@yamada-ui/react 2.3.0-next-20260516100323 → 2.3.0-next-20260516215715
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/radio/use-radio-group.cjs +12 -13
- package/dist/cjs/components/radio/use-radio-group.cjs.map +1 -1
- package/dist/cjs/components/tabs/use-tabs.cjs +5 -5
- package/dist/cjs/components/tabs/use-tabs.cjs.map +1 -1
- package/dist/esm/components/radio/use-radio-group.js +12 -13
- package/dist/esm/components/radio/use-radio-group.js.map +1 -1
- package/dist/esm/components/tabs/use-tabs.js +5 -5
- package/dist/esm/components/tabs/use-tabs.js.map +1 -1
- package/dist/types/components/autocomplete/autocomplete.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/chart/cartesian-chart.style.d.ts +1 -1
- package/dist/types/components/chart/polar-chart.style.d.ts +1 -1
- package/dist/types/components/checkbox-card/checkbox-card.d.ts +3 -3
- package/dist/types/components/checkbox-card/checkbox-card.style.d.ts +1 -1
- package/dist/types/components/color-picker/color-picker.style.d.ts +1 -1
- package/dist/types/components/color-selector/color-selector.style.d.ts +2 -2
- package/dist/types/components/data-list/data-list.style.d.ts +1 -1
- package/dist/types/components/drawer/drawer.style.d.ts +2 -2
- package/dist/types/components/empty-state/empty-state.style.d.ts +2 -2
- package/dist/types/components/modal/modal.style.d.ts +2 -2
- package/dist/types/components/notice/notice.style.d.ts +1 -1
- package/dist/types/components/radio-card/radio-card.d.ts +3 -3
- package/dist/types/components/radio-card/radio-card.style.d.ts +1 -1
- 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/steps/steps.style.d.ts +1 -1
- package/dist/types/components/tabs/use-tabs.d.ts +0 -1
- package/dist/types/components/tag/tag.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/providers/i18n-provider/i18n-provider.d.ts +1 -1
- package/package.json +1 -1
|
@@ -14,7 +14,7 @@ const [RadioGroupContext, useRadioGroupContext] = require_context.createContext(
|
|
|
14
14
|
});
|
|
15
15
|
const useRadioGroup = (props = {}) => {
|
|
16
16
|
const uuid = (0, react.useId)();
|
|
17
|
-
const { context: { labelId } = {}, props: { id = uuid, defaultValue, disabled, readOnly, required, value: valueProp, onChange: onChangeProp, ...rest }, ariaProps: { "aria-describedby":
|
|
17
|
+
const { context: { labelId } = {}, props: { id = uuid, defaultValue, disabled, readOnly, required, value: valueProp, onChange: onChangeProp, ...rest }, ariaProps: { "aria-describedby": ariaDescribedby, ...ariaProps }, dataProps, eventProps } = require_use_field_props.useFieldProps(props);
|
|
18
18
|
const interactive = !(readOnly || disabled);
|
|
19
19
|
const [value, setValue] = require_hooks_use_controllable_state_index.useControllableState({
|
|
20
20
|
defaultValue,
|
|
@@ -26,13 +26,13 @@ const useRadioGroup = (props = {}) => {
|
|
|
26
26
|
if ((0, require_utils_index.utils_exports.isObject)(valueOrEv)) setValue(valueOrEv.target.value);
|
|
27
27
|
else setValue(valueOrEv);
|
|
28
28
|
}, [interactive, setValue]);
|
|
29
|
-
const getRootProps = (0, react.useCallback)((
|
|
29
|
+
const getRootProps = (0, react.useCallback)((props = {}) => require_props.mergeProps(dataProps, {
|
|
30
30
|
id,
|
|
31
|
-
"aria-describedby":
|
|
32
|
-
"aria-labelledby":
|
|
31
|
+
"aria-describedby": ariaDescribedby,
|
|
32
|
+
"aria-labelledby": labelId,
|
|
33
33
|
role: "radiogroup"
|
|
34
|
-
},
|
|
35
|
-
|
|
34
|
+
}, rest, props)(), [
|
|
35
|
+
ariaDescribedby,
|
|
36
36
|
dataProps,
|
|
37
37
|
id,
|
|
38
38
|
labelId,
|
|
@@ -43,7 +43,7 @@ const useRadioGroup = (props = {}) => {
|
|
|
43
43
|
value,
|
|
44
44
|
getInputProps: (0, react.useCallback)((props = {}) => {
|
|
45
45
|
const checked = !(0, require_utils_index.utils_exports.isUndefined)(value) && value === props.value;
|
|
46
|
-
return {
|
|
46
|
+
return require_props.mergeProps({
|
|
47
47
|
...dataProps,
|
|
48
48
|
...ariaProps,
|
|
49
49
|
type: "radio",
|
|
@@ -54,12 +54,11 @@ const useRadioGroup = (props = {}) => {
|
|
|
54
54
|
checked,
|
|
55
55
|
disabled,
|
|
56
56
|
readOnly,
|
|
57
|
-
required
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
};
|
|
57
|
+
required
|
|
58
|
+
}, props, {
|
|
59
|
+
onChange,
|
|
60
|
+
...eventProps
|
|
61
|
+
})();
|
|
63
62
|
}, [
|
|
64
63
|
ariaProps,
|
|
65
64
|
dataProps,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-radio-group.cjs","names":["createContext","useFieldProps","useControllableState","mergeProps","visuallyHiddenAttributes"],"sources":["../../../../src/components/radio/use-radio-group.ts"],"sourcesContent":["\"use client\"\n\nimport type { ChangeEvent } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { FieldProps } from \"../field\"\nimport { useCallback, useId } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport {\n createContext,\n
|
|
1
|
+
{"version":3,"file":"use-radio-group.cjs","names":["createContext","useFieldProps","useControllableState","mergeProps","visuallyHiddenAttributes"],"sources":["../../../../src/components/radio/use-radio-group.ts"],"sourcesContent":["\"use client\"\n\nimport type { ChangeEvent } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { FieldProps } from \"../field\"\nimport { useCallback, useId } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport {\n createContext,\n dataAttr,\n isObject,\n isUndefined,\n visuallyHiddenAttributes,\n} from \"../../utils\"\nimport { useFieldProps } from \"../field\"\n\ninterface RadioGroupContext extends Omit<UseRadioGroupReturn, \"getRootProps\"> {}\n\nconst [RadioGroupContext, useRadioGroupContext] =\n createContext<RadioGroupContext>({\n name: \"RadioGroupContext\",\n strict: false,\n })\n\nexport { RadioGroupContext, useRadioGroupContext }\n\nexport interface UseRadioGroupProps<Y extends string = string>\n extends Omit<HTMLProps, \"defaultValue\" | \"onChange\" | \"value\">, FieldProps {\n /**\n * The initial value of the radio group.\n */\n defaultValue?: Y\n /**\n * The value of the radio group.\n */\n value?: Y\n /**\n * The callback fired when any children radio is checked or unchecked.\n */\n onChange?: (value: Y) => void\n}\n\nexport const useRadioGroup = <Y extends string = string>(\n props: UseRadioGroupProps<Y> = {},\n) => {\n const uuid = useId()\n const {\n context: { labelId } = {},\n props: {\n id = uuid,\n defaultValue,\n disabled,\n readOnly,\n required,\n value: valueProp,\n onChange: onChangeProp,\n ...rest\n },\n ariaProps: { \"aria-describedby\": ariaDescribedby, ...ariaProps },\n dataProps,\n eventProps,\n } = useFieldProps(props)\n const interactive = !(readOnly || disabled)\n const [value, setValue] = useControllableState({\n defaultValue,\n value: valueProp,\n onChange: onChangeProp,\n })\n\n const onChange = useCallback(\n (valueOrEv: ChangeEvent<HTMLInputElement> | Y) => {\n if (!interactive) return\n\n if (isObject(valueOrEv)) {\n setValue(valueOrEv.target.value as Y)\n } else {\n setValue(valueOrEv)\n }\n },\n [interactive, setValue],\n )\n\n const getRootProps: PropGetter = useCallback(\n (props = {}) =>\n mergeProps(\n dataProps,\n {\n id,\n \"aria-describedby\": ariaDescribedby,\n \"aria-labelledby\": labelId,\n role: \"radiogroup\",\n },\n rest,\n props,\n )(),\n [ariaDescribedby, dataProps, id, labelId, rest],\n )\n\n const getInputProps: PropGetter<\"input\"> = useCallback(\n (props = {}) => {\n const checked = !isUndefined(value) && value === props.value\n\n return mergeProps(\n {\n ...dataProps,\n ...ariaProps,\n type: \"radio\",\n name: id,\n style: visuallyHiddenAttributes.style,\n \"aria-checked\": checked,\n \"data-checked\": dataAttr(checked),\n checked,\n disabled,\n readOnly,\n required,\n },\n props,\n { onChange, ...eventProps },\n )()\n },\n [\n ariaProps,\n dataProps,\n disabled,\n eventProps,\n id,\n onChange,\n readOnly,\n required,\n value,\n ],\n )\n\n const getLabelProps: PropGetter<\"label\"> = useCallback(\n (props) => ({\n ...dataProps,\n ...props,\n }),\n [dataProps],\n )\n\n return {\n name: id,\n value,\n getInputProps,\n getLabelProps,\n getRootProps,\n onChange,\n }\n}\n\nexport type UseRadioGroupReturn = ReturnType<typeof useRadioGroup>\n"],"mappings":";;;;;;;;;;AAmBA,MAAM,CAAC,mBAAmB,wBACxBA,gBAAAA,cAAiC;CAC/B,MAAM;CACN,QAAQ;CACT,CAAC;AAoBJ,MAAa,iBACX,QAA+B,EAAE,KAC9B;CACH,MAAM,QAAA,GAAA,MAAA,QAAc;CACpB,MAAM,EACJ,SAAS,EAAE,YAAY,EAAE,EACzB,OAAO,EACL,KAAK,MACL,cACA,UACA,UACA,UACA,OAAO,WACP,UAAU,cACV,GAAG,QAEL,WAAW,EAAE,oBAAoB,iBAAiB,GAAG,aACrD,WACA,eACEC,wBAAAA,cAAc,MAAM;CACxB,MAAM,cAAc,EAAE,YAAY;CAClC,MAAM,CAAC,OAAO,YAAYC,2CAAAA,qBAAqB;EAC7C;EACA,OAAO;EACP,UAAU;EACX,CAAC;CAEF,MAAM,YAAA,GAAA,MAAA,cACH,cAAiD;EAChD,IAAI,CAAC,aAAa;EAElB,KAAA,GAAA,oBAAA,cAAA,UAAa,UAAU,EACrB,SAAS,UAAU,OAAO,MAAW;OAErC,SAAS,UAAU;IAGvB,CAAC,aAAa,SAAS,CACxB;CAED,MAAM,gBAAA,GAAA,MAAA,cACH,QAAQ,EAAE,KACTC,cAAAA,WACE,WACA;EACE;EACA,oBAAoB;EACpB,mBAAmB;EACnB,MAAM;EACP,EACD,MACA,MACD,EAAE,EACL;EAAC;EAAiB;EAAW;EAAI;EAAS;EAAK,CAChD;CA6CD,OAAO;EACL,MAAM;EACN;EACA,gBAAA,GAAA,MAAA,cA7CC,QAAQ,EAAE,KAAK;GACd,MAAM,UAAU,EAAA,GAAA,oBAAA,cAAA,aAAa,MAAM,IAAI,UAAU,MAAM;GAEvD,OAAOA,cAAAA,WACL;IACE,GAAG;IACH,GAAG;IACH,MAAM;IACN,MAAM;IACN,OAAOC,YAAAA,yBAAyB;IAChC,gBAAgB;IAChB,iBAAA,GAAA,oBAAA,cAAA,UAAyB,QAAQ;IACjC;IACA;IACA;IACA;IACD,EACD,OACA;IAAE;IAAU,GAAG;IAAY,CAC5B,EAAE;KAEL;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD,CAcY;EACb,gBAAA,GAAA,MAAA,cAXC,WAAW;GACV,GAAG;GACH,GAAG;GACJ,GACD,CAAC,UAAU,CAOE;EACb;EACA;EACD"}
|
|
@@ -135,7 +135,7 @@ const useTab = ({ id, disabled, index, ...rest }) => {
|
|
|
135
135
|
])
|
|
136
136
|
};
|
|
137
137
|
};
|
|
138
|
-
const useTabPanel = ({ id,
|
|
138
|
+
const useTabPanel = ({ id, index, ...rest }) => {
|
|
139
139
|
const { id: rootId, index: selectedIndex, orientation } = useTabsContext();
|
|
140
140
|
const { register } = useTabPanelDescendant();
|
|
141
141
|
const tabId = `${rootId}-tab-${index}`;
|
|
@@ -144,16 +144,16 @@ const useTabPanel = ({ id, "aria-labelledby": ariaLabelledbyProp, index, ...rest
|
|
|
144
144
|
return {
|
|
145
145
|
index,
|
|
146
146
|
selected,
|
|
147
|
-
getRootProps: (0, react.useCallback)((
|
|
147
|
+
getRootProps: (0, react.useCallback)((props = {}) => require_props.mergeProps({
|
|
148
148
|
id,
|
|
149
|
-
|
|
149
|
+
ref: register,
|
|
150
|
+
"aria-labelledby": tabId,
|
|
150
151
|
"data-orientation": orientation,
|
|
151
152
|
hidden: !selected,
|
|
152
153
|
role: "tabpanel",
|
|
153
154
|
tabIndex: selected ? 0 : -1
|
|
154
|
-
}, rest, props
|
|
155
|
+
}, rest, props)(), [
|
|
155
156
|
id,
|
|
156
|
-
ariaLabelledbyProp,
|
|
157
157
|
orientation,
|
|
158
158
|
register,
|
|
159
159
|
rest,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-tabs.cjs","names":["createDescendants","createContext","useControllableState","mergeProps","mergeRefs"],"sources":["../../../../src/components/tabs/use-tabs.ts"],"sourcesContent":["\"use client\"\n\nimport type { KeyboardEvent } from \"react\"\nimport type { HTMLProps, Orientation, PropGetter } from \"../../core\"\nimport { useCallback, useId, useState } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { createDescendants } from \"../../hooks/use-descendants\"\nimport {\n createContext,\n cx,\n handlerAll,\n isUndefined,\n mergeRefs,\n runKeyAction,\n useUpdateEffect,\n} from \"../../utils\"\n\nconst {\n DescendantsContext: TabDescendantsContext,\n useDescendant: useTabDescendant,\n useDescendants: useTabDescendants,\n} = createDescendants<HTMLButtonElement>()\n\nexport { TabDescendantsContext, useTabDescendant, useTabDescendants }\n\nconst {\n DescendantsContext: TabPanelDescendantsContext,\n useDescendant: useTabPanelDescendant,\n useDescendants: useTabPanelDescendants,\n} = createDescendants<HTMLDivElement>()\n\nexport {\n TabPanelDescendantsContext,\n useTabPanelDescendant,\n useTabPanelDescendants,\n}\n\ninterface TabsContext extends Omit<\n UseTabsReturn,\n \"getRootProps\" | \"tabDescendants\" | \"tabPanelDescendants\"\n> {}\n\nconst [TabsContext, useTabsContext] = createContext<TabsContext>({\n name: \"TabsContext\",\n})\n\nexport { TabsContext, useTabsContext }\n\nexport interface UseTabsProps extends Omit<HTMLProps, \"onChange\"> {\n /**\n * The index of the selected tab.\n */\n defaultIndex?: number\n /**\n * The index of the selected tab.\n */\n index?: number\n /**\n * If `true`, the tabs will be manually activated and display its panel by pressing Space or Enter.\n *\n * If `false`, the tabs will be automatically activated and their panel is displayed when they receive focus.\n *\n * @default false\n */\n manual?: boolean\n /**\n * The orientation of the tabs.\n *\n * @default 'horizontal'\n */\n orientation?: Orientation\n /**\n * The callback invoked when the index changes.\n */\n onChange?: (index: number) => void\n}\n\nexport const useTabs = ({\n id,\n defaultIndex = 0,\n index: indexProp,\n manual = false,\n orientation = \"horizontal\",\n onChange,\n ...rest\n}: UseTabsProps = {}) => {\n const uuid = useId()\n const tabDescendants = useTabDescendants()\n const tabPanelDescendants = useTabPanelDescendants()\n const [index, setIndex] = useControllableState({\n defaultValue: defaultIndex,\n value: indexProp,\n onChange,\n })\n const [focusedIndex, setFocusedIndex] = useState<number>(index)\n const horizontal = orientation === \"horizontal\"\n\n id ??= uuid\n\n const onFocusFirstTab = useCallback(() => {\n const first = tabDescendants.enabledFirstValue()\n\n if (first) first.node.focus()\n }, [tabDescendants])\n\n const onFocusLastTab = useCallback(() => {\n const last = tabDescendants.enabledLastValue()\n\n if (last) last.node.focus()\n }, [tabDescendants])\n\n const onFocusNextTab = useCallback(() => {\n const next = tabDescendants.enabledNextValue(focusedIndex)\n\n if (next) next.node.focus()\n }, [tabDescendants, focusedIndex])\n\n const onFocusPrevTab = useCallback(() => {\n const prev = tabDescendants.enabledPrevValue(focusedIndex)\n\n if (prev) prev.node.focus()\n }, [tabDescendants, focusedIndex])\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLDivElement>) => {\n runKeyAction(ev, {\n ArrowDown: !horizontal ? onFocusNextTab : undefined,\n ArrowLeft: horizontal ? onFocusPrevTab : undefined,\n ArrowRight: horizontal ? onFocusNextTab : undefined,\n ArrowUp: !horizontal ? onFocusPrevTab : undefined,\n End: onFocusLastTab,\n Home: onFocusFirstTab,\n })\n },\n [\n horizontal,\n onFocusNextTab,\n onFocusPrevTab,\n onFocusLastTab,\n onFocusFirstTab,\n ],\n )\n\n useUpdateEffect(() => {\n if (isUndefined(indexProp)) return\n\n setIndex(indexProp)\n setFocusedIndex(indexProp)\n }, [indexProp])\n\n const getRootProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) =>\n mergeProps({ \"data-orientation\": orientation }, rest, props, { ref })(),\n [orientation, rest],\n )\n\n const getListProps: PropGetter = useCallback(\n (props = {}) => ({\n \"aria-orientation\": orientation,\n role: \"tablist\",\n ...props,\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n }),\n [orientation, onKeyDown],\n )\n\n return {\n id,\n focusedIndex,\n index,\n manual,\n orientation,\n setFocusedIndex,\n setIndex,\n tabDescendants,\n tabPanelDescendants,\n getListProps,\n getRootProps,\n }\n}\n\nexport type UseTabsReturn = ReturnType<typeof useTabs>\n\nexport interface UseTabProps extends HTMLProps<\"button\"> {\n /**\n * The index of the tab.\n */\n index: number\n}\n\nexport const useTab = ({ id, disabled, index, ...rest }: UseTabProps) => {\n const {\n id: rootId,\n index: selectedIndex,\n manual,\n orientation,\n setFocusedIndex,\n setIndex,\n } = useTabsContext()\n const { register } = useTabDescendant({ disabled })\n const tabPanelId = `${rootId}-panel-${index}`\n const selected = index === selectedIndex\n\n id ??= `${rootId}-tab-${index}`\n\n const onClick = useCallback(() => {\n if (!disabled) setIndex(index)\n }, [index, setIndex, disabled])\n\n const onFocus = useCallback(() => {\n if (disabled) return\n\n setFocusedIndex(index)\n\n if (!manual) setIndex(index)\n }, [setFocusedIndex, index, manual, disabled, setIndex])\n\n const getRootProps: PropGetter<\"button\"> = useCallback(\n ({ ref, ...props } = {}) =>\n mergeProps(\n {\n id,\n type: \"button\",\n \"aria-controls\": tabPanelId,\n \"aria-selected\": selected,\n \"data-orientation\": orientation,\n disabled,\n role: \"tab\",\n tabIndex: selected ? 0 : -1,\n },\n rest,\n props,\n { ref: mergeRefs(ref, register) },\n {\n onClick: handlerAll(props.onClick, rest.onClick, onClick),\n onFocus: handlerAll(props.onFocus, rest.onFocus, onFocus),\n },\n )({ mergeEvent: false }),\n [\n disabled,\n id,\n onClick,\n onFocus,\n orientation,\n register,\n rest,\n selected,\n tabPanelId,\n ],\n )\n\n return { index, selected, getRootProps }\n}\n\nexport type UseTabReturn = ReturnType<typeof useTab>\n\nexport interface UseTabPanelProps extends HTMLProps {\n /**\n * The index of the tab panel.\n */\n index: number\n}\n\nexport const useTabPanel = ({\n id,\n \"aria-labelledby\": ariaLabelledbyProp,\n index,\n ...rest\n}: UseTabPanelProps) => {\n const { id: rootId, index: selectedIndex, orientation } = useTabsContext()\n const { register } = useTabPanelDescendant()\n const tabId = `${rootId}-tab-${index}`\n const selected = index === selectedIndex\n\n id ??= `${rootId}-panel-${index}`\n\n const getRootProps: PropGetter = useCallback(\n ({ ref, \"aria-labelledby\": ariaLabelledby, ...props } = {}) =>\n mergeProps(\n {\n id,\n \"aria-labelledby\": cx(ariaLabelledbyProp, ariaLabelledby, tabId),\n \"data-orientation\": orientation,\n hidden: !selected,\n role: \"tabpanel\",\n tabIndex: selected ? 0 : -1,\n },\n rest,\n props,\n { ref: mergeRefs(ref, register) },\n )(),\n [id, ariaLabelledbyProp, orientation, register, rest, selected, tabId],\n )\n\n return { index, selected, getRootProps }\n}\n\nexport type UseTabPanelReturn = ReturnType<typeof useTabPanel>\n"],"mappings":";;;;;;;;;;;;AAkBA,MAAM,EACJ,oBAAoB,uBACpB,eAAe,kBACf,gBAAgB,sBACdA,oCAAAA,mBAAsC;AAI1C,MAAM,EACJ,oBAAoB,4BACpB,eAAe,uBACf,gBAAgB,2BACdA,oCAAAA,mBAAmC;AAavC,MAAM,CAAC,aAAa,kBAAkBC,gBAAAA,cAA2B,EAC/D,MAAM,eACP,CAAC;AAiCF,MAAa,WAAW,EACtB,IACA,eAAe,GACf,OAAO,WACP,SAAS,OACT,cAAc,cACd,UACA,GAAG,SACa,EAAE,KAAK;CACvB,MAAM,QAAA,GAAA,MAAA,QAAc;CACpB,MAAM,iBAAiB,mBAAmB;CAC1C,MAAM,sBAAsB,wBAAwB;CACpD,MAAM,CAAC,OAAO,YAAYC,2CAAAA,qBAAqB;EAC7C,cAAc;EACd,OAAO;EACP;EACD,CAAC;CACF,MAAM,CA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;GAC1D,CACF,CAAC,EAAE,YAAY,OAAO,CAAC,EAC1B;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD,CAGmC;EAAE;;AAY1C,MAAa,eAAe,EAC1B,IACA,mBAAmB,oBACnB,OACA,GAAG,WACmB;CACtB,MAAM,EAAE,IAAI,QAAQ,OAAO,eAAe,gBAAgB,gBAAgB;CAC1E,MAAM,EAAE,aAAa,uBAAuB;CAC5C,MAAM,QAAQ,GAAG,OAAO,OAAO;CAC/B,MAAM,WAAW,UAAU;CAE3B,OAAO,GAAG,OAAO,SAAS;CAoB1B,OAAO;EAAE;EAAO;EAAU,eAAA,GAAA,MAAA,cAjBvB,EAAE,KAAK,mBAAmB,gBAAgB,GAAG,UAAU,EAAE,KACxDD,cAAAA,WACE;GACE;GACA,oBAAA,GAAA,oBAAA,cAAA,IAAsB,oBAAoB,gBAAgB,MAAM;GAChE,oBAAoB;GACpB,QAAQ,CAAC;GACT,MAAM;GACN,UAAU,WAAW,IAAI;GAC1B,EACD,MACA,OACA,EAAE,KAAKC,YAAAA,UAAU,KAAK,SAAS,EAAE,CAClC,EAAE,EACL;GAAC;GAAI;GAAoB;GAAa;GAAU;GAAM;GAAU;GAAM,CAGlC;EAAE"}
|
|
1
|
+
{"version":3,"file":"use-tabs.cjs","names":["createDescendants","createContext","useControllableState","mergeProps","mergeRefs"],"sources":["../../../../src/components/tabs/use-tabs.ts"],"sourcesContent":["\"use client\"\n\nimport type { KeyboardEvent } from \"react\"\nimport type { HTMLProps, Orientation, PropGetter } from \"../../core\"\nimport { useCallback, useId, useState } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { createDescendants } from \"../../hooks/use-descendants\"\nimport {\n createContext,\n handlerAll,\n isUndefined,\n mergeRefs,\n runKeyAction,\n useUpdateEffect,\n} from \"../../utils\"\n\nconst {\n DescendantsContext: TabDescendantsContext,\n useDescendant: useTabDescendant,\n useDescendants: useTabDescendants,\n} = createDescendants<HTMLButtonElement>()\n\nexport { TabDescendantsContext, useTabDescendant, useTabDescendants }\n\nconst {\n DescendantsContext: TabPanelDescendantsContext,\n useDescendant: useTabPanelDescendant,\n useDescendants: useTabPanelDescendants,\n} = createDescendants<HTMLDivElement>()\n\nexport {\n TabPanelDescendantsContext,\n useTabPanelDescendant,\n useTabPanelDescendants,\n}\n\ninterface TabsContext extends Omit<\n UseTabsReturn,\n \"getRootProps\" | \"tabDescendants\" | \"tabPanelDescendants\"\n> {}\n\nconst [TabsContext, useTabsContext] = createContext<TabsContext>({\n name: \"TabsContext\",\n})\n\nexport { TabsContext, useTabsContext }\n\nexport interface UseTabsProps extends Omit<HTMLProps, \"onChange\"> {\n /**\n * The index of the selected tab.\n */\n defaultIndex?: number\n /**\n * The index of the selected tab.\n */\n index?: number\n /**\n * If `true`, the tabs will be manually activated and display its panel by pressing Space or Enter.\n *\n * If `false`, the tabs will be automatically activated and their panel is displayed when they receive focus.\n *\n * @default false\n */\n manual?: boolean\n /**\n * The orientation of the tabs.\n *\n * @default 'horizontal'\n */\n orientation?: Orientation\n /**\n * The callback invoked when the index changes.\n */\n onChange?: (index: number) => void\n}\n\nexport const useTabs = ({\n id,\n defaultIndex = 0,\n index: indexProp,\n manual = false,\n orientation = \"horizontal\",\n onChange,\n ...rest\n}: UseTabsProps = {}) => {\n const uuid = useId()\n const tabDescendants = useTabDescendants()\n const tabPanelDescendants = useTabPanelDescendants()\n const [index, setIndex] = useControllableState({\n defaultValue: defaultIndex,\n value: indexProp,\n onChange,\n })\n const [focusedIndex, setFocusedIndex] = useState<number>(index)\n const horizontal = orientation === \"horizontal\"\n\n id ??= uuid\n\n const onFocusFirstTab = useCallback(() => {\n const first = tabDescendants.enabledFirstValue()\n\n if (first) first.node.focus()\n }, [tabDescendants])\n\n const onFocusLastTab = useCallback(() => {\n const last = tabDescendants.enabledLastValue()\n\n if (last) last.node.focus()\n }, [tabDescendants])\n\n const onFocusNextTab = useCallback(() => {\n const next = tabDescendants.enabledNextValue(focusedIndex)\n\n if (next) next.node.focus()\n }, [tabDescendants, focusedIndex])\n\n const onFocusPrevTab = useCallback(() => {\n const prev = tabDescendants.enabledPrevValue(focusedIndex)\n\n if (prev) prev.node.focus()\n }, [tabDescendants, focusedIndex])\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLDivElement>) => {\n runKeyAction(ev, {\n ArrowDown: !horizontal ? onFocusNextTab : undefined,\n ArrowLeft: horizontal ? onFocusPrevTab : undefined,\n ArrowRight: horizontal ? onFocusNextTab : undefined,\n ArrowUp: !horizontal ? onFocusPrevTab : undefined,\n End: onFocusLastTab,\n Home: onFocusFirstTab,\n })\n },\n [\n horizontal,\n onFocusNextTab,\n onFocusPrevTab,\n onFocusLastTab,\n onFocusFirstTab,\n ],\n )\n\n useUpdateEffect(() => {\n if (isUndefined(indexProp)) return\n\n setIndex(indexProp)\n setFocusedIndex(indexProp)\n }, [indexProp])\n\n const getRootProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) =>\n mergeProps({ \"data-orientation\": orientation }, rest, props, { ref })(),\n [orientation, rest],\n )\n\n const getListProps: PropGetter = useCallback(\n (props = {}) => ({\n \"aria-orientation\": orientation,\n role: \"tablist\",\n ...props,\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n }),\n [orientation, onKeyDown],\n )\n\n return {\n id,\n focusedIndex,\n index,\n manual,\n orientation,\n setFocusedIndex,\n setIndex,\n tabDescendants,\n tabPanelDescendants,\n getListProps,\n getRootProps,\n }\n}\n\nexport type UseTabsReturn = ReturnType<typeof useTabs>\n\nexport interface UseTabProps extends HTMLProps<\"button\"> {\n /**\n * The index of the tab.\n */\n index: number\n}\n\nexport const useTab = ({ id, disabled, index, ...rest }: UseTabProps) => {\n const {\n id: rootId,\n index: selectedIndex,\n manual,\n orientation,\n setFocusedIndex,\n setIndex,\n } = useTabsContext()\n const { register } = useTabDescendant({ disabled })\n const tabPanelId = `${rootId}-panel-${index}`\n const selected = index === selectedIndex\n\n id ??= `${rootId}-tab-${index}`\n\n const onClick = useCallback(() => {\n if (!disabled) setIndex(index)\n }, [index, setIndex, disabled])\n\n const onFocus = useCallback(() => {\n if (disabled) return\n\n setFocusedIndex(index)\n\n if (!manual) setIndex(index)\n }, [setFocusedIndex, index, manual, disabled, setIndex])\n\n const getRootProps: PropGetter<\"button\"> = useCallback(\n ({ ref, ...props } = {}) =>\n mergeProps(\n {\n id,\n type: \"button\",\n \"aria-controls\": tabPanelId,\n \"aria-selected\": selected,\n \"data-orientation\": orientation,\n disabled,\n role: \"tab\",\n tabIndex: selected ? 0 : -1,\n },\n rest,\n props,\n { ref: mergeRefs(ref, register) },\n {\n onClick: handlerAll(props.onClick, rest.onClick, onClick),\n onFocus: handlerAll(props.onFocus, rest.onFocus, onFocus),\n },\n )({ mergeEvent: false }),\n [\n disabled,\n id,\n onClick,\n onFocus,\n orientation,\n register,\n rest,\n selected,\n tabPanelId,\n ],\n )\n\n return { index, selected, getRootProps }\n}\n\nexport type UseTabReturn = ReturnType<typeof useTab>\n\nexport interface UseTabPanelProps extends HTMLProps {\n /**\n * The index of the tab panel.\n */\n index: number\n}\n\nexport const useTabPanel = ({ id, index, ...rest }: UseTabPanelProps) => {\n const { id: rootId, index: selectedIndex, orientation } = useTabsContext()\n const { register } = useTabPanelDescendant()\n const tabId = `${rootId}-tab-${index}`\n const selected = index === selectedIndex\n\n id ??= `${rootId}-panel-${index}`\n\n const getRootProps: PropGetter = useCallback(\n (props = {}) =>\n mergeProps(\n {\n id,\n ref: register,\n \"aria-labelledby\": tabId,\n \"data-orientation\": orientation,\n hidden: !selected,\n role: \"tabpanel\",\n tabIndex: selected ? 0 : -1,\n },\n rest,\n props,\n )(),\n [id, orientation, register, rest, selected, tabId],\n )\n\n return { index, selected, getRootProps }\n}\n\nexport type UseTabPanelReturn = ReturnType<typeof useTabPanel>\n"],"mappings":";;;;;;;;;;;;AAiBA,MAAM,EACJ,oBAAoB,uBACpB,eAAe,kBACf,gB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,SAAS,MAAM;IAC3B;EAAC;EAAiB;EAAO;EAAQ;EAAU;EAAS,CAAC;CAoCxD,OAAO;EAAE;EAAO;EAAU,eAAA,GAAA,MAAA,cAjCvB,EAAE,KAAK,GAAG,UAAU,EAAE,KACrBA,cAAAA,WACE;GACE;GACA,MAAM;GACN,iBAAiB;GACjB,iBAAiB;GACjB,oBAAoB;GACpB;GACA,MAAM;GACN,UAAU,WAAW,IAAI;GAC1B,EACD,MACA,OACA,EAAE,KAAKC,YAAAA,UAAU,KAAK,SAAS,EAAE,EACjC;GACE,UAAA,GAAA,oBAAA,cAAA,YAAoB,MAAM,SAAS,KAAK,SAAS,QAAQ;GACzD,UAAA,GAAA,oBAAA,cAAA,YAAoB,MAAM,SAAS,KAAK,SAAS,QAAQ;GAC1D,CACF,CAAC,EAAE,YAAY,OAAO,CAAC,EAC1B;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD,CAGmC;EAAE;;AAY1C,MAAa,eAAe,EAAE,IAAI,OAAO,GAAG,WAA6B;CACvE,MAAM,EAAE,IAAI,QAAQ,OAAO,eAAe,gBAAgB,gBAAgB;CAC1E,MAAM,EAAE,aAAa,uBAAuB;CAC5C,MAAM,QAAQ,GAAG,OAAO,OAAO;CAC/B,MAAM,WAAW,UAAU;CAE3B,OAAO,GAAG,OAAO,SAAS;CAoB1B,OAAO;EAAE;EAAO;EAAU,eAAA,GAAA,MAAA,cAjBvB,QAAQ,EAAE,KACTD,cAAAA,WACE;GACE;GACA,KAAK;GACL,mBAAmB;GACnB,oBAAoB;GACpB,QAAQ,CAAC;GACT,MAAM;GACN,UAAU,WAAW,IAAI;GAC1B,EACD,MACA,MACD,EAAE,EACL;GAAC;GAAI;GAAa;GAAU;GAAM;GAAU;GAAM,CAGd;EAAE"}
|
|
@@ -13,7 +13,7 @@ const [RadioGroupContext, useRadioGroupContext] = createContext$1({
|
|
|
13
13
|
});
|
|
14
14
|
const useRadioGroup = (props = {}) => {
|
|
15
15
|
const uuid = useId();
|
|
16
|
-
const { context: { labelId } = {}, props: { id = uuid, defaultValue, disabled, readOnly, required, value: valueProp, onChange: onChangeProp, ...rest }, ariaProps: { "aria-describedby":
|
|
16
|
+
const { context: { labelId } = {}, props: { id = uuid, defaultValue, disabled, readOnly, required, value: valueProp, onChange: onChangeProp, ...rest }, ariaProps: { "aria-describedby": ariaDescribedby, ...ariaProps }, dataProps, eventProps } = useFieldProps(props);
|
|
17
17
|
const interactive = !(readOnly || disabled);
|
|
18
18
|
const [value, setValue] = useControllableState({
|
|
19
19
|
defaultValue,
|
|
@@ -25,13 +25,13 @@ const useRadioGroup = (props = {}) => {
|
|
|
25
25
|
if ((0, utils_exports.isObject)(valueOrEv)) setValue(valueOrEv.target.value);
|
|
26
26
|
else setValue(valueOrEv);
|
|
27
27
|
}, [interactive, setValue]);
|
|
28
|
-
const getRootProps = useCallback((
|
|
28
|
+
const getRootProps = useCallback((props = {}) => mergeProps(dataProps, {
|
|
29
29
|
id,
|
|
30
|
-
"aria-describedby":
|
|
31
|
-
"aria-labelledby":
|
|
30
|
+
"aria-describedby": ariaDescribedby,
|
|
31
|
+
"aria-labelledby": labelId,
|
|
32
32
|
role: "radiogroup"
|
|
33
|
-
},
|
|
34
|
-
|
|
33
|
+
}, rest, props)(), [
|
|
34
|
+
ariaDescribedby,
|
|
35
35
|
dataProps,
|
|
36
36
|
id,
|
|
37
37
|
labelId,
|
|
@@ -42,7 +42,7 @@ const useRadioGroup = (props = {}) => {
|
|
|
42
42
|
value,
|
|
43
43
|
getInputProps: useCallback((props = {}) => {
|
|
44
44
|
const checked = !(0, utils_exports.isUndefined)(value) && value === props.value;
|
|
45
|
-
return {
|
|
45
|
+
return mergeProps({
|
|
46
46
|
...dataProps,
|
|
47
47
|
...ariaProps,
|
|
48
48
|
type: "radio",
|
|
@@ -53,12 +53,11 @@ const useRadioGroup = (props = {}) => {
|
|
|
53
53
|
checked,
|
|
54
54
|
disabled,
|
|
55
55
|
readOnly,
|
|
56
|
-
required
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
};
|
|
56
|
+
required
|
|
57
|
+
}, props, {
|
|
58
|
+
onChange,
|
|
59
|
+
...eventProps
|
|
60
|
+
})();
|
|
62
61
|
}, [
|
|
63
62
|
ariaProps,
|
|
64
63
|
dataProps,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-radio-group.js","names":["createContext"],"sources":["../../../../src/components/radio/use-radio-group.ts"],"sourcesContent":["\"use client\"\n\nimport type { ChangeEvent } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { FieldProps } from \"../field\"\nimport { useCallback, useId } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport {\n createContext,\n
|
|
1
|
+
{"version":3,"file":"use-radio-group.js","names":["createContext"],"sources":["../../../../src/components/radio/use-radio-group.ts"],"sourcesContent":["\"use client\"\n\nimport type { ChangeEvent } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { FieldProps } from \"../field\"\nimport { useCallback, useId } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport {\n createContext,\n dataAttr,\n isObject,\n isUndefined,\n visuallyHiddenAttributes,\n} from \"../../utils\"\nimport { useFieldProps } from \"../field\"\n\ninterface RadioGroupContext extends Omit<UseRadioGroupReturn, \"getRootProps\"> {}\n\nconst [RadioGroupContext, useRadioGroupContext] =\n createContext<RadioGroupContext>({\n name: \"RadioGroupContext\",\n strict: false,\n })\n\nexport { RadioGroupContext, useRadioGroupContext }\n\nexport interface UseRadioGroupProps<Y extends string = string>\n extends Omit<HTMLProps, \"defaultValue\" | \"onChange\" | \"value\">, FieldProps {\n /**\n * The initial value of the radio group.\n */\n defaultValue?: Y\n /**\n * The value of the radio group.\n */\n value?: Y\n /**\n * The callback fired when any children radio is checked or unchecked.\n */\n onChange?: (value: Y) => void\n}\n\nexport const useRadioGroup = <Y extends string = string>(\n props: UseRadioGroupProps<Y> = {},\n) => {\n const uuid = useId()\n const {\n context: { labelId } = {},\n props: {\n id = uuid,\n defaultValue,\n disabled,\n readOnly,\n required,\n value: valueProp,\n onChange: onChangeProp,\n ...rest\n },\n ariaProps: { \"aria-describedby\": ariaDescribedby, ...ariaProps },\n dataProps,\n eventProps,\n } = useFieldProps(props)\n const interactive = !(readOnly || disabled)\n const [value, setValue] = useControllableState({\n defaultValue,\n value: valueProp,\n onChange: onChangeProp,\n })\n\n const onChange = useCallback(\n (valueOrEv: ChangeEvent<HTMLInputElement> | Y) => {\n if (!interactive) return\n\n if (isObject(valueOrEv)) {\n setValue(valueOrEv.target.value as Y)\n } else {\n setValue(valueOrEv)\n }\n },\n [interactive, setValue],\n )\n\n const getRootProps: PropGetter = useCallback(\n (props = {}) =>\n mergeProps(\n dataProps,\n {\n id,\n \"aria-describedby\": ariaDescribedby,\n \"aria-labelledby\": labelId,\n role: \"radiogroup\",\n },\n rest,\n props,\n )(),\n [ariaDescribedby, dataProps, id, labelId, rest],\n )\n\n const getInputProps: PropGetter<\"input\"> = useCallback(\n (props = {}) => {\n const checked = !isUndefined(value) && value === props.value\n\n return mergeProps(\n {\n ...dataProps,\n ...ariaProps,\n type: \"radio\",\n name: id,\n style: visuallyHiddenAttributes.style,\n \"aria-checked\": checked,\n \"data-checked\": dataAttr(checked),\n checked,\n disabled,\n readOnly,\n required,\n },\n props,\n { onChange, ...eventProps },\n )()\n },\n [\n ariaProps,\n dataProps,\n disabled,\n eventProps,\n id,\n onChange,\n readOnly,\n required,\n value,\n ],\n )\n\n const getLabelProps: PropGetter<\"label\"> = useCallback(\n (props) => ({\n ...dataProps,\n ...props,\n }),\n [dataProps],\n )\n\n return {\n name: id,\n value,\n getInputProps,\n getLabelProps,\n getRootProps,\n onChange,\n }\n}\n\nexport type UseRadioGroupReturn = ReturnType<typeof useRadioGroup>\n"],"mappings":";;;;;;;;;AAmBA,MAA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AU,CAOE;EACb;EACA;EACD"}
|
|
@@ -134,7 +134,7 @@ const useTab = ({ id, disabled, index, ...rest }) => {
|
|
|
134
134
|
])
|
|
135
135
|
};
|
|
136
136
|
};
|
|
137
|
-
const useTabPanel = ({ id,
|
|
137
|
+
const useTabPanel = ({ id, index, ...rest }) => {
|
|
138
138
|
const { id: rootId, index: selectedIndex, orientation } = useTabsContext();
|
|
139
139
|
const { register } = useTabPanelDescendant();
|
|
140
140
|
const tabId = `${rootId}-tab-${index}`;
|
|
@@ -143,16 +143,16 @@ const useTabPanel = ({ id, "aria-labelledby": ariaLabelledbyProp, index, ...rest
|
|
|
143
143
|
return {
|
|
144
144
|
index,
|
|
145
145
|
selected,
|
|
146
|
-
getRootProps: useCallback((
|
|
146
|
+
getRootProps: useCallback((props = {}) => mergeProps({
|
|
147
147
|
id,
|
|
148
|
-
|
|
148
|
+
ref: register,
|
|
149
|
+
"aria-labelledby": tabId,
|
|
149
150
|
"data-orientation": orientation,
|
|
150
151
|
hidden: !selected,
|
|
151
152
|
role: "tabpanel",
|
|
152
153
|
tabIndex: selected ? 0 : -1
|
|
153
|
-
}, rest, props
|
|
154
|
+
}, rest, props)(), [
|
|
154
155
|
id,
|
|
155
|
-
ariaLabelledbyProp,
|
|
156
156
|
orientation,
|
|
157
157
|
register,
|
|
158
158
|
rest,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-tabs.js","names":["createContext"],"sources":["../../../../src/components/tabs/use-tabs.ts"],"sourcesContent":["\"use client\"\n\nimport type { KeyboardEvent } from \"react\"\nimport type { HTMLProps, Orientation, PropGetter } from \"../../core\"\nimport { useCallback, useId, useState } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { createDescendants } from \"../../hooks/use-descendants\"\nimport {\n createContext,\n cx,\n handlerAll,\n isUndefined,\n mergeRefs,\n runKeyAction,\n useUpdateEffect,\n} from \"../../utils\"\n\nconst {\n DescendantsContext: TabDescendantsContext,\n useDescendant: useTabDescendant,\n useDescendants: useTabDescendants,\n} = createDescendants<HTMLButtonElement>()\n\nexport { TabDescendantsContext, useTabDescendant, useTabDescendants }\n\nconst {\n DescendantsContext: TabPanelDescendantsContext,\n useDescendant: useTabPanelDescendant,\n useDescendants: useTabPanelDescendants,\n} = createDescendants<HTMLDivElement>()\n\nexport {\n TabPanelDescendantsContext,\n useTabPanelDescendant,\n useTabPanelDescendants,\n}\n\ninterface TabsContext extends Omit<\n UseTabsReturn,\n \"getRootProps\" | \"tabDescendants\" | \"tabPanelDescendants\"\n> {}\n\nconst [TabsContext, useTabsContext] = createContext<TabsContext>({\n name: \"TabsContext\",\n})\n\nexport { TabsContext, useTabsContext }\n\nexport interface UseTabsProps extends Omit<HTMLProps, \"onChange\"> {\n /**\n * The index of the selected tab.\n */\n defaultIndex?: number\n /**\n * The index of the selected tab.\n */\n index?: number\n /**\n * If `true`, the tabs will be manually activated and display its panel by pressing Space or Enter.\n *\n * If `false`, the tabs will be automatically activated and their panel is displayed when they receive focus.\n *\n * @default false\n */\n manual?: boolean\n /**\n * The orientation of the tabs.\n *\n * @default 'horizontal'\n */\n orientation?: Orientation\n /**\n * The callback invoked when the index changes.\n */\n onChange?: (index: number) => void\n}\n\nexport const useTabs = ({\n id,\n defaultIndex = 0,\n index: indexProp,\n manual = false,\n orientation = \"horizontal\",\n onChange,\n ...rest\n}: UseTabsProps = {}) => {\n const uuid = useId()\n const tabDescendants = useTabDescendants()\n const tabPanelDescendants = useTabPanelDescendants()\n const [index, setIndex] = useControllableState({\n defaultValue: defaultIndex,\n value: indexProp,\n onChange,\n })\n const [focusedIndex, setFocusedIndex] = useState<number>(index)\n const horizontal = orientation === \"horizontal\"\n\n id ??= uuid\n\n const onFocusFirstTab = useCallback(() => {\n const first = tabDescendants.enabledFirstValue()\n\n if (first) first.node.focus()\n }, [tabDescendants])\n\n const onFocusLastTab = useCallback(() => {\n const last = tabDescendants.enabledLastValue()\n\n if (last) last.node.focus()\n }, [tabDescendants])\n\n const onFocusNextTab = useCallback(() => {\n const next = tabDescendants.enabledNextValue(focusedIndex)\n\n if (next) next.node.focus()\n }, [tabDescendants, focusedIndex])\n\n const onFocusPrevTab = useCallback(() => {\n const prev = tabDescendants.enabledPrevValue(focusedIndex)\n\n if (prev) prev.node.focus()\n }, [tabDescendants, focusedIndex])\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLDivElement>) => {\n runKeyAction(ev, {\n ArrowDown: !horizontal ? onFocusNextTab : undefined,\n ArrowLeft: horizontal ? onFocusPrevTab : undefined,\n ArrowRight: horizontal ? onFocusNextTab : undefined,\n ArrowUp: !horizontal ? onFocusPrevTab : undefined,\n End: onFocusLastTab,\n Home: onFocusFirstTab,\n })\n },\n [\n horizontal,\n onFocusNextTab,\n onFocusPrevTab,\n onFocusLastTab,\n onFocusFirstTab,\n ],\n )\n\n useUpdateEffect(() => {\n if (isUndefined(indexProp)) return\n\n setIndex(indexProp)\n setFocusedIndex(indexProp)\n }, [indexProp])\n\n const getRootProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) =>\n mergeProps({ \"data-orientation\": orientation }, rest, props, { ref })(),\n [orientation, rest],\n )\n\n const getListProps: PropGetter = useCallback(\n (props = {}) => ({\n \"aria-orientation\": orientation,\n role: \"tablist\",\n ...props,\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n }),\n [orientation, onKeyDown],\n )\n\n return {\n id,\n focusedIndex,\n index,\n manual,\n orientation,\n setFocusedIndex,\n setIndex,\n tabDescendants,\n tabPanelDescendants,\n getListProps,\n getRootProps,\n }\n}\n\nexport type UseTabsReturn = ReturnType<typeof useTabs>\n\nexport interface UseTabProps extends HTMLProps<\"button\"> {\n /**\n * The index of the tab.\n */\n index: number\n}\n\nexport const useTab = ({ id, disabled, index, ...rest }: UseTabProps) => {\n const {\n id: rootId,\n index: selectedIndex,\n manual,\n orientation,\n setFocusedIndex,\n setIndex,\n } = useTabsContext()\n const { register } = useTabDescendant({ disabled })\n const tabPanelId = `${rootId}-panel-${index}`\n const selected = index === selectedIndex\n\n id ??= `${rootId}-tab-${index}`\n\n const onClick = useCallback(() => {\n if (!disabled) setIndex(index)\n }, [index, setIndex, disabled])\n\n const onFocus = useCallback(() => {\n if (disabled) return\n\n setFocusedIndex(index)\n\n if (!manual) setIndex(index)\n }, [setFocusedIndex, index, manual, disabled, setIndex])\n\n const getRootProps: PropGetter<\"button\"> = useCallback(\n ({ ref, ...props } = {}) =>\n mergeProps(\n {\n id,\n type: \"button\",\n \"aria-controls\": tabPanelId,\n \"aria-selected\": selected,\n \"data-orientation\": orientation,\n disabled,\n role: \"tab\",\n tabIndex: selected ? 0 : -1,\n },\n rest,\n props,\n { ref: mergeRefs(ref, register) },\n {\n onClick: handlerAll(props.onClick, rest.onClick, onClick),\n onFocus: handlerAll(props.onFocus, rest.onFocus, onFocus),\n },\n )({ mergeEvent: false }),\n [\n disabled,\n id,\n onClick,\n onFocus,\n orientation,\n register,\n rest,\n selected,\n tabPanelId,\n ],\n )\n\n return { index, selected, getRootProps }\n}\n\nexport type UseTabReturn = ReturnType<typeof useTab>\n\nexport interface UseTabPanelProps extends HTMLProps {\n /**\n * The index of the tab panel.\n */\n index: number\n}\n\nexport const useTabPanel = ({\n id,\n \"aria-labelledby\": ariaLabelledbyProp,\n index,\n ...rest\n}: UseTabPanelProps) => {\n const { id: rootId, index: selectedIndex, orientation } = useTabsContext()\n const { register } = useTabPanelDescendant()\n const tabId = `${rootId}-tab-${index}`\n const selected = index === selectedIndex\n\n id ??= `${rootId}-panel-${index}`\n\n const getRootProps: PropGetter = useCallback(\n ({ ref, \"aria-labelledby\": ariaLabelledby, ...props } = {}) =>\n mergeProps(\n {\n id,\n \"aria-labelledby\": cx(ariaLabelledbyProp, ariaLabelledby, tabId),\n \"data-orientation\": orientation,\n hidden: !selected,\n role: \"tabpanel\",\n tabIndex: selected ? 0 : -1,\n },\n rest,\n props,\n { ref: mergeRefs(ref, register) },\n )(),\n [id, ariaLabelledbyProp, orientation, register, rest, selected, tabId],\n )\n\n return { index, selected, getRootProps }\n}\n\nexport type UseTabPanelReturn = ReturnType<typeof useTabPanel>\n"],"mappings":";;;;;;;;;;;AAkBA,MAAM,EACJ,oBAAoB,uBACpB,eAAe,kBACf,gBAAgB,sBACd,mBAAsC;AAI1C,MAAM,EACJ,oBAAoB,4BACpB,eAAe,uBACf,gBAAgB,2BACd,mBAAmC;AAavC,MAAM,CAAC,aAAa,kBAAkBA,gBAA2B,EAC/D,MAAM,eACP,CAAC;AAiCF,MAAa,WAAW,EACtB,IACA,eAAe,GACf,OAAO,WACP,SAAS,OACT,cAAc,cACd,UACA,GAAG,SACa,EAAE,KAAK;CACvB,MAAM,OAAO,OAAO;CACpB,MAAM,iBAAiB,mBAAmB;CAC1C,MAAM,sBAAsB,wBAAwB;CACpD,MAAM,CAAC,OAAO,YAAY,qBAAqB;EAC7C,cAAc;EACd,OAAO;EACP;EACD,CAAC;CACF,MAAM,CAAC,cAAc,mBAAmB,SAAiB,MAAM;CAC/D,MAAM,aAAa,gBAAgB;CAEnC,OAAO;CAEP,MAAM,kBAAkB,kBAAkB;EACxC,MAAM,QAAQ,eAAe,mBAAmB;EAEhD,IAAI,OAAO,MAAM,KAAK,OAAO;IAC5B,CAAC,eAAe,CAAC;CAEpB,MAAM,iBAAiB,kBAAkB;EACvC,MAAM,OAAO,eAAe,kBAAkB;EAE9C,IAAI,MAAM,KAAK,KAAK,OAAO;IAC1B,CAAC,eAAe,CAAC;CAEpB,MAAM,iBAAiB,kBAAkB;EACvC,MAAM,OAAO,eAAe,iBAAiB,aAAa;EAE1D,IAAI,MAAM,KAAK,KAAK,OAAO;IAC1B,CAAC,gBAAgB,aAAa,CAAC;CAElC,MAAM,iBAAiB,kBAAkB;EACvC,MAAM,OAAO,eAAe,iBAAiB,aAAa;EAE1D,IAAI,MAAM,KAAK,KAAK,OAAO;IAC1B,CAAC,gBAAgB,aAAa,CAAC;CAElC,MAAM,YAAY,aACf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AC3B;EAAC;EAAiB;EAAO;EAAQ;EAAU;EAAS,CAAC;CAoCxD,OAAO;EAAE;EAAO;EAAU,cAlCiB,aACxC,EAAE,KAAK,GAAG,UAAU,EAAE,KACrB,WACE;GACE;GACA,MAAM;GACN,iBAAiB;GACjB,iBAAiB;GACjB,oBAAoB;GACpB;GACA,MAAM;GACN,UAAU,WAAW,IAAI;GAC1B,EACD,MACA,OACA,EAAE,KAAK,UAAU,KAAK,SAAS,EAAE,EACjC;GACE,UAAA,GAAA,cAAA,YAAoB,MAAM,SAAS,KAAK,SAAS,QAAQ;GACzD,UAAA,GAAA,cAAA,YAAoB,MAAM,SAAS,KAAK,SAAS,QAAQ;GAC1D,CACF,CAAC,EAAE,YAAY,OAAO,CAAC,EAC1B;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD,CAGmC;EAAE;;AAY1C,MAAa,eAAe,EAC1B,IACA,mBAAmB,oBACnB,OACA,GAAG,WACmB;CACtB,MAAM,EAAE,IAAI,QAAQ,OAAO,eAAe,gBAAgB,gBAAgB;CAC1E,MAAM,EAAE,aAAa,uBAAuB;CAC5C,MAAM,QAAQ,GAAG,OAAO,OAAO;CAC/B,MAAM,WAAW,UAAU;CAE3B,OAAO,GAAG,OAAO,SAAS;CAoB1B,OAAO;EAAE;EAAO;EAAU,cAlBO,aAC9B,EAAE,KAAK,mBAAmB,gBAAgB,GAAG,UAAU,EAAE,KACxD,WACE;GACE;GACA,oBAAA,GAAA,cAAA,IAAsB,oBAAoB,gBAAgB,MAAM;GAChE,oBAAoB;GACpB,QAAQ,CAAC;GACT,MAAM;GACN,UAAU,WAAW,IAAI;GAC1B,EACD,MACA,OACA,EAAE,KAAK,UAAU,KAAK,SAAS,EAAE,CAClC,EAAE,EACL;GAAC;GAAI;GAAoB;GAAa;GAAU;GAAM;GAAU;GAAM,CAGlC;EAAE"}
|
|
1
|
+
{"version":3,"file":"use-tabs.js","names":["createContext"],"sources":["../../../../src/components/tabs/use-tabs.ts"],"sourcesContent":["\"use client\"\n\nimport type { KeyboardEvent } from \"react\"\nimport type { HTMLProps, Orientation, PropGetter } from \"../../core\"\nimport { useCallback, useId, useState } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { createDescendants } from \"../../hooks/use-descendants\"\nimport {\n createContext,\n handlerAll,\n isUndefined,\n mergeRefs,\n runKeyAction,\n useUpdateEffect,\n} from \"../../utils\"\n\nconst {\n DescendantsContext: TabDescendantsContext,\n useDescendant: useTabDescendant,\n useDescendants: useTabDescendants,\n} = createDescendants<HTMLButtonElement>()\n\nexport { TabDescendantsContext, useTabDescendant, useTabDescendants }\n\nconst {\n DescendantsContext: TabPanelDescendantsContext,\n useDescendant: useTabPanelDescendant,\n useDescendants: useTabPanelDescendants,\n} = createDescendants<HTMLDivElement>()\n\nexport {\n TabPanelDescendantsContext,\n useTabPanelDescendant,\n useTabPanelDescendants,\n}\n\ninterface TabsContext extends Omit<\n UseTabsReturn,\n \"getRootProps\" | \"tabDescendants\" | \"tabPanelDescendants\"\n> {}\n\nconst [TabsContext, useTabsContext] = createContext<TabsContext>({\n name: \"TabsContext\",\n})\n\nexport { TabsContext, useTabsContext }\n\nexport interface UseTabsProps extends Omit<HTMLProps, \"onChange\"> {\n /**\n * The index of the selected tab.\n */\n defaultIndex?: number\n /**\n * The index of the selected tab.\n */\n index?: number\n /**\n * If `true`, the tabs will be manually activated and display its panel by pressing Space or Enter.\n *\n * If `false`, the tabs will be automatically activated and their panel is displayed when they receive focus.\n *\n * @default false\n */\n manual?: boolean\n /**\n * The orientation of the tabs.\n *\n * @default 'horizontal'\n */\n orientation?: Orientation\n /**\n * The callback invoked when the index changes.\n */\n onChange?: (index: number) => void\n}\n\nexport const useTabs = ({\n id,\n defaultIndex = 0,\n index: indexProp,\n manual = false,\n orientation = \"horizontal\",\n onChange,\n ...rest\n}: UseTabsProps = {}) => {\n const uuid = useId()\n const tabDescendants = useTabDescendants()\n const tabPanelDescendants = useTabPanelDescendants()\n const [index, setIndex] = useControllableState({\n defaultValue: defaultIndex,\n value: indexProp,\n onChange,\n })\n const [focusedIndex, setFocusedIndex] = useState<number>(index)\n const horizontal = orientation === \"horizontal\"\n\n id ??= uuid\n\n const onFocusFirstTab = useCallback(() => {\n const first = tabDescendants.enabledFirstValue()\n\n if (first) first.node.focus()\n }, [tabDescendants])\n\n const onFocusLastTab = useCallback(() => {\n const last = tabDescendants.enabledLastValue()\n\n if (last) last.node.focus()\n }, [tabDescendants])\n\n const onFocusNextTab = useCallback(() => {\n const next = tabDescendants.enabledNextValue(focusedIndex)\n\n if (next) next.node.focus()\n }, [tabDescendants, focusedIndex])\n\n const onFocusPrevTab = useCallback(() => {\n const prev = tabDescendants.enabledPrevValue(focusedIndex)\n\n if (prev) prev.node.focus()\n }, [tabDescendants, focusedIndex])\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLDivElement>) => {\n runKeyAction(ev, {\n ArrowDown: !horizontal ? onFocusNextTab : undefined,\n ArrowLeft: horizontal ? onFocusPrevTab : undefined,\n ArrowRight: horizontal ? onFocusNextTab : undefined,\n ArrowUp: !horizontal ? onFocusPrevTab : undefined,\n End: onFocusLastTab,\n Home: onFocusFirstTab,\n })\n },\n [\n horizontal,\n onFocusNextTab,\n onFocusPrevTab,\n onFocusLastTab,\n onFocusFirstTab,\n ],\n )\n\n useUpdateEffect(() => {\n if (isUndefined(indexProp)) return\n\n setIndex(indexProp)\n setFocusedIndex(indexProp)\n }, [indexProp])\n\n const getRootProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) =>\n mergeProps({ \"data-orientation\": orientation }, rest, props, { ref })(),\n [orientation, rest],\n )\n\n const getListProps: PropGetter = useCallback(\n (props = {}) => ({\n \"aria-orientation\": orientation,\n role: \"tablist\",\n ...props,\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n }),\n [orientation, onKeyDown],\n )\n\n return {\n id,\n focusedIndex,\n index,\n manual,\n orientation,\n setFocusedIndex,\n setIndex,\n tabDescendants,\n tabPanelDescendants,\n getListProps,\n getRootProps,\n }\n}\n\nexport type UseTabsReturn = ReturnType<typeof useTabs>\n\nexport interface UseTabProps extends HTMLProps<\"button\"> {\n /**\n * The index of the tab.\n */\n index: number\n}\n\nexport const useTab = ({ id, disabled, index, ...rest }: UseTabProps) => {\n const {\n id: rootId,\n index: selectedIndex,\n manual,\n orientation,\n setFocusedIndex,\n setIndex,\n } = useTabsContext()\n const { register } = useTabDescendant({ disabled })\n const tabPanelId = `${rootId}-panel-${index}`\n const selected = index === selectedIndex\n\n id ??= `${rootId}-tab-${index}`\n\n const onClick = useCallback(() => {\n if (!disabled) setIndex(index)\n }, [index, setIndex, disabled])\n\n const onFocus = useCallback(() => {\n if (disabled) return\n\n setFocusedIndex(index)\n\n if (!manual) setIndex(index)\n }, [setFocusedIndex, index, manual, disabled, setIndex])\n\n const getRootProps: PropGetter<\"button\"> = useCallback(\n ({ ref, ...props } = {}) =>\n mergeProps(\n {\n id,\n type: \"button\",\n \"aria-controls\": tabPanelId,\n \"aria-selected\": selected,\n \"data-orientation\": orientation,\n disabled,\n role: \"tab\",\n tabIndex: selected ? 0 : -1,\n },\n rest,\n props,\n { ref: mergeRefs(ref, register) },\n {\n onClick: handlerAll(props.onClick, rest.onClick, onClick),\n onFocus: handlerAll(props.onFocus, rest.onFocus, onFocus),\n },\n )({ mergeEvent: false }),\n [\n disabled,\n id,\n onClick,\n onFocus,\n orientation,\n register,\n rest,\n selected,\n tabPanelId,\n ],\n )\n\n return { index, selected, getRootProps }\n}\n\nexport type UseTabReturn = ReturnType<typeof useTab>\n\nexport interface UseTabPanelProps extends HTMLProps {\n /**\n * The index of the tab panel.\n */\n index: number\n}\n\nexport const useTabPanel = ({ id, index, ...rest }: UseTabPanelProps) => {\n const { id: rootId, index: selectedIndex, orientation } = useTabsContext()\n const { register } = useTabPanelDescendant()\n const tabId = `${rootId}-tab-${index}`\n const selected = index === selectedIndex\n\n id ??= `${rootId}-panel-${index}`\n\n const getRootProps: PropGetter = useCallback(\n (props = {}) =>\n mergeProps(\n {\n id,\n ref: register,\n \"aria-labelledby\": tabId,\n \"data-orientation\": orientation,\n hidden: !selected,\n role: \"tabpanel\",\n tabIndex: selected ? 0 : -1,\n },\n rest,\n props,\n )(),\n [id, orientation, register, rest, selected, tabId],\n )\n\n return { index, selected, getRootProps }\n}\n\nexport type UseTabPanelReturn = ReturnType<typeof useTabPanel>\n"],"mappings":";;;;;;;;;;;AAiBA,MAAM,EACJ,oBAAoB,uBACpB,eAAe,kBACf,gBAAgB,sBACd,mBAAsC;AAI1C,MAAM,EACJ,oBAAoB,4BACpB,eAAe,uBACf,gBAAgB,2BACd,mBAAmC;AAavC,MAAM,CAAC,aAAa,kBAAkBA,gBAA2B,EAC/D,MAAM,eACP,CAAC;AAiCF,MAAa,WAAW,EACtB,IACA,eAAe,GACf,OAAO,WACP,SAAS,OACT,cAAc,cACd,UACA,GAAG,SACa,EAAE,KAAK;CACvB,MAAM,OAAO,OAAO;CACpB,MAAM,iBAAiB,mBAAmB;CAC1C,MAAM,sBAAsB,wBAAwB;CACpD,MAAM,CAAC,OAAO,YAAY,qBAAqB;EAC7C,cAAc;EACd,OAAO;EACP;EACD,CAAC;CACF,MAAM,CAAC,cAAc,mBAAmB,SAAiB,MAAM;CAC/D,MAAM,aAAa,gBAAgB;CAEnC,OAAO;CAEP,MAAM,kBAAkB,kBAAkB;EACxC,MAAM,QAAQ,eAAe,mBAAmB;EAEhD,IAAI,OAAO,MAAM,KAAK,OAAO;IAC5B,CAAC,eAAe,CAAC;CAEpB,MAAM,iBAAiB,kBAAkB;EACvC,MAAM,OAAO,eAAe,kBAAkB;EAE9C,IAAI,MAAM,KAAK,KAAK,OAAO;IAC1B,CAAC,eAAe,CAAC;CAEpB,MAAM,iBAAiB,kBAAkB;EACvC,MAAM,OAAO,eAAe,iBAAiB,aAAa;EAE1D,IAAI,MAAM,KAAK,KAAK,OAAO;IAC1B,CAAC,gBAAg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
|
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" | "valueText" | "empty", CSSPropObject<CSSSlotObject<"input" | "label" | "option" | "content" | "group" | "separator" | "icon" | "root" | "indicator" | "field" | "valueText" | "empty">>, {
|
|
5
5
|
xs: {
|
|
6
6
|
empty: {
|
|
7
7
|
gap: "1.5";
|
|
@@ -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" | "root" | "
|
|
4
|
+
declare const calendarStyle: ComponentSlotStyle<"button" | "select" | "cell" | "navigation" | "row" | "separator" | "next" | "root" | "prev" | "month" | "week" | "weekday" | "day" | "months" | "years" | "weeks" | "control", {
|
|
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" | "root" | "
|
|
76
|
+
}, CSSModifierObject<CSSSlotObject<"button" | "select" | "cell" | "navigation" | "row" | "separator" | "next" | "root" | "prev" | "month" | "week" | "weekday" | "day" | "months" | "years" | "weeks" | "control">>>;
|
|
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" | "root" | "
|
|
4
|
+
declare const carouselStyle: ComponentSlotStyle<"list" | "next" | "root" | "indicator" | "item" | "trigger" | "prev" | "indicators", CSSPropObject<CSSSlotObject<"list" | "next" | "root" | "indicator" | "item" | "trigger" | "prev" | "indicators">>, {
|
|
5
5
|
sm: {
|
|
6
6
|
root: {
|
|
7
7
|
h: "sm";
|
|
@@ -17,7 +17,7 @@ declare const carouselStyle: ComponentSlotStyle<"list" | "next" | "root" | "trig
|
|
|
17
17
|
h: "lg";
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
-
}, CSSModifierObject<CSSSlotObject<"list" | "next" | "root" | "
|
|
20
|
+
}, CSSModifierObject<CSSSlotObject<"list" | "next" | "root" | "indicator" | "item" | "trigger" | "prev" | "indicators">>>;
|
|
21
21
|
type CarouselStyle = typeof carouselStyle;
|
|
22
22
|
//#endregion
|
|
23
23
|
export { CarouselStyle, carouselStyle };
|
|
@@ -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/chart/cartesian-chart.style.d.ts
|
|
4
|
-
declare const cartesianChartStyle: ComponentSlotStyle<"area" | "line" | "grid" | "bar" | "dot" | "root" | "
|
|
4
|
+
declare const cartesianChartStyle: ComponentSlotStyle<"area" | "line" | "grid" | "bar" | "dot" | "root" | "activeDot" | "labelList" | "referenceLine" | "referenceLineLabel" | "xAxis" | "xAxisLabel" | "xAxisTick" | "xAxisTickLine" | "yAxis" | "yAxisLabel" | "yAxisTick" | "yAxisTickLine", CSSPropObject<CSSSlotObject<"area" | "line" | "grid" | "bar" | "dot" | "root" | "activeDot" | "labelList" | "referenceLine" | "referenceLineLabel" | "xAxis" | "xAxisLabel" | "xAxisTick" | "xAxisTickLine" | "yAxis" | "yAxisLabel" | "yAxisTick" | "yAxisTickLine">>, CSSModifierObject<CSSSlotObject<"area" | "line" | "grid" | "bar" | "dot" | "root" | "activeDot" | "labelList" | "referenceLine" | "referenceLineLabel" | "xAxis" | "xAxisLabel" | "xAxisTick" | "xAxisTickLine" | "yAxis" | "yAxisLabel" | "yAxisTick" | "yAxisTickLine">>, CSSModifierObject<CSSSlotObject<"area" | "line" | "grid" | "bar" | "dot" | "root" | "activeDot" | "labelList" | "referenceLine" | "referenceLineLabel" | "xAxis" | "xAxisLabel" | "xAxisTick" | "xAxisTickLine" | "yAxis" | "yAxisLabel" | "yAxisTick" | "yAxisTickLine">>>;
|
|
5
5
|
type CartesianChartStyle = typeof cartesianChartStyle;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { CartesianChartStyle, cartesianChartStyle };
|
|
@@ -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/chart/polar-chart.style.d.ts
|
|
4
|
-
declare const polarChartStyle: ComponentSlotStyle<"label" | "grid" | "dot" | "root" | "
|
|
4
|
+
declare const polarChartStyle: ComponentSlotStyle<"label" | "grid" | "dot" | "root" | "radial" | "labelLine" | "activeDot" | "labelList" | "angleAxis" | "angleAxisLabel" | "angleAxisLine" | "angleAxisTick" | "angleAxisTickLine" | "pie" | "radar" | "radialBackground" | "radiusAxis" | "radiusAxisLabel" | "radiusAxisLine" | "radiusAxisTick" | "radiusAxisTickLine" | "sector", CSSPropObject<CSSSlotObject<"label" | "grid" | "dot" | "root" | "radial" | "labelLine" | "activeDot" | "labelList" | "angleAxis" | "angleAxisLabel" | "angleAxisLine" | "angleAxisTick" | "angleAxisTickLine" | "pie" | "radar" | "radialBackground" | "radiusAxis" | "radiusAxisLabel" | "radiusAxisLine" | "radiusAxisTick" | "radiusAxisTickLine" | "sector">>, CSSModifierObject<CSSSlotObject<"label" | "grid" | "dot" | "root" | "radial" | "labelLine" | "activeDot" | "labelList" | "angleAxis" | "angleAxisLabel" | "angleAxisLine" | "angleAxisTick" | "angleAxisTickLine" | "pie" | "radar" | "radialBackground" | "radiusAxis" | "radiusAxisLabel" | "radiusAxisLine" | "radiusAxisTick" | "radiusAxisTickLine" | "sector">>, CSSModifierObject<CSSSlotObject<"label" | "grid" | "dot" | "root" | "radial" | "labelLine" | "activeDot" | "labelList" | "angleAxis" | "angleAxisLabel" | "angleAxisLine" | "angleAxisTick" | "angleAxisTickLine" | "pie" | "radar" | "radialBackground" | "radiusAxis" | "radiusAxisLabel" | "radiusAxisLine" | "radiusAxisTick" | "radiusAxisTickLine" | "sector">>>;
|
|
5
5
|
type PolarChartStyle = typeof polarChartStyle;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { PolarChartStyle, polarChartStyle };
|
|
@@ -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" | As = "div", R extends _$_yamada_ui_utils0.Dict = _$_yamada_ui_utils0.Dict<any>>(el: H | _$react.FC<R>, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"group" | "root" | "
|
|
66
|
+
declare const component: <H extends "fragment" | As = "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: {
|
|
@@ -213,7 +213,7 @@ declare const component: <H extends "fragment" | As = "div", R extends _$_yamada
|
|
|
213
213
|
name,
|
|
214
214
|
className,
|
|
215
215
|
...options
|
|
216
|
-
}?: ComponentOptions) => (initialProps?: InitialProps<R>, ...superProps: SuperProps<R>[]) => H extends "fragment" ? _$react.FunctionComponent<R> : Component<Exclude<H, "fragment">, R>, CheckboxCardPropsContext: _$react.Context<Partial<CheckboxCardRootProps<string>> | undefined>, useCheckboxCardPropsContext: () => Partial<CheckboxCardRootProps<string>> | undefined, useRootComponentProps: <Y extends _$_yamada_ui_utils0.Dict = {}, R extends keyof Y = keyof Y>(props: Y, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"group" | "root" | "
|
|
216
|
+
}?: ComponentOptions) => (initialProps?: InitialProps<R>, ...superProps: SuperProps<R>[]) => H extends "fragment" ? _$react.FunctionComponent<R> : Component<Exclude<H, "fragment">, R>, CheckboxCardPropsContext: _$react.Context<Partial<CheckboxCardRootProps<string>> | undefined>, useCheckboxCardPropsContext: () => Partial<CheckboxCardRootProps<string>> | undefined, useRootComponentProps: <Y extends _$_yamada_ui_utils0.Dict = {}, R extends keyof Y = keyof Y>(props: Y, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"group" | "root" | "description" | "indicator" | "addon", {
|
|
217
217
|
justify: {
|
|
218
218
|
end: {
|
|
219
219
|
addon: {
|
|
@@ -363,7 +363,7 @@ declare const component: <H extends "fragment" | As = "div", R extends _$_yamada
|
|
|
363
363
|
className,
|
|
364
364
|
withContext,
|
|
365
365
|
transferProps
|
|
366
|
-
}?: UseComponentPropsOptions<R>) => [CSSSlotObject, Merge<WithoutThemeProps<Y, ComponentSlotStyle<"group" | "root" | "
|
|
366
|
+
}?: UseComponentPropsOptions<R>) => [CSSSlotObject, Merge<WithoutThemeProps<Y, ComponentSlotStyle<"group" | "root" | "description" | "indicator" | "addon", {
|
|
367
367
|
justify: {
|
|
368
368
|
end: {
|
|
369
369
|
addon: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.types.js";
|
|
2
2
|
//#region src/components/checkbox-card/checkbox-card.style.d.ts
|
|
3
|
-
declare const checkboxCardStyle: ComponentSlotStyle<"group" | "root" | "
|
|
3
|
+
declare const checkboxCardStyle: ComponentSlotStyle<"group" | "root" | "description" | "indicator" | "addon", {
|
|
4
4
|
/**
|
|
5
5
|
* The justify indicator 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/color-picker/color-picker.style.d.ts
|
|
4
|
-
declare const colorPickerStyle: ComponentSlotStyle<"input" | "content" | "icon" | "root" | "
|
|
4
|
+
declare const colorPickerStyle: ComponentSlotStyle<"input" | "content" | "icon" | "root" | "field" | "colorSwatch" | "eyeDropper", CSSPropObject<CSSSlotObject<"input" | "content" | "icon" | "root" | "field" | "colorSwatch" | "eyeDropper">>, {
|
|
5
5
|
xs: {
|
|
6
6
|
field: {
|
|
7
7
|
fontSize: "1em";
|
|
@@ -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/color-selector/color-selector.style.d.ts
|
|
4
|
-
declare const colorSelectorStyle: ComponentSlotStyle<"root" | "hueSlider" | "saturationSlider" | "eyeDropper" | "
|
|
4
|
+
declare const colorSelectorStyle: ComponentSlotStyle<"root" | "hueSlider" | "saturationSlider" | "eyeDropper" | "colorSwatchGroupLabel" | "alphaSlider" | "colorSwatchGroup" | "colorSwatchItem", {
|
|
5
5
|
/**
|
|
6
6
|
* The shape of the thumb and color swatch.
|
|
7
7
|
*
|
|
@@ -22,7 +22,7 @@ declare const colorSelectorStyle: ComponentSlotStyle<"root" | "hueSlider" | "sat
|
|
|
22
22
|
md: {};
|
|
23
23
|
lg: {};
|
|
24
24
|
xl: {};
|
|
25
|
-
}, CSSModifierObject<CSSSlotObject<"root" | "hueSlider" | "saturationSlider" | "eyeDropper" | "
|
|
25
|
+
}, CSSModifierObject<CSSSlotObject<"root" | "hueSlider" | "saturationSlider" | "eyeDropper" | "colorSwatchGroupLabel" | "alphaSlider" | "colorSwatchGroup" | "colorSwatchItem">>>;
|
|
26
26
|
type ColorSelectorStyle = typeof colorSelectorStyle;
|
|
27
27
|
//#endregion
|
|
28
28
|
export { ColorSelectorStyle, colorSelectorStyle };
|
|
@@ -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" | "root" | "
|
|
3
|
+
declare const dataListStyle: ComponentSlotStyle<"term" | "root" | "description" | "item", {
|
|
4
4
|
/**
|
|
5
5
|
* The orientation of the data list.
|
|
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/drawer/drawer.style.d.ts
|
|
4
|
-
declare const drawerStyle: ComponentSlotStyle<"body" | "footer" | "header" | "title" | "content" | "overlay" | "
|
|
4
|
+
declare const drawerStyle: ComponentSlotStyle<"body" | "footer" | "header" | "title" | "content" | "overlay" | "root" | "closeButton" | "dragBar", {
|
|
5
5
|
/**
|
|
6
6
|
* The placement of the drawer.
|
|
7
7
|
*
|
|
@@ -117,7 +117,7 @@ declare const drawerStyle: ComponentSlotStyle<"body" | "footer" | "header" | "ti
|
|
|
117
117
|
rounded: "0";
|
|
118
118
|
};
|
|
119
119
|
};
|
|
120
|
-
}, CSSModifierObject<CSSSlotObject<"body" | "footer" | "header" | "title" | "content" | "overlay" | "
|
|
120
|
+
}, CSSModifierObject<CSSSlotObject<"body" | "footer" | "header" | "title" | "content" | "overlay" | "root" | "closeButton" | "dragBar">>>;
|
|
121
121
|
type DrawerStyle = typeof drawerStyle;
|
|
122
122
|
//#endregion
|
|
123
123
|
export { DrawerStyle, drawerStyle };
|
|
@@ -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/empty-state/empty-state.style.d.ts
|
|
4
|
-
declare const emptyState: ComponentSlotStyle<"title" | "content" | "root" | "
|
|
4
|
+
declare const emptyState: ComponentSlotStyle<"title" | "content" | "root" | "description" | "indicator", CSSPropObject<CSSSlotObject<"title" | "content" | "root" | "description" | "indicator">>, {
|
|
5
5
|
sm: {
|
|
6
6
|
content: {
|
|
7
7
|
gap: "xs";
|
|
@@ -47,7 +47,7 @@ declare const emptyState: ComponentSlotStyle<"title" | "content" | "root" | "ind
|
|
|
47
47
|
fontSize: "xl";
|
|
48
48
|
};
|
|
49
49
|
};
|
|
50
|
-
}, CSSModifierObject<CSSSlotObject<"title" | "content" | "root" | "
|
|
50
|
+
}, CSSModifierObject<CSSSlotObject<"title" | "content" | "root" | "description" | "indicator">>>;
|
|
51
51
|
type EmptyState = typeof emptyState;
|
|
52
52
|
//#endregion
|
|
53
53
|
export { EmptyState, emptyState };
|
|
@@ -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/modal/modal.style.d.ts
|
|
4
|
-
declare const modalStyle: ComponentSlotStyle<"body" | "footer" | "header" | "title" | "content" | "overlay" | "
|
|
4
|
+
declare const modalStyle: ComponentSlotStyle<"body" | "footer" | "header" | "title" | "content" | "overlay" | "root" | "closeButton", {
|
|
5
5
|
/**
|
|
6
6
|
* The placement of the modal.
|
|
7
7
|
*
|
|
@@ -155,7 +155,7 @@ declare const modalStyle: ComponentSlotStyle<"body" | "footer" | "header" | "tit
|
|
|
155
155
|
p: "0";
|
|
156
156
|
};
|
|
157
157
|
};
|
|
158
|
-
}, CSSModifierObject<CSSSlotObject<"body" | "footer" | "header" | "title" | "content" | "overlay" | "
|
|
158
|
+
}, CSSModifierObject<CSSSlotObject<"body" | "footer" | "header" | "title" | "content" | "overlay" | "root" | "closeButton">>>;
|
|
159
159
|
type ModalStyle = typeof modalStyle;
|
|
160
160
|
//#endregion
|
|
161
161
|
export { ModalStyle, modalStyle };
|
|
@@ -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" | "
|
|
4
|
+
declare const noticeStyle: ComponentSlotStyle<"content" | "root" | "item" | "closeButton", CSSPropObject<CSSSlotObject<"content" | "root" | "item" | "closeButton">>, CSSModifierObject<CSSSlotObject<"content" | "root" | "item" | "closeButton">>, CSSModifierObject<CSSSlotObject<"content" | "root" | "item" | "closeButton">>>;
|
|
5
5
|
type NoticeStyle = typeof noticeStyle;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { NoticeStyle };
|
|
@@ -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" | As = "div", R extends _$_yamada_ui_utils0.Dict = _$_yamada_ui_utils0.Dict<any>>(el: H | _$react.FC<R>, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"group" | "root" | "
|
|
58
|
+
declare const component: <H extends "fragment" | As = "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: {
|
|
@@ -232,7 +232,7 @@ declare const component: <H extends "fragment" | As = "div", R extends _$_yamada
|
|
|
232
232
|
name,
|
|
233
233
|
className,
|
|
234
234
|
...options
|
|
235
|
-
}?: ComponentOptions) => (initialProps?: InitialProps<R>, ...superProps: SuperProps<R>[]) => H extends "fragment" ? _$react.FunctionComponent<R> : Component<Exclude<H, "fragment">, R>, RadioCardPropsContext: _$react.Context<Partial<RadioCardRootProps<string>> | undefined>, useRadioCardPropsContext: () => Partial<RadioCardRootProps<string>> | undefined, useRootComponentProps: <Y extends _$_yamada_ui_utils0.Dict = {}, R extends keyof Y = keyof Y>(props: Y, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"group" | "root" | "
|
|
235
|
+
}?: ComponentOptions) => (initialProps?: InitialProps<R>, ...superProps: SuperProps<R>[]) => H extends "fragment" ? _$react.FunctionComponent<R> : Component<Exclude<H, "fragment">, R>, RadioCardPropsContext: _$react.Context<Partial<RadioCardRootProps<string>> | undefined>, useRadioCardPropsContext: () => Partial<RadioCardRootProps<string>> | undefined, useRootComponentProps: <Y extends _$_yamada_ui_utils0.Dict = {}, R extends keyof Y = keyof Y>(props: Y, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"group" | "root" | "description" | "indicator" | "addon", {
|
|
236
236
|
justify: {
|
|
237
237
|
end: {
|
|
238
238
|
addon: {
|
|
@@ -409,7 +409,7 @@ declare const component: <H extends "fragment" | As = "div", R extends _$_yamada
|
|
|
409
409
|
className,
|
|
410
410
|
withContext,
|
|
411
411
|
transferProps
|
|
412
|
-
}?: UseComponentPropsOptions<R>) => [CSSSlotObject, Merge<WithoutThemeProps<Y, ComponentSlotStyle<"group" | "root" | "
|
|
412
|
+
}?: UseComponentPropsOptions<R>) => [CSSSlotObject, Merge<WithoutThemeProps<Y, ComponentSlotStyle<"group" | "root" | "description" | "indicator" | "addon", {
|
|
413
413
|
justify: {
|
|
414
414
|
end: {
|
|
415
415
|
addon: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.types.js";
|
|
2
2
|
//#region src/components/radio-card/radio-card.style.d.ts
|
|
3
|
-
declare const radioCardStyle: ComponentSlotStyle<"group" | "root" | "
|
|
3
|
+
declare const radioCardStyle: ComponentSlotStyle<"group" | "root" | "description" | "indicator" | "addon", {
|
|
4
4
|
/**
|
|
5
5
|
* The justify indicator of the component
|
|
6
6
|
*
|
|
@@ -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<"root" | "
|
|
3
|
+
declare const reorderStyle: ComponentSlotStyle<"root" | "item" | "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" | "root" | "
|
|
4
|
+
declare const resizableStyle: ComponentSlotStyle<"icon" | "root" | "item" | "trigger", {
|
|
5
5
|
/**
|
|
6
6
|
* The orientation of the resizable.
|
|
7
7
|
*
|
|
@@ -19,7 +19,7 @@ declare const resizableStyle: ComponentSlotStyle<"icon" | "root" | "trigger" | "
|
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
|
-
}, CSSModifierObject<CSSSlotObject<"icon" | "root" | "
|
|
22
|
+
}, CSSModifierObject<CSSSlotObject<"icon" | "root" | "item" | "trigger">>, {
|
|
23
23
|
border: {
|
|
24
24
|
icon: {
|
|
25
25
|
bg: "colorScheme.muted";
|
|
@@ -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" | "root" | "
|
|
3
|
+
declare const stepsStyle: ComponentSlotStyle<"title" | "list" | "separator" | "root" | "description" | "indicator" | "item", {
|
|
4
4
|
/**
|
|
5
5
|
* The orientation of the steps.
|
|
6
6
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.types.js";
|
|
2
2
|
//#region src/components/tag/tag.style.d.ts
|
|
3
|
-
declare const tagStyle: ComponentSlotStyle<"content" | "icon" | "
|
|
3
|
+
declare const tagStyle: ComponentSlotStyle<"content" | "icon" | "root" | "endIcon" | "startIcon" | "closeButton", {
|
|
4
4
|
/**
|
|
5
5
|
* If `true`, the tag is full rounded. Else, it'll be slightly round.
|
|
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" | "root" | "
|
|
72
|
+
}: WithoutThemeProps<TimelineRootProps, ComponentSlotStyle<"title" | "content" | "root" | "description" | "connector" | "indicator" | "item", {
|
|
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" | "root" | "
|
|
3
|
+
declare const timelineStyle: ComponentSlotStyle<"title" | "content" | "root" | "description" | "connector" | "indicator" | "item", {
|
|
4
4
|
/**
|
|
5
5
|
* The alignment of the timeline.
|
|
6
6
|
*
|
|
@@ -134,7 +134,7 @@ declare const I18nContext: _$react.Context<I18nContext<{
|
|
|
134
134
|
readonly toggle: {
|
|
135
135
|
readonly "Toggle button": "Toggle button";
|
|
136
136
|
};
|
|
137
|
-
}, "progress.Loading..." | "progress.{value} percent" | "select.Clear value" | "table.Clear sorting" | "table.Page size" | "table.Select all rows" | "table.Select row" | "table.Sort ascending" | "table.Sort descending" | "toggle.Toggle button" | "slider.Slider thumb" | "modal.Close modal" | "modal.Open modal" | "closeButton.Close" | "actionBar.Close action bar" | "actionBar.Open action bar" | "autocomplete.Clear value" | "autocomplete.No results found" | "avatar.Avatar Icon" | "breadcrumb.Breadcrumb" | "breadcrumb.Ellipsis" | "calendar.Choose the month" | "calendar.Choose the year" | "calendar.Go to the next month" | "calendar.Go to the previous month" | "calendar.Today" | "carousel.Go to next slide" | "carousel.Go to previous slide" | "carousel.Go to {page} slide" | "carousel.Slides" | "carousel.{page} of {total}" | "colorPicker.Pick a color" | "colorSelector.Pick a color" | "colorSwatch.Color swatch group" | "datePicker.Clear value" | "hueSlider.Blue" | "hueSlider.Cyan" | "hueSlider.Green" | "hueSlider.Magenta" | "hueSlider.Red" | "hueSlider.Yellow" | "numberInput.Decrease" | "numberInput.Increase" | "pagination.Go to first page" | "pagination.Go to last page" | "pagination.Go to next page" | "pagination.Go to page {value}" | "pagination.Go to previous page" | "pagination.Pagination" | "pagination.{value} / {total}" | "pagination.{value} of {total}" | "passwordInput.Password strength meter" | "passwordInput.Toggle password visibility" | "saturationSlider.Saturation and brightness thumb" | "saturationSlider.Saturation {saturation}%, Brightness {brightness}%"
|
|
137
|
+
}, "progress.Loading..." | "progress.{value} percent" | "select.Clear value" | "table.Clear sorting" | "table.Page size" | "table.Select all rows" | "table.Select row" | "table.Sort ascending" | "table.Sort descending" | "toggle.Toggle button" | "slider.Slider thumb" | "modal.Close modal" | "modal.Open modal" | "closeButton.Close" | "tag.Close tag" | "stat.Decreased by" | "stat.Increased by" | "sidebar.Close sidebar" | "sidebar.Open sidebar" | "actionBar.Close action bar" | "actionBar.Open action bar" | "autocomplete.Clear value" | "autocomplete.No results found" | "avatar.Avatar Icon" | "breadcrumb.Breadcrumb" | "breadcrumb.Ellipsis" | "calendar.Choose the month" | "calendar.Choose the year" | "calendar.Go to the next month" | "calendar.Go to the previous month" | "calendar.Today" | "carousel.Go to next slide" | "carousel.Go to previous slide" | "carousel.Go to {page} slide" | "carousel.Slides" | "carousel.{page} of {total}" | "colorPicker.Pick a color" | "colorSelector.Pick a color" | "colorSwatch.Color swatch group" | "datePicker.Clear value" | "hueSlider.Blue" | "hueSlider.Cyan" | "hueSlider.Green" | "hueSlider.Magenta" | "hueSlider.Red" | "hueSlider.Yellow" | "numberInput.Decrease" | "numberInput.Increase" | "pagination.Go to first page" | "pagination.Go to last page" | "pagination.Go to next page" | "pagination.Go to page {value}" | "pagination.Go to previous page" | "pagination.Pagination" | "pagination.{value} / {total}" | "pagination.{value} of {total}" | "passwordInput.Password strength meter" | "passwordInput.Toggle password visibility" | "saturationSlider.Saturation and brightness thumb" | "saturationSlider.Saturation {saturation}%, Brightness {brightness}%">>;
|
|
138
138
|
interface I18nProviderProps {
|
|
139
139
|
children?: ReactNode;
|
|
140
140
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yamada-ui/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.3.0-next-
|
|
4
|
+
"version": "2.3.0-next-20260516215715",
|
|
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",
|