@yamada-ui/react 2.2.1-dev-20260428160818 → 2.2.1-dev-20260428170353

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 (205) hide show
  1. package/dist/cjs/components/carousel/use-carousel.cjs.map +1 -1
  2. package/dist/cjs/components/tree/use-tree.cjs +5 -5
  3. package/dist/cjs/components/tree/use-tree.cjs.map +1 -1
  4. package/dist/esm/components/carousel/use-carousel.js.map +1 -1
  5. package/dist/esm/components/tree/use-tree.js +5 -5
  6. package/dist/esm/components/tree/use-tree.js.map +1 -1
  7. package/dist/types/components/accordion/accordion.d.ts +2 -2
  8. package/dist/types/components/accordion/accordion.style.d.ts +1 -1
  9. package/dist/types/components/accordion/use-accordion.d.ts +11 -11
  10. package/dist/types/components/action-bar/action-bar.d.ts +2 -2
  11. package/dist/types/components/airy/airy.d.ts +2 -2
  12. package/dist/types/components/alert/alert.d.ts +2 -2
  13. package/dist/types/components/alpha-slider/alpha-slider.d.ts +2 -2
  14. package/dist/types/components/aspect-ratio/aspect-ratio.d.ts +2 -2
  15. package/dist/types/components/autocomplete/autocomplete.d.ts +2 -2
  16. package/dist/types/components/autocomplete/autocomplete.style.d.ts +1 -1
  17. package/dist/types/components/autocomplete/use-autocomplete.d.ts +5 -5
  18. package/dist/types/components/avatar/avatar.d.ts +5 -5
  19. package/dist/types/components/avatar/use-avatar-group.d.ts +2 -2
  20. package/dist/types/components/badge/badge.d.ts +2 -2
  21. package/dist/types/components/bleed/bleed.d.ts +2 -2
  22. package/dist/types/components/blockquote/blockquote.d.ts +2 -2
  23. package/dist/types/components/breadcrumb/breadcrumb.d.ts +2 -2
  24. package/dist/types/components/breadcrumb/breadcrumb.style.d.ts +1 -1
  25. package/dist/types/components/breadcrumb/use-breadcrumb.d.ts +2 -2
  26. package/dist/types/components/button/button.d.ts +2 -2
  27. package/dist/types/components/button/icon-button.d.ts +2 -2
  28. package/dist/types/components/calendar/calendar.d.ts +2 -2
  29. package/dist/types/components/calendar/calendar.style.d.ts +2 -2
  30. package/dist/types/components/calendar/use-calendar.d.ts +8 -8
  31. package/dist/types/components/card/card.d.ts +2 -2
  32. package/dist/types/components/carousel/carousel.d.ts +2 -2
  33. package/dist/types/components/carousel/carousel.style.d.ts +2 -2
  34. package/dist/types/components/carousel/use-carousel.d.ts +3 -3
  35. package/dist/types/components/center/center.d.ts +2 -2
  36. package/dist/types/components/chart/area-chart.d.ts +2 -2
  37. package/dist/types/components/chart/bar-chart.d.ts +2 -2
  38. package/dist/types/components/chart/chart.d.ts +5 -5
  39. package/dist/types/components/chart/composed-chart.d.ts +2 -2
  40. package/dist/types/components/chart/line-chart.d.ts +2 -2
  41. package/dist/types/components/chart/pie-chart.d.ts +2 -2
  42. package/dist/types/components/chart/radar-chart.d.ts +2 -2
  43. package/dist/types/components/chart/use-chart.d.ts +2 -2
  44. package/dist/types/components/checkbox/checkbox.d.ts +4 -4
  45. package/dist/types/components/checkbox/use-checkbox-group.d.ts +2 -2
  46. package/dist/types/components/checkbox-card/checkbox-card.d.ts +4 -4
  47. package/dist/types/components/circle-progress/circle-progress.d.ts +2 -2
  48. package/dist/types/components/close-button/close-button.d.ts +2 -2
  49. package/dist/types/components/code/code.d.ts +2 -2
  50. package/dist/types/components/collapse/collapse.d.ts +2 -2
  51. package/dist/types/components/color-picker/color-picker.d.ts +2 -2
  52. package/dist/types/components/color-picker/color-picker.style.d.ts +1 -1
  53. package/dist/types/components/color-picker/use-color-picker.d.ts +2 -2
  54. package/dist/types/components/color-selector/color-selector.d.ts +2 -2
  55. package/dist/types/components/color-selector/use-color-selector.d.ts +3 -3
  56. package/dist/types/components/color-swatch/color-swatch.d.ts +2 -2
  57. package/dist/types/components/container/container.d.ts +2 -2
  58. package/dist/types/components/data-list/data-list.d.ts +2 -2
  59. package/dist/types/components/data-list/data-list.style.d.ts +1 -1
  60. package/dist/types/components/date-picker/date-picker.d.ts +2 -2
  61. package/dist/types/components/date-picker/use-date-picker.d.ts +4 -4
  62. package/dist/types/components/drawer/drawer.d.ts +2 -2
  63. package/dist/types/components/dropzone/dropzone.d.ts +4 -4
  64. package/dist/types/components/editable/editable.d.ts +4 -4
  65. package/dist/types/components/editable/use-editable.d.ts +2 -2
  66. package/dist/types/components/em/em.d.ts +2 -2
  67. package/dist/types/components/empty-state/empty-state.d.ts +2 -2
  68. package/dist/types/components/fade/fade.d.ts +2 -2
  69. package/dist/types/components/field/field.d.ts +3 -3
  70. package/dist/types/components/field/use-field-props.d.ts +3 -3
  71. package/dist/types/components/fieldset/fieldset.d.ts +3 -3
  72. package/dist/types/components/file-button/file-button.d.ts +2 -2
  73. package/dist/types/components/file-button/use-file-button.d.ts +18 -18
  74. package/dist/types/components/file-input/file-input.d.ts +2 -2
  75. package/dist/types/components/file-input/use-file-input.d.ts +15 -15
  76. package/dist/types/components/flex/flex.d.ts +2 -2
  77. package/dist/types/components/flip/flip.d.ts +4 -4
  78. package/dist/types/components/flip/flip.style.d.ts +1 -1
  79. package/dist/types/components/float/float.d.ts +2 -2
  80. package/dist/types/components/form/form.d.ts +3 -3
  81. package/dist/types/components/format/format-byte.d.ts +4 -4
  82. package/dist/types/components/format/format-date-time.d.ts +4 -4
  83. package/dist/types/components/format/format-number.d.ts +2 -2
  84. package/dist/types/components/grid/grid-item.d.ts +2 -2
  85. package/dist/types/components/grid/grid.d.ts +2 -2
  86. package/dist/types/components/group/group.d.ts +2 -2
  87. package/dist/types/components/group/use-group.d.ts +2 -2
  88. package/dist/types/components/heading/heading.d.ts +2 -2
  89. package/dist/types/components/hue-slider/hue-slider.d.ts +3 -3
  90. package/dist/types/components/icon/icon.d.ts +5 -5
  91. package/dist/types/components/image/image.d.ts +2 -2
  92. package/dist/types/components/indicator/indicator.d.ts +4 -4
  93. package/dist/types/components/infinite-scroll-area/infinite-scroll-area.d.ts +2 -2
  94. package/dist/types/components/input/input-addon.d.ts +2 -2
  95. package/dist/types/components/input/input-element.d.ts +2 -2
  96. package/dist/types/components/input/input.d.ts +2 -2
  97. package/dist/types/components/kbd/kbd.d.ts +2 -2
  98. package/dist/types/components/link/link.d.ts +2 -2
  99. package/dist/types/components/link-box/link-box.d.ts +2 -2
  100. package/dist/types/components/list/list.d.ts +2 -2
  101. package/dist/types/components/list/list.style.d.ts +2 -2
  102. package/dist/types/components/loading/loading-provider.d.ts +2 -2
  103. package/dist/types/components/loading/loading.d.ts +3 -3
  104. package/dist/types/components/mark/mark.d.ts +2 -2
  105. package/dist/types/components/menu/menu.d.ts +2 -2
  106. package/dist/types/components/menu/use-menu.d.ts +11 -11
  107. package/dist/types/components/modal/modal.d.ts +2 -2
  108. package/dist/types/components/native-accordion/native-accordion.d.ts +2 -2
  109. package/dist/types/components/native-accordion/native-accordion.style.d.ts +2 -2
  110. package/dist/types/components/native-accordion/use-native-accordion.d.ts +2 -2
  111. package/dist/types/components/native-popover/native-popover.d.ts +2 -2
  112. package/dist/types/components/native-select/native-select.d.ts +2 -2
  113. package/dist/types/components/native-table/native-table.d.ts +4 -4
  114. package/dist/types/components/notice/notice.style.d.ts +1 -1
  115. package/dist/types/components/number-input/number-input.d.ts +2 -2
  116. package/dist/types/components/number-input/number-input.style.d.ts +1 -1
  117. package/dist/types/components/pagination/pagination.d.ts +2 -2
  118. package/dist/types/components/pagination/pagination.style.d.ts +1 -1
  119. package/dist/types/components/pagination/use-pagination.d.ts +2 -2
  120. package/dist/types/components/password-input/password-input.d.ts +2 -2
  121. package/dist/types/components/password-input/strength-meter.d.ts +2 -2
  122. package/dist/types/components/password-input/use-password-input.d.ts +2 -2
  123. package/dist/types/components/pin-input/pin-input.d.ts +2 -2
  124. package/dist/types/components/pin-input/use-pin-input.d.ts +7 -7
  125. package/dist/types/components/popover/popover.d.ts +2 -2
  126. package/dist/types/components/progress/progress.d.ts +4 -4
  127. package/dist/types/components/progress/use-progress.d.ts +706 -706
  128. package/dist/types/components/qr-code/qr-code.d.ts +2 -2
  129. package/dist/types/components/radio/radio.d.ts +4 -4
  130. package/dist/types/components/radio/use-radio-group.d.ts +2 -2
  131. package/dist/types/components/radio-card/radio-card.d.ts +4 -4
  132. package/dist/types/components/rating/rating.style.d.ts +2 -2
  133. package/dist/types/components/rating/use-rating.d.ts +7 -7
  134. package/dist/types/components/reorder/reorder.d.ts +2 -2
  135. package/dist/types/components/reorder/reorder.style.d.ts +1 -1
  136. package/dist/types/components/reorder/use-reorder.d.ts +3 -3
  137. package/dist/types/components/resizable/resizable.d.ts +2 -2
  138. package/dist/types/components/resizable/resizable.style.d.ts +2 -2
  139. package/dist/types/components/resizable/use-resizable.d.ts +2 -2
  140. package/dist/types/components/ripple/ripple.d.ts +2 -2
  141. package/dist/types/components/ripple/use-ripple.d.ts +2 -2
  142. package/dist/types/components/rotate/rotate.d.ts +2 -2
  143. package/dist/types/components/saturation-slider/saturation-slider.d.ts +2 -2
  144. package/dist/types/components/saturation-slider/use-saturation-slider.d.ts +2 -2
  145. package/dist/types/components/scroll-area/scroll-area.d.ts +2 -2
  146. package/dist/types/components/segmented-control/segmented-control.d.ts +2 -2
  147. package/dist/types/components/segmented-control/segmented-control.style.d.ts +2 -2
  148. package/dist/types/components/segmented-control/use-segmented-control.d.ts +9 -9
  149. package/dist/types/components/select/select.d.ts +2 -2
  150. package/dist/types/components/select/select.style.d.ts +1 -1
  151. package/dist/types/components/select/use-select.d.ts +4 -4
  152. package/dist/types/components/separator/separator.d.ts +2 -2
  153. package/dist/types/components/sidebar/sidebar.d.ts +2 -2
  154. package/dist/types/components/sidebar/use-sidebar.d.ts +9 -9
  155. package/dist/types/components/simple-grid/simple-grid.d.ts +2 -2
  156. package/dist/types/components/skeleton/skeleton.d.ts +2 -2
  157. package/dist/types/components/slide/slide.d.ts +2 -2
  158. package/dist/types/components/slide-fade/slide-fade.d.ts +2 -2
  159. package/dist/types/components/slider/slider.d.ts +2 -2
  160. package/dist/types/components/slider/use-slider.d.ts +2 -2
  161. package/dist/types/components/stack/h-stack.d.ts +2 -2
  162. package/dist/types/components/stack/stack.d.ts +2 -2
  163. package/dist/types/components/stack/v-stack.d.ts +2 -2
  164. package/dist/types/components/stack/z-stack.d.ts +2 -2
  165. package/dist/types/components/stat/stat.d.ts +2 -2
  166. package/dist/types/components/status/status.d.ts +2 -2
  167. package/dist/types/components/steps/steps.d.ts +2 -2
  168. package/dist/types/components/steps/steps.style.d.ts +1 -1
  169. package/dist/types/components/steps/use-steps.d.ts +10 -10
  170. package/dist/types/components/switch/switch.d.ts +2 -2
  171. package/dist/types/components/table/table.d.ts +2 -2
  172. package/dist/types/components/tabs/tabs.d.ts +2 -2
  173. package/dist/types/components/tabs/use-tabs.d.ts +16 -16
  174. package/dist/types/components/tag/tag.d.ts +2 -2
  175. package/dist/types/components/tag/tag.style.d.ts +1 -1
  176. package/dist/types/components/text/text.d.ts +2 -2
  177. package/dist/types/components/textarea/textarea.d.ts +2 -2
  178. package/dist/types/components/textarea/use-autosize.d.ts +2 -2
  179. package/dist/types/components/timeline/timeline.d.ts +5 -5
  180. package/dist/types/components/timeline/timeline.style.d.ts +1 -1
  181. package/dist/types/components/toggle/toggle.d.ts +5 -5
  182. package/dist/types/components/toggle/use-toggle-group.d.ts +2 -2
  183. package/dist/types/components/toggle/use-toggle.d.ts +2 -2
  184. package/dist/types/components/tooltip/tooltip.d.ts +2 -2
  185. package/dist/types/components/tree/tree.d.ts +2 -2
  186. package/dist/types/components/tree/tree.style.d.ts +1 -1
  187. package/dist/types/components/tree/use-tree.d.ts +182 -182
  188. package/dist/types/components/visually-hidden/visually-hidden.d.ts +2 -2
  189. package/dist/types/components/wrap/wrap.d.ts +2 -2
  190. package/dist/types/core/components/create-component.d.ts +7 -7
  191. package/dist/types/core/system/color-mode-provider.d.ts +2 -2
  192. package/dist/types/core/system/storage-script.d.ts +3 -3
  193. package/dist/types/core/system/styled.d.ts +2 -2
  194. package/dist/types/core/system/system-provider.d.ts +2 -2
  195. package/dist/types/hooks/use-breakpoint/use-breakpoint-state.d.ts +2 -2
  196. package/dist/types/hooks/use-counter/index.d.ts +2 -2
  197. package/dist/types/hooks/use-descendants/index.d.ts +2 -2
  198. package/dist/types/hooks/use-field-sizing/index.d.ts +2 -2
  199. package/dist/types/hooks/use-hover/index.d.ts +2 -2
  200. package/dist/types/hooks/use-popper/index.d.ts +2 -2
  201. package/dist/types/hooks/use-resize-observer/index.d.ts +3 -3
  202. package/dist/types/providers/i18n-provider/i18n-provider.d.ts +3 -3
  203. package/dist/types/providers/ui-provider/ui-provider.d.ts +2 -2
  204. package/dist/types/utils/children.d.ts +2 -2
  205. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"use-tree.js","names":["createContext","descendant","value","level: number","value: string","branchOpen: boolean[]","selectedValue","parentTarget: string[]","children","indeterminate","getItemProps: PropGetter<\"li\">","getGroupItemProps: PropGetter<\"li\">","getIndicatorProps: PropGetter<\"svg\">"],"sources":["../../../../src/components/tree/use-tree.ts"],"sourcesContent":["\"use client\"\n\nimport type {\n ChangeEvent,\n KeyboardEvent,\n MouseEvent,\n ReactNode,\n RefObject,\n SetStateAction,\n} from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { Descendant, Descendants } from \"../../hooks/use-descendants\"\nimport type { UseDisclosureProps } from \"../../hooks/use-disclosure\"\nimport type { UseCheckboxProps } from \"../checkbox\"\nimport { Children, useCallback, useRef, useState } from \"react\"\nimport { useAsyncCallback } from \"../../hooks/use-async-callback\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { createDescendants } from \"../../hooks/use-descendants\"\nimport { useDisclosure } from \"../../hooks/use-disclosure\"\nimport {\n ariaAttr,\n assignRef,\n createContext,\n cx,\n dataAttr,\n filterEmpty,\n handlerAll,\n isArray,\n isInputElement,\n isUndefined,\n match,\n mergeRefs,\n runKeyAction,\n setAttribute,\n useIds,\n useSafeLayoutEffect,\n} from \"../../utils\"\n\nexport interface TreeControl {\n collapse: () => void\n expand: () => void\n}\n\ninterface TreeDescendantProps {\n expanded: boolean\n group: boolean\n id: string\n value: string\n query?: string\n}\n\nconst {\n DescendantsContext: TreeDescendantsContext,\n useDescendant: useTreeDescendant,\n useDescendants: useTreeDescendants,\n} = createDescendants<HTMLElement, TreeDescendantProps>()\n\nexport { TreeDescendantsContext, useTreeDescendant, useTreeDescendants }\n\ninterface TreeContext extends Omit<\n UseTreeReturn,\n \"descendants\" | \"getRootProps\"\n> {}\n\nconst [TreeContext, useTreeContext] = createContext<TreeContext>({\n name: \"TreeContext\",\n})\n\nexport { TreeContext, useTreeContext }\n\ninterface TreeItemContext extends Pick<\n UseTreeItemReturn,\n | \"branchOpen\"\n | \"groupOpen\"\n | \"level\"\n | \"onGroupClose\"\n | \"onGroupOpen\"\n | \"onGroupToggle\"\n | \"value\"\n> {}\n\nconst [TreeItemContext, useTreeItemContext] = createContext<TreeItemContext>({\n name: \"TreeItemContext\",\n strict: false,\n})\n\nexport { TreeItemContext, useTreeItemContext }\n\nexport interface UseTreeProps<\n Multiple extends boolean = false,\n> extends HTMLProps<\"ul\"> {\n /**\n * If `true`, the tree will allow checkable items.\n *\n * @default false\n */\n checkable?: boolean\n /**\n * The checked value of the tree.\n */\n checkedValue?: string[]\n /**\n * Ref of the tree callbacks.\n */\n controlRef?: RefObject<null | TreeControl>\n /**\n * The initial checked value of the tree.\n */\n defaultCheckedValue?: string[]\n /**\n * The initial expanded value of the tree.\n */\n defaultExpandedValue?: string[]\n /**\n * The initial selected value of the tree.\n */\n defaultSelectedValue?: Multiple extends true ? string[] : string\n /**\n * The expanded value of the tree.\n */\n expandedValue?: string[]\n /**\n * If `true`, the tree will allow multiple selection.\n *\n * @default false\n */\n multiple?: Multiple\n /**\n * The selected value of the tree.\n */\n selectedValue?: Multiple extends true ? string[] : string\n /**\n * The callback invoked when checked value changes.\n */\n onCheckedChange?: (value: string[]) => void\n /**\n * The callback invoked when expanded value changes.\n */\n onExpandedChange?: (value: string[]) => void\n /**\n * The callback invoked when selected value changes.\n */\n onSelectedChange?: (value: Multiple extends true ? string[] : string) => void\n}\n\nexport const useTree = <Multiple extends boolean = false>({\n checkable = false,\n checkedValue: checkedValueProp,\n children,\n controlRef,\n defaultCheckedValue = [],\n defaultExpandedValue = [],\n defaultSelectedValue,\n expandedValue: expandedValueProp,\n multiple,\n selectedValue: selectedValueProp,\n onCheckedChange: onCheckedChangeProp,\n onExpandedChange: onExpandedChangeProp,\n onSelectedChange: onSelectedChangeProp,\n ...rest\n}: UseTreeProps<Multiple> = {}) => {\n type MaybeSelectedValue = Multiple extends true ? string[] : string\n\n const [selectedValue, setSelectedValue] = useControllableState({\n defaultValue:\n defaultSelectedValue ?? ((multiple ? [] : \"\") as MaybeSelectedValue),\n value: selectedValueProp,\n onChange: onSelectedChangeProp,\n })\n const [checkedValue, onCheckedChange] = useControllableState({\n defaultValue: defaultCheckedValue,\n value: checkedValueProp,\n onChange: onCheckedChangeProp,\n })\n const [expandedValue, setExpandedValue] = useControllableState({\n defaultValue: defaultExpandedValue,\n value: expandedValueProp,\n onChange: onExpandedChangeProp,\n })\n const descendants = useTreeDescendants()\n const activeDescendant = useRef<Descendant<\n HTMLElement,\n TreeDescendantProps\n > | null>(null)\n const searchRef = useRef<{ value: string; omitValue?: string }>({\n omitValue: undefined,\n value: \"\",\n })\n const timeoutRef = useRef<any>(null)\n\n const onExpandAll = useCallback(() => {\n const values = descendants.enabledValues()\n const group = values.filter(({ group }) => group)\n const value = group.map(({ value }) => value)\n\n setExpandedValue(value)\n }, [descendants, setExpandedValue])\n\n const onCollapseAll = useCallback(() => {\n setExpandedValue([])\n }, [setExpandedValue])\n\n const onActiveDescendant = useCallback(\n (\n descendant?: Descendant<HTMLElement, TreeDescendantProps>,\n shouldFocus = true,\n ) => {\n if (!descendant) return\n\n descendants.values().forEach(({ node }) => {\n node.tabIndex = -1\n })\n\n activeDescendant.current = descendant\n descendant.node.tabIndex = 0\n\n if (shouldFocus) descendant.node.focus()\n },\n [descendants],\n )\n\n const onSearch = useCallback(\n (value: string, omitValue: string) => {\n clearTimeout(timeoutRef.current)\n\n searchRef.current.value += value\n\n if (!searchRef.current.omitValue) searchRef.current.omitValue = omitValue\n\n timeoutRef.current = setTimeout(() => {\n searchRef.current = { omitValue: undefined, value: \"\" }\n }, 400)\n\n const values = descendants\n .enabledValues({ expanded: true })\n .filter(\n (descendant) =>\n !isUndefined(descendant.value) &&\n descendant.value !== searchRef.current.omitValue,\n )\n const descendant = values.find(({ query, value }) =>\n match(query ?? value, searchRef.current.value, \"startsWith\"),\n )\n\n if (descendant) onActiveDescendant(descendant)\n },\n [descendants, onActiveDescendant],\n )\n\n const onSelectedChange = useCallback(\n (value: SetStateAction<string | string[]>) => {\n setSelectedValue(value as SetStateAction<MaybeSelectedValue>)\n },\n [setSelectedValue],\n )\n\n const onExpandedChange = useCallback(\n (value: string) => {\n setExpandedValue((prev) => {\n if (prev.includes(value)) {\n return prev.filter((prevValue) => prevValue !== value)\n } else {\n return [...prev, value]\n }\n })\n },\n [setExpandedValue],\n )\n\n useSafeLayoutEffect(() => {\n const value = isArray(selectedValue) ? selectedValue.at(0) : selectedValue\n const expandedDescendants = descendants.enabledValues({ expanded: true })\n\n if (value) {\n const descendant = expandedDescendants.find(\n (descendant) => value === descendant.value,\n )\n\n if (descendant) {\n onActiveDescendant(descendant, false)\n } else {\n onActiveDescendant(expandedDescendants.at(0), false)\n }\n } else {\n onActiveDescendant(expandedDescendants.at(0), false)\n }\n }, [children])\n\n assignRef(controlRef, { collapse: onCollapseAll, expand: onExpandAll })\n\n const getRootProps: PropGetter<\"ul\"> = useCallback(\n (props) => ({\n \"aria-multiselectable\": ariaAttr(multiple || checkable),\n children,\n role: \"tree\",\n ...rest,\n ...props,\n }),\n [multiple, checkable, rest, children],\n )\n\n return {\n activeDescendant,\n checkable,\n checkedValue,\n descendants,\n expandedValue,\n multiple,\n selectedValue,\n getRootProps,\n onActiveDescendant,\n onCheckedChange,\n onCollapseAll,\n onExpandAll,\n onExpandedChange,\n onSearch,\n onSelectedChange,\n }\n}\n\nexport type UseTreeReturn = ReturnType<typeof useTree>\n\nconst getRootDescendant =\n (descendants: Descendants<HTMLElement, TreeDescendantProps>) =>\n (value: string) => {\n const segments = value.split(\"/\")\n\n if (segments.length <= 1) return\n\n const rootValue = segments.at(0)\n\n return descendants.enabledValues().find(({ value }) => value === rootValue)\n }\n\nconst getParentDescendant =\n (descendants: Descendants<HTMLElement, TreeDescendantProps>) =>\n (value: string) => {\n const segments = value.split(\"/\")\n\n if (segments.length <= 1) return\n\n const parentValue = segments.slice(0, -1).join(\"/\")\n\n return descendants\n .enabledValues()\n .find(({ value }) => value === parentValue)\n }\n\nconst getChildDescendants =\n (descendants: Descendants<HTMLElement, TreeDescendantProps>) =>\n (value: string) => {\n const children = descendants\n .enabledValues()\n .filter((descendant) => descendant.value.startsWith(value + \"/\"))\n const values = children\n .map(({ value }) => value)\n .filter((value) => !isUndefined(value))\n\n return { children, values }\n }\n\nconst getParentValues = (value: string) => {\n const segments = value.split(\"/\")\n\n return segments\n .reduce<string[]>((prev, current) => {\n const prevValue = prev.at(-1)\n return prevValue ? [...prev, [prevValue, current].join(\"/\")] : [current]\n }, [])\n .toReversed()\n}\n\nconst getCheckbox = (node?: HTMLElement) => {\n const el = node?.querySelector(\"input[type='checkbox']\")\n\n return isInputElement(el) ? el : null\n}\n\nconst getAllChecked = (\n descendants: Descendant<HTMLElement, TreeDescendantProps>[],\n trulyValues?: string[],\n falsyValues?: string[],\n) => {\n const checked = descendants.map(({ node, value }) => {\n if (value && trulyValues?.includes(value)) return true\n if (value && falsyValues?.includes(value)) return false\n\n const checkbox = getCheckbox(node)\n\n return !!checkbox?.checked\n })\n\n const allChecked = !!checked.length && checked.every(Boolean)\n const indeterminate = checked.some(Boolean) && !allChecked\n\n return { allChecked, checked, indeterminate }\n}\n\nconst getRangeValues =\n (descendants: Descendants<HTMLElement, TreeDescendantProps>) =>\n (start: string, end: string) => {\n const values = descendants.enabledValues()\n const [startIndex, endIndex] = [\n values.findIndex((descendant) => descendant.value === start),\n values.findIndex((descendant) => descendant.value === end),\n ].sort((a, b) => a - b)\n\n return values\n .slice(startIndex, endIndex! + 1)\n .map(({ value }) => value)\n .filter((value) => !isUndefined(value))\n .sort((a, b) => {\n if (a === start && b !== start) return -1\n if (a !== start && b === start) return 1\n\n return 0\n })\n }\n\nexport interface UseTreeItemProps\n extends HTMLProps<\"div\">, Omit<UseDisclosureProps, \"timing\"> {\n /**\n * If `true`, the tree item will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * The query to search for in the tree item.\n */\n query?: string\n /**\n * The value of the item.\n */\n value?: string\n /**\n * If provided, the tree item will be rendered as an async tree item.\n */\n asyncChildren?: () => Promise<ReactNode>\n}\n\nexport const useTreeItem = ({\n asyncChildren,\n children: childrenProp,\n defaultOpen,\n disabled = false,\n open: openProp,\n query,\n value: valueProp,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n ...rest\n}: UseTreeItemProps = {}) => {\n const context = useTreeItemContext()\n const {\n activeDescendant,\n checkable,\n checkedValue,\n expandedValue,\n multiple,\n selectedValue,\n onActiveDescendant,\n onCheckedChange,\n onCollapseAll,\n onExpandAll,\n onExpandedChange,\n onSearch,\n onSelectedChange,\n } = useTreeContext()\n const [children, setChildren] = useState<ReactNode>(childrenProp)\n const [indeterminate, setIndeterminate] = useState(false)\n const [itemId, labelId, checkboxId] = useIds()\n const initialAsyncRef = useRef(false)\n const async = !!asyncChildren\n const group = async || Children.count(children) > 0\n const level: number = (context?.level ?? 0) + 1\n const value: string = filterEmpty([context?.value, valueProp]).join(\"/\")\n const nested = !!context?.value\n const selected = isArray(selectedValue)\n ? !!value && selectedValue.includes(value)\n : !!value && selectedValue === value\n const checked = !!value && checkedValue.includes(value)\n const defaultExpanded = !!value && expandedValue.includes(value)\n const {\n open: groupOpen,\n onClose,\n onOpen,\n } = useDisclosure({\n defaultOpen: defaultOpen ?? defaultExpanded,\n open: openProp,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n })\n const branchOpen: boolean[] = nested\n ? [...context.branchOpen, groupOpen]\n : [groupOpen]\n const { descendants, register } = useTreeDescendant({\n id: itemId!,\n disabled,\n expanded: branchOpen.slice(0, -1).every(Boolean),\n group,\n query,\n value,\n })\n\n const [groupLoading, onGroupChildren] = useAsyncCallback(async () => {\n const children = await asyncChildren?.()\n\n setChildren(children)\n }, [asyncChildren])\n\n const onSelect = useCallback(\n (\n ev: (\n | Partial<KeyboardEvent<HTMLElement>>\n | Partial<MouseEvent<HTMLElement>>\n ) & { value?: string } = {},\n ) => {\n const selectedValue = ev.value ?? value\n\n if (disabled || !selectedValue) return\n\n if (multiple) {\n onSelectedChange((prev) => {\n if (!isArray(prev)) return prev\n\n if (ev.ctrlKey || ev.metaKey) {\n if (prev.includes(selectedValue)) {\n return prev.filter((prevValue) => prevValue !== selectedValue)\n } else {\n return [...prev, selectedValue]\n }\n } else if (ev.shiftKey && prev[0]) {\n if (prev[0] === selectedValue) return prev\n\n return getRangeValues(descendants)(prev[0], selectedValue)\n } else {\n return [selectedValue]\n }\n })\n } else {\n onSelectedChange(selectedValue)\n }\n },\n [descendants, disabled, multiple, onSelectedChange, value],\n )\n\n const onGroupOpen = useCallback(() => {\n if (disabled || !value) return\n\n if (async && !initialAsyncRef.current) {\n initialAsyncRef.current = true\n\n onGroupChildren()\n .then(() => {\n onOpen()\n onExpandedChange(value)\n })\n .catch(() => {\n initialAsyncRef.current = false\n })\n } else {\n onOpen()\n onExpandedChange(value)\n }\n }, [disabled, async, onGroupChildren, onOpen, onExpandedChange, value])\n\n const onGroupClose = useCallback(() => {\n if (disabled || !value) return\n\n onClose()\n onExpandedChange(value)\n }, [disabled, onClose, onExpandedChange, value])\n\n const onGroupToggle = useCallback(() => {\n if (groupOpen) {\n onGroupClose()\n } else {\n onGroupOpen()\n }\n }, [groupOpen, onGroupClose, onGroupOpen])\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLElement>) => {\n if (disabled || !value) return\n\n runKeyAction(ev, {\n a: () => {\n if (!multiple || !(ev.ctrlKey || ev.metaKey)) return\n\n const values = descendants\n .enabledValues()\n .map(({ value }) => value)\n .filter((value) => !isUndefined(value))\n\n onSelectedChange(values)\n },\n ArrowDown: () => {\n if ((ev.ctrlKey || ev.metaKey) && ev.shiftKey) {\n onExpandAll()\n } else {\n const descendant = descendants.enabledNextValue(\n activeDescendant.current,\n false,\n { expanded: true },\n )\n\n onActiveDescendant(descendant)\n\n if (descendant && ev.shiftKey && multiple)\n onSelect({ ctrlKey: true, value: descendant.value })\n }\n },\n ArrowLeft: () => {\n if (group && groupOpen) {\n onGroupClose()\n } else if (nested) {\n const descendant = getParentDescendant(descendants)(value)\n\n onActiveDescendant(descendant)\n }\n },\n ArrowRight: () => {\n if (!group) return\n\n if (groupOpen) {\n const descendant = descendants.enabledNextValue(\n activeDescendant.current,\n false,\n { expanded: true },\n )\n\n onActiveDescendant(descendant)\n } else {\n if (!groupLoading) onGroupOpen()\n }\n },\n ArrowUp: () => {\n if ((ev.ctrlKey || ev.metaKey) && ev.shiftKey) {\n onCollapseAll()\n\n if (!nested) return\n\n const descendant = getRootDescendant(descendants)(value)\n\n onActiveDescendant(descendant)\n } else {\n const descendant = descendants.enabledPrevValue(\n activeDescendant.current,\n false,\n { expanded: true },\n )\n\n onActiveDescendant(descendant)\n\n if (descendant && ev.shiftKey && multiple)\n onSelect({ ctrlKey: true, value: descendant.value })\n }\n },\n End: () => {\n const descendant = descendants\n .enabledValues({ expanded: true })\n .at(-1)\n\n onActiveDescendant(descendant)\n },\n Enter: () => {\n if (group) onGroupToggle()\n\n onSelect(ev)\n },\n Home: () => {\n const descendant = descendants.enabledValues({ expanded: true }).at(0)\n\n onActiveDescendant(descendant)\n },\n Space: () => {\n if (group) onGroupToggle()\n\n onSelect(ev)\n },\n })\n\n if (ev.key.length !== 1) return\n if (ev.ctrlKey || ev.metaKey || ev.altKey) return\n\n ev.preventDefault()\n\n onSearch(ev.key, query ?? value)\n },\n [\n activeDescendant,\n descendants,\n disabled,\n group,\n groupLoading,\n groupOpen,\n multiple,\n nested,\n onActiveDescendant,\n onCollapseAll,\n onExpandAll,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n onSearch,\n onSelect,\n onSelectedChange,\n query,\n value,\n ],\n )\n\n const onItemClick = useCallback(\n (ev: MouseEvent<HTMLLIElement>) => {\n ev.stopPropagation()\n\n if (disabled || !value) return\n\n if (group && !groupLoading)\n if (!ev.ctrlKey && !ev.metaKey && !ev.shiftKey) onGroupToggle()\n\n onSelect(ev)\n },\n [disabled, group, groupLoading, onGroupToggle, onSelect, value],\n )\n\n const onCheckboxChange = useCallback(\n (ev: ChangeEvent<HTMLInputElement>) => {\n if (disabled || !value) return\n\n ev.stopPropagation()\n\n if (group) setIndeterminate(false)\n\n onCheckedChange((prev) => {\n const target = [value]\n\n if (group) {\n const { values } = getChildDescendants(descendants)(value)\n\n target.push(...values)\n }\n\n if (nested) {\n const parentValues = getParentValues(context.value)\n const parentTarget: string[] = []\n\n parentValues.forEach((parentValue) => {\n const { children } = getChildDescendants(descendants)(parentValue)\n const { allChecked } = getAllChecked(\n children,\n [...parentTarget, ...(ev.target.checked ? target : [])],\n !ev.target.checked ? target : [],\n )\n\n if (allChecked) parentTarget.push(parentValue)\n })\n\n if (!ev.target.checked) parentTarget.push(...parentValues)\n\n target.push(...parentTarget)\n }\n\n if (ev.target.checked) {\n return [...new Set([...prev, ...target])]\n } else {\n return prev.filter((prevValue) => !target.includes(prevValue))\n }\n })\n },\n [disabled, group, onCheckedChange, value, nested, descendants, context],\n )\n\n useSafeLayoutEffect(() => {\n if (defaultExpanded) {\n if (async && !initialAsyncRef.current) {\n initialAsyncRef.current = true\n\n onGroupChildren()\n .then(() => {\n onOpen()\n })\n .catch(() => {\n initialAsyncRef.current = false\n })\n } else {\n onOpen()\n }\n } else {\n onClose()\n }\n }, [async, defaultExpanded, onClose, onGroupChildren, onOpen])\n\n useSafeLayoutEffect(() => {\n if (!group || !checkable) return\n\n const { children } = getChildDescendants(descendants)(value)\n const { indeterminate } = getAllChecked(children)\n\n setIndeterminate(indeterminate)\n }, [checkedValue])\n\n useSafeLayoutEffect(() => {\n if (!checkable) return\n\n const { node } = getParentDescendant(descendants)(value) ?? {}\n const checkbox = getCheckbox(node)\n\n if (!checkbox) return\n\n const cleanup = setAttribute(checkbox, \"aria-controls\", checkboxId)\n\n return cleanup\n }, [checkable, descendants])\n\n const getItemProps: PropGetter<\"li\"> = useCallback(\n ({ ref, \"aria-labelledby\": ariaLabelledby, ...props } = {}) => ({\n id: itemId,\n ref: mergeRefs(ref, register),\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-labelledby\": cx(ariaLabelledby, labelId),\n \"aria-level\": level,\n \"aria-selected\": ariaAttr(selected),\n \"data-disabled\": dataAttr(disabled),\n role: \"treeitem\",\n tabIndex: -1,\n ...props,\n onClick: handlerAll(props.onClick, onItemClick),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n }),\n [\n itemId,\n register,\n disabled,\n labelId,\n level,\n selected,\n onItemClick,\n onKeyDown,\n ],\n )\n\n const getGroupItemProps: PropGetter<\"li\"> = useCallback(\n (props = {}) => getItemProps({ \"aria-expanded\": groupOpen, ...props }),\n [getItemProps, groupOpen],\n )\n\n const getIndicatorProps: PropGetter<\"svg\"> = useCallback(\n (props) => ({\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-expanded\": groupOpen,\n \"aria-hidden\": true,\n \"data-disabled\": dataAttr(disabled),\n \"data-loading\": dataAttr(groupLoading),\n \"data-selected\": dataAttr(selected),\n role: \"presentation\",\n ...props,\n }),\n [disabled, groupOpen, selected, groupLoading],\n )\n\n const getCheckboxProps: PropGetter<UseCheckboxProps> = useCallback(\n ({ \"aria-labelledby\": ariaLabelledby, ...props } = {}) => ({\n id: checkboxId,\n \"aria-labelledby\": cx(ariaLabelledby, labelId),\n \"data-selected\": dataAttr(selected),\n checked,\n disabled,\n indeterminate,\n tabIndex: -1,\n ...props,\n onChange: handlerAll(props.onChange, onCheckboxChange),\n }),\n [\n checkboxId,\n labelId,\n selected,\n checked,\n disabled,\n indeterminate,\n onCheckboxChange,\n ],\n )\n\n const getGroupProps: PropGetter<\"ul\"> = useCallback(\n ({ \"aria-labelledby\": ariaLabelledby, ...props } = {}) => ({\n \"aria-busy\": ariaAttr(groupLoading),\n \"aria-labelledby\": cx(ariaLabelledby, labelId),\n \"data-disabled\": dataAttr(disabled),\n role: \"group\",\n ...props,\n }),\n [labelId, disabled, groupLoading],\n )\n\n const getLabelProps: PropGetter<\"span\"> = useCallback(\n (props = {}) => ({ id: labelId, ...props }),\n [labelId],\n )\n\n return {\n branchOpen,\n checked,\n children,\n disabled,\n group,\n groupLoading,\n groupOpen,\n indeterminate,\n level,\n props: rest,\n selected,\n value,\n getCheckboxProps,\n getGroupItemProps,\n getGroupProps,\n getIndicatorProps,\n getItemProps,\n getLabelProps,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n }\n}\n\nexport type UseTreeItemReturn = ReturnType<typeof useTreeItem>\n"],"mappings":";;;;;;;;;;;;;;;AAmDA,MAAM,EACJ,oBAAoB,wBACpB,eAAe,mBACf,gBAAgB,uBACd,mBAAqD;AASzD,MAAM,CAAC,aAAa,kBAAkBA,gBAA2B,EAC/D,MAAM,eACP,CAAC;AAeF,MAAM,CAAC,iBAAiB,sBAAsBA,gBAA+B;CAC3E,MAAM;CACN,QAAQ;CACT,CAAC;AA6DF,MAAa,WAA6C,EACxD,YAAY,OACZ,cAAc,kBACd,UACA,YACA,sBAAsB,EAAE,EACxB,uBAAuB,EAAE,EACzB,sBACA,eAAe,mBACf,UACA,eAAe,mBACf,iBAAiB,qBACjB,kBAAkB,sBAClB,kBAAkB,sBAClB,GAAG,SACuB,EAAE,KAAK;CAGjC,MAAM,CAAC,eAAe,oBAAoB,qBAAqB;EAC7D,cACE,yBAA0B,WAAW,EAAE,GAAG;EAC5C,OAAO;EACP,UAAU;EACX,CAAC;CACF,MAAM,CAAC,cAAc,mBAAmB,qBAAqB;EAC3D,cAAc;EACd,OAAO;EACP,UAAU;EACX,CA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;GACnC,MAAM;GACN,GAAG;GACJ,GACD;GAAC;GAAS;GAAU;GAAa,CAClC;EAuBC;EACA;EACA,eAvBwC,aACvC,QAAQ,EAAE,MAAM;GAAE,IAAI;GAAS,GAAG;GAAO,GAC1C,CAAC,QAAQ,CACV;EAqBC;EACA;EACA;EACD"}
