@manakind/ui-core 0.29.0 → 0.30.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/README.md +5 -1
  2. package/dist/accordion/accordion.css +89 -0
  3. package/dist/accordion/accordion.css.d.ts +2 -0
  4. package/dist/accordion/accordion.d.ts +79 -0
  5. package/dist/accordion/accordion.d.ts.map +1 -0
  6. package/dist/accordion/accordion.js +44 -0
  7. package/dist/accordion/accordion.js.map +1 -0
  8. package/dist/accordion/index.d.ts +2 -0
  9. package/dist/accordion/index.d.ts.map +1 -0
  10. package/dist/accordion/index.js +2 -0
  11. package/dist/accordion/index.js.map +1 -0
  12. package/dist/calendar/calendar.d.ts +3 -4
  13. package/dist/calendar/calendar.d.ts.map +1 -1
  14. package/dist/calendar/calendar.js +5 -2
  15. package/dist/calendar/calendar.js.map +1 -1
  16. package/dist/checkbox/checkbox.d.ts +2 -4
  17. package/dist/checkbox/checkbox.d.ts.map +1 -1
  18. package/dist/checkbox/checkbox.js +4 -2
  19. package/dist/checkbox/checkbox.js.map +1 -1
  20. package/dist/combobox/combobox.d.ts +3 -3
  21. package/dist/combobox/combobox.d.ts.map +1 -1
  22. package/dist/combobox/combobox.js +5 -2
  23. package/dist/combobox/combobox.js.map +1 -1
  24. package/dist/dialog/dialog.d.ts +3 -4
  25. package/dist/dialog/dialog.d.ts.map +1 -1
  26. package/dist/dialog/dialog.js +4 -2
  27. package/dist/dialog/dialog.js.map +1 -1
  28. package/dist/fallback-glyphs.js +3 -3
  29. package/dist/fallback-glyphs.js.map +1 -1
  30. package/dist/icon-defaults.d.ts +45 -0
  31. package/dist/icon-defaults.d.ts.map +1 -0
  32. package/dist/icon-defaults.js +43 -0
  33. package/dist/icon-defaults.js.map +1 -0
  34. package/dist/index.d.ts +3 -0
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +3 -0
  37. package/dist/index.js.map +1 -1
  38. package/dist/menu/action-menu.d.ts +3 -3
  39. package/dist/menu/action-menu.d.ts.map +1 -1
  40. package/dist/menu/action-menu.js +4 -2
  41. package/dist/menu/action-menu.js.map +1 -1
  42. package/dist/menu/menu.d.ts +5 -7
  43. package/dist/menu/menu.d.ts.map +1 -1
  44. package/dist/menu/menu.js +7 -3
  45. package/dist/menu/menu.js.map +1 -1
  46. package/dist/radio-group/index.d.ts +2 -0
  47. package/dist/radio-group/index.d.ts.map +1 -0
  48. package/dist/radio-group/index.js +2 -0
  49. package/dist/radio-group/index.js.map +1 -0
  50. package/dist/radio-group/radio-group.css +70 -0
  51. package/dist/radio-group/radio-group.css.d.ts +2 -0
  52. package/dist/radio-group/radio-group.d.ts +74 -0
  53. package/dist/radio-group/radio-group.d.ts.map +1 -0
  54. package/dist/radio-group/radio-group.js +57 -0
  55. package/dist/radio-group/radio-group.js.map +1 -0
  56. package/dist/select/select.d.ts +3 -3
  57. package/dist/select/select.d.ts.map +1 -1
  58. package/dist/select/select.js +5 -2
  59. package/dist/select/select.js.map +1 -1
  60. package/dist/split-layout/split-layout.css +8 -0
  61. package/dist/split-layout/split-layout.d.ts +2 -1
  62. package/dist/split-layout/split-layout.d.ts.map +1 -1
  63. package/dist/split-layout/split-layout.js +2 -1
  64. package/dist/split-layout/split-layout.js.map +1 -1
  65. package/dist/sticky/sticky.css +3 -1
  66. package/package.json +18 -2
