@yamada-ui/react 2.2.8-dev-20260831222310 → 2.2.8-dev-20260901175238

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 (81) hide show
  1. package/dist/cjs/components/action-bar/action-bar.cjs.map +1 -1
  2. package/dist/cjs/components/action-bar/use-action-bar.cjs.map +1 -1
  3. package/dist/cjs/components/avatar/use-avatar.cjs.map +1 -1
  4. package/dist/cjs/components/carousel/use-carousel.cjs.map +1 -1
  5. package/dist/cjs/components/chart/use-cartesian-chart.cjs.map +1 -1
  6. package/dist/cjs/components/chart/use-polar-chart.cjs.map +1 -1
  7. package/dist/cjs/components/icon/icons/audio-lines-off-icon.cjs +14 -0
  8. package/dist/cjs/components/icon/icons/audio-lines-off-icon.cjs.map +1 -0
  9. package/dist/cjs/components/icon/icons/car-battery-icon.cjs +14 -0
  10. package/dist/cjs/components/icon/icons/car-battery-icon.cjs.map +1 -0
  11. package/dist/cjs/components/icon/icons/index.cjs +27 -0
  12. package/dist/cjs/components/icon/icons/index.cjs.map +1 -1
  13. package/dist/cjs/components/icon/icons/list-clock-icon.cjs +14 -0
  14. package/dist/cjs/components/icon/icons/list-clock-icon.cjs.map +1 -0
  15. package/dist/cjs/components/icon/icons/midi-port-icon.cjs +14 -0
  16. package/dist/cjs/components/icon/icons/midi-port-icon.cjs.map +1 -0
  17. package/dist/cjs/components/icon/icons/mop-icon.cjs +14 -0
  18. package/dist/cjs/components/icon/icons/mop-icon.cjs.map +1 -0
  19. package/dist/cjs/components/icon/icons/mop-sparkles-icon.cjs +14 -0
  20. package/dist/cjs/components/icon/icons/mop-sparkles-icon.cjs.map +1 -0
  21. package/dist/cjs/components/icon/icons/square-dimensions-icon.cjs +14 -0
  22. package/dist/cjs/components/icon/icons/square-dimensions-icon.cjs.map +1 -0
  23. package/dist/cjs/components/icon/icons/square-text-icon.cjs +14 -0
  24. package/dist/cjs/components/icon/icons/square-text-icon.cjs.map +1 -0
  25. package/dist/cjs/components/icon/icons/usb-c-port-icon.cjs +14 -0
  26. package/dist/cjs/components/icon/icons/usb-c-port-icon.cjs.map +1 -0
  27. package/dist/cjs/components/icon/index.cjs +18 -0
  28. package/dist/cjs/components/sidebar/sidebar.cjs.map +1 -1
  29. package/dist/cjs/components/sidebar/use-sidebar.cjs.map +1 -1
  30. package/dist/cjs/components/tree/tree.cjs.map +1 -1
  31. package/dist/cjs/index.cjs +27 -0
  32. package/dist/cjs/utils/dom.cjs.map +1 -1
  33. package/dist/esm/components/action-bar/action-bar.js.map +1 -1
  34. package/dist/esm/components/action-bar/use-action-bar.js.map +1 -1
  35. package/dist/esm/components/avatar/use-avatar.js.map +1 -1
  36. package/dist/esm/components/carousel/use-carousel.js.map +1 -1
  37. package/dist/esm/components/chart/use-cartesian-chart.js.map +1 -1
  38. package/dist/esm/components/chart/use-polar-chart.js.map +1 -1
  39. package/dist/esm/components/icon/icons/audio-lines-off-icon.js +14 -0
  40. package/dist/esm/components/icon/icons/audio-lines-off-icon.js.map +1 -0
  41. package/dist/esm/components/icon/icons/car-battery-icon.js +14 -0
  42. package/dist/esm/components/icon/icons/car-battery-icon.js.map +1 -0
  43. package/dist/esm/components/icon/icons/index.js +19 -1
  44. package/dist/esm/components/icon/icons/index.js.map +1 -1
  45. package/dist/esm/components/icon/icons/list-clock-icon.js +14 -0
  46. package/dist/esm/components/icon/icons/list-clock-icon.js.map +1 -0
  47. package/dist/esm/components/icon/icons/midi-port-icon.js +14 -0
  48. package/dist/esm/components/icon/icons/midi-port-icon.js.map +1 -0
  49. package/dist/esm/components/icon/icons/mop-icon.js +14 -0
  50. package/dist/esm/components/icon/icons/mop-icon.js.map +1 -0
  51. package/dist/esm/components/icon/icons/mop-sparkles-icon.js +14 -0
  52. package/dist/esm/components/icon/icons/mop-sparkles-icon.js.map +1 -0
  53. package/dist/esm/components/icon/icons/square-dimensions-icon.js +14 -0
  54. package/dist/esm/components/icon/icons/square-dimensions-icon.js.map +1 -0
  55. package/dist/esm/components/icon/icons/square-text-icon.js +14 -0
  56. package/dist/esm/components/icon/icons/square-text-icon.js.map +1 -0
  57. package/dist/esm/components/icon/icons/usb-c-port-icon.js +14 -0
  58. package/dist/esm/components/icon/icons/usb-c-port-icon.js.map +1 -0
  59. package/dist/esm/components/icon/index.js +10 -1
  60. package/dist/esm/components/sidebar/sidebar.js.map +1 -1
  61. package/dist/esm/components/sidebar/use-sidebar.js.map +1 -1
  62. package/dist/esm/components/tree/tree.js.map +1 -1
  63. package/dist/esm/index.js +19 -1
  64. package/dist/esm/utils/dom.js.map +1 -1
  65. package/dist/types/components/chart/polar-chart.style.d.ts +1 -1
  66. package/dist/types/components/icon/icons/audio-lines-off-icon.d.ts +13 -0
  67. package/dist/types/components/icon/icons/car-battery-icon.d.ts +13 -0
  68. package/dist/types/components/icon/icons/index.d.ts +11 -2
  69. package/dist/types/components/icon/icons/index.types.d.ts +1 -1
  70. package/dist/types/components/icon/icons/list-clock-icon.d.ts +13 -0
  71. package/dist/types/components/icon/icons/midi-port-icon.d.ts +13 -0
  72. package/dist/types/components/icon/icons/mop-icon.d.ts +13 -0
  73. package/dist/types/components/icon/icons/mop-sparkles-icon.d.ts +13 -0
  74. package/dist/types/components/icon/icons/square-dimensions-icon.d.ts +13 -0
  75. package/dist/types/components/icon/icons/square-text-icon.d.ts +13 -0
  76. package/dist/types/components/icon/icons/usb-c-port-icon.d.ts +13 -0
  77. package/dist/types/components/icon/index.d.ts +10 -1
  78. package/dist/types/components/number-input/number-input.style.d.ts +1 -1
  79. package/dist/types/components/sidebar/sidebar.d.ts +1 -1
  80. package/dist/types/index.d.ts +12 -3
  81. package/package.json +9 -9