1
+ {"version":3,"file":"use-tree.js","names":["createContext","descendant","value","level: number","value: string","branchOpen: boolean[]","selectedValue","parentTarget: string[]","children","indeterminate","getItemProps: PropGetter<\"li\">","getGroupItemProps: PropGetter<\"li\">","getIndicatorProps: PropGetter<\"svg\">"],"sources":["../../../../src/components/tree/use-tree.ts"],"sourcesContent":["\"use client\"\n\nimport type {\n ChangeEvent,\n KeyboardEvent,\n MouseEvent,\n ReactNode,\n RefObject,\n SetStateAction,\n} from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { Descendant, Descendants } from \"../../hooks/use-descendants\"\nimport type { UseDisclosureProps } from \"../../hooks/use-disclosure\"\nimport type { UseCheckboxProps } from \"../checkbox\"\nimport { Children, useCallback, useRef, useState } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useAsyncCallback } from \"../../hooks/use-async-callback\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { createDescendants } from \"../../hooks/use-descendants\"\nimport { useDisclosure } from \"../../hooks/use-disclosure\"\nimport {\n ariaAttr,\n assignRef,\n createContext,\n cx,\n dataAttr,\n filterEmpty,\n handlerAll,\n isArray,\n isInputElement,\n isUndefined,\n match,\n mergeRefs,\n runKeyAction,\n setAttribute,\n useIds,\n useSafeLayoutEffect,\n} from \"../../utils\"\n\nexport interface TreeControl {\n collapse: () => void\n expand: () => void\n}\n\ninterface TreeDescendantProps {\n expanded: boolean\n group: boolean\n id: string\n value: string\n query?: string\n}\n\nconst {\n DescendantsContext: TreeDescendantsContext,\n useDescendant: useTreeDescendant,\n useDescendants: useTreeDescendants,\n} = createDescendants<HTMLElement, TreeDescendantProps>()\n\nexport { TreeDescendantsContext, useTreeDescendant, useTreeDescendants }\n\ninterface TreeContext extends Omit<\n UseTreeReturn,\n \"descendants\" | \"getRootProps\"\n> {}\n\nconst [TreeContext, useTreeContext] = createContext<TreeContext>({\n name: \"TreeContext\",\n})\n\nexport { TreeContext, useTreeContext }\n\ninterface TreeItemContext extends Pick<\n UseTreeItemReturn,\n | \"branchOpen\"\n | \"groupOpen\"\n | \"level\"\n | \"onGroupClose\"\n | \"onGroupOpen\"\n | \"onGroupToggle\"\n | \"value\"\n> {}\n\nconst [TreeItemContext, useTreeItemContext] = createContext<TreeItemContext>({\n name: \"TreeItemContext\",\n strict: false,\n})\n\nexport { TreeItemContext, useTreeItemContext }\n\nexport interface UseTreeProps<\n Multiple extends boolean = false,\n> extends HTMLProps<\"ul\"> {\n /**\n * If `true`, the tree will allow checkable items.\n *\n * @default false\n */\n checkable?: boolean\n /**\n * The checked value of the tree.\n */\n checkedValue?: string[]\n /**\n * Ref of the tree callbacks.\n */\n controlRef?: RefObject<null | TreeControl>\n /**\n * The initial checked value of the tree.\n */\n defaultCheckedValue?: string[]\n /**\n * The initial expanded value of the tree.\n */\n defaultExpandedValue?: string[]\n /**\n * The initial selected value of the tree.\n */\n defaultSelectedValue?: Multiple extends true ? string[] : string\n /**\n * The expanded value of the tree.\n */\n expandedValue?: string[]\n /**\n * If `true`, the tree will allow multiple selection.\n *\n * @default false\n */\n multiple?: Multiple\n /**\n * The selected value of the tree.\n */\n selectedValue?: Multiple extends true ? string[] : string\n /**\n * The callback invoked when checked value changes.\n */\n onCheckedChange?: (value: string[]) => void\n /**\n * The callback invoked when expanded value changes.\n */\n onExpandedChange?: (value: string[]) => void\n /**\n * The callback invoked when selected value changes.\n */\n onSelectedChange?: (value: Multiple extends true ? string[] : string) => void\n}\n\nexport const useTree = <Multiple extends boolean = false>({\n checkable = false,\n checkedValue: checkedValueProp,\n children,\n controlRef,\n defaultCheckedValue = [],\n defaultExpandedValue = [],\n defaultSelectedValue,\n expandedValue: expandedValueProp,\n multiple,\n selectedValue: selectedValueProp,\n onCheckedChange: onCheckedChangeProp,\n onExpandedChange: onExpandedChangeProp,\n onSelectedChange: onSelectedChangeProp,\n ...rest\n}: UseTreeProps<Multiple> = {}) => {\n type MaybeSelectedValue = Multiple extends true ? string[] : string\n\n const [selectedValue, setSelectedValue] = useControllableState({\n defaultValue:\n defaultSelectedValue ?? ((multiple ? [] : \"\") as MaybeSelectedValue),\n value: selectedValueProp,\n onChange: onSelectedChangeProp,\n })\n const [checkedValue, onCheckedChange] = useControllableState({\n defaultValue: defaultCheckedValue,\n value: checkedValueProp,\n onChange: onCheckedChangeProp,\n })\n const [expandedValue, setExpandedValue] = useControllableState({\n defaultValue: defaultExpandedValue,\n value: expandedValueProp,\n onChange: onExpandedChangeProp,\n })\n const descendants = useTreeDescendants()\n const activeDescendant = useRef<Descendant<\n HTMLElement,\n TreeDescendantProps\n > | null>(null)\n const searchRef = useRef<{ value: string; omitValue?: string }>({\n omitValue: undefined,\n value: \"\",\n })\n const timeoutRef = useRef<any>(null)\n\n const onExpandAll = useCallback(() => {\n const values = descendants.enabledValues()\n const group = values.filter(({ group }) => group)\n const value = group.map(({ value }) => value)\n\n setExpandedValue(value)\n }, [descendants, setExpandedValue])\n\n const onCollapseAll = useCallback(() => {\n setExpandedValue([])\n }, [setExpandedValue])\n\n const onActiveDescendant = useCallback(\n (\n descendant?: Descendant<HTMLElement, TreeDescendantProps>,\n shouldFocus = true,\n ) => {\n if (!descendant) return\n\n descendants.values().forEach(({ node }) => {\n node.tabIndex = -1\n })\n\n activeDescendant.current = descendant\n descendant.node.tabIndex = 0\n\n if (shouldFocus) descendant.node.focus()\n },\n [descendants],\n )\n\n const onSearch = useCallback(\n (value: string, omitValue: string) => {\n clearTimeout(timeoutRef.current)\n\n searchRef.current.value += value\n\n if (!searchRef.current.omitValue) searchRef.current.omitValue = omitValue\n\n timeoutRef.current = setTimeout(() => {\n searchRef.current = { omitValue: undefined, value: \"\" }\n }, 400)\n\n const values = descendants\n .enabledValues({ expanded: true })\n .filter(\n (descendant) =>\n !isUndefined(descendant.value) &&\n descendant.value !== searchRef.current.omitValue,\n )\n const descendant = values.find(({ query, value }) =>\n match(query ?? value, searchRef.current.value, \"startsWith\"),\n )\n\n if (descendant) onActiveDescendant(descendant)\n },\n [descendants, onActiveDescendant],\n )\n\n const onSelectedChange = useCallback(\n (value: SetStateAction<string | string[]>) => {\n setSelectedValue(value as SetStateAction<MaybeSelectedValue>)\n },\n [setSelectedValue],\n )\n\n const onExpandedChange = useCallback(\n (value: string) => {\n setExpandedValue((prev) => {\n if (prev.includes(value)) {\n return prev.filter((prevValue) => prevValue !== value)\n } else {\n return [...prev, value]\n }\n })\n },\n [setExpandedValue],\n )\n\n useSafeLayoutEffect(() => {\n const value = isArray(selectedValue) ? selectedValue.at(0) : selectedValue\n const expandedDescendants = descendants.enabledValues({ expanded: true })\n\n if (value) {\n const descendant = expandedDescendants.find(\n (descendant) => value === descendant.value,\n )\n\n if (descendant) {\n onActiveDescendant(descendant, false)\n } else {\n onActiveDescendant(expandedDescendants.at(0), false)\n }\n } else {\n onActiveDescendant(expandedDescendants.at(0), false)\n }\n }, [children])\n\n assignRef(controlRef, { collapse: onCollapseAll, expand: onExpandAll })\n\n const getRootProps: PropGetter<\"ul\"> = useCallback(\n (props) =>\n mergeProps(\n {\n \"aria-multiselectable\": ariaAttr(multiple || checkable),\n children,\n role: \"tree\",\n },\n rest,\n props,\n )(),\n [multiple, checkable, rest, children],\n )\n\n return {\n activeDescendant,\n checkable,\n checkedValue,\n descendants,\n expandedValue,\n multiple,\n selectedValue,\n getRootProps,\n onActiveDescendant,\n onCheckedChange,\n onCollapseAll,\n onExpandAll,\n onExpandedChange,\n onSearch,\n onSelectedChange,\n }\n}\n\nexport type UseTreeReturn = ReturnType<typeof useTree>\n\nconst getRootDescendant =\n (descendants: Descendants<HTMLElement, TreeDescendantProps>) =>\n (value: string) => {\n const segments = value.split(\"/\")\n\n if (segments.length <= 1) return\n\n const rootValue = segments.at(0)\n\n return descendants.enabledValues().find(({ value }) => value === rootValue)\n }\n\nconst getParentDescendant =\n (descendants: Descendants<HTMLElement, TreeDescendantProps>) =>\n (value: string) => {\n const segments = value.split(\"/\")\n\n if (segments.length <= 1) return\n\n const parentValue = segments.slice(0, -1).join(\"/\")\n\n return descendants\n .enabledValues()\n .find(({ value }) => value === parentValue)\n }\n\nconst getChildDescendants =\n (descendants: Descendants<HTMLElement, TreeDescendantProps>) =>\n (value: string) => {\n const children = descendants\n .enabledValues()\n .filter((descendant) => descendant.value.startsWith(value + \"/\"))\n const values = children\n .map(({ value }) => value)\n .filter((value) => !isUndefined(value))\n\n return { children, values }\n }\n\nconst getParentValues = (value: string) => {\n const segments = value.split(\"/\")\n\n return segments\n .reduce<string[]>((prev, current) => {\n const prevValue = prev.at(-1)\n return prevValue ? [...prev, [prevValue, current].join(\"/\")] : [current]\n }, [])\n .toReversed()\n}\n\nconst getCheckbox = (node?: HTMLElement) => {\n const el = node?.querySelector(\"input[type='checkbox']\")\n\n return isInputElement(el) ? el : null\n}\n\nconst getAllChecked = (\n descendants: Descendant<HTMLElement, TreeDescendantProps>[],\n trulyValues?: string[],\n falsyValues?: string[],\n) => {\n const checked = descendants.map(({ node, value }) => {\n if (value && trulyValues?.includes(value)) return true\n if (value && falsyValues?.includes(value)) return false\n\n const checkbox = getCheckbox(node)\n\n return !!checkbox?.checked\n })\n\n const allChecked = !!checked.length && checked.every(Boolean)\n const indeterminate = checked.some(Boolean) && !allChecked\n\n return { allChecked, checked, indeterminate }\n}\n\nconst getRangeValues =\n (descendants: Descendants<HTMLElement, TreeDescendantProps>) =>\n (start: string, end: string) => {\n const values = descendants.enabledValues()\n const [startIndex, endIndex] = [\n values.findIndex((descendant) => descendant.value === start),\n values.findIndex((descendant) => descendant.value === end),\n ].sort((a, b) => a - b)\n\n return values\n .slice(startIndex, endIndex! + 1)\n .map(({ value }) => value)\n .filter((value) => !isUndefined(value))\n .sort((a, b) => {\n if (a === start && b !== start) return -1\n if (a !== start && b === start) return 1\n\n return 0\n })\n }\n\nexport interface UseTreeItemProps\n extends HTMLProps<\"div\">, Omit<UseDisclosureProps, \"timing\"> {\n /**\n * If `true`, the tree item will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * The query to search for in the tree item.\n */\n query?: string\n /**\n * The value of the item.\n */\n value?: string\n /**\n * If provided, the tree item will be rendered as an async tree item.\n */\n asyncChildren?: () => Promise<ReactNode>\n}\n\nexport const useTreeItem = ({\n asyncChildren,\n children: childrenProp,\n defaultOpen,\n disabled = false,\n open: openProp,\n query,\n value: valueProp,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n ...rest\n}: UseTreeItemProps = {}) => {\n const context = useTreeItemContext()\n const {\n activeDescendant,\n checkable,\n checkedValue,\n expandedValue,\n multiple,\n selectedValue,\n onActiveDescendant,\n onCheckedChange,\n onCollapseAll,\n onExpandAll,\n onExpandedChange,\n onSearch,\n onSelectedChange,\n } = useTreeContext()\n const [children, setChildren] = useState<ReactNode>(childrenProp)\n const [indeterminate, setIndeterminate] = useState(false)\n const [itemId, labelId, checkboxId] = useIds()\n const initialAsyncRef = useRef(false)\n const async = !!asyncChildren\n const group = async || Children.count(children) > 0\n const level: number = (context?.level ?? 0) + 1\n const value: string = filterEmpty([context?.value, valueProp]).join(\"/\")\n const nested = !!context?.value\n const selected = isArray(selectedValue)\n ? !!value && selectedValue.includes(value)\n : !!value && selectedValue === value\n const checked = !!value && checkedValue.includes(value)\n const defaultExpanded = !!value && expandedValue.includes(value)\n const {\n open: groupOpen,\n onClose,\n onOpen,\n } = useDisclosure({\n defaultOpen: defaultOpen ?? defaultExpanded,\n open: openProp,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n })\n const branchOpen: boolean[] = nested\n ? [...context.branchOpen, groupOpen]\n : [groupOpen]\n const { descendants, register } = useTreeDescendant({\n id: itemId!,\n disabled,\n expanded: branchOpen.slice(0, -1).every(Boolean),\n group,\n query,\n value,\n })\n\n const [groupLoading, onGroupChildren] = useAsyncCallback(async () => {\n const children = await asyncChildren?.()\n\n setChildren(children)\n }, [asyncChildren])\n\n const onSelect = useCallback(\n (\n ev: (\n | Partial<KeyboardEvent<HTMLElement>>\n | Partial<MouseEvent<HTMLElement>>\n ) & { value?: string } = {},\n ) => {\n const selectedValue = ev.value ?? value\n\n if (disabled || !selectedValue) return\n\n if (multiple) {\n onSelectedChange((prev) => {\n if (!isArray(prev)) return prev\n\n if (ev.ctrlKey || ev.metaKey) {\n if (prev.includes(selectedValue)) {\n return prev.filter((prevValue) => prevValue !== selectedValue)\n } else {\n return [...prev, selectedValue]\n }\n } else if (ev.shiftKey && prev[0]) {\n if (prev[0] === selectedValue) return prev\n\n return getRangeValues(descendants)(prev[0], selectedValue)\n } else {\n return [selectedValue]\n }\n })\n } else {\n onSelectedChange(selectedValue)\n }\n },\n [descendants, disabled, multiple, onSelectedChange, value],\n )\n\n const onGroupOpen = useCallback(() => {\n if (disabled || !value) return\n\n if (async && !initialAsyncRef.current) {\n initialAsyncRef.current = true\n\n onGroupChildren()\n .then(() => {\n onOpen()\n onExpandedChange(value)\n })\n .catch(() => {\n initialAsyncRef.current = false\n })\n } else {\n onOpen()\n onExpandedChange(value)\n }\n }, [disabled, async, onGroupChildren, onOpen, onExpandedChange, value])\n\n const onGroupClose = useCallback(() => {\n if (disabled || !value) return\n\n onClose()\n onExpandedChange(value)\n }, [disabled, onClose, onExpandedChange, value])\n\n const onGroupToggle = useCallback(() => {\n if (groupOpen) {\n onGroupClose()\n } else {\n onGroupOpen()\n }\n }, [groupOpen, onGroupClose, onGroupOpen])\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLElement>) => {\n if (disabled || !value) return\n\n runKeyAction(ev, {\n a: () => {\n if (!multiple || !(ev.ctrlKey || ev.metaKey)) return\n\n const values = descendants\n .enabledValues()\n .map(({ value }) => value)\n .filter((value) => !isUndefined(value))\n\n onSelectedChange(values)\n },\n ArrowDown: () => {\n if ((ev.ctrlKey || ev.metaKey) && ev.shiftKey) {\n onExpandAll()\n } else {\n const descendant = descendants.enabledNextValue(\n activeDescendant.current,\n false,\n { expanded: true },\n )\n\n onActiveDescendant(descendant)\n\n if (descendant && ev.shiftKey && multiple)\n onSelect({ ctrlKey: true, value: descendant.value })\n }\n },\n ArrowLeft: () => {\n if (group && groupOpen) {\n onGroupClose()\n } else if (nested) {\n const descendant = getParentDescendant(descendants)(value)\n\n onActiveDescendant(descendant)\n }\n },\n ArrowRight: () => {\n if (!group) return\n\n if (groupOpen) {\n const descendant = descendants.enabledNextValue(\n activeDescendant.current,\n false,\n { expanded: true },\n )\n\n onActiveDescendant(descendant)\n } else {\n if (!groupLoading) onGroupOpen()\n }\n },\n ArrowUp: () => {\n if ((ev.ctrlKey || ev.metaKey) && ev.shiftKey) {\n onCollapseAll()\n\n if (!nested) return\n\n const descendant = getRootDescendant(descendants)(value)\n\n onActiveDescendant(descendant)\n } else {\n const descendant = descendants.enabledPrevValue(\n activeDescendant.current,\n false,\n { expanded: true },\n )\n\n onActiveDescendant(descendant)\n\n if (descendant && ev.shiftKey && multiple)\n onSelect({ ctrlKey: true, value: descendant.value })\n }\n },\n End: () => {\n const descendant = descendants\n .enabledValues({ expanded: true })\n .at(-1)\n\n onActiveDescendant(descendant)\n },\n Enter: () => {\n if (group) onGroupToggle()\n\n onSelect(ev)\n },\n Home: () => {\n const descendant = descendants.enabledValues({ expanded: true }).at(0)\n\n onActiveDescendant(descendant)\n },\n Space: () => {\n if (group) onGroupToggle()\n\n onSelect(ev)\n },\n })\n\n if (ev.key.length !== 1) return\n if (ev.ctrlKey || ev.metaKey || ev.altKey) return\n\n ev.preventDefault()\n\n onSearch(ev.key, query ?? value)\n },\n [\n activeDescendant,\n descendants,\n disabled,\n group,\n groupLoading,\n groupOpen,\n multiple,\n nested,\n onActiveDescendant,\n onCollapseAll,\n onExpandAll,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n onSearch,\n onSelect,\n onSelectedChange,\n query,\n value,\n ],\n )\n\n const onItemClick = useCallback(\n (ev: MouseEvent<HTMLLIElement>) => {\n ev.stopPropagation()\n\n if (disabled || !value) return\n\n if (group && !groupLoading)\n if (!ev.ctrlKey && !ev.metaKey && !ev.shiftKey) onGroupToggle()\n\n onSelect(ev)\n },\n [disabled, group, groupLoading, onGroupToggle, onSelect, value],\n )\n\n const onCheckboxChange = useCallback(\n (ev: ChangeEvent<HTMLInputElement>) => {\n if (disabled || !value) return\n\n ev.stopPropagation()\n\n if (group) setIndeterminate(false)\n\n onCheckedChange((prev) => {\n const target = [value]\n\n if (group) {\n const { values } = getChildDescendants(descendants)(value)\n\n target.push(...values)\n }\n\n if (nested) {\n const parentValues = getParentValues(context.value)\n const parentTarget: string[] = []\n\n parentValues.forEach((parentValue) => {\n const { children } = getChildDescendants(descendants)(parentValue)\n const { allChecked } = getAllChecked(\n children,\n [...parentTarget, ...(ev.target.checked ? target : [])],\n !ev.target.checked ? target : [],\n )\n\n if (allChecked) parentTarget.push(parentValue)\n })\n\n if (!ev.target.checked) parentTarget.push(...parentValues)\n\n target.push(...parentTarget)\n }\n\n if (ev.target.checked) {\n return [...new Set([...prev, ...target])]\n } else {\n return prev.filter((prevValue) => !target.includes(prevValue))\n }\n })\n },\n [disabled, group, onCheckedChange, value, nested, descendants, context],\n )\n\n useSafeLayoutEffect(() => {\n if (defaultExpanded) {\n if (async && !initialAsyncRef.current) {\n initialAsyncRef.current = true\n\n onGroupChildren()\n .then(() => {\n onOpen()\n })\n .catch(() => {\n initialAsyncRef.current = false\n })\n } else {\n onOpen()\n }\n } else {\n onClose()\n }\n }, [async, defaultExpanded, onClose, onGroupChildren, onOpen])\n\n useSafeLayoutEffect(() => {\n if (!group || !checkable) return\n\n const { children } = getChildDescendants(descendants)(value)\n const { indeterminate } = getAllChecked(children)\n\n setIndeterminate(indeterminate)\n }, [checkedValue])\n\n useSafeLayoutEffect(() => {\n if (!checkable) return\n\n const { node } = getParentDescendant(descendants)(value) ?? {}\n const checkbox = getCheckbox(node)\n\n if (!checkbox) return\n\n const cleanup = setAttribute(checkbox, \"aria-controls\", checkboxId)\n\n return cleanup\n }, [checkable, descendants])\n\n const getItemProps: PropGetter<\"li\"> = useCallback(\n ({ ref, \"aria-labelledby\": ariaLabelledby, ...props } = {}) => ({\n id: itemId,\n ref: mergeRefs(ref, register),\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-labelledby\": cx(ariaLabelledby, labelId),\n \"aria-level\": level,\n \"aria-selected\": ariaAttr(selected),\n \"data-disabled\": dataAttr(disabled),\n role: \"treeitem\",\n tabIndex: -1,\n ...props,\n onClick: handlerAll(props.onClick, onItemClick),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n }),\n [\n itemId,\n register,\n disabled,\n labelId,\n level,\n selected,\n onItemClick,\n onKeyDown,\n ],\n )\n\n const getGroupItemProps: PropGetter<\"li\"> = useCallback(\n (props = {}) => getItemProps({ \"aria-expanded\": groupOpen, ...props }),\n [getItemProps, groupOpen],\n )\n\n const getIndicatorProps: PropGetter<\"svg\"> = useCallback(\n (props) => ({\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-expanded\": groupOpen,\n \"aria-hidden\": true,\n \"data-disabled\": dataAttr(disabled),\n \"data-loading\": dataAttr(groupLoading),\n \"data-selected\": dataAttr(selected),\n role: \"presentation\",\n ...props,\n }),\n [disabled, groupOpen, selected, groupLoading],\n )\n\n const getCheckboxProps: PropGetter<UseCheckboxProps> = useCallback(\n ({ \"aria-labelledby\": ariaLabelledby, ...props } = {}) => ({\n id: checkboxId,\n \"aria-labelledby\": cx(ariaLabelledby, labelId),\n \"data-selected\": dataAttr(selected),\n checked,\n disabled,\n indeterminate,\n tabIndex: -1,\n ...props,\n onChange: handlerAll(props.onChange, onCheckboxChange),\n }),\n [\n checkboxId,\n labelId,\n selected,\n checked,\n disabled,\n indeterminate,\n onCheckboxChange,\n ],\n )\n\n const getGroupProps: PropGetter<\"ul\"> = useCallback(\n ({ \"aria-labelledby\": ariaLabelledby, ...props } = {}) => ({\n \"aria-busy\": ariaAttr(groupLoading),\n \"aria-labelledby\": cx(ariaLabelledby, labelId),\n \"data-disabled\": dataAttr(disabled),\n role: \"group\",\n ...props,\n }),\n [labelId, disabled, groupLoading],\n )\n\n const getLabelProps: PropGetter<\"span\"> = useCallback(\n (props = {}) => ({ id: labelId, ...props }),\n [labelId],\n )\n\n return {\n branchOpen,\n checked,\n children,\n disabled,\n group,\n groupLoading,\n groupOpen,\n indeterminate,\n level,\n props: rest,\n selected,\n value,\n getCheckboxProps,\n getGroupItemProps,\n getGroupProps,\n getIndicatorProps,\n getItemProps,\n getLabelProps,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n }\n}\n\nexport type UseTreeItemReturn = ReturnType<typeof useTreeItem>\n"],"mappings":";;;;;;;;;;;;;;;;;AAoDA,MAAM,EACJ,oBAAoB,wBACpB,eAAe,mBACf,gBAAgB,uBACd,mBAAqD;AASzD,MAAM,CAAC,aAAa,kBAAkBA,gBAA2B,EAC/D,MAAM,eACP,CAAC;AAeF,MAAM,CAAC,iBAAiB,sBAAsBA,gBAA+B;CAC3E,MAAM;CACN,QAAQ;CACT,CAAC;AA6DF,MAAa,WAA6C,EACxD,YAAY,OACZ,cAAc,kBACd,UACA,YACA,sBAAsB,EAAE,EACxB,uBAAuB,EAAE,EACzB,sBACA,eAAe,mBACf,UACA,eAAe,mBACf,iBAAiB,qBACjB,kBAAkB,sBAClB,kBAAkB,sBAClB,GAAG,SACuB,EAAE,KAAK;CAGjC,MAAM,CAAC,eAAe,oBAAoB,qBAAqB;EAC7D,cACE,yBAA0B,WAAW,EAAE,GAAG;EAC5C,OAAO;EACP,UAAU;EACX,CAAC;CACF,MAAM,CAAC,cAAc,mBAAmB,qBAAqB;EAC3D,cAAc;EACd,OAAO;EACP,UAAU;EACX,CAAC;CACF,MAAM,CAAC,eAAe,oBAAoB,qBAAqB;EAC7D,cAAc;EACd,OAAO;EACP,UAAU;EACX,CAAC;CACF,MAAM,cAAc,oBAAoB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MAAM;GAAE,IAAI;GAAS,GAAG;GAAO,GAC1C,CAAC,QAAQ,CACV;EAqBC;EACA;EACA;EACD"}
@@ -9,7 +9,7 @@ import "../collapse/index.js";
9
9
  import "../../index.js";
