Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

Apply review

erwanMarmelabbeaebbce548c
diff --git a/.claude/skills/shadcn-customization/SKILL.md b/.claude/skills/shadcn-customization/SKILL.md
index b9ae3d76..efa2b98e 100644
--- a/.claude/skills/shadcn-customization/SKILL.md
+++ b/.claude/skills/shadcn-customization/SKILL.md
@@ -75,7 +75,7 @@ npx shadcn@latest apply --preset nova
npx shadcn@latest init --preset nova --force --no-reinstall
# Use a custom theme URL.
-npx shadcn@latest apply --preset "https://ui.shadcn.com/init?base=radix&style=nova&theme=blue&..."
+npx shadcn@latest apply --preset "https://ui.shadcn.com/init?base=base-ui&style=base-vega&theme=blue&..."
```
Or edit CSS variables directly in `globals.css`.
@@ -152,7 +152,7 @@ Compose shadcn/ui primitives into higher-level components:
export function ConfirmDialog({ title, description, onConfirm, children }) {
return (
<AlertDialog>
- <AlertDialogTrigger asChild>{children}</AlertDialogTrigger>
+ <AlertDialogTrigger render={children} />
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>{title}</AlertDialogTitle>
diff --git a/AGENTS.md b/AGENTS.md
index ce4d1868..6c6b6104 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -55,7 +55,7 @@ make registry-build # Build Shadcn registry
- **Data Fetching**: React Query (TanStack Query)
- **Forms**: React Hook Form
- **Application Logic**: shadcn-admin-kit + ra-core (react-admin headless)
-- **UI Components**: Shadcn UI + Radix UI
+- **UI Components**: Shadcn UI (`base-vega` style) + Base UI
- **Styling**: Tailwind CSS v4
- **Backend**: Supabase (PostgreSQL + REST API + Auth + Storage + Edge Functions)
- **Testing**: Vitest
diff --git a/doc/src/content/docs/developers/getting-updates.mdx b/doc/src/content/docs/developers/getting-updates.mdx
index be152e8b..c61fa9ac 100644
--- a/doc/src/content/docs/developers/getting-updates.mdx
+++ b/doc/src/content/docs/developers/getting-updates.mdx
@@ -7,6 +7,26 @@ Atomic CRM is meant to be forked and customized: there is no npm package to inst
This registry is not meant to bootstrap a new project. If you're starting a new CRM, follow the [Installation](https://github.com/marmelab/atomic-crm#installation) instructions instead. The registry is only useful once you already have a running fork and want to catch up with upstream improvements (bug fixes, new features, dependency bumps in `src/components/admin` and `src/components/ui`).
+## One-off: Switching Your Fork to Base UI
+
+Atomic CRM now builds on [Base UI](https://base-ui.com/) instead of Radix UI, following [Shadcn Admin Kit 2.0](https://marmelab.com/shadcn-admin-kit/docs/migrate). Before pulling this release into an older fork, switch your own `components.json` to the Base UI style:
+
+```json
+{
+ "style": "base-vega"
+}
+```
+
+Skipping this step leaves the `src/components/ui` files your fork already owns on Radix while the incoming application code uses the Base UI API (`render` instead of `asChild`, an `items` map on `<Select>`, array values on `<ToggleGroup>`), and `tsc` will fail.
+
+Your own components keep using Radix until you migrate them. Shadcn ships an agent skill for that, one component at a time:
+
+```sh
+pnpm dlx skills add shadcn/ui
+```
+
+Then ask your coding agent `migrate accordion to base-ui`, and so on. The [Shadcn Admin Kit migration guide](https://marmelab.com/shadcn-admin-kit/docs/migrate) covers the details.
+
## Refreshing Your Fork
Commit or stash any pending work first, this command overwrites files, and you'll want a clean diff to review the changes:
diff --git a/registry.json b/registry.json
index 2f20432b..a8cdb99e 100644
--- a/registry.json
+++ b/registry.json
@@ -9,11 +9,11 @@
"title": "Atomic CRM",
"description": "A fully fledged CRM application built with Shadcn Admin Kit",
"registryDependencies": [
- "item",
- "progress",
- "tabs",
- "toggle",
- "toggle-group",
+ "https://ui.shadcn.com/r/styles/base-vega/item.json",
+ "https://ui.shadcn.com/r/styles/base-vega/progress.json",
+ "https://ui.shadcn.com/r/styles/base-vega/tabs.json",
+ "https://ui.shadcn.com/r/styles/base-vega/toggle.json",
+ "https://ui.shadcn.com/r/styles/base-vega/toggle-group.json",
"https://marmelab.com/shadcn-admin-kit/r/admin.json"
],
"dependencies": [
@@ -30,7 +30,9 @@
"dompurify@^3.3.1",
"marked@^17.0.1",
"@streamparser/json-whatwg@^0.0.22",
- "mime@^4.1.0"
+ "mime@^4.1.0",
+ "@base-ui/react@^1.8.0",
+ "date-fns@^4.4.0"
],
"files": [
{
diff --git a/src/components/admin/select-input.tsx b/src/components/admin/select-input.tsx
index b7261e85..a786b3f0 100644
--- a/src/components/admin/select-input.tsx
+++ b/src/components/admin/select-input.tsx
@@ -243,6 +243,15 @@ export const SelectInput = (props: SelectInputProps) => {
field.onChange(emptyValue);
};
+ // The clear button sits inside the trigger, and Base UI opens the select on
+ // mousedown. Since the popup is aligned over the trigger, the mouseup would land
+ // on the popup and no click would ever reach the button. Swallowing the mousedown
+ // keeps the select closed so the click below can run.
+ const handleResetMouseDown = (e: React.MouseEvent<HTMLDivElement>) => {
+ e.preventDefault();
+ e.stopPropagation();
+ };
+
return (
<>
<FormField
@@ -290,8 +299,10 @@ export const SelectInput = (props: SelectInputProps) => {
{field.value && field.value !== emptyValue ? (
<div
role="button"
+ aria-label={translate("ra.action.clear_input_value")}
className="p-0 ml-auto pointer-events-auto hover:bg-transparent text-muted-foreground opacity-50 hover:opacity-100"
onClick={handleReset}
+ onMouseDown={handleResetMouseDown}
>
<X className="h-4 w-4" />
</div>
diff --git a/src/components/atomic-crm/contacts/ContactEdit.test.tsx b/src/components/atomic-crm/contacts/ContactEdit.test.tsx
index d458c5ba..2dabfc23 100644
--- a/src/components/atomic-crm/contacts/ContactEdit.test.tsx
+++ b/src/components/atomic-crm/contacts/ContactEdit.test.tsx
@@ -145,6 +145,31 @@ describe("ContactEdit", () => {
}),
);
});
+
+ it("keeps the select closed when pressing the clear button of the email type", async () => {
+ // Arrange: the email type select holds "Work", so its clear button is shown.
+ const screen = await render(<ContactEditWithEmailsAndPhones silent />);
+ await expect
+ .element(screen.getByPlaceholder("Email"))
+ .toHaveValue("[email protected]");
+ const clearButton = screen
+ .getByRole("button", { name: "Clear value" })
+ .first();
+ await expect.element(clearButton).toBeInTheDocument();
+
+ // Act: Base UI opens a select on mousedown, not on click. A plain .click()
+ // is too fast to expose that, so press and let the popup have its frames.
+ clearButton
+ .element()
+ .dispatchEvent(new MouseEvent("mousedown", { bubbles: true }));
+ await new Promise((resolve) =>
+ requestAnimationFrame(() => requestAnimationFrame(resolve)),
+ );
+
+ // Assert: the popup must not have opened, otherwise it would cover the
+ // trigger and swallow the mouseup, leaving the value uncleared.
+ expect(document.querySelector('[data-slot="select-content"]')).toBeNull();
+ });
});
describe("mobile", () => {
beforeAll(() => {
diff --git a/src/components/atomic-crm/dashboard/DashboardStepper.test.tsx b/src/components/atomic-crm/dashboard/DashboardStepper.test.tsx
index 557c666a..6aec2347 100644
--- a/src/components/atomic-crm/dashboard/DashboardStepper.test.tsx
+++ b/src/components/atomic-crm/dashboard/DashboardStepper.test.tsx
@@ -35,6 +35,21 @@ describe("DashboardStepper", () => {
.toHaveAttribute("href", "/contacts/create");
});
+ it("shows the add note button as disabled while no contact exists", async () => {
+ // Arrange: at step 1 the stepper disables "Add note".
+ const screen = await render(<FirstStep />);
+ const addNote = screen.getByRole("button", { name: "Add note" });
+ await expect.element(addNote).toBeVisible();
+
+ // Assert: it is announced as disabled, and it also LOOKS disabled. Base UI
+ // renders it as a link, on which the native :disabled pseudo-class never
+ // matches, so styling it relies on the data-disabled attribute instead.
+ await expect.element(addNote).toHaveAttribute("aria-disabled", "true");
+ const style = getComputedStyle(addNote.element());
+ expect(style.pointerEvents).toBe("none");
+ expect(Number(style.opacity)).toBeLessThan(1);
+ });
+
it("opens the contact creation sheet on mobile", async () => {
mockIsMobile.mockReturnValue(true);
const screen = await render(<FirstStep />);
diff --git a/src/components/ui/button.tsx b/src/components/ui/button.tsx
index b20f4152..f5ca05e6 100644
--- a/src/components/ui/button.tsx
+++ b/src/components/ui/button.tsx
@@ -3,7 +3,7 @@ import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
const buttonVariants = cva(
- "group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+ "group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 data-disabled:pointer-events-none data-disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
{
variants: {
variant: {