@@ -1 +1 @@
1
- {"version":3,"file":"combobox.js","sourceRoot":"","sources":["../../src/combobox/combobox.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAQL,WAAW,EACX,UAAU,EACV,SAAS,EACT,KAAK,EACL,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,C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C,KAAK,GAAQ,EAC1B,KAAC,OAAO,IAAC,OAAO,EAAC,gBAAgB,EAAC,IAAI,EAAC,OAAO,YAC5C,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,0BAA0B,gBACxB,qBAAqB,KAAK,CAAC,KAAK,EAAE,EAC9C,OAAO,EAAE,QAAQ,YAEjB,KAAC,IAAI,IAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAC,IAAI,EAAC,UAAU,SAAG,GAC1C,GACD,IACL,CACR,CAAC;AACJ,CAAC","sourcesContent":["import { Popover as ArkPopover } from '@ark-ui/react/popover';\nimport { Portal } from '@ark-ui/react/portal';\nimport { getTabbableEdges, getTabbables, isComposingEvent } from '@zag-js/dom-query';\nimport {\n type ChangeEvent,\n type KeyboardEvent,\n type MouseEvent,\n type PointerEvent,\n type ReactNode,\n type Ref,\n type TdHTMLAttributes,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { flushSync } from 'react-dom';\nimport { cx } from '../cx';\nimport { Cross, Pin } from '../fallback-glyphs';\nimport { groupItems } from '../group-items';\nimport { Icon, type IconSource } from '../icon/icon';\nimport { PortalContainerContext } from '../portal-container';\nimport { Tooltip } from '../tooltip/tooltip';\nimport '../visually-hidden/visually-hidden.css';\nimport './combobox.css';\n\nexport type ComboboxSize = 'sm' | 'md' | 'lg';\n\n/** What an option belongs to, shown in a second column: its category, its project. */\nexport interface ComboboxFacet {\n /** Stable value reported when the facet is pinned. */\n value: string;\n /** Text in the facet column, and in the pinned chip. */\n label: string;\n /** Decorative mark before the label, such as the category's icon. */\n icon?: ReactNode;\n}\n\nexport interface ComboboxItem {\n /** Stable value reported by `onSelect`. */\n value: string;\n /** Option text, also what screen readers use. */\n label: string;\n /** Optional secondary line under the label, shown muted. */\n description?: string;\n /** Individually disable this option without removing it. */\n disabled?: boolean;\n /**\n * The group the option is listed under, by its heading. Options sharing a\n * group are listed together under it, groups in the order they first\n * appear; options without one (or with an empty name) are listed before\n * any group.\n */\n group?: string;\n /** What the option belongs to, shown in the facet column when `facets` is set. */\n facet?: ComboboxFacet;\n}\n\n/**\n * A second column naming what each option belongs to, with a pin that\n * narrows the list to it.\n */\nexport interface ComboboxFacets {\n /** Heading of the option column, for assistive tech: \"Action\". */\n itemLabel: string;\n /** Heading of the facet column, for assistive tech: \"Category\". */\n label: string;\n /** The facet the list is narrowed to, shown as a removable chip in the status line. */\n pinned?: ComboboxFacet | null;\n /**\n * Pins a row's facet, or unpins it with `null` (its pin pressed again, the\n * chip's remove button, or Backspace in the empty field). The caller does\n * the narrowing. Without it, the facet column shows no pins.\n */\n onPinnedChange?: (facet: ComboboxFacet | null) => void;\n}\n\nexport interface ComboboxProps {\n /**\n * Suggestions for the current text.\n *\n * The caller filters, sorts and groups them; the component does not. What\n * counts as a match (a prefix, a substring, a category's name, anything\n * not already chosen) is the product's call, and the list it passes is the\n * list that shows.\n */\n items: ComboboxItem[];\n /** Controlled text in the input. */\n inputValue: string;\n /** Fired with the new text on every keystroke, and with `''` after a choice. */\n onInputValueChange: (value: string) => void;\n /**\n * A suggestion was chosen. The input then clears (`onInputValueChange('')`)\n * and the field holds no value: this is the \"add to a list\" pattern. A\n * field that keeps its choice is a `Select`.\n */\n onSelect: (value: string) => void;\n /**\n * Visible label. Strongly preferred over `aria-label` — a visible label\n * helps everyone, not only screen reader users.\n */\n label?: ReactNode;\n /** Accessible name when no visible `label` is supplied. */\n 'aria-label'?: string;\n /** Text shown in the empty input. */\n placeholder?: string;\n /** Shown in the open list when `items` is empty. */\n emptyText?: ReactNode;\n /**\n * Controls at the top of the open list that change what it shows: a\n * `Switch`, a small `SegmentGroup`. One row of them, so the options stay\n * in view; Tab moves into them from the field.\n */\n toolbar?: ReactNode;\n /**\n * One line under the toolbar saying what the list shows, such as \"Showing\n * all actions in Health\". Announced politely as it changes.\n */\n status?: ReactNode;\n /** Adds the facet column, with its pins. The list becomes a grid. */\n facets?: ComboboxFacets;\n /** Glyph of a row's pin. Defaults to the inlined fallback pin. */\n pinIcon?: IconSource;\n /** Glyph of the pinned chip's remove button. Defaults to the inlined fallback cross. */\n removeIcon?: IconSource;\n /** Control height and type scale. */\n size?: ComboboxSize;\n /** Disable the whole control. */\n disabled?: boolean;\n /** Marks the field invalid for assistive tech and styling. */\n invalid?: boolean;\n /** Extra class names appended after `ds-combobox` modifiers. */\n className?: string;\n /** The text input, for moving focus back to the field, e.g. after removing an item it added. */\n inputRef?: Ref<HTMLInputElement>;\n}\n\ntype Cell = 'item' | 'facet';\n\ninterface Active {\n value: string;\n cell: Cell;\n}\n\n// The header's own controls, which a press may focus.\nconst HEADER_CONTROLS = 'button, input, label, a[href], [tabindex]:not([tabindex=\"-1\"])';\n\n/**\n * A text input that suggests options as you type, with optional controls at\n * the top of the open list.\n *\n * Choosing a suggestion reports it through `onSelect` and empties the input,\n * so the field is ready for the next one: the control for adding items to a\n * list one at a time. It never holds a selection itself; the caller keeps\n * the list. For a field that keeps one choice, use `Select`.\n *\n * The open list can carry what narrows it, so nothing sits outside the\n * field: a `toolbar` row of switches or a segment group, a `status` line\n * saying what is shown, and with `facets` a second column naming what each\n * option belongs to, whose pin narrows the list to it.\n *\n * ```tsx\n * <Combobox\n * label=\"Add actions\"\n * items={matches}\n * inputValue={query}\n * onInputValueChange={setQuery}\n * onSelect={(value) => setPicked((list) => [...list, value])}\n * toolbar={<Switch size=\"sm\" label=\"Include categories\" checked={…} onCheckedChange={…} />}\n * status={`Showing all actions that contain “${query}”`}\n * facets={{ itemLabel: 'Action', label: 'Category', pinned, onPinnedChange: setPinned }}\n * />\n * ```\n *\n * The field is the APG editable combobox. Focus stays in the input, and the\n * active option is `aria-activedescendant`. Typing highlights the first\n * option, so Enter takes it, and Up and Down walk the options in their drawn\n * order. With `facets` the popup is a grid instead of a listbox: Right, at\n * the end of the text, moves onto the row's pin and Enter then pins it, and\n * Left moves back. Tab moves from the field into the toolbar and the chip,\n * and on out to the next field.\n *\n * The popup is an Ark Popover anchored to the field, so it takes part in\n * the dismiss stack. Escape closes it before a `Dialog` around it, and a\n * click outside closes it. Its wrapper drops the Popover's dialog role, so\n * the listbox or grid inside is the popup assistive tech meets. It portals\n * like `Select`'s list: into `<body>`, or into the panel of the ui-core\n * `Dialog` it opens in, at `z-index: 60`.\n * The field reads the `--ds-input-*` keys and the list the `--ds-select-*`\n * keys, so it reads as one family with `Input` and `Select`.\n */\nexport function Combobox({\n items,\n inputValue,\n onInputValueChange,\n onSelect,\n label,\n 'aria-label': ariaLabel,\n placeholder,\n emptyText,\n toolbar,\n status,\n facets,\n pinIcon = Pin,\n removeIcon = Cross,\n size = 'md',\n disabled,\n invalid,\n className,\n inputRef,\n}: ComboboxProps) {\n const id = useId();\n const inputId = `${id}-input`;\n const labelId = `${id}-label`;\n const listId = `${id}-list`;\n const statusId = `${id}-status`;\n const rowId = (index: number) => `${id}-row-${index}`;\n const cellId = (index: number, cell: Cell) => `${id}-cell-${index}-${cell}`;\n\n const rootRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const headerRef = useRef<HTMLDivElement>(null);\n const inputEl = useRef<HTMLInputElement | null>(null);\n const portalContainer = useContext(PortalContainerContext);\n\n const [open, setOpen] = useState(false);\n const [chosen, setChosen] = useState<Active | null>(null);\n const isOpen = open && !disabled;\n const isGrid = facets !== undefined;\n const pinned = facets?.pinned ?? null;\n const canPin = (item: ComboboxItem) => Boolean(facets?.onPinnedChange && item.facet);\n\n const groups = useMemo(() => groupItems(items), [items]);\n const ordered = useMemo(() => groups.flatMap((group) => group.items), [groups]);\n const navigable = useMemo(() => ordered.filter((item) => !item.disabled), [ordered]);\n\n const chosenItem = chosen && navigable.find((item) => item.value === chosen.value);\n const active: Active | null = chosenItem\n ? {\n value: chosenItem.value,\n cell: chosen?.cell === 'facet' && canPin(chosenItem) ? 'facet' : 'item',\n }\n : inputValue !== '' && navigable[0]\n ? { value: navigable[0].value, cell: 'item' }\n : null;\n const activeIndex = active ? ordered.findIndex((item) => item.value === active.value) : -1;\n const activeDescendant =\n isOpen && active && activeIndex >= 0\n ? isGrid\n ? cellId(activeIndex, active.cell)\n : rowId(activeIndex)\n : undefined;\n\n const setInputRef = useCallback(\n (element: HTMLInputElement | null) => {\n inputEl.current = element;\n if (typeof inputRef === 'function') inputRef(element);\n else if (inputRef) inputRef.current = element;\n },\n [inputRef],\n );\n\n /*\n * The popup portals out of the field, so the browser's Tab order would\n * skip it. While it is open, Tab from the field moves into its header's\n * controls, Tab from the last one moves on to whatever follows the field,\n * and Shift+Tab walks back the same way. Only the header counts, as the\n * pins are reached with the arrows; with no header control, Tab is the\n * browser's. A window listener, so it lives in an effect, and so it runs\n * ahead of a Dialog's focus trap: the popup is the end of the dialog's\n * panel, and the trap would wrap Tab from its last control to the\n * dialog's first.\n */\n useEffect(() => {\n if (!isOpen) return;\n const handleTab = (event: globalThis.KeyboardEvent) => {\n const header = headerRef.current;\n const content = contentRef.current;\n const field = inputEl.current;\n if (event.key !== 'Tab' || !header || !content || !field) return;\n const [first, last] = getTabbableEdges(header);\n if (!first || !last) return;\n const scope = field.closest<HTMLElement>('[aria-modal=\"true\"]') ?? field.ownerDocument.body;\n const tabbables = getTabbables(scope);\n const after = tabbables\n .slice(tabbables.indexOf(field) + 1)\n .find((element) => !content.contains(element));\n const current = field.ownerDocument.activeElement;\n let target: HTMLElement | undefined;\n if (event.shiftKey) target = current === first ? field : current === after ? last : undefined;\n else target = current === field ? first : current === last ? after : undefined;\n if (!target) return;\n event.preventDefault();\n if (target === after) event.stopPropagation();\n target.focus({ preventScroll: true });\n };\n window.addEventListener('keydown', handleTab, true);\n return () => window.removeEventListener('keydown', handleTab, true);\n }, [isOpen]);\n\n const activate = (next: Active | null) => {\n flushSync(() => setChosen(next));\n if (!next) return;\n const index = ordered.findIndex((item) => item.value === next.value);\n document.getElementById(rowId(index))?.scrollIntoView?.({ block: 'nearest' });\n };\n\n const move = (step: 1 | -1) => {\n if (navigable.length === 0) return;\n const from = active ? navigable.findIndex((item) => item.value === active.value) : -1;\n const to =\n from === -1\n ? step === 1\n ? 0\n : navigable.length - 1\n : (from + step + navigable.length) % navigable.length;\n const item = navigable[to];\n activate({\n value: item.value,\n cell: active?.cell === 'facet' && canPin(item) ? 'facet' : 'item',\n });\n };\n\n const focusFieldFromPopup = () => {\n if (contentRef.current?.contains(document.activeElement)) inputEl.current?.focus();\n };\n\n const handleOpenChange = (details: { open: boolean }) => {\n setOpen(details.open);\n if (!details.open) setChosen(null);\n };\n\n const choose = (item: ComboboxItem) => {\n if (item.disabled) return;\n focusFieldFromPopup();\n onSelect(item.value);\n onInputValueChange('');\n setChosen(null);\n setOpen(false);\n };\n\n const togglePin = (facet: ComboboxFacet) => {\n facets?.onPinnedChange?.(pinned?.value === facet.value ? null : facet);\n setChosen(null);\n };\n\n const unpin = () => {\n facets?.onPinnedChange?.(null);\n inputEl.current?.focus();\n };\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n setChosen(null);\n setOpen(true);\n onInputValueChange(event.target.value);\n };\n\n const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (isComposingEvent(event) || event.ctrlKey || event.shiftKey) return;\n const input = event.currentTarget;\n const activeItem = activeIndex >= 0 ? ordered[activeIndex] : undefined;\n const caretAtEnd =\n input.selectionStart === input.value.length && input.selectionEnd === input.value.length;\n\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault();\n if (!isOpen) setOpen(true);\n move(event.key === 'ArrowDown' ? 1 : -1);\n } else if (event.key === 'ArrowRight' && isOpen && activeItem && active?.cell === 'item') {\n if (isGrid && canPin(activeItem) && caretAtEnd) {\n event.preventDefault();\n activate({ value: activeItem.value, cell: 'facet' });\n }\n } else if (event.key === 'ArrowLeft' && isOpen && activeItem && active?.cell === 'facet') {\n event.preventDefault();\n activate({ value: activeItem.value, cell: 'item' });\n } else if (event.key === 'Enter' && isOpen && activeItem) {\n event.preventDefault();\n if (active?.cell === 'facet' && activeItem.facet) togglePin(activeItem.facet);\n else choose(activeItem);\n } else if (event.key === 'Backspace' && input.value === '' && pinned) {\n facets?.onPinnedChange?.(null);\n }\n };\n\n const rowIndexOf = (target: EventTarget) => {\n const row = (target as Element).closest<HTMLElement>('[data-index]');\n return row ? Number(row.dataset.index) : -1;\n };\n\n const handleListClick = (event: MouseEvent) => {\n const item = ordered[rowIndexOf(event.target)];\n if (!item) return;\n if ((event.target as Element).closest('[data-pin]') && item.facet) togglePin(item.facet);\n else choose(item);\n };\n\n const handleListPointerMove = (event: PointerEvent) => {\n const item = ordered[rowIndexOf(event.target)];\n if (item && !item.disabled && item.value !== active?.value) {\n setChosen({ value: item.value, cell: 'item' });\n }\n };\n\n const listName = label ? { 'aria-labelledby': labelId } : { 'aria-label': ariaLabel };\n const hasStatus = status !== undefined || pinned !== null;\n const hasHeader = toolbar !== undefined || hasStatus;\n const isEmpty = items.length === 0 && emptyText !== undefined;\n\n const rowOf = (item: ComboboxItem): RowModel => {\n const index = ordered.indexOf(item);\n const isActive = isOpen && index === activeIndex;\n return {\n item,\n index,\n rowId: rowId(index),\n itemCellId: cellId(index, 'item'),\n facetCellId: cellId(index, 'facet'),\n highlighted: isActive,\n pinnable: canPin(item),\n pinned: pinned !== null && pinned.value === item.facet?.value,\n pinActive: isActive && active?.cell === 'facet',\n };\n };\n const sections: Section[] = groups.map((group, groupIndex) => ({\n label: group.label,\n headingId: `${id}-group-${groupIndex}`,\n rows: group.items.map(rowOf),\n }));\n\n /*\n * Mouse input never takes focus from the field, so typing carries on: a\n * press on a row, a pin or the header's background is cancelled. Only the\n * header's own controls (a switch, a segment, the chip's remove button)\n * take focus, as they would anywhere.\n */\n const handleContentMouseDown = (event: MouseEvent) => {\n const target = event.target as Element;\n if (target.closest('.ds-combobox__list') || !target.closest(HEADER_CONTROLS)) {\n event.preventDefault();\n }\n };\n\n return (\n <ArkPopover.Root\n open={isOpen}\n onOpenChange={handleOpenChange}\n lazyMount\n unmountOnExit\n autoFocus={false}\n restoreFocus={false}\n portalled={false}\n persistentElements={[() => rootRef.current]}\n onEscapeKeyDown={focusFieldFromPopup}\n positioning={{ placement: 'bottom-start', sameWidth: true }}\n >\n <div ref={rootRef} className={cx('ds-combobox', `ds-combobox--${size}`, className)}>\n {label && (\n <label\n id={labelId}\n htmlFor={inputId}\n className=\"ds-combobox__label\"\n data-disabled={disabled ? '' : undefined}\n >\n {label}\n </label>\n )}\n <ArkPopover.Anchor className=\"ds-combobox__control\">\n <input\n ref={setInputRef}\n id={inputId}\n type=\"text\"\n role=\"combobox\"\n className=\"ds-combobox__input\"\n value={inputValue}\n placeholder={placeholder}\n aria-label={label ? undefined : ariaLabel}\n aria-autocomplete=\"list\"\n aria-haspopup={isGrid ? 'grid' : 'listbox'}\n aria-expanded={isOpen}\n aria-controls={isOpen ? listId : undefined}\n aria-activedescendant={activeDescendant}\n aria-describedby={isOpen && hasStatus ? statusId : undefined}\n aria-invalid={invalid || undefined}\n data-invalid={invalid ? '' : undefined}\n disabled={disabled}\n autoComplete=\"off\"\n autoCorrect=\"off\"\n autoCapitalize=\"none\"\n spellCheck={false}\n onChange={handleChange}\n onClick={() => setOpen(true)}\n onKeyDown={handleKeyDown}\n />\n </ArkPopover.Anchor>\n </div>\n\n <Portal container={portalContainer}>\n <ArkPopover.Positioner>\n <ArkPopover.Content\n ref={contentRef}\n role=\"presentation\"\n className=\"ds-combobox__content\"\n onMouseDown={handleContentMouseDown}\n onClick={handleListClick}\n onPointerMove={handleListPointerMove}\n >\n {hasHeader && (\n <div ref={headerRef} className=\"ds-combobox__header\">\n {toolbar && <div className=\"ds-combobox__toolbar\">{toolbar}</div>}\n {hasStatus && (\n <p id={statusId} role=\"status\" className=\"ds-combobox__status\">\n {status}\n {pinned && (\n <>\n {' '}\n <PinnedChip facet={pinned} removeIcon={removeIcon} onRemove={unpin} />\n </>\n )}\n </p>\n )}\n </div>\n )}\n {facets ? (\n <GridList\n id={listId}\n name={listName}\n facets={facets}\n sections={sections}\n emptyText={isEmpty ? emptyText : undefined}\n pinIcon={pinIcon}\n />\n ) : (\n <ListboxList\n id={listId}\n name={listName}\n sections={sections}\n emptyText={isEmpty ? emptyText : undefined}\n />\n )}\n </ArkPopover.Content>\n </ArkPopover.Positioner>\n </Portal>\n </ArkPopover.Root>\n );\n}\n\ninterface RowModel {\n item: ComboboxItem;\n index: number;\n rowId: string;\n itemCellId: string;\n facetCellId: string;\n highlighted: boolean;\n pinnable: boolean;\n pinned: boolean;\n pinActive: boolean;\n}\n\ninterface Section {\n label?: string;\n headingId: string;\n rows: RowModel[];\n}\n\ninterface ListProps {\n id: string;\n name: { 'aria-labelledby': string } | { 'aria-label': string | undefined };\n sections: Section[];\n emptyText: ReactNode;\n}\n\nconst rowState = (row: RowModel) => ({\n 'data-index': row.index,\n 'data-highlighted': row.highlighted ? '' : undefined,\n 'data-disabled': row.item.disabled ? '' : undefined,\n});\n\nfunction ItemText({ item }: { item: ComboboxItem }) {\n return (\n <>\n <span className=\"ds-combobox__item-label\">{item.label}</span>\n {item.description && (\n <>\n {' '}\n <span className=\"ds-combobox__item-description\">{item.description}</span>\n </>\n )}\n </>\n );\n}\n\n/*\n * The listbox's options and groups take their roles on plain elements: the\n * field keeps focus and points at an option with aria-activedescendant, so\n * none of them is focusable, and HTML has no element for an option outside\n * a native select. The lint rules asking for focusable or native elements\n * are therefore suppressed here, and only here.\n */\nfunction ListboxList({ id, name, sections, emptyText }: ListProps) {\n const option = (row: RowModel) => (\n // biome-ignore lint/a11y/useFocusableInteractive: reached through aria-activedescendant from the field, never by focus\n <div\n key={row.item.value}\n id={row.rowId}\n role=\"option\"\n aria-selected=\"false\"\n aria-disabled={row.item.disabled}\n className=\"ds-combobox__item\"\n {...rowState(row)}\n >\n <ItemText item={row.item} />\n </div>\n );\n return (\n <div id={id} role=\"listbox\" className=\"ds-combobox__list\" {...name}>\n {sections.map((section) =>\n section.label === undefined ? (\n section.rows.map(option)\n ) : (\n // biome-ignore lint/a11y/useSemanticElements: a fieldset is a form group, not a group of options\n <div\n key={section.label}\n role=\"group\"\n aria-labelledby={section.headingId}\n className=\"ds-combobox__group\"\n >\n <div id={section.headingId} className=\"ds-combobox__group-label\">\n {section.label}\n </div>\n {section.rows.map(option)}\n </div>\n ),\n )}\n {emptyText !== undefined && (\n // biome-ignore lint/a11y/useFocusableInteractive: a disabled option the keyboard never lands on\n <div\n role=\"option\"\n aria-disabled=\"true\"\n aria-selected=\"false\"\n className=\"ds-combobox__empty\"\n >\n {emptyText}\n </div>\n )}\n </div>\n );\n}\n\ninterface GridListProps extends ListProps {\n facets: ComboboxFacets;\n pinIcon: IconSource;\n}\n\n/*\n * A table in the grid role: its rows and cells line up in two columns by\n * themselves, and a group of rows is a `tbody` named by its heading row.\n * The keyboard skips heading rows, as it skips a listbox's group labels.\n */\nfunction GridList({ id, name, facets, sections, emptyText, pinIcon }: GridListProps) {\n const row = (model: RowModel) => <GridRow key={model.item.value} row={model} pinIcon={pinIcon} />;\n return (\n // biome-ignore lint/a11y/noNoninteractiveElementToInteractiveRole: a table in the grid role is the APG grid pattern; its cells line up by themselves\n <table id={id} role=\"grid\" className=\"ds-combobox__list ds-combobox__list--grid\" {...name}>\n <thead className=\"ds-visually-hidden\">\n <tr>\n <th scope=\"col\">{facets.itemLabel}</th>\n <th scope=\"col\">{facets.label}</th>\n </tr>\n </thead>\n {sections.map((section) =>\n section.label === undefined ? (\n <tbody key=\"ungrouped\">{section.rows.map(row)}</tbody>\n ) : (\n <tbody\n key={section.label}\n aria-labelledby={section.headingId}\n className=\"ds-combobox__group\"\n >\n <tr>\n <th\n id={section.headingId}\n colSpan={2}\n scope=\"colgroup\"\n className=\"ds-combobox__group-label\"\n >\n {section.label}\n </th>\n </tr>\n {section.rows.map(row)}\n </tbody>\n ),\n )}\n {emptyText !== undefined && (\n <tbody>\n <tr>\n <GridCell colSpan={2} aria-disabled=\"true\" className=\"ds-combobox__empty\">\n {emptyText}\n </GridCell>\n </tr>\n </tbody>\n )}\n </table>\n );\n}\n\n/*\n * A cell of the grid, named so explicitly: a `td` in a grid table is a\n * gridcell to browsers, but not to every tool, and the field keeps focus\n * and points at the cell with aria-activedescendant, so it is not focusable.\n */\nfunction GridCell(props: TdHTMLAttributes<HTMLTableCellElement>) {\n // biome-ignore lint/a11y/useFocusableInteractive: reached through aria-activedescendant from the field, never by focus\n // biome-ignore lint/a11y/noNoninteractiveElementToInteractiveRole: a td in a grid table is a gridcell; named so for every tool\n return <td role=\"gridcell\" {...props} />;\n}\n\nfunction GridRow({ row, pinIcon }: { row: RowModel; pinIcon: IconSource }) {\n const { item } = row;\n return (\n <tr id={row.rowId} className=\"ds-combobox__item\" {...rowState(row)}>\n <GridCell id={row.itemCellId} className=\"ds-combobox__cell\" aria-disabled={item.disabled}>\n <ItemText item={item} />\n </GridCell>\n <GridCell id={row.facetCellId} className=\"ds-combobox__facet\">\n {item.facet && <FacetCell facet={item.facet} row={row} pinIcon={pinIcon} />}\n </GridCell>\n </tr>\n );\n}\n\nfunction FacetCell({\n facet,\n row,\n pinIcon,\n}: {\n facet: ComboboxFacet;\n row: RowModel;\n pinIcon: IconSource;\n}) {\n return (\n <span className=\"ds-combobox__facet-content\">\n {facet.icon}\n <span className=\"ds-combobox__facet-label\">{facet.label}</span>\n {row.pinnable && (\n <Tooltip content={`Filter by ${facet.label}`} kind=\"label\">\n <button\n type=\"button\"\n tabIndex={-1}\n className=\"ds-combobox__pin\"\n aria-label={`Filter by ${facet.label}`}\n aria-pressed={row.pinned}\n data-pin=\"\"\n data-active={row.pinActive ? '' : undefined}\n >\n <Icon source={pinIcon} size=\"sm\" decorative />\n </button>\n </Tooltip>\n )}\n </span>\n );\n}\n\ninterface PinnedChipProps {\n facet: ComboboxFacet;\n removeIcon: IconSource;\n onRemove: () => void;\n}\n\nfunction PinnedChip({ facet, removeIcon, onRemove }: PinnedChipProps) {\n return (\n <span className=\"ds-combobox__chip\">\n {facet.icon}\n <span>{facet.label}</span>\n <Tooltip content=\"Stop filtering\" kind=\"label\">\n <button\n type=\"button\"\n className=\"ds-combobox__chip-remove\"\n aria-label={`Stop filtering by ${facet.label}`}\n onClick={onRemove}\n >\n <Icon source={removeIcon} size=\"sm\" decorative />\n </button>\n </Tooltip>\n </span>\n );\n}\n"]}
1
+ {"version":3,"file":"combobox.js","sourceRoot":"","sources":["../../src/combobox/combobox.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAQL,WAAW,EACX,UAAU,EACV,SAAS,EACT,KAAK,EACL,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAmB,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,wCAAwC,CAAC;AAChD,OAAO,gBAAgB,CAAC;AAwHxB,sDAAsD;AACtD,MAAM,eAAe,GAAG,gEAAgE,CAAC;AAEzF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,UAAU,QAAQ,CAAC,EACvB,KAAK,EACL,UAAU,EACV,kBAAkB,EAClB,QAAQ,EACR,KAAK,EACL,YAAY,EAAE,SAAS,EACvB,WAAW,EACX,SAAS,EACT,OAAO,EACP,MAAM,EACN,MAAM,EACN,OAAO,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YAAE,KAAK,CAAC,KAAK,GAAQ,EAC9D,GAAG,CAAC,QAAQ,IAAI,CACf,KAAC,OAAO,IAAC,OAAO,EAAE,aAAa,KAAK,CAAC,KAAK,EAAE,EAAE,IAAI,EAAC,OAAO,YACxD,iBACE,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,CAAC,CAAC,EACZ,SAAS,EAAC,kBAAkB,gBAChB,aAAa,KAAK,CAAC,KAAK,EAAE,kBACxB,GAAG,CAAC,MAAM,cACf,EAAE,iBACE,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,YAE3C,KAAC,IAAI,IAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAC,IAAI,EAAC,UAAU,SAAG,GACvC,GACD,CACX,IACI,CACR,CAAC;AACJ,CAAC;AAQD,SAAS,UAAU,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAmB;IAClE,OAAO,CACL,gBAAM,SAAS,EAAC,mBAAmB,aAChC,KAAK,CAAC,IAAI,EACX,yBAAO,KAAK,CAAC,KAAK,GAAQ,EAC1B,KAAC,OAAO,IAAC,OAAO,EAAC,gBAAgB,EAAC,IAAI,EAAC,OAAO,YAC5C,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,0BAA0B,gBACxB,qBAAqB,KAAK,CAAC,KAAK,EAAE,EAC9C,OAAO,EAAE,QAAQ,YAEjB,KAAC,IAAI,IAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAC,IAAI,EAAC,UAAU,SAAG,GAC1C,GACD,IACL,CACR,CAAC;AACJ,CAAC","sourcesContent":["import { Popover as ArkPopover } from '@ark-ui/react/popover';\nimport { Portal } from '@ark-ui/react/portal';\nimport { getTabbableEdges, getTabbables, isComposingEvent } from '@zag-js/dom-query';\nimport {\n type ChangeEvent,\n type KeyboardEvent,\n type MouseEvent,\n type PointerEvent,\n type ReactNode,\n type Ref,\n type TdHTMLAttributes,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { flushSync } from 'react-dom';\nimport { cx } from '../cx';\nimport { groupItems } from '../group-items';\nimport { Icon, type IconSource } from '../icon/icon';\nimport { useIconDefaults } from '../icon-defaults';\nimport { PortalContainerContext } from '../portal-container';\nimport { Tooltip } from '../tooltip/tooltip';\nimport '../visually-hidden/visually-hidden.css';\nimport './combobox.css';\n\nexport type ComboboxSize = 'sm' | 'md' | 'lg';\n\n/** What an option belongs to, shown in a second column: its category, its project. */\nexport interface ComboboxFacet {\n /** Stable value reported when the facet is pinned. */\n value: string;\n /** Text in the facet column, and in the pinned chip. */\n label: string;\n /** Decorative mark before the label, such as the category's icon. */\n icon?: ReactNode;\n}\n\nexport interface ComboboxItem {\n /** Stable value reported by `onSelect`. */\n value: string;\n /** Option text, also what screen readers use. */\n label: string;\n /** Optional secondary line under the label, shown muted. */\n description?: string;\n /** Individually disable this option without removing it. */\n disabled?: boolean;\n /**\n * The group the option is listed under, by its heading. Options sharing a\n * group are listed together under it, groups in the order they first\n * appear; options without one (or with an empty name) are listed before\n * any group.\n */\n group?: string;\n /** What the option belongs to, shown in the facet column when `facets` is set. */\n facet?: ComboboxFacet;\n}\n\n/**\n * A second column naming what each option belongs to, with a pin that\n * narrows the list to it.\n */\nexport interface ComboboxFacets {\n /** Heading of the option column, for assistive tech: \"Action\". */\n itemLabel: string;\n /** Heading of the facet column, for assistive tech: \"Category\". */\n label: string;\n /** The facet the list is narrowed to, shown as a removable chip in the status line. */\n pinned?: ComboboxFacet | null;\n /**\n * Pins a row's facet, or unpins it with `null` (its pin pressed again, the\n * chip's remove button, or Backspace in the empty field). The caller does\n * the narrowing. Without it, the facet column shows no pins.\n */\n onPinnedChange?: (facet: ComboboxFacet | null) => void;\n}\n\nexport interface ComboboxProps {\n /**\n * Suggestions for the current text.\n *\n * The caller filters, sorts and groups them; the component does not. What\n * counts as a match (a prefix, a substring, a category's name, anything\n * not already chosen) is the product's call, and the list it passes is the\n * list that shows.\n */\n items: ComboboxItem[];\n /** Controlled text in the input. */\n inputValue: string;\n /** Fired with the new text on every keystroke, and with `''` after a choice. */\n onInputValueChange: (value: string) => void;\n /**\n * A suggestion was chosen. The input then clears (`onInputValueChange('')`)\n * and the field holds no value: this is the \"add to a list\" pattern. A\n * field that keeps its choice is a `Select`.\n */\n onSelect: (value: string) => void;\n /**\n * Visible label. Strongly preferred over `aria-label` — a visible label\n * helps everyone, not only screen reader users.\n */\n label?: ReactNode;\n /** Accessible name when no visible `label` is supplied. */\n 'aria-label'?: string;\n /** Text shown in the empty input. */\n placeholder?: string;\n /** Shown in the open list when `items` is empty. */\n emptyText?: ReactNode;\n /**\n * Controls at the top of the open list that change what it shows: a\n * `Switch`, a small `SegmentGroup`. One row of them, so the options stay\n * in view; Tab moves into them from the field.\n */\n toolbar?: ReactNode;\n /**\n * One line under the toolbar saying what the list shows, such as \"Showing\n * all actions in Health\". Announced politely as it changes.\n */\n status?: ReactNode;\n /** Adds the facet column, with its pins. The list becomes a grid. */\n facets?: ComboboxFacets;\n /** Glyph of a row's pin. Defaults to the `IconDefaultsProvider`'s `pin`. */\n pinIcon?: IconSource;\n /** Glyph of the pinned chip's remove button. Defaults to the `IconDefaultsProvider`'s `cross`. */\n removeIcon?: IconSource;\n /** Control height and type scale. */\n size?: ComboboxSize;\n /** Disable the whole control. */\n disabled?: boolean;\n /** Marks the field invalid for assistive tech and styling. */\n invalid?: boolean;\n /** Extra class names appended after `ds-combobox` modifiers. */\n className?: string;\n /** The text input, for moving focus back to the field, e.g. after removing an item it added. */\n inputRef?: Ref<HTMLInputElement>;\n}\n\ntype Cell = 'item' | 'facet';\n\ninterface Active {\n value: string;\n cell: Cell;\n}\n\n// The header's own controls, which a press may focus.\nconst HEADER_CONTROLS = 'button, input, label, a[href], [tabindex]:not([tabindex=\"-1\"])';\n\n/**\n * A text input that suggests options as you type, with optional controls at\n * the top of the open list.\n *\n * Choosing a suggestion reports it through `onSelect` and empties the input,\n * so the field is ready for the next one: the control for adding items to a\n * list one at a time. It never holds a selection itself; the caller keeps\n * the list. For a field that keeps one choice, use `Select`.\n *\n * The open list can carry what narrows it, so nothing sits outside the\n * field: a `toolbar` row of switches or a segment group, a `status` line\n * saying what is shown, and with `facets` a second column naming what each\n * option belongs to, whose pin narrows the list to it.\n *\n * ```tsx\n * <Combobox\n * label=\"Add actions\"\n * items={matches}\n * inputValue={query}\n * onInputValueChange={setQuery}\n * onSelect={(value) => setPicked((list) => [...list, value])}\n * toolbar={<Switch size=\"sm\" label=\"Include categories\" checked={…} onCheckedChange={…} />}\n * status={`Showing all actions that contain “${query}”`}\n * facets={{ itemLabel: 'Action', label: 'Category', pinned, onPinnedChange: setPinned }}\n * />\n * ```\n *\n * The field is the APG editable combobox. Focus stays in the input, and the\n * active option is `aria-activedescendant`. Typing highlights the first\n * option, so Enter takes it, and Up and Down walk the options in their drawn\n * order. With `facets` the popup is a grid instead of a listbox: Right, at\n * the end of the text, moves onto the row's pin and Enter then pins it, and\n * Left moves back. Tab moves from the field into the toolbar and the chip,\n * and on out to the next field.\n *\n * The popup is an Ark Popover anchored to the field, so it takes part in\n * the dismiss stack. Escape closes it before a `Dialog` around it, and a\n * click outside closes it. Its wrapper drops the Popover's dialog role, so\n * the listbox or grid inside is the popup assistive tech meets. It portals\n * like `Select`'s list: into `<body>`, or into the panel of the ui-core\n * `Dialog` it opens in, at `z-index: 60`.\n * The field reads the `--ds-input-*` keys and the list the `--ds-select-*`\n * keys, so it reads as one family with `Input` and `Select`.\n */\nexport function Combobox({\n items,\n inputValue,\n onInputValueChange,\n onSelect,\n label,\n 'aria-label': ariaLabel,\n placeholder,\n emptyText,\n toolbar,\n status,\n facets,\n pinIcon: pinIconProp,\n removeIcon: removeIconProp,\n size = 'md',\n disabled,\n invalid,\n className,\n inputRef,\n}: ComboboxProps) {\n const icons = useIconDefaults();\n const pinIcon = pinIconProp ?? icons.pin;\n const removeIcon = removeIconProp ?? icons.cross;\n const id = useId();\n const inputId = `${id}-input`;\n const labelId = `${id}-label`;\n const listId = `${id}-list`;\n const statusId = `${id}-status`;\n const rowId = (index: number) => `${id}-row-${index}`;\n const cellId = (index: number, cell: Cell) => `${id}-cell-${index}-${cell}`;\n\n const rootRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const headerRef = useRef<HTMLDivElement>(null);\n const inputEl = useRef<HTMLInputElement | null>(null);\n const portalContainer = useContext(PortalContainerContext);\n\n const [open, setOpen] = useState(false);\n const [chosen, setChosen] = useState<Active | null>(null);\n const isOpen = open && !disabled;\n const isGrid = facets !== undefined;\n const pinned = facets?.pinned ?? null;\n const canPin = (item: ComboboxItem) => Boolean(facets?.onPinnedChange && item.facet);\n\n const groups = useMemo(() => groupItems(items), [items]);\n const ordered = useMemo(() => groups.flatMap((group) => group.items), [groups]);\n const navigable = useMemo(() => ordered.filter((item) => !item.disabled), [ordered]);\n\n const chosenItem = chosen && navigable.find((item) => item.value === chosen.value);\n const active: Active | null = chosenItem\n ? {\n value: chosenItem.value,\n cell: chosen?.cell === 'facet' && canPin(chosenItem) ? 'facet' : 'item',\n }\n : inputValue !== '' && navigable[0]\n ? { value: navigable[0].value, cell: 'item' }\n : null;\n const activeIndex = active ? ordered.findIndex((item) => item.value === active.value) : -1;\n const activeDescendant =\n isOpen && active && activeIndex >= 0\n ? isGrid\n ? cellId(activeIndex, active.cell)\n : rowId(activeIndex)\n : undefined;\n\n const setInputRef = useCallback(\n (element: HTMLInputElement | null) => {\n inputEl.current = element;\n if (typeof inputRef === 'function') inputRef(element);\n else if (inputRef) inputRef.current = element;\n },\n [inputRef],\n );\n\n /*\n * The popup portals out of the field, so the browser's Tab order would\n * skip it. While it is open, Tab from the field moves into its header's\n * controls, Tab from the last one moves on to whatever follows the field,\n * and Shift+Tab walks back the same way. Only the header counts, as the\n * pins are reached with the arrows; with no header control, Tab is the\n * browser's. A window listener, so it lives in an effect, and so it runs\n * ahead of a Dialog's focus trap: the popup is the end of the dialog's\n * panel, and the trap would wrap Tab from its last control to the\n * dialog's first.\n */\n useEffect(() => {\n if (!isOpen) return;\n const handleTab = (event: globalThis.KeyboardEvent) => {\n const header = headerRef.current;\n const content = contentRef.current;\n const field = inputEl.current;\n if (event.key !== 'Tab' || !header || !content || !field) return;\n const [first, last] = getTabbableEdges(header);\n if (!first || !last) return;\n const scope = field.closest<HTMLElement>('[aria-modal=\"true\"]') ?? field.ownerDocument.body;\n const tabbables = getTabbables(scope);\n const after = tabbables\n .slice(tabbables.indexOf(field) + 1)\n .find((element) => !content.contains(element));\n const current = field.ownerDocument.activeElement;\n let target: HTMLElement | undefined;\n if (event.shiftKey) target = current === first ? field : current === after ? last : undefined;\n else target = current === field ? first : current === last ? after : undefined;\n if (!target) return;\n event.preventDefault();\n if (target === after) event.stopPropagation();\n target.focus({ preventScroll: true });\n };\n window.addEventListener('keydown', handleTab, true);\n return () => window.removeEventListener('keydown', handleTab, true);\n }, [isOpen]);\n\n const activate = (next: Active | null) => {\n flushSync(() => setChosen(next));\n if (!next) return;\n const index = ordered.findIndex((item) => item.value === next.value);\n document.getElementById(rowId(index))?.scrollIntoView?.({ block: 'nearest' });\n };\n\n const move = (step: 1 | -1) => {\n if (navigable.length === 0) return;\n const from = active ? navigable.findIndex((item) => item.value === active.value) : -1;\n const to =\n from === -1\n ? step === 1\n ? 0\n : navigable.length - 1\n : (from + step + navigable.length) % navigable.length;\n const item = navigable[to];\n activate({\n value: item.value,\n cell: active?.cell === 'facet' && canPin(item) ? 'facet' : 'item',\n });\n };\n\n const focusFieldFromPopup = () => {\n if (contentRef.current?.contains(document.activeElement)) inputEl.current?.focus();\n };\n\n const handleOpenChange = (details: { open: boolean }) => {\n setOpen(details.open);\n if (!details.open) setChosen(null);\n };\n\n const choose = (item: ComboboxItem) => {\n if (item.disabled) return;\n focusFieldFromPopup();\n onSelect(item.value);\n onInputValueChange('');\n setChosen(null);\n setOpen(false);\n };\n\n const togglePin = (facet: ComboboxFacet) => {\n facets?.onPinnedChange?.(pinned?.value === facet.value ? null : facet);\n setChosen(null);\n };\n\n const unpin = () => {\n facets?.onPinnedChange?.(null);\n inputEl.current?.focus();\n };\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n setChosen(null);\n setOpen(true);\n onInputValueChange(event.target.value);\n };\n\n const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (isComposingEvent(event) || event.ctrlKey || event.shiftKey) return;\n const input = event.currentTarget;\n const activeItem = activeIndex >= 0 ? ordered[activeIndex] : undefined;\n const caretAtEnd =\n input.selectionStart === input.value.length && input.selectionEnd === input.value.length;\n\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault();\n if (!isOpen) setOpen(true);\n move(event.key === 'ArrowDown' ? 1 : -1);\n } else if (event.key === 'ArrowRight' && isOpen && activeItem && active?.cell === 'item') {\n if (isGrid && canPin(activeItem) && caretAtEnd) {\n event.preventDefault();\n activate({ value: activeItem.value, cell: 'facet' });\n }\n } else if (event.key === 'ArrowLeft' && isOpen && activeItem && active?.cell === 'facet') {\n event.preventDefault();\n activate({ value: activeItem.value, cell: 'item' });\n } else if (event.key === 'Enter' && isOpen && activeItem) {\n event.preventDefault();\n if (active?.cell === 'facet' && activeItem.facet) togglePin(activeItem.facet);\n else choose(activeItem);\n } else if (event.key === 'Backspace' && input.value === '' && pinned) {\n facets?.onPinnedChange?.(null);\n }\n };\n\n const rowIndexOf = (target: EventTarget) => {\n const row = (target as Element).closest<HTMLElement>('[data-index]');\n return row ? Number(row.dataset.index) : -1;\n };\n\n const handleListClick = (event: MouseEvent) => {\n const item = ordered[rowIndexOf(event.target)];\n if (!item) return;\n if ((event.target as Element).closest('[data-pin]') && item.facet) togglePin(item.facet);\n else choose(item);\n };\n\n const handleListPointerMove = (event: PointerEvent) => {\n const item = ordered[rowIndexOf(event.target)];\n if (item && !item.disabled && item.value !== active?.value) {\n setChosen({ value: item.value, cell: 'item' });\n }\n };\n\n const listName = label ? { 'aria-labelledby': labelId } : { 'aria-label': ariaLabel };\n const hasStatus = status !== undefined || pinned !== null;\n const hasHeader = toolbar !== undefined || hasStatus;\n const isEmpty = items.length === 0 && emptyText !== undefined;\n\n const rowOf = (item: ComboboxItem): RowModel => {\n const index = ordered.indexOf(item);\n const isActive = isOpen && index === activeIndex;\n return {\n item,\n index,\n rowId: rowId(index),\n itemCellId: cellId(index, 'item'),\n facetCellId: cellId(index, 'facet'),\n highlighted: isActive,\n pinnable: canPin(item),\n pinned: pinned !== null && pinned.value === item.facet?.value,\n pinActive: isActive && active?.cell === 'facet',\n };\n };\n const sections: Section[] = groups.map((group, groupIndex) => ({\n label: group.label,\n headingId: `${id}-group-${groupIndex}`,\n rows: group.items.map(rowOf),\n }));\n\n /*\n * Mouse input never takes focus from the field, so typing carries on: a\n * press on a row, a pin or the header's background is cancelled. Only the\n * header's own controls (a switch, a segment, the chip's remove button)\n * take focus, as they would anywhere.\n */\n const handleContentMouseDown = (event: MouseEvent) => {\n const target = event.target as Element;\n if (target.closest('.ds-combobox__list') || !target.closest(HEADER_CONTROLS)) {\n event.preventDefault();\n }\n };\n\n return (\n <ArkPopover.Root\n open={isOpen}\n onOpenChange={handleOpenChange}\n lazyMount\n unmountOnExit\n autoFocus={false}\n restoreFocus={false}\n portalled={false}\n persistentElements={[() => rootRef.current]}\n onEscapeKeyDown={focusFieldFromPopup}\n positioning={{ placement: 'bottom-start', sameWidth: true }}\n >\n <div ref={rootRef} className={cx('ds-combobox', `ds-combobox--${size}`, className)}>\n {label && (\n <label\n id={labelId}\n htmlFor={inputId}\n className=\"ds-combobox__label\"\n data-disabled={disabled ? '' : undefined}\n >\n {label}\n </label>\n )}\n <ArkPopover.Anchor className=\"ds-combobox__control\">\n <input\n ref={setInputRef}\n id={inputId}\n type=\"text\"\n role=\"combobox\"\n className=\"ds-combobox__input\"\n value={inputValue}\n placeholder={placeholder}\n aria-label={label ? undefined : ariaLabel}\n aria-autocomplete=\"list\"\n aria-haspopup={isGrid ? 'grid' : 'listbox'}\n aria-expanded={isOpen}\n aria-controls={isOpen ? listId : undefined}\n aria-activedescendant={activeDescendant}\n aria-describedby={isOpen && hasStatus ? statusId : undefined}\n aria-invalid={invalid || undefined}\n data-invalid={invalid ? '' : undefined}\n disabled={disabled}\n autoComplete=\"off\"\n autoCorrect=\"off\"\n autoCapitalize=\"none\"\n spellCheck={false}\n onChange={handleChange}\n onClick={() => setOpen(true)}\n onKeyDown={handleKeyDown}\n />\n </ArkPopover.Anchor>\n </div>\n\n <Portal container={portalContainer}>\n <ArkPopover.Positioner>\n <ArkPopover.Content\n ref={contentRef}\n role=\"presentation\"\n className=\"ds-combobox__content\"\n onMouseDown={handleContentMouseDown}\n onClick={handleListClick}\n onPointerMove={handleListPointerMove}\n >\n {hasHeader && (\n <div ref={headerRef} className=\"ds-combobox__header\">\n {toolbar && <div className=\"ds-combobox__toolbar\">{toolbar}</div>}\n {hasStatus && (\n <p id={statusId} role=\"status\" className=\"ds-combobox__status\">\n {status}\n {pinned && (\n <>\n {' '}\n <PinnedChip facet={pinned} removeIcon={removeIcon} onRemove={unpin} />\n </>\n )}\n </p>\n )}\n </div>\n )}\n {facets ? (\n <GridList\n id={listId}\n name={listName}\n facets={facets}\n sections={sections}\n emptyText={isEmpty ? emptyText : undefined}\n pinIcon={pinIcon}\n />\n ) : (\n <ListboxList\n id={listId}\n name={listName}\n sections={sections}\n emptyText={isEmpty ? emptyText : undefined}\n />\n )}\n </ArkPopover.Content>\n </ArkPopover.Positioner>\n </Portal>\n </ArkPopover.Root>\n );\n}\n\ninterface RowModel {\n item: ComboboxItem;\n index: number;\n rowId: string;\n itemCellId: string;\n facetCellId: string;\n highlighted: boolean;\n pinnable: boolean;\n pinned: boolean;\n pinActive: boolean;\n}\n\ninterface Section {\n label?: string;\n headingId: string;\n rows: RowModel[];\n}\n\ninterface ListProps {\n id: string;\n name: { 'aria-labelledby': string } | { 'aria-label': string | undefined };\n sections: Section[];\n emptyText: ReactNode;\n}\n\nconst rowState = (row: RowModel) => ({\n 'data-index': row.index,\n 'data-highlighted': row.highlighted ? '' : undefined,\n 'data-disabled': row.item.disabled ? '' : undefined,\n});\n\nfunction ItemText({ item }: { item: ComboboxItem }) {\n return (\n <>\n <span className=\"ds-combobox__item-label\">{item.label}</span>\n {item.description && (\n <>\n {' '}\n <span className=\"ds-combobox__item-description\">{item.description}</span>\n </>\n )}\n </>\n );\n}\n\n/*\n * The listbox's options and groups take their roles on plain elements: the\n * field keeps focus and points at an option with aria-activedescendant, so\n * none of them is focusable, and HTML has no element for an option outside\n * a native select. The lint rules asking for focusable or native elements\n * are therefore suppressed here, and only here.\n */\nfunction ListboxList({ id, name, sections, emptyText }: ListProps) {\n const option = (row: RowModel) => (\n // biome-ignore lint/a11y/useFocusableInteractive: reached through aria-activedescendant from the field, never by focus\n <div\n key={row.item.value}\n id={row.rowId}\n role=\"option\"\n aria-selected=\"false\"\n aria-disabled={row.item.disabled}\n className=\"ds-combobox__item\"\n {...rowState(row)}\n >\n <ItemText item={row.item} />\n </div>\n );\n return (\n <div id={id} role=\"listbox\" className=\"ds-combobox__list\" {...name}>\n {sections.map((section) =>\n section.label === undefined ? (\n section.rows.map(option)\n ) : (\n // biome-ignore lint/a11y/useSemanticElements: a fieldset is a form group, not a group of options\n <div\n key={section.label}\n role=\"group\"\n aria-labelledby={section.headingId}\n className=\"ds-combobox__group\"\n >\n <div id={section.headingId} className=\"ds-combobox__group-label\">\n {section.label}\n </div>\n {section.rows.map(option)}\n </div>\n ),\n )}\n {emptyText !== undefined && (\n // biome-ignore lint/a11y/useFocusableInteractive: a disabled option the keyboard never lands on\n <div\n role=\"option\"\n aria-disabled=\"true\"\n aria-selected=\"false\"\n className=\"ds-combobox__empty\"\n >\n {emptyText}\n </div>\n )}\n </div>\n );\n}\n\ninterface GridListProps extends ListProps {\n facets: ComboboxFacets;\n pinIcon: IconSource;\n}\n\n/*\n * A table in the grid role: its rows and cells line up in two columns by\n * themselves, and a group of rows is a `tbody` named by its heading row.\n * The keyboard skips heading rows, as it skips a listbox's group labels.\n */\nfunction GridList({ id, name, facets, sections, emptyText, pinIcon }: GridListProps) {\n const row = (model: RowModel) => <GridRow key={model.item.value} row={model} pinIcon={pinIcon} />;\n return (\n // biome-ignore lint/a11y/noNoninteractiveElementToInteractiveRole: a table in the grid role is the APG grid pattern; its cells line up by themselves\n <table id={id} role=\"grid\" className=\"ds-combobox__list ds-combobox__list--grid\" {...name}>\n <thead className=\"ds-visually-hidden\">\n <tr>\n <th scope=\"col\">{facets.itemLabel}</th>\n <th scope=\"col\">{facets.label}</th>\n </tr>\n </thead>\n {sections.map((section) =>\n section.label === undefined ? (\n <tbody key=\"ungrouped\">{section.rows.map(row)}</tbody>\n ) : (\n <tbody\n key={section.label}\n aria-labelledby={section.headingId}\n className=\"ds-combobox__group\"\n >\n <tr>\n <th\n id={section.headingId}\n colSpan={2}\n scope=\"colgroup\"\n className=\"ds-combobox__group-label\"\n >\n {section.label}\n </th>\n </tr>\n {section.rows.map(row)}\n </tbody>\n ),\n )}\n {emptyText !== undefined && (\n <tbody>\n <tr>\n <GridCell colSpan={2} aria-disabled=\"true\" className=\"ds-combobox__empty\">\n {emptyText}\n </GridCell>\n </tr>\n </tbody>\n )}\n </table>\n );\n}\n\n/*\n * A cell of the grid, named so explicitly: a `td` in a grid table is a\n * gridcell to browsers, but not to every tool, and the field keeps focus\n * and points at the cell with aria-activedescendant, so it is not focusable.\n */\nfunction GridCell(props: TdHTMLAttributes<HTMLTableCellElement>) {\n // biome-ignore lint/a11y/useFocusableInteractive: reached through aria-activedescendant from the field, never by focus\n // biome-ignore lint/a11y/noNoninteractiveElementToInteractiveRole: a td in a grid table is a gridcell; named so for every tool\n return <td role=\"gridcell\" {...props} />;\n}\n\nfunction GridRow({ row, pinIcon }: { row: RowModel; pinIcon: IconSource }) {\n const { item } = row;\n return (\n <tr id={row.rowId} className=\"ds-combobox__item\" {...rowState(row)}>\n <GridCell id={row.itemCellId} className=\"ds-combobox__cell\" aria-disabled={item.disabled}>\n <ItemText item={item} />\n </GridCell>\n <GridCell id={row.facetCellId} className=\"ds-combobox__facet\">\n {item.facet && <FacetCell facet={item.facet} row={row} pinIcon={pinIcon} />}\n </GridCell>\n </tr>\n );\n}\n\nfunction FacetCell({\n facet,\n row,\n pinIcon,\n}: {\n facet: ComboboxFacet;\n row: RowModel;\n pinIcon: IconSource;\n}) {\n return (\n <span className=\"ds-combobox__facet-content\">\n {facet.icon}\n <span className=\"ds-combobox__facet-label\">{facet.label}</span>\n {row.pinnable && (\n <Tooltip content={`Filter by ${facet.label}`} kind=\"label\">\n <button\n type=\"button\"\n tabIndex={-1}\n className=\"ds-combobox__pin\"\n aria-label={`Filter by ${facet.label}`}\n aria-pressed={row.pinned}\n data-pin=\"\"\n data-active={row.pinActive ? '' : undefined}\n >\n <Icon source={pinIcon} size=\"sm\" decorative />\n </button>\n </Tooltip>\n )}\n </span>\n );\n}\n\ninterface PinnedChipProps {\n facet: ComboboxFacet;\n removeIcon: IconSource;\n onRemove: () => void;\n}\n\nfunction PinnedChip({ facet, removeIcon, onRemove }: PinnedChipProps) {\n return (\n <span className=\"ds-combobox__chip\">\n {facet.icon}\n <span>{facet.label}</span>\n <Tooltip content=\"Stop filtering\" kind=\"label\">\n <button\n type=\"button\"\n className=\"ds-combobox__chip-remove\"\n aria-label={`Stop filtering by ${facet.label}`}\n onClick={onRemove}\n >\n <Icon source={removeIcon} size=\"sm\" decorative />\n </button>\n </Tooltip>\n </span>\n );\n}\n"]}
@@ -74,9 +74,8 @@ export interface DialogProps {
74
74
  /** Accessible name of the close button. Translate it with the rest of the UI. */
75
75
  closeLabel?: string;
76
76
  /**
77
- * Glyph for the close button. Defaults to a plain built-in cross so
78
- * `@manakind/ui-core` renders on its own; products pass their own icon set,
79
- * as they do for Select's indicators.
77
+ * Glyph for the close button. Defaults to the `IconDefaultsProvider`'s
78
+ * `cross`, or a plain built-in one.
80
79
  */
81
80
  closeIcon?: IconSource;
82
81
  /**
@@ -139,5 +138,5 @@ export interface DialogProps {
139
138
  * dialog portals into its panel (see `PortalContainerContext`) and opens at
140
139
  * 60, above it. Nothing is mounted while the dialog is closed.
141
140
  */
142
- export declare function Dialog({ title, description, children, actions, trigger, open, defaultOpen, onOpenChange, role, initialFocusRef, finalFocusRef, closeLabel, closeIcon, size, presentation, className, }: DialogProps): import("react/jsx-runtime").JSX.Element;
141
+ export declare function Dialog({ title, description, children, actions, trigger, open, defaultOpen, onOpenChange, role, initialFocusRef, finalFocusRef, closeLabel, closeIcon: closeIconProp, size, presentation, className, }: DialogProps): import("react/jsx-runtime").JSX.Element;
143
142
  //# sourceMappingURL=dialog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/dialog/dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/C,OAAO,cAAc,CAAC;AAItB,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,aAAa,CAAC;AAElD,gGAAgG;AAChG,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,CAAC;AAErC,4EAA4E;AAC5E,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,MAAM,CAAC;AAElD,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,KAAK,EAAE,SAAS,CAAC;IACjB;;;;OAIG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB;;;;OAIG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,uDAAuD;IACvD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,4CAA4C;IAC5C,WAAW,CAAC,EAAE,OAAO,CAAC;IAC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EACb,UAAoB,EACpB,SAAS,EAAE,aAAa,EACxB,IAAW,EACX,YAAsB,EACtB,SAAS,GACV,EAAE,WAAW,2CAgHb"}
@@ -8,7 +8,7 @@ import { PortalContainerContext } from '../portal-container';
8
8
  import { SidePanelSlotContext } from '../side-panel-layout/side-panel-context';
9
9
  import './dialog.css';
10
10
  import { cx } from '../cx';
11
- import { Cross } from '../fallback-glyphs';
11
+ import { useIconDefaults } from '../icon-defaults';
12
12
  /**
13
13
  * A modal dialog: a raised panel over a dimmed page, built on Ark UI.
14
14
  *
@@ -44,7 +44,9 @@ import { Cross } from '../fallback-glyphs';
44
44
  * dialog portals into its panel (see `PortalContainerContext`) and opens at
45
45
  * 60, above it. Nothing is mounted while the dialog is closed.
46
46
  */
47
- export function Dialog({ title, description, children, actions, trigger, open, defaultOpen, onOpenChange, role = 'dialog', initialFocusRef, finalFocusRef, closeLabel = 'Close', closeIcon = Cross, size = 'md', presentation = 'modal', className, }) {
47
+ export function Dialog({ title, description, children, actions, trigger, open, defaultOpen, onOpenChange, role = 'dialog', initialFocusRef, finalFocusRef, closeLabel = 'Close', closeIcon: closeIconProp, size = 'md', presentation = 'modal', className, }) {
48
+ const icons = useIconDefaults();
49
+ const closeIcon = closeIconProp ?? icons.cross;
48
50
  const dismissible = role === 'dialog';
49
51
  const slot = useContext(SidePanelSlotContext);
50
52
  const side = presentation === 'side' && dismissible && slot ? slot : undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../src/dialog/dialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAIL,WAAW,EACX,UAAU,EACV,eAAe,EACf,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;A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":["import { Dialog as ArkDialog, useDialogContext } from '@ark-ui/react/dialog';\nimport { Portal } from '@ark-ui/react/portal';\nimport {\n type ReactElement,\n type ReactNode,\n type RefObject,\n useCallback,\n useContext,\n useLayoutEffect,\n useRef,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { IconButton } from '../button/icon-button';\nimport type { IconSource } from '../icon/icon';\nimport { PortalContainerContext } from '../portal-container';\nimport { type SidePanelSlot, SidePanelSlotContext } from '../side-panel-layout/side-panel-context';\nimport './dialog.css';\nimport { cx } from '../cx';\nimport { Cross } from '../fallback-glyphs';\n\nexport type DialogRole = 'dialog' | 'alertdialog';\n\n/** How wide the panel may grow: a message or short form, or a form with fields side by side. */\nexport type DialogSize = 'md' | 'lg';\n\n/** Over the page with the rest of it shut off, or in a drawer beside it. */\nexport type DialogPresentation = 'modal' | 'side';\n\nexport interface DialogProps {\n /**\n * The dialog's name: rendered as its `<h2>` heading and announced when it\n * opens (`aria-labelledby`). Write it as a short statement or question —\n * \"Remove “Site foreman”?\".\n */\n title: ReactNode;\n /**\n * One or two sentences under the title, announced with it\n * (`aria-describedby`). For a confirmation, say what the action does and\n * what it leaves alone.\n */\n description?: ReactNode;\n /** Body content. Scrolls inside the panel when it outgrows the viewport. */\n children?: ReactNode;\n /**\n * The footer's buttons, end-aligned, in reading order: the dismissive one\n * first, the committing one last. They wrap onto a second line on a narrow\n * screen. Wrap a dismissive button in `DialogClose` to make it close.\n */\n actions?: ReactNode;\n /**\n * The one element that opens the dialog, such as a `Button`. Focus returns\n * to it when the dialog closes, unless `finalFocusRef` names another\n * element. Leave it out to open the dialog with `open` from elsewhere.\n */\n trigger?: ReactElement;\n /** Controlled open state. Pair with `onOpenChange`. */\n open?: boolean;\n /** Initial open state when uncontrolled. */\n defaultOpen?: boolean;\n /**\n * Fired with the requested state whenever the dialog asks to open (its\n * trigger) or close (a `DialogClose`, the close button, Escape, or for\n * `role=\"dialog\"` a click outside). A controlled dialog stays as it is\n * until `open` changes.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * `dialog` (default) shows a close button and closes on Escape and on a\n * click outside. `alertdialog` is for confirmations: no close button, and a\n * click outside does nothing, so the explicit cancel action is the way\n * out. Escape still cancels.\n */\n role?: DialogRole;\n /**\n * Where focus lands when the dialog opens. Defaults to the first focusable\n * element: the close button of a `dialog`, the first action of an\n * `alertdialog` with no focusable body. Point an alertdialog at its least\n * destructive action.\n */\n initialFocusRef?: RefObject<HTMLElement | null>;\n /**\n * Where focus lands when the dialog closes, in place of the trigger. Use it\n * when the confirmed action removes the trigger, such as a row's Remove\n * button: focus would return to an element that is about to unmount and\n * fall to the page body. Point it at something that stays, such as the\n * list's heading, which needs `tabIndex={-1}` to take focus.\n *\n * The ref is read as the dialog closes, however it closes. Fill it in the\n * committing action, so Cancel and Escape still return focus to the\n * trigger, which is still there. While the ref holds no element, focus\n * returns to the trigger as usual.\n */\n finalFocusRef?: RefObject<HTMLElement | null>;\n /** Accessible name of the close button. Translate it with the rest of the UI. */\n closeLabel?: string;\n /**\n * Glyph for the close button. Defaults to a plain built-in cross so\n * `@manakind/ui-core` renders on its own; products pass their own icon set,\n * as they do for Select's indicators.\n */\n closeIcon?: IconSource;\n /**\n * How wide the panel may grow: `md` (the default) for a message or a short\n * form, `lg` for a form with fields side by side.\n */\n size?: DialogSize;\n /**\n * `modal` (the default) floats the panel over a dimmed page. `side` opens\n * it in the drawer of the nearest `SidePanelLayout`, beside the content,\n * which stays in view and usable: a form for one item of a list the user\n * may want to browse while filling it in. A side panel traps no focus,\n * locks no scroll and stays open on a click outside. Escape closes it\n * while focus is in it or on no control, and leaves an Escape pressed on a\n * control in the page to that control. On close, focus returns as from a\n * modal unless the user had moved it onto the page. It is as wide as a `md` dialog, so `size`\n * does not apply. Opening another side dialog in the layout closes this\n * one through `onOpenChange`; a controlled dialog should honour it.\n *\n * Outside a `SidePanelLayout`, for `role=\"alertdialog\"`, which must hold\n * the user until they answer, and inside another dialog, the dialog opens\n * as a modal.\n */\n presentation?: DialogPresentation;\n /** Extra class names appended to the panel's `ds-dialog`. */\n className?: string;\n}\n\n/**\n * A modal dialog: a raised panel over a dimmed page, built on Ark UI.\n *\n * Ark owns the behaviour: the focus trap, focus returning to the trigger\n * (or to `finalFocusRef`), Escape, the page's scroll lock, `aria-modal`, and the title and\n * description wiring. This wrapper adds the `ds-` classes, the\n * `--ds-dialog-*` bindings, and a slot API in place of Ark's anatomy.\n *\n * ```tsx\n * <Dialog\n * role=\"alertdialog\"\n * title=\"Remove “Site foreman”?\"\n * description=\"2 people and 1 Landfall lose this type; nothing else is deleted.\"\n * trigger={<Button variant=\"secondary\">Remove</Button>}\n * initialFocusRef={cancelRef}\n * actions={\n * <>\n * <DialogClose>\n * <Button ref={cancelRef} variant=\"secondary\">Cancel</Button>\n * </DialogClose>\n * <Button variant=\"danger\" onClick={remove}>Remove</Button>\n * </>\n * }\n * />\n * ```\n *\n * The committing action is the consumer's own button. To close after it\n * runs, control the dialog with `open` and set it false in the handler, or\n * wrap the button in `DialogClose` when closing at once is right.\n *\n * The backdrop and panel portal into `<body>` at `z-index: 50`, the layer\n * the product apps use for their own overlays. A Select or Menu inside the\n * dialog portals into its panel (see `PortalContainerContext`) and opens at\n * 60, above it. Nothing is mounted while the dialog is closed.\n */\nexport function Dialog({\n title,\n description,\n children,\n actions,\n trigger,\n open,\n defaultOpen,\n onOpenChange,\n role = 'dialog',\n initialFocusRef,\n finalFocusRef,\n closeLabel = 'Close',\n closeIcon = Cross,\n size = 'md',\n presentation = 'modal',\n className,\n}: DialogProps) {\n const dismissible = role === 'dialog';\n const slot = useContext(SidePanelSlotContext);\n const side = presentation === 'side' && dismissible && slot ? slot : undefined;\n const panelRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const [sidePanel, setSidePanel] = useState<HTMLDivElement | null>(null);\n const sidePanelRef = useCallback((element: HTMLDivElement | null) => {\n panelRef.current = element;\n setSidePanel(element);\n }, []);\n const handleOpenChange = (details: { open: boolean }) => onOpenChange?.(details.open);\n // Zag types this as returning `HTMLElement | null`, but its focus trap\n // reads undefined as \"the first focusable element\" and, given null, fails\n // to start at all, leaving the page reachable by Tab.\n const initialFocusEl = (() => initialFocusRef?.current ?? undefined) as () => HTMLElement | null;\n const finalFocusEl = () => finalFocusRef?.current ?? null;\n // Zag's dismiss layer takes Escape anywhere in the document. A side panel\n // leaves the page usable, so an Escape meant for a control on the page,\n // such as a ReorderControl dropping its draft, must not close it too.\n const keepEscapeOnThePage = (event: KeyboardEvent) => {\n const target = event.target;\n const onThePage =\n target instanceof Node &&\n target !== target.ownerDocument?.body &&\n !panelRef.current?.contains(target);\n if (onThePage) event.preventDefault();\n };\n const panel = (\n <PortalContainerContext.Provider value={panelRef}>\n <div className=\"ds-dialog__header\">\n <div className=\"ds-dialog__heading\">\n <ArkDialog.Title className=\"ds-dialog__title\">{title}</ArkDialog.Title>\n {description && (\n <ArkDialog.Description className=\"ds-dialog__description\">\n {description}\n </ArkDialog.Description>\n )}\n </div>\n {dismissible && (\n <ArkDialog.CloseTrigger asChild>\n <IconButton\n icon={closeIcon}\n aria-label={closeLabel}\n variant=\"tertiary\"\n size=\"sm\"\n className=\"ds-dialog__close\"\n />\n </ArkDialog.CloseTrigger>\n )}\n </div>\n {children && <DialogBody>{children}</DialogBody>}\n {actions && <div className=\"ds-dialog__actions\">{actions}</div>}\n </PortalContainerContext.Provider>\n );\n const content = (\n <SidePanelSlotContext.Provider value={undefined}>{panel}</SidePanelSlotContext.Provider>\n );\n\n return (\n <ArkDialog.Root\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={handleOpenChange}\n role={role}\n modal={!side}\n closeOnInteractOutside={dismissible && !side}\n onEscapeKeyDown={side ? keepEscapeOnThePage : undefined}\n initialFocusEl={initialFocusEl}\n finalFocusEl={finalFocusEl}\n lazyMount\n unmountOnExit\n >\n {trigger && (\n <ArkDialog.Trigger ref={triggerRef} asChild>\n {trigger}\n </ArkDialog.Trigger>\n )}\n {side ? (\n side.container &&\n createPortal(\n <ArkDialog.Content\n ref={sidePanelRef}\n className={cx('ds-dialog', 'ds-dialog--side', className)}\n >\n <SidePanelSeat\n claim={side.claim}\n panel={sidePanel}\n triggerRef={triggerRef}\n finalFocusRef={finalFocusRef}\n />\n {content}\n </ArkDialog.Content>,\n side.container,\n )\n ) : (\n <Portal>\n <ArkDialog.Backdrop className=\"ds-dialog__backdrop\" />\n <ArkDialog.Positioner className=\"ds-dialog__positioner\">\n <ArkDialog.Content\n ref={panelRef}\n className={cx('ds-dialog', size === 'lg' && 'ds-dialog--lg', className)}\n >\n {content}\n </ArkDialog.Content>\n </ArkDialog.Positioner>\n </Portal>\n )}\n </ArkDialog.Root>\n );\n}\n\n/**\n * What a side panel needs that Ark leaves to a modal's focus trap: the slot,\n * taken on open so any other panel closes; the panel scrolled into view,\n * since below the `lg` step it sits above the content in the page's flow;\n * and focus put back on close. Focus moves when it was inside the panel or\n * on nothing, as after a save whose button disabled itself and so dropped\n * focus, so closing the panel never pulls the user out of the list they\n * moved to but never leaves them on the page's body either.\n * It goes where the trap would send it: `finalFocusRef`'s element, else the\n * trigger, else what had focus when the panel opened. The trigger is named\n * outright because Safari does not focus a button on click.\n *\n * The panel arrives as state from its callback ref: a child's layout effect\n * runs before its parent's ref is attached. A layout effect, because its\n * cleanup runs while the panel is still in the document and can still hold\n * focus, and before Ark moves focus into the panel a frame after it opens.\n * It runs once per opening: the callbacks and refs it reads at close are\n * kept current beside it, so a re-render never closes and reopens the seat.\n */\nfunction SidePanelSeat({\n claim,\n panel,\n triggerRef,\n finalFocusRef,\n}: {\n claim: SidePanelSlot['claim'];\n panel: HTMLDivElement | null;\n triggerRef: RefObject<HTMLElement | null>;\n finalFocusRef?: RefObject<HTMLElement | null>;\n}) {\n const dialog = useDialogContext();\n const latest = useRef({ setOpen: dialog.setOpen, finalFocusRef });\n useLayoutEffect(() => {\n latest.current = { setOpen: dialog.setOpen, finalFocusRef };\n });\n\n useLayoutEffect(() => {\n if (!panel) return;\n const opener = panel.ownerDocument.activeElement;\n const release = claim(() => latest.current.setOpen(false));\n panel.scrollIntoView({ block: 'nearest' });\n return () => {\n release();\n const active = panel.ownerDocument.activeElement;\n const movedToThePage =\n active && active !== panel.ownerDocument.body && !panel.contains(active);\n if (movedToThePage) return;\n const target = [latest.current.finalFocusRef?.current, triggerRef.current, opener].find(\n (element) => element instanceof HTMLElement && element.isConnected,\n );\n if (target instanceof HTMLElement) target.focus();\n };\n }, [claim, panel, triggerRef]);\n\n return null;\n}\n\n/**\n * The scrolling body. While its content overflows it joins the tab order, so\n * a keyboard user can focus it and scroll; a body with nothing to scroll\n * stays out of the way.\n *\n * Two boxes are observed because either can change the answer: the outer one\n * resizes with the viewport, the inner one with the content.\n */\nfunction DialogBody({ children }: { children: ReactNode }) {\n const [scrollable, setScrollable] = useState(false);\n const observe = useCallback((scroller: HTMLDivElement | null) => {\n const content = scroller?.firstElementChild;\n if (!scroller || !content) return;\n const observer = new ResizeObserver(() =>\n setScrollable(scroller.scrollHeight > scroller.clientHeight),\n );\n observer.observe(scroller);\n observer.observe(content);\n return () => observer.disconnect();\n }, []);\n\n return (\n <div ref={observe} className=\"ds-dialog__body\" tabIndex={scrollable ? 0 : undefined}>\n <div className=\"ds-dialog__body-content\">{children}</div>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../src/dialog/dialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAIL,WAAW,EACX,UAAU,EACV,eAAe,EACf,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,sBAA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CACP,CAAC;AACJ,CAAC","sourcesContent":["import { Dialog as ArkDialog, useDialogContext } from '@ark-ui/react/dialog';\nimport { Portal } from '@ark-ui/react/portal';\nimport {\n type ReactElement,\n type ReactNode,\n type RefObject,\n useCallback,\n useContext,\n useLayoutEffect,\n useRef,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { IconButton } from '../button/icon-button';\nimport type { IconSource } from '../icon/icon';\nimport { PortalContainerContext } from '../portal-container';\nimport { type SidePanelSlot, SidePanelSlotContext } from '../side-panel-layout/side-panel-context';\nimport './dialog.css';\nimport { cx } from '../cx';\nimport { useIconDefaults } from '../icon-defaults';\n\nexport type DialogRole = 'dialog' | 'alertdialog';\n\n/** How wide the panel may grow: a message or short form, or a form with fields side by side. */\nexport type DialogSize = 'md' | 'lg';\n\n/** Over the page with the rest of it shut off, or in a drawer beside it. */\nexport type DialogPresentation = 'modal' | 'side';\n\nexport interface DialogProps {\n /**\n * The dialog's name: rendered as its `<h2>` heading and announced when it\n * opens (`aria-labelledby`). Write it as a short statement or question —\n * \"Remove “Site foreman”?\".\n */\n title: ReactNode;\n /**\n * One or two sentences under the title, announced with it\n * (`aria-describedby`). For a confirmation, say what the action does and\n * what it leaves alone.\n */\n description?: ReactNode;\n /** Body content. Scrolls inside the panel when it outgrows the viewport. */\n children?: ReactNode;\n /**\n * The footer's buttons, end-aligned, in reading order: the dismissive one\n * first, the committing one last. They wrap onto a second line on a narrow\n * screen. Wrap a dismissive button in `DialogClose` to make it close.\n */\n actions?: ReactNode;\n /**\n * The one element that opens the dialog, such as a `Button`. Focus returns\n * to it when the dialog closes, unless `finalFocusRef` names another\n * element. Leave it out to open the dialog with `open` from elsewhere.\n */\n trigger?: ReactElement;\n /** Controlled open state. Pair with `onOpenChange`. */\n open?: boolean;\n /** Initial open state when uncontrolled. */\n defaultOpen?: boolean;\n /**\n * Fired with the requested state whenever the dialog asks to open (its\n * trigger) or close (a `DialogClose`, the close button, Escape, or for\n * `role=\"dialog\"` a click outside). A controlled dialog stays as it is\n * until `open` changes.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * `dialog` (default) shows a close button and closes on Escape and on a\n * click outside. `alertdialog` is for confirmations: no close button, and a\n * click outside does nothing, so the explicit cancel action is the way\n * out. Escape still cancels.\n */\n role?: DialogRole;\n /**\n * Where focus lands when the dialog opens. Defaults to the first focusable\n * element: the close button of a `dialog`, the first action of an\n * `alertdialog` with no focusable body. Point an alertdialog at its least\n * destructive action.\n */\n initialFocusRef?: RefObject<HTMLElement | null>;\n /**\n * Where focus lands when the dialog closes, in place of the trigger. Use it\n * when the confirmed action removes the trigger, such as a row's Remove\n * button: focus would return to an element that is about to unmount and\n * fall to the page body. Point it at something that stays, such as the\n * list's heading, which needs `tabIndex={-1}` to take focus.\n *\n * The ref is read as the dialog closes, however it closes. Fill it in the\n * committing action, so Cancel and Escape still return focus to the\n * trigger, which is still there. While the ref holds no element, focus\n * returns to the trigger as usual.\n */\n finalFocusRef?: RefObject<HTMLElement | null>;\n /** Accessible name of the close button. Translate it with the rest of the UI. */\n closeLabel?: string;\n /**\n * Glyph for the close button. Defaults to the `IconDefaultsProvider`'s\n * `cross`, or a plain built-in one.\n */\n closeIcon?: IconSource;\n /**\n * How wide the panel may grow: `md` (the default) for a message or a short\n * form, `lg` for a form with fields side by side.\n */\n size?: DialogSize;\n /**\n * `modal` (the default) floats the panel over a dimmed page. `side` opens\n * it in the drawer of the nearest `SidePanelLayout`, beside the content,\n * which stays in view and usable: a form for one item of a list the user\n * may want to browse while filling it in. A side panel traps no focus,\n * locks no scroll and stays open on a click outside. Escape closes it\n * while focus is in it or on no control, and leaves an Escape pressed on a\n * control in the page to that control. On close, focus returns as from a\n * modal unless the user had moved it onto the page. It is as wide as a `md` dialog, so `size`\n * does not apply. Opening another side dialog in the layout closes this\n * one through `onOpenChange`; a controlled dialog should honour it.\n *\n * Outside a `SidePanelLayout`, for `role=\"alertdialog\"`, which must hold\n * the user until they answer, and inside another dialog, the dialog opens\n * as a modal.\n */\n presentation?: DialogPresentation;\n /** Extra class names appended to the panel's `ds-dialog`. */\n className?: string;\n}\n\n/**\n * A modal dialog: a raised panel over a dimmed page, built on Ark UI.\n *\n * Ark owns the behaviour: the focus trap, focus returning to the trigger\n * (or to `finalFocusRef`), Escape, the page's scroll lock, `aria-modal`, and the title and\n * description wiring. This wrapper adds the `ds-` classes, the\n * `--ds-dialog-*` bindings, and a slot API in place of Ark's anatomy.\n *\n * ```tsx\n * <Dialog\n * role=\"alertdialog\"\n * title=\"Remove “Site foreman”?\"\n * description=\"2 people and 1 Landfall lose this type; nothing else is deleted.\"\n * trigger={<Button variant=\"secondary\">Remove</Button>}\n * initialFocusRef={cancelRef}\n * actions={\n * <>\n * <DialogClose>\n * <Button ref={cancelRef} variant=\"secondary\">Cancel</Button>\n * </DialogClose>\n * <Button variant=\"danger\" onClick={remove}>Remove</Button>\n * </>\n * }\n * />\n * ```\n *\n * The committing action is the consumer's own button. To close after it\n * runs, control the dialog with `open` and set it false in the handler, or\n * wrap the button in `DialogClose` when closing at once is right.\n *\n * The backdrop and panel portal into `<body>` at `z-index: 50`, the layer\n * the product apps use for their own overlays. A Select or Menu inside the\n * dialog portals into its panel (see `PortalContainerContext`) and opens at\n * 60, above it. Nothing is mounted while the dialog is closed.\n */\nexport function Dialog({\n title,\n description,\n children,\n actions,\n trigger,\n open,\n defaultOpen,\n onOpenChange,\n role = 'dialog',\n initialFocusRef,\n finalFocusRef,\n closeLabel = 'Close',\n closeIcon: closeIconProp,\n size = 'md',\n presentation = 'modal',\n className,\n}: DialogProps) {\n const icons = useIconDefaults();\n const closeIcon = closeIconProp ?? icons.cross;\n const dismissible = role === 'dialog';\n const slot = useContext(SidePanelSlotContext);\n const side = presentation === 'side' && dismissible && slot ? slot : undefined;\n const panelRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const [sidePanel, setSidePanel] = useState<HTMLDivElement | null>(null);\n const sidePanelRef = useCallback((element: HTMLDivElement | null) => {\n panelRef.current = element;\n setSidePanel(element);\n }, []);\n const handleOpenChange = (details: { open: boolean }) => onOpenChange?.(details.open);\n // Zag types this as returning `HTMLElement | null`, but its focus trap\n // reads undefined as \"the first focusable element\" and, given null, fails\n // to start at all, leaving the page reachable by Tab.\n const initialFocusEl = (() => initialFocusRef?.current ?? undefined) as () => HTMLElement | null;\n const finalFocusEl = () => finalFocusRef?.current ?? null;\n // Zag's dismiss layer takes Escape anywhere in the document. A side panel\n // leaves the page usable, so an Escape meant for a control on the page,\n // such as a ReorderControl dropping its draft, must not close it too.\n const keepEscapeOnThePage = (event: KeyboardEvent) => {\n const target = event.target;\n const onThePage =\n target instanceof Node &&\n target !== target.ownerDocument?.body &&\n !panelRef.current?.contains(target);\n if (onThePage) event.preventDefault();\n };\n const panel = (\n <PortalContainerContext.Provider value={panelRef}>\n <div className=\"ds-dialog__header\">\n <div className=\"ds-dialog__heading\">\n <ArkDialog.Title className=\"ds-dialog__title\">{title}</ArkDialog.Title>\n {description && (\n <ArkDialog.Description className=\"ds-dialog__description\">\n {description}\n </ArkDialog.Description>\n )}\n </div>\n {dismissible && (\n <ArkDialog.CloseTrigger asChild>\n <IconButton\n icon={closeIcon}\n aria-label={closeLabel}\n variant=\"tertiary\"\n size=\"sm\"\n className=\"ds-dialog__close\"\n />\n </ArkDialog.CloseTrigger>\n )}\n </div>\n {children && <DialogBody>{children}</DialogBody>}\n {actions && <div className=\"ds-dialog__actions\">{actions}</div>}\n </PortalContainerContext.Provider>\n );\n const content = (\n <SidePanelSlotContext.Provider value={undefined}>{panel}</SidePanelSlotContext.Provider>\n );\n\n return (\n <ArkDialog.Root\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={handleOpenChange}\n role={role}\n modal={!side}\n closeOnInteractOutside={dismissible && !side}\n onEscapeKeyDown={side ? keepEscapeOnThePage : undefined}\n initialFocusEl={initialFocusEl}\n finalFocusEl={finalFocusEl}\n lazyMount\n unmountOnExit\n >\n {trigger && (\n <ArkDialog.Trigger ref={triggerRef} asChild>\n {trigger}\n </ArkDialog.Trigger>\n )}\n {side ? (\n side.container &&\n createPortal(\n <ArkDialog.Content\n ref={sidePanelRef}\n className={cx('ds-dialog', 'ds-dialog--side', className)}\n >\n <SidePanelSeat\n claim={side.claim}\n panel={sidePanel}\n triggerRef={triggerRef}\n finalFocusRef={finalFocusRef}\n />\n {content}\n </ArkDialog.Content>,\n side.container,\n )\n ) : (\n <Portal>\n <ArkDialog.Backdrop className=\"ds-dialog__backdrop\" />\n <ArkDialog.Positioner className=\"ds-dialog__positioner\">\n <ArkDialog.Content\n ref={panelRef}\n className={cx('ds-dialog', size === 'lg' && 'ds-dialog--lg', className)}\n >\n {content}\n </ArkDialog.Content>\n </ArkDialog.Positioner>\n </Portal>\n )}\n </ArkDialog.Root>\n );\n}\n\n/**\n * What a side panel needs that Ark leaves to a modal's focus trap: the slot,\n * taken on open so any other panel closes; the panel scrolled into view,\n * since below the `lg` step it sits above the content in the page's flow;\n * and focus put back on close. Focus moves when it was inside the panel or\n * on nothing, as after a save whose button disabled itself and so dropped\n * focus, so closing the panel never pulls the user out of the list they\n * moved to but never leaves them on the page's body either.\n * It goes where the trap would send it: `finalFocusRef`'s element, else the\n * trigger, else what had focus when the panel opened. The trigger is named\n * outright because Safari does not focus a button on click.\n *\n * The panel arrives as state from its callback ref: a child's layout effect\n * runs before its parent's ref is attached. A layout effect, because its\n * cleanup runs while the panel is still in the document and can still hold\n * focus, and before Ark moves focus into the panel a frame after it opens.\n * It runs once per opening: the callbacks and refs it reads at close are\n * kept current beside it, so a re-render never closes and reopens the seat.\n */\nfunction SidePanelSeat({\n claim,\n panel,\n triggerRef,\n finalFocusRef,\n}: {\n claim: SidePanelSlot['claim'];\n panel: HTMLDivElement | null;\n triggerRef: RefObject<HTMLElement | null>;\n finalFocusRef?: RefObject<HTMLElement | null>;\n}) {\n const dialog = useDialogContext();\n const latest = useRef({ setOpen: dialog.setOpen, finalFocusRef });\n useLayoutEffect(() => {\n latest.current = { setOpen: dialog.setOpen, finalFocusRef };\n });\n\n useLayoutEffect(() => {\n if (!panel) return;\n const opener = panel.ownerDocument.activeElement;\n const release = claim(() => latest.current.setOpen(false));\n panel.scrollIntoView({ block: 'nearest' });\n return () => {\n release();\n const active = panel.ownerDocument.activeElement;\n const movedToThePage =\n active && active !== panel.ownerDocument.body && !panel.contains(active);\n if (movedToThePage) return;\n const target = [latest.current.finalFocusRef?.current, triggerRef.current, opener].find(\n (element) => element instanceof HTMLElement && element.isConnected,\n );\n if (target instanceof HTMLElement) target.focus();\n };\n }, [claim, panel, triggerRef]);\n\n return null;\n}\n\n/**\n * The scrolling body. While its content overflows it joins the tab order, so\n * a keyboard user can focus it and scroll; a body with nothing to scroll\n * stays out of the way.\n *\n * Two boxes are observed because either can change the answer: the outer one\n * resizes with the viewport, the inner one with the content.\n */\nfunction DialogBody({ children }: { children: ReactNode }) {\n const [scrollable, setScrollable] = useState(false);\n const observe = useCallback((scroller: HTMLDivElement | null) => {\n const content = scroller?.firstElementChild;\n if (!scroller || !content) return;\n const observer = new ResizeObserver(() =>\n setScrollable(scroller.scrollHeight > scroller.clientHeight),\n );\n observer.observe(scroller);\n observer.observe(content);\n return () => observer.disconnect();\n }, []);\n\n return (\n <div ref={observe} className=\"ds-dialog__body\" tabIndex={scrollable ? 0 : undefined}>\n <div className=\"ds-dialog__body-content\">{children}</div>\n </div>\n );\n}\n"]}
@@ -11,9 +11,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
11
11
  * `check:tarballs` enforces that. A default that ships inside ui-core's own
12
12
  * runtime therefore cannot be a licensed icon.
13
13
  *
14
- * These exist only so the package works standalone. Products override them
15
- * via `indicator` / `itemIndicator`, which is how the Humanity Plus apps
16
- * render Lineicons here.
14
+ * These exist only so the package works standalone. A product sets its own
15
+ * once with `IconDefaultsProvider`, which is how the Humanity Plus apps
16
+ * render Lineicons here; a component's own icon prop still wins.
17
17
  *
18
18
  * Note: that audit is a plain string scan over the built output, and tsc
19
19
  * keeps comments, so naming the private package here — even in prose —
@@ -1 +1 @@
1
- {"version":3,"file":"fallback-glyphs.js","sourceRoot":"","sources":["../src/fallback-glyphs.tsx"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,YAAY,GAAe,CAAC,KAAK,EAAE,EAAE,CAAC,CACjD,6BAAiB,MAAM,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,KAAK,KAAK,YAC/D,eACE,CAAC,EAAC,cAAc,EAChB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,KAAK,EACjB,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,GACtB,GACE,CACP,CAAC;AACF,YAAY,CAAC,WAAW,GAAG,sBAAsB,CAAC;AAElD,MAAM,CAAC,MAAM,WAAW,GAAe,CAAC,KAAK,EAAE,EAAE,CAAC,CAChD,6BAAiB,MAAM,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,KAAK,KAAK,YAC/D,eACE,CAAC,EAAC,eAAe,EACjB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,KAAK,EACjB,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,GACtB,GACE,CACP,CAAC;AACF,WAAW,CAAC,WAAW,GAAG,qBAAqB,CAAC;AAEhD,MAAM,CAAC,MAAM,KAAK,GAAe,CAAC,KAAK,EAAE,EAAE,CAAC,CAC1C,6BAAiB,MAAM,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,KAAK,KAAK,YAC/D,eACE,CAAC,EAAC,kBAAkB,EACpB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,KAAK,EACjB,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,GACtB,GACE,CACP,CAAC;AACF,KAAK,CAAC,WAAW,GAAG,eAAe,CAAC;AAEpC,MAAM,CAAC,MAAM,KAAK,GAAe,CAAC,KAAK,EAAE,EAAE,CAAC,CAC1C,6BAAiB,MAAM,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,KAAK,KAAK,YAC/D,eACE,CAAC,EAAC,kBAAkB,EACpB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,KAAK,EACjB,aAAa,EAAC,OAAO,GACrB,GACE,CACP,CAAC;AACF,KAAK,CAAC,WAAW,GAAG,eAAe,CAAC;AAEpC,MAAM,CAAC,MAAM,GAAG,GAAe,CAAC,KAAK,EAAE,EAAE,CAAC,CACxC,6BAAiB,MAAM,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,KAAK,KAAK,YAC/D,eACE,CAAC,EAAC,gDAAgD,EAClD,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,KAAK,EACjB,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,GACtB,GACE,CACP,CAAC;AACF,GAAG,CAAC,WAAW,GAAG,aAAa,CAAC","sourcesContent":["import type { IconSource } from './icon/icon';\n\n/*\n * Fallback glyphs for the components whose icon slots default to something\n * (Select's indicators, Menu's check, Dialog's close button), inlined on\n * purpose and kept in one place. The package root exports them as\n * `Fallback*`, so a product composition with the same default reuses these\n * rather than copying the path data.\n *\n * ui-core is public and MIT; the Lineicons Pro icon package is private and\n * carries proprietary payloads, so a public package must not reference it —\n * `check:tarballs` enforces that. A default that ships inside ui-core's own\n * runtime therefore cannot be a licensed icon.\n *\n * These exist only so the package works standalone. Products override them\n * via `indicator` / `itemIndicator`, which is how the Humanity Plus apps\n * render Lineicons here.\n *\n * Note: that audit is a plain string scan over the built output, and tsc\n * keeps comments, so naming the private package here — even in prose —\n * would fail CI. Describe it, do not spell it.\n */\nexport const ChevronRight: IconSource = (props) => (\n <svg aria-hidden=\"true\" viewBox=\"0 0 16 16\" fill=\"none\" {...props}>\n <path\n d=\"m6 4 4 4-4 4\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n);\nChevronRight.displayName = 'FallbackChevronRight';\n\nexport const ChevronLeft: IconSource = (props) => (\n <svg aria-hidden=\"true\" viewBox=\"0 0 16 16\" fill=\"none\" {...props}>\n <path\n d=\"M10 4 6 8l4 4\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n);\nChevronLeft.displayName = 'FallbackChevronLeft';\n\nexport const Check: IconSource = (props) => (\n <svg aria-hidden=\"true\" viewBox=\"0 0 16 16\" fill=\"none\" {...props}>\n <path\n d=\"m3.5 8.5 3 3 6-6\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n);\nCheck.displayName = 'FallbackCheck';\n\nexport const Cross: IconSource = (props) => (\n <svg aria-hidden=\"true\" viewBox=\"0 0 16 16\" fill=\"none\" {...props}>\n <path\n d=\"m4 4 8 8m0-8-8 8\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n />\n </svg>\n);\nCross.displayName = 'FallbackCross';\n\nexport const Pin: IconSource = (props) => (\n <svg aria-hidden=\"true\" viewBox=\"0 0 16 16\" fill=\"none\" {...props}>\n <path\n d=\"M6 2.5h4M7 2.5v3.75L4.5 9h7L9 6.25V2.5M8 9v4.5\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n);\nPin.displayName = 'FallbackPin';\n"]}
1
+ {"version":3,"file":"fallback-glyphs.js","sourceRoot":"","sources":["../src/fallback-glyphs.tsx"],"names":[],"mappings":";AAEA;;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AAI,EAAC,MAAM,KAAK,KAAK,YAC/D,eACE,CAAC,EAAC,kBAAkB,EACpB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,KAAK,EACjB,aAAa,EAAC,OAAO,GACrB,GACE,CACP,CAAC;AACF,KAAK,CAAC,WAAW,GAAG,eAAe,CAAC;AAEpC,MAAM,CAAC,MAAM,GAAG,GAAe,CAAC,KAAK,EAAE,EAAE,CAAC,CACxC,6BAAiB,MAAM,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,KAAK,KAAK,YAC/D,eACE,CAAC,EAAC,gDAAgD,EAClD,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,KAAK,EACjB,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,GACtB,GACE,CACP,CAAC;AACF,GAAG,CAAC,WAAW,GAAG,aAAa,CAAC","sourcesContent":["import type { IconSource } from './icon/icon';\n\n/*\n * Fallback glyphs for the components whose icon slots default to something\n * (Select's indicators, Menu's check, Dialog's close button), inlined on\n * purpose and kept in one place. The package root exports them as\n * `Fallback*`, so a product composition with the same default reuses these\n * rather than copying the path data.\n *\n * ui-core is public and MIT; the Lineicons Pro icon package is private and\n * carries proprietary payloads, so a public package must not reference it —\n * `check:tarballs` enforces that. A default that ships inside ui-core's own\n * runtime therefore cannot be a licensed icon.\n *\n * These exist only so the package works standalone. A product sets its own\n * once with `IconDefaultsProvider`, which is how the Humanity Plus apps\n * render Lineicons here; a component's own icon prop still wins.\n *\n * Note: that audit is a plain string scan over the built output, and tsc\n * keeps comments, so naming the private package here — even in prose —\n * would fail CI. Describe it, do not spell it.\n */\nexport const ChevronRight: IconSource = (props) => (\n <svg aria-hidden=\"true\" viewBox=\"0 0 16 16\" fill=\"none\" {...props}>\n <path\n d=\"m6 4 4 4-4 4\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n);\nChevronRight.displayName = 'FallbackChevronRight';\n\nexport const ChevronLeft: IconSource = (props) => (\n <svg aria-hidden=\"true\" viewBox=\"0 0 16 16\" fill=\"none\" {...props}>\n <path\n d=\"M10 4 6 8l4 4\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n);\nChevronLeft.displayName = 'FallbackChevronLeft';\n\nexport const Check: IconSource = (props) => (\n <svg aria-hidden=\"true\" viewBox=\"0 0 16 16\" fill=\"none\" {...props}>\n <path\n d=\"m3.5 8.5 3 3 6-6\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n);\nCheck.displayName = 'FallbackCheck';\n\nexport const Cross: IconSource = (props) => (\n <svg aria-hidden=\"true\" viewBox=\"0 0 16 16\" fill=\"none\" {...props}>\n <path\n d=\"m4 4 8 8m0-8-8 8\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n />\n </svg>\n);\nCross.displayName = 'FallbackCross';\n\nexport const Pin: IconSource = (props) => (\n <svg aria-hidden=\"true\" viewBox=\"0 0 16 16\" fill=\"none\" {...props}>\n <path\n d=\"M6 2.5h4M7 2.5v3.75L4.5 9h7L9 6.25V2.5M8 9v4.5\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n);\nPin.displayName = 'FallbackPin';\n"]}
@@ -0,0 +1,45 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { IconSource } from './icon/icon';
3
+ /**
4
+ * The glyphs ui-core draws when a component's icon prop is left out, by
5
+ * shape: a select's and a menu's chevron, a checkbox's check, a dialog's
6
+ * close cross. Chevrons point right, and a component that needs another
7
+ * direction turns the one it is given.
8
+ */
9
+ export interface IconDefaults {
10
+ /** Select's and Menu's indicator, Calendar's next month, Accordion's indicator. */
11
+ chevronRight: IconSource;
12
+ /** Calendar's previous month. */
13
+ chevronLeft: IconSource;
14
+ /** Checkbox's check, and the chosen option in Select and the menus. */
15
+ check: IconSource;
16
+ /** Dialog's close button and Combobox's remove. */
17
+ cross: IconSource;
18
+ /** Combobox's pin. */
19
+ pin: IconSource;
20
+ }
21
+ export interface IconDefaultsProviderProps {
22
+ /** The product's glyphs. A shape left out keeps the one around it, or the built-in fallback. */
23
+ icons: Partial<IconDefaults>;
24
+ children: ReactNode;
25
+ }
26
+ /**
27
+ * Sets the glyphs every ui-core component below it draws by default, so a
28
+ * product puts its own icon set in once, at its root, instead of passing
29
+ * `indicator`, `itemIndicator` or `closeIcon` at every call. A prop passed to
30
+ * one component still wins.
31
+ *
32
+ * The icons are functions, which a Next.js Server Component cannot pass to a
33
+ * client one, so a Next.js app mounts the provider from a client component of
34
+ * its own.
35
+ *
36
+ * ```tsx
37
+ * <IconDefaultsProvider icons={{ chevronRight: ChevronRight, check: Check }}>
38
+ * <App />
39
+ * </IconDefaultsProvider>
40
+ * ```
41
+ */
42
+ export declare function IconDefaultsProvider({ icons, children }: IconDefaultsProviderProps): import("react/jsx-runtime").JSX.Element;
43
+ /** The glyphs in force here: the nearest provider's, or the built-in fallbacks. */
44
+ export declare function useIconDefaults(): IconDefaults;
45
+ //# sourceMappingURL=icon-defaults.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon-defaults.d.ts","sourceRoot":"","sources":["../src/icon-defaults.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAiB,KAAK,SAAS,EAAuB,MAAM,OAAO,CAAC;AAE3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,mFAAmF;IACnF,YAAY,EAAE,UAAU,CAAC;IACzB,iCAAiC;IACjC,WAAW,EAAE,UAAU,CAAC;IACxB,uEAAuE;IACvE,KAAK,EAAE,UAAU,CAAC;IAClB,mDAAmD;IACnD,KAAK,EAAE,UAAU,CAAC;IAClB,sBAAsB;IACtB,GAAG,EAAE,UAAU,CAAC;CACjB;AAYD,MAAM,WAAW,yBAAyB;IACxC,gGAAgG;IAChG,KAAK,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC7B,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,yBAAyB,2CAOlF;AAED,mFAAmF;AACnF,wBAAgB,eAAe,IAAI,YAAY,CAE9C"}
@@ -0,0 +1,43 @@
1
+ // A client boundary, so a React Server Component can import the provider:
2
+ // React's server build has no createContext. See docs/decisions/icon-defaults.mdx.
3
+ 'use client';
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ import { createContext, useContext, useMemo } from 'react';
6
+ import { Check, ChevronLeft, ChevronRight, Cross, Pin } from './fallback-glyphs';
7
+ const FALLBACKS = {
8
+ chevronRight: ChevronRight,
9
+ chevronLeft: ChevronLeft,
10
+ check: Check,
11
+ cross: Cross,
12
+ pin: Pin,
13
+ };
14
+ const IconDefaultsContext = createContext(FALLBACKS);
15
+ /**
16
+ * Sets the glyphs every ui-core component below it draws by default, so a
17
+ * product puts its own icon set in once, at its root, instead of passing
18
+ * `indicator`, `itemIndicator` or `closeIcon` at every call. A prop passed to
19
+ * one component still wins.
20
+ *
21
+ * The icons are functions, which a Next.js Server Component cannot pass to a
22
+ * client one, so a Next.js app mounts the provider from a client component of
23
+ * its own.
24
+ *
25
+ * ```tsx
26
+ * <IconDefaultsProvider icons={{ chevronRight: ChevronRight, check: Check }}>
27
+ * <App />
28
+ * </IconDefaultsProvider>
29
+ * ```
30
+ */
31
+ export function IconDefaultsProvider({ icons, children }) {
32
+ const outer = useContext(IconDefaultsContext);
33
+ const value = useMemo(() => {
34
+ const given = Object.entries(icons).filter(([, icon]) => icon !== undefined);
35
+ return { ...outer, ...Object.fromEntries(given) };
36
+ }, [outer, icons]);
37
+ return _jsx(IconDefaultsContext.Provider, { value: value, children: children });
38
+ }
39
+ /** The glyphs in force here: the nearest provider's, or the built-in fallbacks. */
40
+ export function useIconDefaults() {
41
+ return useContext(IconDefaultsContext);
42
+ }
43
+ //# sourceMappingURL=icon-defaults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon-defaults.js","sourceRoot":"","sources":["../src/icon-defaults.tsx"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,mFAAmF;AACnF,YAAY,CAAC;;AAEb,OAAO,EAAE,aAAa,EAAkB,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC3E,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAsBjF,MAAM,SAAS,GAAiB;IAC9B,YAAY,EAAE,YAAY;IAC1B,WAAW,EAAE,WAAW;IACxB,KAAK,EAAE,KAAK;IACZ,KAAK,EAAE,KAAK;IACZ,GAAG,EAAE,GAAG;CACT,CAAC;AAEF,MAAM,mBAAmB,GAAG,aAAa,CAAe,SAAS,CAAC,CAAC;AAQnE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,oBAAoB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAA6B;IACjF,MAAM,KAAK,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAC;IAC9C,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE;QACzB,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;QAC7E,OAAO,EAAE,GAAG,KAAK,EAAE,GAAG,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;IACpD,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IACnB,OAAO,KAAC,mBAAmB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAgC,CAAC;AAC/F,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,eAAe;IAC7B,OAAO,UAAU,CAAC,mBAAmB,CAAC,CAAC;AACzC,CAAC","sourcesContent":["// A client boundary, so a React Server Component can import the provider:\n// React's server build has no createContext. See docs/decisions/icon-defaults.mdx.\n'use client';\n\nimport { createContext, type ReactNode, useContext, useMemo } from 'react';\nimport { Check, ChevronLeft, ChevronRight, Cross, Pin } from './fallback-glyphs';\nimport type { IconSource } from './icon/icon';\n\n/**\n * The glyphs ui-core draws when a component's icon prop is left out, by\n * shape: a select's and a menu's chevron, a checkbox's check, a dialog's\n * close cross. Chevrons point right, and a component that needs another\n * direction turns the one it is given.\n */\nexport interface IconDefaults {\n /** Select's and Menu's indicator, Calendar's next month, Accordion's indicator. */\n chevronRight: IconSource;\n /** Calendar's previous month. */\n chevronLeft: IconSource;\n /** Checkbox's check, and the chosen option in Select and the menus. */\n check: IconSource;\n /** Dialog's close button and Combobox's remove. */\n cross: IconSource;\n /** Combobox's pin. */\n pin: IconSource;\n}\n\nconst FALLBACKS: IconDefaults = {\n chevronRight: ChevronRight,\n chevronLeft: ChevronLeft,\n check: Check,\n cross: Cross,\n pin: Pin,\n};\n\nconst IconDefaultsContext = createContext<IconDefaults>(FALLBACKS);\n\nexport interface IconDefaultsProviderProps {\n /** The product's glyphs. A shape left out keeps the one around it, or the built-in fallback. */\n icons: Partial<IconDefaults>;\n children: ReactNode;\n}\n\n/**\n * Sets the glyphs every ui-core component below it draws by default, so a\n * product puts its own icon set in once, at its root, instead of passing\n * `indicator`, `itemIndicator` or `closeIcon` at every call. A prop passed to\n * one component still wins.\n *\n * The icons are functions, which a Next.js Server Component cannot pass to a\n * client one, so a Next.js app mounts the provider from a client component of\n * its own.\n *\n * ```tsx\n * <IconDefaultsProvider icons={{ chevronRight: ChevronRight, check: Check }}>\n * <App />\n * </IconDefaultsProvider>\n * ```\n */\nexport function IconDefaultsProvider({ icons, children }: IconDefaultsProviderProps) {\n const outer = useContext(IconDefaultsContext);\n const value = useMemo(() => {\n const given = Object.entries(icons).filter(([, icon]) => icon !== undefined);\n return { ...outer, ...Object.fromEntries(given) };\n }, [outer, icons]);\n return <IconDefaultsContext.Provider value={value}>{children}</IconDefaultsContext.Provider>;\n}\n\n/** The glyphs in force here: the nearest provider's, or the built-in fallbacks. */\nexport function useIconDefaults(): IconDefaults {\n return useContext(IconDefaultsContext);\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './accordion';
1
2
  export * from './alert';
2
3
  export * from './avatar';
3
4
  export * from './badge';
@@ -17,6 +18,7 @@ export { Check as FallbackCheck, ChevronLeft as FallbackChevronLeft, ChevronRigh
17
18
  export * from './field';
18
19
  export * from './form-layout';
19
20
  export * from './icon';
21
+ export * from './icon-defaults';
20
22
  export * from './illustration';
21
23
  export * from './layout';
22
24
  export * from './link';
@@ -25,6 +27,7 @@ export * from './menu';
25
27
  export * from './page-layout';
26
28
  export * from './popover';
27
29
  export * from './progress';
30
+ export * from './radio-group';
28
31
  export * from './reorder-control';
29
32
  export * from './scroll-area';
30
33
  export * from './section';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;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AmB,CAAC;AAClC,cAAc,iBAAiB,CAAC"}
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './accordion';
1
2
  export * from './alert';
2
3
  export * from './avatar';
3
4
  export * from './badge';
@@ -17,6 +18,7 @@ export { Check as FallbackCheck, ChevronLeft as FallbackChevronLeft, ChevronRigh
17
18
  export * from './field';
18
19
  export * from './form-layout';
19
20
  export * from './icon';
21
+ export * from './icon-defaults';
20
22
  export * from './illustration';
21
23
  export * from './layout';
22
24
  export * from './link';
@@ -24,6 +26,7 @@ export * from './menu';
24
26
  export * from './page-layout';
25
27
  export * from './popover';
26
28
  export * from './progress';
29
+ export * from './radio-group';
27
30
  export * from './reorder-control';
28
31
  export * from './scroll-area';
29
32
  export * from './section';