10
10
  import { AccordionStyle } from "./accordion.style.js";
11
11
  import { UseAccordionItemProps, UseAccordionProps } from "./use-accordion.js";
12
- import * as react1033 from "react";
12
+ import * as react147 from "react";
13
13
 
14
14
  //#region src/components/accordion/accordion.d.ts
15
15
  interface AccordionCallBackProps {
@@ -33,7 +33,7 @@ interface AccordionRootProps extends Omit<HTMLStyledProps, "onChange">, ThemePro
33
33
  */
34
34
  items?: AccordionItem[];
35
35
  }
36
- declare const AccordionPropsContext: react1033.Context<Partial<AccordionRootProps> | undefined>, useAccordionPropsContext: () => Partial<AccordionRootProps> | undefined;
36
+ declare const AccordionPropsContext: react147.Context<Partial<AccordionRootProps> | undefined>, useAccordionPropsContext: () => Partial<AccordionRootProps> | undefined;
37
37
  /**
38
38
  * `Accordion` is a component for a list that displays information in an expandable or collapsible manner.
39
39
  *
@@ -3,7 +3,7 @@ import { CSSModifierObject, CSSPropObject, CSSSlotObject } from "../../core/css/
3
3
  import "../../index.js";
4
4
 
5
5
  //#region src/components/accordion/accordion.style.d.ts
6
- declare const accordionStyle: ComponentSlotStyle<"button" | "panel" | "icon" | "item" | "root", CSSPropObject<CSSSlotObject<"button" | "panel" | "icon" | "item" | "root">>, CSSModifierObject<CSSSlotObject<"button" | "panel" | "icon" | "item" | "root">>, {
6
+ declare const accordionStyle: ComponentSlotStyle<"button" | "panel" | "icon" | "root" | "item", CSSPropObject<CSSSlotObject<"button" | "panel" | "icon" | "root" | "item">>, CSSModifierObject<CSSSlotObject<"button" | "panel" | "icon" | "root" | "item">>, {
7
7
  panel: {
8
8
  button: {
9
9
  rounded: "l2";
@@ -2,10 +2,10 @@ import { HTMLProps, PropGetter } from "../../core/components/index.types.js";
2
2
  import "../../core/index.js";
3
3
  import { Descendant } from "../../hooks/use-descendants/index.js";
4
4
  import "../../index.js";
5
- import * as react1021 from "react";
5
+ import * as react135 from "react";
6
6
 
7
7
  //#region src/components/accordion/use-accordion.d.ts
8
- declare const AccordionDescendantsContext: react1021.Context<{
8
+ declare const AccordionDescendantsContext: react135.Context<{
9
9
  active: (target?: HTMLButtonElement | Descendant<HTMLButtonElement, {}> | null | undefined, options?: FocusOptions) => void;
10
10
  count: (props?: Partial<{}> | undefined) => number;
11
11
  destroy: () => void;
@@ -24,7 +24,7 @@ declare const AccordionDescendantsContext: react1021.Context<{
24
24
  prevValue: (indexOrNode: number | HTMLButtonElement | Descendant<HTMLButtonElement, {}> | null, loop?: boolean, props?: Partial<{}> | undefined) => Descendant<HTMLButtonElement, {}> | undefined;
25
25
  register: (props?: {
26
26
  disabled?: boolean | ((node: HTMLButtonElement) => boolean) | undefined;
27
- } | undefined) => react1021.RefCallback<HTMLButtonElement>;
27
+ } | undefined) => react135.RefCallback<HTMLButtonElement>;
28
28
  unregister: (node?: HTMLButtonElement | null | undefined) => void;
29
29
  value: (indexOrNode: number | HTMLButtonElement | null) => Descendant<HTMLButtonElement, {}> | undefined;
30
30
  values: (props?: Partial<{}> | undefined) => Descendant<HTMLButtonElement, {}>[];
@@ -50,12 +50,12 @@ declare const AccordionDescendantsContext: react1021.Context<{
50
50
  prevValue: (indexOrNode: number | HTMLButtonElement | Descendant<HTMLButtonElement, {}> | null, loop?: boolean, props?: Partial<{}> | undefined) => Descendant<HTMLButtonElement, {}> | undefined;
51
51
  register: (props?: {
52
52
  disabled?: boolean | ((node: HTMLButtonElement) => boolean) | undefined;
53
- } | undefined) => react1021.RefCallback<HTMLButtonElement>;
53
+ } | undefined) => react135.RefCallback<HTMLButtonElement>;
54
54
  unregister: (node?: HTMLButtonElement | null | undefined) => void;
55
55
  value: (indexOrNode: number | HTMLButtonElement | null) => Descendant<HTMLButtonElement, {}> | undefined;
56
56
  values: (props?: Partial<{}> | undefined) => Descendant<HTMLButtonElement, {}>[];
57
57
  };
58
- register: react1021.RefCallback<HTMLButtonElement>;
58
+ register: react135.RefCallback<HTMLButtonElement>;
59
59
  }, useAccordionDescendants: () => {
60
60
  active: (target?: HTMLButtonElement | Descendant<HTMLButtonElement, {}> | null | undefined, options?: FocusOptions) => void;
61
61
  count: (props?: Partial<{}> | undefined) => number;
@@ -75,15 +75,15 @@ declare const AccordionDescendantsContext: react1021.Context<{
75
75
  prevValue: (indexOrNode: number | HTMLButtonElement | Descendant<HTMLButtonElement, {}> | null, loop?: boolean, props?: Partial<{}> | undefined) => Descendant<HTMLButtonElement, {}> | undefined;
76
76
  register: (props?: {
77
77
  disabled?: boolean | ((node: HTMLButtonElement) => boolean) | undefined;
78
- } | undefined) => react1021.RefCallback<HTMLButtonElement>;
78
+ } | undefined) => react135.RefCallback<HTMLButtonElement>;
79
79
  unregister: (node?: HTMLButtonElement | null | undefined) => void;
80
80
  value: (indexOrNode: number | HTMLButtonElement | null) => Descendant<HTMLButtonElement, {}> | undefined;
81
81
  values: (props?: Partial<{}> | undefined) => Descendant<HTMLButtonElement, {}>[];
82
82
  };
83
83
  interface AccordionContext extends Omit<UseAccordionReturn, "descendants" | "getRootProps"> {}
84
- declare const AccordionContext: react1021.Context<AccordionContext>, useAccordionContext: () => AccordionContext;
84
+ declare const AccordionContext: react135.Context<AccordionContext>, useAccordionContext: () => AccordionContext;
85
85
  interface AccordionItemContext extends Omit<UseAccordionItemReturn, "getItemProps"> {}
86
- declare const AccordionItemContext: react1021.Context<AccordionItemContext>, useAccordionItemContext: () => AccordionItemContext;
86
+ declare const AccordionItemContext: react135.Context<AccordionItemContext>, useAccordionItemContext: () => AccordionItemContext;
87
87
  interface UseAccordionProps extends Omit<HTMLProps, "onChange"> {
88
88
  /**
89
89
  * The initial index(es) of the accordion item to expand.
@@ -137,7 +137,7 @@ declare const useAccordion: ({
137
137
  prevValue: (indexOrNode: number | HTMLButtonElement | Descendant<HTMLButtonElement, {}> | null, loop?: boolean, props?: Partial<{}> | undefined) => Descendant<HTMLButtonElement, {}> | undefined;
138
138
  register: (props?: {
139
139
  disabled?: boolean | ((node: HTMLButtonElement) => boolean) | undefined;
140
- } | undefined) => react1021.RefCallback<HTMLButtonElement>;
140
+ } | undefined) => react135.RefCallback<HTMLButtonElement>;
141
141
  unregister: (node?: HTMLButtonElement | null | undefined) => void;
142
142
  value: (indexOrNode: number | HTMLButtonElement | null) => Descendant<HTMLButtonElement, {}> | undefined;
143
143
  values: (props?: Partial<{}> | undefined) => Descendant<HTMLButtonElement, {}>[];
@@ -145,8 +145,8 @@ declare const useAccordion: ({
145
145
  focusedIndex: number;
146
146
  index: number | number[];
147
147
  multiple: boolean | undefined;
148
- setFocusedIndex: react1021.Dispatch<react1021.SetStateAction<number>>;
149
- setIndex: react1021.Dispatch<react1021.SetStateAction<number | number[]>>;
148
+ setFocusedIndex: react135.Dispatch<react135.SetStateAction<number>>;
149
+ setIndex: react135.Dispatch<react135.SetStateAction<number | number[]>>;
150
150
  toggle: boolean | undefined;
151
151
  getRootProps: PropGetter<"div", undefined, undefined>;
152
152
  };
@@ -7,7 +7,7 @@ import { UsePopupAnimationProps } from "../popover/popover.js";
7
7
  import "../popover/index.js";
8
8
  import { UseActionBarProps } from "./use-action-bar.js";
9
9
  import "../../index.js";
10
- import * as react1020 from "react";
10
+ import * as react30 from "react";
11
11
  import { PropsWithChildren, ReactNode } from "react";
12
12
 
13
13
  //#region src/components/action-bar/action-bar.d.ts
@@ -29,7 +29,7 @@ interface ActionBarRootProps extends Omit<HTMLStyledProps, "content">, ThemeProp
29
29
  */
