@yamada-ui/react 2.3.0-next-20260517014349 → 2.3.0-next-20260517154550

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 (49) hide show
  1. package/dist/cjs/components/sidebar/use-sidebar.cjs +13 -19
  2. package/dist/cjs/components/sidebar/use-sidebar.cjs.map +1 -1
  3. package/dist/cjs/components/steps/use-steps.cjs +4 -6
  4. package/dist/cjs/components/steps/use-steps.cjs.map +1 -1
  5. package/dist/esm/components/sidebar/use-sidebar.js +13 -19
  6. package/dist/esm/components/sidebar/use-sidebar.js.map +1 -1
  7. package/dist/esm/components/steps/use-steps.js +4 -6
  8. package/dist/esm/components/steps/use-steps.js.map +1 -1
  9. package/dist/types/components/accordion/accordion.style.d.ts +1 -1
  10. package/dist/types/components/alert/alert.style.d.ts +1 -1
  11. package/dist/types/components/autocomplete/autocomplete.style.d.ts +1 -1
  12. package/dist/types/components/breadcrumb/breadcrumb.style.d.ts +1 -1
  13. package/dist/types/components/carousel/carousel.style.d.ts +2 -2
  14. package/dist/types/components/checkbox-card/checkbox-card.d.ts +3 -3
  15. package/dist/types/components/checkbox-card/checkbox-card.style.d.ts +1 -1
  16. package/dist/types/components/color-picker/color-picker.style.d.ts +1 -1
  17. package/dist/types/components/color-selector/color-selector.style.d.ts +2 -2
  18. package/dist/types/components/data-list/data-list.style.d.ts +1 -1
  19. package/dist/types/components/date-picker/date-picker.style.d.ts +1 -1
  20. package/dist/types/components/dropzone/dropzone.d.ts +1 -1
  21. package/dist/types/components/dropzone/dropzone.style.d.ts +1 -1
  22. package/dist/types/components/empty-state/empty-state.style.d.ts +2 -2
  23. package/dist/types/components/flip/flip.d.ts +1 -1
  24. package/dist/types/components/flip/flip.style.d.ts +1 -1
  25. package/dist/types/components/form/form.style.d.ts +1 -1
  26. package/dist/types/components/list/list.style.d.ts +2 -2
  27. package/dist/types/components/menu/menu.style.d.ts +2 -2
  28. package/dist/types/components/native-accordion/native-accordion.style.d.ts +2 -2
  29. package/dist/types/components/native-select/native-select.style.d.ts +1 -1
  30. package/dist/types/components/notice/notice.style.d.ts +1 -1
  31. package/dist/types/components/number-input/number-input.style.d.ts +1 -1
  32. package/dist/types/components/pagination/pagination.style.d.ts +1 -1
  33. package/dist/types/components/password-input/password-input.style.d.ts +1 -1
  34. package/dist/types/components/pin-input/pin-input.style.d.ts +1 -1
  35. package/dist/types/components/radio-card/radio-card.d.ts +3 -3
  36. package/dist/types/components/radio-card/radio-card.style.d.ts +1 -1
  37. package/dist/types/components/rating/rating.style.d.ts +2 -2
  38. package/dist/types/components/reorder/reorder.style.d.ts +1 -1
  39. package/dist/types/components/resizable/resizable.style.d.ts +2 -2
  40. package/dist/types/components/segmented-control/segmented-control.style.d.ts +2 -2
  41. package/dist/types/components/select/select.style.d.ts +1 -1
  42. package/dist/types/components/steps/steps.style.d.ts +1 -1
  43. package/dist/types/components/steps/use-steps.d.ts +0 -1
  44. package/dist/types/components/tag/tag.style.d.ts +1 -1
  45. package/dist/types/components/timeline/timeline.d.ts +1 -1
  46. package/dist/types/components/timeline/timeline.style.d.ts +1 -1
  47. package/dist/types/components/tree/tree.style.d.ts +1 -1
  48. package/dist/types/providers/i18n-provider/i18n-provider.d.ts +1 -1
  49. package/package.json +1 -1
@@ -218,20 +218,15 @@ const useSidebarItem = ({ asyncChildren, children: childrenProp, defaultOpen, di
218
218
  } else onOpen();
219
219
  else onClose();
220
220
  }, [defaultExpanded]);
