jaci-ui 0.9.3 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +11 -1
  3. package/dist/_virtual/_rolldown/runtime.cjs +1 -1
  4. package/dist/components/accordion/accordion.cjs.map +1 -1
  5. package/dist/components/accordion/accordion.js.map +1 -1
  6. package/dist/components/alert/alert.cjs.map +1 -1
  7. package/dist/components/alert/alert.js.map +1 -1
  8. package/dist/components/alert-dialog/alert-dialog.cjs.map +1 -1
  9. package/dist/components/alert-dialog/alert-dialog.js.map +1 -1
  10. package/dist/components/aspect-ratio/aspect-ratio.cjs.map +1 -1
  11. package/dist/components/avatar/avatar.cjs.map +1 -1
  12. package/dist/components/avatar/avatar.js.map +1 -1
  13. package/dist/components/breadcrumbs/breadcrumbs.cjs.map +1 -1
  14. package/dist/components/button/button.cjs +1 -0
  15. package/dist/components/button/button.cjs.map +1 -1
  16. package/dist/components/button/button.d.cts +2 -1
  17. package/dist/components/button/button.d.ts +2 -1
  18. package/dist/components/button/button.js +1 -0
  19. package/dist/components/button/button.js.map +1 -1
  20. package/dist/components/button-group/button-group.cjs.map +1 -1
  21. package/dist/components/calendar/calendar.cjs +4 -6
  22. package/dist/components/calendar/calendar.cjs.map +1 -1
  23. package/dist/components/calendar/calendar.js +4 -6
  24. package/dist/components/calendar/calendar.js.map +1 -1
  25. package/dist/components/card/card.cjs.map +1 -1
  26. package/dist/components/carousel/carousel.cjs.map +1 -1
  27. package/dist/components/carousel/carousel.js.map +1 -1
  28. package/dist/components/checkbox-group/checkbox-group.cjs +7 -3
  29. package/dist/components/checkbox-group/checkbox-group.cjs.map +1 -1
  30. package/dist/components/checkbox-group/checkbox-group.js +7 -3
  31. package/dist/components/checkbox-group/checkbox-group.js.map +1 -1
  32. package/dist/components/code/code.cjs.map +1 -1
  33. package/dist/components/code/code.js.map +1 -1
  34. package/dist/components/collapsible/collapsible.cjs.map +1 -1
  35. package/dist/components/collapsible/collapsible.js.map +1 -1
  36. package/dist/components/color-picker/color-picker.cjs.map +1 -1
  37. package/dist/components/color-picker/color-picker.js.map +1 -1
  38. package/dist/components/color-swatch/color-swatch.cjs.map +1 -1
  39. package/dist/components/combobox/combobox.cjs +2 -1
  40. package/dist/components/combobox/combobox.cjs.map +1 -1
  41. package/dist/components/combobox/combobox.js +2 -1
  42. package/dist/components/combobox/combobox.js.map +1 -1
  43. package/dist/components/command/command.cjs.map +1 -1
  44. package/dist/components/command/command.js.map +1 -1
  45. package/dist/components/context-menu/context-menu.cjs.map +1 -1
  46. package/dist/components/controls/checkbox.cjs.map +1 -1
  47. package/dist/components/controls/checkbox.js.map +1 -1
  48. package/dist/components/controls/input.cjs.map +1 -1
  49. package/dist/components/controls/input.js.map +1 -1
  50. package/dist/components/controls/radio.cjs.map +1 -1
  51. package/dist/components/controls/switch.cjs.map +1 -1
  52. package/dist/components/controls/switch.js.map +1 -1
  53. package/dist/components/controls/textarea.cjs.map +1 -1
  54. package/dist/components/controls/textarea.js.map +1 -1
  55. package/dist/components/copyable/copyable.cjs.map +1 -1
  56. package/dist/components/copyable/copyable.js.map +1 -1
  57. package/dist/components/data-toolbar/data-toolbar.cjs.map +1 -1
  58. package/dist/components/data-toolbar/data-toolbar.js.map +1 -1
  59. package/dist/components/data-view/data-view.cjs.map +1 -1
  60. package/dist/components/date-picker/date-picker.cjs +4 -7
  61. package/dist/components/date-picker/date-picker.cjs.map +1 -1
  62. package/dist/components/date-picker/date-picker.js +4 -7
  63. package/dist/components/date-picker/date-picker.js.map +1 -1
  64. package/dist/components/date-range-picker/date-range-picker.cjs +4 -6
  65. package/dist/components/date-range-picker/date-range-picker.cjs.map +1 -1
  66. package/dist/components/date-range-picker/date-range-picker.js +4 -6
  67. package/dist/components/date-range-picker/date-range-picker.js.map +1 -1
  68. package/dist/components/dialog/dialog.cjs.map +1 -1
  69. package/dist/components/dialog/dialog.js.map +1 -1
  70. package/dist/components/download-trigger/download-trigger.cjs.map +1 -1
  71. package/dist/components/drawer/drawer.cjs.map +1 -1
  72. package/dist/components/drawer/drawer.js.map +1 -1
  73. package/dist/components/empty-state/empty-state.cjs.map +1 -1
  74. package/dist/components/feedback/badge.cjs.map +1 -1
  75. package/dist/components/feedback/badge.d.cts +2 -1
  76. package/dist/components/feedback/badge.d.ts +2 -1
  77. package/dist/components/feedback/badge.js.map +1 -1
  78. package/dist/components/field/field.cjs.map +1 -1
  79. package/dist/components/field/field.js.map +1 -1
  80. package/dist/components/fieldset/fieldset.cjs.map +1 -1
  81. package/dist/components/figure/figure.cjs.map +1 -1
  82. package/dist/components/figure/figure.js.map +1 -1
  83. package/dist/components/form/form.cjs.map +1 -1
  84. package/dist/components/form/form.js.map +1 -1
  85. package/dist/components/icon-button/icon-button.cjs.map +1 -1
  86. package/dist/components/icon-button/icon-button.js.map +1 -1
  87. package/dist/components/image/image.cjs.map +1 -1
  88. package/dist/components/image/image.js.map +1 -1
  89. package/dist/components/input-group/input-group.cjs.map +1 -1
  90. package/dist/components/kbd/kbd.cjs.map +1 -1
  91. package/dist/components/layout/index.cjs.map +1 -1
  92. package/dist/components/list/list.cjs.map +1 -1
  93. package/dist/components/menu/menu.cjs.map +1 -1
  94. package/dist/components/menubar/menubar.cjs.map +1 -1
  95. package/dist/components/menubar/menubar.js.map +1 -1
  96. package/dist/components/meter/meter.cjs.map +1 -1
  97. package/dist/components/meter/meter.js.map +1 -1
  98. package/dist/components/navigation/navigation.cjs.map +1 -1
  99. package/dist/components/navigation/navigation.js.map +1 -1
  100. package/dist/components/navigation-menu/navigation-menu.cjs.map +1 -1
  101. package/dist/components/navigation-menu/navigation-menu.js.map +1 -1
  102. package/dist/components/number-field/number-field.cjs +2 -1
  103. package/dist/components/number-field/number-field.cjs.map +1 -1
  104. package/dist/components/number-field/number-field.js +2 -1
  105. package/dist/components/number-field/number-field.js.map +1 -1
  106. package/dist/components/option-selector/option-selector.cjs.map +1 -1
  107. package/dist/components/option-selector/option-selector.js.map +1 -1
  108. package/dist/components/pagination/pagination.cjs.map +1 -1
  109. package/dist/components/pagination/pagination.js.map +1 -1
  110. package/dist/components/pin-input/pin-input.cjs.map +1 -1
  111. package/dist/components/pin-input/pin-input.js.map +1 -1
  112. package/dist/components/popover/popover.cjs.map +1 -1
  113. package/dist/components/popover/popover.js.map +1 -1
  114. package/dist/components/progress/progress.cjs.map +1 -1
  115. package/dist/components/progress/progress.js.map +1 -1
  116. package/dist/components/qr-code/qr-code.cjs.map +1 -1
  117. package/dist/components/qr-code/qr-code.js.map +1 -1
  118. package/dist/components/quote/quote.cjs.map +1 -1
  119. package/dist/components/quote/quote.js.map +1 -1
  120. package/dist/components/radio-group/radio-group.cjs +7 -3
  121. package/dist/components/radio-group/radio-group.cjs.map +1 -1
  122. package/dist/components/radio-group/radio-group.js +7 -3
  123. package/dist/components/radio-group/radio-group.js.map +1 -1
  124. package/dist/components/range-slider/range-slider.cjs.map +1 -1
  125. package/dist/components/range-slider/range-slider.js.map +1 -1
  126. package/dist/components/scroll-area/scroll-area.cjs.map +1 -1
  127. package/dist/components/select/select.cjs.map +1 -1
  128. package/dist/components/select/select.js.map +1 -1
  129. package/dist/components/sidebar/sidebar.cjs.map +1 -1
  130. package/dist/components/sidebar/sidebar.js.map +1 -1
  131. package/dist/components/skeleton/skeleton.cjs.map +1 -1
  132. package/dist/components/slider/slider.cjs.map +1 -1
  133. package/dist/components/slider/slider.js.map +1 -1
  134. package/dist/components/spacer/spacer.cjs.map +1 -1
  135. package/dist/components/stat/stat.cjs.map +1 -1
  136. package/dist/components/stat/stat.js.map +1 -1
  137. package/dist/components/stepper/stepper.cjs +2 -1
  138. package/dist/components/stepper/stepper.cjs.map +1 -1
  139. package/dist/components/stepper/stepper.js +2 -1
  140. package/dist/components/stepper/stepper.js.map +1 -1
  141. package/dist/components/table/table.cjs.map +1 -1
  142. package/dist/components/table/table.js.map +1 -1
  143. package/dist/components/tabs/tabs.cjs.map +1 -1
  144. package/dist/components/tabs/tabs.js.map +1 -1
  145. package/dist/components/tags-input/tags-input.cjs.map +1 -1
  146. package/dist/components/tags-input/tags-input.js.map +1 -1
  147. package/dist/components/toast/toast.cjs.map +1 -1
  148. package/dist/components/toast/toast.js.map +1 -1
  149. package/dist/components/toggle/toggle.cjs.map +1 -1
  150. package/dist/components/toggle-group/toggle-group.cjs.map +1 -1
  151. package/dist/components/toolbar/toolbar.cjs.map +1 -1
  152. package/dist/components/tooltip/tooltip.cjs.map +1 -1
  153. package/dist/components/tree-view/tree-view.cjs.map +1 -1
  154. package/dist/components/tree-view/tree-view.js.map +1 -1
  155. package/dist/components/typography/heading.cjs.map +1 -1
  156. package/dist/components/typography/link.cjs.map +1 -1
  157. package/dist/components/typography/paragraph.cjs.map +1 -1
  158. package/dist/components/typography/text.cjs.map +1 -1
  159. package/dist/components/upload/upload.cjs +2 -2
  160. package/dist/components/upload/upload.cjs.map +1 -1
  161. package/dist/components/upload/upload.js +2 -2
  162. package/dist/components/upload/upload.js.map +1 -1
  163. package/dist/components/visually-hidden/visually-hidden.cjs.map +1 -1
  164. package/dist/panda-preset.cjs.map +1 -1
  165. package/dist/styled-system/recipes/badge.cjs +4 -1
  166. package/dist/styled-system/recipes/badge.cjs.map +1 -1
  167. package/dist/styled-system/recipes/badge.js +4 -1
  168. package/dist/styled-system/recipes/badge.js.map +1 -1
  169. package/dist/styles/theme.cjs +88 -68
  170. package/dist/styles/theme.cjs.map +1 -1
  171. package/dist/styles/theme.js +88 -68
  172. package/dist/styles/theme.js.map +1 -1
  173. package/dist/styles.css +5 -19
  174. package/dist/theme/theme-provider.cjs.map +1 -1
  175. package/dist/theme/theme-provider.js.map +1 -1
  176. package/dist/theme/theme-scope.cjs.map +1 -1
  177. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"tags-input.js","names":[],"sources":["../../../src/components/tags-input/tags-input.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, useCallback, useId, useMemo, useRef, useState } from \"react\";\nimport type {\n ChangeEvent,\n ChangeEventHandler,\n ComponentPropsWithoutRef,\n FocusEvent,\n KeyboardEvent,\n MouseEvent,\n ClipboardEvent,\n ReactNode,\n} from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { tagsInput } from \"../../styled-system/recipes\";\n\nexport interface TagsInputProps\n extends Omit<\n ComponentPropsWithoutRef<\"input\">,\n \"children\" | \"defaultValue\" | \"onChange\" | \"type\" | \"value\"\n > {\n /** Current tags. Omit this prop to use the uncontrolled API. */\n tags?: readonly string[];\n /** Initial tags for the uncontrolled API. */\n defaultTags?: readonly string[];\n /** Called whenever a tag is added or removed. */\n onTagsChange?: (tags: string[]) => void;\n /** Optional suggestions. A tag is accepted after a comma only when it is in this list. */\n data?: readonly string[];\n /** Visible label for the input. */\n label?: ReactNode;\n /** Current text query. This is the native input value, not the selected tags. */\n value?: string;\n /** Initial text query for an uncontrolled input. */\n defaultValue?: string;\n /** Native input change callback. */\n onChange?: ChangeEventHandler<HTMLInputElement>;\n /** Optional callback useful when a controlled query is cleared by selecting a tag. */\n onInputValueChange?: (value: string) => void;\n allowDuplicates?: boolean;\n delimiter?: string | RegExp;\n editable?: boolean;\n}\n\nfunction changedEvent(event: ChangeEvent<HTMLInputElement>, value: string) {\n const target = event.target;\n const nextTarget = {\n checked: target.checked,\n id: target.id,\n name: target.name,\n value,\n } as HTMLInputElement;\n\n return {\n ...event,\n currentTarget: nextTarget,\n target: nextTarget,\n } as ChangeEvent<HTMLInputElement>;\n}\n\nfunction tagKey(tag: string, index: number) {\n return `${tag}-${index}`;\n}\n\nfunction hasDelimiter(value: string, delimiter: string | RegExp) {\n if (typeof delimiter === \"string\") return delimiter.length > 0 && value.includes(delimiter);\n delimiter.lastIndex = 0;\n const result = delimiter.test(value);\n delimiter.lastIndex = 0;\n return result;\n}\n\nexport const TagsInput = forwardRef<HTMLInputElement, TagsInputProps>(function TagsInput(\n {\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": ariaInvalid,\n \"aria-label\": ariaLabel,\n allowDuplicates = false,\n className,\n data = [],\n defaultTags = [],\n defaultValue = \"\",\n disabled = false,\n delimiter = /[,\\n]/u,\n editable = false,\n id: providedId,\n label,\n onBlur,\n onChange,\n onFocus,\n onInputValueChange,\n onTagsChange,\n placeholder,\n tags: controlledTags,\n value: controlledInputValue,\n ...props\n },\n ref,\n) {\n const generatedId = useId();\n const id = providedId ?? generatedId;\n const [uncontrolledTags, setUncontrolledTags] = useState<string[]>(() => [...defaultTags]);\n const [uncontrolledInputValue, setUncontrolledInputValue] = useState(defaultValue);\n const [focused, setFocused] = useState(false);\n const [composing, setComposing] = useState(false);\n const [editingTag, setEditingTag] = useState<{ index: number; value: string } | null>(null);\n const rootRef = useRef<HTMLDivElement>(null);\n const styles = tagsInput();\n const selectedTags = controlledTags === undefined ? uncontrolledTags : [...controlledTags];\n const inputValue =\n controlledInputValue === undefined ? uncontrolledInputValue : controlledInputValue;\n\n const updateTags = useCallback(\n (nextTags: string[]) => {\n if (controlledTags === undefined) setUncontrolledTags(nextTags);\n onTagsChange?.(nextTags);\n },\n [controlledTags, onTagsChange],\n );\n\n const clearInput = useCallback(\n (event?: ChangeEvent<HTMLInputElement>) => {\n if (controlledInputValue === undefined) setUncontrolledInputValue(\"\");\n onInputValueChange?.(\"\");\n if (event) onChange?.(changedEvent(event, \"\"));\n },\n [controlledInputValue, onChange, onInputValueChange],\n );\n\n const addTag = useCallback(\n (rawTag: string, event?: ChangeEvent<HTMLInputElement>) => {\n const tag = rawTag.trim();\n const isAllowed = data.length === 0 || data.includes(tag);\n const duplicate = selectedTags.includes(tag);\n if (tag && isAllowed && (allowDuplicates || !duplicate)) {\n if (editingTag) {\n updateTags([\n ...selectedTags.slice(0, editingTag.index),\n tag,\n ...selectedTags.slice(editingTag.index),\n ]);\n setEditingTag(null);\n } else {\n updateTags([...selectedTags, tag]);\n }\n } else if (editingTag) {\n return;\n }\n clearInput(event);\n },\n [allowDuplicates, clearInput, data, editingTag, selectedTags, updateTags],\n );\n\n const addDelimited = useCallback(\n (rawValue: string, event?: ChangeEvent<HTMLInputElement>) => {\n const separator =\n typeof delimiter === \"string\" && delimiter.length === 0 ? /\\r?\\n/u : delimiter;\n const values = rawValue\n .split(separator)\n .map((value) => value.trim())\n .filter(Boolean);\n const nextTags = [...selectedTags];\n for (const value of values) {\n const isAllowed = data.length === 0 || data.includes(value);\n if (isAllowed && (allowDuplicates || !nextTags.includes(value))) nextTags.push(value);\n }\n if (nextTags.length !== selectedTags.length) updateTags(nextTags);\n clearInput(event);\n },\n [allowDuplicates, clearInput, data, delimiter, selectedTags, updateTags],\n );\n\n const suggestions = useMemo(() => {\n const query = inputValue.trim().toLocaleLowerCase();\n return data.filter(\n (item) =>\n !selectedTags.includes(item) &&\n (query.length === 0 || item.toLocaleLowerCase().includes(query)),\n );\n }, [data, inputValue, selectedTags]);\n\n function handleChange(event: ChangeEvent<HTMLInputElement>) {\n const nextValue = event.currentTarget.value;\n if (nextValue.trim() === \"\") {\n clearInput(event);\n onChange?.(event);\n return;\n }\n\n if (!composing && hasDelimiter(nextValue, delimiter)) {\n addDelimited(nextValue, event);\n return;\n }\n\n if (controlledInputValue === undefined) setUncontrolledInputValue(nextValue);\n onInputValueChange?.(nextValue);\n onChange?.(event);\n }\n\n function handleBlur(event: FocusEvent<HTMLInputElement>) {\n setFocused(false);\n onBlur?.(event);\n }\n\n function handlePaste(event: ClipboardEvent<HTMLInputElement>) {\n const pasted = event.clipboardData.getData(\"text\");\n if (!pasted || (!hasDelimiter(pasted, delimiter) && !pasted.includes(\"\\n\"))) return;\n event.preventDefault();\n addDelimited(pasted);\n }\n\n function handleKeyDown(event: KeyboardEvent<HTMLInputElement>) {\n if (event.nativeEvent.isComposing || composing) return;\n if (event.key === \"Enter\") {\n event.preventDefault();\n if (inputValue.trim()) addTag(inputValue);\n else if (editingTag) setEditingTag(null);\n } else if (event.key === \"Escape\" && editingTag) {\n event.preventDefault();\n updateTags([\n ...selectedTags.slice(0, editingTag.index),\n editingTag.value,\n ...selectedTags.slice(editingTag.index),\n ]);\n clearInput();\n setEditingTag(null);\n } else if (event.key === \"Backspace\" && !inputValue && editable && selectedTags.length > 0) {\n const index = selectedTags.length - 1;\n const tag = selectedTags[index];\n if (tag === undefined) return;\n setEditingTag({ index, value: tag });\n updateTags(selectedTags.slice(0, -1));\n if (controlledInputValue === undefined) setUncontrolledInputValue(tag);\n onInputValueChange?.(tag);\n }\n props.onKeyDown?.(event);\n }\n\n function removeTag(index: number) {\n updateTags(selectedTags.filter((_, currentIndex) => currentIndex !== index));\n }\n\n return (\n <div\n className={styles.root}\n data-jaci-component=\"tags-input\"\n data-slot=\"tags-input\"\n ref={rootRef}\n >\n {label ? (\n <label className={styles.label} data-slot=\"tags-input-label\" htmlFor={id}>\n {label}\n </label>\n ) : null}\n <div\n className={cx(styles.control, className)}\n data-disabled={disabled || undefined}\n data-focus={focused || undefined}\n data-slot=\"tags-input-control\"\n >\n <div className={styles.tagList} data-slot=\"tags-input-tag-list\">\n {selectedTags.map((tag, index) => (\n <span className={styles.tag} data-slot=\"tags-input-tag\" key={tagKey(tag, index)}>\n <span className={styles.tagLabel} data-slot=\"tags-input-tag-label\">\n {tag}\n </span>\n <button\n aria-label={`Remove ${tag}`}\n className={styles.tagRemove}\n data-slot=\"tags-input-tag-remove\"\n disabled={disabled}\n onClick={() => removeTag(index)}\n type=\"button\"\n >\n ×\n </button>\n </span>\n ))}\n </div>\n <input\n {...props}\n {...(ariaDescribedBy ? { \"aria-describedby\": ariaDescribedBy } : {})}\n {...(ariaInvalid !== undefined ? { \"aria-invalid\": ariaInvalid } : {})}\n {...(ariaLabel ? { \"aria-label\": ariaLabel } : {})}\n autoComplete=\"off\"\n className={styles.input}\n disabled={disabled}\n id={id}\n onBlur={handleBlur}\n onChange={handleChange}\n onCompositionEnd={() => setComposing(false)}\n onCompositionStart={() => setComposing(true)}\n onFocus={(event) => {\n setFocused(true);\n onFocus?.(event);\n }}\n onKeyDown={handleKeyDown}\n onPaste={handlePaste}\n placeholder={placeholder}\n ref={ref}\n type=\"text\"\n value={inputValue}\n />\n </div>\n {focused && data.length > 0 ? (\n <div className={styles.positioner} data-slot=\"tags-input-positioner\">\n <div\n aria-label=\"Suggestions\"\n className={styles.list}\n data-slot=\"tags-input-list\"\n role=\"listbox\"\n >\n {suggestions.length > 0 ? (\n suggestions.map((item) => (\n <button\n aria-selected={false}\n className={styles.item}\n data-slot=\"tags-input-item\"\n key={item}\n onClick={() => addTag(item)}\n onMouseDown={(event: MouseEvent<HTMLButtonElement>) => event.preventDefault()}\n role=\"option\"\n type=\"button\"\n >\n {item}\n </button>\n ))\n ) : (\n <div className={styles.empty} data-slot=\"tags-input-empty\">\n No options\n </div>\n )}\n </div>\n </div>\n ) : null}\n </div>\n );\n});\n"],"mappings":";;;;;;AA6CA,SAAS,aAAa,OAAsC,OAAe;CACzE,MAAM,SAAS,MAAM;CACrB,MAAM,aAAa;EACjB,SAAS,OAAO;EAChB,IAAI,OAAO;EACX,MAAM,OAAO;EACb;CACF;CAEA,OAAO;EACL,GAAG;EACH,eAAe;EACf,QAAQ;CACV;AACF;AAEA,SAAS,OAAO,KAAa,OAAe;CAC1C,OAAO,GAAG,IAAI,GAAG;AACnB;AAEA,SAAS,aAAa,OAAe,WAA4B;CAC/D,IAAI,OAAO,cAAc,UAAU,OAAO,UAAU,SAAS,KAAK,MAAM,SAAS,SAAS;CAC1F,UAAU,YAAY;CACtB,MAAM,SAAS,UAAU,KAAK,KAAK;CACnC,UAAU,YAAY;CACtB,OAAO;AACT;AAEA,MAAa,YAAY,WAA6C,SAAS,UAC7E,EACE,oBAAoB,iBACpB,gBAAgB,aAChB,cAAc,WACd,kBAAkB,OAClB,WACA,OAAO,CAAC,GACR,cAAc,CAAC,GACf,eAAe,IACf,WAAW,OACX,YAAY,UACZ,WAAW,OACX,IAAI,YACJ,OACA,QACA,UACA,SACA,oBACA,cACA,aACA,MAAM,gBACN,OAAO,sBACP,GAAG,SAEL,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AAW,OAAO;MAAO,aAAU;gBAAmB;KAEtD,CAAA;IAEJ,CAAA;GACF,CAAA,IACH;EACD;;AAET,CAAC"}