30
30
  onCloseComplete?: () => void;
31
31
  }
32
- declare const ActionBarPropsContext: react1020.Context<Partial<ActionBarRootProps> | undefined>, useActionBarPropsContext: () => Partial<ActionBarRootProps> | undefined;
32
+ declare const ActionBarPropsContext: react30.Context<Partial<ActionBarRootProps> | undefined>, useActionBarPropsContext: () => Partial<ActionBarRootProps> | undefined;
33
33
  /**
34
34
  * `ActionBar` is a component that is used to display a bottom action bar with a set of actions.
35
35
  *
@@ -5,7 +5,7 @@ import { HTMLMotionProps } from "../motion/index.types.js";
5
5
  import "../motion/index.js";
6
6
  import { AiryStyle } from "./airy.style.js";
7
7
  import "../../index.js";
8
- import * as react92 from "react";
8
+ import * as react26 from "react";
9
9
  import { ReactNode } from "react";
10
10
 
11
11
  //#region src/components/airy/airy.d.ts
@@ -57,7 +57,7 @@ interface AiryProps extends Omit<HTMLMotionProps<"button">, "onChange">, ThemePr
57
57
  */
58
58
  onChange?: (value: KeyframeIdent) => void;
59
59
  }
60
- declare const AiryPropsContext: react92.Context<Partial<AiryProps> | undefined>, useAiryPropsContext: () => Partial<AiryProps> | undefined;
60
+ declare const AiryPropsContext: react26.Context<Partial<AiryProps> | undefined>, useAiryPropsContext: () => Partial<AiryProps> | undefined;
61
61
  /**
62
62
  * `Airy` is a component that creates an airy animation, switching between two elements when one is clicked.
63
63
  *
@@ -9,7 +9,7 @@ import "../loading/index.js";
9
9
  import { StatusScheme } from "../status/status.js";
10
10
  import "../status/index.js";
11
11
  import "../../index.js";
12
- import * as react91 from "react";
12
+ import * as react134 from "react";
13
13
 
14
14
  //#region src/components/alert/alert.d.ts
15
15
  interface AlertRootProps extends HTMLStyledProps, ThemeProps<AlertStyle> {
@@ -20,7 +20,7 @@ interface AlertRootProps extends HTMLStyledProps, ThemeProps<AlertStyle> {
20
20
  */