221
- const getItemProps = (0, react.useCallback)(({ ref, "aria-labelledby": ariaLabelledby, ...props } = {}) => {
222
- const merged = require_props.mergeProps({
223
- id: itemId,
224
- "aria-current": selected ? "page" : void 0,
225
- "aria-disabled": (0, require_utils_index.utils_exports.ariaAttr)(disabled),
226
- "aria-labelledby": (0, require_utils_index.utils_exports.cx)(ariaLabelledby, labelId),
227
- "data-disabled": (0, require_utils_index.utils_exports.dataAttr)(disabled),
228
- "data-selected": (0, require_utils_index.utils_exports.dataAttr)(selected)
229
- }, rest, props, { ref }, { ref: register })();
230
- return {
231
- ...merged,
232
- onClick: (0, require_utils_index.utils_exports.handlerAll)(merged.onClick, !group ? () => onSelectedChange(value) : void 0)
233
- };
234
- }, [
221
+ const getItemProps = (0, react.useCallback)((props = {}) => require_props.mergeProps({
222
+ id: itemId,
223
+ ref: register,
224
+ "aria-current": selected ? "page" : void 0,
225
+ "aria-disabled": (0, require_utils_index.utils_exports.ariaAttr)(disabled),
226
+ "aria-labelledby": labelId,
227
+ "data-disabled": (0, require_utils_index.utils_exports.dataAttr)(disabled),
228
+ "data-selected": (0, require_utils_index.utils_exports.dataAttr)(selected)
229
+ }, rest, props, { onClick: !group ? () => onSelectedChange(value) : void 0 })(), [
235
230
  itemId,
236
231
  register,
237
232
  selected,
@@ -310,13 +305,12 @@ const useSidebarItem = ({ asyncChildren, children: childrenProp, defaultOpen, di
310
305
  selected,
311
306
  selectedValue,
312
307
  value,
313
- getContentProps: (0, react.useCallback)(({ "aria-labelledby": ariaLabelledby, ...props } = {}) => ({
308
+ getContentProps: (0, react.useCallback)((props = {}) => require_props.mergeProps({
314
309
  id: contentId,
315
310
  "aria-busy": (0, require_utils_index.utils_exports.ariaAttr)(groupLoading),
316
- "aria-labelledby": (0, require_utils_index.utils_exports.cx)(ariaLabelledby, labelId),
317
- "data-disabled": (0, require_utils_index.utils_exports.dataAttr)(disabled),
318
- ...props
319
- }), [
311
+ "aria-labelledby": labelId,
312
+ "data-disabled": (0, require_utils_index.utils_exports.dataAttr)(disabled)
313
+ }, props)(), [
320
314
  contentId,
321
315
  labelId,
322
316
  disabled,
@@ -1 +1 @@
1
- {"version":3,"file":"use-sidebar.cjs","names":["createDescendants","createContext","useI18n","useDisclosure","useControllableState","mergeProps","useEnvironment","mergeRefs","useIds","Children","useAsyncCallback"],"sources":["../../../../src/components/sidebar/use-sidebar.ts"],"sourcesContent":["\"use client\"\n\nimport type { ReactNode, RefObject } from \"react\"\nimport { Children, useCallback, useId, useRef, useState } from \"react\"\nimport {\n type HTMLProps,\n mergeProps,\n type PropGetter,\n useEnvironment,\n} from \"../../core\"\nimport { useAsyncCallback } from \"../../hooks/use-async-callback\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { createDescendants } from \"../../hooks/use-descendants\"\nimport {\n useDisclosure,\n type UseDisclosureProps,\n} from \"../../hooks/use-disclosure\"\nimport { useWindowEvent } from \"../../hooks/use-window-event\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport {\n ariaAttr,\n assignRef,\n createContext,\n cx,\n dataAttr,\n handlerAll,\n mergeRefs,\n setAttribute,\n useIds,\n useSafeLayoutEffect,\n} from \"../../utils\"\n\nexport interface SidebarControl {\n collapse: () => void\n expand: () => void\n}\n\ninterface SidebarDescendantProps {\n expanded: boolean\n group: boolean\n id: string\n value: string\n}\n\nconst {\n DescendantsContext: SidebarDescendantsContext,\n useDescendant: useSidebarDescendant,\n useDescendants: useSidebarDescendants,\n} = createDescendants<HTMLElement, SidebarDescendantProps>()\n\nexport {\n SidebarDescendantsContext,\n useSidebarDescendant,\n useSidebarDescendants,\n}\n\ninterface SidebarContext extends Pick<\n UseSidebarReturn,\n | \"expandedValue\"\n | \"mobile\"\n | \"onClose\"\n | \"onExpandedChange\"\n | \"onOpen\"\n | \"onSelectedChange\"\n | \"onToggle\"\n | \"open\"\n | \"selectedValue\"\n> {}\n\nconst [SidebarContext, useSidebarContext] = createContext<SidebarContext>({\n name: \"SidebarContext\",\n})\n\nexport { SidebarContext, useSidebarContext }\n\ninterface SidebarItemContext extends Pick<\n UseSidebarItemReturn,\n \"branchOpen\" | \"groupOpen\"\n> {}\n\nconst [SidebarItemContext, useSidebarItemContext] =\n createContext<SidebarItemContext>({\n name: \"SidebarItemContext\",\n strict: false,\n })\n\nexport { SidebarItemContext, useSidebarItemContext }\n\nexport interface UseSidebarProps extends HTMLProps<\"div\"> {\n /**\n * Ref of the sidebar callbacks.\n */\n controlRef?: RefObject<null | SidebarControl>\n /**\n * The initial expanded value of the sidebar.\n */\n defaultExpandedValue?: string[]\n /**\n * The initial selected value of the sidebar.\n */\n defaultSelectedValue?: string\n /**\n * The disclosure props for the desktop and mobile.\n */\n disclosure?: {\n desktop?: Omit<UseDisclosureProps, \"timing\">\n mobile?: Omit<UseDisclosureProps, \"timing\">\n }\n /**\n * The expanded value of the sidebar.\n */\n expandedValue?: string[]\n /**\n * If `true`, the trigger click event will be switched to mobile.\n *\n * @default false\n */\n mobile?: boolean\n /**\n * The selected value of the sidebar.\n */\n selectedValue?: string\n /**\n * The callback invoked when expanded value changes.\n */\n onExpandedChange?: (value: string[]) => void\n /**\n * The callback invoked when selected value changes.\n */\n onSelectedChange?: (value: string) => void\n}\n\nexport const useSidebar = ({\n controlRef,\n defaultExpandedValue = [],\n defaultSelectedValue,\n disclosure,\n expandedValue: expandedValueProp,\n mobile = false,\n selectedValue: selectedValueProp,\n onExpandedChange: onExpandedChangeProp,\n onSelectedChange: onSelectedChangeProp,\n ...rest\n}: UseSidebarProps = {}) => {\n const { t } = useI18n(\"sidebar\")\n const desktopDisclosure = useDisclosure({\n defaultOpen: disclosure?.desktop?.defaultOpen ?? true,\n open: disclosure?.desktop?.open,\n onClose: disclosure?.desktop?.onClose,\n onOpen: disclosure?.desktop?.onOpen,\n })\n const mobileDisclosure = useDisclosure({\n defaultOpen: disclosure?.mobile?.defaultOpen ?? false,\n open: disclosure?.mobile?.open,\n onClose: disclosure?.mobile?.onClose,\n onOpen: disclosure?.mobile?.onOpen,\n })\n const [selectedValue, setSelectedValue] = useControllableState({\n defaultValue: defaultSelectedValue,\n value: selectedValueProp,\n onChange: onSelectedChangeProp,\n })\n const [expandedValue, setExpandedValue] = useControllableState({\n defaultValue: defaultExpandedValue,\n value: expandedValueProp,\n onChange: onExpandedChangeProp,\n })\n const descendants = useSidebarDescendants()\n const open = mobile ? mobileDisclosure.open : desktopDisclosure.open\n const onOpen = mobile ? mobileDisclosure.onOpen : desktopDisclosure.onOpen\n const onClose = mobile ? mobileDisclosure.onClose : desktopDisclosure.onClose\n const onToggle = mobile\n ? mobileDisclosure.onToggle\n : desktopDisclosure.onToggle\n\n const onSelectedChange = useCallback(\n (value: string) => {\n setSelectedValue(value)\n },\n [setSelectedValue],\n )\n\n const onExpandAll = useCallback(() => {\n const values = descendants.enabledValues()\n const group = values.filter(({ group }) => group)\n const value = group.map(({ value }) => value)\n\n setExpandedValue(value)\n }, [descendants, setExpandedValue])\n\n const onCollapseAll = useCallback(() => {\n setExpandedValue([])\n }, [setExpandedValue])\n\n const onExpandedChange = useCallback(\n (value: string) => {\n setExpandedValue((prev) => {\n if (prev.includes(value)) {\n return prev.filter((prevValue) => prevValue !== value)\n } else {\n return [...prev, value]\n }\n })\n },\n [setExpandedValue],\n )\n\n assignRef(controlRef, { collapse: onCollapseAll, expand: onExpandAll })\n\n useWindowEvent(\"keydown\", (ev) => {\n if (ev.key !== \"b\") return\n if (!ev.metaKey && !ev.ctrlKey) return\n\n ev.preventDefault()\n\n desktopDisclosure.onToggle()\n })\n\n const getRootProps: PropGetter<\"div\"> = useCallback(\n (props = {}) =>\n mergeProps({ \"data-expanded\": dataAttr(open) }, rest, props)(),\n [open, rest],\n )\n\n const getTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n \"aria-expanded\": open,\n \"aria-label\": t(open ? \"Close sidebar\" : \"Open sidebar\"),\n ...props,\n onClick: handlerAll(props.onClick, onToggle),\n }),\n [open, t, onToggle],\n )\n\n const getSidePanelProps: PropGetter<\"aside\"> = useCallback(\n (props = {}) => ({ \"data-expanded\": dataAttr(open), ...props }),\n [open],\n )\n\n const getHeaderProps: PropGetter<\"header\"> = useCallback(\n (props = {}) => ({ ...props }),\n [],\n )\n\n const getFooterProps: PropGetter<\"footer\"> = useCallback(\n (props = {}) => ({ ...props }),\n [],\n )\n\n const getContentProps: PropGetter<\"ul\"> = useCallback(\n (props = {}) => ({ ...props }),\n [],\n )\n\n return {\n descendants,\n expandedValue,\n mobile,\n open,\n selectedValue,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getRootProps,\n getSidePanelProps,\n getTriggerProps,\n onClose,\n onExpandedChange,\n onOpen,\n onSelectedChange,\n onToggle,\n }\n}\n\nexport type UseSidebarReturn = ReturnType<typeof useSidebar>\n\nexport interface UseSidebarGroupProps extends HTMLProps<\"li\"> {}\n\nexport const useSidebarGroup = ({ ...rest }: UseSidebarGroupProps = {}) => {\n const { getDocument } = useEnvironment()\n const rootRef = useRef<HTMLLIElement>(null)\n const contentRef = useRef<HTMLDivElement>(null)\n const labelId = useId()\n\n useSafeLayoutEffect(() => {\n const el = getDocument()?.getElementById(labelId)\n\n if (!el) return\n\n if (rootRef.current)\n setAttribute(rootRef.current, \"aria-labelledby\", labelId)\n if (contentRef.current)\n setAttribute(contentRef.current, \"aria-labelledby\", labelId)\n }, [])\n\n const getRootProps: PropGetter<\"li\"> = useCallback(\n ({ ref, ...props } = {}) =>\n mergeProps({ ref }, rest, props, { ref: rootRef })(),\n [rest, rootRef],\n )\n\n const getLabelProps: PropGetter<\"span\"> = useCallback(\n (props = {}) => ({ id: labelId, ...props }),\n [labelId],\n )\n\n const getContentProps: PropGetter<\"div\"> = useCallback(\n ({ ref, ...props } = {}) => ({\n ref: mergeRefs(ref, contentRef),\n ...props,\n }),\n [],\n )\n\n return { getContentProps, getLabelProps, getRootProps }\n}\n\nexport type UseSidebarGroupReturn = ReturnType<typeof useSidebarGroup>\n\nexport interface UseSidebarItemProps\n extends HTMLProps<\"li\">, Omit<UseDisclosureProps, \"timing\"> {\n /**\n * The value of the item.\n */\n value: string\n /**\n * If `true`, the tree item will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * If `true`, the link will open in new tab.\n *\n * @default false\n */\n external?: boolean\n /**\n * If provided, the sidebar item will be rendered as an async sidebar item.\n */\n asyncChildren?: () => Promise<ReactNode>\n}\n\nexport const useSidebarItem = ({\n asyncChildren,\n children: childrenProp,\n defaultOpen,\n disabled = false,\n external,\n open: openProp,\n value,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n ...rest\n}: UseSidebarItemProps) => {\n const context = useSidebarItemContext()\n const {\n expandedValue,\n open,\n selectedValue,\n onExpandedChange,\n onSelectedChange,\n } = useSidebarContext()\n const [children, setChildren] = useState<ReactNode>(childrenProp)\n const [itemId, labelId, contentId] = useIds()\n const initialAsyncRef = useRef(false)\n const async = !!asyncChildren\n const group = async || Children.count(children) > 0\n const nested = !!context\n const selected = !!value && selectedValue === value\n const defaultExpanded = !!value && expandedValue.includes(value)\n const {\n open: groupOpen,\n onClose,\n onOpen,\n } = useDisclosure({\n defaultOpen: defaultOpen ?? defaultExpanded,\n open: openProp,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n })\n const branchOpen: boolean[] = nested\n ? [...context.branchOpen, groupOpen]\n : [groupOpen]\n const expanded = branchOpen.slice(0, -1).every(Boolean)\n const { register } = useSidebarDescendant({\n id: itemId!,\n disabled,\n expanded,\n group,\n value,\n })\n\n const [groupLoading, onGroupChildren] = useAsyncCallback(async () => {\n const children = await asyncChildren?.()\n\n setChildren(children)\n }, [asyncChildren])\n\n const onGroupOpen = useCallback(() => {\n if (disabled || !group || !value || groupLoading) return\n\n if (async && !initialAsyncRef.current) {\n initialAsyncRef.current = true\n\n onGroupChildren()\n .then(() => {\n onOpen()\n onExpandedChange(value)\n })\n .catch(() => {\n initialAsyncRef.current = false\n })\n } else {\n onOpen()\n onExpandedChange(value)\n }\n }, [\n disabled,\n group,\n value,\n groupLoading,\n async,\n onGroupChildren,\n onOpen,\n onExpandedChange,\n ])\n\n const onGroupClose = useCallback(() => {\n if (disabled || !group || !value) return\n\n onClose()\n onExpandedChange(value)\n }, [disabled, group, value, onClose, onExpandedChange])\n\n const onGroupToggle = useCallback(() => {\n if (groupOpen) {\n onGroupClose()\n } else {\n onGroupOpen()\n }\n }, [groupOpen, onGroupClose, onGroupOpen])\n\n useSafeLayoutEffect(() => {\n if (defaultExpanded) {\n if (async && !initialAsyncRef.current) {\n initialAsyncRef.current = true\n\n onGroupChildren()\n .then(() => {\n onOpen()\n })\n .catch(() => {\n initialAsyncRef.current = false\n })\n } else {\n onOpen()\n }\n } else {\n onClose()\n }\n }, [defaultExpanded])\n\n const getItemProps: PropGetter<\"li\"> = useCallback(\n ({ ref, \"aria-labelledby\": ariaLabelledby, ...props } = {}) => {\n const merged = mergeProps(\n {\n id: itemId,\n \"aria-current\": selected ? \"page\" : undefined,\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-labelledby\": cx(ariaLabelledby, labelId),\n \"data-disabled\": dataAttr(disabled),\n \"data-selected\": dataAttr(selected),\n },\n rest,\n props,\n { ref },\n { ref: register },\n )()\n\n return {\n ...merged,\n onClick: handlerAll(\n merged.onClick,\n !group ? () => onSelectedChange(value) : undefined,\n ),\n }\n },\n [\n itemId,\n register,\n selected,\n disabled,\n labelId,\n rest,\n group,\n onSelectedChange,\n value,\n ],\n )\n\n const getIndicatorProps: PropGetter<\"svg\"> = useCallback(\n (props) => ({\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-expanded\": groupOpen,\n \"aria-hidden\": true,\n \"data-disabled\": dataAttr(disabled),\n \"data-loading\": dataAttr(groupLoading),\n \"data-selected\": dataAttr(selected),\n role: \"presentation\",\n ...props,\n }),\n [disabled, groupOpen, groupLoading, selected],\n )\n\n const getTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n \"aria-controls\": contentId,\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-expanded\": groupOpen,\n \"data-disabled\": dataAttr(disabled),\n \"data-expanded\": dataAttr(groupOpen),\n \"data-selected\": dataAttr(selected),\n tabIndex: open && expanded && !disabled ? 0 : -1,\n ...props,\n onClick: handlerAll(props.onClick, onGroupToggle),\n }),\n [contentId, disabled, groupOpen, selected, open, expanded, onGroupToggle],\n )\n\n const getLinkProps: PropGetter<\"a\"> = useCallback(\n (props = {}) => ({\n href: value,\n rel: external ? \"noopener\" : undefined,\n target: external ? \"_blank\" : undefined,\n \"data-disabled\": dataAttr(disabled),\n \"data-selected\": dataAttr(selected),\n tabIndex: open && expanded && !disabled ? 0 : -1,\n ...props,\n onClick: handlerAll(props.onClick, (ev) => {\n if (!disabled) return\n\n ev.preventDefault()\n ev.stopPropagation()\n }),\n }),\n [disabled, expanded, external, open, selected, value],\n )\n\n const getContentProps: PropGetter<\"ul\"> = useCallback(\n ({ \"aria-labelledby\": ariaLabelledby, ...props } = {}) => ({\n id: contentId,\n \"aria-busy\": ariaAttr(groupLoading),\n \"aria-labelledby\": cx(ariaLabelledby, labelId),\n \"data-disabled\": dataAttr(disabled),\n ...props,\n }),\n [contentId, labelId, disabled, groupLoading],\n )\n\n const getLabelProps: PropGetter<\"span\"> = useCallback(\n (props = {}) => ({ id: labelId, ...props }),\n [labelId],\n )\n\n return {\n branchOpen,\n children,\n disabled,\n expanded,\n expandedValue,\n group,\n groupLoading,\n groupOpen,\n open,\n selected,\n selectedValue,\n value,\n getContentProps,\n getIndicatorProps,\n getItemProps,\n getLabelProps,\n getLinkProps,\n getTriggerProps,\n onExpandedChange,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n onSelectedChange,\n }\n}\n\nexport type UseSidebarItemReturn = ReturnType<typeof useSidebarItem>\n"],"mappings":";;;;;;;;;;;;;;;;;AA4CA,MAAM,EACJ,oBAAoB,2BACpB,eAAe,sBACf,gBAAgB,0BACdA,oCAAAA,mBAAwD;AAqB5D,MAAM,CAAC,gBAAgB,qBAAqBC,gBAAAA,cAA8B,EACxE,MAAM,kBACP,CAAC;AASF,MAAM,CAAC,oBAAoB,yBACzBA,gBAAAA,cAAkC;CAChC,MAAM;CACN,QAAQ;CACT,CAAC;AAgDJ,MAAa,cAAc,EACzB,YACA,uBAAuB,EAAE,EACzB,sBACA,YACA,eAAe,mBACf,SAAS,OACT,eAAe,mBACf,kBAAkB,sBAClB,kBAAkB,sBAClB,GAAG,SACgB,EAAE,KAAK;CAC1B,MAAM,EAAE,MAAMC,sBAAAA,QAAQ,UAAU;CAChC,MAAM,oBAAoB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AA,cApBC,QAAQ,EAAE,MAAM;GAAE,IAAI;GAAS,GAAG;GAAO,GAC1C,CAAC,QAAQ,CAmBI;EACb;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
1
+ {"version":3,"file":"use-sidebar.cjs","names":["createDescendants","createContext","useI18n","useDisclosure","useControllableState","mergeProps","useEnvironment","mergeRefs","useIds","Children","useAsyncCallback"],"sources":["../../../../src/components/sidebar/use-sidebar.ts"],"sourcesContent":["\"use client\"\n\nimport type { ReactNode, RefObject } from \"react\"\nimport { Children, useCallback, useId, useRef, useState } from \"react\"\nimport {\n type HTMLProps,\n mergeProps,\n type PropGetter,\n useEnvironment,\n} from \"../../core\"\nimport { useAsyncCallback } from \"../../hooks/use-async-callback\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { createDescendants } from \"../../hooks/use-descendants\"\nimport {\n useDisclosure,\n type UseDisclosureProps,\n} from \"../../hooks/use-disclosure\"\nimport { useWindowEvent } from \"../../hooks/use-window-event\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport {\n ariaAttr,\n assignRef,\n createContext,\n dataAttr,\n handlerAll,\n mergeRefs,\n setAttribute,\n useIds,\n useSafeLayoutEffect,\n} from \"../../utils\"\n\nexport interface SidebarControl {\n collapse: () => void\n expand: () => void\n}\n\ninterface SidebarDescendantProps {\n expanded: boolean\n group: boolean\n id: string\n value: string\n}\n\nconst {\n DescendantsContext: SidebarDescendantsContext,\n useDescendant: useSidebarDescendant,\n useDescendants: useSidebarDescendants,\n} = createDescendants<HTMLElement, SidebarDescendantProps>()\n\nexport {\n SidebarDescendantsContext,\n useSidebarDescendant,\n useSidebarDescendants,\n}\n\ninterface SidebarContext extends Pick<\n UseSidebarReturn,\n | \"expandedValue\"\n | \"mobile\"\n | \"onClose\"\n | \"onExpandedChange\"\n | \"onOpen\"\n | \"onSelectedChange\"\n | \"onToggle\"\n | \"open\"\n | \"selectedValue\"\n> {}\n\nconst [SidebarContext, useSidebarContext] = createContext<SidebarContext>({\n name: \"SidebarContext\",\n})\n\nexport { SidebarContext, useSidebarContext }\n\ninterface SidebarItemContext extends Pick<\n UseSidebarItemReturn,\n \"branchOpen\" | \"groupOpen\"\n> {}\n\nconst [SidebarItemContext, useSidebarItemContext] =\n createContext<SidebarItemContext>({\n name: \"SidebarItemContext\",\n strict: false,\n })\n\nexport { SidebarItemContext, useSidebarItemContext }\n\nexport interface UseSidebarProps extends HTMLProps<\"div\"> {\n /**\n * Ref of the sidebar callbacks.\n */\n controlRef?: RefObject<null | SidebarControl>\n /**\n * The initial expanded value of the sidebar.\n */\n defaultExpandedValue?: string[]\n /**\n * The initial selected value of the sidebar.\n */\n defaultSelectedValue?: string\n /**\n * The disclosure props for the desktop and mobile.\n */\n disclosure?: {\n desktop?: Omit<UseDisclosureProps, \"timing\">\n mobile?: Omit<UseDisclosureProps, \"timing\">\n }\n /**\n * The expanded value of the sidebar.\n */\n expandedValue?: string[]\n /**\n * If `true`, the trigger click event will be switched to mobile.\n *\n * @default false\n */\n mobile?: boolean\n /**\n * The selected value of the sidebar.\n */\n selectedValue?: string\n /**\n * The callback invoked when expanded value changes.\n */\n onExpandedChange?: (value: string[]) => void\n /**\n * The callback invoked when selected value changes.\n */\n onSelectedChange?: (value: string) => void\n}\n\nexport const useSidebar = ({\n controlRef,\n defaultExpandedValue = [],\n defaultSelectedValue,\n disclosure,\n expandedValue: expandedValueProp,\n mobile = false,\n selectedValue: selectedValueProp,\n onExpandedChange: onExpandedChangeProp,\n onSelectedChange: onSelectedChangeProp,\n ...rest\n}: UseSidebarProps = {}) => {\n const { t } = useI18n(\"sidebar\")\n const desktopDisclosure = useDisclosure({\n defaultOpen: disclosure?.desktop?.defaultOpen ?? true,\n open: disclosure?.desktop?.open,\n onClose: disclosure?.desktop?.onClose,\n onOpen: disclosure?.desktop?.onOpen,\n })\n const mobileDisclosure = useDisclosure({\n defaultOpen: disclosure?.mobile?.defaultOpen ?? false,\n open: disclosure?.mobile?.open,\n onClose: disclosure?.mobile?.onClose,\n onOpen: disclosure?.mobile?.onOpen,\n })\n const [selectedValue, setSelectedValue] = useControllableState({\n defaultValue: defaultSelectedValue,\n value: selectedValueProp,\n onChange: onSelectedChangeProp,\n })\n const [expandedValue, setExpandedValue] = useControllableState({\n defaultValue: defaultExpandedValue,\n value: expandedValueProp,\n onChange: onExpandedChangeProp,\n })\n const descendants = useSidebarDescendants()\n const open = mobile ? mobileDisclosure.open : desktopDisclosure.open\n const onOpen = mobile ? mobileDisclosure.onOpen : desktopDisclosure.onOpen\n const onClose = mobile ? mobileDisclosure.onClose : desktopDisclosure.onClose\n const onToggle = mobile\n ? mobileDisclosure.onToggle\n : desktopDisclosure.onToggle\n\n const onSelectedChange = useCallback(\n (value: string) => {\n setSelectedValue(value)\n },\n [setSelectedValue],\n )\n\n const onExpandAll = useCallback(() => {\n const values = descendants.enabledValues()\n const group = values.filter(({ group }) => group)\n const value = group.map(({ value }) => value)\n\n setExpandedValue(value)\n }, [descendants, setExpandedValue])\n\n const onCollapseAll = useCallback(() => {\n setExpandedValue([])\n }, [setExpandedValue])\n\n const onExpandedChange = useCallback(\n (value: string) => {\n setExpandedValue((prev) => {\n if (prev.includes(value)) {\n return prev.filter((prevValue) => prevValue !== value)\n } else {\n return [...prev, value]\n }\n })\n },\n [setExpandedValue],\n )\n\n assignRef(controlRef, { collapse: onCollapseAll, expand: onExpandAll })\n\n useWindowEvent(\"keydown\", (ev) => {\n if (ev.key !== \"b\") return\n if (!ev.metaKey && !ev.ctrlKey) return\n\n ev.preventDefault()\n\n desktopDisclosure.onToggle()\n })\n\n const getRootProps: PropGetter<\"div\"> = useCallback(\n (props = {}) =>\n mergeProps({ \"data-expanded\": dataAttr(open) }, rest, props)(),\n [open, rest],\n )\n\n const getTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n \"aria-expanded\": open,\n \"aria-label\": t(open ? \"Close sidebar\" : \"Open sidebar\"),\n ...props,\n onClick: handlerAll(props.onClick, onToggle),\n }),\n [open, t, onToggle],\n )\n\n const getSidePanelProps: PropGetter<\"aside\"> = useCallback(\n (props = {}) => ({ \"data-expanded\": dataAttr(open), ...props }),\n [open],\n )\n\n const getHeaderProps: PropGetter<\"header\"> = useCallback(\n (props = {}) => ({ ...props }),\n [],\n )\n\n const getFooterProps: PropGetter<\"footer\"> = useCallback(\n (props = {}) => ({ ...props }),\n [],\n )\n\n const getContentProps: PropGetter<\"ul\"> = useCallback(\n (props = {}) => ({ ...props }),\n [],\n )\n\n return {\n descendants,\n expandedValue,\n mobile,\n open,\n selectedValue,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getRootProps,\n getSidePanelProps,\n getTriggerProps,\n onClose,\n onExpandedChange,\n onOpen,\n onSelectedChange,\n onToggle,\n }\n}\n\nexport type UseSidebarReturn = ReturnType<typeof useSidebar>\n\nexport interface UseSidebarGroupProps extends HTMLProps<\"li\"> {}\n\nexport const useSidebarGroup = ({ ...rest }: UseSidebarGroupProps = {}) => {\n const { getDocument } = useEnvironment()\n const rootRef = useRef<HTMLLIElement>(null)\n const contentRef = useRef<HTMLDivElement>(null)\n const labelId = useId()\n\n useSafeLayoutEffect(() => {\n const el = getDocument()?.getElementById(labelId)\n\n if (!el) return\n\n if (rootRef.current)\n setAttribute(rootRef.current, \"aria-labelledby\", labelId)\n if (contentRef.current)\n setAttribute(contentRef.current, \"aria-labelledby\", labelId)\n }, [])\n\n const getRootProps: PropGetter<\"li\"> = useCallback(\n ({ ref, ...props } = {}) =>\n mergeProps({ ref }, rest, props, { ref: rootRef })(),\n [rest, rootRef],\n )\n\n const getLabelProps: PropGetter<\"span\"> = useCallback(\n (props = {}) => ({ id: labelId, ...props }),\n [labelId],\n )\n\n const getContentProps: PropGetter<\"div\"> = useCallback(\n ({ ref, ...props } = {}) => ({\n ref: mergeRefs(ref, contentRef),\n ...props,\n }),\n [],\n )\n\n return { getContentProps, getLabelProps, getRootProps }\n}\n\nexport type UseSidebarGroupReturn = ReturnType<typeof useSidebarGroup>\n\nexport interface UseSidebarItemProps\n extends HTMLProps<\"li\">, Omit<UseDisclosureProps, \"timing\"> {\n /**\n * The value of the item.\n */\n value: string\n /**\n * If `true`, the tree item will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * If `true`, the link will open in new tab.\n *\n * @default false\n */\n external?: boolean\n /**\n * If provided, the sidebar item will be rendered as an async sidebar item.\n */\n asyncChildren?: () => Promise<ReactNode>\n}\n\nexport const useSidebarItem = ({\n asyncChildren,\n children: childrenProp,\n defaultOpen,\n disabled = false,\n external,\n open: openProp,\n value,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n ...rest\n}: UseSidebarItemProps) => {\n const context = useSidebarItemContext()\n const {\n expandedValue,\n open,\n selectedValue,\n onExpandedChange,\n onSelectedChange,\n } = useSidebarContext()\n const [children, setChildren] = useState<ReactNode>(childrenProp)\n const [itemId, labelId, contentId] = useIds()\n const initialAsyncRef = useRef(false)\n const async = !!asyncChildren\n const group = async || Children.count(children) > 0\n const nested = !!context\n const selected = !!value && selectedValue === value\n const defaultExpanded = !!value && expandedValue.includes(value)\n const {\n open: groupOpen,\n onClose,\n onOpen,\n } = useDisclosure({\n defaultOpen: defaultOpen ?? defaultExpanded,\n open: openProp,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n })\n const branchOpen: boolean[] = nested\n ? [...context.branchOpen, groupOpen]\n : [groupOpen]\n const expanded = branchOpen.slice(0, -1).every(Boolean)\n const { register } = useSidebarDescendant({\n id: itemId!,\n disabled,\n expanded,\n group,\n value,\n })\n\n const [groupLoading, onGroupChildren] = useAsyncCallback(async () => {\n const children = await asyncChildren?.()\n\n setChildren(children)\n }, [asyncChildren])\n\n const onGroupOpen = useCallback(() => {\n if (disabled || !group || !value || groupLoading) return\n\n if (async && !initialAsyncRef.current) {\n initialAsyncRef.current = true\n\n onGroupChildren()\n .then(() => {\n onOpen()\n onExpandedChange(value)\n })\n .catch(() => {\n initialAsyncRef.current = false\n })\n } else {\n onOpen()\n onExpandedChange(value)\n }\n }, [\n disabled,\n group,\n value,\n groupLoading,\n async,\n onGroupChildren,\n onOpen,\n onExpandedChange,\n ])\n\n const onGroupClose = useCallback(() => {\n if (disabled || !group || !value) return\n\n onClose()\n onExpandedChange(value)\n }, [disabled, group, value, onClose, onExpandedChange])\n\n const onGroupToggle = useCallback(() => {\n if (groupOpen) {\n onGroupClose()\n } else {\n onGroupOpen()\n }\n }, [groupOpen, onGroupClose, onGroupOpen])\n\n useSafeLayoutEffect(() => {\n if (defaultExpanded) {\n if (async && !initialAsyncRef.current) {\n initialAsyncRef.current = true\n\n onGroupChildren()\n .then(() => {\n onOpen()\n })\n .catch(() => {\n initialAsyncRef.current = false\n })\n } else {\n onOpen()\n }\n } else {\n onClose()\n }\n }, [defaultExpanded])\n\n const getItemProps: PropGetter<\"li\"> = useCallback(\n (props = {}) =>\n mergeProps(\n {\n id: itemId,\n ref: register,\n \"aria-current\": selected ? \"page\" : undefined,\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-labelledby\": labelId,\n \"data-disabled\": dataAttr(disabled),\n \"data-selected\": dataAttr(selected),\n },\n rest,\n props,\n { onClick: !group ? () => onSelectedChange(value) : undefined },\n )(),\n [\n itemId,\n register,\n selected,\n disabled,\n labelId,\n rest,\n group,\n onSelectedChange,\n value,\n ],\n )\n\n const getIndicatorProps: PropGetter<\"svg\"> = useCallback(\n (props) => ({\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-expanded\": groupOpen,\n \"aria-hidden\": true,\n \"data-disabled\": dataAttr(disabled),\n \"data-loading\": dataAttr(groupLoading),\n \"data-selected\": dataAttr(selected),\n role: \"presentation\",\n ...props,\n }),\n [disabled, groupOpen, groupLoading, selected],\n )\n\n const getTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n \"aria-controls\": contentId,\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-expanded\": groupOpen,\n \"data-disabled\": dataAttr(disabled),\n \"data-expanded\": dataAttr(groupOpen),\n \"data-selected\": dataAttr(selected),\n tabIndex: open && expanded && !disabled ? 0 : -1,\n ...props,\n onClick: handlerAll(props.onClick, onGroupToggle),\n }),\n [contentId, disabled, groupOpen, selected, open, expanded, onGroupToggle],\n )\n\n const getLinkProps: PropGetter<\"a\"> = useCallback(\n (props = {}) => ({\n href: value,\n rel: external ? \"noopener\" : undefined,\n target: external ? \"_blank\" : undefined,\n \"data-disabled\": dataAttr(disabled),\n \"data-selected\": dataAttr(selected),\n tabIndex: open && expanded && !disabled ? 0 : -1,\n ...props,\n onClick: handlerAll(props.onClick, (ev) => {\n if (!disabled) return\n\n ev.preventDefault()\n ev.stopPropagation()\n }),\n }),\n [disabled, expanded, external, open, selected, value],\n )\n\n const getContentProps: PropGetter<\"ul\"> = useCallback(\n (props = {}) =>\n mergeProps(\n {\n id: contentId,\n \"aria-busy\": ariaAttr(groupLoading),\n \"aria-labelledby\": labelId,\n \"data-disabled\": dataAttr(disabled),\n },\n props,\n )(),\n [contentId, labelId, disabled, groupLoading],\n )\n\n const getLabelProps: PropGetter<\"span\"> = useCallback(\n (props = {}) => ({ id: labelId, ...props }),\n [labelId],\n )\n\n return {\n branchOpen,\n children,\n disabled,\n expanded,\n expandedValue,\n group,\n groupLoading,\n groupOpen,\n open,\n selected,\n selectedValue,\n value,\n getContentProps,\n getIndicatorProps,\n getItemProps,\n getLabelProps,\n getLinkProps,\n getTriggerProps,\n onExpandedChange,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n onSelectedChange,\n }\n}\n\nexport type UseSidebarItemReturn = ReturnType<typeof useSidebarItem>\n"],"mappings":";;;;;;;;;;;;;;;;;AA2CA,MAAM,EACJ,oBAAoB,2BACpB,eAAe,sBACf,gBAAgB,0BACdA,oCAAAA,mBAAwD;AAqB5D,MAAM,CAAC,gBAAgB,qBAAqBC,gBAAAA,cAA8B,EACxE,MAAM,kBACP,CAAC;AASF,MAAM,CAAC,oBAAoB,yBACzBA,gBAAAA,cAAkC;CAChC,MAAM;CACN,QAAQ;CACT,CAA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,EAAE,MAAM;GAAE,IAAI;GAAS,GAAG;GAAO,GAC1C,CAAC,QAAQ,CAmBI;EACb;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
@@ -2,7 +2,6 @@
2
2
  require("../../_virtual/_rolldown/runtime.cjs");
3
3
  const require_context = require("../../utils/context.cjs");
4
4
  const require_effect = require("../../utils/effect.cjs");
5
- const require_ref = require("../../utils/ref.cjs");
6
5
  const require_utils_index = require("../../utils/index.cjs");
7
6
  const require_environment_provider = require("../../core/system/environment-provider.cjs");
8
7
  const require_props = require("../../core/components/props.cjs");
@@ -79,7 +78,7 @@ const useSteps = ({ count = 0, defaultIndex = 0, index: indexProp, orientation =
79
78
  onPrev
80
79
  };
81
80
  };
82
- const useStepsItem = ({ "aria-labelledby": ariaLabelledbyProp, index, ...rest }) => {
81
+ const useStepsItem = ({ index, ...rest }) => {
83
82
  const { descendants, register } = useStepsDescendant();
84
83
  const { id, getStatus, orientation } = useStepsContext();
85
84
  const status = getStatus(index);
@@ -98,13 +97,12 @@ const useStepsItem = ({ "aria-labelledby": ariaLabelledbyProp, index, ...rest })
98
97
  id,
99
98
  index
100
99
  ]);
101
- const getRootProps = (0, react.useCallback)(({ ref, "aria-labelledby": ariaLabelledby, ...props } = {}) => require_props.mergeProps({
100
+ const getRootProps = (0, react.useCallback)((props = {}) => require_props.mergeProps({
101
+ ref: register,
102
102
  "aria-current": current ? "step" : void 0,
103
- "aria-labelledby": (0, require_utils_index.utils_exports.cx)(ariaLabelledbyProp, ariaLabelledby),
104
103
  "data-orientation": orientation,
105
104
  [statusDataAttr]: (0, require_utils_index.utils_exports.dataAttr)(true)
106
- }, rest, props, { ref: require_ref.mergeRefs(ref, register) })(), [
107
- ariaLabelledbyProp,
105
+ }, rest, props)(), [
108
106
  current,
109
107
  orientation,
110
108
  statusDataAttr,
@@ -1 +1 @@
1
- {"version":3,"file":"use-steps.cjs","names":["createDescendants","createContext","useControllableState","mergeProps","useEnvironment","mergeRefs"],"sources":["../../../../src/components/steps/use-steps.ts"],"sourcesContent":["\"use client\"\n\nimport type { HTMLProps, Orientation, PropGetter } from \"../../core\"\nimport { useCallback, useId } from \"react\"\nimport { mergeProps, useEnvironment } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { createDescendants } from \"../../hooks/use-descendants\"\nimport {\n createContext,\n cx,\n dataAttr,\n handlerAll,\n mergeRefs,\n setAttribute,\n useSafeLayoutEffect,\n} from \"../../utils\"\n\nexport type StepStatusScheme = \"complete\" | \"current\" | \"incomplete\"\n\nconst {\n DescendantsContext: StepsDescendantsContext,\n useDescendant: useStepsDescendant,\n useDescendants: useStepsDescendants,\n} = createDescendants<HTMLLIElement>()\n\nexport { StepsDescendantsContext, useStepsDescendant, useStepsDescendants }\n\ninterface StepsContext extends Omit<\n UseStepsReturn,\n \"descendants\" | \"getRootProps\"\n> {}\n\nconst [StepsContext, useStepsContext] = createContext<StepsContext>({\n name: \"StepsContext\",\n})\n\nexport { StepsContext, useStepsContext }\n\ninterface StepsItemContext extends Omit<UseStepsItemReturn, \"getRootProps\"> {}\n\nconst [StepsItemContext, useStepsItemContext] = createContext<StepsItemContext>(\n {\n name: \"StepsItemContext\",\n },\n)\n\nexport { StepsItemContext, useStepsItemContext }\n\nexport interface UseStepsProps extends Omit<HTMLProps, \"onChange\"> {\n /**\n * The total number of steps.\n */\n count?: number\n /**\n * The initial index of the active step.\n *\n * @default 0\n */\n defaultIndex?: number\n /**\n * The index of the active step.\n */\n index?: number\n /**\n * The orientation of the steps.\n *\n * @default 'horizontal'\n */\n orientation?: Orientation\n /**\n * The callback function that is called when the active step index is changed.\n */\n onChange?: (index: number) => void\n}\n\nexport const useSteps = ({\n count = 0,\n defaultIndex = 0,\n index: indexProp,\n orientation = \"horizontal\",\n onChange,\n ...rest\n}: UseStepsProps = {}) => {\n const descendants = useStepsDescendants()\n const [index, setIndex] = useControllableState({\n defaultValue: defaultIndex,\n value: indexProp,\n onChange,\n })\n const id = useId()\n\n const getStatus = useCallback(\n (indexProp: number): StepStatusScheme => {\n if (indexProp < index) {\n return \"complete\"\n } else if (indexProp > index) {\n return \"incomplete\"\n } else {\n return \"current\"\n }\n },\n [index],\n )\n\n const onPrev = useCallback(\n () => setIndex((index) => Math.max(0, index - 1)),\n [setIndex],\n )\n\n const onNext = useCallback(() => {\n setIndex((index) => Math.min(count, index + 1))\n }, [count, setIndex])\n\n const getRootProps: PropGetter = useCallback(\n (props = {}) => mergeProps(rest, props)(),\n [rest],\n )\n\n const getListProps: PropGetter<\"ol\"> = useCallback(\n (props) => {\n return {\n \"data-orientation\": orientation,\n ...props,\n }\n },\n [orientation],\n )\n\n const getContentProps: PropGetter<\"div\", { index?: number }> = useCallback(\n ({ index: indexProp = count, ...props } = {}) => ({\n id: `${id}-${indexProp}`,\n hidden: indexProp !== index,\n tabIndex: 0,\n ...props,\n }),\n [count, id, index],\n )\n\n const getPrevTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n disabled: index === 0,\n ...props,\n onClick: handlerAll(props.onClick, onPrev),\n }),\n [onPrev, index],\n )\n\n const getNextTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => {\n return {\n disabled: count <= index,\n ...props,\n onClick: handlerAll(props.onClick, onNext),\n }\n },\n [count, index, onNext],\n )\n\n return {\n id,\n count,\n descendants,\n getStatus,\n index,\n orientation,\n setIndex,\n getContentProps,\n getListProps,\n getNextTriggerProps,\n getPrevTriggerProps,\n getRootProps,\n onNext,\n onPrev,\n }\n}\n\nexport type UseStepsReturn = ReturnType<typeof useSteps>\n\nexport interface UseStepsItemProps extends HTMLProps<\"li\"> {\n /**\n * The index of the step.\n */\n index: number\n}\n\nexport const useStepsItem = ({\n \"aria-labelledby\": ariaLabelledbyProp,\n index,\n ...rest\n}: UseStepsItemProps) => {\n const { descendants, register } = useStepsDescendant()\n const { id, getStatus, orientation } = useStepsContext()\n const status = getStatus(index)\n const current = status === \"current\"\n const first = index === 0\n const last = index === descendants.lastValue()?.index\n const statusDataAttr = `data-${status}`\n const { getDocument } = useEnvironment()\n\n useSafeLayoutEffect(() => {\n const el = descendants.value(index)?.node\n const hasContent = !!getDocument()?.getElementById(`${id}-${index}`)\n\n if (el && hasContent) setAttribute(el, \"aria-labelledby\", `${id}-${index}`)\n }, [descendants, getDocument, id, index])\n\n const getRootProps: PropGetter<\"li\"> = useCallback(\n ({ ref, \"aria-labelledby\": ariaLabelledby, ...props } = {}) =>\n mergeProps(\n {\n \"aria-current\": current ? \"step\" : undefined,\n \"aria-labelledby\": cx(ariaLabelledbyProp, ariaLabelledby),\n \"data-orientation\": orientation,\n [statusDataAttr]: dataAttr(true),\n },\n rest,\n props,\n { ref: mergeRefs(ref, register) },\n )(),\n [ariaLabelledbyProp, current, orientation, statusDataAttr, rest, register],\n )\n\n const getTitleProps: PropGetter<\"h3\"> = useCallback(\n (props) => ({\n [statusDataAttr]: dataAttr(true),\n ...props,\n }),\n [statusDataAttr],\n )\n\n const getDescriptionProps: PropGetter<\"p\"> = useCallback(\n (props) => ({\n [statusDataAttr]: dataAttr(true),\n ...props,\n }),\n [statusDataAttr],\n )\n\n const getIndicatorProps: PropGetter = useCallback(\n (props) => ({\n [statusDataAttr]: dataAttr(true),\n ...props,\n }),\n [statusDataAttr],\n )\n\n const getSeparatorProps: PropGetter = useCallback(\n (props) => ({\n \"data-orientation\": orientation,\n role: \"separator\",\n [statusDataAttr]: dataAttr(true),\n ...props,\n }),\n [orientation, statusDataAttr],\n )\n\n return {\n first,\n index,\n last,\n status,\n getDescriptionProps,\n getIndicatorProps,\n getRootProps,\n getSeparatorProps,\n getTitleProps,\n }\n}\n\nexport type UseStepsItemReturn = ReturnType<typeof useStepsItem>\n"],"mappings":";;;;;;;;;;;;AAmBA,MAAM,EACJ,oBAAoB,yBACpB,eAAe,oBACf,gBAAgB,wBACdA,oCAAAA,mBAAkC;AAStC,MAAM,CAAC,cAAc,mBAAmBC,gBAAAA,cAA4B,EAClE,MAAM,gBACP,CAAC;AAMF,MA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AE,CAClC,EAAE,EACL;EAAC;EAAoB;EAAS;EAAa;EAAgB;EAAM;EAAS,CAC3E;CAED,MAAM,iBAAA,GAAA,MAAA,cACH,WAAW;GACT,kBAAA,GAAA,oBAAA,cAAA,UAA0B,KAAK;EAChC,GAAG;EACJ,GACD,CAAC,eAAe,CACjB;CA4BD,OAAO;EACL;EACA;EACA;EACA;EACA,sBAAA,GAAA,MAAA,cA9BC,WAAW;IACT,kBAAA,GAAA,oBAAA,cAAA,UAA0B,KAAK;GAChC,GAAG;GACJ,GACD,CAAC,eAAe,CA0BG;EACnB,oBAAA,GAAA,MAAA,cAvBC,WAAW;IACT,kBAAA,GAAA,oBAAA,cAAA,UAA0B,KAAK;GAChC,GAAG;GACJ,GACD,CAAC,eAAe,CAmBC;EACjB;EACA,oBAAA,GAAA,MAAA,cAjBC,WAAW;GACV,oBAAoB;GACpB,MAAM;IACL,kBAAA,GAAA,oBAAA,cAAA,UAA0B,KAAK;GAChC,GAAG;GACJ,GACD,CAAC,aAAa,eAAe,CAWZ;EACjB;EACD"}
1
+ {"version":3,"file":"use-steps.cjs","names":["createDescendants","createContext","useControllableState","mergeProps","useEnvironment"],"sources":["../../../../src/components/steps/use-steps.ts"],"sourcesContent":["\"use client\"\n\nimport type { HTMLProps, Orientation, PropGetter } from \"../../core\"\nimport { useCallback, useId } from \"react\"\nimport { mergeProps, useEnvironment } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { createDescendants } from \"../../hooks/use-descendants\"\nimport {\n createContext,\n dataAttr,\n handlerAll,\n setAttribute,\n useSafeLayoutEffect,\n} from \"../../utils\"\n\nexport type StepStatusScheme = \"complete\" | \"current\" | \"incomplete\"\n\nconst {\n DescendantsContext: StepsDescendantsContext,\n useDescendant: useStepsDescendant,\n useDescendants: useStepsDescendants,\n} = createDescendants<HTMLLIElement>()\n\nexport { StepsDescendantsContext, useStepsDescendant, useStepsDescendants }\n\ninterface StepsContext extends Omit<\n UseStepsReturn,\n \"descendants\" | \"getRootProps\"\n> {}\n\nconst [StepsContext, useStepsContext] = createContext<StepsContext>({\n name: \"StepsContext\",\n})\n\nexport { StepsContext, useStepsContext }\n\ninterface StepsItemContext extends Omit<UseStepsItemReturn, \"getRootProps\"> {}\n\nconst [StepsItemContext, useStepsItemContext] = createContext<StepsItemContext>(\n {\n name: \"StepsItemContext\",\n },\n)\n\nexport { StepsItemContext, useStepsItemContext }\n\nexport interface UseStepsProps extends Omit<HTMLProps, \"onChange\"> {\n /**\n * The total number of steps.\n */\n count?: number\n /**\n * The initial index of the active step.\n *\n * @default 0\n */\n defaultIndex?: number\n /**\n * The index of the active step.\n */\n index?: number\n /**\n * The orientation of the steps.\n *\n * @default 'horizontal'\n */\n orientation?: Orientation\n /**\n * The callback function that is called when the active step index is changed.\n */\n onChange?: (index: number) => void\n}\n\nexport const useSteps = ({\n count = 0,\n defaultIndex = 0,\n index: indexProp,\n orientation = \"horizontal\",\n onChange,\n ...rest\n}: UseStepsProps = {}) => {\n const descendants = useStepsDescendants()\n const [index, setIndex] = useControllableState({\n defaultValue: defaultIndex,\n value: indexProp,\n onChange,\n })\n const id = useId()\n\n const getStatus = useCallback(\n (indexProp: number): StepStatusScheme => {\n if (indexProp < index) {\n return \"complete\"\n } else if (indexProp > index) {\n return \"incomplete\"\n } else {\n return \"current\"\n }\n },\n [index],\n )\n\n const onPrev = useCallback(\n () => setIndex((index) => Math.max(0, index - 1)),\n [setIndex],\n )\n\n const onNext = useCallback(() => {\n setIndex((index) => Math.min(count, index + 1))\n }, [count, setIndex])\n\n const getRootProps: PropGetter = useCallback(\n (props = {}) => mergeProps(rest, props)(),\n [rest],\n )\n\n const getListProps: PropGetter<\"ol\"> = useCallback(\n (props) => {\n return {\n \"data-orientation\": orientation,\n ...props,\n }\n },\n [orientation],\n )\n\n const getContentProps: PropGetter<\"div\", { index?: number }> = useCallback(\n ({ index: indexProp = count, ...props } = {}) => ({\n id: `${id}-${indexProp}`,\n hidden: indexProp !== index,\n tabIndex: 0,\n ...props,\n }),\n [count, id, index],\n )\n\n const getPrevTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n disabled: index === 0,\n ...props,\n onClick: handlerAll(props.onClick, onPrev),\n }),\n [onPrev, index],\n )\n\n const getNextTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => {\n return {\n disabled: count <= index,\n ...props,\n onClick: handlerAll(props.onClick, onNext),\n }\n },\n [count, index, onNext],\n )\n\n return {\n id,\n count,\n descendants,\n getStatus,\n index,\n orientation,\n setIndex,\n getContentProps,\n getListProps,\n getNextTriggerProps,\n getPrevTriggerProps,\n getRootProps,\n onNext,\n onPrev,\n }\n}\n\nexport type UseStepsReturn = ReturnType<typeof useSteps>\n\nexport interface UseStepsItemProps extends HTMLProps<\"li\"> {\n /**\n * The index of the step.\n */\n index: number\n}\n\nexport const useStepsItem = ({ index, ...rest }: UseStepsItemProps) => {\n const { descendants, register } = useStepsDescendant()\n const { id, getStatus, orientation } = useStepsContext()\n const status = getStatus(index)\n const current = status === \"current\"\n const first = index === 0\n const last = index === descendants.lastValue()?.index\n const statusDataAttr = `data-${status}`\n const { getDocument } = useEnvironment()\n\n useSafeLayoutEffect(() => {\n const el = descendants.value(index)?.node\n const hasContent = !!getDocument()?.getElementById(`${id}-${index}`)\n\n if (el && hasContent) setAttribute(el, \"aria-labelledby\", `${id}-${index}`)\n }, [descendants, getDocument, id, index])\n\n const getRootProps: PropGetter<\"li\"> = useCallback(\n (props = {}) =>\n mergeProps(\n {\n ref: register,\n \"aria-current\": current ? \"step\" : undefined,\n \"data-orientation\": orientation,\n [statusDataAttr]: dataAttr(true),\n },\n rest,\n props,\n )(),\n [current, orientation, statusDataAttr, rest, register],\n )\n\n const getTitleProps: PropGetter<\"h3\"> = useCallback(\n (props) => ({\n [statusDataAttr]: dataAttr(true),\n ...props,\n }),\n [statusDataAttr],\n )\n\n const getDescriptionProps: PropGetter<\"p\"> = useCallback(\n (props) => ({\n [statusDataAttr]: dataAttr(true),\n ...props,\n }),\n [statusDataAttr],\n )\n\n const getIndicatorProps: PropGetter = useCallback(\n (props) => ({\n [statusDataAttr]: dataAttr(true),\n ...props,\n }),\n [statusDataAttr],\n )\n\n const getSeparatorProps: PropGetter = useCallback(\n (props) => ({\n \"data-orientation\": orientation,\n role: \"separator\",\n [statusDataAttr]: dataAttr(true),\n ...props,\n }),\n [orientation, statusDataAttr],\n )\n\n return {\n first,\n index,\n last,\n status,\n getDescriptionProps,\n getIndicatorProps,\n getRootProps,\n getSeparatorProps,\n getTitleProps,\n }\n}\n\nexport type UseStepsItemReturn = ReturnType<typeof useStepsItem>\n"],"mappings":";;;;;;;;;;;AAiBA,MAAM,EACJ,oBAAoB,yBACpB,eAAe,oBACf,gBAAgB,wBACdA,oCAAAA,mBAAkC;AAStC,MAAM,CAAC,cAAc,mBAAmBC,gBAAAA,cAA4B,EAClE,MAAM,gBACP,CAAC;AAMF,MAAM,CAAC,kBAAkB,uBAAuBA,gBAAAA,cAC9C,EACE,MAAM,oBACP,CACF;AA+BD,MAAa,YAAY,EACvB,QAAQ,GACR,eAAe,GACf,OAAO,WACP,cAAc,cACd,UACA,GAAG,SACc,EAAE,KAAK;CACxB,MAAM,cAAc,qBAAqB;CACzC,MAAM,CAAC,OAAO,YAAYC,2CAAAA,qBAAqB;EAC7C,cAAc;EACd,OAAO;EACP;EACD,CAAC;CACF,MAAM,MAAA,GAAA,MAAA,QAAY;CAElB,MAAM,aAAA,GAAA,MAAA,cACH,cAAwC;EACvC,IAAI,YAAY,OACd,OAAO;OACF,IAAI,YAAY,OACrB,OAAO;OAEP,OAAO;IAGX,CAAC,MAAM,CACR;CAED,MAAM,UAAA,GAAA,MAAA,mBACE,UAAU,UAAU,KAAK,IAAI,GAAG,QAAQ,EAAE,CAAC,EACjD,CAAC,SAAS,CACX;CAED,MAAM,UAAA,GAAA,MAAA,mBAA2B;EAC/B,UAAU,UAAU,KAAK,IAAI,OAAO,QAAQ,EAAE,CAAC;IAC9C,CAA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MAAM,KAAK,YAAY,MAAM,MAAM,EAAE;EACrC,MAAM,aAAa,CAAC,CAAC,aAAa,EAAE,eAAe,GAAG,GAAG,GAAG,QAAQ;EAEpE,IAAI,MAAM,YAAY,CAAA,GAAA,oBAAA,cAAA,cAAa,IAAI,mBAAmB,GAAG,GAAG,GAAG,QAAQ;IAC1E;EAAC;EAAa;EAAa;EAAI;EAAM,CAAC;CAEzC,MAAM,gBAAA,GAAA,MAAA,cACH,QAAQ,EAAE,KACTD,cAAAA,WACE;EACE,KAAK;EACL,gBAAgB,UAAU,SAAS,KAAA;EACnC,oBAAoB;GACnB,kBAAA,GAAA,oBAAA,cAAA,UAA0B,KAAK;EACjC,EACD,MACA,MACD,EAAE,EACL;EAAC;EAAS;EAAa;EAAgB;EAAM;EAAS,CACvD;CAED,MAAM,iBAAA,GAAA,MAAA,cACH,WAAW;GACT,kBAAA,GAAA,oBAAA,cAAA,UAA0B,KAAK;EAChC,GAAG;EACJ,GACD,CAAC,eAAe,CACjB;CA4BD,OAAO;EACL;EACA;EACA;EACA;EACA,sBAAA,GAAA,MAAA,cA9BC,WAAW;IACT,kBAAA,GAAA,oBAAA,cAAA,UAA0B,KAAK;GAChC,GAAG;GACJ,GACD,CAAC,eAAe,CA0BG;EACnB,oBAAA,GAAA,MAAA,cAvBC,WAAW;IACT,kBAAA,GAAA,oBAAA,cAAA,UAA0B,KAAK;GAChC,GAAG;GACJ,GACD,CAAC,eAAe,CAmBC;EACjB;EACA,oBAAA,GAAA,MAAA,cAjBC,WAAW;GACV,oBAAoB;GACpB,MAAM;IACL,kBAAA,GAAA,oBAAA,cAAA,UAA0B,KAAK;GAChC,GAAG;GACJ,GACD,CAAC,aAAa,eAAe,CAWZ;EACjB;EACD"}
@@ -217,20 +217,15 @@ const useSidebarItem = ({ asyncChildren, children: childrenProp, defaultOpen, di
217
217
  } else onOpen();
218
218
  else onClose();
219
219
  }, [defaultExpanded]);
220
- const getItemProps = useCallback(({ ref, "aria-labelledby": ariaLabelledby, ...props } = {}) => {
221
- const merged = mergeProps({
222
- id: itemId,
223
- "aria-current": selected ? "page" : void 0,
224
- "aria-disabled": (0, utils_exports.ariaAttr)(disabled),
225
- "aria-labelledby": (0, utils_exports.cx)(ariaLabelledby, labelId),
226
- "data-disabled": (0, utils_exports.dataAttr)(disabled),
227
- "data-selected": (0, utils_exports.dataAttr)(selected)
228
- }, rest, props, { ref }, { ref: register })();
229
- return {
230
- ...merged,
231
- onClick: (0, utils_exports.handlerAll)(merged.onClick, !group ? () => onSelectedChange(value) : void 0)
232
- };
233
- }, [
220
+ const getItemProps = useCallback((props = {}) => mergeProps({
221
+ id: itemId,
222
+ ref: register,
223
+ "aria-current": selected ? "page" : void 0,
224
+ "aria-disabled": (0, utils_exports.ariaAttr)(disabled),
225
+ "aria-labelledby": labelId,
226
+ "data-disabled": (0, utils_exports.dataAttr)(disabled),
227
+ "data-selected": (0, utils_exports.dataAttr)(selected)
228
+ }, rest, props, { onClick: !group ? () => onSelectedChange(value) : void 0 })(), [
234
229
  itemId,
235
230
  register,
236
231
  selected,
@@ -309,13 +304,12 @@ const useSidebarItem = ({ asyncChildren, children: childrenProp, defaultOpen, di
309
304
  selected,
310
305
  selectedValue,
311
306
  value,
312
- getContentProps: useCallback(({ "aria-labelledby": ariaLabelledby, ...props } = {}) => ({
307
+ getContentProps: useCallback((props = {}) => mergeProps({
313
308
  id: contentId,
314
309
  "aria-busy": (0, utils_exports.ariaAttr)(groupLoading),
315
- "aria-labelledby": (0, utils_exports.cx)(ariaLabelledby, labelId),
316
- "data-disabled": (0, utils_exports.dataAttr)(disabled),
317
- ...props
318
- }), [
310
+ "aria-labelledby": labelId,
311
+ "data-disabled": (0, utils_exports.dataAttr)(disabled)
312
+ }, props)(), [
319
313
  contentId,
320
314
  labelId,
321
315
  disabled,
@@ -1 +1 @@
1
- {"version":3,"file":"use-sidebar.js","names":["createContext"],"sources":["../../../../src/components/sidebar/use-sidebar.ts"],"sourcesContent":["\"use client\"\n\nimport type { ReactNode, RefObject } from \"react\"\nimport { Children, useCallback, useId, useRef, useState } from \"react\"\nimport {\n type HTMLProps,\n mergeProps,\n type PropGetter,\n useEnvironment,\n} from \"../../core\"\nimport { useAsyncCallback } from \"../../hooks/use-async-callback\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { createDescendants } from \"../../hooks/use-descendants\"\nimport {\n useDisclosure,\n type UseDisclosureProps,\n} from \"../../hooks/use-disclosure\"\nimport { useWindowEvent } from \"../../hooks/use-window-event\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport {\n ariaAttr,\n assignRef,\n createContext,\n cx,\n dataAttr,\n handlerAll,\n mergeRefs,\n setAttribute,\n useIds,\n useSafeLayoutEffect,\n} from \"../../utils\"\n\nexport interface SidebarControl {\n collapse: () => void\n expand: () => void\n}\n\ninterface SidebarDescendantProps {\n expanded: boolean\n group: boolean\n id: string\n value: string\n}\n\nconst {\n DescendantsContext: SidebarDescendantsContext,\n useDescendant: useSidebarDescendant,\n useDescendants: useSidebarDescendants,\n} = createDescendants<HTMLElement, SidebarDescendantProps>()\n\nexport {\n SidebarDescendantsContext,\n useSidebarDescendant,\n useSidebarDescendants,\n}\n\ninterface SidebarContext extends Pick<\n UseSidebarReturn,\n | \"expandedValue\"\n | \"mobile\"\n | \"onClose\"\n | \"onExpandedChange\"\n | \"onOpen\"\n | \"onSelectedChange\"\n | \"onToggle\"\n | \"open\"\n | \"selectedValue\"\n> {}\n\nconst [SidebarContext, useSidebarContext] = createContext<SidebarContext>({\n name: \"SidebarContext\",\n})\n\nexport { SidebarContext, useSidebarContext }\n\ninterface SidebarItemContext extends Pick<\n UseSidebarItemReturn,\n \"branchOpen\" | \"groupOpen\"\n> {}\n\nconst [SidebarItemContext, useSidebarItemContext] =\n createContext<SidebarItemContext>({\n name: \"SidebarItemContext\",\n strict: false,\n })\n\nexport { SidebarItemContext, useSidebarItemContext }\n\nexport interface UseSidebarProps extends HTMLProps<\"div\"> {\n /**\n * Ref of the sidebar callbacks.\n */\n controlRef?: RefObject<null | SidebarControl>\n /**\n * The initial expanded value of the sidebar.\n */\n defaultExpandedValue?: string[]\n /**\n * The initial selected value of the sidebar.\n */\n defaultSelectedValue?: string\n /**\n * The disclosure props for the desktop and mobile.\n */\n disclosure?: {\n desktop?: Omit<UseDisclosureProps, \"timing\">\n mobile?: Omit<UseDisclosureProps, \"timing\">\n }\n /**\n * The expanded value of the sidebar.\n */\n expandedValue?: string[]\n /**\n * If `true`, the trigger click event will be switched to mobile.\n *\n * @default false\n */\n mobile?: boolean\n /**\n * The selected value of the sidebar.\n */\n selectedValue?: string\n /**\n * The callback invoked when expanded value changes.\n */\n onExpandedChange?: (value: string[]) => void\n /**\n * The callback invoked when selected value changes.\n */\n onSelectedChange?: (value: string) => void\n}\n\nexport const useSidebar = ({\n controlRef,\n defaultExpandedValue = [],\n defaultSelectedValue,\n disclosure,\n expandedValue: expandedValueProp,\n mobile = false,\n selectedValue: selectedValueProp,\n onExpandedChange: onExpandedChangeProp,\n onSelectedChange: onSelectedChangeProp,\n ...rest\n}: UseSidebarProps = {}) => {\n const { t } = useI18n(\"sidebar\")\n const desktopDisclosure = useDisclosure({\n defaultOpen: disclosure?.desktop?.defaultOpen ?? true,\n open: disclosure?.desktop?.open,\n onClose: disclosure?.desktop?.onClose,\n onOpen: disclosure?.desktop?.onOpen,\n })\n const mobileDisclosure = useDisclosure({\n defaultOpen: disclosure?.mobile?.defaultOpen ?? false,\n open: disclosure?.mobile?.open,\n onClose: disclosure?.mobile?.onClose,\n onOpen: disclosure?.mobile?.onOpen,\n })\n const [selectedValue, setSelectedValue] = useControllableState({\n defaultValue: defaultSelectedValue,\n value: selectedValueProp,\n onChange: onSelectedChangeProp,\n })\n const [expandedValue, setExpandedValue] = useControllableState({\n defaultValue: defaultExpandedValue,\n value: expandedValueProp,\n onChange: onExpandedChangeProp,\n })\n const descendants = useSidebarDescendants()\n const open = mobile ? mobileDisclosure.open : desktopDisclosure.open\n const onOpen = mobile ? mobileDisclosure.onOpen : desktopDisclosure.onOpen\n const onClose = mobile ? mobileDisclosure.onClose : desktopDisclosure.onClose\n const onToggle = mobile\n ? mobileDisclosure.onToggle\n : desktopDisclosure.onToggle\n\n const onSelectedChange = useCallback(\n (value: string) => {\n setSelectedValue(value)\n },\n [setSelectedValue],\n )\n\n const onExpandAll = useCallback(() => {\n const values = descendants.enabledValues()\n const group = values.filter(({ group }) => group)\n const value = group.map(({ value }) => value)\n\n setExpandedValue(value)\n }, [descendants, setExpandedValue])\n\n const onCollapseAll = useCallback(() => {\n setExpandedValue([])\n }, [setExpandedValue])\n\n const onExpandedChange = useCallback(\n (value: string) => {\n setExpandedValue((prev) => {\n if (prev.includes(value)) {\n return prev.filter((prevValue) => prevValue !== value)\n } else {\n return [...prev, value]\n }\n })\n },\n [setExpandedValue],\n )\n\n assignRef(controlRef, { collapse: onCollapseAll, expand: onExpandAll })\n\n useWindowEvent(\"keydown\", (ev) => {\n if (ev.key !== \"b\") return\n if (!ev.metaKey && !ev.ctrlKey) return\n\n ev.preventDefault()\n\n desktopDisclosure.onToggle()\n })\n\n const getRootProps: PropGetter<\"div\"> = useCallback(\n (props = {}) =>\n mergeProps({ \"data-expanded\": dataAttr(open) }, rest, props)(),\n [open, rest],\n )\n\n const getTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n \"aria-expanded\": open,\n \"aria-label\": t(open ? \"Close sidebar\" : \"Open sidebar\"),\n ...props,\n onClick: handlerAll(props.onClick, onToggle),\n }),\n [open, t, onToggle],\n )\n\n const getSidePanelProps: PropGetter<\"aside\"> = useCallback(\n (props = {}) => ({ \"data-expanded\": dataAttr(open), ...props }),\n [open],\n )\n\n const getHeaderProps: PropGetter<\"header\"> = useCallback(\n (props = {}) => ({ ...props }),\n [],\n )\n\n const getFooterProps: PropGetter<\"footer\"> = useCallback(\n (props = {}) => ({ ...props }),\n [],\n )\n\n const getContentProps: PropGetter<\"ul\"> = useCallback(\n (props = {}) => ({ ...props }),\n [],\n )\n\n return {\n descendants,\n expandedValue,\n mobile,\n open,\n selectedValue,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getRootProps,\n getSidePanelProps,\n getTriggerProps,\n onClose,\n onExpandedChange,\n onOpen,\n onSelectedChange,\n onToggle,\n }\n}\n\nexport type UseSidebarReturn = ReturnType<typeof useSidebar>\n\nexport interface UseSidebarGroupProps extends HTMLProps<\"li\"> {}\n\nexport const useSidebarGroup = ({ ...rest }: UseSidebarGroupProps = {}) => {\n const { getDocument } = useEnvironment()\n const rootRef = useRef<HTMLLIElement>(null)\n const contentRef = useRef<HTMLDivElement>(null)\n const labelId = useId()\n\n useSafeLayoutEffect(() => {\n const el = getDocument()?.getElementById(labelId)\n\n if (!el) return\n\n if (rootRef.current)\n setAttribute(rootRef.current, \"aria-labelledby\", labelId)\n if (contentRef.current)\n setAttribute(contentRef.current, \"aria-labelledby\", labelId)\n }, [])\n\n const getRootProps: PropGetter<\"li\"> = useCallback(\n ({ ref, ...props } = {}) =>\n mergeProps({ ref }, rest, props, { ref: rootRef })(),\n [rest, rootRef],\n )\n\n const getLabelProps: PropGetter<\"span\"> = useCallback(\n (props = {}) => ({ id: labelId, ...props }),\n [labelId],\n )\n\n const getContentProps: PropGetter<\"div\"> = useCallback(\n ({ ref, ...props } = {}) => ({\n ref: mergeRefs(ref, contentRef),\n ...props,\n }),\n [],\n )\n\n return { getContentProps, getLabelProps, getRootProps }\n}\n\nexport type UseSidebarGroupReturn = ReturnType<typeof useSidebarGroup>\n\nexport interface UseSidebarItemProps\n extends HTMLProps<\"li\">, Omit<UseDisclosureProps, \"timing\"> {\n /**\n * The value of the item.\n */\n value: string\n /**\n * If `true`, the tree item will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * If `true`, the link will open in new tab.\n *\n * @default false\n */\n external?: boolean\n /**\n * If provided, the sidebar item will be rendered as an async sidebar item.\n */\n asyncChildren?: () => Promise<ReactNode>\n}\n\nexport const useSidebarItem = ({\n asyncChildren,\n children: childrenProp,\n defaultOpen,\n disabled = false,\n external,\n open: openProp,\n value,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n ...rest\n}: UseSidebarItemProps) => {\n const context = useSidebarItemContext()\n const {\n expandedValue,\n open,\n selectedValue,\n onExpandedChange,\n onSelectedChange,\n } = useSidebarContext()\n const [children, setChildren] = useState<ReactNode>(childrenProp)\n const [itemId, labelId, contentId] = useIds()\n const initialAsyncRef = useRef(false)\n const async = !!asyncChildren\n const group = async || Children.count(children) > 0\n const nested = !!context\n const selected = !!value && selectedValue === value\n const defaultExpanded = !!value && expandedValue.includes(value)\n const {\n open: groupOpen,\n onClose,\n onOpen,\n } = useDisclosure({\n defaultOpen: defaultOpen ?? defaultExpanded,\n open: openProp,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n })\n const branchOpen: boolean[] = nested\n ? [...context.branchOpen, groupOpen]\n : [groupOpen]\n const expanded = branchOpen.slice(0, -1).every(Boolean)\n const { register } = useSidebarDescendant({\n id: itemId!,\n disabled,\n expanded,\n group,\n value,\n })\n\n const [groupLoading, onGroupChildren] = useAsyncCallback(async () => {\n const children = await asyncChildren?.()\n\n setChildren(children)\n }, [asyncChildren])\n\n const onGroupOpen = useCallback(() => {\n if (disabled || !group || !value || groupLoading) return\n\n if (async && !initialAsyncRef.current) {\n initialAsyncRef.current = true\n\n onGroupChildren()\n .then(() => {\n onOpen()\n onExpandedChange(value)\n })\n .catch(() => {\n initialAsyncRef.current = false\n })\n } else {\n onOpen()\n onExpandedChange(value)\n }\n }, [\n disabled,\n group,\n value,\n groupLoading,\n async,\n onGroupChildren,\n onOpen,\n onExpandedChange,\n ])\n\n const onGroupClose = useCallback(() => {\n if (disabled || !group || !value) return\n\n onClose()\n onExpandedChange(value)\n }, [disabled, group, value, onClose, onExpandedChange])\n\n const onGroupToggle = useCallback(() => {\n if (groupOpen) {\n onGroupClose()\n } else {\n onGroupOpen()\n }\n }, [groupOpen, onGroupClose, onGroupOpen])\n\n useSafeLayoutEffect(() => {\n if (defaultExpanded) {\n if (async && !initialAsyncRef.current) {\n initialAsyncRef.current = true\n\n onGroupChildren()\n .then(() => {\n onOpen()\n })\n .catch(() => {\n initialAsyncRef.current = false\n })\n } else {\n onOpen()\n }\n } else {\n onClose()\n }\n }, [defaultExpanded])\n\n const getItemProps: PropGetter<\"li\"> = useCallback(\n ({ ref, \"aria-labelledby\": ariaLabelledby, ...props } = {}) => {\n const merged = mergeProps(\n {\n id: itemId,\n \"aria-current\": selected ? \"page\" : undefined,\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-labelledby\": cx(ariaLabelledby, labelId),\n \"data-disabled\": dataAttr(disabled),\n \"data-selected\": dataAttr(selected),\n },\n rest,\n props,\n { ref },\n { ref: register },\n )()\n\n return {\n ...merged,\n onClick: handlerAll(\n merged.onClick,\n !group ? () => onSelectedChange(value) : undefined,\n ),\n }\n },\n [\n itemId,\n register,\n selected,\n disabled,\n labelId,\n rest,\n group,\n onSelectedChange,\n value,\n ],\n )\n\n const getIndicatorProps: PropGetter<\"svg\"> = useCallback(\n (props) => ({\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-expanded\": groupOpen,\n \"aria-hidden\": true,\n \"data-disabled\": dataAttr(disabled),\n \"data-loading\": dataAttr(groupLoading),\n \"data-selected\": dataAttr(selected),\n role: \"presentation\",\n ...props,\n }),\n [disabled, groupOpen, groupLoading, selected],\n )\n\n const getTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n \"aria-controls\": contentId,\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-expanded\": groupOpen,\n \"data-disabled\": dataAttr(disabled),\n \"data-expanded\": dataAttr(groupOpen),\n \"data-selected\": dataAttr(selected),\n tabIndex: open && expanded && !disabled ? 0 : -1,\n ...props,\n onClick: handlerAll(props.onClick, onGroupToggle),\n }),\n [contentId, disabled, groupOpen, selected, open, expanded, onGroupToggle],\n )\n\n const getLinkProps: PropGetter<\"a\"> = useCallback(\n (props = {}) => ({\n href: value,\n rel: external ? \"noopener\" : undefined,\n target: external ? \"_blank\" : undefined,\n \"data-disabled\": dataAttr(disabled),\n \"data-selected\": dataAttr(selected),\n tabIndex: open && expanded && !disabled ? 0 : -1,\n ...props,\n onClick: handlerAll(props.onClick, (ev) => {\n if (!disabled) return\n\n ev.preventDefault()\n ev.stopPropagation()\n }),\n }),\n [disabled, expanded, external, open, selected, value],\n )\n\n const getContentProps: PropGetter<\"ul\"> = useCallback(\n ({ \"aria-labelledby\": ariaLabelledby, ...props } = {}) => ({\n id: contentId,\n \"aria-busy\": ariaAttr(groupLoading),\n \"aria-labelledby\": cx(ariaLabelledby, labelId),\n \"data-disabled\": dataAttr(disabled),\n ...props,\n }),\n [contentId, labelId, disabled, groupLoading],\n )\n\n const getLabelProps: PropGetter<\"span\"> = useCallback(\n (props = {}) => ({ id: labelId, ...props }),\n [labelId],\n )\n\n return {\n branchOpen,\n children,\n disabled,\n expanded,\n expandedValue,\n group,\n groupLoading,\n groupOpen,\n open,\n selected,\n selectedValue,\n value,\n getContentProps,\n getIndicatorProps,\n getItemProps,\n getLabelProps,\n getLinkProps,\n getTriggerProps,\n onExpandedChange,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n onSelectedChange,\n }\n}\n\nexport type UseSidebarItemReturn = ReturnType<typeof useSidebarItem>\n"],"mappings":";;;;;;;;;;;;;;;;AA4CA,MAAM,EACJ,oBAAoB,2BACpB,eAAe,sBACf,gBAAgB,0BACd,mBAAwD;AAqB5D,MAAM,CAAC,gBAAgB,qBAAqBA,gBAA8B,EACxE,MAAM,kBACP,CAAC;AASF,MAAM,CAAC,oBAAoB,yBACzBA,gBAAkC;CAChC,MAAM;CACN,QAAQ;CACT,CAAC;AAgDJ,MAAa,cAAc,EACzB,YACA,uBAAuB,EAAE,EACzB,sBACA,YACA,eAAe,mBACf,SAAS,OACT,eAAe,mBACf,kBAAkB,sBAClB,kBAAkB,sBAClB,GAAG,SACgB,EAAE,KAAK;CAC1B,MAAM,EAAE,MAAM,QAAQ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A,cAAA,UAA0B,SAAS;EACnC,kBAAA,GAAA,cAAA,UAA0B,SAAS;EACnC,UAAU,QAAQ,YAAY,CAAC,WAAW,IAAI;EAC9C,GAAG;EACH,UAAA,GAAA,cAAA,YAAoB,MAAM,UAAU,OAAO;GACzC,IAAI,CAAC,UAAU;GAEf,GAAG,gBAAgB;GACnB,GAAG,iBAAiB;IACpB;EACH,GACD;EAAC;EAAU;EAAU;EAAU;EAAM;EAAU;EAAM,CACtD;CAkBD,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,iBA7BwC,aACvC,EAAE,mBAAmB,gBAAgB,GAAG,UAAU,EAAE,MAAM;GACzD,IAAI;GACJ,cAAA,GAAA,cAAA,UAAsB,aAAa;GACnC,oBAAA,GAAA,cAAA,IAAsB,gBAAgB,QAAQ;GAC9C,kBAAA,GAAA,cAAA,UAA0B,SAAS;GACnC,GAAG;GACJ,GACD;GAAC;GAAW;GAAS;GAAU;GAAa,CAqB7B;EACf;EACA;EACA,eArBwC,aACvC,QAAQ,EAAE,MAAM;GAAE,IAAI;GAAS,GAAG;GAAO,GAC1C,CAAC,QAAQ,CAmBI;EACb;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
1
+ {"version":3,"file":"use-sidebar.js","names":["createContext"],"sources":["../../../../src/components/sidebar/use-sidebar.ts"],"sourcesContent":["\"use client\"\n\nimport type { ReactNode, RefObject } from \"react\"\nimport { Children, useCallback, useId, useRef, useState } from \"react\"\nimport {\n type HTMLProps,\n mergeProps,\n type PropGetter,\n useEnvironment,\n} from \"../../core\"\nimport { useAsyncCallback } from \"../../hooks/use-async-callback\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { createDescendants } from \"../../hooks/use-descendants\"\nimport {\n useDisclosure,\n type UseDisclosureProps,\n} from \"../../hooks/use-disclosure\"\nimport { useWindowEvent } from \"../../hooks/use-window-event\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport {\n ariaAttr,\n assignRef,\n createContext,\n dataAttr,\n handlerAll,\n mergeRefs,\n setAttribute,\n useIds,\n useSafeLayoutEffect,\n} from \"../../utils\"\n\nexport interface SidebarControl {\n collapse: () => void\n expand: () => void\n}\n\ninterface SidebarDescendantProps {\n expanded: boolean\n group: boolean\n id: string\n value: string\n}\n\nconst {\n DescendantsContext: SidebarDescendantsContext,\n useDescendant: useSidebarDescendant,\n useDescendants: useSidebarDescendants,\n} = createDescendants<HTMLElement, SidebarDescendantProps>()\n\nexport {\n SidebarDescendantsContext,\n useSidebarDescendant,\n useSidebarDescendants,\n}\n\ninterface SidebarContext extends Pick<\n UseSidebarReturn,\n | \"expandedValue\"\n | \"mobile\"\n | \"onClose\"\n | \"onExpandedChange\"\n | \"onOpen\"\n | \"onSelectedChange\"\n | \"onToggle\"\n | \"open\"\n | \"selectedValue\"\n> {}\n\nconst [SidebarContext, useSidebarContext] = createContext<SidebarContext>({\n name: \"SidebarContext\",\n})\n\nexport { SidebarContext, useSidebarContext }\n\ninterface SidebarItemContext extends Pick<\n UseSidebarItemReturn,\n \"branchOpen\" | \"groupOpen\"\n> {}\n\nconst [SidebarItemContext, useSidebarItemContext] =\n createContext<SidebarItemContext>({\n name: \"SidebarItemContext\",\n strict: false,\n })\n\nexport { SidebarItemContext, useSidebarItemContext }\n\nexport interface UseSidebarProps extends HTMLProps<\"div\"> {\n /**\n * Ref of the sidebar callbacks.\n */\n controlRef?: RefObject<null | SidebarControl>\n /**\n * The initial expanded value of the sidebar.\n */\n defaultExpandedValue?: string[]\n /**\n * The initial selected value of the sidebar.\n */\n defaultSelectedValue?: string\n /**\n * The disclosure props for the desktop and mobile.\n */\n disclosure?: {\n desktop?: Omit<UseDisclosureProps, \"timing\">\n mobile?: Omit<UseDisclosureProps, \"timing\">\n }\n /**\n * The expanded value of the sidebar.\n */\n expandedValue?: string[]\n /**\n * If `true`, the trigger click event will be switched to mobile.\n *\n * @default false\n */\n mobile?: boolean\n /**\n * The selected value of the sidebar.\n */\n selectedValue?: string\n /**\n * The callback invoked when expanded value changes.\n */\n onExpandedChange?: (value: string[]) => void\n /**\n * The callback invoked when selected value changes.\n */\n onSelectedChange?: (value: string) => void\n}\n\nexport const useSidebar = ({\n controlRef,\n defaultExpandedValue = [],\n defaultSelectedValue,\n disclosure,\n expandedValue: expandedValueProp,\n mobile = false,\n selectedValue: selectedValueProp,\n onExpandedChange: onExpandedChangeProp,\n onSelectedChange: onSelectedChangeProp,\n ...rest\n}: UseSidebarProps = {}) => {\n const { t } = useI18n(\"sidebar\")\n const desktopDisclosure = useDisclosure({\n defaultOpen: disclosure?.desktop?.defaultOpen ?? true,\n open: disclosure?.desktop?.open,\n onClose: disclosure?.desktop?.onClose,\n onOpen: disclosure?.desktop?.onOpen,\n })\n const mobileDisclosure = useDisclosure({\n defaultOpen: disclosure?.mobile?.defaultOpen ?? false,\n open: disclosure?.mobile?.open,\n onClose: disclosure?.mobile?.onClose,\n onOpen: disclosure?.mobile?.onOpen,\n })\n const [selectedValue, setSelectedValue] = useControllableState({\n defaultValue: defaultSelectedValue,\n value: selectedValueProp,\n onChange: onSelectedChangeProp,\n })\n const [expandedValue, setExpandedValue] = useControllableState({\n defaultValue: defaultExpandedValue,\n value: expandedValueProp,\n onChange: onExpandedChangeProp,\n })\n const descendants = useSidebarDescendants()\n const open = mobile ? mobileDisclosure.open : desktopDisclosure.open\n const onOpen = mobile ? mobileDisclosure.onOpen : desktopDisclosure.onOpen\n const onClose = mobile ? mobileDisclosure.onClose : desktopDisclosure.onClose\n const onToggle = mobile\n ? mobileDisclosure.onToggle\n : desktopDisclosure.onToggle\n\n const onSelectedChange = useCallback(\n (value: string) => {\n setSelectedValue(value)\n },\n [setSelectedValue],\n )\n\n const onExpandAll = useCallback(() => {\n const values = descendants.enabledValues()\n const group = values.filter(({ group }) => group)\n const value = group.map(({ value }) => value)\n\n setExpandedValue(value)\n }, [descendants, setExpandedValue])\n\n const onCollapseAll = useCallback(() => {\n setExpandedValue([])\n }, [setExpandedValue])\n\n const onExpandedChange = useCallback(\n (value: string) => {\n setExpandedValue((prev) => {\n if (prev.includes(value)) {\n return prev.filter((prevValue) => prevValue !== value)\n } else {\n return [...prev, value]\n }\n })\n },\n [setExpandedValue],\n )\n\n assignRef(controlRef, { collapse: onCollapseAll, expand: onExpandAll })\n\n useWindowEvent(\"keydown\", (ev) => {\n if (ev.key !== \"b\") return\n if (!ev.metaKey && !ev.ctrlKey) return\n\n ev.preventDefault()\n\n desktopDisclosure.onToggle()\n })\n\n const getRootProps: PropGetter<\"div\"> = useCallback(\n (props = {}) =>\n mergeProps({ \"data-expanded\": dataAttr(open) }, rest, props)(),\n [open, rest],\n )\n\n const getTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n \"aria-expanded\": open,\n \"aria-label\": t(open ? \"Close sidebar\" : \"Open sidebar\"),\n ...props,\n onClick: handlerAll(props.onClick, onToggle),\n }),\n [open, t, onToggle],\n )\n\n const getSidePanelProps: PropGetter<\"aside\"> = useCallback(\n (props = {}) => ({ \"data-expanded\": dataAttr(open), ...props }),\n [open],\n )\n\n const getHeaderProps: PropGetter<\"header\"> = useCallback(\n (props = {}) => ({ ...props }),\n [],\n )\n\n const getFooterProps: PropGetter<\"footer\"> = useCallback(\n (props = {}) => ({ ...props }),\n [],\n )\n\n const getContentProps: PropGetter<\"ul\"> = useCallback(\n (props = {}) => ({ ...props }),\n [],\n )\n\n return {\n descendants,\n expandedValue,\n mobile,\n open,\n selectedValue,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getRootProps,\n getSidePanelProps,\n getTriggerProps,\n onClose,\n onExpandedChange,\n onOpen,\n onSelectedChange,\n onToggle,\n }\n}\n\nexport type UseSidebarReturn = ReturnType<typeof useSidebar>\n\nexport interface UseSidebarGroupProps extends HTMLProps<\"li\"> {}\n\nexport const useSidebarGroup = ({ ...rest }: UseSidebarGroupProps = {}) => {\n const { getDocument } = useEnvironment()\n const rootRef = useRef<HTMLLIElement>(null)\n const contentRef = useRef<HTMLDivElement>(null)\n const labelId = useId()\n\n useSafeLayoutEffect(() => {\n const el = getDocument()?.getElementById(labelId)\n\n if (!el) return\n\n if (rootRef.current)\n setAttribute(rootRef.current, \"aria-labelledby\", labelId)\n if (contentRef.current)\n setAttribute(contentRef.current, \"aria-labelledby\", labelId)\n }, [])\n\n const getRootProps: PropGetter<\"li\"> = useCallback(\n ({ ref, ...props } = {}) =>\n mergeProps({ ref }, rest, props, { ref: rootRef })(),\n [rest, rootRef],\n )\n\n const getLabelProps: PropGetter<\"span\"> = useCallback(\n (props = {}) => ({ id: labelId, ...props }),\n [labelId],\n )\n\n const getContentProps: PropGetter<\"div\"> = useCallback(\n ({ ref, ...props } = {}) => ({\n ref: mergeRefs(ref, contentRef),\n ...props,\n }),\n [],\n )\n\n return { getContentProps, getLabelProps, getRootProps }\n}\n\nexport type UseSidebarGroupReturn = ReturnType<typeof useSidebarGroup>\n\nexport interface UseSidebarItemProps\n extends HTMLProps<\"li\">, Omit<UseDisclosureProps, \"timing\"> {\n /**\n * The value of the item.\n */\n value: string\n /**\n * If `true`, the tree item will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * If `true`, the link will open in new tab.\n *\n * @default false\n */\n external?: boolean\n /**\n * If provided, the sidebar item will be rendered as an async sidebar item.\n */\n asyncChildren?: () => Promise<ReactNode>\n}\n\nexport const useSidebarItem = ({\n asyncChildren,\n children: childrenProp,\n defaultOpen,\n disabled = false,\n external,\n open: openProp,\n value,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n ...rest\n}: UseSidebarItemProps) => {\n const context = useSidebarItemContext()\n const {\n expandedValue,\n open,\n selectedValue,\n onExpandedChange,\n onSelectedChange,\n } = useSidebarContext()\n const [children, setChildren] = useState<ReactNode>(childrenProp)\n const [itemId, labelId, contentId] = useIds()\n const initialAsyncRef = useRef(false)\n const async = !!asyncChildren\n const group = async || Children.count(children) > 0\n const nested = !!context\n const selected = !!value && selectedValue === value\n const defaultExpanded = !!value && expandedValue.includes(value)\n const {\n open: groupOpen,\n onClose,\n onOpen,\n } = useDisclosure({\n defaultOpen: defaultOpen ?? defaultExpanded,\n open: openProp,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n })\n const branchOpen: boolean[] = nested\n ? [...context.branchOpen, groupOpen]\n : [groupOpen]\n const expanded = branchOpen.slice(0, -1).every(Boolean)\n const { register } = useSidebarDescendant({\n id: itemId!,\n disabled,\n expanded,\n group,\n value,\n })\n\n const [groupLoading, onGroupChildren] = useAsyncCallback(async () => {\n const children = await asyncChildren?.()\n\n setChildren(children)\n }, [asyncChildren])\n\n const onGroupOpen = useCallback(() => {\n if (disabled || !group || !value || groupLoading) return\n\n if (async && !initialAsyncRef.current) {\n initialAsyncRef.current = true\n\n onGroupChildren()\n .then(() => {\n onOpen()\n onExpandedChange(value)\n })\n .catch(() => {\n initialAsyncRef.current = false\n })\n } else {\n onOpen()\n onExpandedChange(value)\n }\n }, [\n disabled,\n group,\n value,\n groupLoading,\n async,\n onGroupChildren,\n onOpen,\n onExpandedChange,\n ])\n\n const onGroupClose = useCallback(() => {\n if (disabled || !group || !value) return\n\n onClose()\n onExpandedChange(value)\n }, [disabled, group, value, onClose, onExpandedChange])\n\n const onGroupToggle = useCallback(() => {\n if (groupOpen) {\n onGroupClose()\n } else {\n onGroupOpen()\n }\n }, [groupOpen, onGroupClose, onGroupOpen])\n\n useSafeLayoutEffect(() => {\n if (defaultExpanded) {\n if (async && !initialAsyncRef.current) {\n initialAsyncRef.current = true\n\n onGroupChildren()\n .then(() => {\n onOpen()\n })\n .catch(() => {\n initialAsyncRef.current = false\n })\n } else {\n onOpen()\n }\n } else {\n onClose()\n }\n }, [defaultExpanded])\n\n const getItemProps: PropGetter<\"li\"> = useCallback(\n (props = {}) =>\n mergeProps(\n {\n id: itemId,\n ref: register,\n \"aria-current\": selected ? \"page\" : undefined,\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-labelledby\": labelId,\n \"data-disabled\": dataAttr(disabled),\n \"data-selected\": dataAttr(selected),\n },\n rest,\n props,\n { onClick: !group ? () => onSelectedChange(value) : undefined },\n )(),\n [\n itemId,\n register,\n selected,\n disabled,\n labelId,\n rest,\n group,\n onSelectedChange,\n value,\n ],\n )\n\n const getIndicatorProps: PropGetter<\"svg\"> = useCallback(\n (props) => ({\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-expanded\": groupOpen,\n \"aria-hidden\": true,\n \"data-disabled\": dataAttr(disabled),\n \"data-loading\": dataAttr(groupLoading),\n \"data-selected\": dataAttr(selected),\n role: \"presentation\",\n ...props,\n }),\n [disabled, groupOpen, groupLoading, selected],\n )\n\n const getTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n \"aria-controls\": contentId,\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-expanded\": groupOpen,\n \"data-disabled\": dataAttr(disabled),\n \"data-expanded\": dataAttr(groupOpen),\n \"data-selected\": dataAttr(selected),\n tabIndex: open && expanded && !disabled ? 0 : -1,\n ...props,\n onClick: handlerAll(props.onClick, onGroupToggle),\n }),\n [contentId, disabled, groupOpen, selected, open, expanded, onGroupToggle],\n )\n\n const getLinkProps: PropGetter<\"a\"> = useCallback(\n (props = {}) => ({\n href: value,\n rel: external ? \"noopener\" : undefined,\n target: external ? \"_blank\" : undefined,\n \"data-disabled\": dataAttr(disabled),\n \"data-selected\": dataAttr(selected),\n tabIndex: open && expanded && !disabled ? 0 : -1,\n ...props,\n onClick: handlerAll(props.onClick, (ev) => {\n if (!disabled) return\n\n ev.preventDefault()\n ev.stopPropagation()\n }),\n }),\n [disabled, expanded, external, open, selected, value],\n )\n\n const getContentProps: PropGetter<\"ul\"> = useCallback(\n (props = {}) =>\n mergeProps(\n {\n id: contentId,\n \"aria-busy\": ariaAttr(groupLoading),\n \"aria-labelledby\": labelId,\n \"data-disabled\": dataAttr(disabled),\n },\n props,\n )(),\n [contentId, labelId, disabled, groupLoading],\n )\n\n const getLabelProps: PropGetter<\"span\"> = useCallback(\n (props = {}) => ({ id: labelId, ...props }),\n [labelId],\n )\n\n return {\n branchOpen,\n children,\n disabled,\n expanded,\n expandedValue,\n group,\n groupLoading,\n groupOpen,\n open,\n selected,\n selectedValue,\n value,\n getContentProps,\n getIndicatorProps,\n getItemProps,\n getLabelProps,\n getLinkProps,\n getTriggerProps,\n onExpandedChange,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n onSelectedChange,\n }\n}\n\nexport type UseSidebarItemReturn = ReturnType<typeof useSidebarItem>\n"],"mappings":";;;;;;;;;;;;;;;;AA2CA,MAAM,EACJ,oBAAoB,2BACpB,eAAe,sBACf,gBAAgB,0BACd,mBAAwD;AAqB5D,MAAM,CAAC,gBAAgB,qBAAqBA,gBAA8B,EACxE,MAAM,kBACP,CAAC;AASF,MAAM,CAAC,oBAAoB,yBACzBA,gBAAkC;CAChC,MAAM;CACN,QAAQ;CACT,CAAC;AAgDJ,MAAa,cAAc,EACzB,YACA,uBAAuB,EAAE,EACzB,sBACA,YACA,eAAe,mBACf,SAAS,OACT,eAAe,mBACf,kBAAkB,sBAClB,kBAAkB,sBAClB,GAAG,SACgB,EAAE,KAAK;CAC1B,MAAM,EAAE,MAAM,QAAQ,UAAU;CAChC,MAAM,oBAAoB,cAAc;EACtC,aAAa,YAAY,SAAS,eAAe;EACjD,MAAM,YAAY,SAAS;EAC3B,SAAS,YAAY,SAAS;EAC9B,QAAQ,YAAY,SAAS;EAC9B,CAAC;CACF,MAAM,mBAAmB,cAAc;EACrC,aAAa,YAAY,QAAQ,eAAe;EAChD,MAAM,YAAY,QAAQ;EAC1B,SAAS,YAAY,QAAQ;EAC7B,QAAQ,YAAY,QAAQ;EAC7B,CAAC;CACF,MAAM,CAAC,eAAe,oBAAoB,qBAAqB;EAC7D,cAAc;EACd,OAAO;EACP,UAAU;EACX,CAAC;CACF,MAAM,CAAC,eAAe,oBAAoB,qBAAqB;EAC7D,cAAc;EACd,OAAO;EACP,UAAU;EACX,CAAC;CACF,MAAM,cAAc,uBAAuB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Q,CAmBI;EACb;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
@@ -1,7 +1,6 @@
1
1
  "use client";
2
2
  import { createContext as createContext$1 } from "../../utils/context.js";
3
3
  import { useSafeLayoutEffect } from "../../utils/effect.js";
4
- import { mergeRefs } from "../../utils/ref.js";
5
4
  import { utils_exports } from "../../utils/index.js";
6
5
  import { useEnvironment } from "../../core/system/environment-provider.js";
7
6
  import { mergeProps } from "../../core/components/props.js";
@@ -78,7 +77,7 @@ const useSteps = ({ count = 0, defaultIndex = 0, index: indexProp, orientation =
78
77
  onPrev
79
78
  };
80
79
  };
81
- const useStepsItem = ({ "aria-labelledby": ariaLabelledbyProp, index, ...rest }) => {
80
+ const useStepsItem = ({ index, ...rest }) => {
82
81
  const { descendants, register } = useStepsDescendant();
83
82
  const { id, getStatus, orientation } = useStepsContext();
84
83
  const status = getStatus(index);
@@ -97,13 +96,12 @@ const useStepsItem = ({ "aria-labelledby": ariaLabelledbyProp, index, ...rest })
97
96
  id,
98
97
  index
99
98
  ]);
100
- const getRootProps = useCallback(({ ref, "aria-labelledby": ariaLabelledby, ...props } = {}) => mergeProps({
99
+ const getRootProps = useCallback((props = {}) => mergeProps({
100
+ ref: register,
101
101
  "aria-current": current ? "step" : void 0,
102
- "aria-labelledby": (0, utils_exports.cx)(ariaLabelledbyProp, ariaLabelledby),
103
102
  "data-orientation": orientation,
104
103
  [statusDataAttr]: (0, utils_exports.dataAttr)(true)
105
- }, rest, props, { ref: mergeRefs(ref, register) })(), [
106
- ariaLabelledbyProp,
104
+ }, rest, props)(), [
107
105
  current,
108
106
  orientation,
109
107
  statusDataAttr,
@@ -1 +1 @@
1
- {"version":3,"file":"use-steps.js","names":["createContext"],"sources":["../../../../src/components/steps/use-steps.ts"],"sourcesContent":["\"use client\"\n\nimport type { HTMLProps, Orientation, PropGetter } from \"../../core\"\nimport { useCallback, useId } from \"react\"\nimport { mergeProps, useEnvironment } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { createDescendants } from \"../../hooks/use-descendants\"\nimport {\n createContext,\n cx,\n dataAttr,\n handlerAll,\n mergeRefs,\n setAttribute,\n useSafeLayoutEffect,\n} from \"../../utils\"\n\nexport type StepStatusScheme = \"complete\" | \"current\" | \"incomplete\"\n\nconst {\n DescendantsContext: StepsDescendantsContext,\n useDescendant: useStepsDescendant,\n useDescendants: useStepsDescendants,\n} = createDescendants<HTMLLIElement>()\n\nexport { StepsDescendantsContext, useStepsDescendant, useStepsDescendants }\n\ninterface StepsContext extends Omit<\n UseStepsReturn,\n \"descendants\" | \"getRootProps\"\n> {}\n\nconst [StepsContext, useStepsContext] = createContext<StepsContext>({\n name: \"StepsContext\",\n})\n\nexport { StepsContext, useStepsContext }\n\ninterface StepsItemContext extends Omit<UseStepsItemReturn, \"getRootProps\"> {}\n\nconst [StepsItemContext, useStepsItemContext] = createContext<StepsItemContext>(\n {\n name: \"StepsItemContext\",\n },\n)\n\nexport { StepsItemContext, useStepsItemContext }\n\nexport interface UseStepsProps extends Omit<HTMLProps, \"onChange\"> {\n /**\n * The total number of steps.\n */\n count?: number\n /**\n * The initial index of the active step.\n *\n * @default 0\n */\n defaultIndex?: number\n /**\n * The index of the active step.\n */\n index?: number\n /**\n * The orientation of the steps.\n *\n * @default 'horizontal'\n */\n orientation?: Orientation\n /**\n * The callback function that is called when the active step index is changed.\n */\n onChange?: (index: number) => void\n}\n\nexport const useSteps = ({\n count = 0,\n defaultIndex = 0,\n index: indexProp,\n orientation = \"horizontal\",\n onChange,\n ...rest\n}: UseStepsProps = {}) => {\n const descendants = useStepsDescendants()\n const [index, setIndex] = useControllableState({\n defaultValue: defaultIndex,\n value: indexProp,\n onChange,\n })\n const id = useId()\n\n const getStatus = useCallback(\n (indexProp: number): StepStatusScheme => {\n if (indexProp < index) {\n return \"complete\"\n } else if (indexProp > index) {\n return \"incomplete\"\n } else {\n return \"current\"\n }\n },\n [index],\n )\n\n const onPrev = useCallback(\n () => setIndex((index) => Math.max(0, index - 1)),\n [setIndex],\n )\n\n const onNext = useCallback(() => {\n setIndex((index) => Math.min(count, index + 1))\n }, [count, setIndex])\n\n const getRootProps: PropGetter = useCallback(\n (props = {}) => mergeProps(rest, props)(),\n [rest],\n )\n\n const getListProps: PropGetter<\"ol\"> = useCallback(\n (props) => {\n return {\n \"data-orientation\": orientation,\n ...props,\n }\n },\n [orientation],\n )\n\n const getContentProps: PropGetter<\"div\", { index?: number }> = useCallback(\n ({ index: indexProp = count, ...props } = {}) => ({\n id: `${id}-${indexProp}`,\n hidden: indexProp !== index,\n tabIndex: 0,\n ...props,\n }),\n [count, id, index],\n )\n\n const getPrevTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n disabled: index === 0,\n ...props,\n onClick: handlerAll(props.onClick, onPrev),\n }),\n [onPrev, index],\n )\n\n const getNextTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => {\n return {\n disabled: count <= index,\n ...props,\n onClick: handlerAll(props.onClick, onNext),\n }\n },\n [count, index, onNext],\n )\n\n return {\n id,\n count,\n descendants,\n getStatus,\n index,\n orientation,\n setIndex,\n getContentProps,\n getListProps,\n getNextTriggerProps,\n getPrevTriggerProps,\n getRootProps,\n onNext,\n onPrev,\n }\n}\n\nexport type UseStepsReturn = ReturnType<typeof useSteps>\n\nexport interface UseStepsItemProps extends HTMLProps<\"li\"> {\n /**\n * The index of the step.\n */\n index: number\n}\n\nexport const useStepsItem = ({\n \"aria-labelledby\": ariaLabelledbyProp,\n index,\n ...rest\n}: UseStepsItemProps) => {\n const { descendants, register } = useStepsDescendant()\n const { id, getStatus, orientation } = useStepsContext()\n const status = getStatus(index)\n const current = status === \"current\"\n const first = index === 0\n const last = index === descendants.lastValue()?.index\n const statusDataAttr = `data-${status}`\n const { getDocument } = useEnvironment()\n\n useSafeLayoutEffect(() => {\n const el = descendants.value(index)?.node\n const hasContent = !!getDocument()?.getElementById(`${id}-${index}`)\n\n if (el && hasContent) setAttribute(el, \"aria-labelledby\", `${id}-${index}`)\n }, [descendants, getDocument, id, index])\n\n const getRootProps: PropGetter<\"li\"> = useCallback(\n ({ ref, \"aria-labelledby\": ariaLabelledby, ...props } = {}) =>\n mergeProps(\n {\n \"aria-current\": current ? \"step\" : undefined,\n \"aria-labelledby\": cx(ariaLabelledbyProp, ariaLabelledby),\n \"data-orientation\": orientation,\n [statusDataAttr]: dataAttr(true),\n },\n rest,\n props,\n { ref: mergeRefs(ref, register) },\n )(),\n [ariaLabelledbyProp, current, orientation, statusDataAttr, rest, register],\n )\n\n const getTitleProps: PropGetter<\"h3\"> = useCallback(\n (props) => ({\n [statusDataAttr]: dataAttr(true),\n ...props,\n }),\n [statusDataAttr],\n )\n\n const getDescriptionProps: PropGetter<\"p\"> = useCallback(\n (props) => ({\n [statusDataAttr]: dataAttr(true),\n ...props,\n }),\n [statusDataAttr],\n )\n\n const getIndicatorProps: PropGetter = useCallback(\n (props) => ({\n [statusDataAttr]: dataAttr(true),\n ...props,\n }),\n [statusDataAttr],\n )\n\n const getSeparatorProps: PropGetter = useCallback(\n (props) => ({\n \"data-orientation\": orientation,\n role: \"separator\",\n [statusDataAttr]: dataAttr(true),\n ...props,\n }),\n [orientation, statusDataAttr],\n )\n\n return {\n first,\n index,\n last,\n status,\n getDescriptionProps,\n getIndicatorProps,\n getRootProps,\n getSeparatorProps,\n getTitleProps,\n }\n}\n\nexport type UseStepsItemReturn = ReturnType<typeof useStepsItem>\n"],"mappings":";;;;;;;;;;;AAmBA,MAAM,EACJ,oBAAoB,yBACpB,eAAe,oBACf,gBAAgB,wBACd,mBAAkC;AAStC,MAAM,CAAC,cAAc,mBAAmBA,gBAA4B,EAClE,MAAM,gBACP,CAAC;AAMF,MAAM,CAAC,kBAAkB,uBAAuBA,gBAC9C,EACE,MAAM,oBACP,CACF;AA+BD,MAAa,YAAY,EACvB,QAAQ,GACR,eAAe,GACf,OAAO,WACP,cAAc,cACd,UACA,GAAG,SACc,EAAE,KAAK;CACxB,MAAM,cAAc,qBA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0B,KAAK;GAChC,GAAG;GACJ,GACD,CAAC,eAAe,CAmBC;EACjB;EACA,mBAlBoC,aACnC,WAAW;GACV,oBAAoB;GACpB,MAAM;IACL,kBAAA,GAAA,cAAA,UAA0B,KAAK;GAChC,GAAG;GACJ,GACD,CAAC,aAAa,eAAe,CAWZ;EACjB;EACD"}
1
+ {"version":3,"file":"use-steps.js","names":["createContext"],"sources":["../../../../src/components/steps/use-steps.ts"],"sourcesContent":["\"use client\"\n\nimport type { HTMLProps, Orientation, PropGetter } from \"../../core\"\nimport { useCallback, useId } from \"react\"\nimport { mergeProps, useEnvironment } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { createDescendants } from \"../../hooks/use-descendants\"\nimport {\n createContext,\n dataAttr,\n handlerAll,\n setAttribute,\n useSafeLayoutEffect,\n} from \"../../utils\"\n\nexport type StepStatusScheme = \"complete\" | \"current\" | \"incomplete\"\n\nconst {\n DescendantsContext: StepsDescendantsContext,\n useDescendant: useStepsDescendant,\n useDescendants: useStepsDescendants,\n} = createDescendants<HTMLLIElement>()\n\nexport { StepsDescendantsContext, useStepsDescendant, useStepsDescendants }\n\ninterface StepsContext extends Omit<\n UseStepsReturn,\n \"descendants\" | \"getRootProps\"\n> {}\n\nconst [StepsContext, useStepsContext] = createContext<StepsContext>({\n name: \"StepsContext\",\n})\n\nexport { StepsContext, useStepsContext }\n\ninterface StepsItemContext extends Omit<UseStepsItemReturn, \"getRootProps\"> {}\n\nconst [StepsItemContext, useStepsItemContext] = createContext<StepsItemContext>(\n {\n name: \"StepsItemContext\",\n },\n)\n\nexport { StepsItemContext, useStepsItemContext }\n\nexport interface UseStepsProps extends Omit<HTMLProps, \"onChange\"> {\n /**\n * The total number of steps.\n */\n count?: number\n /**\n * The initial index of the active step.\n *\n * @default 0\n */\n defaultIndex?: number\n /**\n * The index of the active step.\n */\n index?: number\n /**\n * The orientation of the steps.\n *\n * @default 'horizontal'\n */\n orientation?: Orientation\n /**\n * The callback function that is called when the active step index is changed.\n */\n onChange?: (index: number) => void\n}\n\nexport const useSteps = ({\n count = 0,\n defaultIndex = 0,\n index: indexProp,\n orientation = \"horizontal\",\n onChange,\n ...rest\n}: UseStepsProps = {}) => {\n const descendants = useStepsDescendants()\n const [index, setIndex] = useControllableState({\n defaultValue: defaultIndex,\n value: indexProp,\n onChange,\n })\n const id = useId()\n\n const getStatus = useCallback(\n (indexProp: number): StepStatusScheme => {\n if (indexProp < index) {\n return \"complete\"\n } else if (indexProp > index) {\n return \"incomplete\"\n } else {\n return \"current\"\n }\n },\n [index],\n )\n\n const onPrev = useCallback(\n () => setIndex((index) => Math.max(0, index - 1)),\n [setIndex],\n )\n\n const onNext = useCallback(() => {\n setIndex((index) => Math.min(count, index + 1))\n }, [count, setIndex])\n\n const getRootProps: PropGetter = useCallback(\n (props = {}) => mergeProps(rest, props)(),\n [rest],\n )\n\n const getListProps: PropGetter<\"ol\"> = useCallback(\n (props) => {\n return {\n \"data-orientation\": orientation,\n ...props,\n }\n },\n [orientation],\n )\n\n const getContentProps: PropGetter<\"div\", { index?: number }> = useCallback(\n ({ index: indexProp = count, ...props } = {}) => ({\n id: `${id}-${indexProp}`,\n hidden: indexProp !== index,\n tabIndex: 0,\n ...props,\n }),\n [count, id, index],\n )\n\n const getPrevTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n disabled: index === 0,\n ...props,\n onClick: handlerAll(props.onClick, onPrev),\n }),\n [onPrev, index],\n )\n\n const getNextTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => {\n return {\n disabled: count <= index,\n ...props,\n onClick: handlerAll(props.onClick, onNext),\n }\n },\n [count, index, onNext],\n )\n\n return {\n id,\n count,\n descendants,\n getStatus,\n index,\n orientation,\n setIndex,\n getContentProps,\n getListProps,\n getNextTriggerProps,\n getPrevTriggerProps,\n getRootProps,\n onNext,\n onPrev,\n }\n}\n\nexport type UseStepsReturn = ReturnType<typeof useSteps>\n\nexport interface UseStepsItemProps extends HTMLProps<\"li\"> {\n /**\n * The index of the step.\n */\n index: number\n}\n\nexport const useStepsItem = ({ index, ...rest }: UseStepsItemProps) => {\n const { descendants, register } = useStepsDescendant()\n const { id, getStatus, orientation } = useStepsContext()\n const status = getStatus(index)\n const current = status === \"current\"\n const first = index === 0\n const last = index === descendants.lastValue()?.index\n const statusDataAttr = `data-${status}`\n const { getDocument } = useEnvironment()\n\n useSafeLayoutEffect(() => {\n const el = descendants.value(index)?.node\n const hasContent = !!getDocument()?.getElementById(`${id}-${index}`)\n\n if (el && hasContent) setAttribute(el, \"aria-labelledby\", `${id}-${index}`)\n }, [descendants, getDocument, id, index])\n\n const getRootProps: PropGetter<\"li\"> = useCallback(\n (props = {}) =>\n mergeProps(\n {\n ref: register,\n \"aria-current\": current ? \"step\" : undefined,\n \"data-orientation\": orientation,\n [statusDataAttr]: dataAttr(true),\n },\n rest,\n props,\n )(),\n [current, orientation, statusDataAttr, rest, register],\n )\n\n const getTitleProps: PropGetter<\"h3\"> = useCallback(\n (props) => ({\n [statusDataAttr]: dataAttr(true),\n ...props,\n }),\n [statusDataAttr],\n )\n\n const getDescriptionProps: PropGetter<\"p\"> = useCallback(\n (props) => ({\n [statusDataAttr]: dataAttr(true),\n ...props,\n }),\n [statusDataAttr],\n )\n\n const getIndicatorProps: PropGetter = useCallback(\n (props) => ({\n [statusDataAttr]: dataAttr(true),\n ...props,\n }),\n [statusDataAttr],\n )\n\n const getSeparatorProps: PropGetter = useCallback(\n (props) => ({\n \"data-orientation\": orientation,\n role: \"separator\",\n [statusDataAttr]: dataAttr(true),\n ...props,\n }),\n [orientation, statusDataAttr],\n )\n\n return {\n first,\n index,\n last,\n status,\n getDescriptionProps,\n getIndicatorProps,\n getRootProps,\n getSeparatorProps,\n getTitleProps,\n }\n}\n\nexport type UseStepsItemReturn = ReturnType<typeof useStepsItem>\n"],"mappings":";;;;;;;;;;AAiBA,MAAM,EACJ,oBAAoB,yBACpB,eAAe,oBACf,gBAAgB,wBACd,mBAAk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,cAAA,UAA0B,KAAK;GAChC,GAAG;GACJ,GACD,CAAC,eAAe,CA0BG;EACnB,mBAxBoC,aACnC,WAAW;IACT,kBAAA,GAAA,cAAA,UAA0B,KAAK;GAChC,GAAG;GACJ,GACD,CAAC,eAAe,CAmBC;EACjB;EACA,mBAlBoC,aACnC,WAAW;GACV,oBAAoB;GACpB,MAAM;IACL,kBAAA,GAAA,cAAA,UAA0B,KAAK;GAChC,GAAG;GACJ,GACD,CAAC,aAAa,eAAe,CAWZ;EACjB;EACD"}
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.types.js";
2
2
  import { CSSModifierObject, CSSPropObject, CSSSlotObject } from "../../core/css/index.types.js";
3
3
  //#region src/components/accordion/accordion.style.d.ts
4
- declare const accordionStyle: ComponentSlotStyle<"button" | "panel" | "icon" | "item" | "root", CSSPropObject<CSSSlotObject<"button" | "panel" | "icon" | "item" | "root">>, CSSModifierObject<CSSSlotObject<"button" | "panel" | "icon" | "item" | "root">>, {
4
+ declare const accordionStyle: ComponentSlotStyle<"button" | "panel" | "icon" | "root" | "item", CSSPropObject<CSSSlotObject<"button" | "panel" | "icon" | "root" | "item">>, CSSModifierObject<CSSSlotObject<"button" | "panel" | "icon" | "root" | "item">>, {
5
5
  panel: {
6
6
  button: {
7
7
  rounded: "l2";
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.types.js";
2
2
  import { CSSModifierObject, CSSPropObject, CSSSlotObject } from "../../core/css/index.types.js";
3
3
  //#region src/components/alert/alert.style.d.ts
4
- declare const alertStyle: ComponentSlotStyle<"title" | "loading" | "icon" | "root" | "description", CSSPropObject<CSSSlotObject<"title" | "loading" | "icon" | "root" | "description">>, CSSModifierObject<CSSSlotObject<"title" | "loading" | "icon" | "root" | "description">>, {
4
+ declare const alertStyle: ComponentSlotStyle<"title" | "loading" | "icon" | "description" | "root", CSSPropObject<CSSSlotObject<"title" | "loading" | "icon" | "description" | "root">>, CSSModifierObject<CSSSlotObject<"title" | "loading" | "icon" | "description" | "root">>, {
5
5
  island: {
6
6
  description: {
7
7
  color: "fg.muted";
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.types.js";
2
2
  import { CSSPropObject, CSSSlotObject } from "../../core/css/index.types.js";
3
3
  //#region src/components/autocomplete/autocomplete.style.d.ts
4
- declare const autocompleteStyle: ComponentSlotStyle<"input" | "label" | "option" | "content" | "group" | "separator" | "icon" | "root" | "indicator" | "field" | "valueText" | "empty", CSSPropObject<CSSSlotObject<"input" | "label" | "option" | "content" | "group" | "separator" | "icon" | "root" | "indicator" | "field" | "valueText" | "empty">>, {
4
+ declare const autocompleteStyle: ComponentSlotStyle<"input" | "label" | "option" | "content" | "group" | "separator" | "icon" | "field" | "root" | "indicator" | "empty" | "valueText", CSSPropObject<CSSSlotObject<"input" | "label" | "option" | "content" | "group" | "separator" | "icon" | "field" | "root" | "indicator" | "empty" | "valueText">>, {
5
5
  xs: {
6
6
  empty: {
7
7
  gap: "1.5";
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.types.js";
2
2
  import { CSSPropObject, CSSSlotObject } from "../../core/css/index.types.js";
3
3
  //#region src/components/breadcrumb/breadcrumb.style.d.ts
4
- declare const breadcrumbStyle: ComponentSlotStyle<"link" | "list" | "separator" | "ellipsis" | "item" | "root", CSSPropObject<CSSSlotObject<"link" | "list" | "separator" | "ellipsis" | "item" | "root">>, {
4
+ declare const breadcrumbStyle: ComponentSlotStyle<"link" | "list" | "separator" | "ellipsis" | "root" | "item", CSSPropObject<CSSSlotObject<"link" | "list" | "separator" | "ellipsis" | "root" | "item">>, {
5
5
  sm: {
6
6
  list: {
7
7
  fontSize: "sm";
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.types.js";
2
2
  import { CSSModifierObject, CSSPropObject, CSSSlotObject } from "../../core/css/index.types.js";
3
3
  //#region src/components/carousel/carousel.style.d.ts
4
- declare const carouselStyle: ComponentSlotStyle<"list" | "next" | "item" | "root" | "trigger" | "indicator" | "indicators" | "prev", CSSPropObject<CSSSlotObject<"list" | "next" | "item" | "root" | "trigger" | "indicator" | "indicators" | "prev">>, {
4
+ declare const carouselStyle: ComponentSlotStyle<"list" | "next" | "root" | "indicator" | "item" | "trigger" | "prev" | "indicators", CSSPropObject<CSSSlotObject<"list" | "next" | "root" | "indicator" | "item" | "trigger" | "prev" | "indicators">>, {
5
5
  sm: {
6
6
  root: {
7
7
  h: "sm";
@@ -17,7 +17,7 @@ declare const carouselStyle: ComponentSlotStyle<"list" | "next" | "item" | "root
17
17
  h: "lg";
18
18
  };
19
19
  };
20
- }, CSSModifierObject<CSSSlotObject<"list" | "next" | "item" | "root" | "trigger" | "indicator" | "indicators" | "prev">>>;
20
+ }, CSSModifierObject<CSSSlotObject<"list" | "next" | "root" | "indicator" | "item" | "trigger" | "prev" | "indicators">>>;
21
21
  type CarouselStyle = typeof carouselStyle;
22
22
  //#endregion
23
23
  export { CarouselStyle, carouselStyle };
@@ -63,7 +63,7 @@ interface CheckboxCardRootProps<Y extends string = string> extends Merge<HTMLSty
63
63
  */
64
64
  rootProps?: HTMLStyledProps<"label">;
65
65
  }
66
- declare const component: <H extends "fragment" | As = "div", R extends _$_yamada_ui_utils0.Dict = _$_yamada_ui_utils0.Dict<any>>(el: H | _$react.FC<R>, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"group" | "root" | "indicator" | "description" | "addon", {
66
+ declare const component: <H extends "fragment" | As = "div", R extends _$_yamada_ui_utils0.Dict = _$_yamada_ui_utils0.Dict<any>>(el: H | _$react.FC<R>, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"group" | "description" | "root" | "indicator" | "addon", {
67
67
  justify: {
68
68
  end: {
69
69
  addon: {
@@ -213,7 +213,7 @@ declare const component: <H extends "fragment" | As = "div", R extends _$_yamada
213
213
  name,
214
214
  className,
215
215
  ...options
216
- }?: ComponentOptions) => (initialProps?: InitialProps<R>, ...superProps: SuperProps<R>[]) => H extends "fragment" ? _$react.FunctionComponent<R> : Component<Exclude<H, "fragment">, R>, CheckboxCardPropsContext: _$react.Context<Partial<CheckboxCardRootProps<string>> | undefined>, useCheckboxCardPropsContext: () => Partial<CheckboxCardRootProps<string>> | undefined, useRootComponentProps: <Y extends _$_yamada_ui_utils0.Dict = {}, R extends keyof Y = keyof Y>(props: Y, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"group" | "root" | "indicator" | "description" | "addon", {
216
+ }?: ComponentOptions) => (initialProps?: InitialProps<R>, ...superProps: SuperProps<R>[]) => H extends "fragment" ? _$react.FunctionComponent<R> : Component<Exclude<H, "fragment">, R>, CheckboxCardPropsContext: _$react.Context<Partial<CheckboxCardRootProps<string>> | undefined>, useCheckboxCardPropsContext: () => Partial<CheckboxCardRootProps<string>> | undefined, useRootComponentProps: <Y extends _$_yamada_ui_utils0.Dict = {}, R extends keyof Y = keyof Y>(props: Y, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"group" | "description" | "root" | "indicator" | "addon", {
217
217
  justify: {
218
218
  end: {
219
219
  addon: {
@@ -363,7 +363,7 @@ declare const component: <H extends "fragment" | As = "div", R extends _$_yamada
363
363
  className,
364
364
  withContext,
365
365
  transferProps
366
- }?: UseComponentPropsOptions<R>) => [CSSSlotObject, Merge<WithoutThemeProps<Y, ComponentSlotStyle<"group" | "root" | "indicator" | "description" | "addon", {
366
+ }?: UseComponentPropsOptions<R>) => [CSSSlotObject, Merge<WithoutThemeProps<Y, ComponentSlotStyle<"group" | "description" | "root" | "indicator" | "addon", {
367
367
  justify: {
368
368
  end: {
369
369
  addon: {
@@ -1,6 +1,6 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.types.js";
2
2
  //#region src/components/checkbox-card/checkbox-card.style.d.ts
3
- declare const checkboxCardStyle: ComponentSlotStyle<"group" | "root" | "indicator" | "description" | "addon", {
3
+ declare const checkboxCardStyle: ComponentSlotStyle<"group" | "description" | "root" | "indicator" | "addon", {
4
4
  /**
5
5
  * The justify indicator of the component
6
6
  *
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.types.js";
2
2
  import { CSSPropObject, CSSSlotObject } from "../../core/css/index.types.js";
3
3
  //#region src/components/color-picker/color-picker.style.d.ts
4
- declare const colorPickerStyle: ComponentSlotStyle<"input" | "content" | "icon" | "root" | "field" | "colorSwatch" | "eyeDropper", CSSPropObject<CSSSlotObject<"input" | "content" | "icon" | "root" | "field" | "colorSwatch" | "eyeDropper">>, {
4
+ declare const colorPickerStyle: ComponentSlotStyle<"input" | "content" | "icon" | "field" | "root" | "colorSwatch" | "eyeDropper", CSSPropObject<CSSSlotObject<"input" | "content" | "icon" | "field" | "root" | "colorSwatch" | "eyeDropper">>, {
5
5
  xs: {
6
6
  field: {
7
7
  fontSize: "1em";
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.types.js";
2
2
  import { CSSModifierObject, CSSSlotObject } from "../../core/css/index.types.js";
3
3
  //#region src/components/color-selector/color-selector.style.d.ts
4
- declare const colorSelectorStyle: ComponentSlotStyle<"root" | "hueSlider" | "saturationSlider" | "eyeDropper" | "alphaSlider" | "colorSwatchGroup" | "colorSwatchGroupLabel" | "colorSwatchItem", {
4
+ declare const colorSelectorStyle: ComponentSlotStyle<"root" | "hueSlider" | "saturationSlider" | "eyeDropper" | "colorSwatchGroupLabel" | "alphaSlider" | "colorSwatchGroup" | "colorSwatchItem", {
5
5
  /**
6
6
  * The shape of the thumb and color swatch.
7
7
  *
@@ -22,7 +22,7 @@ declare const colorSelectorStyle: ComponentSlotStyle<"root" | "hueSlider" | "sat
22
22
  md: {};
23
23
  lg: {};
24
24
  xl: {};
25
- }, CSSModifierObject<CSSSlotObject<"root" | "hueSlider" | "saturationSlider" | "eyeDropper" | "alphaSlider" | "colorSwatchGroup" | "colorSwatchGroupLabel" | "colorSwatchItem">>>;
25
+ }, CSSModifierObject<CSSSlotObject<"root" | "hueSlider" | "saturationSlider" | "eyeDropper" | "colorSwatchGroupLabel" | "alphaSlider" | "colorSwatchGroup" | "colorSwatchItem">>>;
26
26
  type ColorSelectorStyle = typeof colorSelectorStyle;
27
27
  //#endregion
28
28
  export { ColorSelectorStyle, colorSelectorStyle };
@@ -1,6 +1,6 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.types.js";
2
2
  //#region src/components/data-list/data-list.style.d.ts
3
- declare const dataListStyle: ComponentSlotStyle<"term" | "item" | "root" | "description", {
3
+ declare const dataListStyle: ComponentSlotStyle<"term" | "description" | "root" | "item", {
4
4
  /**
5
5
  * The orientation of the data list.
6
6
  *
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.types.js";
2
2
  import { CSSPropObject, CSSSlotObject } from "../../core/css/index.types.js";
3
3
  //#region src/components/date-picker/date-picker.style.d.ts
4
- declare const datePickerStyle: ComponentSlotStyle<"input" | "content" | "separator" | "icon" | "root" | "field" | "adjust", CSSPropObject<CSSSlotObject<"input" | "content" | "separator" | "icon" | "root" | "field" | "adjust">>, {
4
+ declare const datePickerStyle: ComponentSlotStyle<"input" | "content" | "separator" | "icon" | "field" | "root" | "adjust", CSSPropObject<CSSSlotObject<"input" | "content" | "separator" | "icon" | "field" | "root" | "adjust">>, {
5
5
  xs: {
6
6
  field: {
7
7
  fontSize: "1em";
@@ -41,7 +41,7 @@ declare const DropzoneRoot: Component<({
41
41
  loadingProps,
42
42
  overlayProps,
43
43
  ...rest
44
- }: WithoutThemeProps<DropzoneRootProps, ComponentSlotStyle<"title" | "overlay" | "loading" | "icon" | "root" | "description", CSSPropObject<CSSSlotObject<"title" | "overlay" | "loading" | "icon" | "root" | "description">>, {
44
+ }: WithoutThemeProps<DropzoneRootProps, ComponentSlotStyle<"title" | "overlay" | "loading" | "icon" | "description" | "root", CSSPropObject<CSSSlotObject<"title" | "overlay" | "loading" | "icon" | "description" | "root">>, {
45
45
  xs: {
46
46
  root: {
47
47
  minH: "xs";
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.types.js";
2
2
  import { CSSPropObject, CSSSlotObject } from "../../core/css/index.types.js";
3
3
  //#region src/components/dropzone/dropzone.style.d.ts
4
- declare const dropzoneStyle: ComponentSlotStyle<"title" | "overlay" | "loading" | "icon" | "root" | "description", CSSPropObject<CSSSlotObject<"title" | "overlay" | "loading" | "icon" | "root" | "description">>, {
4
+ declare const dropzoneStyle: ComponentSlotStyle<"title" | "overlay" | "loading" | "icon" | "description" | "root", CSSPropObject<CSSSlotObject<"title" | "overlay" | "loading" | "icon" | "description" | "root">>, {
5
5
  xs: {
6
6
  root: {
7
7
  minH: "xs";
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.types.js";
2
2
  import { CSSModifierObject, CSSPropObject, CSSSlotObject } from "../../core/css/index.types.js";
3
3
  //#region src/components/empty-state/empty-state.style.d.ts
4
- declare const emptyState: ComponentSlotStyle<"title" | "content" | "root" | "indicator" | "description", CSSPropObject<CSSSlotObject<"title" | "content" | "root" | "indicator" | "description">>, {
4
+ declare const emptyState: ComponentSlotStyle<"title" | "content" | "description" | "root" | "indicator", CSSPropObject<CSSSlotObject<"title" | "content" | "description" | "root" | "indicator">>, {
5
5
  sm: {
6
6
  content: {
7
7
  gap: "xs";
@@ -47,7 +47,7 @@ declare const emptyState: ComponentSlotStyle<"title" | "content" | "root" | "ind
47
47
  fontSize: "xl";
48
48
  };
49
49
  };
50
- }, CSSModifierObject<CSSSlotObject<"title" | "content" | "root" | "indicator" | "description">>>;
50
+ }, CSSModifierObject<CSSSlotObject<"title" | "content" | "description" | "root" | "indicator">>>;
51
51
  type EmptyState = typeof emptyState;
52
52
  //#endregion
53
53
  export { EmptyState, emptyState };
@@ -82,7 +82,7 @@ declare const Flip: Component<({
82
82
  onChange,
83
83
  onClick: onClickProp,
84
84
  ...rest
85
- }: WithoutThemeProps<FlipProps, ComponentSlotStyle<"from" | "to" | "item" | "root", CSSPropObject<CSSSlotObject<"from" | "to" | "item" | "root">>, CSSModifierObject<CSSSlotObject<"from" | "to" | "item" | "root">>, CSSModifierObject<CSSSlotObject<"from" | "to" | "item" | "root">>>, keyof FlipProps>) => _$react_jsx_runtime0.JSX.Element, FlipProps>;
85
+ }: WithoutThemeProps<FlipProps, ComponentSlotStyle<"from" | "to" | "root" | "item", CSSPropObject<CSSSlotObject<"from" | "to" | "root" | "item">>, CSSModifierObject<CSSSlotObject<"from" | "to" | "root" | "item">>, CSSModifierObject<CSSSlotObject<"from" | "to" | "root" | "item">>>, keyof FlipProps>) => _$react_jsx_runtime0.JSX.Element, FlipProps>;
86
86
  //#endregion
87
87
  export { Flip, FlipProps, FlipPropsContext, useFlipPropsContext };
88
88
  //# sourceMappingURL=flip.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.types.js";
2
2
  import { CSSModifierObject, CSSPropObject, CSSSlotObject } from "../../core/css/index.types.js";
3
3
  //#region src/components/flip/flip.style.d.ts
4
- declare const flipStyle: ComponentSlotStyle<"from" | "to" | "item" | "root", CSSPropObject<CSSSlotObject<"from" | "to" | "item" | "root">>, CSSModifierObject<CSSSlotObject<"from" | "to" | "item" | "root">>, CSSModifierObject<CSSSlotObject<"from" | "to" | "item" | "root">>>;
4
+ declare const flipStyle: ComponentSlotStyle<"from" | "to" | "root" | "item", CSSPropObject<CSSSlotObject<"from" | "to" | "root" | "item">>, CSSModifierObject<CSSSlotObject<"from" | "to" | "root" | "item">>, CSSModifierObject<CSSSlotObject<"from" | "to" | "root" | "item">>>;
5
5
  type FlipStyle = typeof flipStyle;
6
6
  //#endregion
7
7
  export { FlipStyle, flipStyle };
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.types.js";
2
2
  import { CSSPropObject, CSSSlotObject } from "../../core/css/index.types.js";
3
3
  //#region src/components/form/form.style.d.ts
4
- declare const formStyle: ComponentSlotStyle<"body" | "footer" | "header" | "title" | "group" | "root" | "description" | "submitButton", CSSPropObject<CSSSlotObject<"body" | "footer" | "header" | "title" | "group" | "root" | "description" | "submitButton">>, {
4
+ declare const formStyle: ComponentSlotStyle<"body" | "footer" | "header" | "title" | "group" | "description" | "root" | "submitButton", CSSPropObject<CSSSlotObject<"body" | "footer" | "header" | "title" | "group" | "description" | "root" | "submitButton">>, {
5
5
  sm: {
6
6
  body: {
7
7
  gap: "5";
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.types.js";
2
2
  import { CSSModifierObject, CSSSlotObject } from "../../core/css/index.types.js";
3
3
  //#region src/components/list/list.style.d.ts
4
- declare const listStyle: ComponentSlotStyle<"icon" | "item" | "root", {
4
+ declare const listStyle: ComponentSlotStyle<"icon" | "root" | "item", {
5
5
  styleType: {
6
6
  circle: {
7
7
  root: {
@@ -35,7 +35,7 @@ declare const listStyle: ComponentSlotStyle<"icon" | "item" | "root", {
35
35
  };
36
36
  };
37
37
  };
38
- }, CSSModifierObject<CSSSlotObject<"icon" | "item" | "root">>, CSSModifierObject<CSSSlotObject<"icon" | "item" | "root">>>;
38
+ }, CSSModifierObject<CSSSlotObject<"icon" | "root" | "item">>, CSSModifierObject<CSSSlotObject<"icon" | "root" | "item">>>;
39
39
  type ListStyle = typeof listStyle;
40
40
  //#endregion
41
41
  export { ListStyle, listStyle };
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.types.js";
2
2
  import { CSSModifierObject, CSSPropObject, CSSSlotObject } from "../../core/css/index.types.js";
3
3
  //#region src/components/menu/menu.style.d.ts
4
- declare const menuStyle: ComponentSlotStyle<"footer" | "header" | "label" | "content" | "command" | "group" | "separator" | "item" | "indicator", CSSPropObject<CSSSlotObject<"footer" | "header" | "label" | "content" | "command" | "group" | "separator" | "item" | "indicator">>, {
4
+ declare const menuStyle: ComponentSlotStyle<"footer" | "header" | "label" | "content" | "command" | "group" | "separator" | "indicator" | "item", CSSPropObject<CSSSlotObject<"footer" | "header" | "label" | "content" | "command" | "group" | "separator" | "indicator" | "item">>, {
5
5
  sm: {
6
6
  command: {
7
7
  fontSize: "2xs";
@@ -86,7 +86,7 @@ declare const menuStyle: ComponentSlotStyle<"footer" | "header" | "label" | "con
86
86
  px: "2";
87
87
  };
88
88
  };
89
- }, CSSModifierObject<CSSSlotObject<"footer" | "header" | "label" | "content" | "command" | "group" | "separator" | "item" | "indicator">>>;
89
+ }, CSSModifierObject<CSSSlotObject<"footer" | "header" | "label" | "content" | "command" | "group" | "separator" | "indicator" | "item">>>;
90
90
  type MenuStyle = typeof menuStyle;
91
91
  //#endregion
92
92
  export { MenuStyle, menuStyle };
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.types.js";
2
2
  import { CSSModifierObject, CSSSlotObject } from "../../core/css/index.types.js";
3
3
  //#region src/components/native-accordion/native-accordion.style.d.ts
4
- declare const nativeAccordionStyle: ComponentSlotStyle<"button" | "panel" | "icon" | "item" | "root", {
4
+ declare const nativeAccordionStyle: ComponentSlotStyle<"button" | "panel" | "icon" | "root" | "item", {
5
5
  /**
6
6
  * If `true`, animate the accordion items when they are expanded or collapsed.
7
7
  *
@@ -31,7 +31,7 @@ declare const nativeAccordionStyle: ComponentSlotStyle<"button" | "panel" | "ico
31
31
  };
32
32
  };
33
33
  };
34
- }, CSSModifierObject<CSSSlotObject<"button" | "panel" | "icon" | "item" | "root">>, {
34
+ }, CSSModifierObject<CSSSlotObject<"button" | "panel" | "icon" | "root" | "item">>, {
35
35
  panel: {
36
36
  button: {
37
37
  rounded: "l2";
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.types.js";
2
2
  import { CSSPropObject, CSSSlotObject } from "../../core/css/index.types.js";
3
3
  //#region src/components/native-select/native-select.style.d.ts
4
- declare const nativeSelectStyle: ComponentSlotStyle<"icon" | "root" | "field", CSSPropObject<CSSSlotObject<"icon" | "root" | "field">>, {
4
+ declare const nativeSelectStyle: ComponentSlotStyle<"icon" | "field" | "root", CSSPropObject<CSSSlotObject<"icon" | "field" | "root">>, {
5
5
  xs: {
6
6
  field: {
7
7
  fontSize: "1em";
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.types.js";
2
2
  import { CSSModifierObject, CSSPropObject, CSSSlotObject } from "../../core/css/index.types.js";
3
3
  //#region src/components/notice/notice.style.d.ts
4
- declare const noticeStyle: ComponentSlotStyle<"content" | "item" | "root" | "closeButton", CSSPropObject<CSSSlotObject<"content" | "item" | "root" | "closeButton">>, CSSModifierObject<CSSSlotObject<"content" | "item" | "root" | "closeButton">>, CSSModifierObject<CSSSlotObject<"content" | "item" | "root" | "closeButton">>>;
4
+ declare const noticeStyle: ComponentSlotStyle<"content" | "root" | "item" | "closeButton", CSSPropObject<CSSSlotObject<"content" | "root" | "item" | "closeButton">>, CSSModifierObject<CSSSlotObject<"content" | "root" | "item" | "closeButton">>, CSSModifierObject<CSSSlotObject<"content" | "root" | "item" | "closeButton">>>;
5
5
  type NoticeStyle = typeof noticeStyle;
6
6
  //#endregion
7
7
  export { NoticeStyle };
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.types.js";
2
2
  import { CSSPropObject, CSSSlotObject } from "../../core/css/index.types.js";
3
3
  //#region src/components/number-input/number-input.style.d.ts
4
- declare const numberInputStyle: ComponentSlotStyle<"button" | "root" | "field" | "control" | "decrement" | "increment", CSSPropObject<CSSSlotObject<"button" | "root" | "field" | "control" | "decrement" | "increment">>, {
4
+ declare const numberInputStyle: ComponentSlotStyle<"button" | "field" | "root" | "control" | "decrement" | "increment", CSSPropObject<CSSSlotObject<"button" | "field" | "root" | "control" | "decrement" | "increment">>, {
5
5
  xs: {
6
6
  control: {
7
7
  boxSize: "calc({--height} - {spaces.2})";
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.types.js";
2
2
  import { CSSPropObject, CSSSlotObject } from "../../core/css/index.types.js";
3
3
  //#region src/components/pagination/pagination.style.d.ts
4
- declare const paginationStyle: ComponentSlotStyle<"text" | "item" | "root", CSSPropObject<CSSSlotObject<"text" | "item" | "root">>, {
4
+ declare const paginationStyle: ComponentSlotStyle<"text" | "root" | "item", CSSPropObject<CSSSlotObject<"text" | "root" | "item">>, {
5
5
  xs: {
6
6
  item: {
7
7
  fontSize: "{font-size}";
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.types.js";
2
2
  import { CSSPropObject, CSSSlotObject } from "../../core/css/index.types.js";
3
3
  //#region src/components/password-input/password-input.style.d.ts
4
- declare const passwordInputStyle: ComponentSlotStyle<"button" | "root" | "field", CSSPropObject<CSSSlotObject<"button" | "root" | "field">>, {
4
+ declare const passwordInputStyle: ComponentSlotStyle<"button" | "field" | "root", CSSPropObject<CSSSlotObject<"button" | "field" | "root">>, {
5
5
  xs: {
6
6
  button: {
7
7
  boxSize: "calc({--height} - {spaces.2})";
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.types.js";
2
2
  import { CSSPropObject, CSSSlotObject } from "../../core/css/index.types.js";
3
3
  //#region src/components/pin-input/pin-input.style.d.ts
4
- declare const pinInputStyle: ComponentSlotStyle<"root" | "field", CSSPropObject<CSSSlotObject<"root" | "field">>, {
4
+ declare const pinInputStyle: ComponentSlotStyle<"field" | "root", CSSPropObject<CSSSlotObject<"field" | "root">>, {
5
5
  xs: {
6
6
  field: {
7
7
  boxSize: string | undefined;
@@ -55,7 +55,7 @@ interface RadioCardRootProps<Y extends string = string> extends Merge<HTMLStyled
55
55
  */
56
56
  rootProps?: HTMLStyledProps<"label">;
57
57
  }
58
- declare const component: <H extends "fragment" | As = "div", R extends _$_yamada_ui_utils0.Dict = _$_yamada_ui_utils0.Dict<any>>(el: H | _$react.FC<R>, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"group" | "root" | "indicator" | "description" | "addon", {
58
+ declare const component: <H extends "fragment" | As = "div", R extends _$_yamada_ui_utils0.Dict = _$_yamada_ui_utils0.Dict<any>>(el: H | _$react.FC<R>, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"group" | "description" | "root" | "indicator" | "addon", {
59
59
  justify: {
60
60
  end: {
61
61
  addon: {
@@ -232,7 +232,7 @@ declare const component: <H extends "fragment" | As = "div", R extends _$_yamada
232
232
  name,
233
233
  className,
234
234
  ...options
235
- }?: ComponentOptions) => (initialProps?: InitialProps<R>, ...superProps: SuperProps<R>[]) => H extends "fragment" ? _$react.FunctionComponent<R> : Component<Exclude<H, "fragment">, R>, RadioCardPropsContext: _$react.Context<Partial<RadioCardRootProps<string>> | undefined>, useRadioCardPropsContext: () => Partial<RadioCardRootProps<string>> | undefined, useRootComponentProps: <Y extends _$_yamada_ui_utils0.Dict = {}, R extends keyof Y = keyof Y>(props: Y, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"group" | "root" | "indicator" | "description" | "addon", {
235
+ }?: ComponentOptions) => (initialProps?: InitialProps<R>, ...superProps: SuperProps<R>[]) => H extends "fragment" ? _$react.FunctionComponent<R> : Component<Exclude<H, "fragment">, R>, RadioCardPropsContext: _$react.Context<Partial<RadioCardRootProps<string>> | undefined>, useRadioCardPropsContext: () => Partial<RadioCardRootProps<string>> | undefined, useRootComponentProps: <Y extends _$_yamada_ui_utils0.Dict = {}, R extends keyof Y = keyof Y>(props: Y, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"group" | "description" | "root" | "indicator" | "addon", {
236
236
  justify: {
237
237
  end: {
238
238
  addon: {
@@ -409,7 +409,7 @@ declare const component: <H extends "fragment" | As = "div", R extends _$_yamada
409
409
  className,
410
410
  withContext,
411
411
  transferProps
412
- }?: UseComponentPropsOptions<R>) => [CSSSlotObject, Merge<WithoutThemeProps<Y, ComponentSlotStyle<"group" | "root" | "indicator" | "description" | "addon", {
412
+ }?: UseComponentPropsOptions<R>) => [CSSSlotObject, Merge<WithoutThemeProps<Y, ComponentSlotStyle<"group" | "description" | "root" | "indicator" | "addon", {
413
413
  justify: {
414
414
  end: {
415
415
  addon: {
@@ -1,6 +1,6 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.types.js";
2
2
  //#region src/components/radio-card/radio-card.style.d.ts
3
- declare const radioCardStyle: ComponentSlotStyle<"group" | "root" | "indicator" | "description" | "addon", {
3
+ declare const radioCardStyle: ComponentSlotStyle<"group" | "description" | "root" | "indicator" | "addon", {
4
4
  /**
5
5
  * The justify indicator of the component
6
6
  *
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.types.js";
2
2
  import { CSSModifierObject, CSSPropObject, CSSSlotObject } from "../../core/css/index.types.js";
3
3
  //#region src/components/rating/rating.style.d.ts
4
- declare const ratingStyle: ComponentSlotStyle<"group" | "icon" | "item" | "root", CSSPropObject<CSSSlotObject<"group" | "icon" | "item" | "root">>, {
4
+ declare const ratingStyle: ComponentSlotStyle<"group" | "icon" | "root" | "item", CSSPropObject<CSSSlotObject<"group" | "icon" | "root" | "item">>, {
5
5
  xs: {
6
6
  icon: {
7
7
  fontSize: "md";
@@ -27,7 +27,7 @@ declare const ratingStyle: ComponentSlotStyle<"group" | "icon" | "item" | "root"
27
27
  fontSize: "3xl";
28
28
  };
29
29
  };
30
- }, CSSModifierObject<CSSSlotObject<"group" | "icon" | "item" | "root">>>;
30
+ }, CSSModifierObject<CSSSlotObject<"group" | "icon" | "root" | "item">>>;
31
31
  type RatingStyle = typeof ratingStyle;
32
32
  //#endregion
33
33
  export { RatingStyle, ratingStyle };
@@ -1,6 +1,6 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.types.js";
2
2
  //#region src/components/reorder/reorder.style.d.ts
3
- declare const reorderStyle: ComponentSlotStyle<"item" | "root" | "trigger", {
3
+ declare const reorderStyle: ComponentSlotStyle<"root" | "item" | "trigger", {
4
4
  /**
5
5
  * The orientation of the reorder.
6
6
  *
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.types.js";
2
2
  import { CSSModifierObject, CSSSlotObject } from "../../core/css/index.types.js";
3
3
  //#region src/components/resizable/resizable.style.d.ts
4
- declare const resizableStyle: ComponentSlotStyle<"icon" | "item" | "root" | "trigger", {
4
+ declare const resizableStyle: ComponentSlotStyle<"icon" | "root" | "item" | "trigger", {
5
5
  /**
6
6
  * The orientation of the resizable.
7
7
  *
@@ -19,7 +19,7 @@ declare const resizableStyle: ComponentSlotStyle<"icon" | "item" | "root" | "tri
19
19
  };
20
20
  };
21
21
  };
22
- }, CSSModifierObject<CSSSlotObject<"icon" | "item" | "root" | "trigger">>, {
22
+ }, CSSModifierObject<CSSSlotObject<"icon" | "root" | "item" | "trigger">>, {
23
23
  border: {
24
24
  icon: {
25
25
  bg: "colorScheme.muted";
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.types.js";
2
2
  import { CSSModifierObject, CSSSlotObject } from "../../core/css/index.types.js";
3
3
  //#region src/components/segmented-control/segmented-control.style.d.ts
4
- declare const segmentedControlStyle: ComponentSlotStyle<"item" | "root" | "indicator", {
4
+ declare const segmentedControlStyle: ComponentSlotStyle<"root" | "indicator" | "item", {
5
5
  /**
6
6
  * If `true`, the segmented control will be full rounded.
7
7
  *
@@ -113,7 +113,7 @@ declare const segmentedControlStyle: ComponentSlotStyle<"item" | "root" | "indic
113
113
  };
114
114
  };
115
115
  };
116
- }, CSSModifierObject<CSSSlotObject<"item" | "root" | "indicator">>>;
116
+ }, CSSModifierObject<CSSSlotObject<"root" | "indicator" | "item">>>;
117
117
  type SegmentedControlStyle = typeof segmentedControlStyle;
118
118
  //#endregion
119
119
  export { SegmentedControlStyle, segmentedControlStyle };
@@ -1,6 +1,6 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.types.js";
2
2
  //#region src/components/select/select.style.d.ts
3
- declare const selectStyle: ComponentSlotStyle<"label" | "option" | "content" | "group" | "separator" | "icon" | "root" | "indicator" | "field" | "valueText", {
3
+ declare const selectStyle: ComponentSlotStyle<"label" | "option" | "content" | "group" | "separator" | "icon" | "field" | "root" | "indicator" | "valueText", {
4
4
  /**
5
5
  * If `true`, wrap the value text.
6
6
  *
@@ -1,6 +1,6 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.types.js";
2
2
  //#region src/components/steps/steps.style.d.ts
3
- declare const stepsStyle: ComponentSlotStyle<"title" | "list" | "separator" | "item" | "root" | "indicator" | "description", {
3
+ declare const stepsStyle: ComponentSlotStyle<"title" | "list" | "separator" | "description" | "root" | "indicator" | "item", {
4
4
  /**
5
5
  * The orientation of the steps.
6
6
  *
@@ -166,7 +166,6 @@ interface UseStepsItemProps extends HTMLProps<"li"> {
166
166
  index: number;
167
167
  }
168
168
  declare const useStepsItem: ({
169
- "aria-labelledby": ariaLabelledbyProp,
170
169
  index,
171
170
  ...rest
172
171
  }: UseStepsItemProps) => {
@@ -1,6 +1,6 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.types.js";
2
2
  //#region src/components/tag/tag.style.d.ts
3
- declare const tagStyle: ComponentSlotStyle<"content" | "icon" | "root" | "closeButton" | "endIcon" | "startIcon", {
3
+ declare const tagStyle: ComponentSlotStyle<"content" | "icon" | "root" | "endIcon" | "startIcon" | "closeButton", {
4
4
  /**
5
5
  * If `true`, the tag is full rounded. Else, it'll be slightly round.
6
6
  *
@@ -69,7 +69,7 @@ declare const TimelineRoot: Component<({
69
69
  index,
70
70
  items,
71
71
  ...rest
72
- }: WithoutThemeProps<TimelineRootProps, ComponentSlotStyle<"title" | "content" | "item" | "root" | "indicator" | "description" | "connector", {
72
+ }: WithoutThemeProps<TimelineRootProps, ComponentSlotStyle<"title" | "content" | "description" | "root" | "indicator" | "item" | "connector", {
73
73
  align: {
74
74
  center: {
75
75
  content: {
@@ -1,6 +1,6 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.types.js";
2
2
  //#region src/components/timeline/timeline.style.d.ts
3
- declare const timelineStyle: ComponentSlotStyle<"title" | "content" | "item" | "root" | "indicator" | "description" | "connector", {
3
+ declare const timelineStyle: ComponentSlotStyle<"title" | "content" | "description" | "root" | "indicator" | "item" | "connector", {
4
4
  /**
5
5
  * The alignment of the timeline.
6
6
  *
@@ -1,6 +1,6 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.types.js";
2
2
  //#region src/components/tree/tree.style.d.ts
3
- declare const treeStyle: ComponentSlotStyle<"label" | "checkbox" | "group" | "end" | "start" | "element" | "item" | "root" | "indicator", {
3
+ declare const treeStyle: ComponentSlotStyle<"label" | "checkbox" | "group" | "end" | "start" | "element" | "root" | "indicator" | "item", {
4
4
  /**
5
5
  * The shape of the component
6
6
  *
@@ -134,7 +134,7 @@ declare const I18nContext: _$react.Context<I18nContext<{
134
134
  readonly toggle: {
135
135
  readonly "Toggle button": "Toggle button";
136
136
  };
137
- }, "progress.Loading..." | "progress.{value} percent" | "select.Clear value" | "table.Clear sorting" | "table.Page size" | "table.Select all rows" | "table.Select row" | "table.Sort ascending" | "table.Sort descending" | "toggle.Toggle button" | "slider.Slider thumb" | "modal.Close modal" | "modal.Open modal" | "sidebar.Close sidebar" | "sidebar.Open sidebar" | "closeButton.Close" | "actionBar.Close action bar" | "actionBar.Open action bar" | "autocomplete.Clear value" | "autocomplete.No results found" | "avatar.Avatar Icon" | "breadcrumb.Breadcrumb" | "breadcrumb.Ellipsis" | "calendar.Choose the month" | "calendar.Choose the year" | "calendar.Go to the next month" | "calendar.Go to the previous month" | "calendar.Today" | "carousel.Go to next slide" | "carousel.Go to previous slide" | "carousel.Go to {page} slide" | "carousel.Slides" | "carousel.{page} of {total}" | "colorPicker.Pick a color" | "colorSelector.Pick a color" | "colorSwatch.Color swatch group" | "datePicker.Clear value" | "hueSlider.Blue" | "hueSlider.Cyan" | "hueSlider.Green" | "hueSlider.Magenta" | "hueSlider.Red" | "hueSlider.Yellow" | "numberInput.Decrease" | "numberInput.Increase" | "pagination.Go to first page" | "pagination.Go to last page" | "pagination.Go to next page" | "pagination.Go to page {value}" | "pagination.Go to previous page" | "pagination.Pagination" | "pagination.{value} / {total}" | "pagination.{value} of {total}" | "passwordInput.Password strength meter" | "passwordInput.Toggle password visibility" | "saturationSlider.Saturation and brightness thumb" | "saturationSlider.Saturation {saturation}%, Brightness {brightness}%" | "stat.Decreased by" | "stat.Increased by" | "tag.Close tag">>;
137
+ }, "progress.Loading..." | "progress.{value} percent" | "select.Clear value" | "table.Clear sorting" | "table.Page size" | "table.Select all rows" | "table.Select row" | "table.Sort ascending" | "table.Sort descending" | "toggle.Toggle button" | "slider.Slider thumb" | "modal.Close modal" | "modal.Open modal" | "actionBar.Close action bar" | "actionBar.Open action bar" | "autocomplete.Clear value" | "autocomplete.No results found" | "avatar.Avatar Icon" | "breadcrumb.Breadcrumb" | "breadcrumb.Ellipsis" | "calendar.Choose the month" | "calendar.Choose the year" | "calendar.Go to the next month" | "calendar.Go to the previous month" | "calendar.Today" | "carousel.Go to next slide" | "carousel.Go to previous slide" | "carousel.Go to {page} slide" | "carousel.Slides" | "carousel.{page} of {total}" | "closeButton.Close" | "colorPicker.Pick a color" | "colorSelector.Pick a color" | "colorSwatch.Color swatch group" | "datePicker.Clear value" | "hueSlider.Blue" | "hueSlider.Cyan" | "hueSlider.Green" | "hueSlider.Magenta" | "hueSlider.Red" | "hueSlider.Yellow" | "numberInput.Decrease" | "numberInput.Increase" | "pagination.Go to first page" | "pagination.Go to last page" | "pagination.Go to next page" | "pagination.Go to page {value}" | "pagination.Go to previous page" | "pagination.Pagination" | "pagination.{value} / {total}" | "pagination.{value} of {total}" | "passwordInput.Password strength meter" | "passwordInput.Toggle password visibility" | "saturationSlider.Saturation and brightness thumb" | "saturationSlider.Saturation {saturation}%, Brightness {brightness}%" | "sidebar.Close sidebar" | "sidebar.Open sidebar" | "stat.Decreased by" | "stat.Increased by" | "tag.Close tag">>;
138
138
  interface I18nProviderProps {
139
139
  children?: ReactNode;
140
140
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@yamada-ui/react",
3
3
  "type": "module",
4
- "version": "2.3.0-next-20260517014349",
4
+ "version": "2.3.0-next-20260517154550",
5
5
  "description": "React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion",
6
6
  "keywords": [
7
7
  "yamada",