react-os-shell 4.55.0 → 4.63.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/dist/{Browser-WHBSYGLC.js → Browser-SPTNLEMR.js} +5 -5
- package/dist/{Browser-WHBSYGLC.js.map → Browser-SPTNLEMR.js.map} +1 -1
- package/dist/{Calculator-PHKNMRLX.js → Calculator-XMOPPCK3.js} +4 -4
- package/dist/{Calculator-PHKNMRLX.js.map → Calculator-XMOPPCK3.js.map} +1 -1
- package/dist/{CurrencyConverter-MEG7RHEK.js → CurrencyConverter-24HNX6C6.js} +4 -4
- package/dist/{CurrencyConverter-MEG7RHEK.js.map → CurrencyConverter-24HNX6C6.js.map} +1 -1
- package/dist/{Documents-Y32RNCTU.js → Documents-GMRVVCH7.js} +5 -5
- package/dist/{Documents-Y32RNCTU.js.map → Documents-GMRVVCH7.js.map} +1 -1
- package/dist/{Files-LTG2S2KU.js → Files-ITH4SVML.js} +5 -5
- package/dist/{Files-LTG2S2KU.js.map → Files-ITH4SVML.js.map} +1 -1
- package/dist/{Notepad-P7J2OAXD.js → Notepad-GE5P55TL.js} +5 -5
- package/dist/{Notepad-P7J2OAXD.js.map → Notepad-GE5P55TL.js.map} +1 -1
- package/dist/{PomodoroTimer-5B5AFXQH.js → PomodoroTimer-ER5STVKM.js} +4 -4
- package/dist/{PomodoroTimer-5B5AFXQH.js.map → PomodoroTimer-ER5STVKM.js.map} +1 -1
- package/dist/{Preview-XZQ55YGY.js → Preview-UXVDXCDJ.js} +5 -5
- package/dist/{Preview-XZQ55YGY.js.map → Preview-UXVDXCDJ.js.map} +1 -1
- package/dist/{Spreadsheet-KKSLCSIK.js → Spreadsheet-B32JQVX4.js} +5 -5
- package/dist/{Spreadsheet-KKSLCSIK.js.map → Spreadsheet-B32JQVX4.js.map} +1 -1
- package/dist/{Stock-KTWRNBI6.js → Stock-FSFPFDQT.js} +4 -4
- package/dist/{Stock-KTWRNBI6.js.map → Stock-FSFPFDQT.js.map} +1 -1
- package/dist/{Weather-B7MO7N4N.js → Weather-HXOERJJV.js} +4 -4
- package/dist/{Weather-B7MO7N4N.js.map → Weather-HXOERJJV.js.map} +1 -1
- package/dist/{WorldClock-M5MEV74F.js → WorldClock-2FUGLIUZ.js} +4 -4
- package/dist/{WorldClock-M5MEV74F.js.map → WorldClock-2FUGLIUZ.js.map} +1 -1
- package/dist/apps/index.js +15 -15
- package/dist/{chunk-CTTHBTOX.js → chunk-CWA27IGB.js} +499 -95
- package/dist/chunk-CWA27IGB.js.map +1 -0
- package/dist/{chunk-5S65ZC5W.js → chunk-JMESET3G.js} +81 -7
- package/dist/chunk-JMESET3G.js.map +1 -0
- package/dist/{chunk-FHPPPDHL.js → chunk-LYQVLRWQ.js} +3 -3
- package/dist/{chunk-FHPPPDHL.js.map → chunk-LYQVLRWQ.js.map} +1 -1
- package/dist/{chunk-S3ZIBWRY.js → chunk-TO6ZZHJK.js} +4 -4
- package/dist/{chunk-S3ZIBWRY.js.map → chunk-TO6ZZHJK.js.map} +1 -1
- package/dist/chunk-WCGHIJZR.js +7 -0
- package/dist/{chunk-LCLB7YBY.js.map → chunk-WCGHIJZR.js.map} +1 -1
- package/dist/{index-BE0z2D6y.d.ts → index-Ka32s3Ij.d.ts} +135 -2
- package/dist/index.d.ts +29 -8
- package/dist/index.js +56 -18
- package/dist/index.js.map +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-5S65ZC5W.js.map +0 -1
- package/dist/chunk-CTTHBTOX.js.map +0 -1
- package/dist/chunk-LCLB7YBY.js +0 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/forms/Button.tsx","../src/forms/IconButton.tsx","../src/forms/styles.ts","../src/forms/Input.tsx","../src/forms/Textarea.tsx","../src/forms/selectNav.ts","../src/forms/Select.tsx","../src/forms/Checkbox.tsx","../src/forms/Radio.tsx","../src/forms/FormField.tsx","../src/forms/Label.tsx","../src/forms/mediaShared.tsx","../src/forms/MediaUploadField.tsx","../src/forms/MediaUploadGrid.tsx","../src/hooks/useClickOutside.ts","../src/forms/DateRangePicker.tsx","../src/forms/DatePicker.tsx","../src/forms/TimePicker.tsx","../src/forms/DateTimePicker.tsx","../src/forms/keypadInput.ts","../src/forms/NumericKeypad.tsx","../src/forms/TileButton.tsx","../src/forms/Segmented.tsx","../src/forms/Switch.tsx","../src/forms/InputNumber.tsx","../src/forms/FilePicker.tsx","../src/forms/dropdownPosition.ts","../src/shell/SearchableSelect.tsx","../src/forms/TagInput.tsx","../src/shell/Card.tsx","../src/shell/Text.tsx","../src/shell/Stack.tsx","../src/shell/Divider.tsx","../src/shell/Skeleton.tsx","../src/shell/DescriptionList.tsx","../src/shell/Result.tsx","../src/shell/CountBadge.tsx","../src/shell/Statistic.tsx","../src/shell/Avatar.tsx","../src/shell/Banner.tsx","../src/shell/Tabs.tsx","../src/shell/Stepper.tsx","../src/shell/Accordion.tsx","../src/shell/Tooltip.tsx","../src/shell/StatusBadge.tsx","../src/shell/ColoredBadge.tsx","../src/shell/EmptyState.tsx","../src/shell/PageHeader.tsx","../src/shell/Spinner.tsx","../src/shell/severity.ts","../src/shell/MetricBar.tsx","../src/utils/date.ts","../src/shell/MilestoneTimeline.tsx","../src/shell/ContainerFillChart.tsx","../src/shell/Markdown.tsx","../src/shell/HelpCenter.tsx","../src/shell/SidebarActionButton.tsx","../src/shell/SidebarNav.tsx","../src/shell/TopNav.tsx","../src/shell/DropdownMenu.tsx","../src/shell/Drawer.tsx","../src/shell/GlobalSearch.tsx","../src/data/Kanban.tsx","../src/data/Pagination.tsx","../src/data/DataTable.tsx","../src/data/ListFooter.tsx","../src/data/ListLoadError.tsx","../src/charts/Sparkline.tsx","../src/charts/BarChart.tsx","../src/charts/DonutChart.tsx","../src/charts/LineChart.tsx","../src/templates/DashboardTemplate.tsx","../src/templates/DataTablePage.tsx","../src/templates/FormLayoutPage.tsx","../src/templates/CheckoutTemplate.tsx","../src/templates/EmailTemplate.tsx","../src/templates/ChatTemplate.tsx","../src/templates/GalleryTemplate.tsx","../src/templates/AuthScreen.tsx","../src/templates/ErrorPage.tsx","../src/templates/ErrorBoundary.tsx","../src/hooks/useTheme.ts","../src/shell/Kbd.tsx"],"names":["Button","forwardRef","IconButton","jsx","Input","pad","jsxs","Textarea","NativeSelect","ListboxSelect","useId","useCallback","Select","Checkbox","useRef","useEffect","Radio","Spinner","useState","useLayoutEffect","Fragment","DatePicker","toInputValue","TimePicker","fromInputValue","DateTimePicker","SIZES","TileButton","Switch","InputNumber","MENU_MAX_HEIGHT","MENU_GAP","VIEWPORT_MARGIN","createPortal","useMemo","SIZE","COLS","TONE","format","fmt","SIZE_PX","ALIGN","len","GROUPS","ITEMS","COPY"],"mappings":";;;;;;;;;AAiEO,IAAM,WAAA,GACX,kKAAA;AAGK,IAAM,eAAA,GAAiD;AAAA,EAC5D,OAAA,EAAS,2EAAA;AAAA,EACT,SAAA,EAAW,iGAAA;AAAA,EACX,KAAA,EAAO,wDAAA;AAAA,EACP,cAAA,EAAgB,oDAAA;AAAA,EAChB,MAAA,EAAQ,wEAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWR,IAAA,EAAM;AACR,CAAA;AAgBA,IAAM,KAAA,GAAoC;AAAA,EACxC,EAAA,EAAI,2BAAA;AAAA,EACJ,EAAA,EAAI,6BAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKJ,EAAA,EAAI,2BAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMJ,UAAA,EAAY,6BAAA;AAAA,EACZ,OAAA,EAAS,2BAAA;AAAA;AAAA,EACT,UAAA,EAAY,yBAAA;AAAA;AAAA,EACZ,UAAA,EAAY;AAAA;AACd,CAAA;AAKA,IAAM,SAAA,GACJ,wIAAA;AAKF,IAAM,UAAA,GAAyC;AAAA,EAC7C,EAAA,EAA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A,CAAU,QAAA,IAAY,SAAA,CAAU,SAAS;AAGlH,IAAM,GAAA,GAAM,QAAQ,QAAA,GAAW;AAC/B,IAAM,GAAA,GAAM,QAAQ,QAAA,GAAW;AAC/B,IAAM,KAAA,GAAQ;AACd,IAAM,KAAA,GAAQ;AAGd,IAAM,SAAA,GAAY,QAAQ,cAAA,GAAiB;AAC3C,IAAM,KAAA,GAAQ,QAAQ,SAAA,GAAY;AAClC,IAAM,KAAA,GAAQ,QAAQ,SAAA,GAAY;AAClC,IAAM,OAAA,GAAU,QAAQ,SAAA,GAAY;AACpC,IAAM,KAAA,GAAQ,QAAQ,SAAA,GAAY;AAClC,IAAM,KAAA,GAAQ,QAAQ,SAAA,GAAY;AAElC,IAAM,WAAA,GAAc,QAAQ,eAAA,GAAkB;AAC9C,IAAM,WAAA,GAAc,QAAQ,eAAA,GAAkB;AAC9C,IAAM,WAAA,GAAc,QAAQ,eAAA,GAAkB;AAC9C,IAAM,WAAA,GAAc,QAAQ,eAAA,GAAkB","file":"chunk-CWA27IGB.js","sourcesContent":["/**\n * Button — the kit's standard button. `primary` uses `bg-blue-600`, which the\n * theme system remaps to the active accent (and to a readable tone in dark\n * mode), so a primary button always follows the user's chosen accent.\n *\n * Controlled by the consumer like any native button (spread `onClick`, `type`,\n * `form`, …); the component only adds the look, a `loading` spinner state, and\n * optional icon slots.\n */\nimport { forwardRef, useId, type ButtonHTMLAttributes, type ReactNode } from 'react';\n\n/**\n * `ghost-danger` is a destructive action sitting in a row of ordinary ones —\n * Clear, Discard, Remove — where solid `danger` would be wrong. Two solid\n * shouting buttons on one screen means neither is read, so the destructive one\n * borrows `ghost`'s weight and keeps only the colour. The colour is the point:\n * it lets someone tell what the button costs WITHOUT reading it, which under\n * time pressure is what actually happens.\n */\nexport type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'ghost-danger' | 'danger' | 'link';\n/**\n * `sm`/`md`/`lg` are the desktop scale. The `touch-*` rungs are for a finger on\n * glass — a till, a warehouse tablet — and are a SEPARATE ladder on purpose:\n * a till's idea of \"medium\" is 56px, and naming it `md` would have made the\n * same word mean two sizes depending on which app you were reading.\n *\n * Nothing picks a touch size automatically. An app that wants them asks for\n * them, so a desktop portal cannot grow finger-sized buttons by accident.\n */\nexport type ButtonSize = 'sm' | 'md' | 'lg' | 'touch-sm' | 'touch' | 'touch-lg' | 'touch-xl';\n\nexport interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'className'> {\n variant?: ButtonVariant;\n size?: ButtonSize;\n /** Show a spinner and disable the button while an action is in flight. */\n loading?: boolean;\n leftIcon?: ReactNode;\n rightIcon?: ReactNode;\n /** Stretch to the full width of the container. */\n block?: boolean;\n className?: string;\n /**\n * Why this button is disabled, rendered as text BESIDE it — never as a\n * `title` tooltip. A tooltip needs a hover, a touchscreen has no hover, and a\n * cashier facing a dead button with no explanation calls a manager.\n *\n * Only rendered while the button is actually disabled (or loading); ignored\n * otherwise, so it is safe to pass unconditionally. Note it changes the\n * rendered shape: the button gains a wrapper element, which matters to a\n * parent `flex gap-*` row or a `:first-child` selector.\n */\n disabledReason?: ReactNode;\n}\n\n/**\n * Shared with `IconButton`, which composes its own class string rather than\n * passing a square size through this component's `className` — two competing\n * padding utilities in one attribute resolve by compiled-stylesheet order, not\n * by the order they were written (the reasoning in forms/styles.ts applies\n * here identically).\n *\n * Package-internal on purpose: exported from the module so IconButton can share\n * it, deliberately absent from `src/ui/kit.ts` so it is not public API. A\n * consumer restyling a button is a consumer the theme system cannot reach.\n */\nexport const BUTTON_BASE =\n 'inline-flex items-center justify-center rounded-md font-medium transition-colors ' +\n 'focus:outline-none focus:ring-2 disabled:cursor-not-allowed disabled:opacity-60';\n\nexport const BUTTON_VARIANTS: Record<ButtonVariant, string> = {\n primary: 'bg-blue-600 text-white shadow-sm hover:bg-blue-700 focus:ring-blue-400/40',\n secondary: 'border border-gray-300 bg-white text-gray-700 shadow-sm hover:bg-gray-50 focus:ring-blue-400/30',\n ghost: 'text-gray-700 hover:bg-gray-100 focus:ring-blue-400/30',\n 'ghost-danger': 'text-red-600 hover:bg-red-50 focus:ring-red-400/30',\n danger: 'bg-red-600 text-white shadow-sm hover:bg-red-700 focus:ring-red-400/40',\n /**\n * A button that reads as a link: no box, no padding, underlined on hover.\n * For an action that belongs in running text or beside a field — \"Forgot\n * your password?\", \"Use a different address\" — where a boxed button would\n * claim more of the page than the action deserves.\n *\n * It is still a <button>. Anything that NAVIGATES should be an anchor, so it\n * can be middle-clicked and read off the status bar; this is for actions\n * that merely look quiet.\n */\n link: 'text-blue-600 underline-offset-4 hover:underline focus:ring-blue-400/30',\n};\n\n// A Record keyed by the union, not a ternary chain: adding a member without a\n// size here is then a compile error rather than a silent fall-through to the\n// default branch. `sm`/`md` are byte-for-byte what they have always been, and\n// `tests/touchPrimitives.test.tsx` pins them against a captured literal.\n//\n// Every rung is also asserted to be the same height as the IconButton rung of\n// the same name (`tests/buttonLinkAndLarge.test.tsx`) — pinning the two sides\n// separately is how `lg` first shipped 4px short of its square twin.\n//\n// The touch rungs carry an explicit `h-*` where the desktop pair uses `py-*`.\n// That is deliberate: a hit target has to be a guaranteed height, not a height\n// implied by the current font size. They are separate map entries and never\n// concatenated with each other, so no two competing utilities land in one class\n// attribute.\nconst SIZES: Record<ButtonSize, string> = {\n sm: 'gap-1 px-2.5 py-1 text-xs',\n md: 'gap-1.5 px-3 py-1.5 text-sm',\n // `py-2.5`, not `py-2`: this rung has to come out 40px to match IconButton's\n // `h-10`, which is the promise IconButton's docblock makes for every rung.\n // `py-2` gives 36px (20px line box + 8px twice) and puts a 4px step between a\n // Button and an IconButton sitting in the same row.\n lg: 'gap-2 px-4 py-2.5 text-sm',\n // 44px is the WCAG 2.5.5 floor, and a floor is not a comfortable size. Use it\n // ONLY for chrome that sits outside the task — switching screens, ending a\n // shift — and never on the path someone is actually working through. It\n // exists so a dense toolbar has something legitimate to reach for instead of\n // borrowing the desktop `sm`, which is half this height.\n 'touch-sm': 'gap-1.5 h-11 px-4 text-base',\n 'touch': 'gap-2 h-14 px-5 text-base', // 56px — the comfortable default\n 'touch-lg': 'gap-2 h-16 px-6 text-lg', // 64px — primary action on a page\n 'touch-xl': 'gap-3 h-20 px-8 text-2xl', // 80px — keypad keys, tender\n};\n\n// Everything BUTTON_BASE has except the box: no rounding (there is nothing to\n// round) and no `justify-center` (a link sits in a line of text, it does not\n// centre itself in a shape).\nconst LINK_BASE =\n 'inline-flex items-center font-medium transition-colors ' +\n 'focus:outline-none focus:ring-2 disabled:cursor-not-allowed disabled:opacity-60';\n\n// Only the gap and the text size survive from each rung — the padding is what\n// the link variant exists to shed.\nconst LINK_SIZES: Record<ButtonSize, string> = {\n sm: 'gap-1 text-xs',\n md: 'gap-1.5 text-sm',\n lg: 'gap-2 text-sm',\n 'touch-sm': 'gap-1.5 text-base',\n 'touch': 'gap-2 text-base',\n 'touch-lg': 'gap-2 text-lg',\n 'touch-xl': 'gap-3 text-2xl',\n};\n\nfunction Spinner() {\n return (\n <svg className=\"h-3.5 w-3.5 animate-spin\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <circle className=\"opacity-25\" cx=\"12\" cy=\"12\" r=\"10\" stroke=\"currentColor\" strokeWidth=\"4\" />\n <path className=\"opacity-75\" fill=\"currentColor\" d=\"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z\" />\n </svg>\n );\n}\n\nconst Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n { variant = 'primary', size = 'md', loading = false, leftIcon, rightIcon, block = false,\n disabled, type = 'button', children, className = '', disabledReason, ...rest },\n ref,\n) {\n // useId, not a module counter: a counter assigns different ids on the server\n // and the client and breaks hydration. Called unconditionally — it is a hook.\n const generatedId = useId();\n const isDisabled = disabled || loading;\n const showReason = isDisabled && disabledReason != null && disabledReason !== '';\n const reasonId = showReason ? generatedId : undefined;\n\n const button = (\n <button\n ref={ref}\n type={type}\n disabled={isDisabled}\n aria-busy={loading || undefined}\n aria-describedby={reasonId}\n className={[\n // `link` takes the base WITHOUT the box: no rounding, no padding from\n // the size table. It cannot cancel those by overriding — two padding\n // utilities in one class attribute resolve by compiled-stylesheet\n // order, not by the order they were written — so it never receives\n // them, and keeps only the size's gap and text size.\n variant === 'link' ? LINK_BASE : BUTTON_BASE,\n BUTTON_VARIANTS[variant],\n variant === 'link' ? LINK_SIZES[size] : SIZES[size],\n block ? 'w-full' : '',\n className,\n ].filter(Boolean).join(' ')}\n {...rest}\n >\n {loading ? <Spinner /> : leftIcon}\n {children}\n {!loading && rightIcon}\n </button>\n );\n\n // No reason to show ⇒ the bare <button>, byte-identical to every release\n // before this prop existed. Only the disabled-with-a-reason case wraps.\n if (!showReason) return button;\n\n return (\n <span className={block ? 'flex w-full flex-col gap-1' : 'inline-flex flex-col items-start gap-1'}>\n {button}\n <span id={reasonId} className=\"text-xs text-red-600\">{disabledReason}</span>\n </span>\n );\n});\n\nexport default Button;\n","/**\n * IconButton — a button whose whole content is an icon.\n *\n * A separate component rather than a `Button` prop, for a reason that is\n * type-level and worth the file: an icon-only control has no accessible name\n * unless someone supplies one, and a REQUIRED `aria-label` in the props is the\n * only way to make forgetting it a compile error instead of a screen-reader\n * user's dead end. `Button` cannot require it — most buttons have text, which\n * names them for free.\n *\n * The size axis is square. `Button` sizes with horizontal padding, so it has no\n * icon-only form: a 32px button there is 32px tall and as wide as its content.\n * The rungs here match `Button`'s heights exactly (`md` is 32px in both), so a\n * row mixing the two lines up.\n *\n * It reuses `Button`'s base and variants — never its class string. Passing a\n * square size through `Button`'s `className` would put two competing padding\n * utilities in one attribute, and those resolve by compiled-stylesheet order\n * rather than by the order they were written, which is the trap documented at\n * length in forms/styles.ts. Composing here means only one size ever lands.\n */\nimport { forwardRef, type ButtonHTMLAttributes, type ReactNode } from 'react';\n\nimport { BUTTON_BASE, BUTTON_VARIANTS, type ButtonSize, type ButtonVariant } from './Button';\n\nexport interface IconButtonProps\n extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'className' | 'children'> {\n /** The icon. Sized by the caller — the kit does not resize what it is given. */\n children: ReactNode;\n /**\n * What the button does, in words. Required: there is no text to read, so\n * without this the control is unusable to anyone not looking at it.\n */\n 'aria-label': string;\n /**\n * Defaults to `ghost`, where `Button` defaults to `primary`. An icon with no\n * label is almost always a secondary action — a row's overflow menu, a copy\n * affordance, a close — and a grid of solid blue squares is not what any of\n * those want. Ask for `primary` on the rare icon-only main action.\n */\n /**\n * `link` is excluded: it exists to shed the box, and a square icon button is\n * nothing but the box. Asking for it would produce a bare coloured glyph\n * with a 40px hit area it no longer draws.\n */\n variant?: Exclude<ButtonVariant, 'link'>;\n size?: ButtonSize;\n className?: string;\n}\n\n/**\n * Square, and matching `Button`'s heights rung for rung: `sm` is 24px in both\n * (py-1 either side of a 16px line box), `md` 32px, and the touch rungs carry\n * the same explicit heights for the same reason — a hit target has to be a\n * guaranteed size, not one implied by the current font.\n *\n * A Record keyed by the union, so a new ButtonSize member without an entry here\n * is a compile error rather than a silent fall-through.\n */\nconst SQUARE: Record<ButtonSize, string> = {\n sm: 'h-6 w-6',\n md: 'h-8 w-8',\n lg: 'h-10 w-10',\n 'touch-sm': 'h-11 w-11',\n 'touch': 'h-14 w-14',\n 'touch-lg': 'h-16 w-16',\n 'touch-xl': 'h-20 w-20',\n};\n\nconst IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(function IconButton(\n { children, variant = 'ghost', size = 'md', type = 'button', className = '', ...rest },\n ref,\n) {\n return (\n <button\n ref={ref}\n type={type}\n className={[BUTTON_BASE, BUTTON_VARIANTS[variant], SQUARE[size], 'shrink-0 p-0', className]\n .filter(Boolean)\n .join(' ')}\n {...rest}\n >\n {children}\n </button>\n );\n});\n\nexport default IconButton;\n","/**\n * Shared form-control styling — the single source of truth for the kit's\n * text-input look. Promoted out of SearchableSelect so every form control\n * (Input, Textarea, Select, SearchableSelect) renders identically and picks\n * up the same `[data-theme=\"dark\"]` input remaps from styles.css.\n *\n * Keep this in the documented Tailwind vocabulary (see .design-sync/conventions.md)\n * so the classes survive both the dark-mode allow-list and the design-sync\n * compiled stylesheet.\n */\n\n/**\n * The size axis is SWAPPED into the class string, never appended to it.\n *\n * That distinction is the whole reason this constant is assembled from parts\n * rather than written as one literal. Two competing utilities in one class\n * attribute — `px-3` and `px-4`, say — are not resolved by their order in the\n * string; they are resolved by their order in the COMPILED stylesheet, which\n * neither this file nor the caller controls. Appending a touch size to a base\n * that already bakes in `px-3 py-1.5 text-sm` would therefore render one size\n * or the other essentially at random, and look fine in review either way.\n *\n * Composed below in the original order, so `INPUT_BASE` is byte-identical to\n * what it has always been — it and `inputClasses` are public exports, so their\n * exact values are contract. `tests/touchPrimitives.test.tsx` pins that.\n */\nconst INPUT_SHAPE_PRE = 'block w-full rounded-md border border-gray-300 bg-white';\nconst INPUT_SHAPE_POST =\n 'text-gray-800 placeholder:text-gray-400 shadow-sm ' +\n 'focus:border-blue-400 focus:outline-none focus:ring-2 focus:ring-blue-400/30';\n\n/** `sm`/`md`/`lg` are the desktop ladder; `touch` is a finger on glass. See\n * ButtonSize for why touch is a separate rung rather than the top of this\n * ladder — a till's idea of \"large\" is 56px, and one word cannot mean both. */\nexport type InputSize = 'sm' | 'md' | 'lg' | 'touch';\n\nexport const INPUT_SIZES: Record<InputSize, string> = {\n // The desktop rungs carry no explicit height: a text control's height should\n // follow its own font, or a long label wraps out of a box that was pinned.\n // The touch rung does carry one, for the same reason Button's does.\n sm: 'px-2.5 py-1 text-xs',\n md: 'px-3 py-1.5 text-sm',\n lg: 'px-3.5 py-2 text-base',\n // 56px, matching Button's `touch`. `text-base` is 16px BY AGREEMENT with the\n // rule in ui.css that forces `font-size: 16px !important` on every form\n // control under `(pointer: coarse)` — the rule that stops iOS zooming the\n // viewport on focus. Picking anything else here would render one size on a\n // desktop and 16px on the device the size was chosen for.\n touch: 'h-14 px-4 text-base',\n};\n\n/** Base look for a text-bearing form control. Native <input>/<select>/<textarea>\n * also receive dark styling for free via the global rule in styles.css. */\nexport const INPUT_BASE = `${INPUT_SHAPE_PRE} ${INPUT_SIZES.md} ${INPUT_SHAPE_POST}`;\n\n/** Error-state ring/border, layered on top of INPUT_BASE. */\nexport const INPUT_INVALID =\n 'border-red-300 focus:border-red-400 focus:ring-red-400/30';\n\n/** Disabled affordance — opacity-based so it stays correct in every theme. */\nexport const INPUT_DISABLED = 'disabled:cursor-not-allowed disabled:opacity-60';\n\n/** Compose the input classes for a control. Omitting `size` — or passing the\n * default `md` — yields exactly `INPUT_BASE`, so every existing caller is\n * unaffected. */\nexport function inputClasses(opts?: { invalid?: boolean; size?: InputSize; className?: string }): string {\n const shape = opts?.size && opts.size !== 'md'\n ? `${INPUT_SHAPE_PRE} ${INPUT_SIZES[opts.size]} ${INPUT_SHAPE_POST}`\n : INPUT_BASE;\n return [shape, opts?.invalid ? INPUT_INVALID : '', INPUT_DISABLED, opts?.className ?? '']\n .filter(Boolean)\n .join(' ');\n}\n","/**\n * Input — a styled text `<input>`. A thin wrapper over the shared INPUT_BASE\n * look; it forwards its ref and spreads every native prop, so it drops into\n * `react-hook-form` via `register()` and works as a controlled or uncontrolled\n * field unchanged. Native dark-mode input styling applies automatically.\n */\nimport { forwardRef, type InputHTMLAttributes, type ReactNode } from 'react';\nimport { inputClasses, type InputSize } from './styles';\n\nexport interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'className' | 'size'> {\n /** Error state — red border + ring. */\n invalid?: boolean;\n /** Icon rendered inside the field's left edge (e.g. a search glyph). */\n leftIcon?: ReactNode;\n /** Content pinned to the field's right edge (e.g. a unit, a small action). */\n rightAdornment?: ReactNode;\n /**\n * `touch` gives a 56px field for a finger. Defaults to the desktop size.\n *\n * This shadows the native `size` attribute (a character count), which is\n * omitted above rather than left to collide — the width of a `w-full` field\n * has never come from that attribute here, so nothing loses a capability it\n * was using. Set `style`/`className` for width instead.\n */\n size?: InputSize;\n className?: string;\n}\n\nconst Input = forwardRef<HTMLInputElement, InputProps>(function Input(\n { invalid, leftIcon, rightAdornment, size, className = '', ...rest },\n ref,\n) {\n const pad = `${leftIcon ? 'pl-9' : ''} ${rightAdornment ? 'pr-9' : ''}`.trim();\n const field = (\n // `inputMode` needs no plumbing — it rides the native spread onto the\n // <input>, which is how a till sets inputMode=\"none\" to keep the OS\n // keyboard off the screen while its own keypad drives the field.\n <input\n ref={ref}\n\n aria-invalid={invalid || undefined}\n className={inputClasses({ invalid, size, className: [pad, className].filter(Boolean).join(' ') })}\n {...rest}\n />\n );\n\n if (!leftIcon && !rightAdornment) return field;\n return (\n <div className=\"relative\">\n {leftIcon && (\n <span className=\"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-gray-400\">{leftIcon}</span>\n )}\n {field}\n {rightAdornment && (\n <span className=\"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400\">{rightAdornment}</span>\n )}\n </div>\n );\n});\n\nexport default Input;\n","/**\n * Textarea — a styled multi-line `<textarea>`, same INPUT_BASE look as Input.\n * Forwards its ref and spreads native props (react-hook-form friendly). With\n * `autoGrow`, the field resizes to fit its content as the user types.\n */\nimport { forwardRef, useCallback, type FormEvent, type TextareaHTMLAttributes } from 'react';\nimport { inputClasses, type InputSize } from './styles';\n\nexport interface TextareaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'className'> {\n /** Error state — red border + ring. */\n invalid?: boolean;\n /** Grow the field to fit its content instead of scrolling. */\n autoGrow?: boolean;\n /** Desktop rung, or `touch`. Defaults to `md`. */\n size?: InputSize;\n className?: string;\n}\n\nconst Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(function Textarea(\n { invalid, autoGrow, className = '', onInput, rows = 3, size, ...rest },\n ref,\n) {\n const handleInput = useCallback((e: FormEvent<HTMLTextAreaElement>) => {\n if (autoGrow) {\n const el = e.currentTarget;\n el.style.height = 'auto';\n el.style.height = `${el.scrollHeight}px`;\n }\n onInput?.(e);\n }, [autoGrow, onInput]);\n\n return (\n <textarea\n ref={ref}\n\n aria-invalid={invalid || undefined}\n rows={rows}\n onInput={handleInput}\n className={inputClasses({ invalid, size, className: `${autoGrow ? 'resize-none overflow-hidden' : ''} ${className}`.trim() })}\n {...rest}\n />\n );\n});\n\nexport default Textarea;\n","/**\n * Pure keyboard-navigation helpers for the custom-listbox `<Select>`. Kept free\n * of React and the DOM so the option-traversal rules (skip disabled options,\n * clamp without wrapping, Home/End, letter typeahead) are unit-testable under\n * the repo's server-only test runner (`npm test`), which never mounts a DOM.\n *\n * The helpers take the minimal shape they need (`label` for typeahead,\n * `disabled` to skip), so they stay decoupled from `SelectOption`.\n */\n\nexport interface NavOption {\n label: string;\n disabled?: boolean;\n}\n\n// The helpers are generic over the option shape (they read only `label` and\n// `disabled`) so they accept a `SelectOption[]` — which also carries `value` —\n// without an excess-property complaint on inline option literals.\n\n/** First selectable option, or -1 when every option is disabled/empty. */\nexport function firstEnabledIndex<T extends NavOption>(options: readonly T[]): number {\n for (let i = 0; i < options.length; i++) {\n if (!options[i].disabled) return i;\n }\n return -1;\n}\n\n/** Last selectable option, or -1 when every option is disabled/empty. */\nexport function lastEnabledIndex<T extends NavOption>(options: readonly T[]): number {\n for (let i = options.length - 1; i >= 0; i--) {\n if (!options[i].disabled) return i;\n }\n return -1;\n}\n\n/**\n * Step one selectable option in `dir` (+1 = ArrowDown, -1 = ArrowUp) from\n * `from`, skipping disabled options and clamping at the ends (no wrap — matches\n * a native `<select>`'s arrow-key behaviour). `from = -1` means \"nothing active\n * yet\": stepping down lands on the first option, stepping up on the last.\n */\nexport function nextEnabledIndex<T extends NavOption>(options: readonly T[], from: number, dir: 1 | -1): number {\n let i = from + dir;\n while (i >= 0 && i < options.length) {\n if (!options[i].disabled) return i;\n i += dir;\n }\n // Ran off the end without finding one — keep the current option if it is\n // itself selectable, otherwise fall back to the nearest end in `dir`.\n if (from >= 0 && from < options.length && !options[from].disabled) return from;\n return dir > 0 ? firstEnabledIndex(options) : lastEnabledIndex(options);\n}\n\n/**\n * Letter typeahead: find the next selectable option whose label starts with\n * `buffer` (case-insensitive), scanning forward from just after `fromIndex` and\n * wrapping around. Returns -1 when nothing matches (or the buffer is empty).\n * Passing `fromIndex = -1` starts the scan at the first option.\n */\nexport function matchTypeahead<T extends NavOption>(options: readonly T[], buffer: string, fromIndex: number): number {\n const q = buffer.toLowerCase();\n const n = options.length;\n if (!q || n === 0) return -1;\n for (let step = 1; step <= n; step++) {\n const i = (((fromIndex + step) % n) + n) % n;\n const o = options[i];\n if (!o.disabled && o.label.toLowerCase().startsWith(q)) return i;\n }\n return -1;\n}\n","/**\n * Select — a form control for short, fixed option lists. Follows the kit's\n * controlled idiom (`value` + `onChange(value)`, not the raw event, matching\n * SearchableSelect).\n *\n * On DESKTOP this renders a custom listbox: a trigger button plus a\n * body-portaled option list (same portal/positioning reasoning as\n * SearchableSelect and PopupMenu). A native `<select>` on desktop opens an OS\n * popup that grabs every key event while it is open — so page/window hotkeys\n * die until it closes (BG#00421). The custom listbox keeps key events flowing\n * to the app, so hotkeys keep working, and adds full keyboard support\n * (Arrow/Home/End/Enter/Space/typeahead) with combobox/listbox ARIA.\n *\n * On MOBILE (touch) this renders the native `<select>` — the OS wheel/sheet\n * picker is the better touch affordance and hotkeys are irrelevant there. The\n * native element is also where the forwarded `HTMLSelectElement` ref and any\n * spread native attributes land, so `NativeSelect` is exported for callers that\n * need a raw native control on every viewport.\n *\n * Use SearchableSelect instead when the list is long or needs type-to-filter /\n * free-text entry; use Select for a handful of known options.\n */\nimport {\n forwardRef, useCallback, useEffect, useId, useLayoutEffect, useRef, useState,\n type KeyboardEvent as ReactKeyboardEvent, type SelectHTMLAttributes,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { inputClasses, type InputSize } from './styles';\nimport { firstEnabledIndex, lastEnabledIndex, matchTypeahead, nextEnabledIndex } from './selectNav';\nimport { glassStyle } from '../utils/glass';\nimport { useIsMobile } from '../shell/useIsMobile';\nimport { registerModalEscapeInterceptor } from '../shell/escapeInterceptors';\n\nexport interface SelectOption {\n value: string;\n label: string;\n disabled?: boolean;\n}\n\nexport interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, 'onChange' | 'value' | 'className' | 'size'> {\n value: string;\n onChange: (value: string) => void;\n /**\n * Desktop rung, or `touch`. Defaults to `md`.\n *\n * This shadows the native `size` attribute (the number of rows a select\n * shows when it is rendered as a list box), which is omitted above rather\n * than left to collide. Nothing here has ever rendered as a list box — the\n * kit's Select is a dropdown — so no capability is lost.\n */\n size?: InputSize;\n options: SelectOption[];\n /** Shown as a disabled first option when no value is selected. */\n placeholder?: string;\n invalid?: boolean;\n className?: string;\n}\n\n/** Gap between the trigger and the popup, and the viewport safety margin. */\nconst MENU_GAP = 4;\nconst VIEWPORT_MARGIN = 8;\nconst MENU_MAX_HEIGHT = 240;\n\n/**\n * Raw native `<select>` styled to match the kit's inputs. This is the original\n * Select — kept as the mobile rendering and exported for callers that need a\n * real `HTMLSelectElement` (form posts, native attribute spread, focus).\n */\nexport const NativeSelect = forwardRef<HTMLSelectElement, SelectProps>(function NativeSelect(\n { value, onChange, options, placeholder, invalid, className = '', size, ...rest },\n ref,\n) {\n return (\n <select\n ref={ref}\n value={value}\n onChange={e => onChange(e.target.value)}\n aria-invalid={invalid || undefined}\n className={inputClasses({ invalid, size, className: `pr-8 ${className}`.trim() })}\n {...rest}\n >\n {placeholder !== undefined && (\n <option value=\"\" disabled>{placeholder}</option>\n )}\n {options.map(o => (\n <option key={o.value} value={o.value} disabled={o.disabled}>{o.label}</option>\n ))}\n </select>\n );\n});\n\n/**\n * Track the popup's fixed-viewport position from the trigger rect while open,\n * re-running on scroll (capture, so nested form-scroll containers count),\n * resize, and every animation frame the trigger moves (a shell window drag\n * moves it via an ancestor transform, which fires neither scroll nor resize).\n * Anchors below the trigger, flips above when below is cramped. Mirrors\n * SearchableSelect's `useDropdownPosition`.\n */\ninterface MenuPos { left: number; top?: number; bottom?: number; minWidth: number; maxHeight: number }\nfunction useAnchoredPosition(triggerRef: React.RefObject<HTMLElement | null>, open: boolean): MenuPos | null {\n const [pos, setPos] = useState<MenuPos | null>(null);\n useLayoutEffect(() => {\n if (!open) { setPos(null); return; }\n let lastLeft = NaN, lastTop = NaN, lastBottom = NaN;\n const compute = () => {\n const rect = triggerRef.current?.getBoundingClientRect();\n if (!rect) return;\n lastLeft = rect.left; lastTop = rect.top; lastBottom = rect.bottom;\n const spaceBelow = window.innerHeight - rect.bottom - MENU_GAP - VIEWPORT_MARGIN;\n const spaceAbove = rect.top - MENU_GAP - VIEWPORT_MARGIN;\n const placeAbove = spaceBelow < Math.min(MENU_MAX_HEIGHT, 160) && spaceAbove > spaceBelow;\n const maxHeight = Math.max(96, Math.min(MENU_MAX_HEIGHT, placeAbove ? spaceAbove : spaceBelow));\n const left = Math.max(VIEWPORT_MARGIN, Math.min(rect.left, window.innerWidth - rect.width - VIEWPORT_MARGIN));\n const next: MenuPos = { left, minWidth: rect.width, maxHeight };\n if (placeAbove) next.bottom = window.innerHeight - rect.top + MENU_GAP;\n else next.top = rect.bottom + MENU_GAP;\n setPos(next);\n };\n compute();\n let raf = requestAnimationFrame(function tick() {\n const rect = triggerRef.current?.getBoundingClientRect();\n if (rect && (rect.left !== lastLeft || rect.top !== lastTop || rect.bottom !== lastBottom)) compute();\n raf = requestAnimationFrame(tick);\n });\n window.addEventListener('scroll', compute, true);\n window.addEventListener('resize', compute);\n return () => {\n cancelAnimationFrame(raf);\n window.removeEventListener('scroll', compute, true);\n window.removeEventListener('resize', compute);\n };\n }, [open, triggerRef]);\n return pos;\n}\n\n/** Desktop custom listbox. Keeps DOM focus on the trigger and tracks the active\n * option with `aria-activedescendant` (the standard combobox pattern). */\nconst ListboxSelect = forwardRef<HTMLSelectElement, SelectProps>(function ListboxSelect(\n { value, onChange, options, placeholder, invalid, className = '', id, disabled, size,\n 'aria-describedby': describedBy, 'aria-label': ariaLabel, 'aria-labelledby': labelledBy, ...rest },\n ref,\n) {\n const [open, setOpen] = useState(false);\n const [active, setActive] = useState(-1);\n const wrapRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const listRef = useRef<HTMLDivElement>(null);\n const openRef = useRef(open);\n openRef.current = open;\n const typeahead = useRef<{ buffer: string; timer: ReturnType<typeof setTimeout> | null }>({ buffer: '', timer: null });\n\n const baseId = useId();\n const listboxId = `${baseId}-listbox`;\n const optionId = (i: number) => `${baseId}-opt-${i}`;\n\n const menuPos = useAnchoredPosition(triggerRef, open);\n const selectedIndex = options.findIndex(o => o.value === value);\n const selectedLabel = selectedIndex >= 0 ? options[selectedIndex].label : undefined;\n\n const close = useCallback((refocus = true) => {\n setOpen(false);\n setActive(-1);\n if (refocus) triggerRef.current?.focus();\n }, []);\n\n const openList = useCallback(() => {\n if (disabled) return;\n setActive(selectedIndex >= 0 ? selectedIndex : firstEnabledIndex(options));\n setOpen(true);\n }, [disabled, options, selectedIndex]);\n\n const commit = useCallback((i: number) => {\n const o = options[i];\n if (!o || o.disabled) return;\n onChange(o.value);\n close();\n }, [options, onChange, close]);\n\n // Esc closes the listbox first, WITHOUT closing any parent modal/window.\n // Modal's Escape handler runs on window in the CAPTURE phase, so it beats the\n // trigger's own (bubble-phase) onKeyDown — the only way to close the listbox\n // ahead of the modal is the shell's own interceptor seam, which the modal\n // consults before closing. The local onKeyDown below still handles Esc when\n // there is no modal in play (a plain page).\n useEffect(() => {\n if (!open) return;\n const unregister = registerModalEscapeInterceptor(e => {\n if (e.key !== 'Escape' || !openRef.current) return false;\n close();\n return true;\n });\n return unregister;\n }, [open, close]);\n\n // Close on outside pointer-down. The list is portaled to <body> (outside\n // wrapRef), so a click inside EITHER the trigger wrap or the portaled list\n // counts as inside.\n useEffect(() => {\n if (!open) return;\n const handler = (e: PointerEvent) => {\n const t = e.target as Node;\n if (wrapRef.current?.contains(t) || listRef.current?.contains(t)) return;\n close(false);\n };\n document.addEventListener('pointerdown', handler);\n return () => document.removeEventListener('pointerdown', handler);\n }, [open, close]);\n\n // Keep the active option scrolled into view as it moves.\n useEffect(() => {\n if (!open || active < 0) return;\n listRef.current?.querySelector<HTMLElement>(`#${CSS.escape(optionId(active))}`)?.scrollIntoView({ block: 'nearest' });\n });\n\n const runTypeahead = useCallback((char: string) => {\n const ta = typeahead.current;\n if (ta.timer) clearTimeout(ta.timer);\n ta.buffer += char;\n ta.timer = setTimeout(() => { ta.buffer = ''; ta.timer = null; }, 500);\n const from = open ? active : selectedIndex;\n const hit = matchTypeahead(options, ta.buffer, from);\n if (hit < 0) return;\n if (open) setActive(hit);\n else commit(hit);\n }, [open, active, selectedIndex, options, commit]);\n\n const onKeyDown = (e: ReactKeyboardEvent<HTMLButtonElement>) => {\n if (disabled) return;\n switch (e.key) {\n case 'ArrowDown':\n e.preventDefault();\n if (!open) openList();\n else setActive(a => nextEnabledIndex(options, a, 1));\n return;\n case 'ArrowUp':\n e.preventDefault();\n if (!open) openList();\n else setActive(a => nextEnabledIndex(options, a, -1));\n return;\n case 'Home':\n if (open) { e.preventDefault(); setActive(firstEnabledIndex(options)); }\n return;\n case 'End':\n if (open) { e.preventDefault(); setActive(lastEnabledIndex(options)); }\n return;\n case 'Enter':\n if (open) { e.preventDefault(); commit(active); }\n return;\n case ' ':\n // Space opens the list, or selects the active option once open.\n e.preventDefault();\n if (!open) openList();\n else commit(active);\n return;\n case 'Escape':\n if (open) { e.preventDefault(); e.stopPropagation(); close(); }\n return;\n case 'Tab':\n if (open) close(false); // no preventDefault — let focus advance\n return;\n default:\n if (e.key.length === 1 && !e.metaKey && !e.ctrlKey && !e.altKey) {\n e.preventDefault();\n runTypeahead(e.key);\n }\n }\n };\n\n return (\n <div ref={wrapRef} className=\"relative\">\n <button\n ref={triggerRef}\n id={id}\n type=\"button\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-expanded={open}\n aria-controls={open ? listboxId : undefined}\n aria-activedescendant={open && active >= 0 ? optionId(active) : undefined}\n aria-invalid={invalid || undefined}\n // These describe the CONTROL, and the control the user focuses is this\n // button — not the sr-only <select> behind it, which is where the\n // spread was putting them. An error message pointed at by a hidden\n // element is announced to nobody.\n aria-describedby={describedBy}\n aria-label={ariaLabel}\n aria-labelledby={labelledBy}\n disabled={disabled}\n onClick={() => (open ? close() : openList())}\n onKeyDown={onKeyDown}\n className={inputClasses({ invalid, size, className: `pr-8 text-left ${className}`.trim() })}\n >\n <span className={`block truncate ${selectedLabel === undefined ? 'text-gray-400' : ''}`}>\n {selectedLabel ?? placeholder ?? ' '}\n </span>\n </button>\n <svg\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute right-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400\"\n fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" strokeWidth={2}\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M8.25 9l3.75-3.75L15.75 9M8.25 15l3.75 3.75L15.75 15\" />\n </svg>\n\n {/* Hidden native <select> carries the forwarded HTMLSelectElement ref and\n any spread native attributes (name, required, form posts…) so the\n public API stays honoured; it is not a tab stop and is hidden from AT. */}\n <select\n ref={ref}\n value={value}\n onChange={e => onChange(e.target.value)}\n disabled={disabled}\n aria-hidden=\"true\"\n tabIndex={-1}\n className=\"sr-only\"\n {...rest}\n >\n {placeholder !== undefined && <option value=\"\" disabled>{placeholder}</option>}\n {options.map(o => (\n <option key={o.value} value={o.value} disabled={o.disabled}>{o.label}</option>\n ))}\n </select>\n\n {open && createPortal(\n <div\n ref={listRef}\n id={listboxId}\n role=\"listbox\"\n className=\"fixed z-[400] overflow-y-auto rounded-2xl py-1\"\n style={{\n left: menuPos?.left,\n top: menuPos?.top,\n bottom: menuPos?.bottom,\n minWidth: menuPos?.minWidth,\n maxHeight: menuPos?.maxHeight ?? MENU_MAX_HEIGHT,\n visibility: menuPos ? undefined : 'hidden',\n ...glassStyle(),\n }}\n >\n {options.map((o, i) => (\n <div\n key={o.value}\n id={optionId(i)}\n role=\"option\"\n aria-selected={value === o.value}\n aria-disabled={o.disabled || undefined}\n onPointerEnter={() => { if (!o.disabled) setActive(i); }}\n onClick={() => commit(i)}\n className={`mx-1 cursor-pointer truncate rounded-lg px-3 py-1.5 text-sm\n ${o.disabled ? 'cursor-not-allowed text-gray-400'\n : i === active ? 'bg-blue-50 text-blue-700'\n : value === o.value ? 'font-medium text-blue-600'\n : 'text-gray-700'}`}\n >\n {o.label}\n </div>\n ))}\n </div>,\n document.body,\n )}\n </div>\n );\n});\n\n/** Smart Select: native `<select>` on touch, custom listbox on desktop. */\nconst Select = forwardRef<HTMLSelectElement, SelectProps>(function Select(props, ref) {\n const isMobile = useIsMobile();\n return isMobile ? <NativeSelect ref={ref} {...props} /> : <ListboxSelect ref={ref} {...props} />;\n});\n\nexport default Select;\n","/**\n * Checkbox — a styled native checkbox. Controlled via `checked` +\n * `onChange(checked)` (boolean, not the event — the kit idiom). When `label`\n * or `description` is given it renders inside a clickable `<label>` row.\n *\n * Uses `accent-blue-600`, which the theme system points at the active accent,\n * so the check fill follows the user's accent in both light and dark mode.\n */\nimport { forwardRef, useCallback, useEffect, useRef, type InputHTMLAttributes, type ReactNode } from 'react';\n\nexport interface CheckboxProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'onChange' | 'checked' | 'className'> {\n checked: boolean;\n onChange: (checked: boolean) => void;\n /**\n * Neither checked nor unchecked — the \"some of the rows below are selected\"\n * state on a select-all box.\n *\n * It has to be a prop because it cannot be an attribute: `indeterminate`\n * exists only as a DOM property, so passing it through JSX sets a bogus\n * attribute, logs \"Received `true` for a non-boolean attribute\", and leaves\n * the box looking unchecked. Set here through a ref instead.\n *\n * A native checkbox in this state reports itself as `mixed` to assistive\n * technology on its own, so no `aria-checked` is added — writing one would\n * risk contradicting the element.\n */\n indeterminate?: boolean;\n label?: ReactNode;\n description?: ReactNode;\n className?: string;\n}\n\nconst BOX =\n 'h-4 w-4 shrink-0 rounded border-gray-300 accent-blue-600 focus:outline-none ' +\n 'focus:ring-2 focus:ring-blue-400/30 disabled:cursor-not-allowed disabled:opacity-60';\n\nconst Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(function Checkbox(\n { checked, onChange, indeterminate = false, label, description, disabled, className = '', ...rest },\n ref,\n) {\n const inner = useRef<HTMLInputElement | null>(null);\n\n // `checked` is in the deps as well: React writes it on every render, and a\n // browser clears `indeterminate` whenever the checked state is assigned. So\n // this has to run after that, not only when `indeterminate` itself changes.\n useEffect(() => {\n if (inner.current) inner.current.indeterminate = indeterminate;\n }, [indeterminate, checked]);\n\n // The caller's ref still has to work — it is how a form library focuses the\n // field — so both are set.\n //\n // Memoised on `ref`: React detaches and reattaches a callback ref whenever\n // its identity changes, so a fresh closure each render meant the caller's ref\n // was handed `null` and then the node again on EVERY render, unrelated to\n // anything it cares about. Stable identity means it is called when the\n // element actually changes and not otherwise.\n const attachRef = useCallback((node: HTMLInputElement | null) => {\n inner.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) ref.current = node;\n }, [ref]);\n\n const input = (extra = '') => (\n <input\n ref={attachRef}\n type=\"checkbox\"\n checked={checked}\n disabled={disabled}\n onChange={e => onChange(e.target.checked)}\n className={`${BOX} ${extra}`.trim()}\n {...rest}\n />\n );\n\n if (!label && !description) {\n return input(className);\n }\n return (\n <label className={`flex items-start gap-2 ${disabled ? 'cursor-not-allowed opacity-60' : 'cursor-pointer'} ${className}`.trim()}>\n {input('mt-0.5')}\n <span className=\"text-sm leading-tight\">\n {label && <span className=\"font-medium text-gray-700\">{label}</span>}\n {description && <span className=\"mt-0.5 block text-xs text-gray-500\">{description}</span>}\n </span>\n </label>\n );\n});\n\nexport default Checkbox;\n","/**\n * Radio — a styled native radio button. Group several by sharing the same\n * `name`; each is controlled via `checked` + `onChange(checked)` (fires when\n * this option becomes selected). Mirrors Checkbox; uses the accent fill.\n */\nimport { forwardRef, type InputHTMLAttributes, type ReactNode } from 'react';\n\nexport interface RadioProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'onChange' | 'checked' | 'className'> {\n checked: boolean;\n onChange: (checked: boolean) => void;\n label?: ReactNode;\n description?: ReactNode;\n className?: string;\n}\n\nconst DOT =\n 'h-4 w-4 shrink-0 border-gray-300 accent-blue-600 focus:outline-none ' +\n 'focus:ring-2 focus:ring-blue-400/30 disabled:cursor-not-allowed disabled:opacity-60';\n\nconst Radio = forwardRef<HTMLInputElement, RadioProps>(function Radio(\n { checked, onChange, label, description, disabled, className = '', ...rest },\n ref,\n) {\n if (!label && !description) {\n return (\n <input\n ref={ref}\n type=\"radio\"\n checked={checked}\n disabled={disabled}\n onChange={e => onChange(e.target.checked)}\n className={`${DOT} ${className}`.trim()}\n {...rest}\n />\n );\n }\n return (\n <label className={`flex items-start gap-2 ${disabled ? 'cursor-not-allowed opacity-60' : 'cursor-pointer'} ${className}`.trim()}>\n <input\n ref={ref}\n type=\"radio\"\n checked={checked}\n disabled={disabled}\n onChange={e => onChange(e.target.checked)}\n className={`${DOT} mt-0.5`}\n {...rest}\n />\n <span className=\"text-sm leading-tight\">\n {label && <span className=\"font-medium text-gray-700\">{label}</span>}\n {description && <span className=\"mt-0.5 block text-xs text-gray-500\">{description}</span>}\n </span>\n </label>\n );\n});\n\nexport default Radio;\n","/**\n * FormField — label + control + hint/error wrapper. The standard row for every\n * form in the kit: pass a control as `children`, a `label` (wired to it via\n * `htmlFor`), and either a `hint` (greyed helper) or an `error` (red, takes\n * precedence). Promotes the `Field` helper the demos used inline.\n */\nimport { type ReactNode } from 'react';\n\nexport interface FormFieldProps {\n label?: ReactNode;\n /** id of the control, for label-for wiring. */\n htmlFor?: string;\n /** id for the `<label>` element itself, so a non-labelable control (e.g. a\n * `role=\"group\"` wrapper) can name itself via `aria-labelledby`. */\n labelId?: string;\n /** Greyed helper text below the control. */\n hint?: ReactNode;\n /** Red error text below the control — overrides `hint` when present. */\n error?: ReactNode;\n /** Append a red asterisk to the label. */\n required?: boolean;\n className?: string;\n children: ReactNode;\n}\n\nexport default function FormField({\n label, htmlFor, labelId, hint, error, required, className = '', children,\n}: FormFieldProps) {\n return (\n <div className={className}>\n {label && (\n <label id={labelId} htmlFor={htmlFor} className=\"mb-1 block text-xs font-medium text-gray-600\">\n {label}\n {/* Decoration. `required` on the control is what assistive\n technology reads; exposed here it becomes part of the label —\n \"Company name star\" — on every required field of every form. */}\n {required && <span aria-hidden=\"true\" className=\"ml-0.5 text-red-500\">*</span>}\n </label>\n )}\n {children}\n {error ? (\n // A validation message appears after the user submits, without focus\n // moving to it. Without a live region it reaches nobody — and this is\n // the one status message a form cannot afford to lose.\n <p\n id={htmlFor ? `${htmlFor}-error` : undefined}\n role=\"alert\"\n className=\"mt-1 text-[11px] text-red-600\"\n >\n {error}\n </p>\n ) : hint ? (\n <p id={htmlFor ? `${htmlFor}-hint` : undefined} className=\"mt-1 text-[11px] text-gray-400\">{hint}</p>\n ) : null}\n </div>\n );\n}\n","/**\n * Label — standalone field label in the kit's style, for the rare case where\n * FormField's all-in-one wrapper isn't wanted. Most forms should use FormField.\n */\nimport { type LabelHTMLAttributes } from 'react';\n\nexport interface LabelProps extends LabelHTMLAttributes<HTMLLabelElement> {\n /** Append a red asterisk. */\n required?: boolean;\n}\n\nexport default function Label({ required, children, className = '', ...rest }: LabelProps) {\n return (\n <label className={`mb-1 block text-xs font-medium text-gray-600 ${className}`.trim()} {...rest}>\n {children}\n {required && <span className=\"ml-0.5 text-red-500\">*</span>}\n </label>\n );\n}\n","/**\n * Internal helpers shared by the media-upload primitives (`MediaUploadField`\n * single slot + `MediaUploadGrid` gallery) so the filename derivation, the\n * image-vs-video test, and the upload glyph / spinner live in one place (DRY /\n * SSoT). Not part of the public API except `mediaFileName`, which the field\n * re-exports.\n */\n\n/** `data:image/svg+xml;base64,…` → captures the `image` type and `svg+xml` subtype. */\nconst DATA_URL_RE = /^data:([a-z0-9!#$&^_.+-]+)\\/([a-z0-9!#$&^_.+-]+)/i;\n\n/**\n * Name a `data:` URL from its media type alone, never its payload.\n *\n * A data URL carries no path, so the generic derivation below would slice at\n * the `/` inside the media type and hand back the whole base64 body as the\n * \"filename\" — hundreds of kilobytes, straight into an `alt` attribute.\n *\n * \"data:image/png;base64,iVBORw0KGgo…\" → \"image.png\"\n * \"data:image/svg+xml;base64,PHN2Zy…\" → \"image.svg\"\n * \"data:image/vnd.microsoft.icon;base64,…\" → \"image.icon\"\n * \"data:,hello\" (no media type) → \"media\"\n */\nfunction dataUrlName(url: string): string {\n const m = DATA_URL_RE.exec(url);\n if (!m) return 'media';\n const [, type, subtype] = m;\n // `svg+xml` → `svg` (drop the structured-syntax suffix), then take the last\n // dot-segment of a tree'd subtype (`vnd.microsoft.icon` → `icon`) and shed a\n // vendor/experimental `x-` prefix (`x-icon` → `icon`).\n const ext = subtype.split('+')[0].split('.').pop()!.replace(/^x-/i, '');\n return ext ? `${type.toLowerCase()}.${ext.toLowerCase()}` : 'media';\n}\n\n/**\n * Derive a human filename from a media URL: drop the query string, strip a\n * 32-hex upload prefix, and URL-decode.\n *\n * \"/media/uploads/9f3…a1_My Clip.mp4?v=2\" → \"My Clip.mp4\"\n *\n * `data:` URLs have no path, so they are named from their media type instead\n * — see `dataUrlName`.\n */\nexport function mediaFileName(url: string): string {\n if (/^data:/i.test(url || '')) return dataUrlName(url);\n const path = (url || '').split('?')[0].split('#')[0];\n const last = path.substring(path.lastIndexOf('/') + 1);\n try {\n return decodeURIComponent(last.replace(/^[0-9a-f]{32}_/i, '')) || last || 'media';\n } catch {\n return last || 'media';\n }\n}\n\nconst VIDEO_EXT_RE = /\\.(mp4|webm|ogg|ogv|mov|m4v)(\\?|#|$)/i;\n\n/**\n * Best-effort image-vs-video guess for a preview: media type for a `data:`\n * URL, then extension, then the `accept` string when it is video-only. Callers\n * that mint extensionless blob URLs (the native fallback) track the MIME\n * themselves and OR it in.\n */\nexport function isVideoUrl(url: string | null | undefined, accept = ''): boolean {\n if (!url) return false;\n // A data URL states its kind in the media type and never carries an\n // extension, so `VIDEO_EXT_RE` can't match one — `data:video/mp4;base64,…`\n // would previously fall through and preview as a broken `<img>`. When the\n // type is present it is authoritative: an `image/*` data URL is not a video\n // even in a video-only picker. A typeless `data:,…` has nothing to go on and\n // falls through to the guess below.\n const data = DATA_URL_RE.exec(url);\n if (data) return data[1].toLowerCase() === 'video';\n const acceptsVideo = accept.includes('video');\n const acceptsImage = accept.includes('image') || accept === '*' || accept === '';\n return VIDEO_EXT_RE.test(url) || (acceptsVideo && !acceptsImage);\n}\n\n/** Spinner matching the kit's Button spinner — muted grey, `currentColor` fill. */\nexport function Spinner({ className = 'h-5 w-5' }: { className?: string }) {\n return (\n <svg className={`${className} animate-spin text-gray-400`} viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <circle className=\"opacity-25\" cx=\"12\" cy=\"12\" r=\"10\" stroke=\"currentColor\" strokeWidth=\"4\" />\n <path className=\"opacity-75\" fill=\"currentColor\" d=\"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z\" />\n </svg>\n );\n}\n\n/** Upload-arrow glyph — inherits colour, matching the kit's line-icon style. */\nexport function UploadGlyph({ className = 'h-6 w-6' }: { className?: string }) {\n return (\n <svg\n viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={1.6}\n strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\" className={className}\n >\n <path d=\"M12 15V4\" />\n <path d=\"M8 8l4-4 4 4\" />\n <path d=\"M4 15v3a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-3\" />\n </svg>\n );\n}\n","/**\n * MediaUploadField — the kit's standard \"choose a media asset\" control, and the\n * server-wide pattern for image / video slots across the EFFICIENT portals.\n *\n * Empty state: a dashed dropzone with an upload glyph, a dim prompt line, and a\n * link-style CTA (\"Choose from library or upload\"). Filled state: a preview\n * (image or video) with an optional filename badge and Replace / Remove actions.\n * Both states accept a dragged file.\n *\n * Presentational and controlled the kit way (`value` URL + `onChange(url)`), it\n * owns NO picker modal and NO upload/fetch — each portal has its own media\n * library and upload endpoint. Inject that via `onPick`: it fires on click and\n * on drop (with the dropped File, so the consumer can seed an immediate upload),\n * and the consumer resolves the selection back through `onChange`. With `onPick`\n * omitted the field falls back to a hidden native `<input type=file>` and emits\n * an object-URL — handy for demos and staged-then-submit forms (the field owns\n * that blob URL's lifetime and revokes it on replace / remove / unmount).\n *\n * This is deliberately the SINGLE-slot field. Thumbnail grids, reorderable\n * zones, and attachment lists change for different reasons (SRP) and belong to a\n * sibling gallery primitive, not here.\n */\nimport { useEffect, useId, useRef, useState, type ChangeEvent, type DragEvent, type ReactNode } from 'react';\nimport Button from './Button';\nimport FormField from './FormField';\nimport { isVideoUrl, mediaFileName, Spinner, UploadGlyph } from './mediaShared';\n\nexport interface MediaUploadFieldProps {\n /** The current media URL. Empty string (or null/undefined) = the CTA state. */\n value?: string | null;\n /** Controlled channel — the newly-chosen URL, or `''` when cleared (Remove). */\n onChange: (url: string) => void;\n /**\n * Open the consumer's library/upload picker. Fires on click and on drop; the\n * dropped File (if any) is passed so the consumer can seed an immediate\n * upload. The consumer resolves the selection back through `onChange`.\n * Omit to fall back to a hidden native `<input type=file>` that emits an\n * object-URL (demos, staged-then-submit forms).\n */\n onPick?: (droppedFile?: File) => void;\n\n // ── Field chrome (delegates to the shell FormField) ──\n /** Label rendered above the control. */\n label?: ReactNode;\n /** Greyed helper line below the control. */\n hint?: ReactNode;\n /** Red error line — overrides `hint`. */\n error?: ReactNode;\n /** Append a red asterisk to the label. */\n required?: boolean;\n className?: string;\n\n // ── Media ──\n /**\n * Native `accept` string. Drives the preview kind (image vs video), the\n * fallback file dialog, and the default empty-state copy. Default `image/*`.\n */\n accept?: string;\n /** `object-fit` for the preview. Default `cover`; use `contain` for logos/SVG. */\n fit?: 'cover' | 'contain';\n /** Preview / dropzone height in px (applied via inline style). Default 112. */\n height?: number;\n\n // ── Empty-state copy (the target design's three lines) ──\n /** Dim prompt line, e.g. \"Upload a background video\". Default derived from `accept`. */\n placeholder?: ReactNode;\n /** The link-style CTA line. Default \"Choose from library or upload\". */\n cta?: ReactNode;\n /** Small kind hint under the CTA, e.g. \"PNG · JPG · WEBP\". */\n acceptHint?: ReactNode;\n\n // ── Filled-state controls ──\n /** Overlay the derived filename on the preview. Default true. */\n showFilename?: boolean;\n /** Show the Replace button when filled. Default true. */\n allowReplace?: boolean;\n /** Show the Remove button when filled. Default true. */\n allowRemove?: boolean;\n /** Relabel Replace, e.g. \"Change\". Default \"Replace\". */\n replaceLabel?: ReactNode;\n /** Relabel Remove, e.g. \"Clear\". Default \"Remove\". */\n removeLabel?: ReactNode;\n\n // ── State ──\n /** Busy: disable controls and show a spinner while the caller's upload runs. */\n busy?: boolean;\n /** Busy label. Default \"Uploading…\". */\n busyLabel?: ReactNode;\n /** Fully disable the control (no click, no drop, no actions). */\n disabled?: boolean;\n}\n\n/** Re-exported from the shared media helpers so `import { mediaFileName }` from\n * this module (and the package root) keeps working. */\nexport { mediaFileName } from './mediaShared';\n\nexport default function MediaUploadField({\n value,\n onChange,\n onPick,\n label,\n hint,\n error,\n required,\n className,\n accept = 'image/*',\n fit = 'cover',\n height = 112,\n placeholder,\n cta = 'Choose from library or upload',\n acceptHint,\n showFilename = true,\n allowReplace = true,\n allowRemove = true,\n replaceLabel = 'Replace',\n removeLabel = 'Remove',\n busy = false,\n busyLabel = 'Uploading…',\n disabled = false,\n}: MediaUploadFieldProps) {\n const inputRef = useRef<HTMLInputElement>(null);\n const [dragOver, setDragOver] = useState(false);\n // Own focus ring drawn inline: the kit's shipped stylesheet doesn't include\n // the Tailwind `focus:ring` machinery, so `focus:ring-*` classes paint\n // nothing. An inline box-shadow on focus is the reliable, theme-safe way to\n // keep the dropzone's focus visible (WCAG 2.4.7).\n const [focused, setFocused] = useState(false);\n const fieldId = useId();\n\n // The blob URL the native fallback minted (if any) and whether it is a video.\n // We own its lifetime: revoke the previous one whenever we replace it, and on\n // unmount, so the fallback path doesn't leak object URLs.\n const objectUrlRef = useRef<string | null>(null);\n const [videoBlobUrl, setVideoBlobUrl] = useState<string | null>(null);\n useEffect(() => () => {\n if (objectUrlRef.current) URL.revokeObjectURL(objectUrlRef.current);\n }, []);\n\n const locked = disabled || busy;\n const acceptsVideo = accept.includes('video');\n const acceptsImage = accept.includes('image') || accept === '*' || accept === '';\n // Extension first; then the MIME captured for an extensionless blob; then the\n // accept-kind heuristic. The blob check is what makes video preview correct in\n // the native fallback where the URL carries no extension.\n const isVideo = !!value && (isVideoUrl(value, accept) || value === videoBlobUrl);\n const kindWord = acceptsVideo && !acceptsImage ? 'video' : acceptsImage && !acceptsVideo ? 'image' : 'file';\n const dimLine = placeholder ?? `Upload ${kindWord === 'image' ? 'an image' : `a ${kindWord}`}`;\n\n /** Mint an object URL for the fallback path, revoking the previous one. */\n const emitObjectUrl = (file: File) => {\n if (objectUrlRef.current) URL.revokeObjectURL(objectUrlRef.current);\n const url = URL.createObjectURL(file);\n objectUrlRef.current = url;\n setVideoBlobUrl(file.type.startsWith('video/') ? url : null);\n onChange(url);\n };\n\n const clearValue = () => {\n if (objectUrlRef.current) {\n URL.revokeObjectURL(objectUrlRef.current);\n objectUrlRef.current = null;\n }\n setVideoBlobUrl(null);\n onChange('');\n };\n\n /** Open the injected picker, or fall back to the native file dialog / dropped file. */\n const pick = (file?: File | null) => {\n if (locked) return;\n if (onPick) {\n onPick(file ?? undefined);\n return;\n }\n if (file) {\n emitObjectUrl(file);\n return;\n }\n inputRef.current?.click();\n };\n\n const onNativeFile = (e: ChangeEvent<HTMLInputElement>) => {\n const file = e.target.files?.[0];\n if (file) emitObjectUrl(file);\n if (inputRef.current) inputRef.current.value = '';\n };\n\n // Drag-drop handlers, shared by the empty dropzone AND the filled preview so\n // drag-to-replace works. A drop with no file (dragged text/URL) is a no-op —\n // it never falls through to opening the native dialog.\n const dropHandlers = locked\n ? {}\n : {\n onDragOver: (e: DragEvent) => {\n e.preventDefault();\n setDragOver(true);\n },\n onDragLeave: () => setDragOver(false),\n onDrop: (e: DragEvent) => {\n e.preventDefault();\n setDragOver(false);\n const file = e.dataTransfer.files?.[0];\n if (file) pick(file);\n },\n };\n\n const previewName = value ? mediaFileName(value) : '';\n\n const filled = (\n <div>\n <div\n {...dropHandlers}\n className={[\n 'relative overflow-hidden rounded-md border bg-gray-100 transition-colors',\n dragOver ? 'border-blue-500' : 'border-gray-200',\n ].join(' ')}\n style={{ height }}\n >\n {isVideo ? (\n <video\n src={value ?? undefined}\n muted\n playsInline\n preload=\"metadata\"\n aria-label={previewName || undefined}\n className=\"h-full w-full\"\n style={{ objectFit: fit }}\n />\n ) : (\n <img src={value ?? undefined} alt={previewName} className=\"h-full w-full\" style={{ objectFit: fit }} />\n )}\n {showFilename && value && (\n <span\n className=\"absolute inset-x-1 bottom-1 truncate rounded px-1.5 py-0.5 text-xs text-white\"\n style={{ background: 'rgba(0,0,0,0.6)' }}\n >\n {previewName}\n </span>\n )}\n {busy && (\n <div\n role=\"status\"\n className=\"absolute inset-0 flex items-center justify-center gap-2\"\n style={{ background: 'rgba(255,255,255,0.6)' }}\n >\n <Spinner />\n <span className=\"text-xs font-medium text-gray-600\">{busyLabel}</span>\n </div>\n )}\n </div>\n {!disabled && (allowReplace || allowRemove) && (\n <div className=\"mt-2 flex gap-2\">\n {allowReplace && (\n <Button id={fieldId} variant=\"secondary\" size=\"sm\" onClick={() => pick()} disabled={busy}>\n {replaceLabel}\n </Button>\n )}\n {allowRemove && (\n <Button variant=\"ghost\" size=\"sm\" onClick={clearValue} disabled={busy}>\n {removeLabel}\n </Button>\n )}\n </div>\n )}\n </div>\n );\n\n const empty = (\n <button\n type=\"button\"\n id={fieldId}\n onClick={() => pick()}\n disabled={locked}\n aria-label={typeof dimLine === 'string' ? dimLine : 'Upload media'}\n aria-busy={busy || undefined}\n aria-invalid={error ? true : undefined}\n aria-required={required || undefined}\n aria-describedby={error ? `${fieldId}-error` : hint ? `${fieldId}-hint` : undefined}\n onFocus={() => setFocused(true)}\n onBlur={() => setFocused(false)}\n {...dropHandlers}\n className={[\n 'flex w-full flex-col items-center justify-center gap-1.5 rounded-lg border-2 border-dashed text-center transition-colors',\n locked ? 'cursor-not-allowed opacity-60' : 'cursor-pointer',\n dragOver ? 'border-blue-500 bg-blue-50' : 'border-gray-300 bg-gray-50 hover:bg-gray-100',\n ].join(' ')}\n style={{\n minHeight: height,\n outline: 'none',\n boxShadow: focused && !locked ? '0 0 0 2px rgba(59,130,246,0.45)' : undefined,\n }}\n >\n {busy ? (\n <span role=\"status\" className=\"flex flex-col items-center gap-1.5\">\n <Spinner />\n <span className=\"text-xs font-medium text-gray-500\">{busyLabel}</span>\n </span>\n ) : (\n <>\n <span className=\"text-gray-400\">\n <UploadGlyph />\n </span>\n <span className=\"px-3 text-xs text-gray-500\">{dimLine}</span>\n <span className=\"text-sm font-medium text-blue-600\">{cta}</span>\n {acceptHint && <span className=\"text-xs text-gray-400\">{acceptHint}</span>}\n </>\n )}\n </button>\n );\n\n return (\n <FormField label={label} htmlFor={fieldId} hint={hint} error={error} required={required} className={className}>\n {value ? filled : empty}\n {!onPick && (\n <input ref={inputRef} type=\"file\" accept={accept} className=\"hidden\" onChange={onNativeFile} />\n )}\n </FormField>\n );\n}\n","/**\n * MediaUploadGrid — the kit's standard MULTI-image / video gallery uploader, and\n * the sibling of {@link MediaUploadField}. Where the field owns one slot, the\n * grid owns a list: a thumbnail grid with an \"+ Add\" tile, per-thumb remove,\n * optional drag-to-reorder, and an optional \"cover\" badge on the first item.\n * Empty, it shows the same dashed dropzone as the single field.\n *\n * Presentational and controlled: it renders the `items` you pass and reports\n * intent through callbacks — it owns NO picker modal, NO upload, and NO ordering\n * logic. Adding is INJECTED via `onPick(droppedFile?)` (fires on click of the\n * Add tile / empty dropzone, and on a file drop onto the zone); removing via\n * `onRemove(id)`; reordering via `onReorder(from, to)`. The consumer resolves\n * each into its own state / API. Shares `mediaFileName` and the dropzone look\n * with {@link MediaUploadField} (DRY / SSoT).\n */\nimport { useId, useState, type DragEvent, type FocusEvent, type KeyboardEvent, type ReactNode } from 'react';\nimport FormField from './FormField';\nimport { isVideoUrl, mediaFileName, Spinner, UploadGlyph } from './mediaShared';\n\nexport interface MediaUploadGridItem {\n /** Stable key — used for React keys, remove, and reorder. */\n id: string;\n /** Preview URL. */\n url: string;\n /** `image` | `video`. Inferred from the URL when omitted. */\n kind?: 'image' | 'video';\n /** Optional label overlaid on the thumbnail (filename, dimensions, …). */\n caption?: ReactNode;\n /** Force the \"cover\" badge on this item (else `showCover` badges the first). */\n cover?: boolean;\n}\n\nexport interface MediaUploadGridProps {\n /** The gallery contents, in display order. */\n items: MediaUploadGridItem[];\n /**\n * Open the consumer's library/upload flow. Fires on click of the Add tile /\n * empty dropzone and on a file drop onto the zone (the dropped File is passed\n * so the consumer can seed an immediate upload). Without it the gallery is\n * read-only for additions (no Add tile, no drop).\n */\n onPick?: (droppedFile?: File) => void;\n /** Remove one item. The per-thumb ✕ shows only when this is provided. */\n onRemove?: (id: string) => void;\n /**\n * Reorder within the grid. Enables drag-to-reorder when provided; called with\n * the source and target indices on drop.\n */\n onReorder?: (fromIndex: number, toIndex: number) => void;\n\n // ── Field chrome (delegates to the shell FormField) ──\n label?: ReactNode;\n hint?: ReactNode;\n error?: ReactNode;\n required?: boolean;\n className?: string;\n\n // ── Media ──\n /** Native accept string — drives preview kind, the drop filter, and the copy. Default `image/*`. */\n accept?: string;\n /** `object-fit` for the thumbnails. Default `cover`. */\n fit?: 'cover' | 'contain';\n /** Thumbnail (and Add tile) square size in px. Default 96. */\n thumbSize?: number;\n\n // ── Empty-state copy (shared with MediaUploadField) ──\n /** Dim prompt line on the empty dropzone. Default derived from `accept`. */\n placeholder?: ReactNode;\n /** The link CTA on the empty dropzone. Default \"Choose from library or upload\". */\n cta?: ReactNode;\n /** Small kind hint under the CTA, e.g. \"PNG · JPG · WEBP\". */\n acceptHint?: ReactNode;\n\n // ── Cover badge ──\n /** Badge the first item (or the one with `cover`) as the gallery cover. Default false. */\n showCover?: boolean;\n /** Cover badge text. Default \"Cover\". */\n coverLabel?: ReactNode;\n\n // ── State ──\n /** Busy: dim the zone and show a spinner while the caller's upload runs. */\n busy?: boolean;\n /** Busy label. Default \"Uploading…\". */\n busyLabel?: ReactNode;\n /** Disable all interaction. */\n disabled?: boolean;\n /** View only — thumbnails without Add / remove / reorder affordances. */\n readOnly?: boolean;\n}\n\nconst REMOVE_ICON = (\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" aria-hidden=\"true\" className=\"h-3 w-3\">\n <path d=\"M6 6l12 12M18 6L6 18\" />\n </svg>\n);\n\nexport default function MediaUploadGrid({\n items,\n onPick,\n onRemove,\n onReorder,\n label,\n hint,\n error,\n required,\n className,\n accept = 'image/*',\n fit = 'cover',\n thumbSize = 96,\n placeholder,\n cta = 'Choose from library or upload',\n acceptHint,\n showCover = false,\n coverLabel = 'Cover',\n busy = false,\n busyLabel = 'Uploading…',\n disabled = false,\n readOnly = false,\n}: MediaUploadGridProps) {\n const gridId = useId();\n const [zoneDragOver, setZoneDragOver] = useState(false);\n const [draggingIndex, setDraggingIndex] = useState<number | null>(null);\n // Which focusable control holds focus, so we can draw an inline focus ring —\n // the kit's shipped stylesheet has no Tailwind focus/ring machinery to fall\n // back on (see MediaUploadField). Keyed per control (zone/add/rm:<id>/thumb:<id>).\n const [focusedKey, setFocusedKey] = useState<string | null>(null);\n const ringStyle = (key: string) => ({\n outline: 'none' as const,\n ...(focusedKey === key && !locked ? { boxShadow: '0 0 0 2px rgba(59,130,246,0.45)' } : {}),\n });\n const blurKey = (key: string) => setFocusedKey(k => (k === key ? null : k));\n\n const locked = disabled || busy;\n const canAdd = !!onPick && !locked && !readOnly;\n const canRemove = !!onRemove && !locked && !readOnly;\n const reorderEnabled = !!onReorder && !locked && !readOnly;\n\n const acceptsVideo = accept.includes('video');\n const acceptsImage = accept.includes('image') || accept === '*' || accept === '';\n const kindWord = acceptsVideo && !acceptsImage ? 'video' : acceptsImage && !acceptsVideo ? 'image' : 'file';\n const dimLine = placeholder ?? `Upload ${kindWord === 'image' ? 'an image' : `a ${kindWord}`}`;\n\n const pick = (file?: File | null) => {\n if (!canAdd) return;\n onPick!(file ?? undefined);\n };\n\n const isFileDrag = (e: DragEvent) => Array.from(e.dataTransfer.types || []).includes('Files');\n\n // Zone-level drag/drop handles EXTERNAL file drops (add). Internal reorder\n // drags are handled on the thumbnails and stop propagation, so they never\n // trigger the zone highlight or an accidental add.\n const zoneHandlers = canAdd\n ? {\n onDragOver: (e: DragEvent) => {\n if (!isFileDrag(e)) return;\n e.preventDefault();\n setZoneDragOver(true);\n },\n onDragLeave: () => setZoneDragOver(false),\n onDrop: (e: DragEvent) => {\n const file = e.dataTransfer.files?.[0];\n if (!file) return;\n e.preventDefault();\n setZoneDragOver(false);\n pick(file);\n },\n }\n : {};\n\n const square = { width: thumbSize, height: thumbSize } as const;\n\n const thumb = (item: MediaUploadGridItem, index: number) => {\n const video = item.kind ? item.kind === 'video' : isVideoUrl(item.url, accept);\n const name = mediaFileName(item.url);\n const isCover = showCover && (item.cover ?? index === 0);\n return (\n <div\n key={item.id}\n draggable={reorderEnabled || undefined}\n onDragStart={\n reorderEnabled\n ? (e: DragEvent) => {\n // setData is required for Firefox to start the drag; the payload\n // is unused (we track the source via `draggingIndex`).\n e.dataTransfer.effectAllowed = 'move';\n e.dataTransfer.setData('text/plain', String(index));\n setDraggingIndex(index);\n }\n : undefined\n }\n onDragEnd={reorderEnabled ? () => setDraggingIndex(null) : undefined}\n onDragOver={\n reorderEnabled\n ? (e: DragEvent) => {\n if (draggingIndex == null) return;\n e.preventDefault();\n e.stopPropagation();\n }\n : undefined\n }\n onDrop={\n reorderEnabled\n ? (e: DragEvent) => {\n if (draggingIndex == null) return;\n e.preventDefault();\n e.stopPropagation();\n if (draggingIndex !== index) onReorder!(draggingIndex, index);\n setDraggingIndex(null);\n }\n : undefined\n }\n tabIndex={reorderEnabled ? 0 : undefined}\n aria-label={reorderEnabled ? `${name}, item ${index + 1} of ${items.length}. Use arrow keys to reorder.` : undefined}\n onKeyDown={\n reorderEnabled\n ? (e: KeyboardEvent) => {\n if (e.key === 'ArrowLeft' || e.key === 'ArrowUp') {\n if (index > 0) { e.preventDefault(); onReorder!(index, index - 1); }\n } else if (e.key === 'ArrowRight' || e.key === 'ArrowDown') {\n if (index < items.length - 1) { e.preventDefault(); onReorder!(index, index + 1); }\n }\n }\n : undefined\n }\n onFocus={reorderEnabled ? (e: FocusEvent) => { if (e.target === e.currentTarget) setFocusedKey(`thumb:${item.id}`); } : undefined}\n onBlur={reorderEnabled ? (e: FocusEvent) => { if (e.target === e.currentTarget) blurKey(`thumb:${item.id}`); } : undefined}\n className={[\n 'relative shrink-0 overflow-hidden rounded-md border border-gray-200 bg-gray-100',\n draggingIndex === index ? 'opacity-50' : '',\n ].join(' ')}\n style={{ ...square, cursor: reorderEnabled ? 'move' : undefined, ...ringStyle(`thumb:${item.id}`) }}\n >\n {video ? (\n <video src={item.url} muted playsInline preload=\"metadata\" aria-label={name} className=\"h-full w-full\" style={{ objectFit: fit }} />\n ) : (\n <img src={item.url} alt={name} className=\"h-full w-full\" style={{ objectFit: fit }} />\n )}\n\n {isCover && (\n <span className=\"absolute left-1 top-1 rounded bg-blue-600 px-1.5 py-0.5 text-xs font-medium text-white\">\n {coverLabel}\n </span>\n )}\n\n {item.caption != null && (\n <span\n className=\"absolute inset-x-1 bottom-1 truncate rounded px-1.5 py-0.5 text-xs text-white\"\n style={{ background: 'rgba(0,0,0,0.6)' }}\n >\n {item.caption}\n </span>\n )}\n\n {canRemove && (\n <button\n type=\"button\"\n onClick={() => onRemove!(item.id)}\n aria-label={`Remove ${name}`}\n onFocus={() => setFocusedKey(`rm:${item.id}`)}\n onBlur={() => blurKey(`rm:${item.id}`)}\n className=\"absolute right-1 top-1 flex h-5 w-5 items-center justify-center rounded-full text-white\"\n style={{ background: 'rgba(0,0,0,0.55)', ...ringStyle(`rm:${item.id}`) }}\n >\n {REMOVE_ICON}\n </button>\n )}\n </div>\n );\n };\n\n const addTile = canAdd && (\n <button\n type=\"button\"\n onClick={() => pick()}\n aria-label=\"Add media\"\n onFocus={() => setFocusedKey('add')}\n onBlur={() => blurKey('add')}\n className=\"flex shrink-0 flex-col items-center justify-center gap-1 rounded-md border-2 border-dashed border-gray-300 bg-gray-50 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-500\"\n style={{ ...square, ...ringStyle('add') }}\n >\n <UploadGlyph className=\"h-5 w-5\" />\n <span className=\"text-xs font-medium text-gray-500\">Add</span>\n </button>\n );\n\n // Empty state: the shared dashed dropzone (only when the caller can add).\n const emptyDropzone = canAdd ? (\n <button\n type=\"button\"\n onClick={() => pick()}\n aria-label={typeof dimLine === 'string' ? dimLine : 'Upload media'}\n onFocus={() => setFocusedKey('zone')}\n onBlur={() => blurKey('zone')}\n className={[\n 'flex w-full flex-col items-center justify-center gap-1.5 rounded-lg border-2 border-dashed text-center transition-colors cursor-pointer',\n zoneDragOver ? 'border-blue-500 bg-blue-50' : 'border-gray-300 bg-gray-50 hover:bg-gray-100',\n ].join(' ')}\n style={{ minHeight: thumbSize + 32, ...ringStyle('zone') }}\n >\n <span className=\"text-gray-400\"><UploadGlyph /></span>\n <span className=\"px-3 text-xs text-gray-500\">{dimLine}</span>\n <span className=\"text-sm font-medium text-blue-600\">{cta}</span>\n {acceptHint && <span className=\"text-xs text-gray-400\">{acceptHint}</span>}\n </button>\n ) : (\n <div\n className=\"flex w-full items-center justify-center rounded-lg border border-gray-200 bg-gray-50 px-3 text-xs text-gray-400\"\n style={{ minHeight: thumbSize + 32 }}\n >\n No media.\n </div>\n );\n\n return (\n <FormField label={label} labelId={label ? `${gridId}-label` : undefined} htmlFor={gridId} hint={hint} error={error} required={required} className={className}>\n <div\n id={gridId}\n role=\"group\"\n aria-labelledby={label ? `${gridId}-label` : undefined}\n aria-describedby={error ? `${gridId}-error` : hint ? `${gridId}-hint` : undefined}\n aria-busy={busy || undefined}\n {...zoneHandlers}\n className=\"relative rounded-lg transition-colors\"\n style={{\n ...(locked ? { opacity: 0.6 } : {}),\n // Inline box-shadow, not `ring-*` — the kit's shipped stylesheet has no\n // Tailwind ring machinery (see MediaUploadField's focus ring).\n ...(zoneDragOver ? { boxShadow: '0 0 0 2px rgba(59,130,246,0.5)' } : {}),\n }}\n >\n {items.length === 0 ? (\n emptyDropzone\n ) : (\n <div className=\"flex flex-wrap gap-2\">\n {items.map(thumb)}\n {addTile}\n </div>\n )}\n\n {busy && (\n <div\n role=\"status\"\n className=\"absolute inset-0 flex items-center justify-center gap-2 rounded-lg\"\n style={{ background: 'rgba(255,255,255,0.6)' }}\n >\n <Spinner />\n <span className=\"text-xs font-medium text-gray-600\">{busyLabel}</span>\n </div>\n )}\n </div>\n </FormField>\n );\n}\n","import { useEffect, type RefObject } from 'react';\n\nexport default function useClickOutside(ref: RefObject<HTMLElement | null>, onClose: () => void) {\n useEffect(() => {\n const handler = (e: MouseEvent) => {\n if (ref.current && !ref.current.contains(e.target as Node)) onClose();\n };\n document.addEventListener('mousedown', handler);\n return () => document.removeEventListener('mousedown', handler);\n }, [ref, onClose]);\n}\n","/**\n * DateRangePicker — a from/to calendar filter in a single popover trigger.\n *\n * Replaces the two-native-`<input type=\"date\">` pattern the portals had grown\n * independently: a pair of bare boxes states no relationship between the two\n * dates, offers no presets, and (on the platforms these tenants use) opens an\n * OS picker that is itself a month-at-a-time stepper.\n *\n * Navigation drills UP rather than stepping: the header's month and year are\n * separate buttons opening a 12-month and a 12-year grid, so a date years back\n * is a few clicks instead of one click per intervening month.\n *\n * The component is deliberately free of app-level dependencies — date DISPLAY\n * is injected via `formatDisplay` so each portal can honour its own user\n * date-format preference, and the value contract is the plain `YYYY-MM-DD` the\n * API filters on.\n *\n * The panel is placed against whatever box CLIPS it rather than against a fixed\n * edge — see `clipBounds` below and the alignment effect in the component.\n */\nimport { useState, useRef, useCallback, useLayoutEffect } from 'react';\nimport { glassStyle } from '../utils/glass';\nimport useClickOutside from '../hooks/useClickOutside';\n\nexport interface DateRangePickerProps {\n /** Start of the range as `YYYY-MM-DD`, or '' when unset. */\n from: string;\n /** End of the range as `YYYY-MM-DD`, or '' when unset. */\n to: string;\n /** Called with the applied range. Both values are '' when cleared. */\n onChange: (from: string, to: string) => void;\n /**\n * Render a `YYYY-MM-DD` for display. Defaults to `DD/MM/YYYY`; portals pass\n * their own so the picker agrees with every other date on screen.\n */\n formatDisplay?: (iso: string) => string;\n /**\n * Offer the Clear affordances. Pass `false` where a range is REQUIRED — an\n * accounting report seeded with a period has nothing sensible to show for an\n * empty one, so it should not offer to empty it.\n */\n clearable?: boolean;\n /** Trigger text when no range is set. */\n placeholder?: string;\n}\n\nconst PRESET_LABELS = ['Last 2 Weeks', 'Last Month', 'Last 3 Months', 'Last 6 Months', 'Last 12 Months'];\n\nconst MONTH_NAMES = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];\n\n/** The year grid pages in 12s so it reuses the month grid's 3x4 shape. */\nconst YEARS_PER_PAGE = 12;\nconst yearPageStart = (y: number) => Math.floor(y / YEARS_PER_PAGE) * YEARS_PER_PAGE;\n\nconst pad = (n: number) => String(n).padStart(2, '0');\n\n/** Clear space kept between the panel and the edge it stops at. */\nconst EDGE_MARGIN = 8;\n\n/**\n * The box the open panel has to stay inside.\n *\n * The nearest ancestor that clips horizontally, falling back to the viewport\n * when nothing on the way up does. The distinction matters: a shell window's\n * body is `overflow-hidden`, so a panel that hangs past its edge is not merely\n * off to one side, it is *gone* — there is nothing to scroll and resizing the\n * window does not bring it back, because the trigger moves with the edge.\n *\n * jsdom, and a container the browser has not laid out yet, both report a rect\n * of zeros; that says nothing about where the panel may go, so keep walking.\n */\nfunction clipBounds(el: HTMLElement): { left: number; right: number } {\n for (let node = el.parentElement; node; node = node.parentElement) {\n const style = getComputedStyle(node);\n // jsdom does not expand the `overflow` shorthand into `overflow-x`, and\n // `overflow-hidden` is how every clipping surface in the shell spells it.\n // A browser always resolves `overflowX`, so the fallback is inert there.\n const overflowX = style.overflowX || style.overflow;\n if (overflowX && overflowX !== 'visible') {\n const rect = node.getBoundingClientRect();\n if (rect.width > 0) return { left: rect.left, right: rect.right };\n }\n }\n return { left: 0, right: window.innerWidth };\n}\n\n/**\n * Serialise a Date to `YYYY-MM-DD`, reading its LOCAL calendar fields.\n *\n * This must not go through `toISOString()`. Every Date this component builds is\n * constructed at local midnight — calendar cells, the preset boundaries, and\n * `new Date()` — and local midnight always falls in the *previous* UTC day for\n * any positive UTC offset. Serialising through UTC would shift the whole picker\n * back one day for every user east of Greenwich.\n */\nexport function toISODate(d: Date): string {\n return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;\n}\n\nfunction parseDate(s: string): Date {\n const [y, m, d] = s.split('-').map(Number);\n return new Date(y, m - 1, d);\n}\n\n/** Fallback display format. Portals override via `formatDisplay`. */\nfunction defaultFormatDisplay(s: string): string {\n const [y, m, d] = s.split('-');\n return y && m && d ? `${d}/${m}/${y}` : s;\n}\n\nexport default function DateRangePicker({\n from,\n to,\n onChange,\n formatDisplay = defaultFormatDisplay,\n clearable = true,\n placeholder = 'Date Range',\n}: DateRangePickerProps) {\n const [open, setOpen] = useState(false);\n const [tempFrom, setTempFrom] = useState(from);\n const [tempTo, setTempTo] = useState(to);\n const [activePreset, setActivePreset] = useState<string | null>(null);\n const ref = useRef<HTMLDivElement>(null);\n const panelRef = useRef<HTMLDivElement>(null);\n // Which edge of the trigger the panel hangs from.\n const [align, setAlign] = useState<'left' | 'right'>('left');\n\n const now = new Date();\n const [month, setMonth] = useState(from ? parseDate(from).getMonth() : now.getMonth());\n const [year, setYear] = useState(from ? parseDate(from).getFullYear() : now.getFullYear());\n // Which panel the calendar column is showing. Days is the leaf; the header\n // label drills up to months, then years.\n const [view, setView] = useState<'days' | 'months' | 'years'>('days');\n // Paging the year grid must not mutate `year` — backing out of the panel\n // without picking would otherwise silently move the day calendar.\n const [yearPage, setYearPage] = useState(() => yearPageStart(year));\n\n const displayDate = (s: string) => (s ? formatDisplay(s) : '');\n\n useClickOutside(ref, useCallback(() => { if (open) setOpen(false); }, [open]));\n\n /**\n * Hang the panel off whichever edge of the trigger leaves it on screen.\n *\n * It used to be pinned to `right: 0`, which suits a trigger sitting at the\n * right of a list toolbar and ruins one sitting at the left: the panel grows\n * leftward, past the edge of the shell window, and the From box, the\n * month/year header and the previous-month arrow are simply not there. So\n * left-align by default, since a filter bar reads left to right and its first\n * control has the whole width to open into, and keep the old right-alignment\n * for the case it was protecting — a trigger with no room to its right.\n *\n * The width is measured, not assumed: the presets column is `min-w-[130px]`,\n * a MINIMUM, so the real width follows the longest preset label at whatever\n * font size the reader has. Ancestor clipping does not affect an element's\n * own rect, so this reads true even while the panel is being cut off.\n *\n * Runs in a layout effect, so the correction lands in the same paint as the\n * open and nothing flashes. Re-measuring on resize is what makes maximising\n * the window do something, which is the first thing anyone tries.\n */\n useLayoutEffect(() => {\n if (!open) return;\n const place = () => {\n const anchor = ref.current, panel = panelRef.current;\n if (!anchor || !panel) return;\n const trigger = anchor.getBoundingClientRect();\n const width = panel.getBoundingClientRect().width;\n const bounds = clipBounds(anchor);\n const fitsLeftAligned = trigger.left + width <= bounds.right - EDGE_MARGIN;\n const fitsRightAligned = trigger.right - width >= bounds.left + EDGE_MARGIN;\n // When neither fits — a container narrower than the panel itself — left\n // wins, because the half worth keeping is the one with the dates in it.\n setAlign(fitsLeftAligned || !fitsRightAligned ? 'left' : 'right');\n };\n place();\n window.addEventListener('resize', place);\n return () => window.removeEventListener('resize', place);\n }, [open]);\n\n const handleOpen = () => {\n setTempFrom(from);\n setTempTo(to);\n setActivePreset(null);\n const anchor = from ? parseDate(from) : now;\n setMonth(anchor.getMonth());\n setYear(anchor.getFullYear());\n setYearPage(yearPageStart(anchor.getFullYear()));\n setView('days');\n setOpen(true);\n };\n\n const handlePreset = (label: string) => {\n let start: Date, end: Date;\n switch (label) {\n case 'Last 2 Weeks':\n end = new Date();\n start = new Date();\n start.setDate(start.getDate() - 14);\n break;\n case 'Last Month':\n start = new Date(now.getFullYear(), now.getMonth() - 1, 1);\n end = new Date(now.getFullYear(), now.getMonth(), 0);\n break;\n case 'Last 3 Months':\n start = new Date(now.getFullYear(), now.getMonth() - 3, 1);\n end = new Date(now.getFullYear(), now.getMonth(), 0);\n break;\n case 'Last 6 Months':\n start = new Date(now.getFullYear(), now.getMonth() - 6, 1);\n end = new Date(now.getFullYear(), now.getMonth(), 0);\n break;\n case 'Last 12 Months':\n start = new Date(now.getFullYear(), now.getMonth() - 12, 1);\n end = new Date(now.getFullYear(), now.getMonth(), 0);\n break;\n default: return;\n }\n setTempFrom(toISODate(start));\n setTempTo(toISODate(end));\n setActivePreset(label);\n setMonth(start.getMonth());\n setYear(start.getFullYear());\n setYearPage(yearPageStart(start.getFullYear()));\n setView('days');\n };\n\n const handleCalendarSelect = (date: string) => {\n setActivePreset('Custom');\n if (!tempFrom || (tempFrom && tempTo)) {\n setTempFrom(date);\n setTempTo('');\n } else {\n if (date < tempFrom) {\n setTempTo(tempFrom);\n setTempFrom(date);\n } else {\n setTempTo(date);\n }\n }\n };\n\n const handleApply = () => {\n onChange(tempFrom, tempTo);\n setOpen(false);\n };\n\n const handleClear = () => {\n onChange('', '');\n setOpen(false);\n };\n\n const changeMonth = (delta: number) => {\n let m = month + delta, y = year;\n if (m < 0) { m = 11; y--; } else if (m > 11) { m = 0; y++; }\n setMonth(m); setYear(y);\n };\n\n // The arrows step whatever the current panel is a grid of.\n const handleStep = (delta: number) => {\n if (view === 'days') changeMonth(delta);\n else if (view === 'months') setYear(year + delta);\n else setYearPage(yearPage + delta * YEARS_PER_PAGE);\n };\n\n const selectMonth = (m: number) => {\n setMonth(m);\n setView('days');\n };\n\n const selectYear = (y: number) => {\n setYear(y);\n setView('months');\n };\n\n const openYears = () => {\n setYearPage(yearPageStart(year));\n setView('years');\n };\n\n // Calendar cells\n const firstDay = new Date(year, month, 1).getDay();\n const daysInMonth = new Date(year, month + 1, 0).getDate();\n const prevDays = new Date(year, month, 0).getDate();\n const monthName = new Date(year, month).toLocaleString('default', { month: 'long' });\n\n const cells: { day: number; current: boolean; date: string }[] = [];\n for (let i = firstDay - 1; i >= 0; i--) {\n const d = new Date(year, month - 1, prevDays - i);\n cells.push({ day: prevDays - i, current: false, date: toISODate(d) });\n }\n for (let d = 1; d <= daysInMonth; d++) {\n cells.push({ day: d, current: true, date: toISODate(new Date(year, month, d)) });\n }\n const remaining = 42 - cells.length;\n for (let d = 1; d <= remaining; d++) {\n cells.push({ day: d, current: false, date: toISODate(new Date(year, month + 1, d)) });\n }\n\n const isInRange = (date: string) => {\n if (!tempFrom || !tempTo) return false;\n const s = tempFrom < tempTo ? tempFrom : tempTo;\n const e = tempFrom < tempTo ? tempTo : tempFrom;\n return date > s && date < e;\n };\n\n const displayText = from && to\n ? `${displayDate(from)} — ${displayDate(to)}`\n : from ? `From ${displayDate(from)}`\n : to ? `To ${displayDate(to)}`\n : '';\n\n return (\n <div className=\"relative\" ref={ref}>\n {/* Trigger + clear are SIBLING buttons inside a shared bordered shell —\n a clear control nested inside the trigger button would be invalid\n nesting and unreachable by keyboard. */}\n <div\n className={`inline-flex items-center gap-2 border rounded-lg px-2.5 py-1.5 text-sm focus-within:border-blue-500 focus-within:ring-1 focus-within:ring-blue-500 ${from || to ? 'border-blue-400 bg-blue-50 text-blue-700' : 'border-gray-300 text-gray-500'}`}>\n <button type=\"button\" onClick={handleOpen} aria-haspopup=\"dialog\" aria-expanded={open}\n className=\"inline-flex items-center gap-2 focus:outline-none\">\n <svg className=\"w-4 h-4 shrink-0\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" viewBox=\"0 0 24 24\">\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z\" />\n </svg>\n {displayText || placeholder}\n </button>\n {clearable && (from || to) && (\n <button type=\"button\" onClick={handleClear} aria-label=\"Clear date range\"\n className=\"text-blue-400 hover:text-red-500 focus:outline-none focus-visible:ring-1 focus-visible:ring-blue-500 rounded\">×</button>\n )}\n </div>\n\n {open && (\n <div ref={panelRef} role=\"dialog\" aria-label=\"Date range\" className=\"absolute z-50 mt-1 rounded-2xl p-4\"\n style={{ ...(align === 'right' ? { right: 0 } : { left: 0 }), ...glassStyle() }}>\n {/* From/To display */}\n <div className=\"flex items-center gap-3 mb-3\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-xs font-medium text-gray-500\">From</span>\n <span className={`text-sm px-2 py-1 rounded border min-w-[90px] ${tempFrom ? 'border-blue-300 bg-blue-50 text-blue-700' : 'border-gray-200 bg-gray-50 text-gray-400'}`}>\n {tempFrom ? displayDate(tempFrom) : 'Start'}\n </span>\n </div>\n <span className=\"text-gray-300\">—</span>\n <div className=\"flex items-center gap-2\">\n <span className=\"text-xs font-medium text-gray-500\">To</span>\n <span className={`text-sm px-2 py-1 rounded border min-w-[90px] ${tempTo ? 'border-blue-300 bg-blue-50 text-blue-700' : 'border-gray-200 bg-gray-50 text-gray-400'}`}>\n {tempTo ? displayDate(tempTo) : 'End'}\n </span>\n </div>\n </div>\n\n <div className=\"flex gap-4\">\n {/* Single Calendar */}\n <div className=\"w-64\">\n <div className=\"flex items-center justify-between mb-2 px-1\">\n <button type=\"button\" onClick={() => handleStep(-1)} aria-label=\"Previous\" className=\"p-1 rounded-full hover:bg-gray-100 text-gray-600\">\n <svg className=\"w-4 h-4\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" viewBox=\"0 0 24 24\"><path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M15 19l-7-7 7-7\" /></svg>\n </button>\n {/* Month and year are separately clickable, so jumping to a far\n year is one click rather than drilling month -> year. */}\n <div className=\"flex items-center gap-1 text-sm font-semibold text-gray-800\">\n {view === 'days' && (\n <button type=\"button\" onClick={() => setView('months')}\n className=\"px-1.5 py-0.5 rounded-md hover:bg-gray-100 transition-colors\">\n {monthName}\n </button>\n )}\n {view === 'years' ? (\n <span className=\"px-1.5 py-0.5\">{yearPage} – {yearPage + YEARS_PER_PAGE - 1}</span>\n ) : (\n <button type=\"button\" onClick={openYears}\n className=\"px-1.5 py-0.5 rounded-md hover:bg-gray-100 transition-colors\">\n {year}\n </button>\n )}\n </div>\n <button type=\"button\" onClick={() => handleStep(1)} aria-label=\"Next\" className=\"p-1 rounded-full hover:bg-gray-100 text-gray-600\">\n <svg className=\"w-4 h-4\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" viewBox=\"0 0 24 24\"><path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M9 5l7 7-7 7\" /></svg>\n </button>\n </div>\n {/* Fixed height keeps the popup from resizing as panels swap. */}\n <div className=\"min-h-[13.75rem]\">\n {view === 'days' && (\n <>\n <div className=\"grid grid-cols-7 text-center text-xs font-medium text-gray-500 mb-1\">\n {['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'].map(d => <div key={d} className=\"py-1\">{d}</div>)}\n </div>\n <div className=\"grid grid-cols-7 text-center text-sm\">\n {cells.map((c, i) => {\n const isStart = c.date === tempFrom;\n const isEnd = c.date === tempTo;\n const isSelected = isStart || isEnd;\n const inRange = isInRange(c.date);\n return (\n <button key={i} type=\"button\" onClick={() => handleCalendarSelect(c.date)}\n className={`py-1.5 rounded-md transition-colors ${\n !c.current ? 'text-gray-300' :\n isSelected ? 'bg-blue-600 text-white font-semibold' :\n inRange ? 'bg-blue-100 text-blue-800' :\n 'text-gray-700 hover:bg-gray-100'\n }`}>\n {c.day}\n </button>\n );\n })}\n </div>\n </>\n )}\n\n {view === 'months' && (\n <div className=\"grid grid-cols-3 gap-1 text-center text-sm\">\n {MONTH_NAMES.map((name, m) => {\n const isCurrent = m === month;\n const isThisMonth = m === now.getMonth() && year === now.getFullYear();\n return (\n <button key={name} type=\"button\" onClick={() => selectMonth(m)}\n className={`py-4 rounded-md transition-colors ${\n isCurrent ? 'bg-blue-600 text-white font-semibold' :\n isThisMonth ? 'text-blue-600 font-medium hover:bg-gray-100' :\n 'text-gray-700 hover:bg-gray-100'\n }`}>\n {name}\n </button>\n );\n })}\n </div>\n )}\n\n {view === 'years' && (\n <div className=\"grid grid-cols-3 gap-1 text-center text-sm\">\n {Array.from({ length: YEARS_PER_PAGE }, (_, i) => yearPage + i).map(y => {\n const isCurrent = y === year;\n const isThisYear = y === now.getFullYear();\n return (\n <button key={y} type=\"button\" onClick={() => selectYear(y)}\n className={`py-4 rounded-md transition-colors ${\n isCurrent ? 'bg-blue-600 text-white font-semibold' :\n isThisYear ? 'text-blue-600 font-medium hover:bg-gray-100' :\n 'text-gray-700 hover:bg-gray-100'\n }`}>\n {y}\n </button>\n );\n })}\n </div>\n )}\n </div>\n </div>\n\n {/* Presets */}\n <div className=\"border-l border-gray-200 pl-4 flex flex-col gap-1 min-w-[130px]\">\n {PRESET_LABELS.map(label => (\n <button key={label} type=\"button\" onClick={() => handlePreset(label)}\n className={`text-left px-3 py-1.5 text-sm rounded-md transition-colors ${activePreset === label ? 'bg-blue-50 text-blue-700 font-medium' : 'text-gray-700 hover:bg-gray-50'}`}>\n {label}\n </button>\n ))}\n <button type=\"button\" onClick={() => setActivePreset('Custom')}\n className={`text-left px-3 py-1.5 text-sm rounded-md transition-colors ${activePreset === 'Custom' ? 'bg-blue-50 text-blue-700 font-medium' : 'text-gray-700 hover:bg-gray-50'}`}>\n Custom\n </button>\n </div>\n </div>\n\n {/* Actions */}\n <div className=\"flex justify-end gap-2 mt-4 pt-3 border-t border-gray-200\">\n {clearable && (\n <button type=\"button\" onClick={handleClear} className=\"px-3 py-1.5 text-sm text-gray-500 hover:text-gray-700\">Clear</button>\n )}\n <button type=\"button\" onClick={() => setOpen(false)} className=\"px-3 py-1.5 text-sm text-gray-600 border border-gray-300 rounded-md hover:bg-gray-50\">Cancel</button>\n <button type=\"button\" onClick={handleApply} disabled={!tempFrom || !tempTo}\n className=\"px-4 py-1.5 text-sm font-medium text-white bg-blue-600 rounded-md hover:bg-blue-700 disabled:opacity-50\">\n Apply\n </button>\n </div>\n </div>\n )}\n </div>\n );\n}\n","/**\n * DatePicker — one calendar date, on the platform's own date input.\n *\n * `DateRangePicker` is the other one: two dates, a rendered calendar, presets,\n * and its own placement logic. This is a native `<input type=\"date\">` wearing\n * the kit's field styling — the browser supplies the calendar, so it also\n * supplies the locale, the keyboard behaviour and the mobile date wheel for\n * free, and there is nothing here to keep in step with any of them.\n *\n * ── Every date bug in this file is the same bug ──\n * `new Date('2026-08-11')` is UTC midnight, which is the 10th anywhere west of\n * Greenwich; `toISOString()` on a locally-built Date is the previous day\n * anywhere east of it. So this component never crosses that boundary: a bare\n * `YYYY-MM-DD` string is passed through untouched, a Date is serialised through\n * `toISODate` (which reads local calendar fields, and says so at length), and\n * the Date handed back to `onChange` is built from the three integers with the\n * local constructor. `DateRangePicker` learned this the same way.\n */\nimport { forwardRef, type InputHTMLAttributes } from 'react';\n\nimport { toISODate } from './DateRangePicker';\nimport { inputClasses, type InputSize } from './styles';\n\n/** What a native date input speaks, and what this component stores. */\nconst ISO_DATE = /^\\d{4}-\\d{2}-\\d{2}$/;\n\nexport interface DatePickerProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'className' | 'size' | 'type' | 'value' | 'onChange' | 'min' | 'max'> {\n /** A Date, a `YYYY-MM-DD` string, or nothing. */\n value?: Date | string | null;\n /**\n * The chosen date at local midnight, or `null` when the field is empty.\n *\n * A native date input also reports `''` mid-entry, while a partly typed date\n * is not yet a date. Both arrive here as `null`: \"no date yet\" and \"cleared\"\n * are the same thing to a caller storing a value.\n */\n onChange?: (value: Date | null) => void;\n /** Earliest selectable date. */\n min?: Date | string | null;\n /** Latest selectable date. */\n max?: Date | string | null;\n /** Error state — red border + ring, matching Input. */\n invalid?: boolean;\n /** `touch` gives a 56px field for a finger. Defaults to the desktop size. */\n size?: InputSize;\n className?: string;\n}\n\n/**\n * Normalise anything the caller holds into what the input element wants.\n *\n * The `ISO_DATE` short-circuit is load-bearing rather than an optimisation: it\n * is what stops a string that is already correct from being round-tripped\n * through `new Date(...)` and coming back a day early.\n */\nfunction toInputValue(value: Date | string | null | undefined): string {\n if (value === null || value === undefined || value === '') return '';\n if (value instanceof Date) return Number.isNaN(value.getTime()) ? '' : toISODate(value);\n if (ISO_DATE.test(value)) return value;\n const parsed = new Date(value);\n return Number.isNaN(parsed.getTime()) ? '' : toISODate(parsed);\n}\n\n/** `YYYY-MM-DD` → local midnight. Built from the parts, never parsed as a string. */\nfunction fromInputValue(raw: string): Date | null {\n if (!ISO_DATE.test(raw)) return null;\n const [year, month, day] = raw.split('-').map(Number);\n const date = new Date(year, month - 1, day);\n // Rejects 2026-02-31, which the constructor would happily roll into March.\n return date.getMonth() === month - 1 && date.getDate() === day ? date : null;\n}\n\nconst DatePicker = forwardRef<HTMLInputElement, DatePickerProps>(function DatePicker(\n { value, onChange, min, max, invalid, size, className = '', ...rest },\n ref,\n) {\n return (\n <input\n ref={ref}\n type=\"date\"\n\n aria-invalid={invalid || undefined}\n value={toInputValue(value)}\n min={toInputValue(min) || undefined}\n max={toInputValue(max) || undefined}\n onChange={event => onChange?.(fromInputValue(event.target.value))}\n className={inputClasses({ invalid, size, className })}\n {...rest}\n />\n );\n});\n\nexport default DatePicker;\n","/**\n * TimePicker — one time of day, on the platform's own time input.\n *\n * The same bargain as DatePicker: a native `<input type=\"time\">` wearing the\n * kit's field styling, so the browser supplies the wheel, the locale's\n * 12/24-hour convention and the keyboard behaviour, and there is nothing here\n * to keep in step with any of them.\n *\n * The value is an `HH:MM` (or `HH:MM:SS`) wall-clock string, and `onChange`\n * hands back the same — never a Date. A time of day names no calendar day, so\n * building a Date from one means inventing a date, which is the same class of\n * bug DatePicker's header warns about, one step earlier. A caller who has a\n * Date may still pass it as `value`; its LOCAL hours and minutes are read\n * (never `toISOString`, which is UTC).\n */\nimport { forwardRef, type InputHTMLAttributes } from 'react';\n\nimport { inputClasses, type InputSize } from './styles';\n\n/** What a native time input speaks, and what this component stores. */\nconst TIME = /^\\d{2}:\\d{2}(:\\d{2})?$/;\n\nconst pad = (n: number) => String(n).padStart(2, '0');\n\nexport interface TimePickerProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'className' | 'size' | 'type' | 'value' | 'onChange' | 'min' | 'max'> {\n /** An `HH:MM` / `HH:MM:SS` string, a Date (local wall-clock time is read), or nothing. */\n value?: Date | string | null;\n /**\n * The chosen time as `HH:MM` (`HH:MM:SS` when `step` asks for seconds), or\n * `null` when the field is empty or mid-entry — same contract as DatePicker.\n */\n onChange?: (value: string | null) => void;\n /** Earliest selectable time. */\n min?: Date | string | null;\n /** Latest selectable time. */\n max?: Date | string | null;\n /** Error state — red border + ring, matching Input. */\n invalid?: boolean;\n /** `touch` gives a 56px field for a finger. Defaults to the desktop size. */\n size?: InputSize;\n className?: string;\n}\n\nfunction toInputValue(value: Date | string | null | undefined, withSeconds: boolean): string {\n if (value === null || value === undefined || value === '') return '';\n if (value instanceof Date) {\n if (Number.isNaN(value.getTime())) return '';\n const base = `${pad(value.getHours())}:${pad(value.getMinutes())}`;\n return withSeconds ? `${base}:${pad(value.getSeconds())}` : base;\n }\n return TIME.test(value) ? value : '';\n}\n\nconst TimePicker = forwardRef<HTMLInputElement, TimePickerProps>(function TimePicker(\n { value, onChange, min, max, invalid, size, className = '', step, ...rest },\n ref,\n) {\n // A sub-minute step makes the native control show (and report) seconds.\n const withSeconds = step != null && Number(step) < 60;\n return (\n <input\n ref={ref}\n type=\"time\"\n step={step}\n aria-invalid={invalid || undefined}\n value={toInputValue(value, withSeconds)}\n min={toInputValue(min, withSeconds) || undefined}\n max={toInputValue(max, withSeconds) || undefined}\n onChange={event => onChange?.(TIME.test(event.target.value) ? event.target.value : null)}\n className={inputClasses({ invalid, size, className })}\n {...rest}\n />\n );\n});\n\nexport default TimePicker;\n","/**\n * DateTimePicker — one calendar date plus a wall-clock time, on the platform's\n * own `datetime-local` input. DatePicker's sibling: the browser supplies the\n * calendar and the time wheel, the kit supplies the field styling.\n *\n * The DatePicker header's rule applies here with one more field to get wrong:\n * `datetime-local` speaks LOCAL `YYYY-MM-DDTHH:MM`, so nothing in this file\n * may pass through `toISOString()` or the string Date constructor — a Date is\n * serialised from its local calendar and clock fields, and the Date handed to\n * `onChange` is built from the parsed integers with the local constructor.\n */\nimport { forwardRef, type InputHTMLAttributes } from 'react';\n\nimport { inputClasses, type InputSize } from './styles';\n\n/** What a native datetime-local input speaks, and what this component stores. */\nconst ISO_LOCAL = /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2})?$/;\n\nconst pad = (n: number) => String(n).padStart(2, '0');\n\nexport interface DateTimePickerProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'className' | 'size' | 'type' | 'value' | 'onChange' | 'min' | 'max'> {\n /** A Date, a local `YYYY-MM-DDTHH:MM` string, or nothing. */\n value?: Date | string | null;\n /**\n * The chosen moment as a local Date, or `null` when the field is empty or\n * mid-entry — same contract as DatePicker.\n */\n onChange?: (value: Date | null) => void;\n /** Earliest selectable moment. */\n min?: Date | string | null;\n /** Latest selectable moment. */\n max?: Date | string | null;\n /** Error state — red border + ring, matching Input. */\n invalid?: boolean;\n /** `touch` gives a 56px field for a finger. Defaults to the desktop size. */\n size?: InputSize;\n className?: string;\n}\n\n/** Local calendar + clock fields, never toISOString — see the header. */\nfunction serialise(date: Date): string {\n return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}T${pad(date.getHours())}:${pad(date.getMinutes())}`;\n}\n\nfunction toInputValue(value: Date | string | null | undefined): string {\n if (value === null || value === undefined || value === '') return '';\n if (value instanceof Date) return Number.isNaN(value.getTime()) ? '' : serialise(value);\n if (ISO_LOCAL.test(value)) return value;\n return '';\n}\n\n/** Local `YYYY-MM-DDTHH:MM[:SS]` → a local Date, built from the parts. */\nfunction fromInputValue(raw: string): Date | null {\n if (!ISO_LOCAL.test(raw)) return null;\n const [datePart, timePart] = raw.split('T');\n const [year, month, day] = datePart.split('-').map(Number);\n const [hours, minutes, seconds = 0] = timePart.split(':').map(Number);\n if (hours > 23 || minutes > 59 || seconds > 59) return null;\n const date = new Date(year, month - 1, day, hours, minutes, seconds);\n // Rejects 2026-02-31T10:00, which the constructor would roll into March.\n return date.getMonth() === month - 1 && date.getDate() === day ? date : null;\n}\n\nconst DateTimePicker = forwardRef<HTMLInputElement, DateTimePickerProps>(function DateTimePicker(\n { value, onChange, min, max, invalid, size, className = '', ...rest },\n ref,\n) {\n return (\n <input\n ref={ref}\n type=\"datetime-local\"\n aria-invalid={invalid || undefined}\n value={toInputValue(value)}\n min={toInputValue(min) || undefined}\n max={toInputValue(max) || undefined}\n onChange={event => onChange?.(fromInputValue(event.target.value))}\n className={inputClasses({ invalid, size, className })}\n {...rest}\n />\n );\n});\n\nexport default DateTimePicker;\n","/**\n * The rules for typing a decimal amount on an on-screen keypad — pure string\n * functions, no React and no DOM.\n *\n * Split out for the same reason as `selectNav.ts`: these are the rules people\n * actually get wrong, and they are far easier to pin exhaustively as functions\n * than by rendering a keypad and firing clicks at it.\n *\n * A STRING, not a number, all the way through. `'1.'` and `'1.0'` are states a\n * user passes through while typing and neither survives a round trip through a\n * float — `'1.'` would become `1` and erase the decimal point the moment it was\n * pressed. The caller converts once, at the end, when it has a whole amount.\n */\n\n/** Digits after the point. Two, because these are money amounts. */\nexport const MAX_FRACTION_DIGITS = 2;\n\n/**\n * Apply one keypress. `key` is a digit `'0'`-`'9'` or `'.'`.\n * Returns the value unchanged when the press is not allowed, so a caller can\n * always assign the result — an ignored key is a no-op, never an error.\n */\nexport function appendKey(value: string, key: string): string {\n if (key === '.') {\n // A second point is meaningless, and a leading one is ambiguous — '.5'\n // reads as an error on a receipt where '0.5' does not.\n if (value.includes('.')) return value;\n return value === '' ? '0.' : `${value}.`;\n }\n\n if (key < '0' || key > '9') return value;\n\n const dot = value.indexOf('.');\n if (dot !== -1 && value.length - dot - 1 >= MAX_FRACTION_DIGITS) return value;\n\n // A leading zero is a placeholder, not a digit: pressing 5 at '0' means 5,\n // not 05. But '0.' is a real prefix and keeps accumulating.\n if (value === '0') return key;\n\n return value + key;\n}\n\n/** Remove the last character. Empty stays empty rather than underflowing. */\nexport function backspace(value: string): string {\n return value.slice(0, -1);\n}\n","/**\n * NumericKeypad — an on-screen number pad for amount entry.\n *\n * Exists because a touch device's own keyboard is the wrong tool for money: it\n * covers the bottom half of the screen (on a till, the cart), it offers letters\n * nobody wants, and its layout moves between OS versions. A field driven by\n * this sets `inputMode=\"none\"` so the OS keyboard never appears at all.\n *\n * Controlled, and its value is a STRING — see `./keypadInput` for why, and for\n * the press rules themselves, which live there as pure functions.\n *\n * Keys are `Button size=\"touch-xl\"` (80px). That is not a decorative choice:\n * this is the control a cashier hits most often, usually without looking, while\n * a queue watches.\n */\nimport { type ReactNode } from 'react';\nimport Button from './Button';\nimport { appendKey, backspace } from './keypadInput';\n\nexport interface NumericKeypadProps {\n value: string;\n onChange: (next: string) => void;\n /** Renders a full-width Enter key below the pad when provided. */\n onEnter?: () => void;\n /** Label for that key — name the action (\"Tender\", \"Add\"), not \"Enter\". */\n enterLabel?: ReactNode;\n enterDisabled?: boolean;\n className?: string;\n}\n\nconst KEYS = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '.', '0'] as const;\n\nexport default function NumericKeypad({\n value, onChange, onEnter, enterLabel = 'Enter', enterDisabled, className = '',\n}: NumericKeypadProps) {\n /**\n * A rejected press notifies NOBODY.\n *\n * `appendKey` returns the value unchanged when a press is not allowed — a\n * third decimal place, a second point — and firing `onChange` with that\n * unchanged value reports a change that did not happen. The displayed number\n * is identical either way, so this is invisible on screen; what it corrupts\n * is everything downstream that treats \"onChange fired\" as \"the user did\n * something\": a dirty flag, a cleared validation error, a reset idle timer.\n */\n const press = (next: string) => {\n if (next !== value) onChange(next);\n };\n\n return (\n <div className={`grid grid-cols-3 gap-3 ${className}`.trim()}>\n {KEYS.map(key => (\n <Button\n key={key}\n size=\"touch-xl\"\n variant=\"secondary\"\n onClick={() => press(appendKey(value, key))}\n >\n {key}\n </Button>\n ))}\n <Button\n size=\"touch-xl\"\n variant=\"secondary\"\n aria-label=\"Backspace\"\n onClick={() => press(backspace(value))}\n >\n ⌫\n </Button>\n {onEnter && (\n <Button\n size=\"touch-xl\"\n variant=\"primary\"\n className=\"col-span-3\"\n disabled={enterDisabled}\n onClick={onEnter}\n >\n {enterLabel}\n </Button>\n )}\n </div>\n );\n}\n","/**\n * TileButton — a large, self-labelling tile for a grid of choices: a product in\n * a catalogue, a payment method, a register.\n *\n * Distinct from `Button` rather than a size of it, because the content model\n * differs: a Button holds one label on one line, a tile holds a title and a\n * subtitle stacked and left-aligned, and stays a fixed height so a grid of them\n * lines up whether or not each has a subtitle.\n *\n * Text is left-aligned, not centred: in a grid the eye scans down the left edge\n * looking for a name, and centring makes every row start somewhere different.\n */\nimport { forwardRef, type ButtonHTMLAttributes, type ReactNode } from 'react';\n\nexport type TileSize = 'md' | 'lg';\n\nexport interface TileButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'className' | 'title'> {\n /** Primary line — the thing being chosen. */\n title: ReactNode;\n /** Secondary line: a price, a count, a reason it is unavailable. */\n subtitle?: ReactNode;\n size?: TileSize;\n /** Draw as chosen. Uses a ring rather than a fill so the label stays legible. */\n selected?: boolean;\n className?: string;\n}\n\nconst SIZES: Record<TileSize, string> = {\n md: 'h-24 p-3',\n lg: 'h-32 p-4',\n};\n\nconst TileButton = forwardRef<HTMLButtonElement, TileButtonProps>(function TileButton(\n { title, subtitle, size = 'lg', selected = false, disabled, type = 'button', className = '', ...rest },\n ref,\n) {\n return (\n <button\n ref={ref}\n type={type}\n disabled={disabled}\n aria-pressed={selected || undefined}\n className={[\n 'flex w-full flex-col justify-between rounded-xl border text-left transition-colors',\n 'focus:outline-none focus:ring-2 focus:ring-blue-400/40',\n 'disabled:cursor-not-allowed disabled:opacity-50',\n selected ? 'border-blue-600 bg-blue-50 ring-2 ring-blue-400/40' : 'border-gray-200 bg-white hover:bg-gray-50',\n SIZES[size],\n className,\n ].filter(Boolean).join(' ')}\n {...rest}\n >\n <span className=\"line-clamp-2 font-medium text-gray-900\">{title}</span>\n {subtitle != null && <span className=\"text-sm text-gray-500\">{subtitle}</span>}\n </button>\n );\n});\n\nexport default TileButton;\n","/**\n * Segmented — a row of mutually exclusive options, all visible at once.\n *\n * It covers two things that look identical and behave differently, and the\n * difference is `name`:\n *\n * without `name` — a button group. A view toggle, a filter. The choice is a\n * UI mode, not data, and nothing submits it.\n * with `name` — real `<input type=\"radio\">` elements in a `radiogroup`.\n * Use this inside a form: it submits, it restores on back,\n * a password manager and a screen reader both understand it,\n * and arrow keys move between options the way a radio group\n * is expected to.\n *\n * Shipping one component rather than two is deliberate — the pair are visually\n * identical, and having two of them is how a form ends up with a button group\n * in it that submits nothing.\n */\nimport { useId, type ReactNode } from 'react';\n\nexport type SegmentedSize = 'sm' | 'md' | 'touch';\n\nexport interface SegmentedOption<T extends string = string> {\n value: T;\n label: ReactNode;\n icon?: ReactNode;\n disabled?: boolean;\n}\n\nexport interface SegmentedProps<T extends string = string> {\n value: T;\n onChange: (value: T) => void;\n options: SegmentedOption<T>[];\n /** Present as a real radio group under this field name. See the docstring. */\n name?: string;\n size?: SegmentedSize;\n /** Stretch to fill the container, each option an equal share. */\n block?: boolean;\n /** Accessible name for the group. */\n label?: string;\n className?: string;\n}\n\nconst SIZE: Record<SegmentedSize, string> = {\n sm: 'h-7 px-2.5 text-xs',\n md: 'h-9 px-3 text-sm',\n touch: 'h-14 px-5 text-base',\n};\n\nconst SELECTED = 'bg-white text-gray-900 shadow-sm';\nconst UNSELECTED = 'text-gray-500 hover:text-gray-700';\n\nexport default function Segmented<T extends string = string>({\n value, onChange, options, name, size = 'md', block = false, label, className = '',\n}: SegmentedProps<T>) {\n const groupId = useId();\n const track = `inline-flex items-center gap-1 rounded-lg bg-gray-100 p-1 ${block ? 'w-full' : ''} ${className}`.trim();\n const itemBase = `inline-flex items-center justify-center gap-1.5 rounded-md font-medium transition-colors ${block ? 'flex-1' : ''}`;\n\n if (name) {\n return (\n <div role=\"radiogroup\" aria-label={label} className={track}>\n {options.map(opt => {\n const id = `${groupId}-${opt.value}`;\n const on = opt.value === value;\n return (\n // The input is visually hidden rather than removed: it stays in the\n // tab order and keeps the label association, so the control behaves\n // like the radio group it actually is.\n <label\n key={opt.value}\n htmlFor={id}\n className={[\n itemBase, SIZE[size], on ? SELECTED : UNSELECTED,\n opt.disabled ? 'cursor-not-allowed opacity-40' : 'cursor-pointer',\n ].join(' ')}\n >\n <input\n id={id}\n type=\"radio\"\n name={name}\n value={opt.value}\n checked={on}\n disabled={opt.disabled}\n onChange={() => onChange(opt.value)}\n className=\"sr-only\"\n />\n {opt.icon}\n {opt.label}\n </label>\n );\n })}\n </div>\n );\n }\n\n return (\n <div role=\"group\" aria-label={label} className={track}>\n {options.map(opt => {\n const on = opt.value === value;\n return (\n <button\n key={opt.value}\n type=\"button\"\n aria-pressed={on}\n disabled={opt.disabled}\n onClick={() => onChange(opt.value)}\n className={[itemBase, SIZE[size], on ? SELECTED : UNSELECTED, 'disabled:cursor-not-allowed disabled:opacity-40'].join(' ')}\n >\n {opt.icon}\n {opt.label}\n </button>\n );\n })}\n </div>\n );\n}\n","/**\n * Switch — an on/off control that takes effect immediately.\n *\n * `Checkbox` is the one to use inside a form: it means \"this will be true when\n * you save\". A Switch means the change has already happened. Choosing the wrong\n * one tells the user the wrong thing about whether they still need to press\n * Save, so the distinction is worth keeping.\n *\n * Built on a real `<button role=\"switch\">` with `aria-checked` rather than a\n * styled checkbox, because that is what the state actually is and it keeps\n * keyboard and screen-reader behaviour without further work.\n */\nimport { forwardRef, useId, type ButtonHTMLAttributes, type ReactNode } from 'react';\n\nexport type SwitchSize = 'sm' | 'md' | 'touch';\n\nexport interface SwitchProps\n extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange' | 'type' | 'className'> {\n checked: boolean;\n onChange: (checked: boolean) => void;\n disabled?: boolean;\n size?: SwitchSize;\n /** Text beside the control. Clicking it toggles, as a label should. */\n label?: ReactNode;\n /** A line under the label for what the setting actually does. */\n hint?: ReactNode;\n id?: string;\n className?: string;\n}\n\nconst TRACK: Record<SwitchSize, string> = {\n sm: 'h-5 w-9',\n md: 'h-6 w-11',\n touch: 'h-8 w-14',\n};\n\nconst KNOB: Record<SwitchSize, string> = {\n sm: 'h-4 w-4',\n md: 'h-5 w-5',\n touch: 'h-7 w-7',\n};\n\n// Travel = track width − knob width − 2× the 2px inset.\nconst TRAVEL: Record<SwitchSize, string> = {\n sm: 'translate-x-4',\n md: 'translate-x-5',\n touch: 'translate-x-6',\n};\n\n/**\n * Forwards its ref, and spreads the rest onto the button.\n *\n * A form library hands a field three things: a change handler, a name, and a\n * ref it uses to move focus to the field when validation fails. The first was\n * here; the other two had nowhere to go, so this control could not be a form\n * field at all — which contradicts the kit's own guidance that its controls\n * drop into react-hook-form.\n */\nconst Switch = forwardRef<HTMLButtonElement, SwitchProps>(function Switch({\n checked, onChange, disabled = false, size = 'md', label, hint, id, className = '', ...rest\n}, ref) {\n const generated = useId();\n const switchId = id ?? generated;\n const hintId = hint ? `${switchId}-hint` : undefined;\n\n const control = (\n <button\n ref={ref}\n id={switchId}\n type=\"button\"\n role=\"switch\"\n aria-checked={checked}\n aria-describedby={hintId}\n disabled={disabled}\n onClick={() => onChange(!checked)}\n {...rest}\n className={[\n 'relative inline-flex shrink-0 items-center rounded-full p-0.5 transition-colors',\n 'focus:outline-none focus:ring-2 focus:ring-blue-400/40',\n 'disabled:cursor-not-allowed disabled:opacity-40',\n TRACK[size],\n checked ? 'bg-blue-600' : 'bg-gray-300',\n ].join(' ')}\n >\n <span\n className={[\n 'inline-block rounded-full bg-white shadow transition-transform',\n KNOB[size],\n checked ? TRAVEL[size] : 'translate-x-0',\n ].join(' ')}\n />\n </button>\n );\n\n if (!label && !hint) return <span className={className}>{control}</span>;\n\n return (\n <span className={`flex items-start gap-3 ${className}`.trim()}>\n {control}\n <span className=\"min-w-0\">\n {label && (\n <label htmlFor={switchId} className=\"block text-sm font-medium text-gray-800\">\n {label}\n </label>\n )}\n {hint && <span id={hintId} className=\"mt-0.5 block text-xs text-gray-500\">{hint}</span>}\n </span>\n </span>\n );\n});\n\nexport default Switch;\n","/**\n * InputNumber — a numeric field that reports a `number | null`.\n *\n * The whole difficulty is that a number and the text of a number are not the\n * same thing while someone is typing one.\n *\n * A controlled field that stores `Number(e.target.value)` and renders it back\n * destroys every intermediate state: typing \"1.\" parses to 1, re-renders as\n * \"1\", and the decimal point the user just pressed disappears. So does the \"-\"\n * of a negative number, and so does a trailing zero in \"1.50\". It looks correct\n * in review, it looks correct in a test that types \"1.5\" in one go, and it is\n * infuriating in use.\n *\n * So this keeps the RAW TEXT in local state and reports the parsed value\n * upward. The text is re-synced from the prop only when the prop describes a\n * different number than the text already does — which means a parent resetting\n * the field works, while a parent echoing back what the user typed does not\n * fight them mid-keystroke.\n *\n * Clamping is applied on BLUR, not on change: clamping while typing means\n * someone entering 25 into a field with `min={10}` gets their \"2\" rewritten to\n * \"10\" before they can press \"5\".\n */\nimport { forwardRef, useEffect, useRef, useState, type KeyboardEvent, type ReactNode } from 'react';\nimport { inputClasses, type InputSize } from './styles';\n\nexport interface InputNumberProps {\n value: number | null;\n onChange: (value: number | null) => void;\n min?: number;\n max?: number;\n /** Decimal places enforced on blur. */\n precision?: number;\n step?: number;\n disabled?: boolean;\n invalid?: boolean;\n placeholder?: string;\n size?: InputSize;\n /** Inside the field's edges — a currency mark, a unit. */\n prefix?: ReactNode;\n suffix?: ReactNode;\n id?: string;\n name?: string;\n className?: string;\n onBlur?: () => void;\n}\n\nconst format = (v: number | null, precision?: number): string =>\n v == null ? '' : precision != null ? v.toFixed(precision) : String(v);\n\n/** Parses \"\", \"-\", \"1.\" and \"1.50\" the way a half-typed number should be read. */\nfunction parse(text: string): number | null {\n const t = text.trim();\n if (t === '' || t === '-' || t === '.' || t === '-.') return null;\n const n = Number(t);\n return Number.isFinite(n) ? n : null;\n}\n\nconst InputNumber = forwardRef<HTMLInputElement, InputNumberProps>(function InputNumber(\n { value, onChange, min, max, precision, step, disabled, invalid, placeholder,\n size, prefix, suffix, id, name, className = '', onBlur },\n ref,\n) {\n const [text, setText] = useState(() => format(value, precision));\n const textRef = useRef(text);\n textRef.current = text;\n\n useEffect(() => {\n // Re-sync only when the incoming value is genuinely different from what the\n // text already represents. Comparing PARSED values, not strings, is what\n // stops \"1.\" being overwritten while the user is still typing it.\n if (parse(textRef.current) !== value) setText(format(value, precision));\n }, [value, precision]);\n\n const handleChange = (next: string) => {\n // Digits, one optional leading minus, one optional point. Rejecting the\n // keystroke outright beats accepting it and silently dropping it later.\n if (next !== '' && !/^-?\\d*\\.?\\d*$/.test(next)) return;\n setText(next);\n onChange(parse(next));\n };\n\n // A `type=\"number\"` field gets arrow-key stepping from the browser. This one\n // does not, and dropping to `type=\"text\"` must not cost the user a way to\n // adjust a quantity without reaching for the keyboard's digits. PageUp and\n // PageDown move by ten steps, which is the native behaviour too.\n const bump = (by: number) => {\n const from = parse(textRef.current) ?? 0;\n let next = from + by;\n if (min != null && next < min) next = min;\n if (max != null && next > max) next = max;\n // Round to the precision so repeated 0.1 steps do not accumulate float\n // noise into 0.30000000000000004.\n const places = precision ?? String(step ?? 1).split('.')[1]?.length ?? 0;\n next = Number(next.toFixed(places));\n setText(format(next, precision));\n onChange(next);\n };\n\n const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n const unit = step ?? 1;\n const by = event.key === 'ArrowUp' ? unit\n : event.key === 'ArrowDown' ? -unit\n : event.key === 'PageUp' ? unit * 10\n : event.key === 'PageDown' ? -unit * 10\n : null;\n if (by === null || disabled) return;\n // The browser would otherwise scroll the page on PageUp/PageDown and move\n // the caret on the arrows.\n event.preventDefault();\n bump(by);\n };\n\n const handleBlur = () => {\n const parsed = parse(text);\n if (parsed == null) {\n setText('');\n onChange(null);\n } else {\n let v = parsed;\n if (min != null && v < min) v = min;\n if (max != null && v > max) v = max;\n // Round to the field's precision BEFORE reporting it. `format` was\n // already rounding for display, so a precision-2 field given 12.345\n // showed \"12.35\" and left the consumer holding 12.345 — a price field\n // that posts a different number from the one on screen.\n if (precision != null) v = Number(v.toFixed(precision));\n setText(format(v, precision));\n if (v !== parsed) onChange(v);\n }\n onBlur?.();\n };\n\n const field = (\n <input\n ref={ref}\n id={id}\n name={name}\n // `type=\"text\"` with a numeric inputMode, not `type=\"number\"`: a number\n // input silently discards non-numeric text (so the buffer above could\n // never see \"1.\"), scrolls the value on a stray wheel event, and renders\n // spinners that are a 12px hit target.\n type=\"text\"\n inputMode={precision === 0 ? 'numeric' : 'decimal'}\n value={text}\n disabled={disabled}\n placeholder={placeholder}\n step={step}\n // The role is claimed only because the keys behind it are implemented —\n // an element that says spinbutton and ignores the arrows is worse than\n // one that says textbox and does the same.\n role=\"spinbutton\"\n aria-valuenow={value ?? undefined}\n aria-valuemin={min}\n aria-valuemax={max}\n // A spinbutton's value is announced from aria-valuenow, which is a bare\n // number. This carries the formatting the user can see — \"1,250.00\" and\n // the currency the prefix is showing — so the two agree.\n aria-valuetext={value == null ? undefined : format(value, precision)}\n aria-invalid={invalid || undefined}\n onChange={e => handleChange(e.target.value)}\n onKeyDown={handleKeyDown}\n onBlur={handleBlur}\n className={inputClasses({\n invalid,\n size,\n className: [prefix ? 'pl-7' : '', suffix ? 'pr-9' : '', 'text-right tabular-nums', className]\n .filter(Boolean).join(' '),\n })}\n />\n );\n\n if (!prefix && !suffix) return field;\n return (\n <div className=\"relative\">\n {prefix && <span className=\"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-sm text-gray-500\">{prefix}</span>}\n {field}\n {suffix && <span className=\"pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 text-sm text-gray-500\">{suffix}</span>}\n </div>\n );\n});\n\nexport default InputNumber;\n","/**\n * FilePicker — choose files and list them. It does NOT upload.\n *\n * That is the entire design. An uploader that owns transport has to own retry,\n * progress, cancellation, auth and the endpoint, and every consumer ends up\n * fighting a piece of it. This hands the caller a `File[]` and stops; the form\n * submits them however it already submits everything else.\n *\n * Rejections are reported, never silent. A file dropped for being too large or\n * the wrong type is the case where a user is most certain they did the thing\n * and most confused that nothing happened.\n */\nimport { useId, useRef, useState, type DragEvent, type ReactNode } from 'react';\nimport { mediaFileName } from './mediaShared';\n\nexport interface FilePickerProps {\n files: File[];\n onChange: (files: File[]) => void;\n /** `accept` for the native picker, e.g. \"image/*,.pdf\". */\n accept?: string;\n multiple?: boolean;\n /** Rejected above this, with the reason shown. */\n maxSizeBytes?: number;\n /** Rejected beyond this many files total. */\n maxFiles?: number;\n disabled?: boolean;\n label?: ReactNode;\n hint?: ReactNode;\n error?: ReactNode;\n className?: string;\n}\n\nconst humanSize = (bytes: number): string => {\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${Math.round(bytes / 1024)} KB`;\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n};\n\nexport default function FilePicker({\n files, onChange, accept, multiple = true, maxSizeBytes, maxFiles,\n disabled = false, label, hint, error, className = '',\n}: FilePickerProps) {\n const inputRef = useRef<HTMLInputElement>(null);\n const inputId = useId();\n const [dragging, setDragging] = useState(false);\n const [rejected, setRejected] = useState<string[]>([]);\n\n const add = (incoming: FileList | null) => {\n if (!incoming || incoming.length === 0) return;\n const reasons: string[] = [];\n const accepted: File[] = [];\n\n for (const file of Array.from(incoming)) {\n if (maxSizeBytes != null && file.size > maxSizeBytes) {\n reasons.push(`${mediaFileName(file.name)} is ${humanSize(file.size)} — the limit is ${humanSize(maxSizeBytes)}`);\n continue;\n }\n if (maxFiles != null && files.length + accepted.length >= maxFiles) {\n reasons.push(`${mediaFileName(file.name)} was not added — ${maxFiles} files is the limit`);\n continue;\n }\n accepted.push(file);\n }\n\n setRejected(reasons);\n if (accepted.length) onChange(multiple ? [...files, ...accepted] : accepted.slice(0, 1));\n // Reset the native input so re-picking the SAME file fires change again —\n // without this, removing a file and re-adding it appears to do nothing.\n if (inputRef.current) inputRef.current.value = '';\n };\n\n const onDrop = (e: DragEvent) => {\n e.preventDefault();\n setDragging(false);\n if (!disabled) add(e.dataTransfer.files);\n };\n\n return (\n <div className={className}>\n {label && <label htmlFor={inputId} className=\"mb-1 block text-sm font-medium text-gray-700\">{label}</label>}\n\n <div\n onDragOver={e => { e.preventDefault(); if (!disabled) setDragging(true); }}\n onDragLeave={() => setDragging(false)}\n onDrop={onDrop}\n className={[\n 'rounded-lg border border-dashed px-4 py-6 text-center transition-colors',\n dragging ? 'border-blue-400 bg-blue-50' : 'border-gray-300 bg-white',\n disabled ? 'opacity-60' : '',\n ].filter(Boolean).join(' ')}\n >\n <input\n ref={inputRef}\n id={inputId}\n type=\"file\"\n accept={accept}\n multiple={multiple}\n disabled={disabled}\n onChange={e => add(e.target.files)}\n className=\"sr-only\"\n />\n <button\n type=\"button\"\n disabled={disabled}\n onClick={() => inputRef.current?.click()}\n className=\"text-sm font-medium text-blue-600 hover:text-blue-700 disabled:cursor-not-allowed\"\n >\n Choose {multiple ? 'files' : 'a file'}\n </button>\n <span className=\"text-sm text-gray-500\"> or drag them here</span>\n {hint && <p className=\"mt-1 text-xs text-gray-500\">{hint}</p>}\n </div>\n\n {files.length > 0 && (\n <ul className=\"mt-2 flex flex-col gap-1\">\n {files.map((file, i) => (\n <li key={`${file.name}-${i}`} className=\"flex items-center justify-between gap-3 rounded-md bg-gray-50 px-3 py-2\">\n <span className=\"min-w-0 flex-1 truncate text-sm text-gray-800\" title={file.name}>{file.name}</span>\n <span className=\"shrink-0 text-xs tabular-nums text-gray-500\">{humanSize(file.size)}</span>\n <button\n type=\"button\"\n disabled={disabled}\n onClick={() => { setRejected([]); onChange(files.filter((_, j) => j !== i)); }}\n aria-label={`Remove ${file.name}`}\n className=\"shrink-0 text-gray-400 hover:text-gray-600\"\n >\n <svg className=\"h-4 w-4\" viewBox=\"0 0 20 20\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" aria-hidden=\"true\">\n <path d=\"M6 6l8 8M14 6l-8 8\" />\n </svg>\n </button>\n </li>\n ))}\n </ul>\n )}\n\n {rejected.length > 0 && (\n <ul className=\"mt-2 flex flex-col gap-0.5\">\n {rejected.map(reason => <li key={reason} className=\"text-xs text-red-600\">{reason}</li>)}\n </ul>\n )}\n {error && <p className=\"mt-1 text-xs text-red-600\">{error}</p>}\n </div>\n );\n}\n","/**\n * Fixed-viewport dropdown positioning, shared by the combobox-style form\n * controls (SearchableSelect, TagInput). Promoted out of SearchableSelect\n * verbatim when TagInput needed the identical logic — the flip/track/clamp\n * behaviour is the kind of thing that drifts when copied.\n */\nimport { useLayoutEffect, useState, type RefObject } from 'react';\n\n/** `max-w-[28rem]` on the menu, as a number for the fit math. */\nexport const POPUP_MAX_WIDTH = 448;\n/** Menu's own max height (former `max-h-60` = 15rem). Capped smaller when the\n * viewport is tight. */\nexport const MENU_MAX_HEIGHT = 240;\n/** Gap between the trigger and the menu, and the viewport safety margin. */\nconst MENU_GAP = 4;\nconst VIEWPORT_MARGIN = 8;\n\nexport interface MenuPos {\n left?: number;\n right?: number;\n top?: number;\n bottom?: number;\n minWidth: number;\n maxHeight: number;\n}\n\n/**\n * Compute the menu's fixed-viewport position from the trigger rect while the\n * dropdown is open, re-running on scroll (capture, so nested form-scroll\n * containers count), resize, and every animation frame the trigger moves so it\n * tracks a moving trigger. Anchors below the trigger by default, flips above\n * when below is cramped and above has more room, and flips to right-aligned\n * when the max width wouldn't fit to the right of the trigger's left edge.\n */\nexport function useDropdownPosition(triggerRef: RefObject<HTMLElement | null>, open: boolean): MenuPos | null {\n const [pos, setPos] = useState<MenuPos | null>(null);\n useLayoutEffect(() => {\n if (!open) { setPos(null); return; }\n // Remember the last trigger rect the rAF poll acted on, so the idle loop\n // recomputes only when the trigger has actually moved.\n let lastLeft = NaN, lastTop = NaN, lastRight = NaN, lastBottom = NaN;\n const compute = () => {\n const rect = triggerRef.current?.getBoundingClientRect();\n if (!rect) return;\n lastLeft = rect.left; lastTop = rect.top; lastRight = rect.right; lastBottom = rect.bottom;\n const spaceBelow = window.innerHeight - rect.bottom - MENU_GAP - VIEWPORT_MARGIN;\n const spaceAbove = rect.top - MENU_GAP - VIEWPORT_MARGIN;\n const placeAbove = spaceBelow < Math.min(MENU_MAX_HEIGHT, 160) && spaceAbove > spaceBelow;\n const maxHeight = Math.max(96, Math.min(MENU_MAX_HEIGHT, placeAbove ? spaceAbove : spaceBelow));\n const next: MenuPos = { minWidth: rect.width, maxHeight };\n if (window.innerWidth - rect.left < POPUP_MAX_WIDTH) {\n next.right = Math.max(VIEWPORT_MARGIN, window.innerWidth - rect.right);\n } else {\n next.left = Math.max(VIEWPORT_MARGIN, rect.left);\n }\n if (placeAbove) next.bottom = window.innerHeight - rect.top + MENU_GAP;\n else next.top = rect.bottom + MENU_GAP;\n setPos(next);\n };\n compute();\n // Dragging a shell window moves the trigger via a CSS transform on an\n // ancestor — that fires neither scroll nor resize, so the listeners below\n // never see it and the menu would hang at its open-time spot while the\n // window slides out from under it. Poll the trigger rect each animation\n // frame and recompute when it shifts, so the menu tracks the window\n // through a drag (and any other transform-/animation-driven move). The\n // rect dirty-check keeps the idle loop cheap when nothing is moving.\n let raf = requestAnimationFrame(function tick() {\n const rect = triggerRef.current?.getBoundingClientRect();\n if (rect && (rect.left !== lastLeft || rect.top !== lastTop || rect.right !== lastRight || rect.bottom !== lastBottom)) {\n compute();\n }\n raf = requestAnimationFrame(tick);\n });\n window.addEventListener('scroll', compute, true);\n window.addEventListener('resize', compute);\n return () => {\n cancelAnimationFrame(raf);\n window.removeEventListener('scroll', compute, true);\n window.removeEventListener('resize', compute);\n };\n }, [open, triggerRef]);\n return pos;\n}\n","/**\n * SearchableSelect — combobox-style form control. Looks like a normal form\n * `<input>` (so it drops in alongside other form fields), but typing filters\n * the options list in a frosted-glass dropdown. Promoted from the EFFICIENT\n * admin portal, where it fronts every entity picker.\n *\n * Use it when the option list is small enough to load all at once; for\n * server-backed lists, wire `onSearchChange` to a debounced query and keep\n * feeding the latest page through `options` — the component keeps working\n * as a dumb view over whatever options it's given.\n *\n * The dropdown is portaled to `document.body` and positioned `fixed` at the\n * trigger's viewport rect. Rendering it in place would let any scrolling /\n * `overflow-hidden` ancestor (every form's scroll container, a window panel)\n * clip it — the classic \"the list is cut off by the modal footer\" bug. See\n * `PopupMenu`'s `portal` prop for the same reasoning.\n */\nimport { useState, useRef, useMemo, useEffect, useLayoutEffect, type ReactNode } from 'react';\nimport { createPortal } from 'react-dom';\nimport { glassStyle } from '../utils/glass';\nimport { INPUT_BASE } from '../forms/styles';\nimport { useDropdownPosition, POPUP_MAX_WIDTH, MENU_MAX_HEIGHT } from '../forms/dropdownPosition';\n\nexport interface SearchableOption {\n value: string;\n label: string;\n /** Optional secondary text rendered greyed-out on the right of the\n * option (e.g. an order date next to a proforma number). */\n sublabel?: string;\n}\n\nexport interface SearchableSelectProps {\n value: string;\n onChange: (value: string) => void;\n options: SearchableOption[];\n /** Placeholder shown when no value is selected and the field is empty. */\n placeholder?: string;\n /** Fallback placeholder text when no `placeholder` is provided and\n * nothing is selected. Clearing the selection is done via the hover\n * \"×\" on the input itself. */\n emptyOptionLabel?: string;\n /** Extra Tailwind classes appended to the input (error rings, custom\n * widths…). The base form-input styling is built in. */\n className?: string;\n disabled?: boolean;\n /** Optional id for label-for wiring. */\n id?: string;\n /** When true, the user can submit a value that isn't in `options` —\n * pressing Enter or clicking outside with non-empty search text\n * fires `onChange` with the typed string. The trigger then displays\n * that free-text value as-is. Default false: only listed options\n * can be picked, typing only filters. */\n allowFreeText?: boolean;\n /** Optional notifier fired whenever the user-typed search text changes\n * (including resets to ''). Lets a parent debounce the value and feed\n * a server-side query, so this component can still front a list that\n * is too large to load up-front. */\n onSearchChange?: (text: string) => void;\n /** Optional content rendered inside the trigger's right edge — to the\n * left of the clear button — when the dropdown is closed. Use for\n * compact status pills that should read alongside the selected label.\n * Hidden while the user is typing so the search text stays legible. */\n rightAdornment?: ReactNode;\n}\n\n// Menu geometry + the positioning hook live in `src/forms/dropdownPosition`,\n// shared with TagInput.\n\n/** Hover-revealed × that clears the selection. The parent is `relative\n * group`, so the button fades in on field hover only. mousedown (not\n * click) so the input's focus/open handlers never fire. */\nfunction ClearButton({ onClear, ariaLabel = 'Clear selection' }: { onClear: () => void; ariaLabel?: string }) {\n return (\n <button\n type=\"button\"\n aria-label={ariaLabel}\n onMouseDown={(e) => { e.preventDefault(); e.stopPropagation(); onClear(); }}\n className=\"absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity text-base leading-none\"\n >\n ×\n </button>\n );\n}\n\n// Trigger input styling is shared with the other form controls — see\n// `src/forms/styles.ts` (INPUT_BASE), which also picks up the dark-theme\n// input remaps from styles.css.\n\nexport default function SearchableSelect({\n value, onChange, options, placeholder, emptyOptionLabel = '— None —', className = '',\n disabled, id, allowFreeText = false, onSearchChange, rightAdornment,\n}: SearchableSelectProps) {\n const [open, setOpen] = useState(false);\n const [search, setSearchState] = useState('');\n // Wrap setSearch so every change also notifies the parent (when wired up).\n // Keeps the in-memory filtering working while letting a parent that wants\n // server-side search debounce + react to the same value.\n const setSearch = (next: string) => {\n setSearchState(next);\n onSearchChange?.(next);\n };\n const wrapRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLInputElement>(null);\n const menuRef = useRef<HTMLDivElement>(null);\n const adornRef = useRef<HTMLDivElement>(null);\n\n // Reserve input padding for the right adornment so long labels truncate\n // in front of it instead of running underneath. Measured (adornment width\n // varies — a pill, an icon row…) and re-checked per render; the state\n // setter bails when the number is unchanged.\n const [adornPad, setAdornPad] = useState<number | null>(null);\n useLayoutEffect(() => {\n if (!rightAdornment || open) { setAdornPad(null); return; }\n const w = adornRef.current?.offsetWidth ?? 0;\n // adornment width + its right offset (8px, or 32px when the clear ×\n // also reserves space) + a 6px gap to the text.\n setAdornPad(w ? w + (value && !disabled ? 32 : 8) + 6 : null);\n });\n\n const menuPos = useDropdownPosition(triggerRef, open);\n\n // Cached lookup so the closed-state display can show the current\n // selection's label without scanning options on every keystroke. In\n // free-text mode, fall back to the raw `value` so user-typed entries\n // round-trip visibly.\n const selectedLabel = useMemo(() => {\n const match = options.find(o => o.value === value);\n if (match) return match.label;\n return allowFreeText ? value : '';\n }, [options, value, allowFreeText]);\n\n // Close on outside pointer-down. The menu is portaled to `document.body`\n // (outside `wrapRef`), so the check has to treat clicks inside EITHER the\n // trigger wrap or the portaled menu as \"inside\" — otherwise scrolling the\n // menu or clicking a wide option would dismiss it.\n useEffect(() => {\n if (!open) return;\n const handler = (e: MouseEvent) => {\n const t = e.target as Node;\n if (wrapRef.current?.contains(t) || menuRef.current?.contains(t)) return;\n if (allowFreeText && search.trim() && search.trim() !== value) {\n onChange(search.trim());\n }\n setOpen(false);\n setSearch('');\n };\n document.addEventListener('mousedown', handler);\n return () => document.removeEventListener('mousedown', handler);\n }, [open, allowFreeText, search, value, onChange]);\n\n // Dedupe by `value` — call sites occasionally feed option lists that\n // contain the same id twice (a server returning a row twice across pages,\n // two cache writers landing on the same key, …). First-wins keeps the\n // earliest entry so duplicate React keys never happen downstream.\n const dedupedOptions = useMemo(() => {\n const seen = new Set<string>();\n const out: SearchableOption[] = [];\n for (const o of options) {\n if (seen.has(o.value)) continue;\n seen.add(o.value);\n out.push(o);\n }\n return out;\n }, [options]);\n\n const filtered = useMemo(() => {\n // Server-search mode (parent wired `onSearchChange`): the options ARE the\n // server's results for the typed text, so show them verbatim. Re-filtering\n // here on label/sublabel would silently hide valid matches the server made\n // on other fields (e.g. a row matched by a field that isn't the label),\n // making the search look capped.\n if (onSearchChange) return dedupedOptions;\n const q = search.trim().toLowerCase();\n if (!q) return dedupedOptions;\n return dedupedOptions.filter(o =>\n o.label.toLowerCase().includes(q) ||\n (o.sublabel?.toLowerCase().includes(q) ?? false)\n );\n }, [dedupedOptions, search, onSearchChange]);\n\n return (\n <div ref={wrapRef} className=\"relative group\">\n {/* Combobox-style trigger: shows the selected label when closed,\n and becomes the search field when focused — typing filters\n the option list directly, no separate search box. */}\n <input\n id={id}\n ref={triggerRef}\n type=\"text\"\n autoComplete=\"off\"\n role=\"combobox\"\n aria-expanded={open}\n value={open ? search : selectedLabel}\n onChange={e => { setSearch(e.target.value); setOpen(true); }}\n onFocus={() => { if (!disabled) { setSearch(''); setOpen(true); } }}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n if (filtered.length === 1) {\n onChange(filtered[0].value);\n setOpen(false);\n setSearch('');\n } else if (allowFreeText && search.trim()) {\n onChange(search.trim());\n setOpen(false);\n setSearch('');\n triggerRef.current?.blur();\n }\n } else if (e.key === 'Escape') {\n setOpen(false);\n setSearch('');\n triggerRef.current?.blur();\n } else if (e.key === 'Tab') {\n // Tab moves focus to the next field; close/clear the dropdown so the\n // body-portaled results don't linger over the neighbour (BG#00359).\n // No preventDefault — let Tab advance focus as usual (covers\n // Shift+Tab too). The free-text-commit guard mirrors the outside-\n // mousedown handler so no new commit behaviour is introduced.\n if (allowFreeText && search.trim() && search.trim() !== value) {\n onChange(search.trim());\n }\n setOpen(false);\n setSearch('');\n }\n }}\n placeholder={placeholder || (emptyOptionLabel || 'Select…')}\n className={`${INPUT_BASE} ${className} ${value ? 'pr-8' : ''} ${disabled ? 'bg-gray-50 text-gray-400 cursor-not-allowed' : ''} truncate`}\n style={adornPad ? { paddingRight: adornPad } : undefined}\n disabled={disabled}\n />\n {value && !disabled && (\n <ClearButton onClear={() => { onChange(''); setOpen(false); setSearch(''); }} />\n )}\n {rightAdornment && !open && (\n <div ref={adornRef} className={`absolute top-1/2 -translate-y-1/2 ${value && !disabled ? 'right-8' : 'right-2'} flex items-center gap-1 flex-nowrap justify-end pointer-events-none`}>\n {rightAdornment}\n </div>\n )}\n {open && createPortal(\n <div\n ref={menuRef}\n className=\"fixed z-[400] rounded-2xl overflow-hidden\"\n style={{\n left: menuPos?.left,\n right: menuPos?.right,\n top: menuPos?.top,\n bottom: menuPos?.bottom,\n minWidth: menuPos?.minWidth,\n maxWidth: POPUP_MAX_WIDTH,\n width: 'max-content',\n // Hidden for the first paint until the layout effect measures the\n // trigger, so the menu never flashes at (0,0).\n visibility: menuPos ? undefined : 'hidden',\n ...glassStyle(),\n }}\n >\n <div className=\"overflow-y-auto\" style={{ maxHeight: menuPos?.maxHeight ?? MENU_MAX_HEIGHT }}>\n {filtered.length === 0 ? (\n <p className=\"px-3 py-3 text-sm text-gray-400 text-center\">No matches</p>\n ) : (\n filtered.map(o => (\n <button\n key={o.value}\n type=\"button\"\n onMouseDown={() => { onChange(o.value); setOpen(false); setSearch(''); }}\n className={`w-full text-left px-3 py-1.5 text-sm hover:bg-gray-50 flex items-center justify-between gap-2 whitespace-nowrap ${value === o.value ? 'text-blue-600 font-medium bg-blue-50/50' : 'text-gray-700'}`}\n >\n <span>{o.label}</span>\n {o.sublabel && <span className=\"text-xs text-gray-400 shrink-0\">{o.sublabel}</span>}\n </button>\n ))\n )}\n </div>\n </div>,\n document.body\n )}\n </div>\n );\n}\n","/**\n * TagInput — SearchableSelect's multi-value sibling. The field holds the\n * chosen values as removable chips with an inline text input after them;\n * typing filters the option list in the same portaled frosted dropdown, and\n * picking an option appends it. Assigning several categories, roles or\n * suppliers to a record is this shape, and each portal was one bad afternoon\n * away from hand-rolling it.\n *\n * Deliberate contracts, all matching SearchableSelect where the two overlap:\n * - Controlled: `value` is the array, `onChange` gets the whole next array.\n * - Values already chosen leave the option list; adding a value twice is a\n * no-op, so the array is always duplicate-free.\n * - `allowFreeText` commits the typed text on Enter / comma / Tab / outside\n * click. Off by default: only listed options can be picked.\n * - Backspace in an empty input removes the last chip — the convention every\n * tag field trains, and the keyboard path to removal.\n * - Picking from the list keeps the dropdown open (multi-add is the entire\n * point); Escape and outside clicks close it.\n */\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { glassStyle } from '../utils/glass';\nimport { inputClasses } from './styles';\nimport { MENU_MAX_HEIGHT, POPUP_MAX_WIDTH, useDropdownPosition } from './dropdownPosition';\n\nexport interface TagInputOption {\n value: string;\n label: string;\n}\n\nexport interface TagInputProps {\n value: string[];\n onChange: (value: string[]) => void;\n /** The pickable list. Omit it for a pure free-text tag field (with\n * `allowFreeText`), where the dropdown never renders. */\n options?: TagInputOption[];\n placeholder?: string;\n /** When true, Enter / comma / Tab / clicking away commits the typed text as\n * a tag of its own. Default false: only listed options can be picked. */\n allowFreeText?: boolean;\n /** Error state — red border + ring, matching Input. */\n invalid?: boolean;\n disabled?: boolean;\n /** Optional id for label-for wiring, applied to the inner text input. */\n id?: string;\n className?: string;\n}\n\nexport default function TagInput({\n value, onChange, options = [], placeholder, allowFreeText = false,\n invalid, disabled, id, className = '',\n}: TagInputProps) {\n const [open, setOpen] = useState(false);\n const [search, setSearch] = useState('');\n const wrapRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const menuRef = useRef<HTMLDivElement>(null);\n const menuPos = useDropdownPosition(wrapRef, open);\n\n const labelFor = (v: string) => options.find(o => o.value === v)?.label ?? v;\n\n // Chosen values leave the list; the remainder filters on the typed text.\n // Dedupe by value first for the same reason SearchableSelect does — a list\n // fed twice must not become duplicate React keys.\n const available = useMemo(() => {\n const seen = new Set<string>(value);\n const out: TagInputOption[] = [];\n const q = search.trim().toLowerCase();\n for (const o of options) {\n if (seen.has(o.value)) continue;\n seen.add(o.value);\n if (!q || o.label.toLowerCase().includes(q)) out.push(o);\n }\n return out;\n }, [options, value, search]);\n\n const add = (v: string) => {\n if (!v || value.includes(v)) { setSearch(''); return; }\n onChange([...value, v]);\n setSearch('');\n };\n const remove = (v: string) => onChange(value.filter(x => x !== v));\n const commitFreeText = () => {\n const t = search.trim();\n if (allowFreeText && t) add(t);\n else setSearch('');\n };\n\n // Close on outside pointer-down — the menu is portaled, so \"inside\" means\n // the field wrap OR the menu (see SearchableSelect).\n useEffect(() => {\n if (!open) return;\n const handler = (e: MouseEvent) => {\n const t = e.target as Node;\n if (wrapRef.current?.contains(t) || menuRef.current?.contains(t)) return;\n commitFreeText();\n setOpen(false);\n };\n document.addEventListener('mousedown', handler);\n return () => document.removeEventListener('mousedown', handler);\n });\n\n const hasMenu = options.length > 0;\n\n return (\n <div ref={wrapRef} className=\"relative\">\n {/* The field is the chips plus an inline input, wearing the shared form\n * styling. The focus ring is focus-within — the div itself never takes\n * focus, the inner input does (a click anywhere in the field lands it\n * there). */}\n <div\n onMouseDown={e => {\n if (disabled) return;\n // Let clicks on chip-remove buttons do their job; anything else\n // focuses the input, like clicking anywhere in a real text field.\n if ((e.target as HTMLElement).closest('button')) return;\n e.preventDefault();\n inputRef.current?.focus();\n }}\n className={inputClasses({\n invalid,\n className: `flex flex-wrap items-center gap-1 cursor-text focus-within:border-blue-400 focus-within:ring-2 focus-within:ring-blue-400/30 ${disabled ? 'bg-gray-50 cursor-not-allowed' : ''} ${className}`,\n })}\n >\n {value.map(v => (\n <span key={v} className=\"inline-flex max-w-full items-center gap-1 rounded bg-blue-50 px-1.5 py-0.5 text-xs font-medium text-blue-700\">\n <span className=\"truncate\">{labelFor(v)}</span>\n {!disabled && (\n <button\n type=\"button\"\n aria-label={`Remove ${labelFor(v)}`}\n onClick={() => remove(v)}\n className=\"text-blue-400 hover:text-red-500 focus:outline-none focus-visible:ring-1 focus-visible:ring-blue-500 rounded leading-none\"\n >\n ×\n </button>\n )}\n </span>\n ))}\n <input\n id={id}\n ref={inputRef}\n type=\"text\"\n autoComplete=\"off\"\n role=\"combobox\"\n aria-expanded={open && hasMenu}\n aria-invalid={invalid || undefined}\n disabled={disabled}\n value={search}\n placeholder={value.length === 0 ? placeholder : undefined}\n onChange={e => { setSearch(e.target.value); setOpen(true); }}\n onFocus={() => { if (!disabled && hasMenu) setOpen(true); }}\n onKeyDown={e => {\n if (e.key === 'Enter' || (e.key === ',' && allowFreeText)) {\n e.preventDefault();\n const q = search.trim();\n const matches = q ? available.filter(o => o.label.toLowerCase().includes(q.toLowerCase())) : [];\n if (matches.length === 1) add(matches[0].value);\n else commitFreeText();\n } else if (e.key === 'Backspace' && search === '' && value.length > 0) {\n remove(value[value.length - 1]);\n } else if (e.key === 'Escape') {\n setOpen(false);\n setSearch('');\n inputRef.current?.blur();\n } else if (e.key === 'Tab') {\n // No preventDefault — Tab advances focus; commit like the\n // outside-click path so the two agree (see SearchableSelect).\n commitFreeText();\n setOpen(false);\n }\n }}\n className=\"min-w-[8ch] flex-1 border-none bg-transparent p-0 text-sm text-gray-800 placeholder:text-gray-400 focus:outline-none focus:ring-0 disabled:cursor-not-allowed\"\n />\n </div>\n {open && hasMenu && createPortal(\n <div\n ref={menuRef}\n className=\"fixed z-[400] rounded-2xl overflow-hidden\"\n style={{\n left: menuPos?.left,\n right: menuPos?.right,\n top: menuPos?.top,\n bottom: menuPos?.bottom,\n minWidth: menuPos?.minWidth,\n maxWidth: POPUP_MAX_WIDTH,\n width: 'max-content',\n // Hidden for the first paint until the layout effect measures the\n // trigger, so the menu never flashes at (0,0).\n visibility: menuPos ? undefined : 'hidden',\n ...glassStyle(),\n }}\n >\n <div className=\"overflow-y-auto\" style={{ maxHeight: menuPos?.maxHeight ?? MENU_MAX_HEIGHT }}>\n {available.length === 0 ? (\n <p className=\"px-3 py-3 text-sm text-gray-400 text-center\">\n {options.length > 0 && value.length >= options.length ? 'All options selected' : 'No matches'}\n </p>\n ) : (\n available.map(o => (\n <button\n key={o.value}\n type=\"button\"\n // mousedown, not click: the field's own mousedown refocuses\n // the input, and by click time a re-render may have moved\n // this row. Same choice as SearchableSelect's options.\n onMouseDown={e => { e.preventDefault(); add(o.value); }}\n className=\"w-full text-left px-3 py-1.5 text-sm hover:bg-gray-50 text-gray-700 whitespace-nowrap\"\n >\n {o.label}\n </button>\n ))\n )}\n </div>\n </div>,\n document.body,\n )}\n </div>\n );\n}\n","/**\n * Card — the kit's standard surface: a rounded, bordered panel with optional\n * header and footer rows. StatCard is the dashboard variant (label + big value\n * + optional trend delta). Both are pure presentational components.\n */\nimport { useId, type CSSProperties, type ReactNode } from 'react';\n\n/** How much room the card gives its contents. `md` is the desktop default;\n * `lg` suits a touch layout, where the same density reads as cramped. */\nexport type CardPadding = 'none' | 'sm' | 'md' | 'lg';\n\nexport interface CardProps {\n children: ReactNode;\n /** Title row above the body, divided by a hairline. */\n header?: ReactNode;\n /** Row below the body, divided by a hairline. */\n footer?: ReactNode;\n /** Apply default padding to the body. Default true; set false to fill edge-to-edge. */\n /**\n * Render the header as a real heading at this level, and the card as a\n * region named by it.\n *\n * A card with a title IS a region of the page — the thing a screen-reader\n * user jumps between, and the thing a heading list is for. Without this the\n * title is a bold `<div>`: it looks like a heading to everyone who can see\n * it and is invisible to everyone navigating by structure.\n *\n * The level is the caller's because only the caller knows the page's\n * outline; a card inside a section that already has an `h2` needs an `h3`,\n * and guessing produces a jumbled outline rather than no outline.\n *\n * Omitted, nothing changes — the header stays a styled `div` and the card a\n * plain `div`, which is what every card shipping today is.\n */\n headingLevel?: 2 | 3 | 4 | 5 | 6;\n /**\n * Rendered at the far end of the header row, opposite the title — a count, a\n * filter, a \"View all\" link.\n *\n * It is a separate slot because it must stay OUT of the heading. Folded into\n * `header`, a card titled \"Team Members\" with a \"Team active\" chip beside it\n * announces itself as \"Team Members Team active\", and that is the string a\n * heading list shows and a voice command has to match.\n */\n headerActions?: ReactNode;\n /**\n * Names the card as a region when there is no header to name it — a card\n * whose title lives outside it, or which has none.\n *\n * Ignored when `headingLevel` is set: the heading is the better name, and\n * two names on one element is a contradiction rather than a belt and braces.\n */\n 'aria-label'?: string;\n padded?: boolean;\n /**\n * Padding scale. Takes precedence over `padded`, which remains supported and\n * is now the two-value shorthand for it (`true` → `md`, `false` → `none`).\n */\n padding?: CardPadding;\n className?: string;\n /**\n * Classes for the body, beside the padding this component supplies.\n *\n * The body is a wrapper this component owns, so `className` cannot reach it\n * — and a card whose contents are a column with a gap otherwise has to nest\n * a div inside the one already there just to say so.\n */\n bodyClassName?: string;\n /**\n * Inline style for the surface. For values that cannot be a class: an\n * animation delay computed per item, a measured height.\n */\n style?: CSSProperties;\n}\n\n// Header/footer padding scales WITH the body. A `p-6` body above a `px-4 py-3`\n// footer reads as a mistake, and the caller cannot fix it — those rows take no\n// className. `edge` is the horizontal/vertical pair for those rows.\nconst PADDING: Record<CardPadding, { body: string; edge: string }> = {\n none: { body: '', edge: 'px-4 py-3' },\n sm: { body: 'p-3', edge: 'px-3 py-2' },\n md: { body: 'p-4', edge: 'px-4 py-3' },\n lg: { body: 'p-6', edge: 'px-6 py-4' },\n};\n\nexport default function Card({\n children, header, footer, padded = true, padding, headingLevel, headerActions,\n 'aria-label': ariaLabel, className = '', bodyClassName = '', style,\n}: CardProps) {\n const p = PADDING[padding ?? (padded ? 'md' : 'none')];\n // Called unconditionally — it is a hook — and only used when the heading is.\n const headingId = useId();\n\n const titled = headingLevel != null && header != null;\n const Heading = (`h${headingLevel}` as 'h2');\n // A <section> is only a landmark once it has a name. Rendering one for every\n // card would turn a dashboard of twelve into twelve unnamed regions, which\n // is worse than none — so the element follows the name, not the other way.\n const named = titled || (ariaLabel != null && ariaLabel !== '');\n const Root = (named ? 'section' : 'div') as 'div';\n\n const surface = `rounded-lg border border-gray-200 bg-white shadow-sm ${className}`.trim();\n const headerCls = `border-b border-gray-100 ${p.edge} text-sm font-semibold text-gray-900`;\n\n return (\n <Root\n className={surface}\n style={style}\n {...(titled\n ? { 'aria-labelledby': headingId }\n : named\n ? { 'aria-label': ariaLabel }\n : {})}\n >\n {header != null && (\n headerActions != null ? (\n // With actions the row has to be a flex container, so the heading is\n // nested rather than being the row itself — and only the title is\n // inside it.\n <div className={`${headerCls} flex items-center justify-between gap-3`}>\n {titled ? <Heading id={headingId}>{header}</Heading> : <span>{header}</span>}\n {headerActions}\n </div>\n ) : titled ? (\n // Without them the heading carries the row's own styling rather than\n // nesting a second element, so the title is not two boxes deep.\n <Heading id={headingId} className={headerCls}>{header}</Heading>\n ) : (\n <div className={headerCls}>{header}</div>\n )\n )}\n <div className={[p.body, bodyClassName].filter(Boolean).join(' ')}>{children}</div>\n {footer && <div className={`border-t border-gray-100 ${p.edge}`}>{footer}</div>}\n </Root>\n );\n}\n\nexport interface StatCardProps {\n label: ReactNode;\n value: ReactNode;\n icon?: ReactNode;\n /** Trend pill, e.g. `{ value: '12%', direction: 'up' }`. */\n delta?: { value: ReactNode; direction: 'up' | 'down' | 'flat' };\n className?: string;\n}\n\nexport function StatCard({ label, value, icon, delta, className = '' }: StatCardProps) {\n const deltaColor =\n delta?.direction === 'up' ? 'text-green-600'\n : delta?.direction === 'down' ? 'text-red-600'\n : 'text-gray-500';\n const arrow = delta?.direction === 'up' ? '▲' : delta?.direction === 'down' ? '▼' : '→';\n return (\n <div className={`rounded-lg border border-gray-200 bg-white p-4 shadow-sm ${className}`.trim()}>\n <div className=\"flex items-center justify-between\">\n <span className=\"text-xs font-medium uppercase tracking-wide text-gray-500\">{label}</span>\n {icon && <span className=\"text-gray-400\">{icon}</span>}\n </div>\n <div className=\"mt-2 flex items-baseline gap-2\">\n <span className=\"text-2xl font-semibold text-gray-900\">{value}</span>\n {delta && <span className={`text-xs font-medium ${deltaColor}`}>{arrow} {delta.value}</span>}\n </div>\n </div>\n );\n}\n","/**\n * Text, Title, Paragraph — the typographic primitives.\n *\n * They exist so a page can say what a piece of text IS rather than which gray\n * it happens to be. That matters here more than it usually does: dark mode in\n * this package works by remapping utility CLASS NAMES, so text styled through a\n * token object or an inline colour is correct in light mode and permanently\n * wrong in dark. Every tone below resolves to a class the dark remaps know.\n *\n * `tone` is semantic, not decorative. `secondary` and `tertiary` are the two\n * steps of de-emphasis; `danger`/`success`/`warning` state what the text means,\n * never merely what colour it should be.\n */\nimport { type ElementType, type ReactNode } from 'react';\n\nexport type TextTone =\n | 'default' | 'secondary' | 'tertiary' | 'disabled'\n | 'danger' | 'success' | 'warning' | 'link' | 'inherit';\nexport type TextSize = 'xs' | 'sm' | 'md' | 'lg';\nexport type TextWeight = 'normal' | 'medium' | 'semibold';\n\nconst TONE: Record<TextTone, string> = {\n default: 'text-gray-900',\n secondary: 'text-gray-500',\n tertiary: 'text-gray-400',\n disabled: 'text-gray-300',\n danger: 'text-red-600',\n success: 'text-green-600',\n warning: 'text-amber-600',\n link: 'text-blue-600',\n // For text that must take the colour of whatever it sits inside — a solid\n // Banner, a coloured badge. Without this the only escape is a className,\n // which the dark remaps then fight.\n inherit: '',\n};\n\nconst SIZE: Record<TextSize, string> = {\n xs: 'text-xs',\n sm: 'text-sm',\n md: 'text-base',\n lg: 'text-lg',\n};\n\nconst WEIGHT: Record<TextWeight, string> = {\n normal: 'font-normal',\n medium: 'font-medium',\n semibold: 'font-semibold',\n};\n\nexport interface TextProps {\n children?: ReactNode;\n tone?: TextTone;\n size?: TextSize;\n weight?: TextWeight;\n /** Single-line ellipsis. Sets `title` so the full string stays readable. */\n truncate?: boolean;\n /** Render as something other than a span — `label`, `div`, `p`. */\n as?: ElementType;\n className?: string;\n htmlFor?: string;\n title?: string;\n}\n\nexport function Text({\n children, tone = 'default', size = 'sm', weight = 'normal', truncate = false,\n as: Tag = 'span', className = '', ...rest\n}: TextProps) {\n return (\n <Tag\n className={[TONE[tone], SIZE[size], WEIGHT[weight], truncate ? 'block truncate' : '', className]\n .filter(Boolean).join(' ')}\n // A truncated string is unreadable without this, and it is the one place\n // a title attribute is the right answer rather than a hidden affordance:\n // it restores text the layout removed, it does not hide anything new.\n title={rest.title ?? (truncate && typeof children === 'string' ? children : undefined)}\n htmlFor={rest.htmlFor}\n >\n {children}\n </Tag>\n );\n}\n\nexport type TitleLevel = 1 | 2 | 3 | 4 | 5;\n\nconst TITLE: Record<TitleLevel, string> = {\n 1: 'text-2xl font-semibold',\n 2: 'text-xl font-semibold',\n 3: 'text-lg font-semibold',\n 4: 'text-base font-semibold',\n 5: 'text-sm font-semibold',\n};\n\nexport interface TitleProps {\n children?: ReactNode;\n /** Heading level — drives BOTH the tag and the size, so the document\n * outline and the visual hierarchy cannot drift apart. */\n level?: TitleLevel;\n tone?: TextTone;\n className?: string;\n}\n\nexport function Title({ children, level = 2, tone = 'default', className = '' }: TitleProps) {\n const Tag = `h${level}` as ElementType;\n return (\n <Tag className={[TITLE[level], TONE[tone], className].filter(Boolean).join(' ')}>\n {children}\n </Tag>\n );\n}\n\nexport interface ParagraphProps {\n children?: ReactNode;\n tone?: TextTone;\n size?: TextSize;\n className?: string;\n}\n\n/** Body copy. Carries its own bottom margin so stacked paragraphs breathe;\n * the last one's margin is removed rather than left to collapse. */\nexport function Paragraph({ children, tone = 'secondary', size = 'sm', className = '' }: ParagraphProps) {\n return (\n <p className={[TONE[tone], SIZE[size], 'mb-2 last:mb-0', className].filter(Boolean).join(' ')}>\n {children}\n </p>\n );\n}\n","/**\n * Stack, Inline, Grid — layout without a class string at every call site.\n *\n * These replace the row/column/spacer components a page otherwise reaches for.\n * The whole value is in the `gap` prop being a CLOSED union mapped to literal\n * classes: Tailwind reads source text, so `gap-${n}` produces no style at all\n * and fails silently — everything simply sits flush and looks like a CSS bug.\n * A union means an unsupported gap is a compile error instead.\n *\n * Nothing here is a grid system. There are no 12ths and no `span` arithmetic;\n * `Grid` takes a column count and children occupy one cell each. A layout that\n * needs more than that should say so in its own classes rather than push this\n * toward a framework.\n */\nimport { type ReactNode } from 'react';\n\nexport type Gap = 0 | 1 | 2 | 3 | 4 | 6 | 8;\n\nconst GAP: Record<Gap, string> = {\n 0: 'gap-0', 1: 'gap-1', 2: 'gap-2', 3: 'gap-3', 4: 'gap-4', 6: 'gap-6', 8: 'gap-8',\n};\n\nexport type Align = 'start' | 'center' | 'end' | 'stretch' | 'baseline';\nconst ALIGN: Record<Align, string> = {\n start: 'items-start',\n center: 'items-center',\n end: 'items-end',\n stretch: 'items-stretch',\n baseline: 'items-baseline',\n};\n\nexport type Justify = 'start' | 'center' | 'end' | 'between' | 'around';\nconst JUSTIFY: Record<Justify, 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 StackProps {\n children?: ReactNode;\n gap?: Gap;\n align?: Align;\n justify?: Justify;\n className?: string;\n}\n\n/** Vertical flow. */\nexport function Stack({ children, gap = 4, align, justify, className = '' }: StackProps) {\n return (\n <div className={['flex flex-col', GAP[gap], align ? ALIGN[align] : '', justify ? JUSTIFY[justify] : '', className]\n .filter(Boolean).join(' ')}>\n {children}\n </div>\n );\n}\n\nexport interface InlineProps extends StackProps {\n /** Wrap onto a second line rather than overflowing. Default true — an\n * unwrapped row is how a toolbar quietly breaks a narrow screen. */\n wrap?: boolean;\n}\n\n/** Horizontal flow. Defaults to vertically centred, which is what a row of\n * mixed-height controls almost always wants. */\nexport function Inline({ children, gap = 2, align = 'center', justify, wrap = true, className = '' }: InlineProps) {\n return (\n <div className={['flex', wrap ? 'flex-wrap' : '', GAP[gap], ALIGN[align], justify ? JUSTIFY[justify] : '', className]\n .filter(Boolean).join(' ')}>\n {children}\n </div>\n );\n}\n\nexport type GridCols = 1 | 2 | 3 | 4 | 6 | 12;\n\n// Written out rather than interpolated. See the module docstring.\nconst COLS: Record<GridCols, string> = {\n 1: 'grid-cols-1', 2: 'grid-cols-2', 3: 'grid-cols-3',\n 4: 'grid-cols-4', 6: 'grid-cols-6', 12: 'grid-cols-12',\n};\n\n// Responsive steps, also literal. `sm:` is the 640px breakpoint, `lg:` 1024px.\nconst SM_COLS: Record<GridCols, string> = {\n 1: 'sm:grid-cols-1', 2: 'sm:grid-cols-2', 3: 'sm:grid-cols-3',\n 4: 'sm:grid-cols-4', 6: 'sm:grid-cols-6', 12: 'sm:grid-cols-12',\n};\nconst LG_COLS: Record<GridCols, string> = {\n 1: 'lg:grid-cols-1', 2: 'lg:grid-cols-2', 3: 'lg:grid-cols-3',\n 4: 'lg:grid-cols-4', 6: 'lg:grid-cols-6', 12: 'lg:grid-cols-12',\n};\n\nexport interface GridProps {\n children?: ReactNode;\n /** Columns at the narrowest width, and optionally from `sm`/`lg` up. */\n cols?: GridCols;\n smCols?: GridCols;\n lgCols?: GridCols;\n gap?: Gap;\n className?: string;\n}\n\nexport function Grid({ children, cols = 1, smCols, lgCols, gap = 4, className = '' }: GridProps) {\n return (\n <div className={['grid', COLS[cols], smCols ? SM_COLS[smCols] : '', lgCols ? LG_COLS[lgCols] : '', GAP[gap], className]\n .filter(Boolean).join(' ')}>\n {children}\n </div>\n );\n}\n","/**\n * Divider — a rule between sections, optionally with a label sitting in it.\n *\n * The vertical variant is for separating controls inside a row (a toolbar), and\n * needs a parent that gives it a height — it stretches, it does not define. A\n * bare vertical divider in a block container renders as nothing, which is the\n * one way to get this wrong.\n */\nimport { useId, type ReactNode } from 'react';\n\nexport type DividerSpacing = 'sm' | 'md' | 'lg';\n\nconst SPACING: Record<DividerSpacing, string> = {\n sm: 'my-2',\n md: 'my-4',\n lg: 'my-6',\n};\n\nexport interface DividerProps {\n orientation?: 'horizontal' | 'vertical';\n /** Label set into the rule. Horizontal only. */\n children?: ReactNode;\n align?: 'left' | 'center' | 'right';\n spacing?: DividerSpacing;\n className?: string;\n}\n\nexport default function Divider({\n orientation = 'horizontal', children, align = 'center', spacing = 'md', className = '',\n}: DividerProps) {\n // Unconditional, above the early returns — only the labelled form uses it,\n // but a hook cannot be called conditionally.\n const labelId = useId();\n\n if (orientation === 'vertical') {\n return (\n <span\n // Presentational: a vertical rule between two controls is a visual\n // grouping cue, not a structural break in the document.\n role=\"presentation\"\n className={`inline-block h-full min-h-[1em] w-px shrink-0 self-stretch bg-gray-200 ${className}`.trim()}\n />\n );\n }\n\n if (!children) {\n return <hr className={`border-0 border-t border-gray-200 ${SPACING[spacing]} ${className}`.trim()} />;\n }\n\n // Flex rules either side rather than a background trick, so the label sits on\n // the container's own background whatever that is.\n const before = align === 'left' ? 'w-4 shrink-0' : 'flex-1';\n const after = align === 'right' ? 'w-4 shrink-0' : 'flex-1';\n return (\n // `role=\"separator\"` because the <hr> above cannot be used once there is a\n // label to place inside the rule — and losing the element must not mean\n // losing what it meant. The two rules either side are decoration.\n //\n // The name is pointed at explicitly. `separator` takes its name from the\n // AUTHOR only — it is not one of the roles that names itself from its\n // contents — so the label sitting inside the element did NOT become the\n // separator's accessible name, and the rule was announced unnamed with the\n // text loose beside it. `aria-labelledby` is what actually attaches it.\n <div\n role=\"separator\"\n aria-orientation=\"horizontal\"\n aria-labelledby={labelId}\n className={`flex items-center gap-3 ${SPACING[spacing]} ${className}`.trim()}\n >\n <span aria-hidden=\"true\" className={`${before} border-t border-gray-200`} />\n <span id={labelId} className=\"shrink-0 text-xs font-medium text-gray-500\">{children}</span>\n <span aria-hidden=\"true\" className={`${after} border-t border-gray-200`} />\n </div>\n );\n}\n","/**\n * Skeleton — a placeholder shaped like the content that is loading.\n *\n * Worth preferring over a spinner wherever the shape is known: it reserves the\n * space, so the page does not jump when data lands, and it tells the user what\n * is coming rather than only that something is.\n *\n * Sizes go through inline `style`, not classes. A skeleton's dimensions are\n * arbitrary by definition — they match whatever they stand in for — and\n * arbitrary Tailwind values (`w-[213px]`) produce NO style in the compiled\n * stylesheet the design-sync previews use. This is the escape hatch\n * `.design-sync/conventions.md` documents, and the same one `Avatar` uses.\n */\nimport { type CSSProperties } from 'react';\n\nexport type SkeletonVariant = 'text' | 'rect' | 'circle';\n\nexport interface SkeletonProps {\n variant?: SkeletonVariant;\n /** CSS length. Defaults to full width for text/rect, and to `height` for a circle. */\n width?: number | string;\n height?: number | string;\n /** For `text`: how many lines. The last is short, the way real prose ends. */\n lines?: number;\n className?: string;\n}\n\nconst SHAPE: Record<SkeletonVariant, string> = {\n text: 'rounded',\n rect: 'rounded-md',\n circle: 'rounded-full',\n};\n\nconst len = (v: number | string | undefined): string | undefined =>\n typeof v === 'number' ? `${v}px` : v;\n\nexport default function Skeleton({ variant = 'text', width, height, lines = 1, className = '' }: SkeletonProps) {\n const base = `animate-pulse bg-gray-200 ${SHAPE[variant]} ${className}`.trim();\n\n if (variant === 'circle') {\n const d = len(height ?? width) ?? '2.5rem';\n return <span className={`inline-block ${base}`} style={{ width: d, height: d }} aria-hidden=\"true\" />;\n }\n\n const style: CSSProperties = {\n width: len(width) ?? '100%',\n height: len(height) ?? (variant === 'text' ? '1rem' : '4rem'),\n };\n\n if (variant === 'text' && lines > 1) {\n return (\n <span className=\"flex flex-col gap-2\" aria-hidden=\"true\">\n {Array.from({ length: lines }, (_, i) => (\n <span\n key={i}\n className={`block ${base}`}\n // A block of identical full-width bars reads as a table, not prose.\n style={{ ...style, width: i === lines - 1 ? '60%' : style.width }}\n />\n ))}\n </span>\n );\n }\n\n return <span className={`block ${base}`} style={style} aria-hidden=\"true\" />;\n}\n","/**\n * DescriptionList — a grid of label/value pairs, for the detail panel of a\n * record: an invoice header, a shipment's dates and references.\n *\n * Renders `<dl>/<dt>/<dd>`, which is what this content actually is. A table\n * would claim a row/column relationship that does not exist between one\n * shipment's carrier and its ETA, and a stack of divs says nothing at all.\n *\n * `columns` accepts a responsive object because these lists are long — a\n * thirteen-item shipment header at three columns on a desktop has to fall back\n * to one on a phone, and a fixed count makes one of those two layouts wrong.\n */\nimport { type ReactNode } from 'react';\n\nexport type DescriptionColumns = 1 | 2 | 3;\n\nexport interface DescriptionItem {\n label: ReactNode;\n value: ReactNode;\n /** Occupy the full row — for an address or a note among short fields. */\n span?: boolean;\n key?: string;\n}\n\nexport interface DescriptionListProps {\n items: DescriptionItem[];\n /** A count, or per-breakpoint counts. `{ base: 1, sm: 2, lg: 3 }`. */\n columns?: DescriptionColumns | { base?: DescriptionColumns; sm?: DescriptionColumns; lg?: DescriptionColumns };\n /** Hairline-separated rows in a bordered panel. */\n bordered?: boolean;\n size?: 'sm' | 'md';\n /**\n * Shown in place of a value that is `null`, `undefined` or `''`. Defaults to\n * an em dash.\n *\n * A blank cell answers nothing — and inside `bordered`, where the cell has\n * an outline of its own, it reads as a rendering fault rather than as \"there\n * is no tracking number\". Pass `emptyText={null}` for the old behaviour.\n */\n emptyText?: ReactNode;\n title?: ReactNode;\n className?: string;\n}\n\n// Literal maps: Tailwind reads source text, so an interpolated `grid-cols-${n}`\n// generates nothing and every column count silently collapses to one.\nconst COLS: Record<DescriptionColumns, string> = { 1: 'grid-cols-1', 2: 'grid-cols-2', 3: 'grid-cols-3' };\nconst SM: Record<DescriptionColumns, string> = { 1: 'sm:grid-cols-1', 2: 'sm:grid-cols-2', 3: 'sm:grid-cols-3' };\nconst LG: Record<DescriptionColumns, string> = { 1: 'lg:grid-cols-1', 2: 'lg:grid-cols-2', 3: 'lg:grid-cols-3' };\nconst SPAN: Record<DescriptionColumns, string> = { 1: 'col-span-1', 2: 'col-span-2', 3: 'col-span-3' };\n\nexport default function DescriptionList({\n items, columns = 1, bordered = false, size = 'md', title, className = '',\n emptyText: empty = '—',\n}: DescriptionListProps) {\n const resolved = typeof columns === 'number' ? { base: columns } : columns;\n const base = resolved.base ?? 1;\n // The widest count in play decides how far a spanning item stretches, so it\n // still fills the row at the breakpoint where the grid is widest.\n const widest = Math.max(base, resolved.sm ?? 0, resolved.lg ?? 0) as DescriptionColumns;\n\n const pad = size === 'sm' ? 'px-3 py-2' : 'px-4 py-3';\n const text = size === 'sm' ? 'text-xs' : 'text-sm';\n\n return (\n <div className={[bordered ? 'rounded-lg border border-gray-200 bg-white' : '', className].filter(Boolean).join(' ')}>\n {title && (\n <div className={`${pad} ${bordered ? 'border-b border-gray-100' : ''} text-sm font-semibold text-gray-900`.trim()}>\n {title}\n </div>\n )}\n <dl className={[\n 'grid',\n COLS[base],\n resolved.sm ? SM[resolved.sm] : '',\n resolved.lg ? LG[resolved.lg] : '',\n bordered ? '' : 'gap-x-6 gap-y-3',\n bordered ? '' : pad === 'px-4 py-3' ? 'py-1' : '',\n ].filter(Boolean).join(' ')}>\n {items.map((item, i) => (\n <div\n key={item.key ?? i}\n className={[\n item.span ? SPAN[widest] : '',\n bordered ? `${pad} border-b border-gray-100 last:border-b-0` : '',\n ].filter(Boolean).join(' ')}\n >\n <dt className={`${text} text-gray-500`}>{item.label}</dt>\n {/* min-w-0 so a long unbroken value (a tracking number) wraps\n inside its cell instead of widening the whole grid. */}\n <dd className={`mt-0.5 min-w-0 break-words ${text} text-gray-900`}>\n {item.value === null || item.value === undefined || item.value === ''\n ? empty\n : item.value}\n </dd>\n </div>\n ))}\n </dl>\n </div>\n );\n}\n","/**\n * Result — the full-page outcome state: a 404, a 403, a crashed boundary, a\n * completed checkout.\n *\n * `EmptyState` is the neighbour to know about. That one means \"this list has\n * nothing in it yet\", which is normal and usually actionable. This one means\n * something ENDED — succeeded, failed, or was refused — and it is the whole\n * page rather than a region of one. `ErrorPage` is this component wrapped in a\n * full-screen frame.\n */\nimport { type ReactNode } from 'react';\n\nexport type ResultStatus = 'success' | 'error' | 'warning' | 'info' | '404' | '403' | '500';\n\nexport interface ResultProps {\n status?: ResultStatus;\n title?: ReactNode;\n subTitle?: ReactNode;\n /** Actions — usually one primary route out. Always give the user one. */\n extra?: ReactNode;\n /** Replace the status glyph entirely. */\n icon?: ReactNode;\n children?: ReactNode;\n className?: string;\n}\n\ntype Tone = 'success' | 'error' | 'warning' | 'info';\n\nconst STATUS_TONE: Record<ResultStatus, Tone> = {\n success: 'success', error: 'error', warning: 'warning', info: 'info',\n // A missing page is not an error the user made, and colouring it red says it\n // was. Refused and broken are genuinely different from not-found.\n 404: 'info', 403: 'warning', 500: 'error',\n};\n\nconst TONE_CLASS: Record<Tone, string> = {\n success: 'text-green-600 bg-green-100',\n error: 'text-red-600 bg-red-100',\n warning: 'text-amber-600 bg-amber-100',\n info: 'text-blue-600 bg-blue-100',\n};\n\n/** Default copy, so the common cases need only `status`. */\nconst DEFAULT_TITLE: Partial<Record<ResultStatus, string>> = {\n 404: 'Page not found',\n 403: \"You don't have access to this\",\n 500: 'Something went wrong',\n};\n\nfunction StatusIcon({ tone }: { tone: Tone }) {\n const common = { className: 'h-6 w-6', fill: 'none', viewBox: '0 0 24 24', stroke: 'currentColor', strokeWidth: 1.5, 'aria-hidden': true } as const;\n switch (tone) {\n case 'success':\n return <svg {...common}><path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\" /></svg>;\n case 'error':\n return <svg {...common}><path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M6 18L18 6M6 6l12 12\" /></svg>;\n case 'warning':\n return <svg {...common}><path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z\" /></svg>;\n default:\n return <svg {...common}><path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z\" /></svg>;\n }\n}\n\nexport default function Result({\n status = 'info', title, subTitle, extra, icon, children, className = '',\n}: ResultProps) {\n const tone = STATUS_TONE[status];\n // WCAG 4.1.3. A Result that reports a failure is a status message: it appears\n // without the user moving focus, so a screen-reader user is told nothing\n // unless it announces itself. `alert` is assertive, which is right for a\n // failure and wrong for everything else — an outcome someone asked for\n // (a completed checkout) or a neutral one (an empty cart) would interrupt\n // whatever they were reading to say something they already expected.\n const announces = tone === 'error';\n return (\n <div\n role={announces ? 'alert' : undefined}\n className={`flex flex-col items-center justify-center px-6 py-12 text-center ${className}`.trim()}\n >\n <div className={`flex h-14 w-14 items-center justify-center rounded-full ${TONE_CLASS[tone]}`}>\n {icon ?? <StatusIcon tone={tone} />}\n </div>\n <h2 className=\"mt-4 text-lg font-semibold text-gray-900\">\n {title ?? DEFAULT_TITLE[status] ?? ''}\n </h2>\n {subTitle && <p className=\"mt-1 max-w-md text-sm text-gray-500\">{subTitle}</p>}\n {children && <div className=\"mt-4 w-full max-w-md text-left\">{children}</div>}\n {extra && <div className=\"mt-6 flex flex-wrap items-center justify-center gap-3\">{extra}</div>}\n </div>\n );\n}\n","/**\n * CountBadge — a count pinned to the corner of something: a cart icon, a nav\n * item with unread messages.\n *\n * Not to be confused with `ColoredBadge`, which is a standalone pill you put\n * text in, or `StatusBadge`, which maps a status string to a semantic tone.\n * This one WRAPS a child and overlays a number on it, and it is the only one of\n * the three that means \"how many\".\n *\n * Zero renders nothing by default. A badge reading \"0\" is noise that has to be\n * read before it can be dismissed, and it trains people to stop looking.\n */\nimport { type ReactNode } from 'react';\n\nexport type CountBadgeTone = 'danger' | 'neutral' | 'accent';\n\nconst TONE: Record<CountBadgeTone, string> = {\n danger: 'bg-red-600 text-white',\n neutral: 'bg-gray-600 text-white',\n accent: 'bg-blue-600 text-white',\n};\n\nexport interface CountBadgeProps {\n count?: number;\n /** Cap the display: 100 with `max={99}` shows \"99+\". */\n max?: number;\n /** A plain dot with no number — \"something changed\" without a quantity. */\n dot?: boolean;\n tone?: CountBadgeTone;\n /** Render at zero. Off by default. */\n showZero?: boolean;\n /** The thing being badged. Without one the badge renders inline on its own. */\n children?: ReactNode;\n className?: string;\n}\n\nexport default function CountBadge({\n count = 0, max = 99, dot = false, tone = 'danger', showZero = false, children, className = '',\n}: CountBadgeProps) {\n const visible = dot || count > 0 || (count === 0 && showZero);\n const label = count > max ? `${max}+` : String(count);\n\n const badge = visible ? (\n dot ? (\n <span\n className={`block h-2.5 w-2.5 rounded-full ring-2 ring-white ${TONE[tone]}`}\n // The child already carries the meaning (\"Notifications\"); an unlabelled\n // dot repeating it adds a second announcement of the same thing.\n aria-hidden={children ? 'true' : undefined}\n />\n ) : (\n <span\n className={`flex h-5 min-w-[1.25rem] items-center justify-center rounded-full px-1 text-xs font-semibold tabular-nums ring-2 ring-white ${TONE[tone]}`}\n >\n {label}\n </span>\n )\n ) : null;\n\n if (!children) return badge;\n\n return (\n <span className={`relative inline-flex ${className}`.trim()}>\n {children}\n {badge && <span className=\"absolute -right-1.5 -top-1.5 flex\">{badge}</span>}\n </span>\n );\n}\n","/**\n * Statistic — one measured number with its label, for a summary strip.\n *\n * `StatCard` is the card-shaped sibling: this plus a surface, a border and an\n * optional trend pill. They are kept separate because a row of six figures\n * inside one panel should not be six bordered cards, and a dashboard tile\n * should not be a bare number floating on the page. Use this when something\n * else already provides the container.\n *\n * Figures are `tabular-nums` so a column of them aligns on the decimal point\n * and a changing value does not make the layout twitch.\n */\nimport { type ReactNode } from 'react';\n\nexport type StatisticSize = 'sm' | 'md' | 'lg';\nexport type StatisticTone = 'default' | 'success' | 'danger' | 'muted';\n\nconst VALUE_SIZE: Record<StatisticSize, string> = {\n sm: 'text-lg',\n md: 'text-2xl',\n lg: 'text-3xl',\n};\n\nconst TONE: Record<StatisticTone, string> = {\n default: 'text-gray-900',\n success: 'text-green-600',\n danger: 'text-red-600',\n muted: 'text-gray-500',\n};\n\nexport interface StatisticProps {\n title?: ReactNode;\n value: ReactNode;\n /** Fixed decimal places. Applied only to a numeric `value`. */\n precision?: number;\n /** Sits before/after the figure at a smaller size — a currency mark, a unit. */\n prefix?: ReactNode;\n suffix?: ReactNode;\n tone?: StatisticTone;\n size?: StatisticSize;\n className?: string;\n}\n\nexport default function Statistic({\n title, value, precision, prefix, suffix, tone = 'default', size = 'md', className = '',\n}: StatisticProps) {\n const shown = typeof value === 'number' && precision != null ? value.toFixed(precision) : value;\n return (\n <div className={className}>\n {title && <div className=\"text-xs font-medium uppercase tracking-wide text-gray-500\">{title}</div>}\n <div className={`mt-1 flex items-baseline gap-1 ${TONE[tone]}`}>\n {prefix && <span className=\"text-sm\">{prefix}</span>}\n <span className={`font-semibold tabular-nums ${VALUE_SIZE[size]}`}>{shown}</span>\n {suffix && <span className=\"text-sm\">{suffix}</span>}\n </div>\n </div>\n );\n}\n","/**\n * Avatar — a circular user image with an initials fallback and an optional\n * status dot. AvatarGroup overlaps several into a stack with a \"+N\" overflow\n * chip. Sizes are applied via inline `style` (fixed px) so they don't depend\n * on arbitrary Tailwind classes.\n */\nimport { Children, useEffect, useState, type ReactNode } from 'react';\n\nexport type AvatarSize = 'xs' | 'sm' | 'md' | 'lg';\nexport type AvatarStatus = 'online' | 'offline' | 'busy' | 'away';\n\nconst SIZE_PX: Record<AvatarSize, number> = { xs: 24, sm: 32, md: 40, lg: 56 };\nconst STATUS_COLOR: Record<AvatarStatus, string> = {\n online: 'bg-green-500',\n offline: 'bg-gray-400',\n busy: 'bg-red-500',\n away: 'bg-amber-500',\n};\n\nexport interface AvatarProps {\n src?: string;\n /**\n * Who this is. It names the avatar to assistive technology and supplies the\n * initials when there is no usable image.\n *\n * Without it the avatar is hidden from assistive technology rather than\n * announced as \"question mark\" — an avatar nobody can name carries nothing\n * a screen-reader user needs.\n */\n name?: string;\n size?: AvatarSize;\n status?: AvatarStatus;\n className?: string;\n}\n\nfunction initials(name?: string): string {\n if (!name) return '?';\n const parts = name.trim().split(/\\s+/).filter(Boolean);\n if (parts.length === 0) return '?';\n const first = parts[0][0] ?? '';\n const last = parts.length > 1 ? parts[parts.length - 1][0] : '';\n return (first + last).toUpperCase() || '?';\n}\n\nexport default function Avatar({ src, name, size = 'md', status, className = '' }: AvatarProps) {\n const px = SIZE_PX[size];\n const dot = Math.max(8, Math.round(px * 0.28));\n\n // An avatar URL is the least reliable thing on the page — an upload that was\n // deleted, a CDN link that expired, a host that is briefly down. Without this\n // the browser renders its broken-image glyph and keeps it there for the rest\n // of the session; the initials are the whole point of having a fallback.\n const [broken, setBroken] = useState(false);\n useEffect(() => { setBroken(false); }, [src]);\n const showImage = Boolean(src) && !broken;\n\n return (\n // The role and the name live on the wrapper rather than on the <img>, so\n // that an avatar showing initials is announced the same way as one showing\n // a photo. The inner image is then decoration and takes an empty alt.\n <span\n className={`relative inline-flex shrink-0 ${className}`.trim()}\n style={{ width: px, height: px }}\n {...(name ? { role: 'img', 'aria-label': name } : { 'aria-hidden': true })}\n >\n {showImage ? (\n <img\n src={src}\n alt=\"\"\n onError={() => setBroken(true)}\n className=\"h-full w-full rounded-full object-cover\"\n />\n ) : (\n <span\n className=\"flex h-full w-full items-center justify-center rounded-full bg-gray-100 font-medium text-gray-600\"\n style={{ fontSize: Math.round(px * 0.4) }}\n >\n {initials(name)}\n </span>\n )}\n {status && (\n <span\n className={`absolute bottom-0 right-0 rounded-full ring-2 ring-white ${STATUS_COLOR[status]}`}\n style={{ width: dot, height: dot }}\n />\n )}\n </span>\n );\n}\n\nexport interface AvatarGroupProps {\n children: ReactNode;\n /** Show at most this many avatars; the rest collapse into a +N chip. */\n max?: number;\n /** Size of the children — used for the overlap + overflow-chip geometry.\n * Give the child Avatars this same size. */\n size?: AvatarSize;\n className?: string;\n}\n\nexport function AvatarGroup({ children, max, size = 'md', className = '' }: AvatarGroupProps) {\n const items = Children.toArray(children);\n const shown = max ? items.slice(0, max) : items;\n const overflow = max ? items.length - shown.length : 0;\n const px = SIZE_PX[size];\n const overlap = Math.round(px * 0.3);\n return (\n <div className={`flex items-center ${className}`.trim()}>\n {shown.map((child, i) => (\n <span key={i} className=\"rounded-full ring-2 ring-white\" style={{ marginLeft: i === 0 ? 0 : -overlap }}>\n {child}\n </span>\n ))}\n {overflow > 0 && (\n <span\n className=\"flex items-center justify-center rounded-full bg-gray-200 font-medium text-gray-600 ring-2 ring-white\"\n style={{ width: px, height: px, marginLeft: -overlap, fontSize: Math.round(px * 0.36) }}\n >\n +{overflow}\n </span>\n )}\n </div>\n );\n}\n","/**\n * Banner — a static, in-flow alert (the counterpart to the imperative `toast`).\n * Use it for form errors, page-level notices, empty-state callouts. Tone drives\n * the background/border/icon color; the text stays neutral so it reads in dark\n * mode. All tone classes are in the dark-mode allow-list.\n */\nimport { type ReactNode } from 'react';\n\nexport type BannerTone = 'info' | 'success' | 'warning' | 'danger';\n\n/**\n * How loudly the banner speaks.\n *\n * `subtle` (the default, and what every existing caller renders) is a tinted\n * panel that sits politely in a form. `solid` is a saturated full-contrast bar\n * for a condition the user must not miss and cannot work around — a till that\n * has lost the server and cannot take payment. The subtle version of that\n * message is a bug: a cashier who misses it takes money for a sale that will\n * not complete.\n */\nexport type BannerEmphasis = 'subtle' | 'solid';\n\nexport interface BannerProps {\n tone?: BannerTone;\n emphasis?: BannerEmphasis;\n title?: ReactNode;\n children?: ReactNode;\n /** Override the default tone icon. */\n icon?: ReactNode;\n /** When provided, renders a dismiss × that calls this. */\n onDismiss?: () => void;\n /**\n * Pin to the top of the scroll container while its content scrolls past.\n *\n * `position: sticky`, so the banner still occupies layout — it pushes the\n * page down rather than covering the first row of it, which is what a\n * blocking notice needs. Defeated by any ancestor with `overflow: hidden`.\n */\n sticky?: boolean;\n className?: string;\n}\n\nconst TONE: Record<BannerTone, { box: string; icon: string }> = {\n info: { box: 'bg-blue-50 border-blue-200', icon: 'text-blue-600' },\n success: { box: 'bg-green-50 border-green-200', icon: 'text-green-600' },\n warning: { box: 'bg-amber-50 border-amber-200', icon: 'text-amber-600' },\n danger: { box: 'bg-red-50 border-red-200', icon: 'text-red-600' },\n};\n\n// Solid tones are saturated -700 backgrounds with white text, all inside the\n// dark-mode allow-list. Text colour is carried on the root here (rather than by\n// the neutral gray-900/gray-700 the subtle variant uses on its children) so the\n// title, body and dismiss control all inherit it.\nconst TONE_SOLID: Record<BannerTone, string> = {\n info: 'bg-blue-700 border-blue-700 text-white',\n success: 'bg-green-700 border-green-700 text-white',\n warning: 'bg-amber-700 border-amber-700 text-white',\n danger: 'bg-red-700 border-red-700 text-white',\n};\n\nfunction ToneIcon({ tone }: { tone: BannerTone }) {\n const common = { className: 'h-5 w-5', viewBox: '0 0 20 20', fill: 'currentColor', 'aria-hidden': true } as const;\n switch (tone) {\n case 'success':\n return <svg {...common}><path fillRule=\"evenodd\" d=\"M10 18a8 8 0 100-16 8 8 0 000 16zm3.7-9.3a1 1 0 00-1.4-1.4L9 10.6 7.7 9.3a1 1 0 00-1.4 1.4l2 2a1 1 0 001.4 0l4-4z\" clipRule=\"evenodd\" /></svg>;\n case 'warning':\n return <svg {...common}><path fillRule=\"evenodd\" d=\"M8.3 2.8a2 2 0 013.4 0l6 10A2 2 0 0116 16H4a2 2 0 01-1.7-3.2l6-10zM10 7a1 1 0 00-1 1v3a1 1 0 102 0V8a1 1 0 00-1-1zm0 7a1 1 0 100 2 1 1 0 000-2z\" clipRule=\"evenodd\" /></svg>;\n case 'danger':\n return <svg {...common}><path fillRule=\"evenodd\" d=\"M10 18a8 8 0 100-16 8 8 0 000 16zM8.7 7.3a1 1 0 00-1.4 1.4L8.6 10l-1.3 1.3a1 1 0 101.4 1.4L10 11.4l1.3 1.3a1 1 0 001.4-1.4L11.4 10l1.3-1.3a1 1 0 10-1.4-1.4L10 8.6 8.7 7.3z\" clipRule=\"evenodd\" /></svg>;\n default:\n return <svg {...common}><path fillRule=\"evenodd\" d=\"M10 18a8 8 0 100-16 8 8 0 000 16zM9 9a1 1 0 012 0v4a1 1 0 11-2 0V9zm1-4a1 1 0 100 2 1 1 0 000-2z\" clipRule=\"evenodd\" /></svg>;\n }\n}\n\nexport default function Banner({\n tone = 'info', emphasis = 'subtle', title, children, icon, onDismiss, sticky = false, className = '',\n}: BannerProps) {\n const t = TONE[tone];\n const solid = emphasis === 'solid';\n // Every branch below collapses to the original string when emphasis is\n // 'subtle' and sticky is false, so existing callers render byte-identically.\n const box = solid ? TONE_SOLID[tone] : t.box;\n const stick = sticky ? 'sticky top-0 z-30' : '';\n return (\n <div\n role={tone === 'danger' ? 'alert' : 'status'}\n className={`${stick} flex items-start gap-3 rounded-lg border px-4 py-3 ${box} ${className}`.trim()}\n >\n <span className={`mt-0.5 shrink-0 ${solid ? '' : t.icon}`.trim()}>{icon ?? <ToneIcon tone={tone} />}</span>\n <div className=\"min-w-0 flex-1 text-sm\">\n {title && <div className={`font-semibold ${solid ? '' : 'text-gray-900'}`.trim()}>{title}</div>}\n {children && (\n <div className={`${solid ? '' : 'text-gray-700'} ${title ? 'mt-0.5' : ''}`.trim()}>{children}</div>\n )}\n </div>\n {onDismiss && (\n <button\n type=\"button\"\n onClick={onDismiss}\n aria-label=\"Dismiss\"\n className={`shrink-0 ${solid ? 'opacity-80 hover:opacity-100' : 'text-gray-400 hover:text-gray-600'}`}\n >\n <svg className=\"h-4 w-4\" viewBox=\"0 0 20 20\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" aria-hidden=\"true\">\n <path d=\"M6 6l8 8M14 6l-8 8\" />\n </svg>\n </button>\n )}\n </div>\n );\n}\n","/**\n * Tabs — a controlled in-content tab strip. The consumer owns the active id\n * (`value` + `onChange`) and renders the body for the active tab itself; this\n * component is just the strip. For app-level navigation use TopNav instead.\n *\n * `underline` (default) is the classic bordered tab row; `pill` is a segmented\n * control whose active segment fills with the accent (dark-mode safe).\n *\n * Wiring a panel: pass `idPrefix` and build the panel's id with `tabPanelId`.\n * The strip then points each tab at its panel with `aria-controls`, and gives\n * the tab a matching id the panel names itself with — the two halves of the\n * association ARIA wants, from one prop, so they cannot drift apart.\n *\n * Keyboard: the strip is one tab stop, and the arrow keys move between tabs\n * inside it (Home / End jump to the ends, disabled tabs are skipped, and the\n * ends wrap). This is the roving-tabindex pattern ARIA specifies for a\n * tablist, and it is not optional — `tabIndex={-1}` on the inactive tabs is\n * what keeps the strip to a single stop, so without the arrow keys those tabs\n * cannot be reached by keyboard at all.\n */\nimport { useRef, type KeyboardEvent, type ReactNode } from 'react';\n\n/**\n * The DOM id of a tab and of the panel it controls, derived from the same\n * prefix so a consumer rendering the panel cannot mismatch them.\n *\n * Exported rather than inlined: the panel is rendered by the CONSUMER, so both\n * sides have to agree on the string, and agreeing by convention in a comment\n * is how these drift.\n */\nexport const tabButtonId = (prefix: string, id: string): string => `${prefix}-tab-${id}`;\nexport const tabPanelId = (prefix: string, id: string): string => `${prefix}-panel-${id}`;\n\nexport interface TabItem {\n id: string;\n label: ReactNode;\n icon?: ReactNode;\n disabled?: boolean;\n}\n\nexport interface TabsProps {\n items: TabItem[];\n value: string;\n onChange: (id: string) => void;\n variant?: 'underline' | 'pill';\n /**\n * Enables the tab/panel association. With it each tab gains a stable id and\n * an `aria-controls` pointing at `tabPanelId(idPrefix, item.id)`; the\n * consumer gives its panel that id and names it with\n * `aria-labelledby={tabButtonId(idPrefix, item.id)}`.\n *\n * Omitted, nothing is emitted. A tab strip used purely as a filter — no\n * panel to point at — should not claim to control an element that does not\n * exist, which is a dangling reference rather than a helpful one.\n */\n idPrefix?: string;\n /**\n * Names the strip. A page with more than one — order sections above, media\n * types below — gives a screen-reader user two \"tab list\"s with nothing to\n * tell them apart, and there was no way to pass a name at all.\n */\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n className?: string;\n}\n\nconst LIST_CLASS: Record<'underline' | 'pill', string> = {\n underline: 'flex items-center gap-1 border-b border-gray-200',\n pill: 'inline-flex items-center gap-1 rounded-lg bg-gray-100 p-1',\n};\n\nfunction tabClass(variant: 'underline' | 'pill', active: boolean): string {\n if (variant === 'pill') {\n return `inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50 ${\n active ? 'bg-blue-600 text-white shadow-sm' : 'text-gray-600 hover:text-gray-900'\n }`;\n }\n return `-mb-px inline-flex items-center gap-1.5 border-b-2 px-3 py-2 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50 ${\n active\n ? 'border-blue-600 text-blue-600'\n : 'border-transparent text-gray-600 hover:border-gray-300 hover:text-gray-900'\n }`;\n}\n\nexport default function Tabs({\n items, value, onChange, variant = 'underline', idPrefix, className = '',\n 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy,\n}: TabsProps) {\n const buttons = useRef<(HTMLButtonElement | null)[]>([]);\n\n // Walks in `step` direction from `from`, wrapping, until it finds a tab that\n // can take focus. Bounded by the item count so an all-disabled strip — which\n // is a legitimate empty state — returns rather than spinning.\n const step = (from: number, direction: 1 | -1): number | null => {\n for (let i = 1; i <= items.length; i += 1) {\n const at = (((from + direction * i) % items.length) + items.length) % items.length;\n if (!items[at]?.disabled) return at;\n }\n return null;\n };\n\n const edge = (direction: 1 | -1): number | null => {\n const order = direction === 1 ? items.map((_, i) => i) : items.map((_, i) => items.length - 1 - i);\n for (const i of order) if (!items[i]?.disabled) return i;\n return null;\n };\n\n const onKeyDown = (event: KeyboardEvent<HTMLDivElement>): void => {\n const current = items.findIndex(t => t.id === value);\n let next: number | null = null;\n if (event.key === 'ArrowRight' || event.key === 'ArrowDown') next = step(current, 1);\n else if (event.key === 'ArrowLeft' || event.key === 'ArrowUp') next = step(current, -1);\n else if (event.key === 'Home') next = edge(1);\n else if (event.key === 'End') next = edge(-1);\n else return;\n\n event.preventDefault();\n if (next === null || next === current) return;\n onChange(items[next].id);\n // Selection follows focus, which is the automatic-activation form of the\n // pattern — right here, where switching a tab is cheap and the panel is\n // already rendered by the consumer.\n buttons.current[next]?.focus();\n };\n\n return (\n <div\n role=\"tablist\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n onKeyDown={onKeyDown}\n className={`${LIST_CLASS[variant]} ${className}`.trim()}\n >\n {items.map((t, i) => {\n const active = t.id === value;\n return (\n <button\n key={t.id}\n ref={el => { buttons.current[i] = el; }}\n type=\"button\"\n role=\"tab\"\n id={idPrefix ? tabButtonId(idPrefix, t.id) : undefined}\n aria-controls={idPrefix ? tabPanelId(idPrefix, t.id) : undefined}\n aria-selected={active}\n tabIndex={active ? 0 : -1}\n disabled={t.disabled}\n onClick={() => onChange(t.id)}\n className={tabClass(variant, active)}\n >\n {/* Decoration, and hidden from assistive technology on purpose: a\n TabItem must have a label, so the icon is always supplementary.\n Left exposed, a text or emoji icon is read as part of the tab's\n name — \"# Lines\" rather than \"Lines\". */}\n {t.icon && <span aria-hidden=\"true\" className=\"inline-flex shrink-0\">{t.icon}</span>}\n {t.label}\n </button>\n );\n })}\n </div>\n );\n}\n","/**\n * Stepper — the progress strip of a linear wizard. Tabs' one-way sibling: the\n * consumer owns the current step (`value`) and renders the body; this is just\n * the strip of numbered circles, connectors and labels.\n *\n * The one-way part is deliberate. Steps BEFORE the current one are complete\n * and — when `onChange` is wired — clickable, because going back is always\n * safe. Steps AFTER it are never clickable: moving forward is the wizard's\n * own Continue button's job, behind whatever validation the current step\n * demands. A strip that lets the user jump to \"Payment\" from \"Contact\" has\n * silently promised that nothing in between matters.\n *\n * Semantically an <ol> (the order is the meaning) with `aria-current=\"step\"`\n * on the current item. The circles — number or check — are decoration and\n * hidden from assistive technology; the label names the step.\n */\nimport { type ReactNode } from 'react';\n\nexport interface StepItem {\n id: string;\n label: ReactNode;\n /** Short line under the label. */\n description?: ReactNode;\n}\n\nexport interface StepperProps {\n items: StepItem[];\n /** The current step's id. Controlled — the consumer owns the wizard state. */\n value: string;\n /**\n * Lets the user return to a COMPLETED step by clicking it. Omitted, the\n * strip is purely an indicator and renders no controls at all.\n */\n onChange?: (id: string) => void;\n /** Names the strip for assistive technology, e.g. \"Checkout steps\". */\n 'aria-label'?: string;\n className?: string;\n}\n\nconst Check = () => (\n <svg viewBox=\"0 0 12 12\" fill=\"none\" className=\"h-3.5 w-3.5\" aria-hidden=\"true\">\n <path d=\"M2.5 6.5L5 9l4.5-5\" stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n);\n\nexport default function Stepper({\n items, value, onChange, 'aria-label': ariaLabel, className = '',\n}: StepperProps) {\n const currentIndex = Math.max(0, items.findIndex(s => s.id === value));\n\n return (\n <ol aria-label={ariaLabel} className={`flex items-start ${className}`.trim()}>\n {items.map((step, i) => {\n const state = i < currentIndex ? 'complete' : i === currentIndex ? 'current' : 'upcoming';\n const clickable = state === 'complete' && !!onChange;\n\n const circle = (\n <span\n aria-hidden=\"true\"\n className={[\n 'flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-xs font-semibold transition-colors',\n state === 'complete' ? 'bg-blue-600 text-white' : '',\n state === 'current' ? 'border-2 border-blue-600 bg-white text-blue-600' : '',\n state === 'upcoming' ? 'border-2 border-gray-300 bg-white text-gray-400' : '',\n ].filter(Boolean).join(' ')}\n >\n {state === 'complete' ? <Check /> : i + 1}\n </span>\n );\n const text = (\n <span className=\"min-w-0\">\n <span className={`block text-sm font-medium ${state === 'upcoming' ? 'text-gray-400' : 'text-gray-900'}`}>\n {step.label}\n </span>\n {step.description && (\n <span className=\"block text-xs text-gray-500\">{step.description}</span>\n )}\n </span>\n );\n\n return (\n <li\n key={step.id}\n aria-current={state === 'current' ? 'step' : undefined}\n className={`flex items-start gap-2 ${i > 0 ? 'flex-1' : ''}`}\n >\n {/* The connector belongs to the step it leads INTO, and takes the\n * incoming step's color: every line left of the current circle\n * reads as travelled. */}\n {i > 0 && (\n <span\n aria-hidden=\"true\"\n className={`mt-3.5 h-0.5 flex-1 rounded ${i <= currentIndex ? 'bg-blue-600' : 'bg-gray-200'}`}\n />\n )}\n {clickable ? (\n <button\n type=\"button\"\n onClick={() => onChange?.(step.id)}\n className=\"flex items-start gap-2 text-left rounded focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400\"\n >\n {circle}\n {text}\n </button>\n ) : (\n <span className=\"flex items-start gap-2\">\n {circle}\n {text}\n </span>\n )}\n </li>\n );\n })}\n </ol>\n );\n}\n","/**\n * Accordion — collapsible sections. Uncontrolled by default (seed with\n * `defaultOpenIds`); pass `openIds` + `onOpenChange` to drive it. `allowMultiple`\n * lets more than one section stay open at once.\n */\nimport { useState, type ReactNode } from 'react';\n\nexport interface AccordionItem {\n id: string;\n title: ReactNode;\n content: ReactNode;\n disabled?: boolean;\n}\n\nexport interface AccordionProps {\n items: AccordionItem[];\n defaultOpenIds?: string[];\n /** Controlled open set — when provided, the component stops tracking its own. */\n openIds?: string[];\n onOpenChange?: (ids: string[]) => void;\n allowMultiple?: boolean;\n className?: string;\n}\n\nexport default function Accordion({\n items, defaultOpenIds = [], openIds, onOpenChange, allowMultiple = false, className = '',\n}: AccordionProps) {\n const [internal, setInternal] = useState<string[]>(defaultOpenIds);\n const open = openIds ?? internal;\n\n const toggle = (id: string) => {\n const isOpen = open.includes(id);\n const next = isOpen ? open.filter(x => x !== id) : allowMultiple ? [...open, id] : [id];\n if (openIds === undefined) setInternal(next);\n onOpenChange?.(next);\n };\n\n return (\n <div className={`divide-y divide-gray-100 overflow-hidden rounded-lg border border-gray-200 ${className}`.trim()}>\n {items.map(item => {\n const isOpen = open.includes(item.id);\n return (\n <div key={item.id}>\n <button\n type=\"button\"\n disabled={item.disabled}\n aria-expanded={isOpen}\n onClick={() => toggle(item.id)}\n className=\"flex w-full items-center justify-between gap-3 px-4 py-3 text-left text-sm font-medium text-gray-900 hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50\"\n >\n <span>{item.title}</span>\n <svg\n className={`h-4 w-4 shrink-0 text-gray-400 transition-transform ${isOpen ? 'rotate-180' : ''}`}\n viewBox=\"0 0 20 20\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" aria-hidden=\"true\"\n >\n <path d=\"M6 8l4 4 4-4\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n </button>\n {isOpen && <div className=\"px-4 pb-3 text-sm text-gray-600\">{item.content}</div>}\n </div>\n );\n })}\n </div>\n );\n}\n","/**\n * Tooltip — a frosted hover/focus bubble around its trigger, using the shared\n * glassStyle() so it matches the kit's menus and follows dark mode. Static\n * previews show only the trigger (the bubble appears on interaction), like\n * ShortcutHelp.\n */\nimport { cloneElement, isValidElement, useEffect, useId, useRef, useState, type ReactNode } from 'react';\nimport { glassStyle } from '../utils/glass';\nimport { registerModalEscapeInterceptor } from './escapeInterceptors';\n\nexport interface TooltipProps {\n content: ReactNode;\n side?: 'top' | 'bottom' | 'left' | 'right';\n /** Hover delay before showing, in ms. */\n delay?: number;\n children: ReactNode;\n}\n\nconst SIDE_POS: Record<NonNullable<TooltipProps['side']>, string> = {\n top: 'bottom-full left-1/2 -translate-x-1/2 mb-1.5',\n bottom: 'top-full left-1/2 -translate-x-1/2 mt-1.5',\n left: 'right-full top-1/2 -translate-y-1/2 mr-1.5',\n right: 'left-full top-1/2 -translate-y-1/2 ml-1.5',\n};\n\nexport default function Tooltip({ content, side = 'top', delay = 200, children }: TooltipProps) {\n const [show, setShow] = useState(false);\n const timer = useRef<number | undefined>(undefined);\n const id = useId();\n const open = () => { timer.current = window.setTimeout(() => setShow(true), delay); };\n const close = () => { window.clearTimeout(timer.current); setShow(false); };\n // Cancel a pending open if the trigger unmounts mid-delay.\n useEffect(() => () => window.clearTimeout(timer.current), []);\n\n // WCAG 1.4.13 — content shown on hover or focus has to be dismissible\n // without moving the pointer or the focus.\n //\n // Through the interceptor seam rather than a listener of this component's\n // own, for two reasons. A tooltip opened by HOVER holds no focus, so a\n // keydown never reaches the trigger — that rules out an `onKeyDown` here.\n // And a plain `document` listener loses inside a window: `Modal` listens on\n // `window` in the CAPTURE phase and calls `stopPropagation()` when it closes,\n // and capture runs window before document, so Escape closed the whole window\n // and this never ran. Three portals render tooltips inside windows, which is\n // where the rule matters most.\n //\n // The seam is the one place that gets both: `Modal` consults it before\n // closing, and since 4.27.0 the Set drains itself when no shell is mounted,\n // so a till and a routed page are covered by the same registration.\n //\n // Registration order is stacking order, walked most-recent-first, so a\n // tooltip opened inside a dialog consumes the first Escape and the dialog\n // takes the second — which is the order the user expects.\n useEffect(() => {\n if (!show) return;\n return registerModalEscapeInterceptor(event => {\n if (event.key !== 'Escape') return false;\n close();\n return true;\n });\n }, [show]);\n\n // `aria-describedby` belongs on the TRIGGER, not on this wrapper. A screen\n // reader announces the description of the element that has focus, and focus\n // lands on the trigger — a describedby on an ancestor is not inherited, so\n // the tooltip was being read by nobody. Cloning is the only way to reach an\n // element the caller passed in; a caller who passes a fragment or a string\n // still gets the wrapper form, which at least keeps the association in the\n // accessibility tree.\n //\n // Merged with whatever the trigger already had rather than assigned over it:\n // `cloneElement` overwrites, so a caller who describes their own control\n // (`<button aria-describedby=\"password-rules\">`) lost that description as\n // soon as a tooltip was wrapped around it — and lost it permanently, since\n // the clone writes `undefined` while the bubble is closed.\n const describedBy = show ? id : undefined;\n const trigger = isValidElement<{ 'aria-describedby'?: string }>(children)\n ? cloneElement(children, {\n 'aria-describedby':\n [children.props['aria-describedby'], describedBy].filter(Boolean).join(' ') || undefined,\n })\n : children;\n\n return (\n <span\n className=\"relative inline-flex\"\n aria-describedby={isValidElement(children) ? undefined : describedBy}\n onMouseEnter={open}\n onMouseLeave={close}\n onFocus={open}\n onBlur={close}\n >\n {trigger}\n {show && (\n <span\n id={id}\n role=\"tooltip\"\n className={`pointer-events-none absolute z-[300] whitespace-nowrap rounded-md px-2 py-1 text-xs text-gray-800 ${SIDE_POS[side]}`}\n style={glassStyle()}\n >\n {content}\n </span>\n )}\n </span>\n );\n}\n","/**\n * StatusBadge — unified status pill across the system.\n *\n * The shell defines 8 semantic groups so the same concept always looks the\n * same color, regardless of which entity the status came from. The mapping\n * from raw status strings → groups is consumer-supplied via\n * <StatusBadgeProvider groups={...}>; when no provider is present (or a\n * status isn't mapped), the badge falls back to the \"neutral\" group.\n *\n * Dark-mode tone-down lives in index.css under [data-theme=\"dark\"].\n */\nimport { createContext, useContext, type ReactNode } from 'react';\n\nexport type SemanticGroup =\n | 'success' // finished, done, paid, approved, confirmed, received, active, production_ready, shipped\n | 'active' // in-progress, in production, in transit, posted, development\n | 'queued' // sent, arranged, loaded, submitted, pending_production\n | 'info' // initialized, delivered\n | 'pending' // pending, at_port (waiting / hold)\n | 'warning' // customs, partially_paid (needs attention)\n | 'danger' // overdue\n | 'draft' // draft (slightly more visible than neutral)\n | 'neutral'; // cancelled, inactive, rejected\n\n/**\n * The one table. `ColoredBadge` reads it too, through its `tone` prop, so a\n * badge given a tone directly and a badge given a status string that maps to\n * that tone are the same colour — which is the promise this component's\n * docblock makes and could not keep for anything that was not a status.\n */\nexport const GROUP_COLORS: Record<SemanticGroup, string> = {\n success: 'bg-green-100 text-green-800',\n active: 'bg-blue-100 text-blue-800',\n queued: 'bg-indigo-100 text-indigo-800',\n info: 'bg-sky-100 text-sky-800',\n pending: 'bg-yellow-100 text-yellow-800',\n warning: 'bg-orange-100 text-orange-800',\n danger: 'bg-red-100 text-red-800',\n draft: 'bg-gray-300 text-gray-800',\n neutral: 'bg-gray-100 text-gray-800',\n};\n\nconst StatusGroupsContext = createContext<Record<string, SemanticGroup>>({});\n\nexport function StatusBadgeProvider({\n groups,\n children,\n}: { groups: Record<string, SemanticGroup>; children: ReactNode }) {\n return <StatusGroupsContext.Provider value={groups}>{children}</StatusGroupsContext.Provider>;\n}\n\ninterface StatusBadgeProps {\n status: string;\n}\n\nexport default function StatusBadge({ status }: StatusBadgeProps) {\n const groups = useContext(StatusGroupsContext);\n const group = groups[status] ?? 'neutral';\n const color = GROUP_COLORS[group];\n const label = status.replace(/_/g, ' ').replace(/\\b\\w/g, c => c.toUpperCase());\n\n return (\n <span className={`inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium ${color}`}>\n {label}\n </span>\n );\n}\n","import { GROUP_COLORS, type SemanticGroup } from './StatusBadge';\nimport type { ReactNode } from 'react';\n\nexport interface ColoredBadgeProps {\n /**\n * A semantic tone, resolved through the same table `StatusBadge` uses — so a\n * badge given `tone=\"success\"` and one given a status string that maps to\n * success are the same green.\n *\n * Prefer this to `colorClass`. Raw classes are the escape hatch for a colour\n * the system has no name for, and every consumer reaching for them is a\n * place the theme system cannot follow.\n */\n tone?: SemanticGroup;\n /** Tailwind classes for the badge color, e.g. `bg-green-100 text-green-800`.\n * Wins over `tone` when both are given. */\n colorClass?: string;\n children: ReactNode;\n /** `xs` = 10px (dense list cells), `sm` = 12px / px-2 (default), `md` =\n * 12px / px-2.5 (matches StatusBadge). */\n size?: 'xs' | 'sm' | 'md';\n /** Capitalize each word — useful for raw status strings like `in_progress`\n * (rendered as `In Progress`). Default false. */\n capitalize?: boolean;\n /**\n * Render a close control — a filter chip the user can drop.\n *\n * Its accessible name is derived from the badge's own text: \"Remove Winter\n * tyres\", not \"Remove\". A row of filter chips otherwise gives a screen-reader\n * user five identical buttons and no way to tell which one drops which\n * filter. `closeLabel` overrides it, and is required in practice whenever\n * the children are not plain text — there is nothing to derive from.\n */\n closable?: boolean;\n onClose?: () => void;\n closeLabel?: string;\n className?: string;\n}\n\n/**\n * ColoredBadge — a small rounded-full pill. Give it a `tone` from the shell's\n * semantic vocabulary, or raw Tailwind classes when the colour has no name.\n *\n * Counterpart to StatusBadge, which takes a domain status STRING and maps it\n * through a provider. Both read the same colour table, so the two never\n * disagree about what success looks like.\n */\nexport default function ColoredBadge({\n colorClass, tone, children, size = 'sm', capitalize = false,\n closable = false, onClose, closeLabel, className = '',\n}: ColoredBadgeProps) {\n // Explicit beats semantic: a caller who passed raw classes did so to say\n // something the tone vocabulary cannot. Neither given is neutral, which is\n // what an unlabelled pill has always looked like.\n const colour = colorClass ?? GROUP_COLORS[tone ?? 'neutral'];\n const sizeCls =\n size === 'xs' ? 'px-2 py-0.5 text-[10px]' :\n size === 'md' ? 'px-2.5 py-0.5 text-xs' :\n 'px-2 py-0.5 text-xs';\n const capCls = capitalize ? 'capitalize' : '';\n const closeName = closeLabel ?? (typeof children === 'string' ? `Remove ${children}` : 'Remove');\n const closeSize = size === 'xs' ? 'h-2.5 w-2.5' : 'h-3 w-3';\n return (\n <span className={['inline-flex items-center rounded-full font-medium', sizeCls, capCls, colour, className].filter(Boolean).join(' ')}>\n {children}\n {closable && (\n <button\n type=\"button\"\n onClick={onClose}\n aria-label={closeName}\n className=\"-mr-0.5 ml-1 inline-flex shrink-0 items-center justify-center rounded-full opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-blue-400/40\"\n >\n <svg className={closeSize} viewBox=\"0 0 20 20\" fill=\"currentColor\" aria-hidden=\"true\">\n <path d=\"M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z\" />\n </svg>\n </button>\n )}\n </span>\n );\n}\n","import type { ReactNode } from 'react';\n\nexport interface EmptyStateProps {\n /** Bold heading, e.g. \"No invoices yet\". */\n title?: string;\n /** Muted primary line. Defaults to \"Nothing here yet.\" when neither\n * `title` nor `message` is given. */\n message?: string;\n /** Secondary muted line. (`hint` is an accepted alias.) */\n description?: string;\n /** @deprecated alias for `description`. */\n hint?: string;\n /** Frame around the content: `dashed` (default), `card` (bordered surface),\n * or `none`. */\n variant?: 'dashed' | 'card' | 'none';\n /** @deprecated set `variant=\"none\"` instead. */\n frameless?: boolean;\n /**\n * `true`/omitted shows the placeholder inbox, `false` shows nothing, and an\n * element shows that instead.\n *\n * The boolean alone meant every empty state in every app was an inbox — an\n * empty catalogue, an empty invoice list and an empty inbox drawn\n * identically, when the icon is the fastest thing on the screen to read.\n * Defaults to the placeholder (to nothing for `variant=\"card\"`).\n */\n icon?: boolean | ReactNode;\n /** Action(s) rendered under the text. */\n children?: ReactNode;\n}\n\n/**\n * EmptyState — placeholder for empty lists/panes. Supersedes the per-portal\n * copies: accepts both the `title`/`description` and `message`/`hint`/`frameless`\n * prop shapes, with a single unified look.\n */\nexport default function EmptyState({\n title, message, description, hint, variant, frameless, icon, children,\n}: EmptyStateProps) {\n const v = frameless ? 'none' : (variant ?? 'dashed');\n // A boolean picks the placeholder; anything else IS the icon. Checked by\n // type rather than truthiness, so `icon={0}` or an empty fragment renders\n // what was passed instead of silently falling back to the inbox.\n const custom = typeof icon !== 'boolean' && icon != null ? icon : null;\n const showIcon = custom ? false : ((icon as boolean | undefined) ?? (v !== 'card'));\n const primary = message ?? (title ? undefined : 'Nothing here yet.');\n const secondary = description ?? hint;\n const frame =\n v === 'card' ? 'rounded-md border border-gray-200 bg-white px-6 py-12' :\n v === 'none' ? 'px-6 py-12' :\n 'rounded-lg border-2 border-dashed border-gray-300 px-6 py-12';\n return (\n <div className={`flex flex-col items-center justify-center text-center ${frame}`}>\n {/* The same 40px footprint the placeholder occupies, so a caller passing\n a 20px glyph gets it centred in that box rather than rendered at half\n the size the default draws at — and the heading below does not shift\n depending on which icon was used. */}\n {custom && (\n <div className=\"mb-3 flex h-10 w-10 items-center justify-center text-gray-300\" aria-hidden=\"true\">\n {custom}\n </div>\n )}\n {showIcon && (\n <svg className=\"h-10 w-10 text-gray-300 mb-3\" aria-hidden=\"true\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" strokeWidth={1}>\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4\" />\n </svg>\n )}\n {title && <h3 className=\"text-sm font-medium text-gray-900\">{title}</h3>}\n {primary && <p className={`text-sm text-gray-500 ${title ? 'mt-2' : ''}`}>{primary}</p>}\n {secondary && <p className=\"text-xs text-gray-400 mt-1\">{secondary}</p>}\n {children && <div className=\"mt-4\">{children}</div>}\n </div>\n );\n}\n","import type { ReactNode } from 'react';\nimport Breadcrumbs, { type BreadcrumbItem } from './Breadcrumbs';\n\nexport interface PageHeaderProps {\n title: string;\n /** Muted line under the title. (`subtitle` is an accepted alias.) */\n description?: string;\n /** @deprecated alias for `description`. */\n subtitle?: string;\n /** Right-aligned actions. (`children` is also accepted.) */\n actions?: ReactNode;\n children?: ReactNode;\n /**\n * Icon beside the title — a marker for the page, not a second headline.\n * Rendered muted and at the title's own size, so it labels the words rather\n * than competing with them.\n */\n icon?: ReactNode;\n /**\n * Trail above the title, root → current, rendered with the kit's own\n * `Breadcrumbs`. Not a second implementation: the collapsing behaviour, the\n * `aria-current=\"page\"` on the last crumb and the separator all come from\n * that component, so a trail in a header and a trail anywhere else stay the\n * same thing.\n */\n breadcrumbs?: BreadcrumbItem[];\n}\n\n/**\n * PageHeader — a page/section title with an optional muted description and a\n * right-aligned actions slot. Accepts both the `description`/`actions` and the\n * `subtitle`/`children` prop shapes the portals previously used locally.\n */\nexport default function PageHeader({\n title, description, subtitle, actions, children, icon, breadcrumbs,\n}: PageHeaderProps) {\n const desc = description ?? subtitle;\n const right = actions ?? children;\n return (\n <div className=\"mb-6\">\n {breadcrumbs && breadcrumbs.length > 0 && <Breadcrumbs items={breadcrumbs} className=\"mb-3\" />}\n <div className=\"flex items-start justify-between gap-4\">\n <div>\n <h1 className=\"flex items-center gap-2 text-xl font-semibold text-gray-900\">\n {icon && <span className=\"shrink-0 text-gray-400\">{icon}</span>}\n {title}\n </h1>\n {desc && <p className=\"mt-1 text-sm text-gray-500\">{desc}</p>}\n </div>\n {right && <div className=\"flex items-center gap-2\">{right}</div>}\n </div>\n </div>\n );\n}\n","import { type ReactNode } from 'react';\n\nexport interface LoadingSpinnerProps {\n /** Ring diameter: `sm` = 20px, `md` = 32px (default), `lg` = 48px. */\n size?: 'sm' | 'md' | 'lg';\n /** Wrapper padding utility (default `py-12`). Pass `''` to remove. */\n padding?: string;\n /**\n * Caption under the ring, e.g. \"Signing in…\". Naming what is happening beats\n * a bare ring on a full-screen wait, where there is nothing else on the page\n * to infer it from. Adds `role=\"status\"` so it is announced.\n */\n label?: ReactNode;\n /** Extra classes on the centering wrapper. */\n className?: string;\n}\n\n/**\n * LoadingSpinner — a centered animated ring for pending/loading regions.\n * (Distinct from the shell's internal \"Loading…\" text used inside data grids.)\n */\nexport default function LoadingSpinner({ size = 'md', padding = 'py-12', label, className = '' }: LoadingSpinnerProps) {\n const dim = size === 'sm' ? 'h-5 w-5' : size === 'lg' ? 'h-12 w-12' : 'h-8 w-8';\n const ring = <div className={`${dim} animate-spin rounded-full border-2 border-gray-200 border-t-blue-600`} />;\n // Without a label the markup is exactly what it has always been — including\n // no `role`, which would otherwise have changed the a11y tree for every\n // existing caller. A labelled spinner is a status; a bare ring is decoration.\n if (label == null) {\n return <div className={`flex items-center justify-center ${padding} ${className}`}>{ring}</div>;\n }\n return (\n <div role=\"status\" className={`flex flex-col items-center justify-center gap-3 ${padding} ${className}`}>\n {ring}\n <p className=\"text-sm text-gray-500\">{label}</p>\n </div>\n );\n}\n","/**\n * Severity — the health subset of the shell's status vocabulary.\n *\n * The shell already speaks `success | warning | danger` everywhere status has a\n * colour (`StatusBadge`'s `SemanticGroup`, `Banner`'s `BannerTone`,\n * `ConfirmDialog`'s `variant`). Health surfaces reuse those three words rather\n * than introducing an ok/warn/crit dialect that would mean the same thing in a\n * different language — a consumer mapping one to the other is a bug waiting to\n * happen. The type is deliberately narrower than `SemanticGroup`: an alarm\n * marker has exactly three things to say.\n *\n * \"No severity\" is expressed as the ABSENCE of a tone (`undefined`/`null`), not\n * as a fourth member. Two different facts collapse into it — no reading at all,\n * and a reading with nothing to judge it against — and both must render as\n * \"unknown\" rather than borrowing the calm green of a measured healthy value.\n * See `MetricBar`, which keeps them apart.\n *\n * A severity usually arrives from a backend rollup, so it crosses a JSON\n * boundary where the compiler cannot follow it. `resolveSeverity` is what the\n * components call: a token the shell does not recognise renders a LOUD unknown\n * marker and logs, it never renders nothing. An alarm surface that silently\n * stops alarming is the one failure these components exist to prevent, so it is\n * also the one failure they must not have themselves.\n */\n\n/** Health tone. Same three words the rest of the shell uses for status colour. */\nexport type SeverityTone = 'success' | 'warning' | 'danger';\n\n/** The tones as a runtime list. A `SeverityTone` annotation is erased at the\n * boundary the values actually cross (a fetch response), so the check that\n * matters has to exist at runtime. */\nexport const SEVERITY_TONES: readonly SeverityTone[] = ['success', 'warning', 'danger'];\n\n/** True when `value` is one of the three tones. Exported so a consumer can\n * validate a rollup at the fetch boundary — where a bad token can still be\n * reported against its payload — rather than discovering it as a wrong pixel. */\nexport function isSeverityTone(value: unknown): value is SeverityTone {\n return typeof value === 'string' && (SEVERITY_TONES as readonly string[]).includes(value);\n}\n\n/**\n * Severity of `value` against its bounds, or `null` when nothing can be said.\n *\n * Both bounds are INCLUSIVE (`>=`): a disk at exactly its `crit` number is\n * `danger`. Either bound may be omitted — a metric with only a `crit` still\n * judges — but with neither the answer is `null`, never `success`: no threshold\n * is hardcoded here, not even as a fallback, so with nothing to measure against\n * there is no verdict to report.\n *\n * A non-finite bound counts as omitted, not as a bound that nothing exceeds.\n * `NaN >= NaN` is false, so an unguarded `warn={NaN}` would have quietly\n * returned `success` — a verdict invented out of a missing threshold.\n */\nexport function severityOf(\n value: number | null | undefined,\n warn?: number | null,\n crit?: number | null,\n): SeverityTone | null {\n if (value == null || !Number.isFinite(value)) return null;\n const warnAt = boundOf(warn);\n const critAt = boundOf(crit);\n if (warnAt == null && critAt == null) return null;\n if (critAt != null && value >= critAt) return 'danger';\n if (warnAt != null && value >= warnAt) return 'warning';\n return 'success';\n}\n\n/** A threshold the component can actually compare against, or `null`. */\nexport function boundOf(value: number | null | undefined): number | null {\n return value != null && Number.isFinite(value) ? value : null;\n}\n\n/** Marker dot / bar fill. The vivid 500s are deliberately NOT dark-remapped in\n * `styles.css`: they carry meaning, and they read on the light (`bg-gray-200`)\n * and dark (#313244) track alike. */\nexport const SEVERITY_FILL: Record<SeverityTone, string> = {\n success: 'bg-green-500',\n warning: 'bg-amber-500',\n danger: 'bg-red-500',\n};\n\n/** Ink for a value the tone judges. `success` stays neutral on purpose —\n * colour on a metric row means \"look at me\", and a healthy number has nothing\n * to say. Write the 600s: `styles.css` remaps them to the lighter weights in\n * dark mode (`text-red-600` → #f87171); the 400s are not remapped. */\nexport const SEVERITY_INK: Record<SeverityTone, string> = {\n success: 'text-gray-900',\n warning: 'text-amber-600',\n danger: 'text-red-600',\n};\n\n/** Screen-reader / tooltip wording. The colour is the fast channel; this is the\n * one that survives a screen reader or a colour-blind operator. */\nexport const SEVERITY_WORD: Record<SeverityTone, string> = {\n success: 'ok',\n warning: 'warning',\n danger: 'critical',\n};\n\n/** Fill for a severity the shell does not recognise. Grey reads \"unknown\", the\n * red edge reads \"and that is a problem\" — deliberately unlike all three real\n * tones, and deliberately never empty: an unrecognised token used to produce\n * `class=\"… rounded-full undefined\"`, an invisible dot on the one surface whose\n * entire job is being visible. Both utilities are un-remapped in dark mode. */\nexport const SEVERITY_UNKNOWN_FILL = 'bg-gray-300 border border-red-500';\n\n/** Ink for a value carrying an unrecognised severity: the number is real, the\n * verdict on it is not, so it gets no tone colour. */\nexport const SEVERITY_UNKNOWN_INK = 'text-gray-900';\n\n/** How a `severity` prop resolved. `fill`, `ink` and `word` are ALWAYS\n * non-empty, which is what makes a bad token impossible to render as nothing;\n * `tone` is `null` when the token was not recognised, for the few places that\n * need to know whether there is a real verdict behind the marker. */\nexport interface SeverityStyle {\n /** The recognised tone, or `null` when the token was not one of the three. */\n tone: SeverityTone | null;\n /** Marker-dot / bar-fill background classes. Never empty. */\n fill: string;\n /** Ink classes for the value this severity judges. Never empty. */\n ink: string;\n /** Tooltip / screen-reader wording. Never empty. */\n word: string;\n}\n\nconst TONE_STYLES: Record<SeverityTone, SeverityStyle> = {\n success: { tone: 'success', fill: SEVERITY_FILL.success, ink: SEVERITY_INK.success, word: SEVERITY_WORD.success },\n warning: { tone: 'warning', fill: SEVERITY_FILL.warning, ink: SEVERITY_INK.warning, word: SEVERITY_WORD.warning },\n danger: { tone: 'danger', fill: SEVERITY_FILL.danger, ink: SEVERITY_INK.danger, word: SEVERITY_WORD.danger },\n};\n\n/** Presentation for a tone the shell already trusts, or `null` for \"no tone\".\n * Use this for a severity the component computed itself (via `severityOf`),\n * where there is no untrusted token to fall back from. */\nexport function styleForTone(tone: SeverityTone | null | undefined): SeverityStyle | null {\n return tone == null ? null : TONE_STYLES[tone];\n}\n\n/** Renderable description of whatever the caller passed, capped so a runaway\n * payload cannot become a 10 KB `title`. React escapes it on the way out. */\nfunction describeToken(value: unknown): string {\n const raw =\n typeof value === 'string'\n ? JSON.stringify(value)\n : typeof value === 'number' || typeof value === 'boolean' || typeof value === 'bigint'\n ? String(value)\n : Object.prototype.toString.call(value);\n return raw.length > 32 ? `${raw.slice(0, 31)}…` : raw;\n}\n\n/** One console line per distinct (component, token) pair — a sidebar with 200\n * items on one bad rollup should say this once, not 200 times. */\nconst reported = new Set<string>();\n\nfunction reportUnknownSeverity(component: string, described: string): void {\n const key = `${component}:${described}`;\n if (reported.has(key)) return;\n reported.add(key);\n // Not gated on NODE_ENV: a mis-typed severity is a production bug that\n // silences an alarm, and the library cannot assume a bundler define exists.\n console.error(\n `[react-os-shell] ${component}: severity ${described} is not one of ` +\n `${SEVERITY_TONES.join(' | ')}. Rendering an \"unknown severity\" marker — a health ` +\n 'marker must never silently disappear. If this came from a backend rollup, map it ' +\n \"to the shell's vocabulary at the fetch boundary (see isSeverityTone).\",\n );\n}\n\n/**\n * Resolve a `severity` prop that may have come from anywhere.\n *\n * Three outcomes, because there are three different facts:\n * `null`/`undefined` in → `null` out nothing was claimed; render no marker\n * a recognised tone → its style the normal path\n * anything else → unknown style logged once, and rendered VISIBLY\n *\n * The third case is the whole point. `SEVERITY_FILL[severity]` on an unknown\n * key yields `undefined`, which interpolates into a className as the string\n * `\"undefined\"` — a dot with no colour, no title and no screen-reader word, on\n * a component whose entire purpose is making a deep alarm visible at the top\n * level. Failing loudly (console) and degrading visibly (grey dot, red edge,\n * the token in its tooltip) are both strictly better than vanishing.\n *\n * Note what this deliberately does NOT do: alias `ok`/`warn`/`crit`, or the\n * displayed words `critical`/`ok`, onto the three tones. Quietly accepting a\n * second dialect would re-create exactly the two-vocabularies-for-one-idea\n * problem this module exists to avoid, and would hide the caller's bug instead\n * of surfacing it. The mismatch is reported, not papered over.\n */\nexport function resolveSeverity(severity: unknown, component: string): SeverityStyle | null {\n if (severity == null) return null;\n if (isSeverityTone(severity)) return TONE_STYLES[severity];\n\n const described = describeToken(severity);\n reportUnknownSeverity(component, described);\n return {\n tone: null,\n fill: SEVERITY_UNKNOWN_FILL,\n ink: SEVERITY_UNKNOWN_INK,\n word: `unrecognised severity ${described}`,\n };\n}\n\n/** Deduplicated console line for the other way a caller can hand these\n * components an impossible number. Shared with `resolveSeverity`'s registry so\n * one bad prop is one line, however many rows render it. */\nexport function warnOnce(key: string, message: string): void {\n if (reported.has(key)) return;\n reported.add(key);\n console.error(message);\n}\n","/**\n * MetricBar — a measured value, a proportional bar, and optional threshold\n * ticks. The CPU / memory / disk row every status surface ends up rewriting.\n *\n * The contract worth knowing before you use it: **`null` is not zero.** A\n * missing reading renders as a dashed empty track and an em dash, never as a\n * zero-width bar — a zero-width bar is a picture of a healthy idle box, which\n * is the opposite of \"we have no idea\". Same reasoning one level up: with no\n * thresholds the fill stays grey rather than green, because green is a claim\n * (\"measured, and under warn\") that nothing here has standing to make.\n *\n * Four render states, because there are four different facts:\n * value + thresholds the real row — toned fill, ticks, coloured value ink\n * value, no threshold a real magnitude nobody can judge — grey fill, no ticks\n * thresholds, no value no reading — dashed empty track, em dash\n * neither same\n *\n * `max` is held to the same standard as `value`, because it is the divisor: a\n * bar is a proportion, and a proportion of an unknown total is not a small bar,\n * it is no bar. `max={0}` used to divide to `Infinity`, clamp to 100 % and paint\n * a full green bar out of a division by zero — a fabricated measurement on the\n * exact path this component exists to guard (`max={total ?? 0}` where the probe\n * never learned the total). Now a non-positive or non-finite `max` drops the\n * scale: the value still prints, the bar does not pretend to place it.\n *\n * Severity is `success | warning | danger` — the shell's status vocabulary (see\n * `severity.ts`), not a private ok/warn/crit dialect.\n */\nimport type { ReactNode } from 'react';\nimport { boundOf, resolveSeverity, severityOf, styleForTone, warnOnce, type SeverityTone } from './severity';\n\nexport interface MetricBarProps {\n /** Row label — `CPU`, `Memory`, `Disk`. Rendered in a fixed-width column so\n * a stack of rows aligns. */\n label?: ReactNode;\n /** The measured value. `null` / `undefined` means NO READING — rendered as\n * unknown, never as 0. */\n value: number | null | undefined;\n /** Value mapped to a full bar. Default 100. Must be a positive finite number:\n * it is the divisor, so `0`, a negative or `NaN` is not a scale. Given one,\n * the row prints the value but draws no proportional bar and no ticks —\n * there is nothing truthful to draw them against. */\n max?: number;\n /** Warning bound, in the same unit as `value`. Inclusive (`>=`). */\n warn?: number | null;\n /** Critical bound, in the same unit as `value`. Inclusive (`>=`). */\n crit?: number | null;\n /** Forces the tone when the caller judges severity itself (e.g. a rollup\n * served by the backend). Overrides `warn`/`crit` for colour; the ticks\n * still render wherever `warn`/`crit` say. */\n severity?: SeverityTone;\n /** Trailing secondary text — `10.9 / 16 GiB`, `4 vCPU`. Hidden when there is\n * no reading, where the row has something more important to say. */\n detail?: ReactNode;\n /** Formats the printed value. Default: one decimal plus `%` on the default\n * 0–100 scale, the bare number on any other `max` (a custom scale is not a\n * percentage, and printing one would be a lie). */\n formatValue?: (value: number) => string;\n /** Wording for \"no reading\". Default `no data`. */\n emptyLabel?: string;\n /** `sm` (default) — the compact row that stacks three to a card.\n * `md` — bigger value type for a standalone stat. Neither draws a frame;\n * wrap in a `Card` (or your own) if you want one. */\n size?: 'sm' | 'md';\n /** Accessible name for the meter. Defaults to `label` when it's a string. */\n ariaLabel?: string;\n className?: string;\n}\n\n/** Ticks come from the caller's numbers — the shell hardcodes no threshold,\n * not even as a fallback. Mid-greys, deliberately not dark-remapped: they stay\n * legible on the light (`bg-gray-200`) and dark track alike. */\nfunction Tick({ at, title, className }: { at: number; title: string; className: string }) {\n return (\n <div\n title={title}\n className={`absolute -top-[3px] h-3 w-0.5 rounded-[1px] ${className}`}\n style={{ left: `${at}%` }}\n />\n );\n}\n\nconst clampPct = (n: number) => Math.min(100, Math.max(0, n));\n\nexport default function MetricBar({\n label,\n value,\n max = 100,\n warn,\n crit,\n severity,\n detail,\n formatValue,\n emptyLabel = 'no data',\n size = 'sm',\n ariaLabel,\n className = '',\n}: MetricBarProps) {\n // One narrowed reading for the whole component: `null` covers both \"not\n // supplied\" and NaN/Infinity, which are just as unmeasured.\n const reading = value != null && Number.isFinite(value) ? value : null;\n // The same test applied to the divisor, plus positivity. Anything else is not\n // a smaller scale, it is the absence of one.\n const scale = Number.isFinite(max) && max > 0 ? max : null;\n if (scale == null) {\n warnOnce(\n `MetricBar:max:${String(max)}`,\n `[react-os-shell] MetricBar: max=${String(max)} is not a positive finite number, so there is ` +\n 'no scale to draw a proportional bar against. Printing the value without a bar. Pass the real ' +\n 'capacity, or leave the reading out entirely (value={null}) when it is unknown — do not pass 0.',\n );\n }\n // A `severity` the caller supplied outranks the bounds. An unrecognised one\n // resolves to a visible \"unknown\" style rather than to undefined classes.\n const supplied = resolveSeverity(severity, 'MetricBar');\n const paint = reading != null ? (supplied ?? styleForTone(severityOf(reading, warn, crit))) : null;\n // Ticks need a bound the component can actually place, on a scale that exists.\n const warnAt = boundOf(warn);\n const critAt = boundOf(crit);\n // Clamp the BAR only — never the printed number. A probe blipping to 103 %\n // should draw a full bar and still say 103 %.\n const width = reading != null && scale != null ? clampPct((reading / scale) * 100) : 0;\n const format = formatValue ?? ((v: number) => (scale === 100 ? `${v.toFixed(1)}%` : String(v)));\n const printed = reading != null ? format(reading) : '—';\n const showTicks = reading != null && scale != null && (warnAt != null || critAt != null);\n\n const meterLabel = ariaLabel ?? (typeof label === 'string' ? label : undefined);\n const barHeight = size === 'md' ? 'h-2' : 'h-1.5';\n // It is a meter only when it is actually a meter: a reading, on a scale.\n // `role=\"meter\"` REQUIRES `aria-valuenow` (unlike `progressbar`, it has no\n // indeterminate state), so a roleless track is the honest empty rendering —\n // omitting valuenow under the role would have been a malformed widget whose\n // announcement is undefined, and `aria-valuenow={0}` would have announced a\n // healthy idle box. Either way the row already says \"— / no data\" in text.\n const isMeter = reading != null && scale != null;\n\n const bar = (\n <div\n {...(isMeter\n ? {\n role: 'meter' as const,\n 'aria-label': meterLabel,\n 'aria-valuemin': 0,\n 'aria-valuemax': scale,\n // Kept inside the declared range: the bar clamps, and a valuenow\n // past its own valuemax is an invalid widget. `aria-valuetext`\n // still carries the unclamped truth, and takes precedence in the\n // announcement.\n 'aria-valuenow': Math.min(scale, Math.max(0, reading)),\n 'aria-valuetext': printed,\n }\n : { 'aria-hidden': true as const })}\n className={\n isMeter && paint\n ? `relative mt-2 ${barHeight} rounded-full bg-gray-200`\n // Dashed track: nothing to compare against, nothing to compare, or\n // nothing to compare it on.\n : `relative mt-2 ${barHeight} rounded-full border border-dashed border-gray-300 bg-transparent`\n }\n >\n {isMeter && (\n // Grey when unjudged: the magnitude is real, the verdict is not ours.\n <div\n className={`absolute inset-y-0 left-0 rounded-full ${paint ? paint.fill : 'bg-gray-400'}`}\n style={{ width: `${width}%` }}\n />\n )}\n {showTicks && scale != null && warnAt != null && (\n <Tick at={clampPct((warnAt / scale) * 100)} title={`warning ≥ ${warnAt}`} className=\"bg-gray-400 opacity-75\" />\n )}\n {showTicks && scale != null && critAt != null && (\n <Tick at={clampPct((critAt / scale) * 100)} title={`critical ≥ ${critAt}`} className=\"bg-gray-500\" />\n )}\n </div>\n );\n\n const valueInk = paint ? paint.ink : reading != null ? 'text-gray-900' : 'text-gray-400';\n\n if (size === 'md') {\n return (\n <div className={className}>\n {label != null && (\n <div className=\"text-[10px] font-medium uppercase tracking-wide text-gray-500\">{label}</div>\n )}\n <div className=\"mt-1 flex items-baseline gap-2\">\n <span className={`text-2xl font-semibold leading-[30px] tabular-nums ${valueInk}`}>{printed}</span>\n <span className=\"min-w-0 truncate text-[11px] tabular-nums text-gray-400\">\n {reading != null ? detail : emptyLabel}\n </span>\n </div>\n {bar}\n </div>\n );\n }\n\n return (\n <div className={className}>\n <div className=\"flex items-baseline gap-2\">\n {label != null && (\n <span className=\"w-14 shrink-0 truncate text-[10px] font-medium uppercase tracking-wide text-gray-500\">\n {label}\n </span>\n )}\n <span className={`text-sm font-semibold tabular-nums ${valueInk}`}>{printed}</span>\n {/* One slot, one question — \"what do we know about this number?\".\n \"No reading\" outranks whatever the absolute figure would have said. */}\n <span className=\"ml-auto min-w-0 truncate text-[10px] tabular-nums text-gray-400\">\n {reading != null ? detail : emptyLabel}\n </span>\n </div>\n {bar}\n </div>\n );\n}\n","/**\n * Shared date formatting utility.\n *\n * Reads the user's preferred date format from localStorage (`user_date_format`)\n * and formats all dates consistently across the app.\n *\n * Supported formats (numeric, two-digit-year, abbreviated- and full-month):\n * 'DD/MM/YYYY' — 24/04/2026 'MM/DD/YY' — 04/24/26\n * 'MM/DD/YYYY' — 04/24/2026 'YYYY/MM/DD' — 2026/04/24\n * 'YYYY-MM-DD' — 2026-04-24 'YYYY.MM.DD' — 2026.04.24\n * 'DD-MM-YYYY' — 24-04-2026 'MM-DD-YYYY' — 04-24-2026\n * 'DD.MM.YYYY' — 24.04.2026 'DD MMM YYYY' — 24 Apr 2026\n * 'DD/MM/YY' — 24/04/26 'MMM DD, YYYY' — Apr 24, 2026\n * 'DD/MMM/YYYY' — 24/Apr/2026 'DD MMMM YYYY' — 24 April 2026\n * 'DD/MMM/YY' — 24/Apr/26 'MMMM DD, YYYY' — April 24, 2026\n */\n\nexport type DateFormatKey =\n | 'DD/MM/YYYY' | 'MM/DD/YYYY' | 'YYYY-MM-DD' | 'DD-MM-YYYY' | 'DD.MM.YYYY'\n | 'DD/MM/YY' | 'DD/MMM/YYYY' | 'DD/MMM/YY'\n | 'MM/DD/YY' | 'YYYY/MM/DD' | 'YYYY.MM.DD' | 'MM-DD-YYYY'\n | 'DD MMM YYYY' | 'MMM DD, YYYY' | 'DD MMMM YYYY' | 'MMMM DD, YYYY';\n\nexport const DATE_FORMAT_OPTIONS: { key: DateFormatKey; example: string }[] = [\n { key: 'DD/MM/YYYY', example: '24/04/2026' },\n { key: 'MM/DD/YYYY', example: '04/24/2026' },\n { key: 'YYYY-MM-DD', example: '2026-04-24' },\n { key: 'DD-MM-YYYY', example: '24-04-2026' },\n { key: 'MM-DD-YYYY', example: '04-24-2026' },\n { key: 'DD.MM.YYYY', example: '24.04.2026' },\n { key: 'YYYY.MM.DD', example: '2026.04.24' },\n { key: 'YYYY/MM/DD', example: '2026/04/24' },\n { key: 'DD/MM/YY', example: '24/04/26' },\n { key: 'MM/DD/YY', example: '04/24/26' },\n { key: 'DD/MMM/YYYY', example: '24/Apr/2026' },\n { key: 'DD/MMM/YY', example: '24/Apr/26' },\n { key: 'DD MMM YYYY', example: '24 Apr 2026' },\n { key: 'MMM DD, YYYY', example: 'Apr 24, 2026' },\n { key: 'DD MMMM YYYY', example: '24 April 2026' },\n { key: 'MMMM DD, YYYY', example: 'April 24, 2026' },\n];\n\n/** Month names for the alpha-numeric 'MMM'/'MMMM' formats. */\nconst MONTH_ABBR = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];\nconst MONTH_FULL = [\n 'January', 'February', 'March', 'April', 'May', 'June',\n 'July', 'August', 'September', 'October', 'November', 'December',\n];\n\nfunction monthAbbr(mm: string): string {\n return MONTH_ABBR[parseInt(mm, 10) - 1] ?? mm;\n}\n\nfunction monthFull(mm: string): string {\n return MONTH_FULL[parseInt(mm, 10) - 1] ?? mm;\n}\n\nexport function getUserDateFormat(): DateFormatKey {\n return (localStorage.getItem('user_date_format') as DateFormatKey) || 'DD/MM/YYYY';\n}\n\nexport function setUserDateFormat(fmt: DateFormatKey) {\n localStorage.setItem('user_date_format', fmt);\n}\n\n/**\n * Format a date string (YYYY-MM-DD or ISO timestamp) for display.\n * Returns '—' for null/empty values.\n */\nexport function formatDate(value: string | null | undefined): string {\n if (!value) return '—';\n // Parse — handle both \"YYYY-MM-DD\" and ISO timestamps\n const dateStr = value.includes('T') ? value.split('T')[0] : value;\n const [y, m, d] = dateStr.split('-').map(Number);\n if (!y || !m || !d) return value; // fallback if unparseable\n\n const dd = String(d).padStart(2, '0');\n const mm = String(m).padStart(2, '0');\n const yyyy = String(y);\n\n const fmt = getUserDateFormat();\n switch (fmt) {\n case 'MM/DD/YYYY': return `${mm}/${dd}/${yyyy}`;\n case 'YYYY-MM-DD': return `${yyyy}-${mm}-${dd}`;\n case 'DD-MM-YYYY': return `${dd}-${mm}-${yyyy}`;\n case 'MM-DD-YYYY': return `${mm}-${dd}-${yyyy}`;\n case 'DD.MM.YYYY': return `${dd}.${mm}.${yyyy}`;\n case 'YYYY.MM.DD': return `${yyyy}.${mm}.${dd}`;\n case 'YYYY/MM/DD': return `${yyyy}/${mm}/${dd}`;\n case 'DD/MM/YY': return `${dd}/${mm}/${yyyy.slice(-2)}`;\n case 'MM/DD/YY': return `${mm}/${dd}/${yyyy.slice(-2)}`;\n case 'DD/MMM/YYYY': return `${dd}/${monthAbbr(mm)}/${yyyy}`;\n case 'DD/MMM/YY': return `${dd}/${monthAbbr(mm)}/${yyyy.slice(-2)}`;\n case 'DD MMM YYYY': return `${dd} ${monthAbbr(mm)} ${yyyy}`;\n case 'MMM DD, YYYY': return `${monthAbbr(mm)} ${dd}, ${yyyy}`;\n case 'DD MMMM YYYY': return `${dd} ${monthFull(mm)} ${yyyy}`;\n case 'MMMM DD, YYYY': return `${monthFull(mm)} ${dd}, ${yyyy}`;\n case 'DD/MM/YYYY':\n default: return `${dd}/${mm}/${yyyy}`;\n }\n}\n\n/**\n * Format a datetime string (ISO timestamp) for display, including time.\n * Returns '—' for null/empty values.\n */\nexport function formatDateTime(value: string | null | undefined): string {\n if (!value) return '—';\n const dt = new Date(value);\n if (isNaN(dt.getTime())) return value;\n const dateStr = `${dt.getFullYear()}-${String(dt.getMonth() + 1).padStart(2, '0')}-${String(dt.getDate()).padStart(2, '0')}`;\n const time = dt.toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit' });\n return `${formatDate(dateStr)}, ${time}`;\n}\n","import { useState } from 'react';\nimport { formatDate } from '../utils/date';\n\n// ─── Pure date helpers ───────────────────────────────────────────────────────\n\n/** Milliseconds in a day — used for axis padding + day-resolution math. */\nconst DAY_MS = 86400000;\n\n/** Parse an ISO date string to epoch ms, or `null` when absent/unparseable. */\nfunction toDayMs(dateStr: string | null | undefined): number | null {\n if (!dateStr) return null;\n const t = new Date(dateStr).getTime();\n return Number.isFinite(t) ? t : null;\n}\n\n/** Format an epoch-ms value as a short date using the user's date format. */\nfunction fmtSliderDate(ms: number): string {\n return formatDate(new Date(ms).toISOString().slice(0, 10));\n}\n\n// ─── Public types ────────────────────────────────────────────────────────────\n\n/** Visual category for a milestone. Drives shape + colour so the user can\n * tell different milestone types apart at a glance. */\nexport type MilestoneKind =\n | 'default' // blue circle — generic / phase start\n | 'dfm' // amber rounded square — engineering iteration\n | 'shipment' // emerald diamond — shipment idiom\n | 'testing' // violet bullseye — mould complete / safety tests\n | 'completion' // green bigger dot — production ready\n;\n\n/** A single point on the timeline. Generic, product-agnostic: the consuming\n * app maps its domain records to this shape in a thin wrapper. */\nexport interface Milestone {\n /** Stable key — used for React keys and the active-dot lookup. */\n key: string;\n /** Short label rendered above the dot when active / hovered. */\n label: string;\n /** ISO date string (`YYYY-MM-DD`) for the milestone. Null / undefined =\n * \"not reached yet\"; renders as a faded outline dot at the *expected*\n * position (between its neighbours) instead of a real coordinate. */\n date: string | null | undefined;\n /** Optional second line for the hover tooltip. */\n detail?: string;\n /** Optional click handler so the caller can open a related entity. */\n onClick?: () => void;\n /** Optional visual category — defaults to `'default'` (blue circle). */\n kind?: MilestoneKind;\n /** Optional phase grouping — milestones sharing the same `phase` value\n * render with a bracket below the bar showing they happened in parallel\n * (e.g. two concurrent QA steps). Lookup the human-readable name from\n * `MilestoneTimelineProps.phaseLabels`. */\n phase?: string;\n}\n\nexport interface MilestoneTimelineProps {\n /** Title rendered above the bar — e.g. \"Mould Development Timeline\". */\n title: string;\n /** Ordered milestones from earliest expected to latest expected. The order\n * controls the fallback position for milestones with no date yet. */\n milestones: Milestone[];\n /** Optional sub-title to the right of the title (e.g. lead-time summary).\n * When omitted, an auto lead-time summary is computed from the dates. */\n summary?: string;\n /** Optional explicit right edge — when provided, the bar always ends here\n * rather than padding to today. Used when the axis should stop at a known\n * final milestone and not run on past it. */\n endDate?: string | null;\n /** Maps `Milestone.phase` keys to the human-readable phase label that\n * appears under the bracket — e.g. `{ qa: 'QA & Sample' }`. Phases\n * without an entry fall back to the phase key itself. */\n phaseLabels?: Record<string, string>;\n}\n\n// Visual style map for milestone kinds. Centralised so caller intent\n// (kind: 'shipment') maps to the same shape + colour everywhere.\ninterface KindStyle {\n /** Tailwind classes for size, shape, and base colour. */\n base: string;\n /** Hover/active variant. */\n active: string;\n /** Outline-only variant for placeholders (not yet reached). */\n placeholder: string;\n /** Optional inner content (e.g. centre dot, checkmark) rendered inside the\n * marker. Lets us put a target ring inside a violet circle, etc. */\n inner?: React.ReactNode;\n}\nconst KIND_STYLES: Record<MilestoneKind, KindStyle> = {\n default: {\n base: 'h-2.5 w-2.5 rounded-full bg-blue-500 border-white',\n active: 'bg-blue-700',\n placeholder: 'h-2.5 w-2.5 rounded-full bg-white border-gray-300 hover:border-gray-500',\n },\n dfm: {\n base: 'h-2.5 w-2.5 rounded-sm bg-amber-500 border-white',\n active: 'bg-amber-600',\n placeholder: 'h-2.5 w-2.5 rounded-sm bg-white border-amber-300 hover:border-amber-500',\n },\n shipment: {\n base: 'h-2.5 w-2.5 rotate-45 bg-emerald-500 border-white',\n active: 'bg-emerald-600',\n placeholder: 'h-2.5 w-2.5 rotate-45 bg-white border-emerald-300 hover:border-emerald-500',\n },\n testing: {\n base: 'h-3 w-3 rounded-full bg-violet-500 border-white',\n active: 'bg-violet-700',\n placeholder: 'h-3 w-3 rounded-full bg-white border-violet-300 hover:border-violet-500',\n inner: <span className=\"block h-1 w-1 rounded-full bg-white\" />,\n },\n completion: {\n base: 'h-3.5 w-3.5 rounded-full bg-green-600 border-white',\n active: 'bg-green-700',\n placeholder: 'h-3.5 w-3.5 rounded-full bg-white border-green-300 hover:border-green-500',\n inner: (\n <svg className=\"h-2 w-2 text-white\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"3\" viewBox=\"0 0 24 24\">\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M5 13l4 4L19 7\" />\n </svg>\n ),\n },\n};\n\n// ─── Component ───────────────────────────────────────────────────────────────\n\n/**\n * Static date-axis bar showing a sequence of milestones along a single line.\n *\n * - No scrubber / playback / interpolation — milestones don't move.\n * - \"Not reached yet\" milestones (no date) render as outline dots wedged at\n * their expected position so the user can see what's still pending.\n * - First / last milestones render as inline edge labels; middle ones stagger\n * above/below the bar so adjacent labels never collide.\n * - Milestones sharing a `phase` (2+ members) get a bracket marking parallel\n * work. The filled portion of the bar never runs past today.\n *\n * Product-agnostic: it takes generic `Milestone` data as props. Map your\n * domain records to the `Milestone` shape in a thin wrapper at the call site.\n */\nexport default function MilestoneTimeline({ title, milestones, summary, endDate, phaseLabels }: MilestoneTimelineProps) {\n const [hoveredKey, setHoveredKey] = useState<string | null>(null);\n // Captured once at mount so render stays idempotent — day-resolution markers\n // don't care that \"today\" doesn't tick while the view is open.\n const [today] = useState(() => Date.now());\n\n // Date range. The caller can pin the right edge explicitly via `endDate`.\n // Otherwise we fall back to the latest filled milestone, padding to today\n // only when nothing's reached.\n const realDates = milestones\n .map((m) => toDayMs(m.date ?? null))\n .filter((t): t is number => t !== null);\n const explicitEnd = toDayMs(endDate ?? null);\n let startMs: number;\n let endMs: number;\n if (realDates.length === 0) {\n // Nothing reached yet — show a 30-day window ending at the explicit end\n // (or today) so the outline dots line up evenly across a real axis.\n endMs = explicitEnd ?? today;\n startMs = endMs - 30 * DAY_MS;\n } else {\n startMs = Math.min(...realDates);\n endMs = explicitEnd ?? Math.max(...realDates);\n if (endMs - startMs < DAY_MS) endMs = startMs + DAY_MS;\n }\n const span = Math.max(endMs - startMs, DAY_MS);\n\n // Auto-summarise the bar's lead time so callers don't each have to compute\n // and pass it. Caller-provided `summary` always wins so a more meaningful\n // sub-title can override the default.\n const totalLeadDays = realDates.length > 0\n ? Math.max(0, Math.round((endMs - startMs) / DAY_MS))\n : 0;\n const autoSummary = totalLeadDays > 0\n ? `${totalLeadDays.toLocaleString()} day${totalLeadDays === 1 ? '' : 's'} lead time`\n : undefined;\n const renderSummary = summary ?? autoSummary;\n\n // Compute the rendered position for every milestone. Real dates pin to\n // their actual day; missing dates get a fallback position interpolated\n // between their nearest filled neighbours so they stay in chronological\n // order on the bar.\n type Placed = Milestone & { ms: number; isPlaceholder: boolean };\n const placed: Placed[] = milestones.map((m, i) => {\n const ms = toDayMs(m.date ?? null);\n if (ms !== null) return { ...m, ms, isPlaceholder: false };\n\n // Look left for the most recent real date and right for the next one.\n let prevMs: number | null = null;\n for (let j = i - 1; j >= 0; j--) {\n const v = toDayMs(milestones[j].date ?? null);\n if (v !== null) { prevMs = v; break; }\n }\n let nextMs: number | null = null;\n for (let j = i + 1; j < milestones.length; j++) {\n const v = toDayMs(milestones[j].date ?? null);\n if (v !== null) { nextMs = v; break; }\n }\n let fallback: number;\n if (prevMs !== null && nextMs !== null) fallback = (prevMs + nextMs) / 2;\n else if (prevMs !== null) fallback = Math.min(prevMs + DAY_MS, endMs);\n else if (nextMs !== null) fallback = Math.max(nextMs - DAY_MS, startMs);\n else fallback = startMs + (span * (i + 1)) / (milestones.length + 1);\n return { ...m, ms: fallback, isPlaceholder: true };\n });\n\n const todayMs = today;\n\n // Group placed milestones by phase. A phase only renders a bracket when\n // it has 2+ members — a single-member \"phase\" would just look like a noise\n // glyph under the bar with no parallel work to communicate.\n type Phase = { key: string; label: string; minMs: number; maxMs: number };\n const phases: Phase[] = (() => {\n const groups: Record<string, Placed[]> = {};\n for (const m of placed) {\n if (!m.phase) continue;\n (groups[m.phase] = groups[m.phase] || []).push(m);\n }\n return Object.entries(groups)\n .filter(([, ms]) => ms.length >= 2)\n .map(([key, ms]) => ({\n key,\n label: phaseLabels?.[key] ?? key,\n minMs: Math.min(...ms.map((m) => m.ms)),\n maxMs: Math.max(...ms.map((m) => m.ms)),\n }));\n })();\n\n return (\n <div className=\"shrink-0\">\n <div className=\"flex items-end justify-between mb-1 gap-2\">\n <h4 className=\"text-xs font-semibold text-gray-500 uppercase tracking-wide\">\n {title}\n {renderSummary && <span className=\"ml-2 text-gray-400 normal-case\">{renderSummary}</span>}\n </h4>\n </div>\n <div className=\"border border-gray-200 rounded-lg bg-gray-50\">\n <div className=\"select-none\">\n {/* Layout: first milestone renders as an inline label on the LEFT,\n * last milestone as an inline label on the RIGHT, both on the\n * same row as the bar so the bar itself can be a touch shorter.\n * Middle milestones still render staggered above/below. */}\n <div className=\"flex items-center gap-3 px-3 py-3\">\n {/* Left edge — first milestone, name above its date, right-aligned\n * so the text hugs the bar. */}\n {placed.length > 0 && (() => {\n const m = placed[0];\n return (\n <div className={`text-[10px] leading-tight whitespace-nowrap text-right shrink-0 pointer-events-none ${\n m.isPlaceholder ? 'text-gray-400 italic' : 'text-gray-700'\n }`}>\n <div className=\"font-medium\">{m.label}</div>\n {!m.isPlaceholder && (\n <div className=\"text-[9px] text-gray-400 font-normal\">{fmtSliderDate(m.ms)}</div>\n )}\n </div>\n );\n })()}\n <div className=\"relative flex-1 flex flex-col justify-center\">\n {/* Lane above the bar — even-indexed middle milestones render\n * here. The first / last milestones are inline edge labels. */}\n <div className=\"relative h-7 mb-1\">\n {placed.map((m, i) => {\n if (i === 0 || i === placed.length - 1) return null;\n if (i % 2 !== 0) return null;\n const p = ((m.ms - startMs) / span) * 100;\n if (p < -0.5 || p > 100.5) return null;\n const isHovered = m.key === hoveredKey;\n return (\n <div\n key={`above-${m.key}`}\n className={`absolute bottom-0 -translate-x-1/2 text-center text-[10px] leading-tight whitespace-nowrap pointer-events-none ${\n m.isPlaceholder\n ? 'text-gray-400 italic'\n : isHovered ? 'text-blue-700 font-semibold' : 'text-gray-700'\n }`}\n style={{ left: `${Math.max(0, Math.min(100, p))}%` }}\n >\n <div>{m.label}</div>\n {!m.isPlaceholder && (\n <div className=\"text-[9px] text-gray-400 font-normal\">{fmtSliderDate(m.ms)}</div>\n )}\n </div>\n );\n })}\n </div>\n\n <div className=\"relative h-2 bg-gray-200 rounded-full\">\n {/* Filled portion = bar start to latest reached milestone,\n * but never past today: achieved progress can't run into the\n * future, so a projected anchor (an estimated-completion date,\n * a future ETA) must not paint the bar as if that point were\n * already reached. */}\n {realDates.length > 0 && (() => {\n const lastReal = Math.min(Math.max(...realDates), todayMs);\n const fillPct = ((lastReal - startMs) / span) * 100;\n return (\n <div className=\"absolute top-0 left-0 h-full bg-blue-300 rounded-full pointer-events-none\"\n style={{ width: `${Math.max(0, Math.min(100, fillPct))}%` }} />\n );\n })()}\n\n {todayMs > startMs && todayMs < endMs && (\n <div className=\"absolute -top-1 h-4 w-px bg-gray-400 pointer-events-none\"\n style={{ left: `${((todayMs - startMs) / span) * 100}%` }}\n title={`Today — ${fmtSliderDate(todayMs)}`} />\n )}\n\n {placed.map((m) => {\n const p = ((m.ms - startMs) / span) * 100;\n if (p < -0.5 || p > 100.5) return null;\n const isHovered = m.key === hoveredKey;\n const style = KIND_STYLES[m.kind ?? 'default'];\n // Pick the right colour variant: placeholder (outline) when\n // not reached, hover/active variant when hovered, base\n // otherwise. Shape comes from style.base in all cases.\n const dotClass = m.isPlaceholder\n ? style.placeholder\n : isHovered ? `${style.base} ${style.active}` : style.base;\n const Tag = m.onClick ? 'button' : 'div';\n return (\n <Tag\n key={m.key}\n type={m.onClick ? 'button' : undefined}\n onMouseEnter={() => setHoveredKey(m.key)}\n onMouseLeave={() => setHoveredKey((prev) => (prev === m.key ? null : prev))}\n onClick={m.onClick}\n className={`absolute top-1/2 -translate-x-1/2 -translate-y-1/2 border-2 shadow flex items-center justify-center ${dotClass} ${m.onClick ? 'cursor-pointer' : 'cursor-default'}`}\n style={{ left: `${Math.max(0, Math.min(100, p))}%` }}\n aria-label={`${m.label}${m.isPlaceholder ? ' (not reached yet)' : ` on ${fmtSliderDate(m.ms)}`}`}\n title={`${m.label}${m.isPlaceholder ? ' — not reached yet' : ` • ${fmtSliderDate(m.ms)}`}${m.detail ? ` — ${m.detail}` : ''}`}\n >\n {!m.isPlaceholder && style.inner}\n </Tag>\n );\n })}\n </div>\n\n {/* Lane below the bar — odd-indexed middle milestones only. */}\n <div className=\"relative h-7 mt-1\">\n {placed.map((m, i) => {\n if (i === 0 || i === placed.length - 1) return null;\n if (i % 2 === 0) return null;\n const p = ((m.ms - startMs) / span) * 100;\n if (p < -0.5 || p > 100.5) return null;\n const isHovered = m.key === hoveredKey;\n return (\n <div\n key={`below-${m.key}`}\n className={`absolute top-0 -translate-x-1/2 text-center text-[10px] leading-tight whitespace-nowrap pointer-events-none ${\n m.isPlaceholder\n ? 'text-gray-400 italic'\n : isHovered ? 'text-blue-700 font-semibold' : 'text-gray-700'\n }`}\n style={{ left: `${Math.max(0, Math.min(100, p))}%` }}\n >\n <div>{m.label}</div>\n {!m.isPlaceholder && (\n <div className=\"text-[9px] text-gray-400 font-normal\">{fmtSliderDate(m.ms)}</div>\n )}\n </div>\n );\n })}\n </div>\n\n {/* Phase brackets — one per group of milestones sharing a\n * `phase` value. Sits below the below-labels so the bracket\n * naturally hangs off the timeline pointing at the dots\n * it groups. The 3-sided box (top open, sides + bottom) is\n * the standard \"this range is a phase\" idiom. */}\n {phases.length > 0 && (\n <div className=\"relative h-5 mt-2\">\n {phases.map((ph) => {\n const leftPct = Math.max(0, ((ph.minMs - startMs) / span) * 100);\n const rightPct = Math.min(100, ((ph.maxMs - startMs) / span) * 100);\n const widthPct = Math.max(rightPct - leftPct, 0.5);\n const centerPct = leftPct + widthPct / 2;\n return (\n <div key={`phase-${ph.key}`}>\n <div\n className=\"absolute border-l border-r border-b border-slate-300 rounded-b-md pointer-events-none\"\n style={{ left: `${leftPct}%`, width: `${widthPct}%`, top: 0, height: 8 }}\n />\n <div\n className=\"absolute -translate-x-1/2 text-[9px] italic text-slate-500 whitespace-nowrap pointer-events-none\"\n style={{ left: `${centerPct}%`, top: 9 }}\n >\n {ph.label} <span className=\"text-slate-400 not-italic\">· parallel</span>\n </div>\n </div>\n );\n })}\n </div>\n )}\n </div>\n {/* Right edge — last milestone, name above its date, left-aligned\n * so the text hugs the bar. */}\n {placed.length > 1 && (() => {\n const m = placed[placed.length - 1];\n return (\n <div className={`text-[10px] leading-tight whitespace-nowrap text-left shrink-0 pointer-events-none ${\n m.isPlaceholder ? 'text-gray-400 italic' : 'text-gray-700'\n }`}>\n <div className=\"font-medium\">{m.label}</div>\n {!m.isPlaceholder && (\n <div className=\"text-[9px] text-gray-400 font-normal\">{fmtSliderDate(m.ms)}</div>\n )}\n </div>\n );\n })()}\n </div>\n </div>\n </div>\n </div>\n );\n}\n","/**\n * ContainerFillChart — visualises a loading list as one or more shipping\n * containers and their fill percentage. The volume of each line is\n * `quantity * volumePerUnit`; the chart sizes containers (20ft = 33 m³, 40ft\n * = 67 m³, preferring 20ft when the volume fits within +5%) and draws a fill\n * bar per container slot.\n *\n * Dual-bar mode (instruction vs loaded): when actual quantities exist on the\n * items, each container row layers two bars — blue for instruction volume,\n * green for loaded volume. Whichever is larger is rendered first (background);\n * the smaller one sits on top so both are simultaneously visible.\n *\n * Product-agnostic: this component does NO fetching. The per-unit volume of\n * each item is supplied by the consumer via `getVolume(item)` (typically a\n * lookup into a part-number → volume map the app fetched). Quantity and\n * \"new\" extraction default to the common `quantity` / `actual_qty` / `_isNew`\n * field names but are overridable so the chart isn't tied to any one shape.\n */\nimport type { CSSProperties } from 'react';\n\nconst C20 = 33; // 20ft container m³\nconst C40 = 67; // 40ft container m³\n\n/** Default item shape — overridable via the accessor props for any other shape. */\nexport interface ContainerFillItem {\n quantity?: number | null;\n actual_qty?: number | null;\n _isNew?: boolean;\n}\n\nexport interface ContainerFillChartProps<T = ContainerFillItem> {\n /** Line items to chart. Each contributes `qty * getVolume(item)` to the total. */\n items: T[];\n /**\n * Per-unit volume (m³) for an item. The lifted app concern — return 0 when\n * unknown. Total volume per item is `quantity * getVolume(item)`.\n */\n getVolume: (item: T) => number;\n /**\n * Single-bar quantity source when no actuals are present:\n * - 'instruction' (default): use the instruction quantity.\n * - 'actual': use the actual quantity (falling back to instruction).\n *\n * When actuals exist on at least one item the chart auto-switches to dual-bar\n * mode regardless of `qtyField` — instruction (blue) and loaded (green) are\n * layered into the same bar so both are visible at once.\n */\n qtyField?: 'instruction' | 'actual';\n /** Show the \"new items\" indicator next to the row count. */\n showNewIndicator?: boolean;\n /** Instruction quantity accessor. Defaults to `item.quantity`. */\n getInstructionQty?: (item: T) => number | null | undefined;\n /** Actual/loaded quantity accessor. Defaults to `item.actual_qty`. */\n getActualQty?: (item: T) => number | null | undefined;\n /**\n * Whether an item should count as charted at all. Defaults to \"has a non-empty\n * key\" — i.e. items whose volume source identifies a real part. By default\n * every item is charted; supply this to drop placeholder/empty rows.\n */\n isFilled?: (item: T) => boolean;\n /** Whether an item is newly added (drives `showNewIndicator`). Defaults to `item._isNew`. */\n isNew?: (item: T) => boolean;\n className?: string;\n style?: CSSProperties;\n}\n\nconst toInt = (v: unknown) => (typeof v === 'number' ? v : parseInt(String(v ?? '')) || 0);\n\n/**\n * Container-fill chart for shipping loading lists. Presentational only — pass\n * `getVolume` to inject per-unit volumes; the chart owns the container math and\n * the instruction-vs-loaded dual-bar rendering.\n */\nexport default function ContainerFillChart<T = ContainerFillItem>({\n items,\n getVolume,\n qtyField = 'instruction',\n showNewIndicator = false,\n getInstructionQty = (item) => (item as ContainerFillItem).quantity,\n getActualQty = (item) => (item as ContainerFillItem).actual_qty,\n isFilled,\n isNew = (item) => Boolean((item as ContainerFillItem)._isNew),\n className,\n style,\n}: ContainerFillChartProps<T>) {\n const filledLines = isFilled ? items.filter(isFilled) : items;\n\n // Instruction quantity always comes from the instruction accessor. Actual\n // quantity comes from the actual accessor (and counts as 0 when missing — the\n // auto-detect uses that to decide whether to draw the second layer).\n const qtyInstr = (l: T) => toInt(getInstructionQty(l));\n const qtyActual = (l: T) => toInt(getActualQty(l));\n\n const hasActual = filledLines.some((l) => getActualQty(l) != null && qtyActual(l) > 0);\n\n // Single-bar fallback: when there are no actuals at all, honor `qtyField` so\n // callers (e.g. a create form) still get an instruction-only chart even if\n // they pass qtyField='actual' at a stage where actuals don't exist yet.\n const qtyOf = (l: T) => {\n if (hasActual) return qtyInstr(l); // dual mode: this branch isn't actually used; we compute both totals separately below\n return qtyField === 'actual' ? (getActualQty(l) ?? getInstructionQty(l) ?? 0) : (getInstructionQty(l) ?? 0);\n };\n const totalQty = filledLines.reduce((s, l) => s + toInt(qtyOf(l)), 0);\n const newCount = filledLines.filter((l) => isNew(l)).length;\n const newQty = filledLines.filter((l) => isNew(l)).reduce((s, l) => s + toInt(qtyOf(l)), 0);\n\n // Per-mode totals.\n const totalQtyInstr = filledLines.reduce((s, l) => s + qtyInstr(l), 0);\n const totalQtyActual = filledLines.reduce((s, l) => s + qtyActual(l), 0);\n const totalVolumeInstr = filledLines.reduce((s, l) => s + getVolume(l) * qtyInstr(l), 0);\n const totalVolumeActual = filledLines.reduce((s, l) => s + getVolume(l) * qtyActual(l), 0);\n\n // The display volume drives container sizing + count. In dual mode we use the\n // larger of the two totals so neither layer gets visually clipped; in single\n // mode we fall back to whichever side has data.\n const totalVolume = hasActual\n ? Math.max(totalVolumeInstr, totalVolumeActual)\n : qtyField === 'actual'\n ? totalVolumeActual || totalVolumeInstr\n : totalVolumeInstr;\n\n // Prefer 20ft when it (the larger of the two volumes) fits within +5%.\n const useType = totalVolume <= C20 * 1.05 ? '20ft' : '40ft';\n const containerCap = useType === '20ft' ? C20 : C40;\n const totalContainers = totalVolume > 0 ? Math.max(1, Math.ceil(totalVolume / containerCap)) : 0;\n\n const totalCap = totalContainers * containerCap;\n const isOptimal = totalVolume > 0 && totalVolume >= totalCap * 0.95 && totalVolume <= totalCap * 1.1;\n\n if (filledLines.length === 0) return null;\n\n // Per-container fill percentages — split totals across N container slots.\n // Returned values can briefly exceed 100 for the last slot if the total\n // volume sits between (n-1)*cap and n*cap; we clamp at the render layer.\n const fillFor = (volume: number, idx: number) =>\n containerCap > 0 ? Math.max(0, Math.min(((volume - idx * containerCap) / containerCap) * 100, 100)) : 0;\n\n return (\n <div className={`mt-2 px-1 space-y-2 ${className ?? ''}`.trim()} style={style}>\n <div className=\"flex items-center justify-between text-xs text-gray-500\">\n <span>\n {filledLines.length} items · {totalQty} pcs\n {hasActual && totalQtyInstr !== totalQtyActual && (\n <span className=\"ml-1 text-gray-400\">({totalQtyInstr} instr / {totalQtyActual} loaded)</span>\n )}\n </span>\n {showNewIndicator && newCount > 0 && (\n <span className=\"flex items-center gap-1 text-green-600\">\n <span className=\"w-1.5 h-1.5 rounded-full bg-green-500\" />\n {newCount} new ({newQty} pcs)\n </span>\n )}\n </div>\n {totalVolume > 0 ? (\n <div className=\"space-y-1.5\">\n {Array.from({ length: totalContainers }).map((_, i) => {\n const instrPct = fillFor(totalVolumeInstr, i);\n const actualPct = fillFor(totalVolumeActual, i);\n // Dual mode: layer the bigger one underneath, smaller one on top (so\n // the smaller bar's color shows in its range and the bigger bar's\n // color shows in the difference range).\n const dual = hasActual;\n const longerPct = Math.max(instrPct, actualPct);\n const shorterPct = Math.min(instrPct, actualPct);\n const longerIsInstr = instrPct >= actualPct;\n const longerColor = dual ? (longerIsInstr ? 'bg-blue-500' : 'bg-green-500') : 'bg-blue-500';\n const shorterColor = dual ? (longerIsInstr ? 'bg-green-500' : 'bg-blue-500') : '';\n return (\n <div key={`bar-${i}`} className=\"flex items-center gap-2\">\n <span className=\"text-[10px] text-gray-400 w-8 shrink-0\">{useType}</span>\n <div className=\"relative flex-1 h-4 bg-gray-100 rounded-full overflow-hidden border border-gray-200\">\n {/* Background = the longer bar */}\n <div className={`absolute inset-y-0 left-0 ${longerColor} transition-all`} style={{ width: `${longerPct}%` }} />\n {/* Foreground (dual mode only) = the shorter bar, layered on top */}\n {dual && shorterPct > 0 && (\n <div className={`absolute inset-y-0 left-0 ${shorterColor} transition-all`} style={{ width: `${shorterPct}%` }} />\n )}\n </div>\n <span className=\"text-[10px] text-gray-500 w-16 text-right\">\n {dual\n ? `${Math.min(totalVolumeActual - i * containerCap, containerCap).toFixed(1)} / ${containerCap} m³`\n : `${Math.min(totalVolumeInstr - i * containerCap, containerCap).toFixed(1)} / ${containerCap} m³`}\n </span>\n </div>\n );\n })}\n <div className=\"flex items-center justify-between text-xs pt-0.5\">\n <span className=\"text-gray-500 inline-flex items-center gap-1\">\n Total:\n {hasActual ? (\n <>\n <span className=\"inline-flex items-center gap-1 text-blue-700\">\n <span className=\"inline-block w-2 h-2 rounded-full bg-blue-500\" />\n {totalVolumeInstr.toFixed(2)} m³ instruction\n </span>\n <span className=\"text-gray-400\">/</span>\n <span className=\"inline-flex items-center gap-1 text-green-700\">\n <span className=\"inline-block w-2 h-2 rounded-full bg-green-500\" />\n {totalVolumeActual.toFixed(2)} m³ loaded\n </span>\n </>\n ) : (\n <b className=\"text-gray-700\">{totalVolume.toFixed(2)} m³</b>\n )}\n </span>\n <span className={`font-medium ${isOptimal ? 'text-green-600' : 'text-gray-500'}`}>\n {isOptimal && '✓ '}\n {totalContainers} × {useType}\n </span>\n </div>\n </div>\n ) : (\n <div className=\"text-xs text-gray-400\">Volume: N/A (no volume data for these part numbers)</div>\n )}\n </div>\n );\n}\n","import type { ReactNode } from 'react';\n\n/**\n * Dependency-free Markdown renderer for help / documentation bodies.\n *\n * Supports the subset used by in-app articles: ATX headings (`##`–`####`),\n * **bold**, *italic*, `inline code`, [links](url), bullet and numbered lists\n * (with wrapped continuation lines), GitHub-style pipe **tables**, `>`\n * blockquote **callouts**, `---` rules, paragraphs, and image syntax\n * `` — which renders as a labelled *screenshot placeholder* box\n * (manual images may not exist yet). Unrecognised syntax degrades to plain\n * text, so author-written articles never break the page. No raw HTML is\n * interpreted.\n */\n\nconst INLINE_RE =\n /!\\[([^\\]]*)\\]\\(([^)]+)\\)|\\[([^\\]]+)\\]\\(([^)]+)\\)|\\*\\*([^*]+)\\*\\*|`([^`]+)`|\\*([^*]+)\\*/g;\n\nfunction renderInline(text: string): ReactNode[] {\n const out: ReactNode[] = [];\n let last = 0;\n let key = 0;\n let m: RegExpExecArray | null;\n INLINE_RE.lastIndex = 0;\n while ((m = INLINE_RE.exec(text)) !== null) {\n if (m.index > last) out.push(text.slice(last, m.index));\n if (m[1] !== undefined) {\n out.push(\n <span key={key++} className=\"text-gray-400\">\n [{m[1]}]\n </span>,\n );\n } else if (m[3] !== undefined) {\n out.push(\n <a\n key={key++}\n href={m[4]}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"text-blue-600 hover:underline\"\n >\n {m[3]}\n </a>,\n );\n } else if (m[5] !== undefined) {\n out.push(\n <strong key={key++} className=\"font-semibold text-gray-900\">\n {m[5]}\n </strong>,\n );\n } else if (m[6] !== undefined) {\n out.push(\n <code\n key={key++}\n className=\"rounded bg-gray-100 px-1 py-0.5 font-mono text-[0.85em] text-gray-800\"\n >\n {m[6]}\n </code>,\n );\n } else if (m[7] !== undefined) {\n out.push(<em key={key++}>{m[7]}</em>);\n }\n last = INLINE_RE.lastIndex;\n }\n if (last < text.length) out.push(text.slice(last));\n return out;\n}\n\nfunction ScreenshotPlaceholder({ alt }: { alt: string }) {\n const label = alt.replace(/^screenshot:\\s*/i, '');\n return (\n <div className=\"my-1 flex items-start gap-2 rounded-lg border border-dashed border-gray-300 bg-gray-50 px-3 py-2.5\">\n <svg\n className=\"mt-0.5 h-4 w-4 shrink-0 text-gray-400\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n >\n <path d=\"M3 6a1.5 1.5 0 0 1 1.5-1.5h1.1l.4-.9a1 1 0 0 1 .9-.6h6.2a1 1 0 0 1 .9.6l.4.9h1.1A1.5 1.5 0 0 1 18 6v8.5A1.5 1.5 0 0 1 16.5 16h-13A1.5 1.5 0 0 1 2 14.5V6Zm7.5 1.5a3.25 3.25 0 1 0 0 6.5 3.25 3.25 0 0 0 0-6.5Z\" />\n </svg>\n <span className=\"text-xs text-gray-500\">\n <span className=\"font-medium text-gray-600\">Screenshot — </span>\n {label}\n </span>\n </div>\n );\n}\n\n/** Collect list items, merging wrapped continuation lines into their item. */\nfunction collectItems(lines: string[], itemRe: RegExp): string[] {\n const items: string[] = [];\n for (const line of lines) {\n const m = itemRe.exec(line);\n if (m) {\n items.push(m[1]);\n } else if (items.length) {\n items[items.length - 1] += ' ' + line.trim();\n }\n }\n return items;\n}\n\nconst splitCells = (line: string): string[] =>\n line\n .replace(/^\\s*\\|/, '')\n .replace(/\\|\\s*$/, '')\n .split('|')\n .map(c => c.trim());\n\n/** A pipe table: header row, a `---|---` separator, then body rows. */\nfunction isTable(lines: string[]): boolean {\n return (\n lines.length >= 2 &&\n lines[0].includes('|') &&\n /^\\s*\\|?[\\s:|-]*-[\\s:|-]*\\|?\\s*$/.test(lines[1]) &&\n lines[1].includes('-')\n );\n}\n\nfunction renderTable(lines: string[], key: number): ReactNode {\n const header = splitCells(lines[0]);\n const rows = lines.slice(2).map(splitCells);\n return (\n <div key={key} className=\"my-1 overflow-x-auto rounded-lg border border-gray-200\">\n <table className=\"w-full border-collapse text-sm\">\n <thead>\n <tr className=\"bg-gray-50\">\n {header.map((h, i) => (\n <th\n key={i}\n className=\"border-b border-gray-200 px-3 py-1.5 text-left font-semibold text-gray-700\"\n >\n {renderInline(h)}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {rows.map((row, r) => (\n <tr key={r} className=\"even:bg-gray-50/50\">\n {row.map((c, i) => (\n <td key={i} className=\"border-t border-gray-100 px-3 py-1.5 align-top text-gray-700\">\n {renderInline(c)}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n}\n\nfunction renderBlock(block: string, key: number): ReactNode {\n const lines = block.split('\\n');\n const first = lines[0];\n\n const heading = /^(#{2,4})\\s+(.*)$/.exec(first);\n if (heading && lines.length === 1) {\n const level = heading[1].length;\n const Tag = (`h${level}` as 'h2');\n const cls =\n level === 2\n ? 'mt-2 text-[13px] font-semibold uppercase tracking-wide text-gray-500'\n : level === 3\n ? 'mt-1 text-base font-semibold text-gray-900'\n : 'mt-1 text-sm font-semibold text-gray-900';\n return (\n <Tag key={key} className={cls}>\n {renderInline(heading[2])}\n </Tag>\n );\n }\n\n if (lines.length === 1 && /^---+$/.test(first)) {\n return <hr key={key} className=\"border-gray-200\" />;\n }\n\n if (isTable(lines)) {\n return renderTable(lines, key);\n }\n\n if (/^>\\s?/.test(first)) {\n const text = lines.map(l => l.replace(/^>\\s?/, '')).join(' ');\n return (\n <div\n key={key}\n className=\"my-1 rounded-r-lg border-l-4 border-blue-300 bg-blue-50/60 px-3 py-2 text-gray-700\"\n >\n {renderInline(text)}\n </div>\n );\n }\n\n const img = /^!\\[([^\\]]*)\\]\\(([^)]+)\\)$/.exec(first);\n if (img && lines.length === 1) {\n return <ScreenshotPlaceholder key={key} alt={img[1]} />;\n }\n\n if (/^[-*]\\s+/.test(first)) {\n const items = collectItems(lines, /^[-*]\\s+(.*)$/);\n return (\n <ul key={key} className=\"list-disc space-y-1 pl-5 marker:text-gray-400\">\n {items.map((it, j) => (\n <li key={j}>{renderInline(it)}</li>\n ))}\n </ul>\n );\n }\n\n const ordered = /^(\\d+)\\.\\s+/.exec(first);\n if (ordered) {\n const items = collectItems(lines, /^\\d+\\.\\s+(.*)$/);\n return (\n <ol\n key={key}\n start={Number(ordered[1])}\n className=\"list-decimal space-y-1 pl-5 marker:text-gray-400\"\n >\n {items.map((it, j) => (\n <li key={j} className=\"pl-1\">\n {renderInline(it)}\n </li>\n ))}\n </ol>\n );\n }\n\n return <p key={key}>{renderInline(lines.join(' '))}</p>;\n}\n\nexport interface MarkdownProps {\n children: string;\n className?: string;\n}\n\nexport default function Markdown({ children, className }: MarkdownProps) {\n const blocks = (children ?? '')\n .replace(/\\r\\n/g, '\\n')\n .split(/\\n{2,}/)\n .map(b => b.replace(/\\s+$/, ''))\n .filter(b => b.trim() !== '');\n\n return (\n <div className={`space-y-3 text-sm leading-relaxed text-gray-700 ${className ?? ''}`.trim()}>\n {blocks.map((block, i) => renderBlock(block, i))}\n </div>\n );\n}\n","import { useMemo, useState, type ReactNode } from 'react';\nimport Markdown from './Markdown';\n\n/**\n * One help article. Generic shape — the consuming portal maps its own\n * help-doc records onto this before passing them in.\n */\nexport interface HelpCenterDoc {\n id: string;\n slug: string;\n title: string;\n body: string;\n /** Grouping key (e.g. `'getting_started'`). */\n category: string;\n /** Group header text (e.g. \"Getting Started\"). */\n category_label: string;\n /** When `false`, a \"Draft\" badge is shown. Omit for always-published docs. */\n is_published?: boolean;\n}\n\nexport interface HelpCenterProps {\n docs: HelpCenterDoc[];\n loading?: boolean;\n /**\n * Category keys in display order. Categories not listed fall to the end in\n * first-seen order. Without it, groups follow first-seen order.\n */\n categoryOrder?: string[];\n /** Show the New/Edit affordances (consumer gates this on write permission). */\n canEdit?: boolean;\n onNew?: () => void;\n onEdit?: (doc: HelpCenterDoc) => void;\n /** Custom body renderer; defaults to preformatted text. */\n renderBody?: (doc: HelpCenterDoc) => ReactNode;\n emptyMessage?: string;\n}\n\ninterface Group {\n key: string;\n label: string;\n docs: HelpCenterDoc[];\n}\n\nconst Chevron = ({ open }: { open: boolean }) => (\n <svg\n className={`h-3.5 w-3.5 shrink-0 text-gray-400 transition-transform ${open ? 'rotate-90' : ''}`}\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n >\n <path\n fillRule=\"evenodd\"\n d=\"M7.21 14.77a.75.75 0 0 1 .02-1.06L11.168 10 7.23 6.29a.75.75 0 1 1 1.04-1.08l4.5 4.25a.75.75 0 0 1 0 1.08l-4.5 4.25a.75.75 0 0 1-1.06-.02Z\"\n clipRule=\"evenodd\"\n />\n </svg>\n);\n\n/**\n * In-app help / documentation viewer. Two panes: a searchable, collapsible\n * category tree on the left, the selected article's body on the right.\n *\n * Presentational only — it holds no API or permission knowledge. The consumer\n * fetches its own help docs, maps them to `HelpCenterDoc`, and (for editors)\n * wires `canEdit` + `onNew`/`onEdit` to its own create/edit UI.\n *\n * Search is client-side: a case-insensitive substring match over title, body\n * and category label. While searching, matching groups auto-expand.\n */\nexport default function HelpCenter({\n docs,\n loading = false,\n categoryOrder,\n canEdit = false,\n onNew,\n onEdit,\n renderBody,\n emptyMessage = 'No help articles yet.',\n}: HelpCenterProps) {\n const [query, setQuery] = useState('');\n const [selectedSlug, setSelectedSlug] = useState<string | null>(null);\n // Per-category open/closed override. A category absent from the map uses its\n // default (only the selected article's group starts open).\n const [expanded, setExpanded] = useState<Record<string, boolean>>({});\n\n const q = query.trim().toLowerCase();\n\n // Group docs by category, preserving categoryOrder then first-seen order.\n const groups = useMemo<Group[]>(() => {\n const map = new Map<string, Group>();\n for (const doc of docs) {\n let g = map.get(doc.category);\n if (!g) {\n g = { key: doc.category, label: doc.category_label || doc.category, docs: [] };\n map.set(doc.category, g);\n }\n g.docs.push(doc);\n }\n if (!categoryOrder?.length) return [...map.values()];\n const rank = new Map(categoryOrder.map((k, i) => [k, i]));\n return [...map.values()].sort(\n (a, b) => (rank.get(a.key) ?? Infinity) - (rank.get(b.key) ?? Infinity),\n );\n }, [docs, categoryOrder]);\n\n const matches = (doc: HelpCenterDoc) =>\n !q ||\n doc.title.toLowerCase().includes(q) ||\n doc.body.toLowerCase().includes(q) ||\n doc.category_label.toLowerCase().includes(q);\n\n // Groups with their docs filtered by the search query; empty groups drop out.\n const visibleGroups = useMemo<Group[]>(\n () =>\n groups\n .map(g => ({ ...g, docs: g.docs.filter(matches) }))\n .filter(g => g.docs.length > 0),\n [groups, q],\n );\n\n const visibleDocs = useMemo(() => visibleGroups.flatMap(g => g.docs), [visibleGroups]);\n\n // Keep the chosen article if it's still visible, else fall back to the first\n // visible one (so typing a query jumps to the first match).\n const selected =\n (selectedSlug ? visibleDocs.find(d => d.slug === selectedSlug) : undefined) ??\n visibleDocs[0] ??\n null;\n\n const isGroupOpen = (key: string) =>\n q ? true : (expanded[key] ?? key === selected?.category);\n\n const toggleGroup = (key: string) =>\n setExpanded(prev => ({ ...prev, [key]: !isGroupOpen(key) }));\n\n return (\n <div className=\"flex h-full gap-4 px-4 py-3 min-h-0\">\n <aside className=\"w-64 shrink-0 flex flex-col bg-white rounded-lg shadow overflow-hidden\">\n <div className=\"flex items-center justify-between gap-2 px-3 py-2 border-b border-gray-200 bg-gray-50 shrink-0\">\n <h2 className=\"text-sm font-semibold text-gray-900\">Help</h2>\n {canEdit && onNew && (\n <button type=\"button\" onClick={onNew} className=\"text-xs text-blue-600 hover:underline\">\n + New\n </button>\n )}\n </div>\n\n <div className=\"px-2.5 py-2 border-b border-gray-100 shrink-0\">\n <div className=\"relative\">\n <svg\n className=\"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n >\n <path\n fillRule=\"evenodd\"\n d=\"M9 3.5a5.5 5.5 0 1 0 3.36 9.85l3.14 3.15a.75.75 0 1 0 1.06-1.06l-3.15-3.14A5.5 5.5 0 0 0 9 3.5ZM5 9a4 4 0 1 1 8 0 4 4 0 0 1-8 0Z\"\n clipRule=\"evenodd\"\n />\n </svg>\n <input\n type=\"text\"\n value={query}\n onChange={e => setQuery(e.target.value)}\n placeholder=\"Search help…\"\n className=\"w-full rounded-md border border-gray-300 bg-white py-1.5 pl-8 pr-2 text-sm shadow-sm focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500\"\n />\n </div>\n </div>\n\n <div className=\"flex-1 overflow-y-auto py-1\">\n {loading ? (\n <p className=\"px-3 py-6 text-center text-xs text-gray-400\">Loading…</p>\n ) : visibleGroups.length === 0 ? (\n <p className=\"px-3 py-6 text-center text-xs text-gray-500\">\n {q ? 'No articles match your search.' : emptyMessage}\n </p>\n ) : (\n visibleGroups.map(group => {\n const open = isGroupOpen(group.key);\n return (\n <div key={group.key} className=\"py-0.5\">\n <button\n type=\"button\"\n onClick={() => toggleGroup(group.key)}\n className=\"w-full flex items-center gap-1.5 px-3 py-1.5 text-left text-[10px] font-semibold uppercase tracking-wide text-gray-400 hover:text-gray-600\"\n >\n <Chevron open={open} />\n <span className=\"truncate\">{group.label}</span>\n </button>\n {open &&\n group.docs.map(doc => {\n const active = selected?.slug === doc.slug;\n return (\n <button\n key={doc.slug}\n type=\"button\"\n onClick={() => setSelectedSlug(doc.slug)}\n className={`w-full text-left pl-8 pr-3 py-1.5 text-sm flex items-center gap-1.5 transition-colors ${\n active\n ? 'bg-blue-50 text-blue-700 font-medium'\n : 'text-gray-700 hover:bg-gray-50'\n }`}\n >\n <span className=\"truncate\">{doc.title}</span>\n {doc.is_published === false && (\n <span className=\"ml-auto shrink-0 text-[10px] text-amber-600\">Draft</span>\n )}\n </button>\n );\n })}\n </div>\n );\n })\n )}\n </div>\n </aside>\n\n <main className=\"flex-1 min-w-0 bg-white rounded-lg shadow overflow-hidden flex flex-col\">\n {selected ? (\n <>\n <div className=\"flex items-start justify-between gap-4 px-5 py-3 border-b border-gray-200 bg-gray-50 shrink-0\">\n <div className=\"min-w-0\">\n <h1 className=\"text-lg font-semibold text-gray-900 truncate\">{selected.title}</h1>\n <p className=\"text-xs text-gray-500 mt-0.5\">\n {selected.category_label}\n {selected.is_published === false && (\n <span className=\"ml-2 text-amber-600\">· Draft</span>\n )}\n </p>\n </div>\n {canEdit && onEdit && (\n <button\n type=\"button\"\n onClick={() => onEdit(selected)}\n className=\"shrink-0 text-sm text-blue-600 hover:underline\"\n >\n Edit\n </button>\n )}\n </div>\n <div className=\"flex-1 overflow-auto px-5 py-4\">\n {renderBody ? (\n renderBody(selected)\n ) : selected.body ? (\n <Markdown>{selected.body}</Markdown>\n ) : (\n <p className=\"text-sm text-gray-500 italic\">This article has no body yet.</p>\n )}\n </div>\n </>\n ) : (\n <div className=\"flex-1 flex items-center justify-center px-6 text-center\">\n <p className=\"text-sm text-gray-500\">\n {loading ? 'Loading…' : 'Pick a help article from the left.'}\n </p>\n </div>\n )}\n </main>\n </div>\n );\n}\n","import type { ReactNode } from 'react';\n\n/**\n * Full-width action button for the `SidebarLayout` `sidebarTop` / `sidebarBottom`\n * slots — the standard list-window pattern of a primary \"New X\" button pinned\n * at the top and a secondary action (e.g. \"Export CSV\") pinned at the bottom.\n *\n * `variant=\"primary\"` is the solid-blue create button; `\"secondary\"` is the\n * white outline button. Pass `hotkey` (e.g. `ALT_SHIFT_N`) to render the small\n * keyboard-hint chip the shell's `useNewHotkey` binds.\n *\n * @example\n * <SidebarLayout\n * sidebarTop={<SidebarActionButton hotkey={ALT_SHIFT_N} onClick={onNew}>New Invoice</SidebarActionButton>}\n * sidebar={<StatusNav />}\n * >…</SidebarLayout>\n */\nexport interface SidebarActionButtonProps {\n children: ReactNode;\n onClick?: () => void;\n /** Solid-blue create button (`'primary'`, default) or white outline (`'secondary'`). */\n variant?: 'primary' | 'secondary';\n /** Keyboard-hint label rendered as a trailing chip, e.g. `ALT_SHIFT_N`. */\n hotkey?: string;\n disabled?: boolean;\n type?: 'button' | 'submit';\n title?: string;\n /** Extra classes appended after the variant styles (escape hatch). */\n className?: string;\n}\n\nconst VARIANTS = {\n primary: 'bg-blue-600 text-white hover:bg-blue-700',\n secondary: 'bg-white text-gray-700 border border-gray-300 hover:bg-gray-50',\n} as const;\n\nexport default function SidebarActionButton({\n children,\n onClick,\n variant = 'primary',\n hotkey,\n disabled = false,\n type = 'button',\n title,\n className = '',\n}: SidebarActionButtonProps) {\n return (\n <button\n type={type}\n onClick={onClick}\n disabled={disabled}\n title={title}\n className={`w-full inline-flex items-center justify-center gap-2 rounded-lg px-4 py-2 text-sm font-medium transition-colors disabled:opacity-50 ${VARIANTS[variant]} ${className}`}\n >\n {children}\n {hotkey && (\n <kbd className=\"rounded border border-blue-400/50 bg-blue-500/30 px-1.5 py-0.5 text-[10px] font-medium\">\n {hotkey}\n </kbd>\n )}\n </button>\n );\n}\n","import type { ReactNode } from 'react';\nimport { resolveSeverity, type SeverityTone } from './severity';\n\n/**\n * Presentational building blocks for SidebarLayout filter sidebars (status\n * buckets, categories, …) — the same item + group-label markup every list\n * window renders. Data wiring (count fetching) stays in the consuming app.\n */\n\nexport function SidebarGroupLabel({ children }: { children: ReactNode }) {\n return (\n <p className=\"px-2.5 pb-1 pt-1 text-[11px] font-semibold uppercase tracking-wide text-gray-400\">{children}</p>\n );\n}\n\nexport function SidebarNavItem({ label, count, active, onClick, severity }: {\n label: string;\n count?: number;\n active: boolean;\n onClick: () => void;\n /**\n * Optional health marker — a small dot before the label, in the shell's\n * status vocabulary (`success | warning | danger`). For sidebars that double\n * as an alarm surface: a problem several levels down inside a section stays\n * visible on the always-on nav item that leads to it, without the operator\n * having to open anything.\n *\n * Roll the tone up in the consuming app (worst-of its children) — the item\n * renders a severity, it never computes one. Omitting it is not a claim of\n * health, it is no claim at all, and renders exactly as an item did before\n * this prop existed.\n *\n * A tone that arrives from a backend rollup has not been near the compiler,\n * so an unrecognised token (`'crit'`, `'critical'`, a stale enum) renders a\n * visible \"unknown severity\" marker and logs — never nothing. This item is\n * often the ONLY place a deep alarm surfaces; a marker that quietly vanishes\n * on a bad token would turn the safety feature into the outage.\n */\n severity?: SeverityTone;\n}) {\n // `null` when the prop was omitted (no marker at all — 3.24's markup), a\n // style otherwise. Never partially-undefined classes, whatever came in.\n const marker = resolveSeverity(severity, 'SidebarNavItem');\n return (\n <button\n type=\"button\"\n onClick={onClick}\n className={`flex w-full items-center justify-between gap-2 rounded-lg px-2.5 py-1.5 text-sm text-left ${active ? 'bg-blue-50 font-medium text-blue-700' : 'text-gray-700 hover:bg-gray-100'}`}\n >\n {marker && (\n // Decorative in the a11y tree — the word itself follows the label, so\n // the item reads \"Warehouses, warning, 12\" in that order instead of\n // leading with a tone before anyone knows what it belongs to.\n <span\n aria-hidden=\"true\"\n title={marker.word}\n className={`shrink-0 h-1.5 w-1.5 rounded-full ${marker.fill}`}\n />\n )}\n {/* `mr-auto` only with a marker: the button is `justify-between`, which\n would otherwise push the dot to the far left and strand the label in\n the middle. An auto margin absorbs the free space instead, so the dot\n stays against the label and the count keeps its right edge. Without a\n marker the class list is untouched — 3.24's exact markup. */}\n <span className={marker ? 'truncate mr-auto' : 'truncate'}>{label}</span>\n {marker && <span className=\"sr-only\">{marker.word}</span>}\n {count != null && count > 0 && (\n <span className={`shrink-0 inline-flex items-center justify-center min-w-[1.25rem] px-1.5 h-5 rounded-full text-[11px] font-medium ${active ? 'bg-blue-100 text-blue-700' : 'bg-gray-100 text-gray-600'}`}>\n {count}\n </span>\n )}\n </button>\n );\n}\n","import type { ReactNode } from 'react';\n\n/**\n * Generic top navigation bar. A horizontal row of tab-style links with an\n * optional brand on the left and free-form actions on the right. Self-contained\n * and styled with the shell's Tailwind utilities, so it themes for free.\n *\n * Controlled: pass `activeKey` and handle `onSelect`. The active item gets an\n * accent underline. Items can carry an `icon`, a `badge` (e.g. a count) and be\n * `disabled`.\n */\nexport interface TopNavItem {\n /** Stable key — what `onSelect` receives and `activeKey` matches. */\n key: string;\n label: ReactNode;\n /** Optional leading icon (typically a 4×4 svg). */\n icon?: ReactNode;\n /** Optional trailing badge — a count, dot, \"New\", etc. */\n badge?: ReactNode;\n disabled?: boolean;\n}\n\nexport interface TopNavProps {\n items: TopNavItem[];\n /** Key of the active item — it gets the accent underline. */\n activeKey?: string;\n onSelect?: (key: string) => void;\n /** Left slot — logo / product title. */\n brand?: ReactNode;\n /** Right slot — actions (buttons, search, avatar…). Pinned to the far right. */\n actions?: ReactNode;\n className?: string;\n}\n\nexport default function TopNav({ items, activeKey, onSelect, brand, actions, className }: TopNavProps) {\n return (\n <div\n className={`flex h-12 shrink-0 items-stretch gap-1 border-b border-gray-200 bg-white px-3 ${className ?? ''}`}\n >\n {brand && (\n <div className=\"mr-1 flex items-center gap-2 pr-3 font-semibold text-gray-900\">{brand}</div>\n )}\n <nav className=\"flex items-stretch gap-0.5\">\n {items.map(item => {\n const active = item.key === activeKey;\n return (\n <button\n key={item.key}\n type=\"button\"\n disabled={item.disabled}\n aria-current={active ? 'page' : undefined}\n onClick={() => !item.disabled && onSelect?.(item.key)}\n className={`relative inline-flex items-center gap-1.5 px-3 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-40 ${\n active ? 'text-blue-600' : 'text-gray-600 hover:text-gray-900'\n }`}\n >\n {item.icon && <span className=\"h-4 w-4 shrink-0\">{item.icon}</span>}\n <span className=\"whitespace-nowrap\">{item.label}</span>\n {item.badge != null && (\n <span className=\"ml-0.5 inline-flex min-w-[1.25rem] items-center justify-center rounded-full bg-gray-100 px-1.5 text-[11px] font-semibold leading-5 text-gray-600\">\n {item.badge}\n </span>\n )}\n {active && (\n <span className=\"absolute inset-x-2 -bottom-px h-0.5 rounded-full bg-blue-600\" aria-hidden />\n )}\n </button>\n );\n })}\n </nav>\n {actions && <div className=\"ml-auto flex items-center gap-2\">{actions}</div>}\n </div>\n );\n}\n","/**\n * DropdownMenu — a trigger and the menu it opens.\n *\n * `PopupMenu` is the surface: the caller positions it and decides when it\n * exists, which is right for a context menu summoned at a cursor. A dropdown\n * hangs off a control instead, and everything that makes it usable — where it\n * lands, when it closes, which item the arrow keys are on, where focus goes\n * afterwards — is the same wherever it appears. So it lives here rather than\n * being written again beside each trigger.\n *\n * The surface is `PopupMenu`, so a dropdown and a context menu look the same\n * and follow the same `--menu-density`.\n */\nimport { useCallback, useEffect, useId, useRef, useState, type ReactNode } from 'react';\nimport { PopupMenu, PopupMenuItem } from './PopupMenu';\nimport { registerModalEscapeInterceptor } from './escapeInterceptors';\n\nexport type DropdownMenuAlign = 'start' | 'end';\n\nexport interface DropdownMenuItem {\n key: string;\n label: ReactNode;\n icon?: ReactNode;\n /** A destructive choice — delete, revoke. Drawn in the danger tone. */\n danger?: boolean;\n disabled?: boolean;\n onSelect: () => void;\n}\n\nexport interface DropdownMenuProps {\n /** What opens the menu. Rendered inside the trigger button. */\n trigger: ReactNode;\n items: DropdownMenuItem[];\n /** Which edge the menu lines up with. `end` (the default) suits a menu at\n * the right of a row, where a left-aligned one would run off the card. */\n align?: DropdownMenuAlign;\n /** Names the trigger. Required in practice — the trigger is usually an icon. */\n 'aria-label'?: string;\n className?: string;\n disabled?: boolean;\n}\n\nexport default function DropdownMenu({\n trigger, items, align = 'end', 'aria-label': ariaLabel, className = '', disabled,\n}: DropdownMenuProps) {\n const [open, setOpen] = useState(false);\n const [active, setActive] = useState(0);\n const wrapRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const itemRefs = useRef<(HTMLButtonElement | null)[]>([]);\n const menuId = useId();\n\n const close = useCallback((restoreFocus: boolean) => {\n setOpen(false);\n // Focus goes back to the trigger unless the user clicked away, where\n // yanking it back would move them somewhere they did not ask to be.\n if (restoreFocus) triggerRef.current?.focus();\n }, []);\n\n // Walks from `from` until it finds an item that can take focus. Bounded by\n // the item count, so an all-disabled menu returns rather than spinning.\n const enabledFrom = (from: number, step: 1 | -1) => {\n for (let i = 0; i < items.length; i += 1) {\n const at = (((from + step * i) % items.length) + items.length) % items.length;\n if (!items[at]?.disabled) return at;\n }\n return from;\n };\n\n useEffect(() => {\n if (!open) return;\n const onPointerDown = (e: PointerEvent) => {\n if (!wrapRef.current?.contains(e.target as Node)) close(false);\n };\n document.addEventListener('pointerdown', onPointerDown, true);\n return () => document.removeEventListener('pointerdown', onPointerDown, true);\n }, [open, close]);\n\n useEffect(() => {\n if (open) itemRefs.current[active]?.focus();\n }, [open, active]);\n\n // Escape, through the shell's interceptor seam rather than an onKeyDown here.\n //\n // A bubble-phase handler cannot win: `Modal` listens for Escape on `window`\n // in the CAPTURE phase and calls stopPropagation() when it closes, and\n // capture runs window before the target — so inside any shell window,\n // Escape closed the whole window and this menu went down with it. The seam\n // is the one place Modal consults BEFORE closing, and since 4.27.0 it drains\n // itself where no shell is mounted, so a till and a routed page are covered\n // by the same registration. Same fix `Tooltip` took in 4.30.1.\n useEffect(() => {\n if (!open) return;\n return registerModalEscapeInterceptor(event => {\n if (event.key !== 'Escape') return false;\n close(true);\n return true;\n });\n }, [open, close]);\n\n const openAt = (index: number) => {\n setActive(index);\n setOpen(true);\n };\n\n const onTriggerKeyDown = (e: React.KeyboardEvent<HTMLButtonElement>) => {\n if (e.key === 'ArrowDown' || e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n openAt(enabledFrom(0, 1));\n } else if (e.key === 'ArrowUp') {\n // Opening upward lands on the last item, which is where the eye goes.\n e.preventDefault();\n openAt(enabledFrom(items.length - 1, -1));\n }\n };\n\n const onMenuKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (e.key === 'ArrowDown') { e.preventDefault(); setActive(enabledFrom(active + 1, 1)); }\n else if (e.key === 'ArrowUp') { e.preventDefault(); setActive(enabledFrom(active - 1, -1)); }\n else if (e.key === 'Home') { e.preventDefault(); setActive(enabledFrom(0, 1)); }\n else if (e.key === 'End') { e.preventDefault(); setActive(enabledFrom(items.length - 1, -1)); }\n // Escape is deliberately absent: it is registered on the interceptor seam\n // above, because a bubble-phase handler here loses to Modal's window-level\n // capture listener and the whole window would close instead of the menu.\n else if (e.key === 'Tab') {\n // Tab leaves the menu rather than moving inside it, and the menu goes\n // with it — a dropdown left open behind the cursor is a stray overlay.\n //\n // Focus goes back to the TRIGGER, and the Tab is consumed rather than\n // also moving on. Letting it through looks more standard and is not:\n // the default action picks the next tabbable from whatever has focus\n // WHEN IT RUNS, which is still a menu item React has not unmounted yet,\n // so where the user lands depends on render timing. Consuming it costs\n // one more press and always ends somewhere they can see.\n e.preventDefault();\n close(true);\n }\n };\n\n const select = (item: DropdownMenuItem) => {\n if (item.disabled) return;\n close(true);\n item.onSelect();\n };\n\n return (\n <div ref={wrapRef} className={`relative inline-flex ${className}`.trim()}>\n <button\n ref={triggerRef}\n type=\"button\"\n aria-haspopup=\"menu\"\n aria-expanded={open}\n aria-controls={open ? menuId : undefined}\n aria-label={ariaLabel}\n disabled={disabled}\n onClick={() => (open ? close(false) : openAt(enabledFrom(0, 1)))}\n onKeyDown={onTriggerKeyDown}\n className=\"inline-flex items-center justify-center rounded-md text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400 disabled:cursor-not-allowed disabled:opacity-60\"\n >\n {trigger}\n </button>\n\n {open && (\n <div\n className={`absolute top-full z-50 mt-1 ${align === 'end' ? 'right-0' : 'left-0'}`}\n onKeyDown={onMenuKeyDown}\n >\n {/* `portal: false` — the menu is positioned against the trigger by\n this wrapper, so moving it to <body> would leave it at the top\n left of the page.\n\n No `onClose`: PopupMenu's own dismissal calls the same callback\n for Escape and for a click elsewhere, and those want opposite\n things. Escape is the user putting the menu away, so focus goes\n back to the trigger; a click elsewhere is them going somewhere,\n and dragging focus back would take them off what they just\n clicked. The handlers above tell the two apart. */}\n <PopupMenu portal={false} minWidth={180}>\n <div id={menuId} role=\"menu\" aria-orientation=\"vertical\" aria-label={ariaLabel}>\n {items.map((item, i) => (\n <PopupMenuItem\n key={item.key}\n ref={el => { itemRefs.current[i] = el; }}\n role=\"menuitem\"\n // One tab stop for the whole menu; the arrows move inside it.\n tabIndex={i === active ? 0 : -1}\n danger={item.danger}\n disabled={item.disabled}\n onMouseEnter={() => { if (!item.disabled) setActive(i); }}\n onClick={() => select(item)}\n >\n {item.icon}\n {item.label}\n </PopupMenuItem>\n ))}\n </div>\n </PopupMenu>\n </div>\n )}\n </div>\n );\n}\n","/**\n * Drawer — a panel that slides in from an edge, over the page.\n *\n * The same modal contract as `Dialog` — focus trapped, page behind locked,\n * Escape claimed through the shell's interceptor — with a different shape. Use\n * a Drawer when the content is a LIST or a long form that wants height, and a\n * Dialog when it is a question that wants to be answered and dismissed. A\n * drawer holding one sentence and two buttons is a dialog wearing the wrong\n * clothes; a dialog holding twenty fields is a scroll trap.\n *\n * Imports nothing but React and its two sibling modules, so it belongs to\n * `react-os-shell/ui` alongside `Dialog`.\n */\nimport { useEffect, useId, useRef, type ReactNode, type RefObject } from 'react';\nimport { useFocusTrap, useScrollLock } from './focusTrap';\nimport { registerModalEscapeInterceptor } from './escapeInterceptors';\n\nexport type DrawerSide = 'right' | 'left' | 'bottom';\nexport type DrawerSize = 'sm' | 'md' | 'lg';\n\nexport interface DrawerProps {\n open: boolean;\n onClose: () => void;\n side?: DrawerSide;\n size?: DrawerSize;\n title?: ReactNode;\n /** Action row pinned to the bottom edge, outside the scrolling body. */\n footer?: ReactNode;\n children?: ReactNode;\n /** Escape and the scrim do nothing. See Dialog's note before reaching for it. */\n blocking?: boolean;\n initialFocus?: RefObject<HTMLElement | null>;\n className?: string;\n}\n\n// Px, applied inline. `w-[28rem]` is an arbitrary value and produces no style\n// in the compiled stylesheet the design-sync previews use — the same reason\n// Avatar and Skeleton size themselves this way.\nconst SIZE_PX: Record<DrawerSize, number> = { sm: 320, md: 448, lg: 640 };\n\nconst SIDE_POSITION: Record<DrawerSide, string> = {\n right: 'inset-y-0 right-0',\n left: 'inset-y-0 left-0',\n bottom: 'inset-x-0 bottom-0',\n};\n\nexport default function Drawer({\n open, onClose, side = 'right', size = 'md', title, footer, children,\n blocking = false, initialFocus, className = '',\n}: DrawerProps) {\n const panelRef = useRef<HTMLDivElement>(null);\n const bodyId = useId();\n\n useFocusTrap(panelRef, open, initialFocus);\n useScrollLock(open);\n\n useEffect(() => {\n if (!open) return;\n return registerModalEscapeInterceptor(() => {\n if (blocking) return true;\n onClose();\n return true;\n });\n }, [open, blocking, onClose]);\n\n if (!open) return null;\n\n const isBottom = side === 'bottom';\n const panelStyle = isBottom\n ? { maxHeight: '85vh' }\n : { width: SIZE_PX[size], maxWidth: '100vw' };\n\n return (\n <div className=\"fixed inset-0 z-[9999]\" role=\"presentation\">\n <div className=\"fixed inset-0 bg-black/30\" onClick={blocking ? undefined : onClose} aria-hidden=\"true\" />\n <div\n ref={panelRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={typeof title === 'string' ? title : undefined}\n // Same reasoning as Dialog: the body is the description, and a screen\n // reader only reads it on open if the panel says so.\n aria-describedby={children ? bodyId : undefined}\n style={panelStyle}\n className={[\n 'fixed flex flex-col bg-white shadow-xl',\n SIDE_POSITION[side],\n isBottom ? 'rounded-t-xl' : '',\n className,\n ].filter(Boolean).join(' ')}\n >\n {(title || !blocking) && (\n <div className=\"flex shrink-0 items-center justify-between gap-4 border-b border-gray-100 px-4 py-3\">\n {title ? <h2 className=\"text-base font-semibold text-gray-900\">{title}</h2> : <span />}\n {!blocking && (\n <button\n type=\"button\"\n onClick={onClose}\n aria-label=\"Close\"\n className=\"rounded-md p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600\"\n >\n <svg className=\"h-5 w-5\" viewBox=\"0 0 20 20\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" aria-hidden=\"true\">\n <path d=\"M6 6l8 8M14 6l-8 8\" />\n </svg>\n </button>\n )}\n </div>\n )}\n {/* Only the body scrolls, so the header and actions stay reachable in a\n long form — the thing a drawer is usually chosen for. */}\n <div id={bodyId} className=\"min-h-0 flex-1 overflow-y-auto px-4 py-4\">{children}</div>\n {footer && (\n <div className=\"flex shrink-0 justify-end gap-3 border-t border-gray-100 px-4 py-3\">{footer}</div>\n )}\n </div>\n </div>\n );\n}\n","/**\n * GlobalSearch — the ⌘K overlay: one input, every provider queried in\n * parallel, arrow keys and Enter over the merged results.\n *\n * ── Why it takes `onSelect` instead of calling openEntity itself ──\n * It used to `import { useWindowManager }` for exactly one line: opening the\n * chosen result in a window. The hook is only a `useContext` and would not have\n * thrown without a provider — but an import is resolved statically, so that one\n * line pulled `WindowManager` and therefore react-query and axios into the\n * module graph of anything containing this overlay. That is what kept a\n * self-contained search box out of `react-os-shell/ui`.\n *\n * `Layout` passes `openEntity` in, so the desktop shell behaves exactly as\n * before; a routed app passes its own navigation and gets the same overlay\n * without the window manager. The alternative — a second, \"headless\" palette\n * component beside this one — would have put two components with the same job\n * in one barrel, where `export *` loses to an explicit export silently.\n */\nimport { useState, useEffect, useRef, useCallback } from 'react';\nimport { glassStyle as getGlassStyle } from '../utils/glass';\n\nexport interface SearchResult {\n /** Category label, e.g. \"Sales Order\". */\n type: string;\n /** Primary text shown in the result row. */\n label: string;\n /** Optional secondary line. */\n sub?: string;\n /** Window-registry key passed to openEntity. */\n entity_type: string;\n entity_id: string;\n}\n\n/** A search provider — given a query, returns matching results. The shell\n * calls every provider in parallel and concatenates the responses. */\nexport type SearchProvider = (query: string) => Promise<SearchResult[]>;\n\n/** Bundle of search-related consumer config. */\nexport interface SearchConfig {\n providers: SearchProvider[];\n /** Per-result-type icon (SVG path `d` attribute). Unmatched types fall\n * back to a generic magnifier glyph. */\n typeIcons?: Record<string, string>;\n placeholder?: string;\n}\n\nexport interface GlobalSearchProps extends Partial<SearchConfig> {\n /**\n * What to do with the chosen result. Called after the overlay closes.\n *\n * Supplied by whoever renders the overlay, not by the consumer's\n * `SearchConfig`: inside the desktop shell `Layout` passes `openEntity`, and\n * a routed app passes its own navigation. Omitted, selecting a result just\n * closes the overlay — which is what a search with nowhere to go should do.\n */\n onSelect?: (result: SearchResult) => void;\n}\n\nconst DEFAULT_MAGNIFIER = 'M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z';\n\nexport default function GlobalSearch({ providers, typeIcons, placeholder = 'Search...', onSelect }: GlobalSearchProps = {}) {\n const [open, setOpen] = useState(false);\n const [query, setQuery] = useState('');\n const [results, setResults] = useState<SearchResult[]>([]);\n const [loading, setLoading] = useState(false);\n const [activeIdx, setActiveIdx] = useState(0);\n const inputRef = useRef<HTMLInputElement>(null);\n const debounceRef = useRef<ReturnType<typeof setTimeout>>();\n\n // Hotkey: Cmd+K / Ctrl+K\n useEffect(() => {\n const handler = (e: KeyboardEvent) => {\n if ((e.ctrlKey || e.metaKey) && e.key === 'k') {\n e.preventDefault();\n setOpen(prev => !prev);\n }\n if (e.key === 'Escape' && open) {\n setOpen(false);\n }\n };\n window.addEventListener('keydown', handler);\n return () => window.removeEventListener('keydown', handler);\n }, [open]);\n\n useEffect(() => {\n if (open) {\n setTimeout(() => inputRef.current?.focus(), 50);\n } else {\n setQuery('');\n setResults([]);\n }\n }, [open]);\n\n // Debounced search across all providers\n useEffect(() => {\n if (debounceRef.current) clearTimeout(debounceRef.current);\n if (query.length < 2) { setResults([]); return; }\n if (!providers || providers.length === 0) { setResults([]); return; }\n debounceRef.current = setTimeout(async () => {\n setLoading(true);\n try {\n const responses = await Promise.all(providers.map(p => p(query).catch(() => [] as SearchResult[])));\n setResults(responses.flat());\n setActiveIdx(0);\n } catch { setResults([]); }\n setLoading(false);\n }, 250);\n return () => { if (debounceRef.current) clearTimeout(debounceRef.current); };\n }, [query, providers]);\n\n const handleSelect = useCallback((result: SearchResult) => {\n setOpen(false);\n onSelect?.(result);\n }, [onSelect]);\n\n const handleKeyDown = (e: React.KeyboardEvent) => {\n if (e.key === 'ArrowDown') { e.preventDefault(); setActiveIdx(i => Math.min(i + 1, results.length - 1)); }\n else if (e.key === 'ArrowUp') { e.preventDefault(); setActiveIdx(i => Math.max(i - 1, 0)); }\n else if (e.key === 'Enter' && results[activeIdx]) { handleSelect(results[activeIdx]); }\n };\n\n if (!open) return null;\n\n return (\n <div className=\"fixed inset-0 z-[200] flex items-start justify-center pt-[15vh]\" onClick={() => setOpen(false)}>\n <div className=\"absolute inset-0 bg-black/50 backdrop-blur-sm\" />\n <div className=\"relative z-10 w-full max-w-xl rounded-2xl overflow-hidden\" onClick={e => e.stopPropagation()} style={getGlassStyle()}>\n {/* Search input */}\n <div className=\"flex items-center gap-3 px-4 py-3 border-b border-gray-200\">\n <svg className=\"h-5 w-5 text-gray-400 shrink-0\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" strokeWidth={2}>\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d={DEFAULT_MAGNIFIER} />\n </svg>\n <input\n ref={inputRef}\n type=\"text\"\n value={query}\n onChange={e => setQuery(e.target.value)}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n className=\"flex-1 text-sm bg-transparent border-0 outline-none placeholder-gray-400\"\n />\n <kbd className=\"hidden sm:inline-flex items-center rounded border border-gray-300 px-1.5 py-0.5 text-[10px] font-medium text-gray-400\">ESC</kbd>\n </div>\n\n {/* Results */}\n <div className=\"max-h-[50vh] overflow-y-auto\">\n {loading && (\n <div className=\"px-4 py-6 text-center text-sm text-gray-400\">Searching...</div>\n )}\n {!loading && query.length >= 2 && results.length === 0 && (\n <div className=\"px-4 py-6 text-center text-sm text-gray-400\">No results found.</div>\n )}\n {!loading && results.length > 0 && (\n <ul className=\"py-2\">\n {results.map((r, i) => (\n <li key={`${r.type}-${r.label}-${i}`}>\n <button\n className={`flex items-center gap-3 w-full px-4 py-2.5 text-left transition-colors ${\n i === activeIdx ? 'bg-blue-50' : 'hover:bg-gray-50'\n }`}\n onClick={() => handleSelect(r)}\n onMouseEnter={() => setActiveIdx(i)}\n >\n <svg className=\"h-4 w-4 text-gray-400 shrink-0\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" strokeWidth={1.5}>\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d={typeIcons?.[r.type] || DEFAULT_MAGNIFIER} />\n </svg>\n <div className=\"flex-1 min-w-0\">\n <p className=\"text-sm font-medium text-gray-900 truncate\">{r.label}</p>\n {r.sub && <p className=\"text-xs text-gray-400 truncate\">{r.sub}</p>}\n </div>\n <span className=\"shrink-0 rounded-full bg-gray-100 px-2 py-0.5 text-[10px] font-medium text-gray-500\">{r.type}</span>\n </button>\n </li>\n ))}\n </ul>\n )}\n {!loading && query.length < 2 && (\n <div className=\"px-4 py-6 text-center text-sm text-gray-400\">Type at least 2 characters to search...</div>\n )}\n </div>\n\n {/* Footer */}\n <div className=\"flex items-center justify-between px-4 py-2 border-t border-gray-100 bg-gray-50 text-[11px] text-gray-400\">\n <div className=\"flex items-center gap-3\">\n <span className=\"flex items-center gap-1\"><kbd className=\"rounded border border-gray-300 px-1 py-0.5 font-medium\">↑</kbd><kbd className=\"rounded border border-gray-300 px-1 py-0.5 font-medium\">↓</kbd> navigate</span>\n <span className=\"flex items-center gap-1\"><kbd className=\"rounded border border-gray-300 px-1 py-0.5 font-medium\">Enter</kbd> open</span>\n </div>\n <span className=\"flex items-center gap-1\"><kbd className=\"rounded border border-gray-300 px-1 py-0.5 font-medium\">Esc</kbd> close</span>\n </div>\n </div>\n </div>\n );\n}\n","import { Fragment, useLayoutEffect, useMemo, useRef, useState } from 'react';\nimport type { ReactNode } from 'react';\n\n/**\n * Generic, drag-and-drop Kanban board. Self-contained (native HTML5 DnD, no\n * library) and styled with the same Tailwind utilities + `grid-scroll` class the\n * shell already ships, so consumers get it for free.\n *\n * Group items into columns with `columnOf`, render each card with `renderCard`.\n * Cards can be dragged **between** columns (to change which column they belong\n * to) and **within** a column (to reorder / prioritise). On drop, `onMove(id,\n * toColumn, toIndex)` fires — `toIndex` is the target position within `toColumn`\n * measured against that column's cards *excluding* the dragged one, so the\n * consumer can persist an order (e.g. midpoint between neighbours) that every\n * user then sees. Sort each column by that order via `sortInColumn`.\n *\n * Affordance: a blue **drop-line** shows exactly where the card will land\n * (between two cards, in either the source or a different column), and the\n * target column highlights. The dragged card dims. The insertion point tracks\n * `dragenter` (once per card crossed) so the line stays stable rather than\n * flickering. Pass `onAddItem` to give each column a \"+ Add item\" button at its\n * foot, revealed on column hover / keyboard focus.\n *\n * With no items the board is replaced by `emptyState` — right when the items\n * are the whole story, wrong when the columns are (a pipeline the user just\n * configured has a shape worth showing, and a board with no drop target can't\n * take its first card). Pass `showColumnsWhenEmpty` for that case and the\n * normal layout draws with every column on its `columnEmptyText` placeholder.\n */\nexport interface KanbanColumn {\n /** Stable column key — what `columnOf` returns and `onMove` receives. */\n value: string;\n label: string;\n /** Tailwind text + bg classes for the column header. */\n accent?: string;\n /** Tailwind bg class for the header dot. */\n dot?: string;\n}\n\nexport interface KanbanProps<T> {\n items: T[];\n columns: KanbanColumn[];\n columnOf: (item: T) => string;\n getId: (item: T) => string;\n /**\n * Fired on drop. `toColumn` is the destination column's `value`; `toIndex` is\n * the target position within that column measured against its cards\n * **excluding** the dragged card (0 = top). A same-column drop that wouldn't\n * change the order is not reported.\n */\n onMove: (id: string, toColumn: string, toIndex: number) => void;\n /** Inner card content — the card chrome (border, padding, hover) is provided. */\n renderCard: (item: T) => ReactNode;\n onCardClick?: (item: T) => void;\n /** Comparator for ordering within a column — sort by the persisted order field. */\n sortInColumn?: (a: T, b: T) => number;\n isLoading?: boolean;\n loadingText?: string;\n /** Shown INSTEAD of the board when there are no items at all. */\n emptyState?: ReactNode;\n /**\n * Draw the board — headers, empty columns, drop targets — even with no items,\n * instead of replacing it with `emptyState`. Opt in when the columns are\n * themselves the information (a configurable pipeline the user just defined)\n * or when an empty board still needs somewhere to drop a card into. Default\n * `false` keeps the `emptyState` behaviour every existing caller relies on.\n */\n showColumnsWhenEmpty?: boolean;\n /** Placeholder text inside an empty column. */\n columnEmptyText?: string;\n /**\n * When provided, each column gets a \"+ Add item\" button at its foot, revealed\n * on column hover or keyboard focus, that fires with the column's `value`.\n */\n onAddItem?: (toColumn: string) => void;\n /** Label for the per-column add button. */\n addItemText?: string;\n}\n\ninterface OverState {\n col: string;\n index: number;\n}\n\nexport default function Kanban<T>({\n items,\n columns,\n columnOf,\n getId,\n onMove,\n renderCard,\n onCardClick,\n sortInColumn,\n isLoading = false,\n loadingText = 'Loading…',\n emptyState,\n showColumnsWhenEmpty = false,\n columnEmptyText = 'Drop here',\n onAddItem,\n addItemText = 'Add item',\n}: KanbanProps<T>) {\n const [dragId, setDragId] = useState<string | null>(null);\n const [over, setOver] = useState<OverState | null>(null);\n\n const grouped = useMemo(() => {\n const map: Record<string, T[]> = {};\n for (const c of columns) map[c.value] = [];\n for (const it of items) (map[columnOf(it)] ??= []).push(it);\n if (sortInColumn) for (const k of Object.keys(map)) map[k].sort(sortInColumn);\n return map;\n }, [items, columns, columnOf, sortInColumn]);\n\n const reset = () => {\n setDragId(null);\n setOver(null);\n };\n\n // FLIP: when the order changes (e.g. on drop), slide each card from its old\n // position to its new one — so the dropped card and the cards making room for\n // it animate into place instead of snapping. Skipped while a drag is active.\n const boardRef = useRef<HTMLDivElement>(null);\n const prevRects = useRef<Map<string, DOMRect>>(new Map());\n useLayoutEffect(() => {\n if (dragId !== null) return;\n const board = boardRef.current;\n if (!board) return;\n const next = new Map<string, DOMRect>();\n const moved: [HTMLElement, number, number][] = [];\n board.querySelectorAll<HTMLElement>('[data-kanban-card]').forEach(el => {\n const id = el.dataset.kanbanCard as string;\n const rect = el.getBoundingClientRect();\n next.set(id, rect);\n const prev = prevRects.current.get(id);\n if (prev) {\n const dx = prev.left - rect.left;\n const dy = prev.top - rect.top;\n if (dx || dy) moved.push([el, dx, dy]);\n }\n });\n prevRects.current = next;\n if (!moved.length) return;\n // Invert: jump each moved card back to where it was, with no transition…\n for (const [el, dx, dy] of moved) {\n el.style.transition = 'none';\n el.style.transform = `translate(${dx}px, ${dy}px)`;\n }\n // …then play: release to the real position on the next frame so it animates.\n requestAnimationFrame(() => {\n for (const [el] of moved) {\n el.style.transition = 'transform 200ms cubic-bezier(0.2, 0, 0, 1)';\n el.style.transform = '';\n el.addEventListener(\n 'transitionend',\n () => {\n el.style.transition = '';\n el.style.transform = '';\n },\n { once: true },\n );\n }\n });\n // Re-measure only when the grouping (order/membership) changes or a drag\n // ends — not on every render — so typing/search doesn't thrash layout.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [grouped, dragId]);\n\n const commitMove = (col: string) => {\n if (dragId && over && over.col === col) {\n const colItems = grouped[col] ?? [];\n const dp = colItems.findIndex(it => getId(it) === dragId); // dragged's pos in this column, or -1\n const sameCol = dp !== -1;\n // Dropping right above or below itself changes nothing.\n const noop = sameCol && (over.index === dp || over.index === dp + 1);\n if (!noop) {\n // `over.index` counts the dragged card while it's still shown; remove it\n // from the count when the drop lands below its current slot.\n const toIndex = sameCol && over.index > dp ? over.index - 1 : over.index;\n onMove(dragId, col, toIndex);\n }\n }\n reset();\n };\n\n if (isLoading) return <div className=\"text-sm text-gray-500 p-4\">{loadingText}</div>;\n if (items.length === 0 && !showColumnsWhenEmpty) {\n return <>{emptyState ?? <div className=\"text-sm text-gray-500 p-4\">No items.</div>}</>;\n }\n\n return (\n <div ref={boardRef} className=\"flex-1 overflow-x-auto grid-scroll\">\n <div className=\"flex gap-3 h-full min-w-max pb-2\">\n {columns.map(col => {\n const colItems = grouped[col.value] ?? [];\n const isOver = over !== null && over.col === col.value;\n const dp = dragId !== null ? colItems.findIndex(it => getId(it) === dragId) : -1;\n // The drop-line index, or -1 to hide it (incl. the no-op slots next to the dragged card).\n const lineAt = isOver && !(dp !== -1 && (over!.index === dp || over!.index === dp + 1)) ? over!.index : -1;\n return (\n <div\n key={col.value}\n className={`group flex flex-col w-72 shrink-0 rounded-xl bg-gray-50 border transition-colors ${\n isOver ? 'border-blue-400 ring-2 ring-blue-300/60' : 'border-gray-200'\n }`}\n onDragOver={e => {\n // Accept the drop as a *move* so the browser doesn't treat it as\n // cancelled and play the native \"fly the drag-image back to its\n // origin\" animation — the snap-back the card showed before it\n // jumped to its new slot. Both this and `dropEffect` are needed:\n // preventing the default on dragover marks the column a valid\n // target, `dropEffect` makes the accepted action a move.\n e.preventDefault();\n try {\n e.dataTransfer.dropEffect = 'move';\n } catch {\n /* some environments disallow setting this */\n }\n }}\n onDrop={e => {\n // Prevent the default drop handling too, so the drag ends cleanly\n // at the drop point and React re-renders the card straight into\n // its new position — one smooth motion, no snap-back.\n e.preventDefault();\n commitMove(col.value);\n }}\n >\n <div\n className={`flex items-center justify-between px-3 py-2 rounded-t-xl text-sm font-medium ${\n col.accent ?? 'text-gray-700 bg-gray-100'\n }`}\n >\n <span className=\"flex items-center gap-2\">\n <span className={`h-2 w-2 rounded-full ${col.dot ?? 'bg-gray-400'}`} />\n {col.label}\n </span>\n <span className=\"text-xs opacity-70\">{colItems.length}</span>\n </div>\n <div\n className=\"flex-1 overflow-y-auto p-2 space-y-2 min-h-[120px]\"\n // Entering the column's empty area (not a card) targets the end.\n onDragEnter={() =>\n setOver(prev =>\n prev && prev.col === col.value && prev.index === colItems.length\n ? prev\n : { col: col.value, index: colItems.length },\n )\n }\n >\n {colItems.map((item, index) => {\n const id = getId(item);\n const isDragged = id === dragId;\n return (\n <Fragment key={id}>\n {lineAt === index && <div className=\"h-0.5 rounded-full bg-blue-500\" aria-hidden />}\n <div\n data-kanban-card={id}\n draggable\n onDragStart={e => {\n setDragId(id);\n try {\n e.dataTransfer.effectAllowed = 'move';\n } catch {\n /* some environments disallow setting this */\n }\n }}\n onDragEnter={e => {\n // Don't let the column's onDragEnter override this precise slot.\n e.stopPropagation();\n // Insert *after* this card when dragging it downward onto a\n // neighbour, *before* it when dragging up — otherwise nudging a\n // card down by one lands \"before its neighbour\" = its own slot,\n // which commitMove treats as a no-op (the same-column reorder bug).\n const draggedPos = dragId !== null ? colItems.findIndex(it => getId(it) === dragId) : -1;\n const target = draggedPos !== -1 && draggedPos < index ? index + 1 : index;\n setOver(prev =>\n prev && prev.col === col.value && prev.index === target\n ? prev\n : { col: col.value, index: target },\n );\n }}\n onDragEnd={reset}\n onClick={onCardClick ? () => onCardClick(item) : undefined}\n style={dragId === null ? undefined : { opacity: isDragged ? 0.4 : 1, transition: 'opacity 120ms ease' }}\n className={`rounded-lg bg-white border border-gray-200 p-3 shadow-sm hover:border-blue-400 hover:shadow transition ${\n onCardClick ? 'cursor-pointer' : ''\n }`}\n >\n {renderCard(item)}\n </div>\n </Fragment>\n );\n })}\n {colItems.length > 0 && lineAt === colItems.length && (\n <div className=\"h-0.5 rounded-full bg-blue-500\" aria-hidden />\n )}\n {colItems.length === 0 && (\n <div\n className={`text-[11px] text-center rounded-lg transition-all duration-150 ${\n isOver\n ? 'border-2 border-dashed border-blue-300 bg-blue-50/50 text-blue-400 py-8'\n : 'text-gray-400 py-6'\n }`}\n >\n {columnEmptyText}\n </div>\n )}\n </div>\n {onAddItem && (\n <div className=\"p-2 pt-0\">\n <button\n type=\"button\"\n onClick={() => onAddItem(col.value)}\n // Hidden until the column is hovered or the button is keyboard-focused.\n // It always reserves its row so revealing it never shifts the layout.\n className=\"flex w-full items-center justify-center gap-1 rounded-lg px-2 py-1.5 text-xs font-medium text-gray-500 opacity-0 transition hover:bg-gray-100 hover:text-gray-700 focus-visible:opacity-100 group-hover:opacity-100\"\n >\n <span aria-hidden className=\"text-sm leading-none\">\n +\n </span>\n {addItemText}\n </button>\n </div>\n )}\n </div>\n );\n })}\n </div>\n </div>\n );\n}\n","/**\n * Pagination — a numbered page control for classic paginated tables/lists, with\n * prev/next and optional first/last edges and ellipsis gaps. Controlled: the\n * consumer owns `page` and updates it in `onPageChange`. Complements ListFooter\n * (which shows counts/selection for infinite-scroll lists).\n */\n\nexport interface PaginationProps {\n /** Current page, 1-based. */\n page: number;\n pageCount: number;\n onPageChange: (page: number) => void;\n /** How many page numbers to show on each side of the current page. */\n siblingCount?: number;\n /** Show first/last («/») buttons. */\n showEdges?: boolean;\n className?: string;\n}\n\nfunction buildPages(page: number, pageCount: number, sibling: number): (number | '…')[] {\n const wanted = new Set<number>([1, pageCount]);\n for (let i = page - sibling; i <= page + sibling; i++) {\n if (i >= 1 && i <= pageCount) wanted.add(i);\n }\n const sorted = [...wanted].sort((a, b) => a - b);\n const out: (number | '…')[] = [];\n let prev = 0;\n for (const p of sorted) {\n if (prev && p - prev > 1) out.push('…');\n out.push(p);\n prev = p;\n }\n return out;\n}\n\nconst BTN =\n 'inline-flex h-8 min-w-8 items-center justify-center rounded-md px-2 text-sm transition-colors ' +\n 'disabled:cursor-not-allowed disabled:opacity-40';\n\nexport default function Pagination({\n page, pageCount, onPageChange, siblingCount = 1, showEdges = false, className = '',\n}: PaginationProps) {\n if (pageCount <= 1) return null;\n const pages = buildPages(page, pageCount, siblingCount);\n const go = (p: number) => { if (p >= 1 && p <= pageCount && p !== page) onPageChange(p); };\n\n return (\n <nav aria-label=\"Pagination\" className={`flex items-center gap-1 ${className}`.trim()}>\n {showEdges && (\n <button type=\"button\" aria-label=\"First page\" disabled={page === 1} onClick={() => go(1)} className={`${BTN} text-gray-600 hover:bg-gray-100`}>«</button>\n )}\n <button type=\"button\" aria-label=\"Previous page\" disabled={page === 1} onClick={() => go(page - 1)} className={`${BTN} text-gray-600 hover:bg-gray-100`}>‹</button>\n {pages.map((p, i) =>\n p === '…' ? (\n <span key={`gap-${i}`} className=\"px-1 text-gray-400\">…</span>\n ) : (\n <button\n key={p}\n type=\"button\"\n aria-current={p === page ? 'page' : undefined}\n onClick={() => go(p)}\n className={`${BTN} ${p === page ? 'bg-blue-600 font-medium text-white' : 'text-gray-700 hover:bg-gray-100'}`}\n >\n {p}\n </button>\n )\n )}\n <button type=\"button\" aria-label=\"Next page\" disabled={page === pageCount} onClick={() => go(page + 1)} className={`${BTN} text-gray-600 hover:bg-gray-100`}>›</button>\n {showEdges && (\n <button type=\"button\" aria-label=\"Last page\" disabled={page === pageCount} onClick={() => go(pageCount)} className={`${BTN} text-gray-600 hover:bg-gray-100`}>»</button>\n )}\n </nav>\n );\n}\n","/**\n * DataTable — a presentational table for server-driven lists.\n *\n * It renders and it reports. It does not fetch, it does not sort, and it does\n * not paginate: the caller owns `sort` and `page` and hands back new data. That\n * is the whole design, and it is what makes it usable against a Django list\n * endpoint where the ordering happens in SQL and the rows on screen are one\n * page of a much larger set. A table that sorts its own `data` prop quietly\n * sorts the current page only, which is wrong in a way nobody notices until the\n * second page disagrees with the first.\n *\n * ── Which table is which ──\n * `EditableGrid` — a spreadsheet. Cells are typed into.\n * `ResizableTable` — persists column widths per user; needs react-query + axios.\n * `EntityList` — a whole list VIEW: fetching, export, context actions.\n * `DataTable` — this. Read-only rows, no peers, no data layer.\n *\n * Sort uses the package's own `SortState` rather than a table-specific vocabulary,\n * so `DataTable`, `useSort` and `ResizableTable` all speak the same language and\n * a caller can move between them without a translation layer.\n */\nimport { useLayoutEffect, useRef, useState, type KeyboardEvent, type ReactNode, type UIEvent } from 'react';\nimport Pagination from './Pagination';\nimport type { SortState } from './types';\n\nexport interface DataTableColumn<T> {\n key: string;\n title: ReactNode;\n /** Read this field when there is no `render`. */\n dataIndex?: keyof T & string;\n render?: (row: T, index: number) => ReactNode;\n align?: 'left' | 'right' | 'center';\n /**\n * The column holds a figure or a code — money, a quantity, a part or order\n * number.\n *\n * Renders it monospaced and right-aligns it by default. The table already\n * sets `tabular-nums`, so the digits line up down the column either way;\n * what this adds is a fixed advance for EVERY character, which is what lets\n * `00620L6N25KMFCBTDTM2QND` be compared against its neighbour by shape, and\n * a decimal point be found at the right edge without reading the number.\n */\n numeric?: boolean;\n /** Px. Also feeds the table's minimum width — see `minWidth`. */\n width?: number;\n /** Single-line with an ellipsis. */\n ellipsis?: boolean;\n /**\n * Pin to the left edge while the table scrolls horizontally. Only useful\n * with `minWidth` set, and only worth it for the columns that identify the\n * row — a part number, a name.\n */\n fixed?: 'left';\n /**\n * Offer a sort control. The FIELD sent to the server is `sortField ?? key`,\n * which is what lets a column named `no` sort by `part_number` without the\n * caller mapping names at the call site.\n */\n sortable?: boolean;\n /**\n * Which way the FIRST click sorts. Defaults to ascending.\n *\n * `desc` is right wherever the interesting end is the top: a price column,\n * a quantity, a date where the newest matters. Making those start ascending\n * costs every user two clicks to see the thing they opened the column for.\n *\n * The cycle is unchanged either way — first click, second click, then back\n * to the server's own ordering.\n */\n sortFirst?: 'asc' | 'desc';\n sortField?: string;\n headerClassName?: string;\n}\n\n/**\n * A header spanning several columns — \"Debit\" over an amount and a balance.\n *\n * The group is not decoration: where two children are both called \"Amount\",\n * it is the only thing telling them apart, and a screen reader reads it as\n * part of each cell's column context.\n */\nexport interface DataTableColumnGroup<T> {\n title: ReactNode;\n columns: DataTableColumn<T>[];\n /** Distinct among its siblings. Defaults to the group's index. */\n key?: string;\n headerClassName?: string;\n}\n\n/** A leaf column, or a group of them. */\nexport type DataTableHeader<T> = DataTableColumn<T> | DataTableColumnGroup<T>;\n\nconst isGroup = <T,>(h: DataTableHeader<T>): h is DataTableColumnGroup<T> =>\n Array.isArray((h as DataTableColumnGroup<T>).columns);\n\nexport interface DataTableProps<T> {\n columns: DataTableHeader<T>[];\n data: T[];\n /** Stable identity per row. A string names a field; a function computes it. */\n rowKey: (keyof T & string) | ((row: T, index: number) => string);\n /** Current sort, or null. Controlled — this component never sorts `data`. */\n sort?: SortState | null;\n onSortChange?: (sort: SortState | null) => void;\n /** Server pagination. Omit entirely for an unpaginated or infinite list. */\n pagination?: { page: number; pageCount: number; onPageChange: (page: number) => void };\n /**\n * Names the table for assistive technology, rendered as a visually hidden\n * `<caption>`.\n *\n * A table with no name is announced as \"table\" and nothing else, so a page\n * with two of them — the invoice lines and the payments against it — gives a\n * screen-reader user two identical landmarks and no way to tell which is\n * which. The heading above it is not enough: table navigation jumps between\n * tables, not through the prose around them.\n */\n caption?: string;\n loading?: boolean;\n bordered?: boolean;\n size?: 'sm' | 'md';\n /**\n * Minimum table width in px. Below it the table scrolls horizontally instead\n * of crushing columns. Usually the sum of the columns' widths.\n */\n minWidth?: number;\n rowClassName?: (row: T, index: number) => string;\n onRow?: (row: T, index: number) => { onClick?: () => void; className?: string };\n emptyText?: ReactNode;\n /** Rendered under the rows — an infinite-scroll sentinel, a totals strip. */\n footer?: ReactNode;\n /**\n * Windowed rendering for large LOADED datasets. Pagination and infinite\n * scroll bound what is fetched; this bounds what is RENDERED — a few\n * thousand loaded rows otherwise all get DOM, and every sort or filter\n * re-lays-out the lot. The wrapper becomes a vertical scroll container of\n * `height` px, only the rows near the viewport exist in the DOM (padded to\n * the full scroll height by two spacer rows), and the header pins to the\n * top of the scroll.\n *\n * `rowHeight` is a promise, not a measurement: every row is rendered at\n * exactly that height (the scroll math depends on it), so `ellipsis` your\n * long columns rather than letting them wrap. Off-screen rows are absent\n * for assistive technology too — same trade every windowed list makes.\n */\n virtualized?: { height: number; rowHeight: number; overscan?: number };\n className?: string;\n}\n\nconst PAD: Record<'sm' | 'md', string> = {\n sm: 'px-2 py-1.5',\n md: 'px-3 py-2',\n};\n\nconst ALIGN: Record<'left' | 'right' | 'center', string> = {\n left: 'text-left',\n right: 'text-right',\n center: 'text-center',\n};\n\nfunction SortIcon({ direction }: { direction: 'asc' | 'desc' | null }) {\n // Both arrows always render; the inactive one is dimmed. A control that\n // appears only once sorted gives no hint that sorting is available at all.\n return (\n <span className=\"ml-1 inline-flex flex-col leading-none\" aria-hidden=\"true\">\n <svg className={`h-2 w-2 ${direction === 'asc' ? 'text-gray-700' : 'text-gray-300'}`} viewBox=\"0 0 8 5\" fill=\"currentColor\">\n <path d=\"M4 0L8 5H0z\" />\n </svg>\n <svg className={`h-2 w-2 ${direction === 'desc' ? 'text-gray-700' : 'text-gray-300'}`} viewBox=\"0 0 8 5\" fill=\"currentColor\">\n <path d=\"M4 5L0 0h8z\" />\n </svg>\n </span>\n );\n}\n\nexport default function DataTable<T>({\n columns, data, rowKey, sort = null, onSortChange, pagination, caption, loading = false,\n bordered = false, size = 'md', minWidth, rowClassName, onRow, emptyText = 'Nothing to show',\n footer, virtualized, className = '',\n}: DataTableProps<T>) {\n const keyOf = (row: T, i: number): string =>\n typeof rowKey === 'function' ? rowKey(row, i) : String(row[rowKey]);\n\n // ── Row window ──\n // `startRow` is the only scroll-derived state, and it is a row index, not a\n // pixel offset: the setter bails until the scroll crosses a row boundary, so\n // a table not being scrolled re-renders nothing.\n const [startRow, setStartRow] = useState(0);\n const overscan = virtualized?.overscan ?? 6;\n const onBodyScroll = virtualized\n ? (e: UIEvent<HTMLDivElement>) => {\n const next = Math.max(0, Math.floor(e.currentTarget.scrollTop / virtualized.rowHeight) - overscan);\n setStartRow(prev => (prev === next ? prev : next));\n }\n : undefined;\n const windowSize = virtualized\n ? Math.ceil(virtualized.height / virtualized.rowHeight) + overscan * 2\n : data.length;\n const start = virtualized ? Math.min(startRow, Math.max(0, data.length - windowSize)) : 0;\n const end = Math.min(data.length, start + windowSize);\n const topPad = virtualized ? start * virtualized.rowHeight : 0;\n const bottomPad = virtualized ? (data.length - end) * virtualized.rowHeight : 0;\n\n // The grouped header's SECOND row pins below the first, which means knowing\n // the first row's height — measured, because it depends on `size` and on\n // whatever the group titles wrap to.\n const headRowRef = useRef<HTMLTableRowElement>(null);\n const [headRowH, setHeadRowH] = useState(0);\n useLayoutEffect(() => {\n if (!virtualized) return;\n const h = headRowRef.current?.offsetHeight ?? 0;\n setHeadRowH(prev => (prev === h ? prev : h));\n });\n\n const fieldOf = (col: DataTableColumn<T>) => col.sortField ?? col.key;\n\n const directionFor = (col: DataTableColumn<T>): 'asc' | 'desc' | null =>\n sort && sort.field === fieldOf(col) ? sort.direction : null;\n\n const toggleSort = (col: DataTableColumn<T>) => {\n if (!onSortChange) return;\n const field = fieldOf(col);\n const current = directionFor(col);\n // First → second → unsorted. The third state matters: without it there is\n // no way back to the server's own default ordering once a column is\n // clicked. Which way \"first\" goes is the column's to say — see sortFirst.\n const first = col.sortFirst ?? 'asc';\n const second = first === 'asc' ? 'desc' : 'asc';\n if (current === null) onSortChange({ field, direction: first });\n else if (current === first) onSortChange({ field, direction: second });\n else onSortChange(null);\n };\n\n // Every rendering below the header row works on the LEAVES: a group has no\n // cells of its own, only a span over its children's.\n const leaves: DataTableColumn<T>[] = columns.flatMap(h => (isGroup(h) ? h.columns : [h]));\n const grouped = columns.some(isGroup);\n\n const cellBase = `${PAD[size]} ${size === 'sm' ? 'text-xs' : 'text-sm'}`;\n\n /**\n * One header cell. Shared by both header rows so a grouped table's leaves\n * are drawn by the same code as an ungrouped table's — the sort button, the\n * aria-sort, the pinning and the alignment are not worth having twice.\n */\n const headerCell = (col: DataTableColumn<T>, ci: number, rowSpan: number, topOffset = 0) => {\n const dir = directionFor(col);\n // A figures column right-aligns unless the caller says otherwise: the\n // decimal point is the thing being compared, and it only lines up at the\n // right edge.\n const align = ALIGN[col.align ?? (col.numeric ? 'right' : 'left')];\n const pinned = col.fixed === 'left';\n return (\n <th\n key={col.key}\n scope=\"col\"\n rowSpan={rowSpan > 1 ? rowSpan : undefined}\n // aria-sort is what a screen reader announces; the arrows are\n // decorative and marked so.\n // `none` rather than nothing on a sortable column: it is how a screen\n // reader knows the column CAN be sorted. Omitted, the only columns\n // that announce themselves as sortable are the ones already sorted.\n aria-sort={\n dir === 'asc' ? 'ascending'\n : dir === 'desc' ? 'descending'\n : col.sortable && onSortChange ? 'none'\n : undefined\n }\n style={{\n width: col.width,\n ...(pinned ? { left: offsets[ci] ?? 0 } : {}),\n // A virtualized header pins to the top of the vertical scroll; one\n // sticky box can hold both axes, so a pinned column's header corner\n // stays put in both directions.\n ...(virtualized ? { top: topOffset } : {}),\n }}\n className={[\n cellBase, align,\n 'font-semibold uppercase tracking-wide text-gray-500',\n size === 'sm' ? 'text-[10px]' : 'text-xs',\n pinned\n ? (virtualized ? 'sticky z-20 bg-gray-50' : 'sticky z-10 bg-gray-50')\n : (virtualized ? 'sticky z-10 bg-gray-50' : ''),\n col.headerClassName ?? '',\n ].filter(Boolean).join(' ')}\n >\n {col.sortable && onSortChange ? (\n <button\n type=\"button\"\n onClick={() => toggleSort(col)}\n className={`inline-flex items-center font-semibold uppercase tracking-wide hover:text-gray-700 ${align}`}\n >\n {col.title}\n <SortIcon direction={dir} />\n </button>\n ) : col.title}\n </th>\n );\n };\n // Running totals of the widths to the left of each fixed column, so a second\n // pinned column sits flush against the first instead of on top of it.\n let fixedOffset = 0;\n const offsets = leaves.map(col => {\n if (col.fixed !== 'left') return null;\n const at = fixedOffset;\n fixedOffset += col.width ?? 0;\n return at;\n });\n\n return (\n <div className={className}>\n <div\n onScroll={onBodyScroll}\n style={virtualized ? { maxHeight: virtualized.height } : undefined}\n className={`relative overflow-x-auto ${virtualized ? 'overflow-y-auto' : ''} ${bordered ? 'rounded-lg border border-gray-200' : ''}`.trim()}\n >\n {loading && (\n // An overlay rather than replacing the rows: the table keeps its\n // height and its scroll position, so re-sorting does not throw the\n // page around under the user.\n <div className=\"absolute inset-0 z-20 flex items-start justify-center bg-white/60 pt-8\" role=\"status\" aria-live=\"polite\">\n <span className=\"h-6 w-6 animate-spin rounded-full border-2 border-gray-200 border-t-blue-600\" />\n <span className=\"sr-only\">Loading</span>\n </div>\n )}\n <table className=\"w-full border-collapse tabular-nums\" style={minWidth ? { minWidth } : undefined}>\n {caption && <caption className=\"sr-only\">{caption}</caption>}\n <thead>\n <tr ref={headRowRef} className=\"border-b border-gray-200 bg-gray-50\">\n {columns.map((h, hi) => {\n if (isGroup(h)) {\n return (\n <th\n key={h.key ?? `group-${hi}`}\n scope=\"colgroup\"\n colSpan={h.columns.length}\n style={virtualized ? { top: 0 } : undefined}\n className={[\n cellBase, 'text-center',\n 'font-semibold uppercase tracking-wide text-gray-500',\n size === 'sm' ? 'text-[10px]' : 'text-xs',\n 'border-b border-gray-200',\n virtualized ? 'sticky z-10 bg-gray-50' : '',\n h.headerClassName ?? '',\n ].filter(Boolean).join(' ')}\n >\n {h.title}\n </th>\n );\n }\n // A leaf beside a group spans both header rows, so its label\n // sits level with the group's children rather than floating\n // above an empty cell.\n return headerCell(h, leaves.indexOf(h), grouped ? 2 : 1);\n })}\n </tr>\n {grouped && (\n <tr className=\"border-b border-gray-200 bg-gray-50\">\n {columns.flatMap(h => (isGroup(h) ? h.columns : [])).map(col =>\n headerCell(col, leaves.indexOf(col), 1, headRowH),\n )}\n </tr>\n )}\n </thead>\n <tbody>\n {data.length === 0 && !loading ? (\n <tr>\n <td colSpan={leaves.length} className={`${cellBase} py-10 text-center text-gray-500`}>\n {emptyText}\n </td>\n </tr>\n ) : (\n <>\n {/* Spacer rows stand in for everything scrolled out of the\n * window, so the scrollbar's size and position tell the truth\n * about the whole dataset. aria-hidden: they are geometry, not\n * data. */}\n {topPad > 0 && (\n <tr aria-hidden=\"true\">\n <td colSpan={leaves.length} style={{ height: topPad, padding: 0, border: 0 }} />\n </tr>\n )}\n {data.slice(start, end).map((row, si) => {\n const i = start + si;\n const rowProps = onRow?.(row, i);\n return (\n <tr\n key={keyOf(row, i)}\n style={virtualized ? { height: virtualized.rowHeight } : undefined}\n onClick={rowProps?.onClick}\n // A clickable row that only answers a mouse is unreachable\n // for everyone else — there is no other control in it to\n // tab to. Focusable, and Enter or Space opens it, which is\n // what the pointer does.\n {...(rowProps?.onClick\n ? {\n tabIndex: 0,\n onKeyDown: (e: KeyboardEvent<HTMLTableRowElement>) => {\n // Only the row's OWN key presses. A keydown from a\n // control inside a cell bubbles up here, so without\n // this an Edit button answered with Enter fired the\n // button AND opened the row — and the\n // preventDefault below ate the space bar of any\n // text input in the table.\n if (e.target !== e.currentTarget) return;\n if (e.key !== 'Enter' && e.key !== ' ') return;\n // Space scrolls the page otherwise, and the row the\n // user was aiming at leaves the screen.\n e.preventDefault();\n rowProps.onClick?.();\n },\n }\n : {})}\n className={[\n 'border-b border-gray-100 last:border-b-0',\n rowProps?.onClick\n ? 'cursor-pointer hover:bg-gray-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400'\n : '',\n rowClassName?.(row, i) ?? '',\n rowProps?.className ?? '',\n ].filter(Boolean).join(' ')}\n >\n {leaves.map((col, ci) => {\n const pinned = col.fixed === 'left';\n return (\n <td\n key={col.key}\n style={pinned ? { left: offsets[ci] ?? 0 } : undefined}\n className={[\n cellBase, ALIGN[col.align ?? (col.numeric ? 'right' : 'left')],\n col.numeric ? 'font-mono' : '', 'text-gray-900',\n col.ellipsis ? 'max-w-0 truncate' : '',\n // A pinned cell needs its own background or the\n // scrolling columns show through it.\n pinned ? 'sticky z-10 bg-white' : '',\n ].filter(Boolean).join(' ')}\n >\n {col.render\n ? col.render(row, i)\n : col.dataIndex\n ? (row[col.dataIndex] as ReactNode)\n : null}\n </td>\n );\n })}\n </tr>\n );\n })}\n {bottomPad > 0 && (\n <tr aria-hidden=\"true\">\n <td colSpan={leaves.length} style={{ height: bottomPad, padding: 0, border: 0 }} />\n </tr>\n )}\n </>\n )}\n </tbody>\n </table>\n {footer}\n </div>\n {pagination && pagination.pageCount > 1 && (\n <div className=\"mt-3 flex justify-end\">\n <Pagination\n page={pagination.page}\n pageCount={pagination.pageCount}\n onPageChange={pagination.onPageChange}\n />\n </div>\n )}\n </div>\n );\n}\n","import type { ReactNode } from 'react';\n\ninterface ListFooterProps {\n selectedCount: number;\n loadedCount: number;\n totalCount?: number;\n label: string;\n isFetchingMore?: boolean;\n extra?: ReactNode;\n}\n\n/**\n * Standardized footer for `EntityList`. Shows:\n * \"[X selected — ] Y records\"\n * \"Y of Z records · Loading more...\"\n * \"All N records loaded\"\n */\nexport default function ListFooter({\n selectedCount,\n loadedCount,\n totalCount,\n label,\n isFetchingMore,\n extra,\n}: ListFooterProps) {\n const total = totalCount ?? loadedCount;\n const allLoaded = loadedCount >= total;\n\n return (\n <>\n {extra}\n {selectedCount > 0 ? `${selectedCount} selected — ` : ''}\n {allLoaded\n ? (totalCount != null ? `All ${total.toLocaleString()} ${label} loaded` : `${total.toLocaleString()} ${label}`)\n : `${loadedCount.toLocaleString()} of ${total.toLocaleString()} ${label}`\n }\n {isFetchingMore ? ' · Loading more...' : ''}\n </>\n );\n}\n","import Button from '../forms/Button';\n\nexport interface ListLoadErrorProps {\n /** Bold heading. Defaults to \"Couldn't load this list\". */\n title?: string;\n /** Muted explanatory line. Defaults to a generic connection/retry message. */\n message?: string;\n /** When provided, renders a \"Try again\" button that calls it (wire the\n * data source's `refetch`). Omit for a static, non-retryable error. */\n onRetry?: () => void;\n /** Frame around the content, mirroring {@link EmptyState}: `dashed`\n * (default), `card` (bordered surface), or `none`. */\n variant?: 'dashed' | 'card' | 'none';\n}\n\n/**\n * ListLoadError — the error counterpart to `EmptyState` for data lists. Shown\n * when a list's fetch fails (5xx, auth expiry, network) so an outage reads as\n * an error with a retry affordance instead of a misleading \"nothing here\"\n * empty state. Visual language mirrors `EmptyState`, tinted for error.\n */\nexport default function ListLoadError({\n title = \"Couldn't load this list\",\n message = 'Something went wrong fetching these records. Check your connection and try again.',\n onRetry,\n variant = 'dashed',\n}: ListLoadErrorProps) {\n const frame =\n variant === 'card' ? 'rounded-md border border-gray-200 bg-white px-6 py-12' :\n variant === 'none' ? 'px-6 py-12' :\n 'rounded-lg border-2 border-dashed border-red-200 px-6 py-12';\n return (\n <div className={`flex flex-col items-center justify-center text-center ${frame}`} role=\"alert\">\n <svg className=\"h-10 w-10 text-red-300 mb-3\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" strokeWidth={1} aria-hidden=\"true\">\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M12 9v3.75m0 3.75h.008M10.34 3.94l-8.4 14.55A1.5 1.5 0 003.24 21h17.52a1.5 1.5 0 001.3-2.51l-8.4-14.55a1.5 1.5 0 00-2.6 0z\" />\n </svg>\n <h3 className=\"text-sm font-medium text-gray-900\">{title}</h3>\n <p className=\"text-sm text-gray-500 mt-2\">{message}</p>\n {onRetry && (\n <div className=\"mt-4\">\n <Button variant=\"secondary\" size=\"sm\" onClick={onRetry}>Try again</Button>\n </div>\n )}\n </div>\n );\n}\n","/**\n * Sparkline — a compact trend line (optionally area-filled) drawn as inline\n * SVG. Color defaults to `currentColor`, so set the line color with a parent\n * `text-*` class. Good inside StatCards and table cells.\n */\nimport { type SparklineProps } from './types';\n\nexport default function Sparkline({\n data, width = 120, height = 32, stroke = 'currentColor', fill,\n strokeWidth = 1.5, showDots = false, className, style,\n}: SparklineProps) {\n if (data.length === 0) return null;\n const max = Math.max(...data);\n const min = Math.min(...data);\n const span = max - min || 1;\n const pad = strokeWidth + (showDots ? 2 : 0);\n const y = (v: number) => height - pad - ((v - min) / span) * (height - pad * 2);\n // A single point has no slope — draw a flat baseline across the full width.\n const pts: [number, number][] = data.length === 1\n ? [[0, height / 2], [width, height / 2]]\n : data.map((v, i) => [(i * width) / (data.length - 1), y(v)]);\n const line = pts.map(([x, yy], i) => `${i === 0 ? 'M' : 'L'}${x.toFixed(2)},${yy.toFixed(2)}`).join(' ');\n const area = `${line} L${width.toFixed(2)},${height} L0,${height} Z`;\n\n return (\n <svg\n className={className}\n style={style}\n width={width}\n height={height}\n viewBox={`0 0 ${width} ${height}`}\n preserveAspectRatio=\"none\"\n role=\"img\"\n aria-hidden=\"true\"\n >\n {fill && <path d={area} fill={fill} stroke=\"none\" />}\n <path d={line} fill=\"none\" stroke={stroke} strokeWidth={strokeWidth} strokeLinejoin=\"round\" strokeLinecap=\"round\" />\n {showDots && pts.map(([x, yy], i) => <circle key={i} cx={x} cy={yy} r={strokeWidth + 0.5} fill={stroke} />)}\n </svg>\n );\n}\n","/**\n * BarChart — a simple vertical bar chart built from CSS-sized divs (no SVG, no\n * dependency). Bar color defaults to `currentColor` (set it with a parent\n * `text-*` class) or per-bar via `colors`. Covers the decorative bar summaries\n * a dashboard needs.\n */\nimport { type BarChartProps } from './types';\n\nexport default function BarChart({\n data, labels, height = 120, color = 'currentColor', colors, max, gap = 6, className, style,\n}: BarChartProps) {\n if (data.length === 0) return null;\n const peak = max ?? (Math.max(...data, 0) || 1);\n\n return (\n <div className={className} style={style}>\n <div className=\"flex items-end\" style={{ height, gap }}>\n {data.map((v, i) => (\n <div key={i} className=\"flex flex-1 flex-col justify-end\" style={{ height: '100%' }}>\n <div\n className=\"w-full rounded-t\"\n style={{\n height: `${Math.max(0, (v / peak) * 100)}%`,\n minHeight: v > 0 ? 2 : 0,\n backgroundColor: colors?.[i] ?? color,\n }}\n title={labels?.[i] != null ? `${labels[i]}: ${v}` : String(v)}\n />\n </div>\n ))}\n </div>\n {labels && (\n <div className=\"mt-1 flex\" style={{ gap }}>\n {labels.map((l, i) => (\n <div key={i} className=\"flex-1 truncate text-center text-[10px] text-gray-400\">{l}</div>\n ))}\n </div>\n )}\n </div>\n );\n}\n","/**\n * DonutChart — a ring chart drawn with SVG stroke-dasharray segments. Segment\n * colors default to a built-in palette (override per segment). The track uses a\n * theme-agnostic translucent slate so it reads in both light and dark mode.\n */\nimport { type DonutChartProps } from './types';\n\nconst PALETTE = ['#3b82f6', '#22c55e', '#f59e0b', '#ef4444', '#6366f1', '#14b8a6', '#a855f7', '#64748b'];\n\nexport default function DonutChart({ segments, size = 120, thickness = 16, centerLabel, className, style }: DonutChartProps) {\n const total = segments.reduce((s, x) => s + Math.max(0, x.value), 0) || 1;\n const r = (size - thickness) / 2;\n const c = size / 2;\n const circ = 2 * Math.PI * r;\n let offset = 0;\n\n return (\n <div\n className={`relative inline-flex items-center justify-center ${className ?? ''}`.trim()}\n style={{ width: size, height: size, ...style }}\n >\n <svg width={size} height={size} viewBox={`0 0 ${size} ${size}`} role=\"img\" aria-hidden=\"true\" style={{ transform: 'rotate(-90deg)' }}>\n <circle cx={c} cy={c} r={r} fill=\"none\" stroke=\"rgba(148,163,184,0.25)\" strokeWidth={thickness} />\n {segments.map((s, i) => {\n const len = (Math.max(0, s.value) / total) * circ;\n const el = (\n <circle\n key={i}\n cx={c}\n cy={c}\n r={r}\n fill=\"none\"\n stroke={s.color ?? PALETTE[i % PALETTE.length]}\n strokeWidth={thickness}\n strokeDasharray={`${len} ${circ - len}`}\n strokeDashoffset={-offset}\n />\n );\n offset += len;\n return el;\n })}\n </svg>\n {centerLabel != null && (\n <div className=\"absolute text-center text-sm font-semibold text-gray-900\">{centerLabel}</div>\n )}\n </div>\n );\n}\n","/**\n * LineChart — a trend over time with an optional scale, legend and area fill.\n * Sparkline's big sibling: multi-series, container-filling width, still\n * dependency-free inline SVG themed by `currentColor`.\n *\n * The plot stretches (`viewBox 0 0 100 100`, `preserveAspectRatio=\"none\"`) so\n * it can fill whatever the dashboard gives it; `vector-effect:\n * non-scaling-stroke` keeps the lines a uniform screen-space width under that\n * stretch, and the dots are zero-length round-capped strokes for the same\n * reason — a stretched `<circle>` is an ellipse.\n *\n * Like the other charts this is decorative (`aria-hidden`): the numbers it\n * draws should also exist as text somewhere on the page.\n */\nimport { type LineChartProps, type LineChartSeries } from './types';\n\nfunction toPoints(data: number[], min: number, span: number): [number, number][] {\n // A single point has no slope — draw a flat line across the full width.\n if (data.length === 1) return [[0, 100 - ((data[0] - min) / span) * 100], [100, 100 - ((data[0] - min) / span) * 100]];\n return data.map((v, i) => [(i * 100) / (data.length - 1), 100 - ((v - min) / span) * 100]);\n}\n\nfunction pathFor(pts: [number, number][]): string {\n return pts.map(([x, y], i) => `${i === 0 ? 'M' : 'L'}${x.toFixed(2)},${y.toFixed(2)}`).join(' ');\n}\n\nconst fmt = (v: number) => (Number.isInteger(v) ? String(v) : v.toFixed(1));\n\nexport default function LineChart({\n series, labels, height = 160, strokeWidth = 2, showDots = false,\n max, min, showScale = false, showLegend = false, className, style,\n}: LineChartProps) {\n const drawn = series.filter(s => s.data.length > 0);\n if (drawn.length === 0) return null;\n const all = drawn.flatMap(s => s.data);\n const top = max ?? Math.max(...all);\n const bottom = min ?? Math.min(...all);\n const span = top - bottom || 1;\n const color = (s: LineChartSeries) => s.color ?? 'currentColor';\n\n return (\n <div className={className} style={style}>\n {showLegend && drawn.some(s => s.label) && (\n <div className=\"mb-1.5 flex flex-wrap items-center gap-x-3 gap-y-0.5\">\n {drawn.map((s, i) => s.label && (\n <span key={i} className=\"flex items-center gap-1 text-xs text-gray-500\">\n <span className=\"h-2 w-2 rounded-full\" style={{ backgroundColor: color(s) }} />\n {s.label}\n </span>\n ))}\n </div>\n )}\n <div className=\"flex\">\n {showScale && (\n <div className=\"flex flex-col justify-between pr-1.5 text-right text-[10px] leading-none text-gray-400\" style={{ height }}>\n <span>{fmt(top)}</span>\n <span>{fmt(bottom + span / 2)}</span>\n <span>{fmt(bottom)}</span>\n </div>\n )}\n <svg\n className=\"min-w-0 flex-1\"\n width=\"100%\"\n height={height}\n viewBox=\"0 0 100 100\"\n preserveAspectRatio=\"none\"\n role=\"img\"\n aria-hidden=\"true\"\n >\n {showScale && [0, 50, 100].map(y => (\n <line key={y} x1={0} y1={y} x2={100} y2={y} stroke=\"currentColor\" strokeOpacity={0.12} strokeWidth={1} vectorEffect=\"non-scaling-stroke\" />\n ))}\n {drawn.map((s, si) => {\n const pts = toPoints(s.data, bottom, span);\n const line = pathFor(pts);\n return (\n <g key={si}>\n {s.fill && <path d={`${line} L100,100 L0,100 Z`} fill={s.fill} stroke=\"none\" />}\n <path d={line} fill=\"none\" stroke={color(s)} strokeWidth={strokeWidth} strokeLinejoin=\"round\" strokeLinecap=\"round\" vectorEffect=\"non-scaling-stroke\" />\n {showDots && s.data.length > 1 && pts.map(([x, y], i) => (\n <path key={i} d={`M${x.toFixed(2)},${y.toFixed(2)} h0.01`} stroke={color(s)} strokeWidth={strokeWidth * 2.5} strokeLinecap=\"round\" vectorEffect=\"non-scaling-stroke\">\n <title>{`${labels?.[i] != null ? `${labels[i]}: ` : ''}${s.label ? `${s.label} ` : ''}${s.data[i]}`}</title>\n </path>\n ))}\n </g>\n );\n })}\n </svg>\n </div>\n {labels && (\n <div className={`mt-1 flex justify-between ${showScale ? 'pl-6' : ''}`}>\n {labels.map((l, i) => (\n <div key={i} className=\"truncate text-[10px] text-gray-400\">{l}</div>\n ))}\n </div>\n )}\n </div>\n );\n}\n","/**\n * DashboardTemplate — an analytics dashboard starter: a stat-card row, a\n * revenue bar chart + traffic donut, and a recent-orders table. Composed\n * entirely from the kit's primitives so a design agent can adapt it. Static\n * data; wire real data in a consuming app.\n */\nimport StatusBadge, { StatusBadgeProvider } from '../shell/StatusBadge';\nimport type { SemanticGroup } from '../shell/StatusBadge';\nimport Card, { StatCard } from '../shell/Card';\nimport Avatar from '../shell/Avatar';\nimport Button from '../forms/Button';\nimport Sparkline from '../charts/Sparkline';\nimport BarChart from '../charts/BarChart';\nimport DonutChart from '../charts/DonutChart';\n\nconst STATUS_GROUPS: Record<string, SemanticGroup> = {\n paid: 'success', shipped: 'active', processing: 'queued', refunded: 'neutral', overdue: 'danger',\n};\n\nconst REVENUE = [12, 18, 14, 22, 19, 27, 24, 31, 28, 35, 30, 38];\nconst MONTHS = ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'];\n\nconst ORDERS = [\n { id: '#3201', customer: 'Alice Nguyen', total: '$1,204', status: 'paid' },\n { id: '#3202', customer: 'Marco Reyes', total: '$642', status: 'shipped' },\n { id: '#3203', customer: 'Priya Patel', total: '$2,980', status: 'processing' },\n { id: '#3204', customer: 'Tom Becker', total: '$318', status: 'overdue' },\n { id: '#3205', customer: 'Sara Lind', total: '$540', status: 'refunded' },\n];\n\nexport default function DashboardTemplate() {\n return (\n <StatusBadgeProvider groups={STATUS_GROUPS}>\n <div className=\"h-full overflow-auto bg-gray-50 p-6\">\n <div className=\"mx-auto max-w-6xl space-y-6\">\n {/* Header */}\n <div className=\"flex items-center justify-between gap-4\">\n <div>\n <h1 className=\"text-xl font-semibold text-gray-900\">Dashboard</h1>\n <p className=\"text-sm text-gray-500\">Overview of your store this month</p>\n </div>\n <div className=\"flex items-center gap-2\">\n <Button variant=\"secondary\" size=\"sm\">Export</Button>\n <Button size=\"sm\">New report</Button>\n </div>\n </div>\n\n {/* Stat row */}\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4\">\n <StatCard label=\"Revenue\" value=\"$38.2k\" delta={{ value: '12%', direction: 'up' }} />\n <StatCard label=\"Orders\" value=\"1,204\" delta={{ value: '4%', direction: 'up' }} />\n <StatCard label=\"Customers\" value=\"892\" delta={{ value: '2%', direction: 'down' }} />\n <StatCard label=\"Refunds\" value=\"$1.1k\" delta={{ value: '0%', direction: 'flat' }} />\n </div>\n\n {/* Charts */}\n <div className=\"grid grid-cols-1 gap-4 lg:grid-cols-3\">\n <Card header=\"Revenue\" className=\"lg:col-span-2\">\n <div className=\"text-blue-600\">\n <BarChart data={REVENUE} labels={MONTHS} height={160} />\n </div>\n </Card>\n <Card header=\"Traffic sources\">\n <div className=\"flex items-center gap-4\">\n <DonutChart\n size={120}\n segments={[\n { label: 'Direct', value: 45 },\n { label: 'Search', value: 30 },\n { label: 'Social', value: 15 },\n { label: 'Email', value: 10 },\n ]}\n centerLabel={<span className=\"text-gray-900\">100%</span>}\n />\n <ul className=\"space-y-1.5 text-sm text-gray-600\">\n <li className=\"flex items-center gap-2\"><Dot c=\"#3b82f6\" />Direct · 45%</li>\n <li className=\"flex items-center gap-2\"><Dot c=\"#22c55e\" />Search · 30%</li>\n <li className=\"flex items-center gap-2\"><Dot c=\"#f59e0b\" />Social · 15%</li>\n <li className=\"flex items-center gap-2\"><Dot c=\"#ef4444\" />Email · 10%</li>\n </ul>\n </div>\n </Card>\n </div>\n\n {/* Recent orders */}\n <Card header=\"Recent orders\" padded={false}>\n <table className=\"w-full text-sm\">\n <thead>\n <tr className=\"border-b border-gray-100 text-left text-xs uppercase tracking-wide text-gray-400\">\n <th className=\"px-4 py-2 font-medium\">Order</th>\n <th className=\"px-4 py-2 font-medium\">Customer</th>\n <th className=\"px-4 py-2 font-medium\">Total</th>\n <th className=\"px-4 py-2 font-medium\">Status</th>\n </tr>\n </thead>\n <tbody className=\"divide-y divide-gray-100\">\n {ORDERS.map(o => (\n <tr key={o.id} className=\"text-gray-700\">\n <td className=\"px-4 py-2 font-mono text-xs text-gray-500\">{o.id}</td>\n <td className=\"px-4 py-2\">\n <span className=\"flex items-center gap-2\">\n <Avatar size=\"xs\" name={o.customer} />\n {o.customer}\n </span>\n </td>\n <td className=\"px-4 py-2\">{o.total}</td>\n <td className=\"px-4 py-2\"><StatusBadge status={o.status} /></td>\n </tr>\n ))}\n </tbody>\n </table>\n </Card>\n\n <p className=\"flex items-center gap-2 text-xs text-gray-400\">\n <span className=\"text-emerald-600\"><Sparkline data={REVENUE} width={80} height={20} /></span>\n Trending up 12% vs last month\n </p>\n </div>\n </div>\n </StatusBadgeProvider>\n );\n}\n\nfunction Dot({ c }: { c: string }) {\n return <span className=\"inline-block h-2.5 w-2.5 rounded-full\" style={{ backgroundColor: c }} />;\n}\n","/**\n * DataTablePage — a list/table screen: a toolbar (search + filter + action), a\n * static data table with status pills and row actions, and a Pagination footer.\n * Uses plain table markup (not the react-query-backed ResizableTable/EntityList)\n * so it renders standalone in design-sync.\n */\nimport { useState } from 'react';\nimport StatusBadge, { StatusBadgeProvider } from '../shell/StatusBadge';\nimport type { SemanticGroup } from '../shell/StatusBadge';\nimport Card from '../shell/Card';\nimport Button from '../forms/Button';\nimport Input from '../forms/Input';\nimport Select from '../forms/Select';\nimport Pagination from '../data/Pagination';\n\nconst GROUPS: Record<string, SemanticGroup> = {\n active: 'success', invited: 'queued', suspended: 'danger', pending: 'pending',\n};\n\nconst ROWS = [\n { name: 'Alice Nguyen', email: 'alice@acme.co', role: 'Admin', status: 'active' },\n { name: 'Marco Reyes', email: 'marco@acme.co', role: 'Editor', status: 'invited' },\n { name: 'Priya Patel', email: 'priya@acme.co', role: 'Editor', status: 'active' },\n { name: 'Tom Becker', email: 'tom@acme.co', role: 'Viewer', status: 'suspended' },\n { name: 'Sara Lind', email: 'sara@acme.co', role: 'Viewer', status: 'pending' },\n { name: 'Yuki Tanaka', email: 'yuki@acme.co', role: 'Editor', status: 'active' },\n];\n\nexport default function DataTablePage() {\n const [page, setPage] = useState(1);\n const [role, setRole] = useState('');\n const [query, setQuery] = useState('');\n\n return (\n <StatusBadgeProvider groups={GROUPS}>\n <div className=\"h-full overflow-auto bg-gray-50 p-6\">\n <div className=\"mx-auto max-w-5xl space-y-4\">\n <div className=\"flex items-center justify-between gap-4\">\n <h1 className=\"text-xl font-semibold text-gray-900\">Members</h1>\n <Button size=\"sm\">Invite member</Button>\n </div>\n\n <Card padded={false}>\n <div className=\"flex flex-wrap items-center gap-2 border-b border-gray-100 p-3\">\n <div className=\"min-w-48 flex-1\">\n <Input value={query} onChange={e => setQuery(e.target.value)} placeholder=\"Search members…\" leftIcon={<SearchIcon />} />\n </div>\n <div className=\"w-40\">\n <Select\n value={role}\n onChange={setRole}\n placeholder=\"All roles\"\n options={[\n { value: 'admin', label: 'Admin' },\n { value: 'editor', label: 'Editor' },\n { value: 'viewer', label: 'Viewer' },\n ]}\n />\n </div>\n <Button variant=\"secondary\" size=\"sm\">Filter</Button>\n </div>\n\n <table className=\"w-full text-sm\">\n <thead>\n <tr className=\"border-b border-gray-100 text-left text-xs uppercase tracking-wide text-gray-400\">\n <th className=\"px-4 py-2 font-medium\">Name</th>\n <th className=\"px-4 py-2 font-medium\">Role</th>\n <th className=\"px-4 py-2 font-medium\">Status</th>\n <th className=\"px-4 py-2 font-medium text-right\">Actions</th>\n </tr>\n </thead>\n <tbody className=\"divide-y divide-gray-100\">\n {ROWS.map(r => (\n <tr key={r.email} className=\"text-gray-700 hover:bg-gray-50\">\n <td className=\"px-4 py-2.5\">\n <div className=\"font-medium text-gray-900\">{r.name}</div>\n <div className=\"text-xs text-gray-400\">{r.email}</div>\n </td>\n <td className=\"px-4 py-2.5\">{r.role}</td>\n <td className=\"px-4 py-2.5\"><StatusBadge status={r.status} /></td>\n <td className=\"px-4 py-2.5 text-right\">\n <Button variant=\"ghost\" size=\"sm\">Edit</Button>\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n\n <div className=\"flex items-center justify-between border-t border-gray-100 p-3\">\n <span className=\"text-xs text-gray-400\">Showing 1–6 of 48</span>\n <Pagination page={page} pageCount={8} onPageChange={setPage} showEdges />\n </div>\n </Card>\n </div>\n </div>\n </StatusBadgeProvider>\n );\n}\n\nfunction SearchIcon() {\n return (\n <svg className=\"h-4 w-4\" viewBox=\"0 0 20 20\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" aria-hidden=\"true\">\n <circle cx=\"9\" cy=\"9\" r=\"6\" /><path d=\"M14 14l3 3\" strokeLinecap=\"round\" />\n </svg>\n );\n}\n","/**\n * FormLayoutPage — a settings/profile form screen: grouped Cards of FormFields\n * wrapping the kit's inputs (Input, Textarea, Select, Checkbox, Radio), with a\n * sticky-feeling action row. The canonical \"real form\" reference.\n */\nimport { useState } from 'react';\nimport Card from '../shell/Card';\nimport Button from '../forms/Button';\nimport Input from '../forms/Input';\nimport Textarea from '../forms/Textarea';\nimport Select from '../forms/Select';\nimport Checkbox from '../forms/Checkbox';\nimport Radio from '../forms/Radio';\nimport FormField from '../forms/FormField';\n\nexport default function FormLayoutPage() {\n const [plan, setPlan] = useState('pro');\n const [newsletter, setNewsletter] = useState(true);\n const [country, setCountry] = useState('us');\n\n return (\n <div className=\"h-full overflow-auto bg-gray-50 p-6\">\n <form className=\"mx-auto max-w-2xl space-y-5\" onSubmit={e => e.preventDefault()}>\n <div>\n <h1 className=\"text-xl font-semibold text-gray-900\">Account settings</h1>\n <p className=\"text-sm text-gray-500\">Update your profile and preferences.</p>\n </div>\n\n <Card header=\"Profile\">\n <div className=\"space-y-4\">\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <FormField label=\"First name\" htmlFor=\"fn\" required>\n <Input id=\"fn\" defaultValue=\"Alice\" />\n </FormField>\n <FormField label=\"Last name\" htmlFor=\"ln\" required>\n <Input id=\"ln\" defaultValue=\"Nguyen\" />\n </FormField>\n </div>\n <FormField label=\"Email\" htmlFor=\"email\" hint=\"We'll never share your email.\">\n <Input id=\"email\" type=\"email\" defaultValue=\"alice@acme.co\" />\n </FormField>\n <FormField label=\"Bio\" htmlFor=\"bio\" hint=\"Brief description for your profile.\">\n <Textarea id=\"bio\" autoGrow defaultValue=\"Product designer at Acme.\" />\n </FormField>\n </div>\n </Card>\n\n <Card header=\"Preferences\">\n <div className=\"space-y-4\">\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <FormField label=\"Country\" htmlFor=\"country\">\n <Select\n value={country}\n onChange={setCountry}\n options={[\n { value: 'us', label: 'United States' },\n { value: 'de', label: 'Germany' },\n { value: 'jp', label: 'Japan' },\n ]}\n />\n </FormField>\n <FormField label=\"Plan\">\n <div className=\"space-y-1.5 pt-1\">\n <Radio name=\"plan\" checked={plan === 'free'} onChange={() => setPlan('free')} label=\"Free\" />\n <Radio name=\"plan\" checked={plan === 'pro'} onChange={() => setPlan('pro')} label=\"Pro\" />\n <Radio name=\"plan\" checked={plan === 'team'} onChange={() => setPlan('team')} label=\"Team\" />\n </div>\n </FormField>\n </div>\n <Checkbox checked={newsletter} onChange={setNewsletter} label=\"Email me product updates\" description=\"Occasional news — no more than once a month.\" />\n </div>\n </Card>\n\n <div className=\"flex items-center justify-end gap-2\">\n <Button variant=\"secondary\">Cancel</Button>\n <Button type=\"submit\">Save changes</Button>\n </div>\n </form>\n </div>\n );\n}\n","/**\n * CheckoutTemplate — a two-column checkout: contact/shipping/payment form on the\n * left, an order summary card on the right. Built from Card + FormField + the\n * form inputs + Button, with a Banner for a promo/notice.\n */\nimport { useState } from 'react';\nimport Card from '../shell/Card';\nimport Banner from '../shell/Banner';\nimport Button from '../forms/Button';\nimport Input from '../forms/Input';\nimport Select from '../forms/Select';\nimport Checkbox from '../forms/Checkbox';\nimport FormField from '../forms/FormField';\n\nconst ITEMS = [\n { name: 'Mechanical keyboard', qty: 1, price: 129 },\n { name: 'USB-C cable (2m)', qty: 2, price: 12 },\n { name: 'Laptop stand', qty: 1, price: 48 },\n];\n\nexport default function CheckoutTemplate() {\n const [sameAddress, setSameAddress] = useState(true);\n const [country, setCountry] = useState('us');\n const subtotal = ITEMS.reduce((s, i) => s + i.qty * i.price, 0);\n const shipping = 9;\n const total = subtotal + shipping;\n\n return (\n <div className=\"h-full overflow-auto bg-gray-50 p-6\">\n <div className=\"mx-auto max-w-5xl space-y-5\">\n <h1 className=\"text-xl font-semibold text-gray-900\">Checkout</h1>\n\n <div className=\"grid grid-cols-1 gap-5 lg:grid-cols-3\">\n {/* Form */}\n <form className=\"space-y-5 lg:col-span-2\" onSubmit={e => e.preventDefault()}>\n <Card header=\"Contact\">\n <div className=\"space-y-4\">\n <FormField label=\"Email\" htmlFor=\"ck-email\" required>\n <Input id=\"ck-email\" type=\"email\" placeholder=\"you@example.com\" />\n </FormField>\n </div>\n </Card>\n\n <Card header=\"Shipping address\">\n <div className=\"space-y-4\">\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <FormField label=\"First name\" required><Input placeholder=\"Alice\" /></FormField>\n <FormField label=\"Last name\" required><Input placeholder=\"Nguyen\" /></FormField>\n </div>\n <FormField label=\"Address\" required><Input placeholder=\"123 Market St\" /></FormField>\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-3\">\n <FormField label=\"City\"><Input placeholder=\"San Francisco\" /></FormField>\n <FormField label=\"ZIP\"><Input placeholder=\"94103\" /></FormField>\n <FormField label=\"Country\">\n <Select\n value={country}\n onChange={setCountry}\n options={[\n { value: 'us', label: 'United States' },\n { value: 'de', label: 'Germany' },\n { value: 'jp', label: 'Japan' },\n ]}\n />\n </FormField>\n </div>\n <Checkbox checked={sameAddress} onChange={setSameAddress} label=\"Billing address same as shipping\" />\n </div>\n </Card>\n\n <Card header=\"Payment\">\n <div className=\"space-y-4\">\n <FormField label=\"Card number\" required><Input placeholder=\"1234 5678 9012 3456\" /></FormField>\n <div className=\"grid grid-cols-2 gap-4\">\n <FormField label=\"Expiry\" required><Input placeholder=\"MM / YY\" /></FormField>\n <FormField label=\"CVC\" required><Input placeholder=\"123\" /></FormField>\n </div>\n </div>\n </Card>\n </form>\n\n {/* Summary */}\n <div className=\"space-y-4\">\n <Card header=\"Order summary\">\n <ul className=\"space-y-2 text-sm\">\n {ITEMS.map(i => (\n <li key={i.name} className=\"flex items-center justify-between gap-2 text-gray-700\">\n <span>{i.name} <span className=\"text-gray-400\">×{i.qty}</span></span>\n <span>${i.qty * i.price}</span>\n </li>\n ))}\n </ul>\n <div className=\"mt-3 space-y-1.5 border-t border-gray-100 pt-3 text-sm text-gray-600\">\n <div className=\"flex justify-between\"><span>Subtotal</span><span>${subtotal}</span></div>\n <div className=\"flex justify-between\"><span>Shipping</span><span>${shipping}</span></div>\n <div className=\"flex justify-between text-base font-semibold text-gray-900\"><span>Total</span><span>${total}</span></div>\n </div>\n <Button block className=\"mt-4\">Pay ${total}</Button>\n </Card>\n <Banner tone=\"success\" title=\"Promo applied\">Free returns within 30 days.</Banner>\n </div>\n </div>\n </div>\n </div>\n );\n}\n","/**\n * EmailTemplate — a three-pane mail client: folder list (SidebarLayout) ·\n * message list · reading pane. Static data; the message list/reading pane are\n * plain markup so the screen renders standalone. Fills its container height.\n */\nimport { useState } from 'react';\nimport SidebarLayout from '../shell/SidebarLayout';\nimport Avatar from '../shell/Avatar';\nimport Button from '../forms/Button';\n\nconst FOLDERS = [\n { id: 'inbox', label: 'Inbox', count: 12 },\n { id: 'starred', label: 'Starred', count: 3 },\n { id: 'sent', label: 'Sent' },\n { id: 'drafts', label: 'Drafts', count: 1 },\n { id: 'archive', label: 'Archive' },\n { id: 'trash', label: 'Trash' },\n];\n\nconst MESSAGES = [\n { id: 1, from: 'Marco Reyes', subject: 'Q3 roadmap review', preview: 'Sharing the deck ahead of Thursday — let me know…', time: '9:14', unread: true },\n { id: 2, from: 'Priya Patel', subject: 'Design handoff', preview: 'The Figma file is ready for engineering. I exported…', time: '8:02', unread: true },\n { id: 3, from: 'GitHub', subject: '[acme/web] PR #482 merged', preview: 'Your pull request was merged into main by…', time: 'Yest' },\n { id: 4, from: 'Sara Lind', subject: 'Lunch Friday?', preview: 'A few of us are heading to the new place on 5th…', time: 'Yest' },\n];\n\nexport default function EmailTemplate() {\n const [active, setActive] = useState(1);\n const selected = MESSAGES.find(m => m.id === active) ?? MESSAGES[0];\n\n return (\n <div className=\"h-full\">\n <SidebarLayout\n side=\"left\"\n defaultWidth={200}\n sidebar={\n <div className=\"flex h-full flex-col p-2\">\n <Button block className=\"mb-2\">Compose</Button>\n {FOLDERS.map((f, i) => (\n <button\n key={f.id}\n className={`flex items-center justify-between rounded-md px-3 py-2 text-left text-sm ${\n i === 0 ? 'bg-blue-50 font-medium text-blue-700' : 'text-gray-700 hover:bg-gray-100'\n }`}\n >\n <span>{f.label}</span>\n {f.count != null && <span className=\"text-xs text-gray-400\">{f.count}</span>}\n </button>\n ))}\n </div>\n }\n >\n <div className=\"flex h-full\">\n {/* Message list */}\n <div className=\"w-72 shrink-0 overflow-auto border-r border-gray-200\">\n {MESSAGES.map(m => (\n <button\n key={m.id}\n onClick={() => setActive(m.id)}\n className={`block w-full border-b border-gray-100 px-4 py-3 text-left hover:bg-gray-50 ${m.id === active ? 'bg-blue-50/50' : ''}`}\n >\n <div className=\"flex items-center justify-between gap-2\">\n <span className={`truncate text-sm ${m.unread ? 'font-semibold text-gray-900' : 'text-gray-700'}`}>{m.from}</span>\n <span className=\"shrink-0 text-[11px] text-gray-400\">{m.time}</span>\n </div>\n <div className={`truncate text-sm ${m.unread ? 'text-gray-800' : 'text-gray-600'}`}>{m.subject}</div>\n <div className=\"truncate text-xs text-gray-400\">{m.preview}</div>\n </button>\n ))}\n </div>\n\n {/* Reading pane */}\n <div className=\"flex min-w-0 flex-1 flex-col overflow-auto\">\n <div className=\"flex items-center justify-between gap-3 border-b border-gray-200 p-4\">\n <h2 className=\"truncate text-base font-semibold text-gray-900\">{selected.subject}</h2>\n <div className=\"flex shrink-0 gap-1.5\">\n <Button variant=\"ghost\" size=\"sm\">Archive</Button>\n <Button variant=\"secondary\" size=\"sm\">Reply</Button>\n </div>\n </div>\n <div className=\"flex items-center gap-3 border-b border-gray-100 p-4\">\n <Avatar name={selected.from} />\n <div className=\"min-w-0\">\n <div className=\"text-sm font-medium text-gray-900\">{selected.from}</div>\n <div className=\"text-xs text-gray-400\">to me · {selected.time}</div>\n </div>\n </div>\n <div className=\"space-y-3 p-4 text-sm leading-relaxed text-gray-700\">\n <p>Hi,</p>\n <p>{selected.preview} The full details are attached — happy to walk through anything on a quick call.</p>\n <p>Best,<br />{selected.from}</p>\n </div>\n </div>\n </div>\n </SidebarLayout>\n </div>\n );\n}\n","/**\n * ChatTemplate — a messaging screen: conversation list (SidebarLayout) + a\n * message thread with a composer. Avatars + bubble rows are plain markup;\n * the composer uses Input + Button. Fills its container height.\n */\nimport { useState } from 'react';\nimport SidebarLayout from '../shell/SidebarLayout';\nimport Avatar from '../shell/Avatar';\nimport Input from '../forms/Input';\nimport Button from '../forms/Button';\nimport type { AvatarStatus } from '../shell/Avatar';\n\nconst CONVOS: { id: number; name: string; last: string; time: string; status: AvatarStatus }[] = [\n { id: 1, name: 'Priya Patel', last: 'Sounds good — shipping it now', time: '9:41', status: 'online' },\n { id: 2, name: 'Design team', last: 'Marco: updated the tokens', time: '9:12', status: 'away' },\n { id: 3, name: 'Tom Becker', last: 'Thanks!', time: 'Yest', status: 'offline' },\n { id: 4, name: 'Sara Lind', last: 'See you Friday 🎉', time: 'Yest', status: 'busy' },\n];\n\nconst THREAD = [\n { mine: false, text: 'Hey! Did the latest build go out?' },\n { mine: true, text: 'Just merged — deploying now.' },\n { mine: false, text: 'Nice. Any breaking changes for the portal?' },\n { mine: true, text: 'Nope, fully additive. New components only.' },\n { mine: false, text: 'Sounds good — shipping it now' },\n];\n\nexport default function ChatTemplate() {\n const [active, setActive] = useState(1);\n const convo = CONVOS.find(c => c.id === active) ?? CONVOS[0];\n\n return (\n <div className=\"h-full\">\n <SidebarLayout\n side=\"left\"\n defaultWidth={260}\n sidebar={\n <div className=\"h-full overflow-auto\">\n {CONVOS.map(c => (\n <button\n key={c.id}\n onClick={() => setActive(c.id)}\n className={`flex w-full items-center gap-3 border-b border-gray-100 px-3 py-3 text-left hover:bg-gray-50 ${c.id === active ? 'bg-blue-50/50' : ''}`}\n >\n <Avatar name={c.name} status={c.status} />\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex items-center justify-between gap-2\">\n <span className=\"truncate text-sm font-medium text-gray-900\">{c.name}</span>\n <span className=\"shrink-0 text-[11px] text-gray-400\">{c.time}</span>\n </div>\n <div className=\"truncate text-xs text-gray-500\">{c.last}</div>\n </div>\n </button>\n ))}\n </div>\n }\n >\n <div className=\"flex h-full flex-col\">\n {/* Thread header */}\n <div className=\"flex items-center gap-3 border-b border-gray-200 p-3\">\n <Avatar name={convo.name} status={convo.status} size=\"sm\" />\n <div>\n <div className=\"text-sm font-medium text-gray-900\">{convo.name}</div>\n <div className=\"text-xs text-gray-400 capitalize\">{convo.status}</div>\n </div>\n </div>\n\n {/* Messages */}\n <div className=\"flex flex-1 flex-col gap-2 overflow-auto bg-gray-50 p-4\">\n {THREAD.map((m, i) => (\n <div key={i} className={`flex ${m.mine ? 'justify-end' : 'justify-start'}`}>\n <div\n style={{ maxWidth: '75%' }}\n className={`rounded-2xl px-3 py-2 text-sm ${\n m.mine ? 'bg-blue-600 text-white' : 'bg-white text-gray-800 shadow-sm'\n }`}\n >\n {m.text}\n </div>\n </div>\n ))}\n </div>\n\n {/* Composer */}\n <form className=\"flex items-center gap-2 border-t border-gray-200 p-3\" onSubmit={e => e.preventDefault()}>\n <div className=\"flex-1\">\n <Input placeholder=\"Type a message…\" />\n </div>\n <Button type=\"submit\">Send</Button>\n </form>\n </div>\n </SidebarLayout>\n </div>\n );\n}\n","/**\n * GalleryTemplate — a media/photo grid with a Tabs filter and Card tiles that\n * carry a StatusBadge overlay. Tiles use a gradient placeholder (inline style)\n * in place of real images. Scrollable page.\n */\nimport { useState } from 'react';\nimport Card from '../shell/Card';\nimport Tabs from '../shell/Tabs';\nimport Button from '../forms/Button';\nimport StatusBadge, { StatusBadgeProvider } from '../shell/StatusBadge';\nimport type { SemanticGroup } from '../shell/StatusBadge';\n\nconst GROUPS: Record<string, SemanticGroup> = { featured: 'success', new: 'active', draft: 'draft' };\n\nconst GRADIENTS = [\n 'linear-gradient(135deg,#60a5fa,#a78bfa)',\n 'linear-gradient(135deg,#34d399,#10b981)',\n 'linear-gradient(135deg,#fbbf24,#f59e0b)',\n 'linear-gradient(135deg,#f472b6,#ec4899)',\n 'linear-gradient(135deg,#38bdf8,#6366f1)',\n 'linear-gradient(135deg,#fb7185,#ef4444)',\n 'linear-gradient(135deg,#4ade80,#22c55e)',\n 'linear-gradient(135deg,#c084fc,#8b5cf6)',\n];\n\nconst ITEMS = GRADIENTS.map((g, i) => ({\n id: i,\n title: ['Sunrise', 'Forest', 'Desert', 'Bloom', 'Ocean', 'Ember', 'Meadow', 'Dusk'][i],\n tag: ['featured', 'new', 'draft'][i % 3],\n bg: g,\n}));\n\nexport default function GalleryTemplate() {\n const [filter, setFilter] = useState('all');\n const shown = filter === 'all' ? ITEMS : ITEMS.filter(i => i.tag === filter);\n\n return (\n <StatusBadgeProvider groups={GROUPS}>\n <div className=\"h-full overflow-auto bg-gray-50 p-6\">\n <div className=\"mx-auto max-w-5xl space-y-4\">\n <div className=\"flex items-center justify-between gap-4\">\n <h1 className=\"text-xl font-semibold text-gray-900\">Gallery</h1>\n <Button size=\"sm\">Upload</Button>\n </div>\n\n <Tabs\n value={filter}\n onChange={setFilter}\n variant=\"pill\"\n items={[\n { id: 'all', label: 'All' },\n { id: 'featured', label: 'Featured' },\n { id: 'new', label: 'New' },\n { id: 'draft', label: 'Drafts' },\n ]}\n />\n\n <div className=\"grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-4\">\n {shown.map(item => (\n <Card key={item.id} padded={false} className=\"overflow-hidden\">\n <div className=\"relative h-28\" style={{ background: item.bg }}>\n <span className=\"absolute right-2 top-2\"><StatusBadge status={item.tag} /></span>\n </div>\n <div className=\"flex items-center justify-between gap-2 p-3\">\n <span className=\"truncate text-sm font-medium text-gray-900\">{item.title}</span>\n <span className=\"text-xs text-gray-400\">2.4 MB</span>\n </div>\n </Card>\n ))}\n </div>\n </div>\n </div>\n </StatusBadgeProvider>\n );\n}\n","/**\n * AuthScreen — centered authentication card. `mode` switches between sign-in,\n * registration, and password-reset layouts. Built from Card + FormField +\n * Input + Checkbox + Button. The design-sync preview renders all three modes.\n */\nimport Card from '../shell/Card';\nimport Button from '../forms/Button';\nimport Input from '../forms/Input';\nimport Checkbox from '../forms/Checkbox';\nimport FormField from '../forms/FormField';\nimport { useState } from 'react';\n\nexport interface AuthScreenProps {\n mode?: 'login' | 'register' | 'forgot';\n}\n\nconst COPY = {\n login: { title: 'Welcome back', subtitle: 'Sign in to your account', cta: 'Sign in' },\n register: { title: 'Create your account', subtitle: 'Start your 14-day free trial', cta: 'Create account' },\n forgot: { title: 'Reset password', subtitle: \"We'll email you a reset link\", cta: 'Send reset link' },\n};\n\nexport default function AuthScreen({ mode = 'login' }: AuthScreenProps) {\n const [remember, setRemember] = useState(true);\n const c = COPY[mode];\n\n return (\n <div className=\"flex h-full items-center justify-center overflow-auto bg-gray-50 p-6\">\n <div className=\"w-full max-w-sm\">\n <div className=\"mb-6 text-center\">\n <div className=\"mx-auto mb-3 flex h-10 w-10 items-center justify-center rounded-lg bg-blue-600 text-sm font-bold text-white\">A</div>\n <h1 className=\"text-lg font-semibold text-gray-900\">{c.title}</h1>\n <p className=\"text-sm text-gray-500\">{c.subtitle}</p>\n </div>\n\n <Card>\n <form className=\"space-y-4\" onSubmit={e => e.preventDefault()}>\n {mode === 'register' && (\n <FormField label=\"Name\" htmlFor=\"au-name\"><Input id=\"au-name\" placeholder=\"Alice Nguyen\" /></FormField>\n )}\n <FormField label=\"Email\" htmlFor=\"au-email\">\n <Input id=\"au-email\" type=\"email\" placeholder=\"you@example.com\" />\n </FormField>\n\n {mode !== 'forgot' && (\n <FormField\n label=\"Password\"\n htmlFor=\"au-pass\"\n hint={mode === 'register' ? 'At least 8 characters.' : undefined}\n >\n <Input id=\"au-pass\" type=\"password\" placeholder=\"••••••••\" />\n </FormField>\n )}\n\n {mode === 'login' && (\n <div className=\"flex items-center justify-between\">\n <Checkbox checked={remember} onChange={setRemember} label=\"Remember me\" />\n <a href=\"#\" className=\"text-sm text-blue-600 hover:underline\">Forgot?</a>\n </div>\n )}\n\n <Button type=\"submit\" block>{c.cta}</Button>\n </form>\n </Card>\n\n <p className=\"mt-4 text-center text-sm text-gray-500\">\n {mode === 'register' ? (\n <>Already have an account? <a href=\"#\" className=\"text-blue-600 hover:underline\">Sign in</a></>\n ) : (\n <>New here? <a href=\"#\" className=\"text-blue-600 hover:underline\">Create an account</a></>\n )}\n </p>\n </div>\n </div>\n );\n}\n","/**\n * ErrorPage — a centered error state for 403 / 404 / 500. `code` selects the\n * heading and copy; `actions` is the way out, supplied by the consumer because\n * the kit has no router. Pure presentational.\n */\nimport { type ReactNode } from 'react';\n\nexport interface ErrorPageProps {\n code?: 403 | 404 | 500;\n /**\n * What the user can do about it — typically a link home.\n *\n * There is no default, and that is the fix: this page used to render \"Go\n * back\" and \"Take me home\" as buttons with no handlers on them. They looked\n * like the way out of a dead end and did nothing, which is worse than\n * offering nothing at all. The kit has no router, so the destination has to\n * come from the consumer.\n */\n actions?: ReactNode;\n}\n\nconst COPY: Record<NonNullable<ErrorPageProps['code']>, { title: string; body: string }> = {\n 403: { title: 'Access denied', body: \"You don't have permission to view this page.\" },\n 404: { title: 'Page not found', body: \"The page you're looking for doesn't exist or was moved.\" },\n 500: { title: 'Something went wrong', body: 'An unexpected error occurred. Please try again.' },\n};\n\nexport default function ErrorPage({ code = 404, actions }: ErrorPageProps) {\n const c = COPY[code];\n return (\n <div className=\"flex h-full flex-col items-center justify-center bg-gray-50 p-6 text-center\">\n <div className=\"text-7xl font-bold tracking-tight text-gray-400\">{code}</div>\n <h1 className=\"mt-2 text-xl font-semibold text-gray-900\">{c.title}</h1>\n <p className=\"mt-1 max-w-sm text-sm text-gray-500\">{c.body}</p>\n {actions && <div className=\"mt-6 flex items-center gap-2\">{actions}</div>}\n </div>\n );\n}\n","/**\n * ErrorBoundary — catches a render crash and shows the 500 page instead of a\n * blank screen.\n *\n * `WindowErrorBoundary` already exists and is not this: it guards one desktop\n * window's body so the taskbar and the other windows keep running, and its\n * fallback is sized to sit inside window chrome. A portal is a plain React app\n * with no windows, so it needs a boundary whose fallback is a whole page. Every\n * portal has written that boundary itself, and each one hard-coded its own\n * colours to do it.\n *\n * Two things the hand-written ones get wrong, worth naming because they are\n * the reason this is a component rather than a snippet:\n *\n * - They print `error.stack` into the page. In development that is the useful\n * part; in production it hands a visitor the internal module layout. Here\n * the detail is opt-in and off by default.\n * - They swap the content out silently. A crash is exactly the moment a screen\n * reader user is owed an announcement, so the PAGE is `role=\"alert\"` — the\n * page, not the whole fallback: `alert` is read wholesale and assertively,\n * and a region spanning the opt-in stack trace would recite `error.stack`\n * at the user before they could act on it.\n */\nimport { Component, type ErrorInfo, type ReactNode } from 'react';\nimport ErrorPage from './ErrorPage';\nimport Button from '../forms/Button';\n\nexport interface ErrorBoundaryProps {\n children: ReactNode;\n /**\n * Replaces the default page. `reset` clears the caught error so the children\n * mount again — worth offering when the cause may have been transient.\n */\n fallback?: (error: Error, reset: () => void) => ReactNode;\n /**\n * What the user can do about it, rendered under the default page. The kit has\n * no router, so a link home has to come from the consumer — the same reason\n * {@link ErrorPage} takes its actions rather than inventing them.\n */\n actions?: ReactNode;\n /**\n * Called with the caught error. This is where a consumer reports to Sentry or\n * its own logger; without it a crash is only ever a `console.error` in a\n * browser nobody is looking at.\n */\n onError?: (error: Error, info: ErrorInfo) => void;\n /**\n * Show the message and stack on the page. Defaults to OFF. Pass\n * `import.meta.env.DEV` to get the detail while developing and nothing in\n * production — the value is the consumer's because the kit is built once and\n * cannot read the app's mode.\n */\n showDetails?: boolean;\n /**\n * Clears the error when any entry changes — typically the current path, so\n * navigating away from a crashed page recovers instead of holding the\n * fallback until a full reload.\n */\n resetKeys?: unknown[];\n}\n\ninterface State {\n error: Error | null;\n}\n\nexport default class ErrorBoundary extends Component<ErrorBoundaryProps, State> {\n state: State = { error: null };\n\n static getDerivedStateFromError(error: Error): State {\n return { error };\n }\n\n componentDidCatch(error: Error, info: ErrorInfo) {\n // Kept even when `onError` is supplied: a reporter that is itself broken\n // would otherwise swallow the only record of the crash.\n console.error('ErrorBoundary caught an error:', error, info);\n this.props.onError?.(error, info);\n }\n\n componentDidUpdate(prev: ErrorBoundaryProps) {\n if (!this.state.error) return;\n // A missing side counts as empty rather than as \"skip\". Guarding on both\n // being present meant a consumer whose keys are conditional — a router\n // hook returning undefined on the first render after a crash, then\n // `[path]` — never recovered, and that transition IS the navigation the\n // prop exists to catch.\n const a = prev.resetKeys ?? [];\n const b = this.props.resetKeys ?? [];\n if (a.length !== b.length || a.some((k, i) => !Object.is(k, b[i]))) {\n this.reset();\n }\n }\n\n reset = () => this.setState({ error: null });\n\n render() {\n const { error } = this.state;\n if (!error) return this.props.children;\n if (this.props.fallback) return this.props.fallback(error, this.reset);\n\n return (\n // A column, not a bare wrapper: `ErrorPage` is `h-full`, so a `<details>`\n // rendered as its sibling inside an `h-full` box starts at the 100% mark\n // and sits below the fold — unreachable under an `overflow-hidden`\n // ancestor, which is the usual app shell. As a flex child it takes the\n // room it needs and the page gives it back.\n <div className=\"flex h-full flex-col\">\n {/* The live region is the PAGE, not everything on screen. `alert` is\n announced wholesale and assertively, so a region spanning the stack\n trace reads a developer's `error.stack` at a screen-reader user\n before they can act. The details sit outside it deliberately. */}\n <div role=\"alert\" className=\"min-h-0 flex-1\">\n <ErrorPage\n code={500}\n actions={\n <>\n {/* The kit's Button, not a hand-written class string. This\n component's whole argument is that the portals' own\n boundaries \"hard-coded its own colours\" — re-typing\n Button's primary here would be the same mistake one layer\n up, and would miss every rung and state Button grows. */}\n <Button onClick={this.reset}>Try again</Button>\n {this.props.actions}\n </>\n }\n />\n </div>\n {this.props.showDetails && (\n <details className=\"mx-auto w-full max-w-2xl shrink-0 px-6 pb-6\">\n <summary className=\"cursor-pointer text-sm font-medium text-gray-600\">Error details</summary>\n <pre className=\"mt-2 overflow-auto rounded-md bg-gray-100 p-3 text-xs text-gray-700\">\n {error.stack ?? error.message}\n </pre>\n </details>\n )}\n </div>\n );\n }\n}\n","import { useEffect, useSyncExternalStore } from 'react';\nimport { useShellPrefs } from '../shell/ShellPrefs';\n\nexport type Theme = 'system' | 'light' | 'dark' | 'pink' | 'green' | 'grey' | 'blue';\n\n/** Subscribe to OS dark-mode changes */\nfunction subscribeMediaQuery(cb: () => void) {\n const mq = window.matchMedia('(prefers-color-scheme: dark)');\n mq.addEventListener('change', cb);\n return () => mq.removeEventListener('change', cb);\n}\nfunction getSystemIsDark() {\n return window.matchMedia('(prefers-color-scheme: dark)').matches;\n}\n\n/** Derive lighter / darker shades from a hex color via HSL */\nfunction hexToHsl(hex: string): [number, number, number] {\n const r = parseInt(hex.slice(1, 3), 16) / 255;\n const g = parseInt(hex.slice(3, 5), 16) / 255;\n const b = parseInt(hex.slice(5, 7), 16) / 255;\n const max = Math.max(r, g, b), min = Math.min(r, g, b);\n let h = 0, s = 0;\n const l = (max + min) / 2;\n if (max !== min) {\n const d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n if (max === r) h = ((g - b) / d + (g < b ? 6 : 0)) / 6;\n else if (max === g) h = ((b - r) / d + 2) / 6;\n else h = ((r - g) / d + 4) / 6;\n }\n return [h * 360, s * 100, l * 100];\n}\nfunction hslToHex(h: number, s: number, l: number): string {\n s /= 100; l /= 100;\n const a = s * Math.min(l, 1 - l);\n const f = (n: number) => { const k = (n + h / 30) % 12; return l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1); };\n const toHex = (x: number) => Math.round(x * 255).toString(16).padStart(2, '0');\n return `#${toHex(f(0))}${toHex(f(8))}${toHex(f(4))}`;\n}\n\n/** Resolve a stored theme to the attribute value <html> actually carries\n * ('system' follows the OS dark-mode media query). */\nexport function resolveTheme(theme: string | null | undefined): string {\n const t = theme || 'system';\n if (t === 'system') return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n return t;\n}\n\n/** Stamp the custom-accent shade scale (or clear it) on <html>. */\nfunction applyAccent(accentColor: string | null) {\n const root = document.documentElement;\n if (accentColor && /^#[0-9a-fA-F]{6}$/.test(accentColor)) {\n const [h, s, l] = hexToHsl(accentColor);\n root.setAttribute('data-custom-accent', 'true');\n root.style.setProperty('--accent-600', accentColor);\n root.style.setProperty('--accent-700', hslToHex(h, s, Math.max(l - 10, 5)));\n root.style.setProperty('--accent-500', hslToHex(h, s, Math.min(l + 10, 95)));\n root.style.setProperty('--accent-400', hslToHex(h, s, Math.min(l + 20, 95)));\n root.style.setProperty('--accent-300', hslToHex(h, Math.min(s + 10, 100), Math.min(l + 30, 92)));\n root.style.setProperty('--accent-200', hslToHex(h, Math.min(s + 15, 100), Math.min(l + 38, 94)));\n root.style.setProperty('--accent-100', hslToHex(h, Math.min(s + 20, 100), Math.min(l + 42, 96)));\n root.style.setProperty('--accent-50', hslToHex(h, Math.min(s + 20, 100), Math.min(l + 46, 98)));\n } else {\n root.removeAttribute('data-custom-accent');\n ['--accent-600', '--accent-700', '--accent-500', '--accent-400', '--accent-300', '--accent-200', '--accent-100', '--accent-50'].forEach(p => root.style.removeProperty(p));\n }\n}\n\n/** Stamp the custom theme colors (bg, title, window, button) on <html>.\n * Only active alongside a custom accent — clears the button/bg vars otherwise. */\nfunction applyCustomColors(\n accentColor: string | null,\n customBgColor: string | null,\n customTitleColor: string | null,\n customWindowColor: string | null,\n customButtonColor: string | null,\n) {\n const root = document.documentElement;\n if (accentColor) {\n // Helper to convert hex to \"r g b\" for rgba usage\n const hexToRgb = (hex: string) => {\n const r = parseInt(hex.slice(1, 3), 16);\n const g = parseInt(hex.slice(3, 5), 16);\n const b = parseInt(hex.slice(5, 7), 16);\n return `${r} ${g} ${b}`;\n };\n if (customBgColor) root.style.setProperty('--custom-bg-color', customBgColor);\n if (customTitleColor) {\n root.style.setProperty('--window-header-rgb', hexToRgb(customTitleColor));\n root.style.setProperty('--window-footer-rgb', hexToRgb(customTitleColor));\n }\n if (customWindowColor) root.style.setProperty('--window-content-rgb', hexToRgb(customWindowColor));\n if (customButtonColor) {\n root.style.setProperty('--custom-button-color', customButtonColor);\n const [h, s, l] = hexToHsl(customButtonColor);\n root.style.setProperty('--custom-button-hover', hslToHex(h, s, Math.max(l - 10, 5)));\n }\n } else {\n ['--custom-bg-color', '--custom-button-color', '--custom-button-hover'].forEach(p => root.style.removeProperty(p));\n }\n}\n\n/**\n * Imperatively apply a theme/accent/custom-color prefs snapshot to <html>.\n *\n * useTheme() already reconciles these from prefs, but it does so via effects\n * that only fire once prefs actually changes — and a backend-backed prefs\n * adapter (the admin/supplier portals PATCH /auth/me/ and refetch) can take\n * seconds to settle, leaving the repaint stalled the whole time. The shell's\n * <Customization> calls this on every theme/accent/color click so the switch\n * lands on the same frame, then persists through save() in the background.\n */\nexport function applyThemePrefs(p: {\n theme?: string | null;\n accent_color?: string | null;\n custom_bg_color?: string | null;\n custom_title_color?: string | null;\n custom_window_color?: string | null;\n custom_button_color?: string | null;\n}) {\n document.documentElement.setAttribute('data-theme', resolveTheme(p.theme));\n applyAccent(p.accent_color ?? null);\n applyCustomColors(\n p.accent_color ?? null,\n p.custom_bg_color ?? null,\n p.custom_title_color ?? null,\n p.custom_window_color ?? null,\n p.custom_button_color ?? null,\n );\n}\n\nexport function useTheme() {\n const { prefs } = useShellPrefs();\n const systemDark = useSyncExternalStore(subscribeMediaQuery, getSystemIsDark);\n const saved: Theme = (prefs.theme as Theme) || 'system';\n const accentColor: string | null = prefs.accent_color || null;\n const customBgColor: string | null = prefs.custom_bg_color || null;\n const customTitleColor: string | null = prefs.custom_title_color || null;\n const customWindowColor: string | null = prefs.custom_window_color || null;\n const customButtonColor: string | null = prefs.custom_button_color || null;\n\n // Resolve \"system\" to actual theme\n const resolved = saved === 'system' ? (systemDark ? 'dark' : 'light') : saved;\n\n useEffect(() => {\n document.documentElement.setAttribute('data-theme', resolved);\n return () => document.documentElement.removeAttribute('data-theme');\n }, [resolved]);\n\n // Custom accent color\n useEffect(() => { applyAccent(accentColor); }, [accentColor]);\n\n // Custom theme colors (bg, title, window, button)\n useEffect(() => {\n applyCustomColors(accentColor, customBgColor, customTitleColor, customWindowColor, customButtonColor);\n }, [accentColor, customBgColor, customTitleColor, customWindowColor, customButtonColor]);\n\n return { theme: saved, resolved };\n}\n","export const isMac = typeof navigator !== 'undefined' && /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent);\n\n/** Platform-aware modifier symbols */\nexport const MOD = isMac ? '\\u2318' : 'Ctrl';\nexport const ALT = isMac ? '\\u2325' : 'Alt';\nexport const SHIFT = '\\u21E7';\nexport const ENTER = '\\u23CE';\n\n/** Common shortcut labels */\nexport const CMD_ENTER = isMac ? '\\u2318\\u23CE' : 'Ctrl\\u23CE';\nexport const CMD_S = isMac ? '\\u2318S' : 'Ctrl+S';\nexport const CMD_K = isMac ? '\\u2318K' : 'Ctrl+K';\nexport const CMD_DOT = isMac ? '\\u2318.' : 'Ctrl+.';\nexport const CMD_A = isMac ? '\\u2318A' : 'Ctrl+A';\nexport const CMD_Z = isMac ? '\\u2318Z' : 'Ctrl+Z';\n/** Redo. Mac has no \\u2318Y convention, so it is the shifted undo there. */\nexport const CMD_SHIFT_Z = isMac ? '\\u2318\\u21e7Z' : 'Ctrl+Shift+Z';\nexport const ALT_SHIFT_D = isMac ? '\\u2325\\u21E7D' : 'Alt+Shift+D';\nexport const ALT_SHIFT_E = isMac ? '\\u2325\\u21E7E' : 'Alt+Shift+E';\nexport const ALT_SHIFT_N = isMac ? '\\u2325\\u21E7N' : 'Alt+Shift+N';\n"]}
|