@yamada-ui/react 2.2.0-next-20260324220421 → 2.2.0-next-20260324223405

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 (230) hide show
  1. package/dist/cjs/components/menu/menu.cjs +2 -2
  2. package/dist/cjs/components/menu/menu.cjs.map +1 -1
  3. package/dist/cjs/components/modal/modal.cjs +1 -1
  4. package/dist/cjs/components/modal/modal.cjs.map +1 -1
  5. package/dist/cjs/components/modal/use-modal.cjs +3 -5
  6. package/dist/cjs/components/modal/use-modal.cjs.map +1 -1
  7. package/dist/cjs/components/pagination/pagination.cjs +4 -4
  8. package/dist/cjs/components/pagination/pagination.cjs.map +1 -1
  9. package/dist/cjs/components/timeline/timeline.cjs +10 -4
  10. package/dist/cjs/components/timeline/timeline.cjs.map +1 -1
  11. package/dist/cjs/components/timeline/timeline.style.cjs +8 -1
  12. package/dist/cjs/components/timeline/timeline.style.cjs.map +1 -1
  13. package/dist/esm/components/menu/menu.js +2 -2
  14. package/dist/esm/components/menu/menu.js.map +1 -1
  15. package/dist/esm/components/modal/modal.js +1 -1
  16. package/dist/esm/components/modal/modal.js.map +1 -1
  17. package/dist/esm/components/modal/use-modal.js +4 -6
  18. package/dist/esm/components/modal/use-modal.js.map +1 -1
  19. package/dist/esm/components/pagination/pagination.js +4 -4
  20. package/dist/esm/components/pagination/pagination.js.map +1 -1
  21. package/dist/esm/components/timeline/timeline.js +10 -4
  22. package/dist/esm/components/timeline/timeline.js.map +1 -1
  23. package/dist/esm/components/timeline/timeline.style.js +8 -1
  24. package/dist/esm/components/timeline/timeline.style.js.map +1 -1
  25. package/dist/types/components/accordion/accordion.d.ts +2 -2
  26. package/dist/types/components/accordion/accordion.style.d.ts +1 -1
  27. package/dist/types/components/accordion/use-accordion.d.ts +11 -11
  28. package/dist/types/components/action-bar/action-bar.d.ts +2 -2
  29. package/dist/types/components/airy/airy.d.ts +2 -2
  30. package/dist/types/components/alert/alert.d.ts +2 -2
  31. package/dist/types/components/alert/alert.style.d.ts +1 -1
  32. package/dist/types/components/alpha-slider/alpha-slider.d.ts +2 -2
  33. package/dist/types/components/aspect-ratio/aspect-ratio.d.ts +2 -2
  34. package/dist/types/components/autocomplete/autocomplete.d.ts +2 -2
  35. package/dist/types/components/autocomplete/autocomplete.style.d.ts +1 -1
  36. package/dist/types/components/autocomplete/use-autocomplete.d.ts +5 -5
  37. package/dist/types/components/avatar/avatar.d.ts +5 -5
  38. package/dist/types/components/avatar/use-avatar-group.d.ts +2 -2
  39. package/dist/types/components/badge/badge.d.ts +2 -2
  40. package/dist/types/components/bleed/bleed.d.ts +2 -2
  41. package/dist/types/components/blockquote/blockquote.d.ts +2 -2
  42. package/dist/types/components/breadcrumb/breadcrumb.d.ts +2 -2
  43. package/dist/types/components/breadcrumb/breadcrumb.style.d.ts +1 -1
  44. package/dist/types/components/breadcrumb/use-breadcrumb.d.ts +2 -2
  45. package/dist/types/components/button/button.d.ts +2 -2
  46. package/dist/types/components/button/icon-button.d.ts +2 -2
  47. package/dist/types/components/calendar/calendar.d.ts +2 -2
  48. package/dist/types/components/calendar/use-calendar.d.ts +8 -8
  49. package/dist/types/components/card/card.d.ts +2 -2
  50. package/dist/types/components/carousel/carousel.d.ts +2 -2
  51. package/dist/types/components/carousel/carousel.style.d.ts +2 -2
  52. package/dist/types/components/carousel/use-carousel.d.ts +3 -3
  53. package/dist/types/components/center/center.d.ts +2 -2
  54. package/dist/types/components/chart/cartesian-chart.style.d.ts +1 -1
  55. package/dist/types/components/chart/chart.d.ts +5 -5
  56. package/dist/types/components/chart/composed-chart.d.ts +2 -2
  57. package/dist/types/components/chart/donut-chart.d.ts +2 -2
  58. package/dist/types/components/chart/line-chart.d.ts +2 -2
  59. package/dist/types/components/chart/pie-chart.d.ts +2 -2
  60. package/dist/types/components/chart/polar-chart.style.d.ts +1 -1
  61. package/dist/types/components/chart/radar-chart.d.ts +2 -2
  62. package/dist/types/components/chart/radial-chart.d.ts +2 -2
  63. package/dist/types/components/chart/use-chart.d.ts +2 -2
  64. package/dist/types/components/checkbox/checkbox.d.ts +5 -5
  65. package/dist/types/components/checkbox/checkbox.style.d.ts +1 -1
  66. package/dist/types/components/checkbox/use-checkbox-group.d.ts +2 -2
  67. package/dist/types/components/checkbox-card/checkbox-card.d.ts +5 -5
  68. package/dist/types/components/checkbox-card/checkbox-card.style.d.ts +1 -1
  69. package/dist/types/components/circle-progress/circle-progress.d.ts +2 -2
  70. package/dist/types/components/close-button/close-button.d.ts +2 -2
  71. package/dist/types/components/code/code.d.ts +2 -2
  72. package/dist/types/components/collapse/collapse.d.ts +2 -2
  73. package/dist/types/components/color-picker/color-picker.d.ts +2 -2
  74. package/dist/types/components/color-picker/color-picker.style.d.ts +1 -1
  75. package/dist/types/components/color-picker/use-color-picker.d.ts +2 -2
  76. package/dist/types/components/color-selector/color-selector.d.ts +2 -2
  77. package/dist/types/components/color-selector/use-color-selector.d.ts +3 -3
  78. package/dist/types/components/color-swatch/color-swatch.d.ts +2 -2
  79. package/dist/types/components/container/container.d.ts +2 -2
  80. package/dist/types/components/data-list/data-list.d.ts +2 -2
  81. package/dist/types/components/data-list/data-list.style.d.ts +1 -1
  82. package/dist/types/components/date-picker/date-picker.d.ts +2 -2
  83. package/dist/types/components/date-picker/date-picker.style.d.ts +1 -1
  84. package/dist/types/components/date-picker/use-date-picker.d.ts +4 -4
  85. package/dist/types/components/drawer/drawer.d.ts +2 -2
  86. package/dist/types/components/dropzone/dropzone.d.ts +5 -5
  87. package/dist/types/components/dropzone/dropzone.style.d.ts +1 -1
  88. package/dist/types/components/editable/editable.d.ts +4 -4
  89. package/dist/types/components/editable/use-editable.d.ts +2 -2
  90. package/dist/types/components/em/em.d.ts +2 -2
  91. package/dist/types/components/empty-state/empty-state.d.ts +2 -2
  92. package/dist/types/components/empty-state/empty-state.style.d.ts +2 -2
  93. package/dist/types/components/field/field.d.ts +3 -3
  94. package/dist/types/components/field/field.style.d.ts +2 -2
  95. package/dist/types/components/field/use-field-props.d.ts +3 -3
  96. package/dist/types/components/fieldset/fieldset.d.ts +3 -3
  97. package/dist/types/components/fieldset/fieldset.style.d.ts +1 -1
  98. package/dist/types/components/file-button/file-button.d.ts +2 -2
  99. package/dist/types/components/file-button/use-file-button.d.ts +18 -18
  100. package/dist/types/components/file-input/file-input.d.ts +2 -2
  101. package/dist/types/components/file-input/use-file-input.d.ts +15 -15
  102. package/dist/types/components/flex/flex.d.ts +2 -2
  103. package/dist/types/components/flip/flip.d.ts +4 -4
  104. package/dist/types/components/flip/flip.style.d.ts +1 -1
  105. package/dist/types/components/float/float.d.ts +2 -2
  106. package/dist/types/components/form/form.d.ts +3 -3
  107. package/dist/types/components/form/form.style.d.ts +1 -1
  108. package/dist/types/components/format/format-byte.d.ts +4 -4
  109. package/dist/types/components/format/format-date-time.d.ts +2 -2
  110. package/dist/types/components/format/format-number.d.ts +2 -2
  111. package/dist/types/components/grid/grid-item.d.ts +2 -2
  112. package/dist/types/components/grid/grid.d.ts +2 -2
  113. package/dist/types/components/group/group.d.ts +2 -2
  114. package/dist/types/components/group/use-group.d.ts +2 -2
  115. package/dist/types/components/heading/heading.d.ts +2 -2
  116. package/dist/types/components/hue-slider/hue-slider.d.ts +3 -3
  117. package/dist/types/components/icon/icon.d.ts +5 -5
  118. package/dist/types/components/image/image.d.ts +2 -2
  119. package/dist/types/components/indicator/indicator.d.ts +4 -4
  120. package/dist/types/components/infinite-scroll-area/infinite-scroll-area.d.ts +2 -2
  121. package/dist/types/components/infinite-scroll-area/infinite-scroll-area.style.d.ts +2 -2
  122. package/dist/types/components/input/input-addon.d.ts +2 -2
  123. package/dist/types/components/input/input-element.d.ts +2 -2
  124. package/dist/types/components/input/input.d.ts +2 -2
  125. package/dist/types/components/kbd/kbd.d.ts +2 -2
  126. package/dist/types/components/link/link.d.ts +2 -2
  127. package/dist/types/components/link-box/link-box.d.ts +2 -2
  128. package/dist/types/components/list/list.d.ts +2 -2
  129. package/dist/types/components/list/list.style.d.ts +2 -2
  130. package/dist/types/components/loading/loading-provider.d.ts +2 -2
  131. package/dist/types/components/loading/loading.d.ts +3 -3
  132. package/dist/types/components/mark/mark.d.ts +2 -2
  133. package/dist/types/components/menu/menu.d.ts +2 -2
  134. package/dist/types/components/menu/menu.style.d.ts +2 -2
  135. package/dist/types/components/menu/use-menu.d.ts +11 -11
  136. package/dist/types/components/modal/modal.d.ts +3 -3
  137. package/dist/types/components/native-accordion/native-accordion.d.ts +2 -2
  138. package/dist/types/components/native-accordion/native-accordion.style.d.ts +2 -2
  139. package/dist/types/components/native-accordion/use-native-accordion.d.ts +2 -2
  140. package/dist/types/components/native-popover/native-popover.d.ts +2 -2
  141. package/dist/types/components/native-select/native-select.d.ts +2 -2
  142. package/dist/types/components/native-select/native-select.style.d.ts +1 -1
  143. package/dist/types/components/native-table/native-table.d.ts +2 -2
  144. package/dist/types/components/notice/notice.style.d.ts +1 -1
  145. package/dist/types/components/number-input/number-input.d.ts +2 -2
  146. package/dist/types/components/number-input/number-input.style.d.ts +1 -1
  147. package/dist/types/components/pagination/pagination.d.ts +2 -2
  148. package/dist/types/components/pagination/pagination.style.d.ts +1 -1
  149. package/dist/types/components/pagination/use-pagination.d.ts +2 -2
  150. package/dist/types/components/password-input/password-input.d.ts +2 -2
  151. package/dist/types/components/password-input/password-input.style.d.ts +1 -1
  152. package/dist/types/components/password-input/strength-meter.d.ts +2 -2
  153. package/dist/types/components/password-input/strength-meter.style.d.ts +1 -1
  154. package/dist/types/components/password-input/use-password-input.d.ts +2 -2
  155. package/dist/types/components/pin-input/pin-input.d.ts +2 -2
  156. package/dist/types/components/pin-input/pin-input.style.d.ts +1 -1
  157. package/dist/types/components/pin-input/use-pin-input.d.ts +7 -7
  158. package/dist/types/components/popover/popover.d.ts +2 -2
  159. package/dist/types/components/progress/progress.d.ts +2 -2
  160. package/dist/types/components/progress/use-progress.d.ts +706 -706
  161. package/dist/types/components/qr-code/qr-code.d.ts +2 -2
  162. package/dist/types/components/radio/radio.d.ts +5 -5
  163. package/dist/types/components/radio/radio.style.d.ts +1 -1
  164. package/dist/types/components/radio/use-radio-group.d.ts +2 -2
  165. package/dist/types/components/radio-card/radio-card.d.ts +5 -5
  166. package/dist/types/components/radio-card/radio-card.style.d.ts +1 -1
  167. package/dist/types/components/rating/rating.style.d.ts +2 -2
  168. package/dist/types/components/rating/use-rating.d.ts +7 -7
  169. package/dist/types/components/reorder/reorder.d.ts +2 -2
  170. package/dist/types/components/reorder/reorder.style.d.ts +1 -1
  171. package/dist/types/components/reorder/use-reorder.d.ts +3 -3
  172. package/dist/types/components/resizable/resizable.d.ts +2 -2
  173. package/dist/types/components/resizable/resizable.style.d.ts +2 -2
  174. package/dist/types/components/resizable/use-resizable.d.ts +2 -2
  175. package/dist/types/components/ripple/ripple.d.ts +2 -2
  176. package/dist/types/components/ripple/use-ripple.d.ts +2 -2
  177. package/dist/types/components/rotate/rotate.d.ts +2 -2
  178. package/dist/types/components/saturation-slider/saturation-slider.d.ts +2 -2
  179. package/dist/types/components/saturation-slider/use-saturation-slider.d.ts +2 -2
  180. package/dist/types/components/scroll-area/scroll-area.d.ts +2 -2
  181. package/dist/types/components/segmented-control/segmented-control.d.ts +2 -2
  182. package/dist/types/components/segmented-control/segmented-control.style.d.ts +2 -2
  183. package/dist/types/components/segmented-control/use-segmented-control.d.ts +9 -9
  184. package/dist/types/components/select/select.d.ts +2 -2
  185. package/dist/types/components/select/select.style.d.ts +1 -1
  186. package/dist/types/components/select/use-select.d.ts +4 -4
  187. package/dist/types/components/separator/separator.d.ts +2 -2
  188. package/dist/types/components/simple-grid/simple-grid.d.ts +2 -2
  189. package/dist/types/components/skeleton/skeleton.d.ts +2 -2
  190. package/dist/types/components/slide/slide.d.ts +2 -2
  191. package/dist/types/components/slide-fade/slide-fade.d.ts +2 -2
  192. package/dist/types/components/slider/slider.d.ts +2 -2
  193. package/dist/types/components/slider/use-slider.d.ts +2 -2
  194. package/dist/types/components/stack/h-stack.d.ts +2 -2
  195. package/dist/types/components/stack/stack.d.ts +2 -2
  196. package/dist/types/components/stack/v-stack.d.ts +2 -2
  197. package/dist/types/components/stack/z-stack.d.ts +2 -2
  198. package/dist/types/components/stat/stat.d.ts +2 -2
  199. package/dist/types/components/stat/stat.style.d.ts +2 -2
  200. package/dist/types/components/status/status.d.ts +2 -2
  201. package/dist/types/components/status/status.style.d.ts +2 -2
  202. package/dist/types/components/steps/steps.d.ts +2 -2
  203. package/dist/types/components/steps/steps.style.d.ts +1 -1
  204. package/dist/types/components/steps/use-steps.d.ts +10 -10
  205. package/dist/types/components/switch/switch.d.ts +2 -2
  206. package/dist/types/components/table/table.d.ts +2 -2
  207. package/dist/types/components/tabs/tabs.d.ts +2 -2
  208. package/dist/types/components/tabs/use-tabs.d.ts +16 -16
  209. package/dist/types/components/tag/tag.d.ts +2 -2
  210. package/dist/types/components/tag/tag.style.d.ts +1 -1
  211. package/dist/types/components/text/text.d.ts +2 -2
  212. package/dist/types/components/textarea/textarea.d.ts +2 -2
  213. package/dist/types/components/textarea/use-autosize.d.ts +2 -2
  214. package/dist/types/components/timeline/timeline.d.ts +26 -6
  215. package/dist/types/components/timeline/timeline.style.d.ts +21 -3
  216. package/dist/types/components/toggle/toggle.d.ts +5 -5
  217. package/dist/types/components/toggle/use-toggle-group.d.ts +2 -2
  218. package/dist/types/components/toggle/use-toggle.d.ts +2 -2
  219. package/dist/types/components/tooltip/tooltip.d.ts +2 -2
  220. package/dist/types/components/tree/tree.d.ts +2 -2
  221. package/dist/types/components/tree/tree.style.d.ts +1 -1
  222. package/dist/types/components/tree/use-tree.d.ts +10 -10
  223. package/dist/types/components/visually-hidden/visually-hidden.d.ts +2 -2
  224. package/dist/types/components/wrap/wrap.d.ts +2 -2
  225. package/dist/types/core/system/color-mode-provider.d.ts +2 -2
  226. package/dist/types/core/system/styled.d.ts +2 -2
  227. package/dist/types/core/system/system-provider.d.ts +2 -2
  228. package/dist/types/providers/i18n-provider/i18n-provider.d.ts +3 -3
  229. package/dist/types/providers/ui-provider/ui-provider.d.ts +2 -2
  230. package/package.json +2 -2
@@ -273,7 +273,7 @@ const MenuOptionGroup = withContext(({ type: typeProp, defaultValue, value: valu
273
273
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MenuGroup, { ...rest })
274
274
  });
275
275
  }, {
276
- name: "optionGroup",
276
+ name: "OptionGroup",
277
277
  slot: ["group", "option"]
278
278
  })();
279
279
  const MenuItem = withContext(({ children, ...rest }) => {
@@ -296,7 +296,7 @@ const MenuOptionItem = withContext(({ children, icon, ...rest }) => {
296
296
  }), children]
297
297
  });
298
298
  }, {
299
- name: "optionItem",
299
+ name: "OptionItem",
300
300
  slot: ["item", "option"]
301
301
  })();
302
302
  const MenuIndicator = withContext("div", "indicator")();
