@inshorts/glint-ui 0.6.0 → 0.6.2

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.
Files changed (37) hide show
  1. package/dist/autocomplete.cjs.map +1 -1
  2. package/dist/autocomplete.js +2 -2
  3. package/dist/{chunk-PVK4WQJZ.js → chunk-5MEOZHJA.js} +2 -2
  4. package/dist/{chunk-43ZUFY63.js → chunk-A6GRLKOO.js} +3 -3
  5. package/dist/chunk-A6GRLKOO.js.map +1 -0
  6. package/dist/{chunk-YSU4VWRD.js → chunk-DS3QYIKL.js} +2 -2
  7. package/dist/{chunk-YSU4VWRD.js.map → chunk-DS3QYIKL.js.map} +1 -1
  8. package/dist/{chunk-WVNRFO5F.js → chunk-ISPICB4W.js} +2 -2
  9. package/dist/{chunk-ASU6CUTZ.js → chunk-MLRSOTFI.js} +5 -9
  10. package/dist/chunk-MLRSOTFI.js.map +1 -0
  11. package/dist/{chunk-6URKHMCF.js → chunk-OUYT6SPU.js} +2 -2
  12. package/dist/confirm-dialog.cjs +1 -1
  13. package/dist/confirm-dialog.cjs.map +1 -1
  14. package/dist/confirm-dialog.js +2 -2
  15. package/dist/index.cjs +6 -10
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.js +6 -6
  18. package/dist/modal.cjs +1 -1
  19. package/dist/modal.cjs.map +1 -1
  20. package/dist/modal.js +1 -1
  21. package/dist/segmented-control.cjs +4 -8
  22. package/dist/segmented-control.cjs.map +1 -1
  23. package/dist/segmented-control.d.cts +5 -7
  24. package/dist/segmented-control.d.ts +5 -7
  25. package/dist/segmented-control.js +1 -1
  26. package/dist/select.cjs.map +1 -1
  27. package/dist/select.js +3 -3
  28. package/dist/side-drawer.cjs +1 -1
  29. package/dist/side-drawer.cjs.map +1 -1
  30. package/dist/side-drawer.js +2 -2
  31. package/package.json +9 -8
  32. package/LICENSE +0 -13
  33. package/dist/chunk-43ZUFY63.js.map +0 -1
  34. package/dist/chunk-ASU6CUTZ.js.map +0 -1
  35. /package/dist/{chunk-PVK4WQJZ.js.map → chunk-5MEOZHJA.js.map} +0 -0
  36. /package/dist/{chunk-WVNRFO5F.js.map → chunk-ISPICB4W.js.map} +0 -0
  37. /package/dist/{chunk-6URKHMCF.js.map → chunk-OUYT6SPU.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/autocomplete.tsx","../src/modal.tsx","../src/utils.ts"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { Check, ChevronDown, Search, X } from \"lucide-react\";\n\nimport { useHasMounted } from \"./modal\";\nimport { cn } from \"./utils\";\n\n/** Room the list wants below the control before it gives up and flips. */\nconst PREFERRED_LIST_HEIGHT = 224;\n/** Below this there is no point opening downward at all. */\nconst MIN_LIST_HEIGHT = 120;\nconst VIEWPORT_MARGIN = 8;\nconst ANCHOR_GAP = 4;\n\ntype DropdownPosition = {\n left: number;\n width: number;\n maxHeight: number;\n /** One of the two is set: `top` opens downward, `bottom` opens upward. */\n top?: number;\n bottom?: number;\n};\n\nexport type AutocompleteOption = {\n value: string;\n label: string;\n disabled?: boolean;\n};\n\ntype BaseAutocompleteProps = {\n options: AutocompleteOption[];\n placeholder?: string;\n disabled?: boolean;\n className?: string;\n emptyMessage?: string;\n id?: string;\n /**\n * Accessible name for the combobox.\n *\n * `Field` renders its label as a `<span>`, so without this the control is\n * announced as an unnamed combobox and cannot be queried by name — the\n * filter toolbars work around it by counting comboboxes on the page.\n */\n ariaLabel?: string;\n /**\n * `compact` is the spreadsheet cell: no search icon, no min height, and a\n * list wide enough to read a name. The closed control still shows the\n * chosen label, and typing filters the list.\n */\n size?: \"default\" | \"compact\";\n /**\n * Type a value and press Enter (or paste a list) to add it, like antd\n * `Select mode=\"tags\"`. With `multiple` a pasted list is split into several\n * values; on a single-value control it accepts one typed value the options\n * do not offer — an id for a record the list has not loaded, say.\n */\n creatable?: boolean;\n /**\n * Shows the clear button once a value is chosen. Off for dropdowns that\n * always keep one of their options, where clearing would blank a required\n * field.\n */\n clearable?: boolean;\n};\n\ntype SingleAutocompleteProps = BaseAutocompleteProps & {\n multiple?: false;\n value: string;\n onChange: (value: string) => void;\n};\n\ntype MultipleAutocompleteProps = BaseAutocompleteProps & {\n multiple: true;\n value: string[];\n onChange: (value: string[]) => void;\n};\n\nexport type AutocompleteProps =\n SingleAutocompleteProps | MultipleAutocompleteProps;\n\nfunction normalizeQuery(query: string) {\n return query.trim().toLowerCase();\n}\n\nfunction filterOptions(options: AutocompleteOption[], query: string) {\n const normalized = normalizeQuery(query);\n if (!normalized) return options;\n\n return options.filter(\n (option) =>\n option.label.toLowerCase().includes(normalized) ||\n option.value.toLowerCase().includes(normalized),\n );\n}\n\nfunction getOptionLabel(options: AutocompleteOption[], value: string) {\n return options.find((option) => option.value === value)?.label ?? value;\n}\n\nfunction parseTagTokens(raw: string): string[] {\n const seen = new Set<string>();\n const tokens: string[] = [];\n for (const part of raw.split(/[\\s,]+/)) {\n const token = part.trim();\n if (!token || seen.has(token)) continue;\n seen.add(token);\n tokens.push(token);\n }\n return tokens;\n}\n\nexport function Autocomplete(props: AutocompleteProps) {\n const {\n options,\n placeholder = \"Search…\",\n disabled = false,\n className,\n emptyMessage = \"No results found\",\n id,\n ariaLabel,\n size = \"default\",\n creatable = false,\n clearable = true,\n } = props;\n\n const multiple = props.multiple ?? false;\n const singleValue = multiple\n ? undefined\n : (props as SingleAutocompleteProps).value;\n const multipleValue = multiple\n ? (props as MultipleAutocompleteProps).value\n : undefined;\n\n // Memoized so dependent callbacks below keep stable identities across renders.\n const selectedValues = React.useMemo<string[]>(() => {\n if (multiple) return multipleValue ?? [];\n return singleValue ? [singleValue] : [];\n }, [multiple, multipleValue, singleValue]);\n\n const onSingleChange = !multiple\n ? (props as SingleAutocompleteProps).onChange\n : undefined;\n const onMultipleChange = multiple\n ? (props as MultipleAutocompleteProps).onChange\n : undefined;\n\n const containerRef = React.useRef<HTMLDivElement>(null);\n const dropdownRef = React.useRef<HTMLDivElement>(null);\n const inputRef = React.useRef<HTMLInputElement>(null);\n const listRef = React.useRef<HTMLUListElement>(null);\n const ignoreBlurRef = React.useRef(false);\n\n const mounted = useHasMounted();\n const [open, setOpen] = React.useState(false);\n const [position, setPosition] = React.useState<DropdownPosition | null>(null);\n const [query, setQuery] = React.useState(\"\");\n const [highlightedIndex, setHighlightedIndex] = React.useState(0);\n\n const filteredOptions = React.useMemo(\n () => filterOptions(options, query),\n [options, query],\n );\n\n // Clamp during render instead of via a setState-in-effect: if the option list\n // shrinks below the stored index, fall back to the last valid row.\n const safeHighlightedIndex =\n highlightedIndex >= filteredOptions.length\n ? Math.max(filteredOptions.length - 1, 0)\n : highlightedIndex;\n\n const close = React.useCallback(() => {\n setOpen(false);\n setQuery(\"\");\n setHighlightedIndex(0);\n }, []);\n\n const openDropdown = React.useCallback(() => {\n if (disabled) return;\n setOpen(true);\n setHighlightedIndex(0);\n }, [disabled]);\n\n const commitSingleValue = React.useCallback(\n (value: string) => {\n if (!multiple) {\n onSingleChange?.(value);\n close();\n }\n },\n [close, multiple, onSingleChange],\n );\n\n const toggleMultipleValue = React.useCallback(\n (value: string) => {\n if (!multiple || !onMultipleChange) return;\n\n onMultipleChange(\n selectedValues.includes(value)\n ? selectedValues.filter((item) => item !== value)\n : [...selectedValues, value],\n );\n setQuery(\"\");\n setHighlightedIndex(0);\n },\n [multiple, onMultipleChange, selectedValues],\n );\n\n const commitCustomValues = React.useCallback(\n (raw: string) => {\n if (!creatable) return;\n\n if (!multiple) {\n const value = raw.trim();\n if (!value) return;\n commitSingleValue(value);\n return;\n }\n\n if (!onMultipleChange) return;\n const tokens = parseTagTokens(raw);\n if (!tokens.length) return;\n const next = [...selectedValues];\n for (const token of tokens) {\n if (!next.includes(token)) next.push(token);\n }\n onMultipleChange(next);\n setQuery(\"\");\n setHighlightedIndex(0);\n },\n [commitSingleValue, creatable, multiple, onMultipleChange, selectedValues],\n );\n\n const removeValue = React.useCallback(\n (value: string) => {\n if (!multiple || !onMultipleChange) return;\n onMultipleChange(selectedValues.filter((item) => item !== value));\n window.requestAnimationFrame(() => inputRef.current?.focus());\n },\n [multiple, onMultipleChange, selectedValues],\n );\n\n const selectOption = React.useCallback(\n (option: AutocompleteOption) => {\n if (option.disabled) return;\n\n ignoreBlurRef.current = true;\n window.setTimeout(() => {\n ignoreBlurRef.current = false;\n }, 0);\n\n if (multiple) {\n toggleMultipleValue(option.value);\n window.requestAnimationFrame(() => inputRef.current?.focus());\n return;\n }\n\n commitSingleValue(option.value);\n },\n [commitSingleValue, multiple, toggleMultipleValue],\n );\n\n const selectHighlighted = React.useCallback(() => {\n const option = filteredOptions[safeHighlightedIndex];\n if (!option) return;\n selectOption(option);\n }, [filteredOptions, safeHighlightedIndex, selectOption]);\n\n React.useEffect(() => {\n if (!open) return;\n\n function handlePointerDown(event: PointerEvent) {\n const target = event.target as Node;\n // The list is portalled to the body, so containment has to be checked\n // against both halves or picking an option would close the control\n // before the choice registered.\n if (\n containerRef.current?.contains(target) ||\n dropdownRef.current?.contains(target)\n ) {\n return;\n }\n close();\n }\n\n document.addEventListener(\"pointerdown\", handlePointerDown);\n return () => document.removeEventListener(\"pointerdown\", handlePointerDown);\n }, [close, open]);\n\n /*\n The list is measured against the viewport and rendered in a portal.\n\n Anchored inside the control it was clipped by whatever `overflow` ancestor\n happened to be above it — inside a dialog body that is the scroll region,\n so the last field on a form showed one row of a six-hundred-row list. It\n opens downward when there is room, upward when there is not, and shrinks to\n what is left when neither side can take the whole list.\n */\n React.useLayoutEffect(() => {\n // Not cleared on close: the render is gated on `open`, and the layout\n // effect recomputes before the next paint, so a stale value is never seen.\n if (!open) return;\n\n const update = () => {\n const anchor = containerRef.current;\n if (!anchor) return;\n const rect = anchor.getBoundingClientRect();\n const below =\n window.innerHeight - rect.bottom - ANCHOR_GAP - VIEWPORT_MARGIN;\n const above = rect.top - ANCHOR_GAP - VIEWPORT_MARGIN;\n const flip =\n below < Math.min(PREFERRED_LIST_HEIGHT, MIN_LIST_HEIGHT) &&\n above > below;\n const room = flip ? above : below;\n const width = Math.max(rect.width, size === \"compact\" ? 220 : 0);\n const left = Math.max(\n VIEWPORT_MARGIN,\n Math.min(rect.left, window.innerWidth - width - VIEWPORT_MARGIN),\n );\n setPosition({\n left,\n width,\n maxHeight: Math.max(\n MIN_LIST_HEIGHT,\n Math.min(PREFERRED_LIST_HEIGHT, room),\n ),\n ...(flip\n ? { bottom: window.innerHeight - rect.top + ANCHOR_GAP }\n : { top: rect.bottom + ANCHOR_GAP }),\n });\n };\n\n update();\n // Capture, so a scroll in any ancestor — the dialog body included — moves\n // the list with its control instead of leaving it behind.\n window.addEventListener(\"scroll\", update, true);\n window.addEventListener(\"resize\", update);\n return () => {\n window.removeEventListener(\"scroll\", update, true);\n window.removeEventListener(\"resize\", update);\n };\n }, [open, size]);\n\n React.useEffect(() => {\n if (!open || !listRef.current) return;\n\n const highlighted = listRef.current.children[safeHighlightedIndex] as\n HTMLElement | undefined;\n\n highlighted?.scrollIntoView({ block: \"nearest\" });\n }, [safeHighlightedIndex, open]);\n\n function handleInputKeyDown(event: React.KeyboardEvent<HTMLInputElement>) {\n if (disabled) return;\n\n switch (event.key) {\n case \"ArrowDown\":\n event.preventDefault();\n if (!open) {\n openDropdown();\n return;\n }\n setHighlightedIndex(\n Math.min(safeHighlightedIndex + 1, filteredOptions.length - 1),\n );\n break;\n case \"ArrowUp\":\n event.preventDefault();\n if (!open) {\n openDropdown();\n return;\n }\n setHighlightedIndex(Math.max(safeHighlightedIndex - 1, 0));\n break;\n case \"Enter\":\n event.preventDefault();\n if (creatable && query.trim()) {\n // A single-value control filters its list as you type, so a match\n // is what Enter means there; only an unmatched query is taken as a\n // new value. Tags have no such list to defer to.\n if (multiple || filteredOptions.length === 0) {\n commitCustomValues(query);\n return;\n }\n }\n if (!open) {\n openDropdown();\n return;\n }\n selectHighlighted();\n break;\n case \",\":\n if (creatable && multiple && query.trim()) {\n event.preventDefault();\n commitCustomValues(query);\n }\n break;\n case \"Escape\":\n event.preventDefault();\n close();\n break;\n case \"Backspace\":\n if (multiple && query.length === 0 && selectedValues.length > 0) {\n event.preventDefault();\n removeValue(selectedValues[selectedValues.length - 1]);\n }\n break;\n case \"Tab\":\n close();\n break;\n default:\n break;\n }\n }\n\n const displayValue =\n !multiple && !open && !query && selectedValues[0]\n ? getOptionLabel(options, selectedValues[0])\n : query;\n\n const inputPlaceholder =\n multiple && selectedValues.length > 0 ? \"\" : placeholder;\n\n const createLabel = query.trim();\n const canCreate =\n creatable && Boolean(createLabel) && !selectedValues.includes(createLabel);\n\n const listboxId = id ? `${id}-listbox` : undefined;\n\n return (\n <div\n ref={containerRef}\n className={cn(\n \"relative\",\n size === \"compact\" ? \"w-auto min-w-24\" : \"w-full\",\n className,\n )}\n >\n <div\n className={cn(\n \"border-border bg-background flex w-full cursor-pointer items-center rounded-md border transition-colors\",\n \"focus-within:border-ring focus-within:ring-ring/30 focus-within:ring-2\",\n size === \"compact\"\n ? \"min-h-0 gap-0.5 border-transparent bg-transparent px-1 py-0.5 text-xs shadow-none\"\n : \"min-h-9 gap-1.5 px-2 py-1.5 text-sm shadow-sm\",\n disabled && \"cursor-not-allowed opacity-50\",\n open && \"border-ring ring-ring/30 ring-2\",\n )}\n onPointerDown={(event) => {\n if (disabled) return;\n if ((event.target as HTMLElement).closest(\"[data-option]\")) return;\n if ((event.target as HTMLElement).closest(\"[data-chip-remove]\"))\n return;\n\n if (!(event.target as HTMLElement).closest(\"input\")) {\n event.preventDefault();\n inputRef.current?.focus();\n }\n\n openDropdown();\n }}\n >\n {size === \"compact\" ? null : (\n <Search className=\"text-muted-foreground size-4 shrink-0\" />\n )}\n\n <div className=\"flex min-w-0 flex-1 flex-wrap items-center gap-1\">\n {multiple &&\n selectedValues.map((value) => (\n <span\n key={value}\n className=\"bg-primary/10 text-primary inline-flex max-w-full items-center gap-1 rounded-md px-2 py-0.5 text-xs font-medium\"\n >\n <span className=\"truncate\">\n {getOptionLabel(options, value)}\n </span>\n <button\n type=\"button\"\n data-chip-remove\n className=\"text-primary/70 hover:bg-primary/15 hover:text-primary rounded-sm transition\"\n onPointerDown={(event) => {\n event.preventDefault();\n event.stopPropagation();\n removeValue(value);\n }}\n aria-label={`Remove ${getOptionLabel(options, value)}`}\n >\n <X className=\"size-3\" />\n </button>\n </span>\n ))}\n\n <input\n ref={inputRef}\n id={id}\n type=\"text\"\n role=\"combobox\"\n aria-label={ariaLabel}\n aria-expanded={open}\n aria-controls={listboxId}\n aria-autocomplete=\"list\"\n disabled={disabled}\n value={displayValue}\n placeholder={inputPlaceholder}\n className={cn(\n \"placeholder:text-muted-foreground flex-1 bg-transparent outline-none\",\n size === \"compact\" ? \"min-w-0\" : \"min-w-[6rem]\",\n )}\n onFocus={openDropdown}\n onBlur={() => {\n if (ignoreBlurRef.current) return;\n close();\n }}\n onChange={(event) => {\n setQuery(event.target.value);\n setHighlightedIndex(0);\n if (!open) setOpen(true);\n }}\n onKeyDown={handleInputKeyDown}\n onPaste={(event) => {\n if (!creatable || !multiple) return;\n const text = event.clipboardData.getData(\"text\");\n if (!/[\\s,]/.test(text)) return;\n event.preventDefault();\n commitCustomValues(text);\n }}\n />\n </div>\n\n {clearable && !multiple && selectedValues[0] && !disabled && (\n <button\n type=\"button\"\n className=\"text-muted-foreground hover:bg-muted hover:text-foreground rounded-sm p-0.5 transition\"\n onPointerDown={(event) => {\n event.preventDefault();\n event.stopPropagation();\n onSingleChange?.(\"\");\n setQuery(\"\");\n inputRef.current?.focus();\n }}\n aria-label=\"Clear selection\"\n >\n <X className=\"size-3.5\" />\n </button>\n )}\n\n <ChevronDown\n className={cn(\n \"text-muted-foreground shrink-0 transition-transform\",\n size === \"compact\" ? \"size-3\" : \"size-4\",\n open && \"rotate-180\",\n )}\n />\n </div>\n\n {open && mounted && position\n ? createPortal(\n <div\n ref={dropdownRef}\n data-autocomplete-dropdown\n style={{\n position: \"fixed\",\n left: position.left,\n width: position.width,\n top: position.top,\n bottom: position.bottom,\n // Above the modal shell (z-100) it is usually opened inside.\n zIndex: 200,\n }}\n className=\"border-border bg-background overflow-hidden rounded-md border shadow-lg\"\n >\n <ul\n ref={listRef}\n id={listboxId}\n role=\"listbox\"\n aria-multiselectable={multiple || undefined}\n className=\"overflow-y-auto p-1\"\n style={{ maxHeight: position.maxHeight }}\n >\n {filteredOptions.length === 0 && !canCreate ? (\n <li className=\"text-muted-foreground px-3 py-6 text-center text-sm\">\n {emptyMessage}\n </li>\n ) : (\n <>\n {filteredOptions.map((option, index) => {\n const isSelected = selectedValues.includes(option.value);\n const isHighlighted = index === safeHighlightedIndex;\n\n return (\n <li\n key={option.value}\n data-option\n role=\"option\"\n aria-selected={isSelected}\n aria-disabled={option.disabled || undefined}\n className={cn(\n \"flex cursor-pointer items-center gap-2 rounded-sm transition-colors\",\n size === \"compact\"\n ? \"px-2 py-1 text-xs\"\n : \"px-2.5 py-2 text-sm\",\n isHighlighted && \"bg-muted\",\n option.disabled && \"cursor-not-allowed opacity-50\",\n )}\n onMouseEnter={() => setHighlightedIndex(index)}\n onPointerDown={(event) => {\n event.preventDefault();\n event.stopPropagation();\n selectOption(option);\n }}\n >\n {multiple ? (\n <span\n className={cn(\n \"border-border flex size-4 shrink-0 items-center justify-center rounded border\",\n isSelected &&\n \"border-primary bg-primary text-primary-foreground\",\n )}\n >\n {isSelected ? <Check className=\"size-3\" /> : null}\n </span>\n ) : (\n <Check\n className={cn(\n \"text-primary size-4 shrink-0\",\n isSelected ? \"opacity-100\" : \"opacity-0\",\n )}\n />\n )}\n <span className=\"truncate\">{option.label}</span>\n </li>\n );\n })}\n {canCreate ? (\n <li\n data-option\n role=\"option\"\n aria-selected={false}\n className=\"hover:bg-muted flex cursor-pointer items-center gap-2 rounded-sm px-2.5 py-2 text-sm transition-colors\"\n onPointerDown={(event) => {\n event.preventDefault();\n event.stopPropagation();\n ignoreBlurRef.current = true;\n window.setTimeout(() => {\n ignoreBlurRef.current = false;\n }, 0);\n commitCustomValues(query);\n window.requestAnimationFrame(() =>\n inputRef.current?.focus(),\n );\n }}\n >\n Add “{createLabel}”\n </li>\n ) : null}\n </>\n )}\n </ul>\n </div>,\n document.body,\n )\n : null}\n </div>\n );\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport { createPortal } from \"react-dom\";\n\nimport { useDialogLayer } from \"./dialogLayer\";\nimport { cn } from \"./utils\";\n\nconst emptySubscribe = () => () => {};\n\n/**\n * Returns false during SSR and the first client render, then true once mounted.\n * `useSyncExternalStore` is the React-recommended way to read client-only state\n * without a setState-in-effect (which triggers cascading renders).\n */\nexport function useHasMounted(): boolean {\n return React.useSyncExternalStore(\n emptySubscribe,\n () => true,\n () => false,\n );\n}\n\ninterface ModalProps {\n isOpen: boolean;\n /** id of the element labelling the dialog; wired to aria-labelledby. */\n labelledBy: string;\n /**\n * Optional id(s) of elements describing the dialog (APG alertdialog body).\n * Space-separated when multiple.\n */\n describedBy?: string;\n /** Accessible label for the backdrop dismiss button. */\n closeLabel: string;\n onClose: () => void;\n children: React.ReactNode;\n /**\n * When false, Escape and backdrop clicks do not close the modal (e.g. while a\n * save is in flight). Defaults to true.\n */\n dismissible?: boolean;\n /** Use \"alertdialog\" for destructive confirmations. Defaults to \"dialog\". */\n role?: \"dialog\" | \"alertdialog\";\n /** Tailwind max-width class for the panel. Defaults to \"max-w-md\". */\n panelClassName?: string;\n}\n\n/**\n * Shared modal shell: renders a portal-backed, scroll-locked, Escape-dismissible\n * overlay with a centered panel. Callers provide the panel body (heading, form,\n * footer). Consolidates the boilerplate previously copied across every dialog.\n */\nexport function Modal({\n isOpen,\n labelledBy,\n describedBy,\n closeLabel,\n onClose,\n children,\n dismissible = true,\n role = \"dialog\",\n panelClassName,\n}: ModalProps) {\n const mounted = useHasMounted();\n const panelRef = React.useRef<HTMLDivElement>(null);\n\n useDialogLayer({\n // Gated on `mounted` too: before that the panel is not rendered, so there\n // would be nothing to move focus into.\n active: isOpen && mounted,\n containerRef: panelRef,\n onEscape: dismissible ? onClose : undefined,\n });\n\n if (!mounted || !isOpen) return null;\n\n return createPortal(\n /*\n `overflow-y-auto` on the overlay, `my-auto` on the panel — not\n `items-center`. A flex item centred with `align-items` overflows equally\n in both directions once it is taller than its container, and the half\n above the top edge cannot be scrolled to: with the page behind it locked,\n an over-tall dialog was simply unreachable at both ends. Auto margins\n centre a short panel the same way and collapse to zero on a tall one,\n which scrolls.\n */\n <div className=\"fixed inset-0 z-[100] flex justify-center overflow-y-auto p-4\">\n {/* `fixed`, not `absolute`: inside a scrolling overlay an absolute\n backdrop scrolls away with the content and leaves the rest of a tall\n dialog sitting on an undimmed page. */}\n <button\n type=\"button\"\n aria-label={closeLabel}\n tabIndex={-1}\n className=\"fixed inset-0 bg-slate-950/50\"\n onClick={() => {\n if (dismissible) onClose();\n }}\n />\n <div\n ref={panelRef}\n role={role}\n aria-modal=\"true\"\n aria-labelledby={labelledBy}\n aria-describedby={describedBy}\n tabIndex={-1}\n className={cn(\n \"border-border bg-background relative z-10 my-auto w-full rounded-lg border shadow-2xl outline-none\",\n panelClassName ?? \"max-w-md p-6\",\n )}\n >\n {children}\n </div>\n </div>,\n document.body,\n );\n}\n","import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,IAAAA,SAAuB;AACvB,IAAAC,oBAA6B;AAC7B,0BAA8C;;;ACF9C,YAAuB;AACvB,uBAA6B;;;ACH7B,kBAAsC;AACtC,4BAAwB;AAEjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;;;ADiFI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA9EJ,IAAM,iBAAiB,MAAM,MAAM;AAAC;AAO7B,SAAS,gBAAyB;AACv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KAAK;AACxB,iCAAO;AAAA,4BAAsB,MAC3B,SAAS,SAAS,MAAM;AAAA,0BAC1B;AAAA,wBACF;AAAA,wBACD;AAAA;AAAA,0BACO;AAAA,0BAAY;AAAA;AAAA;AAAA,oBACpB,IACE;AAAA,qBACN;AAAA;AAAA,cAEJ;AAAA;AAAA,UACF;AAAA,UACA,SAAS;AAAA,QACX,IACA;AAAA;AAAA;AAAA,EACN;AAEJ;","names":["React","import_react_dom","import_jsx_runtime"]}
