@assure-one/design-system 1.42.0 → 1.43.1
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/dist/{brand-scope-B7w3-y9E.d.ts → brand-scope-BOKu4iOc.d.ts} +1 -1
- package/dist/{chunk-YMRSFVW7.js → chunk-5AL4W32Z.js} +335 -225
- package/dist/chunk-5AL4W32Z.js.map +1 -0
- package/dist/{chunk-H53VF62B.js → chunk-L5IQK3GV.js} +108 -50
- package/dist/chunk-L5IQK3GV.js.map +1 -0
- package/dist/{chunk-AF3QYJ24.js → chunk-TBDTXAFH.js} +6 -4
- package/dist/chunk-TBDTXAFH.js.map +1 -0
- package/dist/{chunk-M2HMZ2RW.js → chunk-VK6SW34V.js} +36 -14
- package/dist/chunk-VK6SW34V.js.map +1 -0
- package/dist/css/components.css +1 -1
- package/dist/{data-table-view-BN3GgNdp.d.ts → data-table-view-BWhKeUiw.d.ts} +2 -2
- package/dist/{design-system-provider-CrBRFQjR.d.ts → design-system-provider-Coe2S3Lh.d.ts} +1 -1
- package/dist/icons/index.d.ts +5 -1
- package/dist/icons/index.js +1 -1
- package/dist/index.d.ts +246 -53
- package/dist/index.js +530 -236
- package/dist/index.js.map +1 -1
- package/dist/legacy/index.d.ts +3 -3
- package/dist/legacy/index.js +3 -3
- package/dist/next/index.d.ts +2 -2
- package/dist/styles.css +1 -1
- package/dist/suite/index.d.ts +3 -3
- package/dist/suite/index.js +3 -3
- package/dist/{types-aBQCboFH.d.ts → types-DlqmlVyZ.d.ts} +11 -1
- package/docs/components.md +6 -3
- package/docs/components.registry.json +84 -17
- package/package.json +1 -1
- package/dist/chunk-AF3QYJ24.js.map +0 -1
- package/dist/chunk-H53VF62B.js.map +0 -1
- package/dist/chunk-M2HMZ2RW.js.map +0 -1
- package/dist/chunk-YMRSFVW7.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/primitives/brand-icons.tsx","../src/primitives/chip.tsx","../src/primitives/behavior/collection/option.ts","../src/primitives/behavior/collection/keyboard.ts","../src/primitives/behavior/nested-scroll-lock.tsx","../src/primitives/combobox.tsx","../src/primitives/client-select.tsx","../src/primitives/collapsible.tsx","../src/primitives/coming-soon.tsx","../src/lib/asset-base.ts","../src/foundation/provider/plain-adapters.tsx","../src/primitives/logo.tsx","../src/primitives/sheet.tsx","../src/composites/agreement-viewer.tsx","../src/composites/proposal-pricing.tsx","../src/composites/proposal-content.tsx","../src/composites/proposal-signing.tsx","../src/composites/grid.tsx","../src/composites/questions.tsx","../src/composites/sidebar.tsx","../src/composites/sidebar-brand-switcher.tsx","../src/lib/brand-scope.tsx"],"names":["Chip","jsxs","jsx","Fragment","React","useId","React2","React3","Collapsible","CollapsibleTrigger","CollapsibleContent","forwardRef","ComingSoon","React4","React5","AgreementViewer","useState","AgreementPaneHeading","ProposalServiceRow","ProposalPackageCard","ProposalBillingTerms","ProposalAddOn","ProposalPricingSummary","ProposalCustomPage","ProposalNote","ProposalSignerList","ProposalSignatureBlock","ProposalConsentGate","ProposalPaymentCapture","Grid","Questions","index","Sidebar","SidebarTrigger","SidebarPinButton","SidebarBrand","SidebarBrandText","SidebarSection","SidebarLink","SidebarLinkLabel","SidebarLinkAction","SidebarLinkBadge","SidebarLinkGroup","SidebarFooter","SidebarUser","React7","SidebarBrandSwitcher","createContext","useContext","BrandScope"],"mappings":";;;;;;;;;;;AAqCA,IAAM,eAAA,GAAkB,SAAA;AACxB,IAAM,eAAA,GACJ,suBAAA;AACF,IAAM,iBAAA,GACJ,yoBAAA;AAMF,SAAS,SAAA,CAAU;AAAA,EACjB,IAAA,GAAO,EAAA;AAAA,EACP,MAAA;AAAA,EACA,KAAA;AAAA,EACA,SAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAuD;AACrD,EAAA,uBACE,IAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,IAAA;AAAA,MACP,MAAA,EAAQ,IAAA;AAAA,M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AAA,EAAO,OAAA;AAAA,EACP,KAAA,EAAO,OAAA;AAAA,EACP,GAAA,EAAK;AACP;AAEA,IAAM,iBAAA,GAAoB6C,cAA4B,KAAK,CAAA;AAQpD,SAAS,kBAAA,CAAmB;AAAA,EACjC,OAAA;AAAA,EACA;AACF,CAAA,EAGG;AACD,EAAA,uBACE7C,GAAAA,CAAC,iBAAA,CAAkB,UAAlB,EAA2B,KAAA,EAAO,SAAU,QAAA,EAAS,CAAA;AAE1D;AAGO,SAAS,aAAA,GAA8B;AAC5C,EAAA,OAAO8C,WAAW,iBAAiB,CAAA;AACrC;AAYO,IAAM,UAAA,GAAarC,UAAAA,CAA4C,SAASsC,WAAAA,CAC7E,EAAE,SAAS,QAAA,EAAU,GAAG,KAAA,EAAM,EAC9B,GAAA,EACA;AACA,EAAA,uBACE/C,GAAAA,CAAC,kBAAA,EAAA,EAAmB,OAAA,EAClB,QAAA,kBAAAA,GAAAA,CAAC,KAAA,EAAA,EAAI,GAAA,EAAU,YAAA,EAAY,OAAA,EAAU,GAAG,KAAA,EACrC,UACH,CAAA,EACF,CAAA;AAEJ,CAAC;AAED,UAAA,CAAW,WAAA,GAAc,YAAA","file":"chunk-H53VF62B.js","sourcesContent":["import { cn } from \"../lib/cn\";\n\n/* ───────────────────────────────────────────────────────────────────────\n * Assure Suite brand glyphs\n *\n * Per-product mark icons for the Assure suite. Same silhouette (an \"A\"\n * shape with a small accent square) across all four — only the accent\n * fill changes, so a row of product tiles reads as a coherent family.\n *\n * Why these live separately from `icons.tsx`:\n * - intrinsic colors (the accent fill is part of the brand, not a\n * `currentColor`-driven theme tint), and\n * - a non-square viewBox (`0 0 136 137`) lifted directly from the\n * Pro source artwork to preserve sub-pixel proportions.\n *\n * Sized via `size` (square px on the wire). Default 24 matches every\n * other DS primitive and the `SidebarBrandSwitcher` row tile.\n *\n * The black-ish base color `#070707` is intentional brand tone — kept\n * stable across all variants. Per-product accents pull from the\n * `--color-brand-{slug}` tokens so the same hex is reusable elsewhere\n * (chips, banners, dashboards) and dark mode tracks automatically:\n * Pro var(--color-brand-pro) (purple — Pro's existing brand)\n * Audit var(--color-brand-audit) (teal)\n * Books var(--color-brand-books) (green)\n * Tax var(--color-brand-tax) (blue)\n *\n * Consumer wiring example:\n * <SidebarBrandSwitcher\n * brand={<AssureAuditBrandIcon size={28} />}\n * items={[\n * { id: \"pro\", glyph: <AssureProBrandIcon />, ... },\n * ...\n * ]}\n * />\n * ─────────────────────────────────────────────────────────────────────── */\n\nconst BRAND_BASE_FILL = \"#070707\";\nconst BRAND_BASE_PATH =\n \"M43.8298 23.829C46.9635 23.7428 50.7456 23.9675 54.0114 23.9437L91.3493 23.8048C97.6806 23.7927 101.727 24.9883 106.302 29.5107C107.671 30.864 108.443 32.0751 109.418 33.7063C112.332 38.5806 112.037 42.6442 112.003 48.0679L112.02 56.4922C108.427 57.4911 101.053 57.2229 96.9953 57.2944C87.0232 57.47 76.9072 57.2055 66.9345 57.4014C66.7192 66.474 66.9079 75.8103 66.8438 84.9327C66.7469 92.0668 67.2878 101.738 66.6431 108.599C60.7359 108.871 54.5467 108.479 48.6135 108.641C40.5834 108.86 34.2651 108.559 28.1575 102.692C20.618 95.4486 21.8015 86.9701 21.8025 77.474L21.8166 59.8481L21.8312 49.597C21.8372 47.075 21.7515 43.5009 22.2502 41.142C22.9069 38.0359 25.4258 33.4304 27.6724 31.1548C32.4002 26.3658 37.1772 24.0905 43.8298 23.829Z\";\nconst BRAND_ACCENT_PATH =\n \"M83.7555 72.8376C85.3789 72.6548 90.5991 72.7708 92.4304 72.7692L100.779 72.7802C102.529 72.7903 104.546 72.7296 106.26 73.0259C108.43 73.422 111.61 75.5699 111.737 77.9539C112.107 84.8649 111.986 91.8555 111.974 98.7715C111.969 101.35 111.928 103.109 110.232 105.149C108.61 107.101 107.07 108.323 104.518 108.621C99.7602 108.503 95.0005 108.467 90.2413 108.513C87.5612 108.531 84.6034 108.799 81.9937 108.434C78.4024 107.933 76.1145 105.214 76.0317 101.618C75.9281 97.1186 75.8903 92.669 75.9646 88.174C76.0209 84.7695 75.8279 81.2851 76.3134 77.921C76.3993 77.3266 77.1785 76.1903 77.6286 75.7193C79.6145 73.6412 80.9496 73.0158 83.7555 72.8376Z\";\n\nexport interface BrandIconProps extends React.SVGAttributes<SVGElement> {\n size?: number;\n}\n\nfunction BrandIcon({\n size = 24,\n accent,\n title,\n className,\n ...props\n}: BrandIconProps & { accent: string; title: string }) {\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 136 137\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className={cn(\"ds:shrink-0\", className)}\n role=\"img\"\n aria-label={title}\n {...props}\n >\n <path d={BRAND_BASE_PATH} fill={BRAND_BASE_FILL} />\n <path d={BRAND_ACCENT_PATH} fill={accent} />\n </svg>\n );\n}\n\nexport function AssureProBrandIcon({ size = 24, ...props }: BrandIconProps) {\n return <BrandIcon size={size} accent=\"var(--ds-ref-brand-pro-seed, var(--color-brand-pro))\" title=\"Assure Pro\" {...props} />;\n}\n\nexport function AssureAuditBrandIcon({ size = 24, ...props }: BrandIconProps) {\n return <BrandIcon size={size} accent=\"var(--ds-ref-brand-audit-seed, var(--color-brand-audit))\" title=\"Assure Audit\" {...props} />;\n}\n\nexport function AssureBooksBrandIcon({ size = 24, ...props }: BrandIconProps) {\n return <BrandIcon size={size} accent=\"var(--ds-ref-brand-books-seed, var(--color-brand-books))\" title=\"Assure Books\" {...props} />;\n}\n\nexport function AssureTaxBrandIcon({ size = 24, ...props }: BrandIconProps) {\n return <BrandIcon size={size} accent=\"var(--ds-ref-brand-tax-seed, var(--color-brand-tax))\" title=\"Assure Tax\" {...props} />;\n}\n","\"use client\";\n\nimport { forwardRef, type ReactNode } from \"react\";\n\nimport { chipAnatomy, type ChipSlot } from \"../foundation/anatomy/slots\";\nimport { slot, stateAttributes } from \"../foundation/anatomy/slot\";\nimport type { ControlSize, Variant } from \"../foundation/vocab\";\nimport { cn } from \"../lib/cn\";\n\nimport {\n buttonBase,\n type ButtonIntent,\n type ButtonIntentAlias,\n type ButtonLook,\n} from \"./behavior/button-base\";\nimport { CONTROL_GAP_CLASSES, CONTROL_SIZE_CLASSES } from \"./behavior/control-size\";\nimport { XIcon } from \"./icons\";\nimport { Pressable } from \"./pressable\";\n\n/** The chip parts (ADR-008). See the registry for the doc comment. */\nexport type { ChipSlot };\n\n/* ────────────────────────────────────────────────────────────────────────────\n * Chip — a removable, toggleable or clickable token (W3-15; target\n * architecture §31).\n *\n * The interactive small label. `Badge` is static; a Chip does something:\n *\n * - **toggle** — `pressed` / `onPressedChange` (a filter chip); `aria-pressed`\n * and `data-pressed` on the control\n * - **click** — `onClick` (a suggestion, a recent search)\n * - **remove** — `onRemove` renders a *separate* remove button with its own\n * accessible name, `removeLabel`, which defaults to \"Remove {label}\" when the\n * label is a string\n * - `count` — a trailing number (results, selected items)\n *\n * Built on `buttonBase` (the Button family's recipe: focus ring, press\n * feedback, disabled treatment, the `variant` × `intent` colour table) through\n * `Pressable` (the behaviour: Enter/Space, disabled semantics), so a chip is\n * a small pill-shaped button in every respect that matters, and reads the\n * shared control scale for its geometry (A1: `size=\"sm\"` is the `sm` height\n * of every control).\n *\n * Structure: without `onRemove` the root *is* the pressable (`<button>`). With\n * `onRemove` the root is a `<span>` styled as the chip that holds the label\n * (a pressable when the chip toggles or clicks, plain text otherwise) and the\n * remove button — two focus stops, two names, never a button inside a button.\n *\n * Colour: `intent` defaults to `neutral`, and to `brand` while `pressed`, so a\n * selected filter is the brand tint without a prop (what `FilterChip active`\n * renders). Pass `intent` to fix the family.\n *\n * `DismissibleChip` and `FilterChip` are the chips consumers use today. They\n * keep their exact markup and classes (pinned in\n * `src/primitives/__tests__/chip-adapters-legacy.test.tsx`); new call sites\n * use `Chip`. Consolidating them onto `Chip` changes their DOM (the remove\n * button becomes its own element) and waits for a release that may.\n * ──────────────────────────────────────────────────────────────────────────── */\n\n/** The emphasis subset a chip offers. @experimental */\nexport type ChipVariant = Extract<Variant, \"solid\" | \"soft\" | \"outline\">;\n\n/** The intents a chip offers (the Button family's). @experimental */\nexport type ChipIntent = ButtonIntent;\n\n/** The chip sizes: the shared control scale (A1). @experimental */\nexport type ChipSize = ControlSize;\n\n/** @experimental */\nexport interface ChipProps extends Omit<React.HTMLAttributes<HTMLElement>, \"children\" | \"onClick\"> {\n /** The label. A string also names the remove button (\"Remove {label}\"). */\n children: ReactNode;\n /** Leading glyph, decorative. */\n icon?: ReactNode;\n /** Trailing number. */\n count?: number;\n /** Visual emphasis: `soft` (default) · `solid` · `outline`. */\n variant?: ChipVariant;\n /**\n * Meaning → colour family. Default `neutral`, or `brand` while `pressed`.\n * `destructive` is a deprecated alias of `danger` (decision D4).\n */\n intent?: ChipIntent | ButtonIntentAlias;\n /** Outer height from the shared control scale (A1). Default `sm` (32px). */\n size?: ChipSize;\n /**\n * Toggle state (a boolean prop, never a variant — ADR-007 §2). Controlled:\n * pair with `onPressedChange`. Reflected as `aria-pressed` / `data-pressed`.\n */\n pressed?: boolean;\n /** Called with the next state when a toggle chip is activated. */\n onPressedChange?: (pressed: boolean) => void;\n /** Activation of the chip itself (not of the remove button). */\n onClick?: React.MouseEventHandler<HTMLButtonElement>;\n /** Renders a remove button after the label and is called when it is activated. */\n onRemove?: (() => void) | undefined;\n /**\n * The remove button's accessible name. Defaults to \"Remove {label}\" when\n * `children` is a string; required otherwise (a development error).\n */\n removeLabel?: string;\n /** Disables the chip and its remove button. */\n disabled?: boolean | undefined;\n}\n\n/**\n * The chip class recipe: `buttonBase` for the resolved look (no text-button\n * size row), a pill corner, and the control-scale size. Server-safe.\n *\n * @experimental\n */\nexport function chipVariants({\n variant,\n intent,\n size,\n pressed,\n className,\n}: {\n variant?: ChipVariant | null | undefined;\n intent?: ChipIntent | ButtonIntentAlias | null | undefined;\n size?: ChipSize | null | undefined;\n pressed?: boolean | null | undefined;\n className?: string | null | undefined;\n} = {}): string {\n const { look } = resolveChipStyle({ variant, intent, pressed });\n return cn(\n buttonBase({ look, size: null }),\n \"ds:rounded-full ds:shrink-0\",\n CONTROL_SIZE_CLASSES[size ?? \"sm\"],\n className,\n );\n}\n\n/**\n * The resolved appearance of a chip: the emphasis, the colour family and the\n * row of the Button colour table they render (see the module comment on the\n * `intent` default).\n *\n * @experimental\n */\nexport interface ChipStyle {\n variant: ChipVariant;\n intent: ChipIntent;\n look: ButtonLook;\n}\n\n/** Resolves `variant` + `intent` (+ `pressed`) to the row a chip renders. */\nexport function resolveChipStyle({\n variant,\n intent,\n pressed,\n}: {\n variant?: ChipVariant | null | undefined;\n intent?: ChipIntent | ButtonIntentAlias | null | undefined;\n pressed?: boolean | null | undefined;\n}): ChipStyle {\n const emphasis = variant ?? \"soft\";\n const requested = intent === \"destructive\" ? \"danger\" : intent;\n const family: ChipIntent = requested ?? (pressed ? \"brand\" : \"neutral\");\n return { variant: emphasis, intent: family, look: `${emphasis}/${family}` };\n}\n\n/** Hover surface of the remove button, per colour family (on the chip's own tint). */\nconst REMOVE_HOVER: Readonly<Record<ChipIntent, string>> = {\n brand: \"ds:hover:bg-brand-bg-active\",\n neutral: \"ds:hover:bg-control-active-bg\",\n success: \"ds:hover:bg-success-line\",\n danger: \"ds:hover:bg-danger-line\",\n};\n\n/**\n * The removable, toggleable or clickable token, on `buttonBase` through\n * `Pressable`. See the module comment.\n *\n * @experimental\n */\nexport const Chip = forwardRef<HTMLElement, ChipProps>(function Chip(\n {\n children,\n icon,\n count,\n variant,\n intent,\n size = \"sm\",\n pressed,\n onPressedChange,\n onClick,\n onRemove,\n removeLabel,\n disabled,\n className,\n ...props\n },\n ref,\n) {\n const isToggle = pressed !== undefined || onPressedChange !== undefined;\n const pressedValue = isToggle ? Boolean(pressed) : undefined;\n const interactive = isToggle || onClick !== undefined;\n const style = resolveChipStyle({ variant, intent, pressed: pressedValue });\n\n const resolvedRemoveLabel =\n removeLabel ?? (typeof children === \"string\" ? `Remove ${children}` : undefined);\n if (process.env.NODE_ENV !== \"production\" && onRemove && resolvedRemoveLabel === undefined) {\n throw new Error(\n \"[Chip] `removeLabel` is required when `onRemove` is set and the label is not a string: the remove button needs an accessible name.\",\n );\n }\n\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (event.defaultPrevented) return;\n if (isToggle) onPressedChange?.(!pressedValue);\n };\n\n const state = stateAttributes({\n variant: style.variant,\n intent: style.intent,\n size,\n disabled,\n pressed: pressedValue,\n });\n\n const content = (\n <>\n {icon && (\n <span\n {...slot(chipAnatomy, \"icon\")}\n className=\"ds:inline-flex ds:shrink-0\"\n aria-hidden=\"true\"\n >\n {icon}\n </span>\n )}\n <span {...slot(chipAnatomy, \"label\")}>{children}</span>\n {typeof count === \"number\" && (\n <span {...slot(chipAnatomy, \"count\")} className=\"ds:font-normal ds:tabular-nums\">\n {count}\n </span>\n )}\n </>\n );\n\n if (!onRemove) {\n return (\n <Pressable\n ref={ref}\n pressed={pressedValue}\n disabled={disabled}\n onClick={handleClick}\n {...slot(chipAnatomy, \"root\")}\n {...state}\n className={chipVariants({ variant, intent, size, pressed: pressedValue, className })}\n {...(props as React.ButtonHTMLAttributes<HTMLElement>)}\n >\n {content}\n </Pressable>\n );\n }\n\n return (\n <span\n ref={ref as React.Ref<HTMLSpanElement>}\n // The group has no native `disabled`: the ARIA state says the whole chip\n // is (its parts carry the real one), and disabled text is not judged\n // for contrast.\n aria-disabled={disabled || undefined}\n {...slot(chipAnatomy, \"root\")}\n {...state}\n className={cn(\n chipVariants({ variant, intent, size, pressed: pressedValue }),\n // The remove button ends the row in its own 24px box (a hit target of\n // its own, WCAG 2.5.8), so the end padding is the box's, not the text's.\n \"ds:pe-1\",\n !interactive && \"ds:cursor-default\",\n disabled && \"ds:pointer-events-none ds:bg-bg-disabled ds:text-fg-disabled\",\n className,\n )}\n {...props}\n >\n {interactive ? (\n <Pressable\n pressed={pressedValue}\n disabled={disabled}\n onClick={handleClick}\n className={cn(\n \"ds:inline-flex ds:h-full ds:min-w-0 ds:items-center ds:rounded-full ds:bg-transparent ds:p-0 ds:text-inherit\",\n CONTROL_GAP_CLASSES[size],\n )}\n >\n {content}\n </Pressable>\n ) : (\n <span\n className={cn(\"ds:inline-flex ds:min-w-0 ds:items-center\", CONTROL_GAP_CLASSES[size])}\n >\n {content}\n </span>\n )}\n <Pressable\n {...slot(chipAnatomy, \"remove\")}\n aria-label={resolvedRemoveLabel}\n disabled={disabled}\n onClick={onRemove}\n className={cn(\n \"ds:inline-flex ds:size-6 ds:shrink-0 ds:items-center ds:justify-center ds:rounded-full ds:bg-transparent ds:p-0 ds:text-inherit\",\n \"ds:transition-colors ds:duration-[var(--motion-duration-feedback)] ds:motion-reduce:transition-none\",\n REMOVE_HOVER[style.intent],\n )}\n >\n <XIcon aria-hidden=\"true\" />\n </Pressable>\n </span>\n );\n});\n\nChip.displayName = \"Chip\";\n","import type { ReactNode } from \"react\";\n\n/**\n * L1a behaviour primitive (private). Not exported from the package.\n *\n * The canonical option model of every list-shaped control (W4-09; target\n * architecture §32): `Select`, the coming `Combobox` (W4-10) and its\n * `MultiSelect` preset (W4-11), the `SearchSelect` adapter (W4-12) and the\n * `PeoplePicker` pattern all read one shape, in place of the six that ship\n * today (`{value,label}`, `{id,label,group…}`, `{id,label,email}`,\n * `{id,fullName}`, `{key,label,dot}`, `string[]`).\n *\n * Two halves:\n *\n * - {@link Option} and its accessors: what a row *is*. Consumers with domain\n * objects pass {@link OptionAccessors} (`getOptionValue`/`getOptionLabel`)\n * instead of remapping, and {@link toOptions} normalises everything — a\n * `string[]`, domain objects, `Option`s — into one array the list renders.\n * - The selection helpers: what a control's *value* is, discriminated by\n * `multiple` (single `TValue | null`, multi `TValue[]`; §32 \"Value\"). `\"\"`\n * keeps meaning empty in 2.x (§32 \"Compat\"), so {@link normalizeSingleValue}\n * folds it to `null` at the boundary.\n *\n * No React, no client directive, no DOM: plain functions over plain data, so\n * the same module serves a Server Component, a test and the keyboard helper.\n */\n\n/**\n * One row of a list-shaped control.\n *\n * `value` is never `\"\"`: emptiness is `value === null` on the control, not a\n * sentinel row (§32). `label` is the string typeahead, filtering and the\n * accessible name read; `description` and `icon` are rendered, never searched.\n * `keywords` widen the match without showing. `meta` carries consumer data\n * through to `renderOption` / `onValueChange` details untouched.\n *\n * @experimental\n */\nexport interface Option<TValue extends string = string, TMeta = unknown> {\n value: TValue;\n label: string;\n description?: ReactNode;\n /** Leading visual: icon, avatar, flag, colour swatch. */\n icon?: ReactNode;\n disabled?: boolean;\n group?: string | undefined;\n keywords?: readonly string[] | undefined;\n meta?: TMeta;\n}\n\n/**\n * How a list reads a consumer's own item type. Only `getOptionValue` and\n * `getOptionLabel` are required: an item with no `disabled`/`group`/`keywords`\n * accessor is enabled, ungrouped and matched on its label alone.\n *\n * @experimental\n */\nexport interface OptionAccessors<TItem, TValue extends string = string> {\n getOptionValue: (item: TItem) => TValue;\n getOptionLabel: (item: TItem) => string;\n getOptionDisabled?: ((item: TItem) => boolean) | undefined;\n getOptionGroup?: ((item: TItem) => string | undefined) | undefined;\n getOptionKeywords?: ((item: TItem) => readonly string[] | undefined) | undefined;\n}\n\n/** True for anything shaped like an {@link Option}: a string `value` and a string `label`. */\nexport function isOption(item: unknown): item is Option {\n return (\n typeof item === \"object\" &&\n item !== null &&\n typeof (item as { value?: unknown }).value === \"string\" &&\n typeof (item as { label?: unknown }).label === \"string\"\n );\n}\n\n/** The accessors of an {@link Option}: each field read as it is. */\nexport const optionAccessors: Required<OptionAccessors<Option>> = {\n getOptionValue: (option) => option.value,\n getOptionLabel: (option) => option.label,\n getOptionDisabled: (option) => option.disabled === true,\n getOptionGroup: (option) => option.group,\n getOptionKeywords: (option) => option.keywords,\n};\n\n/**\n * The accessors of a bare `string` item (`options={[\"Draft\", \"Sent\"]}`): the\n * string is both value and label.\n */\nexport const stringOptionAccessors: OptionAccessors<string> = {\n getOptionValue: (item) => item,\n getOptionLabel: (item) => item,\n};\n\n/**\n * The accessors that read `item` when the caller passed none: a `string` is\n * its own value and label, an {@link Option} reads its fields. Anything else\n * needs explicit accessors — the error names the two required ones.\n */\nfunction resolveAccessors<TItem, TValue extends string>(\n item: TItem,\n accessors: OptionAccessors<TItem, TValue> | undefined,\n): OptionAccessors<TItem, TValue> {\n if (accessors !== undefined) return accessors;\n if (typeof item === \"string\") {\n return stringOptionAccessors as unknown as OptionAccessors<TItem, TValue>;\n }\n if (isOption(item)) {\n return optionAccessors as unknown as OptionAccessors<TItem, TValue>;\n }\n throw new TypeError(\n \"collection: an item that is neither a string nor an Option needs accessors (getOptionValue/getOptionLabel)\",\n );\n}\n\n/** The value of one item: through `accessors`, or the default read of a string/`Option`. */\nexport function getOptionValue<TItem, TValue extends string = string>(\n item: TItem,\n accessors?: OptionAccessors<TItem, TValue>,\n): TValue {\n return resolveAccessors(item, accessors).getOptionValue(item);\n}\n\n/** The label of one item: through `accessors`, or the default read of a string/`Option`. */\nexport function getOptionLabel<TItem>(item: TItem, accessors?: OptionAccessors<TItem>): string {\n return resolveAccessors(item, accessors).getOptionLabel(item);\n}\n\n/**\n * One consumer item as an {@link Option}. When the item already is one, its\n * other fields (`description`, `icon`, `meta`) survive; the accessors decide\n * `value`, `label`, `disabled`, `group` and `keywords`. A `string` item needs\n * no accessors, and a domain object is kept as `meta`.\n */\nexport function toOption<TItem, TValue extends string = string>(\n item: TItem,\n accessors?: OptionAccessors<TItem, TValue>,\n): Option<TValue, unknown> {\n const read = resolveAccessors(item, accessors);\n if (accessors === undefined && isOption(item)) {\n return item as Option<TValue, unknown>;\n }\n const base: Option<TValue, unknown> = isOption(item)\n ? { ...(item as Option<TValue, unknown>) }\n : { value: read.getOptionValue(item), label: read.getOptionLabel(item) };\n base.value = read.getOptionValue(item);\n base.label = read.getOptionLabel(item);\n const disabled = read.getOptionDisabled?.(item);\n if (disabled !== undefined) base.disabled = disabled;\n const group = read.getOptionGroup?.(item);\n if (group !== undefined) base.group = group;\n const keywords = read.getOptionKeywords?.(item);\n if (keywords !== undefined) base.keywords = keywords;\n if (!isOption(item) && typeof item !== \"string\") base.meta = item;\n return base;\n}\n\n/**\n * Every consumer item as an {@link Option}, in order. Throws in development\n * on an empty `value` (§32: `\"\"` is not a row) and on a repeated `value` (two\n * rows the keyboard could not tell apart — the cmdk collision that made two\n * clients with one name highlight together).\n */\nexport function toOptions<TItem, TValue extends string = string>(\n items: readonly TItem[],\n accessors?: OptionAccessors<TItem, TValue>,\n): Option<TValue, unknown>[] {\n const options = items.map((item) => toOption(item, accessors));\n if (process.env.NODE_ENV !== \"production\") {\n const seen = new Set<string>();\n for (const option of options) {\n if (option.value === \"\") {\n throw new TypeError(\n `collection: option ${JSON.stringify(option.label)} has an empty value; emptiness is value === null on the control, not a row`,\n );\n }\n if (seen.has(option.value)) {\n throw new TypeError(\n `collection: option value ${JSON.stringify(option.value)} appears twice; values must be unique`,\n );\n }\n seen.add(option.value);\n }\n }\n return options;\n}\n\n/** The option whose `value` is `value`, or `undefined`. */\nexport function findOption<TValue extends string, TMeta>(\n options: readonly Option<TValue, TMeta>[],\n value: TValue | null | undefined,\n): Option<TValue, TMeta> | undefined {\n if (value === null || value === undefined) return undefined;\n return options.find((option) => option.value === value);\n}\n\n/** Whether the row takes no selection (rendered, announced, skipped by the keyboard). */\nexport function isOptionDisabled(option: Pick<Option, \"disabled\">): boolean {\n return option.disabled === true;\n}\n\n/**\n * A run of consecutive rows under one heading. Ungrouped rows come back with\n * `group: undefined` so a list can render them without a heading.\n *\n * @experimental\n */\nexport interface OptionGroup<TValue extends string = string, TMeta = unknown> {\n group: string | undefined;\n options: Option<TValue, TMeta>[];\n}\n\n/**\n * Rows bucketed by `group`, in order of first appearance; ungrouped rows keep\n * their place as their own bucket. A row's group is where its first sibling\n * put it, so consumers who interleave groups still get one heading per group.\n */\nexport function groupOptions<TValue extends string, TMeta>(\n options: readonly Option<TValue, TMeta>[],\n): OptionGroup<TValue, TMeta>[] {\n const buckets = new Map<string | undefined, OptionGroup<TValue, TMeta>>();\n const ordered: OptionGroup<TValue, TMeta>[] = [];\n for (const option of options) {\n let bucket = buckets.get(option.group);\n if (!bucket) {\n bucket = { group: option.group, options: [] };\n buckets.set(option.group, bucket);\n ordered.push(bucket);\n }\n bucket.options.push(option);\n }\n return ordered;\n}\n\n/**\n * Text folded for matching: lower-cased, diacritics removed, whitespace\n * collapsed. `\"Ándrea Lopez\"` and `\"andrea lopez\"` fold to the same string.\n */\nexport function foldForMatch(text: string): string {\n return text.normalize(\"NFD\").replace(/[̀-ͯ]/g, \"\").toLowerCase().replace(/\\s+/g, \" \").trim();\n}\n\n/**\n * Whether a typed query matches a row: a folded substring of the label, of\n * any keyword, or of the group name. An empty query matches every row.\n */\nexport function optionMatches(option: Option, query: string): boolean {\n const needle = foldForMatch(query);\n if (needle === \"\") return true;\n if (foldForMatch(option.label).includes(needle)) return true;\n if (option.group !== undefined && foldForMatch(option.group).includes(needle)) return true;\n return option.keywords?.some((keyword) => foldForMatch(keyword).includes(needle)) ?? false;\n}\n\n/** The rows a typed query keeps, in order. */\nexport function filterOptions<TValue extends string, TMeta>(\n options: readonly Option<TValue, TMeta>[],\n query: string,\n): Option<TValue, TMeta>[] {\n return options.filter((option) => optionMatches(option, query));\n}\n\n/* ── Selection: single `TValue | null`, multiple `TValue[]` (§32 \"Value\") ── */\n\n/**\n * The value of a list-shaped control, discriminated by `multiple`\n * (§32 \"Value\"): a single pick is `TValue | null`, a multi pick is `TValue[]`.\n *\n * @experimental\n */\nexport type SelectionValue<TValue extends string, Multiple extends boolean> = Multiple extends true\n ? TValue[]\n : TValue | null;\n\n/**\n * A single value at the boundary: `\"\"` and `undefined` both mean empty in the\n * 2.x line (§32 \"Compat\": `Select` keeps `value=\"\"`/`undefined` as empty), and\n * the control reasons about `null` from here on.\n */\nexport function normalizeSingleValue<TValue extends string>(\n value: TValue | \"\" | null | undefined,\n): TValue | null {\n return value === undefined || value === null || value === \"\" ? null : value;\n}\n\n/**\n * A multi value at the boundary: `undefined`/`null` is the empty array; empty\n * strings are dropped, so a legacy comma-joined `\"a,,b\"` split by the caller\n * cannot smuggle an empty pick in.\n */\nexport function normalizeMultipleValue<TValue extends string>(\n value: readonly (TValue | \"\")[] | null | undefined,\n): TValue[] {\n if (value === undefined || value === null) return [];\n return value.filter((entry): entry is TValue => entry !== \"\");\n}\n\n/** Whether `optionValue` is picked, for either arity of selection. */\nexport function isValueSelected<TValue extends string>(\n selection: TValue | null | readonly TValue[],\n optionValue: TValue,\n): boolean {\n if (selection === null) return false;\n if (typeof selection === \"string\") return selection === optionValue;\n return selection.includes(optionValue);\n}\n\n/** A multi selection with `optionValue` added or removed, order preserved. */\nexport function toggleValue<TValue extends string>(\n selection: readonly TValue[],\n optionValue: TValue,\n): TValue[] {\n return selection.includes(optionValue)\n ? selection.filter((entry) => entry !== optionValue)\n : [...selection, optionValue];\n}\n\n/**\n * The next selection after activating a row, for either arity: a single pick\n * replaces (or, with `clearable`, clears when the same row is activated\n * again); a multi pick toggles. `multiple` discriminates the selection type\n * in and out.\n */\nexport function selectValue<TValue extends string, Multiple extends boolean = false>(\n selection: SelectionValue<TValue, Multiple>,\n optionValue: TValue,\n options: { multiple?: Multiple; clearable?: boolean } = {},\n): SelectionValue<TValue, Multiple> {\n if (options.multiple) {\n const current = Array.isArray(selection) ? (selection as readonly TValue[]) : [];\n return toggleValue(current, optionValue) as SelectionValue<TValue, Multiple>;\n }\n const current = typeof selection === \"string\" ? selection : null;\n const next = options.clearable && current === optionValue ? null : optionValue;\n return next as SelectionValue<TValue, Multiple>;\n}\n","import { optionElementId } from \"./item-attributes\";\nimport { foldForMatch, type Option } from \"./option\";\n\n/**\n * L1a behaviour primitive (private). Not exported from the package.\n *\n * Keyboard navigation of a list-shaped control that drives its own\n * highlight (W4-09; target architecture §32 \"Keyboard/ARIA\": the combobox\n * pattern with `aria-activedescendant` intact). Radix-rendered lists\n * (`Select`, menus) bring their own; this is for the `Combobox` listbox\n * (W4-10), where focus stays in the input and the list only *marks* a row:\n *\n * - {@link nextHighlightedIndex}: ArrowDown/ArrowUp step over disabled rows,\n * Home/End jump, PageDown/PageUp move a page; wrap is opt-in.\n * - {@link typeaheadQuery} + {@link typeaheadMatch}: the WAI-ARIA listbox\n * typeahead — printable keys within a second concatenate into one query\n * matched against the start of each label; a repeated single character\n * cycles through the rows that start with it.\n * - {@link reconcileHighlight}: after the rows change (a filter, an async\n * load) the highlighted *value* is kept if it is still there, else the\n * first enabled row takes it — never a stale index.\n * - {@link activeDescendantId}: what `aria-activedescendant` names, derived\n * from the list id and the highlighted row's value (see\n * `item-attributes.ts`), or `undefined` when nothing is highlighted so the\n * attribute is dropped rather than left dangling.\n *\n * Every function is pure — index in, index out — so the same code answers a\n * unit test and a component's `onKeyDown`, and nothing here touches the DOM.\n */\n\n/** The one thing a row needs to say for navigation: whether it can be landed on. */\nexport interface NavigableRow {\n disabled?: boolean | undefined;\n}\n\n/** The index of the first enabled row at or after `from`, or `null` when none. */\nexport function firstEnabledIndex(rows: readonly NavigableRow[], from = 0): number | null {\n for (let index = Math.max(0, from); index < rows.length; index += 1) {\n if (!rows[index]?.disabled) return index;\n }\n return null;\n}\n\n/** The index of the last enabled row at or before `from`, or `null` when none. */\nexport function lastEnabledIndex(\n rows: readonly NavigableRow[],\n from = rows.length - 1,\n): number | null {\n for (let index = Math.min(rows.length - 1, from); index >= 0; index -= 1) {\n if (!rows[index]?.disabled) return index;\n }\n return null;\n}\n\n/**\n * The enabled row `steps` away from `from` in `direction`, skipping disabled\n * rows. Past either end: stays on the last enabled row in that direction, or\n * wraps to the other end with `loop`. From `null` (nothing highlighted) a step\n * down lands on the first enabled row and a step up on the last.\n */\nexport function stepEnabledIndex(\n rows: readonly NavigableRow[],\n from: number | null,\n direction: 1 | -1,\n { loop = false, steps = 1 }: { loop?: boolean; steps?: number } = {},\n): number | null {\n if (rows.length === 0) return null;\n if (from === null) {\n return direction === 1 ? firstEnabledIndex(rows) : lastEnabledIndex(rows);\n }\n let current: number = from;\n for (let taken = 0; taken < steps; taken += 1) {\n const candidate: number | null =\n direction === 1 ? firstEnabledIndex(rows, current + 1) : lastEnabledIndex(rows, current - 1);\n if (candidate === null) {\n if (loop && taken === 0) {\n const wrapped = direction === 1 ? firstEnabledIndex(rows) : lastEnabledIndex(rows);\n return wrapped ?? from;\n }\n break;\n }\n current = candidate;\n }\n return current;\n}\n\nexport interface ListNavigationOptions {\n /** Whether ArrowDown on the last row wraps to the first (and the reverse). Default off. */\n loop?: boolean | undefined;\n /** Rows a PageDown/PageUp moves. Default 10. */\n pageSize?: number | undefined;\n /** Which arrow pair navigates; `vertical` by default. */\n orientation?: \"vertical\" | \"horizontal\" | undefined;\n}\n\nconst NAVIGATION_KEYS = new Set([\n \"ArrowDown\",\n \"ArrowUp\",\n \"ArrowRight\",\n \"ArrowLeft\",\n \"Home\",\n \"End\",\n \"PageDown\",\n \"PageUp\",\n]);\n\n/** Whether `key` is one {@link nextHighlightedIndex} handles for the orientation. */\nexport function isListNavigationKey(\n key: string,\n orientation: \"vertical\" | \"horizontal\" = \"vertical\",\n): boolean {\n if (!NAVIGATION_KEYS.has(key)) return false;\n if (orientation === \"vertical\") return key !== \"ArrowRight\" && key !== \"ArrowLeft\";\n return key !== \"ArrowDown\" && key !== \"ArrowUp\";\n}\n\n/**\n * The row a navigation key moves the highlight to: the new index, `null` when\n * the list has no enabled row, or `undefined` when `key` is not a navigation\n * key for this orientation (the caller lets the event through). Only a\n * handled key should have its default prevented.\n */\nexport function nextHighlightedIndex(\n rows: readonly NavigableRow[],\n highlighted: number | null,\n key: string,\n { loop = false, pageSize = 10, orientation = \"vertical\" }: ListNavigationOptions = {},\n): number | null | undefined {\n if (!isListNavigationKey(key, orientation)) return undefined;\n switch (key) {\n case \"ArrowDown\":\n case \"ArrowRight\":\n return stepEnabledIndex(rows, highlighted, 1, { loop });\n case \"ArrowUp\":\n case \"ArrowLeft\":\n return stepEnabledIndex(rows, highlighted, -1, { loop });\n case \"Home\":\n return firstEnabledIndex(rows);\n case \"End\":\n return lastEnabledIndex(rows);\n case \"PageDown\":\n return stepEnabledIndex(rows, highlighted, 1, { steps: pageSize });\n case \"PageUp\":\n return stepEnabledIndex(rows, highlighted, -1, { steps: pageSize });\n default:\n return undefined;\n }\n}\n\n/* ── Typeahead ──────────────────────────────────────────────────────────── */\n\n/** Keys typed within this many milliseconds of each other form one query. */\nexport const TYPEAHEAD_TIMEOUT = 1000;\n\nexport interface TypeaheadState {\n query: string;\n /** When the last character arrived, in the caller's clock (`Date.now()`). */\n at: number;\n}\n\n/**\n * Whether a keyboard event is a typeahead character: one printable character\n * with no Ctrl/Meta/Alt. Space counts, so \"in review\" can be typed; a listbox\n * that selects on Space handles that first.\n */\nexport function isTypeaheadKey(event: {\n key: string;\n ctrlKey?: boolean;\n metaKey?: boolean;\n altKey?: boolean;\n}): boolean {\n return event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey;\n}\n\n/**\n * The query after one more character: appended when it arrives within\n * `timeout` of the previous one, else a fresh query of that character.\n */\nexport function typeaheadQuery(\n previous: TypeaheadState | null,\n character: string,\n now: number,\n timeout = TYPEAHEAD_TIMEOUT,\n): TypeaheadState {\n const continues = previous !== null && now - previous.at <= timeout;\n return { query: continues ? previous.query + character : character, at: now };\n}\n\n/**\n * The row a typeahead query lands on, or `null` when no label starts with it.\n * Searches forward from the row *after* `from`, wrapping, so repeating the\n * same character cycles through every row that starts with it (a query of\n * one repeated character is matched as that character). Disabled rows are\n * skipped. Matching is case- and diacritic-insensitive.\n */\nexport function typeaheadMatch(\n rows: readonly (NavigableRow & { label: string })[],\n query: string,\n from: number | null,\n): number | null {\n if (rows.length === 0 || query.length === 0) return null;\n const repeated = query.length > 1 && query.split(\"\").every((character) => character === query[0]);\n const needle = foldForMatch(repeated ? (query[0] ?? \"\") : query);\n if (needle.length === 0) return null;\n // A fresh multi-character query should still find the row it started on\n // (\"dr\" typed on \"Draft\" stays on \"Draft\"); a repeated character moves on.\n const start = from === null ? 0 : repeated || query.length === 1 ? from + 1 : from;\n for (let offset = 0; offset < rows.length; offset += 1) {\n const index = (start + offset) % rows.length;\n const row = rows[index];\n if (!row || row.disabled) continue;\n if (foldForMatch(row.label).startsWith(needle)) return index;\n }\n return null;\n}\n\n/* ── Highlight bookkeeping ──────────────────────────────────────────────── */\n\n/**\n * The highlighted value after the rows changed. Keeps `highlightedValue`\n * when an enabled row still carries it; otherwise `fallback` decides: the\n * first enabled row (`\"first\"`, what a filtering combobox does so Enter\n * always has a target) or nothing (`\"none\"`).\n */\nexport function reconcileHighlight<TValue extends string>(\n rows: readonly (NavigableRow & { value: TValue })[],\n highlightedValue: TValue | null,\n fallback: \"first\" | \"none\" = \"first\",\n): TValue | null {\n if (highlightedValue !== null) {\n const kept = rows.find((row) => row.value === highlightedValue && !row.disabled);\n if (kept) return kept.value;\n }\n if (fallback === \"none\") return null;\n const first = firstEnabledIndex(rows);\n return first === null ? null : (rows[first]?.value ?? null);\n}\n\n/** The index of `value` among the rows, or `null`. */\nexport function indexOfValue<TValue extends string>(\n rows: readonly { value: TValue }[],\n value: TValue | null,\n): number | null {\n if (value === null) return null;\n const index = rows.findIndex((row) => row.value === value);\n return index === -1 ? null : index;\n}\n\n/**\n * What the input's `aria-activedescendant` names: the id of the highlighted\n * row, or `undefined` so the attribute is omitted when nothing is\n * highlighted (a dangling reference fails axe `aria-valid-attr-value`).\n */\nexport function activeDescendantId(\n listId: string,\n rows: readonly Pick<Option, \"value\">[],\n highlighted: number | null,\n): string | undefined {\n if (highlighted === null || highlighted < 0 || highlighted >= rows.length) return undefined;\n const row = rows[highlighted];\n return row ? optionElementId(listId, row.value) : undefined;\n}\n","\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport { RemoveScroll } from \"react-remove-scroll\";\n\n/**\n * L1a behaviour primitive (private). Not exported from the package.\n *\n * A scroll region that keeps scrolling while a modal overlay locks the page\n * (W4-10; target architecture §32 \"Overlay safety\").\n *\n * A Radix `Dialog` or `Sheet` locks page scroll with react-remove-scroll,\n * which swallows wheel and touch events on everything outside the dialog's\n * own subtree. A picker's listbox is portalled to `<body>`, so it *is*\n * outside: the list opens but does not scroll — the incident that made PRO\n * re-implement five pickers inline (consumer usage audit §28). Mounting a\n * second `RemoveScroll` inside the portalled surface makes that surface the\n * innermost lock while it is open: events inside it are allowed, the page\n * stays locked, and the lock pops off when the surface unmounts.\n *\n * `removeScrollBar={false}`: the outer overlay already compensated for the\n * scrollbar; a second compensation would shift the layout. `contents` adds no\n * box of its own. Rendered only while `active`, so a surface that is not\n * inside a modal overlay pays nothing.\n *\n * This is the one place the package imports `react-remove-scroll` outside\n * Radix; `SearchSelect` used to import it directly (import-hygiene baseline).\n */\nexport function NestedScrollLock({\n active = true,\n children,\n}: {\n active?: boolean;\n children: ReactNode;\n}) {\n if (!active) return <>{children}</>;\n return (\n <RemoveScroll removeScrollBar={false} className=\"ds:contents\">\n {children}\n </RemoveScroll>\n );\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport type { ReactNode } from \"react\";\n\nimport { comboboxAnatomy, type ComboboxSlot } from \"../foundation/anatomy/slots\";\nimport { slot, stateAttributes } from \"../foundation/anatomy/slot\";\nimport { useId } from \"../foundation/id\";\nimport { useMergedRefs } from \"../foundation/merge-refs\";\nimport { EN_MESSAGES } from \"../foundation/messages/en\";\nimport type { ComboboxMessages } from \"../foundation/messages/types\";\nimport { useDsMessages } from \"../foundation/provider/context\";\nimport { useControllableState } from \"../foundation/use-controllable-state\";\nimport type { ControlSize } from \"../foundation/vocab\";\nimport { cn } from \"../lib/cn\";\nimport { microInteractions } from \"../lib/micro-interactions\";\n\nimport { listItemAttributes, optionElementId } 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 {\n activeDescendantId,\n indexOfValue,\n nextHighlightedIndex,\n reconcileHighlight,\n} from \"./behavior/collection/keyboard\";\nimport {\n filterOptions,\n findOption,\n foldForMatch,\n groupOptions,\n normalizeMultipleValue,\n normalizeSingleValue,\n toOptions,\n toggleValue,\n type Option,\n type OptionAccessors,\n} from \"./behavior/collection/option\";\nimport { FormBridge } from \"./behavior/form-bridge\";\nimport { NestedScrollLock } from \"./behavior/nested-scroll-lock\";\nimport { Chip } from \"./chip\";\nimport { useFieldControl } from \"./field/use-field-control\";\nimport { IconButton } from \"./icon-button\";\nimport { CheckIcon, ChevronDownIcon, PlusIcon, XIcon } from \"./icons\";\nimport { Popover, PopoverAnchor, PopoverContent } from \"./popover\";\nimport { Spinner } from \"./spinner\";\n\n/** The combobox parts (ADR-008). See the registry for the doc comment. */\nexport type { ComboboxSlot };\n/** The option model the combobox reads (target architecture §32). @experimental */\nexport type { Option, OptionAccessors };\n\n/* ────────────────────────────────────────────────────────────────────────────\n * Combobox — the searchable pick (W4-10; target architecture §32).\n *\n * One text input with the `combobox` role that keeps focus, a portalled\n * listbox in a `Popover` (so it is not clipped inside a `Dialog` or a `Sheet`\n * and scrolls there — `NestedScrollLock`), and the shared collection\n * internals for what a row is (`Option`, accessors), how it looks\n * (`listItemClasses`), what it carries (`listItemAttributes`) and how the\n * keyboard moves over it (`nextHighlightedIndex`, `aria-activedescendant`).\n *\n * - **Options**: `Option`s, plain strings, or domain objects with\n * `getOptionValue` / `getOptionLabel` (+ `getOptionDisabled`,\n * `getOptionGroup`, `getOptionKeywords`). Emptiness is `value === null`,\n * never a sentinel row; `\"\"` folds to `null` at the boundary (2.x compat).\n * - **Field**: `useFieldControl` names the input from the surrounding `Field`\n * (`aria-labelledby`, `aria-describedby`, invalid/required/disabled); a\n * standalone combobox takes `aria-label` — the development error of W4-02\n * fires otherwise. This is the accessible name `SearchSelect` never had.\n * - **Form**: `FormBridge` submits `name=value` (`name=\"\"` when empty, like a\n * named `Select`), blocks a `required` submission while empty, follows the\n * form's `reset` back to `defaultValue`, and submits nothing while disabled.\n * - **Async**: `loading` shows a spinner and the loading state; `onSearchChange`\n * receives every query; `shouldFilter={false}` hands the filtering to the\n * consumer (the options are the server's answer).\n * - **Create**: `onCreate(query)` renders a \"Create …\" row when the trimmed\n * query matches no label exactly.\n * - **Rendering**: `renderOption(option, state)` replaces the row's content,\n * `renderValue(option)` the closed control's text; `header` / `footer`\n * sit around the list inside the popover; `emptyState` / `loadingState`\n * replace the default messages; `messages` localises every string.\n * - **Keyboard**: ArrowDown/ArrowUp open and move the highlight (disabled\n * rows skipped), Home/End/PageUp/PageDown move it while open, typing\n * filters and highlights the first match, Enter picks the highlighted row,\n * Escape closes (and stops there, so a surrounding Dialog stays open), Tab\n * closes without picking. The input keeps focus throughout; the highlighted\n * row is `aria-activedescendant`, stamped `data-highlighted`.\n *\n * - **Multiple** (W4-11): `multiple` discriminates the value (`TValue[]`),\n * the change handler and `renderValue`. Picks toggle and the list stays\n * open; the picked rows render as `Chip`s inside the control, each with a\n * \"Remove {label}\" button; Backspace in an empty input removes the last\n * chip; `FormBridge` submits one `name` entry per value (`getAll(name)`);\n * `hideSelected` drops picked rows from the list. `MultiSelect` is this\n * preset under its own name.\n *\n * `size` reads the shared control scale (A1): `md` is the 36px / 13px field\n * of today's `SearchSelect`.\n * ──────────────────────────────────────────────────────────────────────────── */\n\n/**\n * Every string the combobox renders: prop > `DesignSystemProvider\n * messages.combobox` > English (W5-20, ADR-010). Deterministic defaults (A3).\n *\n * @experimental\n */\nexport type { ComboboxMessages };\n\n/** The English defaults (the `combobox` namespace of the catalogue). */\nexport const DEFAULT_COMBOBOX_MESSAGES: ComboboxMessages = EN_MESSAGES.combobox;\n\n/** The sizes a combobox offers: the shared control scale (A1). @experimental */\nexport type ComboboxSize = ControlSize;\n\n/** What `renderOption` is told about the row it renders. @experimental */\nexport interface ComboboxOptionState {\n selected: boolean;\n highlighted: boolean;\n disabled: boolean;\n}\n\n/**\n * Class overrides per part, for the consumer who must restyle one slot\n * without reaching into the DOM.\n *\n * @experimental\n */\nexport interface ComboboxClassNames {\n root?: string;\n control?: string;\n input?: string;\n chip?: string;\n content?: string;\n list?: string;\n item?: string;\n}\n\n/** @experimental */\nexport interface ComboboxBaseProps<TItem, TValue extends string> extends Partial<\n OptionAccessors<TItem, TValue>\n> {\n /** The rows: `Option`s, strings, or domain objects read through the accessors. */\n options: readonly TItem[];\n id?: string | undefined;\n /** The form field name. Without it nothing is submitted. */\n name?: string | undefined;\n /** The `id` of the form to submit with when the control is rendered outside it. */\n form?: string | undefined;\n required?: boolean | undefined;\n disabled?: boolean | undefined;\n readOnly?: boolean | undefined;\n invalid?: boolean | undefined;\n /** The accessible name of a combobox outside a `Field`. */\n \"aria-label\"?: string | undefined;\n \"aria-labelledby\"?: string | undefined;\n \"aria-describedby\"?: string | undefined;\n placeholder?: string | undefined;\n /** Outer height from the shared control scale. Default `md` (36px). */\n size?: ComboboxSize | undefined;\n /** A leading glyph inside the control, decorative. */\n icon?: ReactNode | undefined;\n /** Show a clear button while a value is set. Default `true`. */\n clearable?: boolean | undefined;\n /** Open the list when the input receives focus. Default `false`. */\n openOnFocus?: boolean | undefined;\n /** Whether the list surface flips to stay in the viewport. Default `true`. */\n avoidCollisions?: boolean | undefined;\n\n open?: boolean | undefined;\n defaultOpen?: boolean | undefined;\n onOpenChange?: ((open: boolean) => void) | undefined;\n\n /** The typed query (controlled). */\n search?: string | undefined;\n defaultSearch?: string | undefined;\n /** Called with every query the user types (an async source fetches here). */\n onSearchChange?: ((query: string) => void) | undefined;\n /**\n * Filter `options` by the query (`true`, the default). `false` when the\n * consumer filters — the options are already the answer to the query.\n */\n shouldFilter?: boolean | undefined;\n\n /** An async source is fetching: a spinner in the control, `loadingState` in the list. */\n loading?: boolean | undefined;\n emptyState?: ReactNode | undefined;\n loadingState?: ReactNode | undefined;\n /** Rendered above the list, inside the popover. */\n header?: ReactNode | undefined;\n /** Rendered below the list, inside the popover. */\n footer?: ReactNode | undefined;\n\n /** Offer a \"Create …\" row for a query that matches no option exactly. */\n onCreate?: ((query: string) => void) | undefined;\n\n /** Replaces the content of a row. */\n renderOption?:\n | ((option: Option<TValue, unknown>, state: ComboboxOptionState) => ReactNode)\n | undefined;\n\n messages?: Partial<ComboboxMessages> | undefined;\n className?: string | undefined;\n classNames?: ComboboxClassNames | undefined;\n /** The input element. */\n ref?: React.Ref<HTMLInputElement> | undefined;\n}\n\n/** @experimental */\nexport interface ComboboxSingleProps<TItem, TValue extends string> extends ComboboxBaseProps<\n TItem,\n TValue\n> {\n multiple?: false | undefined;\n /** The picked value, or `null`. `\"\"` means empty (2.x compat). */\n value?: TValue | \"\" | null | undefined;\n defaultValue?: TValue | \"\" | null | undefined;\n onValueChange?:\n | ((value: TValue | null, details: { option: Option<TValue, unknown> | null }) => void)\n | undefined;\n /** Replaces the closed control's text for the picked option. */\n renderValue?: ((option: Option<TValue, unknown>) => ReactNode) | undefined;\n /** Close the list after a pick. Default `true`. */\n closeOnSelect?: boolean | undefined;\n}\n\n/** What `renderValue` receives in `multiple` mode besides the picked options. @experimental */\nexport interface ComboboxSelectionControls<TValue extends string> {\n /** Removes one value from the selection. */\n remove: (value: TValue) => void;\n}\n\n/** @experimental */\nexport interface ComboboxMultipleProps<TItem, TValue extends string> extends ComboboxBaseProps<\n TItem,\n TValue\n> {\n multiple: true;\n /** The picked values, in pick order. Empty strings are dropped. */\n value?: readonly (TValue | \"\")[] | undefined;\n defaultValue?: readonly (TValue | \"\")[] | undefined;\n onValueChange?:\n | ((value: TValue[], details: { option: Option<TValue, unknown> | null }) => void)\n | undefined;\n /**\n * Replaces the chips inside the control: called with the picked options\n * and `remove`. Return `null` to render nothing there.\n */\n renderValue?:\n | ((\n options: Option<TValue, unknown>[],\n controls: ComboboxSelectionControls<TValue>,\n ) => ReactNode)\n | undefined;\n /** Close the list after a pick. Default `false`: keep picking. */\n closeOnSelect?: boolean | undefined;\n /** Drop picked rows from the list (the chips already show them). Default `false`. */\n hideSelected?: boolean | undefined;\n}\n\n/**\n * The props, discriminated by `multiple` (target architecture §32 \"Value\"):\n * a single pick is `TValue | null`, a multi pick is `TValue[]`.\n *\n * @experimental\n */\nexport type ComboboxProps<TItem = Option, TValue extends string = string> =\n | ComboboxSingleProps<TItem, TValue>\n | ComboboxMultipleProps<TItem, TValue>;\n\n/** Size rows: min height (chips may wrap), start padding, label, gap, glyph — per control size. */\nconst CONTROL_SIZE: Readonly<Record<ComboboxSize, string>> = {\n xs: \"ds:min-h-(--control-height-xs) ds:ps-(--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:min-h-(--control-height-sm) ds:ps-(--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:min-h-(--control-height-md) ds:ps-(--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:min-h-(--control-height-lg) ds:ps-(--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:min-h-(--control-height-xl) ds:ps-(--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/** The end buttons are one size smaller than the control, so they sit inside it. */\nconst BUTTON_SIZE: Readonly<Record<ComboboxSize, ControlSize>> = {\n xs: \"xs\",\n sm: \"xs\",\n md: \"xs\",\n lg: \"sm\",\n xl: \"md\",\n};\n\n/**\n * The field chrome, on the frame around the input rather than on the input\n * itself: the same box, border, focus edge + halo, invalid and disabled\n * treatment as `controlChrome`, keyed on `focus-within` and the root's state\n * attributes because the frame is not the focusable element.\n */\nconst CONTROL_FRAME = [\n \"ds:relative ds:flex ds:w-full ds:flex-wrap ds:items-center ds:rounded-input ds:border ds:border-field-border ds:bg-surface ds:font-body ds:text-fg ds:pe-1\",\n microInteractions.control,\n \"ds:not-data-disabled:hover:border-field-border-hover\",\n \"ds:focus-within:[border-color:var(--focus-ring-border)] ds:focus-within:[box-shadow:var(--shadow-focus-ring-field)]\",\n \"ds:data-[invalid]:border-field-border-invalid ds:data-[invalid]:focus-within:border-danger-fg\",\n \"ds:data-[invalid]:focus-within:[box-shadow:0_0_0_2px_var(--color-danger-bg)]\",\n \"ds:data-[disabled]:cursor-not-allowed ds:data-[disabled]:bg-bg-disabled ds:data-[disabled]:text-fg-disabled\",\n].join(\" \");\n\n// `ds:[font:inherit]`: the input takes the control's size-scale type. Without it an\n// app's own base rule (`input { font-size: 1rem }`) wins, because the size class sits on\n// the control frame and the <input> element is the one the base rule targets.\nconst INPUT_CLASSES =\n \"ds:min-w-16 ds:flex-1 ds:self-stretch ds:bg-transparent ds:py-0 ds:[font:inherit] ds:text-inherit ds:outline-none ds:placeholder:text-fg-4 ds:disabled:cursor-not-allowed ds:read-only:cursor-default\";\n\nconst LABEL_SIZE = \"ds:text-(length:--control-font-size-md)\";\nconst SMALL_TEXT = \"ds:text-(length:--control-font-size-xs)\";\n\nconst ITEM_CLASSES = listItemClasses({\n frame: \"select\",\n labelSize: LABEL_SIZE,\n palette: \"neutral\",\n highlight: \"data-highlighted\",\n selected: \"aria-selected\",\n});\n\nconst CREATE_ITEM_CLASSES = cn(\n ITEM_CLASSES,\n \"ds:text-brand ds:data-[highlighted]:bg-brand-bg ds:data-[highlighted]:text-brand\",\n);\n\nconst GROUP_HEADING_CLASSES = groupHeadingClasses({ palette: \"neutral\", labelSize: SMALL_TEXT });\n\nconst STATE_CLASSES = cn(\"ds:text-fg-3 ds:px-3 ds:py-2\", SMALL_TEXT);\n\n/**\n * The value of the create row inside the list. A control character no\n * consumer value carries, so `optionElementId` never collides with a row.\n */\nconst CREATE_ROW = \"\\u0000create\";\n\n/**\n * C-CMDK-ATTR: a `SearchSelect` rendered through the combobox still stamps\n * `cmdk-item=\"\"` on its rows. Since 2.0 this is not guaranteed and may go in\n * any 2.x release; `[data-slot=combobox-item]` / role `option` is the\n * contract. Provided by the adapter, never public.\n */\nexport const CmdkCompatContext = React.createContext(false);\n\n/**\n * The searchable pick: one input, a portalled listbox, the option model.\n * See the module comment.\n *\n * @experimental\n */\nexport function Combobox<TItem = Option, TValue extends string = string>(\n props: ComboboxProps<TItem, TValue>,\n) {\n const {\n options: items,\n getOptionValue,\n getOptionLabel,\n getOptionDisabled,\n getOptionGroup,\n getOptionKeywords,\n id: idProp,\n name: nameProp,\n form,\n required: requiredProp,\n disabled: disabledProp,\n readOnly: readOnlyProp,\n invalid: invalidProp,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n placeholder,\n size = \"md\",\n icon,\n clearable = true,\n openOnFocus = false,\n avoidCollisions = true,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n search: searchProp,\n defaultSearch = \"\",\n onSearchChange,\n shouldFilter = true,\n loading = false,\n emptyState,\n loadingState,\n header,\n footer,\n onCreate,\n renderOption,\n messages: messagesProp,\n className,\n classNames,\n ref,\n } = props;\n const multiple = props.multiple === true;\n const closeOnSelect = props.closeOnSelect ?? !multiple;\n const hideSelected = props.multiple === true && props.hideSelected === true;\n\n const messages = useDsMessages(\"combobox\", messagesProp);\n\n const accessors = React.useMemo<OptionAccessors<TItem, TValue> | undefined>(() => {\n if (!getOptionValue || !getOptionLabel) return undefined;\n return {\n getOptionValue,\n getOptionLabel,\n getOptionDisabled,\n getOptionGroup,\n getOptionKeywords,\n };\n }, [getOptionValue, getOptionLabel, getOptionDisabled, getOptionGroup, getOptionKeywords]);\n\n const options = React.useMemo(() => toOptions(items, accessors), [items, accessors]);\n\n /* ── Field wiring ──────────────────────────────────────────────────────── */\n\n // `native: false`: the input must not carry the native `required` — that\n // would validate the typed text, not the value. FormBridge's proxy does it,\n // and the wiring mirrors `aria-required` on the input.\n const wiring = useFieldControl({\n id: idProp,\n name: nameProp,\n invalid: invalidProp,\n required: requiredProp,\n disabled: disabledProp,\n readOnly: readOnlyProp,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n native: false,\n });\n const disabled = wiring.disabled ?? false;\n const readOnly = wiring.readOnly ?? false;\n const inert = disabled || readOnly;\n const listId = useId(undefined, `${wiring.id}-list`);\n\n /* ── State ─────────────────────────────────────────────────────────────── */\n\n // One internal shape for both arities: the picked values in order (a\n // single pick is zero or one). `\"\"` and `undefined` fold to empty (2.x).\n const toSelection = (raw: unknown): TValue[] | undefined => {\n if (raw === undefined) return undefined;\n if (multiple) return normalizeMultipleValue(raw as readonly (TValue | \"\")[] | null);\n const single = normalizeSingleValue(raw as TValue | \"\" | null);\n return single === null ? [] : [single];\n };\n const defaultSelection = React.useMemo(\n () => toSelection(props.defaultValue) ?? [],\n // eslint-disable-next-line react-hooks/exhaustive-deps -- read once, like a default should be\n [],\n );\n const [selection, setSelectionState] = useControllableState<TValue[]>({\n prop: toSelection(props.value),\n defaultProp: defaultSelection,\n });\n const value: TValue | null = multiple ? null : (selection[0] ?? null);\n const [openState, setOpenState] = useControllableState<boolean>({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n });\n const open = openState && !inert;\n const [search, setSearchState] = useControllableState<string>({\n prop: searchProp,\n defaultProp: defaultSearch,\n onChange: onSearchChange,\n });\n\n const selectedOption = React.useMemo(() => findOption(options, value), [options, value]);\n const selectedOptions = React.useMemo(\n () =>\n selection\n .map((entry) => findOption(options, entry))\n .filter((option): option is Option<TValue, unknown> => option !== undefined),\n [options, selection],\n );\n\n const inputRef = React.useRef<HTMLInputElement>(null);\n const controlRef = React.useRef<HTMLDivElement>(null);\n const mergedInputRef = useMergedRefs<HTMLInputElement>(inputRef, ref, wiring.ref);\n\n // Emits through the arity's own handler; `option` is the row that was\n // activated (or `null` for a clear / reset).\n const commitSelection = React.useCallback(\n (next: TValue[], option: Option<TValue, unknown> | null) => {\n setSelectionState(next);\n const changed =\n next.length !== selection.length || next.some((entry, index) => entry !== selection[index]);\n if (!changed) return;\n if (props.multiple === true) props.onValueChange?.(next, { option });\n else props.onValueChange?.(next[0] ?? null, { option });\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps -- `props` is read for the discriminant\n [setSelectionState, selection, props.multiple, props.onValueChange],\n );\n const setValue = React.useCallback(\n (next: TValue | null) =>\n commitSelection(next === null ? [] : [next], findOption(options, next) ?? null),\n [commitSelection, options],\n );\n const removeValue = React.useCallback(\n (entry: TValue) =>\n commitSelection(\n selection.filter((current) => current !== entry),\n findOption(options, entry) ?? null,\n ),\n [commitSelection, selection, options],\n );\n\n const setOpen = React.useCallback(\n (next: boolean) => {\n if (next && inert) return;\n setOpenState(next);\n // A fresh query on every open; the closed control shows the value.\n if (!next) setSearchState(\"\");\n },\n [inert, setOpenState, setSearchState],\n );\n\n /* ── Rows ──────────────────────────────────────────────────────────────── */\n\n const trimmed = search.trim();\n const visibleOptions = React.useMemo(() => {\n const filtered = shouldFilter ? filterOptions(options, search) : options;\n return hideSelected ? filtered.filter((option) => !selection.includes(option.value)) : filtered;\n }, [options, search, shouldFilter, hideSelected, selection]);\n const showCreate =\n onCreate !== undefined &&\n trimmed.length > 0 &&\n !options.some((option) => foldForMatch(option.label) === foldForMatch(trimmed));\n\n // Rows render grouped (a group's rows are consecutive, in order of first\n // appearance), so the navigable order is the grouped order, then the\n // create row.\n const groups = React.useMemo(() => groupOptions(visibleOptions), [visibleOptions]);\n const hasGroups = groups.some((group) => group.group !== undefined);\n const rows = React.useMemo<Option<TValue, unknown>[]>(() => {\n const list = groups.flatMap((group) => group.options);\n if (showCreate) list.push({ value: CREATE_ROW as TValue, label: messages.create(trimmed) });\n return list;\n }, [groups, showCreate, messages, trimmed]);\n\n const [highlightedValue, setHighlightedValue] = React.useState<TValue | null>(null);\n const highlightedIndex = indexOfValue(rows, highlightedValue);\n\n // After the rows change (a keystroke, an async load) the highlight stays on\n // its row when that row is still there, else the first enabled row takes it.\n React.useEffect(() => {\n if (!open) return;\n setHighlightedValue((current) => reconcileHighlight(rows, current, \"first\"));\n }, [open, rows]);\n\n // Opening lands the highlight on the picked row, so Enter keeps it.\n const openList = React.useCallback(() => {\n if (open) return;\n setHighlightedValue(value !== null && findOption(rows, value) ? value : null);\n setOpen(true);\n }, [open, rows, setOpen, value]);\n\n const scrollHighlightedIntoView = React.useCallback(() => {\n const id = activeDescendantId(listId, rows, highlightedIndex);\n if (!id) return;\n document.getElementById(id)?.scrollIntoView({ block: \"nearest\" });\n }, [listId, rows, highlightedIndex]);\n React.useEffect(() => {\n if (open) scrollHighlightedIntoView();\n }, [open, scrollHighlightedIntoView]);\n\n /* ── Actions ───────────────────────────────────────────────────────────── */\n\n const focusInput = () => inputRef.current?.focus();\n\n const activateRow = React.useCallback(\n (option: Option<TValue, unknown>) => {\n if (option.disabled) return;\n if (option.value === CREATE_ROW) {\n onCreate?.(trimmed);\n setOpen(false);\n return;\n }\n if (multiple) commitSelection(toggleValue(selection, option.value), option);\n else setValue(clearable && option.value === value ? null : option.value);\n if (closeOnSelect) setOpen(false);\n else setSearchState(\"\");\n },\n [\n onCreate,\n trimmed,\n setOpen,\n multiple,\n commitSelection,\n selection,\n setValue,\n clearable,\n value,\n closeOnSelect,\n setSearchState,\n ],\n );\n\n const clear = () => {\n commitSelection([], null);\n setSearchState(\"\");\n focusInput();\n };\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (inert) return;\n if (event.key === \"Escape\") {\n if (!open) return;\n // Stop here: a surrounding Dialog or Sheet must not close as well.\n event.preventDefault();\n event.stopPropagation();\n setOpen(false);\n return;\n }\n if (event.key === \"Tab\") {\n if (open) setOpen(false);\n return;\n }\n if (event.key === \"Backspace\" && multiple && event.currentTarget.value === \"\") {\n const last = selection[selection.length - 1];\n if (last !== undefined) {\n event.preventDefault();\n removeValue(last);\n }\n return;\n }\n if (event.key === \"Enter\") {\n if (!open) return;\n // Never submits the form while the list is open.\n event.preventDefault();\n const row = highlightedIndex === null ? undefined : rows[highlightedIndex];\n if (row) activateRow(row);\n return;\n }\n if (!open && (event.key === \"ArrowDown\" || event.key === \"ArrowUp\")) {\n event.preventDefault();\n openList();\n return;\n }\n if (!open) return;\n const next = nextHighlightedIndex(rows, highlightedIndex, event.key);\n if (next === undefined) return;\n event.preventDefault();\n setHighlightedValue(next === null ? null : (rows[next]?.value ?? null));\n };\n\n /* ── Render ────────────────────────────────────────────────────────────── */\n\n const displayValue = open || multiple ? search : (selectedOption?.label ?? \"\");\n const singleRenderValue = props.multiple === true ? undefined : props.renderValue;\n const showValueNode =\n !open && !multiple && selectedOption !== undefined && singleRenderValue !== undefined;\n const chips =\n props.multiple === true\n ? props.renderValue\n ? props.renderValue(selectedOptions, { remove: removeValue })\n : selectedOptions.map((option) => (\n <Chip\n key={option.value}\n size=\"xs\"\n disabled={disabled}\n className={classNames?.chip}\n removeLabel={messages.remove(option.label)}\n onRemove={readOnly ? undefined : () => removeValue(option.value)}\n >\n {option.label}\n </Chip>\n ))\n : null;\n const hasChips = props.multiple === true && selectedOptions.length > 0;\n const cmdkCompat = React.useContext(CmdkCompatContext);\n const buttonSize = BUTTON_SIZE[size];\n\n const indexByValue = new Map(rows.map((row, index) => [row.value, index] as const));\n\n const renderRow = (option: Option<TValue, unknown>) => {\n const index = indexByValue.get(option.value) ?? -1;\n const highlighted = highlightedIndex === index;\n const selected = selection.includes(option.value);\n const isDisabled = option.disabled === true;\n const attributes = listItemAttributes(comboboxAnatomy, {\n id: optionElementId(listId, option.value),\n highlighted,\n selected,\n disabled: isDisabled,\n cmdkCompat,\n });\n return (\n // The row is `role=\"option\"` (in `attributes`), operated from the input\n // through `aria-activedescendant`: it is never a focus stop of its own.\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions\n <div\n key={option.value}\n {...attributes}\n className={cn(ITEM_CLASSES, classNames?.item)}\n onPointerMove={() => {\n if (!isDisabled && highlightedValue !== option.value) setHighlightedValue(option.value);\n }}\n // Keep focus in the input: the row is a target, not a focus stop.\n // `mousedown`, not `pointerdown`: a prevented pointerdown also drops\n // the `click` under user-event (Storybook play, Testing Library),\n // while a prevented mousedown only keeps the focus where it is.\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => activateRow(option)}\n >\n {renderOption ? (\n renderOption(option, { selected, highlighted, disabled: isDisabled })\n ) : (\n <>\n {option.icon !== undefined && (\n <span className=\"ds:inline-flex ds:shrink-0\" aria-hidden=\"true\">\n {option.icon}\n </span>\n )}\n <span className=\"ds:min-w-0 ds:flex-1\">\n <span className=\"ds:block ds:truncate\">{option.label}</span>\n {option.description !== undefined && (\n <span className={cn(\"ds:text-fg-4 ds:block ds:truncate\", SMALL_TEXT)}>\n {option.description}\n </span>\n )}\n </span>\n </>\n )}\n {selected && (\n <span\n {...slot(comboboxAnatomy, \"item-indicator\")}\n className={LIST_ITEM_INDICATOR_WELL.end}\n >\n <CheckIcon aria-hidden=\"true\" />\n </span>\n )}\n </div>\n );\n };\n\n const createIndex = rows.length - 1;\n const createHighlighted = showCreate && highlightedIndex === createIndex;\n\n return (\n <div\n {...slot(comboboxAnatomy, \"root\")}\n {...stateAttributes({\n state: open ? \"open\" : \"closed\",\n disabled,\n invalid: wiring[\"aria-invalid\"] === true,\n size,\n })}\n className={cn(\"ds:relative ds:w-full\", className, classNames?.root)}\n >\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverAnchor asChild>\n <div\n ref={controlRef}\n {...slot(comboboxAnatomy, \"control\")}\n className={cn(CONTROL_FRAME, CONTROL_SIZE[size], classNames?.control)}\n onPointerDown={(event) => {\n // A press on the frame or the value (not on a button or the\n // input itself) is a press on the input.\n const target = event.target as Element;\n if (inert || target === inputRef.current || target.closest(\"button\")) return;\n event.preventDefault();\n focusInput();\n openList();\n }}\n >\n {icon !== undefined && (\n <span\n {...slot(comboboxAnatomy, \"icon\")}\n className=\"ds:text-fg-4 ds:inline-flex ds:shrink-0\"\n aria-hidden=\"true\"\n >\n {icon}\n </span>\n )}\n {showValueNode && (\n // The custom value takes the input's place in the row; the input\n // keeps the label as its value for assistive technology and\n // collapses to a point until the list opens.\n <span\n {...slot(comboboxAnatomy, \"value\")}\n className=\"ds:pointer-events-none ds:flex ds:min-w-0 ds:flex-1 ds:items-center ds:gap-2 ds:truncate\"\n aria-hidden=\"true\"\n >\n {singleRenderValue!(selectedOption!)}\n </span>\n )}\n {hasChips && chips !== null && (\n <span\n {...slot(comboboxAnatomy, \"chips\")}\n className=\"ds:flex ds:min-w-0 ds:flex-wrap ds:items-center ds:gap-1 ds:py-1\"\n >\n {chips}\n </span>\n )}\n <input\n {...slot(comboboxAnatomy, \"input\")}\n ref={mergedInputRef}\n id={wiring.id}\n type=\"text\"\n role=\"combobox\"\n autoComplete=\"off\"\n spellCheck={false}\n aria-autocomplete=\"list\"\n aria-expanded={open}\n aria-controls={open ? listId : undefined}\n aria-activedescendant={\n open ? activeDescendantId(listId, rows, highlightedIndex) : undefined\n }\n aria-label={ariaLabel}\n aria-labelledby={wiring[\"aria-labelledby\"]}\n aria-describedby={wiring[\"aria-describedby\"]}\n aria-invalid={wiring[\"aria-invalid\"]}\n aria-required={wiring[\"aria-required\"]}\n aria-busy={loading || undefined}\n data-invalid={wiring[\"data-invalid\"]}\n data-disabled={wiring[\"data-disabled\"]}\n disabled={disabled}\n readOnly={readOnly}\n placeholder={selectedOption || hasChips ? undefined : placeholder}\n value={displayValue}\n className={cn(\n INPUT_CLASSES,\n showValueNode && \"ds:absolute ds:size-px ds:min-w-0 ds:flex-none ds:opacity-0\",\n classNames?.input,\n )}\n onChange={(event) => {\n if (inert) return;\n setSearchState(event.target.value);\n if (!open) openList();\n }}\n onFocus={() => {\n if (openOnFocus) openList();\n }}\n onClick={() => openList()}\n onKeyDown={onKeyDown}\n />\n {loading && <Spinner size=\"xs\" intent=\"neutral\" aria-hidden=\"true\" />}\n {clearable && selection.length > 0 && !inert && (\n <IconButton\n {...slot(comboboxAnatomy, \"clear\")}\n label={messages.clear}\n tooltip={false}\n variant=\"ghost\"\n intent=\"neutral\"\n size={buttonSize}\n icon={<XIcon />}\n onClick={clear}\n />\n )}\n <IconButton\n {...slot(comboboxAnatomy, \"toggle\")}\n // The frame already shows the disabled state; the ghost button's own\n // disabled fill would draw a grey box around the chevron.\n className=\"ds:[&:disabled:not([data-loading=true])]:bg-transparent\"\n label={messages.toggle}\n tooltip={false}\n variant=\"ghost\"\n intent=\"neutral\"\n size={buttonSize}\n tabIndex={-1}\n aria-expanded={open}\n aria-controls={open ? listId : undefined}\n disabled={inert}\n icon={\n <ChevronDownIcon\n className={cn(\n \"ds:transition-transform ds:duration-[var(--motion-duration-feedback)] ds:motion-reduce:transition-none\",\n open && \"ds:rotate-180\",\n )}\n />\n }\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => {\n focusInput();\n if (open) setOpen(false);\n else openList();\n }}\n />\n </div>\n </PopoverAnchor>\n\n <PopoverContent\n {...slot(comboboxAnatomy, \"content\")}\n // The popup of a combobox is its listbox, not a dialog: Radix's\n // `role=\"dialog\"` would need a name of its own (axe aria-dialog-name).\n role=\"presentation\"\n align=\"start\"\n sideOffset={4}\n avoidCollisions={avoidCollisions}\n onOpenAutoFocus={(event) => event.preventDefault()}\n onCloseAutoFocus={(event) => event.preventDefault()}\n onInteractOutside={(event) => {\n // A press inside the control is not \"outside\": it toggles or types.\n if (controlRef.current?.contains(event.target as Node)) event.preventDefault();\n }}\n // Inline, not classes: the width follows the anchor (the base content\n // ships `w-72`, which tailwind-merge does not reconcile with `w-(--…)`).\n style={{\n width: \"var(--radix-popover-trigger-width)\",\n maxHeight: \"var(--radix-popover-content-available-height)\",\n }}\n className={cn(\n \"ds:flex ds:min-w-48 ds:flex-col ds:overflow-hidden ds:p-0\",\n classNames?.content,\n )}\n >\n <NestedScrollLock>\n {header !== undefined && (\n <div\n {...slot(comboboxAnatomy, \"header\")}\n className=\"ds:border-rule ds:shrink-0 ds:border-b\"\n >\n {header}\n </div>\n )}\n <div\n {...slot(comboboxAnatomy, \"list\")}\n id={listId}\n role=\"listbox\"\n aria-multiselectable={multiple || undefined}\n aria-labelledby={wiring[\"aria-labelledby\"]}\n aria-label={wiring[\"aria-labelledby\"] ? undefined : ariaLabel}\n className={cn(\n \"ds:scrollbar-thin ds:min-h-0 ds:flex-1 ds:max-h-[min(20rem,60vh)] ds:overflow-y-auto ds:p-1\",\n classNames?.list,\n )}\n >\n {hasGroups\n ? groups.map((group, groupIndex) => {\n const headingId =\n group.group === undefined ? undefined : `${listId}-group-${groupIndex}`;\n return (\n <div\n key={group.group ?? `ungrouped-${groupIndex}`}\n {...slot(comboboxAnatomy, \"group\")}\n role=\"group\"\n aria-labelledby={headingId}\n >\n {group.group !== undefined && (\n <div\n {...slot(comboboxAnatomy, \"group-heading\")}\n id={headingId}\n role=\"presentation\"\n className={GROUP_HEADING_CLASSES}\n >\n {group.group}\n </div>\n )}\n {group.options.map(renderRow)}\n </div>\n );\n })\n : visibleOptions.map(renderRow)}\n {showCreate && (\n <>\n {visibleOptions.length > 0 && (\n <div className={LIST_SEPARATOR.neutral} role=\"presentation\" />\n )}\n {/* `role=\"option\"` through the attributes, operated from the input. */}\n {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */}\n <div\n {...listItemAttributes(comboboxAnatomy, {\n id: optionElementId(listId, CREATE_ROW),\n highlighted: createHighlighted,\n selected: false,\n cmdkCompat,\n })}\n {...slot(comboboxAnatomy, \"create\")}\n className={CREATE_ITEM_CLASSES}\n onPointerMove={() => {\n if (highlightedValue !== CREATE_ROW)\n setHighlightedValue(CREATE_ROW as TValue);\n }}\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => {\n const row = rows[createIndex];\n if (row) activateRow(row);\n }}\n >\n <PlusIcon aria-hidden=\"true\" />\n <span className=\"ds:min-w-0 ds:flex-1 ds:truncate\">\n {messages.create(trimmed)}\n </span>\n </div>\n </>\n )}\n </div>\n {loading && (\n <div {...slot(comboboxAnatomy, \"loading\")} role=\"status\" className={STATE_CLASSES}>\n {loadingState ?? messages.loading}\n </div>\n )}\n {!loading && rows.length === 0 && (\n <div {...slot(comboboxAnatomy, \"empty\")} role=\"status\" className={STATE_CLASSES}>\n {emptyState ?? messages.empty}\n </div>\n )}\n {footer !== undefined && (\n <div\n {...slot(comboboxAnatomy, \"footer\")}\n className=\"ds:border-rule ds:shrink-0 ds:border-t\"\n >\n {footer}\n </div>\n )}\n </NestedScrollLock>\n </PopoverContent>\n </Popover>\n\n <FormBridge\n name={wiring.name}\n value={multiple ? selection : value}\n form={form}\n disabled={disabled}\n required={wiring[\"aria-required\"] === true}\n focusTarget={inputRef}\n onReset={() => commitSelection(defaultSelection, null)}\n />\n </div>\n );\n}\n\nCombobox.displayName = \"Combobox\";\n","\"use client\";\n\nimport * as React from \"react\";\n\nimport { cn } from \"../lib/cn\";\nimport { Combobox, type ComboboxSize, type Option } from \"./combobox\";\n\n/* ───────────────────────────────────────────────────────────────────────\n * ClientSelect — single-client picker, an adapter over `Combobox` (W8-06).\n *\n * Public API preserved verbatim:\n * <ClientSelect\n * clients value onChange\n * name error className placeholder\n * />\n *\n * Behavioural notes:\n * - `value` is `string | null`; the combobox speaks the same emptiness\n * (`value === null`), so the bridge is the identity.\n * - `name` still submits inside form posts — through the combobox's\n * `FormBridge` rather than a hand-rolled hidden input.\n * - Each option shows `label` and an optional secondary `email` line; the\n * control itself shows the label only, as before.\n * - New here, and the reason PRO forked this component: the list is\n * **searchable** — typing filters on the client name and the email.\n * ─────────────────────────────────────────────────────────────────────── */\n\nexport type ClientSelectOption = {\n id: string;\n label: string;\n email?: string;\n};\n\ninterface ClientSelectProps {\n clients: ClientSelectOption[];\n value: string | null;\n onChange: (clientId: string | null) => void;\n name?: string;\n error?: string;\n className?: string;\n placeholder?: string;\n /**\n * Height, padding, font and glyph size from the shared control scale (A1,\n * ADR-013), forwarded to the underlying `Combobox`. Default `md` — today's\n * frozen 36px row, byte for byte.\n *\n * @experimental\n */\n size?: ComboboxSize | undefined;\n}\n\nexport function ClientSelect({\n clients,\n value,\n onChange,\n name = \"client_id\",\n error,\n className,\n placeholder = \"Select a client...\",\n size,\n}: ClientSelectProps) {\n const options = React.useMemo<Option<string, ClientSelectOption>[]>(\n () =>\n clients.map((client) => ({\n value: client.id,\n label: client.label,\n keywords: client.email ? [client.email] : undefined,\n meta: client,\n })),\n [clients],\n );\n\n return (\n <div className={cn(\"ds:relative ds:w-full\", className)}>\n <Combobox<Option<string, ClientSelectOption>, string>\n options={options}\n name={name}\n value={value}\n onValueChange={(next) => onChange(next)}\n aria-label={placeholder}\n placeholder={placeholder}\n invalid={Boolean(error)}\n size={size}\n // An empty source list (no clients on the account) rather than a query\n // that matched nothing — the wording the component always had.\n messages={clients.length === 0 ? { empty: \"No clients yet\" } : undefined}\n // The control shows the label only. The dropdown row keeps the email\n // for context: two `line-clamp-1` lines, so a long client name or\n // engagement label clips at a word boundary instead of mid-word —\n // \"2025 Business Tax Organizer — …\" rather than \"… Coasta…\".\n renderValue={(option) => option.label}\n renderOption={(option) => {\n const email = (option.meta as ClientSelectOption | undefined)?.email;\n return (\n <span className=\"ds:flex ds:min-w-0 ds:flex-col\">\n <span className=\"ds:text-fg ds:line-clamp-1 ds:text-(length:--control-font-size-md) ds:font-medium\">\n {option.label}\n </span>\n {email && <span className=\"ds:text-fg-3 ds:line-clamp-1 ds:text-xs\">{email}</span>}\n </span>\n );\n }}\n />\n\n {error && (\n <p role=\"alert\" className=\"ds:text-danger-fg ds:mt-1.5 ds:text-xs\">\n {error}\n </p>\n )}\n </div>\n );\n}\n\nClientSelect.displayName = \"ClientSelect\";\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as CollapsiblePrimitive from \"@radix-ui/react-collapsible\";\n\nimport { cn } from \"../lib/cn\";\n\n/* -------------------------------------------------------------------------- */\n/* Collapsible */\n/* Thin wrapper over Radix's @radix-ui/react-collapsible primitives. */\n/* -------------------------------------------------------------------------- */\n\ntype CollapsibleProps = React.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Root>;\n\nexport const Collapsible = React.forwardRef<\n React.ElementRef<typeof CollapsiblePrimitive.Root>,\n CollapsibleProps\n>(function Collapsible({ className, ...props }, ref) {\n return <CollapsiblePrimitive.Root ref={ref} className={cn(className)} {...props} />;\n});\nCollapsible.displayName = CollapsiblePrimitive.Root.displayName;\n\ntype CollapsibleTriggerProps = React.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Trigger>;\n\nexport const CollapsibleTrigger = React.forwardRef<\n React.ElementRef<typeof CollapsiblePrimitive.Trigger>,\n CollapsibleTriggerProps\n>(function CollapsibleTrigger({ className, ...props }, ref) {\n return (\n <CollapsiblePrimitive.Trigger\n ref={ref}\n className={cn(\n \"ds:flex ds:w-full ds:items-center\",\n \"ds:focus-visible:[box-shadow:var(--shadow-focus-ring)] ds:focus-visible:outline-none\",\n className,\n )}\n {...props}\n />\n );\n});\nCollapsibleTrigger.displayName = CollapsiblePrimitive.Trigger.displayName;\n\ntype CollapsibleContentProps = React.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Content>;\n\nexport const CollapsibleContent = React.forwardRef<\n React.ElementRef<typeof CollapsiblePrimitive.Content>,\n CollapsibleContentProps\n>(function CollapsibleContent({ className, ...props }, ref) {\n return (\n <CollapsiblePrimitive.Content\n ref={ref}\n className={cn(\n \"ds:overflow-hidden\",\n \"ds:data-[state=closed]:animate-[collapsible-up_var(--duration-overlay)_var(--ease-out-quart)]\",\n \"ds:data-[state=open]:animate-[collapsible-down_var(--duration-overlay)_var(--ease-out-quart)]\",\n \"ds:motion-reduce:animate-none\",\n className,\n )}\n {...props}\n />\n );\n});\nCollapsibleContent.displayName = CollapsiblePrimitive.Content.displayName;\n","import { forwardRef } from \"react\";\n\nimport type { ComingSoonMessages } from \"../foundation/messages/types\";\nimport { useDsMessages } from \"../foundation/provider/context\";\nimport { cn } from \"../lib/cn\";\n\nimport { CheckIcon } from \"./icons\";\n/**\n * ComingSoon — placeholder pattern for unreleased modules. Pro-tinted icon\n * halo, dashed Assure border, \"In Development\" pill.\n *\n * Public API preserved: `icon`, `title`, `description`, `features`. The two\n * strings the component owned itself — the \"Coming soon\" eyebrow and the\n * \"In Development\" pill — are injectable through `messages` (prop >\n * `DesignSystemProvider messages.comingSoon` > English, W5-20/W8-08); the\n * defaults are today's text, so nothing changes without an override.\n */\nexport interface ComingSoonProps extends React.HTMLAttributes<HTMLDivElement> {\n icon: React.ReactNode;\n title: string;\n description: string;\n features: string[];\n /** The eyebrow and pill copy. Defaults to English (\"Coming soon\" / \"In Development\"). */\n messages?: Partial<ComingSoonMessages>;\n}\n\nexport const ComingSoon = forwardRef<HTMLDivElement, ComingSoonProps>(function ComingSoon(\n { icon, title, description, features, className, messages: messagesProp, ...props },\n ref,\n) {\n const messages = useDsMessages(\"comingSoon\", messagesProp);\n return (\n <div\n ref={ref}\n className={cn(\"ds:flex ds:items-center ds:justify-center ds:px-6 ds:py-16\", className)}\n {...props}\n >\n <div\n className={cn(\n \"ds:rounded-card ds:border-rule-strong ds:w-full ds:max-w-lg ds:border ds:border-dashed\",\n \"ds:bg-surface ds:shadow-quiet ds:p-10 ds:text-center\",\n )}\n >\n {/* Eyebrow */}\n <div className=\"ds:text-brand ds:mb-5 ds:font-mono ds:text-(length:--text-overline) ds:font-normal ds:tracking-[0.14em] ds:uppercase\">\n {messages.eyebrow}\n </div>\n\n {/* Pro-tinted icon halo */}\n <div\n className={cn(\n \"ds:mx-auto ds:mb-4 ds:flex ds:size-12 ds:items-center ds:justify-center\",\n \"ds:rounded-icon ds:bg-brand-bg ds:text-brand ds:[&>svg]:size-6\",\n )}\n >\n {icon}\n </div>\n\n <h1 className=\"ds:font-display ds:text-fg ds:text-xl ds:font-medium ds:tracking-[-0.022em]\">{title}</h1>\n <p className=\"ds:text-fg-3 ds:mt-1.5 ds:text-sm\">{description}</p>\n\n <ul className=\"ds:mt-6 ds:space-y-2 ds:text-left\">\n {features.map((feature) => (\n <li key={feature} className=\"ds:text-fg-2 ds:flex ds:items-center ds:gap-2 ds:text-sm\">\n <CheckIcon\n className=\"ds:text-success-fg ds:size-3.5 ds:shrink-0\"\n strokeWidth={2.5}\n aria-hidden=\"true\"\n />\n {feature}\n </li>\n ))}\n </ul>\n\n <div className=\"ds:mt-6\">\n <span\n className={cn(\n \"ds:rounded-pill ds:inline-flex ds:items-center ds:border ds:px-2.5 ds:py-0.5\",\n \"ds:text-xs ds:font-medium\",\n \"ds:bg-brand-bg ds:text-brand ds:border-[color:var(--color-brand-bg-active)]\",\n )}\n >\n {messages.badge}\n </span>\n </div>\n </div>\n </div>\n );\n});\n\nComingSoon.displayName = \"ComingSoon\";\n","/**\n * Asset base path — where the design system's own static artwork is served from.\n *\n * Brand art ships in `public/brand/` and is addressed root-relative\n * (`/brand/assure-pro.svg`). That is correct in a consumer app served from the\n * domain root, and wrong anywhere the host serves from a subpath: this repo's\n * Storybook lives at `/design-system/` on GitHub Pages, where a root-relative\n * request leaves the site entirely and 404s.\n *\n * Consumers need do nothing. The default base is `/`, which reproduces today's\n * root-relative URLs byte for byte. A host on a subpath calls\n * `setAssetBasePath` once before first render.\n */\n\nlet basePath = \"/\";\n\n/**\n * Point brand artwork at `base`. Accepts it with or without surrounding\n * slashes; empty, nullish and `\"/\"` all mean the domain root.\n */\nexport function setAssetBasePath(base: string | null | undefined): void {\n const trimmed = (base ?? \"\").replace(/\\/+$/, \"\");\n basePath = trimmed === \"\" ? \"/\" : `${trimmed.startsWith(\"/\") ? \"\" : \"/\"}${trimmed}/`;\n}\n\n/** The configured base, always with a single trailing slash. */\nexport function getAssetBasePath(): string {\n return basePath;\n}\n\n/** Resolve a root-relative design system asset against the configured base. */\nexport function assetPath(path: string): string {\n return `${basePath}${path.replace(/^\\/+/, \"\")}`;\n}\n","import type { ImageComponentProps, LinkComponentProps } from \"./link\";\n\n/**\n * L0 foundation (W9-08, ADR-010 §6). What `LinkButton` and `Logo` render when\n * no `DesignSystemProvider` supplies a `linkComponent` / `imageComponent`: a\n * plain `<a>` and a plain `<img>`, so the root never imports `next/*`\n * (C-NEXT-PEER). A Next.js app gets client routing and `next/image` by\n * rendering `NextDesignSystemProvider` from `@assure-one/design-system/next`.\n */\n\n/** A plain anchor: full-page navigation, every attribute and the ref forwarded. */\nexport function PlainLink({ ref, children, ...props }: LinkComponentProps) {\n return (\n <a ref={ref} {...props}>\n {children}\n </a>\n );\n}\n\n/** A plain image; `priority` becomes an eager, high-priority fetch. */\nexport function PlainImage({ priority, alt, ...props }: ImageComponentProps) {\n return (\n <img\n alt={alt}\n {...(priority ? { loading: \"eager\" as const, fetchPriority: \"high\" as const } : {})}\n {...props}\n />\n );\n}\n","\"use client\";\n\nimport * as React from \"react\";\n\nimport { useImageComponent, useLinkComponent } from \"../foundation/provider/context\";\nimport { PlainImage, PlainLink } from \"../foundation/provider/plain-adapters\";\nimport { assetPath } from \"../lib/asset-base\";\nimport { cn } from \"../lib/cn\";\nimport {\n AssureAuditBrandIcon,\n AssureBooksBrandIcon,\n AssureProBrandIcon,\n AssureTaxBrandIcon,\n} from \"./brand-icons\";\n\n/**\n * Logo — Assure suite wordmark. Renders the official product artwork when\n * available, and falls back to a brand glyph + text lockup otherwise.\n *\n * The artwork ships in the package (`public/brand/*.svg`, W8-07) but is served\n * by the host: copy it into the app's public folder, or point\n * `setAssetBasePath` at wherever it is served from. Nothing breaks if you do\n * neither — an image that fails to load falls back to the glyph + text lockup.\n *\n * The product suffix is configurable so the same component serves every\n * Assure product. The default preserves the original \"Assure Pro\" output —\n * existing consumers do not need to change anything.\n *\n * Public API:\n * - `size`, `href`, `showText`, `inverted` (visual)\n * - `productName` (the suffix text; `null` renders just \"Assure\")\n * - `className`, `iconClassName`, `textClassName` (style overrides)\n *\n * The link and the wordmark image are the provider's `linkComponent` /\n * `imageComponent` when a `DesignSystemProvider` supplies them (W5-21,\n * ADR-010), else a plain `<a>` / `<img>`. Since 2.0 the root never imports\n * `next/*` (C-NEXT-PEER): a Next.js app renders `NextDesignSystemProvider`\n * (`@assure-one/design-system/next`) to get `next/link` / `next/image`.\n *\n * By default the lockup is a link (`href=\"/\"`). Pass `href={null}` to render a\n * non-interactive `<span>` wrapper instead — required when embedding the lockup\n * inside another interactive element (a menu trigger `<button>`, a\n * `DropdownMenuItem`) where a nested `<a>` would be invalid HTML or would race\n * the parent's click handler.\n */\n\nconst sizeStyles = {\n sm: { icon: 20, text: \"ds:text-sm\", gap: \"ds:gap-2\", assetHeight: 24 },\n // 17px: off-scale, between `text-base` (16) and `text-lg` (18); no type role\n // sits there either. Left literal — a VN/D1-track decision, not this pass.\n md: { icon: 24, text: \"ds:text-[17px]\", gap: \"ds:gap-2.5\", assetHeight: 30 },\n lg: { icon: 32, text: \"ds:text-xl\", gap: \"ds:gap-3\", assetHeight: 40 },\n xl: { icon: 40, text: \"ds:text-2xl\", gap: \"ds:gap-3.5\", assetHeight: 48 },\n} as const;\n\nconst productLogoAssets = {\n Pro: { src: \"/brand/assure-pro.svg\", width: 384, height: 90 },\n Audit: { src: \"/brand/assure-audit.svg\", width: 441, height: 90 },\n Books: { src: \"/brand/assure-books.svg\", width: 470, height: 90 },\n Tax: { src: \"/brand/assure-tax.svg\", width: 374, height: 90 },\n Teams: { src: \"/brand/mycpe-teams.svg\", width: 221, height: 49 },\n} as const;\n\nconst productMarkAssets = {\n Pro: { src: \"/brand/assure-pro-mark.svg\", width: 55, height: 48 },\n Audit: { src: \"/brand/assure-audit-mark.svg\", width: 55, height: 48 },\n Books: { src: \"/brand/assure-books-mark.svg\", width: 55, height: 48 },\n Tax: { src: \"/brand/assure-tax-mark.svg\", width: 55, height: 48 },\n Teams: { src: \"/brand/mycpe-teams-mark.svg\", width: 26, height: 31 },\n} as const;\n\nconst productGlyphs = {\n Pro: AssureProBrandIcon,\n Audit: AssureAuditBrandIcon,\n Books: AssureBooksBrandIcon,\n Tax: AssureTaxBrandIcon,\n} as const;\n\n// Products whose wordmark is a complete, standalone brand identity rather than\n// an \"Assure {suffix}\" lockup. For these the wordmark asset carries the full\n// name, so we never prepend \"Assure\" and the accessible name is the brand's own\n// name. Vendor artwork lives in `public/brand/`, keeping brand hex out of the DS.\nconst standaloneBrands: Record<string, string> = {\n Teams: \"myCPE Teams\",\n};\n\ninterface LogoProps {\n size?: keyof typeof sizeStyles;\n /** Link target for the lockup. Pass `null` to render a non-interactive `<span>` wrapper (for embedding inside another interactive element). Defaults to `\"/\"`. */\n href?: string | null;\n showText?: boolean;\n className?: string;\n iconClassName?: string;\n textClassName?: string;\n /**\n * Product suffix rendered after \"Assure\" (e.g. \"Pro\", \"Audit\"). Pass `null`\n * to render just \"Assure\". A few products are standalone brands whose\n * wordmark is the complete identity (e.g. \"Teams\" → myCPE Teams) — those\n * render their own name with no \"Assure\" prefix. Defaults to \"Pro\" for\n * backwards compatibility.\n */\n productName?: string | null;\n /** When true, render on dark/brand surfaces (white \"Assure\" + lighter suffix). */\n inverted?: boolean;\n}\n\nexport function Logo({\n size = \"md\",\n href = \"/\",\n showText = true,\n className,\n iconClassName,\n textClassName,\n productName = \"Pro\",\n inverted = false,\n}: LogoProps) {\n const RouterLink = useLinkComponent() ?? PlainLink;\n const Img = useImageComponent() ?? PlainImage;\n // The artwork ships in the package (`public/brand/`), but a consumer serves\n // it: it is a URL, not an import. When the host has not copied it (or serves\n // it from a subpath and has not called `setAssetBasePath`), the request 404s\n // — so a failed load drops the lockup back to the brand glyph + text, which\n // needs nothing hosted. Server and first client render are unchanged.\n const [artworkFailed, setArtworkFailed] = React.useState(false);\n const s = sizeStyles[size];\n const standaloneLabel = productName ? standaloneBrands[productName] : undefined;\n const isStandalone = Boolean(standaloneLabel);\n const ariaLabel = standaloneLabel ?? (productName ? `Assure ${productName}` : \"Assure\");\n const asset = productName\n ? productLogoAssets[productName as keyof typeof productLogoAssets]\n : undefined;\n const markAsset = productName\n ? productMarkAssets[productName as keyof typeof productMarkAssets]\n : undefined;\n const Glyph = productName ? productGlyphs[productName as keyof typeof productGlyphs] : undefined;\n const wordmark = artworkFailed || !showText ? undefined : asset;\n const mark = artworkFailed || wordmark ? undefined : markAsset;\n\n const wrapperClassName = cn(\"ds:inline-flex ds:items-center\", s.gap, className);\n const content = (\n <>\n {wordmark ? (\n <Img\n src={assetPath(wordmark.src)}\n alt=\"\"\n width={wordmark.width}\n height={wordmark.height}\n priority\n onError={() => setArtworkFailed(true)}\n className={cn(\n \"ds:h-auto ds:flex-shrink-0\",\n inverted && \"ds:brightness-0 ds:invert\",\n iconClassName,\n )}\n style={{ width: Math.round((wordmark.width / wordmark.height) * s.assetHeight) }}\n />\n ) : mark ? (\n <Img\n src={assetPath(mark.src)}\n alt=\"\"\n width={mark.width}\n height={mark.height}\n priority\n onError={() => setArtworkFailed(true)}\n className={cn(\n \"ds:h-auto ds:flex-shrink-0\",\n inverted && \"ds:brightness-0 ds:invert\",\n iconClassName,\n )}\n style={{ width: Math.round((mark.width / mark.height) * s.icon) }}\n />\n ) : (\n <>\n {Glyph ? (\n <Glyph size={s.icon} aria-hidden=\"true\" className={iconClassName} />\n ) : (\n <span\n aria-hidden=\"true\"\n className={cn(\n \"ds:bg-pro-fg ds:grid ds:shrink-0 ds:place-items-center ds:rounded-[5px] ds:text-(length:--text-micro) ds:font-bold ds:text-white\",\n iconClassName,\n )}\n style={{ width: s.icon, height: s.icon }}\n >\n A\n </span>\n )}\n </>\n )}\n {showText && (\n <span\n className={cn(\n \"ds:font-display ds:font-semibold ds:tracking-[-0.025em]\",\n s.text,\n inverted ? \"ds:text-white\" : \"ds:text-fg\",\n wordmark && \"ds:sr-only\",\n textClassName,\n )}\n >\n {isStandalone ? (\n <span>{standaloneLabel}</span>\n ) : (\n <>\n <span>Assure</span>\n {productName && (\n <>\n {\" \"}\n <span\n className={cn(\n \"ds:font-medium\",\n inverted ? \"ds:text-[#d8cfff]\" : \"ds:text-pro-fg\",\n )}\n >\n {productName}\n </span>\n </>\n )}\n </>\n )}\n </span>\n )}\n </>\n );\n\n // Link-less mode: a non-interactive wrapper for embedding the lockup inside\n // another interactive element (menu trigger, dropdown item). No `aria-label`\n // here — the accessible name comes from the rendered wordmark's text (visible\n // for the glyph fallback, `sr-only` alongside the wordmark image).\n if (href === null) {\n return <span className={wrapperClassName}>{content}</span>;\n }\n\n return (\n <RouterLink href={href} className={wrapperClassName} aria-label={ariaLabel}>\n {content}\n </RouterLink>\n );\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as SheetPrimitive from \"@radix-ui/react-dialog\";\n\nimport { sheetAnatomy, type SheetSlot } from \"../foundation/anatomy/slots\";\nimport { stateAttributes } from \"../foundation/anatomy/slot\";\nimport { deprecate } from \"../foundation/deprecate\";\n\nimport { XIcon } from \"./icons\";\nimport { withPortalContainer } from \"./behavior/portal\";\nimport {\n Backdrop,\n DEFAULT_OVERLAY_MESSAGES,\n DISMISS_GLYPH_CLASSES,\n DismissButton,\n OverlayBody,\n OverlayDescription,\n OverlayFooter,\n OverlayHeader,\n OverlaySurface,\n OverlayTitle,\n} from \"./behavior/overlay\";\n/* ───────────────────────────────────────────────────────────────────────\n * Sheet — slide-in panel on top of @radix-ui/react-dialog (shadcn pattern).\n *\n * Public API preserved:\n * Sheet, SheetTrigger, SheetClose, SheetContent, SheetHeader,\n * SheetTitle, SheetDescription, SheetFooter\n *\n * `side` lives on SheetContent (in shadcn it's a content-level prop). For\n * backwards compatibility with the prior implementation, the `Sheet` root\n * also accepts `side` and forwards it to SheetContent via context.\n *\n * NEW (additive): SheetPortal, SheetOverlay are also exported. W5-07 adds\n * `size` and the `--ds-sheet-width` hook (the replacement of `width` /\n * `customWidth`, C-SHEET-WIDTH), `SheetBody`, `closeLabel` / `messages`,\n * and safe-area padding on `side=\"bottom\"`; every legacy `width` value\n * renders the same pixels. Internals are the W5-03 overlay parts.\n * ─────────────────────────────────────────────────────────────────────── */\n\n/**\n * The edge a `Sheet` slides in from.\n *\n * @experimental\n */\nexport type SheetSide = \"top\" | \"right\" | \"bottom\" | \"left\";\n\ntype Side = SheetSide;\n\n/**\n * Width of a left/right `SheetContent`, as a step of the sheet width scale\n * (W5-07): `sm` 420px · `md` 520px · `lg` 640px · `xl` 760px from the `sm`\n * breakpoint (95vw below it) · `full` the viewport. Omitted, the panel keeps\n * its 1.x geometry (`w-3/4 max-w-sm`). Every step and the default yield to\n * `--ds-sheet-width` when a consumer sets it. Top/bottom sheets span the\n * viewport and ignore it.\n *\n * @experimental\n */\nexport type SheetSize = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"full\";\n\n/**\n * What the deprecated `width` prop accepts: the size steps plus `default`.\n *\n * @deprecated Use `size` (C-SHEET-WIDTH, codemod CM-11). Removed in 3.0.\n * @experimental\n */\nexport type SheetWidth = \"default\" | SheetSize;\n\n/**\n * The copy a `Sheet` renders (target architecture §24.5). English defaults\n * until the messages contract of the provider lands (W5-20).\n *\n * @experimental\n */\nexport interface SheetMessages {\n /** The accessible name of the built-in close button. Default `\"Close\"`. */\n close: string;\n}\n\ninterface SheetSideContextValue {\n side?: Side | undefined;\n}\nconst SheetSideContext = React.createContext<SheetSideContextValue>({});\n\ninterface SheetProps extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Root> {\n /**\n * Default side for SheetContent if it doesn't specify its own.\n * Backwards-compat shim — prefer `<SheetContent side=\"…\" />`.\n */\n side?: Side;\n}\n\nconst Sheet = ({ side, children, ...props }: SheetProps) => (\n <SheetPrimitive.Root {...props}>\n <SheetSideContext value={{ side }}>{children}</SheetSideContext>\n </SheetPrimitive.Root>\n);\nSheet.displayName = \"Sheet\";\n\n/** The sheet parts (ADR-008). See the registry for the doc comment. */\nexport type { SheetSlot };\n\nconst SheetTrigger = SheetPrimitive.Trigger;\nconst SheetClose = SheetPrimitive.Close;\nconst SheetPortal = withPortalContainer(SheetPrimitive.Portal);\n\nconst SheetOverlay = React.forwardRef<\n React.ElementRef<typeof SheetPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>\n>((props, ref) => (\n <Backdrop\n as={SheetPrimitive.Overlay}\n anatomy={sheetAnatomy}\n motion=\"legacy\"\n ref={ref}\n {...props}\n />\n));\nSheetOverlay.displayName = SheetPrimitive.Overlay.displayName;\n\n// Each step is a full literal with the consumer hook as the first value of\n// the breakpoint width: `width: var(--ds-sheet-width, <step>)`. Unset, the\n// step is what the 1.x `width` preset computed, pixel for pixel.\nconst SHEET_SIZES: Readonly<Record<SheetSize, string>> = {\n sm: \"ds:w-[95vw] ds:max-w-[95vw] ds:sm:w-[var(--ds-sheet-width,420px)]\",\n md: \"ds:w-[95vw] ds:max-w-[95vw] ds:sm:w-[var(--ds-sheet-width,520px)]\",\n lg: \"ds:w-[95vw] ds:max-w-[95vw] ds:sm:w-[var(--ds-sheet-width,640px)]\",\n xl: \"ds:w-[95vw] ds:max-w-[95vw] ds:sm:w-[var(--ds-sheet-width,760px)]\",\n full: \"ds:w-full ds:max-w-none\",\n};\n\n/**\n * Props of `SheetContent`: Radix's content props plus the side, the sizing\n * and the dismiss options.\n *\n * @experimental\n */\nexport interface SheetContentProps extends React.ComponentPropsWithoutRef<\n typeof SheetPrimitive.Content\n> {\n /** The edge the panel slides in from. Default `right` (or the `Sheet` root's `side`). */\n side?: SheetSide | null;\n /**\n * Width step for left/right sheets. Omit for the 1.x geometry\n * (`w-3/4 max-w-sm`). See {@link SheetSize}.\n */\n size?: SheetSize;\n /** If false, the built-in close button is hidden. Default: true. */\n showCloseButton?: boolean;\n /**\n * The accessible name of the built-in close button. Takes precedence over\n * `messages.close`. Default `\"Close\"`.\n */\n closeLabel?: string;\n /** Overrides of the copy the sheet renders (English defaults until W5-20). */\n messages?: Partial<SheetMessages>;\n /**\n * Width preset for left/right sheets — the same steps as `size`, plus\n * `default`. When both are given `size` wins.\n *\n * @deprecated Use `size` (C-SHEET-WIDTH, codemod CM-11). Removed in 3.0.\n */\n width?: SheetWidth;\n /**\n * Custom CSS width for left/right sheets, e.g. `\"520px\"`, rendered as an\n * inline `width` with `max-width: 95vw`.\n *\n * @deprecated Set the `--ds-sheet-width` custom property instead\n * (C-SHEET-WIDTH, codemod CM-11). Removed in 3.0.\n */\n customWidth?: string;\n}\n\nconst SheetContent = React.forwardRef<\n React.ElementRef<typeof SheetPrimitive.Content>,\n SheetContentProps\n>(\n (\n {\n side,\n size,\n width,\n customWidth,\n className,\n children,\n showCloseButton = true,\n closeLabel,\n messages,\n style,\n ...props\n },\n ref,\n ) => {\n const ctx = React.use(SheetSideContext);\n const resolvedSide: Side = side ?? ctx.side ?? \"right\";\n const supportsWidth = resolvedSide === \"left\" || resolvedSide === \"right\";\n\n if (width !== undefined) {\n deprecate(\n \"C-SHEET-WIDTH\",\n \"width\",\n \"SheetContent `width` is deprecated; pass `size` (the same steps) instead.\",\n );\n }\n if (customWidth !== undefined) {\n deprecate(\n \"C-SHEET-WIDTH\",\n \"customWidth\",\n \"SheetContent `customWidth` is deprecated; set the `--ds-sheet-width` custom property instead.\",\n );\n }\n\n // `size` wins over the alias; `width=\"default\"` is the omitted case.\n const resolvedSize: SheetSize | undefined =\n size ?? (width === undefined || width === \"default\" ? undefined : width);\n const sizeRow = supportsWidth && resolvedSize ? SHEET_SIZES[resolvedSize] : null;\n const widthStyle =\n supportsWidth && customWidth ? { width: customWidth, maxWidth: \"95vw\", ...style } : style;\n\n return (\n <SheetPortal>\n <SheetOverlay />\n <OverlaySurface\n as={SheetPrimitive.Content}\n anatomy={sheetAnatomy}\n placement={resolvedSide}\n motion=\"legacy\"\n ref={ref}\n {...stateAttributes({ size: resolvedSize ?? \"default\" })}\n rows={[sizeRow]}\n className={className}\n style={widthStyle}\n {...props}\n >\n {children}\n {/* Frozen last child of the content (plan §17.1). */}\n {showCloseButton && (\n <DismissButton\n as={SheetPrimitive.Close}\n anatomy={sheetAnatomy}\n label={closeLabel ?? messages?.close ?? DEFAULT_OVERLAY_MESSAGES.close}\n >\n <XIcon className={DISMISS_GLYPH_CLASSES} aria-hidden=\"true\" />\n </DismissButton>\n )}\n </OverlaySurface>\n </SheetPortal>\n );\n },\n);\nSheetContent.displayName = SheetPrimitive.Content.displayName;\n\nconst SheetHeader = (props: React.HTMLAttributes<HTMLDivElement>) => (\n <OverlayHeader anatomy={sheetAnatomy} layout=\"padded\" dismissGutter {...props} />\n);\nSheetHeader.displayName = \"SheetHeader\";\n\n/**\n * Props of `SheetBody` (W5-07).\n *\n * @experimental\n */\nexport interface SheetBodyProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Horizontal padding, matching the header's and footer's `p-6` at `md`\n * (the default). The panel's own `gap-4` spaces the parts vertically.\n */\n padding?: \"none\" | \"sm\" | \"md\" | \"lg\";\n}\n\n/**\n * The scroll region of a sheet between `SheetHeader` and `SheetFooter`\n * (W5-07): takes the remaining height of the panel and scrolls on its own,\n * so the header and the footer stay in place.\n *\n * @experimental\n */\nconst SheetBody = React.forwardRef<HTMLDivElement, SheetBodyProps>(\n ({ padding = \"md\", ...props }, ref) => (\n <OverlayBody anatomy={sheetAnatomy} layout=\"padded\" padding={padding} ref={ref} {...props} />\n ),\n);\nSheetBody.displayName = \"SheetBody\";\n\nconst SheetFooter = (props: React.HTMLAttributes<HTMLDivElement>) => (\n <OverlayFooter anatomy={sheetAnatomy} layout=\"padded\" {...props} />\n);\nSheetFooter.displayName = \"SheetFooter\";\n\nconst SheetTitle = React.forwardRef<\n React.ElementRef<typeof SheetPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>\n>((props, ref) => (\n <OverlayTitle as={SheetPrimitive.Title} anatomy={sheetAnatomy} ref={ref} {...props} />\n));\nSheetTitle.displayName = SheetPrimitive.Title.displayName;\n\nconst SheetDescription = React.forwardRef<\n React.ElementRef<typeof SheetPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description>\n>((props, ref) => (\n <OverlayDescription as={SheetPrimitive.Description} anatomy={sheetAnatomy} ref={ref} {...props} />\n));\nSheetDescription.displayName = SheetPrimitive.Description.displayName;\n\nexport {\n Sheet,\n SheetTrigger,\n SheetClose,\n SheetPortal,\n SheetOverlay,\n SheetContent,\n SheetHeader,\n SheetBody,\n SheetFooter,\n SheetTitle,\n SheetDescription,\n};\n","\"use client\";\n\nimport { forwardRef, useId, useState, type ReactNode } from \"react\";\n\nimport {\n WHITE,\n contrastRatio,\n darkenUntilContrast,\n formatHexColor,\n parseHexColor,\n} from \"../foundation/theme/srgb\";\nimport { cn } from \"../lib/cn\";\nimport {\n CheckIcon,\n ChevronLeftIcon,\n ChevronRightIcon,\n DownloadIcon,\n EyeIcon,\n GlobeIcon,\n HomeIcon,\n MailIcon,\n PhoneIcon,\n XIcon,\n} from \"../primitives/icons\";\n\n/**\n * AgreementViewer — the chrome + navigation shell for a multi-step, branded\n * agreement / proposal (the \"Signed Agreement Viewer\"). It owns the header,\n * the firm-branded cover rail, the section stepper, the signed / awaiting\n * banner, the prev·dots·next footer, and the step state. Each step's body is\n * consumer-owned `content` — the shell is deliberately content-agnostic so the\n * same frame drives a tax proposal, an engagement letter, or an NDA.\n *\n * Step 0 is the cover: it shows the gradient firm rail. Steps 1+ show the\n * light section rail with the stepper. One root attribute drives both:\n * `data-view=\"cover\" | \"inner\"`, derived from the current step.\n *\n * Branding: the whole composite themes from a single accent. Omit `accent` to\n * inherit the suite accent; pass any CSS color (`accent=\"#1f8a5b\"`) and the\n * rail gradient, tints, stepper, dots, and CTAs all retrack — every shade is\n * derived in `tokens.css` via color-mix off `--av-accent`. The accent carries\n * white text (CTAs, monogram) and reads as text on white (logo mark), so a hex\n * accent under 4.5:1 against white is darkened just enough to reach it.\n *\n * <AgreementViewer\n * title=\"Comprehensive Individual Tax Services\"\n * firm={{ name: \"Patel & Associates CPA\", initials: \"P&A\" }}\n * steps={[\n * { id: \"welcome\", label: \"Welcome\", content: <Welcome /> },\n * { id: \"package\", label: \"Select a package\", content: <Packages /> },\n * …\n * ]}\n * onDownload={downloadPdf}\n * />\n *\n * @since 1.12.0\n */\n\nexport type AgreementStatus = \"signed\" | \"awaiting\";\n\nexport interface AgreementStep {\n /** Stable key + stepper/dot identity. */\n id: string;\n /** Section label shown in the stepper rail. */\n label: string;\n /** Node glyph in the stepper; defaults to the step number (or a home glyph\n * for the cover step). */\n icon?: ReactNode;\n /** The step body — consumer-owned. */\n content: ReactNode;\n /** Render this step's body full-bleed: the content pane drops its padding so\n * a cover or hero can reach the card edges. Default false.\n * @since 1.38.0 */\n bleed?: boolean;\n}\n\nexport interface AgreementFirm {\n /** Firm name shown on both rails. */\n name: string;\n /** Logo monogram (e.g. \"P&A\"). Falls back to the first letter of `name`. */\n initials?: string;\n /** Short line under the firm name on the cover rail. */\n tagline?: string;\n /** Subtitle under the firm name on the inner rail. Default \"Your proposal\". */\n subtitle?: string;\n /** Contact rows pinned to the bottom of the cover rail. */\n contact?: {\n phone?: ReactNode;\n email?: ReactNode;\n website?: ReactNode;\n };\n}\n\nexport interface AgreementViewerProps {\n /** Header title (the agreement name). */\n title: ReactNode;\n /** Small overline above the title. Default \"Signed agreement\". */\n overline?: ReactNode;\n /** Steps rendered as panes; index 0 is the cover. */\n steps: AgreementStep[];\n /** Firm branding for the rails. */\n firm: AgreementFirm;\n /** \"signed\" (read-only, all sections complete) or \"awaiting\" (in progress).\n * Drives the banner tone + which stepper nodes read as done. Default \"signed\". */\n status?: AgreementStatus;\n /** Banner body override. Omit for the status-derived default; pass `null` to\n * hide the banner entirely. */\n banner?: ReactNode;\n /** Brand accent override — any CSS color. Defaults to the suite accent. A hex\n * color under 4.5:1 against white is darkened just enough to reach it. */\n accent?: string;\n /** Show the gradient firm rail on the cover step. Set false for a full-bleed\n * cover (e.g. a centered title page). Default true. */\n coverRail?: boolean | undefined;\n /** Controlled current step index. */\n step?: number;\n /** Initial step when uncontrolled. Default 0. */\n defaultStep?: number;\n /** Notified on every step change (controlled or not). */\n onStepChange?: (step: number) => void;\n /** \"Download PDF\" handler — hides the button when omitted. */\n onDownload?: () => void;\n /** Close handler — hides the close button when omitted. */\n onClose?: () => void;\n /** Extra header actions, placed left of Download / Close. */\n headerActions?: ReactNode;\n /** Disable the footer \"Next\" control — e.g. this step has unmet requirements.\n * Default false.\n * @since 1.38.0 */\n nextDisabled?: boolean;\n /** Why \"Next\" is disabled. Kept in a polite live region under the footer and\n * wired to the Next control with `aria-describedby`; the text only appears\n * while `nextDisabled` is true.\n * @since 1.38.0 */\n nextDisabledReason?: ReactNode;\n /** Slot under the footer nav row — a validation summary, a secondary CTA, or\n * a legal note that should sit with the navigation rather than in the step.\n * @since 1.38.0 */\n footer?: ReactNode;\n className?: string;\n}\n\nconst ICON_BTN = cn(\n \"ds:inline-flex ds:size-9 ds:shrink-0 ds:items-center ds:justify-center ds:rounded-[9px]\",\n \"ds:border-rule-strong ds:bg-surface ds:text-fg-3 ds:border\",\n \"ds:transition-colors ds:duration-[var(--duration-fast)] ds:ease-[var(--ease-out-quart)] ds:motion-reduce:transition-none\",\n \"ds:hover:bg-surface-hover ds:hover:text-fg\",\n \"ds:focus-visible:[box-shadow:var(--shadow-focus-ring)] ds:focus-visible:outline-none\",\n);\n\n/** Minimum contrast of the accent against white (WCAG 2.2 SC 1.4.3 AA). */\nconst MIN_ACCENT_CONTRAST = 4.5;\n\n/**\n * The firm accent, clamped so white text on it and it as text on white both\n * reach 4.5:1. A hex accent that already passes is returned untouched; a\n * lighter one is darkened by the smallest mix towards black that passes (the\n * clamp `createBrandTheme` applies to fills), keeping its hue. Any other CSS\n * colour passes through as given.\n */\nfunction legibleAccent(accent: string): string {\n const rgb = parseHexColor(accent);\n if (!rgb || contrastRatio(rgb, WHITE) >= MIN_ACCENT_CONTRAST) return accent;\n return formatHexColor(darkenUntilContrast(rgb, WHITE, MIN_ACCENT_CONTRAST));\n}\n\nexport const AgreementViewer = forwardRef<HTMLDivElement, AgreementViewerProps>(\n function AgreementViewer(\n {\n title,\n overline = \"Signed agreement\",\n steps,\n firm,\n status = \"signed\",\n banner,\n accent,\n coverRail = true,\n step,\n defaultStep = 0,\n onStepChange,\n onDownload,\n onClose,\n headerActions,\n nextDisabled = false,\n nextDisabledReason,\n footer,\n className,\n },\n ref,\n ) {\n const reasonId = useId();\n const [internalStep, setInternalStep] = useState(defaultStep);\n const current = step ?? internalStep;\n const isControlled = step !== undefined;\n const lastIndex = steps.length - 1;\n\n const goTo = (n: number) => {\n if (n < 0 || n > lastIndex || n === current) return;\n if (!isControlled) setInternalStep(n);\n onStepChange?.(n);\n };\n\n const isCover = current === 0;\n const monogram = firm.initials ?? firm.name.charAt(0);\n\n const bannerContent =\n banner === undefined\n ? status === \"signed\"\n ? \"Showing the services your client accepted, at the prices locked in at signing.\"\n : \"Review each section at your pace, then sign whenever you're ready.\"\n : banner;\n\n return (\n <div\n ref={ref}\n data-slot=\"agreement-viewer\"\n data-status={status}\n data-view={isCover ? \"cover\" : \"inner\"}\n style={accent ? ({ \"--av-accent\": legibleAccent(accent) } as React.CSSProperties) : undefined}\n className={cn(\n // Fills its container's height so the content pane scrolls internally\n // while the header, rail, and footer stay fixed — give the parent a\n // height (e.g. h-screen / a fixed card height). Falls back to a 600px\n // floor so it never collapses when dropped in an unsized container.\n // Responsive via CONTAINER queries (@container/agreement), not viewport:\n // the side rails + generous padding only appear when the viewer's own\n // container is wide (≥64rem). In a phone frame or a narrow panel it\n // collapses to the single-column compact layout regardless of the\n // browser viewport.\n \"ds:group/agreement ds:@container/agreement ds:bg-bg ds:text-fg ds:flex ds:h-full ds:min-h-[600px] ds:flex-col ds:font-sans\",\n className,\n )}\n >\n {/* Header */}\n <header className=\"ds:flex ds:items-center ds:gap-2.5 ds:px-4 ds:pt-4 ds:pb-3 ds:@5xl/agreement:gap-3.5 ds:@5xl/agreement:px-7\">\n <span\n aria-hidden=\"true\"\n className=\"ds:rounded-icon ds:flex ds:size-9 ds:shrink-0 ds:items-center ds:justify-center ds:bg-[var(--av-accent-tint)] ds:text-[var(--av-accent)]\"\n >\n <EyeIcon className=\"ds:size-4.5\" />\n </span>\n <div className=\"ds:flex ds:min-w-0 ds:flex-col\">\n <span className=\"ds:text-fg-3 ds:text-[11.5px] ds:leading-tight ds:font-semibold\">{overline}</span>\n <span className=\"ds:font-display ds:text-fg ds:truncate ds:text-[17px] ds:leading-tight ds:font-semibold ds:tracking-tight\">\n {title}\n </span>\n </div>\n <div className=\"ds:ml-auto ds:flex ds:items-center ds:gap-2\">\n {!isCover && (\n <span className=\"ds:border-rule ds:bg-bg-2 ds:text-fg-2 ds:shrink-0 ds:rounded-md ds:border ds:px-2.5 ds:py-1 ds:text-xs ds:font-semibold ds:whitespace-nowrap\">\n Step {current + 1} of {steps.length}\n </span>\n )}\n {headerActions}\n {onDownload && (\n <button\n type=\"button\"\n onClick={onDownload}\n aria-label=\"Download PDF\"\n className={cn(\n \"ds:inline-flex ds:h-9 ds:shrink-0 ds:items-center ds:gap-1.5 ds:rounded-[9px] ds:px-2.5 ds:text-[13px] ds:font-medium ds:whitespace-nowrap ds:@5xl/agreement:px-3.5\",\n \"ds:border-rule-strong ds:bg-surface ds:text-fg ds:border\",\n \"ds:transition-colors ds:duration-[var(--duration-fast)] ds:ease-[var(--ease-out-quart)] ds:motion-reduce:transition-none\",\n \"ds:hover:bg-surface-hover\",\n \"ds:focus-visible:[box-shadow:var(--shadow-focus-ring)] ds:focus-visible:outline-none\",\n )}\n >\n <DownloadIcon className=\"ds:size-4\" aria-hidden=\"true\" />\n <span className=\"ds:hidden ds:@5xl/agreement:inline\">Download PDF</span>\n </button>\n )}\n {onClose && (\n <button type=\"button\" onClick={onClose} aria-label=\"Close\" className={ICON_BTN}>\n <XIcon className=\"ds:size-4\" aria-hidden=\"true\" />\n </button>\n )}\n </div>\n </header>\n\n {/* Status banner */}\n {bannerContent != null && (\n <div\n className={cn(\n \"ds:mx-4 ds:flex ds:items-center ds:gap-2.5 ds:rounded-[11px] ds:border ds:px-4 ds:py-2.5 ds:text-[13.5px] ds:font-medium ds:@5xl/agreement:mx-7\",\n status === \"signed\"\n ? \"ds:border-success-line ds:bg-success-bg ds:text-success-fg\"\n : \"ds:border-[var(--av-accent-tint2)] ds:bg-[var(--av-accent-tint)] ds:text-[var(--av-accent-soft)]\",\n )}\n >\n <CheckIcon className=\"ds:size-4 ds:shrink-0\" aria-hidden=\"true\" />\n <span>{bannerContent}</span>\n </div>\n )}\n\n {/* Stage */}\n <div className=\"ds:flex ds:min-h-0 ds:flex-1 ds:flex-col ds:px-4 ds:pt-3 ds:pb-5 ds:@5xl/agreement:px-7 ds:@5xl/agreement:pb-8\">\n {/* Card: rail + content. Fills the stage (minus footer); the content\n pane inside scrolls. 18px radius is a one-off frame metric, not a\n reusable role token. */}\n <div className=\"ds:border-rule ds:bg-surface ds:shadow-card ds:flex ds:min-h-0 ds:flex-1 ds:overflow-hidden ds:rounded-[18px] ds:border\">\n {/* Cover rail (gradient, firm branding) — step 0; optional via coverRail */}\n {coverRail && (\n <aside\n className=\"ds:hidden ds:w-[340px] ds:shrink-0 ds:flex-col ds:overflow-y-auto ds:p-8 ds:text-white ds:@5xl/agreement:group-data-[view=cover]/agreement:flex\"\n style={{\n backgroundImage:\n \"linear-gradient(166deg, var(--av-accent-light) 0%, var(--av-accent) 50%, var(--av-accent-deep) 100%)\",\n }}\n >\n <span\n aria-hidden=\"true\"\n className=\"ds:rounded-card ds:flex ds:size-[54px] ds:items-center ds:justify-center ds:bg-white ds:text-[17px] ds:font-semibold ds:text-[var(--av-accent)] ds:shadow-raised\"\n >\n {monogram}\n </span>\n <div className=\"ds:mt-4 ds:text-[21px] ds:leading-tight ds:font-semibold\">{firm.name}</div>\n {firm.tagline && (\n <div className=\"ds:mt-1.5 ds:text-[13px] ds:leading-snug ds:text-white/80\">{firm.tagline}</div>\n )}\n {firm.contact && (\n <div className=\"ds:mt-auto ds:pt-7\">\n <div className=\"ds:mb-4 ds:h-px ds:bg-white/20\" />\n <div className=\"ds:flex ds:flex-col ds:gap-3 ds:text-[12.5px] ds:text-white/90\">\n {firm.contact.phone && (\n <span className=\"ds:flex ds:items-center ds:gap-2.5\">\n <PhoneIcon className=\"ds:size-4 ds:shrink-0 ds:opacity-85\" aria-hidden=\"true\" />\n {firm.contact.phone}\n </span>\n )}\n {firm.contact.email && (\n <span className=\"ds:flex ds:items-center ds:gap-2.5\">\n <MailIcon className=\"ds:size-4 ds:shrink-0 ds:opacity-85\" aria-hidden=\"true\" />\n {firm.contact.email}\n </span>\n )}\n {firm.contact.website && (\n <span className=\"ds:flex ds:items-center ds:gap-2.5\">\n <GlobeIcon className=\"ds:size-4 ds:shrink-0 ds:opacity-85\" aria-hidden=\"true\" />\n {firm.contact.website}\n </span>\n )}\n </div>\n </div>\n )}\n </aside>\n )}\n\n {/* Inner rail (sections stepper) — steps 1+ */}\n <aside className=\"ds:border-rule ds:bg-surface-2 ds:hidden ds:w-[300px] ds:shrink-0 ds:flex-col ds:overflow-y-auto ds:border-r ds:px-6 ds:py-7 ds:@5xl/agreement:group-data-[view=inner]/agreement:flex\">\n <div className=\"ds:flex ds:items-center ds:gap-3\">\n <span\n aria-hidden=\"true\"\n className=\"ds:rounded-icon ds:flex ds:size-10 ds:shrink-0 ds:items-center ds:justify-center ds:bg-[var(--av-accent)] ds:text-[13px] ds:font-bold ds:text-[var(--av-accent-contrast)]\"\n >\n {monogram}\n </span>\n <div className=\"ds:min-w-0\">\n <div className=\"ds:text-fg ds:truncate ds:text-sm ds:font-semibold\">{firm.name}</div>\n <div className=\"ds:text-fg-4 ds:text-[11.5px]\">{firm.subtitle ?? \"Your proposal\"}</div>\n </div>\n </div>\n <div className=\"ds:text-fg-4 ds:mt-6 ds:text-[11.5px] ds:font-semibold ds:tracking-wide\">\n Sections\n </div>\n <nav aria-label=\"Agreement sections\" className=\"ds:mt-3 ds:flex ds:flex-col ds:gap-0.5\">\n {steps.map((s, i) => {\n const on = i === current;\n const done = status === \"signed\" ? i !== current && i !== 0 : i < current;\n return (\n <button\n key={s.id}\n type=\"button\"\n onClick={() => goTo(i)}\n aria-current={on ? \"step\" : undefined}\n data-on={on || undefined}\n data-done={done || undefined}\n data-first={i === 0 || undefined}\n className={cn(\n \"ds:group/step ds:text-fg-3 ds:relative ds:z-[calc(var(--z-base)+1)] ds:flex ds:w-full ds:items-center ds:gap-3.5 ds:rounded-[12px] ds:py-2.5 ds:pr-3.5 ds:pl-2 ds:text-left ds:text-[13.5px] ds:font-medium\",\n \"ds:transition-colors ds:duration-[var(--duration-normal)] ds:ease-[var(--ease-out-quart)] ds:motion-reduce:transition-none\",\n \"ds:hover:bg-surface-hover\",\n \"ds:data-[on]:bg-[var(--av-accent-tint)] ds:data-[on]:font-semibold ds:data-[on]:text-[var(--av-accent-soft)]\",\n \"ds:focus-visible:[box-shadow:var(--shadow-focus-ring)] ds:focus-visible:outline-none\",\n )}\n >\n <span\n aria-hidden=\"true\"\n className={cn(\n \"ds:relative ds:flex ds:size-7 ds:shrink-0 ds:items-center ds:justify-center ds:rounded-full ds:border-[1.5px] ds:text-[12.5px] ds:font-semibold\",\n \"ds:border-[var(--av-accent-tint2)] ds:bg-[var(--color-surface)] ds:text-[var(--av-accent)]\",\n \"ds:transition-colors ds:duration-[var(--duration-normal)] ds:ease-[var(--ease-out-quart)] ds:motion-reduce:transition-none\",\n // connector to the node above (skipped on the first step)\n \"ds:before:absolute ds:before:bottom-full ds:before:left-1/2 ds:before:h-[18px] ds:before:w-[2.5px] ds:before:-translate-x-1/2 ds:before:rounded-full ds:before:bg-[var(--av-accent-tint2)] ds:before:transition-colors ds:before:content-['']\",\n \"ds:group-data-[first]/step:before:hidden\",\n \"ds:group-data-[done]/step:border-[var(--av-accent)] ds:group-data-[done]/step:bg-[var(--av-accent)] ds:group-data-[done]/step:text-[var(--av-accent-contrast)] ds:group-data-[done]/step:before:bg-[var(--av-accent)]\",\n \"ds:group-data-[on]/step:border-[var(--av-accent)] ds:group-data-[on]/step:bg-[var(--av-accent)] ds:group-data-[on]/step:text-[var(--av-accent-contrast)] ds:group-data-[on]/step:before:bg-[var(--av-accent)]\",\n )}\n >\n {s.icon ?? (i === 0 ? <HomeIcon className=\"ds:size-3.5\" /> : done ? <CheckIcon className=\"ds:size-3.5\" /> : i)}\n </span>\n <span className=\"ds:truncate\">{s.label}</span>\n </button>\n );\n })}\n </nav>\n </aside>\n\n {/* Content pane — a container itself (@container/pane) so consumer\n content can reflow to the pane width, not the viewport. */}\n <section\n data-bleed={steps[current]?.bleed || undefined}\n className={cn(\n \"ds:@container/pane ds:scrollbar-thin ds:flex ds:min-w-0 ds:flex-1 ds:flex-col ds:overflow-y-auto\",\n // `bleed` steps own their own padding so a cover can reach the\n // card edges — this replaces the app-side\n // `*:has(> [data-esign-cover]) { padding: 0 }` global rule.\n steps[current]?.bleed\n ? \"ds:p-0\"\n : \"ds:px-5 ds:py-7 ds:@5xl/agreement:px-[52px] ds:@5xl/agreement:py-11\",\n )}\n >\n {steps[current]?.content}\n </section>\n </div>\n\n {/* Footer nav */}\n <div className=\"ds:mt-4 ds:flex ds:items-center ds:justify-between\">\n <button\n type=\"button\"\n onClick={() => goTo(current - 1)}\n disabled={current === 0}\n className={cn(\n \"ds:inline-flex ds:h-[42px] ds:items-center ds:gap-1.5 ds:rounded-[11px] ds:px-4 ds:text-sm ds:font-medium\",\n \"ds:border-rule-strong ds:bg-surface ds:text-fg-2 ds:border\",\n \"ds:transition-colors ds:duration-[var(--duration-fast)] ds:ease-[var(--ease-out-quart)] ds:motion-reduce:transition-none\",\n \"ds:hover:bg-surface-hover\",\n \"ds:disabled:border-rule ds:disabled:text-fg-disabled ds:disabled:cursor-default ds:disabled:bg-transparent\",\n \"ds:focus-visible:[box-shadow:var(--shadow-focus-ring)] ds:focus-visible:outline-none\",\n )}\n >\n <ChevronLeftIcon className=\"ds:size-4\" aria-hidden=\"true\" />\n Previous\n </button>\n\n <div className=\"ds:flex ds:items-center ds:gap-1.5\">\n {steps.map((s, i) => (\n <button\n key={s.id}\n type=\"button\"\n onClick={() => goTo(i)}\n aria-label={`Go to ${s.label}`}\n aria-current={i === current ? \"step\" : undefined}\n className={cn(\n \"ds:bg-rule-strong ds:h-2 ds:rounded-full\",\n \"ds:transition-[width,background-color] ds:duration-[var(--duration-normal)] ds:ease-[var(--ease-out-quart)] ds:motion-reduce:transition-none\",\n \"ds:focus-visible:[box-shadow:var(--shadow-focus-ring)] ds:focus-visible:outline-none\",\n i === current ? \"ds:w-[22px] ds:bg-[var(--av-accent)]\" : \"ds:w-2\",\n )}\n />\n ))}\n </div>\n\n <button\n type=\"button\"\n onClick={() => goTo(current + 1)}\n disabled={nextDisabled}\n aria-describedby={nextDisabled && nextDisabledReason != null ? reasonId : undefined}\n style={current === lastIndex ? { visibility: \"hidden\" } : undefined}\n className={cn(\n \"ds:inline-flex ds:h-[42px] ds:items-center ds:gap-2 ds:rounded-[11px] ds:px-5 ds:text-sm ds:font-semibold\",\n \"ds:bg-[var(--av-accent)] ds:text-[var(--av-accent-contrast)]\",\n \"ds:transition-[filter] ds:duration-[var(--duration-fast)] ds:ease-[var(--ease-out-quart)] ds:motion-reduce:transition-none\",\n \"ds:hover:brightness-105\",\n \"ds:focus-visible:[box-shadow:var(--shadow-focus-ring)] ds:focus-visible:outline-none\",\n \"ds:disabled:border-rule ds:disabled:bg-bg-disabled ds:disabled:text-fg-disabled ds:disabled:cursor-not-allowed ds:disabled:border ds:disabled:hover:brightness-100\",\n )}\n >\n Next\n <ChevronRightIcon className=\"ds:size-4\" aria-hidden=\"true\" />\n </button>\n </div>\n\n {footer && <div className=\"ds:mt-4\">{footer}</div>}\n\n {nextDisabledReason != null && (\n <p\n id={reasonId}\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n className=\"ds:text-fg-3 ds:mt-1.5 ds:min-h-5 ds:text-right ds:text-sm\"\n >\n {nextDisabled ? nextDisabledReason : null}\n </p>\n )}\n </div>\n </div>\n );\n },\n);\nAgreementViewer.displayName = \"AgreementViewer\";\n\n/* ─── Pane heading ────────────────────────────────────────────── */\n\nexport interface AgreementPaneHeadingProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** Accent overline, e.g. \"Step 3 of 6\". */\n overline?: ReactNode;\n /** The pane title. */\n title: ReactNode;\n /** Supporting line under the title. */\n subtitle?: ReactNode;\n}\n\nexport const AgreementPaneHeading = forwardRef<HTMLDivElement, AgreementPaneHeadingProps>(\n function AgreementPaneHeading({ overline, title, subtitle, className, ...props }, ref) {\n return (\n <div ref={ref} className={cn(\"ds:mb-6\", className)} {...props}>\n {overline && (\n <div className=\"ds:mb-1.5 ds:text-xs ds:font-semibold ds:tracking-wide ds:text-[var(--av-accent-soft)]\">\n {overline}\n </div>\n )}\n <h2 className=\"ds:font-display ds:text-fg ds:text-[27px] ds:leading-tight ds:font-bold ds:tracking-tight\">\n {title}\n </h2>\n {subtitle && <p className=\"ds:text-fg-3 ds:mt-2 ds:text-sm ds:leading-relaxed\">{subtitle}</p>}\n </div>\n );\n },\n);\nAgreementPaneHeading.displayName = \"AgreementPaneHeading\";\n","\"use client\";\n\nimport { forwardRef, useId, type ReactNode } from \"react\";\n\nimport { cn } from \"../lib/cn\";\nimport {\n CheckIcon,\n CreditCardIcon,\n EyeIcon,\n LockIcon,\n ReceiptIcon,\n RotateCcwIcon,\n} from \"../primitives/icons\";\n\n/**\n * Proposal pricing building-blocks — the client-preview pieces a signing\n * package's \"Services & Pricing\" config renders into. They compose inside an\n * `AgreementViewer` step (where they inherit the firm `--av-accent`), or\n * standalone inside a `[data-av-scope]` wrapper. Accent classes carry a suite\n * fallback so a bare block still renders un-branded rather than transparent.\n *\n * - `ProposalServiceRow` — one line item (name · price · cadence, optional\n * struck-through original for a discount).\n * - `ProposalPackageCard` — a package the client chooses; `mode` switches the\n * builder's three choice models (pick-one / add-on /\n * always-included).\n * - `ProposalPricingSummary`— the \"review total\" block: what's included, the\n * billing schedule, discount savings, tax, total.\n *\n * @since 1.12.0\n */\n\n/* ─── Service line item ───────────────────────────────────────── */\n\nexport interface ProposalServiceRowProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Service name — the primary line. */\n name: ReactNode;\n /** Optional secondary description shown to the client. */\n description?: ReactNode;\n /** Formatted price, e.g. \"$1,300\" or \"$50/mo\". */\n price?: ReactNode;\n /** Pre-discount price, struck through before `price`. */\n originalPrice?: ReactNode;\n /** Leading marker. \"check\" (accent tick) or \"none\". Default \"check\". */\n marker?: \"check\" | \"none\";\n}\n\nexport const ProposalServiceRow = forwardRef<HTMLDivElement, ProposalServiceRowProps>(\n function ProposalServiceRow(\n { name, description, price, originalPrice, marker = \"check\", className, ...props },\n ref,\n ) {\n return (\n <div ref={ref} className={cn(\"ds:flex ds:items-start ds:gap-2.5 ds:py-1.5\", className)} {...props}>\n {marker === \"check\" && (\n <CheckIcon\n className=\"ds:mt-0.5 ds:size-3.5 ds:shrink-0 ds:text-[var(--av-accent,var(--color-accent))]\"\n aria-hidden=\"true\"\n />\n )}\n <div className=\"ds:min-w-0 ds:flex-1\">\n <div className=\"ds:text-fg-2 ds:text-[12.5px] ds:leading-snug\">{name}</div>\n {description && <div className=\"ds:text-fg-4 ds:mt-0.5 ds:text-[11.5px] ds:leading-snug\">{description}</div>}\n </div>\n {(price != null || originalPrice != null) && (\n <div className=\"ds:flex ds:shrink-0 ds:items-baseline ds:gap-1.5 ds:text-xs\">\n {originalPrice != null && (\n <span className=\"ds:text-fg-4 ds:line-through\">{originalPrice}</span>\n )}\n {price != null && <span className=\"ds:text-fg-3 ds:tabular\">{price}</span>}\n </div>\n )}\n </div>\n );\n },\n);\nProposalServiceRow.displayName = \"ProposalServiceRow\";\n\n/* ─── Package card ────────────────────────────────────────────── */\n\nexport type ProposalPackageMode = \"choice\" | \"addon\" | \"included\";\n\nexport interface ProposalPackageCardProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onSelect\"> {\n /** Package name. */\n name: ReactNode;\n /** Short count line, e.g. \"Includes 4 services\". */\n summary?: ReactNode;\n /** Formatted package price. */\n price?: ReactNode;\n /** Caption under the price, e.g. \"Package total\". */\n priceCaption?: ReactNode;\n /** Pre-discount price, struck through. */\n originalPrice?: ReactNode;\n /** Savings line, e.g. \"You save $200\". */\n savings?: ReactNode;\n /** How the client chooses this package. Default \"choice\". */\n mode?: ProposalPackageMode;\n /** Selected / added state (drives accent border + control label). */\n selected?: boolean;\n /** Corner badge, e.g. \"Most popular\". A \"Selected\"/\"Added\" badge is implied. */\n badge?: ReactNode;\n /** Label above the service rows. Default \"Included services\". */\n servicesLabel?: ReactNode;\n /** Service rows (`ProposalServiceRow`) or any content. */\n children?: ReactNode;\n /**\n * Cap the service list's height (any CSS length, e.g. `\"14rem\"`). Past it the\n * list scrolls rather than growing, so a package with many services keeps its\n * select control in view instead of pushing it below the fold — and cards\n * sitting in a row stay the same height.\n *\n * Omit for the previous behaviour: the list grows to fit.\n */\n servicesMaxHeight?: string;\n /** Select / toggle handler — makes the card interactive. */\n onSelect?: () => void;\n disabled?: boolean;\n}\n\nconst CONTROL_LABEL: Record<ProposalPackageMode, [on: string, off: string]> = {\n choice: [\"Selected\", \"Select package\"],\n addon: [\"Added\", \"Add to proposal\"],\n included: [\"Included\", \"Included\"],\n};\n\nexport const ProposalPackageCard = forwardRef<HTMLDivElement, ProposalPackageCardProps>(\n function ProposalPackageCard(\n {\n name,\n summary,\n price,\n priceCaption,\n originalPrice,\n savings,\n mode = \"choice\",\n selected = false,\n badge,\n servicesLabel = \"Included services\",\n children,\n servicesMaxHeight,\n onSelect,\n disabled = false,\n className,\n ...props\n },\n ref,\n ) {\n const interactive = mode !== \"included\" && !!onSelect;\n const [onLabel, offLabel] = CONTROL_LABEL[mode];\n const servicesLabelId = useId();\n\n return (\n <div\n ref={ref}\n data-selected={selected || undefined}\n className={cn(\n \"ds:border-rule ds:bg-surface ds:relative ds:flex ds:flex-col ds:rounded-[14px] ds:border ds:p-4\",\n \"ds:data-[selected]:border-[var(--av-accent,var(--color-accent))] ds:data-[selected]:shadow-[0_0_0_1px_var(--av-accent,var(--color-accent))]\",\n className,\n )}\n {...props}\n >\n {(badge || selected) && (\n <span className=\"ds:rounded-pill ds:absolute ds:-top-2.5 ds:left-4 ds:flex ds:items-center ds:gap-1 ds:bg-[var(--av-accent,var(--color-accent))] ds:px-2 ds:py-1 ds:text-[10px] ds:font-bold ds:tracking-wide ds:text-[var(--av-accent-contrast,var(--color-fg-on-accent))]\">\n {selected && <CheckIcon className=\"ds:size-3\" aria-hidden=\"true\" />}\n {badge ?? (selected ? onLabel : null)}\n </span>\n )}\n\n <div className=\"ds:text-fg ds:text-[15px] ds:font-semibold\">{name}</div>\n {summary && <div className=\"ds:text-fg-4 ds:mt-0.5 ds:text-xs\">{summary}</div>}\n\n {price != null && (\n <div className=\"ds:mt-2.5\">\n <div className=\"ds:flex ds:items-baseline ds:gap-2\">\n {originalPrice != null && (\n <span className=\"ds:text-fg-4 ds:text-base ds:line-through\">{originalPrice}</span>\n )}\n <span className=\"ds:text-fg ds:text-[23px] ds:font-bold ds:tracking-tight ds:tabular\">{price}</span>\n </div>\n {priceCaption && <div className=\"ds:text-fg-4 ds:text-[11.5px]\">{priceCaption}</div>}\n {savings && (\n <div className=\"ds:text-success-fg ds:mt-1 ds:text-[11.5px] ds:font-semibold\">{savings}</div>\n )}\n </div>\n )}\n\n {children && (\n <>\n <div\n id={servicesLabelId}\n className=\"ds:text-fg-3 ds:mt-4 ds:mb-1 ds:text-[11.5px] ds:font-semibold ds:tracking-wide\"\n >\n {servicesLabel}\n </div>\n {/* Unbounded by default, so existing cards render as they always\n * have. Given a cap, the list scrolls instead of growing — which\n * is all it takes to keep the select control on screen, since the\n * card is already a flex column with `mt-auto` on that control.\n * `min-h-0` lets the list actually shrink inside that column. */}\n <div\n {...(servicesMaxHeight\n ? { role: \"region\", \"aria-labelledby\": servicesLabelId, tabIndex: 0 }\n : {})}\n className={cn(\n servicesMaxHeight && [\n \"ds:min-h-0 ds:overflow-y-auto\",\n \"ds:focus-visible:[box-shadow:var(--shadow-focus-ring)] ds:focus-visible:outline-none\",\n // pr-3 keeps the rail off the service text; -mr-1 gives that\n // padding back to the card so the rail still sits near its\n // edge rather than floating in from it.\n \"ds:-mr-1 ds:pr-3\",\n // A 2px hairline. `scrollbar-thin` is 8px, and on\n // Chrome-for-Windows an unstyled bar also carries stepper\n // arrows, which is most of what made it read as heavy.\n \"ds:[scrollbar-width:thin]\",\n \"ds:[&::-webkit-scrollbar]:w-[2px]\",\n \"ds:[&::-webkit-scrollbar-button]:hidden\",\n \"ds:[&::-webkit-scrollbar-track]:bg-transparent\",\n \"ds:[&::-webkit-scrollbar-thumb]:rounded-full\",\n \"ds:[&::-webkit-scrollbar-thumb]:bg-rule-strong\",\n ],\n )}\n style={servicesMaxHeight ? { maxHeight: servicesMaxHeight } : undefined}\n >\n {children}\n </div>\n </>\n )}\n\n <div className=\"ds:mt-auto ds:pt-4\">\n {interactive ? (\n <button\n type=\"button\"\n role={mode === \"addon\" ? \"checkbox\" : \"radio\"}\n aria-checked={selected}\n disabled={disabled}\n onClick={onSelect}\n className={cn(\n \"ds:rounded-input ds:flex ds:h-10 ds:w-full ds:items-center ds:justify-center ds:text-[13.5px] ds:font-semibold\",\n \"ds:transition-colors ds:duration-[var(--duration-fast)] ds:ease-[var(--ease-out-quart)] ds:motion-reduce:transition-none\",\n \"ds:focus-visible:[box-shadow:var(--shadow-focus-ring)] ds:focus-visible:outline-none\",\n selected\n ? \"ds:bg-[var(--av-accent,var(--color-accent))] ds:text-[var(--av-accent-contrast,var(--color-fg-on-accent))]\"\n : \"ds:border-rule-strong ds:text-fg ds:hover:bg-surface-hover ds:border\",\n \"ds:disabled:cursor-not-allowed ds:disabled:opacity-60\",\n )}\n >\n {selected ? onLabel : offLabel}\n </button>\n ) : (\n <div\n className={cn(\n \"ds:rounded-input ds:flex ds:h-10 ds:w-full ds:items-center ds:justify-center ds:gap-1.5 ds:text-[13.5px] ds:font-semibold\",\n mode === \"included\"\n ? \"ds:bg-[var(--av-accent-tint,var(--color-accent-tint))] ds:text-[var(--av-accent-soft,var(--color-accent-2))]\"\n : \"ds:border-rule ds:text-fg-3 ds:border\",\n )}\n >\n {mode === \"included\" && <CheckIcon className=\"ds:size-3.5\" aria-hidden=\"true\" />}\n {selected ? onLabel : offLabel}\n </div>\n )}\n </div>\n </div>\n );\n },\n);\nProposalPackageCard.displayName = \"ProposalPackageCard\";\n\n/* ─── Billing terms (read-only arrangement) ───────────────────── */\n\nexport type ProposalBillingMode = \"now\" | \"auto\" | \"review\" | \"manual\" | \"onetime\";\n\nconst BILLING_ICON: Record<ProposalBillingMode, typeof CheckIcon> = {\n now: CreditCardIcon,\n auto: RotateCcwIcon,\n review: EyeIcon,\n manual: ReceiptIcon,\n onetime: CheckIcon,\n};\n\nexport interface ProposalBillingRow {\n /** e.g. \"Due today\", \"First payment\", \"Then, monthly\", \"Each invoice\". */\n label: ReactNode;\n /** Formatted amount, e.g. \"$2,526\". */\n amount?: ReactNode;\n /** Cadence beside the amount, e.g. \"/mo\". */\n cadence?: ReactNode;\n /** Plain-language explanation of how/when this is charged. */\n detail: ReactNode;\n /** Drives the row icon. Default \"now\". */\n mode?: ProposalBillingMode;\n}\n\nexport interface ProposalBillingTermsProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** Heading. Default \"How billing works\". */\n title?: ReactNode;\n /** The billing steps the firm configured. */\n rows: ProposalBillingRow[];\n /** Show the \"set by your firm — review only\" footer. Default true. */\n locked?: boolean;\n}\n\n/**\n * ProposalBillingTerms — a read-only explanation of the payment arrangement the\n * firm configured (auto-pay, charge-after-review, manual invoicing, one-time,\n * or a mix). The client can see exactly what will be charged and when, but\n * can't change it — the `locked` footer makes that explicit.\n */\nexport const ProposalBillingTerms = forwardRef<HTMLDivElement, ProposalBillingTermsProps>(\n function ProposalBillingTerms(\n { title = \"How billing works\", rows, locked = true, className, ...props },\n ref,\n ) {\n return (\n <div\n ref={ref}\n className={cn(\"ds:border-rule ds:overflow-hidden ds:rounded-[14px] ds:border\", className)}\n {...props}\n >\n {title && (\n <div className=\"ds:border-rule ds:bg-surface-2 ds:text-fg ds:border-b ds:px-5 ds:py-3 ds:text-[13px] ds:font-semibold\">\n {title}\n </div>\n )}\n <div className=\"ds:divide-rule-soft ds:divide-y\">\n {rows.map((r, i) => {\n const Icon = BILLING_ICON[r.mode ?? \"now\"];\n return (\n <div key={i} className=\"ds:flex ds:items-start ds:gap-3.5 ds:px-5 ds:py-3.5\">\n <span\n aria-hidden=\"true\"\n className=\"ds:rounded-icon ds:mt-0.5 ds:flex ds:size-9 ds:shrink-0 ds:items-center ds:justify-center ds:bg-[var(--av-accent-tint,var(--color-accent-tint))] ds:text-[var(--av-accent,var(--color-accent))]\"\n >\n <Icon className=\"ds:size-4.5\" />\n </span>\n <div className=\"ds:min-w-0 ds:flex-1\">\n <div className=\"ds:flex ds:items-baseline ds:justify-between ds:gap-3\">\n <span className=\"ds:text-fg ds:text-sm ds:font-semibold\">{r.label}</span>\n {r.amount != null && (\n <span className=\"ds:text-fg ds:shrink-0 ds:text-sm ds:font-semibold ds:tabular\">\n {r.amount}\n {r.cadence && (\n <small className=\"ds:text-fg-4 ds:ml-0.5 ds:text-xs ds:font-medium\">{r.cadence}</small>\n )}\n </span>\n )}\n </div>\n <div className=\"ds:text-fg-3 ds:mt-0.5 ds:text-[13px] ds:leading-snug\">{r.detail}</div>\n </div>\n </div>\n );\n })}\n </div>\n {locked && (\n <div className=\"ds:border-rule ds:bg-surface-2 ds:text-fg-4 ds:flex ds:items-center ds:gap-2 ds:border-t ds:px-5 ds:py-2.5 ds:text-[12px]\">\n <LockIcon className=\"ds:size-3.5 ds:shrink-0\" aria-hidden=\"true\" />\n Set by your firm — you can review these terms, but not change them.\n </div>\n )}\n </div>\n );\n },\n);\nProposalBillingTerms.displayName = \"ProposalBillingTerms\";\n\n/* ─── Add-on toggle ───────────────────────────────────────────── */\n\nexport interface ProposalAddOnProps\n extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"onToggle\" | \"name\"> {\n /** Add-on name. */\n name: ReactNode;\n /** Short description / cadence note under the name. */\n description?: ReactNode;\n /** Formatted price, e.g. \"$150\" or \"$200\". */\n price?: ReactNode;\n /** Cadence / billing note beside the price, e.g. \"/mo\" or \"One-time\". */\n cadence?: ReactNode;\n /** Added state. */\n selected?: boolean;\n /** Toggle handler. */\n onToggle?: () => void;\n}\n\n/**\n * ProposalAddOn — a compact, checkbox-style toggle for an optional add-on.\n * Lighter than `ProposalPackageCard`: add-ons are secondary extras, so the\n * whole row is one toggle (no separate badge + button), price right-aligned.\n */\nexport const ProposalAddOn = forwardRef<HTMLButtonElement, ProposalAddOnProps>(\n function ProposalAddOn(\n { name, description, price, cadence, selected = false, onToggle, disabled, className, ...props },\n ref,\n ) {\n return (\n <button\n ref={ref}\n type=\"button\"\n role=\"checkbox\"\n aria-checked={selected}\n disabled={disabled}\n onClick={onToggle}\n data-selected={selected || undefined}\n className={cn(\n \"ds:group/addon ds:flex ds:w-full ds:items-center ds:gap-3.5 ds:rounded-[12px] ds:border ds:p-4 ds:text-left\",\n \"ds:border-rule ds:bg-surface\",\n \"ds:transition-colors ds:duration-[var(--duration-fast)] ds:ease-[var(--ease-out-quart)] ds:motion-reduce:transition-none\",\n \"ds:hover:bg-surface-hover\",\n \"ds:data-[selected]:border-[var(--av-accent,var(--color-accent))] ds:data-[selected]:bg-[var(--av-accent-tint,var(--color-accent-tint))]\",\n \"ds:focus-visible:[box-shadow:var(--shadow-focus-ring)] ds:focus-visible:outline-none\",\n \"ds:disabled:cursor-not-allowed ds:disabled:opacity-60\",\n className,\n )}\n {...props}\n >\n <span\n aria-hidden=\"true\"\n className={cn(\n \"ds:flex ds:size-5 ds:shrink-0 ds:items-center ds:justify-center ds:rounded-md ds:border-[1.5px] ds:text-transparent\",\n \"ds:border-rule-strong\",\n \"ds:group-data-[selected]/addon:border-[var(--av-accent,var(--color-accent))] ds:group-data-[selected]/addon:bg-[var(--av-accent,var(--color-accent))] ds:group-data-[selected]/addon:text-[var(--av-accent-contrast,var(--color-fg-on-accent))]\",\n )}\n >\n <CheckIcon className=\"ds:size-3.5\" />\n </span>\n <div className=\"ds:min-w-0 ds:flex-1\">\n <div className=\"ds:text-fg ds:text-sm ds:font-semibold\">{name}</div>\n {description && (\n <div className=\"ds:text-fg-4 ds:group-data-[selected]/addon:text-fg-3 ds:text-xs\">{description}</div>\n )}\n </div>\n {(price != null || cadence != null) && (\n <div className=\"ds:shrink-0 ds:text-right\">\n {price != null && <div className=\"ds:text-fg ds:text-[15px] ds:font-bold ds:tabular\">{price}</div>}\n {cadence != null && (\n <div className=\"ds:text-fg-4 ds:group-data-[selected]/addon:text-fg-3 ds:text-[11.5px]\">{cadence}</div>\n )}\n </div>\n )}\n </button>\n );\n },\n);\nProposalAddOn.displayName = \"ProposalAddOn\";\n\n/* ─── Pricing summary / review total ──────────────────────────── */\n\nexport interface ProposalPricingSummaryProps extends React.HTMLAttributes<HTMLDivElement> {\n /** \"What's included\" rows (`ProposalServiceRow`) — rendered in a 2-col grid. */\n children?: ReactNode;\n /** Billing schedule callout. */\n billing?: {\n title?: ReactNode;\n caption?: ReactNode;\n rows?: { label: ReactNode; value: ReactNode }[];\n };\n /** Discount savings line, e.g. \"You save $200 (annual)\". */\n savings?: ReactNode;\n /** Tax line value, e.g. \"$192.00\". `taxLabel` defaults to \"Tax\". */\n tax?: ReactNode;\n taxLabel?: ReactNode;\n /** Pre-discount total, struck through next to `total`. */\n originalTotal?: ReactNode;\n /** Total due — used for a single-cadence engagement. Omit when `schedule` is set. */\n total?: ReactNode;\n /** Cadence suffix after the total, e.g. \"/ year\". */\n cadence?: ReactNode;\n /** Total row label. Default \"Total due\". */\n totalLabel?: ReactNode;\n /** First-payment + recurring breakdown. Use instead of `total` when billing\n * mixes cadences (e.g. a yearly package + a monthly add-on): the amount due\n * at signing reads prominently, with the ongoing charges listed below. */\n schedule?: {\n /** Amount charged at signing — the prominent figure. */\n dueToday: ReactNode;\n /** Label for the due-now figure. Default \"Due today\". */\n dueTodayLabel?: ReactNode;\n /** Caption under the due-now figure, e.g. \"First payment, on acceptance\". */\n dueTodayCaption?: ReactNode;\n /** Ongoing recurring charges, e.g. [{ label: \"Then\", amount: \"$2,400\", cadence: \"/ year\" }]. */\n then?: { label?: ReactNode; amount: ReactNode; cadence?: ReactNode }[];\n };\n}\n\nexport const ProposalPricingSummary = forwardRef<HTMLDivElement, ProposalPricingSummaryProps>(\n function ProposalPricingSummary(\n {\n children,\n billing,\n savings,\n tax,\n taxLabel = \"Tax\",\n originalTotal,\n total,\n cadence,\n totalLabel = \"Total due\",\n schedule,\n className,\n ...props\n },\n ref,\n ) {\n return (\n <div ref={ref} className={cn(\"ds:@container/summary ds:flex ds:flex-col\", className)} {...props}>\n {children && (\n <div className=\"ds:border-rule ds:grid ds:grid-cols-1 ds:gap-x-6 ds:gap-y-1 ds:rounded-[14px] ds:border ds:p-6 ds:@md/summary:grid-cols-2\">\n {children}\n </div>\n )}\n\n {billing && (\n <div className=\"ds:mt-4 ds:rounded-[14px] ds:border ds:border-[var(--av-accent-tint2,var(--color-accent-tint))] ds:bg-[var(--av-accent-tint,var(--color-accent-tint))] ds:p-5\">\n <div className=\"ds:flex ds:items-center ds:justify-between\">\n <b className=\"ds:text-[13.5px] ds:font-semibold ds:text-[var(--av-accent-soft,var(--color-accent-2))]\">\n {billing.title ?? \"Billing schedule\"}\n </b>\n {billing.caption && (\n <span className=\"ds:text-[11.5px] ds:text-[var(--av-accent-soft,var(--color-accent-2))]\">\n {billing.caption}\n </span>\n )}\n </div>\n {billing.rows?.map((r, i) => (\n <div\n key={i}\n className=\"ds:text-fg-2 ds:mt-2.5 ds:flex ds:items-center ds:justify-between ds:gap-3 ds:text-[13.5px]\"\n >\n <span>{r.label}</span>\n <b className=\"ds:font-semibold ds:tabular\">{r.value}</b>\n </div>\n ))}\n </div>\n )}\n\n {(savings || tax != null) && (\n <div className=\"ds:mt-4 ds:space-y-2\">\n {savings && (\n <div className=\"ds:text-success-fg ds:flex ds:items-center ds:justify-between ds:text-[13.5px] ds:font-medium\">\n <span>Discount</span>\n <span className=\"ds:tabular\">{savings}</span>\n </div>\n )}\n {tax != null && (\n <div className=\"ds:text-fg-3 ds:flex ds:items-center ds:justify-between ds:text-[13.5px]\">\n <span>{taxLabel}</span>\n <span className=\"ds:tabular\">{tax}</span>\n </div>\n )}\n </div>\n )}\n\n {schedule ? (\n <div className=\"ds:border-rule ds:mt-4 ds:border-t ds:pt-4\">\n <div className=\"ds:flex ds:items-baseline ds:justify-between ds:gap-3\">\n <div>\n <div className=\"ds:text-fg ds:text-[15px] ds:font-semibold\">\n {schedule.dueTodayLabel ?? \"Due today\"}\n </div>\n {schedule.dueTodayCaption && (\n <div className=\"ds:text-fg-4 ds:text-xs\">{schedule.dueTodayCaption}</div>\n )}\n </div>\n <span className=\"ds:text-fg ds:text-[26px] ds:font-bold ds:tabular\">{schedule.dueToday}</span>\n </div>\n {schedule.then && schedule.then.length > 0 && (\n <div className=\"ds:border-rule-soft ds:mt-3 ds:space-y-1.5 ds:border-t ds:pt-3\">\n {schedule.then.map((t, i) => (\n <div\n key={i}\n className=\"ds:text-fg-3 ds:flex ds:items-baseline ds:justify-between ds:gap-3 ds:text-[13.5px]\"\n >\n <span>{t.label ?? \"Then\"}</span>\n <span className=\"ds:tabular\">\n <b className=\"ds:text-fg-2 ds:font-semibold\">{t.amount}</b>\n {t.cadence && (\n <small className=\"ds:text-fg-4 ds:ml-1 ds:text-[12px] ds:font-medium\">{t.cadence}</small>\n )}\n </span>\n </div>\n ))}\n </div>\n )}\n </div>\n ) : (\n total != null && (\n <div className=\"ds:border-rule ds:mt-4 ds:flex ds:items-center ds:justify-between ds:border-t ds:pt-4\">\n <span className=\"ds:text-fg ds:text-[15px] ds:font-semibold\">{totalLabel}</span>\n <span className=\"ds:flex ds:items-baseline ds:gap-2\">\n {originalTotal != null && (\n <span className=\"ds:text-fg-4 ds:text-base ds:line-through\">{originalTotal}</span>\n )}\n <span className=\"ds:text-fg ds:text-[22px] ds:font-bold ds:tabular\">{total}</span>\n {cadence && <small className=\"ds:text-fg-4 ds:text-[13px] ds:font-medium\">{cadence}</small>}\n </span>\n </div>\n )\n )}\n </div>\n );\n },\n);\nProposalPricingSummary.displayName = \"ProposalPricingSummary\";\n","\"use client\";\n\nimport { forwardRef, type ReactNode } from \"react\";\n\nimport { cn } from \"../lib/cn\";\nimport {\n CheckIcon,\n ClockIcon,\n EyeIcon,\n FileTextIcon,\n InfoIcon,\n PlayIcon,\n} from \"../primitives/icons\";\n\n/**\n * Proposal content building-blocks — the optional pieces a signing package's\n * \"custom pages\" and recipient config render into on the client preview.\n *\n * - `ProposalCustomPage` — a titled custom page; `kind` switches the builder's\n * Video / PDF / Text page types. The body (a video\n * poster, a `PdfPreview`, or rich text) is slotted.\n * - `ProposalNote` — a short callout shown alongside the agreement.\n * - `ProposalSignerList` — the recipients/signers with role + status.\n *\n * Accent classes carry a suite fallback, so a bare block renders un-branded\n * outside an `AgreementViewer` / `[data-av-scope]`.\n *\n * @since 1.12.0\n */\n\n/* ─── Custom page (video / pdf / text) ────────────────────────── */\n\nexport type ProposalCustomPageKind = \"video\" | \"pdf\" | \"text\";\n\nconst KIND_META: Record<ProposalCustomPageKind, { label: string; icon: typeof PlayIcon }> = {\n video: { label: \"Video\", icon: PlayIcon },\n pdf: { label: \"Document\", icon: FileTextIcon },\n text: { label: \"Read\", icon: FileTextIcon },\n};\n\nexport interface ProposalCustomPageProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** Builder custom-page type. */\n kind: ProposalCustomPageKind;\n /** Page title. */\n title: ReactNode;\n /** Supporting line under the title. */\n caption?: ReactNode;\n /** Overline label; defaults by kind (\"Video\" / \"Document\" / \"Read\"). */\n label?: ReactNode;\n /** Poster image for `kind=\"video\"` — shown with a play overlay when no\n * `children` are supplied. */\n poster?: string;\n /** Play handler — makes the video poster an actual button. */\n onPlay?: () => void;\n /** Body: a `PdfPreview`, rich text, or a custom embed. Replaces the built-in\n * video poster when provided. */\n children?: ReactNode;\n}\n\nexport const ProposalCustomPage = forwardRef<HTMLDivElement, ProposalCustomPageProps>(\n function ProposalCustomPage(\n { kind, title, caption, label, poster, onPlay, children, className, ...props },\n ref,\n ) {\n const meta = KIND_META[kind];\n const Icon = meta.icon;\n return (\n <div ref={ref} className={cn(\"ds:flex ds:flex-col\", className)} {...props}>\n <div className=\"ds:mb-1.5 ds:flex ds:items-center ds:gap-1.5 ds:text-xs ds:font-semibold ds:tracking-wide ds:text-[var(--av-accent-soft,var(--color-accent-2))]\">\n <Icon className=\"ds:size-3.5\" aria-hidden=\"true\" />\n {label ?? meta.label}\n </div>\n <h2 className=\"ds:font-display ds:text-fg ds:text-[27px] ds:leading-tight ds:font-bold ds:tracking-tight\">\n {title}\n </h2>\n {caption && <p className=\"ds:text-fg-3 ds:mt-2 ds:text-sm ds:leading-relaxed\">{caption}</p>}\n\n <div className=\"ds:mt-5\">\n {kind === \"video\" && !children ? (\n <PlayablePoster poster={poster} onPlay={onPlay} title={title} />\n ) : (\n children\n )}\n </div>\n </div>\n );\n },\n);\nProposalCustomPage.displayName = \"ProposalCustomPage\";\n\nfunction PlayablePoster({\n poster,\n onPlay,\n title,\n}: {\n poster?: string | undefined;\n onPlay?: (() => void) | undefined;\n title: ReactNode;\n}) {\n const inner = (\n <>\n <span\n aria-hidden=\"true\"\n className=\"ds:bg-bg-3 ds:absolute ds:inset-0 ds:bg-cover ds:bg-center\"\n style={poster ? { backgroundImage: `url(${poster})` } : undefined}\n />\n <span aria-hidden=\"true\" className=\"ds:absolute ds:inset-0 ds:bg-black/15\" />\n <span\n aria-hidden=\"true\"\n className=\"ds:rounded-full ds:relative ds:flex ds:size-16 ds:items-center ds:justify-center ds:bg-white/90 ds:text-[var(--av-accent,var(--color-accent))] ds:shadow-raised\"\n >\n <PlayIcon className=\"ds:size-7\" />\n </span>\n </>\n );\n const cls =\n \"ds:relative ds:flex ds:aspect-video ds:w-full ds:items-center ds:justify-center ds:overflow-hidden ds:rounded-[14px] ds:border-rule ds:border\";\n return onPlay ? (\n <button\n type=\"button\"\n onClick={onPlay}\n aria-label={typeof title === \"string\" ? `Play ${title}` : \"Play video\"}\n className={cn(\n cls,\n \"ds:transition-[filter] ds:duration-[var(--duration-fast)] ds:ease-[var(--ease-out-quart)] ds:motion-reduce:transition-none ds:hover:brightness-105\",\n \"ds:focus-visible:[box-shadow:var(--shadow-focus-ring)] ds:focus-visible:outline-none\",\n )}\n >\n {inner}\n </button>\n ) : (\n <div className={cls}>{inner}</div>\n );\n}\n\n/* ─── Callout note ────────────────────────────────────────────── */\n\nexport interface ProposalNoteProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** Optional bold lead line. */\n title?: ReactNode;\n /** Note body. */\n children: ReactNode;\n /** Visual tone. Default \"accent\". */\n tone?: \"accent\" | \"info\";\n /** Leading icon; defaults to an info glyph. */\n icon?: ReactNode;\n}\n\nexport const ProposalNote = forwardRef<HTMLDivElement, ProposalNoteProps>(\n function ProposalNote({ title, children, tone = \"accent\", icon, className, ...props }, ref) {\n return (\n <div\n ref={ref}\n className={cn(\n \"ds:flex ds:gap-3 ds:rounded-[12px] ds:border ds:p-4 ds:text-[13.5px] ds:leading-relaxed\",\n tone === \"accent\"\n ? \"ds:border-[var(--av-accent-tint2,var(--color-accent-tint))] ds:bg-[var(--av-accent-tint,var(--color-accent-tint))] ds:text-[var(--av-accent-soft,var(--color-accent-2))]\"\n : \"ds:border-rule ds:bg-bg-2 ds:text-fg-2\",\n className,\n )}\n {...props}\n >\n <span aria-hidden=\"true\" className=\"ds:mt-0.5 ds:shrink-0\">\n {icon ?? <InfoIcon className=\"ds:size-4\" />}\n </span>\n <div className=\"ds:min-w-0\">\n {title && <div className=\"ds:text-fg ds:font-semibold\">{title}</div>}\n <div className={cn(title && \"ds:mt-0.5\")}>{children}</div>\n </div>\n </div>\n );\n },\n);\nProposalNote.displayName = \"ProposalNote\";\n\n/* ─── Signer / recipient list ─────────────────────────────────── */\n\nexport type ProposalSignerStatus = \"signed\" | \"pending\" | \"viewed\";\n\nexport interface ProposalSigner {\n name: string;\n email?: string;\n /** Role, e.g. \"Signer\", \"Approver\", \"CC\". */\n role?: string;\n status?: ProposalSignerStatus;\n /** Status timestamp for the firm tracking view, e.g. \"Signed Jun 6, 2:14 PM\". */\n at?: ReactNode;\n}\n\nconst STATUS_META: Record<\n ProposalSignerStatus,\n { label: string; icon: typeof CheckIcon; className: string }\n> = {\n signed: {\n label: \"Signed\",\n icon: CheckIcon,\n className: \"ds:text-success-fg ds:bg-success-bg ds:border-success-line\",\n },\n viewed: {\n label: \"Viewed\",\n icon: EyeIcon,\n className:\n \"ds:text-[var(--av-accent-soft,var(--color-accent-2))] ds:bg-[var(--av-accent-tint,var(--color-accent-tint))] ds:border-[var(--av-accent-tint2,var(--color-accent-tint))]\",\n },\n pending: { label: \"Pending\", icon: ClockIcon, className: \"ds:text-fg-3 ds:bg-bg-2 ds:border-rule\" },\n};\n\nexport interface ProposalSignerListProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n signers: ProposalSigner[];\n /** Section label. Default \"Recipients\". */\n title?: ReactNode;\n}\n\nexport const ProposalSignerList = forwardRef<HTMLDivElement, ProposalSignerListProps>(\n function ProposalSignerList({ signers, title = \"Recipients\", className, ...props }, ref) {\n return (\n <div ref={ref} className={cn(\"ds:flex ds:flex-col\", className)} {...props}>\n {title && (\n <div className=\"ds:text-fg-3 ds:mb-2 ds:text-[11.5px] ds:font-semibold ds:tracking-wide\">{title}</div>\n )}\n <div className=\"ds:border-rule ds:divide-rule ds:divide-y ds:overflow-hidden ds:rounded-[12px] ds:border\">\n {signers.map((s, i) => {\n const status = s.status ? STATUS_META[s.status] : null;\n const StatusIcon = status?.icon;\n const initials = s.name\n .split(\" \")\n .map((w) => w[0])\n .slice(0, 2)\n .join(\"\")\n .toUpperCase();\n return (\n <div key={i} className=\"ds:flex ds:items-center ds:gap-3 ds:px-4 ds:py-3\">\n <span\n aria-hidden=\"true\"\n className=\"ds:flex ds:size-9 ds:shrink-0 ds:items-center ds:justify-center ds:rounded-full ds:bg-[var(--av-accent-tint,var(--color-accent-tint))] ds:text-[12.5px] ds:font-semibold ds:text-[var(--av-accent-soft,var(--color-accent-2))]\"\n >\n {initials}\n </span>\n <div className=\"ds:min-w-0 ds:flex-1\">\n <div className=\"ds:text-fg ds:truncate ds:text-sm ds:font-medium\">\n {s.name}\n {s.role && <span className=\"ds:text-fg-4 ds:ml-2 ds:text-xs ds:font-normal\">{s.role}</span>}\n </div>\n {s.email && <div className=\"ds:text-fg-4 ds:truncate ds:text-xs\">{s.email}</div>}\n </div>\n {status && StatusIcon && (\n <div className=\"ds:flex ds:shrink-0 ds:flex-col ds:items-end ds:gap-1\">\n <span\n className={cn(\n \"ds:inline-flex ds:items-center ds:gap-1 ds:rounded-full ds:border ds:px-2 ds:py-0.5 ds:text-[11px] ds:font-medium\",\n status.className,\n )}\n >\n <StatusIcon className=\"ds:size-3\" aria-hidden=\"true\" />\n {status.label}\n </span>\n {s.at != null && <span className=\"ds:text-fg-4 ds:text-[11px]\">{s.at}</span>}\n </div>\n )}\n </div>\n );\n })}\n </div>\n </div>\n );\n },\n);\nProposalSignerList.displayName = \"ProposalSignerList\";\n","\"use client\";\n\nimport { forwardRef, useState, type ReactNode } from \"react\";\n\nimport { cn } from \"../lib/cn\";\nimport { CheckIcon, CreditCardIcon, LockIcon, PenSignIcon } from \"../primitives/icons\";\n\nfunction deriveInitials(name: string): string {\n return name\n .trim()\n .split(/\\s+/)\n .filter(Boolean)\n .map((w) => w[0])\n .slice(0, 2)\n .join(\"\")\n .toUpperCase();\n}\n\n/**\n * Proposal signing building-blocks — the client-preview pieces for the\n * agreement's final step.\n *\n * - `ProposalSignatureBlock` — the type/draw signature area; `signed` flips it\n * to a read-only signed preview.\n * - `ProposalConsentGate` — the \"require explicit approval before signing\"\n * checkbox that gates the Sign CTA.\n * - `ProposalPaymentCapture` — the \"payment at signing\" card/bank capture block.\n *\n * Presentational: persistence, signature canvas, and payment tokenization stay\n * with the consumer. Accent classes carry a suite fallback.\n *\n * @since 1.12.0\n */\n\n/* ─── Signature block ─────────────────────────────────────────── */\n\nexport interface ProposalSignatureBlockProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n /** Read-only signed preview — the recorded signer name + initials. */\n signed?: boolean;\n /** Recorded signer name (used in the `signed` read-only preview). */\n name?: string | undefined;\n /** Recorded initials; defaults to the name's initials. */\n initials?: string;\n /** Initial typed name when interactive (defaults to blank — the signer types). */\n defaultName?: string;\n /** Reports the typed name + initials as the signer types (interactive). */\n onChange?: (value: { name: string; initials: string }) => void;\n /** Placeholder shown in the signature face + name field when empty. */\n placeholder?: string;\n /** CSS font-family for the rendered signature face. Default a serif. */\n signatureFont?: string;\n /** Footer slot — typically the Sign CTA or a signed-on note. */\n footer?: ReactNode;\n /** Drop the Type / Draw tab strip — for hosts that own the mode switch\n * themselves, or that only offer one mode. Default false.\n * @since 1.38.0 */\n hideModeTabs?: boolean;\n}\n\nexport const ProposalSignatureBlock = forwardRef<HTMLDivElement, ProposalSignatureBlockProps>(\n function ProposalSignatureBlock(\n {\n signed = false,\n name = \"\",\n initials,\n defaultName = \"\",\n onChange,\n placeholder = \"Type your full name\",\n signatureFont = \"Georgia, serif\",\n footer,\n hideModeTabs = false,\n className,\n ...props\n },\n ref,\n ) {\n const [nameVal, setNameVal] = useState(defaultName);\n const [initialsVal, setInitialsVal] = useState(\"\");\n const [initialsTouched, setInitialsTouched] = useState(false);\n\n // Signed: show the recorded values read-only. Interactive: the signer types,\n // and the signature face + auto-derived initials track the input live.\n const displayName = signed ? name : nameVal;\n const displayInitials = signed\n ? (initials ?? deriveInitials(name))\n : initialsTouched\n ? initialsVal\n : deriveInitials(nameVal);\n\n const emitChange = (n: string, i: string) => onChange?.({ name: n, initials: i });\n\n const handleName = (v: string) => {\n setNameVal(v);\n emitChange(v, initialsTouched ? initialsVal : deriveInitials(v));\n };\n const handleInitials = (v: string) => {\n setInitialsTouched(true);\n setInitialsVal(v);\n emitChange(nameVal, v);\n };\n\n return (\n <div\n ref={ref}\n className={cn(\"ds:@container/signature ds:flex ds:flex-col\", className)}\n {...props}\n >\n {!hideModeTabs && (\n <div className=\"ds:border-rule ds:mb-4 ds:flex ds:gap-6 ds:border-b\">\n <span className=\"ds:border-[var(--av-accent,var(--color-accent))] ds:text-fg ds:-mb-px ds:border-b-2 ds:pb-2.5 ds:text-sm ds:font-medium\">\n Type\n </span>\n <span className=\"ds:text-fg-4 ds:pb-2.5 ds:text-sm ds:font-medium\">Draw</span>\n </div>\n )}\n {/* The block is its own container (`@container/signature`): the tiles\n and the field row reflow off the block's width, not the viewport, so\n a narrow signing column stacks instead of overflowing. Above 42rem\n the metrics are the wide ones it has always rendered. */}\n <div className=\"ds:flex ds:flex-col ds:gap-4 ds:@2xl/signature:flex-row\">\n <div className=\"ds:border-rule ds:bg-surface-2 ds:flex ds:h-[84px] ds:flex-none ds:items-center ds:overflow-hidden ds:rounded-[12px] ds:border ds:px-4 ds:@2xl/signature:h-[118px] ds:@2xl/signature:flex-1 ds:@2xl/signature:px-7\">\n <span\n className={cn(\"ds:text-3xl ds:leading-none ds:font-semibold ds:@2xl/signature:text-[46px]\", displayName ? \"ds:text-fg\" : \"ds:text-fg-4\")}\n style={{ fontFamily: signatureFont }}\n >\n {displayName || placeholder}\n </span>\n </div>\n <div className=\"ds:border-rule ds:bg-surface-2 ds:flex ds:h-[84px] ds:w-full ds:shrink-0 ds:items-center ds:justify-center ds:rounded-[12px] ds:border ds:@2xl/signature:h-[118px] ds:@2xl/signature:w-[168px]\">\n <span\n className={cn(\"ds:text-2xl ds:leading-none ds:@2xl/signature:text-[34px]\", displayInitials ? \"ds:text-fg-3\" : \"ds:text-fg-4\")}\n style={{ fontFamily: signatureFont }}\n >\n {displayInitials || \"—\"}\n </span>\n </div>\n </div>\n <div\n className=\"ds:mt-5 ds:grid ds:grid-cols-1 ds:gap-3.5 ds:@2xl/signature:grid-cols-[1fr_120px]\"\n >\n <label className=\"ds:flex ds:flex-col ds:gap-1.5\">\n <span className=\"ds:text-fg-3 ds:text-xs ds:font-medium\">Your legal name</span>\n <input\n value={displayName}\n readOnly={signed}\n onChange={(e) => handleName(e.target.value)}\n placeholder={signed ? undefined : placeholder}\n aria-label=\"Your legal name\"\n className=\"ds:border-rule-strong ds:rounded-input ds:text-fg-2 ds:bg-surface ds:h-10 ds:border ds:px-3 ds:text-sm ds:read-only:bg-[var(--color-bg-2)]\"\n />\n </label>\n <label className=\"ds:flex ds:flex-col ds:gap-1.5\">\n <span className=\"ds:text-fg-3 ds:text-xs ds:font-medium\">Initials</span>\n <input\n value={displayInitials}\n readOnly={signed}\n onChange={(e) => handleInitials(e.target.value)}\n placeholder={signed ? undefined : \"—\"}\n aria-label=\"Initials\"\n className=\"ds:border-rule-strong ds:rounded-input ds:text-fg-2 ds:bg-surface ds:h-10 ds:border ds:px-3 ds:text-sm ds:read-only:bg-[var(--color-bg-2)]\"\n />\n </label>\n </div>\n {footer && <div className=\"ds:mt-6\">{footer}</div>}\n </div>\n );\n },\n);\nProposalSignatureBlock.displayName = \"ProposalSignatureBlock\";\n\n/* ─── Consent gate + Sign CTA ─────────────────────────────────── */\n\nexport interface ProposalConsentGateProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Consent label (the explicit-approval statement). */\n children: ReactNode;\n /** Checkbox state. */\n checked?: boolean;\n onCheckedChange?: (checked: boolean) => void;\n /** Already-signed read-only state — shows the signed note instead of the CTA. */\n signed?: boolean;\n /** Note shown when `signed`, e.g. \"Signed on June 6, 2026\". */\n signedNote?: ReactNode;\n /** Sign CTA handler — renders the button (disabled until `checked`). */\n onSign?: (() => void) | undefined;\n /** Sign CTA label. Default \"Sign & approve\". */\n signLabel?: ReactNode;\n /** Extra disable condition for the Sign CTA, e.g. a name not yet typed. */\n disabled?: boolean;\n}\n\nexport const ProposalConsentGate = forwardRef<HTMLDivElement, ProposalConsentGateProps>(\n function ProposalConsentGate(\n { children, checked = false, onCheckedChange, signed = false, signedNote, onSign, signLabel = \"Sign & approve\", disabled = false, className, ...props },\n ref,\n ) {\n return (\n <div ref={ref} className={cn(\"ds:flex ds:flex-col ds:gap-4\", className)} {...props}>\n {!signed && (\n <label className=\"ds:flex ds:cursor-pointer ds:items-start ds:gap-2.5 ds:text-[13.5px] ds:leading-relaxed\">\n <input\n type=\"checkbox\"\n checked={checked}\n onChange={(e) => onCheckedChange?.(e.target.checked)}\n className=\"ds:mt-0.5 ds:size-4 ds:shrink-0 ds:rounded ds:accent-[var(--av-accent,var(--color-accent))]\"\n />\n <span className=\"ds:text-fg-2\">{children}</span>\n </label>\n )}\n <div className=\"ds:flex ds:items-center ds:justify-between ds:gap-4\">\n {signed ? (\n <span className=\"ds:text-success-fg ds:flex ds:items-center ds:gap-2 ds:text-[13px] ds:font-medium\">\n <CheckIcon className=\"ds:size-4 ds:shrink-0\" aria-hidden=\"true\" />\n {signedNote ?? \"This agreement has been signed.\"}\n </span>\n ) : (\n <span className=\"ds:text-fg-4 ds:flex ds:items-center ds:gap-1.5 ds:text-[12.5px]\">\n <LockIcon className=\"ds:size-3.5\" aria-hidden=\"true\" /> Secure e-signature\n </span>\n )}\n {onSign && (\n <button\n type=\"button\"\n onClick={onSign}\n disabled={signed || !checked || disabled}\n className={cn(\n \"ds:inline-flex ds:h-[46px] ds:items-center ds:gap-2 ds:rounded-[12px] ds:px-5 ds:text-[14.5px] ds:font-semibold\",\n \"ds:transition-[filter] ds:duration-[var(--duration-fast)] ds:ease-[var(--ease-out-quart)] ds:motion-reduce:transition-none\",\n \"ds:focus-visible:[box-shadow:var(--shadow-focus-ring)] ds:focus-visible:outline-none\",\n \"ds:bg-[var(--av-accent,var(--color-accent))] ds:text-[var(--av-accent-contrast,var(--color-fg-on-accent))] ds:hover:brightness-105\",\n \"ds:disabled:bg-bg-disabled ds:disabled:text-fg-disabled ds:disabled:cursor-not-allowed ds:disabled:brightness-100\",\n )}\n >\n <PenSignIcon className=\"ds:size-4\" aria-hidden=\"true\" />\n {signLabel}\n </button>\n )}\n </div>\n </div>\n );\n },\n);\nProposalConsentGate.displayName = \"ProposalConsentGate\";\n\n/* ─── Payment capture ─────────────────────────────────────────── */\n\nexport interface ProposalPaymentCaptureProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** Heading. Default \"Payment at signing\". */\n title?: ReactNode;\n /** Amount captured at signing, e.g. \"$2,400\". */\n amount?: ReactNode;\n /** Caption under the title, e.g. \"Billed today on acceptance\". */\n caption?: ReactNode;\n /** Method icon hint. Default \"card\". */\n method?: \"card\" | \"bank\";\n /** Saved method last-4 — renders a read-only \"•••• 4242\" line. */\n capturedLast4?: string;\n /** Custom form fields (replaces the placeholder when provided). */\n children?: ReactNode;\n}\n\nexport const ProposalPaymentCapture = forwardRef<HTMLDivElement, ProposalPaymentCaptureProps>(\n function ProposalPaymentCapture(\n { title = \"Payment at signing\", amount, caption, method = \"card\", capturedLast4, children, className, ...props },\n ref,\n ) {\n return (\n <div\n ref={ref}\n className={cn(\"ds:border-rule ds:rounded-[14px] ds:border ds:p-5\", className)}\n {...props}\n >\n <div className=\"ds:flex ds:items-center ds:gap-3\">\n <span\n aria-hidden=\"true\"\n className=\"ds:rounded-card ds:flex ds:size-10 ds:shrink-0 ds:items-center ds:justify-center ds:bg-[var(--av-accent-tint,var(--color-accent-tint))] ds:text-[var(--av-accent,var(--color-accent))]\"\n >\n <CreditCardIcon className=\"ds:size-5\" />\n </span>\n <div className=\"ds:flex-1\">\n <div className=\"ds:text-fg ds:text-sm ds:font-semibold\">{title}</div>\n {caption && <div className=\"ds:text-fg-4 ds:text-xs\">{caption}</div>}\n </div>\n {amount != null && <div className=\"ds:text-fg ds:text-lg ds:font-bold ds:tabular\">{amount}</div>}\n </div>\n\n <div className=\"ds:mt-4\">\n {children ??\n (capturedLast4 ? (\n <div className=\"ds:border-rule ds:flex ds:items-center ds:gap-2.5 ds:rounded-[10px] ds:border ds:px-3.5 ds:py-3\">\n <CreditCardIcon className=\"ds:text-fg-4 ds:size-4\" aria-hidden=\"true\" />\n <span className=\"ds:text-fg-2 ds:text-sm ds:font-medium ds:tabular\">\n {method === \"bank\" ? \"Bank account\" : \"Card\"} •••• {capturedLast4}\n </span>\n <CheckIcon className=\"ds:text-success-fg ds:ml-auto ds:size-4\" aria-hidden=\"true\" />\n </div>\n ) : (\n <div className=\"ds:border-rule ds:text-fg-4 ds:flex ds:h-11 ds:items-center ds:rounded-[10px] ds:border ds:border-dashed ds:px-3.5 ds:text-sm\">\n {method === \"bank\" ? \"Bank account details\" : \"Card number\"}\n </div>\n ))}\n </div>\n </div>\n );\n },\n);\nProposalPaymentCapture.displayName = \"ProposalPaymentCapture\";\n","\"use client\";\n\nimport { forwardRef, Fragment } from \"react\";\n\nimport { cn } from \"../lib/cn\";\nimport { Input } from \"../primitives/input\";\n\n/**\n * Grid — a labeled-rows × typed-columns matrix of editable cells.\n *\n * A fixed grid where every row has a header down the left edge and every\n * column declares the input type its cells accept (text / number / currency\n * / date). Each cell is an editable input; the whole matrix is a single\n * controlled value keyed `rowKey → columnKey → string`.\n *\n * ┌───────────────┬──────────┬──────────┬──────────┐\n * │ │ Taxpayer │ Spouse │ Notes │ ← typed columns\n * ├───────────────┼──────────┼──────────┼──────────┤\n * │ Wages (W-2) │ [ $ ___ ]│ [ $ ___ ]│ [ ___ ] │ ← labeled row\n * │ Interest │ [ $ ___ ]│ [ $ ___ ]│ [ ___ ] │\n * └───────────────┴──────────┴──────────┴──────────┘\n *\n * This is the standalone form of the `Questions` `labeled-table` type — that\n * branch renders a `Grid` internally, so the two share one implementation and\n * one value contract.\n *\n * Fully controlled: pass `columns`, `rows`, `value`, and `onChange`. The\n * component never holds cell state itself.\n */\n\n/** Input type a column's cells accept. Drives keyboard, input mode, and affix. */\nexport type GridInputType = \"text\" | \"number\" | \"currency\" | \"date\";\n\nexport interface GridColumn {\n /** Stable key; the second-level key in the value object. */\n key: string;\n /** Header text shown above the column. */\n label: string;\n /** Cell input type. Defaults to `\"text\"`. */\n inputType?: GridInputType | undefined;\n /** Relative grid weight for this column (a `fr` unit). Defaults to `1`. */\n width?: number | undefined;\n /** Placeholder for this column's empty cells. */\n placeholder?: string;\n}\n\nexport interface GridRow {\n /** Stable key; the first-level key in the value object. */\n key: string;\n /** Row header text shown down the left edge. */\n label: string;\n}\n\n/** Cell values, keyed `rowKey → columnKey → value`. */\nexport type GridValue = Record<string, Record<string, string>>;\n\nexport interface GridProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n /** Typed columns, left-to-right. */\n columns: GridColumn[];\n /** Labeled rows, top-to-bottom. */\n rows: GridRow[];\n /** Controlled cell values (`rowKey → columnKey → value`). */\n value: GridValue;\n /** Called with the full next value object whenever any cell changes. */\n onChange: (value: GridValue) => void;\n /** Accessible name for the matrix (also prefixes each cell's aria-label). */\n ariaLabel?: string;\n /** Header text for the top-left corner cell (above the row headers). */\n rowHeaderLabel?: string;\n /** Prefix shown inside `currency` cells. Defaults to `\"$\"`. */\n currencySymbol?: string;\n /** Minimum matrix width in px before it scrolls horizontally. Defaults to `560`. */\n minWidth?: number;\n /** Disable every cell. */\n disabled?: boolean;\n}\n\nexport const Grid = forwardRef<HTMLDivElement, GridProps>(function Grid(\n {\n columns,\n rows,\n value,\n onChange,\n ariaLabel,\n rowHeaderLabel,\n currencySymbol = \"$\",\n minWidth = 560,\n disabled = false,\n className,\n ...props\n },\n ref,\n) {\n const updateCell = (rowKey: string, colKey: string, nextValue: string) => {\n onChange({\n ...value,\n [rowKey]: { ...(value[rowKey] ?? {}), [colKey]: nextValue },\n });\n };\n\n return (\n <div ref={ref} className={cn(\"ds:overflow-x-auto\", className)} {...props}>\n <div\n role=\"group\"\n aria-label={ariaLabel}\n className=\"ds:grid ds:gap-2\"\n style={{\n minWidth: `${minWidth}px`,\n gridTemplateColumns: `minmax(120px,max-content) ${columns\n .map((column) => `minmax(0, ${column.width ?? 1}fr)`)\n .join(\" \")}`,\n }}\n >\n {rowHeaderLabel ? (\n <span className=\"ds:text-fg-3 ds:flex ds:items-end ds:px-1 ds:text-[12px] ds:font-semibold\">\n {rowHeaderLabel}\n </span>\n ) : (\n <span aria-hidden=\"true\" />\n )}\n {columns.map((column) => (\n <span key={column.key} className=\"ds:text-fg-3 ds:flex ds:items-end ds:px-1 ds:text-[12px] ds:font-semibold\">\n {column.label}\n </span>\n ))}\n {rows.map((row) => (\n <Fragment key={row.key}>\n <span className=\"ds:text-fg ds:flex ds:items-center ds:text-[13px] ds:font-semibold\">{row.label}</span>\n {columns.map((column) => (\n <Input\n key={column.key}\n type={column.inputType === \"date\" ? \"date\" : \"text\"}\n value={value[row.key]?.[column.key] ?? \"\"}\n onChange={(event) => updateCell(row.key, column.key, event.target.value)}\n placeholder={column.placeholder}\n aria-label={[ariaLabel, row.label, column.label].filter(Boolean).join(\" \")}\n disabled={disabled}\n className=\"ds:h-11 ds:rounded-[12px] ds:text-[14px]\"\n inputMode={\n column.inputType === \"number\" || column.inputType === \"currency\"\n ? \"decimal\"\n : undefined\n }\n prefixIcon={\n column.inputType === \"currency\" ? (\n <span className=\"ds:text-xs ds:font-semibold\">{currencySymbol}</span>\n ) : undefined\n }\n />\n ))}\n </Fragment>\n ))}\n </div>\n </div>\n );\n});\n\nGrid.displayName = \"Grid\";\n","\"use client\";\n\nimport { forwardRef } from \"react\";\n\nimport { cn } from \"../lib/cn\";\nimport { Button } from \"../primitives/button\";\nimport { Checkbox } from \"../primitives/checkbox\";\nimport { FileChip } from \"../primitives/file-chip\";\nimport { FileUpload } from \"../primitives/file-upload\";\nimport {\n CheckCircleSolidIcon,\n HelpCircleIcon,\n MinusIcon,\n PenSignIcon,\n PlusIcon,\n TrashIcon,\n} from \"../primitives/icons\";\nimport { Input } from \"../primitives/input\";\nimport { Select } from \"../primitives/select\";\nimport { Textarea } from \"../primitives/textarea\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"../primitives/tooltip\";\nimport { Grid } from \"./grid\";\n\n/**\n * The version of the `QuestionType` contract this build ships (W8-04).\n *\n * `QuestionType` is a cross-service contract: TAX's backend persists these\n * strings and its renderer switches on them, so the union is not free to\n * change with a component refactor. Adding or removing a member means bumping\n * this constant, adding a changelog entry below, and publishing the matching\n * `docs/contracts/question-types.v<version>.json` fixture — the contract test\n * (`__tests__/question-type-contract.test.ts`) fails otherwise.\n *\n * ### Changelog\n * - **1** (1.38.0) — first versioned snapshot of the union that shipped in\n * 1.12.0: the 24 members listed in `QUESTION_TYPES`. No change to the types\n * themselves; this version records them.\n *\n * @experimental The versioning scheme is experimental until D18 (contract\n * ownership) is decided; the members themselves are stable.\n */\nexport const QUESTION_TYPE_CONTRACT_VERSION = 1;\n\n/**\n * Every `QuestionType`, in contract order — the runtime mirror of the union,\n * for iterating, validating a payload, or generating a picker.\n *\n * @experimental\n */\nexport const QUESTION_TYPES = [\n \"short-text\",\n \"long-text\",\n \"email\",\n \"phone\",\n \"ssn-sin\",\n \"date\",\n \"number\",\n \"currency\",\n \"percentage\",\n \"single-choice\",\n \"multi-choice\",\n \"yes-no\",\n \"dropdown\",\n \"multi-select\",\n \"address\",\n \"file-upload\",\n \"table\",\n \"repeater\",\n \"signature\",\n \"section-header\",\n \"consent-checkbox\",\n \"name\",\n \"labeled-table\",\n \"number-stepper\",\n] as const;\n\nexport type QuestionType =\n | \"short-text\"\n | \"long-text\"\n | \"email\"\n | \"phone\"\n | \"ssn-sin\"\n | \"date\"\n | \"number\"\n | \"currency\"\n | \"percentage\"\n | \"single-choice\"\n | \"multi-choice\"\n | \"yes-no\"\n | \"dropdown\"\n | \"multi-select\"\n | \"address\"\n | \"file-upload\"\n | \"table\"\n | \"repeater\"\n | \"signature\"\n | \"section-header\"\n | \"consent-checkbox\"\n | \"name\"\n | \"labeled-table\"\n | \"number-stepper\";\n\nexport interface QuestionOption {\n value: string;\n label: string;\n formLabel?: string;\n helpText?: string;\n disabled?: boolean;\n}\n\nexport interface QuestionAddressValue {\n line1?: string;\n line2?: string;\n city?: string;\n region?: string;\n postalCode?: string;\n country?: string;\n}\n\n/** Personal-name payload for the `name` variant. */\nexport interface QuestionNameValue {\n first?: string;\n middle?: string;\n last?: string;\n suffix?: string;\n}\n\n/** Question-level help/tip rendered as a tooltip beside the title. */\nexport interface QuestionHelp {\n title?: string;\n body: string;\n}\n\nexport interface QuestionTableColumn {\n key: string;\n label: string;\n placeholder?: string;\n inputType?: \"text\" | \"number\" | \"date\" | \"currency\";\n}\n\nexport type QuestionTableRow = Record<string, string>;\n\n/** Column of the fixed `labeled-table` matrix. `width` is a relative grid weight. */\nexport interface QuestionLabeledColumn {\n key: string;\n title: string;\n width?: number;\n inputType?: \"text\" | \"number\" | \"date\" | \"currency\";\n}\n\n/** Fixed row header (down the left edge) of the `labeled-table` matrix. */\nexport interface QuestionLabeledRow {\n key: string;\n title: string;\n}\n\n/** Cell text for the `labeled-table` matrix, keyed rowKey → colKey → value. */\nexport type QuestionLabeledValue = Record<string, Record<string, string>>;\n\nexport interface QuestionFileValue {\n name: string;\n size?: number;\n kind?: \"doc\" | \"sheet\" | \"image\" | \"generic\";\n}\n\nexport interface QuestionsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n index?: number;\n title: string;\n description?: string | undefined;\n type?: QuestionType;\n required?: boolean;\n chrome?: \"card\" | \"plain\";\n sectionLabel?: string | undefined;\n hideHeader?: boolean;\n options?: QuestionOption[];\n value?: string;\n values?: string[];\n placeholder?: string;\n help?: QuestionHelp;\n addressValue?: QuestionAddressValue;\n nameValue?: QuestionNameValue;\n showSuffix?: boolean;\n tableColumns?: QuestionTableColumn[];\n tableRows?: QuestionTableRow[];\n labeledColumns?: QuestionLabeledColumn[];\n labeledRows?: QuestionLabeledRow[];\n labeledValue?: QuestionLabeledValue;\n files?: QuestionFileValue[];\n accept?: string;\n maxSize?: number;\n multiple?: boolean;\n currencySymbol?: string;\n /** Lower bound for `number-stepper`, and for a count-driven `repeater`. */\n min?: number;\n /** Upper bound for `number-stepper`, and max item count for a count-driven `repeater`. */\n max?: number;\n step?: number;\n /** When set on a `repeater`, renders a bounded stepper that drives the number of item grids. */\n countLabel?: string;\n /**\n * Noun for each `repeater` entry card header, e.g. `\"U.S. presence period\"` →\n * \"U.S. presence period 1\". Defaults to the generic \"Item\" when unset.\n */\n itemNoun?: string;\n onValueChange?: (value: string) => void;\n onValuesChange?: (values: string[]) => void;\n onAddressChange?: (value: QuestionAddressValue) => void;\n onNameChange?: (value: QuestionNameValue) => void;\n onLabeledChange?: (value: QuestionLabeledValue) => void;\n onTableRowsChange?: (rows: QuestionTableRow[]) => void;\n onFilesSelected?: (files: File[]) => void;\n /** When set, each uploaded file chip in the `file-upload` type shows a remove\n * button that calls this with the file and its index. */\n onFileRemove?: (file: QuestionFileValue, index: number) => void;\n}\n\nconst defaultOptions: QuestionOption[] = [\n { value: \"yes\", label: \"Yes\" },\n { value: \"no\", label: \"No\" },\n { value: \"not-sure\", label: \"Not sure\" },\n];\n\nexport const Questions = forwardRef<HTMLDivElement, QuestionsProps>(function Questions(\n {\n index,\n title,\n description,\n type = \"short-text\",\n required = false,\n chrome = \"card\",\n sectionLabel,\n hideHeader = false,\n options = defaultOptions,\n value = \"\",\n values = [],\n placeholder,\n help,\n addressValue = {},\n nameValue = {},\n showSuffix = true,\n tableColumns = [],\n tableRows = [],\n labeledColumns = [],\n labeledRows = [],\n labeledValue = {},\n files = [],\n accept,\n maxSize,\n multiple,\n currencySymbol = \"$\",\n min = 0,\n max,\n step = 1,\n countLabel,\n itemNoun,\n onValueChange,\n onValuesChange,\n onAddressChange,\n onNameChange,\n onLabeledChange,\n onTableRowsChange,\n onFilesSelected,\n onFileRemove,\n className,\n ...props\n },\n ref,\n) {\n const humanIndex = typeof index === \"number\" ? index + 1 : undefined;\n const isSectionHeader = type === \"section-header\";\n const isPlain = chrome === \"plain\" || isSectionHeader;\n const showHeader = isSectionHeader || !hideHeader;\n\n const toggleOption = (optionValue: string, checked: boolean) => {\n const nextValues = checked\n ? Array.from(new Set([...values, optionValue]))\n : values.filter((item) => item !== optionValue);\n\n onValuesChange?.(nextValues);\n };\n\n const updateAddress = (key: keyof QuestionAddressValue, nextValue: string) => {\n onAddressChange?.({ ...addressValue, [key]: nextValue });\n };\n\n const updateName = (key: keyof QuestionNameValue, nextValue: string) => {\n onNameChange?.({ ...nameValue, [key]: nextValue });\n };\n\n const updateRow = (rowIndex: number, key: string, nextValue: string) => {\n onTableRowsChange?.(\n tableRows.map((row, index) => (index === rowIndex ? { ...row, [key]: nextValue } : row)),\n );\n };\n\n const emptyRow = (): QuestionTableRow =>\n tableColumns.reduce<QuestionTableRow>((row, column) => ({ ...row, [column.key]: \"\" }), {});\n\n const addRow = () => {\n onTableRowsChange?.([...tableRows, emptyRow()]);\n };\n\n const removeRow = (rowIndex: number) => {\n onTableRowsChange?.(tableRows.filter((_, index) => index !== rowIndex));\n };\n\n // Count-driven `repeater`: a bounded stepper adds empty item grids or trims trailing ones.\n const setRowCount = (nextCount: number) => {\n const clamped = Math.max(min, max != null ? Math.min(nextCount, max) : nextCount);\n if (clamped > tableRows.length) {\n const added = Array.from({ length: clamped - tableRows.length }, emptyRow);\n onTableRowsChange?.([...tableRows, ...added]);\n } else if (clamped < tableRows.length) {\n onTableRowsChange?.(tableRows.slice(0, clamped));\n }\n };\n\n return (\n <section\n ref={ref}\n className={cn(\n \"ds:font-body\",\n isPlain ? \"ds:bg-transparent\" : \"ds:border-rule ds:bg-surface ds:shadow-card ds:rounded-[18px] ds:border ds:p-5\",\n className,\n )}\n {...props}\n >\n {showHeader && (\n <div className={cn(\"ds:flex ds:items-start ds:gap-3\", !isSectionHeader && \"ds:mb-4\")}>\n {humanIndex && !isPlain && (\n <span\n aria-hidden=\"true\"\n className=\"ds:bg-brand-bg ds:text-brand ds:grid ds:size-7 ds:shrink-0 ds:place-items-center ds:rounded-full ds:text-xs ds:font-bold\"\n >\n {humanIndex}\n </span>\n )}\n\n <div className=\"ds:min-w-0 ds:flex-1\">\n {(sectionLabel || isSectionHeader) && (\n <p className=\"ds:text-brand ds:mb-1 ds:text-[11px] ds:font-bold ds:tracking-[0.12em] ds:uppercase\">\n {sectionLabel}\n </p>\n )}\n <div className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-2\">\n <h3\n className={cn(\n \"ds:text-fg\",\n isSectionHeader\n ? \"ds:text-[22px] ds:leading-7 ds:font-bold\"\n : \"ds:text-[14px] ds:leading-5 ds:font-bold\",\n )}\n >\n {title}\n </h3>\n {help && <HelpTip title={help.title ?? title} body={help.body} />}\n {required && (\n <span className=\"ds:bg-brand-bg ds:text-brand ds:rounded-full ds:px-2 ds:py-0.5 ds:text-[11px] ds:font-bold\">\n Required\n </span>\n )}\n </div>\n {description && type !== \"consent-checkbox\" && (\n <p className=\"ds:text-fg-3 ds:mt-1 ds:text-[13px] ds:leading-5\">{description}</p>\n )}\n </div>\n </div>\n )}\n\n {type === \"section-header\" && null}\n\n {type === \"short-text\" && (\n <Input\n value={value}\n onChange={(event) => onValueChange?.(event.target.value)}\n placeholder={placeholder ?? \"Type your answer\"}\n aria-label={title}\n className=\"ds:h-11 ds:rounded-[12px] ds:text-[14px]\"\n />\n )}\n\n {type === \"email\" && (\n <Input\n type=\"email\"\n value={value}\n onChange={(event) => onValueChange?.(event.target.value)}\n placeholder={placeholder ?? \"client@example.com\"}\n aria-label={title}\n className=\"ds:h-11 ds:rounded-[12px] ds:text-[14px]\"\n />\n )}\n\n {type === \"phone\" && (\n <Input\n type=\"tel\"\n value={value}\n onChange={(event) => onValueChange?.(event.target.value)}\n placeholder={placeholder ?? \"(555) 123-4567\"}\n aria-label={title}\n className=\"ds:h-11 ds:rounded-[12px] ds:text-[14px]\"\n />\n )}\n\n {type === \"ssn-sin\" && (\n <Input\n value={value}\n onChange={(event) => onValueChange?.(event.target.value)}\n placeholder={placeholder ?? \"Enter SSN or SIN\"}\n aria-label={title}\n inputMode=\"numeric\"\n className=\"ds:h-11 ds:rounded-[12px] ds:text-[14px]\"\n />\n )}\n\n {type === \"date\" && (\n <Input\n type=\"date\"\n value={value}\n onChange={(event) => onValueChange?.(event.target.value)}\n aria-label={title}\n className=\"ds:h-11 ds:rounded-[12px] ds:text-[14px]\"\n />\n )}\n\n {type === \"number\" && (\n <Input\n type=\"number\"\n value={value}\n onChange={(event) => onValueChange?.(event.target.value)}\n placeholder={placeholder ?? \"0\"}\n aria-label={title}\n className=\"ds:h-11 ds:rounded-[12px] ds:text-[14px]\"\n />\n )}\n\n {type === \"number-stepper\" && (\n <NumberStepper\n value={Number(value) || 0}\n onValueChange={(next) => onValueChange?.(String(next))}\n min={min}\n max={max}\n step={step}\n ariaLabel={title}\n />\n )}\n\n {type === \"currency\" && (\n <Input\n value={value}\n onChange={(event) => onValueChange?.(event.target.value)}\n placeholder={placeholder ?? \"0.00\"}\n aria-label={title}\n inputMode=\"decimal\"\n prefixIcon={<span className=\"ds:text-xs ds:font-semibold\">{currencySymbol}</span>}\n className=\"ds:h-11 ds:rounded-[12px] ds:text-[14px]\"\n />\n )}\n\n {type === \"percentage\" && (\n <Input\n value={value}\n onChange={(event) => onValueChange?.(event.target.value)}\n placeholder={placeholder ?? \"0\"}\n aria-label={title}\n inputMode=\"decimal\"\n suffixIcon={<span className=\"ds:text-xs ds:font-semibold\">%</span>}\n className=\"ds:h-11 ds:rounded-[12px] ds:text-[14px]\"\n />\n )}\n\n {type === \"long-text\" && (\n <Textarea\n value={value}\n onChange={(event) => onValueChange?.(event.target.value)}\n placeholder={placeholder ?? \"Write a detailed answer\"}\n aria-label={title}\n autoResize\n className=\"ds:rounded-[12px] ds:text-[14px]\"\n />\n )}\n\n {(type === \"single-choice\" || type === \"yes-no\") && (\n <div\n className={cn(\n \"ds:grid ds:gap-3\",\n type === \"yes-no\" ? \"ds:grid-cols-[repeat(auto-fit,minmax(78px,max-content))]\" : \"\",\n )}\n role=\"radiogroup\"\n aria-label={title}\n >\n {(type === \"yes-no\"\n ? [\n { value: \"yes\", label: \"Yes\" },\n { value: \"no\", label: \"No\" },\n ]\n : options\n ).map((option) => (\n <QuestionOptionButton\n key={option.value}\n option={option}\n selected={value === option.value}\n compact={type === \"yes-no\"}\n role=\"radio\"\n aria-checked={value === option.value}\n onClick={() => onValueChange?.(option.value)}\n />\n ))}\n </div>\n )}\n\n {type === \"dropdown\" && (\n <Select\n options={options}\n value={value}\n onValueChange={onValueChange}\n placeholder={placeholder ?? \"Select an option\"}\n aria-label={title}\n />\n )}\n\n {(type === \"multi-choice\" || type === \"multi-select\") && (\n <div className=\"ds:grid ds:gap-3\" role=\"group\" aria-label={title}>\n {options.map((option) => (\n <QuestionOptionButton\n key={option.value}\n option={option}\n selected={values.includes(option.value)}\n role=\"checkbox\"\n aria-checked={values.includes(option.value)}\n onClick={() => toggleOption(option.value, !values.includes(option.value))}\n />\n ))}\n </div>\n )}\n\n {type === \"address\" && (\n <div className=\"ds:grid ds:gap-3 ds:sm:grid-cols-2\">\n <Input\n value={addressValue.line1 ?? \"\"}\n onChange={(event) => updateAddress(\"line1\", event.target.value)}\n placeholder=\"Street address\"\n aria-label={`${title} street address`}\n className=\"ds:h-11 ds:rounded-[12px] ds:text-[14px] ds:sm:col-span-2\"\n />\n <Input\n value={addressValue.line2 ?? \"\"}\n onChange={(event) => updateAddress(\"line2\", event.target.value)}\n placeholder=\"Apt, suite, unit\"\n aria-label={`${title} address line 2`}\n className=\"ds:h-11 ds:rounded-[12px] ds:text-[14px] ds:sm:col-span-2\"\n />\n <Input\n value={addressValue.city ?? \"\"}\n onChange={(event) => updateAddress(\"city\", event.target.value)}\n placeholder=\"City\"\n aria-label={`${title} city`}\n className=\"ds:h-11 ds:rounded-[12px] ds:text-[14px]\"\n />\n <Input\n value={addressValue.region ?? \"\"}\n onChange={(event) => updateAddress(\"region\", event.target.value)}\n placeholder=\"State / Province\"\n aria-label={`${title} state or province`}\n className=\"ds:h-11 ds:rounded-[12px] ds:text-[14px]\"\n />\n <Input\n value={addressValue.postalCode ?? \"\"}\n onChange={(event) => updateAddress(\"postalCode\", event.target.value)}\n placeholder=\"ZIP / Postal code\"\n aria-label={`${title} zip or postal code`}\n className=\"ds:h-11 ds:rounded-[12px] ds:text-[14px]\"\n />\n <Input\n value={addressValue.country ?? \"\"}\n onChange={(event) => updateAddress(\"country\", event.target.value)}\n placeholder=\"Country\"\n aria-label={`${title} country`}\n className=\"ds:h-11 ds:rounded-[12px] ds:text-[14px]\"\n />\n </div>\n )}\n\n {type === \"name\" && (\n <div className=\"ds:grid ds:gap-3 ds:sm:grid-cols-6\">\n <Input\n value={nameValue.first ?? \"\"}\n onChange={(event) => updateName(\"first\", event.target.value)}\n placeholder=\"First name\"\n aria-label={`${title} first name`}\n className=\"ds:h-11 ds:rounded-[12px] ds:text-[14px] ds:sm:col-span-2\"\n />\n <Input\n value={nameValue.middle ?? \"\"}\n onChange={(event) => updateName(\"middle\", event.target.value)}\n placeholder=\"Middle\"\n aria-label={`${title} middle name`}\n className=\"ds:h-11 ds:rounded-[12px] ds:text-[14px] ds:sm:col-span-1\"\n />\n <Input\n value={nameValue.last ?? \"\"}\n onChange={(event) => updateName(\"last\", event.target.value)}\n placeholder=\"Last name\"\n aria-label={`${title} last name`}\n className={cn(\n \"ds:h-11 ds:rounded-[12px] ds:text-[14px]\",\n showSuffix ? \"ds:sm:col-span-2\" : \"ds:sm:col-span-3\",\n )}\n />\n {showSuffix && (\n <Input\n value={nameValue.suffix ?? \"\"}\n onChange={(event) => updateName(\"suffix\", event.target.value)}\n placeholder=\"Suffix\"\n aria-label={`${title} suffix`}\n className=\"ds:h-11 ds:rounded-[12px] ds:text-[14px] ds:sm:col-span-1\"\n />\n )}\n </div>\n )}\n\n {type === \"labeled-table\" && (\n <Grid\n ariaLabel={title}\n currencySymbol={currencySymbol}\n columns={labeledColumns.map((column) => ({\n key: column.key,\n label: column.title,\n inputType: column.inputType,\n width: column.width,\n }))}\n rows={labeledRows.map((row) => ({ key: row.key, label: row.title }))}\n value={labeledValue}\n onChange={(next) => onLabeledChange?.(next)}\n />\n )}\n\n {type === \"file-upload\" && (\n <div className=\"ds:grid ds:gap-3\">\n <FileUpload\n accept={accept}\n maxSize={maxSize}\n multiple={multiple}\n onFilesSelected={onFilesSelected}\n />\n {files.length > 0 && (\n <div className=\"ds:grid ds:gap-2\">\n {files.map((file, fileIndex) => (\n <FileChip\n key={`${file.name}-${file.size ?? \"unknown\"}`}\n name={file.name}\n meta={file.size ? formatBytes(file.size) : undefined}\n kind={file.kind ?? \"doc\"}\n action={\n onFileRemove ? (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n onClick={() => onFileRemove(file, fileIndex)}\n aria-label={`Remove ${file.name}`}\n className=\"ds:hover:text-danger-fg\"\n >\n <TrashIcon size={14} aria-hidden=\"true\" />\n </Button>\n ) : undefined\n }\n />\n ))}\n </div>\n )}\n </div>\n )}\n\n {(type === \"table\" || type === \"repeater\") && (\n <div className=\"ds:grid ds:gap-3\">\n {countLabel && (\n <div className=\"ds:flex ds:flex-wrap ds:items-center ds:justify-between ds:gap-3\">\n <span className=\"ds:text-fg ds:text-[13px] ds:font-semibold\">{countLabel}</span>\n <NumberStepper\n value={tableRows.length}\n onValueChange={setRowCount}\n min={min}\n max={max}\n step={step}\n ariaLabel={countLabel}\n />\n </div>\n )}\n {tableRows.map((row, rowIndex) => (\n <div key={rowIndex} className=\"ds:border-rule ds:bg-surface-2 ds:rounded-[16px] ds:border ds:p-4\">\n <div className=\"ds:mb-3 ds:flex ds:items-center ds:justify-between ds:gap-3\">\n <span className=\"ds:text-fg ds:text-[13px] ds:font-semibold\">\n {type === \"repeater\" ? (itemNoun ?? \"Item\") : \"Row\"} {rowIndex + 1}\n </span>\n {!countLabel && tableRows.length > 1 && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n onClick={() => removeRow(rowIndex)}\n aria-label={`Remove row ${rowIndex + 1}`}\n >\n <TrashIcon size={14} aria-hidden=\"true\" />\n </Button>\n )}\n </div>\n <div className=\"ds:grid ds:gap-3 ds:sm:grid-cols-2\">\n {tableColumns.map((column) => (\n <Input\n key={column.key}\n type={column.inputType === \"date\" ? \"date\" : \"text\"}\n value={row[column.key] ?? \"\"}\n onChange={(event) => updateRow(rowIndex, column.key, event.target.value)}\n placeholder={column.placeholder ?? column.label}\n aria-label={`${title} ${column.label} row ${rowIndex + 1}`}\n className=\"ds:h-11 ds:rounded-[12px] ds:text-[14px]\"\n inputMode={\n column.inputType === \"number\" || column.inputType === \"currency\"\n ? \"decimal\"\n : undefined\n }\n prefixIcon={\n column.inputType === \"currency\" ? (\n <span className=\"ds:text-xs ds:font-semibold\">{currencySymbol}</span>\n ) : undefined\n }\n />\n ))}\n </div>\n </div>\n ))}\n {!countLabel && (\n <Button\n type=\"button\"\n variant=\"dashed\"\n size=\"sm\"\n onClick={addRow}\n iconLeft={<PlusIcon size={14} />}\n >\n Add {type === \"repeater\" ? \"item\" : \"row\"}\n </Button>\n )}\n </div>\n )}\n\n {type === \"signature\" && (\n <div className=\"ds:border-rule-strong ds:bg-surface-2 ds:rounded-[16px] ds:border ds:border-dashed ds:p-5\">\n <div className=\"ds:text-fg-2 ds:mb-3 ds:flex ds:items-center ds:gap-2\">\n <PenSignIcon size={18} aria-hidden=\"true\" />\n <span className=\"ds:text-[13px] ds:font-semibold\">Signature</span>\n </div>\n <Input\n value={value}\n onChange={(event) => onValueChange?.(event.target.value)}\n placeholder={placeholder ?? \"Type full legal name\"}\n aria-label={title}\n className=\"ds:h-11 ds:rounded-[12px] ds:text-[14px]\"\n />\n </div>\n )}\n\n {type === \"consent-checkbox\" && (\n <Checkbox\n label={description ?? title}\n checked={value === \"true\"}\n onCheckedChange={(checked) => onValueChange?.(checked === true ? \"true\" : \"false\")}\n />\n )}\n </section>\n );\n});\n\nQuestions.displayName = \"Questions\";\n\ninterface QuestionOptionButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n option: QuestionOption;\n selected: boolean;\n compact?: boolean;\n}\n\nfunction QuestionOptionButton({\n option,\n selected,\n compact,\n className,\n ...props\n}: QuestionOptionButtonProps) {\n return (\n <button\n type=\"button\"\n disabled={option.disabled}\n className={cn(\n \"ds:group ds:bg-surface ds:flex ds:w-full ds:items-center ds:gap-3 ds:border ds:text-left\",\n \"ds:transition-[border-color,background-color,color,box-shadow,transform] ds:duration-[var(--duration-fast)] ds:ease-[var(--ease-out-quart)]\",\n \"ds:motion-reduce:transition-none\",\n \"ds:focus-visible:[box-shadow:var(--shadow-focus-ring)] ds:focus-visible:outline-none\",\n \"ds:disabled:bg-bg-disabled ds:disabled:text-fg-disabled ds:disabled:cursor-not-allowed\",\n compact ? \"ds:h-10 ds:max-w-max ds:rounded-[10px] ds:px-3\" : \"ds:min-h-16 ds:rounded-[12px] ds:px-7 ds:py-4\",\n selected\n ? compact\n ? \"ds:border-brand ds:bg-brand-bg ds:text-brand ds:shadow-xs\"\n : \"ds:border-brand-line ds:bg-brand-bg ds:text-brand ds:hover:bg-brand-bg-hover ds:shadow-xs\"\n : \"ds:border-rule-strong ds:text-fg ds:hover:border-brand-line ds:hover:bg-brand-bg/40\",\n className,\n )}\n {...props}\n >\n <span\n aria-hidden=\"true\"\n className={cn(\n \"ds:grid ds:shrink-0 ds:place-items-center ds:rounded-full ds:border ds:transition-colors ds:duration-[var(--duration-fast)] ds:motion-reduce:transition-none\",\n compact ? \"ds:size-5\" : \"ds:size-4\",\n selected\n ? \"ds:border-brand ds:bg-brand ds:text-fg-on-brand\"\n : \"ds:border-rule-strong ds:bg-surface ds:group-hover:border-brand-line ds:text-transparent\",\n )}\n >\n {selected && <CheckCircleSolidIcon size={compact ? 18 : 14} />}\n </span>\n\n <span className=\"ds:flex ds:min-w-0 ds:flex-1 ds:items-center ds:gap-1.5\">\n <span className={cn(\"ds:truncate ds:font-bold\", compact ? \"ds:text-[13px]\" : \"ds:text-[15px]\")}>\n {option.label}\n </span>\n {option.helpText && <HelpTip title={option.label} body={option.helpText} />}\n </span>\n\n {option.formLabel && !compact && (\n <span\n className={cn(\n \"ds:ml-auto ds:shrink-0 ds:text-right ds:text-[13px] ds:font-semibold\",\n selected ? \"ds:text-brand\" : \"ds:text-fg-3\",\n )}\n >\n {option.formLabel}\n </span>\n )}\n </button>\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\n/** Shared help tooltip — used for question-level `help` and per-option `helpText`. */\nfunction HelpTip({ title, body }: { title: string; body: string }) {\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <span className=\"ds:text-brand ds:inline-flex ds:shrink-0 ds:cursor-help\">\n <HelpCircleIcon size={14} aria-hidden=\"true\" />\n </span>\n </TooltipTrigger>\n <TooltipContent\n side=\"top\"\n align=\"center\"\n sideOffset={12}\n className={cn(\n \"ds:border-rule ds:bg-surface ds:shadow-pop ds:relative ds:max-w-[352px] ds:rounded-[7px] ds:p-5 ds:text-left\",\n \"ds:after:border-rule ds:after:bg-surface ds:after:absolute ds:after:top-full ds:after:left-1/2 ds:after:size-4 ds:after:-translate-x-1/2 ds:after:-translate-y-1/2 ds:after:rotate-45 ds:after:border-r ds:after:border-b ds:after:content-['']\",\n )}\n >\n <div className=\"ds:text-fg ds:text-[15px] ds:leading-5 ds:font-bold\">{title}</div>\n <p className=\"ds:text-fg-2 ds:mt-3 ds:text-[14px] ds:leading-6\">{body}</p>\n </TooltipContent>\n </Tooltip>\n );\n}\n\ninterface NumberStepperProps {\n value: number;\n onValueChange: (value: number) => void;\n min?: number | undefined;\n max?: number | undefined;\n step?: number | undefined;\n ariaLabel?: string | undefined;\n}\n\n/** Bounded −/+ counter. Backs the `number-stepper` variant and the count-driven `repeater`. */\nfunction NumberStepper({\n value,\n onValueChange,\n min = 0,\n max,\n step = 1,\n ariaLabel,\n}: NumberStepperProps) {\n const clamp = (next: number) => Math.max(min, max != null ? Math.min(next, max) : next);\n const current = clamp(Number.isFinite(value) ? value : min);\n const atMin = current <= min;\n const atMax = max != null && current >= max;\n\n return (\n <div\n className=\"ds:inline-flex ds:items-center ds:gap-2\"\n role=\"spinbutton\"\n aria-valuenow={current}\n aria-valuemin={min}\n aria-valuemax={max}\n aria-label={ariaLabel}\n >\n <Button\n type=\"button\"\n variant=\"secondary\"\n size=\"icon-sm\"\n onClick={() => onValueChange(clamp(current - step))}\n disabled={atMin}\n aria-label=\"Decrease\"\n >\n <MinusIcon size={14} aria-hidden=\"true\" />\n </Button>\n <Input\n value={String(current)}\n onChange={(event) => {\n const parsed = Number(event.target.value.replace(/[^0-9-]/g, \"\"));\n onValueChange(clamp(Number.isFinite(parsed) ? parsed : min));\n }}\n inputMode=\"numeric\"\n aria-label={ariaLabel}\n className=\"ds:h-11 ds:w-14 ds:rounded-[12px] ds:text-center ds:text-[14px] ds:tabular-nums\"\n />\n <Button\n type=\"button\"\n variant=\"secondary\"\n size=\"icon-sm\"\n onClick={() => onValueChange(clamp(current + step))}\n disabled={atMax}\n aria-label=\"Increase\"\n >\n <PlusIcon size={14} aria-hidden=\"true\" />\n </Button>\n </div>\n );\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport { Slot } from \"../primitives/slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { Avatar } from \"../primitives/avatar\";\nimport { Collapsible, CollapsibleContent } from \"../primitives/collapsible\";\nimport { ChevronDownIcon, PanelLeftCloseIcon, PanelLeftIcon } from \"../primitives/icons\";\nimport { Sheet, SheetContent, SheetTitle } from \"../primitives/sheet\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"../primitives/tooltip\";\nimport { sidebarAnatomy, type SidebarSlot } from \"../foundation/anatomy/slots\";\nimport { slot, stateAttributes } from \"../foundation/anatomy/slot\";\nimport { useDsMessages } from \"../foundation/provider/context\";\nimport { cn } from \"../lib/cn\";\n\n/** The sidebar parts (ADR-008). See the registry for the doc comment. */\nexport type { SidebarSlot };\n\n/* ───────────────────────────────────────────────────────────────────────\n * State model\n *\n * `expanded` — full 256px column, labels visible. The legacy behavior;\n * still the default for any consumer that doesn't opt in.\n * `rail` — 64px icon column, labels hidden. The user's *pinned*\n * intent to reclaim canvas width.\n *\n * Peek is *transient* and not part of the user intent — when in `rail`,\n * hovering the column momentarily widens it back to expanded as a\n * floating overlay so the user can read labels without losing their\n * pinned preference. Peek lives inside the <Sidebar> as local state.\n * ─────────────────────────────────────────────────────────────────────── */\n\nexport type SidebarState = \"expanded\" | \"rail\";\n\ninterface SidebarContextValue {\n state: SidebarState;\n setState: (next: SidebarState) => void;\n toggle: () => void;\n collapsible: boolean;\n /**\n * Refcount of \"hold the column visually expanded\" requests from external\n * consumers (dropdowns, popovers, command palettes). Read by <Sidebar> to\n * trigger overlay rendering without mutating the persistent `state`.\n * See `useSidebarPeekLock` for the canonical consumer API.\n */\n peekLockCount: number;\n /**\n * Increment the peek-lock refcount. Returns an idempotent release function\n * that decrements once when called and is safe to call twice. Prefer the\n * `useSidebarPeekLock` hook over calling this directly — it handles the\n * acquire/release lifecycle via useEffect cleanup.\n */\n acquirePeekLock: () => () => void;\n}\n\nconst SidebarContext = React.createContext<SidebarContextValue | null>(null);\n\n// Sentinel so atoms can render outside a provider without crashing —\n// keeps the legacy \"drop a <Sidebar> into a <Shell>\" path working\n// untouched.\nconst NOOP_CONTEXT: SidebarContextValue = {\n state: \"expanded\",\n setState: () => {},\n toggle: () => {},\n collapsible: false,\n peekLockCount: 0,\n acquirePeekLock: () => () => {},\n};\n\nexport function useSidebarState(): SidebarContextValue {\n return React.useContext(SidebarContext) ?? NOOP_CONTEXT;\n}\n\n/* ───────────────────────────────────────────────────────────────────────\n * Provider\n *\n * Wraps the app shell. Owns the user's pinned intent. Controlled\n * (`state` + `onStateChange`) and uncontrolled (`defaultState`) modes\n * both supported, following the Radix pattern.\n *\n * `storageKey` opts into localStorage persistence. The stored value is\n * applied *post-mount* via `useEffect`, never in the initial render — so\n * SSR markup and the client's first render produce identical trees and\n * React's `useId` counter doesn't drift for downstream Radix primitives.\n * The trade-off is a one-frame flash from `defaultState` to the stored\n * state when a user has previously pinned a non-default. Consumers that\n * cannot tolerate the flash should persist via a cookie they read in a\n * server component and pass through `defaultState`.\n *\n * `storage=\"cookie\"` (W7-02) writes the same key as a first-party cookie\n * instead, which is what makes the flash-free path actually reachable: the\n * server reads the cookie, passes it as `defaultState`, and the first paint is\n * already correct. See `SidebarProviderProps.storage` for the recipe — this is\n * the reason PRO and TAX each wrap this provider today.\n *\n * `shortcut` defaults to `Mod+\\` — same chord as VS Code, GitHub, Linear.\n * ─────────────────────────────────────────────────────────────────────── */\n\nexport interface SidebarProviderProps {\n children?: React.ReactNode;\n state?: SidebarState;\n /**\n * The state of the first render, in uncontrolled mode. Read on the server\n * (from a cookie) and passed down, this is the hydration-safe way to restore\n * a collapsed sidebar: the server and the client's first render agree, so no\n * `data-state` mismatch and no `useId` drift (W7-02).\n */\n defaultState?: SidebarState;\n onStateChange?: (next: SidebarState) => void;\n /** Persist the user's intent across reloads under this key. See `storage`. */\n storageKey?: string;\n /**\n * Where `storageKey` persists.\n *\n * - `\"localStorage\"` (default) — 1.x behaviour. Readable only in the\n * browser, so the stored value lands one render *after* hydration and a\n * non-default state flashes for a frame.\n * - `\"cookie\"` — writes `storageKey=<state>; path=/; max-age=1y;\n * samesite=lax` on every change, so the *server* can read it back:\n *\n * ```tsx\n * // app/layout.tsx (Next.js server component)\n * const pinned = (await cookies()).get(\"sidebar\")?.value;\n * return (\n * <SidebarProvider\n * storageKey=\"sidebar\"\n * storage=\"cookie\"\n * defaultState={pinned === \"rail\" ? \"rail\" : \"expanded\"}\n * >\n * {children}\n * </SidebarProvider>\n * );\n * ```\n *\n * The first paint is already correct, nothing is read before hydration,\n * and the app needs no wrapper of its own.\n *\n * @experimental W7-02.\n */\n storage?: \"localStorage\" | \"cookie\";\n /** Global toggle shortcut. Pass `null` to disable. Defaults to `Mod+\\`. */\n shortcut?: string | null;\n}\n\nconst DEFAULT_SHORTCUT = \"Mod+\\\\\";\n\ntype SidebarStorage = NonNullable<SidebarProviderProps[\"storage\"]>;\n\nconst asState = (value: string | null | undefined): SidebarState | null =>\n value === \"rail\" || value === \"expanded\" ? value : null;\n\nfunction readStorage(key: string | undefined, storage: SidebarStorage): SidebarState | null {\n if (!key || typeof document === \"undefined\") return null;\n try {\n if (storage === \"cookie\") {\n const match = document.cookie.match(\n new RegExp(`(?:^|;\\\\s*)${key.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")}=([^;]*)`),\n );\n return asState(match ? decodeURIComponent(match[1] ?? \"\") : null);\n }\n return asState(window.localStorage.getItem(key));\n } catch {\n return null;\n }\n}\n\nfunction writeStorage(key: string, storage: SidebarStorage, next: SidebarState): void {\n if (typeof document === \"undefined\") return;\n try {\n if (storage === \"cookie\") {\n // A year, path=/ so every route sees it, lax so a top-level navigation\n // still carries it to the server that renders `defaultState`.\n document.cookie = `${key}=${next}; path=/; max-age=31536000; samesite=lax`;\n return;\n }\n window.localStorage.setItem(key, next);\n } catch {\n /* quota / private-mode — ignore, runtime state still works */\n }\n}\n\nexport function SidebarProvider({\n children,\n state: controlled,\n defaultState = \"expanded\",\n onStateChange,\n storageKey,\n storage = \"localStorage\",\n shortcut = DEFAULT_SHORTCUT,\n}: SidebarProviderProps) {\n // Initial state must be identical on SSR and the client's first render.\n // Reading localStorage here would diverge the two and shift React's\n // `useId` counter for every Radix primitive downstream — the bug that\n // broke `aria-controls` wiring in dropdowns nested inside the app shell.\n // The post-mount effect below applies the stored value on the second\n // render. The one-frame flash is the documented trade-off.\n const [uncontrolled, setUncontrolled] = React.useState<SidebarState>(\n controlled ?? defaultState,\n );\n\n React.useEffect(() => {\n if (controlled !== undefined) return;\n const stored = readStorage(storageKey, storage);\n if (stored && stored !== uncontrolled) setUncontrolled(stored);\n // Apply stored value once after hydration. Subsequent writes are\n // owned by `setState` below and persisted there.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const state = controlled ?? uncontrolled;\n\n const setState = React.useCallback(\n (next: SidebarState) => {\n if (controlled === undefined) setUncontrolled(next);\n onStateChange?.(next);\n if (storageKey) writeStorage(storageKey, storage, next);\n },\n [controlled, onStateChange, storageKey, storage],\n );\n\n const toggle = React.useCallback(() => {\n setState(state === \"expanded\" ? \"rail\" : \"expanded\");\n }, [state, setState]);\n\n // Peek-lock refcount. External consumers (dropdowns, popovers) acquire a\n // lock to hold the column visually expanded as an overlay while their UI\n // is open, without touching the user's persisted `state`. Refcounted so\n // multiple peer consumers compose: e.g. a popover inside a dropdown still\n // holds the column open after the dropdown closes, until the popover\n // releases too. The pinned intent stays the user's, transient visibility\n // stays the consumer's.\n const [peekLockCount, setPeekLockCount] = React.useState(0);\n\n const acquirePeekLock = React.useCallback(() => {\n setPeekLockCount((n) => n + 1);\n // The release closure is idempotent: a consumer that holds the lock\n // through React strict-mode double-effects, or a defensive double-call,\n // must not double-decrement. The `released` flag guards against that;\n // `Math.max(0, n - 1)` is a belt-and-braces floor so accounting bugs\n // can never drag the count negative and leave a permanent overlay.\n let released = false;\n return () => {\n if (released) return;\n released = true;\n setPeekLockCount((n) => Math.max(0, n - 1));\n };\n }, []);\n\n React.useEffect(() => {\n if (!shortcut) return;\n const parts = shortcut.split(\"+\");\n const key = parts.pop() ?? \"\";\n const wantMod = parts.includes(\"Mod\");\n const wantShift = parts.includes(\"Shift\");\n const wantAlt = parts.includes(\"Alt\");\n function onKey(e: KeyboardEvent) {\n const isMac =\n typeof navigator !== \"undefined\" && /Mac|iPhone|iPad/.test(navigator.platform);\n const mod = isMac ? e.metaKey : e.ctrlKey;\n if (e.key.toLowerCase() !== key.toLowerCase()) return;\n if (wantMod !== mod) return;\n if (wantShift !== e.shiftKey) return;\n if (wantAlt !== e.altKey) return;\n e.preventDefault();\n toggle();\n }\n window.addEventListener(\"keydown\", onKey);\n return () => window.removeEventListener(\"keydown\", onKey);\n }, [shortcut, toggle]);\n\n const value: SidebarContextValue = React.useMemo(\n () => ({ state, setState, toggle, collapsible: true, peekLockCount, acquirePeekLock }),\n [state, setState, toggle, peekLockCount, acquirePeekLock],\n );\n\n return <SidebarContext.Provider value={value}>{children}</SidebarContext.Provider>;\n}\nSidebarProvider.displayName = \"SidebarProvider\";\n\n/* ───────────────────────────────────────────────────────────────────────\n * Sidebar root\n *\n * Visual contract:\n * - Width is driven by inline style (either the expanded or rail\n * token). Setting it inline means the flex Shell layout reflows\n * with no coordination needed in <Main>.\n * - Drives child styling via three data-attributes:\n * data-state=\"expanded\"|\"rail\" → user intent\n * data-peek=\"true\"|undefined → transient hover state\n * data-labels=\"show\"|\"hide\" → derived; \"hide\" only when\n * rail AND not peeking. Atoms\n * read this single attribute\n * rather than computing the\n * combination themselves.\n * - Carries `group/sidebar` so descendants can target the parent\n * via `group-data-[labels=hide]/sidebar:…` etc.\n *\n * Peek behavior: when state=\"rail\", hovering the column waits\n * PEEK_ENTER_DELAY_MS (forgives mouse-passthrough) then expands the\n * column to its full width as `position: fixed` overlay. Leaving waits\n * PEEK_LEAVE_DELAY_MS (forgives overshoot toward an item).\n * ─────────────────────────────────────────────────────────────────────── */\n\nconst PEEK_ENTER_DELAY_MS = 100;\nconst PEEK_LEAVE_DELAY_MS = 200;\n\nexport interface SidebarProps extends React.HTMLAttributes<HTMLElement> {\n /**\n * Opt into the rail / hover-peek behavior. When false (default), the\n * sidebar always renders expanded — the legacy behavior. When true,\n * the sidebar reads pinned state from <SidebarProvider>; if no\n * provider is mounted it still renders expanded, so dropping\n * `collapsible` alone is a no-op.\n */\n collapsible?: boolean;\n /**\n * Visual treatment.\n * - `\"classic\"` (default) — full-height column flush to the left\n * edge with a right rule. The legacy look; unchanged.\n * - `\"floating\"` — a detached, rounded card inset from the viewport\n * with a soft shadow (modern SaaS pattern). Nav rows get larger\n * hit areas and a pill active state. Exposed as `data-variant` so\n * descendant atoms restyle via `group-data-[variant=floating]`.\n */\n variant?: \"classic\" | \"floating\";\n /**\n * Whether hovering the collapsed rail transiently expands it.\n *\n * `true` (default) is the legacy behavior: hovering the column widens\n * it to an overlay after a short delay. Set `false` for a sidebar with\n * exactly two states — collapsed and open — switched only by\n * <SidebarTrigger> or Mod+\\. Collapsed rows then explain themselves via\n * a tooltip on icon hover instead of by widening the column.\n *\n * Peek is an accelerator when the sidebar is the only chrome. It stops\n * being one next to a second fixed column (a product rail), where an\n * incidental mouse pass on the way to the rail expands the sidebar and\n * shoves the canvas sideways — motion the user did not ask for, from a\n * gesture they did not intend.\n *\n * Only meaningful alongside `collapsible`; with `collapsible={false}`\n * there is no rail to peek out of.\n */\n peek?: boolean;\n}\n\n/**\n * Whether the sidebar is currently rendering icon-only.\n *\n * Descendants normally style themselves off the `data-labels` attribute,\n * which needs no context. This exists for what CSS cannot express: mounting\n * a tooltip is rendering a component, not applying a rule, so <SidebarLink>\n * has to know the collapsed state in JS.\n */\nconst SidebarLabelsHiddenContext = React.createContext<boolean>(false);\n\n/**\n * Whether hover-peek is active for the surrounding sidebar.\n *\n * <SidebarLink> uses this to decide whether a collapsed row needs a tooltip.\n * With peek on, hovering already reveals the label by widening the column, so\n * a tooltip would be a second, redundant answer to the same question — and the\n * two would race, since the column expands out from under the cursor.\n */\nconst SidebarPeekEnabledContext = React.createContext<boolean>(true);\n\n/**\n * `data-collapsed=\"true\"` on a sidebar slot while the column renders icon-only\n * (W7-03).\n *\n * The replacement hook for `C-DOM-06`: instead of copying\n * `group-data-[labels=hide]/sidebar:*` onto every descendant, a consumer\n * targets the part and its state —\n * `[data-slot=\"sidebar-link-label\"][data-collapsed]`. The attribute is\n * *absent* when labels show, so it is additive: nothing is re-stamped over the\n * frozen `group/sidebar` / `data-labels` pair on the root, and the expanded DOM\n * is byte-identical to 1.x.\n */\nfunction useCollapsedAttribute(): { \"data-collapsed\"?: \"true\" } {\n return React.useContext(SidebarLabelsHiddenContext) ? { \"data-collapsed\": \"true\" } : {};\n}\n\nexport const Sidebar = React.forwardRef<HTMLElement, SidebarProps>(function Sidebar(\n {\n className,\n collapsible = false,\n variant = \"classic\",\n peek: peekEnabled = true,\n onMouseEnter,\n onMouseLeave,\n style,\n children,\n ...props\n },\n ref,\n) {\n const isFloating = variant === \"floating\";\n const ctx = React.useContext(SidebarContext);\n const state: SidebarState = collapsible && ctx ? ctx.state : \"expanded\";\n // A peek lock exists so an open dropdown cannot collapse the column out\n // from under itself. With peek disabled the column never auto-expands in\n // the first place, so there is nothing to hold open and the lock is inert.\n const peekLockCount = collapsible && ctx && peekEnabled ? ctx.peekLockCount : 0;\n const [peek, setPeek] = React.useState(false);\n const enterTimer = React.useRef<number | null>(null);\n const leaveTimer = React.useRef<number | null>(null);\n\n const clearTimers = React.useCallback(() => {\n if (enterTimer.current != null) {\n window.clearTimeout(enterTimer.current);\n enterTimer.current = null;\n }\n if (leaveTimer.current != null) {\n window.clearTimeout(leaveTimer.current);\n leaveTimer.current = null;\n }\n }, []);\n\n React.useEffect(() => () => clearTimers(), [clearTimers]);\n\n // The moment a user re-pins to expanded, drop any pending peek state\n // so we never end up in \"expanded + peek=true\" (visually identical\n // but with the wrong shadow/position).\n React.useEffect(() => {\n if (state === \"expanded\") {\n clearTimers();\n setPeek(false);\n }\n }, [state, clearTimers]);\n\n const handleEnter = (e: React.MouseEvent<HTMLElement>) => {\n onMouseEnter?.(e);\n if (!peekEnabled) return;\n if (!collapsible || state !== \"rail\") return;\n if (leaveTimer.current != null) {\n window.clearTimeout(leaveTimer.current);\n leaveTimer.current = null;\n }\n if (peek) return;\n enterTimer.current = window.setTimeout(() => setPeek(true), PEEK_ENTER_DELAY_MS);\n };\n\n const handleLeave = (e: React.MouseEvent<HTMLElement>) => {\n onMouseLeave?.(e);\n if (!peekEnabled) return;\n if (!collapsible) return;\n if (enterTimer.current != null) {\n window.clearTimeout(enterTimer.current);\n enterTimer.current = null;\n }\n if (!peek) return;\n leaveTimer.current = window.setTimeout(() => setPeek(false), PEEK_LEAVE_DELAY_MS);\n };\n\n // Overlay = transient expansion (hover OR programmatic lock). Rendered as\n // `position: fixed` so the canvas does not reflow. Pinned (`state ===\n // \"expanded\"`) renders in-flow instead — the user has committed to the\n // width, so the canvas should adapt to it.\n const overlay = state === \"rail\" && (peek || peekLockCount > 0);\n const labelsHidden = state === \"rail\" && !peek && peekLockCount === 0;\n // Legacy name first: --ds-layout-shell-sidebar-width is always defined at\n // :root (tokens.css), so a var() fallback in the other order never fires —\n // an app that sets only --shell-sidebar-w (the documented write-compat\n // name, legacy-aliases.css) on <Shell> was silently ignored. Reading\n // --shell-sidebar-w first still resolves to the ds default when nothing\n // overrides it, since legacy-aliases.css aliases it to the ds var.\n const effectiveWidth = labelsHidden ? \"var(--shell-sidebar-w-rail, var(--ds-layout-shell-sidebar-rail-width))\" : \"var(--shell-sidebar-w, var(--ds-layout-shell-sidebar-width))\";\n\n return (\n // Hover-peek is *enhancement only*: the canonical way to toggle the\n // sidebar is <SidebarTrigger> (button) or the Mod+\\ shortcut, both\n // fully keyboard- and screen-reader-accessible. The mouse handlers\n // here exist to widen the column on pointer hover, which has no\n // keyboard analogue and intentionally so.\n // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions\n <aside\n ref={ref}\n data-state={state}\n // `data-peek` retained for hover-specifically (back-compat for any\n // external CSS hooks that target it). Overlay rendering — including\n // programmatic peek-lock from `useSidebarPeekLock` — is driven by\n // `data-overlay`. Plan: drop `data-peek` in the next minor.\n data-peek={peek ? \"true\" : undefined}\n data-overlay={overlay ? \"true\" : undefined}\n data-labels={labelsHidden ? \"hide\" : \"show\"}\n data-collapsible={collapsible ? \"true\" : undefined}\n data-variant={variant}\n {...slot(sidebarAnatomy, \"root\")}\n // `state` and `peek` initialize identically on SSR and the client's\n // first render (see <SidebarProvider>) — all data-attributes here\n // match across the hydration boundary, so no suppression is needed.\n // Any future divergence is a real bug and should fail loud.\n onMouseEnter={handleEnter}\n onMouseLeave={handleLeave}\n style={{ width: effectiveWidth, ...style }}\n className={cn(\n \"ds:group/sidebar group/sidebar ds:scrollbar-thin ds:flex ds:shrink-0 ds:flex-col ds:overflow-y-auto ds:px-3 ds:pt-4 ds:pb-4\",\n // Classic: full-height column flush to the left edge with a right\n // rule. The legacy look.\n !isFloating && \"ds:h-dvh ds:border-rule ds:bg-bg-2 ds:border-r\",\n // Floating: a detached, rounded card inset from the viewport with a\n // soft shadow — the modern SaaS pattern. The clear figure/ground gap\n // (Aesthetic-Usability) reads as its own surface above the canvas.\n isFloating &&\n \"ds:border-rule ds:bg-surface ds:shadow-card ds:m-2.5 ds:h-[calc(100dvh-1.25rem)] ds:rounded-2xl ds:border\",\n // 220ms feels right for a ~192px width sweep — slower than the\n // 150ms `--duration-fast` (which reads as a snap on this size of\n // movement) but well short of `--duration-slow` (which feels\n // sluggish). `will-change` hints the compositor so the column\n // doesn't repaint every frame mid-transition.\n \"ds:transition-[width,box-shadow] ds:duration-[var(--motion-duration-spatial)] ds:ease-[var(--motion-ease-move)] ds:motion-reduce:transition-none\",\n \"ds:[will-change:width]\",\n // Overlay (hover-peek OR programmatic peek-lock): float above the\n // canvas without reflowing layout. Driven by `data-overlay` so a\n // single rule handles both transient sources.\n \"ds:data-[overlay=true]:fixed ds:data-[overlay=true]:top-0 ds:data-[overlay=true]:left-0\",\n \"ds:data-[overlay=true]:z-[var(--z-overlay)] ds:data-[overlay=true]:shadow-pop\",\n // Padding is held constant across states so icons keep their\n // horizontal anchor when the column widens — peek expands the\n // labels rightward rather than shifting the icons leftward.\n className,\n )}\n {...props}\n >\n <SidebarPeekEnabledContext.Provider value={peekEnabled}>\n <SidebarLabelsHiddenContext.Provider value={labelsHidden}>\n {/* Mounted only when collapsed rows can actually raise a tooltip, so\n existing peek sidebars keep the exact provider tree they had.\n TooltipProvider renders no DOM, and a consumer's own outer\n provider still wins for everything outside this subtree. */}\n {collapsible && !peekEnabled ? (\n <TooltipProvider delayDuration={200}>{children}</TooltipProvider>\n ) : (\n children\n )}\n </SidebarLabelsHiddenContext.Provider>\n </SidebarPeekEnabledContext.Provider>\n </aside>\n );\n});\nSidebar.displayName = \"Sidebar\";\n\n/* ───────────────────────────────────────────────────────────────────────\n * Trigger\n *\n * Toggle button. Designed to live in either the brand row (inside\n * <Sidebar>) or an app header (outside <Sidebar>, but inside the\n * provider tree). Renders `null` when no provider is mounted so apps\n * can drop it in without conditionals.\n * ─────────────────────────────────────────────────────────────────────── */\n\nexport interface SidebarTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n expandLabel?: string;\n collapseLabel?: string;\n}\n\nexport const SidebarTrigger = React.forwardRef<HTMLButtonElement, SidebarTriggerProps>(\n function SidebarTrigger(\n {\n className,\n expandLabel,\n collapseLabel,\n onClick,\n ...props\n },\n ref,\n ) {\n const messages = useDsMessages(\"sidebar\");\n const ctx = React.useContext(SidebarContext);\n if (!ctx) return null;\n const { state, toggle } = ctx;\n const label =\n state === \"expanded\" ? (collapseLabel ?? messages.collapse) : (expandLabel ?? messages.expand);\n return (\n <button\n ref={ref}\n type=\"button\"\n aria-label={label}\n aria-expanded={state === \"expanded\"}\n onClick={(e) => {\n onClick?.(e);\n if (!e.defaultPrevented) toggle();\n }}\n {...slot(sidebarAnatomy, \"trigger\")}\n className={cn(\n \"ds:inline-flex ds:size-7 ds:shrink-0 ds:items-center ds:justify-center ds:rounded-md\",\n \"ds:text-fg-3 ds:hover:bg-bg-3 ds:hover:text-fg\",\n \"ds:transition-colors ds:duration-[var(--duration-fast)] ds:ease-[var(--ease-out-quart)] ds:motion-reduce:transition-none\",\n \"ds:focus-visible:[box-shadow:var(--shadow-focus-ring)] ds:focus-visible:outline-none\",\n \"ds:[&_svg]:size-4\",\n className,\n )}\n {...props}\n >\n {state === \"expanded\" ? <PanelLeftCloseIcon /> : <PanelLeftIcon />}\n </button>\n );\n },\n);\nSidebarTrigger.displayName = \"SidebarTrigger\";\n\n/* ───────────────────────────────────────────────────────────────────────\n * useSidebarPeekLock\n *\n * Hold the sidebar column visually expanded while `active` is true. In rail\n * mode this renders the column as a `position: fixed` overlay (the same\n * overlay used for hover-peek) so the canvas does not reflow. Releases\n * automatically when `active` flips false or the consumer unmounts.\n *\n * Use for menus, popovers, or command palettes anchored to elements inside\n * the brand row. Do NOT use to express \"I want this pinned\" — that is the\n * user's intent, surfaced via <SidebarPinButton> or Mod+\\. Mutating `state`\n * for transient UI couples persistence to current visuals and races the\n * canonical writers.\n *\n * Refcounted: multiple peer consumers may hold a lock simultaneously\n * without stomping each other; the column collapses only when every lock\n * has released.\n * ─────────────────────────────────────────────────────────────────────── */\n\nexport function useSidebarPeekLock(active: boolean): void {\n const ctx = React.useContext(SidebarContext);\n React.useEffect(() => {\n if (!active || !ctx) return;\n const release = ctx.acquirePeekLock();\n return release;\n }, [active, ctx]);\n}\n\n/* ───────────────────────────────────────────────────────────────────────\n * SidebarPinButton\n *\n * Pin/unpin affordance. Reads `state` only — never `peek` or `peekLockCount`.\n * That single rule prevents the label from lying when the column is\n * transiently overlay-expanded by a dropdown or hover: aria-label and the\n * click effect both reflect the user's persisted intent, not what the\n * column currently happens to look like.\n *\n * Renders null when no provider is mounted or when collapsible is false,\n * mirroring <SidebarTrigger>'s drop-in safety.\n *\n * Coexists with <SidebarTrigger>. Pick one per product based on voice:\n * pin/unpin (this) for products where the user mental model is \"this stays\n * where I left it,\" collapse/expand (SidebarTrigger) for products where the\n * action language is more about visibility than commitment.\n * ─────────────────────────────────────────────────────────────────────── */\n\nexport interface SidebarPinButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** aria-label when state=\"rail\" (default: \"Pin sidebar\"). */\n pinLabel?: string;\n /** aria-label when state=\"expanded\" (default: \"Unpin sidebar\"). */\n unpinLabel?: string;\n}\n\nexport const SidebarPinButton = React.forwardRef<HTMLButtonElement, SidebarPinButtonProps>(\n function SidebarPinButton(\n {\n pinLabel,\n unpinLabel,\n className,\n onClick,\n ...props\n },\n ref,\n ) {\n const messages = useDsMessages(\"sidebar\");\n const ctx = React.useContext(SidebarContext);\n // No-op outside a provider OR when the sidebar is not collapsible —\n // pin has no meaning when the column never collapses.\n if (!ctx || !ctx.collapsible) return null;\n const { state, setState } = ctx;\n const isPinned = state === \"expanded\";\n return (\n <button\n ref={ref}\n type=\"button\"\n aria-label={isPinned ? (unpinLabel ?? messages.unpin) : (pinLabel ?? messages.pin)}\n aria-pressed={isPinned}\n onClick={(e) => {\n onClick?.(e);\n if (!e.defaultPrevented) setState(isPinned ? \"rail\" : \"expanded\");\n }}\n {...slot(sidebarAnatomy, \"pin\")}\n {...stateAttributes({ selected: isPinned })}\n className={cn(\n \"ds:inline-flex ds:size-7 ds:shrink-0 ds:items-center ds:justify-center ds:rounded-md\",\n \"ds:text-fg-4 ds:hover:bg-bg-3 ds:hover:text-fg ds:aria-pressed:text-fg\",\n \"ds:transition-colors ds:duration-[var(--duration-fast)] ds:ease-[var(--ease-out-quart)] ds:motion-reduce:transition-none\",\n \"ds:focus-visible:outline-none ds:focus-visible:[box-shadow:var(--shadow-focus-ring)]\",\n // Hidden when labels are hidden (rail-no-peek-no-lock). Visible\n // in every overlay state so users can pin during hover or while\n // a dropdown holds the column open.\n \"ds:group-data-[labels=hide]/sidebar:hidden\",\n className,\n )}\n {...props}\n >\n <PinGlyph size={14} filled={isPinned} className=\"ds:rotate-45\" />\n </button>\n );\n },\n);\nSidebarPinButton.displayName = \"SidebarPinButton\";\n\n// Inline thumbtack glyph. Lives next to the button — the only consumer for\n// now. Promote to the icons module if a second consumer needs it.\nfunction PinGlyph({\n size = 16,\n filled = false,\n className,\n}: {\n size?: number;\n filled?: boolean;\n className?: string;\n}) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={2}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n className={className}\n >\n <path d=\"M12 17v5\" />\n <path\n d=\"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z\"\n fill={filled ? \"currentColor\" : \"none\"}\n />\n </svg>\n );\n}\n\n/* ───────────────────────────────────────────────────────────────────────\n * Brand\n *\n * Plain flex row. Children that should disappear in rail (e.g. the\n * wordmark text) should be wrapped in <SidebarBrandText>;\n * a bare logo glyph passed as a sibling stays put.\n * ─────────────────────────────────────────────────────────────────────── */\n\nexport type SidebarBrandProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const SidebarBrand = React.forwardRef<HTMLDivElement, SidebarBrandProps>(\n function SidebarBrand({ className, ...props }, ref) {\n return (\n <div\n ref={ref}\n {...slot(sidebarAnatomy, \"brand\")}\n className={cn(\n \"ds:flex ds:min-w-0 ds:items-center ds:gap-2 ds:px-2.5 ds:pt-1 ds:pb-4\",\n className,\n )}\n {...props}\n />\n );\n },\n);\nSidebarBrand.displayName = \"SidebarBrand\";\n\n/**\n * Text portion of the brand row. Hides itself when the sidebar\n * collapses to a rail. Use to wrap product names / wordmarks so the\n * logo glyph alone remains visible at 64px.\n */\nexport type SidebarBrandTextProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const SidebarBrandText = React.forwardRef<HTMLSpanElement, SidebarBrandTextProps>(\n function SidebarBrandText({ className, ...props }, ref) {\n const collapsed = useCollapsedAttribute();\n return (\n <span\n ref={ref}\n aria-hidden=\"false\"\n {...slot(sidebarAnatomy, \"brand-text\")}\n {...collapsed}\n className={cn(\n // line-clamp-1 (not `truncate`) so multi-word wordmarks clip at a\n // word boundary instead of mid-word when the rail is narrow.\n \"ds:min-w-0 ds:line-clamp-1\",\n // Smooth fade + width collapse on rail. Keeps the wordmark\n // legible up to the moment the column reaches rail width, then\n // fully drops out (visibility:hidden cuts hit-testing).\n \"ds:transition-[opacity,max-width] ds:duration-[var(--motion-duration-spatial)] ds:ease-[var(--motion-ease-move)] ds:motion-reduce:transition-none\",\n \"ds:max-w-[160px] ds:opacity-100\",\n \"ds:group-data-[labels=hide]/sidebar:max-w-0 ds:group-data-[labels=hide]/sidebar:opacity-0 ds:group-data-[labels=hide]/sidebar:invisible\",\n className,\n )}\n {...props}\n />\n );\n },\n);\nSidebarBrandText.displayName = \"SidebarBrandText\";\n\n/* ───────────────────────────────────────────────────────────────────────\n * Section\n *\n * Label hides in rail (the section keeps its vertical rhythm via the\n * existing `mb-4`, so grouping reads even without the text). Stays in\n * the DOM as `aria-label` on the group when collapsed — screen readers\n * announce the group regardless of visual state.\n *\n * Also: provides an *exclusive-open scope* to descendant <SidebarLinkGroup>s.\n * When a group's body row is clicked it claims exclusivity within its\n * containing section; siblings collapse. Chevron clicks bypass this and\n * toggle in place. See `SidebarLinkGroup` for the rule.\n * ─────────────────────────────────────────────────────────────────────── */\n\ninterface SidebarGroupScopeValue {\n exclusiveId: string | null;\n setExclusive: (id: string) => void;\n}\n\nconst SidebarGroupScopeContext = React.createContext<SidebarGroupScopeValue | null>(null);\n\nexport interface SidebarSectionProps extends React.HTMLAttributes<HTMLDivElement> {\n label?: React.ReactNode;\n /**\n * Label color tone. Encodes the *meaning* of the section's\n * priority in the scan path:\n * - `\"pro\"` (default) — Pro-purple, for primary day-to-day work.\n * - `\"muted\"` — `text-fg-3`, for system-level or settings groups\n * that should sit lower in the visual hierarchy.\n *\n * Mirrors the `tone` API on `<SidebarLinkBadge>`.\n */\n tone?: \"pro\" | \"muted\";\n /**\n * Trailing slot in the section's header row, beside the label — an \"add\"\n * icon button, a count, a disclosure. The header row is already a\n * `justify-between` flex row, so this lands at its right edge, and it hides\n * with the rest of the header in rail mode.\n *\n * Rendered bare, with no wrapper of ours, and only when a header row exists\n * (`label` or `headerActions` present) — so a section without it keeps the\n * exact 1.x DOM `C-DOM-06` freezes (the header row stays the section's first\n * child div).\n *\n * @experimental W7-03.\n */\n headerActions?: React.ReactNode;\n}\n\nexport const SidebarSection = React.forwardRef<HTMLDivElement, SidebarSectionProps>(\n function SidebarSection(\n { label, tone = \"pro\", headerActions, className, children, ...props },\n ref,\n ) {\n const collapsed = useCollapsedAttribute();\n const ariaLabel =\n typeof label === \"string\" ? label : typeof label === \"number\" ? String(label) : undefined;\n\n const [exclusiveId, setExclusiveIdState] = React.useState<string | null>(null);\n const setExclusive = React.useCallback(\n (id: string) => setExclusiveIdState(id),\n [],\n );\n const scope = React.useMemo<SidebarGroupScopeValue>(\n () => ({ exclusiveId, setExclusive }),\n [exclusiveId, setExclusive],\n );\n\n return (\n <SidebarGroupScopeContext.Provider value={scope}>\n <div\n ref={ref}\n role={ariaLabel ? \"group\" : undefined}\n aria-label={ariaLabel}\n {...slot(sidebarAnatomy, \"section\")}\n {...collapsed}\n className={cn(\n \"ds:mb-4\",\n // In rail, the visible section labels disappear and the only\n // grouping cue is a thin rule. No extra mb/pb — the border\n // itself separates groups, so inter-section spacing matches\n // intra-section spacing and the rail stays dense.\n \"ds:group-data-[labels=hide]/sidebar:mb-0 ds:group-data-[labels=hide]/sidebar:border-b ds:group-data-[labels=hide]/sidebar:border-rule ds:group-data-[labels=hide]/sidebar:pb-0 ds:group-data-[labels=hide]/sidebar:last:border-b-0\",\n className,\n )}\n {...props}\n >\n {(label != null || headerActions != null) && (\n <div\n {...slot(sidebarAnatomy, \"section-header\")}\n {...collapsed}\n className={cn(\n \"ds:mb-1 ds:flex ds:items-center ds:justify-between ds:px-2.5 ds:py-1\",\n \"ds:transition-opacity ds:duration-[var(--motion-duration-spatial)] ds:ease-[var(--motion-ease-move)] ds:motion-reduce:transition-none\",\n \"ds:opacity-100\",\n \"ds:group-data-[labels=hide]/sidebar:invisible ds:group-data-[labels=hide]/sidebar:opacity-0\",\n )}\n >\n {label != null && (\n <span\n {...slot(sidebarAnatomy, \"section-label\")}\n className={cn(\n \"ds:font-mono ds:text-[11px] ds:tracking-[0.14em] ds:uppercase\",\n tone === \"muted\" ? \"ds:text-fg-3\" : \"ds:text-brand\",\n )}\n >\n {label}\n </span>\n )}\n {headerActions}\n </div>\n )}\n {children}\n </div>\n </SidebarGroupScopeContext.Provider>\n );\n },\n);\nSidebarSection.displayName = \"SidebarSection\";\n\n/* ───────────────────────────────────────────────────────────────────────\n * Link\n *\n * In rail (no peek):\n * - Icon centers (justify-center, no gap consumption)\n * - Label, badge, and any other text children are hidden\n *\n * The active rail indicator already anchors to `before:left-0` of the\n * link itself, so it stays visually correct without changes.\n * ─────────────────────────────────────────────────────────────────────── */\n\nexport interface SidebarLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {\n /** Required when rendered as `<a>`; ignored when `asChild` is true. */\n href?: string;\n icon?: React.ReactNode;\n active?: boolean;\n /**\n * Render via Radix `<Slot>` so the consumer can wrap a router-aware\n * component (e.g. Next.js `<Link>`, React Router `<NavLink>`) that\n * owns `href` and prefetch behavior. Without this, sidebar clicks\n * bypass client-side routing and trigger full page loads.\n */\n asChild?: boolean;\n}\n\nfunction getTextContent(node: React.ReactNode): string {\n if (node == null || typeof node === \"boolean\") return \"\";\n if (typeof node === \"string\" || typeof node === \"number\") return String(node);\n if (Array.isArray(node)) return node.map(getTextContent).filter(Boolean).join(\" \");\n if (React.isValidElement<{ children?: React.ReactNode }>(node)) {\n return getTextContent(node.props.children);\n }\n return \"\";\n}\n\nexport const SidebarLink = React.forwardRef<HTMLAnchorElement, SidebarLinkProps>(\n function SidebarLink(\n { href, icon, active = false, asChild, className, children, \"aria-label\": ariaLabel, ...props },\n ref,\n ) {\n const Comp = asChild ? Slot : \"a\";\n const accessibleLabel = ariaLabel ?? (asChild ? undefined : getTextContent(children) || undefined);\n\n const labelsHidden = React.useContext(SidebarLabelsHiddenContext);\n const peekEnabled = React.useContext(SidebarPeekEnabledContext);\n\n // Derived even for `asChild`, unlike `accessibleLabel` above: this is\n // display text for a tooltip, not an accessibility override on someone\n // else's element, so reaching into the wrapped router link for its label\n // is safe and is exactly what the collapsed row needs to name itself.\n const tooltipLabel = ariaLabel ?? (getTextContent(children) || undefined);\n\n // Only when the row is icon-only AND the column will not widen on hover.\n // With peek on, hovering already reveals the label, so a tooltip would be\n // a second answer to the same question — and would race the column\n // expanding out from under the cursor.\n const showTooltip = labelsHidden && !peekEnabled && Boolean(tooltipLabel);\n\n const link = (\n <Comp\n ref={ref}\n {...(asChild ? {} : { href })}\n data-active={active ? \"true\" : undefined}\n aria-current={active ? \"page\" : undefined}\n aria-label={accessibleLabel}\n {...slot(sidebarAnatomy, \"link\")}\n className={cn(\n \"ds:group/link ds:relative ds:mb-px ds:flex ds:items-center ds:gap-2.5 ds:rounded-md ds:px-2.5 ds:py-1.5\",\n \"ds:text-fg-2 ds:text-[13px] ds:font-normal ds:no-underline\",\n \"ds:transition-colors ds:duration-[var(--duration-fast)] ds:ease-[var(--ease-out-quart)]\",\n \"ds:motion-reduce:transition-none\",\n \"ds:hover:bg-bg-3 ds:hover:text-fg\",\n \"ds:focus-visible:[box-shadow:var(--shadow-focus-ring)] ds:focus-visible:outline-none\",\n \"ds:data-[active=true]:bg-brand-bg ds:data-[active=true]:text-brand ds:data-[active=true]:font-medium\",\n // In rail, the icon itself carries the active state rather\n // than just the rule bar — color is more legible than a 2px\n // vertical mark at the column's left edge when labels are\n // hidden. The full-opacity icon override (`opacity-100`)\n // counters the default `[&_svg]:opacity-85` so the active\n // icon doesn't read as \"still inactive but darker\".\n \"ds:group-data-[labels=hide]/sidebar:data-[active=true]:[&_svg]:text-brand ds:group-data-[labels=hide]/sidebar:data-[active=true]:[&_svg]:opacity-100\",\n // Active rail: 2px wide, 16px tall, anchored to the link's\n // own left edge — no parent-padding dependency. Continues\n // working unchanged when the aside narrows to a rail.\n \"ds:data-[active=true]:before:absolute ds:data-[active=true]:before:content-['']\",\n \"ds:data-[active=true]:before:top-1/2 ds:data-[active=true]:before:left-0\",\n \"ds:data-[active=true]:before:h-4 ds:data-[active=true]:before:w-[2px] ds:data-[active=true]:before:-translate-y-1/2\",\n \"ds:data-[active=true]:before:bg-brand ds:data-[active=true]:before:rounded-r-full\",\n // Padding/gap stay constant so the icon stays under the cursor\n // when the column widens during peek. The label simply collapses\n // to width 0 via <SidebarLinkLabel>.\n \"ds:[&_svg]:size-3.5 ds:[&_svg]:shrink-0 ds:[&_svg]:opacity-85\",\n // Floating variant: softer corners + a taller hit area (Fitts's\n // law — a larger target is faster and lower-error to acquire), and\n // a full pill highlight for active instead of the left rail bar.\n \"ds:group-data-[variant=floating]/sidebar:gap-3 ds:group-data-[variant=floating]/sidebar:rounded-lg ds:group-data-[variant=floating]/sidebar:py-2\",\n \"ds:group-data-[variant=floating]/sidebar:data-[active=true]:before:hidden\",\n className,\n )}\n {...props}\n >\n {asChild ? (\n children\n ) : (\n <>\n {icon}\n <span\n {...slot(sidebarAnatomy, \"link-label\")}\n {...(labelsHidden ? { \"data-collapsed\": \"true\" as const } : {})}\n className={cn(\n // Flex row so a trailing <SidebarLinkBadge> (ml-auto) aligns\n // to the right edge with a gap from the label, instead of\n // butting against it. A line-clamp box swallows the badge's\n // auto margin, which is why \"Billing$48k\" rendered glued.\n // Single-line label clips via overflow; badge stays put.\n \"ds:flex ds:min-w-0 ds:flex-1 ds:items-center ds:gap-1.5 ds:overflow-hidden ds:whitespace-nowrap\",\n \"ds:transition-[opacity,max-width] ds:duration-[var(--motion-duration-spatial)] ds:ease-[var(--motion-ease-move)] ds:motion-reduce:transition-none\",\n \"ds:max-w-full ds:opacity-100\",\n \"ds:group-data-[labels=hide]/sidebar:max-w-0 ds:group-data-[labels=hide]/sidebar:opacity-0 ds:group-data-[labels=hide]/sidebar:invisible\",\n )}\n >\n {children}\n </span>\n </>\n )}\n </Comp>\n );\n\n if (!showTooltip) return link;\n\n return (\n <Tooltip>\n <TooltipTrigger asChild>{link}</TooltipTrigger>\n <TooltipContent side=\"right\">{tooltipLabel}</TooltipContent>\n </Tooltip>\n );\n },\n);\nSidebarLink.displayName = \"SidebarLink\";\n\n/**\n * Label slot for `<SidebarLink asChild>` consumers.\n *\n * The default (non-`asChild`) `SidebarLink` already hides its label in rail\n * mode. When consumers opt into `asChild` to wrap a router-aware element,\n * the design system can't reach inside to apply that rule — so consumers\n * compose this atom around their label text. Removes the leaky requirement\n * that every consumer re-stamp `group-data-[labels=hide]/sidebar:hidden`\n * on their inner spans.\n */\nexport type SidebarLinkLabelProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const SidebarLinkLabel = React.forwardRef<HTMLSpanElement, SidebarLinkLabelProps>(\n function SidebarLinkLabel({ className, ...props }, ref) {\n const collapsed = useCollapsedAttribute();\n return (\n <span\n ref={ref}\n {...slot(sidebarAnatomy, \"link-label\")}\n {...collapsed}\n className={cn(\n // line-clamp-1 (not `truncate`) so multi-word labels clip at a\n // word boundary; collapses cleanly with the rail-mode max-width\n // animation since both rules only constrain visible content.\n \"ds:min-w-0 ds:flex-1 ds:line-clamp-1\",\n // Fade + collapse instead of hard display:none so a single\n // 180ms opacity tween covers all labels in lockstep with the\n // 220ms aside-width transition — no snap on the last frame.\n \"ds:transition-[opacity,max-width] ds:duration-[var(--motion-duration-spatial)] ds:ease-[var(--motion-ease-move)] ds:motion-reduce:transition-none\",\n \"ds:max-w-full ds:opacity-100\",\n \"ds:group-data-[labels=hide]/sidebar:max-w-0 ds:group-data-[labels=hide]/sidebar:opacity-0 ds:group-data-[labels=hide]/sidebar:invisible\",\n className,\n )}\n {...props}\n />\n );\n },\n);\nSidebarLinkLabel.displayName = \"SidebarLinkLabel\";\n\n/**\n * Optional trailing action inside a `<SidebarLink asChild>` (e.g. an\n * expand/collapse chevron for a nested section). Hides in rail because the\n * action is not meaningful when labels themselves are hidden.\n */\nexport type SidebarLinkActionProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const SidebarLinkAction = React.forwardRef<HTMLSpanElement, SidebarLinkActionProps>(\n function SidebarLinkAction({ className, ...props }, ref) {\n const collapsed = useCollapsedAttribute();\n return (\n <span\n ref={ref}\n {...slot(sidebarAnatomy, \"link-action\")}\n {...collapsed}\n className={cn(\n \"ds:transition-opacity ds:duration-[var(--motion-duration-spatial)] ds:ease-[var(--motion-ease-move)] ds:motion-reduce:transition-none\",\n \"ds:opacity-100\",\n \"ds:group-data-[labels=hide]/sidebar:invisible ds:group-data-[labels=hide]/sidebar:opacity-0\",\n className,\n )}\n {...props}\n />\n );\n },\n);\nSidebarLinkAction.displayName = \"SidebarLinkAction\";\n\nexport const sidebarLinkBadgeVariants = cva(\n \"ds:ml-auto ds:inline-flex ds:shrink-0 ds:items-center ds:justify-center ds:font-mono ds:tabular-nums ds:group-data-[labels=hide]/sidebar:hidden\",\n {\n variants: {\n tone: {\n default: \"ds:text-[10.5px] ds:text-fg-4 ds:group-data-[active=true]/link:text-brand\",\n danger: \"ds:rounded-pill ds:bg-danger-bg ds:px-1.5 ds:py-0.5 ds:text-[10.5px] ds:text-danger-fg\",\n warning: \"ds:rounded-pill ds:bg-warning-bg ds:px-1.5 ds:py-0.5 ds:text-[10.5px] ds:text-warning-fg\",\n neutral: \"ds:rounded-pill ds:bg-bg-3 ds:px-1.5 ds:py-0.5 ds:text-[10.5px] ds:text-fg-2\",\n },\n },\n defaultVariants: { tone: \"default\" },\n },\n);\n\nexport type SidebarLinkBadgeVariants = VariantProps<typeof sidebarLinkBadgeVariants>;\n\nexport interface SidebarLinkBadgeProps\n extends React.HTMLAttributes<HTMLSpanElement>,\n SidebarLinkBadgeVariants {}\n\nexport const SidebarLinkBadge = React.forwardRef<HTMLSpanElement, SidebarLinkBadgeProps>(\n function SidebarLinkBadge({ tone, className, ...props }, ref) {\n return (\n <span\n ref={ref}\n {...slot(sidebarAnatomy, \"link-badge\")}\n className={cn(sidebarLinkBadgeVariants({ tone }), className)}\n {...props}\n />\n );\n },\n);\nSidebarLinkBadge.displayName = \"SidebarLinkBadge\";\n\n/* ───────────────────────────────────────────────────────────────────────\n * LinkGroup\n *\n * Expandable nav row with split-click semantics:\n * - Body click (icon + label area): \"I'm activating this section.\"\n * Fires `onActivate` (and follows `href` if no consumer prevents\n * default), opens this group, and *closes any other open group in\n * the same SidebarSection*. The accordion behavior matches user\n * mental model: \"I want to focus on this branch.\"\n * - Chevron click: \"Just let me peek at this.\" Toggles open/closed\n * on this group only — siblings are untouched. Lets users keep\n * two branches open side-by-side for cross-reference work.\n *\n * Exclusive coordination lives in the enclosing `<SidebarSection>` via\n * a small registry context. Outside a section, exclusive becomes a\n * no-op and groups behave as pure independent disclosures.\n *\n * Routing: the body renders as an `<a href>`. For client-side routing\n * frameworks that hijack anchor clicks (Next.js Link, React Router),\n * the standard pattern works as-is. A future `asChild` flag can opt\n * the body into Radix `Slot` for direct router-component wrapping.\n *\n * In rail mode the chevron and the collapsible content hide; the body\n * row collapses to icon-only and a body click still navigates without\n * trying to expand the (hidden) tree.\n * ─────────────────────────────────────────────────────────────────────── */\n\nexport interface SidebarLinkGroupProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onClick\"> {\n /**\n * Stable id used for exclusive-mode coordination. Defaults to a\n * generated React id, which is stable across renders within a\n * single tree.\n */\n id?: string;\n icon?: React.ReactNode;\n label: React.ReactNode;\n /** Body href — the body row renders as `<a href>`. */\n href?: string;\n /** Highlights the body row. Independent of the open state. */\n active?: boolean;\n defaultOpen?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n /**\n * Called when the body row is clicked, before the open state is\n * updated and before the section's exclusive lock is claimed. Call\n * `e.preventDefault()` to opt out of both. Use for navigation that\n * needs to run *before* the accordion behavior (rare).\n */\n onActivate?: (e: React.MouseEvent<HTMLAnchorElement>) => void;\n /**\n * Classes for the body row: `row` is the div holding the link and the\n * chevron, `link` the activating `<a>` (`group-link`). Replaces descendant\n * `div:has(> button[aria-expanded])` overrides on the group (C-DOM-06).\n * Style the active row from the same `active` you pass here.\n */\n classNames?: { row?: string; link?: string };\n children?: React.ReactNode;\n}\n\nexport const SidebarLinkGroup = React.forwardRef<HTMLDivElement, SidebarLinkGroupProps>(\n function SidebarLinkGroup(\n {\n id: idProp,\n icon,\n label,\n href,\n active = false,\n defaultOpen = false,\n open: controlled,\n onOpenChange,\n onActivate,\n classNames,\n className,\n children,\n ...props\n },\n ref,\n ) {\n const messages = useDsMessages(\"sidebar\");\n const collapsed = useCollapsedAttribute();\n const reactId = React.useId();\n const id = idProp ?? reactId;\n const scope = React.useContext(SidebarGroupScopeContext);\n\n const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen);\n const open = controlled ?? uncontrolledOpen;\n\n const setOpen = React.useCallback(\n (next: boolean) => {\n if (controlled === undefined) setUncontrolledOpen(next);\n onOpenChange?.(next);\n },\n [controlled, onOpenChange],\n );\n\n // When another group in the same section claims exclusivity, close.\n // We watch `exclusiveId` rather than reading it in handlers so a\n // group that's already open closes promptly when a sibling activates.\n React.useEffect(() => {\n if (scope?.exclusiveId && scope.exclusiveId !== id && open) {\n setOpen(false);\n }\n }, [scope?.exclusiveId, id, open, setOpen]);\n\n const handleBodyClick = (e: React.MouseEvent<HTMLAnchorElement>) => {\n onActivate?.(e);\n if (e.defaultPrevented) return;\n scope?.setExclusive(id);\n setOpen(true);\n };\n\n const handleChevronClick = (e: React.MouseEvent<HTMLButtonElement>) => {\n // Stop propagation so the body row doesn't also activate.\n e.preventDefault();\n e.stopPropagation();\n setOpen(!open);\n };\n\n const contentId = `${id}-content`;\n\n const bodyClassName = cn(\n \"ds:group/link ds:relative ds:flex ds:flex-1 ds:items-center ds:gap-2.5 ds:rounded-md ds:px-2.5 ds:py-1.5\",\n \"ds:text-fg-2 ds:text-[13px] ds:font-normal ds:no-underline\",\n \"ds:transition-colors ds:duration-[var(--duration-fast)] ds:ease-[var(--ease-out-quart)]\",\n \"ds:motion-reduce:transition-none\",\n \"ds:hover:bg-bg-3 ds:hover:text-fg\",\n \"ds:focus-visible:[box-shadow:var(--shadow-focus-ring)] ds:focus-visible:outline-none\",\n \"ds:data-[active=true]:bg-brand-bg ds:data-[active=true]:text-brand ds:data-[active=true]:font-medium\",\n // In rail, color carries active state since the chevron is hidden.\n \"ds:group-data-[labels=hide]/sidebar:data-[active=true]:[&_svg]:text-brand ds:group-data-[labels=hide]/sidebar:data-[active=true]:[&_svg]:opacity-100\",\n // Active rail mark — anchored to body row's left edge.\n \"ds:data-[active=true]:before:absolute ds:data-[active=true]:before:content-['']\",\n \"ds:data-[active=true]:before:top-1/2 ds:data-[active=true]:before:left-0\",\n \"ds:data-[active=true]:before:h-4 ds:data-[active=true]:before:w-[2px] ds:data-[active=true]:before:-translate-y-1/2\",\n \"ds:data-[active=true]:before:bg-brand ds:data-[active=true]:before:rounded-r-full\",\n \"ds:[&_svg]:size-3.5 ds:[&_svg]:shrink-0 ds:[&_svg]:opacity-85\",\n // Floating variant — match SidebarLink: taller hit area, pill active.\n \"ds:group-data-[variant=floating]/sidebar:gap-3 ds:group-data-[variant=floating]/sidebar:rounded-lg ds:group-data-[variant=floating]/sidebar:py-2\",\n \"ds:group-data-[variant=floating]/sidebar:data-[active=true]:before:hidden\",\n classNames?.link,\n );\n\n const labelSpan = (\n <span\n {...slot(sidebarAnatomy, \"link-label\")}\n {...collapsed}\n className={cn(\n // line-clamp-1 (not `truncate`) so multi-word labels clip at a\n // word boundary; collapses cleanly with the rail-mode max-width\n // animation since both rules only constrain visible content.\n \"ds:min-w-0 ds:flex-1 ds:line-clamp-1\",\n \"ds:transition-[opacity,max-width] ds:duration-[var(--motion-duration-spatial)] ds:ease-[var(--motion-ease-move)] ds:motion-reduce:transition-none\",\n \"ds:max-w-full ds:opacity-100\",\n \"ds:group-data-[labels=hide]/sidebar:max-w-0 ds:group-data-[labels=hide]/sidebar:opacity-0 ds:group-data-[labels=hide]/sidebar:invisible\",\n )}\n >\n {label}\n </span>\n );\n\n return (\n <div\n ref={ref}\n {...slot(sidebarAnatomy, \"group\")}\n {...stateAttributes({ state: open ? \"open\" : \"closed\" })}\n className={cn(\"ds:mb-px\", className)}\n {...props}\n >\n <Collapsible open={open} onOpenChange={setOpen}>\n <div className={cn(\"ds:flex ds:items-stretch\", classNames?.row)}>\n <a\n href={href}\n data-active={active ? \"true\" : undefined}\n aria-current={active ? \"page\" : undefined}\n aria-label={getTextContent(label) || undefined}\n onClick={handleBodyClick}\n {...slot(sidebarAnatomy, \"group-link\")}\n className={bodyClassName}\n >\n {icon}\n {labelSpan}\n </a>\n <button\n type=\"button\"\n aria-expanded={open}\n aria-controls={contentId}\n aria-label={open ? messages.collapseSection : messages.expandSection}\n onClick={handleChevronClick}\n {...slot(sidebarAnatomy, \"group-trigger\")}\n className={cn(\n \"ds:ml-px ds:inline-flex ds:size-7 ds:shrink-0 ds:items-center ds:justify-center ds:rounded-md\",\n \"ds:text-fg-4 ds:hover:bg-bg-3 ds:hover:text-fg-2\",\n \"ds:transition-colors ds:duration-[var(--duration-fast)] ds:ease-[var(--ease-out-quart)] ds:motion-reduce:transition-none\",\n \"ds:focus-visible:[box-shadow:var(--shadow-focus-ring)] ds:focus-visible:outline-none\",\n \"ds:[&_svg]:size-3.5 ds:[&_svg]:shrink-0 ds:[&_svg]:transition-transform ds:[&_svg]:duration-[var(--duration-fast)] ds:[&_svg]:ease-[var(--ease-out-quart)] ds:motion-reduce:[&_svg]:transition-none\",\n // Hide in rail — content tree is hidden too, so the\n // affordance has nothing to control.\n \"ds:group-data-[labels=hide]/sidebar:hidden\",\n )}\n >\n <ChevronDownIcon className={open ? \"\" : \"ds:-rotate-90\"} />\n </button>\n </div>\n <CollapsibleContent\n id={contentId}\n {...slot(sidebarAnatomy, \"group-content\")}\n className={cn(\n // Indent column + connecting rule. Children render as\n // standard <SidebarLink>s and keep their own active-rail\n // indicator, which lands flush at the indented column's\n // left edge.\n \"ds:group-data-[labels=hide]/sidebar:hidden\",\n )}\n >\n <div className=\"ds:border-rule ds:mt-px ds:ml-[18px] ds:border-l ds:pl-2\">{children}</div>\n </CollapsibleContent>\n </Collapsible>\n </div>\n );\n },\n);\nSidebarLinkGroup.displayName = \"SidebarLinkGroup\";\n\n/* ───────────────────────────────────────────────────────────────────────\n * Footer\n *\n * Stays at the bottom via `mt-auto`. In rail, centers content (avatar\n * only — see <SidebarUser>).\n * ─────────────────────────────────────────────────────────────────────── */\n\nexport type SidebarFooterProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const SidebarFooter = React.forwardRef<HTMLDivElement, SidebarFooterProps>(\n function SidebarFooter({ className, ...props }, ref) {\n return (\n <div\n ref={ref}\n {...slot(sidebarAnatomy, \"footer\")}\n className={cn(\n \"ds:border-rule ds:mt-auto ds:flex ds:items-center ds:gap-2.5 ds:border-t ds:px-2 ds:pt-2.5 ds:pb-1\",\n \"ds:text-fg-3 ds:text-xs\",\n className,\n )}\n {...props}\n />\n );\n },\n);\nSidebarFooter.displayName = \"SidebarFooter\";\n\nexport interface SidebarUserProps extends React.HTMLAttributes<HTMLDivElement> {\n name: string;\n subtitle?: React.ReactNode;\n avatarSrc?: string | null;\n}\n\nexport const SidebarUser = React.forwardRef<HTMLDivElement, SidebarUserProps>(function SidebarUser(\n { name, subtitle, avatarSrc, className, ...props },\n ref,\n) {\n const collapsed = useCollapsedAttribute();\n return (\n <div\n ref={ref}\n {...slot(sidebarAnatomy, \"user\")}\n {...collapsed}\n className={cn(\"ds:flex ds:min-w-0 ds:items-center ds:gap-2.5\", className)}\n {...props}\n >\n <Avatar size=\"sm\" variant=\"branded\" name={name} src={avatarSrc ?? undefined} />\n <div\n className={cn(\n \"ds:min-w-0 ds:leading-tight\",\n \"ds:transition-[opacity,max-width] ds:duration-[var(--motion-duration-spatial)] ds:ease-[var(--motion-ease-move)] ds:motion-reduce:transition-none\",\n \"ds:max-w-full ds:opacity-100\",\n \"ds:group-data-[labels=hide]/sidebar:max-w-0 ds:group-data-[labels=hide]/sidebar:opacity-0 ds:group-data-[labels=hide]/sidebar:invisible\",\n )}\n >\n {/* line-clamp-1 (not `truncate`) so long firm names / role lines clip\n at a word boundary instead of mid-word — e.g. \"Pinecrest Tax\n Advisors · …\" rather than \"Pinecrest Tax Advisors · Ow…\". */}\n <div\n {...slot(sidebarAnatomy, \"user-name\")}\n className=\"ds:text-fg ds:line-clamp-1 ds:text-[13px] ds:font-medium\"\n >\n {name}\n </div>\n {subtitle != null && (\n <div\n {...slot(sidebarAnatomy, \"user-subtitle\")}\n className=\"ds:text-fg-4 ds:line-clamp-1 ds:font-mono ds:text-[10.5px]\"\n >\n {subtitle}\n </div>\n )}\n </div>\n </div>\n );\n});\nSidebarUser.displayName = \"SidebarUser\";\n\n/* ───────────────────────────────────────────────────────────────────────\n * SidebarDrawer (W7-04)\n *\n * The same sidebar tree, off-canvas, for small viewports. Built on the\n * Sheet internals (W5-07) so the focus trap, scroll lock, dismissable\n * layer, escape/outside-click handling and the reduced-motion-aware slide\n * all come from the overlay parts rather than being re-implemented here —\n * which is what PORTAL had to do in its own mobile shell.\n *\n * The desktop <Sidebar> is untouched: this is a *second* mount point, not a\n * mode of the first. An app renders the drawer below its mobile breakpoint and\n * the column above it, hiding each with its own responsive utility, and passes\n * the same nav tree to both.\n *\n * Inside the panel the tree renders at full width with labels shown, so the\n * nav atoms behave exactly as they do in an expanded column — the drawer\n * carries `group/sidebar` plus `data-labels=\"show\"` itself, which is the\n * contract those atoms read. `data-mode=\"mobile\"` distinguishes it from the\n * column for anything that needs to.\n * ─────────────────────────────────────────────────────────────────────── */\n\nexport interface SidebarDrawerProps {\n /** Controlled open state. */\n open?: boolean;\n /** Initial open state when uncontrolled. */\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n /**\n * Accessible name of the drawer. Defaults to `sidebar.navigation`\n * (\"Navigation\") from the provider's messages.\n */\n label?: string;\n /** Extra classes on the sliding panel. */\n className?: string;\n children?: React.ReactNode;\n}\n\n/**\n * Off-canvas sidebar for small viewports.\n *\n * @experimental W7-04. The desktop `Sidebar` is unchanged; this is an\n * additional mount point whose panel geometry may still change.\n */\nexport function SidebarDrawer({\n open,\n defaultOpen,\n onOpenChange,\n label,\n className,\n children,\n}: SidebarDrawerProps) {\n const messages = useDsMessages(\"sidebar\");\n return (\n <Sheet\n {...(open !== undefined && { open })}\n {...(defaultOpen !== undefined && { defaultOpen })}\n {...(onOpenChange !== undefined && { onOpenChange })}\n >\n <SheetContent\n side=\"left\"\n data-mode=\"mobile\"\n data-labels=\"show\"\n // Legacy name first — see the comment on `effectiveWidth` above.\n style={{ width: \"var(--shell-sidebar-w, var(--ds-layout-shell-sidebar-width))\" }}\n className={cn(\n \"ds:group/sidebar group/sidebar ds:scrollbar-thin ds:bg-bg-2 ds:flex ds:flex-col ds:overflow-y-auto ds:px-3 ds:pt-4 ds:pb-4\",\n className,\n )}\n >\n {/* Radix requires a title for the dialog's accessible name; the\n drawer's chrome is the nav itself, so it is visually hidden. */}\n <SheetTitle className=\"ds:sr-only\">{label ?? messages.navigation}</SheetTitle>\n {children}\n </SheetContent>\n </Sheet>\n );\n}\nSidebarDrawer.displayName = \"SidebarDrawer\";\n","\"use client\";\n\nimport * as React from \"react\";\n\nimport { cn } from \"../lib/cn\";\nimport { ChevronDownIcon } from \"../primitives/icons\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from \"../primitives/dropdown-menu\";\nimport {\n sidebarBrandSwitcherAnatomy,\n type SidebarBrandSwitcherSlot,\n} from \"../foundation/anatomy/slots\";\nimport { slot } from \"../foundation/anatomy/slot\";\nimport { SidebarBrandText, useSidebarPeekLock } from \"./sidebar\";\n\n/** The brand-switcher parts (ADR-008). See the registry for the doc comment. */\nexport type { SidebarBrandSwitcherSlot };\n\n/* ───────────────────────────────────────────────────────────────────────\n * SidebarBrandSwitcher\n *\n * Brand-row dropdown for switching between sibling products / workspaces\n * (Notion / Linear pattern). The whole brand row is the trigger: a\n * consumer-supplied glyph + wordmark + chevron. Collapses to icon-only\n * in rail mode via the standard `data-[labels=hide]/sidebar` group.\n *\n * Named for its slot: it sits where <SidebarBrand> would, alongside\n * <SidebarBrandText> and <SidebarPinButton> in the brand-row family. The\n * Sidebar prefix groups it with its neighbors in autocomplete and signals\n * the coupling — this composite reads sidebar state (peek-lock, rail)\n * and is not designed to be mounted outside the sidebar shell.\n *\n * **Replaces <SidebarBrand>, do not nest inside it.** The switcher renders\n * its own brand row with the same `px-2.5 pt-1 pb-4 gap-2` geometry, so the\n * brand glyph aligns with link icons below. Wrapping in <SidebarBrand>\n * doubles the padding and shifts the glyph right of the icon column.\n *\n * <Sidebar collapsible>\n * <SidebarBrandSwitcher\n * brand={<img src=\"/brand/mark.svg\" alt=\"\" width={24} height={24} />}\n * label={<>Assure <span className=\"text-pro-fg font-medium\">Pro</span></>}\n * current={items[0]}\n * items={items}\n * onLaunch={launch}\n * trailing={<SidebarPinButton className=\"ml-0.5\" />}\n * />\n * <SidebarSection label=\"MAIN\" tone=\"muted\">…</SidebarSection>\n * </Sidebar>\n *\n * Token discipline: this composite owns layout, motion, and the row\n * affordances, but never owns *product brand colors*. The accent swatch\n * for each item is supplied by the consumer via `tone` (a Tailwind class\n * string or a fully-rendered glyph), keeping vendor-specific hex out of\n * the DS.\n *\n * Framework neutrality: the brand image is a consumer slot. The DS does\n * not import `next/image` or any framework primitive — pass whatever\n * element your stack uses.\n *\n * Sidebar coordination: while the menu is open we acquire a peek-lock\n * via `useSidebarPeekLock` so the column stays visually expanded as an\n * overlay if the user has pinned it to rail. The user's pinned intent\n * is never mutated — that remains the job of <SidebarPinButton>.\n * ─────────────────────────────────────────────────────────────────────── */\n\nexport interface SidebarBrandSwitcherItem {\n /** Stable id used as React key and for `data-item` on each row. */\n id: string;\n /** Primary display name, e.g. \"Assure Audit\". */\n name: string;\n /** Sub-line under the name, e.g. \"Audit fieldwork\". */\n tagline?: string;\n /**\n * Short label rendered inside the default tile glyph (first character\n * is used, à la \"A\" for \"Audit\"). Ignored when `glyph` is supplied.\n */\n short?: string;\n /**\n * Accent for the default tile background. A Tailwind class string\n * (e.g. `\"bg-[#5b3bc4]\"`) — the consumer owns brand color values, the\n * DS just composes them. Ignored when `glyph` is supplied.\n */\n tone?: string;\n /**\n * Pre-rendered tile glyph. When provided, replaces the default\n * \"first letter on `tone` swatch\" tile entirely. Use for items that\n * have a real mark instead of a letter.\n */\n glyph?: React.ReactNode;\n /**\n * Full-width identity node rendered in place of the tile + `name`\n * — e.g. a product wordmark lockup (`<Logo href={null} …>`). When present\n * the row omits the tile and the `name` text; `tagline` still renders\n * beneath it. When absent the row falls back to tile + `name`.\n *\n * Framework-neutral like the rest of this composite: pass whatever element\n * your stack renders (a DS `Logo`, a plain `<img>`, an inline SVG). The DS\n * does not bind to it.\n */\n identity?: React.ReactNode;\n /**\n * False marks the item as not-yet-available; rendered disabled with\n * a \"Soon\" badge by default (override via `unavailableBadge`).\n */\n available?: boolean;\n /** Pass-through onto the row's `data-item` for analytics / e2e hooks. */\n dataAttr?: string;\n}\n\n/**\n * An external launcher row appended after the \"Switch to\" list — a non-suite\n * entry with no availability / \"Soon\" semantics (e.g. a partner product reached\n * by its own autologin URL rather than the suite's switch model). Vendor color\n * lives in the consumer-owned `glyph`, keeping brand hex out of the DS.\n */\nexport interface SidebarBrandSwitcherExtra {\n /** Stable id — React key and default `data-item`. */\n id: string;\n /** Left glyph (a consumer-owned mark/tile). Vendor color belongs here. */\n glyph?: React.ReactNode;\n /**\n * Full-width identity node rendered in place of the `glyph` + `name` — e.g. a\n * product wordmark lockup (`<Logo href={null} …>`) — mirroring\n * `SidebarBrandSwitcherItem.identity`. Use it so an external launcher row\n * reads at the same size and on the same line as the suite product rows.\n * When present, `tagline` still renders beneath it and `glyph`/`name` are\n * omitted. Consumer-owned and framework-neutral like the rest of this slot.\n */\n identity?: React.ReactNode;\n /** Primary display name, e.g. \"myCPE One\". */\n name: React.ReactNode;\n /** Sub-line under the name. */\n tagline?: React.ReactNode;\n /** Invoked when the row is selected. The DS holds no opinion on what it does. */\n onSelect: () => void;\n /** Pass-through onto the row's `data-item` for analytics / e2e hooks. */\n dataAttr?: string;\n}\n\nexport interface SidebarBrandSwitcherProps {\n /**\n * Brand glyph rendered at the left edge of the trigger (e.g. an\n * `<img>` of the product mark). Consumer-supplied so the DS does\n * not bind to a framework-specific image element.\n */\n brand?: React.ReactNode;\n /** Wordmark / label rendered next to the brand glyph in the trigger. */\n label: React.ReactNode;\n /**\n * The currently-active item. Pinned at the top of the menu and\n * excluded from the \"Switch to\" list automatically.\n */\n current: SidebarBrandSwitcherItem;\n /**\n * Full item list including `current`. Order is preserved in the\n * \"Switch to\" section; the current entry is filtered out.\n */\n items: SidebarBrandSwitcherItem[];\n /**\n * Called when a non-current, available item is selected. Receives the\n * full item so consumers can route, open a new window, or trigger an\n * SSO handoff — the DS holds no opinion on what \"switch\" means.\n */\n onLaunch?: (item: SidebarBrandSwitcherItem) => void | Promise<void>;\n /**\n * External launcher rows appended after the \"Switch to\" list — non-suite\n * entries with no availability / \"Soon\" semantics. Each renders a consumer\n * `glyph` + name + tagline and calls its own `onSelect`.\n */\n extras?: SidebarBrandSwitcherExtra[];\n /**\n * Optional predicate reporting whether an item is mid-launch from an\n * external source (e.g. a suite-focus provider that drives the launch itself).\n * ORed with the row's internal launching state to show the \"Opening…\" badge\n * and to guard against a double launch. Absent → only internal state applies.\n */\n isLaunching?: (item: SidebarBrandSwitcherItem) => boolean;\n /** Label above the current row. Defaults to \"Currently using\". */\n currentSectionLabel?: React.ReactNode;\n /** Label above the others list. Defaults to \"Switch to\". */\n switchSectionLabel?: React.ReactNode;\n /** Label at the very top of the menu. Defaults to \"Suite\". */\n menuLabel?: React.ReactNode;\n /** Badge text next to the current item. Defaults to \"Current\". */\n currentBadge?: React.ReactNode;\n /** Badge text on unavailable items. Defaults to \"Soon\". */\n unavailableBadge?: React.ReactNode;\n /** Accessible label on the trigger button. Defaults to \"Switch product\". */\n triggerLabel?: string;\n /** Extra classes applied to the outer brand-row wrapper. */\n className?: string;\n /** Extra classes applied to the trigger button. */\n triggerClassName?: string;\n /** Extra classes applied to the dropdown content panel. */\n contentClassName?: string;\n /** Extra classes applied to the chevron icon. */\n iconClassName?: string;\n /**\n * Extra classes applied to the current row, each \"Switch to\" product row, and\n * each `extras` launcher row. Lets a consumer reproduce bespoke row\n * padding/height via tailwind-merge without the DS owning that geometry, and\n * keeps launcher rows aligned with the product rows.\n */\n rowClassName?: string;\n /**\n * Slot rendered to the right of the trigger inside the brand row.\n * Typical use: drop a `<SidebarPinButton/>` here.\n */\n trailing?: React.ReactNode;\n}\n\nexport const SidebarBrandSwitcher = React.forwardRef<HTMLDivElement, SidebarBrandSwitcherProps>(\n function SidebarBrandSwitcher(\n {\n brand,\n label,\n current,\n items,\n onLaunch,\n extras,\n isLaunching,\n currentSectionLabel = \"Currently using\",\n switchSectionLabel = \"Switch to\",\n menuLabel = \"Suite\",\n currentBadge = \"Current\",\n unavailableBadge = \"Soon\",\n triggerLabel = \"Switch product\",\n className,\n triggerClassName,\n contentClassName,\n iconClassName,\n rowClassName,\n trailing,\n },\n ref,\n ) {\n const [open, setOpen] = React.useState(false);\n useSidebarPeekLock(open);\n\n const others = items.filter((p) => p.id !== current.id);\n\n return (\n // Geometry mirrors <SidebarBrand>: `px-2.5 pt-1 pb-4 gap-2`. This is\n // deliberate — the switcher replaces SidebarBrand, so the brand\n // glyph must land at the same column x-position that direct children\n // of <SidebarBrand> sit at, which in turn matches the 10px left\n // padding of <SidebarLink> icons below.\n <div\n ref={ref}\n {...slot(sidebarBrandSwitcherAnatomy, \"root\")}\n className={cn(\"ds:flex ds:min-w-0 ds:items-center ds:gap-2 ds:px-2.5 ds:pt-1 ds:pb-4\", className)}\n >\n <DropdownMenu open={open} onOpenChange={setOpen}>\n <DropdownMenuTrigger\n aria-label={triggerLabel}\n {...slot(sidebarBrandSwitcherAnatomy, \"trigger\")}\n className={cn(\n // Negative left margin pulls the trigger's hover-bg toward\n // the column edge while the inner padding holds the brand\n // glyph at the same x-position as direct <SidebarBrand>\n // children — same hover affordance, no glyph drift.\n \"ds:group/brand-trigger ds:-ml-2 ds:flex ds:min-w-0 ds:flex-1 ds:items-center ds:gap-2 ds:rounded-md ds:py-1.5 ds:pr-1.5 ds:pl-2\",\n \"ds:text-fg ds:transition-colors ds:duration-[var(--duration-fast)] ds:ease-[var(--ease-out-quart)] ds:motion-reduce:transition-none\",\n \"ds:hover:bg-bg-3 ds:data-[state=open]:bg-bg-3\",\n \"ds:focus-visible:outline-none ds:focus-visible:[box-shadow:var(--shadow-focus-ring)]\",\n triggerClassName,\n )}\n >\n {brand}\n <SidebarBrandText className=\"ds:font-display ds:text-fg ds:text-[17px] ds:font-semibold ds:tracking-tight\">\n {label}\n </SidebarBrandText>\n <ChevronDownIcon\n {...slot(sidebarBrandSwitcherAnatomy, \"icon\")}\n className={cn(\n \"ds:ml-auto ds:size-3.5 ds:shrink-0 ds:text-fg-4\",\n \"ds:transition-transform ds:duration-[var(--duration-fast)] ds:ease-[var(--ease-out-quart)] ds:motion-reduce:transition-none\",\n \"ds:group-data-[state=open]/brand-trigger:rotate-180\",\n \"ds:group-data-[labels=hide]/sidebar:hidden\",\n iconClassName,\n )}\n />\n </DropdownMenuTrigger>\n <DropdownMenuContent\n side=\"right\"\n align=\"start\"\n sideOffset={12}\n className={cn(\"ds:w-72 ds:p-1\", contentClassName)}\n >\n <DropdownMenuLabel className=\"ds:px-2 ds:pt-1 ds:pb-1.5\">{menuLabel}</DropdownMenuLabel>\n <SidebarBrandSwitcherSectionLabel>\n {currentSectionLabel}\n </SidebarBrandSwitcherSectionLabel>\n <SidebarBrandSwitcherCurrentRow\n item={current}\n badge={currentBadge}\n rowClassName={rowClassName}\n />\n <DropdownMenuSeparator className=\"ds:my-1.5\" />\n <SidebarBrandSwitcherSectionLabel>\n {switchSectionLabel}\n </SidebarBrandSwitcherSectionLabel>\n {others.map((p) => (\n <SidebarBrandSwitcherOtherRow\n key={p.id}\n item={p}\n onLaunch={onLaunch}\n unavailableBadge={unavailableBadge}\n rowClassName={rowClassName}\n isLaunching={isLaunching}\n />\n ))}\n {extras?.map((extra) => (\n <SidebarBrandSwitcherExtraRow\n key={extra.id}\n extra={extra}\n rowClassName={rowClassName}\n />\n ))}\n </DropdownMenuContent>\n </DropdownMenu>\n {trailing}\n </div>\n );\n },\n);\nSidebarBrandSwitcher.displayName = \"SidebarBrandSwitcher\";\n\nfunction SidebarBrandSwitcherSectionLabel({ children }: { children: React.ReactNode }) {\n return (\n <div className=\"ds:px-2 ds:pt-1 ds:pb-0.5 ds:text-[10px] ds:tracking-wider ds:uppercase ds:text-fg-4\">\n {children}\n </div>\n );\n}\n\ninterface SidebarBrandSwitcherTileProps {\n item: SidebarBrandSwitcherItem;\n}\n\nexport function SidebarBrandSwitcherTile({ item }: SidebarBrandSwitcherTileProps) {\n if (item.glyph) return <>{item.glyph}</>;\n const initial = (item.short ?? item.name).charAt(0).toUpperCase();\n return (\n <span\n aria-hidden\n className={cn(\n \"ds:inline-flex ds:size-6 ds:shrink-0 ds:items-center ds:justify-center ds:rounded-md\",\n \"ds:text-[11px] ds:font-semibold ds:text-white\",\n item.tone,\n )}\n >\n {initial}\n </span>\n );\n}\n\n// The left identity block shared by the current and \"Switch to\" rows. When the\n// item supplies an `identity` node (e.g. a wordmark lockup) it renders that\n// full-width, with the tagline beneath and no tile/name text. Otherwise it\n// falls back to the default tile + name + tagline — unchanged from before.\nfunction SidebarBrandSwitcherIdentity({ item }: { item: SidebarBrandSwitcherItem }) {\n if (item.identity) {\n return (\n <div className=\"ds:flex ds:min-w-0 ds:flex-1 ds:flex-col ds:gap-0.5\">\n {item.identity}\n {item.tagline && (\n <span className=\"ds:text-fg-3 ds:text-[11px] ds:leading-tight\">{item.tagline}</span>\n )}\n </div>\n );\n }\n return (\n <>\n <SidebarBrandSwitcherTile item={item} />\n <div className=\"ds:flex ds:min-w-0 ds:flex-1 ds:flex-col\">\n <span className=\"ds:text-fg ds:text-[13px] ds:font-medium\">{item.name}</span>\n {item.tagline && <span className=\"ds:text-fg-3 ds:text-[11px]\">{item.tagline}</span>}\n </div>\n </>\n );\n}\n\nfunction SidebarBrandSwitcherCurrentRow({\n item,\n badge,\n rowClassName,\n}: {\n item: SidebarBrandSwitcherItem;\n badge: React.ReactNode;\n rowClassName?: string | undefined;\n}) {\n return (\n <div\n className={cn(\n \"ds:mx-0 ds:flex ds:cursor-default ds:items-center ds:gap-2.5 ds:rounded-md ds:bg-bg-2 ds:px-2 ds:py-1.5\",\n rowClassName,\n )}\n >\n <SidebarBrandSwitcherIdentity item={item} />\n {badge && (\n <span className=\"ds:rounded-sm ds:px-1.5 ds:py-0.5 ds:text-[10px] ds:font-medium ds:tracking-wider ds:uppercase ds:text-pro-fg ds:ring-1 ds:ring-pro-fg/30\">\n {badge}\n </span>\n )}\n </div>\n );\n}\n\nfunction SidebarBrandSwitcherOtherRow({\n item,\n onLaunch,\n unavailableBadge,\n rowClassName,\n isLaunching,\n}: {\n item: SidebarBrandSwitcherItem;\n onLaunch?: ((item: SidebarBrandSwitcherItem) => void | Promise<void>) | undefined;\n unavailableBadge: React.ReactNode;\n rowClassName?: string | undefined;\n isLaunching?: ((item: SidebarBrandSwitcherItem) => boolean) | undefined;\n}) {\n const reachable = item.available !== false;\n const [launching, setLaunching] = React.useState(false);\n // A launch may also be driven from outside (e.g. a suite-focus provider that\n // owns the transition). OR that in so the row reflects it and can't double-fire.\n const externalLaunching = isLaunching?.(item) ?? false;\n const busy = launching || externalLaunching;\n\n const handleSelect = async () => {\n if (!reachable || busy || !onLaunch) return;\n setLaunching(true);\n try {\n await onLaunch(item);\n } finally {\n setLaunching(false);\n }\n };\n\n return (\n <DropdownMenuItem\n disabled={!reachable}\n onSelect={(e) => {\n if (!reachable) {\n e.preventDefault();\n return;\n }\n void handleSelect();\n }}\n data-item={item.dataAttr ?? item.id}\n className={cn(\"ds:flex ds:items-center ds:gap-2.5 ds:rounded-md ds:px-2 ds:py-1.5\", rowClassName)}\n >\n <SidebarBrandSwitcherIdentity item={item} />\n {!reachable && unavailableBadge && (\n <span className=\"ds:rounded-sm ds:bg-bg-3 ds:px-1.5 ds:py-0.5 ds:text-[10px] ds:font-medium ds:tracking-wider ds:uppercase ds:text-fg-4\">\n {unavailableBadge}\n </span>\n )}\n {reachable && busy && (\n <span className=\"ds:rounded-sm ds:bg-bg-3 ds:px-1.5 ds:py-0.5 ds:text-[10px] ds:font-medium ds:tracking-wider ds:uppercase ds:text-fg-4\">\n Opening…\n </span>\n )}\n </DropdownMenuItem>\n );\n}\n\n// An external launcher row (see `SidebarBrandSwitcherExtra`). No availability /\n// \"Soon\" or launching semantics — it just renders the consumer identity/glyph +\n// text and calls `onSelect` on selection. When the extra supplies an `identity`\n// it renders the same full-width lockup layout as the product rows (and honors\n// `rowClassName`) so the launcher reads at the same size and line; otherwise it\n// falls back to the default glyph + name + tagline.\nfunction SidebarBrandSwitcherExtraRow({\n extra,\n rowClassName,\n}: {\n extra: SidebarBrandSwitcherExtra;\n rowClassName?: string | undefined;\n}) {\n return (\n <DropdownMenuItem\n onSelect={() => extra.onSelect()}\n data-item={extra.dataAttr ?? extra.id}\n className={cn(\"ds:flex ds:items-center ds:gap-2.5 ds:rounded-md ds:px-2 ds:py-1.5\", rowClassName)}\n >\n {extra.identity ? (\n <div className=\"ds:flex ds:min-w-0 ds:flex-1 ds:flex-col ds:gap-0.5\">\n {extra.identity}\n {extra.tagline && (\n <span className=\"ds:text-fg-3 ds:text-[11px] ds:leading-tight\">{extra.tagline}</span>\n )}\n </div>\n ) : (\n <>\n {extra.glyph}\n <div className=\"ds:flex ds:min-w-0 ds:flex-1 ds:flex-col\">\n <span className=\"ds:text-fg ds:text-[13px] ds:font-medium\">{extra.name}</span>\n {extra.tagline && <span className=\"ds:text-fg-3 ds:text-[11px]\">{extra.tagline}</span>}\n </div>\n </>\n )}\n </DropdownMenuItem>\n );\n}\n","import { createContext, forwardRef, useContext } from \"react\";\n\n/**\n * Brand scope — ambient product theming.\n *\n * The `brand` color family (bg-brand, hover:bg-brand-hover, bg-brand-bg,\n * border-brand-line, text-fg-on-brand, plus the accent/focus/primary\n * interaction tokens) follows the nearest `[data-brand]` scope and defaults to\n * Pro. Authors type the STATE only; the product comes from the scope. Set it\n * once high in the tree — ideally on the same root as the `.dark` class\n * (`<html>`/`<body>`) — so Radix-portalled surfaces inherit it through the DOM.\n *\n * <html data-brand=\"tax\"> // whole shell renders teal\n * <div {...brandScope(\"audit\")}> // a subtree renders blue\n *\n * For the rarer case of multiple scopes on one page WITH portalled content\n * (a Dialog/Popover that escapes its scoped subtree to document.body), wrap the\n * region in <BrandScope> / <BrandScopeProvider> and have the portalled\n * `*Content` re-stamp `data-brand={useBrandScope()}` on its own element.\n */\nexport type BrandProduct = \"pro\" | \"audit\" | \"books\" | \"tax\";\n\n/**\n * `data-brand` attribute object to spread on any element (mirrors\n * `serviceToneStyle`). This is the primary API for opting a subtree into a\n * product without naming the product in a utility class.\n */\nexport function brandScope(product: BrandProduct): { \"data-brand\": BrandProduct } {\n return { \"data-brand\": product };\n}\n\n/** Every product, in suite order — for switchers and story matrices. */\nexport const BRAND_PRODUCTS: BrandProduct[] = [\"pro\", \"audit\", \"books\", \"tax\"];\n\n/** Human label for a product, for switchers and headings. */\nexport const brandLabel: Record<BrandProduct, string> = {\n pro: \"Pro\",\n audit: \"Audit\",\n books: \"Books\",\n tax: \"Tax\",\n};\n\nconst BrandScopeContext = createContext<BrandProduct>(\"pro\");\n\n/**\n * Provides the active product to descendants so portalled surfaces can\n * re-stamp `data-brand` on themselves via {@link useBrandScope}. Purely a\n * structural carrier — the visual theming still comes from the `[data-brand]`\n * attribute in the DOM, not from this context.\n */\nexport function BrandScopeProvider({\n product,\n children,\n}: {\n product: BrandProduct;\n children: React.ReactNode;\n}) {\n return (\n <BrandScopeContext.Provider value={product}>{children}</BrandScopeContext.Provider>\n );\n}\n\n/** Read the ambient product from the nearest provider (defaults to Pro). */\nexport function useBrandScope(): BrandProduct {\n return useContext(BrandScopeContext);\n}\n\nexport interface BrandScopeProps extends React.HTMLAttributes<HTMLDivElement> {\n /** The product this subtree renders as. */\n product: BrandProduct;\n}\n\n/**\n * Convenience wrapper that stamps `data-brand` on a `<div>` AND provides the\n * product via context, so a portalled descendant can re-stamp itself. Use\n * `brandScope()` directly when you want the attribute on your own element.\n */\nexport const BrandScope = forwardRef<HTMLDivElement, BrandScopeProps>(function BrandScope(\n { product, children, ...props },\n ref,\n) {\n return (\n <BrandScopeProvider product={product}>\n <div ref={ref} data-brand={product} {...props}>\n {children}\n </div>\n </BrandScopeProvider>\n );\n});\n\nBrandScope.displayName = \"BrandScope\";\n"]}
|