@platned/ui 0.10.1 → 0.10.3

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/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/forms/button-group.tsx","../src/components/avatar/avatar.tsx","../src/components/avatar/avatar-group.tsx","../src/components/avatar/avatar-block.tsx","../src/components/forms/input.tsx","../src/components/forms/textarea.tsx","../src/components/forms/native-select.tsx","../src/components/forms/date-picker.tsx","../src/components/overlays/popover.tsx","../src/components/forms/calendar.tsx","../src/components/forms/stepper.tsx","../src/components/forms/multiselect-card.tsx","../src/components/forms/choice-card-size.ts","../src/components/forms/switch.tsx","../src/components/forms/toggle.tsx","../src/components/forms/input-otp.tsx","../src/components/forms/file-drop-zone.tsx","../src/components/forms/tag-input.tsx","../src/components/status/tag-pill.tsx","../src/components/forms/form-card.tsx","../src/components/forms/form.tsx","../src/components/forms/form-fields.tsx","../src/components/forms/combobox.tsx","../src/components/forms/country-select.tsx","../src/components/forms/radio-group.tsx","../src/components/forms/segmented-control.tsx","../src/components/forms/time-zone-select.tsx","../src/components/forms/use-dependent-options.ts","../src/components/forms/form-deprecated.ts","../src/components/status/badge.tsx","../src/components/status/role-badge.tsx","../src/components/forms/role-combo-box.tsx","../src/components/forms/command.tsx","../src/components/status/status-badge.tsx","../src/components/status/status-dot.tsx","../src/components/status/status-chip.tsx","../src/components/status/count-badge.tsx","../src/components/status/trail-chip.tsx","../src/components/status/user-status-pill.tsx","../src/components/status/check-indicator.tsx","../src/components/status/entity-icon-badge.tsx","../src/components/forms/radio-cards.tsx","../src/components/forms/checkbox-group.tsx","../src/components/forms/slider.tsx","../src/components/forms/label.tsx","../src/components/overlays/modal.tsx","../src/components/overlays/toaster-guard.ts","../src/components/overlays/tooltip.tsx","../src/components/overlays/hover-card.tsx","../src/components/overlays/context-menu.tsx","../src/components/overlays/menubar.tsx","../src/components/overlays/drawer.tsx","../src/components/cards/scroll-area.tsx","../src/components/overlays/confirm-dialog.tsx","../src/components/overlays/note-confirm-modal.tsx","../src/components/overlays/scrim.tsx","../src/components/overlays/fullscreen-surface.tsx","../src/components/chrome/visually-hidden.tsx","../src/components/chrome/accessible-icon.tsx","../src/components/cards/card.tsx","../src/components/cards/accordion.tsx","../src/components/cards/collapsible.tsx","../src/components/cards/layout.tsx","../src/components/cards/aspect-ratio.tsx","../src/components/cards/carousel.tsx","../src/components/cards/resizable.tsx","../src/components/chrome/page-heading.tsx","../src/components/chrome/page-toolbar.tsx","../src/components/chrome/filter-bar.tsx","../src/components/chrome/tabs.tsx","../src/components/chrome/nav-item.tsx","../src/components/chrome/sidebar.tsx","../src/lib/use-media-query.ts","../src/components/chrome/eyebrow-label.tsx","../src/components/chrome/separator.tsx","../src/components/chrome/kbd.tsx","../src/components/chrome/breadcrumb.tsx","../src/components/chrome/navigation-menu.tsx","../src/components/chrome/typography.tsx","../src/components/widgets/widget-header.tsx","../src/components/widgets/widget-title.tsx","../src/components/widgets/widget-footer.tsx","../src/components/widgets/widget-grid.tsx","../src/lib/width-tier.ts","../src/lib/use-width-tier.ts","../src/components/stats/stat-tile.tsx","../src/components/stats/stat-number.tsx","../src/components/stats/score-value.tsx","../src/components/stats/tile-grid.tsx","../src/components/charts/chart-tone.ts","../src/components/charts/bar-chart.tsx","../src/components/charts/donut-chart.tsx","../src/components/charts/radial-gauge.tsx","../src/components/charts/sparkline.tsx","../src/components/charts/mini-bar-chart.tsx","../src/components/charts/chart-legend.tsx","../src/components/charts/legend-dot.tsx","../src/components/charts/trend-label.tsx","../src/components/lists/listbox.tsx","../src/components/lists/list-row.tsx","../src/components/lists/file-row.tsx","../src/components/lists/scored-row.tsx","../src/components/lists/numbered-list.tsx","../src/components/lists/icon-text-row.tsx","../src/components/lists/checklist-row.tsx","../src/components/lists/steps-list.tsx","../src/components/lists/detail-item.tsx","../src/components/lists/description-list.tsx","../src/components/lists/checked-group-list.tsx","../src/components/lists/tree-view.tsx","../src/index.tsx","../src/components/feedback/inline-alert.tsx","../src/components/feedback/error-boundary.tsx","../src/components/feedback/banner.tsx","../src/components/feedback/toast.tsx","../src/components/forms/password-input.tsx","../src/components/ai/ai-chat-bar.tsx","../src/components/ai/ai-suggestion-chip.tsx","../src/components/ai/quick-actions-bar.tsx","../src/components/ai/chat.tsx","../src/components/decorative/aurora-backdrop.tsx"],"sourcesContent":["import { type ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { type ButtonSize } from './button';\n\nexport type ButtonGroupVariant = 'primary' | 'neutral' | 'filter';\nexport type ButtonGroupAlign = 'justify' | 'start' | 'end' | 'center' | 'stack';\n\nexport interface ButtonGroupItem {\n value: string;\n label: ReactNode;\n leadingIcon?: ReactNode;\n trailingIcon?: ReactNode;\n disabled?: boolean;\n}\n\nexport interface ButtonGroupProps {\n items: ButtonGroupItem[];\n value: string;\n onChange: (value: string) => void;\n variant?: ButtonGroupVariant;\n size?: ButtonSize;\n align?: ButtonGroupAlign;\n /** Forwarded to the container as aria-label */\n 'aria-label'?: string;\n className?: string;\n}\n\nconst containerStyles: Record<ButtonGroupVariant, string> = {\n primary: 'bg-neutral-tertiary p-1 rounded-2xl',\n neutral: 'bg-neutral-tertiary p-1 rounded-2xl',\n filter: 'bg-default border border-default p-1 rounded-xl',\n};\n\nconst selectedStyles: Record<ButtonGroupVariant, string> = {\n primary: clsx(\n 'bg-brand border border-brand text-brand-on-brand',\n 'hover:bg-brand-hover',\n ),\n neutral: clsx(\n 'bg-default border border-default text-default',\n 'hover:bg-default-hover',\n ),\n filter: clsx(\n 'bg-brand text-brand-on-brand',\n 'hover:bg-brand-hover',\n ),\n};\n\nconst unselectedStyles: Record<ButtonGroupVariant, string> = {\n primary: clsx('bg-transparent text-neutral', 'hover:bg-neutral-tertiary-hover'),\n neutral: clsx('bg-transparent text-neutral', 'hover:bg-neutral-tertiary-hover'),\n filter: clsx('text-default-secondary', 'hover:text-default'),\n};\n\nconst itemSizeStyles: Record<ButtonSize, string> = {\n lg: 'h-12 px-3 gap-1 rounded-2xl text-body font-semibold [&_svg]:size-5',\n md: 'h-9 px-2 gap-0.5 rounded-lg text-body-sm font-semibold [&_svg]:size-5',\n sm: 'h-6 px-1.5 pt-0.5 gap-0 rounded-full text-body-tiny font-semibold [&_svg]:size-4',\n};\n\nconst containerAlignStyles: Record<ButtonGroupAlign, string> = {\n justify: 'flex flex-row items-center',\n start: 'flex flex-row items-center justify-start',\n end: 'flex flex-row items-center justify-end',\n center: 'flex flex-row items-center justify-center',\n stack: 'flex flex-col items-center',\n};\n\nexport function ButtonGroup({\n items,\n value,\n onChange,\n variant = 'primary',\n size = 'md',\n align = 'start',\n className,\n 'aria-label': ariaLabel,\n}: ButtonGroupProps) {\n const isJustify = align === 'justify';\n const isStack = align === 'stack';\n\n return (\n <div\n role=\"group\"\n aria-label={ariaLabel}\n className={clsx(\n containerStyles[variant],\n containerAlignStyles[align],\n className,\n )}\n >\n {items.map((item) => {\n const isSelected = item.value === value;\n return (\n <div\n key={item.value}\n className={clsx(isJustify && 'flex-1 min-w-0', isStack && 'w-full')}\n >\n <button\n type=\"button\"\n aria-pressed={isSelected}\n disabled={item.disabled}\n onClick={() => onChange(item.value)}\n className={clsx(\n 'inline-flex items-center justify-center whitespace-nowrap transition-colors',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1',\n 'disabled:cursor-not-allowed disabled:text-disabled',\n (isJustify || isStack) && 'w-full',\n itemSizeStyles[size],\n isSelected ? selectedStyles[variant] : unselectedStyles[variant],\n )}\n >\n {item.leadingIcon}\n <div className='px-1'>{item.label}</div>\n {item.trailingIcon}\n </button>\n </div>\n );\n })}\n </div>\n );\n}\n","import clsx from 'clsx';\n\nexport type AvatarSize = 'sm' | 'md' | 'lg';\nexport type AvatarShape = 'circle' | 'square';\n\nexport interface AvatarInitialProps {\n type?: 'initial';\n /** Single character — Figma spec: one letter only to avoid overflow */\n initial: string;\n size?: AvatarSize;\n shape?: AvatarShape;\n className?: string;\n}\n\nexport interface AvatarImageProps {\n type: 'image';\n src: string;\n alt?: string;\n size?: AvatarSize;\n shape?: AvatarShape;\n className?: string;\n}\n\nexport type AvatarProps = AvatarInitialProps | AvatarImageProps;\n\n// Figma sizes: lg=40px, md=32px, sm=24px\nconst sizeStyles: Record<AvatarSize, string> = {\n lg: 'size-10',\n md: 'size-8',\n sm: 'size-6',\n};\n\n// Figma text sizes for initials: body-medium at lg, scales down proportionally\nconst initialTextStyles: Record<AvatarSize, string> = {\n lg: 'text-body font-semibold',\n md: 'text-body-xs font-semibold',\n sm: 'text-body-tiny font-semibold',\n};\n\n// Figma shape radii: circle=full, square: lg/md=8px (rounded-lg), sm=4px (rounded)\nfunction getShapeClass(shape: AvatarShape, size: AvatarSize): string {\n if (shape === 'circle') return 'rounded-full';\n return size === 'sm' ? 'rounded' : 'rounded-lg';\n}\n\nexport function Avatar(props: AvatarProps) {\n const { size = 'lg', shape = 'circle', className } = props;\n\n const base = clsx(\n 'shrink-0 overflow-hidden',\n sizeStyles[size],\n getShapeClass(shape, size),\n className,\n );\n\n if (props.type === 'image') {\n return (\n <div className={base}>\n <img\n src={props.src}\n alt={props.alt ?? ''}\n className=\"size-full object-cover\"\n />\n </div>\n );\n }\n\n return (\n <div\n className={clsx(base, 'flex items-center justify-center')}\n style={{\n background:\n 'linear-gradient(135deg, var(--color-graphic-blue) 30%, var(--color-graphic-red) 100%)',\n }}\n >\n <span\n className={clsx(\n 'select-none leading-none text-brand-on-brand',\n initialTextStyles[size],\n )}\n >\n {props.initial.charAt(0).toUpperCase()}\n </span>\n </div>\n );\n}\n","import { type ReactNode } from 'react';\nimport clsx from 'clsx';\n\nexport type AvatarGroupSpacing = 'spaced' | 'overlap';\n\nexport interface AvatarGroupProps {\n children: ReactNode;\n /** Number shown in the overflow badge — omit to hide the badge */\n overflow?: number;\n spacing?: AvatarGroupSpacing;\n className?: string;\n}\n\nexport function AvatarGroup({\n children,\n overflow,\n spacing = 'spaced',\n className,\n}: AvatarGroupProps) {\n return (\n <div\n className={clsx(\n 'flex items-center',\n spacing === 'spaced' ? 'gap-1' : '-space-x-2 isolate',\n className,\n )}\n >\n {children}\n {overflow !== undefined && (\n <div\n className={clsx(\n 'flex items-center justify-center',\n 'min-w-6 h-6 px-1 rounded-lg',\n 'bg-default-secondary text-default-secondary text-body-sm',\n spacing === 'overlap' && 'drop-shadow-sm',\n )}\n >\n +{overflow}\n </div>\n )}\n </div>\n );\n}\n","import clsx from 'clsx';\nimport type { ReactNode } from 'react';\n\nexport interface AvatarBlockProps {\n children: ReactNode;\n title: string;\n description?: string;\n className?: string;\n}\n\nexport function AvatarBlock({ children, title, description, className }: AvatarBlockProps) {\n return (\n <div className={clsx('flex items-start gap-3', className)}>\n <div className=\"shrink-0\">{children}</div>\n <div className=\"flex min-w-0 flex-col gap-0.5\">\n <span className=\"text-body font-semibold text-default-secondary\">\n {title}\n </span>\n {description && (\n <span className=\"text-body text-default-tertiary\">\n {description}\n </span>\n )}\n </div>\n </div>\n );\n}\n","import { forwardRef, type InputHTMLAttributes, type ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { useControlSize } from './control-size';\nimport { useFieldControl } from './field';\n\nexport type InputSize = 'lg' | 'md' | 'sm';\n\nexport interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {\n size?: InputSize;\n /** Red border and `aria-invalid`. Inside a `Field`, a `FieldError` with a message sets this. */\n invalid?: boolean;\n leadingIcon?: ReactNode;\n trailingIcon?: ReactNode;\n /** Interactive trailing slot (e.g. a show/hide password button) — unlike\n * `trailingIcon` it receives pointer events. */\n trailingAction?: ReactNode;\n}\n\n// Figma sizes: lg=48px md=36px sm=24px\nconst inputBase: Record<InputSize, string> = {\n lg: 'h-12 px-5 py-3.5 text-body',\n md: 'h-9 px-4 py-2.5 text-body-sm',\n sm: 'h-6 px-3 py-[5px] text-body-tiny',\n};\n\n// Extra left padding to clear the leading icon\n// lg adds 8px for the explicit flex gap Figma uses on large; md/sm have no gap\nconst leadingPad: Record<InputSize, string> = {\n lg: 'pl-12',\n md: 'pl-8',\n sm: 'pl-6',\n};\n\n// Extra right padding to clear the trailing icon\nconst trailingPad: Record<InputSize, string> = {\n lg: 'pr-12',\n md: 'pr-8',\n sm: 'pr-6',\n};\n\n// Icon wrapper: absolutely positioned inside the input container\nconst iconWrap: Record<InputSize, { left: string; right: string; size: string }> = {\n lg: { left: 'left-4', right: 'right-4', size: 'size-5' },\n md: { left: 'left-3', right: 'right-3', size: 'size-4' },\n sm: { left: 'left-2', right: 'right-2', size: 'size-3' },\n};\n\n/**\n * Focus styling note: `focus-visible:` rather than `focus:`, and `ring-2 ring-brand` to\n * match the button family. Through 0.3.0 this used `focus:ring-1 ring-brand-secondary`,\n * which showed a ring on plain mouse clicks and was a third distinct focus treatment in a\n * library that already had two.\n */\nexport const inputControlClasses = (size: InputSize, invalid: boolean, disabled?: boolean) =>\n clsx(\n 'w-full rounded-lg border outline-none transition-colors',\n 'bg-default text-default',\n 'placeholder:text-default-tertiary',\n 'focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-default',\n inputBase[size],\n disabled\n ? 'cursor-not-allowed bg-disabled border-disabled text-disabled placeholder:text-disabled'\n : invalid\n ? 'border-danger-secondary focus-visible:border-danger focus-visible:ring-danger'\n : 'border-default focus-visible:border-brand focus-visible:ring-brand',\n // read-only is not disabled: the value still matters and is still selectable, but it\n // must not look editable. Nothing in the library styled this before 0.4.0.\n // `enabled:` because a disabled input also matches `:read-only`. Through 0.9.1 that let this\n // lighter fill override `bg-disabled`, so a disabled field looked read-only (0.9.2).\n 'enabled:read-only:bg-default-secondary enabled:read-only:cursor-default',\n );\n\n/**\n * A text input with optional icons. Bare from 0.10.0: it has no label, hint or error of its\n * own. Put it in a `Field` with a `FieldLabel` (and `FieldHint` / `FieldError`), or give it\n * an `aria-label`. `className` sets the layout of the whole control, icons included.\n */\nexport const Input = forwardRef<HTMLInputElement, InputProps>(function Input(\n { size: sizeProp, invalid, leadingIcon, trailingIcon, trailingAction, className, ...props },\n ref,\n) {\n const size = useControlSize(sizeProp);\n const iw = iconWrap[size];\n\n return (\n <div className={clsx('relative flex items-center', className)}>\n {leadingIcon && (\n <span\n aria-hidden\n className={clsx(\n 'pointer-events-none absolute',\n iw.left,\n iw.size,\n 'flex items-center justify-center text-icon-default-secondary',\n )}\n >\n {leadingIcon}\n </span>\n )}\n <InputControl\n ref={ref}\n size={size}\n invalid={invalid}\n className={clsx(leadingIcon && leadingPad[size], (trailingIcon || trailingAction) && trailingPad[size])}\n {...props}\n />\n {trailingIcon && !trailingAction && (\n <span\n aria-hidden\n className={clsx(\n 'pointer-events-none absolute',\n iw.right,\n iw.size,\n 'flex items-center justify-center text-icon-default-secondary',\n )}\n >\n {trailingIcon}\n </span>\n )}\n {trailingAction && (\n <span className={clsx('absolute', iw.right, 'flex items-center justify-center text-icon-default-secondary')}>\n {trailingAction}\n </span>\n )}\n </div>\n );\n});\n\n/**\n * The plain `<input>` element with the field wiring and no icon slots — for `InputGroup` and\n * compositions that place their own adornments. `Input` is built on it.\n */\nexport interface InputControlProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {\n size?: InputSize;\n invalid?: boolean;\n}\n\nexport const InputControl = forwardRef<HTMLInputElement, InputControlProps>(\n function InputControl({ size: sizeProp, invalid = false, className, ...props }, ref) {\n const size = useControlSize(sizeProp);\n const field = useFieldControl();\n const isInvalid = invalid || !!field['aria-invalid'];\n const isDisabled = props.disabled ?? field.disabled;\n\n return (\n <input\n ref={ref}\n // A container's default control size is reported so a test — and a caller reading\n // the DOM — can see which size actually won, rather than inferring it from classes.\n data-size={size}\n // Field wiring first so an explicit prop from the caller still wins.\n {...field}\n // Inside a `Field required`, the native constraint too, so a form post is blocked while empty.\n required={field['aria-required']}\n className={clsx(inputControlClasses(size, isInvalid, isDisabled), className)}\n {...props}\n />\n );\n },\n);\n","import { forwardRef, type TextareaHTMLAttributes } from 'react';\nimport clsx from 'clsx';\nimport { type InputSize } from './input';\nimport { useControlSize } from './control-size';\nimport { useFieldControl } from './field';\n\n// Figma: large textarea inner height ~80px, medium ~68px, small ~52px\nconst textareaBase: Record<InputSize, string> = {\n lg: 'min-h-20 px-4 py-3.5 text-body',\n md: 'min-h-[68px] px-3 py-2.5 text-body-sm',\n sm: 'min-h-[52px] px-2 py-[5px] text-body-tiny',\n};\n\nexport interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {\n size?: InputSize;\n /** Red border and `aria-invalid`. Inside a `Field`, a `FieldError` with a message sets this. */\n invalid?: boolean;\n}\n\n/**\n * A multi-line text input. Bare from 0.10.0: no label, hint or error of its own. Put it in a\n * `Field` with a `FieldLabel` (and `FieldHint` / `FieldError`), or give it an `aria-label`.\n */\nexport const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(\n function Textarea({ size: sizeProp, invalid = false, className, ...props }, ref) {\n const size = useControlSize(sizeProp);\n const field = useFieldControl();\n const isInvalid = invalid || !!field['aria-invalid'];\n const isDisabled = props.disabled ?? field.disabled;\n\n return (\n <textarea\n ref={ref}\n data-size={size}\n {...field}\n // Inside a `Field required`, the native constraint too, so a form post is blocked while empty.\n required={field['aria-required']}\n className={clsx(\n 'w-full resize-y rounded-lg border outline-none transition-colors',\n 'bg-default text-default',\n 'placeholder:text-default-tertiary',\n 'focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-default',\n textareaBase[size],\n isDisabled\n ? 'cursor-not-allowed resize-none border-disabled bg-disabled text-disabled placeholder:text-disabled'\n : isInvalid\n ? 'border-danger-secondary focus-visible:border-danger focus-visible:ring-danger'\n : 'border-default focus-visible:border-brand focus-visible:ring-brand',\n // `enabled:`: a disabled textarea also matches `:read-only` (see Input).\n 'enabled:read-only:cursor-default enabled:read-only:resize-none enabled:read-only:bg-default-secondary',\n className,\n )}\n {...props}\n />\n );\n },\n);\n\n/** @deprecated Since 0.10.0 `Textarea` is the bare control. Use `Textarea`. */\nexport const TextareaControl = Textarea;\n/** @deprecated Since 0.10.0. Use `TextareaProps`. */\nexport type TextareaControlProps = TextareaProps;\n","import {\n forwardRef,\n useState,\n type ChangeEvent,\n type ReactNode,\n type SelectHTMLAttributes,\n} from 'react';\nimport clsx from 'clsx';\nimport { ChevronDownIcon } from 'lucide-react';\n\nimport { devWarn } from '../../lib/dev-warn';\nimport { useControlSize } from './control-size';\nimport { useFieldContext, useFieldControl } from './field';\nimport { type InputSize } from './input';\nimport type { SelectOption, SelectOptionGroup } from './select';\n\n/** The same geometry as `SelectControl`'s trigger, so the two sit side by side unchanged. */\nconst selectBase: Record<InputSize, string> = {\n lg: 'h-12 pl-4 pr-9 text-body',\n md: 'h-9 pl-3 pr-7 text-body-sm',\n sm: 'h-6 pl-2 pr-5 text-body-tiny',\n};\n\nconst chevronPos: Record<InputSize, { right: string; size: string }> = {\n lg: { right: 'right-4', size: 'size-5' },\n md: { right: 'right-3', size: 'size-4' },\n sm: { right: 'right-2', size: 'size-3' },\n};\n\nfunction isGroup(entry: SelectOption | SelectOptionGroup): entry is SelectOptionGroup {\n return 'options' in entry;\n}\n\nfunction renderOptions(options: (SelectOption | SelectOptionGroup)[]) {\n return options.map((entry, index) =>\n isGroup(entry) ? (\n <optgroup key={`group-${index}`} label={entry.label}>\n {entry.options.map((option) => (\n <option key={option.value} value={option.value} disabled={option.disabled}>\n {option.label}\n </option>\n ))}\n </optgroup>\n ) : (\n <option key={entry.value} value={entry.value} disabled={entry.disabled}>\n {entry.label}\n </option>\n ),\n );\n}\n\n// ── NativeSelect ────────────────────────────────────────────────────────\n\nexport interface NativeSelectProps\n extends Omit<SelectHTMLAttributes<HTMLSelectElement>, 'size' | 'children'> {\n /**\n * Flat options, or groups, which render as `<optgroup>`. The same types as `Select`, so\n * moving a field between the two is a rename. Pass `children` instead for hand-written\n * `<option>`s.\n */\n options?: (SelectOption | SelectOptionGroup)[];\n children?: ReactNode;\n size?: InputSize;\n /** Red border and `aria-invalid`. Inside a `Field`, a `FieldError` with a message sets this. */\n invalid?: boolean;\n /**\n * A first, disabled `<option value=\"\">`, shown in the muted placeholder colour while it is\n * the value. An uncontrolled select with a placeholder starts on it; without one the browser\n * would select the first real option, and the field would look filled in when it isn't.\n * With `required`, the empty value blocks submit, as with any native select.\n */\n placeholder?: string;\n}\n\n/**\n * A single-select control on the browser's own `<select>`, styled like `Select`.\n *\n * Use it for form fields, and anywhere on a phone: the OS draws the picker (the iOS wheel, the\n * Android sheet), it is fast with long lists, and it submits and validates as any form control\n * does, `required` included, with `register` in react-hook-form. Use `Select` where the open\n * list has to look like the `DropdownMenu` and `Combobox` panels beside it, e.g. in a filter\n * bar. This mirrors shadcn/ui, which ships `NativeSelect` beside `Select` for the same reason.\n *\n * `onChange` is the native event (`event.target.value`), not `onValueChange`. The trade is\n * the one every native select makes: the open list can't be styled.\n *\n * Bare from 0.10.0: no label, hint or error of its own. Put it in a `Field` with a\n * `FieldLabel`, or give it an `aria-label`.\n */\nexport const NativeSelect = forwardRef<HTMLSelectElement, NativeSelectProps>(\n function NativeSelect(\n {\n options,\n children,\n size: sizeProp,\n invalid = false,\n placeholder,\n value,\n defaultValue,\n onChange,\n className,\n ...props\n },\n ref,\n ) {\n const size = useControlSize(sizeProp);\n const field = useFieldControl();\n const fieldContext = useFieldContext();\n\n // Starting an uncontrolled select on the placeholder: see the `placeholder` prop.\n const initial = defaultValue ?? (placeholder !== undefined && value === undefined ? '' : undefined);\n // Tracked only to colour the placeholder. The DOM still owns an uncontrolled value.\n const [uncontrolled, setUncontrolled] = useState(initial);\n const current = value ?? uncontrolled;\n const showingPlaceholder = placeholder !== undefined && (current === '' || current === undefined);\n\n const isInvalid = invalid || !!field['aria-invalid'];\n const isDisabled = props.disabled ?? field.disabled;\n\n if (!fieldContext && !props['aria-label'] && !props['aria-labelledby'] && !props.id) {\n devWarn(\n 'NativeSelect outside a Field needs aria-label, aria-labelledby, or an id a <label> points at.',\n );\n }\n\n const handleChange = (event: ChangeEvent<HTMLSelectElement>) => {\n if (value === undefined) setUncontrolled(event.target.value);\n onChange?.(event);\n };\n\n const cp = chevronPos[size];\n\n return (\n <div className=\"relative flex items-center\">\n <select\n ref={ref}\n data-size={size}\n data-placeholder={showingPlaceholder || undefined}\n {...field}\n // Inside a `Field required`, the native constraint too, so a form post is blocked while empty.\n required={field['aria-required']}\n value={value}\n defaultValue={value === undefined ? initial : undefined}\n onChange={handleChange}\n className={clsx(\n 'w-full appearance-none rounded-lg border outline-none transition-colors',\n 'bg-default text-default data-[placeholder]:text-default-tertiary',\n 'focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-default',\n selectBase[size],\n isDisabled\n ? 'cursor-not-allowed border-disabled bg-disabled text-disabled'\n : isInvalid\n ? 'border-danger-secondary focus-visible:border-danger focus-visible:ring-danger'\n : 'border-default focus-visible:border-brand focus-visible:ring-brand',\n className,\n )}\n {...props}\n disabled={isDisabled}\n aria-invalid={isInvalid || undefined}\n >\n {placeholder !== undefined && (\n <option value=\"\" disabled>\n {placeholder}\n </option>\n )}\n {options ? renderOptions(options) : children}\n </select>\n <span\n aria-hidden\n className={clsx(\n 'pointer-events-none absolute',\n cp.right,\n cp.size,\n 'flex items-center justify-center',\n isDisabled ? 'text-icon-disabled' : 'text-icon-default-secondary',\n )}\n >\n <ChevronDownIcon className=\"size-full\" />\n </span>\n </div>\n );\n },\n);\n\n/** @deprecated Since 0.10.0 `NativeSelect` is the bare control. Use `NativeSelect`. */\nexport const NativeSelectControl = NativeSelect;\n/** @deprecated Since 0.10.0. Use `NativeSelectProps`. */\nexport type NativeSelectControlProps = NativeSelectProps;\n","import {\n forwardRef,\n useId,\n useMemo,\n useRef,\n useState,\n type ChangeEventHandler,\n type FocusEventHandler,\n type InputHTMLAttributes,\n} from 'react';\nimport clsx from 'clsx';\nimport { CalendarIcon } from 'lucide-react';\nimport { composeRefs } from '../../lib/slot';\nimport { Popover, PopoverContent, PopoverTrigger } from '../overlays/popover';\nimport { Calendar } from './calendar';\nimport { type InputSize } from './input';\nimport { useControlSize } from './control-size';\nimport { useFieldContext, useFieldControl } from './field';\n\nexport interface DatePickerProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'value' | 'defaultValue'> {\n size?: InputSize;\n /** Red border and `aria-invalid`. Inside a `Field`, a `FieldError` with a message sets this. */\n invalid?: boolean;\n /** The selected date as an ISO `YYYY-MM-DD` string, `''` for none. Controlled. */\n value?: string;\n /** Initial ISO date when uncontrolled. */\n defaultValue?: string;\n /**\n * Called with a real change event from the underlying date input, so\n * `onChange={(e) => set(e.target.value)}` keeps working; `e.target.value` is the ISO date.\n */\n onChange?: ChangeEventHandler<HTMLInputElement>;\n /** The new ISO date. New in 0.7.1; an alternative to reading `onChange`'s event. */\n onValueChange?: (value: string) => void;\n /** Shown when there is no date. Default \"Pick a date\". */\n placeholder?: string;\n /** BCP 47 tag for the shown date and the calendar. Default: the browser's. */\n locale?: string;\n /** 0 = Sunday, 1 = Monday. Default `1`. */\n weekStartsOn?: 0 | 1;\n /** `dropdown` (default) puts month and year selects in the calendar header. */\n captionLayout?: 'label' | 'dropdown';\n /** First year in the year select. Default `min`'s year, else 100 years ago. */\n startYear?: number;\n /** Last year in the year select. Default `max`'s year, else 10 years ahead. */\n endYear?: number;\n}\n\nconst triggerBase: Record<InputSize, string> = {\n lg: 'h-12 px-5 pr-12 text-body',\n md: 'h-9 px-4 pr-8 text-body-sm',\n sm: 'h-6 px-3 pr-6 text-body-tiny',\n};\n\nconst iconWrap: Record<InputSize, { right: string; size: string }> = {\n lg: { right: 'right-4', size: 'size-5' },\n md: { right: 'right-3', size: 'size-4' },\n sm: { right: 'right-2', size: 'size-3' },\n};\n\nconst ISO = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\n\nfunction parseIso(value: string | undefined): Date | null {\n const match = value ? ISO.exec(value) : null;\n if (!match) return null;\n const date = new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n return Number.isNaN(date.getTime()) ? null : date;\n}\n\nfunction toIso(date: Date): string {\n const pad = (n: number) => String(n).padStart(2, '0');\n return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;\n}\n\n/**\n * A date field that opens the library's `Calendar` in a `Popover`, the shape of shadcn/ui's\n * Date Picker. Rebuilt in 0.7.1: through 0.7.0 it was a native `<input type=\"date\">`, whose\n * picker is the browser's own and differs in Chromium, Firefox and Safari (Firefox draws its\n * own button inside the field and cannot be restyled), so it never matched `Calendar`.\n *\n * - The trigger is a `role=\"combobox\"` button with `aria-haspopup=\"dialog\"`, named by the label\n * and then the date (\"Start date 22 Oct 2026\"); unlike a plain button, that role carries the\n * `aria-required` and `aria-invalid` that `Field` supplies.\n * - Opening moves focus into the calendar grid, on the selected date or today. Picking a date\n * closes the popover and returns focus to the trigger; Escape closes it without a change.\n * - The month and year selects (`captionLayout=\"dropdown\"`, the default) reach a far-away date\n * in two choices instead of a PageUp per month.\n * - Bare from 0.10.0: no label, hint or error of its own. Put it in a `Field` with a\n * `FieldLabel`, or give it an `aria-label`. The calendar dialog takes its name from either.\n * - A real, invisible `<input type=\"date\">` keeps the old contract: it carries `name`, `value`,\n * `min`, `max` and `required` for forms and native validation, the forwarded ref points at\n * it, and `onChange` receives its genuine change event. When validation focuses it, focus is\n * handed to the trigger.\n */\nexport const DatePicker = forwardRef<HTMLInputElement, DatePickerProps>(function DatePicker(\n {\n size: sizeProp,\n invalid = false,\n className,\n disabled,\n required,\n value: valueProp,\n defaultValue,\n onChange,\n onValueChange,\n onBlur,\n placeholder = 'Pick a date',\n locale,\n weekStartsOn,\n captionLayout = 'dropdown',\n startYear,\n endYear,\n min,\n max,\n 'aria-label': ariaLabel,\n ...props\n },\n ref,\n) {\n const size = useControlSize(sizeProp);\n\n return (\n <DateControl\n ref={ref}\n size={size}\n invalid={invalid}\n disabled={disabled}\n required={required}\n value={valueProp}\n defaultValue={defaultValue}\n onChange={onChange}\n onValueChange={onValueChange}\n onBlur={onBlur}\n placeholder={placeholder}\n locale={locale}\n weekStartsOn={weekStartsOn}\n captionLayout={captionLayout}\n startYear={startYear}\n endYear={endYear}\n min={typeof min === 'number' ? String(min) : min}\n max={typeof max === 'number' ? String(max) : max}\n label={ariaLabel}\n className={className}\n inputProps={props}\n />\n );\n});\n\ninterface DateControlProps {\n size: InputSize;\n invalid: boolean;\n disabled?: boolean;\n required?: boolean;\n value?: string;\n defaultValue?: string;\n onChange?: ChangeEventHandler<HTMLInputElement>;\n onValueChange?: (value: string) => void;\n onBlur?: FocusEventHandler<HTMLInputElement>;\n placeholder: string;\n locale?: string;\n weekStartsOn?: 0 | 1;\n captionLayout: 'label' | 'dropdown';\n startYear?: number;\n endYear?: number;\n min?: string;\n max?: string;\n /** The `aria-label`, when there is no `FieldLabel`. */\n label?: string;\n className?: string;\n inputProps: Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'value' | 'defaultValue'>;\n}\n\nconst DateControl = forwardRef<HTMLInputElement, DateControlProps>(function DateControl(\n {\n size,\n invalid,\n disabled,\n required,\n value,\n defaultValue,\n onChange,\n onValueChange,\n onBlur,\n placeholder,\n locale,\n weekStartsOn,\n captionLayout,\n startYear,\n endYear,\n min,\n max,\n label: ariaLabel,\n className,\n inputProps: { name, ...inputProps },\n },\n ref,\n) {\n const field = useFieldControl();\n const fieldContext = useFieldContext();\n const valueId = useId();\n const dialogId = useId();\n const [open, setOpen] = useState(false);\n const [internal, setInternal] = useState(defaultValue ?? '');\n const iso = value ?? internal;\n const date = parseIso(iso);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n\n const isInvalid = invalid || !!field['aria-invalid'];\n const isDisabled = disabled ?? field.disabled;\n const isRequired = required || !!field['aria-required'];\n // The calendar dialog is named after the field: the FieldLabel's text, else the aria-label.\n // Read when it opens, since the label is a sibling this control can't see as a prop.\n const [label, setLabel] = useState<string | undefined>(ariaLabel);\n const handleOpenChange = (next: boolean) => {\n if (next) {\n const labelText = fieldContext && typeof document !== 'undefined' ? document.getElementById(fieldContext.labelId)?.textContent : null;\n setLabel(labelText?.trim() || ariaLabel);\n }\n setOpen(next);\n };\n const iw = iconWrap[size];\n const formatter = useMemo(() => new Intl.DateTimeFormat(locale, { dateStyle: 'medium' }), [locale]);\n\n const commit = (next: Date) => {\n const nextIso = toIso(next);\n if (value === undefined) setInternal(nextIso);\n onValueChange?.(nextIso);\n // Set the real input's value the way the browser would and let React see the event, so\n // `onChange` gets a genuine ChangeEvent. Assigning `.value` directly would be swallowed by\n // React's value tracker.\n const input = inputRef.current;\n if (input) {\n Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')?.set?.call(input, nextIso);\n input.dispatchEvent(new Event('input', { bubbles: true }));\n }\n setOpen(false);\n };\n\n return (\n <div className={clsx('relative flex items-center', className)}>\n <Popover open={open} onOpenChange={handleOpenChange}>\n <PopoverTrigger asChild>\n <button\n ref={triggerRef}\n type=\"button\"\n // `role=\"combobox\"` with a dialog popup (APG date-picker combobox). A plain button\n // may not carry aria-required / aria-invalid, which Field supplies.\n role=\"combobox\"\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n // Only while open, so it never points at an element that does not exist.\n aria-controls={open ? dialogId : undefined}\n // Named by the label, then the value: \"Start date 22 Oct 2026\". A <label for> does\n // not name a button the way it named the old <input>.\n aria-labelledby={fieldContext ? `${fieldContext.labelId} ${valueId}` : undefined}\n aria-label={fieldContext ? undefined : ariaLabel}\n data-size={size}\n {...field}\n aria-invalid={isInvalid || undefined}\n aria-required={isRequired || undefined}\n disabled={isDisabled}\n onBlur={onBlur as unknown as FocusEventHandler<HTMLButtonElement>}\n className={clsx(\n 'w-full appearance-none rounded-lg border text-left outline-none transition-colors',\n 'bg-default text-default',\n 'focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-default',\n triggerBase[size],\n isDisabled\n ? 'cursor-not-allowed border-disabled bg-disabled text-disabled'\n : isInvalid\n ? 'border-danger-secondary focus-visible:border-danger focus-visible:ring-danger'\n : 'border-default focus-visible:border-brand focus-visible:ring-brand',\n )}\n >\n <span id={valueId} className={clsx('block truncate', !date && 'text-default-tertiary')}>\n {date ? formatter.format(date) : placeholder}\n </span>\n </button>\n </PopoverTrigger>\n <PopoverContent\n ref={contentRef}\n id={dialogId}\n label={label ? `Choose ${label.toLowerCase()}` : 'Choose date'}\n align=\"start\"\n className=\"w-auto max-w-none p-0\"\n onOpenAutoFocus={(event) => {\n // Land on the grid's roving cell (the selected date, else today), not on the first\n // focusable element, which would be the month select.\n event.preventDefault();\n contentRef.current?.querySelector<HTMLElement>('[role=\"grid\"] [tabindex=\"0\"]')?.focus();\n }}\n >\n <Calendar\n value={date}\n onSelect={commit}\n min={parseIso(min) ?? undefined}\n max={parseIso(max) ?? undefined}\n locale={locale}\n weekStartsOn={weekStartsOn}\n captionLayout={captionLayout}\n startYear={startYear}\n endYear={endYear}\n label={label ?? 'Calendar'}\n className=\"border-0\"\n />\n </PopoverContent>\n </Popover>\n\n <span\n aria-hidden\n className={clsx(\n 'pointer-events-none absolute',\n iw.right,\n iw.size,\n 'flex items-center justify-center',\n isDisabled ? 'text-icon-disabled' : 'text-icon-default-secondary',\n )}\n >\n <CalendarIcon className=\"size-full\" />\n </span>\n\n {/* The old contract, kept: a real date input for forms, native `required`/`min`/`max`\n validation, the forwarded ref and `onChange`. Invisible, out of the tab order and\n hidden from assistive tech, which hears the trigger instead. */}\n <input\n ref={composeRefs(ref, inputRef)}\n type=\"date\"\n aria-hidden\n tabIndex={-1}\n {...inputProps}\n name={name}\n value={iso}\n min={min}\n max={max}\n required={isRequired}\n disabled={isDisabled}\n onChange={(event) => {\n if (value === undefined) setInternal(event.target.value);\n onChange?.(event);\n }}\n onFocus={() => triggerRef.current?.focus()}\n className=\"pointer-events-none absolute inset-x-0 bottom-0 h-px w-full opacity-0\"\n />\n </div>\n );\n});\n","import {\n createContext,\n forwardRef,\n useContext,\n useId,\n useMemo,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from 'react';\nimport { Popover as PopoverPrimitive } from 'radix-ui';\n\nimport { cn } from '../../lib/cn';\nimport { composeRefs } from '../../lib/slot';\nimport type { FloatingAlign, FloatingSide } from './floating';\nimport { deferEscapeToInnerPopup } from './overlay-stack';\nimport { usePortalContainer } from './portal';\n\n/** Shares the trigger's element, so the panel can be labelled by whatever id it really has. */\nconst PopoverTriggerNode = createContext<{\n node: HTMLElement | null;\n setNode: (node: HTMLElement | null) => void;\n modal: boolean;\n} | null>(null);\n\nexport interface PopoverProps {\n children: ReactNode;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n /**\n * Trap focus, lock scroll and hide the rest of the page from assistive tech. Default\n * `false`.\n *\n * A popover is normally non-modal: the page behind stays usable, and Tab moves out of the\n * panel and on through the document. Set `modal` when the panel is a small form whose\n * background must not be touched until it is dismissed.\n */\n modal?: boolean;\n}\n\n/**\n * A floating panel anchored to a trigger, for **interactive** content.\n *\n * The distinction from `Tooltip` is not visual and it matters: a tooltip cannot be hovered\n * into or focused, so anything interactive inside one is unreachable. If the panel holds a\n * link, a button or a field, it has to be a popover — which means a real trigger with\n * `aria-expanded`/`aria-controls`, focus moving into the panel on open, and focus returning\n * to the trigger on close.\n *\n * Built on Radix Popover from 0.7.0. Escape and outside press act on the topmost layer only,\n * so a popover inside a `Modal` closes without taking the modal with it, and focus leaving a\n * non-modal panel dismisses it rather than stranding it open.\n */\nexport function Popover({ children, open, defaultOpen, onOpenChange, modal = false }: PopoverProps) {\n const [node, setNode] = useState<HTMLElement | null>(null);\n const trigger = useMemo(() => ({ node, setNode, modal }), [node, modal]);\n\n return (\n <PopoverPrimitive.Root\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n modal={modal}\n >\n <PopoverTriggerNode.Provider value={trigger}>{children}</PopoverTriggerNode.Provider>\n </PopoverPrimitive.Root>\n );\n}\n\nexport interface PopoverTriggerProps extends HTMLAttributes<HTMLButtonElement> {\n children: ReactNode;\n /** Render onto the single child (e.g. a `Button`) instead of a bare `<button>`. */\n asChild?: boolean;\n}\n\n/**\n * Toggles the popover. Radix sets `aria-haspopup=\"dialog\"`, `aria-expanded`,\n * `aria-controls` and `data-state`, and composes your handlers with its own rather than\n * replacing them (0.6's `onClick` overrode the toggle).\n */\nexport const PopoverTrigger = forwardRef<HTMLButtonElement, PopoverTriggerProps>(\n function PopoverTrigger(props, ref) {\n const trigger = useContext(PopoverTriggerNode);\n const fallbackId = useId();\n return (\n <PopoverPrimitive.Trigger\n ref={composeRefs(ref, trigger?.setNode)}\n // An id to label the panel by. An `asChild` child's own `id` wins, and the panel\n // reads the real one off the node, so either way the reference resolves.\n id={props.id ?? fallbackId}\n {...props}\n />\n );\n },\n);\n\nexport interface PopoverContentProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n side?: FloatingSide;\n align?: FloatingAlign;\n sideOffset?: number;\n /** Accessible name for the panel. Falls back to being labelled by the trigger. */\n label?: string;\n /** Where to portal the panel. Defaults to the enclosing dialog, else `document.body`. */\n container?: HTMLElement | null;\n /** Radix's open auto-focus hook: `preventDefault()` and focus something else, e.g. a calendar's selected day. */\n onOpenAutoFocus?: (event: Event) => void;\n}\n\nexport const PopoverContent = forwardRef<HTMLDivElement, PopoverContentProps>(\n function PopoverContent(\n { children, side = 'bottom', align = 'center', sideOffset = 8, label, container, className, onOpenAutoFocus, ...rest },\n ref,\n ) {\n const trigger = useContext(PopoverTriggerNode);\n const inherited = usePortalContainer();\n\n return (\n <PopoverPrimitive.Portal container={container ?? inherited ?? undefined}>\n <PopoverPrimitive.Content\n ref={ref}\n side={side}\n align={align}\n sideOffset={sideOffset}\n collisionPadding={8}\n onOpenAutoFocus={onOpenAutoFocus}\n onEscapeKeyDown={(event) => void deferEscapeToInnerPopup(event)}\n // Radix traps focus and hides the page for a modal popover but does not say so.\n aria-modal={trigger?.modal || undefined}\n aria-label={label}\n aria-labelledby={label ? undefined : trigger?.node?.id || undefined}\n className={cn(\n 'z-popover max-w-[min(22rem,calc(100vw-2rem))] rounded-xl border border-default bg-default p-4 shadow-400',\n 'focus:outline-none',\n className,\n )}\n {...rest}\n >\n {children}\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n );\n },\n);\n\n/** Closes the enclosing popover, e.g. an \"Apply\" or \"Cancel\" button. New in 0.7.0. */\nexport const PopoverClose = forwardRef<HTMLButtonElement, HTMLAttributes<HTMLButtonElement> & { asChild?: boolean }>(\n function PopoverClose(props, ref) {\n return <PopoverPrimitive.Close ref={ref} {...props} />;\n },\n);\n\n/** Positions the panel against an element other than the trigger. New in 0.7.0. */\nexport const PopoverAnchor = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement> & { asChild?: boolean }>(\n function PopoverAnchor(props, ref) {\n return <PopoverPrimitive.Anchor ref={ref} {...props} />;\n },\n);\n","import {\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n} from 'react';\nimport clsx from 'clsx';\nimport { cn } from '../../lib/cn';\nimport { ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';\nimport { IconButton } from './icon-button';\n\nexport type CalendarMode = 'single' | 'range';\n\nexport interface DateRange {\n from: Date | null;\n to: Date | null;\n}\n\nexport interface CalendarProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onSelect'> {\n mode?: CalendarMode;\n /** Selected date in `single` mode. */\n value?: Date | null;\n /** Selected range in `range` mode. */\n range?: DateRange;\n onSelect?: (value: Date) => void;\n onRangeChange?: (range: DateRange) => void;\n /** Month shown on mount. Defaults to the selection's month, else today. */\n defaultMonth?: Date;\n min?: Date;\n max?: Date;\n /** Return `true` to disable a day. Combined with `min`/`max`. */\n isDateDisabled?: (date: Date) => boolean;\n /** 0 = Sunday, 1 = Monday. Default `1`. */\n weekStartsOn?: 0 | 1;\n /** BCP 47 tag for month, weekday and announced day names. Default: the browser's. */\n locale?: string;\n /** Names the grid. Default `Calendar`. */\n label?: string;\n /**\n * `label` (default) shows the month as text between the arrows. `dropdown` replaces it with\n * month and year selects, for dates far from today (a date of birth, a start date years ago),\n * which would otherwise take a dozen PageUp presses a year to reach. Same name and behaviour\n * as shadcn/react-day-picker's `captionLayout=\"dropdown\"`. New in 0.7.1.\n */\n captionLayout?: 'label' | 'dropdown';\n /** First year in the year select. Default `min`'s year, else 100 years ago. */\n startYear?: number;\n /** Last year in the year select. Default `max`'s year, else 10 years ahead. */\n endYear?: number;\n}\n\nconst CAPTION_SELECT = clsx(\n 'h-7 appearance-none rounded-md border border-default bg-default px-2 text-body-xs font-medium text-default',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default',\n);\n\n// ── Date helpers ───────────────────────────────────────────────────────────────\n// Deliberately no date library. Everything below is calendar-grid arithmetic on local\n// dates, which is a few dozen lines; pulling in date-fns for it would be the largest\n// dependency in the package.\n\nconst startOfDay = (d: Date) => new Date(d.getFullYear(), d.getMonth(), d.getDate());\nconst sameDay = (a: Date | null | undefined, b: Date | null | undefined) =>\n !!a && !!b && a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();\nconst addDays = (d: Date, n: number) => new Date(d.getFullYear(), d.getMonth(), d.getDate() + n);\nconst addMonths = (d: Date, n: number) => new Date(d.getFullYear(), d.getMonth() + n, 1);\nconst isBefore = (a: Date, b: Date) => startOfDay(a).getTime() < startOfDay(b).getTime();\nconst isAfter = (a: Date, b: Date) => startOfDay(a).getTime() > startOfDay(b).getTime();\nconst inRange = (d: Date, from: Date, to: Date) =>\n startOfDay(d).getTime() > startOfDay(from).getTime() &&\n startOfDay(d).getTime() < startOfDay(to).getTime();\n\n/** Six weeks of cells so the grid never changes height as the month changes. */\nfunction monthGrid(month: Date, weekStartsOn: 0 | 1): Date[] {\n const first = new Date(month.getFullYear(), month.getMonth(), 1);\n const offset = (first.getDay() - weekStartsOn + 7) % 7;\n const start = addDays(first, -offset);\n return Array.from({ length: 42 }, (_, i) => addDays(start, i));\n}\n\n/**\n * Month grid. Matches Figma's `Calendar`, `Calendar Button`\n * (`State: Default | Hover | Active | Disabled | Range | Range Disabled | Hidden`),\n * `Calendar Select Group` and `Calendar Month/Year Field`.\n *\n * The code had no calendar at all — `DatePicker` was a bare `<input type=\"date\">` with\n * Chromium-only indicator styling, so there was nothing to build a range picker on, no\n * locale control and no min/max navigation.\n *\n * The keyboard model is the APG date-grid pattern, and it is the whole reason this is not\n * just a table of buttons:\n *\n * - **One tab stop.** Tab enters the grid once and leaves it; arrows move within. A grid of\n * 42 individually tabbable buttons takes 42 presses to get past.\n * - **Arrows cross month boundaries.** Pressing Left on the 1st moves to the previous\n * month's last day and pages the view, rather than dead-ending.\n * - **PageUp/PageDown** move by month, **Shift+PageUp/PageDown** by year, **Home/End** to the\n * start/end of the week.\n * - Each day's accessible name is the full date, not the number — \"14\" tells a screen\n * reader user nothing.\n */\nexport function Calendar({\n mode = 'single',\n value,\n range,\n onSelect,\n onRangeChange,\n defaultMonth,\n min,\n max,\n isDateDisabled,\n weekStartsOn = 1,\n locale,\n label = 'Calendar',\n captionLayout = 'label',\n startYear,\n endYear,\n className,\n ...rest\n}: CalendarProps) {\n const today = useMemo(() => startOfDay(new Date()), []);\n const gridId = useId();\n\n const [month, setMonth] = useState<Date>(\n () => defaultMonth ?? value ?? range?.from ?? today,\n );\n // The focused cell, which is what the roving tabindex follows. Distinct from the\n // selection: you can arrow around without selecting.\n const [focusedDate, setFocusedDate] = useState<Date>(\n () => value ?? range?.from ?? today,\n );\n const cellRefs = useRef(new Map<string, HTMLButtonElement>());\n\n const monthFormatter = useMemo(\n () => new Intl.DateTimeFormat(locale, { month: 'long', year: 'numeric' }),\n [locale],\n );\n const dayNameFormatter = useMemo(\n () => new Intl.DateTimeFormat(locale, { weekday: 'short' }),\n [locale],\n );\n const monthNameFormatter = useMemo(\n () => new Intl.DateTimeFormat(locale, { month: 'long' }),\n [locale],\n );\n const fullDateFormatter = useMemo(\n () => new Intl.DateTimeFormat(locale, { weekday: 'long', day: 'numeric', month: 'long', year: 'numeric' }),\n [locale],\n );\n\n const disabled = useCallback(\n (date: Date) => {\n if (min && isBefore(date, min)) return true;\n if (max && isAfter(date, max)) return true;\n return isDateDisabled?.(date) ?? false;\n },\n [min, max, isDateDisabled],\n );\n\n const key = (d: Date) => `${d.getFullYear()}-${d.getMonth()}-${d.getDate()}`;\n\n // Set by keyboard moves only. Focus must not be stolen on mount, or when a click has\n // already put focus on the cell the user pressed.\n const pendingFocus = useRef(false);\n\n const focusDate = useCallback((date: Date) => {\n pendingFocus.current = true;\n setFocusedDate(date);\n // A move across the month boundary pages the view; the target cell does not exist\n // until after that commit, which is why focus is applied in the effect below rather\n // than here.\n setMonth((current) =>\n current.getFullYear() === date.getFullYear() && current.getMonth() === date.getMonth()\n ? current\n : new Date(date.getFullYear(), date.getMonth(), 1),\n );\n }, []);\n\n useEffect(() => {\n if (!pendingFocus.current) return;\n const node = cellRefs.current.get(key(focusedDate));\n if (node) {\n node.focus();\n pendingFocus.current = false;\n }\n // If the node is still absent the month is mid-change; the next commit re-runs this.\n }, [focusedDate, month]);\n\n const select = (date: Date) => {\n if (disabled(date)) return;\n setFocusedDate(date);\n\n if (mode === 'single') {\n onSelect?.(date);\n return;\n }\n\n const current = range ?? { from: null, to: null };\n // Anchor a new range when there is none, when one is already complete, or when the\n // click lands before the anchor — the last case is what makes dragging backwards work\n // instead of producing an inverted range.\n if (!current.from || current.to || isBefore(date, current.from)) {\n onRangeChange?.({ from: date, to: null });\n } else {\n onRangeChange?.({ from: current.from, to: date });\n }\n };\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const moves: Record<string, () => Date> = {\n ArrowLeft: () => addDays(focusedDate, -1),\n ArrowRight: () => addDays(focusedDate, 1),\n ArrowUp: () => addDays(focusedDate, -7),\n ArrowDown: () => addDays(focusedDate, 7),\n Home: () => addDays(focusedDate, -((focusedDate.getDay() - weekStartsOn + 7) % 7)),\n End: () => addDays(focusedDate, 6 - ((focusedDate.getDay() - weekStartsOn + 7) % 7)),\n // Shift moves a year (APG date-picker dialog); without it, a month.\n PageUp: () => new Date(focusedDate.getFullYear() - (event.shiftKey ? 1 : 0), focusedDate.getMonth() - (event.shiftKey ? 0 : 1), focusedDate.getDate()),\n PageDown: () => new Date(focusedDate.getFullYear() + (event.shiftKey ? 1 : 0), focusedDate.getMonth() + (event.shiftKey ? 0 : 1), focusedDate.getDate()),\n };\n\n const move = moves[event.key];\n if (move) {\n event.preventDefault();\n focusDate(move());\n }\n };\n\n const firstYear = startYear ?? min?.getFullYear() ?? today.getFullYear() - 100;\n const lastYear = endYear ?? max?.getFullYear() ?? today.getFullYear() + 10;\n const years = Array.from({ length: Math.max(0, lastYear - firstYear) + 1 }, (_, i) => firstYear + i);\n const monthOutOfRange = (m: number) =>\n (!!min && (month.getFullYear() < min.getFullYear() || (month.getFullYear() === min.getFullYear() && m < min.getMonth()))) ||\n (!!max && (month.getFullYear() > max.getFullYear() || (month.getFullYear() === max.getFullYear() && m > max.getMonth())));\n const showMonth = (year: number, m: number) => {\n let next = new Date(year, m, 1);\n if (min && next < new Date(min.getFullYear(), min.getMonth(), 1)) next = new Date(min.getFullYear(), min.getMonth(), 1);\n if (max && next > new Date(max.getFullYear(), max.getMonth(), 1)) next = new Date(max.getFullYear(), max.getMonth(), 1);\n setMonth(next);\n // Keep the roving cell inside the shown month, so Tab into the grid lands on it.\n const day = Math.min(focusedDate.getDate(), new Date(next.getFullYear(), next.getMonth() + 1, 0).getDate());\n setFocusedDate(new Date(next.getFullYear(), next.getMonth(), day));\n };\n\n const days = monthGrid(month, weekStartsOn);\n const weekdayNames = days.slice(0, 7).map((d) => dayNameFormatter.format(d));\n\n return (\n <div\n data-slot=\"calendar\"\n className={cn('w-fit rounded-xl border border-default bg-default p-3', className)}\n {...rest}\n >\n <div className=\"mb-2 flex items-center justify-between gap-2\">\n <IconButton\n variant=\"subtle\"\n size=\"sm\"\n aria-label=\"Previous month\"\n disabled={!!min && isBefore(addMonths(month, -1), new Date(min.getFullYear(), min.getMonth(), 1))}\n onClick={() => setMonth(addMonths(month, -1))}\n >\n <ChevronLeftIcon aria-hidden size={16} />\n </IconButton>\n {/* aria-live so paging the month is announced — otherwise a screen reader user\n arrowing past the end of a month has no idea the view moved. */}\n {captionLayout === 'dropdown' ? (\n <div className=\"relative flex items-center gap-1.5\">\n {/* Native selects: one tab stop each, the platform's own list on touch devices,\n and every option already announced. */}\n <select\n aria-label=\"Month\"\n value={month.getMonth()}\n onChange={(event) => showMonth(month.getFullYear(), Number(event.target.value))}\n className={CAPTION_SELECT}\n >\n {Array.from({ length: 12 }, (_, m) => (\n <option key={m} value={m} disabled={monthOutOfRange(m)}>\n {monthNameFormatter.format(new Date(2000, m, 1))}\n </option>\n ))}\n </select>\n <select\n aria-label=\"Year\"\n value={month.getFullYear()}\n onChange={(event) => showMonth(Number(event.target.value), month.getMonth())}\n className={CAPTION_SELECT}\n >\n {years.map((year) => (\n <option key={year} value={year}>\n {year}\n </option>\n ))}\n </select>\n <span aria-live=\"polite\" className=\"sr-only\">\n {monthFormatter.format(month)}\n </span>\n </div>\n ) : (\n <span aria-live=\"polite\" className=\"text-body-sm font-semibold text-default\">\n {monthFormatter.format(month)}\n </span>\n )}\n <IconButton\n variant=\"subtle\"\n size=\"sm\"\n aria-label=\"Next month\"\n disabled={!!max && isAfter(addMonths(month, 1), new Date(max.getFullYear(), max.getMonth(), 1))}\n onClick={() => setMonth(addMonths(month, 1))}\n >\n <ChevronRightIcon aria-hidden size={16} />\n </IconButton>\n </div>\n\n {/* role=\"grid\" with an explicit row/cell structure, so a screen reader announces\n \"column 3, row 2\" and the day headers are tied to the columns. */}\n <div\n role=\"grid\"\n aria-label={label}\n id={gridId}\n // Programmatically focusable but out of the tab sequence: the roving day buttons\n // own the tab stop, and key handling is delegated here so it keeps working while\n // focus moves between cells.\n tabIndex={-1}\n onKeyDown={onKeyDown}\n >\n <div role=\"row\" className=\"mb-1 grid grid-cols-7\">\n {weekdayNames.map((name) => (\n <div\n key={name}\n role=\"columnheader\"\n // The short form is shown; the long form is not needed because each cell\n // announces its own full date.\n className=\"flex h-8 items-center justify-center text-body-tiny font-medium text-default-tertiary\"\n >\n {name}\n </div>\n ))}\n </div>\n\n {Array.from({ length: 6 }, (_, week) => (\n <div key={week} role=\"row\" className=\"grid grid-cols-7\">\n {days.slice(week * 7, week * 7 + 7).map((date) => {\n const outside = date.getMonth() !== month.getMonth();\n const isDisabled = disabled(date);\n const selected =\n mode === 'single'\n ? sameDay(date, value)\n : sameDay(date, range?.from) || sameDay(date, range?.to);\n const between =\n mode === 'range' && range?.from && range?.to\n ? inRange(date, range.from, range.to)\n : false;\n const isFocused = sameDay(date, focusedDate);\n\n return (\n <div role=\"gridcell\" key={key(date)} aria-selected={selected || undefined}>\n <button\n ref={(node) => {\n if (node) cellRefs.current.set(key(date), node);\n else cellRefs.current.delete(key(date));\n }}\n type=\"button\"\n // The roving tab stop: exactly one cell is reachable by Tab.\n tabIndex={isFocused ? 0 : -1}\n disabled={isDisabled}\n aria-label={fullDateFormatter.format(date)}\n aria-current={sameDay(date, today) ? 'date' : undefined}\n onClick={() => select(date)}\n onFocus={() => setFocusedDate(date)}\n className={clsx(\n 'flex size-9 items-center justify-center rounded-lg text-body-sm tabular-nums transition-colors',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default',\n 'disabled:cursor-not-allowed disabled:text-disabled disabled:hover:bg-transparent',\n selected\n ? 'bg-brand font-semibold text-brand-on-brand'\n : between\n ? 'rounded-none bg-brand-tertiary text-default'\n : outside\n ? 'text-default-tertiary hover:bg-default-secondary'\n : 'text-default hover:bg-default-secondary',\n // Today is marked by a ring rather than a fill, so it stays legible\n // when it is also the selected day.\n sameDay(date, today) && !selected && 'ring-1 ring-inset ring-brand-tertiary',\n )}\n >\n {date.getDate()}\n </button>\n </div>\n );\n })}\n </div>\n ))}\n </div>\n </div>\n );\n}\n","import clsx from 'clsx';\nimport { forwardRef, useLayoutEffect, useRef, useState, type ReactNode } from 'react';\nimport { CheckIcon, ChevronRightIcon } from 'lucide-react';\nimport { useElementWidth } from '../../lib/use-element-width';\n\nexport type StepStatus = 'complete' | 'active' | 'upcoming';\n\nexport interface StepItem {\n label: string;\n status: StepStatus;\n}\n\nexport type StepperSize = 'sm' | 'md';\nexport type StepperAlign = 'start' | 'center' | 'end';\n\nexport interface StepperCompactInfo {\n /** Zero-based index of the active step. */\n index: number;\n total: number;\n step: StepItem;\n next: StepItem | undefined;\n}\n\nexport interface StepperProps {\n steps: StepItem[];\n /** Matches Figma's `Size` axis on the `Stepper` component set. */\n size?: StepperSize;\n /** Names the list. Defaults to `Progress`. Override for a non-English UI. */\n label?: string;\n /** Horizontal alignment of the full list within its row. Default `start`. */\n align?: StepperAlign;\n /**\n * `auto` (default) switches to a compact \"Step 2 of 5 · Contact\" summary with a segmented bar\n * whenever the labelled steps don't fit on one line. `never` always shows the full list.\n */\n compact?: 'auto' | 'never';\n /** The compact summary's text, for a non-English UI. Defaults to \"Step n of N · label\" and \"Next: label\". */\n formatCompact?: (info: StepperCompactInfo) => { current: ReactNode; next?: ReactNode };\n /** On the wrapper, from 0.9.0. Through 0.8.x the root was the `<ol>` itself. */\n className?: string;\n}\n\n/**\n * Status words announced after each step's label.\n *\n * Step status was conveyed by colour plus an `aria-hidden` glyph only, so \"complete\" and\n * \"upcoming\" were indistinguishable to a screen reader — `aria-current=\"step\"` marked the\n * active one and nothing said which of the rest were done.\n */\nconst STATUS_TEXT: Record<StepStatus, string> = {\n complete: 'completed',\n active: 'current step',\n upcoming: 'not started',\n};\n\nconst SIZE: Record<StepperSize, { indicator: string; glyph: number; label: string }> = {\n sm: { indicator: 'size-4', glyph: 9, label: 'text-body-tiny' },\n md: { indicator: 'size-5', glyph: 11, label: 'text-body-xs' },\n};\n\nconst ALIGN: Record<StepperAlign, string> = {\n start: '',\n center: 'justify-center',\n end: 'justify-end',\n};\n\nfunction StepIndicator({ status, size }: { status: StepStatus; size: StepperSize }) {\n const s = SIZE[size];\n\n if (status === 'complete') {\n return (\n <span\n aria-hidden\n className={clsx(\n 'flex shrink-0 items-center justify-center rounded-full bg-brand text-brand-on-brand',\n s.indicator,\n )}\n >\n <CheckIcon size={s.glyph} />\n </span>\n );\n }\n\n if (status === 'active') {\n return (\n <span\n aria-hidden\n className={clsx(\n 'flex shrink-0 items-center justify-center rounded-full border-2 border-brand-emphasis',\n s.indicator,\n )}\n >\n <span className=\"size-2.5 rounded-full bg-brand\" />\n </span>\n );\n }\n\n return (\n <span\n aria-hidden\n className={clsx('shrink-0 rounded-full border-2 border-disabled', s.indicator)}\n />\n );\n}\n\nfunction ChevronSeparator() {\n return <ChevronRightIcon className=\"mx-1 size-4 shrink-0 text-default-tertiary\" aria-hidden />;\n}\n\nconst labelClass: Record<StepStatus, string> = {\n complete: 'text-brand font-semibold',\n active: 'text-brand font-semibold',\n upcoming: 'text-disabled font-regular',\n};\n\ninterface StepListProps {\n steps: StepItem[];\n size: StepperSize;\n label: string;\n /** The off-screen twin used to measure the list's natural width: hidden, unnamed. */\n measuring?: boolean;\n className?: string;\n}\n\nconst StepList = forwardRef<HTMLOListElement, StepListProps>(function StepList(\n { steps, size, label, measuring, className },\n ref,\n) {\n const s = SIZE[size];\n return (\n <ol\n ref={ref}\n className={clsx('flex items-center', className)}\n aria-label={measuring ? undefined : label}\n aria-hidden={measuring || undefined}\n >\n {steps.map((step, i) => (\n <li\n // Keyed by label rather than index, so reordering or inserting a step does not\n // reuse the wrong element's state.\n key={step.label}\n className=\"flex items-center\"\n aria-current={step.status === 'active' && !measuring ? 'step' : undefined}\n >\n <span className=\"flex items-center gap-1.5\">\n <StepIndicator status={step.status} size={size} />\n <span className={clsx('whitespace-nowrap', s.label, labelClass[step.status])}>\n {step.label}\n </span>\n {!measuring && <span className=\"sr-only\">, {STATUS_TEXT[step.status]}</span>}\n </span>\n {i < steps.length - 1 && <ChevronSeparator />}\n </li>\n ))}\n </ol>\n );\n});\n\nfunction defaultCompactText({ index, total, step, next }: StepperCompactInfo) {\n return {\n current: (\n <>\n Step {index + 1} of {total}\n <span className=\"font-normal text-default\"> · {step.label}</span>\n </>\n ),\n next: next ? `Next: ${next.label}` : undefined,\n };\n}\n\n/**\n * Step progress for wizards.\n *\n * Shows every labelled step when they fit on one line, and otherwise a compact \"Step 2 of 5 ·\n * Contact\" summary with a segmented bar. Ported from SCIC in 0.9.0: through 0.8.x an\n * overflowing list scrolled sideways, which hid the later steps behind a scrollbar.\n *\n * The switch compares the stepper's measured width with the list's natural width, read from an\n * invisible twin, not a breakpoint, so it is right in a narrow modal on desktop and at 200%\n * zoom. The labelled `<ol>` stays in the DOM in both modes (visually hidden in compact), so a\n * screen reader always gets every step with its state; the summary is presentation only.\n */\nexport function Stepper({\n steps,\n size = 'md',\n label = 'Progress',\n align = 'start',\n compact: compactMode = 'auto',\n formatCompact = defaultCompactText,\n className,\n}: StepperProps) {\n const [wrapRef, width] = useElementWidth<HTMLDivElement>();\n const measureRef = useRef<HTMLOListElement>(null);\n const [naturalWidth, setNaturalWidth] = useState(0);\n\n useLayoutEffect(() => {\n // Re-read when the steps change or the row resizes (a web font landing reflows it).\n if (measureRef.current) setNaturalWidth(measureRef.current.scrollWidth);\n }, [steps, width, size]);\n\n const compact = compactMode === 'auto' && width !== undefined && naturalWidth > width;\n const activeIndex = Math.max(0, steps.findIndex((step) => step.status === 'active'));\n const text = compact\n ? formatCompact({ index: activeIndex, total: steps.length, step: steps[activeIndex], next: steps[activeIndex + 1] })\n : null;\n\n return (\n <div ref={wrapRef} data-compact={compact || undefined} className={clsx('relative w-full min-w-0', className)}>\n {compactMode === 'auto' && (\n <div className=\"pointer-events-none invisible absolute left-0 top-0 h-0 overflow-hidden\" aria-hidden>\n <StepList ref={measureRef} steps={steps} size={size} label={label} measuring className=\"w-max\" />\n </div>\n )}\n\n <StepList\n steps={steps}\n size={size}\n label={label}\n className={clsx(compact ? 'sr-only' : ALIGN[align])}\n />\n\n {text && (\n <div aria-hidden className=\"flex flex-col gap-2\">\n <div className=\"flex flex-wrap items-baseline justify-between gap-x-3 gap-y-0.5\">\n <p className={clsx(SIZE[size].label, 'font-semibold text-brand')}>{text.current}</p>\n {text.next && <p className=\"text-body-tiny text-default-secondary\">{text.next}</p>}\n </div>\n <div className=\"flex gap-1\">\n {steps.map((step) => (\n <span\n key={step.label}\n className={clsx(\n 'h-1 flex-1 rounded-full',\n step.status === 'upcoming' ? 'bg-disabled' : 'bg-brand',\n )}\n />\n ))}\n </div>\n </div>\n )}\n </div>\n );\n}\n","import clsx from 'clsx';\nimport { type ReactNode } from 'react';\nimport { CheckIcon } from 'lucide-react';\nimport {\n choiceCardParts,\n initialChoiceCardSize,\n type ChoiceCardSize,\n type ResponsiveChoiceCardSize,\n} from './choice-card-size';\n\n/**\n * Figma's `Size` axis on `Multiselect Card` (`Default | Small`), plus `lg` from 0.9.0 for roomy\n * viewports such as tablets. Shared with `RadioCards`.\n */\nexport type MultiSelectCardSize = ChoiceCardSize;\n\nexport interface MultiSelectCardProps {\n icon: ReactNode;\n title: string;\n description?: string;\n selected: boolean;\n onToggle: () => void;\n /**\n * Figma has had this axis since 0.2.0; the 0.3.0 CHANGELOG recorded it as \"left alone\n * pending a design decision\". `Default` and `Small` differ only in padding, icon box and\n * type step, so there was nothing to decide.\n *\n * From 0.9.0 it also takes a responsive object, mobile-first:\n * `{ initial: 'sm', md: 'lg' }` is small on phones and large from `md` up.\n */\n size?: ResponsiveChoiceCardSize;\n disabled?: boolean;\n className?: string;\n}\n\nexport function MultiSelectCard({\n icon,\n title,\n description,\n selected,\n onToggle,\n size = 'default',\n disabled = false,\n className,\n}: MultiSelectCardProps) {\n const s = choiceCardParts(size);\n\n return (\n <button\n type=\"button\"\n role=\"checkbox\"\n aria-checked={selected}\n data-size={initialChoiceCardSize(size)}\n disabled={disabled}\n onClick={onToggle}\n className={clsx(\n 'relative w-full rounded-2xl border-2 text-left transition-all',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default',\n 'disabled:cursor-not-allowed disabled:opacity-60',\n s.pad,\n selected\n ? 'border-brand bg-brand-tertiary'\n : 'border-default bg-default hover:border-default-secondary',\n className,\n )}\n >\n <div className=\"flex items-start justify-between gap-2\">\n <span\n aria-hidden\n className={clsx(\n 'flex shrink-0 items-center justify-center',\n s.iconBox,\n selected ? 'bg-brand' : 'bg-brand-tertiary',\n )}\n >\n <span className={clsx(s.icon, selected ? 'text-icon-brand-on-brand' : 'text-icon-brand')}>\n {icon}\n </span>\n </span>\n\n {selected ? (\n <span\n aria-hidden\n className={clsx(\n 'flex shrink-0 items-center justify-center rounded-full bg-brand text-icon-brand-on-brand',\n s.mark,\n )}\n >\n <CheckIcon className=\"size-3\" strokeWidth={2.5} />\n </span>\n ) : (\n <span\n aria-hidden\n className={clsx('shrink-0 rounded-full border-2 border-default', s.mark)}\n />\n )}\n </div>\n\n <div className={s.gap}>\n <p className={clsx('font-semibold', s.title, selected ? 'text-brand' : 'text-default')}>\n {title}\n </p>\n {description && (\n <p className={clsx('mt-0.5 text-default-secondary', s.description)}>{description}</p>\n )}\n </div>\n </button>\n );\n}\n","/**\n * The size scale shared by `MultiSelectCard` and `RadioCards`, so the single- and multi-select\n * cards always line up.\n *\n * `size` takes one size or, from 0.9.0, a responsive object in the Radix Themes shape:\n * `{ initial: 'sm', md: 'lg' }`, mobile-first at the preset's `sm`/`md`/`lg` breakpoints. SCIC's\n * onboarding needed \"small on phones, large from tablets\", and a fixed `responsive` size would\n * hardcode one pair.\n *\n * Every breakpoint's classes are written out in full below. Tailwind only generates classes it\n * can find in the source, so a class assembled at runtime (`${bp}:${cls}`) would produce no CSS.\n */\nexport type ChoiceCardSize = 'sm' | 'default' | 'lg';\n\nexport type ChoiceCardBreakpoint = 'sm' | 'md' | 'lg';\n\nexport type ResponsiveChoiceCardSize =\n | ChoiceCardSize\n | ({ initial: ChoiceCardSize } & Partial<Record<ChoiceCardBreakpoint, ChoiceCardSize>>);\n\nexport interface ChoiceCardParts {\n pad: string;\n iconBox: string;\n icon: string;\n mark: string;\n gap: string;\n title: string;\n description: string;\n}\n\nconst BASE: Record<ChoiceCardSize, ChoiceCardParts> = {\n sm: { pad: 'p-3', iconBox: 'size-8 rounded-lg', icon: 'size-4', mark: 'size-4', gap: 'mt-2', title: 'text-body-xs', description: 'text-body-tiny' },\n default: { pad: 'p-4', iconBox: 'size-10 rounded-xl', icon: 'size-5', mark: 'size-5', gap: 'mt-3', title: 'text-body-sm', description: 'text-body-tiny' },\n lg: { pad: 'p-5', iconBox: 'size-12 rounded-xl', icon: 'size-6', mark: 'size-6', gap: 'mt-3.5', title: 'text-body', description: 'text-body-xs' },\n};\n\nconst AT: Record<ChoiceCardBreakpoint, Record<ChoiceCardSize, ChoiceCardParts>> = {\n sm: {\n sm: { pad: 'sm:p-3', iconBox: 'sm:size-8 sm:rounded-lg', icon: 'sm:size-4', mark: 'sm:size-4', gap: 'sm:mt-2', title: 'sm:text-body-xs', description: 'sm:text-body-tiny' },\n default: { pad: 'sm:p-4', iconBox: 'sm:size-10 sm:rounded-xl', icon: 'sm:size-5', mark: 'sm:size-5', gap: 'sm:mt-3', title: 'sm:text-body-sm', description: 'sm:text-body-tiny' },\n lg: { pad: 'sm:p-5', iconBox: 'sm:size-12 sm:rounded-xl', icon: 'sm:size-6', mark: 'sm:size-6', gap: 'sm:mt-3.5', title: 'sm:text-body', description: 'sm:text-body-xs' },\n },\n md: {\n sm: { pad: 'md:p-3', iconBox: 'md:size-8 md:rounded-lg', icon: 'md:size-4', mark: 'md:size-4', gap: 'md:mt-2', title: 'md:text-body-xs', description: 'md:text-body-tiny' },\n default: { pad: 'md:p-4', iconBox: 'md:size-10 md:rounded-xl', icon: 'md:size-5', mark: 'md:size-5', gap: 'md:mt-3', title: 'md:text-body-sm', description: 'md:text-body-tiny' },\n lg: { pad: 'md:p-5', iconBox: 'md:size-12 md:rounded-xl', icon: 'md:size-6', mark: 'md:size-6', gap: 'md:mt-3.5', title: 'md:text-body', description: 'md:text-body-xs' },\n },\n lg: {\n sm: { pad: 'lg:p-3', iconBox: 'lg:size-8 lg:rounded-lg', icon: 'lg:size-4', mark: 'lg:size-4', gap: 'lg:mt-2', title: 'lg:text-body-xs', description: 'lg:text-body-tiny' },\n default: { pad: 'lg:p-4', iconBox: 'lg:size-10 lg:rounded-xl', icon: 'lg:size-5', mark: 'lg:size-5', gap: 'lg:mt-3', title: 'lg:text-body-sm', description: 'lg:text-body-tiny' },\n lg: { pad: 'lg:p-5', iconBox: 'lg:size-12 lg:rounded-xl', icon: 'lg:size-6', mark: 'lg:size-6', gap: 'lg:mt-3.5', title: 'lg:text-body', description: 'lg:text-body-xs' },\n },\n};\n\nconst BREAKPOINTS: ChoiceCardBreakpoint[] = ['sm', 'md', 'lg'];\nconst PARTS = Object.keys(BASE.default) as (keyof ChoiceCardParts)[];\n\n/** The classes for each part of a card at `size`, one size or responsive. */\nexport function choiceCardParts(size: ResponsiveChoiceCardSize): ChoiceCardParts {\n if (typeof size === 'string') return BASE[size];\n const layers = [BASE[size.initial], ...BREAKPOINTS.flatMap((bp) => (size[bp] ? [AT[bp][size[bp]!]] : []))];\n return Object.fromEntries(\n PARTS.map((part) => [part, layers.map((layer) => layer[part]).join(' ')]),\n ) as unknown as ChoiceCardParts;\n}\n\n/** The size the card has before any breakpoint applies, for `data-size`. */\nexport function initialChoiceCardSize(size: ResponsiveChoiceCardSize): ChoiceCardSize {\n return typeof size === 'string' ? size : size.initial;\n}\n","import { forwardRef, useId, type ButtonHTMLAttributes, type ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { composeEventHandlers } from '../../lib/compose-event-handlers';\nimport { useControllableState } from '../../lib/use-controllable-state';\n\nexport type SwitchSize = 'sm' | 'md';\n\nexport interface SwitchProps\n extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange' | 'value' | 'type'> {\n /** Controlled. Omit and pass `defaultChecked` for uncontrolled. */\n checked?: boolean;\n defaultChecked?: boolean;\n onCheckedChange?: (checked: boolean) => void;\n /** Visible text beside the switch. Doubles as the accessible name. */\n label?: ReactNode;\n /** Second line under the label. Matches Figma's `Supporting text` axis. */\n description?: ReactNode;\n /** Track size. `sm` is 36×20, `md` is 44×24. */\n size?: SwitchSize;\n /**\n * Submits with a surrounding form, as `name=value` while on. New in 0.7.0: through 0.6 a\n * Switch posted nothing, so it could not take part in a plain form.\n */\n name?: string;\n /** The value posted while on. Default `\"on\"`, as for a native checkbox. */\n value?: string;\n required?: boolean;\n}\n\n/**\n * Track / knob geometry, straight from the Figma `_Toggle base` component (see the naming\n * note below). The knob sits on a 2px inset, so travel = track width − knob − (2 × inset).\n */\nconst SIZE: Record<SwitchSize, { track: string; knob: string; translate: string }> = {\n sm: { track: 'h-5 w-9', knob: 'size-4', translate: 'translate-x-4' },\n md: { track: 'h-6 w-11', knob: 'size-5', translate: 'translate-x-5' },\n};\n\n/**\n * An on/off switch — a setting that takes effect immediately, with no save step.\n *\n * **Renamed from `Toggle` in 0.4.0.** It was always a switch: `role=\"switch\"`,\n * `aria-checked`, and the track/knob geometry taken from Figma. The name was blocking,\n * because \"Toggle\" means something else in shadcn/ui and in most design systems — a\n * pressed-state *button*, like a bold button in a text toolbar. That component now exists\n * here under the name everyone expects, and the two are not interchangeable:\n *\n * - `Switch` — `role=\"switch\"`, \"on\"/\"off\", applies immediately. A setting.\n * - `Toggle` — `aria-pressed`, \"pressed\"/\"not pressed\". A button whose effect persists.\n *\n * Figma calls its set `Toggle` with a `Pressed` axis, but its geometry and `_Toggle base`\n * match this component exactly, so Figma's `Toggle` **is** this switch. Figma has no\n * pressed-button equivalent yet; that is a gap on the design side, recorded in the\n * CHANGELOG rather than papered over here.\n */\nexport const Switch = forwardRef<HTMLButtonElement, SwitchProps>(function Switch(\n {\n checked: checkedProp,\n defaultChecked = false,\n onCheckedChange,\n label,\n description,\n size = 'md',\n disabled = false,\n name,\n value = 'on',\n required,\n id,\n className,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n onClick,\n ...rest\n },\n ref,\n) {\n const [checked, setChecked] = useControllableState({\n value: checkedProp,\n defaultValue: defaultChecked,\n onChange: onCheckedChange,\n });\n\n const generatedId = useId();\n const controlId = id ?? generatedId;\n const descriptionId = `${controlId}-description`;\n const s = SIZE[size];\n\n const control = (\n <button\n ref={ref}\n type=\"button\"\n role=\"switch\"\n id={controlId}\n aria-checked={checked}\n data-state={checked ? 'checked' : 'unchecked'}\n // With no visible label the switch would otherwise ship with no accessible name.\n aria-label={label ? undefined : ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={description ? descriptionId : undefined}\n disabled={disabled}\n onClick={composeEventHandlers(onClick, () => setChecked(!checked))}\n className={clsx(\n 'group flex items-center gap-2',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default',\n disabled && 'cursor-not-allowed opacity-50',\n !description && !name && className,\n )}\n {...rest}\n >\n <span\n aria-hidden\n className={clsx(\n 'relative inline-flex shrink-0 rounded-full transition-colors',\n s.track,\n // The unchecked track is borderless per the spec. A border here would also shift\n // the knob's rendered inset by 1px between states, since the knob is positioned\n // against the padding box.\n disabled\n ? 'bg-disabled'\n : checked\n ? 'bg-brand group-hover:bg-brand-hover'\n : 'bg-default-secondary group-hover:bg-default-secondary-hover',\n )}\n >\n <span\n className={clsx(\n 'absolute left-0.5 top-0.5 rounded-full bg-default shadow-100 transition-transform motion-reduce:transition-none',\n s.knob,\n checked ? s.translate : 'translate-x-0',\n )}\n />\n </span>\n {label && <span className=\"text-body-xs text-default\">{label}</span>}\n </button>\n );\n\n /*\n * Form participation: a real checkbox, invisible and out of the tab order and the\n * accessibility tree, mirroring the switch. A checkbox rather than a hidden input, so it\n * posts only while on and `required` is validated, exactly as a native checkbox would be.\n * Not Radix Switch: it measures its control with an unguarded ResizeObserver inside a form,\n * which crashes every consumer's jsdom tests that lack a polyfill.\n */\n const formInput = name ? (\n <input\n type=\"checkbox\"\n aria-hidden\n tabIndex={-1}\n name={name}\n value={value}\n checked={checked}\n required={required}\n disabled={disabled}\n onChange={() => {}}\n className=\"pointer-events-none absolute size-px opacity-0\"\n />\n ) : null;\n\n if (!description) {\n return formInput ? (\n <span className={clsx('relative inline-flex', className)}>\n {control}\n {formInput}\n </span>\n ) : (\n control\n );\n }\n\n return (\n <div className={clsx('relative flex flex-col', className)}>\n {control}\n {formInput}\n {/* Outside the button, so it is not folded into the accessible name — the same\n reasoning as `Checkbox` and `Radio`. Indented past the track. */}\n <span\n id={descriptionId}\n className={clsx(\n 'mt-0.5 text-body-tiny',\n size === 'md' ? 'pl-[52px]' : 'pl-[44px]',\n disabled ? 'text-disabled' : 'text-default-secondary',\n )}\n >\n {description}\n </span>\n </div>\n );\n});\n","import {\n createContext,\n forwardRef,\n useContext,\n useMemo,\n useRef,\n type ButtonHTMLAttributes,\n type HTMLAttributes,\n type ReactNode,\n} from 'react';\nimport clsx from 'clsx';\nimport { cn } from '../../lib/cn';\nimport { FOCUS_RING } from '../../lib/focus-ring';\nimport { composeRefs } from '../../lib/slot';\nimport { useControllableState } from '../../lib/use-controllable-state';\nimport { useRovingFocus } from '../../lib/use-roving-focus';\n\nexport type ToggleSize = 'sm' | 'md' | 'lg';\nexport type ToggleVariant = 'ghost' | 'outline';\n\nconst SIZE: Record<ToggleSize, string> = {\n sm: 'h-8 min-w-8 px-2 text-body-tiny [&_svg]:size-3.5',\n md: 'h-9 min-w-9 px-2.5 text-body-xs [&_svg]:size-4',\n lg: 'h-11 min-w-11 px-3 text-body-sm [&_svg]:size-5',\n};\n\nconst VARIANT: Record<ToggleVariant, string> = {\n ghost: 'border border-transparent bg-transparent',\n outline: 'border border-default bg-default',\n};\n\nexport interface ToggleProps\n extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange' | 'type'> {\n /** Controlled pressed state. Omit and pass `defaultPressed` for uncontrolled. */\n pressed?: boolean;\n defaultPressed?: boolean;\n onPressedChange?: (pressed: boolean) => void;\n size?: ToggleSize;\n variant?: ToggleVariant;\n children?: ReactNode;\n}\n\n/**\n * A button with a sticky pressed state — bold in a text toolbar, a map layer on/off, a\n * filter that stays applied.\n *\n * **New in 0.4.0, and not what `Toggle` used to be.** Through 0.3.0 this name belonged to\n * the on/off switch, which is now `Switch`. The two look similar and mean different things:\n *\n * - `Toggle` — `aria-pressed`. A *button*. \"Bold is pressed.\"\n * - `Switch` — `role=\"switch\"` + `aria-checked`. A *setting*. \"Notifications are on.\"\n *\n * `aria-pressed` rather than `aria-checked` is the whole distinction as far as assistive\n * tech is concerned, and it is why this is not just `Switch` with different styling.\n *\n * An icon-only toggle needs `aria-label`, exactly as `IconButton` does — there is no visible\n * text to name it.\n */\nexport const Toggle = forwardRef<HTMLButtonElement, ToggleProps>(function Toggle(\n {\n pressed: pressedProp,\n defaultPressed = false,\n onPressedChange,\n size = 'md',\n variant = 'ghost',\n disabled,\n children,\n className,\n onClick,\n ...rest\n },\n ref,\n) {\n const group = useContext(ToggleGroupContext);\n\n // Inside a ToggleGroup the group owns the state; standalone it owns its own.\n const [standalonePressed, setStandalonePressed] = useControllableState({\n value: pressedProp,\n defaultValue: defaultPressed,\n onChange: onPressedChange,\n });\n\n const pressed = group ? group.isPressed(rest.value as string) : standalonePressed;\n const isDisabled = disabled ?? group?.disabled;\n\n return (\n <button\n ref={ref}\n type=\"button\"\n {...rest}\n // After the spread, so a consumer's handler runs alongside the toggle. Through 0.6\n // `rest` came last and an `onClick` replaced it, so the toggle stopped toggling.\n aria-pressed={pressed}\n data-state={pressed ? 'on' : 'off'}\n disabled={isDisabled}\n onClick={(event) => {\n onClick?.(event);\n if (event.defaultPrevented) return;\n if (group) group.toggle(rest.value as string);\n else setStandalonePressed(!pressed);\n }}\n className={cn(\n 'inline-flex shrink-0 items-center justify-center gap-1.5 rounded-lg font-medium transition-colors',\n FOCUS_RING,\n 'disabled:cursor-not-allowed disabled:opacity-50',\n SIZE[size],\n VARIANT[variant],\n // Pressed state styled from the attribute it is announced by.\n 'text-default-secondary hover:bg-default-secondary hover:text-default',\n 'aria-pressed:border-brand-tertiary aria-pressed:bg-brand-tertiary aria-pressed:text-brand',\n 'aria-pressed:hover:bg-brand-tertiary aria-pressed:hover:text-brand',\n className,\n )}\n >\n {children}\n </button>\n );\n});\n\n// ── ToggleGroup ────────────────────────────────────────────────────────────────\n\nexport type ToggleGroupType = 'single' | 'multiple';\n\ninterface ToggleGroupContextValue {\n isPressed: (value: string) => boolean;\n toggle: (value: string) => void;\n disabled?: boolean;\n /** Items claim a roving index in render order, which is their visual order. */\n claimIndex: () => number;\n roving: ReturnType<typeof useRovingFocus>;\n}\n\nconst ToggleGroupContext = createContext<ToggleGroupContextValue | null>(null);\n\n/** One toggle as data. New in 0.8.0. */\nexport interface ToggleGroupOption {\n value: string;\n /** Text or an icon. */\n label: ReactNode;\n /** Required when `label` is an icon: there is no visible text to name the toggle. */\n 'aria-label'?: string;\n disabled?: boolean;\n}\n\nexport interface ToggleGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {\n /** The parts: `ToggleGroupItem`s. Omit when passing `options`. */\n children?: ReactNode;\n /** The toggles as data, each rendered as a `ToggleGroupItem`. New in 0.8.0. Use it or `children`. */\n options?: readonly ToggleGroupOption[];\n /** `single` behaves like a radio group; `multiple` like a set of checkboxes. */\n type?: ToggleGroupType;\n value?: string | string[];\n defaultValue?: string | string[];\n onValueChange?: (value: string | string[]) => void;\n /** Names the group. Required by the APG for a toolbar-style group. */\n label: string;\n disabled?: boolean;\n orientation?: 'horizontal' | 'vertical';\n}\n\n/**\n * A set of related toggles sharing one selection.\n *\n * `role=\"group\"` with `aria-pressed` on each child, and a roving tabindex so the set is one\n * tab stop with arrow keys inside — the same contract `SegmentedControl` was missing before\n * 0.4.0.\n *\n * How this differs from the neighbours, since three components in this library now look\n * similar: `SegmentedControl` is a `radiogroup` for choosing *one* of a small set of views,\n * and always has exactly one selection. `ToggleGroup type=\"multiple\"` allows none or many.\n * `ToggleGroup type=\"single\"` allows none or one — the deselectable case a radio group\n * cannot express.\n */\nexport function ToggleGroup({\n children,\n options,\n type = 'single',\n value: valueProp,\n defaultValue,\n onValueChange,\n label,\n disabled,\n orientation = 'horizontal',\n className,\n ...rest\n}: ToggleGroupProps) {\n const [value, setValue] = useControllableState<string | string[]>({\n value: valueProp,\n defaultValue: defaultValue ?? (type === 'multiple' ? [] : ''),\n onChange: onValueChange,\n });\n\n const roving = useRovingFocus({\n orientation: orientation === 'vertical' ? 'vertical' : 'horizontal',\n loop: true,\n });\n\n const cursor = useRef(0);\n\n const context = useMemo<ToggleGroupContextValue>(\n () => ({\n isPressed: (itemValue) =>\n Array.isArray(value) ? value.includes(itemValue) : value === itemValue,\n toggle: (itemValue) => {\n if (type === 'multiple') {\n const list = Array.isArray(value) ? value : [];\n setValue(\n list.includes(itemValue) ? list.filter((v) => v !== itemValue) : [...list, itemValue],\n );\n return;\n }\n // Single mode deselects on re-press — the behaviour a radiogroup cannot offer.\n setValue(value === itemValue ? '' : itemValue);\n },\n disabled,\n claimIndex: () => cursor.current++,\n roving,\n }),\n [value, setValue, type, disabled, roving],\n );\n\n // Reset before the children's render bodies run, so indices restart from zero each pass.\n cursor.current = 0;\n\n return (\n <ToggleGroupContext.Provider value={context}>\n <div\n role=\"group\"\n aria-label={label}\n // No `aria-orientation`: `role=\"group\"` does not support it. The orientation only\n // affects which arrow keys move focus, which the roving hook already knows —\n // announcing it here would be an invalid attribute for the role.\n data-slot=\"toggle-group\"\n className={clsx(\n 'inline-flex gap-0.5',\n orientation === 'vertical' ? 'flex-col' : 'flex-row items-center',\n className,\n )}\n {...roving.containerProps}\n {...rest}\n >\n {options\n ? options.map((option) => (\n <ToggleGroupItem\n key={option.value}\n value={option.value}\n aria-label={option['aria-label']}\n disabled={option.disabled}\n >\n {option.label}\n </ToggleGroupItem>\n ))\n : children}\n </div>\n </ToggleGroupContext.Provider>\n );\n}\n\nexport interface ToggleGroupItemProps extends Omit<ToggleProps, 'pressed' | 'defaultPressed'> {\n value: string;\n}\n\n/** A `Toggle` wired to its `ToggleGroup`, with the roving tabindex applied. */\nexport const ToggleGroupItem = forwardRef<HTMLButtonElement, ToggleGroupItemProps>(\n function ToggleGroupItem({ value, children, onFocus, ...rest }, ref) {\n const group = useContext(ToggleGroupContext);\n if (!group) throw new Error('<ToggleGroupItem> must be used inside <ToggleGroup>');\n\n const index = group.claimIndex();\n const { ref: rovingRef, ...itemProps } = group.roving.itemProps(index, {\n disabled: rest.disabled ?? group.disabled,\n label: typeof children === 'string' ? children : undefined,\n });\n\n return (\n <Toggle\n ref={composeRefs<HTMLButtonElement>(ref, rovingRef)}\n value={value}\n {...rest}\n {...itemProps}\n // The roving focus handler and the caller's both run. 0.6 spread `rest` last, so an\n // `onFocus` here silently broke the arrow-key position.\n onFocus={(event) => {\n onFocus?.(event);\n itemProps.onFocus();\n }}\n // Restated after the spread so it is statically visible, and so a group of five\n // toggles is one tab stop rather than five.\n tabIndex={itemProps.tabIndex}\n >\n {children}\n </Toggle>\n );\n },\n);\n","import {\n forwardRef,\n useId,\n useRef,\n useState,\n type ClipboardEvent as ReactClipboardEvent,\n type KeyboardEvent as ReactKeyboardEvent,\n} from 'react';\nimport clsx from 'clsx';\nimport { composeRefs } from '../../lib/slot';\nimport { useControllableState } from '../../lib/use-controllable-state';\n\nexport type InputOTPMode = 'numeric' | 'alphanumeric';\n\nexport interface InputOTPProps {\n /** Number of characters. Default `6`. */\n length?: number;\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n /** Fired once the last slot is filled. */\n onComplete?: (value: string) => void;\n mode?: InputOTPMode;\n /** Draws a gap after this many slots — `3` for a `123 456` code. */\n groupAfter?: number;\n /** Accessible name. Default `Verification code`. */\n label?: string;\n disabled?: boolean;\n invalid?: boolean;\n autoFocus?: boolean;\n className?: string;\n}\n\n/**\n * A one-time-code field — the boxed digits from a 2FA or email-verification flow.\n *\n * **One real input, N drawn boxes.** The obvious implementation is N separate `<input>`s,\n * and it is the wrong one: it makes the code N tab stops, breaks paste (the browser puts all\n * six characters in the first box), fights password managers and SMS autofill, and announces\n * \"edit text, blank\" six times. Instead there is a single input holding the whole value —\n * with `autocomplete=\"one-time-code\"`, so iOS and Android offer the code from the incoming\n * message — rendered transparently over the boxes, which are decorative.\n *\n * That means paste, autofill, undo, selection and screen readers all get the real value, and\n * the caret position simply drives which box is highlighted.\n */\nexport const InputOTP = forwardRef<HTMLInputElement, InputOTPProps>(function InputOTP(\n {\n length = 6,\n value: valueProp,\n defaultValue = '',\n onValueChange,\n onComplete,\n mode = 'numeric',\n groupAfter,\n label = 'Verification code',\n disabled = false,\n invalid = false,\n autoFocus = false,\n className,\n },\n ref,\n) {\n const [value, setValue] = useControllableState({\n value: valueProp,\n defaultValue,\n onChange: onValueChange,\n });\n\n const inputRef = useRef<HTMLInputElement>(null);\n const [focused, setFocused] = useState(false);\n const describedById = useId();\n\n const pattern = mode === 'numeric' ? /[^0-9]/g : /[^a-zA-Z0-9]/g;\n\n const commit = (next: string) => {\n const cleaned = next.replace(pattern, '').slice(0, length);\n setValue(cleaned);\n if (cleaned.length === length) onComplete?.(cleaned);\n };\n\n const chars = value.split('');\n // The caret sits on the first empty slot, or the last one when full.\n const activeIndex = Math.min(value.length, length - 1);\n\n return (\n <div className={clsx('relative inline-flex flex-col gap-1.5', className)}>\n {/* Clicking any box focuses the single real input. Not a control itself and not\n focusable — the input stretched across it is the control, and it is already keyboard\n reachable, so no key handler belongs here. */}\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */}\n <div\n className=\"relative inline-flex items-center gap-2\"\n onClick={() => inputRef.current?.focus()}\n >\n <input\n ref={composeRefs<HTMLInputElement>(inputRef, ref)}\n type=\"text\"\n inputMode={mode === 'numeric' ? 'numeric' : 'text'}\n // The one attribute that makes SMS and email autofill work on mobile.\n autoComplete=\"one-time-code\"\n autoCorrect=\"off\"\n spellCheck={false}\n maxLength={length}\n value={value}\n disabled={disabled}\n // Off by default; opt-in for the case this exists for — a verification screen whose\n // only purpose is entering the code that just arrived.\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n aria-label={label}\n aria-invalid={invalid || undefined}\n aria-describedby={describedById}\n onChange={(event) => commit(event.target.value)}\n onFocus={() => setFocused(true)}\n onBlur={() => setFocused(false)}\n onKeyDown={(event: ReactKeyboardEvent<HTMLInputElement>) => {\n // Arrow keys would move the caret into the middle of the value, which has no\n // meaning here — the code is filled left to right.\n if (event.key === 'ArrowLeft' || event.key === 'ArrowRight') event.preventDefault();\n }}\n onPaste={(event: ReactClipboardEvent<HTMLInputElement>) => {\n // Handled explicitly so a pasted \"123-456\" or \"123 456\" still works.\n event.preventDefault();\n commit(event.clipboardData.getData('text'));\n }}\n // Transparent and stretched across the boxes: the real input stays where the\n // browser expects it (so autofill anchors correctly) while the boxes below are\n // what the user sees.\n className=\"absolute inset-0 z-raised w-full cursor-default bg-transparent text-transparent caret-transparent outline-none\"\n />\n\n {Array.from({ length }, (_, index) => (\n <span\n key={index}\n // Decorative: the input above holds the value and the accessible name.\n aria-hidden\n className={clsx(\n 'flex h-12 w-10 items-center justify-center rounded-lg border text-body font-semibold tabular-nums transition-colors',\n groupAfter && index === groupAfter && 'ml-3',\n disabled\n ? 'border-disabled bg-disabled text-disabled'\n : invalid\n ? 'border-danger-secondary bg-default text-default'\n : 'border-default bg-default text-default',\n focused &&\n !disabled &&\n index === activeIndex &&\n 'border-brand ring-2 ring-brand ring-offset-1 ring-offset-default',\n )}\n >\n {chars[index] ?? ''}\n </span>\n ))}\n </div>\n <span id={describedById} className=\"sr-only\">\n {`Enter the ${length}-character code. ${value.length} of ${length} entered.`}\n </span>\n </div>\n );\n});\n","import { useRef, useState, type InputHTMLAttributes, type RefObject } from 'react';\nimport clsx from 'clsx';\nimport { UploadIcon } from 'lucide-react';\n\nexport interface FileDropZoneProps {\n className?: string;\n /** Caption shown under \"Upload file\". Defaults to the generic document hint. */\n description?: string;\n accept?: string;\n /** Files above this size are rejected before any upload starts. */\n maxSizeBytes?: number;\n onFileSelected?: (file: File) => void;\n disabled?: boolean;\n}\n\nconst DEFAULT_ACCEPT = '.pdf,.jpg,.jpeg,.png';\nconst DEFAULT_MAX_SIZE_BYTES = 10 * 1024 * 1024;\n\n/** Human-readable byte count: \"820 KB\", \"1.4 MB\". New in 0.7.0, from SCIC. */\nexport function formatFileSize(bytes: number): string {\n const kb = bytes / 1024;\n if (kb < 1024) return `${Math.round(kb)} KB`;\n const mb = kb / 1024;\n return `${Number.isInteger(mb) ? mb : mb.toFixed(1)} MB`;\n}\n\nfunction matchesAccept(file: File, accept: string): boolean {\n const extensions = accept\n .split(',')\n .map((part) => part.trim().toLowerCase())\n .filter((part) => part.startsWith('.'));\n if (extensions.length === 0) {\n return true;\n }\n return extensions.some((extension) => file.name.toLowerCase().endsWith(extension));\n}\n\nexport interface UseFilePickerOptions {\n accept?: string;\n maxSizeBytes?: number;\n onFileSelected?: (file: File) => void;\n}\n\nexport interface UseFilePicker {\n /** Spread onto a hidden `<input type=\"file\">`, which must be rendered. */\n inputProps: InputHTMLAttributes<HTMLInputElement> & { ref: RefObject<HTMLInputElement> };\n /** Opens the native picker. */\n open: () => void;\n /** Runs the same accept and size checks on dropped files. */\n handleFiles: (files: FileList | null) => void;\n /** Validation message for the last rejected file, if any. */\n error: string | null;\n}\n\n/**\n * The accept-list and size validation behind every way into a file upload: the drop zone, and\n * any \"Replace\" button that skips it. One implementation, so the checks cannot drift apart.\n * New in 0.7.0, from SCIC.\n */\nexport function useFilePicker({\n accept = DEFAULT_ACCEPT,\n maxSizeBytes = DEFAULT_MAX_SIZE_BYTES,\n onFileSelected,\n}: UseFilePickerOptions = {}): UseFilePicker {\n const inputRef = useRef<HTMLInputElement>(null);\n const [error, setError] = useState<string | null>(null);\n\n function handleFiles(files: FileList | null) {\n const file = files?.[0];\n if (!file) return;\n if (!matchesAccept(file, accept)) {\n setError(`Unsupported file type. Allowed: ${accept}.`);\n return;\n }\n if (file.size > maxSizeBytes) {\n setError(`That file is ${formatFileSize(file.size)}. The limit is ${formatFileSize(maxSizeBytes)}.`);\n return;\n }\n setError(null);\n onFileSelected?.(file);\n }\n\n return {\n inputProps: {\n ref: inputRef,\n type: 'file',\n accept,\n className: 'sr-only',\n tabIndex: -1,\n onChange: (event) => {\n handleFiles(event.currentTarget.files);\n event.currentTarget.value = '';\n },\n },\n open: () => inputRef.current?.click(),\n handleFiles,\n error,\n };\n}\n\nexport function FileDropZone({\n className,\n description = 'Drag & drop or browse · PDF, JPG, PNG · up to 10 MB',\n accept = DEFAULT_ACCEPT,\n maxSizeBytes = DEFAULT_MAX_SIZE_BYTES,\n onFileSelected,\n disabled = false,\n}: FileDropZoneProps) {\n const [isDragging, setIsDragging] = useState(false);\n const picker = useFilePicker({ accept, maxSizeBytes, onFileSelected });\n const { error, handleFiles } = picker;\n const inputRef = picker.inputProps.ref;\n\n return (\n // relative: the hidden input is absolutely positioned (sr-only); without a positioned\n // ancestor its box escapes a scrolling container and scrolls the page instead.\n <div className=\"relative\">\n <input {...picker.inputProps} disabled={disabled} />\n <div\n role=\"button\"\n data-state={isDragging ? 'dragging' : undefined}\n tabIndex={disabled ? -1 : 0}\n aria-disabled={disabled}\n onClick={() => { if (!disabled) inputRef.current?.click(); }}\n onKeyDown={(e) => {\n if (!disabled && (e.key === 'Enter' || e.key === ' ')) {\n e.preventDefault();\n inputRef.current?.click();\n }\n }}\n onDragOver={(e) => { e.preventDefault(); if (!disabled) setIsDragging(true); }}\n onDragEnter={(e) => { e.preventDefault(); if (!disabled) setIsDragging(true); }}\n onDragLeave={() => setIsDragging(false)}\n onDrop={(e) => {\n e.preventDefault();\n setIsDragging(false);\n if (!disabled) handleFiles(e.dataTransfer.files);\n }}\n className={clsx(\n 'flex flex-col items-center justify-center gap-1 rounded-lg border-2 border-dashed py-4 px-4 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1',\n disabled\n ? 'cursor-not-allowed border-disabled bg-disabled'\n : clsx(\n 'cursor-pointer',\n isDragging\n ? 'border-brand bg-brand-tertiary'\n : 'border-default bg-default-secondary hover:border-brand hover:bg-brand-tertiary',\n ),\n className,\n )}\n >\n <span\n aria-hidden\n className={disabled ? 'text-disabled' : isDragging ? 'text-brand' : 'text-default-secondary'}\n >\n <UploadIcon className=\"size-5\" />\n </span>\n <span className={clsx('text-body-sm font-medium', disabled ? 'text-disabled' : 'text-default')}>Upload file</span>\n <span className=\"text-body-xs text-default-secondary text-center\">\n {description}\n </span>\n </div>\n {error && (\n <span role=\"alert\" className=\"text-body-xs text-danger\">\n {error}\n </span>\n )}\n </div>\n );\n}\n","import { useEffect, useState, type ClipboardEvent, type KeyboardEvent } from 'react';\nimport clsx from 'clsx';\nimport { cn } from '../../lib/cn';\nimport { useControllableState } from '../../lib/use-controllable-state';\nimport { TagPill } from '../status/tag-pill';\nimport { useFieldControl } from './field';\n\nexport type TagInputParseResult = { value: string } | { error: string };\n\nexport interface TagInputProps {\n placeholder?: string;\n /** Red border and `aria-invalid`. Inside a `Field`, a `FieldError` with a message sets this. */\n invalid?: boolean;\n disabled?: boolean;\n required?: boolean;\n /** The committed chips, controlled. */\n value?: string[];\n /** The initial chips, uncontrolled. Default none. */\n defaultValue?: string[];\n /** Receives the whole next array when a chip is added or removed. */\n onValueChange?: (value: string[]) => void;\n /** Posts each chip with a surrounding form, as repeated fields of this name. */\n name?: string;\n /** Validates and normalises each token, e.g. lower-case an email or reject a bad one. */\n parse?: (raw: string) => TagInputParseResult;\n /** What separates tokens when typed or pasted. Default whitespace. A `g` or `y` flag is safe. */\n delimiter?: RegExp;\n maxTags?: number;\n /** Told whenever rejected text is sitting in the field, so a form can block saving. */\n onInvalidChange?: (invalid: boolean) => void;\n /**\n * Why the text in the field was rejected (`parse`'s error, or the `maxTags` limit), and\n * `null` once it is fixed or cleared. Show it in the `FieldError`: the control has no\n * message of its own from 0.10.0.\n */\n onParseError?: (error: string | null) => void;\n 'aria-label'?: string;\n className?: string;\n}\n\nconst defaultParse = (raw: string): TagInputParseResult => ({ value: raw.trim() });\n\n/**\n * A multi-value text field: type or paste values, and each becomes a removable chip. Emails,\n * domains, tags. New in 0.7.0, from SCIC (whose `onChange` is `onValueChange` here, matching\n * every other DS control).\n *\n * Controlled with `value`, or uncontrolled with `defaultValue`. With `name` it posts each chip\n * with a form, and `required` then blocks submit while there are none.\n *\n * Enter, the delimiter, blur and a delimited paste all commit. Backspace in an empty field removes\n * the last chip. Duplicates are ignored. A token `parse` rejects stays in the field with its error\n * rather than being dropped, so nothing the user typed silently disappears.\n *\n * Bare from 0.10.0, like the other text fields: no label, hint or error of its own. Put it in\n * a `Field` with a `FieldLabel`, and show `onParseError`'s message in its `FieldError`.\n */\nexport function TagInput(props: TagInputProps) {\n return <TagInputControl {...props} />;\n}\n\n\nfunction TagInputControl({\n value: valueProp,\n defaultValue = [],\n onValueChange,\n name,\n required,\n parse = defaultParse,\n delimiter = /\\s+/,\n maxTags,\n onInvalidChange,\n placeholder,\n disabled: disabledProp,\n invalid: invalidProp = false,\n onParseError,\n 'aria-label': ariaLabel,\n className,\n}: TagInputProps) {\n const field = useFieldControl();\n const disabled = disabledProp ?? field.disabled;\n const [values, setValues] = useControllableState<string[]>({\n value: valueProp,\n defaultValue,\n onChange: onValueChange,\n });\n // A global or sticky pattern keeps `lastIndex` between `test` calls, so alternate keys would fail.\n const isDelimited = (text: string) => {\n delimiter.lastIndex = 0;\n return delimiter.test(text);\n };\n const [draft, setDraft] = useState('');\n const [rejected, setRejected] = useState<string | null>(null);\n\n // A rejected token marks the control invalid even before a form shows the message.\n const invalid = invalidProp || !!field['aria-invalid'] || rejected !== null;\n useEffect(() => {\n onParseError?.(rejected);\n onInvalidChange?.(rejected !== null);\n }, [rejected, onParseError, onInvalidChange]);\n\n function commit(raw: string) {\n const tokens = raw\n .split(delimiter)\n .map((token) => token.trim())\n .filter(Boolean);\n if (!tokens.length) {\n setDraft('');\n return;\n }\n\n const next = [...values];\n let firstRejected: { token: string; error: string } | null = null;\n for (const token of tokens) {\n const result = parse(token);\n if ('error' in result) {\n firstRejected ??= { token, error: result.error };\n continue;\n }\n if (next.includes(result.value)) continue;\n if (maxTags !== undefined && next.length >= maxTags) {\n firstRejected ??= { token, error: `You can add up to ${maxTags}.` };\n continue;\n }\n next.push(result.value);\n }\n\n if (next.length !== values.length) setValues(next);\n setDraft(firstRejected?.token ?? '');\n setRejected(firstRejected?.error ?? null);\n }\n\n function handleKeyDown(event: KeyboardEvent<HTMLInputElement>) {\n if (event.key === 'Enter' || (event.key.length === 1 && isDelimited(event.key))) {\n event.preventDefault();\n commit(draft);\n return;\n }\n if (event.key === 'Backspace' && draft === '' && values.length) {\n setValues(values.slice(0, -1));\n }\n }\n\n function handlePaste(event: ClipboardEvent<HTMLInputElement>) {\n const text = event.clipboardData.getData('text');\n if (!isDelimited(text.trim())) return;\n event.preventDefault();\n commit(`${draft}${text}`);\n }\n\n return (\n <div\n data-invalid={invalid || undefined}\n data-disabled={disabled || undefined}\n className={cn(\n 'flex min-h-9 flex-wrap items-center gap-1.5 rounded-lg border border-default bg-default px-2 py-1.5 transition-colors',\n 'focus-within:border-brand focus-within:ring-1 focus-within:ring-brand',\n 'data-[invalid]:border-danger data-[invalid]:focus-within:ring-danger',\n 'data-[disabled]:cursor-not-allowed data-[disabled]:border-disabled data-[disabled]:bg-disabled',\n className,\n )}\n >\n {values.map((value) => (\n // TagPill rather than Badge from 0.9.0: one removable chip in the library, at the\n // md size with an ellipsising label, so a long address can't stretch the field.\n <TagPill\n key={value}\n label={value}\n size=\"md\"\n onRemove={disabled ? undefined : () => setValues(values.filter((existing) => existing !== value))}\n />\n ))}\n <input\n {...field}\n aria-label={ariaLabel}\n value={draft}\n disabled={disabled}\n placeholder={values.length ? undefined : placeholder}\n aria-invalid={invalid || undefined}\n // The chips are what is required, so the field only blocks submit while there are none.\n required={(required || !!field['aria-required']) && values.length === 0}\n onChange={(event) => {\n setDraft(event.target.value);\n setRejected(null);\n }}\n onKeyDown={handleKeyDown}\n onPaste={handlePaste}\n onBlur={() => commit(draft)}\n className={clsx(\n 'min-w-[8rem] flex-1 bg-transparent px-1 text-body-sm text-default outline-none',\n 'placeholder:text-default-tertiary disabled:cursor-not-allowed',\n )}\n />\n {name && values.map((value) => <input key={value} type=\"hidden\" name={name} value={value} />)}\n </div>\n );\n}\n","import clsx from 'clsx';\nimport type { KeyboardEvent, ReactElement, ReactNode } from 'react';\nimport { XIcon } from 'lucide-react';\nimport { devWarn } from '../../lib/dev-warn';\nimport { FOCUS_RING } from '../../lib/focus-ring';\nimport { Slot } from '../../lib/slot';\n\nexport type TagPillTone = 'default' | 'brand' | 'positive' | 'warning' | 'danger';\nexport type TagPillSize = 'sm' | 'md';\n\nexport interface TagPillProps {\n label: string;\n tone?: TagPillTone;\n /** `sm` (default) for read-only tags; `md` for chips in an input, like `TagInput`. */\n size?: TagPillSize;\n /**\n * Makes the tag removable: an × button named \"Remove {label}\". It also removes on Backspace\n * or Delete while focused, as MUI's Chip does, so a keyboard user deleting a row of tags\n * needn't reach for Enter. The label then ellipsises, with the full text as a `title`.\n */\n onRemove?: () => void;\n /** @deprecated Bypasses the design tokens — pass `tone` instead. Raw hex bg/text pair, overrides `tone` via inline style. Use when the exact source colors don't match design tokens. */\n /**\n * Render onto the single child instead, e.g. a router `<Link>` to the tag's own page. The tag's\n * label replaces the child's children, and it gains a hover fill and a focus ring. Not combined\n * with `onRemove`: a link and a remove button can't share one element. New in 0.9.5.\n */\n asChild?: boolean;\n /**\n * A decorative leading glyph, e.g. the kind of thing the tag stands for. Hidden from assistive\n * tech, so the label must carry the meaning. New in 0.9.5.\n */\n icon?: ReactNode;\n /**\n * A tooltip. Defaults to the label on a removable tag, whose label can ellipsise. Pass it for\n * extra detail, e.g. \"Worked out for the signed-in user\". New in 0.9.5.\n */\n title?: string;\n /** The element to render onto, with `asChild`. */\n children?: ReactElement;\n bg?: string;\n color?: string;\n className?: string;\n}\n\nconst toneStyles: Record<TagPillTone, string> = {\n default: 'bg-default-secondary text-default-secondary',\n brand: 'bg-brand-tertiary text-brand',\n positive:'bg-positive-tertiary text-positive',\n warning: 'bg-warning-tertiary text-warning',\n danger: 'bg-danger-tertiary text-danger',\n};\n\nconst sizeStyles: Record<TagPillSize, string> = {\n sm: 'px-2 py-0.5',\n md: 'px-3 py-1',\n};\n\nexport function TagPill({\n label,\n tone = 'default',\n size = 'sm',\n onRemove,\n asChild = false,\n icon,\n title,\n children,\n bg,\n color,\n className,\n}: TagPillProps) {\n if (asChild && onRemove) devWarn('TagPill: `asChild` and `onRemove` cannot be combined; `onRemove` is ignored.');\n const removeOnKey = (event: KeyboardEvent<HTMLButtonElement>) => {\n if (event.key === 'Backspace' || event.key === 'Delete') {\n event.preventDefault();\n onRemove?.();\n }\n };\n\n const glyph = icon && (\n <span aria-hidden className=\"inline-flex size-3 shrink-0 [&>svg]:size-full\">\n {icon}\n </span>\n );\n const labelContent = icon ? (\n <>\n {glyph}\n <span className=\"truncate\">{label}</span>\n </>\n ) : (\n label\n );\n\n const rootProps = {\n 'data-tone': tone,\n 'data-size': size,\n 'data-removable': onRemove && !asChild ? '' : undefined,\n title: title ?? (onRemove && !asChild ? label : undefined),\n className: clsx(\n 'inline-flex items-center rounded-full text-body-xs font-medium',\n sizeStyles[size],\n // The remove button sits in the end padding, so trim it to keep the × optically centred.\n 'data-[removable]:max-w-full data-[removable]:gap-1 data-[removable]:whitespace-nowrap data-[removable]:pr-1.5',\n icon && 'max-w-full gap-1',\n !bg && !color && toneStyles[tone],\n asChild && ['hover:underline underline-offset-2', FOCUS_RING],\n className,\n ),\n style: {\n ...(bg ? { backgroundColor: bg } : undefined),\n ...(color ? { color } : undefined),\n },\n };\n\n if (asChild) {\n return (\n <Slot {...rootProps} wrapChildren={() => labelContent}>\n {children}\n </Slot>\n );\n }\n\n return (\n <span {...rootProps}>\n {glyph}\n {onRemove || icon ? <span className=\"truncate\">{label}</span> : label}\n {onRemove && (\n <button\n type=\"button\"\n onClick={onRemove}\n onKeyDown={removeOnKey}\n aria-label={`Remove ${label}`}\n // `touch-hit` gives the 12px × a 44px hit area on touch screens without growing it.\n className=\"touch-hit inline-flex shrink-0 items-center justify-center rounded-full opacity-60 transition-opacity hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-current\"\n >\n <XIcon className=\"size-3\" strokeWidth={2.5} aria-hidden />\n </button>\n )}\n </span>\n );\n}\n","import clsx from 'clsx';\nimport type { ReactNode } from 'react';\nimport { ArrowLeftIcon, ArrowRightIcon } from 'lucide-react';\nimport { Button } from './button';\n\n// ── FormCard ───────────────────────────────────────────────────────────────────\n\nexport function FormCard({\n children,\n className,\n}: {\n children: ReactNode;\n className?: string;\n}) {\n return (\n <div\n className={clsx(\n 'overflow-hidden rounded-xl border border-default bg-default',\n className,\n )}\n >\n {children}\n </div>\n );\n}\n\n// ── FormCardHeader ─────────────────────────────────────────────────────────────\n\nexport interface FormCardHeaderProps {\n title: string;\n subtitle?: string;\n}\n\nexport function FormCardHeader({ title, subtitle }: FormCardHeaderProps) {\n // Responsive like FormCardFooter: 28px side padding was cramped on a phone (0.9.2).\n return (\n <div className=\"border-b border-default px-4 py-5 sm:px-7 sm:py-6\">\n {/* A long unbroken title (an entity's legal name, a URL) wraps instead of overflowing\n the card on a phone. */}\n <h2 className=\"text-heading-sm font-semibold text-default leading-snug [overflow-wrap:anywhere]\">{title}</h2>\n {subtitle && (\n <p className=\"mt-1 text-body-xs text-default-secondary\">{subtitle}</p>\n )}\n </div>\n );\n}\n\n// ── FormCardFooter ─────────────────────────────────────────────────────────────\n\nexport interface FormCardFooterProps {\n onSaveDraft?: () => void;\n onBack?: () => void;\n onContinue?: () => void;\n continueLabel?: string;\n /** The continue button's trailing glyph. Default an arrow; `null` for none (e.g. \"Submit\"). */\n continueIcon?: ReactNode | null;\n backDisabled?: boolean;\n continueDisabled?: boolean;\n /** Disable \"Save as draft\" while keeping it visible, e.g. while a draft save is in flight. */\n saveDraftDisabled?: boolean;\n}\n\nexport function FormCardFooter({\n onSaveDraft,\n onBack,\n onContinue,\n continueLabel = 'Continue',\n continueIcon,\n backDisabled = false,\n continueDisabled = false,\n saveDraftDisabled = false,\n}: FormCardFooterProps) {\n return (\n // Inline, NOT sticky: a sticky footer sits over the focused field once a phone keyboard\n // opens (WCAG 2.2 SC 2.4.11 Focus Not Obscured). Below `sm` Back/Continue share one\n // full-width row and the draft action wraps under them; DOM order stays draft → back →\n // continue for keyboards. Ported from SCIC in 0.7.0.\n <div className=\"flex flex-wrap items-center justify-between gap-3 border-t border-default px-4 py-4 sm:px-7 sm:py-5\">\n {/* Rendered only when it can do something. Through 0.6 it rendered disabled wherever no\n handler was passed, which read as an unfinished feature rather than one that does not\n apply here. */}\n {onSaveDraft ? (\n <Button\n variant=\"neutral\"\n size=\"md\"\n onClick={onSaveDraft}\n disabled={saveDraftDisabled}\n className=\"order-last w-full justify-center sm:order-none sm:w-auto\"\n >\n Save as draft\n </Button>\n ) : (\n <span className=\"hidden sm:block\" />\n )}\n <div className=\"flex w-full items-center gap-2 sm:w-auto\">\n {!backDisabled && (\n <Button\n variant=\"neutral\"\n size=\"md\"\n leadingIcon={<ArrowLeftIcon aria-hidden size={16} />}\n onClick={onBack}\n className=\"flex-1 justify-center sm:flex-none\"\n >\n Back\n </Button>\n )}\n <Button\n variant=\"primary\"\n size=\"md\"\n trailingIcon={continueIcon === null ? undefined : (continueIcon ?? <ArrowRightIcon aria-hidden size={16} />)}\n onClick={onContinue}\n disabled={continueDisabled}\n className=\"flex-1 justify-center sm:flex-none\"\n >\n {continueLabel}\n </Button>\n </div>\n </div>\n );\n}\n","import {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type FormEvent,\n type FormHTMLAttributes,\n type ReactNode,\n} from 'react';\n\nimport { cn } from '../../lib/cn';\nimport { Button } from './button';\nimport { ControlSizeProvider } from './control-size';\nimport { FieldLegend, FieldSet } from './field';\nimport type { InputSize } from './input';\nimport { Stepper } from './stepper';\nimport { renderField, TYPED, type FieldScope } from './form-fields';\nimport type {\n FormErrors,\n FormField,\n FormLayout,\n FormResult,\n FormState,\n FormStep,\n FormSubmitOn,\n FormValues,\n} from './form.types';\n\n/** Handed to an `actions` render function, for buttons of your own. */\nexport interface FormActionsApi extends FormState {\n /** Submits the form, as its submit button does (validation first). */\n submit: () => void;\n /** With `steps`: back one step. */\n back: () => void;\n /** With `steps`: whether the current step is the last. Otherwise `true`. */\n lastStep: boolean;\n}\n\nexport interface FormProps<V extends object = FormValues>\n extends Omit<FormHTMLAttributes<HTMLFormElement>, 'onSubmit' | 'children' | 'title' | 'defaultValue'> {\n /** The fields, in order. A field's `section` groups it under a heading. */\n fields: FormField<V>[];\n /** The form's accessible name. */\n title: string;\n /** Starting values when the form holds them itself. */\n defaultValues?: Partial<V>;\n /** Controlled values. Pair with `onValuesChange`. */\n values?: V;\n /** Every change, with the new values and the name of the field that changed. */\n onValuesChange?: (values: NoInfer<V>, name: string) => void;\n /**\n * Saves the values, once every check passes. Disabled fields are left out. Return\n * `{ ok: false }` when the save is refused: the form keeps what was typed. Show why on the\n * page, in a toast or an alert outside the form: the form shows client-side messages only.\n * While it runs the form is `pending`. If it throws, the form stops being pending and the\n * error propagates.\n */\n onSubmit?: (values: NoInfer<V>) => FormResult | void | Promise<FormResult | void>;\n /**\n * Messages by field name (or `list.0.field` path), for values as they stand. A message shows\n * once its field has been visited or a submit was tried, and blocks the submit.\n */\n validate?: (values: NoInfer<V>) => FormErrors;\n /**\n * The message for an empty `required` field that `validate` leaves alone. Default\n * \"<Label> is required.\" Pass `false` to leave required checks to `validate`.\n */\n requiredMessage?: ((field: FormField<V>) => string) | false;\n /**\n * Messages from the page that show at once and win over the form's own, e.g. a check the page\n * runs itself. `undefined` entries are ignored. Not for save errors: those go outside the form.\n */\n errors?: FormErrors;\n /**\n * When a validation message first shows. `blur` (default): once its field has been visited, or a\n * submit was tried. `submit`: only once a submit was tried, as sign-in screens do.\n */\n validateOn?: 'blur' | 'submit';\n /** Default `grid`. */\n layout?: FormLayout;\n /** Default `submit`. `change` submits on every change, with typing debounced. */\n submitOn?: FormSubmitOn;\n /** Debounce for typing with `submitOn=\"change\"`, in ms. Default 300. */\n debounce?: number;\n /** Shows one step at a time; fields name theirs with `step`. Next validates the step. */\n steps?: FormStep[];\n /** Every field read-only, and no buttons. */\n readOnly?: boolean;\n /** Every field disabled. */\n disabled?: boolean;\n /** Control size for every field. */\n size?: InputSize;\n /** Default \"Save\". */\n submitLabel?: string;\n /** Read out while saving. Default \"Saving\". */\n pendingLabel?: string;\n /** Default \"Next\" and \"Back\", with `steps`. */\n nextLabel?: string;\n backLabel?: string;\n /** Shows a Cancel button that calls it. */\n onCancel?: () => void;\n cancelLabel?: string;\n /** Replaces the default buttons. */\n actions?: ReactNode | ((api: FormActionsApi) => ReactNode);\n /** Default: shown unless `readOnly` or `submitOn=\"change\"`. */\n showActions?: boolean;\n /** Pending, dirty, valid, checking and step, for buttons and guards outside the form. */\n onStateChange?: (state: FormState) => void;\n /** Extra content after the fields, before the buttons. */\n children?: ReactNode;\n}\n\nconst LAYOUT: Record<FormLayout, { form: string; group: string; full: string }> = {\n grid: {\n form: 'grid grid-cols-1 gap-5 sm:grid-cols-2',\n group: 'grid grid-cols-1 gap-4 sm:col-span-2 sm:grid-cols-2',\n full: 'sm:col-span-2',\n },\n stack: { form: 'flex flex-col gap-5', group: 'flex flex-col gap-4', full: '' },\n inline: { form: 'flex flex-wrap items-end gap-3', group: 'contents', full: '' },\n};\n\nconst rootOf = (path: string) => path.split('.')[0] ?? path;\n\nfunction isEmpty(value: unknown) {\n if (value === null || value === undefined || value === false) return true;\n if (typeof value === 'string') return value.trim() === '';\n if (Array.isArray(value)) return value.length === 0;\n return false;\n}\n\nfunction clean(errors: FormErrors | undefined): FormErrors {\n const out: FormErrors = {};\n for (const [key, message] of Object.entries(errors ?? {})) if (message) out[key] = message;\n return out;\n}\n\nconst defaultRequired = (field: { label?: string }) => `${field.label ?? 'This field'} is required.`;\n\n/**\n * A form described as data: give it fields and an `onSubmit`, and it holds the values, runs\n * every check that doesn't need a save, shows the messages against the right fields, and\n * tracks pending and dirty state.\n *\n * It covers record forms (`grid`, sections, one Save), narrow forms such as sign-in (`stack`),\n * filter toolbars (`inline` with `submitOn=\"change\"`) and step-by-step flows (`steps`). For\n * the one odd field, use a `custom` field (any control, wired to the form's value and error),\n * or a `list` field for repeated rows, rather than building the whole form by hand.\n *\n * Where messages show:\n * - **In the form, under the field:** everything checkable without saving. `required`,\n * `validate` (cross-field rules such as a matching password, conditional requirements), a\n * field's async `check` (e.g. username availability), and the page's own `errors`. A message\n * shows once its field is visited or a submit is tried, and blocks the submit.\n * - **Outside the form:** anything the save itself refuses. `onSubmit` returns `{ ok: false }`\n * and the page shows why in a toast or an alert. The form keeps what was typed.\n *\n * The Save button looks disabled while a message or a check stands in the way, but it stays\n * focusable and pressing it shows what is wrong: a disabled look is a signal, not an\n * explanation. Values are held in React state, never read back from the DOM.\n */\nexport function Form<V extends object = FormValues>({\n fields: fieldsProp,\n title,\n defaultValues,\n values: valuesProp,\n onValuesChange,\n onSubmit,\n validate,\n requiredMessage,\n errors: errorsProp,\n validateOn = 'blur',\n layout = 'grid',\n submitOn = 'submit',\n debounce = 300,\n steps,\n readOnly = false,\n disabled = false,\n size,\n submitLabel = 'Save',\n pendingLabel = 'Saving',\n nextLabel = 'Next',\n backLabel = 'Back',\n onCancel,\n cancelLabel = 'Cancel',\n actions,\n showActions,\n onStateChange,\n children,\n className,\n noValidate = true,\n ...formProps\n}: FormProps<V>) {\n // The fields' generic parameter only types callbacks for the caller; inside, values are a record.\n const fields = fieldsProp as unknown as FormField[];\n const [inner, setInner] = useState<FormValues>(() => ({ ...(defaultValues ?? {}) }));\n const controlled = valuesProp !== undefined;\n const values = (controlled ? valuesProp : inner) as FormValues;\n const valuesRef = useRef(values);\n valuesRef.current = values;\n\n const [baseline, setBaseline] = useState(() => JSON.stringify(values));\n const [touched, setTouched] = useState<ReadonlySet<string>>(() => new Set());\n const [tried, setTried] = useState(false);\n const [pending, setPending] = useState(false);\n const [step, setStep] = useState(0);\n // The values the form started with, or last saved: a `check` doesn't run on an unchanged value.\n const initial = useRef(values);\n // Async checks by field name, for the value (as JSON) they were run on.\n const [checks, setChecks] = useState<Record<string, { key: string; message?: string; done: boolean }>>({});\n const checkRuns = useRef(new Map<string, { key: string; timer: ReturnType<typeof setTimeout>; abort: AbortController }>());\n const [focusError, setFocusError] = useState(0);\n\n const formRef = useRef<HTMLFormElement>(null);\n const mounted = useRef(true);\n const submitSeq = useRef(0);\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n useEffect(() => {\n mounted.current = true;\n // The map itself never changes, only its entries.\n const runs = checkRuns.current;\n return () => {\n mounted.current = false;\n clearTimeout(timer.current);\n for (const run of runs.values()) {\n clearTimeout(run.timer);\n run.abort.abort();\n }\n };\n }, []);\n\n const visible = fields.filter((f) => !f.hidden?.(values));\n const lastStep = !steps || step >= steps.length - 1;\n const onStep = (f: FormField) => !steps || f.step === steps[step]?.id;\n\n // Validation messages for the values as they stand, whether or not they are shown yet.\n const clientErrors = useMemo(() => {\n const out: FormErrors = {};\n if (requiredMessage !== false) {\n const message = (requiredMessage || defaultRequired) as (field: FormField) => string;\n for (const f of visible) {\n const locked =\n disabled ||\n readOnly ||\n (typeof f.disabled === 'function' ? f.disabled(values) : f.disabled) ||\n (typeof f.readOnly === 'function' ? f.readOnly(values) : f.readOnly);\n if (f.required && !locked && isEmpty(values[f.name])) out[f.name] = message(f);\n }\n }\n Object.assign(out, clean(validate?.(values as V)));\n // A hidden field cannot show its message, so it cannot block the submit either.\n const shown = new Set(visible.map((f) => f.name));\n for (const key of Object.keys(out)) if (!shown.has(rootOf(key))) delete out[key];\n return out;\n // `visible` follows from `fields` and `values`.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [fields, values, validate, requiredMessage, disabled, readOnly]);\n\n const locked = (f: FormField) =>\n disabled || readOnly || !!(typeof f.disabled === 'function' ? f.disabled(values) : f.disabled) || !!(typeof f.readOnly === 'function' ? f.readOnly(values) : f.readOnly);\n // Which fields' async checks should run now, for which value.\n const wanted = new Map<string, string>();\n for (const f of visible) {\n if (!f.check || locked(f) || clientErrors[f.name] || isEmpty(values[f.name])) continue;\n const key = JSON.stringify(values[f.name]);\n if (key !== JSON.stringify(initial.current[f.name])) wanted.set(f.name, key);\n }\n const wantedKey = JSON.stringify([...wanted]);\n\n // Start, restart or drop checks as the values change. A run for an older value is aborted and\n // its answer ignored.\n useEffect(() => {\n const runs = checkRuns.current;\n for (const [name, run] of runs) {\n if (wanted.get(name) === run.key) continue;\n clearTimeout(run.timer);\n run.abort.abort();\n runs.delete(name);\n }\n setChecks((current) => {\n const next: typeof current = {};\n for (const [name, key] of wanted) next[name] = current[name]?.key === key ? current[name] : { key, done: false };\n return JSON.stringify(next) === JSON.stringify(current) ? current : next;\n });\n for (const [name, key] of wanted) {\n if (runs.has(name)) continue;\n const field = fields.find((f) => f.name === name);\n if (!field?.check) continue;\n const check = field.check;\n const abort = new AbortController();\n const timer = setTimeout(() => {\n check(valuesRef.current[name], valuesRef.current, abort.signal).then(\n (message) => {\n if (abort.signal.aborted || !mounted.current) return;\n setChecks((current) => (current[name]?.key === key ? { ...current, [name]: { key, done: true, message: message || undefined } } : current));\n },\n () => {\n // A check that fails to answer blocks nothing; the save checks again anyway.\n if (abort.signal.aborted || !mounted.current) return;\n setChecks((current) => (current[name]?.key === key ? { ...current, [name]: { key, done: true } } : current));\n },\n );\n }, field.checkDelay ?? 400);\n runs.set(name, { key, timer, abort });\n }\n // `wanted` is described by `wantedKey`.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [wantedKey, fields]);\n\n const checkState = (name: string) => {\n const key = wanted.get(name);\n const entry = key === undefined ? undefined : checks[name];\n return { checking: key !== undefined && (!entry || entry.key !== key || !entry.done), message: entry?.key === key ? entry?.message : undefined };\n };\n // Every message that blocks the submit: the form's own, then the async checks'.\n const blocking: FormErrors = { ...clientErrors };\n for (const name of wanted.keys()) {\n const message = checkState(name).message;\n if (message && !blocking[name]) blocking[name] = message;\n }\n const checkingNames = [...wanted.keys()].filter((name) => checkState(name).checking);\n\n const stepNames = new Set(visible.filter(onStep).map((f) => f.name));\n const valid = !Object.keys(blocking).some((key) => stepNames.has(rootOf(key)));\n const checking = checkingNames.some((name) => stepNames.has(name));\n const dirty = JSON.stringify(values) !== baseline;\n\n const onStateChangeRef = useRef(onStateChange);\n onStateChangeRef.current = onStateChange;\n useEffect(() => {\n onStateChangeRef.current?.({ pending, dirty, valid, checking, step });\n }, [pending, dirty, valid, checking, step]);\n\n // After a blocked submit, move focus to the first field that says what is wrong.\n useEffect(() => {\n if (!focusError) return;\n const target = formRef.current?.querySelector<HTMLElement>(\n '[aria-invalid=\"true\"]:not([aria-hidden=\"true\"]), [role=\"alert\"]',\n );\n if (target?.getAttribute('role') === 'alert') {\n target.closest('[data-field]')?.querySelector<HTMLElement>('input, textarea, button, select')?.focus();\n } else target?.focus();\n }, [focusError]);\n\n const runSubmit = useCallback(\n async (submitted: FormValues) => {\n if (!onSubmit) return;\n const seq = ++submitSeq.current;\n const current = valuesRef.current;\n // Disabled fields are shown, not submitted (as a browser leaves them out of a form post).\n const out: FormValues = { ...submitted };\n for (const f of fields) {\n if (typeof f.disabled === 'function' ? f.disabled(current) : f.disabled) delete out[f.name];\n }\n setPending(true);\n let result: FormResult | void;\n try {\n result = await onSubmit(out as V);\n } finally {\n // A newer submit (typing in a `change` form) or an unmount makes this one stale.\n if (mounted.current && seq === submitSeq.current) setPending(false);\n }\n if (!mounted.current || seq !== submitSeq.current) return;\n if (!result || result.ok) {\n // Saved: these are the values to compare against from now on.\n initial.current = current;\n setBaseline(JSON.stringify(current));\n }\n },\n [onSubmit, fields],\n );\n\n const setField = useCallback(\n (name: string, value: unknown, immediate = false) => {\n const next = { ...valuesRef.current, [name]: value };\n valuesRef.current = next;\n if (!controlled) setInner(next);\n onValuesChange?.(next as V, name);\n if (submitOn === 'change') {\n clearTimeout(timer.current);\n const field = fields.find((f) => f.name === name);\n if (field && TYPED.has(field.type) && !immediate) timer.current = setTimeout(() => void runSubmit(next), debounce);\n else void runSubmit(next);\n }\n },\n [controlled, onValuesChange, submitOn, fields, debounce, runSubmit],\n );\n\n const touch = useCallback((path: string) => {\n setTouched((current) => (current.has(path) ? current : new Set(current).add(path)));\n }, []);\n\n const shownError = (path: string) =>\n errorsProp?.[path] || (tried || (validateOn === 'blur' && touched.has(path)) ? blocking[path] : undefined);\n\n const submit = () => {\n if (readOnly || pending) return;\n if (checking) {\n // Nothing to show yet: the field already says \"Checking…\".\n setTried(true);\n return;\n }\n if (!valid) {\n setTried(true);\n setFocusError((n) => n + 1);\n return;\n }\n if (!lastStep) {\n setTried(false);\n setStep((s) => s + 1);\n return;\n }\n // On the last step, a message (or a check) left on an earlier step sends the user back to it.\n const stopping = [...Object.keys(blocking), ...checkingNames];\n if (stopping.length) {\n const first = fields.find((f) => stopping.some((k) => rootOf(k) === f.name));\n const index = steps?.findIndex((s) => s.id === first?.step) ?? -1;\n setTried(true);\n if (index >= 0) setStep(index);\n setFocusError((n) => n + 1);\n return;\n }\n setTried(true);\n void runSubmit(valuesRef.current);\n };\n\n const handleSubmit = (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n if (submitOn === 'change') {\n clearTimeout(timer.current);\n void runSubmit(valuesRef.current);\n return;\n }\n submit();\n };\n\n const back = () => {\n setTried(false);\n setStep((s) => Math.max(0, s - 1));\n };\n\n const scope: FieldScope = {\n values,\n path: (name) => name,\n set: setField,\n error: shownError,\n checking: (path) => checkState(path).checking,\n touch,\n disabled,\n readOnly,\n pending,\n layout,\n };\n\n // Sections in the order they first appear; fields without one come first, unheaded.\n const groups: [string, FormField[]][] = [];\n for (const f of fields.filter(onStep)) {\n const key = layout === 'inline' ? '' : (f.section ?? '');\n const group = groups.find(([k]) => k === key);\n if (group) group[1].push(f);\n else if (key === '') groups.unshift([key, [f]]);\n else groups.push([key, [f]]);\n }\n\n const L = LAYOUT[layout];\n const api: FormActionsApi = {\n pending,\n dirty,\n valid,\n checking,\n step,\n lastStep,\n submit: () => formRef.current?.requestSubmit(),\n back,\n };\n const withActions = showActions ?? (!readOnly && submitOn === 'submit');\n\n const body = (\n <form\n ref={formRef}\n aria-label={title}\n noValidate={noValidate}\n aria-busy={pending || undefined}\n {...formProps}\n onSubmit={handleSubmit}\n className={cn(L.form, className)}\n >\n {steps && (\n <div className={L.full}>\n <Stepper\n steps={steps.map((s, i) => ({\n label: s.label,\n status: i < step ? 'complete' : i === step ? 'active' : 'upcoming',\n }))}\n />\n </div>\n )}\n {groups.map(([section, group]) =>\n section ? (\n <FieldSet key={section} className={L.group}>\n <FieldLegend className={layout === 'grid' ? 'mb-1' : undefined}>{section}</FieldLegend>\n {group.map((f) => renderField(f, scope))}\n </FieldSet>\n ) : (\n <div key=\"\" className={L.group}>\n {group.map((f) => renderField(f, scope))}\n </div>\n ),\n )}\n {children}\n {withActions &&\n (actions !== undefined ? (\n typeof actions === 'function' ? actions(api) : actions\n ) : (\n <div className={cn('flex justify-end gap-2', L.full)}>\n {onCancel && (\n <Button variant=\"neutral\" onClick={onCancel}>\n {cancelLabel}\n </Button>\n )}\n {steps && step > 0 && (\n <Button variant=\"neutral\" onClick={back}>\n {backLabel}\n </Button>\n )}\n <Button\n type=\"submit\"\n loading={pending}\n loadingLabel={pendingLabel}\n // Looks disabled while something stands in the way, but stays pressable: pressing it\n // shows the messages. A natively disabled button would also block Enter-to-submit.\n aria-disabled={pending || !valid || checking || undefined}\n >\n {lastStep ? submitLabel : nextLabel}\n </Button>\n </div>\n ))}\n </form>\n );\n\n return size ? <ControlSizeProvider size={size}>{body}</ControlSizeProvider> : body;\n}\n","import { useState, type FocusEvent, type ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { EyeIcon, EyeOffIcon, PlusIcon, XIcon } from 'lucide-react';\n\nimport { Button } from './button';\nimport { Checkbox } from './checkbox';\nimport { Combobox, type ComboboxOption } from './combobox';\nimport { useControlSize } from './control-size';\nimport { CountrySelect, countryOptions } from './country-select';\nimport { DatePicker } from './date-picker';\nimport { Field, FieldError, FieldHint, FieldLabel, FieldLegend, FieldSet, useFieldContext } from './field';\nimport { IconButton } from './icon-button';\nimport { Input } from './input';\nimport { InputGroup, InputGroupAddon, InputGroupInput, SearchInput } from './input-group';\nimport { RadioGroup } from './radio-group';\nimport { SegmentedControl } from './segmented-control';\nimport { Select, type SelectOption, type SelectOptionGroup } from './select';\nimport { Switch } from './switch';\nimport { Textarea } from './textarea';\nimport { TimeZoneSelect } from './time-zone-select';\nimport type {\n FormCheckField,\n FormField,\n FormFieldContext,\n FormLayout,\n FormListField,\n FormTextType,\n FormValues,\n} from './form.types';\n\n/**\n * Where a field reads and writes its value. The form itself is one scope; each row of a `list`\n * field is another, whose paths are `list.index.field`.\n */\nexport interface FieldScope {\n values: FormValues;\n path: (name: string) => string;\n /** `immediate` skips the typing debounce of a `submitOn=\"change\"` form, e.g. for a clear button. */\n set: (name: string, value: unknown, immediate?: boolean) => void;\n error: (path: string) => string | undefined;\n /** Whether the field's `check` is running. */\n checking: (path: string) => boolean;\n touch: (path: string) => void;\n disabled: boolean;\n readOnly: boolean;\n pending: boolean;\n layout: FormLayout;\n}\n\ntype Resolved = {\n path: string;\n value: unknown;\n error: string | undefined;\n checking: boolean;\n hint: ReactNode;\n disabled: boolean;\n readOnly: boolean;\n required: boolean;\n ctx: FormFieldContext;\n};\n\nfunction resolve<T>(maybe: T | ((values: FormValues) => T) | undefined, values: FormValues) {\n return typeof maybe === 'function' ? (maybe as (values: FormValues) => T)(values) : maybe;\n}\n\nexport const str = (value: unknown) => (value === null || value === undefined ? '' : String(value));\n\nconst TEXT_TYPES: Record<FormTextType, { type: string; step?: string; inputMode?: 'decimal' }> = {\n text: { type: 'text' },\n email: { type: 'email' },\n tel: { type: 'tel' },\n url: { type: 'url' },\n number: { type: 'number' },\n currency: { type: 'number', step: '0.01', inputMode: 'decimal' },\n password: { type: 'password' },\n search: { type: 'search' },\n};\n\n/** Text-like types, whose changes a `submitOn=\"change\"` form debounces. */\nexport const TYPED: ReadonlySet<string> = new Set([...Object.keys(TEXT_TYPES), 'textarea']);\n\n/** Label, control, then the error or the hint: the chrome every labelled control shares. */\nfunction Shell({\n field,\n r,\n className,\n children,\n}: {\n field: FormField;\n r: Resolved;\n className?: string;\n children: ReactNode;\n}) {\n const label = field.label ? (\n <FieldLabel className={field.hideLabel ? 'sr-only' : undefined}>{field.label}</FieldLabel>\n ) : null;\n return (\n <Field\n required={r.required}\n disabled={r.disabled}\n data-field={r.path}\n className={className}\n onBlur={(event: FocusEvent<HTMLDivElement>) => {\n // Visited once focus leaves the whole field, not on every inner blur.\n if (!event.currentTarget.contains(event.relatedTarget as Node | null)) r.ctx.touch();\n }}\n >\n {field.labelAction ? (\n <div className=\"flex items-baseline justify-between gap-2\">\n {label}\n {field.labelAction}\n </div>\n ) : (\n label\n )}\n {children}\n <Messages r={r} />\n </Field>\n );\n}\n\n/** The error, else \"Checking…\" while an async check runs, else the hint. */\nfunction Messages({ r }: { r: Resolved }) {\n return (\n <>\n <FieldError>{r.error}</FieldError>\n <FieldHint aria-live=\"polite\">{r.checking ? 'Checking…' : r.hint}</FieldHint>\n </>\n );\n}\n\n/** A choice field that is read-only shows its label as plain, focusable text. */\nfunction ReadOnlyText({ value }: { value: string }) {\n return <Input readOnly value={value} />;\n}\n\nfunction flatOptions(entries: (SelectOption | SelectOptionGroup)[]): SelectOption[] {\n return entries.flatMap((entry) => ('options' in entry ? entry.options : [entry]));\n}\n\nfunction PasswordControl(props: {\n value: string;\n onChange: (value: string) => void;\n readOnly: boolean;\n placeholder?: string;\n autoComplete?: string;\n maxLength?: number;\n invalid: boolean;\n}) {\n const [visible, setVisible] = useState(false);\n const field = useFieldContext();\n return (\n <InputGroup invalid={props.invalid} disabled={field?.disabled}>\n <InputGroupInput\n type={visible ? 'text' : 'password'}\n value={props.value}\n onChange={(event) => props.onChange(event.target.value)}\n readOnly={props.readOnly}\n placeholder={props.placeholder}\n autoComplete={props.autoComplete}\n maxLength={props.maxLength}\n />\n <InputGroupAddon align=\"inline-end\" decorative={false}>\n <button\n type=\"button\"\n aria-label={visible ? 'Hide password' : 'Show password'}\n onClick={() => setVisible((v) => !v)}\n disabled={field?.disabled}\n className=\"flex items-center justify-center rounded transition-colors hover:text-default focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand\"\n >\n {visible ? <EyeOffIcon aria-hidden className=\"size-4\" /> : <EyeIcon aria-hidden className=\"size-4\" />}\n </button>\n </InputGroupAddon>\n </InputGroup>\n );\n}\n\n/** Checkbox and Switch carry their own label, so only the error comes from the shell. */\nfunction CheckControlField({ field, r }: { field: FormCheckField; r: Resolved }) {\n const ctx = useFieldContext();\n // Checkbox and Switch come in sm and md only; a small form gets the small ones.\n const size = useControlSize() === 'sm' ? 'sm' : 'md';\n const common = {\n checked: r.value === true,\n onCheckedChange: (checked: boolean) => {\n r.ctx.setValue(checked);\n r.ctx.touch();\n },\n label: field.hideLabel ? undefined : field.label,\n 'aria-label': field.hideLabel ? field.label : undefined,\n description: r.hint || undefined,\n disabled: r.disabled || r.readOnly,\n required: r.required,\n 'aria-invalid': r.error ? true : undefined,\n 'aria-describedby': r.error ? ctx?.errorId : r.checking ? ctx?.hintId : undefined,\n } as const;\n return field.type === 'switch' ? <Switch {...common} size={size} /> : <Checkbox {...common} size={size} invalid={!!r.error} />;\n}\n\nfunction ListRows({ field, r, scope }: { field: FormListField; r: Resolved; scope: FieldScope }) {\n const rows = Array.isArray(r.value) ? (r.value as FormValues[]) : [];\n const locked = r.disabled || r.readOnly;\n const atMax = field.max !== undefined && rows.length >= field.max;\n const atMin = field.min !== undefined && rows.length <= field.min;\n const write = (next: FormValues[]) => {\n r.ctx.setValue(next);\n r.ctx.touch();\n };\n const add = (item: FormValues) => {\n if (!atMax) write([...rows, item]);\n };\n\n return (\n <FieldSet\n data-field={r.path}\n aria-describedby={r.error ? `${r.path}-list-error` : undefined}\n className={clsx('flex flex-col gap-2', field.className)}\n >\n <FieldLegend variant=\"label\" className={field.hideLabel ? 'sr-only' : undefined}>\n {field.label}\n </FieldLegend>\n {field.header}\n {rows.length === 0 && field.empty}\n {rows.map((row, index) => {\n const rowScope: FieldScope = {\n ...scope,\n values: row,\n disabled: scope.disabled || r.disabled,\n readOnly: scope.readOnly || r.readOnly,\n path: (name) => `${r.path}.${index}.${name}`,\n set: (name, value) => write(rows.map((x, i) => (i === index ? { ...x, [name]: value } : x))),\n };\n const removable = !locked && !atMin && (field.canRemove?.(row, index) ?? true);\n return (\n <div\n key={field.itemKey?.(row, index) ?? index}\n role=\"group\"\n aria-label={`${field.label} ${index + 1}`}\n className=\"flex flex-wrap items-end gap-2\"\n >\n {field.fields.map((f) => renderField(f, rowScope))}\n <IconButton\n aria-label={field.removeLabel?.(row, index) ?? `Remove row ${index + 1}`}\n variant=\"neutral\"\n size=\"sm\"\n disabled={!removable}\n onClick={() => write(rows.filter((_, i) => i !== index))}\n >\n <XIcon aria-hidden className=\"size-4\" />\n </IconButton>\n </div>\n );\n })}\n {!locked &&\n (field.renderAdd\n ? field.renderAdd(add, r.ctx)\n : field.newItem && (\n <div>\n <Button\n variant=\"neutral\"\n size=\"sm\"\n leadingIcon={<PlusIcon aria-hidden className=\"size-4\" />}\n disabled={atMax}\n onClick={() => field.newItem && add(field.newItem())}\n >\n {field.addLabel ?? 'Add'}\n </Button>\n </div>\n ))}\n {r.error ? (\n <p id={`${r.path}-list-error`} role=\"alert\" className=\"text-body-sm text-danger\">\n {r.error}\n </p>\n ) : r.checking || r.hint ? (\n <p aria-live=\"polite\" className=\"text-body-sm text-default-secondary\">{r.checking ? 'Checking…' : r.hint}</p>\n ) : null}\n </FieldSet>\n );\n}\n\n/** One field, or nothing while it is hidden. */\nexport function renderField(field: FormField, scope: FieldScope): ReactNode {\n const { values } = scope;\n if (field.hidden?.(values)) return null;\n\n const path = scope.path(field.name);\n const value = values[field.name];\n const disabled = scope.disabled || !!resolve(field.disabled, values);\n const readOnly = scope.readOnly || !!resolve(field.readOnly, values);\n const ctx: FormFieldContext = {\n name: path,\n value,\n setValue: (next) => {\n scope.set(field.name, next);\n // After the form has the new value, so a reset it makes lands on top of it.\n field.onValueChange?.(next, { ...ctx, value: next });\n },\n values,\n setField: (name, next) => scope.set(name, next),\n error: scope.error(path),\n touch: () => scope.touch(path),\n disabled,\n readOnly,\n required: !!field.required,\n pending: scope.pending,\n };\n const r: Resolved = {\n path,\n value,\n error: ctx.error,\n checking: scope.checking(path),\n hint: resolve(field.hint, values),\n disabled,\n readOnly,\n required: !!field.required,\n ctx,\n };\n const wide = scope.layout === 'grid' && field.size === 'large' ? 'sm:col-span-2' : undefined;\n const className = clsx(wide, field.className) || undefined;\n const shell = (control: ReactNode) => (\n <Shell key={path} field={field} r={r} className={className}>\n {control}\n </Shell>\n );\n\n switch (field.type) {\n case 'text':\n case 'email':\n case 'tel':\n case 'url':\n case 'number':\n case 'currency':\n case 'search': {\n const attrs = TEXT_TYPES[field.type];\n const control = (\n <Input\n type={attrs.type}\n step={attrs.step}\n inputMode={attrs.inputMode}\n value={str(value)}\n onChange={(event) => ctx.setValue(field.transform ? field.transform(event.target.value) : event.target.value)}\n readOnly={readOnly}\n placeholder={field.placeholder}\n autoComplete={field.autoComplete}\n maxLength={field.maxLength}\n />\n );\n if (field.type === 'search') {\n return shell(\n <SearchInput\n label={field.label}\n value={str(value)}\n onChange={(event) => ctx.setValue(event.target.value)}\n onClear={readOnly ? undefined : () => scope.set(field.name, '', true)}\n readOnly={readOnly}\n disabled={disabled}\n placeholder={field.placeholder}\n autoComplete={field.autoComplete}\n />,\n );\n }\n return shell(control);\n }\n case 'password':\n return shell(\n <PasswordControl\n value={str(value)}\n onChange={(next) => ctx.setValue(field.transform ? field.transform(next) : next)}\n readOnly={readOnly}\n placeholder={field.placeholder}\n autoComplete={field.autoComplete}\n maxLength={field.maxLength}\n invalid={!!r.error}\n />,\n );\n case 'textarea':\n return shell(\n <Textarea\n value={str(value)}\n onChange={(event) => ctx.setValue(field.transform ? field.transform(event.target.value) : event.target.value)}\n readOnly={readOnly}\n rows={field.rows}\n placeholder={field.placeholder}\n maxLength={field.maxLength}\n />,\n );\n case 'select': {\n const options = resolve(field.options, values) ?? [];\n if (readOnly) {\n return shell(<ReadOnlyText value={flatOptions(options).find((o) => o.value === str(value))?.label ?? str(value)} />);\n }\n return shell(\n <Select\n // A visible label names it with its value (\"Status Active\"); a hidden one, on a toolbar\n // whose options already read \"Status: Active\", names it alone.\n {...(field.hideLabel ? { 'aria-label': field.label, 'aria-labelledby': undefined } : {})}\n options={options}\n value={str(value) || null}\n onValueChange={(next) => {\n ctx.setValue(next);\n ctx.touch();\n }}\n placeholder={field.loading ? 'Loading…' : field.placeholder}\n disabled={disabled || field.loading}\n aria-busy={field.loading || undefined}\n />,\n );\n }\n case 'combobox': {\n const options: ComboboxOption[] = resolve(field.options, values) ?? [];\n if (readOnly) return shell(<ReadOnlyText value={options.find((o) => o.value === value)?.label ?? str(value)} />);\n return shell(\n <Combobox\n options={options}\n value={str(value) || null}\n onValueChange={(next) => ctx.setValue(next)}\n label={field.label}\n placeholder={field.loading ? 'Loading…' : field.placeholder}\n emptyMessage={field.emptyMessage}\n clearable={field.clearable}\n disabled={disabled || field.loading}\n invalid={!!r.error}\n />,\n );\n }\n case 'country':\n if (readOnly) return shell(<ReadOnlyText value={value ? (countryOptions([str(value)], field.locale)[0]?.label ?? str(value)) : ''} />);\n return shell(\n <CountrySelect\n value={str(value) || null}\n onValueChange={(next) => ctx.setValue(next)}\n label={field.label}\n countries={field.countries}\n locale={field.locale}\n renderFlag={field.renderFlag}\n placeholder={field.placeholder}\n disabled={disabled}\n invalid={!!r.error}\n />,\n );\n case 'timezone':\n if (readOnly) return shell(<ReadOnlyText value={str(value)} />);\n return shell(\n <TimeZoneSelect\n value={str(value) || null}\n onValueChange={(next) => ctx.setValue(next)}\n label={field.label}\n timeZones={field.timeZones}\n placeholder={field.placeholder}\n disabled={disabled}\n invalid={!!r.error}\n />,\n );\n case 'radio': {\n const options = resolve(field.options, values) ?? [];\n if (readOnly) {\n const chosen = options.find((o) => o.value === value)?.label;\n return shell(<ReadOnlyText value={typeof chosen === 'string' ? chosen : str(value)} />);\n }\n return (\n <Field key={path} data-field={path} disabled={disabled} required={r.required} className={className}>\n <RadioGroup\n label={field.label}\n options={options}\n value={str(value)}\n onValueChange={(next) => {\n ctx.setValue(next);\n ctx.touch();\n }}\n orientation={field.orientation}\n disabled={disabled}\n required={r.required}\n invalid={!!r.error}\n />\n <Messages r={r} />\n </Field>\n );\n }\n case 'segmented': {\n const options = resolve(field.options, values) ?? [];\n if (readOnly || disabled) return shell(<ReadOnlyText value={options.find((o) => o.value === value)?.label ?? str(value)} />);\n return (\n <Field key={path} data-field={path} className={className}>\n <SegmentedControl\n label={field.label}\n options={options}\n value={str(value)}\n onValueChange={(next) => ctx.setValue(next)}\n />\n <Messages r={r} />\n </Field>\n );\n }\n case 'date':\n if (readOnly) return shell(<ReadOnlyText value={formatDate(str(value))} />);\n return shell(\n <DatePicker\n value={str(value)}\n // `onChange` fires for a calendar pick and for the native input alike; `onValueChange`\n // only for the calendar.\n onChange={(event) => {\n ctx.setValue(event.target.value);\n ctx.touch();\n }}\n min={field.min}\n max={field.max}\n placeholder={field.placeholder}\n />,\n );\n case 'checkbox':\n case 'switch':\n return (\n <Field key={path} data-field={path} disabled={disabled} className={className}>\n <CheckControlField field={field} r={r} />\n <FieldError>{r.error}</FieldError>\n {r.checking && <FieldHint aria-live=\"polite\">Checking…</FieldHint>}\n </Field>\n );\n case 'list':\n return <ListRows key={path} field={{ ...field, className }} r={r} scope={scope} />;\n case 'custom':\n if (field.bare) return <div key={path} data-field={path} className={className}>{field.render(ctx)}</div>;\n return shell(field.render(ctx));\n default:\n return null;\n }\n}\n\nfunction formatDate(iso: string) {\n const match = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(iso);\n if (!match) return iso;\n const date = new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n return new Intl.DateTimeFormat(undefined, { dateStyle: 'medium' }).format(date);\n}\n","import {\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from 'react';\nimport clsx from 'clsx';\nimport { CheckIcon, ChevronDownIcon } from 'lucide-react';\n\nimport { useControllableState } from '../../lib/use-controllable-state';\nimport { useFloatingPanel } from '../overlays/floating';\nimport {\n OVERLAY_HEADING,\n OVERLAY_ITEM_ACTIVE,\n OVERLAY_ITEM_BASE,\n OVERLAY_ITEM_SIZE,\n OVERLAY_PANEL,\n OVERLAY_PANEL_SCROLL,\n} from '../overlays/menu-styles';\nimport { Portal } from '../overlays/portal';\nimport { useFieldControl } from './field';\nimport { useControlSize } from './control-size';\nimport type { InputSize } from './input';\n\nexport interface ComboboxOption<T = string> {\n value: T;\n label: string;\n description?: string;\n disabled?: boolean;\n /** Optional group heading. Options sharing a group are rendered together. */\n group?: string;\n /**\n * A leading glyph, e.g. a flag or an avatar. It is shown before the option's label in the\n * list and, for the selected option, inside the field. Decorative: it is `aria-hidden`, so\n * the label must say everything. New in 0.9.0.\n */\n icon?: ReactNode;\n}\n\nexport interface ComboboxProps<T extends string = string> {\n options: ComboboxOption<T>[];\n value?: T | null;\n defaultValue?: T | null;\n onValueChange?: (value: T | null) => void;\n /** Accessible name. Required unless the combobox is inside a `Field` with a label. */\n label?: string;\n placeholder?: string;\n size?: InputSize;\n disabled?: boolean;\n invalid?: boolean;\n /** Allow clearing back to `null` by selecting the chosen option again. Default `true`. */\n clearable?: boolean;\n /** Override the filter. Default is a case-insensitive substring match on `label`. */\n filter?: (option: ComboboxOption<T>, query: string) => boolean;\n /** Shown when nothing matches. */\n emptyMessage?: ReactNode;\n /** Custom option rendering. Receives the option and whether it is selected. */\n renderOption?: (option: ComboboxOption<T>, selected: boolean) => ReactNode;\n className?: string;\n}\n\nconst HEIGHT: Record<InputSize, string> = {\n lg: 'h-12 px-4 text-body',\n md: 'h-9 px-3 text-body-sm',\n sm: 'h-6 px-2 text-body-tiny',\n};\n\n/**\n * Single-select combobox with a text filter — an autocomplete.\n *\n * Implements the ARIA 1.2 combobox pattern, which is specific about a few things that are\n * easy to get wrong and were all wrong in the `RoleComboBox` this replaces:\n *\n * - **`role=\"combobox\"` belongs on the text input**, not on a wrapping `<div>`. The div\n * version means the state attributes sit on an element the user never focuses.\n * - **`aria-activedescendant`, not focus, tracks the highlighted option.** Focus stays in\n * the input the whole time — moving DOM focus into the list breaks typing. This is the\n * one place a roving tabindex is the *wrong* answer, which is why this does not use\n * `useRovingFocus`.\n * - **`aria-controls` points at the listbox**, which therefore needs a stable id.\n * - The listbox is portaled, so it is not clipped by a `Card` or a scrolling container.\n *\n * For a command palette — filter over *actions* rather than a value — use `Command`.\n */\nexport function Combobox<T extends string = string>({\n options,\n value: valueProp,\n defaultValue = null,\n onValueChange,\n label,\n placeholder = 'Select…',\n size: sizeProp,\n disabled: disabledProp,\n invalid = false,\n clearable = true,\n filter,\n emptyMessage = 'No matches',\n renderOption,\n className,\n}: ComboboxProps<T>) {\n const size = useControlSize(sizeProp);\n const [value, setValue] = useControllableState<T | null>({\n value: valueProp,\n defaultValue,\n onChange: onValueChange as ((next: T | null) => void) | undefined,\n });\n\n const [open, setOpen] = useState(false);\n const [query, setQuery] = useState('');\n const [activeIndex, setActiveIndex] = useState(0);\n\n const baseId = useId();\n const listboxId = `${baseId}-listbox`;\n const optionId = (index: number) => `${baseId}-option-${index}`;\n\n const inputRef = useRef<HTMLInputElement>(null);\n const listRef = useRef<HTMLDivElement | null>(null);\n const rootRef = useRef<HTMLDivElement>(null);\n const field = useFieldControl();\n // A disabled `Field` disables the combobox too, as it does every other control (0.9.8).\n const disabled = disabledProp ?? field.disabled ?? false;\n\n const matches = useMemo(() => {\n const predicate =\n filter ?? ((option: ComboboxOption<T>, q: string) =>\n option.label.toLowerCase().includes(q.toLowerCase()));\n return query ? options.filter((option) => predicate(option, query)) : options;\n }, [options, query, filter]);\n\n const selected = options.find((option) => option.value === value) ?? null;\n\n // What the input displays: the query while filtering, the selection otherwise.\n const displayValue = open ? query : (selected?.label ?? '');\n // The selected option's icon goes wherever its label shows: as the value, or as the\n // placeholder while the list is open and nothing has been typed. Typing hides it.\n const leadingIcon = selected?.icon && (!open || query === '') ? selected.icon : null;\n\n const close = useCallback((restoreFocus = true) => {\n setOpen(false);\n setQuery('');\n if (restoreFocus) inputRef.current?.focus();\n }, []);\n\n const commit = (option: ComboboxOption<T>) => {\n if (option.disabled) return;\n setValue(clearable && option.value === value ? null : option.value);\n close();\n };\n\n const move = (delta: number) => {\n if (matches.length === 0) return;\n setActiveIndex((current) => {\n let next = current;\n for (let i = 0; i < matches.length; i++) {\n next = (next + delta + matches.length) % matches.length;\n if (!matches[next]?.disabled) break;\n }\n return next;\n });\n };\n\n const { refs, floatingStyles } = useFloatingPanel({\n open,\n onOpenChange: setOpen,\n side: 'bottom',\n align: 'start',\n sideOffset: 4,\n matchAnchorWidth: true,\n });\n\n useEffect(() => {\n refs.setReference(rootRef.current);\n }, [refs, open]);\n\n // Reset the highlight whenever the result set changes, so it never points past the end.\n useEffect(() => {\n setActiveIndex(0);\n }, [query, options]);\n\n // Keep the highlighted option in view. `aria-activedescendant` moves the virtual cursor but\n // does not scroll, which DOM focus would have done for free.\n useEffect(() => {\n if (!open) return;\n const node = listRef.current?.querySelector(`#${CSS.escape(optionId(activeIndex))}`);\n // Feature-detected: `scrollIntoView` is absent in jsdom and in some embedded webviews,\n // and an unguarded call there throws during render of an otherwise working combobox.\n if (node instanceof Element && typeof node.scrollIntoView === 'function') {\n node.scrollIntoView({ block: 'nearest' });\n }\n });\n\n useEffect(() => {\n if (!open) return;\n function onPointerDown(event: PointerEvent) {\n const withinRoot = rootRef.current?.contains(event.target as Node);\n const withinList = listRef.current?.contains(event.target as Node);\n if (!withinRoot && !withinList) close(false);\n }\n document.addEventListener('pointerdown', onPointerDown);\n return () => document.removeEventListener('pointerdown', onPointerDown);\n }, [open, close]);\n\n let renderedGroup: string | undefined;\n\n return (\n <div ref={rootRef} className={clsx('relative w-full', className)}>\n <div\n className={clsx(\n 'flex w-full items-center gap-2 rounded-lg border transition-colors',\n HEIGHT[size],\n 'focus-within:ring-2 focus-within:ring-offset-1 focus-within:ring-offset-default',\n disabled\n ? 'cursor-not-allowed border-disabled bg-disabled'\n : invalid || field['aria-invalid']\n ? 'border-danger-secondary focus-within:border-danger focus-within:ring-danger'\n : 'border-default bg-default focus-within:border-brand focus-within:ring-brand',\n )}\n >\n {leadingIcon && (\n <span aria-hidden data-slot=\"combobox-icon\" className=\"flex shrink-0 items-center\">\n {leadingIcon}\n </span>\n )}\n <input\n ref={inputRef}\n // ARIA 1.2: the role goes on the input the user actually focuses.\n role=\"combobox\"\n type=\"text\"\n autoComplete=\"off\"\n aria-expanded={open}\n aria-controls={listboxId}\n aria-autocomplete=\"list\"\n aria-activedescendant={open && matches.length > 0 ? optionId(activeIndex) : undefined}\n aria-label={label}\n {...field}\n disabled={disabled}\n value={displayValue}\n placeholder={selected ? selected.label : placeholder}\n onChange={(event) => {\n setQuery(event.target.value);\n if (!open) setOpen(true);\n }}\n onFocus={() => !disabled && setOpen(true)}\n onKeyDown={(event) => {\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n if (!open) setOpen(true);\n else move(1);\n break;\n case 'ArrowUp':\n event.preventDefault();\n if (!open) setOpen(true);\n else move(-1);\n break;\n case 'Home':\n if (open) {\n event.preventDefault();\n setActiveIndex(0);\n }\n break;\n case 'End':\n if (open) {\n event.preventDefault();\n setActiveIndex(matches.length - 1);\n }\n break;\n case 'Enter':\n if (open && matches[activeIndex]) {\n event.preventDefault();\n commit(matches[activeIndex]);\n }\n break;\n case 'Escape':\n event.preventDefault();\n close();\n break;\n case 'Tab':\n // Tab commits nothing and closes — the value only changes on Enter or click,\n // so tabbing away cannot silently pick whatever happened to be highlighted.\n if (open) close(false);\n break;\n default:\n break;\n }\n }}\n className={clsx(\n 'min-w-0 flex-1 bg-transparent text-default outline-none',\n 'placeholder:text-default-tertiary',\n 'disabled:cursor-not-allowed disabled:text-disabled',\n )}\n />\n <ChevronDownIcon\n aria-hidden\n className={clsx(\n 'shrink-0 transition-transform motion-reduce:transition-none',\n size === 'sm' ? 'size-3' : 'size-4',\n disabled ? 'text-icon-disabled' : 'text-icon-default-secondary',\n open && 'rotate-180',\n )}\n />\n </div>\n\n {open && (\n <Portal>\n <div\n ref={(node) => {\n listRef.current = node;\n refs.setFloating(node);\n }}\n id={listboxId}\n role=\"listbox\"\n aria-label={label}\n style={{ ...floatingStyles, width: 'var(--panel-anchor-width)' }}\n className={clsx('z-popover', OVERLAY_PANEL, OVERLAY_PANEL_SCROLL)}\n >\n {matches.length === 0 && (\n <p className=\"px-2.5 py-2 text-body-xs text-default-secondary\">{emptyMessage}</p>\n )}\n {matches.map((option, index) => {\n const isSelected = option.value === value;\n const isActive = index === activeIndex;\n const groupHeading = option.group !== renderedGroup ? option.group : undefined;\n renderedGroup = option.group;\n\n return (\n <div key={String(option.value)}>\n {groupHeading && (\n <div\n role=\"presentation\"\n className={OVERLAY_HEADING}\n >\n {groupHeading}\n </div>\n )}\n {/* Options are deliberately not focusable and carry no key handler. In the\n ARIA 1.2 combobox pattern focus never leaves the input — moving it into\n the list would stop the user typing — and `aria-activedescendant`\n carries the highlight instead, with the input owning every key.\n jsx-a11y cannot model that, so it sees an unreachable option; it is\n reachable, just not by DOM focus. */}\n {/* eslint-disable-next-line jsx-a11y/interactive-supports-focus, jsx-a11y/click-events-have-key-events */}\n <div\n id={optionId(index)}\n role=\"option\"\n aria-selected={isSelected}\n aria-disabled={option.disabled || undefined}\n onPointerDown={(event) => event.preventDefault()}\n onClick={() => commit(option)}\n onPointerEnter={() => !option.disabled && setActiveIndex(index)}\n className={clsx(\n OVERLAY_ITEM_BASE,\n OVERLAY_ITEM_SIZE.md,\n 'items-center',\n option.disabled\n ? 'cursor-not-allowed text-disabled'\n : isActive\n ? clsx(OVERLAY_ITEM_ACTIVE, 'text-default')\n : 'text-default',\n )}\n >\n {renderOption ? (\n renderOption(option, isSelected)\n ) : (\n <>\n {option.icon && (\n <span aria-hidden className=\"flex shrink-0 items-center self-center\">\n {option.icon}\n </span>\n )}\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate\">{option.label}</span>\n {option.description && (\n <span className=\"block truncate text-body-tiny text-default-secondary\">\n {option.description}\n </span>\n )}\n </span>\n {isSelected && (\n <CheckIcon aria-hidden className=\"size-3.5 shrink-0 text-brand\" strokeWidth={3} />\n )}\n </>\n )}\n </div>\n </div>\n );\n })}\n </div>\n </Portal>\n )}\n </div>\n );\n}\n","import { useMemo, type ReactNode } from 'react';\n\nimport { Combobox, type ComboboxOption, type ComboboxProps } from './combobox';\n\n/**\n * ISO 3166-1 alpha-2 codes for every officially assigned country and territory.\n *\n * `Intl` can name a region but cannot list them — there is no `supportedValuesOf('region')` —\n * so the codes are the one thing this component has to carry itself. Labels still come from\n * `Intl.DisplayNames`, which means they follow the locale instead of being frozen in English.\n */\nconst ISO_3166_ALPHA_2 =\n 'AD AE AF AG AI AL AM AO AQ AR AS AT AU AW AX AZ BA BB BD BE BF BG BH BI BJ BL BM BN BO BQ BR ' +\n 'BS BT BV BW BY BZ CA CC CD CF CG CH CI CK CL CM CN CO CR CU CV CW CX CY CZ DE DJ DK DM DO DZ ' +\n 'EC EE EG EH ER ES ET FI FJ FK FM FO FR GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GS GT GU GW ' +\n 'GY HK HM HN HR HT HU ID IE IL IM IN IO IQ IR IS IT JE JM JO JP KE KG KH KI KM KN KP KR KW KY ' +\n 'KZ LA LB LC LI LK LR LS LT LU LV LY MA MC MD ME MF MG MH MK ML MM MN MO MP MQ MR MS MT MU MV ' +\n 'MW MX MY MZ NA NC NE NF NG NI NL NO NP NR NU NZ OM PA PE PF PG PH PK PL PM PN PR PS PT PW PY ' +\n 'QA RE RO RS RU RW SA SB SC SD SE SG SH SI SJ SK SL SM SN SO SR SS ST SV SX SY SZ TC TD TF TG ' +\n 'TH TJ TK TL TM TN TO TR TT TV TW TZ UA UG UM US UY UZ VA VC VE VG VI VN VU WF WS YE YT ZA ZM ZW';\n\nexport const COUNTRY_CODES: readonly string[] = ISO_3166_ALPHA_2.split(' ');\n\nexport interface CountrySelectProps\n extends Omit<ComboboxProps<string>, 'options' | 'filter' | 'renderOption'> {\n /** Restrict the list to these ISO 3166-1 alpha-2 codes. Default: every code. */\n countries?: readonly string[];\n /** Locale for the country names. Default: the browser's. */\n locale?: string;\n /**\n * A flag (or any glyph) for a code, shown before each name and in the field. The library\n * ships no flag artwork: bring your own, e.g. the flag-icons CSS:\n * renderFlag={(code) => <span className={'fi fi-' + code.toLowerCase()} />}. Emoji flags are\n * not a substitute: Windows has no colour glyphs for them. New in 0.9.0.\n */\n renderFlag?: (code: string) => ReactNode;\n}\n\n/** Country names for `codes` in `locale`, sorted by name. Falls back to the code itself. */\nexport function countryOptions(\n codes: readonly string[] = COUNTRY_CODES,\n locale?: string,\n): ComboboxOption<string>[] {\n let names: Intl.DisplayNames | null = null;\n try {\n names = new Intl.DisplayNames(locale ? [locale] : undefined, { type: 'region' });\n } catch {\n // An unknown locale throws. Codes are still a usable list.\n }\n return codes\n .map((code) => ({ value: code, label: names?.of(code) ?? code, description: code }))\n .sort((a, b) => a.label.localeCompare(b.label, locale));\n}\n\n/**\n * Searchable country picker. The value is an ISO 3166-1 alpha-2 code (`\"LK\"`), never the\n * display name, so it survives a locale change and can be stored as-is.\n *\n * A thin layer over `Combobox` — same keyboard contract, same panel — that adds the list and\n * lets the query match the code as well as the name, so typing `GB` finds United Kingdom.\n * A value outside `countries` is still listed, so a saved country never renders as an empty\n * field.\n */\nexport function CountrySelect({\n countries,\n locale,\n renderFlag,\n placeholder = 'Select a country…',\n emptyMessage = 'No countries match',\n ...props\n}: CountrySelectProps) {\n const keep = [props.value, props.defaultValue].filter((v): v is string => !!v);\n const keepKey = keep.join('|');\n const options = useMemo(() => {\n const list = countryOptions(countries, locale);\n const missing = keep.filter((v) => !list.some((o) => o.value === v));\n const all = [...countryOptions(missing, locale), ...list];\n return renderFlag ? all.map((option) => ({ ...option, icon: renderFlag(option.value) })) : all;\n // `keep` is rebuilt every render; `keepKey` is its stable identity.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [countries, locale, keepKey, renderFlag]);\n\n return (\n <Combobox\n {...props}\n options={options}\n placeholder={placeholder}\n emptyMessage={emptyMessage}\n filter={(option, query) => {\n const q = query.trim().toLowerCase();\n return option.label.toLowerCase().includes(q) || option.value.toLowerCase() === q;\n }}\n />\n );\n}\n","import {\n createContext,\n forwardRef,\n useContext,\n useId,\n type HTMLAttributes,\n type InputHTMLAttributes,\n type ReactNode,\n} from 'react';\nimport clsx from 'clsx';\nimport { devWarn } from '../../lib/dev-warn';\nimport { useControllableState } from '../../lib/use-controllable-state';\nimport { CheckControl, type CheckControlSize } from './check-control';\n\nexport type RadioGroupOrientation = 'vertical' | 'horizontal';\n\ninterface RadioGroupContextValue {\n name: string;\n value: string | undefined;\n setValue: (value: string) => void;\n size: CheckControlSize;\n disabled: boolean;\n invalid: boolean;\n}\n\nconst RadioGroupContext = createContext<RadioGroupContextValue | null>(null);\n\n/** One radio as data: the `Radio` props it renders with. New in 0.8.0. */\nexport interface RadioGroupOption {\n value: string;\n label: ReactNode;\n description?: ReactNode;\n disabled?: boolean;\n}\n\nexport interface RadioGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {\n /** The parts: `Radio`s. Omit when passing `options`. */\n children?: ReactNode;\n /** The radios as data, each rendered as a `Radio`. New in 0.8.0. Use it or `children`. */\n options?: readonly RadioGroupOption[];\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n /** Shared `name` for the underlying inputs. Generated when omitted. */\n name?: string;\n /** Names the group. Prefer wrapping in `FieldSet` + `FieldLegend` for a visible label. */\n label?: string;\n size?: CheckControlSize;\n orientation?: RadioGroupOrientation;\n disabled?: boolean;\n invalid?: boolean;\n required?: boolean;\n}\n\n/**\n * Radio group. Matches the `Type=Radio` half of Figma's `Checkbox` set, and shares its\n * geometry through `CheckControl`.\n *\n * Built on real `<input type=\"radio\">` elements sharing a `name`, which is what buys the\n * whole keyboard contract for free: arrow keys move *and* select, only the checked radio is\n * in the tab sequence, and the group is announced as \"2 of 4\". A `div`-based\n * `role=\"radiogroup\"` has to reimplement all of that, and the version of this pattern the\n * library already had — `SegmentedControl` before 0.4.0 — shipped with none of it.\n *\n * `role=\"radiogroup\"` is still set explicitly rather than relying on a `<fieldset>`, so the\n * group works with or without a visible legend.\n */\nexport const RadioGroup = forwardRef<HTMLDivElement, RadioGroupProps>(function RadioGroup(\n {\n children,\n options,\n value: valueProp,\n defaultValue,\n onValueChange,\n name,\n label,\n size = 'md',\n orientation = 'vertical',\n disabled = false,\n invalid = false,\n required = false,\n className,\n ...rest\n },\n ref,\n) {\n const generatedName = useId();\n const [value, setValue] = useControllableState<string | undefined>({\n value: valueProp,\n defaultValue,\n onChange: onValueChange as ((next: string | undefined) => void) | undefined,\n });\n\n return (\n <RadioGroupContext.Provider\n value={{\n name: name ?? generatedName,\n value,\n setValue: (next) => setValue(next),\n size,\n disabled,\n invalid,\n }}\n >\n <div\n ref={ref}\n role=\"radiogroup\"\n aria-label={label}\n aria-required={required || undefined}\n aria-invalid={invalid || undefined}\n aria-orientation={orientation}\n data-slot=\"radio-group\"\n className={clsx(\n 'flex',\n orientation === 'vertical' ? 'flex-col gap-2.5' : 'flex-row flex-wrap gap-4',\n className,\n )}\n {...rest}\n >\n {options\n ? options.map((option) => (\n <Radio\n key={option.value}\n value={option.value}\n label={option.label}\n description={option.description}\n disabled={option.disabled}\n />\n ))\n : children}\n </div>\n </RadioGroupContext.Provider>\n );\n});\n\nexport interface RadioProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'onChange' | 'checked'> {\n value: string;\n label?: ReactNode;\n /** Second line under the label. Matches Figma's `Supporting text` axis. */\n description?: ReactNode;\n /**\n * Standalone only (outside a `RadioGroup`): whether this radio is the selected one. Inside a\n * group the group's `value` decides, and this is ignored. New in 0.9.5.\n */\n checked?: boolean;\n /** Standalone only: called with `true` when the user selects this radio. New in 0.9.5. */\n onCheckedChange?: (checked: boolean) => void;\n /** Standalone only; a group sets it for its radios. New in 0.9.5. */\n size?: CheckControlSize;\n /** Standalone only; a group sets it for its radios. New in 0.9.5. */\n invalid?: boolean;\n className?: string;\n}\n\nconst LABEL_TEXT: Record<CheckControlSize, string> = {\n sm: 'text-body-tiny',\n md: 'text-body-xs',\n};\n\n/**\n * One radio. Inside a `RadioGroup` it takes its name, value and state from the group.\n *\n * From 0.9.5 it also works **standalone**, for radios a group's wrapper cannot hold, such as one\n * per row of a table (\"Make this the default\"). Give every radio of the set the same `name`,\n * control `checked`, and handle `onCheckedChange`. Native radios that share a name are one group\n * wherever they sit in the DOM, so arrow keys, the single tab stop and \"2 of 4\" still work. Name\n * the set with the column header, and name each radio with `aria-label` when it has no `label`.\n * This is MUI's standalone `Radio`; a `div role=\"radiogroup\"` around a whole table would put the\n * table's other controls inside the group.\n */\nexport const Radio = forwardRef<HTMLInputElement, RadioProps>(function Radio(\n {\n value,\n label,\n description,\n disabled,\n id,\n className,\n checked: checkedProp,\n onCheckedChange,\n size: sizeProp,\n invalid: invalidProp,\n name: nameProp,\n ...props\n },\n ref,\n) {\n const group = useContext(RadioGroupContext);\n if (!group && !nameProp) {\n devWarn('A standalone <Radio> needs a `name` shared by its set: without one, each radio is a group of its own.');\n }\n\n const generatedId = useId();\n const controlId = id ?? generatedId;\n const descriptionId = `${controlId}-description`;\n const isDisabled = disabled ?? group?.disabled ?? false;\n const checked = group ? group.value === value : Boolean(checkedProp);\n const size = group?.size ?? sizeProp ?? 'md';\n const invalid = group?.invalid ?? invalidProp ?? false;\n const name = group?.name ?? nameProp;\n const select = () => (group ? group.setValue(value) : onCheckedChange?.(true));\n\n return (\n <div className={clsx('flex flex-col', className)}>\n <label\n htmlFor={controlId}\n className={clsx(\n // relative: the hidden input is absolutely positioned (sr-only). Without a positioned\n // ancestor here its box lands far up the page, and focusing it on click scrolled a\n // scrolling container to that spot, away from the control.\n 'group relative inline-flex items-start gap-2.5',\n isDisabled ? 'cursor-not-allowed opacity-60' : 'cursor-pointer',\n )}\n >\n <input\n ref={ref}\n id={controlId}\n type=\"radio\"\n name={name}\n value={value}\n checked={checked}\n disabled={isDisabled}\n aria-invalid={!group && invalid ? true : undefined}\n aria-describedby={description ? descriptionId : undefined}\n onChange={select}\n className=\"peer sr-only\"\n {...props}\n />\n <CheckControl type=\"radio\" checked={checked} disabled={isDisabled} invalid={invalid} size={size} />\n {label && <span className={clsx(LABEL_TEXT[size], 'text-default')}>{label}</span>}\n </label>\n {/* Outside the <label> — see the note in `Checkbox`. Text nested in a label becomes\n part of the accessible *name*, so the description would be read twice: once as\n the name and again as the description. */}\n {description && (\n <span\n id={descriptionId}\n className={clsx(\n 'mt-0.5 pl-[26px]',\n LABEL_TEXT[size],\n isDisabled ? 'text-disabled' : 'text-default-secondary',\n )}\n >\n {description}\n </span>\n )}\n </div>\n );\n});\n","import clsx from 'clsx';\nimport { useRovingFocus } from '../../lib/use-roving-focus';\nimport { useControllableState } from '../../lib/use-controllable-state';\n\nexport interface SegmentedControlOption {\n value: string;\n label: string;\n disabled?: boolean;\n}\n\nexport interface SegmentedControlProps {\n options: SegmentedControlOption[];\n /** Controlled selection. Omit and pass `defaultValue` for uncontrolled. */\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n /** Names the group. Required by the APG when the control has no visible label. */\n label?: string;\n className?: string;\n}\n\n/**\n * Single-select segmented toggle.\n *\n * Through 0.3.0 this had **no ARIA whatsoever** — the selected segment was distinguished\n * only by `bg-default shadow-panel`, so a screen reader user could not tell which of the\n * segments was active. It is single-select, so `radiogroup`/`radio` is the correct pattern\n * rather than a row of `aria-pressed` buttons: it announces \"2 of 3\" and lets the arrow\n * keys move between options, which a toggle-button group does not.\n *\n * `onChange` was also optional, so `<SegmentedControl options value />` rendered a control\n * that looked interactive and silently did nothing.\n */\nexport function SegmentedControl({\n options,\n value: valueProp,\n defaultValue,\n onValueChange,\n label,\n className,\n}: SegmentedControlProps) {\n const [value, setValue] = useControllableState({\n value: valueProp,\n defaultValue: defaultValue ?? options[0]?.value,\n onChange: onValueChange,\n });\n\n const selectedIndex = Math.max(\n 0,\n options.findIndex((option) => option.value === value),\n );\n\n const roving = useRovingFocus({\n orientation: 'horizontal',\n loop: true,\n defaultIndex: selectedIndex,\n });\n\n return (\n <div\n role=\"radiogroup\"\n aria-label={label}\n className={clsx(\n 'inline-flex items-center rounded-xl border border-default bg-default-secondary p-0.5',\n className,\n )}\n {...roving.containerProps}\n >\n {options.map((option, index) => {\n const selected = option.value === value;\n const itemProps = roving.itemProps(index, {\n disabled: option.disabled,\n label: option.label,\n });\n\n return (\n <button\n key={option.value}\n type=\"button\"\n role=\"radio\"\n aria-checked={selected}\n disabled={option.disabled}\n {...itemProps}\n // The tab stop follows selection, not focus, so Tab lands on the active\n // segment rather than wherever the arrows were last used.\n tabIndex={selected ? 0 : -1}\n onFocus={() => {\n itemProps.onFocus();\n if (!option.disabled) setValue(option.value);\n }}\n onClick={() => !option.disabled && setValue(option.value)}\n className={clsx(\n 'rounded-lg px-3.5 py-1.5 text-body-xs font-medium transition-colors',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default-secondary',\n 'disabled:cursor-not-allowed disabled:opacity-50',\n selected\n ? 'bg-default text-default shadow-panel'\n : 'text-default-secondary hover:text-default',\n )}\n >\n {option.label}\n </button>\n );\n })}\n </div>\n );\n}\n","import { useMemo } from 'react';\n\nimport { Combobox, type ComboboxOption, type ComboboxProps } from './combobox';\n\nexport interface TimeZoneSelectProps\n extends Omit<ComboboxProps<string>, 'options' | 'filter' | 'renderOption'> {\n /** Restrict the list to these IANA zone names. Default: every zone the runtime supports. */\n timeZones?: readonly string[];\n /**\n * The instant offsets are computed for. Default: now. Offsets move with daylight saving,\n * so a fixed date is mainly useful for tests and screenshots.\n */\n at?: Date;\n}\n\n/**\n * Renamed zones, old name → current IANA name. Chromium's ICU still lists the old names\n * (`Asia/Calcutta`, not `Asia/Kolkata`), so without this a search for Kolkata finds nothing\n * and a stored `Asia/Kolkata` matches no option.\n */\nconst RENAMED: Record<string, string> = {\n 'America/Godthab': 'America/Nuuk',\n 'Asia/Calcutta': 'Asia/Kolkata',\n 'Asia/Katmandu': 'Asia/Kathmandu',\n 'Asia/Rangoon': 'Asia/Yangon',\n 'Asia/Saigon': 'Asia/Ho_Chi_Minh',\n 'Atlantic/Faeroe': 'Atlantic/Faroe',\n 'Europe/Kiev': 'Europe/Kyiv',\n 'Pacific/Enderbury': 'Pacific/Kanton',\n 'Pacific/Ponape': 'Pacific/Pohnpei',\n 'Pacific/Truk': 'Pacific/Chuuk',\n};\n\n/** The current IANA name for a zone: `Asia/Kolkata` for `Asia/Calcutta`. */\nexport const currentZoneName = (zone: string): string => RENAMED[zone] ?? zone;\n\n/** `Intl.supportedValuesOf` is ES2022 and missing from older runtimes — read it defensively. */\nfunction supportedTimeZones(): string[] {\n const intl = Intl as typeof Intl & { supportedValuesOf?: (key: 'timeZone') => string[] };\n try {\n const zones = intl.supportedValuesOf?.('timeZone');\n if (zones && zones.length > 0) return zones;\n } catch {\n // Fall through.\n }\n return ['UTC'];\n}\n\n/** `\"+05:30\"` for Asia/Colombo. Minutes east of UTC are returned alongside for sorting. */\nexport function timeZoneOffset(timeZone: string, at: Date = new Date()): { label: string; minutes: number } {\n try {\n const part = new Intl.DateTimeFormat('en-US', { timeZone, timeZoneName: 'longOffset' })\n .formatToParts(at)\n .find((p) => p.type === 'timeZoneName')?.value;\n // \"GMT+05:30\", \"GMT-03:00\", or bare \"GMT\" for UTC itself.\n const match = part?.match(/GMT([+-])(\\d{2}):(\\d{2})/);\n if (!match) return { label: '+00:00', minutes: 0 };\n const [, sign, hh, mm] = match;\n const minutes = (Number(hh) * 60 + Number(mm)) * (sign === '-' ? -1 : 1);\n return { label: `${sign}${hh}:${mm}`, minutes };\n } catch {\n return { label: '+00:00', minutes: 0 };\n }\n}\n\n/**\n * One option per zone, labelled `(UTC+05:30) Asia/Colombo`, west to east then by name.\n * Renamed zones are listed under their current name, once.\n */\nexport function timeZoneOptions(\n zones: readonly string[] = supportedTimeZones(),\n at: Date = new Date(),\n): ComboboxOption<string>[] {\n return Array.from(new Set(zones.map(currentZoneName)))\n .map((zone) => ({ zone, minutes: timeZoneOffset(zone, at).minutes }))\n .sort((a, b) => a.minutes - b.minutes || a.zone.localeCompare(b.zone))\n .map(({ zone }) => zoneOption(zone, at));\n}\n\nconst zoneOption = (zone: string, at: Date): ComboboxOption<string> => ({\n value: zone,\n label: `(UTC${timeZoneOffset(zone, at).label}) ${zone.replace(/_/g, ' ')}`,\n});\n\n/**\n * Searchable IANA time-zone picker. The value is the zone name (`\"Asia/Colombo\"`), never an\n * offset: an offset changes with daylight saving and cannot be turned back into a zone.\n *\n * Labels show the current UTC offset, and the query matches the zone name with or without\n * underscores and the offset itself, so `colombo`, `new york` and `+05:30` all find a zone.\n * A value missing from the list — stored under another name, or outside `timeZones` — is\n * still listed, so a saved zone never renders as an empty field.\n */\nexport function TimeZoneSelect({\n timeZones,\n at,\n placeholder = 'Select a time zone…',\n emptyMessage = 'No time zones match',\n ...props\n}: TimeZoneSelectProps) {\n // `at` is a Date, so depend on its timestamp rather than its identity.\n const atTime = at?.getTime();\n const keep = [props.value, props.defaultValue].filter((v): v is string => !!v);\n const keepKey = keep.join('|');\n const options = useMemo(() => {\n const when = atTime === undefined ? new Date() : new Date(atTime);\n const list = timeZoneOptions(timeZones, when);\n const missing = keep.filter((v) => !list.some((o) => o.value === v));\n return [...missing.map((v) => zoneOption(v, when)), ...list];\n // `keep` is rebuilt every render; `keepKey` is its stable identity.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [timeZones, atTime, keepKey]);\n\n return (\n <Combobox\n {...props}\n options={options}\n placeholder={placeholder}\n emptyMessage={emptyMessage}\n filter={(option, query) => {\n const q = query.trim().toLowerCase();\n return option.label.toLowerCase().includes(q) || option.value.toLowerCase().includes(q);\n }}\n />\n );\n}\n","import { useEffect, useRef, useState } from 'react';\nimport type { SelectOption } from './select';\n\nexport interface DependentOptions<T = SelectOption> {\n /** Choices for the parent's current value. Empty while loading, when the parent is empty, or if loading failed. */\n options: T[];\n /** True from the moment the parent value changes until `load` answers. */\n loading: boolean;\n}\n\n/**\n * Choices of a field that depend on another field's value, fetched asynchronously, e.g. the\n * departments of the chosen role. New in 0.10.0 (from Cleo's form work).\n *\n * Calls `load(parentValue)` every time the parent value changes and ignores answers that arrive\n * after the parent has changed again. An empty parent loads nothing. The options are tied to the\n * parent value they were loaded for, so a stale list is never shown for a new parent. A `load`\n * that fails gives no options.\n *\n * Pass `loading` to the `Form` select or combobox field, which then shows \"Loading…\".\n * Clearing the dependent field's own value when the parent changes is up to the form: do it in\n * the parent field's `onValueChange`.\n *\n * ```tsx\n * const { options, loading } = useDependentOptions(values.role ?? '', loadDepartments);\n * const fields = [\n * { type: 'select', name: 'role', label: 'Role', options: roles,\n * onValueChange: (_, ctx) => ctx.setField('department', null) },\n * { type: 'select', name: 'department', label: 'Department', options, loading,\n * disabled: (v) => !v.role },\n * ];\n * ```\n */\nexport function useDependentOptions<T = SelectOption>(\n parentValue: string,\n load: (parentValue: string) => Promise<T[]>,\n): DependentOptions<T> {\n const [loaded, setLoaded] = useState<{ parent: string; options: T[] } | null>(null);\n\n // Always call the latest `load` without making callers memoize it.\n const loadRef = useRef(load);\n useEffect(() => {\n loadRef.current = load;\n });\n\n useEffect(() => {\n if (!parentValue) return;\n let stale = false;\n loadRef\n .current(parentValue)\n .catch(() => [] as T[])\n .then((options) => {\n if (!stale) setLoaded({ parent: parentValue, options });\n });\n return () => {\n stale = true;\n };\n }, [parentValue]);\n\n const ready = loaded !== null && loaded.parent === parentValue;\n return {\n options: parentValue && ready ? loaded.options : [],\n loading: !!parentValue && !ready,\n };\n}\n","/**\n * The 0.10.0 names of `Form` and its types, kept so code written against 0.10.0 still compiles.\n * 0.10.0 published the component as `SchemaForm`; 0.10.1 renamed it `Form`. These will be removed\n * in a later minor release.\n */\nimport { Form } from './form';\nimport type { FormActionsApi, FormProps } from './form';\nimport type {\n FormCheckField,\n FormComboboxField,\n FormCountryField,\n FormCustomField,\n FormDateField,\n FormErrors,\n FormField,\n FormFieldBase,\n FormFieldContext,\n FormFieldSize,\n FormFieldType,\n FormLayout,\n FormListField,\n FormRadioField,\n FormResult,\n FormSegmentedField,\n FormSelectField,\n FormState,\n FormStep,\n FormSubmitOn,\n FormTextareaField,\n FormTextField,\n FormTextType,\n FormTimeZoneField,\n FormValues,\n} from './form.types';\n\n/** @deprecated Since 0.10.1. Use `Form`. */\nexport const SchemaForm = Form;\n\n/** @deprecated Since 0.10.1. Use `FormProps`. */\nexport type SchemaFormProps<V extends object = FormValues> = FormProps<V>;\n/** @deprecated Since 0.10.1. Use `FormActionsApi`. */\nexport type SchemaFormActionsApi = FormActionsApi;\n/** @deprecated Since 0.10.1. Use `FormValues`. */\nexport type SchemaFormValues = FormValues;\n/** @deprecated Since 0.10.1. Use `FormResult`. */\nexport type SchemaFormResult = FormResult;\n/** @deprecated Since 0.10.1. Use `FormErrors`. */\nexport type SchemaFormErrors = FormErrors;\n/** @deprecated Since 0.10.1. Use `FormState`. */\nexport type SchemaFormState = FormState;\n/** @deprecated Since 0.10.1. Use `FormLayout`. */\nexport type SchemaFormLayout = FormLayout;\n/** @deprecated Since 0.10.1. Use `FormSubmitOn`. */\nexport type SchemaFormSubmitOn = FormSubmitOn;\n/** @deprecated Since 0.10.1. Use `FormStep`. */\nexport type SchemaFormStep = FormStep;\n/** @deprecated Since 0.10.1. Use `FormField`. */\nexport type SchemaFormField<V extends object = FormValues> = FormField<V>;\n/** @deprecated Since 0.10.1. Use `FormFieldType`. */\nexport type SchemaFormFieldType = FormFieldType;\n/** @deprecated Since 0.10.1. Use `FormFieldBase`. */\nexport type SchemaFormFieldBase<V extends object = FormValues> = FormFieldBase<V>;\n/** @deprecated Since 0.10.1. Use `FormFieldContext`. */\nexport type SchemaFormFieldContext<V extends object = FormValues> = FormFieldContext<V>;\n/** @deprecated Since 0.10.1. Use `FormFieldSize`. */\nexport type SchemaFormFieldSize = FormFieldSize;\n/** @deprecated Since 0.10.1. Use `FormTextType`. */\nexport type SchemaFormTextType = FormTextType;\n/** @deprecated Since 0.10.1. Use `FormTextField`. */\nexport type SchemaFormTextField<V extends object = FormValues> = FormTextField<V>;\n/** @deprecated Since 0.10.1. Use `FormTextareaField`. */\nexport type SchemaFormTextareaField<V extends object = FormValues> = FormTextareaField<V>;\n/** @deprecated Since 0.10.1. Use `FormSelectField`. */\nexport type SchemaFormSelectField<V extends object = FormValues> = FormSelectField<V>;\n/** @deprecated Since 0.10.1. Use `FormComboboxField`. */\nexport type SchemaFormComboboxField<V extends object = FormValues> = FormComboboxField<V>;\n/** @deprecated Since 0.10.1. Use `FormCountryField`. */\nexport type SchemaFormCountryField<V extends object = FormValues> = FormCountryField<V>;\n/** @deprecated Since 0.10.1. Use `FormTimeZoneField`. */\nexport type SchemaFormTimeZoneField<V extends object = FormValues> = FormTimeZoneField<V>;\n/** @deprecated Since 0.10.1. Use `FormRadioField`. */\nexport type SchemaFormRadioField<V extends object = FormValues> = FormRadioField<V>;\n/** @deprecated Since 0.10.1. Use `FormSegmentedField`. */\nexport type SchemaFormSegmentedField<V extends object = FormValues> = FormSegmentedField<V>;\n/** @deprecated Since 0.10.1. Use `FormDateField`. */\nexport type SchemaFormDateField<V extends object = FormValues> = FormDateField<V>;\n/** @deprecated Since 0.10.1. Use `FormCheckField`. */\nexport type SchemaFormCheckField<V extends object = FormValues> = FormCheckField<V>;\n/** @deprecated Since 0.10.1. Use `FormListField`. */\nexport type SchemaFormListField<V extends object = FormValues> = FormListField<V>;\n/** @deprecated Since 0.10.1. Use `FormCustomField`. */\nexport type SchemaFormCustomField<V extends object = FormValues> = FormCustomField<V>;\n","import type { ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { XIcon } from 'lucide-react';\n\nexport type BadgeColor = 'gray' | 'red' | 'yellow' | 'lime' | 'green' | 'teal' | 'blue' | 'pink' | 'slate' | 'violet';\n\n/**\n * Every `BadgeColor`, in a stable order: the library's categorical palette. Index it to give\n * data a colour of its own, e.g. a company's tile `BADGE_COLORS[hash % BADGE_COLORS.length]`,\n * instead of keeping a list of hex values in the app. New in 0.9.5.\n */\nexport const BADGE_COLORS: readonly BadgeColor[] = ['blue', 'green', 'violet', 'yellow', 'teal', 'pink', 'lime', 'red', 'slate', 'gray'];\nexport type BadgeSize = 'sm' | 'lg';\nexport type BadgeVariant = 'default' | 'subtle';\n\nexport interface BadgeProps {\n label: string;\n color?: BadgeColor;\n size?: BadgeSize;\n variant?: BadgeVariant;\n indicator?: boolean;\n /**\n * A leading glyph, e.g. `<LockIcon />` on a \"System\" badge. Decorative: the label names the\n * badge, so the glyph is hidden from assistive tech and sized to the badge. New in 0.9.5.\n */\n icon?: ReactNode;\n /** Makes the badge removable: an × button named \"Remove {label}\". Same name as on `TagPill`. */\n onRemove?: () => void;\n /** @deprecated Renamed `onRemove` in 0.9.0, to match `TagPill`. Still works. */\n onClose?: () => void;\n className?: string;\n}\n\nconst defaultClasses: Record<BadgeColor, string> = {\n gray: 'bg-badge-gray text-badge-gray',\n red: 'bg-badge-red text-badge-red',\n yellow: 'bg-badge-yellow text-badge-yellow',\n lime: 'bg-badge-lime text-badge-lime',\n green: 'bg-badge-green text-badge-green',\n teal: 'bg-badge-teal text-badge-teal',\n blue: 'bg-badge-blue text-badge-blue',\n pink: 'bg-badge-pink text-badge-pink',\n slate: 'bg-badge-slate text-badge-slate',\n violet: 'bg-badge-violet text-badge-violet',\n};\n\n// Subtle is outline-only: the colour's tint is the border and its dark shade the text, the same\n// text colour as the filled variant. Through 0.7.0 every subtle badge used text-default-secondary,\n// so colour carried no meaning in the label.\nconst subtleClasses: Record<BadgeColor, string> = {\n gray: 'border border-badge-gray text-badge-gray',\n red: 'border border-badge-red text-badge-red',\n yellow: 'border border-badge-yellow text-badge-yellow',\n lime: 'border border-badge-lime text-badge-lime',\n green: 'border border-badge-green text-badge-green',\n teal: 'border border-badge-teal text-badge-teal',\n blue: 'border border-badge-blue text-badge-blue',\n pink: 'border border-badge-pink text-badge-pink',\n slate: 'border border-badge-slate text-badge-slate',\n violet: 'border border-badge-violet text-badge-violet',\n};\n\nexport function Badge({\n label,\n color = 'gray',\n size = 'sm',\n variant = 'default',\n indicator = false,\n icon,\n onRemove: onRemoveProp,\n onClose,\n className,\n}: BadgeProps) {\n const onRemove = onRemoveProp ?? onClose;\n const isDefault = variant === 'default';\n\n return (\n <span\n data-variant={variant}\n className={clsx(\n 'inline-flex items-center rounded-full px-2 py-0.5',\n size === 'sm' ? 'gap-1' : 'gap-1.5',\n isDefault ? defaultClasses[color] : subtleClasses[color],\n className,\n )}\n >\n {indicator && (\n <span\n className={clsx(\n 'shrink-0 rounded-full bg-current',\n size === 'sm' ? 'h-1.5 w-1.5' : 'h-2 w-2',\n )}\n />\n )}\n {icon && (\n <span\n aria-hidden\n className={clsx('inline-flex shrink-0 [&>svg]:h-full [&>svg]:w-full', size === 'sm' ? 'h-3 w-3' : 'h-3.5 w-3.5')}\n >\n {icon}\n </span>\n )}\n <span\n className={clsx(\n 'whitespace-nowrap',\n size === 'sm'\n ? clsx('text-body-tiny', isDefault && 'font-semibold')\n : 'text-body-xs',\n )}\n >\n {label}\n </span>\n {onRemove && (\n <button\n type=\"button\"\n onClick={onRemove}\n className={clsx(\n 'inline-flex shrink-0 items-center justify-center rounded-full opacity-60 transition-opacity hover:opacity-100',\n size === 'sm' ? 'h-3 w-3' : 'h-4 w-4',\n )}\n // Was a hardcoded \"Remove\", so a row of five dismissible badges produced five\n // identically named buttons with nothing to tell them apart.\n aria-label={`Remove ${label}`}\n >\n <XIcon className=\"h-full w-full\" strokeWidth={2.5} aria-hidden />\n </button>\n )}\n </span>\n );\n}\n","import clsx from 'clsx';\n\n/**\n * The nine-hue categorical palette from `badge.css`, which is what roles want: a role is a\n * *category*, not a severity, so it must not borrow the semantic tones — a `danger`-coloured\n * role badge would imply the role itself is a problem.\n */\nexport type RoleBadgeTone =\n | 'slate'\n | 'blue'\n | 'green'\n | 'yellow'\n | 'red'\n | 'pink'\n | 'violet'\n | 'teal'\n | 'lime'\n | 'gray';\n\nexport interface RoleBadgeProps {\n role: string;\n size?: 'sm' | 'md';\n /**\n * Override the name-map lookup. Use this for roles the map does not know, in preference to\n * `color` — it stays on the token layer and re-themes with the rest of the badge palette.\n */\n tone?: RoleBadgeTone;\n /**\n * @deprecated Bypasses the design tokens — pass `tone` instead. Raw 6-digit hex; text uses\n * the hex and the background a 12% tint of it. Kept for role colours that genuinely come\n * from API data rather than from the design system.\n */\n color?: string | null;\n}\n\n/**\n * Role → palette hue.\n *\n * Through 0.4.0 this was ten hardcoded hex pairs, thirteen of whose twenty values sat off\n * the palette entirely. `Compliance Lead` was the worst: `#5b3da8`, a violet with no ramp in\n * `Color Primitives` at all — a gap `status.css` had already documented for `accent`.\n *\n * Hues were chosen by comparing the original hex against the resolved palette, not by eye.\n * Several land almost exactly:\n *\n * Auditor / Viewer #f5f5f5 / #757575 → gray #f5f5f5 / #757575 (exact)\n * admin family #e9eff7 / #0c2d58 → slate #f1f1f5 / #0c2d58 (text exact)\n * Entity Manager #fbe6cf / #9a6206 → yellow #feedcf / #996100\n * Intelligence Analyst #fde2e7 / #a3284a → red #fce9eb / #bb223a\n * Reviewer #dbeafe / #1d4ed8 → blue\n * Requester #e6f4ea / #1f7a3d → green\n *\n * `Compliance Lead` was reassigned to pink through 0.8.x, because the palette had no violet.\n * From 0.9.0 it is `violet` again, the original #ece6f7 / #5b3da8: the hue is the role's\n * identity, and pink read as a different role. The palette's violet is literal values (see\n * `status.css`), since the primitives have no violet ramp. `teal` and `lime` are deliberately\n * left free for roles added later.\n */\nconst ROLE_TONES: Record<string, RoleBadgeTone> = {\n 'Super Admin': 'slate',\n 'Admin': 'slate',\n 'User': 'slate',\n 'Compliance Lead': 'violet',\n 'Reviewer': 'blue',\n 'Requester': 'green',\n 'Entity Manager': 'yellow',\n 'Intelligence Analyst': 'red',\n 'Auditor': 'gray',\n 'Viewer': 'gray',\n};\n\nconst FALLBACK_TONE: RoleBadgeTone = 'gray';\n\n/**\n * `bg-badge-*` resolves to `--badge-*-bg` and `text-badge-*` to `--badge-*-text`, so each\n * pair is the label/on-label duo the palette was designed around.\n */\nconst TONE_STYLES: Record<RoleBadgeTone, string> = {\n slate: 'bg-badge-slate text-badge-slate',\n blue: 'bg-badge-blue text-badge-blue',\n green: 'bg-badge-green text-badge-green',\n yellow: 'bg-badge-yellow text-badge-yellow',\n red: 'bg-badge-red text-badge-red',\n pink: 'bg-badge-pink text-badge-pink',\n violet: 'bg-badge-violet text-badge-violet',\n teal: 'bg-badge-teal text-badge-teal',\n lime: 'bg-badge-lime text-badge-lime',\n gray: 'bg-badge-gray text-badge-gray',\n};\n\nconst HEX6 = /^#[0-9a-fA-F]{6}$/;\n\nexport function RoleBadge({ role, size = 'sm', tone, color }: RoleBadgeProps) {\n // The raw-hex path stays for data-driven colour, but it no longer wins by default: a\n // caller has to opt into leaving the token layer.\n const rawColor = color && HEX6.test(color) ? color : undefined;\n const resolved = tone ?? ROLE_TONES[role] ?? FALLBACK_TONE;\n\n return (\n <span\n data-tone={tone}\n // A long custom role name ellipsises inside a narrow cell or header row instead of\n // pushing its neighbours, with the full name as a `title`. SCIC's original did this;\n // the 0.7.0 port lost it, and 0.9.1 restores it. The inner span carries the\n // ellipsis, because text-overflow does not apply to an inline-flex box's own text.\n title={role}\n className={clsx(\n 'inline-flex max-w-full items-center rounded-full font-medium whitespace-nowrap align-middle',\n size === 'sm' ? 'px-2 py-0.5 text-body-tiny' : 'px-3 py-1 text-body-xs',\n !rawColor && TONE_STYLES[resolved],\n )}\n style={rawColor ? { backgroundColor: `${rawColor}1F`, color: rawColor } : undefined}\n >\n <span className=\"min-w-0 truncate\">{role}</span>\n </span>\n );\n}\n","import { RoleBadge } from '../status/role-badge';\nimport { Combobox, type ComboboxOption } from './combobox';\nimport type { InputSize } from './input';\n\nexport interface RoleOption {\n role: string;\n description: string;\n}\n\nexport const ROLE_COMBO_OPTIONS: RoleOption[] = [\n { role: 'Reviewer', description: 'Reviews onboarding requests' },\n { role: 'Admin', description: 'Full org control' },\n { role: 'Compliance Lead', description: 'Owns compliance' },\n { role: 'Requester', description: 'Creates onboarding requests' },\n { role: 'Viewer', description: 'Read-only access' },\n { role: 'User', description: 'Default user access' },\n];\n\nexport interface RoleComboBoxProps {\n value: string;\n onChange: (role: string) => void;\n options?: RoleOption[];\n /** Accessible name. Defaults to `Role`. */\n label?: string;\n size?: InputSize;\n disabled?: boolean;\n className?: string;\n}\n\n/**\n * Role picker.\n *\n * Rebuilt in 0.4.0 as a thin wrapper over `Combobox`, which is all it should ever have been.\n * The version it replaces was the least correct component in the library and is worth\n * recording, because every one of these was a category of bug rather than a detail:\n *\n * - `role=\"combobox\"` sat on a `<div>` while the real `<input>` had no role and none of the\n * state attributes. Under ARIA 1.2 the role belongs on the input.\n * - The `role=\"listbox\"` had no `id`, so `aria-controls` could not point at it, and there\n * was no `aria-activedescendant` at all.\n * - No arrow keys, no Home/End, no wrap. The **selected** option had no `tabIndex`, so it\n * was mouse-only, while every *other* option was individually tabbable.\n * - Escape worked on the trigger but not on the search input or the options, and closing\n * never returned focus to the trigger.\n * - The tick was a literal `✓` text node, announced as \"check mark\" mid-option.\n * - It bypassed the token system entirely — `border-blue-500`, `bg-white`, `bg-blue-50`,\n * `text-blue-600`, `text-sm` — and built its className with a template literal. Both are\n * explicitly against the rules in CLAUDE.md, and the raw colours meant it would not theme.\n *\n * It stays a preset rather than becoming `Combobox` usage at every call site only because it\n * renders a `RoleBadge` per option, which `renderOption` exists for.\n */\nexport function RoleComboBox({\n value,\n onChange,\n options = ROLE_COMBO_OPTIONS,\n label = 'Role',\n size = 'md',\n disabled = false,\n className,\n}: RoleComboBoxProps) {\n const comboboxOptions: ComboboxOption[] = options.map((option) => ({\n value: option.role,\n label: option.role,\n description: option.description,\n }));\n\n return (\n <Combobox\n options={comboboxOptions}\n value={value}\n onValueChange={(next) => next && onChange(next)}\n label={label}\n size={size}\n disabled={disabled}\n // A role is always set — there is no \"no role\" state — so re-selecting must not clear.\n clearable={false}\n emptyMessage=\"No roles match\"\n className={className}\n renderOption={(option) => (\n <>\n <RoleBadge role={option.value} size=\"sm\" />\n <span className=\"min-w-0 flex-1 truncate text-body-xs text-default-secondary\">\n {option.description}\n </span>\n </>\n )}\n />\n );\n}\n","import { useEffect, useId, useMemo, useRef, useState, type ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { SearchIcon } from 'lucide-react';\n\nimport { SCROLLBAR_CLASSES } from '../../lib/scrollbar';\n\nimport {\n OVERLAY_HEADING,\n OVERLAY_ITEM_ACTIVE,\n OVERLAY_ITEM_BASE,\n OVERLAY_ITEM_SIZE,\n} from '../overlays/menu-styles';\n\nexport interface CommandItem {\n id: string;\n label: string;\n description?: string;\n /** Group heading. Items sharing a group render together, in the order given. */\n group?: string;\n icon?: ReactNode;\n /** Trailing hint — pass `<Kbd>` elements. */\n shortcut?: ReactNode;\n /** Extra words to match on that are not in the label — synonyms, the old name of a page. */\n keywords?: string[];\n disabled?: boolean;\n onSelect: () => void;\n}\n\nexport interface CommandProps {\n items: CommandItem[];\n /** Accessible name. Default `Command palette`. */\n label?: string;\n placeholder?: string;\n emptyMessage?: ReactNode;\n /** Called after any item is chosen — usually closes the containing dialog. */\n onAfterSelect?: () => void;\n autoFocus?: boolean;\n className?: string;\n}\n\n/**\n * A ⌘K command palette — filter over *actions* and run one.\n *\n * The same ARIA combobox pattern as `Combobox`, and for the same reasons: `role=\"combobox\"`\n * on the input, focus never leaving it, and `aria-activedescendant` carrying the highlight.\n * What differs is the intent, and it changes two behaviours:\n *\n * - Items are **commands, not values**. There is no selected state to display, no way to\n * clear, and choosing one runs a callback rather than setting anything.\n * - Matching includes `keywords`, so \"logout\" can find \"Sign out\" — a palette is useless if\n * you have to already know the wording.\n *\n * This is the palette body only. Put it in a `Modal` for the usual ⌘K overlay; keeping the\n * two separate means the palette can also be embedded in a page or a `Popover`, and the\n * dialog semantics stay with the component that owns them.\n *\n * A live region reports the result count, because otherwise a screen reader user typing into\n * the filter gets no feedback that the list changed underneath them.\n */\nexport function Command({\n items,\n label = 'Command palette',\n placeholder = 'Type a command or search…',\n emptyMessage = 'No results',\n onAfterSelect,\n autoFocus = true,\n className,\n}: CommandProps) {\n const [query, setQuery] = useState('');\n const [activeIndex, setActiveIndex] = useState(0);\n\n const baseId = useId();\n const listboxId = `${baseId}-listbox`;\n const optionId = (index: number) => `${baseId}-option-${index}`;\n\n const listRef = useRef<HTMLDivElement>(null);\n\n const matches = useMemo(() => {\n if (!query) return items;\n const q = query.toLowerCase();\n return items.filter((item) => {\n if (item.label.toLowerCase().includes(q)) return true;\n if (item.group?.toLowerCase().includes(q)) return true;\n return item.keywords?.some((keyword) => keyword.toLowerCase().includes(q)) ?? false;\n });\n }, [items, query]);\n\n useEffect(() => {\n setActiveIndex(0);\n }, [query]);\n\n useEffect(() => {\n const node = listRef.current?.querySelector(`#${CSS.escape(optionId(activeIndex))}`);\n // Feature-detected — see the same note in `Combobox`. Absent in jsdom and some webviews.\n if (node instanceof Element && typeof node.scrollIntoView === 'function') {\n node.scrollIntoView({ block: 'nearest' });\n }\n });\n\n const run = (item: CommandItem) => {\n if (item.disabled) return;\n item.onSelect();\n onAfterSelect?.();\n };\n\n const move = (delta: number) => {\n if (matches.length === 0) return;\n setActiveIndex((current) => {\n let next = current;\n for (let i = 0; i < matches.length; i++) {\n next = (next + delta + matches.length) % matches.length;\n if (!matches[next]?.disabled) break;\n }\n return next;\n });\n };\n\n let renderedGroup: string | undefined;\n\n return (\n <div className={clsx('relative flex w-full flex-col', className)}>\n <div className=\"flex items-center gap-2 border-b border-default px-3.5 py-3\">\n <SearchIcon aria-hidden className=\"size-4 shrink-0 text-icon-default-secondary\" />\n <input\n role=\"combobox\"\n type=\"text\"\n autoComplete=\"off\"\n // A palette's list is always visible while it is open, so `aria-expanded` is\n // permanently true rather than tracking a collapsed state that never happens.\n aria-expanded\n aria-controls={listboxId}\n aria-autocomplete=\"list\"\n aria-activedescendant={matches.length > 0 ? optionId(activeIndex) : undefined}\n aria-label={label}\n // Autofocus is correct here specifically: a command palette is opened by an\n // explicit gesture (⌘K) whose entire purpose is to start typing, so *not* focusing\n // the input would strand the user. The rule guards against autofocus on ordinary\n // page load, which this is not. Caller can still opt out.\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n value={query}\n placeholder={placeholder}\n onChange={(event) => setQuery(event.target.value)}\n onKeyDown={(event) => {\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n move(1);\n break;\n case 'ArrowUp':\n event.preventDefault();\n move(-1);\n break;\n case 'Home':\n event.preventDefault();\n setActiveIndex(0);\n break;\n case 'End':\n event.preventDefault();\n setActiveIndex(matches.length - 1);\n break;\n case 'Enter':\n if (matches[activeIndex]) {\n event.preventDefault();\n run(matches[activeIndex]);\n }\n break;\n default:\n break;\n }\n }}\n className=\"min-w-0 flex-1 bg-transparent text-body-sm text-default outline-none placeholder:text-default-tertiary\"\n />\n </div>\n\n <div\n ref={listRef}\n id={listboxId}\n role=\"listbox\"\n aria-label={label}\n // Focus stays in the filter input and `aria-activedescendant` carries the\n // highlight, so this must not become a tab stop of its own.\n className={clsx('max-h-80 overflow-y-auto p-1.5', SCROLLBAR_CLASSES)}\n >\n {matches.length === 0 && (\n <p className=\"px-2.5 py-6 text-center text-body-sm text-default-secondary\">\n {emptyMessage}\n </p>\n )}\n {matches.map((item, index) => {\n const isActive = index === activeIndex;\n const groupHeading = item.group !== renderedGroup ? item.group : undefined;\n renderedGroup = item.group;\n\n return (\n <div key={item.id}>\n {groupHeading && (\n <div\n role=\"presentation\"\n className={OVERLAY_HEADING}\n >\n {groupHeading}\n </div>\n )}\n {/* Not focusable by design — see the note in `Combobox`. Focus stays in the\n filter input and `aria-activedescendant` carries the highlight. */}\n {/* eslint-disable-next-line jsx-a11y/interactive-supports-focus, jsx-a11y/click-events-have-key-events */}\n <div\n id={optionId(index)}\n role=\"option\"\n aria-selected={isActive}\n aria-disabled={item.disabled || undefined}\n onPointerDown={(event) => event.preventDefault()}\n onClick={() => run(item)}\n onPointerEnter={() => !item.disabled && setActiveIndex(index)}\n className={clsx(\n OVERLAY_ITEM_BASE,\n OVERLAY_ITEM_SIZE.md,\n 'items-center',\n item.disabled\n ? 'cursor-not-allowed text-disabled'\n : isActive\n ? clsx(OVERLAY_ITEM_ACTIVE, 'text-default')\n : 'text-default',\n )}\n >\n {item.icon && (\n <span aria-hidden className=\"flex size-4 shrink-0 items-center justify-center\">\n {item.icon}\n </span>\n )}\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate\">{item.label}</span>\n {item.description && (\n <span className=\"block truncate text-body-tiny text-default-secondary\">\n {item.description}\n </span>\n )}\n </span>\n {item.shortcut && (\n <span className=\"ml-auto flex shrink-0 items-center gap-1\">{item.shortcut}</span>\n )}\n </div>\n </div>\n );\n })}\n </div>\n\n {/* Typing filters the list silently otherwise — a sighted user sees it shrink, a\n screen reader user gets nothing. */}\n <span aria-live=\"polite\" className=\"sr-only\">\n {`${matches.length} ${matches.length === 1 ? 'result' : 'results'}`}\n </span>\n </div>\n );\n}\n","import clsx from 'clsx';\nimport type { ReactNode } from 'react';\n\n/**\n * The six status tones from the Figma design system.\n * Values live in `src/app/styles/tokens/status.css`; see that file for why they do\n * not derive from the SDS semantic colour families.\n */\nexport type StatusTone =\n | 'neutral'\n | 'info'\n | 'warning'\n | 'caution'\n | 'accent'\n | 'violet'\n | 'positive'\n | 'danger';\n\nexport type StatusBadgeSize = 'sm' | 'md';\n\nconst TONE_STYLES: Record<StatusTone, string> = {\n neutral: 'bg-status-neutral text-status-neutral',\n info: 'bg-status-info text-status-info',\n warning: 'bg-status-warning text-status-warning',\n caution: 'bg-status-caution text-status-caution',\n accent: 'bg-status-accent text-status-accent',\n violet: 'bg-status-violet text-status-violet',\n positive: 'bg-status-positive text-status-positive',\n danger: 'bg-status-danger text-status-danger',\n};\n\nconst DOT_STYLES: Record<StatusTone, string> = {\n neutral: 'bg-status-dot-neutral',\n info: 'bg-status-dot-info',\n warning: 'bg-status-dot-warning',\n caution: 'bg-status-dot-caution',\n accent: 'bg-status-dot-accent',\n violet: 'bg-status-dot-violet',\n positive: 'bg-status-dot-positive',\n danger: 'bg-status-dot-danger',\n};\n\nconst SIZE_STYLES: Record<StatusBadgeSize, string> = {\n sm: 'px-2 py-0.5 text-body-tiny',\n md: 'px-3 py-1 text-body-xs',\n};\n\nexport interface StatusBadgeProps {\n label: string;\n tone?: StatusTone;\n size?: StatusBadgeSize;\n /** Leading dot. On by default — the Figma status pills all carry one. */\n dot?: boolean;\n /**\n * Leading glyph, replacing the dot — e.g. `<CheckIcon className=\"size-3\" />`.\n * Use for states a colour alone under-states, like verified or rejected.\n */\n icon?: ReactNode;\n className?: string;\n}\n\n/**\n * The status pill.\n *\n * Replaces thirteen inline re-implementations of the same markup plus five\n * competing hardcoded hex palettes. Generalises `TableCellStatusPill`, which had\n * this exact markup but required callers to pass raw hex strings.\n *\n * Note this is NOT `StatusChip` — that one renders a label *and a count* and is a\n * different component.\n */\nexport function StatusBadge({\n label,\n tone = 'neutral',\n size = 'md',\n dot = true,\n icon,\n className,\n}: StatusBadgeProps) {\n return (\n <span\n data-tone={tone}\n className={clsx(\n 'inline-flex items-center gap-1.5 rounded-full font-medium leading-tight whitespace-nowrap',\n SIZE_STYLES[size],\n TONE_STYLES[tone],\n className,\n )}\n >\n {icon ? (\n <span className=\"shrink-0\">{icon}</span>\n ) : (\n dot && <span className={clsx('size-1.5 shrink-0 rounded-full', DOT_STYLES[tone])} />\n )}\n {label}\n </span>\n );\n}\n","import clsx from 'clsx';\n\nexport type StatusDotTone = 'brand' | 'positive' | 'warning' | 'danger' | 'neutral' | 'default';\n\nexport interface StatusDotProps {\n tone?: StatusDotTone;\n /** @deprecated Bypasses the design tokens — pass `tone` instead. Raw hex color, overrides `tone` via inline style. Use when the exact source color doesn't match a design token. */\n color?: string;\n className?: string;\n}\n\nconst dotTones: Record<StatusDotTone, string> = {\n brand: 'bg-brand',\n positive:'bg-positive',\n warning: 'bg-warning',\n danger: 'bg-danger',\n neutral: 'bg-neutral',\n default: 'bg-default-tertiary',\n};\n\nexport function StatusDot({ tone = 'default', color, className }: StatusDotProps) {\n return (\n <span\n data-tone={tone}\n className={clsx('inline-block size-1.5 shrink-0 rounded-full', !color && dotTones[tone], className)}\n style={color ? { backgroundColor: color } : undefined}\n />\n );\n}\n","import clsx from 'clsx';\nimport { StatusDot } from './status-dot';\nimport type { StatusDotTone } from './status-dot';\n\nexport interface StatusChipProps {\n label: string;\n count: number | string;\n tone?: StatusDotTone;\n /** @deprecated Bypasses the design tokens — pass `tone` instead. Raw hex dot color, overrides `tone` via inline style. Use when the exact source color doesn't match a design token. */\n dotColor?: string;\n bg?: string;\n className?: string;\n}\n\nexport function StatusChip({ label, count, tone = 'default', dotColor, bg, className }: StatusChipProps) {\n return (\n <span\n data-tone={tone}\n className={clsx(\n 'inline-flex items-center gap-1.5 rounded-full px-3 py-1',\n !bg && 'bg-default-secondary',\n className,\n )}\n style={bg ? { backgroundColor: bg } : undefined}\n >\n <StatusDot tone={tone} color={dotColor} />\n <span className=\"text-body-xs font-medium text-default\">{count}</span>\n <span className=\"text-body-xs text-default-secondary\">{label}</span>\n </span>\n );\n}\n","import clsx from 'clsx';\nimport { StatusDot } from './status-dot';\nimport type { StatusDotTone } from './status-dot';\n\nexport interface CountBadgeProps {\n count: number | string;\n label?: string;\n tone?: StatusDotTone;\n className?: string;\n}\n\nexport function CountBadge({ count, label, tone = 'positive', className }: CountBadgeProps) {\n return (\n <span\n data-tone={tone}\n className={clsx(\n 'inline-flex items-center gap-1.5 rounded-full border border-default px-3 py-1 text-body-xs font-medium text-default',\n className,\n )}\n >\n <StatusDot tone={tone} />\n {count}\n {label && <span className=\"text-default-secondary\">{label}</span>}\n </span>\n );\n}\n","import clsx from 'clsx';\n\nimport type { StatusTone } from './status-badge';\n\nconst DOT: Record<StatusTone, string> = {\n neutral: 'bg-status-dot-neutral',\n info: 'bg-status-dot-info',\n warning: 'bg-status-dot-warning',\n caution: 'bg-status-dot-caution',\n accent: 'bg-status-dot-accent',\n violet: 'bg-status-dot-violet',\n positive: 'bg-status-dot-positive',\n danger: 'bg-status-dot-danger',\n};\n\nexport interface TrailChipProps {\n label: string;\n value: string;\n tone?: StatusTone;\n /**\n * Data-driven dot colour, overriding `tone`. The investigations trail mirrors the\n * severity accent of whichever tree node is selected, and those accents come from\n * the row data rather than the status palette — this is the escape hatch Phase 10\n * classifies as \"genuinely data-driven colour\", not a token bypass.\n */\n dotColor?: string;\n className?: string;\n}\n\n/**\n * Dot + small uppercase label + value, used for the drill-down breadcrumb trail on\n * the investigations page.\n *\n * Promoted from `pages/investigations`, where the dot colour was passed as a raw hex.\n */\nexport function TrailChip({ label, value, tone = 'info', dotColor, className }: TrailChipProps) {\n return (\n <div\n data-tone={tone}\n className={clsx(\n 'flex items-center gap-2 rounded-full border border-default bg-default px-3 py-1.5',\n className,\n )}\n >\n <span\n className={clsx('size-1.5 shrink-0 rounded-full', !dotColor && DOT[tone])}\n style={dotColor ? { backgroundColor: dotColor } : undefined}\n />\n <span className=\"text-body-tiny font-semibold uppercase tracking-wide text-default-secondary\">\n {label}\n </span>\n <span className=\"text-body-xs font-medium text-default\">{value}</span>\n </div>\n );\n}\n","import { StatusBadge, type StatusTone } from './status-badge';\n\nexport type UserAccountStatus = 'active' | 'pending' | 'deactivated';\n\nconst STATUS_META: Record<UserAccountStatus, { label: string; tone: StatusTone }> = {\n active: { label: 'Active', tone: 'positive' },\n // `caution` (pale yellow), not `warning` (orange) — Pending is one step below a\n // warning on the severity ramp, and reads as waiting rather than at risk.\n pending: { label: 'Pending', tone: 'caution' },\n deactivated: { label: 'Deactivated', tone: 'danger' },\n};\n\nexport interface UserStatusPillProps {\n status: UserAccountStatus;\n}\n\n/** Account-status pill. A thin wrapper over `StatusBadge`. */\nexport function UserStatusPill({ status }: UserStatusPillProps) {\n const { label, tone } = STATUS_META[status];\n return <StatusBadge label={label} tone={tone} />;\n}\n","import clsx from 'clsx';\nimport { CheckIcon, CircleAlertIcon, LoaderCircleIcon, MinusIcon, XIcon } from 'lucide-react';\n\n/**\n * States of a compliance check.\n *\n * Union of the two previously-divergent local unions:\n * - `features/entity-detail` had passed | in_progress | pending | action_required\n * - `features/reviewer-detail` had passed | in-progress | failed | pending | waived\n *\n * Note `in_progress` (underscore) is canonical — entity-detail's spelling, which is\n * the one backed by the API. reviewer-detail used `in-progress` (hyphen) in mock data.\n */\nexport type CheckIndicatorStatus =\n | 'passed'\n | 'in_progress'\n | 'action_required'\n | 'failed'\n | 'pending'\n | 'waived';\n\n/**\n * `action_required` and `failed` share the Figma colours and differ only in glyph\n * (`!` vs `✕`); `waived` shares `pending`'s colours and adds a dash.\n */\nconst STATUS_STYLES: Record<CheckIndicatorStatus, string> = {\n passed: 'bg-status-check-passed border-status-check-passed text-status-check-passed',\n in_progress: 'bg-status-check-progress border-status-check-progress text-status-check-progress',\n action_required: 'bg-status-check-failed border-status-check-failed text-status-check-failed',\n failed: 'bg-status-check-failed border-status-check-failed text-status-check-failed',\n pending: 'bg-status-check-pending border-status-check-pending text-status-check-pending',\n waived: 'bg-status-check-pending border-status-check-pending text-status-check-pending',\n};\n\n/**\n * Glyphs — every one now comes from `lucide-react`, so the set is stroke-consistent.\n *\n * The two that used to be typographic: `◐` became `LoaderCircleIcon` (lucide has no\n * half-filled circle, but a partial ring reads as in-progress and is a real icon), and\n * `!` became `CircleAlertIcon`. Both are a small visual change from 0.2.0.\n */\nfunction StatusGlyph({ status }: { status: CheckIndicatorStatus }) {\n switch (status) {\n case 'passed':\n return <CheckIcon className=\"size-3\" strokeWidth={3} aria-hidden />;\n case 'failed':\n return <XIcon className=\"size-3\" strokeWidth={3} aria-hidden />;\n case 'waived':\n return <MinusIcon className=\"size-3\" strokeWidth={3} aria-hidden />;\n case 'in_progress':\n return <LoaderCircleIcon className=\"size-3\" strokeWidth={3} aria-hidden />;\n case 'action_required':\n return <CircleAlertIcon className=\"size-3.5\" strokeWidth={2.5} aria-hidden />;\n case 'pending':\n return null;\n }\n}\n\nexport interface CheckIndicatorProps {\n status: CheckIndicatorStatus;\n /** Accessible label. Without one the indicator is decorative, which is correct when an adjacent text label already names the state. */\n label?: string;\n className?: string;\n}\n\n/**\n * The 22px outlined circle used for compliance-check state in entity and reviewer\n * detail. Ring and glyph share one colour; see the check tokens in\n * `src/app/styles/tokens/status.css`.\n */\nexport function CheckIndicator({ status, label, className }: CheckIndicatorProps) {\n return (\n <div\n data-status={status}\n className={clsx(\n 'flex size-[22px] shrink-0 items-center justify-center rounded-full border-[1.5px]',\n STATUS_STYLES[status],\n className,\n )}\n role={label ? 'img' : undefined}\n aria-label={label}\n aria-hidden={label ? undefined : true}\n >\n <StatusGlyph status={status} />\n </div>\n );\n}\n","import clsx from 'clsx';\nimport type { ReactNode } from 'react';\nimport type { BadgeColor } from './badge';\n\n/** `lg` (56px) is new in 0.9.5, for the status glyph above a result screen's heading. */\nexport type EntityIconBadgeSize = 'sm' | 'md' | 'lg';\nexport type EntityIconBadgeTone = 'default' | 'brand' | 'positive' | 'warning' | 'danger' | 'neutral';\nexport type EntityIconBadgeShape = 'square' | 'circle';\n\nexport interface EntityIconBadgeProps {\n size?: EntityIconBadgeSize;\n tone?: EntityIconBadgeTone;\n /**\n * `square` is the rounded-rect used on entity rows. `circle` is the tinted glyph\n * circle used in modal headers. A prop rather than a `className` override, so it\n * does not depend on Tailwind's stylesheet emit order.\n */\n shape?: EntityIconBadgeShape;\n /**\n * A categorical colour from the badge palette, overriding `tone`: for a mark whose colour\n * identifies the thing rather than its status, e.g. a company's initials tile. Pick it from\n * `BADGE_COLORS` by index. New in 0.9.5.\n */\n hue?: BadgeColor;\n /** @deprecated Bypasses the design tokens — pass `tone` instead. Raw hex background, overrides `tone` via inline style. Use when the exact source color doesn't match a design token. */\n bg?: string;\n iconColor?: string;\n children: ReactNode;\n className?: string;\n}\n\nconst sizeStyles: Record<EntityIconBadgeSize, string> = {\n sm: 'size-8',\n md: 'size-10',\n lg: 'size-14',\n};\n\nconst shapeStyles: Record<EntityIconBadgeShape, Record<EntityIconBadgeSize, string>> = {\n square: { sm: 'rounded-lg', md: 'rounded-xl', lg: 'rounded-2xl' },\n circle: { sm: 'rounded-full', md: 'rounded-full', lg: 'rounded-full' },\n};\n\nconst toneStyles: Record<EntityIconBadgeTone, string> = {\n default: 'bg-default-secondary text-icon-default',\n brand: 'bg-brand-tertiary text-icon-brand',\n positive:'bg-positive-tertiary text-icon-positive',\n warning: 'bg-warning-tertiary text-icon-warning',\n danger: 'bg-danger-tertiary text-icon-danger',\n neutral: 'bg-neutral-tertiary text-icon-neutral',\n};\n\nconst hueStyles: Record<BadgeColor, string> = {\n gray: 'bg-badge-gray text-badge-gray',\n red: 'bg-badge-red text-badge-red',\n yellow: 'bg-badge-yellow text-badge-yellow',\n lime: 'bg-badge-lime text-badge-lime',\n green: 'bg-badge-green text-badge-green',\n teal: 'bg-badge-teal text-badge-teal',\n blue: 'bg-badge-blue text-badge-blue',\n pink: 'bg-badge-pink text-badge-pink',\n slate: 'bg-badge-slate text-badge-slate',\n violet: 'bg-badge-violet text-badge-violet',\n};\n\nexport function EntityIconBadge({ size = 'sm', tone = 'default', shape = 'square', hue, bg, iconColor, children, className }: EntityIconBadgeProps) {\n return (\n <span\n data-tone={hue ? undefined : tone}\n data-hue={hue}\n className={clsx(\n 'inline-flex shrink-0 items-center justify-center',\n sizeStyles[size],\n shapeStyles[shape][size],\n !bg && !iconColor && (hue ? hueStyles[hue] : toneStyles[tone]),\n className,\n )}\n style={{\n ...(bg ? { backgroundColor: bg } : undefined),\n ...(iconColor ? { color: iconColor } : undefined),\n }}\n >\n {children}\n </span>\n );\n}\n","import {\n createContext,\n forwardRef,\n useContext,\n useId,\n type HTMLAttributes,\n type ReactNode,\n} from 'react';\nimport clsx from 'clsx';\nimport { cn } from '../../lib/cn';\nimport { useControllableState } from '../../lib/use-controllable-state';\nimport { choiceCardParts, type ChoiceCardSize, type ResponsiveChoiceCardSize } from './choice-card-size';\n\n/** `MultiSelectCard`'s sizes, so the single- and multi-select cards line up. `lg` from 0.9.0. */\nexport type RadioCardsSize = ChoiceCardSize;\n\ninterface RadioCardsContextValue {\n name: string;\n value: string | undefined;\n setValue: (value: string) => void;\n size: ResponsiveChoiceCardSize;\n disabled: boolean;\n required: boolean;\n}\n\nconst RadioCardsContext = createContext<RadioCardsContextValue | null>(null);\n\nexport interface RadioCardsProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {\n /** The parts: `RadioCardsItem`s. Omit when passing `options`. */\n children?: ReactNode;\n /**\n * The cards as data, each rendered as a `RadioCardsItem` (so `title`, not `label`). New in\n * 0.8.0. Use it or `children`, not both.\n */\n options?: readonly RadioCardsItemProps[];\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n /** Shared `name` for the underlying radios, which also submit with a form. Generated when omitted. */\n name?: string;\n /** Names the group. Prefer a visible `FieldLegend` in a `FieldSet` when there is one. */\n label?: string;\n /** One size, or responsive from 0.9.0: `{ initial: 'sm', md: 'lg' }`. */\n size?: ResponsiveChoiceCardSize;\n disabled?: boolean;\n required?: boolean;\n}\n\n/**\n * Choose one of a few options shown as cards: a plan, a workspace type, an import source. The\n * single-select sibling of `MultiSelectCard`, new in 0.7.0 (Radix Themes' `Radio Cards`).\n *\n * Each card is a `<label>` around a real `<input type=\"radio\">`, for the same reason\n * `RadioGroup` uses native radios: arrows move *and* select, only the checked card is a tab\n * stop, and the group announces \"2 of 3\", with nothing reimplemented. The card's selected look\n * is styled from the input's own `:checked` state (`peer-checked:`), so the visual and the\n * semantics cannot disagree.\n *\n * The grid is the caller's: pass layout classes, e.g. `className=\"sm:grid-cols-3\"`.\n */\nexport const RadioCards = forwardRef<HTMLDivElement, RadioCardsProps>(function RadioCards(\n {\n children,\n options,\n value: valueProp,\n defaultValue,\n onValueChange,\n name,\n label,\n size = 'default',\n disabled = false,\n required = false,\n className,\n ...rest\n },\n ref,\n) {\n const generatedName = useId();\n const [value, setValue] = useControllableState<string | undefined>({\n value: valueProp,\n defaultValue,\n onChange: onValueChange as ((next: string | undefined) => void) | undefined,\n });\n\n return (\n <RadioCardsContext.Provider\n value={{ name: name ?? generatedName, value, setValue, size, disabled, required }}\n >\n <div\n ref={ref}\n role=\"radiogroup\"\n aria-label={label}\n aria-required={required || undefined}\n data-slot=\"radio-cards\"\n className={cn('grid gap-3', className)}\n {...rest}\n >\n {options ? options.map((option) => <RadioCardsItem key={option.value} {...option} />) : children}\n </div>\n </RadioCardsContext.Provider>\n );\n});\n\nexport interface RadioCardsItemProps {\n value: string;\n title: ReactNode;\n description?: ReactNode;\n /** Leading glyph in a tinted box, as on `MultiSelectCard`. */\n icon?: ReactNode;\n disabled?: boolean;\n className?: string;\n}\n\nexport const RadioCardsItem = forwardRef<HTMLInputElement, RadioCardsItemProps>(function RadioCardsItem(\n { value, title, description, icon, disabled: itemDisabled = false, className },\n ref,\n) {\n const group = useContext(RadioCardsContext);\n if (!group) throw new Error('<RadioCardsItem> must be used inside <RadioCards>');\n const s = choiceCardParts(group.size);\n const disabled = group.disabled || itemDisabled;\n const titleId = useId();\n const descriptionId = useId();\n\n return (\n <label\n data-slot=\"radio-cards-item\"\n className={cn(\n 'relative block cursor-pointer rounded-2xl border-2 border-default bg-default text-left transition-all',\n 'hover:border-default-secondary',\n // Selected and focus states come from the radio itself.\n 'has-[:checked]:border-brand has-[:checked]:bg-brand-tertiary',\n 'has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-brand has-[:focus-visible]:ring-offset-1 has-[:focus-visible]:ring-offset-default',\n 'has-[:disabled]:cursor-not-allowed has-[:disabled]:opacity-60',\n s.pad,\n className,\n )}\n >\n <input\n ref={ref}\n type=\"radio\"\n name={group.name}\n value={value}\n checked={group.value === value}\n onChange={() => group.setValue(value)}\n disabled={disabled}\n required={group.required}\n // Named by the title alone. The wrapping <label> would otherwise fold the description\n // into the name (\"Team Up to 20 seats\"); it is wired as a description instead.\n aria-labelledby={titleId}\n aria-describedby={description ? descriptionId : undefined}\n className=\"sr-only\"\n />\n <div className=\"flex items-start justify-between gap-2\">\n {icon ? (\n <span\n aria-hidden\n className={clsx(\n 'flex shrink-0 items-center justify-center bg-brand-tertiary',\n '[label:has(:checked)_&]:bg-brand',\n s.iconBox,\n )}\n >\n <span className={clsx(s.icon, 'text-icon-brand [label:has(:checked)_&]:text-icon-brand-on-brand')}>\n {icon}\n </span>\n </span>\n ) : (\n <span />\n )}\n {/* The radio mark: a ring that fills with a dot when chosen. */}\n <span\n aria-hidden\n className={clsx(\n 'flex shrink-0 items-center justify-center rounded-full border-2 border-default',\n '[label:has(:checked)_&]:border-brand',\n s.mark,\n )}\n >\n <span className=\"size-2 scale-0 rounded-full bg-brand transition-transform motion-reduce:transition-none [label:has(:checked)_&]:scale-100\" />\n </span>\n </div>\n <div className={s.gap}>\n <span id={titleId} className={clsx('block font-semibold text-default [label:has(:checked)_&]:text-brand', s.title)}>\n {title}\n </span>\n {description && (\n <span id={descriptionId} className={clsx('mt-0.5 block text-default-secondary', s.description)}>\n {description}\n </span>\n )}\n </div>\n </label>\n );\n});\n","import { createContext, forwardRef, useContext, useId, type ReactNode } from 'react';\nimport { cn } from '../../lib/cn';\nimport { useControllableState } from '../../lib/use-controllable-state';\nimport { Checkbox, type CheckboxSize } from './checkbox';\nimport { FieldLegend, FieldSet } from './field';\n\ninterface CheckboxGroupContextValue {\n name: string;\n value: string[];\n toggle: (value: string, checked: boolean) => void;\n size: CheckboxSize;\n disabled: boolean;\n /** Whether a required group is still empty, so every item carries `required`. */\n required: boolean;\n}\n\nconst CheckboxGroupContext = createContext<CheckboxGroupContextValue | null>(null);\n\nexport interface CheckboxGroupProps {\n /** The parts: `CheckboxGroupItem`s. Omit when passing `options`. */\n children?: ReactNode;\n /**\n * The checkboxes as data, each rendered as a `CheckboxGroupItem`. New in 0.8.0. Use it or\n * `children`, not both.\n */\n options?: readonly CheckboxGroupItemProps[];\n /** The group's visible name, rendered as the fieldset's `<legend>`. */\n legend: ReactNode;\n /** Checked values. Controlled; omit and pass `defaultValue` for uncontrolled. */\n value?: string[];\n defaultValue?: string[];\n onValueChange?: (value: string[]) => void;\n /** Shared `name`, so every checked value posts with a form. Generated when omitted. */\n name?: string;\n size?: CheckboxSize;\n orientation?: 'vertical' | 'horizontal';\n disabled?: boolean;\n /**\n * At least one option must be checked. While none is, every checkbox carries the native\n * `required`, so the form will not submit and the browser points at the first one. Checking\n * any of them lifts it from all. The legend gets\n * the same marker as a required field label.\n */\n required?: boolean;\n className?: string;\n}\n\n/**\n * A named set of checkboxes sharing one value array, new in 0.7.0 (Radix Themes'\n * `Checkbox Group`).\n *\n * A real `<fieldset>` and `<legend>`, which is the only markup that announces the group's name\n * before each option. Each item is the library's native `Checkbox`, so keyboard, form and\n * validation behaviour are the browser's.\n */\nexport const CheckboxGroup = forwardRef<HTMLFieldSetElement, CheckboxGroupProps>(function CheckboxGroup(\n {\n children,\n options,\n legend,\n value: valueProp,\n defaultValue = [],\n onValueChange,\n name,\n size = 'md',\n orientation = 'vertical',\n disabled = false,\n required = false,\n className,\n },\n ref,\n) {\n const generatedName = useId();\n const [value, setValue] = useControllableState<string[]>({\n value: valueProp,\n defaultValue,\n onChange: onValueChange,\n });\n\n const toggle = (item: string, checked: boolean) =>\n setValue(checked ? [...value.filter((v) => v !== item), item] : value.filter((v) => v !== item));\n\n const context = {\n name: name ?? generatedName,\n value,\n toggle,\n size,\n disabled,\n required: required && value.length === 0,\n };\n\n return (\n <CheckboxGroupContext.Provider value={context}>\n <FieldSet ref={ref} data-slot=\"checkbox-group\" data-required={required || undefined} className={className}>\n <FieldLegend\n variant=\"label\"\n className={required ? \"after:ml-0.5 after:text-danger after:content-['*']\" : undefined}\n >\n {legend}\n </FieldLegend>\n <div className={cn('flex', orientation === 'vertical' ? 'flex-col gap-2.5' : 'flex-row flex-wrap gap-4')}>\n {options\n ? options.map((option) => <CheckboxGroupItem key={option.value} {...option} />)\n : children}\n </div>\n </FieldSet>\n </CheckboxGroupContext.Provider>\n );\n});\n\nexport interface CheckboxGroupItemProps {\n value: string;\n label: ReactNode;\n description?: ReactNode;\n disabled?: boolean;\n}\n\nexport const CheckboxGroupItem = forwardRef<HTMLInputElement, CheckboxGroupItemProps>(\n function CheckboxGroupItem({ value, label, description, disabled }, ref) {\n const group = useContext(CheckboxGroupContext);\n if (!group) throw new Error('<CheckboxGroupItem> must be used inside <CheckboxGroup>');\n return (\n <Checkbox\n ref={ref}\n name={group.name}\n value={value}\n label={label}\n description={description}\n size={group.size}\n disabled={group.disabled || disabled}\n required={group.required}\n checked={group.value.includes(value)}\n onCheckedChange={(checked) => group.toggle(value, checked)}\n />\n );\n },\n);\n","import { forwardRef, useId, type InputHTMLAttributes, type ReactNode } from 'react';\nimport clsx from 'clsx';\n\nexport interface SliderProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'size' | 'onChange' | 'value'> {\n value?: number;\n defaultValue?: number;\n onValueChange?: (value: number) => void;\n min?: number;\n max?: number;\n step?: number;\n /** Matches Figma's `Label` / `Has Label`. */\n label?: ReactNode;\n /** Matches Figma's `Description` / `Has Description`. */\n description?: ReactNode;\n /** Show the current value at the right of the label row. */\n showValue?: boolean;\n /** Formats the displayed and announced value — percentages, currency, durations. */\n formatValue?: (value: number) => string;\n className?: string;\n}\n\n/**\n * Range slider. Matches Figma's `Slider Field` (`State: Default | Disabled`, with label and\n * description slots).\n *\n * A native `<input type=\"range\">`, deliberately. It arrives with the entire APG slider\n * contract already implemented — arrow keys, Page Up/Down, Home/End, the correct\n * `aria-valuenow`/`valuemin`/`valuemax`, touch and pointer dragging, and RTL handling — and\n * a `div`-based slider has to rebuild all of it. The track and thumb are styled through the\n * vendor pseudo-elements instead, which is the one place raw `[&::-webkit-…]` selectors are\n * the right tool.\n *\n * `formatValue` feeds `aria-valuetext`, because \"70\" announced on a price slider is\n * meaningless where \"£70\" is not.\n */\nexport const Slider = forwardRef<HTMLInputElement, SliderProps>(function Slider(\n {\n value,\n defaultValue,\n onValueChange,\n min = 0,\n max = 100,\n step = 1,\n label,\n description,\n showValue = false,\n formatValue,\n disabled = false,\n id,\n className,\n ...props\n },\n ref,\n) {\n const generatedId = useId();\n const controlId = id ?? generatedId;\n const descriptionId = `${controlId}-description`;\n\n const current = value ?? defaultValue ?? min;\n const display = formatValue ? formatValue(current) : String(current);\n\n return (\n <div className={clsx('flex w-full flex-col gap-1.5', className)}>\n {(label || showValue) && (\n <div className=\"flex items-baseline justify-between gap-2\">\n {label && (\n <label\n htmlFor={controlId}\n className={clsx('text-body-sm', disabled ? 'text-disabled' : 'text-default')}\n >\n {label}\n </label>\n )}\n {showValue && (\n <span className=\"text-body-sm font-medium tabular-nums text-default\">{display}</span>\n )}\n </div>\n )}\n {description && (\n <p\n id={descriptionId}\n className={clsx('text-body-xs', disabled ? 'text-disabled' : 'text-default-secondary')}\n >\n {description}\n </p>\n )}\n <input\n ref={ref}\n id={controlId}\n type=\"range\"\n min={min}\n max={max}\n step={step}\n value={value}\n defaultValue={value === undefined ? defaultValue : undefined}\n disabled={disabled}\n aria-describedby={description ? descriptionId : undefined}\n // Only when a formatter is supplied — an aria-valuetext that merely repeats\n // aria-valuenow is noise.\n aria-valuetext={formatValue ? display : undefined}\n onChange={(event) => onValueChange?.(Number(event.target.value))}\n className={clsx(\n 'h-5 w-full cursor-pointer appearance-none bg-transparent',\n 'focus-visible:outline-none',\n disabled && 'cursor-not-allowed opacity-50',\n // Track\n '[&::-webkit-slider-runnable-track]:h-1.5 [&::-webkit-slider-runnable-track]:rounded-full [&::-webkit-slider-runnable-track]:bg-default-tertiary',\n '[&::-moz-range-track]:h-1.5 [&::-moz-range-track]:rounded-full [&::-moz-range-track]:bg-default-tertiary',\n '[&::-moz-range-progress]:h-1.5 [&::-moz-range-progress]:rounded-full [&::-moz-range-progress]:bg-brand',\n // Thumb. The negative margin centres it on the track, since the input box is\n // taller than the track to keep a comfortable pointer target.\n '[&::-webkit-slider-thumb]:-mt-[7px] [&::-webkit-slider-thumb]:size-4 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-brand [&::-webkit-slider-thumb]:bg-default [&::-webkit-slider-thumb]:shadow-100',\n '[&::-moz-range-thumb]:size-4 [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:border-2 [&::-moz-range-thumb]:border-brand [&::-moz-range-thumb]:bg-default',\n // Focus ring on the thumb, not the whole 100%-wide input — a ring around the\n // full track reads as the row being focused rather than the handle.\n 'focus-visible:[&::-webkit-slider-thumb]:ring-2 focus-visible:[&::-webkit-slider-thumb]:ring-brand focus-visible:[&::-webkit-slider-thumb]:ring-offset-1',\n 'focus-visible:[&::-moz-range-thumb]:ring-2 focus-visible:[&::-moz-range-thumb]:ring-brand',\n )}\n {...props}\n />\n </div>\n );\n});\n","import { forwardRef, type LabelHTMLAttributes, type ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { useFieldContext } from './field';\nimport type { InputSize } from './input';\n\nexport interface LabelProps extends LabelHTMLAttributes<HTMLLabelElement> {\n children: ReactNode;\n size?: InputSize;\n}\n\nconst SIZE: Record<InputSize, string> = {\n lg: 'text-body',\n md: 'text-body-sm',\n sm: 'text-body-tiny',\n};\n\n/**\n * A standalone `<label>`.\n *\n * `FieldLabel` is the one to reach for inside a `Field` — it picks up the generated id,\n * the size and the disabled state from context automatically. This is for the cases that\n * are not a field: naming a `SegmentedControl`, a group of buttons, or any control the\n * library does not wrap. It still reads `Field` context when it happens to be inside one,\n * so it degrades to `FieldLabel` behaviour rather than silently losing the association.\n */\nexport const Label = forwardRef<HTMLLabelElement, LabelProps>(function Label(\n { children, size, className, htmlFor, ...rest },\n ref,\n) {\n const field = useFieldContext();\n const resolvedSize = size ?? field?.size ?? 'md';\n\n return (\n <label\n ref={ref}\n htmlFor={htmlFor ?? field?.controlId}\n data-slot=\"label\"\n className={clsx(\n 'select-none',\n SIZE[resolvedSize],\n field?.disabled ? 'text-disabled' : 'text-default',\n className,\n )}\n {...rest}\n >\n {children}\n </label>\n );\n});\n","import {\n createContext,\n forwardRef,\n useContext,\n useEffect,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from 'react';\nimport { Dialog as DialogPrimitive } from 'radix-ui';\nimport { CircleCheckBigIcon, InfoIcon, OctagonAlertIcon, TriangleAlertIcon, XIcon } from 'lucide-react';\nimport { cn } from '../../lib/cn';\nimport { SCROLLBAR_CLASSES } from '../../lib/scrollbar';\nimport { EntityIconBadge, type EntityIconBadgeTone } from '../status/entity-icon-badge';\nimport { IconButton } from '../forms/icon-button';\nimport { OVERLAY_SCRIM } from './overlay';\nimport { deferEscapeToInnerPopup } from './overlay-stack';\nimport { PortalContainerProvider } from './portal';\nimport { isInsideToaster } from './toaster-guard';\nimport { composeRefs } from '../../lib/slot';\n\nexport type ModalSize = 'sm' | 'md' | 'lg' | 'xl';\n/**\n * Note `positive`, not `success` — every other tone union in the library\n * (`InlineAlertTone`, `TagPillTone`, `EntityIconBadgeTone`) and the token layer say\n * `positive`, and one vocabulary beats a familiar synonym.\n */\nexport type ModalTone = 'default' | 'info' | 'positive' | 'warning' | 'danger';\nexport type ModalFooterAlign = 'start' | 'between' | 'end';\n/** Where the panel sits above `sm`. Below it the modal is always a bottom sheet. */\nexport type ModalAlign = 'center' | 'top';\n\n/**\n * The `sm:` prefix is mandatory, not cosmetic. In 0.2.0 `max-w-[540px]` was applied\n * unprefixed, so between 540px and the `sm` breakpoint (640px) the \"bottom sheet\" was\n * a 540px card floating in the middle of the viewport.\n */\nconst OVERLAY_ALIGN: Record<ModalAlign, string> = {\n center: 'sm:items-center',\n // A fixed offset rather than centring, so a change in content height grows the panel\n // downward instead of moving its top edge. 6dvh + the 88dvh cap leaves a gap below.\n top: 'sm:items-start sm:pt-[6dvh]',\n};\n\nconst SIZE: Record<ModalSize, string> = {\n sm: 'sm:max-w-[420px]',\n md: 'sm:max-w-[540px]',\n lg: 'sm:max-w-[640px]',\n xl: 'sm:max-w-[800px]',\n};\n\n/**\n * `info` / `positive` / `warning` reuse `InlineAlert`'s glyphs, so one semantic has one\n * mark across the system. `danger` deliberately differs from `warning`: a dialog that\n * is about to destroy something should not be glyph-identical to one merely cautioning.\n */\nconst TONE_ICON: Record<Exclude<ModalTone, 'default'>, ReactNode> = {\n info: <InfoIcon aria-hidden className=\"size-5\" />,\n positive: <CircleCheckBigIcon aria-hidden className=\"size-5\" />,\n warning: <TriangleAlertIcon aria-hidden className=\"size-5\" />,\n danger: <OctagonAlertIcon aria-hidden className=\"size-5\" />,\n};\n\n/** Reuses EntityIconBadge's tone map — one token map for tinted icon circles. */\nconst TONE_BADGE: Record<Exclude<ModalTone, 'default'>, EntityIconBadgeTone> = {\n info: 'brand',\n positive: 'positive',\n warning: 'warning',\n danger: 'danger',\n};\n\nconst FOOTER_ALIGN: Record<ModalFooterAlign, string> = {\n start: 'justify-start',\n between: 'justify-between',\n end: 'justify-end',\n};\n\n// ── Naming context ─────────────────────────────────────────────────────────────\n\n/**\n * Tells the panel which naming parts are actually rendered.\n *\n * Radix wires `aria-labelledby` / `aria-describedby` to its own Title and Description ids,\n * so the name still comes from the visible heading by reference (0.3.0 duplicated it into\n * `aria-label`, and the copy drifted). Two cases still need to know what is present:\n * - **No `ModalTitle`.** The `label` prop is rendered as a visually hidden Title, so the\n * dialog stays named without a heading anyone can see.\n * - **No `ModalDescription`.** Radix would otherwise point `aria-describedby` at an id\n * that is not in the document.\n *\n * Outside a Modal the parts render as plain elements, so a static layout (a docs preview,\n * a design-sync card) can still use them.\n */\ninterface ModalNamingContext {\n registerTitle: (present: boolean) => void;\n registerDescription: (present: boolean) => void;\n}\n\nconst ModalNaming = createContext<ModalNamingContext | null>(null);\n\n// ── Modal ──────────────────────────────────────────────────────────────────────\n\nexport interface ModalProps {\n /** Controlled open state. Omit it, with `ModalTrigger`, for an uncontrolled dialog. */\n open?: boolean;\n /** Initial state when uncontrolled. */\n defaultOpen?: boolean;\n /** Fired with `false` on Escape, an outside press, or the close button. */\n onOpenChange?: (open: boolean) => void;\n /**\n * Accessible name. Only needed when the dialog renders no `ModalTitle` — with one, the\n * name comes from the heading itself via `aria-labelledby`, so it cannot drift.\n */\n label?: string;\n children: ReactNode;\n size?: ModalSize;\n /**\n * `alertdialog` for a dialog that interrupts to confirm or warn — it makes assistive\n * tech announce the body immediately rather than waiting to be browsed. `ConfirmDialog`\n * passes it; plain content dialogs should stay `dialog`.\n */\n role?: 'dialog' | 'alertdialog';\n /** Renders the top-right close button. */\n showClose?: boolean;\n /**\n * Vertical position above `sm`. `center` (the default) suits short, fixed content such as a\n * confirmation. `top` pins the panel near the top of the viewport so it grows downward and\n * does not jump when its height changes: use it for dialogs whose content changes while open\n * (tabs, steps, a builder, results that load). New in 0.8.2.\n */\n align?: ModalAlign;\n /** Applied to the panel. With `cn`, `className=\"sm:max-w-[560px]\"` beats `size`. */\n className?: string;\n /** Call `preventDefault()` to keep the dialog open — e.g. unsaved input. */\n onEscapeKeyDown?: (event: KeyboardEvent) => void;\n /** Call `preventDefault()` to keep the dialog open. */\n onInteractOutside?: (event: PointerEvent) => void;\n /** Focus this on open instead of the first tabbable element. */\n initialFocus?: React.RefObject<HTMLElement | null>;\n /**\n * Where to portal the dialog. Defaults to `document.body`. Pass the element the design\n * tokens are declared on when the app renders inside a shadow root or a scoped theme.\n */\n container?: HTMLElement | null;\n}\n\n/**\n * A centred dialog above `sm`, a bottom sheet below it.\n *\n * Composed from `ModalHeader` / `ModalBody` / `ModalFooter`, mirroring the `Card`\n * parts — so a modal can take any layout a card can, including headerless. Tone lives\n * on `ModalHeader` (the part that draws the glyph); `ConfirmDialog` and\n * `NoteConfirmModal` accept `tone` at their top level and forward it.\n *\n * Built on Radix Dialog from 0.7.0. Radix supplies the focus trap, focus return, Escape and\n * outside-press handling scoped to the topmost layer, scroll lock, and hiding the page behind\n * the dialog from assistive tech. The 0.6 overlay stack got the last of those wrong when\n * modals were stacked. Toasts stay reachable: their region is `aria-live`, which Radix leaves\n * exposed, and pressing one is not treated as an outside press.\n */\nexport const Modal = forwardRef<HTMLDivElement, ModalProps>(function Modal(\n { open, defaultOpen, onOpenChange, container, ...shell },\n ref,\n) {\n return (\n <DialogPrimitive.Root open={open} defaultOpen={defaultOpen} onOpenChange={onOpenChange}>\n {/* The trigger, when there is one, is a direct child of the Root and outside the\n portal, so it renders in place. */}\n {extractTrigger(shell.children)}\n <DialogPrimitive.Portal container={container ?? undefined}>\n <ModalShell ref={ref} {...shell} />\n </DialogPrimitive.Portal>\n </DialogPrimitive.Root>\n );\n});\n\nconst ModalShell = forwardRef<HTMLDivElement, Omit<ModalProps, 'open' | 'defaultOpen' | 'onOpenChange' | 'container'>>(\n function ModalShell(\n {\n label,\n children,\n size = 'md',\n role = 'dialog',\n showClose = true,\n align = 'center',\n className,\n onEscapeKeyDown,\n onInteractOutside,\n initialFocus,\n },\n ref,\n ) {\n const [hasTitle, setHasTitle] = useState(false);\n const [hasDescription, setHasDescription] = useState(false);\n // Floating panels that are not Radix parts portal in here (see PortalContainerProvider).\n const [contentNode, setContentNode] = useState<HTMLDivElement | null>(null);\n // Read during the first render, before Radix moves focus into the panel.\n const [returnFocusTo] = useState(() =>\n typeof document === 'undefined' ? null : (document.activeElement as HTMLElement | null),\n );\n\n return (\n <DialogPrimitive.Overlay\n data-align={align}\n className={cn(\n // The overlay wraps the content (a Radix-supported layout), so it also does the\n // positioning: bottom sheet below `sm`, a card centred or top-anchored above it.\n 'fixed inset-0 z-modal flex items-end justify-center',\n OVERLAY_ALIGN[align],\n OVERLAY_SCRIM,\n )}\n >\n <DialogPrimitive.Content\n ref={composeRefs(ref, setContentNode)}\n role={role}\n // Only point at a description that exists. Passing `undefined` explicitly also\n // tells Radix the omission is deliberate.\n {...(hasDescription ? {} : { 'aria-describedby': undefined })}\n onOpenAutoFocus={(event) => {\n const target = initialFocus?.current;\n if (target) {\n event.preventDefault();\n target.focus();\n }\n }}\n onCloseAutoFocus={(event) => {\n // Radix's modal Dialog returns focus only to its own `Dialog.Trigger`. Most of\n // our modals are controlled and opened by an ordinary button, which Radix never\n // sees, so on close focus would drop to <body>. Return it to whatever held it on\n // open; that is the trigger whenever there is one.\n if (returnFocusTo?.isConnected && returnFocusTo !== document.body) {\n event.preventDefault();\n returnFocusTo.focus();\n }\n }}\n onEscapeKeyDown={(event) => {\n if (!deferEscapeToInnerPopup(event)) onEscapeKeyDown?.(event);\n }}\n onPointerDownOutside={(event) => {\n // A toast is not \"outside the dialog\" in any sense a user means. Pressing its\n // close button must not dismiss the modal underneath it.\n if (isInsideToaster(event.target)) {\n event.preventDefault();\n return;\n }\n const original = event.detail.originalEvent;\n onInteractOutside?.(original);\n if (original.defaultPrevented) event.preventDefault();\n }}\n className={cn(\n 'relative max-h-[92dvh] w-full overflow-y-auto bg-default shadow-400 focus:outline-none',\n align === 'top' && 'sm:max-h-[88dvh]',\n // Not a `ScrollArea`: the panel is the dialog, so the scroll container has to stay\n // the element carrying `role`, `aria-modal` and the trap boundary. It is already\n // keyboard-scrollable because the trap focuses it on open.\n SCROLLBAR_CLASSES,\n 'rounded-t-2xl pb-[env(safe-area-inset-bottom)] sm:mx-4 sm:rounded-2xl sm:pb-0',\n SIZE[size],\n className,\n )}\n >\n {!hasTitle && label && (\n <DialogPrimitive.Title className=\"sr-only\">{label}</DialogPrimitive.Title>\n )}\n {showClose && (\n <DialogPrimitive.Close asChild>\n <IconButton\n variant=\"subtle\"\n size=\"sm\"\n aria-label=\"Close dialog\"\n // Floating rather than inside the header, so a headerless modal is still\n // dismissible. right-6/top-5 reproduces 0.2.0's position exactly.\n className=\"absolute right-6 top-5 z-raised\"\n >\n <XIcon size={16} aria-hidden />\n </IconButton>\n </DialogPrimitive.Close>\n )}\n <ModalNaming.Provider\n value={{ registerTitle: setHasTitle, registerDescription: setHasDescription }}\n >\n <PortalContainerProvider container={contentNode}>\n {withoutTrigger(children)}\n </PortalContainerProvider>\n </ModalNaming.Provider>\n </DialogPrimitive.Content>\n </DialogPrimitive.Overlay>\n );\n },\n);\n\n// ── ModalTrigger / ModalClose ──────────────────────────────────────────────────\n\nexport interface ModalTriggerProps extends HTMLAttributes<HTMLButtonElement> {\n /** Render onto the single child (e.g. a `Button`) instead of a bare `<button>`. */\n asChild?: boolean;\n}\n\n/**\n * Opens an uncontrolled `Modal`. Place it as a direct child of `Modal`; it renders in place,\n * not in the dialog. New in 0.7.0. Controlled modals (`open` + `onOpenChange`) do not need it.\n */\nexport const ModalTrigger = forwardRef<HTMLButtonElement, ModalTriggerProps>(\n function ModalTrigger(props, ref) {\n return <DialogPrimitive.Trigger ref={ref} {...props} />;\n },\n);\n// Marks the part so `Modal` can lift it out of the portalled content.\n(ModalTrigger as unknown as { __modalTrigger: true }).__modalTrigger = true;\n\nexport interface ModalCloseProps extends HTMLAttributes<HTMLButtonElement> {\n asChild?: boolean;\n}\n\n/** Closes the enclosing `Modal`, e.g. a footer \"Cancel\" button. New in 0.7.0. */\nexport const ModalClose = forwardRef<HTMLButtonElement, ModalCloseProps>(\n function ModalClose(props, ref) {\n return <DialogPrimitive.Close ref={ref} {...props} />;\n },\n);\n\nfunction isTrigger(node: ReactNode): boolean {\n return (\n typeof node === 'object' &&\n node !== null &&\n 'type' in node &&\n (node.type as { __modalTrigger?: boolean })?.__modalTrigger === true\n );\n}\n\nfunction extractTrigger(children: ReactNode): ReactNode {\n return Array.isArray(children) ? children.filter(isTrigger) : isTrigger(children) ? children : null;\n}\n\nfunction withoutTrigger(children: ReactNode): ReactNode {\n return Array.isArray(children)\n ? children.filter((child) => !isTrigger(child))\n : isTrigger(children)\n ? null\n : children;\n}\n\n// ── ModalHeader ────────────────────────────────────────────────────────────────\n\nexport interface ModalHeaderProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n /** Adds a tinted glyph circle. `default` renders none. */\n tone?: ModalTone;\n divider?: boolean;\n}\n\nexport const ModalHeader = forwardRef<HTMLDivElement, ModalHeaderProps>(function ModalHeader(\n { children, tone = 'default', divider = true, className, ...rest },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-tone={tone}\n className={cn(\n // pr-14 reserves the floating close button's column (24px gutter + 24px\n // button + gap), which the old flex-between header used to hold open.\n 'flex items-start gap-3 px-6 py-5 pr-14',\n divider && 'border-b border-default',\n className,\n )}\n {...rest}\n >\n {tone !== 'default' && (\n <EntityIconBadge size=\"md\" shape=\"circle\" tone={TONE_BADGE[tone]}>\n {TONE_ICON[tone]}\n </EntityIconBadge>\n )}\n <div className=\"min-w-0 flex-1\">{children}</div>\n </div>\n );\n});\n\n// ── ModalTitle / ModalDescription / ModalBody / ModalFooter ────────────────────\n\nexport interface ModalTitleProps extends HTMLAttributes<HTMLHeadingElement> {\n children: ReactNode;\n}\n\nexport const ModalTitle = forwardRef<HTMLHeadingElement, ModalTitleProps>(function ModalTitle(\n { children, className, ...rest },\n ref,\n) {\n const naming = useContext(ModalNaming);\n\n useEffect(() => {\n naming?.registerTitle(true);\n return () => naming?.registerTitle(false);\n }, [naming]);\n\n const classes = cn('text-heading-sm font-semibold text-default', className);\n\n if (!naming) {\n return (\n <h2 ref={ref} className={classes} {...rest}>\n {children}\n </h2>\n );\n }\n\n return (\n <DialogPrimitive.Title ref={ref} className={classes} {...rest}>\n {children}\n </DialogPrimitive.Title>\n );\n});\n\nexport interface ModalDescriptionProps extends HTMLAttributes<HTMLParagraphElement> {\n children: ReactNode;\n}\n\nexport const ModalDescription = forwardRef<HTMLParagraphElement, ModalDescriptionProps>(\n function ModalDescription({ children, className, ...rest }, ref) {\n const naming = useContext(ModalNaming);\n\n useEffect(() => {\n naming?.registerDescription(true);\n return () => naming?.registerDescription(false);\n }, [naming]);\n\n const classes = cn('mt-0.5 text-body-xs text-default-secondary', className);\n\n if (!naming) {\n return (\n <p ref={ref} className={classes} {...rest}>\n {children}\n </p>\n );\n }\n\n return (\n <DialogPrimitive.Description ref={ref} className={classes} {...rest}>\n {children}\n </DialogPrimitive.Description>\n );\n },\n);\n\nexport interface ModalBodyProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n}\n\n/** Must not carry its own `overflow` — the panel is the scroll container. */\nexport const ModalBody = forwardRef<HTMLDivElement, ModalBodyProps>(function ModalBody(\n { children, className, ...rest },\n ref,\n) {\n return (\n <div ref={ref} className={cn('px-6 py-5', className)} {...rest}>\n {children}\n </div>\n );\n});\n\nexport interface ModalFooterProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n align?: ModalFooterAlign;\n divider?: boolean;\n}\n\nexport const ModalFooter = forwardRef<HTMLDivElement, ModalFooterProps>(function ModalFooter(\n { children, align = 'end', divider = true, className, ...rest },\n ref,\n) {\n return (\n <div\n ref={ref}\n className={cn(\n 'flex items-center gap-2 px-6 py-4',\n FOOTER_ALIGN[align],\n divider && 'border-t border-default',\n className,\n )}\n {...rest}\n >\n {children}\n </div>\n );\n});\n","/**\n * Marks the `Toaster` region so modal overlays can tell a press on a toast apart from a\n * press outside the dialog.\n *\n * A toast fired from inside a Modal (e.g. \"Saved\") renders in the toast region, which is a\n * sibling of the dialog in `document.body`. Radix dismisses a modal on any pointer-down outside\n * its content, so without this check, pressing the toast's close button would also close the\n * dialog the user was still working in.\n */\nexport const TOASTER_ATTRIBUTE = 'data-platned-toaster';\n\nexport function isInsideToaster(target: EventTarget | null): boolean {\n return target instanceof Element && target.closest(`[${TOASTER_ATTRIBUTE}]`) !== null;\n}\n","import { useId, type ReactElement, type ReactNode } from 'react';\nimport { Tooltip as TooltipPrimitive } from 'radix-ui';\nimport { cn } from '../../lib/cn';\nimport type { FloatingAlign, FloatingSide } from './floating';\nimport { usePortalContainer } from './portal';\n\nexport interface TooltipProps {\n /**\n * The trigger. Must be a single focusable element — a tooltip that can only be reached\n * with a pointer is invisible to keyboard and touch users, so this deliberately does not\n * wrap its child in a span to make it hoverable.\n */\n children: ReactElement;\n /** Bold first line. Matches Figma's `Title` property. */\n title?: ReactNode;\n /** Supporting line. Matches Figma's `Body` / `Has Body`. */\n body?: ReactNode;\n side?: FloatingSide;\n align?: FloatingAlign;\n /** Delay before opening on hover, in ms. Default `150`. Keyboard focus opens at once. */\n openDelay?: number;\n /**\n * @deprecated Ignored from 0.7.0. The tooltip now stays open while the pointer travels\n * from the trigger onto it and while it is hovered, as WCAG 1.4.13 requires, which is what\n * a close delay used to approximate. Remove it from call sites; it will be dropped in 0.8.\n */\n closeDelay?: number;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n /**\n * `describedby` — the trigger keeps its own name and the tooltip adds detail. This is\n * almost always what you want. `labelledby` makes the tooltip *be* the trigger's name,\n * for an icon-only button with no other text. Default `describedby`.\n *\n * Deliberately not called `as`: everywhere else in this library `as` chooses the rendered\n * element, and reusing it for something else here would be a trap (it also makes\n * `jsx-a11y`'s polymorphic-component checking treat the value as a tag name).\n */\n association?: 'describedby' | 'labelledby';\n className?: string;\n}\n\n/**\n * Tooltip. Matches Figma's `Tooltip` set — `Placement: Top | Left | Right | Bottom`, with\n * a title and an optional body.\n *\n * Built on Radix Tooltip from 0.7.0, which gets right what a naive tooltip does not:\n *\n * - **Keyboard and touch reachable.** Opens on keyboard focus as well as hover, and closes\n * on Escape. A hover-only tooltip is inaccessible to half the people using it.\n * - **Hoverable (WCAG 1.4.13).** It stays open while the pointer moves onto it, so a\n * magnifier user can read it. 0.6 closed it the moment the pointer left the trigger.\n * - **Escape closes only the tooltip.** It goes through the same layer stack as `Modal`, so\n * dismissing a tooltip inside a dialog no longer closes the dialog too.\n * - **Referenced, not floating text.** The trigger is `aria-describedby` the tooltip (or\n * `aria-labelledby` it), so it is announced *with* the control.\n * - **`role=\"tooltip\"` and no interactive content.** Use `Popover` for anything a user acts on.\n *\n * Each tooltip carries its own Radix provider, so there is nothing to mount at the app root.\n */\nexport function Tooltip({\n children,\n title,\n body,\n side = 'top',\n align = 'center',\n openDelay = 150,\n open,\n defaultOpen,\n onOpenChange,\n association = 'describedby',\n className,\n}: TooltipProps) {\n const container = usePortalContainer();\n const labelId = useId();\n const labelled = association === 'labelledby';\n\n const content = (\n <>\n {title && <p className=\"font-semibold\">{title}</p>}\n {body && <p className={cn(title && 'mt-0.5 opacity-80')}>{body}</p>}\n </>\n );\n\n return (\n <TooltipPrimitive.Provider delayDuration={openDelay}>\n <TooltipPrimitive.Root open={open} defaultOpen={defaultOpen} onOpenChange={onOpenChange}>\n <TooltipPrimitive.Trigger\n asChild\n // As the trigger's *name*, the tooltip text has to exist while closed too, or the\n // control is unnamed; so it is rendered hidden, permanently, and Radix's own\n // description of it is switched off to avoid reading the name twice.\n {...(labelled ? { 'aria-labelledby': labelId, 'aria-describedby': undefined } : {})}\n >\n {children}\n </TooltipPrimitive.Trigger>\n {labelled && (\n <span id={labelId} hidden>\n {title}\n {body ? ' ' : null}\n {body}\n </span>\n )}\n <TooltipPrimitive.Portal container={container ?? undefined}>\n <TooltipPrimitive.Content\n side={side}\n align={align}\n sideOffset={6}\n collisionPadding={8}\n className={cn(\n 'z-tooltip max-w-[260px] rounded-lg bg-neutral px-3 py-2 shadow-300',\n 'text-body-xs text-neutral-on-neutral',\n className,\n )}\n >\n {content}\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>\n </TooltipPrimitive.Root>\n </TooltipPrimitive.Provider>\n );\n}\n","import { useId, useState, type ReactElement, type ReactNode } from 'react';\nimport { HoverCard as HoverCardPrimitive } from 'radix-ui';\n\nimport { cn } from '../../lib/cn';\nimport type { FloatingAlign, FloatingSide } from './floating';\nimport { usePortalContainer } from './portal';\n\nexport interface HoverCardProps {\n /** The trigger. Must be a single focusable element — normally a link. */\n children: ReactElement;\n /** Panel content. May contain links and text; see the note on interactivity below. */\n content: ReactNode;\n side?: FloatingSide;\n align?: FloatingAlign;\n /** Delay before opening, in ms. Default `400`. */\n openDelay?: number;\n /** Delay before closing, in ms. Default `200`. */\n closeDelay?: number;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n className?: string;\n}\n\n/**\n * A preview panel that appears on hover — a user card on an @mention, a page preview on a\n * link.\n *\n * Sits between `Tooltip` and `Popover`, and the difference is about intent rather than\n * looks:\n *\n * - `Tooltip` is a short label. It cannot be entered, so it must hold no controls.\n * - `HoverCard` is supplementary content that *can* be entered — the panel stays open while\n * the pointer is inside it, so a link in the preview is reachable. It is opened by hover\n * and focus, never by click.\n * - `Popover` is opened deliberately by click and is the only one of the three appropriate\n * for content the user must act on.\n *\n * **It is supplementary by contract.** Hover has no touch equivalent, so anything only\n * reachable here is unreachable on a phone. The panel is `aria-labelledby` the trigger and\n * exposed as a group; the trigger keeps its own name and destination.\n *\n * Built on Radix HoverCard from 0.7.0: the open and close delays, the pointer grace area\n * between trigger and panel, and Escape through the shared layer stack (so it closes only\n * the card, not a dialog behind it) come from Radix. The `group` role and the\n * `aria-describedby` wiring are ours; Radix gives the panel no role at all.\n */\nexport function HoverCard({\n children,\n content,\n side = 'bottom',\n align = 'center',\n openDelay = 400,\n closeDelay = 200,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n className,\n}: HoverCardProps) {\n const container = usePortalContainer();\n const baseId = useId();\n const contentId = `${baseId}-content`;\n const triggerId = `${baseId}-trigger`;\n // Tracked here as well as in Radix, because the trigger's description only points at the\n // panel while it exists.\n const [openState, setOpenState] = useState(defaultOpen);\n const open = openProp ?? openState;\n const handleOpenChange = (next: boolean) => {\n setOpenState(next);\n onOpenChange?.(next);\n };\n\n return (\n <HoverCardPrimitive.Root\n open={open}\n onOpenChange={handleOpenChange}\n openDelay={openDelay}\n closeDelay={closeDelay}\n >\n <HoverCardPrimitive.Trigger\n asChild\n id={triggerId}\n // Not `aria-haspopup`: nothing here is triggered by activation, and claiming a popup\n // on a plain link makes a screen reader promise an interaction that does not exist.\n aria-describedby={open ? contentId : undefined}\n >\n {children}\n </HoverCardPrimitive.Trigger>\n <HoverCardPrimitive.Portal container={container ?? undefined}>\n <HoverCardPrimitive.Content\n id={contentId}\n // `group`, not `dialog` — it was not opened deliberately and it traps nothing,\n // so announcing a dialog would be a lie.\n role=\"group\"\n aria-labelledby={triggerId}\n side={side}\n align={align}\n sideOffset={8}\n collisionPadding={8}\n className={cn(\n 'z-popover max-w-[min(20rem,calc(100vw-2rem))] rounded-xl border border-default bg-default p-4 shadow-400',\n className,\n )}\n >\n {content}\n </HoverCardPrimitive.Content>\n </HoverCardPrimitive.Portal>\n </HoverCardPrimitive.Root>\n );\n}\n","import {\n forwardRef,\n type HTMLAttributes,\n type KeyboardEvent as ReactKeyboardEvent,\n type ReactNode,\n} from 'react';\nimport { ContextMenu as ContextMenuPrimitive } from 'radix-ui';\n\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/compose-event-handlers';\nimport { useControllableState } from '../../lib/use-controllable-state';\nimport {\n MENU_PANEL_CLASSES,\n createMenuParts,\n focusMenuEdge,\n stopToAncestors,\n type MenuItemDef,\n} from './menu-core';\nimport { usePortalContainer } from './portal';\n\nexport interface ContextMenuProps {\n /**\n * The parts (`ContextMenuTrigger`, `ContextMenuContent`), or, with `items`, the area that\n * responds to right-click.\n */\n children: ReactNode;\n /**\n * The menu as data. New in 0.8.0. `children` then becomes the right-click area, wrapped in a\n * `ContextMenuTrigger` for you. The same `MenuItemDef` shape as `DropdownMenu` and `Menubar`.\n */\n items?: readonly MenuItemDef[];\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n}\n\n/**\n * Right-click menu, built on Radix ContextMenu from 0.7.0.\n *\n * Shares every item and the whole keyboard contract with `DropdownMenu` (see `menu-core`);\n * the only difference is how it opens — at the pointer, with no trigger element to anchor\n * to.\n *\n * **A context menu must never be the only way to reach an action.** `contextmenu` fires on\n * right-click and on the Windows Menu / Shift+F10 keys, but not on touch, and plenty of\n * users never right-click at all. `ContextMenuTrigger` therefore also opens on Shift+F10 and\n * the ContextMenu key even where the browser would not, and anything in here should have a\n * visible equivalent elsewhere — usually a `DropdownMenu` on the same row.\n *\n * Radix ContextMenu has no `open` prop (it is opened by the pointer only), so a controlled\n * `open={false}` closes it, but `open={true}` cannot open it without a position.\n */\nexport function ContextMenu({ children, items, open: openProp, defaultOpen = false, onOpenChange }: ContextMenuProps) {\n const [, setOpen] = useControllableState({\n value: openProp,\n defaultValue: defaultOpen,\n onChange: onOpenChange,\n });\n\n return (\n <ContextMenuPrimitive.Root onOpenChange={setOpen} modal={false}>\n {items ? (\n <>\n <ContextMenuTrigger>{children}</ContextMenuTrigger>\n <ContextMenuContent>\n <ContextMenuItems items={items} />\n </ContextMenuContent>\n </>\n ) : (\n children\n )}\n </ContextMenuPrimitive.Root>\n );\n}\n\nexport interface ContextMenuTriggerProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n disabled?: boolean;\n}\n\n/**\n * The area that responds to right-click. A wrapper with no tab stop of its own: the keyboard\n * path is Shift+F10 or the ContextMenu key from whatever inside it has focus.\n */\nexport const ContextMenuTrigger = forwardRef<HTMLDivElement, ContextMenuTriggerProps>(\n function ContextMenuTrigger({ children, disabled = false, className, onKeyDown, ...rest }, ref) {\n const openFromKeyboard = (event: ReactKeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n if (disabled || event.defaultPrevented) return;\n if (event.key === 'ContextMenu' || (event.shiftKey && event.key === 'F10')) {\n // Cancelling the key also stops the browser's own `contextmenu`, so the menu opens\n // exactly once, at the focused element rather than wherever the pointer happens to be.\n event.preventDefault();\n const source = event.target instanceof HTMLElement ? event.target : event.currentTarget;\n const rect = source.getBoundingClientRect();\n source.dispatchEvent(\n new MouseEvent('contextmenu', {\n bubbles: true,\n cancelable: true,\n clientX: rect.left + rect.width / 2,\n clientY: rect.top + rect.height / 2,\n }),\n );\n }\n };\n\n return (\n <ContextMenuPrimitive.Trigger asChild disabled={disabled}>\n {/* The key handler only catches Shift+F10 / ContextMenu bubbling up from focusable\n content inside. The wrapper is deliberately not focusable and takes no role: its\n actions have a visible equivalent elsewhere, and a tab stop here would add an\n unexplained one in the middle of, say, a table row. */}\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}\n <div\n ref={ref}\n data-slot=\"context-menu-trigger\"\n className={className}\n onKeyDown={openFromKeyboard}\n {...rest}\n >\n {children}\n </div>\n </ContextMenuPrimitive.Trigger>\n );\n },\n);\n\nexport interface ContextMenuContentProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n /** Minimum gap from the viewport edge, in px. Default `8`. */\n collisionPadding?: number;\n /** Where to portal the menu. Defaults to the enclosing dialog, else `document.body`. */\n container?: HTMLElement | null;\n}\n\nexport const ContextMenuContent = forwardRef<HTMLDivElement, ContextMenuContentProps>(\n function ContextMenuContent(\n { children, collisionPadding = 8, container, className, onClick, onKeyDown, onFocus, ...rest },\n ref,\n ) {\n const inherited = usePortalContainer();\n return (\n <ContextMenuPrimitive.Portal container={container ?? inherited ?? undefined}>\n <ContextMenuPrimitive.Content\n ref={ref}\n collisionPadding={collisionPadding}\n loop\n className={cn(MENU_PANEL_CLASSES, className)}\n onFocus={composeEventHandlers(onFocus, (event) => focusMenuEdge(event, 'start'))}\n onClick={(event) => {\n onClick?.(event);\n stopToAncestors(event);\n }}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n stopToAncestors(event);\n if (event.key === 'Tab') {\n // Tab leaves the menu, as in DropdownMenu. Radix has no imperative close for a\n // context menu, so Escape is replayed on the panel to dismiss it.\n event.currentTarget.dispatchEvent(\n new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }),\n );\n }\n }}\n {...rest}\n >\n {children}\n </ContextMenuPrimitive.Content>\n </ContextMenuPrimitive.Portal>\n );\n },\n);\n\nconst parts = createMenuParts(ContextMenuPrimitive);\n\n/** Renders `MenuItemDef[]` inside your own `ContextMenuContent`. New in 0.8.0. */\nexport const ContextMenuItems = parts.Items;\nexport const ContextMenuItem = parts.Item;\nexport const ContextMenuCheckboxItem = parts.CheckboxItem;\nexport const ContextMenuRadioGroup = parts.RadioGroup;\nexport const ContextMenuRadioItem = parts.RadioItem;\nexport const ContextMenuGroup = parts.Group;\nexport const ContextMenuLabel = parts.Label;\nexport const ContextMenuSeparator = parts.Separator;\nexport const ContextMenuShortcut = parts.Shortcut;\nexport const ContextMenuSub = parts.Sub;\nexport const ContextMenuSubTrigger = parts.SubTrigger;\nexport const ContextMenuSubContent = parts.SubContent;\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { Menubar as MenubarPrimitive } from 'radix-ui';\n\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/compose-event-handlers';\nimport { FOCUS_RING } from '../../lib/focus-ring';\nimport {\n MENU_PANEL_CLASSES,\n createMenuParts,\n focusMenuEdge,\n stopToAncestors,\n type MenuItemDef,\n} from './menu-core';\nimport { usePortalContainer } from './portal';\n\n/** One menu of a data-driven `Menubar`. New in 0.8.0. */\nexport interface MenubarMenuDef {\n /** Identifies the menu within the bar; what `value` / `onValueChange` report. */\n value: string;\n label: ReactNode;\n items: readonly MenuItemDef[];\n hidden?: boolean;\n}\n\nexport interface MenubarProps extends Omit<HTMLAttributes<HTMLDivElement>, 'dir' | 'defaultValue'> {\n /** The parts: `MenubarMenu`s. Omit when passing `menus`. */\n children?: ReactNode;\n /**\n * The bar as data: a trigger and its items per menu, rendered through the parts. New in 0.8.0.\n * Use it or `children`, not both.\n */\n menus?: readonly MenubarMenuDef[];\n /** Reading direction, which flips Left/Right along the bar. */\n dir?: 'ltr' | 'rtl';\n /** Accessible name for the bar, e.g. \"Editor\". Required: a menubar is a landmark-like group. */\n label: string;\n /** The open menu's `value`, controlled. New in 0.7.0. */\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n}\n\n/**\n * A persistent horizontal bar of menus, as in a desktop application's File / Edit / View.\n *\n * Built on Radix Menubar from 0.7.0, which supplies the contract: one tab stop for the whole\n * bar, Left/Right along it, Down/Up into a menu, Left/Right from inside an open menu to its\n * sibling, and moving the pointer across the bar switching menus once one is open. Items are\n * the same parts as `DropdownMenu` (see `menu-core`).\n */\nexport const Menubar = forwardRef<HTMLDivElement, MenubarProps>(function Menubar(\n { children, menus, label, value, defaultValue, onValueChange, className, ...rest },\n ref,\n) {\n return (\n <MenubarPrimitive.Root\n ref={ref}\n value={value}\n defaultValue={defaultValue}\n onValueChange={onValueChange}\n loop\n aria-label={label}\n data-slot=\"menubar\"\n className={cn('flex items-center gap-0.5', className)}\n {...rest}\n >\n {menus\n ? menus\n .filter((menu) => !menu.hidden)\n .map((menu) => (\n <MenubarMenu key={menu.value} value={menu.value}>\n <MenubarTrigger>{menu.label}</MenubarTrigger>\n <MenubarContent>\n <MenubarItems items={menu.items} />\n </MenubarContent>\n </MenubarMenu>\n ))\n : children}\n </MenubarPrimitive.Root>\n );\n});\n\nexport interface MenubarMenuProps {\n children: ReactNode;\n /** Identifies the menu within the bar. */\n value: string;\n}\n\nexport function MenubarMenu({ children, value }: MenubarMenuProps) {\n return <MenubarPrimitive.Menu value={value}>{children}</MenubarPrimitive.Menu>;\n}\n\nexport interface MenubarTriggerProps extends HTMLAttributes<HTMLButtonElement> {\n children: ReactNode;\n}\n\nexport const MenubarTrigger = forwardRef<HTMLButtonElement, MenubarTriggerProps>(\n function MenubarTrigger({ className, ...rest }, ref) {\n return (\n <MenubarPrimitive.Trigger\n ref={ref}\n className={cn(\n 'rounded-md px-2.5 py-1.5 text-body-sm text-default transition-colors',\n FOCUS_RING,\n 'hover:bg-default-secondary data-[state=open]:bg-default-secondary',\n className,\n )}\n {...rest}\n />\n );\n },\n);\n\nexport interface MenubarContentProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n /** Where to portal the menu. Defaults to the enclosing dialog, else `document.body`. */\n container?: HTMLElement | null;\n}\n\nexport const MenubarContent = forwardRef<HTMLDivElement, MenubarContentProps>(\n function MenubarContent(\n { children, container, className, onClick, onKeyDown, onFocus, ...rest },\n ref,\n ) {\n const inherited = usePortalContainer();\n return (\n <MenubarPrimitive.Portal container={container ?? inherited ?? undefined}>\n <MenubarPrimitive.Content\n ref={ref}\n side=\"bottom\"\n align=\"start\"\n sideOffset={4}\n collisionPadding={8}\n loop\n className={cn(MENU_PANEL_CLASSES, className)}\n onFocus={composeEventHandlers(onFocus, (event) => focusMenuEdge(event, 'start'))}\n onClick={(event) => {\n onClick?.(event);\n stopToAncestors(event);\n }}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n stopToAncestors(event);\n // Tab leaves the menu, as in DropdownMenu and ContextMenu. Radix keeps Tab inside an\n // open menu and has no imperative close here, so Escape is replayed on the panel.\n if (event.key === 'Tab') {\n event.currentTarget.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }));\n }\n }}\n {...rest}\n >\n {children}\n </MenubarPrimitive.Content>\n </MenubarPrimitive.Portal>\n );\n },\n);\n\nconst parts = createMenuParts(MenubarPrimitive);\n\n/** Renders `MenuItemDef[]` inside your own `MenubarContent`. New in 0.8.0. */\nexport const MenubarItems = parts.Items;\nexport const MenubarItem = parts.Item;\nexport const MenubarCheckboxItem = parts.CheckboxItem;\nexport const MenubarRadioGroup = parts.RadioGroup;\nexport const MenubarRadioItem = parts.RadioItem;\nexport const MenubarGroup = parts.Group;\nexport const MenubarLabel = parts.Label;\nexport const MenubarSeparator = parts.Separator;\nexport const MenubarShortcut = parts.Shortcut;\nexport const MenubarSub = parts.Sub;\nexport const MenubarSubTrigger = parts.SubTrigger;\nexport const MenubarSubContent = parts.SubContent;\n","import {\n createContext,\n forwardRef,\n useContext,\n useEffect,\n useState,\n type HTMLAttributes,\n type ReactNode,\n type RefObject,\n} from 'react';\nimport { Dialog as DialogPrimitive } from 'radix-ui';\nimport { XIcon } from 'lucide-react';\n\nimport { cn } from '../../lib/cn';\nimport { composeRefs } from '../../lib/slot';\nimport { ScrollArea } from '../cards/scroll-area';\nimport { IconButton } from '../forms/icon-button';\nimport { OVERLAY_SCRIM } from './overlay';\nimport { deferEscapeToInnerPopup } from './overlay-stack';\nimport { PortalContainerProvider } from './portal';\nimport { isInsideToaster } from './toaster-guard';\n\nexport type DrawerSide = 'right' | 'left';\nexport type DrawerFooterAlign = 'end' | 'between';\n\nexport interface DrawerProps {\n /** Controlled open state. Omit it, with `DrawerTrigger`, for an uncontrolled drawer. */\n open?: boolean;\n defaultOpen?: boolean;\n /** Fired with `false` on Escape, an outside press, or the close button. */\n onOpenChange?: (open: boolean) => void;\n /**\n * Header content (left side). The copies this replaces differ only here — a status badge +\n * title in one, an avatar + title + category in another — so it is a slot, not props.\n *\n * Put a `DrawerTitle` in it and the drawer is named by that heading. Leave `header` out\n * altogether to compose the panel from `DrawerHeader` / `DrawerBody` / `DrawerFooter`.\n */\n header?: ReactNode;\n children: ReactNode;\n /** Footer content, with the `header` layout. Composed drawers use `DrawerFooter`. */\n footer?: ReactNode;\n /** `between` when the footer has a left-aligned secondary action. */\n footerAlign?: DrawerFooterAlign;\n /**\n * Panel width. Defaults to the `w-[440px] max-w-[90vw]` shared by every existing drawer.\n * `className` is merged with `cn` from 0.7.0, so a width there works too.\n */\n width?: string;\n /** Which edge the panel slides in from. Default `right`. */\n side?: DrawerSide;\n /**\n * Accessible name, for a drawer that renders no `DrawerTitle`.\n *\n * Required from 0.4.0 to 0.6, because a free `header` slot gave the name nowhere else\n * to come from. From 0.7.0 a `DrawerTitle` anywhere in the drawer names it by reference,\n * the way `ModalTitle` names a `Modal`, so `label` is only needed without one. With\n * neither, Radix warns in development.\n */\n label?: string;\n className?: string;\n /** Call `preventDefault()` to keep the drawer open — e.g. unsaved input. */\n onEscapeKeyDown?: (event: KeyboardEvent) => void;\n /** Call `preventDefault()` to keep the drawer open. */\n onInteractOutside?: (event: PointerEvent) => void;\n /** Focus this on open instead of the first tabbable element. */\n initialFocus?: RefObject<HTMLElement | null>;\n /** Where to portal the drawer. Defaults to `document.body`. */\n container?: HTMLElement | null;\n}\n\ninterface DrawerNamingContext {\n registerTitle: (present: boolean) => void;\n registerDescription: (present: boolean) => void;\n}\n\nconst DrawerNaming = createContext<DrawerNamingContext | null>(null);\n\n/**\n * Side panel, built on Radix Dialog from 0.7.0. Radix handles Escape, the focus trap,\n * scroll lock, hiding the page from assistive tech, and returning focus on close.\n *\n * Two ways to fill it:\n *\n * // Slots: the layout every 0.6 drawer used.\n * <Drawer open={open} onOpenChange={setOpen}\n * header={<DrawerTitle>Supplier</DrawerTitle>} footer={<Button>Save</Button>}>\n * …body…\n * </Drawer>\n *\n * // Parts: for a header with a description, or a body that is not one scroll region.\n * <Drawer open={open} onOpenChange={setOpen}>\n * <DrawerHeader><DrawerTitle>Supplier</DrawerTitle><DrawerDescription>…</DrawerDescription></DrawerHeader>\n * <DrawerBody>…</DrawerBody>\n * <DrawerFooter><Button>Save</Button></DrawerFooter>\n * </Drawer>\n */\nexport const Drawer = forwardRef<HTMLDivElement, DrawerProps>(function Drawer(\n {\n open,\n defaultOpen,\n onOpenChange,\n header,\n children,\n footer,\n footerAlign = 'end',\n width = 'w-[440px] max-w-[90vw]',\n side = 'right',\n label,\n className,\n onEscapeKeyDown,\n onInteractOutside,\n initialFocus,\n container,\n },\n ref,\n) {\n return (\n <DialogPrimitive.Root open={open} defaultOpen={defaultOpen} onOpenChange={onOpenChange}>\n {extractTrigger(children)}\n <DialogPrimitive.Portal container={container ?? undefined}>\n <DrawerPanel\n ref={ref}\n side={side}\n width={width}\n label={label}\n className={className}\n onEscapeKeyDown={onEscapeKeyDown}\n onInteractOutside={onInteractOutside}\n initialFocus={initialFocus}\n >\n {header !== undefined ? (\n <>\n <DrawerHeader>{header}</DrawerHeader>\n <DrawerBody label={label}>{withoutTrigger(children)}</DrawerBody>\n {footer && <DrawerFooter align={footerAlign}>{footer}</DrawerFooter>}\n </>\n ) : (\n withoutTrigger(children)\n )}\n </DrawerPanel>\n </DialogPrimitive.Portal>\n </DialogPrimitive.Root>\n );\n});\n\ninterface DrawerPanelProps\n extends Pick<\n DrawerProps,\n 'side' | 'width' | 'label' | 'className' | 'onEscapeKeyDown' | 'onInteractOutside' | 'initialFocus'\n > {\n children: ReactNode;\n}\n\nconst DrawerPanel = forwardRef<HTMLDivElement, DrawerPanelProps>(function DrawerPanel(\n { side = 'right', width, label, className, onEscapeKeyDown, onInteractOutside, initialFocus, children },\n ref,\n) {\n const [hasTitle, setHasTitle] = useState(false);\n const [hasDescription, setHasDescription] = useState(false);\n const [panelNode, setPanelNode] = useState<HTMLDivElement | null>(null);\n // See Modal: Radix only returns focus to its own Trigger, and most drawers are opened by\n // an ordinary button. Captured before Radix moves focus into the panel.\n const [returnFocusTo] = useState(() =>\n typeof document === 'undefined' ? null : (document.activeElement as HTMLElement | null),\n );\n\n return (\n <DialogPrimitive.Overlay\n className={cn(\n 'fixed inset-0 z-modal flex',\n side === 'right' ? 'justify-end' : 'justify-start',\n OVERLAY_SCRIM,\n )}\n >\n <DialogPrimitive.Content\n asChild\n {...(hasDescription ? {} : { 'aria-describedby': undefined })}\n onOpenAutoFocus={(event) => {\n const target = initialFocus?.current;\n if (target) {\n event.preventDefault();\n target.focus();\n }\n }}\n onCloseAutoFocus={(event) => {\n if (returnFocusTo?.isConnected && returnFocusTo !== document.body) {\n event.preventDefault();\n returnFocusTo.focus();\n }\n }}\n onEscapeKeyDown={(event) => {\n if (!deferEscapeToInnerPopup(event)) onEscapeKeyDown?.(event);\n }}\n onPointerDownOutside={(event) => {\n if (isInsideToaster(event.target)) {\n event.preventDefault();\n return;\n }\n const original = event.detail.originalEvent;\n onInteractOutside?.(original);\n if (original.defaultPrevented) event.preventDefault();\n }}\n >\n {/* A `<div>`, not the `<aside>` of 0.6: `aside` is the complementary landmark, and\n `role=\"dialog\"` is not an allowed role on it (axe: aria-allowed-role). */}\n <div\n ref={composeRefs(ref, setPanelNode)}\n data-side={side}\n className={cn(\n 'relative flex h-full flex-col bg-default shadow-500 focus:outline-none',\n width,\n className,\n )}\n >\n {!hasTitle && label && (\n <DialogPrimitive.Title className=\"sr-only\">{label}</DialogPrimitive.Title>\n )}\n <DrawerNaming.Provider\n value={{ registerTitle: setHasTitle, registerDescription: setHasDescription }}\n >\n <PortalContainerProvider container={panelNode}>{children}</PortalContainerProvider>\n </DrawerNaming.Provider>\n </div>\n </DialogPrimitive.Content>\n </DialogPrimitive.Overlay>\n );\n});\n\n// ── Trigger / Close ────────────────────────────────────────────────────────────\n\nexport interface DrawerTriggerProps extends HTMLAttributes<HTMLButtonElement> {\n asChild?: boolean;\n}\n\n/** Opens an uncontrolled `Drawer`. A direct child of `Drawer`; it renders in place. */\nexport const DrawerTrigger = forwardRef<HTMLButtonElement, DrawerTriggerProps>(\n function DrawerTrigger(props, ref) {\n return <DialogPrimitive.Trigger ref={ref} {...props} />;\n },\n);\n(DrawerTrigger as unknown as { __drawerTrigger: true }).__drawerTrigger = true;\n\nexport interface DrawerCloseProps extends HTMLAttributes<HTMLButtonElement> {\n asChild?: boolean;\n}\n\n/** Closes the enclosing `Drawer`, e.g. a footer \"Cancel\" button. */\nexport const DrawerClose = forwardRef<HTMLButtonElement, DrawerCloseProps>(\n function DrawerClose(props, ref) {\n return <DialogPrimitive.Close ref={ref} {...props} />;\n },\n);\n\nfunction isTrigger(node: ReactNode): boolean {\n return (\n typeof node === 'object' &&\n node !== null &&\n 'type' in node &&\n (node.type as { __drawerTrigger?: boolean })?.__drawerTrigger === true\n );\n}\n\nfunction extractTrigger(children: ReactNode): ReactNode {\n return Array.isArray(children) ? children.filter(isTrigger) : isTrigger(children) ? children : null;\n}\n\nfunction withoutTrigger(children: ReactNode): ReactNode {\n return Array.isArray(children)\n ? children.filter((child) => !isTrigger(child))\n : isTrigger(children)\n ? null\n : children;\n}\n\n// ── Parts ──────────────────────────────────────────────────────────────────────\n\nexport interface DrawerHeaderProps extends HTMLAttributes<HTMLDivElement> {\n /** Renders the close button at the end of the header row. Default `true`. */\n showClose?: boolean;\n}\n\n/** The header row, with the close button. The `header` slot renders inside one of these. */\nexport const DrawerHeader = forwardRef<HTMLDivElement, DrawerHeaderProps>(function DrawerHeader(\n { children, showClose = true, className, ...rest },\n ref,\n) {\n return (\n <div\n ref={ref}\n className={cn('flex items-start justify-between gap-3 border-b border-default p-6', className)}\n {...rest}\n >\n <div className=\"min-w-0\">{children}</div>\n {showClose && (\n <DialogPrimitive.Close asChild>\n <IconButton variant=\"subtle\" size=\"sm\" aria-label=\"Close\">\n <XIcon size={18} aria-hidden />\n </IconButton>\n </DialogPrimitive.Close>\n )}\n </div>\n );\n});\n\nexport interface DrawerTitleProps extends HTMLAttributes<HTMLHeadingElement> {}\n\n/** Names the drawer (`aria-labelledby`). Use it inside the `header` slot or `DrawerHeader`. */\nexport const DrawerTitle = forwardRef<HTMLHeadingElement, DrawerTitleProps>(function DrawerTitle(\n { className, children, ...rest },\n ref,\n) {\n const naming = useContext(DrawerNaming);\n useEffect(() => {\n naming?.registerTitle(true);\n return () => naming?.registerTitle(false);\n }, [naming]);\n\n const classes = cn('text-heading-sm font-semibold text-default', className);\n if (!naming) {\n return (\n <h2 ref={ref} className={classes} {...rest}>\n {children}\n </h2>\n );\n }\n return (\n <DialogPrimitive.Title ref={ref} className={classes} {...rest}>\n {children}\n </DialogPrimitive.Title>\n );\n});\n\nexport interface DrawerDescriptionProps extends HTMLAttributes<HTMLParagraphElement> {}\n\n/** Describes the drawer (`aria-describedby`). */\nexport const DrawerDescription = forwardRef<HTMLParagraphElement, DrawerDescriptionProps>(\n function DrawerDescription({ className, ...rest }, ref) {\n const naming = useContext(DrawerNaming);\n useEffect(() => {\n naming?.registerDescription(true);\n return () => naming?.registerDescription(false);\n }, [naming]);\n\n const classes = cn('mt-0.5 text-body-xs text-default-secondary', className);\n if (!naming) return <p ref={ref} className={classes} {...rest} />;\n return <DialogPrimitive.Description ref={ref} className={classes} {...rest} />;\n },\n);\n\nexport interface DrawerBodyProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Accessible name for the scroll region, which becomes focusable when it overflows.\n * Defaults to \"Content\". It is not the drawer's own name, which would be announced twice.\n */\n label?: string;\n}\n\n/** The scrolling body. It fills the space between header and footer. */\nexport const DrawerBody = forwardRef<HTMLDivElement, DrawerBodyProps>(function DrawerBody(\n { children, label, className, ...rest },\n ref,\n) {\n return (\n <ScrollArea\n ref={ref}\n axis=\"vertical\"\n label={label ? `${label} content` : 'Content'}\n className=\"min-h-0 flex-1\"\n {...rest}\n >\n <div className={cn('space-y-6 p-6', className)}>{children}</div>\n </ScrollArea>\n );\n});\n\nexport interface DrawerFooterProps extends HTMLAttributes<HTMLDivElement> {\n align?: DrawerFooterAlign;\n}\n\nexport const DrawerFooter = forwardRef<HTMLDivElement, DrawerFooterProps>(function DrawerFooter(\n { align = 'end', className, ...rest },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-align={align}\n className={cn(\n 'flex items-center gap-2 border-t border-default px-6 py-4',\n align === 'between' ? 'justify-between' : 'justify-end',\n className,\n )}\n {...rest}\n />\n );\n});\n","import { forwardRef, useEffect, useRef, useState, type HTMLAttributes, type ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { SCROLLBAR_CLASSES } from '../../lib/scrollbar';\nimport { composeRefs } from '../../lib/slot';\n\nexport type ScrollAreaAxis = 'vertical' | 'horizontal' | 'both';\n\nexport interface ScrollAreaProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n axis?: ScrollAreaAxis;\n /**\n * Accessible name for the scrollable region. Strongly recommended — a scroll container\n * that becomes focusable (see below) needs to announce what it is.\n */\n label?: string;\n}\n\nconst OVERFLOW: Record<ScrollAreaAxis, string> = {\n vertical: 'overflow-y-auto overflow-x-hidden',\n horizontal: 'overflow-x-auto overflow-y-hidden',\n both: 'overflow-auto',\n};\n\nexport { SCROLLBAR_CLASSES } from '../../lib/scrollbar';\n\n/**\n * A scrollable region with styled scrollbars.\n *\n * **Native scrolling, deliberately.** shadcn/Radix replaces the scrollbar with a rendered\n * one, which looks tidier and costs real accessibility: an overlay scrollbar has to\n * reimplement keyboard scrolling, momentum, trackpad and pen behaviour, and the OS\n * \"click the track to page\" convention — and it drops out entirely if the JS fails. Styling\n * `::-webkit-scrollbar` plus `scrollbar-width`/`scrollbar-color` gets most of the look with\n * none of that risk, and degrades to a normal scrollbar where unsupported.\n *\n * The one thing this *does* add is the piece browsers get wrong: a scroll container is not\n * keyboard focusable by default in Chrome or Safari, so a keyboard-only user cannot scroll\n * an overflowing `<div>` at all unless something inside it is focusable. This measures its\n * own content and sets `tabIndex={0}` only while it actually overflows, so the region is\n * scrollable with the arrow keys without adding a pointless tab stop when it does not.\n */\nexport const ScrollArea = forwardRef<HTMLDivElement, ScrollAreaProps>(function ScrollArea(\n { children, axis = 'vertical', label, className, ...rest },\n ref,\n) {\n const localRef = useRef<HTMLDivElement>(null);\n const [overflows, setOverflows] = useState(false);\n\n useEffect(() => {\n const node = localRef.current;\n if (!node) return;\n\n const measure = () => {\n const vertical = node.scrollHeight > node.clientHeight + 1;\n const horizontal = node.scrollWidth > node.clientWidth + 1;\n setOverflows(\n axis === 'vertical' ? vertical : axis === 'horizontal' ? horizontal : vertical || horizontal,\n );\n };\n\n measure();\n\n // Feature-detected: `ResizeObserver` is absent in jsdom, in Safari before 13.1, and\n // during any server render, and an unguarded `new ResizeObserver` throws outright. The\n // measurement above has already run, so without the observer the tab stop is simply\n // decided once at mount rather than tracked — degraded, not broken.\n if (typeof ResizeObserver === 'undefined') return;\n\n // Content and box size both matter, so both are observed. On the element it catches the\n // box; on the first child it catches content growth.\n const observer = new ResizeObserver(measure);\n observer.observe(node);\n if (node.firstElementChild) observer.observe(node.firstElementChild);\n return () => observer.disconnect();\n }, [axis, children]);\n\n return (\n <div\n ref={composeRefs<HTMLDivElement>(localRef, ref)}\n // `role=\"region\"` only once it is focusable and named, so an ordinary non-overflowing\n // wrapper does not add a landmark to the page for nothing.\n role={overflows && label ? 'region' : undefined}\n aria-label={overflows ? label : undefined}\n tabIndex={overflows ? 0 : undefined}\n data-slot=\"scroll-area\"\n className={clsx(\n OVERFLOW[axis],\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default',\n SCROLLBAR_CLASSES,\n className,\n )}\n {...rest}\n >\n {children}\n </div>\n );\n});\n","import { useRef, type ReactNode } from 'react';\n\nimport { Button } from '../forms/button';\nimport { Modal, ModalBody, ModalDescription, ModalFooter, ModalHeader, ModalTitle } from './modal';\nimport type { ModalAlign, ModalSize, ModalTone } from './modal';\n\nexport interface ConfirmDialogProps {\n open: boolean;\n title: string;\n subtitle?: string;\n /**\n * Adds a tinted glyph to the header. Defaults to `default` (no glyph) so existing\n * call sites look unchanged; opt in per dialog rather than deriving it from\n * `confirmVariant`, which would silently restyle every destructive confirm.\n */\n tone?: ModalTone;\n size?: ModalSize;\n /** Forwarded to Modal: `top` keeps the panel from moving when its height changes. New in 0.8.2. */\n align?: ModalAlign;\n confirmLabel?: string;\n cancelLabel?: string;\n confirmVariant?: 'primary' | 'danger';\n /**\n * The double-submit guard. While true, the confirm button shows a spinner and its\n * `confirmingLabel`, and ignores presses while keeping focus. The dialog also cannot be\n * dismissed (Escape, outside press, Cancel, the close button), so a request in flight\n * cannot lose the dialog that is waiting on it.\n */\n isConfirming?: boolean;\n /** Label shown on the confirm button while `isConfirming`. */\n confirmingLabel?: string;\n /**\n * The action can't go ahead yet — something still depends on the record, a check is\n * pending. Disables only the confirm button; Cancel, Escape, outside press and the close\n * button still dismiss, so the dialog can explain why and let the person leave. Not a\n * substitute for `isConfirming`, which also locks the dialog while a request is in flight.\n * New in 0.8.1.\n */\n confirmDisabled?: boolean;\n /** Optional body — a warning callout, a consequences list, or a failed-attempt error. */\n children?: ReactNode;\n className?: string;\n onConfirm: () => void;\n /** Fired with `false` on cancel, Escape, or an outside press. */\n onOpenChange: (open: boolean) => void;\n}\n\n/**\n * The in-app replacement for `window.confirm`: a title, an optional body, and a\n * cancel/confirm pair.\n *\n * Kept as a preset rather than folded into `Modal` because it carries *behaviour*, not\n * just layout — the `isConfirming` guard that disables the button and swaps its label\n * is the thing call sites get wrong when they hand-roll a confirm. For any other\n * shape, compose `Modal` and its parts directly.\n *\n * Focus opens on **Cancel**, the least destructive action, as the WAI-ARIA alert dialog\n * pattern recommends. Through 0.6 it opened on the close button, one Tab away from\n * \"Delete\".\n */\nexport function ConfirmDialog({\n open,\n title,\n subtitle,\n tone = 'default',\n size = 'md',\n align,\n confirmLabel = 'Confirm',\n cancelLabel = 'Cancel',\n confirmVariant = 'primary',\n isConfirming = false,\n confirmingLabel = 'Working…',\n confirmDisabled = false,\n children,\n className,\n onConfirm,\n onOpenChange,\n}: ConfirmDialogProps) {\n const cancelRef = useRef<HTMLButtonElement>(null);\n // Every dismissal route (Escape, outside press, close button, Cancel) arrives here.\n const requestOpenChange = (next: boolean) => {\n if (!next && isConfirming) return;\n onOpenChange(next);\n };\n\n return (\n // `alertdialog`, not `dialog`: this interrupts to ask a yes/no question, so the body\n // should be announced on open rather than waiting to be browsed to. The name comes\n // from `ModalTitle` via `aria-labelledby`, so there is no `label` to keep in sync.\n <Modal\n open={open}\n onOpenChange={requestOpenChange}\n role=\"alertdialog\"\n size={size}\n align={align}\n className={className}\n initialFocus={cancelRef}\n >\n <ModalHeader tone={tone} divider={Boolean(children)}>\n <ModalTitle>{title}</ModalTitle>\n {subtitle && <ModalDescription>{subtitle}</ModalDescription>}\n </ModalHeader>\n {/* Guarded: 0.2.0 always rendered a body, so a childless confirm carried 40px of\n dead space plus a stray rule. */}\n {children && <ModalBody>{children}</ModalBody>}\n <ModalFooter>\n <Button\n ref={cancelRef}\n variant=\"neutral\"\n size=\"md\"\n disabled={isConfirming}\n onClick={() => requestOpenChange(false)}\n >\n {cancelLabel}\n </Button>\n <Button\n variant={confirmVariant}\n size=\"md\"\n loading={isConfirming}\n loadingLabel={confirmingLabel}\n disabled={confirmDisabled}\n onClick={onConfirm}\n >\n {isConfirming ? confirmingLabel : confirmLabel}\n </Button>\n </ModalFooter>\n </Modal>\n );\n}\n","import { useState } from 'react';\n\nimport { Button } from '../forms/button';\nimport { Textarea } from '../forms/textarea';\nimport { Modal, ModalBody, ModalDescription, ModalFooter, ModalHeader, ModalTitle } from './modal';\nimport type { ModalAlign, ModalSize, ModalTone } from './modal';\n\nexport interface NoteConfirmModalProps {\n open: boolean;\n title: string;\n subtitle?: string;\n tone?: ModalTone;\n size?: ModalSize;\n /** Forwarded to Modal: `top` keeps the panel from moving when its height changes. New in 0.8.2. */\n align?: ModalAlign;\n confirmLabel: string;\n cancelLabel?: string;\n confirmVariant?: 'primary' | 'danger';\n /** Block confirmation until the note has content. */\n requireNote?: boolean;\n notePlaceholder?: string;\n /** Accessible name of the note field. The placeholder is not a label. Defaults to \"Note\". */\n noteLabel?: string;\n submittingLabel?: string;\n /** Shows a spinner on confirm and keeps the dialog from being dismissed mid-request. */\n isSubmitting?: boolean;\n className?: string;\n /** Fired with `false` on cancel, Escape, or an outside press. */\n onOpenChange: (open: boolean) => void;\n onConfirm: (note: string) => void;\n /**\n * Asked before an Escape or outside press throws away a note that has content.\n * Return `false` to keep the dialog open. Defaults to `window.confirm`.\n */\n onDiscardNote?: (note: string) => boolean;\n}\n\n/**\n * Confirm dialog that collects a free-text note — approvals, rejections, information\n * requests. The note is trimmed before it reaches `onConfirm`.\n *\n * Kept as a preset because it owns state, and a composition cannot.\n */\nexport function NoteConfirmModal({ open, ...rest }: NoteConfirmModalProps) {\n // The shell split is what resets the note. Before 0.3.0 this component had no `open`\n // prop and callers mounted it conditionally, so the typed note was discarded for free.\n // Now that it stays mounted, unmounting the shell is what clears it — otherwise a\n // rejection note would reappear the next time the dialog opened.\n if (!open) return null;\n return <NoteConfirmModalShell {...rest} />;\n}\n\nfunction NoteConfirmModalShell({\n title,\n subtitle,\n tone = 'default',\n size = 'md',\n align,\n confirmLabel,\n cancelLabel = 'Cancel',\n confirmVariant = 'primary',\n requireNote = false,\n notePlaceholder = 'Add a note…',\n noteLabel = 'Note',\n submittingLabel = 'Saving…',\n isSubmitting = false,\n className,\n onOpenChange,\n onConfirm,\n onDiscardNote,\n}: Omit<NoteConfirmModalProps, 'open'>) {\n const [note, setNote] = useState('');\n const noteMissing = requireNote && !note.trim();\n const requestOpenChange = (next: boolean) => {\n if (!next && isSubmitting) return;\n onOpenChange(next);\n };\n\n /**\n * Escape and an outside press both unmount the shell, which is what clears the note —\n * so before 0.4.0 either one silently destroyed whatever the user had typed, with no\n * warning and no undo. On a rejection-reason dialog that is real work lost.\n */\n const guardDiscard = (event: { preventDefault: () => void }) => {\n if (isSubmitting) {\n event.preventDefault();\n return;\n }\n if (!note.trim()) return;\n const confirmed = onDiscardNote\n ? onDiscardNote(note)\n : typeof window !== 'undefined' &&\n window.confirm('Discard your note? It will not be saved.');\n if (!confirmed) event.preventDefault();\n };\n\n return (\n <Modal\n open\n onOpenChange={requestOpenChange}\n size={size}\n align={align}\n className={className}\n onEscapeKeyDown={guardDiscard}\n onInteractOutside={guardDiscard}\n >\n <ModalHeader tone={tone}>\n <ModalTitle>{title}</ModalTitle>\n {subtitle && <ModalDescription>{subtitle}</ModalDescription>}\n </ModalHeader>\n <ModalBody>\n <Textarea\n value={note}\n onChange={(e) => setNote(e.target.value)}\n placeholder={notePlaceholder}\n aria-label={noteLabel}\n rows={4}\n />\n </ModalBody>\n <ModalFooter>\n <Button\n variant=\"neutral\"\n size=\"md\"\n disabled={isSubmitting}\n onClick={() => requestOpenChange(false)}\n >\n {cancelLabel}\n </Button>\n <Button\n variant={confirmVariant}\n size=\"md\"\n disabled={noteMissing}\n loading={isSubmitting}\n loadingLabel={submittingLabel}\n onClick={() => onConfirm(note.trim())}\n >\n {isSubmitting ? submittingLabel : confirmLabel}\n </Button>\n </ModalFooter>\n </Modal>\n );\n}\n","import { cn } from '../../lib/cn';\nimport { OVERLAY_SCRIM } from './overlay';\n\nexport interface ScrimProps {\n /** Dismiss the overlay this scrim sits behind. */\n onClose?: () => void;\n /**\n * Accessible name. With one, the scrim is a real `<button>`, which it must be when clicking it\n * is the *only* pointer route out. Without one it is `aria-hidden` decoration, and the overlay\n * must offer another exit (a close button, Escape).\n */\n label?: string;\n /** `absolute` when the scrim sits inside a wrapper that is already positioned. */\n position?: 'fixed' | 'absolute';\n /**\n * Fade instead of mounting and unmounting, for a panel that slides in and out. While closed\n * the scrim stops taking pointer events; an always-mounted scrim that kept them would silently\n * eat every click on the page. Set as `data-state`.\n */\n open?: boolean;\n /** Stacking and breakpoint gating, e.g. `z-overlay lg:hidden`. */\n className?: string;\n}\n\n/**\n * The dimming layer behind an overlay, for overlays `Modal` and `Drawer` do not cover (a\n * non-modal side panel, a mobile nav). New in 0.7.0, from SCIC. It exists so \"I need a scrim\"\n * never again means hand-writing `fixed inset-0 bg-black/40`, which is how SCIC ended up with\n * three scrim colours. The colour comes from `OVERLAY_SCRIM`.\n */\nexport function Scrim({ onClose, label, position = 'fixed', open, className }: ScrimProps) {\n const classes = cn(\n position === 'fixed' ? 'fixed inset-0' : 'absolute inset-0',\n OVERLAY_SCRIM,\n open !== undefined && 'transition-opacity duration-200 motion-reduce:transition-none',\n 'data-[state=closed]:pointer-events-none data-[state=closed]:opacity-0',\n className,\n );\n const state = open === undefined ? undefined : open ? 'open' : 'closed';\n\n if (label) {\n return <button type=\"button\" aria-label={label} data-state={state} onClick={onClose} className={classes} />;\n }\n // Decoration: the overlay offers another way out, so this needs no keyboard handler.\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions\n return <div aria-hidden data-state={state} onClick={onClose} className={classes} />;\n}\n","import { useState, type ReactNode } from 'react';\nimport { Dialog as DialogPrimitive } from 'radix-ui';\nimport { XIcon } from 'lucide-react';\nimport { cn } from '../../lib/cn';\nimport { Button } from '../forms/button';\nimport { deferEscapeToInnerPopup } from './overlay-stack';\nimport { PortalContainerProvider } from './portal';\n\n/**\n * `base` (the default) sits on the overlay layer, so a dialog opened from inside it appears above\n * it. `elevated` sits above another surface, e.g. a widget preview opened from a full-screen\n * dashboard. SCIC defaulted to `elevated`.\n */\nexport type FullscreenStacking = 'base' | 'elevated';\n\nconst STACKING: Record<FullscreenStacking, string> = {\n base: 'z-overlay',\n elevated: 'z-modal',\n};\n\nexport interface FullscreenSurfaceProps {\n /** Called on Escape and on the close button. The surface renders while mounted. */\n onClose: () => void;\n /** Accessible name of the surface, e.g. \"Supply risk dashboard\". */\n label: string;\n /** Text on the close button. Default \"Close\". */\n closeLabel?: string;\n stacking?: FullscreenStacking;\n children: ReactNode;\n className?: string;\n}\n\n/**\n * An opaque, scrollable surface that fills the viewport, with a close button: \"full screen\" and\n * \"expand this widget\". New in 0.7.0, from SCIC.\n *\n * No scrim, because nothing behind it is visible. But it *is* modal: SCIC's version left the page\n * underneath in the tab order, so Tab walked into content covered by the surface. Built on Radix\n * Dialog, it traps focus, hides the page from assistive tech, returns focus on close, and takes\n * Escape through the shared layer stack, so a dialog opened on top closes first.\n */\nexport function FullscreenSurface({\n onClose,\n label,\n closeLabel = 'Close',\n stacking = 'base',\n children,\n className,\n}: FullscreenSurfaceProps) {\n const [node, setNode] = useState<HTMLDivElement | null>(null);\n // See Modal: Radix only returns focus to its own Trigger, and a surface is opened by an\n // ordinary button. Read during the first render, before Radix moves focus into the surface.\n const [returnFocusTo] = useState(() =>\n typeof document === 'undefined' ? null : (document.activeElement as HTMLElement | null),\n );\n return (\n <DialogPrimitive.Root open onOpenChange={(open) => !open && onClose()}>\n <DialogPrimitive.Portal>\n <DialogPrimitive.Content\n ref={setNode}\n aria-describedby={undefined}\n onCloseAutoFocus={(event) => {\n if (returnFocusTo?.isConnected && returnFocusTo !== document.body) {\n event.preventDefault();\n returnFocusTo.focus();\n }\n }}\n onEscapeKeyDown={(event) => void deferEscapeToInnerPopup(event)}\n className={cn(\n 'fixed inset-0 overflow-auto bg-default-secondary p-4 focus:outline-none lg:p-6',\n STACKING[stacking],\n className,\n )}\n >\n <DialogPrimitive.Title className=\"sr-only\">{label}</DialogPrimitive.Title>\n <div className=\"mb-4 flex justify-end\">\n <DialogPrimitive.Close asChild>\n <Button variant=\"neutral\" size=\"md\" leadingIcon={<XIcon aria-hidden />}>\n {closeLabel}\n </Button>\n </DialogPrimitive.Close>\n </div>\n <PortalContainerProvider container={node}>{children}</PortalContainerProvider>\n </DialogPrimitive.Content>\n </DialogPrimitive.Portal>\n </DialogPrimitive.Root>\n );\n}\n","import { forwardRef, type HTMLAttributes } from 'react';\nimport { VisuallyHidden as VisuallyHiddenPrimitive } from 'radix-ui';\n\nexport interface VisuallyHiddenProps extends HTMLAttributes<HTMLSpanElement> {\n /** Render the hiding styles onto the single child element instead of a `<span>`. */\n asChild?: boolean;\n}\n\n/**\n * Content that screen readers announce and nobody sees: a dialog title the design does\n * not show, a \"(opens in new tab)\" suffix, the label of an icon-only control.\n *\n * Tailwind's `sr-only` does the same job in markup the library owns, and nine components still\n * use it. This is for the call site, where a component is clearer than a utility class and\n * survives a `className` override that would otherwise drop `sr-only` along with the rest.\n */\nexport const VisuallyHidden = forwardRef<HTMLSpanElement, VisuallyHiddenProps>(\n function VisuallyHidden(props, ref) {\n return <VisuallyHiddenPrimitive.Root ref={ref} {...props} />;\n },\n);\n","import type { ReactElement } from 'react';\nimport { AccessibleIcon as AccessibleIconPrimitive } from 'radix-ui';\n\nexport interface AccessibleIconProps {\n /** The icon. A single element; it is hidden from assistive technology. */\n children: ReactElement;\n /** What the icon means. It is announced in place of the icon. */\n label: string;\n}\n\n/**\n * An icon that carries meaning on its own, with no visible text beside it: a \"verified\" tick\n * in a table cell, a warning glyph standing in for a status word.\n *\n * Icons are decorative by default (`lucide-react` hides them, and so does the library wherever\n * it renders one for you). That is right beside a label and wrong here, where the icon *is*\n * the information. This hides the SVG and adds the label as visually hidden text, which reads\n * reliably in every screen reader, unlike `aria-label` on an `<svg>`.\n *\n * Inside a button, use `IconButton` with `aria-label` instead: the name belongs to the control,\n * not to the glyph.\n *\n * <AccessibleIcon label=\"Verified\"><CircleCheckBigIcon className=\"size-4\" /></AccessibleIcon>\n */\nexport function AccessibleIcon({ children, label }: AccessibleIconProps) {\n return <AccessibleIconPrimitive.Root label={label}>{children}</AccessibleIconPrimitive.Root>;\n}\n","import { createContext, useContext, type HTMLAttributes, type ReactNode } from 'react';\nimport { cn } from '../../lib/cn';\n\nexport type CardSize = 'sm' | 'md' | 'lg';\nexport type CardRadius = 'lg' | 'xl' | '2xl';\nexport type CardTone = 'default' | 'brand' | 'positive' | 'warning' | 'danger';\nexport type CardFooterAlign = 'start' | 'between' | 'end';\n\nconst RADIUS: Record<CardRadius, string> = {\n lg: 'rounded-lg',\n xl: 'rounded-xl',\n '2xl': 'rounded-2xl',\n};\n\nconst TONE: Record<CardTone, string> = {\n default: 'border-default bg-default',\n brand: 'border-brand-tertiary bg-brand-tertiary',\n positive: 'border-positive-tertiary bg-positive-tertiary',\n warning: 'border-warning-tertiary bg-warning-tertiary',\n // The one asymmetry: danger keeps the strong `border-danger` rather than the\n // tertiary border, because it is the only tone that has to read as an alarm from\n // across a dashboard. Byte-identical to the deleted AlertCard's danger surface.\n danger: 'border-danger bg-danger-tertiary',\n};\n\n/**\n * Header and footer share one padding ladder, and it now matches `BODY_BOX` on both axes.\n *\n * It used to match horizontally and not vertically — `px-4 py-3` against the body's `p-4` —\n * so a header sat 4px tighter than the body it capped, and stacking a header on a body put\n * two different rhythms in one card. The horizontal inset was already the value that\n * mattered for aligning a title over its content; the vertical one was simply out of step.\n */\nconst BOX: Record<CardSize, string> = {\n sm: 'px-3 py-3',\n md: 'px-4 py-4',\n lg: 'px-5 py-5',\n};\n\nconst BODY_BOX: Record<CardSize, string> = {\n sm: 'gap-3 p-3',\n md: 'gap-4 p-4',\n lg: 'gap-5 p-5',\n};\n\nconst TITLE_SIZE: Record<CardSize, string> = {\n sm: 'text-body-xs',\n md: 'text-body-sm',\n lg: 'text-subheading-sm',\n};\n\n/**\n * One step below the title at every size.\n *\n * `CardDescription` was frozen at `text-body-tiny` while `CardTitle` scaled, so `size=\"lg\"`\n * put an 11px description under a 16px title and `size=\"sm\"` put 11px under 13px — the ratio\n * broke at both ends of the ladder. The size comes from the enclosing `CardHeader` through\n * context rather than a prop, because a description that has to be told its own size at every\n * call site is a size that will drift.\n */\nconst DESCRIPTION_SIZE: Record<CardSize, string> = {\n sm: 'text-body-tiny',\n md: 'text-body-tiny',\n lg: 'text-body-xs',\n};\n\nconst FOOTER_ALIGN: Record<CardFooterAlign, string> = {\n start: 'justify-start',\n between: 'justify-between',\n end: 'justify-end',\n};\n\n/**\n * Set by `CardHeader` so `CardDescription` tracks its sibling title's size.\n *\n * Deliberately only carries the size, and only from the header: the body has its own\n * ladder and nothing inside it reads this.\n */\nconst CardHeaderContext = createContext<CardSize>('md');\n\n// ── Card ───────────────────────────────────────────────────────────────────────\n\nexport interface CardProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n /** `2xl` suits detail pages, `xl` section panels, `lg` dense or nested cards. */\n radius?: CardRadius;\n /**\n * Surface tint. This is a prop rather than a `className` because a tone has to\n * un-set the base `border-default bg-default` pair, not add to it.\n */\n tone?: CardTone;\n}\n\n/**\n * The card shell. Composed from `CardHeader`, `CardBody` and `CardFooter` — or from\n * nothing at all, if you want content to bleed to the edges (drop `CardBody` and put\n * a `DataTable` straight inside).\n *\n * Replaces `SectionCard` and the two monolithic cards that shipped beside it,\n * `AlertCard` and `BenchmarkCard`. Both of those are now documented compositions; see\n * the Cards page. The vocabulary follows shadcn/ui so it is already familiar, with\n * `CardBody` in place of its `CardContent`.\n */\nexport function Card({ children, radius = '2xl', tone = 'default', className, ...rest }: CardProps) {\n return (\n <div\n data-tone={tone}\n data-slot=\"card\"\n // `overflow-hidden` is load-bearing: it clips a header's border-b to the\n // rounded corner. Removing it leaves the rule poking past the radius.\n className={cn('flex flex-col overflow-hidden border', RADIUS[radius], TONE[tone], className)}\n {...rest}\n >\n {children}\n </div>\n );\n}\n\n// ── CardHeader ─────────────────────────────────────────────────────────────────\n\nexport interface CardHeaderProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n size?: CardSize;\n /** Bottom rule separating the header from the body. */\n divider?: boolean;\n}\n\n/**\n * Header row. Holds `CardTitle`, `CardDescription` and an optional `CardAction`.\n *\n * The `has-[…]` selector switches to a two-column grid only when a `CardAction` is\n * present, which is what lets title, description and action share a header with no\n * wrapper div and no stray gap when the action is absent.\n */\nexport function CardHeader({\n children,\n size = 'md',\n divider = true,\n className,\n ...rest\n}: CardHeaderProps) {\n return (\n <CardHeaderContext.Provider value={size}>\n <div\n data-slot=\"card-header\"\n className={cn(\n 'grid auto-rows-min items-center gap-x-3 gap-y-0.5',\n 'has-[[data-slot=card-action]]:grid-cols-[1fr_auto]',\n BOX[size],\n divider && 'border-b border-default',\n className,\n )}\n {...rest}\n >\n {children}\n </div>\n </CardHeaderContext.Provider>\n );\n}\n\n// ── CardTitle / CardDescription / CardAction ───────────────────────────────────\n\nexport interface CardTitleProps extends HTMLAttributes<HTMLElement> {\n children: ReactNode;\n size?: CardSize;\n /** Heading level. Defaults to `p`; use h2/h3 where the page has a real hierarchy. */\n as?: 'h2' | 'h3' | 'h4' | 'p';\n}\n\nexport function CardTitle({ children, size = 'md', as: Tag = 'p', className, ...rest }: CardTitleProps) {\n return (\n <Tag\n data-slot=\"card-title\"\n // min-w-0 belongs here, not on the parent: a grid item defaults to\n // min-width:auto, so `truncate` on a title would not work without it.\n className={cn('min-w-0 font-semibold text-default', TITLE_SIZE[size], className)}\n {...rest}\n >\n {children}\n </Tag>\n );\n}\n\nexport interface CardDescriptionProps extends HTMLAttributes<HTMLParagraphElement> {\n children: ReactNode;\n /** Overrides the size inherited from the enclosing `CardHeader`. */\n size?: CardSize;\n}\n\nexport function CardDescription({ children, size, className, ...rest }: CardDescriptionProps) {\n const inherited = useContext(CardHeaderContext);\n\n return (\n <p\n data-slot=\"card-description\"\n className={cn(\n 'min-w-0 text-default-secondary',\n DESCRIPTION_SIZE[size ?? inherited],\n className,\n )}\n {...rest}\n >\n {children}\n </p>\n );\n}\n\nexport interface CardActionProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n}\n\n/** Right-hand slot in a `CardHeader` — a button, a count, a status badge, a menu. */\nexport function CardAction({ children, className, ...rest }: CardActionProps) {\n return (\n <div\n data-slot=\"card-action\"\n className={cn('col-start-2 row-span-2 row-start-1 shrink-0 self-center justify-self-end', className)}\n {...rest}\n >\n {children}\n </div>\n );\n}\n\n// ── CardBody ───────────────────────────────────────────────────────────────────\n\nexport interface CardBodyProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n size?: CardSize;\n}\n\n/**\n * The content region. A vertical stack by default.\n *\n * Because this file uses `cn`, `className` genuinely overrides the base — so\n * `className=\"flex-row items-center\"` gives you a row, and\n * `className=\"grid grid-cols-3\"` a grid. That is what makes the `AlertCard` and\n * `BenchmarkCard` rebuilds possible without a `layout` prop.\n */\nexport function CardBody({ children, size = 'md', className, ...rest }: CardBodyProps) {\n return (\n <div data-slot=\"card-body\" className={cn('flex flex-col', BODY_BOX[size], className)} {...rest}>\n {children}\n </div>\n );\n}\n\n// ── CardFooter ─────────────────────────────────────────────────────────────────\n\nexport interface CardFooterProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n size?: CardSize;\n divider?: boolean;\n align?: CardFooterAlign;\n}\n\n/** Action row at the foot of a card. Mirrors `ModalFooter` and `Drawer`'s footer. */\nexport function CardFooter({\n children,\n size = 'md',\n divider = true,\n align = 'end',\n className,\n ...rest\n}: CardFooterProps) {\n return (\n <div\n data-slot=\"card-footer\"\n className={cn(\n 'flex items-center gap-2',\n BOX[size],\n FOOTER_ALIGN[align],\n divider && 'border-t border-default',\n className,\n )}\n {...rest}\n >\n {children}\n </div>\n );\n}\n","import { createContext, forwardRef, useContext, type HTMLAttributes, type ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { Accordion as AccordionPrimitive } from 'radix-ui';\nimport { ChevronDownIcon } from 'lucide-react';\nimport { cn } from '../../lib/cn';\nimport { FOCUS_RING } from '../../lib/focus-ring';\n\nexport type AccordionType = 'single' | 'multiple';\n\nconst HeadingLevel = createContext<2 | 3 | 4>(3);\n\n/** One section as data. New in 0.8.0. */\nexport interface AccordionItemDef {\n value: string;\n /** The trigger text. */\n label: ReactNode;\n content: ReactNode;\n disabled?: boolean;\n hidden?: boolean;\n}\n\nexport interface AccordionProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue' | 'dir'> {\n /** The parts: `AccordionItem`s. Omit when passing `items`. */\n children?: ReactNode;\n /**\n * The sections as data, each rendered as an `AccordionItem` with its trigger and content.\n * New in 0.8.0. Use it or `children`, not both.\n */\n items?: readonly AccordionItemDef[];\n /** `single` closes the open item when another opens. Default `single`. */\n type?: AccordionType;\n /** Open item value(s) — a string for `single`, an array for `multiple`. */\n value?: string | string[];\n defaultValue?: string | string[];\n onValueChange?: (value: string | string[]) => void;\n /** Allow closing the open item in `single` mode. Default `true`. */\n collapsible?: boolean;\n /**\n * Heading level for each item's trigger. Default `3`.\n *\n * Each trigger is wrapped in a real heading, per the APG, so the accordion appears in\n * the document outline and a screen reader can jump between sections by heading. The\n * right level depends on what surrounds it, which only the caller knows.\n */\n headingLevel?: 2 | 3 | 4;\n disabled?: boolean;\n}\n\n/**\n * Accordion. Matches Figma's `Accordion` / `Accordion Item` (`State: Closed | Open`).\n *\n * Width is deliberately not set — Figma's own note on `Accordion Item` says the 640px in\n * the component set is a container artefact and the parent should own width, so this is\n * `w-full` and nothing more.\n *\n * Built on Radix Accordion from 0.7.0. The contract is unchanged: real headings, triggers with\n * `aria-expanded` / `aria-controls`, labelled `region` panels, Up/Down/Home/End between\n * triggers, and closed panels unmounted so they are not tabbable. New: your handlers on the\n * trigger compose with the toggle, every part forwards its ref, each part carries\n * `data-state`, and open content exposes `--radix-accordion-content-height` for animation.\n */\nexport const Accordion = forwardRef<HTMLDivElement, AccordionProps>(function Accordion(\n {\n children: childrenProp,\n items,\n type = 'single',\n value,\n defaultValue,\n onValueChange,\n collapsible = true,\n headingLevel = 3,\n disabled,\n className,\n ...rest\n },\n ref,\n) {\n const children = items\n ? items\n .filter((item) => !item.hidden)\n .map((item) => (\n <AccordionItem key={item.value} value={item.value} disabled={item.disabled}>\n <AccordionTrigger>{item.label}</AccordionTrigger>\n <AccordionContent>{item.content}</AccordionContent>\n </AccordionItem>\n ))\n : childrenProp;\n\n const shared = {\n ref,\n disabled,\n 'data-slot': 'accordion',\n className: cn('w-full', className),\n ...rest,\n };\n\n const root =\n type === 'multiple' ? (\n <AccordionPrimitive.Root\n type=\"multiple\"\n value={value === undefined ? undefined : toArray(value)}\n defaultValue={defaultValue === undefined ? undefined : toArray(defaultValue)}\n onValueChange={onValueChange as ((value: string[]) => void) | undefined}\n {...shared}\n >\n {children}\n </AccordionPrimitive.Root>\n ) : (\n <AccordionPrimitive.Root\n type=\"single\"\n collapsible={collapsible}\n value={value === undefined ? undefined : toSingle(value)}\n defaultValue={defaultValue === undefined ? undefined : toSingle(defaultValue)}\n onValueChange={onValueChange as ((value: string) => void) | undefined}\n {...shared}\n >\n {children}\n </AccordionPrimitive.Root>\n );\n\n return <HeadingLevel.Provider value={headingLevel}>{root}</HeadingLevel.Provider>;\n});\n\nconst toArray = (value: string | string[]) => (Array.isArray(value) ? value : value ? [value] : []);\nconst toSingle = (value: string | string[]) => (Array.isArray(value) ? (value[0] ?? '') : value);\n\nexport interface AccordionItemProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n value: string;\n disabled?: boolean;\n}\n\nexport const AccordionItem = forwardRef<HTMLDivElement, AccordionItemProps>(function AccordionItem(\n { className, ...rest },\n ref,\n) {\n return (\n <AccordionPrimitive.Item\n ref={ref}\n data-slot=\"accordion-item\"\n className={cn('border-b border-default last:border-b-0', className)}\n {...rest}\n />\n );\n});\n\nexport interface AccordionTriggerProps extends HTMLAttributes<HTMLButtonElement> {\n children: ReactNode;\n /** Hide the chevron — for a trigger that supplies its own affordance. */\n hideIndicator?: boolean;\n}\n\nexport const AccordionTrigger = forwardRef<HTMLButtonElement, AccordionTriggerProps>(\n function AccordionTrigger({ children, hideIndicator = false, className, ...rest }, ref) {\n const level = useContext(HeadingLevel);\n const Heading = `h${level}` as 'h3';\n\n return (\n // The heading carries no styling of its own — it exists so the accordion shows up in\n // the document outline, which is how screen reader users navigate between sections.\n <AccordionPrimitive.Header asChild>\n <Heading className=\"m-0\">\n <AccordionPrimitive.Trigger\n ref={ref}\n className={cn(\n 'group flex w-full items-center justify-between gap-3 py-4 text-left',\n 'text-body-sm font-semibold text-default transition-colors',\n 'hover:text-brand',\n FOCUS_RING,\n 'disabled:cursor-not-allowed disabled:text-disabled',\n className,\n )}\n {...rest}\n >\n <span className=\"min-w-0 flex-1\">{children}</span>\n {!hideIndicator && (\n <ChevronDownIcon\n aria-hidden\n className={clsx(\n 'size-4 shrink-0 text-icon-default-secondary transition-transform motion-reduce:transition-none',\n 'group-data-[state=open]:rotate-180',\n )}\n />\n )}\n </AccordionPrimitive.Trigger>\n </Heading>\n </AccordionPrimitive.Header>\n );\n },\n);\n\nexport interface AccordionContentProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n}\n\n/**\n * Unmounted while closed rather than height-collapsed: a `height: 0` panel keeps its content\n * focusable and announceable, so keyboard users would tab into a closed section.\n */\nexport const AccordionContent = forwardRef<HTMLDivElement, AccordionContentProps>(\n function AccordionContent({ className, ...rest }, ref) {\n return (\n <AccordionPrimitive.Content\n ref={ref}\n data-slot=\"accordion-content\"\n className={cn('pb-4 text-body-sm text-default-secondary', className)}\n {...rest}\n />\n );\n },\n);\n","import {\n createContext,\n forwardRef,\n useContext,\n useId,\n type HTMLAttributes,\n type ReactNode,\n} from 'react';\nimport { Collapsible as CollapsiblePrimitive } from 'radix-ui';\nimport { useControllableState } from '../../lib/use-controllable-state';\n\n/**\n * The trigger's id, so the panel can be a region labelled by it (Radix gives it no role), and\n * the open state, which `keepMounted` needs: Radix's own `forceMount` renders the content\n * visibly while closed, because it is meant for animation libraries that hide it themselves.\n */\nconst CollapsibleState = createContext<{ triggerId: string; open: boolean } | null>(null);\n\nexport interface CollapsibleProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n disabled?: boolean;\n}\n\n/**\n * A show/hide region with a trigger. The single-item primitive behind `Accordion`.\n *\n * The whole point is the wiring, which is easy to get wrong by hand: the trigger needs\n * `aria-expanded` and `aria-controls`, the panel needs an id and a matching\n * `aria-labelledby`, and the panel must be genuinely removed from the accessibility tree\n * when closed — `height: 0` with `overflow: hidden` leaves its content focusable and\n * announceable, so a keyboard user tabs into a collapsed section.\n *\n * Built on Radix Collapsible from 0.7.0: your `onClick` on the trigger now runs alongside the\n * toggle instead of replacing it, every part forwards its ref, and the open content exposes\n * `--radix-collapsible-content-height` for a height animation. Each part carries\n * `data-state=\"open\" | \"closed\"`.\n */\nexport const Collapsible = forwardRef<HTMLDivElement, CollapsibleProps>(function Collapsible(\n { children, open: openProp, defaultOpen = false, onOpenChange, disabled, ...rest },\n ref,\n) {\n const triggerId = useId();\n const [open, setOpen] = useControllableState({\n value: openProp,\n defaultValue: defaultOpen,\n onChange: onOpenChange,\n });\n return (\n <CollapsiblePrimitive.Root\n ref={ref}\n open={open}\n onOpenChange={setOpen}\n disabled={disabled}\n data-slot=\"collapsible\"\n {...rest}\n >\n <CollapsibleState.Provider value={{ triggerId, open }}>{children}</CollapsibleState.Provider>\n </CollapsiblePrimitive.Root>\n );\n});\n\nexport interface CollapsibleTriggerProps extends HTMLAttributes<HTMLButtonElement> {\n children?: ReactNode;\n asChild?: boolean;\n}\n\nexport const CollapsibleTrigger = forwardRef<HTMLButtonElement, CollapsibleTriggerProps>(\n function CollapsibleTrigger(props, ref) {\n const state = useContext(CollapsibleState);\n return <CollapsiblePrimitive.Trigger ref={ref} id={state?.triggerId} {...props} />;\n },\n);\n\nexport interface CollapsibleContentProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n /**\n * Keep the content mounted while closed, hidden with `hidden`. Default `false`.\n *\n * `hidden` — not `height: 0` — is what keeps hidden content out of the tab sequence and\n * the accessibility tree, so this stays safe. Use it to preserve form state or scroll\n * position across collapses.\n */\n keepMounted?: boolean;\n}\n\nexport const CollapsibleContent = forwardRef<HTMLDivElement, CollapsibleContentProps>(\n function CollapsibleContent({ keepMounted = false, ...rest }, ref) {\n const state = useContext(CollapsibleState);\n return (\n <CollapsiblePrimitive.Content\n ref={ref}\n forceMount={keepMounted || undefined}\n role=\"region\"\n aria-labelledby={state?.triggerId}\n {...(keepMounted ? { hidden: !state?.open } : {})}\n {...rest}\n />\n );\n },\n);\n","import { forwardRef, type CSSProperties, type HTMLAttributes, type ReactNode } from 'react';\nimport { cn } from '../../lib/cn';\nimport { Slot } from '../../lib/slot';\n\n/**\n * Layout primitives, new in 0.7.0: `Box`, `Flex`, `Grid`, `Container` and `Section`, the Radix\n * Themes layout set.\n *\n * Each is a thin, typed wrapper over the Tailwind utilities a page would otherwise hand-write.\n * Spacing props take the Figma spacing tokens by name (`gap=\"400\"` is 16px), so layout uses the\n * same scale as the components inside it and an arbitrary `gap-[13px]` has nowhere to go. All of\n * them take `asChild` to lay out an element of your own (a `<ul>`, a `<form>`, a `<main>`) and\n * merge `className` with `cn`, so a class you pass wins.\n *\n * The class maps below are written out literally on purpose: Tailwind only generates classes\n * that appear verbatim in source, so building them with template strings would emit no CSS.\n */\n\n/** A Figma spacing step, by name: `100` is 4px, `400` is 16px, `1600` is 64px. */\nexport type SpaceToken = '0' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '1000' | '1200' | '1600';\n\nconst GAP: Record<SpaceToken, string> = {\n '0': 'gap-0',\n '100': 'gap-100',\n '200': 'gap-200',\n '300': 'gap-300',\n '400': 'gap-400',\n '500': 'gap-500',\n '600': 'gap-600',\n '700': 'gap-700',\n '800': 'gap-800',\n '1000': 'gap-1000',\n '1200': 'gap-1200',\n '1600': 'gap-1600',\n};\nconst GAP_X: Record<SpaceToken, string> = {\n '0': 'gap-x-0',\n '100': 'gap-x-100',\n '200': 'gap-x-200',\n '300': 'gap-x-300',\n '400': 'gap-x-400',\n '500': 'gap-x-500',\n '600': 'gap-x-600',\n '700': 'gap-x-700',\n '800': 'gap-x-800',\n '1000': 'gap-x-1000',\n '1200': 'gap-x-1200',\n '1600': 'gap-x-1600',\n};\nconst GAP_Y: Record<SpaceToken, string> = {\n '0': 'gap-y-0',\n '100': 'gap-y-100',\n '200': 'gap-y-200',\n '300': 'gap-y-300',\n '400': 'gap-y-400',\n '500': 'gap-y-500',\n '600': 'gap-y-600',\n '700': 'gap-y-700',\n '800': 'gap-y-800',\n '1000': 'gap-y-1000',\n '1200': 'gap-y-1200',\n '1600': 'gap-y-1600',\n};\nconst PAD: Record<SpaceToken, string> = {\n '0': 'p-0',\n '100': 'p-100',\n '200': 'p-200',\n '300': 'p-300',\n '400': 'p-400',\n '500': 'p-500',\n '600': 'p-600',\n '700': 'p-700',\n '800': 'p-800',\n '1000': 'p-1000',\n '1200': 'p-1200',\n '1600': 'p-1600',\n};\nconst PAD_X: Record<SpaceToken, string> = {\n '0': 'px-0',\n '100': 'px-100',\n '200': 'px-200',\n '300': 'px-300',\n '400': 'px-400',\n '500': 'px-500',\n '600': 'px-600',\n '700': 'px-700',\n '800': 'px-800',\n '1000': 'px-1000',\n '1200': 'px-1200',\n '1600': 'px-1600',\n};\nconst PAD_Y: Record<SpaceToken, string> = {\n '0': 'py-0',\n '100': 'py-100',\n '200': 'py-200',\n '300': 'py-300',\n '400': 'py-400',\n '500': 'py-500',\n '600': 'py-600',\n '700': 'py-700',\n '800': 'py-800',\n '1000': 'py-1000',\n '1200': 'py-1200',\n '1600': 'py-1600',\n};\n\ninterface LayoutBaseProps extends HTMLAttributes<HTMLElement> {\n children?: ReactNode;\n /** Lay out your own single child element instead of a `<div>`. */\n asChild?: boolean;\n /** Padding on every side, as a spacing token. */\n p?: SpaceToken;\n /** Horizontal padding, as a spacing token. */\n px?: SpaceToken;\n /** Vertical padding, as a spacing token. */\n py?: SpaceToken;\n}\n\nfunction padding({ p, px, py }: Pick<LayoutBaseProps, 'p' | 'px' | 'py'>) {\n return [p && PAD[p], px && PAD_X[px], py && PAD_Y[py]];\n}\n\nfunction rootElement(asChild: boolean | undefined, fallback: 'div' | 'section') {\n return (asChild ? Slot : fallback) as 'div';\n}\n\n// ── Box ────────────────────────────────────────────────────────────────────────\n\nexport type BoxProps = LayoutBaseProps;\n\n/** A plain block with token padding. The base the others build on. */\nexport const Box = forwardRef<HTMLDivElement, BoxProps>(function Box(\n { asChild, p, px, py, className, ...rest },\n ref,\n) {\n const Root = rootElement(asChild, 'div');\n return <Root ref={ref} className={cn(padding({ p, px, py }), className)} {...rest} />;\n});\n\n// ── Flex ───────────────────────────────────────────────────────────────────────\n\nexport type FlexDirection = 'row' | 'column' | 'row-reverse' | 'column-reverse';\nexport type FlexAlign = 'start' | 'center' | 'end' | 'baseline' | 'stretch';\nexport type FlexJustify = 'start' | 'center' | 'end' | 'between' | 'around';\n\nconst DIRECTION: Record<FlexDirection, string> = {\n row: 'flex-row',\n column: 'flex-col',\n 'row-reverse': 'flex-row-reverse',\n 'column-reverse': 'flex-col-reverse',\n};\n\nconst ALIGN: Record<FlexAlign, string> = {\n start: 'items-start',\n center: 'items-center',\n end: 'items-end',\n baseline: 'items-baseline',\n stretch: 'items-stretch',\n};\n\nconst JUSTIFY: Record<FlexJustify, string> = {\n start: 'justify-start',\n center: 'justify-center',\n end: 'justify-end',\n between: 'justify-between',\n around: 'justify-around',\n};\n\nexport interface FlexProps extends LayoutBaseProps {\n /** Default `row`. */\n direction?: FlexDirection;\n align?: FlexAlign;\n justify?: FlexJustify;\n gap?: SpaceToken;\n /** Let items wrap onto new lines. */\n wrap?: boolean;\n /** `inline-flex` instead of `flex`. */\n inline?: boolean;\n}\n\n/** A flex row or column with token gaps. */\nexport const Flex = forwardRef<HTMLDivElement, FlexProps>(function Flex(\n { asChild, direction = 'row', align, justify, gap, wrap, inline, p, px, py, className, ...rest },\n ref,\n) {\n const Root = rootElement(asChild, 'div');\n return (\n <Root\n ref={ref}\n className={cn(\n inline ? 'inline-flex' : 'flex',\n DIRECTION[direction],\n align && ALIGN[align],\n justify && JUSTIFY[justify],\n gap && GAP[gap],\n wrap && 'flex-wrap',\n padding({ p, px, py }),\n className,\n )}\n {...rest}\n />\n );\n});\n\n// ── Grid ───────────────────────────────────────────────────────────────────────\n\nexport type GridColumnCount = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;\nexport type GridBreakpoint = 'base' | 'sm' | 'md' | 'lg' | 'xl';\n\nconst COLUMNS: Record<GridBreakpoint, Record<GridColumnCount, string>> = {\n base: {\n 1: 'grid-cols-1',\n 2: 'grid-cols-2',\n 3: 'grid-cols-3',\n 4: 'grid-cols-4',\n 5: 'grid-cols-5',\n 6: 'grid-cols-6',\n 7: 'grid-cols-7',\n 8: 'grid-cols-8',\n 9: 'grid-cols-9',\n 10: 'grid-cols-10',\n 11: 'grid-cols-11',\n 12: 'grid-cols-12',\n },\n sm: {\n 1: 'sm:grid-cols-1',\n 2: 'sm:grid-cols-2',\n 3: 'sm:grid-cols-3',\n 4: 'sm:grid-cols-4',\n 5: 'sm:grid-cols-5',\n 6: 'sm:grid-cols-6',\n 7: 'sm:grid-cols-7',\n 8: 'sm:grid-cols-8',\n 9: 'sm:grid-cols-9',\n 10: 'sm:grid-cols-10',\n 11: 'sm:grid-cols-11',\n 12: 'sm:grid-cols-12',\n },\n md: {\n 1: 'md:grid-cols-1',\n 2: 'md:grid-cols-2',\n 3: 'md:grid-cols-3',\n 4: 'md:grid-cols-4',\n 5: 'md:grid-cols-5',\n 6: 'md:grid-cols-6',\n 7: 'md:grid-cols-7',\n 8: 'md:grid-cols-8',\n 9: 'md:grid-cols-9',\n 10: 'md:grid-cols-10',\n 11: 'md:grid-cols-11',\n 12: 'md:grid-cols-12',\n },\n lg: {\n 1: 'lg:grid-cols-1',\n 2: 'lg:grid-cols-2',\n 3: 'lg:grid-cols-3',\n 4: 'lg:grid-cols-4',\n 5: 'lg:grid-cols-5',\n 6: 'lg:grid-cols-6',\n 7: 'lg:grid-cols-7',\n 8: 'lg:grid-cols-8',\n 9: 'lg:grid-cols-9',\n 10: 'lg:grid-cols-10',\n 11: 'lg:grid-cols-11',\n 12: 'lg:grid-cols-12',\n },\n xl: {\n 1: 'xl:grid-cols-1',\n 2: 'xl:grid-cols-2',\n 3: 'xl:grid-cols-3',\n 4: 'xl:grid-cols-4',\n 5: 'xl:grid-cols-5',\n 6: 'xl:grid-cols-6',\n 7: 'xl:grid-cols-7',\n 8: 'xl:grid-cols-8',\n 9: 'xl:grid-cols-9',\n 10: 'xl:grid-cols-10',\n 11: 'xl:grid-cols-11',\n 12: 'xl:grid-cols-12',\n },\n};\n\nexport interface GridProps extends LayoutBaseProps {\n /**\n * Column count, fixed or per breakpoint: `columns={3}` or\n * `columns={{ base: 1, md: 2, lg: 4 }}`.\n */\n columns?: GridColumnCount | Partial<Record<GridBreakpoint, GridColumnCount>>;\n /**\n * As many columns as fit, each at least this wide, e.g. `\"16rem\"`. Responds to the grid's own\n * width, not the viewport's, so it suits form fields and card lists inside panels of any size\n * (what SCIC's `FormGrid` did). Ignored when `columns` is set.\n */\n minColumnWidth?: string;\n gap?: SpaceToken;\n gapX?: SpaceToken;\n gapY?: SpaceToken;\n align?: FlexAlign;\n}\n\n/** A CSS grid with token gaps: fixed, responsive or auto-fitting columns. */\nexport const Grid = forwardRef<HTMLDivElement, GridProps>(function Grid(\n { asChild, columns, minColumnWidth, gap, gapX, gapY, align, p, px, py, className, style, ...rest },\n ref,\n) {\n const Root = rootElement(asChild, 'div');\n const columnClasses =\n columns === undefined\n ? []\n : typeof columns === 'number'\n ? [COLUMNS.base[columns]]\n : (Object.entries(columns) as [GridBreakpoint, GridColumnCount][]).map(\n ([breakpoint, count]) => COLUMNS[breakpoint][count],\n );\n // `min(100%, …)` keeps a single column from overflowing a container narrower than the minimum.\n const autoFit: CSSProperties | undefined =\n columns === undefined && minColumnWidth\n ? { gridTemplateColumns: `repeat(auto-fit, minmax(min(100%, ${minColumnWidth}), 1fr))` }\n : undefined;\n\n return (\n <Root\n ref={ref}\n className={cn(\n 'grid',\n columnClasses,\n gap && GAP[gap],\n gapX && GAP_X[gapX],\n gapY && GAP_Y[gapY],\n align && ALIGN[align],\n padding({ p, px, py }),\n className,\n )}\n style={autoFit ? { ...autoFit, ...style } : style}\n {...rest}\n />\n );\n});\n\n// ── Container ──────────────────────────────────────────────────────────────────\n\nexport type ContainerSize = 'sm' | 'md' | 'lg' | 'xl' | 'full';\n\nconst CONTAINER: Record<ContainerSize, string> = {\n sm: 'max-w-[640px]',\n md: 'max-w-[880px]',\n lg: 'max-w-[1136px]',\n xl: 'max-w-[1440px]',\n full: 'max-w-none',\n};\n\nexport interface ContainerProps extends LayoutBaseProps {\n /** Maximum content width. Default `lg` (1136px). */\n size?: ContainerSize;\n}\n\n/** Centres content at a maximum width, with a 16px side gutter by default. */\nexport const Container = forwardRef<HTMLDivElement, ContainerProps>(function Container(\n { asChild, size = 'lg', p, px = '400', py, className, ...rest },\n ref,\n) {\n const Root = rootElement(asChild, 'div');\n return (\n <Root\n ref={ref}\n className={cn('mx-auto w-full', CONTAINER[size], padding({ p, px, py }), className)}\n {...rest}\n />\n );\n});\n\n// ── Section ────────────────────────────────────────────────────────────────────\n\nexport type SectionSize = 'sm' | 'md' | 'lg';\n\nconst SECTION: Record<SectionSize, string> = {\n sm: 'py-600',\n md: 'py-1000',\n lg: 'py-1600',\n};\n\nexport interface SectionProps extends LayoutBaseProps {\n /** Vertical rhythm: 24, 40 or 64px above and below. Default `md`. */\n size?: SectionSize;\n}\n\n/**\n * A page band with vertical rhythm, rendered as a `<section>`. Give it a heading (or an\n * `aria-label`) when it should be a landmark; an unnamed `<section>` is announced as nothing at\n * all, which is the right default for a purely visual band.\n */\nexport const Section = forwardRef<HTMLElement, SectionProps>(function Section(\n { asChild, size = 'md', p, px, py, className, ...rest },\n ref,\n) {\n const Root = rootElement(asChild, 'section');\n return (\n <Root\n ref={ref as never}\n className={cn(SECTION[size], padding({ p, px, py }), className)}\n {...rest}\n />\n );\n});\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport clsx from 'clsx';\n\nexport interface AspectRatioProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n /** Width ÷ height. `16 / 9` for video, `1` for a square, `4 / 3` for a photo. Default `1`. */\n ratio?: number;\n}\n\n/**\n * Holds a fixed width-to-height ratio for its content.\n *\n * Uses the CSS `aspect-ratio` property rather than the old padding-top percentage hack, so\n * the child is a normal in-flow element instead of being absolutely positioned inside a\n * zero-height box. The ratio is an inline style because it is a per-instance numeric value —\n * a Tailwind class cannot express `16 / 9` without an arbitrary-value escape at every call\n * site.\n */\nexport const AspectRatio = forwardRef<HTMLDivElement, AspectRatioProps>(function AspectRatio(\n { children, ratio = 1, className, style, ...rest },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"aspect-ratio\"\n style={{ aspectRatio: ratio, ...style }}\n className={clsx('w-full overflow-hidden [&>*]:size-full [&>img]:object-cover', className)}\n {...rest}\n >\n {children}\n </div>\n );\n});\n","import {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from 'react';\nimport clsx from 'clsx';\nimport { composeEventHandlers } from '../../lib/compose-event-handlers';\nimport { ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';\nimport { IconButton } from '../forms/icon-button';\nimport { useControllableState } from '../../lib/use-controllable-state';\n\ninterface CarouselContextValue {\n index: number;\n setIndex: (index: number) => void;\n count: number;\n registerSlide: () => number;\n resetSlides: () => void;\n baseId: string;\n loop: boolean;\n paused: boolean;\n setPaused: (paused: boolean) => void;\n hasAutoplay: boolean;\n}\n\nconst CarouselContext = createContext<CarouselContextValue | null>(null);\n\nfunction useCarousel(part: string): CarouselContextValue {\n const value = useContext(CarouselContext);\n if (!value) throw new Error(`<${part}> must be used inside <Carousel>`);\n return value;\n}\n\nexport interface CarouselProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n /** Names the carousel region. Required — a nameless region is not navigable. */\n label: string;\n index?: number;\n defaultIndex?: number;\n onIndexChange?: (index: number) => void;\n /** Number of slides. Needed up front for the controls; `CarouselSlide` count is checked against it. */\n count: number;\n loop?: boolean;\n /** Advance every N ms. Omit for a manual carousel. */\n autoplayInterval?: number;\n}\n\n/**\n * A slide carousel.\n *\n * Carousels are one of the most reliably inaccessible patterns on the web, so the parts that\n * look like polish here are the requirements:\n *\n * - **`aria-roledescription=\"carousel\"`** on a named region, so it is announced as a carousel\n * rather than as an anonymous group of divs.\n * - **Slides are `role=\"group\"` with `aria-roledescription=\"slide\"` and an\n * \"N of M\" label** — position is otherwise invisible to anyone not seeing the dots.\n * - **Off-screen slides are `hidden`**, not merely translated out of view. A slide moved with\n * `transform` keeps its links in the tab order, so keyboard users tab into content they\n * cannot see. This is the single most common carousel bug.\n * - **Autoplay stops on hover, on focus, and permanently once the user takes control**, and\n * there is a visible pause button whenever autoplay is on — required by WCAG 2.2.2 for any\n * motion lasting more than five seconds.\n * - **`prefers-reduced-motion` disables autoplay entirely**, rather than just shortening the\n * transition.\n */\nexport function Carousel({\n children,\n label,\n index: indexProp,\n defaultIndex = 0,\n onIndexChange,\n count,\n loop = false,\n autoplayInterval,\n className,\n ...rest\n}: CarouselProps) {\n const [index, setIndex] = useControllableState({\n value: indexProp,\n defaultValue: defaultIndex,\n onChange: onIndexChange,\n });\n\n const baseId = useId();\n const cursor = useRef(0);\n const [paused, setPaused] = useState(false);\n const [userTookControl, setUserTookControl] = useState(false);\n\n const hasAutoplay = autoplayInterval !== undefined && autoplayInterval > 0;\n\n const context = useMemo<CarouselContextValue>(\n () => ({\n index,\n setIndex: (next) => {\n // Any deliberate move stops autoplay for good. Resuming after a user has navigated\n // yanks the content out from under them.\n setUserTookControl(true);\n setIndex(next);\n },\n count,\n registerSlide: () => cursor.current++,\n resetSlides: () => {\n cursor.current = 0;\n },\n baseId,\n loop,\n paused,\n setPaused,\n hasAutoplay,\n }),\n [index, setIndex, count, baseId, loop, paused, hasAutoplay],\n );\n\n context.resetSlides();\n\n useEffect(() => {\n if (!hasAutoplay || paused || userTookControl) return;\n // Autoplay is motion the user did not ask for, so it does not start at all when they\n // have asked for less of it.\n if (window.matchMedia?.('(prefers-reduced-motion: reduce)').matches) return;\n\n const timer = setInterval(() => {\n setIndex(index === count - 1 ? (loop ? 0 : index) : index + 1);\n }, autoplayInterval);\n return () => clearInterval(timer);\n }, [hasAutoplay, paused, userTookControl, autoplayInterval, index, count, loop, setIndex]);\n\n return (\n <CarouselContext.Provider value={context}>\n {/* The APG carousel pattern puts Left/Right on the region itself, so slides can be\n paged from anywhere inside without first tabbing to the controls. The region is not\n focusable and does not need to be — the keys arrive by bubbling from whatever inside\n it has focus. */}\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */}\n <div\n // `region` + roledescription is what makes this announce as a carousel.\n role=\"region\"\n aria-roledescription=\"carousel\"\n aria-label={label}\n data-slot=\"carousel\"\n className={clsx('relative', className)}\n {...rest}\n onPointerEnter={composeEventHandlers(rest.onPointerEnter, () => hasAutoplay && setPaused(true))}\n onPointerLeave={composeEventHandlers(rest.onPointerLeave, () => hasAutoplay && setPaused(false))}\n onFocus={composeEventHandlers(rest.onFocus, () => hasAutoplay && setPaused(true))}\n onBlur={composeEventHandlers(rest.onBlur, (event) => {\n if (hasAutoplay && !event.currentTarget.contains(event.relatedTarget as Node)) {\n setPaused(false);\n }\n })}\n onKeyDown={composeEventHandlers(rest.onKeyDown, (event) => {\n if (event.key === 'ArrowLeft') {\n event.preventDefault();\n context.setIndex(index === 0 ? (loop ? count - 1 : 0) : index - 1);\n }\n if (event.key === 'ArrowRight') {\n event.preventDefault();\n context.setIndex(index === count - 1 ? (loop ? 0 : index) : index + 1);\n }\n })}\n >\n {children}\n </div>\n </CarouselContext.Provider>\n );\n}\n\nexport interface CarouselViewportProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n}\n\nexport function CarouselViewport({ children, className, ...rest }: CarouselViewportProps) {\n const carousel = useCarousel('CarouselViewport');\n return (\n <div\n id={`${carousel.baseId}-viewport`}\n data-slot=\"carousel-viewport\"\n className={clsx('overflow-hidden', className)}\n {...rest}\n >\n {children}\n </div>\n );\n}\n\nexport interface CarouselSlideProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n}\n\nexport function CarouselSlide({ children, className, ...rest }: CarouselSlideProps) {\n const carousel = useCarousel('CarouselSlide');\n const slideIndex = carousel.registerSlide();\n const active = slideIndex === carousel.index;\n\n return (\n <div\n role=\"group\"\n aria-roledescription=\"slide\"\n // Position stated explicitly — without it, only the dots convey where you are.\n aria-label={`${slideIndex + 1} of ${carousel.count}`}\n // `hidden`, not a transform. An off-screen slide that is merely translated keeps its\n // links focusable, so Tab walks into invisible content.\n hidden={!active}\n data-slot=\"carousel-slide\"\n className={className}\n {...rest}\n >\n {children}\n </div>\n );\n}\n\nexport interface CarouselControlsProps extends HTMLAttributes<HTMLDivElement> {\n /** Show the dot indicators. Default `true`. */\n showDots?: boolean;\n}\n\nexport function CarouselControls({ showDots = true, className, ...rest }: CarouselControlsProps) {\n const carousel = useCarousel('CarouselControls');\n const { index, count, loop } = carousel;\n\n const go = useCallback(\n (next: number) => {\n const wrapped = ((next % count) + count) % count;\n carousel.setIndex(loop ? wrapped : Math.min(Math.max(next, 0), count - 1));\n },\n [carousel, count, loop],\n );\n\n return (\n <div\n className={clsx('mt-3 flex items-center justify-between gap-3', className)}\n {...rest}\n >\n <IconButton\n variant=\"neutral\"\n size=\"sm\"\n aria-label=\"Previous slide\"\n aria-controls={`${carousel.baseId}-viewport`}\n disabled={!loop && index === 0}\n onClick={() => go(index - 1)}\n >\n <ChevronLeftIcon aria-hidden size={16} />\n </IconButton>\n\n {showDots && (\n <div role=\"group\" aria-label={`Slide ${index + 1} of ${count}`} className=\"flex items-center gap-2\">\n {Array.from({ length: count }, (_, i) => (\n <button\n key={i}\n type=\"button\"\n aria-label={`Go to slide ${i + 1}`}\n aria-current={i === index ? 'true' : undefined}\n onClick={() => go(i)}\n className={clsx(\n 'size-2 rounded-full transition-colors',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-2 focus-visible:ring-offset-default',\n i === index ? 'bg-brand' : 'bg-default-tertiary hover:bg-neutral-secondary',\n )}\n />\n ))}\n </div>\n )}\n\n <div className=\"flex items-center gap-1.5\">\n {/* Required by WCAG 2.2.2 whenever autoplay is on: any motion lasting more than five\n seconds needs a visible, keyboard-reachable way to stop it. */}\n {carousel.hasAutoplay && (\n <IconButton\n variant=\"neutral\"\n size=\"sm\"\n aria-label={carousel.paused ? 'Start automatic slide show' : 'Stop automatic slide show'}\n onClick={() => carousel.setPaused(!carousel.paused)}\n >\n <span aria-hidden className=\"text-body-tiny font-semibold\">\n {carousel.paused ? '▶' : '❚❚'}\n </span>\n </IconButton>\n )}\n <IconButton\n variant=\"neutral\"\n size=\"sm\"\n aria-label=\"Next slide\"\n aria-controls={`${carousel.baseId}-viewport`}\n disabled={!loop && index === count - 1}\n onClick={() => go(index + 1)}\n >\n <ChevronRightIcon aria-hidden size={16} />\n </IconButton>\n </div>\n </div>\n );\n}\n","import {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from 'react';\nimport { ScrollArea } from './scroll-area';\nimport clsx from 'clsx';\nimport { composeEventHandlers } from '../../lib/compose-event-handlers';\nimport { useControllableState } from '../../lib/use-controllable-state';\n\nexport type ResizableDirection = 'horizontal' | 'vertical';\n\ninterface ResizableContextValue {\n direction: ResizableDirection;\n /** First pane's size, as a percentage of the container. */\n size: number;\n setSize: (size: number) => void;\n min: number;\n max: number;\n containerRef: React.RefObject<HTMLDivElement | null>;\n baseId: string;\n dragging: boolean;\n setDragging: (dragging: boolean) => void;\n}\n\nconst ResizableContext = createContext<ResizableContextValue | null>(null);\n\nfunction useResizable(part: string): ResizableContextValue {\n const value = useContext(ResizableContext);\n if (!value) throw new Error(`<${part}> must be used inside <Resizable>`);\n return value;\n}\n\nexport interface ResizableProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n direction?: ResizableDirection;\n /** First pane's size as a percentage. Controlled. */\n size?: number;\n defaultSize?: number;\n onSizeChange?: (size: number) => void;\n /** Percentage bounds. Defaults `10` and `90`. */\n min?: number;\n max?: number;\n}\n\n/**\n * Two resizable panes with a draggable divider.\n *\n * This is the APG **window splitter** pattern, and the handle is the whole component as far\n * as accessibility goes. A `<div>` with pointer listeners — the usual implementation — is\n * completely unusable without a mouse. `ResizableHandle` is therefore a real focusable\n * control with:\n *\n * - `role=\"separator\"` plus `aria-valuenow`/`valuemin`/`valuemax`, so the current split is\n * announced as a percentage rather than being invisible;\n * - `tabIndex={0}` and arrow keys to move it in 1% steps, Shift+arrow in 10%, Home/End to\n * the bounds, and Enter to collapse and restore;\n * - `aria-controls` pointing at the pane it resizes.\n *\n * Sizes are percentages, not pixels, so the split survives a container resize — a pixel\n * split silently becomes wrong the moment the window changes.\n */\nexport function Resizable({\n children,\n direction = 'horizontal',\n size: sizeProp,\n defaultSize = 50,\n onSizeChange,\n min = 10,\n max = 90,\n className,\n ...rest\n}: ResizableProps) {\n const [size, setSize] = useControllableState({\n value: sizeProp,\n defaultValue: defaultSize,\n onChange: onSizeChange,\n });\n\n const containerRef = useRef<HTMLDivElement>(null);\n const baseId = useId();\n const [dragging, setDragging] = useState(false);\n\n const context = useMemo<ResizableContextValue>(\n () => ({\n direction,\n size,\n setSize: (next) => setSize(Math.min(Math.max(next, min), max)),\n min,\n max,\n containerRef,\n baseId,\n dragging,\n setDragging,\n }),\n [direction, size, setSize, min, max, baseId, dragging],\n );\n\n return (\n <ResizableContext.Provider value={context}>\n <div\n ref={containerRef}\n data-slot=\"resizable\"\n className={clsx(\n 'flex w-full',\n direction === 'horizontal' ? 'flex-row' : 'flex-col',\n // While dragging, suppress selection and pointer events inside the panes so the\n // gesture cannot start selecting text or hovering things it passes over.\n dragging && 'select-none [&_*]:pointer-events-none',\n className,\n )}\n {...rest}\n >\n {children}\n </div>\n </ResizableContext.Provider>\n );\n}\n\nexport interface ResizablePanelProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n /** `first` is the pane the handle sizes; `second` fills the remainder. */\n which: 'first' | 'second';\n}\n\nexport function ResizablePanel({ children, which, className, ...rest }: ResizablePanelProps) {\n const ctx = useResizable('ResizablePanel');\n const axis = ctx.direction === 'horizontal' ? 'width' : 'height';\n\n return (\n // A panel holds arbitrary content, which may be entirely static — so it needs the tab\n // stop `ScrollArea` adds while overflowing, not just the scrollbar styling.\n <ScrollArea\n axis=\"both\"\n id={which === 'first' ? `${ctx.baseId}-first` : `${ctx.baseId}-second`}\n data-slot=\"resizable-panel\"\n style={which === 'first' ? { [axis]: `${ctx.size}%` } : { flex: '1 1 0%' }}\n className={clsx('min-h-0 min-w-0', className)}\n {...rest}\n >\n {children}\n </ScrollArea>\n );\n}\n\nexport interface ResizableHandleProps extends HTMLAttributes<HTMLDivElement> {\n /** Names the splitter. Default `Resize panels`. */\n label?: string;\n /** Show the grip dots. Default `true`. */\n withGrip?: boolean;\n}\n\nexport function ResizableHandle({\n label = 'Resize panels',\n withGrip = true,\n className,\n ...rest\n}: ResizableHandleProps) {\n const ctx = useResizable('ResizableHandle');\n const horizontal = ctx.direction === 'horizontal';\n const collapsedFrom = useRef<number | null>(null);\n\n const fromPointer = useCallback(\n (clientX: number, clientY: number) => {\n const container = ctx.containerRef.current;\n if (!container) return;\n const rect = container.getBoundingClientRect();\n const ratio = horizontal\n ? (clientX - rect.left) / rect.width\n : (clientY - rect.top) / rect.height;\n ctx.setSize(ratio * 100);\n },\n [ctx, horizontal],\n );\n\n useEffect(() => {\n if (!ctx.dragging) return;\n\n const onMove = (event: PointerEvent) => fromPointer(event.clientX, event.clientY);\n const onUp = () => ctx.setDragging(false);\n\n // Listeners on the window, not the handle: the pointer routinely leaves the 8px handle\n // mid-drag, and a handle-scoped listener would drop the gesture.\n window.addEventListener('pointermove', onMove);\n window.addEventListener('pointerup', onUp);\n window.addEventListener('pointercancel', onUp);\n return () => {\n window.removeEventListener('pointermove', onMove);\n window.removeEventListener('pointerup', onUp);\n window.removeEventListener('pointercancel', onUp);\n };\n }, [ctx, fromPointer]);\n\n return (\n // A *focusable* separator is the APG window-splitter pattern, and the whole point of this\n // component: without the tab stop and the arrow keys below, a split view can only be\n // resized with a mouse. ARIA explicitly allows a focusable separator, which is what\n // carries `aria-valuenow`; jsx-a11y models `separator` as always non-interactive.\n // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex, jsx-a11y/no-noninteractive-element-interactions\n <div\n role=\"separator\"\n // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex\n tabIndex={0}\n aria-label={label}\n aria-orientation={horizontal ? 'vertical' : 'horizontal'}\n aria-valuenow={Math.round(ctx.size)}\n aria-valuemin={ctx.min}\n aria-valuemax={ctx.max}\n aria-controls={`${ctx.baseId}-first`}\n data-slot=\"resizable-handle\"\n {...rest}\n onPointerDown={composeEventHandlers(rest.onPointerDown, (event) => {\n event.preventDefault();\n ctx.setDragging(true);\n })}\n onKeyDown={composeEventHandlers(rest.onKeyDown, (event) => {\n const step = event.shiftKey ? 10 : 1;\n const decrease = horizontal ? 'ArrowLeft' : 'ArrowUp';\n const increase = horizontal ? 'ArrowRight' : 'ArrowDown';\n\n if (event.key === decrease) {\n event.preventDefault();\n ctx.setSize(ctx.size - step);\n } else if (event.key === increase) {\n event.preventDefault();\n ctx.setSize(ctx.size + step);\n } else if (event.key === 'Home') {\n event.preventDefault();\n ctx.setSize(ctx.min);\n } else if (event.key === 'End') {\n event.preventDefault();\n ctx.setSize(ctx.max);\n } else if (event.key === 'Enter') {\n // Collapse/restore, so the splitter is useful without dragging at all.\n event.preventDefault();\n if (collapsedFrom.current === null) {\n collapsedFrom.current = ctx.size;\n ctx.setSize(ctx.min);\n } else {\n ctx.setSize(collapsedFrom.current);\n collapsedFrom.current = null;\n }\n }\n })}\n className={clsx(\n 'group relative flex shrink-0 items-center justify-center bg-divider transition-colors',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand',\n 'hover:bg-brand-tertiary',\n horizontal ? 'w-px cursor-col-resize' : 'h-px cursor-row-resize',\n className,\n )}\n \n >\n {/* An invisible padded hit area, so the 1px rule is grabbable without being 8px of\n visible chrome. */}\n <span\n aria-hidden\n className={clsx('absolute', horizontal ? 'inset-y-0 -inset-x-1.5' : '-inset-y-1.5 inset-x-0')}\n />\n {withGrip && (\n <span\n aria-hidden\n className={clsx(\n 'relative z-raised flex items-center justify-center rounded-full border border-default bg-default',\n 'opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100',\n horizontal ? 'h-6 w-2.5' : 'h-2.5 w-6',\n )}\n >\n <span className={clsx('rounded-full bg-default-tertiary', horizontal ? 'h-2.5 w-px' : 'h-px w-2.5')} />\n </span>\n )}\n </div>\n );\n}\n","import clsx from 'clsx';\nimport type { ReactNode } from 'react';\n\n/**\n * Two genuinely different heading contexts, which the source markup distinguished:\n *\n * `page` 24px title / 14px subtitle — an in-body page heading (settings, users,\n * alerts), i.e. the old `text-2xl` + `mt-1 text-body-sm` block.\n * `toolbar` 20px title / 13px subtitle — inside a `PageToolbar`, where the bar is\n * only 72px tall. Flattening these into one size would have grown ten\n * toolbar titles by 4px.\n * `section` 18px — a panel or card heading.\n */\nexport type PageHeadingSize = 'page' | 'toolbar' | 'section';\n\nconst TITLE: Record<PageHeadingSize, string> = {\n // `text-2xl` was stock Tailwind rather than the design tokens. Same 24px, now on-token.\n page: 'text-heading font-semibold text-default',\n toolbar: 'text-heading-sm font-semibold leading-snug text-default',\n // Was `text-lg` — stock Tailwind's 18px, off the type scale. Snapped DOWN to 16 rather\n // than up to 20, because 20 is already `toolbar`: rounding up would have made two of the\n // three sizes identical and collapsed the ramp to page 24 / toolbar 20 / section 20.\n section: 'text-subheading-sm font-semibold text-default',\n};\n\nconst SUBTITLE: Record<PageHeadingSize, string> = {\n page: 'mt-1 text-body-sm text-default-secondary',\n toolbar: 'text-body-xs text-default-secondary',\n section: 'mt-1 text-body-sm text-default-secondary',\n};\n\nexport interface PageHeadingProps {\n title: ReactNode;\n subtitle?: ReactNode;\n size?: PageHeadingSize;\n /** Heading level. Defaults to `h1` for page/toolbar and `h2` for section. */\n as?: 'h1' | 'h2' | 'h3';\n /**\n * Chips beside the title (\"System\", \"Editing\"). They sit outside the heading element, so they\n * are not part of the heading's accessible name. New in 0.9.5.\n */\n badges?: ReactNode;\n /** A muted line between the title and the subtitle, e.g. \"PS-014 · Finance\". New in 0.9.5. */\n meta?: ReactNode;\n /** Right-aligned action cluster. When set, the heading becomes a flex row. */\n actions?: ReactNode;\n /** Clamp a long title to one line — needed when the title is user data, e.g. an article headline. */\n truncateTitle?: boolean;\n className?: string;\n}\n\n/**\n * Page or section title with an optional subtitle underneath.\n *\n * Replaces nine copies of the `<h1>` + `<p className=\"mt-1 …\">` block, plus the\n * heading halves of `SettingsTabs` and `my-account/tabs`.\n *\n * Emitting a real heading element matters: `reviewer-detail`,\n * `settings-audit-log`'s table area and `widget-gallery` render their titles as\n * `<p>`/`<div>` today, so `getByRole('heading')` finds nothing there — an\n * accessibility gap the e2e specs currently work around.\n */\nexport function PageHeading({\n title,\n subtitle,\n size = 'page',\n as,\n badges,\n meta,\n actions,\n truncateTitle,\n className,\n}: PageHeadingProps) {\n const Tag = as ?? (size === 'section' ? 'h2' : 'h1');\n\n const heading = (\n <div className=\"flex min-w-0 flex-col gap-0.5\">\n {badges ? (\n <div className=\"flex min-w-0 flex-wrap items-center gap-2.5\">\n <Tag className={clsx(TITLE[size], truncateTitle && 'truncate')}>{title}</Tag>\n {badges}\n </div>\n ) : (\n <Tag className={clsx(TITLE[size], truncateTitle && 'truncate')}>{title}</Tag>\n )}\n {meta && <div className=\"flex flex-wrap items-center gap-2.5 text-body-xs text-default-secondary\">{meta}</div>}\n {subtitle && <p className={SUBTITLE[size]}>{subtitle}</p>}\n </div>\n );\n\n if (!actions) return className ? <div className={className}>{heading}</div> : heading;\n\n return (\n <div className={clsx('flex items-start justify-between gap-4', className)}>\n {heading}\n <div className=\"flex shrink-0 items-center gap-2\">{actions}</div>\n </div>\n );\n}\n","import clsx from 'clsx';\nimport type { ReactNode } from 'react';\nimport { ArrowLeftIcon } from 'lucide-react';\nimport { IconButton } from '../forms/icon-button';\n\nexport type PageToolbarSize = 'sm' | 'md';\n\nexport interface PageToolbarProps {\n /** The heading block (usually a `PageHeading`). Without `actions`, the actions as well (legacy). */\n children: ReactNode;\n /**\n * The action cluster, e.g. buttons. New in 0.9.1. Passing it makes the bar responsive: on a\n * wide screen the actions sit on the heading's row, at the right; when they don't fit, they\n * wrap below the heading and among themselves. The heading never narrows below 12rem (or the\n * full width, if less). Without it, children keep the old single-row layout, which squeezed\n * the heading to a sliver and ran the actions off-screen on a phone.\n */\n actions?: ReactNode;\n /**\n * Renders an icon-only back control at the far left, ahead of the heading: the Page Header's\n * `backButton` in Figma (node 3473:16837). New in 0.7.0, from SCIC. Omit for no back control.\n */\n onBack?: () => void;\n /** Accessible name for the back control. Default \"Go back\". */\n backLabel?: string;\n /**\n * Allow the row to wrap when the action cluster is wide (entity-detail has seven buttons).\n * @deprecated Pass the actions through `actions`, which always wraps where needed.\n */\n wrap?: boolean;\n /**\n * The bar's **own** height and padding. `sm` suits a secondary bar under the main toolbar.\n *\n * Not to be confused with `FilterBar.size`, which sets the density of the controls\n * *inside* the row. Same literals, different subject: a bar sizes itself, a row of\n * controls sizes its children. `PageToolbar` passes nothing down.\n */\n size?: PageToolbarSize;\n className?: string;\n}\n\nconst SIZE: Record<PageToolbarSize, string> = {\n sm: 'min-h-[56px] px-4 py-3 md:px-7',\n md: 'min-h-[72px] px-4 py-4 md:px-7',\n};\n\n/**\n * The sticky top bar on a full-bleed detail or list screen: title block on the\n * left, actions on the right.\n *\n * Replaces ten copies of this class string. Three of those copies used the\n * responsive `px-4 py-4 md:px-7` and seven used a fixed `px-7 py-4`; the responsive\n * variant is adopted here, which is a deliberate improvement below `md` where the\n * fixed 28px padding was cramped.\n */\nexport function PageToolbar({\n children,\n actions,\n onBack,\n backLabel = 'Go back',\n wrap,\n size = 'md',\n className,\n}: PageToolbarProps) {\n if (actions !== undefined) {\n return (\n <div\n data-slot=\"page-toolbar\"\n className={clsx(\n 'flex shrink-0 flex-wrap items-center gap-x-4 gap-y-3 border-b border-default bg-default',\n SIZE[size],\n className,\n )}\n >\n {/* Back control and heading share one unbreakable group, so the back arrow never\n ends up alone on a row. */}\n <div className=\"flex min-w-[min(100%,12rem)] flex-1 basis-48 items-center gap-4\">\n {onBack && (\n <IconButton variant=\"neutral\" size=\"md\" aria-label={backLabel} onClick={onBack}>\n <ArrowLeftIcon aria-hidden />\n </IconButton>\n )}\n <div className=\"min-w-0 flex-1\">{children}</div>\n </div>\n {/* `ml-auto` keeps the actions right-aligned on the heading's row and on their own. */}\n <div data-slot=\"page-toolbar-actions\" className=\"ml-auto flex max-w-full flex-wrap items-center justify-end gap-2\">\n {actions}\n </div>\n </div>\n );\n }\n\n return (\n <div\n className={clsx(\n 'flex shrink-0 items-center gap-4 border-b border-default bg-default',\n SIZE[size],\n !onBack && 'justify-between',\n !onBack && wrap && 'flex-wrap gap-2',\n className,\n )}\n >\n {onBack && (\n <IconButton variant=\"neutral\" size=\"md\" aria-label={backLabel} onClick={onBack}>\n <ArrowLeftIcon aria-hidden />\n </IconButton>\n )}\n {/* With a back control the heading and actions keep their split inside a flex-1\n wrapper, so the back control stays pinned left rather than spaced out with them. */}\n {onBack ? (\n <div className={clsx('flex min-w-0 flex-1 items-center justify-between gap-4', wrap && 'flex-wrap gap-2')}>\n {children}\n </div>\n ) : (\n children\n )}\n </div>\n );\n}\n","import clsx from 'clsx';\nimport type { ReactNode } from 'react';\nimport { ControlSizeProvider } from '../forms/control-size';\n\nexport type FilterBarSize = 'sm' | 'md';\n\nexport interface FilterBarProps {\n children: ReactNode;\n /** Right-aligned slot for a result count or a secondary action. */\n trailing?: ReactNode;\n /**\n * Row density. Sets the gap between controls **and** the default `size` of the controls\n * inside — an Input, Select, Combobox, DatePicker or Button that is not given its own\n * `size` inherits this one. Pass `size` on a child to opt it out.\n *\n * `sm` is for a filter row inside a card or drawer: 8px gaps and 24px controls.\n */\n size?: FilterBarSize;\n className?: string;\n}\n\nconst GAP: Record<FilterBarSize, string> = {\n sm: 'gap-2',\n md: 'gap-3',\n};\n\n/**\n * Row of search inputs and filter selects above a table.\n *\n * Replaces nine copies of `flex flex-wrap items-center gap-3`.\n *\n * Through 0.4.0 `size` set only the gap, so every caller had to repeat it on each control\n * and the page documenting this component got it wrong: its `size=\"sm\"` example put a 24px\n * Input beside a 36px Select. A container with a size prop should mean it, so the size now\n * reaches the controls through `ControlSizeProvider`.\n */\nexport function FilterBar({ children, trailing, size = 'md', className }: FilterBarProps) {\n return (\n <ControlSizeProvider size={size}>\n <div className={clsx('flex flex-wrap items-center', GAP[size], className)}>\n {children}\n {/* Was a fixed `gap-2`, which disagreed with the row itself at `md`. */}\n {trailing && <div className={clsx('ml-auto flex items-center', GAP[size])}>{trailing}</div>}\n </div>\n </ControlSizeProvider>\n );\n}\n","import {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactElement,\n type ReactNode,\n type MutableRefObject,\n} from 'react';\nimport clsx from 'clsx';\nimport { ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';\nimport { Tabs as TabsPrimitive } from 'radix-ui';\nimport { cn } from '../../lib/cn';\nimport { FOCUS_RING } from '../../lib/focus-ring';\nimport { composeRefs } from '../../lib/slot';\nimport { useRovingFocus } from '../../lib/use-roving-focus';\nimport { useControllableState } from '../../lib/use-controllable-state';\n\nexport type TabsVariant = 'underline' | 'pill';\nexport type TabsSize = 'sm' | 'md';\nexport type TabsOrientation = 'horizontal' | 'vertical';\n/**\n * `automatic` selects as focus moves, which is the APG default and right when panels are\n * cheap. `manual` requires Enter/Space — use it when switching tab triggers a fetch, so\n * arrowing across five tabs does not fire five requests.\n */\nexport type TabsActivation = 'automatic' | 'manual';\n\nexport interface TabItem<K extends string = string> {\n key: K;\n label: string;\n /**\n * Renders a count chip after the label. A number is formatted for `locale` (`1,284`); pass a\n * node for anything else, e.g. `\"99+\"`. A node from 0.9.4.\n */\n count?: ReactNode;\n disabled?: boolean;\n}\n\n/** The `items` form: a tab strip only, with `TabsPanel`s placed wherever the page needs them. */\nexport interface TabsProps<K extends string = string> {\n items: TabItem<K>[];\n /** Controlled selection. Omit and pass `defaultValue` for uncontrolled. */\n value?: K;\n defaultValue?: K;\n onValueChange?: (key: K) => void;\n /**\n * `underline` is the detail-page form (entity detail, reviewer detail, role detail).\n * `pill` is the filter-style form used by the reviewer queue.\n */\n variant?: TabsVariant;\n /** `md` is the page-level strip; `sm` suits a tab strip inside a card or drawer. */\n size?: TabsSize;\n orientation?: TabsOrientation;\n activation?: TabsActivation;\n /**\n * Shared prefix for the tab and panel ids. Pass the same value to each `TabsPanel` and the\n * tabs point `aria-controls` at their panels. Without it, `aria-controls` is left off: a\n * generated prefix would point it at ids no panel has. The composable form needs neither.\n */\n idPrefix?: string;\n /** Names the tab strip. Required by the APG when there is more than one on a page. */\n label?: string;\n /** Locale for numeric `count`s. Default: the browser's. New in 0.9.4. */\n locale?: string;\n className?: string;\n}\n\n/**\n * The composable form, new in 0.7.0 and built on Radix Tabs: `Tabs` wraps a `TabsList` of\n * `TabsTrigger`s and the `TabsContent` panels, and wires every id itself.\n */\nexport interface TabsRootProps {\n children: ReactNode;\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n variant?: TabsVariant;\n size?: TabsSize;\n orientation?: TabsOrientation;\n activation?: TabsActivation;\n /** Reading direction, which flips Left/Right in a horizontal strip. */\n dir?: 'ltr' | 'rtl';\n /** Locale for numeric `count`s on the triggers. Default: the browser's. New in 0.9.4. */\n locale?: string;\n className?: string;\n}\n\n/**\n * Per-variant sizing. The two variants have genuinely different geometry — a pill has\n * a background to pad against, an underline only has a baseline — so this is a nested\n * map rather than one shared scale.\n */\nconst SIZE: Record<TabsVariant, Record<TabsSize, { strip: string; tab: string }>> = {\n underline: {\n sm: { strip: 'gap-4', tab: 'px-0.5 py-1.5 text-body-xs' },\n md: { strip: 'gap-6', tab: 'px-0.5 py-2.5 text-body-sm' },\n },\n pill: {\n sm: { strip: 'gap-1', tab: 'rounded-md px-2.5 py-1.5 text-body-tiny' },\n md: { strip: 'gap-1.5', tab: 'rounded-lg px-3.5 py-2 text-body-xs' },\n },\n};\n\n/**\n * One look for both forms, keyed on `aria-selected`, which our strip and Radix's triggers\n * both set. The selected state lives in the attribute, not in a conditional class.\n *\n * The `underline` selected colour is `background-brand` (#0C2D58), which is what Figma\n * specifies.\n */\nconst TAB_VARIANT: Record<TabsVariant, string> = {\n pill: clsx(\n 'font-medium text-default-secondary hover:bg-default-secondary',\n 'aria-selected:bg-brand aria-selected:text-brand-on-brand aria-selected:hover:bg-brand',\n ),\n underline: clsx(\n 'snap-start leading-snug font-normal text-default-secondary hover:text-default',\n 'border-b-2 border-transparent',\n 'aria-selected:border-brand-emphasis aria-selected:font-semibold aria-selected:text-brand-emphasis',\n ),\n};\n\nconst tabClasses = (variant: TabsVariant, size: TabsSize) =>\n clsx(\n 'group flex shrink-0 items-center gap-1.5 whitespace-nowrap transition-colors',\n FOCUS_RING,\n 'disabled:cursor-not-allowed disabled:opacity-50',\n SIZE[variant][size].tab,\n TAB_VARIANT[variant],\n );\n\n/** A horizontal underline strip scrolls; a pill strip wraps; a vertical strip stacks. */\nconst scrollsHorizontally = (variant: TabsVariant, orientation: TabsOrientation) =>\n variant === 'underline' && orientation === 'horizontal';\n\nconst stripClasses = (variant: TabsVariant, size: TabsSize, orientation: TabsOrientation) =>\n clsx(\n 'flex',\n // The strip's own children are the tab stops, so it needs no tab stop of its own.\n orientation === 'vertical'\n ? 'shrink-0 flex-col'\n : variant === 'pill'\n ? // Pills are a handful of filter-style choices: wrap, so every one stays visible.\n 'shrink-0 flex-wrap'\n : // Underline tabs are page sections: scroll, snapping to whole tabs. The edge buttons are\n // the affordance, so the (often overlay) native scrollbar is hidden rather than doubled.\n 'min-w-0 flex-1 snap-x snap-mandatory overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden',\n SIZE[variant][size].strip,\n variant === 'underline' &&\n (orientation === 'vertical' ? 'border-r border-default' : 'border-b border-default'),\n );\n\n/** The count chip. Inverts with its tab in the pill variant, styled from the tab's state. */\nfunction TabCount({ count, variant, locale }: { count: ReactNode; variant: TabsVariant; locale?: string }) {\n return (\n <span\n className={clsx(\n 'rounded-md bg-default-secondary px-1.5 py-px text-body-tiny font-medium leading-snug text-default-secondary',\n variant === 'pill' &&\n 'group-aria-selected:bg-brand-hover group-aria-selected:text-brand-on-brand',\n )}\n >\n {typeof count === 'number' ? count.toLocaleString(locale) : count}\n </span>\n );\n}\n\n// ── Scrolling strip ────────────────────────────────────────────────────────────\n\n/** Room kept clear for an edge button when scrolling a tab into view, in px (`w-8`). */\nconst EDGE_PAD = 32;\n\nconst prefersReducedMotion = () =>\n typeof window !== 'undefined' && window.matchMedia?.('(prefers-reduced-motion: reduce)').matches === true;\n\ninterface TabStrip {\n listRef: MutableRefObject<HTMLDivElement | null>;\n edges: { start: boolean; end: boolean };\n measure: () => void;\n page: (direction: 1 | -1) => void;\n}\n\n/**\n * Overflow tracking for a scrolling tab strip: which edges have hidden tabs, paging by the edge\n * buttons, and keeping the selected tab in view when the selection changes, including from\n * outside (a `?tab=` URL). Scrolls the strip only; `scrollIntoView` would scroll the page too.\n * `ResizeObserver`, `scrollTo` and `scrollBy` are guarded, for jsdom.\n */\nfunction useTabStrip(enabled: boolean): TabStrip {\n const listRef = useRef<HTMLDivElement | null>(null);\n const selected = useRef<Element | null>(null);\n const [edges, setEdges] = useState({ start: false, end: false });\n\n const measure = useCallback(() => {\n const el = listRef.current;\n if (!enabled || !el) return;\n const start = el.scrollLeft > 1;\n const end = el.scrollLeft + el.clientWidth < el.scrollWidth - 1;\n setEdges((prev) => (prev.start === start && prev.end === end ? prev : { start, end }));\n }, [enabled]);\n\n useLayoutEffect(() => {\n const el = listRef.current;\n if (!enabled || !el || typeof ResizeObserver === 'undefined') return;\n const observer = new ResizeObserver(measure);\n observer.observe(el);\n return () => observer.disconnect();\n }, [enabled, measure]);\n\n // Every render: tabs added or relabelled change the strip's scroll width without resizing it.\n useLayoutEffect(() => {\n const list = listRef.current;\n if (!enabled || !list) return;\n measure();\n const tab = list.querySelector<HTMLElement>('[role=\"tab\"][aria-selected=\"true\"]');\n if (!tab || tab === selected.current) return;\n selected.current = tab;\n if (typeof list.scrollTo !== 'function') return;\n const left = tab.offsetLeft - list.offsetLeft;\n const right = left + tab.offsetWidth;\n if (left < list.scrollLeft + EDGE_PAD) list.scrollTo({ left: Math.max(0, left - EDGE_PAD) });\n else if (right > list.scrollLeft + list.clientWidth - EDGE_PAD) {\n list.scrollTo({ left: right - list.clientWidth + EDGE_PAD });\n }\n });\n\n const page = useCallback((direction: 1 | -1) => {\n const el = listRef.current;\n if (!el || typeof el.scrollBy !== 'function') return;\n el.scrollBy({ left: direction * el.clientWidth * 0.8, behavior: prefersReducedMotion() ? 'auto' : 'smooth' });\n }, []);\n\n return { listRef, edges, measure, page };\n}\n\n/**\n * The frame around a scrolling strip: the strip plus an edge button on each side with hidden\n * tabs. The buttons are pointer conveniences (`aria-hidden`, not focusable): the arrow keys\n * already move along the strip, and a native scrollbar is no affordance where it overlays.\n */\nfunction TabStripFrame({ strip, children }: { strip: TabStrip; children: ReactNode }) {\n return (\n <div className=\"relative flex min-w-0 max-w-full\">\n {children}\n {strip.edges.start && <TabStripEdge side=\"start\" onClick={() => strip.page(-1)} />}\n {strip.edges.end && <TabStripEdge side=\"end\" onClick={() => strip.page(1)} />}\n </div>\n );\n}\n\nfunction TabStripEdge({ side, onClick }: { side: 'start' | 'end'; onClick: () => void }) {\n const Icon = side === 'start' ? ChevronLeftIcon : ChevronRightIcon;\n return (\n <button\n type=\"button\"\n aria-hidden\n tabIndex={-1}\n onClick={onClick}\n data-edge={side}\n className={clsx(\n // `bottom-px` keeps the strip's baseline visible under the fade.\n 'absolute bottom-px top-0 z-raised flex w-8 items-center text-icon-default-secondary hover:text-icon-default',\n side === 'start'\n ? 'left-0 justify-start bg-gradient-to-r from-default via-default to-transparent'\n : 'right-0 justify-end bg-gradient-to-l from-default via-default to-transparent',\n )}\n >\n <Icon className=\"size-4\" />\n </button>\n );\n}\n\nexport const tabId = (prefix: string, key: string) => `${prefix}-tab-${key}`;\nexport const tabPanelId = (prefix: string, key: string) => `${prefix}-panel-${key}`;\n\n/**\n * Tabs, in two forms.\n *\n * // items: a strip; panels live anywhere, linked by idPrefix.\n * <Tabs items={items} value={tab} onValueChange={setTab} idPrefix=\"entity\" />\n * <TabsPanel tabKey=\"overview\" idPrefix=\"entity\" active={tab === 'overview'}>…</TabsPanel>\n *\n * // composable (0.7.0, Radix): strip and panels in one tree, ids wired for you.\n * <Tabs defaultValue=\"overview\">\n * <TabsList label=\"Sections\"><TabsTrigger value=\"overview\">Overview</TabsTrigger></TabsList>\n * <TabsContent value=\"overview\">…</TabsContent>\n * </Tabs>\n *\n * Both implement the WAI-ARIA tabs pattern: one tab stop on the selected tab, arrows along the\n * strip (wrapping), Home/End, disabled tabs skipped, automatic or manual activation, and\n * `role=\"tabpanel\"` regions labelled by their tabs. 0.3.0 had the roles and none of the keys.\n */\n// Overloads, not a union of the two prop types: with a union, `onValueChange={(key) => …}`\n// loses its contextual type and `key` becomes an implicit `any` at every strict call site.\nexport function Tabs<K extends string = string>(props: TabsProps<K>): ReactElement;\nexport function Tabs(props: TabsRootProps): ReactElement;\nexport function Tabs<K extends string = string>(props: TabsProps<K> | TabsRootProps): ReactElement {\n if ('items' in props && props.items) return <ItemsTabs {...(props as TabsProps<K>)} />;\n return <TabsRoot {...(props as TabsRootProps)} />;\n}\n\nfunction ItemsTabs<K extends string = string>({\n items,\n value: valueProp,\n defaultValue,\n onValueChange,\n variant = 'underline',\n size = 'md',\n orientation = 'horizontal',\n activation = 'automatic',\n idPrefix,\n label,\n locale,\n className,\n}: TabsProps<K>) {\n const scrolls = scrollsHorizontally(variant, orientation);\n const strip = useTabStrip(scrolls);\n const generatedPrefix = useId();\n const prefix = idPrefix ?? generatedPrefix;\n\n const [value, setValue] = useControllableState<K>({\n value: valueProp,\n defaultValue: defaultValue ?? items[0]?.key,\n onChange: onValueChange as ((next: K) => void) | undefined,\n });\n\n const selectedIndex = Math.max(\n 0,\n items.findIndex((item) => item.key === value),\n );\n\n const roving = useRovingFocus({\n orientation: orientation === 'vertical' ? 'vertical' : 'horizontal',\n loop: true,\n defaultIndex: selectedIndex,\n });\n\n const list = (\n <div\n ref={strip.listRef}\n role=\"tablist\"\n aria-label={label}\n aria-orientation={orientation}\n data-variant={variant}\n onScroll={scrolls ? strip.measure : undefined}\n className={cn(\n stripClasses(variant, size, orientation),\n scrolls && (strip.edges.start || strip.edges.end) && 'scroll-px-8',\n className,\n )}\n {...roving.containerProps}\n >\n {items.map((tab, index) => {\n const active = tab.key === value;\n const itemProps = roving.itemProps(index, { disabled: tab.disabled, label: tab.label });\n\n return (\n <button\n key={tab.key}\n type=\"button\"\n role=\"tab\"\n id={tabId(prefix, tab.key)}\n aria-selected={active}\n aria-controls={idPrefix ? tabPanelId(prefix, tab.key) : undefined}\n data-state={active ? 'active' : 'inactive'}\n disabled={tab.disabled}\n {...itemProps}\n // Selection, not focus, owns the tab stop: Tab must land on the *selected*\n // tab, which is not necessarily the one the arrow keys last visited.\n tabIndex={active ? 0 : -1}\n onFocus={() => {\n itemProps.onFocus();\n // Automatic activation: focus and selection move together.\n if (activation === 'automatic' && !tab.disabled) setValue(tab.key);\n }}\n onClick={() => !tab.disabled && setValue(tab.key)}\n onKeyDown={(event) => {\n if (activation === 'manual' && (event.key === 'Enter' || event.key === ' ')) {\n event.preventDefault();\n setValue(tab.key);\n }\n }}\n className={tabClasses(variant, size)}\n >\n {tab.label}\n {tab.count !== undefined && <TabCount count={tab.count} variant={variant} locale={locale} />}\n </button>\n );\n })}\n </div>\n );\n\n return scrolls ? <TabStripFrame strip={strip}>{list}</TabStripFrame> : list;\n}\n\n/** Panels get a visible focus ring: they are tab stops when they hold nothing focusable. */\nconst PANEL_CLASSES = clsx(FOCUS_RING, 'rounded-sm');\n\nexport interface TabsPanelProps extends HTMLAttributes<HTMLDivElement> {\n /** The `key` of the tab this panel belongs to. */\n tabKey: string;\n /** Must match the `idPrefix` given to `Tabs`. */\n idPrefix: string;\n /** Whether this panel's tab is the selected one. */\n active: boolean;\n children: ReactNode;\n /**\n * Keep the panel mounted while hidden. Default `false`. Mounting all panels preserves\n * scroll position and form state across tab switches at the cost of rendering them all.\n */\n keepMounted?: boolean;\n}\n\n/**\n * The `role=\"tabpanel\"` half of the `items` form.\n *\n * `tabIndex={0}` is deliberate and required: when a panel contains no focusable element,\n * it must be reachable itself, otherwise Tab from the selected tab skips the content\n * entirely. So it also needs a visible focus ring, which 0.6 suppressed (WCAG 2.4.7).\n */\nexport function TabsPanel({\n tabKey,\n idPrefix,\n active,\n children,\n keepMounted = false,\n className,\n ...rest\n}: TabsPanelProps) {\n if (!active && !keepMounted) return null;\n\n return (\n <div\n role=\"tabpanel\"\n id={tabPanelId(idPrefix, tabKey)}\n aria-labelledby={tabId(idPrefix, tabKey)}\n hidden={!active}\n tabIndex={0}\n data-state={active ? 'active' : 'inactive'}\n className={cn(PANEL_CLASSES, className)}\n {...rest}\n >\n {children}\n </div>\n );\n}\n\n// ── Composable form (Radix) ────────────────────────────────────────────────────\n\nconst TabsStyle = createContext<{\n variant: TabsVariant;\n size: TabsSize;\n orientation: TabsOrientation;\n locale?: string;\n}>({\n variant: 'underline',\n size: 'md',\n orientation: 'horizontal',\n});\n\nfunction TabsRoot({\n children,\n value,\n defaultValue,\n onValueChange,\n variant = 'underline',\n size = 'md',\n orientation = 'horizontal',\n activation = 'automatic',\n dir,\n locale,\n className,\n}: TabsRootProps) {\n return (\n <TabsPrimitive.Root\n value={value}\n defaultValue={defaultValue}\n onValueChange={onValueChange}\n orientation={orientation}\n activationMode={activation}\n dir={dir}\n className={cn(orientation === 'vertical' ? 'flex gap-6' : 'flex flex-col gap-4', className)}\n >\n <TabsStyle.Provider value={{ variant, size, orientation, locale }}>{children}</TabsStyle.Provider>\n </TabsPrimitive.Root>\n );\n}\n\nexport interface TabsListProps extends HTMLAttributes<HTMLDivElement> {\n /** Names the tab strip. Required by the APG when there is more than one on a page. */\n label?: string;\n}\n\nexport const TabsList = forwardRef<HTMLDivElement, TabsListProps>(function TabsList(\n { label, className, onScroll, ...rest },\n ref,\n) {\n const style = useContext(TabsStyle);\n const scrolls = scrollsHorizontally(style.variant, style.orientation);\n const strip = useTabStrip(scrolls);\n const list = (\n <TabsPrimitive.List\n ref={composeRefs(ref, strip.listRef)}\n aria-label={label}\n loop\n data-variant={style.variant}\n onScroll={(event) => {\n onScroll?.(event);\n if (scrolls) strip.measure();\n }}\n className={cn(\n stripClasses(style.variant, style.size, style.orientation),\n scrolls && (strip.edges.start || strip.edges.end) && 'scroll-px-8',\n className,\n )}\n {...rest}\n />\n );\n return scrolls ? <TabStripFrame strip={strip}>{list}</TabStripFrame> : list;\n});\n\nexport interface TabsTriggerProps extends HTMLAttributes<HTMLButtonElement> {\n value: string;\n disabled?: boolean;\n /** Renders a count chip after the label. A number is formatted for the root's `locale`. */\n count?: ReactNode;\n}\n\nexport const TabsTrigger = forwardRef<HTMLButtonElement, TabsTriggerProps>(function TabsTrigger(\n { value, disabled, count, className, children, ...rest },\n ref,\n) {\n const style = useContext(TabsStyle);\n return (\n <TabsPrimitive.Trigger\n ref={ref}\n value={value}\n disabled={disabled}\n className={cn(tabClasses(style.variant, style.size), className)}\n {...rest}\n >\n {children}\n {count !== undefined && <TabCount count={count} variant={style.variant} locale={style.locale} />}\n </TabsPrimitive.Trigger>\n );\n});\n\nexport interface TabsContentProps extends HTMLAttributes<HTMLDivElement> {\n value: string;\n /** Keep the panel mounted while hidden, preserving its state. Default `false`. */\n keepMounted?: boolean;\n}\n\nexport const TabsContent = forwardRef<HTMLDivElement, TabsContentProps>(function TabsContent(\n { value, keepMounted = false, className, ...rest },\n ref,\n) {\n return (\n <TabsPrimitive.Content\n ref={ref}\n value={value}\n forceMount={keepMounted || undefined}\n className={cn(PANEL_CLASSES, 'data-[state=inactive]:hidden', className)}\n {...rest}\n />\n );\n});\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { ChevronDownIcon } from 'lucide-react';\nimport { Slot } from '../../lib/slot';\n\nexport type NavItemSize = 'sm' | 'md';\nexport type NavItemVariant = 'card' | 'plain';\n/**\n * The two Figma sidebar variants (Sidebar Navigation, node 3133:255). New in 0.9.6.\n *\n * `comfortable` is the card row: 44px, its own border and surface. `compact` is the plain\n * row: 40px, text on the rail. Both use the 16px Body Base label and a 20px icon.\n */\nexport type NavItemDensity = 'comfortable' | 'compact';\n\nexport interface NavItemProps extends Omit<HTMLAttributes<HTMLElement>, 'children'> {\n /**\n * Leading glyph. Optional, but when `collapsed` it is the only thing left to look at, so\n * a row without one falls back to a monogram taken from the label.\n */\n icon?: ReactNode;\n label: string;\n /**\n * A destination that exists but cannot be opened right now (no permission, coming soon).\n * Dimmed, out of the tab order and inert under `asChild`, with `aria-disabled` so it is\n * still announced. New in 0.7.0; replaces `pointer-events-none opacity-40` at the call site.\n */\n disabled?: boolean;\n /**\n * The row you are on — the current route. Paints the brand fill and, under `asChild`, sets\n * `aria-current=\"page\"`; it also reflects to `data-state=\"active\"`.\n *\n * Not the same thing as focus, though Figma's `MenuButton` names this variant\n * `state=focussed`. That is a misnomer to fix on the design side: keyboard focus is the\n * ring below, it is transient and can land on any row, and if it painted the brand fill\n * too there would be no way to see which row is the current one while tabbing past it.\n */\n isActive?: boolean;\n /** Red indicator dot at top-right corner (e.g. unread count) */\n indicator?: boolean;\n /** Collapsed mode — label is visually hidden but stays in the accessibility tree. */\n collapsed?: boolean;\n /** Row height. `sm` suits a dense secondary nav or a nested group. */\n size?: NavItemSize;\n /**\n * Row weight.\n *\n * `card` gives every inactive row its own border and surface — right for a short primary\n * rail of eight or ten destinations, where each row is a target in its own right.\n * `plain` drops both, so an inactive row is just text: right for a long grouped nav,\n * where thirty bordered pills read as thirty cards rather than a list.\n *\n * A variant decides what a row looks like **at rest, and nothing else**. Hover and the\n * current-row fill are one vocabulary shared by both — see `STATE`. Through 0.5.0 each\n * variant defined its own, and `plain`'s was invisible against the rail it was written for.\n */\n variant?: NavItemVariant;\n /**\n * The Figma sidebar density. New in 0.9.6, and when set it supersedes `size` and `variant`:\n * those two predate the current design file and stay only so existing rows do not change.\n */\n density?: NavItemDensity;\n /** Trailing glyph after the label, e.g. the chevron of a row that opens a submenu. */\n trailing?: ReactNode;\n /**\n * Render the single child element as the row, so the row itself is the link or button.\n *\n * `NavItem` is presentational by default — a `<span>` with hover styling. That is fine\n * inside a router `NavLink`, which is how `src/sidebar/` uses it, but on its own it is a\n * nav row that looks interactive and cannot be focused or activated. `asChild` is the\n * fix for anyone using it outside that wrapper:\n *\n * <NavItem asChild icon={<HouseIcon />} label=\"Home\">\n * <NavLink to=\"/\" />\n * </NavItem>\n */\n asChild?: boolean;\n children?: ReactNode;\n className?: string;\n}\n\n/**\n * `md` is Figma's `MenuButton` in every dimension: 44px tall, 12px radius, 12px gap, 14px\n * padding-x. `square` is the collapsed footprint — the design does not stretch a collapsed row\n * to the rail width, it centres a 44×44 button, which is exactly `px-3.5` either side of a\n * 16px icon.\n *\n * The label is the one deliberate departure. Figma specifies Body Base (16px); this is\n * `text-body-sm` (14px), because 16px rows read as oversized against everything else in a\n * product shell. The design file is the authority on the box and the colours, not on this.\n *\n * `sm` has no counterpart in the design file; it is a code-only density for long navs.\n */\nconst SIZE: Record<NavItemSize, { box: string; label: string; square: string }> = {\n sm: { box: 'h-9 gap-2 rounded-lg px-3 py-1.5', label: 'text-body-xs', square: 'w-9' },\n md: { box: 'h-11 gap-3 rounded-xl px-3.5 py-2.5', label: 'text-body-sm', square: 'w-11' },\n};\n\n/**\n * Up to two characters standing in for a missing icon in the collapsed rail.\n *\n * Two rather than one because any nav long enough to be worth collapsing collides on first\n * letters — the docs' own sidebar has Button beside Badges and Input beside Icons. Multiple\n * words give one initial each (\"Color Tokens\" → \"CT\"); a single word gives its first two\n * (\"Button\" → \"Bu\"), which stays readable rather than shouting. Words that open with\n * punctuation are skipped, so \"Cards & Containers\" is \"CC\" and not \"C&\".\n */\nfunction monogram(label: string): string {\n const words = label.split(/\\s+/).filter((word) => /^[\\p{L}\\p{N}]/u.test(word));\n const [first, second] = words;\n // A label of nothing but symbols has no initials to take; show its first character.\n if (!first) return Array.from(label.trim())[0]?.toUpperCase() ?? '';\n if (second) return (Array.from(first)[0] + Array.from(second)[0]).toUpperCase();\n const [a, b] = Array.from(first);\n return a.toUpperCase() + (b ?? '').toLowerCase();\n}\n\n/**\n * What a row looks like when you are on it, and when you hover one you are not — shared by\n * both variants and declared nowhere else. Selection means one thing in this library.\n *\n * Through 0.5.0 each variant carried its own pair, and `plain`'s hover was\n * `hover:bg-default-hover` — a generic app-surface token resolving to `--prim-gray-100`,\n * which is the same #F5F5F5 as the `bg-default-secondary` rail a sidebar row sits on. Plain\n * rows therefore had **no visible hover at all** in light mode, and `plain`'s active\n * `bg-brand-tertiary` (#F1F7FD) was a 1.02:1 step against that same rail. The bug survived\n * because the docs demo every variant on `bg-default` — white — where the collision does\n * not occur.\n */\nconst STATE = {\n // Figma MenuButton `state=hover`. No border change: Figma holds it at #D9D9D9 through\n // hover and moves only the fill and the text.\n hover: 'hover:bg-brand-tertiary-hover hover:text-brand',\n // Figma MenuButton `state=focussed`, which is that file's name for selected — see the\n // `isActive` doc comment. Hovering the current row darkens it rather than reverting it to\n // the pale hover tint, which would read as the row losing its selection under the cursor.\n active: 'bg-brand text-brand-on-brand hover:bg-brand-hover',\n} as const;\n\n/** The resting appearance — the whole of the difference between the two variants. */\nconst VARIANT: Record<NavItemVariant, { active: string; inactive: string }> = {\n card: {\n // `border-transparent` holds the 1px so the icon and label do not shift outward when a\n // row becomes the current one — the same trick, for the same reason, as `button.tsx`.\n // `bg-brand` still paints edge to edge, since backgrounds clip to the border box.\n active: clsx('border border-transparent', STATE.active),\n inactive: clsx('border border-default bg-default text-default-secondary', STATE.hover),\n },\n plain: {\n active: STATE.active,\n inactive: clsx('text-default-secondary', STATE.hover),\n },\n};\n\n/**\n * Figma `NavItem base` (node 3123:139), every state of both densities.\n *\n * `pad` is kept apart from `box` because a collapsed row drops it: 14px either side of a 20px\n * icon is 48px, wider than the 44px square, and `clsx` cannot let a later `px-0` win.\n */\nconst DENSITY: Record<\n NavItemDensity,\n {\n box: string;\n pad: string;\n square: string;\n active: string;\n inactive: string;\n disabled: string;\n dot: string;\n railDot: string;\n }\n> = {\n comfortable: {\n box: 'h-11 gap-3 rounded-xl',\n pad: 'px-3.5',\n square: 'w-11',\n active: clsx('border border-transparent', STATE.active),\n inactive: clsx('border border-default bg-default text-default', STATE.hover),\n disabled: 'data-[disabled]:hover:bg-default',\n // Straddles the card's corner, as in Figma.\n dot: '-right-px -top-px',\n railDot: '-right-px -top-px',\n },\n compact: {\n box: 'h-10 gap-3 rounded-xl',\n pad: 'px-3',\n square: 'w-10',\n active: STATE.active,\n inactive: clsx('text-default', STATE.hover),\n disabled: 'data-[disabled]:hover:bg-transparent',\n // A plain row has no corner to sit on, so the expanded dot trails the label instead.\n dot: 'right-2 top-1/2 -translate-y-1/2',\n railDot: 'right-0 top-0',\n },\n};\n\n/** Disabled per Figma: the label greys out and the card keeps its border, no opacity wash. */\nconst DENSITY_DISABLED =\n 'data-[disabled]:cursor-not-allowed data-[disabled]:text-disabled data-[disabled]:hover:text-disabled';\n\nexport const NavItem = forwardRef<HTMLElement, NavItemProps>(function NavItem(\n {\n icon,\n label,\n isActive = false,\n indicator = false,\n collapsed = false,\n size = 'md',\n variant = 'card',\n density,\n trailing,\n asChild = false,\n disabled = false,\n children,\n className,\n onClick,\n ...rest\n },\n ref,\n) {\n const s = SIZE[size];\n const v = VARIANT[variant];\n const d = density ? DENSITY[density] : null;\n\n const rootProps = {\n ref,\n 'data-density': density,\n // Only meaningful when `asChild` renders a real link — a decorative span with\n // aria-current would be a lie.\n 'aria-current': asChild && isActive ? ('page' as const) : undefined,\n // Same attribute the disclosure components and `TableRow` use, so the state is\n // addressable from a consumer's CSS. `active` rather than `selected`: a nav row is where\n // you *are* (`aria-current=\"page\"`), which is a different thing from a row you have\n // *picked* (`aria-selected`) — `TableRow` is the latter and says `selected`.\n 'data-state': isActive ? ('active' as const) : undefined,\n 'data-disabled': disabled || undefined,\n 'aria-disabled': disabled || undefined,\n className: clsx(\n 'relative flex items-center transition-colors',\n // Unconditional: a row can also become focusable by the caller putting it inside a\n // link, which is how `src/sidebar/` uses it. A ring that only appears under `asChild`\n // leaves that case with no visible focus at all.\n // The offset is `default-secondary`, not `default`: a nav row's home is the sidebar\n // rail, and `ring-offset-default` is #FFFFFF, so a focused `plain` row drew a 1px white\n // halo on the #F5F5F5 rail. The offset itself is load-bearing — in dark mode\n // `ring-brand` and `bg-brand` are both #F1F7FD, so without it a focused *active* row\n // would have no visible ring at its inner edge.\n // It is also Figma's focus state for both densities: 1px rail-coloured gap, 3px of brand\n // in all. Figma's compact focus variant draws a 0px shadow — no ring at all — which\n // would fail WCAG 2.4.7, so compact keeps this ring too.\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default-secondary',\n d\n ? clsx(\n // text-left: a parent row is a <button>, which centres its text by default.\n 'group/nav-item text-left',\n d.box,\n collapsed ? clsx('justify-center', d.square) : clsx('w-full', d.pad),\n isActive ? d.active : d.inactive,\n DENSITY_DISABLED,\n d.disabled,\n )\n : clsx(\n s.box,\n // Expanded rows fill the nav; a collapsed one is a centred square, not a stretched row.\n collapsed ? clsx('justify-center', s.square) : 'w-full',\n isActive ? v.active : v.inactive,\n 'data-[disabled]:cursor-not-allowed data-[disabled]:opacity-40 data-[disabled]:hover:bg-transparent data-[disabled]:hover:text-default-secondary',\n ),\n className,\n ),\n ...rest,\n // After the spread: a disabled row refuses the press (a router Link skips navigation when\n // the event is prevented) and leaves the tab order, as a disabled control does.\n ...(disabled ? { tabIndex: -1 } : {}),\n onClick: (event: React.MouseEvent<HTMLElement>) => {\n if (disabled) {\n event.preventDefault();\n return;\n }\n onClick?.(event);\n },\n };\n\n const content = (\n <>\n {icon != null ? (\n <span\n aria-hidden\n className={clsx(\n 'shrink-0',\n d\n ? clsx(\n // Figma: a 20px glyph, icon-secondary at rest, brand under hover,\n // on-brand on the current row, disabled grey on a disabled one.\n 'flex size-5 items-center justify-center [&_svg]:size-5',\n disabled\n ? 'text-icon-disabled'\n : isActive\n ? 'text-icon-brand-on-brand'\n : 'text-icon-default-secondary group-hover/nav-item:text-icon-brand',\n )\n : '[&_svg]:size-4',\n )}\n >\n {icon}\n </span>\n ) : (\n // Icons are optional, but the collapsed rail hides the label — so a row with neither\n // renders as an empty box. Through 0.5.0 that is exactly what a nav without icons\n // collapsed to, the docs site's own 36-row sidebar included. The monogram is\n // decorative in the same way the icon is: the `sr-only` label below still names the\n // row.\n collapsed && (\n <span\n aria-hidden\n // `min-w-4` rather than `size-4`: the box matches the 16px an icon would take,\n // but a wide pair like \"MW\" is allowed to outgrow it rather than be clipped.\n className=\"flex h-4 min-w-4 shrink-0 items-center justify-center text-body-tiny font-semibold leading-none tracking-tight\"\n >\n {monogram(label)}\n </span>\n )\n )}\n {/* `collapsed` hides the label visually but keeps it in the accessibility tree.\n Through 0.3.0 the span was not rendered at all and no `aria-label` replaced it,\n so a collapsed sidebar was nine unlabelled icon links — the icon itself carries\n no name, being decorative. */}\n <span\n className={clsx(\n 'min-w-0 truncate font-regular',\n d ? 'text-body' : clsx('leading-snug', s.label),\n collapsed ? 'sr-only' : 'flex-1',\n )}\n >\n {label}\n </span>\n {trailing != null && !collapsed && (\n <span aria-hidden className=\"flex shrink-0 items-center [&_svg]:size-4\">\n {trailing}\n </span>\n )}\n {indicator && (\n <span\n // The dot is the only carrier of \"there is something new here\", so it needs a\n // name of its own rather than being purely decorative.\n role=\"status\"\n aria-label=\"Unread\"\n className={clsx(\n 'absolute size-2 rounded-full bg-danger',\n d ? (collapsed ? d.railDot : d.dot) : '-right-px -top-px',\n )}\n />\n )}\n </>\n );\n\n if (asChild) {\n // The child element becomes the row itself, so the icon/label/indicator go inside it\n // and its own children (usually nothing, since the label comes from `label`) are\n // discarded in favour of the composed content.\n return (\n <Slot wrapChildren={() => content} {...rootProps}>\n {children}\n </Slot>\n );\n }\n\n return <span {...rootProps}>{content}</span>;\n});\n\n// ── NavSubItem ─────────────────────────────────────────────────────────────────\n\nexport interface NavSubItemProps extends Omit<HTMLAttributes<HTMLElement>, 'children'> {\n label: string;\n /** The current route. Brand fill and, under `asChild`, `aria-current=\"page\"`. */\n isActive?: boolean;\n disabled?: boolean;\n /** The last child of its parent: the nest line turns into the row instead of running on. */\n last?: boolean;\n density?: NavItemDensity;\n /** Render the single child element (a link) as the row. */\n asChild?: boolean;\n children?: ReactNode;\n className?: string;\n}\n\nconst SUB_HEIGHT: Record<NavItemDensity, string> = { comfortable: 'h-11', compact: 'h-10' };\n\n/**\n * A child row under a `NavItem` that opens a submenu — Figma `Submenu Item` (node 3465:571).\n * New in 0.9.6.\n *\n * Lighter than its parent on purpose: no card, a 6px radius, secondary text, and a nest\n * line in a 16px column to its left that ties the run of children to the row above.\n */\nexport const NavSubItem = forwardRef<HTMLElement, NavSubItemProps>(function NavSubItem(\n {\n label,\n isActive = false,\n disabled = false,\n last = false,\n density = 'comfortable',\n asChild = false,\n children,\n className,\n onClick,\n ...rest\n },\n ref,\n) {\n const rootProps = {\n ref,\n 'aria-current': asChild && isActive ? ('page' as const) : undefined,\n 'data-state': isActive ? ('active' as const) : undefined,\n 'data-disabled': disabled || undefined,\n 'aria-disabled': disabled || undefined,\n className: clsx(\n 'relative flex w-full items-center gap-3 rounded-md pl-4 pr-3 transition-colors',\n // Figma's focus variant is a 1px brand border on the hover tint. The transparent\n // border holds the 1px at rest so the label does not move when focus arrives.\n 'border border-transparent focus-visible:border-brand focus-visible:bg-brand-secondary focus-visible:text-brand focus-visible:outline-none',\n SUB_HEIGHT[density],\n isActive\n ? 'bg-brand text-brand-on-brand'\n : 'text-default-secondary hover:bg-brand-secondary hover:text-brand',\n 'data-[disabled]:cursor-not-allowed data-[disabled]:text-disabled data-[disabled]:hover:bg-transparent data-[disabled]:hover:text-disabled',\n className,\n ),\n ...rest,\n ...(disabled ? { tabIndex: -1 } : {}),\n onClick: (event: React.MouseEvent<HTMLElement>) => {\n if (disabled) {\n event.preventDefault();\n return;\n }\n onClick?.(event);\n },\n };\n\n const content = (\n <>\n <NestIndicator last={last} />\n <span className=\"min-w-0 flex-1 truncate text-body font-regular\">{label}</span>\n </>\n );\n\n if (asChild) {\n return (\n <Slot wrapChildren={() => content} {...rootProps}>\n {children}\n </Slot>\n );\n }\n return <span {...rootProps}>{content}</span>;\n});\n\n/**\n * Figma `Nest indicator` (node 3613:2003): a 1px line down the middle of a 16px column, the\n * full row height — or, on the last child, down to the middle and then right into the row.\n * Drawn with borders rather than shipped as an SVG so it takes the row's height, whichever\n * density that is. The colour is the file's own, `stone-400`.\n */\nfunction NestIndicator({ last }: { last: boolean }) {\n return (\n <span aria-hidden className=\"relative w-4 shrink-0 self-stretch\">\n <span\n className={clsx(\n 'absolute left-1/2 top-0 w-px -translate-x-1/2 bg-[var(--prim-stone-400)]',\n last ? 'h-1/2' : 'h-full',\n )}\n />\n {last && <span className=\"absolute left-1/2 right-0 top-1/2 h-px bg-[var(--prim-stone-400)]\" />}\n </span>\n );\n}\n\n// ── NavGroupHeader ─────────────────────────────────────────────────────────────\n\nexport interface NavGroupHeaderProps extends HTMLAttributes<HTMLDivElement> {\n title: string;\n /**\n * Open state of the group below. Pass it, with `onOpenChange`, and the header grows the\n * chevron button that collapses the group; leave both out for a plain heading.\n */\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n /** Id of the region the chevron controls, for `aria-controls`. */\n controls?: string;\n /** Trailing slot, e.g. an \"add\" icon button. Figma's `trailingButton`. */\n action?: ReactNode;\n}\n\n/**\n * The heading above a sidebar group — Figma `Sidebar Nav Header` (node 3468:5154). New in\n * 0.9.6, replacing the uppercase eyebrow the sidebar drew before: Body Base, sentence case,\n * neutral-tertiary.\n */\nexport const NavGroupHeader = forwardRef<HTMLDivElement, NavGroupHeaderProps>(function NavGroupHeader(\n { title, open, onOpenChange, controls, action, className, ...rest },\n ref,\n) {\n const collapsible = open !== undefined && onOpenChange !== undefined;\n return (\n <div ref={ref} className={clsx('flex items-center gap-2 pl-2.5', className)} {...rest}>\n {collapsible && (\n <button\n type=\"button\"\n aria-expanded={open}\n aria-controls={controls}\n aria-label={`${open ? 'Collapse' : 'Expand'} ${title}`}\n onClick={() => onOpenChange(!open)}\n className={clsx(\n 'flex shrink-0 items-center justify-center rounded-full p-1 text-icon-default-secondary transition-colors',\n 'hover:bg-brand-tertiary-hover hover:text-icon-brand',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default-secondary',\n )}\n >\n <ChevronDownIcon\n aria-hidden\n className={clsx(\n 'size-4 transition-transform motion-reduce:transition-none',\n !open && '-rotate-90',\n )}\n />\n </button>\n )}\n <p className=\"min-w-0 flex-1 truncate text-body font-regular text-neutral-tertiary\">{title}</p>\n {action != null && <div className=\"flex shrink-0 items-center\">{action}</div>}\n </div>\n );\n});\n","import {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useState,\n type AnchorHTMLAttributes,\n type ComponentType,\n type HTMLAttributes,\n type MouseEvent as ReactMouseEvent,\n type ReactNode,\n type RefAttributes,\n} from 'react';\nimport { DropdownMenu as DropdownMenuPrimitive } from 'radix-ui';\nimport {\n ChevronDownIcon,\n ChevronLeftIcon,\n ChevronRightIcon,\n EllipsisVerticalIcon,\n LogOutIcon,\n MenuIcon,\n} from 'lucide-react';\nimport clsx from 'clsx';\n\nimport { cn } from '../../lib/cn';\nimport { useControllableState } from '../../lib/use-controllable-state';\nimport { useMediaQuery } from '../../lib/use-media-query';\nimport { Avatar } from '../avatar/avatar';\nimport { ScrollArea } from '../cards/scroll-area';\nimport { IconButton, type IconButtonProps } from '../forms/icon-button';\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuTrigger,\n} from '../overlays/dropdown-menu';\nimport { Drawer } from '../overlays/drawer';\nimport { OVERLAY_ITEM_BASE, OVERLAY_ITEM_SIZE, overlayItemTone } from '../overlays/menu-styles';\nimport { Tooltip } from '../overlays/tooltip';\nimport {\n NavGroupHeader,\n NavItem,\n NavSubItem,\n type NavItemDensity,\n type NavItemSize,\n type NavItemVariant,\n} from './nav-item';\n\n// ── Types ──────────────────────────────────────────────────────────────────────\n\nexport interface SidebarNavItem {\n /** Stable key. Falls back to `to`, then `href`, then `label`. New in 0.9.6. */\n id?: string;\n /**\n * An in-app destination, rendered through `linkComponent`. May carry a hash\n * (`/docs/floating#tooltip`) to link to a section of a page: that row is current only when\n * the hash matches too, and the page's own plain row steps aside while it is. Optional from\n * 0.9.6, so a row can exist only to open its `children`.\n */\n to?: string;\n /**\n * An external destination, opened in a new tab as a plain `<a>`. New in 0.9.6. Use `to`\n * for anything inside the app.\n */\n href?: string;\n label: string;\n /** Optional — a collapsed row without one falls back to a monogram of its label. */\n icon?: ReactNode;\n /** Red dot on the row — something new behind this destination. */\n indicator?: boolean;\n /** Match the path exactly rather than as a prefix. Needed for an index route. */\n end?: boolean;\n /**\n * A destination that exists but cannot be opened right now (coming soon). The row is\n * dimmed, announced with `aria-disabled`, out of the tab order, and refuses the press.\n * Something the user has no permission for should not be in the list at all: see\n * `filterNav`.\n */\n disabled?: boolean;\n /**\n * Overrides route matching, for a row whose \"current\" rule is more than a path prefix —\n * one page reached from two places, say. New in 0.9.6.\n */\n isActive?: boolean;\n /**\n * Child rows, one level deep. Expanded they open under the row; on the collapsed rail the\n * row opens them as a flyout menu. New in 0.9.6.\n */\n children?: SidebarNavItem[];\n /** Whether the children start open. Default: open when one of them is the current route. */\n defaultOpen?: boolean;\n}\n\nexport interface SidebarNavGroup {\n /** Stable key. Falls back to `title`. New in 0.9.6. */\n id?: string;\n /**\n * Heading above the group. Omit for an ungrouped run of rows.\n *\n * Kept in the accessibility tree when the rail is collapsed rather than dropped: it is the\n * only thing saying what the run of icons below it has in common.\n */\n title?: string;\n items: SidebarNavItem[];\n /** Give the heading a chevron that folds the group away. Needs a `title`. New in 0.9.6. */\n collapsible?: boolean;\n /** With `collapsible`: whether the group starts open. Default `true`. */\n defaultOpen?: boolean;\n /** Trailing slot in the heading — an \"add\" icon button, say. New in 0.9.6. */\n action?: ReactNode;\n}\n\nexport interface SidebarLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {\n href: string;\n}\n\n/**\n * Renders an in-app row's link. It must forward its ref to the anchor — the collapsed rail\n * anchors a tooltip to it and the flyout a menu item — as `next/link` and react-router's\n * `Link` both do.\n */\nexport type SidebarLinkComponent = ComponentType<SidebarLinkProps & RefAttributes<HTMLAnchorElement>>;\n\nexport interface SidebarRenderState {\n collapsed: boolean;\n density: NavItemDensity;\n}\n\nexport interface SidebarProps {\n /** The scrolling nav. One untitled group is a flat list. */\n groups: SidebarNavGroup[];\n /** Rows pinned below the scrolling nav — settings, help, a feedback link. */\n footerNav?: SidebarNavItem[];\n /**\n * Brand lockup. Given a function it receives `collapsed` and `density`, so the caller can\n * swap a full lockup for a mark alone rather than having one squeezed into the rail.\n */\n brand?: ReactNode | ((state: SidebarRenderState) => ReactNode);\n /** Bottom slot — a `SidebarUserCard`, a version pill, nothing. A function gets the state. */\n footer?: ReactNode | ((state: SidebarRenderState) => ReactNode);\n /**\n * Figma's two sidebar variants. `comfortable` (default): 44px card rows, an 80px rail.\n * `compact`: 40px plain rows, a 72px rail. New in 0.9.6.\n */\n density?: NavItemDensity;\n /**\n * Whether the rail can collapse at all. `false` locks it open: no toggle button, and\n * `collapsed` is ignored rather than half honoured.\n */\n collapsible?: boolean;\n /** Controlled collapsed state. Omit for uncontrolled. */\n collapsed?: boolean;\n /** Initial collapsed state when uncontrolled. */\n defaultCollapsed?: boolean;\n onCollapsedChange?: (collapsed: boolean) => void;\n /**\n * Called by the collapse toggle. Kept from before 0.9.6, when `collapsed` was always\n * controlled: passing `collapsed` with neither this nor `onCollapsedChange` still means\n * \"no toggle button\".\n */\n onToggle?: () => void;\n /**\n * localStorage key the collapsed state is remembered under, so it survives a reload.\n * Read after mount, so server and client render the same first frame. New in 0.9.6.\n */\n storageKey?: string;\n /** The current pathname, which decides the current row. New in 0.9.6. */\n currentPath?: string;\n /** The current hash, for rows that link to a section (`#tooltip`). */\n currentHash?: string;\n /** Renders in-app links. Default a plain `<a>`; pass `next/link` or a router link. */\n linkComponent?: SidebarLinkComponent;\n /** Called when a row is pressed — after the mobile drawer has closed itself. */\n onNavigate?: () => void;\n /** Accessible name of the sidebar landmark. Default \"Primary\". */\n label?: string;\n /** @deprecated Use `density`. `plain` maps to `compact`; `size` is ignored. */\n size?: NavItemSize;\n /** @deprecated Use `density`. `plain` maps to `compact`, `card` to `comfortable`. */\n variant?: NavItemVariant;\n /** Expanded width, as a Tailwind class. Default `w-80` (320px). */\n width?: string;\n /** Collapsed width. Default `w-20` (80px) comfortable, `w-[72px]` compact. */\n collapsedWidth?: string;\n className?: string;\n}\n\n// ── State ──────────────────────────────────────────────────────────────────────\n\n/** Below `md` the sidebar leaves the page and becomes a drawer. One breakpoint, in CSS and JS. */\nconst MOBILE_QUERY = '(max-width: 767.98px)';\n\nexport interface SidebarContextValue {\n collapsed: boolean;\n setCollapsed: (collapsed: boolean) => void;\n toggleCollapsed: () => void;\n /** The drawer the sidebar becomes below `md`. */\n mobileOpen: boolean;\n setMobileOpen: (open: boolean) => void;\n /** Whether the viewport is below `md`, so the sidebar is the drawer. */\n isMobile: boolean;\n}\n\nconst SidebarContext = createContext<SidebarContextValue | null>(null);\n\n/** The sidebar's state, for a header button or a layout that reacts to it. */\nexport function useSidebar(): SidebarContextValue {\n const value = useContext(SidebarContext);\n if (!value) throw new Error('useSidebar must be used inside <SidebarProvider>');\n return value;\n}\n\nexport interface SidebarProviderProps {\n children: ReactNode;\n collapsed?: boolean;\n defaultCollapsed?: boolean;\n onCollapsedChange?: (collapsed: boolean) => void;\n /** See `SidebarProps.storageKey`. */\n storageKey?: string;\n mobileOpen?: boolean;\n defaultMobileOpen?: boolean;\n onMobileOpenChange?: (open: boolean) => void;\n}\n\nfunction readStored(key: string): boolean | null {\n try {\n const value = window.localStorage.getItem(key);\n return value === 'true' ? true : value === 'false' ? false : null;\n } catch {\n // Private mode, blocked storage: the sidebar still works, it just forgets.\n return null;\n }\n}\n\nfunction writeStored(key: string, value: boolean) {\n try {\n window.localStorage.setItem(key, String(value));\n } catch {\n // As above.\n }\n}\n\n/**\n * Holds the sidebar's collapsed and mobile-drawer state, so something outside the sidebar —\n * `SidebarTrigger` in an app header — can drive it. New in 0.9.6. Optional: a `Sidebar`\n * without one keeps the same state to itself.\n */\nexport function SidebarProvider({\n children,\n collapsed: collapsedProp,\n defaultCollapsed = false,\n onCollapsedChange,\n storageKey,\n mobileOpen: mobileOpenProp,\n defaultMobileOpen = false,\n onMobileOpenChange,\n}: SidebarProviderProps) {\n const [collapsed, setCollapsedState] = useControllableState({\n value: collapsedProp,\n defaultValue: defaultCollapsed,\n onChange: onCollapsedChange,\n });\n const [mobileOpen, setMobileOpen] = useControllableState({\n value: mobileOpenProp,\n defaultValue: defaultMobileOpen,\n onChange: onMobileOpenChange,\n });\n const isMobile = useMediaQuery(MOBILE_QUERY);\n\n // After mount, not in the initial state: the server has no storage, and a first frame that\n // differs between server and client is a hydration error.\n useEffect(() => {\n if (!storageKey) return;\n const stored = readStored(storageKey);\n if (stored !== null) setCollapsedState(stored);\n }, [storageKey, setCollapsedState]);\n\n const setCollapsed = useCallback(\n (next: boolean) => {\n if (storageKey) writeStored(storageKey, next);\n setCollapsedState(next);\n },\n [storageKey, setCollapsedState],\n );\n\n const value = useMemo<SidebarContextValue>(\n () => ({\n collapsed,\n setCollapsed,\n toggleCollapsed: () => setCollapsed(!collapsed),\n mobileOpen,\n setMobileOpen,\n isMobile,\n }),\n [collapsed, setCollapsed, mobileOpen, setMobileOpen, isMobile],\n );\n\n return <SidebarContext.Provider value={value}>{children}</SidebarContext.Provider>;\n}\n\n// ── Sidebar ────────────────────────────────────────────────────────────────────\n\nconst DefaultLink = forwardRef<HTMLAnchorElement, SidebarLinkProps>(function DefaultLink(\n { children, ...rest },\n ref,\n) {\n return (\n <a ref={ref} {...rest}>\n {children}\n </a>\n );\n});\n\ninterface RowContext {\n density: NavItemDensity;\n collapsed: boolean;\n path?: string;\n hash?: string;\n hashTargets: Set<string>;\n Link: SidebarLinkComponent;\n onNavigate: () => void;\n}\n\nconst Row = createContext<RowContext | null>(null);\n\nfunction useRow(): RowContext {\n const value = useContext(Row);\n if (!value) throw new Error('Sidebar rows must be rendered by <Sidebar>');\n return value;\n}\n\n/**\n * The application nav rail: brand, a grouped list of destinations, and a footer. Figma\n * `Sidebar` (node 3123:278), in both its densities and both its states.\n *\n * New on the main entry in 0.9.6, router-agnostic: the app says where it is (`currentPath`)\n * and how to link (`linkComponent`). `AppSidebar` on `@platned/ui/sidebar` is this, wired to\n * react-router.\n *\n * It renders what it is given and decides nothing about who may see it. A permission-gated\n * nav passes its config through `filterNav` first.\n *\n * Below `md` it becomes a left drawer, opened by `SidebarTrigger`, and closes itself when a\n * row is pressed.\n */\nexport function Sidebar(props: SidebarProps) {\n const outer = useContext(SidebarContext);\n if (outer) return <SidebarRoot {...props} context={outer} ownsState={false} />;\n return (\n <SidebarProvider\n collapsed={props.collapsed}\n defaultCollapsed={props.defaultCollapsed}\n onCollapsedChange={props.onCollapsedChange}\n storageKey={props.storageKey}\n >\n <SidebarFromContext {...props} />\n </SidebarProvider>\n );\n}\n\nfunction SidebarFromContext(props: SidebarProps) {\n return <SidebarRoot {...props} context={useSidebar()} ownsState />;\n}\n\nfunction SidebarRoot({\n groups,\n footerNav,\n brand,\n footer,\n density: densityProp,\n collapsible = true,\n collapsed: collapsedProp,\n onCollapsedChange,\n onToggle,\n currentPath,\n currentHash,\n linkComponent = DefaultLink,\n onNavigate,\n label = 'Primary',\n variant,\n width = 'w-80',\n collapsedWidth,\n className,\n context,\n ownsState,\n}: SidebarProps & { context: SidebarContextValue; ownsState: boolean }) {\n const density: NavItemDensity = densityProp ?? (variant === 'plain' ? 'compact' : 'comfortable');\n const asideId = useId();\n const { isMobile, setMobileOpen } = context;\n\n // The drawer is always the full sidebar: a phone has the room, and an icon rail there would\n // only hide the labels behind tooltips that touch cannot open.\n const collapsed = !isMobile && collapsible && (collapsedProp ?? context.collapsed);\n // Controlled with no way to report a change means the caller does not want a toggle.\n const showToggle =\n collapsible && !isMobile && (collapsedProp === undefined || onToggle != null || onCollapsedChange != null);\n\n const toggle = () => {\n const next = !collapsed;\n onToggle?.();\n // A provider this sidebar made already reports through `onCollapsedChange`.\n if (!ownsState) onCollapsedChange?.(next);\n context.setCollapsed(next);\n };\n\n const hashTargets = useMemo(\n () =>\n new Set(\n [...groups.flatMap((group) => group.items), ...(footerNav ?? [])]\n .flatMap((item) => [item, ...(item.children ?? [])])\n .map((item) => item.to)\n .filter((to): to is string => to?.includes('#') ?? false),\n ),\n [groups, footerNav],\n );\n\n const row = useMemo<RowContext>(\n () => ({\n density,\n collapsed,\n path: currentPath,\n hash: currentHash,\n hashTargets,\n Link: linkComponent,\n onNavigate: () => {\n if (isMobile) setMobileOpen(false);\n onNavigate?.();\n },\n }),\n [density, collapsed, currentPath, currentHash, hashTargets, linkComponent, isMobile, setMobileOpen, onNavigate],\n );\n\n const state = { collapsed, density };\n const comfortable = density === 'comfortable';\n\n const panel = (\n <aside\n id={asideId}\n aria-label={label}\n data-density={density}\n data-collapsed={collapsed || undefined}\n className={cn(\n 'relative flex h-full shrink-0 flex-col justify-between bg-default-secondary py-2',\n 'transition-[width] duration-200 motion-reduce:transition-none',\n isMobile\n ? 'w-full'\n : clsx(\n 'rounded-xl border-r border-default',\n collapsed ? (collapsedWidth ?? (comfortable ? 'w-20' : 'w-[72px]')) : width,\n ),\n className,\n )}\n >\n {showToggle && (\n <button\n type=\"button\"\n aria-label={collapsed ? 'Expand sidebar' : 'Collapse sidebar'}\n aria-expanded={!collapsed}\n aria-controls={asideId}\n onClick={toggle}\n className={cn(\n 'absolute -right-3 top-5 z-raised flex size-6 items-center justify-center rounded-full',\n 'border border-default bg-default text-default-secondary',\n // Not `hover:bg-default-hover` — that is #F5F5F5, exactly the rail colour, and\n // this button straddles the rail edge, so half of it dissolved into the rail on\n // hover. Same hover vocabulary as the rows instead.\n 'shadow-100 transition-colors hover:bg-brand-tertiary-hover hover:text-brand',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default',\n )}\n >\n {collapsed ? (\n <ChevronRightIcon className=\"size-3\" strokeWidth={2.5} aria-hidden />\n ) : (\n <ChevronLeftIcon className=\"size-3\" strokeWidth={2.5} aria-hidden />\n )}\n </button>\n )}\n\n {/* Figma's \"Top\": the brand and the nav, 4px apart, 12px clear of the footer. */}\n <div className=\"flex min-h-0 flex-1 flex-col gap-1 pb-3\">\n {brand && (\n <div\n className={cn(\n 'flex shrink-0 items-center overflow-hidden p-4',\n collapsed ? 'justify-center' : 'gap-2.5',\n )}\n >\n {typeof brand === 'function' ? brand(state) : brand}\n </div>\n )}\n\n <ScrollArea axis=\"vertical\" label=\"Sidebar navigation\" className=\"min-h-0 flex-1\">\n <Row.Provider value={row}>\n {/* Figma: 16px between groups and 8px above the first when comfortable, 8px and\n none when compact. Groups are told apart by that space alone — the frames draw\n no rule between them. */}\n <nav aria-label=\"Main\" className={cn('flex flex-col px-4', comfortable ? 'gap-4 pt-2' : 'gap-2')}>\n {groups.map((group, index) => (\n <SidebarGroupView key={group.id ?? group.title ?? `group-${index}`} group={group} />\n ))}\n </nav>\n </Row.Provider>\n </ScrollArea>\n </div>\n\n {(Boolean(footerNav?.length) || footer != null) && (\n <div className=\"flex shrink-0 flex-col\">\n {footerNav && footerNav.length > 0 && (\n <Row.Provider value={row}>\n <nav\n aria-label=\"Secondary\"\n className={cn('flex flex-col px-4 pt-2', comfortable && 'gap-1', collapsed && 'items-center')}\n >\n {footerNav.map((item) => (\n <SidebarRow key={itemKey(item)} item={item} />\n ))}\n </nav>\n </Row.Provider>\n )}\n {typeof footer === 'function' ? footer(state) : footer}\n </div>\n )}\n </aside>\n );\n\n if (isMobile) {\n return (\n <Drawer\n side=\"left\"\n open={context.mobileOpen}\n onOpenChange={setMobileOpen}\n label={label}\n width=\"w-80 max-w-[85vw]\"\n className=\"bg-default-secondary\"\n >\n {panel}\n </Drawer>\n );\n }\n return panel;\n}\n\nfunction itemKey(item: SidebarNavItem): string {\n return item.id ?? item.to ?? item.href ?? item.label;\n}\n\nfunction SidebarGroupView({ group }: { group: SidebarNavGroup }) {\n const { density, collapsed } = useRow();\n const [open, setOpen] = useState(group.defaultOpen ?? true);\n const regionId = useId();\n const foldable = Boolean(group.collapsible && group.title) && !collapsed;\n const comfortable = density === 'comfortable';\n\n return (\n // Figma \"Menu Container\": 8px above and below; 12px (comfortable) or 8px (compact)\n // between the heading and the rows; rows 4px apart when comfortable, touching when compact.\n <div className={cn('flex flex-col py-2', comfortable ? 'gap-3' : 'gap-2')}>\n {group.title &&\n (collapsed ? (\n // No room in the rail, but still the only thing naming the run of icons below.\n <p className=\"sr-only\">{group.title}</p>\n ) : (\n <NavGroupHeader\n title={group.title}\n action={group.action}\n {...(foldable ? { open, onOpenChange: setOpen, controls: regionId } : {})}\n />\n ))}\n {(!foldable || open) && (\n <div id={regionId} className={cn('flex flex-col', comfortable && 'gap-1', collapsed && 'items-center')}>\n {group.items.map((item) => (\n <SidebarRow key={itemKey(item)} item={item} />\n ))}\n </div>\n )}\n </div>\n );\n}\n\n/**\n * Whether a row is the current one. Hash-aware: with rows linking to sections of one page,\n * only the row naming the shown section is current, and the page's plain row steps aside.\n */\nfunction isRowActive(item: SidebarNavItem, row: RowContext): boolean {\n if (item.isActive !== undefined) return item.isActive;\n if (!item.to || row.path === undefined) return false;\n const [path, hash] = item.to.split('#');\n const pathMatches = item.end\n ? row.path === path\n : row.path === path || row.path.startsWith(`${path.replace(/\\/$/, '')}/`);\n if (!pathMatches) return false;\n if (hash !== undefined) return row.hash === `#${hash}`;\n return !row.hashTargets.has(`${row.path}${row.hash ?? ''}`);\n}\n\nfunction SidebarRow({ item }: { item: SidebarNavItem }) {\n const row = useRow();\n if (item.children?.length) {\n return row.collapsed ? <RailParent item={item} /> : <ParentRow item={item} />;\n }\n return <LeafRow item={item} />;\n}\n\n/** Runs the row's own handler, then the sidebar's — unless the row refused the press. */\nfunction navigateHandler(row: RowContext) {\n return (event: ReactMouseEvent<HTMLElement>) => {\n if (!event.defaultPrevented) row.onNavigate();\n };\n}\n\nfunction LeafRow({ item }: { item: SidebarNavItem }) {\n const row = useRow();\n const active = isRowActive(item, row);\n const common = {\n icon: item.icon,\n label: item.label,\n isActive: active,\n indicator: item.indicator,\n disabled: item.disabled,\n collapsed: row.collapsed,\n density: row.density,\n };\n\n let element: ReactNode;\n if (item.href) {\n element = (\n <NavItem asChild {...common} onClick={navigateHandler(row)}>\n {/* eslint-disable-next-line jsx-a11y/anchor-has-content -- asChild: the row fills it with its icon and label. */}\n <a href={item.href} target=\"_blank\" rel=\"noreferrer\" />\n </NavItem>\n );\n } else if (item.to) {\n const { Link } = row;\n element = (\n <NavItem asChild {...common} onClick={navigateHandler(row)}>\n <Link href={item.to} />\n </NavItem>\n );\n } else {\n // Nowhere to go and nothing to open: a label, not a control.\n return <NavItem {...common} />;\n }\n\n // Only when collapsed. Expanded, the label is already on screen and a tooltip repeating it\n // is noise. It wraps the focusable row itself, so it opens for the keyboard as well as the\n // pointer.\n if (!row.collapsed) return element;\n return (\n <Tooltip title={item.label} side=\"right\">\n {element}\n </Tooltip>\n );\n}\n\nfunction ParentRow({ item }: { item: SidebarNavItem }) {\n const row = useRow();\n const children = item.children ?? [];\n const childActive = children.some((child) => isRowActive(child, row));\n const [open, setOpen] = useState(item.defaultOpen ?? childActive);\n const regionId = useId();\n\n // Arriving on a child's route opens its parent, so the current row is never folded away.\n useEffect(() => {\n if (childActive) setOpen(true);\n }, [childActive]);\n\n return (\n <>\n <NavItem\n asChild\n icon={item.icon}\n label={item.label}\n // Open, the current child shows itself; closed, the parent stands in for it.\n isActive={!open && childActive}\n indicator={item.indicator}\n disabled={item.disabled}\n density={row.density}\n trailing={\n <ChevronDownIcon\n className={cn(\n 'text-icon-default-secondary transition-transform motion-reduce:transition-none',\n !open && '-rotate-90',\n )}\n />\n }\n >\n <button type=\"button\" aria-expanded={open} aria-controls={regionId} onClick={() => setOpen(!open)} />\n </NavItem>\n {open && (\n <div id={regionId} className=\"flex flex-col\">\n {children.map((child, index) => (\n <SubRow key={itemKey(child)} item={child} last={index === children.length - 1} />\n ))}\n </div>\n )}\n </>\n );\n}\n\nfunction SubRow({ item, last }: { item: SidebarNavItem; last: boolean }) {\n const row = useRow();\n const common = {\n label: item.label,\n isActive: isRowActive(item, row),\n disabled: item.disabled,\n last,\n density: row.density,\n };\n if (item.href) {\n return (\n <NavSubItem asChild {...common} onClick={navigateHandler(row)}>\n {/* eslint-disable-next-line jsx-a11y/anchor-has-content -- asChild: the row fills it with its icon and label. */}\n <a href={item.href} target=\"_blank\" rel=\"noreferrer\" />\n </NavSubItem>\n );\n }\n if (item.to) {\n const { Link } = row;\n return (\n <NavSubItem asChild {...common} onClick={navigateHandler(row)}>\n <Link href={item.to} />\n </NavSubItem>\n );\n }\n return <NavSubItem {...common} />;\n}\n\nconst FLYOUT_ITEM = clsx(OVERLAY_ITEM_BASE, OVERLAY_ITEM_SIZE.md, 'no-underline');\n\n/**\n * A parent row on the collapsed rail. There is no room to open its children in place, so its\n * square opens them as a menu beside the rail — keyboard-operable, with the parent's label\n * as the menu's heading.\n */\nfunction RailParent({ item }: { item: SidebarNavItem }) {\n const row = useRow();\n const children = item.children ?? [];\n const childActive = children.some((child) => isRowActive(child, row));\n const { Link } = row;\n\n return (\n <DropdownMenu>\n <Tooltip title={item.label} side=\"right\">\n <DropdownMenuTrigger asChild>\n <NavItem\n asChild\n icon={item.icon}\n label={item.label}\n isActive={childActive}\n indicator={item.indicator}\n disabled={item.disabled}\n collapsed\n density={row.density}\n >\n <button type=\"button\" />\n </NavItem>\n </DropdownMenuTrigger>\n </Tooltip>\n <DropdownMenuContent side=\"right\" align=\"start\">\n <DropdownMenuLabel>{item.label}</DropdownMenuLabel>\n {children.map((child) => {\n const active = isRowActive(child, row);\n const className = cn(\n FLYOUT_ITEM,\n overlayItemTone('default', Boolean(child.disabled)),\n active && 'bg-brand text-brand-on-brand hover:bg-brand-hover focus:bg-brand-hover',\n );\n if (!child.to && !child.href) {\n return (\n <DropdownMenuItem key={itemKey(child)} disabled={child.disabled}>\n {child.label}\n </DropdownMenuItem>\n );\n }\n return (\n <DropdownMenuPrimitive.Item\n key={itemKey(child)}\n asChild\n disabled={child.disabled}\n className={className}\n onSelect={() => row.onNavigate()}\n >\n {child.href ? (\n <a href={child.href} target=\"_blank\" rel=\"noreferrer\">\n {child.label}\n </a>\n ) : (\n <Link href={child.to as string} aria-current={active ? 'page' : undefined}>\n {child.label}\n </Link>\n )}\n </DropdownMenuPrimitive.Item>\n );\n })}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n\n// ── SidebarTrigger ─────────────────────────────────────────────────────────────\n\nexport interface SidebarTriggerProps extends Omit<IconButtonProps, 'aria-label' | 'children'> {\n 'aria-label'?: string;\n}\n\n/**\n * The menu button that opens the sidebar's drawer below `md`. New in 0.9.6. Put it in the\n * app header, with a `SidebarProvider` above both. Hidden from `md` up, where the sidebar is\n * on the page. Outside a provider it renders nothing (0.9.7), so a header that is also used\n * on its own — in a test, a story — does not need one.\n */\nexport const SidebarTrigger = forwardRef<HTMLButtonElement, SidebarTriggerProps>(function SidebarTrigger(\n { 'aria-label': ariaLabel = 'Open navigation', className, onClick, variant = 'subtle', ...rest },\n ref,\n) {\n const context = useContext(SidebarContext);\n if (!context) return null;\n const { mobileOpen, setMobileOpen } = context;\n return (\n <IconButton\n ref={ref}\n aria-label={ariaLabel}\n aria-expanded={mobileOpen}\n aria-haspopup=\"dialog\"\n variant={variant}\n className={cn('md:hidden', className)}\n onClick={(event) => {\n onClick?.(event);\n if (!event.defaultPrevented) setMobileOpen(!mobileOpen);\n }}\n {...rest}\n >\n <MenuIcon className=\"size-5\" aria-hidden />\n </IconButton>\n );\n});\n\n// ── filterNav ──────────────────────────────────────────────────────────────────\n\ninterface NavTreeItem {\n to?: string;\n href?: string;\n children?: NavTreeItem[];\n}\n\n/**\n * The nav a user may see: drops every item `isVisible` refuses, then every parent left with\n * no children and nowhere of its own to go, then every group left empty. New in 0.9.6.\n *\n * The sidebar does not know about permissions and should not; this is where an app's rule\n * meets its nav config. Hiding a row is not access control — the route and the API still\n * have to refuse.\n *\n * const visible = filterNav(navConfig, (item) => !item.requires || item.requires.some(can));\n */\nexport function filterNav<G extends { items: NavTreeItem[] }>(\n groups: readonly G[],\n isVisible: (item: G['items'][number]) => boolean,\n): G[] {\n return groups\n .map((group) => ({ ...group, items: filterNavItems(group.items, isVisible) }))\n .filter((group) => group.items.length > 0);\n}\n\n/** `filterNav` for a single list of items, e.g. `footerNav`. */\nexport function filterNavItems<I extends NavTreeItem>(items: readonly I[], isVisible: (item: I) => boolean): I[] {\n return items.flatMap((item) => {\n if (!isVisible(item)) return [];\n if (!item.children) return [item];\n const children = filterNavItems(item.children as I[], isVisible);\n if (children.length === 0 && !item.to && !item.href) return [];\n return [{ ...item, children }];\n });\n}\n\n// ── SidebarSeparator ───────────────────────────────────────────────────────────\n\nexport type SidebarSeparatorProps = HTMLAttributes<HTMLDivElement>;\n\n/**\n * A rule for the sidebar's `footer` slot or a hand-composed rail. The sidebar itself no\n * longer draws one between groups from 0.9.6 — the Figma frames separate groups by space.\n *\n * Decorative by default. Pass `role=\"separator\"` through where it marks a grouping nothing\n * else names.\n */\nexport function SidebarSeparator({ className, ...rest }: SidebarSeparatorProps) {\n return <div aria-hidden className={cn('mx-1 h-px shrink-0 bg-divider', className)} {...rest} />;\n}\n\n// ── SidebarUserCard ────────────────────────────────────────────────────────────\n\nexport interface SidebarUserCardProps {\n name: string;\n role: string;\n onLogout: () => void;\n collapsed?: boolean;\n /** Extra menu entries above Sign out. */\n menu?: ReactNode;\n className?: string;\n}\n\n/**\n * The signed-in user block, for the sidebar's `footer` slot — Figma `UserCard` (node\n * 3123:156). On the main entry from 0.9.6; `@platned/ui/sidebar` still exports it.\n *\n * Its menu is `DropdownMenu`, which portals, so the collapsed rail does not clip it.\n */\nexport function SidebarUserCard({\n name,\n role,\n onLogout,\n collapsed = false,\n menu,\n className,\n}: SidebarUserCardProps) {\n const initial = name.trim().charAt(0);\n\n const items = (\n <>\n {menu}\n <DropdownMenuItem icon={<LogOutIcon className=\"size-3.5\" aria-hidden />} onSelect={onLogout}>\n Sign out\n </DropdownMenuItem>\n </>\n );\n\n if (collapsed) {\n return (\n // Figma collapsed user card: the avatar alone, 24px above and 16px below.\n <div className={cn('flex shrink-0 items-center justify-center px-4 pb-4 pt-6', className)}>\n <DropdownMenu>\n <DropdownMenuTrigger asChild label=\"User options\">\n <button type=\"button\" aria-label={`${name} — user options`} className=\"rounded-full\">\n <Avatar initial={initial} size=\"lg\" shape=\"circle\" />\n </button>\n </DropdownMenuTrigger>\n <DropdownMenuContent side=\"right\" align=\"end\">\n {items}\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n );\n }\n\n return (\n // Figma: 16px padding, plus 4px more above and below the row inside it.\n <div className={cn('flex shrink-0 items-center gap-2.5 px-4 py-5', className)}>\n <Avatar initial={initial} size=\"lg\" shape=\"circle\" />\n <div className=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <span className=\"truncate text-body-sm font-semibold leading-snug text-default\">{name}</span>\n <span className=\"truncate text-body-tiny font-regular leading-none text-default-secondary\">{role}</span>\n </div>\n <DropdownMenu>\n <DropdownMenuTrigger asChild label=\"User options\">\n <button\n type=\"button\"\n aria-label={`${name} — user options`}\n // `hover:bg-default-hover` here was #F5F5F5 on a #F5F5F5 rail — no hover at all.\n className=\"flex size-6 shrink-0 items-center justify-center rounded-md text-default-secondary transition-colors hover:bg-brand-tertiary-hover hover:text-brand\"\n >\n <EllipsisVerticalIcon className=\"size-5\" aria-hidden />\n </button>\n </DropdownMenuTrigger>\n <DropdownMenuContent side=\"top\" align=\"end\">\n {items}\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n );\n}\n","import { useCallback, useSyncExternalStore } from 'react';\n\n/**\n * Whether a CSS media query matches, kept in sync as the viewport changes.\n *\n * `false` on the server and wherever `matchMedia` is missing — jsdom has none, and a\n * consumer's test setup should not have to polyfill it for a component to render — so the\n * first client render agrees with the server's and hydration does not warn.\n */\nexport function useMediaQuery(query: string): boolean {\n const subscribe = useCallback(\n (onChange: () => void) => {\n if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') return () => {};\n const list = window.matchMedia(query);\n list.addEventListener('change', onChange);\n return () => list.removeEventListener('change', onChange);\n },\n [query],\n );\n const getSnapshot = () =>\n typeof window !== 'undefined' && typeof window.matchMedia === 'function'\n ? window.matchMedia(query).matches\n : false;\n return useSyncExternalStore(subscribe, getSnapshot, () => false);\n}\n","import clsx from 'clsx';\nimport type { ReactNode } from 'react';\n\nexport type EyebrowLabelVariant = 'uppercase' | 'plain';\n\nexport interface EyebrowLabelProps {\n children: ReactNode;\n /**\n * `uppercase` is the dominant form (nine of twelve source copies).\n * `plain` covers the entity-detail / reviewer-detail variant, whose label text is\n * already capitalised in the source string.\n */\n variant?: EyebrowLabelVariant;\n className?: string;\n}\n\n/**\n * Small semibold label above a group of fields.\n *\n * Replaces twelve copies across three variants:\n * `mb-2 text-body-tiny font-semibold uppercase tracking-wide …` (×9)\n * `text-[11px] font-semibold … tracking-wide` (×5, entity/reviewer detail)\n * `text-body-tiny font-semibold uppercase tracking-wider` (×2, entity onboarding)\n *\n * `text-body-tiny` is 11px, so the `text-[11px]` variant collapses into it exactly.\n * The `tracking-wider` copies become `tracking-wide` — a 0.0125em difference at 11px,\n * i.e. sub-pixel.\n */\nexport function EyebrowLabel({ children, variant = 'uppercase', className }: EyebrowLabelProps) {\n return (\n <p\n data-variant={variant}\n className={clsx(\n 'text-body-tiny font-semibold tracking-wide text-default-secondary',\n variant === 'uppercase' && 'uppercase',\n className,\n )}\n >\n {children}\n </p>\n );\n}\n","import { forwardRef, type HTMLAttributes } from 'react';\nimport clsx from 'clsx';\n\nexport type SeparatorOrientation = 'horizontal' | 'vertical';\n\nexport interface SeparatorProps extends HTMLAttributes<HTMLDivElement> {\n orientation?: SeparatorOrientation;\n /**\n * `true` when the rule is purely visual, which is the common case. A decorative\n * separator is `role=\"none\"` and stays out of the accessibility tree; a semantic one\n * is `role=\"separator\"` and announces a break between groups.\n */\n decorative?: boolean;\n}\n\n/**\n * A hairline rule. Matches Figma's `Menu Separator`, generalised to both orientations.\n *\n * Drawn as a filled element rather than a border, because a 1px border on a flex child\n * collapses to nothing at some zoom levels while a `1px` height does not — which is why\n * the preset carries a `divider` background token separate from `border-default`.\n */\nexport const Separator = forwardRef<HTMLDivElement, SeparatorProps>(function Separator(\n { orientation = 'horizontal', decorative = true, className, ...rest },\n ref,\n) {\n return (\n <div\n ref={ref}\n role={decorative ? 'none' : 'separator'}\n aria-orientation={decorative ? undefined : orientation}\n data-slot=\"separator\"\n className={clsx(\n 'shrink-0 bg-divider',\n orientation === 'horizontal' ? 'h-px w-full' : 'h-full w-px',\n className,\n )}\n {...rest}\n />\n );\n});\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport clsx from 'clsx';\n\nexport type KbdSize = 'sm' | 'md';\n\nexport interface KbdProps extends HTMLAttributes<HTMLElement> {\n children: ReactNode;\n size?: KbdSize;\n}\n\nconst SIZE: Record<KbdSize, string> = {\n sm: 'h-4 min-w-4 px-1 text-body-tiny',\n md: 'h-5 min-w-5 px-1.5 text-body-xs',\n};\n\n/**\n * A keyboard key. Matches Figma's `Menu Shortcut`.\n *\n * Renders a real `<kbd>` so assistive tech announces it as key input rather than as a\n * stray glyph — `⌘K` read as plain text is \"place of interest sign K\".\n *\n * Pass one key per element and let the caller supply the joiner, so a shortcut reads as\n * separate keys instead of one run-together string:\n *\n * <Kbd>⌘</Kbd><Kbd>K</Kbd>\n */\nexport const Kbd = forwardRef<HTMLElement, KbdProps>(function Kbd(\n { children, size = 'md', className, ...rest },\n ref,\n) {\n return (\n <kbd\n ref={ref}\n data-slot=\"kbd\"\n className={clsx(\n 'inline-flex items-center justify-center rounded border border-default bg-default-secondary',\n 'font-medium tabular-nums text-default-secondary',\n SIZE[size],\n className,\n )}\n {...rest}\n >\n {children}\n </kbd>\n );\n});\n","import {\n Fragment,\n forwardRef,\n type AnchorHTMLAttributes,\n type HTMLAttributes,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport clsx from 'clsx';\nimport { ChevronRightIcon } from 'lucide-react';\nimport { Slot } from '../../lib/slot';\n\n/** One crumb as data. New in 0.8.0. */\nexport interface BreadcrumbItemDef {\n label: ReactNode;\n /** Omit on the current page. */\n href?: string;\n /** Stable key. Default the position, which suits a static trail. */\n id?: string;\n /** Default: the last crumb is the current page. */\n current?: boolean;\n}\n\nexport interface BreadcrumbProps extends HTMLAttributes<HTMLElement> {\n /** The parts: `BreadcrumbItem`s. Omit when passing `items`. */\n children?: ReactNode;\n /**\n * The trail as data, root first, rendered as `BreadcrumbItem`s. New in 0.8.0. The last crumb\n * is the current page unless an item says otherwise. Use it or `children`, not both.\n */\n items?: readonly BreadcrumbItemDef[];\n /**\n * With `items`: render each link yourself, e.g. a router `Link`. It becomes the crumb through\n * `asChild`, so it gets the crumb styling. Default a plain `<a href>`.\n */\n renderLink?: (item: BreadcrumbItemDef) => ReactElement;\n /**\n * With `items`: collapse the middle of a longer trail into `BreadcrumbEllipsis`, keeping the\n * root and the last `maxItems - 1` crumbs (MUI's `maxItems`). Default: never collapse.\n */\n maxItems?: number;\n /** Names the landmark. Default `Breadcrumb`. */\n label?: string;\n}\n\n/**\n * Breadcrumb trail.\n *\n * A `<nav>` wrapping an ordered list, which is the whole semantic point: the order *is* the\n * hierarchy, so `<ol>` says something `<div>` cannot, and the landmark lets a screen reader\n * user jump to the trail without walking the header.\n *\n * The separators are `aria-hidden` and generated by the list, not passed in — a chevron\n * announced between every crumb is noise, and the `/` characters people usually hand-type\n * get read out one by one.\n */\nexport const Breadcrumb = forwardRef<HTMLElement, BreadcrumbProps>(function Breadcrumb(\n { children, items, renderLink, maxItems, label = 'Breadcrumb', className, ...rest },\n ref,\n) {\n return (\n <nav ref={ref} aria-label={label} data-slot=\"breadcrumb\" {...rest}>\n <ol className={clsx('flex flex-wrap items-center gap-1.5 p-0 text-body-xs', className)}>\n {items ? renderItems(items, renderLink, maxItems) : children}\n </ol>\n </nav>\n );\n});\n\nfunction renderItems(\n items: readonly BreadcrumbItemDef[],\n renderLink: BreadcrumbProps['renderLink'],\n maxItems: number | undefined,\n) {\n const last = items.length - 1;\n const collapse = maxItems !== undefined && maxItems >= 2 && items.length > maxItems;\n const shown = collapse ? [0, ...items.map((_, i) => i).slice(items.length - (maxItems - 1))] : items.map((_, i) => i);\n\n return shown.map((index, position) => {\n const item = items[index];\n const current = item.current ?? index === last;\n const crumb =\n !current && renderLink ? (\n <BreadcrumbItem asChild first={position === 0}>\n {renderLink(item)}\n </BreadcrumbItem>\n ) : (\n <BreadcrumbItem href={item.href} current={current} first={position === 0}>\n {item.label}\n </BreadcrumbItem>\n );\n return (\n <Fragment key={item.id ?? index}>\n {crumb}\n {collapse && position === 0 && <BreadcrumbEllipsis />}\n </Fragment>\n );\n });\n}\n\nexport interface BreadcrumbItemProps extends AnchorHTMLAttributes<HTMLAnchorElement> {\n children: ReactNode;\n /**\n * The page you are on. Renders as plain text with `aria-current=\"page\"` rather than a\n * link — a link to the current page is a dead control, and the APG says the last crumb\n * should not be one.\n */\n current?: boolean;\n /** Render a router `Link` instead of an `<a>`. */\n asChild?: boolean;\n /** Suppress the leading separator. Set automatically on the first item you render. */\n first?: boolean;\n}\n\nexport const BreadcrumbItem = forwardRef<HTMLAnchorElement, BreadcrumbItemProps>(\n function BreadcrumbItem({ children, current = false, asChild = false, first = false, className, ...rest }, ref) {\n return (\n <li className=\"flex items-center gap-1.5\">\n {!first && (\n <ChevronRightIcon aria-hidden className=\"size-3.5 shrink-0 text-icon-default-tertiary\" />\n )}\n {current ? (\n <span aria-current=\"page\" className={clsx('font-medium text-default', className)}>\n {children}\n </span>\n ) : asChild ? (\n <Slot\n className={clsx(\n 'rounded text-default-secondary transition-colors hover:text-brand',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default',\n className,\n )}\n {...rest}\n >\n {children}\n </Slot>\n ) : (\n <a\n ref={ref}\n className={clsx(\n 'rounded text-default-secondary transition-colors hover:text-brand',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default',\n className,\n )}\n {...rest}\n >\n {children}\n </a>\n )}\n </li>\n );\n },\n);\n\nexport interface BreadcrumbEllipsisProps extends HTMLAttributes<HTMLSpanElement> {}\n\n/**\n * Stands in for collapsed middle crumbs on a deep trail.\n *\n * A `<span>`, not a button: it is a truncation marker, and making it a disabled control\n * puts an unusable stop in the tab order. If the hidden crumbs need to be reachable, wrap\n * this in a `DropdownMenuTrigger` and list them.\n */\nexport const BreadcrumbEllipsis = forwardRef<HTMLSpanElement, BreadcrumbEllipsisProps>(\n function BreadcrumbEllipsis({ className, ...rest }, ref) {\n return (\n <li className=\"flex items-center gap-1.5\">\n <ChevronRightIcon aria-hidden className=\"size-3.5 shrink-0 text-icon-default-tertiary\" />\n <span\n ref={ref}\n aria-label=\"Collapsed items\"\n className={clsx('px-0.5 text-default-tertiary', className)}\n {...rest}\n >\n …\n </span>\n </li>\n );\n },\n);\n","import { forwardRef, type AnchorHTMLAttributes, type HTMLAttributes, type ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { Slot } from '../../lib/slot';\n\nexport type NavigationMenuOrientation = 'horizontal' | 'vertical';\nexport type NavigationMenuVariant = 'pill' | 'link';\n\nexport interface NavigationMenuProps extends HTMLAttributes<HTMLElement> {\n children: ReactNode;\n orientation?: NavigationMenuOrientation;\n /** Names the nav landmark. Required when a page has more than one `<nav>`. */\n label: string;\n}\n\n/**\n * A navigation landmark wrapping a list of links. Matches Figma's `Navigation Pill List`\n * and `Navigation Button List`.\n *\n * Why the `<nav>` + `<ul>` + `<li>` nesting rather than a flat row of anchors: the list is\n * what makes a screen reader announce \"list, 5 items\" and lets the user jump the whole\n * block. A bare row of links is announced one at a time with no sense of how many there\n * are or where the set ends. The `label` is required for the same reason — an unnamed\n * landmark in a page with a sidebar *and* a top bar is not navigable.\n */\nexport const NavigationMenu = forwardRef<HTMLElement, NavigationMenuProps>(\n function NavigationMenu({ children, orientation = 'horizontal', label, className, ...rest }, ref) {\n return (\n <nav ref={ref} aria-label={label} data-slot=\"navigation-menu\" {...rest}>\n <ul\n className={clsx(\n 'flex list-none p-0',\n orientation === 'vertical' ? 'flex-col gap-1' : 'flex-row items-center gap-1',\n className,\n )}\n >\n {children}\n </ul>\n </nav>\n );\n },\n);\n\nexport interface NavigationMenuItemProps extends AnchorHTMLAttributes<HTMLAnchorElement> {\n children: ReactNode;\n /** Matches Figma's `State: Active`. Sets `aria-current=\"page\"`. */\n active?: boolean;\n variant?: NavigationMenuVariant;\n /** Render a router `Link` instead of an `<a>`. */\n asChild?: boolean;\n /** Leading glyph. Marked decorative automatically. */\n icon?: ReactNode;\n}\n\n/**\n * A single navigation link. Matches Figma's `Navigation Pill` and `Navigation Button`\n * (`State: Default | Active | Hover`).\n *\n * `aria-current=\"page\"` is the point: the filled pill is not announced, so without it a\n * screen reader user cannot tell which page they are on.\n */\nexport const NavigationMenuItem = forwardRef<HTMLAnchorElement, NavigationMenuItemProps>(\n function NavigationMenuItem(\n { children, active = false, variant = 'pill', asChild = false, icon, className, ...rest },\n ref,\n ) {\n const content = (\n <>\n {icon && (\n <span aria-hidden className=\"shrink-0 [&_svg]:size-4\">\n {icon}\n </span>\n )}\n <span className=\"min-w-0 truncate\">{children}</span>\n </>\n );\n\n const linkProps = {\n 'aria-current': active ? ('page' as const) : undefined,\n className: clsx(\n 'inline-flex items-center gap-2 whitespace-nowrap transition-colors',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default',\n variant === 'pill'\n ? clsx(\n 'rounded-lg px-3 py-1.5 text-body-xs font-medium',\n active\n ? 'bg-brand text-brand-on-brand'\n : 'text-default-secondary hover:bg-default-secondary hover:text-default',\n )\n : clsx(\n 'rounded px-1 py-0.5 text-body-sm',\n active\n ? 'font-semibold text-brand'\n : 'text-default-secondary hover:text-default',\n ),\n className,\n ),\n ...rest,\n };\n\n return (\n <li>\n {asChild ? (\n <Slot wrapChildren={() => content} {...linkProps}>\n {children}\n </Slot>\n ) : (\n <a ref={ref} {...linkProps}>\n {content}\n </a>\n )}\n </li>\n );\n },\n);\n","import { forwardRef, type AnchorHTMLAttributes, type HTMLAttributes, type ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { cn } from '../../lib/cn';\nimport { Slot } from '../../lib/slot';\n\n/**\n * The type ramp as components, mirroring Figma's `Text*` primitives one-for-one:\n * `Text`, `Text Strong`, `Text Emphasis`, `Text Small`, `Text Code`, `Text Link`,\n * `Text Heading`, `Text Subheading`, `Text Subtitle`, `Text Title Page`,\n * `Text Title Hero`, `Text List`, `Text List Item`, `Text Link List`.\n *\n * These existed in Figma with settled styles and had no code counterpart, so every\n * consumer reached for a raw `text-body-sm text-default` triplet and the ramp drifted.\n * Each component pins the size/weight/colour combination and nothing else, so layout\n * stays the caller's job.\n *\n * All of them take `asChild`, because the right element is contextual — a `Heading` is an\n * `<h2>` on a page and an `<h3>` inside a card, and only the caller knows the outline.\n */\n\n/**\n * The text colour as a meaning, new in 0.7.0. `muted` and `subtle` are the secondary and\n * tertiary steps; the rest are the status tones. It replaces the\n * `className={denied ? 'text-danger' : 'text-positive'}` that consumers were writing, so state\n * is a prop and the colour stays a token. Omit it to keep each component's own colour.\n */\nexport type TextTone = 'default' | 'muted' | 'subtle' | 'brand' | 'positive' | 'warning' | 'danger';\n\nconst TONE: Record<TextTone, string> = {\n default: 'text-default',\n muted: 'text-default-secondary',\n subtle: 'text-default-tertiary',\n brand: 'text-brand',\n positive: 'text-positive',\n warning: 'text-warning',\n danger: 'text-danger',\n};\n\ntype BaseProps = HTMLAttributes<HTMLElement> & {\n children?: ReactNode;\n asChild?: boolean;\n /** Text colour as a meaning. See `TextTone`. */\n tone?: TextTone;\n};\n\n/** Factory for the plain ramp entries — identical except for element and classes. */\nfunction textComponent(\n displayName: string,\n defaultElement: 'p' | 'span' | 'h1' | 'h2' | 'h3' | 'h4' | 'strong' | 'em' | 'code' | 'q',\n classes: string,\n) {\n const Component = forwardRef<HTMLElement, BaseProps>(function TextComponent(\n { children, asChild = false, tone, className, ...rest },\n ref,\n ) {\n const Root = (asChild ? Slot : defaultElement) as 'p';\n return (\n <Root\n ref={ref as never}\n data-tone={tone}\n // `cn`, so the tone's colour (and then the caller's class) beats the ramp's own.\n className={cn(classes, tone && TONE[tone], className)}\n {...rest}\n >\n {children}\n </Root>\n );\n });\n Component.displayName = displayName;\n return Component;\n}\n\n// ── Body ───────────────────────────────────────────────────────────────────────\n\nexport type TextProps = BaseProps;\n\n/** `Text` — the default body paragraph. */\nexport const Text = textComponent('Text', 'p', 'text-body text-default');\n\n/** `Text Small` — secondary body copy. */\nexport const TextSmall = textComponent('TextSmall', 'p', 'text-body-sm text-default-secondary');\n\n/** `Text Tiny` — the smallest readable step; captions and table meta. */\nexport const TextTiny = textComponent('TextTiny', 'p', 'text-body-tiny text-default-secondary');\n\n/** `Text Strong` — emphasis by weight, in a real `<strong>`. */\nexport const TextStrong = textComponent('TextStrong', 'strong', 'font-semibold text-default');\n\n/** `Text Emphasis` — emphasis by slant, in a real `<em>`. */\nexport const TextEmphasis = textComponent('TextEmphasis', 'em', 'italic text-default');\n\n/** An inline quotation, in a real `<q>` so the browser adds locale-correct quote marks. New in 0.7.0. */\nexport const Quote = textComponent('Quote', 'q', 'italic text-default');\n\n/** `Text Code` — inline monospace. */\nexport const TextCode = textComponent(\n 'TextCode',\n 'code',\n 'rounded border border-default bg-default-secondary px-1 py-0.5 font-mono text-body-xs text-default',\n);\n\n// ── Headings ───────────────────────────────────────────────────────────────────\n\n/** `Text Title Hero` — the largest step, one per page at most. */\nexport const TitleHero = textComponent('TitleHero', 'h1', 'text-title-hero font-bold text-default');\n\n/** `Text Title Page` — page title. */\nexport const TitlePage = textComponent('TitlePage', 'h1', 'text-title font-bold text-default');\n\n/** `Text Subtitle` — a lead paragraph under a title; regular weight by design. */\nexport const Subtitle = textComponent('Subtitle', 'p', 'text-subtitle text-default-secondary');\n\n/** `Text Heading` — section heading. */\nexport const Heading = textComponent('Heading', 'h2', 'text-heading font-semibold text-default');\n\n/** `Text Subheading` — subsection heading; regular weight, matching Figma. */\nexport const Subheading = textComponent('Subheading', 'h3', 'text-subheading text-default');\n\n// ── Blockquote ─────────────────────────────────────────────────────────────────\n\nexport interface BlockquoteProps extends HTMLAttributes<HTMLQuoteElement> {\n children?: ReactNode;\n /** URL of the source, set as the `cite` attribute. Not shown; pair with a visible credit. */\n cite?: string;\n tone?: TextTone;\n}\n\n/**\n * A block quotation, new in 0.7.0, matching Radix Themes' `Blockquote`. A real\n * `<blockquote>`, so assistive tech announces where the quotation starts and ends.\n */\nexport const Blockquote = forwardRef<HTMLQuoteElement, BlockquoteProps>(function Blockquote(\n { children, cite, tone, className, ...rest },\n ref,\n) {\n return (\n <blockquote\n ref={ref}\n cite={cite}\n data-tone={tone}\n className={cn(\n 'border-l-4 border-default pl-4 text-body italic text-default-secondary',\n tone && TONE[tone],\n className,\n )}\n {...rest}\n >\n {children}\n </blockquote>\n );\n});\n\n// ── Link ───────────────────────────────────────────────────────────────────────\n\n/**\n * `brand` (default) is the underlined link for running text. `neutral`, new in 0.9.5, is a\n * default-coloured link that underlines on hover, for links that stand alone in a list or tree\n * (an indented set of names), where a column of brand underlines would be noise. Don't use\n * `neutral` inside a sentence: there, colour and underline are what mark it as a link.\n */\nexport type TextLinkTone = 'brand' | 'neutral';\n\nexport interface TextLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {\n children?: ReactNode;\n asChild?: boolean;\n tone?: TextLinkTone;\n}\n\nconst TEXT_LINK_TONE: Record<TextLinkTone, string> = {\n brand: 'text-brand underline decoration-1 hover:text-brand-secondary',\n neutral: 'text-default no-underline decoration-1 hover:underline',\n};\n\n/**\n * `Text Link`. Underlined rather than colour-only: colour alone is not a sufficient\n * distinction for a link inside a run of text (WCAG 1.4.1).\n */\nexport const TextLink = forwardRef<HTMLAnchorElement, TextLinkProps>(function TextLink(\n { children, asChild = false, tone = 'brand', className, ...rest },\n ref,\n) {\n const Root = (asChild ? Slot : 'a') as 'a';\n return (\n <Root\n ref={ref}\n data-tone={tone}\n className={clsx(\n 'rounded underline-offset-2 transition-colors',\n TEXT_LINK_TONE[tone],\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default',\n className,\n )}\n {...rest}\n >\n {children}\n </Root>\n );\n});\n\n// ── Lists ──────────────────────────────────────────────────────────────────────\n\nexport type TextListVariant = 'bulleted' | 'numbered' | 'plain';\nexport type TextListDensity = 'default' | 'compact';\n\nexport interface TextListProps extends HTMLAttributes<HTMLElement> {\n children?: ReactNode;\n variant?: TextListVariant;\n /** Matches Figma's `Density` axis on `Text List` / `Text Link List`. */\n density?: TextListDensity;\n}\n\nconst LIST_MARKER: Record<TextListVariant, string> = {\n bulleted: 'list-disc pl-5',\n numbered: 'list-decimal pl-5',\n plain: 'list-none pl-0',\n};\n\n/** `Text List` — a real `<ul>`/`<ol>`, so item count is announced. */\nexport const TextList = forwardRef<HTMLElement, TextListProps>(function TextList(\n { children, variant = 'bulleted', density = 'default', className, ...rest },\n ref,\n) {\n const Root = (variant === 'numbered' ? 'ol' : 'ul') as 'ul';\n return (\n <Root\n ref={ref as never}\n className={clsx(\n 'text-body text-default',\n LIST_MARKER[variant],\n density === 'compact' ? 'space-y-0.5' : 'space-y-1.5',\n className,\n )}\n {...rest}\n >\n {children}\n </Root>\n );\n});\n\nexport type TextListItemProps = HTMLAttributes<HTMLLIElement> & { children?: ReactNode };\n\n/** `Text List Item`. */\nexport const TextListItem = forwardRef<HTMLLIElement, TextListItemProps>(function TextListItem(\n { children, className, ...rest },\n ref,\n) {\n return (\n <li ref={ref} className={clsx('text-body text-default', className)} {...rest}>\n {children}\n </li>\n );\n});\n","import { createContext, useContext, type ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { WidgetTitle } from './widget-title';\nimport type { WidgetTitleSize } from './widget-title';\n\n/**\n * Extra chrome a *container* puts in the header's right-hand cluster, e.g. a pinned widget's\n * freshness label and refresh button, without every widget accepting and forwarding a prop for it.\n * It renders after the widget's own badge and action, so they share the row instead of overlapping.\n *\n * The local `accessory` prop wins over the provider: the React Aria rule for context-supplied\n * props. Context-supplied chrome is invisible at the call site, so keep it to containers.\n */\nconst WidgetHeaderAccessoryContext = createContext<ReactNode>(null);\n\nexport interface WidgetHeaderAccessoryProviderProps {\n accessory: ReactNode;\n children: ReactNode;\n}\n\nexport function WidgetHeaderAccessoryProvider({ accessory, children }: WidgetHeaderAccessoryProviderProps) {\n return <WidgetHeaderAccessoryContext.Provider value={accessory}>{children}</WidgetHeaderAccessoryContext.Provider>;\n}\n\n/** The provided accessory, for a widget that draws its own header instead of using `WidgetHeader`. */\nexport function useWidgetHeaderAccessory(): ReactNode {\n return useContext(WidgetHeaderAccessoryContext);\n}\n\nexport type WidgetHeaderEyebrowVariant = 'uppercase' | 'plain';\n\nexport interface WidgetHeaderProps {\n eyebrow?: string;\n eyebrowVariant?: WidgetHeaderEyebrowVariant;\n title: string;\n titleSize?: WidgetTitleSize;\n subtitle?: string;\n badge?: ReactNode;\n action?: ReactNode;\n /**\n * Trailing chrome after `badge` and `action`. Defaults to what an enclosing\n * `WidgetHeaderAccessoryProvider` supplies; pass it to set it locally, or `null` to opt out.\n */\n accessory?: ReactNode;\n className?: string;\n}\n\n// uppercase: 11px/medium/tracked, matches Variation 2 mockups · plain: 13px/regular, matches Variation 1's small label line\nconst eyebrowStyles: Record<WidgetHeaderEyebrowVariant, string> = {\n uppercase: 'text-body-tiny font-medium uppercase tracking-[0.66px] text-default-secondary',\n plain: 'text-body-xs leading-[1.4] text-default-secondary',\n};\n\nexport function WidgetHeader({\n eyebrow,\n eyebrowVariant = 'uppercase',\n title,\n titleSize,\n subtitle,\n badge,\n action,\n accessory: accessoryProp,\n className,\n}: WidgetHeaderProps) {\n const provided = useWidgetHeaderAccessory();\n const accessory = accessoryProp !== undefined ? accessoryProp : provided;\n return (\n <div className={clsx('flex items-start justify-between gap-2', className)}>\n <div className=\"min-w-0 flex-1\">\n {eyebrow && <p className={eyebrowStyles[eyebrowVariant]}>{eyebrow}</p>}\n <WidgetTitle size={titleSize}>{title}</WidgetTitle>\n {subtitle && (\n <p className=\"mt-1 text-body-xs text-default-secondary leading-snug\">{subtitle}</p>\n )}\n </div>\n <div className=\"flex shrink-0 items-center gap-2\">\n {badge}\n {action}\n {accessory}\n </div>\n </div>\n );\n}\n","import type { ReactNode } from 'react';\nimport clsx from 'clsx';\n\nexport type WidgetTitleSize = 'sm' | 'md' | 'lg';\n\nexport interface WidgetTitleProps {\n children: ReactNode;\n size?: WidgetTitleSize;\n className?: string;\n}\n\n// sm: 16px/semibold (default) · md: 18px/bold (Variation 2 mockups) · lg: 20px/semibold (Variation 1 mockups)\nconst sizeStyles: Record<WidgetTitleSize, string> = {\n sm: 'text-subheading-sm font-semibold leading-none',\n // Was `text-[18px]`, which had no step on the type scale (Scale 04 = 16, Scale 05 = 20).\n // Now 20px, so `md` and `lg` are the same size and separate on weight alone — bold vs\n // semibold. That is the intended trade for getting off an off-scale literal.\n md: 'text-subheading font-bold leading-normal',\n lg: 'text-subheading font-semibold leading-[1.2]',\n};\n\nexport function WidgetTitle({ children, size = 'sm', className }: WidgetTitleProps) {\n return (\n <h3 className={clsx(sizeStyles[size], 'text-default', className)}>\n {children}\n </h3>\n );\n}\n","import type { ReactNode } from 'react';\nimport clsx from 'clsx';\n\nexport interface WidgetFooterProps {\n caption?: string;\n subcaption?: string;\n action?: ReactNode;\n className?: string;\n}\n\nexport function WidgetFooter({ caption, subcaption, action, className }: WidgetFooterProps) {\n return (\n <div className={clsx('flex items-center gap-3', className)}>\n {caption && (\n <div className=\"flex items-stretch gap-3 flex-1 min-w-0\">\n <div className=\"w-0.5 shrink-0 self-stretch rounded-full bg-brand\" />\n <div className=\"min-w-0\">\n <p className=\"text-body-sm font-medium text-default leading-snug\">\n {caption}\n </p>\n {subcaption && (\n <p className=\"mt-0.5 text-body-xs text-default-secondary\">{subcaption}</p>\n )}\n </div>\n </div>\n )}\n {action && <div className=\"ml-auto shrink-0\">{action}</div>}\n </div>\n );\n}\n","import type { HTMLAttributes, ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { cn } from '../../lib/cn';\n\n/**\n * The dashboard grid vocabulary, ported from SCIC in 0.7.0: a 12-column row, five widget widths\n * and three canonical card heights. The heights are modular (364 = 170·2 + 24, 752 = 170·4 +\n * 24·3), so two stacked `medium` cards bottom-align with one `large`.\n *\n * Not included: SCIC's drag-and-drop masonry dashboard, which needs `@dnd-kit` and stays in the\n * app until it earns a subpath of its own.\n */\n\n/** Column span within the 12-column grid. */\nexport type ColSize = 'tiny' | 'small' | 'medium' | 'large' | 'full';\n\n/** Canonical widget card heights. */\nexport type WidgetHeight = 'small' | 'medium' | 'large';\n\n/**\n * Viewport-driven spans: everything stacks (tiny tiles pair up 2×2) below `lg`, then the\n * 12-column spans apply. Right when the grid gets the whole viewport. For a grid that shares\n * its row with a rail or drawer, size by its own width: see `useWidthTier` and\n * `COL_SPAN_BY_TIER`.\n */\nexport const COL_SPAN: Record<ColSize, string> = {\n tiny: 'col-span-6 lg:col-span-3',\n small: 'col-span-12 lg:col-span-4',\n medium: 'col-span-12 lg:col-span-6',\n large: 'col-span-12 lg:col-span-8',\n full: 'col-span-12',\n};\n\nexport const HEIGHT_CLASS: Record<WidgetHeight, string> = {\n small: 'h-[170px]',\n medium: 'h-[364px]',\n large: 'h-[752px]',\n};\n\n/** The same heights in px, for layout maths. Keep in step with `HEIGHT_CLASS`. */\nexport const HEIGHT_PX: Record<WidgetHeight, number> = {\n small: 170,\n medium: 364,\n large: 752,\n};\n\nexport interface WidgetGridProps {\n children: ReactNode;\n className?: string;\n}\n\n/** A vertical stack of `WidgetGridRow`s with the dashboard gutters. */\nexport function WidgetGrid({ children, className }: WidgetGridProps) {\n return <div className={cn('flex w-full flex-col gap-3 lg:gap-6', className)}>{children}</div>;\n}\n\nexport interface WidgetGridRowProps {\n children: ReactNode;\n className?: string;\n}\n\n/** A 12-column row. Place `WidgetGridItem`s in it. */\nexport function WidgetGridRow({ children, className }: WidgetGridRowProps) {\n return <div className={cn('grid grid-cols-12 items-start gap-3 lg:gap-6', className)}>{children}</div>;\n}\n\nexport interface WidgetGridItemProps extends HTMLAttributes<HTMLDivElement> {\n /** How many columns the widget claims. */\n size: ColSize;\n /** Fixes the card height to the canonical scale. Omit for content height. */\n height?: WidgetHeight;\n}\n\n/**\n * One widget's cell. Takes `size` and `height` as props, so a dashboard never composes span\n * classes itself. They are also set as `data-size` / `data-height`.\n */\nexport function WidgetGridItem({ size, height, className, ...rest }: WidgetGridItemProps) {\n return (\n <div\n data-size={size}\n data-height={height}\n className={cn(COL_SPAN[size], height && clsx(HEIGHT_CLASS[height], 'min-h-0'), className)}\n {...rest}\n />\n );\n}\n","import type { ColSize } from '../components/widgets/widget-grid';\n\n/**\n * Container-width tiers for grids that cannot use viewport breakpoints, because they share their\n * row with a nav rail or a docked drawer. Pure functions, ported from SCIC in 0.7.0. The hook that\n * measures and debounces is `useWidthTier`.\n */\nexport type GridTier = 'stacked' | 'narrow' | 'standard' | 'wide';\n\nexport const GRID_TIERS: readonly GridTier[] = ['stacked', 'narrow', 'standard', 'wide'];\n\n/** The narrowest width, in px, at which each tier applies. */\nexport const TIER_MIN_PX: Record<GridTier, number> = {\n stacked: 0,\n narrow: 560,\n standard: 760,\n wide: 960,\n};\n\n/**\n * How far past a threshold the width must go before the tier follows. A tier change reflows the\n * grid, which can add or remove the page scrollbar and so change the measured width: a margin\n * narrower than a scrollbar oscillates.\n */\nexport const TIER_HYSTERESIS_PX = 24;\n\n/** Widths are rounded down to this step, so sub-pixel jitter does not re-render. */\nexport const WIDTH_QUANTUM_PX = 8;\n\nexport function quantizeWidth(px: number): number {\n if (!Number.isFinite(px) || px <= 0) return 0;\n return Math.floor(px / WIDTH_QUANTUM_PX) * WIDTH_QUANTUM_PX;\n}\n\n/** The tier for a width, with no hysteresis. */\nexport function tierForWidth(px: number): GridTier {\n if (px >= TIER_MIN_PX.wide) return 'wide';\n if (px >= TIER_MIN_PX.standard) return 'standard';\n if (px >= TIER_MIN_PX.narrow) return 'narrow';\n return 'stacked';\n}\n\n/** The next tier from `current`, holding still inside the hysteresis band. */\nexport function nextTier(current: GridTier, px: number): GridTier {\n let tier = current;\n for (let i = 0; i < GRID_TIERS.length; i += 1) {\n const index = GRID_TIERS.indexOf(tier);\n const up = GRID_TIERS[index + 1];\n if (up && px >= TIER_MIN_PX[up] + TIER_HYSTERESIS_PX) {\n tier = up;\n continue;\n }\n if (index > 0 && px < TIER_MIN_PX[tier] - TIER_HYSTERESIS_PX) {\n tier = GRID_TIERS[index - 1];\n continue;\n }\n break;\n }\n return tier;\n}\n\n/** Columns (of 12) each widget width claims, per tier. */\nexport const TIER_COLS: Record<GridTier, Record<ColSize, number>> = {\n stacked: { tiny: 6, small: 12, medium: 12, large: 12, full: 12 },\n narrow: { tiny: 6, small: 6, medium: 12, large: 12, full: 12 },\n standard: { tiny: 3, small: 6, medium: 6, large: 12, full: 12 },\n wide: { tiny: 3, small: 4, medium: 6, large: 8, full: 12 },\n};\n\n/** `TIER_COLS` as literal classes (Tailwind only emits classes it finds verbatim). */\nexport const COL_SPAN_BY_TIER: Record<GridTier, Record<ColSize, string>> = {\n stacked: { tiny: 'col-span-6', small: 'col-span-12', medium: 'col-span-12', large: 'col-span-12', full: 'col-span-12' },\n narrow: { tiny: 'col-span-6', small: 'col-span-6', medium: 'col-span-12', large: 'col-span-12', full: 'col-span-12' },\n standard: { tiny: 'col-span-3', small: 'col-span-6', medium: 'col-span-6', large: 'col-span-12', full: 'col-span-12' },\n wide: { tiny: 'col-span-3', small: 'col-span-4', medium: 'col-span-6', large: 'col-span-8', full: 'col-span-12' },\n};\n\nexport function colsFor(tier: GridTier, size: ColSize): number {\n return TIER_COLS[tier][size];\n}\n\n/** The pixel width of a cell spanning `cols` of 12, given the grid width and column gap. */\nexport function slotWidthPx(gridWidthPx: number, columnGapPx: number, cols: number): number {\n return (cols * (gridWidthPx + columnGapPx)) / 12 - columnGapPx;\n}\n","import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport { nextTier, quantizeWidth, type GridTier } from './width-tier';\n\nconst useIsomorphicLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect;\n\n/** How long the width must hold still before a new tier commits, so an animating panel commits once. */\nexport const TIER_SETTLE_MS = 200;\n\nexport interface UseWidthTierOptions {\n /** Stop committing new widths, e.g. while a drawer animates. Unfreezing flushes the latest. */\n frozen?: boolean;\n}\n\nexport interface UseWidthTierResult {\n ref: (node: HTMLElement | null) => void;\n /** The quantised width, or `null` before the first measurement. */\n widthPx: number | null;\n tier: GridTier;\n}\n\n/**\n * Measures an element and reports its `GridTier`, debounced and with hysteresis. Ported from\n * SCIC in 0.7.0. Without `ResizeObserver` (jsdom, very old browsers) it measures once on mount\n * rather than throwing.\n */\nexport function useWidthTier({ frozen = false }: UseWidthTierOptions = {}): UseWidthTierResult {\n const [node, setNode] = useState<HTMLElement | null>(null);\n const [{ widthPx, tier }, setMeasured] = useState<{ widthPx: number | null; tier: GridTier }>({\n widthPx: null,\n tier: 'wide',\n });\n\n // The latest observed width, read by a pending commit, so it always lands on the current\n // width rather than a stale one.\n const observed = useRef<number | null>(null);\n const frozenRef = useRef(frozen);\n frozenRef.current = frozen;\n const tierRef = useRef<GridTier>(tier);\n tierRef.current = tier;\n const widthRef = useRef<number | null>(widthPx);\n widthRef.current = widthPx;\n\n const commit = useCallback(() => {\n const raw = observed.current;\n // A hidden subtree measures 0: keep the last value rather than collapsing and snapping back.\n if (raw === null || raw <= 0 || frozenRef.current) return;\n const next = quantizeWidth(raw);\n const nextT = nextTier(tierRef.current, next);\n if (next === widthRef.current && nextT === tierRef.current) return;\n setMeasured({ widthPx: next, tier: nextT });\n }, []);\n\n useIsomorphicLayoutEffect(() => {\n if (!node) return;\n let frame = 0;\n let timer: ReturnType<typeof setTimeout> | undefined;\n\n // Read and commit synchronously: an observer's first callback lands after paint, and the\n // settle delay would hold it longer, so the grid would show frames at a guessed tier.\n observed.current = node.getBoundingClientRect().width;\n commit();\n\n if (typeof ResizeObserver === 'undefined') return;\n const observer = new ResizeObserver((entries) => {\n const entry = entries[0];\n if (entry) observed.current = entry.contentRect.width;\n if (frame) cancelAnimationFrame(frame);\n frame = requestAnimationFrame(() => {\n frame = 0;\n if (timer) clearTimeout(timer);\n timer = setTimeout(commit, TIER_SETTLE_MS);\n });\n });\n observer.observe(node);\n return () => {\n observer.disconnect();\n if (frame) cancelAnimationFrame(frame);\n if (timer) clearTimeout(timer);\n };\n }, [node, commit]);\n\n // Unfreezing flushes the width that changed while frozen: nothing else would pick it up.\n useEffect(() => {\n if (!frozen) commit();\n }, [frozen, commit]);\n\n return { ref: setNode, widthPx, tier };\n}\n","import clsx from 'clsx';\nimport type { ReactElement, ReactNode } from 'react';\nimport { cn } from '../../lib/cn';\nimport { FOCUS_RING } from '../../lib/focus-ring';\nimport { Slot } from '../../lib/slot';\nimport type { StatusTone } from '../status/status-badge';\n\nconst DOT_TONE: Record<StatusTone, string> = {\n neutral: 'bg-status-dot-neutral',\n info: 'bg-status-dot-info',\n warning: 'bg-status-dot-warning',\n caution: 'bg-status-dot-caution',\n accent: 'bg-status-dot-accent',\n violet: 'bg-status-dot-violet',\n positive: 'bg-status-dot-positive',\n danger: 'bg-status-dot-danger',\n};\n\nexport interface StatTileProps {\n label: string;\n value: string | number;\n /** Status tone for the leading dot. Prefer this over `dotColor`. */\n tone?: StatusTone;\n /**\n * @deprecated Pass `tone` instead. A raw colour here bypasses the token layer,\n * which is how competing status palettes drift apart.\n */\n dotColor?: string;\n /** A muted line under the value: a comparison, a unit, \"of 240\". New in 0.7.0, from SCIC. */\n hint?: ReactNode;\n /**\n * Makes the tile a toggle button, for a row of tiles that filter a list below. New in 0.7.0.\n * Pair with `selected`.\n */\n onClick?: () => void;\n /**\n * The tile's filter is the active one. Sets `aria-pressed` (with `onClick`) or `aria-current`\n * (with `asChild`), and `data-state=\"selected\"`, which the tile styles: no conditional border\n * classes needed.\n */\n selected?: boolean;\n /** Render onto the single child instead, e.g. a router `<Link>` to a filtered page. */\n asChild?: boolean;\n /** The element to render onto, with `asChild`. Its own children are replaced by the tile. */\n children?: ReactElement;\n className?: string;\n}\n\n/**\n * A labelled figure: \"Open cases 42\".\n *\n * From 0.7.0 a tile can also be the filter for the list beneath it, which is what Cleo's\n * Companies, Employees and Users screens hand-built with\n * `className={filter === t.f ? 'border-brand …' : ''}`. Give it `onClick` and `selected` and it\n * is a real toggle button (`aria-pressed`), styled from its own state.\n */\nexport function StatTile({\n label,\n value,\n tone,\n dotColor,\n hint,\n onClick,\n selected,\n asChild = false,\n children,\n className,\n}: StatTileProps) {\n const showDot = Boolean(tone || dotColor);\n const interactive = Boolean(onClick) || asChild;\n\n const content = (\n <>\n <span className=\"flex items-center gap-1.5\">\n {showDot && (\n <span\n aria-hidden\n className={clsx('size-2 shrink-0 rounded-full', tone && DOT_TONE[tone])}\n style={tone ? undefined : { backgroundColor: dotColor }}\n />\n )}\n <span className=\"text-body-xs font-medium text-default-secondary whitespace-nowrap\">\n {label}\n </span>\n </span>\n <span className=\"text-heading font-semibold text-default leading-none\">{value}</span>\n {hint && <span className=\"text-body-tiny text-default-secondary\">{hint}</span>}\n </>\n );\n\n const rootProps = {\n 'data-state': selected ? 'selected' : undefined,\n className: cn(\n 'flex flex-col gap-2 rounded-xl border border-default bg-default p-4 text-left',\n interactive && ['cursor-pointer transition-colors hover:border-default-secondary', FOCUS_RING],\n 'data-[state=selected]:border-brand data-[state=selected]:bg-brand-tertiary',\n className,\n ),\n };\n\n if (asChild) {\n return (\n // A link to a filtered view is the current one, not a pressed toggle: `aria-pressed` is\n // only valid on a button.\n <Slot {...rootProps} aria-current={selected ? 'true' : undefined} wrapChildren={() => content}>\n {children}\n </Slot>\n );\n }\n\n if (onClick) {\n return (\n <button type=\"button\" aria-pressed={selected ?? false} onClick={onClick} {...rootProps}>\n {content}\n </button>\n );\n }\n\n return <div {...rootProps}>{content}</div>;\n}\n","import clsx from 'clsx';\n\nexport type StatNumberSize = 'sm' | 'md' | 'lg';\n\nexport type StatNumberWeight = 'medium' | 'bold';\n\nexport interface StatNumberProps {\n value: string | number;\n unit?: string;\n size?: StatNumberSize;\n weight?: StatNumberWeight;\n /** @deprecated Bypasses the design tokens — pass `tone` instead. Raw hex color, overrides the default text color via inline style. Use when the exact source color doesn't match a design token. */\n color?: string;\n className?: string;\n}\n\n// 32 / 40 / 48px — the --typo-scale-07/08/09 steps. These read `text-scale-0*` until\n// 0.3.0, which the preset never defined, so every size emitted no font-size at all.\nconst sizeStyles: Record<StatNumberSize, string> = {\n sm: 'text-subtitle',\n md: 'text-subtitle-lg',\n lg: 'text-title',\n};\n\nconst weightStyles: Record<StatNumberWeight, string> = {\n medium: 'font-medium',\n bold: 'font-bold',\n};\n\nexport function StatNumber({ value, unit, size = 'md', weight = 'bold', color, className }: StatNumberProps) {\n return (\n <p\n className={clsx(sizeStyles[size], weightStyles[weight], 'leading-none', !color && 'text-default', className)}\n style={color ? { color } : undefined}\n >\n {value}\n {unit && (\n <span className=\"ml-1 text-subheading font-medium text-default-secondary\">{unit}</span>\n )}\n </p>\n );\n}\n","import clsx from 'clsx';\n\nexport type ScoreValueSize = 'sm' | 'md' | 'lg' | 'xl' | '2xl';\nexport type ScoreValueWeight = 'normal' | 'semibold' | 'bold';\nexport type ScoreTone = 'brand' | 'positive' | 'warning' | 'danger' | 'neutral' | 'default';\nexport type ScoreValueTone = ScoreTone | 'auto';\n\n/**\n * The four tones the automatic ramp can produce.\n *\n * Narrower than `ScoreTone` on purpose: a ramp position is always one of these, so the\n * result is directly assignable to `ProgressBarTone` too — which is what lets a caller\n * tone a bar and its score from one `getScoreTone` call.\n */\nexport type ScoreRampTone = 'positive' | 'neutral' | 'warning' | 'danger';\n\n/** Which end of the scale is the bad end. */\nexport type ScoreDirection = 'higher-is-worse' | 'higher-is-better';\n\nexport interface ScoreThresholds {\n /** At or above this, the score is `danger`. */\n danger: number;\n /** At or above this, `warning`. */\n warning: number;\n /** At or above this, `neutral`. Below it, `positive`. */\n neutral: number;\n}\n\n/**\n * Default ramp, on a 0–100 scale read as \"higher is worse\" — the risk case.\n *\n * 0.2.0's ramp had only four stops and resolved 65–79 to `brand` (the blue brand\n * colour), which left `warning` and `positive` unreachable without passing `tone`\n * by hand. This is a real five-stop ramp.\n */\nexport const DEFAULT_SCORE_THRESHOLDS: ScoreThresholds = { danger: 80, warning: 65, neutral: 50 };\n\n/**\n * Resolve a numeric score to a tone.\n *\n * Was `getRiskTone` in 0.2.0, with the thresholds and the direction both hardcoded.\n */\nexport function getScoreTone(\n score: number,\n {\n direction = 'higher-is-worse',\n thresholds = DEFAULT_SCORE_THRESHOLDS,\n }: { direction?: ScoreDirection; thresholds?: ScoreThresholds } = {},\n): ScoreRampTone {\n // Flip the score, not the comparisons — one ramp, read from either end.\n const v = direction === 'higher-is-better' ? 100 - score : score;\n if (v >= thresholds.danger) return 'danger';\n if (v >= thresholds.warning) return 'warning';\n if (v >= thresholds.neutral) return 'neutral';\n return 'positive';\n}\n\n// 13 / 14 / 16 / 20 / 32px\nconst SIZE: Record<ScoreValueSize, string> = {\n sm: 'text-body-xs',\n md: 'text-body-sm',\n lg: 'text-subheading-sm',\n xl: 'text-subheading',\n '2xl': 'text-subtitle',\n};\n\nconst WEIGHT: Record<ScoreValueWeight, string> = {\n normal: 'font-normal',\n semibold: 'font-semibold',\n bold: 'font-bold',\n};\n\nconst TONE: Record<ScoreTone, string> = {\n brand: 'text-brand',\n positive: 'text-positive',\n warning: 'text-warning',\n danger: 'text-danger',\n neutral: 'text-default-secondary',\n default: 'text-default',\n};\n\nexport interface ScoreValueProps {\n value: string | number;\n /** Trailing caption — `/100`, `High`, `of target`. */\n label?: string;\n size?: ScoreValueSize;\n weight?: ScoreValueWeight;\n /** `auto` derives the tone from `value` via {@link getScoreTone}. */\n tone?: ScoreValueTone;\n direction?: ScoreDirection;\n thresholds?: ScoreThresholds;\n className?: string;\n}\n\n/**\n * A scored number with an optional caption and a tone that can track its value.\n *\n * Was `RiskScore`. Nothing about it was ever risk-specific except the name and the\n * direction of its ramp, so both are now parameters: use it for a risk score, a\n * compliance score, a match confidence, a utilisation percentage.\n *\n * Not to be confused with `StatNumber`, which is the *large display* number with a\n * unit (32–48px, for tiles and widget headlines). `ScoreValue` is the inline one with\n * a label and a tone ramp.\n */\nexport function ScoreValue({\n value,\n label,\n size = 'md',\n weight = 'bold',\n tone = 'auto',\n direction = 'higher-is-worse',\n thresholds = DEFAULT_SCORE_THRESHOLDS,\n className,\n}: ScoreValueProps) {\n // A numeric-looking string still resolves. In 0.2.0 `tone=\"auto\"` fell back to\n // `default` for any string, so callers passing `score=\"82\"` silently got no tone.\n const numeric = typeof value === 'number' ? value : Number(value);\n const resolved: ScoreTone =\n tone === 'auto'\n ? Number.isFinite(numeric)\n ? getScoreTone(numeric, { direction, thresholds })\n : 'default'\n : tone;\n\n return (\n <span data-tone={resolved} className={clsx('inline-flex items-baseline gap-1', className)}>\n <span className={clsx(SIZE[size], WEIGHT[weight], TONE[resolved])}>{value}</span>\n {label && <span className=\"text-body-xs text-default-secondary whitespace-nowrap\">{label}</span>}\n </span>\n );\n}\n","import clsx from 'clsx';\nimport type { ReactNode } from 'react';\n\nexport type TileGridColumns = 2 | 3 | 4 | 5 | 6;\n\n/**\n * Responsive column counts. Every source copy started two-up on mobile and stepped\n * to its full count at one breakpoint.\n *\n * The twelve source grids disagreed on which: seven used `lg:`, three used `md:`.\n * Standardising on `lg:` matches eight of them byte-for-byte and is the safer choice\n * — five tiles at `md` (768px) was cramped. `alerts`, `settings-users` and\n * `settings-organization` therefore stay two-up slightly longer on tablets than\n * before; that is the one deliberate layout change here.\n *\n * Six keeps its intermediate `sm:grid-cols-3` step, matching entities-listing —\n * without it, six tiles would stack 2×3 on tablet instead of 3×2.\n */\nexport type TileGridBreakpoint = 'sm' | 'md' | 'lg';\n\nconst COLUMNS: Record<TileGridBreakpoint, Record<TileGridColumns, string>> = {\n sm: {\n 2: 'grid-cols-2',\n 3: 'grid-cols-2 sm:grid-cols-3',\n 4: 'grid-cols-2 sm:grid-cols-4',\n 5: 'grid-cols-2 sm:grid-cols-5',\n 6: 'grid-cols-2 sm:grid-cols-6',\n },\n md: {\n 2: 'grid-cols-2',\n 3: 'grid-cols-2 md:grid-cols-3',\n 4: 'grid-cols-2 md:grid-cols-4',\n 5: 'grid-cols-2 md:grid-cols-5',\n 6: 'grid-cols-2 sm:grid-cols-3 md:grid-cols-6',\n },\n lg: {\n 2: 'grid-cols-2',\n 3: 'grid-cols-2 lg:grid-cols-3',\n 4: 'grid-cols-2 lg:grid-cols-4',\n 5: 'grid-cols-2 lg:grid-cols-5',\n 6: 'grid-cols-2 sm:grid-cols-3 lg:grid-cols-6',\n },\n};\n\nexport interface TileGridProps {\n children: ReactNode;\n columns?: TileGridColumns;\n /**\n * Breakpoint at which the grid reaches its full column count. `lg` is the default\n * and correct for a full-width page. Narrow contexts — a stat row inside a panel,\n * as on the article detail page — legitimately need `sm`.\n */\n at?: TileGridBreakpoint;\n className?: string;\n}\n\n/**\n * A responsive grid of equal-width tiles.\n *\n * Was `StatTileGrid`, which read as a `StatTile`-specific component. It has never been\n * coupled to one: no context, no cloning, no constraint on `children`. It takes any\n * nodes — `StatTile`s, `Card`s, chart tiles — and only owns the column counts and the\n * `gap-3`. The rename says so.\n */\nexport function TileGrid({\n children,\n columns = 4,\n at = 'lg',\n className,\n}: TileGridProps) {\n return <div className={clsx('grid gap-3', COLUMNS[at][columns], className)}>{children}</div>;\n}\n","/**\n * Chart colour.\n *\n * SVG paints via the `stroke` / `fill` *attributes*, which cannot take a Tailwind\n * class — so charts resolve a `tone` to a CSS variable reference instead of a utility.\n * That keeps them on the token layer; 0.2.0's charts defaulted to raw hex (`#0c2d58`,\n * `rgba(140,155,176,0.5)`) and drifted from it.\n *\n * Every chart still accepts an explicit `color` string for genuinely data-driven\n * colour — a series whose colour comes from the data, not from semantics.\n */\nexport type ChartTone = 'brand' | 'info' | 'positive' | 'warning' | 'danger' | 'neutral';\n\nexport const CHART_TONE: Record<ChartTone, string> = {\n brand: 'var(--color-background-brand-default)',\n info: 'var(--status-info-dot)',\n positive: 'var(--color-background-positive-default)',\n warning: 'var(--color-background-warning-default)',\n danger: 'var(--color-background-danger-default)',\n neutral: 'var(--color-background-neutral-default)',\n};\n\n/** The muted track/rest colour behind a highlighted series. */\nexport const CHART_TRACK = 'var(--color-background-default-tertiary)';\n\n/**\n * Ordered sequence for multi-series charts, so two donuts in the same product never\n * assign different colours to the same first category. Semantic tones come first\n * because a chart with two or three series is usually still saying something.\n */\nexport const CHART_SEQUENCE: ChartTone[] = ['brand', 'info', 'positive', 'warning', 'danger', 'neutral'];\n\n/** Resolve an explicit colour, else a tone, else the sequence position. */\nexport function resolveChartColor(color: string | undefined, tone: ChartTone | undefined, index = 0): string {\n if (color) return color;\n if (tone) return CHART_TONE[tone];\n return CHART_TONE[CHART_SEQUENCE[index % CHART_SEQUENCE.length]];\n}\n","import clsx from 'clsx';\nimport { resolveChartColor, type ChartTone } from './chart-tone';\n\nexport type BarChartOrientation = 'vertical' | 'horizontal';\nexport type BarChartSize = 'sm' | 'md' | 'lg';\n\n/** Thickness of one bar / one group slot, and the label type step. */\nconst SIZE: Record<BarChartSize, { band: number; gap: number; label: string }> = {\n sm: { band: 14, gap: 6, label: 'text-body-tiny' },\n md: { band: 20, gap: 8, label: 'text-body-xs' },\n lg: { band: 28, gap: 10, label: 'text-body-xs' },\n};\n\nexport interface BarChartSeries {\n label: string;\n /** One value per category. */\n values: number[];\n tone?: ChartTone;\n color?: string;\n}\n\nexport interface BarChartProps {\n /** Category names — the axis labels. */\n categories: string[];\n series: BarChartSeries[];\n orientation?: BarChartOrientation;\n /** Stack series on top of each other instead of placing them side by side. */\n stacked?: boolean;\n size?: BarChartSize;\n /** Overall length of the value axis, in px. */\n length?: number;\n /** Show the category labels along the axis. */\n showLabels?: boolean;\n /** Print each bar's value at the end of the bar. Horizontal orientation only. */\n showValues?: boolean;\n radius?: number;\n label?: string;\n className?: string;\n}\n\n/**\n * Grouped or stacked bars, in either orientation.\n *\n * Horizontal is the orientation the library was missing and the one that actually suits\n * category data, because long category names get a full line of width rather than being\n * rotated or truncated under a vertical bar.\n *\n * Deliberately axis-light: one baseline, no gridlines, no ticks. For anything needing\n * real axes or interaction, this is the wrong component.\n */\nexport function BarChart({\n categories,\n series,\n orientation = 'horizontal',\n stacked = false,\n size = 'md',\n length = 240,\n showLabels = true,\n showValues = false,\n radius = 3,\n label,\n className,\n}: BarChartProps) {\n const { band, gap, label: labelClass } = SIZE[size];\n if (categories.length === 0 || series.length === 0) return null;\n\n // Stacked bars share one band per category; grouped bars split it between series.\n const perCategory = stacked ? band : band * series.length + gap * (series.length - 1);\n\n const categoryTotals = categories.map((_, ci) =>\n stacked\n ? series.reduce((sum, s) => sum + Math.max(0, s.values[ci] ?? 0), 0)\n : Math.max(...series.map((s) => Math.max(0, s.values[ci] ?? 0))),\n );\n const max = Math.max(...categoryTotals, 1);\n\n const horizontal = orientation === 'horizontal';\n\n return (\n <div\n className={clsx('flex w-full min-w-0', horizontal ? 'flex-col gap-2' : 'flex-row items-end gap-3', className)}\n role={label ? 'img' : undefined}\n aria-label={label}\n // Without a label the chart is decoration and its bars are noise in the a11y tree.\n // Every other chart in the family had this fallback; BarChart was the one that did\n // not, so an unlabelled one announced each bar's markup.\n aria-hidden={label ? undefined : true}\n >\n {categories.map((category, ci) => {\n const bars = series.map((s, si) => ({\n key: s.label,\n value: Math.max(0, s.values[ci] ?? 0),\n color: resolveChartColor(s.color, s.tone, si),\n }));\n\n return (\n <div\n key={category}\n className={clsx('flex min-w-0', horizontal ? 'flex-col gap-1' : 'h-full flex-col justify-end gap-1.5')}\n style={horizontal ? undefined : { width: perCategory }}\n >\n {showLabels && horizontal && (\n <span className={clsx('truncate text-default-secondary', labelClass)}>{category}</span>\n )}\n\n <div\n className={clsx('flex', horizontal ? 'items-center gap-2' : 'w-full flex-1 items-end justify-center')}\n style={horizontal ? undefined : { height: length }}\n >\n <div\n className={clsx('flex min-w-0', stacked ? 'gap-0' : '')}\n style={\n horizontal\n ? { width: length, flexDirection: stacked ? 'row' : 'column', gap: stacked ? 0 : gap }\n : {\n height: '100%',\n width: perCategory,\n flexDirection: stacked ? 'column-reverse' : 'row',\n alignItems: 'flex-end',\n gap: stacked ? 0 : gap,\n }\n }\n >\n {bars.map((bar) => {\n const extent = `${(bar.value / max) * 100}%`;\n return (\n <div\n key={bar.key}\n title={`${category} · ${bar.key}: ${bar.value}`}\n className=\"transition-all motion-reduce:transition-none\"\n style={{\n backgroundColor: bar.color,\n borderRadius: radius,\n ...(horizontal\n ? { width: extent, height: stacked ? band : band }\n : { height: extent, width: stacked ? perCategory : band }),\n }}\n />\n );\n })}\n </div>\n {showValues && horizontal && (\n <span className={clsx('shrink-0 tabular-nums text-default-secondary', labelClass)}>\n {categoryTotals[ci]}\n </span>\n )}\n </div>\n\n {showLabels && !horizontal && (\n <span className={clsx('truncate text-center text-default-secondary', labelClass)}>{category}</span>\n )}\n </div>\n );\n })}\n </div>\n );\n}\n","import clsx from 'clsx';\nimport type { ReactNode } from 'react';\nimport { CHART_TRACK, resolveChartColor, type ChartTone } from './chart-tone';\n\nexport type DonutChartSize = 'sm' | 'md' | 'lg';\n\n/** Diameter and default ring thickness, in px. */\nconst SIZE: Record<DonutChartSize, { box: number; thickness: number }> = {\n sm: { box: 88, thickness: 10 },\n md: { box: 128, thickness: 14 },\n lg: { box: 180, thickness: 20 },\n};\n\nexport interface DonutSegment {\n label: string;\n value: number;\n /** Token-backed colour. Falls back to the segment's position in the chart sequence. */\n tone?: ChartTone;\n /** Explicit colour, for data-driven series. */\n color?: string;\n}\n\nexport interface DonutChartProps {\n segments: DonutSegment[];\n size?: DonutChartSize;\n /** Ring thickness in px. Overrides the `size` preset. */\n thickness?: number;\n /** Large text at the centre — a total, a percentage. */\n centerValue?: ReactNode;\n /** Caption beneath `centerValue`. */\n centerLabel?: ReactNode;\n /** Gap between segments, in degrees. */\n gap?: number;\n /** Accessible description. */\n label?: string;\n className?: string;\n}\n\n/**\n * A proportional ring.\n *\n * Drawn with `stroke-dasharray` on circles rather than arc paths: one element per\n * segment, no trigonometry, and the segments stay crisp at any thickness.\n */\nexport function DonutChart({\n segments,\n size = 'md',\n thickness,\n centerValue,\n centerLabel,\n gap = 2,\n label,\n className,\n}: DonutChartProps) {\n const { box, thickness: presetThickness } = SIZE[size];\n const ring = thickness ?? presetThickness;\n const radius = (box - ring) / 2;\n const circumference = 2 * Math.PI * radius;\n const total = segments.reduce((sum, s) => sum + Math.max(0, s.value), 0);\n\n // A gap is only meaningful between two or more visible segments.\n const visible = segments.filter((s) => s.value > 0);\n const gapLength = visible.length > 1 ? (gap / 360) * circumference : 0;\n\n let offset = 0;\n\n return (\n <div className={clsx('relative inline-flex shrink-0 items-center justify-center', className)}>\n <svg\n width={box}\n height={box}\n viewBox={`0 0 ${box} ${box}`}\n role={label ? 'img' : undefined}\n aria-label={label}\n aria-hidden={label ? undefined : true}\n // -90° so the first segment starts at twelve o'clock rather than three.\n className=\"block -rotate-90\"\n >\n <circle cx={box / 2} cy={box / 2} r={radius} fill=\"none\" stroke={CHART_TRACK} strokeWidth={ring} />\n {total > 0 &&\n segments.map((segment, i) => {\n const fraction = Math.max(0, segment.value) / total;\n const length = Math.max(0, fraction * circumference - gapLength);\n const dash = `${length} ${circumference - length}`;\n const thisOffset = offset;\n offset += fraction * circumference;\n if (segment.value <= 0) return null;\n return (\n <circle\n key={segment.label}\n cx={box / 2}\n cy={box / 2}\n r={radius}\n fill=\"none\"\n stroke={resolveChartColor(segment.color, segment.tone, i)}\n strokeWidth={ring}\n strokeDasharray={dash}\n strokeDashoffset={-thisOffset}\n strokeLinecap=\"butt\"\n />\n );\n })}\n </svg>\n {(centerValue != null || centerLabel != null) && (\n <div className=\"absolute inset-0 flex flex-col items-center justify-center text-center\">\n {centerValue != null && (\n <span className=\"text-subheading-sm font-bold leading-none text-default\">{centerValue}</span>\n )}\n {centerLabel != null && (\n <span className=\"mt-0.5 text-body-tiny text-default-secondary\">{centerLabel}</span>\n )}\n </div>\n )}\n </div>\n );\n}\n","import clsx from 'clsx';\nimport type { ReactNode } from 'react';\nimport { CHART_TRACK, resolveChartColor, type ChartTone } from './chart-tone';\n\nexport type RadialGaugeSize = 'sm' | 'md' | 'lg';\n\nconst SIZE: Record<RadialGaugeSize, { box: number; thickness: number; value: string }> = {\n sm: { box: 72, thickness: 8, value: 'text-body-sm' },\n md: { box: 104, thickness: 11, value: 'text-subheading-sm' },\n lg: { box: 148, thickness: 15, value: 'text-subheading' },\n};\n\nexport interface RadialGaugeProps {\n value: number;\n /** Top of the scale. */\n max?: number;\n size?: RadialGaugeSize;\n tone?: ChartTone;\n color?: string;\n /** Ring thickness in px. Overrides the `size` preset. */\n thickness?: number;\n /**\n * Sweep in degrees. 360 is a full ring; 270 leaves a gap at the bottom, which reads\n * more like a dial than a pie.\n */\n sweep?: number;\n /** Centre content. Defaults to the value; pass `null` for an empty ring. */\n children?: ReactNode;\n /** Caption beneath the centre value. */\n centerLabel?: ReactNode;\n label?: string;\n className?: string;\n}\n\n/**\n * A single-value arc — a score ring, a utilisation dial, a completion meter.\n *\n * The shape the library had no form for: `ProgressBar` covers linear progress and\n * `DonutChart` compares parts of a whole, but neither draws \"one number against its\n * ceiling\" in a round frame.\n */\nexport function RadialGauge({\n value,\n max = 100,\n size = 'md',\n tone = 'brand',\n color,\n thickness,\n sweep = 270,\n children,\n centerLabel,\n label,\n className,\n}: RadialGaugeProps) {\n const preset = SIZE[size];\n const box = preset.box;\n const ring = thickness ?? preset.thickness;\n const radius = (box - ring) / 2;\n const circumference = 2 * Math.PI * radius;\n\n const clampedSweep = Math.min(360, Math.max(1, sweep));\n const arc = (clampedSweep / 360) * circumference;\n const fraction = max > 0 ? Math.min(1, Math.max(0, value / max)) : 0;\n const stroke = resolveChartColor(color, tone);\n\n // Rotate so the arc is centred on twelve o'clock: -90° puts the start at the top,\n // then half the unswept remainder brings it back round.\n const rotation = -90 + (360 - clampedSweep) / 2;\n\n return (\n <div className={clsx('relative inline-flex shrink-0 items-center justify-center', className)}>\n <svg\n width={box}\n height={box}\n viewBox={`0 0 ${box} ${box}`}\n role={label ? 'img' : undefined}\n aria-label={label}\n aria-hidden={label ? undefined : true}\n className=\"block\"\n style={{ transform: `rotate(${rotation}deg)` }}\n >\n <circle\n cx={box / 2}\n cy={box / 2}\n r={radius}\n fill=\"none\"\n stroke={CHART_TRACK}\n strokeWidth={ring}\n strokeDasharray={`${arc} ${circumference - arc}`}\n strokeLinecap=\"round\"\n />\n <circle\n cx={box / 2}\n cy={box / 2}\n r={radius}\n fill=\"none\"\n stroke={stroke}\n strokeWidth={ring}\n strokeDasharray={`${arc * fraction} ${circumference - arc * fraction}`}\n strokeLinecap=\"round\"\n className=\"transition-all motion-reduce:transition-none\"\n />\n </svg>\n <div className=\"absolute inset-0 flex flex-col items-center justify-center text-center\">\n {children === undefined ? (\n <span className={clsx('font-bold leading-none text-default', preset.value)}>{value}</span>\n ) : (\n children\n )}\n {centerLabel != null && (\n <span className=\"mt-0.5 text-body-tiny text-default-secondary\">{centerLabel}</span>\n )}\n </div>\n </div>\n );\n}\n","import { useId } from 'react';\nimport clsx from 'clsx';\nimport { CHART_TONE, resolveChartColor, type ChartTone } from './chart-tone';\n\nexport type SparklineVariant = 'line' | 'area';\nexport type SparklineSize = 'sm' | 'md' | 'lg';\n\n/** Size presets, so callers stop passing bare pixel pairs. */\nconst SIZE: Record<SparklineSize, { width: number; height: number }> = {\n sm: { width: 80, height: 24 },\n md: { width: 120, height: 36 },\n lg: { width: 200, height: 56 },\n};\n\nexport interface SparklineProps {\n data: number[];\n variant?: SparklineVariant;\n /** Token-backed colour. Ignored when `color` is set. */\n tone?: ChartTone;\n /** Explicit colour, for series whose colour comes from the data. */\n color?: string;\n size?: SparklineSize;\n /** Overrides the `size` preset. */\n width?: number;\n height?: number;\n strokeWidth?: number;\n /** Dot on the final point — useful when the line is the \"current value\". */\n showEndDot?: boolean;\n /**\n * Stretch to fill the container instead of drawing at a fixed pixel size.\n *\n * The `size` preset still sets the viewBox, so it decides the sampling density; the SVG then\n * scales to the box it is given. Stroke width is held constant with `non-scaling-stroke`,\n * without which a non-uniform stretch would thin the line on one axis and thicken it on the\n * other.\n */\n fill?: boolean;\n /** Accessible description. Omit to keep the chart decorative. */\n label?: string;\n className?: string;\n}\n\n/**\n * A compact trend line, with no axes and no interaction.\n *\n * `variant=\"area\"` adds the gradient fill beneath the line that 0.2.0 had no way to\n * draw, which is what makes a sparkline readable at `lg` where a bare 1.5px stroke\n * looks thin.\n */\nexport function Sparkline({\n data,\n variant = 'line',\n tone = 'brand',\n color,\n size = 'md',\n width,\n height,\n strokeWidth = 1.5,\n showEndDot = false,\n fill: stretch = false,\n label,\n className,\n}: SparklineProps) {\n const gradientId = useId();\n if (data.length < 2) return null;\n\n const w = width ?? SIZE[size].width;\n const h = height ?? SIZE[size].height;\n const stroke = resolveChartColor(color, tone);\n\n const min = Math.min(...data);\n const max = Math.max(...data);\n const range = max - min || 1;\n const pad = strokeWidth;\n const innerH = h - pad * 2;\n const innerW = w - pad * 2;\n\n const coords = data.map((v, i) => ({\n x: pad + (i / (data.length - 1)) * innerW,\n y: pad + innerH - ((v - min) / range) * innerH,\n }));\n const points = coords.map((p) => `${p.x.toFixed(2)},${p.y.toFixed(2)}`).join(' ');\n // Close the path down to the baseline so the fill has something to fill.\n const areaPath = `M ${points.split(' ').join(' L ')} L ${coords[coords.length - 1].x.toFixed(2)},${h} L ${coords[0].x.toFixed(2)},${h} Z`;\n const last = coords[coords.length - 1];\n\n return (\n <svg\n width={stretch ? undefined : w}\n height={stretch ? undefined : h}\n viewBox={`0 0 ${w} ${h}`}\n preserveAspectRatio={stretch ? 'none' : undefined}\n fill=\"none\"\n role={label ? 'img' : undefined}\n aria-label={label}\n aria-hidden={label ? undefined : true}\n className={clsx('block', stretch ? 'h-full w-full' : 'shrink-0', className)}\n >\n {variant === 'area' && (\n <>\n <defs>\n <linearGradient id={gradientId} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor={stroke} stopOpacity={0.24} />\n <stop offset=\"100%\" stopColor={stroke} stopOpacity={0} />\n </linearGradient>\n </defs>\n <path d={areaPath} fill={`url(#${gradientId})`} />\n </>\n )}\n <polyline\n points={points}\n stroke={stroke}\n strokeWidth={strokeWidth}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n // Holds the line at `strokeWidth` under a non-uniform stretch. Harmless when not\n // stretching, since the scale is 1:1 there.\n vectorEffect={stretch ? 'non-scaling-stroke' : undefined}\n fill=\"none\"\n />\n {showEndDot && (\n <circle\n cx={last.x}\n cy={last.y}\n // A stretched circle would become an ellipse, so the dot is drawn in viewBox units\n // and sized from the smaller axis to stay visually round enough at either extreme.\n r={strokeWidth * 1.6}\n fill={stroke}\n stroke={CHART_TONE.neutral}\n strokeWidth={0}\n />\n )}\n </svg>\n );\n}\n","import clsx from 'clsx';\nimport { CHART_TRACK, resolveChartColor, type ChartTone } from './chart-tone';\n\nexport type MiniBarChartSize = 'sm' | 'md' | 'lg';\nexport type MiniBarChartOrientation = 'vertical' | 'horizontal';\n\nconst SIZE: Record<MiniBarChartSize, { width: number; height: number; gap: number }> = {\n sm: { width: 80, height: 32, gap: 2 },\n md: { width: 120, height: 48, gap: 3 },\n lg: { width: 200, height: 72, gap: 4 },\n};\n\nexport interface MiniBarChartProps {\n bars: number[];\n /** Colour of the highlighted bars. */\n tone?: ChartTone;\n color?: string;\n /** Colour of the un-highlighted bars. Defaults to the muted track token. */\n restColor?: string;\n /**\n * Which bars are highlighted. A number or list of indices; negatives count from the\n * end, so `-1` is the last bar. Pass `[]` to highlight none.\n *\n * Replaces 0.2.0's `highlightLastBar` boolean, which could only ever mean `-1`.\n */\n highlight?: number | number[];\n size?: MiniBarChartSize;\n /** Overrides the `size` preset. */\n width?: number;\n height?: number;\n gap?: number;\n orientation?: MiniBarChartOrientation;\n radius?: number;\n /**\n * Stretch to fill the container instead of drawing at a fixed pixel size.\n *\n * The `size` preset still sets the viewBox, so it decides the bar-to-gap proportions; the\n * SVG then scales to whatever box it is given. Without this a widget body could only hold a\n * chart at a hardcoded width, which stops being the right width as soon as the widget\n * reflows.\n */\n fill?: boolean;\n label?: string;\n className?: string;\n}\n\n/** A compact bar series with no axes — a distribution or a per-period count. */\nexport function MiniBarChart({\n bars,\n tone = 'brand',\n color,\n restColor = CHART_TRACK,\n highlight = -1,\n size = 'md',\n width,\n height,\n gap,\n orientation = 'vertical',\n radius = 2,\n fill: stretch = false,\n label,\n className,\n}: MiniBarChartProps) {\n if (bars.length === 0) return null;\n\n const preset = SIZE[size];\n const w = width ?? preset.width;\n const h = height ?? preset.height;\n const g = gap ?? preset.gap;\n const fill = resolveChartColor(color, tone);\n\n const highlighted = new Set(\n (Array.isArray(highlight) ? highlight : [highlight]).map((i) => (i < 0 ? bars.length + i : i)),\n );\n\n const max = Math.max(...bars) || 1;\n const vertical = orientation === 'vertical';\n // The cross-axis is divided between bars; the value axis carries the magnitude.\n const span = vertical ? w : h;\n const extent = vertical ? h : w;\n const barThickness = (span - g * (bars.length - 1)) / bars.length;\n\n return (\n <svg\n width={stretch ? undefined : w}\n height={stretch ? undefined : h}\n viewBox={`0 0 ${w} ${h}`}\n // `none` so the bars fill the box on both axes rather than letterboxing inside it —\n // there is no geometry here whose aspect ratio has to be preserved, only rectangles.\n preserveAspectRatio={stretch ? 'none' : undefined}\n fill=\"none\"\n role={label ? 'img' : undefined}\n aria-label={label}\n aria-hidden={label ? undefined : true}\n className={clsx('block', stretch ? 'h-full w-full' : 'shrink-0', className)}\n >\n {bars.map((v, i) => {\n const magnitude = Math.max(2, (v / max) * extent);\n const offset = i * (barThickness + g);\n return (\n <rect\n key={i}\n x={(vertical ? offset : 0).toFixed(2)}\n // Vertical bars grow up from the baseline; horizontal ones out from the left.\n y={(vertical ? extent - magnitude : offset).toFixed(2)}\n width={(vertical ? barThickness : magnitude).toFixed(2)}\n height={(vertical ? magnitude : barThickness).toFixed(2)}\n fill={highlighted.has(i) ? fill : restColor}\n rx={radius}\n />\n );\n })}\n </svg>\n );\n}\n","import clsx from 'clsx';\nimport { LegendDot, type LegendDotShape, type LegendDotSize } from './legend-dot';\nimport { resolveChartColor, type ChartTone } from './chart-tone';\n\nexport type ChartLegendOrientation = 'vertical' | 'horizontal';\n\nexport interface ChartLegendItem {\n label: string;\n /** Trailing value. Omit for a legend that only names the series. */\n count?: number | string;\n /** Token-backed colour. Falls back to the item's position in the chart sequence. */\n tone?: ChartTone;\n /** Explicit colour, for data-driven series. */\n color?: string;\n}\n\nexport interface ChartLegendProps {\n items: ChartLegendItem[];\n /**\n * `vertical` spreads each row to fill its container, so the counts align in a column\n * beside a donut. `horizontal` wraps inline, for a legend under a bar chart.\n */\n orientation?: ChartLegendOrientation;\n size?: LegendDotSize;\n shape?: LegendDotShape;\n className?: string;\n}\n\n/** Series names, swatches and optional values. */\nexport function ChartLegend({\n items,\n orientation = 'vertical',\n size = 'md',\n shape = 'dot',\n className,\n}: ChartLegendProps) {\n const horizontal = orientation === 'horizontal';\n\n return (\n <div\n className={clsx(\n horizontal ? 'flex flex-wrap items-center gap-x-4 gap-y-2' : 'flex flex-col gap-3',\n className,\n )}\n >\n {items.map((item, i) => (\n <div\n key={item.label}\n className={clsx('flex items-center gap-2', horizontal ? 'min-w-0' : 'justify-between')}\n >\n <div className=\"flex min-w-0 items-center gap-2\">\n {/* Resolved here, not in LegendDot, so the sequence fallback can use the\n item's position — matching how DonutChart colours its segments. */}\n <LegendDot color={resolveChartColor(item.color, item.tone, i)} size={size} shape={shape} />\n <span className=\"truncate text-body-xs text-default-secondary\">{item.label}</span>\n </div>\n {item.count != null && (\n <span className=\"shrink-0 text-body-xs font-semibold tabular-nums text-default\">{item.count}</span>\n )}\n </div>\n ))}\n </div>\n );\n}\n","import clsx from 'clsx';\nimport { resolveChartColor, type ChartTone } from './chart-tone';\nimport type { BadgeColor } from '../status/badge';\n\nexport type LegendDotSize = 'sm' | 'md';\n/** `line` is the swatch for a line series; `dot` and `square` for areas and bars. */\nexport type LegendDotShape = 'dot' | 'square' | 'line';\n\nconst SHAPE: Record<LegendDotShape, Record<LegendDotSize, string>> = {\n dot: { sm: 'size-1.5 rounded-full', md: 'size-2 rounded-full' },\n square: { sm: 'size-1.5 rounded-[2px]', md: 'size-2 rounded-[3px]' },\n line: { sm: 'h-0.5 w-3 rounded-full', md: 'h-0.5 w-4 rounded-full' },\n};\n\nexport interface LegendDotProps {\n /** Token-backed colour. Ignored when `color` is set. */\n tone?: ChartTone;\n /** Explicit colour, for data-driven series. */\n color?: string;\n /**\n * A categorical colour from the badge palette (its text shade, strong enough for a small dot),\n * to key a list item to the same `hue` on an `EntityIconBadge`. Ignored when `color` is set.\n * New in 0.9.5.\n */\n hue?: BadgeColor;\n size?: LegendDotSize;\n shape?: LegendDotShape;\n className?: string;\n}\n\n/** The colour swatch beside a series name. */\nexport function LegendDot({ tone, color, hue, size = 'md', shape = 'dot', className }: LegendDotProps) {\n return (\n <span\n className={clsx('inline-block shrink-0', SHAPE[shape][size], className)}\n style={{ backgroundColor: color || !hue ? resolveChartColor(color, tone) : `var(--badge-${hue}-text)` }}\n aria-hidden\n />\n );\n}\n","import clsx from 'clsx';\nimport { TrendingDownIcon, TrendingUpIcon } from 'lucide-react';\n\nexport type TrendLabelWeight = 'semibold' | 'bold';\nexport type TrendLabelSize = 'sm' | 'md' | 'lg';\n/**\n * Which direction is the good one.\n *\n * A delta component cannot infer this: +4% on-time delivery is good, +4% unit cost is\n * not. 0.2.0 had no such prop, so the only way to render a \"rising is bad\" delta was to\n * pass a raw hex — which is exactly what the deleted `BenchmarkCard` did, inverting its\n * own `positiveColor` default to red to compensate.\n */\nexport type TrendDirection = 'up-is-good' | 'up-is-bad';\n\nconst SIZE: Record<TrendLabelSize, string> = {\n sm: 'text-body-xs',\n md: 'text-body-sm',\n lg: 'text-subheading-sm',\n};\n\nconst ICON_SIZE: Record<TrendLabelSize, string> = {\n sm: 'size-3',\n md: 'size-3.5',\n lg: 'size-4',\n};\n\nconst weightBySize: Record<TrendLabelSize, TrendLabelWeight> = {\n sm: 'semibold',\n md: 'semibold',\n lg: 'bold',\n};\n\nconst WEIGHT: Record<TrendLabelWeight, string> = {\n semibold: 'font-semibold',\n bold: 'font-bold',\n};\n\nexport interface TrendLabelProps {\n value: number;\n suffix?: string;\n size?: TrendLabelSize;\n weight?: TrendLabelWeight;\n direction?: TrendDirection;\n /** Trend arrow. On by default — the docs described one long before there was one. */\n showArrow?: boolean;\n /** Explicit colour, for the rare data-driven case. Overrides the direction logic. */\n color?: string;\n className?: string;\n}\n\n/** A signed delta with a direction arrow, toned by whether the movement is good news. */\nexport function TrendLabel({\n value,\n suffix = '%',\n size = 'md',\n weight,\n direction = 'up-is-good',\n showArrow = true,\n color,\n className,\n}: TrendLabelProps) {\n const rising = value > 0;\n // Zero is neither good nor bad. 0.2.0 rendered it as a green \"+0%\".\n const flat = value === 0;\n const good = direction === 'up-is-good' ? rising : !rising;\n const Arrow = rising ? TrendingUpIcon : TrendingDownIcon;\n\n return (\n <span\n className={clsx(\n 'inline-flex items-center gap-1 whitespace-nowrap',\n SIZE[size],\n WEIGHT[weight ?? weightBySize[size]],\n !color && (flat ? 'text-default-secondary' : good ? 'text-positive' : 'text-danger'),\n className,\n )}\n style={color ? { color } : undefined}\n >\n {showArrow && !flat && <Arrow className={clsx('shrink-0', ICON_SIZE[size])} aria-hidden />}\n {rising ? '+' : ''}\n {value}\n {suffix}\n </span>\n );\n}\n","import { Fragment, useEffect, useId, useMemo, type ReactNode } from 'react';\nimport clsx from 'clsx';\n\nimport { cn } from '../../lib/cn';\nimport { FOCUS_RING_INSET } from '../../lib/focus-ring';\nimport { SCROLLBAR_CLASSES } from '../../lib/scrollbar';\nimport { useControllableState } from '../../lib/use-controllable-state';\nimport { useRovingFocus } from '../../lib/use-roving-focus';\nimport { EyebrowLabel } from '../chrome/eyebrow-label';\n\n/** One choice in a `Listbox`. */\nexport interface ListboxOption {\n value: string;\n label: ReactNode;\n /** Typeahead text, when `label` is not a plain string. */\n textValue?: string;\n /** Trailing content, e.g. a count: \"3 Permission Sets\". Part of the option's name. */\n meta?: ReactNode;\n disabled?: boolean;\n}\n\n/** A titled run of options. Rendered as `role=\"group\"`, named by its visible header. */\nexport interface ListboxGroup {\n label: string;\n options: readonly ListboxOption[];\n}\n\nexport interface ListboxProps {\n /** Options, or groups of options, in display order. Groups and bare options can mix. */\n options: readonly (ListboxOption | ListboxGroup)[];\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n /** Accessible name. Required: a listbox has no visible name of its own. */\n label: string;\n /**\n * Select an option as soon as it is focused with the arrow keys (the APG's \"selection follows\n * focus\"), for a picker that drives a detail view beside it. Default `true`. With `false`, the\n * arrows only move, and Enter, Space or a click selects.\n */\n selectionFollowsFocus?: boolean;\n /** Cap the height (px number or CSS length) and scroll the options inside it. */\n maxHeight?: number | string;\n /** Shown in place of the options when there are none. */\n empty?: ReactNode;\n /** Layout classes on the root, e.g. width. */\n className?: string;\n}\n\nconst isGroup = (entry: ListboxOption | ListboxGroup): entry is ListboxGroup => 'options' in entry;\n\n/**\n * A persistent single-select list: pick one item and keep it picked, e.g. the permission whose\n * holders a panel beside it lists. New in 0.9.5.\n *\n * The WAI-ARIA APG listbox pattern: `role=\"listbox\"` with `role=\"option\"` items carrying\n * `aria-selected`, one tab stop with a roving tabindex, arrow keys, Home and End, and typeahead.\n * Groups are `role=\"group\"`, named by their visible header. Use it where `Select` or\n * `Combobox` would hide the choices behind a popup, and `Command` does not fit: `Command` is\n * for running an action, its highlight is not a selection, and it always has a search box. For\n * a short set where every option deserves a label and description, use `RadioGroup`.\n */\nexport function Listbox({\n options,\n value: valueProp,\n defaultValue,\n onValueChange,\n label,\n selectionFollowsFocus = true,\n maxHeight,\n empty,\n className,\n}: ListboxProps) {\n const id = useId();\n const [value, setValue] = useControllableState<string | undefined>({\n value: valueProp,\n defaultValue,\n onChange: onValueChange as ((next: string | undefined) => void) | undefined,\n });\n\n // Every option in display order: the roving index is a position in this list.\n const flat = useMemo(\n () => options.flatMap((entry) => (isGroup(entry) ? entry.options : [entry])),\n [options],\n );\n const selectedIndex = flat.findIndex((option) => option.value === value);\n\n const roving = useRovingFocus({\n orientation: 'vertical',\n loop: false,\n typeahead: true,\n defaultIndex: Math.max(0, selectedIndex),\n });\n const { setActiveIndex } = roving;\n\n // A selection made from outside moves the tab stop to it, without stealing focus.\n useEffect(() => {\n if (selectedIndex >= 0) setActiveIndex(selectedIndex);\n }, [selectedIndex, setActiveIndex]);\n\n let index = -1;\n const renderOption = (option: ListboxOption) => {\n index += 1;\n const position = index;\n const selected = option.value === value;\n const item = roving.itemProps(position, {\n disabled: option.disabled,\n label: option.textValue ?? (typeof option.label === 'string' ? option.label : undefined),\n });\n const select = () => {\n if (!option.disabled) setValue(option.value);\n };\n return (\n <div\n key={option.value}\n ref={item.ref}\n tabIndex={item.tabIndex}\n data-roving-index={item['data-roving-index']}\n role=\"option\"\n aria-selected={selected}\n aria-disabled={option.disabled || undefined}\n data-state={selected ? 'selected' : undefined}\n onFocus={() => {\n item.onFocus();\n if (selectionFollowsFocus) select();\n }}\n onClick={select}\n onKeyDown={(event) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n select();\n }\n }}\n className={clsx(\n 'flex w-full cursor-pointer items-center gap-2.5 border-b border-default bg-default px-4 py-2 text-left text-body-xs text-default',\n 'hover:bg-default-secondary',\n 'data-[state=selected]:bg-brand-tertiary data-[state=selected]:font-semibold',\n 'aria-disabled:cursor-not-allowed aria-disabled:text-disabled',\n FOCUS_RING_INSET,\n )}\n >\n <span className=\"min-w-0 flex-1\">{option.label}</span>\n {option.meta !== undefined && (\n <span className=\"shrink-0 whitespace-nowrap font-normal text-default-secondary\">{option.meta}</span>\n )}\n </div>\n );\n };\n\n if (flat.length === 0 && empty) {\n return <div className={cn('px-4 py-6 text-center text-body-xs text-default-secondary', className)}>{empty}</div>;\n }\n\n return (\n <div\n role=\"listbox\"\n aria-label={label}\n {...roving.containerProps}\n className={cn(maxHeight !== undefined && ['overflow-auto overscroll-contain', SCROLLBAR_CLASSES], className)}\n style={maxHeight !== undefined ? { maxHeight } : undefined}\n >\n {options.map((entry, groupIndex) => {\n if (!isGroup(entry)) return <Fragment key={entry.value}>{renderOption(entry)}</Fragment>;\n const headerId = `${id}-group-${groupIndex}`;\n return (\n <div key={`${groupIndex}-${entry.label}`} role=\"group\" aria-labelledby={headerId}>\n <div id={headerId} className=\"border-b border-default bg-default-secondary px-4 py-2\">\n <EyebrowLabel>{entry.label}</EyebrowLabel>\n </div>\n {entry.options.map(renderOption)}\n </div>\n );\n })}\n </div>\n );\n}\n","import clsx from 'clsx';\nimport type { MouseEvent, ReactElement, ReactNode } from 'react';\nimport { cn } from '../../lib/cn';\nimport { FOCUS_RING } from '../../lib/focus-ring';\nimport { Slot } from '../../lib/slot';\n\nexport type ListRowDensity = 'default' | 'compact';\nexport type ListRowDivider = 'none' | 'top' | 'bottom';\n\nconst DENSITY: Record<ListRowDensity, { pad: string; gap: string; title: string; description: string }> = {\n default: {\n pad: 'py-4',\n gap: 'gap-3',\n title: 'text-body-sm font-semibold text-default',\n description: 'text-body-xs text-default-secondary',\n },\n compact: {\n pad: 'py-2.5',\n gap: 'gap-2',\n title: 'text-body-xs font-semibold text-default',\n description: 'text-body-tiny text-default-secondary',\n },\n};\n\nconst DIVIDER: Record<ListRowDivider, string> = {\n none: '',\n top: 'border-t border-default',\n bottom: 'border-b border-default',\n};\n\nexport interface ListRowProps {\n /** Left of the title, on the title line — an icon badge, avatar, checkbox, file chip. */\n leading?: ReactNode;\n title?: ReactNode;\n /** Inline after the title — a Required/Optional chip, a count, a tag. */\n titleMeta?: ReactNode;\n /** Muted line under the title. */\n description?: ReactNode;\n /** Right end of the title line — a `StatusBadge`, a score, a timestamp. */\n meta?: ReactNode;\n /** Right-hand column spanning the whole row, vertically centred — actions, a `Toggle`. */\n trailing?: ReactNode;\n /** Full-width block below the title line — a `FileRow`, a `FileDropZone`, an alert, a nested list. */\n footer?: ReactNode;\n density?: ListRowDensity;\n divider?: ListRowDivider;\n /** Render an `<li>` instead of a `<div>` — use inside a `<ul>`/`<ol>`. */\n as?: 'div' | 'li';\n onClick?: () => void;\n /**\n * Render onto the single child instead, e.g. a router `<Link>` for a row that navigates.\n * The child is the interactive element and the slots render inside it. New in 0.7.0.\n *\n * <ListRow asChild title=\"Acme\" description=\"Supplier\"><Link to=\"/acme\" /></ListRow>\n */\n asChild?: boolean;\n /** The element to render onto, with `asChild`. Its own children are replaced by the slots. */\n children?: ReactElement;\n /**\n * The row is chosen, in a set where rows toggle on and off (a picker, a multi-select list).\n * Sets `aria-pressed` on a clickable row and `data-state=\"selected\"`, which the row styles.\n * New in 0.7.0; it replaces conditional `bg-brand-tertiary` classes at the call site.\n */\n selected?: boolean;\n /**\n * The row is the current one in a navigation-like list (the open section, this page). Sets\n * `aria-current` and is styled like `selected`. New in 0.7.0.\n */\n current?: boolean | 'page' | 'step' | 'location';\n /** A clickable row that cannot be activated right now. Sets `aria-disabled`. New in 0.7.0. */\n disabled?: boolean;\n /**\n * Accessible name for a clickable row. Strongly recommended whenever `onClick` is set:\n * without it the name is the concatenation of every slot's text.\n */\n 'aria-label'?: string;\n className?: string;\n}\n\n/**\n * The generic list row: six slots and no opinion about what goes in them.\n *\n * Replaces `DocumentRow` and `DocumentChecklistRow`, which baked one product's\n * document-upload flow — its status vocabulary, its five raw-hex pills and its\n * unicode-glyph labels — into the library. Every feature of those rows is reachable by\n * composing this with `FileRow`, `FileDropZone` and `StatusBadge`; see the docs.\n *\n * State is a prop, not a class: `selected`, `current` and `disabled` set the attributes that\n * announce them (`aria-pressed`, `aria-current`, `aria-disabled`, `data-state`) and the row\n * styles itself from those.\n */\nexport function ListRow({\n leading,\n title,\n titleMeta,\n description,\n meta,\n trailing,\n footer,\n density = 'default',\n divider = 'none',\n as: Tag = 'div',\n onClick,\n asChild = false,\n children,\n selected,\n current,\n disabled = false,\n 'aria-label': ariaLabel,\n className,\n}: ListRowProps) {\n const d = DENSITY[density];\n const hasTitleLine = Boolean(leading || title != null || titleMeta || meta);\n const clickable = Boolean(onClick) && !asChild;\n const interactive = clickable || asChild;\n\n const activate = () => {\n if (!disabled) onClick?.();\n };\n\n const rootProps = {\n 'data-state': selected ? 'selected' : undefined,\n 'aria-current': current === true ? ('true' as const) : current || undefined,\n className: cn(\n 'flex w-full items-start',\n d.pad,\n DIVIDER[divider],\n interactive && ['cursor-pointer rounded-lg transition-colors hover:bg-default-secondary/50', FOCUS_RING],\n // State styled from the attributes that announce it.\n 'data-[state=selected]:bg-brand-tertiary aria-[current]:bg-brand-tertiary',\n disabled && 'cursor-not-allowed opacity-60 hover:bg-transparent',\n className,\n ),\n };\n\n const body = (\n <>\n <div className={clsx('flex min-w-0 flex-1 flex-col', d.gap)}>\n {hasTitleLine && (\n <div className=\"flex items-center justify-between gap-2\">\n <div className=\"flex min-w-0 items-center gap-2\">\n {leading}\n {title != null && <span className={clsx('truncate', d.title)}>{title}</span>}\n {titleMeta && <span className=\"shrink-0\">{titleMeta}</span>}\n </div>\n {meta && <span className=\"shrink-0\">{meta}</span>}\n </div>\n )}\n {description && <p className={d.description}>{description}</p>}\n {/* Both slots stop click and key propagation when the row itself is clickable.\n The JSDoc on `trailing` and `footer` advertises putting a `Toggle` or a\n `Button` in them, and through 0.3.0 activating that control fired the nested\n handler *and* the row's `onClick` — so toggling a switch also navigated. */}\n {footer && (\n // These two wrappers are propagation barriers, not controls — they add no\n // behaviour of their own and must not be focusable or take a role.\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <div onClick={stopIfInteractive} onKeyDown={stopIfInteractive}>\n {footer}\n </div>\n )}\n </div>\n {trailing && (\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <div\n className=\"ml-3 flex shrink-0 items-center self-center\"\n onClick={stopIfInteractive}\n onKeyDown={stopIfInteractive}\n >\n {trailing}\n </div>\n )}\n </>\n );\n\n if (asChild) {\n return (\n <Slot\n {...rootProps}\n aria-disabled={disabled || undefined}\n aria-label={ariaLabel}\n // A disabled link must refuse the press, as Button's does: preventing it also stops a\n // router `<Link>`, and leaving the tab order matches a disabled `<button>`.\n tabIndex={disabled ? -1 : undefined}\n onClick={disabled ? refusePress : undefined}\n wrapChildren={() => body}\n >\n {children}\n </Slot>\n );\n }\n\n return (\n <Tag\n {...rootProps}\n onClick={clickable ? activate : undefined}\n // Unlike a <tr>, a div/li has no conflicting implicit role, so button is correct here.\n role={clickable ? 'button' : undefined}\n aria-pressed={clickable && selected !== undefined ? selected : undefined}\n aria-disabled={clickable && disabled ? true : undefined}\n // Without this the row's accessible name is the concatenation of everything inside\n // it — title, meta, description, footer and the label of any nested control.\n aria-label={clickable ? ariaLabel : undefined}\n tabIndex={clickable ? 0 : undefined}\n onKeyDown={\n clickable\n ? (e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n activate();\n }\n }\n : undefined\n }\n >\n {body}\n </Tag>\n );\n}\n\n/**\n * Keeps an interaction with a nested control from also triggering the row.\n *\n * Note the remaining limitation: a focusable descendant inside `role=\"button\"` is invalid\n * ARIA regardless of propagation, so a row that is *itself* clickable and *also* contains\n * controls is a compromise. Prefer either a clickable row with static content, or a static\n * row whose title is its own button.\n */\nfunction stopIfInteractive(event: { stopPropagation: () => void }) {\n event.stopPropagation();\n}\n\nfunction refusePress(event: MouseEvent) {\n event.preventDefault();\n event.stopPropagation();\n}\n","import clsx from 'clsx';\nimport type { ReactNode } from 'react';\nimport { DownloadIcon, Trash2Icon } from 'lucide-react';\nimport { IconButton } from '../forms/icon-button';\nimport { Tooltip } from '../overlays/tooltip';\n\nexport interface FileRowProps {\n name: string;\n /** Muted second line — size, upload date, uploader. */\n detail?: ReactNode;\n /** Leading chip showing the file extension, e.g. `\"PDF\"`. Ignored when `leading` is set. */\n fileType?: string;\n /** Custom leading node — overrides `fileType`. */\n leading?: ReactNode;\n /** The canonical action. Renders a download icon button. */\n onDownload?: () => void;\n /** Tooltip, and the start of the button's name (\"Download report.pdf\"). Default \"Download\". */\n downloadLabel?: string;\n /** Renders a remove icon button after download. New in 0.8.0. */\n onRemove?: () => void;\n /** Tooltip, and the start of the button's name (\"Remove report.pdf\"). Default \"Remove\". */\n removeLabel?: string;\n /** Anything else on the right, after the built-in actions — a `DropdownMenu`, review buttons. */\n actions?: ReactNode;\n className?: string;\n}\n\n/** The extension chip. Lifted unchanged from the deleted `DocumentRow`. */\nfunction FileTypeBadge({ type }: { type: string }) {\n return (\n <span className=\"flex size-[34px] shrink-0 items-center justify-center rounded-md bg-brand-tertiary text-body-tiny font-semibold text-brand\">\n {type}\n </span>\n );\n}\n\n/**\n * One attached file: name, optional detail line, and actions.\n *\n * This strip was hardcoded inline inside both `DocumentRow` and\n * `DocumentChecklistRow`. Nothing about it is document-specific — it is the same row\n * for a generated export, an invoice or an evidence attachment.\n *\n * Download and remove are same-size subtle icon buttons (24px, with a larger touch hit area),\n * the way upload and attachment lists do it (Ant Design's Upload list, Gmail, Drive). Through\n * 0.7.1 download was a bare text link and remove was whatever `Button` the caller passed, so\n * the two never matched. Each is named with the file (\"Download report.pdf\") so a list of files\n * does not read as a column of identical buttons, and shows its short label as a tooltip.\n */\nexport function FileRow({\n name,\n detail,\n fileType,\n leading,\n onDownload,\n downloadLabel = 'Download',\n onRemove,\n removeLabel = 'Remove',\n actions,\n className,\n}: FileRowProps) {\n const lead = leading ?? (fileType ? <FileTypeBadge type={fileType} /> : null);\n\n return (\n <div\n className={clsx(\n 'flex items-center gap-3 rounded-lg border border-default bg-default px-3 py-2.5',\n className,\n )}\n >\n {lead}\n <div className=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <span className=\"truncate text-body-sm font-medium text-default\">{name}</span>\n {detail && <span className=\"text-body-xs text-default-secondary\">{detail}</span>}\n </div>\n {(onDownload || onRemove || actions) && (\n <div className=\"flex shrink-0 items-center gap-1\">\n {onDownload && (\n <Tooltip title={downloadLabel}>\n <IconButton variant=\"subtle\" size=\"sm\" aria-label={`${downloadLabel} ${name}`} onClick={onDownload} className=\"touch-hit\">\n <DownloadIcon aria-hidden />\n </IconButton>\n </Tooltip>\n )}\n {onRemove && (\n <Tooltip title={removeLabel}>\n <IconButton variant=\"subtle\" size=\"sm\" aria-label={`${removeLabel} ${name}`} onClick={onRemove} className=\"touch-hit\">\n <Trash2Icon aria-hidden />\n </IconButton>\n </Tooltip>\n )}\n {actions && <div className=\"ml-2 flex items-center gap-2\">{actions}</div>}\n </div>\n )}\n </div>\n );\n}\n","import clsx from 'clsx';\nimport type { ReactNode } from 'react';\n\nexport type ScoredRowAlign = 'center' | 'end';\n/** 8 / 12 / 20 / 48px — the four gaps the source mockups actually used. */\nexport type ScoredRowGap = 'sm' | 'md' | 'lg' | 'xl';\n\nconst GAP: Record<ScoredRowGap, string> = {\n sm: 'gap-2',\n md: 'gap-3',\n lg: 'gap-5',\n xl: 'gap-12',\n};\n\nconst ALIGN: Record<ScoredRowAlign, string> = {\n center: 'items-center',\n end: 'items-end',\n};\n\nexport interface ScoredRowProps {\n /** Leading visual — an `EntityIconBadge`, an `Avatar`, a rank number, or nothing. */\n leading?: ReactNode;\n title: ReactNode;\n subtitle?: ReactNode;\n /** Fixed-width column between the title block and the meter. */\n aside?: ReactNode;\n /** The bar. Put a `<ProgressBar>` here — the row does not choose one for you. */\n meter?: ReactNode;\n /** Right-hand value — a `<ScoreValue>`, a `<TrendLabel>`, a `<Badge>`, a button. */\n trailing?: ReactNode;\n /** CSS width values. Omit one and that slot flexes instead. */\n titleWidth?: string;\n asideWidth?: string;\n meterWidth?: string;\n trailingWidth?: string;\n gap?: ScoredRowGap;\n /** Gap between `leading` and the title block. Defaults to `gap`. */\n leadingGap?: ScoredRowGap;\n align?: ScoredRowAlign;\n className?: string;\n}\n\n/**\n * A row with a title block, an optional bar and a right-hand value.\n *\n * Was `EntityRow`. The rename is the smaller half of the change: the old component\n * hardcoded `RiskScore`, `WidgetProgressBar`, `TrendLabel` and `getRiskTone`, which\n * locked it to one scoring domain and forced 32 props — including four raw\n * `CSSProperties` escape hatches and a magic `nameWidth = '133px'` — to make it fit\n * anything else. The score and the bar are now slots, so the caller decides.\n */\nexport function ScoredRow({\n leading,\n title,\n subtitle,\n aside,\n meter,\n trailing,\n titleWidth,\n asideWidth,\n meterWidth,\n trailingWidth,\n gap = 'md',\n leadingGap,\n align = 'center',\n className,\n}: ScoredRowProps) {\n return (\n <div className={clsx('flex w-full', ALIGN[align], GAP[gap], className)}>\n <div\n className={clsx(\n 'flex min-w-0',\n ALIGN[align],\n GAP[leadingGap ?? gap],\n titleWidth ? 'shrink-0' : 'flex-1',\n )}\n style={titleWidth ? { width: titleWidth } : undefined}\n >\n {leading}\n <div className=\"min-w-0 flex-1\">\n <p className=\"truncate text-body-sm font-medium leading-none text-default\">{title}</p>\n {subtitle && <p className=\"mt-0.5 truncate text-body-xs text-default-secondary\">{subtitle}</p>}\n </div>\n </div>\n\n {aside && (\n <div\n className={clsx('min-w-0', asideWidth ? 'shrink-0' : 'flex-1')}\n style={asideWidth ? { width: asideWidth } : undefined}\n >\n {aside}\n </div>\n )}\n\n {meter && (\n <div\n className={clsx('min-w-0', meterWidth ? 'shrink-0' : 'flex-1')}\n style={meterWidth ? { width: meterWidth } : undefined}\n >\n {meter}\n </div>\n )}\n\n {trailing && (\n <div className=\"shrink-0 text-right\" style={trailingWidth ? { width: trailingWidth } : undefined}>\n {trailing}\n </div>\n )}\n </div>\n );\n}\n","import clsx from 'clsx';\nimport { ProgressBar } from '../feedback/progress-bar';\nimport type { ProgressBarTone } from '../feedback/progress-bar';\nimport { ScoreValue, getScoreTone } from '../stats/score-value';\nimport type { ScoreDirection, ScoreValueSize, ScoreValueWeight } from '../stats/score-value';\n\nexport interface NumberedListItem {\n title: string;\n /** Second line under the title — a region, a category, an id. */\n subtitle?: string;\n score: number;\n /** Bar and value colour for this row. `auto` derives it from `score`. */\n tone?: ProgressBarTone | 'auto';\n}\n\nexport type NumberedListGap = 'sm' | 'md';\n\nexport interface NumberedListProps {\n items: NumberedListItem[];\n /** Which end of the scale is bad, for rows resolving `tone` automatically. */\n direction?: ScoreDirection;\n scoreSize?: ScoreValueSize;\n scoreWeight?: ScoreValueWeight;\n /** First ordinal. Set it to continue a list across a page boundary. */\n startAt?: number;\n gap?: NumberedListGap;\n className?: string;\n}\n\nconst GAP: Record<NumberedListGap, string> = {\n sm: 'gap-2',\n md: 'gap-3',\n};\n\n/**\n * A ranked leaderboard: ordinal, title, score, and a full-width bar under each row.\n *\n * Was `RankedRow`, which was one row and made the caller supply both the `<ol>` and every\n * `rank` by hand — so a filtered or re-sorted list silently kept stale numbers. Owning the\n * list means the ordinal is derived from position and cannot disagree with the order on\n * screen. It also puts it at the same granularity as `StepsList`, its neighbour.\n *\n * It still hardcodes `ProgressBar` and `ScoreValue`, and that is the point: a leaderboard\n * row *is* those three things. Where the pieces need to vary, reach for `ScoredRow`, whose\n * slots take arbitrary content.\n */\nexport function NumberedList({\n items,\n direction = 'higher-is-worse',\n scoreSize = 'md',\n scoreWeight = 'bold',\n startAt = 1,\n gap = 'md',\n className,\n}: NumberedListProps) {\n return (\n <ol className={clsx('flex list-none flex-col p-0', GAP[gap], className)}>\n {items.map((item, index) => {\n const tone =\n !item.tone || item.tone === 'auto'\n ? getScoreTone(item.score, { direction })\n : item.tone;\n\n return (\n <li key={`${item.title}-${index}`} className=\"flex w-full shrink-0 flex-col gap-1.5\">\n <div className=\"flex w-full items-center justify-between\">\n <div className=\"flex min-w-0 items-center gap-2.5\">\n {/* Fixed width so the titles align whether the ordinal is 1 or 10. */}\n <span className=\"w-[14px] shrink-0 text-body-xs font-bold text-default-secondary\">\n {startAt + index}\n </span>\n <div className=\"flex min-w-0 flex-col gap-px\">\n <span className=\"truncate text-body-sm font-medium leading-none text-default\">\n {item.title}\n </span>\n {item.subtitle && (\n <span className=\"text-body-tiny text-default-tertiary\">{item.subtitle}</span>\n )}\n </div>\n </div>\n <ScoreValue\n value={item.score}\n size={scoreSize}\n weight={scoreWeight}\n tone={tone}\n className=\"ml-2 shrink-0\"\n />\n </div>\n <ProgressBar value={item.score} tone={tone} aria-label={`${item.title} score`} />\n </li>\n );\n })}\n </ol>\n );\n}\n","import clsx from 'clsx';\nimport type { ReactNode } from 'react';\n\nexport interface IconTextRowProps {\n icon: ReactNode;\n title: string;\n detail: string;\n className?: string;\n}\n\n/**\n * A circular icon badge, a title, and one line of detail.\n *\n * Feature lists, empty-state explanations, onboarding intros, \"what happens next\"\n * steps. Was `FeatureRow`, which named it after the one screen it was extracted from.\n */\nexport function IconTextRow({ icon, title, detail, className }: IconTextRowProps) {\n return (\n <div className={clsx('flex items-start gap-3', className)}>\n <span className=\"flex size-9 shrink-0 items-center justify-center rounded-full bg-brand-tertiary text-brand\">\n {icon}\n </span>\n <div className=\"min-w-0\">\n <p className=\"text-body-sm font-semibold text-default\">{title}</p>\n <p className=\"mt-0.5 text-body-xs text-default-secondary\">{detail}</p>\n </div>\n </div>\n );\n}\n","import clsx from 'clsx';\nimport { CheckIcon } from 'lucide-react';\n\nexport type ChecklistRowState = 'done' | 'active' | 'pending';\n\nexport interface ChecklistRowProps {\n label: string;\n state: ChecklistRowState;\n className?: string;\n}\n\n/**\n * One step in a progress checklist: a done tick, a spinning active ring, or an empty\n * pending ring.\n *\n * Shared by the event-onboarding \"building your dashboard\" screen and the\n * intelligence page's processing checklist. Both drove the same three states; only\n * the onboarding copy had the animated ring, which is the better treatment and is\n * adopted for both.\n *\n * Renders an `<li>` — callers must wrap it in a list, which is what both sources did.\n */\nexport function ChecklistRow({ label, state, className }: ChecklistRowProps) {\n return (\n <li data-state={state} className={clsx('flex items-center gap-3', className)}>\n <span className=\"flex size-5 shrink-0 items-center justify-center\">\n {state === 'done' ? (\n <CheckIcon className=\"size-4 text-positive\" strokeWidth={2.5} aria-hidden />\n ) : (\n <span\n className={clsx(\n 'size-3.5 rounded-full border-2',\n state === 'active'\n ? 'motion-safe:animate-pulse border-brand-emphasis border-t-transparent'\n : 'border-disabled',\n )}\n />\n )}\n </span>\n <span\n className={clsx(\n 'text-body-sm',\n state === 'pending' ? 'text-default-tertiary' : 'font-semibold text-default',\n )}\n >\n {label}\n </span>\n </li>\n );\n}\n","import clsx from 'clsx';\nimport type { ReactNode } from 'react';\n\nexport interface StepsListProps {\n steps: ReactNode[];\n className?: string;\n}\n\n/**\n * Ordered list of instructions with small filled number bullets.\n *\n * Was `NumberedStepsList`. Renamed in 0.5.0 because `NumberedList` — the ranked\n * leaderboard — also numbers its rows, and two components whose names both led with\n * \"Numbered\" gave no hint which was which. The distinction is what the numbers *mean*:\n * here they are sequence (\"do this, then this\"), there they are rank.\n *\n * The bullet was `bg-[#e7edfb] text-[#1d4ed8]` — a pale blue pair that is not in the\n * token set. It now uses the brand-tertiary background and brand text, which is the\n * documented treatment for a subtle brand-tinted chip.\n */\nexport function StepsList({ steps, className }: StepsListProps) {\n return (\n <ol className={clsx('flex flex-col gap-1.5', className)}>\n {steps.map((step, i) => (\n // `text-[12px]` was off the type scale; 12 sits midway between Scale 01 (11) and\n // Scale 02 (13), so it rounds up to 13 like every other snap in this pass.\n <li key={i} className=\"flex items-start gap-2 text-body-xs text-default\">\n <span className=\"mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-full bg-brand-tertiary text-[9px] font-bold text-brand\">\n {i + 1}\n </span>\n {step}\n </li>\n ))}\n </ol>\n );\n}\n","import clsx from 'clsx';\nimport type { ReactNode } from 'react';\n\nexport type DetailItemLayout = 'stacked' | 'inline';\nexport type DetailItemSpan = 1 | 2 | 'full';\n\nexport interface DetailItemProps {\n label: string;\n value: ReactNode;\n /** Optional second line under the value. */\n detail?: ReactNode;\n /**\n * `stacked` puts the label above the value (detail pages, review summaries).\n * `inline` puts a fixed-width label beside it (drawer detail rows).\n */\n layout?: DetailItemLayout;\n /**\n * Columns to occupy inside a `DetailGrid`. `full` spans the row — for a long value\n * such as an alias list or a legal name that would otherwise truncate.\n */\n span?: DetailItemSpan;\n /**\n * Label column width for the `inline` layout. A `min-w`/`max-w` pair rather than a\n * fixed `w-`, so a long label wraps instead of colliding with the value.\n */\n labelWidth?: string;\n className?: string;\n}\n\nconst SPAN: Record<DetailItemSpan, string> = {\n 1: '',\n 2: 'sm:col-span-2',\n full: 'col-span-full',\n};\n\n/**\n * A label/value pair.\n *\n * Was `MetaField` — an internal codename that said nothing about the shape. Consolidates\n * the same pair from six places: an entity-detail overview grid, a reviewer-detail metric\n * column, three `DetailRow` copies in drawers, and `ReviewMeta` in two onboarding wizards.\n *\n * An empty value renders an em dash, which is what every source copy did by hand. Note\n * that the check is for `null`/`undefined`/`''` only — `0` and `false` are real values and\n * render as themselves.\n */\nexport function DetailItem({\n label,\n value,\n detail,\n layout = 'stacked',\n span = 1,\n labelWidth = 'min-w-[96px] max-w-[140px]',\n className,\n}: DetailItemProps) {\n const shown = value === null || value === undefined || value === '' ? '—' : value;\n\n if (layout === 'inline') {\n return (\n <div className={clsx('flex gap-3 text-body-xs', SPAN[span], className)}>\n <span className={clsx('shrink-0 text-default-secondary', labelWidth)}>{label}</span>\n {/* `detail` used to be dropped silently in this branch. */}\n {/* `overflow-wrap:anywhere` on the values: detail rows hold URLs, IDs and email\n addresses with no break opportunity, which otherwise overflow the row. */}\n <span className=\"flex min-w-0 flex-1 flex-col gap-0.5 [overflow-wrap:anywhere]\">\n <span className=\"text-default\">{shown}</span>\n {detail && <span className=\"text-default-secondary\">{detail}</span>}\n </span>\n </div>\n );\n }\n\n return (\n <div className={clsx('flex min-w-0 flex-col gap-0.5', SPAN[span], className)}>\n <p className=\"text-body-tiny font-medium text-default-secondary\">{label}</p>\n <p className=\"text-body-sm font-medium text-default [overflow-wrap:anywhere]\">{shown}</p>\n {detail && <p className=\"text-body-xs text-default-secondary [overflow-wrap:anywhere]\">{detail}</p>}\n </div>\n );\n}\n\nexport type DetailGridColumns = 2 | 3 | 4 | 'auto';\n\nexport interface DetailGridProps {\n children: ReactNode;\n columns?: DetailGridColumns;\n className?: string;\n}\n\nconst COLUMNS: Record<DetailGridColumns, string> = {\n // Fills the row whatever its width, and reflows to fewer columns as it narrows.\n auto: 'grid-cols-[repeat(auto-fit,minmax(180px,1fr))]',\n 2: 'grid-cols-1 sm:grid-cols-2',\n 3: 'grid-cols-1 sm:grid-cols-2 lg:grid-cols-3',\n 4: 'grid-cols-2 sm:grid-cols-3 lg:grid-cols-4',\n};\n\n/**\n * Wrapper for a set of `DetailItem`s.\n *\n * A real grid, not the `flex flex-wrap` it was as `MetaFieldGrid`. Under flex-wrap every\n * item had to carry its own width (`sm:w-[262px]` was the documented idiom) and whatever\n * space was left over at the end of a row stayed empty — so a three-item row in a wide\n * card had a ragged gap on the right. `1fr` tracks divide the row exactly, and an item\n * that genuinely needs more room asks for it with `span` instead of a magic width.\n */\nexport function DetailGrid({ children, columns = 'auto', className }: DetailGridProps) {\n return (\n <div className={clsx('grid gap-x-4 gap-y-4', COLUMNS[columns], className)}>{children}</div>\n );\n}\n","import { useEffect, useState, type ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { CheckIcon, CopyIcon } from 'lucide-react';\nimport { cn } from '../../lib/cn';\nimport { IconButton } from '../forms/icon-button';\n\n/**\n * Label/value rows for a detail page, as a real `<dl>`. New in 0.7.0, from SCIC.\n *\n * Use it for a profile or account summary read top to bottom. `DetailGrid` / `DetailItem`\n * are for a multi-column summary card. The rows here are width-aware without a breakpoint: the\n * label has a fixed basis and the value a minimum one, and the row wraps, so in a narrow panel\n * (a one-third column, a 320px phone, 200% zoom) the value drops below its label instead of\n * being squeezed into a sliver beside it.\n */\nexport interface DescriptionListProps {\n children: ReactNode;\n className?: string;\n}\n\nexport function DescriptionList({ children, className }: DescriptionListProps) {\n return <dl className={cn('flex flex-col gap-3', className)}>{children}</dl>;\n}\n\nexport interface DescriptionItemProps {\n label: string;\n /** An empty value renders an em dash. */\n value: ReactNode;\n /**\n * Adds a copy-to-clipboard button. Pass the plain string to copy: emails and ids are long,\n * unbroken and commonly pasted elsewhere.\n */\n copyValue?: string;\n className?: string;\n}\n\nexport function DescriptionItem({ label, value, copyValue, className }: DescriptionItemProps) {\n const shown = value === null || value === undefined || value === '' ? '—' : value;\n return (\n <div className={cn('flex flex-wrap items-start gap-x-4 gap-y-0.5 text-body-xs', className)}>\n <dt className=\"shrink-0 grow-0 basis-28 text-default-secondary\">{label}</dt>\n {/* `min-w-0` lets the value shrink below its content; `overflow-wrap:anywhere` lets an\n unbroken token (an email, a URL, an id) break rather than overflow. */}\n <dd className=\"flex min-w-0 flex-[1_1_10rem] items-start gap-1.5 text-default\">\n <span className=\"min-w-0 [overflow-wrap:anywhere]\">{shown}</span>\n {copyValue && <CopyButton value={copyValue} label={`Copy ${label.toLowerCase()}`} />}\n </dd>\n </div>\n );\n}\n\nexport interface CopyButtonProps {\n /** The text to copy. */\n value: string;\n /** The button's accessible name, e.g. \"Copy email\". */\n label: string;\n /** Announced after a copy. Default \"Copied\". */\n copiedLabel?: string;\n className?: string;\n}\n\n/**\n * An icon button that copies `value` to the clipboard, shows a tick for two seconds, and\n * announces the copy in a polite live region. Exported for ids and codes outside a\n * `DescriptionList`.\n */\nexport function CopyButton({ value, label, copiedLabel = 'Copied', className }: CopyButtonProps) {\n const [copied, setCopied] = useState(false);\n\n useEffect(() => {\n if (!copied) return;\n const timer = window.setTimeout(() => setCopied(false), 2000);\n return () => window.clearTimeout(timer);\n }, [copied]);\n\n return (\n // relative: keeps the sr-only status (absolutely positioned) inside a scrolling container.\n <span className=\"relative inline-flex\">\n <IconButton\n variant=\"subtle\"\n size=\"sm\"\n aria-label={label}\n data-state={copied ? 'copied' : undefined}\n className={cn('-my-0.5 touch-hit', className)}\n onClick={() => {\n void navigator.clipboard?.writeText(value).then(\n () => setCopied(true),\n () => undefined,\n );\n }}\n >\n {copied ? <CheckIcon aria-hidden /> : <CopyIcon aria-hidden />}\n </IconButton>\n <span role=\"status\" className=\"sr-only\">\n {copied ? copiedLabel : ''}\n </span>\n </span>\n );\n}\n\n/**\n * A one-line email that truncates the local part and keeps the domain:\n * `alexandra.konstan…@example.com`. The full address stays in the DOM (screen readers and copy\n * get all of it) and in `title`. Pair it with `copyValue`, so touch users, who cannot hover, can\n * still get the address.\n *\n * An email never wraps. It ellipsises through explicit overflow classes rather than the\n * `truncate` utility, because containers that un-truncate for touch target `.truncate`.\n * `DataTable`'s card layout does that, and through 0.9.0 it broke an address mid-word\n * (\"alex.reviewer@example.tes / t\").\n */\nexport function EmailText({ email, className }: { email: string; className?: string }) {\n const at = email.lastIndexOf('@');\n const local = at > 0 ? email.slice(0, at) : email;\n const domain = at > 0 ? email.slice(at) : '';\n return (\n <span title={email} data-slot=\"email-text\" className={clsx('flex min-w-0 max-w-full', className)}>\n <span className=\"min-w-0 overflow-hidden text-ellipsis whitespace-nowrap\">{local}</span>\n {/* Near-zero shrink: the local part gives up its width first. */}\n {domain && (\n <span className=\"min-w-0 overflow-hidden text-ellipsis whitespace-nowrap [flex-shrink:0.001]\">{domain}</span>\n )}\n </span>\n );\n}\n","import clsx from 'clsx';\nimport type { ReactNode } from 'react';\nimport { CheckIcon } from 'lucide-react';\n\nexport type CheckedGroupListColumns = 1 | 2 | 3;\n\n/** One labelled group of ticked items. */\nexport interface CheckedGroup {\n label: string;\n items: string[];\n}\n\nexport interface CheckedGroupListProps {\n groups: CheckedGroup[];\n columns?: CheckedGroupListColumns;\n /** Leading glyph for every item. Defaults to a check; pass `null` for none. */\n icon?: ReactNode | null;\n emptyLabel?: string;\n className?: string;\n}\n\nconst COLUMNS: Record<CheckedGroupListColumns, string> = {\n 1: 'columns-1',\n 2: 'columns-2',\n 3: 'columns-3',\n};\n\n/**\n * A read-only, grouped list of ticked items in a balanced multi-column flow.\n *\n * Was `PermissionGrid` — RBAC-specific naming for a generic shape, and not a grid\n * either: groups pack tightly down each column rather than aligning to shared row\n * heights, so a tall group beside a short one leaves no ragged gap.\n * `break-inside-avoid` keeps each group whole within a column.\n *\n * Granted permissions, included plan features, completed requirements, matched\n * criteria — anything that is \"these labels, grouped, all ticked\".\n */\nexport function CheckedGroupList({\n groups,\n columns = 2,\n icon,\n emptyLabel = 'None.',\n className,\n}: CheckedGroupListProps) {\n if (groups.length === 0) {\n return <p className={clsx('text-body-xs text-default-secondary', className)}>{emptyLabel}</p>;\n }\n\n // `undefined` means \"not passed\" → default check. `null` means \"explicitly none\".\n const glyph = icon === undefined ? <CheckIcon className=\"size-3.5\" strokeWidth={2.5} aria-hidden /> : icon;\n\n return (\n <div className={clsx(COLUMNS[columns], 'gap-x-6', className)}>\n {groups.map((group) => (\n <div key={group.label} className=\"mb-5 break-inside-avoid last:mb-0\">\n <p className=\"mb-2 text-body-tiny font-semibold uppercase tracking-wide text-default-secondary\">\n {group.label}\n </p>\n <ul className=\"space-y-1.5\">\n {group.items.map((item) => (\n <li key={item} className=\"flex items-center gap-2 text-body-xs text-default\">\n {glyph && <span className=\"shrink-0\">{glyph}</span>}\n {item}\n </li>\n ))}\n </ul>\n </div>\n ))}\n </div>\n );\n}\n","import { useMemo, useRef, useState, type KeyboardEvent, type ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { ChevronRightIcon } from 'lucide-react';\n\nimport { useControllableState } from '../../lib/use-controllable-state';\n\nexport type TreeViewSize = 'sm' | 'md';\n\nexport interface TreeItemState {\n /** 1 for a root item. */\n level: number;\n hasChildren: boolean;\n expanded: boolean;\n selected: boolean;\n}\n\nexport interface TreeViewProps<T> {\n /** Root items. */\n items: readonly T[];\n getId: (item: T) => string;\n /** Children of an item. Omit (or return nothing) for a flat list. */\n getChildren?: (item: T) => readonly T[] | undefined;\n /**\n * The row content — a slot rather than props, so the caller decides what a node shows\n * (an avatar, a code, a status badge). The chevron, indentation and selection highlight\n * are drawn by the tree.\n */\n renderItem: (item: T, state: TreeItemState) => ReactNode;\n /** Accessible name of the tree. */\n label: string;\n /** Ids of expanded items. Controlled. */\n expanded?: string[];\n defaultExpanded?: string[];\n onExpandedChange?: (expanded: string[]) => void;\n /** Id of the selected item. Controlled. */\n selected?: string | null;\n defaultSelected?: string | null;\n /** Fired on click, Enter or Space. */\n onSelect?: (id: string, item: T) => void;\n size?: TreeViewSize;\n className?: string;\n}\n\ninterface FlatNode<T> {\n id: string;\n item: T;\n level: number;\n parentId: string | null;\n hasChildren: boolean;\n expanded: boolean;\n}\n\nconst ROW: Record<TreeViewSize, string> = {\n sm: 'min-h-8 py-1 text-body-xs',\n md: 'min-h-10 py-2 text-body-sm',\n};\n\n/** Indentation per level, in px. Data-driven, so it is an inline style rather than a class. */\nconst INDENT = 18;\n\n/**\n * An expandable tree — the ARIA tree pattern, with one tab stop.\n *\n * Focus is a roving tabindex over the *visible* rows, kept here rather than in\n * `useRovingFocus` because a tree gives Left and Right their own meaning: Right expands a\n * closed node or steps into an open one, Left collapses an open node or steps out to its\n * parent. Selection is separate from focus — arrowing does not select — so browsing a\n * controlled tree fires no `onSelect`.\n *\n * Children render inside a real `role=\"group\"`, which is what lets a screen reader announce\n * level and position without `aria-level` being guessed from indentation.\n */\nexport function TreeView<T>({\n items,\n getId,\n getChildren,\n renderItem,\n label,\n expanded: expandedProp,\n defaultExpanded = [],\n onExpandedChange,\n selected: selectedProp,\n defaultSelected = null,\n onSelect,\n size = 'md',\n className,\n}: TreeViewProps<T>) {\n const [expanded, setExpanded] = useControllableState<string[]>({\n value: expandedProp,\n defaultValue: defaultExpanded,\n onChange: onExpandedChange,\n });\n const [selected, setSelected] = useControllableState<string | null>({\n value: selectedProp,\n defaultValue: defaultSelected,\n });\n const [focusedId, setFocusedId] = useState<string | null>(null);\n const rowRefs = useRef(new Map<string, HTMLElement>());\n\n const expandedSet = useMemo(() => new Set(expanded), [expanded]);\n\n // Visible rows in document order — what the arrow keys walk.\n const visible = useMemo(() => {\n const out: FlatNode<T>[] = [];\n const walk = (nodes: readonly T[], level: number, parentId: string | null) => {\n for (const item of nodes) {\n const id = getId(item);\n const children = getChildren?.(item) ?? [];\n const isOpen = children.length > 0 && expandedSet.has(id);\n out.push({ id, item, level, parentId, hasChildren: children.length > 0, expanded: isOpen });\n if (isOpen) walk(children, level + 1, id);\n }\n };\n walk(items, 1, null);\n return out;\n }, [items, getId, getChildren, expandedSet]);\n\n // The single tab stop: the focused row if still visible, else the selection, else the first.\n const tabStop =\n visible.find((n) => n.id === focusedId)?.id ??\n visible.find((n) => n.id === selected)?.id ??\n visible[0]?.id;\n\n const focus = (id: string | undefined) => {\n if (!id) return;\n setFocusedId(id);\n rowRefs.current.get(id)?.focus();\n };\n\n const toggle = (id: string, open: boolean) => {\n setExpanded((prev) => (open ? [...prev.filter((x) => x !== id), id] : prev.filter((x) => x !== id)));\n };\n\n const choose = (node: FlatNode<T>) => {\n setSelected(node.id);\n onSelect?.(node.id, node.item);\n };\n\n const onKeyDown = (event: KeyboardEvent, node: FlatNode<T>) => {\n const index = visible.findIndex((n) => n.id === node.id);\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n focus(visible[index + 1]?.id);\n break;\n case 'ArrowUp':\n event.preventDefault();\n focus(visible[index - 1]?.id);\n break;\n case 'ArrowRight':\n event.preventDefault();\n if (node.hasChildren && !node.expanded) toggle(node.id, true);\n else if (node.expanded) focus(visible[index + 1]?.id);\n break;\n case 'ArrowLeft':\n event.preventDefault();\n if (node.expanded) toggle(node.id, false);\n else if (node.parentId) focus(node.parentId);\n break;\n case 'Home':\n event.preventDefault();\n focus(visible[0]?.id);\n break;\n case 'End':\n event.preventDefault();\n focus(visible[visible.length - 1]?.id);\n break;\n case 'Enter':\n case ' ':\n event.preventDefault();\n choose(node);\n break;\n default:\n break;\n }\n };\n\n const renderLevel = (nodes: readonly T[], level: number): ReactNode =>\n nodes.map((item, i) => {\n const id = getId(item);\n const node = visible.find((n) => n.id === id);\n // Not visible means an ancestor is collapsed — but then this level is not rendered at all.\n if (!node) return null;\n const children = getChildren?.(item) ?? [];\n const isSelected = selected === id;\n\n return (\n <li\n key={id}\n role=\"treeitem\"\n aria-level={level}\n aria-setsize={nodes.length}\n aria-posinset={i + 1}\n aria-expanded={node.hasChildren ? node.expanded : undefined}\n aria-selected={isSelected}\n tabIndex={tabStop === id ? 0 : -1}\n ref={(el) => {\n if (el) rowRefs.current.set(id, el);\n else rowRefs.current.delete(id);\n }}\n onFocus={(event) => {\n // Only the row itself — focus bubbling up from a nested row must not steal it.\n if (event.target === event.currentTarget) setFocusedId(id);\n }}\n onKeyDown={(event) => {\n if (event.target === event.currentTarget) onKeyDown(event, node);\n }}\n className=\"outline-none [&:focus-visible>div]:ring-2 [&:focus-visible>div]:ring-inset [&:focus-visible>div]:ring-brand\"\n >\n {/* The row is a click target, but the keyboard contract lives on the treeitem above,\n which owns focus — the same split Combobox makes with its options. */}\n {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */}\n <div\n onClick={() => {\n focus(id);\n choose(node);\n }}\n style={{ paddingLeft: 8 + (level - 1) * INDENT }}\n className={clsx(\n 'flex w-full cursor-pointer items-center gap-1.5 rounded-md pr-2 transition-colors',\n ROW[size],\n isSelected ? 'bg-brand-secondary text-default' : 'text-default hover:bg-default-secondary',\n )}\n >\n {node.hasChildren ? (\n // Not a button: the treeitem is the one tab stop, and Left/Right already toggle.\n // A pointer user still needs a target that toggles without selecting.\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions\n <span\n aria-hidden\n data-tree-toggle=\"\"\n onClick={(event) => {\n event.stopPropagation();\n toggle(id, !node.expanded);\n focus(id);\n }}\n className=\"flex size-5 shrink-0 items-center justify-center rounded text-icon-default-secondary hover:bg-default-tertiary\"\n >\n <ChevronRightIcon className={clsx('size-3.5 transition-transform motion-reduce:transition-none', node.expanded && 'rotate-90')} />\n </span>\n ) : (\n <span aria-hidden className=\"size-5 shrink-0\" />\n )}\n <div className=\"min-w-0 flex-1\">\n {renderItem(item, {\n level,\n hasChildren: node.hasChildren,\n expanded: node.expanded,\n selected: isSelected,\n })}\n </div>\n </div>\n {node.expanded && (\n <ul role=\"group\" className=\"m-0 list-none p-0\">\n {renderLevel(children, level + 1)}\n </ul>\n )}\n </li>\n );\n });\n\n return (\n <ul role=\"tree\" aria-label={label} className={clsx('m-0 flex list-none flex-col p-0', className)}>\n {renderLevel(items, 1)}\n </ul>\n );\n}\n","export { Button } from './components/forms/button';\nexport type { ButtonProps, ButtonVariant, ButtonSize } from './components/forms/button';\n\nexport { IconButton } from './components/forms/icon-button';\nexport type { IconButtonProps, IconButtonVariant } from './components/forms/icon-button';\n\nexport { ButtonGroup } from './components/forms/button-group';\nexport type { ButtonGroupProps, ButtonGroupItem, ButtonGroupVariant, ButtonGroupAlign } from './components/forms/button-group';\n\nexport { Avatar } from './components/avatar/avatar';\nexport type { AvatarProps, AvatarInitialProps, AvatarImageProps, AvatarSize, AvatarShape } from './components/avatar/avatar';\n\nexport { AvatarGroup } from './components/avatar/avatar-group';\nexport type { AvatarGroupProps, AvatarGroupSpacing } from './components/avatar/avatar-group';\n\nexport { AvatarBlock } from './components/avatar/avatar-block';\nexport type { AvatarBlockProps } from './components/avatar/avatar-block';\n\n\n// ── Field ──────────────────────────────────────────────────────────────────────\n// The label / description / error / control wiring. From 0.10.0 the only place a field's text\n// lives: the controls are bare, and a form (or `Form`) composes them inside a Field.\n\nexport {\n Field,\n FieldLabel,\n FieldDescription,\n FieldError,\n FieldHint,\n FieldGroup,\n FieldSet,\n FieldLegend,\n FieldSeparator,\n useFieldContext,\n useFieldControl,\n} from './components/forms/field';\nexport type {\n FieldProps,\n FieldLabelProps,\n FieldTextProps,\n FieldGroupProps,\n FieldSetProps,\n FieldLegendProps,\n FieldSeparatorProps,\n FieldOrientation,\n FieldContextValue,\n FieldPart,\n} from './components/forms/field';\n\nexport { Input, InputControl } from './components/forms/input';\nexport type { InputProps, InputControlProps, InputSize } from './components/forms/input';\n\n// Supplies a default `size` to the form controls beneath it. `FilterBar` is the built-in\n// provider; export it so an app can set a density for a form section of its own.\nexport { ControlSizeProvider, useControlSize } from './components/forms/control-size';\nexport type { ControlSizeProviderProps } from './components/forms/control-size';\n\nexport { Textarea, TextareaControl } from './components/forms/textarea';\nexport type { TextareaProps, TextareaControlProps } from './components/forms/textarea';\n\nexport { Select, SelectControl } from './components/forms/select';\nexport type {\n SelectProps,\n SelectControlProps,\n SelectOption,\n SelectOptionGroup,\n} from './components/forms/select';\n\nexport { NativeSelect, NativeSelectControl } from './components/forms/native-select';\nexport type { NativeSelectProps, NativeSelectControlProps } from './components/forms/native-select';\n\nexport { DatePicker } from './components/forms/date-picker';\nexport type { DatePickerProps } from './components/forms/date-picker';\n\nexport { Stepper } from './components/forms/stepper';\nexport type { StepperProps, StepperSize, StepperAlign, StepperCompactInfo, StepItem, StepStatus } from './components/forms/stepper';\n\nexport { MultiSelectCard } from './components/forms/multiselect-card';\nexport type {\n MultiSelectCardProps,\n MultiSelectCardSize,\n} from './components/forms/multiselect-card';\n\n/**\n * On/off setting. Was named `Toggle` through 0.3.0 — see the CHANGELOG rename table. The\n * name `Toggle` now belongs to the pressed-state button, as it does in shadcn/ui.\n */\nexport { Switch } from './components/forms/switch';\nexport type { SwitchProps, SwitchSize } from './components/forms/switch';\n\n/** Pressed-state button, and a group of them. New in 0.4.0. */\nexport { Toggle, ToggleGroup, ToggleGroupItem } from './components/forms/toggle';\nexport type {\n ToggleProps,\n ToggleSize,\n ToggleVariant,\n ToggleGroupProps,\n ToggleGroupOption,\n ToggleGroupItemProps,\n ToggleGroupType,\n} from './components/forms/toggle';\n\nexport { InputOTP } from './components/forms/input-otp';\nexport type { InputOTPProps, InputOTPMode } from './components/forms/input-otp';\n\nexport { FileDropZone, useFilePicker, formatFileSize } from './components/forms/file-drop-zone';\nexport type { FileDropZoneProps, UseFilePicker, UseFilePickerOptions } from './components/forms/file-drop-zone';\n\n/** Multi-value text field: typed or pasted values become removable chips. New in 0.7.0. */\nexport { TagInput } from './components/forms/tag-input';\nexport type { TagInputProps, TagInputParseResult } from './components/forms/tag-input';\n\nexport { FormCard, FormCardHeader, FormCardFooter } from './components/forms/form-card';\nexport type { FormCardHeaderProps, FormCardFooterProps } from './components/forms/form-card';\n\n/**\n * A form described as data: fields, client-side validation (sync and async), pending and dirty\n * state, in a grid, stack or inline layout, submitted on Save or on change, optionally in steps.\n * New in 0.9.8 as DynamicForm, 0.10.0 as SchemaForm; `Form` from 0.10.1.\n */\nexport { Form } from './components/forms/form';\nexport type { FormProps, FormActionsApi } from './components/forms/form';\nexport { useDependentOptions } from './components/forms/use-dependent-options';\nexport type { DependentOptions } from './components/forms/use-dependent-options';\nexport type {\n FormValues,\n FormResult,\n FormErrors,\n FormState,\n FormLayout,\n FormSubmitOn,\n FormStep,\n FormField,\n FormFieldType,\n FormFieldBase,\n FormFieldContext,\n FormFieldSize,\n FormTextType,\n FormTextField,\n FormTextareaField,\n FormSelectField,\n FormComboboxField,\n FormCountryField,\n FormTimeZoneField,\n FormRadioField,\n FormSegmentedField,\n FormDateField,\n FormCheckField,\n FormListField,\n FormCustomField,\n} from './components/forms/form.types';\n/** The 0.10.0 names, deprecated. */\nexport { SchemaForm } from './components/forms/form-deprecated';\nexport type {\n SchemaFormProps,\n SchemaFormActionsApi,\n SchemaFormValues,\n SchemaFormResult,\n SchemaFormErrors,\n SchemaFormState,\n SchemaFormLayout,\n SchemaFormSubmitOn,\n SchemaFormStep,\n SchemaFormField,\n SchemaFormFieldType,\n SchemaFormFieldBase,\n SchemaFormFieldContext,\n SchemaFormFieldSize,\n SchemaFormTextType,\n SchemaFormTextField,\n SchemaFormTextareaField,\n SchemaFormSelectField,\n SchemaFormComboboxField,\n SchemaFormCountryField,\n SchemaFormTimeZoneField,\n SchemaFormRadioField,\n SchemaFormSegmentedField,\n SchemaFormDateField,\n SchemaFormCheckField,\n SchemaFormListField,\n SchemaFormCustomField,\n} from './components/forms/form-deprecated';\n\nexport { Badge, BADGE_COLORS } from './components/status/badge';\nexport type { BadgeProps, BadgeColor, BadgeSize, BadgeVariant } from './components/status/badge';\n\nexport { RoleBadge } from './components/status/role-badge';\nexport type { RoleBadgeProps, RoleBadgeTone } from './components/status/role-badge';\n\nexport { RoleComboBox, ROLE_COMBO_OPTIONS } from './components/forms/role-combo-box';\nexport type { RoleComboBoxProps, RoleOption } from './components/forms/role-combo-box';\n\n/** Single-select autocomplete. ARIA 1.2 combobox pattern. */\nexport { Combobox } from './components/forms/combobox';\nexport type { ComboboxProps, ComboboxOption } from './components/forms/combobox';\n\n/** Searchable country picker over Combobox. Value is an ISO 3166-1 alpha-2 code. */\nexport { CountrySelect, COUNTRY_CODES, countryOptions } from './components/forms/country-select';\nexport type { CountrySelectProps } from './components/forms/country-select';\n\n/** Searchable IANA time-zone picker over Combobox, labelled with the current UTC offset. */\nexport { TimeZoneSelect, timeZoneOptions, timeZoneOffset, currentZoneName } from './components/forms/time-zone-select';\nexport type { TimeZoneSelectProps } from './components/forms/time-zone-select';\n\n/** ⌘K command palette body. Compose with `Modal` for the usual overlay. */\nexport { Command } from './components/forms/command';\nexport type { CommandProps, CommandItem } from './components/forms/command';\n\n// ── Status & tags ──────────────────────────────────────────────────────────────\n\nexport { StatusBadge } from './components/status/status-badge';\nexport type { StatusBadgeProps, StatusTone, StatusBadgeSize } from './components/status/status-badge';\n\nexport { StatusDot } from './components/status/status-dot';\nexport type { StatusDotProps, StatusDotTone } from './components/status/status-dot';\n\nexport { StatusChip } from './components/status/status-chip';\nexport type { StatusChipProps } from './components/status/status-chip';\n\nexport { CountBadge } from './components/status/count-badge';\nexport type { CountBadgeProps } from './components/status/count-badge';\n\nexport { TagPill } from './components/status/tag-pill';\nexport type { TagPillProps, TagPillTone, TagPillSize } from './components/status/tag-pill';\n\nexport { TrailChip } from './components/status/trail-chip';\nexport type { TrailChipProps } from './components/status/trail-chip';\n\nexport { UserStatusPill } from './components/status/user-status-pill';\nexport type { UserStatusPillProps, UserAccountStatus } from './components/status/user-status-pill';\n\nexport { CheckIndicator } from './components/status/check-indicator';\nexport type { CheckIndicatorProps, CheckIndicatorStatus } from './components/status/check-indicator';\n\nexport { EntityIconBadge } from './components/status/entity-icon-badge';\nexport type { EntityIconBadgeProps, EntityIconBadgeSize, EntityIconBadgeTone } from './components/status/entity-icon-badge';\n\n// ── Selection ──────────────────────────────────────────────────────────────────\n\nexport { Checkbox } from './components/forms/checkbox';\nexport type { CheckboxProps, CheckboxSize } from './components/forms/checkbox';\n\nexport { RadioGroup, Radio } from './components/forms/radio-group';\n\n/** Choose one option shown as a card. The single-select sibling of MultiSelectCard. New in 0.7.0. */\nexport { RadioCards, RadioCardsItem } from './components/forms/radio-cards';\nexport type { RadioCardsProps, RadioCardsItemProps, RadioCardsSize } from './components/forms/radio-cards';\nexport type { ResponsiveChoiceCardSize, ChoiceCardBreakpoint } from './components/forms/choice-card-size';\n\n/** A fieldset of checkboxes sharing one value array. New in 0.7.0. */\nexport { CheckboxGroup, CheckboxGroupItem } from './components/forms/checkbox-group';\nexport type { CheckboxGroupProps, CheckboxGroupItemProps } from './components/forms/checkbox-group';\nexport type {\n RadioGroupProps,\n RadioGroupOption,\n RadioProps,\n RadioGroupOrientation,\n} from './components/forms/radio-group';\n\nexport { SegmentedControl } from './components/forms/segmented-control';\nexport type { SegmentedControlProps, SegmentedControlOption } from './components/forms/segmented-control';\n\nexport { Slider } from './components/forms/slider';\nexport type { SliderProps } from './components/forms/slider';\n\nexport { Label } from './components/forms/label';\nexport type { LabelProps } from './components/forms/label';\n\nexport { Calendar } from './components/forms/calendar';\nexport type { CalendarProps, CalendarMode, DateRange } from './components/forms/calendar';\n\nexport {\n InputGroup,\n InputGroupInput,\n InputGroupAddon,\n InputGroupText,\n SearchInput,\n} from './components/forms/input-group';\nexport type {\n InputGroupProps,\n InputGroupInputProps,\n InputGroupAddonProps,\n InputGroupTextProps,\n InputGroupAlign,\n SearchInputProps,\n} from './components/forms/input-group';\n\n// ── Overlays ───────────────────────────────────────────────────────────────────\n\nexport {\n Modal,\n ModalTrigger,\n ModalClose,\n ModalHeader,\n ModalTitle,\n ModalDescription,\n ModalBody,\n ModalFooter,\n} from './components/overlays/modal';\nexport type {\n ModalProps,\n ModalSize,\n ModalTone,\n ModalFooterAlign,\n ModalAlign,\n ModalHeaderProps,\n ModalTitleProps,\n ModalDescriptionProps,\n ModalBodyProps,\n ModalFooterProps,\n ModalTriggerProps,\n ModalCloseProps,\n} from './components/overlays/modal';\n\nexport { Tooltip } from './components/overlays/tooltip';\nexport type { TooltipProps } from './components/overlays/tooltip';\n\n/** Anchored panel for **interactive** content — unlike `Tooltip`, which cannot be entered. */\nexport {\n Popover,\n PopoverTrigger,\n PopoverContent,\n PopoverClose,\n PopoverAnchor,\n} from './components/overlays/popover';\nexport type {\n PopoverProps,\n PopoverTriggerProps,\n PopoverContentProps,\n} from './components/overlays/popover';\n\n/** Hover preview that can be entered. Supplementary by contract — hover has no touch equivalent. */\nexport { HoverCard } from './components/overlays/hover-card';\nexport type { HoverCardProps } from './components/overlays/hover-card';\n\nexport {\n ContextMenu,\n ContextMenuTrigger,\n ContextMenuContent,\n ContextMenuItems,\n ContextMenuItem,\n ContextMenuCheckboxItem,\n ContextMenuRadioGroup,\n ContextMenuRadioItem,\n ContextMenuGroup,\n ContextMenuLabel,\n ContextMenuSeparator,\n ContextMenuShortcut,\n ContextMenuSub,\n ContextMenuSubTrigger,\n ContextMenuSubContent,\n} from './components/overlays/context-menu';\nexport type {\n ContextMenuProps,\n ContextMenuTriggerProps,\n ContextMenuContentProps,\n} from './components/overlays/context-menu';\n\nexport {\n Menubar,\n MenubarMenu,\n MenubarTrigger,\n MenubarContent,\n MenubarItems,\n MenubarItem,\n MenubarCheckboxItem,\n MenubarRadioGroup,\n MenubarRadioItem,\n MenubarGroup,\n MenubarLabel,\n MenubarSeparator,\n MenubarShortcut,\n MenubarSub,\n MenubarSubTrigger,\n MenubarSubContent,\n} from './components/overlays/menubar';\nexport type {\n MenubarProps,\n MenubarMenuDef,\n MenubarMenuProps,\n MenubarTriggerProps,\n MenubarContentProps,\n} from './components/overlays/menubar';\n\nexport {\n Drawer,\n DrawerTrigger,\n DrawerClose,\n DrawerHeader,\n DrawerTitle,\n DrawerDescription,\n DrawerBody,\n DrawerFooter,\n} from './components/overlays/drawer';\nexport type {\n DrawerProps,\n DrawerSide,\n DrawerFooterAlign,\n DrawerTriggerProps,\n DrawerCloseProps,\n DrawerHeaderProps,\n DrawerTitleProps,\n DrawerDescriptionProps,\n DrawerBodyProps,\n DrawerFooterProps,\n} from './components/overlays/drawer';\n\nexport { ConfirmDialog } from './components/overlays/confirm-dialog';\nexport type { ConfirmDialogProps } from './components/overlays/confirm-dialog';\n\nexport { NoteConfirmModal } from './components/overlays/note-confirm-modal';\nexport type { NoteConfirmModalProps } from './components/overlays/note-confirm-modal';\n\nexport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItems,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuGroup,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubTrigger,\n DropdownMenuSubContent,\n} from './components/overlays/dropdown-menu';\nexport type {\n /** One menu entry as data, shared by DropdownMenu, ContextMenu and Menubar. New in 0.8.0. */\n MenuItemDef,\n DropdownMenuProps,\n DropdownMenuTriggerProps,\n DropdownMenuContentProps,\n DropdownMenuItemProps,\n DropdownMenuItemTone,\n DropdownMenuCheckboxItemProps,\n DropdownMenuRadioGroupProps,\n DropdownMenuRadioItemProps,\n DropdownMenuGroupProps,\n DropdownMenuLabelProps,\n DropdownMenuSeparatorProps,\n DropdownMenuShortcutProps,\n DropdownMenuSubProps,\n DropdownMenuSubTriggerProps,\n DropdownMenuSubContentProps,\n} from './components/overlays/dropdown-menu';\n\n/** The dimming layer behind a custom overlay. New in 0.7.0. */\nexport { Scrim } from './components/overlays/scrim';\nexport type { ScrimProps } from './components/overlays/scrim';\n\n/** A modal surface that fills the viewport: full screen, expand a widget. New in 0.7.0. */\nexport { FullscreenSurface } from './components/overlays/fullscreen-surface';\nexport type { FullscreenSurfaceProps, FullscreenStacking } from './components/overlays/fullscreen-surface';\n\nexport { Portal, PortalContainerProvider, usePortalContainer } from './components/overlays/portal';\nexport type { PortalProps } from './components/overlays/portal';\n\n// ── Utilities ──────────────────────────────────────────────────────────────────\n\n/** Esc-to-close, Tab focus trap and focus restore — for building your own overlays. */\nexport { OVERLAY_SCRIM, useOverlayDismiss } from './components/overlays/overlay';\n\n/** `clsx` + `tailwind-merge` — for compositions where your className must win. */\nexport { cn } from './lib/cn';\n\n/**\n * What makes `asChild` work: renders its props onto its single child. Exported from 0.7.0\n * so a composition of your own can offer the same `asChild` contract.\n */\nexport { Slot, composeRefs } from './lib/slot';\nexport type { SlotProps } from './lib/slot';\n\n/** The library's keyboard focus ring, for controls you build yourself. New in 0.7.0. */\nexport { FOCUS_RING, FOCUS_RING_INSET } from './lib/focus-ring';\n\n/** Screen-reader-only content. New in 0.7.0. */\nexport { VisuallyHidden } from './components/chrome/visually-hidden';\nexport type { VisuallyHiddenProps } from './components/chrome/visually-hidden';\n\n/** An icon that means something on its own, named for assistive technology. New in 0.7.0. */\nexport { AccessibleIcon } from './components/chrome/accessible-icon';\nexport type { AccessibleIconProps } from './components/chrome/accessible-icon';\n\n// ── Cards & containers ─────────────────────────────────────────────────────────\n\nexport {\n Card,\n CardHeader,\n CardTitle,\n CardDescription,\n CardAction,\n CardBody,\n CardFooter,\n} from './components/cards/card';\nexport type {\n CardProps,\n CardSize,\n CardRadius,\n CardTone,\n CardFooterAlign,\n CardHeaderProps,\n CardTitleProps,\n CardDescriptionProps,\n CardActionProps,\n CardBodyProps,\n CardFooterProps,\n} from './components/cards/card';\n\nexport {\n Accordion,\n AccordionItem,\n AccordionTrigger,\n AccordionContent,\n} from './components/cards/accordion';\nexport type {\n AccordionProps,\n AccordionItemDef,\n AccordionItemProps,\n AccordionTriggerProps,\n AccordionContentProps,\n AccordionType,\n} from './components/cards/accordion';\n\nexport {\n Collapsible,\n CollapsibleTrigger,\n CollapsibleContent,\n} from './components/cards/collapsible';\nexport type {\n CollapsibleProps,\n CollapsibleTriggerProps,\n CollapsibleContentProps,\n} from './components/cards/collapsible';\n\n// Layout primitives, new in 0.7.0. Token-backed spacing props; layout only, no visual styling.\nexport { Box, Flex, Grid, Container, Section } from './components/cards/layout';\nexport type {\n BoxProps,\n FlexProps,\n FlexDirection,\n FlexAlign,\n FlexJustify,\n GridProps,\n GridColumnCount,\n GridBreakpoint,\n ContainerProps,\n ContainerSize,\n SectionProps,\n SectionSize,\n SpaceToken,\n} from './components/cards/layout';\n\nexport { AspectRatio } from './components/cards/aspect-ratio';\nexport type { AspectRatioProps } from './components/cards/aspect-ratio';\n\nexport { ScrollArea } from './components/cards/scroll-area';\nexport type { ScrollAreaProps, ScrollAreaAxis } from './components/cards/scroll-area';\n\n// The scrollbar styling on its own, for a component that must own its own overflow — a\n// table wrapper, a tab strip, a floating panel. Use `ScrollArea` for a region of content.\nexport { SCROLLBAR_CLASSES } from './lib/scrollbar';\n\nexport {\n Carousel,\n CarouselViewport,\n CarouselSlide,\n CarouselControls,\n} from './components/cards/carousel';\nexport type {\n CarouselProps,\n CarouselViewportProps,\n CarouselSlideProps,\n CarouselControlsProps,\n} from './components/cards/carousel';\n\nexport { Resizable, ResizablePanel, ResizableHandle } from './components/cards/resizable';\nexport type {\n ResizableProps,\n ResizablePanelProps,\n ResizableHandleProps,\n ResizableDirection,\n} from './components/cards/resizable';\n\n// ── Page chrome ────────────────────────────────────────────────────────────────\n\nexport { PageHeading } from './components/chrome/page-heading';\nexport type { PageHeadingProps, PageHeadingSize } from './components/chrome/page-heading';\n\nexport { PageToolbar } from './components/chrome/page-toolbar';\nexport type { PageToolbarProps, PageToolbarSize } from './components/chrome/page-toolbar';\n\nexport { FilterBar } from './components/chrome/filter-bar';\nexport type { FilterBarProps, FilterBarSize } from './components/chrome/filter-bar';\n\nexport {\n Tabs,\n TabsPanel,\n TabsList,\n TabsTrigger,\n TabsContent,\n tabId,\n tabPanelId,\n} from './components/chrome/tabs';\nexport type {\n TabsProps,\n TabsRootProps,\n TabsPanelProps,\n TabsListProps,\n TabsTriggerProps,\n TabsContentProps,\n TabItem,\n TabsVariant,\n TabsSize,\n TabsOrientation,\n TabsActivation,\n} from './components/chrome/tabs';\n\nexport { NavItem, NavSubItem, NavGroupHeader } from './components/chrome/nav-item';\nexport type {\n NavItemProps,\n NavItemSize,\n NavItemVariant,\n NavItemDensity,\n NavSubItemProps,\n NavGroupHeaderProps,\n} from './components/chrome/nav-item';\n\nexport {\n Sidebar,\n SidebarProvider,\n SidebarTrigger,\n SidebarSeparator,\n SidebarUserCard,\n useSidebar,\n filterNav,\n filterNavItems,\n} from './components/chrome/sidebar';\nexport type {\n SidebarProps,\n SidebarProviderProps,\n SidebarContextValue,\n SidebarTriggerProps,\n SidebarSeparatorProps,\n SidebarUserCardProps,\n SidebarNavItem,\n SidebarNavGroup,\n SidebarLinkProps,\n SidebarLinkComponent,\n SidebarRenderState,\n} from './components/chrome/sidebar';\n\nexport { EyebrowLabel } from './components/chrome/eyebrow-label';\nexport type { EyebrowLabelProps, EyebrowLabelVariant } from './components/chrome/eyebrow-label';\n\nexport { Separator } from './components/chrome/separator';\nexport type { SeparatorProps, SeparatorOrientation } from './components/chrome/separator';\n\nexport { Kbd } from './components/chrome/kbd';\nexport type { KbdProps, KbdSize } from './components/chrome/kbd';\n\nexport {\n Breadcrumb,\n BreadcrumbItem,\n BreadcrumbEllipsis,\n} from './components/chrome/breadcrumb';\nexport type {\n BreadcrumbProps,\n BreadcrumbItemDef,\n BreadcrumbItemProps,\n BreadcrumbEllipsisProps,\n} from './components/chrome/breadcrumb';\n\nexport { Pagination, PaginationBar, paginationRange } from './components/chrome/pagination';\nexport type { PaginationProps, PaginationBarProps, PaginationType } from './components/chrome/pagination';\n\nexport { NavigationMenu, NavigationMenuItem } from './components/chrome/navigation-menu';\nexport type {\n NavigationMenuProps,\n NavigationMenuItemProps,\n NavigationMenuOrientation,\n NavigationMenuVariant,\n} from './components/chrome/navigation-menu';\n\n// ── Typography ─────────────────────────────────────────────────────────────────\n// The type ramp as components, mirroring Figma's `Text*` primitives. Every one takes\n// `asChild`, because the right element depends on the surrounding document outline.\n\nexport {\n Text,\n TextSmall,\n TextTiny,\n TextStrong,\n TextEmphasis,\n TextCode,\n TextLink,\n TextList,\n TextListItem,\n Blockquote,\n Quote,\n TitleHero,\n TitlePage,\n Subtitle,\n Heading,\n Subheading,\n} from './components/chrome/typography';\nexport type {\n TextProps,\n TextTone,\n BlockquoteProps,\n TextLinkProps,\n TextLinkTone,\n TextListProps,\n TextListItemProps,\n TextListVariant,\n TextListDensity,\n} from './components/chrome/typography';\n\n// ── Widgets ────────────────────────────────────────────────────────────────────\n\nexport { WidgetHeader, WidgetHeaderAccessoryProvider, useWidgetHeaderAccessory } from './components/widgets/widget-header';\nexport type { WidgetHeaderProps, WidgetHeaderEyebrowVariant, WidgetHeaderAccessoryProviderProps } from './components/widgets/widget-header';\n\nexport { WidgetTitle } from './components/widgets/widget-title';\nexport type { WidgetTitleProps, WidgetTitleSize } from './components/widgets/widget-title';\n\nexport { WidgetFooter } from './components/widgets/widget-footer';\nexport type { WidgetFooterProps } from './components/widgets/widget-footer';\n\n/** The dashboard grid vocabulary and container-width tiers. New in 0.7.0, from SCIC. */\nexport {\n WidgetGrid,\n WidgetGridRow,\n WidgetGridItem,\n COL_SPAN,\n HEIGHT_CLASS,\n HEIGHT_PX,\n} from './components/widgets/widget-grid';\nexport type {\n WidgetGridProps,\n WidgetGridRowProps,\n WidgetGridItemProps,\n ColSize,\n WidgetHeight,\n} from './components/widgets/widget-grid';\nexport {\n GRID_TIERS,\n TIER_MIN_PX,\n TIER_COLS,\n COL_SPAN_BY_TIER,\n tierForWidth,\n nextTier,\n quantizeWidth,\n colsFor,\n slotWidthPx,\n} from './lib/width-tier';\nexport type { GridTier } from './lib/width-tier';\nexport { useWidthTier } from './lib/use-width-tier';\nexport type { UseWidthTierOptions, UseWidthTierResult } from './lib/use-width-tier';\n\n// ── Stats ──────────────────────────────────────────────────────────────────────\n\nexport { StatTile } from './components/stats/stat-tile';\nexport type { StatTileProps } from './components/stats/stat-tile';\n\nexport { StatNumber } from './components/stats/stat-number';\nexport type { StatNumberProps, StatNumberSize, StatNumberWeight } from './components/stats/stat-number';\n\nexport { ScoreValue, getScoreTone, DEFAULT_SCORE_THRESHOLDS } from './components/stats/score-value';\nexport type {\n ScoreValueProps,\n ScoreValueSize,\n ScoreValueWeight,\n ScoreValueTone,\n ScoreTone,\n ScoreRampTone,\n ScoreDirection,\n ScoreThresholds,\n} from './components/stats/score-value';\n\nexport { TileGrid } from './components/stats/tile-grid';\nexport type { TileGridProps, TileGridColumns, TileGridBreakpoint } from './components/stats/tile-grid';\n\n// ── Data visualisation ─────────────────────────────────────────────────────────\n\nexport { CHART_TONE, CHART_SEQUENCE, CHART_TRACK, resolveChartColor } from './components/charts/chart-tone';\nexport type { ChartTone } from './components/charts/chart-tone';\n\nexport { BarChart } from './components/charts/bar-chart';\nexport type {\n BarChartProps,\n BarChartSeries,\n BarChartOrientation,\n BarChartSize,\n} from './components/charts/bar-chart';\n\nexport { DonutChart } from './components/charts/donut-chart';\nexport type { DonutChartProps, DonutSegment, DonutChartSize } from './components/charts/donut-chart';\n\nexport { RadialGauge } from './components/charts/radial-gauge';\nexport type { RadialGaugeProps, RadialGaugeSize } from './components/charts/radial-gauge';\n\nexport { Sparkline } from './components/charts/sparkline';\nexport type { SparklineProps, SparklineVariant, SparklineSize } from './components/charts/sparkline';\n\nexport { MiniBarChart } from './components/charts/mini-bar-chart';\nexport type {\n MiniBarChartProps,\n MiniBarChartSize,\n MiniBarChartOrientation,\n} from './components/charts/mini-bar-chart';\n\nexport { ChartLegend } from './components/charts/chart-legend';\nexport type {\n ChartLegendProps,\n ChartLegendItem,\n ChartLegendOrientation,\n} from './components/charts/chart-legend';\n\nexport { LegendDot } from './components/charts/legend-dot';\nexport type { LegendDotProps, LegendDotSize, LegendDotShape } from './components/charts/legend-dot';\n\nexport { TrendLabel } from './components/charts/trend-label';\nexport type {\n TrendLabelProps,\n TrendLabelWeight,\n TrendLabelSize,\n TrendDirection,\n} from './components/charts/trend-label';\n\n// ── Lists & rows ───────────────────────────────────────────────────────────────\n\nexport { Listbox } from './components/lists/listbox';\nexport type { ListboxProps, ListboxOption, ListboxGroup } from './components/lists/listbox';\n\nexport { ListRow } from './components/lists/list-row';\nexport type { ListRowProps, ListRowDensity, ListRowDivider } from './components/lists/list-row';\n\nexport { FileRow } from './components/lists/file-row';\nexport type { FileRowProps } from './components/lists/file-row';\n\nexport { ScoredRow } from './components/lists/scored-row';\nexport type { ScoredRowProps, ScoredRowAlign, ScoredRowGap } from './components/lists/scored-row';\n\nexport { NumberedList } from './components/lists/numbered-list';\nexport type {\n NumberedListProps,\n NumberedListItem,\n NumberedListGap,\n} from './components/lists/numbered-list';\n\nexport { IconTextRow } from './components/lists/icon-text-row';\nexport type { IconTextRowProps } from './components/lists/icon-text-row';\n\nexport { ChecklistRow } from './components/lists/checklist-row';\nexport type { ChecklistRowProps, ChecklistRowState } from './components/lists/checklist-row';\n\nexport { StepsList } from './components/lists/steps-list';\nexport type { StepsListProps } from './components/lists/steps-list';\n\nexport { DetailItem, DetailGrid } from './components/lists/detail-item';\nexport type {\n DetailItemProps,\n DetailItemLayout,\n DetailItemSpan,\n DetailGridProps,\n DetailGridColumns,\n} from './components/lists/detail-item';\n\n/** Label/value rows as a real <dl>, with optional copy. New in 0.7.0, from SCIC. */\nexport { DescriptionList, DescriptionItem, CopyButton, EmailText } from './components/lists/description-list';\nexport type { DescriptionListProps, DescriptionItemProps, CopyButtonProps } from './components/lists/description-list';\n\nexport { CheckedGroupList } from './components/lists/checked-group-list';\nexport type {\n CheckedGroupListProps,\n CheckedGroupListColumns,\n CheckedGroup,\n} from './components/lists/checked-group-list';\n\n/** Expandable tree — ARIA tree pattern, one tab stop, rows as a render slot. */\nexport { TreeView } from './components/lists/tree-view';\nexport type { TreeViewProps, TreeItemState, TreeViewSize } from './components/lists/tree-view';\n\n// ── Table ──────────────────────────────────────────────────────────────────────\n// The composable primitive, for the tables `DataTable`'s column config cannot express —\n// grouped headers, footers, colspans. `DataTable` remains the right default.\n\nexport {\n Table,\n TableCaption,\n TableHeader,\n TableBody,\n TableFooter,\n TableRow,\n TableHead,\n TableCell,\n} from './components/lists/table';\nexport type {\n TableProps,\n TableCaptionProps,\n TableRowProps,\n TableHeadProps,\n TableCellProps,\n TableDensity,\n TableSortDirection,\n TableRowTone,\n} from './components/lists/table';\n\n// ── Data table ─────────────────────────────────────────────────────────────────\n// DataTable, its parts and the TanStack Table types live in the `@platned/ui/data-table` entry\n// from 0.9.4 (src/data-table.tsx); the build keeps them in that file, so the main entry pulls in\n// TanStack only when a DataTable is actually used.\n\nexport * from './data-table';\n\n// The cells need no TanStack, so they are also exported straight from their module: a page that\n// renders a cell outside a DataTable does not load the table.\nexport {\n TableCellLeadText,\n TableCellText,\n TableCellBadge,\n TableCellProgress,\n} from './components/lists/data-table-cells';\n\n/** Measures an element's width, for layouts that switch structure by available space. New in 0.7.0. */\nexport { useElementWidth } from './lib/use-element-width';\n\n// ── Feedback ───────────────────────────────────────────────────────────────────\n\nexport { InlineAlert } from './components/feedback/inline-alert';\nexport type { InlineAlertProps, InlineAlertTone } from './components/feedback/inline-alert';\n\nexport { EmptyState } from './components/feedback/empty-state';\nexport type { EmptyStateProps, EmptyStateVariant, EmptyStateSize } from './components/feedback/empty-state';\n\nexport { ProgressBar } from './components/feedback/progress-bar';\nexport type { ProgressBarProps, ProgressBarTone, ProgressBarSize } from './components/feedback/progress-bar';\n\nexport { Spinner } from './components/feedback/spinner';\nexport type { SpinnerProps, SpinnerSize } from './components/feedback/spinner';\n\n/** Contains a render error to its own subtree. New in 0.7.0. */\nexport { ErrorBoundary } from './components/feedback/error-boundary';\nexport type { ErrorBoundaryProps } from './components/feedback/error-boundary';\n\nexport { Skeleton } from './components/feedback/skeleton';\nexport type { SkeletonProps, SkeletonShape } from './components/feedback/skeleton';\n\n/** Persistent, in-flow notice with a title and an action — Figma's `Notification`. */\nexport { Banner } from './components/feedback/banner';\nexport type { BannerProps, BannerVariant } from './components/feedback/banner';\n\n/** Transient notifications. Mount `Toaster` once at the app root, then call `useToast()`. */\nexport { Toaster, useToast } from './components/feedback/toast';\nexport type {\n ToasterProps,\n ToasterPosition,\n ToastOptions,\n ToastRecord,\n ToastTone,\n} from './components/feedback/toast';\n\n// ── Forms ──────────────────────────────────────────────────────────────────────\n\nexport { PasswordInput } from './components/forms/password-input';\nexport type { PasswordInputProps } from './components/forms/password-input';\n\n// ── AI surfaces & decorative ───────────────────────────────────────────────────\n\nexport { AIChatBar } from './components/ai/ai-chat-bar';\nexport type { AIChatBarProps } from './components/ai/ai-chat-bar';\n\nexport { AISuggestionChip } from './components/ai/ai-suggestion-chip';\nexport type { AISuggestionChipProps } from './components/ai/ai-suggestion-chip';\n\nexport { QuickActionsBar } from './components/ai/quick-actions-bar';\nexport type { QuickActionsBarProps, QuickAction } from './components/ai/quick-actions-bar';\n\n/** Chat transcript pieces. New in 0.7.0, from SCIC. */\nexport { ChatBubble, TypingIndicator, AiAvatar } from './components/ai/chat';\nexport type { ChatBubbleProps, ChatBubbleSender, TypingIndicatorProps, AiAvatarProps } from './components/ai/chat';\n\nexport { AuroraBackdrop } from './components/decorative/aurora-backdrop';\n\n// Icons are not re-exported. Import them straight from `lucide-react` — the nine filled\n// 20×20 `Solid*` marks that used to live here were used by no component in this library,\n// only by its own documentation, and they were the one place the library shipped a second\n// icon set. Charts remain the sole exception to Lucide, because their SVG is geometry.\n","import type { ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { CircleCheckBigIcon, InfoIcon, TriangleAlertIcon } from 'lucide-react';\n\n/** `neutral` is new in 0.9.5: a quiet, bordered note with no status colour, e.g. \"Viewing. Choose Edit to change this.\" */\nexport type InlineAlertTone = 'info' | 'warning' | 'danger' | 'positive' | 'neutral';\n\nexport interface InlineAlertProps {\n tone: InlineAlertTone;\n children: ReactNode;\n /** Overrides the per-tone default glyph. Pass `null` for no icon. */\n icon?: ReactNode | null;\n /**\n * Overrides the live-region role, which is otherwise `alert` for `danger` and `status` for the\n * rest. Pass `status` for a danger-toned answer that updates as the user explores, e.g. \"Not\n * allowed. …\" beside a picker, which should wait its turn rather than interrupt. New in 0.9.5.\n */\n role?: 'alert' | 'status';\n className?: string;\n}\n\nconst toneStyles: Record<InlineAlertTone, string> = {\n info: 'border-brand-tertiary bg-brand-tertiary text-brand',\n warning: 'border-warning-tertiary bg-warning-tertiary text-warning',\n danger: 'border-danger-tertiary bg-danger-tertiary text-danger',\n positive: 'border-positive-tertiary bg-positive-tertiary text-positive',\n neutral: 'border-default bg-default text-default-secondary',\n};\n\nconst toneIcons: Record<InlineAlertTone, ReactNode> = {\n info: <InfoIcon className=\"size-4\" />,\n warning: <TriangleAlertIcon className=\"size-4\" />,\n danger: <TriangleAlertIcon className=\"size-4\" />,\n positive: <CircleCheckBigIcon className=\"size-4\" />,\n neutral: <InfoIcon className=\"size-4 text-icon-default-secondary\" />,\n};\n\n/** Banner for inline messaging — form errors, destructive-action warnings, success confirmations.\n *\n * Replaces four byte-identical raw-`amber-*` callouts, five competing error-text styles and a\n * standalone `Banner` component. `danger` renders as `role=\"alert\"`; the rest as `role=\"status\"`. */\nexport function InlineAlert({ tone, children, icon, role, className }: InlineAlertProps) {\n const glyph = icon === undefined ? toneIcons[tone] : icon;\n\n return (\n <div\n data-tone={tone}\n role={role ?? (tone === 'danger' ? 'alert' : 'status')}\n className={clsx(\n 'flex items-start gap-3 rounded-xl border p-4 text-body-xs',\n toneStyles[tone],\n className,\n )}\n >\n {/* The glyph restates the tone the text already carries, so it is decoration —\n `lucide-react` hides its own SVGs, but any node can be passed here, so the wrapper\n hides it rather than trusting the glyph to keep out of a `role=\"alert\"` region. */}\n {glyph && (\n <span aria-hidden className=\"mt-px shrink-0\">\n {glyph}\n </span>\n )}\n <div className=\"min-w-0\">{children}</div>\n </div>\n );\n}\n","import { Component, type ErrorInfo, type ReactNode } from 'react';\n\nexport interface ErrorBoundaryProps {\n children: ReactNode;\n /** Shown in place of the children when they throw. Default a quiet \"Something went wrong\". */\n fallback?: ReactNode;\n /** Changing this resets the boundary. Use the identity of whatever is being rendered. */\n resetKey?: string;\n onError?: (error: Error, info: ErrorInfo) => void;\n}\n\ninterface ErrorBoundaryState {\n error: Error | null;\n}\n\n/**\n * Stops one broken subtree from taking down the whole app. New in 0.7.0, from SCIC.\n *\n * React unmounts the entire root when a render throws with no boundary above it, so one widget\n * that trips over an unexpected API shape blanks the screen instead of one card. This is the\n * floor under that: everything outside the boundary keeps working.\n *\n * A class, because error boundaries can only be classes. The error is still logged: the\n * fallback deliberately says nothing technical, so the console is how the cause is found.\n */\nexport class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {\n state: ErrorBoundaryState = { error: null };\n\n static getDerivedStateFromError(error: Error): ErrorBoundaryState {\n return { error };\n }\n\n componentDidUpdate(previous: ErrorBoundaryProps) {\n if (this.state.error && previous.resetKey !== this.props.resetKey) {\n this.setState({ error: null });\n }\n }\n\n componentDidCatch(error: Error, info: ErrorInfo) {\n console.error('[ErrorBoundary]', error, info.componentStack);\n this.props.onError?.(error, info);\n }\n\n render() {\n if (!this.state.error) return this.props.children;\n return (\n this.props.fallback ?? (\n <div\n role=\"status\"\n data-slot=\"error-boundary\"\n className=\"flex h-full w-full items-center justify-center rounded-lg border border-default bg-default p-4 text-center text-body-xs text-default-secondary\"\n >\n Something went wrong loading this.\n </div>\n )\n );\n }\n}\n","import { forwardRef, useId, type HTMLAttributes, type ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { CircleCheckBigIcon, InfoIcon, TriangleAlertIcon, XIcon } from 'lucide-react';\nimport { IconButton } from '../forms/icon-button';\nimport type { InlineAlertTone } from './inline-alert';\n\nexport type BannerVariant = 'message' | 'alert';\n\n// `title` is omitted from the base attributes because the HTML `title` attribute is a\n// string that renders a native tooltip — the same collision that made 0.2.0's\n// `Modal.title` become `Modal.label`. Here the prop is the more useful one, so the\n// attribute gives way.\nexport interface BannerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** Bold first line. Matches Figma's `Title`. */\n title: ReactNode;\n /** Supporting copy. Matches Figma's `Body`. */\n children?: ReactNode;\n /**\n * Matches Figma's `Variant` axis. `message` is informational; `alert` is urgent and is\n * announced immediately.\n */\n variant?: BannerVariant;\n tone?: InlineAlertTone;\n /** Replaces the tone glyph. Pass `null` to suppress it. Matches `Icon` / `Has Icon`. */\n icon?: ReactNode | null;\n /** Trailing action slot. Matches `Has Button`. */\n action?: ReactNode;\n /** Renders a dismiss button. Matches `Dismissible`. */\n onDismiss?: () => void;\n}\n\nconst TONE_STYLES: Record<InlineAlertTone, string> = {\n info: 'border-brand-tertiary bg-brand-tertiary text-default',\n positive: 'border-positive-tertiary bg-positive-tertiary text-default',\n warning: 'border-warning-tertiary bg-warning-tertiary text-default',\n danger: 'border-danger-tertiary bg-danger-tertiary text-default',\n neutral: 'border-default bg-default text-default',\n};\n\nconst TONE_ICON_COLOR: Record<InlineAlertTone, string> = {\n info: 'text-icon-brand',\n positive: 'text-icon-positive',\n warning: 'text-icon-warning',\n danger: 'text-icon-danger',\n neutral: 'text-icon-default-secondary',\n};\n\nconst TONE_ICON: Record<InlineAlertTone, ReactNode> = {\n info: <InfoIcon aria-hidden className=\"size-5\" />,\n positive: <CircleCheckBigIcon aria-hidden className=\"size-5\" />,\n warning: <TriangleAlertIcon aria-hidden className=\"size-5\" />,\n danger: <TriangleAlertIcon aria-hidden className=\"size-5\" />,\n neutral: <InfoIcon aria-hidden className=\"size-5\" />,\n};\n\n/**\n * A page- or section-level banner with a title, body, optional action and optional dismiss.\n *\n * This is Figma's `Notification` set (`Variant: Message | Alert`, with `Title`, `Body`,\n * `Has Icon`, `Has Button` and `Dismissible`). Worth being precise about the name: its\n * Figma keywords are \"message, alert, feedback, callout, banner\" — it is a *persistent,\n * in-flow* notice, **not** a toast. A toast is transient, stacked, and announced from a\n * live region that already exists; that is `Toast`, and it is a different component.\n *\n * `InlineAlert` remains the compact single-line form for use inside a form or a card.\n * `Banner` is the one with a heading and an action.\n *\n * `variant` drives the announcement, not just the styling: `alert` is `role=\"alert\"`\n * (interrupts), `message` is `role=\"status\"` (waits its turn).\n */\nexport const Banner = forwardRef<HTMLDivElement, BannerProps>(function Banner(\n {\n title,\n children,\n variant = 'message',\n tone = 'info',\n icon,\n action,\n onDismiss,\n className,\n ...rest\n },\n ref,\n) {\n const titleId = useId();\n const glyph = icon === undefined ? TONE_ICON[tone] : icon;\n\n return (\n <div\n data-tone={tone}\n data-variant={variant}\n ref={ref}\n role={variant === 'alert' ? 'alert' : 'status'}\n aria-labelledby={titleId}\n data-slot=\"banner\"\n className={clsx(\n 'flex w-full items-start gap-3 rounded-xl border p-4',\n TONE_STYLES[tone],\n className,\n )}\n {...rest}\n >\n {glyph && (\n <span aria-hidden className={clsx('mt-px shrink-0', TONE_ICON_COLOR[tone])}>\n {glyph}\n </span>\n )}\n <div className=\"min-w-0 flex-1\">\n <p id={titleId} className=\"text-body-sm font-semibold text-default\">\n {title}\n </p>\n {children && <div className=\"mt-1 text-body-xs text-default-secondary\">{children}</div>}\n {action && <div className=\"mt-3 flex items-center gap-2\">{action}</div>}\n </div>\n {onDismiss && (\n <IconButton\n variant=\"subtle\"\n size=\"sm\"\n // Named with the title, so several stacked banners do not all announce\n // \"Dismiss\" identically.\n aria-label={typeof title === 'string' ? `Dismiss: ${title}` : 'Dismiss'}\n onClick={onDismiss}\n className=\"-mr-1 -mt-1 shrink-0\"\n >\n <XIcon aria-hidden size={16} />\n </IconButton>\n )}\n </div>\n );\n});\n","import {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type ReactNode,\n} from 'react';\nimport clsx from 'clsx';\nimport { CircleCheckBigIcon, InfoIcon, TriangleAlertIcon, XIcon } from 'lucide-react';\nimport { IconButton } from '../forms/icon-button';\nimport { Portal } from '../overlays/portal';\nimport { TOASTER_ATTRIBUTE } from '../overlays/toaster-guard';\nimport type { InlineAlertTone } from './inline-alert';\n\nexport type ToastTone = InlineAlertTone;\nexport type ToasterPosition =\n | 'top-left'\n | 'top-center'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-center'\n | 'bottom-right';\n\nexport interface ToastOptions {\n title: ReactNode;\n description?: ReactNode;\n tone?: ToastTone;\n /** Milliseconds before auto-dismiss. `0` keeps it until dismissed. Default `5000`. */\n duration?: number;\n action?: ReactNode;\n}\n\nexport interface ToastRecord extends ToastOptions {\n id: string;\n}\n\ninterface ToastContextValue {\n toast: (options: ToastOptions) => string;\n dismiss: (id: string) => void;\n dismissAll: () => void;\n}\n\nconst ToastContext = createContext<ToastContextValue | null>(null);\n\n/**\n * Queue a toast. Must be called under a `<Toaster>`.\n *\n * Returns the toast's id so a long-running action can dismiss its own \"Saving…\" toast when\n * it finishes.\n */\nexport function useToast(): ToastContextValue {\n const context = useContext(ToastContext);\n if (!context) throw new Error('useToast() must be used inside <Toaster>');\n return context;\n}\n\nconst TONE_ICON: Record<ToastTone, ReactNode> = {\n info: <InfoIcon aria-hidden className=\"size-4\" />,\n positive: <CircleCheckBigIcon aria-hidden className=\"size-4\" />,\n warning: <TriangleAlertIcon aria-hidden className=\"size-4\" />,\n danger: <TriangleAlertIcon aria-hidden className=\"size-4\" />,\n neutral: <InfoIcon aria-hidden className=\"size-4\" />,\n};\n\nconst TONE_ICON_COLOR: Record<ToastTone, string> = {\n info: 'text-icon-brand',\n positive: 'text-icon-positive',\n warning: 'text-icon-warning',\n danger: 'text-icon-danger',\n neutral: 'text-icon-default-secondary',\n};\n\n/**\n * The vertical edge distance comes from two custom properties set on the region (see `offset`\n * and `mobileOffset`), switching at `md`. The horizontal inset stays a fixed 16px, which the\n * region's `calc(100% - 2rem)` width assumes.\n */\nconst POSITION: Record<ToasterPosition, string> = {\n 'top-left': 'top-[var(--toaster-mobile-offset)] md:top-[var(--toaster-offset)] left-4 items-start',\n 'top-center': 'top-[var(--toaster-mobile-offset)] md:top-[var(--toaster-offset)] left-1/2 -translate-x-1/2 items-center',\n 'top-right': 'top-[var(--toaster-mobile-offset)] md:top-[var(--toaster-offset)] right-4 items-end',\n 'bottom-left': 'bottom-[var(--toaster-mobile-offset)] md:bottom-[var(--toaster-offset)] left-4 items-start',\n 'bottom-center': 'bottom-[var(--toaster-mobile-offset)] md:bottom-[var(--toaster-offset)] left-1/2 -translate-x-1/2 items-center',\n 'bottom-right': 'bottom-[var(--toaster-mobile-offset)] md:bottom-[var(--toaster-offset)] right-4 items-end',\n};\n\n/** A number is pixels; a string is any CSS length. */\nfunction toLength(value: number | string): string {\n return typeof value === 'number' ? `${value}px` : value;\n}\n\nexport interface ToasterProps {\n children: ReactNode;\n position?: ToasterPosition;\n /** Maximum simultaneous toasts. Oldest are dropped first. Default `4`. */\n max?: number;\n /** Default auto-dismiss for toasts that do not set their own. Default `5000`. */\n duration?: number;\n /**\n * Distance from the top or bottom edge, from `md` up. A number is pixels. Default `16`.\n * Named as in Sonner. New in 0.9.0.\n */\n offset?: number | string;\n /**\n * The same distance below `md`. Defaults to `offset`. Raise it where the app has bottom\n * navigation on phones, so toasts sit above it, e.g. `mobileOffset={80}`. New in 0.9.0.\n */\n mobileOffset?: number | string;\n}\n\n/**\n * Provider plus the region toasts render into. Mount once, near the app root.\n *\n * The library had no toast and — more importantly — **no persistent live region at all**,\n * so nothing could announce an event that happened away from focus. The distinction that\n * matters here: a live region must already exist in the DOM before content is put into it.\n * A region that mounts at the same moment as its message is frequently not announced,\n * which is why the wrapper below renders unconditionally and only its children come and go.\n *\n * `aria-live=\"polite\"` on the container, and `role=\"alert\"` on individual `danger` toasts\n * so a failure interrupts rather than queueing behind a success message.\n */\nexport function Toaster({\n children,\n position = 'bottom-right',\n max = 4,\n duration = 5000,\n offset = 16,\n mobileOffset,\n}: ToasterProps) {\n const [toasts, setToasts] = useState<ToastRecord[]>([]);\n const timers = useRef(new Map<string, ReturnType<typeof setTimeout>>());\n const counter = useRef(0);\n\n const dismiss = useCallback((id: string) => {\n const timer = timers.current.get(id);\n if (timer) {\n clearTimeout(timer);\n timers.current.delete(id);\n }\n setToasts((current) => current.filter((entry) => entry.id !== id));\n }, []);\n\n const dismissAll = useCallback(() => {\n for (const timer of timers.current.values()) clearTimeout(timer);\n timers.current.clear();\n setToasts([]);\n }, []);\n\n const toast = useCallback(\n (options: ToastOptions) => {\n // A monotonic counter rather than a random id: `Math.random()` in a render-adjacent\n // path is a hydration hazard, and the value only has to be unique within the session.\n counter.current += 1;\n const id = `toast-${counter.current}`;\n const record: ToastRecord = { tone: 'info', duration, ...options, id };\n\n setToasts((current) => [...current, record].slice(-max));\n\n if (record.duration && record.duration > 0) {\n timers.current.set(\n id,\n setTimeout(() => dismiss(id), record.duration),\n );\n }\n return id;\n },\n [duration, max, dismiss],\n );\n\n useEffect(() => {\n const map = timers.current;\n return () => {\n for (const timer of map.values()) clearTimeout(timer);\n map.clear();\n };\n }, []);\n\n const context = useMemo(() => ({ toast, dismiss, dismissAll }), [toast, dismiss, dismissAll]);\n\n return (\n <ToastContext.Provider value={context}>\n {children}\n <Portal>\n <div\n // Unconditionally rendered, and empty most of the time. See the note above: a\n // live region has to pre-exist its content to be announced reliably.\n aria-live=\"polite\"\n aria-atomic=\"false\"\n // Lets an open Modal recognise a press on a toast as not-outside (see\n // overlays/toaster-guard.ts). `aria-live` already keeps the region out of the\n // set Radix hides from assistive tech behind a modal.\n {...{ [TOASTER_ATTRIBUTE]: '' }}\n // `calc(100% - 2rem)` (100% of a fixed box is the viewport) leaves room for the\n // 16px inset on each side. Through 0.8.2 this was `w-full`, so below ~412px the\n // region was the full viewport width *plus* its inset and ran off the far edge.\n className={clsx(\n 'pointer-events-none fixed z-toast flex w-[calc(100%-2rem)] max-w-[380px] flex-col gap-2',\n POSITION[position],\n )}\n style={\n {\n '--toaster-offset': toLength(offset),\n '--toaster-mobile-offset': toLength(mobileOffset ?? offset),\n } as CSSProperties\n }\n >\n {toasts.map((entry) => (\n <ToastItem key={entry.id} toast={entry} onDismiss={() => dismiss(entry.id)} />\n ))}\n </div>\n </Portal>\n </ToastContext.Provider>\n );\n}\n\nfunction ToastItem({ toast, onDismiss }: { toast: ToastRecord; onDismiss: () => void }) {\n const tone = toast.tone ?? 'info';\n\n return (\n <div\n // The container is polite; a danger toast escalates to assertive so a failure is not\n // read out after two successes.\n role={tone === 'danger' ? 'alert' : 'status'}\n // Re-enabled per toast — the container is pointer-events-none so it never blocks\n // clicks on the page behind an empty region.\n className={clsx(\n 'pointer-events-auto flex w-full items-start gap-3 rounded-xl border border-default',\n 'bg-default p-4 shadow-400',\n )}\n >\n <span aria-hidden className={clsx('mt-px shrink-0', TONE_ICON_COLOR[tone])}>\n {TONE_ICON[tone]}\n </span>\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-body-sm font-semibold text-default\">{toast.title}</p>\n {toast.description && (\n <p className=\"mt-0.5 text-body-xs text-default-secondary\">{toast.description}</p>\n )}\n {toast.action && <div className=\"mt-2 flex items-center gap-2\">{toast.action}</div>}\n </div>\n <IconButton\n variant=\"subtle\"\n size=\"sm\"\n aria-label={typeof toast.title === 'string' ? `Dismiss: ${toast.title}` : 'Dismiss'}\n onClick={onDismiss}\n className=\"-mr-1 -mt-1 shrink-0\"\n >\n <XIcon aria-hidden size={14} />\n </IconButton>\n </div>\n );\n}\n","import { forwardRef, useState } from 'react';\nimport { EyeIcon, EyeOffIcon } from 'lucide-react';\n\nimport { Input, type InputProps } from './input';\n\nexport type PasswordInputProps = Omit<InputProps, 'type' | 'trailingIcon' | 'trailingAction'>;\n\n/** Password field with a show/hide visibility toggle. */\nexport const PasswordInput = forwardRef<HTMLInputElement, PasswordInputProps>(function PasswordInput(props, ref) {\n const [visible, setVisible] = useState(false);\n\n return (\n <Input\n ref={ref}\n {...props}\n type={visible ? 'text' : 'password'}\n trailingAction={\n <button\n type=\"button\"\n aria-label={visible ? 'Hide password' : 'Show password'}\n onClick={() => setVisible((v) => !v)}\n className=\"flex items-center justify-center rounded transition-colors hover:text-default focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand\"\n >\n {visible ? (\n <EyeOffIcon aria-hidden className=\"size-4\" />\n ) : (\n <EyeIcon aria-hidden className=\"size-4\" />\n )}\n </button>\n }\n />\n );\n});\n","import clsx from 'clsx';\nimport { ArrowRightIcon, SearchIcon } from 'lucide-react';\n\nexport interface AIChatBarProps {\n placeholder?: string;\n className?: string;\n}\n\nexport function AIChatBar({\n placeholder = 'Ask Intelligence about any entity, supplier, or risk…',\n className,\n}: AIChatBarProps) {\n return (\n <div\n className={clsx(\n 'flex h-16 items-center gap-3 rounded-2xl border border-default bg-default px-6 shadow-panel',\n className,\n )}\n >\n <span aria-hidden className=\"shrink-0 text-icon-default-secondary\">\n <SearchIcon className=\"size-4\" />\n </span>\n <p className=\"flex-1 text-body-sm text-default-tertiary truncate\">{placeholder}</p>\n <button\n type=\"button\"\n className=\"inline-flex shrink-0 items-center gap-2 rounded-xl bg-brand px-4 py-3 text-body-sm font-semibold text-brand-on-brand hover:bg-brand-hover transition-colors\"\n >\n Ask\n <ArrowRightIcon aria-hidden className=\"size-4\" />\n </button>\n </div>\n );\n}\n","import clsx from 'clsx';\nimport { ArrowRightIcon, CpuIcon } from 'lucide-react';\n\nexport interface AISuggestionChipProps {\n prompt: string;\n onClick?: () => void;\n className?: string;\n}\n\nexport function AISuggestionChip({ prompt, onClick, className }: AISuggestionChipProps) {\n return (\n <button\n type=\"button\"\n onClick={onClick}\n className={clsx(\n 'flex h-12 w-full items-center gap-3 rounded-xl border border-default bg-default px-3 text-left hover:bg-default-hover transition-colors',\n className,\n )}\n >\n <span aria-hidden className=\"shrink-0 text-icon-brand\">\n <CpuIcon className=\"size-4\" />\n </span>\n <span className=\"flex-1 text-body-sm text-default truncate\">{prompt}</span>\n <span aria-hidden className=\"shrink-0 text-icon-default-secondary\">\n <ArrowRightIcon className=\"size-3.5\" strokeWidth={2.5} />\n </span>\n </button>\n );\n}\n","import clsx from 'clsx';\nimport { TagPill } from '../status/tag-pill';\n\nexport interface QuickAction {\n label: string;\n value: string;\n}\n\nexport interface QuickActionsBarProps {\n actions: QuickAction[];\n active?: string;\n onSelect?: (value: string) => void;\n className?: string;\n}\n\nexport function QuickActionsBar({ actions, active, onSelect, className }: QuickActionsBarProps) {\n return (\n <div className={clsx('flex flex-wrap items-center gap-3', className)}>\n {actions.map((action) => {\n const isActive = active === action.value;\n return (\n <button\n key={action.value}\n type=\"button\"\n // `aria-pressed` because these are toggles, not navigation — through 0.3.0 the\n // `active` prop was conveyed by the pill's fill colour only.\n aria-pressed={isActive}\n onClick={() => onSelect?.(action.value)}\n // Was `focus:outline-none` with no replacement — the UA indicator removed and\n // nothing put back, a straight WCAG 2.4.7 failure.\n className=\"rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default\"\n >\n <TagPill label={action.label} tone={isActive ? 'brand' : 'default'} />\n </button>\n );\n })}\n </div>\n );\n}\n","import type { ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { CpuIcon } from 'lucide-react';\nimport { cn } from '../../lib/cn';\n\n/**\n * Presentational pieces of an AI chat transcript, ported from SCIC in 0.7.0. Markup only: the\n * conversation state and streaming stay in the app. SCIC's hard-coded hex colours are replaced\n * by tokens, so the bubbles follow dark mode.\n */\n\nexport interface AiAvatarProps {\n className?: string;\n /** The glyph. Default a chip, SCIC's assistant mark. */\n icon?: ReactNode;\n}\n\n/** The assistant's round mark, decorative. */\nexport function AiAvatar({ className, icon }: AiAvatarProps) {\n return (\n <span\n aria-hidden\n className={cn('flex size-8 shrink-0 items-center justify-center rounded-full bg-brand text-icon-brand-on-brand', className)}\n >\n {icon ?? <CpuIcon className=\"size-3.5\" />}\n </span>\n );\n}\n\nexport interface TypingIndicatorProps {\n /** What the assistant is doing, read aloud. Default \"Assistant is typing\". */\n label?: string;\n className?: string;\n}\n\n/**\n * \"The assistant is working\": an avatar, the label and three pulsing dots. A polite live region,\n * so a screen reader hears the label once rather than nothing. The dots stop under\n * `prefers-reduced-motion`.\n */\nexport function TypingIndicator({ label = 'Assistant is typing', className }: TypingIndicatorProps) {\n return (\n <div role=\"status\" aria-live=\"polite\" className={cn('flex items-center gap-3', className)}>\n <AiAvatar />\n <div className=\"flex items-center gap-2 rounded-2xl rounded-tl-sm border border-default bg-default-secondary px-5 py-3\">\n <span className=\"text-body-xs text-default-secondary\">{label}</span>\n <span aria-hidden className=\"flex gap-1\">\n {[0, 1, 2].map((index) => (\n <span\n key={index}\n className=\"inline-block size-1.5 rounded-full bg-default-tertiary motion-safe:animate-bounce\"\n style={{ animationDelay: `${index * 0.15}s` }}\n />\n ))}\n </span>\n </div>\n </div>\n );\n}\n\nexport type ChatBubbleSender = 'user' | 'assistant';\n\nexport interface ChatBubbleProps {\n /**\n * Who wrote the message. Called `role` in SCIC; renamed so it cannot be mistaken for (or\n * linted as) an ARIA role.\n */\n sender: ChatBubbleSender;\n children: ReactNode;\n /** `assistant` only: the failed-turn palette, set as `data-state=\"failed\"`. */\n failed?: boolean;\n className?: string;\n}\n\n/** One message. The user's sits right in a dark bubble; the assistant's spans the column. */\nexport function ChatBubble({ sender, children, failed = false, className }: ChatBubbleProps) {\n if (sender === 'user') {\n return (\n <div data-sender=\"user\" className={cn('flex justify-end', className)}>\n <div className=\"max-w-[85%] rounded-[18px] rounded-tr-sm bg-neutral px-5 py-3.5 text-body-sm leading-relaxed text-neutral-on-neutral md:max-w-[441px] md:px-7 md:py-4\">\n {children}\n </div>\n </div>\n );\n }\n\n return (\n <div\n data-sender=\"assistant\"\n data-state={failed ? 'failed' : undefined}\n className={cn(\n 'rounded-2xl rounded-tl-sm border px-5 py-4 text-body-sm leading-relaxed',\n clsx(\n 'border-default bg-default-secondary text-default',\n 'data-[state=failed]:border-danger-secondary data-[state=failed]:bg-danger-tertiary data-[state=failed]:text-danger',\n ),\n className,\n )}\n >\n {children}\n </div>\n );\n}\n","/** Soft aurora atmosphere used by the public-facing screens (auth, event\n * onboarding) — mirrors AuroraBackground in pages/intelligence. Blobs are\n * corner-anchored so the effect scales from phones to kiosk displays.\n * Render inside a `relative overflow-hidden` container; content goes on top\n * with `relative`.\n *\n * Each blob is a primitive at an alpha, via `color-mix`, so the backdrop follows\n * the palette. Through 0.8.x these were raw rgba() values; 0.9.0 moved each to its\n * nearest primitive at the same alpha. */\nfunction blob(primitive: string, alpha: number) {\n return `radial-gradient(ellipse, color-mix(in srgb, var(${primitive}) ${alpha}%, transparent) 0%, transparent 70%)`;\n}\n\nexport function AuroraBackdrop() {\n return (\n <div className=\"pointer-events-none absolute inset-0\" aria-hidden>\n <div className=\"absolute -left-24 -top-28\" style={{ width: 380, height: 380, background: blob('--prim-red-400', 45) }} />\n <div className=\"absolute -top-24 right-[-4%]\" style={{ width: 320, height: 320, background: blob('--prim-red-300', 40) }} />\n <div className=\"absolute bottom-[-10%] right-[14%]\" style={{ width: 420, height: 420, background: blob('--prim-violet-400', 30) }} />\n <div className=\"absolute bottom-[-6%] left-[4%]\" style={{ width: 280, height: 280, background: blob('--prim-blue-400', 25) }} />\n <div className=\"absolute left-[20%] top-[30%]\" style={{ width: 240, height: 240, background: blob('--prim-blue-300', 18) }} />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,UAAU;AAiGL,SAeE,KAfF;AAvEZ,IAAM,kBAAsD;AAAA,EAC1D,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAS;AACX;AAEA,IAAM,iBAAqD;AAAA,EACzD,SAAS;AAAA,IACP;AAAA,IACA;AAAA,EACF;AAAA,EACA,SAAS;AAAA,IACP;AAAA,IACA;AAAA,EACF;AAAA,EACA,QAAQ;AAAA,IACN;AAAA,IACA;AAAA,EACF;AACF;AAEA,IAAM,mBAAuD;AAAA,EAC3D,SAAS,KAAK,+BAA+B,iCAAiC;AAAA,EAC9E,SAAS,KAAK,+BAA+B,iCAAiC;AAAA,EAC9E,QAAS,KAAK,0BAA0B,oBAAoB;AAC9D;AAEA,IAAM,iBAA6C;AAAA,EACjD,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAEA,IAAM,uBAAyD;AAAA,EAC7D,SAAS;AAA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I,gBAAAA,OAAC,SAAI,WAAU,mCAAkC,OAAO,EAAE,OAAO,KAAK,QAAQ,KAAK,YAAY,KAAK,mBAAmB,EAAE,EAAE,GAAG;AAAA,IAC9H,gBAAAA,OAAC,SAAI,WAAU,iCAAgC,OAAO,EAAE,OAAO,KAAK,QAAQ,KAAK,YAAY,KAAK,mBAAmB,EAAE,EAAE,GAAG;AAAA,KAC9H;AAEJ;","names":["clsx","jsx","clsx","jsxs","clsx","jsx","jsxs","clsx","jsx","jsxs","clsx","Input","InputControl","forwardRef","clsx","jsx","forwardRef","Textarea","clsx","forwardRef","clsx","jsx","jsxs","forwardRef","NativeSelect","clsx","forwardRef","useId","useMemo","useRef","useState","clsx","forwardRef","useState","jsx","useState","forwardRef","PopoverTrigger","PopoverContent","PopoverClose","PopoverAnchor","useId","useMemo","useState","clsx","jsx","jsxs","clsx","useMemo","useId","useState","jsx","jsxs","iconWrap","forwardRef","DatePicker","DateControl","useId","useState","useRef","useMemo","clsx","clsx","forwardRef","useRef","useState","ChevronRightIcon","jsx","jsxs","clsx","ChevronRightIcon","forwardRef","StepList","useRef","useState","clsx","CheckIcon","jsx","jsxs","clsx","CheckIcon","forwardRef","useId","clsx","jsx","jsxs","SIZE","forwardRef","Switch","useId","clsx","createContext","forwardRef","useContext","useMemo","useRef","clsx","jsx","SIZE","forwardRef","Toggle","useContext","createContext","useRef","useMemo","clsx","ToggleGroupItem","forwardRef","useId","useRef","useState","clsx","jsx","jsxs","forwardRef","InputOTP","useRef","useState","useId","clsx","useRef","useState","clsx","jsx","jsxs","useEffect","useState","clsx","clsx","Fragment","jsx","jsxs","sizeStyles","clsx","jsx","jsxs","useState","useEffect","clsx","clsx","jsx","jsxs","clsx","useCallback","useEffect","useMemo","useRef","useState","useState","clsx","XIcon","useCallback","useEffect","useId","useMemo","useRef","useState","clsx","CheckIcon","ChevronDownIcon","Fragment","jsx","jsxs","useState","useId","useRef","useMemo","useCallback","useEffect","clsx","ChevronDownIcon","CheckIcon","useMemo","jsx","useMemo","createContext","forwardRef","useContext","useId","clsx","jsx","jsxs","createContext","forwardRef","RadioGroup","useId","clsx","Radio","useContext","clsx","jsx","clsx","useMemo","jsx","useMemo","Fragment","jsx","jsxs","useState","clsx","XIcon","jsx","jsxs","useState","useRef","useEffect","useMemo","locked","timer","useCallback","useEffect","useRef","useState","clsx","XIcon","jsx","jsxs","clsx","jsx","Fragment","jsx","jsxs","useEffect","useId","useMemo","useRef","useState","clsx","jsx","jsxs","useState","useId","useRef","useMemo","useEffect","clsx","clsx","jsx","jsxs","TONE_STYLES","clsx","jsx","clsx","jsx","jsxs","clsx","clsx","jsx","jsxs","clsx","clsx","jsx","jsxs","jsx","clsx","CheckIcon","XIcon","jsx","clsx","jsx","sizeStyles","toneStyles","createContext","forwardRef","useContext","useId","clsx","jsx","jsxs","createContext","forwardRef","RadioCards","useId","RadioCardsItem","useContext","clsx","createContext","forwardRef","useContext","useId","jsx","jsxs","createContext","forwardRef","CheckboxGroup","useId","CheckboxGroupItem","useContext","forwardRef","useId","clsx","jsx","jsxs","Slider","forwardRef","clsx","jsx","SIZE","forwardRef","Label","clsx","createContext","forwardRef","useContext","useEffect","useState","XIcon","jsx","jsxs","SIZE","createContext","forwardRef","Modal","ModalShell","useState","XIcon","ModalTrigger","ModalClose","ModalHeader","ModalTitle","useContext","useEffect","ModalDescription","ModalBody","ModalFooter","useId","Fragment","jsx","jsxs","useId","useId","useState","jsx","jsxs","useId","useState","forwardRef","Fragment","jsx","jsxs","forwardRef","ContextMenuTrigger","ContextMenuContent","forwardRef","jsx","jsxs","forwardRef","Menubar","MenubarTrigger","MenubarContent","parts","createContext","forwardRef","useContext","useEffect","useState","DialogPrimitive","XIcon","forwardRef","useEffect","useRef","useState","clsx","jsx","forwardRef","ScrollArea","useRef","useState","useEffect","clsx","Fragment","jsx","jsxs","createContext","forwardRef","Drawer","DialogPrimitive","extractTrigger","withoutTrigger","DrawerPanel","useState","DrawerTrigger","DrawerClose","isTrigger","DrawerHeader","XIcon","DrawerTitle","useContext","useEffect","DrawerDescription","DrawerBody","DrawerFooter","useRef","jsx","jsxs","useRef","useState","jsx","jsxs","useState","jsx","useState","DialogPrimitive","XIcon","jsx","jsxs","useState","DialogPrimitive","XIcon","forwardRef","jsx","VisuallyHidden","jsx","createContext","useContext","jsx","FOOTER_ALIGN","createContext","useContext","createContext","forwardRef","useContext","clsx","ChevronDownIcon","jsx","jsxs","createContext","forwardRef","Accordion","AccordionItem","AccordionTrigger","useContext","Heading","ChevronDownIcon","clsx","AccordionContent","createContext","forwardRef","useContext","useId","jsx","createContext","forwardRef","Collapsible","useId","CollapsibleTrigger","useContext","CollapsibleContent","forwardRef","jsx","forwardRef","Box","ALIGN","Flex","Grid","Container","Section","forwardRef","clsx","jsx","AspectRatio","createContext","useCallback","useContext","useEffect","useId","useMemo","useRef","useState","clsx","ChevronLeftIcon","ChevronRightIcon","jsx","jsxs","createContext","useContext","useId","useRef","useState","useMemo","useEffect","clsx","useCallback","ChevronLeftIcon","ChevronRightIcon","createContext","useCallback","useContext","useEffect","useId","useMemo","useRef","useState","clsx","jsx","jsxs","createContext","useContext","useRef","useId","useState","useMemo","clsx","useCallback","useEffect","clsx","jsx","jsxs","clsx","ArrowLeftIcon","jsx","jsxs","SIZE","clsx","ArrowLeftIcon","clsx","jsx","jsxs","GAP","clsx","createContext","forwardRef","useCallback","useContext","useId","useLayoutEffect","useRef","useState","clsx","ChevronLeftIcon","ChevronRightIcon","jsx","jsxs","SIZE","clsx","useRef","useState","useCallback","useLayoutEffect","ChevronLeftIcon","ChevronRightIcon","useId","createContext","forwardRef","TabsList","useContext","TabsTrigger","TabsContent","forwardRef","clsx","ChevronDownIcon","Fragment","jsx","jsxs","SIZE","VARIANT","clsx","forwardRef","NavItem","NavSubItem","NavGroupHeader","ChevronDownIcon","createContext","forwardRef","useCallback","useContext","useEffect","useId","useMemo","useState","ChevronDownIcon","ChevronLeftIcon","ChevronRightIcon","clsx","useCallback","Fragment","jsx","jsxs","createContext","useContext","useEffect","useCallback","useMemo","forwardRef","DefaultLink","useId","clsx","ChevronRightIcon","ChevronLeftIcon","useState","ChevronDownIcon","SidebarTrigger","clsx","jsx","forwardRef","clsx","jsx","Separator","forwardRef","clsx","jsx","SIZE","Kbd","Fragment","forwardRef","clsx","ChevronRightIcon","jsx","jsxs","forwardRef","Breadcrumb","clsx","Fragment","BreadcrumbItem","ChevronRightIcon","BreadcrumbEllipsis","forwardRef","clsx","Fragment","jsx","jsxs","forwardRef","NavigationMenu","clsx","NavigationMenuItem","forwardRef","clsx","jsx","TONE","Component","forwardRef","Blockquote","TextLink","clsx","TextList","TextListItem","createContext","useContext","clsx","clsx","jsx","sizeStyles","jsx","jsxs","createContext","useContext","clsx","clsx","jsx","jsxs","clsx","jsx","clsx","useCallback","useEffect","useLayoutEffect","useRef","useState","useEffect","useLayoutEffect","useState","useRef","useCallback","clsx","Fragment","jsx","jsxs","clsx","clsx","jsx","jsxs","sizeStyles","clsx","jsx","jsxs","SIZE","TONE","clsx","jsx","COLUMNS","clsx","jsx","jsxs","SIZE","labelClass","clsx","clsx","jsx","jsxs","SIZE","clsx","clsx","jsx","jsxs","SIZE","clsx","useId","clsx","Fragment","jsx","jsxs","SIZE","useId","clsx","clsx","jsx","SIZE","clsx","clsx","clsx","jsx","clsx","jsx","jsxs","clsx","clsx","jsx","jsxs","SIZE","WEIGHT","Fragment","useEffect","useId","useMemo","clsx","jsx","jsxs","isGroup","useId","useMemo","useEffect","clsx","Fragment","clsx","Fragment","jsx","jsxs","DENSITY","clsx","clsx","jsx","jsxs","clsx","clsx","jsx","jsxs","GAP","ALIGN","clsx","jsx","jsxs","GAP","clsx","clsx","jsx","jsxs","clsx","CheckIcon","jsx","jsxs","clsx","jsx","jsxs","clsx","jsx","jsxs","COLUMNS","useEffect","useState","clsx","CheckIcon","jsx","jsxs","useState","useEffect","CheckIcon","clsx","clsx","CheckIcon","jsx","jsxs","COLUMNS","useMemo","useRef","useState","clsx","ChevronRightIcon","jsx","jsxs","useState","useRef","useMemo","clsx","ChevronRightIcon","clsx","CircleCheckBigIcon","InfoIcon","TriangleAlertIcon","jsx","jsxs","toneStyles","jsx","forwardRef","useId","clsx","CircleCheckBigIcon","InfoIcon","TriangleAlertIcon","XIcon","jsx","jsxs","TONE_STYLES","TONE_ICON","InfoIcon","CircleCheckBigIcon","TriangleAlertIcon","forwardRef","Banner","useId","clsx","XIcon","createContext","useCallback","useContext","useEffect","useMemo","useRef","useState","clsx","CircleCheckBigIcon","InfoIcon","TriangleAlertIcon","XIcon","jsx","jsxs","createContext","useContext","TONE_ICON","InfoIcon","CircleCheckBigIcon","TriangleAlertIcon","TONE_ICON_COLOR","useState","useRef","useCallback","useEffect","useMemo","clsx","XIcon","forwardRef","useState","EyeIcon","EyeOffIcon","jsx","forwardRef","PasswordInput","useState","EyeOffIcon","EyeIcon","clsx","ArrowRightIcon","SearchIcon","jsx","jsxs","clsx","ArrowRightIcon","jsx","jsxs","clsx","jsx","clsx","clsx","CpuIcon","jsx","jsxs","CpuIcon","clsx","jsx","jsxs"]}
1
+ {"version":3,"sources":["../src/components/forms/button-group.tsx","../src/components/avatar/avatar.tsx","../src/components/avatar/avatar-group.tsx","../src/components/avatar/avatar-block.tsx","../src/components/forms/input.tsx","../src/components/forms/textarea.tsx","../src/components/forms/native-select.tsx","../src/components/forms/date-picker.tsx","../src/components/overlays/popover.tsx","../src/components/forms/calendar.tsx","../src/components/forms/stepper.tsx","../src/components/forms/multiselect-card.tsx","../src/components/forms/choice-card-size.ts","../src/components/forms/switch.tsx","../src/components/forms/toggle.tsx","../src/components/forms/input-otp.tsx","../src/components/forms/file-drop-zone.tsx","../src/components/forms/tag-input.tsx","../src/components/status/tag-pill.tsx","../src/components/forms/form-card.tsx","../src/components/forms/form.tsx","../src/components/forms/form-fields.tsx","../src/components/forms/combobox.tsx","../src/components/forms/country-select.tsx","../src/components/forms/radio-group.tsx","../src/components/forms/segmented-control.tsx","../src/components/forms/time-zone-select.tsx","../src/components/forms/use-dependent-options.ts","../src/components/forms/form-deprecated.ts","../src/components/status/badge.tsx","../src/components/status/role-badge.tsx","../src/components/forms/role-combo-box.tsx","../src/components/forms/command.tsx","../src/components/status/status-badge.tsx","../src/components/status/status-dot.tsx","../src/components/status/status-chip.tsx","../src/components/status/count-badge.tsx","../src/components/status/trail-chip.tsx","../src/components/status/user-status-pill.tsx","../src/components/status/check-indicator.tsx","../src/components/status/entity-icon-badge.tsx","../src/components/forms/radio-cards.tsx","../src/components/forms/checkbox-group.tsx","../src/components/forms/slider.tsx","../src/components/forms/label.tsx","../src/components/overlays/modal.tsx","../src/components/overlays/toaster-guard.ts","../src/components/overlays/tooltip.tsx","../src/components/overlays/hover-card.tsx","../src/components/overlays/context-menu.tsx","../src/components/overlays/menubar.tsx","../src/components/overlays/drawer.tsx","../src/components/cards/scroll-area.tsx","../src/components/overlays/confirm-dialog.tsx","../src/components/overlays/note-confirm-modal.tsx","../src/components/overlays/scrim.tsx","../src/components/overlays/fullscreen-surface.tsx","../src/components/chrome/visually-hidden.tsx","../src/components/chrome/accessible-icon.tsx","../src/components/cards/card.tsx","../src/components/cards/accordion.tsx","../src/components/cards/collapsible.tsx","../src/components/cards/layout.tsx","../src/components/cards/aspect-ratio.tsx","../src/components/cards/carousel.tsx","../src/components/cards/resizable.tsx","../src/components/chrome/page-heading.tsx","../src/components/chrome/page-toolbar.tsx","../src/components/chrome/filter-bar.tsx","../src/components/chrome/tabs.tsx","../src/components/chrome/nav-item.tsx","../src/components/chrome/sidebar.tsx","../src/lib/use-media-query.ts","../src/components/chrome/eyebrow-label.tsx","../src/components/chrome/separator.tsx","../src/components/chrome/kbd.tsx","../src/components/chrome/breadcrumb.tsx","../src/components/chrome/navigation-menu.tsx","../src/components/chrome/typography.tsx","../src/components/widgets/widget-header.tsx","../src/components/widgets/widget-title.tsx","../src/components/widgets/widget-footer.tsx","../src/components/widgets/widget-grid.tsx","../src/lib/width-tier.ts","../src/lib/use-width-tier.ts","../src/components/stats/stat-tile.tsx","../src/components/stats/stat-number.tsx","../src/components/stats/score-value.tsx","../src/components/stats/tile-grid.tsx","../src/components/charts/chart-tone.ts","../src/components/charts/bar-chart.tsx","../src/components/charts/donut-chart.tsx","../src/components/charts/radial-gauge.tsx","../src/components/charts/sparkline.tsx","../src/components/charts/mini-bar-chart.tsx","../src/components/charts/chart-legend.tsx","../src/components/charts/legend-dot.tsx","../src/components/charts/trend-label.tsx","../src/components/lists/listbox.tsx","../src/components/lists/selection-bar.tsx","../src/components/lists/list-row.tsx","../src/components/lists/file-row.tsx","../src/components/lists/scored-row.tsx","../src/components/lists/numbered-list.tsx","../src/components/lists/icon-text-row.tsx","../src/components/lists/checklist-row.tsx","../src/components/lists/steps-list.tsx","../src/components/lists/detail-item.tsx","../src/components/lists/description-list.tsx","../src/components/lists/checked-group-list.tsx","../src/components/lists/tree-view.tsx","../src/index.tsx","../src/components/feedback/inline-alert.tsx","../src/components/feedback/error-boundary.tsx","../src/components/feedback/banner.tsx","../src/components/feedback/toast.tsx","../src/components/forms/password-input.tsx","../src/components/ai/ai-chat-bar.tsx","../src/components/ai/ai-suggestion-chip.tsx","../src/components/ai/quick-actions-bar.tsx","../src/components/ai/chat.tsx","../src/components/decorative/aurora-backdrop.tsx"],"sourcesContent":["import { type ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { type ButtonSize } from './button';\n\nexport type ButtonGroupVariant = 'primary' | 'neutral' | 'filter';\nexport type ButtonGroupAlign = 'justify' | 'start' | 'end' | 'center' | 'stack';\n\nexport interface ButtonGroupItem {\n value: string;\n label: ReactNode;\n leadingIcon?: ReactNode;\n trailingIcon?: ReactNode;\n disabled?: boolean;\n}\n\nexport interface ButtonGroupProps {\n items: ButtonGroupItem[];\n value: string;\n onChange: (value: string) => void;\n variant?: ButtonGroupVariant;\n size?: ButtonSize;\n align?: ButtonGroupAlign;\n /** Forwarded to the container as aria-label */\n 'aria-label'?: string;\n className?: string;\n}\n\nconst containerStyles: Record<ButtonGroupVariant, string> = {\n primary: 'bg-neutral-tertiary p-1 rounded-2xl',\n neutral: 'bg-neutral-tertiary p-1 rounded-2xl',\n filter: 'bg-default border border-default p-1 rounded-xl',\n};\n\nconst selectedStyles: Record<ButtonGroupVariant, string> = {\n primary: clsx(\n 'bg-brand border border-brand text-brand-on-brand',\n 'hover:bg-brand-hover',\n ),\n neutral: clsx(\n 'bg-default border border-default text-default',\n 'hover:bg-default-hover',\n ),\n filter: clsx(\n 'bg-brand text-brand-on-brand',\n 'hover:bg-brand-hover',\n ),\n};\n\nconst unselectedStyles: Record<ButtonGroupVariant, string> = {\n primary: clsx('bg-transparent text-neutral', 'hover:bg-neutral-tertiary-hover'),\n neutral: clsx('bg-transparent text-neutral', 'hover:bg-neutral-tertiary-hover'),\n filter: clsx('text-default-secondary', 'hover:text-default'),\n};\n\nconst itemSizeStyles: Record<ButtonSize, string> = {\n lg: 'h-12 px-3 gap-1 rounded-2xl text-body font-semibold [&_svg]:size-5',\n md: 'h-9 px-2 gap-0.5 rounded-lg text-body-sm font-semibold [&_svg]:size-5',\n sm: 'h-6 px-1.5 pt-0.5 gap-0 rounded-full text-body-tiny font-semibold [&_svg]:size-4',\n};\n\nconst containerAlignStyles: Record<ButtonGroupAlign, string> = {\n justify: 'flex flex-row items-center',\n start: 'flex flex-row items-center justify-start',\n end: 'flex flex-row items-center justify-end',\n center: 'flex flex-row items-center justify-center',\n stack: 'flex flex-col items-center',\n};\n\nexport function ButtonGroup({\n items,\n value,\n onChange,\n variant = 'primary',\n size = 'md',\n align = 'start',\n className,\n 'aria-label': ariaLabel,\n}: ButtonGroupProps) {\n const isJustify = align === 'justify';\n const isStack = align === 'stack';\n\n return (\n <div\n role=\"group\"\n aria-label={ariaLabel}\n className={clsx(\n containerStyles[variant],\n containerAlignStyles[align],\n className,\n )}\n >\n {items.map((item) => {\n const isSelected = item.value === value;\n return (\n <div\n key={item.value}\n className={clsx(isJustify && 'flex-1 min-w-0', isStack && 'w-full')}\n >\n <button\n type=\"button\"\n aria-pressed={isSelected}\n disabled={item.disabled}\n onClick={() => onChange(item.value)}\n className={clsx(\n 'inline-flex items-center justify-center whitespace-nowrap transition-colors',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1',\n 'disabled:cursor-not-allowed disabled:text-disabled',\n (isJustify || isStack) && 'w-full',\n itemSizeStyles[size],\n isSelected ? selectedStyles[variant] : unselectedStyles[variant],\n )}\n >\n {item.leadingIcon}\n <div className='px-1'>{item.label}</div>\n {item.trailingIcon}\n </button>\n </div>\n );\n })}\n </div>\n );\n}\n","import clsx from 'clsx';\n\nexport type AvatarSize = 'sm' | 'md' | 'lg';\nexport type AvatarShape = 'circle' | 'square';\n\nexport interface AvatarInitialProps {\n type?: 'initial';\n /** Single character — Figma spec: one letter only to avoid overflow */\n initial: string;\n size?: AvatarSize;\n shape?: AvatarShape;\n className?: string;\n}\n\nexport interface AvatarImageProps {\n type: 'image';\n src: string;\n alt?: string;\n size?: AvatarSize;\n shape?: AvatarShape;\n className?: string;\n}\n\nexport type AvatarProps = AvatarInitialProps | AvatarImageProps;\n\n// Figma sizes: lg=40px, md=32px, sm=24px\nconst sizeStyles: Record<AvatarSize, string> = {\n lg: 'size-10',\n md: 'size-8',\n sm: 'size-6',\n};\n\n// Figma text sizes for initials: body-medium at lg, scales down proportionally\nconst initialTextStyles: Record<AvatarSize, string> = {\n lg: 'text-body font-semibold',\n md: 'text-body-xs font-semibold',\n sm: 'text-body-tiny font-semibold',\n};\n\n// Figma shape radii: circle=full, square: lg/md=8px (rounded-lg), sm=4px (rounded)\nfunction getShapeClass(shape: AvatarShape, size: AvatarSize): string {\n if (shape === 'circle') return 'rounded-full';\n return size === 'sm' ? 'rounded' : 'rounded-lg';\n}\n\nexport function Avatar(props: AvatarProps) {\n const { size = 'lg', shape = 'circle', className } = props;\n\n const base = clsx(\n 'shrink-0 overflow-hidden',\n sizeStyles[size],\n getShapeClass(shape, size),\n className,\n );\n\n if (props.type === 'image') {\n return (\n <div className={base}>\n <img\n src={props.src}\n alt={props.alt ?? ''}\n className=\"size-full object-cover\"\n />\n </div>\n );\n }\n\n return (\n <div\n className={clsx(base, 'flex items-center justify-center')}\n style={{\n background:\n 'linear-gradient(135deg, var(--color-graphic-blue) 30%, var(--color-graphic-red) 100%)',\n }}\n >\n <span\n className={clsx(\n 'select-none leading-none text-brand-on-brand',\n initialTextStyles[size],\n )}\n >\n {props.initial.charAt(0).toUpperCase()}\n </span>\n </div>\n );\n}\n","import { type ReactNode } from 'react';\nimport clsx from 'clsx';\n\nexport type AvatarGroupSpacing = 'spaced' | 'overlap';\n\nexport interface AvatarGroupProps {\n children: ReactNode;\n /** Number shown in the overflow badge — omit to hide the badge */\n overflow?: number;\n spacing?: AvatarGroupSpacing;\n className?: string;\n}\n\nexport function AvatarGroup({\n children,\n overflow,\n spacing = 'spaced',\n className,\n}: AvatarGroupProps) {\n return (\n <div\n className={clsx(\n 'flex items-center',\n spacing === 'spaced' ? 'gap-1' : '-space-x-2 isolate',\n className,\n )}\n >\n {children}\n {overflow !== undefined && (\n <div\n className={clsx(\n 'flex items-center justify-center',\n 'min-w-6 h-6 px-1 rounded-lg',\n 'bg-default-secondary text-default-secondary text-body-sm',\n spacing === 'overlap' && 'drop-shadow-sm',\n )}\n >\n +{overflow}\n </div>\n )}\n </div>\n );\n}\n","import clsx from 'clsx';\nimport type { ReactNode } from 'react';\n\nexport interface AvatarBlockProps {\n children: ReactNode;\n title: string;\n description?: string;\n className?: string;\n}\n\nexport function AvatarBlock({ children, title, description, className }: AvatarBlockProps) {\n return (\n <div className={clsx('flex items-start gap-3', className)}>\n <div className=\"shrink-0\">{children}</div>\n <div className=\"flex min-w-0 flex-col gap-0.5\">\n <span className=\"text-body font-semibold text-default-secondary\">\n {title}\n </span>\n {description && (\n <span className=\"text-body text-default-tertiary\">\n {description}\n </span>\n )}\n </div>\n </div>\n );\n}\n","import { forwardRef, type InputHTMLAttributes, type ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { useControlSize } from './control-size';\nimport { useFieldControl } from './field';\n\nexport type InputSize = 'lg' | 'md' | 'sm';\n\nexport interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {\n size?: InputSize;\n /** Red border and `aria-invalid`. Inside a `Field`, a `FieldError` with a message sets this. */\n invalid?: boolean;\n leadingIcon?: ReactNode;\n trailingIcon?: ReactNode;\n /** Interactive trailing slot (e.g. a show/hide password button) — unlike\n * `trailingIcon` it receives pointer events. */\n trailingAction?: ReactNode;\n}\n\n// Figma sizes: lg=48px md=36px sm=24px\nconst inputBase: Record<InputSize, string> = {\n lg: 'h-12 px-5 py-3.5 text-body',\n md: 'h-9 px-4 py-2.5 text-body-sm',\n sm: 'h-6 px-3 py-[5px] text-body-tiny',\n};\n\n// Extra left padding to clear the leading icon\n// lg adds 8px for the explicit flex gap Figma uses on large; md/sm have no gap\nconst leadingPad: Record<InputSize, string> = {\n lg: 'pl-12',\n md: 'pl-8',\n sm: 'pl-6',\n};\n\n// Extra right padding to clear the trailing icon\nconst trailingPad: Record<InputSize, string> = {\n lg: 'pr-12',\n md: 'pr-8',\n sm: 'pr-6',\n};\n\n// Icon wrapper: absolutely positioned inside the input container\nconst iconWrap: Record<InputSize, { left: string; right: string; size: string }> = {\n lg: { left: 'left-4', right: 'right-4', size: 'size-5' },\n md: { left: 'left-3', right: 'right-3', size: 'size-4' },\n sm: { left: 'left-2', right: 'right-2', size: 'size-3' },\n};\n\n/**\n * Focus styling note: `focus-visible:` rather than `focus:`, and `ring-2 ring-brand` to\n * match the button family. Through 0.3.0 this used `focus:ring-1 ring-brand-secondary`,\n * which showed a ring on plain mouse clicks and was a third distinct focus treatment in a\n * library that already had two.\n */\nexport const inputControlClasses = (size: InputSize, invalid: boolean, disabled?: boolean) =>\n clsx(\n 'w-full rounded-lg border outline-none transition-colors',\n 'bg-default text-default',\n 'placeholder:text-default-tertiary',\n 'focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-default',\n inputBase[size],\n disabled\n ? 'cursor-not-allowed bg-disabled border-disabled text-disabled placeholder:text-disabled'\n : invalid\n ? 'border-danger-secondary focus-visible:border-danger focus-visible:ring-danger'\n : 'border-default focus-visible:border-brand focus-visible:ring-brand',\n // read-only is not disabled: the value still matters and is still selectable, but it\n // must not look editable. Nothing in the library styled this before 0.4.0.\n // `enabled:` because a disabled input also matches `:read-only`. Through 0.9.1 that let this\n // lighter fill override `bg-disabled`, so a disabled field looked read-only (0.9.2).\n 'enabled:read-only:bg-default-secondary enabled:read-only:cursor-default',\n );\n\n/**\n * A text input with optional icons. Bare from 0.10.0: it has no label, hint or error of its\n * own. Put it in a `Field` with a `FieldLabel` (and `FieldHint` / `FieldError`), or give it\n * an `aria-label`. `className` sets the layout of the whole control, icons included.\n */\nexport const Input = forwardRef<HTMLInputElement, InputProps>(function Input(\n { size: sizeProp, invalid, leadingIcon, trailingIcon, trailingAction, className, ...props },\n ref,\n) {\n const size = useControlSize(sizeProp);\n const iw = iconWrap[size];\n\n return (\n <div className={clsx('relative flex items-center', className)}>\n {leadingIcon && (\n <span\n aria-hidden\n className={clsx(\n 'pointer-events-none absolute',\n iw.left,\n iw.size,\n 'flex items-center justify-center text-icon-default-secondary',\n )}\n >\n {leadingIcon}\n </span>\n )}\n <InputControl\n ref={ref}\n size={size}\n invalid={invalid}\n className={clsx(leadingIcon && leadingPad[size], (trailingIcon || trailingAction) && trailingPad[size])}\n {...props}\n />\n {trailingIcon && !trailingAction && (\n <span\n aria-hidden\n className={clsx(\n 'pointer-events-none absolute',\n iw.right,\n iw.size,\n 'flex items-center justify-center text-icon-default-secondary',\n )}\n >\n {trailingIcon}\n </span>\n )}\n {trailingAction && (\n <span className={clsx('absolute', iw.right, 'flex items-center justify-center text-icon-default-secondary')}>\n {trailingAction}\n </span>\n )}\n </div>\n );\n});\n\n/**\n * The plain `<input>` element with the field wiring and no icon slots — for `InputGroup` and\n * compositions that place their own adornments. `Input` is built on it.\n */\nexport interface InputControlProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {\n size?: InputSize;\n invalid?: boolean;\n}\n\nexport const InputControl = forwardRef<HTMLInputElement, InputControlProps>(\n function InputControl({ size: sizeProp, invalid = false, className, ...props }, ref) {\n const size = useControlSize(sizeProp);\n const field = useFieldControl();\n const isInvalid = invalid || !!field['aria-invalid'];\n const isDisabled = props.disabled ?? field.disabled;\n\n return (\n <input\n ref={ref}\n // A container's default control size is reported so a test — and a caller reading\n // the DOM — can see which size actually won, rather than inferring it from classes.\n data-size={size}\n // Field wiring first so an explicit prop from the caller still wins.\n {...field}\n // Inside a `Field required`, the native constraint too, so a form post is blocked while empty.\n required={field['aria-required']}\n className={clsx(inputControlClasses(size, isInvalid, isDisabled), className)}\n {...props}\n />\n );\n },\n);\n","import { forwardRef, type TextareaHTMLAttributes } from 'react';\nimport clsx from 'clsx';\nimport { type InputSize } from './input';\nimport { useControlSize } from './control-size';\nimport { useFieldControl } from './field';\n\n// Figma: large textarea inner height ~80px, medium ~68px, small ~52px\nconst textareaBase: Record<InputSize, string> = {\n lg: 'min-h-20 px-4 py-3.5 text-body',\n md: 'min-h-[68px] px-3 py-2.5 text-body-sm',\n sm: 'min-h-[52px] px-2 py-[5px] text-body-tiny',\n};\n\nexport interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {\n size?: InputSize;\n /** Red border and `aria-invalid`. Inside a `Field`, a `FieldError` with a message sets this. */\n invalid?: boolean;\n}\n\n/**\n * A multi-line text input. Bare from 0.10.0: no label, hint or error of its own. Put it in a\n * `Field` with a `FieldLabel` (and `FieldHint` / `FieldError`), or give it an `aria-label`.\n */\nexport const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(\n function Textarea({ size: sizeProp, invalid = false, className, ...props }, ref) {\n const size = useControlSize(sizeProp);\n const field = useFieldControl();\n const isInvalid = invalid || !!field['aria-invalid'];\n const isDisabled = props.disabled ?? field.disabled;\n\n return (\n <textarea\n ref={ref}\n data-size={size}\n {...field}\n // Inside a `Field required`, the native constraint too, so a form post is blocked while empty.\n required={field['aria-required']}\n className={clsx(\n 'w-full resize-y rounded-lg border outline-none transition-colors',\n 'bg-default text-default',\n 'placeholder:text-default-tertiary',\n 'focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-default',\n textareaBase[size],\n isDisabled\n ? 'cursor-not-allowed resize-none border-disabled bg-disabled text-disabled placeholder:text-disabled'\n : isInvalid\n ? 'border-danger-secondary focus-visible:border-danger focus-visible:ring-danger'\n : 'border-default focus-visible:border-brand focus-visible:ring-brand',\n // `enabled:`: a disabled textarea also matches `:read-only` (see Input).\n 'enabled:read-only:cursor-default enabled:read-only:resize-none enabled:read-only:bg-default-secondary',\n className,\n )}\n {...props}\n />\n );\n },\n);\n\n/** @deprecated Since 0.10.0 `Textarea` is the bare control. Use `Textarea`. */\nexport const TextareaControl = Textarea;\n/** @deprecated Since 0.10.0. Use `TextareaProps`. */\nexport type TextareaControlProps = TextareaProps;\n","import {\n forwardRef,\n useState,\n type ChangeEvent,\n type ReactNode,\n type SelectHTMLAttributes,\n} from 'react';\nimport clsx from 'clsx';\nimport { ChevronDownIcon } from 'lucide-react';\n\nimport { devWarn } from '../../lib/dev-warn';\nimport { useControlSize } from './control-size';\nimport { useFieldContext, useFieldControl } from './field';\nimport { type InputSize } from './input';\nimport type { SelectOption, SelectOptionGroup } from './select';\n\n/** The same geometry as `SelectControl`'s trigger, so the two sit side by side unchanged. */\nconst selectBase: Record<InputSize, string> = {\n lg: 'h-12 pl-4 pr-9 text-body',\n md: 'h-9 pl-3 pr-7 text-body-sm',\n sm: 'h-6 pl-2 pr-5 text-body-tiny',\n};\n\nconst chevronPos: Record<InputSize, { right: string; size: string }> = {\n lg: { right: 'right-4', size: 'size-5' },\n md: { right: 'right-3', size: 'size-4' },\n sm: { right: 'right-2', size: 'size-3' },\n};\n\nfunction isGroup(entry: SelectOption | SelectOptionGroup): entry is SelectOptionGroup {\n return 'options' in entry;\n}\n\nfunction renderOptions(options: (SelectOption | SelectOptionGroup)[]) {\n return options.map((entry, index) =>\n isGroup(entry) ? (\n <optgroup key={`group-${index}`} label={entry.label}>\n {entry.options.map((option) => (\n <option key={option.value} value={option.value} disabled={option.disabled}>\n {option.label}\n </option>\n ))}\n </optgroup>\n ) : (\n <option key={entry.value} value={entry.value} disabled={entry.disabled}>\n {entry.label}\n </option>\n ),\n );\n}\n\n// ── NativeSelect ────────────────────────────────────────────────────────\n\nexport interface NativeSelectProps\n extends Omit<SelectHTMLAttributes<HTMLSelectElement>, 'size' | 'children'> {\n /**\n * Flat options, or groups, which render as `<optgroup>`. The same types as `Select`, so\n * moving a field between the two is a rename. Pass `children` instead for hand-written\n * `<option>`s.\n */\n options?: (SelectOption | SelectOptionGroup)[];\n children?: ReactNode;\n size?: InputSize;\n /** Red border and `aria-invalid`. Inside a `Field`, a `FieldError` with a message sets this. */\n invalid?: boolean;\n /**\n * A first, disabled `<option value=\"\">`, shown in the muted placeholder colour while it is\n * the value. An uncontrolled select with a placeholder starts on it; without one the browser\n * would select the first real option, and the field would look filled in when it isn't.\n * With `required`, the empty value blocks submit, as with any native select.\n */\n placeholder?: string;\n}\n\n/**\n * A single-select control on the browser's own `<select>`, styled like `Select`.\n *\n * Use it for form fields, and anywhere on a phone: the OS draws the picker (the iOS wheel, the\n * Android sheet), it is fast with long lists, and it submits and validates as any form control\n * does, `required` included, with `register` in react-hook-form. Use `Select` where the open\n * list has to look like the `DropdownMenu` and `Combobox` panels beside it, e.g. in a filter\n * bar. This mirrors shadcn/ui, which ships `NativeSelect` beside `Select` for the same reason.\n *\n * `onChange` is the native event (`event.target.value`), not `onValueChange`. The trade is\n * the one every native select makes: the open list can't be styled.\n *\n * Bare from 0.10.0: no label, hint or error of its own. Put it in a `Field` with a\n * `FieldLabel`, or give it an `aria-label`.\n */\nexport const NativeSelect = forwardRef<HTMLSelectElement, NativeSelectProps>(\n function NativeSelect(\n {\n options,\n children,\n size: sizeProp,\n invalid = false,\n placeholder,\n value,\n defaultValue,\n onChange,\n className,\n ...props\n },\n ref,\n ) {\n const size = useControlSize(sizeProp);\n const field = useFieldControl();\n const fieldContext = useFieldContext();\n\n // Starting an uncontrolled select on the placeholder: see the `placeholder` prop.\n const initial = defaultValue ?? (placeholder !== undefined && value === undefined ? '' : undefined);\n // Tracked only to colour the placeholder. The DOM still owns an uncontrolled value.\n const [uncontrolled, setUncontrolled] = useState(initial);\n const current = value ?? uncontrolled;\n const showingPlaceholder = placeholder !== undefined && (current === '' || current === undefined);\n\n const isInvalid = invalid || !!field['aria-invalid'];\n const isDisabled = props.disabled ?? field.disabled;\n\n if (!fieldContext && !props['aria-label'] && !props['aria-labelledby'] && !props.id) {\n devWarn(\n 'NativeSelect outside a Field needs aria-label, aria-labelledby, or an id a <label> points at.',\n );\n }\n\n const handleChange = (event: ChangeEvent<HTMLSelectElement>) => {\n if (value === undefined) setUncontrolled(event.target.value);\n onChange?.(event);\n };\n\n const cp = chevronPos[size];\n\n return (\n <div className=\"relative flex items-center\">\n <select\n ref={ref}\n data-size={size}\n data-placeholder={showingPlaceholder || undefined}\n {...field}\n // Inside a `Field required`, the native constraint too, so a form post is blocked while empty.\n required={field['aria-required']}\n value={value}\n defaultValue={value === undefined ? initial : undefined}\n onChange={handleChange}\n className={clsx(\n 'w-full appearance-none rounded-lg border outline-none transition-colors',\n 'bg-default text-default data-[placeholder]:text-default-tertiary',\n 'focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-default',\n selectBase[size],\n isDisabled\n ? 'cursor-not-allowed border-disabled bg-disabled text-disabled'\n : isInvalid\n ? 'border-danger-secondary focus-visible:border-danger focus-visible:ring-danger'\n : 'border-default focus-visible:border-brand focus-visible:ring-brand',\n className,\n )}\n {...props}\n disabled={isDisabled}\n aria-invalid={isInvalid || undefined}\n >\n {placeholder !== undefined && (\n <option value=\"\" disabled>\n {placeholder}\n </option>\n )}\n {options ? renderOptions(options) : children}\n </select>\n <span\n aria-hidden\n className={clsx(\n 'pointer-events-none absolute',\n cp.right,\n cp.size,\n 'flex items-center justify-center',\n isDisabled ? 'text-icon-disabled' : 'text-icon-default-secondary',\n )}\n >\n <ChevronDownIcon className=\"size-full\" />\n </span>\n </div>\n );\n },\n);\n\n/** @deprecated Since 0.10.0 `NativeSelect` is the bare control. Use `NativeSelect`. */\nexport const NativeSelectControl = NativeSelect;\n/** @deprecated Since 0.10.0. Use `NativeSelectProps`. */\nexport type NativeSelectControlProps = NativeSelectProps;\n","import {\n forwardRef,\n useId,\n useMemo,\n useRef,\n useState,\n type ChangeEventHandler,\n type FocusEventHandler,\n type InputHTMLAttributes,\n} from 'react';\nimport clsx from 'clsx';\nimport { CalendarIcon } from 'lucide-react';\nimport { composeRefs } from '../../lib/slot';\nimport { Popover, PopoverContent, PopoverTrigger } from '../overlays/popover';\nimport { Calendar } from './calendar';\nimport { type InputSize } from './input';\nimport { useControlSize } from './control-size';\nimport { useFieldContext, useFieldControl } from './field';\n\nexport interface DatePickerProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'value' | 'defaultValue'> {\n size?: InputSize;\n /** Red border and `aria-invalid`. Inside a `Field`, a `FieldError` with a message sets this. */\n invalid?: boolean;\n /** The selected date as an ISO `YYYY-MM-DD` string, `''` for none. Controlled. */\n value?: string;\n /** Initial ISO date when uncontrolled. */\n defaultValue?: string;\n /**\n * Called with a real change event from the underlying date input, so\n * `onChange={(e) => set(e.target.value)}` keeps working; `e.target.value` is the ISO date.\n */\n onChange?: ChangeEventHandler<HTMLInputElement>;\n /** The new ISO date. New in 0.7.1; an alternative to reading `onChange`'s event. */\n onValueChange?: (value: string) => void;\n /** Shown when there is no date. Default \"Pick a date\". */\n placeholder?: string;\n /** BCP 47 tag for the shown date and the calendar. Default: the browser's. */\n locale?: string;\n /** 0 = Sunday, 1 = Monday. Default `1`. */\n weekStartsOn?: 0 | 1;\n /** `dropdown` (default) puts month and year selects in the calendar header. */\n captionLayout?: 'label' | 'dropdown';\n /** First year in the year select. Default `min`'s year, else 100 years ago. */\n startYear?: number;\n /** Last year in the year select. Default `max`'s year, else 10 years ahead. */\n endYear?: number;\n}\n\nconst triggerBase: Record<InputSize, string> = {\n lg: 'h-12 px-5 pr-12 text-body',\n md: 'h-9 px-4 pr-8 text-body-sm',\n sm: 'h-6 px-3 pr-6 text-body-tiny',\n};\n\nconst iconWrap: Record<InputSize, { right: string; size: string }> = {\n lg: { right: 'right-4', size: 'size-5' },\n md: { right: 'right-3', size: 'size-4' },\n sm: { right: 'right-2', size: 'size-3' },\n};\n\nconst ISO = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\n\nfunction parseIso(value: string | undefined): Date | null {\n const match = value ? ISO.exec(value) : null;\n if (!match) return null;\n const date = new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n return Number.isNaN(date.getTime()) ? null : date;\n}\n\nfunction toIso(date: Date): string {\n const pad = (n: number) => String(n).padStart(2, '0');\n return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;\n}\n\n/**\n * A date field that opens the library's `Calendar` in a `Popover`, the shape of shadcn/ui's\n * Date Picker. Rebuilt in 0.7.1: through 0.7.0 it was a native `<input type=\"date\">`, whose\n * picker is the browser's own and differs in Chromium, Firefox and Safari (Firefox draws its\n * own button inside the field and cannot be restyled), so it never matched `Calendar`.\n *\n * - The trigger is a `role=\"combobox\"` button with `aria-haspopup=\"dialog\"`, named by the label\n * and then the date (\"Start date 22 Oct 2026\"); unlike a plain button, that role carries the\n * `aria-required` and `aria-invalid` that `Field` supplies.\n * - Opening moves focus into the calendar grid, on the selected date or today. Picking a date\n * closes the popover and returns focus to the trigger; Escape closes it without a change.\n * - The month and year selects (`captionLayout=\"dropdown\"`, the default) reach a far-away date\n * in two choices instead of a PageUp per month.\n * - Bare from 0.10.0: no label, hint or error of its own. Put it in a `Field` with a\n * `FieldLabel`, or give it an `aria-label`. The calendar dialog takes its name from either.\n * - A real, invisible `<input type=\"date\">` keeps the old contract: it carries `name`, `value`,\n * `min`, `max` and `required` for forms and native validation, the forwarded ref points at\n * it, and `onChange` receives its genuine change event. When validation focuses it, focus is\n * handed to the trigger.\n */\nexport const DatePicker = forwardRef<HTMLInputElement, DatePickerProps>(function DatePicker(\n {\n size: sizeProp,\n invalid = false,\n className,\n disabled,\n required,\n value: valueProp,\n defaultValue,\n onChange,\n onValueChange,\n onBlur,\n placeholder = 'Pick a date',\n locale,\n weekStartsOn,\n captionLayout = 'dropdown',\n startYear,\n endYear,\n min,\n max,\n 'aria-label': ariaLabel,\n ...props\n },\n ref,\n) {\n const size = useControlSize(sizeProp);\n\n return (\n <DateControl\n ref={ref}\n size={size}\n invalid={invalid}\n disabled={disabled}\n required={required}\n value={valueProp}\n defaultValue={defaultValue}\n onChange={onChange}\n onValueChange={onValueChange}\n onBlur={onBlur}\n placeholder={placeholder}\n locale={locale}\n weekStartsOn={weekStartsOn}\n captionLayout={captionLayout}\n startYear={startYear}\n endYear={endYear}\n min={typeof min === 'number' ? String(min) : min}\n max={typeof max === 'number' ? String(max) : max}\n label={ariaLabel}\n className={className}\n inputProps={props}\n />\n );\n});\n\ninterface DateControlProps {\n size: InputSize;\n invalid: boolean;\n disabled?: boolean;\n required?: boolean;\n value?: string;\n defaultValue?: string;\n onChange?: ChangeEventHandler<HTMLInputElement>;\n onValueChange?: (value: string) => void;\n onBlur?: FocusEventHandler<HTMLInputElement>;\n placeholder: string;\n locale?: string;\n weekStartsOn?: 0 | 1;\n captionLayout: 'label' | 'dropdown';\n startYear?: number;\n endYear?: number;\n min?: string;\n max?: string;\n /** The `aria-label`, when there is no `FieldLabel`. */\n label?: string;\n className?: string;\n inputProps: Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'value' | 'defaultValue'>;\n}\n\nconst DateControl = forwardRef<HTMLInputElement, DateControlProps>(function DateControl(\n {\n size,\n invalid,\n disabled,\n required,\n value,\n defaultValue,\n onChange,\n onValueChange,\n onBlur,\n placeholder,\n locale,\n weekStartsOn,\n captionLayout,\n startYear,\n endYear,\n min,\n max,\n label: ariaLabel,\n className,\n inputProps: { name, ...inputProps },\n },\n ref,\n) {\n const field = useFieldControl();\n const fieldContext = useFieldContext();\n const valueId = useId();\n const dialogId = useId();\n const [open, setOpen] = useState(false);\n const [internal, setInternal] = useState(defaultValue ?? '');\n const iso = value ?? internal;\n const date = parseIso(iso);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n\n const isInvalid = invalid || !!field['aria-invalid'];\n const isDisabled = disabled ?? field.disabled;\n const isRequired = required || !!field['aria-required'];\n // The calendar dialog is named after the field: the FieldLabel's text, else the aria-label.\n // Read when it opens, since the label is a sibling this control can't see as a prop.\n const [label, setLabel] = useState<string | undefined>(ariaLabel);\n const handleOpenChange = (next: boolean) => {\n if (next) {\n const labelText = fieldContext && typeof document !== 'undefined' ? document.getElementById(fieldContext.labelId)?.textContent : null;\n setLabel(labelText?.trim() || ariaLabel);\n }\n setOpen(next);\n };\n const iw = iconWrap[size];\n const formatter = useMemo(() => new Intl.DateTimeFormat(locale, { dateStyle: 'medium' }), [locale]);\n\n const commit = (next: Date) => {\n const nextIso = toIso(next);\n if (value === undefined) setInternal(nextIso);\n onValueChange?.(nextIso);\n // Set the real input's value the way the browser would and let React see the event, so\n // `onChange` gets a genuine ChangeEvent. Assigning `.value` directly would be swallowed by\n // React's value tracker.\n const input = inputRef.current;\n if (input) {\n Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')?.set?.call(input, nextIso);\n input.dispatchEvent(new Event('input', { bubbles: true }));\n }\n setOpen(false);\n };\n\n return (\n <div className={clsx('relative flex items-center', className)}>\n <Popover open={open} onOpenChange={handleOpenChange}>\n <PopoverTrigger asChild>\n <button\n ref={triggerRef}\n type=\"button\"\n // `role=\"combobox\"` with a dialog popup (APG date-picker combobox). A plain button\n // may not carry aria-required / aria-invalid, which Field supplies.\n role=\"combobox\"\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n // Only while open, so it never points at an element that does not exist.\n aria-controls={open ? dialogId : undefined}\n // Named by the label, then the value: \"Start date 22 Oct 2026\". A <label for> does\n // not name a button the way it named the old <input>.\n aria-labelledby={fieldContext ? `${fieldContext.labelId} ${valueId}` : undefined}\n aria-label={fieldContext ? undefined : ariaLabel}\n data-size={size}\n {...field}\n aria-invalid={isInvalid || undefined}\n aria-required={isRequired || undefined}\n disabled={isDisabled}\n onBlur={onBlur as unknown as FocusEventHandler<HTMLButtonElement>}\n className={clsx(\n 'w-full appearance-none rounded-lg border text-left outline-none transition-colors',\n 'bg-default text-default',\n 'focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-default',\n triggerBase[size],\n isDisabled\n ? 'cursor-not-allowed border-disabled bg-disabled text-disabled'\n : isInvalid\n ? 'border-danger-secondary focus-visible:border-danger focus-visible:ring-danger'\n : 'border-default focus-visible:border-brand focus-visible:ring-brand',\n )}\n >\n <span id={valueId} className={clsx('block truncate', !date && 'text-default-tertiary')}>\n {date ? formatter.format(date) : placeholder}\n </span>\n </button>\n </PopoverTrigger>\n <PopoverContent\n ref={contentRef}\n id={dialogId}\n label={label ? `Choose ${label.toLowerCase()}` : 'Choose date'}\n align=\"start\"\n className=\"w-auto max-w-none p-0\"\n onOpenAutoFocus={(event) => {\n // Land on the grid's roving cell (the selected date, else today), not on the first\n // focusable element, which would be the month select.\n event.preventDefault();\n contentRef.current?.querySelector<HTMLElement>('[role=\"grid\"] [tabindex=\"0\"]')?.focus();\n }}\n >\n <Calendar\n value={date}\n onSelect={commit}\n min={parseIso(min) ?? undefined}\n max={parseIso(max) ?? undefined}\n locale={locale}\n weekStartsOn={weekStartsOn}\n captionLayout={captionLayout}\n startYear={startYear}\n endYear={endYear}\n label={label ?? 'Calendar'}\n className=\"border-0\"\n />\n </PopoverContent>\n </Popover>\n\n <span\n aria-hidden\n className={clsx(\n 'pointer-events-none absolute',\n iw.right,\n iw.size,\n 'flex items-center justify-center',\n isDisabled ? 'text-icon-disabled' : 'text-icon-default-secondary',\n )}\n >\n <CalendarIcon className=\"size-full\" />\n </span>\n\n {/* The old contract, kept: a real date input for forms, native `required`/`min`/`max`\n validation, the forwarded ref and `onChange`. Invisible, out of the tab order and\n hidden from assistive tech, which hears the trigger instead. */}\n <input\n ref={composeRefs(ref, inputRef)}\n type=\"date\"\n aria-hidden\n tabIndex={-1}\n {...inputProps}\n name={name}\n value={iso}\n min={min}\n max={max}\n required={isRequired}\n disabled={isDisabled}\n onChange={(event) => {\n if (value === undefined) setInternal(event.target.value);\n onChange?.(event);\n }}\n onFocus={() => triggerRef.current?.focus()}\n className=\"pointer-events-none absolute inset-x-0 bottom-0 h-px w-full opacity-0\"\n />\n </div>\n );\n});\n","import {\n createContext,\n forwardRef,\n useContext,\n useId,\n useMemo,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from 'react';\nimport { Popover as PopoverPrimitive } from 'radix-ui';\n\nimport { cn } from '../../lib/cn';\nimport { composeRefs } from '../../lib/slot';\nimport type { FloatingAlign, FloatingSide } from './floating';\nimport { deferEscapeToInnerPopup } from './overlay-stack';\nimport { usePortalContainer } from './portal';\n\n/** Shares the trigger's element, so the panel can be labelled by whatever id it really has. */\nconst PopoverTriggerNode = createContext<{\n node: HTMLElement | null;\n setNode: (node: HTMLElement | null) => void;\n modal: boolean;\n} | null>(null);\n\nexport interface PopoverProps {\n children: ReactNode;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n /**\n * Trap focus, lock scroll and hide the rest of the page from assistive tech. Default\n * `false`.\n *\n * A popover is normally non-modal: the page behind stays usable, and Tab moves out of the\n * panel and on through the document. Set `modal` when the panel is a small form whose\n * background must not be touched until it is dismissed.\n */\n modal?: boolean;\n}\n\n/**\n * A floating panel anchored to a trigger, for **interactive** content.\n *\n * The distinction from `Tooltip` is not visual and it matters: a tooltip cannot be hovered\n * into or focused, so anything interactive inside one is unreachable. If the panel holds a\n * link, a button or a field, it has to be a popover — which means a real trigger with\n * `aria-expanded`/`aria-controls`, focus moving into the panel on open, and focus returning\n * to the trigger on close.\n *\n * Built on Radix Popover from 0.7.0. Escape and outside press act on the topmost layer only,\n * so a popover inside a `Modal` closes without taking the modal with it, and focus leaving a\n * non-modal panel dismisses it rather than stranding it open.\n */\nexport function Popover({ children, open, defaultOpen, onOpenChange, modal = false }: PopoverProps) {\n const [node, setNode] = useState<HTMLElement | null>(null);\n const trigger = useMemo(() => ({ node, setNode, modal }), [node, modal]);\n\n return (\n <PopoverPrimitive.Root\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n modal={modal}\n >\n <PopoverTriggerNode.Provider value={trigger}>{children}</PopoverTriggerNode.Provider>\n </PopoverPrimitive.Root>\n );\n}\n\nexport interface PopoverTriggerProps extends HTMLAttributes<HTMLButtonElement> {\n children: ReactNode;\n /** Render onto the single child (e.g. a `Button`) instead of a bare `<button>`. */\n asChild?: boolean;\n}\n\n/**\n * Toggles the popover. Radix sets `aria-haspopup=\"dialog\"`, `aria-expanded`,\n * `aria-controls` and `data-state`, and composes your handlers with its own rather than\n * replacing them (0.6's `onClick` overrode the toggle).\n */\nexport const PopoverTrigger = forwardRef<HTMLButtonElement, PopoverTriggerProps>(\n function PopoverTrigger(props, ref) {\n const trigger = useContext(PopoverTriggerNode);\n const fallbackId = useId();\n return (\n <PopoverPrimitive.Trigger\n ref={composeRefs(ref, trigger?.setNode)}\n // An id to label the panel by. An `asChild` child's own `id` wins, and the panel\n // reads the real one off the node, so either way the reference resolves.\n id={props.id ?? fallbackId}\n {...props}\n />\n );\n },\n);\n\nexport interface PopoverContentProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n side?: FloatingSide;\n align?: FloatingAlign;\n sideOffset?: number;\n /** Accessible name for the panel. Falls back to being labelled by the trigger. */\n label?: string;\n /** Where to portal the panel. Defaults to the enclosing dialog, else `document.body`. */\n container?: HTMLElement | null;\n /** Radix's open auto-focus hook: `preventDefault()` and focus something else, e.g. a calendar's selected day. */\n onOpenAutoFocus?: (event: Event) => void;\n}\n\nexport const PopoverContent = forwardRef<HTMLDivElement, PopoverContentProps>(\n function PopoverContent(\n { children, side = 'bottom', align = 'center', sideOffset = 8, label, container, className, onOpenAutoFocus, ...rest },\n ref,\n ) {\n const trigger = useContext(PopoverTriggerNode);\n const inherited = usePortalContainer();\n\n return (\n <PopoverPrimitive.Portal container={container ?? inherited ?? undefined}>\n <PopoverPrimitive.Content\n ref={ref}\n side={side}\n align={align}\n sideOffset={sideOffset}\n collisionPadding={8}\n onOpenAutoFocus={onOpenAutoFocus}\n onEscapeKeyDown={(event) => void deferEscapeToInnerPopup(event)}\n // Radix traps focus and hides the page for a modal popover but does not say so.\n aria-modal={trigger?.modal || undefined}\n aria-label={label}\n aria-labelledby={label ? undefined : trigger?.node?.id || undefined}\n className={cn(\n 'z-popover max-w-[min(22rem,calc(100vw-2rem))] rounded-xl border border-default bg-default p-4 shadow-400',\n 'focus:outline-none',\n className,\n )}\n {...rest}\n >\n {children}\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n );\n },\n);\n\n/** Closes the enclosing popover, e.g. an \"Apply\" or \"Cancel\" button. New in 0.7.0. */\nexport const PopoverClose = forwardRef<HTMLButtonElement, HTMLAttributes<HTMLButtonElement> & { asChild?: boolean }>(\n function PopoverClose(props, ref) {\n return <PopoverPrimitive.Close ref={ref} {...props} />;\n },\n);\n\n/** Positions the panel against an element other than the trigger. New in 0.7.0. */\nexport const PopoverAnchor = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement> & { asChild?: boolean }>(\n function PopoverAnchor(props, ref) {\n return <PopoverPrimitive.Anchor ref={ref} {...props} />;\n },\n);\n","import {\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n} from 'react';\nimport clsx from 'clsx';\nimport { cn } from '../../lib/cn';\nimport { ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';\nimport { IconButton } from './icon-button';\n\nexport type CalendarMode = 'single' | 'range';\n\nexport interface DateRange {\n from: Date | null;\n to: Date | null;\n}\n\nexport interface CalendarProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onSelect'> {\n mode?: CalendarMode;\n /** Selected date in `single` mode. */\n value?: Date | null;\n /** Selected range in `range` mode. */\n range?: DateRange;\n onSelect?: (value: Date) => void;\n onRangeChange?: (range: DateRange) => void;\n /** Month shown on mount. Defaults to the selection's month, else today. */\n defaultMonth?: Date;\n min?: Date;\n max?: Date;\n /** Return `true` to disable a day. Combined with `min`/`max`. */\n isDateDisabled?: (date: Date) => boolean;\n /** 0 = Sunday, 1 = Monday. Default `1`. */\n weekStartsOn?: 0 | 1;\n /** BCP 47 tag for month, weekday and announced day names. Default: the browser's. */\n locale?: string;\n /** Names the grid. Default `Calendar`. */\n label?: string;\n /**\n * `label` (default) shows the month as text between the arrows. `dropdown` replaces it with\n * month and year selects, for dates far from today (a date of birth, a start date years ago),\n * which would otherwise take a dozen PageUp presses a year to reach. Same name and behaviour\n * as shadcn/react-day-picker's `captionLayout=\"dropdown\"`. New in 0.7.1.\n */\n captionLayout?: 'label' | 'dropdown';\n /** First year in the year select. Default `min`'s year, else 100 years ago. */\n startYear?: number;\n /** Last year in the year select. Default `max`'s year, else 10 years ahead. */\n endYear?: number;\n}\n\nconst CAPTION_SELECT = clsx(\n 'h-7 appearance-none rounded-md border border-default bg-default px-2 text-body-xs font-medium text-default',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default',\n);\n\n// ── Date helpers ───────────────────────────────────────────────────────────────\n// Deliberately no date library. Everything below is calendar-grid arithmetic on local\n// dates, which is a few dozen lines; pulling in date-fns for it would be the largest\n// dependency in the package.\n\nconst startOfDay = (d: Date) => new Date(d.getFullYear(), d.getMonth(), d.getDate());\nconst sameDay = (a: Date | null | undefined, b: Date | null | undefined) =>\n !!a && !!b && a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();\nconst addDays = (d: Date, n: number) => new Date(d.getFullYear(), d.getMonth(), d.getDate() + n);\nconst addMonths = (d: Date, n: number) => new Date(d.getFullYear(), d.getMonth() + n, 1);\nconst isBefore = (a: Date, b: Date) => startOfDay(a).getTime() < startOfDay(b).getTime();\nconst isAfter = (a: Date, b: Date) => startOfDay(a).getTime() > startOfDay(b).getTime();\nconst inRange = (d: Date, from: Date, to: Date) =>\n startOfDay(d).getTime() > startOfDay(from).getTime() &&\n startOfDay(d).getTime() < startOfDay(to).getTime();\n\n/** Six weeks of cells so the grid never changes height as the month changes. */\nfunction monthGrid(month: Date, weekStartsOn: 0 | 1): Date[] {\n const first = new Date(month.getFullYear(), month.getMonth(), 1);\n const offset = (first.getDay() - weekStartsOn + 7) % 7;\n const start = addDays(first, -offset);\n return Array.from({ length: 42 }, (_, i) => addDays(start, i));\n}\n\n/**\n * Month grid. Matches Figma's `Calendar`, `Calendar Button`\n * (`State: Default | Hover | Active | Disabled | Range | Range Disabled | Hidden`),\n * `Calendar Select Group` and `Calendar Month/Year Field`.\n *\n * The code had no calendar at all — `DatePicker` was a bare `<input type=\"date\">` with\n * Chromium-only indicator styling, so there was nothing to build a range picker on, no\n * locale control and no min/max navigation.\n *\n * The keyboard model is the APG date-grid pattern, and it is the whole reason this is not\n * just a table of buttons:\n *\n * - **One tab stop.** Tab enters the grid once and leaves it; arrows move within. A grid of\n * 42 individually tabbable buttons takes 42 presses to get past.\n * - **Arrows cross month boundaries.** Pressing Left on the 1st moves to the previous\n * month's last day and pages the view, rather than dead-ending.\n * - **PageUp/PageDown** move by month, **Shift+PageUp/PageDown** by year, **Home/End** to the\n * start/end of the week.\n * - Each day's accessible name is the full date, not the number — \"14\" tells a screen\n * reader user nothing.\n */\nexport function Calendar({\n mode = 'single',\n value,\n range,\n onSelect,\n onRangeChange,\n defaultMonth,\n min,\n max,\n isDateDisabled,\n weekStartsOn = 1,\n locale,\n label = 'Calendar',\n captionLayout = 'label',\n startYear,\n endYear,\n className,\n ...rest\n}: CalendarProps) {\n const today = useMemo(() => startOfDay(new Date()), []);\n const gridId = useId();\n\n const [month, setMonth] = useState<Date>(\n () => defaultMonth ?? value ?? range?.from ?? today,\n );\n // The focused cell, which is what the roving tabindex follows. Distinct from the\n // selection: you can arrow around without selecting.\n const [focusedDate, setFocusedDate] = useState<Date>(\n () => value ?? range?.from ?? today,\n );\n const cellRefs = useRef(new Map<string, HTMLButtonElement>());\n\n const monthFormatter = useMemo(\n () => new Intl.DateTimeFormat(locale, { month: 'long', year: 'numeric' }),\n [locale],\n );\n const dayNameFormatter = useMemo(\n () => new Intl.DateTimeFormat(locale, { weekday: 'short' }),\n [locale],\n );\n const monthNameFormatter = useMemo(\n () => new Intl.DateTimeFormat(locale, { month: 'long' }),\n [locale],\n );\n const fullDateFormatter = useMemo(\n () => new Intl.DateTimeFormat(locale, { weekday: 'long', day: 'numeric', month: 'long', year: 'numeric' }),\n [locale],\n );\n\n const disabled = useCallback(\n (date: Date) => {\n if (min && isBefore(date, min)) return true;\n if (max && isAfter(date, max)) return true;\n return isDateDisabled?.(date) ?? false;\n },\n [min, max, isDateDisabled],\n );\n\n const key = (d: Date) => `${d.getFullYear()}-${d.getMonth()}-${d.getDate()}`;\n\n // Set by keyboard moves only. Focus must not be stolen on mount, or when a click has\n // already put focus on the cell the user pressed.\n const pendingFocus = useRef(false);\n\n const focusDate = useCallback((date: Date) => {\n pendingFocus.current = true;\n setFocusedDate(date);\n // A move across the month boundary pages the view; the target cell does not exist\n // until after that commit, which is why focus is applied in the effect below rather\n // than here.\n setMonth((current) =>\n current.getFullYear() === date.getFullYear() && current.getMonth() === date.getMonth()\n ? current\n : new Date(date.getFullYear(), date.getMonth(), 1),\n );\n }, []);\n\n useEffect(() => {\n if (!pendingFocus.current) return;\n const node = cellRefs.current.get(key(focusedDate));\n if (node) {\n node.focus();\n pendingFocus.current = false;\n }\n // If the node is still absent the month is mid-change; the next commit re-runs this.\n }, [focusedDate, month]);\n\n const select = (date: Date) => {\n if (disabled(date)) return;\n setFocusedDate(date);\n\n if (mode === 'single') {\n onSelect?.(date);\n return;\n }\n\n const current = range ?? { from: null, to: null };\n // Anchor a new range when there is none, when one is already complete, or when the\n // click lands before the anchor — the last case is what makes dragging backwards work\n // instead of producing an inverted range.\n if (!current.from || current.to || isBefore(date, current.from)) {\n onRangeChange?.({ from: date, to: null });\n } else {\n onRangeChange?.({ from: current.from, to: date });\n }\n };\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const moves: Record<string, () => Date> = {\n ArrowLeft: () => addDays(focusedDate, -1),\n ArrowRight: () => addDays(focusedDate, 1),\n ArrowUp: () => addDays(focusedDate, -7),\n ArrowDown: () => addDays(focusedDate, 7),\n Home: () => addDays(focusedDate, -((focusedDate.getDay() - weekStartsOn + 7) % 7)),\n End: () => addDays(focusedDate, 6 - ((focusedDate.getDay() - weekStartsOn + 7) % 7)),\n // Shift moves a year (APG date-picker dialog); without it, a month.\n PageUp: () => new Date(focusedDate.getFullYear() - (event.shiftKey ? 1 : 0), focusedDate.getMonth() - (event.shiftKey ? 0 : 1), focusedDate.getDate()),\n PageDown: () => new Date(focusedDate.getFullYear() + (event.shiftKey ? 1 : 0), focusedDate.getMonth() + (event.shiftKey ? 0 : 1), focusedDate.getDate()),\n };\n\n const move = moves[event.key];\n if (move) {\n event.preventDefault();\n focusDate(move());\n }\n };\n\n const firstYear = startYear ?? min?.getFullYear() ?? today.getFullYear() - 100;\n const lastYear = endYear ?? max?.getFullYear() ?? today.getFullYear() + 10;\n const years = Array.from({ length: Math.max(0, lastYear - firstYear) + 1 }, (_, i) => firstYear + i);\n const monthOutOfRange = (m: number) =>\n (!!min && (month.getFullYear() < min.getFullYear() || (month.getFullYear() === min.getFullYear() && m < min.getMonth()))) ||\n (!!max && (month.getFullYear() > max.getFullYear() || (month.getFullYear() === max.getFullYear() && m > max.getMonth())));\n const showMonth = (year: number, m: number) => {\n let next = new Date(year, m, 1);\n if (min && next < new Date(min.getFullYear(), min.getMonth(), 1)) next = new Date(min.getFullYear(), min.getMonth(), 1);\n if (max && next > new Date(max.getFullYear(), max.getMonth(), 1)) next = new Date(max.getFullYear(), max.getMonth(), 1);\n setMonth(next);\n // Keep the roving cell inside the shown month, so Tab into the grid lands on it.\n const day = Math.min(focusedDate.getDate(), new Date(next.getFullYear(), next.getMonth() + 1, 0).getDate());\n setFocusedDate(new Date(next.getFullYear(), next.getMonth(), day));\n };\n\n const days = monthGrid(month, weekStartsOn);\n const weekdayNames = days.slice(0, 7).map((d) => dayNameFormatter.format(d));\n\n return (\n <div\n data-slot=\"calendar\"\n className={cn('w-fit rounded-xl border border-default bg-default p-3', className)}\n {...rest}\n >\n <div className=\"mb-2 flex items-center justify-between gap-2\">\n <IconButton\n variant=\"subtle\"\n size=\"sm\"\n aria-label=\"Previous month\"\n disabled={!!min && isBefore(addMonths(month, -1), new Date(min.getFullYear(), min.getMonth(), 1))}\n onClick={() => setMonth(addMonths(month, -1))}\n >\n <ChevronLeftIcon aria-hidden size={16} />\n </IconButton>\n {/* aria-live so paging the month is announced — otherwise a screen reader user\n arrowing past the end of a month has no idea the view moved. */}\n {captionLayout === 'dropdown' ? (\n <div className=\"relative flex items-center gap-1.5\">\n {/* Native selects: one tab stop each, the platform's own list on touch devices,\n and every option already announced. */}\n <select\n aria-label=\"Month\"\n value={month.getMonth()}\n onChange={(event) => showMonth(month.getFullYear(), Number(event.target.value))}\n className={CAPTION_SELECT}\n >\n {Array.from({ length: 12 }, (_, m) => (\n <option key={m} value={m} disabled={monthOutOfRange(m)}>\n {monthNameFormatter.format(new Date(2000, m, 1))}\n </option>\n ))}\n </select>\n <select\n aria-label=\"Year\"\n value={month.getFullYear()}\n onChange={(event) => showMonth(Number(event.target.value), month.getMonth())}\n className={CAPTION_SELECT}\n >\n {years.map((year) => (\n <option key={year} value={year}>\n {year}\n </option>\n ))}\n </select>\n <span aria-live=\"polite\" className=\"sr-only\">\n {monthFormatter.format(month)}\n </span>\n </div>\n ) : (\n <span aria-live=\"polite\" className=\"text-body-sm font-semibold text-default\">\n {monthFormatter.format(month)}\n </span>\n )}\n <IconButton\n variant=\"subtle\"\n size=\"sm\"\n aria-label=\"Next month\"\n disabled={!!max && isAfter(addMonths(month, 1), new Date(max.getFullYear(), max.getMonth(), 1))}\n onClick={() => setMonth(addMonths(month, 1))}\n >\n <ChevronRightIcon aria-hidden size={16} />\n </IconButton>\n </div>\n\n {/* role=\"grid\" with an explicit row/cell structure, so a screen reader announces\n \"column 3, row 2\" and the day headers are tied to the columns. */}\n <div\n role=\"grid\"\n aria-label={label}\n id={gridId}\n // Programmatically focusable but out of the tab sequence: the roving day buttons\n // own the tab stop, and key handling is delegated here so it keeps working while\n // focus moves between cells.\n tabIndex={-1}\n onKeyDown={onKeyDown}\n >\n <div role=\"row\" className=\"mb-1 grid grid-cols-7\">\n {weekdayNames.map((name) => (\n <div\n key={name}\n role=\"columnheader\"\n // The short form is shown; the long form is not needed because each cell\n // announces its own full date.\n className=\"flex h-8 items-center justify-center text-body-tiny font-medium text-default-tertiary\"\n >\n {name}\n </div>\n ))}\n </div>\n\n {Array.from({ length: 6 }, (_, week) => (\n <div key={week} role=\"row\" className=\"grid grid-cols-7\">\n {days.slice(week * 7, week * 7 + 7).map((date) => {\n const outside = date.getMonth() !== month.getMonth();\n const isDisabled = disabled(date);\n const selected =\n mode === 'single'\n ? sameDay(date, value)\n : sameDay(date, range?.from) || sameDay(date, range?.to);\n const between =\n mode === 'range' && range?.from && range?.to\n ? inRange(date, range.from, range.to)\n : false;\n const isFocused = sameDay(date, focusedDate);\n\n return (\n <div role=\"gridcell\" key={key(date)} aria-selected={selected || undefined}>\n <button\n ref={(node) => {\n if (node) cellRefs.current.set(key(date), node);\n else cellRefs.current.delete(key(date));\n }}\n type=\"button\"\n // The roving tab stop: exactly one cell is reachable by Tab.\n tabIndex={isFocused ? 0 : -1}\n disabled={isDisabled}\n aria-label={fullDateFormatter.format(date)}\n aria-current={sameDay(date, today) ? 'date' : undefined}\n onClick={() => select(date)}\n onFocus={() => setFocusedDate(date)}\n className={clsx(\n 'flex size-9 items-center justify-center rounded-lg text-body-sm tabular-nums transition-colors',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default',\n 'disabled:cursor-not-allowed disabled:text-disabled disabled:hover:bg-transparent',\n selected\n ? 'bg-brand font-semibold text-brand-on-brand'\n : between\n ? 'rounded-none bg-brand-tertiary text-default'\n : outside\n ? 'text-default-tertiary hover:bg-default-secondary'\n : 'text-default hover:bg-default-secondary',\n // Today is marked by a ring rather than a fill, so it stays legible\n // when it is also the selected day.\n sameDay(date, today) && !selected && 'ring-1 ring-inset ring-brand-tertiary',\n )}\n >\n {date.getDate()}\n </button>\n </div>\n );\n })}\n </div>\n ))}\n </div>\n </div>\n );\n}\n","import clsx from 'clsx';\nimport { forwardRef, useLayoutEffect, useRef, useState, type ReactNode } from 'react';\nimport { CheckIcon, ChevronRightIcon } from 'lucide-react';\nimport { useElementWidth } from '../../lib/use-element-width';\n\nexport type StepStatus = 'complete' | 'active' | 'upcoming';\n\nexport interface StepItem {\n label: string;\n status: StepStatus;\n}\n\nexport type StepperSize = 'sm' | 'md';\nexport type StepperAlign = 'start' | 'center' | 'end';\n\nexport interface StepperCompactInfo {\n /** Zero-based index of the active step. */\n index: number;\n total: number;\n step: StepItem;\n next: StepItem | undefined;\n}\n\nexport interface StepperProps {\n steps: StepItem[];\n /** Matches Figma's `Size` axis on the `Stepper` component set. */\n size?: StepperSize;\n /** Names the list. Defaults to `Progress`. Override for a non-English UI. */\n label?: string;\n /** Horizontal alignment of the full list within its row. Default `start`. */\n align?: StepperAlign;\n /**\n * `auto` (default) switches to a compact \"Step 2 of 5 · Contact\" summary with a segmented bar\n * whenever the labelled steps don't fit on one line. `never` always shows the full list.\n */\n compact?: 'auto' | 'never';\n /** The compact summary's text, for a non-English UI. Defaults to \"Step n of N · label\" and \"Next: label\". */\n formatCompact?: (info: StepperCompactInfo) => { current: ReactNode; next?: ReactNode };\n /** On the wrapper, from 0.9.0. Through 0.8.x the root was the `<ol>` itself. */\n className?: string;\n}\n\n/**\n * Status words announced after each step's label.\n *\n * Step status was conveyed by colour plus an `aria-hidden` glyph only, so \"complete\" and\n * \"upcoming\" were indistinguishable to a screen reader — `aria-current=\"step\"` marked the\n * active one and nothing said which of the rest were done.\n */\nconst STATUS_TEXT: Record<StepStatus, string> = {\n complete: 'completed',\n active: 'current step',\n upcoming: 'not started',\n};\n\nconst SIZE: Record<StepperSize, { indicator: string; glyph: number; label: string }> = {\n sm: { indicator: 'size-4', glyph: 9, label: 'text-body-tiny' },\n md: { indicator: 'size-5', glyph: 11, label: 'text-body-xs' },\n};\n\nconst ALIGN: Record<StepperAlign, string> = {\n start: '',\n center: 'justify-center',\n end: 'justify-end',\n};\n\nfunction StepIndicator({ status, size }: { status: StepStatus; size: StepperSize }) {\n const s = SIZE[size];\n\n if (status === 'complete') {\n return (\n <span\n aria-hidden\n className={clsx(\n 'flex shrink-0 items-center justify-center rounded-full bg-brand text-brand-on-brand',\n s.indicator,\n )}\n >\n <CheckIcon size={s.glyph} />\n </span>\n );\n }\n\n if (status === 'active') {\n return (\n <span\n aria-hidden\n className={clsx(\n 'flex shrink-0 items-center justify-center rounded-full border-2 border-brand-emphasis',\n s.indicator,\n )}\n >\n <span className=\"size-2.5 rounded-full bg-brand\" />\n </span>\n );\n }\n\n return (\n <span\n aria-hidden\n className={clsx('shrink-0 rounded-full border-2 border-disabled', s.indicator)}\n />\n );\n}\n\nfunction ChevronSeparator() {\n return <ChevronRightIcon className=\"mx-1 size-4 shrink-0 text-default-tertiary\" aria-hidden />;\n}\n\nconst labelClass: Record<StepStatus, string> = {\n complete: 'text-brand font-semibold',\n active: 'text-brand font-semibold',\n upcoming: 'text-disabled font-regular',\n};\n\ninterface StepListProps {\n steps: StepItem[];\n size: StepperSize;\n label: string;\n /** The off-screen twin used to measure the list's natural width: hidden, unnamed. */\n measuring?: boolean;\n className?: string;\n}\n\nconst StepList = forwardRef<HTMLOListElement, StepListProps>(function StepList(\n { steps, size, label, measuring, className },\n ref,\n) {\n const s = SIZE[size];\n return (\n <ol\n ref={ref}\n className={clsx('flex items-center', className)}\n aria-label={measuring ? undefined : label}\n aria-hidden={measuring || undefined}\n >\n {steps.map((step, i) => (\n <li\n // Keyed by label rather than index, so reordering or inserting a step does not\n // reuse the wrong element's state.\n key={step.label}\n className=\"flex items-center\"\n aria-current={step.status === 'active' && !measuring ? 'step' : undefined}\n >\n <span className=\"flex items-center gap-1.5\">\n <StepIndicator status={step.status} size={size} />\n <span className={clsx('whitespace-nowrap', s.label, labelClass[step.status])}>\n {step.label}\n </span>\n {!measuring && <span className=\"sr-only\">, {STATUS_TEXT[step.status]}</span>}\n </span>\n {i < steps.length - 1 && <ChevronSeparator />}\n </li>\n ))}\n </ol>\n );\n});\n\nfunction defaultCompactText({ index, total, step, next }: StepperCompactInfo) {\n return {\n current: (\n <>\n Step {index + 1} of {total}\n <span className=\"font-normal text-default\"> · {step.label}</span>\n </>\n ),\n next: next ? `Next: ${next.label}` : undefined,\n };\n}\n\n/**\n * Step progress for wizards.\n *\n * Shows every labelled step when they fit on one line, and otherwise a compact \"Step 2 of 5 ·\n * Contact\" summary with a segmented bar. Ported from SCIC in 0.9.0: through 0.8.x an\n * overflowing list scrolled sideways, which hid the later steps behind a scrollbar.\n *\n * The switch compares the stepper's measured width with the list's natural width, read from an\n * invisible twin, not a breakpoint, so it is right in a narrow modal on desktop and at 200%\n * zoom. The labelled `<ol>` stays in the DOM in both modes (visually hidden in compact), so a\n * screen reader always gets every step with its state; the summary is presentation only.\n */\nexport function Stepper({\n steps,\n size = 'md',\n label = 'Progress',\n align = 'start',\n compact: compactMode = 'auto',\n formatCompact = defaultCompactText,\n className,\n}: StepperProps) {\n const [wrapRef, width] = useElementWidth<HTMLDivElement>();\n const measureRef = useRef<HTMLOListElement>(null);\n const [naturalWidth, setNaturalWidth] = useState(0);\n\n useLayoutEffect(() => {\n // Re-read when the steps change or the row resizes (a web font landing reflows it).\n if (measureRef.current) setNaturalWidth(measureRef.current.scrollWidth);\n }, [steps, width, size]);\n\n const compact = compactMode === 'auto' && width !== undefined && naturalWidth > width;\n const activeIndex = Math.max(0, steps.findIndex((step) => step.status === 'active'));\n const text = compact\n ? formatCompact({ index: activeIndex, total: steps.length, step: steps[activeIndex], next: steps[activeIndex + 1] })\n : null;\n\n return (\n <div ref={wrapRef} data-compact={compact || undefined} className={clsx('relative w-full min-w-0', className)}>\n {compactMode === 'auto' && (\n <div className=\"pointer-events-none invisible absolute left-0 top-0 h-0 overflow-hidden\" aria-hidden>\n <StepList ref={measureRef} steps={steps} size={size} label={label} measuring className=\"w-max\" />\n </div>\n )}\n\n <StepList\n steps={steps}\n size={size}\n label={label}\n className={clsx(compact ? 'sr-only' : ALIGN[align])}\n />\n\n {text && (\n <div aria-hidden className=\"flex flex-col gap-2\">\n <div className=\"flex flex-wrap items-baseline justify-between gap-x-3 gap-y-0.5\">\n <p className={clsx(SIZE[size].label, 'font-semibold text-brand')}>{text.current}</p>\n {text.next && <p className=\"text-body-tiny text-default-secondary\">{text.next}</p>}\n </div>\n <div className=\"flex gap-1\">\n {steps.map((step) => (\n <span\n key={step.label}\n className={clsx(\n 'h-1 flex-1 rounded-full',\n step.status === 'upcoming' ? 'bg-disabled' : 'bg-brand',\n )}\n />\n ))}\n </div>\n </div>\n )}\n </div>\n );\n}\n","import clsx from 'clsx';\nimport { type ReactNode } from 'react';\nimport { CheckIcon } from 'lucide-react';\nimport {\n choiceCardParts,\n initialChoiceCardSize,\n type ChoiceCardSize,\n type ResponsiveChoiceCardSize,\n} from './choice-card-size';\n\n/**\n * Figma's `Size` axis on `Multiselect Card` (`Default | Small`), plus `lg` from 0.9.0 for roomy\n * viewports such as tablets. Shared with `RadioCards`.\n */\nexport type MultiSelectCardSize = ChoiceCardSize;\n\nexport interface MultiSelectCardProps {\n icon: ReactNode;\n title: string;\n description?: string;\n selected: boolean;\n onToggle: () => void;\n /**\n * Figma has had this axis since 0.2.0; the 0.3.0 CHANGELOG recorded it as \"left alone\n * pending a design decision\". `Default` and `Small` differ only in padding, icon box and\n * type step, so there was nothing to decide.\n *\n * From 0.9.0 it also takes a responsive object, mobile-first:\n * `{ initial: 'sm', md: 'lg' }` is small on phones and large from `md` up.\n */\n size?: ResponsiveChoiceCardSize;\n disabled?: boolean;\n className?: string;\n}\n\nexport function MultiSelectCard({\n icon,\n title,\n description,\n selected,\n onToggle,\n size = 'default',\n disabled = false,\n className,\n}: MultiSelectCardProps) {\n const s = choiceCardParts(size);\n\n return (\n <button\n type=\"button\"\n role=\"checkbox\"\n aria-checked={selected}\n data-size={initialChoiceCardSize(size)}\n disabled={disabled}\n onClick={onToggle}\n className={clsx(\n 'relative w-full rounded-2xl border-2 text-left transition-all',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default',\n 'disabled:cursor-not-allowed disabled:opacity-60',\n s.pad,\n selected\n ? 'border-brand bg-brand-tertiary'\n : 'border-default bg-default hover:border-default-secondary',\n className,\n )}\n >\n <div className=\"flex items-start justify-between gap-2\">\n <span\n aria-hidden\n className={clsx(\n 'flex shrink-0 items-center justify-center',\n s.iconBox,\n selected ? 'bg-brand' : 'bg-brand-tertiary',\n )}\n >\n <span className={clsx(s.icon, selected ? 'text-icon-brand-on-brand' : 'text-icon-brand')}>\n {icon}\n </span>\n </span>\n\n {selected ? (\n <span\n aria-hidden\n className={clsx(\n 'flex shrink-0 items-center justify-center rounded-full bg-brand text-icon-brand-on-brand',\n s.mark,\n )}\n >\n <CheckIcon className=\"size-3\" strokeWidth={2.5} />\n </span>\n ) : (\n <span\n aria-hidden\n className={clsx('shrink-0 rounded-full border-2 border-default', s.mark)}\n />\n )}\n </div>\n\n <div className={s.gap}>\n <p className={clsx('font-semibold', s.title, selected ? 'text-brand' : 'text-default')}>\n {title}\n </p>\n {description && (\n <p className={clsx('mt-0.5 text-default-secondary', s.description)}>{description}</p>\n )}\n </div>\n </button>\n );\n}\n","/**\n * The size scale shared by `MultiSelectCard` and `RadioCards`, so the single- and multi-select\n * cards always line up.\n *\n * `size` takes one size or, from 0.9.0, a responsive object in the Radix Themes shape:\n * `{ initial: 'sm', md: 'lg' }`, mobile-first at the preset's `sm`/`md`/`lg` breakpoints. SCIC's\n * onboarding needed \"small on phones, large from tablets\", and a fixed `responsive` size would\n * hardcode one pair.\n *\n * Every breakpoint's classes are written out in full below. Tailwind only generates classes it\n * can find in the source, so a class assembled at runtime (`${bp}:${cls}`) would produce no CSS.\n */\nexport type ChoiceCardSize = 'sm' | 'default' | 'lg';\n\nexport type ChoiceCardBreakpoint = 'sm' | 'md' | 'lg';\n\nexport type ResponsiveChoiceCardSize =\n | ChoiceCardSize\n | ({ initial: ChoiceCardSize } & Partial<Record<ChoiceCardBreakpoint, ChoiceCardSize>>);\n\nexport interface ChoiceCardParts {\n pad: string;\n iconBox: string;\n icon: string;\n mark: string;\n gap: string;\n title: string;\n description: string;\n}\n\nconst BASE: Record<ChoiceCardSize, ChoiceCardParts> = {\n sm: { pad: 'p-3', iconBox: 'size-8 rounded-lg', icon: 'size-4', mark: 'size-4', gap: 'mt-2', title: 'text-body-xs', description: 'text-body-tiny' },\n default: { pad: 'p-4', iconBox: 'size-10 rounded-xl', icon: 'size-5', mark: 'size-5', gap: 'mt-3', title: 'text-body-sm', description: 'text-body-tiny' },\n lg: { pad: 'p-5', iconBox: 'size-12 rounded-xl', icon: 'size-6', mark: 'size-6', gap: 'mt-3.5', title: 'text-body', description: 'text-body-xs' },\n};\n\nconst AT: Record<ChoiceCardBreakpoint, Record<ChoiceCardSize, ChoiceCardParts>> = {\n sm: {\n sm: { pad: 'sm:p-3', iconBox: 'sm:size-8 sm:rounded-lg', icon: 'sm:size-4', mark: 'sm:size-4', gap: 'sm:mt-2', title: 'sm:text-body-xs', description: 'sm:text-body-tiny' },\n default: { pad: 'sm:p-4', iconBox: 'sm:size-10 sm:rounded-xl', icon: 'sm:size-5', mark: 'sm:size-5', gap: 'sm:mt-3', title: 'sm:text-body-sm', description: 'sm:text-body-tiny' },\n lg: { pad: 'sm:p-5', iconBox: 'sm:size-12 sm:rounded-xl', icon: 'sm:size-6', mark: 'sm:size-6', gap: 'sm:mt-3.5', title: 'sm:text-body', description: 'sm:text-body-xs' },\n },\n md: {\n sm: { pad: 'md:p-3', iconBox: 'md:size-8 md:rounded-lg', icon: 'md:size-4', mark: 'md:size-4', gap: 'md:mt-2', title: 'md:text-body-xs', description: 'md:text-body-tiny' },\n default: { pad: 'md:p-4', iconBox: 'md:size-10 md:rounded-xl', icon: 'md:size-5', mark: 'md:size-5', gap: 'md:mt-3', title: 'md:text-body-sm', description: 'md:text-body-tiny' },\n lg: { pad: 'md:p-5', iconBox: 'md:size-12 md:rounded-xl', icon: 'md:size-6', mark: 'md:size-6', gap: 'md:mt-3.5', title: 'md:text-body', description: 'md:text-body-xs' },\n },\n lg: {\n sm: { pad: 'lg:p-3', iconBox: 'lg:size-8 lg:rounded-lg', icon: 'lg:size-4', mark: 'lg:size-4', gap: 'lg:mt-2', title: 'lg:text-body-xs', description: 'lg:text-body-tiny' },\n default: { pad: 'lg:p-4', iconBox: 'lg:size-10 lg:rounded-xl', icon: 'lg:size-5', mark: 'lg:size-5', gap: 'lg:mt-3', title: 'lg:text-body-sm', description: 'lg:text-body-tiny' },\n lg: { pad: 'lg:p-5', iconBox: 'lg:size-12 lg:rounded-xl', icon: 'lg:size-6', mark: 'lg:size-6', gap: 'lg:mt-3.5', title: 'lg:text-body', description: 'lg:text-body-xs' },\n },\n};\n\nconst BREAKPOINTS: ChoiceCardBreakpoint[] = ['sm', 'md', 'lg'];\nconst PARTS = Object.keys(BASE.default) as (keyof ChoiceCardParts)[];\n\n/** The classes for each part of a card at `size`, one size or responsive. */\nexport function choiceCardParts(size: ResponsiveChoiceCardSize): ChoiceCardParts {\n if (typeof size === 'string') return BASE[size];\n const layers = [BASE[size.initial], ...BREAKPOINTS.flatMap((bp) => (size[bp] ? [AT[bp][size[bp]!]] : []))];\n return Object.fromEntries(\n PARTS.map((part) => [part, layers.map((layer) => layer[part]).join(' ')]),\n ) as unknown as ChoiceCardParts;\n}\n\n/** The size the card has before any breakpoint applies, for `data-size`. */\nexport function initialChoiceCardSize(size: ResponsiveChoiceCardSize): ChoiceCardSize {\n return typeof size === 'string' ? size : size.initial;\n}\n","import { forwardRef, useId, type ButtonHTMLAttributes, type ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { composeEventHandlers } from '../../lib/compose-event-handlers';\nimport { useControllableState } from '../../lib/use-controllable-state';\n\nexport type SwitchSize = 'sm' | 'md';\n\nexport interface SwitchProps\n extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange' | 'value' | 'type'> {\n /** Controlled. Omit and pass `defaultChecked` for uncontrolled. */\n checked?: boolean;\n defaultChecked?: boolean;\n onCheckedChange?: (checked: boolean) => void;\n /** Visible text beside the switch. Doubles as the accessible name. */\n label?: ReactNode;\n /** Second line under the label. Matches Figma's `Supporting text` axis. */\n description?: ReactNode;\n /** Track size. `sm` is 36×20, `md` is 44×24. */\n size?: SwitchSize;\n /**\n * Submits with a surrounding form, as `name=value` while on. New in 0.7.0: through 0.6 a\n * Switch posted nothing, so it could not take part in a plain form.\n */\n name?: string;\n /** The value posted while on. Default `\"on\"`, as for a native checkbox. */\n value?: string;\n required?: boolean;\n}\n\n/**\n * Track / knob geometry, straight from the Figma `_Toggle base` component (see the naming\n * note below). The knob sits on a 2px inset, so travel = track width − knob − (2 × inset).\n */\nconst SIZE: Record<SwitchSize, { track: string; knob: string; translate: string }> = {\n sm: { track: 'h-5 w-9', knob: 'size-4', translate: 'translate-x-4' },\n md: { track: 'h-6 w-11', knob: 'size-5', translate: 'translate-x-5' },\n};\n\n/**\n * An on/off switch — a setting that takes effect immediately, with no save step.\n *\n * **Renamed from `Toggle` in 0.4.0.** It was always a switch: `role=\"switch\"`,\n * `aria-checked`, and the track/knob geometry taken from Figma. The name was blocking,\n * because \"Toggle\" means something else in shadcn/ui and in most design systems — a\n * pressed-state *button*, like a bold button in a text toolbar. That component now exists\n * here under the name everyone expects, and the two are not interchangeable:\n *\n * - `Switch` — `role=\"switch\"`, \"on\"/\"off\", applies immediately. A setting.\n * - `Toggle` — `aria-pressed`, \"pressed\"/\"not pressed\". A button whose effect persists.\n *\n * Figma calls its set `Toggle` with a `Pressed` axis, but its geometry and `_Toggle base`\n * match this component exactly, so Figma's `Toggle` **is** this switch. Figma has no\n * pressed-button equivalent yet; that is a gap on the design side, recorded in the\n * CHANGELOG rather than papered over here.\n */\nexport const Switch = forwardRef<HTMLButtonElement, SwitchProps>(function Switch(\n {\n checked: checkedProp,\n defaultChecked = false,\n onCheckedChange,\n label,\n description,\n size = 'md',\n disabled = false,\n name,\n value = 'on',\n required,\n id,\n className,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n onClick,\n ...rest\n },\n ref,\n) {\n const [checked, setChecked] = useControllableState({\n value: checkedProp,\n defaultValue: defaultChecked,\n onChange: onCheckedChange,\n });\n\n const generatedId = useId();\n const controlId = id ?? generatedId;\n const descriptionId = `${controlId}-description`;\n const s = SIZE[size];\n\n const control = (\n <button\n ref={ref}\n type=\"button\"\n role=\"switch\"\n id={controlId}\n aria-checked={checked}\n data-state={checked ? 'checked' : 'unchecked'}\n // With no visible label the switch would otherwise ship with no accessible name.\n aria-label={label ? undefined : ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={description ? descriptionId : undefined}\n disabled={disabled}\n onClick={composeEventHandlers(onClick, () => setChecked(!checked))}\n className={clsx(\n 'group flex items-center gap-2',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default',\n disabled && 'cursor-not-allowed opacity-50',\n !description && !name && className,\n )}\n {...rest}\n >\n <span\n aria-hidden\n className={clsx(\n 'relative inline-flex shrink-0 rounded-full transition-colors',\n s.track,\n // The unchecked track is borderless per the spec. A border here would also shift\n // the knob's rendered inset by 1px between states, since the knob is positioned\n // against the padding box.\n disabled\n ? 'bg-disabled'\n : checked\n ? 'bg-brand group-hover:bg-brand-hover'\n : 'bg-default-secondary group-hover:bg-default-secondary-hover',\n )}\n >\n <span\n className={clsx(\n 'absolute left-0.5 top-0.5 rounded-full bg-default shadow-100 transition-transform motion-reduce:transition-none',\n s.knob,\n checked ? s.translate : 'translate-x-0',\n )}\n />\n </span>\n {label && <span className=\"text-body-xs text-default\">{label}</span>}\n </button>\n );\n\n /*\n * Form participation: a real checkbox, invisible and out of the tab order and the\n * accessibility tree, mirroring the switch. A checkbox rather than a hidden input, so it\n * posts only while on and `required` is validated, exactly as a native checkbox would be.\n * Not Radix Switch: it measures its control with an unguarded ResizeObserver inside a form,\n * which crashes every consumer's jsdom tests that lack a polyfill.\n */\n const formInput = name ? (\n <input\n type=\"checkbox\"\n aria-hidden\n tabIndex={-1}\n name={name}\n value={value}\n checked={checked}\n required={required}\n disabled={disabled}\n onChange={() => {}}\n className=\"pointer-events-none absolute size-px opacity-0\"\n />\n ) : null;\n\n if (!description) {\n return formInput ? (\n <span className={clsx('relative inline-flex', className)}>\n {control}\n {formInput}\n </span>\n ) : (\n control\n );\n }\n\n return (\n <div className={clsx('relative flex flex-col', className)}>\n {control}\n {formInput}\n {/* Outside the button, so it is not folded into the accessible name — the same\n reasoning as `Checkbox` and `Radio`. Indented past the track. */}\n <span\n id={descriptionId}\n className={clsx(\n 'mt-0.5 text-body-tiny',\n size === 'md' ? 'pl-[52px]' : 'pl-[44px]',\n disabled ? 'text-disabled' : 'text-default-secondary',\n )}\n >\n {description}\n </span>\n </div>\n );\n});\n","import {\n createContext,\n forwardRef,\n useContext,\n useMemo,\n useRef,\n type ButtonHTMLAttributes,\n type HTMLAttributes,\n type ReactNode,\n} from 'react';\nimport clsx from 'clsx';\nimport { cn } from '../../lib/cn';\nimport { FOCUS_RING } from '../../lib/focus-ring';\nimport { composeRefs } from '../../lib/slot';\nimport { useControllableState } from '../../lib/use-controllable-state';\nimport { useRovingFocus } from '../../lib/use-roving-focus';\n\nexport type ToggleSize = 'sm' | 'md' | 'lg';\nexport type ToggleVariant = 'ghost' | 'outline';\n\nconst SIZE: Record<ToggleSize, string> = {\n sm: 'h-8 min-w-8 px-2 text-body-tiny [&_svg]:size-3.5',\n md: 'h-9 min-w-9 px-2.5 text-body-xs [&_svg]:size-4',\n lg: 'h-11 min-w-11 px-3 text-body-sm [&_svg]:size-5',\n};\n\nconst VARIANT: Record<ToggleVariant, string> = {\n ghost: 'border border-transparent bg-transparent',\n outline: 'border border-default bg-default',\n};\n\nexport interface ToggleProps\n extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange' | 'type'> {\n /** Controlled pressed state. Omit and pass `defaultPressed` for uncontrolled. */\n pressed?: boolean;\n defaultPressed?: boolean;\n onPressedChange?: (pressed: boolean) => void;\n size?: ToggleSize;\n variant?: ToggleVariant;\n children?: ReactNode;\n}\n\n/**\n * A button with a sticky pressed state — bold in a text toolbar, a map layer on/off, a\n * filter that stays applied.\n *\n * **New in 0.4.0, and not what `Toggle` used to be.** Through 0.3.0 this name belonged to\n * the on/off switch, which is now `Switch`. The two look similar and mean different things:\n *\n * - `Toggle` — `aria-pressed`. A *button*. \"Bold is pressed.\"\n * - `Switch` — `role=\"switch\"` + `aria-checked`. A *setting*. \"Notifications are on.\"\n *\n * `aria-pressed` rather than `aria-checked` is the whole distinction as far as assistive\n * tech is concerned, and it is why this is not just `Switch` with different styling.\n *\n * An icon-only toggle needs `aria-label`, exactly as `IconButton` does — there is no visible\n * text to name it.\n */\nexport const Toggle = forwardRef<HTMLButtonElement, ToggleProps>(function Toggle(\n {\n pressed: pressedProp,\n defaultPressed = false,\n onPressedChange,\n size = 'md',\n variant = 'ghost',\n disabled,\n children,\n className,\n onClick,\n ...rest\n },\n ref,\n) {\n const group = useContext(ToggleGroupContext);\n\n // Inside a ToggleGroup the group owns the state; standalone it owns its own.\n const [standalonePressed, setStandalonePressed] = useControllableState({\n value: pressedProp,\n defaultValue: defaultPressed,\n onChange: onPressedChange,\n });\n\n const pressed = group ? group.isPressed(rest.value as string) : standalonePressed;\n const isDisabled = disabled ?? group?.disabled;\n\n return (\n <button\n ref={ref}\n type=\"button\"\n {...rest}\n // After the spread, so a consumer's handler runs alongside the toggle. Through 0.6\n // `rest` came last and an `onClick` replaced it, so the toggle stopped toggling.\n aria-pressed={pressed}\n data-state={pressed ? 'on' : 'off'}\n disabled={isDisabled}\n onClick={(event) => {\n onClick?.(event);\n if (event.defaultPrevented) return;\n if (group) group.toggle(rest.value as string);\n else setStandalonePressed(!pressed);\n }}\n className={cn(\n 'inline-flex shrink-0 items-center justify-center gap-1.5 rounded-lg font-medium transition-colors',\n FOCUS_RING,\n 'disabled:cursor-not-allowed disabled:opacity-50',\n SIZE[size],\n VARIANT[variant],\n // Pressed state styled from the attribute it is announced by.\n 'text-default-secondary hover:bg-default-secondary hover:text-default',\n 'aria-pressed:border-brand-tertiary aria-pressed:bg-brand-tertiary aria-pressed:text-brand',\n 'aria-pressed:hover:bg-brand-tertiary aria-pressed:hover:text-brand',\n className,\n )}\n >\n {children}\n </button>\n );\n});\n\n// ── ToggleGroup ────────────────────────────────────────────────────────────────\n\nexport type ToggleGroupType = 'single' | 'multiple';\n\ninterface ToggleGroupContextValue {\n isPressed: (value: string) => boolean;\n toggle: (value: string) => void;\n disabled?: boolean;\n /** Items claim a roving index in render order, which is their visual order. */\n claimIndex: () => number;\n roving: ReturnType<typeof useRovingFocus>;\n}\n\nconst ToggleGroupContext = createContext<ToggleGroupContextValue | null>(null);\n\n/** One toggle as data. New in 0.8.0. */\nexport interface ToggleGroupOption {\n value: string;\n /** Text or an icon. */\n label: ReactNode;\n /** Required when `label` is an icon: there is no visible text to name the toggle. */\n 'aria-label'?: string;\n disabled?: boolean;\n}\n\nexport interface ToggleGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {\n /** The parts: `ToggleGroupItem`s. Omit when passing `options`. */\n children?: ReactNode;\n /** The toggles as data, each rendered as a `ToggleGroupItem`. New in 0.8.0. Use it or `children`. */\n options?: readonly ToggleGroupOption[];\n /** `single` behaves like a radio group; `multiple` like a set of checkboxes. */\n type?: ToggleGroupType;\n value?: string | string[];\n defaultValue?: string | string[];\n onValueChange?: (value: string | string[]) => void;\n /** Names the group. Required by the APG for a toolbar-style group. */\n label: string;\n disabled?: boolean;\n orientation?: 'horizontal' | 'vertical';\n}\n\n/**\n * A set of related toggles sharing one selection.\n *\n * `role=\"group\"` with `aria-pressed` on each child, and a roving tabindex so the set is one\n * tab stop with arrow keys inside — the same contract `SegmentedControl` was missing before\n * 0.4.0.\n *\n * How this differs from the neighbours, since three components in this library now look\n * similar: `SegmentedControl` is a `radiogroup` for choosing *one* of a small set of views,\n * and always has exactly one selection. `ToggleGroup type=\"multiple\"` allows none or many.\n * `ToggleGroup type=\"single\"` allows none or one — the deselectable case a radio group\n * cannot express.\n */\nexport function ToggleGroup({\n children,\n options,\n type = 'single',\n value: valueProp,\n defaultValue,\n onValueChange,\n label,\n disabled,\n orientation = 'horizontal',\n className,\n ...rest\n}: ToggleGroupProps) {\n const [value, setValue] = useControllableState<string | string[]>({\n value: valueProp,\n defaultValue: defaultValue ?? (type === 'multiple' ? [] : ''),\n onChange: onValueChange,\n });\n\n const roving = useRovingFocus({\n orientation: orientation === 'vertical' ? 'vertical' : 'horizontal',\n loop: true,\n });\n\n const cursor = useRef(0);\n\n const context = useMemo<ToggleGroupContextValue>(\n () => ({\n isPressed: (itemValue) =>\n Array.isArray(value) ? value.includes(itemValue) : value === itemValue,\n toggle: (itemValue) => {\n if (type === 'multiple') {\n const list = Array.isArray(value) ? value : [];\n setValue(\n list.includes(itemValue) ? list.filter((v) => v !== itemValue) : [...list, itemValue],\n );\n return;\n }\n // Single mode deselects on re-press — the behaviour a radiogroup cannot offer.\n setValue(value === itemValue ? '' : itemValue);\n },\n disabled,\n claimIndex: () => cursor.current++,\n roving,\n }),\n [value, setValue, type, disabled, roving],\n );\n\n // Reset before the children's render bodies run, so indices restart from zero each pass.\n cursor.current = 0;\n\n return (\n <ToggleGroupContext.Provider value={context}>\n <div\n role=\"group\"\n aria-label={label}\n // No `aria-orientation`: `role=\"group\"` does not support it. The orientation only\n // affects which arrow keys move focus, which the roving hook already knows —\n // announcing it here would be an invalid attribute for the role.\n data-slot=\"toggle-group\"\n className={clsx(\n 'inline-flex gap-0.5',\n orientation === 'vertical' ? 'flex-col' : 'flex-row items-center',\n className,\n )}\n {...roving.containerProps}\n {...rest}\n >\n {options\n ? options.map((option) => (\n <ToggleGroupItem\n key={option.value}\n value={option.value}\n aria-label={option['aria-label']}\n disabled={option.disabled}\n >\n {option.label}\n </ToggleGroupItem>\n ))\n : children}\n </div>\n </ToggleGroupContext.Provider>\n );\n}\n\nexport interface ToggleGroupItemProps extends Omit<ToggleProps, 'pressed' | 'defaultPressed'> {\n value: string;\n}\n\n/** A `Toggle` wired to its `ToggleGroup`, with the roving tabindex applied. */\nexport const ToggleGroupItem = forwardRef<HTMLButtonElement, ToggleGroupItemProps>(\n function ToggleGroupItem({ value, children, onFocus, ...rest }, ref) {\n const group = useContext(ToggleGroupContext);\n if (!group) throw new Error('<ToggleGroupItem> must be used inside <ToggleGroup>');\n\n const index = group.claimIndex();\n const { ref: rovingRef, ...itemProps } = group.roving.itemProps(index, {\n disabled: rest.disabled ?? group.disabled,\n label: typeof children === 'string' ? children : undefined,\n });\n\n return (\n <Toggle\n ref={composeRefs<HTMLButtonElement>(ref, rovingRef)}\n value={value}\n {...rest}\n {...itemProps}\n // The roving focus handler and the caller's both run. 0.6 spread `rest` last, so an\n // `onFocus` here silently broke the arrow-key position.\n onFocus={(event) => {\n onFocus?.(event);\n itemProps.onFocus();\n }}\n // Restated after the spread so it is statically visible, and so a group of five\n // toggles is one tab stop rather than five.\n tabIndex={itemProps.tabIndex}\n >\n {children}\n </Toggle>\n );\n },\n);\n","import {\n forwardRef,\n useId,\n useRef,\n useState,\n type ClipboardEvent as ReactClipboardEvent,\n type KeyboardEvent as ReactKeyboardEvent,\n} from 'react';\nimport clsx from 'clsx';\nimport { composeRefs } from '../../lib/slot';\nimport { useControllableState } from '../../lib/use-controllable-state';\n\nexport type InputOTPMode = 'numeric' | 'alphanumeric';\n\nexport interface InputOTPProps {\n /** Number of characters. Default `6`. */\n length?: number;\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n /** Fired once the last slot is filled. */\n onComplete?: (value: string) => void;\n mode?: InputOTPMode;\n /** Draws a gap after this many slots — `3` for a `123 456` code. */\n groupAfter?: number;\n /** Accessible name. Default `Verification code`. */\n label?: string;\n disabled?: boolean;\n invalid?: boolean;\n autoFocus?: boolean;\n className?: string;\n}\n\n/**\n * A one-time-code field — the boxed digits from a 2FA or email-verification flow.\n *\n * **One real input, N drawn boxes.** The obvious implementation is N separate `<input>`s,\n * and it is the wrong one: it makes the code N tab stops, breaks paste (the browser puts all\n * six characters in the first box), fights password managers and SMS autofill, and announces\n * \"edit text, blank\" six times. Instead there is a single input holding the whole value —\n * with `autocomplete=\"one-time-code\"`, so iOS and Android offer the code from the incoming\n * message — rendered transparently over the boxes, which are decorative.\n *\n * That means paste, autofill, undo, selection and screen readers all get the real value, and\n * the caret position simply drives which box is highlighted.\n */\nexport const InputOTP = forwardRef<HTMLInputElement, InputOTPProps>(function InputOTP(\n {\n length = 6,\n value: valueProp,\n defaultValue = '',\n onValueChange,\n onComplete,\n mode = 'numeric',\n groupAfter,\n label = 'Verification code',\n disabled = false,\n invalid = false,\n autoFocus = false,\n className,\n },\n ref,\n) {\n const [value, setValue] = useControllableState({\n value: valueProp,\n defaultValue,\n onChange: onValueChange,\n });\n\n const inputRef = useRef<HTMLInputElement>(null);\n const [focused, setFocused] = useState(false);\n const describedById = useId();\n\n const pattern = mode === 'numeric' ? /[^0-9]/g : /[^a-zA-Z0-9]/g;\n\n const commit = (next: string) => {\n const cleaned = next.replace(pattern, '').slice(0, length);\n setValue(cleaned);\n if (cleaned.length === length) onComplete?.(cleaned);\n };\n\n const chars = value.split('');\n // The caret sits on the first empty slot, or the last one when full.\n const activeIndex = Math.min(value.length, length - 1);\n\n return (\n <div className={clsx('relative inline-flex flex-col gap-1.5', className)}>\n {/* Clicking any box focuses the single real input. Not a control itself and not\n focusable — the input stretched across it is the control, and it is already keyboard\n reachable, so no key handler belongs here. */}\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */}\n <div\n className=\"relative inline-flex items-center gap-2\"\n onClick={() => inputRef.current?.focus()}\n >\n <input\n ref={composeRefs<HTMLInputElement>(inputRef, ref)}\n type=\"text\"\n inputMode={mode === 'numeric' ? 'numeric' : 'text'}\n // The one attribute that makes SMS and email autofill work on mobile.\n autoComplete=\"one-time-code\"\n autoCorrect=\"off\"\n spellCheck={false}\n maxLength={length}\n value={value}\n disabled={disabled}\n // Off by default; opt-in for the case this exists for — a verification screen whose\n // only purpose is entering the code that just arrived.\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n aria-label={label}\n aria-invalid={invalid || undefined}\n aria-describedby={describedById}\n onChange={(event) => commit(event.target.value)}\n onFocus={() => setFocused(true)}\n onBlur={() => setFocused(false)}\n onKeyDown={(event: ReactKeyboardEvent<HTMLInputElement>) => {\n // Arrow keys would move the caret into the middle of the value, which has no\n // meaning here — the code is filled left to right.\n if (event.key === 'ArrowLeft' || event.key === 'ArrowRight') event.preventDefault();\n }}\n onPaste={(event: ReactClipboardEvent<HTMLInputElement>) => {\n // Handled explicitly so a pasted \"123-456\" or \"123 456\" still works.\n event.preventDefault();\n commit(event.clipboardData.getData('text'));\n }}\n // Transparent and stretched across the boxes: the real input stays where the\n // browser expects it (so autofill anchors correctly) while the boxes below are\n // what the user sees.\n className=\"absolute inset-0 z-raised w-full cursor-default bg-transparent text-transparent caret-transparent outline-none\"\n />\n\n {Array.from({ length }, (_, index) => (\n <span\n key={index}\n // Decorative: the input above holds the value and the accessible name.\n aria-hidden\n className={clsx(\n 'flex h-12 w-10 items-center justify-center rounded-lg border text-body font-semibold tabular-nums transition-colors',\n groupAfter && index === groupAfter && 'ml-3',\n disabled\n ? 'border-disabled bg-disabled text-disabled'\n : invalid\n ? 'border-danger-secondary bg-default text-default'\n : 'border-default bg-default text-default',\n focused &&\n !disabled &&\n index === activeIndex &&\n 'border-brand ring-2 ring-brand ring-offset-1 ring-offset-default',\n )}\n >\n {chars[index] ?? ''}\n </span>\n ))}\n </div>\n <span id={describedById} className=\"sr-only\">\n {`Enter the ${length}-character code. ${value.length} of ${length} entered.`}\n </span>\n </div>\n );\n});\n","import { useRef, useState, type InputHTMLAttributes, type RefObject } from 'react';\nimport clsx from 'clsx';\nimport { UploadIcon } from 'lucide-react';\n\nexport interface FileDropZoneProps {\n className?: string;\n /** Caption shown under \"Upload file\". Defaults to the generic document hint. */\n description?: string;\n accept?: string;\n /** Files above this size are rejected before any upload starts. */\n maxSizeBytes?: number;\n onFileSelected?: (file: File) => void;\n disabled?: boolean;\n}\n\nconst DEFAULT_ACCEPT = '.pdf,.jpg,.jpeg,.png';\nconst DEFAULT_MAX_SIZE_BYTES = 10 * 1024 * 1024;\n\n/** Human-readable byte count: \"820 KB\", \"1.4 MB\". New in 0.7.0, from SCIC. */\nexport function formatFileSize(bytes: number): string {\n const kb = bytes / 1024;\n if (kb < 1024) return `${Math.round(kb)} KB`;\n const mb = kb / 1024;\n return `${Number.isInteger(mb) ? mb : mb.toFixed(1)} MB`;\n}\n\nfunction matchesAccept(file: File, accept: string): boolean {\n const extensions = accept\n .split(',')\n .map((part) => part.trim().toLowerCase())\n .filter((part) => part.startsWith('.'));\n if (extensions.length === 0) {\n return true;\n }\n return extensions.some((extension) => file.name.toLowerCase().endsWith(extension));\n}\n\nexport interface UseFilePickerOptions {\n accept?: string;\n maxSizeBytes?: number;\n onFileSelected?: (file: File) => void;\n}\n\nexport interface UseFilePicker {\n /** Spread onto a hidden `<input type=\"file\">`, which must be rendered. */\n inputProps: InputHTMLAttributes<HTMLInputElement> & { ref: RefObject<HTMLInputElement> };\n /** Opens the native picker. */\n open: () => void;\n /** Runs the same accept and size checks on dropped files. */\n handleFiles: (files: FileList | null) => void;\n /** Validation message for the last rejected file, if any. */\n error: string | null;\n}\n\n/**\n * The accept-list and size validation behind every way into a file upload: the drop zone, and\n * any \"Replace\" button that skips it. One implementation, so the checks cannot drift apart.\n * New in 0.7.0, from SCIC.\n */\nexport function useFilePicker({\n accept = DEFAULT_ACCEPT,\n maxSizeBytes = DEFAULT_MAX_SIZE_BYTES,\n onFileSelected,\n}: UseFilePickerOptions = {}): UseFilePicker {\n const inputRef = useRef<HTMLInputElement>(null);\n const [error, setError] = useState<string | null>(null);\n\n function handleFiles(files: FileList | null) {\n const file = files?.[0];\n if (!file) return;\n if (!matchesAccept(file, accept)) {\n setError(`Unsupported file type. Allowed: ${accept}.`);\n return;\n }\n if (file.size > maxSizeBytes) {\n setError(`That file is ${formatFileSize(file.size)}. The limit is ${formatFileSize(maxSizeBytes)}.`);\n return;\n }\n setError(null);\n onFileSelected?.(file);\n }\n\n return {\n inputProps: {\n ref: inputRef,\n type: 'file',\n accept,\n className: 'sr-only',\n tabIndex: -1,\n onChange: (event) => {\n handleFiles(event.currentTarget.files);\n event.currentTarget.value = '';\n },\n },\n open: () => inputRef.current?.click(),\n handleFiles,\n error,\n };\n}\n\nexport function FileDropZone({\n className,\n description = 'Drag & drop or browse · PDF, JPG, PNG · up to 10 MB',\n accept = DEFAULT_ACCEPT,\n maxSizeBytes = DEFAULT_MAX_SIZE_BYTES,\n onFileSelected,\n disabled = false,\n}: FileDropZoneProps) {\n const [isDragging, setIsDragging] = useState(false);\n const picker = useFilePicker({ accept, maxSizeBytes, onFileSelected });\n const { error, handleFiles } = picker;\n const inputRef = picker.inputProps.ref;\n\n return (\n // relative: the hidden input is absolutely positioned (sr-only); without a positioned\n // ancestor its box escapes a scrolling container and scrolls the page instead.\n <div className=\"relative\">\n <input {...picker.inputProps} disabled={disabled} />\n <div\n role=\"button\"\n data-state={isDragging ? 'dragging' : undefined}\n tabIndex={disabled ? -1 : 0}\n aria-disabled={disabled}\n onClick={() => { if (!disabled) inputRef.current?.click(); }}\n onKeyDown={(e) => {\n if (!disabled && (e.key === 'Enter' || e.key === ' ')) {\n e.preventDefault();\n inputRef.current?.click();\n }\n }}\n onDragOver={(e) => { e.preventDefault(); if (!disabled) setIsDragging(true); }}\n onDragEnter={(e) => { e.preventDefault(); if (!disabled) setIsDragging(true); }}\n onDragLeave={() => setIsDragging(false)}\n onDrop={(e) => {\n e.preventDefault();\n setIsDragging(false);\n if (!disabled) handleFiles(e.dataTransfer.files);\n }}\n className={clsx(\n 'flex flex-col items-center justify-center gap-1 rounded-lg border-2 border-dashed py-4 px-4 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1',\n disabled\n ? 'cursor-not-allowed border-disabled bg-disabled'\n : clsx(\n 'cursor-pointer',\n isDragging\n ? 'border-brand bg-brand-tertiary'\n : 'border-default bg-default-secondary hover:border-brand hover:bg-brand-tertiary',\n ),\n className,\n )}\n >\n <span\n aria-hidden\n className={disabled ? 'text-disabled' : isDragging ? 'text-brand' : 'text-default-secondary'}\n >\n <UploadIcon className=\"size-5\" />\n </span>\n <span className={clsx('text-body-sm font-medium', disabled ? 'text-disabled' : 'text-default')}>Upload file</span>\n <span className=\"text-body-xs text-default-secondary text-center\">\n {description}\n </span>\n </div>\n {error && (\n <span role=\"alert\" className=\"text-body-xs text-danger\">\n {error}\n </span>\n )}\n </div>\n );\n}\n","import { useEffect, useState, type ClipboardEvent, type KeyboardEvent } from 'react';\nimport clsx from 'clsx';\nimport { cn } from '../../lib/cn';\nimport { useControllableState } from '../../lib/use-controllable-state';\nimport { TagPill } from '../status/tag-pill';\nimport { useFieldControl } from './field';\n\nexport type TagInputParseResult = { value: string } | { error: string };\n\nexport interface TagInputProps {\n placeholder?: string;\n /** Red border and `aria-invalid`. Inside a `Field`, a `FieldError` with a message sets this. */\n invalid?: boolean;\n disabled?: boolean;\n required?: boolean;\n /** The committed chips, controlled. */\n value?: string[];\n /** The initial chips, uncontrolled. Default none. */\n defaultValue?: string[];\n /** Receives the whole next array when a chip is added or removed. */\n onValueChange?: (value: string[]) => void;\n /** Posts each chip with a surrounding form, as repeated fields of this name. */\n name?: string;\n /** Validates and normalises each token, e.g. lower-case an email or reject a bad one. */\n parse?: (raw: string) => TagInputParseResult;\n /** What separates tokens when typed or pasted. Default whitespace. A `g` or `y` flag is safe. */\n delimiter?: RegExp;\n maxTags?: number;\n /** Told whenever rejected text is sitting in the field, so a form can block saving. */\n onInvalidChange?: (invalid: boolean) => void;\n /**\n * Why the text in the field was rejected (`parse`'s error, or the `maxTags` limit), and\n * `null` once it is fixed or cleared. Show it in the `FieldError`: the control has no\n * message of its own from 0.10.0.\n */\n onParseError?: (error: string | null) => void;\n 'aria-label'?: string;\n className?: string;\n}\n\nconst defaultParse = (raw: string): TagInputParseResult => ({ value: raw.trim() });\n\n/**\n * A multi-value text field: type or paste values, and each becomes a removable chip. Emails,\n * domains, tags. New in 0.7.0, from SCIC (whose `onChange` is `onValueChange` here, matching\n * every other DS control).\n *\n * Controlled with `value`, or uncontrolled with `defaultValue`. With `name` it posts each chip\n * with a form, and `required` then blocks submit while there are none.\n *\n * Enter, the delimiter, blur and a delimited paste all commit. Backspace in an empty field removes\n * the last chip. Duplicates are ignored. A token `parse` rejects stays in the field with its error\n * rather than being dropped, so nothing the user typed silently disappears.\n *\n * Bare from 0.10.0, like the other text fields: no label, hint or error of its own. Put it in\n * a `Field` with a `FieldLabel`, and show `onParseError`'s message in its `FieldError`.\n */\nexport function TagInput(props: TagInputProps) {\n return <TagInputControl {...props} />;\n}\n\n\nfunction TagInputControl({\n value: valueProp,\n defaultValue = [],\n onValueChange,\n name,\n required,\n parse = defaultParse,\n delimiter = /\\s+/,\n maxTags,\n onInvalidChange,\n placeholder,\n disabled: disabledProp,\n invalid: invalidProp = false,\n onParseError,\n 'aria-label': ariaLabel,\n className,\n}: TagInputProps) {\n const field = useFieldControl();\n const disabled = disabledProp ?? field.disabled;\n const [values, setValues] = useControllableState<string[]>({\n value: valueProp,\n defaultValue,\n onChange: onValueChange,\n });\n // A global or sticky pattern keeps `lastIndex` between `test` calls, so alternate keys would fail.\n const isDelimited = (text: string) => {\n delimiter.lastIndex = 0;\n return delimiter.test(text);\n };\n const [draft, setDraft] = useState('');\n const [rejected, setRejected] = useState<string | null>(null);\n\n // A rejected token marks the control invalid even before a form shows the message.\n const invalid = invalidProp || !!field['aria-invalid'] || rejected !== null;\n useEffect(() => {\n onParseError?.(rejected);\n onInvalidChange?.(rejected !== null);\n }, [rejected, onParseError, onInvalidChange]);\n\n function commit(raw: string) {\n const tokens = raw\n .split(delimiter)\n .map((token) => token.trim())\n .filter(Boolean);\n if (!tokens.length) {\n setDraft('');\n return;\n }\n\n const next = [...values];\n let firstRejected: { token: string; error: string } | null = null;\n for (const token of tokens) {\n const result = parse(token);\n if ('error' in result) {\n firstRejected ??= { token, error: result.error };\n continue;\n }\n if (next.includes(result.value)) continue;\n if (maxTags !== undefined && next.length >= maxTags) {\n firstRejected ??= { token, error: `You can add up to ${maxTags}.` };\n continue;\n }\n next.push(result.value);\n }\n\n if (next.length !== values.length) setValues(next);\n setDraft(firstRejected?.token ?? '');\n setRejected(firstRejected?.error ?? null);\n }\n\n function handleKeyDown(event: KeyboardEvent<HTMLInputElement>) {\n if (event.key === 'Enter' || (event.key.length === 1 && isDelimited(event.key))) {\n event.preventDefault();\n commit(draft);\n return;\n }\n if (event.key === 'Backspace' && draft === '' && values.length) {\n setValues(values.slice(0, -1));\n }\n }\n\n function handlePaste(event: ClipboardEvent<HTMLInputElement>) {\n const text = event.clipboardData.getData('text');\n if (!isDelimited(text.trim())) return;\n event.preventDefault();\n commit(`${draft}${text}`);\n }\n\n return (\n <div\n data-invalid={invalid || undefined}\n data-disabled={disabled || undefined}\n className={cn(\n 'flex min-h-9 flex-wrap items-center gap-1.5 rounded-lg border border-default bg-default px-2 py-1.5 transition-colors',\n 'focus-within:border-brand focus-within:ring-1 focus-within:ring-brand',\n 'data-[invalid]:border-danger data-[invalid]:focus-within:ring-danger',\n 'data-[disabled]:cursor-not-allowed data-[disabled]:border-disabled data-[disabled]:bg-disabled',\n className,\n )}\n >\n {values.map((value) => (\n // TagPill rather than Badge from 0.9.0: one removable chip in the library, at the\n // md size with an ellipsising label, so a long address can't stretch the field.\n <TagPill\n key={value}\n label={value}\n size=\"md\"\n onRemove={disabled ? undefined : () => setValues(values.filter((existing) => existing !== value))}\n />\n ))}\n <input\n {...field}\n aria-label={ariaLabel}\n value={draft}\n disabled={disabled}\n placeholder={values.length ? undefined : placeholder}\n aria-invalid={invalid || undefined}\n // The chips are what is required, so the field only blocks submit while there are none.\n required={(required || !!field['aria-required']) && values.length === 0}\n onChange={(event) => {\n setDraft(event.target.value);\n setRejected(null);\n }}\n onKeyDown={handleKeyDown}\n onPaste={handlePaste}\n onBlur={() => commit(draft)}\n className={clsx(\n 'min-w-[8rem] flex-1 bg-transparent px-1 text-body-sm text-default outline-none',\n 'placeholder:text-default-tertiary disabled:cursor-not-allowed',\n )}\n />\n {name && values.map((value) => <input key={value} type=\"hidden\" name={name} value={value} />)}\n </div>\n );\n}\n","import clsx from 'clsx';\nimport type { KeyboardEvent, ReactElement, ReactNode } from 'react';\nimport { XIcon } from 'lucide-react';\nimport { devWarn } from '../../lib/dev-warn';\nimport { FOCUS_RING } from '../../lib/focus-ring';\nimport { Slot } from '../../lib/slot';\n\nexport type TagPillTone = 'default' | 'brand' | 'positive' | 'warning' | 'danger';\nexport type TagPillSize = 'sm' | 'md';\n\nexport interface TagPillProps {\n label: string;\n tone?: TagPillTone;\n /** `sm` (default) for read-only tags; `md` for chips in an input, like `TagInput`. */\n size?: TagPillSize;\n /**\n * Makes the tag removable: an × button named \"Remove {label}\". It also removes on Backspace\n * or Delete while focused, as MUI's Chip does, so a keyboard user deleting a row of tags\n * needn't reach for Enter. The label then ellipsises, with the full text as a `title`.\n */\n onRemove?: () => void;\n /** @deprecated Bypasses the design tokens — pass `tone` instead. Raw hex bg/text pair, overrides `tone` via inline style. Use when the exact source colors don't match design tokens. */\n /**\n * Render onto the single child instead, e.g. a router `<Link>` to the tag's own page. The tag's\n * label replaces the child's children, and it gains a hover fill and a focus ring. Not combined\n * with `onRemove`: a link and a remove button can't share one element. New in 0.9.5.\n */\n asChild?: boolean;\n /**\n * A decorative leading glyph, e.g. the kind of thing the tag stands for. Hidden from assistive\n * tech, so the label must carry the meaning. New in 0.9.5.\n */\n icon?: ReactNode;\n /**\n * A tooltip. Defaults to the label on a removable tag, whose label can ellipsise. Pass it for\n * extra detail, e.g. \"Worked out for the signed-in user\". New in 0.9.5.\n */\n title?: string;\n /** The element to render onto, with `asChild`. */\n children?: ReactElement;\n bg?: string;\n color?: string;\n className?: string;\n}\n\nconst toneStyles: Record<TagPillTone, string> = {\n default: 'bg-default-secondary text-default-secondary',\n brand: 'bg-brand-tertiary text-brand',\n positive:'bg-positive-tertiary text-positive',\n warning: 'bg-warning-tertiary text-warning',\n danger: 'bg-danger-tertiary text-danger',\n};\n\nconst sizeStyles: Record<TagPillSize, string> = {\n sm: 'px-2 py-0.5',\n md: 'px-3 py-1',\n};\n\nexport function TagPill({\n label,\n tone = 'default',\n size = 'sm',\n onRemove,\n asChild = false,\n icon,\n title,\n children,\n bg,\n color,\n className,\n}: TagPillProps) {\n if (asChild && onRemove) devWarn('TagPill: `asChild` and `onRemove` cannot be combined; `onRemove` is ignored.');\n const removeOnKey = (event: KeyboardEvent<HTMLButtonElement>) => {\n if (event.key === 'Backspace' || event.key === 'Delete') {\n event.preventDefault();\n onRemove?.();\n }\n };\n\n const glyph = icon && (\n <span aria-hidden className=\"inline-flex size-3 shrink-0 [&>svg]:size-full\">\n {icon}\n </span>\n );\n const labelContent = icon ? (\n <>\n {glyph}\n <span className=\"truncate\">{label}</span>\n </>\n ) : (\n label\n );\n\n const rootProps = {\n 'data-tone': tone,\n 'data-size': size,\n 'data-removable': onRemove && !asChild ? '' : undefined,\n title: title ?? (onRemove && !asChild ? label : undefined),\n className: clsx(\n 'inline-flex items-center rounded-full text-body-xs font-medium',\n sizeStyles[size],\n // The remove button sits in the end padding, so trim it to keep the × optically centred.\n 'data-[removable]:max-w-full data-[removable]:gap-1 data-[removable]:whitespace-nowrap data-[removable]:pr-1.5',\n icon && 'max-w-full gap-1',\n !bg && !color && toneStyles[tone],\n asChild && ['hover:underline underline-offset-2', FOCUS_RING],\n className,\n ),\n style: {\n ...(bg ? { backgroundColor: bg } : undefined),\n ...(color ? { color } : undefined),\n },\n };\n\n if (asChild) {\n return (\n <Slot {...rootProps} wrapChildren={() => labelContent}>\n {children}\n </Slot>\n );\n }\n\n return (\n <span {...rootProps}>\n {glyph}\n {onRemove || icon ? <span className=\"truncate\">{label}</span> : label}\n {onRemove && (\n <button\n type=\"button\"\n onClick={onRemove}\n onKeyDown={removeOnKey}\n aria-label={`Remove ${label}`}\n // `touch-hit` gives the 12px × a 44px hit area on touch screens without growing it.\n className=\"touch-hit inline-flex shrink-0 items-center justify-center rounded-full opacity-60 transition-opacity hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-current\"\n >\n <XIcon className=\"size-3\" strokeWidth={2.5} aria-hidden />\n </button>\n )}\n </span>\n );\n}\n","import clsx from 'clsx';\nimport type { ReactNode } from 'react';\nimport { ArrowLeftIcon, ArrowRightIcon } from 'lucide-react';\nimport { Button } from './button';\n\n// ── FormCard ───────────────────────────────────────────────────────────────────\n\nexport function FormCard({\n children,\n className,\n}: {\n children: ReactNode;\n className?: string;\n}) {\n return (\n <div\n className={clsx(\n 'overflow-hidden rounded-xl border border-default bg-default',\n className,\n )}\n >\n {children}\n </div>\n );\n}\n\n// ── FormCardHeader ─────────────────────────────────────────────────────────────\n\nexport interface FormCardHeaderProps {\n title: string;\n subtitle?: string;\n}\n\nexport function FormCardHeader({ title, subtitle }: FormCardHeaderProps) {\n // Responsive like FormCardFooter: 28px side padding was cramped on a phone (0.9.2).\n return (\n <div className=\"border-b border-default px-4 py-5 sm:px-7 sm:py-6\">\n {/* A long unbroken title (an entity's legal name, a URL) wraps instead of overflowing\n the card on a phone. */}\n <h2 className=\"text-heading-sm font-semibold text-default leading-snug [overflow-wrap:anywhere]\">{title}</h2>\n {subtitle && (\n <p className=\"mt-1 text-body-xs text-default-secondary\">{subtitle}</p>\n )}\n </div>\n );\n}\n\n// ── FormCardFooter ─────────────────────────────────────────────────────────────\n\nexport interface FormCardFooterProps {\n onSaveDraft?: () => void;\n onBack?: () => void;\n onContinue?: () => void;\n continueLabel?: string;\n /** The continue button's trailing glyph. Default an arrow; `null` for none (e.g. \"Submit\"). */\n continueIcon?: ReactNode | null;\n backDisabled?: boolean;\n continueDisabled?: boolean;\n /** Disable \"Save as draft\" while keeping it visible, e.g. while a draft save is in flight. */\n saveDraftDisabled?: boolean;\n}\n\nexport function FormCardFooter({\n onSaveDraft,\n onBack,\n onContinue,\n continueLabel = 'Continue',\n continueIcon,\n backDisabled = false,\n continueDisabled = false,\n saveDraftDisabled = false,\n}: FormCardFooterProps) {\n return (\n // Inline, NOT sticky: a sticky footer sits over the focused field once a phone keyboard\n // opens (WCAG 2.2 SC 2.4.11 Focus Not Obscured). Below `sm` Back/Continue share one\n // full-width row and the draft action wraps under them; DOM order stays draft → back →\n // continue for keyboards. Ported from SCIC in 0.7.0.\n <div className=\"flex flex-wrap items-center justify-between gap-3 border-t border-default px-4 py-4 sm:px-7 sm:py-5\">\n {/* Rendered only when it can do something. Through 0.6 it rendered disabled wherever no\n handler was passed, which read as an unfinished feature rather than one that does not\n apply here. */}\n {onSaveDraft ? (\n <Button\n variant=\"neutral\"\n size=\"md\"\n onClick={onSaveDraft}\n disabled={saveDraftDisabled}\n className=\"order-last w-full justify-center sm:order-none sm:w-auto\"\n >\n Save as draft\n </Button>\n ) : (\n <span className=\"hidden sm:block\" />\n )}\n <div className=\"flex w-full items-center gap-2 sm:w-auto\">\n {!backDisabled && (\n <Button\n variant=\"neutral\"\n size=\"md\"\n leadingIcon={<ArrowLeftIcon aria-hidden size={16} />}\n onClick={onBack}\n className=\"flex-1 justify-center sm:flex-none\"\n >\n Back\n </Button>\n )}\n <Button\n variant=\"primary\"\n size=\"md\"\n trailingIcon={continueIcon === null ? undefined : (continueIcon ?? <ArrowRightIcon aria-hidden size={16} />)}\n onClick={onContinue}\n disabled={continueDisabled}\n className=\"flex-1 justify-center sm:flex-none\"\n >\n {continueLabel}\n </Button>\n </div>\n </div>\n );\n}\n","import {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type FormEvent,\n type FormHTMLAttributes,\n type ReactNode,\n} from 'react';\n\nimport { cn } from '../../lib/cn';\nimport { Button } from './button';\nimport { ControlSizeProvider } from './control-size';\nimport { FieldLegend, FieldSet } from './field';\nimport type { InputSize } from './input';\nimport { Stepper } from './stepper';\nimport { renderField, TYPED, type FieldScope } from './form-fields';\nimport type {\n FormErrors,\n FormField,\n FormLayout,\n FormResult,\n FormState,\n FormStep,\n FormSubmitOn,\n FormValues,\n} from './form.types';\n\n/** Handed to an `actions` render function, for buttons of your own. */\nexport interface FormActionsApi extends FormState {\n /** Submits the form, as its submit button does (validation first). */\n submit: () => void;\n /** With `steps`: back one step. */\n back: () => void;\n /** With `steps`: whether the current step is the last. Otherwise `true`. */\n lastStep: boolean;\n}\n\nexport interface FormProps<V extends object = FormValues>\n extends Omit<FormHTMLAttributes<HTMLFormElement>, 'onSubmit' | 'children' | 'title' | 'defaultValue'> {\n /** The fields, in order. A field's `section` groups it under a heading. */\n fields: FormField<V>[];\n /** The form's accessible name. */\n title: string;\n /** Starting values when the form holds them itself. */\n defaultValues?: Partial<V>;\n /** Controlled values. Pair with `onValuesChange`. */\n values?: V;\n /** Every change, with the new values and the name of the field that changed. */\n onValuesChange?: (values: NoInfer<V>, name: string) => void;\n /**\n * Saves the values, once every check passes. Disabled fields are left out. Return\n * `{ ok: false }` when the save is refused: the form keeps what was typed. Show why on the\n * page, in a toast or an alert outside the form: the form shows client-side messages only.\n * While it runs the form is `pending`. If it throws, the form stops being pending and the\n * error propagates.\n */\n onSubmit?: (values: NoInfer<V>) => FormResult | void | Promise<FormResult | void>;\n /**\n * Messages by field name (or `list.0.field` path), for values as they stand. A message shows\n * once its field has been visited or a submit was tried, and blocks the submit.\n */\n validate?: (values: NoInfer<V>) => FormErrors;\n /**\n * The message for an empty `required` field that `validate` leaves alone. Default\n * \"<Label> is required.\" Pass `false` to leave required checks to `validate`.\n */\n requiredMessage?: ((field: FormField<V>) => string) | false;\n /**\n * Messages from the page that show at once and win over the form's own, e.g. a check the page\n * runs itself. `undefined` entries are ignored. Not for save errors: those go outside the form.\n */\n errors?: FormErrors;\n /**\n * When a validation message first shows. `blur` (default): once its field has been visited, or a\n * submit was tried. `submit`: only once a submit was tried, as sign-in screens do.\n */\n validateOn?: 'blur' | 'submit';\n /** Default `grid`. */\n layout?: FormLayout;\n /** Default `submit`. `change` submits on every change, with typing debounced. */\n submitOn?: FormSubmitOn;\n /** Debounce for typing with `submitOn=\"change\"`, in ms. Default 300. */\n debounce?: number;\n /** Shows one step at a time; fields name theirs with `step`. Next validates the step. */\n steps?: FormStep[];\n /** Every field read-only, and no buttons. */\n readOnly?: boolean;\n /** Every field disabled. */\n disabled?: boolean;\n /** Control size for every field. */\n size?: InputSize;\n /** Default \"Save\". */\n submitLabel?: string;\n /** Read out while saving. Default \"Saving\". */\n pendingLabel?: string;\n /** Default \"Next\" and \"Back\", with `steps`. */\n nextLabel?: string;\n backLabel?: string;\n /** Shows a Cancel button that calls it. */\n onCancel?: () => void;\n cancelLabel?: string;\n /** Replaces the default buttons. */\n actions?: ReactNode | ((api: FormActionsApi) => ReactNode);\n /** Default: shown unless `readOnly` or `submitOn=\"change\"`. */\n showActions?: boolean;\n /** Pending, dirty, valid, checking and step, for buttons and guards outside the form. */\n onStateChange?: (state: FormState) => void;\n /** Extra content after the fields, before the buttons. */\n children?: ReactNode;\n}\n\nconst LAYOUT: Record<FormLayout, { form: string; group: string; full: string }> = {\n grid: {\n form: 'grid grid-cols-1 gap-5 sm:grid-cols-2',\n group: 'grid grid-cols-1 gap-4 sm:col-span-2 sm:grid-cols-2',\n full: 'sm:col-span-2',\n },\n stack: { form: 'flex flex-col gap-5', group: 'flex flex-col gap-4', full: '' },\n inline: { form: 'flex flex-wrap items-end gap-3', group: 'contents', full: '' },\n};\n\nconst rootOf = (path: string) => path.split('.')[0] ?? path;\n\nfunction isEmpty(value: unknown) {\n if (value === null || value === undefined || value === false) return true;\n if (typeof value === 'string') return value.trim() === '';\n if (Array.isArray(value)) return value.length === 0;\n return false;\n}\n\nfunction clean(errors: FormErrors | undefined): FormErrors {\n const out: FormErrors = {};\n for (const [key, message] of Object.entries(errors ?? {})) if (message) out[key] = message;\n return out;\n}\n\nconst defaultRequired = (field: { label?: string }) => `${field.label ?? 'This field'} is required.`;\n\n/**\n * A form described as data: give it fields and an `onSubmit`, and it holds the values, runs\n * every check that doesn't need a save, shows the messages against the right fields, and\n * tracks pending and dirty state.\n *\n * It covers record forms (`grid`, sections, one Save), narrow forms such as sign-in (`stack`),\n * filter toolbars (`inline` with `submitOn=\"change\"`) and step-by-step flows (`steps`). For\n * the one odd field, use a `custom` field (any control, wired to the form's value and error),\n * or a `list` field for repeated rows, rather than building the whole form by hand.\n *\n * Where messages show:\n * - **In the form, under the field:** everything checkable without saving. `required`,\n * `validate` (cross-field rules such as a matching password, conditional requirements), a\n * field's async `check` (e.g. username availability), and the page's own `errors`. A message\n * shows once its field is visited or a submit is tried, and blocks the submit.\n * - **Outside the form:** anything the save itself refuses. `onSubmit` returns `{ ok: false }`\n * and the page shows why in a toast or an alert. The form keeps what was typed.\n *\n * The Save button looks disabled while a message or a check stands in the way, but it stays\n * focusable and pressing it shows what is wrong: a disabled look is a signal, not an\n * explanation. Values are held in React state, never read back from the DOM.\n */\nexport function Form<V extends object = FormValues>({\n fields: fieldsProp,\n title,\n defaultValues,\n values: valuesProp,\n onValuesChange,\n onSubmit,\n validate,\n requiredMessage,\n errors: errorsProp,\n validateOn = 'blur',\n layout = 'grid',\n submitOn = 'submit',\n debounce = 300,\n steps,\n readOnly = false,\n disabled = false,\n size,\n submitLabel = 'Save',\n pendingLabel = 'Saving',\n nextLabel = 'Next',\n backLabel = 'Back',\n onCancel,\n cancelLabel = 'Cancel',\n actions,\n showActions,\n onStateChange,\n children,\n className,\n noValidate = true,\n ...formProps\n}: FormProps<V>) {\n // The fields' generic parameter only types callbacks for the caller; inside, values are a record.\n const fields = fieldsProp as unknown as FormField[];\n const [inner, setInner] = useState<FormValues>(() => ({ ...(defaultValues ?? {}) }));\n const controlled = valuesProp !== undefined;\n const values = (controlled ? valuesProp : inner) as FormValues;\n const valuesRef = useRef(values);\n valuesRef.current = values;\n\n const [baseline, setBaseline] = useState(() => JSON.stringify(values));\n const [touched, setTouched] = useState<ReadonlySet<string>>(() => new Set());\n const [tried, setTried] = useState(false);\n const [pending, setPending] = useState(false);\n const [step, setStep] = useState(0);\n // The values the form started with, or last saved: a `check` doesn't run on an unchanged value.\n const initial = useRef(values);\n // Async checks by field name, for the value (as JSON) they were run on.\n const [checks, setChecks] = useState<Record<string, { key: string; message?: string; done: boolean }>>({});\n const checkRuns = useRef(new Map<string, { key: string; timer: ReturnType<typeof setTimeout>; abort: AbortController }>());\n const [focusError, setFocusError] = useState(0);\n\n const formRef = useRef<HTMLFormElement>(null);\n const mounted = useRef(true);\n const submitSeq = useRef(0);\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n useEffect(() => {\n mounted.current = true;\n // The map itself never changes, only its entries.\n const runs = checkRuns.current;\n return () => {\n mounted.current = false;\n clearTimeout(timer.current);\n for (const run of runs.values()) {\n clearTimeout(run.timer);\n run.abort.abort();\n }\n };\n }, []);\n\n const visible = fields.filter((f) => !f.hidden?.(values));\n const lastStep = !steps || step >= steps.length - 1;\n const onStep = (f: FormField) => !steps || f.step === steps[step]?.id;\n\n // Validation messages for the values as they stand, whether or not they are shown yet.\n const clientErrors = useMemo(() => {\n const out: FormErrors = {};\n if (requiredMessage !== false) {\n const message = (requiredMessage || defaultRequired) as (field: FormField) => string;\n for (const f of visible) {\n const locked =\n disabled ||\n readOnly ||\n (typeof f.disabled === 'function' ? f.disabled(values) : f.disabled) ||\n (typeof f.readOnly === 'function' ? f.readOnly(values) : f.readOnly);\n if (f.required && !locked && isEmpty(values[f.name])) out[f.name] = message(f);\n }\n }\n Object.assign(out, clean(validate?.(values as V)));\n // A hidden field cannot show its message, so it cannot block the submit either.\n const shown = new Set(visible.map((f) => f.name));\n for (const key of Object.keys(out)) if (!shown.has(rootOf(key))) delete out[key];\n return out;\n // `visible` follows from `fields` and `values`.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [fields, values, validate, requiredMessage, disabled, readOnly]);\n\n const locked = (f: FormField) =>\n disabled || readOnly || !!(typeof f.disabled === 'function' ? f.disabled(values) : f.disabled) || !!(typeof f.readOnly === 'function' ? f.readOnly(values) : f.readOnly);\n // Which fields' async checks should run now, for which value.\n const wanted = new Map<string, string>();\n for (const f of visible) {\n if (!f.check || locked(f) || clientErrors[f.name] || isEmpty(values[f.name])) continue;\n const key = JSON.stringify(values[f.name]);\n if (key !== JSON.stringify(initial.current[f.name])) wanted.set(f.name, key);\n }\n const wantedKey = JSON.stringify([...wanted]);\n\n // Start, restart or drop checks as the values change. A run for an older value is aborted and\n // its answer ignored.\n useEffect(() => {\n const runs = checkRuns.current;\n for (const [name, run] of runs) {\n if (wanted.get(name) === run.key) continue;\n clearTimeout(run.timer);\n run.abort.abort();\n runs.delete(name);\n }\n setChecks((current) => {\n const next: typeof current = {};\n for (const [name, key] of wanted) next[name] = current[name]?.key === key ? current[name] : { key, done: false };\n return JSON.stringify(next) === JSON.stringify(current) ? current : next;\n });\n for (const [name, key] of wanted) {\n if (runs.has(name)) continue;\n const field = fields.find((f) => f.name === name);\n if (!field?.check) continue;\n const check = field.check;\n const abort = new AbortController();\n const timer = setTimeout(() => {\n check(valuesRef.current[name], valuesRef.current, abort.signal).then(\n (message) => {\n if (abort.signal.aborted || !mounted.current) return;\n setChecks((current) => (current[name]?.key === key ? { ...current, [name]: { key, done: true, message: message || undefined } } : current));\n },\n () => {\n // A check that fails to answer blocks nothing; the save checks again anyway.\n if (abort.signal.aborted || !mounted.current) return;\n setChecks((current) => (current[name]?.key === key ? { ...current, [name]: { key, done: true } } : current));\n },\n );\n }, field.checkDelay ?? 400);\n runs.set(name, { key, timer, abort });\n }\n // `wanted` is described by `wantedKey`.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [wantedKey, fields]);\n\n const checkState = (name: string) => {\n const key = wanted.get(name);\n const entry = key === undefined ? undefined : checks[name];\n return { checking: key !== undefined && (!entry || entry.key !== key || !entry.done), message: entry?.key === key ? entry?.message : undefined };\n };\n // Every message that blocks the submit: the form's own, then the async checks'.\n const blocking: FormErrors = { ...clientErrors };\n for (const name of wanted.keys()) {\n const message = checkState(name).message;\n if (message && !blocking[name]) blocking[name] = message;\n }\n const checkingNames = [...wanted.keys()].filter((name) => checkState(name).checking);\n\n const stepNames = new Set(visible.filter(onStep).map((f) => f.name));\n const valid = !Object.keys(blocking).some((key) => stepNames.has(rootOf(key)));\n const checking = checkingNames.some((name) => stepNames.has(name));\n const dirty = JSON.stringify(values) !== baseline;\n\n const onStateChangeRef = useRef(onStateChange);\n onStateChangeRef.current = onStateChange;\n useEffect(() => {\n onStateChangeRef.current?.({ pending, dirty, valid, checking, step });\n }, [pending, dirty, valid, checking, step]);\n\n // After a blocked submit, move focus to the first field that says what is wrong.\n useEffect(() => {\n if (!focusError) return;\n const target = formRef.current?.querySelector<HTMLElement>(\n '[aria-invalid=\"true\"]:not([aria-hidden=\"true\"]), [role=\"alert\"]',\n );\n if (target?.getAttribute('role') === 'alert') {\n target.closest('[data-field]')?.querySelector<HTMLElement>('input, textarea, button, select')?.focus();\n } else target?.focus();\n }, [focusError]);\n\n const runSubmit = useCallback(\n async (submitted: FormValues) => {\n if (!onSubmit) return;\n const seq = ++submitSeq.current;\n const current = valuesRef.current;\n // Disabled fields are shown, not submitted (as a browser leaves them out of a form post).\n const out: FormValues = { ...submitted };\n for (const f of fields) {\n if (typeof f.disabled === 'function' ? f.disabled(current) : f.disabled) delete out[f.name];\n }\n setPending(true);\n let result: FormResult | void;\n try {\n result = await onSubmit(out as V);\n } finally {\n // A newer submit (typing in a `change` form) or an unmount makes this one stale.\n if (mounted.current && seq === submitSeq.current) setPending(false);\n }\n if (!mounted.current || seq !== submitSeq.current) return;\n if (!result || result.ok) {\n // Saved: these are the values to compare against from now on.\n initial.current = current;\n setBaseline(JSON.stringify(current));\n }\n },\n [onSubmit, fields],\n );\n\n const setField = useCallback(\n (name: string, value: unknown, immediate = false) => {\n const next = { ...valuesRef.current, [name]: value };\n valuesRef.current = next;\n if (!controlled) setInner(next);\n onValuesChange?.(next as V, name);\n if (submitOn === 'change') {\n clearTimeout(timer.current);\n const field = fields.find((f) => f.name === name);\n if (field && TYPED.has(field.type) && !immediate) timer.current = setTimeout(() => void runSubmit(next), debounce);\n else void runSubmit(next);\n }\n },\n [controlled, onValuesChange, submitOn, fields, debounce, runSubmit],\n );\n\n const touch = useCallback((path: string) => {\n setTouched((current) => (current.has(path) ? current : new Set(current).add(path)));\n }, []);\n\n const shownError = (path: string) =>\n errorsProp?.[path] || (tried || (validateOn === 'blur' && touched.has(path)) ? blocking[path] : undefined);\n\n const submit = () => {\n if (readOnly || pending) return;\n if (checking) {\n // Nothing to show yet: the field already says \"Checking…\".\n setTried(true);\n return;\n }\n if (!valid) {\n setTried(true);\n setFocusError((n) => n + 1);\n return;\n }\n if (!lastStep) {\n setTried(false);\n setStep((s) => s + 1);\n return;\n }\n // On the last step, a message (or a check) left on an earlier step sends the user back to it.\n const stopping = [...Object.keys(blocking), ...checkingNames];\n if (stopping.length) {\n const first = fields.find((f) => stopping.some((k) => rootOf(k) === f.name));\n const index = steps?.findIndex((s) => s.id === first?.step) ?? -1;\n setTried(true);\n if (index >= 0) setStep(index);\n setFocusError((n) => n + 1);\n return;\n }\n setTried(true);\n void runSubmit(valuesRef.current);\n };\n\n const handleSubmit = (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n if (submitOn === 'change') {\n clearTimeout(timer.current);\n void runSubmit(valuesRef.current);\n return;\n }\n submit();\n };\n\n const back = () => {\n setTried(false);\n setStep((s) => Math.max(0, s - 1));\n };\n\n const scope: FieldScope = {\n values,\n path: (name) => name,\n set: setField,\n error: shownError,\n checking: (path) => checkState(path).checking,\n touch,\n disabled,\n readOnly,\n pending,\n layout,\n };\n\n // Sections in the order they first appear; fields without one come first, unheaded.\n const groups: [string, FormField[]][] = [];\n for (const f of fields.filter(onStep)) {\n const key = layout === 'inline' ? '' : (f.section ?? '');\n const group = groups.find(([k]) => k === key);\n if (group) group[1].push(f);\n else if (key === '') groups.unshift([key, [f]]);\n else groups.push([key, [f]]);\n }\n\n const L = LAYOUT[layout];\n const api: FormActionsApi = {\n pending,\n dirty,\n valid,\n checking,\n step,\n lastStep,\n submit: () => formRef.current?.requestSubmit(),\n back,\n };\n const withActions = showActions ?? (!readOnly && submitOn === 'submit');\n\n const body = (\n <form\n ref={formRef}\n aria-label={title}\n noValidate={noValidate}\n aria-busy={pending || undefined}\n {...formProps}\n onSubmit={handleSubmit}\n className={cn(L.form, className)}\n >\n {steps && (\n <div className={L.full}>\n <Stepper\n steps={steps.map((s, i) => ({\n label: s.label,\n status: i < step ? 'complete' : i === step ? 'active' : 'upcoming',\n }))}\n />\n </div>\n )}\n {groups.map(([section, group]) =>\n section ? (\n <FieldSet key={section} className={L.group}>\n <FieldLegend className={layout === 'grid' ? 'mb-1' : undefined}>{section}</FieldLegend>\n {group.map((f) => renderField(f, scope))}\n </FieldSet>\n ) : (\n <div key=\"\" className={L.group}>\n {group.map((f) => renderField(f, scope))}\n </div>\n ),\n )}\n {children}\n {withActions &&\n (actions !== undefined ? (\n typeof actions === 'function' ? actions(api) : actions\n ) : (\n <div className={cn('flex justify-end gap-2', L.full)}>\n {onCancel && (\n <Button variant=\"neutral\" onClick={onCancel}>\n {cancelLabel}\n </Button>\n )}\n {steps && step > 0 && (\n <Button variant=\"neutral\" onClick={back}>\n {backLabel}\n </Button>\n )}\n <Button\n type=\"submit\"\n loading={pending}\n loadingLabel={pendingLabel}\n // Looks disabled while something stands in the way, but stays pressable: pressing it\n // shows the messages. A natively disabled button would also block Enter-to-submit.\n aria-disabled={pending || !valid || checking || undefined}\n >\n {lastStep ? submitLabel : nextLabel}\n </Button>\n </div>\n ))}\n </form>\n );\n\n return size ? <ControlSizeProvider size={size}>{body}</ControlSizeProvider> : body;\n}\n","import { useState, type FocusEvent, type ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { EyeIcon, EyeOffIcon, PlusIcon, XIcon } from 'lucide-react';\n\nimport { Button } from './button';\nimport { Checkbox } from './checkbox';\nimport { Combobox, type ComboboxOption } from './combobox';\nimport { useControlSize } from './control-size';\nimport { CountrySelect, countryOptions } from './country-select';\nimport { DatePicker } from './date-picker';\nimport { Field, FieldError, FieldHint, FieldLabel, FieldLegend, FieldSet, useFieldContext } from './field';\nimport { IconButton } from './icon-button';\nimport { Input } from './input';\nimport { InputGroup, InputGroupAddon, InputGroupInput, SearchInput } from './input-group';\nimport { RadioGroup } from './radio-group';\nimport { SegmentedControl } from './segmented-control';\nimport { Select, type SelectOption, type SelectOptionGroup } from './select';\nimport { Switch } from './switch';\nimport { Textarea } from './textarea';\nimport { TimeZoneSelect } from './time-zone-select';\nimport type {\n FormCheckField,\n FormField,\n FormFieldContext,\n FormLayout,\n FormListField,\n FormTextType,\n FormValues,\n} from './form.types';\n\n/**\n * Where a field reads and writes its value. The form itself is one scope; each row of a `list`\n * field is another, whose paths are `list.index.field`.\n */\nexport interface FieldScope {\n values: FormValues;\n path: (name: string) => string;\n /** `immediate` skips the typing debounce of a `submitOn=\"change\"` form, e.g. for a clear button. */\n set: (name: string, value: unknown, immediate?: boolean) => void;\n error: (path: string) => string | undefined;\n /** Whether the field's `check` is running. */\n checking: (path: string) => boolean;\n touch: (path: string) => void;\n disabled: boolean;\n readOnly: boolean;\n pending: boolean;\n layout: FormLayout;\n}\n\ntype Resolved = {\n path: string;\n value: unknown;\n error: string | undefined;\n checking: boolean;\n hint: ReactNode;\n disabled: boolean;\n readOnly: boolean;\n required: boolean;\n ctx: FormFieldContext;\n};\n\nfunction resolve<T>(maybe: T | ((values: FormValues) => T) | undefined, values: FormValues) {\n return typeof maybe === 'function' ? (maybe as (values: FormValues) => T)(values) : maybe;\n}\n\nexport const str = (value: unknown) => (value === null || value === undefined ? '' : String(value));\n\nconst TEXT_TYPES: Record<FormTextType, { type: string; step?: string; inputMode?: 'decimal' }> = {\n text: { type: 'text' },\n email: { type: 'email' },\n tel: { type: 'tel' },\n url: { type: 'url' },\n number: { type: 'number' },\n currency: { type: 'number', step: '0.01', inputMode: 'decimal' },\n password: { type: 'password' },\n search: { type: 'search' },\n};\n\n/** Text-like types, whose changes a `submitOn=\"change\"` form debounces. */\nexport const TYPED: ReadonlySet<string> = new Set([...Object.keys(TEXT_TYPES), 'textarea']);\n\n/** Label, control, then the error or the hint: the chrome every labelled control shares. */\nfunction Shell({\n field,\n r,\n className,\n children,\n}: {\n field: FormField;\n r: Resolved;\n className?: string;\n children: ReactNode;\n}) {\n const label = field.label ? (\n <FieldLabel className={field.hideLabel ? 'sr-only' : undefined}>{field.label}</FieldLabel>\n ) : null;\n return (\n <Field\n required={r.required}\n disabled={r.disabled}\n data-field={r.path}\n className={className}\n onBlur={(event: FocusEvent<HTMLDivElement>) => {\n // Visited once focus leaves the whole field, not on every inner blur.\n if (!event.currentTarget.contains(event.relatedTarget as Node | null)) r.ctx.touch();\n }}\n >\n {field.labelAction ? (\n <div className=\"flex items-baseline justify-between gap-2\">\n {label}\n {field.labelAction}\n </div>\n ) : (\n label\n )}\n {children}\n <Messages r={r} />\n </Field>\n );\n}\n\n/** The error, else \"Checking…\" while an async check runs, else the hint. */\nfunction Messages({ r }: { r: Resolved }) {\n return (\n <>\n <FieldError>{r.error}</FieldError>\n <FieldHint aria-live=\"polite\">{r.checking ? 'Checking…' : r.hint}</FieldHint>\n </>\n );\n}\n\n/** A choice field that is read-only shows its label as plain, focusable text. */\nfunction ReadOnlyText({ value }: { value: string }) {\n return <Input readOnly value={value} />;\n}\n\nfunction flatOptions(entries: (SelectOption | SelectOptionGroup)[]): SelectOption[] {\n return entries.flatMap((entry) => ('options' in entry ? entry.options : [entry]));\n}\n\nfunction PasswordControl(props: {\n value: string;\n onChange: (value: string) => void;\n readOnly: boolean;\n placeholder?: string;\n autoComplete?: string;\n maxLength?: number;\n invalid: boolean;\n}) {\n const [visible, setVisible] = useState(false);\n const field = useFieldContext();\n return (\n <InputGroup invalid={props.invalid} disabled={field?.disabled}>\n <InputGroupInput\n type={visible ? 'text' : 'password'}\n value={props.value}\n onChange={(event) => props.onChange(event.target.value)}\n readOnly={props.readOnly}\n placeholder={props.placeholder}\n autoComplete={props.autoComplete}\n maxLength={props.maxLength}\n />\n <InputGroupAddon align=\"inline-end\" decorative={false}>\n <button\n type=\"button\"\n aria-label={visible ? 'Hide password' : 'Show password'}\n onClick={() => setVisible((v) => !v)}\n disabled={field?.disabled}\n className=\"flex items-center justify-center rounded transition-colors hover:text-default focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand\"\n >\n {visible ? <EyeOffIcon aria-hidden className=\"size-4\" /> : <EyeIcon aria-hidden className=\"size-4\" />}\n </button>\n </InputGroupAddon>\n </InputGroup>\n );\n}\n\n/** Checkbox and Switch carry their own label, so only the error comes from the shell. */\nfunction CheckControlField({ field, r }: { field: FormCheckField; r: Resolved }) {\n const ctx = useFieldContext();\n // Checkbox and Switch come in sm and md only; a small form gets the small ones.\n const size = useControlSize() === 'sm' ? 'sm' : 'md';\n const common = {\n checked: r.value === true,\n onCheckedChange: (checked: boolean) => {\n r.ctx.setValue(checked);\n r.ctx.touch();\n },\n label: field.hideLabel ? undefined : field.label,\n 'aria-label': field.hideLabel ? field.label : undefined,\n description: r.hint || undefined,\n disabled: r.disabled || r.readOnly,\n required: r.required,\n 'aria-invalid': r.error ? true : undefined,\n 'aria-describedby': r.error ? ctx?.errorId : r.checking ? ctx?.hintId : undefined,\n } as const;\n return field.type === 'switch' ? <Switch {...common} size={size} /> : <Checkbox {...common} size={size} invalid={!!r.error} />;\n}\n\nfunction ListRows({ field, r, scope }: { field: FormListField; r: Resolved; scope: FieldScope }) {\n const rows = Array.isArray(r.value) ? (r.value as FormValues[]) : [];\n const locked = r.disabled || r.readOnly;\n const atMax = field.max !== undefined && rows.length >= field.max;\n const atMin = field.min !== undefined && rows.length <= field.min;\n const write = (next: FormValues[]) => {\n r.ctx.setValue(next);\n r.ctx.touch();\n };\n const add = (item: FormValues) => {\n if (!atMax) write([...rows, item]);\n };\n\n return (\n <FieldSet\n data-field={r.path}\n aria-describedby={r.error ? `${r.path}-list-error` : undefined}\n className={clsx('flex flex-col gap-2', field.className)}\n >\n <FieldLegend variant=\"label\" className={field.hideLabel ? 'sr-only' : undefined}>\n {field.label}\n </FieldLegend>\n {field.header}\n {rows.length === 0 && field.empty}\n {rows.map((row, index) => {\n const rowScope: FieldScope = {\n ...scope,\n values: row,\n disabled: scope.disabled || r.disabled,\n readOnly: scope.readOnly || r.readOnly,\n path: (name) => `${r.path}.${index}.${name}`,\n set: (name, value) => write(rows.map((x, i) => (i === index ? { ...x, [name]: value } : x))),\n };\n const removable = !locked && !atMin && (field.canRemove?.(row, index) ?? true);\n return (\n <div\n key={field.itemKey?.(row, index) ?? index}\n role=\"group\"\n aria-label={`${field.label} ${index + 1}`}\n className=\"flex flex-wrap items-end gap-2\"\n >\n {field.fields.map((f) => renderField(f, rowScope))}\n <IconButton\n aria-label={field.removeLabel?.(row, index) ?? `Remove row ${index + 1}`}\n variant=\"neutral\"\n size=\"sm\"\n disabled={!removable}\n onClick={() => write(rows.filter((_, i) => i !== index))}\n >\n <XIcon aria-hidden className=\"size-4\" />\n </IconButton>\n </div>\n );\n })}\n {!locked &&\n (field.renderAdd\n ? field.renderAdd(add, r.ctx)\n : field.newItem && (\n <div>\n <Button\n variant=\"neutral\"\n size=\"sm\"\n leadingIcon={<PlusIcon aria-hidden className=\"size-4\" />}\n disabled={atMax}\n onClick={() => field.newItem && add(field.newItem())}\n >\n {field.addLabel ?? 'Add'}\n </Button>\n </div>\n ))}\n {r.error ? (\n <p id={`${r.path}-list-error`} role=\"alert\" className=\"text-body-sm text-danger\">\n {r.error}\n </p>\n ) : r.checking || r.hint ? (\n <p aria-live=\"polite\" className=\"text-body-sm text-default-secondary\">{r.checking ? 'Checking…' : r.hint}</p>\n ) : null}\n </FieldSet>\n );\n}\n\n/** One field, or nothing while it is hidden. */\nexport function renderField(field: FormField, scope: FieldScope): ReactNode {\n const { values } = scope;\n if (field.hidden?.(values)) return null;\n\n const path = scope.path(field.name);\n const value = values[field.name];\n const disabled = scope.disabled || !!resolve(field.disabled, values);\n const readOnly = scope.readOnly || !!resolve(field.readOnly, values);\n const ctx: FormFieldContext = {\n name: path,\n value,\n setValue: (next) => {\n scope.set(field.name, next);\n // After the form has the new value, so a reset it makes lands on top of it.\n field.onValueChange?.(next, { ...ctx, value: next });\n },\n values,\n setField: (name, next) => scope.set(name, next),\n error: scope.error(path),\n touch: () => scope.touch(path),\n disabled,\n readOnly,\n required: !!field.required,\n pending: scope.pending,\n };\n const r: Resolved = {\n path,\n value,\n error: ctx.error,\n checking: scope.checking(path),\n hint: resolve(field.hint, values),\n disabled,\n readOnly,\n required: !!field.required,\n ctx,\n };\n const wide = scope.layout === 'grid' && field.size === 'large' ? 'sm:col-span-2' : undefined;\n const className = clsx(wide, field.className) || undefined;\n const shell = (control: ReactNode) => (\n <Shell key={path} field={field} r={r} className={className}>\n {control}\n </Shell>\n );\n\n switch (field.type) {\n case 'text':\n case 'email':\n case 'tel':\n case 'url':\n case 'number':\n case 'currency':\n case 'search': {\n const attrs = TEXT_TYPES[field.type];\n const control = (\n <Input\n type={attrs.type}\n step={attrs.step}\n inputMode={attrs.inputMode}\n value={str(value)}\n onChange={(event) => ctx.setValue(field.transform ? field.transform(event.target.value) : event.target.value)}\n readOnly={readOnly}\n placeholder={field.placeholder}\n autoComplete={field.autoComplete}\n maxLength={field.maxLength}\n />\n );\n if (field.type === 'search') {\n return shell(\n <SearchInput\n label={field.label}\n value={str(value)}\n onChange={(event) => ctx.setValue(event.target.value)}\n onClear={readOnly ? undefined : () => scope.set(field.name, '', true)}\n readOnly={readOnly}\n disabled={disabled}\n placeholder={field.placeholder}\n autoComplete={field.autoComplete}\n />,\n );\n }\n return shell(control);\n }\n case 'password':\n return shell(\n <PasswordControl\n value={str(value)}\n onChange={(next) => ctx.setValue(field.transform ? field.transform(next) : next)}\n readOnly={readOnly}\n placeholder={field.placeholder}\n autoComplete={field.autoComplete}\n maxLength={field.maxLength}\n invalid={!!r.error}\n />,\n );\n case 'textarea':\n return shell(\n <Textarea\n value={str(value)}\n onChange={(event) => ctx.setValue(field.transform ? field.transform(event.target.value) : event.target.value)}\n readOnly={readOnly}\n rows={field.rows}\n placeholder={field.placeholder}\n maxLength={field.maxLength}\n />,\n );\n case 'select': {\n const options = resolve(field.options, values) ?? [];\n if (readOnly) {\n return shell(<ReadOnlyText value={flatOptions(options).find((o) => o.value === str(value))?.label ?? str(value)} />);\n }\n return shell(\n <Select\n // A visible label names it with its value (\"Status Active\"); a hidden one, on a toolbar\n // whose options already read \"Status: Active\", names it alone.\n {...(field.hideLabel ? { 'aria-label': field.label, 'aria-labelledby': undefined } : {})}\n options={options}\n value={str(value) || null}\n onValueChange={(next) => {\n ctx.setValue(next);\n ctx.touch();\n }}\n placeholder={field.loading ? 'Loading…' : field.placeholder}\n disabled={disabled || field.loading}\n aria-busy={field.loading || undefined}\n />,\n );\n }\n case 'combobox': {\n const options: ComboboxOption[] = resolve(field.options, values) ?? [];\n if (readOnly) return shell(<ReadOnlyText value={options.find((o) => o.value === value)?.label ?? str(value)} />);\n return shell(\n <Combobox\n options={options}\n value={str(value) || null}\n onValueChange={(next) => ctx.setValue(next)}\n label={field.label}\n placeholder={field.loading ? 'Loading…' : field.placeholder}\n emptyMessage={field.emptyMessage}\n clearable={field.clearable}\n disabled={disabled || field.loading}\n invalid={!!r.error}\n />,\n );\n }\n case 'country':\n if (readOnly) return shell(<ReadOnlyText value={value ? (countryOptions([str(value)], field.locale)[0]?.label ?? str(value)) : ''} />);\n return shell(\n <CountrySelect\n value={str(value) || null}\n onValueChange={(next) => ctx.setValue(next)}\n label={field.label}\n countries={field.countries}\n locale={field.locale}\n renderFlag={field.renderFlag}\n placeholder={field.placeholder}\n disabled={disabled}\n invalid={!!r.error}\n />,\n );\n case 'timezone':\n if (readOnly) return shell(<ReadOnlyText value={str(value)} />);\n return shell(\n <TimeZoneSelect\n value={str(value) || null}\n onValueChange={(next) => ctx.setValue(next)}\n label={field.label}\n timeZones={field.timeZones}\n placeholder={field.placeholder}\n disabled={disabled}\n invalid={!!r.error}\n />,\n );\n case 'radio': {\n const options = resolve(field.options, values) ?? [];\n if (readOnly) {\n const chosen = options.find((o) => o.value === value)?.label;\n return shell(<ReadOnlyText value={typeof chosen === 'string' ? chosen : str(value)} />);\n }\n return (\n <Field key={path} data-field={path} disabled={disabled} required={r.required} className={className}>\n <RadioGroup\n label={field.label}\n options={options}\n value={str(value)}\n onValueChange={(next) => {\n ctx.setValue(next);\n ctx.touch();\n }}\n orientation={field.orientation}\n disabled={disabled}\n required={r.required}\n invalid={!!r.error}\n />\n <Messages r={r} />\n </Field>\n );\n }\n case 'segmented': {\n const options = resolve(field.options, values) ?? [];\n if (readOnly || disabled) return shell(<ReadOnlyText value={options.find((o) => o.value === value)?.label ?? str(value)} />);\n return (\n <Field key={path} data-field={path} className={className}>\n <SegmentedControl\n label={field.label}\n options={options}\n value={str(value)}\n onValueChange={(next) => ctx.setValue(next)}\n />\n <Messages r={r} />\n </Field>\n );\n }\n case 'date':\n if (readOnly) return shell(<ReadOnlyText value={formatDate(str(value))} />);\n return shell(\n <DatePicker\n value={str(value)}\n // `onChange` fires for a calendar pick and for the native input alike; `onValueChange`\n // only for the calendar.\n onChange={(event) => {\n ctx.setValue(event.target.value);\n ctx.touch();\n }}\n min={field.min}\n max={field.max}\n placeholder={field.placeholder}\n />,\n );\n case 'checkbox':\n case 'switch':\n return (\n <Field key={path} data-field={path} disabled={disabled} className={className}>\n <CheckControlField field={field} r={r} />\n <FieldError>{r.error}</FieldError>\n {r.checking && <FieldHint aria-live=\"polite\">Checking…</FieldHint>}\n </Field>\n );\n case 'list':\n return <ListRows key={path} field={{ ...field, className }} r={r} scope={scope} />;\n case 'custom':\n if (field.bare) return <div key={path} data-field={path} className={className}>{field.render(ctx)}</div>;\n return shell(field.render(ctx));\n default:\n return null;\n }\n}\n\nfunction formatDate(iso: string) {\n const match = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(iso);\n if (!match) return iso;\n const date = new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n return new Intl.DateTimeFormat(undefined, { dateStyle: 'medium' }).format(date);\n}\n","import {\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from 'react';\nimport clsx from 'clsx';\nimport { CheckIcon, ChevronDownIcon } from 'lucide-react';\n\nimport { useControllableState } from '../../lib/use-controllable-state';\nimport { useFloatingPanel } from '../overlays/floating';\nimport {\n OVERLAY_HEADING,\n OVERLAY_ITEM_ACTIVE,\n OVERLAY_ITEM_BASE,\n OVERLAY_ITEM_SIZE,\n OVERLAY_PANEL,\n OVERLAY_PANEL_SCROLL,\n} from '../overlays/menu-styles';\nimport { Portal } from '../overlays/portal';\nimport { useFieldControl } from './field';\nimport { useControlSize } from './control-size';\nimport type { InputSize } from './input';\n\nexport interface ComboboxOption<T = string> {\n value: T;\n label: string;\n description?: string;\n disabled?: boolean;\n /** Optional group heading. Options sharing a group are rendered together. */\n group?: string;\n /**\n * A leading glyph, e.g. a flag or an avatar. It is shown before the option's label in the\n * list and, for the selected option, inside the field. Decorative: it is `aria-hidden`, so\n * the label must say everything. New in 0.9.0.\n */\n icon?: ReactNode;\n}\n\nexport interface ComboboxProps<T extends string = string> {\n options: ComboboxOption<T>[];\n value?: T | null;\n defaultValue?: T | null;\n onValueChange?: (value: T | null) => void;\n /** Accessible name. Required unless the combobox is inside a `Field` with a label. */\n label?: string;\n placeholder?: string;\n size?: InputSize;\n disabled?: boolean;\n invalid?: boolean;\n /** Allow clearing back to `null` by selecting the chosen option again. Default `true`. */\n clearable?: boolean;\n /** Override the filter. Default is a case-insensitive substring match on `label`. */\n filter?: (option: ComboboxOption<T>, query: string) => boolean;\n /** Shown when nothing matches. */\n emptyMessage?: ReactNode;\n /** Custom option rendering. Receives the option and whether it is selected. */\n renderOption?: (option: ComboboxOption<T>, selected: boolean) => ReactNode;\n className?: string;\n}\n\nconst HEIGHT: Record<InputSize, string> = {\n lg: 'h-12 px-4 text-body',\n md: 'h-9 px-3 text-body-sm',\n sm: 'h-6 px-2 text-body-tiny',\n};\n\n/**\n * Single-select combobox with a text filter — an autocomplete.\n *\n * Implements the ARIA 1.2 combobox pattern, which is specific about a few things that are\n * easy to get wrong and were all wrong in the `RoleComboBox` this replaces:\n *\n * - **`role=\"combobox\"` belongs on the text input**, not on a wrapping `<div>`. The div\n * version means the state attributes sit on an element the user never focuses.\n * - **`aria-activedescendant`, not focus, tracks the highlighted option.** Focus stays in\n * the input the whole time — moving DOM focus into the list breaks typing. This is the\n * one place a roving tabindex is the *wrong* answer, which is why this does not use\n * `useRovingFocus`.\n * - **`aria-controls` points at the listbox**, which therefore needs a stable id.\n * - The listbox is portaled, so it is not clipped by a `Card` or a scrolling container.\n *\n * For a command palette — filter over *actions* rather than a value — use `Command`.\n */\nexport function Combobox<T extends string = string>({\n options,\n value: valueProp,\n defaultValue = null,\n onValueChange,\n label,\n placeholder = 'Select…',\n size: sizeProp,\n disabled: disabledProp,\n invalid = false,\n clearable = true,\n filter,\n emptyMessage = 'No matches',\n renderOption,\n className,\n}: ComboboxProps<T>) {\n const size = useControlSize(sizeProp);\n const [value, setValue] = useControllableState<T | null>({\n value: valueProp,\n defaultValue,\n onChange: onValueChange as ((next: T | null) => void) | undefined,\n });\n\n const [open, setOpen] = useState(false);\n const [query, setQuery] = useState('');\n const [activeIndex, setActiveIndex] = useState(0);\n\n const baseId = useId();\n const listboxId = `${baseId}-listbox`;\n const optionId = (index: number) => `${baseId}-option-${index}`;\n\n const inputRef = useRef<HTMLInputElement>(null);\n const listRef = useRef<HTMLDivElement | null>(null);\n const rootRef = useRef<HTMLDivElement>(null);\n const field = useFieldControl();\n // A disabled `Field` disables the combobox too, as it does every other control (0.9.8).\n const disabled = disabledProp ?? field.disabled ?? false;\n\n const matches = useMemo(() => {\n const predicate =\n filter ?? ((option: ComboboxOption<T>, q: string) =>\n option.label.toLowerCase().includes(q.toLowerCase()));\n return query ? options.filter((option) => predicate(option, query)) : options;\n }, [options, query, filter]);\n\n const selected = options.find((option) => option.value === value) ?? null;\n\n // What the input displays: the query while filtering, the selection otherwise.\n const displayValue = open ? query : (selected?.label ?? '');\n // The selected option's icon goes wherever its label shows: as the value, or as the\n // placeholder while the list is open and nothing has been typed. Typing hides it.\n const leadingIcon = selected?.icon && (!open || query === '') ? selected.icon : null;\n\n const close = useCallback((restoreFocus = true) => {\n setOpen(false);\n setQuery('');\n if (restoreFocus) inputRef.current?.focus();\n }, []);\n\n const commit = (option: ComboboxOption<T>) => {\n if (option.disabled) return;\n setValue(clearable && option.value === value ? null : option.value);\n close();\n };\n\n const move = (delta: number) => {\n if (matches.length === 0) return;\n setActiveIndex((current) => {\n let next = current;\n for (let i = 0; i < matches.length; i++) {\n next = (next + delta + matches.length) % matches.length;\n if (!matches[next]?.disabled) break;\n }\n return next;\n });\n };\n\n const { refs, floatingStyles } = useFloatingPanel({\n open,\n onOpenChange: setOpen,\n side: 'bottom',\n align: 'start',\n sideOffset: 4,\n matchAnchorWidth: true,\n });\n\n useEffect(() => {\n refs.setReference(rootRef.current);\n }, [refs, open]);\n\n // Reset the highlight whenever the result set changes, so it never points past the end.\n useEffect(() => {\n setActiveIndex(0);\n }, [query, options]);\n\n // Keep the highlighted option in view. `aria-activedescendant` moves the virtual cursor but\n // does not scroll, which DOM focus would have done for free.\n useEffect(() => {\n if (!open) return;\n const node = listRef.current?.querySelector(`#${CSS.escape(optionId(activeIndex))}`);\n // Feature-detected: `scrollIntoView` is absent in jsdom and in some embedded webviews,\n // and an unguarded call there throws during render of an otherwise working combobox.\n if (node instanceof Element && typeof node.scrollIntoView === 'function') {\n node.scrollIntoView({ block: 'nearest' });\n }\n });\n\n useEffect(() => {\n if (!open) return;\n function onPointerDown(event: PointerEvent) {\n const withinRoot = rootRef.current?.contains(event.target as Node);\n const withinList = listRef.current?.contains(event.target as Node);\n if (!withinRoot && !withinList) close(false);\n }\n document.addEventListener('pointerdown', onPointerDown);\n return () => document.removeEventListener('pointerdown', onPointerDown);\n }, [open, close]);\n\n let renderedGroup: string | undefined;\n\n return (\n <div ref={rootRef} className={clsx('relative w-full', className)}>\n <div\n className={clsx(\n 'flex w-full items-center gap-2 rounded-lg border transition-colors',\n HEIGHT[size],\n 'focus-within:ring-2 focus-within:ring-offset-1 focus-within:ring-offset-default',\n disabled\n ? 'cursor-not-allowed border-disabled bg-disabled'\n : invalid || field['aria-invalid']\n ? 'border-danger-secondary focus-within:border-danger focus-within:ring-danger'\n : 'border-default bg-default focus-within:border-brand focus-within:ring-brand',\n )}\n >\n {leadingIcon && (\n <span aria-hidden data-slot=\"combobox-icon\" className=\"flex shrink-0 items-center\">\n {leadingIcon}\n </span>\n )}\n <input\n ref={inputRef}\n // ARIA 1.2: the role goes on the input the user actually focuses.\n role=\"combobox\"\n type=\"text\"\n autoComplete=\"off\"\n aria-expanded={open}\n aria-controls={listboxId}\n aria-autocomplete=\"list\"\n aria-activedescendant={open && matches.length > 0 ? optionId(activeIndex) : undefined}\n aria-label={label}\n {...field}\n disabled={disabled}\n value={displayValue}\n placeholder={selected ? selected.label : placeholder}\n onChange={(event) => {\n setQuery(event.target.value);\n if (!open) setOpen(true);\n }}\n onFocus={() => !disabled && setOpen(true)}\n onKeyDown={(event) => {\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n if (!open) setOpen(true);\n else move(1);\n break;\n case 'ArrowUp':\n event.preventDefault();\n if (!open) setOpen(true);\n else move(-1);\n break;\n case 'Home':\n if (open) {\n event.preventDefault();\n setActiveIndex(0);\n }\n break;\n case 'End':\n if (open) {\n event.preventDefault();\n setActiveIndex(matches.length - 1);\n }\n break;\n case 'Enter':\n if (open && matches[activeIndex]) {\n event.preventDefault();\n commit(matches[activeIndex]);\n }\n break;\n case 'Escape':\n event.preventDefault();\n close();\n break;\n case 'Tab':\n // Tab commits nothing and closes — the value only changes on Enter or click,\n // so tabbing away cannot silently pick whatever happened to be highlighted.\n if (open) close(false);\n break;\n default:\n break;\n }\n }}\n className={clsx(\n 'min-w-0 flex-1 bg-transparent text-default outline-none',\n 'placeholder:text-default-tertiary',\n 'disabled:cursor-not-allowed disabled:text-disabled',\n )}\n />\n <ChevronDownIcon\n aria-hidden\n className={clsx(\n 'shrink-0 transition-transform motion-reduce:transition-none',\n size === 'sm' ? 'size-3' : 'size-4',\n disabled ? 'text-icon-disabled' : 'text-icon-default-secondary',\n open && 'rotate-180',\n )}\n />\n </div>\n\n {open && (\n <Portal>\n <div\n ref={(node) => {\n listRef.current = node;\n refs.setFloating(node);\n }}\n id={listboxId}\n role=\"listbox\"\n aria-label={label}\n style={{ ...floatingStyles, width: 'var(--panel-anchor-width)' }}\n className={clsx('z-popover', OVERLAY_PANEL, OVERLAY_PANEL_SCROLL)}\n >\n {matches.length === 0 && (\n <p className=\"px-2.5 py-2 text-body-xs text-default-secondary\">{emptyMessage}</p>\n )}\n {matches.map((option, index) => {\n const isSelected = option.value === value;\n const isActive = index === activeIndex;\n const groupHeading = option.group !== renderedGroup ? option.group : undefined;\n renderedGroup = option.group;\n\n return (\n <div key={String(option.value)}>\n {groupHeading && (\n <div\n role=\"presentation\"\n className={OVERLAY_HEADING}\n >\n {groupHeading}\n </div>\n )}\n {/* Options are deliberately not focusable and carry no key handler. In the\n ARIA 1.2 combobox pattern focus never leaves the input — moving it into\n the list would stop the user typing — and `aria-activedescendant`\n carries the highlight instead, with the input owning every key.\n jsx-a11y cannot model that, so it sees an unreachable option; it is\n reachable, just not by DOM focus. */}\n {/* eslint-disable-next-line jsx-a11y/interactive-supports-focus, jsx-a11y/click-events-have-key-events */}\n <div\n id={optionId(index)}\n role=\"option\"\n aria-selected={isSelected}\n aria-disabled={option.disabled || undefined}\n onPointerDown={(event) => event.preventDefault()}\n onClick={() => commit(option)}\n onPointerEnter={() => !option.disabled && setActiveIndex(index)}\n className={clsx(\n OVERLAY_ITEM_BASE,\n OVERLAY_ITEM_SIZE.md,\n 'items-center',\n option.disabled\n ? 'cursor-not-allowed text-disabled'\n : isActive\n ? clsx(OVERLAY_ITEM_ACTIVE, 'text-default')\n : 'text-default',\n )}\n >\n {renderOption ? (\n renderOption(option, isSelected)\n ) : (\n <>\n {option.icon && (\n <span aria-hidden className=\"flex shrink-0 items-center self-center\">\n {option.icon}\n </span>\n )}\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate\">{option.label}</span>\n {option.description && (\n <span className=\"block truncate text-body-tiny text-default-secondary\">\n {option.description}\n </span>\n )}\n </span>\n {isSelected && (\n <CheckIcon aria-hidden className=\"size-3.5 shrink-0 text-brand\" strokeWidth={3} />\n )}\n </>\n )}\n </div>\n </div>\n );\n })}\n </div>\n </Portal>\n )}\n </div>\n );\n}\n","import { useMemo, type ReactNode } from 'react';\n\nimport { Combobox, type ComboboxOption, type ComboboxProps } from './combobox';\n\n/**\n * ISO 3166-1 alpha-2 codes for every officially assigned country and territory.\n *\n * `Intl` can name a region but cannot list them — there is no `supportedValuesOf('region')` —\n * so the codes are the one thing this component has to carry itself. Labels still come from\n * `Intl.DisplayNames`, which means they follow the locale instead of being frozen in English.\n */\nconst ISO_3166_ALPHA_2 =\n 'AD AE AF AG AI AL AM AO AQ AR AS AT AU AW AX AZ BA BB BD BE BF BG BH BI BJ BL BM BN BO BQ BR ' +\n 'BS BT BV BW BY BZ CA CC CD CF CG CH CI CK CL CM CN CO CR CU CV CW CX CY CZ DE DJ DK DM DO DZ ' +\n 'EC EE EG EH ER ES ET FI FJ FK FM FO FR GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GS GT GU GW ' +\n 'GY HK HM HN HR HT HU ID IE IL IM IN IO IQ IR IS IT JE JM JO JP KE KG KH KI KM KN KP KR KW KY ' +\n 'KZ LA LB LC LI LK LR LS LT LU LV LY MA MC MD ME MF MG MH MK ML MM MN MO MP MQ MR MS MT MU MV ' +\n 'MW MX MY MZ NA NC NE NF NG NI NL NO NP NR NU NZ OM PA PE PF PG PH PK PL PM PN PR PS PT PW PY ' +\n 'QA RE RO RS RU RW SA SB SC SD SE SG SH SI SJ SK SL SM SN SO SR SS ST SV SX SY SZ TC TD TF TG ' +\n 'TH TJ TK TL TM TN TO TR TT TV TW TZ UA UG UM US UY UZ VA VC VE VG VI VN VU WF WS YE YT ZA ZM ZW';\n\nexport const COUNTRY_CODES: readonly string[] = ISO_3166_ALPHA_2.split(' ');\n\nexport interface CountrySelectProps\n extends Omit<ComboboxProps<string>, 'options' | 'filter' | 'renderOption'> {\n /** Restrict the list to these ISO 3166-1 alpha-2 codes. Default: every code. */\n countries?: readonly string[];\n /** Locale for the country names. Default: the browser's. */\n locale?: string;\n /**\n * A flag (or any glyph) for a code, shown before each name and in the field. The library\n * ships no flag artwork: bring your own, e.g. the flag-icons CSS:\n * renderFlag={(code) => <span className={'fi fi-' + code.toLowerCase()} />}. Emoji flags are\n * not a substitute: Windows has no colour glyphs for them. New in 0.9.0.\n */\n renderFlag?: (code: string) => ReactNode;\n}\n\n/** Country names for `codes` in `locale`, sorted by name. Falls back to the code itself. */\nexport function countryOptions(\n codes: readonly string[] = COUNTRY_CODES,\n locale?: string,\n): ComboboxOption<string>[] {\n let names: Intl.DisplayNames | null = null;\n try {\n names = new Intl.DisplayNames(locale ? [locale] : undefined, { type: 'region' });\n } catch {\n // An unknown locale throws. Codes are still a usable list.\n }\n return codes\n .map((code) => ({ value: code, label: names?.of(code) ?? code, description: code }))\n .sort((a, b) => a.label.localeCompare(b.label, locale));\n}\n\n/**\n * Searchable country picker. The value is an ISO 3166-1 alpha-2 code (`\"LK\"`), never the\n * display name, so it survives a locale change and can be stored as-is.\n *\n * A thin layer over `Combobox` — same keyboard contract, same panel — that adds the list and\n * lets the query match the code as well as the name, so typing `GB` finds United Kingdom.\n * A value outside `countries` is still listed, so a saved country never renders as an empty\n * field.\n */\nexport function CountrySelect({\n countries,\n locale,\n renderFlag,\n placeholder = 'Select a country…',\n emptyMessage = 'No countries match',\n ...props\n}: CountrySelectProps) {\n const keep = [props.value, props.defaultValue].filter((v): v is string => !!v);\n const keepKey = keep.join('|');\n const options = useMemo(() => {\n const list = countryOptions(countries, locale);\n const missing = keep.filter((v) => !list.some((o) => o.value === v));\n const all = [...countryOptions(missing, locale), ...list];\n return renderFlag ? all.map((option) => ({ ...option, icon: renderFlag(option.value) })) : all;\n // `keep` is rebuilt every render; `keepKey` is its stable identity.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [countries, locale, keepKey, renderFlag]);\n\n return (\n <Combobox\n {...props}\n options={options}\n placeholder={placeholder}\n emptyMessage={emptyMessage}\n filter={(option, query) => {\n const q = query.trim().toLowerCase();\n return option.label.toLowerCase().includes(q) || option.value.toLowerCase() === q;\n }}\n />\n );\n}\n","import {\n createContext,\n forwardRef,\n useContext,\n useId,\n type HTMLAttributes,\n type InputHTMLAttributes,\n type ReactNode,\n} from 'react';\nimport clsx from 'clsx';\nimport { devWarn } from '../../lib/dev-warn';\nimport { useControllableState } from '../../lib/use-controllable-state';\nimport { CheckControl, type CheckControlSize } from './check-control';\n\nexport type RadioGroupOrientation = 'vertical' | 'horizontal';\n\ninterface RadioGroupContextValue {\n name: string;\n value: string | undefined;\n setValue: (value: string) => void;\n size: CheckControlSize;\n disabled: boolean;\n invalid: boolean;\n}\n\nconst RadioGroupContext = createContext<RadioGroupContextValue | null>(null);\n\n/** One radio as data: the `Radio` props it renders with. New in 0.8.0. */\nexport interface RadioGroupOption {\n value: string;\n label: ReactNode;\n description?: ReactNode;\n disabled?: boolean;\n}\n\nexport interface RadioGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {\n /** The parts: `Radio`s. Omit when passing `options`. */\n children?: ReactNode;\n /** The radios as data, each rendered as a `Radio`. New in 0.8.0. Use it or `children`. */\n options?: readonly RadioGroupOption[];\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n /** Shared `name` for the underlying inputs. Generated when omitted. */\n name?: string;\n /** Names the group. Prefer wrapping in `FieldSet` + `FieldLegend` for a visible label. */\n label?: string;\n size?: CheckControlSize;\n orientation?: RadioGroupOrientation;\n disabled?: boolean;\n invalid?: boolean;\n required?: boolean;\n}\n\n/**\n * Radio group. Matches the `Type=Radio` half of Figma's `Checkbox` set, and shares its\n * geometry through `CheckControl`.\n *\n * Built on real `<input type=\"radio\">` elements sharing a `name`, which is what buys the\n * whole keyboard contract for free: arrow keys move *and* select, only the checked radio is\n * in the tab sequence, and the group is announced as \"2 of 4\". A `div`-based\n * `role=\"radiogroup\"` has to reimplement all of that, and the version of this pattern the\n * library already had — `SegmentedControl` before 0.4.0 — shipped with none of it.\n *\n * `role=\"radiogroup\"` is still set explicitly rather than relying on a `<fieldset>`, so the\n * group works with or without a visible legend.\n */\nexport const RadioGroup = forwardRef<HTMLDivElement, RadioGroupProps>(function RadioGroup(\n {\n children,\n options,\n value: valueProp,\n defaultValue,\n onValueChange,\n name,\n label,\n size = 'md',\n orientation = 'vertical',\n disabled = false,\n invalid = false,\n required = false,\n className,\n ...rest\n },\n ref,\n) {\n const generatedName = useId();\n const [value, setValue] = useControllableState<string | undefined>({\n value: valueProp,\n defaultValue,\n onChange: onValueChange as ((next: string | undefined) => void) | undefined,\n });\n\n return (\n <RadioGroupContext.Provider\n value={{\n name: name ?? generatedName,\n value,\n setValue: (next) => setValue(next),\n size,\n disabled,\n invalid,\n }}\n >\n <div\n ref={ref}\n role=\"radiogroup\"\n aria-label={label}\n aria-required={required || undefined}\n aria-invalid={invalid || undefined}\n aria-orientation={orientation}\n data-slot=\"radio-group\"\n className={clsx(\n 'flex',\n orientation === 'vertical' ? 'flex-col gap-2.5' : 'flex-row flex-wrap gap-4',\n className,\n )}\n {...rest}\n >\n {options\n ? options.map((option) => (\n <Radio\n key={option.value}\n value={option.value}\n label={option.label}\n description={option.description}\n disabled={option.disabled}\n />\n ))\n : children}\n </div>\n </RadioGroupContext.Provider>\n );\n});\n\nexport interface RadioProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'onChange' | 'checked'> {\n value: string;\n label?: ReactNode;\n /** Second line under the label. Matches Figma's `Supporting text` axis. */\n description?: ReactNode;\n /**\n * Standalone only (outside a `RadioGroup`): whether this radio is the selected one. Inside a\n * group the group's `value` decides, and this is ignored. New in 0.9.5.\n */\n checked?: boolean;\n /** Standalone only: called with `true` when the user selects this radio. New in 0.9.5. */\n onCheckedChange?: (checked: boolean) => void;\n /** Standalone only; a group sets it for its radios. New in 0.9.5. */\n size?: CheckControlSize;\n /** Standalone only; a group sets it for its radios. New in 0.9.5. */\n invalid?: boolean;\n className?: string;\n}\n\nconst LABEL_TEXT: Record<CheckControlSize, string> = {\n sm: 'text-body-tiny',\n md: 'text-body-xs',\n};\n\n/**\n * One radio. Inside a `RadioGroup` it takes its name, value and state from the group.\n *\n * From 0.9.5 it also works **standalone**, for radios a group's wrapper cannot hold, such as one\n * per row of a table (\"Make this the default\"). Give every radio of the set the same `name`,\n * control `checked`, and handle `onCheckedChange`. Native radios that share a name are one group\n * wherever they sit in the DOM, so arrow keys, the single tab stop and \"2 of 4\" still work. Name\n * the set with the column header, and name each radio with `aria-label` when it has no `label`.\n * This is MUI's standalone `Radio`; a `div role=\"radiogroup\"` around a whole table would put the\n * table's other controls inside the group.\n */\nexport const Radio = forwardRef<HTMLInputElement, RadioProps>(function Radio(\n {\n value,\n label,\n description,\n disabled,\n id,\n className,\n checked: checkedProp,\n onCheckedChange,\n size: sizeProp,\n invalid: invalidProp,\n name: nameProp,\n ...props\n },\n ref,\n) {\n const group = useContext(RadioGroupContext);\n if (!group && !nameProp) {\n devWarn('A standalone <Radio> needs a `name` shared by its set: without one, each radio is a group of its own.');\n }\n\n const generatedId = useId();\n const controlId = id ?? generatedId;\n const descriptionId = `${controlId}-description`;\n const isDisabled = disabled ?? group?.disabled ?? false;\n const checked = group ? group.value === value : Boolean(checkedProp);\n const size = group?.size ?? sizeProp ?? 'md';\n const invalid = group?.invalid ?? invalidProp ?? false;\n const name = group?.name ?? nameProp;\n const select = () => (group ? group.setValue(value) : onCheckedChange?.(true));\n\n return (\n <div className={clsx('flex flex-col', className)}>\n <label\n htmlFor={controlId}\n className={clsx(\n // relative: the hidden input is absolutely positioned (sr-only). Without a positioned\n // ancestor here its box lands far up the page, and focusing it on click scrolled a\n // scrolling container to that spot, away from the control.\n 'group relative inline-flex items-start gap-2.5',\n isDisabled ? 'cursor-not-allowed opacity-60' : 'cursor-pointer',\n )}\n >\n <input\n ref={ref}\n id={controlId}\n type=\"radio\"\n name={name}\n value={value}\n checked={checked}\n disabled={isDisabled}\n aria-invalid={!group && invalid ? true : undefined}\n aria-describedby={description ? descriptionId : undefined}\n onChange={select}\n className=\"peer sr-only\"\n {...props}\n />\n <CheckControl type=\"radio\" checked={checked} disabled={isDisabled} invalid={invalid} size={size} />\n {label && <span className={clsx(LABEL_TEXT[size], 'text-default')}>{label}</span>}\n </label>\n {/* Outside the <label> — see the note in `Checkbox`. Text nested in a label becomes\n part of the accessible *name*, so the description would be read twice: once as\n the name and again as the description. */}\n {description && (\n <span\n id={descriptionId}\n className={clsx(\n 'mt-0.5 pl-[26px]',\n LABEL_TEXT[size],\n isDisabled ? 'text-disabled' : 'text-default-secondary',\n )}\n >\n {description}\n </span>\n )}\n </div>\n );\n});\n","import clsx from 'clsx';\nimport { useRovingFocus } from '../../lib/use-roving-focus';\nimport { useControllableState } from '../../lib/use-controllable-state';\n\nexport interface SegmentedControlOption {\n value: string;\n label: string;\n disabled?: boolean;\n}\n\nexport interface SegmentedControlProps {\n options: SegmentedControlOption[];\n /** Controlled selection. Omit and pass `defaultValue` for uncontrolled. */\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n /** Names the group. Required by the APG when the control has no visible label. */\n label?: string;\n className?: string;\n}\n\n/**\n * Single-select segmented toggle.\n *\n * Through 0.3.0 this had **no ARIA whatsoever** — the selected segment was distinguished\n * only by `bg-default shadow-panel`, so a screen reader user could not tell which of the\n * segments was active. It is single-select, so `radiogroup`/`radio` is the correct pattern\n * rather than a row of `aria-pressed` buttons: it announces \"2 of 3\" and lets the arrow\n * keys move between options, which a toggle-button group does not.\n *\n * `onChange` was also optional, so `<SegmentedControl options value />` rendered a control\n * that looked interactive and silently did nothing.\n */\nexport function SegmentedControl({\n options,\n value: valueProp,\n defaultValue,\n onValueChange,\n label,\n className,\n}: SegmentedControlProps) {\n const [value, setValue] = useControllableState({\n value: valueProp,\n defaultValue: defaultValue ?? options[0]?.value,\n onChange: onValueChange,\n });\n\n const selectedIndex = Math.max(\n 0,\n options.findIndex((option) => option.value === value),\n );\n\n const roving = useRovingFocus({\n orientation: 'horizontal',\n loop: true,\n defaultIndex: selectedIndex,\n });\n\n return (\n <div\n role=\"radiogroup\"\n aria-label={label}\n className={clsx(\n 'inline-flex items-center rounded-xl border border-default bg-default-secondary p-0.5',\n className,\n )}\n {...roving.containerProps}\n >\n {options.map((option, index) => {\n const selected = option.value === value;\n const itemProps = roving.itemProps(index, {\n disabled: option.disabled,\n label: option.label,\n });\n\n return (\n <button\n key={option.value}\n type=\"button\"\n role=\"radio\"\n aria-checked={selected}\n disabled={option.disabled}\n {...itemProps}\n // The tab stop follows selection, not focus, so Tab lands on the active\n // segment rather than wherever the arrows were last used.\n tabIndex={selected ? 0 : -1}\n onFocus={() => {\n itemProps.onFocus();\n if (!option.disabled) setValue(option.value);\n }}\n onClick={() => !option.disabled && setValue(option.value)}\n className={clsx(\n 'rounded-lg px-3.5 py-1.5 text-body-xs font-medium transition-colors',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default-secondary',\n 'disabled:cursor-not-allowed disabled:opacity-50',\n selected\n ? 'bg-default text-default shadow-panel'\n : 'text-default-secondary hover:text-default',\n )}\n >\n {option.label}\n </button>\n );\n })}\n </div>\n );\n}\n","import { useMemo } from 'react';\n\nimport { Combobox, type ComboboxOption, type ComboboxProps } from './combobox';\n\nexport interface TimeZoneSelectProps\n extends Omit<ComboboxProps<string>, 'options' | 'filter' | 'renderOption'> {\n /** Restrict the list to these IANA zone names. Default: every zone the runtime supports. */\n timeZones?: readonly string[];\n /**\n * The instant offsets are computed for. Default: now. Offsets move with daylight saving,\n * so a fixed date is mainly useful for tests and screenshots.\n */\n at?: Date;\n}\n\n/**\n * Renamed zones, old name → current IANA name. Chromium's ICU still lists the old names\n * (`Asia/Calcutta`, not `Asia/Kolkata`), so without this a search for Kolkata finds nothing\n * and a stored `Asia/Kolkata` matches no option.\n */\nconst RENAMED: Record<string, string> = {\n 'America/Godthab': 'America/Nuuk',\n 'Asia/Calcutta': 'Asia/Kolkata',\n 'Asia/Katmandu': 'Asia/Kathmandu',\n 'Asia/Rangoon': 'Asia/Yangon',\n 'Asia/Saigon': 'Asia/Ho_Chi_Minh',\n 'Atlantic/Faeroe': 'Atlantic/Faroe',\n 'Europe/Kiev': 'Europe/Kyiv',\n 'Pacific/Enderbury': 'Pacific/Kanton',\n 'Pacific/Ponape': 'Pacific/Pohnpei',\n 'Pacific/Truk': 'Pacific/Chuuk',\n};\n\n/** The current IANA name for a zone: `Asia/Kolkata` for `Asia/Calcutta`. */\nexport const currentZoneName = (zone: string): string => RENAMED[zone] ?? zone;\n\n/** `Intl.supportedValuesOf` is ES2022 and missing from older runtimes — read it defensively. */\nfunction supportedTimeZones(): string[] {\n const intl = Intl as typeof Intl & { supportedValuesOf?: (key: 'timeZone') => string[] };\n try {\n const zones = intl.supportedValuesOf?.('timeZone');\n if (zones && zones.length > 0) return zones;\n } catch {\n // Fall through.\n }\n return ['UTC'];\n}\n\n/** `\"+05:30\"` for Asia/Colombo. Minutes east of UTC are returned alongside for sorting. */\nexport function timeZoneOffset(timeZone: string, at: Date = new Date()): { label: string; minutes: number } {\n try {\n const part = new Intl.DateTimeFormat('en-US', { timeZone, timeZoneName: 'longOffset' })\n .formatToParts(at)\n .find((p) => p.type === 'timeZoneName')?.value;\n // \"GMT+05:30\", \"GMT-03:00\", or bare \"GMT\" for UTC itself.\n const match = part?.match(/GMT([+-])(\\d{2}):(\\d{2})/);\n if (!match) return { label: '+00:00', minutes: 0 };\n const [, sign, hh, mm] = match;\n const minutes = (Number(hh) * 60 + Number(mm)) * (sign === '-' ? -1 : 1);\n return { label: `${sign}${hh}:${mm}`, minutes };\n } catch {\n return { label: '+00:00', minutes: 0 };\n }\n}\n\n/**\n * One option per zone, labelled `(UTC+05:30) Asia/Colombo`, west to east then by name.\n * Renamed zones are listed under their current name, once.\n */\nexport function timeZoneOptions(\n zones: readonly string[] = supportedTimeZones(),\n at: Date = new Date(),\n): ComboboxOption<string>[] {\n return Array.from(new Set(zones.map(currentZoneName)))\n .map((zone) => ({ zone, minutes: timeZoneOffset(zone, at).minutes }))\n .sort((a, b) => a.minutes - b.minutes || a.zone.localeCompare(b.zone))\n .map(({ zone }) => zoneOption(zone, at));\n}\n\nconst zoneOption = (zone: string, at: Date): ComboboxOption<string> => ({\n value: zone,\n label: `(UTC${timeZoneOffset(zone, at).label}) ${zone.replace(/_/g, ' ')}`,\n});\n\n/**\n * Searchable IANA time-zone picker. The value is the zone name (`\"Asia/Colombo\"`), never an\n * offset: an offset changes with daylight saving and cannot be turned back into a zone.\n *\n * Labels show the current UTC offset, and the query matches the zone name with or without\n * underscores and the offset itself, so `colombo`, `new york` and `+05:30` all find a zone.\n * A value missing from the list — stored under another name, or outside `timeZones` — is\n * still listed, so a saved zone never renders as an empty field.\n */\nexport function TimeZoneSelect({\n timeZones,\n at,\n placeholder = 'Select a time zone…',\n emptyMessage = 'No time zones match',\n ...props\n}: TimeZoneSelectProps) {\n // `at` is a Date, so depend on its timestamp rather than its identity.\n const atTime = at?.getTime();\n const keep = [props.value, props.defaultValue].filter((v): v is string => !!v);\n const keepKey = keep.join('|');\n const options = useMemo(() => {\n const when = atTime === undefined ? new Date() : new Date(atTime);\n const list = timeZoneOptions(timeZones, when);\n const missing = keep.filter((v) => !list.some((o) => o.value === v));\n return [...missing.map((v) => zoneOption(v, when)), ...list];\n // `keep` is rebuilt every render; `keepKey` is its stable identity.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [timeZones, atTime, keepKey]);\n\n return (\n <Combobox\n {...props}\n options={options}\n placeholder={placeholder}\n emptyMessage={emptyMessage}\n filter={(option, query) => {\n const q = query.trim().toLowerCase();\n return option.label.toLowerCase().includes(q) || option.value.toLowerCase().includes(q);\n }}\n />\n );\n}\n","import { useEffect, useRef, useState } from 'react';\nimport type { SelectOption } from './select';\n\nexport interface DependentOptions<T = SelectOption> {\n /** Choices for the parent's current value. Empty while loading, when the parent is empty, or if loading failed. */\n options: T[];\n /** True from the moment the parent value changes until `load` answers. */\n loading: boolean;\n}\n\n/**\n * Choices of a field that depend on another field's value, fetched asynchronously, e.g. the\n * departments of the chosen role. New in 0.10.0 (from Cleo's form work).\n *\n * Calls `load(parentValue)` every time the parent value changes and ignores answers that arrive\n * after the parent has changed again. An empty parent loads nothing. The options are tied to the\n * parent value they were loaded for, so a stale list is never shown for a new parent. A `load`\n * that fails gives no options.\n *\n * Pass `loading` to the `Form` select or combobox field, which then shows \"Loading…\".\n * Clearing the dependent field's own value when the parent changes is up to the form: do it in\n * the parent field's `onValueChange`.\n *\n * ```tsx\n * const { options, loading } = useDependentOptions(values.role ?? '', loadDepartments);\n * const fields = [\n * { type: 'select', name: 'role', label: 'Role', options: roles,\n * onValueChange: (_, ctx) => ctx.setField('department', null) },\n * { type: 'select', name: 'department', label: 'Department', options, loading,\n * disabled: (v) => !v.role },\n * ];\n * ```\n */\nexport function useDependentOptions<T = SelectOption>(\n parentValue: string,\n load: (parentValue: string) => Promise<T[]>,\n): DependentOptions<T> {\n const [loaded, setLoaded] = useState<{ parent: string; options: T[] } | null>(null);\n\n // Always call the latest `load` without making callers memoize it.\n const loadRef = useRef(load);\n useEffect(() => {\n loadRef.current = load;\n });\n\n useEffect(() => {\n if (!parentValue) return;\n let stale = false;\n loadRef\n .current(parentValue)\n .catch(() => [] as T[])\n .then((options) => {\n if (!stale) setLoaded({ parent: parentValue, options });\n });\n return () => {\n stale = true;\n };\n }, [parentValue]);\n\n const ready = loaded !== null && loaded.parent === parentValue;\n return {\n options: parentValue && ready ? loaded.options : [],\n loading: !!parentValue && !ready,\n };\n}\n","/**\n * The 0.10.0 names of `Form` and its types, kept so code written against 0.10.0 still compiles.\n * 0.10.0 published the component as `SchemaForm`; 0.10.1 renamed it `Form`. These will be removed\n * in a later minor release.\n */\nimport { Form } from './form';\nimport type { FormActionsApi, FormProps } from './form';\nimport type {\n FormCheckField,\n FormComboboxField,\n FormCountryField,\n FormCustomField,\n FormDateField,\n FormErrors,\n FormField,\n FormFieldBase,\n FormFieldContext,\n FormFieldSize,\n FormFieldType,\n FormLayout,\n FormListField,\n FormRadioField,\n FormResult,\n FormSegmentedField,\n FormSelectField,\n FormState,\n FormStep,\n FormSubmitOn,\n FormTextareaField,\n FormTextField,\n FormTextType,\n FormTimeZoneField,\n FormValues,\n} from './form.types';\n\n/** @deprecated Since 0.10.1. Use `Form`. */\nexport const SchemaForm = Form;\n\n/** @deprecated Since 0.10.1. Use `FormProps`. */\nexport type SchemaFormProps<V extends object = FormValues> = FormProps<V>;\n/** @deprecated Since 0.10.1. Use `FormActionsApi`. */\nexport type SchemaFormActionsApi = FormActionsApi;\n/** @deprecated Since 0.10.1. Use `FormValues`. */\nexport type SchemaFormValues = FormValues;\n/** @deprecated Since 0.10.1. Use `FormResult`. */\nexport type SchemaFormResult = FormResult;\n/** @deprecated Since 0.10.1. Use `FormErrors`. */\nexport type SchemaFormErrors = FormErrors;\n/** @deprecated Since 0.10.1. Use `FormState`. */\nexport type SchemaFormState = FormState;\n/** @deprecated Since 0.10.1. Use `FormLayout`. */\nexport type SchemaFormLayout = FormLayout;\n/** @deprecated Since 0.10.1. Use `FormSubmitOn`. */\nexport type SchemaFormSubmitOn = FormSubmitOn;\n/** @deprecated Since 0.10.1. Use `FormStep`. */\nexport type SchemaFormStep = FormStep;\n/** @deprecated Since 0.10.1. Use `FormField`. */\nexport type SchemaFormField<V extends object = FormValues> = FormField<V>;\n/** @deprecated Since 0.10.1. Use `FormFieldType`. */\nexport type SchemaFormFieldType = FormFieldType;\n/** @deprecated Since 0.10.1. Use `FormFieldBase`. */\nexport type SchemaFormFieldBase<V extends object = FormValues> = FormFieldBase<V>;\n/** @deprecated Since 0.10.1. Use `FormFieldContext`. */\nexport type SchemaFormFieldContext<V extends object = FormValues> = FormFieldContext<V>;\n/** @deprecated Since 0.10.1. Use `FormFieldSize`. */\nexport type SchemaFormFieldSize = FormFieldSize;\n/** @deprecated Since 0.10.1. Use `FormTextType`. */\nexport type SchemaFormTextType = FormTextType;\n/** @deprecated Since 0.10.1. Use `FormTextField`. */\nexport type SchemaFormTextField<V extends object = FormValues> = FormTextField<V>;\n/** @deprecated Since 0.10.1. Use `FormTextareaField`. */\nexport type SchemaFormTextareaField<V extends object = FormValues> = FormTextareaField<V>;\n/** @deprecated Since 0.10.1. Use `FormSelectField`. */\nexport type SchemaFormSelectField<V extends object = FormValues> = FormSelectField<V>;\n/** @deprecated Since 0.10.1. Use `FormComboboxField`. */\nexport type SchemaFormComboboxField<V extends object = FormValues> = FormComboboxField<V>;\n/** @deprecated Since 0.10.1. Use `FormCountryField`. */\nexport type SchemaFormCountryField<V extends object = FormValues> = FormCountryField<V>;\n/** @deprecated Since 0.10.1. Use `FormTimeZoneField`. */\nexport type SchemaFormTimeZoneField<V extends object = FormValues> = FormTimeZoneField<V>;\n/** @deprecated Since 0.10.1. Use `FormRadioField`. */\nexport type SchemaFormRadioField<V extends object = FormValues> = FormRadioField<V>;\n/** @deprecated Since 0.10.1. Use `FormSegmentedField`. */\nexport type SchemaFormSegmentedField<V extends object = FormValues> = FormSegmentedField<V>;\n/** @deprecated Since 0.10.1. Use `FormDateField`. */\nexport type SchemaFormDateField<V extends object = FormValues> = FormDateField<V>;\n/** @deprecated Since 0.10.1. Use `FormCheckField`. */\nexport type SchemaFormCheckField<V extends object = FormValues> = FormCheckField<V>;\n/** @deprecated Since 0.10.1. Use `FormListField`. */\nexport type SchemaFormListField<V extends object = FormValues> = FormListField<V>;\n/** @deprecated Since 0.10.1. Use `FormCustomField`. */\nexport type SchemaFormCustomField<V extends object = FormValues> = FormCustomField<V>;\n","import type { ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { XIcon } from 'lucide-react';\n\nexport type BadgeColor = 'gray' | 'red' | 'yellow' | 'lime' | 'green' | 'teal' | 'blue' | 'pink' | 'slate' | 'violet';\n\n/**\n * Every `BadgeColor`, in a stable order: the library's categorical palette. Index it to give\n * data a colour of its own, e.g. a company's tile `BADGE_COLORS[hash % BADGE_COLORS.length]`,\n * instead of keeping a list of hex values in the app. New in 0.9.5.\n */\nexport const BADGE_COLORS: readonly BadgeColor[] = ['blue', 'green', 'violet', 'yellow', 'teal', 'pink', 'lime', 'red', 'slate', 'gray'];\nexport type BadgeSize = 'sm' | 'lg';\nexport type BadgeVariant = 'default' | 'subtle';\n\nexport interface BadgeProps {\n label: string;\n color?: BadgeColor;\n size?: BadgeSize;\n variant?: BadgeVariant;\n indicator?: boolean;\n /**\n * A leading glyph, e.g. `<LockIcon />` on a \"System\" badge. Decorative: the label names the\n * badge, so the glyph is hidden from assistive tech and sized to the badge. New in 0.9.5.\n */\n icon?: ReactNode;\n /** Makes the badge removable: an × button named \"Remove {label}\". Same name as on `TagPill`. */\n onRemove?: () => void;\n /** @deprecated Renamed `onRemove` in 0.9.0, to match `TagPill`. Still works. */\n onClose?: () => void;\n className?: string;\n}\n\nconst defaultClasses: Record<BadgeColor, string> = {\n gray: 'bg-badge-gray text-badge-gray',\n red: 'bg-badge-red text-badge-red',\n yellow: 'bg-badge-yellow text-badge-yellow',\n lime: 'bg-badge-lime text-badge-lime',\n green: 'bg-badge-green text-badge-green',\n teal: 'bg-badge-teal text-badge-teal',\n blue: 'bg-badge-blue text-badge-blue',\n pink: 'bg-badge-pink text-badge-pink',\n slate: 'bg-badge-slate text-badge-slate',\n violet: 'bg-badge-violet text-badge-violet',\n};\n\n// Subtle is outline-only: the colour's tint is the border and its dark shade the text, the same\n// text colour as the filled variant. Through 0.7.0 every subtle badge used text-default-secondary,\n// so colour carried no meaning in the label.\nconst subtleClasses: Record<BadgeColor, string> = {\n gray: 'border border-badge-gray text-badge-gray',\n red: 'border border-badge-red text-badge-red',\n yellow: 'border border-badge-yellow text-badge-yellow',\n lime: 'border border-badge-lime text-badge-lime',\n green: 'border border-badge-green text-badge-green',\n teal: 'border border-badge-teal text-badge-teal',\n blue: 'border border-badge-blue text-badge-blue',\n pink: 'border border-badge-pink text-badge-pink',\n slate: 'border border-badge-slate text-badge-slate',\n violet: 'border border-badge-violet text-badge-violet',\n};\n\nexport function Badge({\n label,\n color = 'gray',\n size = 'sm',\n variant = 'default',\n indicator = false,\n icon,\n onRemove: onRemoveProp,\n onClose,\n className,\n}: BadgeProps) {\n const onRemove = onRemoveProp ?? onClose;\n const isDefault = variant === 'default';\n\n return (\n <span\n data-variant={variant}\n className={clsx(\n 'inline-flex items-center rounded-full px-2 py-0.5',\n size === 'sm' ? 'gap-1' : 'gap-1.5',\n isDefault ? defaultClasses[color] : subtleClasses[color],\n className,\n )}\n >\n {indicator && (\n <span\n className={clsx(\n 'shrink-0 rounded-full bg-current',\n size === 'sm' ? 'h-1.5 w-1.5' : 'h-2 w-2',\n )}\n />\n )}\n {icon && (\n <span\n aria-hidden\n className={clsx('inline-flex shrink-0 [&>svg]:h-full [&>svg]:w-full', size === 'sm' ? 'h-3 w-3' : 'h-3.5 w-3.5')}\n >\n {icon}\n </span>\n )}\n <span\n className={clsx(\n 'whitespace-nowrap',\n size === 'sm'\n ? clsx('text-body-tiny', isDefault && 'font-semibold')\n : 'text-body-xs',\n )}\n >\n {label}\n </span>\n {onRemove && (\n <button\n type=\"button\"\n onClick={onRemove}\n className={clsx(\n 'inline-flex shrink-0 items-center justify-center rounded-full opacity-60 transition-opacity hover:opacity-100',\n size === 'sm' ? 'h-3 w-3' : 'h-4 w-4',\n )}\n // Was a hardcoded \"Remove\", so a row of five dismissible badges produced five\n // identically named buttons with nothing to tell them apart.\n aria-label={`Remove ${label}`}\n >\n <XIcon className=\"h-full w-full\" strokeWidth={2.5} aria-hidden />\n </button>\n )}\n </span>\n );\n}\n","import clsx from 'clsx';\n\n/**\n * The nine-hue categorical palette from `badge.css`, which is what roles want: a role is a\n * *category*, not a severity, so it must not borrow the semantic tones — a `danger`-coloured\n * role badge would imply the role itself is a problem.\n */\nexport type RoleBadgeTone =\n | 'slate'\n | 'blue'\n | 'green'\n | 'yellow'\n | 'red'\n | 'pink'\n | 'violet'\n | 'teal'\n | 'lime'\n | 'gray';\n\nexport interface RoleBadgeProps {\n role: string;\n size?: 'sm' | 'md';\n /**\n * Override the name-map lookup. Use this for roles the map does not know, in preference to\n * `color` — it stays on the token layer and re-themes with the rest of the badge palette.\n */\n tone?: RoleBadgeTone;\n /**\n * @deprecated Bypasses the design tokens — pass `tone` instead. Raw 6-digit hex; text uses\n * the hex and the background a 12% tint of it. Kept for role colours that genuinely come\n * from API data rather than from the design system.\n */\n color?: string | null;\n}\n\n/**\n * Role → palette hue.\n *\n * Through 0.4.0 this was ten hardcoded hex pairs, thirteen of whose twenty values sat off\n * the palette entirely. `Compliance Lead` was the worst: `#5b3da8`, a violet with no ramp in\n * `Color Primitives` at all — a gap `status.css` had already documented for `accent`.\n *\n * Hues were chosen by comparing the original hex against the resolved palette, not by eye.\n * Several land almost exactly:\n *\n * Auditor / Viewer #f5f5f5 / #757575 → gray #f5f5f5 / #757575 (exact)\n * admin family #e9eff7 / #0c2d58 → slate #f1f1f5 / #0c2d58 (text exact)\n * Entity Manager #fbe6cf / #9a6206 → yellow #feedcf / #996100\n * Intelligence Analyst #fde2e7 / #a3284a → red #fce9eb / #bb223a\n * Reviewer #dbeafe / #1d4ed8 → blue\n * Requester #e6f4ea / #1f7a3d → green\n *\n * `Compliance Lead` was reassigned to pink through 0.8.x, because the palette had no violet.\n * From 0.9.0 it is `violet` again, the original #ece6f7 / #5b3da8: the hue is the role's\n * identity, and pink read as a different role. The palette's violet is literal values (see\n * `status.css`), since the primitives have no violet ramp. `teal` and `lime` are deliberately\n * left free for roles added later.\n */\nconst ROLE_TONES: Record<string, RoleBadgeTone> = {\n 'Super Admin': 'slate',\n 'Admin': 'slate',\n 'User': 'slate',\n 'Compliance Lead': 'violet',\n 'Reviewer': 'blue',\n 'Requester': 'green',\n 'Entity Manager': 'yellow',\n 'Intelligence Analyst': 'red',\n 'Auditor': 'gray',\n 'Viewer': 'gray',\n};\n\nconst FALLBACK_TONE: RoleBadgeTone = 'gray';\n\n/**\n * `bg-badge-*` resolves to `--badge-*-bg` and `text-badge-*` to `--badge-*-text`, so each\n * pair is the label/on-label duo the palette was designed around.\n */\nconst TONE_STYLES: Record<RoleBadgeTone, string> = {\n slate: 'bg-badge-slate text-badge-slate',\n blue: 'bg-badge-blue text-badge-blue',\n green: 'bg-badge-green text-badge-green',\n yellow: 'bg-badge-yellow text-badge-yellow',\n red: 'bg-badge-red text-badge-red',\n pink: 'bg-badge-pink text-badge-pink',\n violet: 'bg-badge-violet text-badge-violet',\n teal: 'bg-badge-teal text-badge-teal',\n lime: 'bg-badge-lime text-badge-lime',\n gray: 'bg-badge-gray text-badge-gray',\n};\n\nconst HEX6 = /^#[0-9a-fA-F]{6}$/;\n\nexport function RoleBadge({ role, size = 'sm', tone, color }: RoleBadgeProps) {\n // The raw-hex path stays for data-driven colour, but it no longer wins by default: a\n // caller has to opt into leaving the token layer.\n const rawColor = color && HEX6.test(color) ? color : undefined;\n const resolved = tone ?? ROLE_TONES[role] ?? FALLBACK_TONE;\n\n return (\n <span\n data-tone={tone}\n // A long custom role name ellipsises inside a narrow cell or header row instead of\n // pushing its neighbours, with the full name as a `title`. SCIC's original did this;\n // the 0.7.0 port lost it, and 0.9.1 restores it. The inner span carries the\n // ellipsis, because text-overflow does not apply to an inline-flex box's own text.\n title={role}\n className={clsx(\n 'inline-flex max-w-full items-center rounded-full font-medium whitespace-nowrap align-middle',\n size === 'sm' ? 'px-2 py-0.5 text-body-tiny' : 'px-3 py-1 text-body-xs',\n !rawColor && TONE_STYLES[resolved],\n )}\n style={rawColor ? { backgroundColor: `${rawColor}1F`, color: rawColor } : undefined}\n >\n <span className=\"min-w-0 truncate\">{role}</span>\n </span>\n );\n}\n","import { RoleBadge } from '../status/role-badge';\nimport { Combobox, type ComboboxOption } from './combobox';\nimport type { InputSize } from './input';\n\nexport interface RoleOption {\n role: string;\n description: string;\n}\n\nexport const ROLE_COMBO_OPTIONS: RoleOption[] = [\n { role: 'Reviewer', description: 'Reviews onboarding requests' },\n { role: 'Admin', description: 'Full org control' },\n { role: 'Compliance Lead', description: 'Owns compliance' },\n { role: 'Requester', description: 'Creates onboarding requests' },\n { role: 'Viewer', description: 'Read-only access' },\n { role: 'User', description: 'Default user access' },\n];\n\nexport interface RoleComboBoxProps {\n value: string;\n onChange: (role: string) => void;\n options?: RoleOption[];\n /** Accessible name. Defaults to `Role`. */\n label?: string;\n size?: InputSize;\n disabled?: boolean;\n className?: string;\n}\n\n/**\n * Role picker.\n *\n * Rebuilt in 0.4.0 as a thin wrapper over `Combobox`, which is all it should ever have been.\n * The version it replaces was the least correct component in the library and is worth\n * recording, because every one of these was a category of bug rather than a detail:\n *\n * - `role=\"combobox\"` sat on a `<div>` while the real `<input>` had no role and none of the\n * state attributes. Under ARIA 1.2 the role belongs on the input.\n * - The `role=\"listbox\"` had no `id`, so `aria-controls` could not point at it, and there\n * was no `aria-activedescendant` at all.\n * - No arrow keys, no Home/End, no wrap. The **selected** option had no `tabIndex`, so it\n * was mouse-only, while every *other* option was individually tabbable.\n * - Escape worked on the trigger but not on the search input or the options, and closing\n * never returned focus to the trigger.\n * - The tick was a literal `✓` text node, announced as \"check mark\" mid-option.\n * - It bypassed the token system entirely — `border-blue-500`, `bg-white`, `bg-blue-50`,\n * `text-blue-600`, `text-sm` — and built its className with a template literal. Both are\n * explicitly against the rules in CLAUDE.md, and the raw colours meant it would not theme.\n *\n * It stays a preset rather than becoming `Combobox` usage at every call site only because it\n * renders a `RoleBadge` per option, which `renderOption` exists for.\n */\nexport function RoleComboBox({\n value,\n onChange,\n options = ROLE_COMBO_OPTIONS,\n label = 'Role',\n size = 'md',\n disabled = false,\n className,\n}: RoleComboBoxProps) {\n const comboboxOptions: ComboboxOption[] = options.map((option) => ({\n value: option.role,\n label: option.role,\n description: option.description,\n }));\n\n return (\n <Combobox\n options={comboboxOptions}\n value={value}\n onValueChange={(next) => next && onChange(next)}\n label={label}\n size={size}\n disabled={disabled}\n // A role is always set — there is no \"no role\" state — so re-selecting must not clear.\n clearable={false}\n emptyMessage=\"No roles match\"\n className={className}\n renderOption={(option) => (\n <>\n <RoleBadge role={option.value} size=\"sm\" />\n <span className=\"min-w-0 flex-1 truncate text-body-xs text-default-secondary\">\n {option.description}\n </span>\n </>\n )}\n />\n );\n}\n","import { useEffect, useId, useMemo, useRef, useState, type ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { SearchIcon } from 'lucide-react';\n\nimport { SCROLLBAR_CLASSES } from '../../lib/scrollbar';\n\nimport {\n OVERLAY_HEADING,\n OVERLAY_ITEM_ACTIVE,\n OVERLAY_ITEM_BASE,\n OVERLAY_ITEM_SIZE,\n} from '../overlays/menu-styles';\n\nexport interface CommandItem {\n id: string;\n label: string;\n description?: string;\n /** Group heading. Items sharing a group render together, in the order given. */\n group?: string;\n icon?: ReactNode;\n /** Trailing hint — pass `<Kbd>` elements. */\n shortcut?: ReactNode;\n /** Extra words to match on that are not in the label — synonyms, the old name of a page. */\n keywords?: string[];\n disabled?: boolean;\n onSelect: () => void;\n}\n\nexport interface CommandProps {\n items: CommandItem[];\n /** Accessible name. Default `Command palette`. */\n label?: string;\n placeholder?: string;\n emptyMessage?: ReactNode;\n /** Called after any item is chosen — usually closes the containing dialog. */\n onAfterSelect?: () => void;\n autoFocus?: boolean;\n className?: string;\n}\n\n/**\n * A ⌘K command palette — filter over *actions* and run one.\n *\n * The same ARIA combobox pattern as `Combobox`, and for the same reasons: `role=\"combobox\"`\n * on the input, focus never leaving it, and `aria-activedescendant` carrying the highlight.\n * What differs is the intent, and it changes two behaviours:\n *\n * - Items are **commands, not values**. There is no selected state to display, no way to\n * clear, and choosing one runs a callback rather than setting anything.\n * - Matching includes `keywords`, so \"logout\" can find \"Sign out\" — a palette is useless if\n * you have to already know the wording.\n *\n * This is the palette body only. Put it in a `Modal` for the usual ⌘K overlay; keeping the\n * two separate means the palette can also be embedded in a page or a `Popover`, and the\n * dialog semantics stay with the component that owns them.\n *\n * A live region reports the result count, because otherwise a screen reader user typing into\n * the filter gets no feedback that the list changed underneath them.\n */\nexport function Command({\n items,\n label = 'Command palette',\n placeholder = 'Type a command or search…',\n emptyMessage = 'No results',\n onAfterSelect,\n autoFocus = true,\n className,\n}: CommandProps) {\n const [query, setQuery] = useState('');\n const [activeIndex, setActiveIndex] = useState(0);\n\n const baseId = useId();\n const listboxId = `${baseId}-listbox`;\n const optionId = (index: number) => `${baseId}-option-${index}`;\n\n const listRef = useRef<HTMLDivElement>(null);\n\n const matches = useMemo(() => {\n if (!query) return items;\n const q = query.toLowerCase();\n return items.filter((item) => {\n if (item.label.toLowerCase().includes(q)) return true;\n if (item.group?.toLowerCase().includes(q)) return true;\n return item.keywords?.some((keyword) => keyword.toLowerCase().includes(q)) ?? false;\n });\n }, [items, query]);\n\n useEffect(() => {\n setActiveIndex(0);\n }, [query]);\n\n useEffect(() => {\n const node = listRef.current?.querySelector(`#${CSS.escape(optionId(activeIndex))}`);\n // Feature-detected — see the same note in `Combobox`. Absent in jsdom and some webviews.\n if (node instanceof Element && typeof node.scrollIntoView === 'function') {\n node.scrollIntoView({ block: 'nearest' });\n }\n });\n\n const run = (item: CommandItem) => {\n if (item.disabled) return;\n item.onSelect();\n onAfterSelect?.();\n };\n\n const move = (delta: number) => {\n if (matches.length === 0) return;\n setActiveIndex((current) => {\n let next = current;\n for (let i = 0; i < matches.length; i++) {\n next = (next + delta + matches.length) % matches.length;\n if (!matches[next]?.disabled) break;\n }\n return next;\n });\n };\n\n let renderedGroup: string | undefined;\n\n return (\n <div className={clsx('relative flex w-full flex-col', className)}>\n <div className=\"flex items-center gap-2 border-b border-default px-3.5 py-3\">\n <SearchIcon aria-hidden className=\"size-4 shrink-0 text-icon-default-secondary\" />\n <input\n role=\"combobox\"\n type=\"text\"\n autoComplete=\"off\"\n // A palette's list is always visible while it is open, so `aria-expanded` is\n // permanently true rather than tracking a collapsed state that never happens.\n aria-expanded\n aria-controls={listboxId}\n aria-autocomplete=\"list\"\n aria-activedescendant={matches.length > 0 ? optionId(activeIndex) : undefined}\n aria-label={label}\n // Autofocus is correct here specifically: a command palette is opened by an\n // explicit gesture (⌘K) whose entire purpose is to start typing, so *not* focusing\n // the input would strand the user. The rule guards against autofocus on ordinary\n // page load, which this is not. Caller can still opt out.\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n value={query}\n placeholder={placeholder}\n onChange={(event) => setQuery(event.target.value)}\n onKeyDown={(event) => {\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n move(1);\n break;\n case 'ArrowUp':\n event.preventDefault();\n move(-1);\n break;\n case 'Home':\n event.preventDefault();\n setActiveIndex(0);\n break;\n case 'End':\n event.preventDefault();\n setActiveIndex(matches.length - 1);\n break;\n case 'Enter':\n if (matches[activeIndex]) {\n event.preventDefault();\n run(matches[activeIndex]);\n }\n break;\n default:\n break;\n }\n }}\n className=\"min-w-0 flex-1 bg-transparent text-body-sm text-default outline-none placeholder:text-default-tertiary\"\n />\n </div>\n\n <div\n ref={listRef}\n id={listboxId}\n role=\"listbox\"\n aria-label={label}\n // Focus stays in the filter input and `aria-activedescendant` carries the\n // highlight, so this must not become a tab stop of its own.\n className={clsx('max-h-80 overflow-y-auto p-1.5', SCROLLBAR_CLASSES)}\n >\n {matches.length === 0 && (\n <p className=\"px-2.5 py-6 text-center text-body-sm text-default-secondary\">\n {emptyMessage}\n </p>\n )}\n {matches.map((item, index) => {\n const isActive = index === activeIndex;\n const groupHeading = item.group !== renderedGroup ? item.group : undefined;\n renderedGroup = item.group;\n\n return (\n <div key={item.id}>\n {groupHeading && (\n <div\n role=\"presentation\"\n className={OVERLAY_HEADING}\n >\n {groupHeading}\n </div>\n )}\n {/* Not focusable by design — see the note in `Combobox`. Focus stays in the\n filter input and `aria-activedescendant` carries the highlight. */}\n {/* eslint-disable-next-line jsx-a11y/interactive-supports-focus, jsx-a11y/click-events-have-key-events */}\n <div\n id={optionId(index)}\n role=\"option\"\n aria-selected={isActive}\n aria-disabled={item.disabled || undefined}\n onPointerDown={(event) => event.preventDefault()}\n onClick={() => run(item)}\n onPointerEnter={() => !item.disabled && setActiveIndex(index)}\n className={clsx(\n OVERLAY_ITEM_BASE,\n OVERLAY_ITEM_SIZE.md,\n 'items-center',\n item.disabled\n ? 'cursor-not-allowed text-disabled'\n : isActive\n ? clsx(OVERLAY_ITEM_ACTIVE, 'text-default')\n : 'text-default',\n )}\n >\n {item.icon && (\n <span aria-hidden className=\"flex size-4 shrink-0 items-center justify-center\">\n {item.icon}\n </span>\n )}\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate\">{item.label}</span>\n {item.description && (\n <span className=\"block truncate text-body-tiny text-default-secondary\">\n {item.description}\n </span>\n )}\n </span>\n {item.shortcut && (\n <span className=\"ml-auto flex shrink-0 items-center gap-1\">{item.shortcut}</span>\n )}\n </div>\n </div>\n );\n })}\n </div>\n\n {/* Typing filters the list silently otherwise — a sighted user sees it shrink, a\n screen reader user gets nothing. */}\n <span aria-live=\"polite\" className=\"sr-only\">\n {`${matches.length} ${matches.length === 1 ? 'result' : 'results'}`}\n </span>\n </div>\n );\n}\n","import clsx from 'clsx';\nimport type { ReactNode } from 'react';\n\n/**\n * The six status tones from the Figma design system.\n * Values live in `src/app/styles/tokens/status.css`; see that file for why they do\n * not derive from the SDS semantic colour families.\n */\nexport type StatusTone =\n | 'neutral'\n | 'info'\n | 'warning'\n | 'caution'\n | 'accent'\n | 'violet'\n | 'positive'\n | 'danger';\n\nexport type StatusBadgeSize = 'sm' | 'md';\n\nconst TONE_STYLES: Record<StatusTone, string> = {\n neutral: 'bg-status-neutral text-status-neutral',\n info: 'bg-status-info text-status-info',\n warning: 'bg-status-warning text-status-warning',\n caution: 'bg-status-caution text-status-caution',\n accent: 'bg-status-accent text-status-accent',\n violet: 'bg-status-violet text-status-violet',\n positive: 'bg-status-positive text-status-positive',\n danger: 'bg-status-danger text-status-danger',\n};\n\nconst DOT_STYLES: Record<StatusTone, string> = {\n neutral: 'bg-status-dot-neutral',\n info: 'bg-status-dot-info',\n warning: 'bg-status-dot-warning',\n caution: 'bg-status-dot-caution',\n accent: 'bg-status-dot-accent',\n violet: 'bg-status-dot-violet',\n positive: 'bg-status-dot-positive',\n danger: 'bg-status-dot-danger',\n};\n\nconst SIZE_STYLES: Record<StatusBadgeSize, string> = {\n sm: 'px-2 py-0.5 text-body-tiny',\n md: 'px-3 py-1 text-body-xs',\n};\n\nexport interface StatusBadgeProps {\n label: string;\n tone?: StatusTone;\n size?: StatusBadgeSize;\n /** Leading dot. On by default — the Figma status pills all carry one. */\n dot?: boolean;\n /**\n * Leading glyph, replacing the dot — e.g. `<CheckIcon className=\"size-3\" />`.\n * Use for states a colour alone under-states, like verified or rejected.\n */\n icon?: ReactNode;\n className?: string;\n}\n\n/**\n * The status pill.\n *\n * Replaces thirteen inline re-implementations of the same markup plus five\n * competing hardcoded hex palettes. Generalises `TableCellStatusPill`, which had\n * this exact markup but required callers to pass raw hex strings.\n *\n * Note this is NOT `StatusChip` — that one renders a label *and a count* and is a\n * different component.\n */\nexport function StatusBadge({\n label,\n tone = 'neutral',\n size = 'md',\n dot = true,\n icon,\n className,\n}: StatusBadgeProps) {\n return (\n <span\n data-tone={tone}\n className={clsx(\n 'inline-flex items-center gap-1.5 rounded-full font-medium leading-tight whitespace-nowrap',\n SIZE_STYLES[size],\n TONE_STYLES[tone],\n className,\n )}\n >\n {icon ? (\n <span className=\"shrink-0\">{icon}</span>\n ) : (\n dot && <span className={clsx('size-1.5 shrink-0 rounded-full', DOT_STYLES[tone])} />\n )}\n {label}\n </span>\n );\n}\n","import clsx from 'clsx';\n\nexport type StatusDotTone = 'brand' | 'positive' | 'warning' | 'danger' | 'neutral' | 'default';\n\nexport interface StatusDotProps {\n tone?: StatusDotTone;\n /** @deprecated Bypasses the design tokens — pass `tone` instead. Raw hex color, overrides `tone` via inline style. Use when the exact source color doesn't match a design token. */\n color?: string;\n className?: string;\n}\n\nconst dotTones: Record<StatusDotTone, string> = {\n brand: 'bg-brand',\n positive:'bg-positive',\n warning: 'bg-warning',\n danger: 'bg-danger',\n neutral: 'bg-neutral',\n default: 'bg-default-tertiary',\n};\n\nexport function StatusDot({ tone = 'default', color, className }: StatusDotProps) {\n return (\n <span\n data-tone={tone}\n className={clsx('inline-block size-1.5 shrink-0 rounded-full', !color && dotTones[tone], className)}\n style={color ? { backgroundColor: color } : undefined}\n />\n );\n}\n","import clsx from 'clsx';\nimport { StatusDot } from './status-dot';\nimport type { StatusDotTone } from './status-dot';\n\nexport interface StatusChipProps {\n label: string;\n count: number | string;\n tone?: StatusDotTone;\n /** @deprecated Bypasses the design tokens — pass `tone` instead. Raw hex dot color, overrides `tone` via inline style. Use when the exact source color doesn't match a design token. */\n dotColor?: string;\n bg?: string;\n className?: string;\n}\n\nexport function StatusChip({ label, count, tone = 'default', dotColor, bg, className }: StatusChipProps) {\n return (\n <span\n data-tone={tone}\n className={clsx(\n 'inline-flex items-center gap-1.5 rounded-full px-3 py-1',\n !bg && 'bg-default-secondary',\n className,\n )}\n style={bg ? { backgroundColor: bg } : undefined}\n >\n <StatusDot tone={tone} color={dotColor} />\n <span className=\"text-body-xs font-medium text-default\">{count}</span>\n <span className=\"text-body-xs text-default-secondary\">{label}</span>\n </span>\n );\n}\n","import clsx from 'clsx';\nimport { StatusDot } from './status-dot';\nimport type { StatusDotTone } from './status-dot';\n\nexport interface CountBadgeProps {\n count: number | string;\n label?: string;\n tone?: StatusDotTone;\n className?: string;\n}\n\nexport function CountBadge({ count, label, tone = 'positive', className }: CountBadgeProps) {\n return (\n <span\n data-tone={tone}\n className={clsx(\n 'inline-flex items-center gap-1.5 rounded-full border border-default px-3 py-1 text-body-xs font-medium text-default',\n className,\n )}\n >\n <StatusDot tone={tone} />\n {count}\n {label && <span className=\"text-default-secondary\">{label}</span>}\n </span>\n );\n}\n","import clsx from 'clsx';\n\nimport type { StatusTone } from './status-badge';\n\nconst DOT: Record<StatusTone, string> = {\n neutral: 'bg-status-dot-neutral',\n info: 'bg-status-dot-info',\n warning: 'bg-status-dot-warning',\n caution: 'bg-status-dot-caution',\n accent: 'bg-status-dot-accent',\n violet: 'bg-status-dot-violet',\n positive: 'bg-status-dot-positive',\n danger: 'bg-status-dot-danger',\n};\n\nexport interface TrailChipProps {\n label: string;\n value: string;\n tone?: StatusTone;\n /**\n * Data-driven dot colour, overriding `tone`. The investigations trail mirrors the\n * severity accent of whichever tree node is selected, and those accents come from\n * the row data rather than the status palette — this is the escape hatch Phase 10\n * classifies as \"genuinely data-driven colour\", not a token bypass.\n */\n dotColor?: string;\n className?: string;\n}\n\n/**\n * Dot + small uppercase label + value, used for the drill-down breadcrumb trail on\n * the investigations page.\n *\n * Promoted from `pages/investigations`, where the dot colour was passed as a raw hex.\n */\nexport function TrailChip({ label, value, tone = 'info', dotColor, className }: TrailChipProps) {\n return (\n <div\n data-tone={tone}\n className={clsx(\n 'flex items-center gap-2 rounded-full border border-default bg-default px-3 py-1.5',\n className,\n )}\n >\n <span\n className={clsx('size-1.5 shrink-0 rounded-full', !dotColor && DOT[tone])}\n style={dotColor ? { backgroundColor: dotColor } : undefined}\n />\n <span className=\"text-body-tiny font-semibold uppercase tracking-wide text-default-secondary\">\n {label}\n </span>\n <span className=\"text-body-xs font-medium text-default\">{value}</span>\n </div>\n );\n}\n","import { StatusBadge, type StatusTone } from './status-badge';\n\nexport type UserAccountStatus = 'active' | 'pending' | 'deactivated';\n\nconst STATUS_META: Record<UserAccountStatus, { label: string; tone: StatusTone }> = {\n active: { label: 'Active', tone: 'positive' },\n // `caution` (pale yellow), not `warning` (orange) — Pending is one step below a\n // warning on the severity ramp, and reads as waiting rather than at risk.\n pending: { label: 'Pending', tone: 'caution' },\n deactivated: { label: 'Deactivated', tone: 'danger' },\n};\n\nexport interface UserStatusPillProps {\n status: UserAccountStatus;\n}\n\n/** Account-status pill. A thin wrapper over `StatusBadge`. */\nexport function UserStatusPill({ status }: UserStatusPillProps) {\n const { label, tone } = STATUS_META[status];\n return <StatusBadge label={label} tone={tone} />;\n}\n","import clsx from 'clsx';\nimport { CheckIcon, CircleAlertIcon, LoaderCircleIcon, MinusIcon, XIcon } from 'lucide-react';\n\n/**\n * States of a compliance check.\n *\n * Union of the two previously-divergent local unions:\n * - `features/entity-detail` had passed | in_progress | pending | action_required\n * - `features/reviewer-detail` had passed | in-progress | failed | pending | waived\n *\n * Note `in_progress` (underscore) is canonical — entity-detail's spelling, which is\n * the one backed by the API. reviewer-detail used `in-progress` (hyphen) in mock data.\n */\nexport type CheckIndicatorStatus =\n | 'passed'\n | 'in_progress'\n | 'action_required'\n | 'failed'\n | 'pending'\n | 'waived';\n\n/**\n * `action_required` and `failed` share the Figma colours and differ only in glyph\n * (`!` vs `✕`); `waived` shares `pending`'s colours and adds a dash.\n */\nconst STATUS_STYLES: Record<CheckIndicatorStatus, string> = {\n passed: 'bg-status-check-passed border-status-check-passed text-status-check-passed',\n in_progress: 'bg-status-check-progress border-status-check-progress text-status-check-progress',\n action_required: 'bg-status-check-failed border-status-check-failed text-status-check-failed',\n failed: 'bg-status-check-failed border-status-check-failed text-status-check-failed',\n pending: 'bg-status-check-pending border-status-check-pending text-status-check-pending',\n waived: 'bg-status-check-pending border-status-check-pending text-status-check-pending',\n};\n\n/**\n * Glyphs — every one now comes from `lucide-react`, so the set is stroke-consistent.\n *\n * The two that used to be typographic: `◐` became `LoaderCircleIcon` (lucide has no\n * half-filled circle, but a partial ring reads as in-progress and is a real icon), and\n * `!` became `CircleAlertIcon`. Both are a small visual change from 0.2.0.\n */\nfunction StatusGlyph({ status }: { status: CheckIndicatorStatus }) {\n switch (status) {\n case 'passed':\n return <CheckIcon className=\"size-3\" strokeWidth={3} aria-hidden />;\n case 'failed':\n return <XIcon className=\"size-3\" strokeWidth={3} aria-hidden />;\n case 'waived':\n return <MinusIcon className=\"size-3\" strokeWidth={3} aria-hidden />;\n case 'in_progress':\n return <LoaderCircleIcon className=\"size-3\" strokeWidth={3} aria-hidden />;\n case 'action_required':\n return <CircleAlertIcon className=\"size-3.5\" strokeWidth={2.5} aria-hidden />;\n case 'pending':\n return null;\n }\n}\n\nexport interface CheckIndicatorProps {\n status: CheckIndicatorStatus;\n /** Accessible label. Without one the indicator is decorative, which is correct when an adjacent text label already names the state. */\n label?: string;\n className?: string;\n}\n\n/**\n * The 22px outlined circle used for compliance-check state in entity and reviewer\n * detail. Ring and glyph share one colour; see the check tokens in\n * `src/app/styles/tokens/status.css`.\n */\nexport function CheckIndicator({ status, label, className }: CheckIndicatorProps) {\n return (\n <div\n data-status={status}\n className={clsx(\n 'flex size-[22px] shrink-0 items-center justify-center rounded-full border-[1.5px]',\n STATUS_STYLES[status],\n className,\n )}\n role={label ? 'img' : undefined}\n aria-label={label}\n aria-hidden={label ? undefined : true}\n >\n <StatusGlyph status={status} />\n </div>\n );\n}\n","import clsx from 'clsx';\nimport type { ReactNode } from 'react';\nimport type { BadgeColor } from './badge';\n\n/** `lg` (56px) is new in 0.9.5, for the status glyph above a result screen's heading. */\nexport type EntityIconBadgeSize = 'sm' | 'md' | 'lg';\nexport type EntityIconBadgeTone = 'default' | 'brand' | 'positive' | 'warning' | 'danger' | 'neutral';\nexport type EntityIconBadgeShape = 'square' | 'circle';\n\nexport interface EntityIconBadgeProps {\n size?: EntityIconBadgeSize;\n tone?: EntityIconBadgeTone;\n /**\n * `square` is the rounded-rect used on entity rows. `circle` is the tinted glyph\n * circle used in modal headers. A prop rather than a `className` override, so it\n * does not depend on Tailwind's stylesheet emit order.\n */\n shape?: EntityIconBadgeShape;\n /**\n * A categorical colour from the badge palette, overriding `tone`: for a mark whose colour\n * identifies the thing rather than its status, e.g. a company's initials tile. Pick it from\n * `BADGE_COLORS` by index. New in 0.9.5.\n */\n hue?: BadgeColor;\n /** @deprecated Bypasses the design tokens — pass `tone` instead. Raw hex background, overrides `tone` via inline style. Use when the exact source color doesn't match a design token. */\n bg?: string;\n iconColor?: string;\n children: ReactNode;\n className?: string;\n}\n\nconst sizeStyles: Record<EntityIconBadgeSize, string> = {\n sm: 'size-8',\n md: 'size-10',\n lg: 'size-14',\n};\n\nconst shapeStyles: Record<EntityIconBadgeShape, Record<EntityIconBadgeSize, string>> = {\n square: { sm: 'rounded-lg', md: 'rounded-xl', lg: 'rounded-2xl' },\n circle: { sm: 'rounded-full', md: 'rounded-full', lg: 'rounded-full' },\n};\n\nconst toneStyles: Record<EntityIconBadgeTone, string> = {\n default: 'bg-default-secondary text-icon-default',\n brand: 'bg-brand-tertiary text-icon-brand',\n positive:'bg-positive-tertiary text-icon-positive',\n warning: 'bg-warning-tertiary text-icon-warning',\n danger: 'bg-danger-tertiary text-icon-danger',\n neutral: 'bg-neutral-tertiary text-icon-neutral',\n};\n\nconst hueStyles: Record<BadgeColor, string> = {\n gray: 'bg-badge-gray text-badge-gray',\n red: 'bg-badge-red text-badge-red',\n yellow: 'bg-badge-yellow text-badge-yellow',\n lime: 'bg-badge-lime text-badge-lime',\n green: 'bg-badge-green text-badge-green',\n teal: 'bg-badge-teal text-badge-teal',\n blue: 'bg-badge-blue text-badge-blue',\n pink: 'bg-badge-pink text-badge-pink',\n slate: 'bg-badge-slate text-badge-slate',\n violet: 'bg-badge-violet text-badge-violet',\n};\n\nexport function EntityIconBadge({ size = 'sm', tone = 'default', shape = 'square', hue, bg, iconColor, children, className }: EntityIconBadgeProps) {\n return (\n <span\n data-tone={hue ? undefined : tone}\n data-hue={hue}\n className={clsx(\n 'inline-flex shrink-0 items-center justify-center',\n sizeStyles[size],\n shapeStyles[shape][size],\n !bg && !iconColor && (hue ? hueStyles[hue] : toneStyles[tone]),\n className,\n )}\n style={{\n ...(bg ? { backgroundColor: bg } : undefined),\n ...(iconColor ? { color: iconColor } : undefined),\n }}\n >\n {children}\n </span>\n );\n}\n","import {\n createContext,\n forwardRef,\n useContext,\n useId,\n type HTMLAttributes,\n type ReactNode,\n} from 'react';\nimport clsx from 'clsx';\nimport { cn } from '../../lib/cn';\nimport { useControllableState } from '../../lib/use-controllable-state';\nimport { choiceCardParts, type ChoiceCardSize, type ResponsiveChoiceCardSize } from './choice-card-size';\n\n/** `MultiSelectCard`'s sizes, so the single- and multi-select cards line up. `lg` from 0.9.0. */\nexport type RadioCardsSize = ChoiceCardSize;\n\ninterface RadioCardsContextValue {\n name: string;\n value: string | undefined;\n setValue: (value: string) => void;\n size: ResponsiveChoiceCardSize;\n disabled: boolean;\n required: boolean;\n}\n\nconst RadioCardsContext = createContext<RadioCardsContextValue | null>(null);\n\nexport interface RadioCardsProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {\n /** The parts: `RadioCardsItem`s. Omit when passing `options`. */\n children?: ReactNode;\n /**\n * The cards as data, each rendered as a `RadioCardsItem` (so `title`, not `label`). New in\n * 0.8.0. Use it or `children`, not both.\n */\n options?: readonly RadioCardsItemProps[];\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n /** Shared `name` for the underlying radios, which also submit with a form. Generated when omitted. */\n name?: string;\n /** Names the group. Prefer a visible `FieldLegend` in a `FieldSet` when there is one. */\n label?: string;\n /** One size, or responsive from 0.9.0: `{ initial: 'sm', md: 'lg' }`. */\n size?: ResponsiveChoiceCardSize;\n disabled?: boolean;\n required?: boolean;\n}\n\n/**\n * Choose one of a few options shown as cards: a plan, a workspace type, an import source. The\n * single-select sibling of `MultiSelectCard`, new in 0.7.0 (Radix Themes' `Radio Cards`).\n *\n * Each card is a `<label>` around a real `<input type=\"radio\">`, for the same reason\n * `RadioGroup` uses native radios: arrows move *and* select, only the checked card is a tab\n * stop, and the group announces \"2 of 3\", with nothing reimplemented. The card's selected look\n * is styled from the input's own `:checked` state (`peer-checked:`), so the visual and the\n * semantics cannot disagree.\n *\n * The grid is the caller's: pass layout classes, e.g. `className=\"sm:grid-cols-3\"`.\n */\nexport const RadioCards = forwardRef<HTMLDivElement, RadioCardsProps>(function RadioCards(\n {\n children,\n options,\n value: valueProp,\n defaultValue,\n onValueChange,\n name,\n label,\n size = 'default',\n disabled = false,\n required = false,\n className,\n ...rest\n },\n ref,\n) {\n const generatedName = useId();\n const [value, setValue] = useControllableState<string | undefined>({\n value: valueProp,\n defaultValue,\n onChange: onValueChange as ((next: string | undefined) => void) | undefined,\n });\n\n return (\n <RadioCardsContext.Provider\n value={{ name: name ?? generatedName, value, setValue, size, disabled, required }}\n >\n <div\n ref={ref}\n role=\"radiogroup\"\n aria-label={label}\n aria-required={required || undefined}\n data-slot=\"radio-cards\"\n className={cn('grid gap-3', className)}\n {...rest}\n >\n {options ? options.map((option) => <RadioCardsItem key={option.value} {...option} />) : children}\n </div>\n </RadioCardsContext.Provider>\n );\n});\n\nexport interface RadioCardsItemProps {\n value: string;\n title: ReactNode;\n description?: ReactNode;\n /** Leading glyph in a tinted box, as on `MultiSelectCard`. */\n icon?: ReactNode;\n disabled?: boolean;\n className?: string;\n}\n\nexport const RadioCardsItem = forwardRef<HTMLInputElement, RadioCardsItemProps>(function RadioCardsItem(\n { value, title, description, icon, disabled: itemDisabled = false, className },\n ref,\n) {\n const group = useContext(RadioCardsContext);\n if (!group) throw new Error('<RadioCardsItem> must be used inside <RadioCards>');\n const s = choiceCardParts(group.size);\n const disabled = group.disabled || itemDisabled;\n const titleId = useId();\n const descriptionId = useId();\n\n return (\n <label\n data-slot=\"radio-cards-item\"\n className={cn(\n 'relative block cursor-pointer rounded-2xl border-2 border-default bg-default text-left transition-all',\n 'hover:border-default-secondary',\n // Selected and focus states come from the radio itself.\n 'has-[:checked]:border-brand has-[:checked]:bg-brand-tertiary',\n 'has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-brand has-[:focus-visible]:ring-offset-1 has-[:focus-visible]:ring-offset-default',\n 'has-[:disabled]:cursor-not-allowed has-[:disabled]:opacity-60',\n s.pad,\n className,\n )}\n >\n <input\n ref={ref}\n type=\"radio\"\n name={group.name}\n value={value}\n checked={group.value === value}\n onChange={() => group.setValue(value)}\n disabled={disabled}\n required={group.required}\n // Named by the title alone. The wrapping <label> would otherwise fold the description\n // into the name (\"Team Up to 20 seats\"); it is wired as a description instead.\n aria-labelledby={titleId}\n aria-describedby={description ? descriptionId : undefined}\n className=\"sr-only\"\n />\n <div className=\"flex items-start justify-between gap-2\">\n {icon ? (\n <span\n aria-hidden\n className={clsx(\n 'flex shrink-0 items-center justify-center bg-brand-tertiary',\n '[label:has(:checked)_&]:bg-brand',\n s.iconBox,\n )}\n >\n <span className={clsx(s.icon, 'text-icon-brand [label:has(:checked)_&]:text-icon-brand-on-brand')}>\n {icon}\n </span>\n </span>\n ) : (\n <span />\n )}\n {/* The radio mark: a ring that fills with a dot when chosen. */}\n <span\n aria-hidden\n className={clsx(\n 'flex shrink-0 items-center justify-center rounded-full border-2 border-default',\n '[label:has(:checked)_&]:border-brand',\n s.mark,\n )}\n >\n <span className=\"size-2 scale-0 rounded-full bg-brand transition-transform motion-reduce:transition-none [label:has(:checked)_&]:scale-100\" />\n </span>\n </div>\n <div className={s.gap}>\n <span id={titleId} className={clsx('block font-semibold text-default [label:has(:checked)_&]:text-brand', s.title)}>\n {title}\n </span>\n {description && (\n <span id={descriptionId} className={clsx('mt-0.5 block text-default-secondary', s.description)}>\n {description}\n </span>\n )}\n </div>\n </label>\n );\n});\n","import { createContext, forwardRef, useContext, useId, type ReactNode } from 'react';\nimport { cn } from '../../lib/cn';\nimport { useControllableState } from '../../lib/use-controllable-state';\nimport { Checkbox, type CheckboxSize } from './checkbox';\nimport { FieldLegend, FieldSet } from './field';\n\ninterface CheckboxGroupContextValue {\n name: string;\n value: string[];\n toggle: (value: string, checked: boolean) => void;\n size: CheckboxSize;\n disabled: boolean;\n /** Whether a required group is still empty, so every item carries `required`. */\n required: boolean;\n}\n\nconst CheckboxGroupContext = createContext<CheckboxGroupContextValue | null>(null);\n\nexport interface CheckboxGroupProps {\n /** The parts: `CheckboxGroupItem`s. Omit when passing `options`. */\n children?: ReactNode;\n /**\n * The checkboxes as data, each rendered as a `CheckboxGroupItem`. New in 0.8.0. Use it or\n * `children`, not both.\n */\n options?: readonly CheckboxGroupItemProps[];\n /** The group's visible name, rendered as the fieldset's `<legend>`. */\n legend: ReactNode;\n /** Checked values. Controlled; omit and pass `defaultValue` for uncontrolled. */\n value?: string[];\n defaultValue?: string[];\n onValueChange?: (value: string[]) => void;\n /** Shared `name`, so every checked value posts with a form. Generated when omitted. */\n name?: string;\n size?: CheckboxSize;\n orientation?: 'vertical' | 'horizontal';\n disabled?: boolean;\n /**\n * At least one option must be checked. While none is, every checkbox carries the native\n * `required`, so the form will not submit and the browser points at the first one. Checking\n * any of them lifts it from all. The legend gets\n * the same marker as a required field label.\n */\n required?: boolean;\n className?: string;\n}\n\n/**\n * A named set of checkboxes sharing one value array, new in 0.7.0 (Radix Themes'\n * `Checkbox Group`).\n *\n * A real `<fieldset>` and `<legend>`, which is the only markup that announces the group's name\n * before each option. Each item is the library's native `Checkbox`, so keyboard, form and\n * validation behaviour are the browser's.\n */\nexport const CheckboxGroup = forwardRef<HTMLFieldSetElement, CheckboxGroupProps>(function CheckboxGroup(\n {\n children,\n options,\n legend,\n value: valueProp,\n defaultValue = [],\n onValueChange,\n name,\n size = 'md',\n orientation = 'vertical',\n disabled = false,\n required = false,\n className,\n },\n ref,\n) {\n const generatedName = useId();\n const [value, setValue] = useControllableState<string[]>({\n value: valueProp,\n defaultValue,\n onChange: onValueChange,\n });\n\n const toggle = (item: string, checked: boolean) =>\n setValue(checked ? [...value.filter((v) => v !== item), item] : value.filter((v) => v !== item));\n\n const context = {\n name: name ?? generatedName,\n value,\n toggle,\n size,\n disabled,\n required: required && value.length === 0,\n };\n\n return (\n <CheckboxGroupContext.Provider value={context}>\n <FieldSet ref={ref} data-slot=\"checkbox-group\" data-required={required || undefined} className={className}>\n <FieldLegend\n variant=\"label\"\n className={required ? \"after:ml-0.5 after:text-danger after:content-['*']\" : undefined}\n >\n {legend}\n </FieldLegend>\n <div className={cn('flex', orientation === 'vertical' ? 'flex-col gap-2.5' : 'flex-row flex-wrap gap-4')}>\n {options\n ? options.map((option) => <CheckboxGroupItem key={option.value} {...option} />)\n : children}\n </div>\n </FieldSet>\n </CheckboxGroupContext.Provider>\n );\n});\n\nexport interface CheckboxGroupItemProps {\n value: string;\n label: ReactNode;\n description?: ReactNode;\n disabled?: boolean;\n}\n\nexport const CheckboxGroupItem = forwardRef<HTMLInputElement, CheckboxGroupItemProps>(\n function CheckboxGroupItem({ value, label, description, disabled }, ref) {\n const group = useContext(CheckboxGroupContext);\n if (!group) throw new Error('<CheckboxGroupItem> must be used inside <CheckboxGroup>');\n return (\n <Checkbox\n ref={ref}\n name={group.name}\n value={value}\n label={label}\n description={description}\n size={group.size}\n disabled={group.disabled || disabled}\n required={group.required}\n checked={group.value.includes(value)}\n onCheckedChange={(checked) => group.toggle(value, checked)}\n />\n );\n },\n);\n","import { forwardRef, useId, type InputHTMLAttributes, type ReactNode } from 'react';\nimport clsx from 'clsx';\n\nexport interface SliderProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'size' | 'onChange' | 'value'> {\n value?: number;\n defaultValue?: number;\n onValueChange?: (value: number) => void;\n min?: number;\n max?: number;\n step?: number;\n /** Matches Figma's `Label` / `Has Label`. */\n label?: ReactNode;\n /** Matches Figma's `Description` / `Has Description`. */\n description?: ReactNode;\n /** Show the current value at the right of the label row. */\n showValue?: boolean;\n /** Formats the displayed and announced value — percentages, currency, durations. */\n formatValue?: (value: number) => string;\n className?: string;\n}\n\n/**\n * Range slider. Matches Figma's `Slider Field` (`State: Default | Disabled`, with label and\n * description slots).\n *\n * A native `<input type=\"range\">`, deliberately. It arrives with the entire APG slider\n * contract already implemented — arrow keys, Page Up/Down, Home/End, the correct\n * `aria-valuenow`/`valuemin`/`valuemax`, touch and pointer dragging, and RTL handling — and\n * a `div`-based slider has to rebuild all of it. The track and thumb are styled through the\n * vendor pseudo-elements instead, which is the one place raw `[&::-webkit-…]` selectors are\n * the right tool.\n *\n * `formatValue` feeds `aria-valuetext`, because \"70\" announced on a price slider is\n * meaningless where \"£70\" is not.\n */\nexport const Slider = forwardRef<HTMLInputElement, SliderProps>(function Slider(\n {\n value,\n defaultValue,\n onValueChange,\n min = 0,\n max = 100,\n step = 1,\n label,\n description,\n showValue = false,\n formatValue,\n disabled = false,\n id,\n className,\n ...props\n },\n ref,\n) {\n const generatedId = useId();\n const controlId = id ?? generatedId;\n const descriptionId = `${controlId}-description`;\n\n const current = value ?? defaultValue ?? min;\n const display = formatValue ? formatValue(current) : String(current);\n\n return (\n <div className={clsx('flex w-full flex-col gap-1.5', className)}>\n {(label || showValue) && (\n <div className=\"flex items-baseline justify-between gap-2\">\n {label && (\n <label\n htmlFor={controlId}\n className={clsx('text-body-sm', disabled ? 'text-disabled' : 'text-default')}\n >\n {label}\n </label>\n )}\n {showValue && (\n <span className=\"text-body-sm font-medium tabular-nums text-default\">{display}</span>\n )}\n </div>\n )}\n {description && (\n <p\n id={descriptionId}\n className={clsx('text-body-xs', disabled ? 'text-disabled' : 'text-default-secondary')}\n >\n {description}\n </p>\n )}\n <input\n ref={ref}\n id={controlId}\n type=\"range\"\n min={min}\n max={max}\n step={step}\n value={value}\n defaultValue={value === undefined ? defaultValue : undefined}\n disabled={disabled}\n aria-describedby={description ? descriptionId : undefined}\n // Only when a formatter is supplied — an aria-valuetext that merely repeats\n // aria-valuenow is noise.\n aria-valuetext={formatValue ? display : undefined}\n onChange={(event) => onValueChange?.(Number(event.target.value))}\n className={clsx(\n 'h-5 w-full cursor-pointer appearance-none bg-transparent',\n 'focus-visible:outline-none',\n disabled && 'cursor-not-allowed opacity-50',\n // Track\n '[&::-webkit-slider-runnable-track]:h-1.5 [&::-webkit-slider-runnable-track]:rounded-full [&::-webkit-slider-runnable-track]:bg-default-tertiary',\n '[&::-moz-range-track]:h-1.5 [&::-moz-range-track]:rounded-full [&::-moz-range-track]:bg-default-tertiary',\n '[&::-moz-range-progress]:h-1.5 [&::-moz-range-progress]:rounded-full [&::-moz-range-progress]:bg-brand',\n // Thumb. The negative margin centres it on the track, since the input box is\n // taller than the track to keep a comfortable pointer target.\n '[&::-webkit-slider-thumb]:-mt-[7px] [&::-webkit-slider-thumb]:size-4 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-brand [&::-webkit-slider-thumb]:bg-default [&::-webkit-slider-thumb]:shadow-100',\n '[&::-moz-range-thumb]:size-4 [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:border-2 [&::-moz-range-thumb]:border-brand [&::-moz-range-thumb]:bg-default',\n // Focus ring on the thumb, not the whole 100%-wide input — a ring around the\n // full track reads as the row being focused rather than the handle.\n 'focus-visible:[&::-webkit-slider-thumb]:ring-2 focus-visible:[&::-webkit-slider-thumb]:ring-brand focus-visible:[&::-webkit-slider-thumb]:ring-offset-1',\n 'focus-visible:[&::-moz-range-thumb]:ring-2 focus-visible:[&::-moz-range-thumb]:ring-brand',\n )}\n {...props}\n />\n </div>\n );\n});\n","import { forwardRef, type LabelHTMLAttributes, type ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { useFieldContext } from './field';\nimport type { InputSize } from './input';\n\nexport interface LabelProps extends LabelHTMLAttributes<HTMLLabelElement> {\n children: ReactNode;\n size?: InputSize;\n}\n\nconst SIZE: Record<InputSize, string> = {\n lg: 'text-body',\n md: 'text-body-sm',\n sm: 'text-body-tiny',\n};\n\n/**\n * A standalone `<label>`.\n *\n * `FieldLabel` is the one to reach for inside a `Field` — it picks up the generated id,\n * the size and the disabled state from context automatically. This is for the cases that\n * are not a field: naming a `SegmentedControl`, a group of buttons, or any control the\n * library does not wrap. It still reads `Field` context when it happens to be inside one,\n * so it degrades to `FieldLabel` behaviour rather than silently losing the association.\n */\nexport const Label = forwardRef<HTMLLabelElement, LabelProps>(function Label(\n { children, size, className, htmlFor, ...rest },\n ref,\n) {\n const field = useFieldContext();\n const resolvedSize = size ?? field?.size ?? 'md';\n\n return (\n <label\n ref={ref}\n htmlFor={htmlFor ?? field?.controlId}\n data-slot=\"label\"\n className={clsx(\n 'select-none',\n SIZE[resolvedSize],\n field?.disabled ? 'text-disabled' : 'text-default',\n className,\n )}\n {...rest}\n >\n {children}\n </label>\n );\n});\n","import {\n createContext,\n forwardRef,\n useContext,\n useEffect,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from 'react';\nimport { Dialog as DialogPrimitive } from 'radix-ui';\nimport { CircleCheckBigIcon, InfoIcon, OctagonAlertIcon, TriangleAlertIcon, XIcon } from 'lucide-react';\nimport { cn } from '../../lib/cn';\nimport { SCROLLBAR_CLASSES } from '../../lib/scrollbar';\nimport { EntityIconBadge, type EntityIconBadgeTone } from '../status/entity-icon-badge';\nimport { IconButton } from '../forms/icon-button';\nimport { OVERLAY_SCRIM } from './overlay';\nimport { deferEscapeToInnerPopup } from './overlay-stack';\nimport { PortalContainerProvider } from './portal';\nimport { isInsideToaster } from './toaster-guard';\nimport { composeRefs } from '../../lib/slot';\n\nexport type ModalSize = 'sm' | 'md' | 'lg' | 'xl';\n/**\n * Note `positive`, not `success` — every other tone union in the library\n * (`InlineAlertTone`, `TagPillTone`, `EntityIconBadgeTone`) and the token layer say\n * `positive`, and one vocabulary beats a familiar synonym.\n */\nexport type ModalTone = 'default' | 'info' | 'positive' | 'warning' | 'danger';\nexport type ModalFooterAlign = 'start' | 'between' | 'end';\n/** Where the panel sits above `sm`. Below it the modal is always a bottom sheet. */\nexport type ModalAlign = 'center' | 'top';\n\n/**\n * The `sm:` prefix is mandatory, not cosmetic. In 0.2.0 `max-w-[540px]` was applied\n * unprefixed, so between 540px and the `sm` breakpoint (640px) the \"bottom sheet\" was\n * a 540px card floating in the middle of the viewport.\n */\nconst OVERLAY_ALIGN: Record<ModalAlign, string> = {\n center: 'sm:items-center',\n // A fixed offset rather than centring, so a change in content height grows the panel\n // downward instead of moving its top edge. 6dvh + the 88dvh cap leaves a gap below.\n top: 'sm:items-start sm:pt-[6dvh]',\n};\n\nconst SIZE: Record<ModalSize, string> = {\n sm: 'sm:max-w-[420px]',\n md: 'sm:max-w-[540px]',\n lg: 'sm:max-w-[640px]',\n xl: 'sm:max-w-[800px]',\n};\n\n/**\n * `info` / `positive` / `warning` reuse `InlineAlert`'s glyphs, so one semantic has one\n * mark across the system. `danger` deliberately differs from `warning`: a dialog that\n * is about to destroy something should not be glyph-identical to one merely cautioning.\n */\nconst TONE_ICON: Record<Exclude<ModalTone, 'default'>, ReactNode> = {\n info: <InfoIcon aria-hidden className=\"size-5\" />,\n positive: <CircleCheckBigIcon aria-hidden className=\"size-5\" />,\n warning: <TriangleAlertIcon aria-hidden className=\"size-5\" />,\n danger: <OctagonAlertIcon aria-hidden className=\"size-5\" />,\n};\n\n/** Reuses EntityIconBadge's tone map — one token map for tinted icon circles. */\nconst TONE_BADGE: Record<Exclude<ModalTone, 'default'>, EntityIconBadgeTone> = {\n info: 'brand',\n positive: 'positive',\n warning: 'warning',\n danger: 'danger',\n};\n\nconst FOOTER_ALIGN: Record<ModalFooterAlign, string> = {\n start: 'justify-start',\n between: 'justify-between',\n end: 'justify-end',\n};\n\n// ── Naming context ─────────────────────────────────────────────────────────────\n\n/**\n * Tells the panel which naming parts are actually rendered.\n *\n * Radix wires `aria-labelledby` / `aria-describedby` to its own Title and Description ids,\n * so the name still comes from the visible heading by reference (0.3.0 duplicated it into\n * `aria-label`, and the copy drifted). Two cases still need to know what is present:\n * - **No `ModalTitle`.** The `label` prop is rendered as a visually hidden Title, so the\n * dialog stays named without a heading anyone can see.\n * - **No `ModalDescription`.** Radix would otherwise point `aria-describedby` at an id\n * that is not in the document.\n *\n * Outside a Modal the parts render as plain elements, so a static layout (a docs preview,\n * a design-sync card) can still use them.\n */\ninterface ModalNamingContext {\n registerTitle: (present: boolean) => void;\n registerDescription: (present: boolean) => void;\n}\n\nconst ModalNaming = createContext<ModalNamingContext | null>(null);\n\n// ── Modal ──────────────────────────────────────────────────────────────────────\n\nexport interface ModalProps {\n /** Controlled open state. Omit it, with `ModalTrigger`, for an uncontrolled dialog. */\n open?: boolean;\n /** Initial state when uncontrolled. */\n defaultOpen?: boolean;\n /** Fired with `false` on Escape, an outside press, or the close button. */\n onOpenChange?: (open: boolean) => void;\n /**\n * Accessible name. Only needed when the dialog renders no `ModalTitle` — with one, the\n * name comes from the heading itself via `aria-labelledby`, so it cannot drift.\n */\n label?: string;\n children: ReactNode;\n size?: ModalSize;\n /**\n * `alertdialog` for a dialog that interrupts to confirm or warn — it makes assistive\n * tech announce the body immediately rather than waiting to be browsed. `ConfirmDialog`\n * passes it; plain content dialogs should stay `dialog`.\n */\n role?: 'dialog' | 'alertdialog';\n /** Renders the top-right close button. */\n showClose?: boolean;\n /**\n * Vertical position above `sm`. `center` (the default) suits short, fixed content such as a\n * confirmation. `top` pins the panel near the top of the viewport so it grows downward and\n * does not jump when its height changes: use it for dialogs whose content changes while open\n * (tabs, steps, a builder, results that load). New in 0.8.2.\n */\n align?: ModalAlign;\n /** Applied to the panel. With `cn`, `className=\"sm:max-w-[560px]\"` beats `size`. */\n className?: string;\n /** Call `preventDefault()` to keep the dialog open — e.g. unsaved input. */\n onEscapeKeyDown?: (event: KeyboardEvent) => void;\n /** Call `preventDefault()` to keep the dialog open. */\n onInteractOutside?: (event: PointerEvent) => void;\n /** Focus this on open instead of the first tabbable element. */\n initialFocus?: React.RefObject<HTMLElement | null>;\n /**\n * Where to portal the dialog. Defaults to `document.body`. Pass the element the design\n * tokens are declared on when the app renders inside a shadow root or a scoped theme.\n */\n container?: HTMLElement | null;\n}\n\n/**\n * A centred dialog above `sm`, a bottom sheet below it.\n *\n * Composed from `ModalHeader` / `ModalBody` / `ModalFooter`, mirroring the `Card`\n * parts — so a modal can take any layout a card can, including headerless. Tone lives\n * on `ModalHeader` (the part that draws the glyph); `ConfirmDialog` and\n * `NoteConfirmModal` accept `tone` at their top level and forward it.\n *\n * Built on Radix Dialog from 0.7.0. Radix supplies the focus trap, focus return, Escape and\n * outside-press handling scoped to the topmost layer, scroll lock, and hiding the page behind\n * the dialog from assistive tech. The 0.6 overlay stack got the last of those wrong when\n * modals were stacked. Toasts stay reachable: their region is `aria-live`, which Radix leaves\n * exposed, and pressing one is not treated as an outside press.\n */\nexport const Modal = forwardRef<HTMLDivElement, ModalProps>(function Modal(\n { open, defaultOpen, onOpenChange, container, ...shell },\n ref,\n) {\n return (\n <DialogPrimitive.Root open={open} defaultOpen={defaultOpen} onOpenChange={onOpenChange}>\n {/* The trigger, when there is one, is a direct child of the Root and outside the\n portal, so it renders in place. */}\n {extractTrigger(shell.children)}\n <DialogPrimitive.Portal container={container ?? undefined}>\n <ModalShell ref={ref} {...shell} />\n </DialogPrimitive.Portal>\n </DialogPrimitive.Root>\n );\n});\n\nconst ModalShell = forwardRef<HTMLDivElement, Omit<ModalProps, 'open' | 'defaultOpen' | 'onOpenChange' | 'container'>>(\n function ModalShell(\n {\n label,\n children,\n size = 'md',\n role = 'dialog',\n showClose = true,\n align = 'center',\n className,\n onEscapeKeyDown,\n onInteractOutside,\n initialFocus,\n },\n ref,\n ) {\n const [hasTitle, setHasTitle] = useState(false);\n const [hasDescription, setHasDescription] = useState(false);\n // Floating panels that are not Radix parts portal in here (see PortalContainerProvider).\n const [contentNode, setContentNode] = useState<HTMLDivElement | null>(null);\n // Read during the first render, before Radix moves focus into the panel.\n const [returnFocusTo] = useState(() =>\n typeof document === 'undefined' ? null : (document.activeElement as HTMLElement | null),\n );\n\n return (\n <DialogPrimitive.Overlay\n data-align={align}\n className={cn(\n // The overlay wraps the content (a Radix-supported layout), so it also does the\n // positioning: bottom sheet below `sm`, a card centred or top-anchored above it.\n // `max-sm:items-end`, not a base `items-end` that `sm:` overrides: an app that layers this\n // stylesheet under its own utilities (Cleo) and uses `items-end` itself would otherwise win\n // at every width, and every dialog sat at the bottom on desktop. Fixed in 0.10.3.\n 'fixed inset-0 z-modal flex justify-center max-sm:items-end',\n OVERLAY_ALIGN[align],\n OVERLAY_SCRIM,\n )}\n >\n <DialogPrimitive.Content\n ref={composeRefs(ref, setContentNode)}\n role={role}\n // Only point at a description that exists. Passing `undefined` explicitly also\n // tells Radix the omission is deliberate.\n {...(hasDescription ? {} : { 'aria-describedby': undefined })}\n onOpenAutoFocus={(event) => {\n const target = initialFocus?.current;\n if (target) {\n event.preventDefault();\n target.focus();\n }\n }}\n onCloseAutoFocus={(event) => {\n // Radix's modal Dialog returns focus only to its own `Dialog.Trigger`. Most of\n // our modals are controlled and opened by an ordinary button, which Radix never\n // sees, so on close focus would drop to <body>. Return it to whatever held it on\n // open; that is the trigger whenever there is one.\n if (returnFocusTo?.isConnected && returnFocusTo !== document.body) {\n event.preventDefault();\n returnFocusTo.focus();\n }\n }}\n onEscapeKeyDown={(event) => {\n if (!deferEscapeToInnerPopup(event)) onEscapeKeyDown?.(event);\n }}\n onPointerDownOutside={(event) => {\n // A toast is not \"outside the dialog\" in any sense a user means. Pressing its\n // close button must not dismiss the modal underneath it.\n if (isInsideToaster(event.target)) {\n event.preventDefault();\n return;\n }\n const original = event.detail.originalEvent;\n onInteractOutside?.(original);\n if (original.defaultPrevented) event.preventDefault();\n }}\n className={cn(\n 'relative max-h-[92dvh] w-full overflow-y-auto bg-default shadow-400 focus:outline-none',\n align === 'top' && 'sm:max-h-[88dvh]',\n // Not a `ScrollArea`: the panel is the dialog, so the scroll container has to stay\n // the element carrying `role`, `aria-modal` and the trap boundary. It is already\n // keyboard-scrollable because the trap focuses it on open.\n SCROLLBAR_CLASSES,\n 'rounded-t-2xl pb-[env(safe-area-inset-bottom)] sm:mx-4 sm:rounded-2xl sm:pb-0',\n SIZE[size],\n className,\n )}\n >\n {!hasTitle && label && (\n <DialogPrimitive.Title className=\"sr-only\">{label}</DialogPrimitive.Title>\n )}\n {showClose && (\n <DialogPrimitive.Close asChild>\n <IconButton\n variant=\"subtle\"\n size=\"sm\"\n aria-label=\"Close dialog\"\n // Floating rather than inside the header, so a headerless modal is still\n // dismissible. right-6/top-5 reproduces 0.2.0's position exactly.\n className=\"absolute right-6 top-5 z-raised\"\n >\n <XIcon size={16} aria-hidden />\n </IconButton>\n </DialogPrimitive.Close>\n )}\n <ModalNaming.Provider\n value={{ registerTitle: setHasTitle, registerDescription: setHasDescription }}\n >\n <PortalContainerProvider container={contentNode}>\n {withoutTrigger(children)}\n </PortalContainerProvider>\n </ModalNaming.Provider>\n </DialogPrimitive.Content>\n </DialogPrimitive.Overlay>\n );\n },\n);\n\n// ── ModalTrigger / ModalClose ──────────────────────────────────────────────────\n\nexport interface ModalTriggerProps extends HTMLAttributes<HTMLButtonElement> {\n /** Render onto the single child (e.g. a `Button`) instead of a bare `<button>`. */\n asChild?: boolean;\n}\n\n/**\n * Opens an uncontrolled `Modal`. Place it as a direct child of `Modal`; it renders in place,\n * not in the dialog. New in 0.7.0. Controlled modals (`open` + `onOpenChange`) do not need it.\n */\nexport const ModalTrigger = forwardRef<HTMLButtonElement, ModalTriggerProps>(\n function ModalTrigger(props, ref) {\n return <DialogPrimitive.Trigger ref={ref} {...props} />;\n },\n);\n// Marks the part so `Modal` can lift it out of the portalled content.\n(ModalTrigger as unknown as { __modalTrigger: true }).__modalTrigger = true;\n\nexport interface ModalCloseProps extends HTMLAttributes<HTMLButtonElement> {\n asChild?: boolean;\n}\n\n/** Closes the enclosing `Modal`, e.g. a footer \"Cancel\" button. New in 0.7.0. */\nexport const ModalClose = forwardRef<HTMLButtonElement, ModalCloseProps>(\n function ModalClose(props, ref) {\n return <DialogPrimitive.Close ref={ref} {...props} />;\n },\n);\n\nfunction isTrigger(node: ReactNode): boolean {\n return (\n typeof node === 'object' &&\n node !== null &&\n 'type' in node &&\n (node.type as { __modalTrigger?: boolean })?.__modalTrigger === true\n );\n}\n\nfunction extractTrigger(children: ReactNode): ReactNode {\n return Array.isArray(children) ? children.filter(isTrigger) : isTrigger(children) ? children : null;\n}\n\nfunction withoutTrigger(children: ReactNode): ReactNode {\n return Array.isArray(children)\n ? children.filter((child) => !isTrigger(child))\n : isTrigger(children)\n ? null\n : children;\n}\n\n// ── ModalHeader ────────────────────────────────────────────────────────────────\n\nexport interface ModalHeaderProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n /** Adds a tinted glyph circle. `default` renders none. */\n tone?: ModalTone;\n divider?: boolean;\n}\n\nexport const ModalHeader = forwardRef<HTMLDivElement, ModalHeaderProps>(function ModalHeader(\n { children, tone = 'default', divider = true, className, ...rest },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-tone={tone}\n className={cn(\n // pr-14 reserves the floating close button's column (24px gutter + 24px\n // button + gap), which the old flex-between header used to hold open.\n 'flex items-start gap-3 px-6 py-5 pr-14',\n divider && 'border-b border-default',\n className,\n )}\n {...rest}\n >\n {tone !== 'default' && (\n <EntityIconBadge size=\"md\" shape=\"circle\" tone={TONE_BADGE[tone]}>\n {TONE_ICON[tone]}\n </EntityIconBadge>\n )}\n <div className=\"min-w-0 flex-1\">{children}</div>\n </div>\n );\n});\n\n// ── ModalTitle / ModalDescription / ModalBody / ModalFooter ────────────────────\n\nexport interface ModalTitleProps extends HTMLAttributes<HTMLHeadingElement> {\n children: ReactNode;\n}\n\nexport const ModalTitle = forwardRef<HTMLHeadingElement, ModalTitleProps>(function ModalTitle(\n { children, className, ...rest },\n ref,\n) {\n const naming = useContext(ModalNaming);\n\n useEffect(() => {\n naming?.registerTitle(true);\n return () => naming?.registerTitle(false);\n }, [naming]);\n\n const classes = cn('text-heading-sm font-semibold text-default', className);\n\n if (!naming) {\n return (\n <h2 ref={ref} className={classes} {...rest}>\n {children}\n </h2>\n );\n }\n\n return (\n <DialogPrimitive.Title ref={ref} className={classes} {...rest}>\n {children}\n </DialogPrimitive.Title>\n );\n});\n\nexport interface ModalDescriptionProps extends HTMLAttributes<HTMLParagraphElement> {\n children: ReactNode;\n}\n\nexport const ModalDescription = forwardRef<HTMLParagraphElement, ModalDescriptionProps>(\n function ModalDescription({ children, className, ...rest }, ref) {\n const naming = useContext(ModalNaming);\n\n useEffect(() => {\n naming?.registerDescription(true);\n return () => naming?.registerDescription(false);\n }, [naming]);\n\n const classes = cn('mt-0.5 text-body-xs text-default-secondary', className);\n\n if (!naming) {\n return (\n <p ref={ref} className={classes} {...rest}>\n {children}\n </p>\n );\n }\n\n return (\n <DialogPrimitive.Description ref={ref} className={classes} {...rest}>\n {children}\n </DialogPrimitive.Description>\n );\n },\n);\n\nexport interface ModalBodyProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n}\n\n/** Must not carry its own `overflow` — the panel is the scroll container. */\nexport const ModalBody = forwardRef<HTMLDivElement, ModalBodyProps>(function ModalBody(\n { children, className, ...rest },\n ref,\n) {\n return (\n <div ref={ref} className={cn('px-6 py-5', className)} {...rest}>\n {children}\n </div>\n );\n});\n\nexport interface ModalFooterProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n align?: ModalFooterAlign;\n divider?: boolean;\n}\n\nexport const ModalFooter = forwardRef<HTMLDivElement, ModalFooterProps>(function ModalFooter(\n { children, align = 'end', divider = true, className, ...rest },\n ref,\n) {\n return (\n <div\n ref={ref}\n className={cn(\n 'flex items-center gap-2 px-6 py-4',\n FOOTER_ALIGN[align],\n divider && 'border-t border-default',\n className,\n )}\n {...rest}\n >\n {children}\n </div>\n );\n});\n","/**\n * Marks the `Toaster` region so modal overlays can tell a press on a toast apart from a\n * press outside the dialog.\n *\n * A toast fired from inside a Modal (e.g. \"Saved\") renders in the toast region, which is a\n * sibling of the dialog in `document.body`. Radix dismisses a modal on any pointer-down outside\n * its content, so without this check, pressing the toast's close button would also close the\n * dialog the user was still working in.\n */\nexport const TOASTER_ATTRIBUTE = 'data-platned-toaster';\n\nexport function isInsideToaster(target: EventTarget | null): boolean {\n return target instanceof Element && target.closest(`[${TOASTER_ATTRIBUTE}]`) !== null;\n}\n","import { useId, type ReactElement, type ReactNode } from 'react';\nimport { Tooltip as TooltipPrimitive } from 'radix-ui';\nimport { cn } from '../../lib/cn';\nimport type { FloatingAlign, FloatingSide } from './floating';\nimport { usePortalContainer } from './portal';\n\nexport interface TooltipProps {\n /**\n * The trigger. Must be a single focusable element — a tooltip that can only be reached\n * with a pointer is invisible to keyboard and touch users, so this deliberately does not\n * wrap its child in a span to make it hoverable.\n */\n children: ReactElement;\n /** Bold first line. Matches Figma's `Title` property. */\n title?: ReactNode;\n /** Supporting line. Matches Figma's `Body` / `Has Body`. */\n body?: ReactNode;\n side?: FloatingSide;\n align?: FloatingAlign;\n /** Delay before opening on hover, in ms. Default `150`. Keyboard focus opens at once. */\n openDelay?: number;\n /**\n * @deprecated Ignored from 0.7.0. The tooltip now stays open while the pointer travels\n * from the trigger onto it and while it is hovered, as WCAG 1.4.13 requires, which is what\n * a close delay used to approximate. Remove it from call sites; it will be dropped in 0.8.\n */\n closeDelay?: number;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n /**\n * `describedby` — the trigger keeps its own name and the tooltip adds detail. This is\n * almost always what you want. `labelledby` makes the tooltip *be* the trigger's name,\n * for an icon-only button with no other text. Default `describedby`.\n *\n * Deliberately not called `as`: everywhere else in this library `as` chooses the rendered\n * element, and reusing it for something else here would be a trap (it also makes\n * `jsx-a11y`'s polymorphic-component checking treat the value as a tag name).\n */\n association?: 'describedby' | 'labelledby';\n className?: string;\n}\n\n/**\n * Tooltip. Matches Figma's `Tooltip` set — `Placement: Top | Left | Right | Bottom`, with\n * a title and an optional body.\n *\n * Built on Radix Tooltip from 0.7.0, which gets right what a naive tooltip does not:\n *\n * - **Keyboard and touch reachable.** Opens on keyboard focus as well as hover, and closes\n * on Escape. A hover-only tooltip is inaccessible to half the people using it.\n * - **Hoverable (WCAG 1.4.13).** It stays open while the pointer moves onto it, so a\n * magnifier user can read it. 0.6 closed it the moment the pointer left the trigger.\n * - **Escape closes only the tooltip.** It goes through the same layer stack as `Modal`, so\n * dismissing a tooltip inside a dialog no longer closes the dialog too.\n * - **Referenced, not floating text.** The trigger is `aria-describedby` the tooltip (or\n * `aria-labelledby` it), so it is announced *with* the control.\n * - **`role=\"tooltip\"` and no interactive content.** Use `Popover` for anything a user acts on.\n *\n * Each tooltip carries its own Radix provider, so there is nothing to mount at the app root.\n */\nexport function Tooltip({\n children,\n title,\n body,\n side = 'top',\n align = 'center',\n openDelay = 150,\n open,\n defaultOpen,\n onOpenChange,\n association = 'describedby',\n className,\n}: TooltipProps) {\n const container = usePortalContainer();\n const labelId = useId();\n const labelled = association === 'labelledby';\n\n const content = (\n <>\n {title && <p className=\"font-semibold\">{title}</p>}\n {body && <p className={cn(title && 'mt-0.5 opacity-80')}>{body}</p>}\n </>\n );\n\n return (\n <TooltipPrimitive.Provider delayDuration={openDelay}>\n <TooltipPrimitive.Root open={open} defaultOpen={defaultOpen} onOpenChange={onOpenChange}>\n <TooltipPrimitive.Trigger\n asChild\n // As the trigger's *name*, the tooltip text has to exist while closed too, or the\n // control is unnamed; so it is rendered hidden, permanently, and Radix's own\n // description of it is switched off to avoid reading the name twice.\n {...(labelled ? { 'aria-labelledby': labelId, 'aria-describedby': undefined } : {})}\n >\n {children}\n </TooltipPrimitive.Trigger>\n {labelled && (\n <span id={labelId} hidden>\n {title}\n {body ? ' ' : null}\n {body}\n </span>\n )}\n <TooltipPrimitive.Portal container={container ?? undefined}>\n <TooltipPrimitive.Content\n side={side}\n align={align}\n sideOffset={6}\n collisionPadding={8}\n className={cn(\n 'z-tooltip max-w-[260px] rounded-lg bg-neutral px-3 py-2 shadow-300',\n 'text-body-xs text-neutral-on-neutral',\n className,\n )}\n >\n {content}\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>\n </TooltipPrimitive.Root>\n </TooltipPrimitive.Provider>\n );\n}\n","import { useId, useState, type ReactElement, type ReactNode } from 'react';\nimport { HoverCard as HoverCardPrimitive } from 'radix-ui';\n\nimport { cn } from '../../lib/cn';\nimport type { FloatingAlign, FloatingSide } from './floating';\nimport { usePortalContainer } from './portal';\n\nexport interface HoverCardProps {\n /** The trigger. Must be a single focusable element — normally a link. */\n children: ReactElement;\n /** Panel content. May contain links and text; see the note on interactivity below. */\n content: ReactNode;\n side?: FloatingSide;\n align?: FloatingAlign;\n /** Delay before opening, in ms. Default `400`. */\n openDelay?: number;\n /** Delay before closing, in ms. Default `200`. */\n closeDelay?: number;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n className?: string;\n}\n\n/**\n * A preview panel that appears on hover — a user card on an @mention, a page preview on a\n * link.\n *\n * Sits between `Tooltip` and `Popover`, and the difference is about intent rather than\n * looks:\n *\n * - `Tooltip` is a short label. It cannot be entered, so it must hold no controls.\n * - `HoverCard` is supplementary content that *can* be entered — the panel stays open while\n * the pointer is inside it, so a link in the preview is reachable. It is opened by hover\n * and focus, never by click.\n * - `Popover` is opened deliberately by click and is the only one of the three appropriate\n * for content the user must act on.\n *\n * **It is supplementary by contract.** Hover has no touch equivalent, so anything only\n * reachable here is unreachable on a phone. The panel is `aria-labelledby` the trigger and\n * exposed as a group; the trigger keeps its own name and destination.\n *\n * Built on Radix HoverCard from 0.7.0: the open and close delays, the pointer grace area\n * between trigger and panel, and Escape through the shared layer stack (so it closes only\n * the card, not a dialog behind it) come from Radix. The `group` role and the\n * `aria-describedby` wiring are ours; Radix gives the panel no role at all.\n */\nexport function HoverCard({\n children,\n content,\n side = 'bottom',\n align = 'center',\n openDelay = 400,\n closeDelay = 200,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n className,\n}: HoverCardProps) {\n const container = usePortalContainer();\n const baseId = useId();\n const contentId = `${baseId}-content`;\n const triggerId = `${baseId}-trigger`;\n // Tracked here as well as in Radix, because the trigger's description only points at the\n // panel while it exists.\n const [openState, setOpenState] = useState(defaultOpen);\n const open = openProp ?? openState;\n const handleOpenChange = (next: boolean) => {\n setOpenState(next);\n onOpenChange?.(next);\n };\n\n return (\n <HoverCardPrimitive.Root\n open={open}\n onOpenChange={handleOpenChange}\n openDelay={openDelay}\n closeDelay={closeDelay}\n >\n <HoverCardPrimitive.Trigger\n asChild\n id={triggerId}\n // Not `aria-haspopup`: nothing here is triggered by activation, and claiming a popup\n // on a plain link makes a screen reader promise an interaction that does not exist.\n aria-describedby={open ? contentId : undefined}\n >\n {children}\n </HoverCardPrimitive.Trigger>\n <HoverCardPrimitive.Portal container={container ?? undefined}>\n <HoverCardPrimitive.Content\n id={contentId}\n // `group`, not `dialog` — it was not opened deliberately and it traps nothing,\n // so announcing a dialog would be a lie.\n role=\"group\"\n aria-labelledby={triggerId}\n side={side}\n align={align}\n sideOffset={8}\n collisionPadding={8}\n className={cn(\n 'z-popover max-w-[min(20rem,calc(100vw-2rem))] rounded-xl border border-default bg-default p-4 shadow-400',\n className,\n )}\n >\n {content}\n </HoverCardPrimitive.Content>\n </HoverCardPrimitive.Portal>\n </HoverCardPrimitive.Root>\n );\n}\n","import {\n forwardRef,\n type HTMLAttributes,\n type KeyboardEvent as ReactKeyboardEvent,\n type ReactNode,\n} from 'react';\nimport { ContextMenu as ContextMenuPrimitive } from 'radix-ui';\n\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/compose-event-handlers';\nimport { useControllableState } from '../../lib/use-controllable-state';\nimport {\n MENU_PANEL_CLASSES,\n createMenuParts,\n focusMenuEdge,\n stopToAncestors,\n type MenuItemDef,\n} from './menu-core';\nimport { usePortalContainer } from './portal';\n\nexport interface ContextMenuProps {\n /**\n * The parts (`ContextMenuTrigger`, `ContextMenuContent`), or, with `items`, the area that\n * responds to right-click.\n */\n children: ReactNode;\n /**\n * The menu as data. New in 0.8.0. `children` then becomes the right-click area, wrapped in a\n * `ContextMenuTrigger` for you. The same `MenuItemDef` shape as `DropdownMenu` and `Menubar`.\n */\n items?: readonly MenuItemDef[];\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n}\n\n/**\n * Right-click menu, built on Radix ContextMenu from 0.7.0.\n *\n * Shares every item and the whole keyboard contract with `DropdownMenu` (see `menu-core`);\n * the only difference is how it opens — at the pointer, with no trigger element to anchor\n * to.\n *\n * **A context menu must never be the only way to reach an action.** `contextmenu` fires on\n * right-click and on the Windows Menu / Shift+F10 keys, but not on touch, and plenty of\n * users never right-click at all. `ContextMenuTrigger` therefore also opens on Shift+F10 and\n * the ContextMenu key even where the browser would not, and anything in here should have a\n * visible equivalent elsewhere — usually a `DropdownMenu` on the same row.\n *\n * Radix ContextMenu has no `open` prop (it is opened by the pointer only), so a controlled\n * `open={false}` closes it, but `open={true}` cannot open it without a position.\n */\nexport function ContextMenu({ children, items, open: openProp, defaultOpen = false, onOpenChange }: ContextMenuProps) {\n const [, setOpen] = useControllableState({\n value: openProp,\n defaultValue: defaultOpen,\n onChange: onOpenChange,\n });\n\n return (\n <ContextMenuPrimitive.Root onOpenChange={setOpen} modal={false}>\n {items ? (\n <>\n <ContextMenuTrigger>{children}</ContextMenuTrigger>\n <ContextMenuContent>\n <ContextMenuItems items={items} />\n </ContextMenuContent>\n </>\n ) : (\n children\n )}\n </ContextMenuPrimitive.Root>\n );\n}\n\nexport interface ContextMenuTriggerProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n disabled?: boolean;\n}\n\n/**\n * The area that responds to right-click. A wrapper with no tab stop of its own: the keyboard\n * path is Shift+F10 or the ContextMenu key from whatever inside it has focus.\n */\nexport const ContextMenuTrigger = forwardRef<HTMLDivElement, ContextMenuTriggerProps>(\n function ContextMenuTrigger({ children, disabled = false, className, onKeyDown, ...rest }, ref) {\n const openFromKeyboard = (event: ReactKeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n if (disabled || event.defaultPrevented) return;\n if (event.key === 'ContextMenu' || (event.shiftKey && event.key === 'F10')) {\n // Cancelling the key also stops the browser's own `contextmenu`, so the menu opens\n // exactly once, at the focused element rather than wherever the pointer happens to be.\n event.preventDefault();\n const source = event.target instanceof HTMLElement ? event.target : event.currentTarget;\n const rect = source.getBoundingClientRect();\n source.dispatchEvent(\n new MouseEvent('contextmenu', {\n bubbles: true,\n cancelable: true,\n clientX: rect.left + rect.width / 2,\n clientY: rect.top + rect.height / 2,\n }),\n );\n }\n };\n\n return (\n <ContextMenuPrimitive.Trigger asChild disabled={disabled}>\n {/* The key handler only catches Shift+F10 / ContextMenu bubbling up from focusable\n content inside. The wrapper is deliberately not focusable and takes no role: its\n actions have a visible equivalent elsewhere, and a tab stop here would add an\n unexplained one in the middle of, say, a table row. */}\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}\n <div\n ref={ref}\n data-slot=\"context-menu-trigger\"\n className={className}\n onKeyDown={openFromKeyboard}\n {...rest}\n >\n {children}\n </div>\n </ContextMenuPrimitive.Trigger>\n );\n },\n);\n\nexport interface ContextMenuContentProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n /** Minimum gap from the viewport edge, in px. Default `8`. */\n collisionPadding?: number;\n /** Where to portal the menu. Defaults to the enclosing dialog, else `document.body`. */\n container?: HTMLElement | null;\n}\n\nexport const ContextMenuContent = forwardRef<HTMLDivElement, ContextMenuContentProps>(\n function ContextMenuContent(\n { children, collisionPadding = 8, container, className, onClick, onKeyDown, onFocus, ...rest },\n ref,\n ) {\n const inherited = usePortalContainer();\n return (\n <ContextMenuPrimitive.Portal container={container ?? inherited ?? undefined}>\n <ContextMenuPrimitive.Content\n ref={ref}\n collisionPadding={collisionPadding}\n loop\n className={cn(MENU_PANEL_CLASSES, className)}\n onFocus={composeEventHandlers(onFocus, (event) => focusMenuEdge(event, 'start'))}\n onClick={(event) => {\n onClick?.(event);\n stopToAncestors(event);\n }}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n stopToAncestors(event);\n if (event.key === 'Tab') {\n // Tab leaves the menu, as in DropdownMenu. Radix has no imperative close for a\n // context menu, so Escape is replayed on the panel to dismiss it.\n event.currentTarget.dispatchEvent(\n new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }),\n );\n }\n }}\n {...rest}\n >\n {children}\n </ContextMenuPrimitive.Content>\n </ContextMenuPrimitive.Portal>\n );\n },\n);\n\nconst parts = createMenuParts(ContextMenuPrimitive);\n\n/** Renders `MenuItemDef[]` inside your own `ContextMenuContent`. New in 0.8.0. */\nexport const ContextMenuItems = parts.Items;\nexport const ContextMenuItem = parts.Item;\nexport const ContextMenuCheckboxItem = parts.CheckboxItem;\nexport const ContextMenuRadioGroup = parts.RadioGroup;\nexport const ContextMenuRadioItem = parts.RadioItem;\nexport const ContextMenuGroup = parts.Group;\nexport const ContextMenuLabel = parts.Label;\nexport const ContextMenuSeparator = parts.Separator;\nexport const ContextMenuShortcut = parts.Shortcut;\nexport const ContextMenuSub = parts.Sub;\nexport const ContextMenuSubTrigger = parts.SubTrigger;\nexport const ContextMenuSubContent = parts.SubContent;\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { Menubar as MenubarPrimitive } from 'radix-ui';\n\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/compose-event-handlers';\nimport { FOCUS_RING } from '../../lib/focus-ring';\nimport {\n MENU_PANEL_CLASSES,\n createMenuParts,\n focusMenuEdge,\n stopToAncestors,\n type MenuItemDef,\n} from './menu-core';\nimport { usePortalContainer } from './portal';\n\n/** One menu of a data-driven `Menubar`. New in 0.8.0. */\nexport interface MenubarMenuDef {\n /** Identifies the menu within the bar; what `value` / `onValueChange` report. */\n value: string;\n label: ReactNode;\n items: readonly MenuItemDef[];\n hidden?: boolean;\n}\n\nexport interface MenubarProps extends Omit<HTMLAttributes<HTMLDivElement>, 'dir' | 'defaultValue'> {\n /** The parts: `MenubarMenu`s. Omit when passing `menus`. */\n children?: ReactNode;\n /**\n * The bar as data: a trigger and its items per menu, rendered through the parts. New in 0.8.0.\n * Use it or `children`, not both.\n */\n menus?: readonly MenubarMenuDef[];\n /** Reading direction, which flips Left/Right along the bar. */\n dir?: 'ltr' | 'rtl';\n /** Accessible name for the bar, e.g. \"Editor\". Required: a menubar is a landmark-like group. */\n label: string;\n /** The open menu's `value`, controlled. New in 0.7.0. */\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n}\n\n/**\n * A persistent horizontal bar of menus, as in a desktop application's File / Edit / View.\n *\n * Built on Radix Menubar from 0.7.0, which supplies the contract: one tab stop for the whole\n * bar, Left/Right along it, Down/Up into a menu, Left/Right from inside an open menu to its\n * sibling, and moving the pointer across the bar switching menus once one is open. Items are\n * the same parts as `DropdownMenu` (see `menu-core`).\n */\nexport const Menubar = forwardRef<HTMLDivElement, MenubarProps>(function Menubar(\n { children, menus, label, value, defaultValue, onValueChange, className, ...rest },\n ref,\n) {\n return (\n <MenubarPrimitive.Root\n ref={ref}\n value={value}\n defaultValue={defaultValue}\n onValueChange={onValueChange}\n loop\n aria-label={label}\n data-slot=\"menubar\"\n className={cn('flex items-center gap-0.5', className)}\n {...rest}\n >\n {menus\n ? menus\n .filter((menu) => !menu.hidden)\n .map((menu) => (\n <MenubarMenu key={menu.value} value={menu.value}>\n <MenubarTrigger>{menu.label}</MenubarTrigger>\n <MenubarContent>\n <MenubarItems items={menu.items} />\n </MenubarContent>\n </MenubarMenu>\n ))\n : children}\n </MenubarPrimitive.Root>\n );\n});\n\nexport interface MenubarMenuProps {\n children: ReactNode;\n /** Identifies the menu within the bar. */\n value: string;\n}\n\nexport function MenubarMenu({ children, value }: MenubarMenuProps) {\n return <MenubarPrimitive.Menu value={value}>{children}</MenubarPrimitive.Menu>;\n}\n\nexport interface MenubarTriggerProps extends HTMLAttributes<HTMLButtonElement> {\n children: ReactNode;\n}\n\nexport const MenubarTrigger = forwardRef<HTMLButtonElement, MenubarTriggerProps>(\n function MenubarTrigger({ className, ...rest }, ref) {\n return (\n <MenubarPrimitive.Trigger\n ref={ref}\n className={cn(\n 'rounded-md px-2.5 py-1.5 text-body-sm text-default transition-colors',\n FOCUS_RING,\n 'hover:bg-default-secondary data-[state=open]:bg-default-secondary',\n className,\n )}\n {...rest}\n />\n );\n },\n);\n\nexport interface MenubarContentProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n /** Where to portal the menu. Defaults to the enclosing dialog, else `document.body`. */\n container?: HTMLElement | null;\n}\n\nexport const MenubarContent = forwardRef<HTMLDivElement, MenubarContentProps>(\n function MenubarContent(\n { children, container, className, onClick, onKeyDown, onFocus, ...rest },\n ref,\n ) {\n const inherited = usePortalContainer();\n return (\n <MenubarPrimitive.Portal container={container ?? inherited ?? undefined}>\n <MenubarPrimitive.Content\n ref={ref}\n side=\"bottom\"\n align=\"start\"\n sideOffset={4}\n collisionPadding={8}\n loop\n className={cn(MENU_PANEL_CLASSES, className)}\n onFocus={composeEventHandlers(onFocus, (event) => focusMenuEdge(event, 'start'))}\n onClick={(event) => {\n onClick?.(event);\n stopToAncestors(event);\n }}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n stopToAncestors(event);\n // Tab leaves the menu, as in DropdownMenu and ContextMenu. Radix keeps Tab inside an\n // open menu and has no imperative close here, so Escape is replayed on the panel.\n if (event.key === 'Tab') {\n event.currentTarget.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }));\n }\n }}\n {...rest}\n >\n {children}\n </MenubarPrimitive.Content>\n </MenubarPrimitive.Portal>\n );\n },\n);\n\nconst parts = createMenuParts(MenubarPrimitive);\n\n/** Renders `MenuItemDef[]` inside your own `MenubarContent`. New in 0.8.0. */\nexport const MenubarItems = parts.Items;\nexport const MenubarItem = parts.Item;\nexport const MenubarCheckboxItem = parts.CheckboxItem;\nexport const MenubarRadioGroup = parts.RadioGroup;\nexport const MenubarRadioItem = parts.RadioItem;\nexport const MenubarGroup = parts.Group;\nexport const MenubarLabel = parts.Label;\nexport const MenubarSeparator = parts.Separator;\nexport const MenubarShortcut = parts.Shortcut;\nexport const MenubarSub = parts.Sub;\nexport const MenubarSubTrigger = parts.SubTrigger;\nexport const MenubarSubContent = parts.SubContent;\n","import {\n createContext,\n forwardRef,\n useContext,\n useEffect,\n useState,\n type HTMLAttributes,\n type ReactNode,\n type RefObject,\n} from 'react';\nimport { Dialog as DialogPrimitive } from 'radix-ui';\nimport { XIcon } from 'lucide-react';\n\nimport { cn } from '../../lib/cn';\nimport { composeRefs } from '../../lib/slot';\nimport { ScrollArea } from '../cards/scroll-area';\nimport { IconButton } from '../forms/icon-button';\nimport { OVERLAY_SCRIM } from './overlay';\nimport { deferEscapeToInnerPopup } from './overlay-stack';\nimport { PortalContainerProvider } from './portal';\nimport { isInsideToaster } from './toaster-guard';\n\nexport type DrawerSide = 'right' | 'left';\nexport type DrawerFooterAlign = 'end' | 'between';\n\nexport interface DrawerProps {\n /** Controlled open state. Omit it, with `DrawerTrigger`, for an uncontrolled drawer. */\n open?: boolean;\n defaultOpen?: boolean;\n /** Fired with `false` on Escape, an outside press, or the close button. */\n onOpenChange?: (open: boolean) => void;\n /**\n * Header content (left side). The copies this replaces differ only here — a status badge +\n * title in one, an avatar + title + category in another — so it is a slot, not props.\n *\n * Put a `DrawerTitle` in it and the drawer is named by that heading. Leave `header` out\n * altogether to compose the panel from `DrawerHeader` / `DrawerBody` / `DrawerFooter`.\n */\n header?: ReactNode;\n children: ReactNode;\n /** Footer content, with the `header` layout. Composed drawers use `DrawerFooter`. */\n footer?: ReactNode;\n /** `between` when the footer has a left-aligned secondary action. */\n footerAlign?: DrawerFooterAlign;\n /**\n * Panel width. Defaults to the `w-[440px] max-w-[90vw]` shared by every existing drawer.\n * `className` is merged with `cn` from 0.7.0, so a width there works too.\n */\n width?: string;\n /** Which edge the panel slides in from. Default `right`. */\n side?: DrawerSide;\n /**\n * Accessible name, for a drawer that renders no `DrawerTitle`.\n *\n * Required from 0.4.0 to 0.6, because a free `header` slot gave the name nowhere else\n * to come from. From 0.7.0 a `DrawerTitle` anywhere in the drawer names it by reference,\n * the way `ModalTitle` names a `Modal`, so `label` is only needed without one. With\n * neither, Radix warns in development.\n */\n label?: string;\n className?: string;\n /** Call `preventDefault()` to keep the drawer open — e.g. unsaved input. */\n onEscapeKeyDown?: (event: KeyboardEvent) => void;\n /** Call `preventDefault()` to keep the drawer open. */\n onInteractOutside?: (event: PointerEvent) => void;\n /** Focus this on open instead of the first tabbable element. */\n initialFocus?: RefObject<HTMLElement | null>;\n /** Where to portal the drawer. Defaults to `document.body`. */\n container?: HTMLElement | null;\n}\n\ninterface DrawerNamingContext {\n registerTitle: (present: boolean) => void;\n registerDescription: (present: boolean) => void;\n}\n\nconst DrawerNaming = createContext<DrawerNamingContext | null>(null);\n\n/**\n * Side panel, built on Radix Dialog from 0.7.0. Radix handles Escape, the focus trap,\n * scroll lock, hiding the page from assistive tech, and returning focus on close.\n *\n * Two ways to fill it:\n *\n * // Slots: the layout every 0.6 drawer used.\n * <Drawer open={open} onOpenChange={setOpen}\n * header={<DrawerTitle>Supplier</DrawerTitle>} footer={<Button>Save</Button>}>\n * …body…\n * </Drawer>\n *\n * // Parts: for a header with a description, or a body that is not one scroll region.\n * <Drawer open={open} onOpenChange={setOpen}>\n * <DrawerHeader><DrawerTitle>Supplier</DrawerTitle><DrawerDescription>…</DrawerDescription></DrawerHeader>\n * <DrawerBody>…</DrawerBody>\n * <DrawerFooter><Button>Save</Button></DrawerFooter>\n * </Drawer>\n */\nexport const Drawer = forwardRef<HTMLDivElement, DrawerProps>(function Drawer(\n {\n open,\n defaultOpen,\n onOpenChange,\n header,\n children,\n footer,\n footerAlign = 'end',\n width = 'w-[440px] max-w-[90vw]',\n side = 'right',\n label,\n className,\n onEscapeKeyDown,\n onInteractOutside,\n initialFocus,\n container,\n },\n ref,\n) {\n return (\n <DialogPrimitive.Root open={open} defaultOpen={defaultOpen} onOpenChange={onOpenChange}>\n {extractTrigger(children)}\n <DialogPrimitive.Portal container={container ?? undefined}>\n <DrawerPanel\n ref={ref}\n side={side}\n width={width}\n label={label}\n className={className}\n onEscapeKeyDown={onEscapeKeyDown}\n onInteractOutside={onInteractOutside}\n initialFocus={initialFocus}\n >\n {header !== undefined ? (\n <>\n <DrawerHeader>{header}</DrawerHeader>\n <DrawerBody label={label}>{withoutTrigger(children)}</DrawerBody>\n {footer && <DrawerFooter align={footerAlign}>{footer}</DrawerFooter>}\n </>\n ) : (\n withoutTrigger(children)\n )}\n </DrawerPanel>\n </DialogPrimitive.Portal>\n </DialogPrimitive.Root>\n );\n});\n\ninterface DrawerPanelProps\n extends Pick<\n DrawerProps,\n 'side' | 'width' | 'label' | 'className' | 'onEscapeKeyDown' | 'onInteractOutside' | 'initialFocus'\n > {\n children: ReactNode;\n}\n\nconst DrawerPanel = forwardRef<HTMLDivElement, DrawerPanelProps>(function DrawerPanel(\n { side = 'right', width, label, className, onEscapeKeyDown, onInteractOutside, initialFocus, children },\n ref,\n) {\n const [hasTitle, setHasTitle] = useState(false);\n const [hasDescription, setHasDescription] = useState(false);\n const [panelNode, setPanelNode] = useState<HTMLDivElement | null>(null);\n // See Modal: Radix only returns focus to its own Trigger, and most drawers are opened by\n // an ordinary button. Captured before Radix moves focus into the panel.\n const [returnFocusTo] = useState(() =>\n typeof document === 'undefined' ? null : (document.activeElement as HTMLElement | null),\n );\n\n return (\n <DialogPrimitive.Overlay\n className={cn(\n 'fixed inset-0 z-modal flex',\n side === 'right' ? 'justify-end' : 'justify-start',\n OVERLAY_SCRIM,\n )}\n >\n <DialogPrimitive.Content\n asChild\n {...(hasDescription ? {} : { 'aria-describedby': undefined })}\n onOpenAutoFocus={(event) => {\n const target = initialFocus?.current;\n if (target) {\n event.preventDefault();\n target.focus();\n }\n }}\n onCloseAutoFocus={(event) => {\n if (returnFocusTo?.isConnected && returnFocusTo !== document.body) {\n event.preventDefault();\n returnFocusTo.focus();\n }\n }}\n onEscapeKeyDown={(event) => {\n if (!deferEscapeToInnerPopup(event)) onEscapeKeyDown?.(event);\n }}\n onPointerDownOutside={(event) => {\n if (isInsideToaster(event.target)) {\n event.preventDefault();\n return;\n }\n const original = event.detail.originalEvent;\n onInteractOutside?.(original);\n if (original.defaultPrevented) event.preventDefault();\n }}\n >\n {/* A `<div>`, not the `<aside>` of 0.6: `aside` is the complementary landmark, and\n `role=\"dialog\"` is not an allowed role on it (axe: aria-allowed-role). */}\n <div\n ref={composeRefs(ref, setPanelNode)}\n data-side={side}\n className={cn(\n 'relative flex h-full flex-col bg-default shadow-500 focus:outline-none',\n width,\n className,\n )}\n >\n {!hasTitle && label && (\n <DialogPrimitive.Title className=\"sr-only\">{label}</DialogPrimitive.Title>\n )}\n <DrawerNaming.Provider\n value={{ registerTitle: setHasTitle, registerDescription: setHasDescription }}\n >\n <PortalContainerProvider container={panelNode}>{children}</PortalContainerProvider>\n </DrawerNaming.Provider>\n </div>\n </DialogPrimitive.Content>\n </DialogPrimitive.Overlay>\n );\n});\n\n// ── Trigger / Close ────────────────────────────────────────────────────────────\n\nexport interface DrawerTriggerProps extends HTMLAttributes<HTMLButtonElement> {\n asChild?: boolean;\n}\n\n/** Opens an uncontrolled `Drawer`. A direct child of `Drawer`; it renders in place. */\nexport const DrawerTrigger = forwardRef<HTMLButtonElement, DrawerTriggerProps>(\n function DrawerTrigger(props, ref) {\n return <DialogPrimitive.Trigger ref={ref} {...props} />;\n },\n);\n(DrawerTrigger as unknown as { __drawerTrigger: true }).__drawerTrigger = true;\n\nexport interface DrawerCloseProps extends HTMLAttributes<HTMLButtonElement> {\n asChild?: boolean;\n}\n\n/** Closes the enclosing `Drawer`, e.g. a footer \"Cancel\" button. */\nexport const DrawerClose = forwardRef<HTMLButtonElement, DrawerCloseProps>(\n function DrawerClose(props, ref) {\n return <DialogPrimitive.Close ref={ref} {...props} />;\n },\n);\n\nfunction isTrigger(node: ReactNode): boolean {\n return (\n typeof node === 'object' &&\n node !== null &&\n 'type' in node &&\n (node.type as { __drawerTrigger?: boolean })?.__drawerTrigger === true\n );\n}\n\nfunction extractTrigger(children: ReactNode): ReactNode {\n return Array.isArray(children) ? children.filter(isTrigger) : isTrigger(children) ? children : null;\n}\n\nfunction withoutTrigger(children: ReactNode): ReactNode {\n return Array.isArray(children)\n ? children.filter((child) => !isTrigger(child))\n : isTrigger(children)\n ? null\n : children;\n}\n\n// ── Parts ──────────────────────────────────────────────────────────────────────\n\nexport interface DrawerHeaderProps extends HTMLAttributes<HTMLDivElement> {\n /** Renders the close button at the end of the header row. Default `true`. */\n showClose?: boolean;\n}\n\n/** The header row, with the close button. The `header` slot renders inside one of these. */\nexport const DrawerHeader = forwardRef<HTMLDivElement, DrawerHeaderProps>(function DrawerHeader(\n { children, showClose = true, className, ...rest },\n ref,\n) {\n return (\n <div\n ref={ref}\n className={cn('flex items-start justify-between gap-3 border-b border-default p-6', className)}\n {...rest}\n >\n <div className=\"min-w-0\">{children}</div>\n {showClose && (\n <DialogPrimitive.Close asChild>\n <IconButton variant=\"subtle\" size=\"sm\" aria-label=\"Close\">\n <XIcon size={18} aria-hidden />\n </IconButton>\n </DialogPrimitive.Close>\n )}\n </div>\n );\n});\n\nexport interface DrawerTitleProps extends HTMLAttributes<HTMLHeadingElement> {}\n\n/** Names the drawer (`aria-labelledby`). Use it inside the `header` slot or `DrawerHeader`. */\nexport const DrawerTitle = forwardRef<HTMLHeadingElement, DrawerTitleProps>(function DrawerTitle(\n { className, children, ...rest },\n ref,\n) {\n const naming = useContext(DrawerNaming);\n useEffect(() => {\n naming?.registerTitle(true);\n return () => naming?.registerTitle(false);\n }, [naming]);\n\n const classes = cn('text-heading-sm font-semibold text-default', className);\n if (!naming) {\n return (\n <h2 ref={ref} className={classes} {...rest}>\n {children}\n </h2>\n );\n }\n return (\n <DialogPrimitive.Title ref={ref} className={classes} {...rest}>\n {children}\n </DialogPrimitive.Title>\n );\n});\n\nexport interface DrawerDescriptionProps extends HTMLAttributes<HTMLParagraphElement> {}\n\n/** Describes the drawer (`aria-describedby`). */\nexport const DrawerDescription = forwardRef<HTMLParagraphElement, DrawerDescriptionProps>(\n function DrawerDescription({ className, ...rest }, ref) {\n const naming = useContext(DrawerNaming);\n useEffect(() => {\n naming?.registerDescription(true);\n return () => naming?.registerDescription(false);\n }, [naming]);\n\n const classes = cn('mt-0.5 text-body-xs text-default-secondary', className);\n if (!naming) return <p ref={ref} className={classes} {...rest} />;\n return <DialogPrimitive.Description ref={ref} className={classes} {...rest} />;\n },\n);\n\nexport interface DrawerBodyProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Accessible name for the scroll region, which becomes focusable when it overflows.\n * Defaults to \"Content\". It is not the drawer's own name, which would be announced twice.\n */\n label?: string;\n}\n\n/** The scrolling body. It fills the space between header and footer. */\nexport const DrawerBody = forwardRef<HTMLDivElement, DrawerBodyProps>(function DrawerBody(\n { children, label, className, ...rest },\n ref,\n) {\n return (\n <ScrollArea\n ref={ref}\n axis=\"vertical\"\n label={label ? `${label} content` : 'Content'}\n className=\"min-h-0 flex-1\"\n {...rest}\n >\n <div className={cn('space-y-6 p-6', className)}>{children}</div>\n </ScrollArea>\n );\n});\n\nexport interface DrawerFooterProps extends HTMLAttributes<HTMLDivElement> {\n align?: DrawerFooterAlign;\n}\n\nexport const DrawerFooter = forwardRef<HTMLDivElement, DrawerFooterProps>(function DrawerFooter(\n { align = 'end', className, ...rest },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-align={align}\n className={cn(\n 'flex items-center gap-2 border-t border-default px-6 py-4',\n align === 'between' ? 'justify-between' : 'justify-end',\n className,\n )}\n {...rest}\n />\n );\n});\n","import { forwardRef, useEffect, useRef, useState, type HTMLAttributes, type ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { SCROLLBAR_CLASSES } from '../../lib/scrollbar';\nimport { composeRefs } from '../../lib/slot';\n\nexport type ScrollAreaAxis = 'vertical' | 'horizontal' | 'both';\n\nexport interface ScrollAreaProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n axis?: ScrollAreaAxis;\n /**\n * Accessible name for the scrollable region. Strongly recommended — a scroll container\n * that becomes focusable (see below) needs to announce what it is.\n */\n label?: string;\n}\n\nconst OVERFLOW: Record<ScrollAreaAxis, string> = {\n vertical: 'overflow-y-auto overflow-x-hidden',\n horizontal: 'overflow-x-auto overflow-y-hidden',\n both: 'overflow-auto',\n};\n\nexport { SCROLLBAR_CLASSES } from '../../lib/scrollbar';\n\n/**\n * A scrollable region with styled scrollbars.\n *\n * **Native scrolling, deliberately.** shadcn/Radix replaces the scrollbar with a rendered\n * one, which looks tidier and costs real accessibility: an overlay scrollbar has to\n * reimplement keyboard scrolling, momentum, trackpad and pen behaviour, and the OS\n * \"click the track to page\" convention — and it drops out entirely if the JS fails. Styling\n * `::-webkit-scrollbar` plus `scrollbar-width`/`scrollbar-color` gets most of the look with\n * none of that risk, and degrades to a normal scrollbar where unsupported.\n *\n * The one thing this *does* add is the piece browsers get wrong: a scroll container is not\n * keyboard focusable by default in Chrome or Safari, so a keyboard-only user cannot scroll\n * an overflowing `<div>` at all unless something inside it is focusable. This measures its\n * own content and sets `tabIndex={0}` only while it actually overflows, so the region is\n * scrollable with the arrow keys without adding a pointless tab stop when it does not.\n */\nexport const ScrollArea = forwardRef<HTMLDivElement, ScrollAreaProps>(function ScrollArea(\n { children, axis = 'vertical', label, className, ...rest },\n ref,\n) {\n const localRef = useRef<HTMLDivElement>(null);\n const [overflows, setOverflows] = useState(false);\n\n useEffect(() => {\n const node = localRef.current;\n if (!node) return;\n\n const measure = () => {\n const vertical = node.scrollHeight > node.clientHeight + 1;\n const horizontal = node.scrollWidth > node.clientWidth + 1;\n setOverflows(\n axis === 'vertical' ? vertical : axis === 'horizontal' ? horizontal : vertical || horizontal,\n );\n };\n\n measure();\n\n // Feature-detected: `ResizeObserver` is absent in jsdom, in Safari before 13.1, and\n // during any server render, and an unguarded `new ResizeObserver` throws outright. The\n // measurement above has already run, so without the observer the tab stop is simply\n // decided once at mount rather than tracked — degraded, not broken.\n if (typeof ResizeObserver === 'undefined') return;\n\n // Content and box size both matter, so both are observed. On the element it catches the\n // box; on the first child it catches content growth.\n const observer = new ResizeObserver(measure);\n observer.observe(node);\n if (node.firstElementChild) observer.observe(node.firstElementChild);\n return () => observer.disconnect();\n }, [axis, children]);\n\n return (\n <div\n ref={composeRefs<HTMLDivElement>(localRef, ref)}\n // `role=\"region\"` only once it is focusable and named, so an ordinary non-overflowing\n // wrapper does not add a landmark to the page for nothing.\n role={overflows && label ? 'region' : undefined}\n aria-label={overflows ? label : undefined}\n tabIndex={overflows ? 0 : undefined}\n data-slot=\"scroll-area\"\n className={clsx(\n OVERFLOW[axis],\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default',\n SCROLLBAR_CLASSES,\n className,\n )}\n {...rest}\n >\n {children}\n </div>\n );\n});\n","import { useRef, type ReactNode } from 'react';\n\nimport { Button } from '../forms/button';\nimport { Modal, ModalBody, ModalDescription, ModalFooter, ModalHeader, ModalTitle } from './modal';\nimport type { ModalAlign, ModalSize, ModalTone } from './modal';\n\nexport interface ConfirmDialogProps {\n open: boolean;\n title: string;\n subtitle?: string;\n /**\n * Adds a tinted glyph to the header. Defaults to `default` (no glyph) so existing\n * call sites look unchanged; opt in per dialog rather than deriving it from\n * `confirmVariant`, which would silently restyle every destructive confirm.\n */\n tone?: ModalTone;\n size?: ModalSize;\n /** Forwarded to Modal: `top` keeps the panel from moving when its height changes. New in 0.8.2. */\n align?: ModalAlign;\n confirmLabel?: string;\n cancelLabel?: string;\n confirmVariant?: 'primary' | 'danger';\n /**\n * The double-submit guard. While true, the confirm button shows a spinner and its\n * `confirmingLabel`, and ignores presses while keeping focus. The dialog also cannot be\n * dismissed (Escape, outside press, Cancel, the close button), so a request in flight\n * cannot lose the dialog that is waiting on it.\n */\n isConfirming?: boolean;\n /** Label shown on the confirm button while `isConfirming`. */\n confirmingLabel?: string;\n /**\n * The action can't go ahead yet — something still depends on the record, a check is\n * pending. Disables only the confirm button; Cancel, Escape, outside press and the close\n * button still dismiss, so the dialog can explain why and let the person leave. Not a\n * substitute for `isConfirming`, which also locks the dialog while a request is in flight.\n * New in 0.8.1.\n */\n confirmDisabled?: boolean;\n /** Optional body — a warning callout, a consequences list, or a failed-attempt error. */\n children?: ReactNode;\n className?: string;\n onConfirm: () => void;\n /** Fired with `false` on cancel, Escape, or an outside press. */\n onOpenChange: (open: boolean) => void;\n}\n\n/**\n * The in-app replacement for `window.confirm`: a title, an optional body, and a\n * cancel/confirm pair.\n *\n * Kept as a preset rather than folded into `Modal` because it carries *behaviour*, not\n * just layout — the `isConfirming` guard that disables the button and swaps its label\n * is the thing call sites get wrong when they hand-roll a confirm. For any other\n * shape, compose `Modal` and its parts directly.\n *\n * Focus opens on **Cancel**, the least destructive action, as the WAI-ARIA alert dialog\n * pattern recommends. Through 0.6 it opened on the close button, one Tab away from\n * \"Delete\".\n */\nexport function ConfirmDialog({\n open,\n title,\n subtitle,\n tone = 'default',\n size = 'md',\n align,\n confirmLabel = 'Confirm',\n cancelLabel = 'Cancel',\n confirmVariant = 'primary',\n isConfirming = false,\n confirmingLabel = 'Working…',\n confirmDisabled = false,\n children,\n className,\n onConfirm,\n onOpenChange,\n}: ConfirmDialogProps) {\n const cancelRef = useRef<HTMLButtonElement>(null);\n // Every dismissal route (Escape, outside press, close button, Cancel) arrives here.\n const requestOpenChange = (next: boolean) => {\n if (!next && isConfirming) return;\n onOpenChange(next);\n };\n\n return (\n // `alertdialog`, not `dialog`: this interrupts to ask a yes/no question, so the body\n // should be announced on open rather than waiting to be browsed to. The name comes\n // from `ModalTitle` via `aria-labelledby`, so there is no `label` to keep in sync.\n <Modal\n open={open}\n onOpenChange={requestOpenChange}\n role=\"alertdialog\"\n size={size}\n align={align}\n className={className}\n initialFocus={cancelRef}\n >\n <ModalHeader tone={tone} divider={Boolean(children)}>\n <ModalTitle>{title}</ModalTitle>\n {subtitle && <ModalDescription>{subtitle}</ModalDescription>}\n </ModalHeader>\n {/* Guarded: 0.2.0 always rendered a body, so a childless confirm carried 40px of\n dead space plus a stray rule. */}\n {children && <ModalBody>{children}</ModalBody>}\n <ModalFooter>\n <Button\n ref={cancelRef}\n variant=\"neutral\"\n size=\"md\"\n disabled={isConfirming}\n onClick={() => requestOpenChange(false)}\n >\n {cancelLabel}\n </Button>\n <Button\n variant={confirmVariant}\n size=\"md\"\n loading={isConfirming}\n loadingLabel={confirmingLabel}\n disabled={confirmDisabled}\n onClick={onConfirm}\n >\n {isConfirming ? confirmingLabel : confirmLabel}\n </Button>\n </ModalFooter>\n </Modal>\n );\n}\n","import { useState } from 'react';\n\nimport { Button } from '../forms/button';\nimport { Textarea } from '../forms/textarea';\nimport { Modal, ModalBody, ModalDescription, ModalFooter, ModalHeader, ModalTitle } from './modal';\nimport type { ModalAlign, ModalSize, ModalTone } from './modal';\n\nexport interface NoteConfirmModalProps {\n open: boolean;\n title: string;\n subtitle?: string;\n tone?: ModalTone;\n size?: ModalSize;\n /** Forwarded to Modal: `top` keeps the panel from moving when its height changes. New in 0.8.2. */\n align?: ModalAlign;\n confirmLabel: string;\n cancelLabel?: string;\n confirmVariant?: 'primary' | 'danger';\n /** Block confirmation until the note has content. */\n requireNote?: boolean;\n notePlaceholder?: string;\n /** Accessible name of the note field. The placeholder is not a label. Defaults to \"Note\". */\n noteLabel?: string;\n submittingLabel?: string;\n /** Shows a spinner on confirm and keeps the dialog from being dismissed mid-request. */\n isSubmitting?: boolean;\n className?: string;\n /** Fired with `false` on cancel, Escape, or an outside press. */\n onOpenChange: (open: boolean) => void;\n onConfirm: (note: string) => void;\n /**\n * Asked before an Escape or outside press throws away a note that has content.\n * Return `false` to keep the dialog open. Defaults to `window.confirm`.\n */\n onDiscardNote?: (note: string) => boolean;\n}\n\n/**\n * Confirm dialog that collects a free-text note — approvals, rejections, information\n * requests. The note is trimmed before it reaches `onConfirm`.\n *\n * Kept as a preset because it owns state, and a composition cannot.\n */\nexport function NoteConfirmModal({ open, ...rest }: NoteConfirmModalProps) {\n // The shell split is what resets the note. Before 0.3.0 this component had no `open`\n // prop and callers mounted it conditionally, so the typed note was discarded for free.\n // Now that it stays mounted, unmounting the shell is what clears it — otherwise a\n // rejection note would reappear the next time the dialog opened.\n if (!open) return null;\n return <NoteConfirmModalShell {...rest} />;\n}\n\nfunction NoteConfirmModalShell({\n title,\n subtitle,\n tone = 'default',\n size = 'md',\n align,\n confirmLabel,\n cancelLabel = 'Cancel',\n confirmVariant = 'primary',\n requireNote = false,\n notePlaceholder = 'Add a note…',\n noteLabel = 'Note',\n submittingLabel = 'Saving…',\n isSubmitting = false,\n className,\n onOpenChange,\n onConfirm,\n onDiscardNote,\n}: Omit<NoteConfirmModalProps, 'open'>) {\n const [note, setNote] = useState('');\n const noteMissing = requireNote && !note.trim();\n const requestOpenChange = (next: boolean) => {\n if (!next && isSubmitting) return;\n onOpenChange(next);\n };\n\n /**\n * Escape and an outside press both unmount the shell, which is what clears the note —\n * so before 0.4.0 either one silently destroyed whatever the user had typed, with no\n * warning and no undo. On a rejection-reason dialog that is real work lost.\n */\n const guardDiscard = (event: { preventDefault: () => void }) => {\n if (isSubmitting) {\n event.preventDefault();\n return;\n }\n if (!note.trim()) return;\n const confirmed = onDiscardNote\n ? onDiscardNote(note)\n : typeof window !== 'undefined' &&\n window.confirm('Discard your note? It will not be saved.');\n if (!confirmed) event.preventDefault();\n };\n\n return (\n <Modal\n open\n onOpenChange={requestOpenChange}\n size={size}\n align={align}\n className={className}\n onEscapeKeyDown={guardDiscard}\n onInteractOutside={guardDiscard}\n >\n <ModalHeader tone={tone}>\n <ModalTitle>{title}</ModalTitle>\n {subtitle && <ModalDescription>{subtitle}</ModalDescription>}\n </ModalHeader>\n <ModalBody>\n <Textarea\n value={note}\n onChange={(e) => setNote(e.target.value)}\n placeholder={notePlaceholder}\n aria-label={noteLabel}\n rows={4}\n />\n </ModalBody>\n <ModalFooter>\n <Button\n variant=\"neutral\"\n size=\"md\"\n disabled={isSubmitting}\n onClick={() => requestOpenChange(false)}\n >\n {cancelLabel}\n </Button>\n <Button\n variant={confirmVariant}\n size=\"md\"\n disabled={noteMissing}\n loading={isSubmitting}\n loadingLabel={submittingLabel}\n onClick={() => onConfirm(note.trim())}\n >\n {isSubmitting ? submittingLabel : confirmLabel}\n </Button>\n </ModalFooter>\n </Modal>\n );\n}\n","import { cn } from '../../lib/cn';\nimport { OVERLAY_SCRIM } from './overlay';\n\nexport interface ScrimProps {\n /** Dismiss the overlay this scrim sits behind. */\n onClose?: () => void;\n /**\n * Accessible name. With one, the scrim is a real `<button>`, which it must be when clicking it\n * is the *only* pointer route out. Without one it is `aria-hidden` decoration, and the overlay\n * must offer another exit (a close button, Escape).\n */\n label?: string;\n /** `absolute` when the scrim sits inside a wrapper that is already positioned. */\n position?: 'fixed' | 'absolute';\n /**\n * Fade instead of mounting and unmounting, for a panel that slides in and out. While closed\n * the scrim stops taking pointer events; an always-mounted scrim that kept them would silently\n * eat every click on the page. Set as `data-state`.\n */\n open?: boolean;\n /** Stacking and breakpoint gating, e.g. `z-overlay lg:hidden`. */\n className?: string;\n}\n\n/**\n * The dimming layer behind an overlay, for overlays `Modal` and `Drawer` do not cover (a\n * non-modal side panel, a mobile nav). New in 0.7.0, from SCIC. It exists so \"I need a scrim\"\n * never again means hand-writing `fixed inset-0 bg-black/40`, which is how SCIC ended up with\n * three scrim colours. The colour comes from `OVERLAY_SCRIM`.\n */\nexport function Scrim({ onClose, label, position = 'fixed', open, className }: ScrimProps) {\n const classes = cn(\n position === 'fixed' ? 'fixed inset-0' : 'absolute inset-0',\n OVERLAY_SCRIM,\n open !== undefined && 'transition-opacity duration-200 motion-reduce:transition-none',\n 'data-[state=closed]:pointer-events-none data-[state=closed]:opacity-0',\n className,\n );\n const state = open === undefined ? undefined : open ? 'open' : 'closed';\n\n if (label) {\n return <button type=\"button\" aria-label={label} data-state={state} onClick={onClose} className={classes} />;\n }\n // Decoration: the overlay offers another way out, so this needs no keyboard handler.\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions\n return <div aria-hidden data-state={state} onClick={onClose} className={classes} />;\n}\n","import { useState, type ReactNode } from 'react';\nimport { Dialog as DialogPrimitive } from 'radix-ui';\nimport { XIcon } from 'lucide-react';\nimport { cn } from '../../lib/cn';\nimport { Button } from '../forms/button';\nimport { deferEscapeToInnerPopup } from './overlay-stack';\nimport { PortalContainerProvider } from './portal';\n\n/**\n * `base` (the default) sits on the overlay layer, so a dialog opened from inside it appears above\n * it. `elevated` sits above another surface, e.g. a widget preview opened from a full-screen\n * dashboard. SCIC defaulted to `elevated`.\n */\nexport type FullscreenStacking = 'base' | 'elevated';\n\nconst STACKING: Record<FullscreenStacking, string> = {\n base: 'z-overlay',\n elevated: 'z-modal',\n};\n\nexport interface FullscreenSurfaceProps {\n /** Called on Escape and on the close button. The surface renders while mounted. */\n onClose: () => void;\n /** Accessible name of the surface, e.g. \"Supply risk dashboard\". */\n label: string;\n /** Text on the close button. Default \"Close\". */\n closeLabel?: string;\n stacking?: FullscreenStacking;\n children: ReactNode;\n className?: string;\n}\n\n/**\n * An opaque, scrollable surface that fills the viewport, with a close button: \"full screen\" and\n * \"expand this widget\". New in 0.7.0, from SCIC.\n *\n * No scrim, because nothing behind it is visible. But it *is* modal: SCIC's version left the page\n * underneath in the tab order, so Tab walked into content covered by the surface. Built on Radix\n * Dialog, it traps focus, hides the page from assistive tech, returns focus on close, and takes\n * Escape through the shared layer stack, so a dialog opened on top closes first.\n */\nexport function FullscreenSurface({\n onClose,\n label,\n closeLabel = 'Close',\n stacking = 'base',\n children,\n className,\n}: FullscreenSurfaceProps) {\n const [node, setNode] = useState<HTMLDivElement | null>(null);\n // See Modal: Radix only returns focus to its own Trigger, and a surface is opened by an\n // ordinary button. Read during the first render, before Radix moves focus into the surface.\n const [returnFocusTo] = useState(() =>\n typeof document === 'undefined' ? null : (document.activeElement as HTMLElement | null),\n );\n return (\n <DialogPrimitive.Root open onOpenChange={(open) => !open && onClose()}>\n <DialogPrimitive.Portal>\n <DialogPrimitive.Content\n ref={setNode}\n aria-describedby={undefined}\n onCloseAutoFocus={(event) => {\n if (returnFocusTo?.isConnected && returnFocusTo !== document.body) {\n event.preventDefault();\n returnFocusTo.focus();\n }\n }}\n onEscapeKeyDown={(event) => void deferEscapeToInnerPopup(event)}\n className={cn(\n 'fixed inset-0 overflow-auto bg-default-secondary p-4 focus:outline-none lg:p-6',\n STACKING[stacking],\n className,\n )}\n >\n <DialogPrimitive.Title className=\"sr-only\">{label}</DialogPrimitive.Title>\n <div className=\"mb-4 flex justify-end\">\n <DialogPrimitive.Close asChild>\n <Button variant=\"neutral\" size=\"md\" leadingIcon={<XIcon aria-hidden />}>\n {closeLabel}\n </Button>\n </DialogPrimitive.Close>\n </div>\n <PortalContainerProvider container={node}>{children}</PortalContainerProvider>\n </DialogPrimitive.Content>\n </DialogPrimitive.Portal>\n </DialogPrimitive.Root>\n );\n}\n","import { forwardRef, type HTMLAttributes } from 'react';\nimport { VisuallyHidden as VisuallyHiddenPrimitive } from 'radix-ui';\n\nexport interface VisuallyHiddenProps extends HTMLAttributes<HTMLSpanElement> {\n /** Render the hiding styles onto the single child element instead of a `<span>`. */\n asChild?: boolean;\n}\n\n/**\n * Content that screen readers announce and nobody sees: a dialog title the design does\n * not show, a \"(opens in new tab)\" suffix, the label of an icon-only control.\n *\n * Tailwind's `sr-only` does the same job in markup the library owns, and nine components still\n * use it. This is for the call site, where a component is clearer than a utility class and\n * survives a `className` override that would otherwise drop `sr-only` along with the rest.\n */\nexport const VisuallyHidden = forwardRef<HTMLSpanElement, VisuallyHiddenProps>(\n function VisuallyHidden(props, ref) {\n return <VisuallyHiddenPrimitive.Root ref={ref} {...props} />;\n },\n);\n","import type { ReactElement } from 'react';\nimport { AccessibleIcon as AccessibleIconPrimitive } from 'radix-ui';\n\nexport interface AccessibleIconProps {\n /** The icon. A single element; it is hidden from assistive technology. */\n children: ReactElement;\n /** What the icon means. It is announced in place of the icon. */\n label: string;\n}\n\n/**\n * An icon that carries meaning on its own, with no visible text beside it: a \"verified\" tick\n * in a table cell, a warning glyph standing in for a status word.\n *\n * Icons are decorative by default (`lucide-react` hides them, and so does the library wherever\n * it renders one for you). That is right beside a label and wrong here, where the icon *is*\n * the information. This hides the SVG and adds the label as visually hidden text, which reads\n * reliably in every screen reader, unlike `aria-label` on an `<svg>`.\n *\n * Inside a button, use `IconButton` with `aria-label` instead: the name belongs to the control,\n * not to the glyph.\n *\n * <AccessibleIcon label=\"Verified\"><CircleCheckBigIcon className=\"size-4\" /></AccessibleIcon>\n */\nexport function AccessibleIcon({ children, label }: AccessibleIconProps) {\n return <AccessibleIconPrimitive.Root label={label}>{children}</AccessibleIconPrimitive.Root>;\n}\n","import { createContext, useContext, type HTMLAttributes, type ReactNode } from 'react';\nimport { cn } from '../../lib/cn';\n\nexport type CardSize = 'sm' | 'md' | 'lg';\nexport type CardRadius = 'lg' | 'xl' | '2xl';\nexport type CardTone = 'default' | 'brand' | 'positive' | 'warning' | 'danger';\nexport type CardFooterAlign = 'start' | 'between' | 'end';\n\nconst RADIUS: Record<CardRadius, string> = {\n lg: 'rounded-lg',\n xl: 'rounded-xl',\n '2xl': 'rounded-2xl',\n};\n\nconst TONE: Record<CardTone, string> = {\n default: 'border-default bg-default',\n brand: 'border-brand-tertiary bg-brand-tertiary',\n positive: 'border-positive-tertiary bg-positive-tertiary',\n warning: 'border-warning-tertiary bg-warning-tertiary',\n // The one asymmetry: danger keeps the strong `border-danger` rather than the\n // tertiary border, because it is the only tone that has to read as an alarm from\n // across a dashboard. Byte-identical to the deleted AlertCard's danger surface.\n danger: 'border-danger bg-danger-tertiary',\n};\n\n/**\n * Header and footer share one padding ladder, and it now matches `BODY_BOX` on both axes.\n *\n * It used to match horizontally and not vertically — `px-4 py-3` against the body's `p-4` —\n * so a header sat 4px tighter than the body it capped, and stacking a header on a body put\n * two different rhythms in one card. The horizontal inset was already the value that\n * mattered for aligning a title over its content; the vertical one was simply out of step.\n */\nconst BOX: Record<CardSize, string> = {\n sm: 'px-3 py-3',\n md: 'px-4 py-4',\n lg: 'px-5 py-5',\n};\n\nconst BODY_BOX: Record<CardSize, string> = {\n sm: 'gap-3 p-3',\n md: 'gap-4 p-4',\n lg: 'gap-5 p-5',\n};\n\nconst TITLE_SIZE: Record<CardSize, string> = {\n sm: 'text-body-xs',\n md: 'text-body-sm',\n lg: 'text-subheading-sm',\n};\n\n/**\n * One step below the title at every size.\n *\n * `CardDescription` was frozen at `text-body-tiny` while `CardTitle` scaled, so `size=\"lg\"`\n * put an 11px description under a 16px title and `size=\"sm\"` put 11px under 13px — the ratio\n * broke at both ends of the ladder. The size comes from the enclosing `CardHeader` through\n * context rather than a prop, because a description that has to be told its own size at every\n * call site is a size that will drift.\n */\nconst DESCRIPTION_SIZE: Record<CardSize, string> = {\n sm: 'text-body-tiny',\n md: 'text-body-tiny',\n lg: 'text-body-xs',\n};\n\nconst FOOTER_ALIGN: Record<CardFooterAlign, string> = {\n start: 'justify-start',\n between: 'justify-between',\n end: 'justify-end',\n};\n\n/**\n * Set by `CardHeader` so `CardDescription` tracks its sibling title's size.\n *\n * Deliberately only carries the size, and only from the header: the body has its own\n * ladder and nothing inside it reads this.\n */\nconst CardHeaderContext = createContext<CardSize>('md');\n\n// ── Card ───────────────────────────────────────────────────────────────────────\n\nexport interface CardProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n /** `2xl` suits detail pages, `xl` section panels, `lg` dense or nested cards. */\n radius?: CardRadius;\n /**\n * Surface tint. This is a prop rather than a `className` because a tone has to\n * un-set the base `border-default bg-default` pair, not add to it.\n */\n tone?: CardTone;\n}\n\n/**\n * The card shell. Composed from `CardHeader`, `CardBody` and `CardFooter` — or from\n * nothing at all, if you want content to bleed to the edges (drop `CardBody` and put\n * a `DataTable` straight inside).\n *\n * Replaces `SectionCard` and the two monolithic cards that shipped beside it,\n * `AlertCard` and `BenchmarkCard`. Both of those are now documented compositions; see\n * the Cards page. The vocabulary follows shadcn/ui so it is already familiar, with\n * `CardBody` in place of its `CardContent`.\n */\nexport function Card({ children, radius = '2xl', tone = 'default', className, ...rest }: CardProps) {\n return (\n <div\n data-tone={tone}\n data-slot=\"card\"\n // `overflow-hidden` is load-bearing: it clips a header's border-b to the\n // rounded corner. Removing it leaves the rule poking past the radius.\n className={cn('flex flex-col overflow-hidden border', RADIUS[radius], TONE[tone], className)}\n {...rest}\n >\n {children}\n </div>\n );\n}\n\n// ── CardHeader ─────────────────────────────────────────────────────────────────\n\nexport interface CardHeaderProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n size?: CardSize;\n /** Bottom rule separating the header from the body. */\n divider?: boolean;\n}\n\n/**\n * Header row. Holds `CardTitle`, `CardDescription` and an optional `CardAction`.\n *\n * The `has-[…]` selector switches to a two-column grid only when a `CardAction` is\n * present, which is what lets title, description and action share a header with no\n * wrapper div and no stray gap when the action is absent.\n */\nexport function CardHeader({\n children,\n size = 'md',\n divider = true,\n className,\n ...rest\n}: CardHeaderProps) {\n return (\n <CardHeaderContext.Provider value={size}>\n <div\n data-slot=\"card-header\"\n className={cn(\n 'grid auto-rows-min items-center gap-x-3 gap-y-0.5',\n 'has-[[data-slot=card-action]]:grid-cols-[1fr_auto]',\n BOX[size],\n divider && 'border-b border-default',\n className,\n )}\n {...rest}\n >\n {children}\n </div>\n </CardHeaderContext.Provider>\n );\n}\n\n// ── CardTitle / CardDescription / CardAction ───────────────────────────────────\n\nexport interface CardTitleProps extends HTMLAttributes<HTMLElement> {\n children: ReactNode;\n size?: CardSize;\n /** Heading level. Defaults to `p`; use h2/h3 where the page has a real hierarchy. */\n as?: 'h2' | 'h3' | 'h4' | 'p';\n}\n\nexport function CardTitle({ children, size = 'md', as: Tag = 'p', className, ...rest }: CardTitleProps) {\n return (\n <Tag\n data-slot=\"card-title\"\n // min-w-0 belongs here, not on the parent: a grid item defaults to\n // min-width:auto, so `truncate` on a title would not work without it.\n className={cn('min-w-0 font-semibold text-default', TITLE_SIZE[size], className)}\n {...rest}\n >\n {children}\n </Tag>\n );\n}\n\nexport interface CardDescriptionProps extends HTMLAttributes<HTMLParagraphElement> {\n children: ReactNode;\n /** Overrides the size inherited from the enclosing `CardHeader`. */\n size?: CardSize;\n}\n\nexport function CardDescription({ children, size, className, ...rest }: CardDescriptionProps) {\n const inherited = useContext(CardHeaderContext);\n\n return (\n <p\n data-slot=\"card-description\"\n className={cn(\n 'min-w-0 text-default-secondary',\n DESCRIPTION_SIZE[size ?? inherited],\n className,\n )}\n {...rest}\n >\n {children}\n </p>\n );\n}\n\nexport interface CardActionProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n}\n\n/** Right-hand slot in a `CardHeader` — a button, a count, a status badge, a menu. */\nexport function CardAction({ children, className, ...rest }: CardActionProps) {\n return (\n <div\n data-slot=\"card-action\"\n className={cn('col-start-2 row-span-2 row-start-1 shrink-0 self-center justify-self-end', className)}\n {...rest}\n >\n {children}\n </div>\n );\n}\n\n// ── CardBody ───────────────────────────────────────────────────────────────────\n\nexport interface CardBodyProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n size?: CardSize;\n}\n\n/**\n * The content region. A vertical stack by default.\n *\n * Because this file uses `cn`, `className` genuinely overrides the base — so\n * `className=\"flex-row items-center\"` gives you a row, and\n * `className=\"grid grid-cols-3\"` a grid. That is what makes the `AlertCard` and\n * `BenchmarkCard` rebuilds possible without a `layout` prop.\n */\nexport function CardBody({ children, size = 'md', className, ...rest }: CardBodyProps) {\n return (\n <div data-slot=\"card-body\" className={cn('flex flex-col', BODY_BOX[size], className)} {...rest}>\n {children}\n </div>\n );\n}\n\n// ── CardFooter ─────────────────────────────────────────────────────────────────\n\nexport interface CardFooterProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n size?: CardSize;\n divider?: boolean;\n align?: CardFooterAlign;\n}\n\n/** Action row at the foot of a card. Mirrors `ModalFooter` and `Drawer`'s footer. */\nexport function CardFooter({\n children,\n size = 'md',\n divider = true,\n align = 'end',\n className,\n ...rest\n}: CardFooterProps) {\n return (\n <div\n data-slot=\"card-footer\"\n className={cn(\n 'flex items-center gap-2',\n BOX[size],\n FOOTER_ALIGN[align],\n divider && 'border-t border-default',\n className,\n )}\n {...rest}\n >\n {children}\n </div>\n );\n}\n","import { createContext, forwardRef, useContext, type HTMLAttributes, type ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { Accordion as AccordionPrimitive } from 'radix-ui';\nimport { ChevronDownIcon } from 'lucide-react';\nimport { cn } from '../../lib/cn';\nimport { FOCUS_RING } from '../../lib/focus-ring';\n\nexport type AccordionType = 'single' | 'multiple';\n\nconst HeadingLevel = createContext<2 | 3 | 4>(3);\n\n/** One section as data. New in 0.8.0. */\nexport interface AccordionItemDef {\n value: string;\n /** The trigger text. */\n label: ReactNode;\n content: ReactNode;\n disabled?: boolean;\n hidden?: boolean;\n}\n\nexport interface AccordionProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue' | 'dir'> {\n /** The parts: `AccordionItem`s. Omit when passing `items`. */\n children?: ReactNode;\n /**\n * The sections as data, each rendered as an `AccordionItem` with its trigger and content.\n * New in 0.8.0. Use it or `children`, not both.\n */\n items?: readonly AccordionItemDef[];\n /** `single` closes the open item when another opens. Default `single`. */\n type?: AccordionType;\n /** Open item value(s) — a string for `single`, an array for `multiple`. */\n value?: string | string[];\n defaultValue?: string | string[];\n onValueChange?: (value: string | string[]) => void;\n /** Allow closing the open item in `single` mode. Default `true`. */\n collapsible?: boolean;\n /**\n * Heading level for each item's trigger. Default `3`.\n *\n * Each trigger is wrapped in a real heading, per the APG, so the accordion appears in\n * the document outline and a screen reader can jump between sections by heading. The\n * right level depends on what surrounds it, which only the caller knows.\n */\n headingLevel?: 2 | 3 | 4;\n disabled?: boolean;\n}\n\n/**\n * Accordion. Matches Figma's `Accordion` / `Accordion Item` (`State: Closed | Open`).\n *\n * Width is deliberately not set — Figma's own note on `Accordion Item` says the 640px in\n * the component set is a container artefact and the parent should own width, so this is\n * `w-full` and nothing more.\n *\n * Built on Radix Accordion from 0.7.0. The contract is unchanged: real headings, triggers with\n * `aria-expanded` / `aria-controls`, labelled `region` panels, Up/Down/Home/End between\n * triggers, and closed panels unmounted so they are not tabbable. New: your handlers on the\n * trigger compose with the toggle, every part forwards its ref, each part carries\n * `data-state`, and open content exposes `--radix-accordion-content-height` for animation.\n */\nexport const Accordion = forwardRef<HTMLDivElement, AccordionProps>(function Accordion(\n {\n children: childrenProp,\n items,\n type = 'single',\n value,\n defaultValue,\n onValueChange,\n collapsible = true,\n headingLevel = 3,\n disabled,\n className,\n ...rest\n },\n ref,\n) {\n const children = items\n ? items\n .filter((item) => !item.hidden)\n .map((item) => (\n <AccordionItem key={item.value} value={item.value} disabled={item.disabled}>\n <AccordionTrigger>{item.label}</AccordionTrigger>\n <AccordionContent>{item.content}</AccordionContent>\n </AccordionItem>\n ))\n : childrenProp;\n\n const shared = {\n ref,\n disabled,\n 'data-slot': 'accordion',\n className: cn('w-full', className),\n ...rest,\n };\n\n const root =\n type === 'multiple' ? (\n <AccordionPrimitive.Root\n type=\"multiple\"\n value={value === undefined ? undefined : toArray(value)}\n defaultValue={defaultValue === undefined ? undefined : toArray(defaultValue)}\n onValueChange={onValueChange as ((value: string[]) => void) | undefined}\n {...shared}\n >\n {children}\n </AccordionPrimitive.Root>\n ) : (\n <AccordionPrimitive.Root\n type=\"single\"\n collapsible={collapsible}\n value={value === undefined ? undefined : toSingle(value)}\n defaultValue={defaultValue === undefined ? undefined : toSingle(defaultValue)}\n onValueChange={onValueChange as ((value: string) => void) | undefined}\n {...shared}\n >\n {children}\n </AccordionPrimitive.Root>\n );\n\n return <HeadingLevel.Provider value={headingLevel}>{root}</HeadingLevel.Provider>;\n});\n\nconst toArray = (value: string | string[]) => (Array.isArray(value) ? value : value ? [value] : []);\nconst toSingle = (value: string | string[]) => (Array.isArray(value) ? (value[0] ?? '') : value);\n\nexport interface AccordionItemProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n value: string;\n disabled?: boolean;\n}\n\nexport const AccordionItem = forwardRef<HTMLDivElement, AccordionItemProps>(function AccordionItem(\n { className, ...rest },\n ref,\n) {\n return (\n <AccordionPrimitive.Item\n ref={ref}\n data-slot=\"accordion-item\"\n className={cn('border-b border-default last:border-b-0', className)}\n {...rest}\n />\n );\n});\n\nexport interface AccordionTriggerProps extends HTMLAttributes<HTMLButtonElement> {\n children: ReactNode;\n /** Hide the chevron — for a trigger that supplies its own affordance. */\n hideIndicator?: boolean;\n}\n\nexport const AccordionTrigger = forwardRef<HTMLButtonElement, AccordionTriggerProps>(\n function AccordionTrigger({ children, hideIndicator = false, className, ...rest }, ref) {\n const level = useContext(HeadingLevel);\n const Heading = `h${level}` as 'h3';\n\n return (\n // The heading carries no styling of its own — it exists so the accordion shows up in\n // the document outline, which is how screen reader users navigate between sections.\n <AccordionPrimitive.Header asChild>\n <Heading className=\"m-0\">\n <AccordionPrimitive.Trigger\n ref={ref}\n className={cn(\n 'group flex w-full items-center justify-between gap-3 py-4 text-left',\n 'text-body-sm font-semibold text-default transition-colors',\n 'hover:text-brand',\n FOCUS_RING,\n 'disabled:cursor-not-allowed disabled:text-disabled',\n className,\n )}\n {...rest}\n >\n <span className=\"min-w-0 flex-1\">{children}</span>\n {!hideIndicator && (\n <ChevronDownIcon\n aria-hidden\n className={clsx(\n 'size-4 shrink-0 text-icon-default-secondary transition-transform motion-reduce:transition-none',\n 'group-data-[state=open]:rotate-180',\n )}\n />\n )}\n </AccordionPrimitive.Trigger>\n </Heading>\n </AccordionPrimitive.Header>\n );\n },\n);\n\nexport interface AccordionContentProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n}\n\n/**\n * Unmounted while closed rather than height-collapsed: a `height: 0` panel keeps its content\n * focusable and announceable, so keyboard users would tab into a closed section.\n */\nexport const AccordionContent = forwardRef<HTMLDivElement, AccordionContentProps>(\n function AccordionContent({ className, ...rest }, ref) {\n return (\n <AccordionPrimitive.Content\n ref={ref}\n data-slot=\"accordion-content\"\n className={cn('pb-4 text-body-sm text-default-secondary', className)}\n {...rest}\n />\n );\n },\n);\n","import {\n createContext,\n forwardRef,\n useContext,\n useId,\n type HTMLAttributes,\n type ReactNode,\n} from 'react';\nimport { Collapsible as CollapsiblePrimitive } from 'radix-ui';\nimport { useControllableState } from '../../lib/use-controllable-state';\n\n/**\n * The trigger's id, so the panel can be a region labelled by it (Radix gives it no role), and\n * the open state, which `keepMounted` needs: Radix's own `forceMount` renders the content\n * visibly while closed, because it is meant for animation libraries that hide it themselves.\n */\nconst CollapsibleState = createContext<{ triggerId: string; open: boolean } | null>(null);\n\nexport interface CollapsibleProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n disabled?: boolean;\n}\n\n/**\n * A show/hide region with a trigger. The single-item primitive behind `Accordion`.\n *\n * The whole point is the wiring, which is easy to get wrong by hand: the trigger needs\n * `aria-expanded` and `aria-controls`, the panel needs an id and a matching\n * `aria-labelledby`, and the panel must be genuinely removed from the accessibility tree\n * when closed — `height: 0` with `overflow: hidden` leaves its content focusable and\n * announceable, so a keyboard user tabs into a collapsed section.\n *\n * Built on Radix Collapsible from 0.7.0: your `onClick` on the trigger now runs alongside the\n * toggle instead of replacing it, every part forwards its ref, and the open content exposes\n * `--radix-collapsible-content-height` for a height animation. Each part carries\n * `data-state=\"open\" | \"closed\"`.\n */\nexport const Collapsible = forwardRef<HTMLDivElement, CollapsibleProps>(function Collapsible(\n { children, open: openProp, defaultOpen = false, onOpenChange, disabled, ...rest },\n ref,\n) {\n const triggerId = useId();\n const [open, setOpen] = useControllableState({\n value: openProp,\n defaultValue: defaultOpen,\n onChange: onOpenChange,\n });\n return (\n <CollapsiblePrimitive.Root\n ref={ref}\n open={open}\n onOpenChange={setOpen}\n disabled={disabled}\n data-slot=\"collapsible\"\n {...rest}\n >\n <CollapsibleState.Provider value={{ triggerId, open }}>{children}</CollapsibleState.Provider>\n </CollapsiblePrimitive.Root>\n );\n});\n\nexport interface CollapsibleTriggerProps extends HTMLAttributes<HTMLButtonElement> {\n children?: ReactNode;\n asChild?: boolean;\n}\n\nexport const CollapsibleTrigger = forwardRef<HTMLButtonElement, CollapsibleTriggerProps>(\n function CollapsibleTrigger(props, ref) {\n const state = useContext(CollapsibleState);\n return <CollapsiblePrimitive.Trigger ref={ref} id={state?.triggerId} {...props} />;\n },\n);\n\nexport interface CollapsibleContentProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n /**\n * Keep the content mounted while closed, hidden with `hidden`. Default `false`.\n *\n * `hidden` — not `height: 0` — is what keeps hidden content out of the tab sequence and\n * the accessibility tree, so this stays safe. Use it to preserve form state or scroll\n * position across collapses.\n */\n keepMounted?: boolean;\n}\n\nexport const CollapsibleContent = forwardRef<HTMLDivElement, CollapsibleContentProps>(\n function CollapsibleContent({ keepMounted = false, ...rest }, ref) {\n const state = useContext(CollapsibleState);\n return (\n <CollapsiblePrimitive.Content\n ref={ref}\n forceMount={keepMounted || undefined}\n role=\"region\"\n aria-labelledby={state?.triggerId}\n {...(keepMounted ? { hidden: !state?.open } : {})}\n {...rest}\n />\n );\n },\n);\n","import { forwardRef, type CSSProperties, type HTMLAttributes, type ReactNode } from 'react';\nimport { cn } from '../../lib/cn';\nimport { Slot } from '../../lib/slot';\n\n/**\n * Layout primitives, new in 0.7.0: `Box`, `Flex`, `Grid`, `Container` and `Section`, the Radix\n * Themes layout set.\n *\n * Each is a thin, typed wrapper over the Tailwind utilities a page would otherwise hand-write.\n * Spacing props take the Figma spacing tokens by name (`gap=\"400\"` is 16px), so layout uses the\n * same scale as the components inside it and an arbitrary `gap-[13px]` has nowhere to go. All of\n * them take `asChild` to lay out an element of your own (a `<ul>`, a `<form>`, a `<main>`) and\n * merge `className` with `cn`, so a class you pass wins.\n *\n * The class maps below are written out literally on purpose: Tailwind only generates classes\n * that appear verbatim in source, so building them with template strings would emit no CSS.\n */\n\n/** A Figma spacing step, by name: `100` is 4px, `400` is 16px, `1600` is 64px. */\nexport type SpaceToken = '0' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '1000' | '1200' | '1600';\n\nconst GAP: Record<SpaceToken, string> = {\n '0': 'gap-0',\n '100': 'gap-100',\n '200': 'gap-200',\n '300': 'gap-300',\n '400': 'gap-400',\n '500': 'gap-500',\n '600': 'gap-600',\n '700': 'gap-700',\n '800': 'gap-800',\n '1000': 'gap-1000',\n '1200': 'gap-1200',\n '1600': 'gap-1600',\n};\nconst GAP_X: Record<SpaceToken, string> = {\n '0': 'gap-x-0',\n '100': 'gap-x-100',\n '200': 'gap-x-200',\n '300': 'gap-x-300',\n '400': 'gap-x-400',\n '500': 'gap-x-500',\n '600': 'gap-x-600',\n '700': 'gap-x-700',\n '800': 'gap-x-800',\n '1000': 'gap-x-1000',\n '1200': 'gap-x-1200',\n '1600': 'gap-x-1600',\n};\nconst GAP_Y: Record<SpaceToken, string> = {\n '0': 'gap-y-0',\n '100': 'gap-y-100',\n '200': 'gap-y-200',\n '300': 'gap-y-300',\n '400': 'gap-y-400',\n '500': 'gap-y-500',\n '600': 'gap-y-600',\n '700': 'gap-y-700',\n '800': 'gap-y-800',\n '1000': 'gap-y-1000',\n '1200': 'gap-y-1200',\n '1600': 'gap-y-1600',\n};\nconst PAD: Record<SpaceToken, string> = {\n '0': 'p-0',\n '100': 'p-100',\n '200': 'p-200',\n '300': 'p-300',\n '400': 'p-400',\n '500': 'p-500',\n '600': 'p-600',\n '700': 'p-700',\n '800': 'p-800',\n '1000': 'p-1000',\n '1200': 'p-1200',\n '1600': 'p-1600',\n};\nconst PAD_X: Record<SpaceToken, string> = {\n '0': 'px-0',\n '100': 'px-100',\n '200': 'px-200',\n '300': 'px-300',\n '400': 'px-400',\n '500': 'px-500',\n '600': 'px-600',\n '700': 'px-700',\n '800': 'px-800',\n '1000': 'px-1000',\n '1200': 'px-1200',\n '1600': 'px-1600',\n};\nconst PAD_Y: Record<SpaceToken, string> = {\n '0': 'py-0',\n '100': 'py-100',\n '200': 'py-200',\n '300': 'py-300',\n '400': 'py-400',\n '500': 'py-500',\n '600': 'py-600',\n '700': 'py-700',\n '800': 'py-800',\n '1000': 'py-1000',\n '1200': 'py-1200',\n '1600': 'py-1600',\n};\n\ninterface LayoutBaseProps extends HTMLAttributes<HTMLElement> {\n children?: ReactNode;\n /** Lay out your own single child element instead of a `<div>`. */\n asChild?: boolean;\n /** Padding on every side, as a spacing token. */\n p?: SpaceToken;\n /** Horizontal padding, as a spacing token. */\n px?: SpaceToken;\n /** Vertical padding, as a spacing token. */\n py?: SpaceToken;\n}\n\nfunction padding({ p, px, py }: Pick<LayoutBaseProps, 'p' | 'px' | 'py'>) {\n return [p && PAD[p], px && PAD_X[px], py && PAD_Y[py]];\n}\n\nfunction rootElement(asChild: boolean | undefined, fallback: 'div' | 'section') {\n return (asChild ? Slot : fallback) as 'div';\n}\n\n// ── Box ────────────────────────────────────────────────────────────────────────\n\nexport type BoxProps = LayoutBaseProps;\n\n/** A plain block with token padding. The base the others build on. */\nexport const Box = forwardRef<HTMLDivElement, BoxProps>(function Box(\n { asChild, p, px, py, className, ...rest },\n ref,\n) {\n const Root = rootElement(asChild, 'div');\n return <Root ref={ref} className={cn(padding({ p, px, py }), className)} {...rest} />;\n});\n\n// ── Flex ───────────────────────────────────────────────────────────────────────\n\nexport type FlexDirection = 'row' | 'column' | 'row-reverse' | 'column-reverse';\nexport type FlexAlign = 'start' | 'center' | 'end' | 'baseline' | 'stretch';\nexport type FlexJustify = 'start' | 'center' | 'end' | 'between' | 'around';\n\nconst DIRECTION: Record<FlexDirection, string> = {\n row: 'flex-row',\n column: 'flex-col',\n 'row-reverse': 'flex-row-reverse',\n 'column-reverse': 'flex-col-reverse',\n};\n\nconst ALIGN: Record<FlexAlign, string> = {\n start: 'items-start',\n center: 'items-center',\n end: 'items-end',\n baseline: 'items-baseline',\n stretch: 'items-stretch',\n};\n\nconst JUSTIFY: Record<FlexJustify, string> = {\n start: 'justify-start',\n center: 'justify-center',\n end: 'justify-end',\n between: 'justify-between',\n around: 'justify-around',\n};\n\nexport interface FlexProps extends LayoutBaseProps {\n /** Default `row`. */\n direction?: FlexDirection;\n align?: FlexAlign;\n justify?: FlexJustify;\n gap?: SpaceToken;\n /** Let items wrap onto new lines. */\n wrap?: boolean;\n /** `inline-flex` instead of `flex`. */\n inline?: boolean;\n}\n\n/** A flex row or column with token gaps. */\nexport const Flex = forwardRef<HTMLDivElement, FlexProps>(function Flex(\n { asChild, direction = 'row', align, justify, gap, wrap, inline, p, px, py, className, ...rest },\n ref,\n) {\n const Root = rootElement(asChild, 'div');\n return (\n <Root\n ref={ref}\n className={cn(\n inline ? 'inline-flex' : 'flex',\n DIRECTION[direction],\n align && ALIGN[align],\n justify && JUSTIFY[justify],\n gap && GAP[gap],\n wrap && 'flex-wrap',\n padding({ p, px, py }),\n className,\n )}\n {...rest}\n />\n );\n});\n\n// ── Grid ───────────────────────────────────────────────────────────────────────\n\nexport type GridColumnCount = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;\nexport type GridBreakpoint = 'base' | 'sm' | 'md' | 'lg' | 'xl';\n\nconst COLUMNS: Record<GridBreakpoint, Record<GridColumnCount, string>> = {\n base: {\n 1: 'grid-cols-1',\n 2: 'grid-cols-2',\n 3: 'grid-cols-3',\n 4: 'grid-cols-4',\n 5: 'grid-cols-5',\n 6: 'grid-cols-6',\n 7: 'grid-cols-7',\n 8: 'grid-cols-8',\n 9: 'grid-cols-9',\n 10: 'grid-cols-10',\n 11: 'grid-cols-11',\n 12: 'grid-cols-12',\n },\n sm: {\n 1: 'sm:grid-cols-1',\n 2: 'sm:grid-cols-2',\n 3: 'sm:grid-cols-3',\n 4: 'sm:grid-cols-4',\n 5: 'sm:grid-cols-5',\n 6: 'sm:grid-cols-6',\n 7: 'sm:grid-cols-7',\n 8: 'sm:grid-cols-8',\n 9: 'sm:grid-cols-9',\n 10: 'sm:grid-cols-10',\n 11: 'sm:grid-cols-11',\n 12: 'sm:grid-cols-12',\n },\n md: {\n 1: 'md:grid-cols-1',\n 2: 'md:grid-cols-2',\n 3: 'md:grid-cols-3',\n 4: 'md:grid-cols-4',\n 5: 'md:grid-cols-5',\n 6: 'md:grid-cols-6',\n 7: 'md:grid-cols-7',\n 8: 'md:grid-cols-8',\n 9: 'md:grid-cols-9',\n 10: 'md:grid-cols-10',\n 11: 'md:grid-cols-11',\n 12: 'md:grid-cols-12',\n },\n lg: {\n 1: 'lg:grid-cols-1',\n 2: 'lg:grid-cols-2',\n 3: 'lg:grid-cols-3',\n 4: 'lg:grid-cols-4',\n 5: 'lg:grid-cols-5',\n 6: 'lg:grid-cols-6',\n 7: 'lg:grid-cols-7',\n 8: 'lg:grid-cols-8',\n 9: 'lg:grid-cols-9',\n 10: 'lg:grid-cols-10',\n 11: 'lg:grid-cols-11',\n 12: 'lg:grid-cols-12',\n },\n xl: {\n 1: 'xl:grid-cols-1',\n 2: 'xl:grid-cols-2',\n 3: 'xl:grid-cols-3',\n 4: 'xl:grid-cols-4',\n 5: 'xl:grid-cols-5',\n 6: 'xl:grid-cols-6',\n 7: 'xl:grid-cols-7',\n 8: 'xl:grid-cols-8',\n 9: 'xl:grid-cols-9',\n 10: 'xl:grid-cols-10',\n 11: 'xl:grid-cols-11',\n 12: 'xl:grid-cols-12',\n },\n};\n\nexport interface GridProps extends LayoutBaseProps {\n /**\n * Column count, fixed or per breakpoint: `columns={3}` or\n * `columns={{ base: 1, md: 2, lg: 4 }}`.\n */\n columns?: GridColumnCount | Partial<Record<GridBreakpoint, GridColumnCount>>;\n /**\n * As many columns as fit, each at least this wide, e.g. `\"16rem\"`. Responds to the grid's own\n * width, not the viewport's, so it suits form fields and card lists inside panels of any size\n * (what SCIC's `FormGrid` did). Ignored when `columns` is set.\n */\n minColumnWidth?: string;\n gap?: SpaceToken;\n gapX?: SpaceToken;\n gapY?: SpaceToken;\n align?: FlexAlign;\n}\n\n/** A CSS grid with token gaps: fixed, responsive or auto-fitting columns. */\nexport const Grid = forwardRef<HTMLDivElement, GridProps>(function Grid(\n { asChild, columns, minColumnWidth, gap, gapX, gapY, align, p, px, py, className, style, ...rest },\n ref,\n) {\n const Root = rootElement(asChild, 'div');\n const columnClasses =\n columns === undefined\n ? []\n : typeof columns === 'number'\n ? [COLUMNS.base[columns]]\n : (Object.entries(columns) as [GridBreakpoint, GridColumnCount][]).map(\n ([breakpoint, count]) => COLUMNS[breakpoint][count],\n );\n // `min(100%, …)` keeps a single column from overflowing a container narrower than the minimum.\n const autoFit: CSSProperties | undefined =\n columns === undefined && minColumnWidth\n ? { gridTemplateColumns: `repeat(auto-fit, minmax(min(100%, ${minColumnWidth}), 1fr))` }\n : undefined;\n\n return (\n <Root\n ref={ref}\n className={cn(\n 'grid',\n columnClasses,\n gap && GAP[gap],\n gapX && GAP_X[gapX],\n gapY && GAP_Y[gapY],\n align && ALIGN[align],\n padding({ p, px, py }),\n className,\n )}\n style={autoFit ? { ...autoFit, ...style } : style}\n {...rest}\n />\n );\n});\n\n// ── Container ──────────────────────────────────────────────────────────────────\n\nexport type ContainerSize = 'sm' | 'md' | 'lg' | 'xl' | 'full';\n\nconst CONTAINER: Record<ContainerSize, string> = {\n sm: 'max-w-[640px]',\n md: 'max-w-[880px]',\n lg: 'max-w-[1136px]',\n xl: 'max-w-[1440px]',\n full: 'max-w-none',\n};\n\nexport interface ContainerProps extends LayoutBaseProps {\n /** Maximum content width. Default `lg` (1136px). */\n size?: ContainerSize;\n}\n\n/** Centres content at a maximum width, with a 16px side gutter by default. */\nexport const Container = forwardRef<HTMLDivElement, ContainerProps>(function Container(\n { asChild, size = 'lg', p, px = '400', py, className, ...rest },\n ref,\n) {\n const Root = rootElement(asChild, 'div');\n return (\n <Root\n ref={ref}\n className={cn('mx-auto w-full', CONTAINER[size], padding({ p, px, py }), className)}\n {...rest}\n />\n );\n});\n\n// ── Section ────────────────────────────────────────────────────────────────────\n\nexport type SectionSize = 'sm' | 'md' | 'lg';\n\nconst SECTION: Record<SectionSize, string> = {\n sm: 'py-600',\n md: 'py-1000',\n lg: 'py-1600',\n};\n\nexport interface SectionProps extends LayoutBaseProps {\n /** Vertical rhythm: 24, 40 or 64px above and below. Default `md`. */\n size?: SectionSize;\n}\n\n/**\n * A page band with vertical rhythm, rendered as a `<section>`. Give it a heading (or an\n * `aria-label`) when it should be a landmark; an unnamed `<section>` is announced as nothing at\n * all, which is the right default for a purely visual band.\n */\nexport const Section = forwardRef<HTMLElement, SectionProps>(function Section(\n { asChild, size = 'md', p, px, py, className, ...rest },\n ref,\n) {\n const Root = rootElement(asChild, 'section');\n return (\n <Root\n ref={ref as never}\n className={cn(SECTION[size], padding({ p, px, py }), className)}\n {...rest}\n />\n );\n});\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport clsx from 'clsx';\n\nexport interface AspectRatioProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n /** Width ÷ height. `16 / 9` for video, `1` for a square, `4 / 3` for a photo. Default `1`. */\n ratio?: number;\n}\n\n/**\n * Holds a fixed width-to-height ratio for its content.\n *\n * Uses the CSS `aspect-ratio` property rather than the old padding-top percentage hack, so\n * the child is a normal in-flow element instead of being absolutely positioned inside a\n * zero-height box. The ratio is an inline style because it is a per-instance numeric value —\n * a Tailwind class cannot express `16 / 9` without an arbitrary-value escape at every call\n * site.\n */\nexport const AspectRatio = forwardRef<HTMLDivElement, AspectRatioProps>(function AspectRatio(\n { children, ratio = 1, className, style, ...rest },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"aspect-ratio\"\n style={{ aspectRatio: ratio, ...style }}\n className={clsx('w-full overflow-hidden [&>*]:size-full [&>img]:object-cover', className)}\n {...rest}\n >\n {children}\n </div>\n );\n});\n","import {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from 'react';\nimport clsx from 'clsx';\nimport { composeEventHandlers } from '../../lib/compose-event-handlers';\nimport { ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';\nimport { IconButton } from '../forms/icon-button';\nimport { useControllableState } from '../../lib/use-controllable-state';\n\ninterface CarouselContextValue {\n index: number;\n setIndex: (index: number) => void;\n count: number;\n registerSlide: () => number;\n resetSlides: () => void;\n baseId: string;\n loop: boolean;\n paused: boolean;\n setPaused: (paused: boolean) => void;\n hasAutoplay: boolean;\n}\n\nconst CarouselContext = createContext<CarouselContextValue | null>(null);\n\nfunction useCarousel(part: string): CarouselContextValue {\n const value = useContext(CarouselContext);\n if (!value) throw new Error(`<${part}> must be used inside <Carousel>`);\n return value;\n}\n\nexport interface CarouselProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n /** Names the carousel region. Required — a nameless region is not navigable. */\n label: string;\n index?: number;\n defaultIndex?: number;\n onIndexChange?: (index: number) => void;\n /** Number of slides. Needed up front for the controls; `CarouselSlide` count is checked against it. */\n count: number;\n loop?: boolean;\n /** Advance every N ms. Omit for a manual carousel. */\n autoplayInterval?: number;\n}\n\n/**\n * A slide carousel.\n *\n * Carousels are one of the most reliably inaccessible patterns on the web, so the parts that\n * look like polish here are the requirements:\n *\n * - **`aria-roledescription=\"carousel\"`** on a named region, so it is announced as a carousel\n * rather than as an anonymous group of divs.\n * - **Slides are `role=\"group\"` with `aria-roledescription=\"slide\"` and an\n * \"N of M\" label** — position is otherwise invisible to anyone not seeing the dots.\n * - **Off-screen slides are `hidden`**, not merely translated out of view. A slide moved with\n * `transform` keeps its links in the tab order, so keyboard users tab into content they\n * cannot see. This is the single most common carousel bug.\n * - **Autoplay stops on hover, on focus, and permanently once the user takes control**, and\n * there is a visible pause button whenever autoplay is on — required by WCAG 2.2.2 for any\n * motion lasting more than five seconds.\n * - **`prefers-reduced-motion` disables autoplay entirely**, rather than just shortening the\n * transition.\n */\nexport function Carousel({\n children,\n label,\n index: indexProp,\n defaultIndex = 0,\n onIndexChange,\n count,\n loop = false,\n autoplayInterval,\n className,\n ...rest\n}: CarouselProps) {\n const [index, setIndex] = useControllableState({\n value: indexProp,\n defaultValue: defaultIndex,\n onChange: onIndexChange,\n });\n\n const baseId = useId();\n const cursor = useRef(0);\n const [paused, setPaused] = useState(false);\n const [userTookControl, setUserTookControl] = useState(false);\n\n const hasAutoplay = autoplayInterval !== undefined && autoplayInterval > 0;\n\n const context = useMemo<CarouselContextValue>(\n () => ({\n index,\n setIndex: (next) => {\n // Any deliberate move stops autoplay for good. Resuming after a user has navigated\n // yanks the content out from under them.\n setUserTookControl(true);\n setIndex(next);\n },\n count,\n registerSlide: () => cursor.current++,\n resetSlides: () => {\n cursor.current = 0;\n },\n baseId,\n loop,\n paused,\n setPaused,\n hasAutoplay,\n }),\n [index, setIndex, count, baseId, loop, paused, hasAutoplay],\n );\n\n context.resetSlides();\n\n useEffect(() => {\n if (!hasAutoplay || paused || userTookControl) return;\n // Autoplay is motion the user did not ask for, so it does not start at all when they\n // have asked for less of it.\n if (window.matchMedia?.('(prefers-reduced-motion: reduce)').matches) return;\n\n const timer = setInterval(() => {\n setIndex(index === count - 1 ? (loop ? 0 : index) : index + 1);\n }, autoplayInterval);\n return () => clearInterval(timer);\n }, [hasAutoplay, paused, userTookControl, autoplayInterval, index, count, loop, setIndex]);\n\n return (\n <CarouselContext.Provider value={context}>\n {/* The APG carousel pattern puts Left/Right on the region itself, so slides can be\n paged from anywhere inside without first tabbing to the controls. The region is not\n focusable and does not need to be — the keys arrive by bubbling from whatever inside\n it has focus. */}\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */}\n <div\n // `region` + roledescription is what makes this announce as a carousel.\n role=\"region\"\n aria-roledescription=\"carousel\"\n aria-label={label}\n data-slot=\"carousel\"\n className={clsx('relative', className)}\n {...rest}\n onPointerEnter={composeEventHandlers(rest.onPointerEnter, () => hasAutoplay && setPaused(true))}\n onPointerLeave={composeEventHandlers(rest.onPointerLeave, () => hasAutoplay && setPaused(false))}\n onFocus={composeEventHandlers(rest.onFocus, () => hasAutoplay && setPaused(true))}\n onBlur={composeEventHandlers(rest.onBlur, (event) => {\n if (hasAutoplay && !event.currentTarget.contains(event.relatedTarget as Node)) {\n setPaused(false);\n }\n })}\n onKeyDown={composeEventHandlers(rest.onKeyDown, (event) => {\n if (event.key === 'ArrowLeft') {\n event.preventDefault();\n context.setIndex(index === 0 ? (loop ? count - 1 : 0) : index - 1);\n }\n if (event.key === 'ArrowRight') {\n event.preventDefault();\n context.setIndex(index === count - 1 ? (loop ? 0 : index) : index + 1);\n }\n })}\n >\n {children}\n </div>\n </CarouselContext.Provider>\n );\n}\n\nexport interface CarouselViewportProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n}\n\nexport function CarouselViewport({ children, className, ...rest }: CarouselViewportProps) {\n const carousel = useCarousel('CarouselViewport');\n return (\n <div\n id={`${carousel.baseId}-viewport`}\n data-slot=\"carousel-viewport\"\n className={clsx('overflow-hidden', className)}\n {...rest}\n >\n {children}\n </div>\n );\n}\n\nexport interface CarouselSlideProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n}\n\nexport function CarouselSlide({ children, className, ...rest }: CarouselSlideProps) {\n const carousel = useCarousel('CarouselSlide');\n const slideIndex = carousel.registerSlide();\n const active = slideIndex === carousel.index;\n\n return (\n <div\n role=\"group\"\n aria-roledescription=\"slide\"\n // Position stated explicitly — without it, only the dots convey where you are.\n aria-label={`${slideIndex + 1} of ${carousel.count}`}\n // `hidden`, not a transform. An off-screen slide that is merely translated keeps its\n // links focusable, so Tab walks into invisible content.\n hidden={!active}\n data-slot=\"carousel-slide\"\n className={className}\n {...rest}\n >\n {children}\n </div>\n );\n}\n\nexport interface CarouselControlsProps extends HTMLAttributes<HTMLDivElement> {\n /** Show the dot indicators. Default `true`. */\n showDots?: boolean;\n}\n\nexport function CarouselControls({ showDots = true, className, ...rest }: CarouselControlsProps) {\n const carousel = useCarousel('CarouselControls');\n const { index, count, loop } = carousel;\n\n const go = useCallback(\n (next: number) => {\n const wrapped = ((next % count) + count) % count;\n carousel.setIndex(loop ? wrapped : Math.min(Math.max(next, 0), count - 1));\n },\n [carousel, count, loop],\n );\n\n return (\n <div\n className={clsx('mt-3 flex items-center justify-between gap-3', className)}\n {...rest}\n >\n <IconButton\n variant=\"neutral\"\n size=\"sm\"\n aria-label=\"Previous slide\"\n aria-controls={`${carousel.baseId}-viewport`}\n disabled={!loop && index === 0}\n onClick={() => go(index - 1)}\n >\n <ChevronLeftIcon aria-hidden size={16} />\n </IconButton>\n\n {showDots && (\n <div role=\"group\" aria-label={`Slide ${index + 1} of ${count}`} className=\"flex items-center gap-2\">\n {Array.from({ length: count }, (_, i) => (\n <button\n key={i}\n type=\"button\"\n aria-label={`Go to slide ${i + 1}`}\n aria-current={i === index ? 'true' : undefined}\n onClick={() => go(i)}\n className={clsx(\n 'size-2 rounded-full transition-colors',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-2 focus-visible:ring-offset-default',\n i === index ? 'bg-brand' : 'bg-default-tertiary hover:bg-neutral-secondary',\n )}\n />\n ))}\n </div>\n )}\n\n <div className=\"flex items-center gap-1.5\">\n {/* Required by WCAG 2.2.2 whenever autoplay is on: any motion lasting more than five\n seconds needs a visible, keyboard-reachable way to stop it. */}\n {carousel.hasAutoplay && (\n <IconButton\n variant=\"neutral\"\n size=\"sm\"\n aria-label={carousel.paused ? 'Start automatic slide show' : 'Stop automatic slide show'}\n onClick={() => carousel.setPaused(!carousel.paused)}\n >\n <span aria-hidden className=\"text-body-tiny font-semibold\">\n {carousel.paused ? '▶' : '❚❚'}\n </span>\n </IconButton>\n )}\n <IconButton\n variant=\"neutral\"\n size=\"sm\"\n aria-label=\"Next slide\"\n aria-controls={`${carousel.baseId}-viewport`}\n disabled={!loop && index === count - 1}\n onClick={() => go(index + 1)}\n >\n <ChevronRightIcon aria-hidden size={16} />\n </IconButton>\n </div>\n </div>\n );\n}\n","import {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from 'react';\nimport { ScrollArea } from './scroll-area';\nimport clsx from 'clsx';\nimport { composeEventHandlers } from '../../lib/compose-event-handlers';\nimport { useControllableState } from '../../lib/use-controllable-state';\n\nexport type ResizableDirection = 'horizontal' | 'vertical';\n\ninterface ResizableContextValue {\n direction: ResizableDirection;\n /** First pane's size, as a percentage of the container. */\n size: number;\n setSize: (size: number) => void;\n min: number;\n max: number;\n containerRef: React.RefObject<HTMLDivElement | null>;\n baseId: string;\n dragging: boolean;\n setDragging: (dragging: boolean) => void;\n}\n\nconst ResizableContext = createContext<ResizableContextValue | null>(null);\n\nfunction useResizable(part: string): ResizableContextValue {\n const value = useContext(ResizableContext);\n if (!value) throw new Error(`<${part}> must be used inside <Resizable>`);\n return value;\n}\n\nexport interface ResizableProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n direction?: ResizableDirection;\n /** First pane's size as a percentage. Controlled. */\n size?: number;\n defaultSize?: number;\n onSizeChange?: (size: number) => void;\n /** Percentage bounds. Defaults `10` and `90`. */\n min?: number;\n max?: number;\n}\n\n/**\n * Two resizable panes with a draggable divider.\n *\n * This is the APG **window splitter** pattern, and the handle is the whole component as far\n * as accessibility goes. A `<div>` with pointer listeners — the usual implementation — is\n * completely unusable without a mouse. `ResizableHandle` is therefore a real focusable\n * control with:\n *\n * - `role=\"separator\"` plus `aria-valuenow`/`valuemin`/`valuemax`, so the current split is\n * announced as a percentage rather than being invisible;\n * - `tabIndex={0}` and arrow keys to move it in 1% steps, Shift+arrow in 10%, Home/End to\n * the bounds, and Enter to collapse and restore;\n * - `aria-controls` pointing at the pane it resizes.\n *\n * Sizes are percentages, not pixels, so the split survives a container resize — a pixel\n * split silently becomes wrong the moment the window changes.\n */\nexport function Resizable({\n children,\n direction = 'horizontal',\n size: sizeProp,\n defaultSize = 50,\n onSizeChange,\n min = 10,\n max = 90,\n className,\n ...rest\n}: ResizableProps) {\n const [size, setSize] = useControllableState({\n value: sizeProp,\n defaultValue: defaultSize,\n onChange: onSizeChange,\n });\n\n const containerRef = useRef<HTMLDivElement>(null);\n const baseId = useId();\n const [dragging, setDragging] = useState(false);\n\n const context = useMemo<ResizableContextValue>(\n () => ({\n direction,\n size,\n setSize: (next) => setSize(Math.min(Math.max(next, min), max)),\n min,\n max,\n containerRef,\n baseId,\n dragging,\n setDragging,\n }),\n [direction, size, setSize, min, max, baseId, dragging],\n );\n\n return (\n <ResizableContext.Provider value={context}>\n <div\n ref={containerRef}\n data-slot=\"resizable\"\n className={clsx(\n 'flex w-full',\n direction === 'horizontal' ? 'flex-row' : 'flex-col',\n // While dragging, suppress selection and pointer events inside the panes so the\n // gesture cannot start selecting text or hovering things it passes over.\n dragging && 'select-none [&_*]:pointer-events-none',\n className,\n )}\n {...rest}\n >\n {children}\n </div>\n </ResizableContext.Provider>\n );\n}\n\nexport interface ResizablePanelProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n /** `first` is the pane the handle sizes; `second` fills the remainder. */\n which: 'first' | 'second';\n}\n\nexport function ResizablePanel({ children, which, className, ...rest }: ResizablePanelProps) {\n const ctx = useResizable('ResizablePanel');\n const axis = ctx.direction === 'horizontal' ? 'width' : 'height';\n\n return (\n // A panel holds arbitrary content, which may be entirely static — so it needs the tab\n // stop `ScrollArea` adds while overflowing, not just the scrollbar styling.\n <ScrollArea\n axis=\"both\"\n id={which === 'first' ? `${ctx.baseId}-first` : `${ctx.baseId}-second`}\n data-slot=\"resizable-panel\"\n style={which === 'first' ? { [axis]: `${ctx.size}%` } : { flex: '1 1 0%' }}\n className={clsx('min-h-0 min-w-0', className)}\n {...rest}\n >\n {children}\n </ScrollArea>\n );\n}\n\nexport interface ResizableHandleProps extends HTMLAttributes<HTMLDivElement> {\n /** Names the splitter. Default `Resize panels`. */\n label?: string;\n /** Show the grip dots. Default `true`. */\n withGrip?: boolean;\n}\n\nexport function ResizableHandle({\n label = 'Resize panels',\n withGrip = true,\n className,\n ...rest\n}: ResizableHandleProps) {\n const ctx = useResizable('ResizableHandle');\n const horizontal = ctx.direction === 'horizontal';\n const collapsedFrom = useRef<number | null>(null);\n\n const fromPointer = useCallback(\n (clientX: number, clientY: number) => {\n const container = ctx.containerRef.current;\n if (!container) return;\n const rect = container.getBoundingClientRect();\n const ratio = horizontal\n ? (clientX - rect.left) / rect.width\n : (clientY - rect.top) / rect.height;\n ctx.setSize(ratio * 100);\n },\n [ctx, horizontal],\n );\n\n useEffect(() => {\n if (!ctx.dragging) return;\n\n const onMove = (event: PointerEvent) => fromPointer(event.clientX, event.clientY);\n const onUp = () => ctx.setDragging(false);\n\n // Listeners on the window, not the handle: the pointer routinely leaves the 8px handle\n // mid-drag, and a handle-scoped listener would drop the gesture.\n window.addEventListener('pointermove', onMove);\n window.addEventListener('pointerup', onUp);\n window.addEventListener('pointercancel', onUp);\n return () => {\n window.removeEventListener('pointermove', onMove);\n window.removeEventListener('pointerup', onUp);\n window.removeEventListener('pointercancel', onUp);\n };\n }, [ctx, fromPointer]);\n\n return (\n // A *focusable* separator is the APG window-splitter pattern, and the whole point of this\n // component: without the tab stop and the arrow keys below, a split view can only be\n // resized with a mouse. ARIA explicitly allows a focusable separator, which is what\n // carries `aria-valuenow`; jsx-a11y models `separator` as always non-interactive.\n // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex, jsx-a11y/no-noninteractive-element-interactions\n <div\n role=\"separator\"\n // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex\n tabIndex={0}\n aria-label={label}\n aria-orientation={horizontal ? 'vertical' : 'horizontal'}\n aria-valuenow={Math.round(ctx.size)}\n aria-valuemin={ctx.min}\n aria-valuemax={ctx.max}\n aria-controls={`${ctx.baseId}-first`}\n data-slot=\"resizable-handle\"\n {...rest}\n onPointerDown={composeEventHandlers(rest.onPointerDown, (event) => {\n event.preventDefault();\n ctx.setDragging(true);\n })}\n onKeyDown={composeEventHandlers(rest.onKeyDown, (event) => {\n const step = event.shiftKey ? 10 : 1;\n const decrease = horizontal ? 'ArrowLeft' : 'ArrowUp';\n const increase = horizontal ? 'ArrowRight' : 'ArrowDown';\n\n if (event.key === decrease) {\n event.preventDefault();\n ctx.setSize(ctx.size - step);\n } else if (event.key === increase) {\n event.preventDefault();\n ctx.setSize(ctx.size + step);\n } else if (event.key === 'Home') {\n event.preventDefault();\n ctx.setSize(ctx.min);\n } else if (event.key === 'End') {\n event.preventDefault();\n ctx.setSize(ctx.max);\n } else if (event.key === 'Enter') {\n // Collapse/restore, so the splitter is useful without dragging at all.\n event.preventDefault();\n if (collapsedFrom.current === null) {\n collapsedFrom.current = ctx.size;\n ctx.setSize(ctx.min);\n } else {\n ctx.setSize(collapsedFrom.current);\n collapsedFrom.current = null;\n }\n }\n })}\n className={clsx(\n 'group relative flex shrink-0 items-center justify-center bg-divider transition-colors',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand',\n 'hover:bg-brand-tertiary',\n horizontal ? 'w-px cursor-col-resize' : 'h-px cursor-row-resize',\n className,\n )}\n \n >\n {/* An invisible padded hit area, so the 1px rule is grabbable without being 8px of\n visible chrome. */}\n <span\n aria-hidden\n className={clsx('absolute', horizontal ? 'inset-y-0 -inset-x-1.5' : '-inset-y-1.5 inset-x-0')}\n />\n {withGrip && (\n <span\n aria-hidden\n className={clsx(\n 'relative z-raised flex items-center justify-center rounded-full border border-default bg-default',\n 'opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100',\n horizontal ? 'h-6 w-2.5' : 'h-2.5 w-6',\n )}\n >\n <span className={clsx('rounded-full bg-default-tertiary', horizontal ? 'h-2.5 w-px' : 'h-px w-2.5')} />\n </span>\n )}\n </div>\n );\n}\n","import clsx from 'clsx';\nimport type { ReactNode } from 'react';\n\n/**\n * Two genuinely different heading contexts, which the source markup distinguished:\n *\n * `page` 24px title / 14px subtitle — an in-body page heading (settings, users,\n * alerts), i.e. the old `text-2xl` + `mt-1 text-body-sm` block.\n * `toolbar` 20px title / 13px subtitle — inside a `PageToolbar`, where the bar is\n * only 72px tall. Flattening these into one size would have grown ten\n * toolbar titles by 4px.\n * `section` 18px — a panel or card heading.\n */\nexport type PageHeadingSize = 'page' | 'toolbar' | 'section';\n\nconst TITLE: Record<PageHeadingSize, string> = {\n // `text-2xl` was stock Tailwind rather than the design tokens. Same 24px, now on-token.\n page: 'text-heading font-semibold text-default',\n toolbar: 'text-heading-sm font-semibold leading-snug text-default',\n // Was `text-lg` — stock Tailwind's 18px, off the type scale. Snapped DOWN to 16 rather\n // than up to 20, because 20 is already `toolbar`: rounding up would have made two of the\n // three sizes identical and collapsed the ramp to page 24 / toolbar 20 / section 20.\n section: 'text-subheading-sm font-semibold text-default',\n};\n\nconst SUBTITLE: Record<PageHeadingSize, string> = {\n page: 'mt-1 text-body-sm text-default-secondary',\n toolbar: 'text-body-xs text-default-secondary',\n section: 'mt-1 text-body-sm text-default-secondary',\n};\n\nexport interface PageHeadingProps {\n title: ReactNode;\n subtitle?: ReactNode;\n size?: PageHeadingSize;\n /** Heading level. Defaults to `h1` for page/toolbar and `h2` for section. */\n as?: 'h1' | 'h2' | 'h3';\n /**\n * Chips beside the title (\"System\", \"Editing\"). They sit outside the heading element, so they\n * are not part of the heading's accessible name. New in 0.9.5.\n */\n badges?: ReactNode;\n /** A muted line between the title and the subtitle, e.g. \"PS-014 · Finance\". New in 0.9.5. */\n meta?: ReactNode;\n /** Right-aligned action cluster. When set, the heading becomes a flex row. */\n actions?: ReactNode;\n /** Clamp a long title to one line — needed when the title is user data, e.g. an article headline. */\n truncateTitle?: boolean;\n className?: string;\n}\n\n/**\n * Page or section title with an optional subtitle underneath.\n *\n * Replaces nine copies of the `<h1>` + `<p className=\"mt-1 …\">` block, plus the\n * heading halves of `SettingsTabs` and `my-account/tabs`.\n *\n * Emitting a real heading element matters: `reviewer-detail`,\n * `settings-audit-log`'s table area and `widget-gallery` render their titles as\n * `<p>`/`<div>` today, so `getByRole('heading')` finds nothing there — an\n * accessibility gap the e2e specs currently work around.\n */\nexport function PageHeading({\n title,\n subtitle,\n size = 'page',\n as,\n badges,\n meta,\n actions,\n truncateTitle,\n className,\n}: PageHeadingProps) {\n const Tag = as ?? (size === 'section' ? 'h2' : 'h1');\n\n const heading = (\n <div className=\"flex min-w-0 flex-col gap-0.5\">\n {badges ? (\n <div className=\"flex min-w-0 flex-wrap items-center gap-2.5\">\n <Tag className={clsx(TITLE[size], truncateTitle && 'truncate')}>{title}</Tag>\n {badges}\n </div>\n ) : (\n <Tag className={clsx(TITLE[size], truncateTitle && 'truncate')}>{title}</Tag>\n )}\n {meta && <div className=\"flex flex-wrap items-center gap-2.5 text-body-xs text-default-secondary\">{meta}</div>}\n {subtitle && <p className={SUBTITLE[size]}>{subtitle}</p>}\n </div>\n );\n\n if (!actions) return className ? <div className={className}>{heading}</div> : heading;\n\n return (\n <div className={clsx('flex items-start justify-between gap-4', className)}>\n {heading}\n <div className=\"flex shrink-0 items-center gap-2\">{actions}</div>\n </div>\n );\n}\n","import clsx from 'clsx';\nimport type { ReactNode } from 'react';\nimport { ArrowLeftIcon } from 'lucide-react';\nimport { IconButton } from '../forms/icon-button';\n\nexport type PageToolbarSize = 'sm' | 'md';\n\nexport interface PageToolbarProps {\n /** The heading block (usually a `PageHeading`). Without `actions`, the actions as well (legacy). */\n children: ReactNode;\n /**\n * The action cluster, e.g. buttons. New in 0.9.1. Passing it makes the bar responsive: on a\n * wide screen the actions sit on the heading's row, at the right; when they don't fit, they\n * wrap below the heading and among themselves. The heading never narrows below 12rem (or the\n * full width, if less). Without it, children keep the old single-row layout, which squeezed\n * the heading to a sliver and ran the actions off-screen on a phone.\n */\n actions?: ReactNode;\n /**\n * Renders an icon-only back control at the far left, ahead of the heading: the Page Header's\n * `backButton` in Figma (node 3473:16837). New in 0.7.0, from SCIC. Omit for no back control.\n */\n onBack?: () => void;\n /** Accessible name for the back control. Default \"Go back\". */\n backLabel?: string;\n /**\n * Allow the row to wrap when the action cluster is wide (entity-detail has seven buttons).\n * @deprecated Pass the actions through `actions`, which always wraps where needed.\n */\n wrap?: boolean;\n /**\n * The bar's **own** height and padding. `sm` suits a secondary bar under the main toolbar.\n *\n * Not to be confused with `FilterBar.size`, which sets the density of the controls\n * *inside* the row. Same literals, different subject: a bar sizes itself, a row of\n * controls sizes its children. `PageToolbar` passes nothing down.\n */\n size?: PageToolbarSize;\n className?: string;\n}\n\nconst SIZE: Record<PageToolbarSize, string> = {\n sm: 'min-h-[56px] px-4 py-3 md:px-7',\n md: 'min-h-[72px] px-4 py-4 md:px-7',\n};\n\n/**\n * The sticky top bar on a full-bleed detail or list screen: title block on the\n * left, actions on the right.\n *\n * Replaces ten copies of this class string. Three of those copies used the\n * responsive `px-4 py-4 md:px-7` and seven used a fixed `px-7 py-4`; the responsive\n * variant is adopted here, which is a deliberate improvement below `md` where the\n * fixed 28px padding was cramped.\n */\nexport function PageToolbar({\n children,\n actions,\n onBack,\n backLabel = 'Go back',\n wrap,\n size = 'md',\n className,\n}: PageToolbarProps) {\n if (actions !== undefined) {\n return (\n <div\n data-slot=\"page-toolbar\"\n className={clsx(\n 'flex shrink-0 flex-wrap items-center gap-x-4 gap-y-3 border-b border-default bg-default',\n SIZE[size],\n className,\n )}\n >\n {/* Back control and heading share one unbreakable group, so the back arrow never\n ends up alone on a row. */}\n <div className=\"flex min-w-[min(100%,12rem)] flex-1 basis-48 items-center gap-4\">\n {onBack && (\n <IconButton variant=\"neutral\" size=\"md\" aria-label={backLabel} onClick={onBack}>\n <ArrowLeftIcon aria-hidden />\n </IconButton>\n )}\n <div className=\"min-w-0 flex-1\">{children}</div>\n </div>\n {/* `ml-auto` keeps the actions right-aligned on the heading's row and on their own. */}\n <div data-slot=\"page-toolbar-actions\" className=\"ml-auto flex max-w-full flex-wrap items-center justify-end gap-2\">\n {actions}\n </div>\n </div>\n );\n }\n\n return (\n <div\n className={clsx(\n 'flex shrink-0 items-center gap-4 border-b border-default bg-default',\n SIZE[size],\n !onBack && 'justify-between',\n !onBack && wrap && 'flex-wrap gap-2',\n className,\n )}\n >\n {onBack && (\n <IconButton variant=\"neutral\" size=\"md\" aria-label={backLabel} onClick={onBack}>\n <ArrowLeftIcon aria-hidden />\n </IconButton>\n )}\n {/* With a back control the heading and actions keep their split inside a flex-1\n wrapper, so the back control stays pinned left rather than spaced out with them. */}\n {onBack ? (\n <div className={clsx('flex min-w-0 flex-1 items-center justify-between gap-4', wrap && 'flex-wrap gap-2')}>\n {children}\n </div>\n ) : (\n children\n )}\n </div>\n );\n}\n","import clsx from 'clsx';\nimport type { ReactNode } from 'react';\nimport { ControlSizeProvider } from '../forms/control-size';\n\nexport type FilterBarSize = 'sm' | 'md';\n\nexport interface FilterBarProps {\n children: ReactNode;\n /** Right-aligned slot for a result count or a secondary action. */\n trailing?: ReactNode;\n /**\n * Row density. Sets the gap between controls **and** the default `size` of the controls\n * inside — an Input, Select, Combobox, DatePicker or Button that is not given its own\n * `size` inherits this one. Pass `size` on a child to opt it out.\n *\n * `sm` is for a filter row inside a card or drawer: 8px gaps and 24px controls.\n */\n size?: FilterBarSize;\n className?: string;\n}\n\nconst GAP: Record<FilterBarSize, string> = {\n sm: 'gap-2',\n md: 'gap-3',\n};\n\n/**\n * Row of search inputs and filter selects above a table.\n *\n * Replaces nine copies of `flex flex-wrap items-center gap-3`.\n *\n * Through 0.4.0 `size` set only the gap, so every caller had to repeat it on each control\n * and the page documenting this component got it wrong: its `size=\"sm\"` example put a 24px\n * Input beside a 36px Select. A container with a size prop should mean it, so the size now\n * reaches the controls through `ControlSizeProvider`.\n */\nexport function FilterBar({ children, trailing, size = 'md', className }: FilterBarProps) {\n return (\n <ControlSizeProvider size={size}>\n <div className={clsx('flex flex-wrap items-center', GAP[size], className)}>\n {children}\n {/* Was a fixed `gap-2`, which disagreed with the row itself at `md`. */}\n {trailing && <div className={clsx('ml-auto flex items-center', GAP[size])}>{trailing}</div>}\n </div>\n </ControlSizeProvider>\n );\n}\n","import {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactElement,\n type ReactNode,\n type MutableRefObject,\n} from 'react';\nimport clsx from 'clsx';\nimport { ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';\nimport { Tabs as TabsPrimitive } from 'radix-ui';\nimport { cn } from '../../lib/cn';\nimport { FOCUS_RING } from '../../lib/focus-ring';\nimport { composeRefs } from '../../lib/slot';\nimport { useRovingFocus } from '../../lib/use-roving-focus';\nimport { useControllableState } from '../../lib/use-controllable-state';\n\nexport type TabsVariant = 'underline' | 'pill';\nexport type TabsSize = 'sm' | 'md';\nexport type TabsOrientation = 'horizontal' | 'vertical';\n/**\n * `automatic` selects as focus moves, which is the APG default and right when panels are\n * cheap. `manual` requires Enter/Space — use it when switching tab triggers a fetch, so\n * arrowing across five tabs does not fire five requests.\n */\nexport type TabsActivation = 'automatic' | 'manual';\n\nexport interface TabItem<K extends string = string> {\n key: K;\n label: string;\n /**\n * Renders a count chip after the label. A number is formatted for `locale` (`1,284`); pass a\n * node for anything else, e.g. `\"99+\"`. A node from 0.9.4.\n */\n count?: ReactNode;\n disabled?: boolean;\n}\n\n/** The `items` form: a tab strip only, with `TabsPanel`s placed wherever the page needs them. */\nexport interface TabsProps<K extends string = string> {\n items: TabItem<K>[];\n /** Controlled selection. Omit and pass `defaultValue` for uncontrolled. */\n value?: K;\n defaultValue?: K;\n onValueChange?: (key: K) => void;\n /**\n * `underline` is the detail-page form (entity detail, reviewer detail, role detail).\n * `pill` is the filter-style form used by the reviewer queue.\n */\n variant?: TabsVariant;\n /** `md` is the page-level strip; `sm` suits a tab strip inside a card or drawer. */\n size?: TabsSize;\n orientation?: TabsOrientation;\n activation?: TabsActivation;\n /**\n * Shared prefix for the tab and panel ids. Pass the same value to each `TabsPanel` and the\n * tabs point `aria-controls` at their panels. Without it, `aria-controls` is left off: a\n * generated prefix would point it at ids no panel has. The composable form needs neither.\n */\n idPrefix?: string;\n /** Names the tab strip. Required by the APG when there is more than one on a page. */\n label?: string;\n /** Locale for numeric `count`s. Default: the browser's. New in 0.9.4. */\n locale?: string;\n className?: string;\n}\n\n/**\n * The composable form, new in 0.7.0 and built on Radix Tabs: `Tabs` wraps a `TabsList` of\n * `TabsTrigger`s and the `TabsContent` panels, and wires every id itself.\n */\nexport interface TabsRootProps {\n children: ReactNode;\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n variant?: TabsVariant;\n size?: TabsSize;\n orientation?: TabsOrientation;\n activation?: TabsActivation;\n /** Reading direction, which flips Left/Right in a horizontal strip. */\n dir?: 'ltr' | 'rtl';\n /** Locale for numeric `count`s on the triggers. Default: the browser's. New in 0.9.4. */\n locale?: string;\n className?: string;\n}\n\n/**\n * Per-variant sizing. The two variants have genuinely different geometry — a pill has\n * a background to pad against, an underline only has a baseline — so this is a nested\n * map rather than one shared scale.\n */\nconst SIZE: Record<TabsVariant, Record<TabsSize, { strip: string; tab: string }>> = {\n underline: {\n sm: { strip: 'gap-4', tab: 'px-0.5 py-1.5 text-body-xs' },\n md: { strip: 'gap-6', tab: 'px-0.5 py-2.5 text-body-sm' },\n },\n pill: {\n sm: { strip: 'gap-1', tab: 'rounded-md px-2.5 py-1.5 text-body-tiny' },\n md: { strip: 'gap-1.5', tab: 'rounded-lg px-3.5 py-2 text-body-xs' },\n },\n};\n\n/**\n * One look for both forms, keyed on `aria-selected`, which our strip and Radix's triggers\n * both set. The selected state lives in the attribute, not in a conditional class.\n *\n * The `underline` selected colour is `background-brand` (#0C2D58), which is what Figma\n * specifies.\n */\nconst TAB_VARIANT: Record<TabsVariant, string> = {\n pill: clsx(\n 'font-medium text-default-secondary hover:bg-default-secondary',\n 'aria-selected:bg-brand aria-selected:text-brand-on-brand aria-selected:hover:bg-brand',\n ),\n underline: clsx(\n 'snap-start leading-snug font-normal text-default-secondary hover:text-default',\n 'border-b-2 border-transparent',\n 'aria-selected:border-brand-emphasis aria-selected:font-semibold aria-selected:text-brand-emphasis',\n ),\n};\n\nconst tabClasses = (variant: TabsVariant, size: TabsSize) =>\n clsx(\n 'group flex shrink-0 items-center gap-1.5 whitespace-nowrap transition-colors',\n FOCUS_RING,\n 'disabled:cursor-not-allowed disabled:opacity-50',\n SIZE[variant][size].tab,\n TAB_VARIANT[variant],\n );\n\n/** A horizontal underline strip scrolls; a pill strip wraps; a vertical strip stacks. */\nconst scrollsHorizontally = (variant: TabsVariant, orientation: TabsOrientation) =>\n variant === 'underline' && orientation === 'horizontal';\n\nconst stripClasses = (variant: TabsVariant, size: TabsSize, orientation: TabsOrientation) =>\n clsx(\n 'flex',\n // The strip's own children are the tab stops, so it needs no tab stop of its own.\n orientation === 'vertical'\n ? 'shrink-0 flex-col'\n : variant === 'pill'\n ? // Pills are a handful of filter-style choices: wrap, so every one stays visible.\n 'shrink-0 flex-wrap'\n : // Underline tabs are page sections: scroll, snapping to whole tabs. The edge buttons are\n // the affordance, so the (often overlay) native scrollbar is hidden rather than doubled.\n 'min-w-0 flex-1 snap-x snap-mandatory overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden',\n SIZE[variant][size].strip,\n variant === 'underline' &&\n (orientation === 'vertical' ? 'border-r border-default' : 'border-b border-default'),\n );\n\n/** The count chip. Inverts with its tab in the pill variant, styled from the tab's state. */\nfunction TabCount({ count, variant, locale }: { count: ReactNode; variant: TabsVariant; locale?: string }) {\n return (\n <span\n className={clsx(\n 'rounded-md bg-default-secondary px-1.5 py-px text-body-tiny font-medium leading-snug text-default-secondary',\n variant === 'pill' &&\n 'group-aria-selected:bg-brand-hover group-aria-selected:text-brand-on-brand',\n )}\n >\n {typeof count === 'number' ? count.toLocaleString(locale) : count}\n </span>\n );\n}\n\n// ── Scrolling strip ────────────────────────────────────────────────────────────\n\n/** Room kept clear for an edge button when scrolling a tab into view, in px (`w-8`). */\nconst EDGE_PAD = 32;\n\nconst prefersReducedMotion = () =>\n typeof window !== 'undefined' && window.matchMedia?.('(prefers-reduced-motion: reduce)').matches === true;\n\ninterface TabStrip {\n listRef: MutableRefObject<HTMLDivElement | null>;\n edges: { start: boolean; end: boolean };\n measure: () => void;\n page: (direction: 1 | -1) => void;\n}\n\n/**\n * Overflow tracking for a scrolling tab strip: which edges have hidden tabs, paging by the edge\n * buttons, and keeping the selected tab in view when the selection changes, including from\n * outside (a `?tab=` URL). Scrolls the strip only; `scrollIntoView` would scroll the page too.\n * `ResizeObserver`, `scrollTo` and `scrollBy` are guarded, for jsdom.\n */\nfunction useTabStrip(enabled: boolean): TabStrip {\n const listRef = useRef<HTMLDivElement | null>(null);\n const selected = useRef<Element | null>(null);\n const [edges, setEdges] = useState({ start: false, end: false });\n\n const measure = useCallback(() => {\n const el = listRef.current;\n if (!enabled || !el) return;\n const start = el.scrollLeft > 1;\n const end = el.scrollLeft + el.clientWidth < el.scrollWidth - 1;\n setEdges((prev) => (prev.start === start && prev.end === end ? prev : { start, end }));\n }, [enabled]);\n\n useLayoutEffect(() => {\n const el = listRef.current;\n if (!enabled || !el || typeof ResizeObserver === 'undefined') return;\n const observer = new ResizeObserver(measure);\n observer.observe(el);\n return () => observer.disconnect();\n }, [enabled, measure]);\n\n // Every render: tabs added or relabelled change the strip's scroll width without resizing it.\n useLayoutEffect(() => {\n const list = listRef.current;\n if (!enabled || !list) return;\n measure();\n const tab = list.querySelector<HTMLElement>('[role=\"tab\"][aria-selected=\"true\"]');\n if (!tab || tab === selected.current) return;\n selected.current = tab;\n if (typeof list.scrollTo !== 'function') return;\n const left = tab.offsetLeft - list.offsetLeft;\n const right = left + tab.offsetWidth;\n if (left < list.scrollLeft + EDGE_PAD) list.scrollTo({ left: Math.max(0, left - EDGE_PAD) });\n else if (right > list.scrollLeft + list.clientWidth - EDGE_PAD) {\n list.scrollTo({ left: right - list.clientWidth + EDGE_PAD });\n }\n });\n\n const page = useCallback((direction: 1 | -1) => {\n const el = listRef.current;\n if (!el || typeof el.scrollBy !== 'function') return;\n el.scrollBy({ left: direction * el.clientWidth * 0.8, behavior: prefersReducedMotion() ? 'auto' : 'smooth' });\n }, []);\n\n return { listRef, edges, measure, page };\n}\n\n/**\n * The frame around a scrolling strip: the strip plus an edge button on each side with hidden\n * tabs. The buttons are pointer conveniences (`aria-hidden`, not focusable): the arrow keys\n * already move along the strip, and a native scrollbar is no affordance where it overlays.\n */\nfunction TabStripFrame({ strip, children }: { strip: TabStrip; children: ReactNode }) {\n return (\n <div className=\"relative flex min-w-0 max-w-full\">\n {children}\n {strip.edges.start && <TabStripEdge side=\"start\" onClick={() => strip.page(-1)} />}\n {strip.edges.end && <TabStripEdge side=\"end\" onClick={() => strip.page(1)} />}\n </div>\n );\n}\n\nfunction TabStripEdge({ side, onClick }: { side: 'start' | 'end'; onClick: () => void }) {\n const Icon = side === 'start' ? ChevronLeftIcon : ChevronRightIcon;\n return (\n <button\n type=\"button\"\n aria-hidden\n tabIndex={-1}\n onClick={onClick}\n data-edge={side}\n className={clsx(\n // `bottom-px` keeps the strip's baseline visible under the fade.\n 'absolute bottom-px top-0 z-raised flex w-8 items-center text-icon-default-secondary hover:text-icon-default',\n side === 'start'\n ? 'left-0 justify-start bg-gradient-to-r from-default via-default to-transparent'\n : 'right-0 justify-end bg-gradient-to-l from-default via-default to-transparent',\n )}\n >\n <Icon className=\"size-4\" />\n </button>\n );\n}\n\nexport const tabId = (prefix: string, key: string) => `${prefix}-tab-${key}`;\nexport const tabPanelId = (prefix: string, key: string) => `${prefix}-panel-${key}`;\n\n/**\n * Tabs, in two forms.\n *\n * // items: a strip; panels live anywhere, linked by idPrefix.\n * <Tabs items={items} value={tab} onValueChange={setTab} idPrefix=\"entity\" />\n * <TabsPanel tabKey=\"overview\" idPrefix=\"entity\" active={tab === 'overview'}>…</TabsPanel>\n *\n * // composable (0.7.0, Radix): strip and panels in one tree, ids wired for you.\n * <Tabs defaultValue=\"overview\">\n * <TabsList label=\"Sections\"><TabsTrigger value=\"overview\">Overview</TabsTrigger></TabsList>\n * <TabsContent value=\"overview\">…</TabsContent>\n * </Tabs>\n *\n * Both implement the WAI-ARIA tabs pattern: one tab stop on the selected tab, arrows along the\n * strip (wrapping), Home/End, disabled tabs skipped, automatic or manual activation, and\n * `role=\"tabpanel\"` regions labelled by their tabs. 0.3.0 had the roles and none of the keys.\n */\n// Overloads, not a union of the two prop types: with a union, `onValueChange={(key) => …}`\n// loses its contextual type and `key` becomes an implicit `any` at every strict call site.\nexport function Tabs<K extends string = string>(props: TabsProps<K>): ReactElement;\nexport function Tabs(props: TabsRootProps): ReactElement;\nexport function Tabs<K extends string = string>(props: TabsProps<K> | TabsRootProps): ReactElement {\n if ('items' in props && props.items) return <ItemsTabs {...(props as TabsProps<K>)} />;\n return <TabsRoot {...(props as TabsRootProps)} />;\n}\n\nfunction ItemsTabs<K extends string = string>({\n items,\n value: valueProp,\n defaultValue,\n onValueChange,\n variant = 'underline',\n size = 'md',\n orientation = 'horizontal',\n activation = 'automatic',\n idPrefix,\n label,\n locale,\n className,\n}: TabsProps<K>) {\n const scrolls = scrollsHorizontally(variant, orientation);\n const strip = useTabStrip(scrolls);\n const generatedPrefix = useId();\n const prefix = idPrefix ?? generatedPrefix;\n\n const [value, setValue] = useControllableState<K>({\n value: valueProp,\n defaultValue: defaultValue ?? items[0]?.key,\n onChange: onValueChange as ((next: K) => void) | undefined,\n });\n\n const selectedIndex = Math.max(\n 0,\n items.findIndex((item) => item.key === value),\n );\n\n const roving = useRovingFocus({\n orientation: orientation === 'vertical' ? 'vertical' : 'horizontal',\n loop: true,\n defaultIndex: selectedIndex,\n });\n\n const list = (\n <div\n ref={strip.listRef}\n role=\"tablist\"\n aria-label={label}\n aria-orientation={orientation}\n data-variant={variant}\n onScroll={scrolls ? strip.measure : undefined}\n className={cn(\n stripClasses(variant, size, orientation),\n scrolls && (strip.edges.start || strip.edges.end) && 'scroll-px-8',\n className,\n )}\n {...roving.containerProps}\n >\n {items.map((tab, index) => {\n const active = tab.key === value;\n const itemProps = roving.itemProps(index, { disabled: tab.disabled, label: tab.label });\n\n return (\n <button\n key={tab.key}\n type=\"button\"\n role=\"tab\"\n id={tabId(prefix, tab.key)}\n aria-selected={active}\n aria-controls={idPrefix ? tabPanelId(prefix, tab.key) : undefined}\n data-state={active ? 'active' : 'inactive'}\n disabled={tab.disabled}\n {...itemProps}\n // Selection, not focus, owns the tab stop: Tab must land on the *selected*\n // tab, which is not necessarily the one the arrow keys last visited.\n tabIndex={active ? 0 : -1}\n onFocus={() => {\n itemProps.onFocus();\n // Automatic activation: focus and selection move together.\n if (activation === 'automatic' && !tab.disabled) setValue(tab.key);\n }}\n onClick={() => !tab.disabled && setValue(tab.key)}\n onKeyDown={(event) => {\n if (activation === 'manual' && (event.key === 'Enter' || event.key === ' ')) {\n event.preventDefault();\n setValue(tab.key);\n }\n }}\n className={tabClasses(variant, size)}\n >\n {tab.label}\n {tab.count !== undefined && <TabCount count={tab.count} variant={variant} locale={locale} />}\n </button>\n );\n })}\n </div>\n );\n\n return scrolls ? <TabStripFrame strip={strip}>{list}</TabStripFrame> : list;\n}\n\n/** Panels get a visible focus ring: they are tab stops when they hold nothing focusable. */\nconst PANEL_CLASSES = clsx(FOCUS_RING, 'rounded-sm');\n\nexport interface TabsPanelProps extends HTMLAttributes<HTMLDivElement> {\n /** The `key` of the tab this panel belongs to. */\n tabKey: string;\n /** Must match the `idPrefix` given to `Tabs`. */\n idPrefix: string;\n /** Whether this panel's tab is the selected one. */\n active: boolean;\n children: ReactNode;\n /**\n * Keep the panel mounted while hidden. Default `false`. Mounting all panels preserves\n * scroll position and form state across tab switches at the cost of rendering them all.\n */\n keepMounted?: boolean;\n}\n\n/**\n * The `role=\"tabpanel\"` half of the `items` form.\n *\n * `tabIndex={0}` is deliberate and required: when a panel contains no focusable element,\n * it must be reachable itself, otherwise Tab from the selected tab skips the content\n * entirely. So it also needs a visible focus ring, which 0.6 suppressed (WCAG 2.4.7).\n */\nexport function TabsPanel({\n tabKey,\n idPrefix,\n active,\n children,\n keepMounted = false,\n className,\n ...rest\n}: TabsPanelProps) {\n if (!active && !keepMounted) return null;\n\n return (\n <div\n role=\"tabpanel\"\n id={tabPanelId(idPrefix, tabKey)}\n aria-labelledby={tabId(idPrefix, tabKey)}\n hidden={!active}\n tabIndex={0}\n data-state={active ? 'active' : 'inactive'}\n className={cn(PANEL_CLASSES, className)}\n {...rest}\n >\n {children}\n </div>\n );\n}\n\n// ── Composable form (Radix) ────────────────────────────────────────────────────\n\nconst TabsStyle = createContext<{\n variant: TabsVariant;\n size: TabsSize;\n orientation: TabsOrientation;\n locale?: string;\n}>({\n variant: 'underline',\n size: 'md',\n orientation: 'horizontal',\n});\n\nfunction TabsRoot({\n children,\n value,\n defaultValue,\n onValueChange,\n variant = 'underline',\n size = 'md',\n orientation = 'horizontal',\n activation = 'automatic',\n dir,\n locale,\n className,\n}: TabsRootProps) {\n return (\n <TabsPrimitive.Root\n value={value}\n defaultValue={defaultValue}\n onValueChange={onValueChange}\n orientation={orientation}\n activationMode={activation}\n dir={dir}\n className={cn(orientation === 'vertical' ? 'flex gap-6' : 'flex flex-col gap-4', className)}\n >\n <TabsStyle.Provider value={{ variant, size, orientation, locale }}>{children}</TabsStyle.Provider>\n </TabsPrimitive.Root>\n );\n}\n\nexport interface TabsListProps extends HTMLAttributes<HTMLDivElement> {\n /** Names the tab strip. Required by the APG when there is more than one on a page. */\n label?: string;\n}\n\nexport const TabsList = forwardRef<HTMLDivElement, TabsListProps>(function TabsList(\n { label, className, onScroll, ...rest },\n ref,\n) {\n const style = useContext(TabsStyle);\n const scrolls = scrollsHorizontally(style.variant, style.orientation);\n const strip = useTabStrip(scrolls);\n const list = (\n <TabsPrimitive.List\n ref={composeRefs(ref, strip.listRef)}\n aria-label={label}\n loop\n data-variant={style.variant}\n onScroll={(event) => {\n onScroll?.(event);\n if (scrolls) strip.measure();\n }}\n className={cn(\n stripClasses(style.variant, style.size, style.orientation),\n scrolls && (strip.edges.start || strip.edges.end) && 'scroll-px-8',\n className,\n )}\n {...rest}\n />\n );\n return scrolls ? <TabStripFrame strip={strip}>{list}</TabStripFrame> : list;\n});\n\nexport interface TabsTriggerProps extends HTMLAttributes<HTMLButtonElement> {\n value: string;\n disabled?: boolean;\n /** Renders a count chip after the label. A number is formatted for the root's `locale`. */\n count?: ReactNode;\n}\n\nexport const TabsTrigger = forwardRef<HTMLButtonElement, TabsTriggerProps>(function TabsTrigger(\n { value, disabled, count, className, children, ...rest },\n ref,\n) {\n const style = useContext(TabsStyle);\n return (\n <TabsPrimitive.Trigger\n ref={ref}\n value={value}\n disabled={disabled}\n className={cn(tabClasses(style.variant, style.size), className)}\n {...rest}\n >\n {children}\n {count !== undefined && <TabCount count={count} variant={style.variant} locale={style.locale} />}\n </TabsPrimitive.Trigger>\n );\n});\n\nexport interface TabsContentProps extends HTMLAttributes<HTMLDivElement> {\n value: string;\n /** Keep the panel mounted while hidden, preserving its state. Default `false`. */\n keepMounted?: boolean;\n}\n\nexport const TabsContent = forwardRef<HTMLDivElement, TabsContentProps>(function TabsContent(\n { value, keepMounted = false, className, ...rest },\n ref,\n) {\n return (\n <TabsPrimitive.Content\n ref={ref}\n value={value}\n forceMount={keepMounted || undefined}\n className={cn(PANEL_CLASSES, 'data-[state=inactive]:hidden', className)}\n {...rest}\n />\n );\n});\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { ChevronDownIcon } from 'lucide-react';\nimport { Slot } from '../../lib/slot';\n\nexport type NavItemSize = 'sm' | 'md';\nexport type NavItemVariant = 'card' | 'plain';\n/**\n * The two Figma sidebar variants (Sidebar Navigation, node 3133:255). New in 0.9.6.\n *\n * `comfortable` is the card row: 44px, its own border and surface. `compact` is the plain\n * row: 40px, text on the rail. Both use the 16px Body Base label and a 20px icon.\n */\nexport type NavItemDensity = 'comfortable' | 'compact';\n\nexport interface NavItemProps extends Omit<HTMLAttributes<HTMLElement>, 'children'> {\n /**\n * Leading glyph. Optional, but when `collapsed` it is the only thing left to look at, so\n * a row without one falls back to a monogram taken from the label.\n */\n icon?: ReactNode;\n label: string;\n /**\n * A destination that exists but cannot be opened right now (no permission, coming soon).\n * Dimmed, out of the tab order and inert under `asChild`, with `aria-disabled` so it is\n * still announced. New in 0.7.0; replaces `pointer-events-none opacity-40` at the call site.\n */\n disabled?: boolean;\n /**\n * The row you are on — the current route. Paints the brand fill and, under `asChild`, sets\n * `aria-current=\"page\"`; it also reflects to `data-state=\"active\"`.\n *\n * Not the same thing as focus, though Figma's `MenuButton` names this variant\n * `state=focussed`. That is a misnomer to fix on the design side: keyboard focus is the\n * ring below, it is transient and can land on any row, and if it painted the brand fill\n * too there would be no way to see which row is the current one while tabbing past it.\n */\n isActive?: boolean;\n /** Red indicator dot at top-right corner (e.g. unread count) */\n indicator?: boolean;\n /** Collapsed mode — label is visually hidden but stays in the accessibility tree. */\n collapsed?: boolean;\n /** Row height. `sm` suits a dense secondary nav or a nested group. */\n size?: NavItemSize;\n /**\n * Row weight.\n *\n * `card` gives every inactive row its own border and surface — right for a short primary\n * rail of eight or ten destinations, where each row is a target in its own right.\n * `plain` drops both, so an inactive row is just text: right for a long grouped nav,\n * where thirty bordered pills read as thirty cards rather than a list.\n *\n * A variant decides what a row looks like **at rest, and nothing else**. Hover and the\n * current-row fill are one vocabulary shared by both — see `STATE`. Through 0.5.0 each\n * variant defined its own, and `plain`'s was invisible against the rail it was written for.\n */\n variant?: NavItemVariant;\n /**\n * The Figma sidebar density. New in 0.9.6, and when set it supersedes `size` and `variant`:\n * those two predate the current design file and stay only so existing rows do not change.\n */\n density?: NavItemDensity;\n /** Trailing glyph after the label, e.g. the chevron of a row that opens a submenu. */\n trailing?: ReactNode;\n /**\n * Render the single child element as the row, so the row itself is the link or button.\n *\n * `NavItem` is presentational by default — a `<span>` with hover styling. That is fine\n * inside a router `NavLink`, which is how `src/sidebar/` uses it, but on its own it is a\n * nav row that looks interactive and cannot be focused or activated. `asChild` is the\n * fix for anyone using it outside that wrapper:\n *\n * <NavItem asChild icon={<HouseIcon />} label=\"Home\">\n * <NavLink to=\"/\" />\n * </NavItem>\n */\n asChild?: boolean;\n children?: ReactNode;\n className?: string;\n}\n\n/**\n * `md` is Figma's `MenuButton` in every dimension: 44px tall, 12px radius, 12px gap, 14px\n * padding-x. `square` is the collapsed footprint — the design does not stretch a collapsed row\n * to the rail width, it centres a 44×44 button, which is exactly `px-3.5` either side of a\n * 16px icon.\n *\n * The label is the one deliberate departure. Figma specifies Body Base (16px); this is\n * `text-body-sm` (14px), because 16px rows read as oversized against everything else in a\n * product shell. The design file is the authority on the box and the colours, not on this.\n *\n * `sm` has no counterpart in the design file; it is a code-only density for long navs.\n */\nconst SIZE: Record<NavItemSize, { box: string; label: string; square: string }> = {\n sm: { box: 'h-9 gap-2 rounded-lg px-3 py-1.5', label: 'text-body-xs', square: 'w-9' },\n md: { box: 'h-11 gap-3 rounded-xl px-3.5 py-2.5', label: 'text-body-sm', square: 'w-11' },\n};\n\n/**\n * Up to two characters standing in for a missing icon in the collapsed rail.\n *\n * Two rather than one because any nav long enough to be worth collapsing collides on first\n * letters — the docs' own sidebar has Button beside Badges and Input beside Icons. Multiple\n * words give one initial each (\"Color Tokens\" → \"CT\"); a single word gives its first two\n * (\"Button\" → \"Bu\"), which stays readable rather than shouting. Words that open with\n * punctuation are skipped, so \"Cards & Containers\" is \"CC\" and not \"C&\".\n */\nfunction monogram(label: string): string {\n const words = label.split(/\\s+/).filter((word) => /^[\\p{L}\\p{N}]/u.test(word));\n const [first, second] = words;\n // A label of nothing but symbols has no initials to take; show its first character.\n if (!first) return Array.from(label.trim())[0]?.toUpperCase() ?? '';\n if (second) return (Array.from(first)[0] + Array.from(second)[0]).toUpperCase();\n const [a, b] = Array.from(first);\n return a.toUpperCase() + (b ?? '').toLowerCase();\n}\n\n/**\n * What a row looks like when you are on it, and when you hover one you are not — shared by\n * both variants and declared nowhere else. Selection means one thing in this library.\n *\n * Through 0.5.0 each variant carried its own pair, and `plain`'s hover was\n * `hover:bg-default-hover` — a generic app-surface token resolving to `--prim-gray-100`,\n * which is the same #F5F5F5 as the `bg-default-secondary` rail a sidebar row sits on. Plain\n * rows therefore had **no visible hover at all** in light mode, and `plain`'s active\n * `bg-brand-tertiary` (#F1F7FD) was a 1.02:1 step against that same rail. The bug survived\n * because the docs demo every variant on `bg-default` — white — where the collision does\n * not occur.\n */\nconst STATE = {\n // Figma MenuButton `state=hover`. No border change: Figma holds it at #D9D9D9 through\n // hover and moves only the fill and the text.\n hover: 'hover:bg-brand-tertiary-hover hover:text-brand',\n // Figma MenuButton `state=focussed`, which is that file's name for selected — see the\n // `isActive` doc comment. Hovering the current row darkens it rather than reverting it to\n // the pale hover tint, which would read as the row losing its selection under the cursor.\n active: 'bg-brand text-brand-on-brand hover:bg-brand-hover',\n} as const;\n\n/** The resting appearance — the whole of the difference between the two variants. */\nconst VARIANT: Record<NavItemVariant, { active: string; inactive: string }> = {\n card: {\n // `border-transparent` holds the 1px so the icon and label do not shift outward when a\n // row becomes the current one — the same trick, for the same reason, as `button.tsx`.\n // `bg-brand` still paints edge to edge, since backgrounds clip to the border box.\n active: clsx('border border-transparent', STATE.active),\n inactive: clsx('border border-default bg-default text-default-secondary', STATE.hover),\n },\n plain: {\n active: STATE.active,\n inactive: clsx('text-default-secondary', STATE.hover),\n },\n};\n\n/**\n * Figma `NavItem base` (node 3123:139), every state of both densities.\n *\n * `pad` is kept apart from `box` because a collapsed row drops it: 14px either side of a 20px\n * icon is 48px, wider than the 44px square, and `clsx` cannot let a later `px-0` win.\n */\nconst DENSITY: Record<\n NavItemDensity,\n {\n box: string;\n pad: string;\n square: string;\n active: string;\n inactive: string;\n disabled: string;\n dot: string;\n railDot: string;\n }\n> = {\n comfortable: {\n box: 'h-11 gap-3 rounded-xl',\n pad: 'px-3.5',\n square: 'w-11',\n active: clsx('border border-transparent', STATE.active),\n inactive: clsx('border border-default bg-default text-default', STATE.hover),\n disabled: 'data-[disabled]:hover:bg-default',\n // Straddles the card's corner, as in Figma.\n dot: '-right-px -top-px',\n railDot: '-right-px -top-px',\n },\n compact: {\n box: 'h-10 gap-3 rounded-xl',\n pad: 'px-3',\n square: 'w-10',\n active: STATE.active,\n inactive: clsx('text-default', STATE.hover),\n disabled: 'data-[disabled]:hover:bg-transparent',\n // A plain row has no corner to sit on, so the expanded dot trails the label instead.\n dot: 'right-2 top-1/2 -translate-y-1/2',\n railDot: 'right-0 top-0',\n },\n};\n\n/** Disabled per Figma: the label greys out and the card keeps its border, no opacity wash. */\nconst DENSITY_DISABLED =\n 'data-[disabled]:cursor-not-allowed data-[disabled]:text-disabled data-[disabled]:hover:text-disabled';\n\nexport const NavItem = forwardRef<HTMLElement, NavItemProps>(function NavItem(\n {\n icon,\n label,\n isActive = false,\n indicator = false,\n collapsed = false,\n size = 'md',\n variant = 'card',\n density,\n trailing,\n asChild = false,\n disabled = false,\n children,\n className,\n onClick,\n ...rest\n },\n ref,\n) {\n const s = SIZE[size];\n const v = VARIANT[variant];\n const d = density ? DENSITY[density] : null;\n\n const rootProps = {\n ref,\n 'data-density': density,\n // Only meaningful when `asChild` renders a real link — a decorative span with\n // aria-current would be a lie.\n 'aria-current': asChild && isActive ? ('page' as const) : undefined,\n // Same attribute the disclosure components and `TableRow` use, so the state is\n // addressable from a consumer's CSS. `active` rather than `selected`: a nav row is where\n // you *are* (`aria-current=\"page\"`), which is a different thing from a row you have\n // *picked* (`aria-selected`) — `TableRow` is the latter and says `selected`.\n 'data-state': isActive ? ('active' as const) : undefined,\n 'data-disabled': disabled || undefined,\n 'aria-disabled': disabled || undefined,\n className: clsx(\n 'relative flex items-center transition-colors',\n // Unconditional: a row can also become focusable by the caller putting it inside a\n // link, which is how `src/sidebar/` uses it. A ring that only appears under `asChild`\n // leaves that case with no visible focus at all.\n // The offset is `default-secondary`, not `default`: a nav row's home is the sidebar\n // rail, and `ring-offset-default` is #FFFFFF, so a focused `plain` row drew a 1px white\n // halo on the #F5F5F5 rail. The offset itself is load-bearing — in dark mode\n // `ring-brand` and `bg-brand` are both #F1F7FD, so without it a focused *active* row\n // would have no visible ring at its inner edge.\n // It is also Figma's focus state for both densities: 1px rail-coloured gap, 3px of brand\n // in all. Figma's compact focus variant draws a 0px shadow — no ring at all — which\n // would fail WCAG 2.4.7, so compact keeps this ring too.\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default-secondary',\n d\n ? clsx(\n // text-left: a parent row is a <button>, which centres its text by default.\n 'group/nav-item text-left',\n d.box,\n collapsed ? clsx('justify-center', d.square) : clsx('w-full', d.pad),\n isActive ? d.active : d.inactive,\n DENSITY_DISABLED,\n d.disabled,\n )\n : clsx(\n s.box,\n // Expanded rows fill the nav; a collapsed one is a centred square, not a stretched row.\n collapsed ? clsx('justify-center', s.square) : 'w-full',\n isActive ? v.active : v.inactive,\n 'data-[disabled]:cursor-not-allowed data-[disabled]:opacity-40 data-[disabled]:hover:bg-transparent data-[disabled]:hover:text-default-secondary',\n ),\n className,\n ),\n ...rest,\n // After the spread: a disabled row refuses the press (a router Link skips navigation when\n // the event is prevented) and leaves the tab order, as a disabled control does.\n ...(disabled ? { tabIndex: -1 } : {}),\n onClick: (event: React.MouseEvent<HTMLElement>) => {\n if (disabled) {\n event.preventDefault();\n return;\n }\n onClick?.(event);\n },\n };\n\n const content = (\n <>\n {icon != null ? (\n <span\n aria-hidden\n className={clsx(\n 'shrink-0',\n d\n ? clsx(\n // Figma: a 20px glyph, icon-secondary at rest, brand under hover,\n // on-brand on the current row, disabled grey on a disabled one.\n 'flex size-5 items-center justify-center [&_svg]:size-5',\n disabled\n ? 'text-icon-disabled'\n : isActive\n ? 'text-icon-brand-on-brand'\n : 'text-icon-default-secondary group-hover/nav-item:text-icon-brand',\n )\n : '[&_svg]:size-4',\n )}\n >\n {icon}\n </span>\n ) : (\n // Icons are optional, but the collapsed rail hides the label — so a row with neither\n // renders as an empty box. Through 0.5.0 that is exactly what a nav without icons\n // collapsed to, the docs site's own 36-row sidebar included. The monogram is\n // decorative in the same way the icon is: the `sr-only` label below still names the\n // row.\n collapsed && (\n <span\n aria-hidden\n // `min-w-4` rather than `size-4`: the box matches the 16px an icon would take,\n // but a wide pair like \"MW\" is allowed to outgrow it rather than be clipped.\n className=\"flex h-4 min-w-4 shrink-0 items-center justify-center text-body-tiny font-semibold leading-none tracking-tight\"\n >\n {monogram(label)}\n </span>\n )\n )}\n {/* `collapsed` hides the label visually but keeps it in the accessibility tree.\n Through 0.3.0 the span was not rendered at all and no `aria-label` replaced it,\n so a collapsed sidebar was nine unlabelled icon links — the icon itself carries\n no name, being decorative. */}\n <span\n className={clsx(\n 'min-w-0 truncate font-regular',\n d ? 'text-body' : clsx('leading-snug', s.label),\n collapsed ? 'sr-only' : 'flex-1',\n )}\n >\n {label}\n </span>\n {trailing != null && !collapsed && (\n <span aria-hidden className=\"flex shrink-0 items-center [&_svg]:size-4\">\n {trailing}\n </span>\n )}\n {indicator && (\n <span\n // The dot is the only carrier of \"there is something new here\", so it needs a\n // name of its own rather than being purely decorative.\n role=\"status\"\n aria-label=\"Unread\"\n className={clsx(\n 'absolute size-2 rounded-full bg-danger',\n d ? (collapsed ? d.railDot : d.dot) : '-right-px -top-px',\n )}\n />\n )}\n </>\n );\n\n if (asChild) {\n // The child element becomes the row itself, so the icon/label/indicator go inside it\n // and its own children (usually nothing, since the label comes from `label`) are\n // discarded in favour of the composed content.\n return (\n <Slot wrapChildren={() => content} {...rootProps}>\n {children}\n </Slot>\n );\n }\n\n return <span {...rootProps}>{content}</span>;\n});\n\n// ── NavSubItem ─────────────────────────────────────────────────────────────────\n\nexport interface NavSubItemProps extends Omit<HTMLAttributes<HTMLElement>, 'children'> {\n label: string;\n /** The current route. Brand fill and, under `asChild`, `aria-current=\"page\"`. */\n isActive?: boolean;\n disabled?: boolean;\n /** The last child of its parent: the nest line turns into the row instead of running on. */\n last?: boolean;\n density?: NavItemDensity;\n /** Render the single child element (a link) as the row. */\n asChild?: boolean;\n children?: ReactNode;\n className?: string;\n}\n\nconst SUB_HEIGHT: Record<NavItemDensity, string> = { comfortable: 'h-11', compact: 'h-10' };\n\n/**\n * A child row under a `NavItem` that opens a submenu — Figma `Submenu Item` (node 3465:571).\n * New in 0.9.6.\n *\n * Lighter than its parent on purpose: no card, a 6px radius, secondary text, and a nest\n * line in a 16px column to its left that ties the run of children to the row above.\n */\nexport const NavSubItem = forwardRef<HTMLElement, NavSubItemProps>(function NavSubItem(\n {\n label,\n isActive = false,\n disabled = false,\n last = false,\n density = 'comfortable',\n asChild = false,\n children,\n className,\n onClick,\n ...rest\n },\n ref,\n) {\n const rootProps = {\n ref,\n 'aria-current': asChild && isActive ? ('page' as const) : undefined,\n 'data-state': isActive ? ('active' as const) : undefined,\n 'data-disabled': disabled || undefined,\n 'aria-disabled': disabled || undefined,\n className: clsx(\n 'relative flex w-full items-center gap-3 rounded-md pl-4 pr-3 transition-colors',\n // Figma's focus variant is a 1px brand border on the hover tint. The transparent\n // border holds the 1px at rest so the label does not move when focus arrives.\n 'border border-transparent focus-visible:border-brand focus-visible:bg-brand-secondary focus-visible:text-brand focus-visible:outline-none',\n SUB_HEIGHT[density],\n isActive\n ? 'bg-brand text-brand-on-brand'\n : 'text-default-secondary hover:bg-brand-secondary hover:text-brand',\n 'data-[disabled]:cursor-not-allowed data-[disabled]:text-disabled data-[disabled]:hover:bg-transparent data-[disabled]:hover:text-disabled',\n className,\n ),\n ...rest,\n ...(disabled ? { tabIndex: -1 } : {}),\n onClick: (event: React.MouseEvent<HTMLElement>) => {\n if (disabled) {\n event.preventDefault();\n return;\n }\n onClick?.(event);\n },\n };\n\n const content = (\n <>\n <NestIndicator last={last} />\n <span className=\"min-w-0 flex-1 truncate text-body font-regular\">{label}</span>\n </>\n );\n\n if (asChild) {\n return (\n <Slot wrapChildren={() => content} {...rootProps}>\n {children}\n </Slot>\n );\n }\n return <span {...rootProps}>{content}</span>;\n});\n\n/**\n * Figma `Nest indicator` (node 3613:2003): a 1px line down the middle of a 16px column, the\n * full row height — or, on the last child, down to the middle and then right into the row.\n * Drawn with borders rather than shipped as an SVG so it takes the row's height, whichever\n * density that is. The colour is the file's own, `stone-400`.\n */\nfunction NestIndicator({ last }: { last: boolean }) {\n return (\n <span aria-hidden className=\"relative w-4 shrink-0 self-stretch\">\n <span\n className={clsx(\n 'absolute left-1/2 top-0 w-px -translate-x-1/2 bg-[var(--prim-stone-400)]',\n last ? 'h-1/2' : 'h-full',\n )}\n />\n {last && <span className=\"absolute left-1/2 right-0 top-1/2 h-px bg-[var(--prim-stone-400)]\" />}\n </span>\n );\n}\n\n// ── NavGroupHeader ─────────────────────────────────────────────────────────────\n\nexport interface NavGroupHeaderProps extends HTMLAttributes<HTMLDivElement> {\n title: string;\n /**\n * Open state of the group below. Pass it, with `onOpenChange`, and the header grows the\n * chevron button that collapses the group; leave both out for a plain heading.\n */\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n /** Id of the region the chevron controls, for `aria-controls`. */\n controls?: string;\n /** Trailing slot, e.g. an \"add\" icon button. Figma's `trailingButton`. */\n action?: ReactNode;\n}\n\n/**\n * The heading above a sidebar group — Figma `Sidebar Nav Header` (node 3468:5154). New in\n * 0.9.6, replacing the uppercase eyebrow the sidebar drew before: Body Base, sentence case,\n * neutral-tertiary.\n */\nexport const NavGroupHeader = forwardRef<HTMLDivElement, NavGroupHeaderProps>(function NavGroupHeader(\n { title, open, onOpenChange, controls, action, className, ...rest },\n ref,\n) {\n const collapsible = open !== undefined && onOpenChange !== undefined;\n return (\n <div ref={ref} className={clsx('flex items-center gap-2 pl-2.5', className)} {...rest}>\n {collapsible && (\n <button\n type=\"button\"\n aria-expanded={open}\n aria-controls={controls}\n aria-label={`${open ? 'Collapse' : 'Expand'} ${title}`}\n onClick={() => onOpenChange(!open)}\n className={clsx(\n 'flex shrink-0 items-center justify-center rounded-full p-1 text-icon-default-secondary transition-colors',\n 'hover:bg-brand-tertiary-hover hover:text-icon-brand',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default-secondary',\n )}\n >\n <ChevronDownIcon\n aria-hidden\n className={clsx(\n 'size-4 transition-transform motion-reduce:transition-none',\n !open && '-rotate-90',\n )}\n />\n </button>\n )}\n <p className=\"min-w-0 flex-1 truncate text-body font-regular text-neutral-tertiary\">{title}</p>\n {action != null && <div className=\"flex shrink-0 items-center\">{action}</div>}\n </div>\n );\n});\n","import {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useState,\n type AnchorHTMLAttributes,\n type ComponentType,\n type HTMLAttributes,\n type MouseEvent as ReactMouseEvent,\n type ReactNode,\n type RefAttributes,\n} from 'react';\nimport { DropdownMenu as DropdownMenuPrimitive } from 'radix-ui';\nimport {\n ChevronDownIcon,\n ChevronLeftIcon,\n ChevronRightIcon,\n EllipsisVerticalIcon,\n LogOutIcon,\n MenuIcon,\n} from 'lucide-react';\nimport clsx from 'clsx';\n\nimport { cn } from '../../lib/cn';\nimport { useControllableState } from '../../lib/use-controllable-state';\nimport { useMediaQuery } from '../../lib/use-media-query';\nimport { Avatar } from '../avatar/avatar';\nimport { ScrollArea } from '../cards/scroll-area';\nimport { IconButton, type IconButtonProps } from '../forms/icon-button';\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuTrigger,\n} from '../overlays/dropdown-menu';\nimport { Drawer } from '../overlays/drawer';\nimport { OVERLAY_ITEM_BASE, OVERLAY_ITEM_SIZE, overlayItemTone } from '../overlays/menu-styles';\nimport { Tooltip } from '../overlays/tooltip';\nimport {\n NavGroupHeader,\n NavItem,\n NavSubItem,\n type NavItemDensity,\n type NavItemSize,\n type NavItemVariant,\n} from './nav-item';\n\n// ── Types ──────────────────────────────────────────────────────────────────────\n\nexport interface SidebarNavItem {\n /** Stable key. Falls back to `to`, then `href`, then `label`. New in 0.9.6. */\n id?: string;\n /**\n * An in-app destination, rendered through `linkComponent`. May carry a hash\n * (`/docs/floating#tooltip`) to link to a section of a page: that row is current only when\n * the hash matches too, and the page's own plain row steps aside while it is. Optional from\n * 0.9.6, so a row can exist only to open its `children`.\n */\n to?: string;\n /**\n * An external destination, opened in a new tab as a plain `<a>`. New in 0.9.6. Use `to`\n * for anything inside the app.\n */\n href?: string;\n label: string;\n /** Optional — a collapsed row without one falls back to a monogram of its label. */\n icon?: ReactNode;\n /** Red dot on the row — something new behind this destination. */\n indicator?: boolean;\n /** Match the path exactly rather than as a prefix. Needed for an index route. */\n end?: boolean;\n /**\n * A destination that exists but cannot be opened right now (coming soon). The row is\n * dimmed, announced with `aria-disabled`, out of the tab order, and refuses the press.\n * Something the user has no permission for should not be in the list at all: see\n * `filterNav`.\n */\n disabled?: boolean;\n /**\n * Overrides route matching, for a row whose \"current\" rule is more than a path prefix —\n * one page reached from two places, say. New in 0.9.6.\n */\n isActive?: boolean;\n /**\n * Child rows, one level deep. Expanded they open under the row; on the collapsed rail the\n * row opens them as a flyout menu. New in 0.9.6.\n */\n children?: SidebarNavItem[];\n /** Whether the children start open. Default: open when one of them is the current route. */\n defaultOpen?: boolean;\n}\n\nexport interface SidebarNavGroup {\n /** Stable key. Falls back to `title`. New in 0.9.6. */\n id?: string;\n /**\n * Heading above the group. Omit for an ungrouped run of rows.\n *\n * Kept in the accessibility tree when the rail is collapsed rather than dropped: it is the\n * only thing saying what the run of icons below it has in common.\n */\n title?: string;\n items: SidebarNavItem[];\n /** Give the heading a chevron that folds the group away. Needs a `title`. New in 0.9.6. */\n collapsible?: boolean;\n /** With `collapsible`: whether the group starts open. Default `true`. */\n defaultOpen?: boolean;\n /** Trailing slot in the heading — an \"add\" icon button, say. New in 0.9.6. */\n action?: ReactNode;\n}\n\nexport interface SidebarLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {\n href: string;\n}\n\n/**\n * Renders an in-app row's link. It must forward its ref to the anchor — the collapsed rail\n * anchors a tooltip to it and the flyout a menu item — as `next/link` and react-router's\n * `Link` both do.\n */\nexport type SidebarLinkComponent = ComponentType<SidebarLinkProps & RefAttributes<HTMLAnchorElement>>;\n\nexport interface SidebarRenderState {\n collapsed: boolean;\n density: NavItemDensity;\n}\n\nexport interface SidebarProps {\n /** The scrolling nav. One untitled group is a flat list. */\n groups: SidebarNavGroup[];\n /** Rows pinned below the scrolling nav — settings, help, a feedback link. */\n footerNav?: SidebarNavItem[];\n /**\n * Brand lockup. Given a function it receives `collapsed` and `density`, so the caller can\n * swap a full lockup for a mark alone rather than having one squeezed into the rail.\n */\n brand?: ReactNode | ((state: SidebarRenderState) => ReactNode);\n /** Bottom slot — a `SidebarUserCard`, a version pill, nothing. A function gets the state. */\n footer?: ReactNode | ((state: SidebarRenderState) => ReactNode);\n /**\n * Figma's two sidebar variants. `comfortable` (default): 44px card rows, an 80px rail.\n * `compact`: 40px plain rows, a 72px rail. New in 0.9.6.\n */\n density?: NavItemDensity;\n /**\n * Whether the rail can collapse at all. `false` locks it open: no toggle button, and\n * `collapsed` is ignored rather than half honoured.\n */\n collapsible?: boolean;\n /** Controlled collapsed state. Omit for uncontrolled. */\n collapsed?: boolean;\n /** Initial collapsed state when uncontrolled. */\n defaultCollapsed?: boolean;\n onCollapsedChange?: (collapsed: boolean) => void;\n /**\n * Called by the collapse toggle. Kept from before 0.9.6, when `collapsed` was always\n * controlled: passing `collapsed` with neither this nor `onCollapsedChange` still means\n * \"no toggle button\".\n */\n onToggle?: () => void;\n /**\n * localStorage key the collapsed state is remembered under, so it survives a reload.\n * Read after mount, so server and client render the same first frame. New in 0.9.6.\n */\n storageKey?: string;\n /** The current pathname, which decides the current row. New in 0.9.6. */\n currentPath?: string;\n /** The current hash, for rows that link to a section (`#tooltip`). */\n currentHash?: string;\n /** Renders in-app links. Default a plain `<a>`; pass `next/link` or a router link. */\n linkComponent?: SidebarLinkComponent;\n /** Called when a row is pressed — after the mobile drawer has closed itself. */\n onNavigate?: () => void;\n /** Accessible name of the sidebar landmark. Default \"Primary\". */\n label?: string;\n /** @deprecated Use `density`. `plain` maps to `compact`; `size` is ignored. */\n size?: NavItemSize;\n /** @deprecated Use `density`. `plain` maps to `compact`, `card` to `comfortable`. */\n variant?: NavItemVariant;\n /** Expanded width, as a Tailwind class. Default `w-80` (320px). */\n width?: string;\n /** Collapsed width. Default `w-20` (80px) comfortable, `w-[72px]` compact. */\n collapsedWidth?: string;\n className?: string;\n}\n\n// ── State ──────────────────────────────────────────────────────────────────────\n\n/** Below `md` the sidebar leaves the page and becomes a drawer. One breakpoint, in CSS and JS. */\nconst MOBILE_QUERY = '(max-width: 767.98px)';\n\nexport interface SidebarContextValue {\n collapsed: boolean;\n setCollapsed: (collapsed: boolean) => void;\n toggleCollapsed: () => void;\n /** The drawer the sidebar becomes below `md`. */\n mobileOpen: boolean;\n setMobileOpen: (open: boolean) => void;\n /** Whether the viewport is below `md`, so the sidebar is the drawer. */\n isMobile: boolean;\n}\n\nconst SidebarContext = createContext<SidebarContextValue | null>(null);\n\n/** The sidebar's state, for a header button or a layout that reacts to it. */\nexport function useSidebar(): SidebarContextValue {\n const value = useContext(SidebarContext);\n if (!value) throw new Error('useSidebar must be used inside <SidebarProvider>');\n return value;\n}\n\nexport interface SidebarProviderProps {\n children: ReactNode;\n collapsed?: boolean;\n defaultCollapsed?: boolean;\n onCollapsedChange?: (collapsed: boolean) => void;\n /** See `SidebarProps.storageKey`. */\n storageKey?: string;\n mobileOpen?: boolean;\n defaultMobileOpen?: boolean;\n onMobileOpenChange?: (open: boolean) => void;\n}\n\nfunction readStored(key: string): boolean | null {\n try {\n const value = window.localStorage.getItem(key);\n return value === 'true' ? true : value === 'false' ? false : null;\n } catch {\n // Private mode, blocked storage: the sidebar still works, it just forgets.\n return null;\n }\n}\n\nfunction writeStored(key: string, value: boolean) {\n try {\n window.localStorage.setItem(key, String(value));\n } catch {\n // As above.\n }\n}\n\n/**\n * Holds the sidebar's collapsed and mobile-drawer state, so something outside the sidebar —\n * `SidebarTrigger` in an app header — can drive it. New in 0.9.6. Optional: a `Sidebar`\n * without one keeps the same state to itself.\n */\nexport function SidebarProvider({\n children,\n collapsed: collapsedProp,\n defaultCollapsed = false,\n onCollapsedChange,\n storageKey,\n mobileOpen: mobileOpenProp,\n defaultMobileOpen = false,\n onMobileOpenChange,\n}: SidebarProviderProps) {\n const [collapsed, setCollapsedState] = useControllableState({\n value: collapsedProp,\n defaultValue: defaultCollapsed,\n onChange: onCollapsedChange,\n });\n const [mobileOpen, setMobileOpen] = useControllableState({\n value: mobileOpenProp,\n defaultValue: defaultMobileOpen,\n onChange: onMobileOpenChange,\n });\n const isMobile = useMediaQuery(MOBILE_QUERY);\n\n // After mount, not in the initial state: the server has no storage, and a first frame that\n // differs between server and client is a hydration error.\n useEffect(() => {\n if (!storageKey) return;\n const stored = readStored(storageKey);\n if (stored !== null) setCollapsedState(stored);\n }, [storageKey, setCollapsedState]);\n\n const setCollapsed = useCallback(\n (next: boolean) => {\n if (storageKey) writeStored(storageKey, next);\n setCollapsedState(next);\n },\n [storageKey, setCollapsedState],\n );\n\n const value = useMemo<SidebarContextValue>(\n () => ({\n collapsed,\n setCollapsed,\n toggleCollapsed: () => setCollapsed(!collapsed),\n mobileOpen,\n setMobileOpen,\n isMobile,\n }),\n [collapsed, setCollapsed, mobileOpen, setMobileOpen, isMobile],\n );\n\n return <SidebarContext.Provider value={value}>{children}</SidebarContext.Provider>;\n}\n\n// ── Sidebar ────────────────────────────────────────────────────────────────────\n\nconst DefaultLink = forwardRef<HTMLAnchorElement, SidebarLinkProps>(function DefaultLink(\n { children, ...rest },\n ref,\n) {\n return (\n <a ref={ref} {...rest}>\n {children}\n </a>\n );\n});\n\ninterface RowContext {\n density: NavItemDensity;\n collapsed: boolean;\n path?: string;\n hash?: string;\n hashTargets: Set<string>;\n Link: SidebarLinkComponent;\n onNavigate: () => void;\n}\n\nconst Row = createContext<RowContext | null>(null);\n\nfunction useRow(): RowContext {\n const value = useContext(Row);\n if (!value) throw new Error('Sidebar rows must be rendered by <Sidebar>');\n return value;\n}\n\n/**\n * The application nav rail: brand, a grouped list of destinations, and a footer. Figma\n * `Sidebar` (node 3123:278), in both its densities and both its states.\n *\n * New on the main entry in 0.9.6, router-agnostic: the app says where it is (`currentPath`)\n * and how to link (`linkComponent`). `AppSidebar` on `@platned/ui/sidebar` is this, wired to\n * react-router.\n *\n * It renders what it is given and decides nothing about who may see it. A permission-gated\n * nav passes its config through `filterNav` first.\n *\n * Below `md` it becomes a left drawer, opened by `SidebarTrigger`, and closes itself when a\n * row is pressed.\n */\nexport function Sidebar(props: SidebarProps) {\n const outer = useContext(SidebarContext);\n if (outer) return <SidebarRoot {...props} context={outer} ownsState={false} />;\n return (\n <SidebarProvider\n collapsed={props.collapsed}\n defaultCollapsed={props.defaultCollapsed}\n onCollapsedChange={props.onCollapsedChange}\n storageKey={props.storageKey}\n >\n <SidebarFromContext {...props} />\n </SidebarProvider>\n );\n}\n\nfunction SidebarFromContext(props: SidebarProps) {\n return <SidebarRoot {...props} context={useSidebar()} ownsState />;\n}\n\nfunction SidebarRoot({\n groups,\n footerNav,\n brand,\n footer,\n density: densityProp,\n collapsible = true,\n collapsed: collapsedProp,\n onCollapsedChange,\n onToggle,\n currentPath,\n currentHash,\n linkComponent = DefaultLink,\n onNavigate,\n label = 'Primary',\n variant,\n width = 'w-80',\n collapsedWidth,\n className,\n context,\n ownsState,\n}: SidebarProps & { context: SidebarContextValue; ownsState: boolean }) {\n const density: NavItemDensity = densityProp ?? (variant === 'plain' ? 'compact' : 'comfortable');\n const asideId = useId();\n const { isMobile, setMobileOpen } = context;\n\n // The drawer is always the full sidebar: a phone has the room, and an icon rail there would\n // only hide the labels behind tooltips that touch cannot open.\n const collapsed = !isMobile && collapsible && (collapsedProp ?? context.collapsed);\n // Controlled with no way to report a change means the caller does not want a toggle.\n const showToggle =\n collapsible && !isMobile && (collapsedProp === undefined || onToggle != null || onCollapsedChange != null);\n\n const toggle = () => {\n const next = !collapsed;\n onToggle?.();\n // A provider this sidebar made already reports through `onCollapsedChange`.\n if (!ownsState) onCollapsedChange?.(next);\n context.setCollapsed(next);\n };\n\n const hashTargets = useMemo(\n () =>\n new Set(\n [...groups.flatMap((group) => group.items), ...(footerNav ?? [])]\n .flatMap((item) => [item, ...(item.children ?? [])])\n .map((item) => item.to)\n .filter((to): to is string => to?.includes('#') ?? false),\n ),\n [groups, footerNav],\n );\n\n const row = useMemo<RowContext>(\n () => ({\n density,\n collapsed,\n path: currentPath,\n hash: currentHash,\n hashTargets,\n Link: linkComponent,\n onNavigate: () => {\n if (isMobile) setMobileOpen(false);\n onNavigate?.();\n },\n }),\n [density, collapsed, currentPath, currentHash, hashTargets, linkComponent, isMobile, setMobileOpen, onNavigate],\n );\n\n const state = { collapsed, density };\n const comfortable = density === 'comfortable';\n\n const panel = (\n <aside\n id={asideId}\n aria-label={label}\n data-density={density}\n data-collapsed={collapsed || undefined}\n className={cn(\n 'relative flex h-full shrink-0 flex-col justify-between bg-default-secondary py-2',\n 'transition-[width] duration-200 motion-reduce:transition-none',\n isMobile\n ? 'w-full'\n : clsx(\n 'rounded-xl border-r border-default',\n collapsed ? (collapsedWidth ?? (comfortable ? 'w-20' : 'w-[72px]')) : width,\n ),\n className,\n )}\n >\n {showToggle && (\n <button\n type=\"button\"\n aria-label={collapsed ? 'Expand sidebar' : 'Collapse sidebar'}\n aria-expanded={!collapsed}\n aria-controls={asideId}\n onClick={toggle}\n className={cn(\n 'absolute -right-3 top-5 z-raised flex size-6 items-center justify-center rounded-full',\n 'border border-default bg-default text-default-secondary',\n // Not `hover:bg-default-hover` — that is #F5F5F5, exactly the rail colour, and\n // this button straddles the rail edge, so half of it dissolved into the rail on\n // hover. Same hover vocabulary as the rows instead.\n 'shadow-100 transition-colors hover:bg-brand-tertiary-hover hover:text-brand',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default',\n )}\n >\n {collapsed ? (\n <ChevronRightIcon className=\"size-3\" strokeWidth={2.5} aria-hidden />\n ) : (\n <ChevronLeftIcon className=\"size-3\" strokeWidth={2.5} aria-hidden />\n )}\n </button>\n )}\n\n {/* Figma's \"Top\": the brand and the nav, 4px apart, 12px clear of the footer. */}\n <div className=\"flex min-h-0 flex-1 flex-col gap-1 pb-3\">\n {brand && (\n <div\n className={cn(\n 'flex shrink-0 items-center overflow-hidden p-4',\n collapsed ? 'justify-center' : 'gap-2.5',\n )}\n >\n {typeof brand === 'function' ? brand(state) : brand}\n </div>\n )}\n\n <ScrollArea axis=\"vertical\" label=\"Sidebar navigation\" className=\"min-h-0 flex-1\">\n <Row.Provider value={row}>\n {/* Figma: 16px between groups and 8px above the first when comfortable, 8px and\n none when compact. Groups are told apart by that space alone — the frames draw\n no rule between them. */}\n <nav aria-label=\"Main\" className={cn('flex flex-col px-4', comfortable ? 'gap-4 pt-2' : 'gap-2')}>\n {groups.map((group, index) => (\n <SidebarGroupView key={group.id ?? group.title ?? `group-${index}`} group={group} />\n ))}\n </nav>\n </Row.Provider>\n </ScrollArea>\n </div>\n\n {(Boolean(footerNav?.length) || footer != null) && (\n <div className=\"flex shrink-0 flex-col\">\n {footerNav && footerNav.length > 0 && (\n <Row.Provider value={row}>\n <nav\n aria-label=\"Secondary\"\n className={cn('flex flex-col px-4 pt-2', comfortable && 'gap-1', collapsed && 'items-center')}\n >\n {footerNav.map((item) => (\n <SidebarRow key={itemKey(item)} item={item} />\n ))}\n </nav>\n </Row.Provider>\n )}\n {typeof footer === 'function' ? footer(state) : footer}\n </div>\n )}\n </aside>\n );\n\n if (isMobile) {\n return (\n <Drawer\n side=\"left\"\n open={context.mobileOpen}\n onOpenChange={setMobileOpen}\n label={label}\n width=\"w-80 max-w-[85vw]\"\n className=\"bg-default-secondary\"\n >\n {panel}\n </Drawer>\n );\n }\n return panel;\n}\n\nfunction itemKey(item: SidebarNavItem): string {\n return item.id ?? item.to ?? item.href ?? item.label;\n}\n\nfunction SidebarGroupView({ group }: { group: SidebarNavGroup }) {\n const { density, collapsed } = useRow();\n const [open, setOpen] = useState(group.defaultOpen ?? true);\n const regionId = useId();\n const foldable = Boolean(group.collapsible && group.title) && !collapsed;\n const comfortable = density === 'comfortable';\n\n return (\n // Figma \"Menu Container\": 8px above and below; 12px (comfortable) or 8px (compact)\n // between the heading and the rows; rows 4px apart when comfortable, touching when compact.\n <div className={cn('flex flex-col py-2', comfortable ? 'gap-3' : 'gap-2')}>\n {group.title &&\n (collapsed ? (\n // No room in the rail, but still the only thing naming the run of icons below.\n <p className=\"sr-only\">{group.title}</p>\n ) : (\n <NavGroupHeader\n title={group.title}\n action={group.action}\n {...(foldable ? { open, onOpenChange: setOpen, controls: regionId } : {})}\n />\n ))}\n {(!foldable || open) && (\n <div id={regionId} className={cn('flex flex-col', comfortable && 'gap-1', collapsed && 'items-center')}>\n {group.items.map((item) => (\n <SidebarRow key={itemKey(item)} item={item} />\n ))}\n </div>\n )}\n </div>\n );\n}\n\n/**\n * Whether a row is the current one. Hash-aware: with rows linking to sections of one page,\n * only the row naming the shown section is current, and the page's plain row steps aside.\n */\nfunction isRowActive(item: SidebarNavItem, row: RowContext): boolean {\n if (item.isActive !== undefined) return item.isActive;\n if (!item.to || row.path === undefined) return false;\n const [path, hash] = item.to.split('#');\n const pathMatches = item.end\n ? row.path === path\n : row.path === path || row.path.startsWith(`${path.replace(/\\/$/, '')}/`);\n if (!pathMatches) return false;\n if (hash !== undefined) return row.hash === `#${hash}`;\n return !row.hashTargets.has(`${row.path}${row.hash ?? ''}`);\n}\n\nfunction SidebarRow({ item }: { item: SidebarNavItem }) {\n const row = useRow();\n if (item.children?.length) {\n return row.collapsed ? <RailParent item={item} /> : <ParentRow item={item} />;\n }\n return <LeafRow item={item} />;\n}\n\n/** Runs the row's own handler, then the sidebar's — unless the row refused the press. */\nfunction navigateHandler(row: RowContext) {\n return (event: ReactMouseEvent<HTMLElement>) => {\n if (!event.defaultPrevented) row.onNavigate();\n };\n}\n\nfunction LeafRow({ item }: { item: SidebarNavItem }) {\n const row = useRow();\n const active = isRowActive(item, row);\n const common = {\n icon: item.icon,\n label: item.label,\n isActive: active,\n indicator: item.indicator,\n disabled: item.disabled,\n collapsed: row.collapsed,\n density: row.density,\n };\n\n let element: ReactNode;\n if (item.href) {\n element = (\n <NavItem asChild {...common} onClick={navigateHandler(row)}>\n {/* eslint-disable-next-line jsx-a11y/anchor-has-content -- asChild: the row fills it with its icon and label. */}\n <a href={item.href} target=\"_blank\" rel=\"noreferrer\" />\n </NavItem>\n );\n } else if (item.to) {\n const { Link } = row;\n element = (\n <NavItem asChild {...common} onClick={navigateHandler(row)}>\n <Link href={item.to} />\n </NavItem>\n );\n } else {\n // Nowhere to go and nothing to open: a label, not a control.\n return <NavItem {...common} />;\n }\n\n // Only when collapsed. Expanded, the label is already on screen and a tooltip repeating it\n // is noise. It wraps the focusable row itself, so it opens for the keyboard as well as the\n // pointer.\n if (!row.collapsed) return element;\n return (\n <Tooltip title={item.label} side=\"right\">\n {element}\n </Tooltip>\n );\n}\n\nfunction ParentRow({ item }: { item: SidebarNavItem }) {\n const row = useRow();\n const children = item.children ?? [];\n const childActive = children.some((child) => isRowActive(child, row));\n const [open, setOpen] = useState(item.defaultOpen ?? childActive);\n const regionId = useId();\n\n // Arriving on a child's route opens its parent, so the current row is never folded away.\n useEffect(() => {\n if (childActive) setOpen(true);\n }, [childActive]);\n\n return (\n <>\n <NavItem\n asChild\n icon={item.icon}\n label={item.label}\n // Open, the current child shows itself; closed, the parent stands in for it.\n isActive={!open && childActive}\n indicator={item.indicator}\n disabled={item.disabled}\n density={row.density}\n trailing={\n <ChevronDownIcon\n className={cn(\n 'text-icon-default-secondary transition-transform motion-reduce:transition-none',\n !open && '-rotate-90',\n )}\n />\n }\n >\n <button type=\"button\" aria-expanded={open} aria-controls={regionId} onClick={() => setOpen(!open)} />\n </NavItem>\n {open && (\n <div id={regionId} className=\"flex flex-col\">\n {children.map((child, index) => (\n <SubRow key={itemKey(child)} item={child} last={index === children.length - 1} />\n ))}\n </div>\n )}\n </>\n );\n}\n\nfunction SubRow({ item, last }: { item: SidebarNavItem; last: boolean }) {\n const row = useRow();\n const common = {\n label: item.label,\n isActive: isRowActive(item, row),\n disabled: item.disabled,\n last,\n density: row.density,\n };\n if (item.href) {\n return (\n <NavSubItem asChild {...common} onClick={navigateHandler(row)}>\n {/* eslint-disable-next-line jsx-a11y/anchor-has-content -- asChild: the row fills it with its icon and label. */}\n <a href={item.href} target=\"_blank\" rel=\"noreferrer\" />\n </NavSubItem>\n );\n }\n if (item.to) {\n const { Link } = row;\n return (\n <NavSubItem asChild {...common} onClick={navigateHandler(row)}>\n <Link href={item.to} />\n </NavSubItem>\n );\n }\n return <NavSubItem {...common} />;\n}\n\nconst FLYOUT_ITEM = clsx(OVERLAY_ITEM_BASE, OVERLAY_ITEM_SIZE.md, 'no-underline');\n\n/**\n * A parent row on the collapsed rail. There is no room to open its children in place, so its\n * square opens them as a menu beside the rail — keyboard-operable, with the parent's label\n * as the menu's heading.\n */\nfunction RailParent({ item }: { item: SidebarNavItem }) {\n const row = useRow();\n const children = item.children ?? [];\n const childActive = children.some((child) => isRowActive(child, row));\n const { Link } = row;\n\n return (\n <DropdownMenu>\n <Tooltip title={item.label} side=\"right\">\n <DropdownMenuTrigger asChild>\n <NavItem\n asChild\n icon={item.icon}\n label={item.label}\n isActive={childActive}\n indicator={item.indicator}\n disabled={item.disabled}\n collapsed\n density={row.density}\n >\n <button type=\"button\" />\n </NavItem>\n </DropdownMenuTrigger>\n </Tooltip>\n <DropdownMenuContent side=\"right\" align=\"start\">\n <DropdownMenuLabel>{item.label}</DropdownMenuLabel>\n {children.map((child) => {\n const active = isRowActive(child, row);\n const className = cn(\n FLYOUT_ITEM,\n overlayItemTone('default', Boolean(child.disabled)),\n active && 'bg-brand text-brand-on-brand hover:bg-brand-hover focus:bg-brand-hover',\n );\n if (!child.to && !child.href) {\n return (\n <DropdownMenuItem key={itemKey(child)} disabled={child.disabled}>\n {child.label}\n </DropdownMenuItem>\n );\n }\n return (\n <DropdownMenuPrimitive.Item\n key={itemKey(child)}\n asChild\n disabled={child.disabled}\n className={className}\n onSelect={() => row.onNavigate()}\n >\n {child.href ? (\n <a href={child.href} target=\"_blank\" rel=\"noreferrer\">\n {child.label}\n </a>\n ) : (\n <Link href={child.to as string} aria-current={active ? 'page' : undefined}>\n {child.label}\n </Link>\n )}\n </DropdownMenuPrimitive.Item>\n );\n })}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n\n// ── SidebarTrigger ─────────────────────────────────────────────────────────────\n\nexport interface SidebarTriggerProps extends Omit<IconButtonProps, 'aria-label' | 'children'> {\n 'aria-label'?: string;\n}\n\n/**\n * The menu button that opens the sidebar's drawer below `md`. New in 0.9.6. Put it in the\n * app header, with a `SidebarProvider` above both. Hidden from `md` up, where the sidebar is\n * on the page. Outside a provider it renders nothing (0.9.7), so a header that is also used\n * on its own — in a test, a story — does not need one.\n */\nexport const SidebarTrigger = forwardRef<HTMLButtonElement, SidebarTriggerProps>(function SidebarTrigger(\n { 'aria-label': ariaLabel = 'Open navigation', className, onClick, variant = 'subtle', ...rest },\n ref,\n) {\n const context = useContext(SidebarContext);\n if (!context) return null;\n const { mobileOpen, setMobileOpen } = context;\n return (\n <IconButton\n ref={ref}\n aria-label={ariaLabel}\n aria-expanded={mobileOpen}\n aria-haspopup=\"dialog\"\n variant={variant}\n className={cn('md:hidden', className)}\n onClick={(event) => {\n onClick?.(event);\n if (!event.defaultPrevented) setMobileOpen(!mobileOpen);\n }}\n {...rest}\n >\n <MenuIcon className=\"size-5\" aria-hidden />\n </IconButton>\n );\n});\n\n// ── filterNav ──────────────────────────────────────────────────────────────────\n\ninterface NavTreeItem {\n to?: string;\n href?: string;\n children?: NavTreeItem[];\n}\n\n/**\n * The nav a user may see: drops every item `isVisible` refuses, then every parent left with\n * no children and nowhere of its own to go, then every group left empty. New in 0.9.6.\n *\n * The sidebar does not know about permissions and should not; this is where an app's rule\n * meets its nav config. Hiding a row is not access control — the route and the API still\n * have to refuse.\n *\n * const visible = filterNav(navConfig, (item) => !item.requires || item.requires.some(can));\n */\nexport function filterNav<G extends { items: NavTreeItem[] }>(\n groups: readonly G[],\n isVisible: (item: G['items'][number]) => boolean,\n): G[] {\n return groups\n .map((group) => ({ ...group, items: filterNavItems(group.items, isVisible) }))\n .filter((group) => group.items.length > 0);\n}\n\n/** `filterNav` for a single list of items, e.g. `footerNav`. */\nexport function filterNavItems<I extends NavTreeItem>(items: readonly I[], isVisible: (item: I) => boolean): I[] {\n return items.flatMap((item) => {\n if (!isVisible(item)) return [];\n if (!item.children) return [item];\n const children = filterNavItems(item.children as I[], isVisible);\n if (children.length === 0 && !item.to && !item.href) return [];\n return [{ ...item, children }];\n });\n}\n\n// ── SidebarSeparator ───────────────────────────────────────────────────────────\n\nexport type SidebarSeparatorProps = HTMLAttributes<HTMLDivElement>;\n\n/**\n * A rule for the sidebar's `footer` slot or a hand-composed rail. The sidebar itself no\n * longer draws one between groups from 0.9.6 — the Figma frames separate groups by space.\n *\n * Decorative by default. Pass `role=\"separator\"` through where it marks a grouping nothing\n * else names.\n */\nexport function SidebarSeparator({ className, ...rest }: SidebarSeparatorProps) {\n return <div aria-hidden className={cn('mx-1 h-px shrink-0 bg-divider', className)} {...rest} />;\n}\n\n// ── SidebarUserCard ────────────────────────────────────────────────────────────\n\nexport interface SidebarUserCardProps {\n name: string;\n role: string;\n onLogout: () => void;\n collapsed?: boolean;\n /** Extra menu entries above Sign out. */\n menu?: ReactNode;\n className?: string;\n}\n\n/**\n * The signed-in user block, for the sidebar's `footer` slot — Figma `UserCard` (node\n * 3123:156). On the main entry from 0.9.6; `@platned/ui/sidebar` still exports it.\n *\n * Its menu is `DropdownMenu`, which portals, so the collapsed rail does not clip it.\n */\nexport function SidebarUserCard({\n name,\n role,\n onLogout,\n collapsed = false,\n menu,\n className,\n}: SidebarUserCardProps) {\n const initial = name.trim().charAt(0);\n\n const items = (\n <>\n {menu}\n <DropdownMenuItem icon={<LogOutIcon className=\"size-3.5\" aria-hidden />} onSelect={onLogout}>\n Sign out\n </DropdownMenuItem>\n </>\n );\n\n if (collapsed) {\n return (\n // Figma collapsed user card: the avatar alone, 24px above and 16px below.\n <div className={cn('flex shrink-0 items-center justify-center px-4 pb-4 pt-6', className)}>\n <DropdownMenu>\n <DropdownMenuTrigger asChild label=\"User options\">\n <button type=\"button\" aria-label={`${name} — user options`} className=\"rounded-full\">\n <Avatar initial={initial} size=\"lg\" shape=\"circle\" />\n </button>\n </DropdownMenuTrigger>\n <DropdownMenuContent side=\"right\" align=\"end\">\n {items}\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n );\n }\n\n return (\n // Figma: 16px padding, plus 4px more above and below the row inside it.\n <div className={cn('flex shrink-0 items-center gap-2.5 px-4 py-5', className)}>\n <Avatar initial={initial} size=\"lg\" shape=\"circle\" />\n <div className=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <span className=\"truncate text-body-sm font-semibold leading-snug text-default\">{name}</span>\n <span className=\"truncate text-body-tiny font-regular leading-none text-default-secondary\">{role}</span>\n </div>\n <DropdownMenu>\n <DropdownMenuTrigger asChild label=\"User options\">\n <button\n type=\"button\"\n aria-label={`${name} — user options`}\n // `hover:bg-default-hover` here was #F5F5F5 on a #F5F5F5 rail — no hover at all.\n className=\"flex size-6 shrink-0 items-center justify-center rounded-md text-default-secondary transition-colors hover:bg-brand-tertiary-hover hover:text-brand\"\n >\n <EllipsisVerticalIcon className=\"size-5\" aria-hidden />\n </button>\n </DropdownMenuTrigger>\n <DropdownMenuContent side=\"top\" align=\"end\">\n {items}\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n );\n}\n","import { useCallback, useSyncExternalStore } from 'react';\n\n/**\n * Whether a CSS media query matches, kept in sync as the viewport changes.\n *\n * `false` on the server and wherever `matchMedia` is missing — jsdom has none, and a\n * consumer's test setup should not have to polyfill it for a component to render — so the\n * first client render agrees with the server's and hydration does not warn.\n */\nexport function useMediaQuery(query: string): boolean {\n const subscribe = useCallback(\n (onChange: () => void) => {\n if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') return () => {};\n const list = window.matchMedia(query);\n list.addEventListener('change', onChange);\n return () => list.removeEventListener('change', onChange);\n },\n [query],\n );\n const getSnapshot = () =>\n typeof window !== 'undefined' && typeof window.matchMedia === 'function'\n ? window.matchMedia(query).matches\n : false;\n return useSyncExternalStore(subscribe, getSnapshot, () => false);\n}\n","import clsx from 'clsx';\nimport type { ReactNode } from 'react';\n\nexport type EyebrowLabelVariant = 'uppercase' | 'plain';\n\nexport interface EyebrowLabelProps {\n children: ReactNode;\n /**\n * `uppercase` is the dominant form (nine of twelve source copies).\n * `plain` covers the entity-detail / reviewer-detail variant, whose label text is\n * already capitalised in the source string.\n */\n variant?: EyebrowLabelVariant;\n className?: string;\n}\n\n/**\n * Small semibold label above a group of fields.\n *\n * Replaces twelve copies across three variants:\n * `mb-2 text-body-tiny font-semibold uppercase tracking-wide …` (×9)\n * `text-[11px] font-semibold … tracking-wide` (×5, entity/reviewer detail)\n * `text-body-tiny font-semibold uppercase tracking-wider` (×2, entity onboarding)\n *\n * `text-body-tiny` is 11px, so the `text-[11px]` variant collapses into it exactly.\n * The `tracking-wider` copies become `tracking-wide` — a 0.0125em difference at 11px,\n * i.e. sub-pixel.\n */\nexport function EyebrowLabel({ children, variant = 'uppercase', className }: EyebrowLabelProps) {\n return (\n <p\n data-variant={variant}\n className={clsx(\n 'text-body-tiny font-semibold tracking-wide text-default-secondary',\n variant === 'uppercase' && 'uppercase',\n className,\n )}\n >\n {children}\n </p>\n );\n}\n","import { forwardRef, type HTMLAttributes } from 'react';\nimport clsx from 'clsx';\n\nexport type SeparatorOrientation = 'horizontal' | 'vertical';\n\nexport interface SeparatorProps extends HTMLAttributes<HTMLDivElement> {\n orientation?: SeparatorOrientation;\n /**\n * `true` when the rule is purely visual, which is the common case. A decorative\n * separator is `role=\"none\"` and stays out of the accessibility tree; a semantic one\n * is `role=\"separator\"` and announces a break between groups.\n */\n decorative?: boolean;\n}\n\n/**\n * A hairline rule. Matches Figma's `Menu Separator`, generalised to both orientations.\n *\n * Drawn as a filled element rather than a border, because a 1px border on a flex child\n * collapses to nothing at some zoom levels while a `1px` height does not — which is why\n * the preset carries a `divider` background token separate from `border-default`.\n */\nexport const Separator = forwardRef<HTMLDivElement, SeparatorProps>(function Separator(\n { orientation = 'horizontal', decorative = true, className, ...rest },\n ref,\n) {\n return (\n <div\n ref={ref}\n role={decorative ? 'none' : 'separator'}\n aria-orientation={decorative ? undefined : orientation}\n data-slot=\"separator\"\n className={clsx(\n 'shrink-0 bg-divider',\n orientation === 'horizontal' ? 'h-px w-full' : 'h-full w-px',\n className,\n )}\n {...rest}\n />\n );\n});\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport clsx from 'clsx';\n\nexport type KbdSize = 'sm' | 'md';\n\nexport interface KbdProps extends HTMLAttributes<HTMLElement> {\n children: ReactNode;\n size?: KbdSize;\n}\n\nconst SIZE: Record<KbdSize, string> = {\n sm: 'h-4 min-w-4 px-1 text-body-tiny',\n md: 'h-5 min-w-5 px-1.5 text-body-xs',\n};\n\n/**\n * A keyboard key. Matches Figma's `Menu Shortcut`.\n *\n * Renders a real `<kbd>` so assistive tech announces it as key input rather than as a\n * stray glyph — `⌘K` read as plain text is \"place of interest sign K\".\n *\n * Pass one key per element and let the caller supply the joiner, so a shortcut reads as\n * separate keys instead of one run-together string:\n *\n * <Kbd>⌘</Kbd><Kbd>K</Kbd>\n */\nexport const Kbd = forwardRef<HTMLElement, KbdProps>(function Kbd(\n { children, size = 'md', className, ...rest },\n ref,\n) {\n return (\n <kbd\n ref={ref}\n data-slot=\"kbd\"\n className={clsx(\n 'inline-flex items-center justify-center rounded border border-default bg-default-secondary',\n 'font-medium tabular-nums text-default-secondary',\n SIZE[size],\n className,\n )}\n {...rest}\n >\n {children}\n </kbd>\n );\n});\n","import {\n Fragment,\n forwardRef,\n type AnchorHTMLAttributes,\n type HTMLAttributes,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport clsx from 'clsx';\nimport { ChevronRightIcon } from 'lucide-react';\nimport { Slot } from '../../lib/slot';\n\n/** One crumb as data. New in 0.8.0. */\nexport interface BreadcrumbItemDef {\n label: ReactNode;\n /** Omit on the current page. */\n href?: string;\n /** Stable key. Default the position, which suits a static trail. */\n id?: string;\n /** Default: the last crumb is the current page. */\n current?: boolean;\n}\n\nexport interface BreadcrumbProps extends HTMLAttributes<HTMLElement> {\n /** The parts: `BreadcrumbItem`s. Omit when passing `items`. */\n children?: ReactNode;\n /**\n * The trail as data, root first, rendered as `BreadcrumbItem`s. New in 0.8.0. The last crumb\n * is the current page unless an item says otherwise. Use it or `children`, not both.\n */\n items?: readonly BreadcrumbItemDef[];\n /**\n * With `items`: render each link yourself, e.g. a router `Link`. It becomes the crumb through\n * `asChild`, so it gets the crumb styling. Default a plain `<a href>`.\n */\n renderLink?: (item: BreadcrumbItemDef) => ReactElement;\n /**\n * With `items`: collapse the middle of a longer trail into `BreadcrumbEllipsis`, keeping the\n * root and the last `maxItems - 1` crumbs (MUI's `maxItems`). Default: never collapse.\n */\n maxItems?: number;\n /** Names the landmark. Default `Breadcrumb`. */\n label?: string;\n}\n\n/**\n * Breadcrumb trail.\n *\n * A `<nav>` wrapping an ordered list, which is the whole semantic point: the order *is* the\n * hierarchy, so `<ol>` says something `<div>` cannot, and the landmark lets a screen reader\n * user jump to the trail without walking the header.\n *\n * The separators are `aria-hidden` and generated by the list, not passed in — a chevron\n * announced between every crumb is noise, and the `/` characters people usually hand-type\n * get read out one by one.\n */\nexport const Breadcrumb = forwardRef<HTMLElement, BreadcrumbProps>(function Breadcrumb(\n { children, items, renderLink, maxItems, label = 'Breadcrumb', className, ...rest },\n ref,\n) {\n return (\n <nav ref={ref} aria-label={label} data-slot=\"breadcrumb\" {...rest}>\n <ol className={clsx('flex flex-wrap items-center gap-1.5 p-0 text-body-xs', className)}>\n {items ? renderItems(items, renderLink, maxItems) : children}\n </ol>\n </nav>\n );\n});\n\nfunction renderItems(\n items: readonly BreadcrumbItemDef[],\n renderLink: BreadcrumbProps['renderLink'],\n maxItems: number | undefined,\n) {\n const last = items.length - 1;\n const collapse = maxItems !== undefined && maxItems >= 2 && items.length > maxItems;\n const shown = collapse ? [0, ...items.map((_, i) => i).slice(items.length - (maxItems - 1))] : items.map((_, i) => i);\n\n return shown.map((index, position) => {\n const item = items[index];\n const current = item.current ?? index === last;\n const crumb =\n !current && renderLink ? (\n <BreadcrumbItem asChild first={position === 0}>\n {renderLink(item)}\n </BreadcrumbItem>\n ) : (\n <BreadcrumbItem href={item.href} current={current} first={position === 0}>\n {item.label}\n </BreadcrumbItem>\n );\n return (\n <Fragment key={item.id ?? index}>\n {crumb}\n {collapse && position === 0 && <BreadcrumbEllipsis />}\n </Fragment>\n );\n });\n}\n\nexport interface BreadcrumbItemProps extends AnchorHTMLAttributes<HTMLAnchorElement> {\n children: ReactNode;\n /**\n * The page you are on. Renders as plain text with `aria-current=\"page\"` rather than a\n * link — a link to the current page is a dead control, and the APG says the last crumb\n * should not be one.\n */\n current?: boolean;\n /** Render a router `Link` instead of an `<a>`. */\n asChild?: boolean;\n /** Suppress the leading separator. Set automatically on the first item you render. */\n first?: boolean;\n}\n\nexport const BreadcrumbItem = forwardRef<HTMLAnchorElement, BreadcrumbItemProps>(\n function BreadcrumbItem({ children, current = false, asChild = false, first = false, className, ...rest }, ref) {\n return (\n <li className=\"flex items-center gap-1.5\">\n {!first && (\n <ChevronRightIcon aria-hidden className=\"size-3.5 shrink-0 text-icon-default-tertiary\" />\n )}\n {current ? (\n <span aria-current=\"page\" className={clsx('font-medium text-default', className)}>\n {children}\n </span>\n ) : asChild ? (\n <Slot\n className={clsx(\n 'rounded text-default-secondary transition-colors hover:text-brand',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default',\n className,\n )}\n {...rest}\n >\n {children}\n </Slot>\n ) : (\n <a\n ref={ref}\n className={clsx(\n 'rounded text-default-secondary transition-colors hover:text-brand',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default',\n className,\n )}\n {...rest}\n >\n {children}\n </a>\n )}\n </li>\n );\n },\n);\n\nexport interface BreadcrumbEllipsisProps extends HTMLAttributes<HTMLSpanElement> {}\n\n/**\n * Stands in for collapsed middle crumbs on a deep trail.\n *\n * A `<span>`, not a button: it is a truncation marker, and making it a disabled control\n * puts an unusable stop in the tab order. If the hidden crumbs need to be reachable, wrap\n * this in a `DropdownMenuTrigger` and list them.\n */\nexport const BreadcrumbEllipsis = forwardRef<HTMLSpanElement, BreadcrumbEllipsisProps>(\n function BreadcrumbEllipsis({ className, ...rest }, ref) {\n return (\n <li className=\"flex items-center gap-1.5\">\n <ChevronRightIcon aria-hidden className=\"size-3.5 shrink-0 text-icon-default-tertiary\" />\n <span\n ref={ref}\n aria-label=\"Collapsed items\"\n className={clsx('px-0.5 text-default-tertiary', className)}\n {...rest}\n >\n …\n </span>\n </li>\n );\n },\n);\n","import { forwardRef, type AnchorHTMLAttributes, type HTMLAttributes, type ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { Slot } from '../../lib/slot';\n\nexport type NavigationMenuOrientation = 'horizontal' | 'vertical';\nexport type NavigationMenuVariant = 'pill' | 'link';\n\nexport interface NavigationMenuProps extends HTMLAttributes<HTMLElement> {\n children: ReactNode;\n orientation?: NavigationMenuOrientation;\n /** Names the nav landmark. Required when a page has more than one `<nav>`. */\n label: string;\n}\n\n/**\n * A navigation landmark wrapping a list of links. Matches Figma's `Navigation Pill List`\n * and `Navigation Button List`.\n *\n * Why the `<nav>` + `<ul>` + `<li>` nesting rather than a flat row of anchors: the list is\n * what makes a screen reader announce \"list, 5 items\" and lets the user jump the whole\n * block. A bare row of links is announced one at a time with no sense of how many there\n * are or where the set ends. The `label` is required for the same reason — an unnamed\n * landmark in a page with a sidebar *and* a top bar is not navigable.\n */\nexport const NavigationMenu = forwardRef<HTMLElement, NavigationMenuProps>(\n function NavigationMenu({ children, orientation = 'horizontal', label, className, ...rest }, ref) {\n return (\n <nav ref={ref} aria-label={label} data-slot=\"navigation-menu\" {...rest}>\n <ul\n className={clsx(\n 'flex list-none p-0',\n orientation === 'vertical' ? 'flex-col gap-1' : 'flex-row items-center gap-1',\n className,\n )}\n >\n {children}\n </ul>\n </nav>\n );\n },\n);\n\nexport interface NavigationMenuItemProps extends AnchorHTMLAttributes<HTMLAnchorElement> {\n children: ReactNode;\n /** Matches Figma's `State: Active`. Sets `aria-current=\"page\"`. */\n active?: boolean;\n variant?: NavigationMenuVariant;\n /** Render a router `Link` instead of an `<a>`. */\n asChild?: boolean;\n /** Leading glyph. Marked decorative automatically. */\n icon?: ReactNode;\n}\n\n/**\n * A single navigation link. Matches Figma's `Navigation Pill` and `Navigation Button`\n * (`State: Default | Active | Hover`).\n *\n * `aria-current=\"page\"` is the point: the filled pill is not announced, so without it a\n * screen reader user cannot tell which page they are on.\n */\nexport const NavigationMenuItem = forwardRef<HTMLAnchorElement, NavigationMenuItemProps>(\n function NavigationMenuItem(\n { children, active = false, variant = 'pill', asChild = false, icon, className, ...rest },\n ref,\n ) {\n const content = (\n <>\n {icon && (\n <span aria-hidden className=\"shrink-0 [&_svg]:size-4\">\n {icon}\n </span>\n )}\n <span className=\"min-w-0 truncate\">{children}</span>\n </>\n );\n\n const linkProps = {\n 'aria-current': active ? ('page' as const) : undefined,\n className: clsx(\n 'inline-flex items-center gap-2 whitespace-nowrap transition-colors',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default',\n variant === 'pill'\n ? clsx(\n 'rounded-lg px-3 py-1.5 text-body-xs font-medium',\n active\n ? 'bg-brand text-brand-on-brand'\n : 'text-default-secondary hover:bg-default-secondary hover:text-default',\n )\n : clsx(\n 'rounded px-1 py-0.5 text-body-sm',\n active\n ? 'font-semibold text-brand'\n : 'text-default-secondary hover:text-default',\n ),\n className,\n ),\n ...rest,\n };\n\n return (\n <li>\n {asChild ? (\n <Slot wrapChildren={() => content} {...linkProps}>\n {children}\n </Slot>\n ) : (\n <a ref={ref} {...linkProps}>\n {content}\n </a>\n )}\n </li>\n );\n },\n);\n","import { forwardRef, type AnchorHTMLAttributes, type HTMLAttributes, type ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { cn } from '../../lib/cn';\nimport { Slot } from '../../lib/slot';\n\n/**\n * The type ramp as components, mirroring Figma's `Text*` primitives one-for-one:\n * `Text`, `Text Strong`, `Text Emphasis`, `Text Small`, `Text Code`, `Text Link`,\n * `Text Heading`, `Text Subheading`, `Text Subtitle`, `Text Title Page`,\n * `Text Title Hero`, `Text List`, `Text List Item`, `Text Link List`.\n *\n * These existed in Figma with settled styles and had no code counterpart, so every\n * consumer reached for a raw `text-body-sm text-default` triplet and the ramp drifted.\n * Each component pins the size/weight/colour combination and nothing else, so layout\n * stays the caller's job.\n *\n * All of them take `asChild`, because the right element is contextual — a `Heading` is an\n * `<h2>` on a page and an `<h3>` inside a card, and only the caller knows the outline.\n */\n\n/**\n * The text colour as a meaning, new in 0.7.0. `muted` and `subtle` are the secondary and\n * tertiary steps; the rest are the status tones. It replaces the\n * `className={denied ? 'text-danger' : 'text-positive'}` that consumers were writing, so state\n * is a prop and the colour stays a token. Omit it to keep each component's own colour.\n */\nexport type TextTone = 'default' | 'muted' | 'subtle' | 'brand' | 'positive' | 'warning' | 'danger';\n\nconst TONE: Record<TextTone, string> = {\n default: 'text-default',\n muted: 'text-default-secondary',\n subtle: 'text-default-tertiary',\n brand: 'text-brand',\n positive: 'text-positive',\n warning: 'text-warning',\n danger: 'text-danger',\n};\n\ntype BaseProps = HTMLAttributes<HTMLElement> & {\n children?: ReactNode;\n asChild?: boolean;\n /** Text colour as a meaning. See `TextTone`. */\n tone?: TextTone;\n};\n\n/** Factory for the plain ramp entries — identical except for element and classes. */\nfunction textComponent(\n displayName: string,\n defaultElement: 'p' | 'span' | 'h1' | 'h2' | 'h3' | 'h4' | 'strong' | 'em' | 'code' | 'q',\n classes: string,\n) {\n const Component = forwardRef<HTMLElement, BaseProps>(function TextComponent(\n { children, asChild = false, tone, className, ...rest },\n ref,\n ) {\n const Root = (asChild ? Slot : defaultElement) as 'p';\n return (\n <Root\n ref={ref as never}\n data-tone={tone}\n // `cn`, so the tone's colour (and then the caller's class) beats the ramp's own.\n className={cn(classes, tone && TONE[tone], className)}\n {...rest}\n >\n {children}\n </Root>\n );\n });\n Component.displayName = displayName;\n return Component;\n}\n\n// ── Body ───────────────────────────────────────────────────────────────────────\n\nexport type TextProps = BaseProps;\n\n/** `Text` — the default body paragraph. */\nexport const Text = textComponent('Text', 'p', 'text-body text-default');\n\n/** `Text Small` — secondary body copy. */\nexport const TextSmall = textComponent('TextSmall', 'p', 'text-body-sm text-default-secondary');\n\n/** `Text Tiny` — the smallest readable step; captions and table meta. */\nexport const TextTiny = textComponent('TextTiny', 'p', 'text-body-tiny text-default-secondary');\n\n/** `Text Strong` — emphasis by weight, in a real `<strong>`. */\nexport const TextStrong = textComponent('TextStrong', 'strong', 'font-semibold text-default');\n\n/** `Text Emphasis` — emphasis by slant, in a real `<em>`. */\nexport const TextEmphasis = textComponent('TextEmphasis', 'em', 'italic text-default');\n\n/** An inline quotation, in a real `<q>` so the browser adds locale-correct quote marks. New in 0.7.0. */\nexport const Quote = textComponent('Quote', 'q', 'italic text-default');\n\n/** `Text Code` — inline monospace. */\nexport const TextCode = textComponent(\n 'TextCode',\n 'code',\n 'rounded border border-default bg-default-secondary px-1 py-0.5 font-mono text-body-xs text-default',\n);\n\n// ── Headings ───────────────────────────────────────────────────────────────────\n\n/** `Text Title Hero` — the largest step, one per page at most. */\nexport const TitleHero = textComponent('TitleHero', 'h1', 'text-title-hero font-bold text-default');\n\n/** `Text Title Page` — page title. */\nexport const TitlePage = textComponent('TitlePage', 'h1', 'text-title font-bold text-default');\n\n/** `Text Subtitle` — a lead paragraph under a title; regular weight by design. */\nexport const Subtitle = textComponent('Subtitle', 'p', 'text-subtitle text-default-secondary');\n\n/** `Text Heading` — section heading. */\nexport const Heading = textComponent('Heading', 'h2', 'text-heading font-semibold text-default');\n\n/** `Text Subheading` — subsection heading; regular weight, matching Figma. */\nexport const Subheading = textComponent('Subheading', 'h3', 'text-subheading text-default');\n\n// ── Blockquote ─────────────────────────────────────────────────────────────────\n\nexport interface BlockquoteProps extends HTMLAttributes<HTMLQuoteElement> {\n children?: ReactNode;\n /** URL of the source, set as the `cite` attribute. Not shown; pair with a visible credit. */\n cite?: string;\n tone?: TextTone;\n}\n\n/**\n * A block quotation, new in 0.7.0, matching Radix Themes' `Blockquote`. A real\n * `<blockquote>`, so assistive tech announces where the quotation starts and ends.\n */\nexport const Blockquote = forwardRef<HTMLQuoteElement, BlockquoteProps>(function Blockquote(\n { children, cite, tone, className, ...rest },\n ref,\n) {\n return (\n <blockquote\n ref={ref}\n cite={cite}\n data-tone={tone}\n className={cn(\n 'border-l-4 border-default pl-4 text-body italic text-default-secondary',\n tone && TONE[tone],\n className,\n )}\n {...rest}\n >\n {children}\n </blockquote>\n );\n});\n\n// ── Link ───────────────────────────────────────────────────────────────────────\n\n/**\n * `brand` (default) is the underlined link for running text. `neutral`, new in 0.9.5, is a\n * default-coloured link that underlines on hover, for links that stand alone in a list or tree\n * (an indented set of names), where a column of brand underlines would be noise. Don't use\n * `neutral` inside a sentence: there, colour and underline are what mark it as a link.\n */\nexport type TextLinkTone = 'brand' | 'neutral';\n\nexport interface TextLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {\n children?: ReactNode;\n asChild?: boolean;\n tone?: TextLinkTone;\n}\n\nconst TEXT_LINK_TONE: Record<TextLinkTone, string> = {\n brand: 'text-brand underline decoration-1 hover:text-brand-secondary',\n neutral: 'text-default no-underline decoration-1 hover:underline',\n};\n\n/**\n * `Text Link`. Underlined rather than colour-only: colour alone is not a sufficient\n * distinction for a link inside a run of text (WCAG 1.4.1).\n */\nexport const TextLink = forwardRef<HTMLAnchorElement, TextLinkProps>(function TextLink(\n { children, asChild = false, tone = 'brand', className, ...rest },\n ref,\n) {\n const Root = (asChild ? Slot : 'a') as 'a';\n return (\n <Root\n ref={ref}\n data-tone={tone}\n className={clsx(\n 'rounded underline-offset-2 transition-colors',\n TEXT_LINK_TONE[tone],\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default',\n className,\n )}\n {...rest}\n >\n {children}\n </Root>\n );\n});\n\n// ── Lists ──────────────────────────────────────────────────────────────────────\n\nexport type TextListVariant = 'bulleted' | 'numbered' | 'plain';\nexport type TextListDensity = 'default' | 'compact';\n\nexport interface TextListProps extends HTMLAttributes<HTMLElement> {\n children?: ReactNode;\n variant?: TextListVariant;\n /** Matches Figma's `Density` axis on `Text List` / `Text Link List`. */\n density?: TextListDensity;\n}\n\nconst LIST_MARKER: Record<TextListVariant, string> = {\n bulleted: 'list-disc pl-5',\n numbered: 'list-decimal pl-5',\n plain: 'list-none pl-0',\n};\n\n/** `Text List` — a real `<ul>`/`<ol>`, so item count is announced. */\nexport const TextList = forwardRef<HTMLElement, TextListProps>(function TextList(\n { children, variant = 'bulleted', density = 'default', className, ...rest },\n ref,\n) {\n const Root = (variant === 'numbered' ? 'ol' : 'ul') as 'ul';\n return (\n <Root\n ref={ref as never}\n className={clsx(\n 'text-body text-default',\n LIST_MARKER[variant],\n density === 'compact' ? 'space-y-0.5' : 'space-y-1.5',\n className,\n )}\n {...rest}\n >\n {children}\n </Root>\n );\n});\n\nexport type TextListItemProps = HTMLAttributes<HTMLLIElement> & { children?: ReactNode };\n\n/** `Text List Item`. */\nexport const TextListItem = forwardRef<HTMLLIElement, TextListItemProps>(function TextListItem(\n { children, className, ...rest },\n ref,\n) {\n return (\n <li ref={ref} className={clsx('text-body text-default', className)} {...rest}>\n {children}\n </li>\n );\n});\n","import { createContext, useContext, type ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { WidgetTitle } from './widget-title';\nimport type { WidgetTitleSize } from './widget-title';\n\n/**\n * Extra chrome a *container* puts in the header's right-hand cluster, e.g. a pinned widget's\n * freshness label and refresh button, without every widget accepting and forwarding a prop for it.\n * It renders after the widget's own badge and action, so they share the row instead of overlapping.\n *\n * The local `accessory` prop wins over the provider: the React Aria rule for context-supplied\n * props. Context-supplied chrome is invisible at the call site, so keep it to containers.\n */\nconst WidgetHeaderAccessoryContext = createContext<ReactNode>(null);\n\nexport interface WidgetHeaderAccessoryProviderProps {\n accessory: ReactNode;\n children: ReactNode;\n}\n\nexport function WidgetHeaderAccessoryProvider({ accessory, children }: WidgetHeaderAccessoryProviderProps) {\n return <WidgetHeaderAccessoryContext.Provider value={accessory}>{children}</WidgetHeaderAccessoryContext.Provider>;\n}\n\n/** The provided accessory, for a widget that draws its own header instead of using `WidgetHeader`. */\nexport function useWidgetHeaderAccessory(): ReactNode {\n return useContext(WidgetHeaderAccessoryContext);\n}\n\nexport type WidgetHeaderEyebrowVariant = 'uppercase' | 'plain';\n\nexport interface WidgetHeaderProps {\n eyebrow?: string;\n eyebrowVariant?: WidgetHeaderEyebrowVariant;\n title: string;\n titleSize?: WidgetTitleSize;\n subtitle?: string;\n badge?: ReactNode;\n action?: ReactNode;\n /**\n * Trailing chrome after `badge` and `action`. Defaults to what an enclosing\n * `WidgetHeaderAccessoryProvider` supplies; pass it to set it locally, or `null` to opt out.\n */\n accessory?: ReactNode;\n className?: string;\n}\n\n// uppercase: 11px/medium/tracked, matches Variation 2 mockups · plain: 13px/regular, matches Variation 1's small label line\nconst eyebrowStyles: Record<WidgetHeaderEyebrowVariant, string> = {\n uppercase: 'text-body-tiny font-medium uppercase tracking-[0.66px] text-default-secondary',\n plain: 'text-body-xs leading-[1.4] text-default-secondary',\n};\n\nexport function WidgetHeader({\n eyebrow,\n eyebrowVariant = 'uppercase',\n title,\n titleSize,\n subtitle,\n badge,\n action,\n accessory: accessoryProp,\n className,\n}: WidgetHeaderProps) {\n const provided = useWidgetHeaderAccessory();\n const accessory = accessoryProp !== undefined ? accessoryProp : provided;\n return (\n <div className={clsx('flex items-start justify-between gap-2', className)}>\n <div className=\"min-w-0 flex-1\">\n {eyebrow && <p className={eyebrowStyles[eyebrowVariant]}>{eyebrow}</p>}\n <WidgetTitle size={titleSize}>{title}</WidgetTitle>\n {subtitle && (\n <p className=\"mt-1 text-body-xs text-default-secondary leading-snug\">{subtitle}</p>\n )}\n </div>\n <div className=\"flex shrink-0 items-center gap-2\">\n {badge}\n {action}\n {accessory}\n </div>\n </div>\n );\n}\n","import type { ReactNode } from 'react';\nimport clsx from 'clsx';\n\nexport type WidgetTitleSize = 'sm' | 'md' | 'lg';\n\nexport interface WidgetTitleProps {\n children: ReactNode;\n size?: WidgetTitleSize;\n className?: string;\n}\n\n// sm: 16px/semibold (default) · md: 18px/bold (Variation 2 mockups) · lg: 20px/semibold (Variation 1 mockups)\nconst sizeStyles: Record<WidgetTitleSize, string> = {\n sm: 'text-subheading-sm font-semibold leading-none',\n // Was `text-[18px]`, which had no step on the type scale (Scale 04 = 16, Scale 05 = 20).\n // Now 20px, so `md` and `lg` are the same size and separate on weight alone — bold vs\n // semibold. That is the intended trade for getting off an off-scale literal.\n md: 'text-subheading font-bold leading-normal',\n lg: 'text-subheading font-semibold leading-[1.2]',\n};\n\nexport function WidgetTitle({ children, size = 'sm', className }: WidgetTitleProps) {\n return (\n <h3 className={clsx(sizeStyles[size], 'text-default', className)}>\n {children}\n </h3>\n );\n}\n","import type { ReactNode } from 'react';\nimport clsx from 'clsx';\n\nexport interface WidgetFooterProps {\n caption?: string;\n subcaption?: string;\n action?: ReactNode;\n className?: string;\n}\n\nexport function WidgetFooter({ caption, subcaption, action, className }: WidgetFooterProps) {\n return (\n <div className={clsx('flex items-center gap-3', className)}>\n {caption && (\n <div className=\"flex items-stretch gap-3 flex-1 min-w-0\">\n <div className=\"w-0.5 shrink-0 self-stretch rounded-full bg-brand\" />\n <div className=\"min-w-0\">\n <p className=\"text-body-sm font-medium text-default leading-snug\">\n {caption}\n </p>\n {subcaption && (\n <p className=\"mt-0.5 text-body-xs text-default-secondary\">{subcaption}</p>\n )}\n </div>\n </div>\n )}\n {action && <div className=\"ml-auto shrink-0\">{action}</div>}\n </div>\n );\n}\n","import type { HTMLAttributes, ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { cn } from '../../lib/cn';\n\n/**\n * The dashboard grid vocabulary, ported from SCIC in 0.7.0: a 12-column row, five widget widths\n * and three canonical card heights. The heights are modular (364 = 170·2 + 24, 752 = 170·4 +\n * 24·3), so two stacked `medium` cards bottom-align with one `large`.\n *\n * Not included: SCIC's drag-and-drop masonry dashboard, which needs `@dnd-kit` and stays in the\n * app until it earns a subpath of its own.\n */\n\n/** Column span within the 12-column grid. */\nexport type ColSize = 'tiny' | 'small' | 'medium' | 'large' | 'full';\n\n/** Canonical widget card heights. */\nexport type WidgetHeight = 'small' | 'medium' | 'large';\n\n/**\n * Viewport-driven spans: everything stacks (tiny tiles pair up 2×2) below `lg`, then the\n * 12-column spans apply. Right when the grid gets the whole viewport. For a grid that shares\n * its row with a rail or drawer, size by its own width: see `useWidthTier` and\n * `COL_SPAN_BY_TIER`.\n */\nexport const COL_SPAN: Record<ColSize, string> = {\n tiny: 'col-span-6 lg:col-span-3',\n small: 'col-span-12 lg:col-span-4',\n medium: 'col-span-12 lg:col-span-6',\n large: 'col-span-12 lg:col-span-8',\n full: 'col-span-12',\n};\n\nexport const HEIGHT_CLASS: Record<WidgetHeight, string> = {\n small: 'h-[170px]',\n medium: 'h-[364px]',\n large: 'h-[752px]',\n};\n\n/** The same heights in px, for layout maths. Keep in step with `HEIGHT_CLASS`. */\nexport const HEIGHT_PX: Record<WidgetHeight, number> = {\n small: 170,\n medium: 364,\n large: 752,\n};\n\nexport interface WidgetGridProps {\n children: ReactNode;\n className?: string;\n}\n\n/** A vertical stack of `WidgetGridRow`s with the dashboard gutters. */\nexport function WidgetGrid({ children, className }: WidgetGridProps) {\n return <div className={cn('flex w-full flex-col gap-3 lg:gap-6', className)}>{children}</div>;\n}\n\nexport interface WidgetGridRowProps {\n children: ReactNode;\n className?: string;\n}\n\n/** A 12-column row. Place `WidgetGridItem`s in it. */\nexport function WidgetGridRow({ children, className }: WidgetGridRowProps) {\n return <div className={cn('grid grid-cols-12 items-start gap-3 lg:gap-6', className)}>{children}</div>;\n}\n\nexport interface WidgetGridItemProps extends HTMLAttributes<HTMLDivElement> {\n /** How many columns the widget claims. */\n size: ColSize;\n /** Fixes the card height to the canonical scale. Omit for content height. */\n height?: WidgetHeight;\n}\n\n/**\n * One widget's cell. Takes `size` and `height` as props, so a dashboard never composes span\n * classes itself. They are also set as `data-size` / `data-height`.\n */\nexport function WidgetGridItem({ size, height, className, ...rest }: WidgetGridItemProps) {\n return (\n <div\n data-size={size}\n data-height={height}\n className={cn(COL_SPAN[size], height && clsx(HEIGHT_CLASS[height], 'min-h-0'), className)}\n {...rest}\n />\n );\n}\n","import type { ColSize } from '../components/widgets/widget-grid';\n\n/**\n * Container-width tiers for grids that cannot use viewport breakpoints, because they share their\n * row with a nav rail or a docked drawer. Pure functions, ported from SCIC in 0.7.0. The hook that\n * measures and debounces is `useWidthTier`.\n */\nexport type GridTier = 'stacked' | 'narrow' | 'standard' | 'wide';\n\nexport const GRID_TIERS: readonly GridTier[] = ['stacked', 'narrow', 'standard', 'wide'];\n\n/** The narrowest width, in px, at which each tier applies. */\nexport const TIER_MIN_PX: Record<GridTier, number> = {\n stacked: 0,\n narrow: 560,\n standard: 760,\n wide: 960,\n};\n\n/**\n * How far past a threshold the width must go before the tier follows. A tier change reflows the\n * grid, which can add or remove the page scrollbar and so change the measured width: a margin\n * narrower than a scrollbar oscillates.\n */\nexport const TIER_HYSTERESIS_PX = 24;\n\n/** Widths are rounded down to this step, so sub-pixel jitter does not re-render. */\nexport const WIDTH_QUANTUM_PX = 8;\n\nexport function quantizeWidth(px: number): number {\n if (!Number.isFinite(px) || px <= 0) return 0;\n return Math.floor(px / WIDTH_QUANTUM_PX) * WIDTH_QUANTUM_PX;\n}\n\n/** The tier for a width, with no hysteresis. */\nexport function tierForWidth(px: number): GridTier {\n if (px >= TIER_MIN_PX.wide) return 'wide';\n if (px >= TIER_MIN_PX.standard) return 'standard';\n if (px >= TIER_MIN_PX.narrow) return 'narrow';\n return 'stacked';\n}\n\n/** The next tier from `current`, holding still inside the hysteresis band. */\nexport function nextTier(current: GridTier, px: number): GridTier {\n let tier = current;\n for (let i = 0; i < GRID_TIERS.length; i += 1) {\n const index = GRID_TIERS.indexOf(tier);\n const up = GRID_TIERS[index + 1];\n if (up && px >= TIER_MIN_PX[up] + TIER_HYSTERESIS_PX) {\n tier = up;\n continue;\n }\n if (index > 0 && px < TIER_MIN_PX[tier] - TIER_HYSTERESIS_PX) {\n tier = GRID_TIERS[index - 1];\n continue;\n }\n break;\n }\n return tier;\n}\n\n/** Columns (of 12) each widget width claims, per tier. */\nexport const TIER_COLS: Record<GridTier, Record<ColSize, number>> = {\n stacked: { tiny: 6, small: 12, medium: 12, large: 12, full: 12 },\n narrow: { tiny: 6, small: 6, medium: 12, large: 12, full: 12 },\n standard: { tiny: 3, small: 6, medium: 6, large: 12, full: 12 },\n wide: { tiny: 3, small: 4, medium: 6, large: 8, full: 12 },\n};\n\n/** `TIER_COLS` as literal classes (Tailwind only emits classes it finds verbatim). */\nexport const COL_SPAN_BY_TIER: Record<GridTier, Record<ColSize, string>> = {\n stacked: { tiny: 'col-span-6', small: 'col-span-12', medium: 'col-span-12', large: 'col-span-12', full: 'col-span-12' },\n narrow: { tiny: 'col-span-6', small: 'col-span-6', medium: 'col-span-12', large: 'col-span-12', full: 'col-span-12' },\n standard: { tiny: 'col-span-3', small: 'col-span-6', medium: 'col-span-6', large: 'col-span-12', full: 'col-span-12' },\n wide: { tiny: 'col-span-3', small: 'col-span-4', medium: 'col-span-6', large: 'col-span-8', full: 'col-span-12' },\n};\n\nexport function colsFor(tier: GridTier, size: ColSize): number {\n return TIER_COLS[tier][size];\n}\n\n/** The pixel width of a cell spanning `cols` of 12, given the grid width and column gap. */\nexport function slotWidthPx(gridWidthPx: number, columnGapPx: number, cols: number): number {\n return (cols * (gridWidthPx + columnGapPx)) / 12 - columnGapPx;\n}\n","import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport { nextTier, quantizeWidth, type GridTier } from './width-tier';\n\nconst useIsomorphicLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect;\n\n/** How long the width must hold still before a new tier commits, so an animating panel commits once. */\nexport const TIER_SETTLE_MS = 200;\n\nexport interface UseWidthTierOptions {\n /** Stop committing new widths, e.g. while a drawer animates. Unfreezing flushes the latest. */\n frozen?: boolean;\n}\n\nexport interface UseWidthTierResult {\n ref: (node: HTMLElement | null) => void;\n /** The quantised width, or `null` before the first measurement. */\n widthPx: number | null;\n tier: GridTier;\n}\n\n/**\n * Measures an element and reports its `GridTier`, debounced and with hysteresis. Ported from\n * SCIC in 0.7.0. Without `ResizeObserver` (jsdom, very old browsers) it measures once on mount\n * rather than throwing.\n */\nexport function useWidthTier({ frozen = false }: UseWidthTierOptions = {}): UseWidthTierResult {\n const [node, setNode] = useState<HTMLElement | null>(null);\n const [{ widthPx, tier }, setMeasured] = useState<{ widthPx: number | null; tier: GridTier }>({\n widthPx: null,\n tier: 'wide',\n });\n\n // The latest observed width, read by a pending commit, so it always lands on the current\n // width rather than a stale one.\n const observed = useRef<number | null>(null);\n const frozenRef = useRef(frozen);\n frozenRef.current = frozen;\n const tierRef = useRef<GridTier>(tier);\n tierRef.current = tier;\n const widthRef = useRef<number | null>(widthPx);\n widthRef.current = widthPx;\n\n const commit = useCallback(() => {\n const raw = observed.current;\n // A hidden subtree measures 0: keep the last value rather than collapsing and snapping back.\n if (raw === null || raw <= 0 || frozenRef.current) return;\n const next = quantizeWidth(raw);\n const nextT = nextTier(tierRef.current, next);\n if (next === widthRef.current && nextT === tierRef.current) return;\n setMeasured({ widthPx: next, tier: nextT });\n }, []);\n\n useIsomorphicLayoutEffect(() => {\n if (!node) return;\n let frame = 0;\n let timer: ReturnType<typeof setTimeout> | undefined;\n\n // Read and commit synchronously: an observer's first callback lands after paint, and the\n // settle delay would hold it longer, so the grid would show frames at a guessed tier.\n observed.current = node.getBoundingClientRect().width;\n commit();\n\n if (typeof ResizeObserver === 'undefined') return;\n const observer = new ResizeObserver((entries) => {\n const entry = entries[0];\n if (entry) observed.current = entry.contentRect.width;\n if (frame) cancelAnimationFrame(frame);\n frame = requestAnimationFrame(() => {\n frame = 0;\n if (timer) clearTimeout(timer);\n timer = setTimeout(commit, TIER_SETTLE_MS);\n });\n });\n observer.observe(node);\n return () => {\n observer.disconnect();\n if (frame) cancelAnimationFrame(frame);\n if (timer) clearTimeout(timer);\n };\n }, [node, commit]);\n\n // Unfreezing flushes the width that changed while frozen: nothing else would pick it up.\n useEffect(() => {\n if (!frozen) commit();\n }, [frozen, commit]);\n\n return { ref: setNode, widthPx, tier };\n}\n","import clsx from 'clsx';\nimport type { ReactElement, ReactNode } from 'react';\nimport { cn } from '../../lib/cn';\nimport { FOCUS_RING } from '../../lib/focus-ring';\nimport { Slot } from '../../lib/slot';\nimport type { StatusTone } from '../status/status-badge';\n\nconst DOT_TONE: Record<StatusTone, string> = {\n neutral: 'bg-status-dot-neutral',\n info: 'bg-status-dot-info',\n warning: 'bg-status-dot-warning',\n caution: 'bg-status-dot-caution',\n accent: 'bg-status-dot-accent',\n violet: 'bg-status-dot-violet',\n positive: 'bg-status-dot-positive',\n danger: 'bg-status-dot-danger',\n};\n\nexport interface StatTileProps {\n label: string;\n value: string | number;\n /** Status tone for the leading dot. Prefer this over `dotColor`. */\n tone?: StatusTone;\n /**\n * @deprecated Pass `tone` instead. A raw colour here bypasses the token layer,\n * which is how competing status palettes drift apart.\n */\n dotColor?: string;\n /** A muted line under the value: a comparison, a unit, \"of 240\". New in 0.7.0, from SCIC. */\n hint?: ReactNode;\n /**\n * Makes the tile a toggle button, for a row of tiles that filter a list below. New in 0.7.0.\n * Pair with `selected`.\n */\n onClick?: () => void;\n /**\n * The tile's filter is the active one. Sets `aria-pressed` (with `onClick`) or `aria-current`\n * (with `asChild`), and `data-state=\"selected\"`, which the tile styles: no conditional border\n * classes needed.\n */\n selected?: boolean;\n /** Render onto the single child instead, e.g. a router `<Link>` to a filtered page. */\n asChild?: boolean;\n /** The element to render onto, with `asChild`. Its own children are replaced by the tile. */\n children?: ReactElement;\n className?: string;\n}\n\n/**\n * A labelled figure: \"Open cases 42\".\n *\n * From 0.7.0 a tile can also be the filter for the list beneath it, which is what Cleo's\n * Companies, Employees and Users screens hand-built with\n * `className={filter === t.f ? 'border-brand …' : ''}`. Give it `onClick` and `selected` and it\n * is a real toggle button (`aria-pressed`), styled from its own state.\n */\nexport function StatTile({\n label,\n value,\n tone,\n dotColor,\n hint,\n onClick,\n selected,\n asChild = false,\n children,\n className,\n}: StatTileProps) {\n const showDot = Boolean(tone || dotColor);\n const interactive = Boolean(onClick) || asChild;\n\n const content = (\n <>\n <span className=\"flex items-center gap-1.5\">\n {showDot && (\n <span\n aria-hidden\n className={clsx('size-2 shrink-0 rounded-full', tone && DOT_TONE[tone])}\n style={tone ? undefined : { backgroundColor: dotColor }}\n />\n )}\n <span className=\"text-body-xs font-medium text-default-secondary whitespace-nowrap\">\n {label}\n </span>\n </span>\n <span className=\"text-heading font-semibold text-default leading-none\">{value}</span>\n {hint && <span className=\"text-body-tiny text-default-secondary\">{hint}</span>}\n </>\n );\n\n const rootProps = {\n 'data-state': selected ? 'selected' : undefined,\n className: cn(\n 'flex flex-col gap-2 rounded-xl border border-default bg-default p-4 text-left',\n interactive && ['cursor-pointer transition-colors hover:border-default-secondary', FOCUS_RING],\n 'data-[state=selected]:border-brand data-[state=selected]:bg-brand-tertiary',\n className,\n ),\n };\n\n if (asChild) {\n return (\n // A link to a filtered view is the current one, not a pressed toggle: `aria-pressed` is\n // only valid on a button.\n <Slot {...rootProps} aria-current={selected ? 'true' : undefined} wrapChildren={() => content}>\n {children}\n </Slot>\n );\n }\n\n if (onClick) {\n return (\n <button type=\"button\" aria-pressed={selected ?? false} onClick={onClick} {...rootProps}>\n {content}\n </button>\n );\n }\n\n return <div {...rootProps}>{content}</div>;\n}\n","import clsx from 'clsx';\n\nexport type StatNumberSize = 'sm' | 'md' | 'lg';\n\nexport type StatNumberWeight = 'medium' | 'bold';\n\nexport interface StatNumberProps {\n value: string | number;\n unit?: string;\n size?: StatNumberSize;\n weight?: StatNumberWeight;\n /** @deprecated Bypasses the design tokens — pass `tone` instead. Raw hex color, overrides the default text color via inline style. Use when the exact source color doesn't match a design token. */\n color?: string;\n className?: string;\n}\n\n// 32 / 40 / 48px — the --typo-scale-07/08/09 steps. These read `text-scale-0*` until\n// 0.3.0, which the preset never defined, so every size emitted no font-size at all.\nconst sizeStyles: Record<StatNumberSize, string> = {\n sm: 'text-subtitle',\n md: 'text-subtitle-lg',\n lg: 'text-title',\n};\n\nconst weightStyles: Record<StatNumberWeight, string> = {\n medium: 'font-medium',\n bold: 'font-bold',\n};\n\nexport function StatNumber({ value, unit, size = 'md', weight = 'bold', color, className }: StatNumberProps) {\n return (\n <p\n className={clsx(sizeStyles[size], weightStyles[weight], 'leading-none', !color && 'text-default', className)}\n style={color ? { color } : undefined}\n >\n {value}\n {unit && (\n <span className=\"ml-1 text-subheading font-medium text-default-secondary\">{unit}</span>\n )}\n </p>\n );\n}\n","import clsx from 'clsx';\n\nexport type ScoreValueSize = 'sm' | 'md' | 'lg' | 'xl' | '2xl';\nexport type ScoreValueWeight = 'normal' | 'semibold' | 'bold';\nexport type ScoreTone = 'brand' | 'positive' | 'warning' | 'danger' | 'neutral' | 'default';\nexport type ScoreValueTone = ScoreTone | 'auto';\n\n/**\n * The four tones the automatic ramp can produce.\n *\n * Narrower than `ScoreTone` on purpose: a ramp position is always one of these, so the\n * result is directly assignable to `ProgressBarTone` too — which is what lets a caller\n * tone a bar and its score from one `getScoreTone` call.\n */\nexport type ScoreRampTone = 'positive' | 'neutral' | 'warning' | 'danger';\n\n/** Which end of the scale is the bad end. */\nexport type ScoreDirection = 'higher-is-worse' | 'higher-is-better';\n\nexport interface ScoreThresholds {\n /** At or above this, the score is `danger`. */\n danger: number;\n /** At or above this, `warning`. */\n warning: number;\n /** At or above this, `neutral`. Below it, `positive`. */\n neutral: number;\n}\n\n/**\n * Default ramp, on a 0–100 scale read as \"higher is worse\" — the risk case.\n *\n * 0.2.0's ramp had only four stops and resolved 65–79 to `brand` (the blue brand\n * colour), which left `warning` and `positive` unreachable without passing `tone`\n * by hand. This is a real five-stop ramp.\n */\nexport const DEFAULT_SCORE_THRESHOLDS: ScoreThresholds = { danger: 80, warning: 65, neutral: 50 };\n\n/**\n * Resolve a numeric score to a tone.\n *\n * Was `getRiskTone` in 0.2.0, with the thresholds and the direction both hardcoded.\n */\nexport function getScoreTone(\n score: number,\n {\n direction = 'higher-is-worse',\n thresholds = DEFAULT_SCORE_THRESHOLDS,\n }: { direction?: ScoreDirection; thresholds?: ScoreThresholds } = {},\n): ScoreRampTone {\n // Flip the score, not the comparisons — one ramp, read from either end.\n const v = direction === 'higher-is-better' ? 100 - score : score;\n if (v >= thresholds.danger) return 'danger';\n if (v >= thresholds.warning) return 'warning';\n if (v >= thresholds.neutral) return 'neutral';\n return 'positive';\n}\n\n// 13 / 14 / 16 / 20 / 32px\nconst SIZE: Record<ScoreValueSize, string> = {\n sm: 'text-body-xs',\n md: 'text-body-sm',\n lg: 'text-subheading-sm',\n xl: 'text-subheading',\n '2xl': 'text-subtitle',\n};\n\nconst WEIGHT: Record<ScoreValueWeight, string> = {\n normal: 'font-normal',\n semibold: 'font-semibold',\n bold: 'font-bold',\n};\n\nconst TONE: Record<ScoreTone, string> = {\n brand: 'text-brand',\n positive: 'text-positive',\n warning: 'text-warning',\n danger: 'text-danger',\n neutral: 'text-default-secondary',\n default: 'text-default',\n};\n\nexport interface ScoreValueProps {\n value: string | number;\n /** Trailing caption — `/100`, `High`, `of target`. */\n label?: string;\n size?: ScoreValueSize;\n weight?: ScoreValueWeight;\n /** `auto` derives the tone from `value` via {@link getScoreTone}. */\n tone?: ScoreValueTone;\n direction?: ScoreDirection;\n thresholds?: ScoreThresholds;\n className?: string;\n}\n\n/**\n * A scored number with an optional caption and a tone that can track its value.\n *\n * Was `RiskScore`. Nothing about it was ever risk-specific except the name and the\n * direction of its ramp, so both are now parameters: use it for a risk score, a\n * compliance score, a match confidence, a utilisation percentage.\n *\n * Not to be confused with `StatNumber`, which is the *large display* number with a\n * unit (32–48px, for tiles and widget headlines). `ScoreValue` is the inline one with\n * a label and a tone ramp.\n */\nexport function ScoreValue({\n value,\n label,\n size = 'md',\n weight = 'bold',\n tone = 'auto',\n direction = 'higher-is-worse',\n thresholds = DEFAULT_SCORE_THRESHOLDS,\n className,\n}: ScoreValueProps) {\n // A numeric-looking string still resolves. In 0.2.0 `tone=\"auto\"` fell back to\n // `default` for any string, so callers passing `score=\"82\"` silently got no tone.\n const numeric = typeof value === 'number' ? value : Number(value);\n const resolved: ScoreTone =\n tone === 'auto'\n ? Number.isFinite(numeric)\n ? getScoreTone(numeric, { direction, thresholds })\n : 'default'\n : tone;\n\n return (\n <span data-tone={resolved} className={clsx('inline-flex items-baseline gap-1', className)}>\n <span className={clsx(SIZE[size], WEIGHT[weight], TONE[resolved])}>{value}</span>\n {label && <span className=\"text-body-xs text-default-secondary whitespace-nowrap\">{label}</span>}\n </span>\n );\n}\n","import clsx from 'clsx';\nimport type { ReactNode } from 'react';\n\nexport type TileGridColumns = 2 | 3 | 4 | 5 | 6;\n\n/**\n * Responsive column counts. Every source copy started two-up on mobile and stepped\n * to its full count at one breakpoint.\n *\n * The twelve source grids disagreed on which: seven used `lg:`, three used `md:`.\n * Standardising on `lg:` matches eight of them byte-for-byte and is the safer choice\n * — five tiles at `md` (768px) was cramped. `alerts`, `settings-users` and\n * `settings-organization` therefore stay two-up slightly longer on tablets than\n * before; that is the one deliberate layout change here.\n *\n * Six keeps its intermediate `sm:grid-cols-3` step, matching entities-listing —\n * without it, six tiles would stack 2×3 on tablet instead of 3×2.\n */\nexport type TileGridBreakpoint = 'sm' | 'md' | 'lg';\n\nconst COLUMNS: Record<TileGridBreakpoint, Record<TileGridColumns, string>> = {\n sm: {\n 2: 'grid-cols-2',\n 3: 'grid-cols-2 sm:grid-cols-3',\n 4: 'grid-cols-2 sm:grid-cols-4',\n 5: 'grid-cols-2 sm:grid-cols-5',\n 6: 'grid-cols-2 sm:grid-cols-6',\n },\n md: {\n 2: 'grid-cols-2',\n 3: 'grid-cols-2 md:grid-cols-3',\n 4: 'grid-cols-2 md:grid-cols-4',\n 5: 'grid-cols-2 md:grid-cols-5',\n 6: 'grid-cols-2 sm:grid-cols-3 md:grid-cols-6',\n },\n lg: {\n 2: 'grid-cols-2',\n 3: 'grid-cols-2 lg:grid-cols-3',\n 4: 'grid-cols-2 lg:grid-cols-4',\n 5: 'grid-cols-2 lg:grid-cols-5',\n 6: 'grid-cols-2 sm:grid-cols-3 lg:grid-cols-6',\n },\n};\n\nexport interface TileGridProps {\n children: ReactNode;\n columns?: TileGridColumns;\n /**\n * Breakpoint at which the grid reaches its full column count. `lg` is the default\n * and correct for a full-width page. Narrow contexts — a stat row inside a panel,\n * as on the article detail page — legitimately need `sm`.\n */\n at?: TileGridBreakpoint;\n className?: string;\n}\n\n/**\n * A responsive grid of equal-width tiles.\n *\n * Was `StatTileGrid`, which read as a `StatTile`-specific component. It has never been\n * coupled to one: no context, no cloning, no constraint on `children`. It takes any\n * nodes — `StatTile`s, `Card`s, chart tiles — and only owns the column counts and the\n * `gap-3`. The rename says so.\n */\nexport function TileGrid({\n children,\n columns = 4,\n at = 'lg',\n className,\n}: TileGridProps) {\n return <div className={clsx('grid gap-3', COLUMNS[at][columns], className)}>{children}</div>;\n}\n","/**\n * Chart colour.\n *\n * SVG paints via the `stroke` / `fill` *attributes*, which cannot take a Tailwind\n * class — so charts resolve a `tone` to a CSS variable reference instead of a utility.\n * That keeps them on the token layer; 0.2.0's charts defaulted to raw hex (`#0c2d58`,\n * `rgba(140,155,176,0.5)`) and drifted from it.\n *\n * Every chart still accepts an explicit `color` string for genuinely data-driven\n * colour — a series whose colour comes from the data, not from semantics.\n */\nexport type ChartTone = 'brand' | 'info' | 'positive' | 'warning' | 'danger' | 'neutral';\n\nexport const CHART_TONE: Record<ChartTone, string> = {\n brand: 'var(--color-background-brand-default)',\n info: 'var(--status-info-dot)',\n positive: 'var(--color-background-positive-default)',\n warning: 'var(--color-background-warning-default)',\n danger: 'var(--color-background-danger-default)',\n neutral: 'var(--color-background-neutral-default)',\n};\n\n/** The muted track/rest colour behind a highlighted series. */\nexport const CHART_TRACK = 'var(--color-background-default-tertiary)';\n\n/**\n * Ordered sequence for multi-series charts, so two donuts in the same product never\n * assign different colours to the same first category. Semantic tones come first\n * because a chart with two or three series is usually still saying something.\n */\nexport const CHART_SEQUENCE: ChartTone[] = ['brand', 'info', 'positive', 'warning', 'danger', 'neutral'];\n\n/** Resolve an explicit colour, else a tone, else the sequence position. */\nexport function resolveChartColor(color: string | undefined, tone: ChartTone | undefined, index = 0): string {\n if (color) return color;\n if (tone) return CHART_TONE[tone];\n return CHART_TONE[CHART_SEQUENCE[index % CHART_SEQUENCE.length]];\n}\n","import clsx from 'clsx';\nimport { resolveChartColor, type ChartTone } from './chart-tone';\n\nexport type BarChartOrientation = 'vertical' | 'horizontal';\nexport type BarChartSize = 'sm' | 'md' | 'lg';\n\n/** Thickness of one bar / one group slot, and the label type step. */\nconst SIZE: Record<BarChartSize, { band: number; gap: number; label: string }> = {\n sm: { band: 14, gap: 6, label: 'text-body-tiny' },\n md: { band: 20, gap: 8, label: 'text-body-xs' },\n lg: { band: 28, gap: 10, label: 'text-body-xs' },\n};\n\nexport interface BarChartSeries {\n label: string;\n /** One value per category. */\n values: number[];\n tone?: ChartTone;\n color?: string;\n}\n\n/** A target or threshold drawn across the bars as a dashed line, e.g. \"160h expected\". */\nexport interface BarChartReference {\n value: number;\n /** Printed at the end of the line, and added to the chart's accessible name. */\n label?: string;\n /** Defaults to `warning`. */\n tone?: ChartTone;\n color?: string;\n}\n\nexport interface BarChartProps {\n /** Category names — the axis labels. */\n categories: string[];\n series: BarChartSeries[];\n orientation?: BarChartOrientation;\n /** Stack series on top of each other instead of placing them side by side. */\n stacked?: boolean;\n size?: BarChartSize;\n /** Overall length of the value axis, in px. */\n length?: number;\n /** Show the category labels along the axis. */\n showLabels?: boolean;\n /** Print each bar's value at the end of the bar. Horizontal orientation only. */\n showValues?: boolean;\n /** A dashed target line across the value axis. The axis grows to fit it. */\n reference?: BarChartReference;\n radius?: number;\n label?: string;\n className?: string;\n}\n\n/**\n * Grouped or stacked bars, in either orientation.\n *\n * Horizontal is the orientation the library was missing and the one that actually suits\n * category data, because long category names get a full line of width rather than being\n * rotated or truncated under a vertical bar.\n *\n * Deliberately axis-light: one baseline, no gridlines, no ticks. For anything needing\n * real axes or interaction, this is the wrong component.\n */\nexport function BarChart({\n categories,\n series,\n orientation = 'horizontal',\n stacked = false,\n size = 'md',\n length = 240,\n showLabels = true,\n showValues = false,\n reference,\n radius = 3,\n label,\n className,\n}: BarChartProps) {\n const { band, gap, label: labelClass } = SIZE[size];\n if (categories.length === 0 || series.length === 0) return null;\n\n // Stacked bars share one band per category; grouped bars split it between series.\n const perCategory = stacked ? band : band * series.length + gap * (series.length - 1);\n\n const categoryTotals = categories.map((_, ci) =>\n stacked\n ? series.reduce((sum, s) => sum + Math.max(0, s.values[ci] ?? 0), 0)\n : Math.max(...series.map((s) => Math.max(0, s.values[ci] ?? 0))),\n );\n const referenceValue = reference ? Math.max(0, reference.value) : 0;\n const max = Math.max(...categoryTotals, referenceValue, 1);\n\n const horizontal = orientation === 'horizontal';\n const referenceColor = reference ? resolveChartColor(reference.color, reference.tone ?? 'warning') : undefined;\n const referenceAt = `${(referenceValue / max) * 100}%`;\n const accessibleName = label && reference?.label ? `${label}. ${reference.label}` : label;\n\n return (\n <div\n className={clsx(\n 'flex w-full min-w-0',\n horizontal ? 'flex-col gap-2' : 'flex-row items-end gap-3',\n reference && 'relative',\n className,\n )}\n role={label ? 'img' : undefined}\n aria-label={accessibleName}\n // Without a label the chart is decoration and its bars are noise in the a11y tree.\n // Every other chart in the family had this fallback; BarChart was the one that did\n // not, so an unlabelled one announced each bar's markup.\n aria-hidden={label ? undefined : true}\n >\n {categories.map((category, ci) => {\n const bars = series.map((s, si) => ({\n key: s.label,\n value: Math.max(0, s.values[ci] ?? 0),\n color: resolveChartColor(s.color, s.tone, si),\n }));\n\n return (\n <div\n key={category}\n className={clsx('flex min-w-0', horizontal ? 'flex-col gap-1' : 'h-full flex-col justify-end gap-1.5')}\n style={horizontal ? undefined : { width: perCategory }}\n >\n {showLabels && horizontal && (\n <span className={clsx('truncate text-default-secondary', labelClass)}>{category}</span>\n )}\n\n <div\n className={clsx('flex', horizontal ? 'items-center gap-2' : 'w-full flex-1 items-end justify-center')}\n style={horizontal ? undefined : { height: length }}\n >\n <div\n className={clsx('flex min-w-0', stacked ? 'gap-0' : '')}\n style={\n horizontal\n ? { width: length, flexDirection: stacked ? 'row' : 'column', gap: stacked ? 0 : gap }\n : {\n height: '100%',\n width: perCategory,\n flexDirection: stacked ? 'column-reverse' : 'row',\n alignItems: 'flex-end',\n gap: stacked ? 0 : gap,\n }\n }\n >\n {bars.map((bar) => {\n const extent = `${(bar.value / max) * 100}%`;\n return (\n <div\n key={bar.key}\n title={`${category} · ${bar.key}: ${bar.value}`}\n className=\"transition-all motion-reduce:transition-none\"\n style={{\n backgroundColor: bar.color,\n borderRadius: radius,\n ...(horizontal\n ? { width: extent, height: stacked ? band : band }\n : { height: extent, width: stacked ? perCategory : band }),\n }}\n />\n );\n })}\n </div>\n {showValues && horizontal && (\n <span className={clsx('shrink-0 tabular-nums text-default-secondary', labelClass)}>\n {categoryTotals[ci]}\n </span>\n )}\n </div>\n\n {showLabels && !horizontal && (\n <span className={clsx('truncate text-center text-default-secondary', labelClass)}>{category}</span>\n )}\n </div>\n );\n })}\n\n {reference && (\n // Laid over the bar area only. Vertical bars all start at the top of their column\n // (the labels sit below), so the band is the top `length` px; horizontal tracks all\n // start at the left edge, so the line sits `referenceAt` of `length` from it.\n <div\n data-chart-reference=\"\"\n aria-hidden\n className=\"pointer-events-none absolute\"\n style={horizontal ? { top: 0, bottom: 0, left: 0, width: length } : { top: 0, left: 0, right: 0, height: length }}\n >\n <div\n className=\"absolute\"\n style={\n horizontal\n ? { top: 0, bottom: 0, left: referenceAt, borderLeft: `2px dashed ${referenceColor}` }\n : { left: 0, right: 0, bottom: referenceAt, borderTop: `2px dashed ${referenceColor}` }\n }\n >\n {reference.label && (\n <span\n className={clsx('absolute whitespace-nowrap', labelClass)}\n style={\n horizontal\n ? { top: 0, left: 4, color: referenceColor }\n : { right: 0, bottom: 2, color: referenceColor }\n }\n >\n {reference.label}\n </span>\n )}\n </div>\n </div>\n )}\n </div>\n );\n}\n","import clsx from 'clsx';\nimport type { ReactNode } from 'react';\nimport { CHART_TRACK, resolveChartColor, type ChartTone } from './chart-tone';\n\nexport type DonutChartSize = 'sm' | 'md' | 'lg';\n\n/** Diameter and default ring thickness, in px. */\nconst SIZE: Record<DonutChartSize, { box: number; thickness: number }> = {\n sm: { box: 88, thickness: 10 },\n md: { box: 128, thickness: 14 },\n lg: { box: 180, thickness: 20 },\n};\n\nexport interface DonutSegment {\n label: string;\n value: number;\n /** Token-backed colour. Falls back to the segment's position in the chart sequence. */\n tone?: ChartTone;\n /** Explicit colour, for data-driven series. */\n color?: string;\n}\n\nexport interface DonutChartProps {\n segments: DonutSegment[];\n size?: DonutChartSize;\n /** Ring thickness in px. Overrides the `size` preset. */\n thickness?: number;\n /** Large text at the centre — a total, a percentage. */\n centerValue?: ReactNode;\n /** Caption beneath `centerValue`. */\n centerLabel?: ReactNode;\n /** Gap between segments, in degrees. */\n gap?: number;\n /** Accessible description. */\n label?: string;\n className?: string;\n}\n\n/**\n * A proportional ring.\n *\n * Drawn with `stroke-dasharray` on circles rather than arc paths: one element per\n * segment, no trigonometry, and the segments stay crisp at any thickness.\n */\nexport function DonutChart({\n segments,\n size = 'md',\n thickness,\n centerValue,\n centerLabel,\n gap = 2,\n label,\n className,\n}: DonutChartProps) {\n const { box, thickness: presetThickness } = SIZE[size];\n const ring = thickness ?? presetThickness;\n const radius = (box - ring) / 2;\n const circumference = 2 * Math.PI * radius;\n const total = segments.reduce((sum, s) => sum + Math.max(0, s.value), 0);\n\n // A gap is only meaningful between two or more visible segments.\n const visible = segments.filter((s) => s.value > 0);\n const gapLength = visible.length > 1 ? (gap / 360) * circumference : 0;\n\n let offset = 0;\n\n return (\n <div className={clsx('relative inline-flex shrink-0 items-center justify-center', className)}>\n <svg\n width={box}\n height={box}\n viewBox={`0 0 ${box} ${box}`}\n role={label ? 'img' : undefined}\n aria-label={label}\n aria-hidden={label ? undefined : true}\n // -90° so the first segment starts at twelve o'clock rather than three.\n className=\"block -rotate-90\"\n >\n <circle cx={box / 2} cy={box / 2} r={radius} fill=\"none\" stroke={CHART_TRACK} strokeWidth={ring} />\n {total > 0 &&\n segments.map((segment, i) => {\n const fraction = Math.max(0, segment.value) / total;\n const length = Math.max(0, fraction * circumference - gapLength);\n const dash = `${length} ${circumference - length}`;\n const thisOffset = offset;\n offset += fraction * circumference;\n if (segment.value <= 0) return null;\n return (\n <circle\n key={segment.label}\n cx={box / 2}\n cy={box / 2}\n r={radius}\n fill=\"none\"\n stroke={resolveChartColor(segment.color, segment.tone, i)}\n strokeWidth={ring}\n strokeDasharray={dash}\n strokeDashoffset={-thisOffset}\n strokeLinecap=\"butt\"\n />\n );\n })}\n </svg>\n {(centerValue != null || centerLabel != null) && (\n <div className=\"absolute inset-0 flex flex-col items-center justify-center text-center\">\n {centerValue != null && (\n <span className=\"text-subheading-sm font-bold leading-none text-default\">{centerValue}</span>\n )}\n {centerLabel != null && (\n <span className=\"mt-0.5 text-body-tiny text-default-secondary\">{centerLabel}</span>\n )}\n </div>\n )}\n </div>\n );\n}\n","import clsx from 'clsx';\nimport type { ReactNode } from 'react';\nimport { CHART_TRACK, resolveChartColor, type ChartTone } from './chart-tone';\n\nexport type RadialGaugeSize = 'sm' | 'md' | 'lg';\n\nconst SIZE: Record<RadialGaugeSize, { box: number; thickness: number; value: string }> = {\n sm: { box: 72, thickness: 8, value: 'text-body-sm' },\n md: { box: 104, thickness: 11, value: 'text-subheading-sm' },\n lg: { box: 148, thickness: 15, value: 'text-subheading' },\n};\n\nexport interface RadialGaugeProps {\n value: number;\n /** Top of the scale. */\n max?: number;\n size?: RadialGaugeSize;\n tone?: ChartTone;\n color?: string;\n /** Ring thickness in px. Overrides the `size` preset. */\n thickness?: number;\n /**\n * Sweep in degrees. 360 is a full ring; 270 leaves a gap at the bottom, which reads\n * more like a dial than a pie.\n */\n sweep?: number;\n /** Centre content. Defaults to the value; pass `null` for an empty ring. */\n children?: ReactNode;\n /** Caption beneath the centre value. */\n centerLabel?: ReactNode;\n label?: string;\n className?: string;\n}\n\n/**\n * A single-value arc — a score ring, a utilisation dial, a completion meter.\n *\n * The shape the library had no form for: `ProgressBar` covers linear progress and\n * `DonutChart` compares parts of a whole, but neither draws \"one number against its\n * ceiling\" in a round frame.\n */\nexport function RadialGauge({\n value,\n max = 100,\n size = 'md',\n tone = 'brand',\n color,\n thickness,\n sweep = 270,\n children,\n centerLabel,\n label,\n className,\n}: RadialGaugeProps) {\n const preset = SIZE[size];\n const box = preset.box;\n const ring = thickness ?? preset.thickness;\n const radius = (box - ring) / 2;\n const circumference = 2 * Math.PI * radius;\n\n const clampedSweep = Math.min(360, Math.max(1, sweep));\n const arc = (clampedSweep / 360) * circumference;\n const fraction = max > 0 ? Math.min(1, Math.max(0, value / max)) : 0;\n const stroke = resolveChartColor(color, tone);\n\n // Rotate so the arc is centred on twelve o'clock: -90° puts the start at the top,\n // then half the unswept remainder brings it back round.\n const rotation = -90 + (360 - clampedSweep) / 2;\n\n return (\n <div className={clsx('relative inline-flex shrink-0 items-center justify-center', className)}>\n <svg\n width={box}\n height={box}\n viewBox={`0 0 ${box} ${box}`}\n role={label ? 'img' : undefined}\n aria-label={label}\n aria-hidden={label ? undefined : true}\n className=\"block\"\n style={{ transform: `rotate(${rotation}deg)` }}\n >\n <circle\n cx={box / 2}\n cy={box / 2}\n r={radius}\n fill=\"none\"\n stroke={CHART_TRACK}\n strokeWidth={ring}\n strokeDasharray={`${arc} ${circumference - arc}`}\n strokeLinecap=\"round\"\n />\n <circle\n cx={box / 2}\n cy={box / 2}\n r={radius}\n fill=\"none\"\n stroke={stroke}\n strokeWidth={ring}\n strokeDasharray={`${arc * fraction} ${circumference - arc * fraction}`}\n strokeLinecap=\"round\"\n className=\"transition-all motion-reduce:transition-none\"\n />\n </svg>\n <div className=\"absolute inset-0 flex flex-col items-center justify-center text-center\">\n {children === undefined ? (\n <span className={clsx('font-bold leading-none text-default', preset.value)}>{value}</span>\n ) : (\n children\n )}\n {centerLabel != null && (\n <span className=\"mt-0.5 text-body-tiny text-default-secondary\">{centerLabel}</span>\n )}\n </div>\n </div>\n );\n}\n","import { useId } from 'react';\nimport clsx from 'clsx';\nimport { CHART_TONE, resolveChartColor, type ChartTone } from './chart-tone';\n\nexport type SparklineVariant = 'line' | 'area';\nexport type SparklineSize = 'sm' | 'md' | 'lg';\n\n/** Size presets, so callers stop passing bare pixel pairs. */\nconst SIZE: Record<SparklineSize, { width: number; height: number }> = {\n sm: { width: 80, height: 24 },\n md: { width: 120, height: 36 },\n lg: { width: 200, height: 56 },\n};\n\nexport interface SparklineProps {\n data: number[];\n variant?: SparklineVariant;\n /** Token-backed colour. Ignored when `color` is set. */\n tone?: ChartTone;\n /** Explicit colour, for series whose colour comes from the data. */\n color?: string;\n size?: SparklineSize;\n /** Overrides the `size` preset. */\n width?: number;\n height?: number;\n strokeWidth?: number;\n /** Dot on the final point — useful when the line is the \"current value\". */\n showEndDot?: boolean;\n /**\n * Stretch to fill the container instead of drawing at a fixed pixel size.\n *\n * The `size` preset still sets the viewBox, so it decides the sampling density; the SVG then\n * scales to the box it is given. Stroke width is held constant with `non-scaling-stroke`,\n * without which a non-uniform stretch would thin the line on one axis and thicken it on the\n * other.\n */\n fill?: boolean;\n /** Accessible description. Omit to keep the chart decorative. */\n label?: string;\n className?: string;\n}\n\n/**\n * A compact trend line, with no axes and no interaction.\n *\n * `variant=\"area\"` adds the gradient fill beneath the line that 0.2.0 had no way to\n * draw, which is what makes a sparkline readable at `lg` where a bare 1.5px stroke\n * looks thin.\n */\nexport function Sparkline({\n data,\n variant = 'line',\n tone = 'brand',\n color,\n size = 'md',\n width,\n height,\n strokeWidth = 1.5,\n showEndDot = false,\n fill: stretch = false,\n label,\n className,\n}: SparklineProps) {\n const gradientId = useId();\n if (data.length < 2) return null;\n\n const w = width ?? SIZE[size].width;\n const h = height ?? SIZE[size].height;\n const stroke = resolveChartColor(color, tone);\n\n const min = Math.min(...data);\n const max = Math.max(...data);\n const range = max - min || 1;\n const pad = strokeWidth;\n const innerH = h - pad * 2;\n const innerW = w - pad * 2;\n\n const coords = data.map((v, i) => ({\n x: pad + (i / (data.length - 1)) * innerW,\n y: pad + innerH - ((v - min) / range) * innerH,\n }));\n const points = coords.map((p) => `${p.x.toFixed(2)},${p.y.toFixed(2)}`).join(' ');\n // Close the path down to the baseline so the fill has something to fill.\n const areaPath = `M ${points.split(' ').join(' L ')} L ${coords[coords.length - 1].x.toFixed(2)},${h} L ${coords[0].x.toFixed(2)},${h} Z`;\n const last = coords[coords.length - 1];\n\n return (\n <svg\n width={stretch ? undefined : w}\n height={stretch ? undefined : h}\n viewBox={`0 0 ${w} ${h}`}\n preserveAspectRatio={stretch ? 'none' : undefined}\n fill=\"none\"\n role={label ? 'img' : undefined}\n aria-label={label}\n aria-hidden={label ? undefined : true}\n className={clsx('block', stretch ? 'h-full w-full' : 'shrink-0', className)}\n >\n {variant === 'area' && (\n <>\n <defs>\n <linearGradient id={gradientId} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor={stroke} stopOpacity={0.24} />\n <stop offset=\"100%\" stopColor={stroke} stopOpacity={0} />\n </linearGradient>\n </defs>\n <path d={areaPath} fill={`url(#${gradientId})`} />\n </>\n )}\n <polyline\n points={points}\n stroke={stroke}\n strokeWidth={strokeWidth}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n // Holds the line at `strokeWidth` under a non-uniform stretch. Harmless when not\n // stretching, since the scale is 1:1 there.\n vectorEffect={stretch ? 'non-scaling-stroke' : undefined}\n fill=\"none\"\n />\n {showEndDot && (\n <circle\n cx={last.x}\n cy={last.y}\n // A stretched circle would become an ellipse, so the dot is drawn in viewBox units\n // and sized from the smaller axis to stay visually round enough at either extreme.\n r={strokeWidth * 1.6}\n fill={stroke}\n stroke={CHART_TONE.neutral}\n strokeWidth={0}\n />\n )}\n </svg>\n );\n}\n","import clsx from 'clsx';\nimport { CHART_TRACK, resolveChartColor, type ChartTone } from './chart-tone';\n\nexport type MiniBarChartSize = 'sm' | 'md' | 'lg';\nexport type MiniBarChartOrientation = 'vertical' | 'horizontal';\n\nconst SIZE: Record<MiniBarChartSize, { width: number; height: number; gap: number }> = {\n sm: { width: 80, height: 32, gap: 2 },\n md: { width: 120, height: 48, gap: 3 },\n lg: { width: 200, height: 72, gap: 4 },\n};\n\nexport interface MiniBarChartProps {\n bars: number[];\n /** Colour of the highlighted bars. */\n tone?: ChartTone;\n color?: string;\n /** Colour of the un-highlighted bars. Defaults to the muted track token. */\n restColor?: string;\n /**\n * Which bars are highlighted. A number or list of indices; negatives count from the\n * end, so `-1` is the last bar. Pass `[]` to highlight none.\n *\n * Replaces 0.2.0's `highlightLastBar` boolean, which could only ever mean `-1`.\n */\n highlight?: number | number[];\n size?: MiniBarChartSize;\n /** Overrides the `size` preset. */\n width?: number;\n height?: number;\n gap?: number;\n orientation?: MiniBarChartOrientation;\n radius?: number;\n /**\n * Stretch to fill the container instead of drawing at a fixed pixel size.\n *\n * The `size` preset still sets the viewBox, so it decides the bar-to-gap proportions; the\n * SVG then scales to whatever box it is given. Without this a widget body could only hold a\n * chart at a hardcoded width, which stops being the right width as soon as the widget\n * reflows.\n */\n fill?: boolean;\n label?: string;\n className?: string;\n}\n\n/** A compact bar series with no axes — a distribution or a per-period count. */\nexport function MiniBarChart({\n bars,\n tone = 'brand',\n color,\n restColor = CHART_TRACK,\n highlight = -1,\n size = 'md',\n width,\n height,\n gap,\n orientation = 'vertical',\n radius = 2,\n fill: stretch = false,\n label,\n className,\n}: MiniBarChartProps) {\n if (bars.length === 0) return null;\n\n const preset = SIZE[size];\n const w = width ?? preset.width;\n const h = height ?? preset.height;\n const g = gap ?? preset.gap;\n const fill = resolveChartColor(color, tone);\n\n const highlighted = new Set(\n (Array.isArray(highlight) ? highlight : [highlight]).map((i) => (i < 0 ? bars.length + i : i)),\n );\n\n const max = Math.max(...bars) || 1;\n const vertical = orientation === 'vertical';\n // The cross-axis is divided between bars; the value axis carries the magnitude.\n const span = vertical ? w : h;\n const extent = vertical ? h : w;\n const barThickness = (span - g * (bars.length - 1)) / bars.length;\n\n return (\n <svg\n width={stretch ? undefined : w}\n height={stretch ? undefined : h}\n viewBox={`0 0 ${w} ${h}`}\n // `none` so the bars fill the box on both axes rather than letterboxing inside it —\n // there is no geometry here whose aspect ratio has to be preserved, only rectangles.\n preserveAspectRatio={stretch ? 'none' : undefined}\n fill=\"none\"\n role={label ? 'img' : undefined}\n aria-label={label}\n aria-hidden={label ? undefined : true}\n className={clsx('block', stretch ? 'h-full w-full' : 'shrink-0', className)}\n >\n {bars.map((v, i) => {\n const magnitude = Math.max(2, (v / max) * extent);\n const offset = i * (barThickness + g);\n return (\n <rect\n key={i}\n x={(vertical ? offset : 0).toFixed(2)}\n // Vertical bars grow up from the baseline; horizontal ones out from the left.\n y={(vertical ? extent - magnitude : offset).toFixed(2)}\n width={(vertical ? barThickness : magnitude).toFixed(2)}\n height={(vertical ? magnitude : barThickness).toFixed(2)}\n fill={highlighted.has(i) ? fill : restColor}\n rx={radius}\n />\n );\n })}\n </svg>\n );\n}\n","import clsx from 'clsx';\nimport { LegendDot, type LegendDotShape, type LegendDotSize } from './legend-dot';\nimport { resolveChartColor, type ChartTone } from './chart-tone';\n\nexport type ChartLegendOrientation = 'vertical' | 'horizontal';\n\nexport interface ChartLegendItem {\n label: string;\n /** Trailing value. Omit for a legend that only names the series. */\n count?: number | string;\n /** Token-backed colour. Falls back to the item's position in the chart sequence. */\n tone?: ChartTone;\n /** Explicit colour, for data-driven series. */\n color?: string;\n}\n\nexport interface ChartLegendProps {\n items: ChartLegendItem[];\n /**\n * `vertical` spreads each row to fill its container, so the counts align in a column\n * beside a donut. `horizontal` wraps inline, for a legend under a bar chart.\n */\n orientation?: ChartLegendOrientation;\n size?: LegendDotSize;\n shape?: LegendDotShape;\n className?: string;\n}\n\n/** Series names, swatches and optional values. */\nexport function ChartLegend({\n items,\n orientation = 'vertical',\n size = 'md',\n shape = 'dot',\n className,\n}: ChartLegendProps) {\n const horizontal = orientation === 'horizontal';\n\n return (\n <div\n className={clsx(\n horizontal ? 'flex flex-wrap items-center gap-x-4 gap-y-2' : 'flex flex-col gap-3',\n className,\n )}\n >\n {items.map((item, i) => (\n <div\n key={item.label}\n className={clsx('flex items-center gap-2', horizontal ? 'min-w-0' : 'justify-between')}\n >\n <div className=\"flex min-w-0 items-center gap-2\">\n {/* Resolved here, not in LegendDot, so the sequence fallback can use the\n item's position — matching how DonutChart colours its segments. */}\n <LegendDot color={resolveChartColor(item.color, item.tone, i)} size={size} shape={shape} />\n <span className=\"truncate text-body-xs text-default-secondary\">{item.label}</span>\n </div>\n {item.count != null && (\n <span className=\"shrink-0 text-body-xs font-semibold tabular-nums text-default\">{item.count}</span>\n )}\n </div>\n ))}\n </div>\n );\n}\n","import clsx from 'clsx';\nimport { resolveChartColor, type ChartTone } from './chart-tone';\nimport type { BadgeColor } from '../status/badge';\n\nexport type LegendDotSize = 'sm' | 'md';\n/** `line` is the swatch for a line series; `dot` and `square` for areas and bars. */\nexport type LegendDotShape = 'dot' | 'square' | 'line';\n\nconst SHAPE: Record<LegendDotShape, Record<LegendDotSize, string>> = {\n dot: { sm: 'size-1.5 rounded-full', md: 'size-2 rounded-full' },\n square: { sm: 'size-1.5 rounded-[2px]', md: 'size-2 rounded-[3px]' },\n line: { sm: 'h-0.5 w-3 rounded-full', md: 'h-0.5 w-4 rounded-full' },\n};\n\nexport interface LegendDotProps {\n /** Token-backed colour. Ignored when `color` is set. */\n tone?: ChartTone;\n /** Explicit colour, for data-driven series. */\n color?: string;\n /**\n * A categorical colour from the badge palette (its text shade, strong enough for a small dot),\n * to key a list item to the same `hue` on an `EntityIconBadge`. Ignored when `color` is set.\n * New in 0.9.5.\n */\n hue?: BadgeColor;\n size?: LegendDotSize;\n shape?: LegendDotShape;\n className?: string;\n}\n\n/** The colour swatch beside a series name. */\nexport function LegendDot({ tone, color, hue, size = 'md', shape = 'dot', className }: LegendDotProps) {\n return (\n <span\n className={clsx('inline-block shrink-0', SHAPE[shape][size], className)}\n style={{ backgroundColor: color || !hue ? resolveChartColor(color, tone) : `var(--badge-${hue}-text)` }}\n aria-hidden\n />\n );\n}\n","import clsx from 'clsx';\nimport { TrendingDownIcon, TrendingUpIcon } from 'lucide-react';\n\nexport type TrendLabelWeight = 'semibold' | 'bold';\nexport type TrendLabelSize = 'sm' | 'md' | 'lg';\n/**\n * Which direction is the good one.\n *\n * A delta component cannot infer this: +4% on-time delivery is good, +4% unit cost is\n * not. 0.2.0 had no such prop, so the only way to render a \"rising is bad\" delta was to\n * pass a raw hex — which is exactly what the deleted `BenchmarkCard` did, inverting its\n * own `positiveColor` default to red to compensate.\n */\nexport type TrendDirection = 'up-is-good' | 'up-is-bad';\n\nconst SIZE: Record<TrendLabelSize, string> = {\n sm: 'text-body-xs',\n md: 'text-body-sm',\n lg: 'text-subheading-sm',\n};\n\nconst ICON_SIZE: Record<TrendLabelSize, string> = {\n sm: 'size-3',\n md: 'size-3.5',\n lg: 'size-4',\n};\n\nconst weightBySize: Record<TrendLabelSize, TrendLabelWeight> = {\n sm: 'semibold',\n md: 'semibold',\n lg: 'bold',\n};\n\nconst WEIGHT: Record<TrendLabelWeight, string> = {\n semibold: 'font-semibold',\n bold: 'font-bold',\n};\n\nexport interface TrendLabelProps {\n value: number;\n suffix?: string;\n size?: TrendLabelSize;\n weight?: TrendLabelWeight;\n direction?: TrendDirection;\n /** Trend arrow. On by default — the docs described one long before there was one. */\n showArrow?: boolean;\n /** Explicit colour, for the rare data-driven case. Overrides the direction logic. */\n color?: string;\n className?: string;\n}\n\n/** A signed delta with a direction arrow, toned by whether the movement is good news. */\nexport function TrendLabel({\n value,\n suffix = '%',\n size = 'md',\n weight,\n direction = 'up-is-good',\n showArrow = true,\n color,\n className,\n}: TrendLabelProps) {\n const rising = value > 0;\n // Zero is neither good nor bad. 0.2.0 rendered it as a green \"+0%\".\n const flat = value === 0;\n const good = direction === 'up-is-good' ? rising : !rising;\n const Arrow = rising ? TrendingUpIcon : TrendingDownIcon;\n\n return (\n <span\n className={clsx(\n 'inline-flex items-center gap-1 whitespace-nowrap',\n SIZE[size],\n WEIGHT[weight ?? weightBySize[size]],\n !color && (flat ? 'text-default-secondary' : good ? 'text-positive' : 'text-danger'),\n className,\n )}\n style={color ? { color } : undefined}\n >\n {showArrow && !flat && <Arrow className={clsx('shrink-0', ICON_SIZE[size])} aria-hidden />}\n {rising ? '+' : ''}\n {value}\n {suffix}\n </span>\n );\n}\n","import { Fragment, useEffect, useId, useMemo, type ReactNode } from 'react';\nimport clsx from 'clsx';\n\nimport { cn } from '../../lib/cn';\nimport { FOCUS_RING_INSET } from '../../lib/focus-ring';\nimport { SCROLLBAR_CLASSES } from '../../lib/scrollbar';\nimport { useControllableState } from '../../lib/use-controllable-state';\nimport { useRovingFocus } from '../../lib/use-roving-focus';\nimport { EyebrowLabel } from '../chrome/eyebrow-label';\n\n/** One choice in a `Listbox`. */\nexport interface ListboxOption {\n value: string;\n label: ReactNode;\n /** Typeahead text, when `label` is not a plain string. */\n textValue?: string;\n /** Trailing content, e.g. a count: \"3 Permission Sets\". Part of the option's name. */\n meta?: ReactNode;\n disabled?: boolean;\n}\n\n/** A titled run of options. Rendered as `role=\"group\"`, named by its visible header. */\nexport interface ListboxGroup {\n label: string;\n options: readonly ListboxOption[];\n}\n\nexport interface ListboxProps {\n /** Options, or groups of options, in display order. Groups and bare options can mix. */\n options: readonly (ListboxOption | ListboxGroup)[];\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n /** Accessible name. Required: a listbox has no visible name of its own. */\n label: string;\n /**\n * Select an option as soon as it is focused with the arrow keys (the APG's \"selection follows\n * focus\"), for a picker that drives a detail view beside it. Default `true`. With `false`, the\n * arrows only move, and Enter, Space or a click selects.\n */\n selectionFollowsFocus?: boolean;\n /** Cap the height (px number or CSS length) and scroll the options inside it. */\n maxHeight?: number | string;\n /** Shown in place of the options when there are none. */\n empty?: ReactNode;\n /** Layout classes on the root, e.g. width. */\n className?: string;\n}\n\nconst isGroup = (entry: ListboxOption | ListboxGroup): entry is ListboxGroup => 'options' in entry;\n\n/**\n * A persistent single-select list: pick one item and keep it picked, e.g. the permission whose\n * holders a panel beside it lists. New in 0.9.5.\n *\n * The WAI-ARIA APG listbox pattern: `role=\"listbox\"` with `role=\"option\"` items carrying\n * `aria-selected`, one tab stop with a roving tabindex, arrow keys, Home and End, and typeahead.\n * Groups are `role=\"group\"`, named by their visible header. Use it where `Select` or\n * `Combobox` would hide the choices behind a popup, and `Command` does not fit: `Command` is\n * for running an action, its highlight is not a selection, and it always has a search box. For\n * a short set where every option deserves a label and description, use `RadioGroup`.\n */\nexport function Listbox({\n options,\n value: valueProp,\n defaultValue,\n onValueChange,\n label,\n selectionFollowsFocus = true,\n maxHeight,\n empty,\n className,\n}: ListboxProps) {\n const id = useId();\n const [value, setValue] = useControllableState<string | undefined>({\n value: valueProp,\n defaultValue,\n onChange: onValueChange as ((next: string | undefined) => void) | undefined,\n });\n\n // Every option in display order: the roving index is a position in this list.\n const flat = useMemo(\n () => options.flatMap((entry) => (isGroup(entry) ? entry.options : [entry])),\n [options],\n );\n const selectedIndex = flat.findIndex((option) => option.value === value);\n\n const roving = useRovingFocus({\n orientation: 'vertical',\n loop: false,\n typeahead: true,\n defaultIndex: Math.max(0, selectedIndex),\n });\n const { setActiveIndex } = roving;\n\n // A selection made from outside moves the tab stop to it, without stealing focus.\n useEffect(() => {\n if (selectedIndex >= 0) setActiveIndex(selectedIndex);\n }, [selectedIndex, setActiveIndex]);\n\n let index = -1;\n const renderOption = (option: ListboxOption) => {\n index += 1;\n const position = index;\n const selected = option.value === value;\n const item = roving.itemProps(position, {\n disabled: option.disabled,\n label: option.textValue ?? (typeof option.label === 'string' ? option.label : undefined),\n });\n const select = () => {\n if (!option.disabled) setValue(option.value);\n };\n return (\n <div\n key={option.value}\n ref={item.ref}\n tabIndex={item.tabIndex}\n data-roving-index={item['data-roving-index']}\n role=\"option\"\n aria-selected={selected}\n aria-disabled={option.disabled || undefined}\n data-state={selected ? 'selected' : undefined}\n onFocus={() => {\n item.onFocus();\n if (selectionFollowsFocus) select();\n }}\n onClick={select}\n onKeyDown={(event) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n select();\n }\n }}\n className={clsx(\n 'flex w-full cursor-pointer items-center gap-2.5 border-b border-default bg-default px-4 py-2 text-left text-body-xs text-default',\n 'hover:bg-default-secondary',\n 'data-[state=selected]:bg-brand-tertiary data-[state=selected]:font-semibold',\n 'aria-disabled:cursor-not-allowed aria-disabled:text-disabled',\n FOCUS_RING_INSET,\n )}\n >\n <span className=\"min-w-0 flex-1\">{option.label}</span>\n {option.meta !== undefined && (\n <span className=\"shrink-0 whitespace-nowrap font-normal text-default-secondary\">{option.meta}</span>\n )}\n </div>\n );\n };\n\n if (flat.length === 0 && empty) {\n return <div className={cn('px-4 py-6 text-center text-body-xs text-default-secondary', className)}>{empty}</div>;\n }\n\n return (\n <div\n role=\"listbox\"\n aria-label={label}\n {...roving.containerProps}\n className={cn(maxHeight !== undefined && ['overflow-auto overscroll-contain', SCROLLBAR_CLASSES], className)}\n style={maxHeight !== undefined ? { maxHeight } : undefined}\n >\n {options.map((entry, groupIndex) => {\n if (!isGroup(entry)) return <Fragment key={entry.value}>{renderOption(entry)}</Fragment>;\n const headerId = `${id}-group-${groupIndex}`;\n return (\n <div key={`${groupIndex}-${entry.label}`} role=\"group\" aria-labelledby={headerId}>\n <div id={headerId} className=\"border-b border-default bg-default-secondary px-4 py-2\">\n <EyebrowLabel>{entry.label}</EyebrowLabel>\n </div>\n {entry.options.map(renderOption)}\n </div>\n );\n })}\n </div>\n );\n}\n","import { cn } from '../../lib/cn';\nimport type { ReactNode } from 'react';\nimport { Button } from '../forms/button';\n\nexport type SelectionBarPosition = 'sticky' | 'static';\n\nexport interface SelectionBarProps {\n /** What is selected, e.g. \"6 selected · 23.5h\". The bar's headline. */\n label: ReactNode;\n /** A second, quieter line, e.g. whose rows they are. Truncates to one line. */\n description?: ReactNode;\n /**\n * The bulk actions, e.g. `<Button variant=\"danger-subtle\">Reject…</Button>` and\n * `<Button>Approve</Button>`. Put the primary action last, so it sits at the far right.\n */\n children: ReactNode;\n /** Shows a Clear button ahead of the actions, divided from them by a rule. */\n onClear?: () => void;\n /** Label of the Clear button. Default \"Clear\". */\n clearLabel?: string;\n /** Accessible name of the bar's region. Default \"Selection actions\". */\n 'aria-label'?: string;\n /**\n * `sticky` (default) docks the bar 24px above the bottom of its scroll container while it is\n * rendered, centred and at most 880px wide, so the actions stay in reach on a long list.\n * `static` renders it in the flow, for a short list or a docs preview.\n */\n position?: SelectionBarPosition;\n /** Layout only: margin, grid placement. */\n className?: string;\n}\n\nconst POSITION: Record<SelectionBarPosition, string> = {\n sticky: 'sticky bottom-6 z-sticky',\n static: '',\n};\n\n/**\n * The bulk-action bar for a list whose rows can be selected: what is selected, then what can\n * be done with it. Render it only while something is selected; it is a `region`, so a screen\n * reader can jump to it. From Cleo's Team reports (CLEO-631), new in 0.10.3.\n */\nexport function SelectionBar({\n label,\n description,\n children,\n onClear,\n clearLabel = 'Clear',\n 'aria-label': ariaLabel = 'Selection actions',\n position = 'sticky',\n className,\n}: SelectionBarProps) {\n return (\n <div\n role=\"region\"\n aria-label={ariaLabel}\n data-slot=\"selection-bar\"\n data-position={position}\n className={cn(\n 'mx-auto flex w-full max-w-[880px] flex-wrap items-center gap-4 rounded-xl border border-default bg-default py-3 pl-5 pr-3 text-default shadow-400',\n POSITION[position],\n className,\n )}\n >\n <div className=\"flex min-w-0 flex-1 basis-60 flex-col gap-0.5\">\n <span className=\"text-body font-medium\">{label}</span>\n {description !== undefined && <span className=\"truncate text-body-xs text-default-secondary\">{description}</span>}\n </div>\n <div className=\"flex flex-wrap items-center gap-2\">\n {onClear && (\n <>\n <Button variant=\"subtle\" onClick={onClear}>\n {clearLabel}\n </Button>\n <span aria-hidden className=\"h-6 border-l border-default\" />\n </>\n )}\n {children}\n </div>\n </div>\n );\n}\n","import clsx from 'clsx';\nimport type { MouseEvent, ReactElement, ReactNode } from 'react';\nimport { cn } from '../../lib/cn';\nimport { FOCUS_RING } from '../../lib/focus-ring';\nimport { Slot } from '../../lib/slot';\n\nexport type ListRowDensity = 'default' | 'compact';\nexport type ListRowDivider = 'none' | 'top' | 'bottom';\n\nconst DENSITY: Record<ListRowDensity, { pad: string; gap: string; title: string; description: string }> = {\n default: {\n pad: 'py-4',\n gap: 'gap-3',\n title: 'text-body-sm font-semibold text-default',\n description: 'text-body-xs text-default-secondary',\n },\n compact: {\n pad: 'py-2.5',\n gap: 'gap-2',\n title: 'text-body-xs font-semibold text-default',\n description: 'text-body-tiny text-default-secondary',\n },\n};\n\nconst DIVIDER: Record<ListRowDivider, string> = {\n none: '',\n top: 'border-t border-default',\n bottom: 'border-b border-default',\n};\n\nexport interface ListRowProps {\n /** Left of the title, on the title line — an icon badge, avatar, checkbox, file chip. */\n leading?: ReactNode;\n title?: ReactNode;\n /** Inline after the title — a Required/Optional chip, a count, a tag. */\n titleMeta?: ReactNode;\n /** Muted line under the title. */\n description?: ReactNode;\n /** Right end of the title line — a `StatusBadge`, a score, a timestamp. */\n meta?: ReactNode;\n /** Right-hand column spanning the whole row, vertically centred — actions, a `Toggle`. */\n trailing?: ReactNode;\n /** Full-width block below the title line — a `FileRow`, a `FileDropZone`, an alert, a nested list. */\n footer?: ReactNode;\n density?: ListRowDensity;\n divider?: ListRowDivider;\n /** Render an `<li>` instead of a `<div>` — use inside a `<ul>`/`<ol>`. */\n as?: 'div' | 'li';\n onClick?: () => void;\n /**\n * Render onto the single child instead, e.g. a router `<Link>` for a row that navigates.\n * The child is the interactive element and the slots render inside it. New in 0.7.0.\n *\n * <ListRow asChild title=\"Acme\" description=\"Supplier\"><Link to=\"/acme\" /></ListRow>\n */\n asChild?: boolean;\n /** The element to render onto, with `asChild`. Its own children are replaced by the slots. */\n children?: ReactElement;\n /**\n * The row is chosen, in a set where rows toggle on and off (a picker, a multi-select list).\n * Sets `aria-pressed` on a clickable row and `data-state=\"selected\"`, which the row styles.\n * New in 0.7.0; it replaces conditional `bg-brand-tertiary` classes at the call site.\n */\n selected?: boolean;\n /**\n * The row is the current one in a navigation-like list (the open section, this page). Sets\n * `aria-current` and is styled like `selected`. New in 0.7.0.\n */\n current?: boolean | 'page' | 'step' | 'location';\n /** A clickable row that cannot be activated right now. Sets `aria-disabled`. New in 0.7.0. */\n disabled?: boolean;\n /**\n * Accessible name for a clickable row. Strongly recommended whenever `onClick` is set:\n * without it the name is the concatenation of every slot's text.\n */\n 'aria-label'?: string;\n className?: string;\n}\n\n/**\n * The generic list row: six slots and no opinion about what goes in them.\n *\n * Replaces `DocumentRow` and `DocumentChecklistRow`, which baked one product's\n * document-upload flow — its status vocabulary, its five raw-hex pills and its\n * unicode-glyph labels — into the library. Every feature of those rows is reachable by\n * composing this with `FileRow`, `FileDropZone` and `StatusBadge`; see the docs.\n *\n * State is a prop, not a class: `selected`, `current` and `disabled` set the attributes that\n * announce them (`aria-pressed`, `aria-current`, `aria-disabled`, `data-state`) and the row\n * styles itself from those.\n */\nexport function ListRow({\n leading,\n title,\n titleMeta,\n description,\n meta,\n trailing,\n footer,\n density = 'default',\n divider = 'none',\n as: Tag = 'div',\n onClick,\n asChild = false,\n children,\n selected,\n current,\n disabled = false,\n 'aria-label': ariaLabel,\n className,\n}: ListRowProps) {\n const d = DENSITY[density];\n const hasTitleLine = Boolean(leading || title != null || titleMeta || meta);\n const clickable = Boolean(onClick) && !asChild;\n const interactive = clickable || asChild;\n\n const activate = () => {\n if (!disabled) onClick?.();\n };\n\n const rootProps = {\n 'data-state': selected ? 'selected' : undefined,\n 'aria-current': current === true ? ('true' as const) : current || undefined,\n className: cn(\n 'flex w-full items-start',\n d.pad,\n DIVIDER[divider],\n interactive && ['cursor-pointer rounded-lg transition-colors hover:bg-default-secondary/50', FOCUS_RING],\n // State styled from the attributes that announce it.\n 'data-[state=selected]:bg-brand-tertiary aria-[current]:bg-brand-tertiary',\n disabled && 'cursor-not-allowed opacity-60 hover:bg-transparent',\n className,\n ),\n };\n\n const body = (\n <>\n <div className={clsx('flex min-w-0 flex-1 flex-col', d.gap)}>\n {hasTitleLine && (\n <div className=\"flex items-center justify-between gap-2\">\n <div className=\"flex min-w-0 items-center gap-2\">\n {leading}\n {title != null && <span className={clsx('truncate', d.title)}>{title}</span>}\n {titleMeta && <span className=\"shrink-0\">{titleMeta}</span>}\n </div>\n {meta && <span className=\"shrink-0\">{meta}</span>}\n </div>\n )}\n {description && <p className={d.description}>{description}</p>}\n {/* Both slots stop click and key propagation when the row itself is clickable.\n The JSDoc on `trailing` and `footer` advertises putting a `Toggle` or a\n `Button` in them, and through 0.3.0 activating that control fired the nested\n handler *and* the row's `onClick` — so toggling a switch also navigated. */}\n {footer && (\n // These two wrappers are propagation barriers, not controls — they add no\n // behaviour of their own and must not be focusable or take a role.\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <div onClick={stopIfInteractive} onKeyDown={stopIfInteractive}>\n {footer}\n </div>\n )}\n </div>\n {trailing && (\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <div\n className=\"ml-3 flex shrink-0 items-center self-center\"\n onClick={stopIfInteractive}\n onKeyDown={stopIfInteractive}\n >\n {trailing}\n </div>\n )}\n </>\n );\n\n if (asChild) {\n return (\n <Slot\n {...rootProps}\n aria-disabled={disabled || undefined}\n aria-label={ariaLabel}\n // A disabled link must refuse the press, as Button's does: preventing it also stops a\n // router `<Link>`, and leaving the tab order matches a disabled `<button>`.\n tabIndex={disabled ? -1 : undefined}\n onClick={disabled ? refusePress : undefined}\n wrapChildren={() => body}\n >\n {children}\n </Slot>\n );\n }\n\n return (\n <Tag\n {...rootProps}\n onClick={clickable ? activate : undefined}\n // Unlike a <tr>, a div/li has no conflicting implicit role, so button is correct here.\n role={clickable ? 'button' : undefined}\n aria-pressed={clickable && selected !== undefined ? selected : undefined}\n aria-disabled={clickable && disabled ? true : undefined}\n // Without this the row's accessible name is the concatenation of everything inside\n // it — title, meta, description, footer and the label of any nested control.\n aria-label={clickable ? ariaLabel : undefined}\n tabIndex={clickable ? 0 : undefined}\n onKeyDown={\n clickable\n ? (e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n activate();\n }\n }\n : undefined\n }\n >\n {body}\n </Tag>\n );\n}\n\n/**\n * Keeps an interaction with a nested control from also triggering the row.\n *\n * Note the remaining limitation: a focusable descendant inside `role=\"button\"` is invalid\n * ARIA regardless of propagation, so a row that is *itself* clickable and *also* contains\n * controls is a compromise. Prefer either a clickable row with static content, or a static\n * row whose title is its own button.\n */\nfunction stopIfInteractive(event: { stopPropagation: () => void }) {\n event.stopPropagation();\n}\n\nfunction refusePress(event: MouseEvent) {\n event.preventDefault();\n event.stopPropagation();\n}\n","import clsx from 'clsx';\nimport type { ReactNode } from 'react';\nimport { DownloadIcon, Trash2Icon } from 'lucide-react';\nimport { IconButton } from '../forms/icon-button';\nimport { Tooltip } from '../overlays/tooltip';\n\nexport interface FileRowProps {\n name: string;\n /** Muted second line — size, upload date, uploader. */\n detail?: ReactNode;\n /** Leading chip showing the file extension, e.g. `\"PDF\"`. Ignored when `leading` is set. */\n fileType?: string;\n /** Custom leading node — overrides `fileType`. */\n leading?: ReactNode;\n /** The canonical action. Renders a download icon button. */\n onDownload?: () => void;\n /** Tooltip, and the start of the button's name (\"Download report.pdf\"). Default \"Download\". */\n downloadLabel?: string;\n /** Renders a remove icon button after download. New in 0.8.0. */\n onRemove?: () => void;\n /** Tooltip, and the start of the button's name (\"Remove report.pdf\"). Default \"Remove\". */\n removeLabel?: string;\n /** Anything else on the right, after the built-in actions — a `DropdownMenu`, review buttons. */\n actions?: ReactNode;\n className?: string;\n}\n\n/** The extension chip. Lifted unchanged from the deleted `DocumentRow`. */\nfunction FileTypeBadge({ type }: { type: string }) {\n return (\n <span className=\"flex size-[34px] shrink-0 items-center justify-center rounded-md bg-brand-tertiary text-body-tiny font-semibold text-brand\">\n {type}\n </span>\n );\n}\n\n/**\n * One attached file: name, optional detail line, and actions.\n *\n * This strip was hardcoded inline inside both `DocumentRow` and\n * `DocumentChecklistRow`. Nothing about it is document-specific — it is the same row\n * for a generated export, an invoice or an evidence attachment.\n *\n * Download and remove are same-size subtle icon buttons (24px, with a larger touch hit area),\n * the way upload and attachment lists do it (Ant Design's Upload list, Gmail, Drive). Through\n * 0.7.1 download was a bare text link and remove was whatever `Button` the caller passed, so\n * the two never matched. Each is named with the file (\"Download report.pdf\") so a list of files\n * does not read as a column of identical buttons, and shows its short label as a tooltip.\n */\nexport function FileRow({\n name,\n detail,\n fileType,\n leading,\n onDownload,\n downloadLabel = 'Download',\n onRemove,\n removeLabel = 'Remove',\n actions,\n className,\n}: FileRowProps) {\n const lead = leading ?? (fileType ? <FileTypeBadge type={fileType} /> : null);\n\n return (\n <div\n className={clsx(\n 'flex items-center gap-3 rounded-lg border border-default bg-default px-3 py-2.5',\n className,\n )}\n >\n {lead}\n <div className=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <span className=\"truncate text-body-sm font-medium text-default\">{name}</span>\n {detail && <span className=\"text-body-xs text-default-secondary\">{detail}</span>}\n </div>\n {(onDownload || onRemove || actions) && (\n <div className=\"flex shrink-0 items-center gap-1\">\n {onDownload && (\n <Tooltip title={downloadLabel}>\n <IconButton variant=\"subtle\" size=\"sm\" aria-label={`${downloadLabel} ${name}`} onClick={onDownload} className=\"touch-hit\">\n <DownloadIcon aria-hidden />\n </IconButton>\n </Tooltip>\n )}\n {onRemove && (\n <Tooltip title={removeLabel}>\n <IconButton variant=\"subtle\" size=\"sm\" aria-label={`${removeLabel} ${name}`} onClick={onRemove} className=\"touch-hit\">\n <Trash2Icon aria-hidden />\n </IconButton>\n </Tooltip>\n )}\n {actions && <div className=\"ml-2 flex items-center gap-2\">{actions}</div>}\n </div>\n )}\n </div>\n );\n}\n","import clsx from 'clsx';\nimport type { ReactNode } from 'react';\n\nexport type ScoredRowAlign = 'center' | 'end';\n/** 8 / 12 / 20 / 48px — the four gaps the source mockups actually used. */\nexport type ScoredRowGap = 'sm' | 'md' | 'lg' | 'xl';\n\nconst GAP: Record<ScoredRowGap, string> = {\n sm: 'gap-2',\n md: 'gap-3',\n lg: 'gap-5',\n xl: 'gap-12',\n};\n\nconst ALIGN: Record<ScoredRowAlign, string> = {\n center: 'items-center',\n end: 'items-end',\n};\n\nexport interface ScoredRowProps {\n /** Leading visual — an `EntityIconBadge`, an `Avatar`, a rank number, or nothing. */\n leading?: ReactNode;\n title: ReactNode;\n subtitle?: ReactNode;\n /** Fixed-width column between the title block and the meter. */\n aside?: ReactNode;\n /** The bar. Put a `<ProgressBar>` here — the row does not choose one for you. */\n meter?: ReactNode;\n /** Right-hand value — a `<ScoreValue>`, a `<TrendLabel>`, a `<Badge>`, a button. */\n trailing?: ReactNode;\n /** CSS width values. Omit one and that slot flexes instead. */\n titleWidth?: string;\n asideWidth?: string;\n meterWidth?: string;\n trailingWidth?: string;\n gap?: ScoredRowGap;\n /** Gap between `leading` and the title block. Defaults to `gap`. */\n leadingGap?: ScoredRowGap;\n align?: ScoredRowAlign;\n className?: string;\n}\n\n/**\n * A row with a title block, an optional bar and a right-hand value.\n *\n * Was `EntityRow`. The rename is the smaller half of the change: the old component\n * hardcoded `RiskScore`, `WidgetProgressBar`, `TrendLabel` and `getRiskTone`, which\n * locked it to one scoring domain and forced 32 props — including four raw\n * `CSSProperties` escape hatches and a magic `nameWidth = '133px'` — to make it fit\n * anything else. The score and the bar are now slots, so the caller decides.\n */\nexport function ScoredRow({\n leading,\n title,\n subtitle,\n aside,\n meter,\n trailing,\n titleWidth,\n asideWidth,\n meterWidth,\n trailingWidth,\n gap = 'md',\n leadingGap,\n align = 'center',\n className,\n}: ScoredRowProps) {\n return (\n <div className={clsx('flex w-full', ALIGN[align], GAP[gap], className)}>\n <div\n className={clsx(\n 'flex min-w-0',\n ALIGN[align],\n GAP[leadingGap ?? gap],\n titleWidth ? 'shrink-0' : 'flex-1',\n )}\n style={titleWidth ? { width: titleWidth } : undefined}\n >\n {leading}\n <div className=\"min-w-0 flex-1\">\n <p className=\"truncate text-body-sm font-medium leading-none text-default\">{title}</p>\n {subtitle && <p className=\"mt-0.5 truncate text-body-xs text-default-secondary\">{subtitle}</p>}\n </div>\n </div>\n\n {aside && (\n <div\n className={clsx('min-w-0', asideWidth ? 'shrink-0' : 'flex-1')}\n style={asideWidth ? { width: asideWidth } : undefined}\n >\n {aside}\n </div>\n )}\n\n {meter && (\n <div\n className={clsx('min-w-0', meterWidth ? 'shrink-0' : 'flex-1')}\n style={meterWidth ? { width: meterWidth } : undefined}\n >\n {meter}\n </div>\n )}\n\n {trailing && (\n <div className=\"shrink-0 text-right\" style={trailingWidth ? { width: trailingWidth } : undefined}>\n {trailing}\n </div>\n )}\n </div>\n );\n}\n","import clsx from 'clsx';\nimport { ProgressBar } from '../feedback/progress-bar';\nimport type { ProgressBarTone } from '../feedback/progress-bar';\nimport { ScoreValue, getScoreTone } from '../stats/score-value';\nimport type { ScoreDirection, ScoreValueSize, ScoreValueWeight } from '../stats/score-value';\n\nexport interface NumberedListItem {\n title: string;\n /** Second line under the title — a region, a category, an id. */\n subtitle?: string;\n score: number;\n /** Bar and value colour for this row. `auto` derives it from `score`. */\n tone?: ProgressBarTone | 'auto';\n}\n\nexport type NumberedListGap = 'sm' | 'md';\n\nexport interface NumberedListProps {\n items: NumberedListItem[];\n /** Which end of the scale is bad, for rows resolving `tone` automatically. */\n direction?: ScoreDirection;\n scoreSize?: ScoreValueSize;\n scoreWeight?: ScoreValueWeight;\n /** First ordinal. Set it to continue a list across a page boundary. */\n startAt?: number;\n gap?: NumberedListGap;\n className?: string;\n}\n\nconst GAP: Record<NumberedListGap, string> = {\n sm: 'gap-2',\n md: 'gap-3',\n};\n\n/**\n * A ranked leaderboard: ordinal, title, score, and a full-width bar under each row.\n *\n * Was `RankedRow`, which was one row and made the caller supply both the `<ol>` and every\n * `rank` by hand — so a filtered or re-sorted list silently kept stale numbers. Owning the\n * list means the ordinal is derived from position and cannot disagree with the order on\n * screen. It also puts it at the same granularity as `StepsList`, its neighbour.\n *\n * It still hardcodes `ProgressBar` and `ScoreValue`, and that is the point: a leaderboard\n * row *is* those three things. Where the pieces need to vary, reach for `ScoredRow`, whose\n * slots take arbitrary content.\n */\nexport function NumberedList({\n items,\n direction = 'higher-is-worse',\n scoreSize = 'md',\n scoreWeight = 'bold',\n startAt = 1,\n gap = 'md',\n className,\n}: NumberedListProps) {\n return (\n <ol className={clsx('flex list-none flex-col p-0', GAP[gap], className)}>\n {items.map((item, index) => {\n const tone =\n !item.tone || item.tone === 'auto'\n ? getScoreTone(item.score, { direction })\n : item.tone;\n\n return (\n <li key={`${item.title}-${index}`} className=\"flex w-full shrink-0 flex-col gap-1.5\">\n <div className=\"flex w-full items-center justify-between\">\n <div className=\"flex min-w-0 items-center gap-2.5\">\n {/* Fixed width so the titles align whether the ordinal is 1 or 10. */}\n <span className=\"w-[14px] shrink-0 text-body-xs font-bold text-default-secondary\">\n {startAt + index}\n </span>\n <div className=\"flex min-w-0 flex-col gap-px\">\n <span className=\"truncate text-body-sm font-medium leading-none text-default\">\n {item.title}\n </span>\n {item.subtitle && (\n <span className=\"text-body-tiny text-default-tertiary\">{item.subtitle}</span>\n )}\n </div>\n </div>\n <ScoreValue\n value={item.score}\n size={scoreSize}\n weight={scoreWeight}\n tone={tone}\n className=\"ml-2 shrink-0\"\n />\n </div>\n <ProgressBar value={item.score} tone={tone} aria-label={`${item.title} score`} />\n </li>\n );\n })}\n </ol>\n );\n}\n","import clsx from 'clsx';\nimport type { ReactNode } from 'react';\n\nexport interface IconTextRowProps {\n icon: ReactNode;\n title: string;\n detail: string;\n className?: string;\n}\n\n/**\n * A circular icon badge, a title, and one line of detail.\n *\n * Feature lists, empty-state explanations, onboarding intros, \"what happens next\"\n * steps. Was `FeatureRow`, which named it after the one screen it was extracted from.\n */\nexport function IconTextRow({ icon, title, detail, className }: IconTextRowProps) {\n return (\n <div className={clsx('flex items-start gap-3', className)}>\n <span className=\"flex size-9 shrink-0 items-center justify-center rounded-full bg-brand-tertiary text-brand\">\n {icon}\n </span>\n <div className=\"min-w-0\">\n <p className=\"text-body-sm font-semibold text-default\">{title}</p>\n <p className=\"mt-0.5 text-body-xs text-default-secondary\">{detail}</p>\n </div>\n </div>\n );\n}\n","import clsx from 'clsx';\nimport { CheckIcon } from 'lucide-react';\n\nexport type ChecklistRowState = 'done' | 'active' | 'pending';\n\nexport interface ChecklistRowProps {\n label: string;\n state: ChecklistRowState;\n className?: string;\n}\n\n/**\n * One step in a progress checklist: a done tick, a spinning active ring, or an empty\n * pending ring.\n *\n * Shared by the event-onboarding \"building your dashboard\" screen and the\n * intelligence page's processing checklist. Both drove the same three states; only\n * the onboarding copy had the animated ring, which is the better treatment and is\n * adopted for both.\n *\n * Renders an `<li>` — callers must wrap it in a list, which is what both sources did.\n */\nexport function ChecklistRow({ label, state, className }: ChecklistRowProps) {\n return (\n <li data-state={state} className={clsx('flex items-center gap-3', className)}>\n <span className=\"flex size-5 shrink-0 items-center justify-center\">\n {state === 'done' ? (\n <CheckIcon className=\"size-4 text-positive\" strokeWidth={2.5} aria-hidden />\n ) : (\n <span\n className={clsx(\n 'size-3.5 rounded-full border-2',\n state === 'active'\n ? 'motion-safe:animate-pulse border-brand-emphasis border-t-transparent'\n : 'border-disabled',\n )}\n />\n )}\n </span>\n <span\n className={clsx(\n 'text-body-sm',\n state === 'pending' ? 'text-default-tertiary' : 'font-semibold text-default',\n )}\n >\n {label}\n </span>\n </li>\n );\n}\n","import clsx from 'clsx';\nimport type { ReactNode } from 'react';\n\nexport interface StepsListProps {\n steps: ReactNode[];\n className?: string;\n}\n\n/**\n * Ordered list of instructions with small filled number bullets.\n *\n * Was `NumberedStepsList`. Renamed in 0.5.0 because `NumberedList` — the ranked\n * leaderboard — also numbers its rows, and two components whose names both led with\n * \"Numbered\" gave no hint which was which. The distinction is what the numbers *mean*:\n * here they are sequence (\"do this, then this\"), there they are rank.\n *\n * The bullet was `bg-[#e7edfb] text-[#1d4ed8]` — a pale blue pair that is not in the\n * token set. It now uses the brand-tertiary background and brand text, which is the\n * documented treatment for a subtle brand-tinted chip.\n */\nexport function StepsList({ steps, className }: StepsListProps) {\n return (\n <ol className={clsx('flex flex-col gap-1.5', className)}>\n {steps.map((step, i) => (\n // `text-[12px]` was off the type scale; 12 sits midway between Scale 01 (11) and\n // Scale 02 (13), so it rounds up to 13 like every other snap in this pass.\n <li key={i} className=\"flex items-start gap-2 text-body-xs text-default\">\n <span className=\"mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-full bg-brand-tertiary text-[9px] font-bold text-brand\">\n {i + 1}\n </span>\n {step}\n </li>\n ))}\n </ol>\n );\n}\n","import clsx from 'clsx';\nimport type { ReactNode } from 'react';\n\nexport type DetailItemLayout = 'stacked' | 'inline';\nexport type DetailItemSpan = 1 | 2 | 'full';\n\nexport interface DetailItemProps {\n label: string;\n value: ReactNode;\n /** Optional second line under the value. */\n detail?: ReactNode;\n /**\n * `stacked` puts the label above the value (detail pages, review summaries).\n * `inline` puts a fixed-width label beside it (drawer detail rows).\n */\n layout?: DetailItemLayout;\n /**\n * Columns to occupy inside a `DetailGrid`. `full` spans the row — for a long value\n * such as an alias list or a legal name that would otherwise truncate.\n */\n span?: DetailItemSpan;\n /**\n * Label column width for the `inline` layout. A `min-w`/`max-w` pair rather than a\n * fixed `w-`, so a long label wraps instead of colliding with the value.\n */\n labelWidth?: string;\n className?: string;\n}\n\nconst SPAN: Record<DetailItemSpan, string> = {\n 1: '',\n 2: 'sm:col-span-2',\n full: 'col-span-full',\n};\n\n/**\n * A label/value pair.\n *\n * Was `MetaField` — an internal codename that said nothing about the shape. Consolidates\n * the same pair from six places: an entity-detail overview grid, a reviewer-detail metric\n * column, three `DetailRow` copies in drawers, and `ReviewMeta` in two onboarding wizards.\n *\n * An empty value renders an em dash, which is what every source copy did by hand. Note\n * that the check is for `null`/`undefined`/`''` only — `0` and `false` are real values and\n * render as themselves.\n */\nexport function DetailItem({\n label,\n value,\n detail,\n layout = 'stacked',\n span = 1,\n labelWidth = 'min-w-[96px] max-w-[140px]',\n className,\n}: DetailItemProps) {\n const shown = value === null || value === undefined || value === '' ? '—' : value;\n\n if (layout === 'inline') {\n return (\n <div className={clsx('flex gap-3 text-body-xs', SPAN[span], className)}>\n <span className={clsx('shrink-0 text-default-secondary', labelWidth)}>{label}</span>\n {/* `detail` used to be dropped silently in this branch. */}\n {/* `overflow-wrap:anywhere` on the values: detail rows hold URLs, IDs and email\n addresses with no break opportunity, which otherwise overflow the row. */}\n <span className=\"flex min-w-0 flex-1 flex-col gap-0.5 [overflow-wrap:anywhere]\">\n <span className=\"text-default\">{shown}</span>\n {detail && <span className=\"text-default-secondary\">{detail}</span>}\n </span>\n </div>\n );\n }\n\n return (\n <div className={clsx('flex min-w-0 flex-col gap-0.5', SPAN[span], className)}>\n <p className=\"text-body-tiny font-medium text-default-secondary\">{label}</p>\n <p className=\"text-body-sm font-medium text-default [overflow-wrap:anywhere]\">{shown}</p>\n {detail && <p className=\"text-body-xs text-default-secondary [overflow-wrap:anywhere]\">{detail}</p>}\n </div>\n );\n}\n\nexport type DetailGridColumns = 2 | 3 | 4 | 'auto';\n\nexport interface DetailGridProps {\n children: ReactNode;\n columns?: DetailGridColumns;\n className?: string;\n}\n\nconst COLUMNS: Record<DetailGridColumns, string> = {\n // Fills the row whatever its width, and reflows to fewer columns as it narrows.\n auto: 'grid-cols-[repeat(auto-fit,minmax(180px,1fr))]',\n 2: 'grid-cols-1 sm:grid-cols-2',\n 3: 'grid-cols-1 sm:grid-cols-2 lg:grid-cols-3',\n 4: 'grid-cols-2 sm:grid-cols-3 lg:grid-cols-4',\n};\n\n/**\n * Wrapper for a set of `DetailItem`s.\n *\n * A real grid, not the `flex flex-wrap` it was as `MetaFieldGrid`. Under flex-wrap every\n * item had to carry its own width (`sm:w-[262px]` was the documented idiom) and whatever\n * space was left over at the end of a row stayed empty — so a three-item row in a wide\n * card had a ragged gap on the right. `1fr` tracks divide the row exactly, and an item\n * that genuinely needs more room asks for it with `span` instead of a magic width.\n */\nexport function DetailGrid({ children, columns = 'auto', className }: DetailGridProps) {\n return (\n <div className={clsx('grid gap-x-4 gap-y-4', COLUMNS[columns], className)}>{children}</div>\n );\n}\n","import { useEffect, useState, type ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { CheckIcon, CopyIcon } from 'lucide-react';\nimport { cn } from '../../lib/cn';\nimport { IconButton } from '../forms/icon-button';\n\n/**\n * Label/value rows for a detail page, as a real `<dl>`. New in 0.7.0, from SCIC.\n *\n * Use it for a profile or account summary read top to bottom. `DetailGrid` / `DetailItem`\n * are for a multi-column summary card. The rows here are width-aware without a breakpoint: the\n * label has a fixed basis and the value a minimum one, and the row wraps, so in a narrow panel\n * (a one-third column, a 320px phone, 200% zoom) the value drops below its label instead of\n * being squeezed into a sliver beside it.\n */\nexport interface DescriptionListProps {\n children: ReactNode;\n className?: string;\n}\n\nexport function DescriptionList({ children, className }: DescriptionListProps) {\n return <dl className={cn('flex flex-col gap-3', className)}>{children}</dl>;\n}\n\nexport interface DescriptionItemProps {\n label: string;\n /** An empty value renders an em dash. */\n value: ReactNode;\n /**\n * Adds a copy-to-clipboard button. Pass the plain string to copy: emails and ids are long,\n * unbroken and commonly pasted elsewhere.\n */\n copyValue?: string;\n className?: string;\n}\n\nexport function DescriptionItem({ label, value, copyValue, className }: DescriptionItemProps) {\n const shown = value === null || value === undefined || value === '' ? '—' : value;\n return (\n <div className={cn('flex flex-wrap items-start gap-x-4 gap-y-0.5 text-body-xs', className)}>\n <dt className=\"shrink-0 grow-0 basis-28 text-default-secondary\">{label}</dt>\n {/* `min-w-0` lets the value shrink below its content; `overflow-wrap:anywhere` lets an\n unbroken token (an email, a URL, an id) break rather than overflow. */}\n <dd className=\"flex min-w-0 flex-[1_1_10rem] items-start gap-1.5 text-default\">\n <span className=\"min-w-0 [overflow-wrap:anywhere]\">{shown}</span>\n {copyValue && <CopyButton value={copyValue} label={`Copy ${label.toLowerCase()}`} />}\n </dd>\n </div>\n );\n}\n\nexport interface CopyButtonProps {\n /** The text to copy. */\n value: string;\n /** The button's accessible name, e.g. \"Copy email\". */\n label: string;\n /** Announced after a copy. Default \"Copied\". */\n copiedLabel?: string;\n className?: string;\n}\n\n/**\n * An icon button that copies `value` to the clipboard, shows a tick for two seconds, and\n * announces the copy in a polite live region. Exported for ids and codes outside a\n * `DescriptionList`.\n */\nexport function CopyButton({ value, label, copiedLabel = 'Copied', className }: CopyButtonProps) {\n const [copied, setCopied] = useState(false);\n\n useEffect(() => {\n if (!copied) return;\n const timer = window.setTimeout(() => setCopied(false), 2000);\n return () => window.clearTimeout(timer);\n }, [copied]);\n\n return (\n // relative: keeps the sr-only status (absolutely positioned) inside a scrolling container.\n <span className=\"relative inline-flex\">\n <IconButton\n variant=\"subtle\"\n size=\"sm\"\n aria-label={label}\n data-state={copied ? 'copied' : undefined}\n className={cn('-my-0.5 touch-hit', className)}\n onClick={() => {\n void navigator.clipboard?.writeText(value).then(\n () => setCopied(true),\n () => undefined,\n );\n }}\n >\n {copied ? <CheckIcon aria-hidden /> : <CopyIcon aria-hidden />}\n </IconButton>\n <span role=\"status\" className=\"sr-only\">\n {copied ? copiedLabel : ''}\n </span>\n </span>\n );\n}\n\n/**\n * A one-line email that truncates the local part and keeps the domain:\n * `alexandra.konstan…@example.com`. The full address stays in the DOM (screen readers and copy\n * get all of it) and in `title`. Pair it with `copyValue`, so touch users, who cannot hover, can\n * still get the address.\n *\n * An email never wraps. It ellipsises through explicit overflow classes rather than the\n * `truncate` utility, because containers that un-truncate for touch target `.truncate`.\n * `DataTable`'s card layout does that, and through 0.9.0 it broke an address mid-word\n * (\"alex.reviewer@example.tes / t\").\n */\nexport function EmailText({ email, className }: { email: string; className?: string }) {\n const at = email.lastIndexOf('@');\n const local = at > 0 ? email.slice(0, at) : email;\n const domain = at > 0 ? email.slice(at) : '';\n return (\n <span title={email} data-slot=\"email-text\" className={clsx('flex min-w-0 max-w-full', className)}>\n <span className=\"min-w-0 overflow-hidden text-ellipsis whitespace-nowrap\">{local}</span>\n {/* Near-zero shrink: the local part gives up its width first. */}\n {domain && (\n <span className=\"min-w-0 overflow-hidden text-ellipsis whitespace-nowrap [flex-shrink:0.001]\">{domain}</span>\n )}\n </span>\n );\n}\n","import clsx from 'clsx';\nimport type { ReactNode } from 'react';\nimport { CheckIcon } from 'lucide-react';\n\nexport type CheckedGroupListColumns = 1 | 2 | 3;\n\n/** One labelled group of ticked items. */\nexport interface CheckedGroup {\n label: string;\n items: string[];\n}\n\nexport interface CheckedGroupListProps {\n groups: CheckedGroup[];\n columns?: CheckedGroupListColumns;\n /** Leading glyph for every item. Defaults to a check; pass `null` for none. */\n icon?: ReactNode | null;\n emptyLabel?: string;\n className?: string;\n}\n\nconst COLUMNS: Record<CheckedGroupListColumns, string> = {\n 1: 'columns-1',\n 2: 'columns-2',\n 3: 'columns-3',\n};\n\n/**\n * A read-only, grouped list of ticked items in a balanced multi-column flow.\n *\n * Was `PermissionGrid` — RBAC-specific naming for a generic shape, and not a grid\n * either: groups pack tightly down each column rather than aligning to shared row\n * heights, so a tall group beside a short one leaves no ragged gap.\n * `break-inside-avoid` keeps each group whole within a column.\n *\n * Granted permissions, included plan features, completed requirements, matched\n * criteria — anything that is \"these labels, grouped, all ticked\".\n */\nexport function CheckedGroupList({\n groups,\n columns = 2,\n icon,\n emptyLabel = 'None.',\n className,\n}: CheckedGroupListProps) {\n if (groups.length === 0) {\n return <p className={clsx('text-body-xs text-default-secondary', className)}>{emptyLabel}</p>;\n }\n\n // `undefined` means \"not passed\" → default check. `null` means \"explicitly none\".\n const glyph = icon === undefined ? <CheckIcon className=\"size-3.5\" strokeWidth={2.5} aria-hidden /> : icon;\n\n return (\n <div className={clsx(COLUMNS[columns], 'gap-x-6', className)}>\n {groups.map((group) => (\n <div key={group.label} className=\"mb-5 break-inside-avoid last:mb-0\">\n <p className=\"mb-2 text-body-tiny font-semibold uppercase tracking-wide text-default-secondary\">\n {group.label}\n </p>\n <ul className=\"space-y-1.5\">\n {group.items.map((item) => (\n <li key={item} className=\"flex items-center gap-2 text-body-xs text-default\">\n {glyph && <span className=\"shrink-0\">{glyph}</span>}\n {item}\n </li>\n ))}\n </ul>\n </div>\n ))}\n </div>\n );\n}\n","import { useMemo, useRef, useState, type KeyboardEvent, type ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { ChevronRightIcon } from 'lucide-react';\n\nimport { useControllableState } from '../../lib/use-controllable-state';\n\nexport type TreeViewSize = 'sm' | 'md';\n\nexport interface TreeItemState {\n /** 1 for a root item. */\n level: number;\n hasChildren: boolean;\n expanded: boolean;\n selected: boolean;\n}\n\nexport interface TreeViewProps<T> {\n /** Root items. */\n items: readonly T[];\n getId: (item: T) => string;\n /** Children of an item. Omit (or return nothing) for a flat list. */\n getChildren?: (item: T) => readonly T[] | undefined;\n /**\n * The row content — a slot rather than props, so the caller decides what a node shows\n * (an avatar, a code, a status badge). The chevron, indentation and selection highlight\n * are drawn by the tree.\n */\n renderItem: (item: T, state: TreeItemState) => ReactNode;\n /** Accessible name of the tree. */\n label: string;\n /** Ids of expanded items. Controlled. */\n expanded?: string[];\n defaultExpanded?: string[];\n onExpandedChange?: (expanded: string[]) => void;\n /** Id of the selected item. Controlled. */\n selected?: string | null;\n defaultSelected?: string | null;\n /** Fired on click, Enter or Space. */\n onSelect?: (id: string, item: T) => void;\n size?: TreeViewSize;\n className?: string;\n}\n\ninterface FlatNode<T> {\n id: string;\n item: T;\n level: number;\n parentId: string | null;\n hasChildren: boolean;\n expanded: boolean;\n}\n\nconst ROW: Record<TreeViewSize, string> = {\n sm: 'min-h-8 py-1 text-body-xs',\n md: 'min-h-10 py-2 text-body-sm',\n};\n\n/** Indentation per level, in px. Data-driven, so it is an inline style rather than a class. */\nconst INDENT = 18;\n\n/**\n * An expandable tree — the ARIA tree pattern, with one tab stop.\n *\n * Focus is a roving tabindex over the *visible* rows, kept here rather than in\n * `useRovingFocus` because a tree gives Left and Right their own meaning: Right expands a\n * closed node or steps into an open one, Left collapses an open node or steps out to its\n * parent. Selection is separate from focus — arrowing does not select — so browsing a\n * controlled tree fires no `onSelect`.\n *\n * Children render inside a real `role=\"group\"`, which is what lets a screen reader announce\n * level and position without `aria-level` being guessed from indentation.\n */\nexport function TreeView<T>({\n items,\n getId,\n getChildren,\n renderItem,\n label,\n expanded: expandedProp,\n defaultExpanded = [],\n onExpandedChange,\n selected: selectedProp,\n defaultSelected = null,\n onSelect,\n size = 'md',\n className,\n}: TreeViewProps<T>) {\n const [expanded, setExpanded] = useControllableState<string[]>({\n value: expandedProp,\n defaultValue: defaultExpanded,\n onChange: onExpandedChange,\n });\n const [selected, setSelected] = useControllableState<string | null>({\n value: selectedProp,\n defaultValue: defaultSelected,\n });\n const [focusedId, setFocusedId] = useState<string | null>(null);\n const rowRefs = useRef(new Map<string, HTMLElement>());\n\n const expandedSet = useMemo(() => new Set(expanded), [expanded]);\n\n // Visible rows in document order — what the arrow keys walk.\n const visible = useMemo(() => {\n const out: FlatNode<T>[] = [];\n const walk = (nodes: readonly T[], level: number, parentId: string | null) => {\n for (const item of nodes) {\n const id = getId(item);\n const children = getChildren?.(item) ?? [];\n const isOpen = children.length > 0 && expandedSet.has(id);\n out.push({ id, item, level, parentId, hasChildren: children.length > 0, expanded: isOpen });\n if (isOpen) walk(children, level + 1, id);\n }\n };\n walk(items, 1, null);\n return out;\n }, [items, getId, getChildren, expandedSet]);\n\n // The single tab stop: the focused row if still visible, else the selection, else the first.\n const tabStop =\n visible.find((n) => n.id === focusedId)?.id ??\n visible.find((n) => n.id === selected)?.id ??\n visible[0]?.id;\n\n const focus = (id: string | undefined) => {\n if (!id) return;\n setFocusedId(id);\n rowRefs.current.get(id)?.focus();\n };\n\n const toggle = (id: string, open: boolean) => {\n setExpanded((prev) => (open ? [...prev.filter((x) => x !== id), id] : prev.filter((x) => x !== id)));\n };\n\n const choose = (node: FlatNode<T>) => {\n setSelected(node.id);\n onSelect?.(node.id, node.item);\n };\n\n const onKeyDown = (event: KeyboardEvent, node: FlatNode<T>) => {\n const index = visible.findIndex((n) => n.id === node.id);\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n focus(visible[index + 1]?.id);\n break;\n case 'ArrowUp':\n event.preventDefault();\n focus(visible[index - 1]?.id);\n break;\n case 'ArrowRight':\n event.preventDefault();\n if (node.hasChildren && !node.expanded) toggle(node.id, true);\n else if (node.expanded) focus(visible[index + 1]?.id);\n break;\n case 'ArrowLeft':\n event.preventDefault();\n if (node.expanded) toggle(node.id, false);\n else if (node.parentId) focus(node.parentId);\n break;\n case 'Home':\n event.preventDefault();\n focus(visible[0]?.id);\n break;\n case 'End':\n event.preventDefault();\n focus(visible[visible.length - 1]?.id);\n break;\n case 'Enter':\n case ' ':\n event.preventDefault();\n choose(node);\n break;\n default:\n break;\n }\n };\n\n const renderLevel = (nodes: readonly T[], level: number): ReactNode =>\n nodes.map((item, i) => {\n const id = getId(item);\n const node = visible.find((n) => n.id === id);\n // Not visible means an ancestor is collapsed — but then this level is not rendered at all.\n if (!node) return null;\n const children = getChildren?.(item) ?? [];\n const isSelected = selected === id;\n\n return (\n <li\n key={id}\n role=\"treeitem\"\n aria-level={level}\n aria-setsize={nodes.length}\n aria-posinset={i + 1}\n aria-expanded={node.hasChildren ? node.expanded : undefined}\n aria-selected={isSelected}\n tabIndex={tabStop === id ? 0 : -1}\n ref={(el) => {\n if (el) rowRefs.current.set(id, el);\n else rowRefs.current.delete(id);\n }}\n onFocus={(event) => {\n // Only the row itself — focus bubbling up from a nested row must not steal it.\n if (event.target === event.currentTarget) setFocusedId(id);\n }}\n onKeyDown={(event) => {\n if (event.target === event.currentTarget) onKeyDown(event, node);\n }}\n className=\"outline-none [&:focus-visible>div]:ring-2 [&:focus-visible>div]:ring-inset [&:focus-visible>div]:ring-brand\"\n >\n {/* The row is a click target, but the keyboard contract lives on the treeitem above,\n which owns focus — the same split Combobox makes with its options. */}\n {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */}\n <div\n onClick={() => {\n focus(id);\n choose(node);\n }}\n style={{ paddingLeft: 8 + (level - 1) * INDENT }}\n className={clsx(\n 'flex w-full cursor-pointer items-center gap-1.5 rounded-md pr-2 transition-colors',\n ROW[size],\n isSelected ? 'bg-brand-secondary text-default' : 'text-default hover:bg-default-secondary',\n )}\n >\n {node.hasChildren ? (\n // Not a button: the treeitem is the one tab stop, and Left/Right already toggle.\n // A pointer user still needs a target that toggles without selecting.\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions\n <span\n aria-hidden\n data-tree-toggle=\"\"\n onClick={(event) => {\n event.stopPropagation();\n toggle(id, !node.expanded);\n focus(id);\n }}\n className=\"flex size-5 shrink-0 items-center justify-center rounded text-icon-default-secondary hover:bg-default-tertiary\"\n >\n <ChevronRightIcon className={clsx('size-3.5 transition-transform motion-reduce:transition-none', node.expanded && 'rotate-90')} />\n </span>\n ) : (\n <span aria-hidden className=\"size-5 shrink-0\" />\n )}\n <div className=\"min-w-0 flex-1\">\n {renderItem(item, {\n level,\n hasChildren: node.hasChildren,\n expanded: node.expanded,\n selected: isSelected,\n })}\n </div>\n </div>\n {node.expanded && (\n <ul role=\"group\" className=\"m-0 list-none p-0\">\n {renderLevel(children, level + 1)}\n </ul>\n )}\n </li>\n );\n });\n\n return (\n <ul role=\"tree\" aria-label={label} className={clsx('m-0 flex list-none flex-col p-0', className)}>\n {renderLevel(items, 1)}\n </ul>\n );\n}\n","export { Button } from './components/forms/button';\nexport type { ButtonProps, ButtonVariant, ButtonSize } from './components/forms/button';\n\nexport { IconButton } from './components/forms/icon-button';\nexport type { IconButtonProps, IconButtonVariant } from './components/forms/icon-button';\n\nexport { ButtonGroup } from './components/forms/button-group';\nexport type { ButtonGroupProps, ButtonGroupItem, ButtonGroupVariant, ButtonGroupAlign } from './components/forms/button-group';\n\nexport { Avatar } from './components/avatar/avatar';\nexport type { AvatarProps, AvatarInitialProps, AvatarImageProps, AvatarSize, AvatarShape } from './components/avatar/avatar';\n\nexport { AvatarGroup } from './components/avatar/avatar-group';\nexport type { AvatarGroupProps, AvatarGroupSpacing } from './components/avatar/avatar-group';\n\nexport { AvatarBlock } from './components/avatar/avatar-block';\nexport type { AvatarBlockProps } from './components/avatar/avatar-block';\n\n\n// ── Field ──────────────────────────────────────────────────────────────────────\n// The label / description / error / control wiring. From 0.10.0 the only place a field's text\n// lives: the controls are bare, and a form (or `Form`) composes them inside a Field.\n\nexport {\n Field,\n FieldLabel,\n FieldDescription,\n FieldError,\n FieldHint,\n FieldGroup,\n FieldSet,\n FieldLegend,\n FieldSeparator,\n useFieldContext,\n useFieldControl,\n} from './components/forms/field';\nexport type {\n FieldProps,\n FieldLabelProps,\n FieldTextProps,\n FieldGroupProps,\n FieldSetProps,\n FieldLegendProps,\n FieldSeparatorProps,\n FieldOrientation,\n FieldContextValue,\n FieldPart,\n} from './components/forms/field';\n\nexport { Input, InputControl } from './components/forms/input';\nexport type { InputProps, InputControlProps, InputSize } from './components/forms/input';\n\n// Supplies a default `size` to the form controls beneath it. `FilterBar` is the built-in\n// provider; export it so an app can set a density for a form section of its own.\nexport { ControlSizeProvider, useControlSize } from './components/forms/control-size';\nexport type { ControlSizeProviderProps } from './components/forms/control-size';\n\nexport { Textarea, TextareaControl } from './components/forms/textarea';\nexport type { TextareaProps, TextareaControlProps } from './components/forms/textarea';\n\nexport { Select, SelectControl } from './components/forms/select';\nexport type {\n SelectProps,\n SelectControlProps,\n SelectOption,\n SelectOptionGroup,\n} from './components/forms/select';\n\nexport { NativeSelect, NativeSelectControl } from './components/forms/native-select';\nexport type { NativeSelectProps, NativeSelectControlProps } from './components/forms/native-select';\n\nexport { DatePicker } from './components/forms/date-picker';\nexport type { DatePickerProps } from './components/forms/date-picker';\n\nexport { Stepper } from './components/forms/stepper';\nexport type { StepperProps, StepperSize, StepperAlign, StepperCompactInfo, StepItem, StepStatus } from './components/forms/stepper';\n\nexport { MultiSelectCard } from './components/forms/multiselect-card';\nexport type {\n MultiSelectCardProps,\n MultiSelectCardSize,\n} from './components/forms/multiselect-card';\n\n/**\n * On/off setting. Was named `Toggle` through 0.3.0 — see the CHANGELOG rename table. The\n * name `Toggle` now belongs to the pressed-state button, as it does in shadcn/ui.\n */\nexport { Switch } from './components/forms/switch';\nexport type { SwitchProps, SwitchSize } from './components/forms/switch';\n\n/** Pressed-state button, and a group of them. New in 0.4.0. */\nexport { Toggle, ToggleGroup, ToggleGroupItem } from './components/forms/toggle';\nexport type {\n ToggleProps,\n ToggleSize,\n ToggleVariant,\n ToggleGroupProps,\n ToggleGroupOption,\n ToggleGroupItemProps,\n ToggleGroupType,\n} from './components/forms/toggle';\n\nexport { InputOTP } from './components/forms/input-otp';\nexport type { InputOTPProps, InputOTPMode } from './components/forms/input-otp';\n\nexport { FileDropZone, useFilePicker, formatFileSize } from './components/forms/file-drop-zone';\nexport type { FileDropZoneProps, UseFilePicker, UseFilePickerOptions } from './components/forms/file-drop-zone';\n\n/** Multi-value text field: typed or pasted values become removable chips. New in 0.7.0. */\nexport { TagInput } from './components/forms/tag-input';\nexport type { TagInputProps, TagInputParseResult } from './components/forms/tag-input';\n\nexport { FormCard, FormCardHeader, FormCardFooter } from './components/forms/form-card';\nexport type { FormCardHeaderProps, FormCardFooterProps } from './components/forms/form-card';\n\n/**\n * A form described as data: fields, client-side validation (sync and async), pending and dirty\n * state, in a grid, stack or inline layout, submitted on Save or on change, optionally in steps.\n * New in 0.9.8 as DynamicForm, 0.10.0 as SchemaForm; `Form` from 0.10.1.\n */\nexport { Form } from './components/forms/form';\nexport type { FormProps, FormActionsApi } from './components/forms/form';\nexport { useDependentOptions } from './components/forms/use-dependent-options';\nexport type { DependentOptions } from './components/forms/use-dependent-options';\nexport type {\n FormValues,\n FormResult,\n FormErrors,\n FormState,\n FormLayout,\n FormSubmitOn,\n FormStep,\n FormField,\n FormFieldType,\n FormFieldBase,\n FormFieldContext,\n FormFieldSize,\n FormTextType,\n FormTextField,\n FormTextareaField,\n FormSelectField,\n FormComboboxField,\n FormCountryField,\n FormTimeZoneField,\n FormRadioField,\n FormSegmentedField,\n FormDateField,\n FormCheckField,\n FormListField,\n FormCustomField,\n} from './components/forms/form.types';\n/** The 0.10.0 names, deprecated. */\nexport { SchemaForm } from './components/forms/form-deprecated';\nexport type {\n SchemaFormProps,\n SchemaFormActionsApi,\n SchemaFormValues,\n SchemaFormResult,\n SchemaFormErrors,\n SchemaFormState,\n SchemaFormLayout,\n SchemaFormSubmitOn,\n SchemaFormStep,\n SchemaFormField,\n SchemaFormFieldType,\n SchemaFormFieldBase,\n SchemaFormFieldContext,\n SchemaFormFieldSize,\n SchemaFormTextType,\n SchemaFormTextField,\n SchemaFormTextareaField,\n SchemaFormSelectField,\n SchemaFormComboboxField,\n SchemaFormCountryField,\n SchemaFormTimeZoneField,\n SchemaFormRadioField,\n SchemaFormSegmentedField,\n SchemaFormDateField,\n SchemaFormCheckField,\n SchemaFormListField,\n SchemaFormCustomField,\n} from './components/forms/form-deprecated';\n\nexport { Badge, BADGE_COLORS } from './components/status/badge';\nexport type { BadgeProps, BadgeColor, BadgeSize, BadgeVariant } from './components/status/badge';\n\nexport { RoleBadge } from './components/status/role-badge';\nexport type { RoleBadgeProps, RoleBadgeTone } from './components/status/role-badge';\n\nexport { RoleComboBox, ROLE_COMBO_OPTIONS } from './components/forms/role-combo-box';\nexport type { RoleComboBoxProps, RoleOption } from './components/forms/role-combo-box';\n\n/** Single-select autocomplete. ARIA 1.2 combobox pattern. */\nexport { Combobox } from './components/forms/combobox';\nexport type { ComboboxProps, ComboboxOption } from './components/forms/combobox';\n\n/** Searchable country picker over Combobox. Value is an ISO 3166-1 alpha-2 code. */\nexport { CountrySelect, COUNTRY_CODES, countryOptions } from './components/forms/country-select';\nexport type { CountrySelectProps } from './components/forms/country-select';\n\n/** Searchable IANA time-zone picker over Combobox, labelled with the current UTC offset. */\nexport { TimeZoneSelect, timeZoneOptions, timeZoneOffset, currentZoneName } from './components/forms/time-zone-select';\nexport type { TimeZoneSelectProps } from './components/forms/time-zone-select';\n\n/** ⌘K command palette body. Compose with `Modal` for the usual overlay. */\nexport { Command } from './components/forms/command';\nexport type { CommandProps, CommandItem } from './components/forms/command';\n\n// ── Status & tags ──────────────────────────────────────────────────────────────\n\nexport { StatusBadge } from './components/status/status-badge';\nexport type { StatusBadgeProps, StatusTone, StatusBadgeSize } from './components/status/status-badge';\n\nexport { StatusDot } from './components/status/status-dot';\nexport type { StatusDotProps, StatusDotTone } from './components/status/status-dot';\n\nexport { StatusChip } from './components/status/status-chip';\nexport type { StatusChipProps } from './components/status/status-chip';\n\nexport { CountBadge } from './components/status/count-badge';\nexport type { CountBadgeProps } from './components/status/count-badge';\n\nexport { TagPill } from './components/status/tag-pill';\nexport type { TagPillProps, TagPillTone, TagPillSize } from './components/status/tag-pill';\n\nexport { TrailChip } from './components/status/trail-chip';\nexport type { TrailChipProps } from './components/status/trail-chip';\n\nexport { UserStatusPill } from './components/status/user-status-pill';\nexport type { UserStatusPillProps, UserAccountStatus } from './components/status/user-status-pill';\n\nexport { CheckIndicator } from './components/status/check-indicator';\nexport type { CheckIndicatorProps, CheckIndicatorStatus } from './components/status/check-indicator';\n\nexport { EntityIconBadge } from './components/status/entity-icon-badge';\nexport type { EntityIconBadgeProps, EntityIconBadgeSize, EntityIconBadgeTone } from './components/status/entity-icon-badge';\n\n// ── Selection ──────────────────────────────────────────────────────────────────\n\nexport { Checkbox } from './components/forms/checkbox';\nexport type { CheckboxProps, CheckboxSize } from './components/forms/checkbox';\n\nexport { RadioGroup, Radio } from './components/forms/radio-group';\n\n/** Choose one option shown as a card. The single-select sibling of MultiSelectCard. New in 0.7.0. */\nexport { RadioCards, RadioCardsItem } from './components/forms/radio-cards';\nexport type { RadioCardsProps, RadioCardsItemProps, RadioCardsSize } from './components/forms/radio-cards';\nexport type { ResponsiveChoiceCardSize, ChoiceCardBreakpoint } from './components/forms/choice-card-size';\n\n/** A fieldset of checkboxes sharing one value array. New in 0.7.0. */\nexport { CheckboxGroup, CheckboxGroupItem } from './components/forms/checkbox-group';\nexport type { CheckboxGroupProps, CheckboxGroupItemProps } from './components/forms/checkbox-group';\nexport type {\n RadioGroupProps,\n RadioGroupOption,\n RadioProps,\n RadioGroupOrientation,\n} from './components/forms/radio-group';\n\nexport { SegmentedControl } from './components/forms/segmented-control';\nexport type { SegmentedControlProps, SegmentedControlOption } from './components/forms/segmented-control';\n\nexport { Slider } from './components/forms/slider';\nexport type { SliderProps } from './components/forms/slider';\n\nexport { Label } from './components/forms/label';\nexport type { LabelProps } from './components/forms/label';\n\nexport { Calendar } from './components/forms/calendar';\nexport type { CalendarProps, CalendarMode, DateRange } from './components/forms/calendar';\n\nexport {\n InputGroup,\n InputGroupInput,\n InputGroupAddon,\n InputGroupText,\n SearchInput,\n} from './components/forms/input-group';\nexport type {\n InputGroupProps,\n InputGroupInputProps,\n InputGroupAddonProps,\n InputGroupTextProps,\n InputGroupAlign,\n SearchInputProps,\n} from './components/forms/input-group';\n\n// ── Overlays ───────────────────────────────────────────────────────────────────\n\nexport {\n Modal,\n ModalTrigger,\n ModalClose,\n ModalHeader,\n ModalTitle,\n ModalDescription,\n ModalBody,\n ModalFooter,\n} from './components/overlays/modal';\nexport type {\n ModalProps,\n ModalSize,\n ModalTone,\n ModalFooterAlign,\n ModalAlign,\n ModalHeaderProps,\n ModalTitleProps,\n ModalDescriptionProps,\n ModalBodyProps,\n ModalFooterProps,\n ModalTriggerProps,\n ModalCloseProps,\n} from './components/overlays/modal';\n\nexport { Tooltip } from './components/overlays/tooltip';\nexport type { TooltipProps } from './components/overlays/tooltip';\n\n/** Anchored panel for **interactive** content — unlike `Tooltip`, which cannot be entered. */\nexport {\n Popover,\n PopoverTrigger,\n PopoverContent,\n PopoverClose,\n PopoverAnchor,\n} from './components/overlays/popover';\nexport type {\n PopoverProps,\n PopoverTriggerProps,\n PopoverContentProps,\n} from './components/overlays/popover';\n\n/** Hover preview that can be entered. Supplementary by contract — hover has no touch equivalent. */\nexport { HoverCard } from './components/overlays/hover-card';\nexport type { HoverCardProps } from './components/overlays/hover-card';\n\nexport {\n ContextMenu,\n ContextMenuTrigger,\n ContextMenuContent,\n ContextMenuItems,\n ContextMenuItem,\n ContextMenuCheckboxItem,\n ContextMenuRadioGroup,\n ContextMenuRadioItem,\n ContextMenuGroup,\n ContextMenuLabel,\n ContextMenuSeparator,\n ContextMenuShortcut,\n ContextMenuSub,\n ContextMenuSubTrigger,\n ContextMenuSubContent,\n} from './components/overlays/context-menu';\nexport type {\n ContextMenuProps,\n ContextMenuTriggerProps,\n ContextMenuContentProps,\n} from './components/overlays/context-menu';\n\nexport {\n Menubar,\n MenubarMenu,\n MenubarTrigger,\n MenubarContent,\n MenubarItems,\n MenubarItem,\n MenubarCheckboxItem,\n MenubarRadioGroup,\n MenubarRadioItem,\n MenubarGroup,\n MenubarLabel,\n MenubarSeparator,\n MenubarShortcut,\n MenubarSub,\n MenubarSubTrigger,\n MenubarSubContent,\n} from './components/overlays/menubar';\nexport type {\n MenubarProps,\n MenubarMenuDef,\n MenubarMenuProps,\n MenubarTriggerProps,\n MenubarContentProps,\n} from './components/overlays/menubar';\n\nexport {\n Drawer,\n DrawerTrigger,\n DrawerClose,\n DrawerHeader,\n DrawerTitle,\n DrawerDescription,\n DrawerBody,\n DrawerFooter,\n} from './components/overlays/drawer';\nexport type {\n DrawerProps,\n DrawerSide,\n DrawerFooterAlign,\n DrawerTriggerProps,\n DrawerCloseProps,\n DrawerHeaderProps,\n DrawerTitleProps,\n DrawerDescriptionProps,\n DrawerBodyProps,\n DrawerFooterProps,\n} from './components/overlays/drawer';\n\nexport { ConfirmDialog } from './components/overlays/confirm-dialog';\nexport type { ConfirmDialogProps } from './components/overlays/confirm-dialog';\n\nexport { NoteConfirmModal } from './components/overlays/note-confirm-modal';\nexport type { NoteConfirmModalProps } from './components/overlays/note-confirm-modal';\n\nexport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItems,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuGroup,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubTrigger,\n DropdownMenuSubContent,\n} from './components/overlays/dropdown-menu';\nexport type {\n /** One menu entry as data, shared by DropdownMenu, ContextMenu and Menubar. New in 0.8.0. */\n MenuItemDef,\n DropdownMenuProps,\n DropdownMenuTriggerProps,\n DropdownMenuContentProps,\n DropdownMenuItemProps,\n DropdownMenuItemTone,\n DropdownMenuCheckboxItemProps,\n DropdownMenuRadioGroupProps,\n DropdownMenuRadioItemProps,\n DropdownMenuGroupProps,\n DropdownMenuLabelProps,\n DropdownMenuSeparatorProps,\n DropdownMenuShortcutProps,\n DropdownMenuSubProps,\n DropdownMenuSubTriggerProps,\n DropdownMenuSubContentProps,\n} from './components/overlays/dropdown-menu';\n\n/** The dimming layer behind a custom overlay. New in 0.7.0. */\nexport { Scrim } from './components/overlays/scrim';\nexport type { ScrimProps } from './components/overlays/scrim';\n\n/** A modal surface that fills the viewport: full screen, expand a widget. New in 0.7.0. */\nexport { FullscreenSurface } from './components/overlays/fullscreen-surface';\nexport type { FullscreenSurfaceProps, FullscreenStacking } from './components/overlays/fullscreen-surface';\n\nexport { Portal, PortalContainerProvider, usePortalContainer } from './components/overlays/portal';\nexport type { PortalProps } from './components/overlays/portal';\n\n// ── Utilities ──────────────────────────────────────────────────────────────────\n\n/** Esc-to-close, Tab focus trap and focus restore — for building your own overlays. */\nexport { OVERLAY_SCRIM, useOverlayDismiss } from './components/overlays/overlay';\n\n/** `clsx` + `tailwind-merge` — for compositions where your className must win. */\nexport { cn } from './lib/cn';\n\n/**\n * What makes `asChild` work: renders its props onto its single child. Exported from 0.7.0\n * so a composition of your own can offer the same `asChild` contract.\n */\nexport { Slot, composeRefs } from './lib/slot';\nexport type { SlotProps } from './lib/slot';\n\n/** The library's keyboard focus ring, for controls you build yourself. New in 0.7.0. */\nexport { FOCUS_RING, FOCUS_RING_INSET } from './lib/focus-ring';\n\n/** Screen-reader-only content. New in 0.7.0. */\nexport { VisuallyHidden } from './components/chrome/visually-hidden';\nexport type { VisuallyHiddenProps } from './components/chrome/visually-hidden';\n\n/** An icon that means something on its own, named for assistive technology. New in 0.7.0. */\nexport { AccessibleIcon } from './components/chrome/accessible-icon';\nexport type { AccessibleIconProps } from './components/chrome/accessible-icon';\n\n// ── Cards & containers ─────────────────────────────────────────────────────────\n\nexport {\n Card,\n CardHeader,\n CardTitle,\n CardDescription,\n CardAction,\n CardBody,\n CardFooter,\n} from './components/cards/card';\nexport type {\n CardProps,\n CardSize,\n CardRadius,\n CardTone,\n CardFooterAlign,\n CardHeaderProps,\n CardTitleProps,\n CardDescriptionProps,\n CardActionProps,\n CardBodyProps,\n CardFooterProps,\n} from './components/cards/card';\n\nexport {\n Accordion,\n AccordionItem,\n AccordionTrigger,\n AccordionContent,\n} from './components/cards/accordion';\nexport type {\n AccordionProps,\n AccordionItemDef,\n AccordionItemProps,\n AccordionTriggerProps,\n AccordionContentProps,\n AccordionType,\n} from './components/cards/accordion';\n\nexport {\n Collapsible,\n CollapsibleTrigger,\n CollapsibleContent,\n} from './components/cards/collapsible';\nexport type {\n CollapsibleProps,\n CollapsibleTriggerProps,\n CollapsibleContentProps,\n} from './components/cards/collapsible';\n\n// Layout primitives, new in 0.7.0. Token-backed spacing props; layout only, no visual styling.\nexport { Box, Flex, Grid, Container, Section } from './components/cards/layout';\nexport type {\n BoxProps,\n FlexProps,\n FlexDirection,\n FlexAlign,\n FlexJustify,\n GridProps,\n GridColumnCount,\n GridBreakpoint,\n ContainerProps,\n ContainerSize,\n SectionProps,\n SectionSize,\n SpaceToken,\n} from './components/cards/layout';\n\nexport { AspectRatio } from './components/cards/aspect-ratio';\nexport type { AspectRatioProps } from './components/cards/aspect-ratio';\n\nexport { ScrollArea } from './components/cards/scroll-area';\nexport type { ScrollAreaProps, ScrollAreaAxis } from './components/cards/scroll-area';\n\n// The scrollbar styling on its own, for a component that must own its own overflow — a\n// table wrapper, a tab strip, a floating panel. Use `ScrollArea` for a region of content.\nexport { SCROLLBAR_CLASSES } from './lib/scrollbar';\n\nexport {\n Carousel,\n CarouselViewport,\n CarouselSlide,\n CarouselControls,\n} from './components/cards/carousel';\nexport type {\n CarouselProps,\n CarouselViewportProps,\n CarouselSlideProps,\n CarouselControlsProps,\n} from './components/cards/carousel';\n\nexport { Resizable, ResizablePanel, ResizableHandle } from './components/cards/resizable';\nexport type {\n ResizableProps,\n ResizablePanelProps,\n ResizableHandleProps,\n ResizableDirection,\n} from './components/cards/resizable';\n\n// ── Page chrome ────────────────────────────────────────────────────────────────\n\nexport { PageHeading } from './components/chrome/page-heading';\nexport type { PageHeadingProps, PageHeadingSize } from './components/chrome/page-heading';\n\nexport { PageToolbar } from './components/chrome/page-toolbar';\nexport type { PageToolbarProps, PageToolbarSize } from './components/chrome/page-toolbar';\n\nexport { FilterBar } from './components/chrome/filter-bar';\nexport type { FilterBarProps, FilterBarSize } from './components/chrome/filter-bar';\n\nexport {\n Tabs,\n TabsPanel,\n TabsList,\n TabsTrigger,\n TabsContent,\n tabId,\n tabPanelId,\n} from './components/chrome/tabs';\nexport type {\n TabsProps,\n TabsRootProps,\n TabsPanelProps,\n TabsListProps,\n TabsTriggerProps,\n TabsContentProps,\n TabItem,\n TabsVariant,\n TabsSize,\n TabsOrientation,\n TabsActivation,\n} from './components/chrome/tabs';\n\nexport { NavItem, NavSubItem, NavGroupHeader } from './components/chrome/nav-item';\nexport type {\n NavItemProps,\n NavItemSize,\n NavItemVariant,\n NavItemDensity,\n NavSubItemProps,\n NavGroupHeaderProps,\n} from './components/chrome/nav-item';\n\nexport {\n Sidebar,\n SidebarProvider,\n SidebarTrigger,\n SidebarSeparator,\n SidebarUserCard,\n useSidebar,\n filterNav,\n filterNavItems,\n} from './components/chrome/sidebar';\nexport type {\n SidebarProps,\n SidebarProviderProps,\n SidebarContextValue,\n SidebarTriggerProps,\n SidebarSeparatorProps,\n SidebarUserCardProps,\n SidebarNavItem,\n SidebarNavGroup,\n SidebarLinkProps,\n SidebarLinkComponent,\n SidebarRenderState,\n} from './components/chrome/sidebar';\n\nexport { EyebrowLabel } from './components/chrome/eyebrow-label';\nexport type { EyebrowLabelProps, EyebrowLabelVariant } from './components/chrome/eyebrow-label';\n\nexport { Separator } from './components/chrome/separator';\nexport type { SeparatorProps, SeparatorOrientation } from './components/chrome/separator';\n\nexport { Kbd } from './components/chrome/kbd';\nexport type { KbdProps, KbdSize } from './components/chrome/kbd';\n\nexport {\n Breadcrumb,\n BreadcrumbItem,\n BreadcrumbEllipsis,\n} from './components/chrome/breadcrumb';\nexport type {\n BreadcrumbProps,\n BreadcrumbItemDef,\n BreadcrumbItemProps,\n BreadcrumbEllipsisProps,\n} from './components/chrome/breadcrumb';\n\nexport { Pagination, PaginationBar, paginationRange } from './components/chrome/pagination';\nexport type { PaginationProps, PaginationBarProps, PaginationType } from './components/chrome/pagination';\n\nexport { NavigationMenu, NavigationMenuItem } from './components/chrome/navigation-menu';\nexport type {\n NavigationMenuProps,\n NavigationMenuItemProps,\n NavigationMenuOrientation,\n NavigationMenuVariant,\n} from './components/chrome/navigation-menu';\n\n// ── Typography ─────────────────────────────────────────────────────────────────\n// The type ramp as components, mirroring Figma's `Text*` primitives. Every one takes\n// `asChild`, because the right element depends on the surrounding document outline.\n\nexport {\n Text,\n TextSmall,\n TextTiny,\n TextStrong,\n TextEmphasis,\n TextCode,\n TextLink,\n TextList,\n TextListItem,\n Blockquote,\n Quote,\n TitleHero,\n TitlePage,\n Subtitle,\n Heading,\n Subheading,\n} from './components/chrome/typography';\nexport type {\n TextProps,\n TextTone,\n BlockquoteProps,\n TextLinkProps,\n TextLinkTone,\n TextListProps,\n TextListItemProps,\n TextListVariant,\n TextListDensity,\n} from './components/chrome/typography';\n\n// ── Widgets ────────────────────────────────────────────────────────────────────\n\nexport { WidgetHeader, WidgetHeaderAccessoryProvider, useWidgetHeaderAccessory } from './components/widgets/widget-header';\nexport type { WidgetHeaderProps, WidgetHeaderEyebrowVariant, WidgetHeaderAccessoryProviderProps } from './components/widgets/widget-header';\n\nexport { WidgetTitle } from './components/widgets/widget-title';\nexport type { WidgetTitleProps, WidgetTitleSize } from './components/widgets/widget-title';\n\nexport { WidgetFooter } from './components/widgets/widget-footer';\nexport type { WidgetFooterProps } from './components/widgets/widget-footer';\n\n/** The dashboard grid vocabulary and container-width tiers. New in 0.7.0, from SCIC. */\nexport {\n WidgetGrid,\n WidgetGridRow,\n WidgetGridItem,\n COL_SPAN,\n HEIGHT_CLASS,\n HEIGHT_PX,\n} from './components/widgets/widget-grid';\nexport type {\n WidgetGridProps,\n WidgetGridRowProps,\n WidgetGridItemProps,\n ColSize,\n WidgetHeight,\n} from './components/widgets/widget-grid';\nexport {\n GRID_TIERS,\n TIER_MIN_PX,\n TIER_COLS,\n COL_SPAN_BY_TIER,\n tierForWidth,\n nextTier,\n quantizeWidth,\n colsFor,\n slotWidthPx,\n} from './lib/width-tier';\nexport type { GridTier } from './lib/width-tier';\nexport { useWidthTier } from './lib/use-width-tier';\nexport type { UseWidthTierOptions, UseWidthTierResult } from './lib/use-width-tier';\n\n// ── Stats ──────────────────────────────────────────────────────────────────────\n\nexport { StatTile } from './components/stats/stat-tile';\nexport type { StatTileProps } from './components/stats/stat-tile';\n\nexport { StatNumber } from './components/stats/stat-number';\nexport type { StatNumberProps, StatNumberSize, StatNumberWeight } from './components/stats/stat-number';\n\nexport { ScoreValue, getScoreTone, DEFAULT_SCORE_THRESHOLDS } from './components/stats/score-value';\nexport type {\n ScoreValueProps,\n ScoreValueSize,\n ScoreValueWeight,\n ScoreValueTone,\n ScoreTone,\n ScoreRampTone,\n ScoreDirection,\n ScoreThresholds,\n} from './components/stats/score-value';\n\nexport { TileGrid } from './components/stats/tile-grid';\nexport type { TileGridProps, TileGridColumns, TileGridBreakpoint } from './components/stats/tile-grid';\n\n// ── Data visualisation ─────────────────────────────────────────────────────────\n\nexport { CHART_TONE, CHART_SEQUENCE, CHART_TRACK, resolveChartColor } from './components/charts/chart-tone';\nexport type { ChartTone } from './components/charts/chart-tone';\n\nexport { BarChart } from './components/charts/bar-chart';\nexport type {\n BarChartProps,\n BarChartSeries,\n BarChartReference,\n BarChartOrientation,\n BarChartSize,\n} from './components/charts/bar-chart';\n\nexport { DonutChart } from './components/charts/donut-chart';\nexport type { DonutChartProps, DonutSegment, DonutChartSize } from './components/charts/donut-chart';\n\nexport { RadialGauge } from './components/charts/radial-gauge';\nexport type { RadialGaugeProps, RadialGaugeSize } from './components/charts/radial-gauge';\n\nexport { Sparkline } from './components/charts/sparkline';\nexport type { SparklineProps, SparklineVariant, SparklineSize } from './components/charts/sparkline';\n\nexport { MiniBarChart } from './components/charts/mini-bar-chart';\nexport type {\n MiniBarChartProps,\n MiniBarChartSize,\n MiniBarChartOrientation,\n} from './components/charts/mini-bar-chart';\n\nexport { ChartLegend } from './components/charts/chart-legend';\nexport type {\n ChartLegendProps,\n ChartLegendItem,\n ChartLegendOrientation,\n} from './components/charts/chart-legend';\n\nexport { LegendDot } from './components/charts/legend-dot';\nexport type { LegendDotProps, LegendDotSize, LegendDotShape } from './components/charts/legend-dot';\n\nexport { TrendLabel } from './components/charts/trend-label';\nexport type {\n TrendLabelProps,\n TrendLabelWeight,\n TrendLabelSize,\n TrendDirection,\n} from './components/charts/trend-label';\n\n// ── Lists & rows ───────────────────────────────────────────────────────────────\n\nexport { Listbox } from './components/lists/listbox';\nexport type { ListboxProps, ListboxOption, ListboxGroup } from './components/lists/listbox';\n\nexport { SelectionBar } from './components/lists/selection-bar';\nexport type { SelectionBarProps, SelectionBarPosition } from './components/lists/selection-bar';\n\nexport { ListRow } from './components/lists/list-row';\nexport type { ListRowProps, ListRowDensity, ListRowDivider } from './components/lists/list-row';\n\nexport { FileRow } from './components/lists/file-row';\nexport type { FileRowProps } from './components/lists/file-row';\n\nexport { ScoredRow } from './components/lists/scored-row';\nexport type { ScoredRowProps, ScoredRowAlign, ScoredRowGap } from './components/lists/scored-row';\n\nexport { NumberedList } from './components/lists/numbered-list';\nexport type {\n NumberedListProps,\n NumberedListItem,\n NumberedListGap,\n} from './components/lists/numbered-list';\n\nexport { IconTextRow } from './components/lists/icon-text-row';\nexport type { IconTextRowProps } from './components/lists/icon-text-row';\n\nexport { ChecklistRow } from './components/lists/checklist-row';\nexport type { ChecklistRowProps, ChecklistRowState } from './components/lists/checklist-row';\n\nexport { StepsList } from './components/lists/steps-list';\nexport type { StepsListProps } from './components/lists/steps-list';\n\nexport { DetailItem, DetailGrid } from './components/lists/detail-item';\nexport type {\n DetailItemProps,\n DetailItemLayout,\n DetailItemSpan,\n DetailGridProps,\n DetailGridColumns,\n} from './components/lists/detail-item';\n\n/** Label/value rows as a real <dl>, with optional copy. New in 0.7.0, from SCIC. */\nexport { DescriptionList, DescriptionItem, CopyButton, EmailText } from './components/lists/description-list';\nexport type { DescriptionListProps, DescriptionItemProps, CopyButtonProps } from './components/lists/description-list';\n\nexport { CheckedGroupList } from './components/lists/checked-group-list';\nexport type {\n CheckedGroupListProps,\n CheckedGroupListColumns,\n CheckedGroup,\n} from './components/lists/checked-group-list';\n\n/** Expandable tree — ARIA tree pattern, one tab stop, rows as a render slot. */\nexport { TreeView } from './components/lists/tree-view';\nexport type { TreeViewProps, TreeItemState, TreeViewSize } from './components/lists/tree-view';\n\n// ── Table ──────────────────────────────────────────────────────────────────────\n// The composable primitive, for the tables `DataTable`'s column config cannot express —\n// grouped headers, footers, colspans. `DataTable` remains the right default.\n\nexport {\n Table,\n TableCaption,\n TableHeader,\n TableBody,\n TableFooter,\n TableRow,\n TableHead,\n TableCell,\n} from './components/lists/table';\nexport type {\n TableProps,\n TableCaptionProps,\n TableRowProps,\n TableHeadProps,\n TableCellProps,\n TableDensity,\n TableSortDirection,\n TableRowTone,\n} from './components/lists/table';\n\n// ── Data table ─────────────────────────────────────────────────────────────────\n// DataTable, its parts and the TanStack Table types live in the `@platned/ui/data-table` entry\n// from 0.9.4 (src/data-table.tsx); the build keeps them in that file, so the main entry pulls in\n// TanStack only when a DataTable is actually used.\n\nexport * from './data-table';\n\n// The cells need no TanStack, so they are also exported straight from their module: a page that\n// renders a cell outside a DataTable does not load the table.\nexport {\n TableCellLeadText,\n TableCellText,\n TableCellBadge,\n TableCellProgress,\n} from './components/lists/data-table-cells';\n\n/** Measures an element's width, for layouts that switch structure by available space. New in 0.7.0. */\nexport { useElementWidth } from './lib/use-element-width';\n\n// ── Feedback ───────────────────────────────────────────────────────────────────\n\nexport { InlineAlert } from './components/feedback/inline-alert';\nexport type { InlineAlertProps, InlineAlertTone } from './components/feedback/inline-alert';\n\nexport { EmptyState } from './components/feedback/empty-state';\nexport type { EmptyStateProps, EmptyStateVariant, EmptyStateSize } from './components/feedback/empty-state';\n\nexport { ProgressBar } from './components/feedback/progress-bar';\nexport type { ProgressBarProps, ProgressBarTone, ProgressBarSize } from './components/feedback/progress-bar';\n\nexport { Spinner } from './components/feedback/spinner';\nexport type { SpinnerProps, SpinnerSize } from './components/feedback/spinner';\n\n/** Contains a render error to its own subtree. New in 0.7.0. */\nexport { ErrorBoundary } from './components/feedback/error-boundary';\nexport type { ErrorBoundaryProps } from './components/feedback/error-boundary';\n\nexport { Skeleton } from './components/feedback/skeleton';\nexport type { SkeletonProps, SkeletonShape } from './components/feedback/skeleton';\n\n/** Persistent, in-flow notice with a title and an action — Figma's `Notification`. */\nexport { Banner } from './components/feedback/banner';\nexport type { BannerProps, BannerVariant } from './components/feedback/banner';\n\n/** Transient notifications. Mount `Toaster` once at the app root, then call `useToast()`. */\nexport { Toaster, useToast } from './components/feedback/toast';\nexport type {\n ToasterProps,\n ToasterPosition,\n ToastOptions,\n ToastRecord,\n ToastTone,\n} from './components/feedback/toast';\n\n// ── Forms ──────────────────────────────────────────────────────────────────────\n\nexport { PasswordInput } from './components/forms/password-input';\nexport type { PasswordInputProps } from './components/forms/password-input';\n\n// ── AI surfaces & decorative ───────────────────────────────────────────────────\n\nexport { AIChatBar } from './components/ai/ai-chat-bar';\nexport type { AIChatBarProps } from './components/ai/ai-chat-bar';\n\nexport { AISuggestionChip } from './components/ai/ai-suggestion-chip';\nexport type { AISuggestionChipProps } from './components/ai/ai-suggestion-chip';\n\nexport { QuickActionsBar } from './components/ai/quick-actions-bar';\nexport type { QuickActionsBarProps, QuickAction } from './components/ai/quick-actions-bar';\n\n/** Chat transcript pieces. New in 0.7.0, from SCIC. */\nexport { ChatBubble, TypingIndicator, AiAvatar } from './components/ai/chat';\nexport type { ChatBubbleProps, ChatBubbleSender, TypingIndicatorProps, AiAvatarProps } from './components/ai/chat';\n\nexport { AuroraBackdrop } from './components/decorative/aurora-backdrop';\n\n// Icons are not re-exported. Import them straight from `lucide-react` — the nine filled\n// 20×20 `Solid*` marks that used to live here were used by no component in this library,\n// only by its own documentation, and they were the one place the library shipped a second\n// icon set. Charts remain the sole exception to Lucide, because their SVG is geometry.\n","import type { ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { CircleCheckBigIcon, InfoIcon, TriangleAlertIcon } from 'lucide-react';\n\n/** `neutral` is new in 0.9.5: a quiet, bordered note with no status colour, e.g. \"Viewing. Choose Edit to change this.\" */\nexport type InlineAlertTone = 'info' | 'warning' | 'danger' | 'positive' | 'neutral';\n\nexport interface InlineAlertProps {\n tone: InlineAlertTone;\n children: ReactNode;\n /** Overrides the per-tone default glyph. Pass `null` for no icon. */\n icon?: ReactNode | null;\n /**\n * Overrides the live-region role, which is otherwise `alert` for `danger` and `status` for the\n * rest. Pass `status` for a danger-toned answer that updates as the user explores, e.g. \"Not\n * allowed. …\" beside a picker, which should wait its turn rather than interrupt. New in 0.9.5.\n */\n role?: 'alert' | 'status';\n className?: string;\n}\n\nconst toneStyles: Record<InlineAlertTone, string> = {\n info: 'border-brand-tertiary bg-brand-tertiary text-brand',\n warning: 'border-warning-tertiary bg-warning-tertiary text-warning',\n danger: 'border-danger-tertiary bg-danger-tertiary text-danger',\n positive: 'border-positive-tertiary bg-positive-tertiary text-positive',\n neutral: 'border-default bg-default text-default-secondary',\n};\n\nconst toneIcons: Record<InlineAlertTone, ReactNode> = {\n info: <InfoIcon className=\"size-4\" />,\n warning: <TriangleAlertIcon className=\"size-4\" />,\n danger: <TriangleAlertIcon className=\"size-4\" />,\n positive: <CircleCheckBigIcon className=\"size-4\" />,\n neutral: <InfoIcon className=\"size-4 text-icon-default-secondary\" />,\n};\n\n/** Banner for inline messaging — form errors, destructive-action warnings, success confirmations.\n *\n * Replaces four byte-identical raw-`amber-*` callouts, five competing error-text styles and a\n * standalone `Banner` component. `danger` renders as `role=\"alert\"`; the rest as `role=\"status\"`. */\nexport function InlineAlert({ tone, children, icon, role, className }: InlineAlertProps) {\n const glyph = icon === undefined ? toneIcons[tone] : icon;\n\n return (\n <div\n data-tone={tone}\n role={role ?? (tone === 'danger' ? 'alert' : 'status')}\n className={clsx(\n 'flex items-start gap-3 rounded-xl border p-4 text-body-xs',\n toneStyles[tone],\n className,\n )}\n >\n {/* The glyph restates the tone the text already carries, so it is decoration —\n `lucide-react` hides its own SVGs, but any node can be passed here, so the wrapper\n hides it rather than trusting the glyph to keep out of a `role=\"alert\"` region. */}\n {glyph && (\n <span aria-hidden className=\"mt-px shrink-0\">\n {glyph}\n </span>\n )}\n <div className=\"min-w-0\">{children}</div>\n </div>\n );\n}\n","import { Component, type ErrorInfo, type ReactNode } from 'react';\n\nexport interface ErrorBoundaryProps {\n children: ReactNode;\n /** Shown in place of the children when they throw. Default a quiet \"Something went wrong\". */\n fallback?: ReactNode;\n /** Changing this resets the boundary. Use the identity of whatever is being rendered. */\n resetKey?: string;\n onError?: (error: Error, info: ErrorInfo) => void;\n}\n\ninterface ErrorBoundaryState {\n error: Error | null;\n}\n\n/**\n * Stops one broken subtree from taking down the whole app. New in 0.7.0, from SCIC.\n *\n * React unmounts the entire root when a render throws with no boundary above it, so one widget\n * that trips over an unexpected API shape blanks the screen instead of one card. This is the\n * floor under that: everything outside the boundary keeps working.\n *\n * A class, because error boundaries can only be classes. The error is still logged: the\n * fallback deliberately says nothing technical, so the console is how the cause is found.\n */\nexport class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {\n state: ErrorBoundaryState = { error: null };\n\n static getDerivedStateFromError(error: Error): ErrorBoundaryState {\n return { error };\n }\n\n componentDidUpdate(previous: ErrorBoundaryProps) {\n if (this.state.error && previous.resetKey !== this.props.resetKey) {\n this.setState({ error: null });\n }\n }\n\n componentDidCatch(error: Error, info: ErrorInfo) {\n console.error('[ErrorBoundary]', error, info.componentStack);\n this.props.onError?.(error, info);\n }\n\n render() {\n if (!this.state.error) return this.props.children;\n return (\n this.props.fallback ?? (\n <div\n role=\"status\"\n data-slot=\"error-boundary\"\n className=\"flex h-full w-full items-center justify-center rounded-lg border border-default bg-default p-4 text-center text-body-xs text-default-secondary\"\n >\n Something went wrong loading this.\n </div>\n )\n );\n }\n}\n","import { forwardRef, useId, type HTMLAttributes, type ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { CircleCheckBigIcon, InfoIcon, TriangleAlertIcon, XIcon } from 'lucide-react';\nimport { IconButton } from '../forms/icon-button';\nimport type { InlineAlertTone } from './inline-alert';\n\nexport type BannerVariant = 'message' | 'alert';\n\n// `title` is omitted from the base attributes because the HTML `title` attribute is a\n// string that renders a native tooltip — the same collision that made 0.2.0's\n// `Modal.title` become `Modal.label`. Here the prop is the more useful one, so the\n// attribute gives way.\nexport interface BannerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** Bold first line. Matches Figma's `Title`. */\n title: ReactNode;\n /** Supporting copy. Matches Figma's `Body`. */\n children?: ReactNode;\n /**\n * Matches Figma's `Variant` axis. `message` is informational; `alert` is urgent and is\n * announced immediately.\n */\n variant?: BannerVariant;\n tone?: InlineAlertTone;\n /** Replaces the tone glyph. Pass `null` to suppress it. Matches `Icon` / `Has Icon`. */\n icon?: ReactNode | null;\n /** Trailing action slot. Matches `Has Button`. */\n action?: ReactNode;\n /** Renders a dismiss button. Matches `Dismissible`. */\n onDismiss?: () => void;\n}\n\nconst TONE_STYLES: Record<InlineAlertTone, string> = {\n info: 'border-brand-tertiary bg-brand-tertiary text-default',\n positive: 'border-positive-tertiary bg-positive-tertiary text-default',\n warning: 'border-warning-tertiary bg-warning-tertiary text-default',\n danger: 'border-danger-tertiary bg-danger-tertiary text-default',\n neutral: 'border-default bg-default text-default',\n};\n\nconst TONE_ICON_COLOR: Record<InlineAlertTone, string> = {\n info: 'text-icon-brand',\n positive: 'text-icon-positive',\n warning: 'text-icon-warning',\n danger: 'text-icon-danger',\n neutral: 'text-icon-default-secondary',\n};\n\nconst TONE_ICON: Record<InlineAlertTone, ReactNode> = {\n info: <InfoIcon aria-hidden className=\"size-5\" />,\n positive: <CircleCheckBigIcon aria-hidden className=\"size-5\" />,\n warning: <TriangleAlertIcon aria-hidden className=\"size-5\" />,\n danger: <TriangleAlertIcon aria-hidden className=\"size-5\" />,\n neutral: <InfoIcon aria-hidden className=\"size-5\" />,\n};\n\n/**\n * A page- or section-level banner with a title, body, optional action and optional dismiss.\n *\n * This is Figma's `Notification` set (`Variant: Message | Alert`, with `Title`, `Body`,\n * `Has Icon`, `Has Button` and `Dismissible`). Worth being precise about the name: its\n * Figma keywords are \"message, alert, feedback, callout, banner\" — it is a *persistent,\n * in-flow* notice, **not** a toast. A toast is transient, stacked, and announced from a\n * live region that already exists; that is `Toast`, and it is a different component.\n *\n * `InlineAlert` remains the compact single-line form for use inside a form or a card.\n * `Banner` is the one with a heading and an action.\n *\n * `variant` drives the announcement, not just the styling: `alert` is `role=\"alert\"`\n * (interrupts), `message` is `role=\"status\"` (waits its turn).\n */\nexport const Banner = forwardRef<HTMLDivElement, BannerProps>(function Banner(\n {\n title,\n children,\n variant = 'message',\n tone = 'info',\n icon,\n action,\n onDismiss,\n className,\n ...rest\n },\n ref,\n) {\n const titleId = useId();\n const glyph = icon === undefined ? TONE_ICON[tone] : icon;\n\n return (\n <div\n data-tone={tone}\n data-variant={variant}\n ref={ref}\n role={variant === 'alert' ? 'alert' : 'status'}\n aria-labelledby={titleId}\n data-slot=\"banner\"\n className={clsx(\n 'flex w-full items-start gap-3 rounded-xl border p-4',\n TONE_STYLES[tone],\n className,\n )}\n {...rest}\n >\n {glyph && (\n <span aria-hidden className={clsx('mt-px shrink-0', TONE_ICON_COLOR[tone])}>\n {glyph}\n </span>\n )}\n <div className=\"min-w-0 flex-1\">\n <p id={titleId} className=\"text-body-sm font-semibold text-default\">\n {title}\n </p>\n {children && <div className=\"mt-1 text-body-xs text-default-secondary\">{children}</div>}\n {action && <div className=\"mt-3 flex items-center gap-2\">{action}</div>}\n </div>\n {onDismiss && (\n <IconButton\n variant=\"subtle\"\n size=\"sm\"\n // Named with the title, so several stacked banners do not all announce\n // \"Dismiss\" identically.\n aria-label={typeof title === 'string' ? `Dismiss: ${title}` : 'Dismiss'}\n onClick={onDismiss}\n className=\"-mr-1 -mt-1 shrink-0\"\n >\n <XIcon aria-hidden size={16} />\n </IconButton>\n )}\n </div>\n );\n});\n","import {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type ReactNode,\n} from 'react';\nimport clsx from 'clsx';\nimport { CircleCheckBigIcon, InfoIcon, TriangleAlertIcon, XIcon } from 'lucide-react';\nimport { IconButton } from '../forms/icon-button';\nimport { Portal } from '../overlays/portal';\nimport { TOASTER_ATTRIBUTE } from '../overlays/toaster-guard';\nimport type { InlineAlertTone } from './inline-alert';\n\nexport type ToastTone = InlineAlertTone;\nexport type ToasterPosition =\n | 'top-left'\n | 'top-center'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-center'\n | 'bottom-right';\n\nexport interface ToastOptions {\n title: ReactNode;\n description?: ReactNode;\n tone?: ToastTone;\n /** Milliseconds before auto-dismiss. `0` keeps it until dismissed. Default `5000`. */\n duration?: number;\n action?: ReactNode;\n}\n\nexport interface ToastRecord extends ToastOptions {\n id: string;\n}\n\ninterface ToastContextValue {\n toast: (options: ToastOptions) => string;\n dismiss: (id: string) => void;\n dismissAll: () => void;\n}\n\nconst ToastContext = createContext<ToastContextValue | null>(null);\n\n/**\n * Queue a toast. Must be called under a `<Toaster>`.\n *\n * Returns the toast's id so a long-running action can dismiss its own \"Saving…\" toast when\n * it finishes.\n */\nexport function useToast(): ToastContextValue {\n const context = useContext(ToastContext);\n if (!context) throw new Error('useToast() must be used inside <Toaster>');\n return context;\n}\n\nconst TONE_ICON: Record<ToastTone, ReactNode> = {\n info: <InfoIcon aria-hidden className=\"size-4\" />,\n positive: <CircleCheckBigIcon aria-hidden className=\"size-4\" />,\n warning: <TriangleAlertIcon aria-hidden className=\"size-4\" />,\n danger: <TriangleAlertIcon aria-hidden className=\"size-4\" />,\n neutral: <InfoIcon aria-hidden className=\"size-4\" />,\n};\n\nconst TONE_ICON_COLOR: Record<ToastTone, string> = {\n info: 'text-icon-brand',\n positive: 'text-icon-positive',\n warning: 'text-icon-warning',\n danger: 'text-icon-danger',\n neutral: 'text-icon-default-secondary',\n};\n\n/**\n * The vertical edge distance comes from two custom properties set on the region (see `offset`\n * and `mobileOffset`), switching at `md`. The horizontal inset stays a fixed 16px, which the\n * region's `calc(100% - 2rem)` width assumes.\n */\nconst POSITION: Record<ToasterPosition, string> = {\n 'top-left': 'top-[var(--toaster-mobile-offset)] md:top-[var(--toaster-offset)] left-4 items-start',\n 'top-center': 'top-[var(--toaster-mobile-offset)] md:top-[var(--toaster-offset)] left-1/2 -translate-x-1/2 items-center',\n 'top-right': 'top-[var(--toaster-mobile-offset)] md:top-[var(--toaster-offset)] right-4 items-end',\n 'bottom-left': 'bottom-[var(--toaster-mobile-offset)] md:bottom-[var(--toaster-offset)] left-4 items-start',\n 'bottom-center': 'bottom-[var(--toaster-mobile-offset)] md:bottom-[var(--toaster-offset)] left-1/2 -translate-x-1/2 items-center',\n 'bottom-right': 'bottom-[var(--toaster-mobile-offset)] md:bottom-[var(--toaster-offset)] right-4 items-end',\n};\n\n/** A number is pixels; a string is any CSS length. */\nfunction toLength(value: number | string): string {\n return typeof value === 'number' ? `${value}px` : value;\n}\n\nexport interface ToasterProps {\n children: ReactNode;\n position?: ToasterPosition;\n /** Maximum simultaneous toasts. Oldest are dropped first. Default `4`. */\n max?: number;\n /** Default auto-dismiss for toasts that do not set their own. Default `5000`. */\n duration?: number;\n /**\n * Distance from the top or bottom edge, from `md` up. A number is pixels. Default `16`.\n * Named as in Sonner. New in 0.9.0.\n */\n offset?: number | string;\n /**\n * The same distance below `md`. Defaults to `offset`. Raise it where the app has bottom\n * navigation on phones, so toasts sit above it, e.g. `mobileOffset={80}`. New in 0.9.0.\n */\n mobileOffset?: number | string;\n}\n\n/**\n * Provider plus the region toasts render into. Mount once, near the app root.\n *\n * The library had no toast and — more importantly — **no persistent live region at all**,\n * so nothing could announce an event that happened away from focus. The distinction that\n * matters here: a live region must already exist in the DOM before content is put into it.\n * A region that mounts at the same moment as its message is frequently not announced,\n * which is why the wrapper below renders unconditionally and only its children come and go.\n *\n * `aria-live=\"polite\"` on the container, and `role=\"alert\"` on individual `danger` toasts\n * so a failure interrupts rather than queueing behind a success message.\n */\nexport function Toaster({\n children,\n position = 'bottom-right',\n max = 4,\n duration = 5000,\n offset = 16,\n mobileOffset,\n}: ToasterProps) {\n const [toasts, setToasts] = useState<ToastRecord[]>([]);\n const timers = useRef(new Map<string, ReturnType<typeof setTimeout>>());\n const counter = useRef(0);\n\n const dismiss = useCallback((id: string) => {\n const timer = timers.current.get(id);\n if (timer) {\n clearTimeout(timer);\n timers.current.delete(id);\n }\n setToasts((current) => current.filter((entry) => entry.id !== id));\n }, []);\n\n const dismissAll = useCallback(() => {\n for (const timer of timers.current.values()) clearTimeout(timer);\n timers.current.clear();\n setToasts([]);\n }, []);\n\n const toast = useCallback(\n (options: ToastOptions) => {\n // A monotonic counter rather than a random id: `Math.random()` in a render-adjacent\n // path is a hydration hazard, and the value only has to be unique within the session.\n counter.current += 1;\n const id = `toast-${counter.current}`;\n const record: ToastRecord = { tone: 'info', duration, ...options, id };\n\n setToasts((current) => [...current, record].slice(-max));\n\n if (record.duration && record.duration > 0) {\n timers.current.set(\n id,\n setTimeout(() => dismiss(id), record.duration),\n );\n }\n return id;\n },\n [duration, max, dismiss],\n );\n\n useEffect(() => {\n const map = timers.current;\n return () => {\n for (const timer of map.values()) clearTimeout(timer);\n map.clear();\n };\n }, []);\n\n const context = useMemo(() => ({ toast, dismiss, dismissAll }), [toast, dismiss, dismissAll]);\n\n return (\n <ToastContext.Provider value={context}>\n {children}\n <Portal>\n <div\n // Unconditionally rendered, and empty most of the time. See the note above: a\n // live region has to pre-exist its content to be announced reliably.\n aria-live=\"polite\"\n aria-atomic=\"false\"\n // Lets an open Modal recognise a press on a toast as not-outside (see\n // overlays/toaster-guard.ts). `aria-live` already keeps the region out of the\n // set Radix hides from assistive tech behind a modal.\n {...{ [TOASTER_ATTRIBUTE]: '' }}\n // `calc(100% - 2rem)` (100% of a fixed box is the viewport) leaves room for the\n // 16px inset on each side. Through 0.8.2 this was `w-full`, so below ~412px the\n // region was the full viewport width *plus* its inset and ran off the far edge.\n className={clsx(\n 'pointer-events-none fixed z-toast flex w-[calc(100%-2rem)] max-w-[380px] flex-col gap-2',\n POSITION[position],\n )}\n style={\n {\n '--toaster-offset': toLength(offset),\n '--toaster-mobile-offset': toLength(mobileOffset ?? offset),\n } as CSSProperties\n }\n >\n {toasts.map((entry) => (\n <ToastItem key={entry.id} toast={entry} onDismiss={() => dismiss(entry.id)} />\n ))}\n </div>\n </Portal>\n </ToastContext.Provider>\n );\n}\n\nfunction ToastItem({ toast, onDismiss }: { toast: ToastRecord; onDismiss: () => void }) {\n const tone = toast.tone ?? 'info';\n\n return (\n <div\n // The container is polite; a danger toast escalates to assertive so a failure is not\n // read out after two successes.\n role={tone === 'danger' ? 'alert' : 'status'}\n // Re-enabled per toast — the container is pointer-events-none so it never blocks\n // clicks on the page behind an empty region.\n className={clsx(\n 'pointer-events-auto flex w-full items-start gap-3 rounded-xl border border-default',\n 'bg-default p-4 shadow-400',\n )}\n >\n <span aria-hidden className={clsx('mt-px shrink-0', TONE_ICON_COLOR[tone])}>\n {TONE_ICON[tone]}\n </span>\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-body-sm font-semibold text-default\">{toast.title}</p>\n {toast.description && (\n <p className=\"mt-0.5 text-body-xs text-default-secondary\">{toast.description}</p>\n )}\n {toast.action && <div className=\"mt-2 flex items-center gap-2\">{toast.action}</div>}\n </div>\n <IconButton\n variant=\"subtle\"\n size=\"sm\"\n aria-label={typeof toast.title === 'string' ? `Dismiss: ${toast.title}` : 'Dismiss'}\n onClick={onDismiss}\n className=\"-mr-1 -mt-1 shrink-0\"\n >\n <XIcon aria-hidden size={14} />\n </IconButton>\n </div>\n );\n}\n","import { forwardRef, useState } from 'react';\nimport { EyeIcon, EyeOffIcon } from 'lucide-react';\n\nimport { Input, type InputProps } from './input';\n\nexport type PasswordInputProps = Omit<InputProps, 'type' | 'trailingIcon' | 'trailingAction'>;\n\n/** Password field with a show/hide visibility toggle. */\nexport const PasswordInput = forwardRef<HTMLInputElement, PasswordInputProps>(function PasswordInput(props, ref) {\n const [visible, setVisible] = useState(false);\n\n return (\n <Input\n ref={ref}\n {...props}\n type={visible ? 'text' : 'password'}\n trailingAction={\n <button\n type=\"button\"\n aria-label={visible ? 'Hide password' : 'Show password'}\n onClick={() => setVisible((v) => !v)}\n className=\"flex items-center justify-center rounded transition-colors hover:text-default focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand\"\n >\n {visible ? (\n <EyeOffIcon aria-hidden className=\"size-4\" />\n ) : (\n <EyeIcon aria-hidden className=\"size-4\" />\n )}\n </button>\n }\n />\n );\n});\n","import clsx from 'clsx';\nimport { ArrowRightIcon, SearchIcon } from 'lucide-react';\n\nexport interface AIChatBarProps {\n placeholder?: string;\n className?: string;\n}\n\nexport function AIChatBar({\n placeholder = 'Ask Intelligence about any entity, supplier, or risk…',\n className,\n}: AIChatBarProps) {\n return (\n <div\n className={clsx(\n 'flex h-16 items-center gap-3 rounded-2xl border border-default bg-default px-6 shadow-panel',\n className,\n )}\n >\n <span aria-hidden className=\"shrink-0 text-icon-default-secondary\">\n <SearchIcon className=\"size-4\" />\n </span>\n <p className=\"flex-1 text-body-sm text-default-tertiary truncate\">{placeholder}</p>\n <button\n type=\"button\"\n className=\"inline-flex shrink-0 items-center gap-2 rounded-xl bg-brand px-4 py-3 text-body-sm font-semibold text-brand-on-brand hover:bg-brand-hover transition-colors\"\n >\n Ask\n <ArrowRightIcon aria-hidden className=\"size-4\" />\n </button>\n </div>\n );\n}\n","import clsx from 'clsx';\nimport { ArrowRightIcon, CpuIcon } from 'lucide-react';\n\nexport interface AISuggestionChipProps {\n prompt: string;\n onClick?: () => void;\n className?: string;\n}\n\nexport function AISuggestionChip({ prompt, onClick, className }: AISuggestionChipProps) {\n return (\n <button\n type=\"button\"\n onClick={onClick}\n className={clsx(\n 'flex h-12 w-full items-center gap-3 rounded-xl border border-default bg-default px-3 text-left hover:bg-default-hover transition-colors',\n className,\n )}\n >\n <span aria-hidden className=\"shrink-0 text-icon-brand\">\n <CpuIcon className=\"size-4\" />\n </span>\n <span className=\"flex-1 text-body-sm text-default truncate\">{prompt}</span>\n <span aria-hidden className=\"shrink-0 text-icon-default-secondary\">\n <ArrowRightIcon className=\"size-3.5\" strokeWidth={2.5} />\n </span>\n </button>\n );\n}\n","import clsx from 'clsx';\nimport { TagPill } from '../status/tag-pill';\n\nexport interface QuickAction {\n label: string;\n value: string;\n}\n\nexport interface QuickActionsBarProps {\n actions: QuickAction[];\n active?: string;\n onSelect?: (value: string) => void;\n className?: string;\n}\n\nexport function QuickActionsBar({ actions, active, onSelect, className }: QuickActionsBarProps) {\n return (\n <div className={clsx('flex flex-wrap items-center gap-3', className)}>\n {actions.map((action) => {\n const isActive = active === action.value;\n return (\n <button\n key={action.value}\n type=\"button\"\n // `aria-pressed` because these are toggles, not navigation — through 0.3.0 the\n // `active` prop was conveyed by the pill's fill colour only.\n aria-pressed={isActive}\n onClick={() => onSelect?.(action.value)}\n // Was `focus:outline-none` with no replacement — the UA indicator removed and\n // nothing put back, a straight WCAG 2.4.7 failure.\n className=\"rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default\"\n >\n <TagPill label={action.label} tone={isActive ? 'brand' : 'default'} />\n </button>\n );\n })}\n </div>\n );\n}\n","import type { ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { CpuIcon } from 'lucide-react';\nimport { cn } from '../../lib/cn';\n\n/**\n * Presentational pieces of an AI chat transcript, ported from SCIC in 0.7.0. Markup only: the\n * conversation state and streaming stay in the app. SCIC's hard-coded hex colours are replaced\n * by tokens, so the bubbles follow dark mode.\n */\n\nexport interface AiAvatarProps {\n className?: string;\n /** The glyph. Default a chip, SCIC's assistant mark. */\n icon?: ReactNode;\n}\n\n/** The assistant's round mark, decorative. */\nexport function AiAvatar({ className, icon }: AiAvatarProps) {\n return (\n <span\n aria-hidden\n className={cn('flex size-8 shrink-0 items-center justify-center rounded-full bg-brand text-icon-brand-on-brand', className)}\n >\n {icon ?? <CpuIcon className=\"size-3.5\" />}\n </span>\n );\n}\n\nexport interface TypingIndicatorProps {\n /** What the assistant is doing, read aloud. Default \"Assistant is typing\". */\n label?: string;\n className?: string;\n}\n\n/**\n * \"The assistant is working\": an avatar, the label and three pulsing dots. A polite live region,\n * so a screen reader hears the label once rather than nothing. The dots stop under\n * `prefers-reduced-motion`.\n */\nexport function TypingIndicator({ label = 'Assistant is typing', className }: TypingIndicatorProps) {\n return (\n <div role=\"status\" aria-live=\"polite\" className={cn('flex items-center gap-3', className)}>\n <AiAvatar />\n <div className=\"flex items-center gap-2 rounded-2xl rounded-tl-sm border border-default bg-default-secondary px-5 py-3\">\n <span className=\"text-body-xs text-default-secondary\">{label}</span>\n <span aria-hidden className=\"flex gap-1\">\n {[0, 1, 2].map((index) => (\n <span\n key={index}\n className=\"inline-block size-1.5 rounded-full bg-default-tertiary motion-safe:animate-bounce\"\n style={{ animationDelay: `${index * 0.15}s` }}\n />\n ))}\n </span>\n </div>\n </div>\n );\n}\n\nexport type ChatBubbleSender = 'user' | 'assistant';\n\nexport interface ChatBubbleProps {\n /**\n * Who wrote the message. Called `role` in SCIC; renamed so it cannot be mistaken for (or\n * linted as) an ARIA role.\n */\n sender: ChatBubbleSender;\n children: ReactNode;\n /** `assistant` only: the failed-turn palette, set as `data-state=\"failed\"`. */\n failed?: boolean;\n className?: string;\n}\n\n/** One message. The user's sits right in a dark bubble; the assistant's spans the column. */\nexport function ChatBubble({ sender, children, failed = false, className }: ChatBubbleProps) {\n if (sender === 'user') {\n return (\n <div data-sender=\"user\" className={cn('flex justify-end', className)}>\n <div className=\"max-w-[85%] rounded-[18px] rounded-tr-sm bg-neutral px-5 py-3.5 text-body-sm leading-relaxed text-neutral-on-neutral md:max-w-[441px] md:px-7 md:py-4\">\n {children}\n </div>\n </div>\n );\n }\n\n return (\n <div\n data-sender=\"assistant\"\n data-state={failed ? 'failed' : undefined}\n className={cn(\n 'rounded-2xl rounded-tl-sm border px-5 py-4 text-body-sm leading-relaxed',\n clsx(\n 'border-default bg-default-secondary text-default',\n 'data-[state=failed]:border-danger-secondary data-[state=failed]:bg-danger-tertiary data-[state=failed]:text-danger',\n ),\n className,\n )}\n >\n {children}\n </div>\n );\n}\n","/** Soft aurora atmosphere used by the public-facing screens (auth, event\n * onboarding) — mirrors AuroraBackground in pages/intelligence. Blobs are\n * corner-anchored so the effect scales from phones to kiosk displays.\n * Render inside a `relative overflow-hidden` container; content goes on top\n * with `relative`.\n *\n * Each blob is a primitive at an alpha, via `color-mix`, so the backdrop follows\n * the palette. Through 0.8.x these were raw rgba() values; 0.9.0 moved each to its\n * nearest primitive at the same alpha. */\nfunction blob(primitive: string, alpha: number) {\n return `radial-gradient(ellipse, color-mix(in srgb, var(${primitive}) ${alpha}%, transparent) 0%, transparent 70%)`;\n}\n\nexport function AuroraBackdrop() {\n return (\n <div className=\"pointer-events-none absolute inset-0\" aria-hidden>\n <div className=\"absolute -left-24 -top-28\" style={{ width: 380, height: 380, background: blob('--prim-red-400', 45) }} />\n <div className=\"absolute -top-24 right-[-4%]\" style={{ width: 320, height: 320, background: blob('--prim-red-300', 40) }} />\n <div className=\"absolute bottom-[-10%] right-[14%]\" style={{ width: 420, height: 420, background: blob('--prim-violet-400', 30) }} />\n <div className=\"absolute bottom-[-6%] left-[4%]\" style={{ width: 280, height: 280, background: blob('--prim-blue-400', 25) }} />\n <div className=\"absolute left-[20%] top-[30%]\" style={{ width: 240, height: 240, background: blob('--prim-blue-300', 18) }} />\n </div>\n );\n}\n"],"m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B,OAAO,EAAE,OAAO,KAAK,QAAQ,KAAK,YAAY,KAAK,kBAAkB,EAAE,EAAE,GAAG;AAAA,IAC1H,gBAAAA,OAAC,SAAI,WAAU,sCAAqC,OAAO,EAAE,OAAO,KAAK,QAAQ,KAAK,YAAY,KAAK,qBAAqB,EAAE,EAAE,GAAG;AAAA,IACnI,gBAAAA,OAAC,SAAI,WAAU,mCAAkC,OAAO,EAAE,OAAO,KAAK,QAAQ,KAAK,YAAY,KAAK,mBAAmB,EAAE,EAAE,GAAG;AAAA,IAC9H,gBAAAA,OAAC,SAAI,WAAU,iCAAgC,OAAO,EAAE,OAAO,KAAK,QAAQ,KAAK,YAAY,KAAK,mBAAmB,EAAE,EAAE,GAAG;AAAA,KAC9H;AAEJ;","names":["clsx","jsx","clsx","jsxs","clsx","jsx","jsxs","clsx","jsx","jsxs","clsx","Input","InputControl","forwardRef","clsx","jsx","forwardRef","Textarea","clsx","forwardRef","clsx","jsx","jsxs","forwardRef","NativeSelect","clsx","forwardRef","useId","useMemo","useRef","useState","clsx","forwardRef","useState","jsx","useState","forwardRef","PopoverTrigger","PopoverContent","PopoverClose","PopoverAnchor","useId","useMemo","useState","clsx","jsx","jsxs","clsx","useMemo","useId","useState","jsx","jsxs","iconWrap","forwardRef","DatePicker","DateControl","useId","useState","useRef","useMemo","clsx","clsx","forwardRef","useRef","useState","ChevronRightIcon","jsx","jsxs","clsx","ChevronRightIcon","forwardRef","StepList","useRef","useState","clsx","CheckIcon","jsx","jsxs","clsx","CheckIcon","forwardRef","useId","clsx","jsx","jsxs","SIZE","forwardRef","Switch","useId","clsx","createContext","forwardRef","useContext","useMemo","useRef","clsx","jsx","SIZE","forwardRef","Toggle","useContext","createContext","useRef","useMemo","clsx","ToggleGroupItem","forwardRef","useId","useRef","useState","clsx","jsx","jsxs","forwardRef","InputOTP","useRef","useState","useId","clsx","useRef","useState","clsx","jsx","jsxs","useEffect","useState","clsx","clsx","Fragment","jsx","jsxs","sizeStyles","clsx","jsx","jsxs","useState","useEffect","clsx","clsx","jsx","jsxs","clsx","useCallback","useEffect","useMemo","useRef","useState","useState","clsx","XIcon","useCallback","useEffect","useId","useMemo","useRef","useState","clsx","CheckIcon","ChevronDownIcon","Fragment","jsx","jsxs","useState","useId","useRef","useMemo","useCallback","useEffect","clsx","ChevronDownIcon","CheckIcon","useMemo","jsx","useMemo","createContext","forwardRef","useContext","useId","clsx","jsx","jsxs","createContext","forwardRef","RadioGroup","useId","clsx","Radio","useContext","clsx","jsx","clsx","useMemo","jsx","useMemo","Fragment","jsx","jsxs","useState","clsx","XIcon","jsx","jsxs","useState","useRef","useEffect","useMemo","locked","timer","useCallback","useEffect","useRef","useState","clsx","XIcon","jsx","jsxs","clsx","jsx","Fragment","jsx","jsxs","useEffect","useId","useMemo","useRef","useState","clsx","jsx","jsxs","useState","useId","useRef","useMemo","useEffect","clsx","clsx","jsx","jsxs","TONE_STYLES","clsx","jsx","clsx","jsx","jsxs","clsx","clsx","jsx","jsxs","clsx","clsx","jsx","jsxs","jsx","clsx","CheckIcon","XIcon","jsx","clsx","jsx","sizeStyles","toneStyles","createContext","forwardRef","useContext","useId","clsx","jsx","jsxs","createContext","forwardRef","RadioCards","useId","RadioCardsItem","useContext","clsx","createContext","forwardRef","useContext","useId","jsx","jsxs","createContext","forwardRef","CheckboxGroup","useId","CheckboxGroupItem","useContext","forwardRef","useId","clsx","jsx","jsxs","Slider","forwardRef","clsx","jsx","SIZE","forwardRef","Label","clsx","createContext","forwardRef","useContext","useEffect","useState","XIcon","jsx","jsxs","SIZE","createContext","forwardRef","Modal","ModalShell","useState","XIcon","ModalTrigger","ModalClose","ModalHeader","ModalTitle","useContext","useEffect","ModalDescription","ModalBody","ModalFooter","useId","Fragment","jsx","jsxs","useId","useId","useState","jsx","jsxs","useId","useState","forwardRef","Fragment","jsx","jsxs","forwardRef","ContextMenuTrigger","ContextMenuContent","forwardRef","jsx","jsxs","forwardRef","Menubar","MenubarTrigger","MenubarContent","parts","createContext","forwardRef","useContext","useEffect","useState","DialogPrimitive","XIcon","forwardRef","useEffect","useRef","useState","clsx","jsx","forwardRef","ScrollArea","useRef","useState","useEffect","clsx","Fragment","jsx","jsxs","createContext","forwardRef","Drawer","DialogPrimitive","extractTrigger","withoutTrigger","DrawerPanel","useState","DrawerTrigger","DrawerClose","isTrigger","DrawerHeader","XIcon","DrawerTitle","useContext","useEffect","DrawerDescription","DrawerBody","DrawerFooter","useRef","jsx","jsxs","useRef","useState","jsx","jsxs","useState","jsx","useState","DialogPrimitive","XIcon","jsx","jsxs","useState","DialogPrimitive","XIcon","forwardRef","jsx","VisuallyHidden","jsx","createContext","useContext","jsx","FOOTER_ALIGN","createContext","useContext","createContext","forwardRef","useContext","clsx","ChevronDownIcon","jsx","jsxs","createContext","forwardRef","Accordion","AccordionItem","AccordionTrigger","useContext","Heading","ChevronDownIcon","clsx","AccordionContent","createContext","forwardRef","useContext","useId","jsx","createContext","forwardRef","Collapsible","useId","CollapsibleTrigger","useContext","CollapsibleContent","forwardRef","jsx","forwardRef","Box","ALIGN","Flex","Grid","Container","Section","forwardRef","clsx","jsx","AspectRatio","createContext","useCallback","useContext","useEffect","useId","useMemo","useRef","useState","clsx","ChevronLeftIcon","ChevronRightIcon","jsx","jsxs","createContext","useContext","useId","useRef","useState","useMemo","useEffect","clsx","useCallback","ChevronLeftIcon","ChevronRightIcon","createContext","useCallback","useContext","useEffect","useId","useMemo","useRef","useState","clsx","jsx","jsxs","createContext","useContext","useRef","useId","useState","useMemo","clsx","useCallback","useEffect","clsx","jsx","jsxs","clsx","ArrowLeftIcon","jsx","jsxs","SIZE","clsx","ArrowLeftIcon","clsx","jsx","jsxs","GAP","clsx","createContext","forwardRef","useCallback","useContext","useId","useLayoutEffect","useRef","useState","clsx","ChevronLeftIcon","ChevronRightIcon","jsx","jsxs","SIZE","clsx","useRef","useState","useCallback","useLayoutEffect","ChevronLeftIcon","ChevronRightIcon","useId","createContext","forwardRef","TabsList","useContext","TabsTrigger","TabsContent","forwardRef","clsx","ChevronDownIcon","Fragment","jsx","jsxs","SIZE","VARIANT","clsx","forwardRef","NavItem","NavSubItem","NavGroupHeader","ChevronDownIcon","createContext","forwardRef","useCallback","useContext","useEffect","useId","useMemo","useState","ChevronDownIcon","ChevronLeftIcon","ChevronRightIcon","clsx","useCallback","Fragment","jsx","jsxs","createContext","useContext","useEffect","useCallback","useMemo","forwardRef","DefaultLink","useId","clsx","ChevronRightIcon","ChevronLeftIcon","useState","ChevronDownIcon","SidebarTrigger","clsx","jsx","forwardRef","clsx","jsx","Separator","forwardRef","clsx","jsx","SIZE","Kbd","Fragment","forwardRef","clsx","ChevronRightIcon","jsx","jsxs","forwardRef","Breadcrumb","clsx","Fragment","BreadcrumbItem","ChevronRightIcon","BreadcrumbEllipsis","forwardRef","clsx","Fragment","jsx","jsxs","forwardRef","NavigationMenu","clsx","NavigationMenuItem","forwardRef","clsx","jsx","TONE","Component","forwardRef","Blockquote","TextLink","clsx","TextList","TextListItem","createContext","useContext","clsx","clsx","jsx","sizeStyles","jsx","jsxs","createContext","useContext","clsx","clsx","jsx","jsxs","clsx","jsx","clsx","useCallback","useEffect","useLayoutEffect","useRef","useState","useEffect","useLayoutEffect","useState","useRef","useCallback","clsx","Fragment","jsx","jsxs","clsx","clsx","jsx","jsxs","sizeStyles","clsx","jsx","jsxs","SIZE","TONE","clsx","jsx","COLUMNS","clsx","jsx","jsxs","SIZE","labelClass","clsx","clsx","jsx","jsxs","SIZE","clsx","clsx","jsx","jsxs","SIZE","clsx","useId","clsx","Fragment","jsx","jsxs","SIZE","useId","clsx","clsx","jsx","SIZE","clsx","clsx","clsx","jsx","clsx","jsx","jsxs","clsx","clsx","jsx","jsxs","SIZE","WEIGHT","Fragment","useEffect","useId","useMemo","clsx","jsx","jsxs","isGroup","useId","useMemo","useEffect","clsx","Fragment","Fragment","jsx","jsxs","clsx","Fragment","jsx","jsxs","DENSITY","clsx","clsx","jsx","jsxs","clsx","clsx","jsx","jsxs","GAP","ALIGN","clsx","jsx","jsxs","GAP","clsx","clsx","jsx","jsxs","clsx","CheckIcon","jsx","jsxs","clsx","jsx","jsxs","clsx","jsx","jsxs","COLUMNS","useEffect","useState","clsx","CheckIcon","jsx","jsxs","useState","useEffect","CheckIcon","clsx","clsx","CheckIcon","jsx","jsxs","COLUMNS","useMemo","useRef","useState","clsx","ChevronRightIcon","jsx","jsxs","useState","useRef","useMemo","clsx","ChevronRightIcon","clsx","CircleCheckBigIcon","InfoIcon","TriangleAlertIcon","jsx","jsxs","toneStyles","jsx","forwardRef","useId","clsx","CircleCheckBigIcon","InfoIcon","TriangleAlertIcon","XIcon","jsx","jsxs","TONE_STYLES","TONE_ICON","InfoIcon","CircleCheckBigIcon","TriangleAlertIcon","forwardRef","Banner","useId","clsx","XIcon","createContext","useCallback","useContext","useEffect","useMemo","useRef","useState","clsx","CircleCheckBigIcon","InfoIcon","TriangleAlertIcon","XIcon","jsx","jsxs","createContext","useContext","TONE_ICON","InfoIcon","CircleCheckBigIcon","TriangleAlertIcon","TONE_ICON_COLOR","POSITION","useState","useRef","useCallback","useEffect","useMemo","clsx","XIcon","forwardRef","useState","EyeIcon","EyeOffIcon","jsx","forwardRef","PasswordInput","useState","EyeOffIcon","EyeIcon","clsx","ArrowRightIcon","SearchIcon","jsx","jsxs","clsx","ArrowRightIcon","jsx","jsxs","clsx","jsx","clsx","clsx","CpuIcon","jsx","jsxs","CpuIcon","clsx","jsx","jsxs"]}