21
21
  status?: StatusScheme;
22
22
  }
23
- declare const AlertPropsContext: react91.Context<Partial<AlertRootProps> | undefined>, useAlertPropsContext: () => Partial<AlertRootProps> | undefined;
23
+ declare const AlertPropsContext: react134.Context<Partial<AlertRootProps> | undefined>, useAlertPropsContext: () => Partial<AlertRootProps> | undefined;
24
24
  /**
25
25
  * `Alert` is a component that conveys information to the user.
26
26
  *
@@ -5,7 +5,7 @@ import { AlphaSliderStyle } from "./alpha-slider.style.js";
5
5
  import { HueSliderOverlayProps, HueSliderRootProps, HueSliderThumbProps, HueSliderTrackProps } from "../hue-slider/hue-slider.js";
6
6
  import "../hue-slider/index.js";
7
7
  import "../../index.js";
8
- import * as react90 from "react";
8
+ import * as react133 from "react";
9
9
 
10
10
  //#region src/components/alpha-slider/alpha-slider.d.ts
11
11
  interface AlphaSliderRootProps extends WithoutThemeProps<Omit<HueSliderRootProps, "color" | "max" | "step" | "thumbProps" | "trackProps">, AlphaSliderStyle> {
@@ -38,7 +38,7 @@ interface AlphaSliderRootProps extends WithoutThemeProps<Omit<HueSliderRootProps
38
38
  */