@@ -1 +1 @@
1
- {"version":3,"file":"menu.cjs","names":["createSlotComponent","menuStyle","MenuRoot: FC<MenuRootProps>","usePopoverProps","useMenu","MenuDescendantsContext","MenuContext","MainMenuContext","styled","useMenuContext","rest","Fragment","items","index","useMenuGroupContext","useMenuGroup","MenuGroupContext","useMenuOptionGroup","MenuOptionGroupContext","useMenuItem","ChevronRightIcon","useMenuOptionItem","CircleSmallIcon","CheckIcon"],"sources":["../../../../src/components/menu/menu.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, ReactElement, ReactNode } from \"react\"\nimport type {\n Direction,\n GenericsComponent,\n HTMLProps,\n HTMLStyledProps,\n ThemeProps,\n WithoutThemeProps,\n} from \"../../core\"\nimport type { MenuStyle } from \"./menu.style\"\nimport type {\n MenuOptionGroupType,\n MenuOptionGroupValue,\n UseMenuGroupProps,\n UseMenuItemProps,\n UseMenuOptionGroupProps,\n UseMenuOptionItemProps,\n UseMenuProps,\n UseMenuReturn,\n} from \"./use-menu\"\nimport { Fragment, useMemo, useState } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { cast, handlerAll } from \"../../utils\"\nimport { CheckIcon, ChevronRightIcon, CircleSmallIcon } from \"../icon\"\nimport { Popover, usePopoverProps } from \"../popover\"\nimport { menuStyle } from \"./menu.style\"\nimport {\n MainMenuContext,\n MenuContext,\n MenuDescendantsContext,\n MenuGroupContext,\n MenuOptionGroupContext,\n useMenu,\n useMenuContext,\n useMenuGroup,\n useMenuGroupContext,\n useMenuItem,\n useMenuOptionGroup,\n useMenuOptionItem,\n} from \"./use-menu\"\n\ninterface MenuSharedItem {\n label?: ReactNode\n}\n\ninterface MenuItemWithValue extends MenuSharedItem, MenuItemProps {}\n\ninterface MenuOptionItem extends MenuSharedItem, MenuOptionItemProps {}\n\ninterface MenuItemWithSeparator extends MenuSeparatorProps {\n type: \"separator\"\n}\n\ninterface MenuItemWithRadioGroup<Y extends string = string>\n extends\n Omit<MenuItemWithItems, \"defaultValue\" | \"items\" | \"onChange\">,\n MenuOptionGroupProps<\"radio\", Y> {\n type: \"radio\"\n items?: MenuOptionItem[]\n}\n\ninterface MenuItemWithCheckboxGroup<Y extends string[] = string[]>\n extends\n Omit<MenuItemWithItems, \"defaultValue\" | \"items\" | \"onChange\">,\n MenuOptionGroupProps<\"checkbox\", Y> {\n type: \"checkbox\"\n items?: MenuOptionItem[]\n}\n\ninterface MenuItemWithItems extends MenuSharedItem, MenuGroupProps {\n hasEndSeparator?: boolean\n hasSeparator?: boolean\n hasStartSeparator?: boolean\n items?: MenuItemWithValue[]\n labelProps?: MenuLabelProps\n}\n\nexport type MenuItem =\n | MenuItemWithCheckboxGroup\n | MenuItemWithItems\n | MenuItemWithRadioGroup\n | MenuItemWithSeparator\n | MenuItemWithValue\n\ninterface ComponentContext extends Pick<\n UseMenuReturn,\n | \"getContentProps\"\n | \"getContextTriggerProps\"\n | \"getSeparatorProps\"\n | \"getTriggerProps\"\n> {}\n\nexport interface MenuRootProps\n extends\n UseMenuProps,\n Omit<\n WithoutThemeProps<Popover.RootProps, MenuStyle>,\n \"autoFocus\" | \"modal\" | \"updateRef\" | \"withCloseButton\"\n >,\n ThemeProps<MenuStyle> {\n /**\n * The placement of the popper relative to its reference.\n *\n * @default 'end-start'\n */\n placement?: Direction\n}\n\nconst {\n ComponentContext,\n PropsContext: MenuPropsContext,\n StyleContext,\n useComponentContext,\n usePropsContext: useMenuPropsContext,\n withContext,\n useRootComponentProps,\n} = createSlotComponent<MenuRootProps, MenuStyle, ComponentContext>(\n \"menu\",\n menuStyle,\n)\n\nexport { MenuPropsContext, useMenuPropsContext }\n\n/**\n * `Menu` is a component that displays a common dropdown menu.\n *\n * @see https://yamada-ui.com/docs/components/menu\n */\nexport const MenuRoot: FC<MenuRootProps> = (props) => {\n const [styleContext, mergedProps] = useRootComponentProps(props)\n const [\n { animationScheme, initialFocusRef, offset, placement, ...popoverProps },\n { children, disabled, ...rest },\n ] = usePopoverProps(mergedProps, [\n \"disabled\",\n \"open\",\n \"defaultOpen\",\n \"onOpen\",\n \"onClose\",\n ])\n const {\n closeOnSelect,\n descendants,\n open,\n subMenu,\n subMenuDirection,\n updateRef,\n getContentProps,\n getContextTriggerProps,\n getSeparatorProps,\n getTriggerProps,\n onActiveDescendant,\n onClose,\n onCloseRef,\n onCloseSubMenu,\n onOpen,\n onSelect,\n } = useMenu({ disabled, ...rest })\n const mergedPopoverProps = useMemo<Popover.RootProps>(\n () => ({\n ...popoverProps,\n animationScheme:\n animationScheme ?? (subMenu ? \"inline-start\" : \"block-start\"),\n autoFocus: !!initialFocusRef,\n disabled,\n initialFocusRef,\n offset: offset ?? (subMenu ? [0, 0] : undefined),\n open,\n placement:\n placement ?? (subMenu ? `center-${subMenuDirection}` : \"end-start\"),\n updateRef,\n onClose,\n onOpen,\n }),\n [\n animationScheme,\n disabled,\n initialFocusRef,\n offset,\n onClose,\n onOpen,\n open,\n placement,\n popoverProps,\n subMenu,\n subMenuDirection,\n updateRef,\n ],\n )\n const menuContext = useMemo(\n () => ({\n subMenu,\n subMenuDirection,\n onActiveDescendant,\n onClose,\n onCloseSubMenu,\n onOpen,\n onSelect,\n }),\n [\n onClose,\n onOpen,\n onSelect,\n onActiveDescendant,\n subMenu,\n subMenuDirection,\n onCloseSubMenu,\n ],\n )\n const mainMenuContext = useMemo(\n () => ({\n closeOnSelect,\n descendants,\n onActiveDescendant,\n onCloseRef,\n onSelect,\n }),\n [closeOnSelect, descendants, onActiveDescendant, onCloseRef, onSelect],\n )\n const componentContext = useMemo(\n () => ({\n getContentProps,\n getContextTriggerProps,\n getSeparatorProps,\n getTriggerProps,\n }),\n [\n getContentProps,\n getContextTriggerProps,\n getSeparatorProps,\n getTriggerProps,\n ],\n )\n\n return (\n <StyleContext value={styleContext}>\n <MenuDescendantsContext value={descendants}>\n <MenuContext value={menuContext}>\n <MainMenuContext value={mainMenuContext}>\n <ComponentContext value={componentContext}>\n <Popover.Root {...mergedPopoverProps}>{children}</Popover.Root>\n </ComponentContext>\n </MainMenuContext>\n </MenuContext>\n </MenuDescendantsContext>\n </StyleContext>\n )\n}\n\nexport interface MenuTriggerProps extends Popover.TriggerProps {}\n\nexport const MenuTrigger = withContext<\"button\", MenuTriggerProps>(\n Popover.Trigger,\n \"trigger\",\n)(undefined, (props) => {\n const { getTriggerProps } = useComponentContext()\n\n return cast<HTMLProps<\"button\">>(getTriggerProps(cast<HTMLProps>(props)))\n})\n\ninterface Rect {\n left: number\n top: number\n}\n\nexport interface MenuContextTriggerProps extends HTMLProps {}\n\nexport const MenuContextTrigger = withContext<\"div\", MenuContextTriggerProps>(\n ({ children, onContextMenu, ...rest }) => {\n const [rect, setRect] = useState<Rect>({\n left: 0,\n top: 0,\n })\n const { getContextTriggerProps } = useComponentContext()\n\n return (\n <>\n <MenuAnchor>\n <styled.div style={{ position: \"fixed\", ...rect }} />\n </MenuAnchor>\n\n <styled.div\n asChild\n {...getContextTriggerProps({\n onContextMenu: handlerAll(onContextMenu, (ev) => {\n setRect({ left: ev.clientX, top: ev.clientY })\n }),\n ...rest,\n })}\n >\n {children}\n </styled.div>\n </>\n )\n },\n \"contextTrigger\",\n)()\n\nexport interface MenuAnchorProps extends Popover.AnchorProps {}\n\nexport const MenuAnchor = withContext<\"div\", MenuAnchorProps>(\n Popover.Anchor,\n \"anchor\",\n)()\n\nexport interface MenuContentProps extends Popover.ContentProps {\n /**\n * The footer of the menu.\n */\n footer?: ReactNode\n /**\n * The header of the menu.\n */\n header?: ReactNode\n /**\n * If provided, generate elements based on items.\n */\n items?: MenuItem[]\n /**\n * Props for the footer component.\n */\n footerProps?: MenuFooterProps\n /**\n * Props for the header component.\n */\n headerProps?: MenuHeaderProps\n}\n\nexport const MenuContent = withContext<\"div\", MenuContentProps>(\n Popover.Content,\n \"content\",\n)(\n undefined,\n ({\n children,\n footer,\n header,\n items = [],\n footerProps,\n headerProps,\n portalProps,\n ...rest\n }) => {\n const { subMenu } = useMenuContext()\n const { getContentProps } = useComponentContext()\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return (\n <>\n {header ? <MenuHeader {...headerProps}>{header}</MenuHeader> : null}\n\n {items.map((props, index) => {\n if (\"type\" in props) {\n if (props.type === \"radio\") {\n const {\n type,\n hasSeparator = true,\n hasEndSeparator = hasSeparator,\n hasStartSeparator = hasSeparator,\n items = [],\n ...rest\n } = props\n\n return (\n <Fragment key={index}>\n {hasStartSeparator ? <MenuSeparator /> : null}\n\n <MenuOptionGroup type={type} {...rest}>\n {items.map(({ label, ...rest }, index) => (\n <MenuOptionItem key={index} {...rest}>\n {label}\n </MenuOptionItem>\n ))}\n </MenuOptionGroup>\n\n {hasEndSeparator ? <MenuSeparator /> : null}\n </Fragment>\n )\n } else if (props.type === \"checkbox\") {\n const {\n type,\n hasSeparator = true,\n hasEndSeparator = hasSeparator,\n hasStartSeparator = hasSeparator,\n items = [],\n ...rest\n } = props\n\n return (\n <Fragment key={index}>\n {hasStartSeparator ? <MenuSeparator /> : null}\n\n <MenuOptionGroup type={type} {...rest}>\n {items.map(({ label, ...rest }, index) => (\n <MenuOptionItem key={index} {...rest}>\n {label}\n </MenuOptionItem>\n ))}\n </MenuOptionGroup>\n\n {hasEndSeparator ? <MenuSeparator /> : null}\n </Fragment>\n )\n } else {\n return <MenuSeparator key={index} />\n }\n } else if (\"items\" in props) {\n const {\n hasSeparator = true,\n hasEndSeparator = hasSeparator,\n hasStartSeparator = hasSeparator,\n items = [],\n ...rest\n } = props\n\n return (\n <Fragment key={index}>\n {hasStartSeparator ? <MenuSeparator /> : null}\n\n <MenuGroup {...rest}>\n {items.map(({ label, ...rest }, index) => (\n <MenuItem key={index} {...rest}>\n {label}\n </MenuItem>\n ))}\n </MenuGroup>\n\n {hasEndSeparator ? <MenuSeparator /> : null}\n </Fragment>\n )\n } else if (\"value\" in props) {\n const { label, ...rest } = props\n\n return (\n <MenuItem key={index} {...rest}>\n {label}\n </MenuItem>\n )\n }\n })}\n\n {footer ? <MenuFooter {...footerProps}>{footer}</MenuFooter> : null}\n </>\n )\n }, [children, footer, footerProps, header, headerProps, items])\n\n return {\n ...getContentProps(\n cast<HTMLProps>({ ...rest, children: computedChildren }),\n ),\n portalProps: subMenu ? { ...portalProps, disabled: true } : portalProps,\n }\n },\n)\n\nexport interface MenuHeaderProps extends HTMLStyledProps {}\n\nexport const MenuHeader = withContext<\"div\", MenuHeaderProps>(\n \"div\",\n \"header\",\n)({ \"data-header\": \"\" })\n\nexport interface MenuFooterProps extends HTMLStyledProps {}\n\nexport const MenuFooter = withContext<\"div\", MenuFooterProps>(\n \"div\",\n \"footer\",\n)({ \"data-footer\": \"\" })\n\nexport interface MenuLabelProps extends HTMLStyledProps<\"span\"> {}\n\nexport const MenuLabel = withContext<\"span\", MenuLabelProps>(\"span\", \"label\")(\n undefined,\n (props) => {\n const { getLabelProps } = useMenuGroupContext()\n\n return getLabelProps(props)\n },\n)\n\nexport interface MenuGroupProps extends UseMenuGroupProps, HTMLStyledProps {\n /**\n * The label of the group.\n */\n label?: ReactNode\n /**\n * Props for the label component.\n */\n labelProps?: MenuLabelProps\n}\n\nexport const MenuGroup = withContext<\"div\", MenuGroupProps>(\n ({ children, label, labelProps, ...rest }) => {\n const { getGroupProps, getLabelProps } = useMenuGroup(rest)\n const context = useMemo(() => ({ getLabelProps }), [getLabelProps])\n\n return (\n <MenuGroupContext value={context}>\n <styled.div {...getGroupProps()}>\n {label ? <MenuLabel {...labelProps}>{label}</MenuLabel> : null}\n {children}\n </styled.div>\n </MenuGroupContext>\n )\n },\n \"group\",\n)()\n\nexport interface MenuOptionGroupProps<\n Y extends MenuOptionGroupType = \"checkbox\",\n M extends MenuOptionGroupValue<Y> = MenuOptionGroupValue<Y>,\n>\n extends\n UseMenuOptionGroupProps<Y, M>,\n Omit<MenuGroupProps, \"defaultValue\" | \"onChange\"> {}\n\nexport const MenuOptionGroup = withContext<\"div\", MenuOptionGroupProps>(\n ({\n type: typeProp,\n defaultValue,\n value: valueProp,\n onChange: onChangeProp,\n ...rest\n }) => {\n const { type, value, onChange } = useMenuOptionGroup({\n type: typeProp,\n defaultValue,\n value: valueProp,\n onChange: onChangeProp,\n })\n const context = useMemo(\n () => ({ type, value, onChange }),\n [type, value, onChange],\n )\n\n return (\n <MenuOptionGroupContext value={context}>\n <MenuGroup {...rest} />\n </MenuOptionGroupContext>\n )\n },\n { name: \"optionGroup\", slot: [\"group\", \"option\"] },\n)() as GenericsComponent<{\n <\n Y extends MenuOptionGroupType = \"checkbox\",\n M extends MenuOptionGroupValue<Y> = MenuOptionGroupValue<Y>,\n >(\n props: MenuOptionGroupProps<Y, M>,\n ): ReactElement\n}>\n\nexport interface MenuItemProps extends HTMLStyledProps, UseMenuItemProps {}\n\nexport const MenuItem = withContext<\"div\", MenuItemProps>(\n ({ children, ...rest }) => {\n const { subMenuTrigger, getItemProps } = useMenuItem(rest)\n\n return (\n <styled.div {...getItemProps()}>\n {children}\n\n {subMenuTrigger ? (\n <MenuIndicator as={ChevronRightIcon} ms=\"auto\" />\n ) : null}\n </styled.div>\n )\n },\n \"item\",\n)()\n\nexport interface MenuOptionItemProps\n extends HTMLStyledProps, UseMenuOptionItemProps {\n /**\n * The icon to be used in the menu option item.\n */\n icon?: ReactNode\n}\n\nexport const MenuOptionItem = withContext<\"div\", MenuOptionItemProps>(\n ({ children, icon, ...rest }) => {\n const { type, getIndicatorProps, getOptionItemProps } =\n useMenuOptionItem(rest)\n\n return (\n <styled.div {...getOptionItemProps()}>\n <MenuIndicator {...getIndicatorProps()}>\n {icon ||\n (type === \"radio\" ? (\n <CircleSmallIcon fill=\"currentColor\" />\n ) : (\n <CheckIcon />\n ))}\n </MenuIndicator>\n {children}\n </styled.div>\n )\n },\n { name: \"optionItem\", slot: [\"item\", \"option\"] },\n)()\n\nexport interface MenuIndicatorProps extends HTMLStyledProps {}\n\nexport const MenuIndicator = withContext<\"div\", MenuIndicatorProps>(\n \"div\",\n \"indicator\",\n)()\n\nexport interface MenuCommandProps extends HTMLStyledProps<\"kbd\"> {}\n\nexport const MenuCommand = withContext<\"kbd\", MenuCommandProps>(\n \"kbd\",\n \"command\",\n)()\n\nexport interface MenuSeparatorProps extends HTMLStyledProps<\"hr\"> {}\n\nexport const MenuSeparator = withContext<\"hr\", MenuSeparatorProps>(\n \"hr\",\n \"separator\",\n)(undefined, (props) => {\n const { getSeparatorProps } = useComponentContext()\n\n return getSeparatorProps(props)\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA8GA,MAAM,EACJ,kBACA,cAAc,kBACd,cACA,qBACA,iBAAiB,qBACjB,aACA,0BACEA,6CACF,QACAC,6BACD;;;;;;AASD,MAAaC,YAA+B,UAAU;CACpD,MAAM,CAAC,cAAc,eAAe,sBAAsB,MAAM;CAChE,MAAM,CACJ,EAAE,iBAAiB,iBAAiB,QAAQ,WAAW,GAAG,gBAC1D,EAAE,UAAU,UAAU,GAAG,UACvBC,oCAAgB,aAAa;EAC/B;EACA;EACA;EACA;EACA;EACD,CAAC;CACF,MAAM,EACJ,eACA,aACA,MACA,SACA,kBACA,WACA,iBACA,wBACA,mBACA,iBACA,oBACA,SACA,YACA,gBACA,QACA,aACEC,yBAAQ;EAAE;EAAU,GAAG;EAAM,CAAC;CAClC,MAAM,+CACG;EACL,GAAG;EACH,iBACE,oBAAoB,UAA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B,EACC,MAAM,UACN,cACA,OAAO,WACP,UAAU,cACV,GAAG,WACC;CACJ,MAAM,EAAE,MAAM,OAAO,aAAaS,oCAAmB;EACnD,MAAM;EACN;EACA,OAAO;EACP,UAAU;EACX,CAAC;AAMF,QACE,2CAACC;EAAuB,iCALjB;GAAE;GAAM;GAAO;GAAU,GAChC;GAAC;GAAM;GAAO;GAAS,CACxB;YAIG,2CAAC,aAAU,GAAI,OAAQ;GACA;GAG7B;CAAE,MAAM;CAAe,MAAM,CAAC,SAAS,SAAS;CAAE,CACnD,EAAE;AAWH,MAAa,WAAW,aACrB,EAAE,UAAU,GAAG,WAAW;CACzB,MAAM,EAAE,gBAAgB,iBAAiBC,6BAAY,KAAK;AAE1D,QACE,4CAACX,uBAAO;EAAI,GAAI,cAAc;aAC3B,UAEA,iBACC,2CAAC;GAAc,IAAIY;GAAkB,IAAG;IAAS,GAC/C;GACO;GAGjB,OACD,EAAE;AAUH,MAAa,iBAAiB,aAC3B,EAAE,UAAU,MAAM,GAAG,WAAW;CAC/B,MAAM,EAAE,MAAM,mBAAmB,uBAC/BC,mCAAkB,KAAK;AAEzB,QACE,4CAACb,uBAAO;EAAI,GAAI,oBAAoB;aAClC,2CAAC;GAAc,GAAI,mBAAmB;aACnC,SACE,SAAS,UACR,2CAACc,6CAAgB,MAAK,iBAAiB,GAEvC,2CAACC,iCAAY;IAEH,EACf;GACU;GAGjB;CAAE,MAAM;CAAc,MAAM,CAAC,QAAQ,SAAS;CAAE,CACjD,EAAE;AAIH,MAAa,gBAAgB,YAC3B,OACA,YACD,EAAE;AAIH,MAAa,cAAc,YACzB,OACA,UACD,EAAE;AAIH,MAAa,gBAAgB,YAC3B,MACA,YACD,CAAC,SAAY,UAAU;CACtB,MAAM,EAAE,sBAAsB,qBAAqB;AAEnD,QAAO,kBAAkB,MAAM;EAC/B"}
1
+ {"version":3,"file":"menu.cjs","names":["createSlotComponent","menuStyle","MenuRoot: FC<MenuRootProps>","usePopoverProps","useMenu","MenuDescendantsContext","MenuContext","MainMenuContext","styled","useMenuContext","rest","Fragment","items","index","useMenuGroupContext","useMenuGroup","MenuGroupContext","useMenuOptionGroup","MenuOptionGroupContext","useMenuItem","ChevronRightIcon","useMenuOptionItem","CircleSmallIcon","CheckIcon"],"sources":["../../../../src/components/menu/menu.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, ReactElement, ReactNode } from \"react\"\nimport type {\n Direction,\n GenericsComponent,\n HTMLProps,\n HTMLStyledProps,\n ThemeProps,\n WithoutThemeProps,\n} from \"../../core\"\nimport type { MenuStyle } from \"./menu.style\"\nimport type {\n MenuOptionGroupType,\n MenuOptionGroupValue,\n UseMenuGroupProps,\n UseMenuItemProps,\n UseMenuOptionGroupProps,\n UseMenuOptionItemProps,\n UseMenuProps,\n UseMenuReturn,\n} from \"./use-menu\"\nimport { Fragment, useMemo, useState } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { cast, handlerAll } from \"../../utils\"\nimport { CheckIcon, ChevronRightIcon, CircleSmallIcon } from \"../icon\"\nimport { Popover, usePopoverProps } from \"../popover\"\nimport { menuStyle } from \"./menu.style\"\nimport {\n MainMenuContext,\n MenuContext,\n MenuDescendantsContext,\n MenuGroupContext,\n MenuOptionGroupContext,\n useMenu,\n useMenuContext,\n useMenuGroup,\n useMenuGroupContext,\n useMenuItem,\n useMenuOptionGroup,\n useMenuOptionItem,\n} from \"./use-menu\"\n\ninterface MenuSharedItem {\n label?: ReactNode\n}\n\ninterface MenuItemWithValue extends MenuSharedItem, MenuItemProps {}\n\ninterface MenuOptionItem extends MenuSharedItem, MenuOptionItemProps {}\n\ninterface MenuItemWithSeparator extends MenuSeparatorProps {\n type: \"separator\"\n}\n\ninterface MenuItemWithRadioGroup<Y extends string = string>\n extends\n Omit<MenuItemWithItems, \"defaultValue\" | \"items\" | \"onChange\">,\n MenuOptionGroupProps<\"radio\", Y> {\n type: \"radio\"\n items?: MenuOptionItem[]\n}\n\ninterface MenuItemWithCheckboxGroup<Y extends string[] = string[]>\n extends\n Omit<MenuItemWithItems, \"defaultValue\" | \"items\" | \"onChange\">,\n MenuOptionGroupProps<\"checkbox\", Y> {\n type: \"checkbox\"\n items?: MenuOptionItem[]\n}\n\ninterface MenuItemWithItems extends MenuSharedItem, MenuGroupProps {\n hasEndSeparator?: boolean\n hasSeparator?: boolean\n hasStartSeparator?: boolean\n items?: MenuItemWithValue[]\n labelProps?: MenuLabelProps\n}\n\nexport type MenuItem =\n | MenuItemWithCheckboxGroup\n | MenuItemWithItems\n | MenuItemWithRadioGroup\n | MenuItemWithSeparator\n | MenuItemWithValue\n\ninterface ComponentContext extends Pick<\n UseMenuReturn,\n | \"getContentProps\"\n | \"getContextTriggerProps\"\n | \"getSeparatorProps\"\n | \"getTriggerProps\"\n> {}\n\nexport interface MenuRootProps\n extends\n UseMenuProps,\n Omit<\n WithoutThemeProps<Popover.RootProps, MenuStyle>,\n \"autoFocus\" | \"modal\" | \"updateRef\" | \"withCloseButton\"\n >,\n ThemeProps<MenuStyle> {\n /**\n * The placement of the popper relative to its reference.\n *\n * @default 'end-start'\n */\n placement?: Direction\n}\n\nconst {\n ComponentContext,\n PropsContext: MenuPropsContext,\n StyleContext,\n useComponentContext,\n usePropsContext: useMenuPropsContext,\n withContext,\n useRootComponentProps,\n} = createSlotComponent<MenuRootProps, MenuStyle, ComponentContext>(\n \"menu\",\n menuStyle,\n)\n\nexport { MenuPropsContext, useMenuPropsContext }\n\n/**\n * `Menu` is a component that displays a common dropdown menu.\n *\n * @see https://yamada-ui.com/docs/components/menu\n */\nexport const MenuRoot: FC<MenuRootProps> = (props) => {\n const [styleContext, mergedProps] = useRootComponentProps(props)\n const [\n { animationScheme, initialFocusRef, offset, placement, ...popoverProps },\n { children, disabled, ...rest },\n ] = usePopoverProps(mergedProps, [\n \"disabled\",\n \"open\",\n \"defaultOpen\",\n \"onOpen\",\n \"onClose\",\n ])\n const {\n closeOnSelect,\n descendants,\n open,\n subMenu,\n subMenuDirection,\n updateRef,\n getContentProps,\n getContextTriggerProps,\n getSeparatorProps,\n getTriggerProps,\n onActiveDescendant,\n onClose,\n onCloseRef,\n onCloseSubMenu,\n onOpen,\n onSelect,\n } = useMenu({ disabled, ...rest })\n const mergedPopoverProps = useMemo<Popover.RootProps>(\n () => ({\n ...popoverProps,\n animationScheme:\n animationScheme ?? (subMenu ? \"inline-start\" : \"block-start\"),\n autoFocus: !!initialFocusRef,\n disabled,\n initialFocusRef,\n offset: offset ?? (subMenu ? [0, 0] : undefined),\n open,\n placement:\n placement ?? (subMenu ? `center-${subMenuDirection}` : \"end-start\"),\n updateRef,\n onClose,\n onOpen,\n }),\n [\n animationScheme,\n disabled,\n initialFocusRef,\n offset,\n onClose,\n onOpen,\n open,\n placement,\n popoverProps,\n subMenu,\n subMenuDirection,\n updateRef,\n ],\n )\n const menuContext = useMemo(\n () => ({\n subMenu,\n subMenuDirection,\n onActiveDescendant,\n onClose,\n onCloseSubMenu,\n onOpen,\n onSelect,\n }),\n [\n onClose,\n onOpen,\n onSelect,\n onActiveDescendant,\n subMenu,\n subMenuDirection,\n onCloseSubMenu,\n ],\n )\n const mainMenuContext = useMemo(\n () => ({\n closeOnSelect,\n descendants,\n onActiveDescendant,\n onCloseRef,\n onSelect,\n }),\n [closeOnSelect, descendants, onActiveDescendant, onCloseRef, onSelect],\n )\n const componentContext = useMemo(\n () => ({\n getContentProps,\n getContextTriggerProps,\n getSeparatorProps,\n getTriggerProps,\n }),\n [\n getContentProps,\n getContextTriggerProps,\n getSeparatorProps,\n getTriggerProps,\n ],\n )\n\n return (\n <StyleContext value={styleContext}>\n <MenuDescendantsContext value={descendants}>\n <MenuContext value={menuContext}>\n <MainMenuContext value={mainMenuContext}>\n <ComponentContext value={componentContext}>\n <Popover.Root {...mergedPopoverProps}>{children}</Popover.Root>\n </ComponentContext>\n </MainMenuContext>\n </MenuContext>\n </MenuDescendantsContext>\n </StyleContext>\n )\n}\n\nexport interface MenuTriggerProps extends Popover.TriggerProps {}\n\nexport const MenuTrigger = withContext<\"button\", MenuTriggerProps>(\n Popover.Trigger,\n \"trigger\",\n)(undefined, (props) => {\n const { getTriggerProps } = useComponentContext()\n\n return cast<HTMLProps<\"button\">>(getTriggerProps(cast<HTMLProps>(props)))\n})\n\ninterface Rect {\n left: number\n top: number\n}\n\nexport interface MenuContextTriggerProps extends HTMLProps {}\n\nexport const MenuContextTrigger = withContext<\"div\", MenuContextTriggerProps>(\n ({ children, onContextMenu, ...rest }) => {\n const [rect, setRect] = useState<Rect>({\n left: 0,\n top: 0,\n })\n const { getContextTriggerProps } = useComponentContext()\n\n return (\n <>\n <MenuAnchor>\n <styled.div style={{ position: \"fixed\", ...rect }} />\n </MenuAnchor>\n\n <styled.div\n asChild\n {...getContextTriggerProps({\n onContextMenu: handlerAll(onContextMenu, (ev) => {\n setRect({ left: ev.clientX, top: ev.clientY })\n }),\n ...rest,\n })}\n >\n {children}\n </styled.div>\n </>\n )\n },\n \"contextTrigger\",\n)()\n\nexport interface MenuAnchorProps extends Popover.AnchorProps {}\n\nexport const MenuAnchor = withContext<\"div\", MenuAnchorProps>(\n Popover.Anchor,\n \"anchor\",\n)()\n\nexport interface MenuContentProps extends Popover.ContentProps {\n /**\n * The footer of the menu.\n */\n footer?: ReactNode\n /**\n * The header of the menu.\n */\n header?: ReactNode\n /**\n * If provided, generate elements based on items.\n */\n items?: MenuItem[]\n /**\n * Props for the footer component.\n */\n footerProps?: MenuFooterProps\n /**\n * Props for the header component.\n */\n headerProps?: MenuHeaderProps\n}\n\nexport const MenuContent = withContext<\"div\", MenuContentProps>(\n Popover.Content,\n \"content\",\n)(\n undefined,\n ({\n children,\n footer,\n header,\n items = [],\n footerProps,\n headerProps,\n portalProps,\n ...rest\n }) => {\n const { subMenu } = useMenuContext()\n const { getContentProps } = useComponentContext()\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return (\n <>\n {header ? <MenuHeader {...headerProps}>{header}</MenuHeader> : null}\n\n {items.map((props, index) => {\n if (\"type\" in props) {\n if (props.type === \"radio\") {\n const {\n type,\n hasSeparator = true,\n hasEndSeparator = hasSeparator,\n hasStartSeparator = hasSeparator,\n items = [],\n ...rest\n } = props\n\n return (\n <Fragment key={index}>\n {hasStartSeparator ? <MenuSeparator /> : null}\n\n <MenuOptionGroup type={type} {...rest}>\n {items.map(({ label, ...rest }, index) => (\n <MenuOptionItem key={index} {...rest}>\n {label}\n </MenuOptionItem>\n ))}\n </MenuOptionGroup>\n\n {hasEndSeparator ? <MenuSeparator /> : null}\n </Fragment>\n )\n } else if (props.type === \"checkbox\") {\n const {\n type,\n hasSeparator = true,\n hasEndSeparator = hasSeparator,\n hasStartSeparator = hasSeparator,\n items = [],\n ...rest\n } = props\n\n return (\n <Fragment key={index}>\n {hasStartSeparator ? <MenuSeparator /> : null}\n\n <MenuOptionGroup type={type} {...rest}>\n {items.map(({ label, ...rest }, index) => (\n <MenuOptionItem key={index} {...rest}>\n {label}\n </MenuOptionItem>\n ))}\n </MenuOptionGroup>\n\n {hasEndSeparator ? <MenuSeparator /> : null}\n </Fragment>\n )\n } else {\n return <MenuSeparator key={index} />\n }\n } else if (\"items\" in props) {\n const {\n hasSeparator = true,\n hasEndSeparator = hasSeparator,\n hasStartSeparator = hasSeparator,\n items = [],\n ...rest\n } = props\n\n return (\n <Fragment key={index}>\n {hasStartSeparator ? <MenuSeparator /> : null}\n\n <MenuGroup {...rest}>\n {items.map(({ label, ...rest }, index) => (\n <MenuItem key={index} {...rest}>\n {label}\n </MenuItem>\n ))}\n </MenuGroup>\n\n {hasEndSeparator ? <MenuSeparator /> : null}\n </Fragment>\n )\n } else if (\"value\" in props) {\n const { label, ...rest } = props\n\n return (\n <MenuItem key={index} {...rest}>\n {label}\n </MenuItem>\n )\n }\n })}\n\n {footer ? <MenuFooter {...footerProps}>{footer}</MenuFooter> : null}\n </>\n )\n }, [children, footer, footerProps, header, headerProps, items])\n\n return {\n ...getContentProps(\n cast<HTMLProps>({ ...rest, children: computedChildren }),\n ),\n portalProps: subMenu ? { ...portalProps, disabled: true } : portalProps,\n }\n },\n)\n\nexport interface MenuHeaderProps extends HTMLStyledProps {}\n\nexport const MenuHeader = withContext<\"div\", MenuHeaderProps>(\n \"div\",\n \"header\",\n)({ \"data-header\": \"\" })\n\nexport interface MenuFooterProps extends HTMLStyledProps {}\n\nexport const MenuFooter = withContext<\"div\", MenuFooterProps>(\n \"div\",\n \"footer\",\n)({ \"data-footer\": \"\" })\n\nexport interface MenuLabelProps extends HTMLStyledProps<\"span\"> {}\n\nexport const MenuLabel = withContext<\"span\", MenuLabelProps>(\"span\", \"label\")(\n undefined,\n (props) => {\n const { getLabelProps } = useMenuGroupContext()\n\n return getLabelProps(props)\n },\n)\n\nexport interface MenuGroupProps extends UseMenuGroupProps, HTMLStyledProps {\n /**\n * The label of the group.\n */\n label?: ReactNode\n /**\n * Props for the label component.\n */\n labelProps?: MenuLabelProps\n}\n\nexport const MenuGroup = withContext<\"div\", MenuGroupProps>(\n ({ children, label, labelProps, ...rest }) => {\n const { getGroupProps, getLabelProps } = useMenuGroup(rest)\n const context = useMemo(() => ({ getLabelProps }), [getLabelProps])\n\n return (\n <MenuGroupContext value={context}>\n <styled.div {...getGroupProps()}>\n {label ? <MenuLabel {...labelProps}>{label}</MenuLabel> : null}\n {children}\n </styled.div>\n </MenuGroupContext>\n )\n },\n \"group\",\n)()\n\nexport interface MenuOptionGroupProps<\n Y extends MenuOptionGroupType = \"checkbox\",\n M extends MenuOptionGroupValue<Y> = MenuOptionGroupValue<Y>,\n>\n extends\n UseMenuOptionGroupProps<Y, M>,\n Omit<MenuGroupProps, \"defaultValue\" | \"onChange\"> {}\n\nexport const MenuOptionGroup = withContext<\"div\", MenuOptionGroupProps>(\n ({\n type: typeProp,\n defaultValue,\n value: valueProp,\n onChange: onChangeProp,\n ...rest\n }) => {\n const { type, value, onChange } = useMenuOptionGroup({\n type: typeProp,\n defaultValue,\n value: valueProp,\n onChange: onChangeProp,\n })\n const context = useMemo(\n () => ({ type, value, onChange }),\n [type, value, onChange],\n )\n\n return (\n <MenuOptionGroupContext value={context}>\n <MenuGroup {...rest} />\n </MenuOptionGroupContext>\n )\n },\n { name: \"OptionGroup\", slot: [\"group\", \"option\"] },\n)() as GenericsComponent<{\n <\n Y extends MenuOptionGroupType = \"checkbox\",\n M extends MenuOptionGroupValue<Y> = MenuOptionGroupValue<Y>,\n >(\n props: MenuOptionGroupProps<Y, M>,\n ): ReactElement\n}>\n\nexport interface MenuItemProps extends HTMLStyledProps, UseMenuItemProps {}\n\nexport const MenuItem = withContext<\"div\", MenuItemProps>(\n ({ children, ...rest }) => {\n const { subMenuTrigger, getItemProps } = useMenuItem(rest)\n\n return (\n <styled.div {...getItemProps()}>\n {children}\n\n {subMenuTrigger ? (\n <MenuIndicator as={ChevronRightIcon} ms=\"auto\" />\n ) : null}\n </styled.div>\n )\n },\n \"item\",\n)()\n\nexport interface MenuOptionItemProps\n extends HTMLStyledProps, UseMenuOptionItemProps {\n /**\n * The icon to be used in the menu option item.\n */\n icon?: ReactNode\n}\n\nexport const MenuOptionItem = withContext<\"div\", MenuOptionItemProps>(\n ({ children, icon, ...rest }) => {\n const { type, getIndicatorProps, getOptionItemProps } =\n useMenuOptionItem(rest)\n\n return (\n <styled.div {...getOptionItemProps()}>\n <MenuIndicator {...getIndicatorProps()}>\n {icon ||\n (type === \"radio\" ? (\n <CircleSmallIcon fill=\"currentColor\" />\n ) : (\n <CheckIcon />\n ))}\n </MenuIndicator>\n {children}\n </styled.div>\n )\n },\n { name: \"OptionItem\", slot: [\"item\", \"option\"] },\n)()\n\nexport interface MenuIndicatorProps extends HTMLStyledProps {}\n\nexport const MenuIndicator = withContext<\"div\", MenuIndicatorProps>(\n \"div\",\n \"indicator\",\n)()\n\nexport interface MenuCommandProps extends HTMLStyledProps<\"kbd\"> {}\n\nexport const MenuCommand = withContext<\"kbd\", MenuCommandProps>(\n \"kbd\",\n \"command\",\n)()\n\nexport interface MenuSeparatorProps extends HTMLStyledProps<\"hr\"> {}\n\nexport const MenuSeparator = withContext<\"hr\", MenuSeparatorProps>(\n \"hr\",\n \"separator\",\n)(undefined, (props) => {\n const { getSeparatorProps } = useComponentContext()\n\n return getSeparatorProps(props)\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA8GA,MAAM,EACJ,kBACA,cAAc,kBACd,cACA,qBACA,iBAAiB,qBACjB,aACA,0BACEA,6CACF,QACAC,6BACD;;;;;;AASD,MAAaC,YAA+B,UAAU;CACpD,MAAM,CAAC,cAAc,eAAe,sBAAsB,MAAM;CAChE,MAAM,CACJ,EAAE,iBAAiB,iBAAiB,QAAQ,WAAW,GAAG,gBAC1D,EAAE,UAAU,UAAU,GAAG,UACvBC,oCAAgB,aAAa;EAC/B;EACA;EACA;EACA;EACA;EACD,CAAC;CACF,MAAM,EACJ,eACA,aACA,MACA,SACA,kBACA,WACA,iBACA,wBACA,mBACA,iBACA,oBACA,SACA,YACA,gBACA,QACA,aACEC,yBAAQ;EAAE;EAAU,GAAG;EAAM,CAAC;CAClC,MAAM,+CACG;EACL,GAAG;EACH,iBACE,oBAAoB,UAAU,iBAAiB;EACjD,WAAW,CAAC,CAAC;EACb;EACA;EACA,QAAQ,WAAW,UAAU,CAAC,GAAG,EAAE,GAAG;EACtC;EACA,WACE,cAAc,UAAU,UAAU,qBAAqB;EACzD;EACA;EACA;EACD,GACD;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CACF;AA8CD,QACE,2CAAC;EAAa,OAAO;YACnB,2CAACC;GAAuB,OAAO;aAC7B,2CAACC;IAAY,iCA/CV;KACL;KACA;KACA;KACA;KACA;KACA;KACA;KACD,GACD;KACE;KACA;KACA;KACA;KACA;KACA;KACA;KACD,CACF;cA8BO,2CAACC;KAAgB,iCA5BhB;MACL;MACA;MACA;MACA;MACA;MACD,GACD;MAAC;MAAe;MAAa;MAAoB;MAAY;MAAS,CACvE;eAqBS,2CAAC;MAAiB,iCAnBnB;OACL;OACA;OACA;OACA;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;GAGjB,OACD,EAAE;AAUH,MAAa,iBAAiB,aAC3B,EAAE,UAAU,MAAM,GAAG,WAAW;CAC/B,MAAM,EAAE,MAAM,mBAAmB,uBAC/BC,mCAAkB,KAAK;AAEzB,QACE,4CAACb,uBAAO;EAAI,GAAI,oBAAoB;aAClC,2CAAC;GAAc,GAAI,mBAAmB;aACnC,SACE,SAAS,UACR,2CAACc,6CAAgB,MAAK,iBAAiB,GAEvC,2CAACC,iCAAY;IAEH,EACf;GACU;GAGjB;CAAE,MAAM;CAAc,MAAM,CAAC,QAAQ,SAAS;CAAE,CACjD,EAAE;AAIH,MAAa,gBAAgB,YAC3B,OACA,YACD,EAAE;AAIH,MAAa,cAAc,YACzB,OACA,UACD,EAAE;AAIH,MAAa,gBAAgB,YAC3B,MACA,YACD,CAAC,SAAY,UAAU;CACtB,MAAM,EAAE,sBAAsB,qBAAqB;AAEnD,QAAO,kBAAkB,MAAM;EAC/B"}
@@ -32,7 +32,7 @@ const { ComponentContext, PropsContext: ModalPropsContext, useComponentContext,
32
32
  /**
33
33
  * `Modal` is a component that is displayed over the main content to focus the user's attention solely on the information.
34
34
  *
35
- * @see https://yamada-ui.com/docs/components/overlay/modal
35
+ * @see https://yamada-ui.com/docs/components/modal
36
36
  */
37
37
  const ModalRoot = withProvider(({ allowPinchZoom = false, animationScheme = "scale", autoFocus, blockScrollOnMount = true, body, cancel, children, duration, finalFocusRef, footer, header, initialFocusRef, lockFocusAcrossFrames = true, middle, restoreFocus, success, title, trigger, withCloseButton = true, withOverlay = true, portalProps, onCancel, onCloseComplete, onMiddle, onSuccess, ...props }) => {
38
38
  const [omittedChildren, openTrigger, customOverlay] = require_children.useSplitChildren(children, ModalOpenTrigger, ModalOverlay);
@@ -1 +1 @@
1
- {"version":3,"file":"modal.cjs","names":["createSlotComponent","modalStyle","useSplitChildren","useModal","AnimatePresence","Portal","FocusLock","RemoveScroll","styled","CloseButton","motion","fadeVariants","getPopupAnimationProps","ShorthandModalContent: FC<ShorthandModalContentProps>","wrapOrPassProps","Button"],"sources":["../../../../src/components/modal/modal.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, PropsWithChildren, ReactNode } from \"react\"\nimport type { HTMLProps, HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { ButtonProps } from \"../button\"\nimport type { CloseButtonProps } from \"../close-button\"\nimport type { FocusLockProps } from \"../focus-lock\"\nimport type { HTMLMotionProps, HTMLMotionPropsWithoutAs } from \"../motion\"\nimport type { PopupAnimationProps } from \"../popover\"\nimport type { PortalProps } from \"../portal\"\nimport type { ModalStyle } from \"./modal.style\"\nimport type { UseModalProps, UseModalReturn } from \"./use-modal\"\nimport { AnimatePresence } from \"motion/react\"\nimport { useMemo } from \"react\"\nimport { RemoveScroll } from \"react-remove-scroll\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { cast, isArray, useSplitChildren, wrapOrPassProps } from \"../../utils\"\nimport { Button } from \"../button\"\nimport { CloseButton } from \"../close-button\"\nimport { fadeVariants } from \"../fade\"\nimport { FocusLock } from \"../focus-lock\"\nimport { motion } from \"../motion\"\nimport { getPopupAnimationProps } from \"../popover\"\nimport { Portal } from \"../portal\"\nimport { modalStyle } from \"./modal.style\"\nimport { useModal } from \"./use-modal\"\n\ninterface ComponentContext\n extends\n Omit<UseModalReturn, \"getRootProps\">,\n PopupAnimationProps,\n Pick<ModalRootProps, \"withCloseButton\"> {}\n\nexport interface ModalRootProps\n extends\n ThemeProps<ModalStyle>,\n Omit<UseModalProps, \"title\">,\n Pick<\n FocusLockProps,\n | \"autoFocus\"\n | \"finalFocusRef\"\n | \"initialFocusRef\"\n | \"lockFocusAcrossFrames\"\n | \"restoreFocus\"\n >,\n PopupAnimationProps,\n ShorthandModalContentProps {\n /**\n * Handle zoom or pinch gestures on iOS devices when scroll locking is enabled.\n *\n * @default false.\n */\n allowPinchZoom?: boolean\n /**\n * If `true`, scrolling will be disabled on the `body` when the modal opens.\n *\n * @default true\n */\n blockScrollOnMount?: boolean\n /**\n * The modal trigger to use.\n */\n trigger?: ReactNode\n /**\n * If `true`, display the modal close button.\n *\n * @default true\n */\n withCloseButton?: boolean\n /**\n * If `true`, display the modal overlay.\n *\n * @default true\n */\n withOverlay?: boolean\n /**\n * Props to be forwarded to the portal component.\n */\n portalProps?: Omit<PortalProps, \"children\">\n /**\n * Callback function to run side effects after the modal has closed.\n */\n onCloseComplete?: () => void\n}\n\nconst {\n ComponentContext,\n PropsContext: ModalPropsContext,\n useComponentContext,\n usePropsContext: useModalPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<ModalRootProps, ModalStyle, ComponentContext>(\n \"modal\",\n modalStyle,\n)\n\nexport { ModalPropsContext, useModalPropsContext }\n\n/**\n * `Modal` is a component that is displayed over the main content to focus the user's attention solely on the information.\n *\n * @see https://yamada-ui.com/docs/components/overlay/modal\n */\nexport const ModalRoot = withProvider<\"div\", ModalRootProps>(\n ({\n allowPinchZoom = false,\n animationScheme = \"scale\",\n autoFocus,\n blockScrollOnMount = true,\n body,\n cancel,\n children,\n duration,\n finalFocusRef,\n footer,\n header,\n initialFocusRef,\n lockFocusAcrossFrames = true,\n middle,\n restoreFocus,\n success,\n title,\n trigger,\n withCloseButton = true,\n withOverlay = true,\n portalProps,\n onCancel,\n onCloseComplete,\n onMiddle,\n onSuccess,\n ...props\n }) => {\n const [omittedChildren, openTrigger, customOverlay] = useSplitChildren(\n children,\n ModalOpenTrigger,\n ModalOverlay,\n )\n const hasChildren = isArray(omittedChildren) && !!omittedChildren.length\n const { open, getRootProps, ...rest } = useModal(props)\n const customOpenTrigger = trigger ? (\n <ModalOpenTrigger>{trigger}</ModalOpenTrigger>\n ) : null\n\n const context = useMemo(\n () => ({\n animationScheme,\n duration,\n open,\n withCloseButton,\n ...rest,\n }),\n [animationScheme, duration, open, withCloseButton, rest],\n )\n\n return (\n <ComponentContext value={context}>\n {openTrigger ?? customOpenTrigger}\n\n <AnimatePresence onExitComplete={onCloseComplete}>\n {open ? (\n <Portal {...portalProps}>\n <FocusLock\n autoFocus={autoFocus}\n finalFocusRef={finalFocusRef}\n initialFocusRef={initialFocusRef}\n lockFocusAcrossFrames={lockFocusAcrossFrames}\n restoreFocus={restoreFocus}\n >\n <RemoveScroll\n allowPinchZoom={allowPinchZoom}\n enabled={blockScrollOnMount}\n forwardProps\n >\n <styled.div {...getRootProps()}>\n {customOverlay ?? (withOverlay ? <ModalOverlay /> : null)}\n\n {hasChildren ? (\n omittedChildren\n ) : (\n <ShorthandModalContent\n body={body}\n cancel={cancel}\n footer={footer}\n header={header}\n middle={middle}\n success={success}\n title={title}\n onCancel={onCancel}\n onMiddle={onMiddle}\n onSuccess={onSuccess}\n />\n )}\n </styled.div>\n </RemoveScroll>\n </FocusLock>\n </Portal>\n ) : null}\n </AnimatePresence>\n </ComponentContext>\n )\n },\n \"root\",\n)()\n\nexport interface ModalOpenTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const ModalOpenTrigger = withContext<\"button\", ModalOpenTriggerProps>(\n \"button\",\n { name: \"OpenTrigger\", slot: [\"trigger\", \"open\"] },\n)(undefined, (props) => {\n const { getOpenTriggerProps } = useComponentContext()\n\n return { asChild: true, ...getOpenTriggerProps(props) }\n})\n\nexport interface ModalCloseTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const ModalCloseTrigger = withContext<\"button\", ModalCloseTriggerProps>(\n \"button\",\n { name: \"CloseTrigger\", slot: [\"trigger\", \"close\"] },\n)(undefined, (props) => {\n const { getCloseTriggerProps } = useComponentContext()\n\n return { asChild: true, ...getCloseTriggerProps(props) }\n})\n\nexport interface ModalCloseButtonProps extends CloseButtonProps {}\n\nexport const ModalCloseButton = withContext<\"button\", ModalCloseButtonProps>(\n CloseButton,\n \"closeButton\",\n)(undefined, (props) => {\n const { getCloseButtonProps } = useComponentContext()\n\n return { ...getCloseButtonProps(props) }\n})\n\nexport interface ModalOverlayProps extends HTMLMotionProps {}\n\nexport const ModalOverlay = withContext<\"div\", ModalOverlayProps>((props) => {\n const { animationScheme, duration, getOverlayProps } = useComponentContext()\n\n return (\n <motion.div\n custom={{ duration }}\n {...(animationScheme !== \"none\"\n ? {\n animate: \"enter\",\n exit: \"exit\",\n initial: \"exit\",\n variants: fadeVariants,\n }\n : {})}\n {...cast<HTMLMotionProps>(getOverlayProps(cast<HTMLProps>(props)))}\n />\n )\n}, \"overlay\")()\n\nexport interface ModalContentProps\n extends Omit<HTMLMotionProps<\"section\">, \"children\">, PropsWithChildren {}\n\nexport const ModalContent = withContext<\"section\", ModalContentProps>(\n ({ children, ...rest }) => {\n const { animationScheme, duration, withCloseButton, getContentProps } =\n useComponentContext()\n const [omittedChildren, customCloseButton] = useSplitChildren(\n children,\n ModalCloseButton,\n )\n\n return (\n <motion.section\n {...getPopupAnimationProps(animationScheme, duration)}\n {...cast<HTMLMotionPropsWithoutAs<\"section\">>(\n getContentProps(cast<HTMLProps<\"section\">>(rest)),\n )}\n >\n {customCloseButton ?? (withCloseButton ? <ModalCloseButton /> : null)}\n\n {omittedChildren}\n </motion.section>\n )\n },\n \"content\",\n)()\n\ninterface ShorthandModalContentProps {\n /**\n * The modal body to use.\n */\n body?: ModalBodyProps | ReactNode\n /**\n * The modal cancel button to use.\n */\n cancel?: ButtonProps | ReactNode\n /**\n * The modal footer to use.\n */\n footer?: ModalFooterProps | ReactNode\n /**\n * The modal header to use.\n */\n header?: ModalHeaderProps | ReactNode\n /**\n * The modal middle button to use.\n */\n middle?: ButtonProps | ReactNode\n /**\n * The modal success button to use.\n */\n success?: ButtonProps | ReactNode\n /**\n * The modal title to use.\n */\n title?: ModalTitleProps | ReactNode\n /**\n * The callback invoked when cancel button clicked.\n */\n onCancel?: (onClose: () => void) => void\n /**\n * The callback invoked when middle button clicked.\n */\n onMiddle?: (onClose: () => void) => void\n /**\n * The callback invoked when success button clicked.\n */\n onSuccess?: (onClose: () => void) => void\n}\n\nexport const ShorthandModalContent: FC<ShorthandModalContentProps> = ({\n body,\n cancel,\n footer,\n header,\n middle,\n success,\n title,\n onCancel,\n onMiddle,\n onSuccess,\n}) => {\n const { onClose } = useComponentContext()\n const customHeader = wrapOrPassProps(ModalHeader, header)\n const customTitle = wrapOrPassProps(ModalTitle, title)\n const customBody = wrapOrPassProps(ModalBody, body)\n const customFooter = wrapOrPassProps(ModalFooter, footer)\n const customCancel = wrapOrPassProps(Button, cancel, {\n colorScheme: \"mono\",\n variant: \"ghost\",\n onClick: () => (onCancel ? onCancel(onClose) : onClose()),\n })\n const customMiddle = wrapOrPassProps(Button, middle, {\n colorScheme: \"secondary\",\n onClick: () => (onMiddle ? onMiddle(onClose) : onClose()),\n })\n const customSuccess = wrapOrPassProps(Button, success, {\n colorScheme: \"primary\",\n onClick: () => (onSuccess ? onSuccess(onClose) : onClose()),\n })\n\n return (\n <ModalContent>\n {customHeader ??\n (customTitle ? <ModalHeader>{customTitle}</ModalHeader> : null)}\n {customBody}\n {customFooter ??\n (customCancel || customMiddle || customSuccess ? (\n <ModalFooter>\n {customCancel}\n {customMiddle}\n {customSuccess}\n </ModalFooter>\n ) : null)}\n </ModalContent>\n )\n}\n\nexport interface ModalHeaderProps extends HTMLStyledProps<\"header\"> {}\n\nexport const ModalHeader = withContext<\"header\", ModalHeaderProps>(\n \"header\",\n \"header\",\n)(undefined, (props) => {\n const { getHeaderProps } = useComponentContext()\n\n return { ...getHeaderProps(props) }\n})\n\nexport interface ModalTitleProps extends HTMLStyledProps<\"h2\"> {}\n\nexport const ModalTitle = withContext<\"h2\", ModalTitleProps>(\"h2\", \"title\")(\n undefined,\n (props) => {\n const { getTitleProps } = useComponentContext()\n\n return { ...getTitleProps(props) }\n },\n)\n\nexport interface ModalBodyProps extends HTMLStyledProps {}\n\nexport const ModalBody = withContext<\"div\", ModalBodyProps>(\"div\", \"body\")(\n undefined,\n (props) => {\n const { getBodyProps } = useComponentContext()\n\n return { ...getBodyProps(props) }\n },\n)\n\nexport interface ModalFooterProps extends HTMLStyledProps<\"footer\"> {}\n\nexport const ModalFooter = withContext<\"footer\", ModalFooterProps>(\n \"footer\",\n \"footer\",\n)(undefined, (props) => {\n const { getFooterProps } = useComponentContext()\n\n return { ...getFooterProps(props) }\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqFA,MAAM,EACJ,kBACA,cAAc,mBACd,qBACA,iBAAiB,sBACjB,aACA,iBACEA,6CACF,SACAC,+BACD;;;;;;AASD,MAAa,YAAY,cACtB,EACC,iBAAiB,OACjB,kBAAkB,SAClB,WACA,qBAAqB,MACrB,MACA,QACA,UACA,UACA,eACA,QACA,QACA,iBACA,wBAAwB,MACxB,QACA,cACA,SACA,OACA,SACA,kBAAkB,MAClB,cAAc,MACd,aACA,UACA,iBACA,UACA,WACA,GAAG,YACC;CACJ,MAAM,CAAC,iBAAiB,aAAa,iBAAiBC,kCACpD,UACA,kBACA,aACD;CACD,MAAM,6DAAsB,gBAAgB,IAAI,CAAC,CAAC,gBAAgB;CAClE,MAAM,EAAE,MAAM,cAAc,GAAG,SAASC,2BAAS,MAAM;CACvD,MAAM,oBAAoB,UACxB,2CAAC,8BAAkB,UAA2B,GAC5C;AAaJ,QACE,4CAAC;EAAiB,iCAXX;GACL;GACA;GACA;GACA;GACA,GAAG;GACJ,GACD;GAAC;GAAiB;GAAU;GAAM;GAAiB;GAAK,CACzD;aAII,eAAe,mBAEhB,2CAACC;GAAgB,gBAAgB;aAC9B,OACC,2CAACC;IAAO,GAAI;cACV,2CAACC;KACY;KACI;KACE;KACM;KACT;eAEd,2CAACC;MACiB;MAChB,SAAS;MACT;gBAEA,4CAACC,uBAAO;OAAI,GAAI,cAAc;kBAC3B,kBAAkB,cAAc,2CAAC,iBAAe,GAAG,OAEnD,cACC,kBAEA,2CAAC;QACO;QACE;QACA;QACA;QACA;QACC;QACF;QACG;QACA;QACC;SACX;QAEO;OACA;MACL;KACL,GACP;IACY;GACD;GAGvB,OACD,EAAE;AAIH,MAAa,mBAAmB,YAC9B,UACA;CAAE,MAAM;CAAe,MAAM,CAAC,WAAW,OAAO;CAA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ePresence","Portal","FocusLock","RemoveScroll","styled","CloseButton","motion","fadeVariants","getPopupAnimationProps","ShorthandModalContent: FC<ShorthandModalContentProps>","wrapOrPassProps","Button"],"sources":["../../../../src/components/modal/modal.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, PropsWithChildren, ReactNode } from \"react\"\nimport type { HTMLProps, HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { ButtonProps } from \"../button\"\nimport type { CloseButtonProps } from \"../close-button\"\nimport type { FocusLockProps } from \"../focus-lock\"\nimport type { HTMLMotionProps, HTMLMotionPropsWithoutAs } from \"../motion\"\nimport type { PopupAnimationProps } from \"../popover\"\nimport type { PortalProps } from \"../portal\"\nimport type { ModalStyle } from \"./modal.style\"\nimport type { UseModalProps, UseModalReturn } from \"./use-modal\"\nimport { AnimatePresence } from \"motion/react\"\nimport { useMemo } from \"react\"\nimport { RemoveScroll } from \"react-remove-scroll\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { cast, isArray, useSplitChildren, wrapOrPassProps } from \"../../utils\"\nimport { Button } from \"../button\"\nimport { CloseButton } from \"../close-button\"\nimport { fadeVariants } from \"../fade\"\nimport { FocusLock } from \"../focus-lock\"\nimport { motion } from \"../motion\"\nimport { getPopupAnimationProps } from \"../popover\"\nimport { Portal } from \"../portal\"\nimport { modalStyle } from \"./modal.style\"\nimport { useModal } from \"./use-modal\"\n\ninterface ComponentContext\n extends\n Omit<UseModalReturn, \"getRootProps\">,\n PopupAnimationProps,\n Pick<ModalRootProps, \"withCloseButton\"> {}\n\nexport interface ModalRootProps\n extends\n ThemeProps<ModalStyle>,\n Omit<UseModalProps, \"title\">,\n Pick<\n FocusLockProps,\n | \"autoFocus\"\n | \"finalFocusRef\"\n | \"initialFocusRef\"\n | \"lockFocusAcrossFrames\"\n | \"restoreFocus\"\n >,\n PopupAnimationProps,\n ShorthandModalContentProps {\n /**\n * Handle zoom or pinch gestures on iOS devices when scroll locking is enabled.\n *\n * @default false.\n */\n allowPinchZoom?: boolean\n /**\n * If `true`, scrolling will be disabled on the `body` when the modal opens.\n *\n * @default true\n */\n blockScrollOnMount?: boolean\n /**\n * The modal trigger to use.\n */\n trigger?: ReactNode\n /**\n * If `true`, display the modal close button.\n *\n * @default true\n */\n withCloseButton?: boolean\n /**\n * If `true`, display the modal overlay.\n *\n * @default true\n */\n withOverlay?: boolean\n /**\n * Props to be forwarded to the portal component.\n */\n portalProps?: Omit<PortalProps, \"children\">\n /**\n * Callback function to run side effects after the modal has closed.\n */\n onCloseComplete?: () => void\n}\n\nconst {\n ComponentContext,\n PropsContext: ModalPropsContext,\n useComponentContext,\n usePropsContext: useModalPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<ModalRootProps, ModalStyle, ComponentContext>(\n \"modal\",\n modalStyle,\n)\n\nexport { ModalPropsContext, useModalPropsContext }\n\n/**\n * `Modal` is a component that is displayed over the main content to focus the user's attention solely on the information.\n *\n * @see https://yamada-ui.com/docs/components/modal\n */\nexport const ModalRoot = withProvider<\"div\", ModalRootProps>(\n ({\n allowPinchZoom = false,\n animationScheme = \"scale\",\n autoFocus,\n blockScrollOnMount = true,\n body,\n cancel,\n children,\n duration,\n finalFocusRef,\n footer,\n header,\n initialFocusRef,\n lockFocusAcrossFrames = true,\n middle,\n restoreFocus,\n success,\n title,\n trigger,\n withCloseButton = true,\n withOverlay = true,\n portalProps,\n onCancel,\n onCloseComplete,\n onMiddle,\n onSuccess,\n ...props\n }) => {\n const [omittedChildren, openTrigger, customOverlay] = useSplitChildren(\n children,\n ModalOpenTrigger,\n ModalOverlay,\n )\n const hasChildren = isArray(omittedChildren) && !!omittedChildren.length\n const { open, getRootProps, ...rest } = useModal(props)\n const customOpenTrigger = trigger ? (\n <ModalOpenTrigger>{trigger}</ModalOpenTrigger>\n ) : null\n const context = useMemo(\n () => ({\n animationScheme,\n duration,\n open,\n withCloseButton,\n ...rest,\n }),\n [animationScheme, duration, open, withCloseButton, rest],\n )\n\n return (\n <ComponentContext value={context}>\n {openTrigger ?? customOpenTrigger}\n\n <AnimatePresence onExitComplete={onCloseComplete}>\n {open ? (\n <Portal {...portalProps}>\n <FocusLock\n autoFocus={autoFocus}\n finalFocusRef={finalFocusRef}\n initialFocusRef={initialFocusRef}\n lockFocusAcrossFrames={lockFocusAcrossFrames}\n restoreFocus={restoreFocus}\n >\n <RemoveScroll\n allowPinchZoom={allowPinchZoom}\n enabled={blockScrollOnMount}\n forwardProps\n >\n <styled.div {...getRootProps()}>\n {customOverlay ?? (withOverlay ? <ModalOverlay /> : null)}\n\n {hasChildren ? (\n omittedChildren\n ) : (\n <ShorthandModalContent\n body={body}\n cancel={cancel}\n footer={footer}\n header={header}\n middle={middle}\n success={success}\n title={title}\n onCancel={onCancel}\n onMiddle={onMiddle}\n onSuccess={onSuccess}\n />\n )}\n </styled.div>\n </RemoveScroll>\n </FocusLock>\n </Portal>\n ) : null}\n </AnimatePresence>\n </ComponentContext>\n )\n },\n \"root\",\n)()\n\nexport interface ModalOpenTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const ModalOpenTrigger = withContext<\"button\", ModalOpenTriggerProps>(\n \"button\",\n { name: \"OpenTrigger\", slot: [\"trigger\", \"open\"] },\n)(undefined, (props) => {\n const { getOpenTriggerProps } = useComponentContext()\n\n return { asChild: true, ...getOpenTriggerProps(props) }\n})\n\nexport interface ModalCloseTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const ModalCloseTrigger = withContext<\"button\", ModalCloseTriggerProps>(\n \"button\",\n { name: \"CloseTrigger\", slot: [\"trigger\", \"close\"] },\n)(undefined, (props) => {\n const { getCloseTriggerProps } = useComponentContext()\n\n return { asChild: true, ...getCloseTriggerProps(props) }\n})\n\nexport interface ModalCloseButtonProps extends CloseButtonProps {}\n\nexport const ModalCloseButton = withContext<\"button\", ModalCloseButtonProps>(\n CloseButton,\n \"closeButton\",\n)(undefined, (props) => {\n const { getCloseButtonProps } = useComponentContext()\n\n return { ...getCloseButtonProps(props) }\n})\n\nexport interface ModalOverlayProps extends HTMLMotionProps {}\n\nexport const ModalOverlay = withContext<\"div\", ModalOverlayProps>((props) => {\n const { animationScheme, duration, getOverlayProps } = useComponentContext()\n\n return (\n <motion.div\n custom={{ duration }}\n {...(animationScheme !== \"none\"\n ? {\n animate: \"enter\",\n exit: \"exit\",\n initial: \"exit\",\n variants: fadeVariants,\n }\n : {})}\n {...cast<HTMLMotionProps>(getOverlayProps(cast<HTMLProps>(props)))}\n />\n )\n}, \"overlay\")()\n\nexport interface ModalContentProps\n extends Omit<HTMLMotionProps<\"section\">, \"children\">, PropsWithChildren {}\n\nexport const ModalContent = withContext<\"section\", ModalContentProps>(\n ({ children, ...rest }) => {\n const { animationScheme, duration, withCloseButton, getContentProps } =\n useComponentContext()\n const [omittedChildren, customCloseButton] = useSplitChildren(\n children,\n ModalCloseButton,\n )\n\n return (\n <motion.section\n {...getPopupAnimationProps(animationScheme, duration)}\n {...cast<HTMLMotionPropsWithoutAs<\"section\">>(\n getContentProps(cast<HTMLProps<\"section\">>(rest)),\n )}\n >\n {customCloseButton ?? (withCloseButton ? <ModalCloseButton /> : null)}\n\n {omittedChildren}\n </motion.section>\n )\n },\n \"content\",\n)()\n\ninterface ShorthandModalContentProps {\n /**\n * The modal body to use.\n */\n body?: ModalBodyProps | ReactNode\n /**\n * The modal cancel button to use.\n */\n cancel?: ButtonProps | ReactNode\n /**\n * The modal footer to use.\n */\n footer?: ModalFooterProps | ReactNode\n /**\n * The modal header to use.\n */\n header?: ModalHeaderProps | ReactNode\n /**\n * The modal middle button to use.\n */\n middle?: ButtonProps | ReactNode\n /**\n * The modal success button to use.\n */\n success?: ButtonProps | ReactNode\n /**\n * The modal title to use.\n */\n title?: ModalTitleProps | ReactNode\n /**\n * The callback invoked when cancel button clicked.\n */\n onCancel?: (onClose: () => void) => void\n /**\n * The callback invoked when middle button clicked.\n */\n onMiddle?: (onClose: () => void) => void\n /**\n * The callback invoked when success button clicked.\n */\n onSuccess?: (onClose: () => void) => void\n}\n\nexport const ShorthandModalContent: FC<ShorthandModalContentProps> = ({\n body,\n cancel,\n footer,\n header,\n middle,\n success,\n title,\n onCancel,\n onMiddle,\n onSuccess,\n}) => {\n const { onClose } = useComponentContext()\n const customHeader = wrapOrPassProps(ModalHeader, header)\n const customTitle = wrapOrPassProps(ModalTitle, title)\n const customBody = wrapOrPassProps(ModalBody, body)\n const customFooter = wrapOrPassProps(ModalFooter, footer)\n const customCancel = wrapOrPassProps(Button, cancel, {\n colorScheme: \"mono\",\n variant: \"ghost\",\n onClick: () => (onCancel ? onCancel(onClose) : onClose()),\n })\n const customMiddle = wrapOrPassProps(Button, middle, {\n colorScheme: \"secondary\",\n onClick: () => (onMiddle ? onMiddle(onClose) : onClose()),\n })\n const customSuccess = wrapOrPassProps(Button, success, {\n colorScheme: \"primary\",\n onClick: () => (onSuccess ? onSuccess(onClose) : onClose()),\n })\n\n return (\n <ModalContent>\n {customHeader ??\n (customTitle ? <ModalHeader>{customTitle}</ModalHeader> : null)}\n {customBody}\n {customFooter ??\n (customCancel || customMiddle || customSuccess ? (\n <ModalFooter>\n {customCancel}\n {customMiddle}\n {customSuccess}\n </ModalFooter>\n ) : null)}\n </ModalContent>\n )\n}\n\nexport interface ModalHeaderProps extends HTMLStyledProps<\"header\"> {}\n\nexport const ModalHeader = withContext<\"header\", ModalHeaderProps>(\n \"header\",\n \"header\",\n)(undefined, (props) => {\n const { getHeaderProps } = useComponentContext()\n\n return { ...getHeaderProps(props) }\n})\n\nexport interface ModalTitleProps extends HTMLStyledProps<\"h2\"> {}\n\nexport const ModalTitle = withContext<\"h2\", ModalTitleProps>(\"h2\", \"title\")(\n undefined,\n (props) => {\n const { getTitleProps } = useComponentContext()\n\n return { ...getTitleProps(props) }\n },\n)\n\nexport interface ModalBodyProps extends HTMLStyledProps {}\n\nexport const ModalBody = withContext<\"div\", ModalBodyProps>(\"div\", \"body\")(\n undefined,\n (props) => {\n const { getBodyProps } = useComponentContext()\n\n return { ...getBodyProps(props) }\n },\n)\n\nexport interface ModalFooterProps extends HTMLStyledProps<\"footer\"> {}\n\nexport const ModalFooter = withContext<\"footer\", ModalFooterProps>(\n \"footer\",\n \"footer\",\n)(undefined, (props) => {\n const { getFooterProps } = useComponentContext()\n\n return { ...getFooterProps(props) }\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqFA,MAAM,EACJ,kBACA,cAAc,mBACd,qBACA,iBAAiB,sBACjB,aACA,iBACEA,6CACF,SACAC,+BACD;;;;;;AASD,MAAa,YAAY,cACtB,EACC,iBAAiB,OACjB,kBAAkB,SAClB,WACA,qBAAqB,MACrB,MACA,QACA,UACA,UACA,eACA,QACA,QACA,iBACA,wBAAwB,MACxB,QACA,cACA,SACA,OACA,SACA,kBAAkB,MAClB,cAAc,MACd,aACA,UACA,iBACA,UACA,WACA,GAAG,YACC;CACJ,MAAM,CAAC,iBAAiB,aAAa,iBAAiBC,kCACpD,UACA,kBACA,aACD;CACD,MAAM,6DAAsB,gBAAgB,IAAI,CAAC,CAAC,gBAAgB;CAClE,MAAM,EAAE,MAAM,cAAc,GAAG,SAASC,2BAAS,MAAM;CACvD,MAAM,oBAAoB,UACxB,2CAAC,8BAAkB,UAA2B,GAC5C;AAYJ,QACE,4CAAC;EAAiB,iCAXX;GACL;GACA;GACA;GACA;GACA,GAAG;GACJ,GACD;GAAC;GAAiB;GAAU;GAAM;GAAiB;GAAK,CACzD;aAII,eAAe,mBAEhB,2CAACC;GAAgB,gBAAgB;aAC9B,OACC,2CAACC;IAAO,GAAI;cACV,2CAACC;KACY;KACI;KACE;KACM;KACT;eAEd,2CAACC;MACiB;MAChB,SAAS;MACT;gBAEA,4CAACC,uBAAO;OAAI,GAAI,cAAc;kBAC3B,kBAAkB,cAAc,2CAAC,iBAAe,GAAG,OAEnD,cACC,kBAEA,2CAAC;QACO;QACE;QACA;QACA;QACA;QACC;QACF;QACG;QACA;QACC;SACX;QAEO;OACA;MACL;KACL,GACP;IACY;GACD;GAGvB,OACD,EAAE;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AAE;EACnC"}
@@ -1,4 +1,5 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ const require_dom = require('../../utils/dom.cjs');
2
3
  const require_utils_index = require('../../utils/index.cjs');
3
4
  const require_use_disclosure = require('../../hooks/use-disclosure/use-disclosure.cjs');
4
5
  require('../../hooks/use-disclosure/index.cjs');
@@ -12,12 +13,9 @@ const useModal = ({ closeOnEsc = true, closeOnOverlay = true, defaultOpen, open:
12
13
  defaultOpen,
13
14
  open: openProp,
14
15
  onClose: onCloseProp,
15
- onOpen: onOpenProp,
16
- ...rest
16
+ onOpen: onOpenProp
17
17
  });
18
- const contentId = (0, react.useId)();
19
- const titleId = (0, react.useId)();
20
- const bodyId = (0, react.useId)();
18
+ const [contentId, titleId, bodyId] = require_dom.useIds();
21
19
  const { t } = require_i18n_provider.useI18n("modal");
22
20
  const onKeyDown = (0, react.useCallback)((ev) => {
23
21
  if (ev.key !== "Escape") return;
@@ -1 +1 @@
1
- {"version":3,"file":"use-modal.cjs","names":["useDisclosure","useI18n","getRootProps: PropGetter","getOverlayProps: PropGetter","getOpenTriggerProps: PropGetter<\"button\">","getCloseTriggerProps: PropGetter<\"button\">","getCloseButtonProps: PropGetter<\"button\">","getContentProps: PropGetter<\"section\">","getHeaderProps: PropGetter<\"header\">","getTitleProps: PropGetter<\"h2\">"],"sources":["../../../../src/components/modal/use-modal.ts"],"sourcesContent":["import type { KeyboardEvent } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { UseDisclosureProps } from \"../../hooks/use-disclosure\"\nimport { useCallback, useId } from \"react\"\nimport { useDisclosure } from \"../../hooks/use-disclosure\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport { cx, handlerAll } from \"../../utils\"\n\nexport interface UseModalProps\n extends HTMLProps, Omit<UseDisclosureProps, \"timing\"> {\n /**\n * If `true`, the modal will close when the `Esc` key is pressed.\n *\n * @default true\n */\n closeOnEsc?: boolean\n /**\n * If `true`, the modal will close when the overlay is clicked.\n *\n * @default true\n */\n closeOnOverlay?: boolean\n /**\n * Callback invoked when the escape key is pressed and focus is within modal.\n */\n onEsc?: () => void\n}\n\nexport const useModal = ({\n closeOnEsc = true,\n closeOnOverlay = true,\n defaultOpen,\n open: openProp,\n onClose: onCloseProp,\n onEsc,\n onOpen: onOpenProp,\n ...rest\n}: UseModalProps = {}) => {\n const { open, onClose, onOpen } = useDisclosure({\n defaultOpen,\n open: openProp,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n ...rest,\n })\n const contentId = useId()\n const titleId = useId()\n const bodyId = useId()\n const { t } = useI18n(\"modal\")\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent) => {\n if (ev.key !== \"Escape\") return\n\n ev.stopPropagation()\n\n if (closeOnEsc) onClose()\n\n onEsc?.()\n },\n [closeOnEsc, onClose, onEsc],\n )\n\n const getRootProps: PropGetter = useCallback(\n (props) => ({\n ...rest,\n ...props,\n }),\n [rest],\n )\n\n const getOverlayProps: PropGetter = useCallback(\n (props = {}) => ({\n \"aria-hidden\": \"true\",\n ...props,\n onClick: handlerAll(props.onClick, (ev) => {\n ev.stopPropagation()\n\n if (closeOnOverlay) onClose()\n }),\n }),\n [closeOnOverlay, onClose],\n )\n\n const getOpenTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n \"aria-controls\": open ? contentId : undefined,\n \"aria-expanded\": open,\n \"aria-haspopup\": \"dialog\",\n \"aria-label\": t(\"Open modal\"),\n ...props,\n onClick: handlerAll(props.onClick, onOpen),\n }),\n [contentId, onOpen, open, t],\n )\n\n const getCloseTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n \"aria-label\": t(\"Close modal\"),\n ...props,\n onClick: handlerAll(props.onClick, onClose),\n }),\n [onClose, t],\n )\n\n const getCloseButtonProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n \"aria-label\": t(\"Close modal\"),\n ...props,\n onClick: handlerAll(props.onClick, onClose),\n }),\n [onClose, t],\n )\n\n const getContentProps: PropGetter<\"section\"> = useCallback(\n ({\n \"aria-describedby\": ariaDescribedby,\n \"aria-labelledby\": ariaLabelledby,\n ...props\n } = {}) => ({\n id: contentId,\n \"aria-describedby\": cx(ariaDescribedby, bodyId),\n \"aria-labelledby\": cx(ariaLabelledby, titleId),\n \"aria-modal\": \"true\",\n role: \"dialog\",\n ...props,\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n }),\n [bodyId, contentId, onKeyDown, titleId],\n )\n\n const getHeaderProps: PropGetter<\"header\"> = useCallback(\n (props) => ({\n ...props,\n }),\n [],\n )\n\n const getTitleProps: PropGetter<\"h2\"> = useCallback(\n (props) => ({\n id: titleId,\n ...props,\n }),\n [titleId],\n )\n\n const getBodyProps: PropGetter = useCallback(\n (props) => ({\n id: bodyId,\n ...props,\n }),\n [bodyId],\n )\n\n const getFooterProps: PropGetter<\"footer\"> = useCallback(\n (props) => ({\n ...props,\n }),\n [],\n )\n\n return {\n open,\n getBodyProps,\n getCloseButtonProps,\n getCloseTriggerProps,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getOpenTriggerProps,\n getOverlayProps,\n getRootProps,\n getTitleProps,\n onClose,\n onOpen,\n }\n}\n\nexport type UseModalReturn = ReturnType<typeof useModal>\n"],"mappings":";;;;;;;;;AA4BA,MAAa,YAAY,EACvB,aAAa,MACb,iBAAiB,MACjB,aACA,MAAM,UACN,SAAS,aACT,OACA,QAAQ,YACR,GAAG,SACc,EAAE,KAAK;CACxB,MAAM,EAAE,MAAM,SAAS,WAAWA,qCAAc;EAC9C;EACA,MAAM;EACN,SAAS;EACT,QAAQ;EACR,GAAG;EACJ,CAAC;CACF,MAAM,8BAAmB;CACzB,MAAM,4BAAiB;CACvB,MAAM,2BAAgB;CACtB,MAAM,EAAE,MAAMC,8BAAQ,QAAQ;CAE9B,MAAM,oCACH,OAAsB;AACrB,MAAI,GAAG,QAAQ,SAAU;AAEzB,KAAG,iBAAiB;AAEpB,MAAI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CAhBC,WAAW;GACV,IAAI;GACJ,GAAG;GACJ,GACD,CAAC,OAAO,CACT;EAYC;EACA;EACA;EACA,wCAZC,WAAW,EACV,GAAG,OACJ,GACD,EAAE,CACH;EASC;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
1
+ {"version":3,"file":"use-modal.cjs","names":["useDisclosure","useIds","useI18n","getRootProps: PropGetter","getOverlayProps: PropGetter","getOpenTriggerProps: PropGetter<\"button\">","getCloseTriggerProps: PropGetter<\"button\">","getCloseButtonProps: PropGetter<\"button\">","getContentProps: PropGetter<\"section\">","getHeaderProps: PropGetter<\"header\">","getTitleProps: PropGetter<\"h2\">"],"sources":["../../../../src/components/modal/use-modal.ts"],"sourcesContent":["import type { KeyboardEvent } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { UseDisclosureProps } from \"../../hooks/use-disclosure\"\nimport { useCallback } from \"react\"\nimport { useDisclosure } from \"../../hooks/use-disclosure\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport { cx, handlerAll, useIds } from \"../../utils\"\n\nexport interface UseModalProps\n extends HTMLProps, Omit<UseDisclosureProps, \"timing\"> {\n /**\n * If `true`, the modal will close when the `Esc` key is pressed.\n *\n * @default true\n */\n closeOnEsc?: boolean\n /**\n * If `true`, the modal will close when the overlay is clicked.\n *\n * @default true\n */\n closeOnOverlay?: boolean\n /**\n * Callback invoked when the escape key is pressed and focus is within modal.\n */\n onEsc?: () => void\n}\n\nexport const useModal = ({\n closeOnEsc = true,\n closeOnOverlay = true,\n defaultOpen,\n open: openProp,\n onClose: onCloseProp,\n onEsc,\n onOpen: onOpenProp,\n ...rest\n}: UseModalProps = {}) => {\n const { open, onClose, onOpen } = useDisclosure({\n defaultOpen,\n open: openProp,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n })\n const [contentId, titleId, bodyId] = useIds()\n const { t } = useI18n(\"modal\")\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent) => {\n if (ev.key !== \"Escape\") return\n\n ev.stopPropagation()\n\n if (closeOnEsc) onClose()\n\n onEsc?.()\n },\n [closeOnEsc, onClose, onEsc],\n )\n\n const getRootProps: PropGetter = useCallback(\n (props) => ({\n ...rest,\n ...props,\n }),\n [rest],\n )\n\n const getOverlayProps: PropGetter = useCallback(\n (props = {}) => ({\n \"aria-hidden\": \"true\",\n ...props,\n onClick: handlerAll(props.onClick, (ev) => {\n ev.stopPropagation()\n\n if (closeOnOverlay) onClose()\n }),\n }),\n [closeOnOverlay, onClose],\n )\n\n const getOpenTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n \"aria-controls\": open ? contentId : undefined,\n \"aria-expanded\": open,\n \"aria-haspopup\": \"dialog\",\n \"aria-label\": t(\"Open modal\"),\n ...props,\n onClick: handlerAll(props.onClick, onOpen),\n }),\n [contentId, onOpen, open, t],\n )\n\n const getCloseTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n \"aria-label\": t(\"Close modal\"),\n ...props,\n onClick: handlerAll(props.onClick, onClose),\n }),\n [onClose, t],\n )\n\n const getCloseButtonProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n \"aria-label\": t(\"Close modal\"),\n ...props,\n onClick: handlerAll(props.onClick, onClose),\n }),\n [onClose, t],\n )\n\n const getContentProps: PropGetter<\"section\"> = useCallback(\n ({\n \"aria-describedby\": ariaDescribedby,\n \"aria-labelledby\": ariaLabelledby,\n ...props\n } = {}) => ({\n id: contentId,\n \"aria-describedby\": cx(ariaDescribedby, bodyId),\n \"aria-labelledby\": cx(ariaLabelledby, titleId),\n \"aria-modal\": \"true\",\n role: \"dialog\",\n ...props,\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n }),\n [bodyId, contentId, onKeyDown, titleId],\n )\n\n const getHeaderProps: PropGetter<\"header\"> = useCallback(\n (props) => ({\n ...props,\n }),\n [],\n )\n\n const getTitleProps: PropGetter<\"h2\"> = useCallback(\n (props) => ({\n id: titleId,\n ...props,\n }),\n [titleId],\n )\n\n const getBodyProps: PropGetter = useCallback(\n (props) => ({\n id: bodyId,\n ...props,\n }),\n [bodyId],\n )\n\n const getFooterProps: PropGetter<\"footer\"> = useCallback(\n (props) => ({\n ...props,\n }),\n [],\n )\n\n return {\n open,\n getBodyProps,\n getCloseButtonProps,\n getCloseTriggerProps,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getOpenTriggerProps,\n getOverlayProps,\n getRootProps,\n getTitleProps,\n onClose,\n onOpen,\n }\n}\n\nexport type UseModalReturn = ReturnType<typeof useModal>\n"],"mappings":";;;;;;;;;;AA4BA,MAAa,YAAY,EACvB,aAAa,MACb,iBAAiB,MACjB,aACA,MAAM,UACN,SAAS,aACT,OACA,QAAQ,YACR,GAAG,SACc,EAAE,KAAK;CACxB,MAAM,EAAE,MAAM,SAAS,WAAWA,qCAAc;EAC9C;EACA,MAAM;EACN,SAAS;EACT,QAAQ;EACT,CAAC;CACF,MAAM,CAAC,WAAW,SAAS,UAAUC,oBAAQ;CAC7C,MAAM,EAAE,MAAMC,8BAAQ,QAAQ;CAE9B,MAAM,oCACH,OAAsB;AACrB,MAAI,GAAG,QAAQ,SAAU;AAEzB,KAAG,iBAAiB;AAEpB,MAAI,WAAY,UAAS;AAEzB,WAAS;IAEX;EAAC;EAAY;EAAS;EAAM,CAC7B;CAED,MAAMC,uCACH,WAAW;EACV,GAAG;EACH,GAAG;EACJ,GACD,CAAC,KAAK,CACP;CAED,MAAMC,0CACH,QAAQ,EAAE,MAAM;EACf,eAAe;EACf,GAAG;EACH,2DAAoB,MAAM,UAAU,OAAO;AACzC,MAAG,iBAAiB;AAEpB,OAAI,eAAgB,UAAS;IAC7B;EACH,GACD,CAAC,gBAAgB,QAAQ,CAC1B;CAED,MAAMC,8CACH,QAAQ,EAAE,MAAM;EACf,iBAAiB,OAAO,YAAY;EACpC,iBAAiB;EACjB,iBAAiB;EACjB,cAAc,EAAE,aAAa;EAC7B,GAAG;EACH,2DAAoB,MAAM,SAAS,OAAO;EAC3C,GACD;EAAC;EAAW;EAAQ;EAAM;EAAE,CAC7B;CAED,MAAMC,+CACH,QAAQ,EAAE,MAAM;EACf,cAAc,EAAE,cAAc;EAC9B,GAAG;EACH,2DAAoB,MAAM,SAAS,QAAQ;EAC5C,GACD,CAAC,SAAS,EAAE,CACb;CAED,MAAMC,8CACH,QAAQ,EAAE,MAAM;EACf,cAAc,EAAE,cAAc;EAC9B,GAAG;EACH,2DAAoB,MAAM,SAAS,QAAQ;EAC5C,GACD,CAAC,SAAS,EAAE,CACb;CAED,MAAMC,0CACH,EACC,oBAAoB,iBACpB,mBAAmB,gBACnB,GAAG,UACD,EAAE,MAAM;EACV,IAAI;EACJ,8DAAuB,iBAAiB,OAAO;EAC/C,6DAAsB,gBAAgB,QAAQ;EAC9C,cAAc;EACd,MAAM;EACN,GAAG;EACH,6DAAsB,MAAM,WAAW,UAAU;EAClD,GACD;EAAC;EAAQ;EAAW;EAAW;EAAQ,CACxC;CAED,MAAMC,yCACH,WAAW,EACV,GAAG,OACJ,GACD,EAAE,CACH;CAED,MAAMC,wCACH,WAAW;EACV,IAAI;EACJ,GAAG;EACJ,GACD,CAAC,QAAQ,CACV;AAiBD,QAAO;EACL;EACA,sCAhBC,WAAW;GACV,IAAI;GACJ,GAAG;GACJ,GACD,CAAC,OAAO,CACT;EAYC;EACA;EACA;EACA,wCAZC,WAAW,EACV,GAAG,OACJ,GACD,EAAE,CACH;EASC;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
@@ -169,7 +169,7 @@ const PaginationText = withContext("span", "text")(void 0, ({ children, format =
169
169
  };
170
170
  });
171
171
  const PaginationStartTrigger = withContext("button", {
172
- name: "startTrigger",
172
+ name: "StartTrigger",
173
173
  slot: ["trigger", "start"]
174
174
  })(void 0, (props) => {
175
175
  const { getStartTriggerProps } = require_use_pagination.usePaginationContext();
@@ -179,7 +179,7 @@ const PaginationStartTrigger = withContext("button", {
179
179
  };
180
180
  });
181
181
  const PaginationEndTrigger = withContext("button", {
182
- name: "endTrigger",
182
+ name: "EndTrigger",
183
183
  slot: ["trigger", "end"]
184
184
  })(void 0, (props) => {
185
185
  const { getEndTriggerProps } = require_use_pagination.usePaginationContext();
@@ -189,7 +189,7 @@ const PaginationEndTrigger = withContext("button", {
189
189
  };
190
190
  });
191
191
  const PaginationPrevTrigger = withContext("button", {
192
- name: "prevTrigger",
192
+ name: "PrevTrigger",
193
193
  slot: ["trigger", "prev"]
194
194
  })(void 0, (props) => {
195
195
  const { getPrevTriggerProps } = require_use_pagination.usePaginationContext();
@@ -199,7 +199,7 @@ const PaginationPrevTrigger = withContext("button", {
199
199
  };
200
200
  });
201
201
  const PaginationNextTrigger = withContext("button", {
202
- name: "nextTrigger",
202
+ name: "NextTrigger",
203
203
  slot: ["trigger", "next"]
204
204
  })(void 0, (props) => {
205
205
  const { getNextTriggerProps } = require_use_pagination.usePaginationContext();
@@ -1 +1 @@
1
- {"version":3,"file":"pagination.cjs","names":["createSlotComponent","paginationStyle","usePagination","children: ReactNode[]","ChevronsLeftIcon","ChevronLeftIcon","styled","EllipsisIcon","ChevronRightIcon","ChevronsRightIcon","children","PaginationContext","PaginationItems: FC<PaginationItemsProps>","usePaginationContext","useI18n"],"sources":["../../../../src/components/pagination/pagination.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, ReactNode } from \"react\"\nimport type {\n HTMLProps,\n HTMLStyledProps,\n ThemeProps,\n WithoutThemeProps,\n} from \"../../core\"\nimport type { ReactNodeOrFunction } from \"../../utils\"\nimport type { PaginationStyle } from \"./pagination.style\"\nimport type { Page, UsePaginationProps } from \"./use-pagination\"\nimport { cloneElement, isValidElement, useMemo } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport { isNumber, runIfFn } from \"../../utils\"\nimport { ButtonGroup } from \"../button\"\nimport {\n ChevronLeftIcon,\n ChevronRightIcon,\n ChevronsLeftIcon,\n ChevronsRightIcon,\n EllipsisIcon,\n} from \"../icon\"\nimport { paginationStyle } from \"./pagination.style\"\nimport {\n PaginationContext,\n usePagination,\n usePaginationContext,\n} from \"./use-pagination\"\n\nexport interface PaginationRootProps\n extends\n WithoutThemeProps<\n Omit<ButtonGroup.RootProps, \"onChange\" | \"page\">,\n PaginationStyle\n >,\n ThemeProps<PaginationStyle>,\n Omit<UsePaginationProps, \"boundaries\" | \"siblings\"> {\n /**\n * Number of elements visible on the left/right edges.\n *\n * @default 1\n */\n boundaries?: number\n /** Number of siblings displayed on the left/right side of selected page.\n *\n * @default 1\n */\n siblings?: number\n /**\n * If `true`, display the control buttons.\n *\n * @default true\n */\n withControls?: boolean\n /**\n * If `true`, display the edge buttons.\n *\n * @default false\n */\n withEdges?: boolean\n /**\n * Props for next of the control button element.\n */\n controlNextProps?: PaginationItemProps\n /**\n * Props for previous of the control button element.\n */\n controlPrevProps?: PaginationItemProps\n /**\n * Props for control button element.\n */\n controlProps?: PaginationItemProps\n /**\n * Props for end of the edge button element.\n */\n edgeEndProps?: PaginationItemProps\n /**\n * Props for edge button element.\n */\n edgeProps?: PaginationItemProps\n /**\n * Props for start of the edge button element.\n */\n edgeStartProps?: PaginationItemProps\n /**\n * Props for ellipsis of the element.\n */\n ellipsisProps?: PaginationItemProps\n /**\n * Props for item of the button element.\n */\n itemProps?: PaginationItemProps\n}\n\nconst {\n PropsContext: PaginationPropsContext,\n usePropsContext: usePaginationPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<PaginationRootProps, PaginationStyle>(\n \"pagination\",\n paginationStyle,\n)\n\nexport { PaginationPropsContext, usePaginationPropsContext }\n\n/**\n * `Pagination` is a component for managing the pagination and navigation of content.\n *\n * @see https://yamada-ui.com/docs/components/pagination\n */\nexport const PaginationRoot = withProvider<\n \"nav\",\n PaginationRootProps,\n \"size\" | \"variant\"\n>(\n ({\n size,\n variant,\n children,\n withControls = true,\n withEdges = false,\n controlNextProps,\n controlPrevProps,\n controlProps,\n edgeEndProps,\n edgeProps,\n edgeStartProps,\n ellipsisProps,\n itemProps,\n ...rest\n }) => {\n const {\n currentPage,\n disabled,\n range,\n total,\n getEndTriggerProps,\n getItemProps,\n getNextTriggerProps,\n getPrevTriggerProps,\n getRootProps,\n getStartTriggerProps,\n onChange,\n onChangeEnd,\n onChangeNext,\n onChangePrev,\n onChangeStart,\n } = usePagination(rest)\n const context = useMemo(\n () => ({\n currentPage,\n disabled,\n range,\n total,\n getEndTriggerProps,\n getItemProps,\n getNextTriggerProps,\n getPrevTriggerProps,\n getStartTriggerProps,\n onChange,\n onChangeEnd,\n onChangeNext,\n onChangePrev,\n onChangeStart,\n }),\n [\n currentPage,\n disabled,\n range,\n total,\n getEndTriggerProps,\n getItemProps,\n getNextTriggerProps,\n getPrevTriggerProps,\n getStartTriggerProps,\n onChange,\n onChangeEnd,\n onChangeNext,\n onChangePrev,\n onChangeStart,\n ],\n )\n const computedChildren = useMemo(() => {\n if (children) {\n return children\n } else {\n const children: ReactNode[] = []\n\n if (withEdges)\n children.push(\n <PaginationStartTrigger>\n <PaginationItem\n icon={<ChevronsLeftIcon />}\n {...edgeProps}\n {...edgeStartProps}\n />\n </PaginationStartTrigger>,\n )\n if (withControls)\n children.push(\n <PaginationPrevTrigger>\n <PaginationItem\n icon={<ChevronLeftIcon />}\n {...controlProps}\n {...controlPrevProps}\n />\n </PaginationPrevTrigger>,\n )\n\n children.push(\n <PaginationItems\n render={(page) =>\n isNumber(page) ? (\n <PaginationItem {...itemProps}>\n <styled.span role=\"presentation\">{page}</styled.span>\n </PaginationItem>\n ) : (\n <PaginationItem\n as=\"span\"\n icon={<EllipsisIcon />}\n {...ellipsisProps}\n />\n )\n }\n />,\n )\n\n if (withControls)\n children.push(\n <PaginationNextTrigger>\n <PaginationItem\n icon={<ChevronRightIcon />}\n {...controlProps}\n {...controlNextProps}\n />\n </PaginationNextTrigger>,\n )\n if (withEdges)\n children.push(\n <PaginationEndTrigger>\n <PaginationItem\n icon={<ChevronsRightIcon />}\n {...edgeProps}\n {...edgeEndProps}\n />\n </PaginationEndTrigger>,\n )\n\n return children\n }\n }, [\n children,\n withEdges,\n withControls,\n itemProps,\n ellipsisProps,\n edgeProps,\n edgeStartProps,\n edgeEndProps,\n controlProps,\n controlPrevProps,\n controlNextProps,\n ])\n\n return (\n <PaginationContext value={context}>\n <ButtonGroup.Root\n as=\"nav\"\n size={size}\n variant={variant}\n {...getRootProps()}\n >\n {computedChildren}\n </ButtonGroup.Root>\n </PaginationContext>\n )\n },\n \"root\",\n { transferProps: [\"variant\", \"size\"] },\n)()\n\nexport interface PaginationItemsProps {\n /**\n * The function used to generate children.\n * it will be called with page number or `\"ellipsis\"`.\n */\n children?: (page: Page) => ReactNode\n /**\n * The function used to generate children.\n * it will be called with page number or `\"ellipsis\"`.\n */\n render?: (page: Page) => ReactNode\n}\n\nexport const PaginationItems: FC<PaginationItemsProps> = ({\n children,\n render,\n}) => {\n const { range, getItemProps } = usePaginationContext()\n\n return useMemo(\n () =>\n range.map((page, index) => {\n const component = children?.(page) ?? render?.(page)\n\n if (isValidElement<HTMLProps<\"button\">>(component)) {\n return cloneElement(component, {\n ...getItemProps({ key: index, page, ...component.props }),\n })\n } else {\n return component\n }\n }),\n [children, getItemProps, range, render],\n )\n}\n\nexport interface PaginationItemProps extends ButtonGroup.IconItemProps {}\n\nexport const PaginationItem = withContext<\"button\", PaginationItemProps>(\n ButtonGroup.IconItem,\n \"item\",\n)()\n\nexport interface PaginationTextProps extends Omit<\n HTMLStyledProps<\"span\">,\n \"children\"\n> {\n /**\n * The children of the text.\n * if function, it will be called with `{ page: number; total: number }`.\n */\n children?: ReactNodeOrFunction<{ page: number; total: number }>\n /**\n * The format of the text.\n *\n * @default 'compact'\n */\n format?: \"compact\" | \"short\"\n}\n\nexport const PaginationText = withContext<\"span\", PaginationTextProps>(\n \"span\",\n \"text\",\n)(undefined, ({ children, format = \"compact\", ...rest }) => {\n const { currentPage, total } = usePaginationContext()\n const { t } = useI18n(\"pagination\")\n const computedChildren = useMemo(() => {\n if (children) {\n return runIfFn(children, { page: currentPage, total })\n } else if (format === \"short\") {\n return t(\"{value} / {total}\", {\n total,\n value: currentPage,\n })\n } else {\n return t(\"{value} of {total}\", {\n total,\n value: currentPage,\n })\n }\n }, [children, currentPage, format, total, t])\n\n return {\n ...rest,\n children: computedChildren,\n }\n})\n\nexport interface PaginationStartTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const PaginationStartTrigger = withContext<\n \"button\",\n PaginationStartTriggerProps\n>(\"button\", { name: \"startTrigger\", slot: [\"trigger\", \"start\"] })(\n undefined,\n (props) => {\n const { getStartTriggerProps } = usePaginationContext()\n\n return { asChild: true, ...getStartTriggerProps(props) }\n },\n)\n\nexport interface PaginationEndTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const PaginationEndTrigger = withContext<\n \"button\",\n PaginationEndTriggerProps\n>(\"button\", { name: \"endTrigger\", slot: [\"trigger\", \"end\"] })(\n undefined,\n (props) => {\n const { getEndTriggerProps } = usePaginationContext()\n\n return { asChild: true, ...getEndTriggerProps(props) }\n },\n)\n\nexport interface PaginationPrevTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const PaginationPrevTrigger = withContext<\n \"button\",\n PaginationPrevTriggerProps\n>(\"button\", { name: \"prevTrigger\", slot: [\"trigger\", \"prev\"] })(\n undefined,\n (props) => {\n const { getPrevTriggerProps } = usePaginationContext()\n\n return { asChild: true, ...getPrevTriggerProps(props) }\n },\n)\n\nexport interface PaginationNextTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const PaginationNextTrigger = withContext<\n \"button\",\n PaginationNextTriggerProps\n>(\"button\", { name: \"nextTrigger\", slot: [\"trigger\", \"next\"] })(\n undefined,\n (props) => {\n const { getNextTriggerProps } = usePaginationContext()\n\n return { asChild: true, ...getNextTriggerProps(props) }\n },\n)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAgGA,MAAM,EACJ,cAAc,wBACd,iBAAiB,2BACjB,aACA,iBACEA,6CACF,cACAC,yCACD;;;;;;AASD,MAAa,iBAAiB,cAK3B,EACC,MACA,SACA,UACA,eAAe,MACf,YAAY,OACZ,kBACA,kBACA,cACA,cACA,WACA,gBACA,eACA,WACA,GAAG,WACC;CACJ,MAAM,EACJ,aACA,UACA,OACA,OACA,oBACA,cACA,qBACA,qBACA,cACA,sBACA,UACA,aACA,cACA,cACA,kBACEC,qCAAc,KAAK;CACvB,MAAM,oCACG;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,GACD;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CACF;CACD,MAAM,4CAAiC;AACrC,MAAI,SACF,QAAO;OACF;GACL,MAAMC,aAAwB,EAAE;AAEhC,OAAI,UACF,YAAS,KACP,2CAAC,oCACC,2CAAC;IACC,MAAM,2CAACC,gDAAmB;IAC1B,GAAI;IACJ,GAAI;KACJ,GACqB,CAC1B;AACH,OAAI,aACF,YAAS,KACP,2CAAC,mCACC,2CAAC;IACC,MAAM,2CAACC,8CAAkB;IACzB,GAAI;IACJ,GAAI;KACJ,GACoB,CACzB;AAEH,cAAS,KACP,2CAAC,mBACC,SAAS,yDACE,KAAK,GACZ,2CAAC;IAAe,GAAI;cAClB,2CAACC,uBAAO;KAAK,MAAK;eAAgB;MAAmB;KACtC,GAEjB,2CAAC;IACC,IAAG;IACH,MAAM,2CAACC,uCAAe;IACtB,GAAI;KACJ,GAGN,CACH;AAED,OAAI,aACF,YAAS,KACP,2CAAC,mCACC,2CAAC;IACC,MAAM,2CAACC,gDAAmB;IAC1B,GAAI;IACJ,GAAI;KACJ,GACoB,CACzB;AACH,OAAI,UACF,YAAS,KACP,2CAAC,kCACC,2CAAC;IACC,MAAM,2CAACC,kDAAoB;IAC3B,GAAI;IACJ,GAAI;KACJ,GACmB,CACxB;AAEH,UAAOC;;IAER;EACD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;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AID,MAAa,uBAAuB,YAGlC,UAAU;CAAE,MAAM;CAAc,MAAM,CAAC,WAAW,MAAM;CAAE,CAAC,CAC3D,SACC,UAAU;CACT,MAAM,EAAE,uBAAuBA,6CAAsB;AAErD,QAAO;EAAE,SAAS;EAAM,GAAG,mBAAmB,MAAM;EAAE;EAEzD;AAID,MAAa,wBAAwB,YAGnC,UAAU;CAAE,MAAM;CAAe,MAAM,CAAC,WAAW,OAAO;CAAE,CAAC,CAC7D,SACC,UAAU;CACT,MAAM,EAAE,wBAAwBA,6CAAsB;AAEtD,QAAO;EAAE,SAAS;EAAM,GAAG,oBAAoB,MAAM;EAAE;EAE1D;AAID,MAAa,wBAAwB,YAGnC,UAAU;CAAE,MAAM;CAAe,MAAM,CAAC,WAAW,OAAO;CAAE,CAAC,CAC7D,SACC,UAAU;CACT,MAAM,EAAE,wBAAwBA,6CAAsB;AAEtD,QAAO;EAAE,SAAS;EAAM,GAAG,oBAAoB,MAAM;EAAE;EAE1D"}
1
+ {"version":3,"file":"pagination.cjs","names":["createSlotComponent","paginationStyle","usePagination","children: ReactNode[]","ChevronsLeftIcon","ChevronLeftIcon","styled","EllipsisIcon","ChevronRightIcon","ChevronsRightIcon","children","PaginationContext","PaginationItems: FC<PaginationItemsProps>","usePaginationContext","useI18n"],"sources":["../../../../src/components/pagination/pagination.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, ReactNode } from \"react\"\nimport type {\n HTMLProps,\n HTMLStyledProps,\n ThemeProps,\n WithoutThemeProps,\n} from \"../../core\"\nimport type { ReactNodeOrFunction } from \"../../utils\"\nimport type { PaginationStyle } from \"./pagination.style\"\nimport type { Page, UsePaginationProps } from \"./use-pagination\"\nimport { cloneElement, isValidElement, useMemo } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport { isNumber, runIfFn } from \"../../utils\"\nimport { ButtonGroup } from \"../button\"\nimport {\n ChevronLeftIcon,\n ChevronRightIcon,\n ChevronsLeftIcon,\n ChevronsRightIcon,\n EllipsisIcon,\n} from \"../icon\"\nimport { paginationStyle } from \"./pagination.style\"\nimport {\n PaginationContext,\n usePagination,\n usePaginationContext,\n} from \"./use-pagination\"\n\nexport interface PaginationRootProps\n extends\n WithoutThemeProps<\n Omit<ButtonGroup.RootProps, \"onChange\" | \"page\">,\n PaginationStyle\n >,\n ThemeProps<PaginationStyle>,\n Omit<UsePaginationProps, \"boundaries\" | \"siblings\"> {\n /**\n * Number of elements visible on the left/right edges.\n *\n * @default 1\n */\n boundaries?: number\n /** Number of siblings displayed on the left/right side of selected page.\n *\n * @default 1\n */\n siblings?: number\n /**\n * If `true`, display the control buttons.\n *\n * @default true\n */\n withControls?: boolean\n /**\n * If `true`, display the edge buttons.\n *\n * @default false\n */\n withEdges?: boolean\n /**\n * Props for next of the control button element.\n */\n controlNextProps?: PaginationItemProps\n /**\n * Props for previous of the control button element.\n */\n controlPrevProps?: PaginationItemProps\n /**\n * Props for control button element.\n */\n controlProps?: PaginationItemProps\n /**\n * Props for end of the edge button element.\n */\n edgeEndProps?: PaginationItemProps\n /**\n * Props for edge button element.\n */\n edgeProps?: PaginationItemProps\n /**\n * Props for start of the edge button element.\n */\n edgeStartProps?: PaginationItemProps\n /**\n * Props for ellipsis of the element.\n */\n ellipsisProps?: PaginationItemProps\n /**\n * Props for item of the button element.\n */\n itemProps?: PaginationItemProps\n}\n\nconst {\n PropsContext: PaginationPropsContext,\n usePropsContext: usePaginationPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<PaginationRootProps, PaginationStyle>(\n \"pagination\",\n paginationStyle,\n)\n\nexport { PaginationPropsContext, usePaginationPropsContext }\n\n/**\n * `Pagination` is a component for managing the pagination and navigation of content.\n *\n * @see https://yamada-ui.com/docs/components/pagination\n */\nexport const PaginationRoot = withProvider<\n \"nav\",\n PaginationRootProps,\n \"size\" | \"variant\"\n>(\n ({\n size,\n variant,\n children,\n withControls = true,\n withEdges = false,\n controlNextProps,\n controlPrevProps,\n controlProps,\n edgeEndProps,\n edgeProps,\n edgeStartProps,\n ellipsisProps,\n itemProps,\n ...rest\n }) => {\n const {\n currentPage,\n disabled,\n range,\n total,\n getEndTriggerProps,\n getItemProps,\n getNextTriggerProps,\n getPrevTriggerProps,\n getRootProps,\n getStartTriggerProps,\n onChange,\n onChangeEnd,\n onChangeNext,\n onChangePrev,\n onChangeStart,\n } = usePagination(rest)\n const context = useMemo(\n () => ({\n currentPage,\n disabled,\n range,\n total,\n getEndTriggerProps,\n getItemProps,\n getNextTriggerProps,\n getPrevTriggerProps,\n getStartTriggerProps,\n onChange,\n onChangeEnd,\n onChangeNext,\n onChangePrev,\n onChangeStart,\n }),\n [\n currentPage,\n disabled,\n range,\n total,\n getEndTriggerProps,\n getItemProps,\n getNextTriggerProps,\n getPrevTriggerProps,\n getStartTriggerProps,\n onChange,\n onChangeEnd,\n onChangeNext,\n onChangePrev,\n onChangeStart,\n ],\n )\n const computedChildren = useMemo(() => {\n if (children) {\n return children\n } else {\n const children: ReactNode[] = []\n\n if (withEdges)\n children.push(\n <PaginationStartTrigger>\n <PaginationItem\n icon={<ChevronsLeftIcon />}\n {...edgeProps}\n {...edgeStartProps}\n />\n </PaginationStartTrigger>,\n )\n if (withControls)\n children.push(\n <PaginationPrevTrigger>\n <PaginationItem\n icon={<ChevronLeftIcon />}\n {...controlProps}\n {...controlPrevProps}\n />\n </PaginationPrevTrigger>,\n )\n\n children.push(\n <PaginationItems\n render={(page) =>\n isNumber(page) ? (\n <PaginationItem {...itemProps}>\n <styled.span role=\"presentation\">{page}</styled.span>\n </PaginationItem>\n ) : (\n <PaginationItem\n as=\"span\"\n icon={<EllipsisIcon />}\n {...ellipsisProps}\n />\n )\n }\n />,\n )\n\n if (withControls)\n children.push(\n <PaginationNextTrigger>\n <PaginationItem\n icon={<ChevronRightIcon />}\n {...controlProps}\n {...controlNextProps}\n />\n </PaginationNextTrigger>,\n )\n if (withEdges)\n children.push(\n <PaginationEndTrigger>\n <PaginationItem\n icon={<ChevronsRightIcon />}\n {...edgeProps}\n {...edgeEndProps}\n />\n </PaginationEndTrigger>,\n )\n\n return children\n }\n }, [\n children,\n withEdges,\n withControls,\n itemProps,\n ellipsisProps,\n edgeProps,\n edgeStartProps,\n edgeEndProps,\n controlProps,\n controlPrevProps,\n controlNextProps,\n ])\n\n return (\n <PaginationContext value={context}>\n <ButtonGroup.Root\n as=\"nav\"\n size={size}\n variant={variant}\n {...getRootProps()}\n >\n {computedChildren}\n </ButtonGroup.Root>\n </PaginationContext>\n )\n },\n \"root\",\n { transferProps: [\"variant\", \"size\"] },\n)()\n\nexport interface PaginationItemsProps {\n /**\n * The function used to generate children.\n * it will be called with page number or `\"ellipsis\"`.\n */\n children?: (page: Page) => ReactNode\n /**\n * The function used to generate children.\n * it will be called with page number or `\"ellipsis\"`.\n */\n render?: (page: Page) => ReactNode\n}\n\nexport const PaginationItems: FC<PaginationItemsProps> = ({\n children,\n render,\n}) => {\n const { range, getItemProps } = usePaginationContext()\n\n return useMemo(\n () =>\n range.map((page, index) => {\n const component = children?.(page) ?? render?.(page)\n\n if (isValidElement<HTMLProps<\"button\">>(component)) {\n return cloneElement(component, {\n ...getItemProps({ key: index, page, ...component.props }),\n })\n } else {\n return component\n }\n }),\n [children, getItemProps, range, render],\n )\n}\n\nexport interface PaginationItemProps extends ButtonGroup.IconItemProps {}\n\nexport const PaginationItem = withContext<\"button\", PaginationItemProps>(\n ButtonGroup.IconItem,\n \"item\",\n)()\n\nexport interface PaginationTextProps extends Omit<\n HTMLStyledProps<\"span\">,\n \"children\"\n> {\n /**\n * The children of the text.\n * if function, it will be called with `{ page: number; total: number }`.\n */\n children?: ReactNodeOrFunction<{ page: number; total: number }>\n /**\n * The format of the text.\n *\n * @default 'compact'\n */\n format?: \"compact\" | \"short\"\n}\n\nexport const PaginationText = withContext<\"span\", PaginationTextProps>(\n \"span\",\n \"text\",\n)(undefined, ({ children, format = \"compact\", ...rest }) => {\n const { currentPage, total } = usePaginationContext()\n const { t } = useI18n(\"pagination\")\n const computedChildren = useMemo(() => {\n if (children) {\n return runIfFn(children, { page: currentPage, total })\n } else if (format === \"short\") {\n return t(\"{value} / {total}\", {\n total,\n value: currentPage,\n })\n } else {\n return t(\"{value} of {total}\", {\n total,\n value: currentPage,\n })\n }\n }, [children, currentPage, format, total, t])\n\n return {\n ...rest,\n children: computedChildren,\n }\n})\n\nexport interface PaginationStartTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const PaginationStartTrigger = withContext<\n \"button\",\n PaginationStartTriggerProps\n>(\"button\", { name: \"StartTrigger\", slot: [\"trigger\", \"start\"] })(\n undefined,\n (props) => {\n const { getStartTriggerProps } = usePaginationContext()\n\n return { asChild: true, ...getStartTriggerProps(props) }\n },\n)\n\nexport interface PaginationEndTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const PaginationEndTrigger = withContext<\n \"button\",\n PaginationEndTriggerProps\n>(\"button\", { name: \"EndTrigger\", slot: [\"trigger\", \"end\"] })(\n undefined,\n (props) => {\n const { getEndTriggerProps } = usePaginationContext()\n\n return { asChild: true, ...getEndTriggerProps(props) }\n },\n)\n\nexport interface PaginationPrevTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const PaginationPrevTrigger = withContext<\n \"button\",\n PaginationPrevTriggerProps\n>(\"button\", { name: \"PrevTrigger\", slot: [\"trigger\", \"prev\"] })(\n undefined,\n (props) => {\n const { getPrevTriggerProps } = usePaginationContext()\n\n return { asChild: true, ...getPrevTriggerProps(props) }\n },\n)\n\nexport interface PaginationNextTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const PaginationNextTrigger = withContext<\n \"button\",\n PaginationNextTriggerProps\n>(\"button\", { name: \"NextTrigger\", slot: [\"trigger\", \"next\"] })(\n undefined,\n (props) => {\n const { getNextTriggerProps } = usePaginationContext()\n\n return { asChild: true, ...getNextTriggerProps(props) }\n },\n)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAgGA,MAAM,EACJ,cAAc,wBACd,iBAAiB,2BACjB,aACA,iBACEA,6CACF,cACAC,yCACD;;;;;;AASD,MAAa,iBAAiB,cAK3B,EACC,MACA,SACA,UACA,eAAe,MACf,YAAY,OACZ,kBACA,kBACA,cACA,cACA,WACA,gBACA,eACA,WACA,GAAG,WACC;CACJ,MAAM,EACJ,aACA,UACA,OACA,OACA,oBACA,cACA,qBACA,qBACA,cACA,sBACA,UACA,aACA,cACA,cACA,kBACEC,qCAAc,KAAK;CACvB,MAAM,oCACG;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,GACD;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CACF;CACD,MAAM,4CAAiC;AACrC,MAAI,SACF,QAAO;OACF;GACL,MAAMC,aAAwB,EAAE;AAEhC,OAAI,UACF,YAAS,KACP,2CAAC,oCACC,2CAAC;IACC,MAAM,2CAACC,gDAAmB;IAC1B,GAAI;IACJ,GAAI;KACJ,GACqB,CAC1B;AACH,OAAI,aACF,YAAS,KACP,2CAAC,mCACC,2CAAC;IACC,MAAM,2CAACC,8CAAkB;IACzB,GAAI;IACJ,GAAI;KACJ,GACoB,CACzB;AAEH,cAAS,KACP,2CAAC,mBACC,SAAS,yDACE,KAAK,GACZ,2CAAC;IAAe,GAAI;cAClB,2CAACC,uBAAO;KAAK,MAAK;eAAgB;MAAmB;KACtC,GAEjB,2CAAC;IACC,IAAG;IACH,MAAM,2CAACC,uCAAe;IACtB,GAAI;KACJ,GAGN,CACH;AAED,OAAI,aACF,YAAS,KACP,2CAAC,mCACC,2CAAC;IACC,MAAM,2CAACC,gDAAmB;IAC1B,GAAI;IACJ,GAAI;KACJ,GACoB,CACzB;AACH,OAAI,UACF,YAAS,KACP,2CAAC,kCACC,2CAAC;IACC,MAAM,2CAACC,kDAAoB;IAC3B,GAAI;IACJ,GAAI;KACJ,GACmB,CACxB;AAEH,UAAOC;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;EAAE,SAAS;EAAM,GAAG,qBAAqB,MAAM;EAAE;EAE3D;AAID,MAAa,uBAAuB,YAGlC,UAAU;CAAE,MAAM;CAAc,MAAM,CAAC,WAAW,MAAM;CAAE,CAAC,CAC3D,SACC,UAAU;CACT,MAAM,EAAE,uBAAuBA,6CAAsB;AAErD,QAAO;EAAE,SAAS;EAAM,GAAG,mBAAmB,MAAM;EAAE;EAEzD;AAID,MAAa,wBAAwB,YAGnC,UAAU;CAAE,MAAM;CAAe,MAAM,CAAC,WAAW,OAAO;CAAE,CAAC,CAC7D,SACC,UAAU;CACT,MAAM,EAAE,wBAAwBA,6CAAsB;AAEtD,QAAO;EAAE,SAAS;EAAM,GAAG,oBAAoB,MAAM;EAAE;EAE1D;AAID,MAAa,wBAAwB,YAGnC,UAAU;CAAE,MAAM;CAAe,MAAM,CAAC,WAAW,OAAO;CAAE,CAAC,CAC7D,SACC,UAAU;CACT,MAAM,EAAE,wBAAwBA,6CAAsB;AAEtD,QAAO;EAAE,SAAS;EAAM,GAAG,oBAAoB,MAAM;EAAE;EAE1D"}
@@ -6,6 +6,7 @@ const require_var = require('../../core/system/var.cjs');
6
6
  const require_factory = require('../../core/system/factory.cjs');
7
7
  const require_create_component = require('../../core/components/create-component.cjs');
8
8
  require('../../core/index.cjs');
9
+ const require_hooks_use_value_index = require('../../hooks/use-value/index.cjs');
9
10
  const require_timeline_style = require('./timeline.style.cjs');
10
11
  let react = require("react");
11
12
  let react_jsx_runtime = require("react/jsx-runtime");
@@ -17,8 +18,9 @@ const { ComponentContext, PropsContext: TimelinePropsContext, useComponentContex
17
18
  *
18
19
  * @see https://yamada-ui.com/docs/components/timeline
19
20
  */
20
- const TimelineRoot = withProvider(({ children, index = -1, items = [], ...rest }) => {
21
+ const TimelineRoot = withProvider(({ variant: variantProp, children, index = -1, items = [], ...rest }) => {
21
22
  const context = (0, react.useMemo)(() => ({ index }), [index]);
23
+ const variant = require_hooks_use_value_index.useValue(variantProp);
22
24
  const computedChildren = (0, react.useMemo)(() => {
23
25
  if (children) return children;
24
26
  return items.map(({ align = "start", content, description, indicator, title, connectorProps, contentProps, descriptionProps, indicatorProps, titleProps, ...rest$1 }, index$1) => {
@@ -27,7 +29,7 @@ const TimelineRoot = withProvider(({ children, index = -1, items = [], ...rest }
27
29
  ...connectorProps,
28
30
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TimelineIndicator, {
29
31
  ...indicatorProps,
30
- children: indicator
32
+ children: indicator ?? (variant === "number" ? index$1 + 1 : void 0)
31
33
  })
32
34
  }),
33
35
  content: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TimelineContent, {
@@ -47,7 +49,11 @@ const TimelineRoot = withProvider(({ children, index = -1, items = [], ...rest }
47
49
  children: [align === "start" ? children$1.connector : children$1.content, align === "start" ? children$1.content : children$1.connector]
48
50
  }, index$1);
49
51
  });
50
- }, [items, children]);
52
+ }, [
53
+ children,
54
+ items,
55
+ variant
56
+ ]);
51
57
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContext, {
52
58
  value: context,
53
59
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.styled.ul, {
@@ -55,7 +61,7 @@ const TimelineRoot = withProvider(({ children, index = -1, items = [], ...rest }
55
61
  children: computedChildren
56
62
  })
57
63
  });
58
- }, "root")(void 0, ({ indicatorFill, indicatorSize, indicatorStroke, separatorColor, separatorGap, separatorStyle, separatorWidth, ...rest }) => ({
64
+ }, "root", { transferProps: ["variant"] })(void 0, ({ indicatorFill, indicatorSize, indicatorStroke, separatorColor, separatorGap, separatorStyle, separatorWidth, ...rest }) => ({
59
65
  "--indicator-fill": require_var.varAttr(indicatorFill, "colors"),
60
66
  "--indicator-size": require_var.varAttr(indicatorSize, "sizes"),
61
67
  "--indicator-stroke": require_var.varAttr(indicatorStroke, "colors"),
@@ -1 +1 @@
1
- {"version":3,"file":"timeline.cjs","names":["createSlotComponent","timelineStyle","rest","children","index","styled","varAttr"],"sources":["../../../../src/components/timeline/timeline.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactNode } from \"react\"\nimport type { CSSProps, HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { TimelineStyle } from \"./timeline.style\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, styled, varAttr } from \"../../core\"\nimport { dataAttr, isUndefined } from \"../../utils\"\nimport { timelineStyle } from \"./timeline.style\"\n\nexport interface TimelineItem extends Omit<\n TimelineItemProps,\n \"content\" | \"title\"\n> {\n align?: \"end\" | \"start\"\n content?: ReactNode\n description?: ReactNode\n indicator?: ReactNode\n title?: ReactNode\n connectorProps?: TimelineConnectorProps\n contentProps?: TimelineContentProps\n descriptionProps?: TimelineDescriptionProps\n indicatorProps?: TimelineIndicatorProps\n titleProps?: TimelineTitleProps\n}\n\ninterface ComponentContext extends Pick<TimelineRootProps, \"index\"> {}\n\nexport interface TimelineRootProps\n extends HTMLStyledProps<\"ul\">, ThemeProps<TimelineStyle> {\n /**\n * The index of the active timeline item.\n */\n index?: number\n /**\n * The fill color of the indicator.\n */\n indicatorFill?: CSSProps[\"bg\"]\n /**\n * The size of the indicator.\n */\n indicatorSize?: CSSProps[\"boxSize\"]\n /**\n * The stroke color of the indicator.\n */\n indicatorStroke?: CSSProps[\"color\"]\n /**\n * If provided, generate timeline components based on items.\n */\n items?: TimelineItem[]\n /**\n * The color of the separator.\n */\n separatorColor?: CSSProps[\"color\"]\n /**\n * The gap of the separator.\n */\n separatorGap?: CSSProps[\"gap\"]\n /**\n * The style of the separator.\n */\n separatorStyle?: CSSProps[\"borderStyle\"]\n /**\n * The width of the separator.\n */\n separatorWidth?: CSSProps[\"width\"]\n}\n\nconst {\n ComponentContext,\n PropsContext: TimelinePropsContext,\n useComponentContext,\n usePropsContext: useTimelinePropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<TimelineRootProps, TimelineStyle, ComponentContext>(\n \"timeline\",\n timelineStyle,\n)\n\nexport { TimelinePropsContext, useTimelinePropsContext }\n\n/**\n * `Timeline` is a component that is used to display a list of events in chronological order.\n *\n * @see https://yamada-ui.com/docs/components/timeline\n */\nexport const TimelineRoot = withProvider(\n ({ children, index = -1, items = [], ...rest }) => {\n const context = useMemo(() => ({ index }), [index])\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return items.map(\n (\n {\n align = \"start\",\n content,\n description,\n indicator,\n title,\n connectorProps,\n contentProps,\n descriptionProps,\n indicatorProps,\n titleProps,\n ...rest\n },\n index,\n ) => {\n const children = {\n connector: (\n <TimelineConnector {...connectorProps}>\n <TimelineIndicator {...indicatorProps}>\n {indicator}\n </TimelineIndicator>\n </TimelineConnector>\n ),\n content: (\n <TimelineContent {...contentProps}>\n {content ?? (\n <>\n <TimelineTitle {...titleProps}>{title}</TimelineTitle>\n <TimelineDescription {...descriptionProps}>\n {description}\n </TimelineDescription>\n </>\n )}\n </TimelineContent>\n ),\n }\n\n return (\n <TimelineItem key={index} index={index} {...rest}>\n {align === \"start\" ? children.connector : children.content}\n {align === \"start\" ? children.content : children.connector}\n </TimelineItem>\n )\n },\n )\n }, [items, children])\n\n return (\n <ComponentContext value={context}>\n <styled.ul {...rest}>{computedChildren}</styled.ul>\n </ComponentContext>\n )\n },\n \"root\",\n)(\n undefined,\n ({\n indicatorFill,\n indicatorSize,\n indicatorStroke,\n separatorColor,\n separatorGap,\n separatorStyle,\n separatorWidth,\n ...rest\n }) => ({\n \"--indicator-fill\": varAttr(indicatorFill, \"colors\"),\n \"--indicator-size\": varAttr(indicatorSize, \"sizes\"),\n \"--indicator-stroke\": varAttr(indicatorStroke, \"colors\"),\n \"--separator-color\": varAttr(separatorColor, \"colors\"),\n \"--separator-gap\": varAttr(separatorGap, \"spaces\"),\n \"--separator-style\": varAttr(separatorStyle),\n \"--separator-width\": varAttr(separatorWidth, \"sizes\"),\n ...rest,\n }),\n)\n\nexport interface TimelineItemProps extends HTMLStyledProps<\"li\"> {\n /**\n * The index of the timeline item.\n */\n index?: number\n}\n\nexport const TimelineItem = withContext<\"li\", TimelineItemProps>(\"li\", \"item\")(\n undefined,\n ({ index, ...rest }) => {\n const { index: currentIndex } = useComponentContext()\n const active =\n !isUndefined(index) && !isUndefined(currentIndex) && index <= currentIndex\n\n return {\n ...rest,\n \"data-active\": dataAttr(active),\n \"data-index\": index,\n }\n },\n)\n\nexport interface TimelineConnectorProps extends HTMLStyledProps {}\n\nexport const TimelineConnector = withContext<\"div\", TimelineConnectorProps>(\n \"div\",\n \"connector\",\n)({ \"data-connector\": \"\" })\n\nexport interface TimelineIndicatorProps extends HTMLStyledProps {}\n\nconst TimelineIcon = styled(\"div\", {\n base: {\n bg: \"{indicator-fill}\",\n borderColor: \"{indicator-stroke}\",\n borderWidth: \"{separator-width}\",\n boxSize: \"full\",\n rounded: \"{indicator-rounded}\",\n },\n})\n\nexport const TimelineIndicator = withContext<\"div\", TimelineIndicatorProps>(\n \"div\",\n \"indicator\",\n)(undefined, ({ children = <TimelineIcon />, ...rest }) => ({\n children,\n ...rest,\n}))\n\nexport interface TimelineContentProps extends HTMLStyledProps {}\n\nexport const TimelineContent = withContext<\"div\", TimelineContentProps>(\n \"div\",\n \"content\",\n)({ \"data-content\": \"\" })\n\nexport interface TimelineTitleProps extends HTMLStyledProps<\"h3\"> {}\n\nexport const TimelineTitle = withContext<\"h3\", TimelineTitleProps>(\n \"h3\",\n \"title\",\n)()\n\nexport interface TimelineDescriptionProps extends HTMLStyledProps<\"p\"> {}\n\nexport const TimelineDescription = withContext<\"p\", TimelineDescriptionProps>(\n \"p\",\n \"description\",\n)()\n"],"mappings":";;;;;;;;;;;;;AAoEA,MAAM,EACJ,kBACA,cAAc,sBACd,qBACA,iBAAiB,yBACjB,aACA,iBACEA,6CACF,YACAC,qCACD;;;;;;AASD,MAAa,eAAe,cACzB,EAAE,UAAU,QAAQ,IAAI,QAAQ,EAAE,EAAE,GAAG,WAAW;CACjD,MAAM,oCAAyB,EAAE,OAAO,GAAG,CAAC,MAAM,CAAC;CACnD,MAAM,4CAAiC;AACrC,MAA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B,OACA,YACD,CAAC,EAAE,kBAAkB,IAAI,CAAC;AAI3B,MAAM,eAAeD,uBAAO,OAAO,EACjC,MAAM;CACJ,IAAI;CACJ,aAAa;CACb,aAAa;CACb,SAAS;CACT,SAAS;CACV,EACF,CAAC;AAEF,MAAa,oBAAoB,YAC/B,OACA,YACD,CAAC,SAAY,EAAE,WAAW,2CAAC,iBAAe,EAAE,GAAG,YAAY;CAC1D;CACA,GAAG;CACJ,EAAE;AAIH,MAAa,kBAAkB,YAC7B,OACA,UACD,CAAC,EAAE,gBAAgB,IAAI,CAAC;AAIzB,MAAa,gBAAgB,YAC3B,MACA,QACD,EAAE;AAIH,MAAa,sBAAsB,YACjC,KACA,cACD,EAAE"}
1
+ {"version":3,"file":"timeline.cjs","names":["createSlotComponent","timelineStyle","useValue","rest","children","index","styled","varAttr"],"sources":["../../../../src/components/timeline/timeline.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactNode } from \"react\"\nimport type { CSSProps, HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { TimelineStyle } from \"./timeline.style\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, styled, varAttr } from \"../../core\"\nimport { useValue } from \"../../hooks/use-value\"\nimport { dataAttr, isUndefined } from \"../../utils\"\nimport { timelineStyle } from \"./timeline.style\"\n\nexport interface TimelineItem extends Omit<\n TimelineItemProps,\n \"content\" | \"title\"\n> {\n align?: \"end\" | \"start\"\n content?: ReactNode\n description?: ReactNode\n indicator?: ReactNode\n title?: ReactNode\n connectorProps?: TimelineConnectorProps\n contentProps?: TimelineContentProps\n descriptionProps?: TimelineDescriptionProps\n indicatorProps?: TimelineIndicatorProps\n titleProps?: TimelineTitleProps\n}\n\ninterface ComponentContext extends Pick<TimelineRootProps, \"index\"> {}\n\nexport interface TimelineRootProps\n extends HTMLStyledProps<\"ul\">, ThemeProps<TimelineStyle> {\n /**\n * The index of the active timeline item.\n */\n index?: number\n /**\n * The fill color of the indicator.\n */\n indicatorFill?: CSSProps[\"bg\"]\n /**\n * The size of the indicator.\n */\n indicatorSize?: CSSProps[\"boxSize\"]\n /**\n * The stroke color of the indicator.\n */\n indicatorStroke?: CSSProps[\"color\"]\n /**\n * If provided, generate timeline components based on items.\n */\n items?: TimelineItem[]\n /**\n * The color of the separator.\n */\n separatorColor?: CSSProps[\"color\"]\n /**\n * The gap of the separator.\n */\n separatorGap?: CSSProps[\"gap\"]\n /**\n * The style of the separator.\n */\n separatorStyle?: CSSProps[\"borderStyle\"]\n /**\n * The width of the separator.\n */\n separatorWidth?: CSSProps[\"width\"]\n}\n\nconst {\n ComponentContext,\n PropsContext: TimelinePropsContext,\n useComponentContext,\n usePropsContext: useTimelinePropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<TimelineRootProps, TimelineStyle, ComponentContext>(\n \"timeline\",\n timelineStyle,\n)\n\nexport { TimelinePropsContext, useTimelinePropsContext }\n\n/**\n * `Timeline` is a component that is used to display a list of events in chronological order.\n *\n * @see https://yamada-ui.com/docs/components/timeline\n */\nexport const TimelineRoot = withProvider(\n ({ variant: variantProp, children, index = -1, items = [], ...rest }) => {\n const context = useMemo(() => ({ index }), [index])\n const variant = useValue(variantProp)\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return items.map(\n (\n {\n align = \"start\",\n content,\n description,\n indicator,\n title,\n connectorProps,\n contentProps,\n descriptionProps,\n indicatorProps,\n titleProps,\n ...rest\n },\n index,\n ) => {\n const children = {\n connector: (\n <TimelineConnector {...connectorProps}>\n <TimelineIndicator {...indicatorProps}>\n {indicator ?? (variant === \"number\" ? index + 1 : undefined)}\n </TimelineIndicator>\n </TimelineConnector>\n ),\n content: (\n <TimelineContent {...contentProps}>\n {content ?? (\n <>\n <TimelineTitle {...titleProps}>{title}</TimelineTitle>\n <TimelineDescription {...descriptionProps}>\n {description}\n </TimelineDescription>\n </>\n )}\n </TimelineContent>\n ),\n }\n\n return (\n <TimelineItem key={index} index={index} {...rest}>\n {align === \"start\" ? children.connector : children.content}\n {align === \"start\" ? children.content : children.connector}\n </TimelineItem>\n )\n },\n )\n }, [children, items, variant])\n\n return (\n <ComponentContext value={context}>\n <styled.ul {...rest}>{computedChildren}</styled.ul>\n </ComponentContext>\n )\n },\n \"root\",\n { transferProps: [\"variant\"] },\n)(\n undefined,\n ({\n indicatorFill,\n indicatorSize,\n indicatorStroke,\n separatorColor,\n separatorGap,\n separatorStyle,\n separatorWidth,\n ...rest\n }) => ({\n \"--indicator-fill\": varAttr(indicatorFill, \"colors\"),\n \"--indicator-size\": varAttr(indicatorSize, \"sizes\"),\n \"--indicator-stroke\": varAttr(indicatorStroke, \"colors\"),\n \"--separator-color\": varAttr(separatorColor, \"colors\"),\n \"--separator-gap\": varAttr(separatorGap, \"spaces\"),\n \"--separator-style\": varAttr(separatorStyle),\n \"--separator-width\": varAttr(separatorWidth, \"sizes\"),\n ...rest,\n }),\n)\n\nexport interface TimelineItemProps extends HTMLStyledProps<\"li\"> {\n /**\n * The index of the timeline item.\n */\n index?: number\n}\n\nexport const TimelineItem = withContext<\"li\", TimelineItemProps>(\"li\", \"item\")(\n undefined,\n ({ index, ...rest }) => {\n const { index: currentIndex } = useComponentContext()\n const active =\n !isUndefined(index) && !isUndefined(currentIndex) && index <= currentIndex\n\n return {\n ...rest,\n \"data-active\": dataAttr(active),\n \"data-index\": index,\n }\n },\n)\n\nexport interface TimelineConnectorProps extends HTMLStyledProps {}\n\nexport const TimelineConnector = withContext<\"div\", TimelineConnectorProps>(\n \"div\",\n \"connector\",\n)({ \"data-connector\": \"\" })\n\nexport interface TimelineIndicatorProps extends HTMLStyledProps {}\n\nconst TimelineIcon = styled(\"div\", {\n base: {\n bg: \"{indicator-fill}\",\n borderColor: \"{indicator-stroke}\",\n borderWidth: \"{separator-width}\",\n boxSize: \"full\",\n rounded: \"{indicator-rounded}\",\n },\n})\n\nexport const TimelineIndicator = withContext<\"div\", TimelineIndicatorProps>(\n \"div\",\n \"indicator\",\n)(undefined, ({ children = <TimelineIcon />, ...rest }) => ({\n children,\n ...rest,\n}))\n\nexport interface TimelineContentProps extends HTMLStyledProps {}\n\nexport const TimelineContent = withContext<\"div\", TimelineContentProps>(\n \"div\",\n \"content\",\n)({ \"data-content\": \"\" })\n\nexport interface TimelineTitleProps extends HTMLStyledProps<\"h3\"> {}\n\nexport const TimelineTitle = withContext<\"h3\", TimelineTitleProps>(\n \"h3\",\n \"title\",\n)()\n\nexport interface TimelineDescriptionProps extends HTMLStyledProps<\"p\"> {}\n\nexport const TimelineDescription = withContext<\"p\", TimelineDescriptionProps>(\n \"p\",\n \"description\",\n)()\n"],"mappings":";;;;;;;;;;;;;;AAqEA,MAAM,EACJ,kBACA,cAAc,sBACd,qBACA,iBAAiB,yBACjB,aACA,iBACEA,6CACF,YACAC,qCACD;;;;;;AASD,MAAa,eAAe,cACzB,EAAE,SAAS,aAAa,UAAU,QAAQ,IAAI,QAAQ,EAAE,EAAE,GAAG,WAAW;CACvE,MAAM,oCAAyB,EAAE,OAAO,GAAG,CAAC,MAAM,CAAC;CACnD,MAAM,UAAUC,uCAAS,YAAY;CACrC,MAAM,4CAAiC;AACrC,MAAI,SAAU,QAAO;AAErB,SAAO,MAAM,KAET,EACE,QAAQ,SACR,SACA,aACA,WACA,OACA,gBACA,cACA,kBACA,gBACA,YACA,GAAGC,UAEL,YACG;GACH,MAAMC,aAAW;IACf,WACE,2CAAC;KAAkB,GAAI;eACrB,2CAAC;MAAkB,GAAI;gBACpB,cAAc,YAAY,WAAWC,UAAQ,IAAI;OAChC;MACF;IAEtB,SACE,2CAAC;KAAgB,GAAI;eAClB,WACC,qFACE,2CAAC;MAAc,GAAI;gBAAa;OAAsB,EACtD,2CAAC;MAAoB,GAAI;gBACtB;OACmB,IACrB;MAEW;IAErB;AAED,UACE,4CAAC;IAAyB,OAAOA;IAAO,GAAIF;eACzC,UAAU,UAAUC,WAAS,YAAYA,WAAS,SAClD,UAAU,UAAUA,WAAS,UAAUA,WAAS;MAFhCC,QAGJ;IAGpB;IACA;EAAC;EAAU;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ineStyle = require_config.defineComponentSlotStyle({
30
30
  boxSize: "{indicator-size}",
31
31
  color: "{indicator-stroke}",
32
32
  display: "flex",
33
- fontWeight: "medium",
34
33
  justifyContent: "center",
35
34
  lineHeight: "{indicator-size}",
36
35
  overflow: "hidden",
@@ -86,6 +85,10 @@ const timelineStyle = require_config.defineComponentSlotStyle({
86
85
  square: { item: { "--indicator-rounded": "radii.0" } }
87
86
  }
88
87
  },
88
+ variants: {
89
+ number: { indicator: { layerStyle: "solid" } },
90
+ plain: {}
91
+ },
89
92
  sizes: {
90
93
  base: { item: { _last: { "& [data-content]": { pb: 0 } } } },
91
94
  sm: {
@@ -94,6 +97,7 @@ const timelineStyle = require_config.defineComponentSlotStyle({
94
97
  pb: "8"
95
98
  },
96
99
  description: { fontSize: "xs" },
100
+ indicator: { fontSize: "xs" },
97
101
  item: { gap: "3" },
98
102
  root: {
99
103
  "--indicator-size": "sizes.3",
@@ -108,6 +112,7 @@ const timelineStyle = require_config.defineComponentSlotStyle({
108
112
  pb: "10"
109
113
  },
110
114
  description: { fontSize: "sm" },
115
+ indicator: { fontSize: "sm" },
111
116
  item: { gap: "4" },
112
117
  root: {
113
118
  "--indicator-size": "sizes.5",
@@ -122,6 +127,7 @@ const timelineStyle = require_config.defineComponentSlotStyle({
122
127
  pb: "10"
123
128
  },
124
129
  description: { fontSize: "sm" },
130
+ indicator: { fontSize: "md" },
125
131
  item: { gap: "4" },
126
132
  root: {
127
133
  "--indicator-size": "sizes.7",
@@ -136,6 +142,7 @@ const timelineStyle = require_config.defineComponentSlotStyle({
136
142
  pb: "12"
137
143
  },
138
144
  description: { fontSize: "md" },
145
+ indicator: { fontSize: "md" },
139
146
  item: { gap: "5" },
140
147
  root: {
141
148
  "--indicator-size": "sizes.8",
@@ -1 +1 @@
1
- {"version":3,"file":"timeline.style.cjs","names":["defineComponentSlotStyle"],"sources":["../../../../src/components/timeline/timeline.style.ts"],"sourcesContent":["import { defineComponentSlotStyle } from \"../../core\"\n\nexport const timelineStyle = defineComponentSlotStyle({\n base: {\n connector: {\n alignSelf: \"stretch\",\n position: \"relative\",\n transitionDuration: \"moderate\",\n transitionProperty: \"common\",\n _after: {\n borderInlineStart:\n \"{separator-width} {separator-style, solid} {separator-color}\",\n display: \"block\",\n h: \"full\",\n insetBlockStart: \"calc({indicator-size} + {separator-gap})\",\n insetInlineStart:\n \"calc(({indicator-size} / 2) - ({separator-width} / 2))\",\n maxH: `calc(full - {indicator-size} - ({separator-gap} * 2))`,\n position: \"absolute\",\n },\n },\n content: {\n display: \"flex\",\n flexDirection: \"column\",\n w: \"full\",\n },\n description: {\n color: \"fg.muted\",\n },\n indicator: {\n alignItems: \"center\",\n boxSize: \"{indicator-size}\",\n color: \"{indicator-stroke}\",\n display: \"flex\",\n fontWeight: \"medium\",\n justifyContent: \"center\",\n lineHeight: \"{indicator-size}\",\n overflow: \"hidden\",\n rounded: \"{indicator-rounded}\",\n },\n item: {\n alignItems: \"flex-start\",\n display: \"flex\",\n flexShrink: \"0\",\n _last: {\n \"& [data-connector]\": {\n _after: { display: \"none\" },\n },\n },\n },\n root: {\n \"--indicator-fill\": \"transparent\",\n \"--indicator-stroke\": \"colorScheme.solid\",\n \"--separator-color\": \"colors.border\",\n display: \"flex\",\n flexDirection: \"column\",\n w: \"full\",\n },\n title: {\n alignItems: \"center\",\n display: \"flex\",\n fontWeight: \"medium\",\n gap: \"1\",\n lineHeight: \"{indicator-size}\",\n },\n },\n\n props: {\n /**\n * The alignment of the timeline.\n *\n * @default 'start'\n */\n align: {\n center: {\n content: {\n \"&:first-of-type\": { alignItems: \"flex-end\" },\n flex: \"1\",\n },\n item: {\n \"&:has(> [data-content]:first-of-type)\": {\n \"&:not(:has(> [data-content]:last-of-type))\": {\n _after: { display: \"block\", flex: \"1\" },\n },\n },\n \"&:not(:has(> [data-content]:first-of-type))\": {\n _before: { display: \"block\", flex: \"1\" },\n },\n },\n },\n end: {\n content: { alignItems: \"flex-end\" },\n },\n start: {\n content: { alignItems: \"flex-start\" },\n },\n },\n /**\n * If `true`, the timeline will be attached.\n *\n * @default false\n */\n attached: {\n true: {\n item: {\n \"--separator-gap\": \"0px\",\n },\n },\n },\n /**\n * The shape of the timeline.\n *\n * @default 'circle'\n */\n shape: {\n circle: {\n item: { \"--indicator-rounded\": \"radii.full\" },\n },\n rounded: {\n item: { \"--indicator-rounded\": \"radii.l2\" },\n },\n square: {\n item: { \"--indicator-rounded\": \"radii.0\" },\n },\n },\n },\n\n sizes: {\n base: {\n item: {\n _last: {\n \"& [data-content]\": { pb: 0 },\n },\n },\n },\n sm: {\n content: { gap: \"1\", pb: \"8\" },\n description: { fontSize: \"xs\" },\n item: { gap: \"3\" },\n root: {\n \"--indicator-size\": \"sizes.3\",\n \"--separator-gap\": \"spaces.2\",\n \"--separator-width\": \"sizes.0.5\",\n },\n title: { fontSize: \"sm\" },\n },\n md: {\n content: { gap: \"2\", pb: \"10\" },\n description: { fontSize: \"sm\" },\n item: { gap: \"4\" },\n root: {\n \"--indicator-size\": \"sizes.5\",\n \"--separator-gap\": \"spaces.2\",\n \"--separator-width\": \"sizes.1\",\n },\n title: { fontSize: \"md\" },\n },\n lg: {\n content: { gap: \"2\", pb: \"10\" },\n description: { fontSize: \"sm\" },\n item: { gap: \"4\" },\n root: {\n \"--indicator-size\": \"sizes.7\",\n \"--separator-gap\": \"spaces.2.5\",\n \"--separator-width\": \"sizes.1\",\n },\n title: { fontSize: \"md\" },\n },\n xl: {\n content: { gap: \"2\", pb: \"12\" },\n description: { fontSize: \"md\" },\n item: { gap: \"5\" },\n root: {\n \"--indicator-size\": \"sizes.8\",\n \"--separator-gap\": \"spaces.3\",\n \"--separator-width\": \"sizes.1.5\",\n },\n title: { fontSize: \"lg\" },\n },\n },\n\n defaultProps: {\n size: \"md\",\n align: \"start\",\n shape: \"circle\",\n },\n})\n\nexport type TimelineStyle = typeof timelineStyle\n"],"mappings":";;;;AAEA,MAAa,gBAAgBA,wCAAyB;CACpD,MAAM;EACJ,WAAW;GACT,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,OAAO;EACL,MAAM,EACJ,MAAM,EACJ,OAAO,EACL,oBAAoB,EAAE,IAAI,GAAG,EAC9B,EACF,EACF;EACD,IAAI;GACF,SAAS;IAAE,KAAK;IAAK,IAAI;IAAK;GAC9B,aAAa,EAAE,UAAU,MAAM;GAC/B,MAAM,EAAE,KAAK,KAAK;GAClB,MAAM;IACJ,oBAAoB;IACpB,mBAAmB;IACnB,qBAAqB;IACtB;GACD,OAAO,EAAE,UAAU,MAAM;GAC1B;EACD,IAAI;GACF,SAAS;IAAE,KAAK;IAAK,IAAI;IAAM;GAC/B,aAAa,EAAE,UAAU,MAAM;GAC/B,MAAM,EAAE,KAAK,KAAK;GAClB,MAAM;IACJ,oBAAoB;IACpB,mBAAmB;IACnB,qBAAqB;IACtB;GACD,OAAO,EAAE,UAAU,MAAM;GAC1B;EACD,IAAI;GACF,SAAS;IAAE,KAAK;IAAK,IAAI;IAAM;GAC/B,aAAa,EAAE,UAAU,MAAM;GAC/B,MAAM,EAAE,KAAK,KAAK;GAClB,MAAM;IACJ,oBAAoB;IACpB,mBAAmB;IACnB,qBAAqB;IACtB;GACD,OAAO,EAAE,UAAU,MAAM;GAC1B;EACD,IAAI;GACF,SAAS;IAAE,KAAK;IAAK,IAAI;IAAM;GAC/B,aAAa,EAAE,UAAU,MAAM;GAC/B,MAAM,EAAE,KAAK,KAAK;GAClB,MAAM;IACJ,oBAAoB;IACpB,mBAAmB;IACnB,qBAAqB;IACtB;GACD,OAAO,EAAE,UAAU,MAAM;GAC1B;EACF;CAED,cAAc;EACZ,MAAM;EACN,OAAO;EACP,OAAO;EACR;CACF,CAAC"}
1
+ {"version":3,"file":"timeline.style.cjs","names":["defineComponentSlotStyle"],"sources":["../../../../src/components/timeline/timeline.style.ts"],"sourcesContent":["import { defineComponentSlotStyle } from \"../../core\"\n\nexport const timelineStyle = defineComponentSlotStyle({\n base: {\n connector: {\n alignSelf: \"stretch\",\n position: \"relative\",\n transitionDuration: \"moderate\",\n transitionProperty: \"common\",\n _after: {\n borderInlineStart:\n \"{separator-width} {separator-style, solid} {separator-color}\",\n display: \"block\",\n h: \"full\",\n insetBlockStart: \"calc({indicator-size} + {separator-gap})\",\n insetInlineStart:\n \"calc(({indicator-size} / 2) - ({separator-width} / 2))\",\n maxH: `calc(full - {indicator-size} - ({separator-gap} * 2))`,\n position: \"absolute\",\n },\n },\n content: {\n display: \"flex\",\n flexDirection: \"column\",\n w: \"full\",\n },\n description: {\n color: \"fg.muted\",\n },\n indicator: {\n alignItems: \"center\",\n boxSize: \"{indicator-size}\",\n color: \"{indicator-stroke}\",\n display: \"flex\",\n justifyContent: \"center\",\n lineHeight: \"{indicator-size}\",\n overflow: \"hidden\",\n rounded: \"{indicator-rounded}\",\n },\n item: {\n alignItems: \"flex-start\",\n display: \"flex\",\n flexShrink: \"0\",\n _last: {\n \"& [data-connector]\": {\n _after: { display: \"none\" },\n },\n },\n },\n root: {\n \"--indicator-fill\": \"transparent\",\n \"--indicator-stroke\": \"colorScheme.solid\",\n \"--separator-color\": \"colors.border\",\n display: \"flex\",\n flexDirection: \"column\",\n w: \"full\",\n },\n title: {\n alignItems: \"center\",\n display: \"flex\",\n fontWeight: \"medium\",\n gap: \"1\",\n lineHeight: \"{indicator-size}\",\n },\n },\n\n props: {\n /**\n * The alignment of the timeline.\n *\n * @default 'start'\n */\n align: {\n center: {\n content: {\n \"&:first-of-type\": { alignItems: \"flex-end\" },\n flex: \"1\",\n },\n item: {\n \"&:has(> [data-content]:first-of-type)\": {\n \"&:not(:has(> [data-content]:last-of-type))\": {\n _after: { display: \"block\", flex: \"1\" },\n },\n },\n \"&:not(:has(> [data-content]:first-of-type))\": {\n _before: { display: \"block\", flex: \"1\" },\n },\n },\n },\n end: {\n content: { alignItems: \"flex-end\" },\n },\n start: {\n content: { alignItems: \"flex-start\" },\n },\n },\n /**\n * If `true`, the timeline will be attached.\n *\n * @default false\n */\n attached: {\n true: {\n item: {\n \"--separator-gap\": \"0px\",\n },\n },\n },\n /**\n * The shape of the timeline.\n *\n * @default 'circle'\n */\n shape: {\n circle: {\n item: { \"--indicator-rounded\": \"radii.full\" },\n },\n rounded: {\n item: { \"--indicator-rounded\": \"radii.l2\" },\n },\n square: {\n item: { \"--indicator-rounded\": \"radii.0\" },\n },\n },\n },\n\n variants: {\n number: { indicator: { layerStyle: \"solid\" } },\n plain: {},\n },\n\n sizes: {\n base: {\n item: {\n _last: {\n \"& [data-content]\": { pb: 0 },\n },\n },\n },\n sm: {\n content: { gap: \"1\", pb: \"8\" },\n description: { fontSize: \"xs\" },\n indicator: { fontSize: \"xs\" },\n item: { gap: \"3\" },\n root: {\n \"--indicator-size\": \"sizes.3\",\n \"--separator-gap\": \"spaces.2\",\n \"--separator-width\": \"sizes.0.5\",\n },\n title: { fontSize: \"sm\" },\n },\n md: {\n content: { gap: \"2\", pb: \"10\" },\n description: { fontSize: \"sm\" },\n indicator: { fontSize: \"sm\" },\n item: { gap: \"4\" },\n root: {\n \"--indicator-size\": \"sizes.5\",\n \"--separator-gap\": \"spaces.2\",\n \"--separator-width\": \"sizes.1\",\n },\n title: { fontSize: \"md\" },\n },\n lg: {\n content: { gap: \"2\", pb: \"10\" },\n description: { fontSize: \"sm\" },\n indicator: { fontSize: \"md\" },\n item: { gap: \"4\" },\n root: {\n \"--indicator-size\": \"sizes.7\",\n \"--separator-gap\": \"spaces.2.5\",\n \"--separator-width\": \"sizes.1\",\n },\n title: { fontSize: \"md\" },\n },\n xl: {\n content: { gap: \"2\", pb: \"12\" },\n description: { fontSize: \"md\" },\n indicator: { fontSize: \"md\" },\n item: { gap: \"5\" },\n root: {\n \"--indicator-size\": \"sizes.8\",\n \"--separator-gap\": \"spaces.3\",\n \"--separator-width\": \"sizes.1.5\",\n },\n title: { fontSize: \"lg\" },\n },\n },\n\n defaultProps: {\n size: \"md\",\n align: \"start\",\n shape: \"circle\",\n },\n})\n\nexport type TimelineStyle = typeof timelineStyle\n"],"mappings":";;;;AAEA,MAAa,gBAAgBA,wCAAyB;CACpD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