@yamada-ui/react 2.1.8-dev-20260408062027 → 2.1.8-dev-20260409035719

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 (202) hide show
  1. package/dist/cjs/components/infinite-scroll-area/infinite-scroll-area.style.cjs +5 -2
  2. package/dist/cjs/components/infinite-scroll-area/infinite-scroll-area.style.cjs.map +1 -1
  3. package/dist/cjs/core/components/create-component.cjs.map +1 -1
  4. package/dist/cjs/core/components/props.cjs +1 -0
  5. package/dist/cjs/core/components/props.cjs.map +1 -1
  6. package/dist/esm/components/infinite-scroll-area/infinite-scroll-area.style.js +5 -2
  7. package/dist/esm/components/infinite-scroll-area/infinite-scroll-area.style.js.map +1 -1
  8. package/dist/esm/core/components/create-component.js.map +1 -1
  9. package/dist/esm/core/components/props.js +1 -0
  10. package/dist/esm/core/components/props.js.map +1 -1
  11. package/dist/types/components/accordion/accordion.d.ts +2 -2
  12. package/dist/types/components/accordion/use-accordion.d.ts +11 -11
  13. package/dist/types/components/airy/airy.d.ts +2 -2
  14. package/dist/types/components/alert/alert.d.ts +2 -2
  15. package/dist/types/components/alpha-slider/alpha-slider.d.ts +2 -2
  16. package/dist/types/components/aspect-ratio/aspect-ratio.d.ts +2 -2
  17. package/dist/types/components/autocomplete/autocomplete.style.d.ts +1 -1
  18. package/dist/types/components/autocomplete/use-autocomplete.d.ts +5 -5
  19. package/dist/types/components/avatar/avatar.d.ts +5 -5
  20. package/dist/types/components/avatar/use-avatar-group.d.ts +2 -2
  21. package/dist/types/components/badge/badge.d.ts +2 -2
  22. package/dist/types/components/bleed/bleed.d.ts +2 -2
  23. package/dist/types/components/blockquote/blockquote.d.ts +2 -2
  24. package/dist/types/components/breadcrumb/breadcrumb.d.ts +2 -2
  25. package/dist/types/components/breadcrumb/use-breadcrumb.d.ts +2 -2
  26. package/dist/types/components/button/button.d.ts +2 -2
  27. package/dist/types/components/button/icon-button.d.ts +2 -2
  28. package/dist/types/components/calendar/calendar.d.ts +2 -2
  29. package/dist/types/components/calendar/calendar.style.d.ts +2 -2
  30. package/dist/types/components/calendar/use-calendar.d.ts +8 -8
  31. package/dist/types/components/card/card.d.ts +2 -2
  32. package/dist/types/components/carousel/carousel.d.ts +2 -2
  33. package/dist/types/components/carousel/carousel.style.d.ts +2 -2
  34. package/dist/types/components/carousel/use-carousel.d.ts +3 -3
  35. package/dist/types/components/center/center.d.ts +2 -2
  36. package/dist/types/components/chart/bar-chart.d.ts +2 -2
  37. package/dist/types/components/chart/chart.d.ts +5 -5
  38. package/dist/types/components/chart/composed-chart.d.ts +2 -2
  39. package/dist/types/components/chart/donut-chart.d.ts +2 -2
  40. package/dist/types/components/chart/line-chart.d.ts +2 -2
  41. package/dist/types/components/chart/pie-chart.d.ts +2 -2
  42. package/dist/types/components/chart/radar-chart.d.ts +2 -2
  43. package/dist/types/components/chart/radial-chart.d.ts +2 -2
  44. package/dist/types/components/chart/use-chart.d.ts +2 -2
  45. package/dist/types/components/checkbox/checkbox.d.ts +4 -4
  46. package/dist/types/components/checkbox/use-checkbox-group.d.ts +2 -2
  47. package/dist/types/components/checkbox-card/checkbox-card.d.ts +5 -5
  48. package/dist/types/components/checkbox-card/checkbox-card.style.d.ts +1 -1
  49. package/dist/types/components/circle-progress/circle-progress.d.ts +2 -2
  50. package/dist/types/components/close-button/close-button.d.ts +2 -2
  51. package/dist/types/components/code/code.d.ts +2 -2
  52. package/dist/types/components/collapse/collapse.d.ts +2 -2
  53. package/dist/types/components/color-picker/color-picker.d.ts +2 -2
  54. package/dist/types/components/color-picker/color-picker.style.d.ts +1 -1
  55. package/dist/types/components/color-picker/use-color-picker.d.ts +2 -2
  56. package/dist/types/components/color-selector/color-selector.d.ts +2 -2
  57. package/dist/types/components/color-selector/color-selector.style.d.ts +2 -2
  58. package/dist/types/components/color-selector/use-color-selector.d.ts +3 -3
  59. package/dist/types/components/color-swatch/color-swatch.d.ts +2 -2
  60. package/dist/types/components/container/container.d.ts +2 -2
  61. package/dist/types/components/data-list/data-list.d.ts +2 -2
  62. package/dist/types/components/date-picker/date-picker.d.ts +2 -2
  63. package/dist/types/components/date-picker/use-date-picker.d.ts +4 -4
  64. package/dist/types/components/drawer/drawer.d.ts +2 -2
  65. package/dist/types/components/dropzone/dropzone.d.ts +4 -4
  66. package/dist/types/components/editable/editable.d.ts +4 -4
  67. package/dist/types/components/editable/use-editable.d.ts +2 -2
  68. package/dist/types/components/em/em.d.ts +2 -2
  69. package/dist/types/components/empty-state/empty-state.d.ts +2 -2
  70. package/dist/types/components/fade/fade.d.ts +2 -2
  71. package/dist/types/components/field/field.d.ts +3 -3
  72. package/dist/types/components/field/field.style.d.ts +2 -2
  73. package/dist/types/components/field/use-field-props.d.ts +3 -3
  74. package/dist/types/components/fieldset/fieldset.d.ts +3 -3
  75. package/dist/types/components/fieldset/fieldset.style.d.ts +1 -1
  76. package/dist/types/components/file-button/file-button.d.ts +2 -2
  77. package/dist/types/components/file-button/use-file-button.d.ts +18 -18
  78. package/dist/types/components/file-input/file-input.d.ts +2 -2
  79. package/dist/types/components/file-input/use-file-input.d.ts +15 -15
  80. package/dist/types/components/flex/flex.d.ts +2 -2
  81. package/dist/types/components/flip/flip.d.ts +4 -4
  82. package/dist/types/components/float/float.d.ts +2 -2
  83. package/dist/types/components/form/form.d.ts +3 -3
  84. package/dist/types/components/format/format-byte.d.ts +4 -4
  85. package/dist/types/components/format/format-date-time.d.ts +4 -4
  86. package/dist/types/components/format/format-number.d.ts +2 -2
  87. package/dist/types/components/grid/grid-item.d.ts +2 -2
  88. package/dist/types/components/grid/grid.d.ts +2 -2
  89. package/dist/types/components/group/group.d.ts +2 -2
  90. package/dist/types/components/group/use-group.d.ts +2 -2
  91. package/dist/types/components/heading/heading.d.ts +2 -2
  92. package/dist/types/components/hue-slider/hue-slider.d.ts +3 -3
  93. package/dist/types/components/icon/icon.d.ts +5 -5
  94. package/dist/types/components/image/image.d.ts +2 -2
  95. package/dist/types/components/indicator/indicator.d.ts +4 -4
  96. package/dist/types/components/infinite-scroll-area/infinite-scroll-area.d.ts +2 -2
  97. package/dist/types/components/infinite-scroll-area/infinite-scroll-area.style.d.ts +3 -0
  98. package/dist/types/components/input/input-addon.d.ts +2 -2
  99. package/dist/types/components/input/input-element.d.ts +2 -2
  100. package/dist/types/components/input/input.d.ts +2 -2
  101. package/dist/types/components/kbd/kbd.d.ts +2 -2
  102. package/dist/types/components/link/link.d.ts +2 -2
  103. package/dist/types/components/link-box/link-box.d.ts +2 -2
  104. package/dist/types/components/list/list.d.ts +2 -2
  105. package/dist/types/components/loading/loading-provider.d.ts +2 -2
  106. package/dist/types/components/loading/loading.d.ts +3 -3
  107. package/dist/types/components/mark/mark.d.ts +2 -2
  108. package/dist/types/components/menu/menu.d.ts +2 -2
  109. package/dist/types/components/menu/menu.style.d.ts +2 -2
  110. package/dist/types/components/menu/use-menu.d.ts +11 -11
  111. package/dist/types/components/modal/modal.d.ts +2 -2
  112. package/dist/types/components/native-accordion/native-accordion.d.ts +2 -2
  113. package/dist/types/components/native-accordion/use-native-accordion.d.ts +2 -2
  114. package/dist/types/components/native-popover/native-popover.d.ts +2 -2
  115. package/dist/types/components/native-select/native-select.d.ts +2 -2
  116. package/dist/types/components/native-table/native-table.d.ts +4 -4
  117. package/dist/types/components/notice/notice.style.d.ts +1 -1
  118. package/dist/types/components/number-input/number-input.d.ts +2 -2
  119. package/dist/types/components/number-input/number-input.style.d.ts +1 -1
  120. package/dist/types/components/pagination/pagination.d.ts +2 -2
  121. package/dist/types/components/pagination/use-pagination.d.ts +2 -2
  122. package/dist/types/components/password-input/password-input.d.ts +2 -2
  123. package/dist/types/components/password-input/strength-meter.d.ts +2 -2
  124. package/dist/types/components/password-input/use-password-input.d.ts +2 -2
  125. package/dist/types/components/pin-input/pin-input.d.ts +2 -2
  126. package/dist/types/components/pin-input/use-pin-input.d.ts +7 -7
  127. package/dist/types/components/popover/popover.d.ts +2 -2
  128. package/dist/types/components/progress/progress.d.ts +4 -4
  129. package/dist/types/components/progress/use-progress.d.ts +706 -706
  130. package/dist/types/components/qr-code/qr-code.d.ts +2 -2
  131. package/dist/types/components/radio/radio.d.ts +4 -4
  132. package/dist/types/components/radio/use-radio-group.d.ts +2 -2
  133. package/dist/types/components/radio-card/radio-card.d.ts +5 -5
  134. package/dist/types/components/radio-card/radio-card.style.d.ts +1 -1
  135. package/dist/types/components/rating/use-rating.d.ts +7 -7
  136. package/dist/types/components/reorder/reorder.d.ts +2 -2
  137. package/dist/types/components/reorder/use-reorder.d.ts +4 -4
  138. package/dist/types/components/resizable/resizable.d.ts +2 -2
  139. package/dist/types/components/resizable/use-resizable.d.ts +2 -2
  140. package/dist/types/components/ripple/ripple.d.ts +2 -2
  141. package/dist/types/components/ripple/use-ripple.d.ts +2 -2
  142. package/dist/types/components/rotate/rotate.d.ts +2 -2
  143. package/dist/types/components/saturation-slider/saturation-slider.d.ts +2 -2
  144. package/dist/types/components/saturation-slider/use-saturation-slider.d.ts +2 -2
  145. package/dist/types/components/scroll-area/scroll-area.d.ts +2 -2
  146. package/dist/types/components/segmented-control/segmented-control.d.ts +2 -2
  147. package/dist/types/components/segmented-control/segmented-control.style.d.ts +2 -2
  148. package/dist/types/components/segmented-control/use-segmented-control.d.ts +9 -9
  149. package/dist/types/components/select/select.d.ts +2 -2
  150. package/dist/types/components/select/use-select.d.ts +4 -4
  151. package/dist/types/components/separator/separator.d.ts +2 -2
  152. package/dist/types/components/simple-grid/simple-grid.d.ts +2 -2
  153. package/dist/types/components/skeleton/skeleton.d.ts +2 -2
  154. package/dist/types/components/slide/slide.d.ts +2 -2
  155. package/dist/types/components/slide-fade/slide-fade.d.ts +2 -2
  156. package/dist/types/components/slider/slider.d.ts +2 -2
  157. package/dist/types/components/slider/use-slider.d.ts +2 -2
  158. package/dist/types/components/stack/h-stack.d.ts +2 -2
  159. package/dist/types/components/stack/stack.d.ts +2 -2
  160. package/dist/types/components/stack/v-stack.d.ts +2 -2
  161. package/dist/types/components/stack/z-stack.d.ts +2 -2
  162. package/dist/types/components/stat/stat.d.ts +2 -2
  163. package/dist/types/components/stat/stat.style.d.ts +2 -2
  164. package/dist/types/components/status/status.d.ts +2 -2
  165. package/dist/types/components/steps/steps.d.ts +2 -2
  166. package/dist/types/components/steps/steps.style.d.ts +1 -1
  167. package/dist/types/components/steps/use-steps.d.ts +10 -10
  168. package/dist/types/components/switch/switch.d.ts +2 -2
  169. package/dist/types/components/table/table.d.ts +2 -2
  170. package/dist/types/components/tabs/tabs.d.ts +2 -2
  171. package/dist/types/components/tabs/use-tabs.d.ts +16 -16
  172. package/dist/types/components/tag/tag.d.ts +2 -2
  173. package/dist/types/components/tag/tag.style.d.ts +1 -1
  174. package/dist/types/components/text/text.d.ts +2 -2
  175. package/dist/types/components/textarea/textarea.d.ts +2 -2
  176. package/dist/types/components/textarea/use-autosize.d.ts +2 -2
  177. package/dist/types/components/timeline/timeline.d.ts +5 -5
  178. package/dist/types/components/timeline/timeline.style.d.ts +2 -2
  179. package/dist/types/components/toggle/toggle.d.ts +5 -5
  180. package/dist/types/components/toggle/use-toggle-group.d.ts +2 -2
  181. package/dist/types/components/toggle/use-toggle.d.ts +2 -2
  182. package/dist/types/components/tooltip/tooltip.d.ts +2 -2
  183. package/dist/types/components/visually-hidden/visually-hidden.d.ts +2 -2
  184. package/dist/types/components/wrap/wrap.d.ts +2 -2
  185. package/dist/types/core/components/create-component.d.ts +9 -9
  186. package/dist/types/core/components/props.d.ts +6 -10
  187. package/dist/types/core/system/color-mode-provider.d.ts +2 -2
  188. package/dist/types/core/system/styled.d.ts +2 -2
  189. package/dist/types/core/system/system-provider.d.ts +2 -2
  190. package/dist/types/hooks/use-breakpoint/use-breakpoint-state.d.ts +2 -2
  191. package/dist/types/hooks/use-clipboard/index.d.ts +2 -2
  192. package/dist/types/hooks/use-combobox/index.d.ts +12 -12
  193. package/dist/types/hooks/use-counter/index.d.ts +2 -2
  194. package/dist/types/hooks/use-descendants/index.d.ts +2 -2
  195. package/dist/types/hooks/use-field-sizing/index.d.ts +2 -2
  196. package/dist/types/hooks/use-hover/index.d.ts +2 -2
  197. package/dist/types/hooks/use-popper/index.d.ts +2 -2
  198. package/dist/types/hooks/use-resize-observer/index.d.ts +3 -3
  199. package/dist/types/providers/i18n-provider/i18n-provider.d.ts +3 -3
  200. package/dist/types/providers/ui-provider/ui-provider.d.ts +2 -2
  201. package/dist/types/utils/children.d.ts +2 -2
  202. package/package.json +1 -1