39
39
  trackProps?: AlphaSliderTrackProps;
40
40
  }
41
- declare const AlphaSliderPropsContext: react90.Context<Partial<AlphaSliderRootProps> | undefined>, useAlphaSliderPropsContext: () => Partial<AlphaSliderRootProps> | undefined;
41
+ declare const AlphaSliderPropsContext: react133.Context<Partial<AlphaSliderRootProps> | undefined>, useAlphaSliderPropsContext: () => Partial<AlphaSliderRootProps> | undefined;
42
42
  /**
43
43
  * `AlphaSlider` is a component used to allow the user to select color transparency.
44
44
  *
@@ -2,7 +2,7 @@ import { StyleValue } from "../../core/css/index.types.js";
2
2
  import { Component, HTMLStyledProps } from "../../core/components/index.types.js";
3
3
  import "../../core/index.js";
4
4
  import "../../index.js";
5
- import * as react89 from "react";
5
+ import * as react132 from "react";
6
6
 
7
7
  //#region src/components/aspect-ratio/aspect-ratio.d.ts
8
8
  interface AspectRatioProps extends HTMLStyledProps {
@@ -13,7 +13,7 @@ interface AspectRatioProps extends HTMLStyledProps {
13
13
  */
14
14
  ratio?: StyleValue<number>;
