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

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 (85) hide show
  1. package/dist/cjs/components/accordion/accordion.cjs +4 -3
  2. package/dist/cjs/components/accordion/accordion.cjs.map +1 -1
  3. package/dist/cjs/components/aspect-ratio/aspect-ratio.cjs +2 -2
  4. package/dist/cjs/components/aspect-ratio/aspect-ratio.cjs.map +1 -1
  5. package/dist/cjs/components/button/button.cjs +11 -8
  6. package/dist/cjs/components/button/button.cjs.map +1 -1
  7. package/dist/cjs/components/code/code.style.cjs +2 -1
  8. package/dist/cjs/components/code/code.style.cjs.map +1 -1
  9. package/dist/cjs/components/field/field.cjs +4 -3
  10. package/dist/cjs/components/field/field.cjs.map +1 -1
  11. package/dist/cjs/components/kbd/kbd.style.cjs +2 -1
  12. package/dist/cjs/components/kbd/kbd.style.cjs.map +1 -1
  13. package/dist/cjs/components/list/list.cjs +5 -3
  14. package/dist/cjs/components/list/list.cjs.map +1 -1
  15. package/dist/cjs/components/native-accordion/native-accordion.cjs +4 -3
  16. package/dist/cjs/components/native-accordion/native-accordion.cjs.map +1 -1
  17. package/dist/cjs/components/sidebar/sidebar.cjs +4 -3
  18. package/dist/cjs/components/sidebar/sidebar.cjs.map +1 -1
  19. package/dist/cjs/components/slot/slot.cjs +10 -9
  20. package/dist/cjs/components/slot/slot.cjs.map +1 -1
  21. package/dist/cjs/components/tree/tree.cjs +5 -3
  22. package/dist/cjs/components/tree/tree.cjs.map +1 -1
  23. package/dist/cjs/index.cjs +4 -0
  24. package/dist/cjs/utils/children.cjs +22 -9
  25. package/dist/cjs/utils/children.cjs.map +1 -1
  26. package/dist/cjs/utils/index.cjs +4 -0
  27. package/dist/esm/components/accordion/accordion.js +5 -4
  28. package/dist/esm/components/accordion/accordion.js.map +1 -1
  29. package/dist/esm/components/aspect-ratio/aspect-ratio.js +2 -2
  30. package/dist/esm/components/aspect-ratio/aspect-ratio.js.map +1 -1
  31. package/dist/esm/components/button/button.js +11 -8
  32. package/dist/esm/components/button/button.js.map +1 -1
  33. package/dist/esm/components/code/code.style.js +2 -1
  34. package/dist/esm/components/code/code.style.js.map +1 -1
  35. package/dist/esm/components/field/field.js +5 -4
  36. package/dist/esm/components/field/field.js.map +1 -1
  37. package/dist/esm/components/kbd/kbd.style.js +2 -1
  38. package/dist/esm/components/kbd/kbd.style.js.map +1 -1
  39. package/dist/esm/components/list/list.js +5 -3
  40. package/dist/esm/components/list/list.js.map +1 -1
  41. package/dist/esm/components/native-accordion/native-accordion.js +5 -4
  42. package/dist/esm/components/native-accordion/native-accordion.js.map +1 -1
  43. package/dist/esm/components/sidebar/sidebar.js +5 -4
  44. package/dist/esm/components/sidebar/sidebar.js.map +1 -1
  45. package/dist/esm/components/slot/slot.js +11 -10
  46. package/dist/esm/components/slot/slot.js.map +1 -1
  47. package/dist/esm/components/tree/tree.js +5 -3
  48. package/dist/esm/components/tree/tree.js.map +1 -1
  49. package/dist/esm/index.js +4 -2
  50. package/dist/esm/utils/children.js +22 -11
  51. package/dist/esm/utils/children.js.map +1 -1
  52. package/dist/esm/utils/index.js +4 -2
  53. package/dist/types/components/accordion/accordion.style.d.ts +1 -1
  54. package/dist/types/components/alert/alert.style.d.ts +1 -1
  55. package/dist/types/components/autocomplete/autocomplete.style.d.ts +1 -1
  56. package/dist/types/components/breadcrumb/breadcrumb.style.d.ts +1 -1
  57. package/dist/types/components/calendar/calendar.style.d.ts +2 -2
  58. package/dist/types/components/carousel/carousel.style.d.ts +2 -2
  59. package/dist/types/components/chart/cartesian-chart.style.d.ts +1 -1
  60. package/dist/types/components/chart/polar-chart.style.d.ts +1 -1
  61. package/dist/types/components/date-picker/date-picker.style.d.ts +1 -1
  62. package/dist/types/components/dropzone/dropzone.d.ts +1 -1
  63. package/dist/types/components/dropzone/dropzone.style.d.ts +1 -1
  64. package/dist/types/components/field/use-field-props.d.ts +1 -1
  65. package/dist/types/components/file-button/use-file-button.d.ts +2 -2
  66. package/dist/types/components/file-input/use-file-input.d.ts +2 -2
  67. package/dist/types/components/menu/menu.style.d.ts +2 -2
  68. package/dist/types/components/native-accordion/native-accordion.style.d.ts +2 -2
  69. package/dist/types/components/progress/use-progress.d.ts +6 -6
  70. package/dist/types/components/rating/rating.style.d.ts +2 -2
  71. package/dist/types/components/segmented-control/segmented-control.style.d.ts +2 -2
  72. package/dist/types/components/select/select.style.d.ts +1 -1
  73. package/dist/types/components/stat/stat.style.d.ts +2 -2
  74. package/dist/types/components/steps/steps.style.d.ts +1 -1
  75. package/dist/types/components/tabs/tabs.style.d.ts +1 -1
  76. package/dist/types/components/timeline/timeline.d.ts +1 -1
  77. package/dist/types/components/timeline/timeline.style.d.ts +1 -1
  78. package/dist/types/components/tree/tree.style.d.ts +1 -1
  79. package/dist/types/components/tree/use-tree.d.ts +4 -4
  80. package/dist/types/hooks/use-clickable/index.d.ts +2 -2
  81. package/dist/types/index.d.ts +3 -3
  82. package/dist/types/providers/i18n-provider/i18n-provider.d.ts +1 -1
  83. package/dist/types/utils/children.d.ts +11 -2
  84. package/dist/types/utils/index.d.ts +3 -3
  85. package/package.json +2 -2
