@yamada-ui/react 2.2.3-dev-20260622141401 → 2.2.3-dev-20260624122859

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 (197) hide show
  1. package/dist/cjs/components/accordion/use-accordion.cjs.map +1 -1
  2. package/dist/cjs/components/autocomplete/use-autocomplete.cjs.map +1 -1
  3. package/dist/cjs/components/calendar/use-calendar.cjs +1 -1
  4. package/dist/cjs/components/calendar/use-calendar.cjs.map +1 -1
  5. package/dist/cjs/components/carousel/carousel.cjs.map +1 -1
  6. package/dist/cjs/components/chart/chart.cjs.map +1 -1
  7. package/dist/cjs/components/chart/use-polar-chart.cjs.map +1 -1
  8. package/dist/cjs/components/checkbox/checkbox.cjs.map +1 -1
  9. package/dist/cjs/components/checkbox/use-checkbox-group.cjs.map +1 -1
  10. package/dist/cjs/components/checkbox-card/checkbox-card.cjs.map +1 -1
  11. package/dist/cjs/components/collapse/collapse.cjs.map +1 -1
  12. package/dist/cjs/components/color-picker/use-color-picker.cjs.map +1 -1
  13. package/dist/cjs/components/color-swatch/color-swatch-group.cjs.map +1 -1
  14. package/dist/cjs/components/date-picker/date-picker.cjs.map +1 -1
  15. package/dist/cjs/components/date-picker/use-date-picker.cjs +1 -1
  16. package/dist/cjs/components/date-picker/use-date-picker.cjs.map +1 -1
  17. package/dist/cjs/components/editable/use-editable.cjs.map +1 -1
  18. package/dist/cjs/components/field/field.cjs.map +1 -1
  19. package/dist/cjs/components/file-input/file-input.cjs.map +1 -1
  20. package/dist/cjs/components/flip/flip.cjs.map +1 -1
  21. package/dist/cjs/components/highlight/highlight.cjs.map +1 -1
  22. package/dist/cjs/components/indicator/indicator.cjs.map +1 -1
  23. package/dist/cjs/components/infinite-scroll-area/use-infinite-scroll.cjs.map +1 -1
  24. package/dist/cjs/components/input/input-group.cjs.map +1 -1
  25. package/dist/cjs/components/list/list.cjs.map +1 -1
  26. package/dist/cjs/components/menu/use-menu.cjs.map +1 -1
  27. package/dist/cjs/components/native-select/use-native-select.cjs.map +1 -1
  28. package/dist/cjs/components/native-table/native-table.cjs.map +1 -1
  29. package/dist/cjs/components/notice/notice.cjs.map +1 -1
  30. package/dist/cjs/components/number-input/use-number-input.cjs.map +1 -1
  31. package/dist/cjs/components/pagination/pagination.cjs.map +1 -1
  32. package/dist/cjs/components/pagination/use-pagination.cjs.map +1 -1
  33. package/dist/cjs/components/picture/picture.cjs.map +1 -1
  34. package/dist/cjs/components/pin-input/pin-input.cjs.map +1 -1
  35. package/dist/cjs/components/pin-input/use-pin-input.cjs.map +1 -1
  36. package/dist/cjs/components/qr-code/use-qr-code.cjs.map +1 -1
  37. package/dist/cjs/components/radio/use-radio-group.cjs.map +1 -1
  38. package/dist/cjs/components/segmented-control/segmented-control.cjs.map +1 -1
  39. package/dist/cjs/components/select/use-select.cjs.map +1 -1
  40. package/dist/cjs/components/show/show.cjs.map +1 -1
  41. package/dist/cjs/components/sidebar/sidebar.cjs.map +1 -1
  42. package/dist/cjs/components/sidebar/use-sidebar.cjs.map +1 -1
  43. package/dist/cjs/components/simple-grid/simple-grid.cjs.map +1 -1
  44. package/dist/cjs/components/stack/z-stack.cjs.map +1 -1
  45. package/dist/cjs/components/steps/steps.cjs.map +1 -1
  46. package/dist/cjs/components/steps/use-steps.cjs.map +1 -1
  47. package/dist/cjs/components/table/table.cjs.map +1 -1
  48. package/dist/cjs/components/tabs/tabs.cjs.map +1 -1
  49. package/dist/cjs/components/toggle/use-toggle-group.cjs.map +1 -1
  50. package/dist/cjs/components/toggle/use-toggle.cjs.map +1 -1
  51. package/dist/cjs/components/tree/tree.cjs.map +1 -1
  52. package/dist/cjs/components/tree/use-tree.cjs.map +1 -1
  53. package/dist/cjs/core/components/create-component.cjs.map +1 -1
  54. package/dist/cjs/core/components/props.cjs.map +1 -1
  55. package/dist/cjs/core/components/use-component-style.cjs.map +1 -1
  56. package/dist/cjs/core/css/animation.cjs.map +1 -1
  57. package/dist/cjs/core/css/at-rule.cjs.map +1 -1
  58. package/dist/cjs/core/css/calc.cjs.map +1 -1
  59. package/dist/cjs/core/css/color-mix.cjs.map +1 -1
  60. package/dist/cjs/core/css/config.cjs.map +1 -1
  61. package/dist/cjs/core/css/css.cjs.map +1 -1
  62. package/dist/cjs/core/css/gradient.cjs.map +1 -1
  63. package/dist/cjs/core/css/grid.cjs.map +1 -1
  64. package/dist/cjs/core/css/transition.cjs.map +1 -1
  65. package/dist/cjs/core/css/utils.cjs.map +1 -1
  66. package/dist/cjs/core/system/breakpoint.cjs.map +1 -1
  67. package/dist/cjs/core/system/color-mode-provider.cjs.map +1 -1
  68. package/dist/cjs/core/system/create-system.cjs.map +1 -1
  69. package/dist/cjs/core/system/environment-provider.cjs.map +1 -1
  70. package/dist/cjs/core/system/storage-manager.cjs.map +1 -1
  71. package/dist/cjs/core/system/storage-script.cjs.map +1 -1
  72. package/dist/cjs/core/system/use-system-color-mode.cjs.map +1 -1
  73. package/dist/cjs/core/system/var.cjs.map +1 -1
  74. package/dist/cjs/hooks/use-animation/index.cjs.map +1 -1
  75. package/dist/cjs/hooks/use-breakpoint/use-breakpoint-value.cjs.map +1 -1
  76. package/dist/cjs/hooks/use-breakpoint/use-breakpoint.cjs.map +1 -1
  77. package/dist/cjs/hooks/use-clickable/index.cjs.map +1 -1
  78. package/dist/cjs/hooks/use-clipboard/index.cjs.map +1 -1
  79. package/dist/cjs/hooks/use-controllable-state/index.cjs.map +1 -1
  80. package/dist/cjs/hooks/use-counter/index.cjs.map +1 -1
  81. package/dist/cjs/hooks/use-descendants/index.cjs.map +1 -1
  82. package/dist/cjs/hooks/use-focus/index.cjs.map +1 -1
  83. package/dist/cjs/hooks/use-local-storage/index.cjs.map +1 -1
  84. package/dist/cjs/hooks/use-mounted/index.cjs.map +1 -1
  85. package/dist/cjs/hooks/use-outside-click/index.cjs.map +1 -1
  86. package/dist/cjs/providers/i18n-provider/i18n-provider.cjs.map +1 -1
  87. package/dist/cjs/utils/children.cjs.map +1 -1
  88. package/dist/cjs/utils/dom.cjs.map +1 -1
  89. package/dist/cjs/utils/store.cjs.map +1 -1
  90. package/dist/esm/components/accordion/use-accordion.js.map +1 -1
  91. package/dist/esm/components/autocomplete/use-autocomplete.js.map +1 -1
  92. package/dist/esm/components/calendar/use-calendar.js +1 -1
  93. package/dist/esm/components/calendar/use-calendar.js.map +1 -1
  94. package/dist/esm/components/carousel/carousel.js.map +1 -1
  95. package/dist/esm/components/chart/chart.js.map +1 -1
  96. package/dist/esm/components/chart/use-polar-chart.js.map +1 -1
  97. package/dist/esm/components/checkbox/checkbox.js.map +1 -1
  98. package/dist/esm/components/checkbox/use-checkbox-group.js.map +1 -1
  99. package/dist/esm/components/checkbox-card/checkbox-card.js.map +1 -1
  100. package/dist/esm/components/collapse/collapse.js.map +1 -1
  101. package/dist/esm/components/color-picker/use-color-picker.js.map +1 -1
  102. package/dist/esm/components/color-swatch/color-swatch-group.js.map +1 -1
  103. package/dist/esm/components/date-picker/date-picker.js.map +1 -1
  104. package/dist/esm/components/date-picker/use-date-picker.js +1 -1
  105. package/dist/esm/components/date-picker/use-date-picker.js.map +1 -1
  106. package/dist/esm/components/editable/use-editable.js.map +1 -1
  107. package/dist/esm/components/field/field.js.map +1 -1
  108. package/dist/esm/components/file-input/file-input.js.map +1 -1
  109. package/dist/esm/components/flip/flip.js.map +1 -1
  110. package/dist/esm/components/highlight/highlight.js.map +1 -1
  111. package/dist/esm/components/indicator/indicator.js.map +1 -1
  112. package/dist/esm/components/infinite-scroll-area/use-infinite-scroll.js.map +1 -1
  113. package/dist/esm/components/input/input-group.js.map +1 -1
  114. package/dist/esm/components/list/list.js.map +1 -1
  115. package/dist/esm/components/menu/use-menu.js.map +1 -1
  116. package/dist/esm/components/native-select/use-native-select.js.map +1 -1
  117. package/dist/esm/components/native-table/native-table.js.map +1 -1
  118. package/dist/esm/components/notice/notice.js.map +1 -1
  119. package/dist/esm/components/number-input/use-number-input.js.map +1 -1
  120. package/dist/esm/components/pagination/pagination.js.map +1 -1
  121. package/dist/esm/components/pagination/use-pagination.js.map +1 -1
  122. package/dist/esm/components/picture/picture.js.map +1 -1
  123. package/dist/esm/components/pin-input/pin-input.js.map +1 -1
  124. package/dist/esm/components/pin-input/use-pin-input.js.map +1 -1
  125. package/dist/esm/components/qr-code/use-qr-code.js.map +1 -1
  126. package/dist/esm/components/radio/use-radio-group.js.map +1 -1
  127. package/dist/esm/components/segmented-control/segmented-control.js.map +1 -1
  128. package/dist/esm/components/select/use-select.js.map +1 -1
  129. package/dist/esm/components/show/show.js.map +1 -1
  130. package/dist/esm/components/sidebar/sidebar.js.map +1 -1
  131. package/dist/esm/components/sidebar/use-sidebar.js.map +1 -1
  132. package/dist/esm/components/simple-grid/simple-grid.js.map +1 -1
  133. package/dist/esm/components/stack/z-stack.js.map +1 -1
  134. package/dist/esm/components/steps/steps.js.map +1 -1
  135. package/dist/esm/components/steps/use-steps.js.map +1 -1
  136. package/dist/esm/components/table/table.js.map +1 -1
  137. package/dist/esm/components/tabs/tabs.js.map +1 -1
  138. package/dist/esm/components/toggle/use-toggle-group.js.map +1 -1
  139. package/dist/esm/components/toggle/use-toggle.js.map +1 -1
  140. package/dist/esm/components/tree/tree.js.map +1 -1
  141. package/dist/esm/components/tree/use-tree.js.map +1 -1
  142. package/dist/esm/core/components/create-component.js.map +1 -1
  143. package/dist/esm/core/components/props.js.map +1 -1
  144. package/dist/esm/core/components/use-component-style.js.map +1 -1
  145. package/dist/esm/core/css/animation.js.map +1 -1
  146. package/dist/esm/core/css/at-rule.js.map +1 -1
  147. package/dist/esm/core/css/calc.js.map +1 -1
  148. package/dist/esm/core/css/color-mix.js.map +1 -1
  149. package/dist/esm/core/css/config.js.map +1 -1
  150. package/dist/esm/core/css/css.js.map +1 -1
  151. package/dist/esm/core/css/gradient.js.map +1 -1
  152. package/dist/esm/core/css/grid.js.map +1 -1
  153. package/dist/esm/core/css/transition.js.map +1 -1
  154. package/dist/esm/core/css/utils.js.map +1 -1
  155. package/dist/esm/core/system/breakpoint.js.map +1 -1
  156. package/dist/esm/core/system/color-mode-provider.js.map +1 -1
  157. package/dist/esm/core/system/create-system.js.map +1 -1
  158. package/dist/esm/core/system/environment-provider.js.map +1 -1
  159. package/dist/esm/core/system/storage-manager.js.map +1 -1
  160. package/dist/esm/core/system/storage-script.js.map +1 -1
  161. package/dist/esm/core/system/use-system-color-mode.js.map +1 -1
  162. package/dist/esm/core/system/var.js.map +1 -1
  163. package/dist/esm/hooks/use-animation/index.js.map +1 -1
  164. package/dist/esm/hooks/use-breakpoint/use-breakpoint-value.js.map +1 -1
  165. package/dist/esm/hooks/use-breakpoint/use-breakpoint.js.map +1 -1
  166. package/dist/esm/hooks/use-clickable/index.js.map +1 -1
  167. package/dist/esm/hooks/use-clipboard/index.js.map +1 -1
  168. package/dist/esm/hooks/use-controllable-state/index.js.map +1 -1
  169. package/dist/esm/hooks/use-counter/index.js.map +1 -1
  170. package/dist/esm/hooks/use-descendants/index.js.map +1 -1
  171. package/dist/esm/hooks/use-focus/index.js.map +1 -1
  172. package/dist/esm/hooks/use-local-storage/index.js.map +1 -1
  173. package/dist/esm/hooks/use-mounted/index.js.map +1 -1
  174. package/dist/esm/hooks/use-outside-click/index.js.map +1 -1
  175. package/dist/esm/providers/i18n-provider/i18n-provider.js.map +1 -1
  176. package/dist/esm/utils/children.js.map +1 -1
  177. package/dist/esm/utils/dom.js.map +1 -1
  178. package/dist/esm/utils/store.js.map +1 -1
  179. package/dist/types/components/autocomplete/autocomplete.style.d.ts +1 -1
  180. package/dist/types/components/breadcrumb/breadcrumb.style.d.ts +1 -1
  181. package/dist/types/components/calendar/calendar.style.d.ts +2 -2
  182. package/dist/types/components/carousel/carousel.style.d.ts +2 -2
  183. package/dist/types/components/date-picker/date-picker.style.d.ts +1 -1
  184. package/dist/types/components/field/use-field-props.d.ts +1 -1
  185. package/dist/types/components/file-button/use-file-button.d.ts +2 -2
  186. package/dist/types/components/file-input/use-file-input.d.ts +2 -2
  187. package/dist/types/components/menu/menu.style.d.ts +2 -2
  188. package/dist/types/components/progress/use-progress.d.ts +6 -6
  189. package/dist/types/components/rating/rating.style.d.ts +2 -2
  190. package/dist/types/components/select/select.style.d.ts +1 -1
  191. package/dist/types/components/steps/steps.style.d.ts +1 -1
  192. package/dist/types/components/tabs/tabs.style.d.ts +1 -1
  193. package/dist/types/components/tree/tree.style.d.ts +1 -1
  194. package/dist/types/components/tree/use-tree.d.ts +2 -2
  195. package/dist/types/hooks/use-clickable/index.d.ts +2 -2
  196. package/dist/types/providers/i18n-provider/i18n-provider.d.ts +1 -1
  197. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"sidebar.cjs","names":["createContext","createSlotComponent","sidebarStyle","useBreakpointValue","useValue","useSidebar","SidebarDescendantsContext","SidebarContext","styled","useSidebarContext","useSplitChildren","mergeProps","useSidebarGroup","useIncludesChildren","useValidChildren","useLoadingComponent","useSidebarItem","SidebarItemContext","Tooltip","Collapse","ChevronRightIcon","Children"],"sources":["../../../../src/components/sidebar/sidebar.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, PropsWithChildren, ReactNode } from \"react\"\nimport type {\n Breakpoint,\n ExtractStyleValue,\n HTMLProps,\n HTMLStyledProps,\n ThemeProps,\n} from \"../../core\"\nimport type { ReactNodeOrFunction } from \"../../utils\"\nimport type { CollapseProps } from \"../collapse\"\nimport type { Loading } from \"../loading\"\nimport type { WithTransitionProps } from \"../motion\"\nimport type {\n UseSidebarGroupProps,\n UseSidebarGroupReturn,\n UseSidebarItemProps,\n UseSidebarItemReturn,\n UseSidebarProps,\n UseSidebarReturn,\n} from \"./use-sidebar\"\nimport {\n Children,\n cloneElement,\n isValidElement,\n useCallback,\n useMemo,\n} from \"react\"\nimport { createSlotComponent, mergeProps, styled } from \"../../core\"\nimport { useBreakpointValue } from \"../../hooks/use-breakpoint\"\nimport { useValue } from \"../../hooks/use-value\"\nimport {\n cast,\n createContext,\n dataAttr,\n isObject,\n isString,\n runIfFn,\n useIncludesChildren,\n useSplitChildren,\n useValidChildren,\n} from \"../../utils\"\nimport { Collapse } from \"../collapse\"\nimport { Drawer } from \"../drawer\"\nimport { ChevronRightIcon } from \"../icon\"\nimport { useLoadingComponent } from \"../loading\"\nimport { Tooltip, type TooltipProps } from \"../tooltip\"\nimport { sidebarStyle, type SidebarStyle } from \"./sidebar.style\"\nimport {\n SidebarContext,\n SidebarDescendantsContext,\n SidebarItemContext,\n useSidebar,\n useSidebarContext,\n useSidebarGroup,\n useSidebarItem,\n} from \"./use-sidebar\"\n\ninterface SidebarItemCallBackProps {\n disabled?: boolean\n expanded?: boolean\n}\n\ntype SidebarItemReactNode =\n | ReactNodeOrFunction<SidebarItemCallBackProps>\n | {\n group: ReactNodeOrFunction<SidebarItemCallBackProps>\n item?: ReactNodeOrFunction<SidebarItemCallBackProps>\n }\n | {\n item: ReactNodeOrFunction<SidebarItemCallBackProps>\n group?: ReactNodeOrFunction<SidebarItemCallBackProps>\n }\n\ninterface SidebarItemSharedRenderProps\n extends\n Pick<SidebarItemProps, \"label\">,\n Pick<\n UseSidebarItemReturn,\n | \"expanded\"\n | \"expandedValue\"\n | \"onExpandedChange\"\n | \"onSelectedChange\"\n | \"selected\"\n | \"selectedValue\"\n | \"value\"\n > {\n itemProps: HTMLStyledProps<\"li\">\n linkProps: HTMLStyledProps<\"a\">\n triggerProps: HTMLStyledProps<\"button\">\n endElement?: ReactNode\n startElement?: ReactNode\n}\n\ninterface SidebarItemRenderProps\n extends\n PropsWithChildren,\n Omit<SidebarItemSharedRenderProps, \"endElement\" | \"startElement\">,\n Pick<\n UseSidebarItemReturn,\n | \"group\"\n | \"groupLoading\"\n | \"groupOpen\"\n | \"onGroupClose\"\n | \"onGroupOpen\"\n | \"onGroupToggle\"\n > {\n endElement: { group?: ReactNode; item?: ReactNode }\n startElement: { group?: ReactNode; item?: ReactNode }\n indicator?: ReactNode\n link?: ReactNode\n trigger?: ReactNode\n}\n\ninterface SidebarItemLinkRenderProps extends Omit<\n SidebarItemSharedRenderProps,\n \"itemProps\" | \"triggerProps\"\n> {}\n\ninterface SidebarItemTriggerRenderProps\n extends\n Omit<SidebarItemSharedRenderProps, \"itemProps\" | \"linkProps\">,\n Pick<\n UseSidebarItemReturn,\n | \"groupLoading\"\n | \"groupOpen\"\n | \"onGroupClose\"\n | \"onGroupOpen\"\n | \"onGroupToggle\"\n > {\n indicator?: ReactNode\n}\n\ninterface SidebarItemRender {\n item?: ReactNodeOrFunction<SidebarItemRenderProps>\n link?: ReactNodeOrFunction<SidebarItemLinkRenderProps>\n trigger?: ReactNodeOrFunction<SidebarItemTriggerRenderProps>\n}\n\ninterface SidebarGroup extends Omit<SidebarGroupProps, \"children\" | \"value\"> {\n children: SidebarItemWithValue[]\n group: true\n}\n\nexport interface SidebarItemWithValue extends Omit<\n SidebarItemProps,\n \"children\"\n> {\n children?: SidebarItemWithValue[]\n}\n\nexport type SidebarItem = SidebarGroup | SidebarItemWithValue\n\nconst createKey = (props: SidebarItem, index: number) => {\n return \"value\" in props ? props.value || index : index\n}\n\nconst getReactNodeOrFunction = (\n type: \"group\" | \"item\",\n custom?: SidebarItemReactNode,\n root?: SidebarItemReactNode,\n): ReactNodeOrFunction<SidebarItemCallBackProps> => {\n if (isObject(custom) && (\"group\" in custom || \"item\" in custom)) {\n return custom[type]\n } else if (custom) {\n return custom\n } else if (isObject(root) && (\"group\" in root || \"item\" in root)) {\n return root[type]\n } else {\n return root\n }\n}\n\ninterface ComponentContext extends Pick<\n UseSidebarReturn,\n | \"getContentProps\"\n | \"getFooterProps\"\n | \"getHeaderProps\"\n | \"getSidePanelProps\"\n | \"getTriggerProps\"\n> {\n breakpoint: ExtractStyleValue<NonNullable<SidebarRootProps[\"breakpoint\"]>>\n mode: ExtractStyleValue<NonNullable<SidebarRootProps[\"mode\"]>>\n placement: ExtractStyleValue<NonNullable<SidebarRootProps[\"placement\"]>>\n}\n\ninterface GroupComponentContext\n extends\n Pick<SidebarGroupProps, \"contentProps\" | \"labelProps\">,\n Pick<UseSidebarGroupReturn, \"getContentProps\" | \"getLabelProps\"> {}\n\nconst [GroupComponentContext, useGroupComponentContext] =\n createContext<GroupComponentContext>({ name: \"GroupComponentContext\" })\n\ninterface ItemComponentContext {\n contentProps: SidebarItemContentProps\n endElementProps: SidebarItemEndElementProps\n indicatorProps: SidebarItemIndicatorProps\n labelProps: SidebarItemLabelProps\n startElementProps: SidebarItemStartElementProps\n tooltipProps: SidebarItemTooltipProps\n}\n\nconst [ItemComponentContext, useItemComponentContext] =\n createContext<ItemComponentContext>({ name: \"ItemComponentContext\" })\n\ninterface SidePanelComponentContext extends Pick<\n SidebarSidePanelProps,\n | \"animated\"\n | \"contentProps\"\n | \"endElement\"\n | \"endElementProps\"\n | \"footerProps\"\n | \"groupContentProps\"\n | \"groupProps\"\n | \"handleProps\"\n | \"headerProps\"\n | \"indicator\"\n | \"indicatorHidden\"\n | \"indicatorProps\"\n | \"itemContentProps\"\n | \"itemProps\"\n | \"items\"\n | \"labelProps\"\n | \"linkProps\"\n | \"loadingScheme\"\n | \"menuProps\"\n | \"render\"\n | \"startElement\"\n | \"startElementProps\"\n | \"tooltipProps\"\n | \"triggerProps\"\n> {}\n\nconst [SidePanelComponentContext, useSidePanelComponentContext] =\n createContext<SidePanelComponentContext>({\n name: \"SidePanelComponentContext\",\n })\n\nexport interface SidebarRootProps\n extends\n HTMLStyledProps<\"div\">,\n ThemeProps<SidebarStyle>,\n Omit<UseSidebarProps, \"mobile\"> {\n /**\n * The breakpoint to use for the sidebar. If `false`, the sidebar will be always visible.\n *\n * @default 'md'\n */\n breakpoint?: Exclude<Breakpoint, \"base\"> | false\n}\n\nconst {\n ComponentContext,\n PropsContext: SidebarPropsContext,\n useComponentContext,\n usePropsContext: useSidebarPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<SidebarRootProps, SidebarStyle, ComponentContext>(\n \"sidebar\",\n sidebarStyle,\n)\n\nexport { SidebarPropsContext, useSidebarPropsContext }\n\n/**\n * `Sidebar` is a component that is used to display a list of items in a sidebar.\n *\n * @see https://yamada-ui.com/docs/components/sidebar\n */\nexport const SidebarRoot = withProvider<\n \"div\",\n SidebarRootProps,\n \"mode\" | \"placement\"\n>(\n ({\n breakpoint = \"md\",\n mode: modeProp = \"offcanvas\",\n placement: placementProp = \"start\",\n ...rest\n }) => {\n const mobile =\n useBreakpointValue<boolean | undefined>(\n breakpoint ? { [breakpoint]: true } : { base: false },\n ) ?? false\n const mode = useValue(modeProp)\n const placement = useValue(placementProp)\n const {\n descendants,\n expandedValue,\n open,\n selectedValue,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getRootProps,\n getSidePanelProps,\n getTriggerProps,\n onClose,\n onExpandedChange,\n onOpen,\n onSelectedChange,\n onToggle,\n } = useSidebar({ mobile, ...rest })\n const context = useMemo(\n () => ({\n expandedValue,\n mobile,\n open,\n selectedValue,\n onClose,\n onExpandedChange,\n onOpen,\n onSelectedChange,\n onToggle,\n }),\n [\n mobile,\n expandedValue,\n open,\n selectedValue,\n onClose,\n onExpandedChange,\n onOpen,\n onSelectedChange,\n onToggle,\n ],\n )\n const componentContext = useMemo(\n () => ({\n breakpoint,\n mode,\n placement,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getSidePanelProps,\n getTriggerProps,\n }),\n [\n breakpoint,\n mode,\n placement,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getSidePanelProps,\n getTriggerProps,\n ],\n )\n\n return (\n <SidebarDescendantsContext value={descendants}>\n <SidebarContext value={context}>\n <ComponentContext value={componentContext}>\n <styled.div data-group {...getRootProps()} />\n </ComponentContext>\n </SidebarContext>\n </SidebarDescendantsContext>\n )\n },\n \"root\",\n { transferProps: [\"mode\", \"placement\"] },\n)()\n\nexport interface SidebarMainPanelProps extends HTMLStyledProps {}\n\nexport const SidebarMainPanel = withContext<\"div\", SidebarMainPanelProps>(\n \"div\",\n \"mainPanel\",\n)()\n\nexport interface SidebarTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const SidebarTrigger = withContext<\"button\", SidebarTriggerProps>(\n \"button\",\n \"trigger\",\n)(undefined, (props) => {\n const { getTriggerProps } = useComponentContext()\n\n return { asChild: true, ...getTriggerProps(props) }\n})\n\nexport interface SidebarSidePanelProps\n extends\n Omit<HTMLStyledProps<\"aside\">, \"content\">,\n Pick<SidebarContentProps, \"items\">,\n Pick<\n SidebarItemProps,\n | \"animated\"\n | \"endElement\"\n | \"endElementProps\"\n | \"indicator\"\n | \"indicatorProps\"\n | \"labelProps\"\n | \"linkProps\"\n | \"loadingScheme\"\n | \"render\"\n | \"startElement\"\n | \"startElementProps\"\n | \"tooltipProps\"\n | \"triggerProps\"\n > {\n /**\n * The content of the sidebar.\n */\n content?: ReactNode\n /**\n * The footer of the sidebar.\n */\n footer?: ReactNode\n /**\n * The header of the sidebar.\n */\n header?: ReactNode\n /**\n * If `true`, hide the tree indicator icon for all items.\n *\n * @default false\n */\n indicatorHidden?: boolean\n /**\n * If `true`, the sidebar will be rendered with a handle.\n *\n * @default true\n */\n withHandle?: boolean\n /**\n * Props for the content component.\n */\n contentProps?: SidebarContentProps\n /**\n * Props for the drawer component.\n */\n drawerProps?: Omit<\n Drawer.RootProps,\n | \"body\"\n | \"cancel\"\n | \"children\"\n | \"footer\"\n | \"header\"\n | \"middle\"\n | \"onCancel\"\n | \"onClose\"\n | \"onMiddle\"\n | \"onOpen\"\n | \"onSuccess\"\n | \"open\"\n | \"success\"\n | \"title\"\n | \"trigger\"\n >\n /**\n * Props for the footer component.\n */\n footerProps?: SidebarFooterProps\n /**\n * Props for the group content component.\n */\n groupContentProps?: Omit<SidebarGroupContentProps, \"children\">\n /**\n * Props for the group component.\n */\n groupProps?: Omit<SidebarGroupProps, \"children\" | \"label\" | \"value\">\n /**\n * Props for the handle component.\n */\n handleProps?: SidebarHandleProps\n /**\n * Props for the header component.\n */\n headerProps?: SidebarHeaderProps\n /**\n * Props for the item content component.\n */\n itemContentProps?: SidebarItemContentProps\n /**\n * Props for the item component.\n */\n itemProps?: Omit<\n SidebarItemProps,\n \"children\" | \"items\" | \"label\" | \"open\" | \"value\"\n >\n /**\n * Props for the menu component.\n *\n * @default 'md'\n */\n menuProps?: SidebarMenuProps\n}\n\nexport const SidebarSidePanel = withContext<\"aside\", SidebarSidePanelProps>(\n ({\n animated = true,\n children,\n content,\n endElement,\n footer,\n header,\n indicator,\n indicatorHidden,\n items,\n loadingScheme,\n render,\n startElement,\n withHandle = true,\n contentProps,\n drawerProps,\n endElementProps,\n footerProps,\n groupContentProps,\n groupProps,\n handleProps,\n headerProps,\n indicatorProps,\n itemContentProps,\n itemProps,\n labelProps,\n linkProps,\n menuProps,\n startElementProps,\n tooltipProps,\n triggerProps,\n ...rest\n }) => {\n const { mobile, open, onClose } = useSidebarContext()\n const { breakpoint, placement, getSidePanelProps } = useComponentContext()\n const [\n omittedChildren,\n customHeader,\n customContent,\n customFooter,\n customHandle,\n ] = useSplitChildren(\n children,\n SidebarHeader,\n SidebarContent,\n SidebarFooter,\n SidebarHandle,\n )\n const context = useMemo(\n () => ({\n animated,\n endElement,\n indicator,\n indicatorHidden,\n items,\n loadingScheme,\n render,\n startElement,\n contentProps,\n endElementProps,\n footerProps,\n groupContentProps,\n groupProps,\n handleProps,\n headerProps,\n indicatorProps,\n itemContentProps,\n itemProps,\n labelProps,\n linkProps,\n menuProps,\n startElementProps,\n tooltipProps,\n triggerProps,\n }),\n [\n animated,\n endElement,\n indicator,\n indicatorHidden,\n items,\n render,\n loadingScheme,\n startElement,\n contentProps,\n endElementProps,\n footerProps,\n groupContentProps,\n groupProps,\n handleProps,\n headerProps,\n indicatorProps,\n itemContentProps,\n itemProps,\n labelProps,\n linkProps,\n menuProps,\n startElementProps,\n tooltipProps,\n triggerProps,\n ],\n )\n\n return (\n <SidePanelComponentContext value={context}>\n {mobile ? (\n <Drawer.Root\n size=\"sm\"\n autoFocus={false}\n duration={!animated ? 0 : undefined}\n open={open}\n placement={`inline-${placement}`}\n withCloseButton={false}\n portalProps={{ disabled: true }}\n onClose={onClose}\n {...drawerProps}\n >\n <Drawer.Content>\n {customHeader ??\n (header ? <SidebarHeader>{header}</SidebarHeader> : null)}\n\n {customContent ??\n (content || items ? (\n <SidebarContent>{content}</SidebarContent>\n ) : null)}\n\n {customFooter ??\n (footer ? <SidebarFooter>{footer}</SidebarFooter> : null)}\n </Drawer.Content>\n </Drawer.Root>\n ) : (\n <>\n <SidebarGap\n data-animated={dataAttr(animated)}\n display={\n breakpoint\n ? { base: undefined, [breakpoint]: \"none\" }\n : undefined\n }\n />\n\n <styled.aside\n data-animated={dataAttr(animated)}\n data-group\n display={\n breakpoint\n ? { base: undefined, [breakpoint]: \"none\" }\n : undefined\n }\n {...getSidePanelProps(rest)}\n >\n {customHeader ??\n (header ? <SidebarHeader>{header}</SidebarHeader> : null)}\n {customContent ??\n (content || items ? (\n <SidebarContent>{content}</SidebarContent>\n ) : null)}\n {customFooter ??\n (footer ? <SidebarFooter>{footer}</SidebarFooter> : null)}\n {customHandle ?? (withHandle ? <SidebarHandle /> : null)}\n\n {omittedChildren}\n </styled.aside>\n </>\n )}\n </SidePanelComponentContext>\n )\n },\n \"sidePanel\",\n)()\n\ninterface SidebarGapProps extends HTMLStyledProps<\"div\"> {}\n\nconst SidebarGap = withContext<\"div\", SidebarGapProps>(\"div\", \"gap\")()\n\nexport interface SidebarHeaderProps extends HTMLStyledProps<\"header\"> {}\n\nexport const SidebarHeader = withContext<\"header\", SidebarHeaderProps>(\n \"header\",\n \"header\",\n)(undefined, (props) => {\n const { getHeaderProps } = useComponentContext()\n const { headerProps } = useSidePanelComponentContext()\n\n return getHeaderProps(mergeProps(headerProps, props)())\n})\n\nexport interface SidebarFooterProps extends HTMLStyledProps<\"footer\"> {}\n\nexport const SidebarFooter = withContext<\"footer\", SidebarFooterProps>(\n \"footer\",\n \"footer\",\n)(undefined, (props) => {\n const { getFooterProps } = useComponentContext()\n const { footerProps } = useSidePanelComponentContext()\n\n return getFooterProps(mergeProps(footerProps, props)())\n})\n\nexport interface SidebarContentProps extends HTMLStyledProps<\"ul\"> {\n /**\n * If provided, generate elements based on items.\n */\n items?: SidebarItem[]\n}\n\nexport const SidebarContent = withContext<\"ul\", SidebarContentProps>(\n ({ children, items, ...rest }) => {\n const { getContentProps } = useComponentContext()\n const { items: rootItems, contentProps } = useSidePanelComponentContext()\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return (items ?? rootItems)?.map((props, index) => {\n const key = createKey(props, index)\n\n if (\"group\" in props) {\n const { children, group: _, ...rest } = props\n\n return <SidebarGroup key={key} items={children} {...rest} />\n } else {\n const { children, ...rest } = props\n\n return <SidebarItem key={key} items={children} {...rest} />\n }\n })\n }, [children, items, rootItems])\n\n return (\n <styled.ul {...getContentProps(mergeProps(contentProps, rest)())}>\n {computedChildren}\n </styled.ul>\n )\n },\n \"content\",\n)()\n\nexport interface SidebarHandleProps extends HTMLStyledProps<\"button\"> {}\n\nexport const SidebarHandle = withContext<\"button\", SidebarHandleProps>(\n (props) => {\n const { handleProps } = useSidePanelComponentContext()\n\n return (\n <SidebarTrigger {...mergeProps(handleProps, props)()}>\n <styled.button tabIndex={-1} />\n </SidebarTrigger>\n )\n },\n \"handle\",\n)()\n\nexport interface SidebarGroupProps\n extends\n Omit<HTMLStyledProps<\"li\">, \"content\" | \"value\">,\n UseSidebarGroupProps {\n /**\n * If provided, generate elements based on items.\n */\n items?: SidebarItemWithValue[]\n /**\n * The label of the group.\n */\n label?: ReactNode\n /**\n * Props for the content component.\n */\n contentProps?: Omit<SidebarGroupContentProps, \"children\">\n /**\n * Props for the label component.\n */\n labelProps?: HTMLStyledProps<\"span\">\n}\n\nexport const SidebarGroup = withContext<\"li\", SidebarGroupProps>(\n ({\n children,\n items,\n label,\n value: valueProp = isString(label) ? label : undefined,\n contentProps,\n labelProps,\n ...rest\n }) => {\n const { groupProps } = useSidePanelComponentContext()\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return items?.map(({ children, ...rest }, index) => {\n const key = createKey(rest, index)\n\n return <SidebarItem key={key} items={children} {...rest} />\n })\n }, [children, items])\n const [omittedChildren, customLabel, customContent] = useSplitChildren(\n computedChildren,\n SidebarGroupLabel,\n SidebarGroupContent,\n )\n const { getContentProps, getLabelProps, getRootProps } = useSidebarGroup({\n ...mergeProps(groupProps, rest)(),\n value: valueProp,\n })\n const context = useMemo(\n () => ({ contentProps, getContentProps, getLabelProps, labelProps }),\n [getLabelProps, labelProps, getContentProps, contentProps],\n )\n\n return (\n <GroupComponentContext value={context}>\n <styled.li {...getRootProps()}>\n {customLabel ??\n (label ? <SidebarGroupLabel>{label}</SidebarGroupLabel> : null)}\n {customContent ?? (\n <SidebarGroupContent>{omittedChildren}</SidebarGroupContent>\n )}\n </styled.li>\n </GroupComponentContext>\n )\n },\n \"group\",\n)()\n\nexport interface SidebarGroupLabelProps extends HTMLStyledProps<\"span\"> {}\n\nexport const SidebarGroupLabel = withContext<\"span\", SidebarGroupLabelProps>(\n \"span\",\n \"groupLabel\",\n)(undefined, (props) => {\n const { getLabelProps, labelProps } = useGroupComponentContext()\n\n return getLabelProps(mergeProps(labelProps, props)())\n})\n\nexport interface SidebarGroupContentProps extends HTMLStyledProps<\"div\"> {}\n\nexport const SidebarGroupContent = withContext<\"div\", SidebarGroupContentProps>(\n \"div\",\n \"groupContent\",\n)(undefined, ({ children, ...rest }) => {\n const validChildren = useValidChildren(children)\n const list = useIncludesChildren(validChildren, SidebarItem)\n const { groupContentProps } = useSidePanelComponentContext()\n const { contentProps, getContentProps } = useGroupComponentContext()\n\n return {\n as: list ? \"ul\" : \"div\",\n children,\n ...getContentProps(mergeProps(groupContentProps, contentProps, rest)()),\n }\n})\n\nexport interface SidebarMenuProps extends HTMLStyledProps<\"div\"> {}\n\nexport const SidebarMenu = withContext<\"div\", SidebarMenuProps>(\"div\", \"menu\")(\n undefined,\n (props) => {\n const { menuProps } = useSidePanelComponentContext()\n\n return { \"data-menu\": \"\", ...mergeProps(menuProps, props)() }\n },\n)\n\nexport interface SidebarMenuButtonProps extends HTMLStyledProps<\"button\"> {}\n\nexport const SidebarMenuButton = withContext<\"button\", SidebarMenuButtonProps>(\n \"button\",\n [\"menu\", \"button\"],\n)(undefined, (props) => {\n const { open } = useSidebarContext()\n const { mode } = useComponentContext()\n const { menuProps } = useSidePanelComponentContext()\n const offcanvas = mode === \"offcanvas\"\n const { disabled, ...rest } = mergeProps(menuProps, props)()\n\n return {\n \"data-menu\": \"\",\n disabled,\n ...rest,\n tabIndex: (!offcanvas || open) && !disabled ? 0 : -1,\n }\n})\n\nexport interface SidebarItemProps\n extends\n Omit<HTMLStyledProps<\"li\">, \"value\">,\n Omit<UseSidebarItemProps, \"asyncChildren\"> {\n /**\n * The label to display in the item.\n */\n label: ReactNode\n /**\n * If `true`, the sidebar item will be animated.\n *\n * @default true\n */\n animated?: boolean\n /**\n * The element to display at the end of the item.\n */\n endElement?: SidebarItemReactNode\n /**\n * The sidebar item indicator icon to use.\n */\n indicator?: ReactNodeOrFunction<SidebarItemCallBackProps>\n /**\n * If provided, generate elements based on items.\n */\n items?: SidebarItemWithValue[]\n /**\n * The loading scheme.\n *\n * @default 'oval'\n */\n loadingScheme?: Loading.Scheme\n /**\n * If provided, the sidebar item will be rendered with custom components.\n */\n render?: SidebarItemRender\n /**\n * The element to display at the start of the item.\n */\n startElement?: SidebarItemReactNode\n /**\n * Props for the content component.\n */\n contentProps?: Omit<SidebarItemContentProps, \"children\">\n /**\n * Props for the end component.\n */\n endElementProps?: SidebarItemEndElementProps\n /**\n * Props for the indicator component.\n */\n indicatorProps?: SidebarItemIndicatorProps\n /**\n * Props for the label component.\n */\n labelProps?: SidebarItemLabelProps\n /**\n * Props for the link component.\n */\n linkProps?: SidebarItemLinkProps\n /**\n * Props for the start component.\n */\n startElementProps?: SidebarItemStartElementProps\n /**\n * Props for the tooltip component.\n */\n tooltipProps?: Omit<SidebarItemTooltipProps, \"children\" | \"content\">\n /**\n * Props for the trigger component.\n */\n triggerProps?: SidebarItemTriggerProps\n /**\n * If provided, the sidebar item will be rendered as an async sidebar item.\n */\n asyncChildren?: () => Promise<SidebarItemWithValue[]>\n}\n\nexport const SidebarItem = withContext<\"li\", SidebarItemProps>(\n ({\n animated: animatedProp,\n asyncChildren: asyncChildrenProp,\n children: childrenProp,\n endElement,\n indicator: indicatorProp,\n items,\n label,\n loadingScheme,\n render,\n startElement,\n contentProps,\n endElementProps,\n indicatorProps,\n labelProps,\n linkProps,\n startElementProps,\n tooltipProps,\n triggerProps,\n ...rest\n }) => {\n const { mode } = useComponentContext()\n const offcanvas = mode === \"offcanvas\"\n const componentContext = useSidePanelComponentContext()\n const Loading = useLoadingComponent(\n loadingScheme ?? componentContext.loadingScheme ?? \"oval\",\n )\n const computedChildren = useMemo(() => {\n if (childrenProp) return childrenProp\n\n return items?.map(({ children, ...rest }, index) => {\n const key = createKey(rest, index)\n\n return <SidebarItem key={key} items={children} {...rest} />\n })\n }, [childrenProp, items])\n const asyncChildren = useCallback(async () => {\n const items = await asyncChildrenProp?.()\n\n return items?.map(({ children, ...rest }, index) => {\n const key = createKey(rest, index)\n\n return <SidebarItem key={key} items={children} {...rest} />\n })\n }, [asyncChildrenProp])\n const {\n branchOpen,\n children,\n disabled,\n expanded,\n expandedValue,\n group,\n groupLoading,\n groupOpen,\n open,\n selected,\n selectedValue,\n value,\n getContentProps,\n getIndicatorProps,\n getItemProps,\n getLabelProps,\n getLinkProps,\n getTriggerProps,\n onExpandedChange,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n onSelectedChange,\n } = useSidebarItem({\n ...mergeProps(componentContext.itemProps, rest)(),\n asyncChildren: asyncChildrenProp ? asyncChildren : undefined,\n children: computedChildren,\n })\n const animated = animatedProp ?? componentContext.animated ?? true\n const tabIndex = offcanvas\n ? open && expanded && !disabled\n ? 0\n : -1\n : expanded && !disabled\n ? 0\n : -1\n const callbackProps = useMemo(\n () => ({ disabled, expanded: groupOpen }),\n [disabled, groupOpen],\n )\n const mergedTriggerProps = useMemo(() => {\n return getTriggerProps({\n tabIndex,\n ...mergeProps(componentContext.triggerProps, triggerProps)(),\n }) as SidebarItemTriggerProps\n }, [getTriggerProps, tabIndex, componentContext.triggerProps, triggerProps])\n const mergedLinkProps = useMemo(() => {\n return getLinkProps({\n tabIndex,\n ...mergeProps(componentContext.linkProps, linkProps)(),\n }) as SidebarItemLinkProps\n }, [getLinkProps, tabIndex, componentContext.linkProps, linkProps])\n const indicator = useMemo<ReactNode>(\n () => runIfFn(indicatorProp ?? componentContext.indicator, callbackProps),\n [indicatorProp, componentContext.indicator, callbackProps],\n )\n const groupStartElement = useMemo<ReactNode>(\n () =>\n runIfFn(\n getReactNodeOrFunction(\n \"group\",\n startElement,\n componentContext.startElement,\n ),\n callbackProps,\n ),\n [startElement, componentContext.startElement, callbackProps],\n )\n const groupEndElement = useMemo<ReactNode>(\n () =>\n runIfFn(\n getReactNodeOrFunction(\n \"group\",\n endElement,\n componentContext.endElement,\n ),\n callbackProps,\n ),\n [endElement, componentContext.endElement, callbackProps],\n )\n const itemStartElement = useMemo<ReactNode>(\n () =>\n runIfFn(\n getReactNodeOrFunction(\n \"item\",\n startElement,\n componentContext.startElement,\n ),\n callbackProps,\n ),\n [startElement, componentContext.startElement, callbackProps],\n )\n const itemEndElement = useMemo<ReactNode>(\n () =>\n runIfFn(\n getReactNodeOrFunction(\n \"item\",\n endElement,\n componentContext.endElement,\n ),\n callbackProps,\n ),\n [endElement, componentContext.endElement, callbackProps],\n )\n const trigger = useMemo<ReactNode>(\n () =>\n runIfFn(render?.trigger ?? componentContext.render?.trigger, {\n endElement: groupEndElement,\n expanded,\n expandedValue,\n groupLoading,\n groupOpen,\n indicator,\n label,\n selected,\n selectedValue,\n startElement: groupStartElement,\n value,\n triggerProps: mergedTriggerProps,\n onExpandedChange,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n onSelectedChange,\n }),\n [\n render?.trigger,\n componentContext.render?.trigger,\n groupEndElement,\n expanded,\n expandedValue,\n groupLoading,\n groupOpen,\n indicator,\n label,\n selected,\n selectedValue,\n groupStartElement,\n value,\n mergedTriggerProps,\n onExpandedChange,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n onSelectedChange,\n ],\n )\n const link = useMemo<ReactNode>(\n () =>\n runIfFn(render?.link ?? componentContext.render?.link, {\n endElement: itemEndElement,\n expanded,\n expandedValue,\n label,\n selected,\n selectedValue,\n startElement: itemStartElement,\n value,\n linkProps: mergedLinkProps,\n onExpandedChange,\n onSelectedChange,\n }),\n [\n render?.link,\n componentContext.render?.link,\n itemEndElement,\n expanded,\n expandedValue,\n label,\n selected,\n selectedValue,\n itemStartElement,\n value,\n mergedLinkProps,\n onExpandedChange,\n onSelectedChange,\n ],\n )\n const item = useMemo<ReactNode>(\n () =>\n runIfFn(render?.item ?? componentContext.render?.item, {\n children,\n endElement: { group: groupEndElement, item: itemEndElement },\n expanded,\n expandedValue,\n group,\n groupLoading,\n groupOpen,\n indicator,\n label,\n link,\n selected,\n selectedValue,\n startElement: { group: groupStartElement, item: itemStartElement },\n trigger,\n value,\n itemProps: getItemProps() as HTMLStyledProps<\"li\">,\n linkProps: mergedLinkProps,\n triggerProps: mergedTriggerProps,\n onExpandedChange,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n onSelectedChange,\n }),\n [\n render?.item,\n componentContext.render?.item,\n children,\n groupEndElement,\n itemEndElement,\n expanded,\n expandedValue,\n group,\n groupLoading,\n groupOpen,\n indicator,\n label,\n link,\n selected,\n selectedValue,\n groupStartElement,\n itemStartElement,\n trigger,\n value,\n getItemProps,\n mergedLinkProps,\n mergedTriggerProps,\n onExpandedChange,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n onSelectedChange,\n ],\n )\n const context = useMemo(\n () => ({ branchOpen, groupOpen }),\n [branchOpen, groupOpen],\n )\n const itemComponentContext = useMemo(\n () => ({\n contentProps: {\n duration: !animated ? 0 : undefined,\n open: groupOpen,\n ...getContentProps(\n mergeProps(componentContext.itemContentProps, contentProps)(),\n ),\n },\n endElementProps: mergeProps(\n componentContext.endElementProps,\n endElementProps,\n )(),\n indicatorProps: getIndicatorProps({\n \"data-animated\": dataAttr(animated),\n ...mergeProps(componentContext.indicatorProps, indicatorProps)(),\n }) as SidebarItemIndicatorProps,\n labelProps: getLabelProps(\n mergeProps(componentContext.labelProps, labelProps)(),\n ) as SidebarItemLabelProps,\n startElementProps: mergeProps(\n componentContext.startElementProps,\n startElementProps,\n )(),\n tooltipProps: {\n content: label,\n disabled: open,\n ...mergeProps(componentContext.tooltipProps, tooltipProps)(),\n },\n }),\n [\n animated,\n componentContext.endElementProps,\n componentContext.indicatorProps,\n componentContext.itemContentProps,\n componentContext.labelProps,\n componentContext.startElementProps,\n componentContext.tooltipProps,\n contentProps,\n endElementProps,\n getContentProps,\n getIndicatorProps,\n getLabelProps,\n groupOpen,\n indicatorProps,\n label,\n labelProps,\n open,\n startElementProps,\n tooltipProps,\n ],\n )\n\n return (\n <SidebarItemContext value={context}>\n <ItemComponentContext value={itemComponentContext}>\n {item ?? (\n <styled.li {...getItemProps()}>\n {group ? (\n <>\n {trigger ?? (\n <SidebarItemTrigger {...mergedTriggerProps}>\n {groupStartElement ? (\n <SidebarItemStartElement>\n {groupStartElement}\n </SidebarItemStartElement>\n ) : null}\n {label ? (\n <SidebarItemLabel>{label}</SidebarItemLabel>\n ) : null}\n {groupEndElement ? (\n <SidebarItemEndElement>\n {groupEndElement}\n </SidebarItemEndElement>\n ) : null}\n <SidebarItemIndicator>\n {groupLoading ? (\n <Loading />\n ) : (\n runIfFn(indicator, callbackProps)\n )}\n </SidebarItemIndicator>\n </SidebarItemTrigger>\n )}\n\n <SidebarItemContent>{children}</SidebarItemContent>\n </>\n ) : (\n (link ?? (\n <SidebarItemLink {...mergedLinkProps}>\n {itemStartElement ? (\n <SidebarItemStartElement>\n {itemStartElement}\n </SidebarItemStartElement>\n ) : null}\n {label ? (\n <SidebarItemLabel>{label}</SidebarItemLabel>\n ) : null}\n {itemEndElement ? (\n <SidebarItemEndElement>\n {itemEndElement}\n </SidebarItemEndElement>\n ) : null}\n </SidebarItemLink>\n ))\n )}\n </styled.li>\n )}\n </ItemComponentContext>\n </SidebarItemContext>\n )\n },\n \"item\",\n)()\n\ninterface SidebarItemTooltipProps extends TooltipProps {}\n\nconst SidebarItemTooltip: FC<SidebarItemTooltipProps> = (props) => {\n const { tooltipProps } = useItemComponentContext()\n const { children, disabled, ...rest } = mergeProps(tooltipProps, props)()\n const { mode, placement } = useComponentContext()\n const offcanvas = mode === \"offcanvas\"\n\n if (offcanvas || disabled) {\n return children\n } else {\n return (\n <Tooltip\n closeOnClick={false}\n gutter={16}\n placement={`center-${placement === \"start\" ? \"end\" : \"start\"}`}\n {...rest}\n >\n {children}\n </Tooltip>\n )\n }\n}\n\nexport interface SidebarItemTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const SidebarItemTrigger = withContext<\n \"button\",\n SidebarItemTriggerProps\n>((props) => {\n return (\n <SidebarItemTooltip>\n <styled.button {...props} />\n </SidebarItemTooltip>\n )\n}, \"itemTrigger\")()\n\nexport interface SidebarItemLinkProps extends HTMLStyledProps<\"a\"> {}\n\nexport const SidebarItemLink = withContext<\"a\", SidebarItemLinkProps>(\n (props) => {\n return (\n <SidebarItemTooltip>\n <styled.a {...props} />\n </SidebarItemTooltip>\n )\n },\n \"itemLink\",\n)()\n\nexport interface SidebarItemContentProps\n extends\n Omit<HTMLStyledProps<\"ul\">, \"transition\">,\n Pick<CollapseProps, \"animationOpacity\" | keyof WithTransitionProps> {}\n\nexport const SidebarItemContent = withContext<\"ul\", SidebarItemContentProps>(\n (props) => {\n const { contentProps } = useItemComponentContext()\n\n return (\n <Collapse\n as=\"ul\"\n {...cast<CollapseProps>(mergeProps(contentProps, props)())}\n />\n )\n },\n \"itemContent\",\n)()\n\nexport interface SidebarItemIndicatorProps extends HTMLStyledProps<\"svg\"> {}\n\nexport const SidebarItemIndicator = withContext<\n \"svg\",\n SidebarItemIndicatorProps\n>(({ children = <ChevronRightIcon />, ...rest }) => {\n const { indicatorHidden } = useSidePanelComponentContext()\n\n if (indicatorHidden) return null\n\n if (isValidElement<HTMLProps<\"svg\">>(children))\n return cloneElement(children, { ...rest, ...children.props })\n\n return Children.count(children) > 1 ? Children.only(null) : null\n}, \"itemIndicator\")(undefined, (props) => {\n const { indicatorProps } = useItemComponentContext()\n\n return mergeProps(indicatorProps, props)()\n})\n\nexport interface SidebarItemStartElementProps extends HTMLStyledProps {}\n\nexport const SidebarItemStartElement = withContext<\n \"div\",\n SidebarItemStartElementProps\n>(\"div\", {\n name: \"ItemStartElement\",\n slot: [\"itemElement\", \"start\"],\n})(undefined, (props) => {\n const { startElementProps } = useItemComponentContext()\n\n return mergeProps(startElementProps, props)()\n})\n\nexport interface SidebarItemEndElementProps extends HTMLStyledProps {}\n\nexport const SidebarItemEndElement = withContext<\n \"div\",\n SidebarItemEndElementProps\n>(\"div\", {\n name: \"ItemEndElement\",\n slot: [\"itemElement\", \"end\"],\n})(undefined, (props) => {\n const { endElementProps } = useItemComponentContext()\n\n return mergeProps(endElementProps, props)()\n})\n\nexport interface SidebarItemLabelProps extends HTMLStyledProps<\"span\"> {}\n\nexport const SidebarItemLabel = withContext<\"span\", SidebarItemLabelProps>(\n \"span\",\n \"itemLabel\",\n)(undefined, (props) => {\n const { labelProps } = useItemComponentContext()\n\n return mergeProps(labelProps, props)()\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA0JA,MAAM,aAAa,OAAoB,UAAkB;CACvD,OAAO,WAAW,QAAQ,MAAM,SAAS,QAAQ;AACnD;AAEA,MAAM,0BACJ,MACA,QACA,SACkD;CAClD,KAAA,GAAA,oBAAA,cAAA,SAAA,CAAa,MAAM,MAAM,WAAW,UAAU,UAAU,SACtD,OAAO,OAAO;MACT,IAAI,QACT,OAAO;MACF,KAAA,GAAA,oBAAA,cAAA,SAAA,CAAa,IAAI,MAAM,WAAW,QAAQ,UAAU,OACzD,OAAO,KAAK;MAEZ,OAAO;AAEX;AAoBA,MAAM,CAAC,uBAAuB,4BAC5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O,KAAR;KAAY,cAAA;KAAW,GAAI,aAAa;IAAI,CAAA;GAC5B,CAAA;EACJ,CAAA;CACS,CAAA;AAE/B,GACA,QACA,EAAE,eAAe,CAAC,QAAQ,WAAW,EAAE,CACzC,CAAC,CAAC;AAIF,MAAa,mBAAmB,YAC9B,OACA,WACF,CAAC,CAAC;AAIF,MAAa,iBAAiB,YAC5B,UACA,SACF,CAAC,CAAC,KAAA,IAAY,UAAU;CACtB,MAAM,EAAE,oBAAoB,oBAAoB;CAEhD,OAAO;EAAE,SAAS;EAAM,GAAG,gBAAgB,KAAK;CAAE;AACpD,CAAC;AA8GD,MAAa,mBAAmB,aAC7B,EACC,WAAW,MACX,UACA,SACA,YACA,QACA,QACA,WACA,iBACA,OACA,eACA,QACA,cACA,aAAa,MACb,cACA,aACA,iBACA,aACA,mBACA,YACA,aACA,aACA,gBACA,kBACA,WACA,YACA,WACA,WACA,mBACA,cACA,cACA,GAAG,WACC;CACJ,MAAM,EAAE,QAAQ,MAAM,YAAYC,oBAAAA,kBAAkB;CACpD,MAAM,EAAE,YAAY,WAAW,sBAAsB,oBAAoB;CACzE,MAAM,CACJ,iBACA,cACA,eACA,cACA,gBACEC,iBAAAA,iBACF,UACA,eACA,gBACA,eACA,aACF;CAwDA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,2BAAD;EAA2B,QAAA,GAAA,MAAA,QAAA,QAvDpB;GACL;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,IACA;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,CAIwC;YACrC,SACC,iBAAA,GAAA,kBAAA,IAAA,CAAA,eAAA,YAAA;GACE,MAAK;GACL,WAAW;GACX,UAAU,CAAC,WAAW,IAAI,KAAA;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AAA,aAAA,CAAoB,UAAU;EAAE,GAAG;EAAM,GAAG,SAAS;CAAM,CAAC;CAE9D,OAAOC,MAAAA,SAAS,MAAM,QAAQ,IAAI,IAAIA,MAAAA,SAAS,KAAK,IAAI,IAAI;AAC9D,GAAG,eAAe,CAAC,CAAC,KAAA,IAAY,UAAU;CACxC,MAAM,EAAE,mBAAmB,wBAAwB;CAEnD,OAAOV,cAAAA,WAAW,gBAAgB,KAAK,CAAC,CAAC;AAC3C,CAAC;AAID,MAAa,0BAA0B,YAGrC,OAAO;CACP,MAAM;CACN,MAAM,CAAC,eAAe,OAAO;AAC/B,CAAC,CAAC,CAAC,KAAA,IAAY,UAAU;CACvB,MAAM,EAAE,sBAAsB,wBAAwB;CAEtD,OAAOA,cAAAA,WAAW,mBAAmB,KAAK,CAAC,CAAC;AAC9C,CAAC;AAID,MAAa,wBAAwB,YAGnC,OAAO;CACP,MAAM;CACN,MAAM,CAAC,eAAe,KAAK;AAC7B,CAAC,CAAC,CAAC,KAAA,IAAY,UAAU;CACvB,MAAM,EAAE,oBAAoB,wBAAwB;CAEpD,OAAOA,cAAAA,WAAW,iBAAiB,KAAK,CAAC,CAAC;AAC5C,CAAC;AAID,MAAa,mBAAmB,YAC9B,QACA,WACF,CAAC,CAAC,KAAA,IAAY,UAAU;CACtB,MAAM,EAAE,eAAe,wBAAwB;CAE/C,OAAOA,cAAAA,WAAW,YAAY,KAAK,CAAC,CAAC;AACvC,CAAC"}