15
15
  }
16
- declare const AspectRatioPropsContext: react89.Context<Partial<AspectRatioProps> | undefined>, useAspectRatioPropsContext: () => Partial<AspectRatioProps> | undefined;
16
+ declare const AspectRatioPropsContext: react132.Context<Partial<AspectRatioProps> | undefined>, useAspectRatioPropsContext: () => Partial<AspectRatioProps> | undefined;
17
17
  /**
18
18
  * `AspectRatio` is a component for embedding things like videos and maps while maintaining the aspect ratio.
19
19
  *
@@ -12,7 +12,7 @@ import { InputGroupRootProps } from "../input/input-group.js";
12
12
  import "../input/index.js";
13
13
  import { UseAutocompleteOptionProps, UseAutocompleteProps } from "./use-autocomplete.js";
14
14
  import "../../index.js";
15
- import * as react69 from "react";
15
+ import * as react126 from "react";
16
16
  import { ReactElement, ReactNode } from "react";
17
17
 
18
18
  //#region src/components/autocomplete/autocomplete.d.ts
@@ -68,7 +68,7 @@ interface AutocompleteRootProps<Multiple extends boolean = false> extends Omit<H
68
68
  */
69
69
  rootProps?: InputGroupRootProps;
70
70
  }
71
- declare const AutocompletePropsContext: react69.Context<Partial<AutocompleteRootProps<false>> | undefined>, useAutocompletePropsContext: () => Partial<AutocompleteRootProps<false>> | undefined;
71
+ declare const AutocompletePropsContext: react126.Context<Partial<AutocompleteRootProps<false>> | undefined>, useAutocompletePropsContext: () => Partial<AutocompleteRootProps<false>> | undefined;
72
72
  /**
73
73
  * `Autocomplete` is a component used to display suggestions in response to user text input.
74
74
  *
@@ -3,7 +3,7 @@ import { CSSPropObject, CSSSlotObject } from "../../core/css/index.types.js";
3
3
  import "../../index.js";
4
4
 
5
5
  //#region src/components/autocomplete/autocomplete.style.d.ts
6
- declare const autocompleteStyle: ComponentSlotStyle<"input" | "label" | "option" | "content" | "group" | "separator" | "icon" | "root" | "indicator" | "field" | "valueText" | "empty", CSSPropObject<CSSSlotObject<"input" | "label" | "option" | "content" | "group" | "separator" | "icon" | "root" | "indicator" | "field" | "valueText" | "empty">>, {
6
+ declare const autocompleteStyle: ComponentSlotStyle<"input" | "label" | "option" | "content" | "group" | "separator" | "icon" | "root" | "field" | "empty" | "indicator" | "valueText", CSSPropObject<CSSSlotObject<"input" | "label" | "option" | "content" | "group" | "separator" | "icon" | "root" | "field" | "empty" | "indicator" | "valueText">>, {
7
7
  xs: {
8
8
  empty: {
9
9
  gap: "1.5";
@@ -8,7 +8,7 @@ import "../field/index.js";
8
8
  import { Descendant, DescendantProps } from "../../hooks/use-descendants/index.js";
9
9
  import { ComboboxDescendant, ComboboxDescendantProps, ComboboxItem, ComboboxItemWithValue, UseComboboxItemProps, UseComboboxProps } from "../../hooks/use-combobox/index.js";
10
10
  import "../../index.js";
11
- import * as react70 from "react";
11
+ import * as react120 from "react";
12
12
  import { ChangeEvent, ReactNode } from "react";
13
13
 
14
14
  //#region src/components/autocomplete/use-autocomplete.d.ts
@@ -28,7 +28,7 @@ interface AutocompleteFilter {
28
28
  }
29
29
  type AutocompleteMatcher = typeof index_d_exports.match;
30
30
  interface AutocompleteContext extends Pick<UseAutocompleteReturn, "max" | "value"> {}
31
- declare const AutocompleteContext: react70.Context<AutocompleteContext>, useAutocompleteContext: () => AutocompleteContext;
31
+ declare const AutocompleteContext: react120.Context<AutocompleteContext>, useAutocompleteContext: () => AutocompleteContext;
32
32
  interface UseAutocompleteProps<Multiple extends boolean = false> extends Omit<HTMLProps, "defaultValue" | "onChange" | "ref" | "value">, Omit<UseComboboxProps, "defaultValue" | "initialFocusValue" | "onChange" | "ref" | "value">, HTMLRefAttributes<"input">, FieldProps {
33
33
  /**
34
34
  * If `true`, the autocomplete will allow custom value.
@@ -156,7 +156,7 @@ declare const useAutocomplete: <Multiple extends boolean = false>(props?: UseAut
156
156
  lastValue: (props?: Partial<ComboboxDescendantProps> | undefined) => Descendant<HTMLDivElement, ComboboxDescendantProps> | undefined;
157
157
  nextValue: (indexOrNode: number | HTMLDivElement | Descendant<HTMLDivElement, ComboboxDescendantProps> | null, loop?: boolean, props?: Partial<ComboboxDescendantProps> | undefined) => Descendant<HTMLDivElement, ComboboxDescendantProps> | undefined;
158
158
  prevValue: (indexOrNode: number | HTMLDivElement | Descendant<HTMLDivElement, ComboboxDescendantProps> | null, loop?: boolean, props?: Partial<ComboboxDescendantProps> | undefined) => Descendant<HTMLDivElement, ComboboxDescendantProps> | undefined;
159
- register: (props?: DescendantProps<HTMLDivElement, ComboboxDescendantProps> | undefined) => react70.RefCallback<HTMLDivElement>;
159
+ register: (props?: DescendantProps<HTMLDivElement, ComboboxDescendantProps> | undefined) => react120.RefCallback<HTMLDivElement>;
160
160
  unregister: (node?: HTMLDivElement | null | undefined) => void;
161
161
  value: (indexOrNode: number | HTMLDivElement | null) => Descendant<HTMLDivElement, ComboboxDescendantProps> | undefined;
162
162
  values: (props?: Partial<ComboboxDescendantProps> | undefined) => Descendant<HTMLDivElement, ComboboxDescendantProps>[];
@@ -166,8 +166,8 @@ declare const useAutocomplete: <Multiple extends boolean = false>(props?: UseAut
166
166
  items: ComboboxItem[];
167
167
  max: number | undefined;
168
168
  open: boolean;
169
- setInputValue: react70.Dispatch<react70.SetStateAction<string>>;
170
- setValue: react70.Dispatch<react70.SetStateAction<Multiple extends true ? string[] : string>>;
169
+ setInputValue: react120.Dispatch<react120.SetStateAction<string>>;
170
+ setValue: react120.Dispatch<react120.SetStateAction<Multiple extends true ? string[] : string>>;
171
171
  value: Multiple extends true ? string[] : string;
172
172
  valueMap: {
173
173
  [key: string]: ComboboxItemWithValue;
@@ -6,9 +6,9 @@ import "../../core/index.js";
6
6
  import { AvatarStyle } from "./avatar.style.js";
7
7
  import { UseAvatarProps } from "./use-avatar.js";
8
8
  import "../../index.js";
9
- import * as react66 from "react";
9
+ import * as react127 from "react";
10
10
  import { ReactElement } from "react";
11
- import * as _yamada_ui_utils2 from "@yamada-ui/utils";
11
+ import * as _yamada_ui_utils5 from "@yamada-ui/utils";
12
12
 
13
13
  //#region src/components/avatar/avatar.d.ts
14
14
  interface AvatarProps extends HTMLStyledProps, ThemeProps<AvatarStyle>, UseAvatarProps {
@@ -25,7 +25,7 @@ interface AvatarProps extends HTMLStyledProps, ThemeProps<AvatarStyle>, UseAvata
25
25
  */
