@yamada-ui/react 2.3.0-dev-20261024181815 → 2.3.0-dev-20261026034146

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 (110) hide show
  1. package/dist/cjs/components/accordion/use-accordion.cjs +4 -5
  2. package/dist/cjs/components/accordion/use-accordion.cjs.map +1 -1
  3. package/dist/cjs/components/checkbox/use-checkbox-group.cjs +6 -6
  4. package/dist/cjs/components/checkbox/use-checkbox-group.cjs.map +1 -1
  5. package/dist/cjs/components/checkbox/use-checkbox.cjs +17 -18
  6. package/dist/cjs/components/checkbox/use-checkbox.cjs.map +1 -1
  7. package/dist/cjs/components/color-picker/use-color-picker.cjs +14 -16
  8. package/dist/cjs/components/color-picker/use-color-picker.cjs.map +1 -1
  9. package/dist/cjs/components/color-selector/use-color-selector.cjs +4 -5
  10. package/dist/cjs/components/color-selector/use-color-selector.cjs.map +1 -1
  11. package/dist/cjs/components/dropzone/use-dropzone.cjs +3 -4
  12. package/dist/cjs/components/dropzone/use-dropzone.cjs.map +1 -1
  13. package/dist/cjs/components/file-input/use-file-input.cjs +5 -5
  14. package/dist/cjs/components/file-input/use-file-input.cjs.map +1 -1
  15. package/dist/cjs/components/menu/use-menu.cjs +36 -49
  16. package/dist/cjs/components/menu/use-menu.cjs.map +1 -1
  17. package/dist/cjs/components/modal/use-modal.cjs +5 -7
  18. package/dist/cjs/components/modal/use-modal.cjs.map +1 -1
  19. package/dist/cjs/components/native-popover/use-native-popover.cjs +8 -8
  20. package/dist/cjs/components/native-popover/use-native-popover.cjs.map +1 -1
  21. package/dist/cjs/components/pin-input/use-pin-input.cjs +10 -9
  22. package/dist/cjs/components/pin-input/use-pin-input.cjs.map +1 -1
  23. package/dist/cjs/components/radio/use-radio-group.cjs +12 -13
  24. package/dist/cjs/components/radio/use-radio-group.cjs.map +1 -1
  25. package/dist/cjs/components/radio/use-radio.cjs +15 -18
  26. package/dist/cjs/components/radio/use-radio.cjs.map +1 -1
  27. package/dist/cjs/components/saturation-slider/use-saturation-slider.cjs +4 -6
  28. package/dist/cjs/components/saturation-slider/use-saturation-slider.cjs.map +1 -1
  29. package/dist/cjs/components/select/use-select.cjs +5 -6
  30. package/dist/cjs/components/select/use-select.cjs.map +1 -1
  31. package/dist/cjs/components/sidebar/use-sidebar.cjs +13 -19
  32. package/dist/cjs/components/sidebar/use-sidebar.cjs.map +1 -1
  33. package/dist/cjs/components/slider/use-slider.cjs +13 -18
  34. package/dist/cjs/components/slider/use-slider.cjs.map +1 -1
  35. package/dist/cjs/components/steps/use-steps.cjs +4 -6
  36. package/dist/cjs/components/steps/use-steps.cjs.map +1 -1
  37. package/dist/cjs/components/tabs/use-tabs.cjs +5 -5
  38. package/dist/cjs/components/tabs/use-tabs.cjs.map +1 -1
  39. package/dist/cjs/components/tooltip/use-tooltip.cjs +13 -14
  40. package/dist/cjs/components/tooltip/use-tooltip.cjs.map +1 -1
  41. package/dist/cjs/core/components/props.cjs +12 -1
  42. package/dist/cjs/core/components/props.cjs.map +1 -1
  43. package/dist/cjs/core/index.cjs +2 -0
  44. package/dist/cjs/core/system/index.cjs +2 -0
  45. package/dist/cjs/core/system/styled.cjs +23 -12
  46. package/dist/cjs/core/system/styled.cjs.map +1 -1
  47. package/dist/cjs/hooks/use-combobox/index.cjs +23 -28
  48. package/dist/cjs/hooks/use-combobox/index.cjs.map +1 -1
  49. package/dist/cjs/index.cjs +4 -0
  50. package/dist/esm/components/accordion/use-accordion.js +4 -5
  51. package/dist/esm/components/accordion/use-accordion.js.map +1 -1
  52. package/dist/esm/components/checkbox/use-checkbox-group.js +6 -6
  53. package/dist/esm/components/checkbox/use-checkbox-group.js.map +1 -1
  54. package/dist/esm/components/checkbox/use-checkbox.js +17 -18
  55. package/dist/esm/components/checkbox/use-checkbox.js.map +1 -1
  56. package/dist/esm/components/color-picker/use-color-picker.js +14 -16
  57. package/dist/esm/components/color-picker/use-color-picker.js.map +1 -1
  58. package/dist/esm/components/color-selector/use-color-selector.js +4 -5
  59. package/dist/esm/components/color-selector/use-color-selector.js.map +1 -1
  60. package/dist/esm/components/dropzone/use-dropzone.js +3 -4
  61. package/dist/esm/components/dropzone/use-dropzone.js.map +1 -1
  62. package/dist/esm/components/file-input/use-file-input.js +5 -5
  63. package/dist/esm/components/file-input/use-file-input.js.map +1 -1
  64. package/dist/esm/components/menu/use-menu.js +36 -49
  65. package/dist/esm/components/menu/use-menu.js.map +1 -1
  66. package/dist/esm/components/modal/use-modal.js +5 -7
  67. package/dist/esm/components/modal/use-modal.js.map +1 -1
  68. package/dist/esm/components/native-popover/use-native-popover.js +8 -8
  69. package/dist/esm/components/native-popover/use-native-popover.js.map +1 -1
  70. package/dist/esm/components/pin-input/use-pin-input.js +10 -9
  71. package/dist/esm/components/pin-input/use-pin-input.js.map +1 -1
  72. package/dist/esm/components/radio/use-radio-group.js +12 -13
  73. package/dist/esm/components/radio/use-radio-group.js.map +1 -1
  74. package/dist/esm/components/radio/use-radio.js +15 -18
  75. package/dist/esm/components/radio/use-radio.js.map +1 -1
  76. package/dist/esm/components/saturation-slider/use-saturation-slider.js +4 -6
  77. package/dist/esm/components/saturation-slider/use-saturation-slider.js.map +1 -1
  78. package/dist/esm/components/select/use-select.js +5 -6
  79. package/dist/esm/components/select/use-select.js.map +1 -1
  80. package/dist/esm/components/sidebar/use-sidebar.js +13 -19
  81. package/dist/esm/components/sidebar/use-sidebar.js.map +1 -1
  82. package/dist/esm/components/slider/use-slider.js +13 -18
  83. package/dist/esm/components/slider/use-slider.js.map +1 -1
  84. package/dist/esm/components/steps/use-steps.js +4 -6
  85. package/dist/esm/components/steps/use-steps.js.map +1 -1
  86. package/dist/esm/components/tabs/use-tabs.js +5 -5
  87. package/dist/esm/components/tabs/use-tabs.js.map +1 -1
  88. package/dist/esm/components/tooltip/use-tooltip.js +14 -15
  89. package/dist/esm/components/tooltip/use-tooltip.js.map +1 -1
  90. package/dist/esm/core/components/props.js +12 -1
  91. package/dist/esm/core/components/props.js.map +1 -1
  92. package/dist/esm/core/index.js +2 -2
  93. package/dist/esm/core/system/index.js +2 -2
  94. package/dist/esm/core/system/styled.js +22 -13
  95. package/dist/esm/core/system/styled.js.map +1 -1
  96. package/dist/esm/hooks/use-combobox/index.js +23 -28
  97. package/dist/esm/hooks/use-combobox/index.js.map +1 -1
  98. package/dist/esm/index.js +4 -2
  99. package/dist/types/components/chart/polar-chart.style.d.ts +1 -1
  100. package/dist/types/components/menu/use-menu.d.ts +1 -1
  101. package/dist/types/components/steps/use-steps.d.ts +1 -1
  102. package/dist/types/components/tabs/use-tabs.d.ts +1 -1
  103. package/dist/types/core/components/index.d.ts +2 -2
  104. package/dist/types/core/components/props.d.ts +2 -1
  105. package/dist/types/core/index.d.ts +3 -3
  106. package/dist/types/core/system/index.d.ts +2 -2
  107. package/dist/types/core/system/styled.d.ts +1 -0
  108. package/dist/types/hooks/use-combobox/index.d.ts +1 -1
  109. package/dist/types/index.d.ts +4 -4
  110. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"use-tabs.js","names":["createContext","isUndefined","handlerAll","cx"],"sources":["../../../../src/components/tabs/use-tabs.ts"],"sourcesContent":["\"use client\"\n\nimport type { KeyboardEvent } from \"react\"\nimport type { HTMLProps, Orientation, PropGetter } from \"../../core\"\nimport { useCallback, useId, useState } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { createDescendants } from \"../../hooks/use-descendants\"\nimport {\n createContext,\n cx,\n handlerAll,\n isUndefined,\n mergeRefs,\n runKeyAction,\n useUpdateEffect,\n} from \"../../utils\"\n\nconst {\n DescendantsContext: TabDescendantsContext,\n useDescendant: useTabDescendant,\n useDescendants: useTabDescendants,\n} = createDescendants<HTMLButtonElement>()\n\nexport { TabDescendantsContext, useTabDescendant, useTabDescendants }\n\nconst {\n DescendantsContext: TabPanelDescendantsContext,\n useDescendant: useTabPanelDescendant,\n useDescendants: useTabPanelDescendants,\n} = createDescendants<HTMLDivElement>()\n\nexport {\n TabPanelDescendantsContext,\n useTabPanelDescendant,\n useTabPanelDescendants,\n}\n\ninterface TabsContext extends Omit<\n UseTabsReturn,\n \"getRootProps\" | \"tabDescendants\" | \"tabPanelDescendants\"\n> {}\n\nconst [TabsContext, useTabsContext] = createContext<TabsContext>({\n name: \"TabsContext\",\n})\n\nexport { TabsContext, useTabsContext }\n\nexport interface UseTabsProps extends Omit<HTMLProps, \"onChange\"> {\n /**\n * The index of the selected tab.\n */\n defaultIndex?: number\n /**\n * The index of the selected tab.\n */\n index?: number\n /**\n * If `true`, the tabs will be manually activated and display its panel by pressing Space or Enter.\n *\n * If `false`, the tabs will be automatically activated and their panel is displayed when they receive focus.\n *\n * @default false\n */\n manual?: boolean\n /**\n * The orientation of the tabs.\n *\n * @default 'horizontal'\n */\n orientation?: Orientation\n /**\n * The callback invoked when the index changes.\n */\n onChange?: (index: number) => void\n}\n\nexport const useTabs = ({\n id,\n defaultIndex = 0,\n index: indexProp,\n manual = false,\n orientation = \"horizontal\",\n onChange,\n ...rest\n}: UseTabsProps = {}) => {\n const uuid = useId()\n const tabDescendants = useTabDescendants()\n const tabPanelDescendants = useTabPanelDescendants()\n const [index, setIndex] = useControllableState({\n defaultValue: defaultIndex,\n value: indexProp,\n onChange,\n })\n const [focusedIndex, setFocusedIndex] = useState<number>(index)\n const horizontal = orientation === \"horizontal\"\n\n id ??= uuid\n\n const onFocusFirstTab = useCallback(() => {\n const first = tabDescendants.enabledFirstValue()\n\n if (first) first.node.focus()\n }, [tabDescendants])\n\n const onFocusLastTab = useCallback(() => {\n const last = tabDescendants.enabledLastValue()\n\n if (last) last.node.focus()\n }, [tabDescendants])\n\n const onFocusNextTab = useCallback(() => {\n const next = tabDescendants.enabledNextValue(focusedIndex)\n\n if (next) next.node.focus()\n }, [tabDescendants, focusedIndex])\n\n const onFocusPrevTab = useCallback(() => {\n const prev = tabDescendants.enabledPrevValue(focusedIndex)\n\n if (prev) prev.node.focus()\n }, [tabDescendants, focusedIndex])\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLDivElement>) => {\n runKeyAction(ev, {\n ArrowDown: !horizontal ? onFocusNextTab : undefined,\n ArrowLeft: horizontal ? onFocusPrevTab : undefined,\n ArrowRight: horizontal ? onFocusNextTab : undefined,\n ArrowUp: !horizontal ? onFocusPrevTab : undefined,\n End: onFocusLastTab,\n Home: onFocusFirstTab,\n })\n },\n [\n horizontal,\n onFocusNextTab,\n onFocusPrevTab,\n onFocusLastTab,\n onFocusFirstTab,\n ],\n )\n\n useUpdateEffect(() => {\n if (isUndefined(indexProp)) return\n\n setIndex(indexProp)\n setFocusedIndex(indexProp)\n }, [indexProp])\n\n const getRootProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) =>\n mergeProps({ \"data-orientation\": orientation }, rest, props, { ref })(),\n [orientation, rest],\n )\n\n const getListProps: PropGetter = useCallback(\n (props = {}) => ({\n \"aria-orientation\": orientation,\n role: \"tablist\",\n ...props,\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n }),\n [orientation, onKeyDown],\n )\n\n return {\n id,\n focusedIndex,\n index,\n manual,\n orientation,\n setFocusedIndex,\n setIndex,\n tabDescendants,\n tabPanelDescendants,\n getListProps,\n getRootProps,\n }\n}\n\nexport type UseTabsReturn = ReturnType<typeof useTabs>\n\nexport interface UseTabProps extends HTMLProps<\"button\"> {\n /**\n * The index of the tab.\n */\n index: number\n}\n\nexport const useTab = ({ id, disabled, index, ...rest }: UseTabProps) => {\n const {\n id: rootId,\n index: selectedIndex,\n manual,\n orientation,\n setFocusedIndex,\n setIndex,\n } = useTabsContext()\n const { register } = useTabDescendant({ disabled })\n const tabPanelId = `${rootId}-panel-${index}`\n const selected = index === selectedIndex\n\n id ??= `${rootId}-tab-${index}`\n\n const onClick = useCallback(() => {\n if (!disabled) setIndex(index)\n }, [index, setIndex, disabled])\n\n const onFocus = useCallback(() => {\n if (disabled) return\n\n setFocusedIndex(index)\n\n if (!manual) setIndex(index)\n }, [setFocusedIndex, index, manual, disabled, setIndex])\n\n const getRootProps: PropGetter<\"button\"> = useCallback(\n ({ ref, ...props } = {}) =>\n mergeProps(\n {\n id,\n type: \"button\",\n \"aria-controls\": tabPanelId,\n \"aria-selected\": selected,\n \"data-orientation\": orientation,\n disabled,\n role: \"tab\",\n tabIndex: selected ? 0 : -1,\n },\n rest,\n props,\n { ref: mergeRefs(ref, register) },\n {\n onClick: handlerAll(props.onClick, rest.onClick, onClick),\n onFocus: handlerAll(props.onFocus, rest.onFocus, onFocus),\n },\n )({ mergeEvent: false }),\n [\n disabled,\n id,\n onClick,\n onFocus,\n orientation,\n register,\n rest,\n selected,\n tabPanelId,\n ],\n )\n\n return { index, selected, getRootProps }\n}\n\nexport type UseTabReturn = ReturnType<typeof useTab>\n\nexport interface UseTabPanelProps extends HTMLProps {\n /**\n * The index of the tab panel.\n */\n index: number\n}\n\nexport const useTabPanel = ({\n id,\n \"aria-labelledby\": ariaLabelledbyProp,\n index,\n ...rest\n}: UseTabPanelProps) => {\n const { id: rootId, index: selectedIndex, orientation } = useTabsContext()\n const { register } = useTabPanelDescendant()\n const tabId = `${rootId}-tab-${index}`\n const selected = index === selectedIndex\n\n id ??= `${rootId}-panel-${index}`\n\n const getRootProps: PropGetter = useCallback(\n ({ ref, \"aria-labelledby\": ariaLabelledby, ...props } = {}) =>\n mergeProps(\n {\n id,\n \"aria-labelledby\": cx(ariaLabelledbyProp, ariaLabelledby, tabId),\n \"data-orientation\": orientation,\n hidden: !selected,\n role: \"tabpanel\",\n tabIndex: selected ? 0 : -1,\n },\n rest,\n props,\n { ref: mergeRefs(ref, register) },\n )(),\n [id, ariaLabelledbyProp, orientation, register, rest, selected, tabId],\n )\n\n return { index, selected, getRootProps }\n}\n\nexport type UseTabPanelReturn = ReturnType<typeof useTabPanel>\n"],"mappings":";;;;;;;;;;;AAkBA,MAAM,EACJ,oBAAoB,uBACpB,eAAe,kBACf,gBAAgB,sBACd,kBAAqC;AAIzC,MAAM,EAC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GACE;GACA,MAAM;GACN,iBAAiB;GACjB,iBAAiB;GACjB,oBAAoB;GACpB;GACA,MAAM;GACN,UAAU,WAAW,IAAI;EAC3B,GACA,MACA,OACA,EAAE,KAAK,UAAU,KAAK,QAAQ,EAAE,GAChC;GACE,UAAA,GAASA,cAAAA,WAAAA,CAAW,MAAM,SAAS,KAAK,SAAS,OAAO;GACxD,UAAA,GAASA,cAAAA,WAAAA,CAAW,MAAM,SAAS,KAAK,SAAS,OAAO;EAC1D,CACF,CAAC,CAAC,EAAE,YAAY,MAAM,CAAC,GACzB;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,CAGmC;CAAE;AACzC;AAWA,MAAa,eAAe,EAC1B,IACA,mBAAmB,oBACnB,OACA,GAAG,WACmB;CACtB,MAAM,EAAE,IAAI,QAAQ,OAAO,eAAe,gBAAgB,eAAe;CACzE,MAAM,EAAE,aAAa,sBAAsB;CAC3C,MAAM,QAAQ,GAAG,OAAO,OAAO;CAC/B,MAAM,WAAW,UAAU;CAE3B,OAAO,GAAG,OAAO,SAAS;CAoB1B,OAAO;EAAE;EAAO;EAAU,cAlBO,aAC9B,EAAE,KAAK,mBAAmB,gBAAgB,GAAG,UAAU,CAAC,MACvD,WACE;GACE;GACA,oBAAA,GAAmBC,cAAAA,GAAAA,CAAG,oBAAoB,gBAAgB,KAAK;GAC/D,oBAAoB;GACpB,QAAQ,CAAC;GACT,MAAM;GACN,UAAU,WAAW,IAAI;EAC3B,GACA,MACA,OACA,EAAE,KAAK,UAAU,KAAK,QAAQ,EAAE,CAClC,CAAC,CAAC,GACJ;GAAC;GAAI;GAAoB;GAAa;GAAU;GAAM;GAAU;EAAK,CAGlC;CAAE;AACzC"}
