@yamada-ui/react 2.2.1-dev-20260510062932 → 2.2.1-dev-20260511103853
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.
- package/dist/cjs/components/accordion/use-accordion.cjs +4 -1
- package/dist/cjs/components/accordion/use-accordion.cjs.map +1 -1
- package/dist/cjs/components/calendar/calendar.cjs +8 -30
- package/dist/cjs/components/calendar/calendar.cjs.map +1 -1
- package/dist/esm/components/accordion/use-accordion.js +4 -1
- package/dist/esm/components/accordion/use-accordion.js.map +1 -1
- package/dist/esm/components/calendar/calendar.js +8 -30
- package/dist/esm/components/calendar/calendar.js.map +1 -1
- package/dist/types/components/accordion/accordion.style.d.ts +1 -1
- package/dist/types/components/autocomplete/autocomplete.style.d.ts +1 -1
- package/dist/types/components/avatar/avatar.d.ts +3 -3
- package/dist/types/components/avatar/avatar.style.d.ts +1 -1
- package/dist/types/components/breadcrumb/breadcrumb.style.d.ts +1 -1
- package/dist/types/components/calendar/calendar.style.d.ts +2 -2
- package/dist/types/components/carousel/carousel.style.d.ts +2 -2
- package/dist/types/components/checkbox/checkbox.d.ts +1 -1
- package/dist/types/components/checkbox-card/checkbox-card.d.ts +1 -1
- package/dist/types/components/data-list/data-list.style.d.ts +1 -1
- package/dist/types/components/flip/flip.d.ts +1 -1
- package/dist/types/components/flip/flip.style.d.ts +1 -1
- package/dist/types/components/icon/icon.d.ts +2 -2
- package/dist/types/components/list/list.style.d.ts +2 -2
- package/dist/types/components/loading/loading.d.ts +1 -1
- package/dist/types/components/menu/menu.style.d.ts +2 -2
- package/dist/types/components/native-accordion/native-accordion.style.d.ts +2 -2
- package/dist/types/components/notice/notice.style.d.ts +1 -1
- package/dist/types/components/pagination/pagination.style.d.ts +1 -1
- package/dist/types/components/radio/radio.d.ts +1 -1
- package/dist/types/components/radio-card/radio-card.d.ts +1 -1
- package/dist/types/components/rating/rating.style.d.ts +2 -2
- package/dist/types/components/reorder/reorder.style.d.ts +1 -1
- package/dist/types/components/resizable/resizable.style.d.ts +2 -2
- package/dist/types/components/segmented-control/segmented-control.style.d.ts +2 -2
- package/dist/types/components/steps/steps.style.d.ts +1 -1
- package/dist/types/components/timeline/timeline.d.ts +1 -1
- package/dist/types/components/timeline/timeline.style.d.ts +1 -1
- package/dist/types/components/toggle/toggle.d.ts +1 -1
- package/dist/types/components/tree/tree.style.d.ts +1 -1
- package/package.json +2 -3
|
@@ -62,11 +62,13 @@ const useAccordionItem = ({ disabled, index, ...rest }) => {
|
|
|
62
62
|
const onClick = (0, react.useCallback)(() => {
|
|
63
63
|
onChange(!open);
|
|
64
64
|
setFocusedIndex(index);
|
|
65
|
+
descendants.value(index)?.node.focus();
|
|
65
66
|
}, [
|
|
66
67
|
index,
|
|
67
68
|
setFocusedIndex,
|
|
68
69
|
open,
|
|
69
|
-
onChange
|
|
70
|
+
onChange,
|
|
71
|
+
descendants
|
|
70
72
|
]);
|
|
71
73
|
const onKeyDown = (0, react.useCallback)((ev) => {
|
|
72
74
|
require_dom.runKeyAction(ev, {
|
|
@@ -91,6 +93,7 @@ const useAccordionItem = ({ disabled, index, ...rest }) => {
|
|
|
91
93
|
"aria-controls": panelId,
|
|
92
94
|
"aria-disabled": (0, require_utils_index.utils_exports.ariaAttr)(!multiple && !toggle && open || disabled),
|
|
93
95
|
"aria-expanded": open,
|
|
96
|
+
tabIndex: 0,
|
|
94
97
|
...props,
|
|
95
98
|
ref: require_ref.mergeRefs(register, ref),
|
|
96
99
|
disabled,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-accordion.cjs","names":["createDescendants","createContext","useControllableState","mergeProps","mergeRefs"],"sources":["../../../../src/components/accordion/use-accordion.ts"],"sourcesContent":["\"use client\"\n\nimport type { KeyboardEvent } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport { useCallback, useEffect, useId, useState } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { createDescendants } from \"../../hooks/use-descendants\"\nimport {\n ariaAttr,\n createContext,\n cx,\n dataAttr,\n handlerAll,\n isArray,\n mergeRefs,\n runKeyAction,\n} from \"../../utils\"\n\nconst {\n DescendantsContext: AccordionDescendantsContext,\n useDescendant: useAccordionDescendant,\n useDescendants: useAccordionDescendants,\n} = createDescendants<HTMLButtonElement>()\n\nexport {\n AccordionDescendantsContext,\n useAccordionDescendant,\n useAccordionDescendants,\n}\n\ninterface AccordionContext extends Omit<\n UseAccordionReturn,\n \"descendants\" | \"getRootProps\"\n> {}\n\nconst [AccordionContext, useAccordionContext] = createContext<AccordionContext>(\n { name: \"AccordionContext\" },\n)\n\nexport { AccordionContext, useAccordionContext }\n\ninterface AccordionItemContext extends Omit<\n UseAccordionItemReturn,\n \"getItemProps\"\n> {}\n\nconst [AccordionItemContext, useAccordionItemContext] =\n createContext<AccordionItemContext>({\n name: \"AccordionItemContext\",\n })\n\nexport { AccordionItemContext, useAccordionItemContext }\n\nexport interface UseAccordionProps extends Omit<HTMLProps, \"onChange\"> {\n /**\n * The initial index(es) of the accordion item to expand.\n */\n defaultIndex?: number | number[]\n /**\n * The index(es) of the accordion item to expand.\n */\n index?: number | number[]\n /**\n * If `true`, multiple accordion items can be expanded at once.\n *\n * @default false\n */\n multiple?: boolean\n /**\n * If `true`, any expanded accordion item can be collapsed again.\n *\n * @default false\n */\n toggle?: boolean\n /**\n * The callback invoked when accordion items are expanded or collapsed.\n */\n onChange?: (index: number | number[]) => void\n}\n\nexport const useAccordion = ({\n defaultIndex: defaultIndexProp,\n index: indexProp,\n multiple,\n toggle,\n onChange,\n ...rest\n}: UseAccordionProps = {}) => {\n if (\n (indexProp || defaultIndexProp) != null &&\n !isArray(indexProp || defaultIndexProp) &&\n multiple\n ) {\n console.warn(\n `Accordion: If 'multiple' is passed, then 'index' or 'defaultIndex' must be an array.`,\n )\n }\n\n if (multiple && toggle) {\n console.warn(\n `Accordion: If 'multiple' is passed, 'toggle' will be ignored. Either remove 'toggle' or 'multiple' depending on whether you want multiple accordions visible or not`,\n )\n }\n\n const descendants = useAccordionDescendants()\n\n const [focusedIndex, setFocusedIndex] = useState<number>(-1)\n\n const [index, setIndex] = useControllableState({\n defaultValue: () =>\n multiple ? (defaultIndexProp ?? []) : (defaultIndexProp ?? -1),\n value: indexProp,\n onChange,\n })\n\n const getRootProps: PropGetter = useCallback(\n (props = {}) => mergeProps(rest, props)(),\n [rest],\n )\n\n useEffect(() => {\n return () => setFocusedIndex(-1)\n }, [])\n\n return {\n descendants,\n focusedIndex,\n index,\n multiple,\n setFocusedIndex,\n setIndex,\n toggle,\n getRootProps,\n }\n}\n\nexport type UseAccordionReturn = ReturnType<typeof useAccordion>\n\nexport interface UseAccordionItemProps extends HTMLProps {\n /**\n * The index of the accordion item.\n */\n index: number\n /**\n * If `true`, the accordion item will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n}\n\nexport const useAccordionItem = ({\n disabled,\n index,\n ...rest\n}: UseAccordionItemProps) => {\n const itemId = useId()\n const panelId = useId()\n const {\n index: selectedIndex,\n multiple,\n setFocusedIndex,\n setIndex,\n toggle,\n } = useAccordionContext()\n const { descendants, register } = useAccordionDescendant({ disabled })\n const open =\n index !== -1\n ? isArray(selectedIndex)\n ? selectedIndex.includes(index)\n : selectedIndex === index\n : false\n\n if (open && disabled)\n console.warn(`Accordion: Cannot open a disabled accordion item`)\n\n const onChange = useCallback(\n (open: boolean) => {\n if (index === -1) return\n\n if (multiple && isArray(selectedIndex)) {\n setIndex(\n open\n ? selectedIndex.concat(index)\n : selectedIndex.filter((i) => i !== index),\n )\n } else if (open) {\n setIndex(index)\n } else if (toggle) {\n setIndex(-1)\n }\n },\n [multiple, toggle, index, selectedIndex, setIndex],\n )\n\n const onFocus = useCallback(() => {\n setFocusedIndex(index)\n }, [setFocusedIndex, index])\n\n const onClick = useCallback(() => {\n onChange(!open)\n setFocusedIndex(index)\n }, [index, setFocusedIndex, open, onChange])\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLButtonElement>) => {\n runKeyAction(ev, {\n ArrowDown: () => {\n const next = descendants.enabledNextValue(index)\n\n next?.node.focus()\n },\n ArrowUp: () => {\n const prev = descendants.enabledPrevValue(index)\n\n prev?.node.focus()\n },\n End: () => {\n const last = descendants.enabledLastValue()\n\n last?.node.focus()\n },\n Home: () => {\n const first = descendants.enabledFirstValue()\n\n first?.node.focus()\n },\n })\n },\n [descendants, index],\n )\n\n const getItemProps: PropGetter = useCallback(\n (props = {}) =>\n mergeProps({ \"data-expanded\": dataAttr(open) }, rest, props)(),\n [open, rest],\n )\n\n const getButtonProps: PropGetter<\"button\"> = useCallback(\n ({ ref, ...props } = {}) => ({\n id: itemId,\n type: \"button\",\n \"aria-controls\": panelId,\n \"aria-disabled\": ariaAttr((!multiple && !toggle && open) || disabled),\n \"aria-expanded\": open,\n ...props,\n ref: mergeRefs(register, ref),\n disabled,\n onClick: handlerAll(props.onClick, onClick),\n onFocus: handlerAll(props.onFocus, onFocus),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n }),\n [\n itemId,\n open,\n panelId,\n multiple,\n toggle,\n disabled,\n register,\n onClick,\n onFocus,\n onKeyDown,\n ],\n )\n\n const getPanelProps: PropGetter = useCallback(\n ({ \"aria-labelledby\": ariaLabelledby, ...props } = {}) => ({\n id: panelId,\n \"aria-labelledby\": cx(ariaLabelledby, itemId),\n role: \"region\",\n ...props,\n }),\n [itemId, panelId],\n )\n\n const getIconProps: PropGetter<\"svg\"> = useCallback(\n (props) => ({\n \"aria-disabled\": ariaAttr((!multiple && !toggle && open) || disabled),\n \"aria-expanded\": open,\n \"aria-hidden\": true,\n role: \"presentation\",\n ...props,\n }),\n [multiple, toggle, open, disabled],\n )\n\n return {\n disabled,\n open,\n getButtonProps,\n getIconProps,\n getItemProps,\n getPanelProps,\n }\n}\n\nexport type UseAccordionItemReturn = ReturnType<typeof useAccordionItem>\n"],"mappings":";;;;;;;;;;;AAmBA,MAAM,EACJ,oBAAoB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AA,UAA2B,CAAC,YAAY,CAAC,UAAU,QAAS,SAAS;EACrE,iBAAiB;EACjB,GAAG;EACH,KAAKC,YAAAA,UAAU,UAAU,IAAI;EAC7B;EACA,UAAA,GAAA,oBAAA,cAAA,YAAoB,MAAM,SAAS,QAAQ;EAC3C,UAAA,GAAA,oBAAA,cAAA,YAAoB,MAAM,SAAS,QAAQ;EAC3C,YAAA,GAAA,oBAAA,cAAA,YAAsB,MAAM,WAAW,UAAU;EAClD,GACD;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CACF;CAED,MAAM,iBAAA,GAAA,MAAA,cACH,EAAE,mBAAmB,gBAAgB,GAAG,UAAU,EAAE,MAAM;EACzD,IAAI;EACJ,oBAAA,GAAA,oBAAA,cAAA,IAAsB,gBAAgB,OAAO;EAC7C,MAAM;EACN,GAAG;EACJ,GACD,CAAC,QAAQ,QAAQ,CAClB;CAaD,OAAO;EACL;EACA;EACA;EACA,eAAA,GAAA,MAAA,cAdC,WAAW;GACV,kBAAA,GAAA,oBAAA,cAAA,UAA2B,CAAC,YAAY,CAAC,UAAU,QAAS,SAAS;GACrE,iBAAiB;GACjB,eAAe;GACf,MAAM;GACN,GAAG;GACJ,GACD;GAAC;GAAU;GAAQ;GAAM;GAAS,CAOtB;EACZ;EACA;EACD"}
|
|
1
|
+
{"version":3,"file":"use-accordion.cjs","names":["createDescendants","createContext","useControllableState","mergeProps","mergeRefs"],"sources":["../../../../src/components/accordion/use-accordion.ts"],"sourcesContent":["\"use client\"\n\nimport type { KeyboardEvent } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport { useCallback, useEffect, useId, useState } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { createDescendants } from \"../../hooks/use-descendants\"\nimport {\n ariaAttr,\n createContext,\n cx,\n dataAttr,\n handlerAll,\n isArray,\n mergeRefs,\n runKeyAction,\n} from \"../../utils\"\n\nconst {\n DescendantsContext: AccordionDescendantsContext,\n useDescendant: useAccordionDescendant,\n useDescendants: useAccordionDescendants,\n} = createDescendants<HTMLButtonElement>()\n\nexport {\n AccordionDescendantsContext,\n useAccordionDescendant,\n useAccordionDescendants,\n}\n\ninterface AccordionContext extends Omit<\n UseAccordionReturn,\n \"descendants\" | \"getRootProps\"\n> {}\n\nconst [AccordionContext, useAccordionContext] = createContext<AccordionContext>(\n { name: \"AccordionContext\" },\n)\n\nexport { AccordionContext, useAccordionContext }\n\ninterface AccordionItemContext extends Omit<\n UseAccordionItemReturn,\n \"getItemProps\"\n> {}\n\nconst [AccordionItemContext, useAccordionItemContext] =\n createContext<AccordionItemContext>({\n name: \"AccordionItemContext\",\n })\n\nexport { AccordionItemContext, useAccordionItemContext }\n\nexport interface UseAccordionProps extends Omit<HTMLProps, \"onChange\"> {\n /**\n * The initial index(es) of the accordion item to expand.\n */\n defaultIndex?: number | number[]\n /**\n * The index(es) of the accordion item to expand.\n */\n index?: number | number[]\n /**\n * If `true`, multiple accordion items can be expanded at once.\n *\n * @default false\n */\n multiple?: boolean\n /**\n * If `true`, any expanded accordion item can be collapsed again.\n *\n * @default false\n */\n toggle?: boolean\n /**\n * The callback invoked when accordion items are expanded or collapsed.\n */\n onChange?: (index: number | number[]) => void\n}\n\nexport const useAccordion = ({\n defaultIndex: defaultIndexProp,\n index: indexProp,\n multiple,\n toggle,\n onChange,\n ...rest\n}: UseAccordionProps = {}) => {\n if (\n (indexProp || defaultIndexProp) != null &&\n !isArray(indexProp || defaultIndexProp) &&\n multiple\n ) {\n console.warn(\n `Accordion: If 'multiple' is passed, then 'index' or 'defaultIndex' must be an array.`,\n )\n }\n\n if (multiple && toggle) {\n console.warn(\n `Accordion: If 'multiple' is passed, 'toggle' will be ignored. Either remove 'toggle' or 'multiple' depending on whether you want multiple accordions visible or not`,\n )\n }\n\n const descendants = useAccordionDescendants()\n\n const [focusedIndex, setFocusedIndex] = useState<number>(-1)\n\n const [index, setIndex] = useControllableState({\n defaultValue: () =>\n multiple ? (defaultIndexProp ?? []) : (defaultIndexProp ?? -1),\n value: indexProp,\n onChange,\n })\n\n const getRootProps: PropGetter = useCallback(\n (props = {}) => mergeProps(rest, props)(),\n [rest],\n )\n\n useEffect(() => {\n return () => setFocusedIndex(-1)\n }, [])\n\n return {\n descendants,\n focusedIndex,\n index,\n multiple,\n setFocusedIndex,\n setIndex,\n toggle,\n getRootProps,\n }\n}\n\nexport type UseAccordionReturn = ReturnType<typeof useAccordion>\n\nexport interface UseAccordionItemProps extends HTMLProps {\n /**\n * The index of the accordion item.\n */\n index: number\n /**\n * If `true`, the accordion item will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n}\n\nexport const useAccordionItem = ({\n disabled,\n index,\n ...rest\n}: UseAccordionItemProps) => {\n const itemId = useId()\n const panelId = useId()\n const {\n index: selectedIndex,\n multiple,\n setFocusedIndex,\n setIndex,\n toggle,\n } = useAccordionContext()\n const { descendants, register } = useAccordionDescendant({ disabled })\n const open =\n index !== -1\n ? isArray(selectedIndex)\n ? selectedIndex.includes(index)\n : selectedIndex === index\n : false\n\n if (open && disabled)\n console.warn(`Accordion: Cannot open a disabled accordion item`)\n\n const onChange = useCallback(\n (open: boolean) => {\n if (index === -1) return\n\n if (multiple && isArray(selectedIndex)) {\n setIndex(\n open\n ? selectedIndex.concat(index)\n : selectedIndex.filter((i) => i !== index),\n )\n } else if (open) {\n setIndex(index)\n } else if (toggle) {\n setIndex(-1)\n }\n },\n [multiple, toggle, index, selectedIndex, setIndex],\n )\n\n const onFocus = useCallback(() => {\n setFocusedIndex(index)\n }, [setFocusedIndex, index])\n\n const onClick = useCallback(() => {\n onChange(!open)\n setFocusedIndex(index)\n descendants.value(index)?.node.focus()\n }, [index, setFocusedIndex, open, onChange, descendants])\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLButtonElement>) => {\n runKeyAction(ev, {\n ArrowDown: () => {\n const next = descendants.enabledNextValue(index)\n\n next?.node.focus()\n },\n ArrowUp: () => {\n const prev = descendants.enabledPrevValue(index)\n\n prev?.node.focus()\n },\n End: () => {\n const last = descendants.enabledLastValue()\n\n last?.node.focus()\n },\n Home: () => {\n const first = descendants.enabledFirstValue()\n\n first?.node.focus()\n },\n })\n },\n [descendants, index],\n )\n\n const getItemProps: PropGetter = useCallback(\n (props = {}) =>\n mergeProps({ \"data-expanded\": dataAttr(open) }, rest, props)(),\n [open, rest],\n )\n\n const getButtonProps: PropGetter<\"button\"> = useCallback(\n ({ ref, ...props } = {}) => ({\n id: itemId,\n type: \"button\",\n \"aria-controls\": panelId,\n \"aria-disabled\": ariaAttr((!multiple && !toggle && open) || disabled),\n \"aria-expanded\": open,\n tabIndex: 0,\n ...props,\n ref: mergeRefs(register, ref),\n disabled,\n onClick: handlerAll(props.onClick, onClick),\n onFocus: handlerAll(props.onFocus, onFocus),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n }),\n [\n itemId,\n open,\n panelId,\n multiple,\n toggle,\n disabled,\n register,\n onClick,\n onFocus,\n onKeyDown,\n ],\n )\n\n const getPanelProps: PropGetter = useCallback(\n ({ \"aria-labelledby\": ariaLabelledby, ...props } = {}) => ({\n id: panelId,\n \"aria-labelledby\": cx(ariaLabelledby, itemId),\n role: \"region\",\n ...props,\n }),\n [itemId, panelId],\n )\n\n const getIconProps: PropGetter<\"svg\"> = useCallback(\n (props) => ({\n \"aria-disabled\": ariaAttr((!multiple && !toggle && open) || disabled),\n \"aria-expanded\": open,\n \"aria-hidden\": true,\n role: \"presentation\",\n ...props,\n }),\n [multiple, toggle, open, disabled],\n )\n\n return {\n disabled,\n open,\n getButtonProps,\n getIconProps,\n getItemProps,\n getPanelProps,\n }\n}\n\nexport type UseAccordionItemReturn = ReturnType<typeof useAccordionItem>\n"],"mappings":";;;;;;;;;;;AAmBA,MAAM,EACJ,oBAAoB,6BACpB,eAAe,wBACf,gBAAgB,4BACdA,oCAAAA,mBAAsC;AAa1C,MAAM,CAAC,kBAAkB,uBAAuBC,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AAS;EACrE,iBAAiB;EACjB,UAAU;EACV,GAAG;EACH,KAAKC,YAAAA,UAAU,UAAU,IAAI;EAC7B;EACA,UAAA,GAAA,oBAAA,cAAA,YAAoB,MAAM,SAAS,QAAQ;EAC3C,UAAA,GAAA,oBAAA,cAAA,YAAoB,MAAM,SAAS,QAAQ;EAC3C,YAAA,GAAA,oBAAA,cAAA,YAAsB,MAAM,WAAW,UAAU;EAClD,GACD;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CACF;CAED,MAAM,iBAAA,GAAA,MAAA,cACH,EAAE,mBAAmB,gBAAgB,GAAG,UAAU,EAAE,MAAM;EACzD,IAAI;EACJ,oBAAA,GAAA,oBAAA,cAAA,IAAsB,gBAAgB,OAAO;EAC7C,MAAM;EACN,GAAG;EACJ,GACD,CAAC,QAAQ,QAAQ,CAClB;CAaD,OAAO;EACL;EACA;EACA;EACA,eAAA,GAAA,MAAA,cAdC,WAAW;GACV,kBAAA,GAAA,oBAAA,cAAA,UAA2B,CAAC,YAAY,CAAC,UAAU,QAAS,SAAS;GACrE,iBAAiB;GACjB,eAAe;GACf,MAAM;GACN,GAAG;GACJ,GACD;GAAC;GAAU;GAAQ;GAAM;GAAS,CAOtB;EACZ;EACA;EACD"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
require("../../_virtual/_rolldown/runtime.cjs");
|
|
3
3
|
const require_utils_index = require("../../utils/index.cjs");
|
|
4
4
|
const require_factory = require("../../core/system/factory.cjs");
|
|
5
|
+
const require_props = require("../../core/components/props.cjs");
|
|
5
6
|
const require_create_component = require("../../core/components/create-component.cjs");
|
|
6
7
|
const require_chevron_left_icon = require("../icon/icons/chevron-left-icon.cjs");
|
|
7
8
|
const require_chevron_right_icon = require("../icon/icons/chevron-right-icon.cjs");
|
|
@@ -143,10 +144,7 @@ const CalendarNavigation = withContext("div", ["row", "navigation"])(void 0, ({
|
|
|
143
144
|
] });
|
|
144
145
|
}, [children]);
|
|
145
146
|
return {
|
|
146
|
-
...getNavigationProps(
|
|
147
|
-
...navigationProps,
|
|
148
|
-
...rest
|
|
149
|
-
}),
|
|
147
|
+
...getNavigationProps(require_props.mergeProps(navigationProps, rest)()),
|
|
150
148
|
children: computedChildren
|
|
151
149
|
};
|
|
152
150
|
});
|
|
@@ -158,8 +156,7 @@ const CalendarControl = withContext("div", "control")(void 0, ({ children, ...re
|
|
|
158
156
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CalendarMonthSelect, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CalendarYearSelect, {})] });
|
|
159
157
|
}, [children, month]);
|
|
160
158
|
return {
|
|
161
|
-
...controlProps,
|
|
162
|
-
...rest,
|
|
159
|
+
...require_props.mergeProps(controlProps, rest)(),
|
|
163
160
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [computedChildren, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.styled.div, { ...getStatusProps() })] })
|
|
164
161
|
};
|
|
165
162
|
});
|
|
@@ -167,22 +164,14 @@ const CalendarPrevButton = withContext("button", ["button", "prev"])(void 0, ({
|
|
|
167
164
|
const { buttonProps, getPrevButtonProps, prevButtonProps } = useComponentContext();
|
|
168
165
|
return {
|
|
169
166
|
children,
|
|
170
|
-
...getPrevButtonProps(
|
|
171
|
-
...buttonProps,
|
|
172
|
-
...prevButtonProps,
|
|
173
|
-
...rest
|
|
174
|
-
})
|
|
167
|
+
...getPrevButtonProps(require_props.mergeProps(buttonProps, prevButtonProps, rest)())
|
|
175
168
|
};
|
|
176
169
|
});
|
|
177
170
|
const CalendarNextButton = withContext("button", ["button", "next"])(void 0, ({ children = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_chevron_right_icon.ChevronRightIcon, {}), ...rest }) => {
|
|
178
171
|
const { buttonProps, getNextButtonProps, nextButtonProps } = useComponentContext();
|
|
179
172
|
return {
|
|
180
173
|
children,
|
|
181
|
-
...getNextButtonProps(
|
|
182
|
-
...buttonProps,
|
|
183
|
-
...nextButtonProps,
|
|
184
|
-
...rest
|
|
185
|
-
})
|
|
174
|
+
...getNextButtonProps(require_props.mergeProps(buttonProps, nextButtonProps, rest)())
|
|
186
175
|
};
|
|
187
176
|
});
|
|
188
177
|
withContext("span", "separator")({
|
|
@@ -191,11 +180,7 @@ withContext("span", "separator")({
|
|
|
191
180
|
});
|
|
192
181
|
const CalendarYearSelect = withContext((props) => {
|
|
193
182
|
const { yearItems, getYearSelectProps, selectProps, yearSelectProps } = useComponentContext();
|
|
194
|
-
const { contentProps, rootProps, ...rest } =
|
|
195
|
-
...selectProps,
|
|
196
|
-
...yearSelectProps,
|
|
197
|
-
...props
|
|
198
|
-
};
|
|
183
|
+
const { contentProps, rootProps, ...rest } = require_props.mergeProps(selectProps, yearSelectProps, props)();
|
|
199
184
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_select.SelectRoot, {
|
|
200
185
|
variant: "plain",
|
|
201
186
|
items: yearItems,
|
|
@@ -215,11 +200,7 @@ const CalendarYearSelect = withContext((props) => {
|
|
|
215
200
|
}, ["select", "years"])();
|
|
216
201
|
const CalendarMonthSelect = withContext((props) => {
|
|
217
202
|
const { monthItems, getMonthSelectProps, monthSelectProps, selectProps } = useComponentContext();
|
|
218
|
-
const { contentProps, rootProps, ...rest } =
|
|
219
|
-
...selectProps,
|
|
220
|
-
...monthSelectProps,
|
|
221
|
-
...props
|
|
222
|
-
};
|
|
203
|
+
const { contentProps, rootProps, ...rest } = require_props.mergeProps(selectProps, monthSelectProps, props)();
|
|
223
204
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_select.SelectRoot, {
|
|
224
205
|
variant: "plain",
|
|
225
206
|
items: monthItems,
|
|
@@ -264,10 +245,7 @@ const CalendarMonth = withContext("table", "month")(void 0, ({ day: dayProp, ...
|
|
|
264
245
|
}, index))
|
|
265
246
|
})] });
|
|
266
247
|
return {
|
|
267
|
-
...getMonthProps(
|
|
268
|
-
...monthProps,
|
|
269
|
-
...rest
|
|
270
|
-
}),
|
|
248
|
+
...getMonthProps(require_props.mergeProps(monthProps, rest)()),
|
|
271
249
|
children
|
|
272
250
|
};
|
|
273
251
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.cjs","names":["createSlotComponent","calendarStyle","useCalendar","CalendarDescendantsContext","CalendarContext","styled","useCalendarContext","ChevronLeftIcon","ChevronRightIcon","resetFieldProps","useCalendarDay"],"sources":["../../../../src/components/calendar/calendar.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement } from \"react\"\nimport type { GenericsComponent, HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { ReactNodeOrFunction } from \"../../utils\"\nimport type { CalendarStyle } from \"./calendar.style\"\nimport type {\n UseCalendarDayProps,\n UseCalendarProps,\n UseCalendarReturn,\n} from \"./use-calendar\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { runIfFn } from \"../../utils\"\nimport { resetFieldProps } from \"../field\"\nimport { ChevronLeftIcon, ChevronRightIcon } from \"../icon\"\nimport { Select } from \"../select\"\nimport { calendarStyle } from \"./calendar.style\"\nimport {\n CalendarContext,\n CalendarDescendantsContext,\n useCalendar,\n useCalendarContext,\n useCalendarDay,\n} from \"./use-calendar\"\n\ninterface ComponentContext\n extends\n Pick<\n UseCalendarReturn,\n | \"getMonthProps\"\n | \"getMonthSelectProps\"\n | \"getNavigationProps\"\n | \"getNextButtonProps\"\n | \"getPrevButtonProps\"\n | \"getStatusProps\"\n | \"getWeekdayProps\"\n | \"getYearSelectProps\"\n | \"monthDays\"\n | \"monthItems\"\n | \"weekdays\"\n | \"yearItems\"\n >,\n Pick<\n CalendarRootProps,\n | \"buttonProps\"\n | \"controlProps\"\n | \"day\"\n | \"dayProps\"\n | \"monthProps\"\n | \"monthSelectProps\"\n | \"navigationProps\"\n | \"nextButtonProps\"\n | \"prevButtonProps\"\n | \"selectProps\"\n | \"weekdayProps\"\n | \"weekdaysProps\"\n | \"weekProps\"\n | \"weeksProps\"\n | \"yearSelectProps\"\n > {}\n\nexport interface CalendarRootProps<\n Multiple extends boolean = false,\n Range extends boolean = false,\n>\n extends\n Omit<HTMLStyledProps, \"defaultValue\" | \"onChange\">,\n ThemeProps<CalendarStyle>,\n UseCalendarProps<Multiple, Range>,\n Pick<CalendarMonthProps, \"day\"> {\n /**\n * Props for the button component.\n */\n buttonProps?: HTMLStyledProps<\"button\">\n /**\n * Props for the control component.\n */\n controlProps?: CalendarControlProps\n /**\n * Props for the day component.\n */\n dayProps?: Omit<CalendarDayProps, \"value\">\n /**\n * Props for the month component.\n */\n monthProps?: CalendarMonthProps\n /**\n * Props for the month select component.\n */\n monthSelectProps?: CalendarMonthSelectProps\n /**\n * Props for the navigation component.\n */\n navigationProps?: Omit<CalendarNavigationProps, \"children\">\n /**\n * Props for the next button component.\n */\n nextButtonProps?: CalendarNextButtonProps\n /**\n * Props for the prev button component.\n */\n prevButtonProps?: CalendarPrevButtonProps\n /**\n * Props for the select component.\n */\n selectProps?: Select.RootProps\n /**\n * Props for the weekday component.\n */\n weekdayProps?: HTMLStyledProps<\"th\">\n /**\n * Props for the weekdays component.\n */\n weekdaysProps?: HTMLStyledProps<\"tr\">\n /**\n * Props for the week component.\n */\n weekProps?: HTMLStyledProps<\"tr\">\n /**\n * Props for the weeks component.\n */\n weeksProps?: HTMLStyledProps<\"tbody\">\n /**\n * Props for the year select component.\n */\n yearSelectProps?: CalendarYearSelectProps\n}\n\nconst {\n ComponentContext,\n PropsContext: CalendarPropsContext,\n useComponentContext,\n usePropsContext: useCalendarPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<CalendarRootProps, CalendarStyle, ComponentContext>(\n \"calendar\",\n calendarStyle,\n)\n\nexport { CalendarPropsContext, useCalendarPropsContext }\n\n/**\n * `Calendar` is a component for displaying or selecting dates in a calendar.\n *\n * @see https://yamada-ui.com/docs/components/calendar\n */\nexport const CalendarRoot = withProvider(\n <Multiple extends boolean = false, Range extends boolean = false>({\n children,\n day,\n buttonProps,\n controlProps,\n dayProps,\n monthProps,\n monthSelectProps,\n navigationProps,\n nextButtonProps,\n prevButtonProps,\n selectProps,\n weekdayProps,\n weekdaysProps,\n weekProps,\n weeksProps,\n yearSelectProps,\n ...props\n }: CalendarRootProps<Multiple, Range>) => {\n const {\n descendants,\n disabled,\n endOfMonth,\n excludeDate,\n holidays,\n locale,\n max,\n maxDate,\n minDate,\n month,\n monthDays,\n monthItems,\n multiple,\n range,\n startDayOfWeek,\n startOfMonth,\n today,\n value,\n weekdays,\n weekendDays,\n yearItems,\n getMonthProps,\n getMonthSelectProps,\n getNavigationProps,\n getNextButtonProps,\n getPrevButtonProps,\n getRootProps,\n getStatusProps,\n getWeekdayProps,\n getYearSelectProps,\n onChange,\n onMonthChange,\n onNextMonth,\n onPrevMonth,\n } = useCalendar(props)\n const calendarContext = useMemo(\n () => ({\n disabled,\n endOfMonth,\n excludeDate,\n holidays,\n locale,\n max,\n maxDate,\n minDate,\n month,\n multiple,\n range,\n startDayOfWeek,\n startOfMonth,\n today,\n value,\n weekendDays,\n onChange,\n onMonthChange,\n onNextMonth,\n onPrevMonth,\n }),\n [\n disabled,\n endOfMonth,\n excludeDate,\n holidays,\n locale,\n max,\n maxDate,\n minDate,\n month,\n multiple,\n range,\n startDayOfWeek,\n startOfMonth,\n today,\n value,\n weekendDays,\n onChange,\n onMonthChange,\n onNextMonth,\n onPrevMonth,\n ],\n )\n const componentContext = useMemo(\n () => ({\n day,\n monthDays,\n monthItems,\n weekdays,\n yearItems,\n buttonProps,\n controlProps,\n dayProps,\n getMonthProps,\n getMonthSelectProps,\n getNavigationProps,\n getNextButtonProps,\n getPrevButtonProps,\n getStatusProps,\n getWeekdayProps,\n getYearSelectProps,\n monthProps,\n monthSelectProps,\n navigationProps,\n nextButtonProps,\n prevButtonProps,\n selectProps,\n weekdayProps,\n weekdaysProps,\n weekProps,\n weeksProps,\n yearSelectProps,\n }),\n [\n day,\n monthDays,\n monthItems,\n weekdays,\n yearItems,\n buttonProps,\n controlProps,\n dayProps,\n getMonthProps,\n getMonthSelectProps,\n getNavigationProps,\n getNextButtonProps,\n getPrevButtonProps,\n getStatusProps,\n getWeekdayProps,\n getYearSelectProps,\n monthProps,\n monthSelectProps,\n navigationProps,\n nextButtonProps,\n prevButtonProps,\n selectProps,\n weekdayProps,\n weekdaysProps,\n weekProps,\n weeksProps,\n yearSelectProps,\n ],\n )\n\n return (\n <CalendarDescendantsContext value={descendants}>\n <CalendarContext value={calendarContext}>\n <ComponentContext value={componentContext}>\n <styled.div {...getRootProps()}>\n {children ?? (\n <>\n <CalendarNavigation />\n <CalendarMonth />\n </>\n )}\n </styled.div>\n </ComponentContext>\n </CalendarContext>\n </CalendarDescendantsContext>\n )\n },\n \"root\",\n)() as GenericsComponent<{\n <Multiple extends boolean = false, Range extends boolean = false>(\n props: CalendarRootProps<Multiple, Range>,\n ): ReactElement\n}>\n\nexport interface CalendarNavigationProps extends HTMLStyledProps {}\n\nexport const CalendarNavigation = withContext<\"div\", CalendarNavigationProps>(\n \"div\",\n [\"row\", \"navigation\"],\n)(undefined, ({ children, ...rest }) => {\n const { getNavigationProps, navigationProps } = useComponentContext()\n\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return (\n <>\n <CalendarPrevButton />\n <CalendarControl />\n <CalendarNextButton />\n </>\n )\n }, [children])\n\n return {\n ...getNavigationProps({ ...navigationProps, ...rest }),\n children: computedChildren,\n }\n})\n\nexport interface CalendarControlProps extends Omit<\n HTMLStyledProps,\n \"children\"\n> {\n /**\n * The control children to use.\n */\n children?: ReactNodeOrFunction<{ month: Date }>\n}\n\nexport const CalendarControl = withContext<\"div\", CalendarControlProps>(\n \"div\",\n \"control\",\n)(undefined, ({ children, ...rest }) => {\n const { month } = useCalendarContext()\n const { controlProps, getStatusProps } = useComponentContext()\n\n const computedChildren = useMemo(() => {\n if (children) return runIfFn(children, { month })\n\n return (\n <>\n <CalendarMonthSelect />\n <CalendarYearSelect />\n </>\n )\n }, [children, month])\n\n return {\n ...controlProps,\n ...rest,\n children: (\n <>\n {computedChildren}\n <styled.div {...getStatusProps()} />\n </>\n ),\n }\n})\n\nexport interface CalendarPrevButtonProps extends HTMLStyledProps<\"button\"> {}\n\nexport const CalendarPrevButton = withContext<\n \"button\",\n CalendarPrevButtonProps\n>(\"button\", [\"button\", \"prev\"])(\n undefined,\n ({ children = <ChevronLeftIcon />, ...rest }) => {\n const { buttonProps, getPrevButtonProps, prevButtonProps } =\n useComponentContext()\n\n return {\n children,\n ...getPrevButtonProps({ ...buttonProps, ...prevButtonProps, ...rest }),\n }\n },\n)\n\nexport interface CalendarNextButtonProps extends HTMLStyledProps<\"button\"> {}\n\nexport const CalendarNextButton = withContext<\n \"button\",\n CalendarNextButtonProps\n>(\"button\", [\"button\", \"next\"])(\n undefined,\n ({ children = <ChevronRightIcon />, ...rest }) => {\n const { buttonProps, getNextButtonProps, nextButtonProps } =\n useComponentContext()\n\n return {\n children,\n ...getNextButtonProps({ ...buttonProps, ...nextButtonProps, ...rest }),\n }\n },\n)\n\nexport interface CalendarSeparatorProps extends HTMLStyledProps<\"span\"> {}\n\nexport const CalendarSeparator = withContext<\"span\", CalendarSeparatorProps>(\n \"span\",\n \"separator\",\n)({ children: \"/\", role: \"separator\" })\n\nexport interface CalendarYearSelectProps extends Select.RootProps {}\n\nexport const CalendarYearSelect = withContext<\"div\", CalendarYearSelectProps>(\n (props) => {\n const { yearItems, getYearSelectProps, selectProps, yearSelectProps } =\n useComponentContext()\n const { contentProps, rootProps, ...rest } = {\n ...selectProps,\n ...yearSelectProps,\n ...props,\n }\n\n return (\n <Select.Root\n variant=\"plain\"\n items={yearItems}\n minH=\"{cell-size}\"\n contentProps={{ minW: \"{select-content-size}\", ...contentProps }}\n rootProps={{\n fontSize: \"{select-font-size}\",\n w: \"{select-root-size}\",\n ...rootProps,\n }}\n {...resetFieldProps}\n {...getYearSelectProps(rest)}\n />\n )\n },\n [\"select\", \"years\"],\n)()\n\nexport interface CalendarMonthSelectProps extends Select.RootProps {}\n\nexport const CalendarMonthSelect = withContext<\"div\", CalendarMonthSelectProps>(\n (props) => {\n const { monthItems, getMonthSelectProps, monthSelectProps, selectProps } =\n useComponentContext()\n const { contentProps, rootProps, ...rest } = {\n ...selectProps,\n ...monthSelectProps,\n ...props,\n }\n\n return (\n <Select.Root\n variant=\"plain\"\n items={monthItems}\n minH=\"{cell-size}\"\n contentProps={{ minW: \"{select-content-size}\", ...contentProps }}\n rootProps={{\n fontSize: \"{select-font-size}\",\n w: \"{select-root-size}\",\n ...rootProps,\n }}\n {...resetFieldProps}\n {...getMonthSelectProps(rest)}\n />\n )\n },\n [\"select\", \"months\"],\n)()\n\nexport interface CalendarMonthProps extends Omit<\n HTMLStyledProps<\"table\">,\n \"children\"\n> {\n /**\n * The day component to use.\n */\n day?: ReactNodeOrFunction<{ value: Date }>\n}\n\nexport const CalendarMonth = withContext<\"table\", CalendarMonthProps>(\n \"table\",\n \"month\",\n)(undefined, ({ day: dayProp, ...rest }) => {\n const {\n day,\n monthDays,\n weekdays,\n dayProps,\n getMonthProps,\n getWeekdayProps,\n monthProps,\n weekdayProps,\n weekdaysProps,\n weekProps,\n weeksProps,\n } = useComponentContext()\n\n dayProp ??= day\n\n const children = (\n <>\n <styled.thead aria-hidden>\n <CalendarWeekDays {...weekdaysProps}>\n {weekdays.map(({ label, value }, index) => (\n <CalendarWeekday\n key={index}\n {...getWeekdayProps({ ...weekdayProps, value })}\n >\n {label}\n </CalendarWeekday>\n ))}\n </CalendarWeekDays>\n </styled.thead>\n\n <CalendarWeeks {...weeksProps}>\n {monthDays.map((week, index) => (\n <CalendarWeek key={index} {...weekProps}>\n {week.map(({ label, value }) => (\n <CalendarDay\n key={value.toDateString()}\n {...{ ...dayProps, value }}\n >\n {runIfFn(dayProp, { value }) ?? (\n <styled.span>{label}</styled.span>\n )}\n </CalendarDay>\n ))}\n </CalendarWeek>\n ))}\n </CalendarWeeks>\n </>\n )\n\n return {\n ...getMonthProps({ ...monthProps, ...rest }),\n children,\n }\n})\n\nconst CalendarWeekDays = withContext(\"tr\", [\"row\", \"weekdays\"])()\n\nconst CalendarWeekday = withContext(\"th\", [\"cell\", \"weekday\"])()\n\nconst CalendarWeeks = withContext(\"tbody\", \"weeks\")()\n\nconst CalendarWeek = withContext(\"tr\", [\"row\", \"week\"])()\n\ninterface CalendarDayProps\n extends Omit<HTMLStyledProps<\"td\">, \"value\">, UseCalendarDayProps {}\n\nconst CalendarDay = withContext<\"td\", CalendarDayProps>(\"td\", [\"cell\", \"day\"])(\n undefined,\n (props) => {\n const { getDayProps } = useCalendarDay(props)\n\n return getDayProps()\n },\n)\n"],"mappings":";;;;;;;;;;;;;;AAiIA,MAAM,EACJ,kBACA,cAAc,sBACd,qBACA,iBAAiB,yBACjB,aACA,iBACEA,yBAAAA,oBACF,YACAC,uBAAAA,cACD;;;;;;AASD,MAAa,eAAe,cACwC,EAChE,UACA,KACA,aACA,cACA,UACA,YACA,kBACA,iBACA,iBACA,iBACA,aACA,cACA,eACA,WACA,YACA,iBACA,GAAG,YACqC;CACxC,MAAM,EACJ,aACA,UACA,YACA,aACA,UACA,QACA,KACA,SACA,SACA,OACA,WACA,YACA,UACA,OACA,gBACA,cACA,OACA,OACA,UACA,aACA,WACA,eACA,qBACA,oBACA,oBACA,oBACA,cACA,gBACA,iBACA,oBACA,UACA,eACA,aACA,gBACEC,qBAAAA,YAAY,MAAM;CA4GtB,OACE,iBAAA,GAAA,kBAAA,KAACC,qBAAAA,4BAAD;EAA4B,OAAO;YACjC,iBAAA,GAAA,kBAAA,KAACC,qBAAAA,iBAAD;GAAiB,QAAA,GAAA,MAAA,gBA5GZ;IACL;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACD,GACD;IACE;I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Q,MAAM,CAAC,CAC5E,KAAA,IACC,UAAU;CACT,MAAM,EAAE,gBAAgBK,qBAAAA,eAAe,MAAM;CAE7C,OAAO,aAAa;EAEvB"}
|
|
1
|
+
{"version":3,"file":"calendar.cjs","names":["createSlotComponent","calendarStyle","useCalendar","CalendarDescendantsContext","CalendarContext","styled","mergeProps","useCalendarContext","ChevronLeftIcon","ChevronRightIcon","resetFieldProps","useCalendarDay"],"sources":["../../../../src/components/calendar/calendar.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement } from \"react\"\nimport type { GenericsComponent, HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { ReactNodeOrFunction } from \"../../utils\"\nimport type { CalendarStyle } from \"./calendar.style\"\nimport type {\n UseCalendarDayProps,\n UseCalendarProps,\n UseCalendarReturn,\n} from \"./use-calendar\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, mergeProps, styled } from \"../../core\"\nimport { runIfFn } from \"../../utils\"\nimport { resetFieldProps } from \"../field\"\nimport { ChevronLeftIcon, ChevronRightIcon } from \"../icon\"\nimport { Select } from \"../select\"\nimport { calendarStyle } from \"./calendar.style\"\nimport {\n CalendarContext,\n CalendarDescendantsContext,\n useCalendar,\n useCalendarContext,\n useCalendarDay,\n} from \"./use-calendar\"\n\ninterface ComponentContext\n extends\n Pick<\n UseCalendarReturn,\n | \"getMonthProps\"\n | \"getMonthSelectProps\"\n | \"getNavigationProps\"\n | \"getNextButtonProps\"\n | \"getPrevButtonProps\"\n | \"getStatusProps\"\n | \"getWeekdayProps\"\n | \"getYearSelectProps\"\n | \"monthDays\"\n | \"monthItems\"\n | \"weekdays\"\n | \"yearItems\"\n >,\n Pick<\n CalendarRootProps,\n | \"buttonProps\"\n | \"controlProps\"\n | \"day\"\n | \"dayProps\"\n | \"monthProps\"\n | \"monthSelectProps\"\n | \"navigationProps\"\n | \"nextButtonProps\"\n | \"prevButtonProps\"\n | \"selectProps\"\n | \"weekdayProps\"\n | \"weekdaysProps\"\n | \"weekProps\"\n | \"weeksProps\"\n | \"yearSelectProps\"\n > {}\n\nexport interface CalendarRootProps<\n Multiple extends boolean = false,\n Range extends boolean = false,\n>\n extends\n Omit<HTMLStyledProps, \"defaultValue\" | \"onChange\">,\n ThemeProps<CalendarStyle>,\n UseCalendarProps<Multiple, Range>,\n Pick<CalendarMonthProps, \"day\"> {\n /**\n * Props for the button component.\n */\n buttonProps?: HTMLStyledProps<\"button\">\n /**\n * Props for the control component.\n */\n controlProps?: CalendarControlProps\n /**\n * Props for the day component.\n */\n dayProps?: Omit<CalendarDayProps, \"value\">\n /**\n * Props for the month component.\n */\n monthProps?: CalendarMonthProps\n /**\n * Props for the month select component.\n */\n monthSelectProps?: CalendarMonthSelectProps\n /**\n * Props for the navigation component.\n */\n navigationProps?: Omit<CalendarNavigationProps, \"children\">\n /**\n * Props for the next button component.\n */\n nextButtonProps?: CalendarNextButtonProps\n /**\n * Props for the prev button component.\n */\n prevButtonProps?: CalendarPrevButtonProps\n /**\n * Props for the select component.\n */\n selectProps?: Select.RootProps\n /**\n * Props for the weekday component.\n */\n weekdayProps?: HTMLStyledProps<\"th\">\n /**\n * Props for the weekdays component.\n */\n weekdaysProps?: HTMLStyledProps<\"tr\">\n /**\n * Props for the week component.\n */\n weekProps?: HTMLStyledProps<\"tr\">\n /**\n * Props for the weeks component.\n */\n weeksProps?: HTMLStyledProps<\"tbody\">\n /**\n * Props for the year select component.\n */\n yearSelectProps?: CalendarYearSelectProps\n}\n\nconst {\n ComponentContext,\n PropsContext: CalendarPropsContext,\n useComponentContext,\n usePropsContext: useCalendarPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<CalendarRootProps, CalendarStyle, ComponentContext>(\n \"calendar\",\n calendarStyle,\n)\n\nexport { CalendarPropsContext, useCalendarPropsContext }\n\n/**\n * `Calendar` is a component for displaying or selecting dates in a calendar.\n *\n * @see https://yamada-ui.com/docs/components/calendar\n */\nexport const CalendarRoot = withProvider(\n <Multiple extends boolean = false, Range extends boolean = false>({\n children,\n day,\n buttonProps,\n controlProps,\n dayProps,\n monthProps,\n monthSelectProps,\n navigationProps,\n nextButtonProps,\n prevButtonProps,\n selectProps,\n weekdayProps,\n weekdaysProps,\n weekProps,\n weeksProps,\n yearSelectProps,\n ...props\n }: CalendarRootProps<Multiple, Range>) => {\n const {\n descendants,\n disabled,\n endOfMonth,\n excludeDate,\n holidays,\n locale,\n max,\n maxDate,\n minDate,\n month,\n monthDays,\n monthItems,\n multiple,\n range,\n startDayOfWeek,\n startOfMonth,\n today,\n value,\n weekdays,\n weekendDays,\n yearItems,\n getMonthProps,\n getMonthSelectProps,\n getNavigationProps,\n getNextButtonProps,\n getPrevButtonProps,\n getRootProps,\n getStatusProps,\n getWeekdayProps,\n getYearSelectProps,\n onChange,\n onMonthChange,\n onNextMonth,\n onPrevMonth,\n } = useCalendar(props)\n const calendarContext = useMemo(\n () => ({\n disabled,\n endOfMonth,\n excludeDate,\n holidays,\n locale,\n max,\n maxDate,\n minDate,\n month,\n multiple,\n range,\n startDayOfWeek,\n startOfMonth,\n today,\n value,\n weekendDays,\n onChange,\n onMonthChange,\n onNextMonth,\n onPrevMonth,\n }),\n [\n disabled,\n endOfMonth,\n excludeDate,\n holidays,\n locale,\n max,\n maxDate,\n minDate,\n month,\n multiple,\n range,\n startDayOfWeek,\n startOfMonth,\n today,\n value,\n weekendDays,\n onChange,\n onMonthChange,\n onNextMonth,\n onPrevMonth,\n ],\n )\n const componentContext = useMemo(\n () => ({\n day,\n monthDays,\n monthItems,\n weekdays,\n yearItems,\n buttonProps,\n controlProps,\n dayProps,\n getMonthProps,\n getMonthSelectProps,\n getNavigationProps,\n getNextButtonProps,\n getPrevButtonProps,\n getStatusProps,\n getWeekdayProps,\n getYearSelectProps,\n monthProps,\n monthSelectProps,\n navigationProps,\n nextButtonProps,\n prevButtonProps,\n selectProps,\n weekdayProps,\n weekdaysProps,\n weekProps,\n weeksProps,\n yearSelectProps,\n }),\n [\n day,\n monthDays,\n monthItems,\n weekdays,\n yearItems,\n buttonProps,\n controlProps,\n dayProps,\n getMonthProps,\n getMonthSelectProps,\n getNavigationProps,\n getNextButtonProps,\n getPrevButtonProps,\n getStatusProps,\n getWeekdayProps,\n getYearSelectProps,\n monthProps,\n monthSelectProps,\n navigationProps,\n nextButtonProps,\n prevButtonProps,\n selectProps,\n weekdayProps,\n weekdaysProps,\n weekProps,\n weeksProps,\n yearSelectProps,\n ],\n )\n\n return (\n <CalendarDescendantsContext value={descendants}>\n <CalendarContext value={calendarContext}>\n <ComponentContext value={componentContext}>\n <styled.div {...getRootProps()}>\n {children ?? (\n <>\n <CalendarNavigation />\n <CalendarMonth />\n </>\n )}\n </styled.div>\n </ComponentContext>\n </CalendarContext>\n </CalendarDescendantsContext>\n )\n },\n \"root\",\n)() as GenericsComponent<{\n <Multiple extends boolean = false, Range extends boolean = false>(\n props: CalendarRootProps<Multiple, Range>,\n ): ReactElement\n}>\n\nexport interface CalendarNavigationProps extends HTMLStyledProps {}\n\nexport const CalendarNavigation = withContext<\"div\", CalendarNavigationProps>(\n \"div\",\n [\"row\", \"navigation\"],\n)(undefined, ({ children, ...rest }) => {\n const { getNavigationProps, navigationProps } = useComponentContext()\n\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return (\n <>\n <CalendarPrevButton />\n <CalendarControl />\n <CalendarNextButton />\n </>\n )\n }, [children])\n\n return {\n ...getNavigationProps(mergeProps(navigationProps, rest)()),\n children: computedChildren,\n }\n})\n\nexport interface CalendarControlProps extends Omit<\n HTMLStyledProps,\n \"children\"\n> {\n /**\n * The control children to use.\n */\n children?: ReactNodeOrFunction<{ month: Date }>\n}\n\nexport const CalendarControl = withContext<\"div\", CalendarControlProps>(\n \"div\",\n \"control\",\n)(undefined, ({ children, ...rest }) => {\n const { month } = useCalendarContext()\n const { controlProps, getStatusProps } = useComponentContext()\n\n const computedChildren = useMemo(() => {\n if (children) return runIfFn(children, { month })\n\n return (\n <>\n <CalendarMonthSelect />\n <CalendarYearSelect />\n </>\n )\n }, [children, month])\n\n return {\n ...mergeProps(controlProps, rest)(),\n children: (\n <>\n {computedChildren}\n <styled.div {...getStatusProps()} />\n </>\n ),\n }\n})\n\nexport interface CalendarPrevButtonProps extends HTMLStyledProps<\"button\"> {}\n\nexport const CalendarPrevButton = withContext<\n \"button\",\n CalendarPrevButtonProps\n>(\"button\", [\"button\", \"prev\"])(\n undefined,\n ({ children = <ChevronLeftIcon />, ...rest }) => {\n const { buttonProps, getPrevButtonProps, prevButtonProps } =\n useComponentContext()\n\n return {\n children,\n ...getPrevButtonProps(mergeProps(buttonProps, prevButtonProps, rest)()),\n }\n },\n)\n\nexport interface CalendarNextButtonProps extends HTMLStyledProps<\"button\"> {}\n\nexport const CalendarNextButton = withContext<\n \"button\",\n CalendarNextButtonProps\n>(\"button\", [\"button\", \"next\"])(\n undefined,\n ({ children = <ChevronRightIcon />, ...rest }) => {\n const { buttonProps, getNextButtonProps, nextButtonProps } =\n useComponentContext()\n\n return {\n children,\n ...getNextButtonProps(mergeProps(buttonProps, nextButtonProps, rest)()),\n }\n },\n)\n\nexport interface CalendarSeparatorProps extends HTMLStyledProps<\"span\"> {}\n\nexport const CalendarSeparator = withContext<\"span\", CalendarSeparatorProps>(\n \"span\",\n \"separator\",\n)({ children: \"/\", role: \"separator\" })\n\nexport interface CalendarYearSelectProps extends Select.RootProps {}\n\nexport const CalendarYearSelect = withContext<\"div\", CalendarYearSelectProps>(\n (props) => {\n const { yearItems, getYearSelectProps, selectProps, yearSelectProps } =\n useComponentContext()\n const { contentProps, rootProps, ...rest } = mergeProps(\n selectProps,\n yearSelectProps,\n props,\n )()\n\n return (\n <Select.Root\n variant=\"plain\"\n items={yearItems}\n minH=\"{cell-size}\"\n contentProps={{ minW: \"{select-content-size}\", ...contentProps }}\n rootProps={{\n fontSize: \"{select-font-size}\",\n w: \"{select-root-size}\",\n ...rootProps,\n }}\n {...resetFieldProps}\n {...getYearSelectProps(rest)}\n />\n )\n },\n [\"select\", \"years\"],\n)()\n\nexport interface CalendarMonthSelectProps extends Select.RootProps {}\n\nexport const CalendarMonthSelect = withContext<\"div\", CalendarMonthSelectProps>(\n (props) => {\n const { monthItems, getMonthSelectProps, monthSelectProps, selectProps } =\n useComponentContext()\n const { contentProps, rootProps, ...rest } = mergeProps(\n selectProps,\n monthSelectProps,\n props,\n )()\n\n return (\n <Select.Root\n variant=\"plain\"\n items={monthItems}\n minH=\"{cell-size}\"\n contentProps={{ minW: \"{select-content-size}\", ...contentProps }}\n rootProps={{\n fontSize: \"{select-font-size}\",\n w: \"{select-root-size}\",\n ...rootProps,\n }}\n {...resetFieldProps}\n {...getMonthSelectProps(rest)}\n />\n )\n },\n [\"select\", \"months\"],\n)()\n\nexport interface CalendarMonthProps extends Omit<\n HTMLStyledProps<\"table\">,\n \"children\"\n> {\n /**\n * The day component to use.\n */\n day?: ReactNodeOrFunction<{ value: Date }>\n}\n\nexport const CalendarMonth = withContext<\"table\", CalendarMonthProps>(\n \"table\",\n \"month\",\n)(undefined, ({ day: dayProp, ...rest }) => {\n const {\n day,\n monthDays,\n weekdays,\n dayProps,\n getMonthProps,\n getWeekdayProps,\n monthProps,\n weekdayProps,\n weekdaysProps,\n weekProps,\n weeksProps,\n } = useComponentContext()\n\n dayProp ??= day\n\n const children = (\n <>\n <styled.thead aria-hidden>\n <CalendarWeekDays {...weekdaysProps}>\n {weekdays.map(({ label, value }, index) => (\n <CalendarWeekday\n key={index}\n {...getWeekdayProps({ ...weekdayProps, value })}\n >\n {label}\n </CalendarWeekday>\n ))}\n </CalendarWeekDays>\n </styled.thead>\n\n <CalendarWeeks {...weeksProps}>\n {monthDays.map((week, index) => (\n <CalendarWeek key={index} {...weekProps}>\n {week.map(({ label, value }) => (\n <CalendarDay\n key={value.toDateString()}\n {...{ ...dayProps, value }}\n >\n {runIfFn(dayProp, { value }) ?? (\n <styled.span>{label}</styled.span>\n )}\n </CalendarDay>\n ))}\n </CalendarWeek>\n ))}\n </CalendarWeeks>\n </>\n )\n\n return {\n ...getMonthProps(mergeProps(monthProps, rest)()),\n children,\n }\n})\n\nconst CalendarWeekDays = withContext(\"tr\", [\"row\", \"weekdays\"])()\n\nconst CalendarWeekday = withContext(\"th\", [\"cell\", \"weekday\"])()\n\nconst CalendarWeeks = withContext(\"tbody\", \"weeks\")()\n\nconst CalendarWeek = withContext(\"tr\", [\"row\", \"week\"])()\n\ninterface CalendarDayProps\n extends Omit<HTMLStyledProps<\"td\">, \"value\">, UseCalendarDayProps {}\n\nconst CalendarDay = withContext<\"td\", CalendarDayProps>(\"td\", [\"cell\", \"day\"])(\n undefined,\n (props) => {\n const { getDayProps } = useCalendarDay(props)\n\n return getDayProps()\n },\n)\n"],"mappings":";;;;;;;;;;;;;;;AAiIA,MAAM,EACJ,kBACA,cAAc,sBACd,qBACA,iBAAiB,yBACjB,aACA,iBACEA,yBAAAA,oBACF,YACAC,uBAAAA,cACD;;;;;;AASD,MAAa,eAAe,cACwC,EAChE,UACA,KACA,aACA,cACA,UACA,YACA,kBACA,iBACA,iBACA,iBACA,aACA,cACA,eACA,WACA,YACA,iBACA,GAAG,YACqC;CACxC,MAAM,EACJ,aACA,UACA,YACA,aACA,UACA,QACA,KACA,SACA,SACA,OACA,WACA,YACA,UACA,OACA,gBACA,cACA,OACA,OACA,UACA,aACA,WACA,eACA,qBACA,oBACA,oBACA,oBACA,cACA,gBACA,iBACA,oBACA,UACA,eACA,aACA,gBACEC,qBAAAA,YAAY,MAAM;CA4GtB,OACE,iBAAA,GAAA,kBAAA,KAACC,qBAAAA,4BAAD;EAA4B,OAAO;YACjC,iBAAA,GAAA,kBAAA,KAACC,qBAAAA,iBAAD;GAAiB,QAAA,GAAA,MAAA,gBA5GZ;IACL;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACD,GACD;IACE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAC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K,qBAAAA,eAAe,MAAM;CAE7C,OAAO,aAAa;EAEvB"}
|
|
@@ -61,11 +61,13 @@ const useAccordionItem = ({ disabled, index, ...rest }) => {
|
|
|
61
61
|
const onClick = useCallback(() => {
|
|
62
62
|
onChange(!open);
|
|
63
63
|
setFocusedIndex(index);
|
|
64
|
+
descendants.value(index)?.node.focus();
|
|
64
65
|
}, [
|
|
65
66
|
index,
|
|
66
67
|
setFocusedIndex,
|
|
67
68
|
open,
|
|
68
|
-
onChange
|
|
69
|
+
onChange,
|
|
70
|
+
descendants
|
|
69
71
|
]);
|
|
70
72
|
const onKeyDown = useCallback((ev) => {
|
|
71
73
|
runKeyAction(ev, {
|
|
@@ -90,6 +92,7 @@ const useAccordionItem = ({ disabled, index, ...rest }) => {
|
|
|
90
92
|
"aria-controls": panelId,
|
|
91
93
|
"aria-disabled": (0, utils_exports.ariaAttr)(!multiple && !toggle && open || disabled),
|
|
92
94
|
"aria-expanded": open,
|
|
95
|
+
tabIndex: 0,
|
|
93
96
|
...props,
|
|
94
97
|
ref: mergeRefs(register, ref),
|
|
95
98
|
disabled,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-accordion.js","names":["createContext"],"sources":["../../../../src/components/accordion/use-accordion.ts"],"sourcesContent":["\"use client\"\n\nimport type { KeyboardEvent } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport { useCallback, useEffect, useId, useState } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { createDescendants } from \"../../hooks/use-descendants\"\nimport {\n ariaAttr,\n createContext,\n cx,\n dataAttr,\n handlerAll,\n isArray,\n mergeRefs,\n runKeyAction,\n} from \"../../utils\"\n\nconst {\n DescendantsContext: AccordionDescendantsContext,\n useDescendant: useAccordionDescendant,\n useDescendants: useAccordionDescendants,\n} = createDescendants<HTMLButtonElement>()\n\nexport {\n AccordionDescendantsContext,\n useAccordionDescendant,\n useAccordionDescendants,\n}\n\ninterface AccordionContext extends Omit<\n UseAccordionReturn,\n \"descendants\" | \"getRootProps\"\n> {}\n\nconst [AccordionContext, useAccordionContext] = createContext<AccordionContext>(\n { name: \"AccordionContext\" },\n)\n\nexport { AccordionContext, useAccordionContext }\n\ninterface AccordionItemContext extends Omit<\n UseAccordionItemReturn,\n \"getItemProps\"\n> {}\n\nconst [AccordionItemContext, useAccordionItemContext] =\n createContext<AccordionItemContext>({\n name: \"AccordionItemContext\",\n })\n\nexport { AccordionItemContext, useAccordionItemContext }\n\nexport interface UseAccordionProps extends Omit<HTMLProps, \"onChange\"> {\n /**\n * The initial index(es) of the accordion item to expand.\n */\n defaultIndex?: number | number[]\n /**\n * The index(es) of the accordion item to expand.\n */\n index?: number | number[]\n /**\n * If `true`, multiple accordion items can be expanded at once.\n *\n * @default false\n */\n multiple?: boolean\n /**\n * If `true`, any expanded accordion item can be collapsed again.\n *\n * @default false\n */\n toggle?: boolean\n /**\n * The callback invoked when accordion items are expanded or collapsed.\n */\n onChange?: (index: number | number[]) => void\n}\n\nexport const useAccordion = ({\n defaultIndex: defaultIndexProp,\n index: indexProp,\n multiple,\n toggle,\n onChange,\n ...rest\n}: UseAccordionProps = {}) => {\n if (\n (indexProp || defaultIndexProp) != null &&\n !isArray(indexProp || defaultIndexProp) &&\n multiple\n ) {\n console.warn(\n `Accordion: If 'multiple' is passed, then 'index' or 'defaultIndex' must be an array.`,\n )\n }\n\n if (multiple && toggle) {\n console.warn(\n `Accordion: If 'multiple' is passed, 'toggle' will be ignored. Either remove 'toggle' or 'multiple' depending on whether you want multiple accordions visible or not`,\n )\n }\n\n const descendants = useAccordionDescendants()\n\n const [focusedIndex, setFocusedIndex] = useState<number>(-1)\n\n const [index, setIndex] = useControllableState({\n defaultValue: () =>\n multiple ? (defaultIndexProp ?? []) : (defaultIndexProp ?? -1),\n value: indexProp,\n onChange,\n })\n\n const getRootProps: PropGetter = useCallback(\n (props = {}) => mergeProps(rest, props)(),\n [rest],\n )\n\n useEffect(() => {\n return () => setFocusedIndex(-1)\n }, [])\n\n return {\n descendants,\n focusedIndex,\n index,\n multiple,\n setFocusedIndex,\n setIndex,\n toggle,\n getRootProps,\n }\n}\n\nexport type UseAccordionReturn = ReturnType<typeof useAccordion>\n\nexport interface UseAccordionItemProps extends HTMLProps {\n /**\n * The index of the accordion item.\n */\n index: number\n /**\n * If `true`, the accordion item will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n}\n\nexport const useAccordionItem = ({\n disabled,\n index,\n ...rest\n}: UseAccordionItemProps) => {\n const itemId = useId()\n const panelId = useId()\n const {\n index: selectedIndex,\n multiple,\n setFocusedIndex,\n setIndex,\n toggle,\n } = useAccordionContext()\n const { descendants, register } = useAccordionDescendant({ disabled })\n const open =\n index !== -1\n ? isArray(selectedIndex)\n ? selectedIndex.includes(index)\n : selectedIndex === index\n : false\n\n if (open && disabled)\n console.warn(`Accordion: Cannot open a disabled accordion item`)\n\n const onChange = useCallback(\n (open: boolean) => {\n if (index === -1) return\n\n if (multiple && isArray(selectedIndex)) {\n setIndex(\n open\n ? selectedIndex.concat(index)\n : selectedIndex.filter((i) => i !== index),\n )\n } else if (open) {\n setIndex(index)\n } else if (toggle) {\n setIndex(-1)\n }\n },\n [multiple, toggle, index, selectedIndex, setIndex],\n )\n\n const onFocus = useCallback(() => {\n setFocusedIndex(index)\n }, [setFocusedIndex, index])\n\n const onClick = useCallback(() => {\n onChange(!open)\n setFocusedIndex(index)\n }, [index, setFocusedIndex, open, onChange])\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLButtonElement>) => {\n runKeyAction(ev, {\n ArrowDown: () => {\n const next = descendants.enabledNextValue(index)\n\n next?.node.focus()\n },\n ArrowUp: () => {\n const prev = descendants.enabledPrevValue(index)\n\n prev?.node.focus()\n },\n End: () => {\n const last = descendants.enabledLastValue()\n\n last?.node.focus()\n },\n Home: () => {\n const first = descendants.enabledFirstValue()\n\n first?.node.focus()\n },\n })\n },\n [descendants, index],\n )\n\n const getItemProps: PropGetter = useCallback(\n (props = {}) =>\n mergeProps({ \"data-expanded\": dataAttr(open) }, rest, props)(),\n [open, rest],\n )\n\n const getButtonProps: PropGetter<\"button\"> = useCallback(\n ({ ref, ...props } = {}) => ({\n id: itemId,\n type: \"button\",\n \"aria-controls\": panelId,\n \"aria-disabled\": ariaAttr((!multiple && !toggle && open) || disabled),\n \"aria-expanded\": open,\n ...props,\n ref: mergeRefs(register, ref),\n disabled,\n onClick: handlerAll(props.onClick, onClick),\n onFocus: handlerAll(props.onFocus, onFocus),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n }),\n [\n itemId,\n open,\n panelId,\n multiple,\n toggle,\n disabled,\n register,\n onClick,\n onFocus,\n onKeyDown,\n ],\n )\n\n const getPanelProps: PropGetter = useCallback(\n ({ \"aria-labelledby\": ariaLabelledby, ...props } = {}) => ({\n id: panelId,\n \"aria-labelledby\": cx(ariaLabelledby, itemId),\n role: \"region\",\n ...props,\n }),\n [itemId, panelId],\n )\n\n const getIconProps: PropGetter<\"svg\"> = useCallback(\n (props) => ({\n \"aria-disabled\": ariaAttr((!multiple && !toggle && open) || disabled),\n \"aria-expanded\": open,\n \"aria-hidden\": true,\n role: \"presentation\",\n ...props,\n }),\n [multiple, toggle, open, disabled],\n )\n\n return {\n disabled,\n open,\n getButtonProps,\n getIconProps,\n getItemProps,\n getPanelProps,\n }\n}\n\nexport type UseAccordionItemReturn = ReturnType<typeof useAccordionItem>\n"],"mappings":";;;;;;;;;;AAmBA,MAAM,EACJ,oBAAoB,6BACpB,eAAe,wBACf,gBAAgB,4BACd,mBAAsC;AAa1C,MAAM,CAAC,kBAAkB,uBAAuBA,gBAC9C,EAAE,MAAM,oBAAoB,CAC7B;AASD,MAAM,CAAC,sBAAsB,2BAC3BA,gBAAoC,EAClC,MAAM,wBACP,CAAC;AA+BJ,MAAa,gBAAgB,EAC3B,cAAc,kBACd,OAAO,WACP,UACA,QACA,UACA,GAAG,SACkB,EAAE,KAAK;CA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,QAAQ,QAAQ,CAClB;CAaD,OAAO;EACL;EACA;EACA;EACA,cAfsC,aACrC,WAAW;GACV,kBAAA,GAAA,cAAA,UAA2B,CAAC,YAAY,CAAC,UAAU,QAAS,SAAS;GACrE,iBAAiB;GACjB,eAAe;GACf,MAAM;GACN,GAAG;GACJ,GACD;GAAC;GAAU;GAAQ;GAAM;GAAS,CAOtB;EACZ;EACA;EACD"}
|
|
1
|
+
{"version":3,"file":"use-accordion.js","names":["createContext"],"sources":["../../../../src/components/accordion/use-accordion.ts"],"sourcesContent":["\"use client\"\n\nimport type { KeyboardEvent } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport { useCallback, useEffect, useId, useState } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { createDescendants } from \"../../hooks/use-descendants\"\nimport {\n ariaAttr,\n createContext,\n cx,\n dataAttr,\n handlerAll,\n isArray,\n mergeRefs,\n runKeyAction,\n} from \"../../utils\"\n\nconst {\n DescendantsContext: AccordionDescendantsContext,\n useDescendant: useAccordionDescendant,\n useDescendants: useAccordionDescendants,\n} = createDescendants<HTMLButtonElement>()\n\nexport {\n AccordionDescendantsContext,\n useAccordionDescendant,\n useAccordionDescendants,\n}\n\ninterface AccordionContext extends Omit<\n UseAccordionReturn,\n \"descendants\" | \"getRootProps\"\n> {}\n\nconst [AccordionContext, useAccordionContext] = createContext<AccordionContext>(\n { name: \"AccordionContext\" },\n)\n\nexport { AccordionContext, useAccordionContext }\n\ninterface AccordionItemContext extends Omit<\n UseAccordionItemReturn,\n \"getItemProps\"\n> {}\n\nconst [AccordionItemContext, useAccordionItemContext] =\n createContext<AccordionItemContext>({\n name: \"AccordionItemContext\",\n })\n\nexport { AccordionItemContext, useAccordionItemContext }\n\nexport interface UseAccordionProps extends Omit<HTMLProps, \"onChange\"> {\n /**\n * The initial index(es) of the accordion item to expand.\n */\n defaultIndex?: number | number[]\n /**\n * The index(es) of the accordion item to expand.\n */\n index?: number | number[]\n /**\n * If `true`, multiple accordion items can be expanded at once.\n *\n * @default false\n */\n multiple?: boolean\n /**\n * If `true`, any expanded accordion item can be collapsed again.\n *\n * @default false\n */\n toggle?: boolean\n /**\n * The callback invoked when accordion items are expanded or collapsed.\n */\n onChange?: (index: number | number[]) => void\n}\n\nexport const useAccordion = ({\n defaultIndex: defaultIndexProp,\n index: indexProp,\n multiple,\n toggle,\n onChange,\n ...rest\n}: UseAccordionProps = {}) => {\n if (\n (indexProp || defaultIndexProp) != null &&\n !isArray(indexProp || defaultIndexProp) &&\n multiple\n ) {\n console.warn(\n `Accordion: If 'multiple' is passed, then 'index' or 'defaultIndex' must be an array.`,\n )\n }\n\n if (multiple && toggle) {\n console.warn(\n `Accordion: If 'multiple' is passed, 'toggle' will be ignored. Either remove 'toggle' or 'multiple' depending on whether you want multiple accordions visible or not`,\n )\n }\n\n const descendants = useAccordionDescendants()\n\n const [focusedIndex, setFocusedIndex] = useState<number>(-1)\n\n const [index, setIndex] = useControllableState({\n defaultValue: () =>\n multiple ? (defaultIndexProp ?? []) : (defaultIndexProp ?? -1),\n value: indexProp,\n onChange,\n })\n\n const getRootProps: PropGetter = useCallback(\n (props = {}) => mergeProps(rest, props)(),\n [rest],\n )\n\n useEffect(() => {\n return () => setFocusedIndex(-1)\n }, [])\n\n return {\n descendants,\n focusedIndex,\n index,\n multiple,\n setFocusedIndex,\n setIndex,\n toggle,\n getRootProps,\n }\n}\n\nexport type UseAccordionReturn = ReturnType<typeof useAccordion>\n\nexport interface UseAccordionItemProps extends HTMLProps {\n /**\n * The index of the accordion item.\n */\n index: number\n /**\n * If `true`, the accordion item will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n}\n\nexport const useAccordionItem = ({\n disabled,\n index,\n ...rest\n}: UseAccordionItemProps) => {\n const itemId = useId()\n const panelId = useId()\n const {\n index: selectedIndex,\n multiple,\n setFocusedIndex,\n setIndex,\n toggle,\n } = useAccordionContext()\n const { descendants, register } = useAccordionDescendant({ disabled })\n const open =\n index !== -1\n ? isArray(selectedIndex)\n ? selectedIndex.includes(index)\n : selectedIndex === index\n : false\n\n if (open && disabled)\n console.warn(`Accordion: Cannot open a disabled accordion item`)\n\n const onChange = useCallback(\n (open: boolean) => {\n if (index === -1) return\n\n if (multiple && isArray(selectedIndex)) {\n setIndex(\n open\n ? selectedIndex.concat(index)\n : selectedIndex.filter((i) => i !== index),\n )\n } else if (open) {\n setIndex(index)\n } else if (toggle) {\n setIndex(-1)\n }\n },\n [multiple, toggle, index, selectedIndex, setIndex],\n )\n\n const onFocus = useCallback(() => {\n setFocusedIndex(index)\n }, [setFocusedIndex, index])\n\n const onClick = useCallback(() => {\n onChange(!open)\n setFocusedIndex(index)\n descendants.value(index)?.node.focus()\n }, [index, setFocusedIndex, open, onChange, descendants])\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLButtonElement>) => {\n runKeyAction(ev, {\n ArrowDown: () => {\n const next = descendants.enabledNextValue(index)\n\n next?.node.focus()\n },\n ArrowUp: () => {\n const prev = descendants.enabledPrevValue(index)\n\n prev?.node.focus()\n },\n End: () => {\n const last = descendants.enabledLastValue()\n\n last?.node.focus()\n },\n Home: () => {\n const first = descendants.enabledFirstValue()\n\n first?.node.focus()\n },\n })\n },\n [descendants, index],\n )\n\n const getItemProps: PropGetter = useCallback(\n (props = {}) =>\n mergeProps({ \"data-expanded\": dataAttr(open) }, rest, props)(),\n [open, rest],\n )\n\n const getButtonProps: PropGetter<\"button\"> = useCallback(\n ({ ref, ...props } = {}) => ({\n id: itemId,\n type: \"button\",\n \"aria-controls\": panelId,\n \"aria-disabled\": ariaAttr((!multiple && !toggle && open) || disabled),\n \"aria-expanded\": open,\n tabIndex: 0,\n ...props,\n ref: mergeRefs(register, ref),\n disabled,\n onClick: handlerAll(props.onClick, onClick),\n onFocus: handlerAll(props.onFocus, onFocus),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n }),\n [\n itemId,\n open,\n panelId,\n multiple,\n toggle,\n disabled,\n register,\n onClick,\n onFocus,\n onKeyDown,\n ],\n )\n\n const getPanelProps: PropGetter = useCallback(\n ({ \"aria-labelledby\": ariaLabelledby, ...props } = {}) => ({\n id: panelId,\n \"aria-labelledby\": cx(ariaLabelledby, itemId),\n role: \"region\",\n ...props,\n }),\n [itemId, panelId],\n )\n\n const getIconProps: PropGetter<\"svg\"> = useCallback(\n (props) => ({\n \"aria-disabled\": ariaAttr((!multiple && !toggle && open) || disabled),\n \"aria-expanded\": open,\n \"aria-hidden\": true,\n role: \"presentation\",\n ...props,\n }),\n [multiple, toggle, open, disabled],\n )\n\n return {\n disabled,\n open,\n getButtonProps,\n getIconProps,\n getItemProps,\n getPanelProps,\n }\n}\n\nexport type UseAccordionItemReturn = ReturnType<typeof useAccordionItem>\n"],"mappings":";;;;;;;;;;AAmBA,MAAM,EACJ,oBAAoB,6BACpB,eAAe,wBACf,gBAAgB,4BACd,mBAAsC;AAa1C,MAAM,CAAC,kBAAkB,uBAAuBA,gBAC9C,EAAE,MAAM,oBAAoB,CAC7B;AASD,MAAM,CAAC,sBAAsB,2BAC3BA,gBAAoC,EAClC,MAAM,wBACP,CAAC;AA+BJ,MAAa,gBAAgB,EAC3B,cAAc,kBACd,OAAO,WACP,UACA,QACA,UACA,GAAG,SACkB,EAAE,KAAK;CAC5B,KACG,aAAa,qBAAqB,QACnC,EAAA,GAAA,cAAA,SAAS,aAAa,iBAAiB,IACvC,UAEA,QAAQ,KACN,uFACD;CAGH,IAAI,YAAY,QACd,QAAQ,KACN,sKACD;CAGH,MAAM,cAAc,yBAAyB;CAE7C,MAAM,CAAC,cAAc,mBAAmB,SAAiB,GAAG;CAE5D,MAAM,CAAC,OAAO,YAAY,qBAAqB;EAC7C,oBACE,WAAY,oBAAoB,EAAE,GAAK,oBAAoB;EAC7D,OAAO;EACP;EACD,CAAC;CAEF,MAAM,eAA2B,aAC9B,QAAQ,EAAE,KAAK,WAAW,MAAM,MAAM,EAAE,EACzC,CAAC,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} from "../../core/system/factory.js";
|
|
4
|
+
import { mergeProps } from "../../core/components/props.js";
|
|
4
5
|
import { createSlotComponent } from "../../core/components/create-component.js";
|
|
5
6
|
import { ChevronLeftIcon } from "../icon/icons/chevron-left-icon.js";
|
|
6
7
|
import { ChevronRightIcon } from "../icon/icons/chevron-right-icon.js";
|
|
@@ -142,10 +143,7 @@ const CalendarNavigation = withContext("div", ["row", "navigation"])(void 0, ({
|
|
|
142
143
|
] });
|
|
143
144
|
}, [children]);
|
|
144
145
|
return {
|
|
145
|
-
...getNavigationProps(
|
|
146
|
-
...navigationProps,
|
|
147
|
-
...rest
|
|
148
|
-
}),
|
|
146
|
+
...getNavigationProps(mergeProps(navigationProps, rest)()),
|
|
149
147
|
children: computedChildren
|
|
150
148
|
};
|
|
151
149
|
});
|
|
@@ -157,8 +155,7 @@ const CalendarControl = withContext("div", "control")(void 0, ({ children, ...re
|
|
|
157
155
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(CalendarMonthSelect, {}), /* @__PURE__ */ jsx(CalendarYearSelect, {})] });
|
|
158
156
|
}, [children, month]);
|
|
159
157
|
return {
|
|
160
|
-
...controlProps,
|
|
161
|
-
...rest,
|
|
158
|
+
...mergeProps(controlProps, rest)(),
|
|
162
159
|
children: /* @__PURE__ */ jsxs(Fragment$1, { children: [computedChildren, /* @__PURE__ */ jsx(styled.div, { ...getStatusProps() })] })
|
|
163
160
|
};
|
|
164
161
|
});
|
|
@@ -166,22 +163,14 @@ const CalendarPrevButton = withContext("button", ["button", "prev"])(void 0, ({
|
|
|
166
163
|
const { buttonProps, getPrevButtonProps, prevButtonProps } = useComponentContext();
|
|
167
164
|
return {
|
|
168
165
|
children,
|
|
169
|
-
...getPrevButtonProps(
|
|
170
|
-
...buttonProps,
|
|
171
|
-
...prevButtonProps,
|
|
172
|
-
...rest
|
|
173
|
-
})
|
|
166
|
+
...getPrevButtonProps(mergeProps(buttonProps, prevButtonProps, rest)())
|
|
174
167
|
};
|
|
175
168
|
});
|
|
176
169
|
const CalendarNextButton = withContext("button", ["button", "next"])(void 0, ({ children = /* @__PURE__ */ jsx(ChevronRightIcon, {}), ...rest }) => {
|
|
177
170
|
const { buttonProps, getNextButtonProps, nextButtonProps } = useComponentContext();
|
|
178
171
|
return {
|
|
179
172
|
children,
|
|
180
|
-
...getNextButtonProps(
|
|
181
|
-
...buttonProps,
|
|
182
|
-
...nextButtonProps,
|
|
183
|
-
...rest
|
|
184
|
-
})
|
|
173
|
+
...getNextButtonProps(mergeProps(buttonProps, nextButtonProps, rest)())
|
|
185
174
|
};
|
|
186
175
|
});
|
|
187
176
|
withContext("span", "separator")({
|
|
@@ -190,11 +179,7 @@ withContext("span", "separator")({
|
|
|
190
179
|
});
|
|
191
180
|
const CalendarYearSelect = withContext((props) => {
|
|
192
181
|
const { yearItems, getYearSelectProps, selectProps, yearSelectProps } = useComponentContext();
|
|
193
|
-
const { contentProps, rootProps, ...rest } =
|
|
194
|
-
...selectProps,
|
|
195
|
-
...yearSelectProps,
|
|
196
|
-
...props
|
|
197
|
-
};
|
|
182
|
+
const { contentProps, rootProps, ...rest } = mergeProps(selectProps, yearSelectProps, props)();
|
|
198
183
|
return /* @__PURE__ */ jsx(SelectRoot, {
|
|
199
184
|
variant: "plain",
|
|
200
185
|
items: yearItems,
|
|
@@ -214,11 +199,7 @@ const CalendarYearSelect = withContext((props) => {
|
|
|
214
199
|
}, ["select", "years"])();
|
|
215
200
|
const CalendarMonthSelect = withContext((props) => {
|
|
216
201
|
const { monthItems, getMonthSelectProps, monthSelectProps, selectProps } = useComponentContext();
|
|
217
|
-
const { contentProps, rootProps, ...rest } =
|
|
218
|
-
...selectProps,
|
|
219
|
-
...monthSelectProps,
|
|
220
|
-
...props
|
|
221
|
-
};
|
|
202
|
+
const { contentProps, rootProps, ...rest } = mergeProps(selectProps, monthSelectProps, props)();
|
|
222
203
|
return /* @__PURE__ */ jsx(SelectRoot, {
|
|
223
204
|
variant: "plain",
|
|
224
205
|
items: monthItems,
|
|
@@ -263,10 +244,7 @@ const CalendarMonth = withContext("table", "month")(void 0, ({ day: dayProp, ...
|
|
|
263
244
|
}, index))
|
|
264
245
|
})] });
|
|
265
246
|
return {
|
|
266
|
-
...getMonthProps(
|
|
267
|
-
...monthProps,
|
|
268
|
-
...rest
|
|
269
|
-
}),
|
|
247
|
+
...getMonthProps(mergeProps(monthProps, rest)()),
|
|
270
248
|
children
|
|
271
249
|
};
|
|
272
250
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.js","names":["Select.Root"],"sources":["../../../../src/components/calendar/calendar.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement } from \"react\"\nimport type { GenericsComponent, HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { ReactNodeOrFunction } from \"../../utils\"\nimport type { CalendarStyle } from \"./calendar.style\"\nimport type {\n UseCalendarDayProps,\n UseCalendarProps,\n UseCalendarReturn,\n} from \"./use-calendar\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { runIfFn } from \"../../utils\"\nimport { resetFieldProps } from \"../field\"\nimport { ChevronLeftIcon, ChevronRightIcon } from \"../icon\"\nimport { Select } from \"../select\"\nimport { calendarStyle } from \"./calendar.style\"\nimport {\n CalendarContext,\n CalendarDescendantsContext,\n useCalendar,\n useCalendarContext,\n useCalendarDay,\n} from \"./use-calendar\"\n\ninterface ComponentContext\n extends\n Pick<\n UseCalendarReturn,\n | \"getMonthProps\"\n | \"getMonthSelectProps\"\n | \"getNavigationProps\"\n | \"getNextButtonProps\"\n | \"getPrevButtonProps\"\n | \"getStatusProps\"\n | \"getWeekdayProps\"\n | \"getYearSelectProps\"\n | \"monthDays\"\n | \"monthItems\"\n | \"weekdays\"\n | \"yearItems\"\n >,\n Pick<\n CalendarRootProps,\n | \"buttonProps\"\n | \"controlProps\"\n | \"day\"\n | \"dayProps\"\n | \"monthProps\"\n | \"monthSelectProps\"\n | \"navigationProps\"\n | \"nextButtonProps\"\n | \"prevButtonProps\"\n | \"selectProps\"\n | \"weekdayProps\"\n | \"weekdaysProps\"\n | \"weekProps\"\n | \"weeksProps\"\n | \"yearSelectProps\"\n > {}\n\nexport interface CalendarRootProps<\n Multiple extends boolean = false,\n Range extends boolean = false,\n>\n extends\n Omit<HTMLStyledProps, \"defaultValue\" | \"onChange\">,\n ThemeProps<CalendarStyle>,\n UseCalendarProps<Multiple, Range>,\n Pick<CalendarMonthProps, \"day\"> {\n /**\n * Props for the button component.\n */\n buttonProps?: HTMLStyledProps<\"button\">\n /**\n * Props for the control component.\n */\n controlProps?: CalendarControlProps\n /**\n * Props for the day component.\n */\n dayProps?: Omit<CalendarDayProps, \"value\">\n /**\n * Props for the month component.\n */\n monthProps?: CalendarMonthProps\n /**\n * Props for the month select component.\n */\n monthSelectProps?: CalendarMonthSelectProps\n /**\n * Props for the navigation component.\n */\n navigationProps?: Omit<CalendarNavigationProps, \"children\">\n /**\n * Props for the next button component.\n */\n nextButtonProps?: CalendarNextButtonProps\n /**\n * Props for the prev button component.\n */\n prevButtonProps?: CalendarPrevButtonProps\n /**\n * Props for the select component.\n */\n selectProps?: Select.RootProps\n /**\n * Props for the weekday component.\n */\n weekdayProps?: HTMLStyledProps<\"th\">\n /**\n * Props for the weekdays component.\n */\n weekdaysProps?: HTMLStyledProps<\"tr\">\n /**\n * Props for the week component.\n */\n weekProps?: HTMLStyledProps<\"tr\">\n /**\n * Props for the weeks component.\n */\n weeksProps?: HTMLStyledProps<\"tbody\">\n /**\n * Props for the year select component.\n */\n yearSelectProps?: CalendarYearSelectProps\n}\n\nconst {\n ComponentContext,\n PropsContext: CalendarPropsContext,\n useComponentContext,\n usePropsContext: useCalendarPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<CalendarRootProps, CalendarStyle, ComponentContext>(\n \"calendar\",\n calendarStyle,\n)\n\nexport { CalendarPropsContext, useCalendarPropsContext }\n\n/**\n * `Calendar` is a component for displaying or selecting dates in a calendar.\n *\n * @see https://yamada-ui.com/docs/components/calendar\n */\nexport const CalendarRoot = withProvider(\n <Multiple extends boolean = false, Range extends boolean = false>({\n children,\n day,\n buttonProps,\n controlProps,\n dayProps,\n monthProps,\n monthSelectProps,\n navigationProps,\n nextButtonProps,\n prevButtonProps,\n selectProps,\n weekdayProps,\n weekdaysProps,\n weekProps,\n weeksProps,\n yearSelectProps,\n ...props\n }: CalendarRootProps<Multiple, Range>) => {\n const {\n descendants,\n disabled,\n endOfMonth,\n excludeDate,\n holidays,\n locale,\n max,\n maxDate,\n minDate,\n month,\n monthDays,\n monthItems,\n multiple,\n range,\n startDayOfWeek,\n startOfMonth,\n today,\n value,\n weekdays,\n weekendDays,\n yearItems,\n getMonthProps,\n getMonthSelectProps,\n getNavigationProps,\n getNextButtonProps,\n getPrevButtonProps,\n getRootProps,\n getStatusProps,\n getWeekdayProps,\n getYearSelectProps,\n onChange,\n onMonthChange,\n onNextMonth,\n onPrevMonth,\n } = useCalendar(props)\n const calendarContext = useMemo(\n () => ({\n disabled,\n endOfMonth,\n excludeDate,\n holidays,\n locale,\n max,\n maxDate,\n minDate,\n month,\n multiple,\n range,\n startDayOfWeek,\n startOfMonth,\n today,\n value,\n weekendDays,\n onChange,\n onMonthChange,\n onNextMonth,\n onPrevMonth,\n }),\n [\n disabled,\n endOfMonth,\n excludeDate,\n holidays,\n locale,\n max,\n maxDate,\n minDate,\n month,\n multiple,\n range,\n startDayOfWeek,\n startOfMonth,\n today,\n value,\n weekendDays,\n onChange,\n onMonthChange,\n onNextMonth,\n onPrevMonth,\n ],\n )\n const componentContext = useMemo(\n () => ({\n day,\n monthDays,\n monthItems,\n weekdays,\n yearItems,\n buttonProps,\n controlProps,\n dayProps,\n getMonthProps,\n getMonthSelectProps,\n getNavigationProps,\n getNextButtonProps,\n getPrevButtonProps,\n getStatusProps,\n getWeekdayProps,\n getYearSelectProps,\n monthProps,\n monthSelectProps,\n navigationProps,\n nextButtonProps,\n prevButtonProps,\n selectProps,\n weekdayProps,\n weekdaysProps,\n weekProps,\n weeksProps,\n yearSelectProps,\n }),\n [\n day,\n monthDays,\n monthItems,\n weekdays,\n yearItems,\n buttonProps,\n controlProps,\n dayProps,\n getMonthProps,\n getMonthSelectProps,\n getNavigationProps,\n getNextButtonProps,\n getPrevButtonProps,\n getStatusProps,\n getWeekdayProps,\n getYearSelectProps,\n monthProps,\n monthSelectProps,\n navigationProps,\n nextButtonProps,\n prevButtonProps,\n selectProps,\n weekdayProps,\n weekdaysProps,\n weekProps,\n weeksProps,\n yearSelectProps,\n ],\n )\n\n return (\n <CalendarDescendantsContext value={descendants}>\n <CalendarContext value={calendarContext}>\n <ComponentContext value={componentContext}>\n <styled.div {...getRootProps()}>\n {children ?? (\n <>\n <CalendarNavigation />\n <CalendarMonth />\n </>\n )}\n </styled.div>\n </ComponentContext>\n </CalendarContext>\n </CalendarDescendantsContext>\n )\n },\n \"root\",\n)() as GenericsComponent<{\n <Multiple extends boolean = false, Range extends boolean = false>(\n props: CalendarRootProps<Multiple, Range>,\n ): ReactElement\n}>\n\nexport interface CalendarNavigationProps extends HTMLStyledProps {}\n\nexport const CalendarNavigation = withContext<\"div\", CalendarNavigationProps>(\n \"div\",\n [\"row\", \"navigation\"],\n)(undefined, ({ children, ...rest }) => {\n const { getNavigationProps, navigationProps } = useComponentContext()\n\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return (\n <>\n <CalendarPrevButton />\n <CalendarControl />\n <CalendarNextButton />\n </>\n )\n }, [children])\n\n return {\n ...getNavigationProps({ ...navigationProps, ...rest }),\n children: computedChildren,\n }\n})\n\nexport interface CalendarControlProps extends Omit<\n HTMLStyledProps,\n \"children\"\n> {\n /**\n * The control children to use.\n */\n children?: ReactNodeOrFunction<{ month: Date }>\n}\n\nexport const CalendarControl = withContext<\"div\", CalendarControlProps>(\n \"div\",\n \"control\",\n)(undefined, ({ children, ...rest }) => {\n const { month } = useCalendarContext()\n const { controlProps, getStatusProps } = useComponentContext()\n\n const computedChildren = useMemo(() => {\n if (children) return runIfFn(children, { month })\n\n return (\n <>\n <CalendarMonthSelect />\n <CalendarYearSelect />\n </>\n )\n }, [children, month])\n\n return {\n ...controlProps,\n ...rest,\n children: (\n <>\n {computedChildren}\n <styled.div {...getStatusProps()} />\n </>\n ),\n }\n})\n\nexport interface CalendarPrevButtonProps extends HTMLStyledProps<\"button\"> {}\n\nexport const CalendarPrevButton = withContext<\n \"button\",\n CalendarPrevButtonProps\n>(\"button\", [\"button\", \"prev\"])(\n undefined,\n ({ children = <ChevronLeftIcon />, ...rest }) => {\n const { buttonProps, getPrevButtonProps, prevButtonProps } =\n useComponentContext()\n\n return {\n children,\n ...getPrevButtonProps({ ...buttonProps, ...prevButtonProps, ...rest }),\n }\n },\n)\n\nexport interface CalendarNextButtonProps extends HTMLStyledProps<\"button\"> {}\n\nexport const CalendarNextButton = withContext<\n \"button\",\n CalendarNextButtonProps\n>(\"button\", [\"button\", \"next\"])(\n undefined,\n ({ children = <ChevronRightIcon />, ...rest }) => {\n const { buttonProps, getNextButtonProps, nextButtonProps } =\n useComponentContext()\n\n return {\n children,\n ...getNextButtonProps({ ...buttonProps, ...nextButtonProps, ...rest }),\n }\n },\n)\n\nexport interface CalendarSeparatorProps extends HTMLStyledProps<\"span\"> {}\n\nexport const CalendarSeparator = withContext<\"span\", CalendarSeparatorProps>(\n \"span\",\n \"separator\",\n)({ children: \"/\", role: \"separator\" })\n\nexport interface CalendarYearSelectProps extends Select.RootProps {}\n\nexport const CalendarYearSelect = withContext<\"div\", CalendarYearSelectProps>(\n (props) => {\n const { yearItems, getYearSelectProps, selectProps, yearSelectProps } =\n useComponentContext()\n const { contentProps, rootProps, ...rest } = {\n ...selectProps,\n ...yearSelectProps,\n ...props,\n }\n\n return (\n <Select.Root\n variant=\"plain\"\n items={yearItems}\n minH=\"{cell-size}\"\n contentProps={{ minW: \"{select-content-size}\", ...contentProps }}\n rootProps={{\n fontSize: \"{select-font-size}\",\n w: \"{select-root-size}\",\n ...rootProps,\n }}\n {...resetFieldProps}\n {...getYearSelectProps(rest)}\n />\n )\n },\n [\"select\", \"years\"],\n)()\n\nexport interface CalendarMonthSelectProps extends Select.RootProps {}\n\nexport const CalendarMonthSelect = withContext<\"div\", CalendarMonthSelectProps>(\n (props) => {\n const { monthItems, getMonthSelectProps, monthSelectProps, selectProps } =\n useComponentContext()\n const { contentProps, rootProps, ...rest } = {\n ...selectProps,\n ...monthSelectProps,\n ...props,\n }\n\n return (\n <Select.Root\n variant=\"plain\"\n items={monthItems}\n minH=\"{cell-size}\"\n contentProps={{ minW: \"{select-content-size}\", ...contentProps }}\n rootProps={{\n fontSize: \"{select-font-size}\",\n w: \"{select-root-size}\",\n ...rootProps,\n }}\n {...resetFieldProps}\n {...getMonthSelectProps(rest)}\n />\n )\n },\n [\"select\", \"months\"],\n)()\n\nexport interface CalendarMonthProps extends Omit<\n HTMLStyledProps<\"table\">,\n \"children\"\n> {\n /**\n * The day component to use.\n */\n day?: ReactNodeOrFunction<{ value: Date }>\n}\n\nexport const CalendarMonth = withContext<\"table\", CalendarMonthProps>(\n \"table\",\n \"month\",\n)(undefined, ({ day: dayProp, ...rest }) => {\n const {\n day,\n monthDays,\n weekdays,\n dayProps,\n getMonthProps,\n getWeekdayProps,\n monthProps,\n weekdayProps,\n weekdaysProps,\n weekProps,\n weeksProps,\n } = useComponentContext()\n\n dayProp ??= day\n\n const children = (\n <>\n <styled.thead aria-hidden>\n <CalendarWeekDays {...weekdaysProps}>\n {weekdays.map(({ label, value }, index) => (\n <CalendarWeekday\n key={index}\n {...getWeekdayProps({ ...weekdayProps, value })}\n >\n {label}\n </CalendarWeekday>\n ))}\n </CalendarWeekDays>\n </styled.thead>\n\n <CalendarWeeks {...weeksProps}>\n {monthDays.map((week, index) => (\n <CalendarWeek key={index} {...weekProps}>\n {week.map(({ label, value }) => (\n <CalendarDay\n key={value.toDateString()}\n {...{ ...dayProps, value }}\n >\n {runIfFn(dayProp, { value }) ?? (\n <styled.span>{label}</styled.span>\n )}\n </CalendarDay>\n ))}\n </CalendarWeek>\n ))}\n </CalendarWeeks>\n </>\n )\n\n return {\n ...getMonthProps({ ...monthProps, ...rest }),\n children,\n }\n})\n\nconst CalendarWeekDays = withContext(\"tr\", [\"row\", \"weekdays\"])()\n\nconst CalendarWeekday = withContext(\"th\", [\"cell\", \"weekday\"])()\n\nconst CalendarWeeks = withContext(\"tbody\", \"weeks\")()\n\nconst CalendarWeek = withContext(\"tr\", [\"row\", \"week\"])()\n\ninterface CalendarDayProps\n extends Omit<HTMLStyledProps<\"td\">, \"value\">, UseCalendarDayProps {}\n\nconst CalendarDay = withContext<\"td\", CalendarDayProps>(\"td\", [\"cell\", \"day\"])(\n undefined,\n (props) => {\n const { getDayProps } = useCalendarDay(props)\n\n return getDayProps()\n },\n)\n"],"mappings":";;;;;;;;;;;;;AAiIA,MAAM,EACJ,kBACA,cAAc,sBACd,qBACA,iBAAiB,yBACjB,aACA,iBACE,oBACF,YACA,cACD;;;;;;AASD,MAAa,eAAe,cACwC,EAChE,UACA,KACA,aACA,cACA,UACA,YACA,kBACA,iBACA,iBACA,iBACA,aACA,cACA,eACA,WACA,YACA,iBACA,GAAG,YACqC;CACxC,MAAM,EACJ,aACA,UACA,YACA,aACA,UACA,QACA,KACA,SACA,SACA,OACA,WACA,YACA,UACA,OACA,gBACA,cACA,OACA,OACA,UACA,aACA,WACA,eACA,qBACA,oBACA,oBACA,oBACA,cACA,gBACA,iBACA,oBACA,UACA,eACA,aACA,gBACE,YAAY,MAAM;CA4GtB,OACE,oBAAC,4BAAD;EAA4B,OAAO;YACjC,oBAAC,iBAAD;GAAiB,OA7GG,eACf;IACL;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACD,GACD;IACE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACD,CAiEwC;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AAoB,CAAA;IAExB,EANP,MAAM,cAAc,CAMb,CACd;GACW,EAXI,MAWJ,CACf;EACY,CAAA,CACf,EAAA,CAAA;CAGL,OAAO;EACL,GAAG,cAAc;GAAE,GAAG;GAAY,GAAG;GAAM,CAAC;EAC5C;EACD;EACD;AAEF,MAAM,mBAAmB,YAAY,MAAM,CAAC,OAAO,WAAW,CAAC,EAAE;AAEjE,MAAM,kBAAkB,YAAY,MAAM,CAAC,QAAQ,UAAU,CAAC,EAAE;AAEhE,MAAM,gBAAgB,YAAY,SAAS,QAAQ,EAAE;AAErD,MAAM,eAAe,YAAY,MAAM,CAAC,OAAO,OAAO,CAAC,EAAE;AAKzD,MAAM,cAAc,YAAoC,MAAM,CAAC,QAAQ,MAAM,CAAC,CAC5E,KAAA,IACC,UAAU;CACT,MAAM,EAAE,gBAAgB,eAAe,MAAM;CAE7C,OAAO,aAAa;EAEvB"}
|
|
1
|
+
{"version":3,"file":"calendar.js","names":["Select.Root"],"sources":["../../../../src/components/calendar/calendar.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement } from \"react\"\nimport type { GenericsComponent, HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { ReactNodeOrFunction } from \"../../utils\"\nimport type { CalendarStyle } from \"./calendar.style\"\nimport type {\n UseCalendarDayProps,\n UseCalendarProps,\n UseCalendarReturn,\n} from \"./use-calendar\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, mergeProps, styled } from \"../../core\"\nimport { runIfFn } from \"../../utils\"\nimport { resetFieldProps } from \"../field\"\nimport { ChevronLeftIcon, ChevronRightIcon } from \"../icon\"\nimport { Select } from \"../select\"\nimport { calendarStyle } from \"./calendar.style\"\nimport {\n CalendarContext,\n CalendarDescendantsContext,\n useCalendar,\n useCalendarContext,\n useCalendarDay,\n} from \"./use-calendar\"\n\ninterface ComponentContext\n extends\n Pick<\n UseCalendarReturn,\n | \"getMonthProps\"\n | \"getMonthSelectProps\"\n | \"getNavigationProps\"\n | \"getNextButtonProps\"\n | \"getPrevButtonProps\"\n | \"getStatusProps\"\n | \"getWeekdayProps\"\n | \"getYearSelectProps\"\n | \"monthDays\"\n | \"monthItems\"\n | \"weekdays\"\n | \"yearItems\"\n >,\n Pick<\n CalendarRootProps,\n | \"buttonProps\"\n | \"controlProps\"\n | \"day\"\n | \"dayProps\"\n | \"monthProps\"\n | \"monthSelectProps\"\n | \"navigationProps\"\n | \"nextButtonProps\"\n | \"prevButtonProps\"\n | \"selectProps\"\n | \"weekdayProps\"\n | \"weekdaysProps\"\n | \"weekProps\"\n | \"weeksProps\"\n | \"yearSelectProps\"\n > {}\n\nexport interface CalendarRootProps<\n Multiple extends boolean = false,\n Range extends boolean = false,\n>\n extends\n Omit<HTMLStyledProps, \"defaultValue\" | \"onChange\">,\n ThemeProps<CalendarStyle>,\n UseCalendarProps<Multiple, Range>,\n Pick<CalendarMonthProps, \"day\"> {\n /**\n * Props for the button component.\n */\n buttonProps?: HTMLStyledProps<\"button\">\n /**\n * Props for the control component.\n */\n controlProps?: CalendarControlProps\n /**\n * Props for the day component.\n */\n dayProps?: Omit<CalendarDayProps, \"value\">\n /**\n * Props for the month component.\n */\n monthProps?: CalendarMonthProps\n /**\n * Props for the month select component.\n */\n monthSelectProps?: CalendarMonthSelectProps\n /**\n * Props for the navigation component.\n */\n navigationProps?: Omit<CalendarNavigationProps, \"children\">\n /**\n * Props for the next button component.\n */\n nextButtonProps?: CalendarNextButtonProps\n /**\n * Props for the prev button component.\n */\n prevButtonProps?: CalendarPrevButtonProps\n /**\n * Props for the select component.\n */\n selectProps?: Select.RootProps\n /**\n * Props for the weekday component.\n */\n weekdayProps?: HTMLStyledProps<\"th\">\n /**\n * Props for the weekdays component.\n */\n weekdaysProps?: HTMLStyledProps<\"tr\">\n /**\n * Props for the week component.\n */\n weekProps?: HTMLStyledProps<\"tr\">\n /**\n * Props for the weeks component.\n */\n weeksProps?: HTMLStyledProps<\"tbody\">\n /**\n * Props for the year select component.\n */\n yearSelectProps?: CalendarYearSelectProps\n}\n\nconst {\n ComponentContext,\n PropsContext: CalendarPropsContext,\n useComponentContext,\n usePropsContext: useCalendarPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<CalendarRootProps, CalendarStyle, ComponentContext>(\n \"calendar\",\n calendarStyle,\n)\n\nexport { CalendarPropsContext, useCalendarPropsContext }\n\n/**\n * `Calendar` is a component for displaying or selecting dates in a calendar.\n *\n * @see https://yamada-ui.com/docs/components/calendar\n */\nexport const CalendarRoot = withProvider(\n <Multiple extends boolean = false, Range extends boolean = false>({\n children,\n day,\n buttonProps,\n controlProps,\n dayProps,\n monthProps,\n monthSelectProps,\n navigationProps,\n nextButtonProps,\n prevButtonProps,\n selectProps,\n weekdayProps,\n weekdaysProps,\n weekProps,\n weeksProps,\n yearSelectProps,\n ...props\n }: CalendarRootProps<Multiple, Range>) => {\n const {\n descendants,\n disabled,\n endOfMonth,\n excludeDate,\n holidays,\n locale,\n max,\n maxDate,\n minDate,\n month,\n monthDays,\n monthItems,\n multiple,\n range,\n startDayOfWeek,\n startOfMonth,\n today,\n value,\n weekdays,\n weekendDays,\n yearItems,\n getMonthProps,\n getMonthSelectProps,\n getNavigationProps,\n getNextButtonProps,\n getPrevButtonProps,\n getRootProps,\n getStatusProps,\n getWeekdayProps,\n getYearSelectProps,\n onChange,\n onMonthChange,\n onNextMonth,\n onPrevMonth,\n } = useCalendar(props)\n const calendarContext = useMemo(\n () => ({\n disabled,\n endOfMonth,\n excludeDate,\n holidays,\n locale,\n max,\n maxDate,\n minDate,\n month,\n multiple,\n range,\n startDayOfWeek,\n startOfMonth,\n today,\n value,\n weekendDays,\n onChange,\n onMonthChange,\n onNextMonth,\n onPrevMonth,\n }),\n [\n disabled,\n endOfMonth,\n excludeDate,\n holidays,\n locale,\n max,\n maxDate,\n minDate,\n month,\n multiple,\n range,\n startDayOfWeek,\n startOfMonth,\n today,\n value,\n weekendDays,\n onChange,\n onMonthChange,\n onNextMonth,\n onPrevMonth,\n ],\n )\n const componentContext = useMemo(\n () => ({\n day,\n monthDays,\n monthItems,\n weekdays,\n yearItems,\n buttonProps,\n controlProps,\n dayProps,\n getMonthProps,\n getMonthSelectProps,\n getNavigationProps,\n getNextButtonProps,\n getPrevButtonProps,\n getStatusProps,\n getWeekdayProps,\n getYearSelectProps,\n monthProps,\n monthSelectProps,\n navigationProps,\n nextButtonProps,\n prevButtonProps,\n selectProps,\n weekdayProps,\n weekdaysProps,\n weekProps,\n weeksProps,\n yearSelectProps,\n }),\n [\n day,\n monthDays,\n monthItems,\n weekdays,\n yearItems,\n buttonProps,\n controlProps,\n dayProps,\n getMonthProps,\n getMonthSelectProps,\n getNavigationProps,\n getNextButtonProps,\n getPrevButtonProps,\n getStatusProps,\n getWeekdayProps,\n getYearSelectProps,\n monthProps,\n monthSelectProps,\n navigationProps,\n nextButtonProps,\n prevButtonProps,\n selectProps,\n weekdayProps,\n weekdaysProps,\n weekProps,\n weeksProps,\n yearSelectProps,\n ],\n )\n\n return (\n <CalendarDescendantsContext value={descendants}>\n <CalendarContext value={calendarContext}>\n <ComponentContext value={componentContext}>\n <styled.div {...getRootProps()}>\n {children ?? (\n <>\n <CalendarNavigation />\n <CalendarMonth />\n </>\n )}\n </styled.div>\n </ComponentContext>\n </CalendarContext>\n </CalendarDescendantsContext>\n )\n },\n \"root\",\n)() as GenericsComponent<{\n <Multiple extends boolean = false, Range extends boolean = false>(\n props: CalendarRootProps<Multiple, Range>,\n ): ReactElement\n}>\n\nexport interface CalendarNavigationProps extends HTMLStyledProps {}\n\nexport const CalendarNavigation = withContext<\"div\", CalendarNavigationProps>(\n \"div\",\n [\"row\", \"navigation\"],\n)(undefined, ({ children, ...rest }) => {\n const { getNavigationProps, navigationProps } = useComponentContext()\n\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return (\n <>\n <CalendarPrevButton />\n <CalendarControl />\n <CalendarNextButton />\n </>\n )\n }, [children])\n\n return {\n ...getNavigationProps(mergeProps(navigationProps, rest)()),\n children: computedChildren,\n }\n})\n\nexport interface CalendarControlProps extends Omit<\n HTMLStyledProps,\n \"children\"\n> {\n /**\n * The control children to use.\n */\n children?: ReactNodeOrFunction<{ month: Date }>\n}\n\nexport const CalendarControl = withContext<\"div\", CalendarControlProps>(\n \"div\",\n \"control\",\n)(undefined, ({ children, ...rest }) => {\n const { month } = useCalendarContext()\n const { controlProps, getStatusProps } = useComponentContext()\n\n const computedChildren = useMemo(() => {\n if (children) return runIfFn(children, { month })\n\n return (\n <>\n <CalendarMonthSelect />\n <CalendarYearSelect />\n </>\n )\n }, [children, month])\n\n return {\n ...mergeProps(controlProps, rest)(),\n children: (\n <>\n {computedChildren}\n <styled.div {...getStatusProps()} />\n </>\n ),\n }\n})\n\nexport interface CalendarPrevButtonProps extends HTMLStyledProps<\"button\"> {}\n\nexport const CalendarPrevButton = withContext<\n \"button\",\n CalendarPrevButtonProps\n>(\"button\", [\"button\", \"prev\"])(\n undefined,\n ({ children = <ChevronLeftIcon />, ...rest }) => {\n const { buttonProps, getPrevButtonProps, prevButtonProps } =\n useComponentContext()\n\n return {\n children,\n ...getPrevButtonProps(mergeProps(buttonProps, prevButtonProps, rest)()),\n }\n },\n)\n\nexport interface CalendarNextButtonProps extends HTMLStyledProps<\"button\"> {}\n\nexport const CalendarNextButton = withContext<\n \"button\",\n CalendarNextButtonProps\n>(\"button\", [\"button\", \"next\"])(\n undefined,\n ({ children = <ChevronRightIcon />, ...rest }) => {\n const { buttonProps, getNextButtonProps, nextButtonProps } =\n useComponentContext()\n\n return {\n children,\n ...getNextButtonProps(mergeProps(buttonProps, nextButtonProps, rest)()),\n }\n },\n)\n\nexport interface CalendarSeparatorProps extends HTMLStyledProps<\"span\"> {}\n\nexport const CalendarSeparator = withContext<\"span\", CalendarSeparatorProps>(\n \"span\",\n \"separator\",\n)({ children: \"/\", role: \"separator\" })\n\nexport interface CalendarYearSelectProps extends Select.RootProps {}\n\nexport const CalendarYearSelect = withContext<\"div\", CalendarYearSelectProps>(\n (props) => {\n const { yearItems, getYearSelectProps, selectProps, yearSelectProps } =\n useComponentContext()\n const { contentProps, rootProps, ...rest } = mergeProps(\n selectProps,\n yearSelectProps,\n props,\n )()\n\n return (\n <Select.Root\n variant=\"plain\"\n items={yearItems}\n minH=\"{cell-size}\"\n contentProps={{ minW: \"{select-content-size}\", ...contentProps }}\n rootProps={{\n fontSize: \"{select-font-size}\",\n w: \"{select-root-size}\",\n ...rootProps,\n }}\n {...resetFieldProps}\n {...getYearSelectProps(rest)}\n />\n )\n },\n [\"select\", \"years\"],\n)()\n\nexport interface CalendarMonthSelectProps extends Select.RootProps {}\n\nexport const CalendarMonthSelect = withContext<\"div\", CalendarMonthSelectProps>(\n (props) => {\n const { monthItems, getMonthSelectProps, monthSelectProps, selectProps } =\n useComponentContext()\n const { contentProps, rootProps, ...rest } = mergeProps(\n selectProps,\n monthSelectProps,\n props,\n )()\n\n return (\n <Select.Root\n variant=\"plain\"\n items={monthItems}\n minH=\"{cell-size}\"\n contentProps={{ minW: \"{select-content-size}\", ...contentProps }}\n rootProps={{\n fontSize: \"{select-font-size}\",\n w: \"{select-root-size}\",\n ...rootProps,\n }}\n {...resetFieldProps}\n {...getMonthSelectProps(rest)}\n />\n )\n },\n [\"select\", \"months\"],\n)()\n\nexport interface CalendarMonthProps extends Omit<\n HTMLStyledProps<\"table\">,\n \"children\"\n> {\n /**\n * The day component to use.\n */\n day?: ReactNodeOrFunction<{ value: Date }>\n}\n\nexport const CalendarMonth = withContext<\"table\", CalendarMonthProps>(\n \"table\",\n \"month\",\n)(undefined, ({ day: dayProp, ...rest }) => {\n const {\n day,\n monthDays,\n weekdays,\n dayProps,\n getMonthProps,\n getWeekdayProps,\n monthProps,\n weekdayProps,\n weekdaysProps,\n weekProps,\n weeksProps,\n } = useComponentContext()\n\n dayProp ??= day\n\n const children = (\n <>\n <styled.thead aria-hidden>\n <CalendarWeekDays {...weekdaysProps}>\n {weekdays.map(({ label, value }, index) => (\n <CalendarWeekday\n key={index}\n {...getWeekdayProps({ ...weekdayProps, value })}\n >\n {label}\n </CalendarWeekday>\n ))}\n </CalendarWeekDays>\n </styled.thead>\n\n <CalendarWeeks {...weeksProps}>\n {monthDays.map((week, index) => (\n <CalendarWeek key={index} {...weekProps}>\n {week.map(({ label, value }) => (\n <CalendarDay\n key={value.toDateString()}\n {...{ ...dayProps, value }}\n >\n {runIfFn(dayProp, { value }) ?? (\n <styled.span>{label}</styled.span>\n )}\n </CalendarDay>\n ))}\n </CalendarWeek>\n ))}\n </CalendarWeeks>\n </>\n )\n\n return {\n ...getMonthProps(mergeProps(monthProps, rest)()),\n children,\n }\n})\n\nconst CalendarWeekDays = withContext(\"tr\", [\"row\", \"weekdays\"])()\n\nconst CalendarWeekday = withContext(\"th\", [\"cell\", \"weekday\"])()\n\nconst CalendarWeeks = withContext(\"tbody\", \"weeks\")()\n\nconst CalendarWeek = withContext(\"tr\", [\"row\", \"week\"])()\n\ninterface CalendarDayProps\n extends Omit<HTMLStyledProps<\"td\">, \"value\">, UseCalendarDayProps {}\n\nconst CalendarDay = withContext<\"td\", CalendarDayProps>(\"td\", [\"cell\", \"day\"])(\n undefined,\n (props) => {\n const { getDayProps } = useCalendarDay(props)\n\n return getDayProps()\n },\n)\n"],"mappings":";;;;;;;;;;;;;;AAiIA,MAAM,EACJ,kBACA,cAAc,sBACd,qBACA,iBAAiB,yBACjB,aACA,iBACE,oBACF,YACA,cACD;;;;;;AASD,MAAa,eAAe,cACwC,EAChE,UACA,KACA,aACA,cACA,UACA,YACA,kBACA,iBACA,iBACA,iBACA,aACA,cACA,eACA,WACA,YACA,iBACA,GAAG,YACqC;CACxC,MAAM,EACJ,aACA,UACA,YACA,aACA,UACA,QACA,KACA,SACA,SACA,OACA,WACA,YACA,UACA,OACA,gBACA,cACA,OACA,OACA,UACA,aACA,WACA,eACA,qBACA,oBACA,oBACA,oBACA,cACA,gBACA,iBACA,oBACA,UACA,eACA,aACA,gBACE,YAAY,MAAM;CA4GtB,OACE,oBAAC,4BAAD;EAA4B,OAAO;YACjC,oBAAC,iBAAD;GAAiB,OA7GG,eACf;IACL;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACD,GACD;IACE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACD,CAiEwC;aACrC,oBAAC,kBAAD;IAAkB,OAhEC,eAChB;KACL;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACD,GACD;KACE;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACD,CAM4C;cACvC,oBAAC,OAAO,KAAR;KAAY,GAAI,cAAc;eAC3B,YACC,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,oBAAD,EAAsB,CAAA,EACtB,oBAAC,eAAD,EAAiB,CAAA,CAChB,EAAA,CAAA;KAEM,CAAA;IACI,CAAA;GACH,CAAA;EACS,CAAA;GAGjC,OACD,EAAE;AAQH,MAAa,qBAAqB,YAChC,OACA,CAAC,OAAO,aAAa,CACtB,CAAC,KAAA,IAAY,EAAE,UAAU,GAAG,WAAW;CACtC,MAAM,EAAE,oBAAoB,oBAAoB,qBAAqB;CAErE,MAAM,mBAAmB,cAAc;EACrC,IAAI,UAAU,OAAO;EAErB,OACE,qBAAA,YAAA,EAAA,UAAA;GACE,oBAAC,oBAAD,EAAsB,CAAA;GACtB,oBAAC,iBAAD,EAAmB,CAAA;GACnB,oBAAC,oBAAD,EAAsB,CAAA;GACrB,EAAA,CAAA;IAEJ,CAAC,SAAS,CAAC;CAEd,OAAO;EACL,GAAG,mBAAmB,WAAW,iBAAiB,KAAK,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EAEf,oBAAC,eAAD;EAAe,GAAI;YAChB,UAAU,KAAK,MAAM,UACpB,oBAAC,cAAD;GAA0B,GAAI;aAC3B,KAAK,KAAK,EAAE,OAAO,YAClB,oBAAC,aAAD;IAEQ,GAAG;IAAU;yCAEV,SAAS,EAAE,OAAO,CAAC,IAC1B,oBAAC,OAAO,MAAR,EAAA,UAAc,OAAoB,CAAA;IAExB,EANP,MAAM,cAAc,CAMb,CACd;GACW,EAXI,MAWJ,CACf;EACY,CAAA,CACf,EAAA,CAAA;CAGL,OAAO;EACL,GAAG,cAAc,WAAW,YAAY,KAAK,EAAE,CAAC;EAChD;EACD;EACD;AAEF,MAAM,mBAAmB,YAAY,MAAM,CAAC,OAAO,WAAW,CAAC,EAAE;AAEjE,MAAM,kBAAkB,YAAY,MAAM,CAAC,QAAQ,UAAU,CAAC,EAAE;AAEhE,MAAM,gBAAgB,YAAY,SAAS,QAAQ,EAAE;AAErD,MAAM,eAAe,YAAY,MAAM,CAAC,OAAO,OAAO,CAAC,EAAE;AAKzD,MAAM,cAAc,YAAoC,MAAM,CAAC,QAAQ,MAAM,CAAC,CAC5E,KAAA,IACC,UAAU;CACT,MAAM,EAAE,gBAAgB,eAAe,MAAM;CAE7C,OAAO,aAAa;EAEvB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.types.js";
|
|
2
2
|
import { CSSModifierObject, CSSPropObject, CSSSlotObject } from "../../core/css/index.types.js";
|
|
3
3
|
//#region src/components/accordion/accordion.style.d.ts
|
|
4
|
-
declare const accordionStyle: ComponentSlotStyle<"button" | "panel" | "icon" | "
|
|
4
|
+
declare const accordionStyle: ComponentSlotStyle<"button" | "panel" | "icon" | "item" | "root", CSSPropObject<CSSSlotObject<"button" | "panel" | "icon" | "item" | "root">>, CSSModifierObject<CSSSlotObject<"button" | "panel" | "icon" | "item" | "root">>, {
|
|
5
5
|
panel: {
|
|
6
6
|
button: {
|
|
7
7
|
rounded: "l2";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.types.js";
|
|
2
2
|
import { CSSPropObject, CSSSlotObject } from "../../core/css/index.types.js";
|
|
3
3
|
//#region src/components/autocomplete/autocomplete.style.d.ts
|
|
4
|
-
declare const autocompleteStyle: ComponentSlotStyle<"input" | "label" | "option" | "content" | "group" | "separator" | "icon" | "root" | "indicator" | "field" | "
|
|
4
|
+
declare const autocompleteStyle: ComponentSlotStyle<"input" | "label" | "option" | "content" | "group" | "separator" | "icon" | "root" | "indicator" | "field" | "empty" | "valueText", CSSPropObject<CSSSlotObject<"input" | "label" | "option" | "content" | "group" | "separator" | "icon" | "root" | "indicator" | "field" | "empty" | "valueText">>, {
|
|
5
5
|
xs: {
|
|
6
6
|
empty: {
|
|
7
7
|
gap: "1.5";
|
|
@@ -23,7 +23,7 @@ interface AvatarProps extends HTMLStyledProps, ThemeProps<AvatarStyle>, UseAvata
|
|
|
23
23
|
*/
|
|
24
24
|
imageProps?: AvatarImageProps;
|
|
25
25
|
}
|
|
26
|
-
declare const component: <H extends "fragment"
|
|
26
|
+
declare const component: <H extends As | "fragment" = "div", R extends _$_yamada_ui_utils0.Dict = _$_yamada_ui_utils0.Dict<any>>(el: H | _$react.FC<R>, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"image" | "group" | "fallback" | "root", {
|
|
27
27
|
shape: {
|
|
28
28
|
circle: {
|
|
29
29
|
root: {
|
|
@@ -146,7 +146,7 @@ declare const component: <H extends "fragment" | As = "div", R extends _$_yamada
|
|
|
146
146
|
name,
|
|
147
147
|
className,
|
|
148
148
|
...options
|
|
149
|
-
}?: ComponentOptions) => (initialProps?: InitialProps<R>, ...superProps: SuperProps<R>[]) => H extends "fragment" ? _$react.FunctionComponent<R> : Component<Exclude<H, "fragment">, R>, AvatarPropsContext: _$react.Context<Partial<AvatarProps> | undefined>, useAvatarPropsContext: () => Partial<AvatarProps> | undefined, useRootComponentProps: <Y extends _$_yamada_ui_utils0.Dict = {}, R extends keyof Y = keyof Y>(props: Y, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"image" | "group" | "
|
|
149
|
+
}?: ComponentOptions) => (initialProps?: InitialProps<R>, ...superProps: SuperProps<R>[]) => H extends "fragment" ? _$react.FunctionComponent<R> : Component<Exclude<H, "fragment">, R>, AvatarPropsContext: _$react.Context<Partial<AvatarProps> | undefined>, useAvatarPropsContext: () => Partial<AvatarProps> | undefined, useRootComponentProps: <Y extends _$_yamada_ui_utils0.Dict = {}, R extends keyof Y = keyof Y>(props: Y, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"image" | "group" | "fallback" | "root", {
|
|
150
150
|
shape: {
|
|
151
151
|
circle: {
|
|
152
152
|
root: {
|
|
@@ -269,7 +269,7 @@ declare const component: <H extends "fragment" | As = "div", R extends _$_yamada
|
|
|
269
269
|
className,
|
|
270
270
|
withContext,
|
|
271
271
|
transferProps
|
|
272
|
-
}?: UseComponentPropsOptions<R>) => [CSSSlotObject, _$_yamada_ui_utils0.Merge<WithoutThemeProps<Y, ComponentSlotStyle<"image" | "group" | "
|
|
272
|
+
}?: UseComponentPropsOptions<R>) => [CSSSlotObject, _$_yamada_ui_utils0.Merge<WithoutThemeProps<Y, ComponentSlotStyle<"image" | "group" | "fallback" | "root", {
|
|
273
273
|
shape: {
|
|
274
274
|
circle: {
|
|
275
275
|
root: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.types.js";
|
|
2
2
|
//#region src/components/avatar/avatar.style.d.ts
|
|
3
|
-
declare const avatarStyle: ComponentSlotStyle<"image" | "group" | "
|
|
3
|
+
declare const avatarStyle: ComponentSlotStyle<"image" | "group" | "fallback" | "root", {
|
|
4
4
|
/**
|
|
5
5
|
* The shape of the component
|
|
6
6
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.types.js";
|
|
2
2
|
import { CSSPropObject, CSSSlotObject } from "../../core/css/index.types.js";
|
|
3
3
|
//#region src/components/breadcrumb/breadcrumb.style.d.ts
|
|
4
|
-
declare const breadcrumbStyle: ComponentSlotStyle<"link" | "list" | "separator" | "ellipsis" | "
|
|
4
|
+
declare const breadcrumbStyle: ComponentSlotStyle<"link" | "list" | "separator" | "ellipsis" | "item" | "root", CSSPropObject<CSSSlotObject<"link" | "list" | "separator" | "ellipsis" | "item" | "root">>, {
|
|
5
5
|
sm: {
|
|
6
6
|
list: {
|
|
7
7
|
fontSize: "sm";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.types.js";
|
|
2
2
|
import { CSSModifierObject, CSSSlotObject } from "../../core/css/index.types.js";
|
|
3
3
|
//#region src/components/calendar/calendar.style.d.ts
|
|
4
|
-
declare const calendarStyle: ComponentSlotStyle<"button" | "select" | "cell" | "navigation" | "row" | "separator" | "next" | "
|
|
4
|
+
declare const calendarStyle: ComponentSlotStyle<"button" | "select" | "cell" | "navigation" | "row" | "separator" | "next" | "prev" | "root" | "month" | "week" | "control" | "weekday" | "day" | "months" | "years" | "weeks", {
|
|
5
5
|
/**
|
|
6
6
|
* If `true`, the calendar will be fixed rows.
|
|
7
7
|
*
|
|
@@ -73,7 +73,7 @@ declare const calendarStyle: ComponentSlotStyle<"button" | "select" | "cell" | "
|
|
|
73
73
|
"--font-size": "fontSizes.xl";
|
|
74
74
|
};
|
|
75
75
|
};
|
|
76
|
-
}, CSSModifierObject<CSSSlotObject<"button" | "select" | "cell" | "navigation" | "row" | "separator" | "next" | "
|
|
76
|
+
}, CSSModifierObject<CSSSlotObject<"button" | "select" | "cell" | "navigation" | "row" | "separator" | "next" | "prev" | "root" | "month" | "week" | "control" | "weekday" | "day" | "months" | "years" | "weeks">>>;
|
|
77
77
|
type CalendarStyle = typeof calendarStyle;
|
|
78
78
|
//#endregion
|
|
79
79
|
export { CalendarStyle, calendarStyle };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.types.js";
|
|
2
2
|
import { CSSModifierObject, CSSPropObject, CSSSlotObject } from "../../core/css/index.types.js";
|
|
3
3
|
//#region src/components/carousel/carousel.style.d.ts
|
|
4
|
-
declare const carouselStyle: ComponentSlotStyle<"list" | "next" | "
|
|
4
|
+
declare const carouselStyle: ComponentSlotStyle<"list" | "next" | "prev" | "item" | "root" | "trigger" | "indicator" | "indicators", CSSPropObject<CSSSlotObject<"list" | "next" | "prev" | "item" | "root" | "trigger" | "indicator" | "indicators">>, {
|
|
5
5
|
sm: {
|
|
6
6
|
root: {
|
|
7
7
|
h: "sm";
|
|
@@ -17,7 +17,7 @@ declare const carouselStyle: ComponentSlotStyle<"list" | "next" | "root" | "indi
|
|
|
17
17
|
h: "lg";
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
-
}, CSSModifierObject<CSSSlotObject<"list" | "next" | "
|
|
20
|
+
}, CSSModifierObject<CSSSlotObject<"list" | "next" | "prev" | "item" | "root" | "trigger" | "indicator" | "indicators">>>;
|
|
21
21
|
type CarouselStyle = typeof carouselStyle;
|
|
22
22
|
//#endregion
|
|
23
23
|
export { CarouselStyle, carouselStyle };
|
|
@@ -37,7 +37,7 @@ interface CheckboxProps<Y extends string = string> extends Merge<HTMLStyledProps
|
|
|
37
37
|
*/
|
|
38
38
|
rootProps?: HTMLStyledProps<"label">;
|
|
39
39
|
}
|
|
40
|
-
declare const component: <H extends "fragment"
|
|
40
|
+
declare const component: <H extends As | "fragment" = "div", R extends _$_yamada_ui_utils0.Dict = _$_yamada_ui_utils0.Dict<any>>(el: H | _$react.FC<R>, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"label" | "group" | "root" | "indicator", {
|
|
41
41
|
shape: {
|
|
42
42
|
rounded: {
|
|
43
43
|
indicator: {
|
|
@@ -63,7 +63,7 @@ interface CheckboxCardRootProps<Y extends string = string> extends Merge<HTMLSty
|
|
|
63
63
|
*/
|
|
64
64
|
rootProps?: HTMLStyledProps<"label">;
|
|
65
65
|
}
|
|
66
|
-
declare const component: <H extends "fragment"
|
|
66
|
+
declare const component: <H extends As | "fragment" = "div", R extends _$_yamada_ui_utils0.Dict = _$_yamada_ui_utils0.Dict<any>>(el: H | _$react.FC<R>, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"group" | "root" | "description" | "indicator" | "addon", {
|
|
67
67
|
justify: {
|
|
68
68
|
end: {
|
|
69
69
|
addon: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.types.js";
|
|
2
2
|
//#region src/components/data-list/data-list.style.d.ts
|
|
3
|
-
declare const dataListStyle: ComponentSlotStyle<"term" | "
|
|
3
|
+
declare const dataListStyle: ComponentSlotStyle<"term" | "item" | "root" | "description", {
|
|
4
4
|
/**
|
|
5
5
|
* The orientation of the data list.
|
|
6
6
|
*
|
|
@@ -82,7 +82,7 @@ declare const Flip: Component<({
|
|
|
82
82
|
onChange,
|
|
83
83
|
onClick: onClickProp,
|
|
84
84
|
...rest
|
|
85
|
-
}: WithoutThemeProps<FlipProps, ComponentSlotStyle<"from" | "to" | "
|
|
85
|
+
}: WithoutThemeProps<FlipProps, ComponentSlotStyle<"from" | "to" | "item" | "root", CSSPropObject<CSSSlotObject<"from" | "to" | "item" | "root">>, CSSModifierObject<CSSSlotObject<"from" | "to" | "item" | "root">>, CSSModifierObject<CSSSlotObject<"from" | "to" | "item" | "root">>>, keyof FlipProps>) => _$react_jsx_runtime0.JSX.Element, FlipProps>;
|
|
86
86
|
//#endregion
|
|
87
87
|
export { Flip, FlipProps, FlipPropsContext, useFlipPropsContext };
|
|
88
88
|
//# sourceMappingURL=flip.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.types.js";
|
|
2
2
|
import { CSSModifierObject, CSSPropObject, CSSSlotObject } from "../../core/css/index.types.js";
|
|
3
3
|
//#region src/components/flip/flip.style.d.ts
|
|
4
|
-
declare const flipStyle: ComponentSlotStyle<"from" | "to" | "
|
|
4
|
+
declare const flipStyle: ComponentSlotStyle<"from" | "to" | "item" | "root", CSSPropObject<CSSSlotObject<"from" | "to" | "item" | "root">>, CSSModifierObject<CSSSlotObject<"from" | "to" | "item" | "root">>, CSSModifierObject<CSSSlotObject<"from" | "to" | "item" | "root">>>;
|
|
5
5
|
type FlipStyle = typeof flipStyle;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { FlipStyle, flipStyle };
|
|
@@ -8,11 +8,11 @@ import * as _$_yamada_ui_utils0 from "@yamada-ui/utils";
|
|
|
8
8
|
|
|
9
9
|
//#region src/components/icon/icon.d.ts
|
|
10
10
|
interface IconProps extends HTMLStyledProps<"svg">, ThemeProps<IconStyle> {}
|
|
11
|
-
declare const component: <D extends "fragment"
|
|
11
|
+
declare const component: <D extends As | "fragment" = "div", H extends _$_yamada_ui_utils0.Dict = IconProps>(el: D | _$react.FC<H>, {
|
|
12
12
|
name,
|
|
13
13
|
className,
|
|
14
14
|
...options
|
|
15
|
-
}?: ComponentOptions) => (initialProps?: InitialProps<H>, ...superProps: SuperProps<H>[]) => D extends "fragment" ? _$react.FunctionComponent<H> : Component<Exclude<D, "fragment">, H>, IconPropsContext: _$react.Context<Partial<IconProps> | undefined>, useIconPropsContext: () => Partial<IconProps> | undefined, withContext: <D extends "fragment"
|
|
15
|
+
}?: ComponentOptions) => (initialProps?: InitialProps<H>, ...superProps: SuperProps<H>[]) => D extends "fragment" ? _$react.FunctionComponent<H> : Component<Exclude<D, "fragment">, H>, IconPropsContext: _$react.Context<Partial<IconProps> | undefined>, useIconPropsContext: () => Partial<IconProps> | undefined, withContext: <D extends As | "fragment" = "div", H extends IconProps = IconProps, R extends keyof H = keyof H>(el: D | _$react.FC<WithoutThemeProps<H, ComponentStyle<CSSPropObject<CSSObject>, CSSModifierObject, CSSModifierObject>, R>>, {
|
|
16
16
|
name,
|
|
17
17
|
className,
|
|
18
18
|
withContext,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.types.js";
|
|
2
2
|
import { CSSModifierObject, CSSSlotObject } from "../../core/css/index.types.js";
|
|
3
3
|
//#region src/components/list/list.style.d.ts
|
|
4
|
-
declare const listStyle: ComponentSlotStyle<"icon" | "
|
|
4
|
+
declare const listStyle: ComponentSlotStyle<"icon" | "item" | "root", {
|
|
5
5
|
styleType: {
|
|
6
6
|
circle: {
|
|
7
7
|
root: {
|
|
@@ -35,7 +35,7 @@ declare const listStyle: ComponentSlotStyle<"icon" | "root" | "item", {
|
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
37
|
};
|
|
38
|
-
}, CSSModifierObject<CSSSlotObject<"icon" | "
|
|
38
|
+
}, CSSModifierObject<CSSSlotObject<"icon" | "item" | "root">>, CSSModifierObject<CSSSlotObject<"icon" | "item" | "root">>>;
|
|
39
39
|
type ListStyle = typeof listStyle;
|
|
40
40
|
//#endregion
|
|
41
41
|
export { ListStyle, listStyle };
|
|
@@ -17,7 +17,7 @@ interface LoadingProps extends WithoutThemeProps<IconProps>, ThemeProps<LoadingS
|
|
|
17
17
|
*/
|
|
18
18
|
secondaryColor?: CSSProps["color"];
|
|
19
19
|
}
|
|
20
|
-
declare const LoadingPropsContext: _$react.Context<Partial<LoadingProps> | undefined>, useLoadingPropsContext: () => Partial<LoadingProps> | undefined, withContext: <D extends "fragment"
|
|
20
|
+
declare const LoadingPropsContext: _$react.Context<Partial<LoadingProps> | undefined>, useLoadingPropsContext: () => Partial<LoadingProps> | undefined, withContext: <D extends As | "fragment" = "div", H extends LoadingProps = LoadingProps, R extends keyof H = keyof H>(el: D | _$react.FC<WithoutThemeProps<H, ComponentStyle<CSSPropObject<CSSObject>, CSSModifierObject, CSSModifierObject>, R>>, {
|
|
21
21
|
name,
|
|
22
22
|
className,
|
|
23
23
|
withContext,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.types.js";
|
|
2
2
|
import { CSSModifierObject, CSSPropObject, CSSSlotObject } from "../../core/css/index.types.js";
|
|
3
3
|
//#region src/components/menu/menu.style.d.ts
|
|
4
|
-
declare const menuStyle: ComponentSlotStyle<"footer" | "header" | "label" | "content" | "command" | "group" | "separator" | "
|
|
4
|
+
declare const menuStyle: ComponentSlotStyle<"footer" | "header" | "label" | "content" | "command" | "group" | "separator" | "item" | "indicator", CSSPropObject<CSSSlotObject<"footer" | "header" | "label" | "content" | "command" | "group" | "separator" | "item" | "indicator">>, {
|
|
5
5
|
sm: {
|
|
6
6
|
command: {
|
|
7
7
|
fontSize: "2xs";
|
|
@@ -86,7 +86,7 @@ declare const menuStyle: ComponentSlotStyle<"footer" | "header" | "label" | "con
|
|
|
86
86
|
px: "2";
|
|
87
87
|
};
|
|
88
88
|
};
|
|
89
|
-
}, CSSModifierObject<CSSSlotObject<"footer" | "header" | "label" | "content" | "command" | "group" | "separator" | "
|
|
89
|
+
}, CSSModifierObject<CSSSlotObject<"footer" | "header" | "label" | "content" | "command" | "group" | "separator" | "item" | "indicator">>>;
|
|
90
90
|
type MenuStyle = typeof menuStyle;
|
|
91
91
|
//#endregion
|
|
92
92
|
export { MenuStyle, menuStyle };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.types.js";
|
|
2
2
|
import { CSSModifierObject, CSSSlotObject } from "../../core/css/index.types.js";
|
|
3
3
|
//#region src/components/native-accordion/native-accordion.style.d.ts
|
|
4
|
-
declare const nativeAccordionStyle: ComponentSlotStyle<"button" | "panel" | "icon" | "
|
|
4
|
+
declare const nativeAccordionStyle: ComponentSlotStyle<"button" | "panel" | "icon" | "item" | "root", {
|
|
5
5
|
/**
|
|
6
6
|
* If `true`, animate the accordion items when they are expanded or collapsed.
|
|
7
7
|
*
|
|
@@ -31,7 +31,7 @@ declare const nativeAccordionStyle: ComponentSlotStyle<"button" | "panel" | "ico
|
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
|
-
}, CSSModifierObject<CSSSlotObject<"button" | "panel" | "icon" | "
|
|
34
|
+
}, CSSModifierObject<CSSSlotObject<"button" | "panel" | "icon" | "item" | "root">>, {
|
|
35
35
|
panel: {
|
|
36
36
|
button: {
|
|
37
37
|
rounded: "l2";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.types.js";
|
|
2
2
|
import { CSSModifierObject, CSSPropObject, CSSSlotObject } from "../../core/css/index.types.js";
|
|
3
3
|
//#region src/components/notice/notice.style.d.ts
|
|
4
|
-
declare const noticeStyle: ComponentSlotStyle<"content" | "closeButton" | "
|
|
4
|
+
declare const noticeStyle: ComponentSlotStyle<"content" | "closeButton" | "item" | "root", CSSPropObject<CSSSlotObject<"content" | "closeButton" | "item" | "root">>, CSSModifierObject<CSSSlotObject<"content" | "closeButton" | "item" | "root">>, CSSModifierObject<CSSSlotObject<"content" | "closeButton" | "item" | "root">>>;
|
|
5
5
|
type NoticeStyle = typeof noticeStyle;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { NoticeStyle };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.types.js";
|
|
2
2
|
import { CSSPropObject, CSSSlotObject } from "../../core/css/index.types.js";
|
|
3
3
|
//#region src/components/pagination/pagination.style.d.ts
|
|
4
|
-
declare const paginationStyle: ComponentSlotStyle<"text" | "
|
|
4
|
+
declare const paginationStyle: ComponentSlotStyle<"text" | "item" | "root", CSSPropObject<CSSSlotObject<"text" | "item" | "root">>, {
|
|
5
5
|
xs: {
|
|
6
6
|
item: {
|
|
7
7
|
fontSize: "{font-size}";
|
|
@@ -29,7 +29,7 @@ interface RadioProps<Y extends string = string> extends Merge<HTMLStyledProps<"l
|
|
|
29
29
|
*/
|
|
30
30
|
rootProps?: HTMLStyledProps<"label">;
|
|
31
31
|
}
|
|
32
|
-
declare const component: <H extends "fragment"
|
|
32
|
+
declare const component: <H extends As | "fragment" = "div", R extends _$_yamada_ui_utils0.Dict = _$_yamada_ui_utils0.Dict<any>>(el: H | _$react.FC<R>, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"label" | "group" | "root" | "indicator", {
|
|
33
33
|
shape: {
|
|
34
34
|
circle: {
|
|
35
35
|
indicator: {
|
|
@@ -55,7 +55,7 @@ interface RadioCardRootProps<Y extends string = string> extends Merge<HTMLStyled
|
|
|
55
55
|
*/
|
|
56
56
|
rootProps?: HTMLStyledProps<"label">;
|
|
57
57
|
}
|
|
58
|
-
declare const component: <H extends "fragment"
|
|
58
|
+
declare const component: <H extends As | "fragment" = "div", R extends _$_yamada_ui_utils0.Dict = _$_yamada_ui_utils0.Dict<any>>(el: H | _$react.FC<R>, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"group" | "root" | "description" | "indicator" | "addon", {
|
|
59
59
|
justify: {
|
|
60
60
|
end: {
|
|
61
61
|
addon: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.types.js";
|
|
2
2
|
import { CSSModifierObject, CSSPropObject, CSSSlotObject } from "../../core/css/index.types.js";
|
|
3
3
|
//#region src/components/rating/rating.style.d.ts
|
|
4
|
-
declare const ratingStyle: ComponentSlotStyle<"group" | "icon" | "
|
|
4
|
+
declare const ratingStyle: ComponentSlotStyle<"group" | "icon" | "item" | "root", CSSPropObject<CSSSlotObject<"group" | "icon" | "item" | "root">>, {
|
|
5
5
|
xs: {
|
|
6
6
|
icon: {
|
|
7
7
|
fontSize: "md";
|
|
@@ -27,7 +27,7 @@ declare const ratingStyle: ComponentSlotStyle<"group" | "icon" | "root" | "item"
|
|
|
27
27
|
fontSize: "3xl";
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
|
-
}, CSSModifierObject<CSSSlotObject<"group" | "icon" | "
|
|
30
|
+
}, CSSModifierObject<CSSSlotObject<"group" | "icon" | "item" | "root">>>;
|
|
31
31
|
type RatingStyle = typeof ratingStyle;
|
|
32
32
|
//#endregion
|
|
33
33
|
export { RatingStyle, ratingStyle };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.types.js";
|
|
2
2
|
//#region src/components/reorder/reorder.style.d.ts
|
|
3
|
-
declare const reorderStyle: ComponentSlotStyle<"
|
|
3
|
+
declare const reorderStyle: ComponentSlotStyle<"item" | "root" | "trigger", {
|
|
4
4
|
/**
|
|
5
5
|
* The orientation of the reorder.
|
|
6
6
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.types.js";
|
|
2
2
|
import { CSSModifierObject, CSSSlotObject } from "../../core/css/index.types.js";
|
|
3
3
|
//#region src/components/resizable/resizable.style.d.ts
|
|
4
|
-
declare const resizableStyle: ComponentSlotStyle<"icon" | "
|
|
4
|
+
declare const resizableStyle: ComponentSlotStyle<"icon" | "item" | "root" | "trigger", {
|
|
5
5
|
/**
|
|
6
6
|
* The orientation of the resizable.
|
|
7
7
|
*
|
|
@@ -19,7 +19,7 @@ declare const resizableStyle: ComponentSlotStyle<"icon" | "root" | "item" | "tri
|
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
|
-
}, CSSModifierObject<CSSSlotObject<"icon" | "
|
|
22
|
+
}, CSSModifierObject<CSSSlotObject<"icon" | "item" | "root" | "trigger">>, {
|
|
23
23
|
border: {
|
|
24
24
|
icon: {
|
|
25
25
|
bg: "colorScheme.muted";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.types.js";
|
|
2
2
|
import { CSSModifierObject, CSSSlotObject } from "../../core/css/index.types.js";
|
|
3
3
|
//#region src/components/segmented-control/segmented-control.style.d.ts
|
|
4
|
-
declare const segmentedControlStyle: ComponentSlotStyle<"
|
|
4
|
+
declare const segmentedControlStyle: ComponentSlotStyle<"item" | "root" | "indicator", {
|
|
5
5
|
/**
|
|
6
6
|
* If `true`, the segmented control will be full rounded.
|
|
7
7
|
*
|
|
@@ -113,7 +113,7 @@ declare const segmentedControlStyle: ComponentSlotStyle<"root" | "indicator" | "
|
|
|
113
113
|
};
|
|
114
114
|
};
|
|
115
115
|
};
|
|
116
|
-
}, CSSModifierObject<CSSSlotObject<"
|
|
116
|
+
}, CSSModifierObject<CSSSlotObject<"item" | "root" | "indicator">>>;
|
|
117
117
|
type SegmentedControlStyle = typeof segmentedControlStyle;
|
|
118
118
|
//#endregion
|
|
119
119
|
export { SegmentedControlStyle, segmentedControlStyle };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.types.js";
|
|
2
2
|
//#region src/components/steps/steps.style.d.ts
|
|
3
|
-
declare const stepsStyle: ComponentSlotStyle<"title" | "list" | "separator" | "
|
|
3
|
+
declare const stepsStyle: ComponentSlotStyle<"title" | "list" | "separator" | "item" | "root" | "description" | "indicator", {
|
|
4
4
|
/**
|
|
5
5
|
* The orientation of the steps.
|
|
6
6
|
*
|
|
@@ -69,7 +69,7 @@ declare const TimelineRoot: Component<({
|
|
|
69
69
|
index,
|
|
70
70
|
items,
|
|
71
71
|
...rest
|
|
72
|
-
}: WithoutThemeProps<TimelineRootProps, ComponentSlotStyle<"title" | "content" | "
|
|
72
|
+
}: WithoutThemeProps<TimelineRootProps, ComponentSlotStyle<"title" | "content" | "item" | "root" | "description" | "indicator" | "connector", {
|
|
73
73
|
align: {
|
|
74
74
|
center: {
|
|
75
75
|
content: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.types.js";
|
|
2
2
|
//#region src/components/timeline/timeline.style.d.ts
|
|
3
|
-
declare const timelineStyle: ComponentSlotStyle<"title" | "content" | "
|
|
3
|
+
declare const timelineStyle: ComponentSlotStyle<"title" | "content" | "item" | "root" | "description" | "indicator" | "connector", {
|
|
4
4
|
/**
|
|
5
5
|
* The alignment of the timeline.
|
|
6
6
|
*
|
|
@@ -12,7 +12,7 @@ import * as _$_yamada_ui_utils0 from "@yamada-ui/utils";
|
|
|
12
12
|
|
|
13
13
|
//#region src/components/toggle/toggle.d.ts
|
|
14
14
|
interface ToggleProps<Y extends string = string> extends Omit<WithoutThemeProps<IconButtonProps, ToggleStyle>, "aria-label" | "onChange" | "ref" | "value">, UseToggleProps<Y>, Pick<UseInputBorderProps, "errorBorderColor">, ThemeProps<ToggleStyle> {}
|
|
15
|
-
declare const component: <H extends "fragment"
|
|
15
|
+
declare const component: <H extends As | "fragment" = "div", R extends _$_yamada_ui_utils0.Dict = _$_yamada_ui_utils0.Dict<any>>(el: H | _$react.FC<R>, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"group" | "root", {
|
|
16
16
|
fullRounded: {
|
|
17
17
|
true: {
|
|
18
18
|
root: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.types.js";
|
|
2
2
|
//#region src/components/tree/tree.style.d.ts
|
|
3
|
-
declare const treeStyle: ComponentSlotStyle<"label" | "checkbox" | "group" | "end" | "start" | "element" | "
|
|
3
|
+
declare const treeStyle: ComponentSlotStyle<"label" | "checkbox" | "group" | "end" | "start" | "element" | "item" | "root" | "indicator", {
|
|
4
4
|
/**
|
|
5
5
|
* The shape of the component
|
|
6
6
|
*
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yamada-ui/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.2.1-dev-
|
|
4
|
+
"version": "2.2.1-dev-20260511103853",
|
|
5
5
|
"description": "React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"yamada",
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
"scroll-into-view-if-needed": "^3.1.0",
|
|
148
148
|
"sonner": "^2.0.7",
|
|
149
149
|
"uqr": "^0.1.3",
|
|
150
|
-
"@yamada-ui/utils": "2.1.3-dev-
|
|
150
|
+
"@yamada-ui/utils": "2.1.3-dev-20260511103853"
|
|
151
151
|
},
|
|
152
152
|
"devDependencies": {
|
|
153
153
|
"@babel/parser": "^7.29.2",
|
|
@@ -163,7 +163,6 @@
|
|
|
163
163
|
"@vitejs/plugin-react": "^6.0.1",
|
|
164
164
|
"@vitest/browser": "^4.1.5",
|
|
165
165
|
"@vitest/browser-playwright": "^4.1.5",
|
|
166
|
-
"axe-core": "^4.11.2",
|
|
167
166
|
"axe-playwright": "^2.2.2",
|
|
168
167
|
"jsdom": "^29.1.1",
|
|
169
168
|
"playwright": "^1.59.1",
|