1
+ {"version":3,"sources":["../src/autocomplete.tsx","../src/modal.tsx","../src/utils.ts"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { Check, ChevronDown, Search, X } from \"lucide-react\";\n\nimport { useHasMounted } from \"./modal\";\nimport { cn } from \"./utils\";\n\n/** Room the list wants below the control before it gives up and flips. */\nconst PREFERRED_LIST_HEIGHT = 224;\n/** Below this there is no point opening downward at all. */\nconst MIN_LIST_HEIGHT = 120;\nconst VIEWPORT_MARGIN = 8;\nconst ANCHOR_GAP = 4;\n\ntype DropdownPosition = {\n left: number;\n width: number;\n maxHeight: number;\n /** One of the two is set: `top` opens downward, `bottom` opens upward. */\n top?: number;\n bottom?: number;\n};\n\nexport type AutocompleteOption = {\n value: string;\n label: string;\n disabled?: boolean;\n};\n\ntype BaseAutocompleteProps = {\n options: AutocompleteOption[];\n placeholder?: string;\n disabled?: boolean;\n className?: string;\n emptyMessage?: string;\n id?: string;\n /**\n * Accessible name for the combobox.\n *\n * `Field` renders its label as a `<span>`, so without this the control is\n * announced as an unnamed combobox and cannot be queried by name — the\n * filter toolbars work around it by counting comboboxes on the page.\n */\n ariaLabel?: string;\n /**\n * `compact` is the spreadsheet cell: no search icon, no min height, and a\n * list wide enough to read a name. The closed control still shows the\n * chosen label, and typing filters the list.\n */\n size?: \"default\" | \"compact\";\n /**\n * Type a value and press Enter (or paste a list) to add it, like antd\n * `Select mode=\"tags\"`. With `multiple` a pasted list is split into several\n * values; on a single-value control it accepts one typed value the options\n * do not offer — an id for a record the list has not loaded, say.\n */\n creatable?: boolean;\n /**\n * Shows the clear button once a value is chosen. Off for dropdowns that\n * always keep one of their options, where clearing would blank a required\n * field.\n */\n clearable?: boolean;\n};\n\ntype SingleAutocompleteProps = BaseAutocompleteProps & {\n multiple?: false;\n value: string;\n onChange: (value: string) => void;\n};\n\ntype MultipleAutocompleteProps = BaseAutocompleteProps & {\n multiple: true;\n value: string[];\n onChange: (value: string[]) => void;\n};\n\nexport type AutocompleteProps =\n SingleAutocompleteProps | MultipleAutocompleteProps;\n\nfunction normalizeQuery(query: string) {\n return query.trim().toLowerCase();\n}\n\nfunction filterOptions(options: AutocompleteOption[], query: string) {\n const normalized = normalizeQuery(query);\n if (!normalized) return options;\n\n return options.filter(\n (option) =>\n option.label.toLowerCase().includes(normalized) ||\n option.value.toLowerCase().includes(normalized),\n );\n}\n\nfunction getOptionLabel(options: AutocompleteOption[], value: string) {\n return options.find((option) => option.value === value)?.label ?? value;\n}\n\nfunction parseTagTokens(raw: string): string[] {\n const seen = new Set<string>();\n const tokens: string[] = [];\n for (const part of raw.split(/[\\s,]+/)) {\n const token = part.trim();\n if (!token || seen.has(token)) continue;\n seen.add(token);\n tokens.push(token);\n }\n return tokens;\n}\n\nexport function Autocomplete(props: AutocompleteProps) {\n const {\n options,\n placeholder = \"Search…\",\n disabled = false,\n className,\n emptyMessage = \"No results found\",\n id,\n ariaLabel,\n size = \"default\",\n creatable = false,\n clearable = true,\n } = props;\n\n const multiple = props.multiple ?? false;\n const singleValue = multiple\n ? undefined\n : (props as SingleAutocompleteProps).value;\n const multipleValue = multiple\n ? (props as MultipleAutocompleteProps).value\n : undefined;\n\n // Memoized so dependent callbacks below keep stable identities across renders.\n const selectedValues = React.useMemo<string[]>(() => {\n if (multiple) return multipleValue ?? [];\n return singleValue ? [singleValue] : [];\n }, [multiple, multipleValue, singleValue]);\n\n const onSingleChange = !multiple\n ? (props as SingleAutocompleteProps).onChange\n : undefined;\n const onMultipleChange = multiple\n ? (props as MultipleAutocompleteProps).onChange\n : undefined;\n\n const containerRef = React.useRef<HTMLDivElement>(null);\n const dropdownRef = React.useRef<HTMLDivElement>(null);\n const inputRef = React.useRef<HTMLInputElement>(null);\n const listRef = React.useRef<HTMLUListElement>(null);\n const ignoreBlurRef = React.useRef(false);\n\n const mounted = useHasMounted();\n const [open, setOpen] = React.useState(false);\n const [position, setPosition] = React.useState<DropdownPosition | null>(null);\n const [query, setQuery] = React.useState(\"\");\n const [highlightedIndex, setHighlightedIndex] = React.useState(0);\n\n const filteredOptions = React.useMemo(\n () => filterOptions(options, query),\n [options, query],\n );\n\n // Clamp during render instead of via a setState-in-effect: if the option list\n // shrinks below the stored index, fall back to the last valid row.\n const safeHighlightedIndex =\n highlightedIndex >= filteredOptions.length\n ? Math.max(filteredOptions.length - 1, 0)\n : highlightedIndex;\n\n const close = React.useCallback(() => {\n setOpen(false);\n setQuery(\"\");\n setHighlightedIndex(0);\n }, []);\n\n const openDropdown = React.useCallback(() => {\n if (disabled) return;\n setOpen(true);\n setHighlightedIndex(0);\n }, [disabled]);\n\n const commitSingleValue = React.useCallback(\n (value: string) => {\n if (!multiple) {\n onSingleChange?.(value);\n close();\n }\n },\n [close, multiple, onSingleChange],\n );\n\n const toggleMultipleValue = React.useCallback(\n (value: string) => {\n if (!multiple || !onMultipleChange) return;\n\n onMultipleChange(\n selectedValues.includes(value)\n ? selectedValues.filter((item) => item !== value)\n : [...selectedValues, value],\n );\n setQuery(\"\");\n setHighlightedIndex(0);\n },\n [multiple, onMultipleChange, selectedValues],\n );\n\n const commitCustomValues = React.useCallback(\n (raw: string) => {\n if (!creatable) return;\n\n if (!multiple) {\n const value = raw.trim();\n if (!value) return;\n commitSingleValue(value);\n return;\n }\n\n if (!onMultipleChange) return;\n const tokens = parseTagTokens(raw);\n if (!tokens.length) return;\n const next = [...selectedValues];\n for (const token of tokens) {\n if (!next.includes(token)) next.push(token);\n }\n onMultipleChange(next);\n setQuery(\"\");\n setHighlightedIndex(0);\n },\n [commitSingleValue, creatable, multiple, onMultipleChange, selectedValues],\n );\n\n const removeValue = React.useCallback(\n (value: string) => {\n if (!multiple || !onMultipleChange) return;\n onMultipleChange(selectedValues.filter((item) => item !== value));\n window.requestAnimationFrame(() => inputRef.current?.focus());\n },\n [multiple, onMultipleChange, selectedValues],\n );\n\n const selectOption = React.useCallback(\n (option: AutocompleteOption) => {\n if (option.disabled) return;\n\n ignoreBlurRef.current = true;\n window.setTimeout(() => {\n ignoreBlurRef.current = false;\n }, 0);\n\n if (multiple) {\n toggleMultipleValue(option.value);\n window.requestAnimationFrame(() => inputRef.current?.focus());\n return;\n }\n\n commitSingleValue(option.value);\n },\n [commitSingleValue, multiple, toggleMultipleValue],\n );\n\n const selectHighlighted = React.useCallback(() => {\n const option = filteredOptions[safeHighlightedIndex];\n if (!option) return;\n selectOption(option);\n }, [filteredOptions, safeHighlightedIndex, selectOption]);\n\n React.useEffect(() => {\n if (!open) return;\n\n function handlePointerDown(event: PointerEvent) {\n const target = event.target as Node;\n // The list is portalled to the body, so containment has to be checked\n // against both halves or picking an option would close the control\n // before the choice registered.\n if (\n containerRef.current?.contains(target) ||\n dropdownRef.current?.contains(target)\n ) {\n return;\n }\n close();\n }\n\n document.addEventListener(\"pointerdown\", handlePointerDown);\n return () => document.removeEventListener(\"pointerdown\", handlePointerDown);\n }, [close, open]);\n\n /*\n The list is measured against the viewport and rendered in a portal.\n\n Anchored inside the control it was clipped by whatever `overflow` ancestor\n happened to be above it — inside a dialog body that is the scroll region,\n so the last field on a form showed one row of a six-hundred-row list. It\n opens downward when there is room, upward when there is not, and shrinks to\n what is left when neither side can take the whole list.\n */\n React.useLayoutEffect(() => {\n // Not cleared on close: the render is gated on `open`, and the layout\n // effect recomputes before the next paint, so a stale value is never seen.\n if (!open) return;\n\n const update = () => {\n const anchor = containerRef.current;\n if (!anchor) return;\n const rect = anchor.getBoundingClientRect();\n const below =\n window.innerHeight - rect.bottom - ANCHOR_GAP - VIEWPORT_MARGIN;\n const above = rect.top - ANCHOR_GAP - VIEWPORT_MARGIN;\n const flip =\n below < Math.min(PREFERRED_LIST_HEIGHT, MIN_LIST_HEIGHT) &&\n above > below;\n const room = flip ? above : below;\n const width = Math.max(rect.width, size === \"compact\" ? 220 : 0);\n const left = Math.max(\n VIEWPORT_MARGIN,\n Math.min(rect.left, window.innerWidth - width - VIEWPORT_MARGIN),\n );\n setPosition({\n left,\n width,\n maxHeight: Math.max(\n MIN_LIST_HEIGHT,\n Math.min(PREFERRED_LIST_HEIGHT, room),\n ),\n ...(flip\n ? { bottom: window.innerHeight - rect.top + ANCHOR_GAP }\n : { top: rect.bottom + ANCHOR_GAP }),\n });\n };\n\n update();\n // Capture, so a scroll in any ancestor — the dialog body included — moves\n // the list with its control instead of leaving it behind.\n window.addEventListener(\"scroll\", update, true);\n window.addEventListener(\"resize\", update);\n return () => {\n window.removeEventListener(\"scroll\", update, true);\n window.removeEventListener(\"resize\", update);\n };\n }, [open, size]);\n\n React.useEffect(() => {\n if (!open || !listRef.current) return;\n\n const highlighted = listRef.current.children[safeHighlightedIndex] as\n HTMLElement | undefined;\n\n highlighted?.scrollIntoView({ block: \"nearest\" });\n }, [safeHighlightedIndex, open]);\n\n function handleInputKeyDown(event: React.KeyboardEvent<HTMLInputElement>) {\n if (disabled) return;\n\n switch (event.key) {\n case \"ArrowDown\":\n event.preventDefault();\n if (!open) {\n openDropdown();\n return;\n }\n setHighlightedIndex(\n Math.min(safeHighlightedIndex + 1, filteredOptions.length - 1),\n );\n break;\n case \"ArrowUp\":\n event.preventDefault();\n if (!open) {\n openDropdown();\n return;\n }\n setHighlightedIndex(Math.max(safeHighlightedIndex - 1, 0));\n break;\n case \"Enter\":\n event.preventDefault();\n if (creatable && query.trim()) {\n // A single-value control filters its list as you type, so a match\n // is what Enter means there; only an unmatched query is taken as a\n // new value. Tags have no such list to defer to.\n if (multiple || filteredOptions.length === 0) {\n commitCustomValues(query);\n return;\n }\n }\n if (!open) {\n openDropdown();\n return;\n }\n selectHighlighted();\n break;\n case \",\":\n if (creatable && multiple && query.trim()) {\n event.preventDefault();\n commitCustomValues(query);\n }\n break;\n case \"Escape\":\n event.preventDefault();\n close();\n break;\n case \"Backspace\":\n if (multiple && query.length === 0 && selectedValues.length > 0) {\n event.preventDefault();\n removeValue(selectedValues[selectedValues.length - 1]);\n }\n break;\n case \"Tab\":\n close();\n break;\n default:\n break;\n }\n }\n\n const displayValue =\n !multiple && !open && !query && selectedValues[0]\n ? getOptionLabel(options, selectedValues[0])\n : query;\n\n const inputPlaceholder =\n multiple && selectedValues.length > 0 ? \"\" : placeholder;\n\n const createLabel = query.trim();\n const canCreate =\n creatable && Boolean(createLabel) && !selectedValues.includes(createLabel);\n\n const listboxId = id ? `${id}-listbox` : undefined;\n\n return (\n <div\n ref={containerRef}\n className={cn(\n \"relative\",\n size === \"compact\" ? \"w-auto min-w-24\" : \"w-full\",\n className,\n )}\n >\n <div\n className={cn(\n \"border-border bg-background flex w-full cursor-pointer items-center rounded-md border transition-colors\",\n \"focus-within:border-ring focus-within:ring-ring/30 focus-within:ring-2\",\n size === \"compact\"\n ? \"min-h-0 gap-0.5 border-transparent bg-transparent px-1 py-0.5 text-xs shadow-none\"\n : \"min-h-9 gap-1.5 px-2 py-1.5 text-sm shadow-sm\",\n disabled && \"cursor-not-allowed opacity-50\",\n open && \"border-ring ring-ring/30 ring-2\",\n )}\n onPointerDown={(event) => {\n if (disabled) return;\n if ((event.target as HTMLElement).closest(\"[data-option]\")) return;\n if ((event.target as HTMLElement).closest(\"[data-chip-remove]\"))\n return;\n\n if (!(event.target as HTMLElement).closest(\"input\")) {\n event.preventDefault();\n inputRef.current?.focus();\n }\n\n openDropdown();\n }}\n >\n {size === \"compact\" ? null : (\n <Search className=\"text-muted-foreground size-4 shrink-0\" />\n )}\n\n <div className=\"flex min-w-0 flex-1 flex-wrap items-center gap-1\">\n {multiple &&\n selectedValues.map((value) => (\n <span\n key={value}\n className=\"bg-primary/10 text-primary inline-flex max-w-full items-center gap-1 rounded-md px-2 py-0.5 text-xs font-medium\"\n >\n <span className=\"truncate\">\n {getOptionLabel(options, value)}\n </span>\n <button\n type=\"button\"\n data-chip-remove\n className=\"text-primary/70 hover:bg-primary/15 hover:text-primary rounded-sm transition\"\n onPointerDown={(event) => {\n event.preventDefault();\n event.stopPropagation();\n removeValue(value);\n }}\n aria-label={`Remove ${getOptionLabel(options, value)}`}\n >\n <X className=\"size-3\" />\n </button>\n </span>\n ))}\n\n <input\n ref={inputRef}\n id={id}\n type=\"text\"\n role=\"combobox\"\n aria-label={ariaLabel}\n aria-expanded={open}\n aria-controls={listboxId}\n aria-autocomplete=\"list\"\n disabled={disabled}\n value={displayValue}\n placeholder={inputPlaceholder}\n className={cn(\n \"placeholder:text-muted-foreground flex-1 bg-transparent outline-none\",\n size === \"compact\" ? \"min-w-0\" : \"min-w-[6rem]\",\n )}\n onFocus={openDropdown}\n onBlur={() => {\n if (ignoreBlurRef.current) return;\n close();\n }}\n onChange={(event) => {\n setQuery(event.target.value);\n setHighlightedIndex(0);\n if (!open) setOpen(true);\n }}\n onKeyDown={handleInputKeyDown}\n onPaste={(event) => {\n if (!creatable || !multiple) return;\n const text = event.clipboardData.getData(\"text\");\n if (!/[\\s,]/.test(text)) return;\n event.preventDefault();\n commitCustomValues(text);\n }}\n />\n </div>\n\n {clearable && !multiple && selectedValues[0] && !disabled && (\n <button\n type=\"button\"\n className=\"text-muted-foreground hover:bg-muted hover:text-foreground rounded-sm p-0.5 transition\"\n onPointerDown={(event) => {\n event.preventDefault();\n event.stopPropagation();\n onSingleChange?.(\"\");\n setQuery(\"\");\n inputRef.current?.focus();\n }}\n aria-label=\"Clear selection\"\n >\n <X className=\"size-3.5\" />\n </button>\n )}\n\n <ChevronDown\n className={cn(\n \"text-muted-foreground shrink-0 transition-transform\",\n size === \"compact\" ? \"size-3\" : \"size-4\",\n open && \"rotate-180\",\n )}\n />\n </div>\n\n {open && mounted && position\n ? createPortal(\n <div\n ref={dropdownRef}\n data-autocomplete-dropdown\n style={{\n position: \"fixed\",\n left: position.left,\n width: position.width,\n top: position.top,\n bottom: position.bottom,\n // Above the modal shell (z-100) it is usually opened inside.\n zIndex: 200,\n }}\n className=\"border-border bg-background overflow-hidden rounded-md border shadow-lg\"\n >\n <ul\n ref={listRef}\n id={listboxId}\n role=\"listbox\"\n aria-multiselectable={multiple || undefined}\n className=\"overflow-y-auto p-1\"\n style={{ maxHeight: position.maxHeight }}\n >\n {filteredOptions.length === 0 && !canCreate ? (\n <li className=\"text-muted-foreground px-3 py-6 text-center text-sm\">\n {emptyMessage}\n </li>\n ) : (\n <>\n {filteredOptions.map((option, index) => {\n const isSelected = selectedValues.includes(option.value);\n const isHighlighted = index === safeHighlightedIndex;\n\n return (\n <li\n key={option.value}\n data-option\n role=\"option\"\n aria-selected={isSelected}\n aria-disabled={option.disabled || undefined}\n className={cn(\n \"flex cursor-pointer items-center gap-2 rounded-sm transition-colors\",\n size === \"compact\"\n ? \"px-2 py-1 text-xs\"\n : \"px-2.5 py-2 text-sm\",\n isHighlighted && \"bg-muted\",\n option.disabled && \"cursor-not-allowed opacity-50\",\n )}\n onMouseEnter={() => setHighlightedIndex(index)}\n onPointerDown={(event) => {\n event.preventDefault();\n event.stopPropagation();\n selectOption(option);\n }}\n >\n {multiple ? (\n <span\n className={cn(\n \"border-border flex size-4 shrink-0 items-center justify-center rounded border\",\n isSelected &&\n \"border-primary bg-primary text-primary-foreground\",\n )}\n >\n {isSelected ? <Check className=\"size-3\" /> : null}\n </span>\n ) : (\n <Check\n className={cn(\n \"text-primary size-4 shrink-0\",\n isSelected ? \"opacity-100\" : \"opacity-0\",\n )}\n />\n )}\n <span className=\"truncate\">{option.label}</span>\n </li>\n );\n })}\n {canCreate ? (\n <li\n data-option\n role=\"option\"\n aria-selected={false}\n className=\"hover:bg-muted flex cursor-pointer items-center gap-2 rounded-sm px-2.5 py-2 text-sm transition-colors\"\n onPointerDown={(event) => {\n event.preventDefault();\n event.stopPropagation();\n ignoreBlurRef.current = true;\n window.setTimeout(() => {\n ignoreBlurRef.current = false;\n }, 0);\n commitCustomValues(query);\n window.requestAnimationFrame(() =>\n inputRef.current?.focus(),\n );\n }}\n >\n Add “{createLabel}”\n </li>\n ) : null}\n </>\n )}\n </ul>\n </div>,\n document.body,\n )\n : null}\n </div>\n );\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport { createPortal } from \"react-dom\";\n\nimport { useDialogLayer } from \"./dialogLayer\";\nimport { cn } from \"./utils\";\n\nconst emptySubscribe = () => () => {};\n\n/**\n * Returns false during SSR and the first client render, then true once mounted.\n * `useSyncExternalStore` is the React-recommended way to read client-only state\n * without a setState-in-effect (which triggers cascading renders).\n */\nexport function useHasMounted(): boolean {\n return React.useSyncExternalStore(\n emptySubscribe,\n () => true,\n () => false,\n );\n}\n\ninterface ModalProps {\n isOpen: boolean;\n /** id of the element labelling the dialog; wired to aria-labelledby. */\n labelledBy: string;\n /**\n * Optional id(s) of elements describing the dialog (APG alertdialog body).\n * Space-separated when multiple.\n */\n describedBy?: string;\n /** Accessible label for the backdrop dismiss button. */\n closeLabel: string;\n onClose: () => void;\n children: React.ReactNode;\n /**\n * When false, Escape and backdrop clicks do not close the modal (e.g. while a\n * save is in flight). Defaults to true.\n */\n dismissible?: boolean;\n /** Use \"alertdialog\" for destructive confirmations. Defaults to \"dialog\". */\n role?: \"dialog\" | \"alertdialog\";\n /** Tailwind max-width class for the panel. Defaults to \"max-w-md\". */\n panelClassName?: string;\n}\n\n/**\n * Shared modal shell: renders a portal-backed, scroll-locked, Escape-dismissible\n * overlay with a centered panel. Callers provide the panel body (heading, form,\n * footer). Consolidates the boilerplate previously copied across every dialog.\n */\nexport function Modal({\n isOpen,\n labelledBy,\n describedBy,\n closeLabel,\n onClose,\n children,\n dismissible = true,\n role = \"dialog\",\n panelClassName,\n}: ModalProps) {\n const mounted = useHasMounted();\n const panelRef = React.useRef<HTMLDivElement>(null);\n\n useDialogLayer({\n // Gated on `mounted` too: before that the panel is not rendered, so there\n // would be nothing to move focus into.\n active: isOpen && mounted,\n containerRef: panelRef,\n onEscape: dismissible ? onClose : undefined,\n });\n\n if (!mounted || !isOpen) return null;\n\n return createPortal(\n /*\n `overflow-y-auto` on the overlay, `my-auto` on the panel — not\n `items-center`. A flex item centred with `align-items` overflows equally\n in both directions once it is taller than its container, and the half\n above the top edge cannot be scrolled to: with the page behind it locked,\n an over-tall dialog was simply unreachable at both ends. Auto margins\n centre a short panel the same way and collapse to zero on a tall one,\n which scrolls.\n */\n <div className=\"fixed inset-0 z-[100] flex justify-center overflow-y-auto p-4\">\n {/* `fixed`, not `absolute`: inside a scrolling overlay an absolute\n backdrop scrolls away with the content and leaves the rest of a tall\n dialog sitting on an undimmed page. */}\n <button\n type=\"button\"\n aria-label={closeLabel}\n tabIndex={-1}\n className=\"fixed inset-0 bg-overlay/50\"\n onClick={() => {\n if (dismissible) onClose();\n }}\n />\n <div\n ref={panelRef}\n role={role}\n aria-modal=\"true\"\n aria-labelledby={labelledBy}\n aria-describedby={describedBy}\n tabIndex={-1}\n className={cn(\n \"border-border bg-background relative z-10 my-auto w-full rounded-lg border shadow-2xl outline-none\",\n panelClassName ?? \"max-w-md p-6\",\n )}\n >\n {children}\n </div>\n </div>,\n document.body,\n );\n}\n","import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,IAAAA,SAAuB;AACvB,IAAAC,oBAA6B;AAC7B,0BAA8C;;;ACF9C,YAAuB;AACvB,uBAA6B;;;ACH7B,kBAAsC;AACtC,4BAAwB;AAEjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;;;ADiFI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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,UAAU;AACxB,iCAAO,WAAW,MAAM;AACtB,0CAAc,UAAU;AAAA,0BAC1B,GAAG,CAAC;AACJ,6CAAmB,KAAK;AACxB,iCAAO;AAAA,4BAAsB,MAC3B,SAAS,SAAS,MAAM;AAAA,0BAC1B;AAAA,wBACF;AAAA,wBACD;AAAA;AAAA,0BACO;AAAA,0BAAY;AAAA;AAAA;AAAA,oBACpB,IACE;AAAA,qBACN;AAAA;AAAA,cAEJ;AAAA;AAAA,UACF;AAAA,UACA,SAAS;AAAA,QACX,IACA;AAAA;AAAA;AAAA,EACN;AAEJ;","names":["React","import_react_dom","import_jsx_runtime"]}
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import {
3
3
  Autocomplete
4
- } from "./chunk-PVK4WQJZ.js";
5
- import "./chunk-YSU4VWRD.js";
4
+ } from "./chunk-5MEOZHJA.js";
5
+ import "./chunk-DS3QYIKL.js";
6
6
  import "./chunk-HBBOR43A.js";