1
+ {"version":3,"file":"use-tabs.js","names":["createContext","isUndefined","handlerAll"],"sources":["../../../../src/components/tabs/use-tabs.ts"],"sourcesContent":["\"use client\"\n\nimport type { KeyboardEvent } from \"react\"\nimport type { HTMLProps, Orientation, PropGetter } from \"../../core\"\nimport { useCallback, useId, useState } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { createDescendants } from \"../../hooks/use-descendants\"\nimport {\n createContext,\n handlerAll,\n isUndefined,\n mergeRefs,\n runKeyAction,\n useUpdateEffect,\n} from \"../../utils\"\n\nconst {\n DescendantsContext: TabDescendantsContext,\n useDescendant: useTabDescendant,\n useDescendants: useTabDescendants,\n} = createDescendants<HTMLButtonElement>()\n\nexport { TabDescendantsContext, useTabDescendant, useTabDescendants }\n\nconst {\n DescendantsContext: TabPanelDescendantsContext,\n useDescendant: useTabPanelDescendant,\n useDescendants: useTabPanelDescendants,\n} = createDescendants<HTMLDivElement>()\n\nexport {\n TabPanelDescendantsContext,\n useTabPanelDescendant,\n useTabPanelDescendants,\n}\n\ninterface TabsContext extends Omit<\n UseTabsReturn,\n \"getRootProps\" | \"tabDescendants\" | \"tabPanelDescendants\"\n> {}\n\nconst [TabsContext, useTabsContext] = createContext<TabsContext>({\n name: \"TabsContext\",\n})\n\nexport { TabsContext, useTabsContext }\n\nexport interface UseTabsProps extends Omit<HTMLProps, \"onChange\"> {\n /**\n * The index of the selected tab.\n */\n defaultIndex?: number\n /**\n * The index of the selected tab.\n */\n index?: number\n /**\n * If `true`, the tabs will be manually activated and display its panel by pressing Space or Enter.\n *\n * If `false`, the tabs will be automatically activated and their panel is displayed when they receive focus.\n *\n * @default false\n */\n manual?: boolean\n /**\n * The orientation of the tabs.\n *\n * @default 'horizontal'\n */\n orientation?: Orientation\n /**\n * The callback invoked when the index changes.\n */\n onChange?: (index: number) => void\n}\n\nexport const useTabs = ({\n id,\n defaultIndex = 0,\n index: indexProp,\n manual = false,\n orientation = \"horizontal\",\n onChange,\n ...rest\n}: UseTabsProps = {}) => {\n const uuid = useId()\n const tabDescendants = useTabDescendants()\n const tabPanelDescendants = useTabPanelDescendants()\n const [index, setIndex] = useControllableState({\n defaultValue: defaultIndex,\n value: indexProp,\n onChange,\n })\n const [focusedIndex, setFocusedIndex] = useState<number>(index)\n const horizontal = orientation === \"horizontal\"\n\n id ??= uuid\n\n const onFocusFirstTab = useCallback(() => {\n const first = tabDescendants.enabledFirstValue()\n\n if (first) first.node.focus()\n }, [tabDescendants])\n\n const onFocusLastTab = useCallback(() => {\n const last = tabDescendants.enabledLastValue()\n\n if (last) last.node.focus()\n }, [tabDescendants])\n\n const onFocusNextTab = useCallback(() => {\n const next = tabDescendants.enabledNextValue(focusedIndex)\n\n if (next) next.node.focus()\n }, [tabDescendants, focusedIndex])\n\n const onFocusPrevTab = useCallback(() => {\n const prev = tabDescendants.enabledPrevValue(focusedIndex)\n\n if (prev) prev.node.focus()\n }, [tabDescendants, focusedIndex])\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLDivElement>) => {\n runKeyAction(ev, {\n ArrowDown: !horizontal ? onFocusNextTab : undefined,\n ArrowLeft: horizontal ? onFocusPrevTab : undefined,\n ArrowRight: horizontal ? onFocusNextTab : undefined,\n ArrowUp: !horizontal ? onFocusPrevTab : undefined,\n End: onFocusLastTab,\n Home: onFocusFirstTab,\n })\n },\n [\n horizontal,\n onFocusNextTab,\n onFocusPrevTab,\n onFocusLastTab,\n onFocusFirstTab,\n ],\n )\n\n useUpdateEffect(() => {\n if (isUndefined(indexProp)) return\n\n setIndex(indexProp)\n setFocusedIndex(indexProp)\n }, [indexProp])\n\n const getRootProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) =>\n mergeProps({ \"data-orientation\": orientation }, rest, props, { ref })(),\n [orientation, rest],\n )\n\n const getListProps: PropGetter = useCallback(\n (props = {}) => ({\n \"aria-orientation\": orientation,\n role: \"tablist\",\n ...props,\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n }),\n [orientation, onKeyDown],\n )\n\n return {\n id,\n focusedIndex,\n index,\n manual,\n orientation,\n setFocusedIndex,\n setIndex,\n tabDescendants,\n tabPanelDescendants,\n getListProps,\n getRootProps,\n }\n}\n\nexport type UseTabsReturn = ReturnType<typeof useTabs>\n\nexport interface UseTabProps extends HTMLProps<\"button\"> {\n /**\n * The index of the tab.\n */\n index: number\n}\n\nexport const useTab = ({ id, disabled, index, ...rest }: UseTabProps) => {\n const {\n id: rootId,\n index: selectedIndex,\n manual,\n orientation,\n setFocusedIndex,\n setIndex,\n } = useTabsContext()\n const { register } = useTabDescendant({ disabled })\n const tabPanelId = `${rootId}-panel-${index}`\n const selected = index === selectedIndex\n\n id ??= `${rootId}-tab-${index}`\n\n const onClick = useCallback(() => {\n if (!disabled) setIndex(index)\n }, [index, setIndex, disabled])\n\n const onFocus = useCallback(() => {\n if (disabled) return\n\n setFocusedIndex(index)\n\n if (!manual) setIndex(index)\n }, [setFocusedIndex, index, manual, disabled, setIndex])\n\n const getRootProps: PropGetter<\"button\"> = useCallback(\n ({ ref, ...props } = {}) =>\n mergeProps(\n {\n id,\n type: \"button\",\n \"aria-controls\": tabPanelId,\n \"aria-selected\": selected,\n \"data-orientation\": orientation,\n disabled,\n role: \"tab\",\n tabIndex: selected ? 0 : -1,\n },\n rest,\n props,\n { ref: mergeRefs(ref, register) },\n {\n onClick: handlerAll(props.onClick, rest.onClick, onClick),\n onFocus: handlerAll(props.onFocus, rest.onFocus, onFocus),\n },\n )({ mergeEvent: false }),\n [\n disabled,\n id,\n onClick,\n onFocus,\n orientation,\n register,\n rest,\n selected,\n tabPanelId,\n ],\n )\n\n return { index, selected, getRootProps }\n}\n\nexport type UseTabReturn = ReturnType<typeof useTab>\n\nexport interface UseTabPanelProps extends HTMLProps {\n /**\n * The index of the tab panel.\n */\n index: number\n}\n\nexport const useTabPanel = ({ id, index, ...rest }: UseTabPanelProps) => {\n const { id: rootId, index: selectedIndex, orientation } = useTabsContext()\n const { register } = useTabPanelDescendant()\n const tabId = `${rootId}-tab-${index}`\n const selected = index === selectedIndex\n\n id ??= `${rootId}-panel-${index}`\n\n const getRootProps: PropGetter = useCallback(\n (props = {}) =>\n mergeProps(\n {\n id,\n ref: register,\n \"aria-labelledby\": tabId,\n \"data-orientation\": orientation,\n hidden: !selected,\n role: \"tabpanel\",\n tabIndex: selected ? 0 : -1,\n },\n rest,\n props,\n )(),\n [id, orientation, register, rest, selected, tabId],\n )\n\n return { index, selected, getRootProps }\n}\n\nexport type UseTabPanelReturn = ReturnType<typeof useTabPanel>\n"],"mappings":";;;;;;;;;;;AAiBA,MAAM,EACJ,oBAAoB,uBACpB,eAAe,kBACf,gBAAgB,sBACd,kBAAqC;AAIzC,MAAM,EACJ,oBAAoB,4BACpB,eAAe,uBACf,gBAAgB,2BACd,kBAAkC;AAatC,MAAM,CAAC,aAAa,kBAAkBA,gBAA2B,EAC/D,MAAM,cACR,CAAC;AAiCD,MAAa,WAAW,EACtB,IACA,eAAe,GACf,OAAO,WACP,SAAS,OACT,cAAc,cACd,UACA,GAAG,SACa,CAAC,MAAM;CACvB,MAAM,OAAO,MAAM;CACnB,MAAM,iBAAiB,kBAAkB;CACzC,MAAM,sBAAsB,uBAAuB;CACnD,MAAM,CAAC,OAAO,YAAY,qBAAqB;EAC7C,cAAc;EACd,OAAO;EACP;CACF,CAAC;CACD,MAAM,CAAC,cAAc,mBAAmB,SAAiB,KAAK;CAC9D,MAAM,aAAa,gBAAgB;CAEnC,OAAO;CAEP,MAAM,kBAAkB,kBAAkB;EACxC,MAAM,QAAQ,eAAe,kBAAkB;EAE/C,IAAI,OAAO,MAAM,KAAK,MAAM;CAC9B,GAAG,CAAC,cAAc,CAAC;CAEnB,MAAM,iBAAiB,kBAAkB;EACvC,MAAM,OAAO,eAAe,iBAAiB;EAE7C,IAAI,MAAM,KAAK,KAAK,MAAM;CAC5B,GAAG,CAAC,cAAc,CAAC;CAEnB,MAAM,iBAAiB,kBAAkB;EACvC,MAAM,OAAO,eAAe,iBAAiB,YAAY;EAEzD,IAAI,MAAM,KAAK,KAAK,MAAM;CAC5B,GAAG,CAAC,gBAAgB,YAAY,CAAC;CAEjC,MAAM,iBAAiB,kBAAkB;EACvC,MAAM,OAAO,eAAe,iB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 +1,7 @@
1
1
  "use client";
2
2
  import { useUnmountEffect } from "../../utils/effect.js";
3
- import { mergeRefs } from "../../utils/ref.js";
4
3
  import { utils_exports } from "../../utils/index.js";
5
- import { useSplitProps } from "../../core/components/props.js";
4
+ import { mergeProps, useSplitProps } from "../../core/components/props.js";
6
5
  import { popperProps, usePopper, usePopperProps } from "../../hooks/use-popper/index.js";
7
6
  import { useDisclosure } from "../../hooks/use-disclosure/use-disclosure.js";
8
7
  import { useEventListener } from "../../hooks/use-event-listener/index.js";
@@ -70,21 +69,21 @@ const useTooltip = (props = {}) => {
70
69
  clearTimeout(openTimeout.current);
71
70
  clearTimeout(closeTimeout.current);
72
71
  });