26
26
  imageProps?: AvatarImageProps;
27
27
  }
28
- declare const component: <H extends "fragment" | As = "div", R extends _yamada_ui_utils2.Dict = _yamada_ui_utils2.Dict<any>>(el: H | react66.FC<R>, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"image" | "group" | "root" | "fallback", {
28
+ declare const component: <H extends "fragment" | As = "div", R extends _yamada_ui_utils5.Dict = _yamada_ui_utils5.Dict<any>>(el: H | react127.FC<R>, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"image" | "group" | "root" | "fallback", {
29
29
  shape: {
30
30
  circle: {
31
31
  root: {
@@ -148,7 +148,7 @@ declare const component: <H extends "fragment" | As = "div", R extends _yamada_u
148
148
  name,
149
149
  className,
150
150
  ...options
151
- }?: ComponentOptions) => (initialProps?: InitialProps<R>, ...superProps: SuperProps<R>[]) => H extends "fragment" ? react66.FunctionComponent<R> : Component<Exclude<H, "fragment">, R>, AvatarPropsContext: react66.Context<Partial<AvatarProps> | undefined>, useAvatarPropsContext: () => Partial<AvatarProps> | undefined, useRootComponentProps: <Y extends _yamada_ui_utils2.Dict = {}, R extends keyof Y = keyof Y>(props: Y, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"image" | "group" | "root" | "fallback", {
151
+ }?: ComponentOptions) => (initialProps?: InitialProps<R>, ...superProps: SuperProps<R>[]) => H extends "fragment" ? react127.FunctionComponent<R> : Component<Exclude<H, "fragment">, R>, AvatarPropsContext: react127.Context<Partial<AvatarProps> | undefined>, useAvatarPropsContext: () => Partial<AvatarProps> | undefined, useRootComponentProps: <Y extends _yamada_ui_utils5.Dict = {}, R extends keyof Y = keyof Y>(props: Y, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"image" | "group" | "root" | "fallback", {
152
152
  shape: {
153
153
  circle: {
154
154
  root: {
@@ -271,7 +271,7 @@ declare const component: <H extends "fragment" | As = "div", R extends _yamada_u
271
271
  className,
272
272
  withContext,
273
273
  transferProps
274
- }?: UseComponentPropsOptions<R>) => [CSSSlotObject, _yamada_ui_utils2.Merge<WithoutThemeProps<Y, ComponentSlotStyle<"image" | "group" | "root" | "fallback", {
274
+ }?: UseComponentPropsOptions<R>) => [CSSSlotObject, _yamada_ui_utils5.Merge<WithoutThemeProps<Y, ComponentSlotStyle<"image" | "group" | "root" | "fallback", {
275
275
  shape: {
276
276
  circle: {
277
277
  root: {
@@ -1,6 +1,6 @@
1
1
  import { HTMLProps, PropGetter } from "../../core/components/index.types.js";
2
2
  import "../../core/index.js";
3
- import * as react62 from "react";
3
+ import * as react130 from "react";
4
4
 
5
5
  //#region src/components/avatar/use-avatar-group.d.ts
6
6
  interface UseAvatarGroupProps extends HTMLProps {
@@ -19,7 +19,7 @@ declare const useAvatarGroup: ({
19
19
  reverse,
20
20
  ...rest
21
21
  }?: UseAvatarGroupProps) => {
22
- children: react62.ReactElement<any, string | react62.JSXElementConstructor<any>>[];
22
+ children: react130.ReactElement<any, string | react130.JSXElementConstructor<any>>[];
23
23
  excess: number;
24
24
  getRootProps: PropGetter<"div", undefined, undefined>;
25
25
  };
@@ -3,11 +3,11 @@ import { Component, HTMLStyledProps } from "../../core/components/index.types.js
3
3
  import "../../core/index.js";
4
4
  import { BadgeStyle } from "./badge.style.js";
5
5
  import "../../index.js";
6
- import * as react60 from "react";
6
+ import * as react119 from "react";
7
7
 
8
8
  //#region src/components/badge/badge.d.ts
9
9
  interface BadgeProps extends HTMLStyledProps<"span">, ThemeProps<BadgeStyle> {}
10
- declare const BadgePropsContext: react60.Context<Partial<BadgeProps> | undefined>, useBadgePropsContext: () => Partial<BadgeProps> | undefined;
10
+ declare const BadgePropsContext: react119.Context<Partial<BadgeProps> | undefined>, useBadgePropsContext: () => Partial<BadgeProps> | undefined;
11
11
  /**
12
12
  * `Badge` is a component that emphasizes the status of an item to make it immediately recognizable.
13
13
  *
@@ -2,7 +2,7 @@ import { CSSProps } from "../../core/css/index.types.js";
2
2
  import { Component, HTMLStyledProps } from "../../core/components/index.types.js";
3
3
  import "../../core/index.js";
4
4
  import "../../index.js";
5
- import * as react86 from "react";
5
+ import * as react118 from "react";
6
6
 
7
7
  //#region src/components/bleed/bleed.d.ts
8
8
  interface BleedProps extends HTMLStyledProps {
@@ -31,7 +31,7 @@ interface BleedProps extends HTMLStyledProps {
31
31
  */
32
32
  inlineStart?: "full" | CSSProps["marginInlineStart"];
33
33
  }
34
- declare const BleedPropsContext: react86.Context<Partial<BleedProps> | undefined>, useBleedPropsContext: () => Partial<BleedProps> | undefined;
34
+ declare const BleedPropsContext: react118.Context<Partial<BleedProps> | undefined>, useBleedPropsContext: () => Partial<BleedProps> | undefined;
35
35
  /**
36
36
  * `Bleed` is a component used to break an element from the boundaries of its container.
37
37
  *
@@ -3,7 +3,7 @@ import { Component, HTMLStyledProps } from "../../core/components/index.types.js
3
3
  import "../../core/index.js";
4
4
  import { BlockquoteStyle } from "./blockquote.style.js";
5
5
  import "../../index.js";
6
- import * as react77 from "react";
6
+ import * as react117 from "react";
7
7
  import { ReactNode } from "react";
8
8
 
9
9
  //#region src/components/blockquote/blockquote.d.ts
@@ -29,7 +29,7 @@ interface BlockquoteRootProps extends Omit<HTMLStyledProps<"figure">, "cite">, T
29
29
  */
30
30
  contentProps?: HTMLStyledProps<"blockquote">;
31
31
  }
32
- declare const BlockquotePropsContext: react77.Context<Partial<BlockquoteRootProps> | undefined>, useBlockquotePropsContext: () => Partial<BlockquoteRootProps> | undefined;
32
+ declare const BlockquotePropsContext: react117.Context<Partial<BlockquoteRootProps> | undefined>, useBlockquotePropsContext: () => Partial<BlockquoteRootProps> | undefined;
33
33
  /**
34
34
  * `Blockquote` is a component that represents a blockquote. By default, it renders a `blockquote` element.
35
35
  *
@@ -4,7 +4,7 @@ import "../../core/index.js";
4
4
  import { BreadcrumbStyle } from "./breadcrumb.style.js";
5
5
  import { UseBreadcrumbProps } from "./use-breadcrumb.js";
6
6
  import "../../index.js";
7
- import * as react76 from "react";
7
+ import * as react113 from "react";
8
8
  import { ReactElement } from "react";
9
9
 
10
10
  //#region src/components/breadcrumb/breadcrumb.d.ts
@@ -40,7 +40,7 @@ interface BreadcrumbRootProps extends HTMLStyledProps<"nav">, ThemeProps<Breadcr
40
40
  */
41
41
  separatorProps?: BreadcrumbSeparatorProps;
42
42
  }
43
- declare const BreadcrumbPropsContext: react76.Context<Partial<BreadcrumbRootProps> | undefined>, useBreadcrumbPropsContext: () => Partial<BreadcrumbRootProps> | undefined;
43
+ declare const BreadcrumbPropsContext: react113.Context<Partial<BreadcrumbRootProps> | undefined>, useBreadcrumbPropsContext: () => Partial<BreadcrumbRootProps> | undefined;
44
44
  /**
45
45
  * `Breadcrumb` is a component that helps users understand the hierarchy of a website.
46
46
  *
@@ -3,7 +3,7 @@ import { CSSPropObject, CSSSlotObject } from "../../core/css/index.types.js";
3
3
  import "../../index.js";
4
4
 
5
5
  //#region src/components/breadcrumb/breadcrumb.style.d.ts
6
- declare const breadcrumbStyle: ComponentSlotStyle<"link" | "list" | "separator" | "ellipsis" | "item" | "root", CSSPropObject<CSSSlotObject<"link" | "list" | "separator" | "ellipsis" | "item" | "root">>, {
6
+ declare const breadcrumbStyle: ComponentSlotStyle<"link" | "list" | "separator" | "ellipsis" | "root" | "item", CSSPropObject<CSSSlotObject<"link" | "list" | "separator" | "ellipsis" | "root" | "item">>, {
7
7
  sm: {
8
8
  list: {
9
9
  fontSize: "sm";
@@ -1,7 +1,7 @@
1
1
  import { ReactNodeOrFunction } from "../../utils/index.types.js";
2
2
  import { HTMLProps, PropGetter } from "../../core/components/index.types.js";
3
3
  import "../../core/index.js";
4
- import * as react54 from "react";
4
+ import * as react114 from "react";
5
5
  import { ReactElement, ReactNode } from "react";
6
6
 
7
7
  //#region src/components/breadcrumb/use-breadcrumb.d.ts
@@ -46,7 +46,7 @@ declare const useBreadcrumb: ({
46
46
  startBoundaries,
47
47
  ...rest
48
48
  }?: UseBreadcrumbProps) => {
49
- children: (string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react54.ReactPortal | ReactElement<unknown, string | react54.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | ReactElement<any, string | react54.JSXElementConstructor<any>> | null | undefined)[];
49
+ children: (string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react114.ReactPortal | ReactElement<unknown, string | react114.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | ReactElement<any, string | react114.JSXElementConstructor<any>> | null | undefined)[];
50
50
  getEllipsisProps: PropGetter<"svg", undefined, undefined>;
51
51
  getLinkProps: PropGetter<"a", {
52
52
  currentPage?: boolean;