1
+ {"version":3,"file":"sidebar.cjs","names":["createContext","createSlotComponent","sidebarStyle","useBreakpointValue","useValue","useSidebar","SidebarDescendantsContext","SidebarContext","styled","useSidebarContext","useSplitChildren","mergeProps","useSidebarGroup","useIncludesChildren","useValidChildren","useLoadingComponent","useSidebarItem","SidebarItemContext","Tooltip","Collapse","ChevronRightIcon","Children"],"sources":["../../../../src/components/sidebar/sidebar.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, PropsWithChildren, ReactNode } from \"react\"\nimport type {\n Breakpoint,\n ExtractStyleValue,\n HTMLProps,\n HTMLStyledProps,\n ThemeProps,\n} from \"../../core\"\nimport type { ReactNodeOrFunction } from \"../../utils\"\nimport type { CollapseProps } from \"../collapse\"\nimport type { Loading } from \"../loading\"\nimport type { WithTransitionProps } from \"../motion\"\nimport type {\n UseSidebarGroupProps,\n UseSidebarGroupReturn,\n UseSidebarItemProps,\n UseSidebarItemReturn,\n UseSidebarProps,\n UseSidebarReturn,\n} from \"./use-sidebar\"\nimport {\n Children,\n cloneElement,\n isValidElement,\n useCallback,\n useMemo,\n} from \"react\"\nimport { createSlotComponent, mergeProps, styled } from \"../../core\"\nimport { useBreakpointValue } from \"../../hooks/use-breakpoint\"\nimport { useValue } from \"../../hooks/use-value\"\nimport {\n cast,\n createContext,\n dataAttr,\n isObject,\n isString,\n runIfFn,\n useIncludesChildren,\n useSplitChildren,\n useValidChildren,\n} from \"../../utils\"\nimport { Collapse } from \"../collapse\"\nimport { Drawer } from \"../drawer\"\nimport { ChevronRightIcon } from \"../icon\"\nimport { useLoadingComponent } from \"../loading\"\nimport { Tooltip, type TooltipProps } from \"../tooltip\"\nimport { sidebarStyle, type SidebarStyle } from \"./sidebar.style\"\nimport {\n SidebarContext,\n SidebarDescendantsContext,\n SidebarItemContext,\n useSidebar,\n useSidebarContext,\n useSidebarGroup,\n useSidebarItem,\n} from \"./use-sidebar\"\n\ninterface SidebarItemCallBackProps {\n disabled?: boolean\n expanded?: boolean\n}\n\ntype SidebarItemReactNode =\n | ReactNodeOrFunction<SidebarItemCallBackProps>\n | {\n group: ReactNodeOrFunction<SidebarItemCallBackProps>\n item?: ReactNodeOrFunction<SidebarItemCallBackProps>\n }\n | {\n item: ReactNodeOrFunction<SidebarItemCallBackProps>\n group?: ReactNodeOrFunction<SidebarItemCallBackProps>\n }\n\ninterface SidebarItemSharedRenderProps\n extends\n Pick<SidebarItemProps, \"label\">,\n Pick<\n UseSidebarItemReturn,\n | \"expanded\"\n | \"expandedValue\"\n | \"onExpandedChange\"\n | \"onSelectedChange\"\n | \"selected\"\n | \"selectedValue\"\n | \"value\"\n > {\n itemProps: HTMLStyledProps<\"li\">\n linkProps: HTMLStyledProps<\"a\">\n triggerProps: HTMLStyledProps<\"button\">\n endElement?: ReactNode\n startElement?: ReactNode\n}\n\ninterface SidebarItemRenderProps\n extends\n PropsWithChildren,\n Omit<SidebarItemSharedRenderProps, \"endElement\" | \"startElement\">,\n Pick<\n UseSidebarItemReturn,\n | \"group\"\n | \"groupLoading\"\n | \"groupOpen\"\n | \"onGroupClose\"\n | \"onGroupOpen\"\n | \"onGroupToggle\"\n > {\n endElement: { group?: ReactNode; item?: ReactNode }\n startElement: { group?: ReactNode; item?: ReactNode }\n indicator?: ReactNode\n link?: ReactNode\n trigger?: ReactNode\n}\n\ninterface SidebarItemLinkRenderProps extends Omit<\n SidebarItemSharedRenderProps,\n \"itemProps\" | \"triggerProps\"\n> {}\n\ninterface SidebarItemTriggerRenderProps\n extends\n Omit<SidebarItemSharedRenderProps, \"itemProps\" | \"linkProps\">,\n Pick<\n UseSidebarItemReturn,\n | \"groupLoading\"\n | \"groupOpen\"\n | \"onGroupClose\"\n | \"onGroupOpen\"\n | \"onGroupToggle\"\n > {\n indicator?: ReactNode\n}\n\ninterface SidebarItemRender {\n item?: ReactNodeOrFunction<SidebarItemRenderProps>\n link?: ReactNodeOrFunction<SidebarItemLinkRenderProps>\n trigger?: ReactNodeOrFunction<SidebarItemTriggerRenderProps>\n}\n\ninterface SidebarGroup extends Omit<SidebarGroupProps, \"children\" | \"value\"> {\n children: SidebarItemWithValue[]\n group: true\n}\n\nexport interface SidebarItemWithValue extends Omit<\n SidebarItemProps,\n \"children\"\n> {\n children?: SidebarItemWithValue[]\n}\n\nexport type SidebarItem = SidebarGroup | SidebarItemWithValue\n\nconst createKey = (props: SidebarItem, index: number) => {\n return \"value\" in props ? props.value || index : index\n}\n\nconst getReactNodeOrFunction = (\n type: \"group\" | \"item\",\n custom?: SidebarItemReactNode,\n root?: SidebarItemReactNode,\n): ReactNodeOrFunction<SidebarItemCallBackProps> => {\n if (isObject(custom) && (\"group\" in custom || \"item\" in custom))\n return custom[type]\n else if (custom) return custom\n else if (isObject(root) && (\"group\" in root || \"item\" in root))\n return root[type]\n else return root\n}\n\ninterface ComponentContext extends Pick<\n UseSidebarReturn,\n | \"getContentProps\"\n | \"getFooterProps\"\n | \"getHeaderProps\"\n | \"getSidePanelProps\"\n | \"getTriggerProps\"\n> {\n breakpoint: ExtractStyleValue<NonNullable<SidebarRootProps[\"breakpoint\"]>>\n mode: ExtractStyleValue<NonNullable<SidebarRootProps[\"mode\"]>>\n placement: ExtractStyleValue<NonNullable<SidebarRootProps[\"placement\"]>>\n}\n\ninterface GroupComponentContext\n extends\n Pick<SidebarGroupProps, \"contentProps\" | \"labelProps\">,\n Pick<UseSidebarGroupReturn, \"getContentProps\" | \"getLabelProps\"> {}\n\nconst [GroupComponentContext, useGroupComponentContext] =\n createContext<GroupComponentContext>({ name: \"GroupComponentContext\" })\n\ninterface ItemComponentContext {\n contentProps: SidebarItemContentProps\n endElementProps: SidebarItemEndElementProps\n indicatorProps: SidebarItemIndicatorProps\n labelProps: SidebarItemLabelProps\n startElementProps: SidebarItemStartElementProps\n tooltipProps: SidebarItemTooltipProps\n}\n\nconst [ItemComponentContext, useItemComponentContext] =\n createContext<ItemComponentContext>({ name: \"ItemComponentContext\" })\n\ninterface SidePanelComponentContext extends Pick<\n SidebarSidePanelProps,\n | \"animated\"\n | \"contentProps\"\n | \"endElement\"\n | \"endElementProps\"\n | \"footerProps\"\n | \"groupContentProps\"\n | \"groupProps\"\n | \"handleProps\"\n | \"headerProps\"\n | \"indicator\"\n | \"indicatorHidden\"\n | \"indicatorProps\"\n | \"itemContentProps\"\n | \"itemProps\"\n | \"items\"\n | \"labelProps\"\n | \"linkProps\"\n | \"loadingScheme\"\n | \"menuProps\"\n | \"render\"\n | \"startElement\"\n | \"startElementProps\"\n | \"tooltipProps\"\n | \"triggerProps\"\n> {}\n\nconst [SidePanelComponentContext, useSidePanelComponentContext] =\n createContext<SidePanelComponentContext>({\n name: \"SidePanelComponentContext\",\n })\n\nexport interface SidebarRootProps\n extends\n HTMLStyledProps<\"div\">,\n ThemeProps<SidebarStyle>,\n Omit<UseSidebarProps, \"mobile\"> {\n /**\n * The breakpoint to use for the sidebar. If `false`, the sidebar will be always visible.\n *\n * @default 'md'\n */\n breakpoint?: Exclude<Breakpoint, \"base\"> | false\n}\n\nconst {\n ComponentContext,\n PropsContext: SidebarPropsContext,\n useComponentContext,\n usePropsContext: useSidebarPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<SidebarRootProps, SidebarStyle, ComponentContext>(\n \"sidebar\",\n sidebarStyle,\n)\n\nexport { SidebarPropsContext, useSidebarPropsContext }\n\n/**\n * `Sidebar` is a component that is used to display a list of items in a sidebar.\n *\n * @see https://yamada-ui.com/docs/components/sidebar\n */\nexport const SidebarRoot = withProvider<\n \"div\",\n SidebarRootProps,\n \"mode\" | \"placement\"\n>(\n ({\n breakpoint = \"md\",\n mode: modeProp = \"offcanvas\",\n placement: placementProp = \"start\",\n ...rest\n }) => {\n const mobile =\n useBreakpointValue<boolean | undefined>(\n breakpoint ? { [breakpoint]: true } : { base: false },\n ) ?? false\n const mode = useValue(modeProp)\n const placement = useValue(placementProp)\n const {\n descendants,\n expandedValue,\n open,\n selectedValue,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getRootProps,\n getSidePanelProps,\n getTriggerProps,\n onClose,\n onExpandedChange,\n onOpen,\n onSelectedChange,\n onToggle,\n } = useSidebar({ mobile, ...rest })\n const context = useMemo(\n () => ({\n expandedValue,\n mobile,\n open,\n selectedValue,\n onClose,\n onExpandedChange,\n onOpen,\n onSelectedChange,\n onToggle,\n }),\n [\n mobile,\n expandedValue,\n open,\n selectedValue,\n onClose,\n onExpandedChange,\n onOpen,\n onSelectedChange,\n onToggle,\n ],\n )\n const componentContext = useMemo(\n () => ({\n breakpoint,\n mode,\n placement,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getSidePanelProps,\n getTriggerProps,\n }),\n [\n breakpoint,\n mode,\n placement,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getSidePanelProps,\n getTriggerProps,\n ],\n )\n\n return (\n <SidebarDescendantsContext value={descendants}>\n <SidebarContext value={context}>\n <ComponentContext value={componentContext}>\n <styled.div data-group {...getRootProps()} />\n </ComponentContext>\n </SidebarContext>\n </SidebarDescendantsContext>\n )\n },\n \"root\",\n { transferProps: [\"mode\", \"placement\"] },\n)()\n\nexport interface SidebarMainPanelProps extends HTMLStyledProps {}\n\nexport const SidebarMainPanel = withContext<\"div\", SidebarMainPanelProps>(\n \"div\",\n \"mainPanel\",\n)()\n\nexport interface SidebarTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const SidebarTrigger = withContext<\"button\", SidebarTriggerProps>(\n \"button\",\n \"trigger\",\n)(undefined, (props) => {\n const { getTriggerProps } = useComponentContext()\n\n return { asChild: true, ...getTriggerProps(props) }\n})\n\nexport interface SidebarSidePanelProps\n extends\n Omit<HTMLStyledProps<\"aside\">, \"content\">,\n Pick<SidebarContentProps, \"items\">,\n Pick<\n SidebarItemProps,\n | \"animated\"\n | \"endElement\"\n | \"endElementProps\"\n | \"indicator\"\n | \"indicatorProps\"\n | \"labelProps\"\n | \"linkProps\"\n | \"loadingScheme\"\n | \"render\"\n | \"startElement\"\n | \"startElementProps\"\n | \"tooltipProps\"\n | \"triggerProps\"\n > {\n /**\n * The content of the sidebar.\n */\n content?: ReactNode\n /**\n * The footer of the sidebar.\n */\n footer?: ReactNode\n /**\n * The header of the sidebar.\n */\n header?: ReactNode\n /**\n * If `true`, hide the tree indicator icon for all items.\n *\n * @default false\n */\n indicatorHidden?: boolean\n /**\n * If `true`, the sidebar will be rendered with a handle.\n *\n * @default true\n */\n withHandle?: boolean\n /**\n * Props for the content component.\n */\n contentProps?: SidebarContentProps\n /**\n * Props for the drawer component.\n */\n drawerProps?: Omit<\n Drawer.RootProps,\n | \"body\"\n | \"cancel\"\n | \"children\"\n | \"footer\"\n | \"header\"\n | \"middle\"\n | \"onCancel\"\n | \"onClose\"\n | \"onMiddle\"\n | \"onOpen\"\n | \"onSuccess\"\n | \"open\"\n | \"success\"\n | \"title\"\n | \"trigger\"\n >\n /**\n * Props for the footer component.\n */\n footerProps?: SidebarFooterProps\n /**\n * Props for the group content component.\n */\n groupContentProps?: Omit<SidebarGroupContentProps, \"children\">\n /**\n * Props for the group component.\n */\n groupProps?: Omit<SidebarGroupProps, \"children\" | \"label\" | \"value\">\n /**\n * Props for the handle component.\n */\n handleProps?: SidebarHandleProps\n /**\n * Props for the header component.\n */\n headerProps?: SidebarHeaderProps\n /**\n * Props for the item content component.\n */\n itemContentProps?: SidebarItemContentProps\n /**\n * Props for the item component.\n */\n itemProps?: Omit<\n SidebarItemProps,\n \"children\" | \"items\" | \"label\" | \"open\" | \"value\"\n >\n /**\n * Props for the menu component.\n *\n * @default 'md'\n */\n menuProps?: SidebarMenuProps\n}\n\nexport const SidebarSidePanel = withContext<\"aside\", SidebarSidePanelProps>(\n ({\n animated = true,\n children,\n content,\n endElement,\n footer,\n header,\n indicator,\n indicatorHidden,\n items,\n loadingScheme,\n render,\n startElement,\n withHandle = true,\n contentProps,\n drawerProps,\n endElementProps,\n footerProps,\n groupContentProps,\n groupProps,\n handleProps,\n headerProps,\n indicatorProps,\n itemContentProps,\n itemProps,\n labelProps,\n linkProps,\n menuProps,\n startElementProps,\n tooltipProps,\n triggerProps,\n ...rest\n }) => {\n const { mobile, open, onClose } = useSidebarContext()\n const { breakpoint, placement, getSidePanelProps } = useComponentContext()\n const [\n omittedChildren,\n customHeader,\n customContent,\n customFooter,\n customHandle,\n ] = useSplitChildren(\n children,\n SidebarHeader,\n SidebarContent,\n SidebarFooter,\n SidebarHandle,\n )\n const context = useMemo(\n () => ({\n animated,\n endElement,\n indicator,\n indicatorHidden,\n items,\n loadingScheme,\n render,\n startElement,\n contentProps,\n endElementProps,\n footerProps,\n groupContentProps,\n groupProps,\n handleProps,\n headerProps,\n indicatorProps,\n itemContentProps,\n itemProps,\n labelProps,\n linkProps,\n menuProps,\n startElementProps,\n tooltipProps,\n triggerProps,\n }),\n [\n animated,\n endElement,\n indicator,\n indicatorHidden,\n items,\n render,\n loadingScheme,\n startElement,\n contentProps,\n endElementProps,\n footerProps,\n groupContentProps,\n groupProps,\n handleProps,\n headerProps,\n indicatorProps,\n itemContentProps,\n itemProps,\n labelProps,\n linkProps,\n menuProps,\n startElementProps,\n tooltipProps,\n triggerProps,\n ],\n )\n\n return (\n <SidePanelComponentContext value={context}>\n {mobile ? (\n <Drawer.Root\n size=\"sm\"\n autoFocus={false}\n duration={!animated ? 0 : undefined}\n open={open}\n placement={`inline-${placement}`}\n withCloseButton={false}\n portalProps={{ disabled: true }}\n onClose={onClose}\n {...drawerProps}\n >\n <Drawer.Content>\n {customHeader ??\n (header ? <SidebarHeader>{header}</SidebarHeader> : null)}\n\n {customContent ??\n (content || items ? (\n <SidebarContent>{content}</SidebarContent>\n ) : null)}\n\n {customFooter ??\n (footer ? <SidebarFooter>{footer}</SidebarFooter> : null)}\n </Drawer.Content>\n </Drawer.Root>\n ) : (\n <>\n <SidebarGap\n data-animated={dataAttr(animated)}\n display={\n breakpoint\n ? { base: undefined, [breakpoint]: \"none\" }\n : undefined\n }\n />\n\n <styled.aside\n data-animated={dataAttr(animated)}\n data-group\n display={\n breakpoint\n ? { base: undefined, [breakpoint]: \"none\" }\n : undefined\n }\n {...getSidePanelProps(rest)}\n >\n {customHeader ??\n (header ? <SidebarHeader>{header}</SidebarHeader> : null)}\n {customContent ??\n (content || items ? (\n <SidebarContent>{content}</SidebarContent>\n ) : null)}\n {customFooter ??\n (footer ? <SidebarFooter>{footer}</SidebarFooter> : null)}\n {customHandle ?? (withHandle ? <SidebarHandle /> : null)}\n\n {omittedChildren}\n </styled.aside>\n </>\n )}\n </SidePanelComponentContext>\n )\n },\n \"sidePanel\",\n)()\n\ninterface SidebarGapProps extends HTMLStyledProps<\"div\"> {}\n\nconst SidebarGap = withContext<\"div\", SidebarGapProps>(\"div\", \"gap\")()\n\nexport interface SidebarHeaderProps extends HTMLStyledProps<\"header\"> {}\n\nexport const SidebarHeader = withContext<\"header\", SidebarHeaderProps>(\n \"header\",\n \"header\",\n)(undefined, (props) => {\n const { getHeaderProps } = useComponentContext()\n const { headerProps } = useSidePanelComponentContext()\n\n return getHeaderProps(mergeProps(headerProps, props)())\n})\n\nexport interface SidebarFooterProps extends HTMLStyledProps<\"footer\"> {}\n\nexport const SidebarFooter = withContext<\"footer\", SidebarFooterProps>(\n \"footer\",\n \"footer\",\n)(undefined, (props) => {\n const { getFooterProps } = useComponentContext()\n const { footerProps } = useSidePanelComponentContext()\n\n return getFooterProps(mergeProps(footerProps, props)())\n})\n\nexport interface SidebarContentProps extends HTMLStyledProps<\"ul\"> {\n /**\n * If provided, generate elements based on items.\n */\n items?: SidebarItem[]\n}\n\nexport const SidebarContent = withContext<\"ul\", SidebarContentProps>(\n ({ children, items, ...rest }) => {\n const { getContentProps } = useComponentContext()\n const { items: rootItems, contentProps } = useSidePanelComponentContext()\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return (items ?? rootItems)?.map((props, index) => {\n const key = createKey(props, index)\n\n if (\"group\" in props) {\n const { children, group: _, ...rest } = props\n\n return <SidebarGroup key={key} items={children} {...rest} />\n } else {\n const { children, ...rest } = props\n\n return <SidebarItem key={key} items={children} {...rest} />\n }\n })\n }, [children, items, rootItems])\n\n return (\n <styled.ul {...getContentProps(mergeProps(contentProps, rest)())}>\n {computedChildren}\n </styled.ul>\n )\n },\n \"content\",\n)()\n\nexport interface SidebarHandleProps extends HTMLStyledProps<\"button\"> {}\n\nexport const SidebarHandle = withContext<\"button\", SidebarHandleProps>(\n (props) => {\n const { handleProps } = useSidePanelComponentContext()\n\n return (\n <SidebarTrigger {...mergeProps(handleProps, props)()}>\n <styled.button tabIndex={-1} />\n </SidebarTrigger>\n )\n },\n \"handle\",\n)()\n\nexport interface SidebarGroupProps\n extends\n Omit<HTMLStyledProps<\"li\">, \"content\" | \"value\">,\n UseSidebarGroupProps {\n /**\n * If provided, generate elements based on items.\n */\n items?: SidebarItemWithValue[]\n /**\n * The label of the group.\n */\n label?: ReactNode\n /**\n * Props for the content component.\n */\n contentProps?: Omit<SidebarGroupContentProps, \"children\">\n /**\n * Props for the label component.\n */\n labelProps?: HTMLStyledProps<\"span\">\n}\n\nexport const SidebarGroup = withContext<\"li\", SidebarGroupProps>(\n ({\n children,\n items,\n label,\n value: valueProp = isString(label) ? label : undefined,\n contentProps,\n labelProps,\n ...rest\n }) => {\n const { groupProps } = useSidePanelComponentContext()\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return items?.map(({ children, ...rest }, index) => {\n const key = createKey(rest, index)\n\n return <SidebarItem key={key} items={children} {...rest} />\n })\n }, [children, items])\n const [omittedChildren, customLabel, customContent] = useSplitChildren(\n computedChildren,\n SidebarGroupLabel,\n SidebarGroupContent,\n )\n const { getContentProps, getLabelProps, getRootProps } = useSidebarGroup({\n ...mergeProps(groupProps, rest)(),\n value: valueProp,\n })\n const context = useMemo(\n () => ({ contentProps, getContentProps, getLabelProps, labelProps }),\n [getLabelProps, labelProps, getContentProps, contentProps],\n )\n\n return (\n <GroupComponentContext value={context}>\n <styled.li {...getRootProps()}>\n {customLabel ??\n (label ? <SidebarGroupLabel>{label}</SidebarGroupLabel> : null)}\n {customContent ?? (\n <SidebarGroupContent>{omittedChildren}</SidebarGroupContent>\n )}\n </styled.li>\n </GroupComponentContext>\n )\n },\n \"group\",\n)()\n\nexport interface SidebarGroupLabelProps extends HTMLStyledProps<\"span\"> {}\n\nexport const SidebarGroupLabel = withContext<\"span\", SidebarGroupLabelProps>(\n \"span\",\n \"groupLabel\",\n)(undefined, (props) => {\n const { getLabelProps, labelProps } = useGroupComponentContext()\n\n return getLabelProps(mergeProps(labelProps, props)())\n})\n\nexport interface SidebarGroupContentProps extends HTMLStyledProps<\"div\"> {}\n\nexport const SidebarGroupContent = withContext<\"div\", SidebarGroupContentProps>(\n \"div\",\n \"groupContent\",\n)(undefined, ({ children, ...rest }) => {\n const validChildren = useValidChildren(children)\n const list = useIncludesChildren(validChildren, SidebarItem)\n const { groupContentProps } = useSidePanelComponentContext()\n const { contentProps, getContentProps } = useGroupComponentContext()\n\n return {\n as: list ? \"ul\" : \"div\",\n children,\n ...getContentProps(mergeProps(groupContentProps, contentProps, rest)()),\n }\n})\n\nexport interface SidebarMenuProps extends HTMLStyledProps<\"div\"> {}\n\nexport const SidebarMenu = withContext<\"div\", SidebarMenuProps>(\"div\", \"menu\")(\n undefined,\n (props) => {\n const { menuProps } = useSidePanelComponentContext()\n\n return { \"data-menu\": \"\", ...mergeProps(menuProps, props)() }\n },\n)\n\nexport interface SidebarMenuButtonProps extends HTMLStyledProps<\"button\"> {}\n\nexport const SidebarMenuButton = withContext<\"button\", SidebarMenuButtonProps>(\n \"button\",\n [\"menu\", \"button\"],\n)(undefined, (props) => {\n const { open } = useSidebarContext()\n const { mode } = useComponentContext()\n const { menuProps } = useSidePanelComponentContext()\n const offcanvas = mode === \"offcanvas\"\n const { disabled, ...rest } = mergeProps(menuProps, props)()\n\n return {\n \"data-menu\": \"\",\n disabled,\n ...rest,\n tabIndex: (!offcanvas || open) && !disabled ? 0 : -1,\n }\n})\n\nexport interface SidebarItemProps\n extends\n Omit<HTMLStyledProps<\"li\">, \"value\">,\n Omit<UseSidebarItemProps, \"asyncChildren\"> {\n /**\n * The label to display in the item.\n */\n label: ReactNode\n /**\n * If `true`, the sidebar item will be animated.\n *\n * @default true\n */\n animated?: boolean\n /**\n * The element to display at the end of the item.\n */\n endElement?: SidebarItemReactNode\n /**\n * The sidebar item indicator icon to use.\n */\n indicator?: ReactNodeOrFunction<SidebarItemCallBackProps>\n /**\n * If provided, generate elements based on items.\n */\n items?: SidebarItemWithValue[]\n /**\n * The loading scheme.\n *\n * @default 'oval'\n */\n loadingScheme?: Loading.Scheme\n /**\n * If provided, the sidebar item will be rendered with custom components.\n */\n render?: SidebarItemRender\n /**\n * The element to display at the start of the item.\n */\n startElement?: SidebarItemReactNode\n /**\n * Props for the content component.\n */\n contentProps?: Omit<SidebarItemContentProps, \"children\">\n /**\n * Props for the end component.\n */\n endElementProps?: SidebarItemEndElementProps\n /**\n * Props for the indicator component.\n */\n indicatorProps?: SidebarItemIndicatorProps\n /**\n * Props for the label component.\n */\n labelProps?: SidebarItemLabelProps\n /**\n * Props for the link component.\n */\n linkProps?: SidebarItemLinkProps\n /**\n * Props for the start component.\n */\n startElementProps?: SidebarItemStartElementProps\n /**\n * Props for the tooltip component.\n */\n tooltipProps?: Omit<SidebarItemTooltipProps, \"children\" | \"content\">\n /**\n * Props for the trigger component.\n */\n triggerProps?: SidebarItemTriggerProps\n /**\n * If provided, the sidebar item will be rendered as an async sidebar item.\n */\n asyncChildren?: () => Promise<SidebarItemWithValue[]>\n}\n\nexport const SidebarItem = withContext<\"li\", SidebarItemProps>(\n ({\n animated: animatedProp,\n asyncChildren: asyncChildrenProp,\n children: childrenProp,\n endElement,\n indicator: indicatorProp,\n items,\n label,\n loadingScheme,\n render,\n startElement,\n contentProps,\n endElementProps,\n indicatorProps,\n labelProps,\n linkProps,\n startElementProps,\n tooltipProps,\n triggerProps,\n ...rest\n }) => {\n const { mode } = useComponentContext()\n const offcanvas = mode === \"offcanvas\"\n const componentContext = useSidePanelComponentContext()\n const Loading = useLoadingComponent(\n loadingScheme ?? componentContext.loadingScheme ?? \"oval\",\n )\n const computedChildren = useMemo(() => {\n if (childrenProp) return childrenProp\n\n return items?.map(({ children, ...rest }, index) => {\n const key = createKey(rest, index)\n\n return <SidebarItem key={key} items={children} {...rest} />\n })\n }, [childrenProp, items])\n const asyncChildren = useCallback(async () => {\n const items = await asyncChildrenProp?.()\n\n return items?.map(({ children, ...rest }, index) => {\n const key = createKey(rest, index)\n\n return <SidebarItem key={key} items={children} {...rest} />\n })\n }, [asyncChildrenProp])\n const {\n branchOpen,\n children,\n disabled,\n expanded,\n expandedValue,\n group,\n groupLoading,\n groupOpen,\n open,\n selected,\n selectedValue,\n value,\n getContentProps,\n getIndicatorProps,\n getItemProps,\n getLabelProps,\n getLinkProps,\n getTriggerProps,\n onExpandedChange,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n onSelectedChange,\n } = useSidebarItem({\n ...mergeProps(componentContext.itemProps, rest)(),\n asyncChildren: asyncChildrenProp ? asyncChildren : undefined,\n children: computedChildren,\n })\n const animated = animatedProp ?? componentContext.animated ?? true\n const tabIndex = offcanvas\n ? open && expanded && !disabled\n ? 0\n : -1\n : expanded && !disabled\n ? 0\n : -1\n const callbackProps = useMemo(\n () => ({ disabled, expanded: groupOpen }),\n [disabled, groupOpen],\n )\n const mergedTriggerProps = useMemo(() => {\n return getTriggerProps({\n tabIndex,\n ...mergeProps(componentContext.triggerProps, triggerProps)(),\n }) as SidebarItemTriggerProps\n }, [getTriggerProps, tabIndex, componentContext.triggerProps, triggerProps])\n const mergedLinkProps = useMemo(() => {\n return getLinkProps({\n tabIndex,\n ...mergeProps(componentContext.linkProps, linkProps)(),\n }) as SidebarItemLinkProps\n }, [getLinkProps, tabIndex, componentContext.linkProps, linkProps])\n const indicator = useMemo<ReactNode>(\n () => runIfFn(indicatorProp ?? componentContext.indicator, callbackProps),\n [indicatorProp, componentContext.indicator, callbackProps],\n )\n const groupStartElement = useMemo<ReactNode>(\n () =>\n runIfFn(\n getReactNodeOrFunction(\n \"group\",\n startElement,\n componentContext.startElement,\n ),\n callbackProps,\n ),\n [startElement, componentContext.startElement, callbackProps],\n )\n const groupEndElement = useMemo<ReactNode>(\n () =>\n runIfFn(\n getReactNodeOrFunction(\n \"group\",\n endElement,\n componentContext.endElement,\n ),\n callbackProps,\n ),\n [endElement, componentContext.endElement, callbackProps],\n )\n const itemStartElement = useMemo<ReactNode>(\n () =>\n runIfFn(\n getReactNodeOrFunction(\n \"item\",\n startElement,\n componentContext.startElement,\n ),\n callbackProps,\n ),\n [startElement, componentContext.startElement, callbackProps],\n )\n const itemEndElement = useMemo<ReactNode>(\n () =>\n runIfFn(\n getReactNodeOrFunction(\n \"item\",\n endElement,\n componentContext.endElement,\n ),\n callbackProps,\n ),\n [endElement, componentContext.endElement, callbackProps],\n )\n const trigger = useMemo<ReactNode>(\n () =>\n runIfFn(render?.trigger ?? componentContext.render?.trigger, {\n endElement: groupEndElement,\n expanded,\n expandedValue,\n groupLoading,\n groupOpen,\n indicator,\n label,\n selected,\n selectedValue,\n startElement: groupStartElement,\n value,\n triggerProps: mergedTriggerProps,\n onExpandedChange,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n onSelectedChange,\n }),\n [\n render?.trigger,\n componentContext.render?.trigger,\n groupEndElement,\n expanded,\n expandedValue,\n groupLoading,\n groupOpen,\n indicator,\n label,\n selected,\n selectedValue,\n groupStartElement,\n value,\n mergedTriggerProps,\n onExpandedChange,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n onSelectedChange,\n ],\n )\n const link = useMemo<ReactNode>(\n () =>\n runIfFn(render?.link ?? componentContext.render?.link, {\n endElement: itemEndElement,\n expanded,\n expandedValue,\n label,\n selected,\n selectedValue,\n startElement: itemStartElement,\n value,\n linkProps: mergedLinkProps,\n onExpandedChange,\n onSelectedChange,\n }),\n [\n render?.link,\n componentContext.render?.link,\n itemEndElement,\n expanded,\n expandedValue,\n label,\n selected,\n selectedValue,\n itemStartElement,\n value,\n mergedLinkProps,\n onExpandedChange,\n onSelectedChange,\n ],\n )\n const item = useMemo<ReactNode>(\n () =>\n runIfFn(render?.item ?? componentContext.render?.item, {\n children,\n endElement: { group: groupEndElement, item: itemEndElement },\n expanded,\n expandedValue,\n group,\n groupLoading,\n groupOpen,\n indicator,\n label,\n link,\n selected,\n selectedValue,\n startElement: { group: groupStartElement, item: itemStartElement },\n trigger,\n value,\n itemProps: getItemProps() as HTMLStyledProps<\"li\">,\n linkProps: mergedLinkProps,\n triggerProps: mergedTriggerProps,\n onExpandedChange,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n onSelectedChange,\n }),\n [\n render?.item,\n componentContext.render?.item,\n children,\n groupEndElement,\n itemEndElement,\n expanded,\n expandedValue,\n group,\n groupLoading,\n groupOpen,\n indicator,\n label,\n link,\n selected,\n selectedValue,\n groupStartElement,\n itemStartElement,\n trigger,\n value,\n getItemProps,\n mergedLinkProps,\n mergedTriggerProps,\n onExpandedChange,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n onSelectedChange,\n ],\n )\n const context = useMemo(\n () => ({ branchOpen, groupOpen }),\n [branchOpen, groupOpen],\n )\n const itemComponentContext = useMemo(\n () => ({\n contentProps: {\n duration: !animated ? 0 : undefined,\n open: groupOpen,\n ...getContentProps(\n mergeProps(componentContext.itemContentProps, contentProps)(),\n ),\n },\n endElementProps: mergeProps(\n componentContext.endElementProps,\n endElementProps,\n )(),\n indicatorProps: getIndicatorProps({\n \"data-animated\": dataAttr(animated),\n ...mergeProps(componentContext.indicatorProps, indicatorProps)(),\n }) as SidebarItemIndicatorProps,\n labelProps: getLabelProps(\n mergeProps(componentContext.labelProps, labelProps)(),\n ) as SidebarItemLabelProps,\n startElementProps: mergeProps(\n componentContext.startElementProps,\n startElementProps,\n )(),\n tooltipProps: {\n content: label,\n disabled: open,\n ...mergeProps(componentContext.tooltipProps, tooltipProps)(),\n },\n }),\n [\n animated,\n componentContext.endElementProps,\n componentContext.indicatorProps,\n componentContext.itemContentProps,\n componentContext.labelProps,\n componentContext.startElementProps,\n componentContext.tooltipProps,\n contentProps,\n endElementProps,\n getContentProps,\n getIndicatorProps,\n getLabelProps,\n groupOpen,\n indicatorProps,\n label,\n labelProps,\n open,\n startElementProps,\n tooltipProps,\n ],\n )\n\n return (\n <SidebarItemContext value={context}>\n <ItemComponentContext value={itemComponentContext}>\n {item ?? (\n <styled.li {...getItemProps()}>\n {group ? (\n <>\n {trigger ?? (\n <SidebarItemTrigger {...mergedTriggerProps}>\n {groupStartElement ? (\n <SidebarItemStartElement>\n {groupStartElement}\n </SidebarItemStartElement>\n ) : null}\n {label ? (\n <SidebarItemLabel>{label}</SidebarItemLabel>\n ) : null}\n {groupEndElement ? (\n <SidebarItemEndElement>\n {groupEndElement}\n </SidebarItemEndElement>\n ) : null}\n <SidebarItemIndicator>\n {groupLoading ? (\n <Loading />\n ) : (\n runIfFn(indicator, callbackProps)\n )}\n </SidebarItemIndicator>\n </SidebarItemTrigger>\n )}\n\n <SidebarItemContent>{children}</SidebarItemContent>\n </>\n ) : (\n (link ?? (\n <SidebarItemLink {...mergedLinkProps}>\n {itemStartElement ? (\n <SidebarItemStartElement>\n {itemStartElement}\n </SidebarItemStartElement>\n ) : null}\n {label ? (\n <SidebarItemLabel>{label}</SidebarItemLabel>\n ) : null}\n {itemEndElement ? (\n <SidebarItemEndElement>\n {itemEndElement}\n </SidebarItemEndElement>\n ) : null}\n </SidebarItemLink>\n ))\n )}\n </styled.li>\n )}\n </ItemComponentContext>\n </SidebarItemContext>\n )\n },\n \"item\",\n)()\n\ninterface SidebarItemTooltipProps extends TooltipProps {}\n\nconst SidebarItemTooltip: FC<SidebarItemTooltipProps> = (props) => {\n const { tooltipProps } = useItemComponentContext()\n const { children, disabled, ...rest } = mergeProps(tooltipProps, props)()\n const { mode, placement } = useComponentContext()\n const offcanvas = mode === \"offcanvas\"\n\n if (offcanvas || disabled) return children\n else\n return (\n <Tooltip\n closeOnClick={false}\n gutter={16}\n placement={`center-${placement === \"start\" ? \"end\" : \"start\"}`}\n {...rest}\n >\n {children}\n </Tooltip>\n )\n}\n\nexport interface SidebarItemTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const SidebarItemTrigger = withContext<\n \"button\",\n SidebarItemTriggerProps\n>((props) => {\n return (\n <SidebarItemTooltip>\n <styled.button {...props} />\n </SidebarItemTooltip>\n )\n}, \"itemTrigger\")()\n\nexport interface SidebarItemLinkProps extends HTMLStyledProps<\"a\"> {}\n\nexport const SidebarItemLink = withContext<\"a\", SidebarItemLinkProps>(\n (props) => {\n return (\n <SidebarItemTooltip>\n <styled.a {...props} />\n </SidebarItemTooltip>\n )\n },\n \"itemLink\",\n)()\n\nexport interface SidebarItemContentProps\n extends\n Omit<HTMLStyledProps<\"ul\">, \"transition\">,\n Pick<CollapseProps, \"animationOpacity\" | keyof WithTransitionProps> {}\n\nexport const SidebarItemContent = withContext<\"ul\", SidebarItemContentProps>(\n (props) => {\n const { contentProps } = useItemComponentContext()\n\n return (\n <Collapse\n as=\"ul\"\n {...cast<CollapseProps>(mergeProps(contentProps, props)())}\n />\n )\n },\n \"itemContent\",\n)()\n\nexport interface SidebarItemIndicatorProps extends HTMLStyledProps<\"svg\"> {}\n\nexport const SidebarItemIndicator = withContext<\n \"svg\",\n SidebarItemIndicatorProps\n>(({ children = <ChevronRightIcon />, ...rest }) => {\n const { indicatorHidden } = useSidePanelComponentContext()\n\n if (indicatorHidden) return null\n\n if (isValidElement<HTMLProps<\"svg\">>(children))\n return cloneElement(children, { ...rest, ...children.props })\n\n return Children.count(children) > 1 ? Children.only(null) : null\n}, \"itemIndicator\")(undefined, (props) => {\n const { indicatorProps } = useItemComponentContext()\n\n return mergeProps(indicatorProps, props)()\n})\n\nexport interface SidebarItemStartElementProps extends HTMLStyledProps {}\n\nexport const SidebarItemStartElement = withContext<\n \"div\",\n SidebarItemStartElementProps\n>(\"div\", {\n name: \"ItemStartElement\",\n slot: [\"itemElement\", \"start\"],\n})(undefined, (props) => {\n const { startElementProps } = useItemComponentContext()\n\n return mergeProps(startElementProps, props)()\n})\n\nexport interface SidebarItemEndElementProps extends HTMLStyledProps {}\n\nexport const SidebarItemEndElement = withContext<\n \"div\",\n SidebarItemEndElementProps\n>(\"div\", {\n name: \"ItemEndElement\",\n slot: [\"itemElement\", \"end\"],\n})(undefined, (props) => {\n const { endElementProps } = useItemComponentContext()\n\n return mergeProps(endElementProps, props)()\n})\n\nexport interface SidebarItemLabelProps extends HTMLStyledProps<\"span\"> {}\n\nexport const SidebarItemLabel = withContext<\"span\", SidebarItemLabelProps>(\n \"span\",\n \"itemLabel\",\n)(undefined, (props) => {\n const { labelProps } = useItemComponentContext()\n\n return mergeProps(labelProps, props)()\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA0JA,MAAM,aAAa,OAAoB,UAAkB;CACvD,OAAO,WAAW,QAAQ,MAAM,SAAS,QAAQ;AACnD;AAEA,MAAM,0BACJ,MACA,QACA,SACkD;CAClD,KAAA,GAAA,oBAAA,cAAA,SAAA,CAAa,MAAM,MAAM,WAAW,UAAU,UAAU,SACtD,OAAO,OAAO;MACX,IAAI,QAAQ,OAAO;MACnB,KAAA,GAAA,oBAAA,cAAA,SAAA,CAAa,IAAI,MAAM,WAAW,QAAQ,UAAU,OACvD,OAAO,KAAK;MACT,OAAO;AACd;AAoBA,MAAM,CAAC,uBAAuB,4BAC5BA,gBAAAA,cAAqC,EAAE,MAAM,wBAAwB,CAAC;AAWxE,MAAM,CAAC,sBAAsB,2BAC3BA,gBAAAA,cAAoC,EAAE,MAAM,uBAAuB,CAAC;AA8BtE,MAAM,CAAC,2BAA2B,gCAChCA,gBAAAA,cAAyC,EACvC,MAAM,4BACR,CAAC;AAeH,MAAM,EACJ,kBACA,cAAc,qBACd,qBACA,iBAAiB,wBACjB,aACA,iBACEC,yBAAAA,oBACF,WACAC,sBAAAA,YACF;;;;;;AASA,MAAa,cAAc,cAKxB,EACC,aAAa,MACb,MAAM,WAAW,aACjB,WAAW,gBAAgB,SAC3B,GAAG,WACC;CACJ,MAAM,SACJC,6BAAAA,mBACE,aAAa,GAAG,aAAa,KAAK,IAAI,EAAE,MAAM,MAAM,CACtD,KAAK;CACP,MAAM,OAAOC,8BAAAA,SAAS,QAAQ;CAC9B,MAAM,YAAYA,8BAAAA,SAAS,aAAa;CACxC,MAAM,EACJ,aACA,eACA,MACA,eACA,iBACA,gBACA,gBACA,cACA,mBACA,iBACA,SACA,kBACA,QACA,kBACA,aACEC,oBAAAA,WAAW;EAAE;EAAQ,GAAG;CAAK,CAAC;CAgDlC,OACE,iB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AAC;AAID,MAAa,mBAAmB,YAC9B,QACA,WACF,CAAC,CAAC,KAAA,IAAY,UAAU;CACtB,MAAM,EAAE,eAAe,wBAAwB;CAE/C,OAAOA,cAAAA,WAAW,YAAY,KAAK,CAAC,CAAC;AACvC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-sidebar.cjs","names":["createDescendants","createContext","useI18n","useDisclosure","useControllableState","mergeProps","useEnvironment","mergeRefs","useIds","Children","useAsyncCallback"],"sources":["../../../../src/components/sidebar/use-sidebar.ts"],"sourcesContent":["\"use client\"\n\nimport type { ReactNode, RefObject } from \"react\"\nimport { Children, useCallback, useId, useRef, useState } from \"react\"\nimport {\n type HTMLProps,\n mergeProps,\n type PropGetter,\n useEnvironment,\n} from \"../../core\"\nimport { useAsyncCallback } from \"../../hooks/use-async-callback\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { createDescendants } from \"../../hooks/use-descendants\"\nimport {\n useDisclosure,\n type UseDisclosureProps,\n} from \"../../hooks/use-disclosure\"\nimport { useWindowEvent } from \"../../hooks/use-window-event\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport {\n ariaAttr,\n assignRef,\n createContext,\n cx,\n dataAttr,\n handlerAll,\n mergeRefs,\n setAttribute,\n useIds,\n useSafeLayoutEffect,\n} from \"../../utils\"\n\nexport interface SidebarControl {\n collapse: () => void\n expand: () => void\n}\n\ninterface SidebarDescendantProps {\n expanded: boolean\n group: boolean\n id: string\n value: string\n}\n\nconst {\n DescendantsContext: SidebarDescendantsContext,\n useDescendant: useSidebarDescendant,\n useDescendants: useSidebarDescendants,\n} = createDescendants<HTMLElement, SidebarDescendantProps>()\n\nexport {\n SidebarDescendantsContext,\n useSidebarDescendant,\n useSidebarDescendants,\n}\n\ninterface SidebarContext extends Pick<\n UseSidebarReturn,\n | \"expandedValue\"\n | \"mobile\"\n | \"onClose\"\n | \"onExpandedChange\"\n | \"onOpen\"\n | \"onSelectedChange\"\n | \"onToggle\"\n | \"open\"\n | \"selectedValue\"\n> {}\n\nconst [SidebarContext, useSidebarContext] = createContext<SidebarContext>({\n name: \"SidebarContext\",\n})\n\nexport { SidebarContext, useSidebarContext }\n\ninterface SidebarItemContext extends Pick<\n UseSidebarItemReturn,\n \"branchOpen\" | \"groupOpen\"\n> {}\n\nconst [SidebarItemContext, useSidebarItemContext] =\n createContext<SidebarItemContext>({\n name: \"SidebarItemContext\",\n strict: false,\n })\n\nexport { SidebarItemContext, useSidebarItemContext }\n\nexport interface UseSidebarProps extends HTMLProps<\"div\"> {\n /**\n * Ref of the sidebar callbacks.\n */\n controlRef?: RefObject<null | SidebarControl>\n /**\n * The initial expanded value of the sidebar.\n */\n defaultExpandedValue?: string[]\n /**\n * The initial selected value of the sidebar.\n */\n defaultSelectedValue?: string\n /**\n * The disclosure props for the desktop and mobile.\n */\n disclosure?: {\n desktop?: Omit<UseDisclosureProps, \"timing\">\n mobile?: Omit<UseDisclosureProps, \"timing\">\n }\n /**\n * The expanded value of the sidebar.\n */\n expandedValue?: string[]\n /**\n * If `true`, the trigger click event will be switched to mobile.\n *\n * @default false\n */\n mobile?: boolean\n /**\n * The selected value of the sidebar.\n */\n selectedValue?: string\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: string) => void\n}\n\nexport const useSidebar = ({\n controlRef,\n defaultExpandedValue = [],\n defaultSelectedValue,\n disclosure,\n expandedValue: expandedValueProp,\n mobile = false,\n selectedValue: selectedValueProp,\n onExpandedChange: onExpandedChangeProp,\n onSelectedChange: onSelectedChangeProp,\n ...rest\n}: UseSidebarProps = {}) => {\n const { t } = useI18n(\"sidebar\")\n const desktopDisclosure = useDisclosure({\n defaultOpen: disclosure?.desktop?.defaultOpen ?? true,\n open: disclosure?.desktop?.open,\n onClose: disclosure?.desktop?.onClose,\n onOpen: disclosure?.desktop?.onOpen,\n })\n const mobileDisclosure = useDisclosure({\n defaultOpen: disclosure?.mobile?.defaultOpen ?? false,\n open: disclosure?.mobile?.open,\n onClose: disclosure?.mobile?.onClose,\n onOpen: disclosure?.mobile?.onOpen,\n })\n const [selectedValue, setSelectedValue] = useControllableState({\n defaultValue: defaultSelectedValue,\n value: selectedValueProp,\n onChange: onSelectedChangeProp,\n })\n const [expandedValue, setExpandedValue] = useControllableState({\n defaultValue: defaultExpandedValue,\n value: expandedValueProp,\n onChange: onExpandedChangeProp,\n })\n const descendants = useSidebarDescendants()\n const open = mobile ? mobileDisclosure.open : desktopDisclosure.open\n const onOpen = mobile ? mobileDisclosure.onOpen : desktopDisclosure.onOpen\n const onClose = mobile ? mobileDisclosure.onClose : desktopDisclosure.onClose\n const onToggle = mobile\n ? mobileDisclosure.onToggle\n : desktopDisclosure.onToggle\n\n const onSelectedChange = useCallback(\n (value: string) => {\n setSelectedValue(value)\n },\n [setSelectedValue],\n )\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 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 assignRef(controlRef, { collapse: onCollapseAll, expand: onExpandAll })\n\n useWindowEvent(\"keydown\", (ev) => {\n if (ev.key !== \"b\") return\n if (!ev.metaKey && !ev.ctrlKey) return\n\n ev.preventDefault()\n\n desktopDisclosure.onToggle()\n })\n\n const getRootProps: PropGetter<\"div\"> = useCallback(\n (props = {}) =>\n mergeProps({ \"data-expanded\": dataAttr(open) }, rest, props)(),\n [open, rest],\n )\n\n const getTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n \"aria-expanded\": open,\n \"aria-label\": t(open ? \"Close sidebar\" : \"Open sidebar\"),\n ...props,\n onClick: handlerAll(props.onClick, onToggle),\n }),\n [open, t, onToggle],\n )\n\n const getSidePanelProps: PropGetter<\"aside\"> = useCallback(\n (props = {}) => ({ \"data-expanded\": dataAttr(open), ...props }),\n [open],\n )\n\n const getHeaderProps: PropGetter<\"header\"> = useCallback(\n (props = {}) => ({ ...props }),\n [],\n )\n\n const getFooterProps: PropGetter<\"footer\"> = useCallback(\n (props = {}) => ({ ...props }),\n [],\n )\n\n const getContentProps: PropGetter<\"ul\"> = useCallback(\n (props = {}) => ({ ...props }),\n [],\n )\n\n return {\n descendants,\n expandedValue,\n mobile,\n open,\n selectedValue,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getRootProps,\n getSidePanelProps,\n getTriggerProps,\n onClose,\n onExpandedChange,\n onOpen,\n onSelectedChange,\n onToggle,\n }\n}\n\nexport type UseSidebarReturn = ReturnType<typeof useSidebar>\n\nexport interface UseSidebarGroupProps extends HTMLProps<\"li\"> {}\n\nexport const useSidebarGroup = ({ ...rest }: UseSidebarGroupProps = {}) => {\n const { getDocument } = useEnvironment()\n const rootRef = useRef<HTMLLIElement>(null)\n const contentRef = useRef<HTMLDivElement>(null)\n const labelId = useId()\n\n useSafeLayoutEffect(() => {\n const el = getDocument()?.getElementById(labelId)\n\n if (!el) return\n\n if (rootRef.current)\n setAttribute(rootRef.current, \"aria-labelledby\", labelId)\n if (contentRef.current)\n setAttribute(contentRef.current, \"aria-labelledby\", labelId)\n }, [])\n\n const getRootProps: PropGetter<\"li\"> = useCallback(\n ({ ref, ...props } = {}) =>\n mergeProps({ ref }, rest, props, { ref: rootRef })(),\n [rest, rootRef],\n )\n\n const getLabelProps: PropGetter<\"span\"> = useCallback(\n (props = {}) => ({ id: labelId, ...props }),\n [labelId],\n )\n\n const getContentProps: PropGetter<\"div\"> = useCallback(\n ({ ref, ...props } = {}) => ({\n ref: mergeRefs(ref, contentRef),\n ...props,\n }),\n [],\n )\n\n return { getContentProps, getLabelProps, getRootProps }\n}\n\nexport type UseSidebarGroupReturn = ReturnType<typeof useSidebarGroup>\n\nexport interface UseSidebarItemProps\n extends HTMLProps<\"li\">, Omit<UseDisclosureProps, \"timing\"> {\n /**\n * The value of the item.\n */\n value: string\n /**\n * If `true`, the tree item will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * If `true`, the link will open in new tab.\n *\n * @default false\n */\n external?: boolean\n /**\n * If provided, the sidebar item will be rendered as an async sidebar item.\n */\n asyncChildren?: () => Promise<ReactNode>\n}\n\nexport const useSidebarItem = ({\n asyncChildren,\n children: childrenProp,\n defaultOpen,\n disabled = false,\n external,\n open: openProp,\n value,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n ...rest\n}: UseSidebarItemProps) => {\n const context = useSidebarItemContext()\n const {\n expandedValue,\n open,\n selectedValue,\n onExpandedChange,\n onSelectedChange,\n } = useSidebarContext()\n const [children, setChildren] = useState<ReactNode>(childrenProp)\n const [itemId, labelId, contentId] = useIds()\n const initialAsyncRef = useRef(false)\n const async = !!asyncChildren\n const group = async || Children.count(children) > 0\n const nested = !!context\n const selected = !!value && selectedValue === 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 expanded = branchOpen.slice(0, -1).every(Boolean)\n const { register } = useSidebarDescendant({\n id: itemId!,\n disabled,\n expanded,\n group,\n value,\n })\n\n const [groupLoading, onGroupChildren] = useAsyncCallback(async () => {\n const children = await asyncChildren?.()\n\n setChildren(children)\n }, [asyncChildren])\n\n const onGroupOpen = useCallback(() => {\n if (disabled || !group || !value || groupLoading) 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 }, [\n disabled,\n group,\n value,\n groupLoading,\n async,\n onGroupChildren,\n onOpen,\n onExpandedChange,\n ])\n\n const onGroupClose = useCallback(() => {\n if (disabled || !group || !value) return\n\n onClose()\n onExpandedChange(value)\n }, [disabled, group, value, onClose, onExpandedChange])\n\n const onGroupToggle = useCallback(() => {\n if (groupOpen) {\n onGroupClose()\n } else {\n onGroupOpen()\n }\n }, [groupOpen, onGroupClose, onGroupOpen])\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 }, [defaultExpanded])\n\n const getItemProps: PropGetter<\"li\"> = useCallback(\n ({ ref, \"aria-labelledby\": ariaLabelledby, ...props } = {}) => {\n const merged = mergeProps(\n {\n id: itemId,\n \"aria-current\": selected ? \"page\" : undefined,\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-labelledby\": cx(ariaLabelledby, labelId),\n \"data-disabled\": dataAttr(disabled),\n \"data-selected\": dataAttr(selected),\n },\n rest,\n props,\n { ref },\n { ref: register },\n )()\n\n return {\n ...merged,\n onClick: handlerAll(\n merged.onClick,\n !group ? () => onSelectedChange(value) : undefined,\n ),\n }\n },\n [\n itemId,\n register,\n selected,\n disabled,\n labelId,\n rest,\n group,\n onSelectedChange,\n value,\n ],\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, groupLoading, selected],\n )\n\n const getTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n \"aria-controls\": contentId,\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-expanded\": groupOpen,\n \"data-disabled\": dataAttr(disabled),\n \"data-expanded\": dataAttr(groupOpen),\n \"data-selected\": dataAttr(selected),\n tabIndex: open && expanded && !disabled ? 0 : -1,\n ...props,\n onClick: handlerAll(props.onClick, onGroupToggle),\n }),\n [contentId, disabled, groupOpen, selected, open, expanded, onGroupToggle],\n )\n\n const getLinkProps: PropGetter<\"a\"> = useCallback(\n (props = {}) => ({\n href: value,\n rel: external ? \"noopener\" : undefined,\n target: external ? \"_blank\" : undefined,\n \"data-disabled\": dataAttr(disabled),\n \"data-selected\": dataAttr(selected),\n tabIndex: open && expanded && !disabled ? 0 : -1,\n ...props,\n onClick: handlerAll(props.onClick, (ev) => {\n if (!disabled) return\n\n ev.preventDefault()\n ev.stopPropagation()\n }),\n }),\n [disabled, expanded, external, open, selected, value],\n )\n\n const getContentProps: PropGetter<\"ul\"> = useCallback(\n ({ \"aria-labelledby\": ariaLabelledby, ...props } = {}) => ({\n id: contentId,\n \"aria-busy\": ariaAttr(groupLoading),\n \"aria-labelledby\": cx(ariaLabelledby, labelId),\n \"data-disabled\": dataAttr(disabled),\n ...props,\n }),\n [contentId, 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 children,\n disabled,\n expanded,\n expandedValue,\n group,\n groupLoading,\n groupOpen,\n open,\n selected,\n selectedValue,\n value,\n getContentProps,\n getIndicatorProps,\n getItemProps,\n getLabelProps,\n getLinkProps,\n getTriggerProps,\n onExpandedChange,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n onSelectedChange,\n }\n}\n\nexport type UseSidebarItemReturn = ReturnType<typeof useSidebarItem>\n"],"mappings":";;;;;;;;;;;;;;;;AA4CA,MAAM,EACJ,oBAAoB,2BACpB,eAAe,s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A,MAAM,gBAAA,GAAA,MAAA,YAAA,EACH,QAAQ,CAAC,OAAO;EACf,MAAM;EACN,KAAK,WAAW,aAAa,KAAA;EAC7B,QAAQ,WAAW,WAAW,KAAA;EAC9B,kBAAA,GAAA,oBAAA,cAAA,SAAA,CAA0B,QAAQ;EAClC,kBAAA,GAAA,oBAAA,cAAA,SAAA,CAA0B,QAAQ;EAClC,UAAU,QAAQ,YAAY,CAAC,WAAW,IAAI;EAC9C,GAAG;EACH,UAAA,GAAA,oBAAA,cAAA,WAAA,CAAoB,MAAM,UAAU,OAAO;GACzC,IAAI,CAAC,UAAU;GAEf,GAAG,eAAe;GAClB,GAAG,gBAAgB;EACrB,CAAC;CACH,IACA;EAAC;EAAU;EAAU;EAAU;EAAM;EAAU;CAAK,CACtD;CAkBA,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,kBAAA,GAAA,MAAA,YAAA,EA5BC,EAAE,mBAAmB,gBAAgB,GAAG,UAAU,CAAC,OAAO;GACzD,IAAI;GACJ,cAAA,GAAA,oBAAA,cAAA,SAAA,CAAsB,YAAY;GAClC,oBAAA,GAAA,oBAAA,cAAA,GAAA,CAAsB,gBAAgB,OAAO;GAC7C,kBAAA,GAAA,oBAAA,cAAA,SAAA,CAA0B,QAAQ;GAClC,GAAG;EACL,IACA;GAAC;GAAW;GAAS;GAAU;EAAY,CAqB7B;EACd;EACA;EACA,gBAAA,GAAA,MAAA,YAAA,EApBC,QAAQ,CAAC,OAAO;GAAE,IAAI;GAAS,GAAG;EAAM,IACzC,CAAC,OAAO,CAmBI;EACZ;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"use-sidebar.cjs","names":["createDescendants","createContext","useI18n","useDisclosure","useControllableState","mergeProps","useEnvironment","mergeRefs","useIds","Children","useAsyncCallback"],"sources":["../../../../src/components/sidebar/use-sidebar.ts"],"sourcesContent":["\"use client\"\n\nimport type { ReactNode, RefObject } from \"react\"\nimport { Children, useCallback, useId, useRef, useState } from \"react\"\nimport {\n type HTMLProps,\n mergeProps,\n type PropGetter,\n useEnvironment,\n} from \"../../core\"\nimport { useAsyncCallback } from \"../../hooks/use-async-callback\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { createDescendants } from \"../../hooks/use-descendants\"\nimport {\n useDisclosure,\n type UseDisclosureProps,\n} from \"../../hooks/use-disclosure\"\nimport { useWindowEvent } from \"../../hooks/use-window-event\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport {\n ariaAttr,\n assignRef,\n createContext,\n cx,\n dataAttr,\n handlerAll,\n mergeRefs,\n setAttribute,\n useIds,\n useSafeLayoutEffect,\n} from \"../../utils\"\n\nexport interface SidebarControl {\n collapse: () => void\n expand: () => void\n}\n\ninterface SidebarDescendantProps {\n expanded: boolean\n group: boolean\n id: string\n value: string\n}\n\nconst {\n DescendantsContext: SidebarDescendantsContext,\n useDescendant: useSidebarDescendant,\n useDescendants: useSidebarDescendants,\n} = createDescendants<HTMLElement, SidebarDescendantProps>()\n\nexport {\n SidebarDescendantsContext,\n useSidebarDescendant,\n useSidebarDescendants,\n}\n\ninterface SidebarContext extends Pick<\n UseSidebarReturn,\n | \"expandedValue\"\n | \"mobile\"\n | \"onClose\"\n | \"onExpandedChange\"\n | \"onOpen\"\n | \"onSelectedChange\"\n | \"onToggle\"\n | \"open\"\n | \"selectedValue\"\n> {}\n\nconst [SidebarContext, useSidebarContext] = createContext<SidebarContext>({\n name: \"SidebarContext\",\n})\n\nexport { SidebarContext, useSidebarContext }\n\ninterface SidebarItemContext extends Pick<\n UseSidebarItemReturn,\n \"branchOpen\" | \"groupOpen\"\n> {}\n\nconst [SidebarItemContext, useSidebarItemContext] =\n createContext<SidebarItemContext>({\n name: \"SidebarItemContext\",\n strict: false,\n })\n\nexport { SidebarItemContext, useSidebarItemContext }\n\nexport interface UseSidebarProps extends HTMLProps<\"div\"> {\n /**\n * Ref of the sidebar callbacks.\n */\n controlRef?: RefObject<null | SidebarControl>\n /**\n * The initial expanded value of the sidebar.\n */\n defaultExpandedValue?: string[]\n /**\n * The initial selected value of the sidebar.\n */\n defaultSelectedValue?: string\n /**\n * The disclosure props for the desktop and mobile.\n */\n disclosure?: {\n desktop?: Omit<UseDisclosureProps, \"timing\">\n mobile?: Omit<UseDisclosureProps, \"timing\">\n }\n /**\n * The expanded value of the sidebar.\n */\n expandedValue?: string[]\n /**\n * If `true`, the trigger click event will be switched to mobile.\n *\n * @default false\n */\n mobile?: boolean\n /**\n * The selected value of the sidebar.\n */\n selectedValue?: string\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: string) => void\n}\n\nexport const useSidebar = ({\n controlRef,\n defaultExpandedValue = [],\n defaultSelectedValue,\n disclosure,\n expandedValue: expandedValueProp,\n mobile = false,\n selectedValue: selectedValueProp,\n onExpandedChange: onExpandedChangeProp,\n onSelectedChange: onSelectedChangeProp,\n ...rest\n}: UseSidebarProps = {}) => {\n const { t } = useI18n(\"sidebar\")\n const desktopDisclosure = useDisclosure({\n defaultOpen: disclosure?.desktop?.defaultOpen ?? true,\n open: disclosure?.desktop?.open,\n onClose: disclosure?.desktop?.onClose,\n onOpen: disclosure?.desktop?.onOpen,\n })\n const mobileDisclosure = useDisclosure({\n defaultOpen: disclosure?.mobile?.defaultOpen ?? false,\n open: disclosure?.mobile?.open,\n onClose: disclosure?.mobile?.onClose,\n onOpen: disclosure?.mobile?.onOpen,\n })\n const [selectedValue, setSelectedValue] = useControllableState({\n defaultValue: defaultSelectedValue,\n value: selectedValueProp,\n onChange: onSelectedChangeProp,\n })\n const [expandedValue, setExpandedValue] = useControllableState({\n defaultValue: defaultExpandedValue,\n value: expandedValueProp,\n onChange: onExpandedChangeProp,\n })\n const descendants = useSidebarDescendants()\n const open = mobile ? mobileDisclosure.open : desktopDisclosure.open\n const onOpen = mobile ? mobileDisclosure.onOpen : desktopDisclosure.onOpen\n const onClose = mobile ? mobileDisclosure.onClose : desktopDisclosure.onClose\n const onToggle = mobile\n ? mobileDisclosure.onToggle\n : desktopDisclosure.onToggle\n\n const onSelectedChange = useCallback(\n (value: string) => {\n setSelectedValue(value)\n },\n [setSelectedValue],\n )\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 onExpandedChange = useCallback(\n (value: string) => {\n setExpandedValue((prev) => {\n if (prev.includes(value))\n return prev.filter((prevValue) => prevValue !== value)\n else return [...prev, value]\n })\n },\n [setExpandedValue],\n )\n\n assignRef(controlRef, { collapse: onCollapseAll, expand: onExpandAll })\n\n useWindowEvent(\"keydown\", (ev) => {\n if (ev.key !== \"b\") return\n if (!ev.metaKey && !ev.ctrlKey) return\n\n ev.preventDefault()\n\n desktopDisclosure.onToggle()\n })\n\n const getRootProps: PropGetter<\"div\"> = useCallback(\n (props = {}) =>\n mergeProps({ \"data-expanded\": dataAttr(open) }, rest, props)(),\n [open, rest],\n )\n\n const getTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n \"aria-expanded\": open,\n \"aria-label\": t(open ? \"Close sidebar\" : \"Open sidebar\"),\n ...props,\n onClick: handlerAll(props.onClick, onToggle),\n }),\n [open, t, onToggle],\n )\n\n const getSidePanelProps: PropGetter<\"aside\"> = useCallback(\n (props = {}) => ({ \"data-expanded\": dataAttr(open), ...props }),\n [open],\n )\n\n const getHeaderProps: PropGetter<\"header\"> = useCallback(\n (props = {}) => ({ ...props }),\n [],\n )\n\n const getFooterProps: PropGetter<\"footer\"> = useCallback(\n (props = {}) => ({ ...props }),\n [],\n )\n\n const getContentProps: PropGetter<\"ul\"> = useCallback(\n (props = {}) => ({ ...props }),\n [],\n )\n\n return {\n descendants,\n expandedValue,\n mobile,\n open,\n selectedValue,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getRootProps,\n getSidePanelProps,\n getTriggerProps,\n onClose,\n onExpandedChange,\n onOpen,\n onSelectedChange,\n onToggle,\n }\n}\n\nexport type UseSidebarReturn = ReturnType<typeof useSidebar>\n\nexport interface UseSidebarGroupProps extends HTMLProps<\"li\"> {}\n\nexport const useSidebarGroup = ({ ...rest }: UseSidebarGroupProps = {}) => {\n const { getDocument } = useEnvironment()\n const rootRef = useRef<HTMLLIElement>(null)\n const contentRef = useRef<HTMLDivElement>(null)\n const labelId = useId()\n\n useSafeLayoutEffect(() => {\n const el = getDocument()?.getElementById(labelId)\n\n if (!el) return\n\n if (rootRef.current)\n setAttribute(rootRef.current, \"aria-labelledby\", labelId)\n if (contentRef.current)\n setAttribute(contentRef.current, \"aria-labelledby\", labelId)\n }, [])\n\n const getRootProps: PropGetter<\"li\"> = useCallback(\n ({ ref, ...props } = {}) =>\n mergeProps({ ref }, rest, props, { ref: rootRef })(),\n [rest, rootRef],\n )\n\n const getLabelProps: PropGetter<\"span\"> = useCallback(\n (props = {}) => ({ id: labelId, ...props }),\n [labelId],\n )\n\n const getContentProps: PropGetter<\"div\"> = useCallback(\n ({ ref, ...props } = {}) => ({\n ref: mergeRefs(ref, contentRef),\n ...props,\n }),\n [],\n )\n\n return { getContentProps, getLabelProps, getRootProps }\n}\n\nexport type UseSidebarGroupReturn = ReturnType<typeof useSidebarGroup>\n\nexport interface UseSidebarItemProps\n extends HTMLProps<\"li\">, Omit<UseDisclosureProps, \"timing\"> {\n /**\n * The value of the item.\n */\n value: string\n /**\n * If `true`, the tree item will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * If `true`, the link will open in new tab.\n *\n * @default false\n */\n external?: boolean\n /**\n * If provided, the sidebar item will be rendered as an async sidebar item.\n */\n asyncChildren?: () => Promise<ReactNode>\n}\n\nexport const useSidebarItem = ({\n asyncChildren,\n children: childrenProp,\n defaultOpen,\n disabled = false,\n external,\n open: openProp,\n value,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n ...rest\n}: UseSidebarItemProps) => {\n const context = useSidebarItemContext()\n const {\n expandedValue,\n open,\n selectedValue,\n onExpandedChange,\n onSelectedChange,\n } = useSidebarContext()\n const [children, setChildren] = useState<ReactNode>(childrenProp)\n const [itemId, labelId, contentId] = useIds()\n const initialAsyncRef = useRef(false)\n const async = !!asyncChildren\n const group = async || Children.count(children) > 0\n const nested = !!context\n const selected = !!value && selectedValue === 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 expanded = branchOpen.slice(0, -1).every(Boolean)\n const { register } = useSidebarDescendant({\n id: itemId!,\n disabled,\n expanded,\n group,\n value,\n })\n\n const [groupLoading, onGroupChildren] = useAsyncCallback(async () => {\n const children = await asyncChildren?.()\n\n setChildren(children)\n }, [asyncChildren])\n\n const onGroupOpen = useCallback(() => {\n if (disabled || !group || !value || groupLoading) 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 }, [\n disabled,\n group,\n value,\n groupLoading,\n async,\n onGroupChildren,\n onOpen,\n onExpandedChange,\n ])\n\n const onGroupClose = useCallback(() => {\n if (disabled || !group || !value) return\n\n onClose()\n onExpandedChange(value)\n }, [disabled, group, value, onClose, onExpandedChange])\n\n const onGroupToggle = useCallback(() => {\n if (groupOpen) onGroupClose()\n else onGroupOpen()\n }, [groupOpen, onGroupClose, onGroupOpen])\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 onClose()\n }, [defaultExpanded])\n\n const getItemProps: PropGetter<\"li\"> = useCallback(\n ({ ref, \"aria-labelledby\": ariaLabelledby, ...props } = {}) => {\n const merged = mergeProps(\n {\n id: itemId,\n \"aria-current\": selected ? \"page\" : undefined,\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-labelledby\": cx(ariaLabelledby, labelId),\n \"data-disabled\": dataAttr(disabled),\n \"data-selected\": dataAttr(selected),\n },\n rest,\n props,\n { ref },\n { ref: register },\n )()\n\n return {\n ...merged,\n onClick: handlerAll(\n merged.onClick,\n !group ? () => onSelectedChange(value) : undefined,\n ),\n }\n },\n [\n itemId,\n register,\n selected,\n disabled,\n labelId,\n rest,\n group,\n onSelectedChange,\n value,\n ],\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, groupLoading, selected],\n )\n\n const getTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n \"aria-controls\": contentId,\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-expanded\": groupOpen,\n \"data-disabled\": dataAttr(disabled),\n \"data-expanded\": dataAttr(groupOpen),\n \"data-selected\": dataAttr(selected),\n tabIndex: open && expanded && !disabled ? 0 : -1,\n ...props,\n onClick: handlerAll(props.onClick, onGroupToggle),\n }),\n [contentId, disabled, groupOpen, selected, open, expanded, onGroupToggle],\n )\n\n const getLinkProps: PropGetter<\"a\"> = useCallback(\n (props = {}) => ({\n href: value,\n rel: external ? \"noopener\" : undefined,\n target: external ? \"_blank\" : undefined,\n \"data-disabled\": dataAttr(disabled),\n \"data-selected\": dataAttr(selected),\n tabIndex: open && expanded && !disabled ? 0 : -1,\n ...props,\n onClick: handlerAll(props.onClick, (ev) => {\n if (!disabled) return\n\n ev.preventDefault()\n ev.stopPropagation()\n }),\n }),\n [disabled, expanded, external, open, selected, value],\n )\n\n const getContentProps: PropGetter<\"ul\"> = useCallback(\n ({ \"aria-labelledby\": ariaLabelledby, ...props } = {}) => ({\n id: contentId,\n \"aria-busy\": ariaAttr(groupLoading),\n \"aria-labelledby\": cx(ariaLabelledby, labelId),\n \"data-disabled\": dataAttr(disabled),\n ...props,\n }),\n [contentId, 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 children,\n disabled,\n expanded,\n expandedValue,\n group,\n groupLoading,\n groupOpen,\n open,\n selected,\n selectedValue,\n value,\n getContentProps,\n getIndicatorProps,\n getItemProps,\n getLabelProps,\n getLinkProps,\n getTriggerProps,\n onExpandedChange,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n onSelectedChange,\n }\n}\n\nexport type UseSidebarItemReturn = ReturnType<typeof useSidebarItem>\n"],"mappings":";;;;;;;;;;;;;;;;AA4CA,MAAM,EACJ,oBAAoB,2BACpB,eAAe,sBACf,gBAAgB,0BACdA,oCAAAA,kBAAuD;AAqB3D,MAAM,CAAC,gBAAgB,qBAAqBC,gBAAAA,cAA8B,EACxE,MAAM,iBACR,CAAC;AASD,MAAM,CAAC,oBAAoB,yBACzBA,gBAAAA,cAAkC;CAChC,MAAM;CACN,QAAQ;AACV,CAAC;AAgDH,MAAa,cAAc,EACzB,YACA,uBAAuB,CAAC,GACxB,sBACA,YACA,eAAe,mBACf,SAAS,OACT,eAAe,mBACf,kBAAkB,sBAClB,kBAAkB,sBAClB,GAAG,SACgB,CAAC,MAAM;CAC1B,MAAM,EAAE,MAAMC,sBAAAA,QAAQ,SAAS;C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GAAG,gBAAgB;EACrB,CAAC;CACH,IACA;EAAC;EAAU;EAAU;EAAU;EAAM;EAAU;CAAK,CACtD;CAkBA,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,kBAAA,GAAA,MAAA,YAAA,EA5BC,EAAE,mBAAmB,gBAAgB,GAAG,UAAU,CAAC,OAAO;GACzD,IAAI;GACJ,cAAA,GAAA,oBAAA,cAAA,SAAA,CAAsB,YAAY;GAClC,oBAAA,GAAA,oBAAA,cAAA,GAAA,CAAsB,gBAAgB,OAAO;GAC7C,kBAAA,GAAA,oBAAA,cAAA,SAAA,CAA0B,QAAQ;GAClC,GAAG;EACL,IACA;GAAC;GAAW;GAAS;GAAU;EAAY,CAqB7B;EACd;EACA;EACA,gBAAA,GAAA,MAAA,YAAA,EApBC,QAAQ,CAAC,OAAO;GAAE,IAAI;GAAS,GAAG;EAAM,IACzC,CAAC,OAAO,CAmBI;EACZ;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"simple-grid.cjs","names":["createComponent","simpleGridStyle","Grid"],"sources":["../../../../src/components/simple-grid/simple-grid.tsx"],"sourcesContent":["\"use client\"\n\nimport type {\n CSSProps,\n StyleValue,\n ThemeProps,\n WithoutThemeProps,\n} from \"../../core\"\nimport type { GridProps } from \"../grid\"\nimport type { SimpleGridStyle } from \"./simple-grid.style\"\nimport { useMemo } from \"react\"\nimport { createComponent } from \"../../core\"\nimport { replaceObject } from \"../../utils\"\nimport { Grid } from \"../grid\"\nimport { simpleGridStyle } from \"./simple-grid.style\"\n\nexport interface SimpleGridProps\n extends\n Omit<WithoutThemeProps<GridProps, SimpleGridStyle>, \"columns\">,\n ThemeProps<SimpleGridStyle> {\n /**\n * The number of columns.\n */\n columns?: StyleValue<number>\n /**\n * The width at which child elements will break into columns.\n * Pass a number for pixel values or a string for any other valid CSS length.\n */\n minChildWidth?: CSSProps[\"minWidth\"]\n}\n\nconst {\n PropsContext: SimpleGridPropsContext,\n usePropsContext: useSimpleGridPropsContext,\n withContext,\n} = createComponent<SimpleGridProps, SimpleGridStyle>(\n \"simple-grid\",\n simpleGridStyle,\n)\n\nexport { SimpleGridPropsContext, useSimpleGridPropsContext }\n\n/**\n * `SimpleGrid` is a component that makes `Grid` simpler and more user-friendly.\n *\n * @see https://yamada-ui.com/docs/components/simple-grid\n */\nexport const SimpleGrid = withContext<\"div\", SimpleGridProps>(Grid)(\n undefined,\n ({ columns, minChildWidth, ...rest }) => {\n const templateColumns = useMemo(() => {\n if (minChildWidth) {\n return replaceObject(minChildWidth, (value) => {\n return value != null\n ? `repeat(auto-fit, minmax({sizes.${value}, ${value}}, 1fr))`\n : undefined\n })\n } else {\n return replaceObject(columns, (value) =>\n value != null ? `repeat(${value}, minmax(0, 1fr))` : undefined,\n )\n }\n }, [minChildWidth, columns])\n\n return { templateColumns, ...rest }\n },\n)\n"],"mappings":";;;;;;;AA+BA,MAAM,EACJ,cAAc,wBACd,iBAAiB,2BACjB,gBACEA,yBAAAA,gBACF,eACAC,0BAAAA,eACF;;;;;;AASA,MAAa,aAAa,YAAoCC,aAAAA,IAAI,CAAC,CACjE,KAAA,IACC,EAAE,SAAS,eAAe,GAAG,WAAW;CAevC,OAAO;EAAE,kBAAA,GAAA,MAAA,QAAA,OAd6B;GACpC,IAAI,eACF,QAAA,GAAA,oBAAA,cAAA,cAAA,CAAqB,gBAAgB,UAAU;IAC7C,OAAO,SAAS,OACZ,kCAAkC,MAAM,IAAI,MAAM,YAClD,KAAA;GACN,CAAC;QAED,QAAA,GAAA,oBAAA,cAAA,cAAA,CAAqB,UAAU,UAC7B,SAAS,OAAO,UAAU,MAAM,qBAAqB,KAAA,CACvD;EAEJ,GAAG,CAAC,eAAe,OAAO,CAEH;EAAG,GAAG;CAAK;AACpC,CACF"}
1
+ {"version":3,"file":"simple-grid.cjs","names":["createComponent","simpleGridStyle","Grid"],"sources":["../../../../src/components/simple-grid/simple-grid.tsx"],"sourcesContent":["\"use client\"\n\nimport type {\n CSSProps,\n StyleValue,\n ThemeProps,\n WithoutThemeProps,\n} from \"../../core\"\nimport type { GridProps } from \"../grid\"\nimport type { SimpleGridStyle } from \"./simple-grid.style\"\nimport { useMemo } from \"react\"\nimport { createComponent } from \"../../core\"\nimport { replaceObject } from \"../../utils\"\nimport { Grid } from \"../grid\"\nimport { simpleGridStyle } from \"./simple-grid.style\"\n\nexport interface SimpleGridProps\n extends\n Omit<WithoutThemeProps<GridProps, SimpleGridStyle>, \"columns\">,\n ThemeProps<SimpleGridStyle> {\n /**\n * The number of columns.\n */\n columns?: StyleValue<number>\n /**\n * The width at which child elements will break into columns.\n * Pass a number for pixel values or a string for any other valid CSS length.\n */\n minChildWidth?: CSSProps[\"minWidth\"]\n}\n\nconst {\n PropsContext: SimpleGridPropsContext,\n usePropsContext: useSimpleGridPropsContext,\n withContext,\n} = createComponent<SimpleGridProps, SimpleGridStyle>(\n \"simple-grid\",\n simpleGridStyle,\n)\n\nexport { SimpleGridPropsContext, useSimpleGridPropsContext }\n\n/**\n * `SimpleGrid` is a component that makes `Grid` simpler and more user-friendly.\n *\n * @see https://yamada-ui.com/docs/components/simple-grid\n */\nexport const SimpleGrid = withContext<\"div\", SimpleGridProps>(Grid)(\n undefined,\n ({ columns, minChildWidth, ...rest }) => {\n const templateColumns = useMemo(() => {\n if (minChildWidth)\n return replaceObject(minChildWidth, (value) => {\n return value != null\n ? `repeat(auto-fit, minmax({sizes.${value}, ${value}}, 1fr))`\n : undefined\n })\n else\n return replaceObject(columns, (value) =>\n value != null ? `repeat(${value}, minmax(0, 1fr))` : undefined,\n )\n }, [minChildWidth, columns])\n\n return { templateColumns, ...rest }\n },\n)\n"],"mappings":";;;;;;;AA+BA,MAAM,EACJ,cAAc,wBACd,iBAAiB,2BACjB,gBACEA,yBAAAA,gBACF,eACAC,0BAAAA,eACF;;;;;;AASA,MAAa,aAAa,YAAoCC,aAAAA,IAAI,CAAC,CACjE,KAAA,IACC,EAAE,SAAS,eAAe,GAAG,WAAW;CAcvC,OAAO;EAAE,kBAAA,GAAA,MAAA,QAAA,OAb6B;GACpC,IAAI,eACF,QAAA,GAAA,oBAAA,cAAA,cAAA,CAAqB,gBAAgB,UAAU;IAC7C,OAAO,SAAS,OACZ,kCAAkC,MAAM,IAAI,MAAM,YAClD,KAAA;GACN,CAAC;QAED,QAAA,GAAA,oBAAA,cAAA,cAAA,CAAqB,UAAU,UAC7B,SAAS,OAAO,UAAU,MAAM,qBAAqB,KAAA,CACvD;EACJ,GAAG,CAAC,eAAe,OAAO,CAEH;EAAG,GAAG;CAAK;AACpC,CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"z-stack.cjs","names":["createComponent","zStackStyle","getValidChildren","Fragment","mergeRefs","mergeCSS","styled","useInjectVarsIntoCss","useInjectVarsIntoProps"],"sources":["../../../../src/components/stack/z-stack.tsx"],"sourcesContent":["\"use client\"\n\nimport type { RefObject } from \"react\"\nimport type {\n CSSObject,\n Direction,\n HTMLStyledProps,\n ThemeProps,\n} from \"../../core\"\nimport type { ZStackStyle } from \"./z-stack.style\"\nimport {\n cloneElement,\n createRef,\n Fragment,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\"\nimport {\n createComponent,\n mergeCSS,\n styled,\n useInjectVarsIntoCss,\n useInjectVarsIntoProps,\n} from \"../../core\"\nimport { getValidChildren, mergeRefs } from \"../../utils\"\nimport { zStackStyle } from \"./z-stack.style\"\n\nexport interface ZStackProps\n extends Omit<HTMLStyledProps, \"direction\">, ThemeProps<ZStackStyle> {\n /**\n * Stack in the specified direction.\n *\n * @default 'end'\n */\n direction?: Direction\n /**\n * If `true`, calculate the `width` and `height` of the element and assign container.\n *\n * @default true\n */\n fit?: boolean\n /**\n * If `true`, reverse direction.\n *\n * @default false\n */\n reverse?: boolean\n /**\n * If set the stack will start from the given index.\n *\n * @default 0\n */\n startIndex?: number\n}\n\nconst {\n PropsContext: ZStackPropsContext,\n usePropsContext: useZStackPropsContext,\n withContext,\n} = createComponent<ZStackProps, ZStackStyle>(\"stack--depth\", zStackStyle)\n\nexport { useZStackPropsContext, ZStackPropsContext }\n\n/**\n * `ZStack` is a component that groups elements and provides space between child elements.\n *\n * @see https://yamada-ui.com/docs/components/stack\n */\nexport const ZStack = withContext<\"div\", ZStackProps>(\n ({\n css,\n children,\n direction = \"end\",\n fit = true,\n reverse = false,\n startIndex = 0,\n ...rest\n }) => {\n if (direction === \"start-center\") direction = \"start\"\n if (direction === \"end-center\") direction = \"end\"\n\n const refMap = useRef<Map<number, RefObject<HTMLDivElement | null>>>(\n new Map(),\n )\n const [rect, setRect] = useState<{ height: number; width: number }>({\n height: 0,\n width: 0,\n })\n\n const vertical = useCallback(\n (space: string) => {\n if (direction.startsWith(\"start\")) {\n return { [!reverse ? \"bottom\" : \"top\"]: space }\n } else if (direction.startsWith(\"end\")) {\n return { [!reverse ? \"top\" : \"bottom\"]: space }\n } else {\n return { [!reverse ? \"top\" : \"bottom\"]: 0 }\n }\n },\n [direction, reverse],\n )\n\n const horizontal = useCallback(\n (space: string) => {\n if (direction.endsWith(\"-start\")) {\n return { [!reverse ? \"right\" : \"left\"]: space }\n } else if (direction.endsWith(\"-end\")) {\n return { [!reverse ? \"left\" : \"right\"]: space }\n } else {\n return { [!reverse ? \"left\" : \"right\"]: 0 }\n }\n },\n [direction, reverse],\n )\n\n const cloneChildren = useMemo(() => {\n const validChildren = getValidChildren(children)\n\n const clonedChildren = validChildren.map((child, index) => {\n const ref = createRef<HTMLDivElement>()\n\n refMap.current.set(index, ref)\n\n const key = child.key ?? index\n\n const zIndex = startIndex + index\n const space = `calc({space} * ${index})`\n\n const css: CSSObject = {\n position: \"absolute\",\n zIndex,\n ...vertical(space),\n ...horizontal(space),\n }\n\n const props = {\n ...child.props,\n ref: mergeRefs(child.props.ref, ref),\n css: mergeCSS(child.props.css, css),\n }\n\n const clonedChild = cloneElement(child, props)\n\n return <Fragment key={key}>{clonedChild}</Fragment>\n })\n\n return clonedChildren\n }, [children, startIndex, vertical, horizontal])\n\n useEffect(() => {\n if (!fit) return\n\n let negativeLeft = direction.endsWith(\"-start\")\n let negativeTop = direction.startsWith(\"start\")\n let width = 0\n let height = 0\n\n if (reverse) {\n negativeLeft = !negativeLeft\n negativeTop = !negativeTop\n }\n\n for (const ref of refMap.current.values()) {\n if (!ref.current) continue\n\n let { offsetHeight, offsetLeft, offsetParent, offsetTop, offsetWidth } =\n ref.current\n\n if (!offsetParent && process.env.NODE_ENV !== \"test\") continue\n\n if (negativeLeft) {\n const offsetParentWidth =\n (offsetParent as HTMLDivElement | null)?.offsetWidth ?? 0\n\n offsetLeft = offsetParentWidth - offsetLeft - offsetWidth\n }\n\n if (negativeTop) {\n const offsetParentHeight =\n (offsetParent as HTMLDivElement | null)?.offsetHeight ?? 0\n\n offsetTop = offsetParentHeight - offsetTop - offsetHeight\n }\n\n offsetWidth += offsetLeft\n offsetHeight += offsetTop\n\n if (offsetWidth > width) width = offsetWidth\n if (offsetHeight > height) height = offsetHeight\n }\n\n setRect({ height, width })\n }, [cloneChildren, direction, reverse, fit])\n\n return (\n <styled.div\n css={css}\n minHeight={fit ? `${rect.height}px` : undefined}\n minWidth={fit ? `${rect.width}px` : undefined}\n {...rest}\n >\n {cloneChildren}\n </styled.div>\n )\n },\n)(undefined, (props) => {\n const css = useInjectVarsIntoCss(props.css, { gap: \"space\" })\n const rest = useInjectVarsIntoProps(props, { gap: \"space\" })\n\n return { ...rest, css }\n})\n"],"mappings":";;;;;;;;;;;AA0DA,MAAM,EACJ,cAAc,oBACd,iBAAiB,uBACjB,gBACEA,yBAAAA,gBAA0C,gBAAgBC,sBAAAA,WAAW;;;;;;AASzE,MAAa,SAAS,aACnB,EACC,KACA,UACA,YAAY,OACZ,MAAM,MACN,UAAU,OACV,aAAa,GACb,GAAG,WACC;CACJ,IAAI,cAAc,gBAAgB,YAAY;CAC9C,IAAI,cAAc,cAAc,YAAY;CAE5C,MAAM,UAAA,GA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,uBAAuB,OAAO,EAAE,KAAK,QAAQ,CAE3C;EAAG;CAAI;AACxB,CAAC"}
1
+ {"version":3,"file":"z-stack.cjs","names":["createComponent","zStackStyle","getValidChildren","Fragment","mergeRefs","mergeCSS","styled","useInjectVarsIntoCss","useInjectVarsIntoProps"],"sources":["../../../../src/components/stack/z-stack.tsx"],"sourcesContent":["\"use client\"\n\nimport type { RefObject } from \"react\"\nimport type {\n CSSObject,\n Direction,\n HTMLStyledProps,\n ThemeProps,\n} from \"../../core\"\nimport type { ZStackStyle } from \"./z-stack.style\"\nimport {\n cloneElement,\n createRef,\n Fragment,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\"\nimport {\n createComponent,\n mergeCSS,\n styled,\n useInjectVarsIntoCss,\n useInjectVarsIntoProps,\n} from \"../../core\"\nimport { getValidChildren, mergeRefs } from \"../../utils\"\nimport { zStackStyle } from \"./z-stack.style\"\n\nexport interface ZStackProps\n extends Omit<HTMLStyledProps, \"direction\">, ThemeProps<ZStackStyle> {\n /**\n * Stack in the specified direction.\n *\n * @default 'end'\n */\n direction?: Direction\n /**\n * If `true`, calculate the `width` and `height` of the element and assign container.\n *\n * @default true\n */\n fit?: boolean\n /**\n * If `true`, reverse direction.\n *\n * @default false\n */\n reverse?: boolean\n /**\n * If set the stack will start from the given index.\n *\n * @default 0\n */\n startIndex?: number\n}\n\nconst {\n PropsContext: ZStackPropsContext,\n usePropsContext: useZStackPropsContext,\n withContext,\n} = createComponent<ZStackProps, ZStackStyle>(\"stack--depth\", zStackStyle)\n\nexport { useZStackPropsContext, ZStackPropsContext }\n\n/**\n * `ZStack` is a component that groups elements and provides space between child elements.\n *\n * @see https://yamada-ui.com/docs/components/stack\n */\nexport const ZStack = withContext<\"div\", ZStackProps>(\n ({\n css,\n children,\n direction = \"end\",\n fit = true,\n reverse = false,\n startIndex = 0,\n ...rest\n }) => {\n if (direction === \"start-center\") direction = \"start\"\n if (direction === \"end-center\") direction = \"end\"\n\n const refMap = useRef<Map<number, RefObject<HTMLDivElement | null>>>(\n new Map(),\n )\n const [rect, setRect] = useState<{ height: number; width: number }>({\n height: 0,\n width: 0,\n })\n\n const vertical = useCallback(\n (space: string) => {\n if (direction.startsWith(\"start\"))\n return { [!reverse ? \"bottom\" : \"top\"]: space }\n else if (direction.startsWith(\"end\"))\n return { [!reverse ? \"top\" : \"bottom\"]: space }\n else return { [!reverse ? \"top\" : \"bottom\"]: 0 }\n },\n [direction, reverse],\n )\n\n const horizontal = useCallback(\n (space: string) => {\n if (direction.endsWith(\"-start\"))\n return { [!reverse ? \"right\" : \"left\"]: space }\n else if (direction.endsWith(\"-end\"))\n return { [!reverse ? \"left\" : \"right\"]: space }\n else return { [!reverse ? \"left\" : \"right\"]: 0 }\n },\n [direction, reverse],\n )\n\n const cloneChildren = useMemo(() => {\n const validChildren = getValidChildren(children)\n\n const clonedChildren = validChildren.map((child, index) => {\n const ref = createRef<HTMLDivElement>()\n\n refMap.current.set(index, ref)\n\n const key = child.key ?? index\n\n const zIndex = startIndex + index\n const space = `calc({space} * ${index})`\n\n const css: CSSObject = {\n position: \"absolute\",\n zIndex,\n ...vertical(space),\n ...horizontal(space),\n }\n\n const props = {\n ...child.props,\n ref: mergeRefs(child.props.ref, ref),\n css: mergeCSS(child.props.css, css),\n }\n\n const clonedChild = cloneElement(child, props)\n\n return <Fragment key={key}>{clonedChild}</Fragment>\n })\n\n return clonedChildren\n }, [children, startIndex, vertical, horizontal])\n\n useEffect(() => {\n if (!fit) return\n\n let negativeLeft = direction.endsWith(\"-start\")\n let negativeTop = direction.startsWith(\"start\")\n let width = 0\n let height = 0\n\n if (reverse) {\n negativeLeft = !negativeLeft\n negativeTop = !negativeTop\n }\n\n for (const ref of refMap.current.values()) {\n if (!ref.current) continue\n\n let { offsetHeight, offsetLeft, offsetParent, offsetTop, offsetWidth } =\n ref.current\n\n if (!offsetParent && process.env.NODE_ENV !== \"test\") continue\n\n if (negativeLeft) {\n const offsetParentWidth =\n (offsetParent as HTMLDivElement | null)?.offsetWidth ?? 0\n\n offsetLeft = offsetParentWidth - offsetLeft - offsetWidth\n }\n\n if (negativeTop) {\n const offsetParentHeight =\n (offsetParent as HTMLDivElement | null)?.offsetHeight ?? 0\n\n offsetTop = offsetParentHeight - offsetTop - offsetHeight\n }\n\n offsetWidth += offsetLeft\n offsetHeight += offsetTop\n\n if (offsetWidth > width) width = offsetWidth\n if (offsetHeight > height) height = offsetHeight\n }\n\n setRect({ height, width })\n }, [cloneChildren, direction, reverse, fit])\n\n return (\n <styled.div\n css={css}\n minHeight={fit ? `${rect.height}px` : undefined}\n minWidth={fit ? `${rect.width}px` : undefined}\n {...rest}\n >\n {cloneChildren}\n </styled.div>\n )\n },\n)(undefined, (props) => {\n const css = useInjectVarsIntoCss(props.css, { gap: \"space\" })\n const rest = useInjectVarsIntoProps(props, { gap: \"space\" })\n\n return { ...rest, css }\n})\n"],"mappings":";;;;;;;;;;;AA0DA,MAAM,EACJ,cAAc,oBACd,iBAAiB,uBACjB,gBACEA,yBAAAA,gBAA0C,gBAAgBC,sBAAAA,WAAW;;;;;;AASzE,MAAa,SAAS,aACnB,EACC,KACA,UACA,YAAY,OACZ,MAAM,MACN,UAAU,OACV,aAAa,GACb,GAAG,WACC;CACJ,IAAI,cAAc,gBAAgB,YAAY;CAC9C,IAAI,cAAc,cAAc,YAAY;CAE5C,MAAM,UAAA,GAAA,MAAA,OAAA,iBACJ,IAAI,IAAI,CACV;CACA,MAAM,CAAC,MAAM,YAAA,GAAA,MAAA,SAAA,CAAuD;EAClE,QAAQ;EACR,OAAO;CACT,CAAC;CAED,MAAM,YAAA,GAAA,MAAA,YAAA,EACH,UAAkB;EACjB,IAAI,UAAU,WAAW,OAAO,GAC9B,OAAO,GAAG,CAAC,UAAU,WAAW,QAAQ,MAAM;OAC3C,IAAI,UAAU,WAAW,KAAK,GACjC,OAAO,GAAG,CAAC,UAAU,QAAQ,WAAW,MAAM;OAC3C,OAAO,GAAG,CAAC,UAAU,QAAQ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X,eAAe,CAAC;GAChB,cAAc,CAAC;EACjB;EAEA,KAAK,MAAM,OAAO,OAAO,QAAQ,OAAO,GAAG;GACzC,IAAI,CAAC,IAAI,SAAS;GAElB,IAAI,EAAE,cAAc,YAAY,cAAc,WAAW,gBACvD,IAAI;GAEN,IAAI,CAAC,gBAAgB,QAAQ,IAAI,aAAa,QAAQ;GAEtD,IAAI,cAIF,cAFG,cAAwC,eAAe,KAEzB,aAAa;GAGhD,IAAI,aAIF,aAFG,cAAwC,gBAAgB,KAE1B,YAAY;GAG/C,eAAe;GACf,gBAAgB;GAEhB,IAAI,cAAc,OAAO,QAAQ;GACjC,IAAI,eAAe,QAAQ,SAAS;EACtC;EAEA,QAAQ;GAAE;GAAQ;EAAM,CAAC;CAC3B,GAAG;EAAC;EAAe;EAAW;EAAS;CAAG,CAAC;CAE3C,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,gBAAAA,OAAO,KAAR;EACO;EACL,WAAW,MAAM,GAAG,KAAK,OAAO,MAAM,KAAA;EACtC,UAAU,MAAM,GAAG,KAAK,MAAM,MAAM,KAAA;EACpC,GAAI;YAEH;CACS,CAAA;AAEhB,CACF,CAAC,CAAC,KAAA,IAAY,UAAU;CACtB,MAAM,MAAMC,wBAAAA,qBAAqB,MAAM,KAAK,EAAE,KAAK,QAAQ,CAAC;CAG5D,OAAO;EAAE,GAFIC,wBAAAA,uBAAuB,OAAO,EAAE,KAAK,QAAQ,CAE3C;EAAG;CAAI;AACxB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"steps.cjs","names":["createSlotComponent","stepsStyle","useValue","useFindChild","useValidChildren","useSteps","Children","StepsDescendantsContext","StepsContext","styled","useStepsContext","useStepsItem","StepsItemContext","CheckIcon","useStepsItemContext","useLazyMount"],"sources":["../../../../src/components/steps/steps.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, PropsWithChildren, ReactNode } from \"react\"\nimport type { HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { UseLazyMountProps } from \"../../hooks/use-lazy-mount\"\nimport type { StepsStyle } from \"./steps.style\"\nimport type { UseStepsItemProps, UseStepsProps } from \"./use-steps\"\nimport { Children, useMemo } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { useLazyMount } from \"../../hooks/use-lazy-mount\"\nimport { useValue } from \"../../hooks/use-value\"\nimport {\n isNull,\n isUndefined,\n useFindChild,\n useValidChildren,\n} from \"../../utils\"\nimport { CheckIcon } from \"../icon\"\nimport { stepsStyle } from \"./steps.style\"\nimport {\n StepsContext,\n StepsDescendantsContext,\n StepsItemContext,\n useSteps,\n useStepsContext,\n useStepsItem,\n useStepsItemContext,\n} from \"./use-steps\"\n\ninterface ComponentContext extends Pick<\n StepsRootProps,\n \"items\" | \"lazy\" | \"lazyBehavior\"\n> {}\n\nexport interface StepsItem\n extends\n Omit<StepsItemProps, \"content\" | \"index\" | \"title\">,\n Pick<StepsIndicatorProps, \"complete\" | \"current\" | \"incomplete\"> {\n /**\n * The content for step element.\n */\n content?: ReactNode\n /**\n * The description for step element.\n */\n description?: ReactNode\n /**\n * If true, display the step separator.\n *\n * @default true\n */\n hasSeparator?: boolean\n /**\n * The title for step element.\n */\n title?: string\n /**\n * Props for step content element.\n */\n contentProps?: StepsContentProps\n /**\n * Props for step description element.\n */\n descriptionProps?: StepsDescriptionProps\n /**\n * Props for step indicator element.\n */\n indicatorProps?: StepsIndicatorProps\n /**\n * Props for step separator element.\n */\n separatorProps?: StepsSeparatorProps\n /**\n * Props for step title element.\n */\n titleProps?: StepsTitleProps\n}\n\nexport interface StepsRootProps\n extends\n Omit<HTMLStyledProps, \"onChange\">,\n Omit<UseStepsProps, \"count\" | \"orientation\">,\n Pick<UseLazyMountProps, \"lazy\" | \"lazyBehavior\">,\n ThemeProps<StepsStyle> {\n /**\n * If provided, generate step components based on steps.\n */\n items?: StepsItem[]\n}\n\nconst {\n ComponentContext,\n PropsContext: StepsPropsContext,\n useComponentContext,\n usePropsContext: useStepsPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<StepsRootProps, StepsStyle, ComponentContext>(\n \"steps\",\n stepsStyle,\n)\n\nexport { StepsPropsContext, useStepsPropsContext }\n\n/**\n * `Steps` is a component that displays the progress of a multi-step process.\n *\n * @see https://yamada-ui.com/docs/components/steps\n */\nexport const StepsRoot = withProvider<\"div\", StepsRootProps, \"orientation\">(\n ({\n children,\n items = [],\n lazy,\n lazyBehavior,\n orientation: orientationProp,\n ...rest\n }) => {\n const computedOrientation = useValue(orientationProp)\n const validChildren = useValidChildren(children)\n const stepsList = useFindChild<StepsListProps>(validChildren, StepsList)\n const {\n id,\n count,\n descendants,\n getStatus,\n index,\n orientation,\n setIndex,\n getContentProps,\n getListProps,\n getNextTriggerProps,\n getPrevTriggerProps,\n getRootProps,\n onNext,\n onPrev,\n } = useSteps({\n count: items.length || Children.count(stepsList?.props.children),\n orientation: computedOrientation,\n ...rest,\n })\n const componentContext = useMemo(\n () => ({ items, lazy, lazyBehavior }),\n [items, lazy, lazyBehavior],\n )\n const stepsContext = useMemo(\n () => ({\n id,\n count,\n getStatus,\n index,\n orientation,\n setIndex,\n getContentProps,\n getListProps,\n getNextTriggerProps,\n getPrevTriggerProps,\n onNext,\n onPrev,\n }),\n [\n id,\n count,\n index,\n orientation,\n setIndex,\n getStatus,\n onNext,\n onPrev,\n getListProps,\n getNextTriggerProps,\n getPrevTriggerProps,\n getContentProps,\n ],\n )\n\n return (\n <StepsDescendantsContext value={descendants}>\n <StepsContext value={stepsContext}>\n <ComponentContext value={componentContext}>\n <styled.div {...getRootProps()}>{children}</styled.div>\n </ComponentContext>\n </StepsContext>\n </StepsDescendantsContext>\n )\n },\n \"root\",\n { transferProps: [\"orientation\"] },\n)()\n\nexport interface StepsListProps extends HTMLStyledProps<\"ol\"> {}\n\nexport const StepsList = withContext<\"ol\", StepsListProps>(\n ({ children, ...rest }) => {\n const { items } = useComponentContext()\n const { getListProps } = useStepsContext()\n const computedChildren = useMemo(() => {\n if (children) {\n return children\n } else {\n return items?.map(\n (\n {\n complete,\n content: _content,\n current,\n description,\n hasSeparator = true,\n incomplete,\n title,\n contentProps: _contentProps,\n descriptionProps,\n indicatorProps,\n separatorProps,\n titleProps,\n ...rest\n },\n index,\n ) => (\n <StepsItem key={index} index={index} title={title} {...rest}>\n <StepsIndicator\n complete={complete}\n current={current}\n incomplete={incomplete}\n {...indicatorProps}\n />\n\n <styled.div>\n {title ? (\n <StepsTitle {...titleProps}>{title}</StepsTitle>\n ) : null}\n {description ? (\n <StepsDescription {...descriptionProps}>\n {description}\n </StepsDescription>\n ) : null}\n </styled.div>\n\n {hasSeparator ? <StepsSeparator {...separatorProps} /> : null}\n </StepsItem>\n ),\n )\n }\n }, [children, items])\n\n return <styled.ol {...getListProps(rest)}>{computedChildren}</styled.ol>\n },\n \"list\",\n)()\n\nexport interface StepsItemProps\n extends HTMLStyledProps<\"li\">, UseStepsItemProps {}\n\nexport const StepsItem = withContext<\"li\", StepsItemProps>((props) => {\n const {\n first,\n index,\n last,\n status,\n getDescriptionProps,\n getIndicatorProps,\n getRootProps,\n getSeparatorProps,\n getTitleProps,\n } = useStepsItem(props)\n const context = useMemo(\n () => ({\n first,\n index,\n last,\n status,\n getDescriptionProps,\n getIndicatorProps,\n getSeparatorProps,\n getTitleProps,\n }),\n [\n first,\n index,\n last,\n status,\n getTitleProps,\n getDescriptionProps,\n getSeparatorProps,\n getIndicatorProps,\n ],\n )\n\n return (\n <StepsItemContext value={context}>\n <styled.li {...getRootProps()} />\n </StepsItemContext>\n )\n}, \"item\")()\n\nexport interface StepsIndicatorProps extends HTMLStyledProps {\n /**\n * The element for the complete indicator.\n *\n * @default <CheckIcon />\n */\n complete?: ReactNode\n /**\n * The element for the current indicator.\n *\n * @default <StepsNumber />\n */\n current?: ReactNode\n /**\n * The element for the incomplete indicator.\n *\n * @default <StepsNumber />\n */\n incomplete?: ReactNode\n}\n\nexport const StepsIndicator = withContext<\"div\", StepsIndicatorProps>(\n ({\n complete = <CheckIcon />,\n current = <StepsNumber />,\n incomplete = <StepsNumber />,\n ...rest\n }) => {\n const { status, getIndicatorProps } = useStepsItemContext()\n const components = useMemo(\n () => ({ complete, current, incomplete }),\n [complete, current, incomplete],\n )\n\n return (\n <styled.div {...getIndicatorProps(rest)}>{components[status]}</styled.div>\n )\n },\n \"indicator\",\n)()\n\nexport interface StepsNumberProps extends HTMLStyledProps<\"span\"> {}\n\nexport const StepsNumber = withContext<\"span\", StepsNumberProps>(\n \"span\",\n \"number\",\n)(undefined, ({ children, ...rest }) => {\n const { index } = useStepsItemContext()\n\n return { ...rest, children: children ?? index + 1 }\n})\n\nexport interface StepsTitleProps extends HTMLStyledProps {}\n\nexport const StepsTitle = withContext<\"h3\", StepsTitleProps>(\"h3\", \"title\")(\n undefined,\n (props) => {\n const { getTitleProps } = useStepsItemContext()\n\n return getTitleProps(props)\n },\n)\n\nexport interface StepsDescriptionProps extends HTMLStyledProps<\"p\"> {}\n\nexport const StepsDescription = withContext<\"p\", StepsDescriptionProps>(\n \"p\",\n \"description\",\n)(undefined, (props) => {\n const { getDescriptionProps } = useStepsItemContext()\n\n return getDescriptionProps(props)\n})\n\nexport interface StepsSeparatorProps extends HTMLStyledProps {}\n\nexport const StepsSeparator = withContext<\"div\", StepsSeparatorProps>(\n \"div\",\n \"separator\",\n)(undefined, (props) => {\n const { getSeparatorProps } = useStepsItemContext()\n\n return getSeparatorProps(props)\n})\n\nexport interface StepsContentsProps extends PropsWithChildren {}\n\nexport const StepsContents: FC<StepsContentsProps> = ({ children }) => {\n const { items } = useComponentContext()\n\n return useMemo(() => {\n if (children) {\n return children\n } else {\n return items?.map(({ content, contentProps }, index) =>\n isUndefined(content) || isNull(content) ? null : (\n <StepsContent key={index} index={index} {...contentProps}>\n {content}\n </StepsContent>\n ),\n )\n }\n }, [children, items])\n}\n\nexport interface StepsContentProps extends HTMLStyledProps {\n /**\n * The index of the step content.\n */\n index: number\n}\n\nexport const StepsContent = withContext<\"div\", StepsContentProps>(\n \"div\",\n \"content\",\n)(undefined, ({ index, ...rest }) => {\n const { lazy, lazyBehavior } = useComponentContext()\n const { index: selectedIndex, getContentProps } = useStepsContext()\n const mounted = index === selectedIndex\n const children = useLazyMount({\n lazy,\n lazyBehavior,\n mounted,\n ...rest,\n })\n\n return { ...getContentProps({ index, ...rest }), children }\n})\n\nexport interface StepsCompletedContentProps extends HTMLStyledProps {}\n\nexport const StepsCompletedContent = withContext<\n \"div\",\n StepsCompletedContentProps\n>(\"div\", { name: \"CompletedContent\", slot: [\"content\", \"completed\"] })(\n undefined,\n (props) => {\n const { lazy, lazyBehavior } = useComponentContext()\n const { count, index: selectedIndex, getContentProps } = useStepsContext()\n const mounted = count !== 0 && count === selectedIndex\n const children = useLazyMount({\n lazy,\n lazyBehavior,\n mounted,\n ...props,\n })\n\n return { ...getContentProps(props), children }\n },\n)\n\nexport interface StepsPrevTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const StepsPrevTrigger = withContext<\"button\", StepsPrevTriggerProps>(\n \"button\",\n { name: \"PrevTrigger\", slot: [\"trigger\", \"prev\"] },\n)((props) => {\n const { getPrevTriggerProps } = useStepsContext()\n\n return { asChild: true, ...getPrevTriggerProps(props) }\n})\n\nexport interface StepsNextTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const StepsNextTrigger = withContext<\"button\", StepsNextTriggerProps>(\n \"button\",\n { name: \"NextTrigger\", slot: [\"trigger\", \"next\"] },\n)((props) => {\n const { getNextTriggerProps } = useStepsContext()\n\n return { asChild: true, ...getNextTriggerProps(props) }\n})\n"],"mappings":";;;;;;;;;;;;;AA0FA,MAAM,EACJ,kBACA,cAAc,mBACd,qBACA,iBAAiB,sBACjB,aACA,iBACEA,yBAAAA,oBACF,SACAC,oBAAAA,UACF;;;;;;AASA,MAAa,YAAY,cACtB,EACC,UACA,QAAQ,CAAC,GACT,MACA,cACA,aAAa,iBACb,GAAG,WACC;CACJ,MAAM,sBAAsBC,8BAAAA,SAAS,eAAe;CAEpD,MAA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AAmB,YAC9B,UACA;CAAE,MAAM;CAAe,MAAM,CAAC,WAAW,MAAM;AAAE,CACnD,CAAC,EAAE,UAAU;CACX,MAAM,EAAE,wBAAwBA,kBAAAA,gBAAgB;CAEhD,OAAO;EAAE,SAAS;EAAM,GAAG,oBAAoB,KAAK;CAAE;AACxD,CAAC"}
1
+ {"version":3,"file":"steps.cjs","names":["createSlotComponent","stepsStyle","useValue","useFindChild","useValidChildren","useSteps","Children","StepsDescendantsContext","StepsContext","styled","useStepsContext","useStepsItem","StepsItemContext","CheckIcon","useStepsItemContext","useLazyMount"],"sources":["../../../../src/components/steps/steps.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, PropsWithChildren, ReactNode } from \"react\"\nimport type { HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { UseLazyMountProps } from \"../../hooks/use-lazy-mount\"\nimport type { StepsStyle } from \"./steps.style\"\nimport type { UseStepsItemProps, UseStepsProps } from \"./use-steps\"\nimport { Children, useMemo } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { useLazyMount } from \"../../hooks/use-lazy-mount\"\nimport { useValue } from \"../../hooks/use-value\"\nimport {\n isNull,\n isUndefined,\n useFindChild,\n useValidChildren,\n} from \"../../utils\"\nimport { CheckIcon } from \"../icon\"\nimport { stepsStyle } from \"./steps.style\"\nimport {\n StepsContext,\n StepsDescendantsContext,\n StepsItemContext,\n useSteps,\n useStepsContext,\n useStepsItem,\n useStepsItemContext,\n} from \"./use-steps\"\n\ninterface ComponentContext extends Pick<\n StepsRootProps,\n \"items\" | \"lazy\" | \"lazyBehavior\"\n> {}\n\nexport interface StepsItem\n extends\n Omit<StepsItemProps, \"content\" | \"index\" | \"title\">,\n Pick<StepsIndicatorProps, \"complete\" | \"current\" | \"incomplete\"> {\n /**\n * The content for step element.\n */\n content?: ReactNode\n /**\n * The description for step element.\n */\n description?: ReactNode\n /**\n * If true, display the step separator.\n *\n * @default true\n */\n hasSeparator?: boolean\n /**\n * The title for step element.\n */\n title?: string\n /**\n * Props for step content element.\n */\n contentProps?: StepsContentProps\n /**\n * Props for step description element.\n */\n descriptionProps?: StepsDescriptionProps\n /**\n * Props for step indicator element.\n */\n indicatorProps?: StepsIndicatorProps\n /**\n * Props for step separator element.\n */\n separatorProps?: StepsSeparatorProps\n /**\n * Props for step title element.\n */\n titleProps?: StepsTitleProps\n}\n\nexport interface StepsRootProps\n extends\n Omit<HTMLStyledProps, \"onChange\">,\n Omit<UseStepsProps, \"count\" | \"orientation\">,\n Pick<UseLazyMountProps, \"lazy\" | \"lazyBehavior\">,\n ThemeProps<StepsStyle> {\n /**\n * If provided, generate step components based on steps.\n */\n items?: StepsItem[]\n}\n\nconst {\n ComponentContext,\n PropsContext: StepsPropsContext,\n useComponentContext,\n usePropsContext: useStepsPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<StepsRootProps, StepsStyle, ComponentContext>(\n \"steps\",\n stepsStyle,\n)\n\nexport { StepsPropsContext, useStepsPropsContext }\n\n/**\n * `Steps` is a component that displays the progress of a multi-step process.\n *\n * @see https://yamada-ui.com/docs/components/steps\n */\nexport const StepsRoot = withProvider<\"div\", StepsRootProps, \"orientation\">(\n ({\n children,\n items = [],\n lazy,\n lazyBehavior,\n orientation: orientationProp,\n ...rest\n }) => {\n const computedOrientation = useValue(orientationProp)\n const validChildren = useValidChildren(children)\n const stepsList = useFindChild<StepsListProps>(validChildren, StepsList)\n const {\n id,\n count,\n descendants,\n getStatus,\n index,\n orientation,\n setIndex,\n getContentProps,\n getListProps,\n getNextTriggerProps,\n getPrevTriggerProps,\n getRootProps,\n onNext,\n onPrev,\n } = useSteps({\n count: items.length || Children.count(stepsList?.props.children),\n orientation: computedOrientation,\n ...rest,\n })\n const componentContext = useMemo(\n () => ({ items, lazy, lazyBehavior }),\n [items, lazy, lazyBehavior],\n )\n const stepsContext = useMemo(\n () => ({\n id,\n count,\n getStatus,\n index,\n orientation,\n setIndex,\n getContentProps,\n getListProps,\n getNextTriggerProps,\n getPrevTriggerProps,\n onNext,\n onPrev,\n }),\n [\n id,\n count,\n index,\n orientation,\n setIndex,\n getStatus,\n onNext,\n onPrev,\n getListProps,\n getNextTriggerProps,\n getPrevTriggerProps,\n getContentProps,\n ],\n )\n\n return (\n <StepsDescendantsContext value={descendants}>\n <StepsContext value={stepsContext}>\n <ComponentContext value={componentContext}>\n <styled.div {...getRootProps()}>{children}</styled.div>\n </ComponentContext>\n </StepsContext>\n </StepsDescendantsContext>\n )\n },\n \"root\",\n { transferProps: [\"orientation\"] },\n)()\n\nexport interface StepsListProps extends HTMLStyledProps<\"ol\"> {}\n\nexport const StepsList = withContext<\"ol\", StepsListProps>(\n ({ children, ...rest }) => {\n const { items } = useComponentContext()\n const { getListProps } = useStepsContext()\n const computedChildren = useMemo(() => {\n if (children) return children\n else\n return items?.map(\n (\n {\n complete,\n content: _content,\n current,\n description,\n hasSeparator = true,\n incomplete,\n title,\n contentProps: _contentProps,\n descriptionProps,\n indicatorProps,\n separatorProps,\n titleProps,\n ...rest\n },\n index,\n ) => (\n <StepsItem key={index} index={index} title={title} {...rest}>\n <StepsIndicator\n complete={complete}\n current={current}\n incomplete={incomplete}\n {...indicatorProps}\n />\n\n <styled.div>\n {title ? (\n <StepsTitle {...titleProps}>{title}</StepsTitle>\n ) : null}\n {description ? (\n <StepsDescription {...descriptionProps}>\n {description}\n </StepsDescription>\n ) : null}\n </styled.div>\n\n {hasSeparator ? <StepsSeparator {...separatorProps} /> : null}\n </StepsItem>\n ),\n )\n }, [children, items])\n\n return <styled.ol {...getListProps(rest)}>{computedChildren}</styled.ol>\n },\n \"list\",\n)()\n\nexport interface StepsItemProps\n extends HTMLStyledProps<\"li\">, UseStepsItemProps {}\n\nexport const StepsItem = withContext<\"li\", StepsItemProps>((props) => {\n const {\n first,\n index,\n last,\n status,\n getDescriptionProps,\n getIndicatorProps,\n getRootProps,\n getSeparatorProps,\n getTitleProps,\n } = useStepsItem(props)\n const context = useMemo(\n () => ({\n first,\n index,\n last,\n status,\n getDescriptionProps,\n getIndicatorProps,\n getSeparatorProps,\n getTitleProps,\n }),\n [\n first,\n index,\n last,\n status,\n getTitleProps,\n getDescriptionProps,\n getSeparatorProps,\n getIndicatorProps,\n ],\n )\n\n return (\n <StepsItemContext value={context}>\n <styled.li {...getRootProps()} />\n </StepsItemContext>\n )\n}, \"item\")()\n\nexport interface StepsIndicatorProps extends HTMLStyledProps {\n /**\n * The element for the complete indicator.\n *\n * @default <CheckIcon />\n */\n complete?: ReactNode\n /**\n * The element for the current indicator.\n *\n * @default <StepsNumber />\n */\n current?: ReactNode\n /**\n * The element for the incomplete indicator.\n *\n * @default <StepsNumber />\n */\n incomplete?: ReactNode\n}\n\nexport const StepsIndicator = withContext<\"div\", StepsIndicatorProps>(\n ({\n complete = <CheckIcon />,\n current = <StepsNumber />,\n incomplete = <StepsNumber />,\n ...rest\n }) => {\n const { status, getIndicatorProps } = useStepsItemContext()\n const components = useMemo(\n () => ({ complete, current, incomplete }),\n [complete, current, incomplete],\n )\n\n return (\n <styled.div {...getIndicatorProps(rest)}>{components[status]}</styled.div>\n )\n },\n \"indicator\",\n)()\n\nexport interface StepsNumberProps extends HTMLStyledProps<\"span\"> {}\n\nexport const StepsNumber = withContext<\"span\", StepsNumberProps>(\n \"span\",\n \"number\",\n)(undefined, ({ children, ...rest }) => {\n const { index } = useStepsItemContext()\n\n return { ...rest, children: children ?? index + 1 }\n})\n\nexport interface StepsTitleProps extends HTMLStyledProps {}\n\nexport const StepsTitle = withContext<\"h3\", StepsTitleProps>(\"h3\", \"title\")(\n undefined,\n (props) => {\n const { getTitleProps } = useStepsItemContext()\n\n return getTitleProps(props)\n },\n)\n\nexport interface StepsDescriptionProps extends HTMLStyledProps<\"p\"> {}\n\nexport const StepsDescription = withContext<\"p\", StepsDescriptionProps>(\n \"p\",\n \"description\",\n)(undefined, (props) => {\n const { getDescriptionProps } = useStepsItemContext()\n\n return getDescriptionProps(props)\n})\n\nexport interface StepsSeparatorProps extends HTMLStyledProps {}\n\nexport const StepsSeparator = withContext<\"div\", StepsSeparatorProps>(\n \"div\",\n \"separator\",\n)(undefined, (props) => {\n const { getSeparatorProps } = useStepsItemContext()\n\n return getSeparatorProps(props)\n})\n\nexport interface StepsContentsProps extends PropsWithChildren {}\n\nexport const StepsContents: FC<StepsContentsProps> = ({ children }) => {\n const { items } = useComponentContext()\n\n return useMemo(() => {\n if (children) return children\n else\n return items?.map(({ content, contentProps }, index) =>\n isUndefined(content) || isNull(content) ? null : (\n <StepsContent key={index} index={index} {...contentProps}>\n {content}\n </StepsContent>\n ),\n )\n }, [children, items])\n}\n\nexport interface StepsContentProps extends HTMLStyledProps {\n /**\n * The index of the step content.\n */\n index: number\n}\n\nexport const StepsContent = withContext<\"div\", StepsContentProps>(\n \"div\",\n \"content\",\n)(undefined, ({ index, ...rest }) => {\n const { lazy, lazyBehavior } = useComponentContext()\n const { index: selectedIndex, getContentProps } = useStepsContext()\n const mounted = index === selectedIndex\n const children = useLazyMount({\n lazy,\n lazyBehavior,\n mounted,\n ...rest,\n })\n\n return { ...getContentProps({ index, ...rest }), children }\n})\n\nexport interface StepsCompletedContentProps extends HTMLStyledProps {}\n\nexport const StepsCompletedContent = withContext<\n \"div\",\n StepsCompletedContentProps\n>(\"div\", { name: \"CompletedContent\", slot: [\"content\", \"completed\"] })(\n undefined,\n (props) => {\n const { lazy, lazyBehavior } = useComponentContext()\n const { count, index: selectedIndex, getContentProps } = useStepsContext()\n const mounted = count !== 0 && count === selectedIndex\n const children = useLazyMount({\n lazy,\n lazyBehavior,\n mounted,\n ...props,\n })\n\n return { ...getContentProps(props), children }\n },\n)\n\nexport interface StepsPrevTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const StepsPrevTrigger = withContext<\"button\", StepsPrevTriggerProps>(\n \"button\",\n { name: \"PrevTrigger\", slot: [\"trigger\", \"prev\"] },\n)((props) => {\n const { getPrevTriggerProps } = useStepsContext()\n\n return { asChild: true, ...getPrevTriggerProps(props) }\n})\n\nexport interface StepsNextTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const StepsNextTrigger = withContext<\"button\", StepsNextTriggerProps>(\n \"button\",\n { name: \"NextTrigger\", slot: [\"trigger\", \"next\"] },\n)((props) => {\n const { getNextTriggerProps } = useStepsContext()\n\n return { asChild: true, ...getNextTriggerProps(props) }\n})\n"],"mappings":";;;;;;;;;;;;;AA0FA,MAAM,EACJ,kBACA,cAAc,mBACd,qBACA,iBAAiB,sBACjB,aACA,iBACEA,yBAAAA,oBACF,SACAC,oBAAAA,UACF;;;;;;AASA,MAAa,YAAY,cACtB,EACC,UACA,QAAQ,CAAC,GACT,MACA,cACA,aAAa,iBACb,GAAG,WACC;CACJ,MAAM,sBAAsBC,8BAAAA,SAAS,eAAe;CAEpD,MAAM,YAAYC,iBAAAA,aADIC,iBAAAA,iBAAiB,QACoB,GAAG,SAAS;CACvE,MAAM,EACJ,IACA,OACA,aACA,WACA,OACA,aACA,UACA,iBACA,cACA,qBACA,qBACA,cACA,QACA,WACEC,kBAAAA,SAAS;EACX,OAAO,MAAM,UAAUC,MAAAA,SAAS,MAAM,WAAW,MAAM,QAAQ;EAC/D,aAAa;EACb,GAAG;CACL,CAAC;CACD,MAAM,oBAAA,GAAA,MAAA,QAAA,QACG;EAAE;EAAO;EAAM;CAAa,IACnC;EAAC;EAAO;EAAM;CAAY,CAC5B;CAgCA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,kBAAAA,yBAAD;EAAyB,OAAO;YAC9B,iBAAA,GAAA,kBAAA,IAAA,CAACC,kBAAAA,cAAD;GAAc,QAAA,GAAA,MAAA,QAAA,QAhCT;IACL;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACF,IACA;IACE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACF,CAKkC;aAC9B,iBAAA,GAAA,kBAAA,IAAA,CAAC,kBAAD;IAAkB,OAAO;cACvB,iBAAA,GAAA,kBAAA,IA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