73
- const getTriggerProps = useCallback(({ "aria-describedby": ariaDescribedby, ...props } = {}) => {
74
- return getReferenceProps({
75
- ...props,
76
- ref: mergeRefs(props.ref, triggerRef),
77
- "aria-describedby": (0, utils_exports.cx)(ariaDescribedby, open ? describedbyId : void 0),
78
- onBlur: (0, utils_exports.handlerAll)(props.onBlur, onDelayClose),
79
- onClick: (0, utils_exports.handlerAll)(props.onClick, closeOnClick ? onDelayClose : void 0),
80
- onFocus: (0, utils_exports.handlerAll)(props.onFocus, onDelayOpen),
81
- onPointerEnter: (0, utils_exports.handlerAll)(props.onPointerEnter, (ev) => {
72
+ const getTriggerProps = useCallback((props = {}) => {
73
+ return getReferenceProps(mergeProps(props, {
74
+ ref: triggerRef,
75
+ "aria-describedby": open ? describedbyId : void 0
76
+ }, {
77
+ onBlur: onDelayClose,
78
+ onClick: closeOnClick ? onDelayClose : void 0,
79
+ onFocus: onDelayOpen,
80
+ onPointerEnter: (ev) => {
82
81
  if (ev.pointerType !== "touch") onDelayOpen();
83
- }),
84
- onPointerLeave: (0, utils_exports.handlerAll)(props.onPointerLeave, (ev) => {
82
+ },
83
+ onPointerLeave: (ev) => {
85
84
  if (ev.pointerType !== "touch") onDelayClose();
86
- })
87
- });
85
+ }
86
+ })());
88
87
  }, [
89
88
  getReferenceProps,
90
89
  describedbyId,
@@ -1 +1 @@
1
- {"version":3,"file":"use-tooltip.js","names":["getWindow","getDocument","cx","handlerAll","dataAttr"],"sources":["../../../../src/components/tooltip/use-tooltip.tsx"],"sourcesContent":["\"use client\"\n\nimport type { PropGetter } from \"../../core\"\nimport type { UseDisclosureProps } from \"../../hooks/use-disclosure\"\nimport type { UsePopperProps } from \"../../hooks/use-popper\"\nimport type { Dict } from \"../../utils\"\nimport { useCallback, useId, useRef } from \"react\"\nimport { useSplitProps } from \"../../core\"\nimport { useDisclosure } from \"../../hooks/use-disclosure\"\nimport { useEventListener } from \"../../hooks/use-event-listener\"\nimport { useOutsideClick } from \"../../hooks/use-outside-click\"\nimport { popperProps, usePopper, usePopperProps } from \"../../hooks/use-popper\"\nimport {\n cx,\n dataAttr,\n getDocument,\n getWindow,\n handlerAll,\n mergeRefs,\n useUnmountEffect,\n} from \"../../utils\"\n\nexport interface UseTooltipProps\n extends Omit<UseDisclosureProps, \"timing\">, UsePopperProps<\"button\"> {\n /**\n * The delay before hiding the tooltip.\n *\n * @default 100\n */\n closeDelay?: number\n /**\n * If `true`, the tooltip will hide on click.\n *\n * @default true\n */\n closeOnClick?: boolean\n /**\n * If `true`, the tooltip will hide on pressing Esc key.\n *\n * @default true\n */\n closeOnEsc?: boolean\n /**\n * If `true`, the tooltip will hide on scroll.\n *\n * @default false\n */\n closeOnScroll?: boolean\n /**\n * If `true`, the tooltip will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * The delay before showing the tooltip.\n *\n * @default 400\n */\n openDelay?: number\n}\n\nexport const useTooltip = (props: UseTooltipProps = {}) => {\n const [\n popperProps,\n {\n closeDelay = 0,\n closeOnClick = true,\n closeOnEsc = true,\n closeOnScroll,\n defaultOpen,\n disabled,\n open: openProp,\n openDelay = 0,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n },\n ] = usePopperProps(props, [\"open\"])\n const describedbyId = useId()\n const triggerRef = useRef<HTMLElement>(null)\n const openTimeout = useRef<NodeJS.Timeout>(undefined)\n const closeTimeout = useRef<NodeJS.Timeout>(undefined)\n const { open, onClose, onOpen } = useDisclosure({\n defaultOpen,\n open: openProp,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n })\n const { getPopperProps, getReferenceProps } = usePopper({\n open,\n ...popperProps,\n })\n\n const onForceClose = useCallback(() => {\n if (closeTimeout.current) {\n clearTimeout(closeTimeout.current)\n\n closeTimeout.current = undefined\n }\n\n onClose()\n }, [onClose])\n\n const onDelayOpen = useCallback(() => {\n if (!disabled && !openTimeout.current) {\n if (open) onForceClose()\n\n openTimeout.current = getWindow(triggerRef.current).setTimeout(\n onOpen,\n openDelay,\n )\n }\n }, [disabled, open, onForceClose, onOpen, openDelay])\n\n const onDelayClose = useCallback(() => {\n if (openTimeout.current) {\n clearTimeout(openTimeout.current)\n openTimeout.current = undefined\n }\n\n closeTimeout.current = getWindow(triggerRef.current).setTimeout(() => {\n onForceClose()\n }, closeDelay)\n }, [closeDelay, onForceClose])\n\n useEventListener(\n () => getDocument(triggerRef.current),\n \"keydown\",\n ({ key }) => {\n if (closeOnEsc && key === \"Escape\") onDelayClose()\n },\n )\n\n useEventListener(\n () => getDocument(triggerRef.current),\n \"scroll\",\n () => {\n if (open && closeOnScroll) onForceClose()\n },\n )\n\n useOutsideClick({\n ref: triggerRef,\n enabled: open,\n handler: () => {\n onDelayClose()\n },\n })\n\n useUnmountEffect(() => {\n clearTimeout(openTimeout.current)\n clearTimeout(closeTimeout.current)\n })\n\n const getTriggerProps: PropGetter<\"button\"> = useCallback(\n ({ \"aria-describedby\": ariaDescribedby, ...props } = {}) => {\n return getReferenceProps({\n ...props,\n ref: mergeRefs(props.ref, triggerRef),\n \"aria-describedby\": cx(\n ariaDescribedby,\n open ? describedbyId : undefined,\n ),\n onBlur: handlerAll(props.onBlur, onDelayClose),\n onClick: handlerAll(\n props.onClick,\n closeOnClick ? onDelayClose : undefined,\n ),\n onFocus: handlerAll(props.onFocus, onDelayOpen),\n onPointerEnter: handlerAll(props.onPointerEnter, (ev) => {\n if (ev.pointerType !== \"touch\") onDelayOpen()\n }),\n onPointerLeave: handlerAll(props.onPointerLeave, (ev) => {\n if (ev.pointerType !== \"touch\") onDelayClose()\n }),\n })\n },\n [\n getReferenceProps,\n describedbyId,\n onDelayOpen,\n open,\n closeOnClick,\n onDelayClose,\n ],\n )\n\n const getPositionerProps: PropGetter = useCallback(\n (props) => {\n return getPopperProps(props)\n },\n [getPopperProps],\n )\n\n const getContentProps: PropGetter = useCallback(\n (props = {}) => ({\n id: describedbyId,\n \"data-close\": dataAttr(!open),\n \"data-open\": dataAttr(open),\n role: \"tooltip\",\n onPointerLeave: handlerAll(props.onPointerLeave, onDelayClose),\n ...props,\n }),\n [describedbyId, onDelayClose, open],\n )\n\n return {\n open,\n getContentProps,\n getPositionerProps,\n getTriggerProps,\n onClose: onForceClose,\n onDelayClose,\n onDelayOpen,\n onOpen,\n }\n}\n\nexport type UseTooltipReturn = ReturnType<typeof useTooltip>\n\nexport const tooltipProps: (keyof UseTooltipProps)[] = [\n ...popperProps,\n \"open\",\n \"defaultOpen\",\n \"onOpen\",\n \"onClose\",\n \"closeDelay\",\n \"closeOnClick\",\n \"closeOnEsc\",\n \"closeOnScroll\",\n \"disabled\",\n \"openDelay\",\n]\n\nexport const useTooltipProps = <\n Y extends Dict = Dict,\n M extends keyof UseTooltipProps = keyof UseTooltipProps,\n>(\n props: Y,\n omitKeys?: M[],\n) => {\n return useSplitProps(\n props,\n tooltipProps.filter((key) => !omitKeys?.includes(key as M)),\n ) as unknown as [\n keyof UseTooltipProps extends M\n ? UseTooltipProps\n : Omit<UseTooltipProps, M>,\n Omit<\n Y,\n keyof UseTooltipProps extends M\n ? keyof UseTooltipProps\n : Exclude<keyof UseTooltipProps, M>\n >,\n ]\n}\n"],"mappings":";;;;;;;;;;;AA8DA,MAAa,cAAc,QAAyB,CAAC,MAAM;CACzD,MAAM,CACJ,aACA,EACE,aAAa,GACb,eAAe,MACf,aAAa,MACb,eACA,a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d;EACA;EACA,SAAS;EACT;EACA;EACA;CACF;AACF;AAIA,MAAa,eAA0C;CACrD,GAAG;CACH;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,mBAIX,OACA,aACG;CACH,OAAO,cACL,OACA,aAAa,QAAQ,QAAQ,CAAC,UAAU,SAAS,GAAQ,CAAC,CAC5D;AAWF"}
1
+ {"version":3,"file":"use-tooltip.js","names":["getWindow","getDocument","dataAttr","handlerAll"],"sources":["../../../../src/components/tooltip/use-tooltip.tsx"],"sourcesContent":["\"use client\"\n\nimport type { PointerEvent } from \"react\"\nimport type { PropGetter } from \"../../core\"\nimport type { UseDisclosureProps } from \"../../hooks/use-disclosure\"\nimport type { UsePopperProps } from \"../../hooks/use-popper\"\nimport type { Dict } from \"../../utils\"\nimport { useCallback, useId, useRef } from \"react\"\nimport { mergeProps, useSplitProps } from \"../../core\"\nimport { useDisclosure } from \"../../hooks/use-disclosure\"\nimport { useEventListener } from \"../../hooks/use-event-listener\"\nimport { useOutsideClick } from \"../../hooks/use-outside-click\"\nimport { popperProps, usePopper, usePopperProps } from \"../../hooks/use-popper\"\nimport {\n dataAttr,\n getDocument,\n getWindow,\n handlerAll,\n useUnmountEffect,\n} from \"../../utils\"\n\nexport interface UseTooltipProps\n extends Omit<UseDisclosureProps, \"timing\">, UsePopperProps<\"button\"> {\n /**\n * The delay before hiding the tooltip.\n *\n * @default 100\n */\n closeDelay?: number\n /**\n * If `true`, the tooltip will hide on click.\n *\n * @default true\n */\n closeOnClick?: boolean\n /**\n * If `true`, the tooltip will hide on pressing Esc key.\n *\n * @default true\n */\n closeOnEsc?: boolean\n /**\n * If `true`, the tooltip will hide on scroll.\n *\n * @default false\n */\n closeOnScroll?: boolean\n /**\n * If `true`, the tooltip will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * The delay before showing the tooltip.\n *\n * @default 400\n */\n openDelay?: number\n}\n\nexport const useTooltip = (props: UseTooltipProps = {}) => {\n const [\n popperProps,\n {\n closeDelay = 0,\n closeOnClick = true,\n closeOnEsc = true,\n closeOnScroll,\n defaultOpen,\n disabled,\n open: openProp,\n openDelay = 0,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n },\n ] = usePopperProps(props, [\"open\"])\n const describedbyId = useId()\n const triggerRef = useRef<HTMLButtonElement>(null)\n const openTimeout = useRef<NodeJS.Timeout>(undefined)\n const closeTimeout = useRef<NodeJS.Timeout>(undefined)\n const { open, onClose, onOpen } = useDisclosure({\n defaultOpen,\n open: openProp,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n })\n const { getPopperProps, getReferenceProps } = usePopper({\n open,\n ...popperProps,\n })\n\n const onForceClose = useCallback(() => {\n if (closeTimeout.current) {\n clearTimeout(closeTimeout.current)\n\n closeTimeout.current = undefined\n }\n\n onClose()\n }, [onClose])\n\n const onDelayOpen = useCallback(() => {\n if (!disabled && !openTimeout.current) {\n if (open) onForceClose()\n\n openTimeout.current = getWindow(triggerRef.current).setTimeout(\n onOpen,\n openDelay,\n )\n }\n }, [disabled, open, onForceClose, onOpen, openDelay])\n\n const onDelayClose = useCallback(() => {\n if (openTimeout.current) {\n clearTimeout(openTimeout.current)\n openTimeout.current = undefined\n }\n\n closeTimeout.current = getWindow(triggerRef.current).setTimeout(() => {\n onForceClose()\n }, closeDelay)\n }, [closeDelay, onForceClose])\n\n useEventListener(\n () => getDocument(triggerRef.current),\n \"keydown\",\n ({ key }) => {\n if (closeOnEsc && key === \"Escape\") onDelayClose()\n },\n )\n\n useEventListener(\n () => getDocument(triggerRef.current),\n \"scroll\",\n () => {\n if (open && closeOnScroll) onForceClose()\n },\n )\n\n useOutsideClick({\n ref: triggerRef,\n enabled: open,\n handler: () => {\n onDelayClose()\n },\n })\n\n useUnmountEffect(() => {\n clearTimeout(openTimeout.current)\n clearTimeout(closeTimeout.current)\n })\n\n const getTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => {\n return getReferenceProps(\n mergeProps(\n props,\n {\n ref: triggerRef,\n \"aria-describedby\": open ? describedbyId : undefined,\n },\n {\n onBlur: onDelayClose,\n onClick: closeOnClick ? onDelayClose : undefined,\n onFocus: onDelayOpen,\n onPointerEnter: (ev: PointerEvent<HTMLButtonElement>) => {\n if (ev.pointerType !== \"touch\") onDelayOpen()\n },\n onPointerLeave: (ev: PointerEvent<HTMLButtonElement>) => {\n if (ev.pointerType !== \"touch\") onDelayClose()\n },\n },\n )(),\n )\n },\n [\n getReferenceProps,\n describedbyId,\n onDelayOpen,\n open,\n closeOnClick,\n onDelayClose,\n ],\n )\n\n const getPositionerProps: PropGetter = useCallback(\n (props) => {\n return getPopperProps(props)\n },\n [getPopperProps],\n )\n\n const getContentProps: PropGetter = useCallback(\n (props = {}) => ({\n id: describedbyId,\n \"data-close\": dataAttr(!open),\n \"data-open\": dataAttr(open),\n role: \"tooltip\",\n onPointerLeave: handlerAll(props.onPointerLeave, onDelayClose),\n ...props,\n }),\n [describedbyId, onDelayClose, open],\n )\n\n return {\n open,\n getContentProps,\n getPositionerProps,\n getTriggerProps,\n onClose: onForceClose,\n onDelayClose,\n onDelayOpen,\n onOpen,\n }\n}\n\nexport type UseTooltipReturn = ReturnType<typeof useTooltip>\n\nexport const tooltipProps: (keyof UseTooltipProps)[] = [\n ...popperProps,\n \"open\",\n \"defaultOpen\",\n \"onOpen\",\n \"onClose\",\n \"closeDelay\",\n \"closeOnClick\",\n \"closeOnEsc\",\n \"closeOnScroll\",\n \"disabled\",\n \"openDelay\",\n]\n\nexport const useTooltipProps = <\n Y extends Dict = Dict,\n M extends keyof UseTooltipProps = keyof UseTooltipProps,\n>(\n props: Y,\n omitKeys?: M[],\n) => {\n return useSplitProps(\n props,\n tooltipProps.filter((key) => !omitKeys?.includes(key as M)),\n ) as unknown as [\n keyof UseTooltipProps extends M\n ? UseTooltipProps\n : Omit<UseTooltipProps, M>,\n Omit<\n Y,\n keyof UseTooltipProps extends M\n ? keyof UseTooltipProps\n : Exclude<keyof UseTooltipProps, M>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AAO,cACL,OACA,aAAa,QAAQ,QAAQ,CAAC,UAAU,SAAS,GAAQ,CAAC,CAC5D;AAWF"}
@@ -13,6 +13,13 @@ const cssProps = /* @__PURE__ */ new Set([
13
13
  ...styleProperties,
14
14
  ...vendorProperties
15
15
  ]);
16
+ const ariaSpaceSeparatedProps = /* @__PURE__ */ new Set([
17
+ "aria-controls",
18
+ "aria-describedby",
19
+ "aria-flowto",
20
+ "aria-labelledby",
21
+ "aria-owns"
22
+ ]);
16
23
  function createShouldForwardProp(forwardProps = []) {
17
24
  return function(prop) {
18
25
  if (forwardProps.includes(prop)) return true;
@@ -21,7 +28,7 @@ function createShouldForwardProp(forwardProps = []) {
21
28
  };
22
29
  }
23
30
  function mergeProps(...args) {
24
- return function({ mergeClassName = true, mergeCSS = true, mergeEvent = true, mergeRef = true, mergeStyle = true } = {}) {
31
+ return function({ mergeAria = true, mergeClassName = true, mergeCSS = true, mergeEvent = true, mergeRef = true, mergeStyle = true } = {}) {
25
32
  let result = {};
26
33
  for (const props of args) {
27
34
  if ((0, utils_exports.isUndefined)(props)) continue;
@@ -38,6 +45,10 @@ function mergeProps(...args) {
38
45
  result[key] = (0, utils_exports.cx)(result[key], props[key]);
39
46
  continue;
40
47
  }
48
+ if (mergeAria && ariaSpaceSeparatedProps.has(key)) {
49
+ result[key] = (0, utils_exports.cx)(result[key], props[key]);
50
+ continue;
51
+ }
41
52
  if (mergeStyle && key === "style") {
42
53
  result[key] = (0, utils_exports.merge)(result[key] ?? {}, props[key] ?? {});
43
54
  continue;
@@ -1 +1 @@
1
- {"version":3,"file":"props.js","names":["isUndefined","isFunction","handlerAll","cx","merge","isArray","omitObject","splitObject","isObject","isEmptyObject"],"sources":["../../../../src/core/components/props.ts"],"sourcesContent":["import type { Dict, Merge } from \"../../utils\"\nimport { useMemo } from \"react\"\nimport isEqual from \"react-fast-compare\"\nimport {\n cx,\n handlerAll,\n isArray,\n isEmptyObject,\n isFunction,\n isObject,\n isUndefined,\n merge,\n mergeRefs,\n omitObject,\n splitObject,\n} from \"../../utils\"\nimport { conditionProperties, styleProperties, vendorProperties } from \"../css\"\n\ntype Optionalize<Y> = [Extract<Y, undefined>] extends [never]\n ? Y\n : Partial<Exclude<Y, undefined>>\n\ntype MergeAll<Y extends (Dict | undefined)[]> = Y extends [infer M]\n ? Optionalize<M>\n : Y extends [infer D, ...infer H]\n ? H extends (Dict | undefined)[]\n ? Merge<Optionalize<D>, MergeAll<H>>\n : Optionalize<D>\n : never\n\nfunction isEvent(key: string) {\n return /^on[A-Z]/.test(key)\n}\n\nexport const cssProps = new Set<string>([\n ...conditionProperties,\n ...styleProperties,\n ...vendorProperties,\n])\n\nexport type ShouldForwardProp = (prop: string) => boolean\n\nexport function createShouldForwardProp(\n forwardProps: string[] = [],\n): ShouldForwardProp {\n return function (prop: string): boolean {\n if (forwardProps.includes(prop)) return true\n\n if (prop.startsWith(\"--\")) return false\n\n return !cssProps.has(prop)\n }\n}\n\ninterface MergePropsOptions {\n mergeClassName?: boolean\n mergeCSS?: boolean\n mergeEvent?: boolean\n mergeRef?: boolean\n mergeStyle?: boolean\n}\n\nexport function mergeProps<Y extends Dict>(\n ...args: Y[]\n): (options?: MergePropsOptions) => Y\nexport function mergeProps<Y extends (Dict | undefined)[]>(\n ...args: Y\n): (options?: MergePropsOptions) => MergeAll<Y>\nexport function mergeProps(...args: (Dict | undefined)[]) {\n return function ({\n mergeClassName = true,\n mergeCSS = true,\n mergeEvent = true,\n mergeRef = true,\n mergeStyle = true,\n }: MergePropsOptions = {}) {\n let result: Dict = {}\n\n for (const props of args) {\n if (isUndefined(props)) continue\n\n for (const key in result) {\n if (mergeRef && key === \"ref\") {\n result[key] = mergeRefs(result[key], props[key])\n\n continue\n }\n\n if (\n mergeEvent &&\n isEvent(key) &&\n isFunction(result[key]) &&\n isFunction(props[key])\n ) {\n result[key] = handlerAll(result[key], props[key])\n\n continue\n }\n\n if (mergeClassName && (key === \"className\" || key === \"class\")) {\n result[key] = cx(result[key], props[key])\n\n continue\n }\n\n if (mergeStyle && key === \"style\") {\n result[key] = merge(result[key] ?? {}, props[key] ?? {})\n\n continue\n }\n\n if (mergeCSS && key === \"css\") {\n if (isArray(result[key])) {\n result[key].push(props[key])\n } else {\n result[key] ??= []\n\n result[key] = [result[key], props[key]]\n }\n\n continue\n }\n\n result[key] = !isUndefined(props[key]) ? props[key] : result[key]\n }\n\n for (const key in props)\n if (isUndefined(result[key])) result[key] = props[key]\n }\n\n return result as any\n }\n}\n\ntype CallbackProps<Y extends Dict = Dict> = (props: Y) => Y\n\ntype PropsOrCallback<Y extends Dict = Dict> = CallbackProps<Y> | Y\n\nexport function chainProps<Y extends Dict = Dict>(\n ...props: PropsOrCallback<Y>[]\n) {\n return function (options: MergePropsOptions = {}) {\n if (!props.length) return (a: Y) => a\n\n if (props.length === 1)\n return function (b: Y) {\n const a = props[0] ?? {}\n const c = isFunction(a) ? a(b) : mergeProps(a, b)(options)\n\n return c\n } as CallbackProps<Y>\n\n return props.reduce(function (a, b) {\n return function (c: Y = {} as Y) {\n const d = isFunction(a) ? a(c) : mergeProps(a, c)(options)\n const f = isFunction(b) ? b(d) : mergeProps(b, d)(options)\n\n return f\n }\n }) as CallbackProps<Y>\n }\n}\n\nexport function isEqualProps<\n Y extends Dict,\n M extends Dict,\n D extends keyof M | keyof Y,\n>(a: Y, b: M, omitKeys: D[] = []) {\n return isEqual(\n omitObject(a, omitKeys as (keyof Y)[]),\n omitObject(b, omitKeys as (keyof M)[]),\n )\n}\n\nexport function useSplitProps<Y extends Dict, M extends keyof Y>(\n props: Y,\n keys: M[] | readonly M[],\n) {\n return useMemo(() => splitObject<Y, M>(props, keys), [props, keys])\n}\n\nexport function extractProps(props: Dict, keys: readonly string[] | string[]) {\n let result: Dict = {}\n\n Object.entries(props).forEach(([key, value]) => {\n if (!cssProps.has(key)) return\n\n if (keys.includes(key)) {\n result = merge(result, { [key]: value })\n } else if (isObject(value)) {\n value = extractProps(value, keys)\n\n if (isEmptyObject(value)) return\n\n result = merge(result, { [key]: value })\n }\n })\n\n return result\n}\n\nexport function useExtractProps(\n props: Dict,\n keys: readonly string[] | string[],\n) {\n return useMemo(() => extractProps(props, keys), [props, keys])\n}\n"],"mappings":";;;;;;;AA8BA,SAAS,QAAQ,KAAa;CAC5B,OAAO,WAAW,KAAK,GAAG;AAC5B;AAEA,MAAa,2BAAW,IAAI,IAAY;CACtC,GAAG;CACH,GAAG;CACH,GAAG;AACL,CAAC;AAID,SAAgB,wBACd,eAAyB,CAAC,GACP;CACnB,OAAO,SAAU,MAAuB;EACtC,IAAI,aAAa,SAAS,IAAI,GAAG,OAAO;EAExC,IAAI,KAAK,WAAW,IAAI,GAAG,OAAO;EAElC,OAAO,CAAC,SAAS,IAAI,IAAI;CAC3B;AACF;AAgBA,SAAgB,WAAW,GAAG,MAA4B;CACxD,OAAO,SAAU,EACf,iBAAiB,MACjB,WAAW,MACX,aAAa,MACb,WAAW,MACX,aAAa,SACQ,CAAC,GAAG;EACzB,IAAI,SAAe,CAAC;EAEpB,KAAK,MAAM,SAAS,MAAM;GACxB,KAAA,GAAIA,cAAAA,YAAAA,CAAY,KAAK,GAAG;GAExB,KAAK,MAAM,OAAO,QAAQ;IACxB,IAAI,YAAY,QAAQ,OAAO;KAC7B,OAAO,OAAO,UAAU,OAAO,MAAM,MAAM,IAAI;KAE/C;IACF;IAEA,IACE,cACA,QAAQ,GAAG,MAAA,GACXC,cAAAA,WAAAA,CAAW,OAAO,IAAI,MAAA,GACtBA,cAAAA,WAAAA,CAAW,MAAM,IAAI,GACrB;KACA,OAAO,QAAA,GAAOC,cAAAA,WAAAA,CAAW,OAAO,MAAM,MAAM,IAAI;KAEhD;IACF;IAEA,IAAI,mBAAmB,QAAQ,eAAe,QAAQ,UAAU;KAC9D,OAAO,QAAA,GAAOC,cAAAA,GAAAA,CAAG,OAAO,MAAM,MAAM,IAAI;KAExC;IACF;IAEA,IAAI,cAAc,QAAQ,SAAS;KACjC,OAAO,QAAA,GAAOC,cAAAA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AAAA,WAAAA,CAAW,GAAG,QAAuB,IAAA,GACrCA,cAAAA,WAAAA,CAAW,GAAG,QAAuB,CACvC;AACF;AAEA,SAAgB,cACd,OACA,MACA;CACA,OAAO,eAAA,GAAcC,cAAAA,YAAAA,CAAkB,OAAO,IAAI,GAAG,CAAC,OAAO,IAAI,CAAC;AACpE;AAEA,SAAgB,aAAa,OAAa,MAAoC;CAC5E,IAAI,SAAe,CAAC;CAEpB,OAAO,QAAQ,KAAK,CAAC,CAAC,SAAS,CAAC,KAAK,WAAW;EAC9C,IAAI,CAAC,SAAS,IAAI,GAAG,GAAG;EAExB,IAAI,KAAK,SAAS,GAAG,GACnB,UAAA,GAASH,cAAAA,MAAAA,CAAM,QAAQ,GAAG,MAAM,MAAM,CAAC;OAClC,KAAA,GAAII,cAAAA,SAAAA,CAAS,KAAK,GAAG;GAC1B,QAAQ,aAAa,OAAO,IAAI;GAEhC,KAAA,GAAIC,cAAAA,cAAAA,CAAc,KAAK,GAAG;GAE1B,UAAA,GAASL,cAAAA,MAAAA,CAAM,QAAQ,GAAG,MAAM,MAAM,CAAC;EACzC;CACF,CAAC;CAED,OAAO;AACT;AAEA,SAAgB,gBACd,OACA,MACA;CACA,OAAO,cAAc,aAAa,OAAO,IAAI,GAAG,CAAC,OAAO,IAAI,CAAC;AAC/D"}
1
+ {"version":3,"file":"props.js","names":["isUndefined","isFunction","handlerAll","cx","merge","isArray","omitObject","splitObject","isObject","isEmptyObject"],"sources":["../../../../src/core/components/props.ts"],"sourcesContent":["import type { Dict, Merge } from \"../../utils\"\nimport { useMemo } from \"react\"\nimport isEqual from \"react-fast-compare\"\nimport {\n cx,\n handlerAll,\n isArray,\n isEmptyObject,\n isFunction,\n isObject,\n isUndefined,\n merge,\n mergeRefs,\n omitObject,\n splitObject,\n} from \"../../utils\"\nimport { conditionProperties, styleProperties, vendorProperties } from \"../css\"\n\ntype Optionalize<Y> = [Extract<Y, undefined>] extends [never]\n ? Y\n : Partial<Exclude<Y, undefined>>\n\ntype MergeAll<Y extends (Dict | undefined)[]> = Y extends [infer M]\n ? Optionalize<M>\n : Y extends [infer D, ...infer H]\n ? H extends (Dict | undefined)[]\n ? Merge<Optionalize<D>, MergeAll<H>>\n : Optionalize<D>\n : never\n\nfunction isEvent(key: string) {\n return /^on[A-Z]/.test(key)\n}\n\nexport const cssProps = new Set<string>([\n ...conditionProperties,\n ...styleProperties,\n ...vendorProperties,\n])\n\nconst ariaSpaceSeparatedProps = new Set<string>([\n \"aria-controls\",\n \"aria-describedby\",\n \"aria-flowto\",\n \"aria-labelledby\",\n \"aria-owns\",\n])\n\nexport type ShouldForwardProp = (prop: string) => boolean\n\nexport function createShouldForwardProp(\n forwardProps: string[] = [],\n): ShouldForwardProp {\n return function (prop: string): boolean {\n if (forwardProps.includes(prop)) return true\n\n if (prop.startsWith(\"--\")) return false\n\n return !cssProps.has(prop)\n }\n}\n\nexport interface MergePropsOptions {\n mergeAria?: boolean\n mergeClassName?: boolean\n mergeCSS?: boolean\n mergeEvent?: boolean\n mergeRef?: boolean\n mergeStyle?: boolean\n}\n\nexport function mergeProps<Y extends Dict>(\n ...args: Y[]\n): (options?: MergePropsOptions) => Y\nexport function mergeProps<Y extends (Dict | undefined)[]>(\n ...args: Y\n): (options?: MergePropsOptions) => MergeAll<Y>\nexport function mergeProps(...args: (Dict | undefined)[]) {\n return function ({\n mergeAria = true,\n mergeClassName = true,\n mergeCSS = true,\n mergeEvent = true,\n mergeRef = true,\n mergeStyle = true,\n }: MergePropsOptions = {}) {\n let result: Dict = {}\n\n for (const props of args) {\n if (isUndefined(props)) continue\n\n for (const key in result) {\n if (mergeRef && key === \"ref\") {\n result[key] = mergeRefs(result[key], props[key])\n\n continue\n }\n\n if (\n mergeEvent &&\n isEvent(key) &&\n isFunction(result[key]) &&\n isFunction(props[key])\n ) {\n result[key] = handlerAll(result[key], props[key])\n\n continue\n }\n\n if (mergeClassName && (key === \"className\" || key === \"class\")) {\n result[key] = cx(result[key], props[key])\n\n continue\n }\n\n if (mergeAria && ariaSpaceSeparatedProps.has(key)) {\n result[key] = cx(result[key], props[key])\n\n continue\n }\n\n if (mergeStyle && key === \"style\") {\n result[key] = merge(result[key] ?? {}, props[key] ?? {})\n\n continue\n }\n\n if (mergeCSS && key === \"css\") {\n if (isArray(result[key])) {\n result[key].push(props[key])\n } else {\n result[key] ??= []\n\n result[key] = [result[key], props[key]]\n }\n\n continue\n }\n\n result[key] = !isUndefined(props[key]) ? props[key] : result[key]\n }\n\n for (const key in props)\n if (isUndefined(result[key])) result[key] = props[key]\n }\n\n return result as any\n }\n}\n\ntype CallbackProps<Y extends Dict = Dict> = (props: Y) => Y\n\ntype PropsOrCallback<Y extends Dict = Dict> = CallbackProps<Y> | Y\n\nexport function chainProps<Y extends Dict = Dict>(\n ...props: PropsOrCallback<Y>[]\n) {\n return function (options: MergePropsOptions = {}) {\n if (!props.length) return (a: Y) => a\n\n if (props.length === 1)\n return function (b: Y) {\n const a = props[0] ?? {}\n const c = isFunction(a) ? a(b) : mergeProps(a, b)(options)\n\n return c\n } as CallbackProps<Y>\n\n return props.reduce(function (a, b) {\n return function (c: Y = {} as Y) {\n const d = isFunction(a) ? a(c) : mergeProps(a, c)(options)\n const f = isFunction(b) ? b(d) : mergeProps(b, d)(options)\n\n return f\n }\n }) as CallbackProps<Y>\n }\n}\n\nexport function isEqualProps<\n Y extends Dict,\n M extends Dict,\n D extends keyof M | keyof Y,\n>(a: Y, b: M, omitKeys: D[] = []) {\n return isEqual(\n omitObject(a, omitKeys as (keyof Y)[]),\n omitObject(b, omitKeys as (keyof M)[]),\n )\n}\n\nexport function useSplitProps<Y extends Dict, M extends keyof Y>(\n props: Y,\n keys: M[] | readonly M[],\n) {\n return useMemo(() => splitObject<Y, M>(props, keys), [props, keys])\n}\n\nexport function extractProps(props: Dict, keys: readonly string[] | string[]) {\n let result: Dict = {}\n\n Object.entries(props).forEach(([key, value]) => {\n if (!cssProps.has(key)) return\n\n if (keys.includes(key)) {\n result = merge(result, { [key]: value })\n } else if (isObject(value)) {\n value = extractProps(value, keys)\n\n if (isEmptyObject(value)) return\n\n result = merge(result, { [key]: value })\n }\n })\n\n return result\n}\n\nexport function useExtractProps(\n props: Dict,\n keys: readonly string[] | string[],\n) {\n return useMemo(() => extractProps(props, keys), [props, keys])\n}\n"],"mappings":";;;;;;;AA8BA,SAAS,QAAQ,KAAa;CAC5B,OAAO,WAAW,KAAK,GAAG;AAC5B;AAEA,MAAa,2BAAW,IAAI,IAAY;CACtC,GAAG;CACH,GAAG;CACH,GAAG;AACL,CAAC;AAED,MAAM,0CAA0B,IAAI,IAAY;CAC9C;CACA;CACA;CACA;CACA;AACF,CAAC;AAID,SAAgB,wBACd,eAAyB,CAAC,GACP;CACnB,OAAO,SAAU,MAAuB;EACtC,IAAI,aAAa,SAAS,IAAI,GAAG,OAAO;EAExC,IAAI,KAAK,WAAW,IAAI,GAAG,OAAO;EAElC,OAAO,CAAC,SAAS,IAAI,IAAI;CAC3B;AACF;AAiBA,SAAgB,WAAW,GAAG,MAA4B;CACxD,OAAO,SAAU,EACf,YAAY,MACZ,iBAAiB,MACjB,WAAW,MACX,aAAa,MACb,WAAW,MACX,aAAa,SACQ,CAAC,GAAG;EACzB,IAAI,SAAe,CAAC;EAEpB,KAAK,MAAM,SAAS,MAAM;GACxB,KAAA,GAAIA,cAAAA,YAAAA,CAAY,KAAK,GAAG;GAExB,KAAK,MAAM,OAAO,QAAQ;IACxB,IAAI,YAAY,QAAQ,OAAO;KAC7B,OAAO,OAAO,UAAU,OAAO,MAAM,MAAM,IAAI;KAE/C;IACF;IAEA,IACE,cACA,QAAQ,GAAG,MAAA,GACXC,cAAAA,WAAAA,CAAW,OAAO,IAAI,MAAA,GACtBA,cAAAA,WAAAA,CAAW,MAAM,IAAI,GACrB;KACA,OAAO,QAAA,GAAOC,cAAAA,WAAAA,CAAW,OAAO,MAAM,MAAM,IAAI;KAEhD;IACF;IAEA,IAAI,mBAAmB,QAAQ,eAAe,QAAQ,UAAU;K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AAI,EAAE,CAAC,IAAI,WAAW,GAAG,CAAC,CAAC,CAAC,OAAO;IAGzD,QAAA,GAFUA,cAAAA,WAAAA,CAAW,CAAC,IAAI,EAAE,CAAC,IAAI,WAAW,GAAG,CAAC,CAAC,CAAC,OAAO;GAG3D;EACF,CAAC;CACH;AACF;AAEA,SAAgB,aAId,GAAM,GAAM,WAAgB,CAAC,GAAG;CAChC,OAAO,SAAA,GACLK,cAAAA,WAAAA,CAAW,GAAG,QAAuB,IAAA,GACrCA,cAAAA,WAAAA,CAAW,GAAG,QAAuB,CACvC;AACF;AAEA,SAAgB,cACd,OACA,MACA;CACA,OAAO,eAAA,GAAcC,cAAAA,YAAAA,CAAkB,OAAO,IAAI,GAAG,CAAC,OAAO,IAAI,CAAC;AACpE;AAEA,SAAgB,aAAa,OAAa,MAAoC;CAC5E,IAAI,SAAe,CAAC;CAEpB,OAAO,QAAQ,KAAK,CAAC,CAAC,SAAS,CAAC,KAAK,WAAW;EAC9C,IAAI,CAAC,SAAS,IAAI,GAAG,GAAG;EAExB,IAAI,KAAK,SAAS,GAAG,GACnB,UAAA,GAASH,cAAAA,MAAAA,CAAM,QAAQ,GAAG,MAAM,MAAM,CAAC;OAClC,KAAA,GAAII,cAAAA,SAAAA,CAAS,KAAK,GAAG;GAC1B,QAAQ,aAAa,OAAO,IAAI;GAEhC,KAAA,GAAIC,cAAAA,cAAAA,CAAc,KAAK,GAAG;GAE1B,UAAA,GAASL,cAAAA,MAAAA,CAAM,QAAQ,GAAG,MAAM,MAAM,CAAC;EACzC;CACF,CAAC;CAED,OAAO;AACT;AAEA,SAAgB,gBACd,OACA,MACA;CACA,OAAO,cAAc,aAAa,OAAO,IAAI,GAAG,CAAC,OAAO,IAAI,CAAC;AAC/D"}
@@ -10,7 +10,7 @@ import { GlobalStyles, ThemeProvider, getPreventTransition, useTheme } from "./s
10
10
  import { useSystemColorMode } from "./system/use-system-color-mode.js";
11
11
  import { ColorModeContext, ColorModeProvider, useColorMode } from "./system/color-mode-provider.js";
12
12
  import { defineComponentSlotStyle, defineComponentStyle, defineConfig, defineSemanticTokens, defineStyles, defineTheme, defineThemeSchemes, defineTokens } from "./system/config.js";
13
- import { ColorSchemeContext, createStyled, useColorSchemeContext } from "./system/styled.js";
13
+ import { ColorSchemeContext, HydrationContext, createStyled, useColorSchemeContext, useHydrationContext } from "./system/styled.js";
14
14
  import { styled } from "./system/factory.js";
15
15
  import { ColorModeScript, ThemeSchemeScript, getStorageScript } from "./system/storage-script.js";
16
16
  import { getColorModeValue, useColorModeValue } from "./system/use-color-mode-value.js";
@@ -31,4 +31,4 @@ import { chainProps, createShouldForwardProp, cssProps, extractProps, isEqualPro
31
31
  import { getSlotClassName, mergeSlotCSS, useComponentSlotStyle, useComponentStyle } from "./components/use-component-style.js";
32
32
  import { getClassName, getDisplayName } from "./components/utils.js";
33
33
  import { createComponent, createSlotComponent } from "./components/create-component.js";
34
- export { COLOR_MODE_STORAGE_KEY, ColorModeContext, ColorModeProvider, ColorModeScript, ColorSchemeContext, DEFAULT_DIRECTION, DEFAULT_LAYERS, DEFAULT_LOCALE, DEFAULT_VAR_PREFIX, EnvironmentProvider, GlobalStyles, SystemProvider, THEME_SCHEME_STORAGE_KEY, ThemeProvider, ThemeSchemeScript, animation, animationProperties, aspectRatioProperties, atRuleStyles, attributeProperties, attributeSelectors, attributes, blurProperties, borderProperties, chainProps, colorMix, colorProperties, conditionProperties, conditionSelectors, conditions, createBreakpoints, createComponent, createLayers, createShouldForwardProp, createSlotComponent, createStorageManager, createStyled, createSystem, createVarRules, createVars, css, cssProps, defaultEnvironment, defaultLayers, defaultSystem, defineComponentSlotStyle, defineComponentStyle, defineConfig, defineSemanticTokens, defineStyles, defineTheme, defineThemeSchemes, defineTokens, display, durationProperties, easingProperties, extractProps, focusRingStyle, fontProperties, getCSS, getCSSFunction, getClassName, getColorModeValue, getColorSchemeVar, getCondition, getDisplayName, getPreventTransition, getSlotClassName, getStorageScript, getStyle, getVar, getVarName, gradient, gradientProperties, groupAttributeProperties, groupAttributeSelectors, groupAttributes, injectKeyframes, injectVars, isCSSFunction, isCSSToken, isCSSVar, isColorScheme, isEqualProps, keyframeProperties, keyframes, mergeCSS, mergeProps, mergeSlotCSS, mergeVars, peerAttributeProperties, peerAttributeSelectors, peerAttributes, pseudoClassProperties, pseudoClassSelectors, pseudoClasses, pseudoElementProperties, pseudoElementSelectors, pseudoElements, pseudoStyles, radiusProperties, shadowProperties, shorthandStyles, sizeProperties, spaceProperties, standardStyles, styleProperties, styled, styledStyles, styles, tokenToValue, tokenToVar, transformConditionalValue, transformInterpolation, transforms, useCSS, useColorMode, useColorModeValue, useColorSchemeContext, useComponentSlotStyle, useComponentStyle, useEnvironment, useExtractProps, useInjectVarsIntoCss, useInjectVarsIntoProps, useSplitProps, useSystem, useSystemColorMode, useTheme, varAttr, varToValue, variableLengthProperties, vendorProperties, zIndexProperties };
34
+ export { COLOR_MODE_STORAGE_KEY, ColorModeContext, ColorModeProvider, ColorModeScript, ColorSchemeContext, DEFAULT_DIRECTION, DEFAULT_LAYERS, DEFAULT_LOCALE, DEFAULT_VAR_PREFIX, EnvironmentProvider, GlobalStyles, HydrationContext, SystemProvider, THEME_SCHEME_STORAGE_KEY, ThemeProvider, ThemeSchemeScript, animation, animationProperties, aspectRatioProperties, atRuleStyles, attributeProperties, attributeSelectors, attributes, blurProperties, borderProperties, chainProps, colorMix, colorProperties, conditionProperties, conditionSelectors, conditions, createBreakpoints, createComponent, createLayers, createShouldForwardProp, createSlotComponent, createStorageManager, createStyled, createSystem, createVarRules, createVars, css, cssProps, defaultEnvironment, defaultLayers, defaultSystem, defineComponentSlotStyle, defineComponentStyle, defineConfig, defineSemanticTokens, defineStyles, defineTheme, defineThemeSchemes, defineTokens, display, durationProperties, easingProperties, extractProps, focusRingStyle, fontProperties, getCSS, getCSSFunction, getClassName, getColorModeValue, getColorSchemeVar, getCondition, getDisplayName, getPreventTransition, getSlotClassName, getStorageScript, getStyle, getVar, getVarName, gradient, gradientProperties, groupAttributeProperties, groupAttributeSelectors, groupAttributes, injectKeyframes, injectVars, isCSSFunction, isCSSToken, isCSSVar, isColorScheme, isEqualProps, keyframeProperties, keyframes, mergeCSS, mergeProps, mergeSlotCSS, mergeVars, peerAttributeProperties, peerAttributeSelectors, peerAttributes, pseudoClassProperties, pseudoClassSelectors, pseudoClasses, pseudoElementProperties, pseudoElementSelectors, pseudoElements, pseudoStyles, radiusProperties, shadowProperties, shorthandStyles, sizeProperties, spaceProperties, standardStyles, styleProperties, styled, styledStyles, styles, tokenToValue, tokenToVar, transformConditionalValue, transformInterpolation, transforms, useCSS, useColorMode, useColorModeValue, useColorSchemeContext, useComponentSlotStyle, useComponentStyle, useEnvironment, useExtractProps, useHydrationContext, useInjectVarsIntoCss, useInjectVarsIntoProps, useSplitProps, useSystem, useSystemColorMode, useTheme, varAttr, varToValue, variableLengthProperties, vendorProperties, zIndexProperties };
@@ -9,8 +9,8 @@ import { GlobalStyles, ThemeProvider, getPreventTransition, useTheme } from "./t
9
9
  import { useSystemColorMode } from "./use-system-color-mode.js";
10
10
  import { ColorModeContext, ColorModeProvider, useColorMode } from "./color-mode-provider.js";
11
11
  import { defineComponentSlotStyle, defineComponentStyle, defineConfig, defineSemanticTokens, defineStyles, defineTheme, defineThemeSchemes, defineTokens } from "./config.js";
12
- import { ColorSchemeContext, createStyled, useColorSchemeContext } from "./styled.js";
12
+ import { ColorSchemeContext, HydrationContext, createStyled, useColorSchemeContext, useHydrationContext } from "./styled.js";
13
13
  import { styled } from "./factory.js";
14
14
  import { ColorModeScript, ThemeSchemeScript, getStorageScript } from "./storage-script.js";
15
15
  import { getColorModeValue, useColorModeValue } from "./use-color-mode-value.js";
16
- export { ColorModeContext, ColorModeProvider, ColorModeScript, ColorSchemeContext, EnvironmentProvider, GlobalStyles, SystemProvider, ThemeProvider, ThemeSchemeScript, createBreakpoints, createLayers, createStorageManager, createStyled, createSystem, createVarRules, createVars, defaultEnvironment, defaultLayers, defaultSystem, defineComponentSlotStyle, defineComponentStyle, defineConfig, defineSemanticTokens, defineStyles, defineTheme, defineThemeSchemes, defineTokens, getColorModeValue, getColorSchemeVar, getPreventTransition, getStorageScript, getVar, getVarName, injectVars, isColorScheme, mergeVars, styled, transformInterpolation, useColorMode, useColorModeValue, useColorSchemeContext, useEnvironment, useSystem, useSystemColorMode, useTheme, varAttr };
16
+ export { ColorModeContext, ColorModeProvider, ColorModeScript, ColorSchemeContext, EnvironmentProvider, GlobalStyles, HydrationContext, SystemProvider, ThemeProvider, ThemeSchemeScript, createBreakpoints, createLayers, createStorageManager, createStyled, createSystem, createVarRules, createVars, defaultEnvironment, defaultLayers, defaultSystem, defineComponentSlotStyle, defineComponentStyle, defineConfig, defineSemanticTokens, defineStyles, defineTheme, defineThemeSchemes, defineTokens, getColorModeValue, getColorSchemeVar, getPreventTransition, getStorageScript, getVar, getVarName, injectVars, isColorScheme, mergeVars, styled, transformInterpolation, useColorMode, useColorModeValue, useColorSchemeContext, useEnvironment, useHydrationContext, useSystem, useSystemColorMode, useTheme, varAttr };
@@ -63,6 +63,10 @@ const [ColorSchemeContext, useColorSchemeContext] = createContext$1({
63
63
  name: "ColorSchemeContext",
64
64
  strict: false
65
65
  });
66
+ const [HydrationContext, useHydrationContext] = createContext$1({
67
+ name: "HydrationContext",
68
+ strict: false
69
+ });
66
70
  function createStyled(el, { name, base, compounds, props, sizes, variants, defaultProps, transferProps, ...options } = {}) {
67
71
  const displayName = options.displayName ?? getDisplayName(name, "");
68
72
  const shouldForwardProp = !options.shouldForwardProp ? createShouldForwardProp(options.forwardProps) : void 0;
@@ -89,6 +93,7 @@ function createStyled(el, { name, base, compounds, props, sizes, variants, defau
89
93
  const forwardAsChild = options.forwardAsChild || options.forwardProps?.includes("asChild");
90
94
  const [omittedProps, styleProps] = useSplitProps(props, shouldForwardProp);
91
95
  const [, rest] = useComponentStyle(omittedProps, componentStyleOptions);
96
+ const suppressHydrationWarning = useHydrationContext();
92
97
  const [cssArray, colorScheme, forwardProps] = useMemo(() => {
93
98
  const { css, colorScheme, ...forwardProps } = rest;
94
99
  return [
@@ -98,6 +103,7 @@ function createStyled(el, { name, base, compounds, props, sizes, variants, defau
98
103
  ];
99
104
  }, [rest]);
100
105
  styleProps.colorScheme ??= colorScheme;
106
+ forwardProps.suppressHydrationWarning ??= suppressHydrationWarning;
101
107
  if (forwardProps.className) className = getRegisteredStyles(cache.registered, registered.current, forwardProps.className).trim();
102
108
  const interpolations = useMemo(() => [...registered.current, ...(0, utils_exports.filterEmpty)([...cssArray, styleProps].map(css(system, theme)))], [
103
109
  cssArray,
@@ -114,25 +120,28 @@ function createStyled(el, { name, base, compounds, props, sizes, variants, defau
114
120
  className,
115
121
  children
116
122
  };
117
- return /* @__PURE__ */ jsxs(ColorSchemeContext, {
123
+ return /* @__PURE__ */ jsx(ColorSchemeContext, {
118
124
  value: styleProps.colorScheme,
119
- children: [/* @__PURE__ */ jsx(Insertion, {
120
- cache,
121
- htmlTag,
122
- serialized
123
- }), asChild && !forwardAsChild ? /* @__PURE__ */ jsx(Slot, {
124
- ref,
125
- ...mergedProps
126
- }) : /* @__PURE__ */ jsx(Component, {
127
- ref,
128
- ...mergedProps
129
- })]
125
+ children: /* @__PURE__ */ jsxs(HydrationContext, {
126
+ value: mergedProps.suppressHydrationWarning,
127
+ children: [/* @__PURE__ */ jsx(Insertion, {
128
+ cache,
129
+ htmlTag,
130
+ serialized
131
+ }), asChild && !forwardAsChild ? /* @__PURE__ */ jsx(Slot, {
132
+ ref,
133
+ ...mergedProps
134
+ }) : /* @__PURE__ */ jsx(Component, {
135
+ ref,
136
+ ...mergedProps
137
+ })]
138
+ })
130
139
  });
131
140
  });
132
141
  StyledComponent.displayName = displayName || "StyledComponent";
133
142
  return StyledComponent;
134
143
  }
135
144
  //#endregion
136
- export { ColorSchemeContext, createStyled, useColorSchemeContext };
145
+ export { ColorSchemeContext, HydrationContext, createStyled, useColorSchemeContext, useHydrationContext };
137
146
 
138
147
  //# sourceMappingURL=styled.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"styled.js","names":["isUndefined","createdDom","cx","splitObject","createContext","filterUndefined","runIfFn","toKebabCase","isString","toArray","filterEmpty"],"sources":["../../../../src/core/system/styled.tsx"],"sourcesContent":["\"use client\"\n\nimport type { EmotionCache, SerializedStyles } from \"@emotion/utils\"\nimport type { FC } from \"react\"\nimport type { Dict } from \"../../utils\"\nimport type { As, ShouldForwardProp, StyledComponent } from \"../components\"\nimport type { CSSModifierObject, CSSPropObject } from \"../css\"\nimport type {\n ColorScheme,\n ComponentStyle,\n System,\n UsageTheme,\n} from \"./index.type\"\nimport { withEmotionCache } from \"@emotion/react\"\nimport { serializeStyles } from \"@emotion/serialize\"\nimport { useInsertionEffectAlwaysWithSyncFallback } from \"@emotion/use-insertion-effect-with-fallbacks\"\nimport { getRegisteredStyles, registerStyles } from \"@emotion/utils\"\nimport { useMemo, useRef } from \"react\"\nimport isEqual from \"react-fast-compare\"\nimport { Slot } from \"../../components/slot\"\nimport {\n createContext,\n createdDom,\n cx,\n filterEmpty,\n filterUndefined,\n isString,\n isUndefined,\n runIfFn,\n splitObject,\n toArray,\n toKebabCase,\n} from \"../../utils\"\nimport {\n createShouldForwardProp,\n getDisplayName,\n useComponentStyle,\n} from \"../components\"\nimport { css } from \"../css\"\nimport { useSystem } from \"./system-provider\"\nimport { useTheme } from \"./theme-provider\"\n\ninterface InsertionProps {\n cache: EmotionCache\n htmlTag: boolean\n serialized: SerializedStyles\n}\n\nfunction normalizeHostSelector(rule: string, className: string) {\n const selector = `.${className}`\n\n return rule\n .replaceAll(\n `${selector}:host([data-mode=dark]) ${selector}`,\n `:host([data-mode=dark]) ${selector}`,\n )\n .replaceAll(\n `${selector}:host([data-mode=light]) ${selector}`,\n `:host([data-mode=light]) ${selector}`,\n )\n}\n\nfunction insertStyles(cache: EmotionCache, serialized: SerializedStyles) {\n const className = `${cache.key}-${serialized.name}`\n\n if (!isUndefined(cache.inserted[serialized.name])) return\n\n const sheet = Object.create(cache.sheet) as typeof cache.sheet\n\n sheet.insert = (rule) => {\n cache.sheet.insert(normalizeHostSelector(rule, className))\n }\n\n let styleForSsr = \"\"\n let current: SerializedStyles | undefined = serialized\n\n do {\n const style =\n cache.insert(\n serialized === current ? `.${className}` : \"\",\n current,\n sheet,\n true,\n ) || undefined\n\n if (!createdDom() && !isUndefined(style))\n styleForSsr += normalizeHostSelector(style, className)\n\n current = current.next\n } while (current !== undefined)\n\n return styleForSsr || undefined\n}\n\nconst Insertion: FC<InsertionProps> = ({ cache, htmlTag, serialized }) => {\n registerStyles(cache, serialized, htmlTag)\n\n const style = useInsertionEffectAlwaysWithSyncFallback(() =>\n insertStyles(cache, serialized),\n )\n\n if (!createdDom() && !isUndefined(style)) {\n let className = serialized.name\n let next = serialized.next\n\n while (next !== undefined) {\n className = cx(className, next.name) ?? \"\"\n next = next.next\n }\n\n return (\n <style\n data-emotion={cx(cache.key, className)}\n dangerouslySetInnerHTML={{ __html: style }}\n nonce={cache.sheet.nonce}\n />\n )\n } else {\n return null\n }\n}\n\nconst useSplitProps = <Y extends Dict, M extends Dict>(\n props: Dict,\n shouldForwardProp?: ShouldForwardProp,\n) => {\n const propsRef = useRef(props)\n\n if (!isEqual(propsRef.current, props)) propsRef.current = props\n\n const computedProps = propsRef.current\n\n return useMemo(\n () => splitObject<Y, M>(computedProps, shouldForwardProp),\n [computedProps, shouldForwardProp],\n )\n}\n\nexport const [ColorSchemeContext, useColorSchemeContext] =\n createContext<ColorScheme>({\n name: \"ColorSchemeContext\",\n strict: false,\n })\n\nexport interface StyledOptions<\n Y extends CSSPropObject = CSSPropObject,\n M extends CSSModifierObject = CSSModifierObject,\n D extends CSSModifierObject = CSSModifierObject,\n H extends number | string | symbol = string,\n> extends Omit<ComponentStyle<Y, M, D>, \"className\"> {\n className?: ((system: System) => string) | string\n displayName?: string\n forwardAsChild?: boolean\n name?: string\n shouldForwardProp?: boolean | ShouldForwardProp\n target?: string\n forwardProps?: string[]\n transferProps?: H[]\n}\n\nexport function createStyled<\n Y extends As,\n M extends object = {},\n D extends CSSPropObject = CSSPropObject,\n H extends CSSModifierObject = CSSModifierObject,\n R extends CSSModifierObject = CSSModifierObject,\n>(\n el: Y,\n {\n name,\n base,\n compounds,\n props,\n sizes,\n variants,\n defaultProps,\n transferProps,\n ...options\n }: StyledOptions<D, H, R, keyof M> = {},\n) {\n const displayName = options.displayName ?? getDisplayName(name, \"\")\n const shouldForwardProp = !options.shouldForwardProp\n ? createShouldForwardProp(options.forwardProps)\n : undefined\n const style = filterUndefined({\n base,\n compounds,\n props,\n sizes,\n variants,\n defaultProps,\n })\n\n const StyledComponent = withEmotionCache<Dict>(function (\n { as: Component = el, asChild, children, ...props },\n cache,\n ref,\n ) {\n let className: string | undefined = \"\"\n\n const system = useSystem()\n const { theme } = useTheme<UsageTheme>()\n const componentStyleOptions = {\n name,\n className: system.utils.getClassName(\n runIfFn(options.className, system) ?? toKebabCase(name ?? \"\"),\n ),\n style,\n transferProps,\n }\n const registered = useRef<string[]>([])\n const htmlTag = isString(Component)\n const forwardAsChild =\n options.forwardAsChild || options.forwardProps?.includes(\"asChild\")\n const [omittedProps, styleProps] = useSplitProps(props, shouldForwardProp)\n const [, rest] = useComponentStyle<any, {}>(\n omittedProps,\n componentStyleOptions,\n )\n const [cssArray, colorScheme, forwardProps] = useMemo(() => {\n const { css, colorScheme, ...forwardProps } = rest\n\n return [toArray(css), colorScheme, forwardProps]\n }, [rest])\n\n styleProps.colorScheme ??= colorScheme\n\n if (forwardProps.className)\n className = getRegisteredStyles(\n cache.registered,\n registered.current,\n forwardProps.className,\n ).trim()\n\n const interpolations = useMemo(\n () => [\n ...registered.current,\n ...filterEmpty([...cssArray, styleProps].map(css(system, theme))),\n ],\n [cssArray, system, styleProps, theme],\n )\n\n const serialized = useMemo(\n () => serializeStyles(interpolations, cache.registered),\n [interpolations, cache.registered],\n )\n\n className = cx(\n className,\n serialized.styles ? `${cache.key}-${serialized.name}` : undefined,\n )\n className = cx(className, options.target)\n\n if (!className) className = undefined\n\n const mergedProps = { ...forwardProps, className, children }\n\n return (\n <ColorSchemeContext value={styleProps.colorScheme}>\n <Insertion cache={cache} htmlTag={htmlTag} serialized={serialized} />\n\n {asChild && !forwardAsChild ? (\n <Slot ref={ref} {...mergedProps} />\n ) : (\n <Component ref={ref} {...mergedProps} />\n )}\n </ColorSchemeContext>\n )\n }) as StyledComponent<Y, M>\n\n StyledComponent.displayName = displayName || \"StyledComponent\"\n\n return StyledComponent\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgDA,SAAS,sBAAsB,MAAc,WAAmB;CAC9D,MAAM,WAAW,IAAI;CAErB,OAAO,KACJ,WACC,GAAG,SAAS,0BAA0B,YACtC,2BAA2B,UAC7B,CAAC,CACA,WACC,GAAG,SAAS,2BAA2B,YACvC,4BAA4B,UAC9B;AACJ;AAEA,SAAS,aAAa,OAAqB,YAA8B;CACvE,MAAM,YAAY,GAAG,MAAM,IAAI,GAAG,WAAW;CAE7C,IAAI,EAAA,GAACA,cAAAA,YAAAA,CAAY,MAAM,SAAS,WAAW,KAAK,GAAG;CAEnD,MAAM,QAAQ,OAAO,OAAO,MAAM,KAAK;CAEvC,MAAM,UAAU,SAAS;EACvB,MAAM,MAAM,OAAO,sBAAsB,MAAM,SAAS,CAAC;CAC3D;CAEA,IAAI,cAAc;CAClB,IAAI,UAAwC;CAE5C,GAAG;EACD,MAAM,QACJ,MAAM,OACJ,eAAe,UAAU,IAAI,cAAc,IAC3C,SACA,OACA,IACF,KAAK,KAAA;EAEP,IAAI,EAAA,GAACC,cAAAA,WAAAA,CAAW,KAAK,EAAA,GAACD,cAAAA,YAAAA,CAAY,KAAK,GACrC,eAAe,sBAAsB,OAAO,SAAS;EAEvD,UAAU,QAAQ;CACpB,SAAS,YAAY,KAAA;CAErB,OAAO,eAAe,KAAA;AACxB;AAEA,MAAM,aAAiC,EAAE,OAAO,SAAS,iBAAiB;CACxE,eAAe,OAAO,YAAY,OAAO;CAEzC,MAAM,QAAQ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AY,KAAA;EAE5B,MAAM,cAAc;GAAE,GAAG;GAAc;GAAW;EAAS;EAE3D,OACE,qBAAC,oBAAD;GAAoB,OAAO,WAAW;GAAtC,UAAA,CACE,oBAAC,WAAD;IAAkB;IAAgB;IAAqB;GAAa,CAAA,GAEnE,WAAW,CAAC,iBACX,oBAAC,MAAD;IAAW;IAAK,GAAI;GAAc,CAAA,IAElC,oBAAC,WAAD;IAAgB;IAAK,GAAI;GAAc,CAAA,CAEvB;;CAExB,CAAC;CAED,gBAAgB,cAAc,eAAe;CAE7C,OAAO;AACT"}
1
+ {"version":3,"file":"styled.js","names":["isUndefined","createdDom","cx","splitObject","createContext","filterUndefined","runIfFn","toKebabCase","isString","toArray","filterEmpty"],"sources":["../../../../src/core/system/styled.tsx"],"sourcesContent":["\"use client\"\n\nimport type { EmotionCache, SerializedStyles } from \"@emotion/utils\"\nimport type { FC } from \"react\"\nimport type { Dict } from \"../../utils\"\nimport type {\n As,\n HTMLProps,\n ShouldForwardProp,\n StyledComponent,\n} from \"../components\"\nimport type { CSSModifierObject, CSSPropObject } from \"../css\"\nimport type {\n ColorScheme,\n ComponentStyle,\n System,\n UsageTheme,\n} from \"./index.type\"\nimport { withEmotionCache } from \"@emotion/react\"\nimport { serializeStyles } from \"@emotion/serialize\"\nimport { useInsertionEffectAlwaysWithSyncFallback } from \"@emotion/use-insertion-effect-with-fallbacks\"\nimport { getRegisteredStyles, registerStyles } from \"@emotion/utils\"\nimport { useMemo, useRef } from \"react\"\nimport isEqual from \"react-fast-compare\"\nimport { Slot } from \"../../components/slot\"\nimport {\n createContext,\n createdDom,\n cx,\n filterEmpty,\n filterUndefined,\n isString,\n isUndefined,\n runIfFn,\n splitObject,\n toArray,\n toKebabCase,\n} from \"../../utils\"\nimport {\n createShouldForwardProp,\n getDisplayName,\n useComponentStyle,\n} from \"../components\"\nimport { css } from \"../css\"\nimport { useSystem } from \"./system-provider\"\nimport { useTheme } from \"./theme-provider\"\n\ninterface InsertionProps {\n cache: EmotionCache\n htmlTag: boolean\n serialized: SerializedStyles\n}\n\nfunction normalizeHostSelector(rule: string, className: string) {\n const selector = `.${className}`\n\n return rule\n .replaceAll(\n `${selector}:host([data-mode=dark]) ${selector}`,\n `:host([data-mode=dark]) ${selector}`,\n )\n .replaceAll(\n `${selector}:host([data-mode=light]) ${selector}`,\n `:host([data-mode=light]) ${selector}`,\n )\n}\n\nfunction insertStyles(cache: EmotionCache, serialized: SerializedStyles) {\n const className = `${cache.key}-${serialized.name}`\n\n if (!isUndefined(cache.inserted[serialized.name])) return\n\n const sheet = Object.create(cache.sheet) as typeof cache.sheet\n\n sheet.insert = (rule) => {\n cache.sheet.insert(normalizeHostSelector(rule, className))\n }\n\n let styleForSsr = \"\"\n let current: SerializedStyles | undefined = serialized\n\n do {\n const style =\n cache.insert(\n serialized === current ? `.${className}` : \"\",\n current,\n sheet,\n true,\n ) || undefined\n\n if (!createdDom() && !isUndefined(style))\n styleForSsr += normalizeHostSelector(style, className)\n\n current = current.next\n } while (current !== undefined)\n\n return styleForSsr || undefined\n}\n\nconst Insertion: FC<InsertionProps> = ({ cache, htmlTag, serialized }) => {\n registerStyles(cache, serialized, htmlTag)\n\n const style = useInsertionEffectAlwaysWithSyncFallback(() =>\n insertStyles(cache, serialized),\n )\n\n if (!createdDom() && !isUndefined(style)) {\n let className = serialized.name\n let next = serialized.next\n\n while (next !== undefined) {\n className = cx(className, next.name) ?? \"\"\n next = next.next\n }\n\n return (\n <style\n data-emotion={cx(cache.key, className)}\n dangerouslySetInnerHTML={{ __html: style }}\n nonce={cache.sheet.nonce}\n />\n )\n } else {\n return null\n }\n}\n\nconst useSplitProps = <Y extends Dict, M extends Dict>(\n props: Dict,\n shouldForwardProp?: ShouldForwardProp,\n) => {\n const propsRef = useRef(props)\n\n if (!isEqual(propsRef.current, props)) propsRef.current = props\n\n const computedProps = propsRef.current\n\n return useMemo(\n () => splitObject<Y, M>(computedProps, shouldForwardProp),\n [computedProps, shouldForwardProp],\n )\n}\n\nexport const [ColorSchemeContext, useColorSchemeContext] =\n createContext<ColorScheme>({\n name: \"ColorSchemeContext\",\n strict: false,\n })\n\nexport const [HydrationContext, useHydrationContext] = createContext<boolean>({\n name: \"HydrationContext\",\n strict: false,\n})\n\nexport interface StyledOptions<\n Y extends CSSPropObject = CSSPropObject,\n M extends CSSModifierObject = CSSModifierObject,\n D extends CSSModifierObject = CSSModifierObject,\n H extends number | string | symbol = string,\n> extends Omit<ComponentStyle<Y, M, D>, \"className\"> {\n className?: ((system: System) => string) | string\n displayName?: string\n forwardAsChild?: boolean\n name?: string\n shouldForwardProp?: boolean | ShouldForwardProp\n target?: string\n forwardProps?: string[]\n transferProps?: H[]\n}\n\nexport function createStyled<\n Y extends As,\n M extends object = {},\n D extends CSSPropObject = CSSPropObject,\n H extends CSSModifierObject = CSSModifierObject,\n R extends CSSModifierObject = CSSModifierObject,\n>(\n el: Y,\n {\n name,\n base,\n compounds,\n props,\n sizes,\n variants,\n defaultProps,\n transferProps,\n ...options\n }: StyledOptions<D, H, R, keyof M> = {},\n) {\n const displayName = options.displayName ?? getDisplayName(name, \"\")\n const shouldForwardProp = !options.shouldForwardProp\n ? createShouldForwardProp(options.forwardProps)\n : undefined\n const style = filterUndefined({\n base,\n compounds,\n props,\n sizes,\n variants,\n defaultProps,\n })\n\n const StyledComponent = withEmotionCache<Dict>(function (\n { as: Component = el, asChild, children, ...props },\n cache,\n ref,\n ) {\n let className: string | undefined = \"\"\n\n const system = useSystem()\n const { theme } = useTheme<UsageTheme>()\n const componentStyleOptions = {\n name,\n className: system.utils.getClassName(\n runIfFn(options.className, system) ?? toKebabCase(name ?? \"\"),\n ),\n style,\n transferProps,\n }\n const registered = useRef<string[]>([])\n const htmlTag = isString(Component)\n const forwardAsChild =\n options.forwardAsChild || options.forwardProps?.includes(\"asChild\")\n const [omittedProps, styleProps] = useSplitProps(props, shouldForwardProp)\n const [, rest] = useComponentStyle<any, {}>(\n omittedProps,\n componentStyleOptions,\n )\n const suppressHydrationWarning = useHydrationContext()\n const [cssArray, colorScheme, forwardProps] = useMemo(() => {\n const { css, colorScheme, ...forwardProps } = rest\n\n return [toArray(css), colorScheme, forwardProps]\n }, [rest])\n\n styleProps.colorScheme ??= colorScheme\n forwardProps.suppressHydrationWarning ??= suppressHydrationWarning\n\n if (forwardProps.className)\n className = getRegisteredStyles(\n cache.registered,\n registered.current,\n forwardProps.className,\n ).trim()\n\n const interpolations = useMemo(\n () => [\n ...registered.current,\n ...filterEmpty([...cssArray, styleProps].map(css(system, theme))),\n ],\n [cssArray, system, styleProps, theme],\n )\n\n const serialized = useMemo(\n () => serializeStyles(interpolations, cache.registered),\n [interpolations, cache.registered],\n )\n\n className = cx(\n className,\n serialized.styles ? `${cache.key}-${serialized.name}` : undefined,\n )\n className = cx(className, options.target)\n\n if (!className) className = undefined\n\n const mergedProps: HTMLProps = { ...forwardProps, className, children }\n\n return (\n <ColorSchemeContext value={styleProps.colorScheme}>\n <HydrationContext value={mergedProps.suppressHydrationWarning}>\n <Insertion cache={cache} htmlTag={htmlTag} serialized={serialized} />\n\n {asChild && !forwardAsChild ? (\n <Slot ref={ref} {...mergedProps} />\n ) : (\n <Component ref={ref} {...mergedProps} />\n )}\n </HydrationContext>\n </ColorSchemeContext>\n )\n }) as StyledComponent<Y, M>\n\n StyledComponent.displayName = displayName || \"StyledComponent\"\n\n return StyledComponent\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAqDA,SAAS,sBAAsB,MAAc,WAAmB;CAC9D,MAAM,WAAW,IAAI;CAErB,OAAO,KACJ,WACC,GAAG,SAAS,0BAA0B,YACtC,2BAA2B,UAC7B,CAAC,CACA,WACC,GAAG,SAAS,2BAA2B,YACvC,4BAA4B,UAC9B;AACJ;AAEA,SAAS,aAAa,OAAqB,YAA8B;CACvE,MAAM,YAAY,GAAG,MAAM,IAAI,GAAG,WAAW;CAE7C,IAAI,EAAA,GAACA,cAAAA,YAAAA,CAAY,MAAM,SAAS,WAAW,KAAK,GAAG;CAEn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AAA,QAAAA,CAAQ,GAAG;IAAG;IAAa;GAAY;EACjD,GAAG,CAAC,IAAI,CAAC;EAET,WAAW,gBAAgB;EAC3B,aAAa,6BAA6B;EAE1C,IAAI,aAAa,WACf,YAAY,oBACV,MAAM,YACN,WAAW,SACX,aAAa,SACf,CAAC,CAAC,KAAK;EAET,MAAM,iBAAiB,cACf,CACJ,GAAG,WAAW,SACd,IAAA,GAAGC,cAAAA,YAAAA,CAAY,CAAC,GAAG,UAAU,UAAU,CAAC,CAAC,IAAI,IAAI,QAAQ,KAAK,CAAC,CAAC,CAClE,GACA;GAAC;GAAU;GAAQ;GAAY;EAAK,CACtC;EAEA,MAAM,aAAa,cACX,gBAAgB,gBAAgB,MAAM,UAAU,GACtD,CAAC,gBAAgB,MAAM,UAAU,CACnC;EAEA,aAAA,GAAYR,cAAAA,GAAAA,CACV,WACA,WAAW,SAAS,GAAG,MAAM,IAAI,GAAG,WAAW,SAAS,KAAA,CAC1D;EACA,aAAA,GAAYA,cAAAA,GAAAA,CAAG,WAAW,QAAQ,MAAM;EAExC,IAAI,CAAC,WAAW,YAAY,KAAA;EAE5B,MAAM,cAAyB;GAAE,GAAG;GAAc;GAAW;EAAS;EAEtE,OACE,oBAAC,oBAAD;GAAoB,OAAO,WAAW;GACpC,UAAA,qBAAC,kBAAD;IAAkB,OAAO,YAAY;IAArC,UAAA,CACE,oBAAC,WAAD;KAAkB;KAAgB;KAAqB;IAAa,CAAA,GAEnE,WAAW,CAAC,iBACX,oBAAC,MAAD;KAAW;KAAK,GAAI;IAAc,CAAA,IAElC,oBAAC,WAAD;KAAgB;KAAK,GAAI;IAAc,CAAA,CAEzB;;EACA,CAAA;CAExB,CAAC;CAED,gBAAgB,cAAc,eAAe;CAE7C,OAAO;AACT"}
@@ -65,7 +65,7 @@ const { DescendantsContext: ComboboxDescendantsContext, useDescendant: useCombob
65
65
  const [ComboboxContext, useComboboxContext] = createContext$1({ name: "ComboboxContext" });
66
66
  const [ComboboxGroupContext, useComboboxGroupContext] = createContext$1({ name: "ComboboxGroupContext" });
67
67
  const useCombobox = (props = {}) => {
68
- const [{ matchWidth = true, ...popoverProps }, { "aria-label": ariaLabelProp, "aria-labelledby": ariaLabelledbyProp, closeOnSelect: closeOnSelectProp = true, defaultOpen, disabled, initialFocusValue, open: openProp, openOnClick = true, openOnEnter = true, openOnSpace = true, readOnly, selectFocusRef, selectOnSpace = true, onChange: onChangeProp, onClose: onCloseProp, onOpen: onOpenProp, ...rest }] = usePopoverProps(props, [
68
+ const [{ matchWidth = true, ...popoverProps }, { "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, closeOnSelect: closeOnSelectProp = true, defaultOpen, disabled, initialFocusValue, open: openProp, openOnClick = true, openOnEnter = true, openOnSpace = true, readOnly, selectFocusRef, selectOnSpace = true, onChange: onChangeProp, onClose: onCloseProp, onOpen: onOpenProp, ...rest }] = usePopoverProps(props, [
69
69
  "disabled",
70
70
  "open",
71
71
  "defaultOpen",
@@ -255,30 +255,29 @@ const useCombobox = (props = {}) => {
255
255
  if (open) return;
256
256
  activeDescendant.current = null;
257
257
  }, [open]);
258
- const getTriggerProps = useCallback(({ "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, ...props } = {}) => ({
259
- ...mergeProps({
260
- ref: triggerRef,
261
- "aria-controls": open ? contentId : void 0,
262
- "aria-disabled": (0, utils_exports.ariaAttr)(!interactive),
263
- "aria-expanded": open,
264
- "aria-haspopup": "listbox",
265
- "aria-label": ariaLabel || ariaLabelProp,
266
- "aria-labelledby": (0, utils_exports.cx)(ariaLabelledby, ariaLabelledbyProp),
267
- "data-disabled": (0, utils_exports.dataAttr)(disabled),
268
- "data-readonly": (0, utils_exports.dataAttr)(readOnly),
269
- role: "combobox",
270
- tabIndex: interactive ? 0 : -1
271
- }, rest, props)({ mergeEvent: false }),
272
- onClick: (0, utils_exports.handlerAll)(props.onClick, rest.onClick, onClick),
273
- onKeyDown: (0, utils_exports.handlerAll)(props.onKeyDown, rest.onKeyDown, onKeyDown)
274
- }), [
258
+ const getTriggerProps = useCallback((props = {}) => ({ ...mergeProps({
259
+ ref: triggerRef,
260
+ "aria-controls": open ? contentId : void 0,
261
+ "aria-disabled": (0, utils_exports.ariaAttr)(!interactive),
262
+ "aria-expanded": open,
263
+ "aria-haspopup": "listbox",
264
+ "aria-label": ariaLabel,
265
+ "aria-labelledby": ariaLabelledby,
266
+ "data-disabled": (0, utils_exports.dataAttr)(disabled),
267
+ "data-readonly": (0, utils_exports.dataAttr)(readOnly),
268
+ role: "combobox",
269
+ tabIndex: interactive ? 0 : -1
270
+ }, rest, props, {
271
+ onClick,
272
+ onKeyDown
273
+ })() }), [
275
274
  open,
276
275
  contentId,
277
276
  interactive,
278
- ariaLabelledbyProp,
279
277
  disabled,
280
278
  readOnly,
281
- ariaLabelProp,
279
+ ariaLabelledby,
280
+ ariaLabel,
282
281
  rest,
283
282
  onClick,
284
283
  onKeyDown
@@ -309,17 +308,13 @@ const useCombobox = (props = {}) => {
309
308
  onSelect
310
309
  };
311
310
  };
312
- const useComboboxGroup = ({ "aria-labelledby": ariaLabelledbyProp, ...rest } = {}) => {
311
+ const useComboboxGroup = ({ ...rest } = {}) => {
313
312
  const labelId = useId();
314
313
  return {
315
- getGroupProps: useCallback(({ "aria-labelledby": ariaLabelledby, ...props } = {}) => mergeProps({
316
- "aria-labelledby": (0, utils_exports.cx)(ariaLabelledbyProp, ariaLabelledby, labelId),
314
+ getGroupProps: useCallback((props = {}) => mergeProps({
315
+ "aria-labelledby": labelId,
317
316
  role: "group"
318
- }, rest, props)(), [
319
- ariaLabelledbyProp,
320
- labelId,
321
- rest
322
- ]),
317
+ }, rest, props)(), [labelId, rest]),
323
318
  getLabelProps: useCallback((props) => ({
324
319
  id: labelId,
325
320
  role: "presentation",