@assure-one/design-system 1.47.1 → 1.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/codemods/lib/entry-map.mjs +4 -0
- package/dist/{brand-scope-DwLzUrSY.d.ts → brand-scope-ObBYNT0J.d.ts} +3 -63
- package/dist/{chunk-6CXI3KRG.js → chunk-FO2WSYUA.js} +796 -336
- package/dist/chunk-FO2WSYUA.js.map +1 -0
- package/dist/{chunk-IIBDSTOG.js → chunk-HV24JSRN.js} +215 -10
- package/dist/chunk-HV24JSRN.js.map +1 -0
- package/dist/{chunk-FIRPQWYR.js → chunk-YRFLK7ER.js} +1258 -270
- package/dist/chunk-YRFLK7ER.js.map +1 -0
- package/dist/css/components.css +1 -1
- package/dist/{data-table-view-D9a1_IRF.d.ts → data-table-view-CNTfzEyS.d.ts} +769 -16
- package/dist/{design-system-provider-C6Tu1vyg.d.ts → design-system-provider-YblRtwYw.d.ts} +1 -1
- package/dist/index.d.ts +914 -392
- package/dist/index.js +3227 -340
- package/dist/index.js.map +1 -1
- package/dist/legacy/index.d.ts +4 -3
- package/dist/legacy/index.js +2 -2
- package/dist/next/index.d.ts +2 -2
- package/dist/option-izy_4w4Z.d.ts +64 -0
- package/dist/styles.css +1 -1
- package/dist/suite/index.d.ts +38 -4
- package/dist/suite/index.js +2 -2
- package/dist/{types-BTHIs2nk.d.ts → types-CKpkEBvW.d.ts} +282 -1
- package/docs/components.md +19 -7
- package/docs/components.registry.json +152 -8
- package/package.json +2 -1
- package/dist/chunk-6CXI3KRG.js.map +0 -1
- package/dist/chunk-FIRPQWYR.js.map +0 -1
- package/dist/chunk-IIBDSTOG.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/foundation/theme/theme-scope.tsx","../src/lib/micro-interactions.ts","../src/primitives/behavior/button-base.ts","../src/primitives/spinner.tsx","../src/foundation/anatomy/define.ts","../src/foundation/anatomy/slots.ts","../src/foundation/anatomy/slot.ts","../src/foundation/deprecate.ts","../src/primitives/behavior/button-deprecations.ts","../src/primitives/behavior/inert.ts","../src/primitives/button.tsx","../src/foundation/messages/en.ts","../src/foundation/provider/context.tsx","../src/foundation/anatomy/class-names.ts","../src/primitives/avatar.tsx","../src/foundation/id.ts","../src/primitives/field/internal/accessible-name.ts","../src/primitives/field/internal/field-context.ts","../src/primitives/field/use-field-control.ts","../src/foundation/provider/portal-container.tsx","../src/primitives/behavior/portal.tsx","../src/primitives/behavior/presence.tsx","../src/primitives/tooltip.tsx","../src/primitives/behavior/control-size.ts","../src/primitives/icon-button.tsx","../src/foundation/use-controllable-state.ts","../src/primitives/behavior/collection/item-attributes.ts","../src/primitives/behavior/collection/item-recipe.ts","../src/primitives/behavior/button-type.ts","../src/primitives/behavior/form-bridge.tsx","../src/primitives/select.tsx","../src/foundation/merge-refs.ts","../src/primitives/behavior/control-label.ts","../src/primitives/field/internal/fieldset-context.ts","../src/primitives/checkbox.tsx","../src/primitives/pressable.tsx","../src/primitives/behavior/overlay/recipes.ts","../src/primitives/behavior/overlay/parts.tsx","../src/primitives/behavior/overlay/modal.ts","../src/primitives/popover.tsx","../src/primitives/behavior/menu/content.ts","../src/primitives/behavior/menu/item-recipe.ts","../src/primitives/dropdown-menu.tsx","../src/primitives/file-chip.tsx","../src/primitives/file-upload.tsx","../src/primitives/behavior/control-chrome.ts","../src/primitives/input.tsx","../src/primitives/behavior/form-reset.ts","../src/primitives/textarea.tsx","../src/suite/documents/document-detail-panel.tsx"],"names":["ThemeScope","resolvedIntent","cva","forwardRef","Spinner","jsx","Button","jsxs","text","createContext","useContext","useMemo","React","Avatar","useReactId","Portal","React2","React3","IconButton","Slot","useState","useRef","useCallback","useId","useEffect","React4","React5","Checkbox","Pressable","React8","FileChip","Fragment","Input","useFormReset","Textarea","DocumentDetailPanel","DocumentDetailHeader","DocumentDetailTitle","DocumentDetailRequester","DocumentDetailMetaRow","DocumentDetailActions","DocumentDetailBody","DocumentList","Document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AA,UACC,wBAAQA,GAAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,2CAA2C,QAAA,EAAA,IAAA,EAAK;AAAA,SAAA,EAC1E,CAAA;AAAA,QACC,2BAAWA,GAAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,kDAAkD,QAAA,EAAA,OAAA,EAAQ;AAAA;AAAA;AAAA,GACvF;AAEJ,CAAC;AACD,WAAA,CAAY,WAAA,GAAc,aAAA","file":"chunk-HV24JSRN.js","sourcesContent":["\"use client\";\n\nimport { createContext, forwardRef, useContext, useMemo, type ReactNode } from \"react\";\n\nimport type { BrandTheme } from \"./brand-theme\";\n\n/**\n * Theme scope — the host dimensions a subtree renders with (W5-02).\n *\n * The design system's scopes are DOM attributes: `[data-ds-scheme]`,\n * `[data-ds-brand]`, `[data-ds-density]`, `dir`, and the `--ds-*` style a\n * runtime brand writes (`createBrandTheme`). Set on the document root they\n * reach everything, portalled overlays included. Set on a *subtree* they stop\n * at the subtree: a Dialog or Popover opened from inside it renders in\n * `document.body`, outside the scope, and comes up in the root theme.\n *\n * `ThemeScope` fixes that. It stamps the attributes on its own element, as a\n * hand-written scope would, **and** registers them in context, so the shared\n * `Portal` (`primitives/behavior/portal.tsx`) can re-stamp the same attributes\n * and runtime-brand style on the container wrapper it mounts portalled content\n * into. Nested scopes merge: a `density=\"compact\"` scope inside a `brand=\"tax\"`\n * one propagates both.\n *\n * Apps that scope the document root need none of this; the portal path is\n * unchanged for them (no wrapper is created).\n */\n\n/** The scheme a subtree renders with (`[data-ds-scheme]`). */\nexport type ThemeScheme = \"light\" | \"dark\";\n/** A built-in brand scope (`[data-ds-brand]`). */\nexport type ThemeBrand = \"pro\" | \"audit\" | \"books\" | \"tax\";\n/** The density scope (`[data-ds-density]`, W2-06). */\nexport type ThemeDensity = \"comfortable\" | \"compact\";\n/** Text direction (`dir`). */\nexport type ThemeDirection = \"ltr\" | \"rtl\";\n\n/**\n * The dimensions a scope sets. Every field is optional; an unset field is\n * inherited from the enclosing scope, then from the document.\n *\n * @experimental\n */\nexport interface ThemeScopeValue {\n scheme?: ThemeScheme | undefined;\n brand?: ThemeBrand | undefined;\n density?: ThemeDensity | undefined;\n dir?: ThemeDirection | undefined;\n /**\n * A registered runtime brand: the object `createBrandTheme()` returns. It is\n * applied as inline `--ds-*` style on the scope element and re-applied on\n * portalled content.\n */\n brandTheme?: BrandTheme | undefined;\n}\n\nconst ThemeScopeContext = createContext<ThemeScopeValue | null>(null);\n\n/**\n * The merged scope registered by the nearest `ThemeScope` ancestors, or\n * `null` when the subtree is scoped by the document root only. Internal:\n * the shared `Portal` reads it to re-stamp portalled content.\n */\nexport function useThemeScope(): ThemeScopeValue | null {\n return useContext(ThemeScopeContext);\n}\n\nfunction mergeScopes(parent: ThemeScopeValue | null, own: ThemeScopeValue): ThemeScopeValue {\n const merged: ThemeScopeValue = { ...parent };\n if (own.scheme !== undefined) merged.scheme = own.scheme;\n if (own.brand !== undefined) merged.brand = own.brand;\n if (own.density !== undefined) merged.density = own.density;\n if (own.dir !== undefined) merged.dir = own.dir;\n if (own.brandTheme !== undefined) merged.brandTheme = own.brandTheme;\n return merged;\n}\n\n/**\n * The attributes a scope stamps: on the `ThemeScope` element, and again on the\n * container wrapper the `Portal` creates for content that originates inside it.\n * Internal.\n */\nexport function themeScopeAttributes(scope: ThemeScopeValue): {\n \"data-ds-scheme\"?: ThemeScheme | undefined;\n \"data-ds-brand\"?: ThemeBrand | undefined;\n \"data-ds-density\"?: ThemeDensity | undefined;\n dir?: ThemeDirection | undefined;\n} {\n return {\n \"data-ds-scheme\": scope.scheme,\n \"data-ds-brand\": scope.brand,\n \"data-ds-density\": scope.density,\n dir: scope.dir,\n };\n}\n\n/**\n * Registers a scope in context without rendering an element. For a provider\n * that already owns the scoped element (`DesignSystemProvider`, W5-20, renders\n * no DOM wrapper); components use `ThemeScope`. Internal.\n */\nexport function ThemeScopeProvider({\n value,\n children,\n}: {\n value: ThemeScopeValue;\n children?: ReactNode;\n}) {\n const parent = useThemeScope();\n // `value` must be referentially stable across renders (memoise it at the call\n // site): the Portal keys its container wrapper on the merged scope.\n const merged = useMemo(() => mergeScopes(parent, value), [parent, value]);\n return <ThemeScopeContext value={merged}>{children}</ThemeScopeContext>;\n}\n\n/** Props of {@link ThemeScope}. @experimental */\nexport interface ThemeScopeProps\n extends ThemeScopeValue,\n Omit<React.HTMLAttributes<HTMLDivElement>, \"dir\"> {\n children?: ReactNode;\n}\n\n/**\n * A `<div>` that scopes the host dimensions of its subtree — scheme, brand,\n * density, direction and a runtime brand — and propagates them into every\n * overlay opened from inside it (Dialog, Sheet, Popover, Tooltip, menus,\n * Select, Toast …), which would otherwise render in the document's theme.\n *\n * ```tsx\n * <ThemeScope brand=\"tax\" density=\"compact\">\n * <Popover>…</Popover> // its content renders as compact Tax, too\n * </ThemeScope>\n *\n * <ThemeScope brandTheme={createBrandTheme({ brand: firm.primary })}>\n * <Dialog>…</Dialog> // the runtime brand follows the dialog to <body>\n * </ThemeScope>\n * ```\n *\n * Nothing changes for apps that scope `<html>` or `<body>`: no wrapper is\n * created around portalled content when no `ThemeScope` encloses it.\n *\n * @experimental W5-02. The public shape follows decision D7 for the runtime\n * brand seed.\n */\nexport const ThemeScope = forwardRef<HTMLDivElement, ThemeScopeProps>(function ThemeScope(\n { scheme, brand, density, dir, brandTheme, style, children, ...props },\n ref,\n) {\n const value = useMemo<ThemeScopeValue>(\n () => ({ scheme, brand, density, dir, brandTheme }),\n [scheme, brand, density, dir, brandTheme],\n );\n return (\n <ThemeScopeProvider value={value}>\n <div\n ref={ref}\n {...themeScopeAttributes(value)}\n style={brandTheme ? { ...(brandTheme as React.CSSProperties), ...style } : style}\n {...props}\n >\n {children}\n </div>\n </ThemeScopeProvider>\n );\n});\n\nThemeScope.displayName = \"ThemeScope\";\n","/** GENERATED FILE — do not edit.\n * Source: tokens/src/motion-recipes.json (ADR-003).\n * Generator: tokens/build/generate-motion.mjs. Change the source and run\n * `pnpm tokens:build`; `pnpm tokens:check` fails when this file is stale.\n *\n * Internal microinteraction recipes.\n *\n * These strings deliberately remain static so Tailwind can discover every\n * utility at build time. Components own their state selectors and geometry;\n * the recipes only standardize timing, easing, transitioned properties, and\n * reduced-motion behavior.\n */\nexport const microInteractions = {\n control:\n \"ds:transition-[color,background-color,border-color,box-shadow] ds:duration-[var(--motion-duration-feedback)] ds:ease-[var(--motion-ease-enter)] ds:motion-reduce:transition-none\",\n pressable:\n \"ds:transition-[color,background-color,border-color,box-shadow,transform] ds:[transition-duration:var(--motion-duration-feedback),var(--motion-duration-feedback),var(--motion-duration-feedback),var(--motion-duration-feedback),var(--motion-duration-press)] ds:ease-[var(--motion-ease-enter)] ds:active:scale-[0.98] ds:motion-reduce:transform-none ds:motion-reduce:transition-none\",\n selection:\n \"ds:transition-[color,background-color,border-color,box-shadow] ds:duration-[var(--motion-duration-press)] ds:ease-[var(--motion-ease-enter)] ds:motion-reduce:transition-none\",\n disclosure:\n \"ds:transition-[grid-template-rows,opacity,transform] ds:duration-[var(--motion-duration-spatial)] ds:ease-[var(--motion-ease-move)] ds:motion-reduce:transform-none ds:motion-reduce:transition-none\",\n overlay:\n \"ds:transition-[opacity,transform] ds:duration-[var(--motion-duration-overlay)] ds:ease-[var(--motion-ease-enter)] ds:motion-reduce:transform-none ds:motion-reduce:transition-none\",\n progress:\n \"ds:transition-[width,height,stroke-dashoffset,background-color] ds:duration-[var(--motion-duration-deliberate)] ds:ease-[var(--motion-ease-enter)] ds:motion-reduce:transition-none\",\n reveal:\n \"ds:transition-[opacity,transform] ds:duration-[var(--motion-duration-feedback)] ds:ease-[var(--motion-ease-enter)] ds:motion-reduce:transform-none ds:motion-reduce:transition-none\",\n} as const;\n\nexport type MicroInteractionRecipe = keyof typeof microInteractions;\n","import { cva, type VariantProps } from \"class-variance-authority\";\nimport type { ReactNode } from \"react\";\n\nimport type { ControlSize, Intent, Variant } from \"../../foundation/vocab\";\nimport { cn } from \"../../lib/cn\";\nimport { microInteractions } from \"../../lib/micro-interactions\";\n\n/**\n * L1a behaviour primitive (private). Not exported from the package.\n *\n * `buttonBase` — the one class recipe every button-shaped control renders\n * (W3-03; target architecture §4 L1a, §30), and the `variant` + `intent`\n * resolver in front of it (W3-02; ADR-007). `Button`, `LinkButton` and\n * `SubmitButton` read both through the public `buttonVariants`;\n * `IconButton` (W3-09) and `Chip` (W3-15) read them next, so the geometry,\n * the focus ring, the disabled treatment, the press feedback and the colour\n * table of an action are written once.\n *\n * Two axes, one table: `variant` says how loudly (`solid · soft · outline ·\n * ghost · link`), `intent` says what it means (`brand · neutral · success ·\n * danger`), and every pair has one row in {@link BUTTON_LOOKS}. The legacy\n * single-axis words (`primary`, `secondary`, `destructive`, `success`,\n * `dashed`) resolve to a pair through {@link LEGACY_BUTTON_VARIANTS}\n * and produce the class string they always did:\n * `src/primitives/__tests__/button-legacy-classes.test.tsx` pins every legacy\n * `variant` × `size` to the output recorded from `main` before W3-02.\n *\n * No React, no client directive: plain functions of props to a string, so a\n * Server Component can call them once the root entry is server-safe (S3).\n */\n\n/**\n * The emphases a Button offers: all five of the shared vocabulary.\n *\n * @experimental\n */\nexport type ButtonEmphasis = Variant;\n\n/**\n * The intents a Button offers (ADR-007 §1; `info` and `warning` are not actions).\n *\n * @experimental\n */\nexport type ButtonIntent = Extract<Intent, \"brand\" | \"neutral\" | \"success\" | \"danger\">;\n\n/**\n * `destructive` is accepted where an intent is expected, as an alias of\n * `danger`, until decision D4 settles the canonical word (ADR-007 §5).\n *\n * @deprecated Use `intent=\"danger\"`.\n * @experimental\n */\nexport type ButtonIntentAlias = \"destructive\";\n\n/**\n * The single-axis words Button accepted before W3-02, each a fixed\n * `{ variant, intent }` pair (ADR-007 §4, target architecture §28):\n *\n * - `primary` → `solid` + `brand` (the default; nothing to migrate)\n * - `secondary` → `soft` + `neutral`\n * - `destructive` → `solid` + `danger`\n * - `success` → `solid` + `success`\n * - `dashed` → `outline` + `neutral` with a dashed 2px border; kept for the\n * 2.x line\n *\n * `ghost`, `outline` and `link` are not legacy: they already are emphases.\n * `accent` was removed in 2.0 (C-BTN-ACCENT, decision D13): use `intent=\"brand\"`.\n *\n * @deprecated Pass `variant` (emphasis) and `intent` (meaning) instead. The\n * codemod CM-04 rewrites call sites mechanically.\n * @experimental\n */\nexport type ButtonLegacyVariant = \"primary\" | \"secondary\" | \"destructive\" | \"success\" | \"dashed\";\n\n/** What `variant` accepts on the Button family: the vocabulary plus the deprecated aliases. */\nexport type ButtonVariant = ButtonEmphasis | ButtonLegacyVariant;\n\n/**\n * A row of the colour table: a `variant`/`intent` pair or the legacy-only\n * `dashed` look. The separator is `/`, not `-`: the keys of the table are\n * text Tailwind scans, and an `outline` emphasis joined to an intent with a\n * hyphen would compile to an outline-colour utility nobody asked for.\n *\n * @experimental\n */\nexport type ButtonLook = `${ButtonEmphasis}/${ButtonIntent}` | \"dashed\";\n\n/**\n * The resolved appearance of a Button.\n *\n * @experimental\n */\nexport interface ButtonStyle {\n variant: ButtonEmphasis;\n intent: ButtonIntent;\n /** The row of the colour table the pair renders. */\n look: ButtonLook;\n}\n\n/**\n * The legacy alias map (ADR-007 §4). `look` is set only where the legacy word\n * has a colour of its own that no `variant`/`intent` pair reproduces.\n */\nexport const LEGACY_BUTTON_VARIANTS: Readonly<\n Record<\n ButtonLegacyVariant,\n Readonly<Pick<ButtonStyle, \"variant\" | \"intent\"> & { look?: ButtonLook }>\n >\n> = {\n primary: { variant: \"solid\", intent: \"brand\" },\n secondary: { variant: \"soft\", intent: \"neutral\" },\n destructive: { variant: \"solid\", intent: \"danger\" },\n success: { variant: \"solid\", intent: \"success\" },\n dashed: { variant: \"outline\", intent: \"neutral\", look: \"dashed\" },\n};\n\n/**\n * The intent each emphasis renders when only `variant` is passed (ADR-007\n * §3): today's pixels for `ghost`, `outline` and `link`, and the default pair\n * for `solid`.\n */\nexport const DEFAULT_BUTTON_INTENT: Readonly<Record<ButtonEmphasis, ButtonIntent>> = {\n solid: \"brand\",\n soft: \"neutral\",\n outline: \"neutral\",\n ghost: \"neutral\",\n link: \"brand\",\n};\n\nconst isLegacyVariant = (value: string): value is ButtonLegacyVariant =>\n Object.hasOwn(LEGACY_BUTTON_VARIANTS, value);\n\n/**\n * Resolve what a Button renders from the two-axis props, accepting every\n * legacy word (W3-02, ADR-007 §4).\n *\n * - No `variant`: `solid` + `brand` (what `primary` always rendered).\n * - A legacy `variant` alone: its fixed pair; `dashed` keeps its own look.\n * - A legacy `variant` with an explicit `intent`: the alias contributes its\n * emphasis, the intent is the caller's (`variant=\"primary\" intent=\"danger\"`\n * is a solid danger button). `dashed`'s own look applies only without a\n * competing intent.\n * - `intent=\"destructive\"` is `danger` (deprecated alias, D4).\n *\n * @experimental\n */\nexport function resolveButtonStyle({\n variant,\n intent,\n}: {\n variant?: ButtonVariant | null | undefined;\n intent?: ButtonIntent | ButtonIntentAlias | null | undefined;\n}): ButtonStyle {\n const requested: ButtonIntent | undefined =\n intent === \"destructive\" ? \"danger\" : (intent ?? undefined);\n const word = variant ?? \"primary\";\n if (isLegacyVariant(word)) {\n const legacy = LEGACY_BUTTON_VARIANTS[word];\n const resolvedIntent = requested ?? legacy.intent;\n const look =\n legacy.look && resolvedIntent === legacy.intent\n ? legacy.look\n : (`${legacy.variant}/${resolvedIntent}` as const);\n return { variant: legacy.variant, intent: resolvedIntent, look };\n }\n const resolvedIntent = requested ?? DEFAULT_BUTTON_INTENT[word];\n return { variant: word, intent: resolvedIntent, look: `${word}/${resolvedIntent}` };\n}\n\n/**\n * The colour table, one row per {@link ButtonLook}. The rows the legacy words\n * resolve to (`solid/brand`, `soft/neutral`, `solid/danger`, `solid/success`,\n * `ghost/neutral`, `outline/neutral`, `link/brand`, `dashed`) are\n * the strings the legacy variants rendered before W3-02, unchanged. The other\n * rows are new: each pairs the intent's colour family with the emphasis, on\n * the system tokens the legacy rows already use, so a `ghost` `danger` action\n * is the red-text-red-hover override consumers used to write by hand with a\n * `className` (consumer usage audit §10).\n */\nexport const BUTTON_LOOKS: Readonly<Record<ButtonLook, string>> = {\n // solid — filled with the intent colour, contrasting foreground\n \"solid/brand\":\n \"ds:bg-brand ds:text-fg-on-brand ds:hover:bg-brand-hover ds:active:bg-brand-active\",\n \"solid/neutral\": \"ds:bg-fg-2 ds:text-bg ds:hover:bg-fg ds:active:bg-fg\",\n \"solid/success\":\n \"ds:bg-success-fg ds:text-fg-on-success ds:hover:bg-success-fg-hover ds:active:bg-success-fg-active\",\n \"solid/danger\":\n \"ds:bg-danger-fg ds:text-fg-on-danger ds:hover:bg-danger-fg-hover ds:active:bg-danger-fg-active\",\n // soft — tinted background, intent-coloured foreground, a hairline that shows on hover\n \"soft/brand\":\n \"ds:bg-brand-bg ds:text-brand ds:border ds:border-transparent ds:hover:bg-brand-bg-hover ds:hover:border-brand-line\",\n \"soft/neutral\":\n \"ds:bg-control-secondary-bg ds:text-control-fg ds:border ds:border-control-border ds:hover:bg-control-active-bg ds:hover:border-control-border-strong\",\n \"soft/success\":\n \"ds:bg-success-bg ds:text-success-fg ds:border ds:border-transparent ds:hover:border-success-line\",\n \"soft/danger\":\n \"ds:bg-danger-bg ds:text-danger-fg ds:border ds:border-transparent ds:hover:border-danger-line\",\n // outline — border only, transparent background\n \"outline/brand\":\n \"ds:border ds:border-brand-line ds:bg-control-bg ds:text-brand ds:hover:bg-brand-bg\",\n \"outline/neutral\":\n \"ds:border ds:border-control-border-strong ds:bg-control-bg ds:text-control-fg ds:hover:bg-control-hover-bg ds:hover:border-control-border-hover\",\n \"outline/success\":\n \"ds:border ds:border-success-line ds:bg-control-bg ds:text-success-fg ds:hover:bg-success-bg\",\n \"outline/danger\":\n \"ds:border ds:border-danger-line ds:bg-control-bg ds:text-danger-fg ds:hover:bg-danger-bg\",\n // ghost — nothing until hovered\n \"ghost/brand\": \"ds:bg-control-bg ds:text-brand ds:hover:bg-brand-bg\",\n \"ghost/neutral\":\n \"ds:bg-control-bg ds:text-control-fg ds:hover:bg-control-hover-bg ds:hover:text-control-hover-fg\",\n \"ghost/success\": \"ds:bg-control-bg ds:text-success-fg ds:hover:bg-success-bg\",\n \"ghost/danger\":\n \"ds:bg-control-bg ds:text-control-destructive-fg ds:hover:bg-control-destructive-hover-bg\",\n // link — inline text, underlined on hover; no box of its own\n \"link/brand\":\n \"ds:bg-transparent ds:text-accent ds:underline-offset-4 ds:hover:underline ds:p-0 ds:h-auto ds:active:scale-100\",\n \"link/neutral\":\n \"ds:bg-transparent ds:text-fg ds:underline-offset-4 ds:hover:underline ds:p-0 ds:h-auto ds:active:scale-100\",\n \"link/success\":\n \"ds:bg-transparent ds:text-success-fg ds:underline-offset-4 ds:hover:underline ds:p-0 ds:h-auto ds:active:scale-100\",\n \"link/danger\":\n \"ds:bg-transparent ds:text-danger-fg ds:underline-offset-4 ds:hover:underline ds:p-0 ds:h-auto ds:active:scale-100\",\n // legacy-only look (ADR-007 §4)\n dashed:\n \"ds:border-2 ds:border-dashed ds:border-control-border ds:bg-control-bg ds:text-control-muted-fg ds:hover:border-control-border-hover ds:hover:bg-control-hover-bg ds:hover:text-control-hover-fg\",\n};\n\n/**\n * The size names the recipe knows (W3-05, ADR-013): the shared control scale\n * `xs · sm · md · lg · xl` (`ControlSize`) and the square icon-only steps `icon-xs` / `icon-sm` / `icon` (C-BTN-SIZE-ICON).\n *\n * D5 (W2-05, W3-05): `md` and `lg` now read the shared scale like every\n * other row — `--control-height-md` (36px, was 40) and `--control-height-lg`\n * (40px, was 48), with padding/label size/glyph from the matching\n * `--control-*-{md,lg}` tokens instead of Tailwind's `px-4 text-sm` /\n * `px-6 text-base`. A Button next to an Input/Select at the same `size` is\n * now the same outer height. The old pixels stay defined as\n * `--button-height-md` / `--button-height-lg` (unused by this recipe now,\n * kept per the additive-tokens rule) in case anything else still reads them.\n * `sm` (32px) already agreed with the scale's `sm` step, so it already read\n * the shared row like `xs`/`xl`.\n */\nexport type ButtonSize = ControlSize | ButtonIconSize;\n\n/**\n * The icon-only squares (C-BTN-SIZE-ICON): 24 / 28 / 40px. `IconButton`\n * (W3-09) owns icon-only geometry; the codemod CM-03 rewrites the call sites.\n * Removed in 3.0.\n *\n * @deprecated Use `IconButton`.\n * @experimental\n */\nexport type ButtonIconSize = \"icon-xs\" | \"icon-sm\" | \"icon\";\n\n/**\n * One class string per size name, so the type and the table cannot drift.\n * Heights read a token, never a Tailwind step, so the browser test\n * (`tests/browser/button-sizes.test.tsx`) and the token are the same number.\n */\nconst BUTTON_SIZES: Readonly<Record<ButtonSize, string>> = {\n // Shared scale rows (A1): height, horizontal padding, label size, gap and\n // glyph size all from `--control-*-<size>`.\n xs: \"ds:h-(--control-height-xs) ds:px-(--control-padding-x-xs) ds:text-(length:--control-font-size-xs) ds:gap-(--control-gap-xs) ds:[&_svg]:size-(--control-icon-xs)\",\n // `sm` renders 16px glyphs today (the base `[&_svg]:size-4`), not the\n // scale's 14, so the glyph column is left to the base until D5.\n sm: \"ds:h-(--control-height-sm) ds:px-(--control-padding-x-sm) ds:text-(length:--control-font-size-sm) ds:gap-(--control-gap-sm)\",\n xl: \"ds:h-(--control-height-xl) ds:px-(--control-padding-x-xl) ds:text-(length:--control-font-size-xl) ds:gap-(--control-gap-xl) ds:[&_svg]:size-(--control-icon-xl)\",\n // D5 (W2-05): md/lg now read the shared scale (36px / 40px), same as\n // every other row, instead of the old compat tokens (40px / 48px).\n md: \"ds:h-(--control-height-md) ds:px-(--control-padding-x-md) ds:text-(length:--control-font-size-md) ds:gap-(--control-gap-md)\",\n lg: \"ds:h-(--control-height-lg) ds:px-(--control-padding-x-lg) ds:text-(length:--control-font-size-lg) ds:gap-(--control-gap-lg)\",\n // Icon-only sizes: square, today's pixels through the compat tokens\n // (C-BTN-SIZE-ICON). Hit target ≥ 24px (WCAG 2.5.5 floor); `icon-xs` /\n // `icon-sm` are for dense in-row action stacks where `icon` (40×40) would\n // visually crowd the row. `IconButton` (W3-09) takes over the geometry.\n \"icon-xs\": \"ds:size-(--button-height-icon-xs) ds:[&_svg]:size-3.5\",\n \"icon-sm\": \"ds:size-(--button-height-icon-sm) ds:[&_svg]:size-4\",\n icon: \"ds:size-(--button-height-icon)\",\n};\n\n/**\n * The recipe: base + look + size, in that order — the order `buttonVariants`\n * has always emitted. `look` is the resolved row, never a prop a component\n * exposes; components call {@link buttonVariants}.\n */\nexport const buttonBase = cva(\n cn(\n \"ds:inline-flex ds:items-center ds:justify-center ds:rounded-btn ds:font-medium ds:whitespace-nowrap ds:cursor-pointer\",\n microInteractions.pressable,\n \"ds:focus-visible:outline-none ds:focus-visible:[box-shadow:var(--shadow-focus-ring)]\",\n \"ds:disabled:pointer-events-none ds:[&:disabled:not([data-loading=true])]:bg-bg-disabled ds:[&:disabled:not([data-loading=true])]:text-fg-disabled\",\n // `pointer-events-none` alone leaves the cursor showing whatever's\n // beneath (or the inherited pointer), which reads as clickable in a\n // screenshot or with assistive tooling that bypasses pointer-events.\n // Every other control in the family (Checkbox, RadioGroup, Switch,\n // Tabs, ToggleGroup) already pairs its disabled state with\n // `cursor-not-allowed`; Button/IconButton/Chip share this recipe, so\n // this one line brings all three in line. Excluded while loading,\n // which already gets its own `cursor-wait` below.\n \"ds:[&:disabled:not([data-loading=true])]:cursor-not-allowed\",\n \"ds:data-[loading=true]:cursor-wait\",\n \"ds:[&_svg]:size-4 ds:[&_svg]:shrink-0\",\n ),\n {\n variants: {\n look: BUTTON_LOOKS,\n size: BUTTON_SIZES,\n },\n defaultVariants: {\n look: \"solid/brand\",\n size: \"md\",\n },\n },\n);\n\nexport type ButtonBaseProps = VariantProps<typeof buttonBase>;\n\n/**\n * What {@link buttonVariants} takes: the two axes, the size and cva's class\n * pass-through.\n *\n * @experimental\n */\nexport interface ButtonVariantsProps {\n variant?: ButtonVariant | null | undefined;\n intent?: ButtonIntent | ButtonIntentAlias | null | undefined;\n size?: ButtonSize | null | undefined;\n class?: string | null;\n className?: string | null;\n}\n\n/**\n * The public recipe of the Button family: resolves `variant` + `intent`\n * (legacy words included) and renders the row with the size. Same name and\n * output as before W3-02 for every call that existed; `intent` is the one\n * addition. Server-safe.\n */\nexport function buttonVariants({\n variant,\n intent,\n size,\n class: classProp,\n className,\n}: ButtonVariantsProps = {}): string {\n const { look } = resolveButtonStyle({ variant, intent });\n return buttonBase({ look, size, class: cn(classProp, className) || undefined });\n}\n\n/**\n * The icon slots of the Button family (W3-07). `iconStart` / `iconEnd` are\n * logical — start is the left in LTR and the right in RTL, because the button\n * is a flex row and the slot follows the writing direction. `iconLeft` /\n * `iconRight` are the names consumers use today (140 call sites) and stay as\n * aliases of the same slots.\n *\n * @experimental\n */\nexport interface ButtonIconProps {\n /** Icon before the label (logical start). */\n iconStart?: ReactNode;\n /** Icon after the label (logical end). */\n iconEnd?: ReactNode;\n /**\n * Alias of `iconStart`. The codemod CM-05 renames it.\n *\n * @deprecated Use `iconStart`.\n */\n iconLeft?: ReactNode;\n /**\n * Alias of `iconEnd`. The codemod CM-05 renames it.\n *\n * @deprecated Use `iconEnd`.\n */\n iconRight?: ReactNode;\n}\n\n/**\n * The icon each slot renders. Passing both names of one side is a\n * programming error, not a preference: in development it throws (the two\n * names are one slot, and silently picking one would hide the mistake); in\n * production the new name wins.\n */\nexport function resolveButtonIcons(\n { iconStart, iconEnd, iconLeft, iconRight }: ButtonIconProps,\n component = \"Button\",\n): { start: ReactNode; end: ReactNode } {\n if (process.env.NODE_ENV !== \"production\") {\n if (iconStart !== undefined && iconLeft !== undefined) {\n throw new Error(\n `[${component}] \\`iconStart\\` and \\`iconLeft\\` are the same slot; pass one of them (\\`iconLeft\\` is the deprecated alias).`,\n );\n }\n if (iconEnd !== undefined && iconRight !== undefined) {\n throw new Error(\n `[${component}] \\`iconEnd\\` and \\`iconRight\\` are the same slot; pass one of them (\\`iconRight\\` is the deprecated alias).`,\n );\n }\n }\n return { start: iconStart ?? iconLeft, end: iconEnd ?? iconRight };\n}\n","import { forwardRef } from \"react\";\nimport { cva } from \"class-variance-authority\";\n\nimport type { Intent } from \"../foundation/vocab\";\nimport { cn } from \"../lib/cn\";\n\nimport { LoaderIcon } from \"./icons\";\n\n/**\n * Spinner — indeterminate activity indicator.\n *\n * intent — omitted (default) inherits `currentColor`, so a Spinner inside a\n * Button takes the button's ink; `neutral` | `brand` | `info` |\n * `success` | `warning` | `danger` pick a colour (ADR-007).\n * `tone` is the deprecated spelling: `muted` → `neutral`,\n * `accent` → `info`, `destructive` → `danger`, `current` → omit.\n * size — xs (12px) | sm (16px) | md (20px, default) | lg (24px)\n */\n\n/** Every intent of the shared vocabulary is a Spinner colour. */\nexport type SpinnerIntent = Intent;\n\n/**\n * The pre-W3-21 colour words (compat registry C-TONE).\n *\n * @deprecated Use `intent` — `muted` → `neutral`, `accent` → `info`,\n * `destructive` → `danger`; `current` is the default and is simply omitted.\n * Removed in 3.0; CM-06 rewrites call sites.\n */\nexport type SpinnerTone = \"current\" | \"muted\" | \"accent\" | \"success\" | \"warning\" | \"destructive\";\n\nexport type SpinnerSize = \"xs\" | \"sm\" | \"md\" | \"lg\";\n\n/**\n * Legacy `tone` → `intent` (ADR-007 §4). `current` maps to no intent: the\n * spinner inherits `currentColor`, which is also what an omitted `intent`\n * renders. Classes are identical on both sides.\n */\nexport const SPINNER_TONE_TO_INTENT: Readonly<Record<SpinnerTone, SpinnerIntent | undefined>> = {\n current: undefined,\n muted: \"neutral\",\n accent: \"info\",\n success: \"success\",\n warning: \"warning\",\n destructive: \"danger\",\n};\n\nconst spinnerCva = cva(\n \"ds:inline-flex ds:shrink-0 ds:items-center ds:justify-center ds:[&_svg]:motion-reduce:animate-none\",\n {\n variants: {\n size: {\n xs: \"ds:[&_svg]:size-3\",\n sm: \"ds:[&_svg]:size-4\",\n md: \"ds:[&_svg]:size-5\",\n lg: \"ds:[&_svg]:size-6\",\n },\n // The six intents plus the inherit case; `intent` (public) never says `current`.\n ink: {\n // No `intent` inherits `currentColor` (what `tone=\"current\"` rendered).\n current: \"ds:text-current\",\n neutral: \"ds:text-fg-3\",\n brand: \"ds:text-brand\",\n info: \"ds:text-accent\",\n success: \"ds:text-success-fg\",\n warning: \"ds:text-warning-fg\",\n danger: \"ds:text-danger-fg\",\n },\n },\n defaultVariants: {\n size: \"md\",\n ink: \"current\",\n },\n },\n);\n\nexport interface SpinnerVariantProps {\n /** Semantic colour (ADR-007). Omitted, the spinner inherits `currentColor`. Wins over `tone`. */\n intent?: SpinnerIntent | null | undefined;\n /** @deprecated Use `intent`. `muted` → `neutral`, `accent` → `info`, `destructive` → `danger`. */\n tone?: SpinnerTone | null | undefined;\n size?: SpinnerSize | null | undefined;\n}\n\n/** Resolves the colour a Spinner renders: explicit `intent`, else the aliased `tone`. */\nconst resolveSpinnerIntent = (\n intent?: SpinnerIntent | null,\n tone?: SpinnerTone | null,\n): SpinnerIntent | undefined => intent ?? (tone ? SPINNER_TONE_TO_INTENT[tone] : undefined);\n\n/** The Spinner class string. Accepts `intent` or the deprecated `tone`. */\nexport function spinnerVariants({ intent, tone, size }: SpinnerVariantProps = {}) {\n return spinnerCva({ ink: resolveSpinnerIntent(intent, tone), size });\n}\n\nexport interface SpinnerProps extends React.HTMLAttributes<HTMLSpanElement>, SpinnerVariantProps {\n /**\n * Accessible status text. Omit when adjacent visible copy already names the\n * loading state, such as inside a button labelled \"Saving\".\n */\n label?: string;\n}\n\nexport const Spinner = forwardRef<HTMLSpanElement, SpinnerProps>(function Spinner(\n { intent, tone, size, label, className, ...props },\n ref,\n) {\n return (\n <span\n ref={ref}\n role={label ? \"status\" : undefined}\n aria-live={label ? \"polite\" : undefined}\n className={cn(spinnerVariants({ intent, tone, size }), className)}\n {...props}\n >\n <LoaderIcon className=\"ds:animate-spinner\" aria-hidden=\"true\" />\n {label && <span className=\"ds:sr-only\">{label}</span>}\n </span>\n );\n});\nSpinner.displayName = \"Spinner\";\n","/**\n * L0 foundation (W2-17). Internal: not exported from the package.\n *\n * The slot-name registry behind the anatomy contract (ADR-008, target\n * architecture §29.2). One component declares its parts once:\n *\n * ```ts\n * export const selectAnatomy = defineAnatomy(\"select\", [\"trigger\", \"content\", \"item\"]);\n * export type SelectSlot = SlotOf<typeof selectAnatomy>; // \"trigger\" | \"content\" | \"item\"\n * ```\n *\n * `selectAnatomy.attr(\"trigger\")` is the public `data-slot` value\n * (`\"select-trigger\"`); the part names are the public `classNames` keys.\n * `ROOT_PART` stamps the component name itself, so a root slot reads\n * `data-slot=\"select\"`.\n *\n * Registration is a module-level side effect: the component name may be\n * claimed only once, which is what makes the registry the single source of\n * truth for the naming lint (`scripts/eslint/anatomy-slot-names.mjs`).\n */\n\n/** The part name that stands for the component's own root element. */\nexport const ROOT_PART = \"root\";\n\n/** Component and part names are lower-case kebab: `message-composer`, `below-editor`. */\nexport const NAME_PATTERN = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;\n\nexport interface Anatomy<Part extends string = string> {\n /** The component's name, and the `data-slot` value of its root part. */\n readonly name: string;\n /** Every declared part, in declaration order. */\n readonly parts: readonly Part[];\n /** Every `data-slot` value this component may stamp, in declaration order. */\n readonly attrs: readonly string[];\n /** The `data-slot` value of one part. */\n attr(part: Part): string;\n /** Whether `part` belongs to this component. */\n has(part: string): part is Part;\n}\n\n/** The part union of an anatomy: the `classNames` keys and `slot()` arguments. */\nexport type SlotOf<A extends Anatomy> = A extends Anatomy<infer Part> ? Part : never;\n\nconst registry = new Map<string, Anatomy>();\n\nfunction assertName(value: string, what: string): void {\n if (!NAME_PATTERN.test(value)) {\n throw new TypeError(\n `anatomy: ${what} must be lower-case kebab-case, received ${JSON.stringify(value)}`,\n );\n }\n}\n\n/**\n * Declares a component's parts and registers them under `name`.\n * Throws when a name is malformed, a part is repeated, or the component name\n * is already registered.\n */\nexport function defineAnatomy<const Name extends string, const Parts extends readonly string[]>(\n name: Name,\n parts: Parts,\n): Anatomy<Parts[number]> {\n assertName(name, \"component name\");\n if (parts.length === 0) {\n throw new TypeError(`anatomy: ${name} must declare at least one part`);\n }\n const seen = new Set<string>();\n for (const part of parts) {\n assertName(part, `part name of ${name}`);\n if (seen.has(part)) {\n throw new TypeError(`anatomy: ${name} declares the part ${JSON.stringify(part)} twice`);\n }\n seen.add(part);\n }\n if (registry.has(name)) {\n throw new TypeError(`anatomy: ${name} is already registered`);\n }\n\n const attr = (part: Parts[number]): string =>\n part === ROOT_PART ? name : `${name}-${String(part)}`;\n\n const anatomy: Anatomy<Parts[number]> = {\n name,\n parts: [...parts] as readonly Parts[number][],\n attrs: parts.map((part) => attr(part)),\n attr,\n has: (part: string): part is Parts[number] => seen.has(part),\n };\n registry.set(name, anatomy as Anatomy);\n return anatomy;\n}\n\n/** Every anatomy registered by the modules loaded so far, by component name. */\nexport function registeredAnatomies(): ReadonlyMap<string, Anatomy> {\n return new Map(registry);\n}\n\n/** Every registered `data-slot` value, sorted. */\nexport function registeredSlotAttrs(): readonly string[] {\n return [...registry.values()].flatMap((anatomy) => [...anatomy.attrs]).sort();\n}\n","import { defineAnatomy, type SlotOf } from \"./define\";\n\n/**\n * L0 foundation (W2-17). Internal: not exported from the package.\n *\n * The slot registry: every `data-slot` name the library may stamp lives here,\n * so one file answers \"is this slot name real?\" for reviewers, for the docs\n * template and for the `ds/anatomy-slot-names` lint rule.\n *\n * This file only *describes* names. W2-17 changes no component; W2-18 adds the\n * attributes to Tier-A components, one family per pull request, and registers\n * each family's parts here as it does.\n *\n * The two `already ships` entries below are the slot names that were live\n * before the registry existed (current-state audit §26) — recorded, not\n * changed. Then come the Wave 2 primitives that were born with slots (W2-14),\n * and everything after those is a W2-18 family.\n *\n * Part names that do not change with a refactor are preferred over names that\n * describe today's element: `icon-start` / `icon-end` rather than\n * `icon-left` / `icon-right`, because the props are renamed in W3-07 and the\n * slot name is the thing consumers cannot have moved under them.\n *\n * Each family's part union is written out as a literal union rather than as\n * `SlotOf<typeof xAnatomy>`, because the component re-exports it and the\n * public API report only records the *names* when the alias resolves to them.\n * `anatomy.test.ts` asserts each union equals the registered parts, so the two\n * spellings cannot drift.\n */\n\n/* ── already ships (current-state audit §26) ─────────────────────────────── */\n\nexport const agreementViewerAnatomy = defineAnatomy(\"agreement-viewer\", [\"root\"]);\nexport type AgreementViewerSlot = SlotOf<typeof agreementViewerAnatomy>;\n\nexport const messageComposerAnatomy = defineAnatomy(\"message-composer\", [\n \"root\",\n \"header\",\n \"chips\",\n \"editor\",\n \"below-editor\",\n \"footer\",\n]);\nexport type MessageComposerSlot = SlotOf<typeof messageComposerAnatomy>;\n\n/* ── W2-14 typography primitives ─────────────────────────────────────────── */\n\nexport const codeAnatomy = defineAnatomy(\"code\", [\"root\", \"content\"]);\n/**\n * `Code` parts, stamped as `data-slot=\"code[-<part>]\"` (ADR-008). Inline, the\n * root is the `<code>`; as a block, the root is the `<pre>` and `content` the\n * `<code>` inside it. State on the root: `data-variant`.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-18).\n */\nexport type CodeSlot = \"root\" | \"content\";\n\nexport const kbdAnatomy = defineAnatomy(\"kbd\", [\"root\"]);\n/**\n * `Kbd` part, stamped as `data-slot=\"kbd\"` (ADR-008). State on the root:\n * `data-variant`. `KbdHint` and `CommandPalette` render it.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-18).\n */\nexport type KbdSlot = \"root\";\n\n/* ── W2-18 actions family ────────────────────────────────────────────────── */\n\nexport const pressableAnatomy = defineAnatomy(\"pressable\", [\"root\"]);\n/**\n * `Pressable` has one part, its root, stamped as `data-slot=\"pressable\"`\n * (ADR-008): the element that carries the button behaviour, whether that is\n * the `<button>` it renders or the child it wraps with `asChild`. State on the\n * root: `data-disabled`, `data-pressed`. Components that compose it (`Button`\n * once it adopts the behaviour, a clickable `Surface`) declare their own parts.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W3-03).\n */\nexport type PressableSlot = \"root\";\n\nexport const buttonAnatomy = defineAnatomy(\"button\", [\"root\", \"icon-start\", \"icon-end\", \"spinner\"]);\n/**\n * `Button` parts, stamped as `data-slot=\"button[-<part>]\"` (ADR-008).\n * States on the root: `data-variant`, `data-size`, `data-disabled`, and the\n * pre-existing `data-loading=\"true\"`.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-18).\n */\nexport type ButtonSlot = \"root\" | \"icon-start\" | \"icon-end\" | \"spinner\";\n\nexport const linkButtonAnatomy = defineAnatomy(\"link-button\", [\"root\", \"icon-start\", \"icon-end\"]);\n/**\n * `LinkButton` parts, stamped as `data-slot=\"link-button[-<part>]\"` (ADR-008).\n * States on the root: `data-variant`, `data-size`.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-18).\n */\nexport type LinkButtonSlot = \"root\" | \"icon-start\" | \"icon-end\";\n\nexport const badgeAnatomy = defineAnatomy(\"badge\", [\"root\", \"dot\", \"icon\"]);\n/**\n * `Badge` parts, stamped as `data-slot=\"badge[-<part>]\"` (ADR-008).\n * States on the root: `data-variant`, `data-size`.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-18).\n */\nexport type BadgeSlot = \"root\" | \"dot\" | \"icon\";\n\n/* ── W2-18 form family ───────────────────────────────────────────────────── */\n\nexport const inputAnatomy = defineAnatomy(\"input\", [\n \"root\",\n \"label\",\n \"icon-start\",\n \"icon-end\",\n \"password-toggle\",\n \"description\",\n \"error\",\n]);\n/**\n * `Input` parts, stamped as `data-slot=\"input[-<part>]\"` (ADR-008).\n * `root` is the `<input>` itself — the control frame, and the element\n * `className` lands on (`C-INPUT-CLASSNAME`). The wrappers around it are\n * private (target architecture §29.2).\n * States on the root: `data-variant`, `data-size`, `data-disabled`,\n * `data-invalid`. `description` is the `description` sugar's hint text (W4-05).\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-18).\n */\nexport type InputSlot =\n | \"root\"\n | \"label\"\n | \"icon-start\"\n | \"icon-end\"\n | \"password-toggle\"\n | \"description\"\n | \"error\";\n\nexport const textareaAnatomy = defineAnatomy(\"textarea\", [\n \"root\",\n \"label\",\n \"description\",\n \"error\",\n \"count\",\n]);\n/**\n * `Textarea` parts, stamped as `data-slot=\"textarea[-<part>]\"` (ADR-008).\n * `root` is the `<textarea>`. States on the root: `data-variant`, `data-size`,\n * `data-disabled`, `data-invalid`. `description` is the `description` sugar's\n * hint text (W4-06).\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-18).\n */\nexport type TextareaSlot = \"root\" | \"label\" | \"description\" | \"error\" | \"count\";\n\nexport const searchInputAnatomy = defineAnatomy(\"search-input\", [\n \"root\",\n \"control\",\n \"icon\",\n \"clear\",\n]);\n/**\n * `SearchInput` parts, stamped as `data-slot=\"search-input[-<part>]\"`\n * (ADR-008). `root` is the positioning wrapper `className` lands on;\n * `control` is the `<input type=\"search\">`.\n * States on the root: `data-size`, `data-disabled`.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-18).\n */\nexport type SearchInputSlot = \"root\" | \"control\" | \"icon\" | \"clear\";\n\nexport const selectAnatomy = defineAnatomy(\"select\", [\n \"root\",\n \"trigger\",\n \"value\",\n \"icon\",\n \"clear\",\n \"content\",\n \"viewport\",\n \"item\",\n \"item-indicator\",\n \"label\",\n \"separator\",\n \"scroll-up-button\",\n \"scroll-down-button\",\n]);\n/**\n * `Select` parts, stamped as `data-slot=\"select-<part>\"` (ADR-008).\n * `SelectRoot` renders no element: `root` is the wrapper the options-driven\n * `Select clearable` renders around the trigger and the `clear` button (W4-08),\n * and exists only then. Radix's own `data-state`, `data-disabled`,\n * `data-placeholder` and `data-highlighted` are left as they are\n * (`P-DATA-STATE`); the trigger adds `data-size` when a `size` is set.\n *\n * `SelectValue` and `SelectGroup` are re-exported Radix components with no\n * wrapper of ours, so they carry no slot of their own. `value` is the span\n * the options-driven `Select` wraps Radix's value in when `classNames.value`\n * or `clearable` asks for it (Radix's own span drops `className`); a legacy\n * call renders no wrapper, so the `SelectTrigger > span` structure PRO selects\n * on stays as frozen by `C-DOM-10`.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-18).\n */\nexport type SelectSlot =\n | \"root\"\n | \"trigger\"\n | \"value\"\n | \"icon\"\n | \"clear\"\n | \"content\"\n | \"viewport\"\n | \"item\"\n | \"item-indicator\"\n | \"label\"\n | \"separator\"\n | \"scroll-up-button\"\n | \"scroll-down-button\";\n\nexport const checkboxAnatomy = defineAnatomy(\"checkbox\", [\"root\", \"indicator\", \"label\"]);\n/**\n * `Checkbox` parts, stamped as `data-slot=\"checkbox[-<part>]\"` (ADR-008).\n * `root` is the Radix root — the box, and the element `className` lands on.\n * Radix's `data-state` (`checked` / `unchecked` / `indeterminate`) is left as\n * it is; `data-shape` is not part of the state vocabulary, so the shape stays\n * a class until W4-13.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-18).\n */\nexport type CheckboxSlot = \"root\" | \"indicator\" | \"label\";\n\nexport const radioGroupAnatomy = defineAnatomy(\"radio-group\", [\n \"root\",\n \"item\",\n \"indicator\",\n \"label\",\n \"card\",\n \"description\",\n]);\n/**\n * `RadioGroup` / `RadioGroupItem` parts, stamped as\n * `data-slot=\"radio-group[-<part>]\"` (ADR-008). `root` is the group,\n * `item` the radio. Radix's `data-state` is left as it is. With\n * `appearance=\"card\"` (W4-14) the root carries `data-appearance=\"card\"` and\n * every item is wrapped in a `card` holding the `label` (stretched over the\n * card, so the whole box is the click target) and an optional `description`.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-18).\n */\nexport type RadioGroupSlot = \"root\" | \"item\" | \"indicator\" | \"label\" | \"card\" | \"description\";\n\nexport const switchAnatomy = defineAnatomy(\"switch\", [\"root\", \"thumb\", \"label\"]);\n/**\n * `Switch` parts, stamped as `data-slot=\"switch[-<part>]\"` (ADR-008).\n * `root` is the Radix root — the track, and the element `className` lands on;\n * the label wrapper is a private wrapper. States on the root: `data-size`.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-18).\n */\nexport type SwitchSlot = \"root\" | \"thumb\" | \"label\";\n\nexport const labelAnatomy = defineAnatomy(\"label\", [\"root\", \"required\"]);\n/**\n * `Label` parts, stamped as `data-slot=\"label[-<part>]\"` (ADR-008).\n * `required` is the asterisk marker.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-18).\n */\nexport type LabelSlot = \"root\" | \"required\";\n\nexport const numberInputAnatomy = defineAnatomy(\"number-input\", [\"root\"]);\n/**\n * `NumberInput` parts, stamped as `data-slot=\"number-input\"` (ADR-008).\n * `root` is the `<input>` itself — the control frame and the element\n * `className` lands on, like `Input`. The hidden inputs `FormBridge` renders\n * next to it are not parts. States on the root: `data-variant`, `data-size`,\n * `data-disabled`, `data-invalid`.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W4-21).\n */\nexport type NumberInputSlot = \"root\";\n\nexport const phoneFieldAnatomy = defineAnatomy(\"phone-field\", [\n \"root\",\n \"country\",\n \"number\",\n \"flag\",\n]);\n/**\n * `PhoneField` parts, stamped as `data-slot=\"phone-field[-<part>]\"` (ADR-008).\n * `root` is the row (the element `className` lands on), `number` the `tel`\n * `<input>` on the control chrome, `flag` a `CountryFlag` (the SVG, or its\n * placeholder while the flag set loads). `country` is the country picker: a\n * `Combobox`, stamped with its own anatomy and styled through\n * `classNames.country`. States on the root: `data-variant`, `data-size`,\n * `data-disabled`, `data-invalid`.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W4-22).\n */\nexport type PhoneFieldSlot = \"root\" | \"country\" | \"number\" | \"flag\";\n\nexport const fileUploadAnatomy = defineAnatomy(\"file-upload\", [\n \"root\",\n \"dropzone\",\n \"input\",\n \"error\",\n]);\n/**\n * `FileUpload` parts, stamped as `data-slot=\"file-upload[-<part>]\"` (ADR-008).\n * `dropzone` is the `<label>` that `C-DOM-04` freezes and that\n * `[&_[data-slot=file-upload-dropzone]]` replaces (target architecture §29.4).\n * States: `data-disabled` and `data-invalid` on the root, `data-disabled` and\n * `data-state=\"drag-over\"` on the dropzone.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-18).\n */\nexport type FileUploadSlot = \"root\" | \"dropzone\" | \"input\" | \"error\";\n\n/* ── W2-18 overlay family ────────────────────────────────────────────────── */\n\nexport const commandAnatomy = defineAnatomy(\"command\", [\n \"overlay\",\n \"content\",\n \"title\",\n \"description\",\n \"root\",\n \"input\",\n \"list\",\n \"empty\",\n \"group\",\n \"item\",\n \"footer\",\n]);\n/**\n * `Command` / `CommandPalette` parts, stamped as `data-slot=\"command-<part>\"`\n * (ADR-008, W5-19). `overlay`, `content`, `title` and `description` are the\n * spotlight modal (`CommandDialog`); `root`, `input`, `list`, `empty`,\n * `group` and `item` are the command-list parts; `footer` is the\n * keyboard-hint strip `CommandPalette` renders below the list.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-18).\n */\nexport type CommandSlot =\n | \"overlay\"\n | \"content\"\n | \"title\"\n | \"description\"\n | \"root\"\n | \"input\"\n | \"list\"\n | \"empty\"\n | \"group\"\n | \"item\"\n | \"footer\";\n\nexport const dialogAnatomy = defineAnatomy(\"dialog\", [\n \"overlay\",\n \"content\",\n \"header\",\n \"title\",\n \"description\",\n \"body\",\n \"footer\",\n \"close\",\n]);\n/**\n * `Dialog` parts, stamped as `data-slot=\"dialog-<part>\"` (ADR-008). There is\n * no `root`: `Dialog` is Radix's non-rendering root. `close` is stamped on\n * both the built-in close button and `DialogClose`; they are the same part —\n * a control that dismisses the dialog. `body` is the scroll region between\n * header and footer (W5-05). States: `data-size` on the content, and\n * `data-variant=\"responsive\"` when it presents as a bottom sheet below `sm`\n * (W5-09). Radix's `data-state` is left as it is (`P-DATA-STATE`).\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-18).\n */\nexport type DialogSlot =\n | \"overlay\"\n | \"content\"\n | \"header\"\n | \"title\"\n | \"description\"\n | \"body\"\n | \"footer\"\n | \"close\";\n\nexport const alertDialogAnatomy = defineAnatomy(\"alert-dialog\", [\n \"overlay\",\n \"content\",\n \"header\",\n \"title\",\n \"description\",\n \"footer\",\n \"action\",\n \"cancel\",\n]);\n/**\n * `AlertDialog` parts, stamped as `data-slot=\"alert-dialog-<part>\"`\n * (ADR-008). No `root` — Radix's root renders no element.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-18).\n */\nexport type AlertDialogSlot =\n | \"overlay\"\n | \"content\"\n | \"header\"\n | \"title\"\n | \"description\"\n | \"footer\"\n | \"action\"\n | \"cancel\";\n\nexport const sheetAnatomy = defineAnatomy(\"sheet\", [\n \"overlay\",\n \"content\",\n \"header\",\n \"title\",\n \"description\",\n \"body\",\n \"footer\",\n \"close\",\n]);\n/**\n * `Sheet` parts, stamped as `data-slot=\"sheet-<part>\"` (ADR-008).\n * `body` is the scroll region between header and footer (W5-07). States:\n * `data-size` on the content, carrying the `size` step (or the deprecated\n * `width` preset, C-SHEET-WIDTH; `default` when neither is given). The\n * `side` is not in the §29.2 vocabulary and stays a class.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-18).\n */\nexport type SheetSlot =\n | \"overlay\"\n | \"content\"\n | \"header\"\n | \"title\"\n | \"description\"\n | \"body\"\n | \"footer\"\n | \"close\";\n\nexport const sideDrawerAnatomy = defineAnatomy(\"side-drawer\", [\n \"overlay\",\n \"root\",\n \"header\",\n \"heading\",\n \"subtitle\",\n \"close\",\n \"body\",\n \"footer\",\n]);\n/**\n * `SideDrawer` parts, stamped as `data-slot=\"side-drawer[-<part>]\"`\n * (ADR-008). `root` is the panel. The screen-reader-only Radix title that the\n * panel always renders is an accessibility fallback, not a part, so it carries\n * no slot. States: `data-size` on the root, carrying the `width` preset.\n *\n * `SideDrawer` itself is `C-SIDEDRAWER` and is replaced by `Sheet` in W5-08;\n * the slots exist so the two can be styled the same way in the meantime.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-18).\n */\nexport type SideDrawerSlot =\n | \"overlay\"\n | \"root\"\n | \"header\"\n | \"heading\"\n | \"subtitle\"\n | \"close\"\n | \"body\"\n | \"footer\";\n\nexport const popoverAnatomy = defineAnatomy(\"popover\", [\"content\"]);\n/**\n * `Popover` parts, stamped as `data-slot=\"popover-content\"` (ADR-008).\n * `Popover`, `PopoverTrigger`, `PopoverAnchor` and `PopoverClose` are bare\n * Radix re-exports, so the content is the only part we render.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-18).\n */\nexport type PopoverSlot = \"content\";\n\n/**\n * The two menus declare the same parts, written out per component so the\n * registry reader (and the lint rule that uses it) can see every name in the\n * `defineAnatomy` call itself. `Menu` internals merge in W5.\n */\nexport const dropdownMenuAnatomy = defineAnatomy(\"dropdown-menu\", [\n \"content\",\n \"item\",\n \"checkbox-item\",\n \"radio-item\",\n \"item-indicator\",\n \"label\",\n \"separator\",\n \"shortcut\",\n \"sub-trigger\",\n \"sub-content\",\n]);\n/**\n * `DropdownMenu` parts, stamped as `data-slot=\"dropdown-menu-<part>\"`\n * (ADR-008). No `root`, no `trigger`: both are bare Radix re-exports.\n * `destructive` items get no `data-intent` yet — W3-02 defines the intent\n * values, and this task does not invent them.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-18).\n */\nexport type DropdownMenuSlot =\n | \"content\"\n | \"item\"\n | \"checkbox-item\"\n | \"radio-item\"\n | \"item-indicator\"\n | \"label\"\n | \"separator\"\n | \"shortcut\"\n | \"sub-trigger\"\n | \"sub-content\";\n\nexport const contextMenuAnatomy = defineAnatomy(\"context-menu\", [\n \"content\",\n \"item\",\n \"checkbox-item\",\n \"radio-item\",\n \"item-indicator\",\n \"label\",\n \"separator\",\n \"shortcut\",\n \"sub-trigger\",\n \"sub-content\",\n]);\n/**\n * `ContextMenu` parts, stamped as `data-slot=\"context-menu-<part>\"`\n * (ADR-008). The same part names as `DropdownMenu`, which is what makes the\n * shared `Menu` internals of W5 a rename-free change for consumers.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-18).\n */\nexport type ContextMenuSlot =\n | \"content\"\n | \"item\"\n | \"checkbox-item\"\n | \"radio-item\"\n | \"item-indicator\"\n | \"label\"\n | \"separator\"\n | \"shortcut\"\n | \"sub-trigger\"\n | \"sub-content\";\n\nexport const tooltipAnatomy = defineAnatomy(\"tooltip\", [\"content\"]);\n/**\n * `Tooltip` parts, stamped as `data-slot=\"tooltip-content\"` (ADR-008).\n * `TooltipTrigger` is a bare Radix re-export.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-18).\n */\nexport type TooltipSlot = \"content\";\n\nexport const toastAnatomy = defineAnatomy(\"toast\", [\n \"region\",\n \"root\",\n \"icon\",\n \"title\",\n \"description\",\n \"action\",\n \"close\",\n]);\n/**\n * `Toast` parts, stamped as `data-slot=\"toast[-<part>]\"` (ADR-008).\n * `region` is the live region; `data-slot=\"toast-region\"` is how consumers\n * locate it (W5-15). Its `aria-label` is not a locator contract since 2.0\n * (C-TOAST-ARIALABEL). States: `data-variant` on the root; its\n * `data-state` (`open` / `closed`) already existed.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-18).\n */\nexport type ToastSlot = \"region\" | \"root\" | \"icon\" | \"title\" | \"description\" | \"action\" | \"close\";\n\n/* ── W2-18 table family ──────────────────────────────────────────────────── */\n\nexport const tableAnatomy = defineAnatomy(\"table\", [\n \"root\",\n \"wrapper\",\n \"header\",\n \"body\",\n \"footer\",\n \"row\",\n \"head\",\n \"cell\",\n \"caption\",\n \"sort\",\n \"sort-indicator\",\n \"group-row\",\n \"group-row-toggle\",\n \"group-row-label\",\n \"group-row-trailing\",\n \"sort-rank\",\n \"resize-handle\",\n \"head-menu\",\n \"cell-secondary\",\n \"spacer-row\",\n \"group-row-count\",\n \"group-row-subtotal\",\n]);\n/**\n * `Table` parts, stamped as `data-slot=\"table[-<part>]\"` (ADR-008).\n * `root` is the `<table>` — the element `className` lands on; `wrapper` is the\n * overflow container that `wrapperClassName` styles today and\n * `classNames.wrapper` replaces (`C-CLASSNAME-PROPS`). `header` is `<thead>`\n * and `head` is a `<th>`, matching the `TableHeader` / `TableHead` component\n * names. Native table semantics are permanent (`P-NATIVE-TABLE`). `sort` is\n * the `<button>` a sortable `TableHead` renders around its label and\n * `sort-indicator` the chevron inside it (W6-01). `group-row` is the\n * full-width `<tr>` a `TableGroupRow` renders (its one `<td colSpan>` cell),\n * with `group-row-toggle`, `group-row-label` and `group-row-trailing` for\n * the collapse button, the overline label and the trailing count/actions\n * slot inside it (fix/cursor-sidebar-tooltips table-standardization work).\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-18).\n */\nexport type TableSlot =\n | \"root\"\n | \"wrapper\"\n | \"header\"\n | \"body\"\n | \"footer\"\n | \"row\"\n | \"head\"\n | \"cell\"\n | \"caption\"\n | \"sort\"\n | \"sort-indicator\"\n | \"group-row\"\n | \"group-row-toggle\"\n | \"group-row-label\"\n | \"group-row-trailing\"\n | \"sort-rank\"\n | \"resize-handle\"\n | \"head-menu\"\n | \"cell-secondary\"\n | \"spacer-row\"\n | \"group-row-count\"\n | \"group-row-subtotal\";\n\nexport const dataTableAnatomy = defineAnatomy(\"data-table\", [\n \"root\",\n \"toolbar\",\n \"spacer\",\n \"results-count\",\n \"header\",\n \"body\",\n \"row\",\n \"head\",\n \"head-button\",\n \"head-indicator\",\n \"cell\",\n \"checkbox-cell\",\n \"search\",\n \"filters\",\n \"columns-menu\",\n \"content\",\n \"bulk-actions\",\n \"pagination\",\n \"head-menu\",\n \"cell-secondary\",\n \"load-more\",\n]);\n/**\n * `DataTable*` parts, stamped as `data-slot=\"data-table[-<part>]\"` (ADR-008).\n * These are `C-DT-PARTS`, the parallel copy of `Table*` that W6-03 folds back\n * in; the part names deliberately match `table`'s so that fold is a no-op for\n * a consumer's selectors (`header` = `<thead>` via `DataTableHead`, `head` =\n * the `<th>` via `DataTableHeader`).\n *\n * `head-button` is the sortable header's `<button>` that `C-DOM-13` freezes.\n * The four cell components share one `cell` part and are told apart by\n * `data-variant` (`name`, `mono`, `id`, `due`).\n *\n * `DataTableSearch` and `DataTablePagination` render an `Input` and a\n * `Pagination` with no wrapper of their own, so they carry those components'\n * slots (`data-slot=\"input\"`, `data-slot=\"pagination\"`) rather than one of\n * their own — stamping over it would delete the inner component's part name.\n * W6-06 gives the search its own `classNames.search` (`C-DOM-18`).\n *\n * The compound `DataTablePattern` (W6-06, `src/patterns/data/data-table.tsx`)\n * renders in the same namespace and adds its slots: `search`, `filters`,\n * `columns-menu`, `content` (the table's overflow wrapper), `bulk-actions`\n * and `pagination`. It is the same component family, so a consumer's\n * `[data-slot^=\"data-table\"]` selectors keep meaning what they meant.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-18).\n */\nexport type DataTableSlot =\n | \"root\"\n | \"toolbar\"\n | \"spacer\"\n | \"results-count\"\n | \"header\"\n | \"body\"\n | \"row\"\n | \"head\"\n | \"head-button\"\n | \"head-indicator\"\n | \"cell\"\n | \"checkbox-cell\"\n | \"search\"\n | \"filters\"\n | \"columns-menu\"\n | \"content\"\n | \"bulk-actions\"\n | \"pagination\"\n | \"head-menu\"\n | \"cell-secondary\"\n | \"load-more\";\n\nexport const paginationAnatomy = defineAnatomy(\"pagination\", [\n \"root\",\n \"label\",\n \"page-size\",\n \"pages\",\n \"previous\",\n \"next\",\n \"page\",\n \"ellipsis\",\n]);\n/**\n * `Pagination` parts, stamped as `data-slot=\"pagination[-<part>]\"` (ADR-008).\n * `root` is the `<nav>`. The current page carries `data-selected` alongside\n * its existing `aria-current=\"page\"`. `page-size` wraps the optional\n * rows-per-page `Select` (W6-09).\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-18).\n */\nexport type PaginationSlot =\n | \"root\"\n | \"label\"\n | \"page-size\"\n | \"pages\"\n | \"previous\"\n | \"next\"\n | \"page\"\n | \"ellipsis\";\n\n/* ── W2-18 shell family ──────────────────────────────────────────────────── */\n\nexport const shellAnatomy = defineAnatomy(\"shell\", [\"root\", \"main\", \"content\"]);\n/**\n * `Shell` / `Main` / `Content` parts, stamped as `data-slot=\"shell[-<part>]\"`\n * (ADR-008). Three elements, three names: the app frame, the column beside the\n * sidebar and the scrolling page region.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-18).\n */\nexport type ShellSlot = \"root\" | \"main\" | \"content\";\n\nexport const sidebarAnatomy = defineAnatomy(\"sidebar\", [\n \"root\",\n \"trigger\",\n \"pin\",\n \"brand\",\n \"brand-text\",\n \"section\",\n \"section-header\",\n \"section-label\",\n \"link\",\n \"link-label\",\n \"link-action\",\n \"link-badge\",\n \"group\",\n \"group-link\",\n \"group-trigger\",\n \"group-content\",\n \"footer\",\n \"user\",\n \"user-name\",\n \"user-subtitle\",\n]);\n/**\n * `Sidebar` and its parts, stamped as `data-slot=\"sidebar[-<part>]\"`\n * (ADR-008). This is the anatomy `C-DOM-06` is waiting for: PRO and TAX carry\n * identical copies of `group-data-[labels=hide]/sidebar:*` and\n * `[&>div:first-child]` overrides because there is no name for\n * `section-header`, `link-label` or `user` today.\n *\n * `group/sidebar`, `data-labels`, `data-state`, `data-collapsible` and\n * `data-variant` on the root are **unchanged** — they are the frozen part of\n * `C-DOM-06`, and no state attribute is re-stamped over them. (`data-peek` and\n * `data-overlay` were only ever present mid-hover-peek; with peek removed they\n * are never set.) W7-03 adds `data-collapsed` to the slots and the `SidebarSection`\n * header slot; this change only names the parts.\n *\n * `group` is a `SidebarLinkGroup`: `group-link` is its activating row,\n * `group-trigger` its chevron and `group-content` the collapsible body.\n * The `tone` props on `SidebarSection` and `SidebarLinkBadge` get no\n * `data-intent`: they are `C-TONE`, and W3-21 defines the intent values.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-18).\n */\nexport type SidebarSlot =\n | \"root\"\n | \"trigger\"\n | \"pin\"\n | \"brand\"\n | \"brand-text\"\n | \"section\"\n | \"section-header\"\n | \"section-label\"\n | \"link\"\n | \"link-label\"\n | \"link-action\"\n | \"link-badge\"\n | \"group\"\n | \"group-link\"\n | \"group-trigger\"\n | \"group-content\"\n | \"footer\"\n | \"user\"\n | \"user-name\"\n | \"user-subtitle\";\n\nexport const sidebarBrandSwitcherAnatomy = defineAnatomy(\"sidebar-brand-switcher\", [\n \"root\",\n \"trigger\",\n \"icon\",\n \"mark\",\n]);\n/**\n * `SidebarBrandSwitcher` parts, stamped as\n * `data-slot=\"sidebar-brand-switcher[-<part>]\"` (ADR-008). Its menu is a\n * `DropdownMenuContent` and keeps that component's slots; its `trailing`\n * children are rendered bare, with no wrapper of ours to name (W7-03 gives\n * them one).\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-18).\n */\nexport type SidebarBrandSwitcherSlot = \"root\" | \"trigger\" | \"icon\" | \"mark\";\n\n/* ── W2-12 / W2-13 typography primitives ─────────────────────────────────── */\n\nexport const textAnatomy = defineAnatomy(\"text\", [\"root\"]);\n/**\n * `Text` parts, stamped as `data-slot=\"text\"` (ADR-008). One part: the\n * element that carries the role, and the element `className` lands on (with\n * `asChild`, the child the caller supplied).\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-12).\n */\nexport type TextSlot = \"root\";\n\nexport const headingAnatomy = defineAnatomy(\"heading\", [\"root\"]);\n/**\n * `Heading` parts, stamped as `data-slot=\"heading\"` (ADR-008). One part: the\n * `<h1>`…`<h6>` itself, which is the element `className` lands on.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-13).\n */\nexport type HeadingSlot = \"root\";\n/* ── W2-15 / W2-16 layout primitives ─────────────────────────────────────── */\n\nexport const stackAnatomy = defineAnatomy(\"stack\", [\"root\"]);\n/**\n * `Stack` has one part, its root, stamped as `data-slot=\"stack\"` (ADR-008).\n * No state attributes: a responsive `direction` has no single value to\n * stamp, and the primitive's job is spacing, not state.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-15).\n */\nexport type StackSlot = \"root\";\n\nexport const inlineAnatomy = defineAnatomy(\"inline\", [\"root\"]);\n/**\n * `Inline` has one part, its root, stamped as `data-slot=\"inline\"` (ADR-008).\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-15).\n */\nexport type InlineSlot = \"root\";\n\nexport const surfaceAnatomy = defineAnatomy(\"surface\", [\"root\"]);\n/**\n * `Surface` has one part, its root, stamped as `data-slot=\"surface\"`\n * (ADR-008). Composites built on it (Card, W3-17) declare their own parts.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-16).\n */\nexport type SurfaceSlot = \"root\";\n\n/* ── W3 display family ───────────────────────────────────────────────────── */\n\nexport const avatarAnatomy = defineAnatomy(\"avatar\", [\n \"root\",\n \"frame\",\n \"image\",\n \"fallback\",\n \"status\",\n]);\n/**\n * `Avatar` parts, stamped as `data-slot=\"avatar[-<part>]\"` (ADR-008, W3-16).\n * `root` is the outer positioning wrapper — the element a consumer's\n * `shrink-0` / `mt-0.5` overrides are aimed at and `classNames.root` reaches;\n * `frame` is the circle (the Radix root: image and fallback clip to it), and\n * the element `className` and `ref` keep landing on behind the compatibility\n * entry (target architecture §29.1, ADR-008 decision 6 — the landing does not\n * move silently). `image` and `fallback` are the Radix image and fallback;\n * `status` is the corner dot, rendered only when `status` is set.\n * States on the root: `data-size`, `data-variant`.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W3-16).\n */\nexport type AvatarSlot = \"root\" | \"frame\" | \"image\" | \"fallback\" | \"status\";\n\nexport const cardAnatomy = defineAnatomy(\"card\", [\n \"root\",\n \"header\",\n \"title\",\n \"description\",\n \"action\",\n \"content\",\n \"footer\",\n]);\n/**\n * `Card` parts, stamped as `data-slot=\"card[-<part>]\"` (ADR-008, W3-17). The\n * root is a `Surface` (W2-16) that stamps `card` over `surface`: a composite\n * declares its own parts. Each part is a real JSX component (`CardHeader`,\n * `CardTitle`, …) and takes `className` itself, so `Card` has no `classNames`\n * (ADR-008 decision 4). States on the root: `data-variant`.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W3-17).\n */\nexport type CardSlot =\n | \"root\"\n | \"header\"\n | \"title\"\n | \"description\"\n | \"action\"\n | \"content\"\n | \"footer\";\n\nexport const statusBadgeAnatomy = defineAnatomy(\"status-badge\", [\"root\", \"indicator\", \"label\"]);\n/**\n * `StatusBadge` parts, stamped as `data-slot=\"status-badge[-<part>]\"`\n * (ADR-008): the root, the `indicator` (dot, icon or spinner — one at a time)\n * and the `label`. States on the root: `data-variant`, `data-intent`,\n * `data-size`, `data-loading`.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W3-14).\n */\nexport type StatusBadgeSlot = \"root\" | \"indicator\" | \"label\";\n\n/* ── W3-09 / W3-15 ───────────────────────────────────────────────────────── */\n\nexport const iconButtonAnatomy = defineAnatomy(\"icon-button\", [\"root\", \"icon\", \"spinner\"]);\n/**\n * `IconButton` parts, stamped as `data-slot=\"icon-button[-<part>]\"` (ADR-008):\n * the square root, the `icon` box and the `spinner` that replaces it while\n * loading. States on the root: `data-variant`, `data-intent`, `data-size`,\n * `data-disabled`, `data-loading`, `data-pressed`.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W3-09).\n */\nexport type IconButtonSlot = \"root\" | \"icon\" | \"spinner\";\n\nexport const chipAnatomy = defineAnatomy(\"chip\", [\"root\", \"icon\", \"label\", \"count\", \"remove\"]);\n/**\n * `Chip` parts, stamped as `data-slot=\"chip[-<part>]\"` (ADR-008): the root\n * (the pressable itself, or the group that holds a pressable label and the\n * `remove` button), the leading `icon`, the `label`, the `count` and the\n * `remove` button. States on the root: `data-variant`, `data-intent`,\n * `data-size`, `data-disabled`, `data-pressed`.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W3-15).\n */\nexport type ChipSlot = \"root\" | \"icon\" | \"label\" | \"count\" | \"remove\";\n\n/* ── W4-01 Field family ──────────────────────────────────────────────────── */\n\nexport const fieldAnatomy = defineAnatomy(\"field\", [\n \"root\",\n \"label\",\n \"required\",\n \"optional\",\n \"description\",\n \"error\",\n]);\n/**\n * `Field` parts, stamped as `data-slot=\"field[-<part>]\"` (ADR-008, W4-01):\n * the root (the layout wrapper, no chrome), the `label` (a `Label` rendered\n * inside a field stamps this over its own `label`, the way `Card` stamps\n * `card` over `surface`), its `required` asterisk and `optional` indicator,\n * the `description` and the `error`. The control is not a part: it keeps its\n * own anatomy (`input`, `select-trigger`, …) and is found by the field's id.\n * States on the root: `data-orientation`, `data-invalid`, `data-disabled`,\n * `data-required`.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W4-01).\n */\nexport type FieldSlot = \"root\" | \"label\" | \"required\" | \"optional\" | \"description\" | \"error\";\n\nexport const fieldsetAnatomy = defineAnatomy(\"fieldset\", [\"root\", \"legend\"]);\n/**\n * `Fieldset` parts, stamped as `data-slot=\"fieldset[-<part>]\"` (ADR-008,\n * W4-01): the `<fieldset>` root and its `<legend>`. States on the root:\n * `data-disabled`, `data-invalid`.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W4-01).\n */\nexport type FieldsetSlot = \"root\" | \"legend\";\n\n/* ── W4-10 Combobox ──────────────────────────────────────────────────────── */\n\nexport const comboboxAnatomy = defineAnatomy(\"combobox\", [\n \"root\",\n \"control\",\n \"value\",\n \"chips\",\n \"input\",\n \"icon\",\n \"clear\",\n \"toggle\",\n \"content\",\n \"header\",\n \"list\",\n \"group\",\n \"group-heading\",\n \"item\",\n \"item-indicator\",\n \"create\",\n \"empty\",\n \"loading\",\n \"footer\",\n]);\n/**\n * `Combobox` parts, stamped as `data-slot=\"combobox[-<part>]\"` (ADR-008,\n * W4-10): the `root` (the frame that holds the control and its form bridge),\n * the `control` (the field-shaped box the popover anchors to), the `value`\n * (a custom `renderValue` node over the input), the `chips` row and its\n * `Chip`s in `multiple` mode, the `input` (the `role=\"combobox\"` element that\n * keeps focus), the leading `icon`, the `clear` and `toggle` buttons; then\n * the portalled `content` with an optional `header`, the `list`\n * (`role=\"listbox\"`), a `group` with its `group-heading`, each `item`\n * (`role=\"option\"`, see `behavior/collection/item-attributes.ts`) and its\n * `item-indicator`, the `create` row, the `empty` and `loading` states and an\n * optional `footer`. States on the root: `data-state` (`open` · `closed`),\n * `data-disabled`, `data-invalid`, `data-size`.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W4-10).\n */\nexport type ComboboxSlot =\n | \"root\"\n | \"control\"\n | \"value\"\n | \"chips\"\n | \"input\"\n | \"icon\"\n | \"clear\"\n | \"toggle\"\n | \"content\"\n | \"header\"\n | \"list\"\n | \"group\"\n | \"group-heading\"\n | \"item\"\n | \"item-indicator\"\n | \"create\"\n | \"empty\"\n | \"loading\"\n | \"footer\";\n\nexport const statStripAnatomy = defineAnatomy(\"stat-strip\", [\n \"root\",\n \"content\",\n \"toggle\",\n \"item\",\n \"label\",\n \"value\",\n \"caption\",\n]);\n/**\n * `StatStrip` parts, stamped as `data-slot=\"stat-strip[-<part>]\"` (ADR-008).\n * `root` is the joined card (`role=\"group\"`, `data-state=\"expanded\" |\n * \"collapsed\"`, `data-loading`), `content` the grid / inline row the toggle\n * controls, `toggle` the wrapper of the collapse chevron. Each\n * `StatStripItem` is an `item` (`data-pressed` and `data-disabled` when it is\n * a filter toggle, `data-intent`, `data-glow` while it highlights a change)\n * with its `label`, `value` and `caption`.\n *\n * @experimental Slot names are experimental until ADR-008 is accepted (W2-18).\n */\nexport type StatStripSlot =\n | \"root\"\n | \"content\"\n | \"toggle\"\n | \"item\"\n | \"label\"\n | \"value\"\n | \"caption\";\n/* ── PR 3 table system: FilterChips, ListPage ─────────────────────────────── */\n\nexport const filterChipsAnatomy = defineAnatomy(\"filter-chips\", [\n \"root\",\n \"chip\",\n \"overflow\",\n \"overflow-panel\",\n \"overflow-facet\",\n \"overflow-value\",\n \"clear\",\n]);\n/**\n * `FilterChips` parts, stamped as `data-slot=\"filter-chips[-<part>]\"` (ADR-008):\n * the row (`root`), one `chip` per active facet, the collapsed `overflow`\n * (\"+N\") chip and its popover `overflow-panel` listing each `overflow-facet`\n * and `overflow-value`, and the trailing `clear` (\"Clear all\") action.\n *\n * @experimental\n */\nexport type FilterChipsSlot =\n | \"root\"\n | \"chip\"\n | \"overflow\"\n | \"overflow-panel\"\n | \"overflow-facet\"\n | \"overflow-value\"\n | \"clear\";\n\nexport const listPageAnatomy = defineAnatomy(\"list-page\", [\n \"root\",\n \"stats\",\n \"toolbar\",\n \"search\",\n \"chips\",\n \"count\",\n \"actions\",\n \"table\",\n \"scroll\",\n \"footer\",\n \"bulk-bar\",\n \"result-count\",\n]);\n/**\n * `ListPage` parts, stamped as `data-slot=\"list-page[-<part>]\"` (ADR-008): the\n * full-height, non-scrolling `root`; the `stats`, `toolbar` and `bulk-bar`\n * bands; the toolbar's `search`, `chips`, `count` and `actions` cells; the\n * `table` card, its single `scroll` region and pinned `footer`; and the\n * live `result-count`.\n *\n * @experimental\n */\nexport type ListPageSlot =\n | \"root\"\n | \"stats\"\n | \"toolbar\"\n | \"search\"\n | \"chips\"\n | \"count\"\n | \"actions\"\n | \"table\"\n | \"scroll\"\n | \"footer\"\n | \"bulk-bar\"\n | \"result-count\";\n\n/** Every anatomy declared above, in declaration order. */\nexport const ANATOMIES = [\n agreementViewerAnatomy,\n messageComposerAnatomy,\n codeAnatomy,\n kbdAnatomy,\n pressableAnatomy,\n buttonAnatomy,\n linkButtonAnatomy,\n badgeAnatomy,\n inputAnatomy,\n textareaAnatomy,\n searchInputAnatomy,\n selectAnatomy,\n checkboxAnatomy,\n radioGroupAnatomy,\n switchAnatomy,\n labelAnatomy,\n numberInputAnatomy,\n phoneFieldAnatomy,\n fileUploadAnatomy,\n dialogAnatomy,\n alertDialogAnatomy,\n sheetAnatomy,\n sideDrawerAnatomy,\n popoverAnatomy,\n dropdownMenuAnatomy,\n contextMenuAnatomy,\n tooltipAnatomy,\n toastAnatomy,\n tableAnatomy,\n dataTableAnatomy,\n paginationAnatomy,\n shellAnatomy,\n sidebarAnatomy,\n sidebarBrandSwitcherAnatomy,\n textAnatomy,\n headingAnatomy,\n stackAnatomy,\n inlineAnatomy,\n surfaceAnatomy,\n avatarAnatomy,\n cardAnatomy,\n statusBadgeAnatomy,\n iconButtonAnatomy,\n chipAnatomy,\n fieldAnatomy,\n fieldsetAnatomy,\n comboboxAnatomy,\n commandAnatomy,\n statStripAnatomy,\n filterChipsAnatomy,\n listPageAnatomy,\n] as const;\n","import type { Anatomy, SlotOf } from \"./define\";\n\n/**\n * L0 foundation (W2-17). Internal: not exported from the package.\n *\n * Stamps the anatomy attributes a part renders (ADR-008).\n *\n * ```tsx\n * <div {...slot(dialogAnatomy, \"header\")} className={cn(…)} />\n * // <div data-slot=\"dialog-header\" …>\n * ```\n */\n\nexport interface SlotAttributes {\n \"data-slot\": string;\n}\n\n/** The `data-slot` attribute of one registered part. Spread onto the element. */\nexport function slot<A extends Anatomy>(anatomy: A, part: SlotOf<A>): SlotAttributes {\n return { \"data-slot\": anatomy.attr(part) };\n}\n\n/**\n * The state attributes of the anatomy contract (target architecture §29.2).\n * Booleans render as a valueless-looking `\"\"` attribute when true and are\n * omitted when false or undefined, so `[data-disabled]` works as a selector;\n * value states render their value and are omitted when undefined.\n */\nexport interface StateAttributeInput {\n state?: string | undefined;\n disabled?: boolean | undefined;\n invalid?: boolean | undefined;\n loading?: boolean | undefined;\n selected?: boolean | undefined;\n pressed?: boolean | undefined;\n size?: string | undefined;\n variant?: string | undefined;\n intent?: string | undefined;\n orientation?: \"horizontal\" | \"vertical\" | undefined;\n}\n\nconst BOOLEAN_STATES = [\"disabled\", \"invalid\", \"loading\", \"selected\", \"pressed\"] as const;\nconst VALUE_STATES = [\"state\", \"size\", \"variant\", \"intent\", \"orientation\"] as const;\n\nexport function stateAttributes(input: StateAttributeInput): Record<string, string> {\n const attributes: Record<string, string> = {};\n for (const key of BOOLEAN_STATES) {\n if (input[key]) attributes[`data-${key}`] = \"\";\n }\n for (const key of VALUE_STATES) {\n const value = input[key];\n if (value !== undefined) attributes[`data-${key}`] = value;\n }\n return attributes;\n}\n","/**\n * L0 foundation (W3-04). Internal: not exported from the package.\n *\n * One-time development warnings. Three kinds share the plumbing:\n *\n * - **Deprecations** ({@link deprecate}): a legacy value or prop that a\n * compatibility-registry entry (`compat/registry.json`, plan §9) keeps\n * working until its removal major. They are gated by\n * {@link DEPRECATION_WARNINGS}, which is **off** until decision D10 settles\n * the deprecation window and ADR-011 is Accepted: the JSDoc `@deprecated`\n * tags already tell the editor, the console stays quiet.\n * - **Migration signals** ({@link warnOnce}): something that is not\n * deprecated but will behave differently in a later major — the untyped\n * `Button` inside a `<form>` (C-BTN-TYPE, W3-10) is the first. On by\n * default in development, because the count of these warnings is a release\n * gate (plan §20, G4).\n * - **Development errors** ({@link errorOnce}): a mistake in the consumer's\n * tree that the library can detect but not repair — a form control with no\n * accessible name (W4-02, target architecture §24.2) is the first. Same\n * plumbing, printed with `console.error`, never behind the deprecation\n * switch.\n *\n * Every message carries its registry id (`C-BTN-VAR: …`) so a consumer can\n * look the item up, and is printed once per session per key: the same value\n * on two hundred buttons is one line, not two hundred.\n *\n * Silent when `NODE_ENV` is `production` or `test`. The check reads\n * `process.env.NODE_ENV` inside the call, the expression bundlers replace,\n * so production builds fold the body away and unit tests can stub the\n * environment.\n */\n\nconst PREFIX = \"[@assure-one/design-system]\";\n\nconst warned = new Set<string>();\n\n/**\n * Whether development warnings print at all: never in production and never\n * under a test runner, where a warning would only be noise in the output of\n * a suite that renders the legacy values on purpose.\n */\nexport function devWarningsEnabled(): boolean {\n return process.env.NODE_ENV !== \"production\" && process.env.NODE_ENV !== \"test\";\n}\n\n/**\n * Print `message` once per session for `id` + `key`, prefixed with the\n * package name and the registry id. Returns whether it printed.\n *\n * @param id the compatibility-registry id the message belongs to (`C-BTN-TYPE`)\n * @param key what makes this occurrence distinct within the id (a prop value,\n * a label); the dedupe key is `id:key`\n */\nexport function warnOnce(id: string, key: string, message: string): boolean {\n return printOnce(\"warn\", id, key, message);\n}\n\n/**\n * Print `message` once per session for `id` + `key` as an error (W4-02). For\n * a consumer mistake the library cannot repair, not for a deprecation: it is\n * not behind {@link DEPRECATION_WARNINGS}. Same dedupe space as\n * {@link warnOnce}. Returns whether it printed.\n *\n * @param id the contract the message belongs to (`Field`)\n * @param key what makes this occurrence distinct within the id\n */\nexport function errorOnce(id: string, key: string, message: string): boolean {\n return printOnce(\"error\", id, key, message);\n}\n\nfunction printOnce(level: \"warn\" | \"error\", id: string, key: string, message: string): boolean {\n if (!devWarningsEnabled()) return false;\n const dedupeKey = `${id}:${key}`;\n if (warned.has(dedupeKey)) return false;\n warned.add(dedupeKey);\n console[level](`${PREFIX} ${id}: ${message}`);\n return true;\n}\n\n/**\n * The switch for deprecation warnings (W3-04). **Off until D10 is decided\n * and ADR-011 is Accepted**; flipping `enabled` to `true` is the release that\n * \"ships the first deprecations\" in the plan's sense. Migration signals\n * ({@link warnOnce}) are not behind it.\n */\nexport const DEPRECATION_WARNINGS: { enabled: boolean } = { enabled: false };\n\n/**\n * A deprecation warning: {@link warnOnce} behind {@link DEPRECATION_WARNINGS}.\n * Returns whether it printed.\n */\nexport function deprecate(id: string, key: string, message: string): boolean {\n if (!DEPRECATION_WARNINGS.enabled) return false;\n return warnOnce(id, key, message);\n}\n\n/** Forget what has been warned. For tests. */\nexport function resetDevWarnings(): void {\n warned.clear();\n}\n","import { deprecate } from \"../../foundation/deprecate\";\n\nimport type { ButtonIconProps, ButtonSize, ButtonVariant } from \"./button-base\";\n\n/**\n * L1a behaviour primitive (private). Not exported from the package.\n *\n * The deprecation warnings of the Button family (W3-04): one call per render\n * that names every legacy value the call passed, keyed by the value so each\n * prints once per session. Every message carries its compatibility-registry\n * id (`compat/registry.json`) and the codemod that rewrites the call.\n *\n * Behind `DEPRECATION_WARNINGS` (off until D10 / ADR-011 Accepted): until\n * then this is a cheap early return.\n */\n\n/** Legacy `variant` words and their two-axis pair (ADR-007 §4), for the message. */\nconst LEGACY_VARIANT_REPLACEMENT: Readonly<Record<string, string>> = {\n primary: 'variant=\"solid\" intent=\"brand\" (or no variant — it is the default)',\n secondary: 'variant=\"soft\" intent=\"neutral\"',\n destructive: 'variant=\"solid\" intent=\"danger\"',\n success: 'variant=\"solid\" intent=\"success\"',\n dashed: 'variant=\"outline\" intent=\"neutral\" (the dashed border has no replacement yet)',\n};\n\nconst ICON_SIZES = new Set<string>([\"icon-xs\", \"icon-sm\", \"icon\"]);\n\nexport interface LegacyButtonProps extends ButtonIconProps {\n variant?: ButtonVariant | null | undefined;\n size?: ButtonSize | null | undefined;\n}\n\n/**\n * Warn once per legacy value in `props`. Call at render, after the props are\n * known and before they are resolved.\n */\nexport function warnLegacyButtonProps(\n component: \"Button\" | \"LinkButton\",\n { variant, size, iconLeft, iconRight }: LegacyButtonProps,\n): void {\n if (variant && Object.hasOwn(LEGACY_VARIANT_REPLACEMENT, variant)) {\n deprecate(\n \"C-BTN-VAR\",\n `variant=${variant}`,\n `<${component} variant=\"${variant}\"> is a deprecated alias. Pass ${LEGACY_VARIANT_REPLACEMENT[variant]}; codemod CM-04 rewrites it. Removed in 3.0.`,\n );\n }\n\n if (size && ICON_SIZES.has(size)) {\n deprecate(\n \"C-BTN-SIZE-ICON\",\n `size=${size}`,\n `<${component} size=\"${size}\"> is deprecated. Use <IconButton> (W3-09); codemod CM-03 rewrites it. Removed in 3.0.`,\n );\n }\n\n if (iconLeft !== undefined) {\n deprecate(\n \"C-BTN-ICONPROPS\",\n \"iconLeft\",\n `<${component} iconLeft> is a deprecated alias of iconStart; codemod CM-05 renames it. Removed in 3.0.`,\n );\n }\n if (iconRight !== undefined) {\n deprecate(\n \"C-BTN-ICONPROPS\",\n \"iconRight\",\n `<${component} iconRight> is a deprecated alias of iconEnd; codemod CM-05 renames it. Removed in 3.0.`,\n );\n }\n}\n","import type { KeyboardEvent, KeyboardEventHandler, MouseEvent, MouseEventHandler } from \"react\";\n\n/**\n * L1a behaviour primitive (private). Not exported from the package.\n *\n * Disabled semantics for an element that has no native `disabled` — a link,\n * or whatever child `asChild` renders (W3-06, W3-08; target architecture\n * §30). A native `<button disabled>` gets all of this from the browser: it is\n * announced as disabled, leaves the tab order, and neither clicks nor\n * activates from the keyboard. An `<a href>` gets none of it, so the Button\n * family reproduces the four pieces by hand:\n *\n * - `aria-disabled=\"true\"` — announced as disabled (`data-disabled` for CSS\n * comes from the anatomy state attributes, not from here).\n * - `tabIndex={-1}` — out of the tab order, like a disabled button.\n * - the click is swallowed: `preventDefault` so a link does not navigate,\n * `stopPropagation` so a delegated handler does not fire, and the\n * consumer's `onClick` is not called.\n * - Enter and Space are swallowed on `keydown`, so a link that is focused by\n * other means (a click focuses it even at `tabIndex={-1}`) still does not\n * navigate on Enter.\n *\n * Plus `pointer-events: none` while inert (the class the native branch gets\n * from `disabled:`), and the disabled colours when disabled but not loading —\n * the same two tokens the native `<button>` reads.\n *\n * `Pressable` (W3-03) carries its own copy of the click/keyboard guard\n * because it also emulates Space activation; the two agree on the semantics.\n *\n * Limits: Radix `Slot` composes a child's own handler *before* the slot's, so\n * an `onClick` written on the child element itself still runs (the\n * navigation is still prevented); the `onClick` passed to the Button is the\n * one this guards.\n */\n\n/** The attributes an inert non-native element renders. */\nexport const INERT_ATTRIBUTES = { \"aria-disabled\": true, tabIndex: -1 } as const;\n\n/** `pointer-events: none` — what `disabled:` gives the native button. */\nexport const INERT_CLASSES = \"ds:pointer-events-none\";\n\n/**\n * The disabled colours and cursor of the native `<button>`\n * (`[&:disabled:not([data-loading=true])]`) — `cursor-not-allowed` mirrors\n * the native branch's own class (see `behavior/button-base.ts`); without it\n * an inert link/asChild target looked clickable to a sighted mouse user\n * hovering it, since `pointer-events: none` alone shows no cursor at all.\n */\nexport const DISABLED_LOOK_CLASSES = \"ds:bg-bg-disabled ds:text-fg-disabled ds:cursor-not-allowed\";\n\nconst isActivationKey = (key: string) => key === \"Enter\" || key === \" \";\n\n/**\n * Wrap the consumer's `onClick` / `onKeyDown` so that, while `inert`, a click\n * or an activation key does nothing and reaches nobody. Not inert: the\n * consumer's handlers are called as they are.\n */\nexport function inertHandlers<E extends HTMLElement>(\n inert: boolean,\n handlers: {\n onClick?: MouseEventHandler<E> | undefined;\n onKeyDown?: KeyboardEventHandler<E> | undefined;\n },\n): { onClick: MouseEventHandler<E>; onKeyDown: KeyboardEventHandler<E> } {\n return {\n onClick(event: MouseEvent<E>) {\n if (inert) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n handlers.onClick?.(event);\n },\n onKeyDown(event: KeyboardEvent<E>) {\n if (inert) {\n if (isActivationKey(event.key)) {\n event.preventDefault();\n event.stopPropagation();\n }\n return;\n }\n handlers.onKeyDown?.(event);\n },\n };\n}\n","\"use client\";\n\nimport { Slot, Slottable } from \"@radix-ui/react-slot\";\nimport { forwardRef } from \"react\";\n\nimport { buttonAnatomy, type ButtonSlot } from \"../foundation/anatomy/slots\";\nimport { slot, stateAttributes } from \"../foundation/anatomy/slot\";\nimport { cn } from \"../lib/cn\";\n\nimport {\n buttonVariants,\n resolveButtonIcons,\n type ButtonIconProps,\n type ButtonIntent,\n type ButtonIntentAlias,\n type ButtonSize,\n type ButtonVariant,\n} from \"./behavior/button-base\";\nimport { warnLegacyButtonProps } from \"./behavior/button-deprecations\";\nimport {\n DISABLED_LOOK_CLASSES,\n INERT_ATTRIBUTES,\n INERT_CLASSES,\n inertHandlers,\n} from \"./behavior/inert\";\nimport { Spinner } from \"./spinner\";\n\n/**\n * Button — action atom.\n *\n * Two axes (W3-02, ADR-007): `variant` is the emphasis — `solid` · `soft` ·\n * `outline` · `ghost` · `link` — and `intent` is the meaning — `brand` ·\n * `neutral` · `success` · `danger`. Any pair renders; omitted, `intent` follows\n * the variant (`solid`/`link` → `brand`, the rest → `neutral`) and omitted,\n * `variant` is `solid`, so a Button with no props is what `primary` always was.\n *\n * Legacy single-axis values are accepted as deprecated aliases and render the\n * exact classes they always did (pinned by snapshot):\n * - primary → solid + brand\n * - secondary → soft + neutral\n * - destructive → solid + danger\n * - success → solid + success\n * - dashed → outline + neutral with a dashed border\n * - ghost / outline / link are emphases already; unchanged\n * (`accent` was removed in 2.0 — use `intent=\"brand\"`, decision D13)\n *\n * Sizes (W3-05, D5, ADR-013): the shared control scale `xs · sm · md · lg ·\n * xl` plus the icon-only squares. Every text size reads `--ds-control-height-*`\n * (28/32/36/40/48) — `md`/`lg` moved off their old `--ds-button-height-*`\n * compat tokens (40/48) onto the shared 36/40 (D5, W2-05), so a Button lines\n * up with an Input/Select at the same `size`. The icon-only squares keep\n * their own compat pixels (24/28/40, `C-BTN-SIZE-ICON`) — deprecated in\n * favour of `IconButton`, which already sits on the shared scale. `sm` is the\n * dense tier used in toolbars; `md` is the default. Labels: xs 12px, sm 13px,\n * md 13px, lg 14px, xl 16px.\n * Use `asChild` to render as a different element (e.g. an anchor / next/link).\n * `type` defaults to `\"button\"` (2.0, W9-05): pass `type=\"submit\"` (or use\n * `SubmitButton`) for the button that submits its form.\n *\n * The class recipe and the resolver are the L1a `buttonBase` (W3-03); the\n * public names are `buttonVariants` and `resolveButtonStyle`.\n */\nexport {\n buttonVariants,\n resolveButtonStyle,\n type ButtonEmphasis,\n type ButtonIconProps,\n type ButtonIconSize,\n type ButtonIntent,\n type ButtonIntentAlias,\n type ButtonLegacyVariant,\n type ButtonLook,\n type ButtonSize,\n type ButtonStyle,\n type ButtonVariant,\n type ButtonVariantsProps,\n} from \"./behavior/button-base\";\n\n/** The button parts (ADR-008). See the registry for the doc comment. */\nexport type { ButtonSlot };\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>, ButtonIconProps {\n /**\n * Visual emphasis: `solid` (default) · `soft` · `outline` · `ghost` · `link`.\n * The legacy words (`primary`, `secondary`, `destructive`, `success`,\n * `dashed`) are deprecated aliases — see {@link ButtonLegacyVariant}.\n */\n variant?: ButtonVariant;\n /**\n * Meaning → colour family: `brand` · `neutral` · `success` · `danger`.\n * Defaults per variant so an omitted prop renders what it always did.\n * `destructive` is a deprecated alias of `danger` (decision D4).\n *\n * @experimental\n */\n intent?: ButtonIntent | ButtonIntentAlias;\n /**\n * The shared control scale `xs · sm · md · lg · xl` (ADR-013). Default `md`\n * (36px, D5 — was 40px). The icon-only squares `icon-xs` · `icon-sm` ·\n * `icon` are deprecated in favour of `IconButton`\n * ({@link ButtonIconSize}).\n */\n size?: ButtonSize;\n /** Render as the child element via Radix `Slot` (shadcn pattern). */\n asChild?: boolean;\n loading?: boolean;\n /**\n * Stretch to the container's width (`w-full`). A prop instead of a\n * `className`, so the codemods and the dashboard can see it.\n *\n * @experimental\n */\n fullWidth?: boolean;\n /**\n * Toggle state (a boolean prop, never a variant — ADR-007 §2). Reflected as\n * `aria-pressed` and, when true, `data-pressed`. Leave undefined for an\n * action that does not toggle.\n *\n * @experimental\n */\n pressed?: boolean;\n}\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n {\n variant,\n intent,\n size,\n asChild = false,\n loading,\n fullWidth,\n pressed,\n iconStart,\n iconEnd,\n iconLeft,\n iconRight,\n disabled,\n onClick,\n onKeyDown,\n children,\n className,\n ...props\n },\n ref,\n) {\n warnLegacyButtonProps(\"Button\", { variant, size, iconLeft, iconRight });\n const icons = resolveButtonIcons({ iconStart, iconEnd, iconLeft, iconRight });\n const inert = Boolean(disabled || loading);\n\n // Anatomy (ADR-008). `data-loading` is *not* re-stamped from\n // stateAttributes(): the shipped stylesheet selects `data-[loading=true]`,\n // so the value stays \"true\" until W3 can change the class with it.\n // `data-variant` carries the word as passed (the legacy word included) and\n // `data-intent` appears only when `intent` is passed: the DOM of every call\n // that exists today is unchanged (C-DOM-05 freezes it).\n const resolvedVariant: ButtonVariant = variant ?? \"primary\";\n const resolvedSize: ButtonSize = size ?? \"md\";\n const state = stateAttributes({\n variant: resolvedVariant,\n intent: intent ?? undefined,\n size: resolvedSize,\n disabled: inert,\n pressed,\n });\n\n const start = loading ? (\n <Spinner size=\"sm\" {...slot(buttonAnatomy, \"spinner\")} />\n ) : (\n icons.start && (\n <span\n {...slot(buttonAnatomy, \"icon-start\")}\n className=\"ds:inline-flex ds:shrink-0\"\n aria-hidden=\"true\"\n >\n {icons.start}\n </span>\n )\n );\n const end = icons.end && !loading && (\n <span\n {...slot(buttonAnatomy, \"icon-end\")}\n className=\"ds:inline-flex ds:shrink-0\"\n aria-hidden=\"true\"\n >\n {icons.end}\n </span>\n );\n\n if (asChild) {\n // The child keeps its element (`<a href>` stays a link) and gains the\n // button's behaviour (W3-06). `disabled` / `loading` have no native form\n // on it, so they become `aria-disabled`, `tabIndex={-1}`, a swallowed\n // click and Enter/Space, plus the disabled colours (W3-08). The spinner\n // and the icon slots render *inside* the child through `Slottable`; a\n // call with neither renders the child untouched, as it always did.\n const guarded = inertHandlers<HTMLButtonElement>(inert, { onClick, onKeyDown });\n const root = {\n ref,\n ...slot(buttonAnatomy, \"root\"),\n ...state,\n \"aria-pressed\": pressed,\n \"aria-busy\": loading || undefined,\n \"data-loading\": loading || undefined,\n ...(inert ? INERT_ATTRIBUTES : {}),\n className: cn(\n buttonVariants({ variant, intent, size }),\n fullWidth && \"ds:w-full\",\n inert && INERT_CLASSES,\n disabled && !loading && DISABLED_LOOK_CLASSES,\n className,\n ),\n ...props,\n ...guarded,\n };\n // Slot wants exactly one child unless a Slottable marks where the child's\n // own content goes; keep the single-child form when nothing is added.\n if (!start && !end) return <Slot {...root}>{children}</Slot>;\n return (\n <Slot {...root}>\n {start}\n <Slottable>{children}</Slottable>\n {end}\n </Slot>\n );\n }\n\n return (\n <button\n ref={ref}\n disabled={disabled || loading}\n aria-busy={loading || undefined}\n data-loading={loading || undefined}\n {...slot(buttonAnatomy, \"root\")}\n {...state}\n aria-pressed={pressed}\n className={cn(buttonVariants({ variant, intent, size }), fullWidth && \"ds:w-full\", className)}\n onClick={onClick}\n onKeyDown={onKeyDown}\n {...props}\n // W9-05 (C-BTN-TYPE): `button`, not the browser's `submit`, unless passed.\n type={props.type ?? \"button\"}\n >\n {start}\n {children}\n {end}\n </button>\n );\n});\n\nButton.displayName = \"Button\";\n","import type { DsMessages } from \"./types\";\n\n/**\n * The English catalogue (W5-20). Every value is byte-identical to the default\n * the component rendered before the provider existed; a change here is a\n * visible change for every consumer without a provider and needs a changeset.\n *\n * `en.json` is generated from this object (`pnpm messages:generate`; functions\n * are recorded with `{parameter}` placeholders). Keep the two in step —\n * `pnpm messages:check` fails when they drift.\n */\nexport const EN_MESSAGES: DsMessages = {\n select: { clear: \"Clear selection\", placeholder: \"Select...\" },\n searchInput: { clear: \"Clear search\", placeholder: \"Search...\" },\n combobox: {\n empty: \"No results\",\n loading: \"Loading…\",\n create: (query) => `Create “${query}”`,\n clear: \"Clear\",\n toggle: \"Show options\",\n remove: (label) => `Remove ${label}`,\n },\n field: { optional: \"optional\" },\n fileUpload: {\n prompt: \"Click to upload\",\n dragHint: \" or drag and drop\",\n accepted: (accept) => `Accepted: ${accept}`,\n maxSize: (size) => `Max size: ${size}`,\n },\n confirm: {\n confirm: \"Confirm\",\n cancel: \"Cancel\",\n failed: \"Something went wrong. Please try again.\",\n },\n overlay: { close: \"Close\" },\n toast: { region: \"Notifications\", dismiss: \"Dismiss\" },\n commandPalette: {\n name: \"Command palette\",\n instructions: \"Search and run commands\",\n search: \"Type a command or search...\",\n empty: \"No results found.\",\n navigate: \"Navigate\",\n select: \"Select\",\n close: \"Close\",\n escapeKey: \"esc\",\n },\n keyboardShortcuts: {\n name: \"Keyboard Shortcuts\",\n general: \"General\",\n commandPalette: \"Command palette\",\n focusSearch: \"Focus search\",\n keyboardShortcuts: \"Keyboard shortcuts\",\n closeOrBack: \"Close / go back\",\n then: \"then\",\n hintPrefix: \"Press\",\n hintSuffix: \"anytime to toggle this dialog\",\n },\n pagination: {\n region: (page, total) => `Pagination, page ${page} of ${total}`,\n range: (start, end, total) => `${start}–${end} of ${total}`,\n page: (page, total) => `Page ${page} of ${total}`,\n previous: \"Previous page\",\n next: \"Next page\",\n rowsPerPage: \"Rows per page\",\n },\n copyButton: { copy: \"Copy to clipboard\", copied: \"Copied\" },\n loadingRows: { loading: \"Loading\" },\n progress: { progress: \"Progress\" },\n segmentedProgress: { step: (filled, steps) => `Step ${filled} of ${steps}` },\n breadcrumb: { region: \"Breadcrumb\" },\n input: { showPassword: \"Show password\", hidePassword: \"Hide password\" },\n avatar: {\n image: \"Avatar\",\n unknownUser: \"Unknown user\",\n status: (status) => `${status} status`,\n },\n avatarGroup: {\n overflow: (count) => `+${count}`,\n overflowLabel: (count) => `${count} more`,\n },\n otpInput: { name: \"One-time password\" },\n datePicker: {\n openCalendar: \"Open calendar\",\n pickYear: \"Pick a year\",\n previousDecade: \"Previous decade\",\n nextDecade: \"Next decade\",\n },\n dateRangePicker: { name: \"Date range\", placeholder: \"Select date range\" },\n dismissibleChip: {\n remove: \"Remove filter\",\n removeNamed: (label) => `Remove ${label} filter`,\n },\n multiFilterPill: {\n clear: (label) => `Clear ${label} filter`,\n clearSelection: \"Clear selection\",\n },\n searchSelect: {\n placeholder: \"Search...\",\n createNew: \"Create new\",\n all: \"All\",\n remove: (label) => `Remove ${label}`,\n empty: \"No results found.\",\n noOptions: \"No options available.\",\n clear: \"Clear\",\n clearNamed: (label) => `Clear ${label}`,\n toggle: \"Show options\",\n changeNamed: (label) => `Change ${label}`,\n },\n phoneField: {\n country: \"Country\",\n searchCountries: \"Search countries\",\n noCountries: \"No countries found\",\n },\n phoneCountryInput: {\n selectCountry: \"Select country code\",\n searchCountries: \"Search country or code...\",\n noCountries: \"No countries found\",\n },\n starRating: {\n rating: (rating, max) => `${rating} out of ${max} stars`,\n half: \"half\",\n },\n fileTypeBadge: { file: (code) => `${code} file` },\n attachmentChip: {\n view: (name) => `View ${name}`,\n download: (name) => `Download ${name}`,\n },\n masterDetailLayout: { back: \"Back\" },\n sidebar: {\n collapse: \"Collapse sidebar\",\n expand: \"Expand sidebar\",\n pin: \"Pin sidebar\",\n unpin: \"Unpin sidebar\",\n collapseSection: \"Collapse section\",\n expandSection: \"Expand section\",\n navigation: \"Navigation\",\n },\n shell: { content: \"Page content\" },\n bottomNav: { region: \"Primary\" },\n dashGrid: { reorder: \"Reorder widget\" },\n folderTree: {\n collapse: (name) => `Collapse ${name}`,\n expand: (name) => `Expand ${name}`,\n },\n appHeader: { search: \"Search…\" },\n bulkActionBar: {\n clearSelection: \"Clear selection\",\n toolbar: \"Bulk actions\",\n selected: (count) => `${count} selected`,\n cleared: \"Selection cleared\",\n clear: \"Clear\",\n escapeKey: \"Esc\",\n more: \"More\",\n eligible: (eligible, total) => `${eligible} of ${total}`,\n },\n errorState: {\n title: \"Something went wrong\",\n retry: \"Try again\",\n showDetails: \"Show details\",\n hideDetails: \"Hide details\",\n },\n dataTable: {\n search: \"Search…\",\n of: \"of\",\n searchLabel: \"Search\",\n columns: \"Columns\",\n filterAll: \"All\",\n selectAll: \"Select all rows\",\n selectRow: \"Select row\",\n columnOptions: (label) => `Column options for ${label}`,\n sortAscending: \"Sort ascending\",\n sortDescending: \"Sort descending\",\n clearSort: \"Clear sort\",\n moveLeft: \"Move left\",\n moveRight: \"Move right\",\n hideColumn: \"Hide column\",\n pinColumn: \"Pin column\",\n unpinColumn: \"Unpin column\",\n autosizeColumn: \"Autosize column\",\n resetColumns: \"Reset columns\",\n loadMore: \"Load more\",\n loadingMore: \"Loading more…\",\n allLoaded: (count) => `All ${count} loaded`,\n loadedOf: (loaded, total) => `${loaded} of ${total} loaded`,\n },\n tableStates: { loading: \"Loading\", empty: \"No results\" },\n table: {\n region: \"Scrollable table\",\n collapseSection: \"Collapse section\",\n expandSection: \"Expand section\",\n sortedAscending: (rank) => `Sorted ascending, priority ${rank}`,\n sortedDescending: (rank) => `Sorted descending, priority ${rank}`,\n resizeColumn: \"Resize column\",\n resizeColumnNamed: (label) => `Resize ${label}`,\n groupLoadedOf: (loaded, total) => `${loaded} of ${total} loaded`,\n },\n tableDensity: { label: \"Row density\", comfortable: \"Detailed view\", compact: \"Compact view\" },\n stackedBarChart: { region: \"Scrollable chart\" },\n pdfPreview: { region: \"PDF preview\" },\n spreadsheetPreview: { region: \"Spreadsheet preview\" },\n peoplePicker: { assignToMe: \"Assign to me\" },\n comingSoon: { eyebrow: \"Coming soon\", badge: \"In Development\" },\n statStrip: { region: \"Summary\", collapse: \"Collapse summary\", expand: \"Expand summary\" },\n displayMenu: {\n trigger: \"Display\",\n tooltip: \"Filters, grouping, ordering, columns\",\n triggerCustomised: (label) => `${label} (customised)`,\n rootSearchPlaceholder: \"Filter…\",\n rootSearchLabel: \"Filter options and values\",\n reset: \"Reset to default\",\n noMatches: \"No matches\",\n nothingToFilter: \"Nothing to filter by\",\n sectionSearchPlaceholder: (section) => `Filter ${section.toLowerCase()}…`,\n sectionSearchLabel: (section) => `Filter ${section}`,\n clearSelected: (count) => `Clear ${count} selected`,\n groupFilter: \"Filter\",\n groupArrange: \"Arrange\",\n activeFilters: (label, count) => `${label}, ${count} active`,\n matchLabel: \"Match\",\n matchAll: \"All filters\",\n matchAny: \"Any filter\",\n views: \"Views\",\n noView: \"Custom view\",\n saveView: \"Save view\",\n unsavedChanges: \"unsaved changes\",\n announceSelected: (section, option) => `${section}: ${option} selected`,\n announceDeselected: (section, option) => `${section}: ${option} removed`,\n announceCleared: (section) => `${section} cleared`,\n announceReset: \"Display reset to default\",\n announceView: (view) => `${view} view applied`,\n },\n displayMenuFilters: {\n operator: \"Operator\",\n operatorIs: \"is\",\n operatorIsNot: \"is not\",\n operatorIsAnyOf: \"is any of\",\n operatorIsNoneOf: \"is none of\",\n operatorIsEmpty: \"is empty\",\n operatorIsNotEmpty: \"is not empty\",\n more: (count) => `+${count}`,\n search: (section) => `Search ${section}`,\n searchPlaceholder: \"Search…\",\n noMatches: \"No matches\",\n clear: \"Clear\",\n me: \"Me\",\n unassigned: \"Unassigned\",\n tagMatch: \"Match\",\n tagMatchAny: \"Any of these\",\n tagMatchAll: \"All of these\",\n tagMatchAllSummary: (labels) => `all of ${labels}`,\n dateDue: \"Due\",\n dateCalendar: \"Date\",\n datePresets: \"Date presets\",\n overdue: \"Overdue\",\n dueToday: \"Due today\",\n dueNext7: \"Due in 7 days\",\n dueThisMonth: \"Due this month\",\n noDate: \"No date\",\n today: \"Today\",\n last7: \"Last 7 days\",\n last30: \"Last 30 days\",\n thisMonth: \"This month\",\n lastMonth: \"Last month\",\n thisQuarter: \"This quarter\",\n lastQuarter: \"Last quarter\",\n ytd: \"Year to date\",\n custom: \"Custom range\",\n dateFrom: \"From\",\n dateTo: \"To\",\n dateBetween: (from, to) => `${from} – ${to}`,\n dateOnOrAfter: (from) => `from ${from}`,\n dateOnOrBefore: (to) => `until ${to}`,\n numberEq: \"Equals\",\n numberNe: \"Does not equal\",\n numberLt: \"Less than\",\n numberLte: \"At most\",\n numberGt: \"Greater than\",\n numberGte: \"At least\",\n numberBetween: \"Between\",\n numberValue: \"Value\",\n numberMin: \"Minimum\",\n numberMax: \"Maximum\",\n numberInvalid: \"Enter a number\",\n numberBetweenSummary: (from, to) => `between ${from} and ${to}`,\n textContains: \"Contains\",\n textStartsWith: \"Starts with\",\n textValue: \"Text\",\n textContainsSummary: (text) => `contains “${text}”`,\n textStartsWithSummary: (text) => `starts with “${text}”`,\n booleanAny: \"Any\",\n booleanTrue: \"Yes\",\n booleanFalse: \"No\",\n sortBy: \"Sort by\",\n sortThenBy: \"Then by\",\n sortField: (position) => `${position} field`,\n sortDirection: (field) => `${field} direction`,\n ascending: \"Ascending\",\n descending: \"Descending\",\n addSort: \"Add sort\",\n chooseField: \"Choose a field\",\n removeSort: (field) => `Remove ${field} sort`,\n makePrimary: (field) => `Sort by ${field} first`,\n sortSummary: (fields) => fields,\n columnsList: \"Columns\",\n showColumn: (column) => `Show ${column}`,\n moveUp: (column) => `Move ${column} up`,\n moveDown: (column) => `Move ${column} down`,\n locked: \"Locked\",\n resetColumns: \"Reset columns\",\n columnMoved: (column, position, total) => `${column} moved to position ${position} of ${total}`,\n columnShown: (column) => `${column} shown`,\n columnHidden: (column) => `${column} hidden`,\n sortChanged: (summary) => `Sorted by ${summary}`,\n },\n filterChips: {\n region: \"Active filters\",\n facet: (label, summary) => `${label}: ${summary}`,\n remove: (label) => `Remove ${label} filter`,\n removeValue: (label, value) => `Remove ${value} from ${label}`,\n more: (count) => `+${count}`,\n moreLabel: (count) => `${count} more filters`,\n panelTitle: (count) => `Active filters (${count})`,\n clearFilters: \"Clear filters\",\n clearAll: \"Clear all\",\n },\n listPage: {\n tableRegion: \"Results\",\n range: (start, end, total) => `${start}–${end} of ${total}`,\n loaded: (loaded, total) => `${loaded} of ${total} loaded`,\n total: (total) => `${total} results`,\n },\n};\n","\"use client\";\n\nimport { createContext, useContext, useMemo } from \"react\";\n\nimport { EN_MESSAGES } from \"../messages/en\";\nimport type { DsMessageNamespace, DsMessages, DsMessagesOverride } from \"../messages/types\";\nimport type { ImageComponent, LinkComponent } from \"./link\";\n\n/** Text direction the provider announces. Context only until components adopt logical properties (W5-22). @experimental */\nexport type DsDirection = \"ltr\" | \"rtl\";\n\nexport interface DesignSystemContextValue {\n /** The consumer's partial catalogue; merged per namespace on read. */\n messages: DsMessagesOverride | undefined;\n dir: DsDirection | undefined;\n linkComponent: LinkComponent | undefined;\n imageComponent: ImageComponent | undefined;\n /**\n * Whether the provider mounted the one shared Radix `TooltipProvider`\n * (`tooltip !== false`). `Tooltip` then renders its root alone instead of\n * wrapping a provider per instance (W5-12).\n */\n sharedTooltipProvider: boolean;\n}\n\n/**\n * L0 foundation (W5-20). One context for everything the provider owns that is\n * not a locale or a portal container (those have their own, older contexts so\n * a test can mount them alone). `null` = no provider above — every hook below\n * then returns the same value the component used before the provider existed.\n */\nexport const DesignSystemContext = createContext<DesignSystemContextValue | null>(null);\n\n/**\n * The resolved messages of one component namespace: the component's own\n * `messages` prop wins over the provider's catalogue, which wins over the\n * English default. Works without a provider (English). Stable while the three\n * inputs are.\n *\n * @experimental\n */\nexport function useDsMessages<N extends DsMessageNamespace>(\n namespace: N,\n override?: Partial<DsMessages[N]> | undefined,\n): DsMessages[N] {\n const provided = useContext(DesignSystemContext)?.messages?.[namespace];\n return useMemo(\n () => ({ ...EN_MESSAGES[namespace], ...stripUndefined(provided), ...stripUndefined(override) }),\n [namespace, provided, override],\n );\n}\n\n/** A spread of `{ clear: undefined }` must not erase the default below it. */\nfunction stripUndefined<T extends object>(value: T | undefined): Partial<T> {\n if (!value) return {};\n const out: Partial<T> = {};\n for (const key of Object.keys(value) as (keyof T)[]) {\n if (value[key] !== undefined) out[key] = value[key];\n }\n return out;\n}\n\n/** The provider's link adapter, or `undefined` (render the static default). */\nexport function useLinkComponent(): LinkComponent | undefined {\n return useContext(DesignSystemContext)?.linkComponent;\n}\n\n/** The provider's image adapter, or `undefined` (render the static default). */\nexport function useImageComponent(): ImageComponent | undefined {\n return useContext(DesignSystemContext)?.imageComponent;\n}\n\n/**\n * The `delayDuration` a `Tooltip` renders with when nothing sets one (W5-12):\n * the per-instance fallback and the provider's shared `TooltipProvider` both\n * default to it, so adding the provider changes no timing. Internal.\n */\nexport const TOOLTIP_DEFAULT_DELAY_MS = 300;\n\n/**\n * Whether a `DesignSystemProvider` above mounted the shared `TooltipProvider`\n * (W5-12). `false` without a provider, or when it was given `tooltip={false}`.\n */\nexport function useSharedTooltipProvider(): boolean {\n return useContext(DesignSystemContext)?.sharedTooltipProvider ?? false;\n}\n\n/** The provider's text direction, or `undefined` when none was given. */\nexport function useDsDirection(): DsDirection | undefined {\n return useContext(DesignSystemContext)?.dir;\n}\n","import type { Anatomy, SlotOf } from \"./define\";\n\n/**\n * L0 foundation (W2-17). Internal: not exported from the package.\n *\n * The typing helper behind the `classNames` prop (ADR-008, target architecture\n * §27, §29.3): a data-driven component with no JSX part to hang a class on\n * takes one class per part, keyed by the component's part union.\n *\n * ```ts\n * export interface SelectProps {\n * classNames?: SlotClassNames<SelectSlot>;\n * }\n * ```\n *\n * `className` keeps landing on the root (A5); `classNames.root` is not a\n * second spelling of it — a component either has a root part in its anatomy or\n * takes `className`, never both for the same element.\n */\nexport type SlotClassNames<Part extends string> = Partial<Record<Part, string>>;\n\n/** The `classNames` type of an anatomy, without naming its part union. */\nexport type ClassNamesOf<A extends Anatomy> = SlotClassNames<SlotOf<A>>;\n\n/** One part's class, or `undefined` when the consumer passed none. */\nexport function slotClassName<Part extends string>(\n classNames: SlotClassNames<Part> | undefined,\n part: Part,\n): string | undefined {\n return classNames?.[part];\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as AvatarPrimitive from \"@radix-ui/react-avatar\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { slotClassName } from \"../foundation/anatomy/class-names\";\nimport { slot, stateAttributes } from \"../foundation/anatomy/slot\";\nimport { avatarAnatomy, type AvatarSlot } from \"../foundation/anatomy/slots\";\nimport { useDsMessages } from \"../foundation/provider/context\";\nimport { cn } from \"../lib/cn\";\n\n/* -------------------------------------------------------------------------- */\n/* Sizing + status */\n/* */\n/* Per spec §5.22: */\n/* - `initials` (default): bg-bg-3 + text-fg-2, 500 medium, no border. */\n/* Use for client/contact/anonymous initials — the most common case. */\n/* - `branded`: bg-pro-bg + text-pro-fg + D8CFFF rule. Reserved for firm */\n/* members (the logged-in user, team-member assignment cells). */\n/* - `image`: the variant is irrelevant when `src` is provided; the image */\n/* covers the fallback. */\n/* */\n/* The box reads the `avatar.size.*` tokens (W3-16, target architecture */\n/* §17): Avatar's own scale under the shared size names, carrying today's */\n/* 20 / 28 / 36 / 48 / 64px. `sm`/`md` initials read the `micro`/`caption` */\n/* type-role sizes (Polish 2): same 10px/11px, now token-sourced. `xs` */\n/* stays a literal `9px` — no role sits there and half-/off-scale snaps are */\n/* reserved for the VN/D1 track (see typography-roles.md), not this pass. */\n/* -------------------------------------------------------------------------- */\n\nconst avatarVariants = cva(\n cn(\n \"ds:relative ds:inline-flex ds:shrink-0 ds:items-center ds:justify-center ds:overflow-hidden ds:rounded-full\",\n \"ds:font-mono ds:font-medium\",\n ),\n {\n variants: {\n size: {\n // 9px: off-scale, no type role — deliberately left literal (see file comment above).\n xs: \"ds:size-(--avatar-size-xs) ds:text-[9px]\",\n sm: \"ds:size-(--avatar-size-sm) ds:text-(length:--text-micro)\",\n md: \"ds:size-(--avatar-size-md) ds:text-(length:--text-caption)\",\n lg: \"ds:size-(--avatar-size-lg) ds:text-sm\",\n xl: \"ds:size-(--avatar-size-xl) ds:text-base\",\n },\n variant: {\n initials: \"ds:bg-bg-3 ds:text-fg-2\",\n branded: \"ds:border ds:border-[#D8CFFF] ds:bg-pro-bg ds:text-pro-fg\",\n },\n },\n defaultVariants: {\n size: \"md\",\n variant: \"initials\",\n },\n },\n);\n\ntype AvatarSize = NonNullable<VariantProps<typeof avatarVariants>[\"size\"]>;\n\nconst statusStyles = {\n online: \"ds:bg-success-fg\",\n away: \"ds:bg-warning-fg\",\n busy: \"ds:bg-danger-fg\",\n offline: \"ds:bg-fg-4\",\n} as const;\n\nconst statusDotSizes: Record<AvatarSize, string> = {\n xs: \"ds:size-1.5\",\n sm: \"ds:size-2\",\n md: \"ds:size-2.5\",\n lg: \"ds:size-3\",\n xl: \"ds:size-3.5\",\n};\n\n/* -------------------------------------------------------------------------- */\n/* Initials helper */\n/* -------------------------------------------------------------------------- */\n\nfunction getInitials(name: string): string {\n return name\n .split(\" \")\n .map((part) => part[0])\n .filter(Boolean)\n .slice(0, 2)\n .join(\"\")\n .toUpperCase();\n}\n\n/* -------------------------------------------------------------------------- */\n/* Avatar */\n/* Wraps Radix Root/Image/Fallback. Preserves the legacy contract: */\n/* - `src` -> renders Radix Image */\n/* - `name` -> initials fallback (auto-computed) */\n/* - `alt` -> image alt (defaults to name) */\n/* - `size` -> xs|sm|md|lg|xl */\n/* - `status` -> online|away|busy|offline (renders a corner dot) */\n/* */\n/* Anatomy (ADR-008, W3-16) — `data-slot` on every part: */\n/* root the outer positioning wrapper (`data-size`, `data-variant`) */\n/* frame the circle: the Radix root, which image and fallback clip to */\n/* image the Radix image (only when `src` is set and has loaded) */\n/* fallback the initials */\n/* status the corner dot (only when `status` is set) */\n/* */\n/* COMPAT: `className` and `ref` land on the FRAME, as they always have — */\n/* 59 consumer files depend on it (consumer usage audit §21). The target */\n/* landing is the root; until the codemod moves them, `classNames.root` */\n/* reaches the wrapper and `classNames.frame` is the same element as */\n/* `className`, so nothing a consumer wrote today moves under them. */\n/* -------------------------------------------------------------------------- */\n\n/** The Avatar parts (ADR-008). See the registry for the doc comment. */\nexport type { AvatarSlot };\n\n/**\n * Props of `Avatar`. Everything not listed spreads onto the frame (the Radix\n * root), as it always has.\n */\nexport interface AvatarProps\n extends\n Omit<React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>, \"children\">,\n VariantProps<typeof avatarVariants> {\n src?: string | null | undefined;\n alt?: string;\n name?: string | undefined;\n status?: keyof typeof statusStyles;\n /**\n * One class per part, keyed by `AvatarSlot` (ADR-008 decision 4). `root` is\n * the outer wrapper — where a `shrink-0` or a margin belongs; `frame` is the\n * circle, the same element `className` lands on. Each part's class comes\n * after the design system's own and, on the frame, before `className`, so a\n * consumer's `className` keeps winning exactly as it does today.\n *\n * Spelled out as `Partial<Record<AvatarSlot, string>>` rather than through the\n * internal `SlotClassNames` helper so the public declaration names no\n * unexported type.\n *\n * @experimental\n */\n classNames?: Partial<Record<AvatarSlot, string>>;\n}\n\nexport const Avatar = React.forwardRef<React.ElementRef<typeof AvatarPrimitive.Root>, AvatarProps>(\n function Avatar(\n { src, alt, name, size = \"md\", variant = \"initials\", status, className, classNames, ...props },\n ref,\n ) {\n const messages = useDsMessages(\"avatar\");\n const initials = name ? getInitials(name) : \"?\";\n const resolvedSize: AvatarSize = size ?? \"md\";\n const resolvedVariant = variant ?? \"initials\";\n\n return (\n <span\n {...slot(avatarAnatomy, \"root\")}\n {...stateAttributes({ size: resolvedSize, variant: resolvedVariant })}\n className={cn(\"ds:relative ds:inline-flex\", slotClassName(classNames, \"root\"))}\n >\n <AvatarPrimitive.Root\n ref={ref}\n {...slot(avatarAnatomy, \"frame\")}\n className={cn(\n avatarVariants({ size: resolvedSize, variant: resolvedVariant }),\n slotClassName(classNames, \"frame\"),\n className,\n )}\n {...props}\n >\n {src ? (\n <AvatarPrimitive.Image\n {...slot(avatarAnatomy, \"image\")}\n src={src}\n alt={alt ?? name ?? messages.image}\n className={cn(\n \"ds:aspect-square ds:size-full ds:object-cover\",\n slotClassName(classNames, \"image\"),\n )}\n />\n ) : null}\n <AvatarPrimitive.Fallback\n {...slot(avatarAnatomy, \"fallback\")}\n delayMs={src ? 200 : 0}\n className={cn(\n \"ds:flex ds:size-full ds:items-center ds:justify-center\",\n slotClassName(classNames, \"fallback\"),\n )}\n aria-label={name || messages.unknownUser}\n >\n {initials}\n </AvatarPrimitive.Fallback>\n </AvatarPrimitive.Root>\n {status && (\n <span\n {...slot(avatarAnatomy, \"status\")}\n className={cn(\n \"ds:ring-bg ds:absolute ds:right-0 ds:bottom-0 ds:block ds:rounded-full ds:ring-2\",\n statusDotSizes[resolvedSize],\n statusStyles[status],\n slotClassName(classNames, \"status\"),\n )}\n role=\"img\"\n aria-label={messages.status(status)}\n />\n )}\n </span>\n );\n },\n);\nAvatar.displayName = AvatarPrimitive.Root.displayName;\n","import { useId as useReactId } from \"react\";\n\n/**\n * L0 foundation (W2-11). Internal: not exported from the package.\n *\n * Id helpers. Generated ids come from React's `useId`, so server and client\n * agree (no counters, no randomness).\n */\n\n/**\n * Returns `explicit` when given, otherwise a stable generated id.\n * `prefix` makes generated ids readable in the DOM (`ds-«r1»`).\n */\nexport function useId(explicit?: string | null, prefix = \"ds\"): string {\n const generated = useReactId();\n return explicit ? explicit : `${prefix}-${generated}`;\n}\n\n/** Derives a part id from a base id: `partId(\"x\", \"description\")` is `\"x-description\"`. */\nexport function partId(base: string, part: string): string {\n return `${base}-${part}`;\n}\n\n/**\n * Joins id references for `aria-describedby` / `aria-labelledby`.\n * Skips empty values and duplicates and keeps the first occurrence's order.\n * Returns `undefined` when nothing is left, so the attribute is omitted\n * instead of rendered empty.\n */\nexport function joinIds(\n ...ids: ReadonlyArray<string | null | undefined | false>\n): string | undefined {\n const seen = new Set<string>();\n for (const value of ids) {\n if (!value) continue;\n for (const id of value.split(/\\s+/)) {\n if (id) seen.add(id);\n }\n }\n return seen.size > 0 ? [...seen].join(\" \") : undefined;\n}\n","/**\n * L1b field internals (W4-02). Not exported from the package.\n *\n * Whether a form control has an accessible name, decided the way axe-core's\n * `label` / `aria-input-field-name` / `aria-toggle-field-name` rules decide\n * it, so the development error `useFieldControl` prints (target architecture\n * §24.2) agrees with the a11y suite CI already runs: what axe accepts, this\n * accepts. The sweep over every story in the W4-02 pull request holds the two\n * to zero disagreements on correctly labelled controls.\n *\n * Pure DOM, no imports: the sweep bundles this file on its own.\n */\n\n/** Elements `<label for>` and a wrapping `<label>` name natively (HTML \"labelable elements\"). */\nconst LABELABLE = \"button, input, meter, output, progress, select, textarea\";\n\n/**\n * Roles named from their content (ARIA 1.2 \"name from: contents\"). A\n * `combobox`, `textbox`, `listbox`, `slider` or `spinbutton` is not among\n * them: its visible text is its value, not its name.\n */\nconst NAMED_FROM_CONTENT = new Set([\n \"button\",\n \"checkbox\",\n \"link\",\n \"menuitem\",\n \"menuitemcheckbox\",\n \"menuitemradio\",\n \"option\",\n \"radio\",\n \"switch\",\n \"tab\",\n \"treeitem\",\n]);\n\nfunction text(value: string | null | undefined): boolean {\n return typeof value === \"string\" && value.trim().length > 0;\n}\n\n/** The text a referenced element contributes to a name. */\nfunction contributesText(element: Element): boolean {\n if (text(element.getAttribute(\"aria-label\"))) return true;\n if (text(element.textContent)) return true;\n // An input referenced by aria-labelledby contributes its value.\n const value = (element as HTMLInputElement).value;\n return typeof value === \"string\" && text(value);\n}\n\n/**\n * Whether `element` can be the target of `htmlFor` (and of a wrapping label).\n * A `<div role=\"textbox\">` cannot: `Label` focuses it on click instead.\n */\nexport function isLabelable(element: Element): boolean {\n if (!element.matches(LABELABLE)) return false;\n return !(element instanceof HTMLInputElement && element.type === \"hidden\");\n}\n\n/**\n * Whether assistive technology cannot reach the element at all, in which case\n * it needs no name: `aria-hidden` on it or an ancestor, or the `hidden`\n * attribute / `type=\"hidden\"`. Display is not inspected here (no layout in\n * the check); the sweep filters computed visibility itself.\n */\nexport function isHiddenFromAssistiveTech(element: Element): boolean {\n if (element.closest('[aria-hidden=\"true\"]')) return true;\n if (element.closest(\"[hidden]\")) return true;\n return element instanceof HTMLInputElement && element.type === \"hidden\";\n}\n\n/**\n * Whether the control has an accessible name. In order: `aria-labelledby`\n * (references that resolve to text), `aria-label`, an associated `<label>`\n * with text (explicit `for` or wrapping), `title`, `placeholder` (axe's\n * `label` rule accepts it, so this does too), and the element's own content\n * when its role is named from content.\n */\nexport function hasAccessibleName(element: Element): boolean {\n const labelledBy = element.getAttribute(\"aria-labelledby\");\n if (text(labelledBy)) {\n const root = element.ownerDocument;\n const named = labelledBy!\n .split(/\\s+/)\n .filter(Boolean)\n .some((id) => {\n const target = root.getElementById(id);\n return target !== null && contributesText(target);\n });\n if (named) return true;\n }\n\n if (text(element.getAttribute(\"aria-label\"))) return true;\n\n const labels = (element as HTMLInputElement).labels;\n if (labels && labels.length > 0) {\n for (const label of Array.from(labels)) {\n if (text(label.textContent)) return true;\n }\n }\n const wrapping = element.closest(\"label\");\n if (wrapping && text(wrapping.textContent)) return true;\n\n if (text(element.getAttribute(\"title\"))) return true;\n if (text(element.getAttribute(\"placeholder\"))) return true;\n\n const role = element.getAttribute(\"role\") ?? implicitRole(element);\n // A listbox that is the popup of a combobox is named by that combobox; axe\n // (`no-naming-method-matches`) exempts it the same way.\n if (role === \"listbox\" && element.id && isComboboxPopup(element)) return true;\n if (role && NAMED_FROM_CONTENT.has(role)) {\n if (text(element.textContent)) return true;\n // A native button input is named by its value.\n if (element instanceof HTMLInputElement && text(element.value)) return true;\n }\n\n return false;\n}\n\nfunction isComboboxPopup(listbox: Element): boolean {\n const id = listbox.id;\n return Array.from(\n listbox.ownerDocument.querySelectorAll(\n \"[role=combobox][aria-controls], [role=combobox][aria-owns]\",\n ),\n ).some((combobox) => {\n const refs = `${combobox.getAttribute(\"aria-controls\") ?? \"\"} ${combobox.getAttribute(\"aria-owns\") ?? \"\"}`;\n return refs.split(/\\s+/).includes(id);\n });\n}\n\nfunction implicitRole(element: Element): string | null {\n const tag = element.tagName.toLowerCase();\n if (tag === \"button\") return \"button\";\n if (tag === \"a\" && element.hasAttribute(\"href\")) return \"link\";\n if (tag === \"input\") {\n const type = (element as HTMLInputElement).type;\n if (type === \"checkbox\" || type === \"radio\") return type;\n if (type === \"button\" || type === \"submit\" || type === \"reset\") return \"button\";\n }\n return null;\n}\n","import { createContext, useContext, type RefObject } from \"react\";\n\nimport type { FieldMessages } from \"../../../foundation/messages/types\";\n\n/**\n * L1b field internals (W2-19 scaffolding, wired to the public parts in\n * W4-01). Not exported from the package: the public surface is `Field` and\n * its parts (`field.tsx`, `fieldset.tsx`, `field-control.tsx`), `Label` and\n * `useFieldControl` (target architecture §24, ADR-006).\n */\n\n/** The parts that register themselves, so a control only references mounted ids. */\nexport const FIELD_PARTS = [\"label\", \"description\", \"error\"] as const;\n\nexport type FieldPart = (typeof FIELD_PARTS)[number];\n\n/**\n * How a `Field` lays out its parts: stacked (`vertical`, the default) or on\n * one row (`horizontal`: settings rows, Switch and Checkbox rows).\n *\n * @experimental\n */\nexport type FieldOrientation = \"vertical\" | \"horizontal\";\n\n/**\n * The copy a `Field` renders (target architecture §24.5): the field's\n * `messages` prop > `DesignSystemProvider messages.field` > English (W5-20,\n * ADR-010).\n *\n * @experimental\n */\nexport type { FieldMessages };\n\nexport interface FieldIds {\n /** The control's own id; a native control is labelled with `htmlFor` pointing here. */\n control: string;\n label: string;\n description: string;\n error: string;\n}\n\nexport interface FieldContextValue {\n /** The base id every part id is derived from. */\n id: string;\n ids: FieldIds;\n name: string | undefined;\n /** The field's own `invalid` prop, or a mounted error with content. */\n invalid: boolean;\n required: boolean;\n optional: boolean;\n disabled: boolean;\n readOnly: boolean;\n orientation: FieldOrientation;\n size: string | undefined;\n messages: FieldMessages;\n /** Which parts are mounted right now. */\n mounted: Readonly<Record<FieldPart, boolean>>;\n /** Called by a part on mount; the returned function unregisters it. */\n registerPart: (part: FieldPart) => () => void;\n /**\n * `true` once the field has committed on the client. A part that mounts\n * while this is already `true` appeared after the first paint — after an\n * interaction — which is what decides whether `FieldError` is a live region\n * (target architecture §24.1).\n */\n hasMounted: RefObject<boolean>;\n}\n\nexport const FieldContext = createContext<FieldContextValue | null>(null);\n\n/** The surrounding field, or `null` for a control used on its own. */\nexport function useFieldContext(): FieldContextValue | null {\n return useContext(FieldContext);\n}\n","\"use client\";\n\nimport { useCallback, useEffect, useRef, type RefCallback } from \"react\";\n\nimport { errorOnce } from \"../../foundation/deprecate\";\nimport { joinIds, useId } from \"../../foundation/id\";\nimport { hasAccessibleName, isHiddenFromAssistiveTech } from \"./internal/accessible-name\";\nimport { useFieldContext } from \"./internal/field-context\";\n\n/**\n * L1b (W2-19 scaffolding, public since W4-02). The integration contract of\n * target architecture §24.2: a control asks for its wiring and never knows\n * about labels. Explicit props always win over the surrounding `Field`, and a\n * control outside a field keeps working.\n *\n * Every design-system form control calls this hook (from W4-05 on). It is\n * public for product-built controls — a rich-text editor, an annotation\n * editor — that want the same binding; `FieldControl` is the same contract as\n * a Slot for a control that is already a component.\n */\n\n/**\n * What a control tells `useFieldControl`. Every prop is optional: inside a\n * `Field` the context supplies the rest, outside one the hook generates an id\n * and adds nothing else.\n *\n * @experimental\n */\nexport interface UseFieldControlProps {\n id?: string | undefined;\n name?: string | undefined;\n invalid?: boolean | undefined;\n required?: boolean | undefined;\n disabled?: boolean | undefined;\n readOnly?: boolean | undefined;\n \"aria-labelledby\"?: string | undefined;\n \"aria-describedby\"?: string | undefined;\n /**\n * `false` for a control that cannot be the target of `htmlFor` — a Radix\n * trigger, a checkbox button, a slider thumb. Those are named with\n * `aria-labelledby` and cannot carry the native `required` attribute.\n * Default `true` (`input`, `textarea`, `select`).\n */\n native?: boolean | undefined;\n}\n\n/**\n * The wiring `useFieldControl` returns. Spread it onto the control's element\n * (`<input {...wiring} />`); merge `ref` with your own through a ref callback\n * when you keep one.\n *\n * @experimental\n */\nexport interface FieldControlWiring {\n id: string;\n name: string | undefined;\n \"aria-labelledby\": string | undefined;\n \"aria-describedby\": string | undefined;\n \"aria-invalid\": true | undefined;\n \"aria-required\": true | undefined;\n required: true | undefined;\n disabled: boolean | undefined;\n readOnly: boolean | undefined;\n /** State attributes per ADR-008: present when true, absent otherwise. */\n \"data-invalid\": \"\" | undefined;\n \"data-disabled\": \"\" | undefined;\n /**\n * Attach to the control's element. In development the hook checks, once the\n * element is in the document, that it has an accessible name, and prints an\n * error (once per control) when it has none. Nothing in production.\n */\n ref: RefCallback<HTMLElement>;\n}\n\n/**\n * The wiring of one form control: `id`, `name`, ARIA references to the\n * mounted `Field` parts (description before error), invalid / required /\n * disabled / readOnly and the matching state attributes.\n *\n * Merge order: an explicit prop wins over the field; `aria-describedby` is\n * merged (field ids first, then the prop). Outside a `Field` only the\n * explicit props and a generated id remain.\n *\n * @experimental\n */\nexport function useFieldControl(props: UseFieldControlProps = {}): FieldControlWiring {\n const field = useFieldContext();\n // Always called, so the hook order never depends on the context or the props.\n const generatedId = useId(props.id, \"ds-control\");\n const native = props.native ?? true;\n\n const id = props.id ?? field?.ids.control ?? generatedId;\n const invalid = props.invalid ?? field?.invalid ?? false;\n const required = props.required ?? field?.required ?? false;\n const disabled = props.disabled ?? field?.disabled;\n const readOnly = props.readOnly ?? field?.readOnly;\n\n // Only mounted parts are referenced, and the description always comes before\n // the error (target architecture §24.4). An explicit `aria-describedby` is\n // kept and appended, never dropped.\n const describedBy = joinIds(\n field?.mounted.description && field.ids.description,\n field?.mounted.error && field.ids.error,\n props[\"aria-describedby\"],\n );\n\n // A native control is named through `htmlFor`/`id`, so it gets no\n // `aria-labelledby` unless the caller asked for one.\n const labelledBy =\n props[\"aria-labelledby\"] ?? (!native && field?.mounted.label ? field.ids.label : undefined);\n\n const element = useRef<HTMLElement | null>(null);\n const ref = useCallback<RefCallback<HTMLElement>>((node) => {\n element.current = node;\n }, []);\n\n // W4-02: the development error for a control without an accessible name.\n // The parts register themselves in effects, so the commit that mounts a\n // field renders the control before `aria-labelledby` points at its label;\n // the check therefore waits one task and reads the settled DOM (the sibling\n // parts, the element an explicit `aria-labelledby` points to). Re-checked\n // when the references change, deduped per control, nothing in production.\n useEffect(() => {\n if (process.env.NODE_ENV === \"production\" || process.env.NODE_ENV === \"test\") return;\n const timer = setTimeout(() => {\n const node = element.current;\n if (!node || !node.isConnected || isHiddenFromAssistiveTech(node)) return;\n if (hasAccessibleName(node)) return;\n const tag = node.tagName.toLowerCase();\n const key = `${tag}#${node.getAttribute(\"name\") ?? id}`;\n errorOnce(\n \"Field\",\n key,\n `the <${tag}${node.id ? ` id=\"${node.id}\"` : \"\"}> control has no accessible name. ` +\n \"Put it inside a <Field> with a <Label>, or give it aria-label / aria-labelledby.\",\n );\n }, 0);\n return () => clearTimeout(timer);\n }, [id, labelledBy, native]);\n\n return {\n id,\n name: props.name ?? field?.name,\n \"aria-labelledby\": labelledBy,\n \"aria-describedby\": describedBy,\n \"aria-invalid\": invalid ? true : undefined,\n // Native controls express it with the `required` attribute; the rest mirror\n // it in ARIA because a button cannot be `required`.\n \"aria-required\": required && !native ? true : undefined,\n required: required && native ? true : undefined,\n disabled,\n readOnly,\n \"data-invalid\": invalid ? \"\" : undefined,\n \"data-disabled\": disabled ? \"\" : undefined,\n ref,\n };\n}\n","\"use client\";\n\nimport { createContext, useContext } from \"react\";\n\n/**\n * L0 foundation (W5-20). Where portalled content (dialogs, menus, tooltips,\n * toasts) mounts when a `DesignSystemProvider portalContainer` is given.\n *\n * The shared Portal of `primitives/behavior/portal.tsx` reads this context\n * (W5-22: it is the one portal-container context; every overlay resolves its\n * container through that module). `undefined` / `null` means \"no preference\"\n * — Radix then portals to `document.body`, exactly as today.\n */\nexport const PortalContainerContext = createContext<HTMLElement | null | undefined>(undefined);\n\n/** The provider's portal container, or `undefined` when none was given. */\nexport function usePortalContainer(): HTMLElement | null | undefined {\n return useContext(PortalContainerContext);\n}\n","\"use client\";\n\nimport {\n useContext,\n useLayoutEffect,\n useState,\n type ComponentType,\n type FC,\n type ReactNode,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\n\nimport { PortalContainerContext } from \"../../foundation/provider/portal-container\";\nimport {\n themeScopeAttributes,\n useThemeScope,\n type ThemeScopeValue,\n} from \"../../foundation/theme/theme-scope\";\n\n/**\n * Portal — the one path portalled content takes out of the tree (W5-01).\n *\n * Every overlay (Dialog, AlertDialog, Sheet, Popover, HoverCard, Tooltip,\n * DropdownMenu, ContextMenu, Select, Toast, and everything built on them)\n * resolves its container here instead of letting each Radix `Portal` default\n * on its own:\n *\n * 1. the container `DesignSystemProvider portalContainer` registers through\n * the provider's `PortalContainerContext` (`foundation/provider/\n * portal-container.tsx` — the one context, W5-22) when one is set;\n * 2. else `document.body`, exactly as today — the hook returns `undefined`, so a\n * Radix `Portal` keeps its own default and its own mount timing.\n *\n * Theme propagation (W5-02). When the content originates inside a `ThemeScope`\n * (`foundation/theme/theme-scope.tsx`) — a subtree scoped to a scheme, brand,\n * density, direction or runtime brand that is *not* the document root — the\n * hook mounts a `display: contents` wrapper in the container, stamps the\n * scope's attributes and runtime-brand style on it, and portals into the\n * wrapper. Content then matches its origin instead of the document. Without a\n * `ThemeScope` no wrapper exists and the DOM is identical to before.\n *\n * SSR: nothing here touches `document` during render; the wrapper is created\n * in a layout effect, the same moment a Radix `Portal` first mounts.\n *\n * Internal (L1a). Not exported from the package.\n */\n\n/**\n * The container the provider registered, or `undefined` for `document.body`\n * (`null`, the provider's \"no preference\", folds into `undefined` here).\n */\nexport function usePortalContainerContext(): HTMLElement | undefined {\n return useContext(PortalContainerContext) ?? undefined;\n}\n\n/** `data-ds-portal` marks the wrapper the Portal creates for a nested scope. */\nconst WRAPPER_ATTRIBUTE = \"data-ds-portal\";\n\nfunction stampScope(wrapper: HTMLElement, scope: ThemeScopeValue) {\n const attributes = themeScopeAttributes(scope);\n for (const [name, value] of Object.entries(attributes)) {\n if (value === undefined) wrapper.removeAttribute(name);\n else wrapper.setAttribute(name, value);\n }\n // Replace the runtime-brand style wholesale so a scope that drops its brand\n // does not leave the previous properties behind. `display: contents` keeps\n // the wrapper out of layout and stacking.\n wrapper.removeAttribute(\"style\");\n wrapper.style.display = \"contents\";\n if (scope.brandTheme) {\n for (const [property, value] of Object.entries(scope.brandTheme)) {\n wrapper.style.setProperty(property, value);\n }\n }\n}\n\n/**\n * Resolves the container for portalled content rendered at this point in the\n * tree. An explicit `container` from the caller is returned as is (the caller\n * owns the placement); otherwise the provider's container, else `undefined`,\n * which every Radix `Portal` reads as `document.body`.\n *\n * Inside a `ThemeScope` the resolved container is a stamped wrapper mounted in\n * the provider's container (or `document.body`). Until the wrapper exists (the\n * first render) the hook returns `undefined`; a Radix `Portal` renders nothing\n * on that render anyway, so content mounts straight into the wrapper.\n */\nexport function usePortalContainer<C extends Element | DocumentFragment>(\n container?: C | null,\n): C | HTMLElement | undefined {\n const provided = usePortalContainerContext();\n const scope = useThemeScope();\n // An explicit container opts out of the scope wrapper.\n const wrap = container === undefined && scope !== null;\n const [wrapper, setWrapper] = useState<HTMLElement | null>(null);\n\n useLayoutEffect(() => {\n if (!wrap || !scope) {\n setWrapper(null);\n return;\n }\n const element = document.createElement(\"div\");\n element.setAttribute(WRAPPER_ATTRIBUTE, \"\");\n stampScope(element, scope);\n (provided ?? document.body).appendChild(element);\n setWrapper(element);\n return () => element.remove();\n }, [wrap, scope, provided]);\n\n if (container !== undefined) return container ?? undefined;\n if (wrap) return wrapper ?? undefined;\n return provided;\n}\n\ninterface PortalLikeProps {\n container?: Element | DocumentFragment | null | undefined;\n}\n\n/**\n * Wraps a Radix `*.Portal` so it portals into {@link usePortalContainer}'s\n * container unless the caller passes its own. Same props, same element type;\n * a one-line swap at each `const XPortal = XPrimitive.Portal`.\n */\nexport function withPortalContainer<P extends PortalLikeProps>(\n RadixPortal: ComponentType<P>,\n): FC<P> {\n function Portal(props: P) {\n const container = usePortalContainer(props.container);\n const merged = { ...props, container } as P;\n return <RadixPortal {...merged} />;\n }\n Portal.displayName = RadixPortal.displayName ?? \"Portal\";\n return Portal;\n}\n\nexport interface PortalProps {\n children?: ReactNode;\n /** Mount here instead of the provider's container / `document.body`. */\n container?: HTMLElement | null;\n}\n\n/**\n * Portal for surfaces that are not built on a Radix `Portal` (Toast). Renders\n * nothing on the server and on the first client render, then portals into the\n * resolved container.\n */\nexport function Portal({ children, container }: PortalProps) {\n const resolved = usePortalContainer(container);\n const [mounted, setMounted] = useState(false);\n useLayoutEffect(() => setMounted(true), []);\n const target = resolved ?? (mounted ? document.body : null);\n return target ? createPortal(children, target) : null;\n}\n","\"use client\";\n\nimport * as React from \"react\";\n\n/**\n * L1a behaviour primitive (private). Not exported from the package.\n *\n * Overlay presence (W5-04, ADR-012): how a surface enters and leaves the\n * DOM. Spike S4 measured that Radix `Presence` defers an unmount only for a\n * running CSS *animation* whose name differs from the one it saw on mount,\n * so every overlay animates with `@keyframes` selected by `data-state` —\n * never with a transition (ADR-012 decisions 1–3). The keyframes and the\n * `animation-*` longhands live in `src/styles/components/presence.css`\n * (inside `@layer ds` in the prefixed build), keyed by the one attribute\n * this module stamps:\n *\n * ```tsx\n * <DialogPrimitive.Content {...presence(\"modal\")} … />\n * // <div data-ds-presence=\"modal\" data-state=\"open\" …>\n * ```\n *\n * Durations and eases resolve from the W2-09 motion roles\n * (`--motion-duration-overlay` / `-overlay-exit` / `-spatial`,\n * `--motion-ease-enter` / `-exit`); the `animation-name` reads\n * `var(--motion-presence-name, ds-<motion>-enter)`, which the token layer\n * resolves to `none` under `prefers-reduced-motion` so nothing animates and\n * the unmount is synchronous (decision 4). The attribute is additive: no\n * `data-slot`, role or `data-state` changes (plan §17.1).\n *\n * Radix surfaces need nothing else. A hand-rolled surface (Toast) pairs the\n * attribute with {@link useExitPresence}, which keeps the element mounted\n * until its own animations have settled — no timers (decision 5).\n */\n\n/**\n * The motion of a surface: `fade` (a backdrop), `modal` (a centred box),\n * `floating` (a popper-anchored surface: popover, menu, tooltip, hover\n * card), `sheet-<side>` (a docked panel), `responsive` (a bottom panel below\n * the `sm` breakpoint, a centred box from it — W5-09), `spotlight` (a\n * keyboard-opened palette: no enter, a fade out — W5-19) or `toast`.\n */\nexport type PresenceMotion =\n | \"fade\"\n | \"modal\"\n | \"floating\"\n | \"sheet-top\"\n | \"sheet-right\"\n | \"sheet-bottom\"\n | \"sheet-left\"\n | \"responsive\"\n | \"spotlight\"\n | \"toast\";\n\n/** The attribute `presence.css` keys its rules on. */\nexport const PRESENCE_ATTRIBUTE = \"data-ds-presence\";\n\nexport interface PresenceAttributes {\n \"data-ds-presence\": PresenceMotion;\n}\n\n/** The presence stamp of one surface. Spread onto the element that carries `data-state`. */\nexport function presence(motion: PresenceMotion): PresenceAttributes {\n return { [PRESENCE_ATTRIBUTE]: motion };\n}\n\n/**\n * Keeps a non-Radix surface mounted until its exit animation has finished.\n *\n * When `open` turns false the caller has already rendered\n * `data-state=\"closed\"`; this effect reads the animations running on the\n * element (`getAnimations()` flushes style, so the exit keyframes started by\n * that commit are visible) and calls `onExited` once every one of them has\n * settled. With nothing running — reduced motion, a duration override of\n * `0ms`, or an environment without the Web Animations API (jsdom) — it calls\n * back in the same commit, which is the S4 \"unmount within one frame\" rule.\n * Re-opening mid-exit cancels the pending callback.\n *\n * The animations' `finished` promises are the signal; a bounded fallback —\n * the longest running animation's remaining time plus one frame's grace —\n * covers an animation that never settles (a tab throttled to a halt, a\n * cancelled effect whose promise rejects late), so a closed surface can never\n * stay mounted indefinitely. It is a guard, not the mechanism: it never fires\n * before the animation would have.\n */\nexport function useExitPresence(\n ref: React.RefObject<HTMLElement | null>,\n open: boolean,\n onExited: () => void,\n): void {\n const onExitedRef = React.useRef(onExited);\n onExitedRef.current = onExited;\n\n React.useLayoutEffect(() => {\n if (open) return undefined;\n const node = ref.current;\n const running =\n node && typeof node.getAnimations === \"function\"\n ? node.getAnimations().filter((animation) => animation.playState !== \"finished\")\n : [];\n if (running.length === 0) {\n onExitedRef.current();\n return undefined;\n }\n let active = true;\n const exit = () => {\n if (!active) return;\n active = false;\n onExitedRef.current();\n };\n Promise.allSettled(running.map((animation) => animation.finished)).then(exit);\n const guard = setTimeout(exit, remainingTime(running) + EXIT_GUARD_GRACE_MS);\n return () => {\n active = false;\n clearTimeout(guard);\n };\n }, [open, ref]);\n}\n\n/** One frame at 20 fps: the grace the fallback adds to the animations' own end. */\nconst EXIT_GUARD_GRACE_MS = 50;\n\n/** The longest remaining time of the given animations, in milliseconds. */\nfunction remainingTime(animations: readonly Animation[]): number {\n let longest = 0;\n for (const animation of animations) {\n const timing = animation.effect?.getComputedTiming();\n const end = typeof timing?.endTime === \"number\" ? timing.endTime : 0;\n const current = typeof animation.currentTime === \"number\" ? animation.currentTime : 0;\n longest = Math.max(longest, end - current);\n }\n return Number.isFinite(longest) ? longest : 0;\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\n\nimport { tooltipAnatomy, type TooltipSlot } from \"../foundation/anatomy/slots\";\nimport { slot } from \"../foundation/anatomy/slot\";\nimport { deprecate } from \"../foundation/deprecate\";\nimport { TOOLTIP_DEFAULT_DELAY_MS, useSharedTooltipProvider } from \"../foundation/provider/context\";\nimport { cn } from \"../lib/cn\";\nimport { withPortalContainer } from \"./behavior/portal\";\nimport { presence } from \"./behavior/presence\";\n\n/* ───────────────────────────────────────────────────────────────────────\n * Tooltip — Radix UI tooltip primitive. Modified\n *\n * The root `Tooltip` needs a Radix `TooltipPrimitive.Provider` above it.\n * Under a `DesignSystemProvider` (W5-20) that is the one shared provider\n * the app mounts — its `tooltip` defaults apply, and sibling tooltips open\n * instantly within `skipDelayDuration` of each other (ADR-012 finding 11).\n * Without one, `Tooltip` wraps a provider per instance, as it always has,\n * so single-use tooltips work without app-level scaffolding and the timing\n * is unchanged (`delayDuration` 300ms).\n *\n * Public API preserved:\n * Tooltip (with `delayMs` prop), TooltipTrigger, TooltipContent\n *\n * NEW (additive): TooltipProvider, TooltipPortal are exported; `delayMs`\n * is a deprecated alias of `delayDuration` (C-TOOLTIP-DELAY, W5-12;\n * codemod CM-13); `TooltipContent` takes `maxWidth`.\n * ─────────────────────────────────────────────────────────────────────── */\n\n/** The tooltip parts (ADR-008). See the registry for the doc comment. */\nexport type { TooltipSlot };\n\nconst TooltipProvider = TooltipPrimitive.Provider;\nconst TooltipTrigger = TooltipPrimitive.Trigger;\nconst TooltipPortal = withPortalContainer(TooltipPrimitive.Portal);\n\nexport interface TooltipProps extends React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Root> {\n /**\n * Alias of Radix's `delayDuration`. `delayDuration` wins when both are\n * given. Contract C-TOOLTIP-DELAY, removed in 3.0; codemod CM-13 renames it.\n *\n * @deprecated Use `delayDuration`.\n */\n delayMs?: number;\n /**\n * How long the pointer rests on the trigger before the tooltip opens, in\n * milliseconds. Default: the surrounding provider's (`DesignSystemProvider\n * tooltip.delayDuration`), or 300 without one.\n */\n delayDuration?: number;\n}\n\nconst Tooltip = ({ delayMs, delayDuration, children, ...props }: TooltipProps) => {\n const shared = useSharedTooltipProvider();\n if (delayMs !== undefined) {\n deprecate(\n \"C-TOOLTIP-DELAY\",\n \"delayMs\",\n \"`Tooltip delayMs` is an alias of `delayDuration` and is removed in 3.0; codemod CM-13 renames it.\",\n );\n }\n const requested = delayDuration ?? delayMs;\n if (shared) {\n // The DesignSystemProvider's TooltipProvider is above: its defaults apply\n // unless this tooltip asks for its own delay.\n return (\n <TooltipPrimitive.Root\n {...(requested !== undefined && { delayDuration: requested })}\n {...props}\n >\n {children}\n </TooltipPrimitive.Root>\n );\n }\n const resolvedDelay = requested ?? TOOLTIP_DEFAULT_DELAY_MS;\n return (\n <TooltipPrimitive.Provider delayDuration={resolvedDelay}>\n <TooltipPrimitive.Root delayDuration={resolvedDelay} {...props}>\n {children}\n </TooltipPrimitive.Root>\n </TooltipPrimitive.Provider>\n );\n};\nTooltip.displayName = \"Tooltip\";\n\n/**\n * How wide a `TooltipContent` may grow before its text wraps. `xs` (20rem)\n * is what the tooltip always rendered; `sm` and `md` are 24rem and 28rem for\n * multi-line help; `none` lets the text set the width. Replaces the `max-w-*`\n * class consumers wrote on `className` (a third of them today).\n *\n * @experimental\n */\nexport type TooltipMaxWidth = \"xs\" | \"sm\" | \"md\" | \"none\";\n\nconst TOOLTIP_MAX_WIDTH: Readonly<Record<TooltipMaxWidth, string>> = {\n xs: \"ds:max-w-xs\",\n sm: \"ds:max-w-sm\",\n md: \"ds:max-w-md\",\n none: \"ds:max-w-none\",\n};\n\nexport interface TooltipContentProps extends React.ComponentPropsWithoutRef<\n typeof TooltipPrimitive.Content\n> {\n /** See {@link TooltipMaxWidth}. Default `xs`. @experimental */\n maxWidth?: TooltipMaxWidth;\n}\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n TooltipContentProps\n>(({ className, sideOffset = 6, maxWidth = \"xs\", ...props }, ref) => (\n <TooltipPortal>\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n {...slot(tooltipAnatomy, \"content\")}\n {...presence(\"floating\")}\n className={cn(\n \"ds:rounded-card ds:border-rule ds:bg-surface ds:z-[var(--z-tooltip)]\",\n TOOLTIP_MAX_WIDTH[maxWidth],\n \"ds:border ds:px-2.5 ds:py-1.5\",\n \"ds:font-body ds:text-fg ds:shadow-pop ds:text-xs ds:leading-tight\",\n className,\n )}\n {...props}\n />\n </TooltipPortal>\n));\nTooltipContent.displayName = TooltipPrimitive.Content.displayName;\n\nexport { Tooltip, TooltipProvider, TooltipTrigger, TooltipPortal, TooltipContent };\n\n/**\n * @internal The bare Radix root, for composites that mount their own\n * `TooltipProvider` and need its grouping (skip-delay between neighbours).\n * `Tooltip` above wraps each root in a provider of its own when no\n * `DesignSystemProvider` is present, which isolates every tooltip. Not\n * re-exported from the package.\n */\nexport const TooltipRoot = TooltipPrimitive.Root;\n","import type { ControlSize } from \"../../foundation/vocab\";\n\n/**\n * L1a behaviour primitive (private). Not exported from the package.\n *\n * The shared control-scale rows (A1, ADR-013; W2-03 tokens): one class string\n * per size name, every value a `--control-*-<size>` token, so a control that\n * reads a row is the height, padding, label size, gap and glyph size the\n * scale says — and the density scope moves it. `IconButton` (W3-09) and\n * `Chip` (W3-15) read these; Button keeps its own table in `button-base.ts`\n * because two of its rows (`md`, `lg`) are D5-gated compat pixels.\n *\n * No React, no client directive: a table of strings Tailwind scans.\n */\n\n/** Text controls: height, horizontal padding, label size, gap and glyph. */\nexport const CONTROL_SIZE_CLASSES: Readonly<Record<ControlSize, string>> = {\n xs: \"ds:h-(--control-height-xs) ds:px-(--control-padding-x-xs) ds:text-(length:--control-font-size-xs) ds:gap-(--control-gap-xs) ds:[&_svg]:size-(--control-icon-xs)\",\n sm: \"ds:h-(--control-height-sm) ds:px-(--control-padding-x-sm) ds:text-(length:--control-font-size-sm) ds:gap-(--control-gap-sm) ds:[&_svg]:size-(--control-icon-sm)\",\n md: \"ds:h-(--control-height-md) ds:px-(--control-padding-x-md) ds:text-(length:--control-font-size-md) ds:gap-(--control-gap-md) ds:[&_svg]:size-(--control-icon-md)\",\n lg: \"ds:h-(--control-height-lg) ds:px-(--control-padding-x-lg) ds:text-(length:--control-font-size-lg) ds:gap-(--control-gap-lg) ds:[&_svg]:size-(--control-icon-lg)\",\n xl: \"ds:h-(--control-height-xl) ds:px-(--control-padding-x-xl) ds:text-(length:--control-font-size-xl) ds:gap-(--control-gap-xl) ds:[&_svg]:size-(--control-icon-xl)\",\n};\n\n/** Icon-only controls: a square of the control height with the scale's glyph. */\nexport const SQUARE_CONTROL_SIZE_CLASSES: Readonly<Record<ControlSize, string>> = {\n xs: \"ds:size-(--control-height-xs) ds:[&_svg]:size-(--control-icon-xs)\",\n sm: \"ds:size-(--control-height-sm) ds:[&_svg]:size-(--control-icon-sm)\",\n md: \"ds:size-(--control-height-md) ds:[&_svg]:size-(--control-icon-md)\",\n lg: \"ds:size-(--control-height-lg) ds:[&_svg]:size-(--control-icon-lg)\",\n xl: \"ds:size-(--control-height-xl) ds:[&_svg]:size-(--control-icon-xl)\",\n};\n\n/** The gap of a size, for a part that lays out its own children. */\nexport const CONTROL_GAP_CLASSES: Readonly<Record<ControlSize, string>> = {\n xs: \"ds:gap-(--control-gap-xs)\",\n sm: \"ds:gap-(--control-gap-sm)\",\n md: \"ds:gap-(--control-gap-md)\",\n lg: \"ds:gap-(--control-gap-lg)\",\n xl: \"ds:gap-(--control-gap-xl)\",\n};\n","\"use client\";\n\nimport { forwardRef, type ReactNode } from \"react\";\n\nimport { iconButtonAnatomy, type IconButtonSlot } from \"../foundation/anatomy/slots\";\nimport { slot, stateAttributes } from \"../foundation/anatomy/slot\";\nimport type { ControlSize } from \"../foundation/vocab\";\nimport { cn } from \"../lib/cn\";\n\nimport {\n buttonBase,\n resolveButtonStyle,\n type ButtonIntent,\n type ButtonIntentAlias,\n type ButtonVariant,\n} from \"./behavior/button-base\";\nimport { SQUARE_CONTROL_SIZE_CLASSES } from \"./behavior/control-size\";\nimport { Slot } from \"./behavior/slot\";\nimport { Spinner } from \"./spinner\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"./tooltip\";\n\n/** The icon button parts (ADR-008). See the registry for the doc comment. */\nexport type { IconButtonSlot };\n\n/* ────────────────────────────────────────────────────────────────────────────\n * IconButton — an icon-only action (W3-09; target architecture §30.2).\n *\n * A separate component, not a Button mode, because the contract differs: an\n * icon-only control *requires* an accessible name, is square, and usually\n * wants a tooltip. `label` is that name — `aria-label` on the element and,\n * by default, the tooltip's text (shown on hover *and* focus, so a keyboard\n * user sees it too). Without `label` the props do not type-check, and in\n * development the component throws when it mounts.\n *\n * Look: the same two axes as Button (`variant` × `intent`, one resolver,\n * ADR-007) on the same `buttonBase` recipe — focus ring, press feedback,\n * disabled and loading states are written once.\n *\n * Geometry (A1, ADR-013): `size` is the *outer control height*, square, read\n * from the shared scale — `xs` 28 · `sm` 32 · `md` 36 · `lg` 40 · `xl` 48\n * (`--ds-control-height-*`), with the glyph from `--ds-control-icon-*`. The\n * default is `md`, the scale's token: 36px today, which decision D5 may move.\n * There is no IconButton-only size word (A1); the legacy `Button\n * size=\"icon\" | \"icon-sm\"` squares (40 / 28) are `lg` / `xs` here, and\n * `Button size=\"icon-xs\"` (24) has no named step until D5 decides whether a\n * shared `2xs` exists. `tests/browser/icon-button-geometry.test.tsx` holds the\n * two families to the same pixels.\n * ──────────────────────────────────────────────────────────────────────────── */\n\n/**\n * The IconButton sizes: the shared control scale, nothing else (A1).\n *\n * @experimental\n */\nexport type IconButtonSize = ControlSize;\n\n/** Where the default tooltip opens. @experimental */\nexport type IconButtonTooltipSide = \"top\" | \"right\" | \"bottom\" | \"left\";\n\n/** @experimental */\nexport interface IconButtonProps extends Omit<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n \"aria-label\" | \"children\"\n> {\n /**\n * The accessible name — what a screen reader says and, by default, what the\n * tooltip shows. Required: an icon alone is not a name.\n */\n label: string;\n /** The glyph. `children` is accepted as an alias for `<IconButton label=\"…\"><Icon /></IconButton>`. */\n icon?: ReactNode;\n children?: ReactNode;\n /**\n * Visual emphasis, as on Button: `solid` (default) · `soft` · `outline` ·\n * `ghost` · `link`. The legacy Button words resolve through the same table.\n */\n variant?: ButtonVariant;\n /**\n * Meaning → colour family: `brand` · `neutral` · `success` · `danger`.\n * Defaults per variant, as on Button. `destructive` is a deprecated alias\n * of `danger` (decision D4).\n */\n intent?: ButtonIntent | ButtonIntentAlias;\n /**\n * Outer size, square, from the shared control scale (A1): `xs` 28 · `sm` 32\n * · `md` 36 (default; D5-gated token) · `lg` 40 · `xl` 48.\n */\n size?: IconButtonSize;\n /**\n * `true` (default) shows `label` in a tooltip on hover and focus; `false`\n * renders no tooltip (the `aria-label` stays); a node replaces the text.\n * The tooltip is never the only source of the name.\n */\n tooltip?: boolean | ReactNode;\n /** Side the tooltip opens on. Default `top`. */\n tooltipSide?: IconButtonTooltipSide;\n /** Render the child element instead of a `<button>` (Radix `Slot`). */\n asChild?: boolean;\n /** Replaces the glyph with a spinner, sets `aria-busy` and disables the control. */\n loading?: boolean;\n /**\n * Toggle state (a boolean prop, never a variant — ADR-007 §2). Reflected as\n * `aria-pressed` and, when true, `data-pressed`.\n */\n pressed?: boolean;\n}\n\n/**\n * The IconButton class recipe: `buttonBase` (look resolved from `variant` +\n * `intent`, no text-button size row) plus the square control-scale size, so\n * `IconButton size=\"sm\"` and `Button size=\"sm\"` are the same height by\n * construction. Server-safe.\n *\n * @experimental\n */\nexport function iconButtonVariants({\n variant,\n intent,\n size = \"md\",\n className,\n}: {\n variant?: ButtonVariant | null | undefined;\n intent?: ButtonIntent | ButtonIntentAlias | null | undefined;\n size?: IconButtonSize | null | undefined;\n className?: string | null | undefined;\n} = {}): string {\n const { look } = resolveButtonStyle({ variant, intent });\n return cn(\n buttonBase({ look, size: null }),\n \"ds:shrink-0 ds:p-0\",\n SQUARE_CONTROL_SIZE_CLASSES[size ?? \"md\"],\n className,\n );\n}\n\n/**\n * An icon-only action with a required accessible name, a tooltip by default\n * and the Button family's look on a square control-scale geometry. See the\n * module comment.\n *\n * @experimental\n */\nexport const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(function IconButton(\n {\n label,\n icon,\n children,\n variant,\n intent,\n size = \"md\",\n tooltip = true,\n tooltipSide,\n asChild = false,\n loading,\n pressed,\n disabled,\n className,\n ...props\n },\n ref,\n) {\n if (process.env.NODE_ENV !== \"production\" && typeof label !== \"string\") {\n // The type requires it; this catches the untyped call (`{...spread}`, JS,\n // `as any`). An icon-only control without a name is an accessibility\n // defect, not a preference (target architecture §41, ADR-015).\n throw new Error(\n \"[IconButton] `label` is required: it is the accessible name of an icon-only control (and its default tooltip).\",\n );\n }\n\n const style = resolveButtonStyle({ variant, intent });\n const state = stateAttributes({\n variant: style.variant,\n intent: style.intent,\n size,\n disabled: asChild ? undefined : disabled || loading,\n loading: asChild ? undefined : loading,\n pressed,\n });\n const classes = iconButtonVariants({ variant, intent, size, className });\n const glyph = icon ?? children;\n\n const control = asChild ? (\n <Slot\n ref={ref}\n aria-label={label}\n aria-pressed={pressed}\n {...slot(iconButtonAnatomy, \"root\")}\n {...state}\n className={classes}\n {...props}\n >\n {glyph}\n </Slot>\n ) : (\n <button\n ref={ref}\n type=\"button\"\n aria-label={label}\n aria-pressed={pressed}\n aria-busy={loading || undefined}\n disabled={disabled || loading}\n {...slot(iconButtonAnatomy, \"root\")}\n {...state}\n className={classes}\n {...props}\n >\n {loading ? (\n // `size={null}`: the glyph box is the button's `--ds-control-icon-*`.\n <Spinner size={null} {...slot(iconButtonAnatomy, \"spinner\")} />\n ) : (\n <span\n {...slot(iconButtonAnatomy, \"icon\")}\n className=\"ds:inline-flex ds:shrink-0\"\n aria-hidden=\"true\"\n >\n {glyph}\n </span>\n )}\n </button>\n );\n\n if (tooltip === false || tooltip === null || tooltip === undefined) return control;\n\n return (\n <Tooltip>\n <TooltipTrigger asChild>{control}</TooltipTrigger>\n <TooltipContent {...(tooltipSide !== undefined && { side: tooltipSide })}>\n {tooltip === true ? label : tooltip}\n </TooltipContent>\n </Tooltip>\n );\n});\n\nIconButton.displayName = \"IconButton\";\n","import { useCallback, useRef, useState } from \"react\";\n\n/**\n * L0 foundation (W2-11). Internal: not exported from the package.\n *\n * One controlled/uncontrolled implementation for every value, checked and open\n * state (target architecture §25, §27).\n */\n\n/**\n * The prop triple of a controllable state, named after `key`:\n *\n * ```ts\n * Controllable<\"value\", string>\n * // { value?: string; defaultValue?: string; onValueChange?: (value: string) => void }\n * Controllable<\"open\", boolean>\n * // { open?: boolean; defaultOpen?: boolean; onOpenChange?: (open: boolean) => void }\n * ```\n */\nexport type Controllable<K extends string, T> = {\n [P in K]?: T;\n} & {\n [P in `default${Capitalize<K>}`]?: T;\n} & {\n [P in `on${Capitalize<K>}Change`]?: (next: T) => void;\n};\n\nexport type SetStateAction<T> = T | ((previous: T) => T);\n\nexport interface UseControllableStateOptions<T> {\n /** The controlled value. `undefined` means \"uncontrolled\". */\n prop?: T | undefined;\n /** Initial value while uncontrolled. Read on the first render only. */\n defaultProp: T;\n /** Called when the value changes, in both modes. Not called when the next value is identical. */\n onChange?: ((next: T) => void) | undefined;\n}\n\n/**\n * Returns `[value, setValue]`.\n *\n * - Controlled when `prop !== undefined`: `value` is always `prop`; `setValue`\n * only calls `onChange`.\n * - Uncontrolled otherwise: internal state starting at `defaultProp`; `setValue`\n * updates it and calls `onChange`.\n * - `setValue` accepts an updater function, resolved against the current value.\n * - `setValue` is referentially stable, and always uses the latest `onChange`.\n * - `onChange` is not called when the next value is `Object.is`-equal to the\n * current one.\n */\nexport function useControllableState<T>({\n prop,\n defaultProp,\n onChange,\n}: UseControllableStateOptions<T>): [T, (next: SetStateAction<T>) => void] {\n const [uncontrolled, setUncontrolled] = useState<T>(defaultProp);\n const isControlled = prop !== undefined;\n const value = isControlled ? (prop as T) : uncontrolled;\n\n // Latest values for the stable setter. Written during render so a setter\n // called from an event handler sees the props of the last committed render.\n const latest = useRef({ value, isControlled, onChange });\n latest.current = { value, isControlled, onChange };\n\n const setValue = useCallback((next: SetStateAction<T>) => {\n const current = latest.current;\n const resolved =\n typeof next === \"function\" ? (next as (previous: T) => T)(current.value) : next;\n if (Object.is(resolved, current.value)) return;\n if (!current.isControlled) setUncontrolled(resolved);\n // Keep consecutive calls in one event consistent in uncontrolled mode.\n latest.current = { ...current, value: resolved };\n current.onChange?.(resolved);\n }, []);\n\n return [value, setValue];\n}\n","import type { Anatomy, SlotOf } from \"../../../foundation/anatomy/define\";\nimport { slot, type SlotAttributes } from \"../../../foundation/anatomy/slot\";\n\n/**\n * L1a behaviour primitive (private). Not exported from the package.\n *\n * The attributes a list row carries (W4-09; ADR-008, target architecture\n * §29.2 and §32): its `data-slot` (`select-item`, `combobox-item`), the state attributes\n * the recipe's selectors read (`data-highlighted`, `data-selected`,\n * `data-disabled`) and the `option` role with its `aria-*` twins for a\n * listbox that drives selection itself (`Combobox`, W4-10). Radix-rendered\n * rows (`SelectItem`, menu items) stamp only the slot: Radix owns their\n * `data-state`, `data-disabled`, `data-highlighted` and `aria-selected`\n * (`P-DATA-STATE`), and the recipe's `focus:`/`data-[state=checked]` rows\n * read those.\n *\n * `[cmdk-item]` (C-CMDK-ATTR, no longer a contract since 2.0): a list that\n * replaces cmdk still stamps it by passing `cmdkCompat`, but nothing\n * guarantees it and it may go in any 2.x release. Locate rows by\n * `[data-slot=combobox-item]` / `role=\"option\"`, the documented contract.\n */\n\n/** An anatomy that declares an `item` part. */\nexport type ItemAnatomy<A extends Anatomy = Anatomy> = \"item\" extends SlotOf<A> ? A : never;\n\n/** The `data-slot` attribute of a component's row (`select-item` for Select). */\nexport function itemSlot<A extends Anatomy>(anatomy: ItemAnatomy<A>): SlotAttributes {\n return slot(anatomy as Anatomy<\"item\">, \"item\");\n}\n\nexport interface ListItemState {\n /** The row the keyboard or pointer is on. */\n highlighted?: boolean | undefined;\n /** The row that is part of the value. */\n selected?: boolean | undefined;\n disabled?: boolean | undefined;\n}\n\nexport interface ListItemAttributeOptions extends ListItemState {\n /** The row's DOM id, the one `aria-activedescendant` points at. */\n id?: string | undefined;\n /**\n * Also stamp `cmdk-item=\"\"` on a row cmdk did not render (C-CMDK-ATTR).\n * Not guaranteed since 2.0.\n */\n cmdkCompat?: boolean | undefined;\n}\n\nexport interface ListItemAttributes extends SlotAttributes {\n role: \"option\";\n id?: string;\n \"aria-selected\": boolean;\n \"aria-disabled\"?: true;\n \"data-highlighted\"?: \"\";\n \"data-selected\"?: \"\";\n \"data-disabled\"?: \"\";\n \"cmdk-item\"?: \"\";\n}\n\n/**\n * Every attribute of a self-driven listbox row: the slot, `role=\"option\"`,\n * `aria-selected` (always present — a listbox option without it is\n * announced as unselectable), `aria-disabled` when disabled, and the boolean\n * `data-*` states as valueless attributes so `[data-highlighted]` selects.\n * Spread onto the element; the recipe's `data-highlighted`/`aria-selected`\n * rows style it.\n */\nexport function listItemAttributes<A extends Anatomy>(\n anatomy: ItemAnatomy<A>,\n { id, highlighted, selected, disabled, cmdkCompat }: ListItemAttributeOptions = {},\n): ListItemAttributes {\n const attributes: ListItemAttributes = {\n ...itemSlot(anatomy),\n role: \"option\",\n \"aria-selected\": selected === true,\n };\n if (id !== undefined) attributes.id = id;\n if (disabled) attributes[\"aria-disabled\"] = true;\n if (highlighted) attributes[\"data-highlighted\"] = \"\";\n if (selected) attributes[\"data-selected\"] = \"\";\n if (disabled) attributes[\"data-disabled\"] = \"\";\n if (cmdkCompat) attributes[\"cmdk-item\"] = \"\";\n return attributes;\n}\n\n/**\n * The DOM id of a row, derived from the list's id and the row's value, so\n * `aria-activedescendant` can name it without a ref per row. Values are\n * consumer strings and may hold characters an id must not (spaces, quotes),\n * so the value is encoded, and decoded back by {@link optionValueFromId}.\n */\nexport function optionElementId(listId: string, value: string): string {\n return `${listId}-option-${encodeURIComponent(value)}`;\n}\n\n/** The value {@link optionElementId} encoded into `id`, or `undefined` for a foreign id. */\nexport function optionValueFromId(\n listId: string,\n id: string | null | undefined,\n): string | undefined {\n if (!id) return undefined;\n const prefix = `${listId}-option-`;\n if (!id.startsWith(prefix)) return undefined;\n try {\n return decodeURIComponent(id.slice(prefix.length));\n } catch {\n return undefined;\n }\n}\n","/**\n * L1a behaviour primitive (private). Not exported from the package.\n *\n * The one class recipe of a list row (W4-09; target architecture §32 \"one\n * list implementation\", plan lock L-MENU): what a row in a `Select`, a\n * `Combobox` listbox or a `Menu` looks like at rest, highlighted, selected\n * and disabled, plus the group heading, the separator and the indicator\n * well beside it. `SelectItem` reads it first, with zero diff\n * (`src/primitives/__tests__/select-list-classes.test.tsx` pins every class\n * string to the bytes recorded from `main` before the adoption); `Combobox`\n * (W4-10) reads it next, and the menus follow in W5-13/14.\n *\n * Every row is a full literal so Tailwind's scanner sees it: never build a\n * class from a template. Rows are joined in one fixed order — box, label\n * size, interaction, ink, motion, highlighted, selected, disabled, glyph —\n * which is the order the adopted components already wrote them in, so a\n * component that moves onto the recipe keeps its class string byte for byte.\n *\n * Three axes the adopters differ on today, each a table rather than a\n * template so the CSS that ships is exactly the rows that are used:\n *\n * - {@link ListItemFrame}: box, padding and radius. `select` keeps a\n * trailing 1rem indicator well (`pr-8`) and is `w-full`; the menu frames\n * keep a leading well (`pl-8`) for check/radio items. The `Combobox`\n * listbox (W4-10) adds its frame here when it renders one. The label size\n * is the component's ({@link ListItemRecipe.labelSize}).\n * - {@link ListItemPalette}: `neutral` (Select, ContextMenu, SearchSelect) or\n * `menu` (DropdownMenu's `menu.item.*` tokens).\n * - {@link ListItemHighlight}: how the pointer/keyboard row is marked. Radix\n * focuses the item (`focus:`), cmdk stamps `data-selected=\"true\"`, and an\n * `aria-activedescendant` listbox stamps `data-highlighted` (the row never\n * receives focus) — see `item-attributes.ts`.\n *\n * No React, no client directive: tables of strings and one join.\n */\n\n/** Box, padding and radius of a row; the label size is the component's. */\nexport type ListItemFrame = \"select\" | \"menu\" | \"menu-indicator\";\n\n/** The colour family a row draws from. */\nexport type ListItemPalette = \"neutral\" | \"menu\";\n\n/** The selector that marks the highlighted row. */\nexport type ListItemHighlight = \"focus\" | \"cmdk\" | \"data-highlighted\";\n\n/** The selector that marks the selected row, or none (a menu has no selection). */\nexport type ListItemSelected = \"radix-checked\" | \"aria-selected\" | \"none\";\n\n/**\n * The box of a row: radius, layout, cursor, gap and padding. The label size\n * is not here — it is the one metric each component owns (`Select` takes it\n * from the control scale in W4-08, the menus from `menu.item.*` in W5-13),\n * so the recipe takes it as {@link ListItemRecipe.labelSize} and the\n * arbitrary-values ratchet keeps attributing today's pixel to the component\n * that renders it.\n */\n// `cursor-pointer`, not `cursor-default`: every row here is a click target\n// (a Select option, a Combobox option, a menu item) — Tailwind 4's preflight\n// no longer forces a hand cursor on non-anchor elements the way its v2 did,\n// so a row rendered on a `<div role=\"option\">`/`<button>` reads as inert to\n// a mouse user without this. A disabled row falls back through\n// `LIST_ITEM_DISABLED`'s `pointer-events-none`, which already shows the\n// inherited/default cursor with nothing further needed here.\nexport const LIST_ITEM_BOX: Readonly<Record<ListItemFrame, string>> = {\n select:\n \"ds:rounded-surface-sm ds:relative ds:flex ds:w-full ds:cursor-pointer ds:items-center ds:gap-2 ds:py-1.5 ds:pr-8 ds:pl-2\",\n menu: \"ds:rounded-surface-sm ds:relative ds:flex ds:cursor-pointer ds:items-center ds:gap-2 ds:px-2 ds:py-1.5\",\n \"menu-indicator\":\n \"ds:rounded-surface-sm ds:relative ds:flex ds:cursor-pointer ds:items-center ds:gap-2 ds:py-1.5 ds:pr-2 ds:pl-8\",\n};\n\n/** A row is a target, not text: no focus outline of its own, no text selection. */\nexport const LIST_ITEM_INTERACTION = \"ds:outline-none ds:select-none\";\n\n/** The resting text colour of a row. */\nexport const LIST_ITEM_INK: Readonly<Record<ListItemPalette, string>> = {\n neutral: \"ds:text-fg-2\",\n menu: \"ds:text-menu-item-fg\",\n};\n\n/** Colour transition with its reduced-motion gate; every row carries it. */\nexport const LIST_ITEM_MOTION =\n \"ds:transition-colors ds:duration-[var(--duration-fast)] ds:ease-[var(--ease-out-quart)] ds:motion-reduce:transition-none\";\n\n/**\n * The highlighted row, per palette and per selector. Only the pairs a\n * component renders are written, because every literal here becomes CSS that\n * ships: the menu palette is focus-driven (Radix menus) until a menu needs\n * another selector, and {@link listItemClasses} throws on a pair that has no\n * row yet rather than templating one Tailwind would never see.\n */\nexport const LIST_ITEM_HIGHLIGHTED: Readonly<\n Record<ListItemPalette, Readonly<Partial<Record<ListItemHighlight, string>>>>\n> = {\n neutral: {\n focus: \"ds:focus:bg-bg-2 ds:focus:text-fg\",\n cmdk: \"ds:data-[selected=true]:bg-bg-2 ds:data-[selected=true]:text-fg\",\n \"data-highlighted\": \"ds:data-[highlighted]:bg-bg-2 ds:data-[highlighted]:text-fg\",\n },\n menu: {\n focus: \"ds:focus:bg-menu-item-hover-bg ds:focus:text-menu-item-hover-fg\",\n },\n};\n\n/** The selected row: brand wash and brand ink, per selector. */\nexport const LIST_ITEM_SELECTED: Readonly<Record<ListItemSelected, string>> = {\n \"radix-checked\": \"ds:data-[state=checked]:bg-brand-bg ds:data-[state=checked]:text-brand\",\n \"aria-selected\": \"ds:aria-selected:bg-brand-bg ds:aria-selected:text-brand\",\n none: \"\",\n};\n\n/** The disabled row: disabled ink, no pointer. Same for every palette. */\nexport const LIST_ITEM_DISABLED =\n \"ds:data-[disabled]:text-fg-disabled ds:data-[disabled]:pointer-events-none\";\n\n/** Glyph sizing for an icon rendered inside the row. */\nexport const LIST_ITEM_GLYPH = \"ds:[&_svg]:size-4 ds:[&_svg]:shrink-0\";\n\n/** The 1rem well that holds the check/radio indicator, at the row's end or start. */\nexport const LIST_ITEM_INDICATOR_WELL: Readonly<Record<\"end\" | \"start\", string>> = {\n end: \"ds:absolute ds:right-2 ds:flex ds:size-4 ds:items-center ds:justify-center\",\n start: \"ds:absolute ds:left-2 ds:flex ds:size-4 ds:items-center ds:justify-center\",\n};\n\n/** The ink of a group heading above a run of rows. */\nexport const LIST_GROUP_HEADING_INK: Readonly<Record<ListItemPalette, string>> = {\n neutral: \"ds:text-fg-3\",\n menu: \"ds:text-menu-label-fg\",\n};\n\n/** The box and type treatment of a group heading, around the component's label size. */\nexport const LIST_GROUP_HEADING_BOX = \"ds:px-2 ds:py-1.5 ds:font-mono\";\nexport const LIST_GROUP_HEADING_TYPE = \"ds:tracking-wider ds:uppercase\";\n\n/**\n * The class string of a group heading: ink, box, the component's label size,\n * type treatment, in that order.\n */\nexport function groupHeadingClasses({\n palette,\n labelSize,\n}: {\n palette: ListItemPalette;\n labelSize: string;\n}): string {\n return [\n LIST_GROUP_HEADING_INK[palette],\n LIST_GROUP_HEADING_BOX,\n labelSize,\n LIST_GROUP_HEADING_TYPE,\n ].join(\" \");\n}\n\n/** A hairline between runs of rows. */\nexport const LIST_SEPARATOR: Readonly<Record<ListItemPalette, string>> = {\n neutral: \"ds:bg-rule ds:-mx-1 ds:my-1 ds:h-px\",\n menu: \"ds:bg-menu-border ds:-mx-1 ds:my-1 ds:h-px\",\n};\n\nexport interface ListItemRecipe {\n frame: ListItemFrame;\n /** The label size class the component owns (`ds:text-[13px]` today, a control-scale token next). */\n labelSize: string;\n palette: ListItemPalette;\n highlight: ListItemHighlight;\n selected: ListItemSelected;\n /** Whether the row sizes an icon inside it; menus with an indicator well leave this off. */\n glyph?: boolean;\n}\n\n/**\n * The class string of one row: box, label size, interaction, ink, motion,\n * highlighted, selected, disabled, glyph, in that order, with no empty rows.\n * Pass the result to `cn()` ahead of the consumer's `className`.\n */\nexport function listItemClasses({\n frame,\n labelSize,\n palette,\n highlight,\n selected,\n glyph = true,\n}: ListItemRecipe): string {\n const highlighted = LIST_ITEM_HIGHLIGHTED[palette][highlight];\n if (highlighted === undefined) {\n throw new TypeError(\n `collection: no highlighted row for palette ${JSON.stringify(palette)} with ${JSON.stringify(highlight)}; write the literal in item-recipe.ts`,\n );\n }\n return [\n LIST_ITEM_BOX[frame],\n labelSize,\n LIST_ITEM_INTERACTION,\n LIST_ITEM_INK[palette],\n LIST_ITEM_MOTION,\n highlighted,\n LIST_ITEM_SELECTED[selected],\n LIST_ITEM_DISABLED,\n glyph ? LIST_ITEM_GLYPH : \"\",\n ]\n .filter(Boolean)\n .join(\" \");\n}\n","/**\n * L1a behaviour primitive (private). Not exported from the package.\n *\n * The W3-10 untyped-Button warning (C-BTN-TYPE) left in 2.0: `Button` now\n * defaults to `type=\"button\"` (W9-05), so nothing submits by accident. What\n * remains is the form handle the FormBridge duplicate warning (W4-04) keys on.\n */\n\n/**\n * A short handle for the form, for the FormBridge duplicate warning's dedupe\n * key and message (W4-04).\n */\nexport function describeForm(form: HTMLFormElement): string {\n const id = form.getAttribute(\"id\");\n if (id) return `form#${id}`;\n const name = form.getAttribute(\"name\");\n if (name) return `form[name=\"${name}\"]`;\n const label = form.getAttribute(\"aria-label\");\n if (label) return `form[aria-label=\"${label}\"]`;\n const action = form.getAttribute(\"action\");\n if (action) return `form[action=\"${action}\"]`;\n return \"form\";\n}\n","import { useEffect, useId, useRef, type CSSProperties, type RefObject } from \"react\";\n\nimport { devWarningsEnabled, warnOnce } from \"../../foundation/deprecate\";\n\nimport { describeForm } from \"./button-type\";\n\n/**\n * L1a behaviour primitive (private). Not exported from the package.\n *\n * `FormBridge` — native form participation for a control whose value does not\n * live in a native form element (W4-04, ADR-006; target architecture §25).\n * Select, Combobox, DatePicker and DateRangePicker render it next to their\n * visible control; Input, Textarea, Checkbox, Switch and FileUpload own a\n * native element and do not need it.\n *\n * What the bridge does, and nothing else:\n *\n * - **Serialises** the control's value into hidden `<input name>` elements, so\n * `new FormData(form)` and a Server Action see it. A single value is one\n * entry; an empty single value is `name=\"\"` (what a named Select, DatePicker\n * and DateRangePicker submit today — C-SELECT-EMPTY — and what consumer zod\n * schemas expect), unless `submitEmpty={false}` omits it. Several values are\n * one entry per value in order, like `<select multiple>`; an empty list\n * submits nothing. The wire format is the caller's (dates are ISO\n * `YYYY-MM-DD` per P-ISO-DATES).\n * - **Associates** with the form the control sits in, or with `form={id}` when\n * the control is portalled out of it (Dialog, Sheet).\n * - **Submits nothing while `disabled`**, like a disabled native control.\n * - **Takes part in constraint validation** for `required`: hidden inputs\n * never do, so an unnamed, visually hidden proxy `<input required>` blocks\n * the submission while the value is empty. When the browser reports the\n * proxy invalid it also focuses it (after the `invalid` event), so any\n * focus the proxy receives is forwarded to `focusTarget` (the visible\n * control): focus never rests on the invisible element. The caller mirrors\n * `aria-required` on that control.\n * - **Follows reset**: `form.reset()`, `<button type=\"reset\">` and React 19's\n * automatic reset after a `<form action>` all dispatch `reset` on the form;\n * the bridge calls `onReset`, and the caller restores its `defaultValue`\n * through its controllable state. Nothing is restored here: the hidden\n * inputs render from the caller's state and re-render with it.\n * - **Warns about duplicates in development** (C-HIDDEN-MIRRORS): when another\n * control in the same form submits under the same `name` — a hand-written\n * hidden mirror, most often — `FormData` holds the value twice and\n * `formData.get()` returns whichever comes first in DOM order. The bridge\n * warns once per form and name, names the field and says to remove the\n * mirror or the `name`. It never changes what is submitted: no removal, no\n * de-duplication, nothing at all in production.\n *\n * Participation is opt-in through `name`: without it the bridge renders\n * nothing and listens to nothing, so an existing call site does not change\n * behaviour. The server HTML carries the hidden inputs with the default\n * value, so a form submitted before hydration still sends it.\n */\n\n/** A control's value as the bridge serialises it: one entry, several, or none. */\nexport type FormBridgeValue = string | null | undefined | readonly string[];\n\n/** The compatibility-registry id the duplicate warning is filed under. */\nexport const FORM_BRIDGE_DUPLICATE_ID = \"C-HIDDEN-MIRRORS\";\n\nexport interface FormBridgeProps {\n /** The form field name. Without it the bridge renders nothing. */\n name?: string | undefined;\n /** The control's current value. */\n value: FormBridgeValue;\n /**\n * Submit an empty single value as `name=\"\"` (`true`, the default and what a\n * native `<select>` with an empty option does) or omit the entry (`false`).\n * Ignored for lists: an empty list never submits.\n */\n submitEmpty?: boolean | undefined;\n /** `id` of the form to submit with when the control is rendered outside it. */\n form?: string | undefined;\n /** A disabled control submits nothing and is not validated. */\n disabled?: boolean | undefined;\n /** Block native submission while the value is empty. */\n required?: boolean | undefined;\n /** The visible control that receives focus when `required` is reported invalid. */\n focusTarget?: RefObject<HTMLElement | null> | undefined;\n /** Called when the associated form is reset. Restore `defaultValue` here. */\n onReset?: (() => void) | undefined;\n}\n\n/**\n * The entries the bridge submits for `value`: `[]` means no entry at all.\n * Pure, so the serialisation rules of ADR-006 §3 can be unit-tested.\n */\nexport function serializeFormValue(\n value: FormBridgeValue,\n { submitEmpty = true }: { submitEmpty?: boolean } = {},\n): string[] {\n if (Array.isArray(value)) return [...(value as readonly string[])];\n if (value == null || value === \"\") return submitEmpty ? [\"\"] : [];\n return [value as string];\n}\n\n// Inline, not a class: the proxy must stay invisible under any consumer\n// stylesheet, and the bridge has no visual vocabulary of its own.\nconst PROXY_STYLE: CSSProperties = {\n position: \"absolute\",\n width: 1,\n height: 1,\n padding: 0,\n margin: -1,\n overflow: \"hidden\",\n clip: \"rect(0, 0, 0, 0)\",\n whiteSpace: \"nowrap\",\n border: 0,\n opacity: 0,\n pointerEvents: \"none\",\n};\n\nconst noop = () => {};\n\n/** Focus is forwarded synchronously; the proxy is never the resting focus. */\nconst forwardFocus = (target: RefObject<HTMLElement | null> | undefined) => {\n const element = target?.current;\n if (element && element.ownerDocument.activeElement !== element) element.focus();\n};\n\nexport function FormBridge({\n name,\n value,\n submitEmpty = true,\n form,\n disabled = false,\n required = false,\n focusTarget,\n onReset,\n}: FormBridgeProps) {\n // Ties this instance's inputs together for the duplicate check (two bridges\n // with the same name in one form are a duplicate too). Stable across SSR.\n const instance = useId();\n const anchorRef = useRef<HTMLInputElement>(null);\n const values = name ? serializeFormValue(value, { submitEmpty }) : [];\n const filled = values.some((entry) => entry !== \"\");\n\n useFormReset(anchorRef, onReset, name, form);\n useDuplicateNameWarning(anchorRef, instance, name, form, disabled ? 0 : values.length);\n\n if (!name) return null;\n\n return (\n <>\n {values.map((entry, index) => (\n <input\n // Position is the identity: a list may repeat a value.\n key={index}\n ref={index === 0 ? anchorRef : undefined}\n type=\"hidden\"\n name={name}\n value={entry}\n form={form}\n disabled={disabled}\n data-form-bridge={instance}\n />\n ))}\n {values.length === 0 && (\n // Resolves the form for the reset listener and the duplicate check;\n // disabled and unnamed, so it is never submitted.\n <input ref={anchorRef} type=\"hidden\" form={form} disabled data-form-bridge={instance} />\n )}\n {required && !disabled && (\n <input\n type=\"text\"\n aria-hidden=\"true\"\n tabIndex={-1}\n required\n form={form}\n value={filled ? \"filled\" : \"\"}\n onChange={noop}\n onInvalid={() => forwardFocus(focusTarget)}\n onFocus={() => forwardFocus(focusTarget)}\n style={PROXY_STYLE}\n data-form-bridge-validation={instance}\n />\n )}\n </>\n );\n}\n\n/**\n * Call `onReset` when the form the anchor input belongs to (through the DOM or\n * the `form` attribute) dispatches `reset`. The event fires before the browser\n * restores native defaults; the caller's state is the source of truth for the\n * hidden inputs, so restoring that state is all the reset needs.\n *\n * Also used directly by a control that owns a native input but renders it\n * controlled (OTPInput, W4-23): the browser's reset restores the input's\n * `value` attribute, which React keeps equal to the current value, so the\n * component has to restore its own state.\n */\nexport function useFormReset(\n anchorRef: RefObject<HTMLInputElement | null>,\n onReset: (() => void) | undefined,\n name: string | undefined,\n form: string | undefined,\n) {\n const latest = useRef(onReset);\n latest.current = onReset;\n useEffect(() => {\n const owner = anchorRef.current?.form;\n if (!owner || !name) return;\n const handle = () => latest.current?.();\n owner.addEventListener(\"reset\", handle);\n return () => owner.removeEventListener(\"reset\", handle);\n }, [anchorRef, name, form]);\n}\n\n/**\n * Development only: warn once per form and name when another control in the\n * same form submits under this bridge's name. Runs on mount and when the\n * name, the form or the number of own entries changes.\n */\nfunction useDuplicateNameWarning(\n anchorRef: RefObject<HTMLInputElement | null>,\n instance: string,\n name: string | undefined,\n form: string | undefined,\n ownCount: number,\n) {\n useEffect(() => {\n if (!name || ownCount === 0 || !devWarningsEnabled()) return;\n const owner = anchorRef.current?.form;\n if (!owner) return;\n const others = Array.from(owner.elements).filter((element) => {\n const control = element as HTMLInputElement;\n return (\n control.name === name &&\n control.getAttribute(\"data-form-bridge\") !== instance &&\n !control.matches(\":disabled\")\n );\n });\n if (others.length === 0) return;\n const where = describeForm(owner);\n warnOnce(\n FORM_BRIDGE_DUPLICATE_ID,\n `${where}::${name}`,\n `field \"${name}\" in ${where} is also submitted by ${others.length} other control${others.length === 1 ? \"\" : \"s\"} with the same name (a hidden <input> mirror, most likely), so FormData carries it twice and formData.get(\"${name}\") returns whichever comes first in DOM order. Remove the mirror, or drop \\`name\\` from the design-system control.`,\n );\n }, [anchorRef, instance, name, form, ownCount]);\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as SelectPrimitive from \"@radix-ui/react-select\";\n\nimport { selectAnatomy, type SelectSlot } from \"../foundation/anatomy/slots\";\nimport { slot, stateAttributes } from \"../foundation/anatomy/slot\";\nimport { deprecate } from \"../foundation/deprecate\";\nimport { useControllableState } from \"../foundation/use-controllable-state\";\nimport type { SelectMessages } from \"../foundation/messages/types\";\nimport { useDsMessages } from \"../foundation/provider/context\";\nimport type { ControlSize } from \"../foundation/vocab\";\nimport { cn } from \"../lib/cn\";\n\nimport { itemSlot } from \"./behavior/collection/item-attributes\";\nimport {\n LIST_ITEM_INDICATOR_WELL,\n LIST_SEPARATOR,\n groupHeadingClasses,\n listItemClasses,\n} from \"./behavior/collection/item-recipe\";\nimport { CONTROL_SIZE_CLASSES } from \"./behavior/control-size\";\nimport { FormBridge } from \"./behavior/form-bridge\";\nimport { withPortalContainer } from \"./behavior/portal\";\nimport { presence } from \"./behavior/presence\";\nimport { useFieldContext } from \"./field/internal/field-context\";\nimport { useFieldControl } from \"./field/use-field-control\";\nimport { IconButton } from \"./icon-button\";\nimport { CheckIcon, ChevronDownIcon, ChevronUpIcon, XIcon } from \"./icons\";\n/* ───────────────────────────────────────────────────────────────────────\n * Select — Radix UI select primitive. Modified\n *\n * Public API preserved (the convenience wrapper):\n * <Select options={...} value placeholder onValueChange />\n * - the original `Select` accepted `options: SelectOption[]`. Consumers\n * across firm + portal use that shape and we keep it.\n *\n * NEW (additive, shadcn parity) — composable lower-level slots so callers\n * can build their own trees:\n * SelectTrigger, SelectValue, SelectContent, SelectItem, SelectLabel,\n * SelectSeparator, SelectGroup, SelectScrollUpButton, SelectScrollDownButton\n *\n * Note: The legacy `Select` rendered Radix-incompatible custom slots (it\n * accepted `children` as raw JSX wrapping `<SelectTrigger />` /\n * `<SelectContent />` with no props). The new `Select` keeps the\n * options-driven path; for full composition use `SelectRoot` + the\n * lower-level slots directly.\n *\n * Filtering: Radix Select cannot filter, and the no-op `searchable` prop was\n * removed in 2.0 (C-SELECT-DEAD). Use `Combobox` for filterable selection.\n *\n * List parts (W4-09): `SelectItem`, `SelectLabel` and `SelectSeparator` read\n * their class rows from the shared collection recipe\n * (`behavior/collection/item-recipe.ts`) — the same rows the Combobox\n * listbox (W4-10) and the menus (W5-13) render — with the class strings\n * pinned byte for byte in `__tests__/select-list-classes.test.tsx`.\n *\n * Form control (W4-08; target architecture §24, §25, §32; ADR-006):\n *\n * - **Field binding** through `useFieldControl`: inside a `<Field>` the\n * trigger is named by the field's `Label` (`aria-labelledby`), described by\n * `FieldDescription` then `FieldError` (`aria-describedby`), and carries the\n * field's `aria-invalid` / `aria-required` / `disabled`; a label click\n * opens the list. Explicit props win. Outside a field the trigger keeps its\n * `aria-label` (the placeholder by default).\n * - **Native form participation** through `FormBridge`: with `name` the\n * value is one hidden `<input name>` — `\"\"` when nothing is selected\n * (C-SELECT-EMPTY, what a named Select submitted before) — that follows\n * `form.reset()`, a reset button and React 19's automatic reset after a\n * `<form action>` (the wrapper restores `defaultValue`), submits nothing\n * while `disabled`, and blocks submission while `required` and empty\n * (focus lands on the trigger). Radix gets neither `name` nor `required`:\n * its unnamed native `<select>` stays only so browser autofill reaches the\n * value. `form` ties a trigger portalled out of its form (Dialog, Sheet)\n * to it.\n * - **Value** is `string | null`; `null`, `\"\"` and `undefined` all mean\n * \"nothing selected\" (`\"\"` stays accepted through 2.x — C-SELECT-EMPTY).\n * `onValueChange` keeps its `(value: string) => void` signature: a clear\n * reports `\"\"`, so every existing handler type-checks; the `null` callback\n * is a 3.0 item.\n * - **`size`** is the shared control scale (A1, ADR-013). Without it the\n * trigger keeps its legacy geometry row byte for byte\n * (`__tests__/select-legacy-classes.test.tsx`); `md` is the same pixels\n * from the tokens. A `<Field size>` supplies it.\n * - **`clearable`** renders a clear IconButton beside the chevron while a\n * value is selected; the wrapper it needs (the `root` part,\n * `data-slot=\"select\"`) exists only then, so the legacy DOM is untouched\n * (C-DOM-10).\n * - **`classNames`** reaches every part the wrapper renders;\n * `triggerClassName` / `contentClassName` are deprecated aliases\n * (C-CLASSNAME-PROPS).\n * ─────────────────────────────────────────────────────────────────────── */\n\n/** The select parts (ADR-008). See the registry for the doc comment. */\nexport type { SelectSlot };\n\nconst SelectRoot = SelectPrimitive.Root;\nconst SelectGroup = SelectPrimitive.Group;\nconst SelectValue = SelectPrimitive.Value;\n\n/**\n * The Select sizes: the shared control scale, nothing else (A1, ADR-013).\n *\n * @experimental\n */\nexport type SelectSize = ControlSize;\n\n/**\n * The parts a `classNames` entry can reach on the options-driven `Select`,\n * keyed by the anatomy (ADR-008 decision 4). `value` is a span of ours\n * around Radix's value (Radix's own span drops `className`), rendered only\n * when `classNames.value` or `clearable` asks for it, so a legacy call keeps\n * the `SelectTrigger > span` structure C-DOM-10 freezes.\n *\n * @experimental\n */\nexport type SelectClassNames = Partial<Record<SelectSlot, string>>;\n\n/**\n * The copy the options-driven `Select` renders (target architecture §24.5):\n * prop > `DesignSystemProvider messages.select` > English (W5-20, ADR-010).\n *\n * @experimental\n */\nexport type { SelectMessages };\n\n/**\n * True while the Radix trigger reports `data-state=\"open\"`.\n *\n * While the list is open Radix hides everything outside it with\n * `aria-hidden` (the trigger included) and keeps focus in the list. A trigger\n * that stays in the tab order inside that hidden tree fails axe\n * `aria-hidden-focus` (escalation E2), so the trigger leaves the tab order\n * while open. Radix still returns focus to it on close (`focus()` works with\n * `tabIndex={-1}`). Read from the DOM because the open state lives in Radix's\n * private context and `SelectRoot` may be controlled or uncontrolled.\n */\nfunction useTriggerOpen(node: HTMLButtonElement | null): boolean {\n const [open, setOpen] = React.useState(false);\n React.useEffect(() => {\n if (!node) return;\n const sync = () => setOpen(node.getAttribute(\"data-state\") === \"open\");\n sync();\n const observer = new MutationObserver(sync);\n observer.observe(node, { attributes: true, attributeFilter: [\"data-state\"] });\n return () => observer.disconnect();\n }, [node]);\n return open;\n}\n\n/**\n * Props of `SelectTrigger`: Radix's trigger props plus the control-scale\n * `size` and a class for the chevron.\n *\n * @experimental `size` and `classNames`\n */\nexport interface SelectTriggerProps extends React.ComponentPropsWithoutRef<\n typeof SelectPrimitive.Trigger\n> {\n /**\n * Height, horizontal padding, label size, gap and glyph size from the shared\n * control scale (A1). Omitted, the trigger keeps its legacy geometry (36px,\n * the same pixels as `md`).\n */\n size?: SelectSize | null | undefined;\n /**\n * Classes for the trigger's parts: the chevron `icon`, and `value` — a span\n * of ours around `children`, rendered only when `value` is passed (so the\n * default keeps the `SelectTrigger > span` structure C-DOM-10 freezes).\n * Replaces `[&>span]` overrides on the trigger.\n */\n classNames?: Pick<SelectClassNames, \"icon\" | \"value\"> | undefined;\n}\n\nconst SelectTrigger = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Trigger>,\n SelectTriggerProps\n>(({ className, children, tabIndex, size, classNames, ...props }, ref) => {\n const [node, setNode] = React.useState<HTMLButtonElement | null>(null);\n const open = useTriggerOpen(node);\n const composedRef = React.useCallback(\n (element: HTMLButtonElement | null) => {\n setNode(element);\n if (typeof ref === \"function\") ref(element);\n else if (ref) ref.current = element;\n },\n [ref],\n );\n return (\n <SelectPrimitive.Trigger\n ref={composedRef}\n tabIndex={open ? -1 : tabIndex}\n {...slot(selectAnatomy, \"trigger\")}\n {...stateAttributes({ size: size ?? undefined })}\n className={cn(\n // The legacy geometry row (`h-9 gap-2 px-3 py-2 text-[13px]`) is the\n // scale's `md` in pixels; it stays inline, byte for byte, until D5\n // settles the size numbers. A `size` swaps it for the token row.\n size == null\n ? \"ds:rounded-input ds:border-field-border ds:bg-surface ds:font-body ds:text-fg ds:flex ds:h-9 ds:w-full ds:items-center ds:justify-between ds:gap-2 ds:border ds:px-3 ds:py-2 ds:text-[13px]\"\n : cn(\n \"ds:rounded-input ds:border-field-border ds:bg-surface ds:font-body ds:text-fg ds:flex ds:w-full ds:items-center ds:justify-between ds:border ds:py-2\",\n CONTROL_SIZE_CLASSES[size],\n ),\n \"ds:cursor-pointer\",\n \"ds:transition-[color,background-color,border-color,box-shadow] ds:duration-[var(--duration-fast)] ds:ease-[var(--ease-out-quart)]\",\n \"ds:motion-reduce:transition-none\",\n \"ds:placeholder:text-fg-4\",\n \"ds:not-disabled:hover:border-field-border-hover\",\n \"ds:focus-visible:[border-color:var(--focus-ring-border)] ds:focus-visible:[box-shadow:var(--shadow-focus-ring-field)] ds:focus-visible:outline-none\",\n \"ds:disabled:bg-bg-disabled ds:disabled:text-fg-disabled ds:disabled:cursor-not-allowed\",\n \"ds:data-[placeholder]:text-fg-4\",\n \"ds:aria-[invalid=true]:border-field-border-invalid ds:aria-[invalid=true]:focus-visible:border-danger-fg\",\n \"ds:aria-[invalid=true]:focus-visible:[box-shadow:0_0_0_2px_var(--color-danger-bg)]\",\n \"ds:[&>span]:line-clamp-1 ds:[&>span]:text-left\",\n className,\n )}\n {...props}\n >\n {classNames?.value !== undefined ? (\n <span {...slot(selectAnatomy, \"value\")} className={classNames.value}>\n {children}\n </span>\n ) : (\n children\n )}\n <SelectPrimitive.Icon asChild>\n <ChevronDownIcon\n {...slot(selectAnatomy, \"icon\")}\n className={cn(\n \"ds:text-fg-3 ds:size-(--control-icon-md) ds:shrink-0 ds:translate-y-px ds:transition-transform ds:duration-[var(--duration-fast)] ds:ease-[var(--ease-out-quart)] ds:data-[state=open]:rotate-180 ds:motion-reduce:transition-none\",\n classNames?.icon,\n )}\n aria-hidden=\"true\"\n />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n );\n});\nSelectTrigger.displayName = SelectPrimitive.Trigger.displayName;\n\nconst SelectScrollUpButton = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollUpButton\n ref={ref}\n {...slot(selectAnatomy, \"scroll-up-button\")}\n className={cn(\n \"ds:text-fg-3 ds:flex ds:cursor-default ds:items-center ds:justify-center ds:py-1\",\n className,\n )}\n {...props}\n >\n <ChevronUpIcon className=\"ds:size-(--control-icon-md)\" aria-hidden=\"true\" />\n </SelectPrimitive.ScrollUpButton>\n));\nSelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;\n\nconst SelectScrollDownButton = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollDownButton\n ref={ref}\n {...slot(selectAnatomy, \"scroll-down-button\")}\n className={cn(\n \"ds:text-fg-3 ds:flex ds:cursor-default ds:items-center ds:justify-center ds:py-1\",\n className,\n )}\n {...props}\n >\n <ChevronDownIcon className=\"ds:size-(--control-icon-md)\" aria-hidden=\"true\" />\n </SelectPrimitive.ScrollDownButton>\n));\nSelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;\n\n/**\n * Props of `SelectContent`: Radix's content props plus a class for the\n * viewport (C-DOM-19's `[data-radix-select-viewport]` selector replacement).\n *\n * @experimental `classNames`\n */\nexport interface SelectContentProps extends React.ComponentPropsWithoutRef<\n typeof SelectPrimitive.Content\n> {\n /** Classes for the parts the content renders itself: the scrolling `viewport`. */\n classNames?: Pick<SelectClassNames, \"viewport\"> | undefined;\n}\n\nconst SelectPortal = withPortalContainer(SelectPrimitive.Portal);\n\nconst SelectContent = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Content>,\n SelectContentProps\n>(({ className, children, position = \"popper\", classNames, ...props }, ref) => (\n <SelectPortal>\n <SelectPrimitive.Content\n ref={ref}\n position={position}\n {...slot(selectAnatomy, \"content\")}\n {...presence(\"floating\")}\n className={cn(\n \"ds:rounded-card ds:border-rule ds:bg-surface ds:text-fg ds:shadow-pop ds:relative ds:z-[var(--z-dropdown)] ds:max-h-(--radix-select-content-available-height) ds:min-w-[8rem] ds:overflow-hidden ds:border\",\n position === \"popper\" &&\n \"ds:data-[side=bottom]:translate-y-1 ds:data-[side=left]:-translate-x-1 ds:data-[side=right]:translate-x-1 ds:data-[side=top]:-translate-y-1\",\n className,\n )}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.Viewport\n {...slot(selectAnatomy, \"viewport\")}\n className={cn(\n \"ds:p-1\",\n position === \"popper\" &&\n \"ds:h-(--radix-select-trigger-height) ds:w-full ds:min-w-(--radix-select-trigger-width)\",\n classNames?.viewport,\n )}\n >\n {children}\n </SelectPrimitive.Viewport>\n <SelectScrollDownButton />\n </SelectPrimitive.Content>\n </SelectPortal>\n));\nSelectContent.displayName = SelectPrimitive.Content.displayName;\n\nconst SelectLabel = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Label\n ref={ref}\n {...slot(selectAnatomy, \"label\")}\n className={cn(\n groupHeadingClasses({ palette: \"neutral\", labelSize: \"ds:text-(length:--text-caption)\" }),\n className,\n )}\n {...props}\n />\n));\nSelectLabel.displayName = SelectPrimitive.Label.displayName;\n\nconst SelectItem = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>\n>(({ className, children, ...props }, ref) => (\n <SelectPrimitive.Item\n ref={ref}\n {...itemSlot(selectAnatomy)}\n className={cn(\n // Radix focuses the highlighted row and stamps `data-state=\"checked\"`\n // on the selected one, so those are the selectors the rows read. The\n // label size is the scale's `md` (13px, the row's size since 1.0):\n // W4-08 took it from the control tokens with zero diff\n // (`tests/browser/select-form.test.tsx`).\n listItemClasses({\n frame: \"select\",\n labelSize: \"ds:text-(length:--control-font-size-md)\",\n palette: \"neutral\",\n highlight: \"focus\",\n selected: \"radix-checked\",\n }),\n className,\n )}\n {...props}\n >\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n <span className={LIST_ITEM_INDICATOR_WELL.end}>\n <SelectPrimitive.ItemIndicator {...slot(selectAnatomy, \"item-indicator\")}>\n <CheckIcon className=\"ds:size-3.5\" aria-hidden=\"true\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n </SelectPrimitive.Item>\n));\nSelectItem.displayName = SelectPrimitive.Item.displayName;\n\nconst SelectSeparator = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Separator\n ref={ref}\n {...slot(selectAnatomy, \"separator\")}\n className={cn(LIST_SEPARATOR.neutral, className)}\n {...props}\n />\n));\nSelectSeparator.displayName = SelectPrimitive.Separator.displayName;\n\n/* ─── Convenience wrapper ───────────────────────────────────────────── */\n\n/**\n * SelectOption shape — preserved verbatim from the legacy Select:\n * { value, label, disabled?, labelSuffix? }\n */\nexport interface SelectOption {\n value: string;\n label: string;\n disabled?: boolean | undefined;\n labelSuffix?: React.ReactNode;\n}\n\nexport interface SelectProps {\n /** Option list. Required to preserve legacy API. */\n options: SelectOption[];\n /**\n * Controlled value. `null` is \"nothing selected\" (target architecture §32);\n * `\"\"` means the same and stays accepted through 2.x (C-SELECT-EMPTY).\n */\n value?: string | null | undefined;\n /** Uncontrolled initial value; restored on form reset. `null` = nothing selected. */\n defaultValue?: string | null | undefined;\n /**\n * Called with the picked option's value, and with `\"\"` when the selection\n * is cleared (`clearable`) — the signature every existing handler already\n * has. Reporting `null` is a 3.0 change (C-SELECT-EMPTY).\n */\n onValueChange?: ((value: string) => void) | undefined;\n placeholder?: string | undefined;\n disabled?: boolean | undefined;\n /**\n * Submit the value under this name through the form the trigger sits in\n * (or `form`). Inside a `<Field name>` the field's name applies.\n */\n name?: string | undefined;\n /**\n * Block native submission while nothing is selected; the trigger carries\n * `aria-required`. Inside a `<Field required>` the field's flag applies.\n */\n required?: boolean | undefined;\n /**\n * The `id` of the form to submit with when the trigger is rendered outside\n * it — inside a portalled Dialog or Sheet (ADR-006).\n *\n * @experimental\n */\n form?: string | undefined;\n /**\n * The trigger's `id`; inside a `<Field>` the field's control id applies.\n *\n * @experimental\n */\n id?: string | undefined;\n /**\n * The control scale (A1, ADR-013): `xs` 28 · `sm` 32 · `md` 36 · `lg` 40 ·\n * `xl` 48. Omitted, the trigger keeps its legacy 36px row; a `<Field size>`\n * supplies it.\n *\n * @experimental\n */\n size?: SelectSize | undefined;\n /**\n * Show a clear button beside the chevron while a value is selected. Clearing\n * reports `\"\"` through `onValueChange` and focuses the trigger. Renders the\n * `root` part (`data-slot=\"select\"`) around the trigger — `className` lands\n * on that wrapper then, `classNames.trigger` on the trigger.\n *\n * @experimental\n */\n clearable?: boolean | undefined;\n /**\n * The outermost element's class: the trigger, or the `root` wrapper when\n * `clearable`.\n */\n className?: string | undefined;\n /**\n * One class per part (ADR-008 decision 4): `trigger`, `value`, `icon`\n * (chevron), `content`, `viewport`, `item`, `clear`, `root`. Each part's\n * class comes after the design system's own and before `className`.\n * `value` wraps Radix's value span in one of ours (see `SelectClassNames`).\n *\n * @experimental\n */\n classNames?: SelectClassNames | undefined;\n /** Overrides of the copy the select renders (English defaults until W5-20). */\n messages?: Partial<SelectMessages> | undefined;\n /**\n * @deprecated Use `classNames.trigger` (C-CLASSNAME-PROPS, codemod CM-11).\n * Removed in 3.0.\n */\n triggerClassName?: string | undefined;\n /**\n * @deprecated Use `classNames.content` (C-CLASSNAME-PROPS, codemod CM-11).\n * Removed in 3.0.\n */\n contentClassName?: string | undefined;\n /** aria-invalid + danger styling on trigger. Inside a `<Field invalid>` the field's flag applies. */\n \"aria-invalid\"?: boolean | undefined;\n /**\n * aria-label fallback when there is no visible label. Inside a `<Field>`\n * with a `Label` the trigger is named by the label instead.\n */\n \"aria-label\"?: string | undefined;\n /** Explicit `aria-labelledby`; wins over the surrounding `Field`. */\n \"aria-labelledby\"?: string | undefined;\n /** Explicit `aria-describedby`; appended after the field's description and error. */\n \"aria-describedby\"?: string | undefined;\n}\n\nconst CONTROL_SIZES: ReadonlySet<string> = new Set([\"xs\", \"sm\", \"md\", \"lg\", \"xl\"]);\n\n/** The field's `size`, when it is a control size (the field types it loosely). */\nfunction fieldControlSize(size: string | undefined): SelectSize | undefined {\n return size !== undefined && CONTROL_SIZES.has(size) ? (size as SelectSize) : undefined;\n}\n\n/**\n * Convenience `Select` — preserved options-driven API.\n *\n * For full composition, import the lower-level slots:\n * <SelectRoot>\n * <SelectTrigger><SelectValue /></SelectTrigger>\n * <SelectContent>\n * <SelectGroup>\n * <SelectLabel>Label</SelectLabel>\n * <SelectItem value=\"…\">…</SelectItem>\n * </SelectGroup>\n * </SelectContent>\n * </SelectRoot>\n */\nfunction Select({\n options,\n value: valueProp,\n defaultValue: defaultValueProp,\n onValueChange,\n placeholder: placeholderProp,\n disabled: disabledProp,\n name: nameProp,\n required: requiredProp,\n form,\n id: idProp,\n size: sizeProp,\n clearable = false,\n className,\n classNames,\n messages,\n triggerClassName,\n contentClassName,\n \"aria-invalid\": ariaInvalid,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n}: SelectProps) {\n const resolvedMessages = useDsMessages(\"select\", messages);\n const placeholder = placeholderProp ?? resolvedMessages.placeholder;\n if (triggerClassName !== undefined) {\n deprecate(\n \"C-CLASSNAME-PROPS\",\n \"Select.triggerClassName\",\n \"<Select triggerClassName> is a deprecated alias. Pass classNames={{ trigger }}; codemod CM-11 rewrites it. Removed in 3.0.\",\n );\n }\n if (contentClassName !== undefined) {\n deprecate(\n \"C-CLASSNAME-PROPS\",\n \"Select.contentClassName\",\n \"<Select contentClassName> is a deprecated alias. Pass classNames={{ content }}; codemod CM-11 rewrites it. Removed in 3.0.\",\n );\n }\n\n // `null`, `\"\"` and `undefined` are all \"nothing selected\"; Radix reads `\"\"`.\n const defaultValue = defaultValueProp ?? \"\";\n const [value, setValue] = useControllableState<string>({\n prop: valueProp === null ? \"\" : valueProp,\n defaultProp: defaultValue,\n onChange: onValueChange,\n });\n\n const field = useFieldContext();\n const wiring = useFieldControl({\n id: idProp,\n name: nameProp,\n invalid: ariaInvalid,\n required: requiredProp,\n disabled: disabledProp,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n native: false,\n });\n const disabled = wiring.disabled ?? false;\n const required = wiring[\"aria-required\"] === true;\n const size = sizeProp ?? fieldControlSize(field?.size);\n\n const triggerRef = React.useRef<HTMLButtonElement | null>(null);\n const fieldRef = wiring.ref;\n const composedTriggerRef = React.useCallback(\n (node: HTMLButtonElement | null) => {\n triggerRef.current = node;\n fieldRef(node);\n },\n [fieldRef],\n );\n\n const clear = () => {\n setValue(\"\");\n // The clear button unmounts with the value; focus moves to the trigger\n // rather than falling to the document.\n triggerRef.current?.focus();\n };\n\n const showClear = clearable && value !== \"\" && !disabled;\n // Radix's value span drops `className`; ours wraps it only when asked, so\n // a legacy call keeps the `SelectTrigger > span` structure (C-DOM-10).\n const wrapValue = clearable || classNames?.value !== undefined;\n\n const trigger = (\n <SelectTrigger\n ref={composedTriggerRef}\n id={wiring.id}\n size={size}\n aria-invalid={wiring[\"aria-invalid\"]}\n aria-required={wiring[\"aria-required\"]}\n aria-labelledby={wiring[\"aria-labelledby\"]}\n aria-describedby={wiring[\"aria-describedby\"]}\n // Named by the field's label when there is one; the placeholder is the\n // fallback name a Select outside a field has always had.\n aria-label={ariaLabel ?? (wiring[\"aria-labelledby\"] ? undefined : placeholder)}\n data-invalid={wiring[\"data-invalid\"]}\n className={cn(triggerClassName, classNames?.trigger, clearable ? undefined : className)}\n classNames={classNames?.icon !== undefined ? { icon: classNames.icon } : undefined}\n >\n {wrapValue ? (\n <span\n {...slot(selectAnatomy, \"value\")}\n // Room for the 28px clear button (and a hair of air) between the\n // text and the chevron.\n className={cn(clearable && \"ds:mr-8\", classNames?.value)}\n >\n <SelectValue placeholder={placeholder} />\n </span>\n ) : (\n <SelectValue placeholder={placeholder} />\n )}\n </SelectTrigger>\n );\n\n return (\n <SelectRoot\n value={value}\n onValueChange={setValue}\n disabled={disabled}\n // Not `name` and not `required`: the bridge below submits and validates\n // (ADR-006 §2). `form` still reaches Radix so its unnamed native\n // `<select>` — kept for browser autofill — exists in a portalled form.\n {...(form !== undefined && { form })}\n >\n {clearable ? (\n <span\n {...slot(selectAnatomy, \"root\")}\n className={cn(\"ds:relative ds:flex ds:w-full\", classNames?.root, className)}\n >\n {trigger}\n {showClear && (\n <IconButton\n label={resolvedMessages.clear}\n icon={<XIcon />}\n variant=\"ghost\"\n intent=\"neutral\"\n size=\"xs\"\n tooltip={false}\n onClick={clear}\n {...slot(selectAnatomy, \"clear\")}\n className={cn(\n // Left of the chevron box (1px border + 12px padding + 16px glyph), 3px of air.\n \"ds:absolute ds:top-1/2 ds:right-8 ds:-translate-y-1/2 ds:text-fg-4 ds:hover:text-fg\",\n classNames?.clear,\n )}\n />\n )}\n </span>\n ) : (\n trigger\n )}\n <SelectContent\n className={cn(contentClassName, classNames?.content)}\n classNames={\n classNames?.viewport !== undefined ? { viewport: classNames.viewport } : undefined\n }\n >\n {options.map((opt) => (\n <SelectItem\n key={opt.value}\n value={opt.value}\n {...(opt.disabled !== undefined && { disabled: opt.disabled })}\n className={classNames?.item}\n >\n {/* flex+line-clamp can't share an element (`display: flex` vs.\n `display: -webkit-box`), so layout lives on the outer span\n and word-boundary clamp lives on the inner label span. */}\n <span className=\"ds:flex ds:min-w-0 ds:items-center ds:gap-1.5\">\n <span className=\"ds:line-clamp-1\">{opt.label}</span>\n {opt.labelSuffix}\n </span>\n </SelectItem>\n ))}\n </SelectContent>\n <FormBridge\n name={wiring.name}\n value={value}\n form={form}\n disabled={disabled}\n required={required}\n focusTarget={triggerRef}\n onReset={() => setValue(defaultValue)}\n />\n </SelectRoot>\n );\n}\nSelect.displayName = \"Select\";\n\nexport {\n Select,\n SelectRoot,\n SelectGroup,\n SelectValue,\n SelectTrigger,\n SelectContent,\n SelectLabel,\n SelectItem,\n SelectSeparator,\n SelectScrollUpButton,\n SelectScrollDownButton,\n};\n","import { useMemo, type Ref, type RefCallback } from \"react\";\n\n/**\n * L0 foundation (W2-11). Internal: not exported from the package.\n */\n\ntype Cleanup = () => void;\n\n/**\n * Assigns `value` to a callback or object ref. Returns the callback's cleanup\n * function when it returned one (React 19 ref cleanup).\n */\nexport function setRef<T>(ref: Ref<T> | undefined, value: T | null): Cleanup | undefined {\n if (typeof ref === \"function\") {\n const result = ref(value);\n return typeof result === \"function\" ? result : undefined;\n }\n if (ref !== null && ref !== undefined) {\n (ref as { current: T | null }).current = value;\n }\n return undefined;\n}\n\n/**\n * Combines refs into one callback ref.\n *\n * Supports React 19 ref cleanup: the returned callback returns a cleanup that\n * runs each ref's own cleanup, or resets a ref without one to `null`.\n */\nexport function mergeRefs<T>(...refs: ReadonlyArray<Ref<T> | undefined>): RefCallback<T> {\n return (value: T | null) => {\n const cleanups = refs.map((ref) => setRef(ref, value));\n return () => {\n refs.forEach((ref, index) => {\n const cleanup = cleanups[index];\n if (cleanup) cleanup();\n else setRef(ref, null);\n });\n };\n };\n}\n\n/** `mergeRefs` memoised on the refs, so the element is not detached and re-attached on every render. */\nexport function useMergedRefs<T>(...refs: ReadonlyArray<Ref<T> | undefined>): RefCallback<T> {\n // The refs themselves are the dependency list.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return useMemo(() => mergeRefs(...refs), refs);\n}\n","/**\n * L1a behaviour primitive (private). Not exported from the package.\n *\n * Checkbox, RadioGroup and Switch each hand-wrote the identical inline-label\n * class string, with the same arbitrary `text-[13px]` typed three times.\n * `CONTROL_LABEL_TEXT` is the one place that font-size now lives: the\n * size-only plumbing form of `--control-font-size-md` (13px at every\n * density — the token doesn't move under `[data-ds-density=compact]`, unlike\n * its `sm`/`lg`/`xl` neighbours), not the full `text-label` role utility,\n * because these labels don't set an explicit weight today and the role\n * carries `font-weight: 500` — swapping to it would silently bold the text.\n */\n\n/** The label font-size all three inline-control labels share. */\nexport const CONTROL_LABEL_TEXT = \"ds:text-(length:--control-font-size-md)\";\n","import { createContext, useCallback, useContext, useEffect, useMemo, useState } from \"react\";\n\nimport { partId, useId } from \"../../../foundation/id\";\n\n/**\n * L1b field internals (W4-13/W4-14). Not exported from the package.\n *\n * What a `Fieldset` tells the controls inside it: the id of its legend (once\n * mounted), so a grouped control that is not named by a `<label>` — a\n * `RadioGroup`, a `ToggleGroup` — can reference it through `aria-labelledby`;\n * and the group's `disabled` / `invalid`, so a Radix control inside a disabled\n * `<fieldset>` renders its `data-disabled` state instead of relying on the\n * browser's implicit disabling alone.\n */\n\nexport interface FieldsetContextValue {\n /** The legend's id. Referenced only while `legendMounted`. */\n legendId: string;\n legendMounted: boolean;\n /** Called by the legend on mount; the returned function unregisters it. */\n registerLegend: () => () => void;\n disabled: boolean;\n invalid: boolean;\n}\n\nexport const FieldsetContext = createContext<FieldsetContextValue | null>(null);\n\n/** The surrounding fieldset, or `null` for a control used on its own. */\nexport function useFieldsetContext(): FieldsetContextValue | null {\n return useContext(FieldsetContext);\n}\n\n/** The context value for one fieldset. Ids come from `useId`, so SSR and client agree. */\nexport function useFieldsetState({\n id,\n disabled = false,\n invalid = false,\n}: {\n id?: string | undefined;\n disabled?: boolean | undefined;\n invalid?: boolean | undefined;\n}): FieldsetContextValue {\n const base = useId(id, \"ds-fieldset\");\n const [legends, setLegends] = useState(0);\n const registerLegend = useCallback(() => {\n setLegends((count) => count + 1);\n let released = false;\n return () => {\n if (released) return;\n released = true;\n setLegends((count) => Math.max(0, count - 1));\n };\n }, []);\n return useMemo(\n () => ({\n legendId: partId(base, \"legend\"),\n legendMounted: legends > 0,\n registerLegend,\n disabled,\n invalid,\n }),\n [base, legends, registerLegend, disabled, invalid],\n );\n}\n\n/**\n * Registers the legend with the surrounding fieldset for as long as it is\n * mounted, and returns the id it must render. Outside a fieldset the legend\n * keeps its explicit id, if any.\n */\nexport function useFieldsetLegend(explicitId?: string): string | undefined {\n const fieldset = useFieldsetContext();\n const registerLegend = fieldset?.registerLegend;\n useEffect(() => {\n if (!registerLegend) return;\n return registerLegend();\n }, [registerLegend]);\n return explicitId ?? fieldset?.legendId;\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as CheckboxPrimitive from \"@radix-ui/react-checkbox\";\n\nimport { checkboxAnatomy, type CheckboxSlot } from \"../foundation/anatomy/slots\";\nimport { slot } from \"../foundation/anatomy/slot\";\nimport { deprecate } from \"../foundation/deprecate\";\nimport { useMergedRefs } from \"../foundation/merge-refs\";\nimport { cn } from \"../lib/cn\";\nimport { microInteractions } from \"../lib/micro-interactions\";\n\nimport { CONTROL_LABEL_TEXT } from \"./behavior/control-label\";\nimport { useFieldsetContext } from \"./field/internal/fieldset-context\";\nimport { useFieldControl } from \"./field/use-field-control\";\nimport { CheckIcon, MinusIcon } from \"./icons\";\n\n/**\n * Checkbox — a Radix checkbox with the design system's box (W4-13, plan\n * §16.1).\n *\n * **Form participation** is Radix's own (ADR-006 §1): the button is paired\n * with a hidden native `<input type=\"checkbox\">` that carries `name`, `value`\n * (default `\"on\"`), `required`, `disabled` and `form`, so `new FormData(form)`\n * holds `name=value` while checked and nothing while unchecked, `required`\n * blocks submission while unchecked, and a form `reset` restores the initial\n * state. No `FormBridge` is needed.\n *\n * **Field binding** through `useFieldControl`: inside a `Field` the button\n * takes the field's id (so the `Label` names it through `htmlFor` — a\n * `<button>` is a labelable element), `name`, `required`, `disabled`,\n * `invalid` and `aria-describedby` (description, then error). Explicit props\n * win. Inside a disabled `Fieldset` the checkbox renders its disabled state.\n *\n * **Tri-state**: `checked` is `true | false | \"indeterminate\"`. The legacy\n * boolean `indeterminate` prop still works (C-CHECKBOX-INDET) and is a\n * deprecated alias of `checked=\"indeterminate\"`.\n */\n\n/** The checkbox parts (ADR-008). See the registry for the doc comment. */\nexport type { CheckboxSlot };\n\n/** The states a checkbox renders: checked, unchecked, or partly checked. */\nexport type CheckboxChecked = boolean | \"indeterminate\";\n\nexport interface CheckboxProps extends Omit<\n React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>,\n \"checked\" | \"defaultChecked\"\n> {\n /** Optional inline label rendered to the right of the box. Names the button through `htmlFor`. */\n label?: string | undefined;\n /** Tri-state support: true | false | \"indeterminate\" */\n checked?: CheckboxChecked | undefined;\n defaultChecked?: CheckboxChecked | undefined;\n /**\n * Render the indeterminate state.\n *\n * @deprecated Pass `checked=\"indeterminate\"` instead (C-CHECKBOX-INDET;\n * codemod CM-11 rewrites it). Removed in 3.0.\n */\n indeterminate?: boolean | undefined;\n /** Box shape. Defaults to \"square\". */\n shape?: \"square\" | \"circle\";\n /**\n * The value submitted with `name` while checked. Default `\"on\"`, like a\n * native checkbox.\n */\n value?: string;\n /**\n * The checkbox is in error: `aria-invalid` and `data-invalid`. Implied by\n * the surrounding `Field`'s `invalid` or a mounted `FieldError`.\n */\n invalid?: boolean;\n}\n\nexport const Checkbox = React.forwardRef<\n React.ElementRef<typeof CheckboxPrimitive.Root>,\n CheckboxProps\n>(function Checkbox(\n {\n label,\n indeterminate,\n checked,\n defaultChecked,\n shape = \"square\",\n className,\n id,\n name,\n invalid,\n required,\n disabled,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": ariaInvalid,\n ...props\n },\n ref,\n) {\n if (indeterminate !== undefined) {\n deprecate(\n \"C-CHECKBOX-INDET\",\n \"indeterminate\",\n '<Checkbox indeterminate> is a deprecated alias of checked=\"indeterminate\"; codemod CM-11 rewrites it. Removed in 3.0.',\n );\n }\n\n const fieldset = useFieldsetContext();\n const wiring = useFieldControl({\n id,\n name,\n invalid,\n required,\n disabled: disabled ?? (fieldset?.disabled ? true : undefined),\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n });\n\n const rootRef = useMergedRefs(ref, wiring.ref);\n\n // Resolve tri-state from either explicit `checked` or legacy `indeterminate`.\n const resolvedChecked: CheckboxPrimitive.CheckboxProps[\"checked\"] = indeterminate\n ? \"indeterminate\"\n : checked;\n\n return (\n <div className=\"ds:inline-flex ds:items-center ds:gap-2 ds:align-middle\">\n <CheckboxPrimitive.Root\n ref={rootRef}\n id={wiring.id}\n name={wiring.name}\n {...(wiring.required !== undefined && { required: wiring.required })}\n disabled={wiring.disabled}\n {...(resolvedChecked !== undefined && { checked: resolvedChecked })}\n {...(defaultChecked !== undefined && { defaultChecked })}\n aria-labelledby={wiring[\"aria-labelledby\"]}\n aria-describedby={wiring[\"aria-describedby\"]}\n aria-invalid={ariaInvalid ?? wiring[\"aria-invalid\"]}\n data-invalid={wiring[\"data-invalid\"]}\n {...slot(checkboxAnatomy, \"root\")}\n className={cn(\n // Resting edge at ≥3:1 on the surface and the canvas (WCAG 1.4.11):\n // an unchecked box is identified by its border alone, and\n // `border-rule-strong` measured 1.34:1.\n \"ds:peer ds:border-fg-4/80 ds:bg-surface ds:text-brand ds:flex ds:size-4 ds:shrink-0 ds:cursor-pointer ds:items-center ds:justify-center ds:border\",\n shape === \"circle\" ? \"ds:rounded-full\" : \"ds:rounded-badge\",\n microInteractions.selection,\n \"ds:hover:border-fg-4\",\n \"ds:focus-visible:[border-color:var(--focus-ring-border)] ds:focus-visible:[box-shadow:var(--shadow-focus-ring-field)] ds:focus-visible:outline-none\",\n \"ds:data-[state=checked]:border-brand ds:data-[state=checked]:bg-brand-bg\",\n \"ds:data-[state=indeterminate]:border-brand ds:data-[state=indeterminate]:bg-brand-bg\",\n \"ds:disabled:bg-bg-disabled ds:disabled:border-rule ds:disabled:text-fg-disabled ds:disabled:cursor-not-allowed\",\n // A disabled box reads disabled whatever its value: the checked /\n // indeterminate brand edge and tint would otherwise outrank it.\n \"ds:disabled:data-[state=checked]:border-rule ds:disabled:data-[state=checked]:bg-bg-disabled\",\n \"ds:disabled:data-[state=indeterminate]:border-rule ds:disabled:data-[state=indeterminate]:bg-bg-disabled\",\n // Danger ink, not the pale danger line (1.48:1): an invalid box is still\n // identified by its edge alone (WCAG 1.4.11).\n \"ds:aria-[invalid=true]:border-danger-fg\",\n className,\n )}\n {...props}\n >\n <CheckboxPrimitive.Indicator\n {...slot(checkboxAnatomy, \"indicator\")}\n // The mark settles in (press tier, no overshoot) rather than blinking on.\n className=\"ds:flex ds:items-center ds:justify-center ds:text-current ds:motion-safe:animate-in ds:motion-safe:fade-in-0 ds:motion-safe:zoom-in-50 ds:duration-[var(--motion-duration-press)] ds:ease-[var(--motion-ease-enter)]\"\n >\n {resolvedChecked === \"indeterminate\" ? (\n <MinusIcon className=\"ds:size-3\" strokeWidth={3} aria-hidden=\"true\" />\n ) : shape === \"circle\" ? (\n <span className=\"ds:size-1.5 ds:rounded-full ds:bg-current\" aria-hidden=\"true\" />\n ) : (\n <CheckIcon className=\"ds:size-3\" strokeWidth={3} aria-hidden=\"true\" />\n )}\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n {label && (\n <label\n htmlFor={wiring.id}\n {...slot(checkboxAnatomy, \"label\")}\n className={cn(\n \"ds:text-fg ds:peer-disabled:text-fg-disabled ds:cursor-pointer ds:leading-none ds:select-none ds:peer-disabled:cursor-not-allowed\",\n CONTROL_LABEL_TEXT,\n )}\n >\n {label}\n </label>\n )}\n </div>\n );\n});\n\nCheckbox.displayName = CheckboxPrimitive.Root.displayName;\n","\"use client\";\n\nimport { forwardRef } from \"react\";\n\nimport { pressableAnatomy, type PressableSlot } from \"../foundation/anatomy/slots\";\nimport { slot, stateAttributes } from \"../foundation/anatomy/slot\";\nimport { cn } from \"../lib/cn\";\n\nimport { Slot } from \"./behavior/slot\";\n\n/** The pressable part (ADR-008). See the registry for the doc comment. */\nexport type { PressableSlot };\n\nexport interface PressableProps extends React.ButtonHTMLAttributes<HTMLElement> {\n /**\n * Render the child element instead of a `<button>` (Radix `Slot`). The\n * child keeps its own element and role — an `<a href>` stays a link — and\n * gains the pressable behaviour: Space activates it like a button, `disabled`\n * becomes `aria-disabled` + `tabIndex={-1}` with the click swallowed, and\n * `pressed` is reflected. A child that is neither a `<button>` nor a link\n * must carry its own `role=\"button\"` and `tabIndex`.\n */\n asChild?: boolean;\n /**\n * Toggle state (a boolean prop, never a variant — ADR-007 §2). Reflected as\n * `aria-pressed` and, when true, `data-pressed`. Leave undefined for an\n * action that does not toggle.\n */\n pressed?: boolean | undefined;\n /**\n * Native `disabled` on a `<button>`; on any other element (`asChild`)\n * `aria-disabled=\"true\"`, removal from the tab order and a prevented click,\n * because links and generic elements have no `disabled` attribute.\n */\n disabled?: boolean | undefined;\n}\n\n/**\n * The behaviour of a button, without its look (W3-03; target architecture\n * §30, ADR-008). What every pressable thing in the system needs and what a\n * `<div onClick>` never gets: keyboard activation with Enter *and* Space, a\n * visible focus ring, disabled semantics that hold on links, and `pressed`\n * reflected as ARIA and as a `data-*` hook for styling.\n *\n * Unstyled-accessible: the only classes are the cursor, the focus ring and\n * `pointer-events-none` while disabled. Geometry and colour belong to the\n * component that composes it (`Button`'s recipe is `buttonBase`; a clickable\n * `Surface` renders through this).\n *\n * State attributes on the root: `data-slot=\"pressable\"`, `data-disabled`,\n * `data-pressed`. The native element defaults to `type=\"button\"` — a new\n * primitive has no submit-by-default legacy to keep (Button's own default is\n * W3-10).\n *\n * @experimental\n */\nexport const Pressable = forwardRef<HTMLElement, PressableProps>(function Pressable(\n {\n asChild = false,\n pressed,\n disabled,\n type,\n className,\n onClick,\n onKeyDown,\n onKeyUp,\n children,\n ...props\n },\n ref,\n) {\n const state = stateAttributes({ disabled, pressed });\n\n const handleClick = (event: React.MouseEvent<HTMLElement>) => {\n if (disabled) {\n // A link or a generic element has no native `disabled`: the click must\n // not navigate, must not bubble to a delegated handler, and must not\n // reach the consumer's `onClick`.\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n onClick?.(event);\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLElement>) => {\n onKeyDown?.(event);\n if (event.defaultPrevented) return;\n const element = event.currentTarget;\n if (disabled) {\n if (event.key === \"Enter\" || event.key === \" \") event.preventDefault();\n return;\n }\n if (isNativeButton(element)) return; // the browser activates on Enter and Space\n if (event.key === \" \") {\n // Like a native button: Space activates on key *up*; here it must only\n // not scroll the page.\n event.preventDefault();\n return;\n }\n if (event.key === \"Enter\" && !isLink(element)) {\n // A link already follows Enter natively; anything else needs the click.\n event.preventDefault();\n element.click();\n }\n };\n\n const handleKeyUp = (event: React.KeyboardEvent<HTMLElement>) => {\n onKeyUp?.(event);\n if (event.defaultPrevented || disabled) return;\n const element = event.currentTarget;\n if (event.key === \" \" && !isNativeButton(element)) {\n event.preventDefault();\n element.click();\n }\n };\n\n const shared = {\n ...slot(pressableAnatomy, \"root\"),\n ...state,\n \"aria-pressed\": pressed,\n className: cn(PRESSABLE_CLASSES, className),\n onClick: handleClick,\n onKeyDown: handleKeyDown,\n onKeyUp: handleKeyUp,\n };\n\n if (asChild) {\n return (\n <Slot\n ref={ref}\n {...shared}\n {...(disabled ? { \"aria-disabled\": true, tabIndex: -1 } : {})}\n {...(type === undefined ? {} : { type })}\n {...props}\n >\n {children}\n </Slot>\n );\n }\n\n return (\n <button\n ref={ref as React.Ref<HTMLButtonElement>}\n type={type ?? \"button\"}\n disabled={disabled}\n {...shared}\n {...props}\n >\n {children}\n </button>\n );\n});\n\nPressable.displayName = \"Pressable\";\n\n/**\n * Cursor, focus ring and the disabled block (no pointer events and a\n * `not-allowed` cursor, as Slider's thumb and every other disabled control\n * show) — nothing that gives the element a size or a colour. The ring is the\n * system's `--shadow-focus-ring`, the same one `buttonBase` draws, so a\n * Pressable inside a Button-styled surface never shows two rings.\n */\nconst PRESSABLE_CLASSES =\n \"ds:cursor-pointer ds:focus-visible:outline-none ds:focus-visible:[box-shadow:var(--shadow-focus-ring)] ds:data-[disabled]:pointer-events-none ds:data-[disabled]:cursor-not-allowed\";\n\nfunction isNativeButton(element: HTMLElement): boolean {\n if (element.tagName === \"BUTTON\") return true;\n if (element.tagName !== \"INPUT\") return false;\n const type = (element as HTMLInputElement).type;\n return type === \"button\" || type === \"submit\" || type === \"reset\";\n}\n\nfunction isLink(element: HTMLElement): boolean {\n return element.tagName === \"A\" && element.hasAttribute(\"href\");\n}\n","import { cn } from \"../../../lib/cn\";\n\n/**\n * L1a behaviour primitive (private). Not exported from the package.\n *\n * The class recipes of a modal overlay (W5-03; target architecture §4 L1a,\n * §17): the backdrop, the surface, the dismiss button and the header, title,\n * description, body and footer parts. `Dialog`, `AlertDialog` and `Sheet`\n * wrote the same strings three times; they read them from here now, and the\n * strings themselves are today's bytes — every row below is the literal the\n * adopting component rendered from `main` before W5-03, joined in the order\n * it wrote them, so the adoption is a zero-diff move. Popover and HoverCard\n * (W5-11) share the anchored, non-modal `floating` surface below on the same\n * terms; the menus (W5-13/14) keep their own.\n *\n * One axis the adopters differ on, a table rather than a template so the\n * CSS that ships is exactly the rows that are used:\n *\n * - {@link OverlayLayout}: a centred box pads itself (`inset` — the header\n * and footer carry margins inside a `p-6` surface); a sheet's parts pad\n * themselves (`padded` — `p-6` on each part, the surface is a flex\n * column). The body region follows the same split.\n *\n * Motion is no longer a class axis (W5-04, ADR-012): backdrop and surface\n * carry `data-ds-presence` (`behavior/presence.tsx`) and animate with the\n * keyframes in `src/styles/components/presence.css`. The transition rows\n * the recipes wrote before never ran (Radix mounts content already open and\n * ignores transitions on close — spike S4), so their removal changes no\n * rest-state pixel; {@link OverlayMotion} stays as a prop the adopters pass\n * and now selects nothing.\n *\n * Every row is a full literal so Tailwind's scanner sees it: never build a\n * class from a template. No React, no client directive.\n */\n\n/**\n * The pre-ADR-012 motion axis (`tokens` for Dialog, `legacy` for\n * AlertDialog/Sheet). Both resolve to the same keyframe presence now; the\n * type stays so the adopters' call sites are untouched.\n */\nexport type OverlayMotion = \"tokens\" | \"legacy\";\n\n/** Whether the surface pads itself (`inset`) or its parts do (`padded`). */\nexport type OverlayLayout = \"inset\" | \"padded\";\n\n/**\n * Where a modal surface sits: centred, docked to one viewport edge, or\n * `responsive` — a bottom panel below the `sm` breakpoint and the centred box\n * from it, on one node (W5-09). `spotlight` — horizontally centred below the\n * top edge (a command palette, W5-19). The anchored, non-modal surface of\n * Popover and HoverCard is {@link floatingSurfaceClasses}: Radix's popper\n * places it.\n */\nexport type OverlayPlacement = \"center\" | \"top\" | \"right\" | \"bottom\" | \"left\" | \"responsive\" | \"spotlight\";\n\n/**\n * How wide a floating surface is (W5-11; target architecture §14 \"Popover /\n * HoverCard: `width: auto | trigger | sm | md | lg`\" — 100% of consumer\n * `PopoverContent` uses override width or padding by class today). `auto`\n * adds nothing (the content sizes the box); `trigger` reads the popper\n * variable Radix stamps on the content; `sm`/`md`/`lg` are 16/18/24rem —\n * `md` is the `w-72` Popover always wrote, `sm` the `w-64` of HoverCard.\n */\nexport type FloatingWidth = \"auto\" | \"trigger\" | \"sm\" | \"md\" | \"lg\";\n\n/** Inner padding of a floating surface; `md` is the `p-4` both adopters wrote. */\nexport type FloatingPadding = \"none\" | \"sm\" | \"md\";\n\n/** Inner padding of an overlay body, as a `surface.padding` step or none. */\nexport type OverlayBodyPadding = \"none\" | \"sm\" | \"md\" | \"lg\";\n\n/* ── Backdrop ─────────────────────────────────────────────────────────────── */\n\nconst BACKDROP_BOX =\n \"ds:bg-overlay ds:fixed ds:inset-0 ds:z-[var(--z-overlay)] ds:backdrop-blur-[4px]\";\n\n/** The dimmed, blurred layer behind a modal surface (presence: `fade`). */\nexport function backdropClasses(_motion: OverlayMotion, className?: string): string {\n return cn(BACKDROP_BOX, className);\n}\n\n/* ── Surface ──────────────────────────────────────────────────────────────── */\n\nconst CENTER_BOX = \"ds:fixed ds:top-1/2 ds:left-1/2 ds:z-[var(--z-modal)] ds:w-full\";\nconst CENTER_SCROLL = \"ds:scrollbar-thin ds:max-h-[calc(100vh-6rem)] ds:overflow-y-auto\";\n// `rounded-card` and `shadow-overlay` are the W2-07 radius and the W2-08\n// `overlay` elevation role of `Surface`; the surface is not a `Surface` only\n// because its box is Radix's content element.\nconst CENTER_CHROME =\n \"ds:rounded-card ds:border-rule ds:bg-surface ds:shadow-overlay ds:border ds:p-6\";\nconst CENTER_INK = \"ds:font-body ds:text-fg\";\n// The centring is unconditional now: the `data-[state=open]:` variants it\n// wore before ADR-012 were the rest state, and the closed-state offset was\n// part of a transition that never ran. The presence keyframes animate\n// `transform`, which composes with this `translate`.\nconst CENTER_PLACE = \"ds:-translate-x-1/2 ds:-translate-y-1/2\";\n\n/**\n * The docked panel (a sheet): the base every side shares, then the side\n * (its slide is the `sheet-<side>` presence). A left/right panel is\n * `width: var(--ds-sheet-width, 75%)` capped at\n * `min(var(--ds-sheet-width, 24rem), 95vw)` — the 1.x `w-3/4 max-w-sm`\n * when the hook is unset (W5-07; the `95vw` cap only binds below 404px,\n * where 75% is narrower anyway) and the consumer's width when it is. The\n * bottom panel pads for the home-indicator safe area (zero on other devices).\n */\nconst PANEL_BASE =\n \"ds:fixed ds:z-[var(--z-modal)] ds:flex ds:flex-col ds:gap-4 ds:bg-surface ds:text-fg ds:shadow-overlay\";\n\n/**\n * The spotlight box (W5-19): `CommandPalette`'s surface, byte for byte — a\n * full-width box capped by the adopter's `width` row, pinned 20vh from the\n * top and centred on the x axis; unpadded and clipping (the palette's own\n * regions pad themselves). Its motion is the `spotlight` presence (W5-04,\n * ADR-012): a keyboard-opened surface enters without animation (Polish 2\n * §3.8 frequency rule) and fades out.\n */\nconst SPOTLIGHT_BOX = \"ds:fixed ds:top-[20vh] ds:left-1/2 ds:z-[var(--z-modal)] ds:w-full\";\nconst SPOTLIGHT_SHIFT = \"ds:-translate-x-1/2\";\nconst SPOTLIGHT_CHROME =\n \"ds:rounded-card ds:border-rule ds:bg-surface ds:shadow-overlay ds:overflow-hidden ds:border\";\n\nconst PANEL_SIDE: Readonly<\n Record<Exclude<OverlayPlacement, \"center\" | \"responsive\" | \"spotlight\">, string>\n> = {\n top: \"ds:inset-x-0 ds:top-0 ds:border-b ds:border-rule\",\n bottom:\n \"ds:inset-x-0 ds:bottom-0 ds:border-t ds:border-rule ds:max-h-[85vh] ds:pb-[env(safe-area-inset-bottom)]\",\n left: \"ds:inset-y-0 ds:left-0 ds:h-full ds:w-[var(--ds-sheet-width,75%)] ds:max-w-[min(var(--ds-sheet-width,24rem),95vw)] ds:border-r ds:border-rule\",\n right:\n \"ds:inset-y-0 ds:right-0 ds:h-full ds:w-[var(--ds-sheet-width,75%)] ds:max-w-[min(var(--ds-sheet-width,24rem),95vw)] ds:border-l ds:border-rule\",\n};\n\n/**\n * The responsive surface (W5-09, `Dialog presentation=\"responsive\"`): one\n * node that is a bottom panel below the `sm` breakpoint and the centred box\n * from it. Every unprefixed row is the panel form (the `bottom` side above,\n * with the box padding the centred form's parts expect and the safe-area\n * inset added to the bottom padding); every `sm:` row restores the centred\n * form, property for property (`CENTER_*` rewritten under the variant), so\n * the two forms compute to the same styles as `bottom` and `center` do.\n * Crossing the breakpoint changes CSS only: the node, its focus and its\n * scroll position stay. Motion is the `responsive` presence (W5-04,\n * ADR-012): the bottom panel's slide below `sm`, the modal box's settle\n * from it.\n */\nconst RESPONSIVE_BOX = cn(\n \"ds:fixed ds:inset-x-0 ds:bottom-0 ds:z-[var(--z-modal)] ds:w-full\",\n \"ds:sm:top-1/2 ds:sm:right-auto ds:sm:bottom-auto ds:sm:left-1/2\",\n);\nconst RESPONSIVE_SCROLL =\n \"ds:scrollbar-thin ds:max-h-[85vh] ds:overflow-y-auto ds:sm:max-h-[calc(100vh-6rem)]\";\nconst RESPONSIVE_CHROME = cn(\n \"ds:rounded-t-card ds:border-rule ds:bg-surface ds:shadow-overlay ds:border-t ds:p-6\",\n \"ds:pb-[calc(1.5rem+env(safe-area-inset-bottom))]\",\n \"ds:sm:rounded-card ds:sm:border ds:sm:pb-6\",\n);\n// The centred form's placement from `sm`, unconditional (see CENTER_PLACE).\nconst RESPONSIVE_PLACE = \"ds:sm:-translate-x-1/2 ds:sm:-translate-y-1/2\";\n\n/** Where a component's own rows go in the surface recipe. */\nexport interface OverlaySurfaceRows {\n /**\n * A width row written into the box row (`AlertDialog` wrote `max-w-lg`\n * there); `rows` come after the recipe. Two positions only because the\n * adopters wrote them there before W5-03 and keep their bytes.\n */\n width?: string | undefined;\n /** Rows after the recipe and before the consumer's `className`. */\n rows?: ReadonlyArray<string | null | undefined | false> | undefined;\n}\n\n/**\n * The modal surface: the centred box of a dialog (`center`), the spotlight\n * box of a palette (`spotlight`) or the docked panel of a sheet (a side),\n * then the component's own rows, then `className`.\n */\nexport function overlaySurfaceClasses(\n placement: OverlayPlacement,\n _motion: OverlayMotion,\n { width, rows = [] }: OverlaySurfaceRows = {},\n className?: string,\n): string {\n if (placement === \"center\") {\n return cn(\n CENTER_BOX,\n width,\n CENTER_SCROLL,\n CENTER_CHROME,\n CENTER_INK,\n CENTER_PLACE,\n ...rows,\n className,\n );\n }\n if (placement === \"responsive\") {\n return cn(\n RESPONSIVE_BOX,\n width,\n RESPONSIVE_SCROLL,\n RESPONSIVE_CHROME,\n CENTER_INK,\n RESPONSIVE_PLACE,\n ...rows,\n className,\n );\n }\n if (placement === \"spotlight\") {\n return cn(SPOTLIGHT_BOX, width, SPOTLIGHT_SHIFT, SPOTLIGHT_CHROME, CENTER_INK, ...rows, className);\n }\n return cn(PANEL_BASE, PANEL_SIDE[placement], ...rows, className);\n}\n\n/* ── Floating surface (Popover, HoverCard) ────────────────────────────────── */\n\n/**\n * The anchored box: Radix's popper positions it, so it has no placement rows\n * of its own. Written in the order Popover and HoverCard wrote it before\n * W5-11 — chrome, width, `border`, padding, `outline-none` — so both\n * defaults are today's bytes. Its motion is the `floating` presence\n * (W5-04, ADR-012): the adopter stamps `data-ds-presence=\"floating\"`.\n */\nconst FLOATING_CHROME =\n \"ds:rounded-card ds:border-rule ds:bg-surface ds:text-fg ds:shadow-pop ds:z-[var(--z-dropdown)]\";\n\n/**\n * The width rows of a floating surface, per adopter: the `trigger` row reads\n * the popper variable of the adopter's Radix family. Full literals so\n * Tailwind's scanner sees them.\n */\nexport const FLOATING_WIDTH: Readonly<\n Record<\"popover\" | \"hover-card\", Readonly<Record<FloatingWidth, string>>>\n> = {\n popover: {\n auto: \"\",\n trigger: \"ds:w-(--radix-popover-trigger-width)\",\n sm: \"ds:w-64\",\n md: \"ds:w-72\",\n lg: \"ds:w-96\",\n },\n \"hover-card\": {\n auto: \"\",\n trigger: \"ds:w-(--radix-hover-card-trigger-width)\",\n sm: \"ds:w-64\",\n md: \"ds:w-72\",\n lg: \"ds:w-96\",\n },\n};\n\nexport const FLOATING_PADDING: Readonly<Record<FloatingPadding, string>> = {\n none: \"\",\n sm: \"ds:p-3\",\n md: \"ds:p-4\",\n};\n\n/** The floating surface's own rows: the resolved width and padding rows. */\nexport interface FloatingSurfaceRows {\n /** The width row (a {@link FLOATING_WIDTH} entry); `\"\"` for `auto`. */\n width?: string;\n /** The padding row (a {@link FLOATING_PADDING} entry); `\"\"` for `none`. */\n padding?: string;\n /** Rows after the recipe and before the consumer's `className`. */\n rows?: ReadonlyArray<string | null | undefined | false>;\n}\n\n/**\n * The anchored, non-modal surface of a Popover or HoverCard (W5-11): chrome,\n * width, border, padding, then the component's own rows and the consumer's\n * `className` last.\n */\nexport function floatingSurfaceClasses(\n _motion: OverlayMotion,\n { width, padding, rows = [] }: FloatingSurfaceRows = {},\n className?: string,\n): string {\n return cn(FLOATING_CHROME, width, \"ds:border\", padding, \"ds:outline-none\", ...rows, className);\n}\n\n/* ── Dismiss button ───────────────────────────────────────────────────────── */\n\n/**\n * The built-in close affordance in the top-right corner of a dismissible\n * surface (`Dialog`, `Sheet`). Not an `IconButton`: its box, colours and\n * hover are the 1.x bytes, and it is the frozen last child of the content\n * (plan §17.1).\n */\nexport const DISMISS_BUTTON_CLASSES = cn(\n \"ds:absolute ds:top-4 ds:right-4 ds:inline-flex ds:size-7 ds:items-center ds:justify-center\",\n \"ds:rounded-icon ds:text-fg-4 ds:transition-colors ds:duration-[var(--duration-fast)] ds:ease-[var(--ease-out-quart)] ds:motion-reduce:transition-none\",\n \"ds:hover:bg-overlay-hover ds:hover:text-fg\",\n \"ds:focus-visible:[box-shadow:var(--shadow-focus-ring)] ds:focus-visible:outline-none\",\n \"ds:disabled:pointer-events-none\",\n);\n\n/** The glyph inside the dismiss button. */\nexport const DISMISS_GLYPH_CLASSES = \"ds:size-4\";\n\n/* ── Parts ────────────────────────────────────────────────────────────────── */\n\nconst HEADER_COLUMN = \"ds:flex ds:flex-col ds:gap-1.5\";\n\n/**\n * The header: a column of title and description. `dismissGutter` reserves\n * the corner the dismiss button occupies (`pr-8` inside a padded box, `pr-12`\n * on a part that pads itself). Joined in the order the adopters wrote it.\n */\nexport function overlayHeaderClasses(\n layout: OverlayLayout,\n dismissGutter: boolean,\n className?: string,\n): string {\n return layout === \"inset\"\n ? cn(\"ds:mb-4\", HEADER_COLUMN, dismissGutter && \"ds:pr-8\", className)\n : cn(HEADER_COLUMN, \"ds:p-6\", dismissGutter && \"ds:pr-12\", \"ds:pb-0\", className);\n}\n\nexport const OVERLAY_TITLE_CLASSES =\n \"ds:font-display ds:text-fg ds:text-base ds:leading-tight ds:font-medium ds:tracking-tight\";\n\nexport const OVERLAY_DESCRIPTION_CLASSES = \"ds:text-fg-3 ds:text-sm\";\n\nconst FOOTER_ROW = \"ds:flex ds:flex-col-reverse ds:gap-2\";\nconst FOOTER_RESPONSIVE = \"ds:sm:flex-row ds:sm:items-center ds:sm:justify-end\";\n\n/** The footer: actions stacked on small screens, a right-aligned row from `sm`. */\nexport function overlayFooterClasses(layout: OverlayLayout, className?: string): string {\n return layout === \"inset\"\n ? cn(\"ds:mt-6\", FOOTER_ROW, FOOTER_RESPONSIVE, className)\n : cn(\n \"ds:border-rule ds:mt-auto\",\n FOOTER_ROW,\n \"ds:border-t ds:p-6\",\n FOOTER_RESPONSIVE,\n className,\n );\n}\n\n/**\n * The body: the scroll region between header and footer. It takes the\n * remaining height of a flex-column surface (a sheet, or a dialog with a\n * fixed `height`) and scrolls on its own; in an auto-height dialog it has\n * nothing to scroll and is inert. Padding is the step the sibling parts\n * write (`md` is their `p-6`): on both axes inside a padded box, and\n * horizontally on a self-padding part (the parts' `gap` spaces them).\n */\nconst BODY_SCROLL = \"ds:scrollbar-thin ds:min-h-0 ds:flex-1 ds:overflow-y-auto\";\n\nconst BODY_PADDING: Readonly<Record<OverlayLayout, Readonly<Record<OverlayBodyPadding, string>>>> =\n {\n inset: {\n none: \"\",\n sm: \"ds:p-4\",\n md: \"ds:p-6\",\n lg: \"ds:p-8\",\n },\n padded: {\n none: \"\",\n sm: \"ds:px-4\",\n md: \"ds:px-6\",\n lg: \"ds:px-8\",\n },\n };\n\nexport function overlayBodyClasses(\n layout: OverlayLayout,\n padding: OverlayBodyPadding,\n className?: string,\n): string {\n return cn(BODY_SCROLL, BODY_PADDING[layout][padding], className);\n}\n","\"use client\";\n\nimport * as React from \"react\";\n\nimport type { Anatomy } from \"../../../foundation/anatomy/define\";\nimport { slot } from \"../../../foundation/anatomy/slot\";\nimport { EN_MESSAGES } from \"../../../foundation/messages/en\";\nimport type { OverlayMessages } from \"../../../foundation/messages/types\";\nimport {\n backdropClasses,\n DISMISS_BUTTON_CLASSES,\n OVERLAY_DESCRIPTION_CLASSES,\n OVERLAY_TITLE_CLASSES,\n overlayBodyClasses,\n overlayFooterClasses,\n overlayHeaderClasses,\n overlaySurfaceClasses,\n type OverlayBodyPadding,\n type OverlayLayout,\n type OverlayMotion,\n type OverlayPlacement,\n type OverlaySurfaceRows,\n} from \"./recipes\";\nimport { presence, type PresenceMotion } from \"../presence\";\nimport { cn } from \"../../../lib/cn\";\n\n/**\n * L1a behaviour primitive (private). Not exported from the package.\n *\n * The parts of a modal overlay (W5-03): `Backdrop`, `OverlaySurface`,\n * `DismissButton` and the `OverlayHeader` / `OverlayTitle` /\n * `OverlayDescription` / `OverlayBody` / `OverlayFooter` regions. `Dialog`,\n * `AlertDialog` and `Sheet` render them; each stays the public component\n * with its own Radix element and its own anatomy, so a part takes the\n * element to render (`as` — Radix's `Overlay`, `Content`, `Close`, `Title`\n * or `Description` of the adopting family) and the anatomy to stamp, and\n * renders exactly `<as {...slot(anatomy, part)} className={recipe} …/>`: the\n * DOM the three components rendered before, byte for byte\n * (`recipes.ts` has the strings).\n *\n * Nothing here is a `forwardRef` of its own: the adopting component owns the\n * ref and the public prop types (its Radix element's), and passes `ref` down\n * like any other prop — React 19 makes `ref` a prop, and Radix's primitives\n * forward it.\n *\n * `Backdrop` and `OverlaySurface` also stamp `data-ds-presence` (W5-04,\n * ADR-012): the backdrop fades, a centred box is `modal`, a docked panel is\n * `sheet-<side>`; the keyframes live in `src/styles/components/presence.css`.\n */\n\n/** Props every part shares: the anatomy to stamp and the element's own props. */\ninterface PartBase {\n anatomy: Anatomy;\n className?: string | undefined;\n children?: React.ReactNode;\n /** Every other prop, `ref` included, lands on the element. */\n [prop: string]: unknown;\n}\n\n/** A part rendered by a Radix element the adopter names. */\ninterface PartProps extends PartBase {\n /** The element (a Radix part or an intrinsic tag) that renders the part. */\n as: React.ElementType;\n}\n\n/** A part that is a `div` unless the adopter names another element. */\ninterface RegionProps extends PartBase {\n as?: React.ElementType;\n}\n\n/** The dimmed layer behind the surface (Radix `Overlay`). */\nexport function Backdrop({\n as: Component,\n anatomy,\n motion,\n className,\n ...props\n}: PartProps & { motion: OverlayMotion }) {\n return (\n <Component\n {...slot(anatomy, \"overlay\")}\n {...presence(\"fade\")}\n className={backdropClasses(motion, className)}\n {...props}\n />\n );\n}\n\nconst SURFACE_PRESENCE: Readonly<Record<OverlayPlacement, PresenceMotion>> = {\n center: \"modal\",\n top: \"sheet-top\",\n right: \"sheet-right\",\n bottom: \"sheet-bottom\",\n left: \"sheet-left\",\n responsive: \"responsive\",\n spotlight: \"spotlight\",\n};\n\n/**\n * The modal box (Radix `Content`). `width` and `rows` are the component's\n * own class rows (size, width), placed where it wrote them (see\n * {@link OverlaySurfaceRows}); `className` comes last.\n */\nexport function OverlaySurface({\n as: Component,\n anatomy,\n placement,\n motion,\n width,\n rows,\n className,\n ...props\n}: PartProps & OverlaySurfaceRows & { placement: OverlayPlacement; motion: OverlayMotion }) {\n return (\n <Component\n {...slot(anatomy, \"content\")}\n {...presence(SURFACE_PRESENCE[placement])}\n className={overlaySurfaceClasses(placement, motion, { width, rows }, className)}\n {...props}\n />\n );\n}\n\n/**\n * The copy a dismissible overlay renders (target architecture §24.5): the\n * `overlay` namespace of the messages catalogue (W5-22). An adopter resolves\n * it with `useDsMessages(\"overlay\", messages)` — prop > provider > English —\n * and passes the result to {@link DismissButton}; this constant is the English\n * row for call sites that cannot use the hook.\n */\nexport type { OverlayMessages };\n\nexport const DEFAULT_OVERLAY_MESSAGES: Readonly<OverlayMessages> = EN_MESSAGES.overlay;\n\n/**\n * The built-in close button (Radix `Close`), the frozen last child of a\n * dismissible content (plan §17.1). `label` is its accessible name; the\n * adopter resolves it from `closeLabel ?? useDsMessages(\"overlay\", messages).close`. The\n * glyph is the adopter's `children` (`<XIcon className={DISMISS_GLYPH_CLASSES}\n * aria-hidden />`): icons are L2, and an L1a module does not import upward.\n */\nexport function DismissButton({\n as: Component,\n anatomy,\n label,\n className,\n children,\n ...props\n}: PartProps & { label: string; children: React.ReactNode }) {\n return (\n <Component\n {...slot(anatomy, \"close\")}\n className={cn(DISMISS_BUTTON_CLASSES, className)}\n aria-label={label}\n {...props}\n >\n {children}\n </Component>\n );\n}\n\n/** The title and description column. */\nexport function OverlayHeader({\n as: Component = \"div\",\n anatomy,\n layout,\n dismissGutter,\n className,\n ...props\n}: RegionProps & { layout: OverlayLayout; dismissGutter: boolean }) {\n return (\n <Component\n {...slot(anatomy, \"header\")}\n className={overlayHeaderClasses(layout, dismissGutter, className)}\n {...props}\n />\n );\n}\n\n/** The heading (Radix `Title`). */\nexport function OverlayTitle({ as: Component, anatomy, className, ...props }: PartProps) {\n return (\n <Component\n {...slot(anatomy, \"title\")}\n className={cn(OVERLAY_TITLE_CLASSES, className)}\n {...props}\n />\n );\n}\n\n/** The supporting copy (Radix `Description`). */\nexport function OverlayDescription({ as: Component, anatomy, className, ...props }: PartProps) {\n return (\n <Component\n {...slot(anatomy, \"description\")}\n className={cn(OVERLAY_DESCRIPTION_CLASSES, className)}\n {...props}\n />\n );\n}\n\n/** The scroll region between header and footer (new in W5-05/07). */\nexport function OverlayBody({\n as: Component = \"div\",\n anatomy,\n layout,\n padding,\n className,\n ...props\n}: RegionProps & { layout: OverlayLayout; padding: OverlayBodyPadding }) {\n return (\n <Component\n {...slot(anatomy, \"body\")}\n className={overlayBodyClasses(layout, padding, className)}\n {...props}\n />\n );\n}\n\n/** The action row. */\nexport function OverlayFooter({\n as: Component = \"div\",\n anatomy,\n layout,\n className,\n ...props\n}: RegionProps & { layout: OverlayLayout }) {\n return (\n <Component\n {...slot(anatomy, \"footer\")}\n className={overlayFooterClasses(layout, className)}\n {...props}\n />\n );\n}\n","import * as DialogPrimitive from \"@radix-ui/react-dialog\";\n\n/**\n * L1a behaviour primitive (private). Not exported from the package.\n *\n * The headless modal behaviour every modal overlay shares (W5-19; target\n * architecture P7, §33): focus trap, scroll lock, dismissable layer, the\n * `data-state` attribute and the `aria-labelledby` / `aria-describedby`\n * wiring — Radix's Dialog today, named for what it does so an adopter never\n * spells the package. `Dialog` and `Sheet` are the registered wrappers of\n * the package itself (`architecture/l2-dag.json`); a pattern that is a modal\n * but not a `Dialog` (`CommandPalette`) renders these as the `as` element of\n * the overlay parts (`./parts.tsx`) instead of importing the package.\n */\nexport const ModalRoot = DialogPrimitive.Root;\nexport const ModalTrigger = DialogPrimitive.Trigger;\nexport const ModalPortal = DialogPrimitive.Portal;\nexport const ModalOverlay = DialogPrimitive.Overlay;\nexport const ModalContent = DialogPrimitive.Content;\nexport const ModalTitle = DialogPrimitive.Title;\nexport const ModalDescription = DialogPrimitive.Description;\nexport const ModalClose = DialogPrimitive.Close;\n\nexport type ModalRootProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>;\nexport type ModalContentProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>;\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\n\nimport { popoverAnatomy, type PopoverSlot } from \"../foundation/anatomy/slots\";\nimport { slot } from \"../foundation/anatomy/slot\";\nimport {\n FLOATING_PADDING,\n FLOATING_WIDTH,\n floatingSurfaceClasses,\n type FloatingPadding,\n type FloatingWidth,\n} from \"./behavior/overlay\";\nimport { withPortalContainer } from \"./behavior/portal\";\nimport { presence } from \"./behavior/presence\";\n\n/* ───────────────────────────────────────────────────────────────────────\n * Popover — Radix UI popover primitive. Modified\n *\n * Public API preserved:\n * Popover, PopoverTrigger, PopoverContent\n *\n * NEW (additive): PopoverAnchor, PopoverPortal, PopoverClose are\n * exported for advanced composition.\n *\n * W5-11: the content is the shared floating surface of the overlay\n * internals (`behavior/overlay`), with `width` and `padding` props. The\n * defaults (`md`, `md`) render the class string the component always did;\n * every other value is opt-in and replaces the `w-*` / `p-*` class\n * consumers wrote on `className`.\n *\n * G10: the content is a `role=\"dialog\"`, and a dialog needs a name. When\n * the caller gives none (`aria-label` / `aria-labelledby`), the content is\n * labelled by the trigger that opened it — the root shares the trigger's\n * rendered id through context. A caller's label always wins.\n * ─────────────────────────────────────────────────────────────────────── */\n\n/** The popover parts (ADR-008). See the registry for the doc comment. */\nexport type { PopoverSlot };\n\n/** How wide a `PopoverContent` is. @experimental */\nexport type PopoverWidth = FloatingWidth;\n/** Inner padding of a `PopoverContent`. @experimental */\nexport type PopoverPadding = FloatingPadding;\n\n/** The mounted trigger's id, so an unnamed content can point at it. */\nconst PopoverTriggerIdContext = React.createContext<{\n open: boolean;\n triggerId: string | undefined;\n setTriggerId: (id: string | undefined) => void;\n} | null>(null);\n\nconst Popover: React.FC<PopoverPrimitive.PopoverProps> = ({\n open: openProp,\n defaultOpen,\n onOpenChange,\n ...props\n}) => {\n // Mirrors Radix's open state (controlled or not) so the trigger only\n // carries a generated id while there is a dialog to label: the closed\n // markup stays exactly what it was.\n const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen ?? false);\n const open = openProp ?? uncontrolledOpen;\n const handleOpenChange = React.useCallback(\n (next: boolean) => {\n setUncontrolledOpen(next);\n onOpenChange?.(next);\n },\n [onOpenChange],\n );\n const [triggerId, setTriggerId] = React.useState<string | undefined>(undefined);\n const value = React.useMemo(() => ({ open, triggerId, setTriggerId }), [open, triggerId]);\n return (\n <PopoverTriggerIdContext.Provider value={value}>\n <PopoverPrimitive.Root\n {...(openProp !== undefined ? { open: openProp } : {})}\n {...(defaultOpen !== undefined ? { defaultOpen } : {})}\n onOpenChange={handleOpenChange}\n {...props}\n />\n </PopoverTriggerIdContext.Provider>\n );\n};\nPopover.displayName = \"Popover\";\n\nconst PopoverTrigger = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Trigger>\n>(({ id, ...props }, forwardedRef) => {\n const context = React.useContext(PopoverTriggerIdContext);\n const generatedId = React.useId();\n const node = React.useRef<HTMLButtonElement | null>(null);\n const ref = React.useCallback(\n (element: HTMLButtonElement | null) => {\n node.current = element;\n if (typeof forwardedRef === \"function\") forwardedRef(element);\n else if (forwardedRef) forwardedRef.current = element;\n },\n [forwardedRef],\n );\n const setTriggerId = context?.setTriggerId;\n // Read the id from the DOM: with `asChild` the child's own id wins the merge.\n React.useEffect(() => {\n setTriggerId?.(node.current?.id || undefined);\n });\n React.useEffect(() => () => setTriggerId?.(undefined), [setTriggerId]);\n return (\n <PopoverPrimitive.Trigger\n ref={ref}\n id={id ?? (context?.open ? generatedId : undefined)}\n {...props}\n />\n );\n});\nPopoverTrigger.displayName = PopoverPrimitive.Trigger.displayName;\nconst PopoverAnchor = PopoverPrimitive.Anchor;\nconst PopoverPortal = withPortalContainer(PopoverPrimitive.Portal);\nconst PopoverClose = PopoverPrimitive.Close;\n\nexport interface PopoverContentProps extends React.ComponentPropsWithoutRef<\n typeof PopoverPrimitive.Content\n> {\n /**\n * The width of the surface. `md` (default, 18rem) is what the popover\n * always rendered; `auto` sizes to the content, `trigger` matches the\n * element that opened it, `sm` and `lg` are 16rem and 24rem. Replaces the\n * `w-*` class consumers wrote on `className`.\n *\n * @experimental\n */\n width?: PopoverWidth;\n /**\n * Inner padding of the surface. `md` (default) is the `p-4` the popover\n * always rendered; `sm` is `p-3`; `none` lets the content pad itself (a\n * list, a form). Replaces the `p-*` class consumers wrote on `className`.\n *\n * @experimental\n */\n padding?: PopoverPadding;\n}\n\nconst PopoverContent = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Content>,\n PopoverContentProps\n>(\n (\n {\n className,\n align = \"center\",\n side = \"bottom\",\n sideOffset = 8,\n width = \"md\",\n padding = \"md\",\n ...props\n },\n ref,\n ) => {\n const triggerId = React.useContext(PopoverTriggerIdContext)?.triggerId;\n const named = Boolean(props[\"aria-label\"] || props[\"aria-labelledby\"]);\n return (\n <PopoverPortal>\n <PopoverPrimitive.Content\n ref={ref}\n aria-labelledby={named ? undefined : triggerId}\n align={align}\n side={side}\n sideOffset={sideOffset}\n {...slot(popoverAnatomy, \"content\")}\n {...presence(\"floating\")}\n className={floatingSurfaceClasses(\n \"tokens\",\n { width: FLOATING_WIDTH.popover[width], padding: FLOATING_PADDING[padding] },\n className,\n )}\n {...props}\n />\n </PopoverPortal>\n );\n },\n);\nPopoverContent.displayName = PopoverPrimitive.Content.displayName;\n\nexport { Popover, PopoverTrigger, PopoverAnchor, PopoverPortal, PopoverClose, PopoverContent };\n","/**\n * L1a behaviour primitive (private). Not exported from the package.\n *\n * The `width` of a menu content surface (W5-13; target architecture §14\n * \"Menus: `width: auto | trigger | sm | md`\" — 62% of consumer\n * `DropdownMenuContent` uses override the width by class today). `auto` is\n * the default and adds nothing, so every existing menu keeps its class string\n * byte for byte; the other values are opt-in. `trigger` reads the Popper\n * variable Radix stamps on the content, so the menu is as wide as the element\n * that opened it.\n *\n * Full literals, one per row, so Tailwind's scanner sees them.\n */\n\n/** How wide a menu content surface is. */\nexport type MenuWidth = \"auto\" | \"trigger\" | \"sm\" | \"md\";\n\n/** The width row of a `DropdownMenuContent`, per {@link MenuWidth}; `auto` is empty. */\nexport const DROPDOWN_MENU_WIDTH: Readonly<Record<MenuWidth, string>> = {\n auto: \"\",\n trigger: \"ds:w-(--radix-dropdown-menu-trigger-width)\",\n sm: \"ds:w-48\",\n md: \"ds:w-64\",\n};\n","/**\n * L1a behaviour primitive (private). Not exported from the package.\n *\n * The one class recipe of a menu (W5-13/W5-14; target architecture §32 \"one\n * `Menu` item implementation\", plan lock L-MENU), written on the collection\n * frames of `../collection/item-recipe.ts`: what an item, a checkbox/radio\n * item, a sub-menu trigger, a label, a separator and a shortcut look like in\n * `DropdownMenu` (the `menu` palette, `menu.item.*` tokens) and `ContextMenu`\n * (the `neutral` palette). Both components read these tables with zero diff:\n * every class string is the one they wrote before the adoption, byte for byte,\n * so the C-DOM snapshots and the CSS contracts do not move.\n *\n * The two menus differ on exactly one axis, the {@link MenuPalette}, so every\n * table here is keyed by it. Rows are full literals — Tailwind's scanner reads\n * them here, never from a template.\n *\n * `onSelect` and `onClick` (target architecture §14 \"Selection callbacks in\n * menus\"): Radix composes the consumer's `onClick` with its own select\n * handler, and a keyboard activation (Enter/Space) clicks the element, so both\n * callbacks fire for every activation. `onSelect` is the canonical one (it\n * carries the `event.preventDefault()` that keeps the menu open); `onClick`\n * is tolerated and stays.\n *\n * No React, no client directive: tables of strings and a few joins.\n */\n\nimport {\n LIST_ITEM_DISABLED,\n LIST_ITEM_HIGHLIGHTED,\n LIST_ITEM_INDICATOR_WELL,\n LIST_ITEM_INK,\n LIST_ITEM_INTERACTION,\n LIST_ITEM_MOTION,\n LIST_SEPARATOR,\n type ListItemPalette,\n groupHeadingClasses,\n listItemClasses,\n} from \"../collection/item-recipe\";\n\n/**\n * The colour family a menu draws from: `menu` is DropdownMenu's `menu.item.*`\n * token family, `neutral` is ContextMenu's semantic ink (the same rows\n * Select's list uses).\n */\nexport type MenuPalette = ListItemPalette;\n\n/** The label size every menu row renders today. Owned here, not by the collection. */\nexport const MENU_ITEM_LABEL_SIZE = \"ds:text-sm\";\n\n/** The extra leading well of an `inset` item, label or sub-trigger, aligning it with indicator items. */\nexport const MENU_INSET = \"ds:pl-8\";\n\n/**\n * The `intent=\"danger\"` look of an item — what the legacy `destructive`\n * boolean alias maps to on both menus (plan W5-13: \"`destructive` item alias\n * intact\"). Per palette, because DropdownMenu has dedicated\n * `menu.item.destructive.*` tokens and ContextMenu reads the `danger` roles.\n */\nexport const MENU_ITEM_DANGER: Readonly<Record<MenuPalette, string>> = {\n menu: \"ds:text-menu-item-destructive-fg ds:focus:bg-menu-item-destructive-hover-bg ds:focus:text-menu-item-destructive-hover-fg\",\n neutral: \"ds:text-danger-fg ds:focus:bg-danger-bg ds:focus:text-danger-fg\",\n};\n\n/** The open sub-menu trigger keeps its highlighted colours while its content is open. */\nexport const MENU_SUB_TRIGGER_OPEN: Readonly<Record<MenuPalette, string>> = {\n menu: \"ds:data-[state=open]:bg-menu-item-hover-bg ds:data-[state=open]:text-menu-item-hover-fg\",\n neutral: \"ds:data-[state=open]:bg-bg-2 ds:data-[state=open]:text-fg\",\n};\n\n/**\n * The box of a sub-menu trigger: the `menu` frame without `relative` (it has\n * no indicator well to anchor; the chevron is a flex child).\n */\nexport const MENU_SUB_TRIGGER_BOX =\n \"ds:rounded-surface-sm ds:flex ds:cursor-pointer ds:items-center ds:gap-2 ds:px-2 ds:py-1.5\";\n\n/** The chevron glyph at the end of a sub-menu trigger, nudged 1px left onto its visual mass (Polish 2 §3.9). */\nexport const MENU_SUB_TRIGGER_CHEVRON = \"ds:text-fg-3 ds:ml-auto ds:size-4 ds:-translate-x-px\";\n\n/** The 1rem well at the start of a checkbox/radio item that holds its indicator. */\nexport const MENU_INDICATOR_WELL = LIST_ITEM_INDICATOR_WELL.start;\n\n/**\n * The check glyph of a checked checkbox item. `!` on the size utility: a\n * plain `ds:size-3.5` (0,1,0) loses to `LIST_ITEM_GLYPH`'s `ds:[&_svg]:size-4`\n * (0,1,1) if this glyph is ever rendered inside a row that carries the\n * collection's default glyph sizing (today's `menuIndicatorItemClasses`\n * passes `glyph: false` so the two never actually collide, but the row and\n * the glyph are defined in different files with no static link between them\n * — the `!` makes the intended size win regardless).\n */\nexport const MENU_CHECK_GLYPH = \"ds:size-3.5!\";\n\n/** The dot glyph of a checked radio item. Same `!` guard as {@link MENU_CHECK_GLYPH}. */\nexport const MENU_RADIO_GLYPH = \"ds:size-2! ds:fill-current!\";\n\n/** The ink of a keyboard shortcut hint at the end of an item. */\nexport const MENU_SHORTCUT_INK: Readonly<Record<MenuPalette, string>> = {\n menu: \"ds:text-menu-shortcut-fg\",\n neutral: \"ds:text-fg-4\",\n};\n\n/** The box and type treatment of a shortcut hint, around the component's label size. */\nexport const MENU_SHORTCUT_BOX = \"ds:ml-auto ds:font-mono\";\nexport const MENU_SHORTCUT_TYPE = \"ds:tracking-wider\";\n\n/**\n * The class string of a plain menu item: the collection's `menu` frame with\n * the menu label size, focus highlight, no selection row and glyph sizing.\n */\nexport function menuItemClasses(palette: MenuPalette): string {\n return listItemClasses({\n frame: \"menu\",\n labelSize: MENU_ITEM_LABEL_SIZE,\n palette,\n highlight: \"focus\",\n selected: \"none\",\n });\n}\n\n/**\n * The class string of a checkbox or radio item: the collection's\n * `menu-indicator` frame (leading well), no glyph sizing — the indicator is\n * sized by {@link MENU_CHECK_GLYPH} / {@link MENU_RADIO_GLYPH}.\n */\nexport function menuIndicatorItemClasses(palette: MenuPalette): string {\n return listItemClasses({\n frame: \"menu-indicator\",\n labelSize: MENU_ITEM_LABEL_SIZE,\n palette,\n highlight: \"focus\",\n selected: \"none\",\n glyph: false,\n });\n}\n\n/**\n * The class string of a sub-menu trigger: box, label size, interaction, ink,\n * motion, highlighted, open, disabled — the item order with the open row\n * after the highlighted one and no glyph sizing.\n */\nexport function menuSubTriggerClasses(palette: MenuPalette): string {\n const highlighted = LIST_ITEM_HIGHLIGHTED[palette].focus;\n if (highlighted === undefined) {\n throw new TypeError(\n `menu: no focus row for palette ${JSON.stringify(palette)}; write the literal in collection/item-recipe.ts`,\n );\n }\n return [\n MENU_SUB_TRIGGER_BOX,\n MENU_ITEM_LABEL_SIZE,\n LIST_ITEM_INTERACTION,\n LIST_ITEM_INK[palette],\n LIST_ITEM_MOTION,\n highlighted,\n MENU_SUB_TRIGGER_OPEN[palette],\n LIST_ITEM_DISABLED,\n ].join(\" \");\n}\n\n/**\n * The class string of a menu label (a group heading): the collection's\n * heading ink, box, the component's label size and type treatment. The size\n * stays the component's (`ds:text-[11px]` today), as in the collection, so the\n * arbitrary-values ratchet keeps attributing the pixel to the component that\n * renders it.\n */\nexport function menuLabelClasses(palette: MenuPalette, labelSize: string): string {\n return groupHeadingClasses({ palette, labelSize });\n}\n\n/** The class string of a menu separator: the collection's hairline in the palette. */\nexport function menuSeparatorClasses(palette: MenuPalette): string {\n return LIST_SEPARATOR[palette];\n}\n\n/** The class string of a shortcut hint: ink, box, the component's label size, type. */\nexport function menuShortcutClasses(palette: MenuPalette, labelSize: string): string {\n return [MENU_SHORTCUT_INK[palette], MENU_SHORTCUT_BOX, labelSize, MENU_SHORTCUT_TYPE].join(\" \");\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\n\nimport { dropdownMenuAnatomy, type DropdownMenuSlot } from \"../foundation/anatomy/slots\";\nimport { slot } from \"../foundation/anatomy/slot\";\nimport { cn } from \"../lib/cn\";\n\nimport { DROPDOWN_MENU_WIDTH, type MenuWidth } from \"./behavior/menu/content\";\nimport {\n MENU_CHECK_GLYPH,\n MENU_INDICATOR_WELL,\n MENU_INSET,\n MENU_ITEM_DANGER,\n MENU_RADIO_GLYPH,\n MENU_SUB_TRIGGER_CHEVRON,\n menuIndicatorItemClasses,\n menuItemClasses,\n menuLabelClasses,\n menuSeparatorClasses,\n menuShortcutClasses,\n menuSubTriggerClasses,\n} from \"./behavior/menu/item-recipe\";\nimport { CheckIcon, ChevronRightIcon, CircleIcon } from \"./icons\";\nimport { withPortalContainer } from \"./behavior/portal\";\nimport { presence } from \"./behavior/presence\";\n/* ───────────────────────────────────────────────────────────────────────\n * DropdownMenu — Radix UI dropdown-menu primitive. Modified\n *\n * Public API preserved:\n * DropdownMenu, DropdownMenuTrigger, DropdownMenuContent,\n * DropdownMenuItem (with `destructive` prop), DropdownMenuSeparator,\n * DropdownMenuLabel, DropdownMenuGroup\n *\n * NEW (additive, shadcn parity):\n * DropdownMenuPortal, DropdownMenuSub, DropdownMenuSubTrigger,\n * DropdownMenuSubContent, DropdownMenuCheckboxItem,\n * DropdownMenuRadioGroup, DropdownMenuRadioItem,\n * DropdownMenuShortcut\n *\n * W5-13: the items, labels, separators, shortcuts and sub-triggers read the\n * shared Menu internals (`behavior/menu/*`, on the W4-09 collection frames)\n * in the `menu` palette — ContextMenu reads the same tables in `neutral`\n * (W5-14). Class strings are byte-identical to the ones written here before.\n * `DropdownMenuContent` gains `width` (`auto` default, `trigger`, `sm`, `md`).\n * ─────────────────────────────────────────────────────────────────────── */\n\n/** The `menu.item.*` token family: DropdownMenu's palette in the shared Menu recipe. */\nconst PALETTE = \"menu\";\n\n/** The dropdown-menu parts (ADR-008). See the registry for the doc comment. */\nexport type { DropdownMenuSlot };\n\nconst DropdownMenu = DropdownMenuPrimitive.Root;\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group;\nconst DropdownMenuPortal = withPortalContainer(DropdownMenuPrimitive.Portal);\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub;\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n }\n>(({ className, inset, children, ...props }, ref) => (\n <DropdownMenuPrimitive.SubTrigger\n ref={ref}\n {...slot(dropdownMenuAnatomy, \"sub-trigger\")}\n className={cn(menuSubTriggerClasses(PALETTE), inset && MENU_INSET, className)}\n {...props}\n >\n {children}\n <ChevronRightIcon className={MENU_SUB_TRIGGER_CHEVRON} aria-hidden=\"true\" />\n </DropdownMenuPrimitive.SubTrigger>\n));\nDropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;\n\nconst DropdownMenuSubContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n // Portal the sub-content to the body. The parent Content is transformed\n // while its presence keyframes run, which makes it the containing block for\n // `position: fixed` descendants — and its `overflow-hidden` would then clip\n // this Popper-positioned flyout to nothing. Portaling escapes both.\n <DropdownMenuPortal>\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n {...slot(dropdownMenuAnatomy, \"sub-content\")}\n {...presence(\"floating\")}\n className={cn(\n \"ds:rounded-card ds:border-rule ds:bg-menu-bg ds:text-menu-fg ds:shadow-pop ds:z-[var(--z-dropdown)] ds:min-w-[8rem] ds:overflow-hidden ds:border ds:p-1\",\n className,\n )}\n {...props}\n />\n </DropdownMenuPortal>\n));\nDropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;\n\ninterface DropdownMenuContentProps extends React.ComponentPropsWithoutRef<\n typeof DropdownMenuPrimitive.Content\n> {\n /**\n * The width of the menu surface. `auto` (default) sizes to the items with\n * the 10rem minimum; `trigger` matches the element that opened the menu;\n * `sm` and `md` are fixed widths (12rem, 16rem). Replaces the `w-*` class\n * overrides most consumers write today.\n * @default \"auto\"\n */\n width?: MenuWidth;\n}\n\nconst DropdownMenuContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Content>,\n DropdownMenuContentProps\n>(({ className, sideOffset = 6, align = \"start\", width = \"auto\", ...props }, ref) => (\n <DropdownMenuPortal>\n <DropdownMenuPrimitive.Content\n ref={ref}\n {...slot(dropdownMenuAnatomy, \"content\")}\n {...presence(\"floating\")}\n sideOffset={sideOffset}\n align={align}\n className={cn(\n \"ds:rounded-card ds:border-rule ds:bg-menu-bg ds:text-menu-fg ds:shadow-pop ds:z-[var(--z-dropdown)] ds:min-w-[10rem] ds:overflow-hidden ds:border ds:p-1\",\n DROPDOWN_MENU_WIDTH[width],\n className,\n )}\n {...props}\n />\n </DropdownMenuPortal>\n));\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;\n\ninterface DropdownMenuItemProps extends React.ComponentPropsWithoutRef<\n typeof DropdownMenuPrimitive.Item\n> {\n /**\n * Render as a destructive (danger) action — the `intent=\"danger\"` look of\n * the shared Menu recipe (`menu.item.destructive.*` tokens).\n */\n destructive?: boolean;\n /** Increase left padding to align with checkbox/radio items. */\n inset?: boolean;\n}\n\n/**\n * A menu item. Activation fires both `onSelect` (canonical; call\n * `event.preventDefault()` on it to keep the menu open) and `onClick`\n * (tolerated): Radix composes `onClick` with its select handler and a\n * keyboard activation clicks the element.\n */\n\nconst DropdownMenuItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Item>,\n DropdownMenuItemProps\n>(({ className, destructive, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Item\n ref={ref}\n {...slot(dropdownMenuAnatomy, \"item\")}\n className={cn(\n menuItemClasses(PALETTE),\n inset && MENU_INSET,\n destructive && MENU_ITEM_DANGER[PALETTE],\n className,\n )}\n {...props}\n />\n));\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;\n\nconst DropdownMenuCheckboxItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>\n>(({ className, children, ...props }, ref) => (\n <DropdownMenuPrimitive.CheckboxItem\n ref={ref}\n {...slot(dropdownMenuAnatomy, \"checkbox-item\")}\n className={cn(menuIndicatorItemClasses(PALETTE), className)}\n {...props}\n >\n <span className={MENU_INDICATOR_WELL}>\n <DropdownMenuPrimitive.ItemIndicator {...slot(dropdownMenuAnatomy, \"item-indicator\")}>\n <CheckIcon className={MENU_CHECK_GLYPH} aria-hidden=\"true\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n));\nDropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;\n\nconst DropdownMenuRadioItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n <DropdownMenuPrimitive.RadioItem\n ref={ref}\n {...slot(dropdownMenuAnatomy, \"radio-item\")}\n className={cn(menuIndicatorItemClasses(PALETTE), className)}\n {...props}\n >\n <span className={MENU_INDICATOR_WELL}>\n <DropdownMenuPrimitive.ItemIndicator {...slot(dropdownMenuAnatomy, \"item-indicator\")}>\n <CircleIcon className={MENU_RADIO_GLYPH} aria-hidden=\"true\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n));\nDropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;\n\nconst DropdownMenuLabel = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Label\n ref={ref}\n {...slot(dropdownMenuAnatomy, \"label\")}\n className={cn(\n menuLabelClasses(PALETTE, \"ds:text-(length:--text-overline)\"),\n inset && MENU_INSET,\n className,\n )}\n {...props}\n />\n));\nDropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;\n\nconst DropdownMenuSeparator = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.Separator\n ref={ref}\n {...slot(dropdownMenuAnatomy, \"separator\")}\n className={cn(menuSeparatorClasses(PALETTE), className)}\n {...props}\n />\n));\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;\n\nconst DropdownMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => (\n <span\n {...slot(dropdownMenuAnatomy, \"shortcut\")}\n className={cn(menuShortcutClasses(PALETTE, \"ds:text-(length:--text-code)\"), className)}\n {...props}\n />\n);\nDropdownMenuShortcut.displayName = \"DropdownMenuShortcut\";\n\nexport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuGroup,\n DropdownMenuPortal,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuRadioGroup,\n};\n","import { forwardRef } from \"react\";\n\nimport { cn } from \"../lib/cn\";\nimport { FileTextIcon } from \"./icons\";\n\n/**\n * FileChip — compact attachment row: a colored file-type tile, the file\n * name, a \"size · when\" meta line, and an optional trailing action\n * (View / Download). Used in the AI receipt panel, document mini-lists,\n * and message attachments.\n *\n * The tile tone keys off `kind`: documents are danger-tinted (PDF red),\n * sheets success, images info, generic neutral — a quick visual file-type\n * cue without a bespoke icon per extension.\n */\n\nexport type FileKind = \"doc\" | \"sheet\" | \"image\" | \"generic\";\n\nconst kindTile: Record<FileKind, string> = {\n doc: \"ds:bg-danger-bg ds:text-danger-fg\",\n sheet: \"ds:bg-success-bg ds:text-success-fg\",\n image: \"ds:bg-accent-tint ds:text-accent\",\n generic: \"ds:bg-bg-3 ds:text-fg-3\",\n};\n\nexport interface FileChipProps extends React.HTMLAttributes<HTMLDivElement> {\n name: string;\n /** Right-side meta, e.g. \"240 KB · uploaded just now\". */\n meta?: React.ReactNode;\n kind?: FileKind;\n /** Custom glyph inside the tile; defaults to a document icon. */\n icon?: React.ReactNode;\n /** Trailing action node (a Button / link). */\n action?: React.ReactNode;\n}\n\nexport const FileChip = forwardRef<HTMLDivElement, FileChipProps>(function FileChip(\n { name, meta, kind = \"doc\", icon, action, className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n className={cn(\n \"ds:border-rule ds:bg-surface ds:flex ds:items-center ds:gap-3 ds:rounded-[var(--radius-input)] ds:border ds:p-2.5\",\n className,\n )}\n {...props}\n >\n <span\n aria-hidden=\"true\"\n className={cn(\n \"ds:flex ds:size-9 ds:shrink-0 ds:items-center ds:justify-center ds:rounded-[var(--radius-icon)] ds:[&_svg]:size-4.5\",\n kindTile[kind],\n )}\n >\n {icon ?? <FileTextIcon />}\n </span>\n <div className=\"ds:min-w-0 ds:flex-1\">\n <p className=\"ds:text-fg ds:truncate ds:text-sm ds:font-medium\">{name}</p>\n {meta != null && <p className=\"ds:text-fg-3 ds:truncate ds:text-xs\">{meta}</p>}\n </div>\n {action && <div className=\"ds:shrink-0\">{action}</div>}\n </div>\n );\n});\n\nFileChip.displayName = \"FileChip\";\n","\"use client\";\n\nimport { useCallback, useRef, useState } from \"react\";\n\nimport { slotClassName } from \"../foundation/anatomy/class-names\";\nimport { fileUploadAnatomy, type FileUploadSlot } from \"../foundation/anatomy/slots\";\nimport { slot, stateAttributes } from \"../foundation/anatomy/slot\";\nimport { mergeRefs } from \"../foundation/merge-refs\";\nimport type { FileUploadMessages } from \"../foundation/messages/types\";\nimport { useDsMessages } from \"../foundation/provider/context\";\nimport { cn } from \"../lib/cn\";\n\nimport { useFieldControl } from \"./field/use-field-control\";\nimport { UploadIcon } from \"./icons\";\n/* ───────────────────────────────────────────────────────────────────────\n * FileUpload — custom drag-drop + file picker.\n *\n * Public API preserved:\n * <FileUpload accept maxSize multiple onFilesSelected disabled className />\n *\n * Keyboard (A7 escalation E3, W4-24 a11y part): the file input is the\n * focusable control. It stays in the `<label>` dropzone (DOM frozen,\n * C-DOM-04), Enter and Space open the picker, and the dropzone shows the\n * focus ring while the input has keyboard focus. When a consumer makes the\n * wrapper itself the focus stop (passes `tabIndex` or `role`), the input\n * stays out of the tab order so the dropzone is not reached twice.\n *\n * Tokenized style:\n * - dashed `border-rule-strong` drop zone, rounded-card\n * - hover/drag-over uses suite accent (bg-brand-bg / border-brand-line / text-brand)\n * - catalog `UploadIcon`\n *\n * W4-24 (implementation plan §16.1; additive, the default DOM stays frozen —\n * C-DOM-04 — and the class strings of every legacy prop combination are\n * pinned in `__tests__/file-upload-classes.test.tsx`):\n * - **Owned file input**: `name` makes the component the form's file\n * control. `new FormData(form)` then holds the selected or dropped\n * `File` entries under `name` (dropped files are placed in the input\n * through a `DataTransfer`), files a validation rejects never reach it,\n * and `required` blocks the submission natively while it is empty.\n * Without `name` the input is cleared after each pick as before, so the\n * same file can be chosen twice.\n * - **`classNames`** per part (`dropzone`, `input`, `error`): what the\n * `[&_label]` selectors of PORTAL and TAX reach for today.\n * - **`variant`**: `default` (the stacked tile) or `compact` (one row:\n * icon, then the copy). Stamped as `data-variant` on the root only when\n * it is not the default, so the frozen default DOM does not change.\n * - **Field binding** through `useFieldControl`: inside a `Field` the file\n * input takes the field's id, `name`, `required`, `disabled` and the\n * description / error references; the dropzone label keeps naming it.\n * ─────────────────────────────────────────────────────────────────────── */\n\n/** The file-upload parts (ADR-008). See the registry for the doc comment. */\nexport type { FileUploadSlot };\n\n/**\n * The looks of the dropzone: `default` stacks the icon and the copy in a\n * padded tile; `compact` lays them out in one row for dialogs and dense\n * forms.\n *\n * @experimental\n */\nexport type FileUploadVariant = \"default\" | \"compact\";\n\n/**\n * The default dropzone copy: prop > `DesignSystemProvider messages.fileUpload`\n * > English (W5-20, ADR-010). `children` replaces the whole block.\n *\n * @experimental\n */\nexport type { FileUploadMessages };\n\n/**\n * Props of `FileUpload`.\n *\n * @experimental The W4-24 additions (`name`, `form`, `required`, `classNames`,\n * `variant`, `inputRef`) are experimental; the legacy props keep their contract.\n */\nexport interface FileUploadProps extends React.HTMLAttributes<HTMLDivElement> {\n accept?: string | undefined;\n maxSize?: number | undefined;\n multiple?: boolean | undefined;\n onFilesSelected?: ((files: File[]) => void) | undefined;\n disabled?: boolean | undefined;\n /**\n * The form field name. With it the owned `<input type=\"file\">` submits the\n * selected or dropped files; a surrounding `Field` can supply it.\n */\n name?: string | undefined;\n /** `id` of the form to submit with when the dropzone is rendered outside it. */\n form?: string | undefined;\n /** Block native submission while no file is selected. */\n required?: boolean | undefined;\n /** `default` (stacked tile) or `compact` (one row). */\n variant?: FileUploadVariant | undefined;\n /**\n * One class per part, keyed by `FileUploadSlot` (ADR-008). `className`\n * keeps landing on the root; `dropzone` is the `<label>` that\n * `[&_label]` selectors reach for today (C-DOM-04), `input` the file\n * input, `error` the message.\n */\n classNames?: Partial<Record<Exclude<FileUploadSlot, \"root\">, string>> | undefined;\n /** A ref to the owned file input. */\n inputRef?: React.Ref<HTMLInputElement> | undefined;\n /** Overrides for the default dropzone copy (W5-20). @experimental */\n messages?: Partial<FileUploadMessages> | undefined;\n}\n\nconst DROPZONE_LAYOUT: Record<FileUploadVariant, string> = {\n default: \"ds:flex ds:flex-col ds:items-center ds:justify-center ds:gap-2\",\n compact: \"ds:flex ds:flex-row ds:items-center ds:justify-start ds:gap-3\",\n};\n\nconst DROPZONE_SPACING: Record<FileUploadVariant, string> = {\n default: \"ds:font-body ds:p-8 ds:text-center\",\n compact: \"ds:font-body ds:p-3 ds:text-left\",\n};\n\n/** Put `files` into a file input, so a form submits them. */\nfunction assignFiles(input: HTMLInputElement, files: File[]) {\n try {\n const transfer = new DataTransfer();\n for (const file of files) transfer.items.add(file);\n input.files = transfer.files;\n } catch {\n // No DataTransfer constructor (older WebKit): nothing invalid may stay behind.\n input.value = \"\";\n }\n}\n\nexport function FileUpload({\n accept,\n maxSize,\n multiple,\n onFilesSelected,\n disabled,\n name,\n form,\n required,\n variant = \"default\",\n classNames,\n inputRef: inputRefProp,\n messages: messagesProp,\n className,\n children,\n ...props\n}: FileUploadProps) {\n const messages = useDsMessages(\"fileUpload\", messagesProp);\n const inputRef = useRef<HTMLInputElement>(null);\n const [isDragOver, setIsDragOver] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const wiring = useFieldControl({\n name,\n required,\n disabled,\n invalid: error ? true : undefined,\n \"aria-describedby\": props[\"aria-describedby\"],\n });\n const inputId = wiring.id;\n const isDisabled = wiring.disabled;\n // With a name the input is the form's file control and keeps its files;\n // without one it is cleared after each pick so the same file can be re-chosen.\n const ownsFiles = wiring.name !== undefined;\n // A consumer that made the wrapper focusable owns the keyboard stop.\n const wrapperOwnsFocus = props.tabIndex !== undefined || props.role !== undefined;\n\n const validateFiles = useCallback(\n (files: File[]): File[] => {\n setError(null);\n const acceptTypes = accept ? accept.split(\",\").map((t) => t.trim()) : null;\n\n const valid = files.filter((file) => {\n if (acceptTypes) {\n const ext = `.${file.name.split(\".\").pop()?.toLowerCase()}`;\n const matchesType = acceptTypes.some(\n (type) =>\n type === ext ||\n type === file.type ||\n (type.endsWith(\"/*\") && file.type.startsWith(type.replace(\"/*\", \"/\"))),\n );\n if (!matchesType) {\n setError(`File type not accepted: ${file.name}`);\n return false;\n }\n }\n if (maxSize && file.size > maxSize) {\n setError(`File too large: ${file.name} (max ${formatBytes(maxSize)})`);\n return false;\n }\n return true;\n });\n\n return valid;\n },\n [accept, maxSize],\n );\n\n function handleFiles(fileList: FileList, source: \"input\" | \"drop\") {\n const files = Array.from(fileList);\n const considered = multiple ? files : files.slice(0, 1);\n const valid = validateFiles(considered);\n const input = inputRef.current;\n if (input) {\n if (!ownsFiles) {\n // Reset value so the same file can be re-selected\n input.value = \"\";\n } else if (source === \"drop\" || valid.length !== files.length) {\n // Dropped files, or a selection with rejects: the input holds the\n // valid ones only, so nothing a validation refused is submitted.\n assignFiles(input, valid);\n }\n }\n if (valid.length > 0) onFilesSelected?.(valid);\n }\n\n function handleDrop(e: React.DragEvent) {\n e.preventDefault();\n setIsDragOver(false);\n if (isDisabled) return;\n handleFiles(e.dataTransfer.files, \"drop\");\n }\n\n // The catalogue's copy (English without a provider); `children` replaces it.\n const defaultCopy = (\n <>\n <div className=\"ds:text-fg-3 ds:text-sm\">\n <span className=\"ds:text-fg ds:font-medium\">{messages.prompt}</span>\n {messages.dragHint}\n </div>\n {accept && (\n <p className=\"ds:text-fg-4 ds:font-mono ds:text-(length:--text-code)\">\n {messages.accepted(accept)}\n </p>\n )}\n {maxSize && (\n <p className=\"ds:text-fg-4 ds:font-mono ds:text-(length:--text-code)\">\n {messages.maxSize(formatBytes(maxSize))}\n </p>\n )}\n </>\n );\n\n return (\n <div\n {...slot(fileUploadAnatomy, \"root\")}\n {...stateAttributes({\n disabled: isDisabled,\n invalid: !!error,\n // Only when it is not the default: the default DOM is frozen (C-DOM-04).\n variant: variant === \"default\" ? undefined : variant,\n })}\n className={cn(\"ds:w-full\", className)}\n {...props}\n >\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */}\n <label\n htmlFor={inputId}\n {...slot(fileUploadAnatomy, \"dropzone\")}\n {...stateAttributes({ disabled: isDisabled, state: isDragOver ? \"drag-over\" : undefined })}\n onDragOver={(e) => {\n e.preventDefault();\n if (!isDisabled) setIsDragOver(true);\n }}\n onDragLeave={() => setIsDragOver(false)}\n onDrop={handleDrop}\n className={cn(\n DROPZONE_LAYOUT[variant],\n \"ds:rounded-card ds:border-rule-strong ds:bg-surface ds:border ds:border-dashed\",\n DROPZONE_SPACING[variant],\n \"ds:transition-colors ds:duration-[var(--duration-fast)] ds:ease-[var(--ease-out-quart)]\",\n \"ds:motion-reduce:transition-none\",\n // Hover (when not disabled)\n !isDisabled && \"ds:hover:border-brand-line ds:hover:bg-brand-bg/40\",\n // Drag-over → Pro purple highlight\n isDragOver && \"ds:border-brand-line ds:bg-brand-bg\",\n isDisabled &&\n \"ds:border-rule ds:bg-bg-disabled ds:text-fg-disabled ds:cursor-not-allowed\",\n !isDisabled && \"ds:cursor-pointer\",\n // Keyboard focus lands on the (visually hidden) file input.\n \"ds:has-[input:focus-visible]:[box-shadow:var(--shadow-focus-ring)]\",\n slotClassName(classNames, \"dropzone\"),\n )}\n >\n <input\n ref={mergeRefs(inputRef, inputRefProp, wiring.ref)}\n id={inputId}\n name={wiring.name}\n form={form}\n type=\"file\"\n {...slot(fileUploadAnatomy, \"input\")}\n accept={accept}\n multiple={multiple}\n onChange={(e) => {\n if (e.target.files) handleFiles(e.target.files, \"input\");\n }}\n className={cn(\n \"ds:fixed ds:-top-[9999px] ds:-left-[9999px] ds:opacity-0\",\n slotClassName(classNames, \"input\"),\n )}\n onKeyDown={(e) => {\n if (e.key !== \"Enter\" && e.key !== \" \") return;\n // Browsers differ on which keys activate a file input; open the\n // picker once, for both keys, and suppress the native activation.\n e.preventDefault();\n e.currentTarget.click();\n }}\n disabled={isDisabled}\n required={wiring.required}\n aria-invalid={wiring[\"aria-invalid\"]}\n aria-describedby={wiring[\"aria-describedby\"]}\n tabIndex={wrapperOwnsFocus ? -1 : undefined}\n />\n {children ?? (\n <>\n <div\n className={cn(\n \"ds:rounded-icon ds:flex ds:size-10 ds:items-center ds:justify-center ds:transition-colors ds:duration-[var(--duration-fast)] ds:ease-[var(--ease-out-quart)] ds:motion-reduce:transition-none\",\n variant === \"compact\" && \"ds:shrink-0\",\n isDragOver ? \"ds:bg-brand ds:text-fg-on-brand\" : \"ds:bg-brand-bg ds:text-brand\",\n )}\n aria-hidden=\"true\"\n >\n <UploadIcon className=\"ds:size-5\" />\n </div>\n {variant === \"compact\" ? (\n <div className=\"ds:flex ds:min-w-0 ds:flex-col ds:gap-0.5\">{defaultCopy}</div>\n ) : (\n defaultCopy\n )}\n </>\n )}\n </label>\n {error && (\n <p\n role=\"alert\"\n {...slot(fileUploadAnatomy, \"error\")}\n className={cn(\"ds:text-danger-fg ds:mt-2 ds:text-sm\", slotClassName(classNames, \"error\"))}\n >\n {error}\n </p>\n )}\n </div>\n );\n}\n\nfunction formatBytes(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n}\n","import { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { microInteractions } from \"../../lib/micro-interactions\";\n\nimport { CONTROL_SIZE_CLASSES } from \"./control-size\";\n\n/**\n * L1a behaviour primitive (private). Not exported from the package.\n *\n * `controlChrome` — the one class recipe of every field-shaped control: the\n * box a text field, a textarea, a select trigger, a date field or a phone\n * field draws around its value (W4-03; target architecture §4 L1a, §16.1\n * \"Field renders no control chrome\"; current-state audit §8.4 counts the\n * copy seven times). Written once here so the border, the focus treatment,\n * the invalid treatment, the disabled treatment and the size rows of a field\n * cannot drift between components again.\n *\n * What the chrome is, in the order the string emits it:\n *\n * 1. **Box** — `flex w-full rounded-input border bg-surface font-body text-fg`.\n * 2. **Motion** — `microInteractions.control`: colour, background, border\n * and box-shadow transition on the feedback duration, none under\n * `prefers-reduced-motion`.\n * 3. **Placeholder** — `--color-fg-4`.\n * 4. **Focus (VN-5)** — no outline; the border takes `--focus-ring-border`\n * and the box draws the 3px `--shadow-focus-ring-field` halo. Fields move\n * their border on focus, so they get the field halo, not the action ring\n * (`--shadow-focus-ring`) buttons draw.\n * 5. **Disabled** — `not-allowed` cursor, `--color-bg-disabled` /\n * `--color-fg-disabled`.\n * 6. **Invalid** — read from `aria-invalid=\"true\"`, so the state the\n * assistive tree sees is the state the user sees: `--color-danger-line`\n * border at rest, `--color-danger-fg` border and a 2px `--color-danger-bg`\n * halo on focus.\n *\n * Two axes: `variant` (`default` draws the `--color-rule-strong` border;\n * `ghost` draws none and no background until focused) and `size`, the shared\n * control scale `xs · sm · md · lg · xl` (`CONTROL_SIZE_CLASSES`, W2-03/A1),\n * so a field that reads a row is the height, padding, label size and gap the\n * scale says and the density scope moves it.\n *\n * Adoption is by W4-03 for Input and by W4-06/07/08/18/19/23 for the other\n * six copies. Input keeps its legacy size rows (in `input.tsx`, D5-gated)\n * until W4-05, so today it composes the recipe's definitions rather than\n * reading a `size` row: `inputVariants` is\n * `cva([CONTROL_CHROME, …], { variant: CONTROL_CHROME_VARIANTS, inputSize })`,\n * which emits the bytes it emitted before this module existed\n * (`src/primitives/__tests__/input-chrome-classes.test.tsx`). A control that\n * has its own geometry passes `size: null` and appends its rows in `class`.\n *\n * No React, no client directive: plain functions of props to a string, so a\n * Server Component can call them once the root entry is server-safe (S3).\n */\n\n/**\n * The chrome itself, without a border colour or a size: the string every\n * variant of every field starts with. Exported so a component that must keep\n * a cva of its own (Input, until W4-05) builds it from the same definition.\n */\nexport const CONTROL_CHROME: string = [\n \"ds:flex ds:w-full ds:rounded-input ds:border ds:bg-surface ds:font-body ds:text-fg\",\n microInteractions.control,\n \"ds:placeholder:text-fg-4\",\n \"ds:focus-visible:outline-none ds:focus-visible:[border-color:var(--focus-ring-border)]\",\n \"ds:focus-visible:[box-shadow:var(--shadow-focus-ring-field)]\",\n \"ds:disabled:cursor-not-allowed ds:disabled:bg-bg-disabled ds:disabled:text-fg-disabled\",\n \"ds:aria-[invalid=true]:border-field-border-invalid ds:aria-[invalid=true]:focus-visible:border-danger-fg\",\n \"ds:aria-[invalid=true]:focus-visible:[box-shadow:0_0_0_2px_var(--color-danger-bg)]\",\n].join(\" \");\n\n/**\n * The emphases a field offers: `default` (a `--color-field-border` hairline)\n * and `ghost` (no border and no background until the field is focused — an\n * inline-edit look; the floating label of Input has no border to notch into\n * here).\n *\n * @experimental\n */\nexport type ControlChromeVariant = \"default\" | \"ghost\";\n\n/**\n * One class string per variant. `satisfies`, not an annotation: the table's\n * own literal keys are what cva infers, so `inputVariants`'s public type\n * keeps printing `\"ghost\" | \"default\"` and not this module's private alias\n * (api-extractor would otherwise report a forgotten export).\n */\nexport const CONTROL_CHROME_VARIANTS = {\n default: \"ds:border-field-border ds:not-disabled:hover:border-field-border-hover\",\n ghost: \"ds:border-transparent ds:bg-transparent ds:focus-visible:bg-surface\",\n} satisfies Readonly<Record<ControlChromeVariant, string>>;\n\n/**\n * The recipe: chrome + variant + size, in that order. The size rows are the\n * shared control scale (A1, ADR-013) — height, horizontal padding, label\n * size, gap and glyph size from `--control-*-<size>`, the same rows\n * IconButton and Chip read. `size: null` opts out of the axis for a control\n * that carries its own geometry (Input until W4-05; a multi-line Textarea\n * needs a `min-height` row); `size` omitted reads `md`.\n */\nexport const controlChrome = cva(CONTROL_CHROME, {\n variants: {\n variant: CONTROL_CHROME_VARIANTS,\n size: CONTROL_SIZE_CLASSES,\n },\n defaultVariants: {\n variant: \"default\",\n size: \"md\",\n },\n});\n\nexport type ControlChromeProps = VariantProps<typeof controlChrome>;\n","\"use client\";\n\nimport { forwardRef, useState, type ReactNode } from \"react\";\n\nimport { inputAnatomy, type InputSlot } from \"../foundation/anatomy/slots\";\nimport { slot, stateAttributes } from \"../foundation/anatomy/slot\";\nimport { deprecate } from \"../foundation/deprecate\";\nimport { joinIds, partId } from \"../foundation/id\";\nimport { useMergedRefs } from \"../foundation/merge-refs\";\nimport { useDsMessages } from \"../foundation/provider/context\";\nimport type { ControlSize } from \"../foundation/vocab\";\nimport { cn } from \"../lib/cn\";\n\nimport { controlChrome, CONTROL_CHROME_VARIANTS } from \"./behavior/control-chrome\";\nimport { useFieldContext } from \"./field/internal/field-context\";\nimport { useFieldControl } from \"./field/use-field-control\";\nimport { EyeIcon, EyeOffIcon } from \"./icons\";\n\n/** The input parts (ADR-008). See the registry for the doc comment. */\nexport type { InputSlot };\n\n/**\n * The native file-selector button, reset so a `type=\"file\"` Input reads as a\n * field and not as a browser-drawn button. Input-only: no other field renders\n * a file selector, so this is not part of the shared chrome.\n */\nconst INPUT_FILE_RESET =\n \"ds:file:border-0 ds:file:bg-transparent ds:file:text-sm ds:file:font-medium\";\n\n/**\n * The emphases an Input offers: the shared chrome's `default` (a\n * `--color-rule-strong` hairline) and `ghost` (no border and no background\n * until focused). Spelled out rather than aliased to the recipe's private\n * type so the public declaration names no unexported symbol; the\n * `satisfies` below keeps the two in step.\n *\n * @experimental\n */\nexport type InputVariant = \"default\" | \"ghost\";\n\nCONTROL_CHROME_VARIANTS satisfies Readonly<Record<InputVariant, string>>;\n\n/**\n * The 1.31 aliases of `sm` / `md` / `lg` (C-INPUT-SIZE). No known consumer\n * uses them; they leave with `inputSize` in 3.0.\n *\n * @deprecated Use `size=\"sm\"`, `\"md\"` or `\"lg\"`.\n * @experimental\n */\nexport type InputSizeAlias = \"compact\" | \"default\" | \"comfortable\";\n\n/**\n * The size names an Input knows (W4-05, ADR-013): the shared control scale\n * `xs · sm · md · lg · xl` (`ControlSize`) and the 1.31 aliases.\n *\n * `sm` and `md` are today's pixels *and* the scale's steps (32 / 36px), so\n * they read `--control-height-{sm,md}` and follow the density scope. `lg`\n * was the A1 mismatch recorded in `baselines/size-geometry.json` (44px where\n * the scale says 40) — resolved by decision D5 (W2-05): `lg` now reads\n * `--control-height-lg` (40px) like every other row, on both the `size` path\n * and the deprecated `inputSize` alias (same pixels, as the deprecation\n * message always promised). `xs` and `xl` read the shared rows in full.\n * Padding and text stay on Tailwind's steps.\n *\n * @experimental\n */\nexport type InputSize = ControlSize | InputSizeAlias;\n\n/** The steps that read the shared control-scale row in full (`controlChrome`'s `size` axis). */\ntype InputScaleSize = Extract<InputSize, \"xs\" | \"xl\">;\n\nconst isScaleRowSize = (size: InputSize): size is InputScaleSize => size === \"xs\" || size === \"xl\";\n\n/**\n * The `size` rows of the compat steps: today's pixels with the height read\n * from a token. `lg` reads the shared `--control-height-lg` since D5\n * (was the standalone `--input-height-lg` compat token); text from the scale\n * where the value agrees.\n */\nconst INPUT_SIZE_ROWS: Readonly<Record<Exclude<InputSize, InputScaleSize>, string>> = {\n sm: \"ds:h-(--control-height-sm) ds:px-2.5 ds:py-1 ds:text-xs\",\n md: \"ds:h-(--control-height-md) ds:px-3 ds:py-2 ds:text-(length:--control-font-size-md)\",\n lg: \"ds:h-(--control-height-lg) ds:px-3.5 ds:py-2.5 ds:text-sm\",\n compact: \"ds:h-(--control-height-sm) ds:px-2.5 ds:py-1 ds:text-(length:--control-font-size-md)\",\n default: \"ds:h-(--control-height-lg) ds:px-3 ds:py-2 ds:text-sm\",\n comfortable: \"ds:h-(--control-height-xl) ds:px-3.5 ds:py-2.5 ds:text-base\",\n};\n\n/**\n * What {@link inputVariants} takes: the emphasis, the size (either name — the\n * new `size` wins when both are given) and cva's class props.\n *\n * @experimental\n */\nexport interface InputVariantsOptions {\n variant?: InputVariant | null | undefined;\n size?: InputSize | null | undefined;\n /**\n * The legacy size prop (C-INPUT-SIZE): today's rows, byte for byte, so a\n * call that has not moved to `size` renders the classes it always did.\n *\n * @deprecated Use `size`. Codemod CM-07 renames it.\n */\n inputSize?: InputSize | null;\n class?: string | null;\n className?: string | null;\n}\n\n/** The variant props of `inputVariants` (cva's `VariantProps` shape, kept for the API report). */\nexport type InputVariants = Omit<InputVariantsOptions, \"class\" | \"className\">;\n\n/**\n * The Input class recipe (W4-05): the shared control chrome\n * (`behavior/control-chrome.ts` — border, VN-5 focus edge + field halo,\n * `aria-invalid`, `disabled`, `ghost`) called with the emphasis and, for the\n * scale steps `xs` / `xl`, the shared size row; then the file-selector reset\n * and, for the compat sizes, Input's own row (see {@link InputSize}).\n *\n * Emits the same *set* of classes as the cva it replaces for every legacy\n * `variant` × `inputSize` (`src/primitives/__tests__/input-chrome-classes.test.tsx`\n * pins the set and the browser test pins the pixels); only the position of\n * the file reset moved, which Tailwind does not read. Server-safe.\n *\n * @experimental\n */\nexport function inputVariants({\n variant,\n size,\n inputSize,\n class: classProp,\n className,\n}: InputVariantsOptions = {}): string {\n // Kept inside the recipe on purpose: the arbitrary-value ratchet files the\n // two `text-[13px]` rows of the legacy table under `inputVariants`.\n const LEGACY_ROWS: Readonly<Record<Exclude<InputSize, InputScaleSize>, string>> = {\n // The `inputSize` rows: today's classes, byte for byte (W2-03 compat).\n // `lg` moved with `size`'s row at D5 (h-11→h-10, 44px→40px) — the\n // deprecation message promises \"same pixels\" as `size`, so the two paths\n // must never disagree.\n sm: \"ds:h-8 ds:px-2.5 ds:py-1 ds:text-xs\",\n md: \"ds:h-9 ds:px-3 ds:py-2 ds:text-[13px]\",\n lg: \"ds:h-10 ds:px-3.5 ds:py-2.5 ds:text-sm\",\n compact: \"ds:h-8 ds:px-2.5 ds:py-1 ds:text-[13px]\",\n default: \"ds:h-10 ds:px-3 ds:py-2 ds:text-sm\",\n comfortable: \"ds:h-12 ds:px-3.5 ds:py-2.5 ds:text-base\",\n };\n const resolved: InputSize = size ?? inputSize ?? \"md\";\n // `xs` / `xl` have no compat row: they always read the scale.\n const scale = isScaleRowSize(resolved);\n const row = scale ? null : size ? INPUT_SIZE_ROWS[resolved] : LEGACY_ROWS[resolved];\n return controlChrome({\n variant,\n size: scale ? resolved : null,\n class: cn(INPUT_FILE_RESET, row, classProp, className) || undefined,\n });\n}\n\n/**\n * Resting size of the floating label, matched to the input's own text size so\n * that an empty field reads as a placeholder rather than a shrunken label.\n */\nconst floatingLabelSize: Record<InputSize, string> = {\n sm: \"ds:text-xs\",\n md: \"ds:text-(length:--control-font-size-md)\",\n lg: \"ds:text-sm\",\n compact: \"ds:text-(length:--control-font-size-md)\",\n default: \"ds:text-sm\",\n comfortable: \"ds:text-base\",\n xs: \"ds:text-(length:--control-font-size-xs)\",\n xl: \"ds:text-(length:--control-font-size-xl)\",\n};\n\n/**\n * Props of `Input` (W4-05; target architecture §24.3, §29.1).\n *\n * @experimental The name is exported since W4-05; the props it lists have been\n * stable since 1.x.\n */\nexport interface InputProps\n extends Omit<React.InputHTMLAttributes<HTMLInputElement>, \"size\">, InputVariants {\n /**\n * Sugar for the field label: renders the label above the control, bound\n * through the field wiring (`htmlFor`/`id`), exactly as\n * `<Field><Label>…</Label><Input/></Field>` binds it.\n */\n label?: string | undefined;\n /**\n * Render `label` inside the field instead of stacked above it: it rests like\n * a placeholder while the field is empty and unfocused, then rises onto the\n * top border at a smaller size. Requires `label`, and is intended for the\n * `default` variant — `ghost` has no border for the label to notch into.\n *\n * Any `placeholder` stays hidden until focus, so a format hint\n * (\"e.g. 555-0100\") can still sit behind the label without competing with it.\n */\n floatingLabel?: boolean;\n /**\n * Sugar for the hint text under the control, referenced first in the\n * control's `aria-describedby` (before `error`).\n */\n description?: string;\n /**\n * Sugar for the error message: renders it under the control, linked through\n * `aria-describedby`, and marks the control invalid.\n */\n error?: string;\n /**\n * The value is invalid without a message to show: `aria-invalid`,\n * `data-invalid` and the chrome's invalid treatment. Implied by `error`.\n */\n invalid?: boolean;\n prefixIcon?: ReactNode;\n suffixIcon?: ReactNode;\n /**\n * Called with the new string value on every change, next to `onChange`\n * (which keeps receiving the event).\n */\n onValueChange?: (value: string) => void;\n /**\n * Classes per anatomy part (the `input-*` slots). The `<input>` is\n * the root part and takes `className` (C-INPUT-CLASSNAME), so it has no\n * entry here.\n */\n classNames?: Partial<Record<Exclude<InputSlot, \"root\">, string>>;\n /**\n * Classes for the outer wrapper around the control and its parts.\n * Transitional (C-INPUT-CLASSNAME): `className` keeps landing on the\n * `<input>` because 192 consumer overrides depend on it; this is the name\n * for the wrapper until `className` moves there in 3.0.\n */\n rootClassName?: string;\n}\n\n/**\n * A single-line text field (target architecture §24, §29). The control is a\n * native `<input>` and takes part in a form on its own. Inside a `Field` it\n * binds itself through `useFieldControl` — id, name, `aria-describedby`,\n * invalid / required / disabled come from the field; explicit props win. The\n * `label` / `description` / `error` sugar renders the same wiring around the\n * control for the call sites that never adopt the compound form.\n */\nexport const Input = forwardRef<HTMLInputElement, InputProps>(function Input(\n {\n label,\n floatingLabel,\n description,\n error,\n invalid,\n prefixIcon,\n suffixIcon,\n variant,\n size,\n inputSize,\n type = \"text\",\n className,\n classNames,\n rootClassName,\n id: providedId,\n name,\n required,\n disabled,\n readOnly,\n placeholder,\n onChange,\n onValueChange,\n onWheel,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-labelledby\": ariaLabelledBy,\n ...props\n },\n ref,\n) {\n if (inputSize) {\n deprecate(\n \"C-INPUT-SIZE\",\n `Input inputSize=${inputSize}`,\n `<Input inputSize=\"${inputSize}\"> is deprecated. Pass size=\"${inputSize}\" (same pixels); codemod CM-07 renames it. Removed in 3.0.`,\n );\n }\n const field = useFieldContext();\n // The sugar parts are named from the control's id. The ids are only known\n // after `useFieldControl` resolves them, so the references are joined on\n // the id it returns; the explicit `aria-describedby` keeps the sugar and\n // the caller's ids in the markup from the first (server) render. `error`\n // implies invalid; otherwise the explicit prop decides, or the field.\n const wiring = useFieldControl({\n id: providedId,\n name,\n invalid: error ? true : invalid,\n required,\n disabled,\n readOnly,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n });\n const { ref: wiringRef, \"aria-describedby\": wiredDescribedBy, ...control } = wiring;\n const id = control.id;\n const isInvalid = control[\"aria-invalid\"] === true;\n const descriptionId = partId(id, \"description\");\n const errorId = partId(id, \"error\");\n // Description first, then error, then whatever the field or the caller\n // referenced (target architecture §24.4). `joinIds` drops duplicates.\n const describedBy = joinIds(description && descriptionId, error && errorId, wiredDescribedBy);\n const inputRef = useMergedRefs(ref, wiringRef);\n\n const messages = useDsMessages(\"input\");\n const [showPassword, setShowPassword] = useState(false);\n const isPassword = type === \"password\";\n const inputType = isPassword && showPassword ? \"text\" : type;\n const isFloating = !!floatingLabel && !!label;\n // An explicit prop wins over the field; `inputSize` renders its legacy row,\n // every other route reads the `size` rows.\n const fieldSize = field?.size as InputSize | undefined;\n const recipe: InputVariantsOptions = size\n ? { variant, size }\n : inputSize\n ? { variant, inputSize }\n : fieldSize\n ? { variant, size: fieldSize }\n : { variant, inputSize: \"md\" };\n const resolvedSize: InputSize = size ?? inputSize ?? fieldSize ?? \"md\";\n\n // The rest/float switch is pure CSS off `:placeholder-shown`, which needs a\n // non-empty placeholder to latch onto. Tracking the value in React instead\n // would miss uncontrolled inputs that start populated via `defaultValue`.\n const resolvedPlaceholder = isFloating ? (placeholder ?? \" \") : placeholder;\n\n // A focused number input treats a mouse wheel as \"step the value\", so\n // scrolling a form past a box just typed in silently rewrites it (80 becomes\n // 79.99, a fee gains a cent). Dropping focus hands the wheel back to the\n // page and leaves the typed value alone. A caller's own `onWheel` runs\n // first and may `preventDefault()` to keep focus.\n const handleWheel =\n inputType === \"number\"\n ? (event: React.WheelEvent<HTMLInputElement>) => {\n onWheel?.(event);\n if (!event.defaultPrevented) event.currentTarget.blur();\n }\n : onWheel;\n\n const handleChange = onValueChange\n ? (event: React.ChangeEvent<HTMLInputElement>) => {\n onChange?.(event);\n onValueChange(event.target.value);\n }\n : onChange;\n\n return (\n <div className={cn(\"ds:w-full\", rootClassName)}>\n {label && !isFloating && (\n <label\n htmlFor={id}\n id={partId(id, \"label\")}\n {...slot(inputAnatomy, \"label\")}\n className={cn(\n \"ds:text-fg ds:mb-1.5 ds:block ds:text-(length:--control-font-size-md) ds:leading-none ds:font-medium\",\n classNames?.label,\n )}\n >\n {label}\n </label>\n )}\n <div className=\"ds:relative\">\n {prefixIcon && (\n <span\n {...slot(inputAnatomy, \"icon-start\")}\n className={cn(\n \"ds:text-fg-4 ds:pointer-events-none ds:absolute ds:top-1/2 ds:left-3 ds:-translate-y-1/2 ds:[&>svg]:size-4\",\n classNames?.[\"icon-start\"],\n )}\n aria-hidden=\"true\"\n >\n {prefixIcon}\n </span>\n )}\n <input\n ref={inputRef}\n type={inputType}\n placeholder={resolvedPlaceholder}\n {...control}\n aria-describedby={describedBy}\n {...slot(inputAnatomy, \"root\")}\n {...stateAttributes({\n variant: variant ?? \"default\",\n size: resolvedSize,\n disabled: control.disabled,\n invalid: isInvalid,\n })}\n className={cn(\n inputVariants(recipe),\n prefixIcon && \"ds:pl-9\",\n (suffixIcon || isPassword) && \"ds:pr-9\",\n isFloating && \"ds:peer ds:focus:placeholder:text-fg-4 ds:placeholder:text-transparent\",\n className,\n )}\n onWheel={handleWheel}\n onChange={handleChange}\n {...props}\n />\n {isFloating && (\n // Rendered after the input because `peer-*` compiles to a sibling\n // combinator; absolute positioning keeps the visual order intact.\n <label\n htmlFor={id}\n id={partId(id, \"label\")}\n {...slot(inputAnatomy, \"label\")}\n className={cn(\n \"ds:pointer-events-none ds:absolute ds:left-3 ds:origin-left ds:px-1 ds:leading-none\",\n \"ds:bg-surface ds:text-fg-4\",\n \"ds:top-1/2 ds:-translate-y-1/2\",\n \"ds:transition-[top,transform,color] ds:duration-[var(--duration-fast)] ds:ease-[var(--ease-out-quart)]\",\n \"ds:motion-reduce:transition-none\",\n // Floated by focus or by content. Both branches declare the same\n // values, so their relative order in the emitted CSS is moot.\n \"ds:peer-focus:top-0 ds:peer-focus:scale-[0.85]\",\n \"ds:peer-[:not(:placeholder-shown)]:top-0 ds:peer-[:not(:placeholder-shown)]:scale-[0.85]\",\n // Colours are split on `:not(:focus)` so the two rules can never\n // both match, which would otherwise be an ordering coin flip.\n \"ds:peer-focus:text-brand\",\n \"ds:peer-[:not(:placeholder-shown):not(:focus)]:text-fg-3\",\n floatingLabelSize[resolvedSize],\n prefixIcon && \"ds:left-9\",\n classNames?.label,\n )}\n >\n {label}\n </label>\n )}\n {isPassword && (\n <button\n type=\"button\"\n onClick={() => setShowPassword((prev) => !prev)}\n {...slot(inputAnatomy, \"password-toggle\")}\n className={cn(\n \"ds:text-fg-4 ds:hover:text-fg ds:absolute ds:top-1/2 ds:right-1 ds:-translate-y-1/2 ds:inline-flex ds:size-7 ds:items-center ds:justify-center ds:rounded-control ds:transition-colors ds:duration-[var(--duration-fast)] ds:ease-[var(--ease-out-quart)] ds:focus-visible:[box-shadow:var(--shadow-focus-ring)] ds:focus-visible:outline-none ds:motion-reduce:transition-none\",\n classNames?.[\"password-toggle\"],\n )}\n aria-label={showPassword ? messages.hidePassword : messages.showPassword}\n >\n {showPassword ? (\n <EyeOffIcon className=\"ds:size-4\" aria-hidden=\"true\" />\n ) : (\n <EyeIcon className=\"ds:size-4\" aria-hidden=\"true\" />\n )}\n </button>\n )}\n {suffixIcon && !isPassword && (\n <span\n {...slot(inputAnatomy, \"icon-end\")}\n className={cn(\n \"ds:text-fg-4 ds:pointer-events-none ds:absolute ds:top-1/2 ds:right-3 ds:-translate-y-1/2 ds:[&>svg]:size-4\",\n classNames?.[\"icon-end\"],\n )}\n aria-hidden=\"true\"\n >\n {suffixIcon}\n </span>\n )}\n </div>\n {description && (\n <p\n id={descriptionId}\n {...slot(inputAnatomy, \"description\")}\n className={cn(\"ds:text-fg-3 ds:mt-1.5 ds:text-xs\", classNames?.description)}\n >\n {description}\n </p>\n )}\n {error && (\n <p\n id={errorId}\n role=\"alert\"\n {...slot(inputAnatomy, \"error\")}\n className={cn(\"ds:text-danger-fg ds:mt-1.5 ds:text-xs\", classNames?.error)}\n >\n {error}\n </p>\n )}\n </div>\n );\n});\n\nInput.displayName = \"Input\";\n","import { useEffect, useRef, type RefObject } from \"react\";\n\n/**\n * L1a behaviour primitive (private). Not exported from the package.\n *\n * `useFormReset` — call `onReset` when the form a control belongs to is reset\n * (W4-14/W4-15/W4-16, ADR-006 §3). `form.reset()`, `<button type=\"reset\">`\n * and React 19's automatic reset after a `<form action>` all dispatch `reset`\n * on the form; the browser then restores the *native* fields, which for a\n * Radix control is the hidden input it renders — not the Radix state the\n * visible control shows. Radix Checkbox listens to `reset` itself; Switch,\n * RadioGroup and Slider do not, so the wrapper restores its own state here.\n * `FormBridge` has the same listener for the controls it serialises.\n *\n * The form is the one the element sits in (`closest(\"form\")`), or the one\n * `form={id}` names when the control is portalled out of it. Nothing happens\n * without a form. The callback is read at event time, so it may change\n * between renders without re-subscribing.\n */\nexport function useFormReset(\n elementRef: RefObject<HTMLElement | null>,\n onReset: (() => void) | undefined,\n form?: string | undefined,\n): void {\n const latest = useRef(onReset);\n latest.current = onReset;\n useEffect(() => {\n const element = elementRef.current;\n if (!element) return;\n const owner = form\n ? (element.ownerDocument.getElementById(form) as HTMLFormElement | null)\n : element.closest(\"form\");\n if (!owner) return;\n const handle = () => latest.current?.();\n owner.addEventListener(\"reset\", handle);\n return () => owner.removeEventListener(\"reset\", handle);\n }, [elementRef, form]);\n}\n","\"use client\";\n\nimport { forwardRef, useCallback, useEffect, useRef, useState } from \"react\";\n\nimport { textareaAnatomy, type TextareaSlot } from \"../foundation/anatomy/slots\";\nimport { slot, stateAttributes } from \"../foundation/anatomy/slot\";\nimport { deprecate } from \"../foundation/deprecate\";\nimport { joinIds, partId } from \"../foundation/id\";\nimport { useMergedRefs } from \"../foundation/merge-refs\";\nimport type { ControlSize } from \"../foundation/vocab\";\nimport { cn } from \"../lib/cn\";\n\nimport { controlChrome, CONTROL_CHROME_VARIANTS } from \"./behavior/control-chrome\";\nimport { useFormReset } from \"./behavior/form-reset\";\nimport { useFieldContext } from \"./field/internal/field-context\";\nimport { useFieldControl } from \"./field/use-field-control\";\n\n/** The textarea parts (ADR-008). See the registry for the doc comment. */\nexport type { TextareaSlot };\n\n/**\n * The emphases a Textarea offers: the shared chrome's `default` and `ghost`\n * (spelled out, as on Input, so the public declaration names no unexported\n * symbol; the `satisfies` keeps it in step with the recipe).\n *\n * @experimental\n */\nexport type TextareaVariant = \"default\" | \"ghost\";\n\nCONTROL_CHROME_VARIANTS satisfies Readonly<Record<TextareaVariant, string>>;\n\n/**\n * The size names a Textarea knows (W4-06): the three steps that have a\n * `--textarea-min-height-<size>` token (64 / 80 / 96px). A textarea grows\n * with its content, so `size` is a *minimum* height, not the outer height\n * the shared scale promises (`baselines/size-geometry.json` keeps Textarea\n * out of A1 on purpose). Padding and text stay on today's steps until D5.\n *\n * @experimental\n */\nexport type TextareaSize = Extract<ControlSize, \"sm\" | \"md\" | \"lg\">;\n\n/**\n * What {@link textareaVariants} takes: the emphasis, the size (either name —\n * `size` wins when both are given) and cva's class props.\n *\n * @experimental\n */\nexport interface TextareaVariantsOptions {\n variant?: TextareaVariant | null | undefined;\n size?: TextareaSize | null | undefined;\n /**\n * The legacy size prop (C-INPUT-SIZE): today's rows, byte for byte.\n *\n * @deprecated Use `size`. Codemod CM-07 renames it.\n */\n inputSize?: TextareaSize | null;\n class?: string | null;\n className?: string | null;\n}\n\n/** The variant props of `textareaVariants` (cva's `VariantProps` shape, kept for the API report). */\nexport type TextareaVariants = Omit<TextareaVariantsOptions, \"class\" | \"className\">;\n\n/**\n * The `size` rows: today's pixels with the minimum height read from the\n * Textarea token and the 13px text from the scale where the value agrees.\n */\nconst TEXTAREA_SIZE_ROWS: Readonly<Record<TextareaSize, string>> = {\n sm: \"ds:min-h-(--textarea-min-height-sm) ds:px-2.5 ds:py-1.5 ds:text-xs\",\n md: \"ds:min-h-(--textarea-min-height-md) ds:px-3 ds:py-2 ds:text-(length:--control-font-size-md)\",\n lg: \"ds:min-h-(--textarea-min-height-lg) ds:px-3.5 ds:py-2.5 ds:text-sm\",\n};\n\n/**\n * The Textarea class recipe (W4-06): the shared control chrome\n * (`behavior/control-chrome.ts`) with the emphasis and no height row, then\n * the `min-height` row of the size.\n *\n * Against the cva it replaces the set of classes differs in one place, on\n * purpose (W4-03 mapping, PR #199): the motion string is the shared\n * `microInteractions.control` — same transitioned properties, the feedback\n * duration token (the same 150ms `--duration-fast` was) and the `enter`\n * easing where the copy declared none. `tests/browser/textarea-parity.test.tsx`\n * holds every other computed property equal under each host fixture.\n * Server-safe.\n *\n * @experimental\n */\nexport function textareaVariants({\n variant,\n size,\n inputSize,\n class: classProp,\n className,\n}: TextareaVariantsOptions = {}): string {\n // Kept inside the recipe on purpose: the arbitrary-value ratchet files the\n // `text-[13px]` row of the legacy table under `textareaVariants`.\n const LEGACY_ROWS: Readonly<Record<TextareaSize, string>> = {\n sm: \"ds:min-h-16 ds:px-2.5 ds:py-1.5 ds:text-xs\",\n md: \"ds:min-h-20 ds:px-3 ds:py-2 ds:text-[13px]\",\n lg: \"ds:min-h-24 ds:px-3.5 ds:py-2.5 ds:text-sm\",\n };\n const row = size ? TEXTAREA_SIZE_ROWS[size] : LEGACY_ROWS[inputSize ?? \"md\"];\n return controlChrome({\n variant,\n size: null,\n class: cn(row, classProp, className) || undefined,\n });\n}\n\n/**\n * Props of `Textarea` (W4-06).\n *\n * @experimental The name is exported since W4-06; the props it lists have been\n * stable since 1.x.\n */\nexport interface TextareaProps\n extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, \"size\">, TextareaVariants {\n /** Sugar for the field label, bound through the field wiring (`htmlFor`/`id`). */\n label?: string;\n /** Sugar for the hint text under the control, referenced before `error` in `aria-describedby`. */\n description?: string;\n /** Sugar for the error message: linked through `aria-describedby`, marks the control invalid. */\n error?: string;\n /** The value is invalid without a message to show. Implied by `error`. */\n invalid?: boolean;\n /** Show `<length>/<maxLength>` under the control. Needs `maxLength`. */\n showCount?: boolean;\n /** Grow with the content instead of scrolling. */\n autoResize?: boolean;\n /** Called with the new string value on every change, next to `onChange`. */\n onValueChange?: (value: string) => void;\n /**\n * Classes per anatomy part (the `textarea-*` slots). The `<textarea>`\n * is the root part and takes `className` (C-INPUT-CLASSNAME), so it has no\n * entry here.\n */\n classNames?: Partial<Record<Exclude<TextareaSlot, \"root\">, string>>;\n /** Classes for the outer wrapper (transitional, C-INPUT-CLASSNAME — see `Input`). */\n rootClassName?: string;\n}\n\n/**\n * A multi-line text field. The control is a native `<textarea>`; inside a\n * `Field` it binds itself through `useFieldControl`, and the\n * `label` / `description` / `error` sugar renders the same wiring around it.\n */\nexport const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(function Textarea(\n {\n label,\n description,\n error,\n invalid,\n showCount,\n autoResize,\n variant,\n size,\n inputSize,\n maxLength,\n value,\n defaultValue,\n className,\n classNames,\n rootClassName,\n id: providedId,\n name,\n required,\n disabled,\n readOnly,\n onChange,\n onValueChange,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-labelledby\": ariaLabelledBy,\n ...props\n },\n ref,\n) {\n if (inputSize) {\n deprecate(\n \"C-INPUT-SIZE\",\n `Textarea inputSize=${inputSize}`,\n `<Textarea inputSize=\"${inputSize}\"> is deprecated. Pass size=\"${inputSize}\" (same pixels); codemod CM-07 renames it. Removed in 3.0.`,\n );\n }\n const field = useFieldContext();\n // `error` implies invalid; otherwise the explicit prop, or the field's.\n const wiring = useFieldControl({\n id: providedId,\n name,\n invalid: error ? true : invalid,\n required,\n disabled,\n readOnly,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n });\n const { ref: wiringRef, \"aria-describedby\": wiredDescribedBy, ...control } = wiring;\n const id = control.id;\n const isInvalid = control[\"aria-invalid\"] === true;\n const descriptionId = partId(id, \"description\");\n const errorId = partId(id, \"error\");\n const describedBy = joinIds(description && descriptionId, error && errorId, wiredDescribedBy);\n\n const internalRef = useRef<HTMLTextAreaElement | null>(null);\n const setRefs = useMergedRefs<HTMLTextAreaElement>(ref, wiringRef, internalRef);\n\n const adjustHeight = useCallback(() => {\n if (!autoResize || !internalRef.current) return;\n const el = internalRef.current;\n el.style.height = \"auto\";\n el.style.height = `${el.scrollHeight}px`;\n }, [autoResize]);\n\n useEffect(() => {\n adjustHeight();\n }, [value, adjustHeight]);\n\n const fieldSize = field?.size as TextareaSize | undefined;\n const recipe: TextareaVariantsOptions = size\n ? { variant, size }\n : inputSize\n ? { variant, inputSize }\n : fieldSize && fieldSize in TEXTAREA_SIZE_ROWS\n ? { variant, size: fieldSize }\n : { variant, inputSize: \"md\" };\n const resolvedSize: TextareaSize = recipe.size ?? recipe.inputSize ?? \"md\";\n\n // Uncontrolled, the count follows what is typed: it used to read\n // `defaultValue` on every render, so it never moved. A form reset puts it\n // back with the text.\n const [uncontrolledLength, setUncontrolledLength] = useState(() =>\n typeof defaultValue === \"string\" ? defaultValue.length : 0,\n );\n useFormReset(\n internalRef,\n () => setUncontrolledLength(internalRef.current?.defaultValue.length ?? 0),\n props.form,\n );\n const currentLength = typeof value === \"string\" ? value.length : uncontrolledLength;\n\n return (\n <div className={cn(\"ds:w-full\", rootClassName)}>\n {label && (\n <label\n htmlFor={id}\n id={partId(id, \"label\")}\n {...slot(textareaAnatomy, \"label\")}\n className={cn(\n \"ds:text-fg ds:mb-1.5 ds:block ds:text-(length:--control-font-size-md) ds:leading-none ds:font-medium\",\n classNames?.label,\n )}\n >\n {label}\n </label>\n )}\n <textarea\n ref={setRefs}\n value={value}\n defaultValue={defaultValue}\n maxLength={maxLength}\n {...control}\n aria-describedby={describedBy}\n {...slot(textareaAnatomy, \"root\")}\n {...stateAttributes({\n variant: variant ?? \"default\",\n size: resolvedSize,\n disabled: control.disabled,\n invalid: isInvalid,\n })}\n onChange={(e) => {\n if (value === undefined) setUncontrolledLength(e.target.value.length);\n onChange?.(e);\n onValueChange?.(e.target.value);\n adjustHeight();\n }}\n className={cn(\n textareaVariants(recipe),\n autoResize && \"ds:resize-none ds:overflow-hidden\",\n className,\n )}\n {...props}\n />\n {description && (\n <p\n id={descriptionId}\n {...slot(textareaAnatomy, \"description\")}\n className={cn(\"ds:text-fg-3 ds:mt-1.5 ds:text-xs\", classNames?.description)}\n >\n {description}\n </p>\n )}\n {(error || (showCount && maxLength)) && (\n <div className=\"ds:mt-1.5 ds:flex ds:items-center ds:justify-between ds:gap-2\">\n {error ? (\n <p\n id={errorId}\n role=\"alert\"\n {...slot(textareaAnatomy, \"error\")}\n className={cn(\"ds:text-danger-fg ds:text-xs\", classNames?.error)}\n >\n {error}\n </p>\n ) : (\n <span />\n )}\n {showCount && maxLength && (\n <span\n {...slot(textareaAnatomy, \"count\")}\n className={cn(\n \"ds:text-fg-4 ds:ml-auto ds:font-mono ds:text-(length:--text-caption)\",\n classNames?.count,\n )}\n >\n {currentLength}/{maxLength}\n </span>\n )}\n </div>\n )}\n </div>\n );\n});\n\nTextarea.displayName = \"Textarea\";\n","\"use client\";\n\nimport { forwardRef } from \"react\";\n\nimport { cn } from \"../../lib/cn\";\nimport { Avatar } from \"../../primitives/avatar\";\nimport { AlertTriangleIcon, CheckIcon, FileTextIcon, XIcon } from \"../../primitives/icons\";\n\n/**\n * DocumentDetailPanel — the right-hand inspector for a document request\n * (the \"FY2025 PBC — Receivables & Fixed Assets\" panel). Presentational\n * compound: the app owns data, tab state, and every action handler;\n * compose only the rows a surface needs.\n *\n * <DocumentDetailPanel>\n * <DocumentDetailHeader\n * status={<Badge variant=\"success\">Provided</Badge>}\n * tags={<>…</>}\n * onClose={close}\n * >\n * <DocumentDetailTitle>FY2025 PBC — Receivables & Fixed Assets</DocumentDetailTitle>\n * <DocumentDetailRequester\n * org=\"Acme Manufacturing LLC\" avatar=\"AM\"\n * requestedBy=\"Maya Auditor\" time=\"5d ago\"\n * />\n * <DocumentDetailMetaRow>…due chip…2 assigned…</DocumentDetailMetaRow>\n * <DocumentDetailActions>…Edit / Lock / Status / Delete…</DocumentDetailActions>\n * </DocumentDetailHeader>\n * <DocumentDetailBody>\n * <Tabs>…</Tabs>\n * <DocumentList>\n * <DocumentListSection label=\"Client uploads\" count={2}>\n * <DocumentRow fileName=\"…\" meta=\"…\" actions={<…/>} />\n * </DocumentListSection>\n * </DocumentList>\n * </DocumentDetailBody>\n * </DocumentDetailPanel>\n *\n * Tabs (Documents / Comments / Activity) use the `Tabs` primitive — this\n * composite doesn't reinvent them. Status / priority chips are `Badge`s.\n */\n\n/* ─── Panel root ──────────────────────────────────────────────── */\n\nexport type DocumentDetailPanelProps = React.HTMLAttributes<HTMLElement>;\n\nexport const DocumentDetailPanel = forwardRef<HTMLElement, DocumentDetailPanelProps>(\n function DocumentDetailPanel({ className, ...props }, ref) {\n return (\n <aside\n ref={ref}\n className={cn(\n \"ds:bg-surface ds:text-fg ds:border-rule ds:flex ds:h-full ds:min-h-0 ds:flex-col ds:border-l\",\n className,\n )}\n {...props}\n />\n );\n },\n);\nDocumentDetailPanel.displayName = \"DocumentDetailPanel\";\n\n/* ─── Header ──────────────────────────────────────────────────── */\n\nexport interface DocumentDetailHeaderProps extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n \"title\"\n> {\n /** Leading chips — folder, priority, classification (left of the bar). */\n tags?: React.ReactNode;\n /** Status pill, right-aligned (e.g. a \"Provided\" success Badge). */\n status?: React.ReactNode;\n onClose?: (() => void) | undefined;\n}\n\nexport const DocumentDetailHeader = forwardRef<HTMLDivElement, DocumentDetailHeaderProps>(\n function DocumentDetailHeader({ tags, status, onClose, className, children, ...props }, ref) {\n const showControls = Boolean(status || onClose);\n // The status pill + close button float into the top-right corner so the\n // title (and the rest of the header) reclaim the full width, instead of\n // sitting on a separate full-width bar stacked above them. The `*Clearance`\n // classes reserve room on whichever element is the first header row so it\n // doesn't run under the floated controls.\n const tagsClearance = !showControls ? undefined : status ? \"ds:pr-32\" : \"ds:pr-12\";\n const titleClearance =\n !showControls || tags\n ? undefined\n : status\n ? \"ds:[&>:first-child]:pr-32\"\n : \"ds:[&>:first-child]:pr-12\";\n return (\n <div\n ref={ref}\n className={cn(\"ds:border-rule ds:relative ds:shrink-0 ds:space-y-3 ds:border-b ds:px-5 ds:py-4\", className)}\n {...props}\n >\n {showControls && (\n <div className=\"ds:absolute ds:top-4 ds:right-5 ds:z-[calc(var(--z-base)+10)] ds:flex ds:shrink-0 ds:items-center ds:gap-2\">\n {status}\n {onClose && (\n <button\n type=\"button\"\n onClick={onClose}\n aria-label=\"Close\"\n className={cn(\n \"ds:inline-flex ds:size-7 ds:shrink-0 ds:items-center ds:justify-center\",\n \"ds:rounded-icon ds:text-fg-4 ds:transition-colors ds:duration-[var(--duration-fast)] ds:ease-[var(--ease-out-quart)] ds:motion-reduce:transition-none\",\n \"ds:hover:bg-overlay-hover ds:hover:text-fg\",\n \"ds:focus-visible:[box-shadow:var(--shadow-focus-ring)] ds:focus-visible:outline-none\",\n )}\n >\n <XIcon className=\"ds:size-4\" aria-hidden=\"true\" />\n </button>\n )}\n </div>\n )}\n {tags && (\n <div className={cn(\"ds:flex ds:min-w-0 ds:flex-wrap ds:items-center ds:gap-1.5\", tagsClearance)}>\n {tags}\n </div>\n )}\n <div className={cn(\"ds:space-y-3\", titleClearance)}>{children}</div>\n </div>\n );\n },\n);\nDocumentDetailHeader.displayName = \"DocumentDetailHeader\";\n\n/* ─── Title ───────────────────────────────────────────────────── */\n\nexport type DocumentDetailTitleProps = React.HTMLAttributes<HTMLHeadingElement>;\n\nexport const DocumentDetailTitle = forwardRef<HTMLHeadingElement, DocumentDetailTitleProps>(\n function DocumentDetailTitle({ className, children, ...props }, ref) {\n return (\n <h2\n ref={ref}\n className={cn(\n \"ds:font-display ds:text-fg ds:text-lg ds:leading-snug ds:font-semibold ds:tracking-tight\",\n className,\n )}\n {...props}\n >\n {children}\n </h2>\n );\n },\n);\nDocumentDetailTitle.displayName = \"DocumentDetailTitle\";\n\n/* ─── Requester ───────────────────────────────────────────────── */\n\nexport interface DocumentDetailRequesterProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Image src, or initials/name passed through to <Avatar>. */\n avatar: string;\n /** Client / organisation name — the primary line. */\n org: string;\n /** Who requested the document. */\n requestedBy: string;\n /** Relative time, e.g. \"5d ago\". */\n time: string;\n}\n\nexport const DocumentDetailRequester = forwardRef<HTMLDivElement, DocumentDetailRequesterProps>(\n function DocumentDetailRequester({ avatar, org, requestedBy, time, className, ...props }, ref) {\n const isImageSrc = /^(https?:|data:|\\/)/i.test(avatar);\n return (\n <div ref={ref} className={cn(\"ds:flex ds:items-center ds:gap-2.5\", className)} {...props}>\n <Avatar size=\"sm\" src={isImageSrc ? avatar : undefined} name={isImageSrc ? org : avatar} />\n <div className=\"ds:min-w-0\">\n <div className=\"ds:text-fg ds:line-clamp-1 ds:text-sm ds:font-medium\">{org}</div>\n <div className=\"ds:text-fg-4 ds:text-xs\">\n Requested by {requestedBy} · {time}\n </div>\n </div>\n </div>\n );\n },\n);\nDocumentDetailRequester.displayName = \"DocumentDetailRequester\";\n\n/* ─── Meta row (due chip ⇄ assignees) ─────────────────────────── */\n\nexport type DocumentDetailMetaRowProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const DocumentDetailMetaRow = forwardRef<HTMLDivElement, DocumentDetailMetaRowProps>(\n function DocumentDetailMetaRow({ className, ...props }, ref) {\n return (\n <div\n ref={ref}\n className={cn(\"ds:flex ds:items-center ds:justify-between ds:gap-3\", className)}\n {...props}\n />\n );\n },\n);\nDocumentDetailMetaRow.displayName = \"DocumentDetailMetaRow\";\n\n/* ─── Action button row ───────────────────────────────────────── */\n\nexport type DocumentDetailActionsProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const DocumentDetailActions = forwardRef<HTMLDivElement, DocumentDetailActionsProps>(\n function DocumentDetailActions({ className, ...props }, ref) {\n return (\n <div\n ref={ref}\n className={cn(\"ds:flex ds:flex-wrap ds:items-center ds:gap-2 ds:[&>*]:flex-1\", className)}\n {...props}\n />\n );\n },\n);\nDocumentDetailActions.displayName = \"DocumentDetailActions\";\n\n/* ─── Body (scrollable) ───────────────────────────────────────── */\n\nexport type DocumentDetailBodyProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const DocumentDetailBody = forwardRef<HTMLDivElement, DocumentDetailBodyProps>(\n function DocumentDetailBody({ className, ...props }, ref) {\n return (\n <div\n ref={ref}\n className={cn(\"ds:scrollbar-thin ds:min-h-0 ds:flex-1 ds:overflow-y-auto ds:px-5 ds:py-4\", className)}\n {...props}\n />\n );\n },\n);\nDocumentDetailBody.displayName = \"DocumentDetailBody\";\n\n/* ─── Document list ───────────────────────────────────────────── */\n\nexport type DocumentListProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const DocumentList = forwardRef<HTMLDivElement, DocumentListProps>(function DocumentList(\n { className, ...props },\n ref,\n) {\n return <div ref={ref} className={cn(\"ds:space-y-5\", className)} {...props} />;\n});\nDocumentList.displayName = \"DocumentList\";\n\nexport interface DocumentListSectionProps extends React.HTMLAttributes<HTMLElement> {\n /** Section label, e.g. \"Client uploads\". */\n label: React.ReactNode;\n /** Count shown next to the label. */\n count?: number;\n /** Trailing slot, right-aligned (e.g. an \"Upload\" button). */\n action?: React.ReactNode;\n}\n\nexport const DocumentListSection = forwardRef<HTMLElement, DocumentListSectionProps>(\n function DocumentListSection({ label, count, action, className, children, ...props }, ref) {\n return (\n <section ref={ref} className={cn(\"ds:space-y-1\", className)} {...props}>\n <div className=\"ds:flex ds:items-center ds:justify-between ds:gap-2 ds:px-2.5 ds:py-1\">\n <div className=\"ds:text-fg-3 ds:flex ds:items-center ds:gap-1.5 ds:text-xs ds:font-medium\">\n <span>{label}</span>\n {count != null && <span className=\"ds:text-fg-4 ds:tabular-nums\">{count}</span>}\n </div>\n {action}\n </div>\n <div className=\"ds:space-y-0.5\">{children}</div>\n </section>\n );\n },\n);\nDocumentListSection.displayName = \"DocumentListSection\";\n\nexport interface DocumentRowProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** File name — the row's primary line. */\n fileName: string;\n /** Secondary line, e.g. \"320 KB · Jun 11, 2026 · Acme Manufacturing\". */\n meta?: React.ReactNode | undefined;\n /** Leading file-type icon; defaults to a neutral document glyph. */\n icon?: React.ReactNode | undefined;\n /** Render the row in its approved state — a green file-icon chip plus an\n * \"Approved\" tag after the file name. */\n approved?: boolean | undefined;\n /** Render the row in its rejected state — a red file-icon chip plus a\n * \"Rejected\" tag after the file name. Ignored when `approved` is set. */\n rejected?: boolean | undefined;\n /** Trailing action controls (Extract / preview / download / delete). */\n actions?: React.ReactNode | undefined;\n}\n\nexport const DocumentRow = forwardRef<HTMLDivElement, DocumentRowProps>(function DocumentRow(\n { fileName, meta, icon, approved, rejected, actions, className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n className={cn(\n \"ds:group/row ds:rounded-card ds:flex ds:items-center ds:gap-3 ds:px-2.5 ds:py-2\",\n \"ds:transition-colors ds:duration-[var(--duration-fast)] ds:ease-[var(--ease-out-quart)] ds:motion-reduce:transition-none\",\n \"ds:hover:bg-overlay-hover\",\n className,\n )}\n {...props}\n >\n <span\n aria-hidden=\"true\"\n className={cn(\n \"ds:rounded-icon ds:inline-flex ds:size-9 ds:shrink-0 ds:items-center ds:justify-center\",\n approved\n ? \"ds:bg-success-bg ds:text-success-fg\"\n : rejected\n ? \"ds:bg-danger-bg ds:text-danger-fg\"\n : \"ds:bg-bg-2 ds:text-fg-3\",\n )}\n >\n {icon ?? <FileTextIcon className=\"ds:size-4.5\" />}\n </span>\n <div className=\"ds:min-w-0 ds:flex-1\">\n <div className=\"ds:flex ds:min-w-0 ds:items-center ds:gap-1.5\">\n <span className=\"ds:text-fg ds:line-clamp-1 ds:min-w-0 ds:text-sm ds:font-medium\">{fileName}</span>\n {approved ? (\n <span className=\"ds:bg-success-bg ds:text-success-fg ds:inline-flex ds:shrink-0 ds:items-center ds:gap-1 ds:rounded-md ds:px-1.5 ds:py-0.5 ds:text-[10.5px] ds:font-semibold\">\n <CheckIcon className=\"ds:size-3\" aria-hidden=\"true\" />\n Approved\n </span>\n ) : rejected ? (\n <span className=\"ds:bg-danger-bg ds:text-danger-fg ds:inline-flex ds:shrink-0 ds:items-center ds:gap-1 ds:rounded-md ds:px-1.5 ds:py-0.5 ds:text-[10.5px] ds:font-semibold\">\n <AlertTriangleIcon className=\"ds:size-3\" aria-hidden=\"true\" />\n Rejected\n </span>\n ) : null}\n </div>\n {meta && <div className=\"ds:text-fg-4 ds:line-clamp-1 ds:text-xs\">{meta}</div>}\n </div>\n {actions && <div className=\"ds:flex ds:shrink-0 ds:items-center ds:gap-0.5\">{actions}</div>}\n </div>\n );\n});\nDocumentRow.displayName = \"DocumentRow\";\n"]}
|