@@ -20,11 +20,14 @@ const infiniteScrollAreaStyle = require_config.defineComponentSlotStyle({
20
20
  props: { orientation: {
21
21
  horizontal: { root: {
22
22
  flexDirection: "row",
23
- gap: "md"
23
+ gap: "md",
24
+ overflowX: "auto"
24
25
  } },
25
26
  vertical: { root: {
26
27
  flexDirection: "column",
27
- gap: "lg"
28
+ gap: "lg",
29
+ h: "full",
30
+ overflowY: "auto"
28
31
  } }
29
32
  } },
30
33
  defaultProps: { orientation: "vertical" }
@@ -1 +1 @@
1
- {"version":3,"file":"infinite-scroll-area.style.cjs","names":["defineComponentSlotStyle"],"sources":["../../../../src/components/infinite-scroll-area/infinite-scroll-area.style.ts"],"sourcesContent":["import { defineComponentSlotStyle } from \"../../core\"\n\nexport const infiniteScrollAreaStyle = defineComponentSlotStyle({\n base: {\n root: {\n display: \"flex\",\n flexDirection: \"row\",\n w: \"full\",\n },\n trigger: {\n alignItems: \"center\",\n display: \"flex\",\n flex: 1,\n justifyContent: \"center\",\n w: \"full\",\n },\n },\n\n props: {\n /**\n * The orientation of the infinite scroll.\n *\n * @default 'vertical'\n */\n orientation: {\n horizontal: {\n root: { flexDirection: \"row\", gap: \"md\" },\n },\n vertical: {\n root: { flexDirection: \"column\", gap: \"lg\" },\n },\n },\n },\n\n defaultProps: {\n orientation: \"vertical\",\n },\n})\n\nexport type InfiniteScrollAreaStyle = typeof infiniteScrollAreaStyle\n"],"mappings":";;;;AAEA,MAAa,0BAA0BA,wCAAyB;CAC9D,MAAM;EACJ,MAAM;GACJ,SAAS;GACT,eAAe;GACf,GAAG;GACJ;EACD,SAAS;GACP,YAAY;GACZ,SAAS;GACT,MAAM;GACN,gBAAgB;GAChB,GAAG;GACJ;EACF;CAED,OAAO,EAML,aAAa;EACX,YAAY,EACV,MAAM;GAAE,eAAe;GAAO,KAAK;GAAM,EAC1C;EACD,UAAU,EACR,MAAM;GAAE,eAAe;GAAU,KAAK;GAAM,EAC7C;EACF,EACF;CAED,cAAc,EACZ,aAAa,YACd;CACF,CAAC"}
1
+ {"version":3,"file":"infinite-scroll-area.style.cjs","names":["defineComponentSlotStyle"],"sources":["../../../../src/components/infinite-scroll-area/infinite-scroll-area.style.ts"],"sourcesContent":["import { defineComponentSlotStyle } from \"../../core\"\n\nexport const infiniteScrollAreaStyle = defineComponentSlotStyle({\n base: {\n root: {\n display: \"flex\",\n flexDirection: \"row\",\n w: \"full\",\n },\n trigger: {\n alignItems: \"center\",\n display: \"flex\",\n flex: 1,\n justifyContent: \"center\",\n w: \"full\",\n },\n },\n\n props: {\n /**\n * The orientation of the infinite scroll.\n *\n * @default 'vertical'\n */\n orientation: {\n horizontal: {\n root: { flexDirection: \"row\", gap: \"md\", overflowX: \"auto\" },\n },\n vertical: {\n root: {\n flexDirection: \"column\",\n gap: \"lg\",\n h: \"full\",\n overflowY: \"auto\",\n },\n },\n },\n },\n\n defaultProps: {\n orientation: \"vertical\",\n },\n})\n\nexport type InfiniteScrollAreaStyle = typeof infiniteScrollAreaStyle\n"],"mappings":";;;;AAEA,MAAa,0BAA0BA,wCAAyB;CAC9D,MAAM;EACJ,MAAM;GACJ,SAAS;GACT,eAAe;GACf,GAAG;GACJ;EACD,SAAS;GACP,YAAY;GACZ,SAAS;GACT,MAAM;GACN,gBAAgB;GAChB,GAAG;GACJ;EACF;CAED,OAAO,EAML,aAAa;EACX,YAAY,EACV,MAAM;GAAE,eAAe;GAAO,KAAK;GAAM,WAAW;GAAQ,EAC7D;EACD,UAAU,EACR,MAAM;GACJ,eAAe;GACf,KAAK;GACL,GAAG;GACH,WAAW;GACZ,EACF;EACF,EACF;CAED,cAAc,EACZ,aAAa,YACd;CACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"create-component.cjs","names":["Fragment","styled","getDisplayName","createContext","useSystem","getClassName","name","useComponentStyle","withContext","mergeProps","chainProps","getSlotClassName","useComponentSlotStyle","style","mergeSlotCSS"],"sources":["../../../../src/core/components/create-component.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, FunctionComponent } from \"react\"\nimport type { AnyString, Dict, Merge } from \"../../utils\"\nimport type { CSSObject, CSSSlotObject } from \"../css\"\nimport type {\n ComponentSlotStyle,\n ComponentStyle,\n StyledOptions,\n System,\n WithoutThemeProps,\n} from \"../system\"\nimport type {\n As,\n DOMElement,\n HTMLStyledProps,\n Component as OriginalComponent,\n} from \"./index.types\"\nimport { Fragment } from \"react\"\nimport {\n createContext,\n cx,\n isArray,\n isFunction,\n isObject,\n isString,\n runIfFn,\n toArray,\n toCamelCase,\n toPascalCase,\n} from \"../../utils\"\nimport { styled, useSystem } from \"../system\"\nimport { chainProps, mergeProps } from \"./props\"\nimport {\n getSlotClassName,\n mergeSlotCSS,\n useComponentSlotStyle,\n useComponentStyle,\n} from \"./use-component-style\"\nimport { getClassName, getDisplayName } from \"./utils\"\n\ntype AsWithFragment = \"fragment\" | As\ntype ClassName = ((system: System) => string) | string\n\ntype Component<\n Y extends AsWithFragment = AsWithFragment,\n M extends object = {},\n> = Y extends \"fragment\"\n ? FunctionComponent<M>\n : OriginalComponent<Exclude<Y, \"fragment\">, M>\n\nexport type ComponentSlotName<\n Y extends ComponentSlotStyle | ComponentStyle = ComponentSlotStyle,\n> = AnyString | Extract<keyof NonNullable<Y[\"base\"]>, string>\n\nexport type ComponentSlot<Y extends string> =\n | [Y, Y]\n | Y\n | { name: string; slot: [Y, Y] | Y }\n\nexport type InitialProps<Y extends Dict = Dict> =\n | ((props: Y) => any)\n | Partial<Y>\nexport type SuperProps<Y extends Dict = Dict> = ((props: Y) => any) | Y\n\nexport type SuperWithoutThemeProps<\n Y extends Dict = Dict,\n M extends Dict = Dict,\n D extends keyof Y = keyof Y,\n> = ((props: WithoutThemeProps<Y, M, D>) => any) | WithoutThemeProps<Y, M, D>\n\nexport interface UseComponentPropsOptions<\n Y extends number | string | symbol = string,\n> {\n className?: ClassName\n withContext?: boolean\n transferProps?: Y[]\n}\n\nexport interface ComponentOptions extends Omit<StyledOptions, \"transferProps\"> {\n className?: ClassName\n shouldStyleProps?: boolean\n}\n\ninterface classNameOptions<Y extends string = string> {\n className?: ClassName\n slot?: ComponentSlot<Y>\n}\n\nexport interface ComponentWithContextOptions<\n Y extends number | string | symbol = string,\n>\n extends ComponentOptions, UseComponentPropsOptions<Y> {}\n\nfunction createProxyComponent<\n Y extends AsWithFragment = \"div\",\n M extends Dict = Dict,\n>(el: FC<M> | Y, { shouldStyleProps, ...options }: ComponentOptions = {}) {\n options.shouldForwardProp ??= isFunction(el)\n shouldStyleProps ??= !isFunction(el)\n\n if (el === \"fragment\") el = Fragment\n\n if (shouldStyleProps || isString(el)) {\n const ProxyComponent = styled(el as As, options)\n\n ProxyComponent.displayName = \"ProxyComponent\"\n\n return ProxyComponent\n } else {\n el.displayName ??= \"ProxyComponent\"\n\n return el as FC<M>\n }\n}\n\nfunction withDisplayName<\n Y extends AsWithFragment = AsWithFragment,\n M extends object = {},\n>(Component: FC<M>, displayName: string) {\n Object.defineProperty(Component, \"name\", { value: displayName })\n Object.defineProperty(Component, \"displayName\", { value: displayName })\n\n return Component as Component<Y, M>\n}\n\nfunction getSlotKey<Y extends string>(slot?: ComponentSlot<Y>) {\n if (!slot) return \"unknown\"\n\n if (isArray(slot) || !isObject(slot)) {\n return toCamelCase(toArray(slot).join(\"-\"))\n } else {\n return toCamelCase(slot.name)\n }\n}\n\nfunction getSlotName<Y extends string>(slot?: ComponentSlot<Y>) {\n if (!slot) return \"\"\n\n if (isArray(slot)) {\n return slot.map((value) => toPascalCase(value as string)).join(\"\")\n } else if (isObject(slot)) {\n return toPascalCase(slot.name)\n } else {\n return toPascalCase(slot as string)\n }\n}\n\nexport function createComponent<\n Y extends object = {},\n M extends ComponentStyle = Dict,\n D extends Dict = Dict,\n>(name: string, style?: M) {\n const defaultClassName = style?.className\n const defaultDisplayName = getDisplayName(name)\n const [ComponentContext, useComponentContext] = createContext<D>({\n name: `${defaultDisplayName}Context`,\n })\n const [PropsContext, usePropsContext] = createContext<Partial<Y>>({\n name: `${defaultDisplayName}PropsContext`,\n strict: false,\n })\n\n function useClassName(name?: string, className?: ClassName) {\n const system = useSystem()\n\n className = runIfFn(className, system)\n className ??= getClassName(name, defaultClassName)(system)\n\n return className\n }\n\n function useComponentProps<H extends Y = Y, R extends keyof H = keyof H>(\n props: H,\n {\n className,\n withContext = true,\n transferProps,\n }: UseComponentPropsOptions<R> = {},\n ) {\n const system = useSystem()\n\n className = runIfFn(className, system)\n className ??= defaultClassName\n className ??= getClassName(name)(system)\n\n const contextProps = usePropsContext() ?? {}\n const mergedProps = withContext ? mergeProps(contextProps, props)() : props\n const [, rest] = useComponentStyle(mergedProps, {\n name,\n className,\n style,\n transferProps,\n })\n\n return rest\n }\n\n function component<D extends AsWithFragment = \"div\", H extends Dict = Y>(\n el: D | FC<H>,\n { name, className, ...options }: ComponentOptions = {},\n ) {\n const displayName = getDisplayName(name, defaultDisplayName)\n const ProxyComponent = createProxyComponent(el, options)\n\n return function (\n initialProps?: InitialProps<H>,\n ...superProps: SuperProps<H>[]\n ) {\n return withDisplayName<D, H>((props) => {\n className = useClassName(name, className)\n\n const computedProps = isFunction(initialProps)\n ? initialProps(props)\n : mergeProps(initialProps ?? {}, props)()\n const mergedProps = chainProps<any>(...superProps)()(computedProps)\n\n return (\n <ProxyComponent\n {...mergedProps}\n className={cx(className, mergedProps.className)}\n />\n )\n }, displayName)\n }\n }\n\n function withContext<\n D extends AsWithFragment = \"div\",\n H extends Y = Y,\n R extends keyof H = keyof H,\n >(\n el: D | FC<WithoutThemeProps<H, M, R>>,\n {\n name,\n className,\n withContext,\n transferProps,\n ...options\n }: ComponentWithContextOptions<R> = {},\n ) {\n const displayName = getDisplayName(name, defaultDisplayName)\n const ProxyComponent = createProxyComponent(el, options)\n\n return function (\n initialProps?: InitialProps<H>,\n ...superProps: SuperWithoutThemeProps<H, M, R>[]\n ) {\n return withDisplayName<D, H>((props) => {\n className = useClassName(name, className)\n\n const computedProps = isFunction(initialProps)\n ? initialProps(props)\n : mergeProps(initialProps ?? {}, props)()\n const mergedProps = useComponentProps(computedProps, {\n className,\n withContext,\n transferProps,\n })\n const rest = chainProps<any>(...toArray(superProps))()(mergedProps)\n\n return <ProxyComponent {...rest} />\n }, displayName)\n }\n }\n\n return {\n component,\n ComponentContext,\n PropsContext,\n useComponentContext,\n usePropsContext,\n withContext,\n useComponentProps,\n }\n}\n\nexport function createSlotComponent<\n Y extends object = {},\n M extends ComponentSlotStyle = Dict,\n D extends Dict = Dict,\n>(rootName: string, style?: M) {\n const rootClassName = style?.className\n const rootDisplayName = getDisplayName(rootName)\n const classNameMap = new Map<string, classNameOptions>()\n const [StyleContext, useStyleContext] = createContext<\n CSSSlotObject<ComponentSlotName<M>>\n >({\n name: `${rootDisplayName}StyleContext`,\n })\n const [ComponentContext, useComponentContext] = createContext<D>({\n name: `${rootDisplayName}Context`,\n })\n const [PropsContext, usePropsContext] = createContext<Partial<Y>>({\n name: `${rootDisplayName}PropsContext`,\n strict: false,\n })\n\n function useClassName(\n slot?: ComponentSlot<ComponentSlotName<M>>,\n className?: ClassName,\n ) {\n const system = useSystem()\n\n className = runIfFn(className, system)\n className ??= getSlotClassName(\n rootClassName ?? getClassName(rootName)(system),\n slot,\n )\n\n return className\n }\n\n function useClassNames() {\n const system = useSystem()\n const entries = classNameMap.entries().map(([key, { className, slot }]) => {\n className = runIfFn(className, system)\n className ??= getSlotClassName(\n rootClassName ?? getClassName(rootName)(system),\n slot,\n )\n\n return [key, className]\n })\n\n return Object.fromEntries(\n entries.filter(([_, className]) => className),\n ) as { [key: string]: string }\n }\n\n function useRootComponentProps<\n Y extends Dict = Dict,\n R extends keyof Y = keyof Y,\n >(\n props: Y,\n slot?: ComponentSlot<ComponentSlotName<M>>,\n {\n className,\n withContext = true,\n transferProps,\n }: UseComponentPropsOptions<R> = {},\n ): [\n CSSSlotObject,\n Merge<WithoutThemeProps<Y, M, R>, { css?: CSSObject | CSSObject[] }>,\n ] {\n className = useClassName(slot, className)\n\n const contextProps = usePropsContext() ?? {}\n const mergedProps = withContext ? mergeProps(contextProps, props)() : props\n const [css, rest] = useComponentSlotStyle(mergedProps, {\n name: rootName,\n className,\n style,\n slot,\n transferProps,\n })\n\n return [css, rest]\n }\n\n function useSlotComponentProps<Y extends Dict = Dict>(\n props: Y,\n slot?: ComponentSlot<ComponentSlotName<M>>,\n { className }: Omit<UseComponentPropsOptions, \"transferProps\"> = {},\n ) {\n className = useClassName(slot, className)\n\n const style = useStyleContext()\n\n return {\n ...props,\n className: cx(className, props.className),\n css: mergeSlotCSS(slot, style, props.css),\n }\n }\n\n function component<H extends AsWithFragment = \"div\", R extends Dict = Dict>(\n el: FC<R> | H,\n slot?: ComponentSlot<ComponentSlotName<M>>,\n { name, className, ...options }: ComponentOptions = {},\n ) {\n const ProxyComponent = createProxyComponent(el, options)\n const slotKey = getSlotKey(slot)\n const slotName = getSlotName(slot)\n const displayName = getDisplayName(name, `${rootDisplayName}${slotName}`)\n\n classNameMap.set(slotKey, { className, slot })\n\n return function (\n initialProps?: InitialProps<R>,\n ...superProps: SuperProps<R>[]\n ) {\n return withDisplayName<H, R>((props) => {\n className = useClassName(slot, className)\n\n const computedProps = isFunction(initialProps)\n ? initialProps(props)\n : mergeProps(initialProps ?? {}, props)()\n const mergedProps = chainProps(...superProps)()(computedProps)\n\n return (\n <ProxyComponent\n {...mergedProps}\n className={cx(className, mergedProps.className)}\n />\n )\n }, displayName)\n }\n }\n\n function withProvider<\n H extends AsWithFragment = \"div\",\n R extends Y = Y,\n T extends keyof R = keyof R,\n >(\n el: FC<WithoutThemeProps<R, M, T>> | H,\n slot: ComponentSlot<ComponentSlotName<M>> = \"root\" as ComponentSlot<\n ComponentSlotName<M>\n >,\n {\n name,\n className,\n withContext,\n transferProps,\n ...options\n }: ComponentWithContextOptions<T> = {},\n ) {\n const ProxyComponent = createProxyComponent(el, options)\n const slotKey = getSlotKey(slot)\n const slotName = getSlotName(slot)\n const displayName = getDisplayName(name, `${rootDisplayName}${slotName}`)\n\n classNameMap.set(slotKey, { className, slot })\n\n return function (\n initialProps?: InitialProps<R>,\n ...superProps: SuperWithoutThemeProps<R, M, T>[]\n ) {\n return withDisplayName<H, R>((props) => {\n const computedProps = isFunction(initialProps)\n ? initialProps(props)\n : mergeProps(initialProps ?? {}, props)()\n const [context, mergedProps] = useRootComponentProps(\n computedProps,\n slot,\n {\n className,\n withContext,\n transferProps,\n },\n )\n const rest = chainProps<any>(...superProps)()(mergedProps)\n\n return (\n <StyleContext value={context}>\n <ProxyComponent {...rest} />\n </StyleContext>\n )\n }, displayName)\n }\n }\n\n function withContext<\n H extends AsWithFragment = \"div\",\n R extends Dict = H extends DOMElement ? HTMLStyledProps<H> : Dict,\n >(\n el: FC<R> | H,\n slot?: ComponentSlot<ComponentSlotName<M>>,\n {\n name,\n className,\n withContext,\n ...options\n }: Omit<ComponentWithContextOptions, \"transferProps\"> = {},\n ) {\n const ProxyComponent = createProxyComponent(el, options)\n const slotKey = getSlotKey(slot)\n const slotName = getSlotName(slot)\n const displayName = getDisplayName(name, `${rootDisplayName}${slotName}`)\n\n classNameMap.set(slotKey, { className, slot })\n\n return function (\n initialProps?: InitialProps<R>,\n ...superProps: SuperProps<R>[]\n ) {\n return withDisplayName<H, R>((props) => {\n const computedProps = isFunction(initialProps)\n ? initialProps(props)\n : mergeProps(initialProps ?? {}, props)()\n const mergedProps = useSlotComponentProps(computedProps, slot, {\n className,\n withContext,\n })\n const rest = chainProps(...superProps)()(mergedProps)\n\n return <ProxyComponent {...rest} />\n }, displayName)\n }\n }\n\n return {\n component,\n ComponentContext,\n PropsContext,\n StyleContext,\n useClassNames,\n useComponentContext,\n usePropsContext,\n useStyleContext,\n withContext,\n withProvider,\n useRootComponentProps,\n useSlotComponentProps,\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AA8FA,SAAS,qBAGP,IAAe,EAAE,kBAAkB,GAAG,YAA8B,EAAE,EAAE;AACxE,SAAQ,wEAAiC,GAAG;AAC5C,sBAAqB,mDAAY,GAAG;AAEpC,KAAI,OAAO,WAAY,MAAKA;AAE5B,KAAI,oEAA6B,GAAG,EAAE;EACpC,MAAM,iBAAiBC,uBAAO,IAAU,QAAQ;AAEhD,iBAAe,cAAc;AAE7B,SAAO;QACF;AACL,KAAG,gBAAgB;AAEnB,SAAO;;;AAIX,SAAS,gBAGP,WAAkB,aAAqB;AACvC,QAAO,eAAe,WAAW,QAAQ,EAAE,OAAO,aAAa,CAAC;AAChE,QAAO,eAAe,WAAW,eAAe,EAAE,OAAO,aAAa,CAAC;AAEvE,QAAO;;AAGT,SAAS,WAA6B,MAAyB;AAC7D,KAAI,CAAC,KAAM,QAAO;AAElB,oDAAY,KAAK,IAAI,iDAAU,KAAK,CAClC,0GAA2B,KAAK,CAAC,KAAK,IAAI,CAAC;KAE3C,2DAAmB,KAAK,KAAK;;AAIjC,SAAS,YAA8B,MAAyB;AAC9D,KAAI,CAAC,KAAM,QAAO;AAElB,oDAAY,KAAK,CACf,QAAO,KAAK,KAAK,8DAAuB,MAAgB,CAAC,CAAC,KAAK,GAAG;0DAChD,KAAK,CACvB,4DAAoB,KAAK,KAAK;KAE9B,4DAAoB,KAAe;;AAIvC,SAAgB,gBAId,MAAc,OAAW;CACzB,MAAM,mBAAmB,OAAO;CAChC,MAAM,qBAAqBC,6BAAe,KAAK;CAC/C,MAAM,CAAC,kBAAkB,uBAAuBC,8BAAiB,EAC/D,MAAM,GAAG,mBAAmB,UAC7B,CAAC;CACF,MAAM,CAAC,cAAc,mBAAmBA,8BAA0B;EAChE,MAAM,GAAG,mBAAmB;EAC5B,QAAQ;E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Aa,IAAI,SAAS;GAAE;GAAW;GAAM,CAAC;AAE9C,SAAO,SACL,cACA,GAAG,YACH;AACA,UAAO,iBAAuB,UAAU;IAItC,MAAM,CAAC,SAAS,eAAe,wEAHE,aAAa,GAC1C,aAAa,MAAM,GACnBO,yBAAW,gBAAgB,EAAE,EAAE,MAAM,EAAE,EAGzC,MACA;KACE;KACA;KACA;KACD,CACF;AAGD,WACE,2CAAC;KAAa,OAAO;eACnB,2CAAC,kBAAe,GAJPC,yBAAgB,GAAG,WAAW,EAAE,CAAC,YAAY,GAI1B;MACf;MAEhB,YAAY;;;CAInB,SAAS,YAIP,IACA,MACA,EACE,MACA,WACA,4BACA,GAAG,YACmD,EAAE,EAC1D;EACA,MAAM,iBAAiB,qBAAqB,IAAI,QAAQ;EACxD,MAAM,UAAU,WAAW,KAAK;EAEhC,MAAM,cAAcR,6BAAe,MAAM,GAAG,kBAD3B,YAAY,KAAK,GACuC;AAEzE,eAAa,IAAI,SAAS;GAAE;GAAW;GAAM,CAAC;AAE9C,SAAO,SACL,cACA,GAAG,YACH;AACA,UAAO,iBAAuB,UAAU;IAItC,MAAM,cAAc,wEAHa,aAAa,GAC1C,aAAa,MAAM,GACnBO,yBAAW,gBAAgB,EAAE,EAAE,MAAM,EAAE,EACc,MAAM;KAC7D;KACA;KACD,CAAC;AAGF,WAAO,2CAAC,kBAAe,GAFVC,yBAAW,GAAG,WAAW,EAAE,CAAC,YAAY,GAElB;MAClC,YAAY;;;AAInB,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
1
+ {"version":3,"file":"create-component.cjs","names":["Fragment","styled","getDisplayName","createContext","useSystem","getClassName","name","useComponentStyle","withContext","mergeProps","chainProps","getSlotClassName","useComponentSlotStyle","style","mergeSlotCSS"],"sources":["../../../../src/core/components/create-component.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, FunctionComponent } from \"react\"\nimport type { AnyString, Dict, Merge } from \"../../utils\"\nimport type { CSSObject, CSSSlotObject } from \"../css\"\nimport type {\n ComponentSlotStyle,\n ComponentStyle,\n StyledOptions,\n System,\n WithoutThemeProps,\n} from \"../system\"\nimport type {\n As,\n DOMElement,\n HTMLStyledProps,\n Component as OriginalComponent,\n} from \"./index.types\"\nimport { Fragment } from \"react\"\nimport {\n createContext,\n cx,\n isArray,\n isFunction,\n isObject,\n isString,\n runIfFn,\n toArray,\n toCamelCase,\n toPascalCase,\n} from \"../../utils\"\nimport { styled, useSystem } from \"../system\"\nimport { chainProps, mergeProps } from \"./props\"\nimport {\n getSlotClassName,\n mergeSlotCSS,\n useComponentSlotStyle,\n useComponentStyle,\n} from \"./use-component-style\"\nimport { getClassName, getDisplayName } from \"./utils\"\n\ntype AsWithFragment = \"fragment\" | As\ntype ClassName = ((system: System) => string) | string\n\ntype Component<\n Y extends AsWithFragment = AsWithFragment,\n M extends object = {},\n> = Y extends \"fragment\"\n ? FunctionComponent<M>\n : OriginalComponent<Exclude<Y, \"fragment\">, M>\n\nexport type ComponentSlotName<\n Y extends ComponentSlotStyle | ComponentStyle = ComponentSlotStyle,\n> = AnyString | Extract<keyof NonNullable<Y[\"base\"]>, string>\n\nexport type ComponentSlot<Y extends string> =\n | [Y, Y]\n | Y\n | { name: string; slot: [Y, Y] | Y }\n\nexport type InitialProps<Y extends Dict = Dict> =\n | ((props: Y) => any)\n | Partial<Y>\nexport type SuperProps<Y extends Dict = Dict> = ((props: Y) => any) | Y\n\nexport type SuperWithoutThemeProps<\n Y extends Dict = Dict,\n M extends Dict = Dict,\n D extends keyof Y = keyof Y,\n> = ((props: WithoutThemeProps<Y, M, D>) => any) | WithoutThemeProps<Y, M, D>\n\nexport interface UseComponentPropsOptions<\n Y extends number | string | symbol = string,\n> {\n className?: ClassName\n withContext?: boolean\n transferProps?: Y[]\n}\n\nexport interface ComponentOptions extends Omit<StyledOptions, \"transferProps\"> {\n className?: ClassName\n shouldStyleProps?: boolean\n}\n\ninterface classNameOptions<Y extends string = string> {\n className?: ClassName\n slot?: ComponentSlot<Y>\n}\n\nexport interface ComponentWithContextOptions<\n Y extends number | string | symbol = string,\n>\n extends ComponentOptions, UseComponentPropsOptions<Y> {}\n\nfunction createProxyComponent<\n Y extends AsWithFragment = \"div\",\n M extends Dict = Dict,\n>(el: FC<M> | Y, { shouldStyleProps, ...options }: ComponentOptions = {}) {\n options.shouldForwardProp ??= isFunction(el)\n shouldStyleProps ??= !isFunction(el)\n\n if (el === \"fragment\") el = Fragment\n\n if (shouldStyleProps || isString(el)) {\n const ProxyComponent = styled(el as As, options)\n\n ProxyComponent.displayName = \"ProxyComponent\"\n\n return ProxyComponent\n } else {\n el.displayName ??= \"ProxyComponent\"\n\n return el as FC<M>\n }\n}\n\nfunction withDisplayName<\n Y extends AsWithFragment = AsWithFragment,\n M extends object = {},\n>(Component: FC<M>, displayName: string) {\n Object.defineProperty(Component, \"name\", { value: displayName })\n Object.defineProperty(Component, \"displayName\", { value: displayName })\n\n return Component as Component<Y, M>\n}\n\nfunction getSlotKey<Y extends string>(slot?: ComponentSlot<Y>) {\n if (!slot) return \"unknown\"\n\n if (isArray(slot) || !isObject(slot)) {\n return toCamelCase(toArray(slot).join(\"-\"))\n } else {\n return toCamelCase(slot.name)\n }\n}\n\nfunction getSlotName<Y extends string>(slot?: ComponentSlot<Y>) {\n if (!slot) return \"\"\n\n if (isArray(slot)) {\n return slot.map((value) => toPascalCase(value as string)).join(\"\")\n } else if (isObject(slot)) {\n return toPascalCase(slot.name)\n } else {\n return toPascalCase(slot as string)\n }\n}\n\nexport function createComponent<\n Y extends object = {},\n M extends ComponentStyle = Dict,\n D extends Dict = Dict,\n>(name: string, style?: M) {\n const defaultClassName = style?.className\n const defaultDisplayName = getDisplayName(name)\n const [ComponentContext, useComponentContext] = createContext<D>({\n name: `${defaultDisplayName}Context`,\n })\n const [PropsContext, usePropsContext] = createContext<Partial<Y>>({\n name: `${defaultDisplayName}PropsContext`,\n strict: false,\n })\n\n function useClassName(name?: string, className?: ClassName) {\n const system = useSystem()\n\n className = runIfFn(className, system)\n className ??= getClassName(name, defaultClassName)(system)\n\n return className\n }\n\n function useComponentProps<H extends Y = Y, R extends keyof H = keyof H>(\n props: H,\n {\n className,\n withContext = true,\n transferProps,\n }: UseComponentPropsOptions<R> = {},\n ) {\n const system = useSystem()\n\n className = runIfFn(className, system)\n className ??= defaultClassName\n className ??= getClassName(name)(system)\n\n const contextProps = usePropsContext() ?? {}\n const mergedProps = withContext\n ? (mergeProps(contextProps, props)() as H)\n : props\n const [, rest] = useComponentStyle(mergedProps, {\n name,\n className,\n style,\n transferProps,\n })\n\n return rest\n }\n\n function component<D extends AsWithFragment = \"div\", H extends Dict = Y>(\n el: D | FC<H>,\n { name, className, ...options }: ComponentOptions = {},\n ) {\n const displayName = getDisplayName(name, defaultDisplayName)\n const ProxyComponent = createProxyComponent(el, options)\n\n return function (\n initialProps?: InitialProps<H>,\n ...superProps: SuperProps<H>[]\n ) {\n return withDisplayName<D, H>((props) => {\n className = useClassName(name, className)\n\n const computedProps = isFunction(initialProps)\n ? initialProps(props)\n : mergeProps(initialProps ?? {}, props)()\n const mergedProps = chainProps<any>(...superProps)()(computedProps)\n\n return (\n <ProxyComponent\n {...mergedProps}\n className={cx(className, mergedProps.className)}\n />\n )\n }, displayName)\n }\n }\n\n function withContext<\n D extends AsWithFragment = \"div\",\n H extends Y = Y,\n R extends keyof H = keyof H,\n >(\n el: D | FC<WithoutThemeProps<H, M, R>>,\n {\n name,\n className,\n withContext,\n transferProps,\n ...options\n }: ComponentWithContextOptions<R> = {},\n ) {\n const displayName = getDisplayName(name, defaultDisplayName)\n const ProxyComponent = createProxyComponent(el, options)\n\n return function (\n initialProps?: InitialProps<H>,\n ...superProps: SuperWithoutThemeProps<H, M, R>[]\n ) {\n return withDisplayName<D, H>((props) => {\n className = useClassName(name, className)\n\n const computedProps = isFunction(initialProps)\n ? initialProps(props)\n : mergeProps(initialProps ?? {}, props)()\n const mergedProps = useComponentProps(computedProps, {\n className,\n withContext,\n transferProps,\n })\n const rest = chainProps<any>(...toArray(superProps))()(mergedProps)\n\n return <ProxyComponent {...rest} />\n }, displayName)\n }\n }\n\n return {\n component,\n ComponentContext,\n PropsContext,\n useComponentContext,\n usePropsContext,\n withContext,\n useComponentProps,\n }\n}\n\nexport function createSlotComponent<\n Y extends object = {},\n M extends ComponentSlotStyle = Dict,\n D extends Dict = Dict,\n>(rootName: string, style?: M) {\n const rootClassName = style?.className\n const rootDisplayName = getDisplayName(rootName)\n const classNameMap = new Map<string, classNameOptions>()\n const [StyleContext, useStyleContext] = createContext<\n CSSSlotObject<ComponentSlotName<M>>\n >({\n name: `${rootDisplayName}StyleContext`,\n })\n const [ComponentContext, useComponentContext] = createContext<D>({\n name: `${rootDisplayName}Context`,\n })\n const [PropsContext, usePropsContext] = createContext<Partial<Y>>({\n name: `${rootDisplayName}PropsContext`,\n strict: false,\n })\n\n function useClassName(\n slot?: ComponentSlot<ComponentSlotName<M>>,\n className?: ClassName,\n ) {\n const system = useSystem()\n\n className = runIfFn(className, system)\n className ??= getSlotClassName(\n rootClassName ?? getClassName(rootName)(system),\n slot,\n )\n\n return className\n }\n\n function useClassNames() {\n const system = useSystem()\n const entries = classNameMap.entries().map(([key, { className, slot }]) => {\n className = runIfFn(className, system)\n className ??= getSlotClassName(\n rootClassName ?? getClassName(rootName)(system),\n slot,\n )\n\n return [key, className]\n })\n\n return Object.fromEntries(\n entries.filter(([_, className]) => className),\n ) as { [key: string]: string }\n }\n\n function useRootComponentProps<\n Y extends Dict = {},\n R extends keyof Y = keyof Y,\n >(\n props: Y,\n slot?: ComponentSlot<ComponentSlotName<M>>,\n {\n className,\n withContext = true,\n transferProps,\n }: UseComponentPropsOptions<R> = {},\n ): [\n CSSSlotObject,\n Merge<WithoutThemeProps<Y, M, R>, { css?: CSSObject | CSSObject[] }>,\n ] {\n className = useClassName(slot, className)\n\n const contextProps = usePropsContext() ?? {}\n const mergedProps = withContext\n ? (mergeProps(contextProps, props)() as Y)\n : props\n const [css, rest] = useComponentSlotStyle(mergedProps, {\n name: rootName,\n className,\n style,\n slot,\n transferProps,\n })\n\n return [css, rest]\n }\n\n function useSlotComponentProps<Y extends Dict = {}>(\n props: Y,\n slot?: ComponentSlot<ComponentSlotName<M>>,\n { className }: Omit<UseComponentPropsOptions, \"transferProps\"> = {},\n ) {\n className = useClassName(slot, className)\n\n const style = useStyleContext()\n\n return {\n ...props,\n className: cx(className, props.className),\n css: mergeSlotCSS(slot, style, props.css),\n }\n }\n\n function component<H extends AsWithFragment = \"div\", R extends Dict = Dict>(\n el: FC<R> | H,\n slot?: ComponentSlot<ComponentSlotName<M>>,\n { name, className, ...options }: ComponentOptions = {},\n ) {\n const ProxyComponent = createProxyComponent(el, options)\n const slotKey = getSlotKey(slot)\n const slotName = getSlotName(slot)\n const displayName = getDisplayName(name, `${rootDisplayName}${slotName}`)\n\n classNameMap.set(slotKey, { className, slot })\n\n return function (\n initialProps?: InitialProps<R>,\n ...superProps: SuperProps<R>[]\n ) {\n return withDisplayName<H, R>((props) => {\n className = useClassName(slot, className)\n\n const computedProps = isFunction(initialProps)\n ? initialProps(props)\n : mergeProps(initialProps ?? {}, props)()\n const mergedProps = chainProps(...superProps)()(computedProps)\n\n return (\n <ProxyComponent\n {...mergedProps}\n className={cx(className, mergedProps.className)}\n />\n )\n }, displayName)\n }\n }\n\n function withProvider<\n H extends AsWithFragment = \"div\",\n R extends Y = Y,\n T extends keyof R = keyof R,\n >(\n el: FC<WithoutThemeProps<R, M, T>> | H,\n slot: ComponentSlot<ComponentSlotName<M>> = \"root\" as ComponentSlot<\n ComponentSlotName<M>\n >,\n {\n name,\n className,\n withContext,\n transferProps,\n ...options\n }: ComponentWithContextOptions<T> = {},\n ) {\n const ProxyComponent = createProxyComponent(el, options)\n const slotKey = getSlotKey(slot)\n const slotName = getSlotName(slot)\n const displayName = getDisplayName(name, `${rootDisplayName}${slotName}`)\n\n classNameMap.set(slotKey, { className, slot })\n\n return function (\n initialProps?: InitialProps<R>,\n ...superProps: SuperWithoutThemeProps<R, M, T>[]\n ) {\n return withDisplayName<H, R>((props) => {\n const computedProps = isFunction(initialProps)\n ? initialProps(props)\n : mergeProps(initialProps ?? {}, props)()\n const [context, mergedProps] = useRootComponentProps(\n computedProps,\n slot,\n {\n className,\n withContext,\n transferProps,\n },\n )\n const rest = chainProps<any>(...superProps)()(mergedProps)\n\n return (\n <StyleContext value={context}>\n <ProxyComponent {...rest} />\n </StyleContext>\n )\n }, displayName)\n }\n }\n\n function withContext<\n H extends AsWithFragment = \"div\",\n R extends Dict = H extends DOMElement ? HTMLStyledProps<H> : Dict,\n >(\n el: FC<R> | H,\n slot?: ComponentSlot<ComponentSlotName<M>>,\n {\n name,\n className,\n withContext,\n ...options\n }: Omit<ComponentWithContextOptions, \"transferProps\"> = {},\n ) {\n const ProxyComponent = createProxyComponent(el, options)\n const slotKey = getSlotKey(slot)\n const slotName = getSlotName(slot)\n const displayName = getDisplayName(name, `${rootDisplayName}${slotName}`)\n\n classNameMap.set(slotKey, { className, slot })\n\n return function (\n initialProps?: InitialProps<R>,\n ...superProps: SuperProps<R>[]\n ) {\n return withDisplayName<H, R>((props) => {\n const computedProps = isFunction(initialProps)\n ? initialProps(props)\n : mergeProps(initialProps ?? {}, props)()\n const mergedProps = useSlotComponentProps(computedProps, slot, {\n className,\n withContext,\n })\n const rest = chainProps(...superProps)()(mergedProps)\n\n return <ProxyComponent {...rest} />\n }, displayName)\n }\n }\n\n return {\n component,\n ComponentContext,\n PropsContext,\n StyleContext,\n useClassNames,\n useComponentContext,\n usePropsContext,\n useStyleContext,\n withContext,\n withProvider,\n useRootComponentProps,\n useSlotComponentProps,\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AA8FA,SAAS,qBAGP,IAAe,EAAE,kBAAkB,GAAG,YAA8B,EAAE,EAAE;AACxE,SAAQ,wEAAiC,GAAG;AAC5C,sBAAqB,mDAAY,GAAG;AAEpC,KAAI,OAAO,WAAY,MAAKA;AAE5B,KAAI,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C,yBAAgB,GAAG,WAAW,EAAE,CAAC,YAAY,GAI1B;MACf;MAEhB,YAAY;;;CAInB,SAAS,YAIP,IACA,MACA,EACE,MACA,WACA,4BACA,GAAG,YACmD,EAAE,EAC1D;EACA,MAAM,iBAAiB,qBAAqB,IAAI,QAAQ;EACxD,MAAM,UAAU,WAAW,KAAK;EAEhC,MAAM,cAAcR,6BAAe,MAAM,GAAG,kBAD3B,YAAY,KAAK,GACuC;AAEzE,eAAa,IAAI,SAAS;GAAE;GAAW;GAAM,CAAC;AAE9C,SAAO,SACL,cACA,GAAG,YACH;AACA,UAAO,iBAAuB,UAAU;IAItC,MAAM,cAAc,wEAHa,aAAa,GAC1C,aAAa,MAAM,GACnBO,yBAAW,gBAAgB,EAAE,EAAE,MAAM,EAAE,EACc,MAAM;KAC7D;KACA;KACD,CAAC;AAGF,WAAO,2CAAC,kBAAe,GAFVC,yBAAW,GAAG,WAAW,EAAE,CAAC,YAAY,GAElB;MAClC,YAAY;;;AAInB,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
@@ -24,6 +24,7 @@ function mergeProps(...args) {
24
24
  return function({ mergeClassName = true, mergeCSS = true, mergeEvent = true, mergeRef = true, mergeStyle = true } = {}) {
25
25
  let result = {};
26
26
  for (const props of args) {
27
+ if ((0, require_utils_index.utils_exports.isUndefined)(props)) continue;
27
28
  for (const key in result) {
28
29
  if (mergeRef && key === "ref") {
29
30
  result[key] = require_ref.mergeRefs(result[key], props[key]);
@@ -1 +1 @@
1
- {"version":3,"file":"props.cjs","names":["conditionProperties","styleProperties","result: Dict","mergeRefs"],"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 } from \"../css\"\n\ntype MergeAll<Y extends Dict[]> = Y extends [infer M]\n ? M\n : Y extends [infer D, ...infer H]\n ? H extends any[]\n ? Merge<D, MergeAll<H>>\n : 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])\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[]>(...args: Y) {\n return function ({\n mergeClassName = true,\n mergeCSS = true,\n mergeEvent = true,\n mergeRef = true,\n mergeStyle = true,\n }: MergePropsOptions = {}): MergeAll<Y> {\n let result: Dict = {}\n\n for (const props of args) {\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\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":";;;;;;;;;;;AA0BA,SAAS,QAAQ,KAAa;AAC5B,QAAO,WAAW,KAAK,IAAI;;AAG7B,MAAa,WAAW,IAAI,IAAY,CACtC,GAAGA,wCACH,GAAGC,+BACJ,CAAC;AAIF,SAAgB,wBACd,eAAyB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Q,MAAS;AAEpC,MAAI,MAAM,WAAW,EACnB,QAAO,SAAU,GAAM;GACrB,MAAM,IAAI,MAAM,MAAM,EAAE;AAGxB,4DAFqB,EAAE,GAAG,EAAE,EAAE,GAAG,WAAW,GAAG,EAAE,CAAC,QAAQ;;AAK9D,SAAO,MAAM,OAAO,SAAU,GAAG,GAAG;AAClC,UAAO,SAAU,IAAO,EAAE,EAAO;IAC/B,MAAM,sDAAe,EAAE,GAAG,EAAE,EAAE,GAAG,WAAW,GAAG,EAAE,CAAC,QAAQ;AAG1D,6DAFqB,EAAE,GAAG,EAAE,EAAE,GAAG,WAAW,GAAG,EAAE,CAAC,QAAQ;;IAI5D;;;AAIN,SAAgB,aAId,GAAM,GAAM,WAAgB,EAAE,EAAE;AAChC,0FACa,GAAG,SAAwB,oDAC3B,GAAG,SAAwB,CACvC;;AAGH,SAAgB,cACd,OACA,MACA;AACA,oFAAuC,OAAO,KAAK,EAAE,CAAC,OAAO,KAAK,CAAC;;AAGrE,SAAgB,aAAa,OAAa,MAAoC;CAC5E,IAAID,SAAe,EAAE;AAErB,QAAO,QAAQ,MAAM,CAAC,SAAS,CAAC,KAAK,WAAW;AAC9C,MAAI,CAAC,SAAS,IAAI,IAAI,CAAE;AAExB,MAAI,KAAK,SAAS,IAAI,CACpB,uDAAe,QAAQ,GAAG,MAAM,OAAO,CAAC;2DACtB,MAAM,EAAE;AAC1B,WAAQ,aAAa,OAAO,KAAK;AAEjC,4DAAkB,MAAM,CAAE;AAE1B,yDAAe,QAAQ,GAAG,MAAM,OAAO,CAAC;;GAE1C;AAEF,QAAO;;AAGT,SAAgB,gBACd,OACA,MACA;AACA,iCAAqB,aAAa,OAAO,KAAK,EAAE,CAAC,OAAO,KAAK,CAAC"}
1
+ {"version":3,"file":"props.cjs","names":["conditionProperties","styleProperties","result: Dict","mergeRefs"],"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 } 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])\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\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;AAC5B,QAAO,WAAW,KAAK,IAAI;;AAG7B,MAAa,WAAW,IAAI,IAAY,CACtC,GAAGA,wCACH,GAAGC,+BACJ,CAAC;AAIF,SAAgB,wBACd,eAAyB,EAAE,EACR;AACnB,QAAO,SAAU,MAAuB;AACtC,MAAI,aAAa,SAAS,KAAK,CAAE,QAAO;AAExC,MAAI,KAAK,WAAW,KAAK,CAAE,QAAO;AAElC,SAAO,CAAC,SAAS,IAAI,KAAK;;;AAkB9B,SAAgB,WAAW,GAAG,MAA4B;AACxD,QAAO,SAAU,EACf,iBAAiB,MACjB,WAAW,MACX,aAAa,MACb,WAAW,MACX,aAAa,SACQ,EAAE,EAAE;EACzB,IAAIC,SAAe,EAAE;AAErB,OAAK,MAAM,SAAS,MAAM;AACxB,0DAAgB,MAAM,CAAE;AAExB,QAAK,MAAM,OAAO,QAAQ;AACxB,QAAI,YAAY,QAAQ,OAAO;AAC7B,YAAO,OAAOC,sBAAU,OAAO,MAAM,MAAM,KAAK;AAEhD;;AAGF,QACE,cACA,QAAQ,IAAI,sDACD,OAAO,KAAK,sDACZ,MAAM,KAAK,EACtB;AACA,YAAO,yDAAkB,OAAO,MAAM,MAAM,KAAK;AAEjD;;AAGF,QAAI,mBAAmB,QAAQ,eAAe,QAAQ,UAAU;AAC9D,YAAO,iDAAU,OAAO,MAAM,MAAM,KAAK;AAEzC;;AAGF,QAAI,cAAc,QAAQ,SAAS;AACjC,YAAO,oDAAa,OAAO,QAAQ,EAAE,EAAE,MAAM,QAAQ,EAAE,CAAC;AAExD;;AAGF,QAAI,YAAY,QAAQ,OAA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AM,OAAO,CAAC;2DACtB,MAAM,EAAE;AAC1B,WAAQ,aAAa,OAAO,KAAK;AAEjC,4DAAkB,MAAM,CAAE;AAE1B,yDAAe,QAAQ,GAAG,MAAM,OAAO,CAAC;;GAE1C;AAEF,QAAO;;AAGT,SAAgB,gBACd,OACA,MACA;AACA,iCAAqB,aAAa,OAAO,KAAK,EAAE,CAAC,OAAO,KAAK,CAAC"}
@@ -20,11 +20,14 @@ const infiniteScrollAreaStyle = defineComponentSlotStyle({
20
20
  props: { orientation: {
21
21
  horizontal: { root: {
22
22
  flexDirection: "row",
23
- gap: "md"
23
+ gap: "md",
24
+ overflowX: "auto"
24
25
  } },
25
26
  vertical: { root: {
26
27
  flexDirection: "column",
27
- gap: "lg"
28
+ gap: "lg",
29
+ h: "full",
30
+ overflowY: "auto"
28
31
  } }
29
32
  } },
30
33
  defaultProps: { orientation: "vertical" }
@@ -1 +1 @@
1
- {"version":3,"file":"infinite-scroll-area.style.js","names":[],"sources":["../../../../src/components/infinite-scroll-area/infinite-scroll-area.style.ts"],"sourcesContent":["import { defineComponentSlotStyle } from \"../../core\"\n\nexport const infiniteScrollAreaStyle = defineComponentSlotStyle({\n base: {\n root: {\n display: \"flex\",\n flexDirection: \"row\",\n w: \"full\",\n },\n trigger: {\n alignItems: \"center\",\n display: \"flex\",\n flex: 1,\n justifyContent: \"center\",\n w: \"full\",\n },\n },\n\n props: {\n /**\n * The orientation of the infinite scroll.\n *\n * @default 'vertical'\n */\n orientation: {\n horizontal: {\n root: { flexDirection: \"row\", gap: \"md\" },\n },\n vertical: {\n root: { flexDirection: \"column\", gap: \"lg\" },\n },\n },\n },\n\n defaultProps: {\n orientation: \"vertical\",\n },\n})\n\nexport type InfiniteScrollAreaStyle = typeof infiniteScrollAreaStyle\n"],"mappings":";;;;AAEA,MAAa,0BAA0B,yBAAyB;CAC9D,MAAM;EACJ,MAAM;GACJ,SAAS;GACT,eAAe;GACf,GAAG;GACJ;EACD,SAAS;GACP,YAAY;GACZ,SAAS;GACT,MAAM;GACN,gBAAgB;GAChB,GAAG;GACJ;EACF;CAED,OAAO,EAML,aAAa;EACX,YAAY,EACV,MAAM;GAAE,eAAe;GAAO,KAAK;GAAM,EAC1C;EACD,UAAU,EACR,MAAM;GAAE,eAAe;GAAU,KAAK;GAAM,EAC7C;EACF,EACF;CAED,cAAc,EACZ,aAAa,YACd;CACF,CAAC"}
1
+ {"version":3,"file":"infinite-scroll-area.style.js","names":[],"sources":["../../../../src/components/infinite-scroll-area/infinite-scroll-area.style.ts"],"sourcesContent":["import { defineComponentSlotStyle } from \"../../core\"\n\nexport const infiniteScrollAreaStyle = defineComponentSlotStyle({\n base: {\n root: {\n display: \"flex\",\n flexDirection: \"row\",\n w: \"full\",\n },\n trigger: {\n alignItems: \"center\",\n display: \"flex\",\n flex: 1,\n justifyContent: \"center\",\n w: \"full\",\n },\n },\n\n props: {\n /**\n * The orientation of the infinite scroll.\n *\n * @default 'vertical'\n */\n orientation: {\n horizontal: {\n root: { flexDirection: \"row\", gap: \"md\", overflowX: \"auto\" },\n },\n vertical: {\n root: {\n flexDirection: \"column\",\n gap: \"lg\",\n h: \"full\",\n overflowY: \"auto\",\n },\n },\n },\n },\n\n defaultProps: {\n orientation: \"vertical\",\n },\n})\n\nexport type InfiniteScrollAreaStyle = typeof infiniteScrollAreaStyle\n"],"mappings":";;;;AAEA,MAAa,0BAA0B,yBAAyB;CAC9D,MAAM;EACJ,MAAM;GACJ,SAAS;GACT,eAAe;GACf,GAAG;GACJ;EACD,SAAS;GACP,YAAY;GACZ,SAAS;GACT,MAAM;GACN,gBAAgB;GAChB,GAAG;GACJ;EACF;CAED,OAAO,EAML,aAAa;EACX,YAAY,EACV,MAAM;GAAE,eAAe;GAAO,KAAK;GAAM,WAAW;GAAQ,EAC7D;EACD,UAAU,EACR,MAAM;GACJ,eAAe;GACf,KAAK;GACL,GAAG;GACH,WAAW;GACZ,EACF;EACF,EACF;CAED,cAAc,EACZ,aAAa,YACd;CACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"create-component.js","names":["createContext","name","withContext","style"],"sources":["../../../../src/core/components/create-component.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, FunctionComponent } from \"react\"\nimport type { AnyString, Dict, Merge } from \"../../utils\"\nimport type { CSSObject, CSSSlotObject } from \"../css\"\nimport type {\n ComponentSlotStyle,\n ComponentStyle,\n StyledOptions,\n System,\n WithoutThemeProps,\n} from \"../system\"\nimport type {\n As,\n DOMElement,\n HTMLStyledProps,\n Component as OriginalComponent,\n} from \"./index.types\"\nimport { Fragment } from \"react\"\nimport {\n createContext,\n cx,\n isArray,\n isFunction,\n isObject,\n isString,\n runIfFn,\n toArray,\n toCamelCase,\n toPascalCase,\n} from \"../../utils\"\nimport { styled, useSystem } from \"../system\"\nimport { chainProps, mergeProps } from \"./props\"\nimport {\n getSlotClassName,\n mergeSlotCSS,\n useComponentSlotStyle,\n useComponentStyle,\n} from \"./use-component-style\"\nimport { getClassName, getDisplayName } from \"./utils\"\n\ntype AsWithFragment = \"fragment\" | As\ntype ClassName = ((system: System) => string) | string\n\ntype Component<\n Y extends AsWithFragment = AsWithFragment,\n M extends object = {},\n> = Y extends \"fragment\"\n ? FunctionComponent<M>\n : OriginalComponent<Exclude<Y, \"fragment\">, M>\n\nexport type ComponentSlotName<\n Y extends ComponentSlotStyle | ComponentStyle = ComponentSlotStyle,\n> = AnyString | Extract<keyof NonNullable<Y[\"base\"]>, string>\n\nexport type ComponentSlot<Y extends string> =\n | [Y, Y]\n | Y\n | { name: string; slot: [Y, Y] | Y }\n\nexport type InitialProps<Y extends Dict = Dict> =\n | ((props: Y) => any)\n | Partial<Y>\nexport type SuperProps<Y extends Dict = Dict> = ((props: Y) => any) | Y\n\nexport type SuperWithoutThemeProps<\n Y extends Dict = Dict,\n M extends Dict = Dict,\n D extends keyof Y = keyof Y,\n> = ((props: WithoutThemeProps<Y, M, D>) => any) | WithoutThemeProps<Y, M, D>\n\nexport interface UseComponentPropsOptions<\n Y extends number | string | symbol = string,\n> {\n className?: ClassName\n withContext?: boolean\n transferProps?: Y[]\n}\n\nexport interface ComponentOptions extends Omit<StyledOptions, \"transferProps\"> {\n className?: ClassName\n shouldStyleProps?: boolean\n}\n\ninterface classNameOptions<Y extends string = string> {\n className?: ClassName\n slot?: ComponentSlot<Y>\n}\n\nexport interface ComponentWithContextOptions<\n Y extends number | string | symbol = string,\n>\n extends ComponentOptions, UseComponentPropsOptions<Y> {}\n\nfunction createProxyComponent<\n Y extends AsWithFragment = \"div\",\n M extends Dict = Dict,\n>(el: FC<M> | Y, { shouldStyleProps, ...options }: ComponentOptions = {}) {\n options.shouldForwardProp ??= isFunction(el)\n shouldStyleProps ??= !isFunction(el)\n\n if (el === \"fragment\") el = Fragment\n\n if (shouldStyleProps || isString(el)) {\n const ProxyComponent = styled(el as As, options)\n\n ProxyComponent.displayName = \"ProxyComponent\"\n\n return ProxyComponent\n } else {\n el.displayName ??= \"ProxyComponent\"\n\n return el as FC<M>\n }\n}\n\nfunction withDisplayName<\n Y extends AsWithFragment = AsWithFragment,\n M extends object = {},\n>(Component: FC<M>, displayName: string) {\n Object.defineProperty(Component, \"name\", { value: displayName })\n Object.defineProperty(Component, \"displayName\", { value: displayName })\n\n return Component as Component<Y, M>\n}\n\nfunction getSlotKey<Y extends string>(slot?: ComponentSlot<Y>) {\n if (!slot) return \"unknown\"\n\n if (isArray(slot) || !isObject(slot)) {\n return toCamelCase(toArray(slot).join(\"-\"))\n } else {\n return toCamelCase(slot.name)\n }\n}\n\nfunction getSlotName<Y extends string>(slot?: ComponentSlot<Y>) {\n if (!slot) return \"\"\n\n if (isArray(slot)) {\n return slot.map((value) => toPascalCase(value as string)).join(\"\")\n } else if (isObject(slot)) {\n return toPascalCase(slot.name)\n } else {\n return toPascalCase(slot as string)\n }\n}\n\nexport function createComponent<\n Y extends object = {},\n M extends ComponentStyle = Dict,\n D extends Dict = Dict,\n>(name: string, style?: M) {\n const defaultClassName = style?.className\n const defaultDisplayName = getDisplayName(name)\n const [ComponentContext, useComponentContext] = createContext<D>({\n name: `${defaultDisplayName}Context`,\n })\n const [PropsContext, usePropsContext] = createContext<Partial<Y>>({\n name: `${defaultDisplayName}PropsContext`,\n strict: false,\n })\n\n function useClassName(name?: string, className?: ClassName) {\n const system = useSystem()\n\n className = runIfFn(className, system)\n className ??= getClassName(name, defaultClassName)(system)\n\n return className\n }\n\n function useComponentProps<H extends Y = Y, R extends keyof H = keyof H>(\n props: H,\n {\n className,\n withContext = true,\n transferProps,\n }: UseComponentPropsOptions<R> = {},\n ) {\n const system = useSystem()\n\n className = runIfFn(className, system)\n className ??= defaultClassName\n className ??= getClassName(name)(system)\n\n const contextProps = usePropsContext() ?? {}\n const mergedProps = withContext ? mergeProps(contextProps, props)() : props\n const [, rest] = useComponentStyle(mergedProps, {\n name,\n className,\n style,\n transferProps,\n })\n\n return rest\n }\n\n function component<D extends AsWithFragment = \"div\", H extends Dict = Y>(\n el: D | FC<H>,\n { name, className, ...options }: ComponentOptions = {},\n ) {\n const displayName = getDisplayName(name, defaultDisplayName)\n const ProxyComponent = createProxyComponent(el, options)\n\n return function (\n initialProps?: InitialProps<H>,\n ...superProps: SuperProps<H>[]\n ) {\n return withDisplayName<D, H>((props) => {\n className = useClassName(name, className)\n\n const computedProps = isFunction(initialProps)\n ? initialProps(props)\n : mergeProps(initialProps ?? {}, props)()\n const mergedProps = chainProps<any>(...superProps)()(computedProps)\n\n return (\n <ProxyComponent\n {...mergedProps}\n className={cx(className, mergedProps.className)}\n />\n )\n }, displayName)\n }\n }\n\n function withContext<\n D extends AsWithFragment = \"div\",\n H extends Y = Y,\n R extends keyof H = keyof H,\n >(\n el: D | FC<WithoutThemeProps<H, M, R>>,\n {\n name,\n className,\n withContext,\n transferProps,\n ...options\n }: ComponentWithContextOptions<R> = {},\n ) {\n const displayName = getDisplayName(name, defaultDisplayName)\n const ProxyComponent = createProxyComponent(el, options)\n\n return function (\n initialProps?: InitialProps<H>,\n ...superProps: SuperWithoutThemeProps<H, M, R>[]\n ) {\n return withDisplayName<D, H>((props) => {\n className = useClassName(name, className)\n\n const computedProps = isFunction(initialProps)\n ? initialProps(props)\n : mergeProps(initialProps ?? {}, props)()\n const mergedProps = useComponentProps(computedProps, {\n className,\n withContext,\n transferProps,\n })\n const rest = chainProps<any>(...toArray(superProps))()(mergedProps)\n\n return <ProxyComponent {...rest} />\n }, displayName)\n }\n }\n\n return {\n component,\n ComponentContext,\n PropsContext,\n useComponentContext,\n usePropsContext,\n withContext,\n useComponentProps,\n }\n}\n\nexport function createSlotComponent<\n Y extends object = {},\n M extends ComponentSlotStyle = Dict,\n D extends Dict = Dict,\n>(rootName: string, style?: M) {\n const rootClassName = style?.className\n const rootDisplayName = getDisplayName(rootName)\n const classNameMap = new Map<string, classNameOptions>()\n const [StyleContext, useStyleContext] = createContext<\n CSSSlotObject<ComponentSlotName<M>>\n >({\n name: `${rootDisplayName}StyleContext`,\n })\n const [ComponentContext, useComponentContext] = createContext<D>({\n name: `${rootDisplayName}Context`,\n })\n const [PropsContext, usePropsContext] = createContext<Partial<Y>>({\n name: `${rootDisplayName}PropsContext`,\n strict: false,\n })\n\n function useClassName(\n slot?: ComponentSlot<ComponentSlotName<M>>,\n className?: ClassName,\n ) {\n const system = useSystem()\n\n className = runIfFn(className, system)\n className ??= getSlotClassName(\n rootClassName ?? getClassName(rootName)(system),\n slot,\n )\n\n return className\n }\n\n function useClassNames() {\n const system = useSystem()\n const entries = classNameMap.entries().map(([key, { className, slot }]) => {\n className = runIfFn(className, system)\n className ??= getSlotClassName(\n rootClassName ?? getClassName(rootName)(system),\n slot,\n )\n\n return [key, className]\n })\n\n return Object.fromEntries(\n entries.filter(([_, className]) => className),\n ) as { [key: string]: string }\n }\n\n function useRootComponentProps<\n Y extends Dict = Dict,\n R extends keyof Y = keyof Y,\n >(\n props: Y,\n slot?: ComponentSlot<ComponentSlotName<M>>,\n {\n className,\n withContext = true,\n transferProps,\n }: UseComponentPropsOptions<R> = {},\n ): [\n CSSSlotObject,\n Merge<WithoutThemeProps<Y, M, R>, { css?: CSSObject | CSSObject[] }>,\n ] {\n className = useClassName(slot, className)\n\n const contextProps = usePropsContext() ?? {}\n const mergedProps = withContext ? mergeProps(contextProps, props)() : props\n const [css, rest] = useComponentSlotStyle(mergedProps, {\n name: rootName,\n className,\n style,\n slot,\n transferProps,\n })\n\n return [css, rest]\n }\n\n function useSlotComponentProps<Y extends Dict = Dict>(\n props: Y,\n slot?: ComponentSlot<ComponentSlotName<M>>,\n { className }: Omit<UseComponentPropsOptions, \"transferProps\"> = {},\n ) {\n className = useClassName(slot, className)\n\n const style = useStyleContext()\n\n return {\n ...props,\n className: cx(className, props.className),\n css: mergeSlotCSS(slot, style, props.css),\n }\n }\n\n function component<H extends AsWithFragment = \"div\", R extends Dict = Dict>(\n el: FC<R> | H,\n slot?: ComponentSlot<ComponentSlotName<M>>,\n { name, className, ...options }: ComponentOptions = {},\n ) {\n const ProxyComponent = createProxyComponent(el, options)\n const slotKey = getSlotKey(slot)\n const slotName = getSlotName(slot)\n const displayName = getDisplayName(name, `${rootDisplayName}${slotName}`)\n\n classNameMap.set(slotKey, { className, slot })\n\n return function (\n initialProps?: InitialProps<R>,\n ...superProps: SuperProps<R>[]\n ) {\n return withDisplayName<H, R>((props) => {\n className = useClassName(slot, className)\n\n const computedProps = isFunction(initialProps)\n ? initialProps(props)\n : mergeProps(initialProps ?? {}, props)()\n const mergedProps = chainProps(...superProps)()(computedProps)\n\n return (\n <ProxyComponent\n {...mergedProps}\n className={cx(className, mergedProps.className)}\n />\n )\n }, displayName)\n }\n }\n\n function withProvider<\n H extends AsWithFragment = \"div\",\n R extends Y = Y,\n T extends keyof R = keyof R,\n >(\n el: FC<WithoutThemeProps<R, M, T>> | H,\n slot: ComponentSlot<ComponentSlotName<M>> = \"root\" as ComponentSlot<\n ComponentSlotName<M>\n >,\n {\n name,\n className,\n withContext,\n transferProps,\n ...options\n }: ComponentWithContextOptions<T> = {},\n ) {\n const ProxyComponent = createProxyComponent(el, options)\n const slotKey = getSlotKey(slot)\n const slotName = getSlotName(slot)\n const displayName = getDisplayName(name, `${rootDisplayName}${slotName}`)\n\n classNameMap.set(slotKey, { className, slot })\n\n return function (\n initialProps?: InitialProps<R>,\n ...superProps: SuperWithoutThemeProps<R, M, T>[]\n ) {\n return withDisplayName<H, R>((props) => {\n const computedProps = isFunction(initialProps)\n ? initialProps(props)\n : mergeProps(initialProps ?? {}, props)()\n const [context, mergedProps] = useRootComponentProps(\n computedProps,\n slot,\n {\n className,\n withContext,\n transferProps,\n },\n )\n const rest = chainProps<any>(...superProps)()(mergedProps)\n\n return (\n <StyleContext value={context}>\n <ProxyComponent {...rest} />\n </StyleContext>\n )\n }, displayName)\n }\n }\n\n function withContext<\n H extends AsWithFragment = \"div\",\n R extends Dict = H extends DOMElement ? HTMLStyledProps<H> : Dict,\n >(\n el: FC<R> | H,\n slot?: ComponentSlot<ComponentSlotName<M>>,\n {\n name,\n className,\n withContext,\n ...options\n }: Omit<ComponentWithContextOptions, \"transferProps\"> = {},\n ) {\n const ProxyComponent = createProxyComponent(el, options)\n const slotKey = getSlotKey(slot)\n const slotName = getSlotName(slot)\n const displayName = getDisplayName(name, `${rootDisplayName}${slotName}`)\n\n classNameMap.set(slotKey, { className, slot })\n\n return function (\n initialProps?: InitialProps<R>,\n ...superProps: SuperProps<R>[]\n ) {\n return withDisplayName<H, R>((props) => {\n const computedProps = isFunction(initialProps)\n ? initialProps(props)\n : mergeProps(initialProps ?? {}, props)()\n const mergedProps = useSlotComponentProps(computedProps, slot, {\n className,\n withContext,\n })\n const rest = chainProps(...superProps)()(mergedProps)\n\n return <ProxyComponent {...rest} />\n }, displayName)\n }\n }\n\n return {\n component,\n ComponentContext,\n PropsContext,\n StyleContext,\n useClassNames,\n useComponentContext,\n usePropsContext,\n useStyleContext,\n withContext,\n withProvider,\n useRootComponentProps,\n useSlotComponentProps,\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AA8FA,SAAS,qB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AGzC,MACA;KACE;KACA;KACA;KACD,CACF;AAGD,WACE,oBAAC;KAAa,OAAO;eACnB,oBAAC,kBAAe,GAJP,WAAgB,GAAG,WAAW,EAAE,CAAC,YAAY,GAI1B;MACf;MAEhB,YAAY;;;CAInB,SAAS,YAIP,IACA,MACA,EACE,MACA,WACA,4BACA,GAAG,YACmD,EAAE,EAC1D;EACA,MAAM,iBAAiB,qBAAqB,IAAI,QAAQ;EACxD,MAAM,UAAU,WAAW,KAAK;EAEhC,MAAM,cAAc,eAAe,MAAM,GAAG,kBAD3B,YAAY,KAAK,GACuC;AAEzE,eAAa,IAAI,SAAS;GAAE;GAAW;GAAM,CAAC;AAE9C,SAAO,SACL,cACA,GAAG,YACH;AACA,UAAO,iBAAuB,UAAU;IAItC,MAAM,cAAc,oDAHa,aAAa,GAC1C,aAAa,MAAM,GACnB,WAAW,gBAAgB,EAAE,EAAE,MAAM,EAAE,EACc,MAAM;KAC7D;KACA;KACD,CAAC;AAGF,WAAO,oBAAC,kBAAe,GAFV,WAAW,GAAG,WAAW,EAAE,CAAC,YAAY,GAElB;MAClC,YAAY;;;AAInB,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
1
+ {"version":3,"file":"create-component.js","names":["createContext","name","withContext","style"],"sources":["../../../../src/core/components/create-component.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, FunctionComponent } from \"react\"\nimport type { AnyString, Dict, Merge } from \"../../utils\"\nimport type { CSSObject, CSSSlotObject } from \"../css\"\nimport type {\n ComponentSlotStyle,\n ComponentStyle,\n StyledOptions,\n System,\n WithoutThemeProps,\n} from \"../system\"\nimport type {\n As,\n DOMElement,\n HTMLStyledProps,\n Component as OriginalComponent,\n} from \"./index.types\"\nimport { Fragment } from \"react\"\nimport {\n createContext,\n cx,\n isArray,\n isFunction,\n isObject,\n isString,\n runIfFn,\n toArray,\n toCamelCase,\n toPascalCase,\n} from \"../../utils\"\nimport { styled, useSystem } from \"../system\"\nimport { chainProps, mergeProps } from \"./props\"\nimport {\n getSlotClassName,\n mergeSlotCSS,\n useComponentSlotStyle,\n useComponentStyle,\n} from \"./use-component-style\"\nimport { getClassName, getDisplayName } from \"./utils\"\n\ntype AsWithFragment = \"fragment\" | As\ntype ClassName = ((system: System) => string) | string\n\ntype Component<\n Y extends AsWithFragment = AsWithFragment,\n M extends object = {},\n> = Y extends \"fragment\"\n ? FunctionComponent<M>\n : OriginalComponent<Exclude<Y, \"fragment\">, M>\n\nexport type ComponentSlotName<\n Y extends ComponentSlotStyle | ComponentStyle = ComponentSlotStyle,\n> = AnyString | Extract<keyof NonNullable<Y[\"base\"]>, string>\n\nexport type ComponentSlot<Y extends string> =\n | [Y, Y]\n | Y\n | { name: string; slot: [Y, Y] | Y }\n\nexport type InitialProps<Y extends Dict = Dict> =\n | ((props: Y) => any)\n | Partial<Y>\nexport type SuperProps<Y extends Dict = Dict> = ((props: Y) => any) | Y\n\nexport type SuperWithoutThemeProps<\n Y extends Dict = Dict,\n M extends Dict = Dict,\n D extends keyof Y = keyof Y,\n> = ((props: WithoutThemeProps<Y, M, D>) => any) | WithoutThemeProps<Y, M, D>\n\nexport interface UseComponentPropsOptions<\n Y extends number | string | symbol = string,\n> {\n className?: ClassName\n withContext?: boolean\n transferProps?: Y[]\n}\n\nexport interface ComponentOptions extends Omit<StyledOptions, \"transferProps\"> {\n className?: ClassName\n shouldStyleProps?: boolean\n}\n\ninterface classNameOptions<Y extends string = string> {\n className?: ClassName\n slot?: ComponentSlot<Y>\n}\n\nexport interface ComponentWithContextOptions<\n Y extends number | string | symbol = string,\n>\n extends ComponentOptions, UseComponentPropsOptions<Y> {}\n\nfunction createProxyComponent<\n Y extends AsWithFragment = \"div\",\n M extends Dict = Dict,\n>(el: FC<M> | Y, { shouldStyleProps, ...options }: ComponentOptions = {}) {\n options.shouldForwardProp ??= isFunction(el)\n shouldStyleProps ??= !isFunction(el)\n\n if (el === \"fragment\") el = Fragment\n\n if (shouldStyleProps || isString(el)) {\n const ProxyComponent = styled(el as As, options)\n\n ProxyComponent.displayName = \"ProxyComponent\"\n\n return ProxyComponent\n } else {\n el.displayName ??= \"ProxyComponent\"\n\n return el as FC<M>\n }\n}\n\nfunction withDisplayName<\n Y extends AsWithFragment = AsWithFragment,\n M extends object = {},\n>(Component: FC<M>, displayName: string) {\n Object.defineProperty(Component, \"name\", { value: displayName })\n Object.defineProperty(Component, \"displayName\", { value: displayName })\n\n return Component as Component<Y, M>\n}\n\nfunction getSlotKey<Y extends string>(slot?: ComponentSlot<Y>) {\n if (!slot) return \"unknown\"\n\n if (isArray(slot) || !isObject(slot)) {\n return toCamelCase(toArray(slot).join(\"-\"))\n } else {\n return toCamelCase(slot.name)\n }\n}\n\nfunction getSlotName<Y extends string>(slot?: ComponentSlot<Y>) {\n if (!slot) return \"\"\n\n if (isArray(slot)) {\n return slot.map((value) => toPascalCase(value as string)).join(\"\")\n } else if (isObject(slot)) {\n return toPascalCase(slot.name)\n } else {\n return toPascalCase(slot as string)\n }\n}\n\nexport function createComponent<\n Y extends object = {},\n M extends ComponentStyle = Dict,\n D extends Dict = Dict,\n>(name: string, style?: M) {\n const defaultClassName = style?.className\n const defaultDisplayName = getDisplayName(name)\n const [ComponentContext, useComponentContext] = createContext<D>({\n name: `${defaultDisplayName}Context`,\n })\n const [PropsContext, usePropsContext] = createContext<Partial<Y>>({\n name: `${defaultDisplayName}PropsContext`,\n strict: false,\n })\n\n function useClassName(name?: string, className?: ClassName) {\n const system = useSystem()\n\n className = runIfFn(className, system)\n className ??= getClassName(name, defaultClassName)(system)\n\n return className\n }\n\n function useComponentProps<H extends Y = Y, R extends keyof H = keyof H>(\n props: H,\n {\n className,\n withContext = true,\n transferProps,\n }: UseComponentPropsOptions<R> = {},\n ) {\n const system = useSystem()\n\n className = runIfFn(className, system)\n className ??= defaultClassName\n className ??= getClassName(name)(system)\n\n const contextProps = usePropsContext() ?? {}\n const mergedProps = withContext\n ? (mergeProps(contextProps, props)() as H)\n : props\n const [, rest] = useComponentStyle(mergedProps, {\n name,\n className,\n style,\n transferProps,\n })\n\n return rest\n }\n\n function component<D extends AsWithFragment = \"div\", H extends Dict = Y>(\n el: D | FC<H>,\n { name, className, ...options }: ComponentOptions = {},\n ) {\n const displayName = getDisplayName(name, defaultDisplayName)\n const ProxyComponent = createProxyComponent(el, options)\n\n return function (\n initialProps?: InitialProps<H>,\n ...superProps: SuperProps<H>[]\n ) {\n return withDisplayName<D, H>((props) => {\n className = useClassName(name, className)\n\n const computedProps = isFunction(initialProps)\n ? initialProps(props)\n : mergeProps(initialProps ?? {}, props)()\n const mergedProps = chainProps<any>(...superProps)()(computedProps)\n\n return (\n <ProxyComponent\n {...mergedProps}\n className={cx(className, mergedProps.className)}\n />\n )\n }, displayName)\n }\n }\n\n function withContext<\n D extends AsWithFragment = \"div\",\n H extends Y = Y,\n R extends keyof H = keyof H,\n >(\n el: D | FC<WithoutThemeProps<H, M, R>>,\n {\n name,\n className,\n withContext,\n transferProps,\n ...options\n }: ComponentWithContextOptions<R> = {},\n ) {\n const displayName = getDisplayName(name, defaultDisplayName)\n const ProxyComponent = createProxyComponent(el, options)\n\n return function (\n initialProps?: InitialProps<H>,\n ...superProps: SuperWithoutThemeProps<H, M, R>[]\n ) {\n return withDisplayName<D, H>((props) => {\n className = useClassName(name, className)\n\n const computedProps = isFunction(initialProps)\n ? initialProps(props)\n : mergeProps(initialProps ?? {}, props)()\n const mergedProps = useComponentProps(computedProps, {\n className,\n withContext,\n transferProps,\n })\n const rest = chainProps<any>(...toArray(superProps))()(mergedProps)\n\n return <ProxyComponent {...rest} />\n }, displayName)\n }\n }\n\n return {\n component,\n ComponentContext,\n PropsContext,\n useComponentContext,\n usePropsContext,\n withContext,\n useComponentProps,\n }\n}\n\nexport function createSlotComponent<\n Y extends object = {},\n M extends ComponentSlotStyle = Dict,\n D extends Dict = Dict,\n>(rootName: string, style?: M) {\n const rootClassName = style?.className\n const rootDisplayName = getDisplayName(rootName)\n const classNameMap = new Map<string, classNameOptions>()\n const [StyleContext, useStyleContext] = createContext<\n CSSSlotObject<ComponentSlotName<M>>\n >({\n name: `${rootDisplayName}StyleContext`,\n })\n const [ComponentContext, useComponentContext] = createContext<D>({\n name: `${rootDisplayName}Context`,\n })\n const [PropsContext, usePropsContext] = createContext<Partial<Y>>({\n name: `${rootDisplayName}PropsContext`,\n strict: false,\n })\n\n function useClassName(\n slot?: ComponentSlot<ComponentSlotName<M>>,\n className?: ClassName,\n ) {\n const system = useSystem()\n\n className = runIfFn(className, system)\n className ??= getSlotClassName(\n rootClassName ?? getClassName(rootName)(system),\n slot,\n )\n\n return className\n }\n\n function useClassNames() {\n const system = useSystem()\n const entries = classNameMap.entries().map(([key, { className, slot }]) => {\n className = runIfFn(className, system)\n className ??= getSlotClassName(\n rootClassName ?? getClassName(rootName)(system),\n slot,\n )\n\n return [key, className]\n })\n\n return Object.fromEntries(\n entries.filter(([_, className]) => className),\n ) as { [key: string]: string }\n }\n\n function useRootComponentProps<\n Y extends Dict = {},\n R extends keyof Y = keyof Y,\n >(\n props: Y,\n slot?: ComponentSlot<ComponentSlotName<M>>,\n {\n className,\n withContext = true,\n transferProps,\n }: UseComponentPropsOptions<R> = {},\n ): [\n CSSSlotObject,\n Merge<WithoutThemeProps<Y, M, R>, { css?: CSSObject | CSSObject[] }>,\n ] {\n className = useClassName(slot, className)\n\n const contextProps = usePropsContext() ?? {}\n const mergedProps = withContext\n ? (mergeProps(contextProps, props)() as Y)\n : props\n const [css, rest] = useComponentSlotStyle(mergedProps, {\n name: rootName,\n className,\n style,\n slot,\n transferProps,\n })\n\n return [css, rest]\n }\n\n function useSlotComponentProps<Y extends Dict = {}>(\n props: Y,\n slot?: ComponentSlot<ComponentSlotName<M>>,\n { className }: Omit<UseComponentPropsOptions, \"transferProps\"> = {},\n ) {\n className = useClassName(slot, className)\n\n const style = useStyleContext()\n\n return {\n ...props,\n className: cx(className, props.className),\n css: mergeSlotCSS(slot, style, props.css),\n }\n }\n\n function component<H extends AsWithFragment = \"div\", R extends Dict = Dict>(\n el: FC<R> | H,\n slot?: ComponentSlot<ComponentSlotName<M>>,\n { name, className, ...options }: ComponentOptions = {},\n ) {\n const ProxyComponent = createProxyComponent(el, options)\n const slotKey = getSlotKey(slot)\n const slotName = getSlotName(slot)\n const displayName = getDisplayName(name, `${rootDisplayName}${slotName}`)\n\n classNameMap.set(slotKey, { className, slot })\n\n return function (\n initialProps?: InitialProps<R>,\n ...superProps: SuperProps<R>[]\n ) {\n return withDisplayName<H, R>((props) => {\n className = useClassName(slot, className)\n\n const computedProps = isFunction(initialProps)\n ? initialProps(props)\n : mergeProps(initialProps ?? {}, props)()\n const mergedProps = chainProps(...superProps)()(computedProps)\n\n return (\n <ProxyComponent\n {...mergedProps}\n className={cx(className, mergedProps.className)}\n />\n )\n }, displayName)\n }\n }\n\n function withProvider<\n H extends AsWithFragment = \"div\",\n R extends Y = Y,\n T extends keyof R = keyof R,\n >(\n el: FC<WithoutThemeProps<R, M, T>> | H,\n slot: ComponentSlot<ComponentSlotName<M>> = \"root\" as ComponentSlot<\n ComponentSlotName<M>\n >,\n {\n name,\n className,\n withContext,\n transferProps,\n ...options\n }: ComponentWithContextOptions<T> = {},\n ) {\n const ProxyComponent = createProxyComponent(el, options)\n const slotKey = getSlotKey(slot)\n const slotName = getSlotName(slot)\n const displayName = getDisplayName(name, `${rootDisplayName}${slotName}`)\n\n classNameMap.set(slotKey, { className, slot })\n\n return function (\n initialProps?: InitialProps<R>,\n ...superProps: SuperWithoutThemeProps<R, M, T>[]\n ) {\n return withDisplayName<H, R>((props) => {\n const computedProps = isFunction(initialProps)\n ? initialProps(props)\n : mergeProps(initialProps ?? {}, props)()\n const [context, mergedProps] = useRootComponentProps(\n computedProps,\n slot,\n {\n className,\n withContext,\n transferProps,\n },\n )\n const rest = chainProps<any>(...superProps)()(mergedProps)\n\n return (\n <StyleContext value={context}>\n <ProxyComponent {...rest} />\n </StyleContext>\n )\n }, displayName)\n }\n }\n\n function withContext<\n H extends AsWithFragment = \"div\",\n R extends Dict = H extends DOMElement ? HTMLStyledProps<H> : Dict,\n >(\n el: FC<R> | H,\n slot?: ComponentSlot<ComponentSlotName<M>>,\n {\n name,\n className,\n withContext,\n ...options\n }: Omit<ComponentWithContextOptions, \"transferProps\"> = {},\n ) {\n const ProxyComponent = createProxyComponent(el, options)\n const slotKey = getSlotKey(slot)\n const slotName = getSlotName(slot)\n const displayName = getDisplayName(name, `${rootDisplayName}${slotName}`)\n\n classNameMap.set(slotKey, { className, slot })\n\n return function (\n initialProps?: InitialProps<R>,\n ...superProps: SuperProps<R>[]\n ) {\n return withDisplayName<H, R>((props) => {\n const computedProps = isFunction(initialProps)\n ? initialProps(props)\n : mergeProps(initialProps ?? {}, props)()\n const mergedProps = useSlotComponentProps(computedProps, slot, {\n className,\n withContext,\n })\n const rest = chainProps(...superProps)()(mergedProps)\n\n return <ProxyComponent {...rest} />\n }, displayName)\n }\n }\n\n return {\n component,\n ComponentContext,\n PropsContext,\n StyleContext,\n useClassNames,\n useComponentContext,\n usePropsContext,\n useStyleContext,\n withContext,\n withProvider,\n useRootComponentProps,\n useSlotComponentProps,\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AA8FA,SAAS,qBAGP,IAAe,EAAE,kBAAkB,GAAG,YAA8B,EAAE,EAAE;AACxE,SAAQ,oDAAiC,GAAG;AAC5C,sBAAqB,+BAAY,GAAG;AAEpC,KAAI,OAAO,WAAY,MAAK;AAE5B,KAAI,gDAA6B,GAAG,EAAE;EACpC,MAAM,iBAAiB,OAAO,IAAU,QAAQ;AAEhD,iBAAe,cAAc;AAE7B,SAAO;QACF;AACL,KAAG,gBAAgB;AAEnB,SAAO;;;AAIX,SAAS,gBAGP,WAAkB,aAAqB;AACvC,QAAO,eAAe,WAAW,QAAQ,EAAE,OAAO,aAAa,CAAC;AAChE,QAAO,eAAe,WAAW,eAAe,EAAE,OAAO,aAAa,CAAC;AAEvE,QAAO;;AAGT,SAAS,WAA6B,M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AAuB,UAAU;IAItC,MAAM,cAAc,oDAHa,aAAa,GAC1C,aAAa,MAAM,GACnB,WAAW,gBAAgB,EAAE,EAAE,MAAM,EAAE,EACc,MAAM;KAC7D;KACA;KACD,CAAC;AAGF,WAAO,oBAAC,kBAAe,GAFV,WAAW,GAAG,WAAW,EAAE,CAAC,YAAY,GAElB;MAClC,YAAY;;;AAInB,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
@@ -22,6 +22,7 @@ function mergeProps(...args) {
22
22
  return function({ mergeClassName = true, mergeCSS = true, mergeEvent = true, mergeRef = true, mergeStyle = true } = {}) {
23
23
  let result = {};
24
24
  for (const props of args) {
25
+ if ((0, utils_exports.isUndefined)(props)) continue;
25
26
  for (const key in result) {
26
27
  if (mergeRef && key === "ref") {
27
28
  result[key] = mergeRefs(result[key], props[key]);
@@ -1 +1 @@
1
- {"version":3,"file":"props.js","names":["result: Dict"],"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 } from \"../css\"\n\ntype MergeAll<Y extends Dict[]> = Y extends [infer M]\n ? M\n : Y extends [infer D, ...infer H]\n ? H extends any[]\n ? Merge<D, MergeAll<H>>\n : 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])\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[]>(...args: Y) {\n return function ({\n mergeClassName = true,\n mergeCSS = true,\n mergeEvent = true,\n mergeRef = true,\n mergeStyle = true,\n }: MergePropsOptions = {}): MergeAll<Y> {\n let result: Dict = {}\n\n for (const props of args) {\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\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":";;;;;;;;;AA0BA,SAAS,QAAQ,KAAa;AAC5B,QAAO,WAAW,KAAK,IAAI;;AAG7B,MAAa,WAAW,IAAI,IAAY,CACtC,GAAG,qBACH,GAAG,gBACJ,CAAC;AAIF,SAAgB,wBACd,eAAyB,EAAE,EACR;AACnB,QAAO,SAAU,MAAuB;AACtC,MAAI,aAAa,SAAS,KAAK,CAAE,QAAO;AAExC,MAAI,KAAK,WAAW,KAAK,CAAE,QAAO;AAElC,SAAO,CAAC,SAAS,IAAI,KAAK;;;AAY9B,SAAgB,WAA6B,GAAG,MAAS;AACvD,QAAO,SAAU,EACf,iBAAiB,MACjB,WAAW,MACX,aAAa,MACb,WAAW,MACX,aAAa,SACQ,EAAE,EAAe;EACtC,IAAIA,SAAe,EAAE;AAErB,OAAK,MAAM,SAAS,MAAM;AACxB,QAAK,MAAM,OAAO,QAAQ;AACxB,QAAI,YAAY,QAAQ,OAAO;AAC7B,YAAO,OAAO,U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SAAgB,aAId,GAAM,GAAM,WAAgB,EAAE,EAAE;AAChC,QAAO,sCACM,GAAG,SAAwB,gCAC3B,GAAG,SAAwB,CACvC;;AAGH,SAAgB,cACd,OACA,MACA;AACA,QAAO,6CAAgC,OAAO,KAAK,EAAE,CAAC,OAAO,KAAK,CAAC;;AAGrE,SAAgB,aAAa,OAAa,MAAoC;CAC5E,IAAIA,SAAe,EAAE;AAErB,QAAO,QAAQ,MAAM,CAAC,SAAS,CAAC,KAAK,WAAW;AAC9C,MAAI,CAAC,SAAS,IAAI,IAAI,CAAE;AAExB,MAAI,KAAK,SAAS,IAAI,CACpB,mCAAe,QAAQ,GAAG,MAAM,OAAO,CAAC;uCACtB,MAAM,EAAE;AAC1B,WAAQ,aAAa,OAAO,KAAK;AAEjC,wCAAkB,MAAM,CAAE;AAE1B,qCAAe,QAAQ,GAAG,MAAM,OAAO,CAAC;;GAE1C;AAEF,QAAO;;AAGT,SAAgB,gBACd,OACA,MACA;AACA,QAAO,cAAc,aAAa,OAAO,KAAK,EAAE,CAAC,OAAO,KAAK,CAAC"}
1
+ {"version":3,"file":"props.js","names":["result: Dict"],"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 } 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])\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\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;AAC5B,QAAO,WAAW,KAAK,IAAI;;AAG7B,MAAa,WAAW,IAAI,IAAY,CACtC,GAAG,qBACH,GAAG,gBACJ,CAAC;AAIF,SAAgB,wBACd,eAAyB,EAAE,EACR;AACnB,QAAO,SAAU,MAAuB;AACtC,MAAI,aAAa,SAAS,KAA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,QAAO,SAAU,GAAM;GACrB,MAAM,IAAI,MAAM,MAAM,EAAE;AAGxB,wCAFqB,EAAE,GAAG,EAAE,EAAE,GAAG,WAAW,GAAG,EAAE,CAAC,QAAQ;;AAK9D,SAAO,MAAM,OAAO,SAAU,GAAG,GAAG;AAClC,UAAO,SAAU,IAAO,EAAE,EAAO;IAC/B,MAAM,kCAAe,EAAE,GAAG,EAAE,EAAE,GAAG,WAAW,GAAG,EAAE,CAAC,QAAQ;AAG1D,yCAFqB,EAAE,GAAG,EAAE,EAAE,GAAG,WAAW,GAAG,EAAE,CAAC,QAAQ;;IAI5D;;;AAIN,SAAgB,aAId,GAAM,GAAM,WAAgB,EAAE,EAAE;AAChC,QAAO,sCACM,GAAG,SAAwB,gCAC3B,GAAG,SAAwB,CACvC;;AAGH,SAAgB,cACd,OACA,MACA;AACA,QAAO,6CAAgC,OAAO,KAAK,EAAE,CAAC,OAAO,KAAK,CAAC;;AAGrE,SAAgB,aAAa,OAAa,MAAoC;CAC5E,IAAIA,SAAe,EAAE;AAErB,QAAO,QAAQ,MAAM,CAAC,SAAS,CAAC,KAAK,WAAW;AAC9C,MAAI,CAAC,SAAS,IAAI,IAAI,CAAE;AAExB,MAAI,KAAK,SAAS,IAAI,CACpB,mCAAe,QAAQ,GAAG,MAAM,OAAO,CAAC;uCACtB,MAAM,EAAE;AAC1B,WAAQ,aAAa,OAAO,KAAK;AAEjC,wCAAkB,MAAM,CAAE;AAE1B,qCAAe,QAAQ,GAAG,MAAM,OAAO,CAAC;;GAE1C;AAEF,QAAO;;AAGT,SAAgB,gBACd,OACA,MACA;AACA,QAAO,cAAc,aAAa,OAAO,KAAK,EAAE,CAAC,OAAO,KAAK,CAAC"}
@@ -9,7 +9,7 @@ import "../collapse/index.js";
9
9
  import "../../index.js";
10
10
  import { AccordionStyle } from "./accordion.style.js";
11
11
  import { UseAccordionItemProps, UseAccordionProps } from "./use-accordion.js";
12
- import * as react1046 from "react";
12
+ import * as react138 from "react";
13
13
 
14
14
  //#region src/components/accordion/accordion.d.ts
15
15
  interface AccordionCallBackProps {
@@ -33,7 +33,7 @@ interface AccordionRootProps extends Omit<HTMLStyledProps, "onChange">, ThemePro
33
33
  */
34
34
  items?: AccordionItem[];
35
35
  }
36
- declare const AccordionPropsContext: react1046.Context<Partial<AccordionRootProps> | undefined>, useAccordionPropsContext: () => Partial<AccordionRootProps> | undefined;
36
+ declare const AccordionPropsContext: react138.Context<Partial<AccordionRootProps> | undefined>, useAccordionPropsContext: () => Partial<AccordionRootProps> | undefined;
37
37
  /**
38
38
  * `Accordion` is a component for a list that displays information in an expandable or collapsible manner.
39
39
  *
@@ -2,10 +2,10 @@ import { HTMLProps, PropGetter } from "../../core/components/index.types.js";
2
2
  import "../../core/index.js";
3
3
  import { Descendant } from "../../hooks/use-descendants/index.js";
4
4
  import "../../index.js";
5
- import * as react1034 from "react";
5
+ import * as react126 from "react";
6
6
 
7
7
  //#region src/components/accordion/use-accordion.d.ts
8
- declare const AccordionDescendantsContext: react1034.Context<{
8
+ declare const AccordionDescendantsContext: react126.Context<{
9
9
  active: (target?: HTMLButtonElement | Descendant<HTMLButtonElement, {}> | null | undefined, options?: FocusOptions) => void;
10
10
  count: (props?: Partial<{}> | undefined) => number;
11
11
  destroy: () => void;
@@ -24,7 +24,7 @@ declare const AccordionDescendantsContext: react1034.Context<{
24
24
  prevValue: (indexOrNode: number | HTMLButtonElement | Descendant<HTMLButtonElement, {}> | null, loop?: boolean, props?: Partial<{}> | undefined) => Descendant<HTMLButtonElement, {}> | undefined;
25
25
  register: (props?: {
26
26
  disabled?: boolean | ((node: HTMLButtonElement) => boolean) | undefined;
27
- } | undefined) => react1034.RefCallback<HTMLButtonElement>;
27
+ } | undefined) => react126.RefCallback<HTMLButtonElement>;
28
28
  unregister: (node?: HTMLButtonElement | null | undefined) => void;
29
29
  value: (indexOrNode: number | HTMLButtonElement | null) => Descendant<HTMLButtonElement, {}> | undefined;
30
30
  values: (props?: Partial<{}> | undefined) => Descendant<HTMLButtonElement, {}>[];
@@ -50,12 +50,12 @@ declare const AccordionDescendantsContext: react1034.Context<{
50
50
  prevValue: (indexOrNode: number | HTMLButtonElement | Descendant<HTMLButtonElement, {}> | null, loop?: boolean, props?: Partial<{}> | undefined) => Descendant<HTMLButtonElement, {}> | undefined;
51
51
  register: (props?: {
52
52
  disabled?: boolean | ((node: HTMLButtonElement) => boolean) | undefined;
53
- } | undefined) => react1034.RefCallback<HTMLButtonElement>;
53
+ } | undefined) => react126.RefCallback<HTMLButtonElement>;
54
54
  unregister: (node?: HTMLButtonElement | null | undefined) => void;
55
55
  value: (indexOrNode: number | HTMLButtonElement | null) => Descendant<HTMLButtonElement, {}> | undefined;
56
56
  values: (props?: Partial<{}> | undefined) => Descendant<HTMLButtonElement, {}>[];
57
57
  };
58
- register: react1034.RefCallback<HTMLButtonElement>;
58
+ register: react126.RefCallback<HTMLButtonElement>;
59
59
  }, useAccordionDescendants: () => {
60
60
  active: (target?: HTMLButtonElement | Descendant<HTMLButtonElement, {}> | null | undefined, options?: FocusOptions) => void;
61
61
  count: (props?: Partial<{}> | undefined) => number;
@@ -75,15 +75,15 @@ declare const AccordionDescendantsContext: react1034.Context<{
75
75
  prevValue: (indexOrNode: number | HTMLButtonElement | Descendant<HTMLButtonElement, {}> | null, loop?: boolean, props?: Partial<{}> | undefined) => Descendant<HTMLButtonElement, {}> | undefined;
76
76
  register: (props?: {
77
77
  disabled?: boolean | ((node: HTMLButtonElement) => boolean) | undefined;
78
- } | undefined) => react1034.RefCallback<HTMLButtonElement>;
78
+ } | undefined) => react126.RefCallback<HTMLButtonElement>;
79
79
  unregister: (node?: HTMLButtonElement | null | undefined) => void;
80
80
  value: (indexOrNode: number | HTMLButtonElement | null) => Descendant<HTMLButtonElement, {}> | undefined;
81
81
  values: (props?: Partial<{}> | undefined) => Descendant<HTMLButtonElement, {}>[];
82
82
  };
83
83
  interface AccordionContext extends Omit<UseAccordionReturn, "descendants" | "getRootProps"> {}
84
- declare const AccordionContext: react1034.Context<AccordionContext>, useAccordionContext: () => AccordionContext;
84
+ declare const AccordionContext: react126.Context<AccordionContext>, useAccordionContext: () => AccordionContext;
85
85
  interface AccordionItemContext extends Omit<UseAccordionItemReturn, "getItemProps"> {}
86
- declare const AccordionItemContext: react1034.Context<AccordionItemContext>, useAccordionItemContext: () => AccordionItemContext;
86
+ declare const AccordionItemContext: react126.Context<AccordionItemContext>, useAccordionItemContext: () => AccordionItemContext;
87
87
  interface UseAccordionProps extends Omit<HTMLProps, "onChange"> {
88
88
  /**
89
89
  * The initial index(es) of the accordion item to expand.
@@ -137,7 +137,7 @@ declare const useAccordion: ({
137
137
  prevValue: (indexOrNode: number | HTMLButtonElement | Descendant<HTMLButtonElement, {}> | null, loop?: boolean, props?: Partial<{}> | undefined) => Descendant<HTMLButtonElement, {}> | undefined;
138
138
  register: (props?: {
139
139
  disabled?: boolean | ((node: HTMLButtonElement) => boolean) | undefined;
140
- } | undefined) => react1034.RefCallback<HTMLButtonElement>;
140
+ } | undefined) => react126.RefCallback<HTMLButtonElement>;
141
141
  unregister: (node?: HTMLButtonElement | null | undefined) => void;
142
142
  value: (indexOrNode: number | HTMLButtonElement | null) => Descendant<HTMLButtonElement, {}> | undefined;
143
143
  values: (props?: Partial<{}> | undefined) => Descendant<HTMLButtonElement, {}>[];
@@ -145,8 +145,8 @@ declare const useAccordion: ({
145
145
  focusedIndex: number;
146
146
  index: number | number[];
147
147
  multiple: boolean | undefined;
148
- setFocusedIndex: react1034.Dispatch<react1034.SetStateAction<number>>;
149
- setIndex: react1034.Dispatch<react1034.SetStateAction<number | number[]>>;
148
+ setFocusedIndex: react126.Dispatch<react126.SetStateAction<number>>;
149
+ setIndex: react126.Dispatch<react126.SetStateAction<number | number[]>>;
150
150
  toggle: boolean | undefined;
151
151
  getRootProps: PropGetter<"div", undefined, undefined>;
152
152
  };
@@ -5,7 +5,7 @@ import { AiryStyle } from "./airy.style.js";
5
5
  import { HTMLMotionProps } from "../motion/index.types.js";
6
6
  import "../motion/index.js";
7
7
  import "../../index.js";
8
- import * as react892 from "react";
8
+ import * as react125 from "react";
9
9
  import { ReactNode } from "react";
10
10
 
11
11
  //#region src/components/airy/airy.d.ts
@@ -57,7 +57,7 @@ interface AiryProps extends Omit<HTMLMotionProps<"button">, "onChange">, ThemePr
57
57
  */
58
58
  onChange?: (value: KeyframeIdent) => void;
59
59
  }
60
- declare const AiryPropsContext: react892.Context<Partial<AiryProps> | undefined>, useAiryPropsContext: () => Partial<AiryProps> | undefined;
60
+ declare const AiryPropsContext: react125.Context<Partial<AiryProps> | undefined>, useAiryPropsContext: () => Partial<AiryProps> | undefined;
61
61
  /**
62
62
  * `Airy` is a component that creates an airy animation, switching between two elements when one is clicked.
63
63
  *
@@ -9,7 +9,7 @@ import "../loading/index.js";
9
9
  import { StatusScheme } from "../status/status.js";
10
10
  import "../status/index.js";
11
11
  import "../../index.js";
12
- import * as react1033 from "react";
12
+ import * as react124 from "react";
13
13
 
14
14
  //#region src/components/alert/alert.d.ts
15
15
  interface AlertRootProps extends HTMLStyledProps, ThemeProps<AlertStyle> {
@@ -20,7 +20,7 @@ interface AlertRootProps extends HTMLStyledProps, ThemeProps<AlertStyle> {
20
20
  */
21
21
  status?: StatusScheme;
22
22
  }
23
- declare const AlertPropsContext: react1033.Context<Partial<AlertRootProps> | undefined>, useAlertPropsContext: () => Partial<AlertRootProps> | undefined;
23
+ declare const AlertPropsContext: react124.Context<Partial<AlertRootProps> | undefined>, useAlertPropsContext: () => Partial<AlertRootProps> | undefined;
24
24
  /**
25
25
  * `Alert` is a component that conveys information to the user.
26
26
  *
@@ -5,7 +5,7 @@ import { AlphaSliderStyle } from "./alpha-slider.style.js";
5
5
  import { HueSliderOverlayProps, HueSliderRootProps, HueSliderThumbProps, HueSliderTrackProps } from "../hue-slider/hue-slider.js";
6
6
  import "../hue-slider/index.js";
7
7
  import "../../index.js";
8
- import * as react1032 from "react";
8
+ import * as react123 from "react";
9
9
 
10
10
  //#region src/components/alpha-slider/alpha-slider.d.ts
11
11
  interface AlphaSliderRootProps extends WithoutThemeProps<Omit<HueSliderRootProps, "color" | "max" | "step" | "thumbProps" | "trackProps">, AlphaSliderStyle> {
@@ -38,7 +38,7 @@ interface AlphaSliderRootProps extends WithoutThemeProps<Omit<HueSliderRootProps
38
38
  */
39
39
  trackProps?: AlphaSliderTrackProps;
40
40
  }
41
- declare const AlphaSliderPropsContext: react1032.Context<Partial<AlphaSliderRootProps> | undefined>, useAlphaSliderPropsContext: () => Partial<AlphaSliderRootProps> | undefined;
41
+ declare const AlphaSliderPropsContext: react123.Context<Partial<AlphaSliderRootProps> | undefined>, useAlphaSliderPropsContext: () => Partial<AlphaSliderRootProps> | undefined;
42
42
  /**
43
43
  * `AlphaSlider` is a component used to allow the user to select color transparency.
44
44
  *
@@ -2,7 +2,7 @@ import { StyleValue } from "../../core/css/index.types.js";
2
2
  import { Component, HTMLStyledProps } from "../../core/components/index.types.js";
3
3
  import "../../core/index.js";
4
4
  import "../../index.js";
5
- import * as react1031 from "react";
5
+ import * as react1028 from "react";
6
6
 
7
7
  //#region src/components/aspect-ratio/aspect-ratio.d.ts
8
8
  interface AspectRatioProps extends HTMLStyledProps {
@@ -13,7 +13,7 @@ interface AspectRatioProps extends HTMLStyledProps {
13
13
  */
14
14
  ratio?: StyleValue<number>;
15
15
  }
16
- declare const AspectRatioPropsContext: react1031.Context<Partial<AspectRatioProps> | undefined>, useAspectRatioPropsContext: () => Partial<AspectRatioProps> | undefined;
16
+ declare const AspectRatioPropsContext: react1028.Context<Partial<AspectRatioProps> | undefined>, useAspectRatioPropsContext: () => Partial<AspectRatioProps> | undefined;
17
17
  /**
18
18
  * `AspectRatio` is a component for embedding things like videos and maps while maintaining the aspect ratio.
19
19
  *
@@ -3,7 +3,7 @@ import { CSSPropObject, CSSSlotObject } from "../../core/css/index.types.js";
3
3
  import "../../index.js";
4
4
 
5
5
  //#region src/components/autocomplete/autocomplete.style.d.ts
6
- declare const autocompleteStyle: ComponentSlotStyle<"input" | "label" | "option" | "content" | "group" | "separator" | "icon" | "root" | "indicator" | "field" | "valueText" | "empty", CSSPropObject<CSSSlotObject<"input" | "label" | "option" | "content" | "group" | "separator" | "icon" | "root" | "indicator" | "field" | "valueText" | "empty">>, {
6
+ declare const autocompleteStyle: ComponentSlotStyle<"input" | "label" | "option" | "content" | "group" | "separator" | "icon" | "root" | "indicator" | "field" | "empty" | "valueText", CSSPropObject<CSSSlotObject<"input" | "label" | "option" | "content" | "group" | "separator" | "icon" | "root" | "indicator" | "field" | "empty" | "valueText">>, {
7
7
  xs: {
8
8
  empty: {
9
9
  gap: "1.5";
@@ -8,7 +8,7 @@ import { UsePopoverProps } from "../popover/use-popover.js";
8
8
  import "../popover/index.js";
9
9
  import { ComboboxDescendant, ComboboxDescendantProps, ComboboxItem, ComboboxItemWithValue, UseComboboxItemProps, UseComboboxProps } from "../../hooks/use-combobox/index.js";
10
10
  import "../../index.js";
11
- import * as react1024 from "react";
11
+ import * as react1022 from "react";
12
12
  import { ChangeEvent, ReactNode } from "react";
13
13
 
14
14
  //#region src/components/autocomplete/use-autocomplete.d.ts
@@ -28,7 +28,7 @@ interface AutocompleteFilter {
28
28
  }
29
29
  type AutocompleteMatcher = typeof index_d_exports.match;
30
30
  interface AutocompleteContext extends Pick<UseAutocompleteReturn, "max" | "value"> {}
31
- declare const AutocompleteContext: react1024.Context<AutocompleteContext>, useAutocompleteContext: () => AutocompleteContext;
31
+ declare const AutocompleteContext: react1022.Context<AutocompleteContext>, useAutocompleteContext: () => AutocompleteContext;
32
32
  interface UseAutocompleteProps<Multiple extends boolean = false> extends Omit<HTMLProps, "defaultValue" | "onChange" | "ref" | "value">, Omit<UseComboboxProps, "defaultValue" | "initialFocusValue" | "onChange" | "ref" | "value">, HTMLRefAttributes<"input">, FieldProps {
33
33
  /**
34
34
  * If `true`, the autocomplete will allow custom value.
@@ -156,7 +156,7 @@ declare const useAutocomplete: <Multiple extends boolean = false>(props?: UseAut
156
156
  lastValue: (props?: Partial<ComboboxDescendantProps> | undefined) => Descendant<HTMLDivElement, ComboboxDescendantProps> | undefined;
157
157
  nextValue: (indexOrNode: number | HTMLDivElement | Descendant<HTMLDivElement, ComboboxDescendantProps> | null, loop?: boolean, props?: Partial<ComboboxDescendantProps> | undefined) => Descendant<HTMLDivElement, ComboboxDescendantProps> | undefined;
158
158
  prevValue: (indexOrNode: number | HTMLDivElement | Descendant<HTMLDivElement, ComboboxDescendantProps> | null, loop?: boolean, props?: Partial<ComboboxDescendantProps> | undefined) => Descendant<HTMLDivElement, ComboboxDescendantProps> | undefined;
159
- register: (props?: DescendantProps<HTMLDivElement, ComboboxDescendantProps> | undefined) => react1024.RefCallback<HTMLDivElement>;
159
+ register: (props?: DescendantProps<HTMLDivElement, ComboboxDescendantProps> | undefined) => react1022.RefCallback<HTMLDivElement>;
160
160
  unregister: (node?: HTMLDivElement | null | undefined) => void;
161
161
  value: (indexOrNode: number | HTMLDivElement | null) => Descendant<HTMLDivElement, ComboboxDescendantProps> | undefined;
162
162
  values: (props?: Partial<ComboboxDescendantProps> | undefined) => Descendant<HTMLDivElement, ComboboxDescendantProps>[];
@@ -166,8 +166,8 @@ declare const useAutocomplete: <Multiple extends boolean = false>(props?: UseAut
166
166
  items: ComboboxItem[];
167
167
  max: number | undefined;
168
168
  open: boolean;
169
- setInputValue: react1024.Dispatch<react1024.SetStateAction<string>>;
170
- setValue: react1024.Dispatch<react1024.SetStateAction<Multiple extends true ? string[] : string>>;
169
+ setInputValue: react1022.Dispatch<react1022.SetStateAction<string>>;
170
+ setValue: react1022.Dispatch<react1022.SetStateAction<Multiple extends true ? string[] : string>>;
171
171
  value: Multiple extends true ? string[] : string;
172
172
  valueMap: {
173
173
  [key: string]: ComboboxItemWithValue;