@@ -1 +1 @@
1
- {"version":3,"file":"use-sidebar.cjs","names":["createDescendants","createContext","useI18n","useDisclosure","useControllableState","useCallback","mergeProps","useEnvironment","useRef","useId","mergeRefs","useState","useIds","Children","useAsyncCallback"],"sources":["../../../../src/components/sidebar/use-sidebar.ts"],"sourcesContent":["\"use client\"\n\nimport type { ReactNode, RefObject } from \"react\"\nimport { Children, useCallback, useId, useRef, useState } from \"react\"\nimport {\n type HTMLProps,\n mergeProps,\n type PropGetter,\n useEnvironment,\n} from \"../../core\"\nimport { useAsyncCallback } from \"../../hooks/use-async-callback\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { createDescendants } from \"../../hooks/use-descendants\"\nimport {\n useDisclosure,\n type UseDisclosureProps,\n} from \"../../hooks/use-disclosure\"\nimport { useWindowEvent } from \"../../hooks/use-window-event\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport {\n ariaAttr,\n assignRef,\n createContext,\n cx,\n dataAttr,\n handlerAll,\n mergeRefs,\n setAttribute,\n useIds,\n useSafeLayoutEffect,\n} from \"../../utils\"\n\nexport interface SidebarControl {\n collapse: () => void\n expand: () => void\n}\n\ninterface SidebarDescendantProps {\n expanded: boolean\n group: boolean\n id: string\n value: string\n}\n\nconst {\n DescendantsContext: SidebarDescendantsContext,\n useDescendant: useSidebarDescendant,\n useDescendants: useSidebarDescendants,\n} = createDescendants<HTMLElement, SidebarDescendantProps>()\n\nexport {\n SidebarDescendantsContext,\n useSidebarDescendant,\n useSidebarDescendants,\n}\n\ninterface SidebarContext extends Pick<\n UseSidebarReturn,\n | \"expandedValue\"\n | \"mobile\"\n | \"onClose\"\n | \"onExpandedChange\"\n | \"onOpen\"\n | \"onSelectedChange\"\n | \"onToggle\"\n | \"open\"\n | \"selectedValue\"\n> {}\n\nconst [SidebarContext, useSidebarContext] = createContext<SidebarContext>({\n name: \"SidebarContext\",\n})\n\nexport { SidebarContext, useSidebarContext }\n\ninterface SidebarItemContext extends Pick<\n UseSidebarItemReturn,\n \"branchOpen\" | \"groupOpen\"\n> {}\n\nconst [SidebarItemContext, useSidebarItemContext] =\n createContext<SidebarItemContext>({\n name: \"SidebarItemContext\",\n strict: false,\n })\n\nexport { SidebarItemContext, useSidebarItemContext }\n\nexport interface UseSidebarProps extends HTMLProps<\"div\"> {\n /**\n * Ref of the sidebar callbacks.\n */\n controlRef?: RefObject<null | SidebarControl>\n /**\n * The initial expanded value of the sidebar.\n */\n defaultExpandedValue?: string[]\n /**\n * The initial selected value of the sidebar.\n */\n defaultSelectedValue?: string\n /**\n * The disclosure props for the desktop and mobile.\n */\n disclosure?: {\n desktop?: Omit<UseDisclosureProps, \"timing\">\n mobile?: Omit<UseDisclosureProps, \"timing\">\n }\n /**\n * The expanded value of the sidebar.\n */\n expandedValue?: string[]\n /**\n * If `true`, the trigger click event will be switched to mobile.\n *\n * @default false\n */\n mobile?: boolean\n /**\n * The selected value of the sidebar.\n */\n selectedValue?: string\n /**\n * The callback invoked when expanded value changes.\n */\n onExpandedChange?: (value: string[]) => void\n /**\n * The callback invoked when selected value changes.\n */\n onSelectedChange?: (value: string) => void\n}\n\nexport const useSidebar = ({\n controlRef,\n defaultExpandedValue = [],\n defaultSelectedValue,\n disclosure,\n expandedValue: expandedValueProp,\n mobile = false,\n selectedValue: selectedValueProp,\n onExpandedChange: onExpandedChangeProp,\n onSelectedChange: onSelectedChangeProp,\n ...rest\n}: UseSidebarProps = {}) => {\n const { t } = useI18n(\"sidebar\")\n const desktopDisclosure = useDisclosure({\n defaultOpen: disclosure?.desktop?.defaultOpen ?? true,\n open: disclosure?.desktop?.open,\n onClose: disclosure?.desktop?.onClose,\n onOpen: disclosure?.desktop?.onOpen,\n })\n const mobileDisclosure = useDisclosure({\n defaultOpen: disclosure?.mobile?.defaultOpen ?? false,\n open: disclosure?.mobile?.open,\n onClose: disclosure?.mobile?.onClose,\n onOpen: disclosure?.mobile?.onOpen,\n })\n const [selectedValue, setSelectedValue] = useControllableState({\n defaultValue: defaultSelectedValue,\n value: selectedValueProp,\n onChange: onSelectedChangeProp,\n })\n const [expandedValue, setExpandedValue] = useControllableState({\n defaultValue: defaultExpandedValue,\n value: expandedValueProp,\n onChange: onExpandedChangeProp,\n })\n const descendants = useSidebarDescendants()\n const open = mobile ? mobileDisclosure.open : desktopDisclosure.open\n const onOpen = mobile ? mobileDisclosure.onOpen : desktopDisclosure.onOpen\n const onClose = mobile ? mobileDisclosure.onClose : desktopDisclosure.onClose\n const onToggle = mobile\n ? mobileDisclosure.onToggle\n : desktopDisclosure.onToggle\n\n const onSelectedChange = useCallback(\n (value: string) => {\n setSelectedValue(value)\n },\n [setSelectedValue],\n )\n\n const onExpandAll = useCallback(() => {\n const values = descendants.enabledValues()\n const group = values.filter(({ group }) => group)\n const value = group.map(({ value }) => value)\n\n setExpandedValue(value)\n }, [descendants, setExpandedValue])\n\n const onCollapseAll = useCallback(() => {\n setExpandedValue([])\n }, [setExpandedValue])\n\n const onExpandedChange = useCallback(\n (value: string) => {\n setExpandedValue((prev) => {\n if (prev.includes(value))\n return prev.filter((prevValue) => prevValue !== value)\n else return [...prev, value]\n })\n },\n [setExpandedValue],\n )\n\n assignRef(controlRef, { collapse: onCollapseAll, expand: onExpandAll })\n\n useWindowEvent(\"keydown\", (ev) => {\n if (ev.key !== \"b\") return\n if (!ev.metaKey && !ev.ctrlKey) return\n\n ev.preventDefault()\n\n desktopDisclosure.onToggle()\n })\n\n const getRootProps: PropGetter<\"div\"> = useCallback(\n (props = {}) =>\n mergeProps({ \"data-expanded\": dataAttr(open) }, rest, props)(),\n [open, rest],\n )\n\n const getTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n \"aria-expanded\": open,\n \"aria-label\": t(open ? \"Close sidebar\" : \"Open sidebar\"),\n ...props,\n onClick: handlerAll(props.onClick, onToggle),\n }),\n [open, t, onToggle],\n )\n\n const getSidePanelProps: PropGetter<\"aside\"> = useCallback(\n (props = {}) => ({ \"data-expanded\": dataAttr(open), ...props }),\n [open],\n )\n\n const getHeaderProps: PropGetter<\"header\"> = useCallback(\n (props = {}) => ({ ...props }),\n [],\n )\n\n const getFooterProps: PropGetter<\"footer\"> = useCallback(\n (props = {}) => ({ ...props }),\n [],\n )\n\n const getContentProps: PropGetter<\"ul\"> = useCallback(\n (props = {}) => ({ ...props }),\n [],\n )\n\n return {\n descendants,\n expandedValue,\n mobile,\n open,\n selectedValue,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getRootProps,\n getSidePanelProps,\n getTriggerProps,\n onClose,\n onExpandedChange,\n onOpen,\n onSelectedChange,\n onToggle,\n }\n}\n\nexport type UseSidebarReturn = ReturnType<typeof useSidebar>\n\nexport interface UseSidebarGroupProps extends HTMLProps<\"li\"> {}\n\nexport const useSidebarGroup = ({ ...rest }: UseSidebarGroupProps = {}) => {\n const { getDocument } = useEnvironment()\n const rootRef = useRef<HTMLLIElement>(null)\n const contentRef = useRef<HTMLDivElement>(null)\n const labelId = useId()\n\n useSafeLayoutEffect(() => {\n const el = getDocument()?.getElementById(labelId)\n\n if (!el) return\n\n if (rootRef.current)\n setAttribute(rootRef.current, \"aria-labelledby\", labelId)\n if (contentRef.current)\n setAttribute(contentRef.current, \"aria-labelledby\", labelId)\n }, [])\n\n const getRootProps: PropGetter<\"li\"> = useCallback(\n ({ ref, ...props } = {}) =>\n mergeProps({ ref }, rest, props, { ref: rootRef })(),\n [rest, rootRef],\n )\n\n const getLabelProps: PropGetter<\"span\"> = useCallback(\n (props = {}) => ({ id: labelId, ...props }),\n [labelId],\n )\n\n const getContentProps: PropGetter<\"div\"> = useCallback(\n ({ ref, ...props } = {}) => ({\n ref: mergeRefs(ref, contentRef),\n ...props,\n }),\n [],\n )\n\n return { getContentProps, getLabelProps, getRootProps }\n}\n\nexport type UseSidebarGroupReturn = ReturnType<typeof useSidebarGroup>\n\nexport interface UseSidebarItemProps\n extends HTMLProps<\"li\">, Omit<UseDisclosureProps, \"timing\"> {\n /**\n * The value of the item.\n */\n value: string\n /**\n * If `true`, the tree item will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * If `true`, the link will open in new tab.\n *\n * @default false\n */\n external?: boolean\n /**\n * If provided, the sidebar item will be rendered as an async sidebar item.\n */\n asyncChildren?: () => Promise<ReactNode>\n}\n\nexport const useSidebarItem = ({\n asyncChildren,\n children: childrenProp,\n defaultOpen,\n disabled = false,\n external,\n open: openProp,\n value,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n ...rest\n}: UseSidebarItemProps) => {\n const context = useSidebarItemContext()\n const {\n expandedValue,\n open,\n selectedValue,\n onExpandedChange,\n onSelectedChange,\n } = useSidebarContext()\n const [children, setChildren] = useState<ReactNode>(childrenProp)\n const [itemId, labelId, contentId] = useIds()\n const initialAsyncRef = useRef(false)\n const async = !!asyncChildren\n const group = async || Children.count(children) > 0\n const nested = !!context\n const selected = !!value && selectedValue === value\n const defaultExpanded = !!value && expandedValue.includes(value)\n const {\n open: groupOpen,\n onClose,\n onOpen,\n } = useDisclosure({\n defaultOpen: defaultOpen ?? defaultExpanded,\n open: openProp,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n })\n const branchOpen: boolean[] = nested\n ? [...context.branchOpen, groupOpen]\n : [groupOpen]\n const expanded = branchOpen.slice(0, -1).every(Boolean)\n const { register } = useSidebarDescendant({\n id: itemId!,\n disabled,\n expanded,\n group,\n value,\n })\n\n const [groupLoading, onGroupChildren] = useAsyncCallback(async () => {\n const children = await asyncChildren?.()\n\n setChildren(children)\n }, [asyncChildren])\n\n const onGroupOpen = useCallback(() => {\n if (disabled || !group || !value || groupLoading) return\n\n if (async && !initialAsyncRef.current) {\n initialAsyncRef.current = true\n\n onGroupChildren()\n .then(() => {\n onOpen()\n onExpandedChange(value)\n })\n .catch(() => {\n initialAsyncRef.current = false\n })\n } else {\n onOpen()\n onExpandedChange(value)\n }\n }, [\n disabled,\n group,\n value,\n groupLoading,\n async,\n onGroupChildren,\n onOpen,\n onExpandedChange,\n ])\n\n const onGroupClose = useCallback(() => {\n if (disabled || !group || !value) return\n\n onClose()\n onExpandedChange(value)\n }, [disabled, group, value, onClose, onExpandedChange])\n\n const onGroupToggle = useCallback(() => {\n if (groupOpen) onGroupClose()\n else onGroupOpen()\n }, [groupOpen, onGroupClose, onGroupOpen])\n\n useSafeLayoutEffect(() => {\n if (defaultExpanded)\n if (async && !initialAsyncRef.current) {\n initialAsyncRef.current = true\n\n onGroupChildren()\n .then(() => {\n onOpen()\n })\n .catch(() => {\n initialAsyncRef.current = false\n })\n } else {\n onOpen()\n }\n else onClose()\n }, [defaultExpanded])\n\n const getItemProps: PropGetter<\"li\"> = useCallback(\n ({ ref, \"aria-labelledby\": ariaLabelledby, ...props } = {}) => {\n const merged = mergeProps(\n {\n id: itemId,\n \"aria-current\": selected ? \"page\" : undefined,\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-labelledby\": cx(ariaLabelledby, labelId),\n \"data-disabled\": dataAttr(disabled),\n \"data-selected\": dataAttr(selected),\n },\n rest,\n props,\n { ref },\n { ref: register },\n )()\n\n return {\n ...merged,\n onClick: handlerAll(\n merged.onClick,\n !group ? () => onSelectedChange(value) : undefined,\n ),\n }\n },\n [\n itemId,\n register,\n selected,\n disabled,\n labelId,\n rest,\n group,\n onSelectedChange,\n value,\n ],\n )\n\n const getIndicatorProps: PropGetter<\"svg\"> = useCallback(\n (props) => ({\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-expanded\": groupOpen,\n \"aria-hidden\": true,\n \"data-disabled\": dataAttr(disabled),\n \"data-loading\": dataAttr(groupLoading),\n \"data-selected\": dataAttr(selected),\n role: \"presentation\",\n ...props,\n }),\n [disabled, groupOpen, groupLoading, selected],\n )\n\n const getTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n \"aria-controls\": contentId,\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-expanded\": groupOpen,\n \"data-disabled\": dataAttr(disabled),\n \"data-expanded\": dataAttr(groupOpen),\n \"data-selected\": dataAttr(selected),\n tabIndex: open && expanded && !disabled ? 0 : -1,\n ...props,\n onClick: handlerAll(props.onClick, onGroupToggle),\n }),\n [contentId, disabled, groupOpen, selected, open, expanded, onGroupToggle],\n )\n\n const getLinkProps: PropGetter<\"a\"> = useCallback(\n (props = {}) => ({\n href: value,\n rel: external ? \"noopener\" : undefined,\n target: external ? \"_blank\" : undefined,\n \"data-disabled\": dataAttr(disabled),\n \"data-selected\": dataAttr(selected),\n tabIndex: open && expanded && !disabled ? 0 : -1,\n ...props,\n onClick: handlerAll(props.onClick, (ev) => {\n if (!disabled) return\n\n ev.preventDefault()\n ev.stopPropagation()\n }),\n }),\n [disabled, expanded, external, open, selected, value],\n )\n\n const getContentProps: PropGetter<\"ul\"> = useCallback(\n ({ \"aria-labelledby\": ariaLabelledby, ...props } = {}) => ({\n id: contentId,\n \"aria-busy\": ariaAttr(groupLoading),\n \"aria-labelledby\": cx(ariaLabelledby, labelId),\n \"data-disabled\": dataAttr(disabled),\n ...props,\n }),\n [contentId, labelId, disabled, groupLoading],\n )\n\n const getLabelProps: PropGetter<\"span\"> = useCallback(\n (props = {}) => ({ id: labelId, ...props }),\n [labelId],\n )\n\n return {\n branchOpen,\n children,\n disabled,\n expanded,\n expandedValue,\n group,\n groupLoading,\n groupOpen,\n open,\n selected,\n selectedValue,\n value,\n getContentProps,\n getIndicatorProps,\n getItemProps,\n getLabelProps,\n getLinkProps,\n getTriggerProps,\n onExpandedChange,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n onSelectedChange,\n }\n}\n\nexport type UseSidebarItemReturn = ReturnType<typeof useSidebarItem>\n"],"mappings":";;;;;;;;;;;;;;;;;AA4CA,MAAM,EACJ,oBAAoB,2BACpB,eAAe,sBACf,gBAAgB,0BACdA,oCAAAA,kBAAuD;AAqB3D,MAAM,CAAC,gBAAgB,qBAAqBC,gBAAAA,cAA8B,EACxE,MAAM,iBACR,CAAC;AASD,MAAM,CAAC,oBAAoB,yBACzBA,gBAAAA,cAAkC;CAChC,MAAM;CACN,QAAQ;AACV,CAAC;AAgDH,MAAa,cAAc,EACzB,YACA,uBAAuB,CAAC,GACxB,sBACA,YACA,eAAe,mBACf,SAAS,OACT,eAAe,mBACf,kBAAkB,sBAClB,kBAAkB,sBAClB,GAAG,SACgB,CAAC,MAAM;CAC1B,MAAM,EAAE,MAAMC,sBAAAA,QA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A,CAAS,QAAQ;EAClC,UAAU,QAAQ,YAAY,CAAC,WAAW,IAAI;EAC9C,GAAG;EACH,UAAA,GAAA,oBAAA,cAAS,WAAA,CAAW,MAAM,UAAU,OAAO;GACzC,IAAI,CAAC,UAAU;GAEf,GAAG,eAAe;GAClB,GAAG,gBAAgB;EACrB,CAAC;CACH,IACA;EAAC;EAAU;EAAU;EAAU;EAAM;EAAU;CAAK,CACtD;CAkBA,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,kBAAA,GA7BwCA,MAAAA,YAAAA,EACvC,EAAE,mBAAmB,gBAAgB,GAAG,UAAU,CAAC,OAAO;GACzD,IAAI;GACJ,cAAA,GAAA,oBAAA,cAAa,SAAA,CAAS,YAAY;GAClC,oBAAA,GAAA,oBAAA,cAAmB,GAAA,CAAG,gBAAgB,OAAO;GAC7C,kBAAA,GAAA,oBAAA,cAAiB,SAAA,CAAS,QAAQ;GAClC,GAAG;EACL,IACA;GAAC;GAAW;GAAS;GAAU;EAAY,CAqB7B;EACd;EACA;EACA,gBAAA,GArBwCA,MAAAA,YAAAA,EACvC,QAAQ,CAAC,OAAO;GAAE,IAAI;GAAS,GAAG;EAAM,IACzC,CAAC,OAAO,CAmBI;EACZ;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"use-sidebar.cjs","names":["createDescendants","createContext","useI18n","useDisclosure","useControllableState","useCallback","mergeProps","useEnvironment","useRef","useId","mergeRefs","useState","useIds","Children","useAsyncCallback"],"sources":["../../../../src/components/sidebar/use-sidebar.ts"],"sourcesContent":["\"use client\"\n\nimport type { ReactNode, RefObject } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { UseDisclosureProps } from \"../../hooks/use-disclosure\"\nimport { Children, useCallback, useId, useRef, useState } from \"react\"\nimport { mergeProps, useEnvironment } from \"../../core\"\nimport { useAsyncCallback } from \"../../hooks/use-async-callback\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { createDescendants } from \"../../hooks/use-descendants\"\nimport { useDisclosure } from \"../../hooks/use-disclosure\"\nimport { useWindowEvent } from \"../../hooks/use-window-event\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport {\n ariaAttr,\n assignRef,\n createContext,\n cx,\n dataAttr,\n handlerAll,\n mergeRefs,\n setAttribute,\n useIds,\n useSafeLayoutEffect,\n} from \"../../utils\"\n\nexport interface SidebarControl {\n collapse: () => void\n expand: () => void\n}\n\ninterface SidebarDescendantProps {\n expanded: boolean\n group: boolean\n id: string\n value: string\n}\n\nconst {\n DescendantsContext: SidebarDescendantsContext,\n useDescendant: useSidebarDescendant,\n useDescendants: useSidebarDescendants,\n} = createDescendants<HTMLElement, SidebarDescendantProps>()\n\nexport {\n SidebarDescendantsContext,\n useSidebarDescendant,\n useSidebarDescendants,\n}\n\ninterface SidebarContext extends Pick<\n UseSidebarReturn,\n | \"expandedValue\"\n | \"mobile\"\n | \"onClose\"\n | \"onExpandedChange\"\n | \"onOpen\"\n | \"onSelectedChange\"\n | \"onToggle\"\n | \"open\"\n | \"selectedValue\"\n> {}\n\nconst [SidebarContext, useSidebarContext] = createContext<SidebarContext>({\n name: \"SidebarContext\",\n})\n\nexport { SidebarContext, useSidebarContext }\n\ninterface SidebarItemContext extends Pick<\n UseSidebarItemReturn,\n \"branchOpen\" | \"groupOpen\"\n> {}\n\nconst [SidebarItemContext, useSidebarItemContext] =\n createContext<SidebarItemContext>({\n name: \"SidebarItemContext\",\n strict: false,\n })\n\nexport { SidebarItemContext, useSidebarItemContext }\n\nexport interface UseSidebarProps extends HTMLProps<\"div\"> {\n /**\n * Ref of the sidebar callbacks.\n */\n controlRef?: RefObject<null | SidebarControl>\n /**\n * The initial expanded value of the sidebar.\n */\n defaultExpandedValue?: string[]\n /**\n * The initial selected value of the sidebar.\n */\n defaultSelectedValue?: string\n /**\n * The disclosure props for the desktop and mobile.\n */\n disclosure?: {\n desktop?: Omit<UseDisclosureProps, \"timing\">\n mobile?: Omit<UseDisclosureProps, \"timing\">\n }\n /**\n * The expanded value of the sidebar.\n */\n expandedValue?: string[]\n /**\n * If `true`, the trigger click event will be switched to mobile.\n *\n * @default false\n */\n mobile?: boolean\n /**\n * The selected value of the sidebar.\n */\n selectedValue?: string\n /**\n * The callback invoked when expanded value changes.\n */\n onExpandedChange?: (value: string[]) => void\n /**\n * The callback invoked when selected value changes.\n */\n onSelectedChange?: (value: string) => void\n}\n\nexport const useSidebar = ({\n controlRef,\n defaultExpandedValue = [],\n defaultSelectedValue,\n disclosure,\n expandedValue: expandedValueProp,\n mobile = false,\n selectedValue: selectedValueProp,\n onExpandedChange: onExpandedChangeProp,\n onSelectedChange: onSelectedChangeProp,\n ...rest\n}: UseSidebarProps = {}) => {\n const { t } = useI18n(\"sidebar\")\n const desktopDisclosure = useDisclosure({\n defaultOpen: disclosure?.desktop?.defaultOpen ?? true,\n open: disclosure?.desktop?.open,\n onClose: disclosure?.desktop?.onClose,\n onOpen: disclosure?.desktop?.onOpen,\n })\n const mobileDisclosure = useDisclosure({\n defaultOpen: disclosure?.mobile?.defaultOpen ?? false,\n open: disclosure?.mobile?.open,\n onClose: disclosure?.mobile?.onClose,\n onOpen: disclosure?.mobile?.onOpen,\n })\n const [selectedValue, setSelectedValue] = useControllableState({\n defaultValue: defaultSelectedValue,\n value: selectedValueProp,\n onChange: onSelectedChangeProp,\n })\n const [expandedValue, setExpandedValue] = useControllableState({\n defaultValue: defaultExpandedValue,\n value: expandedValueProp,\n onChange: onExpandedChangeProp,\n })\n const descendants = useSidebarDescendants()\n const open = mobile ? mobileDisclosure.open : desktopDisclosure.open\n const onOpen = mobile ? mobileDisclosure.onOpen : desktopDisclosure.onOpen\n const onClose = mobile ? mobileDisclosure.onClose : desktopDisclosure.onClose\n const onToggle = mobile\n ? mobileDisclosure.onToggle\n : desktopDisclosure.onToggle\n\n const onSelectedChange = useCallback(\n (value: string) => {\n setSelectedValue(value)\n },\n [setSelectedValue],\n )\n\n const onExpandAll = useCallback(() => {\n const values = descendants.enabledValues()\n const group = values.filter(({ group }) => group)\n const value = group.map(({ value }) => value)\n\n setExpandedValue(value)\n }, [descendants, setExpandedValue])\n\n const onCollapseAll = useCallback(() => {\n setExpandedValue([])\n }, [setExpandedValue])\n\n const onExpandedChange = useCallback(\n (value: string) => {\n setExpandedValue((prev) => {\n if (prev.includes(value))\n return prev.filter((prevValue) => prevValue !== value)\n else return [...prev, value]\n })\n },\n [setExpandedValue],\n )\n\n assignRef(controlRef, { collapse: onCollapseAll, expand: onExpandAll })\n\n useWindowEvent(\"keydown\", (ev) => {\n if (ev.key !== \"b\") return\n if (!ev.metaKey && !ev.ctrlKey) return\n\n ev.preventDefault()\n\n desktopDisclosure.onToggle()\n })\n\n const getRootProps: PropGetter<\"div\"> = useCallback(\n (props = {}) =>\n mergeProps({ \"data-expanded\": dataAttr(open) }, rest, props)(),\n [open, rest],\n )\n\n const getTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n \"aria-expanded\": open,\n \"aria-label\": t(open ? \"Close sidebar\" : \"Open sidebar\"),\n ...props,\n onClick: handlerAll(props.onClick, onToggle),\n }),\n [open, t, onToggle],\n )\n\n const getSidePanelProps: PropGetter<\"aside\"> = useCallback(\n (props = {}) => ({ \"data-expanded\": dataAttr(open), ...props }),\n [open],\n )\n\n const getHeaderProps: PropGetter<\"header\"> = useCallback(\n (props = {}) => ({ ...props }),\n [],\n )\n\n const getFooterProps: PropGetter<\"footer\"> = useCallback(\n (props = {}) => ({ ...props }),\n [],\n )\n\n const getContentProps: PropGetter<\"ul\"> = useCallback(\n (props = {}) => ({ ...props }),\n [],\n )\n\n return {\n descendants,\n expandedValue,\n mobile,\n open,\n selectedValue,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getRootProps,\n getSidePanelProps,\n getTriggerProps,\n onClose,\n onExpandedChange,\n onOpen,\n onSelectedChange,\n onToggle,\n }\n}\n\nexport type UseSidebarReturn = ReturnType<typeof useSidebar>\n\nexport interface UseSidebarGroupProps extends HTMLProps<\"li\"> {}\n\nexport const useSidebarGroup = ({ ...rest }: UseSidebarGroupProps = {}) => {\n const { getDocument } = useEnvironment()\n const rootRef = useRef<HTMLLIElement>(null)\n const contentRef = useRef<HTMLDivElement>(null)\n const labelId = useId()\n\n useSafeLayoutEffect(() => {\n const el = getDocument()?.getElementById(labelId)\n\n if (!el) return\n\n if (rootRef.current)\n setAttribute(rootRef.current, \"aria-labelledby\", labelId)\n if (contentRef.current)\n setAttribute(contentRef.current, \"aria-labelledby\", labelId)\n }, [])\n\n const getRootProps: PropGetter<\"li\"> = useCallback(\n ({ ref, ...props } = {}) =>\n mergeProps({ ref }, rest, props, { ref: rootRef })(),\n [rest, rootRef],\n )\n\n const getLabelProps: PropGetter<\"span\"> = useCallback(\n (props = {}) => ({ id: labelId, ...props }),\n [labelId],\n )\n\n const getContentProps: PropGetter<\"div\"> = useCallback(\n ({ ref, ...props } = {}) => ({\n ref: mergeRefs(ref, contentRef),\n ...props,\n }),\n [],\n )\n\n return { getContentProps, getLabelProps, getRootProps }\n}\n\nexport type UseSidebarGroupReturn = ReturnType<typeof useSidebarGroup>\n\nexport interface UseSidebarItemProps\n extends HTMLProps<\"li\">, Omit<UseDisclosureProps, \"timing\"> {\n /**\n * The value of the item.\n */\n value: string\n /**\n * If `true`, the tree item will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * If `true`, the link will open in new tab.\n *\n * @default false\n */\n external?: boolean\n /**\n * If provided, the sidebar item will be rendered as an async sidebar item.\n */\n asyncChildren?: () => Promise<ReactNode>\n}\n\nexport const useSidebarItem = ({\n asyncChildren,\n children: childrenProp,\n defaultOpen,\n disabled = false,\n external,\n open: openProp,\n value,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n ...rest\n}: UseSidebarItemProps) => {\n const context = useSidebarItemContext()\n const {\n expandedValue,\n open,\n selectedValue,\n onExpandedChange,\n onSelectedChange,\n } = useSidebarContext()\n const [children, setChildren] = useState<ReactNode>(childrenProp)\n const [itemId, labelId, contentId] = useIds()\n const initialAsyncRef = useRef(false)\n const async = !!asyncChildren\n const group = async || Children.count(children) > 0\n const nested = !!context\n const selected = !!value && selectedValue === value\n const defaultExpanded = !!value && expandedValue.includes(value)\n const {\n open: groupOpen,\n onClose,\n onOpen,\n } = useDisclosure({\n defaultOpen: defaultOpen ?? defaultExpanded,\n open: openProp,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n })\n const branchOpen: boolean[] = nested\n ? [...context.branchOpen, groupOpen]\n : [groupOpen]\n const expanded = branchOpen.slice(0, -1).every(Boolean)\n const { register } = useSidebarDescendant({\n id: itemId!,\n disabled,\n expanded,\n group,\n value,\n })\n\n const [groupLoading, onGroupChildren] = useAsyncCallback(async () => {\n const children = await asyncChildren?.()\n\n setChildren(children)\n }, [asyncChildren])\n\n const onGroupOpen = useCallback(() => {\n if (disabled || !group || !value || groupLoading) return\n\n if (async && !initialAsyncRef.current) {\n initialAsyncRef.current = true\n\n onGroupChildren()\n .then(() => {\n onOpen()\n onExpandedChange(value)\n })\n .catch(() => {\n initialAsyncRef.current = false\n })\n } else {\n onOpen()\n onExpandedChange(value)\n }\n }, [\n disabled,\n group,\n value,\n groupLoading,\n async,\n onGroupChildren,\n onOpen,\n onExpandedChange,\n ])\n\n const onGroupClose = useCallback(() => {\n if (disabled || !group || !value) return\n\n onClose()\n onExpandedChange(value)\n }, [disabled, group, value, onClose, onExpandedChange])\n\n const onGroupToggle = useCallback(() => {\n if (groupOpen) onGroupClose()\n else onGroupOpen()\n }, [groupOpen, onGroupClose, onGroupOpen])\n\n useSafeLayoutEffect(() => {\n if (defaultExpanded)\n if (async && !initialAsyncRef.current) {\n initialAsyncRef.current = true\n\n onGroupChildren()\n .then(() => {\n onOpen()\n })\n .catch(() => {\n initialAsyncRef.current = false\n })\n } else {\n onOpen()\n }\n else onClose()\n }, [defaultExpanded])\n\n const getItemProps: PropGetter<\"li\"> = useCallback(\n ({ ref, \"aria-labelledby\": ariaLabelledby, ...props } = {}) => {\n const merged = mergeProps(\n {\n id: itemId,\n \"aria-current\": selected ? \"page\" : undefined,\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-labelledby\": cx(ariaLabelledby, labelId),\n \"data-disabled\": dataAttr(disabled),\n \"data-selected\": dataAttr(selected),\n },\n rest,\n props,\n { ref },\n { ref: register },\n )()\n\n return {\n ...merged,\n onClick: handlerAll(\n merged.onClick,\n !group ? () => onSelectedChange(value) : undefined,\n ),\n }\n },\n [\n itemId,\n register,\n selected,\n disabled,\n labelId,\n rest,\n group,\n onSelectedChange,\n value,\n ],\n )\n\n const getIndicatorProps: PropGetter<\"svg\"> = useCallback(\n (props) => ({\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-expanded\": groupOpen,\n \"aria-hidden\": true,\n \"data-disabled\": dataAttr(disabled),\n \"data-loading\": dataAttr(groupLoading),\n \"data-selected\": dataAttr(selected),\n role: \"presentation\",\n ...props,\n }),\n [disabled, groupOpen, groupLoading, selected],\n )\n\n const getTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n \"aria-controls\": contentId,\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-expanded\": groupOpen,\n \"data-disabled\": dataAttr(disabled),\n \"data-expanded\": dataAttr(groupOpen),\n \"data-selected\": dataAttr(selected),\n tabIndex: open && expanded && !disabled ? 0 : -1,\n ...props,\n onClick: handlerAll(props.onClick, onGroupToggle),\n }),\n [contentId, disabled, groupOpen, selected, open, expanded, onGroupToggle],\n )\n\n const getLinkProps: PropGetter<\"a\"> = useCallback(\n (props = {}) => ({\n href: value,\n rel: external ? \"noopener\" : undefined,\n target: external ? \"_blank\" : undefined,\n \"data-disabled\": dataAttr(disabled),\n \"data-selected\": dataAttr(selected),\n tabIndex: open && expanded && !disabled ? 0 : -1,\n ...props,\n onClick: handlerAll(props.onClick, (ev) => {\n if (!disabled) return\n\n ev.preventDefault()\n ev.stopPropagation()\n }),\n }),\n [disabled, expanded, external, open, selected, value],\n )\n\n const getContentProps: PropGetter<\"ul\"> = useCallback(\n ({ \"aria-labelledby\": ariaLabelledby, ...props } = {}) => ({\n id: contentId,\n \"aria-busy\": ariaAttr(groupLoading),\n \"aria-labelledby\": cx(ariaLabelledby, labelId),\n \"data-disabled\": dataAttr(disabled),\n ...props,\n }),\n [contentId, labelId, disabled, groupLoading],\n )\n\n const getLabelProps: PropGetter<\"span\"> = useCallback(\n (props = {}) => ({ id: labelId, ...props }),\n [labelId],\n )\n\n return {\n branchOpen,\n children,\n disabled,\n expanded,\n expandedValue,\n group,\n groupLoading,\n groupOpen,\n open,\n selected,\n selectedValue,\n value,\n getContentProps,\n getIndicatorProps,\n getItemProps,\n getLabelProps,\n getLinkProps,\n getTriggerProps,\n onExpandedChange,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n onSelectedChange,\n }\n}\n\nexport type UseSidebarItemReturn = ReturnType<typeof useSidebarItem>\n"],"mappings":";;;;;;;;;;;;;;;;;AAsCA,MAAM,EACJ,oBAAoB,2BACpB,eAAe,sBACf,gBAAgB,0BACdA,oCAAAA,kBAAuD;AAqB3D,MAAM,CAAC,gBAAgB,qBAAqBC,gBAAAA,cAA8B,EACxE,MAAM,iBACR,CAAC;AASD,MAAM,CAAC,oBAAoB,yBACzBA,gBAAAA,cAAkC;CAChC,MAAM;CACN,QAAQ;AACV,CAAC;AAgDH,MAAa,cAAc,EACzB,YACA,uBAAuB,CAAC,GACxB,sBACA,YACA,eAAe,mBACf,SAAS,OACT,eAAe,mBACf,kBAAkB,sBAClB,kBAAkB,sBAClB,GAAG,SACgB,CAAC,MAAM;CAC1B,MAAM,EAAE,MAAMC,sBAAAA,QAAQ,SAAS;CAC/B,MAAM,oBAAoBC,uBAAAA,cAAc;EACtC,aAAa,YAAY,SAAS,eAAe;EACjD,MAAM,YAAY,SAAS;EAC3B,SAAS,YAAY,SAAS;EAC9B,QAAQ,YAAY,SAAS;CAC/B,CAAC;CACD,MAAM,mBAAmBA,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BAAgB;EACrB,CAAC;CACH,IACA;EAAC;EAAU;EAAU;EAAU;EAAM;EAAU;CAAK,CACtD;CAkBA,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,kBAAA,GA7BwCA,MAAAA,YAAAA,EACvC,EAAE,mBAAmB,gBAAgB,GAAG,UAAU,CAAC,OAAO;GACzD,IAAI;GACJ,cAAA,GAAA,oBAAA,cAAa,SAAA,CAAS,YAAY;GAClC,oBAAA,GAAA,oBAAA,cAAmB,GAAA,CAAG,gBAAgB,OAAO;GAC7C,kBAAA,GAAA,oBAAA,cAAiB,SAAA,CAAS,QAAQ;GAClC,GAAG;EACL,IACA;GAAC;GAAW;GAAS;GAAU;EAAY,CAqB7B;EACd;EACA;EACA,gBAAA,GArBwCA,MAAAA,YAAAA,EACvC,QAAQ,CAAC,OAAO;GAAE,IAAI;GAAS,GAAG;EAAM,IACzC,CAAC,OAAO,CAmBI;EACZ;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"tree.cjs","names":["createContext","createSlotComponent","treeStyle","useMemo","useTree","TreeDescendantsContext","TreeContext","styled","useTreeContext","useLoadingComponent","useCallback","useTreeItem","TreeItemContext","Collapse","ChevronRightIcon","isValidElement","cloneElement","Children","mergeProps","Checkbox"],"sources":["../../../../src/components/tree/tree.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement, ReactNode } from \"react\"\nimport type {\n GenericsComponent,\n HTMLProps,\n HTMLStyledProps,\n ThemeProps,\n} from \"../../core\"\nimport type { CheckboxProps } from \"../checkbox\"\nimport type { CollapseProps } from \"../collapse\"\nimport type { Loading } from \"../loading\"\nimport type { WithTransitionProps } from \"../motion\"\nimport type { TreeStyle } from \"./tree.style\"\nimport type { UseTreeItemProps, UseTreeProps } from \"./use-tree\"\nimport {\n Children,\n cloneElement,\n isValidElement,\n useCallback,\n useMemo,\n} from \"react\"\nimport { createSlotComponent, mergeProps, styled } from \"../../core\"\nimport {\n cast,\n createContext,\n dataAttr,\n isObject,\n isString,\n type ReactNodeOrFunction,\n runIfFn,\n} from \"../../utils\"\nimport { Checkbox } from \"../checkbox\"\nimport { Collapse } from \"../collapse\"\nimport { ChevronRightIcon } from \"../icon\"\nimport { useLoadingComponent } from \"../loading\"\nimport { treeStyle } from \"./tree.style\"\nimport {\n TreeContext,\n TreeDescendantsContext,\n TreeItemContext,\n useTree,\n useTreeContext,\n useTreeItem,\n} from \"./use-tree\"\n\ninterface TreeCallBackProps {\n disabled?: boolean\n expanded?: boolean\n}\n\ntype TreeItemReactNode =\n | ReactNodeOrFunction<TreeCallBackProps>\n | {\n group: ReactNodeOrFunction<TreeCallBackProps>\n item?: ReactNodeOrFunction<TreeCallBackProps>\n }\n | {\n item: ReactNodeOrFunction<TreeCallBackProps>\n group?: ReactNodeOrFunction<TreeCallBackProps>\n }\n\ninterface TreeItemWithValue extends Omit<TreeItemProps, \"children\"> {}\n\ninterface TreeItemWithChildren extends TreeItemWithValue {\n children: TreeItem[]\n}\n\nexport type TreeItem = TreeItemWithChildren | TreeItemWithValue\n\nconst recursiveTreeItem = (items?: TreeItem[]) => {\n return items?.map((props, index) => {\n const key =\n props.value || (isString(props.label) ? `${props.label}-${index}` : index)\n\n if (\"children\" in props) {\n const { children, ...rest } = props\n\n return (\n <TreeItem key={key} {...rest}>\n {recursiveTreeItem(children)}\n </TreeItem>\n )\n } else {\n return <TreeItem key={key} {...props} />\n }\n })\n}\n\nconst getReactNodeOrFunction = (\n type: \"group\" | \"item\",\n custom?: TreeItemReactNode,\n root?: TreeItemReactNode,\n): ReactNodeOrFunction<TreeCallBackProps> => {\n if (isObject(custom) && (\"group\" in custom || \"item\" in custom))\n return custom[type]\n else if (custom) return custom\n else if (isObject(root) && (\"group\" in root || \"item\" in root))\n return root[type]\n else return root\n}\n\ninterface ComponentContext extends Pick<\n TreeRootProps,\n | \"animated\"\n | \"checkboxProps\"\n | \"endElement\"\n | \"endElementProps\"\n | \"groupProps\"\n | \"indicator\"\n | \"indicatorHidden\"\n | \"indicatorProps\"\n | \"itemProps\"\n | \"labelProps\"\n | \"loadingScheme\"\n | \"size\"\n | \"startElement\"\n | \"startElementProps\"\n> {}\n\ninterface ItemComponentContext {\n checkboxProps: TreeCheckboxProps\n endElementProps: TreeEndElementProps\n indicatorProps: TreeIndicatorProps\n labelProps: TreeLabelProps\n startElementProps: TreeStartElementProps\n}\n\nconst [ItemComponentContext, useItemComponentContext] =\n createContext<ItemComponentContext>({ name: \"ItemComponentContext\" })\n\nexport interface TreeRootProps<Multiple extends boolean = false>\n extends\n HTMLStyledProps<\"ul\">,\n ThemeProps<TreeStyle>,\n UseTreeProps<Multiple>,\n Pick<\n TreeItemProps,\n | \"animated\"\n | \"checkboxProps\"\n | \"endElement\"\n | \"endElementProps\"\n | \"groupProps\"\n | \"indicator\"\n | \"indicatorProps\"\n | \"labelProps\"\n | \"loadingScheme\"\n | \"startElement\"\n | \"startElementProps\"\n > {\n /**\n * If `true`, hide the tree indicator icon for all items.\n *\n * @default false\n */\n indicatorHidden?: boolean\n /**\n * If provided, generate elements based on items.\n */\n items?: TreeItem[]\n /**\n * Props for the item component.\n */\n itemProps?: Omit<\n TreeItemProps,\n \"children\" | \"label\" | \"open\" | \"query\" | \"value\"\n >\n}\n\nconst {\n ComponentContext,\n PropsContext: TreePropsContext,\n useComponentContext,\n usePropsContext: useTreePropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<TreeRootProps, TreeStyle, ComponentContext>(\n \"tree\",\n treeStyle,\n)\n\nexport { TreePropsContext, useTreePropsContext }\n\n/**\n * `Tree` is a component used to display hierarchical data structures in an expandable tree format.\n *\n * @see https://yamada-ui.com/docs/components/tree\n */\nexport const TreeRoot = withProvider<\"ul\", TreeRootProps, \"size\">(\n <Multiple extends boolean = false>({\n size,\n animated,\n children,\n endElement,\n indicator,\n indicatorHidden,\n items,\n loadingScheme,\n startElement,\n checkboxProps,\n endElementProps,\n groupProps,\n indicatorProps,\n itemProps,\n labelProps,\n startElementProps,\n ...rest\n }: TreeRootProps<Multiple>) => {\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return recursiveTreeItem(items)\n }, [children, items])\n const {\n activeDescendant,\n checkable,\n checkedValue,\n descendants,\n expandedValue,\n multiple,\n selectedValue,\n getRootProps,\n onActiveDescendant,\n onCheckedChange,\n onCollapseAll,\n onExpandAll,\n onExpandedChange,\n onSearch,\n onSelectedChange,\n } = useTree({ ...rest, children: computedChildren })\n const context = useMemo(\n () => ({\n activeDescendant,\n checkable,\n checkedValue,\n expandedValue,\n multiple,\n selectedValue,\n onActiveDescendant,\n onCheckedChange,\n onCollapseAll,\n onExpandAll,\n onExpandedChange,\n onSearch,\n onSelectedChange,\n }),\n [\n activeDescendant,\n checkable,\n checkedValue,\n expandedValue,\n multiple,\n selectedValue,\n onActiveDescendant,\n onCheckedChange,\n onSearch,\n onCollapseAll,\n onExpandAll,\n onExpandedChange,\n onSelectedChange,\n ],\n )\n const componentContext = useMemo(\n () => ({\n size,\n animated,\n endElement,\n indicator,\n indicatorHidden,\n loadingScheme,\n startElement,\n checkboxProps,\n endElementProps,\n groupProps,\n indicatorProps,\n itemProps,\n labelProps,\n startElementProps,\n }),\n [\n size,\n animated,\n endElement,\n indicator,\n indicatorHidden,\n startElement,\n endElementProps,\n groupProps,\n indicatorProps,\n itemProps,\n labelProps,\n startElementProps,\n checkboxProps,\n loadingScheme,\n ],\n )\n\n return (\n <TreeDescendantsContext value={descendants}>\n <TreeContext value={context}>\n <ComponentContext value={componentContext}>\n <styled.ul {...getRootProps()} />\n </ComponentContext>\n </TreeContext>\n </TreeDescendantsContext>\n )\n },\n \"root\",\n { transferProps: [\"size\"] },\n)() as GenericsComponent<{\n <Multiple extends boolean = false>(\n props: TreeRootProps<Multiple>,\n ): ReactElement\n}>\n\nexport interface TreeItemProps\n extends HTMLStyledProps<\"div\">, Omit<UseTreeItemProps, \"asyncChildren\"> {\n /**\n * The label to display in the item.\n */\n label: ReactNode\n /**\n * If `true`, the tree item will be animated.\n *\n * @default false\n */\n animated?: boolean\n /**\n * The element to display at the end of the item.\n */\n endElement?: TreeItemReactNode\n /**\n * The tree indicator icon to use.\n */\n indicator?: ReactNodeOrFunction<TreeCallBackProps>\n /**\n * The loading scheme.\n *\n * @default 'oval'\n */\n loadingScheme?: Loading.Scheme\n /**\n * The element to display at the start of the item.\n */\n startElement?: TreeItemReactNode\n /**\n * Props for the checkbox component.\n */\n checkboxProps?: Omit<CheckboxProps, \"checked\" | \"defaultChecked\" | \"value\">\n /**\n * Props for the end component.\n */\n endElementProps?: TreeEndElementProps\n /**\n * Props for the group component.\n */\n groupProps?: Omit<TreeGroupProps, \"children\">\n /**\n * Props for the indicator component.\n */\n indicatorProps?: TreeIndicatorProps\n /**\n * Props for the label component.\n */\n labelProps?: TreeLabelProps\n /**\n * Props for the root element.\n */\n rootProps?: HTMLStyledProps<\"li\">\n /**\n * Props for the start component.\n */\n startElementProps?: TreeStartElementProps\n /**\n * If provided, the tree item will be rendered as an async tree item.\n */\n asyncChildren?: () => Promise<TreeItem[]>\n}\n\nexport const TreeItem = withContext<\"div\", TreeItemProps>(\n ({\n className,\n css,\n colorScheme,\n animated: animatedProp,\n asyncChildren: asyncChildrenProp,\n endElement,\n indicator: indicatorProp,\n label,\n loadingScheme,\n query,\n startElement,\n value: valueProp = isString(label) ? label : undefined,\n checkboxProps,\n endElementProps,\n groupProps,\n indicatorProps,\n labelProps,\n rootProps,\n startElementProps,\n ...rest\n }) => {\n const { checkable } = useTreeContext()\n const componentContext = useComponentContext()\n const Loading = useLoadingComponent(\n loadingScheme ?? componentContext.loadingScheme ?? \"oval\",\n )\n const animated = animatedProp ?? componentContext.animated\n const indicator = indicatorProp ?? componentContext.indicator\n const groupStartElement = getReactNodeOrFunction(\n \"group\",\n startElement,\n componentContext.startElement,\n )\n const groupEndElement = getReactNodeOrFunction(\n \"group\",\n endElement,\n componentContext.endElement,\n )\n const itemStartElement = getReactNodeOrFunction(\n \"item\",\n startElement,\n componentContext.startElement,\n )\n const itemEndElement = getReactNodeOrFunction(\n \"item\",\n endElement,\n componentContext.endElement,\n )\n const asyncChildren = useCallback(async () => {\n const items = await asyncChildrenProp?.()\n\n return recursiveTreeItem(items)\n }, [asyncChildrenProp])\n const {\n branchOpen,\n children,\n disabled,\n group,\n groupLoading,\n groupOpen,\n level,\n props,\n value,\n getCheckboxProps,\n getGroupItemProps,\n getGroupProps,\n getIndicatorProps,\n getItemProps,\n getLabelProps,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n } = useTreeItem({\n ...componentContext.itemProps,\n ...rest,\n asyncChildren: asyncChildrenProp ? asyncChildren : undefined,\n query: query ?? (isString(label) ? label : undefined),\n value: valueProp,\n })\n const itemProps = {\n className,\n css,\n colorScheme,\n \"--level\": level.toString(),\n ...rootProps,\n }\n const callbackProps = { disabled, expanded: groupOpen }\n const context = useMemo(\n () => ({\n branchOpen,\n groupOpen,\n level,\n value,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n }),\n [\n branchOpen,\n groupOpen,\n level,\n value,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n ],\n )\n const itemComponentContext = useMemo(\n () => ({\n checkboxProps: {\n size: componentContext.size,\n ...getCheckboxProps({\n ...componentContext.checkboxProps,\n ...checkboxProps,\n }),\n },\n endElementProps: {\n ...componentContext.endElementProps,\n ...endElementProps,\n },\n indicatorProps: {\n ...getIndicatorProps({\n ...componentContext.indicatorProps,\n ...indicatorProps,\n }),\n },\n labelProps: {\n ...getLabelProps({\n ...componentContext.labelProps,\n ...labelProps,\n }),\n },\n startElementProps: {\n ...componentContext.startElementProps,\n ...startElementProps,\n },\n }),\n [\n checkboxProps,\n componentContext.checkboxProps,\n componentContext.endElementProps,\n componentContext.indicatorProps,\n componentContext.labelProps,\n componentContext.size,\n componentContext.startElementProps,\n endElementProps,\n getCheckboxProps,\n getIndicatorProps,\n getLabelProps,\n indicatorProps,\n labelProps,\n startElementProps,\n ],\n )\n\n return (\n <TreeItemContext value={context}>\n <ItemComponentContext value={itemComponentContext}>\n {group ? (\n <styled.li {...getGroupItemProps(itemProps)}>\n <styled.div data-content {...props}>\n <TreeIndicator data-animated={dataAttr(animated)}>\n {groupLoading ? (\n <Loading />\n ) : (\n runIfFn(indicator, callbackProps)\n )}\n </TreeIndicator>\n {checkable ? <TreeCheckbox /> : null}\n {groupStartElement ? (\n <TreeStartElement>\n {runIfFn(groupStartElement, callbackProps)}\n </TreeStartElement>\n ) : null}\n {label ? <TreeLabel>{label}</TreeLabel> : null}\n {groupEndElement ? (\n <TreeEndElement>\n {runIfFn(groupEndElement, callbackProps)}\n </TreeEndElement>\n ) : null}\n </styled.div>\n\n <TreeGroup\n duration={!animated ? 0 : undefined}\n open={groupOpen}\n {...getGroupProps({\n ...componentContext.groupProps,\n ...groupProps,\n })}\n >\n {children}\n </TreeGroup>\n </styled.li>\n ) : (\n <styled.li {...getItemProps(itemProps)}>\n <styled.div data-content {...props}>\n <TreeIndicator data-hidden />\n {checkable ? <TreeCheckbox /> : null}\n {itemStartElement ? (\n <TreeStartElement>\n {runIfFn(itemStartElement, callbackProps)}\n </TreeStartElement>\n ) : null}\n {label ? <TreeLabel>{label}</TreeLabel> : null}\n {itemEndElement ? (\n <TreeEndElement>\n {runIfFn(itemEndElement, callbackProps)}\n </TreeEndElement>\n ) : null}\n </styled.div>\n </styled.li>\n )}\n </ItemComponentContext>\n </TreeItemContext>\n )\n },\n \"item\",\n)()\n\ninterface TreeGroupProps\n extends\n Omit<HTMLStyledProps<\"ul\">, \"transition\">,\n Pick<CollapseProps, \"animationOpacity\" | keyof WithTransitionProps> {}\n\nconst TreeGroup = withContext<\"ul\", TreeGroupProps>((props) => {\n return <Collapse as=\"ul\" {...cast<CollapseProps>(props)} />\n}, \"group\")()\n\ninterface TreeIndicatorProps extends HTMLStyledProps<\"svg\"> {}\n\nconst TreeIndicator = withContext<\"svg\", TreeIndicatorProps>(\n ({ children = <ChevronRightIcon />, ...rest }) => {\n const { indicatorHidden } = useComponentContext()\n\n if (indicatorHidden) return null\n\n if (isValidElement<HTMLProps<\"svg\">>(children))\n return cloneElement(children, { ...rest, ...children.props })\n\n return Children.count(children) > 1 ? Children.only(null) : null\n },\n \"indicator\",\n)(undefined, (props) => {\n const { indicatorProps } = useItemComponentContext()\n\n return mergeProps(indicatorProps, props)()\n})\n\ninterface TreeCheckboxProps extends CheckboxProps {}\n\nconst TreeCheckbox = withContext<\"input\", TreeCheckboxProps>(\n Checkbox,\n \"checkbox\",\n)(undefined, (props) => {\n const { checkboxProps } = useItemComponentContext()\n\n return mergeProps(checkboxProps, props)()\n})\n\ninterface TreeStartElementProps extends HTMLStyledProps {}\n\nconst TreeStartElement = withContext<\"div\", TreeStartElementProps>(\"div\", {\n name: \"StartElement\",\n slot: [\"element\", \"start\"],\n})(undefined, (props) => {\n const { startElementProps } = useItemComponentContext()\n\n return mergeProps(startElementProps, props)()\n})\n\ninterface TreeEndElementProps extends HTMLStyledProps {}\n\nconst TreeEndElement = withContext<\"div\", TreeEndElementProps>(\"div\", {\n name: \"EndElement\",\n slot: [\"element\", \"end\"],\n})(undefined, (props) => {\n const { endElementProps } = useItemComponentContext()\n\n return mergeProps(endElementProps, props)()\n})\n\ninterface TreeLabelProps extends HTMLStyledProps<\"span\"> {}\n\nconst TreeLabel = withContext<\"span\", TreeLabelProps>(\"span\", \"label\")(\n undefined,\n (props) => {\n const { labelProps } = useItemComponentContext()\n\n return mergeProps(labelProps, props)()\n },\n)\n"],"mappings":";;;;;;;;;;;;;;;;AAsEA,MAAM,qBAAqB,UAAuB;CAChD,OAAO,OAAO,KAAK,OAAO,UAAU;EAClC,MAAM,MACJ,MAAM,WAAA,GAAA,oBAAA,cAAU,SAAA,CAAS,MAAM,KAAK,IAAI,GAAG,MAAM,MAAM,GAAG,UAAU;EAEtE,IAAI,cAAc,OAAO;GACvB,MAAM,EAAE,UAAU,GAAG,SAAS;GAE9B,OACE,iBAAA,GAAA,k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,MAAM,QAAQ,IAAI,IAAIA,MAAAA,SAAS,KAAK,IAAI,IAAI;AAC9D,GACA,WACF,CAAC,CAAC,KAAA,IAAY,UAAU;CACtB,MAAM,EAAE,mBAAmB,wBAAwB;CAEnD,OAAOC,cAAAA,WAAW,gBAAgB,KAAK,CAAC,CAAC;AAC3C,CAAC;AAID,MAAM,eAAe,YACnBC,iBAAAA,UACA,UACF,CAAC,CAAC,KAAA,IAAY,UAAU;CACtB,MAAM,EAAE,kBAAkB,wBAAwB;CAElD,OAAOD,cAAAA,WAAW,eAAe,KAAK,CAAC,CAAC;AAC1C,CAAC;AAID,MAAM,mBAAmB,YAA0C,OAAO;CACxE,MAAM;CACN,MAAM,CAAC,WAAW,OAAO;AAC3B,CAAC,CAAC,CAAC,KAAA,IAAY,UAAU;CACvB,MAAM,EAAE,sBAAsB,wBAAwB;CAEtD,OAAOA,cAAAA,WAAW,mBAAmB,KAAK,CAAC,CAAC;AAC9C,CAAC;AAID,MAAM,iBAAiB,YAAwC,OAAO;CACpE,MAAM;CACN,MAAM,CAAC,WAAW,KAAK;AACzB,CAAC,CAAC,CAAC,KAAA,IAAY,UAAU;CACvB,MAAM,EAAE,oBAAoB,wBAAwB;CAEpD,OAAOA,cAAAA,WAAW,iBAAiB,KAAK,CAAC,CAAC;AAC5C,CAAC;AAID,MAAM,YAAY,YAAoC,QAAQ,OAAO,CAAC,CACpE,KAAA,IACC,UAAU;CACT,MAAM,EAAE,eAAe,wBAAwB;CAE/C,OAAOA,cAAAA,WAAW,YAAY,KAAK,CAAC,CAAC;AACvC,CACF"}
1
+ {"version":3,"file":"tree.cjs","names":["createContext","createSlotComponent","treeStyle","useMemo","useTree","TreeDescendantsContext","TreeContext","styled","useTreeContext","useLoadingComponent","useCallback","useTreeItem","TreeItemContext","Collapse","ChevronRightIcon","isValidElement","cloneElement","Children","mergeProps","Checkbox"],"sources":["../../../../src/components/tree/tree.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement, ReactNode } from \"react\"\nimport type {\n GenericsComponent,\n HTMLProps,\n HTMLStyledProps,\n ThemeProps,\n} from \"../../core\"\nimport type { ReactNodeOrFunction } from \"../../utils\"\nimport type { CheckboxProps } from \"../checkbox\"\nimport type { CollapseProps } from \"../collapse\"\nimport type { Loading } from \"../loading\"\nimport type { WithTransitionProps } from \"../motion\"\nimport type { TreeStyle } from \"./tree.style\"\nimport type { UseTreeItemProps, UseTreeProps } from \"./use-tree\"\nimport {\n Children,\n cloneElement,\n isValidElement,\n useCallback,\n useMemo,\n} from \"react\"\nimport { createSlotComponent, mergeProps, styled } from \"../../core\"\nimport {\n cast,\n createContext,\n dataAttr,\n isObject,\n isString,\n runIfFn,\n} from \"../../utils\"\nimport { Checkbox } from \"../checkbox\"\nimport { Collapse } from \"../collapse\"\nimport { ChevronRightIcon } from \"../icon\"\nimport { useLoadingComponent } from \"../loading\"\nimport { treeStyle } from \"./tree.style\"\nimport {\n TreeContext,\n TreeDescendantsContext,\n TreeItemContext,\n useTree,\n useTreeContext,\n useTreeItem,\n} from \"./use-tree\"\n\ninterface TreeCallBackProps {\n disabled?: boolean\n expanded?: boolean\n}\n\ntype TreeItemReactNode =\n | ReactNodeOrFunction<TreeCallBackProps>\n | {\n group: ReactNodeOrFunction<TreeCallBackProps>\n item?: ReactNodeOrFunction<TreeCallBackProps>\n }\n | {\n item: ReactNodeOrFunction<TreeCallBackProps>\n group?: ReactNodeOrFunction<TreeCallBackProps>\n }\n\ninterface TreeItemWithValue extends Omit<TreeItemProps, \"children\"> {}\n\ninterface TreeItemWithChildren extends TreeItemWithValue {\n children: TreeItem[]\n}\n\nexport type TreeItem = TreeItemWithChildren | TreeItemWithValue\n\nconst recursiveTreeItem = (items?: TreeItem[]) => {\n return items?.map((props, index) => {\n const key =\n props.value || (isString(props.label) ? `${props.label}-${index}` : index)\n\n if (\"children\" in props) {\n const { children, ...rest } = props\n\n return (\n <TreeItem key={key} {...rest}>\n {recursiveTreeItem(children)}\n </TreeItem>\n )\n } else {\n return <TreeItem key={key} {...props} />\n }\n })\n}\n\nconst getReactNodeOrFunction = (\n type: \"group\" | \"item\",\n custom?: TreeItemReactNode,\n root?: TreeItemReactNode,\n): ReactNodeOrFunction<TreeCallBackProps> => {\n if (isObject(custom) && (\"group\" in custom || \"item\" in custom))\n return custom[type]\n else if (custom) return custom\n else if (isObject(root) && (\"group\" in root || \"item\" in root))\n return root[type]\n else return root\n}\n\ninterface ComponentContext extends Pick<\n TreeRootProps,\n | \"animated\"\n | \"checkboxProps\"\n | \"endElement\"\n | \"endElementProps\"\n | \"groupProps\"\n | \"indicator\"\n | \"indicatorHidden\"\n | \"indicatorProps\"\n | \"itemProps\"\n | \"labelProps\"\n | \"loadingScheme\"\n | \"size\"\n | \"startElement\"\n | \"startElementProps\"\n> {}\n\ninterface ItemComponentContext {\n checkboxProps: TreeCheckboxProps\n endElementProps: TreeEndElementProps\n indicatorProps: TreeIndicatorProps\n labelProps: TreeLabelProps\n startElementProps: TreeStartElementProps\n}\n\nconst [ItemComponentContext, useItemComponentContext] =\n createContext<ItemComponentContext>({ name: \"ItemComponentContext\" })\n\nexport interface TreeRootProps<Multiple extends boolean = false>\n extends\n HTMLStyledProps<\"ul\">,\n ThemeProps<TreeStyle>,\n UseTreeProps<Multiple>,\n Pick<\n TreeItemProps,\n | \"animated\"\n | \"checkboxProps\"\n | \"endElement\"\n | \"endElementProps\"\n | \"groupProps\"\n | \"indicator\"\n | \"indicatorProps\"\n | \"labelProps\"\n | \"loadingScheme\"\n | \"startElement\"\n | \"startElementProps\"\n > {\n /**\n * If `true`, hide the tree indicator icon for all items.\n *\n * @default false\n */\n indicatorHidden?: boolean\n /**\n * If provided, generate elements based on items.\n */\n items?: TreeItem[]\n /**\n * Props for the item component.\n */\n itemProps?: Omit<\n TreeItemProps,\n \"children\" | \"label\" | \"open\" | \"query\" | \"value\"\n >\n}\n\nconst {\n ComponentContext,\n PropsContext: TreePropsContext,\n useComponentContext,\n usePropsContext: useTreePropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<TreeRootProps, TreeStyle, ComponentContext>(\n \"tree\",\n treeStyle,\n)\n\nexport { TreePropsContext, useTreePropsContext }\n\n/**\n * `Tree` is a component used to display hierarchical data structures in an expandable tree format.\n *\n * @see https://yamada-ui.com/docs/components/tree\n */\nexport const TreeRoot = withProvider<\"ul\", TreeRootProps, \"size\">(\n <Multiple extends boolean = false>({\n size,\n animated,\n children,\n endElement,\n indicator,\n indicatorHidden,\n items,\n loadingScheme,\n startElement,\n checkboxProps,\n endElementProps,\n groupProps,\n indicatorProps,\n itemProps,\n labelProps,\n startElementProps,\n ...rest\n }: TreeRootProps<Multiple>) => {\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return recursiveTreeItem(items)\n }, [children, items])\n const {\n activeDescendant,\n checkable,\n checkedValue,\n descendants,\n expandedValue,\n multiple,\n selectedValue,\n getRootProps,\n onActiveDescendant,\n onCheckedChange,\n onCollapseAll,\n onExpandAll,\n onExpandedChange,\n onSearch,\n onSelectedChange,\n } = useTree({ ...rest, children: computedChildren })\n const context = useMemo(\n () => ({\n activeDescendant,\n checkable,\n checkedValue,\n expandedValue,\n multiple,\n selectedValue,\n onActiveDescendant,\n onCheckedChange,\n onCollapseAll,\n onExpandAll,\n onExpandedChange,\n onSearch,\n onSelectedChange,\n }),\n [\n activeDescendant,\n checkable,\n checkedValue,\n expandedValue,\n multiple,\n selectedValue,\n onActiveDescendant,\n onCheckedChange,\n onSearch,\n onCollapseAll,\n onExpandAll,\n onExpandedChange,\n onSelectedChange,\n ],\n )\n const componentContext = useMemo(\n () => ({\n size,\n animated,\n endElement,\n indicator,\n indicatorHidden,\n loadingScheme,\n startElement,\n checkboxProps,\n endElementProps,\n groupProps,\n indicatorProps,\n itemProps,\n labelProps,\n startElementProps,\n }),\n [\n size,\n animated,\n endElement,\n indicator,\n indicatorHidden,\n startElement,\n endElementProps,\n groupProps,\n indicatorProps,\n itemProps,\n labelProps,\n startElementProps,\n checkboxProps,\n loadingScheme,\n ],\n )\n\n return (\n <TreeDescendantsContext value={descendants}>\n <TreeContext value={context}>\n <ComponentContext value={componentContext}>\n <styled.ul {...getRootProps()} />\n </ComponentContext>\n </TreeContext>\n </TreeDescendantsContext>\n )\n },\n \"root\",\n { transferProps: [\"size\"] },\n)() as GenericsComponent<{\n <Multiple extends boolean = false>(\n props: TreeRootProps<Multiple>,\n ): ReactElement\n}>\n\nexport interface TreeItemProps\n extends HTMLStyledProps<\"div\">, Omit<UseTreeItemProps, \"asyncChildren\"> {\n /**\n * The label to display in the item.\n */\n label: ReactNode\n /**\n * If `true`, the tree item will be animated.\n *\n * @default false\n */\n animated?: boolean\n /**\n * The element to display at the end of the item.\n */\n endElement?: TreeItemReactNode\n /**\n * The tree indicator icon to use.\n */\n indicator?: ReactNodeOrFunction<TreeCallBackProps>\n /**\n * The loading scheme.\n *\n * @default 'oval'\n */\n loadingScheme?: Loading.Scheme\n /**\n * The element to display at the start of the item.\n */\n startElement?: TreeItemReactNode\n /**\n * Props for the checkbox component.\n */\n checkboxProps?: Omit<CheckboxProps, \"checked\" | \"defaultChecked\" | \"value\">\n /**\n * Props for the end component.\n */\n endElementProps?: TreeEndElementProps\n /**\n * Props for the group component.\n */\n groupProps?: Omit<TreeGroupProps, \"children\">\n /**\n * Props for the indicator component.\n */\n indicatorProps?: TreeIndicatorProps\n /**\n * Props for the label component.\n */\n labelProps?: TreeLabelProps\n /**\n * Props for the root element.\n */\n rootProps?: HTMLStyledProps<\"li\">\n /**\n * Props for the start component.\n */\n startElementProps?: TreeStartElementProps\n /**\n * If provided, the tree item will be rendered as an async tree item.\n */\n asyncChildren?: () => Promise<TreeItem[]>\n}\n\nexport const TreeItem = withContext<\"div\", TreeItemProps>(\n ({\n className,\n css,\n colorScheme,\n animated: animatedProp,\n asyncChildren: asyncChildrenProp,\n endElement,\n indicator: indicatorProp,\n label,\n loadingScheme,\n query,\n startElement,\n value: valueProp = isString(label) ? label : undefined,\n checkboxProps,\n endElementProps,\n groupProps,\n indicatorProps,\n labelProps,\n rootProps,\n startElementProps,\n ...rest\n }) => {\n const { checkable } = useTreeContext()\n const componentContext = useComponentContext()\n const Loading = useLoadingComponent(\n loadingScheme ?? componentContext.loadingScheme ?? \"oval\",\n )\n const animated = animatedProp ?? componentContext.animated\n const indicator = indicatorProp ?? componentContext.indicator\n const groupStartElement = getReactNodeOrFunction(\n \"group\",\n startElement,\n componentContext.startElement,\n )\n const groupEndElement = getReactNodeOrFunction(\n \"group\",\n endElement,\n componentContext.endElement,\n )\n const itemStartElement = getReactNodeOrFunction(\n \"item\",\n startElement,\n componentContext.startElement,\n )\n const itemEndElement = getReactNodeOrFunction(\n \"item\",\n endElement,\n componentContext.endElement,\n )\n const asyncChildren = useCallback(async () => {\n const items = await asyncChildrenProp?.()\n\n return recursiveTreeItem(items)\n }, [asyncChildrenProp])\n const {\n branchOpen,\n children,\n disabled,\n group,\n groupLoading,\n groupOpen,\n level,\n props,\n value,\n getCheckboxProps,\n getGroupItemProps,\n getGroupProps,\n getIndicatorProps,\n getItemProps,\n getLabelProps,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n } = useTreeItem({\n ...componentContext.itemProps,\n ...rest,\n asyncChildren: asyncChildrenProp ? asyncChildren : undefined,\n query: query ?? (isString(label) ? label : undefined),\n value: valueProp,\n })\n const itemProps = {\n className,\n css,\n colorScheme,\n \"--level\": level.toString(),\n ...rootProps,\n }\n const callbackProps = { disabled, expanded: groupOpen }\n const context = useMemo(\n () => ({\n branchOpen,\n groupOpen,\n level,\n value,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n }),\n [\n branchOpen,\n groupOpen,\n level,\n value,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n ],\n )\n const itemComponentContext = useMemo(\n () => ({\n checkboxProps: {\n size: componentContext.size,\n ...getCheckboxProps({\n ...componentContext.checkboxProps,\n ...checkboxProps,\n }),\n },\n endElementProps: {\n ...componentContext.endElementProps,\n ...endElementProps,\n },\n indicatorProps: {\n ...getIndicatorProps({\n ...componentContext.indicatorProps,\n ...indicatorProps,\n }),\n },\n labelProps: {\n ...getLabelProps({\n ...componentContext.labelProps,\n ...labelProps,\n }),\n },\n startElementProps: {\n ...componentContext.startElementProps,\n ...startElementProps,\n },\n }),\n [\n checkboxProps,\n componentContext.checkboxProps,\n componentContext.endElementProps,\n componentContext.indicatorProps,\n componentContext.labelProps,\n componentContext.size,\n componentContext.startElementProps,\n endElementProps,\n getCheckboxProps,\n getIndicatorProps,\n getLabelProps,\n indicatorProps,\n labelProps,\n startElementProps,\n ],\n )\n\n return (\n <TreeItemContext value={context}>\n <ItemComponentContext value={itemComponentContext}>\n {group ? (\n <styled.li {...getGroupItemProps(itemProps)}>\n <styled.div data-content {...props}>\n <TreeIndicator data-animated={dataAttr(animated)}>\n {groupLoading ? (\n <Loading />\n ) : (\n runIfFn(indicator, callbackProps)\n )}\n </TreeIndicator>\n {checkable ? <TreeCheckbox /> : null}\n {groupStartElement ? (\n <TreeStartElement>\n {runIfFn(groupStartElement, callbackProps)}\n </TreeStartElement>\n ) : null}\n {label ? <TreeLabel>{label}</TreeLabel> : null}\n {groupEndElement ? (\n <TreeEndElement>\n {runIfFn(groupEndElement, callbackProps)}\n </TreeEndElement>\n ) : null}\n </styled.div>\n\n <TreeGroup\n duration={!animated ? 0 : undefined}\n open={groupOpen}\n {...getGroupProps({\n ...componentContext.groupProps,\n ...groupProps,\n })}\n >\n {children}\n </TreeGroup>\n </styled.li>\n ) : (\n <styled.li {...getItemProps(itemProps)}>\n <styled.div data-content {...props}>\n <TreeIndicator data-hidden />\n {checkable ? <TreeCheckbox /> : null}\n {itemStartElement ? (\n <TreeStartElement>\n {runIfFn(itemStartElement, callbackProps)}\n </TreeStartElement>\n ) : null}\n {label ? <TreeLabel>{label}</TreeLabel> : null}\n {itemEndElement ? (\n <TreeEndElement>\n {runIfFn(itemEndElement, callbackProps)}\n </TreeEndElement>\n ) : null}\n </styled.div>\n </styled.li>\n )}\n </ItemComponentContext>\n </TreeItemContext>\n )\n },\n \"item\",\n)()\n\ninterface TreeGroupProps\n extends\n Omit<HTMLStyledProps<\"ul\">, \"transition\">,\n Pick<CollapseProps, \"animationOpacity\" | keyof WithTransitionProps> {}\n\nconst TreeGroup = withContext<\"ul\", TreeGroupProps>((props) => {\n return <Collapse as=\"ul\" {...cast<CollapseProps>(props)} />\n}, \"group\")()\n\ninterface TreeIndicatorProps extends HTMLStyledProps<\"svg\"> {}\n\nconst TreeIndicator = withContext<\"svg\", TreeIndicatorProps>(\n ({ children = <ChevronRightIcon />, ...rest }) => {\n const { indicatorHidden } = useComponentContext()\n\n if (indicatorHidden) return null\n\n if (isValidElement<HTMLProps<\"svg\">>(children))\n return cloneElement(children, { ...rest, ...children.props })\n\n return Children.count(children) > 1 ? Children.only(null) : null\n },\n \"indicator\",\n)(undefined, (props) => {\n const { indicatorProps } = useItemComponentContext()\n\n return mergeProps(indicatorProps, props)()\n})\n\ninterface TreeCheckboxProps extends CheckboxProps {}\n\nconst TreeCheckbox = withContext<\"input\", TreeCheckboxProps>(\n Checkbox,\n \"checkbox\",\n)(undefined, (props) => {\n const { checkboxProps } = useItemComponentContext()\n\n return mergeProps(checkboxProps, props)()\n})\n\ninterface TreeStartElementProps extends HTMLStyledProps {}\n\nconst TreeStartElement = withContext<\"div\", TreeStartElementProps>(\"div\", {\n name: \"StartElement\",\n slot: [\"element\", \"start\"],\n})(undefined, (props) => {\n const { startElementProps } = useItemComponentContext()\n\n return mergeProps(startElementProps, props)()\n})\n\ninterface TreeEndElementProps extends HTMLStyledProps {}\n\nconst TreeEndElement = withContext<\"div\", TreeEndElementProps>(\"div\", {\n name: \"EndElement\",\n slot: [\"element\", \"end\"],\n})(undefined, (props) => {\n const { endElementProps } = useItemComponentContext()\n\n return mergeProps(endElementProps, props)()\n})\n\ninterface TreeLabelProps extends HTMLStyledProps<\"span\"> {}\n\nconst TreeLabel = withContext<\"span\", TreeLabelProps>(\"span\", \"label\")(\n undefined,\n (props) => {\n const { labelProps }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AAC;CACpB,MAAM,EACJ,kBACA,WACA,cACA,aACA,eACA,UACA,eACA,cACA,oBACA,iBACA,eACA,aACA,kBACA,UACA,qBACEC,iBAAAA,QAAQ;EAAE,GAAG;EAAM,UAAU;CAAiB,CAAC;CACnD,MAAM,WAAA,GAAUD,MAAAA,QAAAA,QACP;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,IACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CACA,MAAM,oBAAA,GAAmBA,MAAAA,QAAAA,QAChB;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,IACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CAEA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACE,iBAAAA,wBAAD;EAAwB,OAAO;EAC7B,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,iBAAAA,aAAD;GAAa,OAAO;GAClB,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,kBAAD;IAAkB,OAAO;IACvB,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,gBAAAA,OAAO,IAAR,EAAW,GAAI,aAAa,EAAI,CAAA;GAChB,CAAA;EACP,CAAA;CACS,CAAA;AAE5B,GACA,QACA,EAAE,eAAe,CAAC,MAAM,EAAE,CAC5B,CAAC,CAAC;AAsEF,MAAa,WAAW,aACrB,EACC,WACA,KACA,aACA,UAAU,cACV,eAAe,mBACf,YACA,WAAW,eACX,OACA,eACA,OACA,cACA,OAAO,aAAA,GAAA,oBAAA,cAAY,SAAA,CAAS,KAAK,IAAI,QAAQ,KAAA,GAC7C,eACA,iBACA,YACA,gBACA,YACA,WACA,mBACA,GAAG,WACC;CACJ,MAAM,EAAE,cAAcC,iBAAAA,eAAe;CACrC,MAAM,mBAA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,eAAe,wBAAwB;CAE/C,OAAOA,cAAAA,WAAW,YAAY,KAAK,CAAC,CAAC;AACvC,CACF"}
@@ -148,6 +148,7 @@ const require_astroid_icon = require("./components/icon/icons/astroid-icon.cjs")
148
148
  const require_at_sign_icon = require("./components/icon/icons/at-sign-icon.cjs");
149
149
  const require_atom_icon = require("./components/icon/icons/atom-icon.cjs");
150
150
  const require_audio_lines_icon = require("./components/icon/icons/audio-lines-icon.cjs");
151
+ const require_audio_lines_off_icon = require("./components/icon/icons/audio-lines-off-icon.cjs");
151
152
  const require_audio_lines_x_icon = require("./components/icon/icons/audio-lines-x-icon.cjs");
152
153
  const require_audio_waveform_icon = require("./components/icon/icons/audio-waveform-icon.cjs");
153
154
  const require_award_icon = require("./components/icon/icons/award-icon.cjs");
@@ -339,6 +340,7 @@ const require_cannabis_icon = require("./components/icon/icons/cannabis-icon.cjs
339
340
  const require_cannabis_off_icon = require("./components/icon/icons/cannabis-off-icon.cjs");
340
341
  const require_captions_icon = require("./components/icon/icons/captions-icon.cjs");
341
342
  const require_captions_off_icon = require("./components/icon/icons/captions-off-icon.cjs");
343
+ const require_car_battery_icon = require("./components/icon/icons/car-battery-icon.cjs");
342
344
  const require_car_front_icon = require("./components/icon/icons/car-front-icon.cjs");
343
345
  const require_car_icon = require("./components/icon/icons/car-icon.cjs");
344
346
  const require_car_taxi_front_icon = require("./components/icon/icons/car-taxi-front-icon.cjs");
@@ -969,6 +971,7 @@ const require_list_check_icon = require("./components/icon/icons/list-check-icon
969
971
  const require_list_checks_icon = require("./components/icon/icons/list-checks-icon.cjs");
970
972
  const require_list_chevrons_down_up_icon = require("./components/icon/icons/list-chevrons-down-up-icon.cjs");
971
973
  const require_list_chevrons_up_down_icon = require("./components/icon/icons/list-chevrons-up-down-icon.cjs");
974
+ const require_list_clock_icon = require("./components/icon/icons/list-clock-icon.cjs");
972
975
  const require_list_collapse_icon = require("./components/icon/icons/list-collapse-icon.cjs");
973
976
  const require_list_end_icon = require("./components/icon/icons/list-end-icon.cjs");
974
977
  const require_list_filter_icon = require("./components/icon/icons/list-filter-icon.cjs");
@@ -1083,6 +1086,7 @@ const require_mic_vocal_icon = require("./components/icon/icons/mic-vocal-icon.c
1083
1086
  const require_microchip_icon = require("./components/icon/icons/microchip-icon.cjs");
1084
1087
  const require_microscope_icon = require("./components/icon/icons/microscope-icon.cjs");
1085
1088
  const require_microwave_icon = require("./components/icon/icons/microwave-icon.cjs");
1089
+ const require_midi_port_icon = require("./components/icon/icons/midi-port-icon.cjs");
1086
1090
  const require_milestone_icon = require("./components/icon/icons/milestone-icon.cjs");
1087
1091
  const require_milk_icon = require("./components/icon/icons/milk-icon.cjs");
1088
1092
  const require_milk_off_icon = require("./components/icon/icons/milk-off-icon.cjs");
@@ -1107,6 +1111,8 @@ const require_monitor_up_icon = require("./components/icon/icons/monitor-up-icon
1107
1111
  const require_monitor_x_icon = require("./components/icon/icons/monitor-x-icon.cjs");
1108
1112
  const require_moon_icon = require("./components/icon/icons/moon-icon.cjs");
1109
1113
  const require_moon_star_icon = require("./components/icon/icons/moon-star-icon.cjs");
1114
+ const require_mop_icon = require("./components/icon/icons/mop-icon.cjs");
1115
+ const require_mop_sparkles_icon = require("./components/icon/icons/mop-sparkles-icon.cjs");
1110
1116
  const require_mosque_icon = require("./components/icon/icons/mosque-icon.cjs");
1111
1117
  const require_motorbike_icon = require("./components/icon/icons/motorbike-icon.cjs");
1112
1118
  const require_mountain_icon = require("./components/icon/icons/mountain-icon.cjs");
@@ -1506,6 +1512,7 @@ const require_square_dashed_kanban_icon = require("./components/icon/icons/squar
1506
1512
  const require_square_dashed_mouse_pointer_icon = require("./components/icon/icons/square-dashed-mouse-pointer-icon.cjs");
1507
1513
  const require_square_dashed_text_icon = require("./components/icon/icons/square-dashed-text-icon.cjs");
1508
1514
  const require_square_dashed_top_solid_icon = require("./components/icon/icons/square-dashed-top-solid-icon.cjs");
1515
+ const require_square_dimensions_icon = require("./components/icon/icons/square-dimensions-icon.cjs");
1509
1516
  const require_square_divide_icon = require("./components/icon/icons/square-divide-icon.cjs");
1510
1517
  const require_square_dot_icon = require("./components/icon/icons/square-dot-icon.cjs");
1511
1518
  const require_square_equal_icon = require("./components/icon/icons/square-equal-icon.cjs");
@@ -1540,6 +1547,7 @@ const require_square_stack_icon = require("./components/icon/icons/square-stack-
1540
1547
  const require_square_star_icon = require("./components/icon/icons/square-star-icon.cjs");
1541
1548
  const require_square_stop_icon = require("./components/icon/icons/square-stop-icon.cjs");
1542
1549
  const require_square_terminal_icon = require("./components/icon/icons/square-terminal-icon.cjs");
1550
+ const require_square_text_icon = require("./components/icon/icons/square-text-icon.cjs");
1543
1551
  const require_square_user_icon = require("./components/icon/icons/square-user-icon.cjs");
1544
1552
  const require_square_user_round_icon = require("./components/icon/icons/square-user-round-icon.cjs");
1545
1553
  const require_square_x_icon = require("./components/icon/icons/square-x-icon.cjs");
@@ -1705,6 +1713,7 @@ const require_unlink2_icon = require("./components/icon/icons/unlink2-icon.cjs")
1705
1713
  const require_unlink_icon = require("./components/icon/icons/unlink-icon.cjs");
1706
1714
  const require_unplug_icon = require("./components/icon/icons/unplug-icon.cjs");
1707
1715
  const require_upload_icon = require("./components/icon/icons/upload-icon.cjs");
1716
+ const require_usb_c_port_icon = require("./components/icon/icons/usb-c-port-icon.cjs");
1708
1717
  const require_usb_icon = require("./components/icon/icons/usb-icon.cjs");
1709
1718
  const require_user_check_icon = require("./components/icon/icons/user-check-icon.cjs");
1710
1719
  const require_user_cog_icon = require("./components/icon/icons/user-cog-icon.cjs");
@@ -2398,6 +2407,7 @@ var src_exports = /* @__PURE__ */ require_runtime.__exportAll({
2398
2407
  AtSignIcon: () => require_at_sign_icon.AtSignIcon,
2399
2408
  AtomIcon: () => require_atom_icon.AtomIcon,
2400
2409
  AudioLinesIcon: () => require_audio_lines_icon.AudioLinesIcon,
2410
+ AudioLinesOffIcon: () => require_audio_lines_off_icon.AudioLinesOffIcon,
2401
2411
  AudioLinesXIcon: () => require_audio_lines_x_icon.AudioLinesXIcon,
2402
2412
  AudioWaveformIcon: () => require_audio_waveform_icon.AudioWaveformIcon,
2403
2413
  Autocomplete: () => require_namespace$18.namespace_exports,
@@ -2636,6 +2646,7 @@ var src_exports = /* @__PURE__ */ require_runtime.__exportAll({
2636
2646
  Caption: () => require_native_table.Caption,
2637
2647
  CaptionsIcon: () => require_captions_icon.CaptionsIcon,
2638
2648
  CaptionsOffIcon: () => require_captions_off_icon.CaptionsOffIcon,
2649
+ CarBatteryIcon: () => require_car_battery_icon.CarBatteryIcon,
2639
2650
  CarFrontIcon: () => require_car_front_icon.CarFrontIcon,
2640
2651
  CarIcon: () => require_car_icon.CarIcon,
2641
2652
  CarTaxiFrontIcon: () => require_car_taxi_front_icon.CarTaxiFrontIcon,
@@ -3523,6 +3534,7 @@ var src_exports = /* @__PURE__ */ require_runtime.__exportAll({
3523
3534
  ListChecksIcon: () => require_list_checks_icon.ListChecksIcon,
3524
3535
  ListChevronsDownUpIcon: () => require_list_chevrons_down_up_icon.ListChevronsDownUpIcon,
3525
3536
  ListChevronsUpDownIcon: () => require_list_chevrons_up_down_icon.ListChevronsUpDownIcon,
3537
+ ListClockIcon: () => require_list_clock_icon.ListClockIcon,
3526
3538
  ListCollapseIcon: () => require_list_collapse_icon.ListCollapseIcon,
3527
3539
  ListEndIcon: () => require_list_end_icon.ListEndIcon,
3528
3540
  ListFilterIcon: () => require_list_filter_icon.ListFilterIcon,
@@ -3669,6 +3681,7 @@ var src_exports = /* @__PURE__ */ require_runtime.__exportAll({
3669
3681
  MicrochipIcon: () => require_microchip_icon.MicrochipIcon,
3670
3682
  MicroscopeIcon: () => require_microscope_icon.MicroscopeIcon,
3671
3683
  MicrowaveIcon: () => require_microwave_icon.MicrowaveIcon,
3684
+ MidiPortIcon: () => require_midi_port_icon.MidiPortIcon,
3672
3685
  MilestoneIcon: () => require_milestone_icon.MilestoneIcon,
3673
3686
  MilkIcon: () => require_milk_icon.MilkIcon,
3674
3687
  MilkOffIcon: () => require_milk_off_icon.MilkOffIcon,
@@ -3705,6 +3718,8 @@ var src_exports = /* @__PURE__ */ require_runtime.__exportAll({
3705
3718
  MonitorXIcon: () => require_monitor_x_icon.MonitorXIcon,
3706
3719
  MoonIcon: () => require_moon_icon.MoonIcon,
3707
3720
  MoonStarIcon: () => require_moon_star_icon.MoonStarIcon,
3721
+ MopIcon: () => require_mop_icon.MopIcon,
3722
+ MopSparklesIcon: () => require_mop_sparkles_icon.MopSparklesIcon,
3708
3723
  MosqueIcon: () => require_mosque_icon.MosqueIcon,
3709
3724
  Motion: () => require_motion.Motion,
3710
3725
  MotorbikeIcon: () => require_motorbike_icon.MotorbikeIcon,
@@ -4285,6 +4300,7 @@ var src_exports = /* @__PURE__ */ require_runtime.__exportAll({
4285
4300
  SquareDashedMousePointerIcon: () => require_square_dashed_mouse_pointer_icon.SquareDashedMousePointerIcon,
4286
4301
  SquareDashedTextIcon: () => require_square_dashed_text_icon.SquareDashedTextIcon,
4287
4302
  SquareDashedTopSolidIcon: () => require_square_dashed_top_solid_icon.SquareDashedTopSolidIcon,
4303
+ SquareDimensionsIcon: () => require_square_dimensions_icon.SquareDimensionsIcon,
4288
4304
  SquareDivideIcon: () => require_square_divide_icon.SquareDivideIcon,
4289
4305
  SquareDotIcon: () => require_square_dot_icon.SquareDotIcon,
4290
4306
  SquareEqualIcon: () => require_square_equal_icon.SquareEqualIcon,
@@ -4319,6 +4335,7 @@ var src_exports = /* @__PURE__ */ require_runtime.__exportAll({
4319
4335
  SquareStarIcon: () => require_square_star_icon.SquareStarIcon,
4320
4336
  SquareStopIcon: () => require_square_stop_icon.SquareStopIcon,
4321
4337
  SquareTerminalIcon: () => require_square_terminal_icon.SquareTerminalIcon,
4338
+ SquareTextIcon: () => require_square_text_icon.SquareTextIcon,
4322
4339
  SquareUserIcon: () => require_square_user_icon.SquareUserIcon,
4323
4340
  SquareUserRoundIcon: () => require_square_user_round_icon.SquareUserRoundIcon,
4324
4341
  SquareXIcon: () => require_square_x_icon.SquareXIcon,
@@ -4568,6 +4585,7 @@ var src_exports = /* @__PURE__ */ require_runtime.__exportAll({
4568
4585
  UnlinkIcon: () => require_unlink_icon.UnlinkIcon,
4569
4586
  UnplugIcon: () => require_unplug_icon.UnplugIcon,
4570
4587
  UploadIcon: () => require_upload_icon.UploadIcon,
4588
+ UsbCPortIcon: () => require_usb_c_port_icon.UsbCPortIcon,
4571
4589
  UsbIcon: () => require_usb_icon.UsbIcon,
4572
4590
  UserCheckIcon: () => require_user_check_icon.UserCheckIcon,
4573
4591
  UserCogIcon: () => require_user_cog_icon.UserCogIcon,
@@ -5523,6 +5541,7 @@ exports.AstroidIcon = require_astroid_icon.AstroidIcon;
5523
5541
  exports.AtSignIcon = require_at_sign_icon.AtSignIcon;
5524
5542
  exports.AtomIcon = require_atom_icon.AtomIcon;
5525
5543
  exports.AudioLinesIcon = require_audio_lines_icon.AudioLinesIcon;
5544
+ exports.AudioLinesOffIcon = require_audio_lines_off_icon.AudioLinesOffIcon;
5526
5545
  exports.AudioLinesXIcon = require_audio_lines_x_icon.AudioLinesXIcon;
5527
5546
  exports.AudioWaveformIcon = require_audio_waveform_icon.AudioWaveformIcon;
5528
5547
  Object.defineProperty(exports, "Autocomplete", {
@@ -5796,6 +5815,7 @@ exports.CannabisOffIcon = require_cannabis_off_icon.CannabisOffIcon;
5796
5815
  exports.Caption = require_native_table.Caption;
5797
5816
  exports.CaptionsIcon = require_captions_icon.CaptionsIcon;
5798
5817
  exports.CaptionsOffIcon = require_captions_off_icon.CaptionsOffIcon;
5818
+ exports.CarBatteryIcon = require_car_battery_icon.CarBatteryIcon;
5799
5819
  exports.CarFrontIcon = require_car_front_icon.CarFrontIcon;
5800
5820
  exports.CarIcon = require_car_icon.CarIcon;
5801
5821
  exports.CarTaxiFrontIcon = require_car_taxi_front_icon.CarTaxiFrontIcon;
@@ -6803,6 +6823,7 @@ exports.ListCheckIcon = require_list_check_icon.ListCheckIcon;
6803
6823
  exports.ListChecksIcon = require_list_checks_icon.ListChecksIcon;
6804
6824
  exports.ListChevronsDownUpIcon = require_list_chevrons_down_up_icon.ListChevronsDownUpIcon;
6805
6825
  exports.ListChevronsUpDownIcon = require_list_chevrons_up_down_icon.ListChevronsUpDownIcon;
6826
+ exports.ListClockIcon = require_list_clock_icon.ListClockIcon;
6806
6827
  exports.ListCollapseIcon = require_list_collapse_icon.ListCollapseIcon;
6807
6828
  exports.ListEndIcon = require_list_end_icon.ListEndIcon;
6808
6829
  exports.ListFilterIcon = require_list_filter_icon.ListFilterIcon;
@@ -6959,6 +6980,7 @@ exports.MicVocalIcon = require_mic_vocal_icon.MicVocalIcon;
6959
6980
  exports.MicrochipIcon = require_microchip_icon.MicrochipIcon;
6960
6981
  exports.MicroscopeIcon = require_microscope_icon.MicroscopeIcon;
6961
6982
  exports.MicrowaveIcon = require_microwave_icon.MicrowaveIcon;
6983
+ exports.MidiPortIcon = require_midi_port_icon.MidiPortIcon;
6962
6984
  exports.MilestoneIcon = require_milestone_icon.MilestoneIcon;
6963
6985
  exports.MilkIcon = require_milk_icon.MilkIcon;
6964
6986
  exports.MilkOffIcon = require_milk_off_icon.MilkOffIcon;
@@ -7000,6 +7022,8 @@ exports.MonitorUpIcon = require_monitor_up_icon.MonitorUpIcon;
7000
7022
  exports.MonitorXIcon = require_monitor_x_icon.MonitorXIcon;
7001
7023
  exports.MoonIcon = require_moon_icon.MoonIcon;
7002
7024
  exports.MoonStarIcon = require_moon_star_icon.MoonStarIcon;
7025
+ exports.MopIcon = require_mop_icon.MopIcon;
7026
+ exports.MopSparklesIcon = require_mop_sparkles_icon.MopSparklesIcon;
7003
7027
  exports.MosqueIcon = require_mosque_icon.MosqueIcon;
7004
7028
  exports.Motion = require_motion.Motion;
7005
7029
  exports.MotorbikeIcon = require_motorbike_icon.MotorbikeIcon;
@@ -7685,6 +7709,7 @@ exports.SquareDashedKanbanIcon = require_square_dashed_kanban_icon.SquareDashedK
7685
7709
  exports.SquareDashedMousePointerIcon = require_square_dashed_mouse_pointer_icon.SquareDashedMousePointerIcon;
7686
7710
  exports.SquareDashedTextIcon = require_square_dashed_text_icon.SquareDashedTextIcon;
7687
7711
  exports.SquareDashedTopSolidIcon = require_square_dashed_top_solid_icon.SquareDashedTopSolidIcon;
7712
+ exports.SquareDimensionsIcon = require_square_dimensions_icon.SquareDimensionsIcon;
7688
7713
  exports.SquareDivideIcon = require_square_divide_icon.SquareDivideIcon;
7689
7714
  exports.SquareDotIcon = require_square_dot_icon.SquareDotIcon;
7690
7715
  exports.SquareEqualIcon = require_square_equal_icon.SquareEqualIcon;
@@ -7719,6 +7744,7 @@ exports.SquareStackIcon = require_square_stack_icon.SquareStackIcon;
7719
7744
  exports.SquareStarIcon = require_square_star_icon.SquareStarIcon;
7720
7745
  exports.SquareStopIcon = require_square_stop_icon.SquareStopIcon;
7721
7746
  exports.SquareTerminalIcon = require_square_terminal_icon.SquareTerminalIcon;
7747
+ exports.SquareTextIcon = require_square_text_icon.SquareTextIcon;
7722
7748
  exports.SquareUserIcon = require_square_user_icon.SquareUserIcon;
7723
7749
  exports.SquareUserRoundIcon = require_square_user_round_icon.SquareUserRoundIcon;
7724
7750
  exports.SquareXIcon = require_square_x_icon.SquareXIcon;
@@ -7998,6 +8024,7 @@ exports.Unlink2Icon = require_unlink2_icon.Unlink2Icon;
7998
8024
  exports.UnlinkIcon = require_unlink_icon.UnlinkIcon;
7999
8025
  exports.UnplugIcon = require_unplug_icon.UnplugIcon;
8000
8026
  exports.UploadIcon = require_upload_icon.UploadIcon;
8027
+ exports.UsbCPortIcon = require_usb_c_port_icon.UsbCPortIcon;
8001
8028
  exports.UsbIcon = require_usb_icon.UsbIcon;
8002
8029
  exports.UserCheckIcon = require_user_check_icon.UserCheckIcon;
8003
8030
  exports.UserCogIcon = require_user_cog_icon.UserCogIcon;
@@ -1 +1 @@
1
- {"version":3,"file":"dom.cjs","names":["getActiveElement","React"],"sources":["../../../src/utils/dom.ts"],"sourcesContent":["import { type AnyString, getActiveElement } from \"@yamada-ui/utils\"\nimport * as React from \"react\"\n\ntype KeyboardNavigationKey =\n | \"ArrowDown\"\n | \"ArrowLeft\"\n | \"ArrowRight\"\n | \"ArrowUp\"\n | \"End\"\n | \"Home\"\n | \"PageDown\"\n | \"PageUp\"\n\ntype KeyboardControlKey =\n | \"Alt\"\n | \"Backspace\"\n | \"CapsLock\"\n | \"Control\"\n | \"Delete\"\n | \"Enter\"\n | \"Escape\"\n | \"Insert\"\n | \"Meta\"\n | \"NumLock\"\n | \"Pause\"\n | \"PrintScreen\"\n | \"ScrollLock\"\n | \"Shift\"\n | \"Space\"\n | \"Tab\"\n\ntype KeyboardFunctionKey = \"Fn\" | \"FnLock\" | `F${number}`\n\ntype KeyboardKey =\n | AnyString\n | KeyboardControlKey\n | KeyboardFunctionKey\n | KeyboardNavigationKey\n\nexport function runKeyAction<Y>(\n ev: React.KeyboardEvent<Y>,\n actions: { [key in KeyboardKey]?: React.KeyboardEventHandler<Y> },\n { preventDefault = true }: { preventDefault?: boolean } = {},\n) {\n if (ev.key === \" \") ev.key = ev.code\n const action = actions[ev.key]\n\n if (!action) return\n\n if (preventDefault) ev.preventDefault()\n\n action(ev)\n}\n\nexport function isComposing(\n ev: React.ChangeEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,\n): boolean {\n if (\"keyCode\" in ev) return ev.nativeEvent.isComposing || ev.keyCode === 229\n else if (ev.nativeEvent instanceof InputEvent)\n return ev.nativeEvent.isComposing\n else return false\n}\n\nexport function useAttributeObserver(\n ref: React.RefObject<HTMLElement | null>,\n attributeFilter: string[],\n enabled: boolean,\n func: () => void,\n) {\n React.useEffect(() => {\n if (!ref.current || !enabled) return\n\n const ownerDocument = ref.current.ownerDocument.defaultView ?? window\n\n const observer = new ownerDocument.MutationObserver((changes) => {\n for (const { type, attributeName } of changes) {\n if (type !== \"attributes\") continue\n if (!attributeName) continue\n\n if (attributeFilter.includes(attributeName)) func()\n }\n })\n\n observer.observe(ref.current, { attributeFilter, attributes: true })\n\n return () => observer.disconnect()\n })\n}\n\nexport function getEventRelatedTarget(ev: React.FocusEvent | React.MouseEvent) {\n if (ev.relatedTarget) return ev.relatedTarget as HTMLElement\n\n const getRootNode = (\n ev.currentTarget as unknown as {\n getRootNode?: () => Document | ShadowRoot\n }\n ).getRootNode\n const root = getRootNode?.call(ev.currentTarget)\n\n return ((root && getActiveElement(root)) ??\n ev.currentTarget.ownerDocument.activeElement) as HTMLElement | null\n}\n\nconst visuallyHiddenStyle = {\n border: \"0px\",\n clipPath: \"rect(0px 0px 0px 0px)\",\n height: \"1px\",\n margin: \"-1px\",\n overflow: \"hidden\",\n padding: \"0px\",\n position: \"absolute\",\n whiteSpace: \"nowrap\",\n width: \"1px\",\n} satisfies React.CSSProperties\n\nexport const visuallyHiddenAttributes = {\n style: visuallyHiddenStyle,\n \"aria-hidden\": true,\n tabIndex: -1,\n} satisfies React.HTMLAttributes<HTMLElement>\n\nexport function* useIds() {\n const id = React.useId()\n\n for (let i = 0; ; i++) yield `${id}-${i}`\n}\n"],"mappings":";;;;;AAuCA,SAAgB,aACd,IACA,SACA,EAAE,iBAAiB,SAAuC,CAAC,GAC3D;CACA,IAAI,GAAG,QAAQ,KAAK,GAAG,MAAM,GAAG;CAChC,MAAM,SAAS,QAAQ,GAAG;CAE1B,IAAI,CAAC,QAAQ;CAEb,IAAI,gBAAgB,GAAG,eAAe;CAEtC,OAAO,EAAE;AACX;AAEA,SAAgB,YACd,IACS;CACT,IAAI,aAAa,IAAI,OAAO,GAAG,YAAY,eAAe,GAAG,YAAY;MACpE,IAAI,GAAG,uBAAuB,YACjC,OAAO,GAAG,YAAY;MACnB,OAAO;AACd;AAEA,SAAgB,qBACd,KACA,iBACA,SACA,MACA;CACA,MAAM,gBAAgB;EACpB,IAAI,CAAC,IAAI,WAAW,CAAC,SAAS;EAI9B,MAAM,WAAW,KAFK,IAAI,QAAQ,cAAc,eAAe,OAAA,CAE5B,kBAAkB,YAAY;GAC/D,KAAK,MAAM,EAAE,MAAM,mBAAmB,SAAS;IAC7C,IAAI,SAAS,cAAc;IAC3B,IAAI,CAAC,eAAe;IAEpB,IAAI,gBAAgB,SAAS,aAAa,GAAG,KAAK;GACpD;EACF,CAAC;EAED,SAAS,QAAQ,IAAI,SAAS;GAAE;GAAiB,YAAY;EAAK,CAAC;EAEnE,aAAa,SAAS,WAAW;CACnC,CAAC;AACH;AAEA,SAAgB,sBAAsB,IAAyC;CAC7E,IAAI,GAAG,eAAe,OAAO,GAAG;CAOhC,MAAM,OAJJ,GAAG,cAGH,aACwB,KAAK,GAAG,aAAa;CAE/C,QAAS,SAAA,GAAQA,iBAAAA,iBAAAA,CAAiB,IAAI,MACpC,GAAG,cAAc,cAAc;AACnC;AAcA,MAAa,2BAA2B;CACtC,OAAO;EAZP,QAAQ;EACR,UAAU;EACV,QAAQ;EACR,QAAQ;EACR,UAAU;EACV,SAAS;EACT,UAAU;EACV,YAAY;EACZ,OAAO;CAIA;CACP,eAAe;CACf,UAAU;AACZ;AAEA,UAAiB,SAAS;CACxB,MAAM,KAAKC,MAAM,MAAM;CAEvB,KAAK,IAAI,IAAI,IAAK,KAAK,MAAM,GAAG,GAAG,GAAG;AACxC"}
1
+ {"version":3,"file":"dom.cjs","names":["getActiveElement","React"],"sources":["../../../src/utils/dom.ts"],"sourcesContent":["import type { AnyString } from \"@yamada-ui/utils\"\nimport { getActiveElement } from \"@yamada-ui/utils\"\nimport * as React from \"react\"\n\ntype KeyboardNavigationKey =\n | \"ArrowDown\"\n | \"ArrowLeft\"\n | \"ArrowRight\"\n | \"ArrowUp\"\n | \"End\"\n | \"Home\"\n | \"PageDown\"\n | \"PageUp\"\n\ntype KeyboardControlKey =\n | \"Alt\"\n | \"Backspace\"\n | \"CapsLock\"\n | \"Control\"\n | \"Delete\"\n | \"Enter\"\n | \"Escape\"\n | \"Insert\"\n | \"Meta\"\n | \"NumLock\"\n | \"Pause\"\n | \"PrintScreen\"\n | \"ScrollLock\"\n | \"Shift\"\n | \"Space\"\n | \"Tab\"\n\ntype KeyboardFunctionKey = \"Fn\" | \"FnLock\" | `F${number}`\n\ntype KeyboardKey =\n | AnyString\n | KeyboardControlKey\n | KeyboardFunctionKey\n | KeyboardNavigationKey\n\nexport function runKeyAction<Y>(\n ev: React.KeyboardEvent<Y>,\n actions: { [key in KeyboardKey]?: React.KeyboardEventHandler<Y> },\n { preventDefault = true }: { preventDefault?: boolean } = {},\n) {\n if (ev.key === \" \") ev.key = ev.code\n const action = actions[ev.key]\n\n if (!action) return\n\n if (preventDefault) ev.preventDefault()\n\n action(ev)\n}\n\nexport function isComposing(\n ev: React.ChangeEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,\n): boolean {\n if (\"keyCode\" in ev) return ev.nativeEvent.isComposing || ev.keyCode === 229\n else if (ev.nativeEvent instanceof InputEvent)\n return ev.nativeEvent.isComposing\n else return false\n}\n\nexport function useAttributeObserver(\n ref: React.RefObject<HTMLElement | null>,\n attributeFilter: string[],\n enabled: boolean,\n func: () => void,\n) {\n React.useEffect(() => {\n if (!ref.current || !enabled) return\n\n const ownerDocument = ref.current.ownerDocument.defaultView ?? window\n\n const observer = new ownerDocument.MutationObserver((changes) => {\n for (const { type, attributeName } of changes) {\n if (type !== \"attributes\") continue\n if (!attributeName) continue\n\n if (attributeFilter.includes(attributeName)) func()\n }\n })\n\n observer.observe(ref.current, { attributeFilter, attributes: true })\n\n return () => observer.disconnect()\n })\n}\n\nexport function getEventRelatedTarget(ev: React.FocusEvent | React.MouseEvent) {\n if (ev.relatedTarget) return ev.relatedTarget as HTMLElement\n\n const getRootNode = (\n ev.currentTarget as unknown as {\n getRootNode?: () => Document | ShadowRoot\n }\n ).getRootNode\n const root = getRootNode?.call(ev.currentTarget)\n\n return ((root && getActiveElement(root)) ??\n ev.currentTarget.ownerDocument.activeElement) as HTMLElement | null\n}\n\nconst visuallyHiddenStyle = {\n border: \"0px\",\n clipPath: \"rect(0px 0px 0px 0px)\",\n height: \"1px\",\n margin: \"-1px\",\n overflow: \"hidden\",\n padding: \"0px\",\n position: \"absolute\",\n whiteSpace: \"nowrap\",\n width: \"1px\",\n} satisfies React.CSSProperties\n\nexport const visuallyHiddenAttributes = {\n style: visuallyHiddenStyle,\n \"aria-hidden\": true,\n tabIndex: -1,\n} satisfies React.HTMLAttributes<HTMLElement>\n\nexport function* useIds() {\n const id = React.useId()\n\n for (let i = 0; ; i++) yield `${id}-${i}`\n}\n"],"mappings":";;;;;AAwCA,SAAgB,aACd,IACA,SACA,EAAE,iBAAiB,SAAuC,CAAC,GAC3D;CACA,IAAI,GAAG,QAAQ,KAAK,GAAG,MAAM,GAAG;CAChC,MAAM,SAAS,QAAQ,GAAG;CAE1B,IAAI,CAAC,QAAQ;CAEb,IAAI,gBAAgB,GAAG,eAAe;CAEtC,OAAO,EAAE;AACX;AAEA,SAAgB,YACd,IACS;CACT,IAAI,aAAa,IAAI,OAAO,GAAG,YAAY,eAAe,GAAG,YAAY;MACpE,IAAI,GAAG,uBAAuB,YACjC,OAAO,GAAG,YAAY;MACnB,OAAO;AACd;AAEA,SAAgB,qBACd,KACA,iBACA,SACA,MACA;CACA,MAAM,gBAAgB;EACpB,IAAI,CAAC,IAAI,WAAW,CAAC,SAAS;EAI9B,MAAM,WAAW,KAFK,IAAI,QAAQ,cAAc,eAAe,OAAA,CAE5B,kBAAkB,YAAY;GAC/D,KAAK,MAAM,EAAE,MAAM,mBAAmB,SAAS;IAC7C,IAAI,SAAS,cAAc;IAC3B,IAAI,CAAC,eAAe;IAEpB,IAAI,gBAAgB,SAAS,aAAa,GAAG,KAAK;GACpD;EACF,CAAC;EAED,SAAS,QAAQ,IAAI,SAAS;GAAE;GAAiB,YAAY;EAAK,CAAC;EAEnE,aAAa,SAAS,WAAW;CACnC,CAAC;AACH;AAEA,SAAgB,sBAAsB,IAAyC;CAC7E,IAAI,GAAG,eAAe,OAAO,GAAG;CAOhC,MAAM,OAJJ,GAAG,cAGH,aACwB,KAAK,GAAG,aAAa;CAE/C,QAAS,SAAA,GAAQA,iBAAAA,iBAAAA,CAAiB,IAAI,MACpC,GAAG,cAAc,cAAc;AACnC;AAcA,MAAa,2BAA2B;CACtC,OAAO;EAZP,QAAQ;EACR,UAAU;EACV,QAAQ;EACR,QAAQ;EACR,UAAU;EACV,SAAS;EACT,UAAU;EACV,YAAY;EACZ,OAAO;CAIA;CACP,eAAe;CACf,UAAU;AACZ;AAEA,UAAiB,SAAS;CACxB,MAAM,KAAKC,MAAM,MAAM;CAEvB,KAAK,IAAI,IAAI,IAAK,KAAK,MAAM,GAAG,GAAG,GAAG;AACxC"}
@@ -1 +1 @@
1
- {"version":3,"file":"action-bar.js","names":["motion","cast"],"sources":["../../../../src/components/action-bar/action-bar.tsx"],"sourcesContent":["\"use client\"\n\nimport type { PropsWithChildren, ReactNode } from \"react\"\nimport type { HTMLProps, HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { HTMLMotionPropsWithoutAs } from \"../motion\"\nimport type { UsePopupAnimationProps } from \"../popover\"\nimport type { ActionBarStyle } from \"./action-bar.style\"\nimport type { UseActionBarProps, UseActionBarReturn } from \"./use-action-bar\"\nimport { AnimatePresence } from \"motion/react\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { useValue } from \"../../hooks/use-value\"\nimport { cast, useSplitChildren } from \"../../utils\"\nimport { motion } from \"../motion\"\nimport { usePopupAnimationProps } from \"../popover\"\nimport { Portal, type PortalProps } from \"../portal\"\nimport { actionBarStyle } from \"./action-bar.style\"\nimport { useActionBar } from \"./use-action-bar\"\n\ninterface ComponentContext\n extends\n Pick<\n UseActionBarReturn,\n \"getCloseTriggerProps\" | \"getContentProps\" | \"getOpenTriggerProps\"\n >,\n Pick<ActionBarRootProps, \"animationScheme\" | \"duration\"> {}\n\nexport interface ActionBarRootProps\n extends\n Omit<HTMLStyledProps, \"content\">,\n ThemeProps<ActionBarStyle>,\n UseActionBarProps,\n UsePopupAnimationProps {\n /**\n * The action bar content to use.\n */\n content?: ReactNode\n /**\n * The action bar trigger to use.\n */\n trigger?: ReactNode\n /**\n * Props to be forwarded to the portal component.\n */\n portalProps?: Omit<PortalProps, \"children\">\n /**\n * Callback function to run side effects after the action bar has closed.\n */\n onCloseComplete?: () => void\n}\n\nconst {\n ComponentContext,\n PropsContext: ActionBarPropsContext,\n useComponentContext,\n usePropsContext: useActionBarPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<ActionBarRootProps, ActionBarStyle, ComponentContext>(\n \"action-bar\",\n actionBarStyle,\n)\n\nexport { ActionBarPropsContext, useActionBarPropsContext }\n\n/**\n * `ActionBar` is a component that is used to display a bottom action bar with a set of actions.\n *\n * @see https://yamada-ui.com/docs/components/action-bar\n */\nexport const ActionBarRoot = withProvider<\n \"div\",\n ActionBarRootProps,\n \"placement\"\n>(\n ({\n animationScheme,\n children,\n content: contentProp,\n duration,\n placement: placementProp,\n trigger,\n portalProps,\n onCloseComplete,\n ...rest\n }) => {\n const placement = useValue(placementProp)\n\n animationScheme ??= placement?.startsWith(\"start\")\n ? \"block-start\"\n : \"block-end\"\n\n const [omittedChildren, openTrigger, content] = useSplitChildren(\n children,\n ActionBarOpenTrigger,\n ActionBarContent,\n )\n const {\n open,\n getCloseTriggerProps,\n getContentProps,\n getOpenTriggerProps,\n getRootProps,\n } = useActionBar(rest)\n const customOpenTrigger = trigger ? (\n <ActionBarOpenTrigger>{trigger}</ActionBarOpenTrigger>\n ) : null\n const customContent = contentProp ? (\n <ActionBarContent>{contentProp}</ActionBarContent>\n ) : null\n const context = useMemo(\n () => ({\n animationScheme,\n duration,\n getCloseTriggerProps,\n getContentProps,\n getOpenTriggerProps,\n }),\n [\n animationScheme,\n duration,\n getCloseTriggerProps,\n getContentProps,\n getOpenTriggerProps,\n ],\n )\n\n return (\n <ComponentContext value={context}>\n {openTrigger ?? customOpenTrigger}\n\n <AnimatePresence onExitComplete={onCloseComplete}>\n {open ? (\n <Portal {...portalProps}>\n <styled.div {...getRootProps()}>\n {content ?? customContent ?? omittedChildren}\n </styled.div>\n </Portal>\n ) : null}\n </AnimatePresence>\n </ComponentContext>\n )\n },\n \"root\",\n { transferProps: [\"placement\"] },\n)()\n\nexport interface ActionBarOpenTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const ActionBarOpenTrigger = withContext<\n \"button\",\n ActionBarOpenTriggerProps\n>(\"button\", { name: \"OpenTrigger\", slot: [\"trigger\", \"open\"] })(\n undefined,\n (props) => {\n const { getOpenTriggerProps } = useComponentContext()\n\n return { asChild: true, ...getOpenTriggerProps(props) }\n },\n)\n\nexport interface ActionBarCloseTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const ActionBarCloseTrigger = withContext<\n \"button\",\n ActionBarCloseTriggerProps\n>(\"button\", { name: \"CloseTrigger\", slot: [\"trigger\", \"close\"] })(\n undefined,\n (props) => {\n const { getCloseTriggerProps } = useComponentContext()\n\n return { asChild: true, ...getCloseTriggerProps(props) }\n },\n)\n\nexport interface ActionBarContentProps\n extends Omit<HTMLStyledProps<\"section\">, \"children\">, PropsWithChildren {}\n\nexport const ActionBarContent = withContext<\"section\", ActionBarContentProps>(\n (props) => {\n const { animationScheme, duration, getContentProps } = useComponentContext()\n const popupAnimationProps = usePopupAnimationProps({\n animationScheme,\n duration,\n })\n\n return (\n <motion.section\n {...popupAnimationProps}\n {...cast<HTMLMotionPropsWithoutAs<\"section\">>(\n getContentProps(cast<HTMLProps<\"section\">>(props)),\n )}\n />\n )\n },\n \"content\",\n)()\n\nexport interface ActionBarSeparatorProps extends HTMLStyledProps {}\n\nexport const ActionBarSeparator = withContext<\"div\", ActionBarSeparatorProps>(\n \"div\",\n \"separator\",\n)()\n"],"mappings":";;;;;;;;;;;;;;;AAmDA,MAAM,EACJ,kBACA,cAAc,uBACd,qBACA,iBAAiB,0BACjB,aACA,iBACE,oBACF,cACA,cACF;;;;;;AASA,MAAa,gBAAgB,cAK1B,EACC,iBACA,UACA,SAAS,aACT,UACA,WAAW,eACX,SACA,aACA,iBACA,GAAG,WACC;CACJ,MAAM,YA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MAAM,EAAE,iBAAiB,UAAU,oBAAoB,oBAAoB;CAC3E,MAAM,sBAAsB,uBAAuB;EACjD;EACA;CACF,CAAC;CAED,OACE,oBAACA,SAAO,SAAR;EACE,GAAI;EACJ,IAAA,GAAIC,cAAAA,KAAAA,CACF,iBAAA,GAAgBA,cAAAA,KAAAA,CAA2B,KAAK,CAAC,CACnD;CACD,CAAA;AAEL,GACA,SACF,CAAC,CAAC;AAIF,MAAa,qBAAqB,YAChC,OACA,WACF,CAAC,CAAC"}
1
+ {"version":3,"file":"action-bar.js","names":["motion","cast"],"sources":["../../../../src/components/action-bar/action-bar.tsx"],"sourcesContent":["\"use client\"\n\nimport type { PropsWithChildren, ReactNode } from \"react\"\nimport type { HTMLProps, HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { HTMLMotionPropsWithoutAs } from \"../motion\"\nimport type { UsePopupAnimationProps } from \"../popover\"\nimport type { PortalProps } from \"../portal\"\nimport type { ActionBarStyle } from \"./action-bar.style\"\nimport type { UseActionBarProps, UseActionBarReturn } from \"./use-action-bar\"\nimport { AnimatePresence } from \"motion/react\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { useValue } from \"../../hooks/use-value\"\nimport { cast, useSplitChildren } from \"../../utils\"\nimport { motion } from \"../motion\"\nimport { usePopupAnimationProps } from \"../popover\"\nimport { Portal } from \"../portal\"\nimport { actionBarStyle } from \"./action-bar.style\"\nimport { useActionBar } from \"./use-action-bar\"\n\ninterface ComponentContext\n extends\n Pick<\n UseActionBarReturn,\n \"getCloseTriggerProps\" | \"getContentProps\" | \"getOpenTriggerProps\"\n >,\n Pick<ActionBarRootProps, \"animationScheme\" | \"duration\"> {}\n\nexport interface ActionBarRootProps\n extends\n Omit<HTMLStyledProps, \"content\">,\n ThemeProps<ActionBarStyle>,\n UseActionBarProps,\n UsePopupAnimationProps {\n /**\n * The action bar content to use.\n */\n content?: ReactNode\n /**\n * The action bar trigger to use.\n */\n trigger?: ReactNode\n /**\n * Props to be forwarded to the portal component.\n */\n portalProps?: Omit<PortalProps, \"children\">\n /**\n * Callback function to run side effects after the action bar has closed.\n */\n onCloseComplete?: () => void\n}\n\nconst {\n ComponentContext,\n PropsContext: ActionBarPropsContext,\n useComponentContext,\n usePropsContext: useActionBarPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<ActionBarRootProps, ActionBarStyle, ComponentContext>(\n \"action-bar\",\n actionBarStyle,\n)\n\nexport { ActionBarPropsContext, useActionBarPropsContext }\n\n/**\n * `ActionBar` is a component that is used to display a bottom action bar with a set of actions.\n *\n * @see https://yamada-ui.com/docs/components/action-bar\n */\nexport const ActionBarRoot = withProvider<\n \"div\",\n ActionBarRootProps,\n \"placement\"\n>(\n ({\n animationScheme,\n children,\n content: contentProp,\n duration,\n placement: placementProp,\n trigger,\n portalProps,\n onCloseComplete,\n ...rest\n }) => {\n const placement = useValue(placementProp)\n\n animationScheme ??= placement?.startsWith(\"start\")\n ? \"block-start\"\n : \"block-end\"\n\n const [omittedChildren, openTrigger, content] = useSplitChildren(\n children,\n ActionBarOpenTrigger,\n ActionBarContent,\n )\n const {\n open,\n getCloseTriggerProps,\n getContentProps,\n getOpenTriggerProps,\n getRootProps,\n } = useActionBar(rest)\n const customOpenTrigger = trigger ? (\n <ActionBarOpenTrigger>{trigger}</ActionBarOpenTrigger>\n ) : null\n const customContent = contentProp ? (\n <ActionBarContent>{contentProp}</ActionBarContent>\n ) : null\n const context = useMemo(\n () => ({\n animationScheme,\n duration,\n getCloseTriggerProps,\n getContentProps,\n getOpenTriggerProps,\n }),\n [\n animationScheme,\n duration,\n getCloseTriggerProps,\n getContentProps,\n getOpenTriggerProps,\n ],\n )\n\n return (\n <ComponentContext value={context}>\n {openTrigger ?? customOpenTrigger}\n\n <AnimatePresence onExitComplete={onCloseComplete}>\n {open ? (\n <Portal {...portalProps}>\n <styled.div {...getRootProps()}>\n {content ?? customContent ?? omittedChildren}\n </styled.div>\n </Portal>\n ) : null}\n </AnimatePresence>\n </ComponentContext>\n )\n },\n \"root\",\n { transferProps: [\"placement\"] },\n)()\n\nexport interface ActionBarOpenTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const ActionBarOpenTrigger = withContext<\n \"button\",\n ActionBarOpenTriggerProps\n>(\"button\", { name: \"OpenTrigger\", slot: [\"trigger\", \"open\"] })(\n undefined,\n (props) => {\n const { getOpenTriggerProps } = useComponentContext()\n\n return { asChild: true, ...getOpenTriggerProps(props) }\n },\n)\n\nexport interface ActionBarCloseTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const ActionBarCloseTrigger = withContext<\n \"button\",\n ActionBarCloseTriggerProps\n>(\"button\", { name: \"CloseTrigger\", slot: [\"trigger\", \"close\"] })(\n undefined,\n (props) => {\n const { getCloseTriggerProps } = useComponentContext()\n\n return { asChild: true, ...getCloseTriggerProps(props) }\n },\n)\n\nexport interface ActionBarContentProps\n extends Omit<HTMLStyledProps<\"section\">, \"children\">, PropsWithChildren {}\n\nexport const ActionBarContent = withContext<\"section\", ActionBarContentProps>(\n (props) => {\n const { animationScheme, duration, getContentProps } = useComponentContext()\n const popupAnimationProps = usePopupAnimationProps({\n animationScheme,\n duration,\n })\n\n return (\n <motion.section\n {...popupAnimationProps}\n {...cast<HTMLMotionPropsWithoutAs<\"section\">>(\n getContentProps(cast<HTMLProps<\"section\">>(props)),\n )}\n />\n )\n },\n \"content\",\n)()\n\nexport interface ActionBarSeparatorProps extends HTMLStyledProps {}\n\nexport const ActionBarSeparator = withContext<\"div\", ActionBarSeparatorProps>(\n \"div\",\n \"separator\",\n)()\n"],"mappings":";;;;;;;;;;;;;;;AAoDA,MAAM,EACJ,kBACA,cAAc,uBACd,qBACA,iBAAiB,0BACjB,aACA,iBACE,oBACF,cACA,cACF;;;;;;AASA,MAAa,gBAAgB,cAK1B,EACC,iBACA,UACA,SAAS,aACT,UACA,WAAW,eACX,SACA,aACA,iBACA,GAAG,WACC;CACJ,MAAM,YAAY,SAAS,aAAa;CAExC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UAAU,oBAAoB,oBAAoB;CAC3E,MAAM,sBAAsB,uBAAuB;EACjD;EACA;CACF,CAAC;CAED,OACE,oBAACA,SAAO,SAAR;EACE,GAAI;EACJ,IAAA,GAAIC,cAAAA,KAAAA,CACF,iBAAA,GAAgBA,cAAAA,KAAAA,CAA2B,KAAK,CAAC,CACnD;CACD,CAAA;AAEL,GACA,SACF,CAAC,CAAC;AAIF,MAAa,qBAAqB,YAChC,OACA,WACF,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-action-bar.js","names":["handlerAll"],"sources":["../../../../src/components/action-bar/use-action-bar.ts"],"sourcesContent":["\"use client\"\n\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport { useCallback } from \"react\"\nimport { mergeProps, useEnvironment } from \"../../core\"\nimport {\n useDisclosure,\n type UseDisclosureProps,\n} from \"../../hooks/use-disclosure\"\nimport { useEventListener } from \"../../hooks/use-event-listener\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport { handlerAll, useIds } from \"../../utils\"\n\nexport interface UseActionBarProps\n extends HTMLProps, Omit<UseDisclosureProps, \"timing\"> {\n /**\n * If `true`, the action bar will close when the `Esc` key is pressed.\n *\n * @default true\n */\n closeOnEsc?: boolean\n}\n\nexport const useActionBar = ({\n closeOnEsc = true,\n defaultOpen,\n open: openProp,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n ...rest\n}: UseActionBarProps = {}) => {\n const { getDocument } = useEnvironment()\n const { open, onClose, onOpen } = useDisclosure({\n defaultOpen,\n open: openProp,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n })\n const [contentId] = useIds()\n const { t } = useI18n(\"actionBar\")\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent) => {\n if (ev.key !== \"Escape\") return\n\n if (!closeOnEsc) return\n\n ev.stopPropagation()\n onClose()\n },\n [closeOnEsc, onClose],\n )\n\n useEventListener(getDocument(), \"keydown\", onKeyDown)\n\n const getRootProps: PropGetter = useCallback(\n (props = {}) => mergeProps(rest, props)(),\n [rest],\n )\n\n const getOpenTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n \"aria-controls\": open ? contentId : undefined,\n \"aria-expanded\": open,\n \"aria-haspopup\": \"dialog\",\n \"aria-label\": t(\"Open action bar\"),\n ...props,\n onClick: handlerAll(props.onClick, onOpen),\n }),\n [contentId, onOpen, open, t],\n )\n\n const getCloseTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n \"aria-label\": t(\"Close action bar\"),\n ...props,\n onClick: handlerAll(props.onClick, onClose),\n }),\n [onClose, t],\n )\n\n const getContentProps: PropGetter<\"section\"> = useCallback(\n (props = {}) => ({\n id: contentId,\n role: \"dialog\",\n ...props,\n }),\n [contentId],\n )\n\n return {\n open,\n getCloseTriggerProps,\n getContentProps,\n getOpenTriggerProps,\n getRootProps,\n onClose,\n onOpen,\n }\n}\n\nexport type UseActionBarReturn = ReturnType<typeof useActionBar>\n"],"mappings":";;;;;;;;;;AAuBA,MAAa,gBAAgB,EAC3B,aAAa,MACb,aACA,MAAM,UACN,SAAS,aACT,QAAQ,YACR,GAAG,SACkB,CAAC,MAAM;CAC5B,MAAM,EAAE,gBAAgB,eAAe;CACvC,MAAM,EAAE,MAAM,SAAS,WAAW,cAAc;EAC9C;EACA,MAAM;EACN,SAAS;EACT,QAAQ;CACV,CAAC;CACD,MAAM,CAAC,aAAa,OAAO;CAC3B,MAAM,EAAE,MAAM,QAAQ,WAAW;CAEjC,MAAM,YAAY,aACf,OAAsB;EACrB,IAAI,GAAG,QAAQ,UAAU;EAEzB,IAAI,CAAC,YAAY;EAEjB,GAAG,gBAAgB;EACnB,QAAQ;CACV,GACA,CAAC,YAAY,OAAO,CACtB;CAEA,iBAAiB,YAAY,GAAG,WAAW,SAAS;CAEpD,MAAM,eAA2B,aAC9B,QAAQ,CAAC,MAAM,WAAW,MAAM,KAAK,CAAC,CAAC,GACxC,CAAC,IAAI,CACP;CAEA,MAAM,sBAA4C,aAC/C,QAAQ,CAAC,OAAO;EACf,iBAAiB,OAAO,YAAY,KAAA;EACpC,iBAAiB;EACjB,iBAAiB;EACjB,cAAc,EAAE,iBAAiB;EACjC,GAAG;EACH,UAAA,GAASA,cAAAA,WAAAA,CAAW,MAAM,SAAS,MAAM;CAC3C,IACA;EAAC;EAAW;EAAQ;EAAM;CAAC,CAC7B;CAoBA,OAAO;EACL;EACA,sBApBiD,aAChD,QAAQ,CAAC,OAAO;GACf,cAAc,EAAE,kBAAkB;GAClC,GAAG;GACH,UAAA,GAASA,cAAAA,WAAAA,CAAW,MAAM,SAAS,OAAO;EAC5C,IACA,CAAC,SAAS,CAAC,CAcQ;EACnB,iBAZ6C,aAC5C,QAAQ,CAAC,OAAO;GACf,IAAI;GACJ,MAAM;GACN,GAAG;EACL,IACA,CAAC,SAAS,CAMI;EACd;EACA;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"use-action-bar.js","names":["handlerAll"],"sources":["../../../../src/components/action-bar/use-action-bar.ts"],"sourcesContent":["\"use client\"\n\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { UseDisclosureProps } from \"../../hooks/use-disclosure\"\nimport { useCallback } from \"react\"\nimport { mergeProps, useEnvironment } from \"../../core\"\nimport { useDisclosure } from \"../../hooks/use-disclosure\"\nimport { useEventListener } from \"../../hooks/use-event-listener\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport { handlerAll, useIds } from \"../../utils\"\n\nexport interface UseActionBarProps\n extends HTMLProps, Omit<UseDisclosureProps, \"timing\"> {\n /**\n * If `true`, the action bar will close when the `Esc` key is pressed.\n *\n * @default true\n */\n closeOnEsc?: boolean\n}\n\nexport const useActionBar = ({\n closeOnEsc = true,\n defaultOpen,\n open: openProp,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n ...rest\n}: UseActionBarProps = {}) => {\n const { getDocument } = useEnvironment()\n const { open, onClose, onOpen } = useDisclosure({\n defaultOpen,\n open: openProp,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n })\n const [contentId] = useIds()\n const { t } = useI18n(\"actionBar\")\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent) => {\n if (ev.key !== \"Escape\") return\n\n if (!closeOnEsc) return\n\n ev.stopPropagation()\n onClose()\n },\n [closeOnEsc, onClose],\n )\n\n useEventListener(getDocument(), \"keydown\", onKeyDown)\n\n const getRootProps: PropGetter = useCallback(\n (props = {}) => mergeProps(rest, props)(),\n [rest],\n )\n\n const getOpenTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n \"aria-controls\": open ? contentId : undefined,\n \"aria-expanded\": open,\n \"aria-haspopup\": \"dialog\",\n \"aria-label\": t(\"Open action bar\"),\n ...props,\n onClick: handlerAll(props.onClick, onOpen),\n }),\n [contentId, onOpen, open, t],\n )\n\n const getCloseTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n \"aria-label\": t(\"Close action bar\"),\n ...props,\n onClick: handlerAll(props.onClick, onClose),\n }),\n [onClose, t],\n )\n\n const getContentProps: PropGetter<\"section\"> = useCallback(\n (props = {}) => ({\n id: contentId,\n role: \"dialog\",\n ...props,\n }),\n [contentId],\n )\n\n return {\n open,\n getCloseTriggerProps,\n getContentProps,\n getOpenTriggerProps,\n getRootProps,\n onClose,\n onOpen,\n }\n}\n\nexport type UseActionBarReturn = ReturnType<typeof useActionBar>\n"],"mappings":";;;;;;;;;;AAqBA,MAAa,gBAAgB,EAC3B,aAAa,MACb,aACA,MAAM,UACN,SAAS,aACT,QAAQ,YACR,GAAG,SACkB,CAAC,MAAM;CAC5B,MAAM,EAAE,gBAAgB,eAAe;CACvC,MAAM,EAAE,MAAM,SAAS,WAAW,cAAc;EAC9C;EACA,MAAM;EACN,SAAS;EACT,QAAQ;CACV,CAAC;CACD,MAAM,CAAC,aAAa,OAAO;CAC3B,MAAM,EAAE,MAAM,QAAQ,WAAW;CAEjC,MAAM,YAAY,aACf,OAAsB;EACrB,IAAI,GAAG,QAAQ,UAAU;EAEzB,IAAI,CAAC,YAAY;EAEjB,GAAG,gBAAgB;EACnB,QAAQ;CACV,GACA,CAAC,YAAY,OAAO,CACtB;CAEA,iBAAiB,YAAY,GAAG,WAAW,SAAS;CAEpD,MAAM,eAA2B,aAC9B,QAAQ,CAAC,MAAM,WAAW,MAAM,KAAK,CAAC,CAAC,GACxC,CAAC,IAAI,CACP;CAEA,MAAM,sBAA4C,aAC/C,QAAQ,CAAC,OAAO;EACf,iBAAiB,OAAO,YAAY,KAAA;EACpC,iBAAiB;EACjB,iBAAiB;EACjB,cAAc,EAAE,iBAAiB;EACjC,GAAG;EACH,UAAA,GAASA,cAAAA,WAAAA,CAAW,MAAM,SAAS,MAAM;CAC3C,IACA;EAAC;EAAW;EAAQ;EAAM;CAAC,CAC7B;CAoBA,OAAO;EACL;EACA,sBApBiD,aAChD,QAAQ,CAAC,OAAO;GACf,cAAc,EAAE,kBAAkB;GAClC,GAAG;GACH,UAAA,GAASA,cAAAA,WAAAA,CAAW,MAAM,SAAS,OAAO;EAC5C,IACA,CAAC,SAAS,CAAC,CAcQ;EACnB,iBAZ6C,aAC5C,QAAQ,CAAC,OAAO;GACf,IAAI;GACJ,MAAM;GACN,GAAG;EACL,IACA,CAAC,SAAS,CAMI;EACd;EACA;EACA;EACA;CACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-avatar.js","names":["dataAttr","handlerAll"],"sources":["../../../../src/components/avatar/use-avatar.ts"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement, ReactNode } from \"react\"\nimport { useCallback, useEffect, useRef, useState } from \"react\"\nimport { type HTMLProps, mergeProps, type PropGetter } from \"../../core\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport { dataAttr, handlerAll, mergeRefs } from \"../../utils\"\n\nconst defaultFormat = (name: string) => {\n const names = name.trim().split(\" \")\n const firstName = names[0] ?? \"\"\n const lastName = names.length > 1 ? names[names.length - 1] : \"\"\n\n return firstName && lastName\n ? `${firstName.charAt(0)}${lastName.charAt(0)}`\n : firstName.charAt(0)\n}\n\nexport interface UseAvatarProps extends HTMLProps {\n /**\n * The `HTMLImageElement` property `alt`.\n */\n alt?: HTMLProps<\"img\">[\"alt\"]\n /**\n * The `HTMLImageElement` property `crossOrigin`.\n */\n crossOrigin?: HTMLProps<\"img\">[\"crossOrigin\"]\n /**\n * The fallback text to display if the image is not provided.\n */\n fallback?: ReactNode\n /**\n * The avatar icon to use.\n */\n icon?: ReactElement\n /**\n * Defines loading strategy.\n */\n loading?: HTMLProps<\"img\">[\"loading\"]\n /**\n * The name of the person in the avatar.\n *\n * - If `src` has loaded, the name will be used as the `alt` attribute of the `img`\n * - If `src` is not loaded, the name will be used to create the initials\n */\n name?: string\n /**\n * Defining which referrer is sent when fetching the resource.\n *\n * @default 'no-referrer'\n */\n referrerPolicy?: HTMLProps<\"img\">[\"referrerPolicy\"]\n /**\n * The image url of the avatar.\n */\n src?: HTMLProps<\"img\">[\"src\"]\n /**\n * List of sources to use for different screen resolutions.\n */\n srcSet?: HTMLProps<\"img\">[\"srcSet\"]\n /**\n * Function to get the initials to display.\n */\n format?: (name: string) => string\n}\n\nexport const useAvatar = ({\n name,\n src,\n srcSet,\n alt,\n crossOrigin,\n fallback: fallbackMessage,\n format = defaultFormat,\n icon,\n loading,\n referrerPolicy = \"no-referrer\",\n ...rest\n}: UseAvatarProps = {}) => {\n const imageRef = useRef<HTMLImageElement>(null)\n const initials = name ? format(name) : undefined\n const [loaded, setLoaded] = useState<boolean>(false)\n const fallback = !src || !loaded\n const { t } = useI18n(\"avatar\")\n\n useEffect(() => {\n if (!imageRef.current) return\n\n if (!!imageRef.current.src && imageRef.current.complete) setLoaded(true)\n }, [])\n\n const getGroupProps: PropGetter = useCallback((props) => ({ ...props }), [])\n\n const getRootProps: PropGetter = useCallback(\n (props) => ({\n ...mergeProps(rest, props)(),\n \"data-fallback\": dataAttr(!!fallbackMessage),\n \"data-loaded\": dataAttr(loaded),\n }),\n [loaded, fallbackMessage, rest],\n )\n\n const getImageProps: PropGetter<\"img\"> = useCallback(\n ({ ref, onLoad, ...props } = {}) => ({\n ...props,\n ref: mergeRefs(ref, imageRef),\n src,\n srcSet,\n alt: name || alt,\n crossOrigin,\n draggable: false,\n hidden: fallback,\n loading,\n referrerPolicy,\n onLoad: handlerAll(onLoad, () => setLoaded(true)),\n }),\n [src, srcSet, alt, crossOrigin, loading, referrerPolicy, fallback, name],\n )\n\n const getFallbackProps: PropGetter = useCallback(\n (props) => ({\n ...props,\n \"aria-label\": !fallbackMessage\n ? name || alt || t(\"Avatar Icon\")\n : undefined,\n children: fallbackMessage || initials || icon,\n hidden: !fallback,\n role: !fallbackMessage ? \"img\" : undefined,\n }),\n [name, initials, fallback, icon, fallbackMessage, alt, t],\n )\n\n return {\n name,\n loaded,\n getFallbackProps,\n getGroupProps,\n getImageProps,\n getRootProps,\n }\n}\n\nexport type UseAvatarReturn = ReturnType<typeof useAvatar>\n"],"mappings":";;;;;;;AAQA,MAAM,iBAAiB,SAAiB;CACtC,MAAM,QAAQ,KAAK,KAAK,CAAC,CAAC,MAAM,GAAG;CACnC,MAAM,YAAY,MAAM,MAAM;CAC9B,MAAM,WAAW,MAAM,SAAS,IAAI,MAAM,MAAM,SAAS,KAAK;CAE9D,OAAO,aAAa,WAChB,GAAG,UAAU,OAAO,CAAC,IAAI,SAAS,OAAO,CAAC,MAC1C,UAAU,OAAO,CAAC;AACxB;AAkDA,MAAa,aAAa,EACxB,MACA,KACA,QACA,KACA,aACA,UAAU,iBACV,SAAS,eACT,MACA,SACA,iBAAiB,eACjB,GAAG,SACe,CAAC,MAAM;CACzB,MAAM,WAAW,OAAyB,IAAI;CAC9C,MAAM,WAAW,OAAO,OAAO,IAAI,IAAI,KAAA;CACvC,MAAM,CAAC,QAAQ,aAAa,SAAkB,KAAK;CACnD,MAAM,WAAW,CAAC,OAAO,CAAC;CAC1B,MAAM,EAAE,MAAM,QAAQ,QAAQ;CAE9B,gBAAgB;EACd,IAAI,CAAC,SAAS,SAAS;EAEvB,IAAI,CAAC,CAAC,SAAS,QAAQ,OAAO,SAAS,QAAQ,UAAU,UAAU,IAAI;CACzE,GAAG,CAAC,CAAC;CAEL,MAAM,gBAA4B,aAAa,WAAW,EAAE,GAAG,MAAM,IAAI,CAAC,CAAC;CAE3E,MAAM,eAA2B,aAC9B,WAAW;EACV,GAAG,WAAW,MAAM,KAAK,CAAC,CAAC;EAC3B,kBAAA,GAAiBA,cAAAA,SAAAA,CAAS,CAAC,CAAC,eAAe;EAC3C,gBAAA,GAAeA,cAAAA,SAAAA,CAAS,MAAM;CAChC,IACA;EAAC;EAAQ;EAAiB;CAAI,CAChC;CAEA,MAAM,gBAAmC,aACtC,EAAE,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO;EACnC,GAAG;EACH,KAAK,UAAU,KAAK,QAAQ;EAC5B;EACA;EACA,KAAK,QAAQ;EACb;EACA,WAAW;EACX,QAAQ;EACR;EACA;EACA,SAAA,GAAQC,cAAAA,WAAAA,CAAW,cAAc,UAAU,IAAI,CAAC;CAClD,IACA;EAAC;EAAK;EAAQ;EAAK;EAAa;EAAS;EAAgB;EAAU;CAAI,CACzE;CAeA,OAAO;EACL;EACA;EACA,kBAhBmC,aAClC,WAAW;GACV,GAAG;GACH,cAAc,CAAC,kBACX,QAAQ,OAAO,EAAE,aAAa,IAC9B,KAAA;GACJ,UAAU,mBAAmB,YAAY;GACzC,QAAQ,CAAC;GACT,MAAM,CAAC,kBAAkB,QAAQ,KAAA;EACnC,IACA;GAAC;GAAM;GAAU;GAAU;GAAM;GAAiB;GAAK;EAAC,CAMzC;EACf;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"use-avatar.js","names":["dataAttr","handlerAll"],"sources":["../../../../src/components/avatar/use-avatar.ts"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement, ReactNode } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport { useCallback, useEffect, useRef, useState } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport { dataAttr, handlerAll, mergeRefs } from \"../../utils\"\n\nconst defaultFormat = (name: string) => {\n const names = name.trim().split(\" \")\n const firstName = names[0] ?? \"\"\n const lastName = names.length > 1 ? names[names.length - 1] : \"\"\n\n return firstName && lastName\n ? `${firstName.charAt(0)}${lastName.charAt(0)}`\n : firstName.charAt(0)\n}\n\nexport interface UseAvatarProps extends HTMLProps {\n /**\n * The `HTMLImageElement` property `alt`.\n */\n alt?: HTMLProps<\"img\">[\"alt\"]\n /**\n * The `HTMLImageElement` property `crossOrigin`.\n */\n crossOrigin?: HTMLProps<\"img\">[\"crossOrigin\"]\n /**\n * The fallback text to display if the image is not provided.\n */\n fallback?: ReactNode\n /**\n * The avatar icon to use.\n */\n icon?: ReactElement\n /**\n * Defines loading strategy.\n */\n loading?: HTMLProps<\"img\">[\"loading\"]\n /**\n * The name of the person in the avatar.\n *\n * - If `src` has loaded, the name will be used as the `alt` attribute of the `img`\n * - If `src` is not loaded, the name will be used to create the initials\n */\n name?: string\n /**\n * Defining which referrer is sent when fetching the resource.\n *\n * @default 'no-referrer'\n */\n referrerPolicy?: HTMLProps<\"img\">[\"referrerPolicy\"]\n /**\n * The image url of the avatar.\n */\n src?: HTMLProps<\"img\">[\"src\"]\n /**\n * List of sources to use for different screen resolutions.\n */\n srcSet?: HTMLProps<\"img\">[\"srcSet\"]\n /**\n * Function to get the initials to display.\n */\n format?: (name: string) => string\n}\n\nexport const useAvatar = ({\n name,\n src,\n srcSet,\n alt,\n crossOrigin,\n fallback: fallbackMessage,\n format = defaultFormat,\n icon,\n loading,\n referrerPolicy = \"no-referrer\",\n ...rest\n}: UseAvatarProps = {}) => {\n const imageRef = useRef<HTMLImageElement>(null)\n const initials = name ? format(name) : undefined\n const [loaded, setLoaded] = useState<boolean>(false)\n const fallback = !src || !loaded\n const { t } = useI18n(\"avatar\")\n\n useEffect(() => {\n if (!imageRef.current) return\n\n if (!!imageRef.current.src && imageRef.current.complete) setLoaded(true)\n }, [])\n\n const getGroupProps: PropGetter = useCallback((props) => ({ ...props }), [])\n\n const getRootProps: PropGetter = useCallback(\n (props) => ({\n ...mergeProps(rest, props)(),\n \"data-fallback\": dataAttr(!!fallbackMessage),\n \"data-loaded\": dataAttr(loaded),\n }),\n [loaded, fallbackMessage, rest],\n )\n\n const getImageProps: PropGetter<\"img\"> = useCallback(\n ({ ref, onLoad, ...props } = {}) => ({\n ...props,\n ref: mergeRefs(ref, imageRef),\n src,\n srcSet,\n alt: name || alt,\n crossOrigin,\n draggable: false,\n hidden: fallback,\n loading,\n referrerPolicy,\n onLoad: handlerAll(onLoad, () => setLoaded(true)),\n }),\n [src, srcSet, alt, crossOrigin, loading, referrerPolicy, fallback, name],\n )\n\n const getFallbackProps: PropGetter = useCallback(\n (props) => ({\n ...props,\n \"aria-label\": !fallbackMessage\n ? name || alt || t(\"Avatar Icon\")\n : undefined,\n children: fallbackMessage || initials || icon,\n hidden: !fallback,\n role: !fallbackMessage ? \"img\" : undefined,\n }),\n [name, initials, fallback, icon, fallbackMessage, alt, t],\n )\n\n return {\n name,\n loaded,\n getFallbackProps,\n getGroupProps,\n getImageProps,\n getRootProps,\n }\n}\n\nexport type UseAvatarReturn = ReturnType<typeof useAvatar>\n"],"mappings":";;;;;;;AASA,MAAM,iBAAiB,SAAiB;CACtC,MAAM,QAAQ,KAAK,KAAK,CAAC,CAAC,MAAM,GAAG;CACnC,MAAM,YAAY,MAAM,MAAM;CAC9B,MAAM,WAAW,MAAM,SAAS,IAAI,MAAM,MAAM,SAAS,KAAK;CAE9D,OAAO,aAAa,WAChB,GAAG,UAAU,OAAO,CAAC,IAAI,SAAS,OAAO,CAAC,MAC1C,UAAU,OAAO,CAAC;AACxB;AAkDA,MAAa,aAAa,EACxB,MACA,KACA,QACA,KACA,aACA,UAAU,iBACV,SAAS,eACT,MACA,SACA,iBAAiB,eACjB,GAAG,SACe,CAAC,MAAM;CACzB,MAAM,WAAW,OAAyB,IAAI;CAC9C,MA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