1
+ {"version":3,"file":"tags-input.js","names":[],"sources":["../../../src/components/tags-input/tags-input.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, useCallback, useId, useMemo, useRef, useState } from \"react\";\nimport type {\n ChangeEvent,\n ChangeEventHandler,\n ComponentPropsWithoutRef,\n FocusEvent,\n KeyboardEvent,\n MouseEvent,\n ClipboardEvent,\n ReactNode,\n} from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { tagsInput } from \"../../styled-system/recipes\";\n\nexport interface TagsInputProps\n extends Omit<\n ComponentPropsWithoutRef<\"input\">,\n \"children\" | \"defaultValue\" | \"onChange\" | \"type\" | \"value\"\n > {\n /** Current tags. Omit this prop to use the uncontrolled API. */\n tags?: readonly string[];\n /** Initial tags for the uncontrolled API. */\n defaultTags?: readonly string[];\n /** Called whenever a tag is added or removed. */\n onTagsChange?: (tags: string[]) => void;\n /** Optional suggestions. A tag is accepted after a comma only when it is in this list. */\n data?: readonly string[];\n /** Visible label for the input. */\n label?: ReactNode;\n /** Current text query. This is the native input value, not the selected tags. */\n value?: string;\n /** Initial text query for an uncontrolled input. */\n defaultValue?: string;\n /** Native input change callback. */\n onChange?: ChangeEventHandler<HTMLInputElement>;\n /** Optional callback useful when a controlled query is cleared by selecting a tag. */\n onInputValueChange?: (value: string) => void;\n allowDuplicates?: boolean;\n delimiter?: string | RegExp;\n editable?: boolean;\n}\n\nfunction changedEvent(event: ChangeEvent<HTMLInputElement>, value: string) {\n const target = event.target;\n const nextTarget = {\n checked: target.checked,\n id: target.id,\n name: target.name,\n value,\n } as HTMLInputElement;\n\n return {\n ...event,\n currentTarget: nextTarget,\n target: nextTarget,\n } as ChangeEvent<HTMLInputElement>;\n}\n\nfunction tagKey(tag: string, index: number) {\n return `${tag}-${index}`;\n}\n\nfunction hasDelimiter(value: string, delimiter: string | RegExp) {\n if (typeof delimiter === \"string\") return delimiter.length > 0 && value.includes(delimiter);\n delimiter.lastIndex = 0;\n const result = delimiter.test(value);\n delimiter.lastIndex = 0;\n return result;\n}\n\nexport const TagsInput = forwardRef<HTMLInputElement, TagsInputProps>(function TagsInput(\n {\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": ariaInvalid,\n \"aria-label\": ariaLabel,\n allowDuplicates = false,\n className,\n data = [],\n defaultTags = [],\n defaultValue = \"\",\n disabled = false,\n delimiter = /[,\\n]/u,\n editable = false,\n id: providedId,\n label,\n onBlur,\n onChange,\n onFocus,\n onInputValueChange,\n onTagsChange,\n placeholder,\n tags: controlledTags,\n value: controlledInputValue,\n ...props\n },\n ref,\n) {\n const generatedId = useId();\n const id = providedId ?? generatedId;\n const [uncontrolledTags, setUncontrolledTags] = useState<string[]>(() => [...defaultTags]);\n const [uncontrolledInputValue, setUncontrolledInputValue] = useState(defaultValue);\n const [focused, setFocused] = useState(false);\n const [composing, setComposing] = useState(false);\n const [editingTag, setEditingTag] = useState<{ index: number; value: string } | null>(null);\n const rootRef = useRef<HTMLDivElement>(null);\n const styles = tagsInput();\n const selectedTags = controlledTags === undefined ? uncontrolledTags : [...controlledTags];\n const inputValue =\n controlledInputValue === undefined ? uncontrolledInputValue : controlledInputValue;\n\n const updateTags = useCallback(\n (nextTags: string[]) => {\n if (controlledTags === undefined) setUncontrolledTags(nextTags);\n onTagsChange?.(nextTags);\n },\n [controlledTags, onTagsChange],\n );\n\n const clearInput = useCallback(\n (event?: ChangeEvent<HTMLInputElement>) => {\n if (controlledInputValue === undefined) setUncontrolledInputValue(\"\");\n onInputValueChange?.(\"\");\n if (event) onChange?.(changedEvent(event, \"\"));\n },\n [controlledInputValue, onChange, onInputValueChange],\n );\n\n const addTag = useCallback(\n (rawTag: string, event?: ChangeEvent<HTMLInputElement>) => {\n const tag = rawTag.trim();\n const isAllowed = data.length === 0 || data.includes(tag);\n const duplicate = selectedTags.includes(tag);\n if (tag && isAllowed && (allowDuplicates || !duplicate)) {\n if (editingTag) {\n updateTags([\n ...selectedTags.slice(0, editingTag.index),\n tag,\n ...selectedTags.slice(editingTag.index),\n ]);\n setEditingTag(null);\n } else {\n updateTags([...selectedTags, tag]);\n }\n } else if (editingTag) {\n return;\n }\n clearInput(event);\n },\n [allowDuplicates, clearInput, data, editingTag, selectedTags, updateTags],\n );\n\n const addDelimited = useCallback(\n (rawValue: string, event?: ChangeEvent<HTMLInputElement>) => {\n const separator =\n typeof delimiter === \"string\" && delimiter.length === 0 ? /\\r?\\n/u : delimiter;\n const values = rawValue\n .split(separator)\n .map((value) => value.trim())\n .filter(Boolean);\n const nextTags = [...selectedTags];\n for (const value of values) {\n const isAllowed = data.length === 0 || data.includes(value);\n if (isAllowed && (allowDuplicates || !nextTags.includes(value))) nextTags.push(value);\n }\n if (nextTags.length !== selectedTags.length) updateTags(nextTags);\n clearInput(event);\n },\n [allowDuplicates, clearInput, data, delimiter, selectedTags, updateTags],\n );\n\n const suggestions = useMemo(() => {\n const query = inputValue.trim().toLocaleLowerCase();\n return data.filter(\n (item) =>\n !selectedTags.includes(item) &&\n (query.length === 0 || item.toLocaleLowerCase().includes(query)),\n );\n }, [data, inputValue, selectedTags]);\n\n function handleChange(event: ChangeEvent<HTMLInputElement>) {\n const nextValue = event.currentTarget.value;\n if (nextValue.trim() === \"\") {\n clearInput(event);\n onChange?.(event);\n return;\n }\n\n if (!composing && hasDelimiter(nextValue, delimiter)) {\n addDelimited(nextValue, event);\n return;\n }\n\n if (controlledInputValue === undefined) setUncontrolledInputValue(nextValue);\n onInputValueChange?.(nextValue);\n onChange?.(event);\n }\n\n function handleBlur(event: FocusEvent<HTMLInputElement>) {\n setFocused(false);\n onBlur?.(event);\n }\n\n function handlePaste(event: ClipboardEvent<HTMLInputElement>) {\n const pasted = event.clipboardData.getData(\"text\");\n if (!pasted || (!hasDelimiter(pasted, delimiter) && !pasted.includes(\"\\n\"))) return;\n event.preventDefault();\n addDelimited(pasted);\n }\n\n function handleKeyDown(event: KeyboardEvent<HTMLInputElement>) {\n if (event.nativeEvent.isComposing || composing) return;\n if (event.key === \"Enter\") {\n event.preventDefault();\n if (inputValue.trim()) addTag(inputValue);\n else if (editingTag) setEditingTag(null);\n } else if (event.key === \"Escape\" && editingTag) {\n event.preventDefault();\n updateTags([\n ...selectedTags.slice(0, editingTag.index),\n editingTag.value,\n ...selectedTags.slice(editingTag.index),\n ]);\n clearInput();\n setEditingTag(null);\n } else if (event.key === \"Backspace\" && !inputValue && editable && selectedTags.length > 0) {\n const index = selectedTags.length - 1;\n const tag = selectedTags[index];\n if (tag === undefined) return;\n setEditingTag({ index, value: tag });\n updateTags(selectedTags.slice(0, -1));\n if (controlledInputValue === undefined) setUncontrolledInputValue(tag);\n onInputValueChange?.(tag);\n }\n props.onKeyDown?.(event);\n }\n\n function removeTag(index: number) {\n updateTags(selectedTags.filter((_, currentIndex) => currentIndex !== index));\n }\n\n return (\n <div\n className={styles.root}\n data-jaci-component=\"tags-input\"\n data-slot=\"tags-input\"\n ref={rootRef}\n >\n {label ? (\n <label className={styles.label} data-slot=\"tags-input-label\" htmlFor={id}>\n {label}\n </label>\n ) : null}\n <div\n className={cx(styles.control, className)}\n data-disabled={disabled || undefined}\n data-focus={focused || undefined}\n data-slot=\"tags-input-control\"\n >\n <div className={styles.tagList} data-slot=\"tags-input-tag-list\">\n {selectedTags.map((tag, index) => (\n <span className={styles.tag} data-slot=\"tags-input-tag\" key={tagKey(tag, index)}>\n <span className={styles.tagLabel} data-slot=\"tags-input-tag-label\">\n {tag}\n </span>\n <button\n aria-label={`Remove ${tag}`}\n className={styles.tagRemove}\n data-slot=\"tags-input-tag-remove\"\n disabled={disabled}\n onClick={() => removeTag(index)}\n type=\"button\"\n >\n ×\n </button>\n </span>\n ))}\n </div>\n <input\n {...props}\n {...(ariaDescribedBy ? { \"aria-describedby\": ariaDescribedBy } : {})}\n {...(ariaInvalid !== undefined ? { \"aria-invalid\": ariaInvalid } : {})}\n {...(ariaLabel ? { \"aria-label\": ariaLabel } : {})}\n autoComplete=\"off\"\n className={styles.input}\n disabled={disabled}\n id={id}\n onBlur={handleBlur}\n onChange={handleChange}\n onCompositionEnd={() => setComposing(false)}\n onCompositionStart={() => setComposing(true)}\n onFocus={(event) => {\n setFocused(true);\n onFocus?.(event);\n }}\n onKeyDown={handleKeyDown}\n onPaste={handlePaste}\n placeholder={placeholder}\n ref={ref}\n type=\"text\"\n value={inputValue}\n />\n </div>\n {focused && data.length > 0 ? (\n <div className={styles.positioner} data-slot=\"tags-input-positioner\">\n <div\n aria-label=\"Suggestions\"\n className={styles.list}\n data-slot=\"tags-input-list\"\n role=\"listbox\"\n >\n {suggestions.length > 0 ? (\n suggestions.map((item) => (\n <button\n aria-selected={false}\n className={styles.item}\n data-slot=\"tags-input-item\"\n key={item}\n onClick={() => addTag(item)}\n onMouseDown={(event: MouseEvent<HTMLButtonElement>) => event.preventDefault()}\n role=\"option\"\n type=\"button\"\n >\n {item}\n </button>\n ))\n ) : (\n <div className={styles.empty} data-slot=\"tags-input-empty\">\n No options\n </div>\n )}\n </div>\n </div>\n ) : null}\n </div>\n );\n});\n"],"mappings":";;;;;;AA6CA,SAAS,aAAa,OAAsC,OAAe;CACzE,MAAM,SAAS,MAAM;CACrB,MAAM,aAAa;EACjB,SAAS,OAAO;EAChB,IAAI,OAAO;EACX,MAAM,OAAO;EACb;CACF;CAEA,OAAO;EACL,GAAG;EACH,eAAe;EACf,QAAQ;CACV;AACF;AAEA,SAAS,OAAO,KAAa,OAAe;CAC1C,OAAO,GAAG,IAAI,GAAG;AACnB;AAEA,SAAS,aAAa,OAAe,WAA4B;CAC/D,IAAI,OAAO,cAAc,UAAU,OAAO,UAAU,SAAS,KAAK,MAAM,SAAS,SAAS;CAC1F,UAAU,YAAY;CACtB,MAAM,SAAS,UAAU,KAAK,KAAK;CACnC,UAAU,YAAY;CACtB,OAAO;AACT;AAEA,MAAa,YAAY,WAA6C,SAAS,UAC7E,EACE,oBAAoB,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W,OAAO;KAClB,aAAU;KACV,MAAK;KAEJ,UAAA,YAAY,SAAS,IACpB,YAAY,KAAK,SACf,oBAAC,UAAD;MACE,iBAAe;MACf,WAAW,OAAO;MAClB,aAAU;MAEV,eAAe,OAAO,IAAI;MAC1B,cAAc,UAAyC,MAAM,eAAe;MAC5E,MAAK;MACL,MAAK;MAEJ,UAAA;KACK,GAPD,IAOC,CACT,IAED,oBAAC,OAAD;MAAK,WAAW,OAAO;MAAO,aAAU;MAAmB,UAAA;KAEtD,CAAA;IAEJ,CAAA;GACF,CAAA,IACH;EACD;;AAET,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"toast.cjs","names":["BaseToast","withRecipeClassName","toastRecipe","cx","useThemePortalProps"],"sources":["../../../src/components/toast/toast.tsx"],"sourcesContent":["\"use client\";\n\nimport { Toast as BaseToast } from \"@base-ui/react/toast\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { toast as toastRecipe } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\nimport { useThemePortalProps } from \"../../theme/theme-scope\";\n\nexport type ToastTone = \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\";\n\nconst toneByToastType: Record<string, ToastTone> = {\n danger: \"danger\",\n error: \"danger\",\n info: \"info\",\n success: \"success\",\n warning: \"warning\",\n};\n\nfunction resolveTone(type: string | undefined, tone: ToastTone | undefined): ToastTone {\n return tone ?? (type === undefined ? \"neutral\" : (toneByToastType[type] ?? \"neutral\"));\n}\n\nexport type ToastProviderProps = ComponentPropsWithoutRef<typeof BaseToast.Provider>;\n\n/**\n * Creates an isolated, declarative toast region. Configure `timeout` and\n * `limit` here; use `Toast.Root` to render each toast from local state or\n * `Toast.useToastManager()`.\n */\nexport function ToastProvider(props: ToastProviderProps) {\n return <BaseToast.Provider {...props} />;\n}\n\nexport type ToastViewportProps = ComponentPropsWithoutRef<typeof BaseToast.Viewport>;\n\n/**\n * A bottom-centred notification region.\n */\nexport const ToastViewport = forwardRef<HTMLDivElement, ToastViewportProps>(function ToastViewport(\n { \"aria-label\": ariaLabel, \"aria-live\": ariaLive, className, ...props },\n ref,\n) {\n return (\n <BaseToast.Viewport\n {...props}\n aria-label={ariaLabel ?? \"Notifications\"}\n aria-live={ariaLive ?? \"polite\"}\n ref={ref}\n className={withRecipeClassName(toastRecipe().viewport, className)}\n data-jaci-component=\"toast-viewport\"\n data-slot=\"toast-viewport\"\n />\n );\n});\n\nexport interface ToastRootProps extends ComponentPropsWithoutRef<typeof BaseToast.Root> {\n /**\n * Visual status. When omitted, the value is inferred from the toast's\n * `type` (`error` maps to `danger`) and otherwise remains neutral.\n */\n tone?: ToastTone;\n}\n\n/**\n * Renders a toast object while preserving Base UI's lifecycle, focus, swipe,\n * and auto-dismiss behavior. It is intentionally composed rather than a\n * global imperative notification API.\n */\nexport const ToastRoot = forwardRef<HTMLDivElement, ToastRootProps>(function ToastRoot(\n { className, toast: toastObject, tone, ...props },\n ref,\n) {\n const resolvedTone = resolveTone(toastObject.type, tone);\n\n return (\n <BaseToast.Root\n {...props}\n ref={ref}\n toast={toastObject}\n className={withRecipeClassName(toastRecipe({ tone: resolvedTone }).root, className)}\n data-jaci-component=\"toast\"\n data-jaci-tone={resolvedTone}\n data-slot=\"toast\"\n />\n );\n});\n\nexport type ToastContentProps = ComponentPropsWithoutRef<typeof BaseToast.Content>;\n\nexport const ToastContent = forwardRef<HTMLDivElement, ToastContentProps>(function ToastContent(\n { className, ...props },\n ref,\n) {\n return (\n <BaseToast.Content\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().content, className)}\n data-slot=\"toast-content\"\n />\n );\n});\n\n/** A layout wrapper for `Toast.Title` and `Toast.Description`. */\nexport type ToastTextProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const ToastText = forwardRef<HTMLDivElement, ToastTextProps>(function ToastText(\n { className, ...props },\n ref,\n) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(toastRecipe().text, className)}\n data-slot=\"toast-text\"\n />\n );\n});\n\nexport type ToastTitleProps = ComponentPropsWithoutRef<typeof BaseToast.Title>;\n\nexport const ToastTitle = forwardRef<HTMLHeadingElement, ToastTitleProps>(function ToastTitle(\n { className, ...props },\n ref,\n) {\n return (\n <BaseToast.Title\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().title, className)}\n data-slot=\"toast-title\"\n />\n );\n});\n\nexport type ToastDescriptionProps = ComponentPropsWithoutRef<typeof BaseToast.Description>;\n\nexport const ToastDescription = forwardRef<HTMLParagraphElement, ToastDescriptionProps>(\n function ToastDescription({ className, ...props }, ref) {\n return (\n <BaseToast.Description\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().description, className)}\n data-slot=\"toast-description\"\n />\n );\n },\n);\n\nexport type ToastCloseProps = ComponentPropsWithoutRef<typeof BaseToast.Close>;\n\nexport const ToastClose = forwardRef<HTMLButtonElement, ToastCloseProps>(function ToastClose(\n { \"aria-label\": ariaLabel, children, className, ...props },\n ref,\n) {\n const hasVisibleLabel = children != null;\n\n return (\n <BaseToast.Close\n {...props}\n aria-label={ariaLabel ?? (hasVisibleLabel ? undefined : \"Dismiss notification\")}\n ref={ref}\n className={withRecipeClassName(toastRecipe().close, className)}\n data-slot=\"toast-close\"\n >\n {children ?? \"×\"}\n </BaseToast.Close>\n );\n});\n\nexport type ToastActionProps = ComponentPropsWithoutRef<typeof BaseToast.Action>;\n\nexport const ToastAction = forwardRef<HTMLButtonElement, ToastActionProps>(function ToastAction(\n { className, ...props },\n ref,\n) {\n return (\n <BaseToast.Action\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().action, className)}\n data-slot=\"toast-action\"\n />\n );\n});\n\n/** Base UI's portal is preserved for rendering the viewport at document level. */\nexport function ToastPortal(props: ComponentPropsWithoutRef<typeof BaseToast.Portal>) {\n return <BaseToast.Portal {...useThemePortalProps(props)} />;\n}\n\nexport interface ToastComponent {\n Provider: typeof ToastProvider;\n Viewport: typeof ToastViewport;\n Root: typeof ToastRoot;\n Content: typeof ToastContent;\n Text: typeof ToastText;\n Title: typeof ToastTitle;\n Description: typeof ToastDescription;\n Close: typeof ToastClose;\n Action: typeof ToastAction;\n Portal: typeof ToastPortal;\n useToastManager: typeof BaseToast.useToastManager;\n}\n\nexport const Toast: ToastComponent = {\n Provider: ToastProvider,\n Viewport: ToastViewport,\n Root: ToastRoot,\n Content: ToastContent,\n Text: ToastText,\n Title: ToastTitle,\n Description: ToastDescription,\n Close: ToastClose,\n Action: ToastAction,\n Portal: ToastPortal,\n useToastManager: BaseToast.useToastManager,\n};\n"],"mappings":";;;;;;;;;AAaA,MAAM,kBAA6C;CACjD,QAAQ;CACR,OAAO;CACP,MAAM;CACN,SAAS;CACT,SAAS;AACX;AAEA,SAAS,YAAY,MAA0B,MAAwC;CACrF,OAAO,SAAS,SAAS,KAAA,IAAY,YAAa,gBAAgB,SAAS;AAC7E;;;;;;AASA,SAAgB,cAAc,OAA2B;CACvD,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACA,qBAAAA,MAAU,UAAX,EAAoB,GAAI,MAAQ,CAAA;AACzC;;;;AAOA,MAAa,iBAAA,GAAA,MAAA,WAAA,CAA+D,SAAS,cACnF,EAAE,cAAc,WAAW,aAAa,UAAU,WAAW,GAAG,SAChE,KACA;CACA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACA,qBAAAA,MAAU,UAAX;EACE,GAAI;EACJ,cAAY,aAAa;EACzB,aAAW,YAAY;EAClB;EACL,WAAWC,gBAAAA,oBAAoBC,cAAAA,MAAY,CAAC,CAAC,UAAU,SAAS;EAChE,uBAAoB;EACpB,aAAU;CACX,CAAA;AAEL,CAAC;;;;;;AAeD,MAAa,aAAA,GAAA,MAAA,WAAA,CAAuD,SAAS,UAC3E,EAAE,WAAW,OAAO,aAAa,MAAM,GAAG,SAC1C,KACA;CACA,MAAM,eAAe,YAAY,YAAY,MAAM,IAAI;CAEvD,O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CAAC,aAAa,SAAS;EACnE,aAAU;CACX,CAAA;AAEL,CACF;AAIA,MAAa,cAAA,GAAA,MAAA,WAAA,CAA4D,SAAS,WAChF,EAAE,cAAc,WAAW,UAAU,WAAW,GAAG,SACnD,KACA;CACA,MAAM,kBAAkB,YAAY;CAEpC,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACF,qBAAAA,MAAU,OAAX;EACE,GAAI;EACJ,cAAY,cAAc,kBAAkB,KAAA,IAAY;EACnD;EACL,WAAWC,gBAAAA,oBAAoBC,cAAAA,MAAY,CAAC,CAAC,OAAO,SAAS;EAC7D,aAAU;YAET,YAAY;CACE,CAAA;AAErB,CAAC;AAID,MAAa,eAAA,GAAA,MAAA,WAAA,CAA8D,SAAS,YAClF,EAAE,WAAW,GAAG,SAChB,KACA;CACA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACF,qBAAAA,MAAU,QAAX;EACE,GAAI;EACC;EACL,WAAWC,gBAAAA,oBAAoBC,cAAAA,MAAY,CAAC,CAAC,QAAQ,SAAS;EAC9D,aAAU;CACX,CAAA;AAEL,CAAC;;AAGD,SAAgB,YAAY,OAA0D;CACpF,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACF,qBAAAA,MAAU,QAAX,EAAkB,GAAII,oBAAAA,oBAAoB,KAAK,EAAI,CAAA;AAC5D;AAgBA,MAAa,QAAwB;CACnC,UAAU;CACV,UAAU;CACV,MAAM;CACN,SAAS;CACT,MAAM;CACN,OAAO;CACP,aAAa;CACb,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,iBAAiBJ,qBAAAA,MAAU;AAC7B"}
1
+ {"version":3,"file":"toast.cjs","names":["BaseToast","forwardRef","withRecipeClassName","toastRecipe","cx","useThemePortalProps"],"sources":["../../../src/components/toast/toast.tsx"],"sourcesContent":["\"use client\";\n\nimport { Toast as BaseToast } from \"@base-ui/react/toast\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { toast as toastRecipe } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\nimport { useThemePortalProps } from \"../../theme/theme-scope\";\n\nexport type ToastTone = \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\";\n\nconst toneByToastType: Record<string, ToastTone> = {\n danger: \"danger\",\n error: \"danger\",\n info: \"info\",\n success: \"success\",\n warning: \"warning\",\n};\n\nfunction resolveTone(type: string | undefined, tone: ToastTone | undefined): ToastTone {\n return tone ?? (type === undefined ? \"neutral\" : (toneByToastType[type] ?? \"neutral\"));\n}\n\nexport type ToastProviderProps = ComponentPropsWithoutRef<typeof BaseToast.Provider>;\n\n/**\n * Creates an isolated, declarative toast region. Configure `timeout` and\n * `limit` here; use `Toast.Root` to render each toast from local state or\n * `Toast.useToastManager()`.\n */\nexport function ToastProvider(props: ToastProviderProps) {\n return <BaseToast.Provider {...props} />;\n}\n\nexport type ToastViewportProps = ComponentPropsWithoutRef<typeof BaseToast.Viewport>;\n\n/**\n * A bottom-centred notification region.\n */\nexport const ToastViewport = forwardRef<HTMLDivElement, ToastViewportProps>(function ToastViewport(\n { \"aria-label\": ariaLabel, \"aria-live\": ariaLive, className, ...props },\n ref,\n) {\n return (\n <BaseToast.Viewport\n {...props}\n aria-label={ariaLabel ?? \"Notifications\"}\n aria-live={ariaLive ?? \"polite\"}\n ref={ref}\n className={withRecipeClassName(toastRecipe().viewport, className)}\n data-jaci-component=\"toast-viewport\"\n data-slot=\"toast-viewport\"\n />\n );\n});\n\nexport interface ToastRootProps extends ComponentPropsWithoutRef<typeof BaseToast.Root> {\n /**\n * Visual status. When omitted, the value is inferred from the toast's\n * `type` (`error` maps to `danger`) and otherwise remains neutral.\n */\n tone?: ToastTone;\n}\n\n/**\n * Renders a toast object while preserving Base UI's lifecycle, focus, swipe,\n * and auto-dismiss behavior. It is intentionally composed rather than a\n * global imperative notification API.\n */\nexport const ToastRoot = forwardRef<HTMLDivElement, ToastRootProps>(function ToastRoot(\n { className, toast: toastObject, tone, ...props },\n ref,\n) {\n const resolvedTone = resolveTone(toastObject.type, tone);\n\n return (\n <BaseToast.Root\n {...props}\n ref={ref}\n toast={toastObject}\n className={withRecipeClassName(toastRecipe({ tone: resolvedTone }).root, className)}\n data-jaci-component=\"toast\"\n data-jaci-tone={resolvedTone}\n data-slot=\"toast\"\n />\n );\n});\n\nexport type ToastContentProps = ComponentPropsWithoutRef<typeof BaseToast.Content>;\n\nexport const ToastContent = forwardRef<HTMLDivElement, ToastContentProps>(function ToastContent(\n { className, ...props },\n ref,\n) {\n return (\n <BaseToast.Content\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().content, className)}\n data-slot=\"toast-content\"\n />\n );\n});\n\n/** A layout wrapper for `Toast.Title` and `Toast.Description`. */\nexport type ToastTextProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const ToastText = forwardRef<HTMLDivElement, ToastTextProps>(function ToastText(\n { className, ...props },\n ref,\n) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(toastRecipe().text, className)}\n data-slot=\"toast-text\"\n />\n );\n});\n\nexport type ToastTitleProps = ComponentPropsWithoutRef<typeof BaseToast.Title>;\n\nexport const ToastTitle = forwardRef<HTMLHeadingElement, ToastTitleProps>(function ToastTitle(\n { className, ...props },\n ref,\n) {\n return (\n <BaseToast.Title\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().title, className)}\n data-slot=\"toast-title\"\n />\n );\n});\n\nexport type ToastDescriptionProps = ComponentPropsWithoutRef<typeof BaseToast.Description>;\n\nexport const ToastDescription = forwardRef<HTMLParagraphElement, ToastDescriptionProps>(\n function ToastDescription({ className, ...props }, ref) {\n return (\n <BaseToast.Description\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().description, className)}\n data-slot=\"toast-description\"\n />\n );\n },\n);\n\nexport type ToastCloseProps = ComponentPropsWithoutRef<typeof BaseToast.Close>;\n\nexport const ToastClose = forwardRef<HTMLButtonElement, ToastCloseProps>(function ToastClose(\n { \"aria-label\": ariaLabel, children, className, ...props },\n ref,\n) {\n const hasVisibleLabel = children != null;\n\n return (\n <BaseToast.Close\n {...props}\n aria-label={ariaLabel ?? (hasVisibleLabel ? undefined : \"Dismiss notification\")}\n ref={ref}\n className={withRecipeClassName(toastRecipe().close, className)}\n data-slot=\"toast-close\"\n >\n {children ?? \"×\"}\n </BaseToast.Close>\n );\n});\n\nexport type ToastActionProps = ComponentPropsWithoutRef<typeof BaseToast.Action>;\n\nexport const ToastAction = forwardRef<HTMLButtonElement, ToastActionProps>(function ToastAction(\n { className, ...props },\n ref,\n) {\n return (\n <BaseToast.Action\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().action, className)}\n data-slot=\"toast-action\"\n />\n );\n});\n\n/** Base UI's portal is preserved for rendering the viewport at document level. */\nexport function ToastPortal(props: ComponentPropsWithoutRef<typeof BaseToast.Portal>) {\n return <BaseToast.Portal {...useThemePortalProps(props)} />;\n}\n\nexport interface ToastComponent {\n Provider: typeof ToastProvider;\n Viewport: typeof ToastViewport;\n Root: typeof ToastRoot;\n Content: typeof ToastContent;\n Text: typeof ToastText;\n Title: typeof ToastTitle;\n Description: typeof ToastDescription;\n Close: typeof ToastClose;\n Action: typeof ToastAction;\n Portal: typeof ToastPortal;\n useToastManager: typeof BaseToast.useToastManager;\n}\n\nexport const Toast: ToastComponent = {\n Provider: ToastProvider,\n Viewport: ToastViewport,\n Root: ToastRoot,\n Content: ToastContent,\n Text: ToastText,\n Title: ToastTitle,\n Description: ToastDescription,\n Close: ToastClose,\n Action: ToastAction,\n Portal: ToastPortal,\n useToastManager: BaseToast.useToastManager,\n};\n"],"mappings":";;;;;;;;;AAaA,MAAM,kBAA6C;CACjD,QAAQ;CACR,OAAO;CACP,MAAM;CACN,SAAS;CACT,SAAS;AACX;AAEA,SAAS,YAAY,MAA0B,MAAwC;CACrF,OAAO,SAAS,SAAS,KAAA,IAAY,YAAa,gBAAgB,SAAS;AAC7E;;;;;;AASA,S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EACC;EACL,WAAWE,gBAAAA,oBAAoBC,cAAAA,MAAY,CAAC,CAAC,QAAQ,SAAS;EAC9D,aAAU;CACX,CAAA;AAEL,CAAC;;AAGD,SAAgB,YAAY,OAA0D;CACpF,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACH,qBAAAA,MAAU,QAAX,EAAkB,GAAIK,oBAAAA,oBAAoB,KAAK,EAAI,CAAA;AAC5D;AAgBA,MAAa,QAAwB;CACnC,UAAU;CACV,UAAU;CACV,MAAM;CACN,SAAS;CACT,MAAM;CACN,OAAO;CACP,aAAa;CACb,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,iBAAiBL,qBAAAA,MAAU;AAC7B"}
@@ -1 +1 @@
1
- {"version":3,"file":"toast.js","names":["BaseToast","toastRecipe","Toast"],"sources":["../../../src/components/toast/toast.tsx"],"sourcesContent":["\"use client\";\n\nimport { Toast as BaseToast } from \"@base-ui/react/toast\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { toast as toastRecipe } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\nimport { useThemePortalProps } from \"../../theme/theme-scope\";\n\nexport type ToastTone = \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\";\n\nconst toneByToastType: Record<string, ToastTone> = {\n danger: \"danger\",\n error: \"danger\",\n info: \"info\",\n success: \"success\",\n warning: \"warning\",\n};\n\nfunction resolveTone(type: string | undefined, tone: ToastTone | undefined): ToastTone {\n return tone ?? (type === undefined ? \"neutral\" : (toneByToastType[type] ?? \"neutral\"));\n}\n\nexport type ToastProviderProps = ComponentPropsWithoutRef<typeof BaseToast.Provider>;\n\n/**\n * Creates an isolated, declarative toast region. Configure `timeout` and\n * `limit` here; use `Toast.Root` to render each toast from local state or\n * `Toast.useToastManager()`.\n */\nexport function ToastProvider(props: ToastProviderProps) {\n return <BaseToast.Provider {...props} />;\n}\n\nexport type ToastViewportProps = ComponentPropsWithoutRef<typeof BaseToast.Viewport>;\n\n/**\n * A bottom-centred notification region.\n */\nexport const ToastViewport = forwardRef<HTMLDivElement, ToastViewportProps>(function ToastViewport(\n { \"aria-label\": ariaLabel, \"aria-live\": ariaLive, className, ...props },\n ref,\n) {\n return (\n <BaseToast.Viewport\n {...props}\n aria-label={ariaLabel ?? \"Notifications\"}\n aria-live={ariaLive ?? \"polite\"}\n ref={ref}\n className={withRecipeClassName(toastRecipe().viewport, className)}\n data-jaci-component=\"toast-viewport\"\n data-slot=\"toast-viewport\"\n />\n );\n});\n\nexport interface ToastRootProps extends ComponentPropsWithoutRef<typeof BaseToast.Root> {\n /**\n * Visual status. When omitted, the value is inferred from the toast's\n * `type` (`error` maps to `danger`) and otherwise remains neutral.\n */\n tone?: ToastTone;\n}\n\n/**\n * Renders a toast object while preserving Base UI's lifecycle, focus, swipe,\n * and auto-dismiss behavior. It is intentionally composed rather than a\n * global imperative notification API.\n */\nexport const ToastRoot = forwardRef<HTMLDivElement, ToastRootProps>(function ToastRoot(\n { className, toast: toastObject, tone, ...props },\n ref,\n) {\n const resolvedTone = resolveTone(toastObject.type, tone);\n\n return (\n <BaseToast.Root\n {...props}\n ref={ref}\n toast={toastObject}\n className={withRecipeClassName(toastRecipe({ tone: resolvedTone }).root, className)}\n data-jaci-component=\"toast\"\n data-jaci-tone={resolvedTone}\n data-slot=\"toast\"\n />\n );\n});\n\nexport type ToastContentProps = ComponentPropsWithoutRef<typeof BaseToast.Content>;\n\nexport const ToastContent = forwardRef<HTMLDivElement, ToastContentProps>(function ToastContent(\n { className, ...props },\n ref,\n) {\n return (\n <BaseToast.Content\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().content, className)}\n data-slot=\"toast-content\"\n />\n );\n});\n\n/** A layout wrapper for `Toast.Title` and `Toast.Description`. */\nexport type ToastTextProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const ToastText = forwardRef<HTMLDivElement, ToastTextProps>(function ToastText(\n { className, ...props },\n ref,\n) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(toastRecipe().text, className)}\n data-slot=\"toast-text\"\n />\n );\n});\n\nexport type ToastTitleProps = ComponentPropsWithoutRef<typeof BaseToast.Title>;\n\nexport const ToastTitle = forwardRef<HTMLHeadingElement, ToastTitleProps>(function ToastTitle(\n { className, ...props },\n ref,\n) {\n return (\n <BaseToast.Title\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().title, className)}\n data-slot=\"toast-title\"\n />\n );\n});\n\nexport type ToastDescriptionProps = ComponentPropsWithoutRef<typeof BaseToast.Description>;\n\nexport const ToastDescription = forwardRef<HTMLParagraphElement, ToastDescriptionProps>(\n function ToastDescription({ className, ...props }, ref) {\n return (\n <BaseToast.Description\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().description, className)}\n data-slot=\"toast-description\"\n />\n );\n },\n);\n\nexport type ToastCloseProps = ComponentPropsWithoutRef<typeof BaseToast.Close>;\n\nexport const ToastClose = forwardRef<HTMLButtonElement, ToastCloseProps>(function ToastClose(\n { \"aria-label\": ariaLabel, children, className, ...props },\n ref,\n) {\n const hasVisibleLabel = children != null;\n\n return (\n <BaseToast.Close\n {...props}\n aria-label={ariaLabel ?? (hasVisibleLabel ? undefined : \"Dismiss notification\")}\n ref={ref}\n className={withRecipeClassName(toastRecipe().close, className)}\n data-slot=\"toast-close\"\n >\n {children ?? \"×\"}\n </BaseToast.Close>\n );\n});\n\nexport type ToastActionProps = ComponentPropsWithoutRef<typeof BaseToast.Action>;\n\nexport const ToastAction = forwardRef<HTMLButtonElement, ToastActionProps>(function ToastAction(\n { className, ...props },\n ref,\n) {\n return (\n <BaseToast.Action\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().action, className)}\n data-slot=\"toast-action\"\n />\n );\n});\n\n/** Base UI's portal is preserved for rendering the viewport at document level. */\nexport function ToastPortal(props: ComponentPropsWithoutRef<typeof BaseToast.Portal>) {\n return <BaseToast.Portal {...useThemePortalProps(props)} />;\n}\n\nexport interface ToastComponent {\n Provider: typeof ToastProvider;\n Viewport: typeof ToastViewport;\n Root: typeof ToastRoot;\n Content: typeof ToastContent;\n Text: typeof ToastText;\n Title: typeof ToastTitle;\n Description: typeof ToastDescription;\n Close: typeof ToastClose;\n Action: typeof ToastAction;\n Portal: typeof ToastPortal;\n useToastManager: typeof BaseToast.useToastManager;\n}\n\nexport const Toast: ToastComponent = {\n Provider: ToastProvider,\n Viewport: ToastViewport,\n Root: ToastRoot,\n Content: ToastContent,\n Text: ToastText,\n Title: ToastTitle,\n Description: ToastDescription,\n Close: ToastClose,\n Action: ToastAction,\n Portal: ToastPortal,\n useToastManager: BaseToast.useToastManager,\n};\n"],"mappings":";;;;;;;;;AAaA,MAAM,kBAA6C;CACjD,QAAQ;CACR,OAAO;CACP,MAAM;CACN,SAAS;CACT,SAAS;AACX;AAEA,SAAS,YAAY,MAA0B,MAAwC;CACrF,OAAO,SAAS,SAAS,KAAA,IAAY,YAAa,gBAAgB,SAAS;AAC7E;;;;;;AASA,SAAgB,cAAc,OAA2B;CACvD,OAAO,oBAACA,MAAU,UAAX,EAAoB,GAAI,MAAQ,CAAA;AACzC;;;;AAOA,MAAa,gBAAgB,WAA+C,SAAS,cACnF,EAAE,cAAc,WAAW,aAAa,UAAU,WAAW,GAAG,SAChE,KACA;CACA,OACE,oBAACA,MAAU,UAAX;EACE,GAAI;EACJ,cAAY,aAAa;EACzB,aAAW,YAAY;EAClB;EACL,WAAW,oBAAoBC,MAAY,CAAC,CAAC,UAAU,SAAS;EAChE,uBAAoB;EACpB,aAAU;CACX,CAAA;AAEL,CAAC;;;;;;AAeD,MAAa,YAAY,WAA2C,SAAS,UAC3E,EAAE,WAAW,OAAO,aAAa,MAAM,GAAG,SAC1C,KACA;CACA,MAAM,eAAe,YAAY,YAAY,MAAM,IAAI;CAEvD,OACE,oBAACD,MAAU,MAAX;EACE,GAAI;EACC;EACL,OAAO;EACP,WAAW,oBAAoBC,MAAY,EAAE,MA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G,SAChB,KACA;CACA,OACE,oBAACD,MAAU,QAAX;EACE,GAAI;EACC;EACL,WAAW,oBAAoBC,MAAY,CAAC,CAAC,QAAQ,SAAS;EAC9D,aAAU;CACX,CAAA;AAEL,CAAC;;AAGD,SAAgB,YAAY,OAA0D;CACpF,OAAO,oBAACD,MAAU,QAAX,EAAkB,GAAI,oBAAoB,KAAK,EAAI,CAAA;AAC5D;AAgBA,MAAaE,UAAwB;CACnC,UAAU;CACV,UAAU;CACV,MAAM;CACN,SAAS;CACT,MAAM;CACN,OAAO;CACP,aAAa;CACb,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,iBAAiBF,MAAU;AAC7B"}
1
+ {"version":3,"file":"toast.js","names":["BaseToast","toastRecipe","Toast"],"sources":["../../../src/components/toast/toast.tsx"],"sourcesContent":["\"use client\";\n\nimport { Toast as BaseToast } from \"@base-ui/react/toast\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { toast as toastRecipe } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\nimport { useThemePortalProps } from \"../../theme/theme-scope\";\n\nexport type ToastTone = \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\";\n\nconst toneByToastType: Record<string, ToastTone> = {\n danger: \"danger\",\n error: \"danger\",\n info: \"info\",\n success: \"success\",\n warning: \"warning\",\n};\n\nfunction resolveTone(type: string | undefined, tone: ToastTone | undefined): ToastTone {\n return tone ?? (type === undefined ? \"neutral\" : (toneByToastType[type] ?? \"neutral\"));\n}\n\nexport type ToastProviderProps = ComponentPropsWithoutRef<typeof BaseToast.Provider>;\n\n/**\n * Creates an isolated, declarative toast region. Configure `timeout` and\n * `limit` here; use `Toast.Root` to render each toast from local state or\n * `Toast.useToastManager()`.\n */\nexport function ToastProvider(props: ToastProviderProps) {\n return <BaseToast.Provider {...props} />;\n}\n\nexport type ToastViewportProps = ComponentPropsWithoutRef<typeof BaseToast.Viewport>;\n\n/**\n * A bottom-centred notification region.\n */\nexport const ToastViewport = forwardRef<HTMLDivElement, ToastViewportProps>(function ToastViewport(\n { \"aria-label\": ariaLabel, \"aria-live\": ariaLive, className, ...props },\n ref,\n) {\n return (\n <BaseToast.Viewport\n {...props}\n aria-label={ariaLabel ?? \"Notifications\"}\n aria-live={ariaLive ?? \"polite\"}\n ref={ref}\n className={withRecipeClassName(toastRecipe().viewport, className)}\n data-jaci-component=\"toast-viewport\"\n data-slot=\"toast-viewport\"\n />\n );\n});\n\nexport interface ToastRootProps extends ComponentPropsWithoutRef<typeof BaseToast.Root> {\n /**\n * Visual status. When omitted, the value is inferred from the toast's\n * `type` (`error` maps to `danger`) and otherwise remains neutral.\n */\n tone?: ToastTone;\n}\n\n/**\n * Renders a toast object while preserving Base UI's lifecycle, focus, swipe,\n * and auto-dismiss behavior. It is intentionally composed rather than a\n * global imperative notification API.\n */\nexport const ToastRoot = forwardRef<HTMLDivElement, ToastRootProps>(function ToastRoot(\n { className, toast: toastObject, tone, ...props },\n ref,\n) {\n const resolvedTone = resolveTone(toastObject.type, tone);\n\n return (\n <BaseToast.Root\n {...props}\n ref={ref}\n toast={toastObject}\n className={withRecipeClassName(toastRecipe({ tone: resolvedTone }).root, className)}\n data-jaci-component=\"toast\"\n data-jaci-tone={resolvedTone}\n data-slot=\"toast\"\n />\n );\n});\n\nexport type ToastContentProps = ComponentPropsWithoutRef<typeof BaseToast.Content>;\n\nexport const ToastContent = forwardRef<HTMLDivElement, ToastContentProps>(function ToastContent(\n { className, ...props },\n ref,\n) {\n return (\n <BaseToast.Content\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().content, className)}\n data-slot=\"toast-content\"\n />\n );\n});\n\n/** A layout wrapper for `Toast.Title` and `Toast.Description`. */\nexport type ToastTextProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const ToastText = forwardRef<HTMLDivElement, ToastTextProps>(function ToastText(\n { className, ...props },\n ref,\n) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(toastRecipe().text, className)}\n data-slot=\"toast-text\"\n />\n );\n});\n\nexport type ToastTitleProps = ComponentPropsWithoutRef<typeof BaseToast.Title>;\n\nexport const ToastTitle = forwardRef<HTMLHeadingElement, ToastTitleProps>(function ToastTitle(\n { className, ...props },\n ref,\n) {\n return (\n <BaseToast.Title\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().title, className)}\n data-slot=\"toast-title\"\n />\n );\n});\n\nexport type ToastDescriptionProps = ComponentPropsWithoutRef<typeof BaseToast.Description>;\n\nexport const ToastDescription = forwardRef<HTMLParagraphElement, ToastDescriptionProps>(\n function ToastDescription({ className, ...props }, ref) {\n return (\n <BaseToast.Description\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().description, className)}\n data-slot=\"toast-description\"\n />\n );\n },\n);\n\nexport type ToastCloseProps = ComponentPropsWithoutRef<typeof BaseToast.Close>;\n\nexport const ToastClose = forwardRef<HTMLButtonElement, ToastCloseProps>(function ToastClose(\n { \"aria-label\": ariaLabel, children, className, ...props },\n ref,\n) {\n const hasVisibleLabel = children != null;\n\n return (\n <BaseToast.Close\n {...props}\n aria-label={ariaLabel ?? (hasVisibleLabel ? undefined : \"Dismiss notification\")}\n ref={ref}\n className={withRecipeClassName(toastRecipe().close, className)}\n data-slot=\"toast-close\"\n >\n {children ?? \"×\"}\n </BaseToast.Close>\n );\n});\n\nexport type ToastActionProps = ComponentPropsWithoutRef<typeof BaseToast.Action>;\n\nexport const ToastAction = forwardRef<HTMLButtonElement, ToastActionProps>(function ToastAction(\n { className, ...props },\n ref,\n) {\n return (\n <BaseToast.Action\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().action, className)}\n data-slot=\"toast-action\"\n />\n );\n});\n\n/** Base UI's portal is preserved for rendering the viewport at document level. */\nexport function ToastPortal(props: ComponentPropsWithoutRef<typeof BaseToast.Portal>) {\n return <BaseToast.Portal {...useThemePortalProps(props)} />;\n}\n\nexport interface ToastComponent {\n Provider: typeof ToastProvider;\n Viewport: typeof ToastViewport;\n Root: typeof ToastRoot;\n Content: typeof ToastContent;\n Text: typeof ToastText;\n Title: typeof ToastTitle;\n Description: typeof ToastDescription;\n Close: typeof ToastClose;\n Action: typeof ToastAction;\n Portal: typeof ToastPortal;\n useToastManager: typeof BaseToast.useToastManager;\n}\n\nexport const Toast: ToastComponent = {\n Provider: ToastProvider,\n Viewport: ToastViewport,\n Root: ToastRoot,\n Content: ToastContent,\n Text: ToastText,\n Title: ToastTitle,\n Description: ToastDescription,\n Close: ToastClose,\n Action: ToastAction,\n Portal: ToastPortal,\n useToastManager: BaseToast.useToastManager,\n};\n"],"mappings":";;;;;;;;;AAaA,MAAM,kBAA6C;CACjD,QAAQ;CACR,OAAO;CACP,MAAM;CACN,SAAS;CACT,SAAS;AACX;AAEA,SAAS,YAAY,MAA0B,MAAwC;CACrF,OAAO,SAAS,SAAS,KAAA,IAAY,YAAa,gBAAgB,SAAS;AAC7E;;;;;;AASA,SAAgB,cAAc,OAA2B;CACvD,OAAO,oBAACA,MAAU,UAAX,EAAoB,GAAI,MAAQ,CAAA;AACzC;;;;AAOA,MAAa,gBAAgB,WAA+C,SAAS,cACnF,EAAE,cAAc,WAAW,aAAa,UAAU,WAAW,GAAG,SAChE,KACA;CACA,OACE,oBAACA,MAAU,UAAX;EACE,GAAI;EACJ,cAAY,aAAa;EACzB,aAAW,YAAY;EAClB;EACL,WAAW,oBAAoBC,MAAY,CAAC,CAAC,UAAU,SAAS;EAChE,uBAAoB;EACpB,aAAU;CACX,CAAA;AAEL,CAAC;;;;;;AAeD,MAAa,YAAY,WAA2C,SAAS,UAC3E,EAAE,WAAW,OAAO,aAAa,MAAM,GAAG,SAC1C,KACA;CACA,MAAM,eAAe,YAAY,YAAY,MAAM,IAAI;CAEvD,OACE,oBAACD,MAAU,MAAX;EACE,GAAI;EACC;EACL,OAAO;EACP,WAAW,oBAAoBC,MAAY,EAAE,MAAM,aAAa,CAAC,CAAC,CAAC,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,oBAACD,MAAU,QAAX;EACE,GAAI;EACC;EACL,WAAW,oBAAoBC,MAAY,CAAC,CAAC,QAAQ,SAAS;EAC9D,aAAU;CACX,CAAA;AAEL,CAAC;;AAGD,SAAgB,YAAY,OAA0D;CACpF,OAAO,oBAACD,MAAU,QAAX,EAAkB,GAAI,oBAAoB,KAAK,EAAI,CAAA;AAC5D;AAgBA,MAAaE,UAAwB;CACnC,UAAU;CACV,UAAU;CACV,MAAM;CACN,SAAS;CACT,MAAM;CACN,OAAO;CACP,aAAa;CACb,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,iBAAiBF,MAAU;AAC7B"}
@@ -1 +1 @@
1
- {"version":3,"file":"toggle.cjs","names":["BaseToggle","withRecipeClassName","toggle"],"sources":["../../../src/components/toggle/toggle.tsx"],"sourcesContent":["\"use client\";\n\nimport { Toggle as BaseToggle } from \"@base-ui/react/toggle\";\nimport { forwardRef } from \"react\";\nimport type { ReactNode } from \"react\";\nimport type { Toggle as BaseToggleType } from \"@base-ui/react/toggle\";\n\nimport { toggle } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\n\nexport type ToggleVariant = \"solid\" | \"outline\" | \"ghost\";\nexport type ToggleSize = \"sm\" | \"md\" | \"lg\";\n\nexport interface ToggleProps\n extends Omit<BaseToggleType.Props<string>, \"children\" | \"className\" | \"onPressedChange\"> {\n children?: ReactNode;\n className?: string;\n onPressedChange?: (pressed: boolean) => void;\n size?: ToggleSize;\n variant?: ToggleVariant;\n}\n\nexport const Toggle = forwardRef<HTMLButtonElement, ToggleProps>(function Toggle(\n { children, className, onPressedChange, size = \"md\", variant = \"outline\", ...props },\n ref,\n) {\n return (\n <BaseToggle\n {...props}\n ref={ref}\n className={withRecipeClassName(toggle({ size, variant }), className)}\n data-jaci-component=\"toggle\"\n data-slot=\"toggle\"\n onPressedChange={(pressed) => onPressedChange?.(pressed)}\n >\n {children}\n </BaseToggle>\n );\n});\n"],"mappings":";;;;;;;AAsBA,MAAa,UAAA,GAAA,MAAA,WAAA,CAAoD,SAAS,OACxE,EAAE,UAAU,WAAW,iBAAiB,OAAO,MAAM,UAAU,WAAW,GAAG,SAC7E,KACA;CACA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACA,sBAAAA,QAAD;EACE,GAAI;EACC;EACL,WAAWC,gBAAAA,oBAAoBC,eAAAA,OAAO;GAAE;GAAM;EAAQ,CAAC,GAAG,SAAS;EACnE,uBAAoB;EACpB,aAAU;EACV,kBAAkB,YAAY,kBAAkB,OAAO;EAEtD;CACS,CAAA;AAEhB,CAAC"}
1
+ {"version":3,"file":"toggle.cjs","names":["forwardRef","BaseToggle","withRecipeClassName","toggle"],"sources":["../../../src/components/toggle/toggle.tsx"],"sourcesContent":["\"use client\";\n\nimport { Toggle as BaseToggle } from \"@base-ui/react/toggle\";\nimport { forwardRef } from \"react\";\nimport type { ReactNode } from \"react\";\nimport type { Toggle as BaseToggleType } from \"@base-ui/react/toggle\";\n\nimport { toggle } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\n\nexport type ToggleVariant = \"solid\" | \"outline\" | \"ghost\";\nexport type ToggleSize = \"sm\" | \"md\" | \"lg\";\n\nexport interface ToggleProps\n extends Omit<BaseToggleType.Props<string>, \"children\" | \"className\" | \"onPressedChange\"> {\n children?: ReactNode;\n className?: string;\n onPressedChange?: (pressed: boolean) => void;\n size?: ToggleSize;\n variant?: ToggleVariant;\n}\n\nexport const Toggle = forwardRef<HTMLButtonElement, ToggleProps>(function Toggle(\n { children, className, onPressedChange, size = \"md\", variant = \"outline\", ...props },\n ref,\n) {\n return (\n <BaseToggle\n {...props}\n ref={ref}\n className={withRecipeClassName(toggle({ size, variant }), className)}\n data-jaci-component=\"toggle\"\n data-slot=\"toggle\"\n onPressedChange={(pressed) => onPressedChange?.(pressed)}\n >\n {children}\n </BaseToggle>\n );\n});\n"],"mappings":";;;;;;;AAsBA,MAAa,UAAA,GAASA,MAAAA,WAAAA,CAA2C,SAAS,OACxE,EAAE,UAAU,WAAW,iBAAiB,OAAO,MAAM,UAAU,WAAW,GAAG,SAC7E,KACA;CACA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,QAAD;EACE,GAAI;EACC;EACL,WAAWC,gBAAAA,oBAAoBC,eAAAA,OAAO;GAAE;GAAM;EAAQ,CAAC,GAAG,SAAS;EACnE,uBAAoB;EACpB,aAAU;EACV,kBAAkB,YAAY,kBAAkB,OAAO;EAEtD;CACS,CAAA;AAEhB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"toggle-group.cjs","names":["toggleGroup","BaseToggleGroup","cx","BaseToggle","withRecipeClassName"],"sources":["../../../src/components/toggle-group/toggle-group.tsx"],"sourcesContent":["\"use client\";\n\nimport { Toggle as BaseToggle } from \"@base-ui/react/toggle\";\nimport { ToggleGroup as BaseToggleGroup } from \"@base-ui/react/toggle-group\";\nimport { forwardRef } from \"react\";\nimport type { ReactNode } from \"react\";\nimport type { ToggleGroup as BaseToggleGroupType } from \"@base-ui/react/toggle-group\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { toggleGroup } from \"../../styled-system/recipes\";\nimport type { ToggleProps, ToggleSize, ToggleVariant } from \"../toggle\";\nimport { withRecipeClassName } from \"../base-ui\";\n\nexport interface ToggleGroupRootProps\n extends Omit<BaseToggleGroupType.Props<string>, \"children\" | \"className\" | \"onValueChange\"> {\n children?: ReactNode;\n className?: string;\n onValueChange?: (value: string[]) => void;\n size?: ToggleSize;\n variant?: ToggleVariant;\n}\n\nexport const ToggleGroupRoot = forwardRef<HTMLDivElement, ToggleGroupRootProps>(\n function ToggleGroupRoot(\n {\n children,\n className,\n onValueChange,\n orientation = \"horizontal\",\n size = \"md\",\n variant = \"outline\",\n ...props\n },\n ref,\n ) {\n const styles = toggleGroup({ size, variant });\n\n return (\n <BaseToggleGroup\n {...props}\n ref={ref}\n className={cx(styles.root, className)}\n data-jaci-component=\"toggle-group\"\n data-orientation={orientation}\n data-slot=\"toggle-group\"\n onValueChange={(value) => onValueChange?.(value)}\n orientation={orientation}\n >\n {children}\n </BaseToggleGroup>\n );\n },\n);\n\nexport interface ToggleGroupItemProps extends Omit<ToggleProps, \"className\"> {\n className?: string;\n value: string;\n}\n\nexport const ToggleGroupItem = forwardRef<HTMLButtonElement, ToggleGroupItemProps>(\n function ToggleGroupItem(\n { children, className, onPressedChange, size = \"md\", value, variant = \"outline\", ...props },\n ref,\n ) {\n const styles = toggleGroup({ size, variant });\n\n return (\n <BaseToggle\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.item, className)}\n data-jaci-component=\"toggle-group\"\n data-slot=\"toggle-group-item\"\n onPressedChange={(pressed) => onPressedChange?.(pressed)}\n value={value}\n >\n {children}\n </BaseToggle>\n );\n },\n);\n\nexport const ToggleGroup = {\n Root: ToggleGroupRoot,\n Item: ToggleGroupItem,\n};\n"],"mappings":";;;;;;;;;AAsBA,MAAa,mBAAA,GAAA,MAAA,WAAA,CACX,SAAS,gBACP,EACE,UACA,WACA,eACA,cAAc,cACd,OAAO,MACP,UAAU,WACV,GAAG,SAEL,KACA;CACA,MAAM,SAASA,qBAAAA,YAAY;EAAE;EAAM;CAAQ,CAAC;CAE5C,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,4BAAAA,aAAD;EACE,GAAI;EACC;EACL,WAAWC,WAAAA,GAAG,OAAO,MAAM,SAAS;EACpC,uBAAoB;EACpB,oBAAkB;EAClB,aAAU;EACV,gBAAgB,UAAU,gBAAgB,KAAK;EAClC;EAEZ;CACc,CAAA;AAErB,CACF;AAOA,MAAa,mBAAA,GAAA,MAAA,WAAA,CACX,SAAS,gBACP,EAAE,UAAU,WAAW,iBAAiB,OAAO,MAAM,OAAO,UAAU,WAAW,GAAG,SACpF,KACA;CACA,MAAM,SAASF,qBAAAA,YAAY;EAAE;EAAM;CAAQ,CAAC;CAE5C,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACG,sBAAAA,QAAD;EACE,GAAI;EACC;EACL,WAAWC,gBAAAA,oBAAoB,OAAO,MAAM,SAAS;EACrD,uBAAoB;EACpB,aAAU;EACV,kBAAkB,YAAY,kBAAkB,OAAO;EAChD;EAEN;CACS,CAAA;AAEhB,CACF;AAEA,MAAa,cAAc;CACzB,MAAM;CACN,MAAM;AACR"}
1
+ {"version":3,"file":"toggle-group.cjs","names":["forwardRef","toggleGroup","BaseToggleGroup","cx","BaseToggle","withRecipeClassName"],"sources":["../../../src/components/toggle-group/toggle-group.tsx"],"sourcesContent":["\"use client\";\n\nimport { Toggle as BaseToggle } from \"@base-ui/react/toggle\";\nimport { ToggleGroup as BaseToggleGroup } from \"@base-ui/react/toggle-group\";\nimport { forwardRef } from \"react\";\nimport type { ReactNode } from \"react\";\nimport type { ToggleGroup as BaseToggleGroupType } from \"@base-ui/react/toggle-group\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { toggleGroup } from \"../../styled-system/recipes\";\nimport type { ToggleProps, ToggleSize, ToggleVariant } from \"../toggle\";\nimport { withRecipeClassName } from \"../base-ui\";\n\nexport interface ToggleGroupRootProps\n extends Omit<BaseToggleGroupType.Props<string>, \"children\" | \"className\" | \"onValueChange\"> {\n children?: ReactNode;\n className?: string;\n onValueChange?: (value: string[]) => void;\n size?: ToggleSize;\n variant?: ToggleVariant;\n}\n\nexport const ToggleGroupRoot = forwardRef<HTMLDivElement, ToggleGroupRootProps>(\n function ToggleGroupRoot(\n {\n children,\n className,\n onValueChange,\n orientation = \"horizontal\",\n size = \"md\",\n variant = \"outline\",\n ...props\n },\n ref,\n ) {\n const styles = toggleGroup({ size, variant });\n\n return (\n <BaseToggleGroup\n {...props}\n ref={ref}\n className={cx(styles.root, className)}\n data-jaci-component=\"toggle-group\"\n data-orientation={orientation}\n data-slot=\"toggle-group\"\n onValueChange={(value) => onValueChange?.(value)}\n orientation={orientation}\n >\n {children}\n </BaseToggleGroup>\n );\n },\n);\n\nexport interface ToggleGroupItemProps extends Omit<ToggleProps, \"className\"> {\n className?: string;\n value: string;\n}\n\nexport const ToggleGroupItem = forwardRef<HTMLButtonElement, ToggleGroupItemProps>(\n function ToggleGroupItem(\n { children, className, onPressedChange, size = \"md\", value, variant = \"outline\", ...props },\n ref,\n ) {\n const styles = toggleGroup({ size, variant });\n\n return (\n <BaseToggle\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.item, className)}\n data-jaci-component=\"toggle-group\"\n data-slot=\"toggle-group-item\"\n onPressedChange={(pressed) => onPressedChange?.(pressed)}\n value={value}\n >\n {children}\n </BaseToggle>\n );\n },\n);\n\nexport const ToggleGroup = {\n Root: ToggleGroupRoot,\n Item: ToggleGroupItem,\n};\n"],"mappings":";;;;;;;;;AAsBA,MAAa,mBAAA,GAAkBA,MAAAA,WAAAA,CAC7B,SAAS,gBACP,EACE,UACA,WACA,eACA,cAAc,cACd,OAAO,MACP,UAAU,WACV,GAAG,SAEL,KACA;CACA,MAAM,SAASC,qBAAAA,YAAY;EAAE;EAAM;CAAQ,CAAC;CAE5C,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,4BAAAA,aAAD;EACE,GAAI;EACC;EACL,WAAWC,WAAAA,GAAG,OAAO,MAAM,SAAS;EACpC,uBAAoB;EACpB,oBAAkB;EAClB,aAAU;EACV,gBAAgB,UAAU,gBAAgB,KAAK;EAClC;EAEZ;CACc,CAAA;AAErB,CACF;AAOA,MAAa,mBAAA,GAAkBH,MAAAA,WAAAA,CAC7B,SAAS,gBACP,EAAE,UAAU,WAAW,iBAAiB,OAAO,MAAM,OAAO,UAAU,WAAW,GAAG,SACpF,KACA;CACA,MAAM,SAASC,qBAAAA,YAAY;EAAE;EAAM;CAAQ,CAAC;CAE5C,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACG,sBAAAA,QAAD;EACE,GAAI;EACC;EACL,WAAWC,gBAAAA,oBAAoB,OAAO,MAAM,SAAS;EACrD,uBAAoB;EACpB,aAAU;EACV,kBAAkB,YAAY,kBAAkB,OAAO;EAChD;EAEN;CACS,CAAA;AAEhB,CACF;AAEA,MAAa,cAAc;CACzB,MAAM;CACN,MAAM;AACR"}
@@ -1 +1 @@
1
- {"version":3,"file":"toolbar.cjs","names":["toolbar","BaseToolbar","withRecipeClassName"],"sources":["../../../src/components/toolbar/toolbar.tsx"],"sourcesContent":["\"use client\";\n\nimport { Toolbar as BaseToolbar } from \"@base-ui/react/toolbar\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\n\nimport { toolbar } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\nimport type { ToggleSize, ToggleVariant } from \"../toggle\";\n\nexport type ToolbarOrientation = \"horizontal\" | \"vertical\";\n\nexport interface ToolbarRootProps extends ComponentPropsWithoutRef<typeof BaseToolbar.Root> {\n orientation?: ToolbarOrientation;\n}\n\nexport const ToolbarRoot = forwardRef<HTMLDivElement, ToolbarRootProps>(function ToolbarRoot(\n { className, orientation = \"horizontal\", ...props },\n ref,\n) {\n const styles = toolbar();\n\n return (\n <BaseToolbar.Root\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.root, className)}\n data-jaci-component=\"toolbar\"\n data-orientation={orientation}\n data-slot=\"toolbar\"\n orientation={orientation}\n />\n );\n});\n\nexport type ToolbarGroupProps = ComponentPropsWithoutRef<typeof BaseToolbar.Group>;\n\nexport const ToolbarGroup = forwardRef<HTMLDivElement, ToolbarGroupProps>(function ToolbarGroup(\n { className, ...props },\n ref,\n) {\n return (\n <BaseToolbar.Group\n {...props}\n ref={ref}\n className={withRecipeClassName(toolbar().group, className)}\n data-jaci-component=\"toolbar\"\n data-slot=\"toolbar-group\"\n />\n );\n});\n\nexport interface ToolbarButtonProps extends ComponentPropsWithoutRef<typeof BaseToolbar.Button> {\n size?: ToggleSize;\n variant?: ToggleVariant;\n}\n\nexport const ToolbarButton = forwardRef<HTMLButtonElement, ToolbarButtonProps>(\n function ToolbarButton({ className, size = \"md\", variant = \"ghost\", ...props }, ref) {\n return (\n <BaseToolbar.Button\n {...props}\n ref={ref}\n className={withRecipeClassName(toolbar({ size, variant }).button, className)}\n data-jaci-component=\"toolbar\"\n data-slot=\"toolbar-button\"\n />\n );\n },\n);\n\nexport type ToolbarLinkProps = ComponentPropsWithoutRef<typeof BaseToolbar.Link>;\n\nexport const ToolbarLink = forwardRef<HTMLAnchorElement, ToolbarLinkProps>(function ToolbarLink(\n { className, ...props },\n ref,\n) {\n return (\n <BaseToolbar.Link\n {...props}\n ref={ref}\n className={withRecipeClassName(toolbar().link, className)}\n data-jaci-component=\"toolbar\"\n data-slot=\"toolbar-link\"\n />\n );\n});\n\nexport type ToolbarInputProps = ComponentPropsWithoutRef<typeof BaseToolbar.Input>;\n\nexport const ToolbarInput = forwardRef<HTMLInputElement, ToolbarInputProps>(function ToolbarInput(\n { className, ...props },\n ref,\n) {\n return (\n <BaseToolbar.Input\n {...props}\n ref={ref}\n className={withRecipeClassName(toolbar().input, className)}\n data-jaci-component=\"toolbar\"\n data-slot=\"toolbar-input\"\n />\n );\n});\n\nexport type ToolbarSeparatorProps = ComponentPropsWithoutRef<typeof BaseToolbar.Separator>;\n\nexport const ToolbarSeparator = forwardRef<HTMLDivElement, ToolbarSeparatorProps>(\n function ToolbarSeparator({ className, ...props }, ref) {\n return (\n <BaseToolbar.Separator\n {...props}\n ref={ref}\n className={withRecipeClassName(toolbar().separator, className)}\n data-jaci-component=\"toolbar\"\n data-slot=\"toolbar-separator\"\n />\n );\n },\n);\n\nexport const Toolbar = {\n Root: ToolbarRoot,\n Group: ToolbarGroup,\n Button: ToolbarButton,\n Link: ToolbarLink,\n Input: ToolbarInput,\n Separator: ToolbarSeparator,\n};\n"],"mappings":";;;;;;;AAgBA,MAAa,eAAA,GAAA,MAAA,WAAA,CAA2D,SAAS,YAC/E,EAAE,WAAW,cAAc,cAAc,GAAG,SAC5C,KACA;CACA,MAAM,SAASA,gBAAAA,QAAQ;CAEvB,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,uBAAAA,QAAY,MAAb;EACE,GAAI;EAC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C,OAAO,SAAS;EACzD,uBAAoB;EACpB,aAAU;CACX,CAAA;AAEL,CAAC;AAID,MAAa,oBAAA,GAAA,MAAA,WAAA,CACX,SAAS,iBAAiB,EAAE,WAAW,GAAG,SAAS,KAAK;CACtD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,uBAAAA,QAAY,WAAb;EACE,GAAI;EACC;EACL,WAAWC,gBAAAA,oBAAoBF,gBAAAA,QAAQ,CAAC,CAAC,WAAW,SAAS;EAC7D,uBAAoB;EACpB,aAAU;CACX,CAAA;AAEL,CACF;AAEA,MAAa,UAAU;CACrB,MAAM;CACN,OAAO;CACP,QAAQ;CACR,MAAM;CACN,OAAO;CACP,WAAW;AACb"}
1
+ {"version":3,"file":"toolbar.cjs","names":["forwardRef","toolbar","BaseToolbar","withRecipeClassName"],"sources":["../../../src/components/toolbar/toolbar.tsx"],"sourcesContent":["\"use client\";\n\nimport { Toolbar as BaseToolbar } from \"@base-ui/react/toolbar\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\n\nimport { toolbar } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\nimport type { ToggleSize, ToggleVariant } from \"../toggle\";\n\nexport type ToolbarOrientation = \"horizontal\" | \"vertical\";\n\nexport interface ToolbarRootProps extends ComponentPropsWithoutRef<typeof BaseToolbar.Root> {\n orientation?: ToolbarOrientation;\n}\n\nexport const ToolbarRoot = forwardRef<HTMLDivElement, ToolbarRootProps>(function ToolbarRoot(\n { className, orientation = \"horizontal\", ...props },\n ref,\n) {\n const styles = toolbar();\n\n return (\n <BaseToolbar.Root\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.root, className)}\n data-jaci-component=\"toolbar\"\n data-orientation={orientation}\n data-slot=\"toolbar\"\n orientation={orientation}\n />\n );\n});\n\nexport type ToolbarGroupProps = ComponentPropsWithoutRef<typeof BaseToolbar.Group>;\n\nexport const ToolbarGroup = forwardRef<HTMLDivElement, ToolbarGroupProps>(function ToolbarGroup(\n { className, ...props },\n ref,\n) {\n return (\n <BaseToolbar.Group\n {...props}\n ref={ref}\n className={withRecipeClassName(toolbar().group, className)}\n data-jaci-component=\"toolbar\"\n data-slot=\"toolbar-group\"\n />\n );\n});\n\nexport interface ToolbarButtonProps extends ComponentPropsWithoutRef<typeof BaseToolbar.Button> {\n size?: ToggleSize;\n variant?: ToggleVariant;\n}\n\nexport const ToolbarButton = forwardRef<HTMLButtonElement, ToolbarButtonProps>(\n function ToolbarButton({ className, size = \"md\", variant = \"ghost\", ...props }, ref) {\n return (\n <BaseToolbar.Button\n {...props}\n ref={ref}\n className={withRecipeClassName(toolbar({ size, variant }).button, className)}\n data-jaci-component=\"toolbar\"\n data-slot=\"toolbar-button\"\n />\n );\n },\n);\n\nexport type ToolbarLinkProps = ComponentPropsWithoutRef<typeof BaseToolbar.Link>;\n\nexport const ToolbarLink = forwardRef<HTMLAnchorElement, ToolbarLinkProps>(function ToolbarLink(\n { className, ...props },\n ref,\n) {\n return (\n <BaseToolbar.Link\n {...props}\n ref={ref}\n className={withRecipeClassName(toolbar().link, className)}\n data-jaci-component=\"toolbar\"\n data-slot=\"toolbar-link\"\n />\n );\n});\n\nexport type ToolbarInputProps = ComponentPropsWithoutRef<typeof BaseToolbar.Input>;\n\nexport const ToolbarInput = forwardRef<HTMLInputElement, ToolbarInputProps>(function ToolbarInput(\n { className, ...props },\n ref,\n) {\n return (\n <BaseToolbar.Input\n {...props}\n ref={ref}\n className={withRecipeClassName(toolbar().input, className)}\n data-jaci-component=\"toolbar\"\n data-slot=\"toolbar-input\"\n />\n );\n});\n\nexport type ToolbarSeparatorProps = ComponentPropsWithoutRef<typeof BaseToolbar.Separator>;\n\nexport const ToolbarSeparator = forwardRef<HTMLDivElement, ToolbarSeparatorProps>(\n function ToolbarSeparator({ className, ...props }, ref) {\n return (\n <BaseToolbar.Separator\n {...props}\n ref={ref}\n className={withRecipeClassName(toolbar().separator, className)}\n data-jaci-component=\"toolbar\"\n data-slot=\"toolbar-separator\"\n />\n );\n },\n);\n\nexport const Toolbar = {\n Root: ToolbarRoot,\n Group: ToolbarGroup,\n Button: ToolbarButton,\n Link: ToolbarLink,\n Input: ToolbarInput,\n Separator: ToolbarSeparator,\n};\n"],"mappings":";;;;;;;AAgBA,MAAa,eAAA,GAAcA,MAAAA,WAAAA,CAA6C,SAAS,YAC/E,EAAE,WAAW,cAAc,cAAc,GAAG,SAC5C,KACA;CACA,MAAM,SAASC,gBAAAA,QAAQ;CAEvB,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,uBAAAA,QAAY,MAAb;EACE,GAAI;EACC;EACL,WAAWC,gBAAAA,oBAAoB,OAAO,MAAM,SAAS;EACrD,uBAAoB;EACpB,oBAAkB;EAClB,aAAU;EACG;CACd,CAAA;AAEL,CAAC;AAID,MAAa,gBAAA,GAAeH,MAAAA,WAAAA,CAA8C,SAAS,aACjF,EAAE,WAAW,GAAG,SAChB,KACA;CACA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACE,uBAAAA,QAAY,OAAb;EACE,GAAI;EACC;EACL,WAAWC,gBAAAA,oBAAoBF,gBAAAA,QAAQ,CAAC,CAAC,OAAO,SAAS;EACzD,uBAAoB;EACpB,aAAU;CACX,CAAA;AAEL,CAAC;AAOD,MAAa,iBAAA,GAAgBD,MAAAA,WAAAA,CAC3B,SAAS,cAAc,EAAE,WAAW,OAAO,MAAM,UAAU,SAAS,GAAG,SAAS,KAAK;CACnF,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACE,uBAAAA,QAAY,QAAb;EACE,GAAI;EACC;EACL,WAAWC,gBAAAA,oBAAoBF,gBAAAA,QAAQ;GAAE;GAAM;EAAQ,CAAC,CAAC,CAAC,QAAQ,SAAS;EAC3E,uBAAoB;EACpB,aAAU;CACX,CAAA;AAEL,CACF;AAIA,MAAa,eAAA,GAAcD,MAAAA,WAAAA,CAAgD,SAAS,YAClF,EAAE,WAAW,GAAG,SAChB,KACA;CACA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACE,uBAAAA,QAAY,MAAb;EACE,GAAI;EACC;EACL,WAAWC,gBAAAA,oBAAoBF,gBAAAA,QAAQ,CAAC,CAAC,MAAM,SAAS;EACxD,uBAAoB;EACpB,aAAU;CACX,CAAA;AAEL,CAAC;AAID,MAAa,gBAAA,GAAeD,MAAAA,WAAAA,CAAgD,SAAS,aACnF,EAAE,WAAW,GAAG,SAChB,KACA;CACA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACE,uBAAAA,QAAY,OAAb;EACE,GAAI;EACC;EACL,WAAWC,gBAAAA,oBAAoBF,gBAAAA,QAAQ,CAAC,CAAC,OAAO,SAAS;EACzD,uBAAoB;EACpB,aAAU;CACX,CAAA;AAEL,CAAC;AAID,MAAa,oBAAA,GAAmBD,MAAAA,WAAAA,CAC9B,SAAS,iBAAiB,EAAE,WAAW,GAAG,SAAS,KAAK;CACtD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACE,uBAAAA,QAAY,WAAb;EACE,GAAI;EACC;EACL,WAAWC,gBAAAA,oBAAoBF,gBAAAA,QAAQ,CAAC,CAAC,WAAW,SAAS;EAC7D,uBAAoB;EACpB,aAAU;CACX,CAAA;AAEL,CACF;AAEA,MAAa,UAAU;CACrB,MAAM;CACN,OAAO;CACP,QAAQ;CACR,MAAM;CACN,OAAO;CACP,WAAW;AACb"}
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.cjs","names":["BaseTooltip","withRecipeClassName","tooltip","useThemePortalProps"],"sources":["../../../src/components/tooltip/tooltip.tsx"],"sourcesContent":["\"use client\";\n\nimport { Tooltip as BaseTooltip } from \"@base-ui/react/tooltip\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\nimport type { TooltipRoot as BaseTooltipRoot } from \"@base-ui/react/tooltip\";\n\nimport { tooltip } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\nimport { useThemePortalProps } from \"../../theme/theme-scope\";\n\n/** Preserves Base UI's controlled `open` API and uncontrolled `defaultOpen` API. */\nexport type TooltipRootProps<Payload = unknown> = BaseTooltipRoot.Props<Payload>;\n\nexport function TooltipRoot<Payload = unknown>(props: TooltipRootProps<Payload>) {\n return <BaseTooltip.Root {...props} />;\n}\n\nexport type TooltipTriggerProps = ComponentPropsWithoutRef<typeof BaseTooltip.Trigger>;\n\nexport const TooltipTrigger = forwardRef<HTMLButtonElement, TooltipTriggerProps>(\n function TooltipTrigger({ className, ...props }, ref) {\n return (\n <BaseTooltip.Trigger\n {...props}\n ref={ref}\n className={withRecipeClassName(tooltip().trigger, className)}\n data-jaci-component=\"tooltip\"\n data-slot=\"tooltip-trigger\"\n />\n );\n },\n);\n\n/** Preserves Base UI's optional portal container and mount controls. */\nexport function TooltipPortal(props: ComponentPropsWithoutRef<typeof BaseTooltip.Portal>) {\n return <BaseTooltip.Portal {...useThemePortalProps(props)} />;\n}\n\nexport type TooltipPositionerProps = ComponentPropsWithoutRef<typeof BaseTooltip.Positioner>;\n\nexport const TooltipPositioner = forwardRef<HTMLDivElement, TooltipPositionerProps>(\n function TooltipPositioner({ className, ...props }, ref) {\n return (\n <BaseTooltip.Positioner\n {...props}\n ref={ref}\n className={withRecipeClassName(tooltip().positioner, className)}\n data-slot=\"tooltip-positioner\"\n />\n );\n },\n);\n\nexport type TooltipPopupProps = ComponentPropsWithoutRef<typeof BaseTooltip.Popup>;\n\nexport const TooltipPopup = forwardRef<HTMLDivElement, TooltipPopupProps>(function TooltipPopup(\n { className, ...props },\n ref,\n) {\n return (\n <BaseTooltip.Popup\n {...props}\n ref={ref}\n className={withRecipeClassName(tooltip().popup, className)}\n data-jaci-component=\"tooltip\"\n data-slot=\"tooltip-popup\"\n />\n );\n});\n\nexport type TooltipArrowProps = ComponentPropsWithoutRef<typeof BaseTooltip.Arrow>;\n\nexport const TooltipArrow = forwardRef<HTMLDivElement, TooltipArrowProps>(function TooltipArrow(\n { className, ...props },\n ref,\n) {\n return (\n <BaseTooltip.Arrow\n {...props}\n ref={ref}\n className={withRecipeClassName(tooltip().arrow, className)}\n data-slot=\"tooltip-arrow\"\n />\n );\n});\n\nexport const Tooltip = {\n Root: TooltipRoot,\n Trigger: TooltipTrigger,\n Portal: TooltipPortal,\n Positioner: TooltipPositioner,\n Popup: TooltipPopup,\n Arrow: TooltipArrow,\n createHandle: BaseTooltip.createHandle,\n};\n"],"mappings":";;;;;;;;AAcA,SAAgB,YAA+B,OAAkC;CAC/E,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACA,uBAAAA,QAAY,MAAb,EAAkB,GAAI,MAAQ,CAAA;AACvC;AAIA,MAAa,kBAAA,GAAA,MAAA,WAAA,CACX,SAAS,eAAe,EAAE,WAAW,GAAG,SAAS,KAAK;CACpD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACA,uBAAAA,QAAY,SAAb;EACE,GAAI;EACC;EACL,WAAWC,gBAAAA,oBAAoBC,gBAAAA,QAAQ,CAAC,CAAC,SAAS,SAAS;EAC3D,uBAAoB;EACpB,aAAU;CACX,CAAA;AAEL,CACF;;AAGA,SAAgB,cAAc,OAA4D;CACxF,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACF,uBAAAA,QAAY,QAAb,EAAoB,GAAIG,oBAAAA,oBAAoB,KAAK,EAAI,CAAA;AAC9D;AAIA,MAAa,qBAAA,GAAA,MAAA,WAAA,CACX,SAAS,kBAAkB,EAAE,WAAW,GAAG,SAAS,KAAK;CACvD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACH,uBAAAA,QAAY,YAAb;EACE,GAAI;EACC;EACL,WAAWC,gBAAAA,oBAAoBC,gBAAAA,QAAQ,CAAC,CAAC,YAAY,SAAS;EAC9D,aAAU;CACX,CAAA;AAEL,CACF;AAIA,MAAa,gBAAA,GAAA,MAAA,WAAA,CAA6D,SAAS,aACjF,EAAE,WAAW,GAAG,SAChB,KACA;CACA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACF,uBAAAA,QAAY,OAAb;EACE,GAAI;EACC;EACL,WAAWC,gBAAAA,oBAAoBC,gBAAAA,QAAQ,CAAC,CAAC,OAAO,SAAS;EACzD,uBAAoB;EACpB,aAAU;CACX,CAAA;AAEL,CAAC;AAID,MAAa,gBAAA,GAAA,MAAA,WAAA,CAA6D,SAAS,aACjF,EAAE,WAAW,GAAG,SAChB,KACA;CACA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACF,uBAAAA,QAAY,OAAb;EACE,GAAI;EACC;EACL,WAAWC,gBAAAA,oBAAoBC,gBAAAA,QAAQ,CAAC,CAAC,OAAO,SAAS;EACzD,aAAU;CACX,CAAA;AAEL,CAAC;AAED,MAAa,UAAU;CACrB,MAAM;CACN,SAAS;CACT,QAAQ;CACR,YAAY;CACZ,OAAO;CACP,OAAO;CACP,cAAcF,uBAAAA,QAAY;AAC5B"}
1
+ {"version":3,"file":"tooltip.cjs","names":["BaseTooltip","forwardRef","withRecipeClassName","tooltip","useThemePortalProps"],"sources":["../../../src/components/tooltip/tooltip.tsx"],"sourcesContent":["\"use client\";\n\nimport { Tooltip as BaseTooltip } from \"@base-ui/react/tooltip\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\nimport type { TooltipRoot as BaseTooltipRoot } from \"@base-ui/react/tooltip\";\n\nimport { tooltip } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\nimport { useThemePortalProps } from \"../../theme/theme-scope\";\n\n/** Preserves Base UI's controlled `open` API and uncontrolled `defaultOpen` API. */\nexport type TooltipRootProps<Payload = unknown> = BaseTooltipRoot.Props<Payload>;\n\nexport function TooltipRoot<Payload = unknown>(props: TooltipRootProps<Payload>) {\n return <BaseTooltip.Root {...props} />;\n}\n\nexport type TooltipTriggerProps = ComponentPropsWithoutRef<typeof BaseTooltip.Trigger>;\n\nexport const TooltipTrigger = forwardRef<HTMLButtonElement, TooltipTriggerProps>(\n function TooltipTrigger({ className, ...props }, ref) {\n return (\n <BaseTooltip.Trigger\n {...props}\n ref={ref}\n className={withRecipeClassName(tooltip().trigger, className)}\n data-jaci-component=\"tooltip\"\n data-slot=\"tooltip-trigger\"\n />\n );\n },\n);\n\n/** Preserves Base UI's optional portal container and mount controls. */\nexport function TooltipPortal(props: ComponentPropsWithoutRef<typeof BaseTooltip.Portal>) {\n return <BaseTooltip.Portal {...useThemePortalProps(props)} />;\n}\n\nexport type TooltipPositionerProps = ComponentPropsWithoutRef<typeof BaseTooltip.Positioner>;\n\nexport const TooltipPositioner = forwardRef<HTMLDivElement, TooltipPositionerProps>(\n function TooltipPositioner({ className, ...props }, ref) {\n return (\n <BaseTooltip.Positioner\n {...props}\n ref={ref}\n className={withRecipeClassName(tooltip().positioner, className)}\n data-slot=\"tooltip-positioner\"\n />\n );\n },\n);\n\nexport type TooltipPopupProps = ComponentPropsWithoutRef<typeof BaseTooltip.Popup>;\n\nexport const TooltipPopup = forwardRef<HTMLDivElement, TooltipPopupProps>(function TooltipPopup(\n { className, ...props },\n ref,\n) {\n return (\n <BaseTooltip.Popup\n {...props}\n ref={ref}\n className={withRecipeClassName(tooltip().popup, className)}\n data-jaci-component=\"tooltip\"\n data-slot=\"tooltip-popup\"\n />\n );\n});\n\nexport type TooltipArrowProps = ComponentPropsWithoutRef<typeof BaseTooltip.Arrow>;\n\nexport const TooltipArrow = forwardRef<HTMLDivElement, TooltipArrowProps>(function TooltipArrow(\n { className, ...props },\n ref,\n) {\n return (\n <BaseTooltip.Arrow\n {...props}\n ref={ref}\n className={withRecipeClassName(tooltip().arrow, className)}\n data-slot=\"tooltip-arrow\"\n />\n );\n});\n\nexport const Tooltip = {\n Root: TooltipRoot,\n Trigger: TooltipTrigger,\n Portal: TooltipPortal,\n Positioner: TooltipPositioner,\n Popup: TooltipPopup,\n Arrow: TooltipArrow,\n createHandle: BaseTooltip.createHandle,\n};\n"],"mappings":";;;;;;;;AAcA,SAAgB,YAA+B,OAAkC;CAC/E,OAAO,iBAAA,GAAA,kBAAA,IAAA,CA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AWE,gBAAAA,oBAAoBC,gBAAAA,QAAQ,CAAC,CAAC,OAAO,SAAS;EACzD,aAAU;CACX,CAAA;AAEL,CAAC;AAED,MAAa,UAAU;CACrB,MAAM;CACN,SAAS;CACT,QAAQ;CACR,YAAY;CACZ,OAAO;CACP,OAAO;CACP,cAAcH,uBAAAA,QAAY;AAC5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"tree-view.cjs","names":["treeView","cx","Children"],"sources":["../../../src/components/tree-view/tree-view.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { Children, isValidElement } from \"react\";\nimport type { ComponentPropsWithoutRef, KeyboardEvent, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { treeView } from \"../../styled-system/recipes\";\n\nexport type TreeViewSelectionMode = \"none\" | \"single\" | \"multiple\";\nexport type TreeViewSelection = string | readonly string[] | null;\n\ninterface TreeNodeRecord {\n id: string;\n parentId: string | undefined;\n disabled: boolean;\n hasChildren: boolean;\n loading: boolean;\n selectable: boolean;\n order: number;\n element: HTMLDivElement | null;\n}\n\ninterface TreeViewContextValue {\n disabled: boolean;\n loopFocus: boolean;\n selectionMode: TreeViewSelectionMode;\n expanded: ReadonlySet<string>;\n selected: ReadonlySet<string>;\n nodes: readonly TreeNodeRecord[];\n registerNode: (node: TreeNodeRecord) => () => void;\n setNodeElement: (id: string, element: HTMLDivElement | null) => void;\n isVisible: (id: string) => boolean;\n hasChildren: (id: string) => boolean;\n getDepth: (id: string) => number;\n getSiblings: (id: string) => readonly TreeNodeRecord[];\n toggleExpanded: (id: string) => void;\n selectNode: (id: string) => void;\n focusNode: (id: string) => void;\n handleKeyDown: (id: string, event: KeyboardEvent<HTMLDivElement>) => void;\n activeId: string | null;\n setActiveId: (id: string) => void;\n}\n\nconst TreeViewContext = createContext<TreeViewContextValue | null>(null);\nconst TreeParentContext = createContext<string | undefined>(undefined);\nconst TreeItemContext = createContext<string | null>(null);\n\nfunction useTreeViewContext() {\n const context = useContext(TreeViewContext);\n if (!context) throw new Error(\"TreeView parts must be rendered inside TreeView.Root.\");\n return context;\n}\n\nfunction asSet(value: string | readonly string[] | null | undefined, mode: TreeViewSelectionMode) {\n if (mode === \"multiple\") return new Set(Array.isArray(value) ? value : value ? [value] : []);\n return new Set(typeof value === \"string\" ? [value] : []);\n}\n\nexport interface TreeViewRootProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> {\n expanded?: readonly string[];\n defaultExpanded?: readonly string[];\n onExpandedChange?: (expanded: string[]) => void;\n selected?: TreeViewSelection;\n defaultSelected?: TreeViewSelection;\n onSelectedChange?: (selected: TreeViewSelection) => void;\n selectionMode?: TreeViewSelectionMode;\n loopFocus?: boolean;\n disabled?: boolean;\n children?: ReactNode;\n}\n\nexport const TreeViewRoot = forwardRef<HTMLDivElement, TreeViewRootProps>(function TreeViewRoot(\n {\n children,\n className,\n defaultExpanded = [],\n defaultSelected = null,\n disabled = false,\n expanded: controlledExpanded,\n loopFocus = true,\n onExpandedChange,\n onSelectedChange,\n selected: controlledSelected,\n selectionMode = \"single\",\n ...props\n },\n ref,\n) {\n const [uncontrolledExpanded, setUncontrolledExpanded] = useState(() => new Set(defaultExpanded));\n const [uncontrolledSelected, setUncontrolledSelected] = useState(() =>\n asSet(defaultSelected, selectionMode),\n );\n const [activeId, setActiveId] = useState<string | null>(null);\n const [, setVersion] = useState(0);\n const nodesRef = useRef(new Map<string, TreeNodeRecord>());\n const orderRef = useRef(0);\n const styles = treeView();\n const expanded = useMemo(\n () => new Set(controlledExpanded ?? uncontrolledExpanded),\n [controlledExpanded, uncontrolledExpanded],\n );\n const selected = useMemo(\n () =>\n controlledSelected === undefined\n ? uncontrolledSelected\n : asSet(controlledSelected, selectionMode),\n [controlledSelected, selectionMode, uncontrolledSelected],\n );\n const nodes = Array.from(nodesRef.current.values()).sort((a, b) => a.order - b.order);\n\n const registerNode = useCallback((node: TreeNodeRecord) => {\n const registeredNode = { ...node, order: orderRef.current++ };\n nodesRef.current.set(node.id, registeredNode);\n setVersion((current) => current + 1);\n return () => {\n if (nodesRef.current.get(node.id) === registeredNode) nodesRef.current.delete(node.id);\n setVersion((current) => current + 1);\n };\n }, []);\n\n const setNodeElement = useCallback((id: string, element: HTMLDivElement | null) => {\n const node = nodesRef.current.get(id);\n if (node) node.element = element;\n }, []);\n\n const hasChildren = useCallback(\n (id: string) =>\n nodes.some((node) => node.parentId === id) ||\n Boolean(nodes.find((node) => node.id === id)?.hasChildren),\n [nodes],\n );\n const isVisible = useCallback(\n (id: string) => {\n let current = nodes.find((node) => node.id === id);\n while (current?.parentId) {\n if (!expanded.has(current.parentId)) return false;\n current = nodes.find((node) => node.id === current?.parentId);\n }\n return true;\n },\n [expanded, nodes],\n );\n const getDepth = useCallback(\n (id: string) => {\n let depth = 1;\n let current = nodes.find((node) => node.id === id);\n while (current?.parentId) {\n depth += 1;\n current = nodes.find((node) => node.id === current?.parentId);\n }\n return depth;\n },\n [nodes],\n );\n const getSiblings = useCallback(\n (id: string) => {\n const node = nodes.find((candidate) => candidate.id === id);\n return nodes.filter((candidate) => candidate.parentId === node?.parentId);\n },\n [nodes],\n );\n\n const toggleExpanded = useCallback(\n (id: string) => {\n if (disabled || !hasChildren(id)) return;\n const next = new Set(expanded);\n if (next.has(id)) next.delete(id);\n else next.add(id);\n if (controlledExpanded === undefined) setUncontrolledExpanded(next);\n onExpandedChange?.(Array.from(next));\n },\n [controlledExpanded, disabled, expanded, hasChildren, onExpandedChange],\n );\n\n const selectNode = useCallback(\n (id: string) => {\n const node = nodes.find((candidate) => candidate.id === id);\n if (disabled || !node || node.disabled || !node.selectable || selectionMode === \"none\")\n return;\n const next = new Set(selected);\n if (selectionMode === \"single\") {\n next.clear();\n next.add(id);\n } else if (next.has(id)) next.delete(id);\n else next.add(id);\n if (controlledSelected === undefined) setUncontrolledSelected(next);\n onSelectedChange?.(\n selectionMode === \"multiple\" ? Array.from(next) : (next.values().next().value ?? null),\n );\n },\n [controlledSelected, disabled, nodes, onSelectedChange, selected, selectionMode],\n );\n\n const visibleNodes = nodes.filter((node) => isVisible(node.id));\n const focusNode = useCallback(\n (id: string) => {\n const node = nodes.find((candidate) => candidate.id === id);\n if (!node || node.disabled || !isVisible(id)) return;\n setActiveId(id);\n node.element?.focus();\n },\n [isVisible, nodes],\n );\n\n const handleKeyDown = useCallback(\n (id: string, event: KeyboardEvent<HTMLDivElement>) => {\n if (disabled) return;\n const index = visibleNodes.findIndex((node) => node.id === id);\n const node = nodes.find((candidate) => candidate.id === id);\n if (!node) return;\n if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n event.preventDefault();\n const direction = event.key === \"ArrowDown\" ? 1 : -1;\n let nextIndex = index + direction;\n if (loopFocus) nextIndex = (nextIndex + visibleNodes.length) % visibleNodes.length;\n const nextNode = visibleNodes[nextIndex];\n if (nextIndex >= 0 && nextIndex < visibleNodes.length && nextNode) focusNode(nextNode.id);\n } else if (event.key === \"Home\" || event.key === \"End\") {\n event.preventDefault();\n focusNode((event.key === \"Home\" ? visibleNodes[0] : visibleNodes.at(-1))?.id ?? id);\n } else if (event.key === \"ArrowRight\") {\n event.preventDefault();\n if (hasChildren(id) && !expanded.has(id)) toggleExpanded(id);\n else if (hasChildren(id))\n focusNode(nodes.find((candidate) => candidate.parentId === id)?.id ?? id);\n } else if (event.key === \"ArrowLeft\") {\n event.preventDefault();\n if (hasChildren(id) && expanded.has(id)) toggleExpanded(id);\n else if (node.parentId) focusNode(node.parentId);\n } else if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n selectNode(id);\n }\n },\n [\n disabled,\n expanded,\n focusNode,\n hasChildren,\n loopFocus,\n nodes,\n selectNode,\n toggleExpanded,\n visibleNodes,\n ],\n );\n\n const context = useMemo<TreeViewContextValue>(\n () => ({\n disabled,\n loopFocus,\n selectionMode,\n expanded,\n selected,\n nodes,\n registerNode,\n setNodeElement,\n isVisible,\n hasChildren,\n getDepth,\n getSiblings,\n toggleExpanded,\n selectNode,\n focusNode,\n handleKeyDown,\n activeId,\n setActiveId,\n }),\n [\n activeId,\n disabled,\n expanded,\n focusNode,\n getDepth,\n getSiblings,\n handleKeyDown,\n hasChildren,\n isVisible,\n loopFocus,\n nodes,\n registerNode,\n selectNode,\n selected,\n selectionMode,\n setNodeElement,\n toggleExpanded,\n ],\n );\n\n return (\n <TreeViewContext.Provider value={context}>\n <div\n {...props}\n ref={ref}\n aria-multiselectable={selectionMode === \"multiple\" || undefined}\n className={cx(styles.root, className)}\n data-disabled={disabled || undefined}\n data-jaci-component=\"tree-view\"\n data-slot=\"tree-view\"\n role=\"tree\"\n >\n {children}\n </div>\n </TreeViewContext.Provider>\n );\n});\n\nexport interface TreeViewItemProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"id\"> {\n id: string;\n disabled?: boolean;\n hasChildren?: boolean;\n loading?: boolean;\n selectable?: boolean;\n}\n\nexport const TreeViewItem = forwardRef<HTMLDivElement, TreeViewItemProps>(function TreeViewItem(\n {\n children,\n className,\n disabled = false,\n hasChildren: hasChildrenProp = false,\n loading = false,\n onClick,\n onFocus,\n onKeyDown,\n style,\n selectable = true,\n id,\n ...props\n },\n ref,\n) {\n const context = useTreeViewContext();\n const parentId = useContext(TreeParentContext);\n const styles = treeView();\n useEffect(\n () =>\n context.registerNode({\n id,\n parentId,\n disabled,\n hasChildren: hasChildrenProp,\n loading,\n selectable,\n order: 0,\n element: null,\n }),\n [context.registerNode, disabled, hasChildrenProp, id, loading, parentId, selectable],\n );\n const siblings = context.getSiblings(id);\n const registeredNode = context.nodes.find((candidate) => candidate.id === id);\n const selected = context.selected.has(id);\n const visible = context.isVisible(id);\n const siblingIndex = siblings.findIndex((candidate) => candidate.id === id);\n const tabIndex =\n context.activeId === id || (context.activeId === null && context.nodes[0]?.id === id) ? 0 : -1;\n const childNodes = Children.toArray(children);\n const groupNodes = childNodes.filter(\n (child) => isValidElement(child) && child.type === TreeViewGroup,\n );\n const rowNodes = childNodes.filter(\n (child) => !(isValidElement(child) && child.type === TreeViewGroup),\n );\n\n return (\n <TreeParentContext.Provider value={id}>\n <TreeItemContext.Provider value={id}>\n <div\n {...props}\n ref={(element) => {\n context.setNodeElement(id, element);\n if (typeof ref === \"function\") ref(element);\n else if (ref) ref.current = element;\n }}\n aria-disabled={disabled || undefined}\n aria-expanded={context.hasChildren(id) ? context.expanded.has(id) : undefined}\n aria-busy={loading || undefined}\n aria-level={registeredNode ? context.getDepth(id) : parentId ? 2 : 1}\n aria-posinset={siblingIndex >= 0 ? siblingIndex + 1 : 1}\n aria-setsize={siblings.length || 1}\n aria-selected={context.selectionMode === \"none\" ? undefined : selected}\n className={styles.itemWrapper}\n data-disabled={disabled || undefined}\n data-expanded={context.expanded.has(id) || undefined}\n data-jaci-component=\"tree-view\"\n data-selected={selected || undefined}\n data-loading={loading || undefined}\n data-slot=\"tree-view-item\"\n onClick={(event) => {\n event.stopPropagation();\n onClick?.(event);\n if (!event.defaultPrevented) context.selectNode(id);\n }}\n onFocus={(event) => {\n context.setActiveId(id);\n onFocus?.(event);\n }}\n onKeyDown={(event) => {\n event.stopPropagation();\n context.handleKeyDown(id, event);\n onKeyDown?.(event);\n }}\n role=\"treeitem\"\n tabIndex={visible ? tabIndex : -1}\n >\n <div\n className={cx(styles.item, className)}\n data-disabled={disabled || undefined}\n data-expanded={context.expanded.has(id) || undefined}\n data-selected={selected || undefined}\n data-slot=\"tree-view-item-row\"\n style={style}\n >\n {rowNodes}\n </div>\n {groupNodes}\n </div>\n </TreeItemContext.Provider>\n </TreeParentContext.Provider>\n );\n});\n\nexport type TreeViewGroupProps = ComponentPropsWithoutRef<\"div\">;\nexport const TreeViewGroup = forwardRef<HTMLDivElement, TreeViewGroupProps>(function TreeViewGroup(\n { children, className, style, ...props },\n ref,\n) {\n const context = useTreeViewContext();\n const parentId = useContext(TreeParentContext);\n const styles = treeView();\n const visible = parentId ? context.expanded.has(parentId) : true;\n return (\n // biome-ignore lint/a11y/useSemanticElements: WAI-ARIA tree groups require role=\"group\".\n <div\n {...props}\n ref={ref}\n aria-hidden={!visible || undefined}\n className={cx(styles.group, className)}\n data-jaci-component=\"tree-view\"\n data-expanded={visible || undefined}\n data-slot=\"tree-view-group\"\n hidden={!visible}\n role=\"group\"\n style={{ ...style, display: visible ? style?.display : \"none\" }}\n >\n {children}\n </div>\n );\n});\n\nexport type TreeViewToggleProps = ComponentPropsWithoutRef<\"button\">;\nexport const TreeViewToggle = forwardRef<HTMLButtonElement, TreeViewToggleProps>(\n function TreeViewToggle({ children, className, onClick, ...props }, ref) {\n const context = useTreeViewContext();\n const itemId = useContext(TreeItemContext);\n const id = itemId;\n const item = id ? context.nodes.find((candidate) => candidate.id === id) : undefined;\n const disabled = context.disabled || Boolean(item?.disabled);\n return (\n <button\n {...props}\n ref={ref}\n aria-expanded={id ? context.expanded.has(id) : undefined}\n aria-disabled={disabled || undefined}\n className={cx(treeView().toggle, className)}\n data-slot=\"tree-view-toggle\"\n disabled={disabled || props.disabled}\n onClick={(event) => {\n event.stopPropagation();\n onClick?.(event);\n if (!event.defaultPrevented && id) context.toggleExpanded(id);\n }}\n tabIndex={-1}\n type=\"button\"\n >\n {children ?? (id && context.expanded.has(id) ? \"▾\" : \"▸\")}\n </button>\n );\n },\n);\n\nexport type TreeViewLabelProps = ComponentPropsWithoutRef<\"span\">;\nexport const TreeViewLabel = forwardRef<HTMLSpanElement, TreeViewLabelProps>(function TreeViewLabel(\n { className, ...props },\n ref,\n) {\n return (\n <span\n {...props}\n ref={ref}\n className={cx(treeView().label, className)}\n data-slot=\"tree-view-label\"\n />\n );\n});\n\nexport interface TreeViewStateProps extends ComponentPropsWithoutRef<\"div\"> {\n children?: ReactNode;\n}\n\nexport const TreeViewLoading = forwardRef<HTMLDivElement, TreeViewStateProps>(\n function TreeViewLoading({ children = \"Loading…\", className, ...props }, ref) {\n return (\n <div\n {...props}\n ref={ref}\n aria-disabled=\"true\"\n aria-live=\"polite\"\n aria-level={1}\n className={cx(treeView().loading, className)}\n data-slot=\"tree-view-loading\"\n role=\"treeitem\"\n tabIndex={-1}\n >\n {children}\n </div>\n );\n },\n);\n\nexport const TreeViewEmpty = forwardRef<HTMLDivElement, TreeViewStateProps>(function TreeViewEmpty(\n { children = \"No items found.\", className, ...props },\n ref,\n) {\n return (\n <div\n {...props}\n ref={ref}\n aria-disabled=\"true\"\n aria-level={1}\n className={cx(treeView().empty, className)}\n data-slot=\"tree-view-empty\"\n role=\"treeitem\"\n tabIndex={-1}\n >\n {children}\n </div>\n );\n});\n\nexport const TreeViewError = forwardRef<HTMLDivElement, TreeViewStateProps>(function TreeViewError(\n { children = \"Something went wrong.\", className, ...props },\n ref,\n) {\n return (\n <div\n {...props}\n ref={ref}\n aria-disabled=\"true\"\n aria-live=\"assertive\"\n aria-level={1}\n className={cx(treeView().error, className)}\n data-slot=\"tree-view-error\"\n role=\"treeitem\"\n tabIndex={-1}\n >\n {children}\n </div>\n );\n});\n\nexport const TreeView = {\n Root: TreeViewRoot,\n Item: TreeViewItem,\n Group: TreeViewGroup,\n Toggle: TreeViewToggle,\n Label: TreeViewLabel,\n Loading: TreeViewLoading,\n Empty: TreeViewEmpty,\n Error: TreeViewError,\n};\n"],"mappings":";;;;;;AAqDA,MAAM,mBAAA,GAAA,MAAA,cAAA,CAA6D,IAAI;AACvE,MAAM,qBAAA,GAAA,MAAA,cAAA,CAAsD,KAAA,CAAS;AACrE,MAAM,mBAAA,GAAA,MAAA,cAAA,CAA+C,IAAI;AAEzD,SAAS,qBAAqB;CAC5B,MAAM,WAAA,GAAA,MAAA,WAAA,CAAqB,eAAe;CAC1C,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,uDAAuD;CACrF,OAAO;AACT;AAEA,SAAS,MAAM,OAAsD,MAA6B;CAChG,IAAI,SAAS,YAAY,OAAO,IAAI,IAAI,MAAM,QAAQ,KAAK,IAAI,QAAQ,QAAQ,CAAC,KAAK,IAAI,CAAC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9C,KACA;CACA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EACE,GAAI;EACC;EACL,iBAAc;EACd,cAAY;EACZ,WAAWC,WAAAA,GAAGD,kBAAAA,SAAS,CAAC,CAAC,OAAO,SAAS;EACzC,aAAU;EACV,MAAK;EACL,UAAU;EAET;CACE,CAAA;AAET,CAAC;AAED,MAAa,iBAAA,GAAA,MAAA,WAAA,CAA+D,SAAS,cACnF,EAAE,WAAW,yBAAyB,WAAW,GAAG,SACpD,KACA;CACA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EACE,GAAI;EACC;EACL,iBAAc;EACd,aAAU;EACV,cAAY;EACZ,WAAWC,WAAAA,GAAGD,kBAAAA,SAAS,CAAC,CAAC,OAAO,SAAS;EACzC,aAAU;EACV,MAAK;EACL,UAAU;EAET;CACE,CAAA;AAET,CAAC;AAED,MAAa,WAAW;CACtB,MAAM;CACN,MAAM;CACN,OAAO;CACP,QAAQ;CACR,OAAO;CACP,SAAS;CACT,OAAO;CACP,OAAO;AACT"}
1
+ {"version":3,"file":"tree-view.cjs","names":["createContext","useContext","forwardRef","useState","useRef","treeView","useMemo","useCallback","cx","Children","isValidElement"],"sources":["../../../src/components/tree-view/tree-view.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { Children, isValidElement } from \"react\";\nimport type { ComponentPropsWithoutRef, KeyboardEvent, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { treeView } from \"../../styled-system/recipes\";\n\nexport type TreeViewSelectionMode = \"none\" | \"single\" | \"multiple\";\nexport type TreeViewSelection = string | readonly string[] | null;\n\ninterface TreeNodeRecord {\n id: string;\n parentId: string | undefined;\n disabled: boolean;\n hasChildren: boolean;\n loading: boolean;\n selectable: boolean;\n order: number;\n element: HTMLDivElement | null;\n}\n\ninterface TreeViewContextValue {\n disabled: boolean;\n loopFocus: boolean;\n selectionMode: TreeViewSelectionMode;\n expanded: ReadonlySet<string>;\n selected: ReadonlySet<string>;\n nodes: readonly TreeNodeRecord[];\n registerNode: (node: TreeNodeRecord) => () => void;\n setNodeElement: (id: string, element: HTMLDivElement | null) => void;\n isVisible: (id: string) => boolean;\n hasChildren: (id: string) => boolean;\n getDepth: (id: string) => number;\n getSiblings: (id: string) => readonly TreeNodeRecord[];\n toggleExpanded: (id: string) => void;\n selectNode: (id: string) => void;\n focusNode: (id: string) => void;\n handleKeyDown: (id: string, event: KeyboardEvent<HTMLDivElement>) => void;\n activeId: string | null;\n setActiveId: (id: string) => void;\n}\n\nconst TreeViewContext = createContext<TreeViewContextValue | null>(null);\nconst TreeParentContext = createContext<string | undefined>(undefined);\nconst TreeItemContext = createContext<string | null>(null);\n\nfunction useTreeViewContext() {\n const context = useContext(TreeViewContext);\n if (!context) throw new Error(\"TreeView parts must be rendered inside TreeView.Root.\");\n return context;\n}\n\nfunction asSet(value: string | readonly string[] | null | undefined, mode: TreeViewSelectionMode) {\n if (mode === \"multiple\") return new Set(Array.isArray(value) ? value : value ? [value] : []);\n return new Set(typeof value === \"string\" ? [value] : []);\n}\n\nexport interface TreeViewRootProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> {\n expanded?: readonly string[];\n defaultExpanded?: readonly string[];\n onExpandedChange?: (expanded: string[]) => void;\n selected?: TreeViewSelection;\n defaultSelected?: TreeViewSelection;\n onSelectedChange?: (selected: TreeViewSelection) => void;\n selectionMode?: TreeViewSelectionMode;\n loopFocus?: boolean;\n disabled?: boolean;\n children?: ReactNode;\n}\n\nexport const TreeViewRoot = forwardRef<HTMLDivElement, TreeViewRootProps>(function TreeViewRoot(\n {\n children,\n className,\n defaultExpanded = [],\n defaultSelected = null,\n disabled = false,\n expanded: controlledExpanded,\n loopFocus = true,\n onExpandedChange,\n onSelectedChange,\n selected: controlledSelected,\n selectionMode = \"single\",\n ...props\n },\n ref,\n) {\n const [uncontrolledExpanded, setUncontrolledExpanded] = useState(() => new Set(defaultExpanded));\n const [uncontrolledSelected, setUncontrolledSelected] = useState(() =>\n asSet(defaultSelected, selectionMode),\n );\n const [activeId, setActiveId] = useState<string | null>(null);\n const [, setVersion] = useState(0);\n const nodesRef = useRef(new Map<string, TreeNodeRecord>());\n const orderRef = useRef(0);\n const styles = treeView();\n const expanded = useMemo(\n () => new Set(controlledExpanded ?? uncontrolledExpanded),\n [controlledExpanded, uncontrolledExpanded],\n );\n const selected = useMemo(\n () =>\n controlledSelected === undefined\n ? uncontrolledSelected\n : asSet(controlledSelected, selectionMode),\n [controlledSelected, selectionMode, uncontrolledSelected],\n );\n const nodes = Array.from(nodesRef.current.values()).sort((a, b) => a.order - b.order);\n\n const registerNode = useCallback((node: TreeNodeRecord) => {\n const registeredNode = { ...node, order: orderRef.current++ };\n nodesRef.current.set(node.id, registeredNode);\n setVersion((current) => current + 1);\n return () => {\n if (nodesRef.current.get(node.id) === registeredNode) nodesRef.current.delete(node.id);\n setVersion((current) => current + 1);\n };\n }, []);\n\n const setNodeElement = useCallback((id: string, element: HTMLDivElement | null) => {\n const node = nodesRef.current.get(id);\n if (node) node.element = element;\n }, []);\n\n const hasChildren = useCallback(\n (id: string) =>\n nodes.some((node) => node.parentId === id) ||\n Boolean(nodes.find((node) => node.id === id)?.hasChildren),\n [nodes],\n );\n const isVisible = useCallback(\n (id: string) => {\n let current = nodes.find((node) => node.id === id);\n while (current?.parentId) {\n if (!expanded.has(current.parentId)) return false;\n current = nodes.find((node) => node.id === current?.parentId);\n }\n return true;\n },\n [expanded, nodes],\n );\n const getDepth = useCallback(\n (id: string) => {\n let depth = 1;\n let current = nodes.find((node) => node.id === id);\n while (current?.parentId) {\n depth += 1;\n current = nodes.find((node) => node.id === current?.parentId);\n }\n return depth;\n },\n [nodes],\n );\n const getSiblings = useCallback(\n (id: string) => {\n const node = nodes.find((candidate) => candidate.id === id);\n return nodes.filter((candidate) => candidate.parentId === node?.parentId);\n },\n [nodes],\n );\n\n const toggleExpanded = useCallback(\n (id: string) => {\n if (disabled || !hasChildren(id)) return;\n const next = new Set(expanded);\n if (next.has(id)) next.delete(id);\n else next.add(id);\n if (controlledExpanded === undefined) setUncontrolledExpanded(next);\n onExpandedChange?.(Array.from(next));\n },\n [controlledExpanded, disabled, expanded, hasChildren, onExpandedChange],\n );\n\n const selectNode = useCallback(\n (id: string) => {\n const node = nodes.find((candidate) => candidate.id === id);\n if (disabled || !node || node.disabled || !node.selectable || selectionMode === \"none\")\n return;\n const next = new Set(selected);\n if (selectionMode === \"single\") {\n next.clear();\n next.add(id);\n } else if (next.has(id)) next.delete(id);\n else next.add(id);\n if (controlledSelected === undefined) setUncontrolledSelected(next);\n onSelectedChange?.(\n selectionMode === \"multiple\" ? Array.from(next) : (next.values().next().value ?? null),\n );\n },\n [controlledSelected, disabled, nodes, onSelectedChange, selected, selectionMode],\n );\n\n const visibleNodes = nodes.filter((node) => isVisible(node.id));\n const focusNode = useCallback(\n (id: string) => {\n const node = nodes.find((candidate) => candidate.id === id);\n if (!node || node.disabled || !isVisible(id)) return;\n setActiveId(id);\n node.element?.focus();\n },\n [isVisible, nodes],\n );\n\n const handleKeyDown = useCallback(\n (id: string, event: KeyboardEvent<HTMLDivElement>) => {\n if (disabled) return;\n const index = visibleNodes.findIndex((node) => node.id === id);\n const node = nodes.find((candidate) => candidate.id === id);\n if (!node) return;\n if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n event.preventDefault();\n const direction = event.key === \"ArrowDown\" ? 1 : -1;\n let nextIndex = index + direction;\n if (loopFocus) nextIndex = (nextIndex + visibleNodes.length) % visibleNodes.length;\n const nextNode = visibleNodes[nextIndex];\n if (nextIndex >= 0 && nextIndex < visibleNodes.length && nextNode) focusNode(nextNode.id);\n } else if (event.key === \"Home\" || event.key === \"End\") {\n event.preventDefault();\n focusNode((event.key === \"Home\" ? visibleNodes[0] : visibleNodes.at(-1))?.id ?? id);\n } else if (event.key === \"ArrowRight\") {\n event.preventDefault();\n if (hasChildren(id) && !expanded.has(id)) toggleExpanded(id);\n else if (hasChildren(id))\n focusNode(nodes.find((candidate) => candidate.parentId === id)?.id ?? id);\n } else if (event.key === \"ArrowLeft\") {\n event.preventDefault();\n if (hasChildren(id) && expanded.has(id)) toggleExpanded(id);\n else if (node.parentId) focusNode(node.parentId);\n } else if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n selectNode(id);\n }\n },\n [\n disabled,\n expanded,\n focusNode,\n hasChildren,\n loopFocus,\n nodes,\n selectNode,\n toggleExpanded,\n visibleNodes,\n ],\n );\n\n const context = useMemo<TreeViewContextValue>(\n () => ({\n disabled,\n loopFocus,\n selectionMode,\n expanded,\n selected,\n nodes,\n registerNode,\n setNodeElement,\n isVisible,\n hasChildren,\n getDepth,\n getSiblings,\n toggleExpanded,\n selectNode,\n focusNode,\n handleKeyDown,\n activeId,\n setActiveId,\n }),\n [\n activeId,\n disabled,\n expanded,\n focusNode,\n getDepth,\n getSiblings,\n handleKeyDown,\n hasChildren,\n isVisible,\n loopFocus,\n nodes,\n registerNode,\n selectNode,\n selected,\n selectionMode,\n setNodeElement,\n toggleExpanded,\n ],\n );\n\n return (\n <TreeViewContext.Provider value={context}>\n <div\n {...props}\n ref={ref}\n aria-multiselectable={selectionMode === \"multiple\" || undefined}\n className={cx(styles.root, className)}\n data-disabled={disabled || undefined}\n data-jaci-component=\"tree-view\"\n data-slot=\"tree-view\"\n role=\"tree\"\n >\n {children}\n </div>\n </TreeViewContext.Provider>\n );\n});\n\nexport interface TreeViewItemProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"id\"> {\n id: string;\n disabled?: boolean;\n hasChildren?: boolean;\n loading?: boolean;\n selectable?: boolean;\n}\n\nexport const TreeViewItem = forwardRef<HTMLDivElement, TreeViewItemProps>(function TreeViewItem(\n {\n children,\n className,\n disabled = false,\n hasChildren: hasChildrenProp = false,\n loading = false,\n onClick,\n onFocus,\n onKeyDown,\n style,\n selectable = true,\n id,\n ...props\n },\n ref,\n) {\n const context = useTreeViewContext();\n const parentId = useContext(TreeParentContext);\n const styles = treeView();\n useEffect(\n () =>\n context.registerNode({\n id,\n parentId,\n disabled,\n hasChildren: hasChildrenProp,\n loading,\n selectable,\n order: 0,\n element: null,\n }),\n [context.registerNode, disabled, hasChildrenProp, id, loading, parentId, selectable],\n );\n const siblings = context.getSiblings(id);\n const registeredNode = context.nodes.find((candidate) => candidate.id === id);\n const selected = context.selected.has(id);\n const visible = context.isVisible(id);\n const siblingIndex = siblings.findIndex((candidate) => candidate.id === id);\n const tabIndex =\n context.activeId === id || (context.activeId === null && context.nodes[0]?.id === id) ? 0 : -1;\n const childNodes = Children.toArray(children);\n const groupNodes = childNodes.filter(\n (child) => isValidElement(child) && child.type === TreeViewGroup,\n );\n const rowNodes = childNodes.filter(\n (child) => !(isValidElement(child) && child.type === TreeViewGroup),\n );\n\n return (\n <TreeParentContext.Provider value={id}>\n <TreeItemContext.Provider value={id}>\n <div\n {...props}\n ref={(element) => {\n context.setNodeElement(id, element);\n if (typeof ref === \"function\") ref(element);\n else if (ref) ref.current = element;\n }}\n aria-disabled={disabled || undefined}\n aria-expanded={context.hasChildren(id) ? context.expanded.has(id) : undefined}\n aria-busy={loading || undefined}\n aria-level={registeredNode ? context.getDepth(id) : parentId ? 2 : 1}\n aria-posinset={siblingIndex >= 0 ? siblingIndex + 1 : 1}\n aria-setsize={siblings.length || 1}\n aria-selected={context.selectionMode === \"none\" ? undefined : selected}\n className={styles.itemWrapper}\n data-disabled={disabled || undefined}\n data-expanded={context.expanded.has(id) || undefined}\n data-jaci-component=\"tree-view\"\n data-selected={selected || undefined}\n data-loading={loading || undefined}\n data-slot=\"tree-view-item\"\n onClick={(event) => {\n event.stopPropagation();\n onClick?.(event);\n if (!event.defaultPrevented) context.selectNode(id);\n }}\n onFocus={(event) => {\n context.setActiveId(id);\n onFocus?.(event);\n }}\n onKeyDown={(event) => {\n event.stopPropagation();\n context.handleKeyDown(id, event);\n onKeyDown?.(event);\n }}\n role=\"treeitem\"\n tabIndex={visible ? tabIndex : -1}\n >\n <div\n className={cx(styles.item, className)}\n data-disabled={disabled || undefined}\n data-expanded={context.expanded.has(id) || undefined}\n data-selected={selected || undefined}\n data-slot=\"tree-view-item-row\"\n style={style}\n >\n {rowNodes}\n </div>\n {groupNodes}\n </div>\n </TreeItemContext.Provider>\n </TreeParentContext.Provider>\n );\n});\n\nexport type TreeViewGroupProps = ComponentPropsWithoutRef<\"div\">;\nexport const TreeViewGroup = forwardRef<HTMLDivElement, TreeViewGroupProps>(function TreeViewGroup(\n { children, className, style, ...props },\n ref,\n) {\n const context = useTreeViewContext();\n const parentId = useContext(TreeParentContext);\n const styles = treeView();\n const visible = parentId ? context.expanded.has(parentId) : true;\n return (\n // biome-ignore lint/a11y/useSemanticElements: WAI-ARIA tree groups require role=\"group\".\n <div\n {...props}\n ref={ref}\n aria-hidden={!visible || undefined}\n className={cx(styles.group, className)}\n data-jaci-component=\"tree-view\"\n data-expanded={visible || undefined}\n data-slot=\"tree-view-group\"\n hidden={!visible}\n role=\"group\"\n style={{ ...style, display: visible ? style?.display : \"none\" }}\n >\n {children}\n </div>\n );\n});\n\nexport type TreeViewToggleProps = ComponentPropsWithoutRef<\"button\">;\nexport const TreeViewToggle = forwardRef<HTMLButtonElement, TreeViewToggleProps>(\n function TreeViewToggle({ children, className, onClick, ...props }, ref) {\n const context = useTreeViewContext();\n const itemId = useContext(TreeItemContext);\n const id = itemId;\n const item = id ? context.nodes.find((candidate) => candidate.id === id) : undefined;\n const disabled = context.disabled || Boolean(item?.disabled);\n return (\n <button\n {...props}\n ref={ref}\n aria-expanded={id ? context.expanded.has(id) : undefined}\n aria-disabled={disabled || undefined}\n className={cx(treeView().toggle, className)}\n data-slot=\"tree-view-toggle\"\n disabled={disabled || props.disabled}\n onClick={(event) => {\n event.stopPropagation();\n onClick?.(event);\n if (!event.defaultPrevented && id) context.toggleExpanded(id);\n }}\n tabIndex={-1}\n type=\"button\"\n >\n {children ?? (id && context.expanded.has(id) ? \"▾\" : \"▸\")}\n </button>\n );\n },\n);\n\nexport type TreeViewLabelProps = ComponentPropsWithoutRef<\"span\">;\nexport const TreeViewLabel = forwardRef<HTMLSpanElement, TreeViewLabelProps>(function TreeViewLabel(\n { className, ...props },\n ref,\n) {\n return (\n <span\n {...props}\n ref={ref}\n className={cx(treeView().label, className)}\n data-slot=\"tree-view-label\"\n />\n );\n});\n\nexport interface TreeViewStateProps extends ComponentPropsWithoutRef<\"div\"> {\n children?: ReactNode;\n}\n\nexport const TreeViewLoading = forwardRef<HTMLDivElement, TreeViewStateProps>(\n function TreeViewLoading({ children = \"Loading…\", className, ...props }, ref) {\n return (\n <div\n {...props}\n ref={ref}\n aria-disabled=\"true\"\n aria-live=\"polite\"\n aria-level={1}\n className={cx(treeView().loading, className)}\n data-slot=\"tree-view-loading\"\n role=\"treeitem\"\n tabIndex={-1}\n >\n {children}\n </div>\n );\n },\n);\n\nexport const TreeViewEmpty = forwardRef<HTMLDivElement, TreeViewStateProps>(function TreeViewEmpty(\n { children = \"No items found.\", className, ...props },\n ref,\n) {\n return (\n <div\n {...props}\n ref={ref}\n aria-disabled=\"true\"\n aria-level={1}\n className={cx(treeView().empty, className)}\n data-slot=\"tree-view-empty\"\n role=\"treeitem\"\n tabIndex={-1}\n >\n {children}\n </div>\n );\n});\n\nexport const TreeViewError = forwardRef<HTMLDivElement, TreeViewStateProps>(function TreeViewError(\n { children = \"Something went wrong.\", className, ...props },\n ref,\n) {\n return (\n <div\n {...props}\n ref={ref}\n aria-disabled=\"true\"\n aria-live=\"assertive\"\n aria-level={1}\n className={cx(treeView().error, className)}\n data-slot=\"tree-view-error\"\n role=\"treeitem\"\n tabIndex={-1}\n >\n {children}\n </div>\n );\n});\n\nexport const TreeView = {\n Root: TreeViewRoot,\n Item: TreeViewItem,\n Group: TreeViewGroup,\n Toggle: TreeViewToggle,\n Label: TreeViewLabel,\n Loading: TreeViewLoading,\n Empty: TreeViewEmpty,\n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ACN,OAAO;CACP,QAAQ;CACR,OAAO;CACP,SAAS;CACT,OAAO;CACP,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"tree-view.js","names":[],"sources":["../../../src/components/tree-view/tree-view.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { Children, isValidElement } from \"react\";\nimport type { ComponentPropsWithoutRef, KeyboardEvent, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { treeView } from \"../../styled-system/recipes\";\n\nexport type TreeViewSelectionMode = \"none\" | \"single\" | \"multiple\";\nexport type TreeViewSelection = string | readonly string[] | null;\n\ninterface TreeNodeRecord {\n id: string;\n parentId: string | undefined;\n disabled: boolean;\n hasChildren: boolean;\n loading: boolean;\n selectable: boolean;\n order: number;\n element: HTMLDivElement | null;\n}\n\ninterface TreeViewContextValue {\n disabled: boolean;\n loopFocus: boolean;\n selectionMode: TreeViewSelectionMode;\n expanded: ReadonlySet<string>;\n selected: ReadonlySet<string>;\n nodes: readonly TreeNodeRecord[];\n registerNode: (node: TreeNodeRecord) => () => void;\n setNodeElement: (id: string, element: HTMLDivElement | null) => void;\n isVisible: (id: string) => boolean;\n hasChildren: (id: string) => boolean;\n getDepth: (id: string) => number;\n getSiblings: (id: string) => readonly TreeNodeRecord[];\n toggleExpanded: (id: string) => void;\n selectNode: (id: string) => void;\n focusNode: (id: string) => void;\n handleKeyDown: (id: string, event: KeyboardEvent<HTMLDivElement>) => void;\n activeId: string | null;\n setActiveId: (id: string) => void;\n}\n\nconst TreeViewContext = createContext<TreeViewContextValue | null>(null);\nconst TreeParentContext = createContext<string | undefined>(undefined);\nconst TreeItemContext = createContext<string | null>(null);\n\nfunction useTreeViewContext() {\n const context = useContext(TreeViewContext);\n if (!context) throw new Error(\"TreeView parts must be rendered inside TreeView.Root.\");\n return context;\n}\n\nfunction asSet(value: string | readonly string[] | null | undefined, mode: TreeViewSelectionMode) {\n if (mode === \"multiple\") return new Set(Array.isArray(value) ? value : value ? [value] : []);\n return new Set(typeof value === \"string\" ? [value] : []);\n}\n\nexport interface TreeViewRootProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> {\n expanded?: readonly string[];\n defaultExpanded?: readonly string[];\n onExpandedChange?: (expanded: string[]) => void;\n selected?: TreeViewSelection;\n defaultSelected?: TreeViewSelection;\n onSelectedChange?: (selected: TreeViewSelection) => void;\n selectionMode?: TreeViewSelectionMode;\n loopFocus?: boolean;\n disabled?: boolean;\n children?: ReactNode;\n}\n\nexport const TreeViewRoot = forwardRef<HTMLDivElement, TreeViewRootProps>(function TreeViewRoot(\n {\n children,\n className,\n defaultExpanded = [],\n defaultSelected = null,\n disabled = false,\n expanded: controlledExpanded,\n loopFocus = true,\n onExpandedChange,\n onSelectedChange,\n selected: controlledSelected,\n selectionMode = \"single\",\n ...props\n },\n ref,\n) {\n const [uncontrolledExpanded, setUncontrolledExpanded] = useState(() => new Set(defaultExpanded));\n const [uncontrolledSelected, setUncontrolledSelected] = useState(() =>\n asSet(defaultSelected, selectionMode),\n );\n const [activeId, setActiveId] = useState<string | null>(null);\n const [, setVersion] = useState(0);\n const nodesRef = useRef(new Map<string, TreeNodeRecord>());\n const orderRef = useRef(0);\n const styles = treeView();\n const expanded = useMemo(\n () => new Set(controlledExpanded ?? uncontrolledExpanded),\n [controlledExpanded, uncontrolledExpanded],\n );\n const selected = useMemo(\n () =>\n controlledSelected === undefined\n ? uncontrolledSelected\n : asSet(controlledSelected, selectionMode),\n [controlledSelected, selectionMode, uncontrolledSelected],\n );\n const nodes = Array.from(nodesRef.current.values()).sort((a, b) => a.order - b.order);\n\n const registerNode = useCallback((node: TreeNodeRecord) => {\n const registeredNode = { ...node, order: orderRef.current++ };\n nodesRef.current.set(node.id, registeredNode);\n setVersion((current) => current + 1);\n return () => {\n if (nodesRef.current.get(node.id) === registeredNode) nodesRef.current.delete(node.id);\n setVersion((current) => current + 1);\n };\n }, []);\n\n const setNodeElement = useCallback((id: string, element: HTMLDivElement | null) => {\n const node = nodesRef.current.get(id);\n if (node) node.element = element;\n }, []);\n\n const hasChildren = useCallback(\n (id: string) =>\n nodes.some((node) => node.parentId === id) ||\n Boolean(nodes.find((node) => node.id === id)?.hasChildren),\n [nodes],\n );\n const isVisible = useCallback(\n (id: string) => {\n let current = nodes.find((node) => node.id === id);\n while (current?.parentId) {\n if (!expanded.has(current.parentId)) return false;\n current = nodes.find((node) => node.id === current?.parentId);\n }\n return true;\n },\n [expanded, nodes],\n );\n const getDepth = useCallback(\n (id: string) => {\n let depth = 1;\n let current = nodes.find((node) => node.id === id);\n while (current?.parentId) {\n depth += 1;\n current = nodes.find((node) => node.id === current?.parentId);\n }\n return depth;\n },\n [nodes],\n );\n const getSiblings = useCallback(\n (id: string) => {\n const node = nodes.find((candidate) => candidate.id === id);\n return nodes.filter((candidate) => candidate.parentId === node?.parentId);\n },\n [nodes],\n );\n\n const toggleExpanded = useCallback(\n (id: string) => {\n if (disabled || !hasChildren(id)) return;\n const next = new Set(expanded);\n if (next.has(id)) next.delete(id);\n else next.add(id);\n if (controlledExpanded === undefined) setUncontrolledExpanded(next);\n onExpandedChange?.(Array.from(next));\n },\n [controlledExpanded, disabled, expanded, hasChildren, onExpandedChange],\n );\n\n const selectNode = useCallback(\n (id: string) => {\n const node = nodes.find((candidate) => candidate.id === id);\n if (disabled || !node || node.disabled || !node.selectable || selectionMode === \"none\")\n return;\n const next = new Set(selected);\n if (selectionMode === \"single\") {\n next.clear();\n next.add(id);\n } else if (next.has(id)) next.delete(id);\n else next.add(id);\n if (controlledSelected === undefined) setUncontrolledSelected(next);\n onSelectedChange?.(\n selectionMode === \"multiple\" ? Array.from(next) : (next.values().next().value ?? null),\n );\n },\n [controlledSelected, disabled, nodes, onSelectedChange, selected, selectionMode],\n );\n\n const visibleNodes = nodes.filter((node) => isVisible(node.id));\n const focusNode = useCallback(\n (id: string) => {\n const node = nodes.find((candidate) => candidate.id === id);\n if (!node || node.disabled || !isVisible(id)) return;\n setActiveId(id);\n node.element?.focus();\n },\n [isVisible, nodes],\n );\n\n const handleKeyDown = useCallback(\n (id: string, event: KeyboardEvent<HTMLDivElement>) => {\n if (disabled) return;\n const index = visibleNodes.findIndex((node) => node.id === id);\n const node = nodes.find((candidate) => candidate.id === id);\n if (!node) return;\n if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n event.preventDefault();\n const direction = event.key === \"ArrowDown\" ? 1 : -1;\n let nextIndex = index + direction;\n if (loopFocus) nextIndex = (nextIndex + visibleNodes.length) % visibleNodes.length;\n const nextNode = visibleNodes[nextIndex];\n if (nextIndex >= 0 && nextIndex < visibleNodes.length && nextNode) focusNode(nextNode.id);\n } else if (event.key === \"Home\" || event.key === \"End\") {\n event.preventDefault();\n focusNode((event.key === \"Home\" ? visibleNodes[0] : visibleNodes.at(-1))?.id ?? id);\n } else if (event.key === \"ArrowRight\") {\n event.preventDefault();\n if (hasChildren(id) && !expanded.has(id)) toggleExpanded(id);\n else if (hasChildren(id))\n focusNode(nodes.find((candidate) => candidate.parentId === id)?.id ?? id);\n } else if (event.key === \"ArrowLeft\") {\n event.preventDefault();\n if (hasChildren(id) && expanded.has(id)) toggleExpanded(id);\n else if (node.parentId) focusNode(node.parentId);\n } else if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n selectNode(id);\n }\n },\n [\n disabled,\n expanded,\n focusNode,\n hasChildren,\n loopFocus,\n nodes,\n selectNode,\n toggleExpanded,\n visibleNodes,\n ],\n );\n\n const context = useMemo<TreeViewContextValue>(\n () => ({\n disabled,\n loopFocus,\n selectionMode,\n expanded,\n selected,\n nodes,\n registerNode,\n setNodeElement,\n isVisible,\n hasChildren,\n getDepth,\n getSiblings,\n toggleExpanded,\n selectNode,\n focusNode,\n handleKeyDown,\n activeId,\n setActiveId,\n }),\n [\n activeId,\n disabled,\n expanded,\n focusNode,\n getDepth,\n getSiblings,\n handleKeyDown,\n hasChildren,\n isVisible,\n loopFocus,\n nodes,\n registerNode,\n selectNode,\n selected,\n selectionMode,\n setNodeElement,\n toggleExpanded,\n ],\n );\n\n return (\n <TreeViewContext.Provider value={context}>\n <div\n {...props}\n ref={ref}\n aria-multiselectable={selectionMode === \"multiple\" || undefined}\n className={cx(styles.root, className)}\n data-disabled={disabled || undefined}\n data-jaci-component=\"tree-view\"\n data-slot=\"tree-view\"\n role=\"tree\"\n >\n {children}\n </div>\n </TreeViewContext.Provider>\n );\n});\n\nexport interface TreeViewItemProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"id\"> {\n id: string;\n disabled?: boolean;\n hasChildren?: boolean;\n loading?: boolean;\n selectable?: boolean;\n}\n\nexport const TreeViewItem = forwardRef<HTMLDivElement, TreeViewItemProps>(function TreeViewItem(\n {\n children,\n className,\n disabled = false,\n hasChildren: hasChildrenProp = false,\n loading = false,\n onClick,\n onFocus,\n onKeyDown,\n style,\n selectable = true,\n id,\n ...props\n },\n ref,\n) {\n const context = useTreeViewContext();\n const parentId = useContext(TreeParentContext);\n const styles = treeView();\n useEffect(\n () =>\n context.registerNode({\n id,\n parentId,\n disabled,\n hasChildren: hasChildrenProp,\n loading,\n selectable,\n order: 0,\n element: null,\n }),\n [context.registerNode, disabled, hasChildrenProp, id, loading, parentId, selectable],\n );\n const siblings = context.getSiblings(id);\n const registeredNode = context.nodes.find((candidate) => candidate.id === id);\n const selected = context.selected.has(id);\n const visible = context.isVisible(id);\n const siblingIndex = siblings.findIndex((candidate) => candidate.id === id);\n const tabIndex =\n context.activeId === id || (context.activeId === null && context.nodes[0]?.id === id) ? 0 : -1;\n const childNodes = Children.toArray(children);\n const groupNodes = childNodes.filter(\n (child) => isValidElement(child) && child.type === TreeViewGroup,\n );\n const rowNodes = childNodes.filter(\n (child) => !(isValidElement(child) && child.type === TreeViewGroup),\n );\n\n return (\n <TreeParentContext.Provider value={id}>\n <TreeItemContext.Provider value={id}>\n <div\n {...props}\n ref={(element) => {\n context.setNodeElement(id, element);\n if (typeof ref === \"function\") ref(element);\n else if (ref) ref.current = element;\n }}\n aria-disabled={disabled || undefined}\n aria-expanded={context.hasChildren(id) ? context.expanded.has(id) : undefined}\n aria-busy={loading || undefined}\n aria-level={registeredNode ? context.getDepth(id) : parentId ? 2 : 1}\n aria-posinset={siblingIndex >= 0 ? siblingIndex + 1 : 1}\n aria-setsize={siblings.length || 1}\n aria-selected={context.selectionMode === \"none\" ? undefined : selected}\n className={styles.itemWrapper}\n data-disabled={disabled || undefined}\n data-expanded={context.expanded.has(id) || undefined}\n data-jaci-component=\"tree-view\"\n data-selected={selected || undefined}\n data-loading={loading || undefined}\n data-slot=\"tree-view-item\"\n onClick={(event) => {\n event.stopPropagation();\n onClick?.(event);\n if (!event.defaultPrevented) context.selectNode(id);\n }}\n onFocus={(event) => {\n context.setActiveId(id);\n onFocus?.(event);\n }}\n onKeyDown={(event) => {\n event.stopPropagation();\n context.handleKeyDown(id, event);\n onKeyDown?.(event);\n }}\n role=\"treeitem\"\n tabIndex={visible ? tabIndex : -1}\n >\n <div\n className={cx(styles.item, className)}\n data-disabled={disabled || undefined}\n data-expanded={context.expanded.has(id) || undefined}\n data-selected={selected || undefined}\n data-slot=\"tree-view-item-row\"\n style={style}\n >\n {rowNodes}\n </div>\n {groupNodes}\n </div>\n </TreeItemContext.Provider>\n </TreeParentContext.Provider>\n );\n});\n\nexport type TreeViewGroupProps = ComponentPropsWithoutRef<\"div\">;\nexport const TreeViewGroup = forwardRef<HTMLDivElement, TreeViewGroupProps>(function TreeViewGroup(\n { children, className, style, ...props },\n ref,\n) {\n const context = useTreeViewContext();\n const parentId = useContext(TreeParentContext);\n const styles = treeView();\n const visible = parentId ? context.expanded.has(parentId) : true;\n return (\n // biome-ignore lint/a11y/useSemanticElements: WAI-ARIA tree groups require role=\"group\".\n <div\n {...props}\n ref={ref}\n aria-hidden={!visible || undefined}\n className={cx(styles.group, className)}\n data-jaci-component=\"tree-view\"\n data-expanded={visible || undefined}\n data-slot=\"tree-view-group\"\n hidden={!visible}\n role=\"group\"\n style={{ ...style, display: visible ? style?.display : \"none\" }}\n >\n {children}\n </div>\n );\n});\n\nexport type TreeViewToggleProps = ComponentPropsWithoutRef<\"button\">;\nexport const TreeViewToggle = forwardRef<HTMLButtonElement, TreeViewToggleProps>(\n function TreeViewToggle({ children, className, onClick, ...props }, ref) {\n const context = useTreeViewContext();\n const itemId = useContext(TreeItemContext);\n const id = itemId;\n const item = id ? context.nodes.find((candidate) => candidate.id === id) : undefined;\n const disabled = context.disabled || Boolean(item?.disabled);\n return (\n <button\n {...props}\n ref={ref}\n aria-expanded={id ? context.expanded.has(id) : undefined}\n aria-disabled={disabled || undefined}\n className={cx(treeView().toggle, className)}\n data-slot=\"tree-view-toggle\"\n disabled={disabled || props.disabled}\n onClick={(event) => {\n event.stopPropagation();\n onClick?.(event);\n if (!event.defaultPrevented && id) context.toggleExpanded(id);\n }}\n tabIndex={-1}\n type=\"button\"\n >\n {children ?? (id && context.expanded.has(id) ? \"▾\" : \"▸\")}\n </button>\n );\n },\n);\n\nexport type TreeViewLabelProps = ComponentPropsWithoutRef<\"span\">;\nexport const TreeViewLabel = forwardRef<HTMLSpanElement, TreeViewLabelProps>(function TreeViewLabel(\n { className, ...props },\n ref,\n) {\n return (\n <span\n {...props}\n ref={ref}\n className={cx(treeView().label, className)}\n data-slot=\"tree-view-label\"\n />\n );\n});\n\nexport interface TreeViewStateProps extends ComponentPropsWithoutRef<\"div\"> {\n children?: ReactNode;\n}\n\nexport const TreeViewLoading = forwardRef<HTMLDivElement, TreeViewStateProps>(\n function TreeViewLoading({ children = \"Loading…\", className, ...props }, ref) {\n return (\n <div\n {...props}\n ref={ref}\n aria-disabled=\"true\"\n aria-live=\"polite\"\n aria-level={1}\n className={cx(treeView().loading, className)}\n data-slot=\"tree-view-loading\"\n role=\"treeitem\"\n tabIndex={-1}\n >\n {children}\n </div>\n );\n },\n);\n\nexport const TreeViewEmpty = forwardRef<HTMLDivElement, TreeViewStateProps>(function TreeViewEmpty(\n { children = \"No items found.\", className, ...props },\n ref,\n) {\n return (\n <div\n {...props}\n ref={ref}\n aria-disabled=\"true\"\n aria-level={1}\n className={cx(treeView().empty, className)}\n data-slot=\"tree-view-empty\"\n role=\"treeitem\"\n tabIndex={-1}\n >\n {children}\n </div>\n );\n});\n\nexport const TreeViewError = forwardRef<HTMLDivElement, TreeViewStateProps>(function TreeViewError(\n { children = \"Something went wrong.\", className, ...props },\n ref,\n) {\n return (\n <div\n {...props}\n ref={ref}\n aria-disabled=\"true\"\n aria-live=\"assertive\"\n aria-level={1}\n className={cx(treeView().error, className)}\n data-slot=\"tree-view-error\"\n role=\"treeitem\"\n tabIndex={-1}\n >\n {children}\n </div>\n );\n});\n\nexport const TreeView = {\n Root: TreeViewRoot,\n Item: TreeViewItem,\n Group: TreeViewGroup,\n Toggle: TreeViewToggle,\n Label: TreeViewLabel,\n Loading: TreeViewLoading,\n Empty: TreeViewEmpty,\n Error: TreeViewError,\n};\n"],"mappings":";;;;;;AAqDA,MAAM,kBAAkB,cAA2C,IAAI;AACvE,MAAM,oBAAoB,cAAkC,KAAA,CAAS;AACrE,MAAM,kBAAkB,cAA6B,IAAI;AAEzD,SAAS,qBAAqB;CAC5B,MAAM,UAAU,WAAW,eAAe;CAC1C,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,uDAAuD;CACrF,OAAO;AACT;AAEA,SAAS,MAAM,OAAsD,MAA6B;CAChG,IAAI,SAAS,YAAY,OAAO,IAAI,IAAI,MAAM,QAAQ,KAAK,IAAI,QAAQ,QAAQ,CAAC,KAAK,IAAI,CAAC,CAAC;CAC3F,OAAO,IAAI,IAAI,OAAO,UAAU,WAAW,CAAC,KAAK,IAAI,CAAC,CAAC;AACzD;AAeA,MAAa,eAAe,WAA8C,SAAS,aACjF,EACE,UACA,WACA,kBAAkB,CAAC,GACnB,kBAAkB,MAClB,WAAW,OACX,UAAU,oBACV,YAAY,MACZ,kBACA,kBACA,UAAU,oBACV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,WAA+C,SAAS,cACnF,EAAE,WAAW,mBAAmB,WAAW,GAAG,SAC9C,KACA;CACA,OACE,oBAAC,OAAD;EACE,GAAI;EACC;EACL,iBAAc;EACd,cAAY;EACZ,WAAW,GAAG,SAAS,CAAC,CAAC,OAAO,SAAS;EACzC,aAAU;EACV,MAAK;EACL,UAAU;EAET;CACE,CAAA;AAET,CAAC;AAED,MAAa,gBAAgB,WAA+C,SAAS,cACnF,EAAE,WAAW,yBAAyB,WAAW,GAAG,SACpD,KACA;CACA,OACE,oBAAC,OAAD;EACE,GAAI;EACC;EACL,iBAAc;EACd,aAAU;EACV,cAAY;EACZ,WAAW,GAAG,SAAS,CAAC,CAAC,OAAO,SAAS;EACzC,aAAU;EACV,MAAK;EACL,UAAU;EAET;CACE,CAAA;AAET,CAAC;AAED,MAAa,WAAW;CACtB,MAAM;CACN,MAAM;CACN,OAAO;CACP,QAAQ;CACR,OAAO;CACP,SAAS;CACT,OAAO;CACP,OAAO;AACT"}
1
+ {"version":3,"file":"tree-view.js","names":[],"sources":["../../../src/components/tree-view/tree-view.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { Children, isValidElement } from \"react\";\nimport type { ComponentPropsWithoutRef, KeyboardEvent, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { treeView } from \"../../styled-system/recipes\";\n\nexport type TreeViewSelectionMode = \"none\" | \"single\" | \"multiple\";\nexport type TreeViewSelection = string | readonly string[] | null;\n\ninterface TreeNodeRecord {\n id: string;\n parentId: string | undefined;\n disabled: boolean;\n hasChildren: boolean;\n loading: boolean;\n selectable: boolean;\n order: number;\n element: HTMLDivElement | null;\n}\n\ninterface TreeViewContextValue {\n disabled: boolean;\n loopFocus: boolean;\n selectionMode: TreeViewSelectionMode;\n expanded: ReadonlySet<string>;\n selected: ReadonlySet<string>;\n nodes: readonly TreeNodeRecord[];\n registerNode: (node: TreeNodeRecord) => () => void;\n setNodeElement: (id: string, element: HTMLDivElement | null) => void;\n isVisible: (id: string) => boolean;\n hasChildren: (id: string) => boolean;\n getDepth: (id: string) => number;\n getSiblings: (id: string) => readonly TreeNodeRecord[];\n toggleExpanded: (id: string) => void;\n selectNode: (id: string) => void;\n focusNode: (id: string) => void;\n handleKeyDown: (id: string, event: KeyboardEvent<HTMLDivElement>) => void;\n activeId: string | null;\n setActiveId: (id: string) => void;\n}\n\nconst TreeViewContext = createContext<TreeViewContextValue | null>(null);\nconst TreeParentContext = createContext<string | undefined>(undefined);\nconst TreeItemContext = createContext<string | null>(null);\n\nfunction useTreeViewContext() {\n const context = useContext(TreeViewContext);\n if (!context) throw new Error(\"TreeView parts must be rendered inside TreeView.Root.\");\n return context;\n}\n\nfunction asSet(value: string | readonly string[] | null | undefined, mode: TreeViewSelectionMode) {\n if (mode === \"multiple\") return new Set(Array.isArray(value) ? value : value ? [value] : []);\n return new Set(typeof value === \"string\" ? [value] : []);\n}\n\nexport interface TreeViewRootProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> {\n expanded?: readonly string[];\n defaultExpanded?: readonly string[];\n onExpandedChange?: (expanded: string[]) => void;\n selected?: TreeViewSelection;\n defaultSelected?: TreeViewSelection;\n onSelectedChange?: (selected: TreeViewSelection) => void;\n selectionMode?: TreeViewSelectionMode;\n loopFocus?: boolean;\n disabled?: boolean;\n children?: ReactNode;\n}\n\nexport const TreeViewRoot = forwardRef<HTMLDivElement, TreeViewRootProps>(function TreeViewRoot(\n {\n children,\n className,\n defaultExpanded = [],\n defaultSelected = null,\n disabled = false,\n expanded: controlledExpanded,\n loopFocus = true,\n onExpandedChange,\n onSelectedChange,\n selected: controlledSelected,\n selectionMode = \"single\",\n ...props\n },\n ref,\n) {\n const [uncontrolledExpanded, setUncontrolledExpanded] = useState(() => new Set(defaultExpanded));\n const [uncontrolledSelected, setUncontrolledSelected] = useState(() =>\n asSet(defaultSelected, selectionMode),\n );\n const [activeId, setActiveId] = useState<string | null>(null);\n const [, setVersion] = useState(0);\n const nodesRef = useRef(new Map<string, TreeNodeRecord>());\n const orderRef = useRef(0);\n const styles = treeView();\n const expanded = useMemo(\n () => new Set(controlledExpanded ?? uncontrolledExpanded),\n [controlledExpanded, uncontrolledExpanded],\n );\n const selected = useMemo(\n () =>\n controlledSelected === undefined\n ? uncontrolledSelected\n : asSet(controlledSelected, selectionMode),\n [controlledSelected, selectionMode, uncontrolledSelected],\n );\n const nodes = Array.from(nodesRef.current.values()).sort((a, b) => a.order - b.order);\n\n const registerNode = useCallback((node: TreeNodeRecord) => {\n const registeredNode = { ...node, order: orderRef.current++ };\n nodesRef.current.set(node.id, registeredNode);\n setVersion((current) => current + 1);\n return () => {\n if (nodesRef.current.get(node.id) === registeredNode) nodesRef.current.delete(node.id);\n setVersion((current) => current + 1);\n };\n }, []);\n\n const setNodeElement = useCallback((id: string, element: HTMLDivElement | null) => {\n const node = nodesRef.current.get(id);\n if (node) node.element = element;\n }, []);\n\n const hasChildren = useCallback(\n (id: string) =>\n nodes.some((node) => node.parentId === id) ||\n Boolean(nodes.find((node) => node.id === id)?.hasChildren),\n [nodes],\n );\n const isVisible = useCallback(\n (id: string) => {\n let current = nodes.find((node) => node.id === id);\n while (current?.parentId) {\n if (!expanded.has(current.parentId)) return false;\n current = nodes.find((node) => node.id === current?.parentId);\n }\n return true;\n },\n [expanded, nodes],\n );\n const getDepth = useCallback(\n (id: string) => {\n let depth = 1;\n let current = nodes.find((node) => node.id === id);\n while (current?.parentId) {\n depth += 1;\n current = nodes.find((node) => node.id === current?.parentId);\n }\n return depth;\n },\n [nodes],\n );\n const getSiblings = useCallback(\n (id: string) => {\n const node = nodes.find((candidate) => candidate.id === id);\n return nodes.filter((candidate) => candidate.parentId === node?.parentId);\n },\n [nodes],\n );\n\n const toggleExpanded = useCallback(\n (id: string) => {\n if (disabled || !hasChildren(id)) return;\n const next = new Set(expanded);\n if (next.has(id)) next.delete(id);\n else next.add(id);\n if (controlledExpanded === undefined) setUncontrolledExpanded(next);\n onExpandedChange?.(Array.from(next));\n },\n [controlledExpanded, disabled, expanded, hasChildren, onExpandedChange],\n );\n\n const selectNode = useCallback(\n (id: string) => {\n const node = nodes.find((candidate) => candidate.id === id);\n if (disabled || !node || node.disabled || !node.selectable || selectionMode === \"none\")\n return;\n const next = new Set(selected);\n if (selectionMode === \"single\") {\n next.clear();\n next.add(id);\n } else if (next.has(id)) next.delete(id);\n else next.add(id);\n if (controlledSelected === undefined) setUncontrolledSelected(next);\n onSelectedChange?.(\n selectionMode === \"multiple\" ? Array.from(next) : (next.values().next().value ?? null),\n );\n },\n [controlledSelected, disabled, nodes, onSelectedChange, selected, selectionMode],\n );\n\n const visibleNodes = nodes.filter((node) => isVisible(node.id));\n const focusNode = useCallback(\n (id: string) => {\n const node = nodes.find((candidate) => candidate.id === id);\n if (!node || node.disabled || !isVisible(id)) return;\n setActiveId(id);\n node.element?.focus();\n },\n [isVisible, nodes],\n );\n\n const handleKeyDown = useCallback(\n (id: string, event: KeyboardEvent<HTMLDivElement>) => {\n if (disabled) return;\n const index = visibleNodes.findIndex((node) => node.id === id);\n const node = nodes.find((candidate) => candidate.id === id);\n if (!node) return;\n if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n event.preventDefault();\n const direction = event.key === \"ArrowDown\" ? 1 : -1;\n let nextIndex = index + direction;\n if (loopFocus) nextIndex = (nextIndex + visibleNodes.length) % visibleNodes.length;\n const nextNode = visibleNodes[nextIndex];\n if (nextIndex >= 0 && nextIndex < visibleNodes.length && nextNode) focusNode(nextNode.id);\n } else if (event.key === \"Home\" || event.key === \"End\") {\n event.preventDefault();\n focusNode((event.key === \"Home\" ? visibleNodes[0] : visibleNodes.at(-1))?.id ?? id);\n } else if (event.key === \"ArrowRight\") {\n event.preventDefault();\n if (hasChildren(id) && !expanded.has(id)) toggleExpanded(id);\n else if (hasChildren(id))\n focusNode(nodes.find((candidate) => candidate.parentId === id)?.id ?? id);\n } else if (event.key === \"ArrowLeft\") {\n event.preventDefault();\n if (hasChildren(id) && expanded.has(id)) toggleExpanded(id);\n else if (node.parentId) focusNode(node.parentId);\n } else if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n selectNode(id);\n }\n },\n [\n disabled,\n expanded,\n focusNode,\n hasChildren,\n loopFocus,\n nodes,\n selectNode,\n toggleExpanded,\n visibleNodes,\n ],\n );\n\n const context = useMemo<TreeViewContextValue>(\n () => ({\n disabled,\n loopFocus,\n selectionMode,\n expanded,\n selected,\n nodes,\n registerNode,\n setNodeElement,\n isVisible,\n hasChildren,\n getDepth,\n getSiblings,\n toggleExpanded,\n selectNode,\n focusNode,\n handleKeyDown,\n activeId,\n setActiveId,\n }),\n [\n activeId,\n disabled,\n expanded,\n focusNode,\n getDepth,\n getSiblings,\n handleKeyDown,\n hasChildren,\n isVisible,\n loopFocus,\n nodes,\n registerNode,\n selectNode,\n selected,\n selectionMode,\n setNodeElement,\n toggleExpanded,\n ],\n );\n\n return (\n <TreeViewContext.Provider value={context}>\n <div\n {...props}\n ref={ref}\n aria-multiselectable={selectionMode === \"multiple\" || undefined}\n className={cx(styles.root, className)}\n data-disabled={disabled || undefined}\n data-jaci-component=\"tree-view\"\n data-slot=\"tree-view\"\n role=\"tree\"\n >\n {children}\n </div>\n </TreeViewContext.Provider>\n );\n});\n\nexport interface TreeViewItemProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"id\"> {\n id: string;\n disabled?: boolean;\n hasChildren?: boolean;\n loading?: boolean;\n selectable?: boolean;\n}\n\nexport const TreeViewItem = forwardRef<HTMLDivElement, TreeViewItemProps>(function TreeViewItem(\n {\n children,\n className,\n disabled = false,\n hasChildren: hasChildrenProp = false,\n loading = false,\n onClick,\n onFocus,\n onKeyDown,\n style,\n selectable = true,\n id,\n ...props\n },\n ref,\n) {\n const context = useTreeViewContext();\n const parentId = useContext(TreeParentContext);\n const styles = treeView();\n useEffect(\n () =>\n context.registerNode({\n id,\n parentId,\n disabled,\n hasChildren: hasChildrenProp,\n loading,\n selectable,\n order: 0,\n element: null,\n }),\n [context.registerNode, disabled, hasChildrenProp, id, loading, parentId, selectable],\n );\n const siblings = context.getSiblings(id);\n const registeredNode = context.nodes.find((candidate) => candidate.id === id);\n const selected = context.selected.has(id);\n const visible = context.isVisible(id);\n const siblingIndex = siblings.findIndex((candidate) => candidate.id === id);\n const tabIndex =\n context.activeId === id || (context.activeId === null && context.nodes[0]?.id === id) ? 0 : -1;\n const childNodes = Children.toArray(children);\n const groupNodes = childNodes.filter(\n (child) => isValidElement(child) && child.type === TreeViewGroup,\n );\n const rowNodes = childNodes.filter(\n (child) => !(isValidElement(child) && child.type === TreeViewGroup),\n );\n\n return (\n <TreeParentContext.Provider value={id}>\n <TreeItemContext.Provider value={id}>\n <div\n {...props}\n ref={(element) => {\n context.setNodeElement(id, element);\n if (typeof ref === \"function\") ref(element);\n else if (ref) ref.current = element;\n }}\n aria-disabled={disabled || undefined}\n aria-expanded={context.hasChildren(id) ? context.expanded.has(id) : undefined}\n aria-busy={loading || undefined}\n aria-level={registeredNode ? context.getDepth(id) : parentId ? 2 : 1}\n aria-posinset={siblingIndex >= 0 ? siblingIndex + 1 : 1}\n aria-setsize={siblings.length || 1}\n aria-selected={context.selectionMode === \"none\" ? undefined : selected}\n className={styles.itemWrapper}\n data-disabled={disabled || undefined}\n data-expanded={context.expanded.has(id) || undefined}\n data-jaci-component=\"tree-view\"\n data-selected={selected || undefined}\n data-loading={loading || undefined}\n data-slot=\"tree-view-item\"\n onClick={(event) => {\n event.stopPropagation();\n onClick?.(event);\n if (!event.defaultPrevented) context.selectNode(id);\n }}\n onFocus={(event) => {\n context.setActiveId(id);\n onFocus?.(event);\n }}\n onKeyDown={(event) => {\n event.stopPropagation();\n context.handleKeyDown(id, event);\n onKeyDown?.(event);\n }}\n role=\"treeitem\"\n tabIndex={visible ? tabIndex : -1}\n >\n <div\n className={cx(styles.item, className)}\n data-disabled={disabled || undefined}\n data-expanded={context.expanded.has(id) || undefined}\n data-selected={selected || undefined}\n data-slot=\"tree-view-item-row\"\n style={style}\n >\n {rowNodes}\n </div>\n {groupNodes}\n </div>\n </TreeItemContext.Provider>\n </TreeParentContext.Provider>\n );\n});\n\nexport type TreeViewGroupProps = ComponentPropsWithoutRef<\"div\">;\nexport const TreeViewGroup = forwardRef<HTMLDivElement, TreeViewGroupProps>(function TreeViewGroup(\n { children, className, style, ...props },\n ref,\n) {\n const context = useTreeViewContext();\n const parentId = useContext(TreeParentContext);\n const styles = treeView();\n const visible = parentId ? context.expanded.has(parentId) : true;\n return (\n // biome-ignore lint/a11y/useSemanticElements: WAI-ARIA tree groups require role=\"group\".\n <div\n {...props}\n ref={ref}\n aria-hidden={!visible || undefined}\n className={cx(styles.group, className)}\n data-jaci-component=\"tree-view\"\n data-expanded={visible || undefined}\n data-slot=\"tree-view-group\"\n hidden={!visible}\n role=\"group\"\n style={{ ...style, display: visible ? style?.display : \"none\" }}\n >\n {children}\n </div>\n );\n});\n\nexport type TreeViewToggleProps = ComponentPropsWithoutRef<\"button\">;\nexport const TreeViewToggle = forwardRef<HTMLButtonElement, TreeViewToggleProps>(\n function TreeViewToggle({ children, className, onClick, ...props }, ref) {\n const context = useTreeViewContext();\n const itemId = useContext(TreeItemContext);\n const id = itemId;\n const item = id ? context.nodes.find((candidate) => candidate.id === id) : undefined;\n const disabled = context.disabled || Boolean(item?.disabled);\n return (\n <button\n {...props}\n ref={ref}\n aria-expanded={id ? context.expanded.has(id) : undefined}\n aria-disabled={disabled || undefined}\n className={cx(treeView().toggle, className)}\n data-slot=\"tree-view-toggle\"\n disabled={disabled || props.disabled}\n onClick={(event) => {\n event.stopPropagation();\n onClick?.(event);\n if (!event.defaultPrevented && id) context.toggleExpanded(id);\n }}\n tabIndex={-1}\n type=\"button\"\n >\n {children ?? (id && context.expanded.has(id) ? \"▾\" : \"▸\")}\n </button>\n );\n },\n);\n\nexport type TreeViewLabelProps = ComponentPropsWithoutRef<\"span\">;\nexport const TreeViewLabel = forwardRef<HTMLSpanElement, TreeViewLabelProps>(function TreeViewLabel(\n { className, ...props },\n ref,\n) {\n return (\n <span\n {...props}\n ref={ref}\n className={cx(treeView().label, className)}\n data-slot=\"tree-view-label\"\n />\n );\n});\n\nexport interface TreeViewStateProps extends ComponentPropsWithoutRef<\"div\"> {\n children?: ReactNode;\n}\n\nexport const TreeViewLoading = forwardRef<HTMLDivElement, TreeViewStateProps>(\n function TreeViewLoading({ children = \"Loading…\", className, ...props }, ref) {\n return (\n <div\n {...props}\n ref={ref}\n aria-disabled=\"true\"\n aria-live=\"polite\"\n aria-level={1}\n className={cx(treeView().loading, className)}\n data-slot=\"tree-view-loading\"\n role=\"treeitem\"\n tabIndex={-1}\n >\n {children}\n </div>\n );\n },\n);\n\nexport const TreeViewEmpty = forwardRef<HTMLDivElement, TreeViewStateProps>(function TreeViewEmpty(\n { children = \"No items found.\", className, ...props },\n ref,\n) {\n return (\n <div\n {...props}\n ref={ref}\n aria-disabled=\"true\"\n aria-level={1}\n className={cx(treeView().empty, className)}\n data-slot=\"tree-view-empty\"\n role=\"treeitem\"\n tabIndex={-1}\n >\n {children}\n </div>\n );\n});\n\nexport const TreeViewError = forwardRef<HTMLDivElement, TreeViewStateProps>(function TreeViewError(\n { children = \"Something went wrong.\", className, ...props },\n ref,\n) {\n return (\n <div\n {...props}\n ref={ref}\n aria-disabled=\"true\"\n aria-live=\"assertive\"\n aria-level={1}\n className={cx(treeView().error, className)}\n data-slot=\"tree-view-error\"\n role=\"treeitem\"\n tabIndex={-1}\n >\n {children}\n </div>\n );\n});\n\nexport const TreeView = {\n Root: TreeViewRoot,\n Item: TreeViewItem,\n Group: TreeViewGroup,\n Toggle: TreeViewToggle,\n Label: TreeViewLabel,\n Loading: TreeViewLoading,\n Empty: TreeViewEmpty,\n Error: TreeViewError,\n};\n"],"mappings":";;;;;;AAqDA,MAAM,kBAAkB,cAA2C,IAAI;AACvE,MAAM,oBAAoB,cAAkC,KAAA,CAAS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EJ,UAAA,aAAa,MAAM,QAAQ,SAAS,IAAI,EAAE,IAAI,MAAM;CAC/C,CAAA;AAEZ,CACF;AAGA,MAAa,gBAAgB,WAAgD,SAAS,cACpF,EAAE,WAAW,GAAG,SAChB,KACA;CACA,OACE,oBAAC,QAAD;EACE,GAAI;EACC;EACL,WAAW,GAAG,SAAS,CAAC,CAAC,OAAO,SAAS;EACzC,aAAU;CACX,CAAA;AAEL,CAAC;AAMD,MAAa,kBAAkB,WAC7B,SAAS,gBAAgB,EAAE,WAAW,YAAY,WAAW,GAAG,SAAS,KAAK;CAC5E,OACE,oBAAC,OAAD;EACE,GAAI;EACC;EACL,iBAAc;EACd,aAAU;EACV,cAAY;EACZ,WAAW,GAAG,SAAS,CAAC,CAAC,SAAS,SAAS;EAC3C,aAAU;EACV,MAAK;EACL,UAAU;EAET;CACE,CAAA;AAET,CACF;AAEA,MAAa,gBAAgB,WAA+C,SAAS,cACnF,EAAE,WAAW,mBAAmB,WAAW,GAAG,SAC9C,KACA;CACA,OACE,oBAAC,OAAD;EACE,GAAI;EACC;EACL,iBAAc;EACd,cAAY;EACZ,WAAW,GAAG,SAAS,CAAC,CAAC,OAAO,SAAS;EACzC,aAAU;EACV,MAAK;EACL,UAAU;EAET;CACE,CAAA;AAET,CAAC;AAED,MAAa,gBAAgB,WAA+C,SAAS,cACnF,EAAE,WAAW,yBAAyB,WAAW,GAAG,SACpD,KACA;CACA,OACE,oBAAC,OAAD;EACE,GAAI;EACC;EACL,iBAAc;EACd,aAAU;EACV,cAAY;EACZ,WAAW,GAAG,SAAS,CAAC,CAAC,OAAO,SAAS;EACzC,aAAU;EACV,MAAK;EACL,UAAU;EAET;CACE,CAAA;AAET,CAAC;AAED,MAAa,WAAW;CACtB,MAAM;CACN,MAAM;CACN,OAAO;CACP,QAAQ;CACR,OAAO;CACP,SAAS;CACT,OAAO;CACP,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"heading.cjs","names":["cx","heading"],"sources":["../../../src/components/typography/heading.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef, ElementType, ReactElement, Ref } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { heading } from \"../../styled-system/recipes\";\n\nexport type HeadingSize = \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\nexport type HeadingElement = \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\nexport type TypographyWeight = \"normal\" | \"medium\" | \"semibold\" | \"bold\";\nexport type TypographyWidth = \"auto\" | \"fit\" | \"full\";\nexport type TypographyLineClamp = 1 | 2 | 3 | 4;\n\nconst defaultSizeByElement: Record<HeadingElement, HeadingSize> = {\n h1: \"2xl\",\n h2: \"xl\",\n h3: \"lg\",\n h4: \"md\",\n h5: \"sm\",\n h6: \"xs\",\n};\n\nexport interface HeadingProps extends Omit<ComponentPropsWithoutRef<\"h2\">, \"color\"> {\n as?: HeadingElement;\n size?: HeadingSize;\n weight?: TypographyWeight;\n truncate?: boolean;\n lineClamp?: TypographyLineClamp;\n width?: TypographyWidth;\n}\n\nexport const Heading = forwardRef<HTMLHeadingElement, HeadingProps>(function Heading(\n { as = \"h2\", className, lineClamp, size, truncate = false, weight, width = \"auto\", ...props },\n ref,\n) {\n const Component = as as ElementType;\n const resolvedSize = size ?? defaultSizeByElement[as];\n\n return (\n <Component\n {...props}\n ref={ref as Ref<HTMLElement>}\n className={cx(\n heading({\n lineClamp: lineClamp ? (String(lineClamp) as \"1\" | \"2\" | \"3\" | \"4\") : undefined,\n size: resolvedSize,\n truncate,\n weight,\n width,\n }),\n className,\n )}\n data-jaci-component=\"heading\"\n data-slot=\"heading\"\n />\n ) as ReactElement;\n});\n"],"mappings":";;;;;AAYA,MAAM,uBAA4D;CAChE,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAWA,MAAa,WAAA,GAAA,MAAA,WAAA,CAAuD,SAAS,QAC3E,EAAE,KAAK,MAAM,WAAW,WAAW,MAAM,WAAW,OAAO,QAAQ,QAAQ,QAAQ,GAAG,SACtF,KACA;CACA,MAAM,YAAY;CAClB,MAAM,eAAe,QAAQ,qBAAqB;CAElD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,WAAD;EACE,GAAI;EACC;EACL,WAAWA,WAAAA,GACTC,gBAAAA,QAAQ;GACN,WAAW,YAAa,OAAO,SAAS,IAA8B,KAAA;GACtE,MAAM;GACN;GACA;GACA;EACF,CAAC,GACD,SACF;EACA,uBAAoB;EACpB,aAAU;CACX,CAAA;AAEL,CAAC"}
1
+ {"version":3,"file":"heading.cjs","names":["forwardRef","cx","heading"],"sources":["../../../src/components/typography/heading.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef, ElementType, ReactElement, Ref } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { heading } from \"../../styled-system/recipes\";\n\nexport type HeadingSize = \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\nexport type HeadingElement = \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\nexport type TypographyWeight = \"normal\" | \"medium\" | \"semibold\" | \"bold\";\nexport type TypographyWidth = \"auto\" | \"fit\" | \"full\";\nexport type TypographyLineClamp = 1 | 2 | 3 | 4;\n\nconst defaultSizeByElement: Record<HeadingElement, HeadingSize> = {\n h1: \"2xl\",\n h2: \"xl\",\n h3: \"lg\",\n h4: \"md\",\n h5: \"sm\",\n h6: \"xs\",\n};\n\nexport interface HeadingProps extends Omit<ComponentPropsWithoutRef<\"h2\">, \"color\"> {\n as?: HeadingElement;\n size?: HeadingSize;\n weight?: TypographyWeight;\n truncate?: boolean;\n lineClamp?: TypographyLineClamp;\n width?: TypographyWidth;\n}\n\nexport const Heading = forwardRef<HTMLHeadingElement, HeadingProps>(function Heading(\n { as = \"h2\", className, lineClamp, size, truncate = false, weight, width = \"auto\", ...props },\n ref,\n) {\n const Component = as as ElementType;\n const resolvedSize = size ?? defaultSizeByElement[as];\n\n return (\n <Component\n {...props}\n ref={ref as Ref<HTMLElement>}\n className={cx(\n heading({\n lineClamp: lineClamp ? (String(lineClamp) as \"1\" | \"2\" | \"3\" | \"4\") : undefined,\n size: resolvedSize,\n truncate,\n weight,\n width,\n }),\n className,\n )}\n data-jaci-component=\"heading\"\n data-slot=\"heading\"\n />\n ) as ReactElement;\n});\n"],"mappings":";;;;;AAYA,MAAM,uBAA4D;CAChE,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAWA,MAAa,WAAA,GAAUA,MAAAA,WAAAA,CAA6C,SAAS,QAC3E,EAAE,KAAK,MAAM,WAAW,WAAW,MAAM,WAAW,OAAO,QAAQ,QAAQ,QAAQ,GAAG,SACtF,KACA;CACA,MAAM,YAAY;CAClB,MAAM,eAAe,QAAQ,qBAAqB;CAElD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,WAAD;EACE,GAAI;EACC;EACL,WAAWC,WAAAA,GACTC,gBAAAA,QAAQ;GACN,WAAW,YAAa,OAAO,SAAS,IAA8B,KAAA;GACtE,MAAM;GACN;GACA;GACA;EACF,CAAC,GACD,SACF;EACA,uBAAoB;EACpB,aAAU;CACX,CAAA;AAEL,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"link.cjs","names":["cx","link"],"sources":["../../../src/components/typography/link.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { link } from \"../../styled-system/recipes\";\n\nexport interface LinkProps extends ComponentPropsWithoutRef<\"a\"> {\n subtle?: boolean;\n}\n\nexport const Link = forwardRef<HTMLAnchorElement, LinkProps>(function Link(\n { className, subtle = true, ...props },\n ref,\n) {\n return (\n <a\n {...props}\n ref={ref}\n className={cx(link({ subtle }), className)}\n data-jaci-component=\"link\"\n data-slot=\"link\"\n />\n );\n});\n"],"mappings":";;;;;AAUA,MAAa,QAAA,GAAA,MAAA,WAAA,CAAgD,SAAS,KACpE,EAAE,WAAW,SAAS,MAAM,GAAG,SAC/B,KACA;CACA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;EACE,GAAI;EACC;EACL,WAAWA,WAAAA,GAAGC,aAAAA,KAAK,EAAE,OAAO,CAAC,GAAG,SAAS;EACzC,uBAAoB;EACpB,aAAU;CACX,CAAA;AAEL,CAAC"}
1
+ {"version":3,"file":"link.cjs","names":["forwardRef","cx","link"],"sources":["../../../src/components/typography/link.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { link } from \"../../styled-system/recipes\";\n\nexport interface LinkProps extends ComponentPropsWithoutRef<\"a\"> {\n subtle?: boolean;\n}\n\nexport const Link = forwardRef<HTMLAnchorElement, LinkProps>(function Link(\n { className, subtle = true, ...props },\n ref,\n) {\n return (\n <a\n {...props}\n ref={ref}\n className={cx(link({ subtle }), className)}\n data-jaci-component=\"link\"\n data-slot=\"link\"\n />\n );\n});\n"],"mappings":";;;;;AAUA,MAAa,QAAA,GAAOA,MAAAA,WAAAA,CAAyC,SAAS,KACpE,EAAE,WAAW,SAAS,MAAM,GAAG,SAC/B,KACA;CACA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;EACE,GAAI;EACC;EACL,WAAWC,WAAAA,GAAGC,aAAAA,KAAK,EAAE,OAAO,CAAC,GAAG,SAAS;EACzC,uBAAoB;EACpB,aAAU;CACX,CAAA;AAEL,CAAC"}