@@ -121,11 +121,12 @@ const AccordionIcon = withContext(({ children = /* @__PURE__ */ (0, react_jsx_ru
121
121
  const { iconHidden } = useComponentContext();
122
122
  const { getIconProps } = require_use_accordion.useAccordionItemContext();
123
123
  if (iconHidden) return null;
124
- if ((0, react.isValidElement)(children)) return (0, react.cloneElement)(children, getIconProps({
124
+ const child = require_children.getResolvedChild(children);
125
+ if ((0, react.isValidElement)(child)) return (0, react.cloneElement)(child, getIconProps({
125
126
  ...rest,
126
- ...children.props
127
+ ...child.props
127
128
  }));
128
- return react.Children.count(children) > 1 ? react.Children.only(null) : null;
129
+ return react.Children.count(child) > 1 ? react.Children.only(null) : null;
129
130
  }, "icon")();
130
131
  const AccordionPanel = withContext(({ animationOpacity, children, delay, duration, endingHeight, startingHeight, transition, transitionEnd, unmountOnExit, ...rest }) => {
131
132
  const { open, getPanelProps } = require_use_accordion.useAccordionItemContext();
@@ -1 +1 @@
1
- {"version":3,"file":"accordion.cjs","names":["createContext","createSlotComponent","accordionStyle","useAccordion","useMemo","AccordionDescendantsContext","AccordionContext","styled","useAccordionItem","useSplitChildren","AccordionItemContext","useAccordionItemContext","ChevronDownIcon","isValidElement","cloneElement","Children","Collapse"],"sources":["../../../../src/components/accordion/accordion.tsx"],"sourcesContent":["\"use client\"\n\nimport type { HTMLProps, HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { ReactNodeOrFunction } from \"../../utils\"\nimport type { CollapseProps } from \"../collapse\"\nimport type { WithTransitionProps } from \"../motion\"\nimport type { AccordionStyle } from \"./accordion.style\"\nimport type { UseAccordionItemProps, UseAccordionProps } from \"./use-accordion\"\nimport { Children, cloneElement, isValidElement, useMemo } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { createContext, isString, runIfFn, useSplitChildren } from \"../../utils\"\nimport { Collapse } from \"../collapse\"\nimport { ChevronDownIcon } from \"../icon\"\nimport { accordionStyle } from \"./accordion.style\"\nimport {\n AccordionContext,\n AccordionDescendantsContext,\n AccordionItemContext,\n useAccordion,\n useAccordionItem,\n useAccordionItemContext,\n} from \"./use-accordion\"\n\ninterface AccordionCallBackProps {\n disabled?: boolean\n expanded?: boolean\n}\n\nexport interface AccordionItem extends Omit<AccordionItemProps, \"index\"> {}\n\ninterface ComponentContext extends Pick<\n AccordionRootProps,\n \"icon\" | \"iconHidden\"\n> {}\n\nexport interface AccordionRootProps\n extends\n Omit<HTMLStyledProps, \"onChange\">,\n ThemeProps<AccordionStyle>,\n UseAccordionProps {\n /**\n * The accordion icon for all items to use.\n */\n icon?: ReactNodeOrFunction<AccordionCallBackProps>\n /**\n * If `true`, hide the accordion icon for all items.\n *\n * @default false\n */\n iconHidden?: boolean\n /**\n * If provided, generate elements based on items.\n */\n items?: AccordionItem[]\n}\n\ninterface ItemComponentContext extends Pick<AccordionItemProps, \"icon\"> {}\n\nconst [ItemComponentContext, useItemComponentContext] =\n createContext<ItemComponentContext>({\n name: \"ItemComponentContext\",\n })\n\nconst {\n ComponentContext,\n PropsContext: AccordionPropsContext,\n useComponentContext,\n usePropsContext: useAccordionPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<AccordionRootProps, AccordionStyle, ComponentContext>(\n \"accordion\",\n accordionStyle,\n)\n\nexport { AccordionPropsContext, useAccordionPropsContext }\n\n/**\n * `Accordion` is a component for a list that displays information in an expandable or collapsible manner.\n *\n * @see https://yamada-ui.com/docs/components/accordion\n */\nexport const AccordionRoot = withProvider<\"div\", AccordionRootProps>(\n ({ children, icon, iconHidden, items, ...props }) => {\n const {\n descendants,\n focusedIndex,\n index,\n multiple,\n setFocusedIndex,\n setIndex,\n toggle,\n getRootProps,\n } = useAccordion(props)\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return items?.map((props, index) => (\n <AccordionItem key={index} index={index} {...props} />\n ))\n }, [children, items])\n const context = useMemo(\n () => ({\n focusedIndex,\n index,\n multiple,\n setFocusedIndex,\n setIndex,\n toggle,\n }),\n [focusedIndex, index, multiple, setFocusedIndex, setIndex, toggle],\n )\n const componentContext = useMemo(\n () => ({ icon, iconHidden }),\n [icon, iconHidden],\n )\n\n return (\n <AccordionDescendantsContext value={descendants}>\n <AccordionContext value={context}>\n <ComponentContext value={componentContext}>\n <styled.div {...getRootProps()}>{computedChildren}</styled.div>\n </ComponentContext>\n </AccordionContext>\n </AccordionDescendantsContext>\n )\n },\n \"root\",\n)()\n\nexport interface AccordionItemProps\n extends\n Omit<HTMLStyledProps, \"children\">,\n Omit<UseAccordionItemProps, \"children\"> {\n /**\n * The accordion button to use.\n */\n button?: ReactNodeOrFunction<AccordionCallBackProps>\n /**\n * The accordion children to use.\n */\n children?: ReactNodeOrFunction<AccordionCallBackProps>\n /**\n * The accordion icon to use.\n */\n icon?: ReactNodeOrFunction<AccordionCallBackProps>\n}\n\nexport const AccordionItem = withContext<\"div\", AccordionItemProps>(\n ({ button, children, icon, ...rest }) => {\n const {\n disabled,\n open,\n getButtonProps,\n getIconProps,\n getItemProps,\n getPanelProps,\n } = useAccordionItem(rest)\n const computedChildren = useMemo(\n () => runIfFn(children, { disabled, expanded: open }),\n [children, disabled, open],\n )\n const [omittedChildren, customAccordionButton, customAccordionPanel] =\n useSplitChildren(computedChildren, AccordionButton, AccordionPanel)\n const context = useMemo(\n () => ({\n disabled,\n icon,\n open,\n getButtonProps,\n getIconProps,\n getPanelProps,\n }),\n [disabled, getButtonProps, getPanelProps, getIconProps, icon, open],\n )\n const componentContext = useMemo(() => ({ icon }), [icon])\n\n return (\n <AccordionItemContext value={context}>\n <ItemComponentContext value={componentContext}>\n <styled.div {...getItemProps()}>\n {customAccordionButton ?? (\n <AccordionButton>\n {runIfFn(button, { disabled, expanded: open })}\n </AccordionButton>\n )}\n {customAccordionPanel ?? (\n <AccordionPanel>{omittedChildren}</AccordionPanel>\n )}\n </styled.div>\n </ItemComponentContext>\n </AccordionItemContext>\n )\n },\n \"item\",\n)()\n\nexport interface AccordionButtonProps extends HTMLStyledProps<\"button\"> {\n /**\n * The accordion icon to use.\n */\n icon?: ReactNodeOrFunction<AccordionCallBackProps>\n /**\n * Props the container element.\n */\n containerProps?: HTMLStyledProps\n}\n\nexport const AccordionButton = withContext<\"button\", AccordionButtonProps>(\n ({ children, icon: customIcon, containerProps, ...rest }) => {\n const { icon: rootIcon } = useComponentContext()\n const { icon: itemIcon } = useItemComponentContext()\n const { disabled, open, getButtonProps } = useAccordionItemContext()\n const props = { disabled, expanded: open }\n\n return (\n <styled.h3 {...containerProps}>\n <styled.button {...getButtonProps(rest)}>\n {children}\n\n <AccordionIcon>\n {runIfFn(customIcon, props) ??\n runIfFn(itemIcon, props) ??\n runIfFn(rootIcon, props)}\n </AccordionIcon>\n </styled.button>\n </styled.h3>\n )\n },\n \"button\",\n)()\n\ninterface AccordionIconProps extends HTMLStyledProps<\"svg\"> {}\n\nexport const AccordionIcon = withContext<\"svg\", AccordionIconProps>(\n ({ children = <ChevronDownIcon />, ...rest }) => {\n const { iconHidden } = useComponentContext()\n const { getIconProps } = useAccordionItemContext()\n\n if (iconHidden) return null\n\n if (isValidElement<HTMLProps<\"svg\">>(children))\n return cloneElement(\n children,\n getIconProps({\n ...rest,\n ...children.props,\n }),\n )\n\n return Children.count(children) > 1 ? Children.only(null) : null\n },\n \"icon\",\n)()\n\nexport interface AccordionPanelProps\n extends\n Omit<HTMLStyledProps, \"transition\">,\n Pick<\n CollapseProps,\n | \"animationOpacity\"\n | \"endingHeight\"\n | \"startingHeight\"\n | keyof WithTransitionProps\n > {}\n\nexport const AccordionPanel = withContext<\"div\", AccordionPanelProps>(\n ({\n animationOpacity,\n children,\n delay,\n duration,\n endingHeight,\n startingHeight,\n transition,\n transitionEnd,\n unmountOnExit,\n ...rest\n }) => {\n const { open, getPanelProps } = useAccordionItemContext()\n\n return (\n <Collapse\n {...{\n animationOpacity,\n delay,\n duration,\n endingHeight,\n open,\n startingHeight,\n transition,\n transitionEnd,\n unmountOnExit,\n }}\n >\n <styled.div {...getPanelProps(rest)}>\n {isString(children) ? <styled.p>{children}</styled.p> : children}\n </styled.div>\n </Collapse>\n )\n },\n \"panel\",\n)()\n"],"mappings":";;;;;;;;;;;;;AA0DA,MAAM,CAAC,sBAAsB,2BAC3BA,gBAAAA,cAAoC,EAClC,MAAM,uBACR,CAAC;AAEH,MAAM,EACJ,kBACA,cAAc,uBACd,qBACA,iBAAiB,0BACjB,aACA,iBACEC,yBAAAA,oBACF,aACAC,wBAAAA,cACF;;;;;;AASA,MAAa,gBAAgB,cAC1B,EAAE,UAAU,MAAM,YAAY,OAAO,GAAG,YAAY;CACnD,MAAM,EACJ,aACA,cACA,OACA,UACA,iBACA,UACA,QACA,iBACEC,sBAAAA,aAAa,KAAK;CACtB,MAAM,oBAAA,GAAmBC,MAAAA,QAAAA,OAAc;EACrC,IAAI,UAAU,OAAO;EAErB,OAAO,OA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AA,oBAAA,cACvB,QAAA,CAAQ,UAAU,KAAK,EACZ,CAAA,CACF;;CACN,CAAA;AAEf,GACA,QACF,CAAC,CAAC;AAIF,MAAa,gBAAgB,aAC1B,EAAE,WAAW,iBAAA,GAAA,kBAAA,IAAA,CAACK,0BAAAA,iBAAD,CAAkB,CAAA,GAAG,GAAG,WAAW;CAC/C,MAAM,EAAE,eAAe,oBAAoB;CAC3C,MAAM,EAAE,iBAAiBD,sBAAAA,wBAAwB;CAEjD,IAAI,YAAY,OAAO;CAEvB,KAAA,GAAIE,MAAAA,eAAAA,CAAiC,QAAQ,GAC3C,QAAA,GAAOC,MAAAA,aAAAA,CACL,UACA,aAAa;EACX,GAAG;EACH,GAAG,SAAS;CACd,CAAC,CACH;CAEF,OAAOC,MAAAA,SAAS,MAAM,QAAQ,IAAI,IAAIA,MAAAA,SAAS,KAAK,IAAI,IAAI;AAC9D,GACA,MACF,CAAC,CAAC;AAaF,MAAa,iBAAiB,aAC3B,EACC,kBACA,UACA,OACA,UACA,cACA,gBACA,YACA,eACA,eACA,GAAG,WACC;CACJ,MAAM,EAAE,MAAM,kBAAkBJ,sBAAAA,wBAAwB;CAExD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACK,iBAAAA,UAAD;EAEI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAGF,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACT,gBAAAA,OAAO,KAAR;GAAY,GAAI,cAAc,IAAI;GAC/B,WAAA,GAAA,oBAAA,cAAA,SAAA,CAAS,QAAQ,IAAI,iBAAA,GAAA,kBAAA,IAAA,CAACA,gBAAAA,OAAO,GAAR,EAAW,SAAmB,CAAA,IAAI;EAC9C,CAAA;CACJ,CAAA;AAEd,GACA,OACF,CAAC,CAAC"}
1
+ {"version":3,"file":"accordion.cjs","names":["createContext","createSlotComponent","accordionStyle","useAccordion","useMemo","AccordionDescendantsContext","AccordionContext","styled","useAccordionItem","useSplitChildren","AccordionItemContext","useAccordionItemContext","ChevronDownIcon","getResolvedChild","isValidElement","cloneElement","Children","Collapse"],"sources":["../../../../src/components/accordion/accordion.tsx"],"sourcesContent":["\"use client\"\n\nimport type { HTMLProps, HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { ReactNodeOrFunction } from \"../../utils\"\nimport type { CollapseProps } from \"../collapse\"\nimport type { WithTransitionProps } from \"../motion\"\nimport type { AccordionStyle } from \"./accordion.style\"\nimport type { UseAccordionItemProps, UseAccordionProps } from \"./use-accordion\"\nimport { Children, cloneElement, isValidElement, useMemo } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport {\n createContext,\n getResolvedChild,\n isString,\n runIfFn,\n useSplitChildren,\n} from \"../../utils\"\nimport { Collapse } from \"../collapse\"\nimport { ChevronDownIcon } from \"../icon\"\nimport { accordionStyle } from \"./accordion.style\"\nimport {\n AccordionContext,\n AccordionDescendantsContext,\n AccordionItemContext,\n useAccordion,\n useAccordionItem,\n useAccordionItemContext,\n} from \"./use-accordion\"\n\ninterface AccordionCallBackProps {\n disabled?: boolean\n expanded?: boolean\n}\n\nexport interface AccordionItem extends Omit<AccordionItemProps, \"index\"> {}\n\ninterface ComponentContext extends Pick<\n AccordionRootProps,\n \"icon\" | \"iconHidden\"\n> {}\n\nexport interface AccordionRootProps\n extends\n Omit<HTMLStyledProps, \"onChange\">,\n ThemeProps<AccordionStyle>,\n UseAccordionProps {\n /**\n * The accordion icon for all items to use.\n */\n icon?: ReactNodeOrFunction<AccordionCallBackProps>\n /**\n * If `true`, hide the accordion icon for all items.\n *\n * @default false\n */\n iconHidden?: boolean\n /**\n * If provided, generate elements based on items.\n */\n items?: AccordionItem[]\n}\n\ninterface ItemComponentContext extends Pick<AccordionItemProps, \"icon\"> {}\n\nconst [ItemComponentContext, useItemComponentContext] =\n createContext<ItemComponentContext>({\n name: \"ItemComponentContext\",\n })\n\nconst {\n ComponentContext,\n PropsContext: AccordionPropsContext,\n useComponentContext,\n usePropsContext: useAccordionPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<AccordionRootProps, AccordionStyle, ComponentContext>(\n \"accordion\",\n accordionStyle,\n)\n\nexport { AccordionPropsContext, useAccordionPropsContext }\n\n/**\n * `Accordion` is a component for a list that displays information in an expandable or collapsible manner.\n *\n * @see https://yamada-ui.com/docs/components/accordion\n */\nexport const AccordionRoot = withProvider<\"div\", AccordionRootProps>(\n ({ children, icon, iconHidden, items, ...props }) => {\n const {\n descendants,\n focusedIndex,\n index,\n multiple,\n setFocusedIndex,\n setIndex,\n toggle,\n getRootProps,\n } = useAccordion(props)\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return items?.map((props, index) => (\n <AccordionItem key={index} index={index} {...props} />\n ))\n }, [children, items])\n const context = useMemo(\n () => ({\n focusedIndex,\n index,\n multiple,\n setFocusedIndex,\n setIndex,\n toggle,\n }),\n [focusedIndex, index, multiple, setFocusedIndex, setIndex, toggle],\n )\n const componentContext = useMemo(\n () => ({ icon, iconHidden }),\n [icon, iconHidden],\n )\n\n return (\n <AccordionDescendantsContext value={descendants}>\n <AccordionContext value={context}>\n <ComponentContext value={componentContext}>\n <styled.div {...getRootProps()}>{computedChildren}</styled.div>\n </ComponentContext>\n </AccordionContext>\n </AccordionDescendantsContext>\n )\n },\n \"root\",\n)()\n\nexport interface AccordionItemProps\n extends\n Omit<HTMLStyledProps, \"children\">,\n Omit<UseAccordionItemProps, \"children\"> {\n /**\n * The accordion button to use.\n */\n button?: ReactNodeOrFunction<AccordionCallBackProps>\n /**\n * The accordion children to use.\n */\n children?: ReactNodeOrFunction<AccordionCallBackProps>\n /**\n * The accordion icon to use.\n */\n icon?: ReactNodeOrFunction<AccordionCallBackProps>\n}\n\nexport const AccordionItem = withContext<\"div\", AccordionItemProps>(\n ({ button, children, icon, ...rest }) => {\n const {\n disabled,\n open,\n getButtonProps,\n getIconProps,\n getItemProps,\n getPanelProps,\n } = useAccordionItem(rest)\n const computedChildren = useMemo(\n () => runIfFn(children, { disabled, expanded: open }),\n [children, disabled, open],\n )\n const [omittedChildren, customAccordionButton, customAccordionPanel] =\n useSplitChildren(computedChildren, AccordionButton, AccordionPanel)\n const context = useMemo(\n () => ({\n disabled,\n icon,\n open,\n getButtonProps,\n getIconProps,\n getPanelProps,\n }),\n [disabled, getButtonProps, getPanelProps, getIconProps, icon, open],\n )\n const componentContext = useMemo(() => ({ icon }), [icon])\n\n return (\n <AccordionItemContext value={context}>\n <ItemComponentContext value={componentContext}>\n <styled.div {...getItemProps()}>\n {customAccordionButton ?? (\n <AccordionButton>\n {runIfFn(button, { disabled, expanded: open })}\n </AccordionButton>\n )}\n {customAccordionPanel ?? (\n <AccordionPanel>{omittedChildren}</AccordionPanel>\n )}\n </styled.div>\n </ItemComponentContext>\n </AccordionItemContext>\n )\n },\n \"item\",\n)()\n\nexport interface AccordionButtonProps extends HTMLStyledProps<\"button\"> {\n /**\n * The accordion icon to use.\n */\n icon?: ReactNodeOrFunction<AccordionCallBackProps>\n /**\n * Props the container element.\n */\n containerProps?: HTMLStyledProps\n}\n\nexport const AccordionButton = withContext<\"button\", AccordionButtonProps>(\n ({ children, icon: customIcon, containerProps, ...rest }) => {\n const { icon: rootIcon } = useComponentContext()\n const { icon: itemIcon } = useItemComponentContext()\n const { disabled, open, getButtonProps } = useAccordionItemContext()\n const props = { disabled, expanded: open }\n\n return (\n <styled.h3 {...containerProps}>\n <styled.button {...getButtonProps(rest)}>\n {children}\n\n <AccordionIcon>\n {runIfFn(customIcon, props) ??\n runIfFn(itemIcon, props) ??\n runIfFn(rootIcon, props)}\n </AccordionIcon>\n </styled.button>\n </styled.h3>\n )\n },\n \"button\",\n)()\n\ninterface AccordionIconProps extends HTMLStyledProps<\"svg\"> {}\n\nexport const AccordionIcon = withContext<\"svg\", AccordionIconProps>(\n ({ children = <ChevronDownIcon />, ...rest }) => {\n const { iconHidden } = useComponentContext()\n const { getIconProps } = useAccordionItemContext()\n\n if (iconHidden) return null\n\n const child = getResolvedChild(children)\n\n if (isValidElement<HTMLProps<\"svg\">>(child))\n return cloneElement(child, getIconProps({ ...rest, ...child.props }))\n\n return Children.count(child) > 1 ? Children.only(null) : null\n },\n \"icon\",\n)()\n\nexport interface AccordionPanelProps\n extends\n Omit<HTMLStyledProps, \"transition\">,\n Pick<\n CollapseProps,\n | \"animationOpacity\"\n | \"endingHeight\"\n | \"startingHeight\"\n | keyof WithTransitionProps\n > {}\n\nexport const AccordionPanel = withContext<\"div\", AccordionPanelProps>(\n ({\n animationOpacity,\n children,\n delay,\n duration,\n endingHeight,\n startingHeight,\n transition,\n transitionEnd,\n unmountOnExit,\n ...rest\n }) => {\n const { open, getPanelProps } = useAccordionItemContext()\n\n return (\n <Collapse\n {...{\n animationOpacity,\n delay,\n duration,\n endingHeight,\n open,\n startingHeight,\n transition,\n transitionEnd,\n unmountOnExit,\n }}\n >\n <styled.div {...getPanelProps(rest)}>\n {isString(children) ? <styled.p>{children}</styled.p> : children}\n </styled.div>\n </Collapse>\n )\n },\n \"panel\",\n)()\n"],"mappings":";;;;;;;;;;;;;AAgEA,MAAM,CAAC,sBAAsB,2BAC3BA,gBAAAA,cAAoC,EAClC,MAAM,uBACR,CAAC;AAEH,MAAM,EACJ,kBACA,cAAc,uBACd,qBACA,iBAAiB,0BACjB,aACA,iBACEC,yBAAAA,oBACF,aACAC,wBAAAA,cACF;;;;;;AASA,MAAa,gBAAgB,cAC1B,EAAE,UAAU,MAAM,YAAY,OAAO,GAAG,YAAY;CACnD,MAAM,EACJ,aACA,cACA,OACA,UACA,iBACA,UACA,QACA,iBACEC,sBAAAA,aAAa,KAAK;CACtB,MAAM,oBAAA,GAAmBC,MAAAA,QAAAA,OAAc;EACrC,IAAI,UAAU,OAAO;EAErB,OAAO,OAAO,KAAK,OAAO,UACxB,iBAAA,GAAA,kBAAA,IAAA,CAAC,eAAD;GAAkC;GAAO,GAAI;EAAQ,GAAjC,KAAiC,CACtD;CACH,GAAG,CAAC,UAAU,KAAK,CAAC;CACpB,MAAM,WAAA,GAAUA,MAAAA,Q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AA,iBAAD,CAAkB,CAAA,GAAG,GAAG,WAAW;CAC/C,MAAM,EAAE,eAAe,oBAAoB;CAC3C,MAAM,EAAE,iBAAiBD,sBAAAA,wBAAwB;CAEjD,IAAI,YAAY,OAAO;CAEvB,MAAM,QAAQE,iBAAAA,iBAAiB,QAAQ;CAEvC,KAAA,GAAIC,MAAAA,eAAAA,CAAiC,KAAK,GACxC,QAAA,GAAOC,MAAAA,aAAAA,CAAa,OAAO,aAAa;EAAE,GAAG;EAAM,GAAG,MAAM;CAAM,CAAC,CAAC;CAEtE,OAAOC,MAAAA,SAAS,MAAM,KAAK,IAAI,IAAIA,MAAAA,SAAS,KAAK,IAAI,IAAI;AAC3D,GACA,MACF,CAAC,CAAC;AAaF,MAAa,iBAAiB,aAC3B,EACC,kBACA,UACA,OACA,UACA,cACA,gBACA,YACA,eACA,eACA,GAAG,WACC;CACJ,MAAM,EAAE,MAAM,kBAAkBL,sBAAAA,wBAAwB;CAExD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACM,iBAAAA,UAAD;EAEI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAGF,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACV,gBAAAA,OAAO,KAAR;GAAY,GAAI,cAAc,IAAI;GAC/B,WAAA,GAAA,oBAAA,cAAA,SAAA,CAAS,QAAQ,IAAI,iBAAA,GAAA,kBAAA,IAAA,CAACA,gBAAAA,OAAO,GAAR,EAAW,SAAmB,CAAA,IAAI;EAC9C,CAAA;CACJ,CAAA;AAEd,GACA,OACF,CAAC,CAAC"}
@@ -1,4 +1,5 @@
1
1
  "use client";
2
+ const require_children = require("../../utils/children.cjs");
2
3
  const require_utils_index = require("../../utils/index.cjs");
3
4
  const require_create_component = require("../../core/components/create-component.cjs");
4
5
  const require_aspect_ratio_style = require("./aspect-ratio.style.cjs");
@@ -11,10 +12,9 @@ const { PropsContext: AspectRatioPropsContext, usePropsContext: useAspectRatioPr
11
12
  * @see https://yamada-ui.com/docs/components/aspect-ratio
12
13
  */
13
14
  const AspectRatio = withContext("div")(void 0, ({ children, ratio = 4 / 3, ...rest }) => {
14
- const child = react.Children.only(children);
15
15
  return {
16
16
  ...rest,
17
- children: child,
17
+ children: react.Children.only(require_children.getResolvedChild(children)),
18
18
  _before: {
19
19
  display: "block",
20
20
  h: 0,
@@ -1 +1 @@
1
- {"version":3,"file":"aspect-ratio.cjs","names":["createComponent","aspectRatioStyle","Children"],"sources":["../../../../src/components/aspect-ratio/aspect-ratio.tsx"],"sourcesContent":["\"use client\"\n\nimport type { HTMLStyledProps, StyleValue } from \"../../core\"\nimport type { AspectRatioStyle } from \"./aspect-ratio.style\"\nimport { Children } from \"react\"\nimport { createComponent } from \"../../core\"\nimport { replaceObject } from \"../../utils\"\nimport { aspectRatioStyle } from \"./aspect-ratio.style\"\n\nexport interface AspectRatioProps extends HTMLStyledProps {\n /**\n * The aspect ratio of the Box.\n *\n * @default '4 / 3'\n */\n ratio?: StyleValue<number>\n}\n\nconst {\n PropsContext: AspectRatioPropsContext,\n usePropsContext: useAspectRatioPropsContext,\n withContext,\n} = createComponent<AspectRatioProps, AspectRatioStyle>(\n \"aspect-ratio\",\n aspectRatioStyle,\n)\n\nexport { AspectRatioPropsContext, useAspectRatioPropsContext }\n\n/**\n * `AspectRatio` is a component for embedding things like videos and maps while maintaining the aspect ratio.\n *\n * @see https://yamada-ui.com/docs/components/aspect-ratio\n */\nexport const AspectRatio = withContext(\"div\")(\n undefined,\n ({ children, ratio = 4 / 3, ...rest }) => {\n const child = Children.only(children)\n\n return {\n ...rest,\n children: child,\n _before: {\n display: \"block\",\n h: 0,\n pb: replaceObject(ratio, (r) => `${(1 / r) * 100}%`),\n },\n }\n },\n)\n"],"mappings":";;;;;;AAkBA,MAAM,EACJ,cAAc,yBACd,iBAAiB,4BACjB,gBACEA,yBAAAA,gBACF,gBACAC,2BAAAA,gBACF;;;;;;AASA,MAAa,cAAc,YAAY,KAAK,CAAC,CAC3C,KAAA,IACC,EAAE,UAAU,QAAQ,IAAI,GAAG,GAAG,WAAW;CACxC,MAAM,QAAQC,MAAAA,SAAS,KAAK,QAAQ;CAEpC,OAAO;EACL,GAAG;EACH,UAAU;EACV,SAAS;GACP,SAAS;GACT,GAAG;GACH,KAAA,GAAA,oBAAA,cAAI,cAAA,CAAc,QAAQ,MAAM,GAAI,IAAI,IAAK,IAAI,EAAE;EACrD;CACF;AACF,CACF"}
1
+ {"version":3,"file":"aspect-ratio.cjs","names":["createComponent","aspectRatioStyle","Children","getResolvedChild"],"sources":["../../../../src/components/aspect-ratio/aspect-ratio.tsx"],"sourcesContent":["\"use client\"\n\nimport type { HTMLStyledProps, StyleValue } from \"../../core\"\nimport type { AspectRatioStyle } from \"./aspect-ratio.style\"\nimport { Children } from \"react\"\nimport { createComponent } from \"../../core\"\nimport { getResolvedChild, replaceObject } from \"../../utils\"\nimport { aspectRatioStyle } from \"./aspect-ratio.style\"\n\nexport interface AspectRatioProps extends HTMLStyledProps {\n /**\n * The aspect ratio of the Box.\n *\n * @default '4 / 3'\n */\n ratio?: StyleValue<number>\n}\n\nconst {\n PropsContext: AspectRatioPropsContext,\n usePropsContext: useAspectRatioPropsContext,\n withContext,\n} = createComponent<AspectRatioProps, AspectRatioStyle>(\n \"aspect-ratio\",\n aspectRatioStyle,\n)\n\nexport { AspectRatioPropsContext, useAspectRatioPropsContext }\n\n/**\n * `AspectRatio` is a component for embedding things like videos and maps while maintaining the aspect ratio.\n *\n * @see https://yamada-ui.com/docs/components/aspect-ratio\n */\nexport const AspectRatio = withContext(\"div\")(\n undefined,\n ({ children, ratio = 4 / 3, ...rest }) => {\n return {\n ...rest,\n children: Children.only(getResolvedChild(children)),\n _before: {\n display: \"block\",\n h: 0,\n pb: replaceObject(ratio, (r) => `${(1 / r) * 100}%`),\n },\n }\n },\n)\n"],"mappings":";;;;;;;AAkBA,MAAM,EACJ,cAAc,yBACd,iBAAiB,4BACjB,gBACEA,yBAAAA,gBACF,gBACAC,2BAAAA,gBACF;;;;;;AASA,MAAa,cAAc,YAAY,KAAK,CAAC,CAC3C,KAAA,IACC,EAAE,UAAU,QAAQ,IAAI,GAAG,GAAG,WAAW;CACxC,OAAO;EACL,GAAG;EACH,UAAUC,MAAAA,SAAS,KAAKC,iBAAAA,iBAAiB,QAAQ,CAAC;EAClD,SAAS;GACP,SAAS;GACT,GAAG;GACH,KAAA,GAAA,oBAAA,cAAI,cAAA,CAAc,QAAQ,MAAM,GAAI,IAAI,IAAK,IAAI,EAAE;EACrD;CACF;AACF,CACF"}
@@ -1,4 +1,5 @@
1
1
  "use client";
2
+ const require_children = require("../../utils/children.cjs");
2
3
  const require_ref = require("../../utils/ref.cjs");
3
4
  const require_utils_index = require("../../utils/index.cjs");
4
5
  const require_factory = require("../../core/system/factory.cjs");
@@ -92,18 +93,19 @@ const ButtonContent = component(({ children }) => {
92
93
  const ButtonLoading = component((props) => {
93
94
  const { loadingIcon, loadingMessage } = useComponentContext();
94
95
  const css = (0, react.useMemo)(() => ({ position: loadingMessage ? "relative" : "absolute" }), [loadingMessage]);
95
- if (require_use_loading_component.isLoadingScheme(loadingIcon)) {
96
- const Component = require_use_loading_component.getLoadingComponent(loadingIcon);
96
+ const child = require_children.getResolvedChild(loadingIcon);
97
+ if (require_use_loading_component.isLoadingScheme(child)) {
98
+ const Component = require_use_loading_component.getLoadingComponent(child);
97
99
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, {
98
100
  color: "currentColor",
99
101
  ...props,
100
102
  css: require_merge_css.mergeCSS(css, props.css)
101
103
  });
102
104
  }
103
- if ((0, react.isValidElement)(loadingIcon)) return (0, react.cloneElement)(loadingIcon, {
105
+ if ((0, react.isValidElement)(child)) return (0, react.cloneElement)(child, {
104
106
  ...props,
105
- ...loadingIcon.props,
106
- css: require_merge_css.mergeCSS(css, props.css, loadingIcon.props.css)
107
+ ...child.props,
108
+ css: require_merge_css.mergeCSS(css, props.css, child.props.css)
107
109
  });
108
110
  return null;
109
111
  }, {
@@ -119,13 +121,14 @@ const ButtonEndLoading = component(ButtonLoading, {
119
121
  className: require_utils.getClassName((0, require_utils_index.utils_exports.bem)("button", "loading", "end"))
120
122
  })();
121
123
  const ButtonIcon = component(({ children, ...rest }) => {
122
- if ((0, react.isValidElement)(children)) return (0, react.cloneElement)(children, {
124
+ const child = require_children.getResolvedChild(children);
125
+ if ((0, react.isValidElement)(child)) return (0, react.cloneElement)(child, {
123
126
  "aria-hidden": true,
124
127
  role: "img",
125
128
  ...rest,
126
- ...children.props
129
+ ...child.props
127
130
  });
128
- return react.Children.count(children) > 1 ? react.Children.only(null) : null;
131
+ return react.Children.count(child) > 1 ? react.Children.only(null) : null;
129
132
  }, {
130
133
  name: "ButtonIcon",
131
134
  className: require_utils.getClassName((0, require_utils_index.utils_exports.bem)("button", "icon"))
@@ -1 +1 @@
1
- {"version":3,"file":"button.cjs","names":["useRef","useCallback","createComponent","buttonStyle","useRipple","useMemo","styled","mergeRefs","Ripple","getClassName","isLoadingScheme","getLoadingComponent","mergeCSS","isValidElement","cloneElement","Children"],"sources":["../../../../src/components/button/button.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ElementType, PropsWithChildren, ReactNode } from \"react\"\nimport type {\n CSSObject,\n HTMLProps,\n HTMLStyledProps,\n ThemeProps,\n} from \"../../core\"\nimport type { Loading } from \"../loading\"\nimport type { ButtonStyle } from \"./button.style\"\nimport {\n Children,\n cloneElement,\n isValidElement,\n useCallback,\n useMemo,\n useRef,\n} from \"react\"\nimport { createComponent, getClassName, mergeCSS, styled } from \"../../core\"\nimport { bem, dataAttr, mergeRefs } from \"../../utils\"\nimport { getLoadingComponent, isLoadingScheme } from \"../loading\"\nimport { Ripple, useRipple } from \"../ripple\"\nimport { buttonStyle } from \"./button.style\"\n\ninterface ComponentContext extends Pick<\n ButtonProps,\n \"endIcon\" | \"iconProps\" | \"loadingIcon\" | \"loadingMessage\" | \"startIcon\"\n> {}\n\nconst useButtonType = (value?: ElementType) => {\n const buttonRef = useRef(!value)\n\n const ref = useCallback((node: HTMLElement | null) => {\n if (node) buttonRef.current = node.tagName === \"BUTTON\"\n }, [])\n\n const type = buttonRef.current ? \"button\" : undefined\n\n return { ref, type } as const\n}\n\nexport interface ButtonProps\n extends HTMLStyledProps<\"button\">, ThemeProps<ButtonStyle> {\n /**\n * If `true`, the button is represented as active.\n *\n * @default false\n */\n active?: boolean\n /**\n * If `true`, the button is disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * If `true`, disable ripple effects when pressing a element.\n *\n * @default false\n */\n disableRipple?: boolean\n /**\n * The icon to display at the end side of the button.\n */\n endIcon?: ReactNode\n /**\n * If `true`, the loading state of the button is represented.\n *\n * @default false\n */\n loading?: boolean\n /**\n * The icon to display when the button is loading.\n *\n * @default 'oval'\n */\n loadingIcon?: Loading.Scheme | ReactNode\n /**\n * The message to display when the button is loading.\n */\n loadingMessage?: ReactNode\n /**\n * The placement of the loading indicator. Accepts `start` or `end`.\n *\n * @default 'start'\n */\n loadingPlacement?: \"end\" | \"start\"\n /**\n * The icon to display at the start side of the button.\n */\n startIcon?: ReactNode\n /**\n * The type of button. Accepts `button`, `reset`, or `submit`.\n *\n * @default 'button'\n */\n type?: HTMLProps<\"button\">[\"type\"]\n /**\n * The props of the icon element.\n */\n iconProps?: ButtonIconProps\n /**\n * The props of the loading icon element.\n */\n loadingProps?: ButtonLoadingProps\n}\n\nconst {\n component,\n ComponentContext,\n PropsContext: ButtonPropsContext,\n useComponentContext,\n usePropsContext: useButtonPropsContext,\n withContext,\n} = createComponent<ButtonProps, ButtonStyle, ComponentContext>(\n \"button\",\n buttonStyle,\n)\n\nexport { ButtonPropsContext, useButtonPropsContext }\n\n/**\n * `Button` is an interactive component that allows users to perform actions such as submitting forms and toggling modals.\n *\n * @see https://yamada-ui.com/docs/components/button\n */\nexport const Button = withContext<\"button\", ButtonProps>(\n ({\n ref,\n as,\n active,\n children,\n disabled,\n disableRipple,\n endIcon = null,\n loading,\n loadingIcon = \"oval\",\n loadingMessage,\n loadingPlacement = \"start\",\n startIcon = null,\n iconProps,\n loadingProps,\n ...rest\n }) => {\n const trulyDisabled = disabled || loading\n const { ref: buttonRef, type } = useButtonType(as)\n const { onClick, ...rippleProps } = useRipple({\n ...rest,\n disabled: disableRipple || trulyDisabled,\n })\n const startLoading = loading && loadingPlacement === \"start\"\n const endLoading = loading && loadingPlacement === \"end\"\n\n const context = useMemo(\n () => ({ endIcon, loadingIcon, loadingMessage, startIcon, iconProps }),\n [loadingIcon, loadingMessage, startIcon, endIcon, iconProps],\n )\n\n return (\n <ComponentContext value={context}>\n <styled.button\n ref={mergeRefs(ref, buttonRef)}\n as={as}\n type={type}\n data-active={dataAttr(active)}\n data-loading={dataAttr(loading)}\n disabled={trulyDisabled}\n {...rest}\n onClick={onClick}\n >\n {startLoading ? <ButtonStartLoading {...loadingProps} /> : null}\n\n {loading ? (\n loadingMessage || (\n <styled.span opacity={0}>\n <ButtonContent>{children}</ButtonContent>\n </styled.span>\n )\n ) : (\n <ButtonContent>{children}</ButtonContent>\n )}\n\n {endLoading ? <ButtonEndLoading {...loadingProps} /> : null}\n\n <Ripple {...rippleProps} />\n </styled.button>\n </ComponentContext>\n )\n },\n)()\n\nconst ButtonContent = component<\"fragment\", PropsWithChildren>(\n ({ children }) => {\n const { endIcon, startIcon, iconProps } = useComponentContext()\n\n return (\n <>\n {startIcon ? (\n <ButtonStartIcon {...iconProps}>{startIcon}</ButtonStartIcon>\n ) : null}\n {children}\n {endIcon ? (\n <ButtonEndIcon {...iconProps}>{endIcon}</ButtonEndIcon>\n ) : null}\n </>\n )\n },\n { name: \"ButtonContent\", className: getClassName(bem(\"button\", \"content\")) },\n)()\n\ninterface ButtonLoadingProps extends HTMLStyledProps<\"svg\"> {}\n\nconst ButtonLoading = component<\"svg\", ButtonLoadingProps>(\n (props) => {\n const { loadingIcon, loadingMessage } = useComponentContext()\n\n const css = useMemo<CSSObject>(\n () => ({\n position: loadingMessage ? \"relative\" : \"absolute\",\n }),\n [loadingMessage],\n )\n\n if (isLoadingScheme(loadingIcon)) {\n const Component = getLoadingComponent(loadingIcon)\n\n return (\n <Component\n color=\"currentColor\"\n {...props}\n css={mergeCSS(css, props.css)}\n />\n )\n }\n\n if (isValidElement<HTMLStyledProps<\"svg\">>(loadingIcon))\n return cloneElement(loadingIcon, {\n ...props,\n ...loadingIcon.props,\n css: mergeCSS(css, props.css, loadingIcon.props.css),\n })\n\n return null\n },\n { name: \"ButtonLoading\", className: getClassName(bem(\"button\", \"loading\")) },\n)()\n\nconst ButtonStartLoading = component<\"svg\", ButtonLoadingProps>(ButtonLoading, {\n name: \"ButtonStartLoading\",\n className: getClassName(bem(\"button\", \"loading\", \"start\")),\n})()\n\nconst ButtonEndLoading = component<\"svg\", ButtonLoadingProps>(ButtonLoading, {\n name: \"ButtonEndLoading\",\n className: getClassName(bem(\"button\", \"loading\", \"end\")),\n})()\n\ninterface ButtonIconProps extends HTMLStyledProps<\"svg\"> {}\n\nconst ButtonIcon = component<\"svg\", ButtonIconProps>(\n ({ children, ...rest }) => {\n if (isValidElement<HTMLProps<\"svg\">>(children))\n return cloneElement(children, {\n \"aria-hidden\": true,\n role: \"img\",\n ...rest,\n ...children.props,\n })\n\n return Children.count(children) > 1 ? Children.only(null) : null\n },\n { name: \"ButtonIcon\", className: getClassName(bem(\"button\", \"icon\")) },\n)()\n\nconst ButtonStartIcon = component<\"svg\", ButtonIconProps>(ButtonIcon, {\n name: \"ButtonStartIcon\",\n className: getClassName(bem(\"button\", \"icon\", \"start\")),\n})()\n\nconst ButtonEndIcon = component<\"svg\", ButtonIconProps>(ButtonIcon, {\n name: \"ButtonEndIcon\",\n className: getClassName(bem(\"button\", \"icon\", \"end\")),\n})()\n"],"mappings":";;;;;;;;;;;;;;AA8BA,MAAM,iBAAiB,UAAwB;CAC7C,MAAM,aAAA,GAAYA,MAAAA,OAAAA,CAAO,CAAC,KAAK;CAQ/B,OAAO;EAAE,MAAA,GANGC,MAAAA,YAAAA,EAAa,SAA6B;GACpD,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C,YAAY;CAClE,MAAM;CACN,WAAWA,cAAAA,cAAAA,GAAAA,oBAAAA,cAAa,IAAA,CAAI,UAAU,QAAQ,KAAK,CAAC;AACtD,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"button.cjs","names":["useRef","useCallback","createComponent","buttonStyle","useRipple","useMemo","styled","mergeRefs","Ripple","getClassName","getResolvedChild","isLoadingScheme","getLoadingComponent","mergeCSS","isValidElement","cloneElement","Children"],"sources":["../../../../src/components/button/button.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ElementType, PropsWithChildren, ReactNode } from \"react\"\nimport type {\n CSSObject,\n HTMLProps,\n HTMLStyledProps,\n ThemeProps,\n} from \"../../core\"\nimport type { Loading } from \"../loading\"\nimport type { ButtonStyle } from \"./button.style\"\nimport {\n Children,\n cloneElement,\n isValidElement,\n useCallback,\n useMemo,\n useRef,\n} from \"react\"\nimport { createComponent, getClassName, mergeCSS, styled } from \"../../core\"\nimport { bem, dataAttr, getResolvedChild, mergeRefs } from \"../../utils\"\nimport { getLoadingComponent, isLoadingScheme } from \"../loading\"\nimport { Ripple, useRipple } from \"../ripple\"\nimport { buttonStyle } from \"./button.style\"\n\ninterface ComponentContext extends Pick<\n ButtonProps,\n \"endIcon\" | \"iconProps\" | \"loadingIcon\" | \"loadingMessage\" | \"startIcon\"\n> {}\n\nconst useButtonType = (value?: ElementType) => {\n const buttonRef = useRef(!value)\n\n const ref = useCallback((node: HTMLElement | null) => {\n if (node) buttonRef.current = node.tagName === \"BUTTON\"\n }, [])\n\n const type = buttonRef.current ? \"button\" : undefined\n\n return { ref, type } as const\n}\n\nexport interface ButtonProps\n extends HTMLStyledProps<\"button\">, ThemeProps<ButtonStyle> {\n /**\n * If `true`, the button is represented as active.\n *\n * @default false\n */\n active?: boolean\n /**\n * If `true`, the button is disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * If `true`, disable ripple effects when pressing a element.\n *\n * @default false\n */\n disableRipple?: boolean\n /**\n * The icon to display at the end side of the button.\n */\n endIcon?: ReactNode\n /**\n * If `true`, the loading state of the button is represented.\n *\n * @default false\n */\n loading?: boolean\n /**\n * The icon to display when the button is loading.\n *\n * @default 'oval'\n */\n loadingIcon?: Loading.Scheme | ReactNode\n /**\n * The message to display when the button is loading.\n */\n loadingMessage?: ReactNode\n /**\n * The placement of the loading indicator. Accepts `start` or `end`.\n *\n * @default 'start'\n */\n loadingPlacement?: \"end\" | \"start\"\n /**\n * The icon to display at the start side of the button.\n */\n startIcon?: ReactNode\n /**\n * The type of button. Accepts `button`, `reset`, or `submit`.\n *\n * @default 'button'\n */\n type?: HTMLProps<\"button\">[\"type\"]\n /**\n * The props of the icon element.\n */\n iconProps?: ButtonIconProps\n /**\n * The props of the loading icon element.\n */\n loadingProps?: ButtonLoadingProps\n}\n\nconst {\n component,\n ComponentContext,\n PropsContext: ButtonPropsContext,\n useComponentContext,\n usePropsContext: useButtonPropsContext,\n withContext,\n} = createComponent<ButtonProps, ButtonStyle, ComponentContext>(\n \"button\",\n buttonStyle,\n)\n\nexport { ButtonPropsContext, useButtonPropsContext }\n\n/**\n * `Button` is an interactive component that allows users to perform actions such as submitting forms and toggling modals.\n *\n * @see https://yamada-ui.com/docs/components/button\n */\nexport const Button = withContext<\"button\", ButtonProps>(\n ({\n ref,\n as,\n active,\n children,\n disabled,\n disableRipple,\n endIcon = null,\n loading,\n loadingIcon = \"oval\",\n loadingMessage,\n loadingPlacement = \"start\",\n startIcon = null,\n iconProps,\n loadingProps,\n ...rest\n }) => {\n const trulyDisabled = disabled || loading\n const { ref: buttonRef, type } = useButtonType(as)\n const { onClick, ...rippleProps } = useRipple({\n ...rest,\n disabled: disableRipple || trulyDisabled,\n })\n const startLoading = loading && loadingPlacement === \"start\"\n const endLoading = loading && loadingPlacement === \"end\"\n\n const context = useMemo(\n () => ({ endIcon, loadingIcon, loadingMessage, startIcon, iconProps }),\n [loadingIcon, loadingMessage, startIcon, endIcon, iconProps],\n )\n\n return (\n <ComponentContext value={context}>\n <styled.button\n ref={mergeRefs(ref, buttonRef)}\n as={as}\n type={type}\n data-active={dataAttr(active)}\n data-loading={dataAttr(loading)}\n disabled={trulyDisabled}\n {...rest}\n onClick={onClick}\n >\n {startLoading ? <ButtonStartLoading {...loadingProps} /> : null}\n\n {loading ? (\n loadingMessage || (\n <styled.span opacity={0}>\n <ButtonContent>{children}</ButtonContent>\n </styled.span>\n )\n ) : (\n <ButtonContent>{children}</ButtonContent>\n )}\n\n {endLoading ? <ButtonEndLoading {...loadingProps} /> : null}\n\n <Ripple {...rippleProps} />\n </styled.button>\n </ComponentContext>\n )\n },\n)()\n\nconst ButtonContent = component<\"fragment\", PropsWithChildren>(\n ({ children }) => {\n const { endIcon, startIcon, iconProps } = useComponentContext()\n\n return (\n <>\n {startIcon ? (\n <ButtonStartIcon {...iconProps}>{startIcon}</ButtonStartIcon>\n ) : null}\n {children}\n {endIcon ? (\n <ButtonEndIcon {...iconProps}>{endIcon}</ButtonEndIcon>\n ) : null}\n </>\n )\n },\n { name: \"ButtonContent\", className: getClassName(bem(\"button\", \"content\")) },\n)()\n\ninterface ButtonLoadingProps extends HTMLStyledProps<\"svg\"> {}\n\nconst ButtonLoading = component<\"svg\", ButtonLoadingProps>(\n (props) => {\n const { loadingIcon, loadingMessage } = useComponentContext()\n const css = useMemo<CSSObject>(\n () => ({\n position: loadingMessage ? \"relative\" : \"absolute\",\n }),\n [loadingMessage],\n )\n const child = getResolvedChild(loadingIcon)\n\n if (isLoadingScheme(child)) {\n const Component = getLoadingComponent(child)\n\n return (\n <Component\n color=\"currentColor\"\n {...props}\n css={mergeCSS(css, props.css)}\n />\n )\n }\n\n if (isValidElement<HTMLStyledProps<\"svg\">>(child))\n return cloneElement(child, {\n ...props,\n ...child.props,\n css: mergeCSS(css, props.css, child.props.css),\n })\n\n return null\n },\n { name: \"ButtonLoading\", className: getClassName(bem(\"button\", \"loading\")) },\n)()\n\nconst ButtonStartLoading = component<\"svg\", ButtonLoadingProps>(ButtonLoading, {\n name: \"ButtonStartLoading\",\n className: getClassName(bem(\"button\", \"loading\", \"start\")),\n})()\n\nconst ButtonEndLoading = component<\"svg\", ButtonLoadingProps>(ButtonLoading, {\n name: \"ButtonEndLoading\",\n className: getClassName(bem(\"button\", \"loading\", \"end\")),\n})()\n\ninterface ButtonIconProps extends HTMLStyledProps<\"svg\"> {}\n\nconst ButtonIcon = component<\"svg\", ButtonIconProps>(\n ({ children, ...rest }) => {\n const child = getResolvedChild(children)\n\n if (isValidElement<HTMLProps<\"svg\">>(child))\n return cloneElement(child, {\n \"aria-hidden\": true,\n role: \"img\",\n ...rest,\n ...child.props,\n })\n\n return Children.count(child) > 1 ? Children.only(null) : null\n },\n { name: \"ButtonIcon\", className: getClassName(bem(\"button\", \"icon\")) },\n)()\n\nconst ButtonStartIcon = component<\"svg\", ButtonIconProps>(ButtonIcon, {\n name: \"ButtonStartIcon\",\n className: getClassName(bem(\"button\", \"icon\", \"start\")),\n})()\n\nconst ButtonEndIcon = component<\"svg\", ButtonIconProps>(ButtonIcon, {\n name: \"ButtonEndIcon\",\n className: getClassName(bem(\"button\", \"icon\", \"end\")),\n})()\n"],"mappings":";;;;;;;;;;;;;;;AA8BA,MAAM,iBAAiB,UAAwB;CAC7C,MAAM,aAAA,GAAYA,MAAAA,OAAAA,CAAO,CAAC,KAAK;CAQ/B,OAAO;EAAE,MAAA,GANGC,MAAAA,YAAAA,EAAa,SAA6B;GACpD,IAAI,MAAM,UAAU,UAAU,KAAK,YAAY;EACjD,GAAG,CAAC,CAIO;EAAG,MAFD,UAAU,UAAU,WAAW,KAAA;CAEzB;AACrB;AAoEA,MAAM,EACJ,WACA,kBACA,cAAc,oBACd,qBACA,iBAAiB,uBACjB,gBACEC,yBAAAA,gBACF,UACAC,qBAAAA,WACF;;;;;;AASA,MAAa,SAAS,aACnB,EACC,KACA,IACA,QACA,UACA,UACA,eACA,UAAU,MACV,SACA,cAAc,QACd,gBACA,mBAAmB,SACnB,YAAY,MACZ,WACA,cACA,GAAG,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AC7E,CAAC,CAAC;AAEF,MAAM,qBAAqB,UAAqC,eAAe;CAC7E,MAAM;CACN,WAAWA,cAAAA,cAAAA,GAAAA,oBAAAA,cAAa,IAAA,CAAI,UAAU,WAAW,OAAO,CAAC;AAC3D,CAAC,CAAC,CAAC;AAEH,MAAM,mBAAmB,UAAqC,eAAe;CAC3E,MAAM;CACN,WAAWA,cAAAA,cAAAA,GAAAA,oBAAAA,cAAa,IAAA,CAAI,UAAU,WAAW,KAAK,CAAC;AACzD,CAAC,CAAC,CAAC;AAIH,MAAM,aAAa,WAChB,EAAE,UAAU,GAAG,WAAW;CACzB,MAAM,QAAQC,iBAAAA,iBAAiB,QAAQ;CAEvC,KAAA,GAAII,MAAAA,eAAAA,CAAiC,KAAK,GACxC,QAAA,GAAOC,MAAAA,aAAAA,CAAa,OAAO;EACzB,eAAe;EACf,MAAM;EACN,GAAG;EACH,GAAG,MAAM;CACX,CAAC;CAEH,OAAOC,MAAAA,SAAS,MAAM,KAAK,IAAI,IAAIA,MAAAA,SAAS,KAAK,IAAI,IAAI;AAC3D,GACA;CAAE,MAAM;CAAc,WAAWP,cAAAA,cAAAA,GAAAA,oBAAAA,cAAa,IAAA,CAAI,UAAU,MAAM,CAAC;AAAE,CACvE,CAAC,CAAC;AAEF,MAAM,kBAAkB,UAAkC,YAAY;CACpE,MAAM;CACN,WAAWA,cAAAA,cAAAA,GAAAA,oBAAAA,cAAa,IAAA,CAAI,UAAU,QAAQ,OAAO,CAAC;AACxD,CAAC,CAAC,CAAC;AAEH,MAAM,gBAAgB,UAAkC,YAAY;CAClE,MAAM;CACN,WAAWA,cAAAA,cAAAA,GAAAA,oBAAAA,cAAa,IAAA,CAAI,UAAU,QAAQ,KAAK,CAAC;AACtD,CAAC,CAAC,CAAC"}
@@ -4,7 +4,8 @@ const codeStyle = require("../../core/system/config.cjs").defineComponentStyle({
4
4
  alignItems: "center",
5
5
  display: "inline-flex",
6
6
  fontFamily: "mono",
7
- rounded: "l1"
7
+ rounded: "l1",
8
+ verticalAlign: "middle"
8
9
  },
9
10
  variants: {
10
11
  outline: { layerStyle: "outline" },
@@ -1 +1 @@
1
- {"version":3,"file":"code.style.cjs","names":["defineComponentStyle"],"sources":["../../../../src/components/code/code.style.ts"],"sourcesContent":["import { defineComponentStyle } from \"../../core\"\n\nexport const codeStyle = defineComponentStyle({\n base: {\n alignItems: \"center\",\n display: \"inline-flex\",\n fontFamily: \"mono\",\n rounded: \"l1\",\n },\n\n variants: {\n outline: {\n layerStyle: \"outline\",\n },\n solid: {\n layerStyle: \"solid\",\n },\n subtle: {\n layerStyle: \"subtle\",\n },\n surface: {\n layerStyle: \"surface\",\n },\n },\n\n sizes: {\n xs: {\n fontSize: \"2xs\",\n lineHeight: \"{sizes.4}\",\n minH: \"4\",\n px: \"1\",\n },\n sm: {\n fontSize: \"xs\",\n lineHeight: \"{sizes.5}\",\n minH: \"5\",\n px: \"1.5\",\n },\n md: {\n fontSize: \"sm\",\n lineHeight: \"{sizes.6}\",\n minH: \"6\",\n px: \"2\",\n },\n lg: {\n fontSize: \"sm\",\n lineHeight: \"{sizes.7}\",\n minH: \"7\",\n px: \"2.5\",\n },\n },\n\n defaultProps: {\n size: \"sm\",\n variant: \"subtle\",\n },\n})\n\nexport type CodeStyle = typeof codeStyle\n"],"mappings":";AAEA,MAAa,kDAAYA,CAAAA,CAAAA,qBAAqB;CAC5C,MAAM;EACJ,YAAY;EACZ,SAAS;EACT,YAAY;EACZ,SAAS;CACX;CAEA,UAAU;EACR,SAAS,EACP,YAAY,UACd;EACA,OAAO,EACL,YAAY,QACd;EACA,QAAQ,EACN,YAAY,SACd;EACA,SAAS,EACP,YAAY,UACd;CACF;CAEA,OAAO;EACL,IAAI;GACF,UAAU;GACV,YAAY;GACZ,MAAM;GACN,IAAI;EACN;EACA,IAAI;GACF,UAAU;GACV,YAAY;GACZ,MAAM;GACN,IAAI;EACN;EACA,IAAI;GACF,UAAU;GACV,YAAY;GACZ,MAAM;GACN,IAAI;EACN;EACA,IAAI;GACF,UAAU;GACV,YAAY;GACZ,MAAM;GACN,IAAI;EACN;CACF;CAEA,cAAc;EACZ,MAAM;EACN,SAAS;CACX;AACF,CAAC"}
1
+ {"version":3,"file":"code.style.cjs","names":["defineComponentStyle"],"sources":["../../../../src/components/code/code.style.ts"],"sourcesContent":["import { defineComponentStyle } from \"../../core\"\n\nexport const codeStyle = defineComponentStyle({\n base: {\n alignItems: \"center\",\n display: \"inline-flex\",\n fontFamily: \"mono\",\n rounded: \"l1\",\n verticalAlign: \"middle\",\n },\n\n variants: {\n outline: {\n layerStyle: \"outline\",\n },\n solid: {\n layerStyle: \"solid\",\n },\n subtle: {\n layerStyle: \"subtle\",\n },\n surface: {\n layerStyle: \"surface\",\n },\n },\n\n sizes: {\n xs: {\n fontSize: \"2xs\",\n lineHeight: \"{sizes.4}\",\n minH: \"4\",\n px: \"1\",\n },\n sm: {\n fontSize: \"xs\",\n lineHeight: \"{sizes.5}\",\n minH: \"5\",\n px: \"1.5\",\n },\n md: {\n fontSize: \"sm\",\n lineHeight: \"{sizes.6}\",\n minH: \"6\",\n px: \"2\",\n },\n lg: {\n fontSize: \"sm\",\n lineHeight: \"{sizes.7}\",\n minH: \"7\",\n px: \"2.5\",\n },\n },\n\n defaultProps: {\n size: \"sm\",\n variant: \"subtle\",\n },\n})\n\nexport type CodeStyle = typeof codeStyle\n"],"mappings":";AAEA,MAAa,kDAAYA,CAAAA,CAAAA,qBAAqB;CAC5C,MAAM;EACJ,YAAY;EACZ,SAAS;EACT,YAAY;EACZ,SAAS;EACT,eAAe;CACjB;CAEA,UAAU;EACR,SAAS,EACP,YAAY,UACd;EACA,OAAO,EACL,YAAY,QACd;EACA,QAAQ,EACN,YAAY,SACd;EACA,SAAS,EACP,YAAY,UACd;CACF;CAEA,OAAO;EACL,IAAI;GACF,UAAU;GACV,YAAY;GACZ,MAAM;GACN,IAAI;EACN;EACA,IAAI;GACF,UAAU;GACV,YAAY;GACZ,MAAM;GACN,IAAI;EACN;EACA,IAAI;GACF,UAAU;GACV,YAAY;GACZ,MAAM;GACN,IAAI;EACN;EACA,IAAI;GACF,UAAU;GACV,YAAY;GACZ,MAAM;GACN,IAAI;EACN;CACF;CAEA,cAAc;EACZ,MAAM;EACN,SAAS;CACX;AACF,CAAC"}
@@ -116,13 +116,14 @@ const FieldLabel = withContext(({ id, htmlFor, children, optionalIndicator = nul
116
116
  });
117
117
  }, "label")();
118
118
  const FieldRequiredIndicator = withContext(({ children, ...rest }) => {
119
- if (!(0, react.isValidElement)(children)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.styled.span, {
119
+ const child = require_children.getResolvedChild(children);
120
+ if (!(0, react.isValidElement)(child)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.styled.span, {
120
121
  "aria-hidden": true,
121
122
  role: "presentation",
122
123
  ...rest,
123
- children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: "*" })
124
+ children: child || /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: "*" })
124
125
  });
125
- else return children;
126
+ else return child;
126
127
  }, "requiredIndicator")();
127
128
  const FieldHelperMessage = withContext((props) => {
128
129
  const { helperMessageId, invalid, replace } = useFieldContext() ?? {};
@@ -1 +1 @@
1
- {"version":3,"file":"field.cjs","names":["createContext","createSlotComponent","fieldStyle","useId","useFormContext","useFieldsetContext","useState","useSplitChildren","useMemo","styled","isValidElement"],"sources":["../../../../src/components/field/field.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactNode } from \"react\"\nimport type { HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { FieldStyle } from \"./field.style\"\nimport { isValidElement, useId, useMemo, useState } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport {\n createContext,\n dataAttr,\n isObject,\n useSplitChildren,\n} from \"../../utils\"\nimport { useFieldsetContext } from \"../fieldset\"\nimport { useFormContext } from \"../form\"\nimport { fieldStyle } from \"./field.style\"\n\nexport interface FieldContext\n extends FieldProps, Pick<FieldRootProps, \"replace\"> {\n errorMessageId: string\n focused: boolean\n helperMessageId: string\n id: string\n labelId: string\n onBlur: () => void\n onFocus: () => void\n}\n\nconst [FieldContext, useFieldContext] = createContext<FieldContext>({\n name: \"FieldContext\",\n strict: false,\n})\n\nexport { FieldContext, useFieldContext }\n\nexport interface FieldProps {\n /**\n * If `true`, the field will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * If `true`, the field will be invalid.\n *\n * @default false\n */\n invalid?: boolean\n /**\n * If `true`, the field will be readonly.\n *\n * @default false\n */\n readOnly?: boolean\n /**\n * If `true`, the field will be required.\n *\n * @default false\n */\n required?: boolean\n}\n\nexport interface FieldRootProps\n extends\n HTMLStyledProps,\n ThemeProps<FieldStyle>,\n Pick<FieldLabelProps, \"optionalIndicator\" | \"requiredIndicator\">,\n FieldProps {\n /**\n * The field error message to use.\n */\n errorMessage?: ReactNode\n /**\n * The field helper message to use.\n */\n helperMessage?: ReactNode\n /**\n * The field label to use.\n */\n label?: ReactNode\n /**\n * The name of the field.\n */\n name?: string\n /**\n * If `true`, switch between helper message and error message using invalid.\n *\n * @default true\n */\n replace?: boolean\n /**\n * Props the error message component.\n */\n errorMessageProps?: FieldErrorMessageProps\n /**\n * Props the helper message component.\n */\n helperMessageProps?: FieldHelperMessageProps\n /**\n * Props the label component.\n */\n labelProps?: FieldLabelProps\n}\n\nconst {\n PropsContext: FieldPropsContext,\n usePropsContext: useFieldPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<FieldRootProps, FieldStyle>(\"field\", fieldStyle)\n\nexport { FieldPropsContext, useFieldPropsContext }\n\n/**\n * `Field` is a component used to group form elements with label, helper message, error message, etc.\n *\n * @see https://yamada-ui.com/docs/components/field\n */\nexport const FieldRoot = withProvider<\"div\", FieldRootProps>(\n ({\n id,\n name,\n children,\n disabled,\n errorMessage,\n helperMessage,\n invalid,\n label,\n optionalIndicator,\n readOnly,\n replace,\n required,\n requiredIndicator,\n errorMessageProps,\n helperMessageProps,\n labelProps,\n ...rest\n }) => {\n const uuid = useId()\n const labelId = useId()\n const helperMessageId = useId()\n const errorMessageId = useId()\n const formContext = useFormContext()\n const fieldsetContext = useFieldsetContext()\n const [focused, setFocused] = useState<boolean>(false)\n const [\n omittedChildren,\n customLabel,\n customHelperMessage,\n customErrorMessage,\n ] = useSplitChildren(\n children,\n FieldLabel,\n FieldHelperMessage,\n FieldErrorMessage,\n )\n\n id ??= uuid\n optionalIndicator ??= formContext?.optionalIndicator\n requiredIndicator ??= formContext?.requiredIndicator\n\n disabled ??= fieldsetContext?.disabled\n invalid ??= fieldsetContext?.invalid\n readOnly ??= fieldsetContext?.readOnly\n required ??= fieldsetContext?.required\n\n if (name) {\n disabled ??= isObject(formContext?.disabled)\n ? formContext.disabled[name]\n : formContext?.disabled\n invalid ??= isObject(formContext?.invalid)\n ? formContext.invalid[name]\n : formContext?.invalid\n readOnly ??= isObject(formContext?.readOnly)\n ? formContext.readOnly[name]\n : formContext?.readOnly\n required ??= isObject(formContext?.required)\n ? formContext.required[name]\n : formContext?.required\n replace ??= isObject(formContext?.replace)\n ? (formContext.replace[name] ?? true)\n : (formContext?.replace ?? true)\n errorMessage ??= formContext?.errorMessage?.[name]\n helperMessage ??= formContext?.helperMessage?.[name]\n }\n\n const context = useMemo(\n () => ({\n id,\n disabled,\n errorMessageId,\n focused,\n helperMessageId,\n invalid,\n labelId,\n readOnly,\n replace,\n required,\n onBlur: () => setFocused(false),\n onFocus: () => setFocused(true),\n }),\n [\n id,\n disabled,\n labelId,\n focused,\n invalid,\n helperMessageId,\n errorMessageId,\n readOnly,\n replace,\n required,\n ],\n )\n\n return (\n <FieldContext value={context}>\n <styled.div\n data-disabled={dataAttr(disabled)}\n data-focus={dataAttr(focused)}\n data-invalid={dataAttr(invalid)}\n data-readonly={dataAttr(readOnly)}\n role=\"group\"\n {...rest}\n >\n {customLabel ||\n (label ? (\n <FieldLabel\n optionalIndicator={optionalIndicator}\n requiredIndicator={requiredIndicator}\n {...labelProps}\n >\n {label}\n </FieldLabel>\n ) : null)}\n\n {omittedChildren}\n\n {customHelperMessage ||\n (helperMessage ? (\n <FieldHelperMessage {...helperMessageProps}>\n {helperMessage}\n </FieldHelperMessage>\n ) : null)}\n\n {customErrorMessage ||\n (errorMessage ? (\n <FieldErrorMessage {...errorMessageProps}>\n {errorMessage}\n </FieldErrorMessage>\n ) : null)}\n </styled.div>\n </FieldContext>\n )\n },\n \"root\",\n)()\n\nexport interface FieldLabelProps extends HTMLStyledProps<\"label\"> {\n /**\n * The optional indicator to use.\n */\n optionalIndicator?: ReactNode\n /**\n * If `true`, the field will be required.\n *\n * @default false\n */\n required?: boolean\n /**\n * The required indicator to use.\n */\n requiredIndicator?: ReactNode\n}\n\nexport const FieldLabel = withContext<\"label\", FieldLabelProps>(\n ({\n id,\n htmlFor,\n children,\n optionalIndicator = null,\n required,\n requiredIndicator = null,\n ...rest\n }) => {\n const fieldContext = useFieldContext()\n\n id ??= fieldContext?.labelId\n htmlFor ??= fieldContext?.id\n required ??= fieldContext?.required\n\n return (\n <styled.label\n id={id}\n htmlFor={htmlFor}\n data-disabled={dataAttr(fieldContext?.disabled)}\n data-focus={dataAttr(fieldContext?.focused)}\n data-invalid={dataAttr(fieldContext?.invalid)}\n data-readonly={dataAttr(fieldContext?.readOnly)}\n {...rest}\n >\n {children}\n\n {required ? (\n requiredIndicator ? (\n <FieldRequiredIndicator>{requiredIndicator}</FieldRequiredIndicator>\n ) : (\n <FieldRequiredIndicator />\n )\n ) : (\n optionalIndicator\n )}\n </styled.label>\n )\n },\n \"label\",\n)()\n\ninterface FieldRequiredIndicatorProps extends HTMLStyledProps<\"span\"> {}\n\nconst FieldRequiredIndicator = withContext<\"span\", FieldRequiredIndicatorProps>(\n ({ children, ...rest }) => {\n if (!isValidElement(children))\n return (\n <styled.span aria-hidden role=\"presentation\" {...rest}>\n {children ?? <>*</>}\n </styled.span>\n )\n else return children\n },\n \"requiredIndicator\",\n)()\n\nexport interface FieldHelperMessageProps extends HTMLStyledProps<\"span\"> {}\n\nexport const FieldHelperMessage = withContext<\"span\", FieldHelperMessageProps>(\n (props) => {\n const { helperMessageId, invalid, replace } = useFieldContext() ?? {}\n\n return (\n <styled.span\n id={helperMessageId}\n hidden={replace && invalid ? true : false}\n {...props}\n />\n )\n },\n \"helperMessage\",\n)()\n\nexport interface FieldErrorMessageProps extends HTMLStyledProps<\"span\"> {}\n\nexport const FieldErrorMessage = withContext<\"span\", FieldErrorMessageProps>(\n (props) => {\n const { errorMessageId, invalid } = useFieldContext() ?? {}\n\n return (\n <styled.span\n id={errorMessageId}\n aria-live={invalid ? \"polite\" : undefined}\n hidden={!invalid}\n {...props}\n />\n )\n },\n \"errorMessage\",\n)()\n"],"mappings":";;;;;;;;;;;;AA4BA,MAAM,CAAC,cAAc,mBAAmBA,gBAAAA,cAA4B;CAClE,MAAM;CACN,QAAQ;AACV,CAAC;AAyED,MAAM,EACJ,cAAc,mBACd,iBAAiB,sBACjB,aACA,iBACEC,yBAAAA,oBAAgD,SAASC,oBAAAA,UAAU;;;;;;AASvE,MAAa,YAAY,cACtB,EACC,IACA,MACA,UACA,UACA,cACA,eACA,SACA,OACA,mBACA,UACA,SACA,UACA,mBACA,mBACA,oBACA,YACA,GAAG,WACC;CACJ,MAAM,QAAA,GAAOC,MAAAA,MAAAA,CAAM;CACnB,MAAM,WAAA,GAAUA,MAAAA,MAAAA,CAAM;CACtB,MAAM,mBAAA,GAAkBA,MAAAA,MAAAA,CAAM;CAC9B,MAAM,kBAAA,GAAiBA,MAAAA,MAAAA,CAAM;CAC7B,MAAM,cAAcC,aAAAA,eAAe;CACnC,MAAM,kBAAkBC,iBAAAA,mBAAmB;CAC3C,MAAM,CAAC,SAAS,eAAA,GAAcC,MAAAA,SAAAA,CAAkB,KAAK;CACrD,MAAM,CACJ,iBACA,aACA,qBACA,sBACEC,iBAAAA,iBACF,UACA,YACA,oBACA,iBACF;CAEA,O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EAAY,MAAK;EAAe,GAAI;EAC9C,UAAA,YAAY,iBAAA,GAAA,kBAAA,IAAA,CAAA,kBAAA,UAAA,EAAA,UAAE,IAAG,CAAA;CACP,CAAA;MAEZ,OAAO;AACd,GACA,mBACF,CAAC,CAAC;AAIF,MAAa,qBAAqB,aAC/B,UAAU;CACT,MAAM,EAAE,iBAAiB,SAAS,YAAY,gBAAgB,KAAK,CAAC;CAEpE,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACA,gBAAAA,OAAO,MAAR;EACE,IAAI;EACJ,QAAQ,WAAW,UAAU,OAAO;EACpC,GAAI;CACL,CAAA;AAEL,GACA,eACF,CAAC,CAAC;AAIF,MAAa,oBAAoB,aAC9B,UAAU;CACT,MAAM,EAAE,gBAAgB,YAAY,gBAAgB,KAAK,CAAC;CAE1D,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACA,gBAAAA,OAAO,MAAR;EACE,IAAI;EACJ,aAAW,UAAU,WAAW,KAAA;EAChC,QAAQ,CAAC;EACT,GAAI;CACL,CAAA;AAEL,GACA,cACF,CAAC,CAAC"}
1
+ {"version":3,"file":"field.cjs","names":["createContext","createSlotComponent","fieldStyle","useId","useFormContext","useFieldsetContext","useState","useSplitChildren","useMemo","styled","getResolvedChild","isValidElement"],"sources":["../../../../src/components/field/field.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactNode } from \"react\"\nimport type { HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { FieldStyle } from \"./field.style\"\nimport { isValidElement, useId, useMemo, useState } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport {\n createContext,\n dataAttr,\n getResolvedChild,\n isObject,\n useSplitChildren,\n} from \"../../utils\"\nimport { useFieldsetContext } from \"../fieldset\"\nimport { useFormContext } from \"../form\"\nimport { fieldStyle } from \"./field.style\"\n\nexport interface FieldContext\n extends FieldProps, Pick<FieldRootProps, \"replace\"> {\n errorMessageId: string\n focused: boolean\n helperMessageId: string\n id: string\n labelId: string\n onBlur: () => void\n onFocus: () => void\n}\n\nconst [FieldContext, useFieldContext] = createContext<FieldContext>({\n name: \"FieldContext\",\n strict: false,\n})\n\nexport { FieldContext, useFieldContext }\n\nexport interface FieldProps {\n /**\n * If `true`, the field will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * If `true`, the field will be invalid.\n *\n * @default false\n */\n invalid?: boolean\n /**\n * If `true`, the field will be readonly.\n *\n * @default false\n */\n readOnly?: boolean\n /**\n * If `true`, the field will be required.\n *\n * @default false\n */\n required?: boolean\n}\n\nexport interface FieldRootProps\n extends\n HTMLStyledProps,\n ThemeProps<FieldStyle>,\n Pick<FieldLabelProps, \"optionalIndicator\" | \"requiredIndicator\">,\n FieldProps {\n /**\n * The field error message to use.\n */\n errorMessage?: ReactNode\n /**\n * The field helper message to use.\n */\n helperMessage?: ReactNode\n /**\n * The field label to use.\n */\n label?: ReactNode\n /**\n * The name of the field.\n */\n name?: string\n /**\n * If `true`, switch between helper message and error message using invalid.\n *\n * @default true\n */\n replace?: boolean\n /**\n * Props the error message component.\n */\n errorMessageProps?: FieldErrorMessageProps\n /**\n * Props the helper message component.\n */\n helperMessageProps?: FieldHelperMessageProps\n /**\n * Props the label component.\n */\n labelProps?: FieldLabelProps\n}\n\nconst {\n PropsContext: FieldPropsContext,\n usePropsContext: useFieldPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<FieldRootProps, FieldStyle>(\"field\", fieldStyle)\n\nexport { FieldPropsContext, useFieldPropsContext }\n\n/**\n * `Field` is a component used to group form elements with label, helper message, error message, etc.\n *\n * @see https://yamada-ui.com/docs/components/field\n */\nexport const FieldRoot = withProvider<\"div\", FieldRootProps>(\n ({\n id,\n name,\n children,\n disabled,\n errorMessage,\n helperMessage,\n invalid,\n label,\n optionalIndicator,\n readOnly,\n replace,\n required,\n requiredIndicator,\n errorMessageProps,\n helperMessageProps,\n labelProps,\n ...rest\n }) => {\n const uuid = useId()\n const labelId = useId()\n const helperMessageId = useId()\n const errorMessageId = useId()\n const formContext = useFormContext()\n const fieldsetContext = useFieldsetContext()\n const [focused, setFocused] = useState<boolean>(false)\n const [\n omittedChildren,\n customLabel,\n customHelperMessage,\n customErrorMessage,\n ] = useSplitChildren(\n children,\n FieldLabel,\n FieldHelperMessage,\n FieldErrorMessage,\n )\n\n id ??= uuid\n optionalIndicator ??= formContext?.optionalIndicator\n requiredIndicator ??= formContext?.requiredIndicator\n\n disabled ??= fieldsetContext?.disabled\n invalid ??= fieldsetContext?.invalid\n readOnly ??= fieldsetContext?.readOnly\n required ??= fieldsetContext?.required\n\n if (name) {\n disabled ??= isObject(formContext?.disabled)\n ? formContext.disabled[name]\n : formContext?.disabled\n invalid ??= isObject(formContext?.invalid)\n ? formContext.invalid[name]\n : formContext?.invalid\n readOnly ??= isObject(formContext?.readOnly)\n ? formContext.readOnly[name]\n : formContext?.readOnly\n required ??= isObject(formContext?.required)\n ? formContext.required[name]\n : formContext?.required\n replace ??= isObject(formContext?.replace)\n ? (formContext.replace[name] ?? true)\n : (formContext?.replace ?? true)\n errorMessage ??= formContext?.errorMessage?.[name]\n helperMessage ??= formContext?.helperMessage?.[name]\n }\n\n const context = useMemo(\n () => ({\n id,\n disabled,\n errorMessageId,\n focused,\n helperMessageId,\n invalid,\n labelId,\n readOnly,\n replace,\n required,\n onBlur: () => setFocused(false),\n onFocus: () => setFocused(true),\n }),\n [\n id,\n disabled,\n labelId,\n focused,\n invalid,\n helperMessageId,\n errorMessageId,\n readOnly,\n replace,\n required,\n ],\n )\n\n return (\n <FieldContext value={context}>\n <styled.div\n data-disabled={dataAttr(disabled)}\n data-focus={dataAttr(focused)}\n data-invalid={dataAttr(invalid)}\n data-readonly={dataAttr(readOnly)}\n role=\"group\"\n {...rest}\n >\n {customLabel ||\n (label ? (\n <FieldLabel\n optionalIndicator={optionalIndicator}\n requiredIndicator={requiredIndicator}\n {...labelProps}\n >\n {label}\n </FieldLabel>\n ) : null)}\n\n {omittedChildren}\n\n {customHelperMessage ||\n (helperMessage ? (\n <FieldHelperMessage {...helperMessageProps}>\n {helperMessage}\n </FieldHelperMessage>\n ) : null)}\n\n {customErrorMessage ||\n (errorMessage ? (\n <FieldErrorMessage {...errorMessageProps}>\n {errorMessage}\n </FieldErrorMessage>\n ) : null)}\n </styled.div>\n </FieldContext>\n )\n },\n \"root\",\n)()\n\nexport interface FieldLabelProps extends HTMLStyledProps<\"label\"> {\n /**\n * The optional indicator to use.\n */\n optionalIndicator?: ReactNode\n /**\n * If `true`, the field will be required.\n *\n * @default false\n */\n required?: boolean\n /**\n * The required indicator to use.\n */\n requiredIndicator?: ReactNode\n}\n\nexport const FieldLabel = withContext<\"label\", FieldLabelProps>(\n ({\n id,\n htmlFor,\n children,\n optionalIndicator = null,\n required,\n requiredIndicator = null,\n ...rest\n }) => {\n const fieldContext = useFieldContext()\n\n id ??= fieldContext?.labelId\n htmlFor ??= fieldContext?.id\n required ??= fieldContext?.required\n\n return (\n <styled.label\n id={id}\n htmlFor={htmlFor}\n data-disabled={dataAttr(fieldContext?.disabled)}\n data-focus={dataAttr(fieldContext?.focused)}\n data-invalid={dataAttr(fieldContext?.invalid)}\n data-readonly={dataAttr(fieldContext?.readOnly)}\n {...rest}\n >\n {children}\n\n {required ? (\n requiredIndicator ? (\n <FieldRequiredIndicator>{requiredIndicator}</FieldRequiredIndicator>\n ) : (\n <FieldRequiredIndicator />\n )\n ) : (\n optionalIndicator\n )}\n </styled.label>\n )\n },\n \"label\",\n)()\n\ninterface FieldRequiredIndicatorProps extends HTMLStyledProps<\"span\"> {}\n\nconst FieldRequiredIndicator = withContext<\"span\", FieldRequiredIndicatorProps>(\n ({ children, ...rest }) => {\n const child = getResolvedChild(children)\n\n if (!isValidElement(child))\n return (\n <styled.span aria-hidden role=\"presentation\" {...rest}>\n {child || <>*</>}\n </styled.span>\n )\n else return child\n },\n \"requiredIndicator\",\n)()\n\nexport interface FieldHelperMessageProps extends HTMLStyledProps<\"span\"> {}\n\nexport const FieldHelperMessage = withContext<\"span\", FieldHelperMessageProps>(\n (props) => {\n const { helperMessageId, invalid, replace } = useFieldContext() ?? {}\n\n return (\n <styled.span\n id={helperMessageId}\n hidden={replace && invalid ? true : false}\n {...props}\n />\n )\n },\n \"helperMessage\",\n)()\n\nexport interface FieldErrorMessageProps extends HTMLStyledProps<\"span\"> {}\n\nexport const FieldErrorMessage = withContext<\"span\", FieldErrorMessageProps>(\n (props) => {\n const { errorMessageId, invalid } = useFieldContext() ?? {}\n\n return (\n <styled.span\n id={errorMessageId}\n aria-live={invalid ? \"polite\" : undefined}\n hidden={!invalid}\n {...props}\n />\n )\n },\n \"errorMessage\",\n)()\n"],"mappings":";;;;;;;;;;;;AA6BA,MAAM,CAAC,cAAc,mBAAmBA,gBAAAA,cAA4B;CAClE,MAAM;CACN,QAAQ;AACV,CAAC;AAyED,MAAM,EACJ,cAAc,mBACd,iBAAiB,sBACjB,aACA,iBACEC,yBAAAA,oBAAgD,SAASC,oBAAAA,UAAU;;;;;;AASvE,MAAa,YAAY,cACtB,EACC,IACA,MACA,UACA,UACA,cACA,eACA,SACA,OACA,mBACA,UACA,SACA,UACA,mBACA,mBACA,oBACA,YACA,GAAG,WACC;CACJ,MAAM,QAAA,GAAOC,MAAAA,MAAAA,CAAM;CACnB,MAAM,WAAA,GAAUA,MAAAA,MAAAA,CAAM;CACtB,MAAM,mBAAA,GAAkBA,MAAAA,MAAAA,CAAM;CAC9B,MAAM,kBAAA,GAAiBA,MAAAA,MAAAA,CAAM;CAC7B,MAAM,cAAcC,aAAAA,eAAe;CACnC,MAAM,kBAAkBC,iBAAAA,mBAAmB;CAC3C,MAAM,CAAC,SAAS,eAAA,GAAcC,MAAAA,SAAAA,CAAkB,KAAK;CACrD,MAAM,CACJ,iBACA,aACA,qBACA,sBACEC,iBAAAA,iBACF,UACA,YACA,oBACA,iBACF;CAEA,OAAO;CACP,sBAAsB,aAAa;CACnC,sBAAsB,aAAa;CAEnC,aAAa,iBAAiB;CAC9B,YAAY,iBAAiB;CAC7B,aA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,kBAAA,IAAA,CAAA,kBAAA,UAAA,EAAA,UAAE,IAAG,CAAA;CACJ,CAAA;MAEZ,OAAO;AACd,GACA,mBACF,CAAC,CAAC;AAIF,MAAa,qBAAqB,aAC/B,UAAU;CACT,MAAM,EAAE,iBAAiB,SAAS,YAAY,gBAAgB,KAAK,CAAC;CAEpE,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACA,gBAAAA,OAAO,MAAR;EACE,IAAI;EACJ,QAAQ,WAAW,UAAU,OAAO;EACpC,GAAI;CACL,CAAA;AAEL,GACA,eACF,CAAC,CAAC;AAIF,MAAa,oBAAoB,aAC9B,UAAU;CACT,MAAM,EAAE,gBAAgB,YAAY,gBAAgB,KAAK,CAAC;CAE1D,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACA,gBAAAA,OAAO,MAAR;EACE,IAAI;EACJ,aAAW,UAAU,WAAW,KAAA;EAChC,QAAQ,CAAC;EACT,GAAI;CACL,CAAA;AAEL,GACA,cACF,CAAC,CAAC"}
@@ -4,7 +4,8 @@ const kbdStyle = require("../../core/system/config.cjs").defineComponentStyle({
4
4
  textStyle: "mono",
5
5
  alignItems: "center",
6
6
  display: "inline-flex",
7
- rounded: "l1"
7
+ rounded: "l1",
8
+ verticalAlign: "middle"
8
9
  },
9
10
  variants: {
10
11
  outline: { layerStyle: "outline" },
@@ -1 +1 @@
1
- {"version":3,"file":"kbd.style.cjs","names":["defineComponentStyle"],"sources":["../../../../src/components/kbd/kbd.style.ts"],"sourcesContent":["import { defineComponentStyle } from \"../../core\"\n\nexport const kbdStyle = defineComponentStyle({\n base: {\n textStyle: \"mono\",\n alignItems: \"center\",\n display: \"inline-flex\",\n rounded: \"l1\",\n },\n\n variants: {\n outline: {\n layerStyle: \"outline\",\n },\n solid: {\n layerStyle: \"solid\",\n },\n subtle: {\n layerStyle: \"subtle\",\n },\n surface: {\n layerStyle: \"surface\",\n },\n },\n\n sizes: {\n sm: {\n fontSize: \"xs\",\n lineHeight: \"{sizes.4}\",\n minH: \"4\",\n px: \"1\",\n },\n md: {\n fontSize: \"sm\",\n lineHeight: \"{sizes.5}\",\n minH: \"5\",\n px: \"1.5\",\n },\n lg: {\n fontSize: \"md\",\n lineHeight: \"{sizes.6}\",\n minH: \"6\",\n px: \"2\",\n },\n },\n\n defaultProps: {\n size: \"md\",\n variant: \"surface\",\n },\n})\n\nexport type KbdStyle = typeof kbdStyle\n"],"mappings":";AAEA,MAAa,iDAAWA,CAAAA,CAAAA,qBAAqB;CAC3C,MAAM;EACJ,WAAW;EACX,YAAY;EACZ,SAAS;EACT,SAAS;CACX;CAEA,UAAU;EACR,SAAS,EACP,YAAY,UACd;EACA,OAAO,EACL,YAAY,QACd;EACA,QAAQ,EACN,YAAY,SACd;EACA,SAAS,EACP,YAAY,UACd;CACF;CAEA,OAAO;EACL,IAAI;GACF,UAAU;GACV,YAAY;GACZ,MAAM;GACN,IAAI;EACN;EACA,IAAI;GACF,UAAU;GACV,YAAY;GACZ,MAAM;GACN,IAAI;EACN;EACA,IAAI;GACF,UAAU;GACV,YAAY;GACZ,MAAM;GACN,IAAI;EACN;CACF;CAEA,cAAc;EACZ,MAAM;EACN,SAAS;CACX;AACF,CAAC"}
1
+ {"version":3,"file":"kbd.style.cjs","names":["defineComponentStyle"],"sources":["../../../../src/components/kbd/kbd.style.ts"],"sourcesContent":["import { defineComponentStyle } from \"../../core\"\n\nexport const kbdStyle = defineComponentStyle({\n base: {\n textStyle: \"mono\",\n alignItems: \"center\",\n display: \"inline-flex\",\n rounded: \"l1\",\n verticalAlign: \"middle\",\n },\n\n variants: {\n outline: {\n layerStyle: \"outline\",\n },\n solid: {\n layerStyle: \"solid\",\n },\n subtle: {\n layerStyle: \"subtle\",\n },\n surface: {\n layerStyle: \"surface\",\n },\n },\n\n sizes: {\n sm: {\n fontSize: \"xs\",\n lineHeight: \"{sizes.4}\",\n minH: \"4\",\n px: \"1\",\n },\n md: {\n fontSize: \"sm\",\n lineHeight: \"{sizes.5}\",\n minH: \"5\",\n px: \"1.5\",\n },\n lg: {\n fontSize: \"md\",\n lineHeight: \"{sizes.6}\",\n minH: \"6\",\n px: \"2\",\n },\n },\n\n defaultProps: {\n size: \"md\",\n variant: \"surface\",\n },\n})\n\nexport type KbdStyle = typeof kbdStyle\n"],"mappings":";AAEA,MAAa,iDAAWA,CAAAA,CAAAA,qBAAqB;CAC3C,MAAM;EACJ,WAAW;EACX,YAAY;EACZ,SAAS;EACT,SAAS;EACT,eAAe;CACjB;CAEA,UAAU;EACR,SAAS,EACP,YAAY,UACd;EACA,OAAO,EACL,YAAY,QACd;EACA,QAAQ,EACN,YAAY,SACd;EACA,SAAS,EACP,YAAY,UACd;CACF;CAEA,OAAO;EACL,IAAI;GACF,UAAU;GACV,YAAY;GACZ,MAAM;GACN,IAAI;EACN;EACA,IAAI;GACF,UAAU;GACV,YAAY;GACZ,MAAM;GACN,IAAI;EACN;EACA,IAAI;GACF,UAAU;GACV,YAAY;GACZ,MAAM;GACN,IAAI;EACN;CACF;CAEA,cAAc;EACZ,MAAM;EACN,SAAS;CACX;AACF,CAAC"}
@@ -1,4 +1,5 @@
1
1
  "use client";
2
+ const require_children = require("../../utils/children.cjs");
2
3
  const require_factory = require("../../core/system/factory.cjs");
3
4
  const require_create_component = require("../../core/components/create-component.cjs");
4
5
  const require_list_style = require("./list.style.cjs");
@@ -52,10 +53,11 @@ const ListItem = withContext(({ children, icon, iconProps, ...rest }) => /* @__P
52
53
  };
53
54
  });
54
55
  const ListItemIcon = withContext(({ children, ...rest }) => {
55
- if ((0, react.isValidElement)(children)) return (0, react.cloneElement)(children, {
56
- ...children.props,
56
+ const child = require_children.getResolvedChild(children);
57
+ if ((0, react.isValidElement)(child)) return (0, react.cloneElement)(child, {
58
+ role: "presentation",
57
59
  ...rest,
58
- role: "presentation"
60
+ ...child.props
59
61
  });
60
62
  else return null;
61
63
  }, "icon")({ "data-list-icon": "" });
@@ -1 +1 @@
1
- {"version":3,"file":"list.cjs","names":["createSlotComponent","listStyle","useMemo","styled","isValidElement","cloneElement"],"sources":["../../../../src/components/list/list.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement } from \"react\"\nimport type {\n CSSProps,\n HTMLProps,\n HTMLStyledProps,\n ThemeProps,\n} from \"../../core\"\nimport type { ListStyle } from \"./list.style\"\nimport { cloneElement, isValidElement, useMemo } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { listStyle } from \"./list.style\"\n\ninterface ComponentContext extends Pick<\n ListRootProps,\n \"iconProps\" | \"itemProps\"\n> {}\n\nexport interface ListItem extends ListItemProps {}\n\nexport interface ListRootProps\n extends HTMLStyledProps<\"ul\">, Omit<ThemeProps<ListStyle>, \"styleType\"> {\n /**\n * If provided, generate elements based on items.\n */\n items?: ListItem[]\n /**\n * The CSS `list-style-position` property.\n */\n stylePosition?: CSSProps[\"listStylePosition\"]\n /**\n * The CSS `list-style-position` property.\n */\n styleType?: CSSProps[\"listStyleType\"]\n /**\n * Props for the icon component.\n */\n iconProps?: ListIconProps\n /**\n * Props for the item component.\n */\n itemProps?: ListItemProps\n}\n\nconst {\n ComponentContext,\n PropsContext: ListPropsContext,\n useComponentContext,\n usePropsContext: useListPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<ListRootProps, ListStyle, ComponentContext>(\n \"list\",\n listStyle,\n)\n\nexport { ListPropsContext, useListPropsContext }\n\n/**\n * `List` is a component for displaying lists. By default, it renders a `ul` element.\n *\n * @see https://yamada-ui.com/docs/components/list\n */\nexport const ListRoot = withProvider<\"ul\", ListRootProps, \"styleType\">(\n ({\n as: asProp,\n children,\n items,\n stylePosition: listStylePosition,\n styleType: listStyleType = \"none\",\n iconProps,\n itemProps,\n ...rest\n }) => {\n const as = asProp ?? (listStyleType == \"decimal\" ? \"ol\" : undefined)\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return items?.map((props, index) => <ListItem key={index} {...props} />)\n }, [children, items])\n const context = useMemo(\n () => ({ iconProps, itemProps }),\n [iconProps, itemProps],\n )\n\n return (\n <ComponentContext value={context}>\n <styled.ul\n as={as}\n listStylePosition={listStylePosition}\n listStyleType={listStyleType}\n role=\"list\"\n {...rest}\n >\n {computedChildren}\n </styled.ul>\n </ComponentContext>\n )\n },\n \"root\",\n { transferProps: [\"styleType\"] },\n)()\n\nexport interface ListItemProps extends HTMLStyledProps<\"li\"> {\n /**\n * The icon to use.\n */\n icon?: ReactElement<any>\n /**\n * Props for the icon component.\n */\n iconProps?: ListIconProps\n}\n\nexport const ListItem = withContext<\"li\", ListItemProps>(\n ({ children, icon, iconProps, ...rest }) => (\n <styled.li {...rest}>\n <ListItemIcon {...iconProps}>{icon}</ListItemIcon>\n\n {children}\n </styled.li>\n ),\n \"item\",\n)((props) => {\n const { iconProps, itemProps } = useComponentContext()\n\n return {\n ...itemProps,\n ...props,\n iconProps: {\n ...iconProps,\n ...itemProps?.iconProps,\n ...props.iconProps,\n },\n }\n})\n\nexport interface ListIconProps extends HTMLStyledProps<\"svg\"> {}\n\nexport const ListItemIcon = withContext<\"svg\", ListIconProps>(\n ({ children, ...rest }) => {\n if (isValidElement<HTMLProps<\"svg\">>(children))\n return cloneElement(children, {\n ...children.props,\n ...rest,\n role: \"presentation\",\n })\n else return null\n },\n \"icon\",\n)({ \"data-list-icon\": \"\" })\n"],"mappings":";;;;;;;AA6CA,MAAM,EACJ,kBACA,cAAc,kBACd,qBACA,iBAAiB,qBACjB,aACA,iBACEA,yBAAAA,oBACF,QACAC,mBAAAA,SACF;;;;;;AASA,MAAa,WAAW,cACrB,EACC,IAAI,QACJ,UACA,OACA,eAAe,mBACf,WAAW,gBAAgB,QAC3B,WACA,WACA,GAAG,WACC;CACJ,MAAM,KAAK,WAAW,iBAAiB,YAAY,OAAO,KAAA;CAC1D,MAAM,oBAAA,GAAmBC,MAAAA,QAAAA,OAAc;EACrC,IAAI,UAAU,OAAO;EAErB,OAAO,OAAO,KAAK,OAAO,UAAU,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD,EAAsB,GAAI,MAAQ,GAAnB,KAAmB,CAAC;CACzE,GAAG,CAAC,UAAU,KAAK,CAAC;CACpB,MAAM,WAAA,GAAUA,MAAAA,QAAAA,QACP;EAAE;EAAW;CAAU,IAC9B,CAAC,WAAW,SAAS,CACvB;CAEA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,kBAAD;EAAkB,OAAO;EACvB,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,gBAAAA,OAAO,IAAR;GACM;GACe;GACJ;GACf,MAAK;GACL,GAAI;GAEH,UAAA;EACQ,CAAA;CACK,CAAA;AAEtB,GACA,QACA,EAAE,eAAe,CAAC,WAAW,EAAE,CACjC,CAAC,CAAC;AAaF,MAAa,WAAW,aACrB,EAAE,UAAU,MAAM,WAAW,GAAG,WAC/B,iBAAA,GAAA,kBAAA,KAAA,CAACA,gBAAAA,OAAO,IAAR;CAAW,GAAI;CAAf,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,cAAD;EAAc,GAAI;EAAY,UAAA;CAAmB,CAAA,GAEhD,QACQ;AAEb,CAAA,GAAA,MACF,CAAC,EAAE,UAAU;CACX,MAAM,EAAE,WAAW,cAAc,oBAAoB;CAErD,OAAO;EACL,GAAG;EACH,GAAG;EACH,WAAW;GACT,GAAG;GACH,GAAG,WAAW;GACd,GAAG,MAAM;EACX;CACF;AACF,CAAC;AAID,MAAa,eAAe,aACzB,EAAE,UAAU,GAAG,WAAW;CACzB,KAAA,GAAIC,MAAAA,eAAAA,CAAiC,QAAQ,GAC3C,QAAA,GAAOC,MAAAA,aAAAA,CAAa,UAAU;EAC5B,GAAG,SAAS;EACZ,GAAG;EACH,MAAM;CACR,CAAC;MACE,OAAO;AACd,GACA,MACF,CAAC,CAAC,EAAE,kBAAkB,GAAG,CAAC"}
1
+ {"version":3,"file":"list.cjs","names":["createSlotComponent","listStyle","useMemo","styled","getResolvedChild","isValidElement","cloneElement"],"sources":["../../../../src/components/list/list.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement } from \"react\"\nimport type {\n CSSProps,\n HTMLProps,\n HTMLStyledProps,\n ThemeProps,\n} from \"../../core\"\nimport type { ListStyle } from \"./list.style\"\nimport { cloneElement, isValidElement, useMemo } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { getResolvedChild } from \"../../utils\"\nimport { listStyle } from \"./list.style\"\n\ninterface ComponentContext extends Pick<\n ListRootProps,\n \"iconProps\" | \"itemProps\"\n> {}\n\nexport interface ListItem extends ListItemProps {}\n\nexport interface ListRootProps\n extends HTMLStyledProps<\"ul\">, Omit<ThemeProps<ListStyle>, \"styleType\"> {\n /**\n * If provided, generate elements based on items.\n */\n items?: ListItem[]\n /**\n * The CSS `list-style-position` property.\n */\n stylePosition?: CSSProps[\"listStylePosition\"]\n /**\n * The CSS `list-style-position` property.\n */\n styleType?: CSSProps[\"listStyleType\"]\n /**\n * Props for the icon component.\n */\n iconProps?: ListIconProps\n /**\n * Props for the item component.\n */\n itemProps?: ListItemProps\n}\n\nconst {\n ComponentContext,\n PropsContext: ListPropsContext,\n useComponentContext,\n usePropsContext: useListPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<ListRootProps, ListStyle, ComponentContext>(\n \"list\",\n listStyle,\n)\n\nexport { ListPropsContext, useListPropsContext }\n\n/**\n * `List` is a component for displaying lists. By default, it renders a `ul` element.\n *\n * @see https://yamada-ui.com/docs/components/list\n */\nexport const ListRoot = withProvider<\"ul\", ListRootProps, \"styleType\">(\n ({\n as: asProp,\n children,\n items,\n stylePosition: listStylePosition,\n styleType: listStyleType = \"none\",\n iconProps,\n itemProps,\n ...rest\n }) => {\n const as = asProp ?? (listStyleType == \"decimal\" ? \"ol\" : undefined)\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return items?.map((props, index) => <ListItem key={index} {...props} />)\n }, [children, items])\n const context = useMemo(\n () => ({ iconProps, itemProps }),\n [iconProps, itemProps],\n )\n\n return (\n <ComponentContext value={context}>\n <styled.ul\n as={as}\n listStylePosition={listStylePosition}\n listStyleType={listStyleType}\n role=\"list\"\n {...rest}\n >\n {computedChildren}\n </styled.ul>\n </ComponentContext>\n )\n },\n \"root\",\n { transferProps: [\"styleType\"] },\n)()\n\nexport interface ListItemProps extends HTMLStyledProps<\"li\"> {\n /**\n * The icon to use.\n */\n icon?: ReactElement<any>\n /**\n * Props for the icon component.\n */\n iconProps?: ListIconProps\n}\n\nexport const ListItem = withContext<\"li\", ListItemProps>(\n ({ children, icon, iconProps, ...rest }) => (\n <styled.li {...rest}>\n <ListItemIcon {...iconProps}>{icon}</ListItemIcon>\n\n {children}\n </styled.li>\n ),\n \"item\",\n)((props) => {\n const { iconProps, itemProps } = useComponentContext()\n\n return {\n ...itemProps,\n ...props,\n iconProps: {\n ...iconProps,\n ...itemProps?.iconProps,\n ...props.iconProps,\n },\n }\n})\n\nexport interface ListIconProps extends HTMLStyledProps<\"svg\"> {}\n\nexport const ListItemIcon = withContext<\"svg\", ListIconProps>(\n ({ children, ...rest }) => {\n const child = getResolvedChild(children)\n\n if (isValidElement<HTMLProps<\"svg\">>(child))\n return cloneElement(child, {\n role: \"presentation\",\n ...rest,\n ...child.props,\n })\n else return null\n },\n \"icon\",\n)({ \"data-list-icon\": \"\" })\n"],"mappings":";;;;;;;;AA8CA,MAAM,EACJ,kBACA,cAAc,kBACd,qBACA,iBAAiB,qBACjB,aACA,iBACEA,yBAAAA,oBACF,QACAC,mBAAAA,SACF;;;;;;AASA,MAAa,WAAW,cACrB,EACC,IAAI,QACJ,UACA,OACA,eAAe,mBACf,WAAW,gBAAgB,QAC3B,WACA,WACA,GAAG,WACC;CACJ,MAAM,KAAK,WAAW,iBAAiB,YAAY,OAAO,KAAA;CAC1D,MAAM,oBAAA,GAAmBC,MAAAA,QAAAA,OAAc;EACrC,IAAI,UAAU,OAAO;EAErB,OAAO,OAAO,KAAK,OAAO,UAAU,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD,EAAsB,GAAI,MAAQ,GAAnB,KAAmB,CAAC;CACzE,GAAG,CAAC,UAAU,KAAK,CAAC;CACpB,MAAM,WAAA,GAAUA,MAAAA,QAAAA,QACP;EAAE;EAAW;CAAU,IAC9B,CAAC,WAAW,SAAS,CACvB;CAEA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,kBAAD;EAAkB,OAAO;EACvB,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,gBAAAA,OAAO,IAAR;GACM;GACe;GACJ;GACf,MAAK;GACL,GAAI;GAEH,UAAA;EACQ,CAAA;CACK,CAAA;AAEtB,GACA,QACA,EAAE,eAAe,CAAC,WAAW,EAAE,CACjC,CAAC,CAAC;AAaF,MAAa,WAAW,aACrB,EAAE,UAAU,MAAM,WAAW,GAAG,WAC/B,iBAAA,GAAA,kBAAA,KAAA,CAACA,gBAAAA,OAAO,IAAR;CAAW,GAAI;CAAf,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,cAAD;EAAc,GAAI;EAAY,UAAA;CAAmB,CAAA,GAEhD,QACQ;AAEb,CAAA,GAAA,MACF,CAAC,EAAE,UAAU;CACX,MAAM,EAAE,WAAW,cAAc,oBAAoB;CAErD,OAAO;EACL,GAAG;EACH,GAAG;EACH,WAAW;GACT,GAAG;GACH,GAAG,WAAW;GACd,GAAG,MAAM;EACX;CACF;AACF,CAAC;AAID,MAAa,eAAe,aACzB,EAAE,UAAU,GAAG,WAAW;CACzB,MAAM,QAAQC,iBAAAA,iBAAiB,QAAQ;CAEvC,KAAA,GAAIC,MAAAA,eAAAA,CAAiC,KAAK,GACxC,QAAA,GAAOC,MAAAA,aAAAA,CAAa,OAAO;EACzB,MAAM;EACN,GAAG;EACH,GAAG,MAAM;CACX,CAAC;MACE,OAAO;AACd,GACA,MACF,CAAC,CAAC,EAAE,kBAAkB,GAAG,CAAC"}
@@ -74,11 +74,12 @@ const NativeAccordionIcon = withContext(({ children = /* @__PURE__ */ (0, react_
74
74
  const { iconHidden } = useComponentContext();
75
75
  const { getIconProps } = useItemComponentContext();
76
76
  if (iconHidden) return null;
77
- if ((0, react.isValidElement)(children)) return (0, react.cloneElement)(children, getIconProps({
77
+ const child = require_children.getResolvedChild(children);
78
+ if ((0, react.isValidElement)(child)) return (0, react.cloneElement)(child, getIconProps({
78
79
  ...rest,
79
- ...children.props
80
+ ...child.props
80
81
  }));
81
- return react.Children.count(children) > 1 ? react.Children.only(null) : null;
82
+ return react.Children.count(child) > 1 ? react.Children.only(null) : null;
82
83
  }, "icon")();
83
84
  const NativeAccordionPanel = withContext(({ children, ...rest }) => {
84
85
  const { getPanelProps } = useItemComponentContext();
@@ -1 +1 @@
1
- {"version":3,"file":"native-accordion.cjs","names":["createContext","createSlotComponent","nativeAccordionStyle","useNativeAccordion","useMemo","NativeAccordionContext","styled","useNativeAccordionItem","useSplitChildren","ChevronDownIcon","isValidElement","cloneElement","Children"],"sources":["../../../../src/components/native-accordion/native-accordion.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactNode } from \"react\"\nimport type { HTMLProps, HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { NativeAccordionStyle } from \"./native-accordion.style\"\nimport type {\n UseNativeAccordionItemProps,\n UseNativeAccordionItemReturn,\n UseNativeAccordionProps,\n} from \"./use-native-accordion\"\nimport { Children, cloneElement, isValidElement, useMemo } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { createContext, useSplitChildren } from \"../../utils\"\nimport { ChevronDownIcon } from \"../icon\"\nimport { nativeAccordionStyle } from \"./native-accordion.style\"\nimport {\n NativeAccordionContext,\n useNativeAccordion,\n useNativeAccordionItem,\n} from \"./use-native-accordion\"\n\nexport interface NativeAccordionItem extends NativeAccordionItemProps {}\n\ninterface ComponentContext extends Pick<\n NativeAccordionRootProps,\n \"icon\" | \"iconHidden\"\n> {}\n\nexport interface NativeAccordionRootProps\n extends\n Omit<HTMLStyledProps, \"onChange\">,\n ThemeProps<NativeAccordionStyle>,\n UseNativeAccordionProps {\n /**\n * The accordion icon for all items to use.\n */\n icon?: ReactNode\n /**\n * If `true`, hide the accordion icon for all items.\n *\n * @default false\n */\n iconHidden?: boolean\n /**\n * If provided, generate elements based on items.\n */\n items?: NativeAccordionItem[]\n}\n\ninterface ItemComponentContext\n extends\n Pick<NativeAccordionItemProps, \"icon\">,\n Omit<UseNativeAccordionItemReturn, \"getItemProps\"> {}\n\nconst [ItemComponentContext, useItemComponentContext] =\n createContext<ItemComponentContext>({\n name: \"ItemComponentContext\",\n })\n\nconst {\n ComponentContext,\n PropsContext: NativeAccordionPropsContext,\n useComponentContext,\n usePropsContext: useNativeAccordionPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<\n NativeAccordionRootProps,\n NativeAccordionStyle,\n ComponentContext\n>(\"native-accordion\", nativeAccordionStyle)\n\nexport { NativeAccordionPropsContext, useNativeAccordionPropsContext }\n\n/**\n * `NativeAccordion` is a component for a list that displays information in an expandable or collapsible manner using the native HTML details element.\n *\n * @see https://yamada-ui.com/docs/components/native-accordion\n */\nexport const NativeAccordionRoot = withProvider<\n \"div\",\n NativeAccordionRootProps\n>(({ children, icon, iconHidden, items, ...props }) => {\n const { name, getRootProps } = useNativeAccordion(props)\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return items?.map((props, index) => (\n <NativeAccordionItem key={index} {...props} />\n ))\n }, [children, items])\n const context = useMemo(() => ({ name }), [name])\n const componentContext = useMemo(\n () => ({ icon, iconHidden }),\n [icon, iconHidden],\n )\n\n return (\n <NativeAccordionContext value={context}>\n <ComponentContext value={componentContext}>\n <styled.div {...getRootProps()}>{computedChildren}</styled.div>\n </ComponentContext>\n </NativeAccordionContext>\n )\n}, \"root\")()\n\nexport interface NativeAccordionItemProps\n extends HTMLStyledProps<\"details\">, UseNativeAccordionItemProps {\n /**\n * The accordion button to use.\n */\n button?: ReactNode\n /**\n * The accordion icon to use.\n */\n icon?: ReactNode\n}\n\nexport const NativeAccordionItem = withContext<\n \"details\",\n NativeAccordionItemProps\n>(({ button, children, icon, ...rest }) => {\n const {\n disabled,\n getButtonProps,\n getIconProps,\n getItemProps,\n getPanelProps,\n } = useNativeAccordionItem(rest)\n const [omittedChildren, customAccordionButton, customAccordionPanel] =\n useSplitChildren(children, NativeAccordionButton, NativeAccordionPanel)\n const context = useMemo(\n () => ({\n disabled,\n icon,\n getButtonProps,\n getIconProps,\n getPanelProps,\n }),\n [disabled, getIconProps, getPanelProps, getButtonProps, icon],\n )\n\n return (\n <ItemComponentContext value={context}>\n <styled.details {...getItemProps()}>\n {customAccordionButton ?? (\n <NativeAccordionButton>{button}</NativeAccordionButton>\n )}\n {customAccordionPanel ?? (\n <NativeAccordionPanel>{omittedChildren}</NativeAccordionPanel>\n )}\n </styled.details>\n </ItemComponentContext>\n )\n}, \"item\")()\n\nexport interface NativeAccordionButtonProps extends HTMLStyledProps<\"summary\"> {\n /**\n * The accordion icon to use.\n */\n icon?: ReactNode\n}\n\nexport const NativeAccordionButton = withContext<\n \"summary\",\n NativeAccordionButtonProps\n>(({ children, icon: customIcon, ...rest }) => {\n const { icon: rootIcon } = useComponentContext()\n const { icon: itemIcon, getButtonProps } = useItemComponentContext()\n\n return (\n <styled.summary {...getButtonProps(rest)}>\n {children}\n\n <NativeAccordionIcon>\n {customIcon ?? itemIcon ?? rootIcon}\n </NativeAccordionIcon>\n </styled.summary>\n )\n}, \"button\")()\n\nexport interface NativeAccordionIconProps extends HTMLStyledProps<\"svg\"> {}\n\nexport const NativeAccordionIcon = withContext<\"svg\", NativeAccordionIconProps>(\n ({ children = <ChevronDownIcon />, ...rest }) => {\n const { iconHidden } = useComponentContext()\n const { getIconProps } = useItemComponentContext()\n\n if (iconHidden) return null\n\n if (isValidElement<HTMLProps<\"svg\">>(children))\n return cloneElement(\n children,\n getIconProps({\n ...rest,\n ...children.props,\n }),\n )\n\n return Children.count(children) > 1 ? Children.only(null) : null\n },\n \"icon\",\n)()\n\nexport interface NativeAccordionPanelProps extends HTMLStyledProps {}\n\nexport const NativeAccordionPanel = withContext<\n \"div\",\n NativeAccordionPanelProps\n>(({ children, ...rest }) => {\n const { getPanelProps } = useItemComponentContext()\n\n return (\n <styled.div {...getPanelProps(rest)}>\n <styled.div>{children}</styled.div>\n </styled.div>\n )\n}, \"panel\")()\n"],"mappings":";;;;;;;;;;;AAsDA,MAAM,CAAC,sBAAsB,2BAC3BA,gBAAAA,cAAoC,EAClC,MAAM,uBACR,CAAC;AAEH,MAAM,EACJ,kBACA,cAAc,6BACd,qBACA,iBAAiB,gCACjB,aACA,iBACEC,yBAAAA,oBAIF,oBAAoBC,+BAAAA,oBAAoB;;;;;;AAS1C,MAAa,sBAAsB,cAGhC,EAAE,UAAU,MAAM,YAAY,OAAO,GAAG,YAAY;CACrD,MAAM,EAAE,MAAM,iBAAiBC,6BAAAA,mBAAmB,KAAK;CACvD,MAAM,oBAAA,GAAmBC,MAAAA,QAAAA,OAAc;EACrC,IAAI,UAAU,OAAO;EAErB,OAAO,OAAO,KAAK,OAAO,UACxB,iBAAA,GAAA,kBAAA,IAAA,CAAC,qBAAD,EAAiC,GAAI,MAAQ,GAAnB,KAAmB,CAC9C;CACH,GAAG,CAAC,UAAU,KAAK,CAAC;CACpB,MAAM,WAAA,GAAUA,MAAAA,QAAAA,QAAe,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC;CAChD,MAAM,oBAAA,GAAmBA,MAAAA,QAAAA,QAChB;EAAE;EAAM;CAAW,IAC1B,CAAC,MAAM,UAAU,CACnB;CAEA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,6BAAAA,wBAAD;EAAwB,OAAO;EAC7B,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,kBAAD;GAAkB,OAAO;GACvB,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,gBAAAA,OAAO,KAAR;IAAY,GAAI,aAAa;IAAI,UAAA;GAA6B,CAAA;EAC9C,CAAA;CACI,CAAA;AAE5B,GAAG,MAAM,CAAC,CAAC;AAcX,MAAa,sBAAsB,aAGhC,EAAE,QAAQ,UAAU,MAAM,G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AI,YAAY,OAAO;CAEvB,KAAA,GAAIC,MAAAA,eAAAA,CAAiC,QAAQ,GAC3C,QAAA,GAAOC,MAAAA,aAAAA,CACL,UACA,aAAa;EACX,GAAG;EACH,GAAG,SAAS;CACd,CAAC,CACH;CAEF,OAAOC,MAAAA,SAAS,MAAM,QAAQ,IAAI,IAAIA,MAAAA,SAAS,KAAK,IAAI,IAAI;AAC9D,GACA,MACF,CAAC,CAAC;AAIF,MAAa,uBAAuB,aAGjC,EAAE,UAAU,GAAG,WAAW;CAC3B,MAAM,EAAE,kBAAkB,wBAAwB;CAElD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACN,gBAAAA,OAAO,KAAR;EAAY,GAAI,cAAc,IAAI;EAChC,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACA,gBAAAA,OAAO,KAAR,EAAa,SAAqB,CAAA;CACxB,CAAA;AAEhB,GAAG,OAAO,CAAC,CAAC"}
1
+ {"version":3,"file":"native-accordion.cjs","names":["createContext","createSlotComponent","nativeAccordionStyle","useNativeAccordion","useMemo","NativeAccordionContext","styled","useNativeAccordionItem","useSplitChildren","ChevronDownIcon","getResolvedChild","isValidElement","cloneElement","Children"],"sources":["../../../../src/components/native-accordion/native-accordion.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactNode } from \"react\"\nimport type { HTMLProps, HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { NativeAccordionStyle } from \"./native-accordion.style\"\nimport type {\n UseNativeAccordionItemProps,\n UseNativeAccordionItemReturn,\n UseNativeAccordionProps,\n} from \"./use-native-accordion\"\nimport { Children, cloneElement, isValidElement, useMemo } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { createContext, getResolvedChild, useSplitChildren } from \"../../utils\"\nimport { ChevronDownIcon } from \"../icon\"\nimport { nativeAccordionStyle } from \"./native-accordion.style\"\nimport {\n NativeAccordionContext,\n useNativeAccordion,\n useNativeAccordionItem,\n} from \"./use-native-accordion\"\n\nexport interface NativeAccordionItem extends NativeAccordionItemProps {}\n\ninterface ComponentContext extends Pick<\n NativeAccordionRootProps,\n \"icon\" | \"iconHidden\"\n> {}\n\nexport interface NativeAccordionRootProps\n extends\n Omit<HTMLStyledProps, \"onChange\">,\n ThemeProps<NativeAccordionStyle>,\n UseNativeAccordionProps {\n /**\n * The accordion icon for all items to use.\n */\n icon?: ReactNode\n /**\n * If `true`, hide the accordion icon for all items.\n *\n * @default false\n */\n iconHidden?: boolean\n /**\n * If provided, generate elements based on items.\n */\n items?: NativeAccordionItem[]\n}\n\ninterface ItemComponentContext\n extends\n Pick<NativeAccordionItemProps, \"icon\">,\n Omit<UseNativeAccordionItemReturn, \"getItemProps\"> {}\n\nconst [ItemComponentContext, useItemComponentContext] =\n createContext<ItemComponentContext>({\n name: \"ItemComponentContext\",\n })\n\nconst {\n ComponentContext,\n PropsContext: NativeAccordionPropsContext,\n useComponentContext,\n usePropsContext: useNativeAccordionPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<\n NativeAccordionRootProps,\n NativeAccordionStyle,\n ComponentContext\n>(\"native-accordion\", nativeAccordionStyle)\n\nexport { NativeAccordionPropsContext, useNativeAccordionPropsContext }\n\n/**\n * `NativeAccordion` is a component for a list that displays information in an expandable or collapsible manner using the native HTML details element.\n *\n * @see https://yamada-ui.com/docs/components/native-accordion\n */\nexport const NativeAccordionRoot = withProvider<\n \"div\",\n NativeAccordionRootProps\n>(({ children, icon, iconHidden, items, ...props }) => {\n const { name, getRootProps } = useNativeAccordion(props)\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return items?.map((props, index) => (\n <NativeAccordionItem key={index} {...props} />\n ))\n }, [children, items])\n const context = useMemo(() => ({ name }), [name])\n const componentContext = useMemo(\n () => ({ icon, iconHidden }),\n [icon, iconHidden],\n )\n\n return (\n <NativeAccordionContext value={context}>\n <ComponentContext value={componentContext}>\n <styled.div {...getRootProps()}>{computedChildren}</styled.div>\n </ComponentContext>\n </NativeAccordionContext>\n )\n}, \"root\")()\n\nexport interface NativeAccordionItemProps\n extends HTMLStyledProps<\"details\">, UseNativeAccordionItemProps {\n /**\n * The accordion button to use.\n */\n button?: ReactNode\n /**\n * The accordion icon to use.\n */\n icon?: ReactNode\n}\n\nexport const NativeAccordionItem = withContext<\n \"details\",\n NativeAccordionItemProps\n>(({ button, children, icon, ...rest }) => {\n const {\n disabled,\n getButtonProps,\n getIconProps,\n getItemProps,\n getPanelProps,\n } = useNativeAccordionItem(rest)\n const [omittedChildren, customAccordionButton, customAccordionPanel] =\n useSplitChildren(children, NativeAccordionButton, NativeAccordionPanel)\n const context = useMemo(\n () => ({\n disabled,\n icon,\n getButtonProps,\n getIconProps,\n getPanelProps,\n }),\n [disabled, getIconProps, getPanelProps, getButtonProps, icon],\n )\n\n return (\n <ItemComponentContext value={context}>\n <styled.details {...getItemProps()}>\n {customAccordionButton ?? (\n <NativeAccordionButton>{button}</NativeAccordionButton>\n )}\n {customAccordionPanel ?? (\n <NativeAccordionPanel>{omittedChildren}</NativeAccordionPanel>\n )}\n </styled.details>\n </ItemComponentContext>\n )\n}, \"item\")()\n\nexport interface NativeAccordionButtonProps extends HTMLStyledProps<\"summary\"> {\n /**\n * The accordion icon to use.\n */\n icon?: ReactNode\n}\n\nexport const NativeAccordionButton = withContext<\n \"summary\",\n NativeAccordionButtonProps\n>(({ children, icon: customIcon, ...rest }) => {\n const { icon: rootIcon } = useComponentContext()\n const { icon: itemIcon, getButtonProps } = useItemComponentContext()\n\n return (\n <styled.summary {...getButtonProps(rest)}>\n {children}\n\n <NativeAccordionIcon>\n {customIcon ?? itemIcon ?? rootIcon}\n </NativeAccordionIcon>\n </styled.summary>\n )\n}, \"button\")()\n\nexport interface NativeAccordionIconProps extends HTMLStyledProps<\"svg\"> {}\n\nexport const NativeAccordionIcon = withContext<\"svg\", NativeAccordionIconProps>(\n ({ children = <ChevronDownIcon />, ...rest }) => {\n const { iconHidden } = useComponentContext()\n const { getIconProps } = useItemComponentContext()\n\n if (iconHidden) return null\n\n const child = getResolvedChild(children)\n\n if (isValidElement<HTMLProps<\"svg\">>(child))\n return cloneElement(child, getIconProps({ ...rest, ...child.props }))\n\n return Children.count(child) > 1 ? Children.only(null) : null\n },\n \"icon\",\n)()\n\nexport interface NativeAccordionPanelProps extends HTMLStyledProps {}\n\nexport const NativeAccordionPanel = withContext<\n \"div\",\n NativeAccordionPanelProps\n>(({ children, ...rest }) => {\n const { getPanelProps } = useItemComponentContext()\n\n return (\n <styled.div {...getPanelProps(rest)}>\n <styled.div>{children}</styled.div>\n </styled.div>\n )\n}, \"panel\")()\n"],"mappings":";;;;;;;;;;;AAsDA,MAAM,CAAC,sBAAsB,2BAC3BA,gBAAAA,cAAoC,EAClC,MAAM,uBACR,CAAC;AAEH,MAAM,EACJ,kBACA,cAAc,6BACd,qBACA,iBAAiB,gCACjB,aACA,iBACEC,yBAAAA,oBAIF,oBAAoBC,+BAAAA,oBAAoB;;;;;;AAS1C,MAAa,sBAAsB,cAGhC,EAAE,UAAU,MAAM,YAAY,OAAO,GAAG,YAAY;CACrD,MAAM,EAAE,MAAM,iBAAiBC,6BAAAA,mBAAmB,KAAK;CACvD,MAAM,oBAAA,GAAmBC,MAAAA,QAAAA,OAAc;EACrC,IAAI,UAAU,OAAO;EAErB,OAAO,OAAO,KAAK,OAAO,UACxB,iBAAA,GAAA,kBAAA,IAAA,CAAC,qBAAD,EAAiC,GAAI,MAAQ,GAAnB,KAAmB,CAC9C;CACH,GAAG,CAAC,UAAU,KAAK,CAAC;CACpB,MAAM,WAAA,GAAUA,MAAAA,QAAAA,QAAe,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC;CAChD,MAAM,oBAAA,GAAmBA,MAAAA,QAAAA,QAChB;EAAE;EAAM;CAAW,IAC1B,CAAC,MAAM,UAAU,CACnB;CAEA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,6BAAAA,wBAAD;EAAwB,OAAO;EAC7B,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,kBAAD;GAAkB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B,GAAG,QAAQ,CAAC,CAAC;AAIb,MAAa,sBAAsB,aAChC,EAAE,WAAW,iBAAA,GAAA,kBAAA,IAAA,CAACG,0BAAAA,iBAAD,CAAkB,CAAA,GAAG,GAAG,WAAW;CAC/C,MAAM,EAAE,eAAe,oBAAoB;CAC3C,MAAM,EAAE,iBAAiB,wBAAwB;CAEjD,IAAI,YAAY,OAAO;CAEvB,MAAM,QAAQC,iBAAAA,iBAAiB,QAAQ;CAEvC,KAAA,GAAIC,MAAAA,eAAAA,CAAiC,KAAK,GACxC,QAAA,GAAOC,MAAAA,aAAAA,CAAa,OAAO,aAAa;EAAE,GAAG;EAAM,GAAG,MAAM;CAAM,CAAC,CAAC;CAEtE,OAAOC,MAAAA,SAAS,MAAM,KAAK,IAAI,IAAIA,MAAAA,SAAS,KAAK,IAAI,IAAI;AAC3D,GACA,MACF,CAAC,CAAC;AAIF,MAAa,uBAAuB,aAGjC,EAAE,UAAU,GAAG,WAAW;CAC3B,MAAM,EAAE,kBAAkB,wBAAwB;CAElD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACP,gBAAAA,OAAO,KAAR;EAAY,GAAI,cAAc,IAAI;EAChC,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACA,gBAAAA,OAAO,KAAR,EAAa,SAAqB,CAAA;CACxB,CAAA;AAEhB,GAAG,OAAO,CAAC,CAAC"}
@@ -626,11 +626,12 @@ const SidebarItemContent = withContext((props) => {
626
626
  const SidebarItemIndicator = withContext(({ children = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_chevron_right_icon.ChevronRightIcon, {}), ...rest }) => {
627
627
  const { indicatorHidden } = useSidePanelComponentContext();
628
628
  if (indicatorHidden) return null;
629
- if ((0, react.isValidElement)(children)) return (0, react.cloneElement)(children, {
629
+ const child = require_children.getResolvedChild(children);
630
+ if ((0, react.isValidElement)(child)) return (0, react.cloneElement)(child, {
630
631
  ...rest,
631
- ...children.props
632
+ ...child.props
632
633
  });
633
- return react.Children.count(children) > 1 ? react.Children.only(null) : null;
634
+ return react.Children.count(child) > 1 ? react.Children.only(null) : null;
634
635
  }, "itemIndicator")(void 0, (props) => {
635
636
  const { indicatorProps } = useItemComponentContext();
636
637
  return require_props.mergeProps(indicatorProps, props)();