7
7
  import "./chunk-HCA5ODCD.js";
8
8
  export {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useHasMounted
3
- } from "./chunk-YSU4VWRD.js";
3
+ } from "./chunk-DS3QYIKL.js";
4
4
  import {
5
5
  cn
6
6
  } from "./chunk-HCA5ODCD.js";
@@ -510,4 +510,4 @@ function Autocomplete(props) {
510
510
  export {
511
511
  Autocomplete
512
512
  };
513
- //# sourceMappingURL=chunk-PVK4WQJZ.js.map
513
+ //# sourceMappingURL=chunk-5MEOZHJA.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useHasMounted
3
- } from "./chunk-YSU4VWRD.js";
3
+ } from "./chunk-DS3QYIKL.js";
4
4
  import {
5
5
  useDialogLayer
6
6
  } from "./chunk-HBBOR43A.js";
@@ -41,7 +41,7 @@ function SideDrawer({
41
41
  {
42
42
  "aria-hidden": true,
43
43
  onClick: onClose,
44
- className: "fixed inset-0 z-[90] bg-slate-950/30"
44
+ className: "fixed inset-0 z-[90] bg-overlay/30"
45
45
  }
46
46
  ),
47
47
  /* @__PURE__ */ jsxs(
@@ -82,4 +82,4 @@ function SideDrawer({
82
82
  export {
83
83
  SideDrawer
84
84
  };
85
- //# sourceMappingURL=chunk-43ZUFY63.js.map
85
+ //# sourceMappingURL=chunk-A6GRLKOO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/side-drawer.tsx"],"sourcesContent":["\"use client\";\n\nimport { X } from \"lucide-react\";\nimport * as React from \"react\";\nimport { createPortal } from \"react-dom\";\n\nimport { Button } from \"./button\";\nimport { useDialogLayer } from \"./dialogLayer\";\nimport { useHasMounted } from \"./modal\";\nimport { cn } from \"./utils\";\n\ninterface SideDrawerProps {\n isOpen: boolean;\n title: string;\n onClose: () => void;\n children: React.ReactNode;\n /** Tailwind width class for the panel. Defaults to a reading-width column. */\n panelClassName?: string;\n}\n\n/**\n * A panel that slides in from the right.\n *\n * For content that belongs beside the page rather than on top of it — a queue\n * you glance at and dismiss, not a decision you have to answer. Unlike\n * `Modal`, it does not centre or dim the whole page to a stop: the table\n * underneath stays readable, which is the point of looking at both.\n */\nexport function SideDrawer({\n isOpen,\n title,\n onClose,\n children,\n panelClassName,\n}: SideDrawerProps) {\n const mounted = useHasMounted();\n const headingId = React.useId();\n const panelRef = React.useRef<HTMLElement>(null);\n\n useDialogLayer({\n // Gated on `mounted` too: before that the panel is not rendered, so there\n // would be nothing to move focus into.\n active: isOpen && mounted,\n containerRef: panelRef,\n onEscape: onClose,\n });\n\n if (!mounted || !isOpen) return null;\n\n return createPortal(\n <>\n <div\n aria-hidden\n onClick={onClose}\n className=\"fixed inset-0 z-[90] bg-overlay/30\"\n />\n <aside\n ref={panelRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={headingId}\n tabIndex={-1}\n className={cn(\n \"border-border bg-background fixed inset-y-0 right-0 z-[95] flex flex-col border-l shadow-2xl outline-none\",\n panelClassName ?? \"w-full max-w-md\",\n )}\n >\n <div className=\"border-border flex items-center justify-between gap-3 border-b px-4 py-3\">\n <h2 id={headingId} className=\"truncate text-base font-semibold\">\n {title}\n </h2>\n <Button\n variant=\"ghost\"\n size=\"icon\"\n aria-label=\"Close panel\"\n onClick={onClose}\n >\n <X className=\"h-4 w-4\" aria-hidden />\n </Button>\n </div>\n\n <div className=\"min-h-0 flex-1 overflow-y-auto p-4\">{children}</div>\n </aside>\n </>,\n document.body,\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAEA,SAAS,SAAS;AAClB,YAAY,WAAW;AACvB,SAAS,oBAAoB;AA8CzB,mBACE,KAgBE,YAjBJ;AAtBG,SAAS,WAAW;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAoB;AAClB,QAAM,UAAU,cAAc;AAC9B,QAAM,YAAkB,YAAM;AAC9B,QAAM,WAAiB,aAAoB,IAAI;AAE/C,iBAAe;AAAA;AAAA;AAAA,IAGb,QAAQ,UAAU;AAAA,IAClB,cAAc;AAAA,IACd,UAAU;AAAA,EACZ,CAAC;AAED,MAAI,CAAC,WAAW,CAAC,OAAQ,QAAO;AAEhC,SAAO;AAAA,IACL,iCACE;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,eAAW;AAAA,UACX,SAAS;AAAA,UACT,WAAU;AAAA;AAAA,MACZ;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,KAAK;AAAA,UACL,MAAK;AAAA,UACL,cAAW;AAAA,UACX,mBAAiB;AAAA,UACjB,UAAU;AAAA,UACV,WAAW;AAAA,YACT;AAAA,YACA,kBAAkB;AAAA,UACpB;AAAA,UAEA;AAAA,iCAAC,SAAI,WAAU,4EACb;AAAA,kCAAC,QAAG,IAAI,WAAW,WAAU,oCAC1B,iBACH;AAAA,cACA;AAAA,gBAAC;AAAA;AAAA,kBACC,SAAQ;AAAA,kBACR,MAAK;AAAA,kBACL,cAAW;AAAA,kBACX,SAAS;AAAA,kBAET,8BAAC,KAAE,WAAU,WAAU,eAAW,MAAC;AAAA;AAAA,cACrC;AAAA,eACF;AAAA,YAEA,oBAAC,SAAI,WAAU,sCAAsC,UAAS;AAAA;AAAA;AAAA,MAChE;AAAA,OACF;AAAA,IACA,SAAS;AAAA,EACX;AACF;","names":[]}
@@ -56,7 +56,7 @@ function Modal({
56
56
  type: "button",
57
57
  "aria-label": closeLabel,
58
58
  tabIndex: -1,
59
- className: "fixed inset-0 bg-slate-950/50",
59
+ className: "fixed inset-0 bg-overlay/50",
60
60
  onClick: () => {
61
61
  if (dismissible) onClose();
62
62
  }
@@ -87,4 +87,4 @@ export {
87
87
  useHasMounted,
88
88
  Modal
89
89
  };
90
- //# sourceMappingURL=chunk-YSU4VWRD.js.map
90
+ //# sourceMappingURL=chunk-DS3QYIKL.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/modal.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { createPortal } from \"react-dom\";\n\nimport { useDialogLayer } from \"./dialogLayer\";\nimport { cn } from \"./utils\";\n\nconst emptySubscribe = () => () => {};\n\n/**\n * Returns false during SSR and the first client render, then true once mounted.\n * `useSyncExternalStore` is the React-recommended way to read client-only state\n * without a setState-in-effect (which triggers cascading renders).\n */\nexport function useHasMounted(): boolean {\n return React.useSyncExternalStore(\n emptySubscribe,\n () => true,\n () => false,\n );\n}\n\ninterface ModalProps {\n isOpen: boolean;\n /** id of the element labelling the dialog; wired to aria-labelledby. */\n labelledBy: string;\n /**\n * Optional id(s) of elements describing the dialog (APG alertdialog body).\n * Space-separated when multiple.\n */\n describedBy?: string;\n /** Accessible label for the backdrop dismiss button. */\n closeLabel: string;\n onClose: () => void;\n children: React.ReactNode;\n /**\n * When false, Escape and backdrop clicks do not close the modal (e.g. while a\n * save is in flight). Defaults to true.\n */\n dismissible?: boolean;\n /** Use \"alertdialog\" for destructive confirmations. Defaults to \"dialog\". */\n role?: \"dialog\" | \"alertdialog\";\n /** Tailwind max-width class for the panel. Defaults to \"max-w-md\". */\n panelClassName?: string;\n}\n\n/**\n * Shared modal shell: renders a portal-backed, scroll-locked, Escape-dismissible\n * overlay with a centered panel. Callers provide the panel body (heading, form,\n * footer). Consolidates the boilerplate previously copied across every dialog.\n */\nexport function Modal({\n isOpen,\n labelledBy,\n describedBy,\n closeLabel,\n onClose,\n children,\n dismissible = true,\n role = \"dialog\",\n panelClassName,\n}: ModalProps) {\n const mounted = useHasMounted();\n const panelRef = React.useRef<HTMLDivElement>(null);\n\n useDialogLayer({\n // Gated on `mounted` too: before that the panel is not rendered, so there\n // would be nothing to move focus into.\n active: isOpen && mounted,\n containerRef: panelRef,\n onEscape: dismissible ? onClose : undefined,\n });\n\n if (!mounted || !isOpen) return null;\n\n return createPortal(\n /*\n `overflow-y-auto` on the overlay, `my-auto` on the panel — not\n `items-center`. A flex item centred with `align-items` overflows equally\n in both directions once it is taller than its container, and the half\n above the top edge cannot be scrolled to: with the page behind it locked,\n an over-tall dialog was simply unreachable at both ends. Auto margins\n centre a short panel the same way and collapse to zero on a tall one,\n which scrolls.\n */\n <div className=\"fixed inset-0 z-[100] flex justify-center overflow-y-auto p-4\">\n {/* `fixed`, not `absolute`: inside a scrolling overlay an absolute\n backdrop scrolls away with the content and leaves the rest of a tall\n dialog sitting on an undimmed page. */}\n <button\n type=\"button\"\n aria-label={closeLabel}\n tabIndex={-1}\n className=\"fixed inset-0 bg-slate-950/50\"\n onClick={() => {\n if (dismissible) onClose();\n }}\n />\n <div\n ref={panelRef}\n role={role}\n aria-modal=\"true\"\n aria-labelledby={labelledBy}\n aria-describedby={describedBy}\n tabIndex={-1}\n className={cn(\n \"border-border bg-background relative z-10 my-auto w-full rounded-lg border shadow-2xl outline-none\",\n panelClassName ?? \"max-w-md p-6\",\n )}\n >\n {children}\n </div>\n </div>,\n document.body,\n );\n}\n"],"mappings":";;;;;;;;AAEA,YAAY,WAAW;AACvB,SAAS,oBAAoB;AAmFzB,SAIE,KAJF;AA9EJ,IAAM,iBAAiB,MAAM,MAAM;AAAC;AAO7B,SAAS,gBAAyB;AACvC,SAAa;AAAA,IACX;AAAA,IACA,MAAM;AAAA,IACN,MAAM;AAAA,EACR;AACF;AA+BO,SAAS,MAAM;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd,OAAO;AAAA,EACP;AACF,GAAe;AACb,QAAM,UAAU,cAAc;AAC9B,QAAM,WAAiB,aAAuB,IAAI;AAElD,iBAAe;AAAA;AAAA;AAAA,IAGb,QAAQ,UAAU;AAAA,IAClB,cAAc;AAAA,IACd,UAAU,cAAc,UAAU;AAAA,EACpC,CAAC;AAED,MAAI,CAAC,WAAW,CAAC,OAAQ,QAAO;AAEhC,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAUL,qBAAC,SAAI,WAAU,iEAIb;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,cAAY;AAAA,UACZ,UAAU;AAAA,UACV,WAAU;AAAA,UACV,SAAS,MAAM;AACb,gBAAI,YAAa,SAAQ;AAAA,UAC3B;AAAA;AAAA,MACF;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,KAAK;AAAA,UACL;AAAA,UACA,cAAW;AAAA,UACX,mBAAiB;AAAA,UACjB,oBAAkB;AAAA,UAClB,UAAU;AAAA,UACV,WAAW;AAAA,YACT;AAAA,YACA,kBAAkB;AAAA,UACpB;AAAA,UAEC;AAAA;AAAA,MACH;AAAA,OACF;AAAA,IACA,SAAS;AAAA,EACX;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/modal.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { createPortal } from \"react-dom\";\n\nimport { useDialogLayer } from \"./dialogLayer\";\nimport { cn } from \"./utils\";\n\nconst emptySubscribe = () => () => {};\n\n/**\n * Returns false during SSR and the first client render, then true once mounted.\n * `useSyncExternalStore` is the React-recommended way to read client-only state\n * without a setState-in-effect (which triggers cascading renders).\n */\nexport function useHasMounted(): boolean {\n return React.useSyncExternalStore(\n emptySubscribe,\n () => true,\n () => false,\n );\n}\n\ninterface ModalProps {\n isOpen: boolean;\n /** id of the element labelling the dialog; wired to aria-labelledby. */\n labelledBy: string;\n /**\n * Optional id(s) of elements describing the dialog (APG alertdialog body).\n * Space-separated when multiple.\n */\n describedBy?: string;\n /** Accessible label for the backdrop dismiss button. */\n closeLabel: string;\n onClose: () => void;\n children: React.ReactNode;\n /**\n * When false, Escape and backdrop clicks do not close the modal (e.g. while a\n * save is in flight). Defaults to true.\n */\n dismissible?: boolean;\n /** Use \"alertdialog\" for destructive confirmations. Defaults to \"dialog\". */\n role?: \"dialog\" | \"alertdialog\";\n /** Tailwind max-width class for the panel. Defaults to \"max-w-md\". */\n panelClassName?: string;\n}\n\n/**\n * Shared modal shell: renders a portal-backed, scroll-locked, Escape-dismissible\n * overlay with a centered panel. Callers provide the panel body (heading, form,\n * footer). Consolidates the boilerplate previously copied across every dialog.\n */\nexport function Modal({\n isOpen,\n labelledBy,\n describedBy,\n closeLabel,\n onClose,\n children,\n dismissible = true,\n role = \"dialog\",\n panelClassName,\n}: ModalProps) {\n const mounted = useHasMounted();\n const panelRef = React.useRef<HTMLDivElement>(null);\n\n useDialogLayer({\n // Gated on `mounted` too: before that the panel is not rendered, so there\n // would be nothing to move focus into.\n active: isOpen && mounted,\n containerRef: panelRef,\n onEscape: dismissible ? onClose : undefined,\n });\n\n if (!mounted || !isOpen) return null;\n\n return createPortal(\n /*\n `overflow-y-auto` on the overlay, `my-auto` on the panel — not\n `items-center`. A flex item centred with `align-items` overflows equally\n in both directions once it is taller than its container, and the half\n above the top edge cannot be scrolled to: with the page behind it locked,\n an over-tall dialog was simply unreachable at both ends. Auto margins\n centre a short panel the same way and collapse to zero on a tall one,\n which scrolls.\n */\n <div className=\"fixed inset-0 z-[100] flex justify-center overflow-y-auto p-4\">\n {/* `fixed`, not `absolute`: inside a scrolling overlay an absolute\n backdrop scrolls away with the content and leaves the rest of a tall\n dialog sitting on an undimmed page. */}\n <button\n type=\"button\"\n aria-label={closeLabel}\n tabIndex={-1}\n className=\"fixed inset-0 bg-overlay/50\"\n onClick={() => {\n if (dismissible) onClose();\n }}\n />\n <div\n ref={panelRef}\n role={role}\n aria-modal=\"true\"\n aria-labelledby={labelledBy}\n aria-describedby={describedBy}\n tabIndex={-1}\n className={cn(\n \"border-border bg-background relative z-10 my-auto w-full rounded-lg border shadow-2xl outline-none\",\n panelClassName ?? \"max-w-md p-6\",\n )}\n >\n {children}\n </div>\n </div>,\n document.body,\n );\n}\n"],"mappings":";;;;;;;;AAEA,YAAY,WAAW;AACvB,SAAS,oBAAoB;AAmFzB,SAIE,KAJF;AA9EJ,IAAM,iBAAiB,MAAM,MAAM;AAAC;AAO7B,SAAS,gBAAyB;AACvC,SAAa;AAAA,IACX;AAAA,IACA,MAAM;AAAA,IACN,MAAM;AAAA,EACR;AACF;AA+BO,SAAS,MAAM;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd,OAAO;AAAA,EACP;AACF,GAAe;AACb,QAAM,UAAU,cAAc;AAC9B,QAAM,WAAiB,aAAuB,IAAI;AAElD,iBAAe;AAAA;AAAA;AAAA,IAGb,QAAQ,UAAU;AAAA,IAClB,cAAc;AAAA,IACd,UAAU,cAAc,UAAU;AAAA,EACpC,CAAC;AAED,MAAI,CAAC,WAAW,CAAC,OAAQ,QAAO;AAEhC,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAUL,qBAAC,SAAI,WAAU,iEAIb;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,cAAY;AAAA,UACZ,UAAU;AAAA,UACV,WAAU;AAAA,UACV,SAAS,MAAM;AACb,gBAAI,YAAa,SAAQ;AAAA,UAC3B;AAAA;AAAA,MACF;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,KAAK;AAAA,UACL;AAAA,UACA,cAAW;AAAA,UACX,mBAAiB;AAAA,UACjB,oBAAkB;AAAA,UAClB,UAAU;AAAA,UACV,WAAW;AAAA,YACT;AAAA,YACA,kBAAkB;AAAA,UACpB;AAAA,UAEC;AAAA;AAAA,MACH;AAAA,OACF;AAAA,IACA,SAAS;AAAA,EACX;AACF;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Modal
3
- } from "./chunk-YSU4VWRD.js";
3
+ } from "./chunk-DS3QYIKL.js";
4
4
  import {
5
5
  Button
6
6
  } from "./chunk-KR3BCFP7.js";
@@ -67,4 +67,4 @@ function ConfirmDialog({
67
67
  export {
68
68
  ConfirmDialog
69
69
  };
70
- //# sourceMappingURL=chunk-WVNRFO5F.js.map
70
+ //# sourceMappingURL=chunk-ISPICB4W.js.map
@@ -5,15 +5,11 @@ import {
5
5
  // src/segmented-control.tsx
6
6
  import * as React from "react";
7
7
  import { jsx } from "react/jsx-runtime";
8
+ var TONE_ON = "bg-primary text-primary-foreground";
9
+ var TONE_OFF = "text-muted-foreground hover:bg-muted";
8
10
  var TONES = {
9
- emphasis: {
10
- on: "bg-slate-950 text-white dark:bg-white dark:text-slate-950",
11
- off: "text-muted-foreground hover:bg-muted"
12
- },
13
- primary: {
14
- on: "bg-primary text-primary-foreground",
15
- off: "text-muted-foreground hover:bg-muted"
16
- }
11
+ emphasis: { on: TONE_ON, off: TONE_OFF },
12
+ primary: { on: TONE_ON, off: TONE_OFF }
17
13
  };
18
14
  var TRACKS = {
19
15
  contained: "border-border inline-flex rounded-md border p-0.5",
@@ -82,4 +78,4 @@ function SegmentedControl({
82
78
  export {
83
79
  SegmentedControl
84
80
  };
85
- //# sourceMappingURL=chunk-ASU6CUTZ.js.map
81
+ //# sourceMappingURL=chunk-MLRSOTFI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/segmented-control.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nimport { cn } from \"./utils\";\n\n/**\n * The one-of-N picker seven panels were each drawing by hand.\n *\n * Not `Tabs`, which is a bottom-bordered strip sitting above the content it\n * switches. This is the inline version — a bordered track with the selected\n * option filled in — used for a filter or a setting that sits among other\n * controls rather than heading a panel.\n *\n * **Roles are the reason to use this.** The seven copies had three different\n * ideas about what they were: one said `tablist`/`tab`, one said\n * `group`/`aria-pressed`, and the other five said nothing at all — so on five\n * of seven a screen reader heard a row of unlabelled buttons with no\n * indication which one was active. None of the three was right. `tablist`\n * without a `tabpanel` is a promise the markup does not keep, and\n * `aria-pressed` describes independent toggles, not a choice of one. Picking a\n * value out of a fixed set is a radio group, so that is what this is, with the\n * roving tabindex and arrow keys that come with the role.\n *\n * `tone` is kept for call-site compatibility. Both `emphasis` and `primary`\n * resolve to `bg-primary text-primary-foreground` — neutral brand primary is\n * already the ink fill five panels used, and a raw `slate-950` utility would\n * escape brand recoloring. Prefer `primary` in new code.\n */\nexport interface SegmentedOption<Value extends string> {\n value: Value;\n label: React.ReactNode;\n disabled?: boolean;\n /**\n * Hover text. Worth setting on a disabled option — \"Everyone\" going grey\n * says nothing about which permission would bring it back.\n */\n title?: string;\n}\n\nexport interface SegmentedControlProps<Value extends string> {\n options: ReadonlyArray<SegmentedOption<Value>>;\n value: Value;\n onChange: (value: Value) => void;\n /**\n * Required: the group never has a visible label — the options name the\n * choice between them, which tells you nothing about what is being chosen.\n */\n ariaLabel: string;\n /**\n * `contained` — one bordered track around the options (five panels).\n * `loose` — free-standing pills with a gap between them (two panels).\n */\n variant?: \"contained\" | \"loose\";\n /** Prefer `primary`. `emphasis` is an alias kept for existing call sites. */\n tone?: \"emphasis\" | \"primary\";\n /** Options share the width equally, for a control that fills its column. */\n fill?: boolean;\n className?: string;\n}\n\nconst TONE_ON = \"bg-primary text-primary-foreground\";\nconst TONE_OFF = \"text-muted-foreground hover:bg-muted\";\n\nconst TONES = {\n emphasis: { on: TONE_ON, off: TONE_OFF },\n primary: { on: TONE_ON, off: TONE_OFF },\n} as const;\n\nconst TRACKS = {\n contained: \"border-border inline-flex rounded-md border p-0.5\",\n loose: \"flex flex-wrap gap-2\",\n} as const;\n\nexport function SegmentedControl<Value extends string>({\n options,\n value,\n onChange,\n ariaLabel,\n variant = \"contained\",\n tone = \"emphasis\",\n fill = false,\n className,\n}: SegmentedControlProps<Value>) {\n const refs = React.useRef(new Map<Value, HTMLButtonElement | null>());\n\n function onKeyDown(event: React.KeyboardEvent<HTMLDivElement>) {\n const step =\n event.key === \"ArrowRight\" || event.key === \"ArrowDown\"\n ? 1\n : event.key === \"ArrowLeft\" || event.key === \"ArrowUp\"\n ? -1\n : 0;\n if (step === 0) return;\n\n const selectable = options.filter((option) => !option.disabled);\n if (selectable.length < 2) return;\n\n const current = selectable.findIndex((option) => option.value === value);\n // Wraps, which is what a radio group is expected to do.\n const next =\n selectable[(current + step + selectable.length) % selectable.length];\n\n event.preventDefault();\n onChange(next.value);\n // The newly checked option has to take focus, or the next arrow press is\n // still measured from the old one.\n refs.current.get(next.value)?.focus();\n }\n\n return (\n <div\n role=\"radiogroup\"\n aria-label={ariaLabel}\n onKeyDown={onKeyDown}\n className={cn(TRACKS[variant], className)}\n >\n {options.map((option) => {\n const checked = option.value === value;\n return (\n <button\n key={option.value}\n ref={(node) => {\n refs.current.set(option.value, node);\n }}\n type=\"button\"\n role=\"radio\"\n aria-checked={checked}\n disabled={option.disabled}\n title={option.title}\n // Only the checked option is reachable by Tab; arrows move within\n // the group. Without this a keyboard user pages through every\n // option to get past the control.\n tabIndex={checked ? 0 : -1}\n onClick={() => onChange(option.value)}\n className={cn(\n \"cursor-pointer rounded px-3 py-1 text-sm font-medium transition\",\n \"focus-visible:ring-ring focus-visible:ring-2 focus-visible:outline-none\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n fill && \"flex-1\",\n checked ? TONES[tone].on : TONES[tone].off,\n )}\n >\n {option.label}\n </button>\n );\n })}\n </div>\n );\n}\n"],"mappings":";;;;;AAEA,YAAY,WAAW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A,YACL,gBAAc;AAAA,YACd,UAAU,OAAO;AAAA,YACjB,OAAO,OAAO;AAAA,YAId,UAAU,UAAU,IAAI;AAAA,YACxB,SAAS,MAAM,SAAS,OAAO,KAAK;AAAA,YACpC,WAAW;AAAA,cACT;AAAA,cACA;AAAA,cACA;AAAA,cACA,QAAQ;AAAA,cACR,UAAU,MAAM,IAAI,EAAE,KAAK,MAAM,IAAI,EAAE;AAAA,YACzC;AAAA,YAEC,iBAAO;AAAA;AAAA,UAtBH,OAAO;AAAA,QAuBd;AAAA,MAEJ,CAAC;AAAA;AAAA,EACH;AAEJ;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Autocomplete
3
- } from "./chunk-PVK4WQJZ.js";
3
+ } from "./chunk-5MEOZHJA.js";
4
4
 
5
5
  // src/select.tsx
6
6
  import * as React from "react";
@@ -73,4 +73,4 @@ function Select({
73
73
  export {
74
74
  Select
75
75
  };
76
- //# sourceMappingURL=chunk-6URKHMCF.js.map
76
+ //# sourceMappingURL=chunk-OUYT6SPU.js.map
@@ -278,7 +278,7 @@ function Modal({
278
278
  type: "button",
279
279
  "aria-label": closeLabel,
280
280
  tabIndex: -1,
281
- className: "fixed inset-0 bg-slate-950/50",
281
+ className: "fixed inset-0 bg-overlay/50",
282
282
  onClick: () => {
283
283
  if (dismissible) onClose();
284
284
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/confirm-dialog.tsx","../src/button.tsx","../src/spinner.tsx","../src/utils.ts","../src/modal.tsx","../src/dialogLayer.ts"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nimport { Button } from \"./button\";\nimport { Modal } from \"./modal\";\n\ninterface ConfirmDialogProps {\n isOpen: boolean;\n title: string;\n description?: React.ReactNode;\n confirmLabel?: string;\n cancelLabel?: string;\n isConfirming?: boolean;\n error?: string | null;\n onConfirm: () => void;\n onClose: () => void;\n}\n\nexport function ConfirmDialog({\n isOpen,\n title,\n description,\n confirmLabel = \"Delete\",\n cancelLabel = \"Cancel\",\n isConfirming,\n error,\n onConfirm,\n onClose,\n}: ConfirmDialogProps) {\n const titleId = React.useId();\n const descriptionId = React.useId();\n const errorId = React.useId();\n\n const describedBy = [\n description ? descriptionId : null,\n error ? errorId : null,\n ]\n .filter(Boolean)\n .join(\" \");\n\n return (\n <Modal\n isOpen={isOpen}\n role=\"alertdialog\"\n labelledBy={titleId}\n describedBy={describedBy || undefined}\n closeLabel=\"Close dialog\"\n onClose={onClose}\n >\n <h3 id={titleId} className=\"text-lg font-semibold\">\n {title}\n </h3>\n {description ? (\n <div id={descriptionId} className=\"text-muted-foreground mt-2 text-sm\">\n {description}\n </div>\n ) : null}\n\n {error ? (\n <div\n id={errorId}\n role=\"alert\"\n className=\"border-destructive/30 bg-destructive/5 text-destructive mt-4 rounded-lg border px-3 py-2 text-sm\"\n >\n {error}\n </div>\n ) : null}\n\n <div className=\"mt-6 flex justify-end gap-2\">\n <Button variant=\"outline\" onClick={onClose} disabled={isConfirming}>\n {cancelLabel}\n </Button>\n <Button\n variant=\"destructive\"\n onClick={onConfirm}\n loading={isConfirming}\n >\n {confirmLabel}\n </Button>\n </div>\n </Modal>\n );\n}\n","import * as React from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\nimport { Spinner } from \"./spinner\";\nimport { cn } from \"./utils\";\n\nconst buttonVariants = cva(\n \"inline-flex h-9 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-md px-3 text-sm font-medium transition duration-200 active:scale-[0.98] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n secondary: \"bg-muted text-foreground hover:bg-muted/80\",\n ghost: \"hover:bg-muted\",\n destructive:\n \"bg-destructive text-destructive-foreground hover:bg-destructive/90\",\n outline: \"border border-border bg-background hover:bg-muted\",\n },\n size: {\n sm: \"h-8 px-2.5\",\n md: \"h-9 px-3\",\n lg: \"h-10 px-4\",\n icon: \"h-9 w-9 px-0\",\n // Square, matching `sm`'s height — for an icon-only control sitting in\n // a table row or beside `sm` buttons, where `icon` is a row taller.\n \"icon-sm\": \"h-8 w-8 px-0\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"md\",\n },\n },\n);\n\nexport interface ButtonProps\n extends\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean;\n /**\n * Work is in flight: shows a spinner, disables the button, and sets\n * `aria-busy`.\n *\n * This exists because the panel had 272 disabled buttons and only 22 that\n * said anything about why — the rest went dead on click with no spinner and\n * no label change, which reads as a broken button rather than a busy one.\n * Making the feedback part of `disabled` rather than something each caller\n * remembers separately is the only way that ratio stays fixed.\n *\n * The label is kept rather than swapped. \"Saving…\" loses which button you\n * pressed, and the spinner already says it is working. An icon-only button\n * is the exception — there is no room beside the glyph, so the spinner takes\n * its place; the `aria-label` is what names the button either way.\n *\n * \"Icon-only\" means an icon `size`. A square button that grew a spinner\n * beside its glyph would not just look wrong, it would resize mid-request\n * and shove whatever sits next to it sideways.\n */\n loading?: boolean;\n}\n\n/** Sizes with no room for a spinner beside the glyph. */\nconst ICON_SIZES = new Set<string>([\"icon\", \"icon-sm\"]);\n\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n className,\n variant,\n size,\n asChild = false,\n loading,\n disabled,\n children,\n ...props\n },\n ref,\n ) => {\n const Comp = asChild ? Slot : \"button\";\n\n // `asChild` renders someone else's element, which may not take a spinner or\n // a disabled attribute — so the busy treatment is only applied to a real\n // button, and passing both is a mistake worth not papering over.\n if (asChild) {\n return (\n <Comp\n ref={ref}\n className={cn(buttonVariants({ variant, size }), className)}\n {...props}\n >\n {children}\n </Comp>\n );\n }\n\n return (\n <button\n ref={ref}\n disabled={disabled || loading}\n aria-busy={loading || undefined}\n className={cn(buttonVariants({ variant, size }), className)}\n {...props}\n >\n {loading ? <Spinner size=\"sm\" /> : null}\n {loading && size != null && ICON_SIZES.has(size) ? null : children}\n </button>\n );\n },\n);\n\nButton.displayName = \"Button\";\n","import * as React from \"react\";\nimport { Loader2 } from \"lucide-react\";\n\nimport { cn } from \"./utils\";\n\n/**\n * The one spinner.\n *\n * There were five spellings of `animate-spin` across twelve files — `h-4 w-4`,\n * `h-5 w-5`, `size-4`, bare, and a hand-drawn ring in `ProtectedRoute` — so the\n * same \"working\" signal came out a different size depending on which panel you\n * were on.\n *\n * It is `aria-hidden` on purpose. A spinner is decoration; what a screen reader\n * needs is the surrounding control's `aria-busy` or the panel's status text,\n * and announcing \"loading\" twice is worse than once. `Button` and `StatePanel`\n * both supply that.\n */\nconst SIZES = {\n sm: \"size-3.5\",\n md: \"size-4\",\n lg: \"size-5\",\n xl: \"size-10 border-2\",\n} as const;\n\nexport interface SpinnerProps extends React.SVGProps<SVGSVGElement> {\n size?: keyof typeof SIZES;\n}\n\nexport function Spinner({ size = \"md\", className, ...props }: SpinnerProps) {\n return (\n <Loader2\n aria-hidden\n className={cn(\"animate-spin\", SIZES[size], className)}\n {...props}\n />\n );\n}\n","import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport { createPortal } from \"react-dom\";\n\nimport { useDialogLayer } from \"./dialogLayer\";\nimport { cn } from \"./utils\";\n\nconst emptySubscribe = () => () => {};\n\n/**\n * Returns false during SSR and the first client render, then true once mounted.\n * `useSyncExternalStore` is the React-recommended way to read client-only state\n * without a setState-in-effect (which triggers cascading renders).\n */\nexport function useHasMounted(): boolean {\n return React.useSyncExternalStore(\n emptySubscribe,\n () => true,\n () => false,\n );\n}\n\ninterface ModalProps {\n isOpen: boolean;\n /** id of the element labelling the dialog; wired to aria-labelledby. */\n labelledBy: string;\n /**\n * Optional id(s) of elements describing the dialog (APG alertdialog body).\n * Space-separated when multiple.\n */\n describedBy?: string;\n /** Accessible label for the backdrop dismiss button. */\n closeLabel: string;\n onClose: () => void;\n children: React.ReactNode;\n /**\n * When false, Escape and backdrop clicks do not close the modal (e.g. while a\n * save is in flight). Defaults to true.\n */\n dismissible?: boolean;\n /** Use \"alertdialog\" for destructive confirmations. Defaults to \"dialog\". */\n role?: \"dialog\" | \"alertdialog\";\n /** Tailwind max-width class for the panel. Defaults to \"max-w-md\". */\n panelClassName?: string;\n}\n\n/**\n * Shared modal shell: renders a portal-backed, scroll-locked, Escape-dismissible\n * overlay with a centered panel. Callers provide the panel body (heading, form,\n * footer). Consolidates the boilerplate previously copied across every dialog.\n */\nexport function Modal({\n isOpen,\n labelledBy,\n describedBy,\n closeLabel,\n onClose,\n children,\n dismissible = true,\n role = \"dialog\",\n panelClassName,\n}: ModalProps) {\n const mounted = useHasMounted();\n const panelRef = React.useRef<HTMLDivElement>(null);\n\n useDialogLayer({\n // Gated on `mounted` too: before that the panel is not rendered, so there\n // would be nothing to move focus into.\n active: isOpen && mounted,\n containerRef: panelRef,\n onEscape: dismissible ? onClose : undefined,\n });\n\n if (!mounted || !isOpen) return null;\n\n return createPortal(\n /*\n `overflow-y-auto` on the overlay, `my-auto` on the panel — not\n `items-center`. A flex item centred with `align-items` overflows equally\n in both directions once it is taller than its container, and the half\n above the top edge cannot be scrolled to: with the page behind it locked,\n an over-tall dialog was simply unreachable at both ends. Auto margins\n centre a short panel the same way and collapse to zero on a tall one,\n which scrolls.\n */\n <div className=\"fixed inset-0 z-[100] flex justify-center overflow-y-auto p-4\">\n {/* `fixed`, not `absolute`: inside a scrolling overlay an absolute\n backdrop scrolls away with the content and leaves the rest of a tall\n dialog sitting on an undimmed page. */}\n <button\n type=\"button\"\n aria-label={closeLabel}\n tabIndex={-1}\n className=\"fixed inset-0 bg-slate-950/50\"\n onClick={() => {\n if (dismissible) onClose();\n }}\n />\n <div\n ref={panelRef}\n role={role}\n aria-modal=\"true\"\n aria-labelledby={labelledBy}\n aria-describedby={describedBy}\n tabIndex={-1}\n className={cn(\n \"border-border bg-background relative z-10 my-auto w-full rounded-lg border shadow-2xl outline-none\",\n panelClassName ?? \"max-w-md p-6\",\n )}\n >\n {children}\n </div>\n </div>,\n document.body,\n );\n}\n","\"use client\";\n\nimport * as React from \"react\";\n\n/**\n * The keyboard and focus behaviour every dialog needs, in one place.\n *\n * `Modal` and `SideDrawer` each had a copy of the scroll lock and an Escape\n * handler, and neither did anything about focus: opening a dialog left focus\n * on the button behind it, Tab walked the page underneath — through the\n * full-screen backdrop button, among other things — and closing left focus\n * wherever it had wandered. That is the whole keyboard story for thirty\n * dialogs, so it is fixed once here rather than thirty times.\n */\n\n/**\n * Open dialogs, innermost last.\n *\n * Nesting is real here — \"Create audience group\" opens on top of \"Send\n * notification\" — and without an ordering both would answer the same Escape\n * and fight over the same Tab. Only the top layer acts.\n */\nconst layers: symbol[] = [];\n\nconst FOCUSABLE = [\n \"a[href]\",\n \"button:not([disabled])\",\n \"input:not([disabled])\",\n \"select:not([disabled])\",\n \"textarea:not([disabled])\",\n '[tabindex]:not([tabindex=\"-1\"])',\n].join(\",\");\n\n/**\n * Deliberately not `offsetParent` or `getClientRects`: the first is null for\n * anything `position: fixed`, which a dialog panel usually is, and the second\n * is empty for *everything* under a test renderer that does no layout — which\n * would collapse the trap to \"no focusable elements\" in every test.\n */\nfunction isVisible(element: HTMLElement): boolean {\n if (element.closest(\"[hidden]\")) return false;\n if (element.getAttribute(\"aria-hidden\") === \"true\") return false;\n return typeof element.checkVisibility === \"function\"\n ? element.checkVisibility()\n : true;\n}\n\nfunction focusableWithin(container: HTMLElement): HTMLElement[] {\n return Array.from(container.querySelectorAll<HTMLElement>(FOCUSABLE)).filter(\n isVisible,\n );\n}\n\nexport function useDialogLayer({\n active,\n containerRef,\n onEscape,\n}: {\n active: boolean;\n /** The panel. Focus is moved into it and kept inside it. */\n containerRef: React.RefObject<HTMLElement | null>;\n /** Called on Escape, only while this is the top layer. Omit to ignore it. */\n onEscape?: () => void;\n}): void {\n // Read through a ref so a caller passing a fresh closure every render does\n // not tear the listener down and rebuild it on every keystroke.\n const escapeRef = React.useRef(onEscape);\n React.useEffect(() => {\n escapeRef.current = onEscape;\n });\n\n React.useEffect(() => {\n if (!active) return;\n\n const layer = Symbol(\"dialog-layer\");\n layers.push(layer);\n const isTopLayer = () => layers[layers.length - 1] === layer;\n\n const previouslyFocused =\n document.activeElement instanceof HTMLElement\n ? document.activeElement\n : null;\n\n const container = containerRef.current;\n // Something inside may have claimed focus already — an `autoFocus` input —\n // and that choice is better than any this could make.\n if (container && !container.contains(document.activeElement)) {\n const [first] = focusableWithin(container);\n // The panel itself, not its first control: the first control is a Delete\n // button often enough that focusing it would put a destructive action\n // one Enter away from an accidental keypress.\n (container.hasAttribute(\"tabindex\") ? container : first)?.focus();\n }\n\n function handleKeyDown(event: KeyboardEvent) {\n if (!isTopLayer()) return;\n\n if (event.key === \"Escape\") {\n escapeRef.current?.();\n return;\n }\n\n if (event.key !== \"Tab\") return;\n const panel = containerRef.current;\n if (!panel) return;\n\n const items = focusableWithin(panel);\n if (items.length === 0) {\n event.preventDefault();\n panel.focus();\n return;\n }\n\n const first = items[0]!;\n const last = items[items.length - 1]!;\n const active = document.activeElement;\n const outside = !panel.contains(active);\n\n if (event.shiftKey && (active === first || outside)) {\n event.preventDefault();\n last.focus();\n } else if (!event.shiftKey && (active === last || outside)) {\n event.preventDefault();\n first.focus();\n }\n }\n\n document.addEventListener(\"keydown\", handleKeyDown);\n const previousOverflow = document.body.style.overflow;\n document.body.style.overflow = \"hidden\";\n\n return () => {\n document.removeEventListener(\"keydown\", handleKeyDown);\n document.body.style.overflow = previousOverflow;\n const index = layers.indexOf(layer);\n if (index !== -1) layers.splice(index, 1);\n // Back where it came from, so closing a dialog opened by keyboard does\n // not drop the caret at the top of the document.\n if (previouslyFocused?.isConnected) previouslyFocused.focus();\n };\n }, [active, containerRef]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;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AC,sBAAA;AA/BC,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAuB;AACrB,QAAM,UAAgB,aAAM;AAC5B,QAAM,gBAAsB,aAAM;AAClC,QAAM,UAAgB,aAAM;AAE5B,QAAM,cAAc;AAAA,IAClB,cAAc,gBAAgB;AAAA,IAC9B,QAAQ,UAAU;AAAA,EACpB,EACG,OAAO,OAAO,EACd,KAAK,GAAG;AAEX,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,MAAK;AAAA,MACL,YAAY;AAAA,MACZ,aAAa,eAAe;AAAA,MAC5B,YAAW;AAAA,MACX;AAAA,MAEA;AAAA,qDAAC,QAAG,IAAI,SAAS,WAAU,yBACxB,iBACH;AAAA,QACC,cACC,6CAAC,SAAI,IAAI,eAAe,WAAU,sCAC/B,uBACH,IACE;AAAA,QAEH,QACC;AAAA,UAAC;AAAA;AAAA,YACC,IAAI;AAAA,YACJ,MAAK;AAAA,YACL,WAAU;AAAA,YAET;AAAA;AAAA,QACH,IACE;AAAA,QAEJ,8CAAC,SAAI,WAAU,+BACb;AAAA,uDAAC,UAAO,SAAQ,WAAU,SAAS,SAAS,UAAU,cACnD,uBACH;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,SAAQ;AAAA,cACR,SAAS;AAAA,cACT,SAAS;AAAA,cAER;AAAA;AAAA,UACH;AAAA,WACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":["React","import_jsx_runtime","React","React","active","import_jsx_runtime","import_jsx_runtime"]}
1
+ {"version":3,"sources":["../src/confirm-dialog.tsx","../src/button.tsx","../src/spinner.tsx","../src/utils.ts","../src/modal.tsx","../src/dialogLayer.ts"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nimport { Button } from \"./button\";\nimport { Modal } from \"./modal\";\n\ninterface ConfirmDialogProps {\n isOpen: boolean;\n title: string;\n description?: React.ReactNode;\n confirmLabel?: string;\n cancelLabel?: string;\n isConfirming?: boolean;\n error?: string | null;\n onConfirm: () => void;\n onClose: () => void;\n}\n\nexport function ConfirmDialog({\n isOpen,\n title,\n description,\n confirmLabel = \"Delete\",\n cancelLabel = \"Cancel\",\n isConfirming,\n error,\n onConfirm,\n onClose,\n}: ConfirmDialogProps) {\n const titleId = React.useId();\n const descriptionId = React.useId();\n const errorId = React.useId();\n\n const describedBy = [\n description ? descriptionId : null,\n error ? errorId : null,\n ]\n .filter(Boolean)\n .join(\" \");\n\n return (\n <Modal\n isOpen={isOpen}\n role=\"alertdialog\"\n labelledBy={titleId}\n describedBy={describedBy || undefined}\n closeLabel=\"Close dialog\"\n onClose={onClose}\n >\n <h3 id={titleId} className=\"text-lg font-semibold\">\n {title}\n </h3>\n {description ? (\n <div id={descriptionId} className=\"text-muted-foreground mt-2 text-sm\">\n {description}\n </div>\n ) : null}\n\n {error ? (\n <div\n id={errorId}\n role=\"alert\"\n className=\"border-destructive/30 bg-destructive/5 text-destructive mt-4 rounded-lg border px-3 py-2 text-sm\"\n >\n {error}\n </div>\n ) : null}\n\n <div className=\"mt-6 flex justify-end gap-2\">\n <Button variant=\"outline\" onClick={onClose} disabled={isConfirming}>\n {cancelLabel}\n </Button>\n <Button\n variant=\"destructive\"\n onClick={onConfirm}\n loading={isConfirming}\n >\n {confirmLabel}\n </Button>\n </div>\n </Modal>\n );\n}\n","import * as React from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\nimport { Spinner } from \"./spinner\";\nimport { cn } from \"./utils\";\n\nconst buttonVariants = cva(\n \"inline-flex h-9 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-md px-3 text-sm font-medium transition duration-200 active:scale-[0.98] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n secondary: \"bg-muted text-foreground hover:bg-muted/80\",\n ghost: \"hover:bg-muted\",\n destructive:\n \"bg-destructive text-destructive-foreground hover:bg-destructive/90\",\n outline: \"border border-border bg-background hover:bg-muted\",\n },\n size: {\n sm: \"h-8 px-2.5\",\n md: \"h-9 px-3\",\n lg: \"h-10 px-4\",\n icon: \"h-9 w-9 px-0\",\n // Square, matching `sm`'s height — for an icon-only control sitting in\n // a table row or beside `sm` buttons, where `icon` is a row taller.\n \"icon-sm\": \"h-8 w-8 px-0\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"md\",\n },\n },\n);\n\nexport interface ButtonProps\n extends\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean;\n /**\n * Work is in flight: shows a spinner, disables the button, and sets\n * `aria-busy`.\n *\n * This exists because the panel had 272 disabled buttons and only 22 that\n * said anything about why — the rest went dead on click with no spinner and\n * no label change, which reads as a broken button rather than a busy one.\n * Making the feedback part of `disabled` rather than something each caller\n * remembers separately is the only way that ratio stays fixed.\n *\n * The label is kept rather than swapped. \"Saving…\" loses which button you\n * pressed, and the spinner already says it is working. An icon-only button\n * is the exception — there is no room beside the glyph, so the spinner takes\n * its place; the `aria-label` is what names the button either way.\n *\n * \"Icon-only\" means an icon `size`. A square button that grew a spinner\n * beside its glyph would not just look wrong, it would resize mid-request\n * and shove whatever sits next to it sideways.\n */\n loading?: boolean;\n}\n\n/** Sizes with no room for a spinner beside the glyph. */\nconst ICON_SIZES = new Set<string>([\"icon\", \"icon-sm\"]);\n\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n className,\n variant,\n size,\n asChild = false,\n loading,\n disabled,\n children,\n ...props\n },\n ref,\n ) => {\n const Comp = asChild ? Slot : \"button\";\n\n // `asChild` renders someone else's element, which may not take a spinner or\n // a disabled attribute — so the busy treatment is only applied to a real\n // button, and passing both is a mistake worth not papering over.\n if (asChild) {\n return (\n <Comp\n ref={ref}\n className={cn(buttonVariants({ variant, size }), className)}\n {...props}\n >\n {children}\n </Comp>\n );\n }\n\n return (\n <button\n ref={ref}\n disabled={disabled || loading}\n aria-busy={loading || undefined}\n className={cn(buttonVariants({ variant, size }), className)}\n {...props}\n >\n {loading ? <Spinner size=\"sm\" /> : null}\n {loading && size != null && ICON_SIZES.has(size) ? null : children}\n </button>\n );\n },\n);\n\nButton.displayName = \"Button\";\n","import * as React from \"react\";\nimport { Loader2 } from \"lucide-react\";\n\nimport { cn } from \"./utils\";\n\n/**\n * The one spinner.\n *\n * There were five spellings of `animate-spin` across twelve files — `h-4 w-4`,\n * `h-5 w-5`, `size-4`, bare, and a hand-drawn ring in `ProtectedRoute` — so the\n * same \"working\" signal came out a different size depending on which panel you\n * were on.\n *\n * It is `aria-hidden` on purpose. A spinner is decoration; what a screen reader\n * needs is the surrounding control's `aria-busy` or the panel's status text,\n * and announcing \"loading\" twice is worse than once. `Button` and `StatePanel`\n * both supply that.\n */\nconst SIZES = {\n sm: \"size-3.5\",\n md: \"size-4\",\n lg: \"size-5\",\n xl: \"size-10 border-2\",\n} as const;\n\nexport interface SpinnerProps extends React.SVGProps<SVGSVGElement> {\n size?: keyof typeof SIZES;\n}\n\nexport function Spinner({ size = \"md\", className, ...props }: SpinnerProps) {\n return (\n <Loader2\n aria-hidden\n className={cn(\"animate-spin\", SIZES[size], className)}\n {...props}\n />\n );\n}\n","import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport { createPortal } from \"react-dom\";\n\nimport { useDialogLayer } from \"./dialogLayer\";\nimport { cn } from \"./utils\";\n\nconst emptySubscribe = () => () => {};\n\n/**\n * Returns false during SSR and the first client render, then true once mounted.\n * `useSyncExternalStore` is the React-recommended way to read client-only state\n * without a setState-in-effect (which triggers cascading renders).\n */\nexport function useHasMounted(): boolean {\n return React.useSyncExternalStore(\n emptySubscribe,\n () => true,\n () => false,\n );\n}\n\ninterface ModalProps {\n isOpen: boolean;\n /** id of the element labelling the dialog; wired to aria-labelledby. */\n labelledBy: string;\n /**\n * Optional id(s) of elements describing the dialog (APG alertdialog body).\n * Space-separated when multiple.\n */\n describedBy?: string;\n /** Accessible label for the backdrop dismiss button. */\n closeLabel: string;\n onClose: () => void;\n children: React.ReactNode;\n /**\n * When false, Escape and backdrop clicks do not close the modal (e.g. while a\n * save is in flight). Defaults to true.\n */\n dismissible?: boolean;\n /** Use \"alertdialog\" for destructive confirmations. Defaults to \"dialog\". */\n role?: \"dialog\" | \"alertdialog\";\n /** Tailwind max-width class for the panel. Defaults to \"max-w-md\". */\n panelClassName?: string;\n}\n\n/**\n * Shared modal shell: renders a portal-backed, scroll-locked, Escape-dismissible\n * overlay with a centered panel. Callers provide the panel body (heading, form,\n * footer). Consolidates the boilerplate previously copied across every dialog.\n */\nexport function Modal({\n isOpen,\n labelledBy,\n describedBy,\n closeLabel,\n onClose,\n children,\n dismissible = true,\n role = \"dialog\",\n panelClassName,\n}: ModalProps) {\n const mounted = useHasMounted();\n const panelRef = React.useRef<HTMLDivElement>(null);\n\n useDialogLayer({\n // Gated on `mounted` too: before that the panel is not rendered, so there\n // would be nothing to move focus into.\n active: isOpen && mounted,\n containerRef: panelRef,\n onEscape: dismissible ? onClose : undefined,\n });\n\n if (!mounted || !isOpen) return null;\n\n return createPortal(\n /*\n `overflow-y-auto` on the overlay, `my-auto` on the panel — not\n `items-center`. A flex item centred with `align-items` overflows equally\n in both directions once it is taller than its container, and the half\n above the top edge cannot be scrolled to: with the page behind it locked,\n an over-tall dialog was simply unreachable at both ends. Auto margins\n centre a short panel the same way and collapse to zero on a tall one,\n which scrolls.\n */\n <div className=\"fixed inset-0 z-[100] flex justify-center overflow-y-auto p-4\">\n {/* `fixed`, not `absolute`: inside a scrolling overlay an absolute\n backdrop scrolls away with the content and leaves the rest of a tall\n dialog sitting on an undimmed page. */}\n <button\n type=\"button\"\n aria-label={closeLabel}\n tabIndex={-1}\n className=\"fixed inset-0 bg-overlay/50\"\n onClick={() => {\n if (dismissible) onClose();\n }}\n />\n <div\n ref={panelRef}\n role={role}\n aria-modal=\"true\"\n aria-labelledby={labelledBy}\n aria-describedby={describedBy}\n tabIndex={-1}\n className={cn(\n \"border-border bg-background relative z-10 my-auto w-full rounded-lg border shadow-2xl outline-none\",\n panelClassName ?? \"max-w-md p-6\",\n )}\n >\n {children}\n </div>\n </div>,\n document.body,\n );\n}\n","\"use client\";\n\nimport * as React from \"react\";\n\n/**\n * The keyboard and focus behaviour every dialog needs, in one place.\n *\n * `Modal` and `SideDrawer` each had a copy of the scroll lock and an Escape\n * handler, and neither did anything about focus: opening a dialog left focus\n * on the button behind it, Tab walked the page underneath — through the\n * full-screen backdrop button, among other things — and closing left focus\n * wherever it had wandered. That is the whole keyboard story for thirty\n * dialogs, so it is fixed once here rather than thirty times.\n */\n\n/**\n * Open dialogs, innermost last.\n *\n * Nesting is real here — \"Create audience group\" opens on top of \"Send\n * notification\" — and without an ordering both would answer the same Escape\n * and fight over the same Tab. Only the top layer acts.\n */\nconst layers: symbol[] = [];\n\nconst FOCUSABLE = [\n \"a[href]\",\n \"button:not([disabled])\",\n \"input:not([disabled])\",\n \"select:not([disabled])\",\n \"textarea:not([disabled])\",\n '[tabindex]:not([tabindex=\"-1\"])',\n].join(\",\");\n\n/**\n * Deliberately not `offsetParent` or `getClientRects`: the first is null for\n * anything `position: fixed`, which a dialog panel usually is, and the second\n * is empty for *everything* under a test renderer that does no layout — which\n * would collapse the trap to \"no focusable elements\" in every test.\n */\nfunction isVisible(element: HTMLElement): boolean {\n if (element.closest(\"[hidden]\")) return false;\n if (element.getAttribute(\"aria-hidden\") === \"true\") return false;\n return typeof element.checkVisibility === \"function\"\n ? element.checkVisibility()\n : true;\n}\n\nfunction focusableWithin(container: HTMLElement): HTMLElement[] {\n return Array.from(container.querySelectorAll<HTMLElement>(FOCUSABLE)).filter(\n isVisible,\n );\n}\n\nexport function useDialogLayer({\n active,\n containerRef,\n onEscape,\n}: {\n active: boolean;\n /** The panel. Focus is moved into it and kept inside it. */\n containerRef: React.RefObject<HTMLElement | null>;\n /** Called on Escape, only while this is the top layer. Omit to ignore it. */\n onEscape?: () => void;\n}): void {\n // Read through a ref so a caller passing a fresh closure every render does\n // not tear the listener down and rebuild it on every keystroke.\n const escapeRef = React.useRef(onEscape);\n React.useEffect(() => {\n escapeRef.current = onEscape;\n });\n\n React.useEffect(() => {\n if (!active) return;\n\n const layer = Symbol(\"dialog-layer\");\n layers.push(layer);\n const isTopLayer = () => layers[layers.length - 1] === layer;\n\n const previouslyFocused =\n document.activeElement instanceof HTMLElement\n ? document.activeElement\n : null;\n\n const container = containerRef.current;\n // Something inside may have claimed focus already — an `autoFocus` input —\n // and that choice is better than any this could make.\n if (container && !container.contains(document.activeElement)) {\n const [first] = focusableWithin(container);\n // The panel itself, not its first control: the first control is a Delete\n // button often enough that focusing it would put a destructive action\n // one Enter away from an accidental keypress.\n (container.hasAttribute(\"tabindex\") ? container : first)?.focus();\n }\n\n function handleKeyDown(event: KeyboardEvent) {\n if (!isTopLayer()) return;\n\n if (event.key === \"Escape\") {\n escapeRef.current?.();\n return;\n }\n\n if (event.key !== \"Tab\") return;\n const panel = containerRef.current;\n if (!panel) return;\n\n const items = focusableWithin(panel);\n if (items.length === 0) {\n event.preventDefault();\n panel.focus();\n return;\n }\n\n const first = items[0]!;\n const last = items[items.length - 1]!;\n const active = document.activeElement;\n const outside = !panel.contains(active);\n\n if (event.shiftKey && (active === first || outside)) {\n event.preventDefault();\n last.focus();\n } else if (!event.shiftKey && (active === last || outside)) {\n event.preventDefault();\n first.focus();\n }\n }\n\n document.addEventListener(\"keydown\", handleKeyDown);\n const previousOverflow = document.body.style.overflow;\n document.body.style.overflow = \"hidden\";\n\n return () => {\n document.removeEventListener(\"keydown\", handleKeyDown);\n document.body.style.overflow = previousOverflow;\n const index = layers.indexOf(layer);\n if (index !== -1) layers.splice(index, 1);\n // Back where it came from, so closing a dialog opened by keyboard does\n // not drop the caret at the top of the document.\n if (previouslyFocused?.isConnected) previouslyFocused.focus();\n };\n }, [active, containerRef]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,IAAAA,SAAuB;;;ACFvB,YAAuB;AACvB,sCAAuC;AACvC,wBAAqB;;;ACDrB,0BAAwB;;;ACDxB,kBAAsC;AACtC,4BAAwB;AAEjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;;;AD0BI;AAbJ,IAAM,QAAQ;AAAA,EACZ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAMO,SAAS,QAAQ,EAAE,OAAO,MAAM,WAAW,GAAG,MAAM,GAAiB;AAC1E,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAW;AAAA,MACX,WAAW,GAAG,gBAAgB,MAAM,IAAI,GAAG,SAAS;AAAA,MACnD,GAAG;AAAA;AAAA,EACN;AAEJ;;;ADkDQ,IAAAC,sBAAA;AAhFR,IAAM,qBAAiB;AAAA,EACrB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA,QACT,WAAW;AAAA,QACX,OAAO;AAAA,QACP,aACE;AAAA,QACF,SAAS;AAAA,MACX;AAAA,MACA,MAAM;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,MAAM;AAAA;AAAA;AAAA,QAGN,WAAW;AAAA,MACb;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,SAAS;AAAA,MACT,MAAM;AAAA,IACR;AAAA,EACF;AACF;AA8BA,IAAM,aAAa,oBAAI,IAAY,CAAC,QAAQ,SAAS,CAAC;AAE/C,IAAM,SAAe;AAAA,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AA,UACjB,oBAAkB;AAAA,UAClB,UAAU;AAAA,UACV,WAAW;AAAA,YACT;AAAA,YACA,kBAAkB;AAAA,UACpB;AAAA,UAEC;AAAA;AAAA,MACH;AAAA,OACF;AAAA,IACA,SAAS;AAAA,EACX;AACF;;;AJlEM,IAAAC,sBAAA;AA/BC,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAuB;AACrB,QAAM,UAAgB,aAAM;AAC5B,QAAM,gBAAsB,aAAM;AAClC,QAAM,UAAgB,aAAM;AAE5B,QAAM,cAAc;AAAA,IAClB,cAAc,gBAAgB;AAAA,IAC9B,QAAQ,UAAU;AAAA,EACpB,EACG,OAAO,OAAO,EACd,KAAK,GAAG;AAEX,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,MAAK;AAAA,MACL,YAAY;AAAA,MACZ,aAAa,eAAe;AAAA,MAC5B,YAAW;AAAA,MACX;AAAA,MAEA;AAAA,qDAAC,QAAG,IAAI,SAAS,WAAU,yBACxB,iBACH;AAAA,QACC,cACC,6CAAC,SAAI,IAAI,eAAe,WAAU,sCAC/B,uBACH,IACE;AAAA,QAEH,QACC;AAAA,UAAC;AAAA;AAAA,YACC,IAAI;AAAA,YACJ,MAAK;AAAA,YACL,WAAU;AAAA,YAET;AAAA;AAAA,QACH,IACE;AAAA,QAEJ,8CAAC,SAAI,WAAU,+BACb;AAAA,uDAAC,UAAO,SAAQ,WAAU,SAAS,SAAS,UAAU,cACnD,uBACH;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,SAAQ;AAAA,cACR,SAAS;AAAA,cACT,SAAS;AAAA,cAER;AAAA;AAAA,UACH;AAAA,WACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":["React","import_jsx_runtime","React","React","active","import_jsx_runtime","import_jsx_runtime"]}
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import {
3
3
  ConfirmDialog
4
- } from "./chunk-WVNRFO5F.js";
5
- import "./chunk-YSU4VWRD.js";
4
+ } from "./chunk-ISPICB4W.js";
5
+ import "./chunk-DS3QYIKL.js";
6
6
  import "./chunk-HBBOR43A.js";
7
7
  import "./chunk-KR3BCFP7.js";
8
8
  import "./chunk-UE7JY7VR.js";
package/dist/index.cjs CHANGED
@@ -308,7 +308,7 @@ function Modal({
308
308
  type: "button",
309
309
  "aria-label": closeLabel,
310
310
  tabIndex: -1,
311
- className: "fixed inset-0 bg-slate-950/50",
311
+ className: "fixed inset-0 bg-overlay/50",
312
312
  onClick: () => {
313
313
  if (dismissible) onClose();
314
314
  }
@@ -2251,15 +2251,11 @@ function Pagination({
2251
2251
  // src/segmented-control.tsx
2252
2252
  var React17 = __toESM(require("react"), 1);
2253
2253
  var import_jsx_runtime25 = require("react/jsx-runtime");
2254
+ var TONE_ON = "bg-primary text-primary-foreground";
2255
+ var TONE_OFF = "text-muted-foreground hover:bg-muted";
2254
2256
  var TONES = {
2255
- emphasis: {
2256
- on: "bg-slate-950 text-white dark:bg-white dark:text-slate-950",
2257
- off: "text-muted-foreground hover:bg-muted"
2258
- },
2259
- primary: {
2260
- on: "bg-primary text-primary-foreground",
2261
- off: "text-muted-foreground hover:bg-muted"
2262
- }
2257
+ emphasis: { on: TONE_ON, off: TONE_OFF },
2258
+ primary: { on: TONE_ON, off: TONE_OFF }
2263
2259
  };
2264
2260
  var TRACKS = {
2265
2261
  contained: "border-border inline-flex rounded-md border p-0.5",
@@ -2444,7 +2440,7 @@ function SideDrawer({
2444
2440
  {
2445
2441
  "aria-hidden": true,
2446
2442
  onClick: onClose,
2447
- className: "fixed inset-0 z-[90] bg-slate-950/30"
2443
+ className: "fixed inset-0 z-[90] bg-overlay/30"
2448
2444
  }
2449
2445
  ),
2450
2446
  /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(