@yamada-ui/react 2.3.4-dev-20261116075346 → 2.3.4-dev-20261116083348

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/cjs/components/checkbox/use-checkbox-group.cjs +6 -15
  2. package/dist/cjs/components/checkbox/use-checkbox-group.cjs.map +1 -1
  3. package/dist/cjs/components/checkbox/use-checkbox.cjs +7 -16
  4. package/dist/cjs/components/checkbox/use-checkbox.cjs.map +1 -1
  5. package/dist/cjs/components/color-picker/use-color-picker.cjs +4 -4
  6. package/dist/cjs/components/color-picker/use-color-picker.cjs.map +1 -1
  7. package/dist/esm/components/checkbox/use-checkbox-group.js +6 -15
  8. package/dist/esm/components/checkbox/use-checkbox-group.js.map +1 -1
  9. package/dist/esm/components/checkbox/use-checkbox.js +7 -16
  10. package/dist/esm/components/checkbox/use-checkbox.js.map +1 -1
  11. package/dist/esm/components/color-picker/use-color-picker.js +4 -4
  12. package/dist/esm/components/color-picker/use-color-picker.js.map +1 -1
  13. package/dist/types/components/accordion/accordion.style.d.ts +1 -1
  14. package/dist/types/components/autocomplete/autocomplete.style.d.ts +1 -1
  15. package/dist/types/components/breadcrumb/breadcrumb.style.d.ts +1 -1
  16. package/dist/types/components/bubble/bubble.style.d.ts +1 -1
  17. package/dist/types/components/calendar/calendar.style.d.ts +2 -2
  18. package/dist/types/components/carousel/carousel.style.d.ts +2 -2
  19. package/dist/types/components/color-picker/color-picker.style.d.ts +1 -1
  20. package/dist/types/components/color-selector/color-selector.style.d.ts +2 -2
  21. package/dist/types/components/data-list/data-list.style.d.ts +1 -1
  22. package/dist/types/components/drawer/drawer.style.d.ts +2 -2
  23. package/dist/types/components/field/field.style.d.ts +2 -2
  24. package/dist/types/components/fieldset/fieldset.style.d.ts +1 -1
  25. package/dist/types/components/file-input/file-input.style.d.ts +1 -1
  26. package/dist/types/components/flip/flip.d.ts +1 -1
  27. package/dist/types/components/flip/flip.style.d.ts +1 -1
  28. package/dist/types/components/list/list.style.d.ts +2 -2
  29. package/dist/types/components/marquee/marquee.style.d.ts +1 -1
  30. package/dist/types/components/modal/modal.style.d.ts +2 -2
  31. package/dist/types/components/native-accordion/native-accordion.style.d.ts +2 -2
  32. package/dist/types/components/notice/notice.style.d.ts +1 -1
  33. package/dist/types/components/pagination/pagination.style.d.ts +1 -1
  34. package/dist/types/components/rating/rating.style.d.ts +2 -2
  35. package/dist/types/components/reorder/reorder.style.d.ts +1 -1
  36. package/dist/types/components/resizable/resizable.style.d.ts +2 -2
  37. package/dist/types/components/segmented-control/segmented-control.style.d.ts +2 -2
  38. package/dist/types/components/select/select.style.d.ts +1 -1
  39. package/dist/types/components/stat/stat.style.d.ts +2 -2
  40. package/dist/types/components/steps/steps.style.d.ts +1 -1
  41. package/dist/types/components/tag/tag.style.d.ts +1 -1
  42. package/dist/types/components/timeline/timeline.d.ts +1 -1
  43. package/dist/types/components/timeline/timeline.style.d.ts +1 -1
  44. package/dist/types/components/tree/tree.style.d.ts +1 -1
  45. package/dist/types/providers/i18n-provider/i18n-provider.d.ts +1 -1
  46. package/package.json +1 -1
@@ -45,12 +45,10 @@ const useCheckboxGroup = (props = {}) => {
45
45
  return {
46
46
  max,
47
47
  value,
48
- getInputProps: (0, react.useCallback)((props = {}) => {
48
+ getInputProps: (0, react.useCallback)(({ disabled, ...props } = {}) => {
49
49
  const checked = !(0, require_utils_index.utils_exports.isUndefined)(value) && ((0, require_utils_index.utils_exports.isString)(props.value) || (0, require_utils_index.utils_exports.isNumber)(props.value)) && value.includes(props.value);
50
50
  const trulyDisabled = !checked && (0, require_utils_index.utils_exports.isNumber)(max) && value.length >= max;
51
- return {
52
- ...dataProps,
53
- ...ariaProps,
51
+ return require_props.mergeProps(dataProps, ariaProps, {
54
52
  type: "checkbox",
55
53
  style: require_dom.visuallyHiddenAttributes.style,
56
54
  "aria-checked": checked,
@@ -58,14 +56,10 @@ const useCheckboxGroup = (props = {}) => {
58
56
  "data-checked": (0, require_utils_index.utils_exports.dataAttr)(checked),
59
57
  "data-disabled": (0, require_utils_index.utils_exports.dataAttr)(trulyDisabled),
60
58
  checked,
59
+ disabled: Boolean(disabled || trulyDisabled),
61
60
  readOnly,
62
- required,
63
- ...props,
64
- disabled: Boolean(props.disabled || trulyDisabled),
65
- onBlur: (0, require_utils_index.utils_exports.handlerAll)(props.onBlur, eventProps.onBlur),
66
- onChange: (0, require_utils_index.utils_exports.handlerAll)(props.onChange, onChange),
67
- onFocus: (0, require_utils_index.utils_exports.handlerAll)(props.onFocus, eventProps.onFocus)
68
- };
61
+ required
62
+ }, props, eventProps, { onChange })();
69
63
  }, [
70
64
  ariaProps,
71
65
  dataProps,
@@ -76,10 +70,7 @@ const useCheckboxGroup = (props = {}) => {
76
70
  required,
77
71
  value
78
72
  ]),
79
- getLabelProps: (0, react.useCallback)((props) => ({
80
- ...dataProps,
81
- ...props
82
- }), [dataProps]),
73
+ getLabelProps: (0, react.useCallback)((props = {}) => require_props.mergeProps(dataProps, props)(), [dataProps]),
83
74
  getRootProps,
84
75
  onChange
85
76
  };
@@ -1 +1 @@
1
- {"version":3,"file":"use-checkbox-group.cjs","names":["createContext","useFieldProps","useControllableState","useCallback","mergeProps","visuallyHiddenAttributes"],"sources":["../../../../src/components/checkbox/use-checkbox-group.ts"],"sourcesContent":["\"use client\"\n\nimport type { ChangeEvent } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { FieldProps } from \"../field\"\nimport { useCallback } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport {\n ariaAttr,\n createContext,\n dataAttr,\n handlerAll,\n isNumber,\n isObject,\n isString,\n isUndefined,\n visuallyHiddenAttributes,\n} from \"../../utils\"\nimport { useFieldProps } from \"../field\"\n\ninterface CheckboxGroupContext extends Omit<\n UseCheckboxGroupReturn,\n \"getRootProps\"\n> {}\n\nconst [CheckboxGroupContext, useCheckboxGroupContext] =\n createContext<CheckboxGroupContext>({\n name: \"CheckboxGroupContext\",\n strict: false,\n })\n\nexport { CheckboxGroupContext, useCheckboxGroupContext }\n\nexport interface UseCheckboxGroupProps<Y extends string = string>\n extends Omit<HTMLProps, \"defaultValue\" | \"onChange\" | \"value\">, FieldProps {\n /**\n * The initial value of the checkbox group.\n *\n * @default []\n */\n defaultValue?: Y[]\n /**\n * The maximum number of checkboxes that can be checked.\n */\n max?: number\n /**\n * The value of the checkbox group.\n */\n value?: Y[]\n /**\n * The callback fired when any children checkbox is checked or unchecked.\n */\n onChange?: (value: Y[]) => void\n}\n\nexport const useCheckboxGroup = <Y extends string = string>(\n props: UseCheckboxGroupProps<Y> = {},\n) => {\n const {\n context: { labelId } = {},\n props: {\n defaultValue = [],\n disabled,\n max,\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)) valueOrEv = valueOrEv.target.value as Y\n\n setValue((prev) => {\n if (prev.includes(valueOrEv))\n return prev.filter((prevValue) => prevValue !== valueOrEv)\n else if (!isNumber(max) || prev.length < max)\n return [...prev, valueOrEv]\n else return prev\n })\n },\n [interactive, max, setValue],\n )\n\n const getRootProps: PropGetter = useCallback(\n (props = {}) =>\n mergeProps(\n dataProps,\n {\n \"aria-describedby\": ariaDescribedby,\n \"aria-labelledby\": labelId,\n role: \"group\",\n },\n rest,\n props,\n )(),\n [ariaDescribedby, dataProps, labelId, rest],\n )\n\n const getInputProps: PropGetter<\"input\"> = useCallback(\n (props = {}) => {\n const checked =\n !isUndefined(value) &&\n (isString(props.value) || isNumber(props.value)) &&\n value.includes(props.value as Y)\n const trulyDisabled = !checked && isNumber(max) && value.length >= max\n\n return {\n ...dataProps,\n ...ariaProps,\n type: \"checkbox\",\n style: visuallyHiddenAttributes.style,\n \"aria-checked\": checked,\n \"aria-disabled\": ariaAttr(trulyDisabled),\n \"data-checked\": dataAttr(checked),\n \"data-disabled\": dataAttr(trulyDisabled),\n checked,\n readOnly,\n required,\n ...props,\n disabled: Boolean(props.disabled || trulyDisabled),\n onBlur: handlerAll(props.onBlur, eventProps.onBlur),\n onChange: handlerAll(props.onChange, onChange),\n onFocus: handlerAll(props.onFocus, eventProps.onFocus),\n }\n },\n [\n ariaProps,\n dataProps,\n eventProps,\n max,\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 max,\n value,\n getInputProps,\n getLabelProps,\n getRootProps,\n onChange,\n }\n}\n\nexport type UseCheckboxGroupReturn = ReturnType<typeof useCheckboxGroup>\n"],"mappings":";;;;;;;;;AA0BA,MAAM,CAAC,sBAAsB,2BAC3BA,gBAAAA,cAAoC;CAClC,MAAM;CACN,QAAQ;AACV,CAAC;AA0BH,MAAa,oBACX,QAAkC,CAAC,MAChC;CACH,MAAM,EACJ,SAAS,EAAE,YAAY,CAAC,GACxB,OAAO,EACL,eAAe,CAAC,GAChB,UACA,KACA,UACA,UACA,OAAO,WACP,UAAU,cACV,GAAG,QAEL,WAAW,EAAE,oBAAoB,iBAAiB,GAAG,aACrD,WACA,eACEC,wBAAAA,cAAc,KAAK;CACvB,MAAM,cAAc,EAAE,YAAY;CAClC,MAAM,CAAC,OAAO,YAAYC,2CAAAA,qBAAqB;EAC7C;EACA,OAAO;EACP,UAAU;CACZ,CAAC;CAED,MAAM,YAAA,GAAWC,MAAAA,YAAAA,EACd,cAAiD;EAChD,IAAI,CAAC,aAAa;EAElB,KAAA,GAAA,oBAAA,cAAI,SAAA,CAAS,SAAS,GAAG,YAAY,UAAU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BAAA,cAAU,WAAA,CAAW,MAAM,UAAU,QAAQ;IAC7C,UAAA,GAAA,oBAAA,cAAS,WAAA,CAAW,MAAM,SAAS,WAAW,OAAO;GACvD;EACF,GACA;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,CAcY;EACZ,gBAAA,GAZyCF,MAAAA,YAAAA,EACxC,WAAW;GACV,GAAG;GACH,GAAG;EACL,IACA,CAAC,SAAS,CAOE;EACZ;EACA;CACF;AACF"}
1
+ {"version":3,"file":"use-checkbox-group.cjs","names":["createContext","useFieldProps","useControllableState","useCallback","mergeProps","visuallyHiddenAttributes"],"sources":["../../../../src/components/checkbox/use-checkbox-group.ts"],"sourcesContent":["\"use client\"\n\nimport type { ChangeEvent } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { FieldProps } from \"../field\"\nimport { useCallback } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport {\n ariaAttr,\n createContext,\n dataAttr,\n isNumber,\n isObject,\n isString,\n isUndefined,\n visuallyHiddenAttributes,\n} from \"../../utils\"\nimport { useFieldProps } from \"../field\"\n\ninterface CheckboxGroupContext extends Omit<\n UseCheckboxGroupReturn,\n \"getRootProps\"\n> {}\n\nconst [CheckboxGroupContext, useCheckboxGroupContext] =\n createContext<CheckboxGroupContext>({\n name: \"CheckboxGroupContext\",\n strict: false,\n })\n\nexport { CheckboxGroupContext, useCheckboxGroupContext }\n\nexport interface UseCheckboxGroupProps<Y extends string = string>\n extends Omit<HTMLProps, \"defaultValue\" | \"onChange\" | \"value\">, FieldProps {\n /**\n * The initial value of the checkbox group.\n *\n * @default []\n */\n defaultValue?: Y[]\n /**\n * The maximum number of checkboxes that can be checked.\n */\n max?: number\n /**\n * The value of the checkbox group.\n */\n value?: Y[]\n /**\n * The callback fired when any children checkbox is checked or unchecked.\n */\n onChange?: (value: Y[]) => void\n}\n\nexport const useCheckboxGroup = <Y extends string = string>(\n props: UseCheckboxGroupProps<Y> = {},\n) => {\n const {\n context: { labelId } = {},\n props: {\n defaultValue = [],\n disabled,\n max,\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)) valueOrEv = valueOrEv.target.value as Y\n\n setValue((prev) => {\n if (prev.includes(valueOrEv))\n return prev.filter((prevValue) => prevValue !== valueOrEv)\n else if (!isNumber(max) || prev.length < max)\n return [...prev, valueOrEv]\n else return prev\n })\n },\n [interactive, max, setValue],\n )\n\n const getRootProps: PropGetter = useCallback(\n (props = {}) =>\n mergeProps(\n dataProps,\n {\n \"aria-describedby\": ariaDescribedby,\n \"aria-labelledby\": labelId,\n role: \"group\",\n },\n rest,\n props,\n )(),\n [ariaDescribedby, dataProps, labelId, rest],\n )\n\n const getInputProps: PropGetter<\"input\"> = useCallback(\n ({ disabled, ...props } = {}) => {\n const checked =\n !isUndefined(value) &&\n (isString(props.value) || isNumber(props.value)) &&\n value.includes(props.value as Y)\n const trulyDisabled = !checked && isNumber(max) && value.length >= max\n\n return mergeProps(\n dataProps,\n ariaProps,\n {\n type: \"checkbox\",\n style: visuallyHiddenAttributes.style,\n \"aria-checked\": checked,\n \"aria-disabled\": ariaAttr(trulyDisabled),\n \"data-checked\": dataAttr(checked),\n \"data-disabled\": dataAttr(trulyDisabled),\n checked,\n disabled: Boolean(disabled || trulyDisabled),\n readOnly,\n required,\n },\n props,\n eventProps,\n { onChange },\n )()\n },\n [\n ariaProps,\n dataProps,\n eventProps,\n max,\n onChange,\n readOnly,\n required,\n value,\n ],\n )\n\n const getLabelProps: PropGetter<\"label\"> = useCallback(\n (props = {}) => mergeProps(dataProps, props)(),\n [dataProps],\n )\n\n return {\n max,\n value,\n getInputProps,\n getLabelProps,\n getRootProps,\n onChange,\n }\n}\n\nexport type UseCheckboxGroupReturn = ReturnType<typeof useCheckboxGroup>\n"],"mappings":";;;;;;;;;AAyBA,MAAM,CAAC,sBAAsB,2BAC3BA,gBAAAA,cAAoC;CAClC,MAAM;CACN,QAAQ;AACV,CAAC;AA0BH,MAAa,oBACX,QAAkC,CAAC,MAChC;CACH,MAAM,EACJ,SAAS,EAAE,YAAY,CAAC,GACxB,OAAO,EACL,eAAe,CAAC,GAChB,UACA,KACA,UACA,UACA,OAAO,WACP,UAAU,cACV,GAAG,QAEL,WAAW,EAAE,oBAAoB,iBAAiB,GAAG,aACrD,WACA,eACEC,wBAAAA,cAAc,KAAK;CACvB,MAAM,cAAc,EAAE,YAAY;CAClC,MAAM,CAAC,OAAO,YAAYC,2CAAAA,qBAAqB;EAC7C;EACA,OAAO;EACP,UAAU;CACZ,CAAC;CAED,MAAM,YAAA,GAAWC,MAAAA,YAAAA,EACd,cAAiD;EAChD,IAAI,CAAC,aAAa;EAElB,KAAA,GAAA,oBAAA,cAAI,SAAA,CAAS,SAAS,GAAG,YAAY,UAAU,OAAO;EAEtD,UAAU,SAAS;GACjB,IAAI,KAAK,SAAS,SAAS,GACzB,OAAO,KAAK,QAAQ,cAAc,cAAc,SAAS;QACtD,IAAI,EAAA,GAAA,oBAAA,cAAC,SAAA,CAAS,GAAG,KAAK,KAAK,SAAS,KACvC,OAAO,CAAC,GAAG,MAAM,SAAS;QACvB,OAAO;EACd,CAAC;CACH,GACA;EAAC;EAAa;EAAK;CAAQ,CAC7B;CAEA,MAAM,gBAAA,GAA2BA,MAAAA,YAAAA,EAC9B,QAAQ,CAAC,MACRC,cAAAA,WACE,WACA;EACE,oBAAoB;EACpB,mBAAmB;EACnB,MAAM;CACR,GACA,MACA,KACF,CAAC,CAAC,GACJ;EAAC;EAAiB;EAAW;EAAS;CAAI,CAC5C;CA+CA,OAAO;EACL;EACA;EACA,gBAAA,GAhDyCD,MAAAA,YAAAA,EACxC,EAAE,UAAU,GAAG,UAAU,CAAC,MAAM;GAC/B,MAAM,UACJ,EAAA,GAAA,oBAAA,cAAC,YAAA,CAAY,KAAK,OAAA,GAAA,oBAAA,cACjB,SAAA,CAAS,MAAM,KAAK,MAAA,GAAA,oBAAA,cAAK,SAAA,CAAS,MAAM,KAAK,MAC9C,MAAM,SAAS,MAAM,KAAU;GACjC,MAAM,gBAAgB,CAAC,YAAA,GAAA,oBAAA,cAAW,SAAA,CAAS,GAAG,KAAK,MAAM,UAAU;GAEnE,OAAOC,cAAAA,WACL,WACA,WACA;IACE,MAAM;IACN,OAAOC,YAAAA,yBAAyB;IAChC,gBAAgB;IAChB,kBAAA,GAAA,oBAAA,cAAiB,SAAA,CAAS,aAAa;IACvC,iBAAA,GAAA,oBAAA,cAAgB,SAAA,CAAS,OAAO;IAChC,kBAAA,GAAA,oBAAA,cAAiB,SAAA,CAAS,aAAa;IACvC;IACA,UAAU,QAAQ,YAAY,aAAa;IAC3C;IACA;GACF,GACA,OACA,YACA,EAAE,SAAS,CACb,CAAC,CAAC;EACJ,GACA;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,CAWY;EACZ,gBAAA,GATyCF,MAAAA,YAAAA,EACxC,QAAQ,CAAC,MAAMC,cAAAA,WAAW,WAAW,KAAK,CAAC,CAAC,GAC7C,CAAC,SAAS,CAOE;EACZ;EACA;CACF;AACF"}
@@ -1,6 +1,5 @@
1
1
  "use client";
2
2
  const require_dom = require("../../utils/dom.cjs");
3
- const require_ref = require("../../utils/ref.cjs");
4
3
  const require_props = require("../../core/components/props.cjs");
5
4
  const require_hooks_use_controllable_state_index = require("../../hooks/use-controllable-state/index.cjs");
6
5
  const require_utils_index = require("../../utils/index.cjs");
@@ -39,8 +38,7 @@ const useCheckbox = ({ "aria-describedby": ariaDescribedbyProp, ...props } = {})
39
38
  setChecked
40
39
  ]);
41
40
  const getRootProps = (0, react.useCallback)((props = {}) => {
42
- const merged = require_props.mergeProps({
43
- ...dataProps,
41
+ const merged = require_props.mergeProps(dataProps, {
44
42
  "data-checked": (0, require_utils_index.utils_exports.dataAttr)(checked),
45
43
  "data-indeterminate": (0, require_utils_index.utils_exports.dataAttr)(indeterminate)
46
44
  }, rest, props)();
@@ -53,11 +51,9 @@ const useCheckbox = ({ "aria-describedby": ariaDescribedbyProp, ...props } = {})
53
51
  getLabelProps
54
52
  ]);
55
53
  const getInputProps = (0, react.useCallback)((props = {}) => {
56
- const sharedProps = require_props.mergeProps({
57
- ...dataProps,
58
- ...ariaProps,
54
+ const sharedProps = require_props.mergeProps({ ref }, dataProps, ariaProps, {
59
55
  id,
60
- ref: require_ref.mergeRefs(ref, indeterminateRef),
56
+ ref: indeterminateRef,
61
57
  type: "checkbox",
62
58
  name,
63
59
  style: require_dom.visuallyHiddenAttributes.style,
@@ -74,10 +70,7 @@ const useCheckbox = ({ "aria-describedby": ariaDescribedbyProp, ...props } = {})
74
70
  required,
75
71
  tabIndex,
76
72
  value
77
- }, props, {
78
- ...eventProps,
79
- onChange
80
- })();
73
+ }, props, eventProps, { onChange })();
81
74
  return getGroupInputProps?.(sharedProps) ?? sharedProps;
82
75
  }, [
83
76
  dataProps,
@@ -104,13 +97,11 @@ const useCheckbox = ({ "aria-describedby": ariaDescribedbyProp, ...props } = {})
104
97
  return {
105
98
  checked,
106
99
  indeterminate,
107
- getIndicatorProps: (0, react.useCallback)((props = {}) => ({
108
- ...dataProps,
100
+ getIndicatorProps: (0, react.useCallback)((props = {}) => require_props.mergeProps(dataProps, {
109
101
  "aria-hidden": "true",
110
102
  "data-checked": (0, require_utils_index.utils_exports.dataAttr)(checked),
111
- "data-indeterminate": (0, require_utils_index.utils_exports.dataAttr)(indeterminate),
112
- ...props
113
- }), [
103
+ "data-indeterminate": (0, require_utils_index.utils_exports.dataAttr)(indeterminate)
104
+ }, props)(), [
114
105
  dataProps,
115
106
  checked,
116
107
  indeterminate
@@ -1 +1 @@
1
- {"version":3,"file":"use-checkbox.cjs","names":["useCheckboxGroupContext","useId","useFieldProps","useControllableEventState","useCallback","mergeProps","mergeRefs","visuallyHiddenAttributes"],"sources":["../../../../src/components/checkbox/use-checkbox.ts"],"sourcesContent":["\"use client\"\n\nimport type { ChangeEvent, ChangeEventHandler, FocusEventHandler } from \"react\"\nimport type { HTMLProps, HTMLRefAttributes, PropGetter } from \"../../core\"\nimport type { FieldProps } from \"../field\"\nimport { useCallback, useId } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useControllableEventState } from \"../../hooks/use-controllable-state\"\nimport {\n ariaAttr,\n dataAttr,\n isNumber,\n isUndefined,\n mergeRefs,\n visuallyHiddenAttributes,\n} from \"../../utils\"\nimport { useFieldProps } from \"../field\"\nimport { useCheckboxGroupContext } from \"./use-checkbox-group\"\n\nexport interface UseCheckboxProps<Y extends string = string>\n extends\n Omit<HTMLProps<\"label\">, \"onBlur\" | \"onChange\" | \"onFocus\" | \"ref\">,\n HTMLRefAttributes<\"input\">,\n FieldProps {\n /**\n * If `true`, the checkbox will be checked.\n */\n checked?: boolean\n /**\n * If `true`, the checkbox will be initially checked.\n *\n * @default false\n */\n defaultChecked?: boolean\n /**\n * id assigned to input.\n */\n id?: string\n /**\n * If `true`, the checkbox will be indeterminate.\n *\n * @default false\n */\n indeterminate?: boolean\n /**\n * The name of the input field in a checkbox.\n */\n name?: string\n /**\n * The value of the checkbox.\n */\n value?: Y\n /**\n * The callback invoked when the checkbox is blurred.\n */\n onBlur?: FocusEventHandler<HTMLInputElement>\n /**\n * The callback invoked when the checked state changes.\n */\n onChange?: ChangeEventHandler<HTMLInputElement>\n /**\n * The callback invoked when the checkbox is focused.\n */\n onFocus?: FocusEventHandler<HTMLInputElement>\n}\n\nexport const useCheckbox = <Y extends string = string>({\n \"aria-describedby\": ariaDescribedbyProp,\n ...props\n}: UseCheckboxProps<Y> = {}) => {\n const group = useCheckboxGroupContext()\n const {\n max,\n value: groupValue,\n getInputProps: getGroupInputProps,\n getLabelProps,\n } = group ?? {}\n const uuid = useId()\n const {\n props: {\n id,\n ref,\n name,\n \"aria-controls\": ariaControls,\n \"aria-labelledby\": ariaLabelledby,\n checked: checkedProp,\n defaultChecked = false,\n disabled,\n indeterminate = false,\n readOnly,\n required,\n tabIndex,\n value,\n onChange: onChangeProp,\n ...rest\n },\n ariaProps: { \"aria-describedby\": ariaDescribedby, ...ariaProps },\n dataProps,\n eventProps,\n } = useFieldProps({\n id: group ? uuid : undefined,\n ...props,\n notSupportReadOnly: true,\n })\n const resolvedAriaDescribedby = group ? ariaDescribedbyProp : ariaDescribedby\n const resolvedChecked =\n !isUndefined(groupValue) && !isUndefined(value)\n ? groupValue.includes(value)\n : checkedProp\n const [checked, setChecked] = useControllableEventState({\n defaultValue: defaultChecked,\n value: resolvedChecked,\n onChange: onChangeProp,\n })\n const trulyDisabled =\n !checked && isNumber(max) && group && group.value.length >= max\n const interactive = !(readOnly || trulyDisabled)\n const indeterminateRef = useCallback(\n (el: HTMLInputElement | null) => {\n if (el) el.indeterminate = indeterminate\n },\n [indeterminate],\n )\n\n const onChange = useCallback(\n (ev: ChangeEvent<HTMLInputElement>) => {\n if (!interactive) return (ev.defaultPrevented = true)\n\n if (indeterminate) ev.target.checked = true\n\n setChecked(ev)\n },\n [interactive, indeterminate, setChecked],\n )\n\n const getRootProps: PropGetter<\"label\"> = useCallback(\n (props = {}) => {\n const merged = mergeProps(\n {\n ...dataProps,\n \"data-checked\": dataAttr(checked),\n \"data-indeterminate\": dataAttr(indeterminate),\n },\n rest,\n props,\n )()\n\n return getLabelProps?.(merged) ?? merged\n },\n [dataProps, checked, indeterminate, rest, getLabelProps],\n )\n\n const getInputProps: PropGetter<\"input\"> = useCallback(\n (props = {}) => {\n const sharedProps = mergeProps(\n {\n ...dataProps,\n ...ariaProps,\n id,\n ref: mergeRefs(ref, indeterminateRef),\n type: \"checkbox\",\n name,\n style: visuallyHiddenAttributes.style,\n \"aria-checked\": indeterminate ? (\"mixed\" as const) : checked,\n \"aria-controls\": ariaControls,\n \"aria-describedby\": resolvedAriaDescribedby,\n \"aria-disabled\": ariaAttr(!interactive),\n \"aria-labelledby\": ariaLabelledby,\n \"data-checked\": dataAttr(checked),\n \"data-indeterminate\": dataAttr(indeterminate),\n checked,\n disabled,\n readOnly,\n required,\n tabIndex,\n value,\n },\n props,\n { ...eventProps, onChange },\n )()\n\n return getGroupInputProps?.(sharedProps) ?? sharedProps\n },\n [\n dataProps,\n ariaProps,\n id,\n name,\n indeterminate,\n checked,\n ariaControls,\n resolvedAriaDescribedby,\n interactive,\n ariaLabelledby,\n disabled,\n readOnly,\n required,\n tabIndex,\n value,\n ref,\n indeterminateRef,\n eventProps,\n onChange,\n getGroupInputProps,\n ],\n )\n\n const getIndicatorProps: PropGetter = useCallback(\n (props = {}) => ({\n ...dataProps,\n \"aria-hidden\": \"true\",\n \"data-checked\": dataAttr(checked),\n \"data-indeterminate\": dataAttr(indeterminate),\n ...props,\n }),\n [dataProps, checked, indeterminate],\n )\n\n return {\n checked,\n indeterminate,\n getIndicatorProps,\n getInputProps,\n getRootProps,\n onChange,\n }\n}\n\nexport type UseCheckboxReturn = ReturnType<typeof useCheckbox>\n"],"mappings":";;;;;;;;;;AAkEA,MAAa,eAA0C,EACrD,oBAAoB,qBACpB,GAAG,UACoB,CAAC,MAAM;CAC9B,MAAM,QAAQA,2BAAAA,wBAAwB;CACtC,MAAM,EACJ,KACA,OAAO,YACP,eAAe,oBACf,kBACE,SAAS,CAAC;CACd,MAAM,QAAA,GAAOC,MAAAA,MAAAA,CAAM;CACnB,MAAM,EACJ,OAAO,EACL,IACA,KACA,MACA,iBAAiB,cACjB,mBAAmB,gBACnB,SAAS,aACT,iBAAiB,OACjB,UACA,gBAAgB,OAChB,UACA,UACA,UACA,OACA,UAAU,cACV,GAAG,QAEL,WAAW,EAAE,oBAAoB,iBAAiB,GAAG,aACrD,WACA,eACEC,wBAAAA,cAAc;EAChB,IAA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AAKC,YAAAA,UAAU,KAAK,gBAAgB;GACpC,MAAM;GACN;GACA,OAAOC,YAAAA,yBAAyB;GAChC,gBAAgB,gBAAiB,UAAoB;GACrD,iBAAiB;GACjB,oBAAoB;GACpB,kBAAA,GAAA,oBAAA,cAAiB,SAAA,CAAS,CAAC,WAAW;GACtC,mBAAmB;GACnB,iBAAA,GAAA,oBAAA,cAAgB,SAAA,CAAS,OAAO;GAChC,uBAAA,GAAA,oBAAA,cAAsB,SAAA,CAAS,aAAa;GAC5C;GACA;GACA;GACA;GACA;GACA;EACF,GACA,OACA;GAAE,GAAG;GAAY;EAAS,CAC5B,CAAC,CAAC;EAEF,OAAO,qBAAqB,WAAW,KAAK;CAC9C,GACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CAaA,OAAO;EACL;EACA;EACA,oBAAA,GAdoCH,MAAAA,YAAAA,EACnC,QAAQ,CAAC,OAAO;GACf,GAAG;GACH,eAAe;GACf,iBAAA,GAAA,oBAAA,cAAgB,SAAA,CAAS,OAAO;GAChC,uBAAA,GAAA,oBAAA,cAAsB,SAAA,CAAS,aAAa;GAC5C,GAAG;EACL,IACA;GAAC;GAAW;GAAS;EAAa,CAMlB;EAChB;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"use-checkbox.cjs","names":["useCheckboxGroupContext","useId","useFieldProps","useControllableEventState","useCallback","mergeProps","visuallyHiddenAttributes"],"sources":["../../../../src/components/checkbox/use-checkbox.ts"],"sourcesContent":["\"use client\"\n\nimport type { ChangeEvent, ChangeEventHandler, FocusEventHandler } from \"react\"\nimport type { HTMLProps, HTMLRefAttributes, PropGetter } from \"../../core\"\nimport type { FieldProps } from \"../field\"\nimport { useCallback, useId } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useControllableEventState } from \"../../hooks/use-controllable-state\"\nimport {\n ariaAttr,\n dataAttr,\n isNumber,\n isUndefined,\n visuallyHiddenAttributes,\n} from \"../../utils\"\nimport { useFieldProps } from \"../field\"\nimport { useCheckboxGroupContext } from \"./use-checkbox-group\"\n\nexport interface UseCheckboxProps<Y extends string = string>\n extends\n Omit<HTMLProps<\"label\">, \"onBlur\" | \"onChange\" | \"onFocus\" | \"ref\">,\n HTMLRefAttributes<\"input\">,\n FieldProps {\n /**\n * If `true`, the checkbox will be checked.\n */\n checked?: boolean\n /**\n * If `true`, the checkbox will be initially checked.\n *\n * @default false\n */\n defaultChecked?: boolean\n /**\n * id assigned to input.\n */\n id?: string\n /**\n * If `true`, the checkbox will be indeterminate.\n *\n * @default false\n */\n indeterminate?: boolean\n /**\n * The name of the input field in a checkbox.\n */\n name?: string\n /**\n * The value of the checkbox.\n */\n value?: Y\n /**\n * The callback invoked when the checkbox is blurred.\n */\n onBlur?: FocusEventHandler<HTMLInputElement>\n /**\n * The callback invoked when the checked state changes.\n */\n onChange?: ChangeEventHandler<HTMLInputElement>\n /**\n * The callback invoked when the checkbox is focused.\n */\n onFocus?: FocusEventHandler<HTMLInputElement>\n}\n\nexport const useCheckbox = <Y extends string = string>({\n \"aria-describedby\": ariaDescribedbyProp,\n ...props\n}: UseCheckboxProps<Y> = {}) => {\n const group = useCheckboxGroupContext()\n const {\n max,\n value: groupValue,\n getInputProps: getGroupInputProps,\n getLabelProps,\n } = group ?? {}\n const uuid = useId()\n const {\n props: {\n id,\n ref,\n name,\n \"aria-controls\": ariaControls,\n \"aria-labelledby\": ariaLabelledby,\n checked: checkedProp,\n defaultChecked = false,\n disabled,\n indeterminate = false,\n readOnly,\n required,\n tabIndex,\n value,\n onChange: onChangeProp,\n ...rest\n },\n ariaProps: { \"aria-describedby\": ariaDescribedby, ...ariaProps },\n dataProps,\n eventProps,\n } = useFieldProps({\n id: group ? uuid : undefined,\n ...props,\n notSupportReadOnly: true,\n })\n const resolvedAriaDescribedby = group ? ariaDescribedbyProp : ariaDescribedby\n const resolvedChecked =\n !isUndefined(groupValue) && !isUndefined(value)\n ? groupValue.includes(value)\n : checkedProp\n const [checked, setChecked] = useControllableEventState({\n defaultValue: defaultChecked,\n value: resolvedChecked,\n onChange: onChangeProp,\n })\n const trulyDisabled =\n !checked && isNumber(max) && group && group.value.length >= max\n const interactive = !(readOnly || trulyDisabled)\n const indeterminateRef = useCallback(\n (el: HTMLInputElement | null) => {\n if (el) el.indeterminate = indeterminate\n },\n [indeterminate],\n )\n\n const onChange = useCallback(\n (ev: ChangeEvent<HTMLInputElement>) => {\n if (!interactive) return (ev.defaultPrevented = true)\n\n if (indeterminate) ev.target.checked = true\n\n setChecked(ev)\n },\n [interactive, indeterminate, setChecked],\n )\n\n const getRootProps: PropGetter<\"label\"> = useCallback(\n (props = {}) => {\n const merged = mergeProps(\n dataProps,\n {\n \"data-checked\": dataAttr(checked),\n \"data-indeterminate\": dataAttr(indeterminate),\n },\n rest,\n props,\n )()\n\n return getLabelProps?.(merged) ?? merged\n },\n [dataProps, checked, indeterminate, rest, getLabelProps],\n )\n\n const getInputProps: PropGetter<\"input\"> = useCallback(\n (props = {}) => {\n const sharedProps = mergeProps(\n { ref },\n dataProps,\n ariaProps,\n {\n id,\n ref: indeterminateRef,\n type: \"checkbox\",\n name,\n style: visuallyHiddenAttributes.style,\n \"aria-checked\": indeterminate ? (\"mixed\" as const) : checked,\n \"aria-controls\": ariaControls,\n \"aria-describedby\": resolvedAriaDescribedby,\n \"aria-disabled\": ariaAttr(!interactive),\n \"aria-labelledby\": ariaLabelledby,\n \"data-checked\": dataAttr(checked),\n \"data-indeterminate\": dataAttr(indeterminate),\n checked,\n disabled,\n readOnly,\n required,\n tabIndex,\n value,\n },\n props,\n eventProps,\n { onChange },\n )()\n\n return getGroupInputProps?.(sharedProps) ?? sharedProps\n },\n [\n dataProps,\n ariaProps,\n id,\n name,\n indeterminate,\n checked,\n ariaControls,\n resolvedAriaDescribedby,\n interactive,\n ariaLabelledby,\n disabled,\n readOnly,\n required,\n tabIndex,\n value,\n ref,\n indeterminateRef,\n eventProps,\n onChange,\n getGroupInputProps,\n ],\n )\n\n const getIndicatorProps: PropGetter = useCallback(\n (props = {}) =>\n mergeProps(\n dataProps,\n {\n \"aria-hidden\": \"true\",\n \"data-checked\": dataAttr(checked),\n \"data-indeterminate\": dataAttr(indeterminate),\n },\n props,\n )(),\n [dataProps, checked, indeterminate],\n )\n\n return {\n checked,\n indeterminate,\n getIndicatorProps,\n getInputProps,\n getRootProps,\n onChange,\n }\n}\n\nexport type UseCheckboxReturn = ReturnType<typeof useCheckbox>\n"],"mappings":";;;;;;;;;AAiEA,MAAa,eAA0C,EACrD,oBAAoB,qBACpB,GAAG,UACoB,CAAC,MAAM;CAC9B,MAAM,QAAQA,2BAAAA,wBAAwB;CACtC,MAAM,EACJ,KACA,OAAO,YACP,eAAe,oBACf,kBACE,SAAS,CAAC;CACd,MAAM,QAAA,GAAOC,MAAAA,MAAAA,CAAM;CACnB,MAAM,EACJ,OAAO,EACL,IACA,KACA,MACA,iBAAiB,cACjB,mBAAmB,gBACnB,SAAS,aACT,iBAAiB,OACjB,UACA,gBAAgB,OAChB,UACA,UACA,UACA,OACA,UAAU,cACV,GAAG,QAEL,WAAW,EAAE,oBAAoB,iBAAiB,GAAG,aACrD,WACA,eACEC,wBAAAA,cAAc;EAChB,IAAI,QAAQ,OAAO,KAAA;EACnB,GAAG;EACH,oBAAoB;CACtB,CAAC;CACD,MAAM,0BAA0B,QAAQ,sBAAsB;CAC9D,MAAM,kBACJ,EAAA,GAAA,oBAAA,cAAC,YAAA,CAAY,UAAU,KAAK,EAAA,GAAA,oBAAA,cAAC,YAAA,CAAY,KAAK,IAC1C,WAAW,SAAS,KAAK,IACzB;CACN,MAAM,CAAC,SAAS,cAAcC,2CAAAA,0BAA0B;EACtD,cAAc;EACd,OAAO;EACP,UAAU;CACZ,CAAC;CACD,MAAM,gBACJ,CAAC,YAAA,GAAA,oBAAA,cAAW,SAAA,CAAS,GAAG,KAAK,SAAS,MAAM,MAAM,UAAU;CAC9D,M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A;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CAgBA,OAAO;EACL;EACA;EACA,oBAAA,GAjBoCF,MAAAA,YAAAA,EACnC,QAAQ,CAAC,MACRC,cAAAA,WACE,WACA;GACE,eAAe;GACf,iBAAA,GAAA,oBAAA,cAAgB,SAAA,CAAS,OAAO;GAChC,uBAAA,GAAA,oBAAA,cAAsB,SAAA,CAAS,aAAa;EAC9C,GACA,KACF,CAAC,CAAC,GACJ;GAAC;GAAW;GAAS;EAAa,CAMlB;EAChB;EACA;EACA;CACF;AACF"}
@@ -138,9 +138,9 @@ const useColorPicker = (props) => {
138
138
  onFieldFocus,
139
139
  onMouseDown
140
140
  ]);
141
- const getInputProps = (0, react.useCallback)((props = {}) => require_props.mergeProps({
141
+ const getInputProps = (0, react.useCallback)((props = {}) => require_props.mergeProps(dataProps, {
142
142
  id,
143
- ref: require_ref.mergeRefs(ref, inputRef),
143
+ ref,
144
144
  name,
145
145
  style: !allowInput ? { pointerEvents: "none" } : {},
146
146
  "aria-label": ariaLabel,
@@ -151,9 +151,9 @@ const useColorPicker = (props) => {
151
151
  readOnly,
152
152
  required,
153
153
  tabIndex: allowInput ? 0 : -1,
154
- value,
155
- ...dataProps
154
+ value
156
155
  }, props, {
156
+ ref: inputRef,
157
157
  onBlur,
158
158
  onChange: onInputChange,
159
159
  onFocus: onInputFocus,
@@ -1 +1 @@
1
- {"version":3,"file":"use-color-picker.cjs","names":["useI18n","useFieldProps","useCombobox","useRef","useControllableState","useEyeDropper","useCallback","mergeRefs","mergeProps","runKeyAction"],"sources":["../../../../src/components/color-picker/use-color-picker.ts"],"sourcesContent":["\"use client\"\n\nimport type { ChangeEvent, FocusEvent, MouseEvent } from \"react\"\nimport type { HTMLRefAttributes, PropGetter } from \"../../core\"\nimport type { UseComboboxProps } from \"../../hooks/use-combobox\"\nimport type { ColorFormat } from \"../../utils\"\nimport type { UseColorSelectorProps } from \"../color-selector\"\nimport type { FieldProps } from \"../field\"\nimport { useCallback, useEffect, useRef } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useCombobox } from \"../../hooks/use-combobox\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { useEyeDropper } from \"../../hooks/use-eye-dropper\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport {\n ariaAttr,\n calcFormat,\n contains,\n convertColor,\n focusTransfer,\n handlerAll,\n mergeRefs,\n runIfFn,\n runKeyAction,\n} from \"../../utils\"\nimport { useFieldProps } from \"../field\"\n\nexport interface UseColorPickerProps\n extends\n Omit<\n UseComboboxProps,\n | \"closeOnSelect\"\n | \"initialFocusValue\"\n | \"onChange\"\n | \"ref\"\n | \"selectFocusRef\"\n | \"selectOnSpace\"\n >,\n HTMLRefAttributes<\"input\">,\n FieldProps {\n /**\n * If `true`, allows input.\n *\n * @default true\n */\n allowInput?: boolean\n /**\n * If `true`, the color picker will be closed when the input value changes.\n *\n * @default false\n */\n closeOnChange?: ((ev: ChangeEvent<HTMLInputElement>) => boolean) | boolean\n /**\n * The initial value of the color picker.\n */\n defaultValue?: string\n /**\n * The fallback value of the color picker.\n *\n * @default '#FFFFFF'\n */\n fallbackValue?: string\n /**\n * The format of the color picker.\n * Automatically determines the format of `value` or `defaultValue`.\n *\n * @default 'hex'\n */\n format?: ColorFormat\n /**\n * The `id` attribute of the input element.\n */\n id?: string\n /**\n * The `name` attribute of the input element.\n */\n name?: string\n /**\n * If `true`, the color picker will be opened when the input value changes.\n *\n * @default true\n */\n openOnChange?: ((ev: ChangeEvent<HTMLInputElement>) => boolean) | boolean\n /**\n * If `true`, the color picker will be opened when the input is focused.\n *\n * @default false\n */\n openOnFocus?: boolean\n /**\n * The pattern used to check the input element.\n */\n pattern?: RegExp\n /**\n * The placeholder for color picker.\n */\n placeholder?: string\n /**\n * The value of the color picker.\n */\n value?: string\n /**\n * The function to format the input value.\n */\n formatInput?: (value: string) => string\n /**\n * The callback invoked when the value changes.\n */\n onChange?: (value: string) => void\n /**\n * The callback invoked when input value state changes.\n */\n onInputChange?: (ev: ChangeEvent<HTMLInputElement>) => void\n}\n\nexport const useColorPicker = (props: UseColorPickerProps) => {\n const { t } = useI18n(\"colorPicker\")\n const {\n props: {\n id,\n ref,\n name,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledby,\n allowInput = true,\n closeOnChange = false,\n defaultValue,\n disabled,\n fallbackValue = \"#FFFFFF\",\n format: formatProp,\n formatInput,\n openOnChange = true,\n openOnClick = true,\n openOnFocus = true,\n pattern,\n placeholder,\n placement = \"end-start\",\n readOnly,\n required,\n value: valueProp,\n onChange: onChangeProp,\n onInputChange: onInputChangeProp,\n ...rest\n },\n ariaProps,\n dataProps,\n eventProps,\n } = useFieldProps(props)\n const {\n interactive,\n open,\n getContentProps: getComboboxContentProps,\n getTriggerProps,\n popoverProps,\n onClose,\n onOpen,\n } = useCombobox({\n disabled,\n matchWidth: false,\n openOnClick: false,\n openOnEnter: !allowInput,\n openOnSpace: !allowInput,\n placement,\n readOnly,\n transferFocus: false,\n ...ariaProps,\n ...dataProps,\n ...eventProps,\n ...rest,\n })\n const format =\n formatProp ?? calcFormat(valueProp ?? defaultValue ?? fallbackValue)\n const alpha = format.endsWith(\"a\")\n const fieldRef = useRef<HTMLDivElement>(null)\n const contentRef = useRef<HTMLDivElement>(null)\n const inputRef = useRef<HTMLInputElement>(null)\n const focusByClickRef = useRef<boolean>(false)\n const [value, setValue] = useControllableState({\n defaultValue,\n value: valueProp,\n onChange: onChangeProp,\n })\n const { supported: supportedEyeDropper, onOpen: onOpenEyeDropper } =\n useEyeDropper()\n\n const onClick = useCallback(() => {\n if (!interactive) return\n\n focusByClickRef.current = true\n\n if (allowInput) inputRef.current?.focus()\n\n if (openOnClick) onOpen()\n }, [allowInput, interactive, onOpen, openOnClick])\n\n const onMouseDown = useCallback(\n (ev: MouseEvent<HTMLDivElement | HTMLInputElement>) => {\n if (!openOnFocus) return\n\n ev.preventDefault()\n ev.stopPropagation()\n },\n [openOnFocus],\n )\n\n const onFieldFocus = useCallback(() => {\n if (allowInput) return\n\n if (openOnFocus) onOpen()\n\n focusByClickRef.current = false\n }, [allowInput, onOpen, openOnFocus])\n\n const onInputFocus = useCallback(\n (ev: FocusEvent<HTMLInputElement>) => {\n ev.preventDefault()\n ev.stopPropagation()\n\n if (openOnFocus && !focusByClickRef.current) onOpen()\n\n focusByClickRef.current = false\n },\n [onOpen, openOnFocus],\n )\n\n const onBlur = useCallback(\n (ev: FocusEvent<HTMLInputElement>) => {\n if (\n contains(fieldRef.current, ev.relatedTarget) ||\n contains(contentRef.current, ev.relatedTarget)\n )\n ev.preventDefault()\n else\n setValue((prev) => {\n if (!prev) return prev\n\n let value = convertColor(prev)(format)\n\n if (!value) return prev\n\n if (formatInput) value = formatInput(value)\n\n if (pattern) value = value.replace(pattern, \"\")\n\n return value\n })\n },\n [format, formatInput, pattern, setValue],\n )\n\n const onInputChange = useCallback(\n (ev: ChangeEvent<HTMLInputElement>) => {\n if (!allowInput) return\n\n onInputChangeProp?.(ev)\n\n if (runIfFn(closeOnChange, ev)) onClose()\n else if (runIfFn(openOnChange, ev)) onOpen()\n\n let inputValue = ev.target.value\n\n if (formatInput) inputValue = formatInput(inputValue)\n\n if (pattern) inputValue = inputValue.replace(pattern, \"\")\n\n setValue(inputValue)\n },\n [\n allowInput,\n closeOnChange,\n formatInput,\n onClose,\n onInputChangeProp,\n onOpen,\n openOnChange,\n pattern,\n setValue,\n ],\n )\n\n const onEyeDropperClick = useCallback(async () => {\n if (!interactive) return\n\n const result = await onOpenEyeDropper()\n\n if (result?.sRGBHex) setValue(result.sRGBHex)\n }, [interactive, onOpenEyeDropper, setValue])\n\n useEffect(() => {\n if (!open) return\n\n return focusTransfer(\n contentRef.current,\n allowInput ? inputRef.current : fieldRef.current,\n )\n }, [allowInput, open])\n\n const getRootProps: PropGetter = useCallback(\n (props) => ({\n ...dataProps,\n ...props,\n }),\n [dataProps],\n )\n\n const getFieldProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) =>\n getTriggerProps({\n ref: mergeRefs(ref, fieldRef),\n \"aria-haspopup\": \"dialog\",\n tabIndex: !allowInput ? 0 : -1,\n ...props,\n onClick: handlerAll(props.onClick, onClick),\n onFocus: handlerAll(props.onFocus, onFieldFocus),\n onMouseDown: handlerAll(props.onMouseDown, onMouseDown),\n }),\n\n [allowInput, getTriggerProps, onClick, onFieldFocus, onMouseDown],\n )\n\n const getInputProps: PropGetter<\"input\"> = useCallback(\n (props = {}) =>\n mergeProps(\n {\n id,\n ref: mergeRefs(ref, inputRef),\n name,\n style: !allowInput ? { pointerEvents: \"none\" } : {},\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledby,\n autoComplete: \"off\",\n disabled,\n placeholder,\n readOnly,\n required,\n tabIndex: allowInput ? 0 : -1,\n value,\n ...dataProps,\n },\n props,\n { onBlur, onChange: onInputChange, onFocus: onInputFocus, onMouseDown },\n )(),\n [\n allowInput,\n ariaLabel,\n ariaLabelledby,\n dataProps,\n disabled,\n id,\n name,\n onBlur,\n onInputChange,\n onInputFocus,\n onMouseDown,\n placeholder,\n readOnly,\n ref,\n required,\n value,\n ],\n )\n\n const getEyeDropperProps: PropGetter = useCallback(\n (props = {}) => ({\n ...dataProps,\n \"aria-disabled\": ariaAttr(!interactive),\n \"aria-label\": t(\"Pick a color\"),\n hidden: !supportedEyeDropper,\n role: \"button\",\n tabIndex: interactive ? 0 : -1,\n ...props,\n onClick: handlerAll(props.onClick, onEyeDropperClick),\n onKeyDown: handlerAll(props.onKeyDown, (ev) =>\n runKeyAction(ev, {\n Enter: onEyeDropperClick,\n Space: onEyeDropperClick,\n }),\n ),\n }),\n [dataProps, interactive, onEyeDropperClick, supportedEyeDropper, t],\n )\n\n const getContentProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) =>\n getComboboxContentProps({\n ref: mergeRefs(ref, contentRef),\n role: \"dialog\",\n ...props,\n }),\n [getComboboxContentProps],\n )\n\n const getSelectorProps: PropGetter<UseColorSelectorProps> = useCallback(\n (props = {}) => ({\n disabled,\n fallbackValue,\n format,\n readOnly,\n value,\n ...props,\n onChange: handlerAll(props.onChange, setValue),\n }),\n [disabled, fallbackValue, format, readOnly, value, setValue],\n )\n\n return {\n alpha,\n format,\n interactive,\n open,\n setValue,\n value,\n getContentProps,\n getEyeDropperProps,\n getFieldProps,\n getInputProps,\n getRootProps,\n getSelectorProps,\n popoverProps,\n onClose,\n onOpen,\n }\n}\n\nexport type UseColorPickerReturn = ReturnType<typeof useColorPicker>\n"],"mappings":";;;;;;;;;;;;AAmHA,MAAa,kBAAkB,UAA+B;CAC5D,MAAM,EAAE,MAAMA,sBAAAA,QAAQ,aAAa;CACnC,MAAM,EACJ,OAAO,EACL,IACA,KACA,MACA,cAAc,WACd,mBAAmB,gBACnB,aAAa,MACb,gBAAgB,OAChB,cACA,UACA,gBAAgB,WAChB,QAAQ,YACR,aACA,eAAe,MACf,cAAc,MACd,cAAc,MACd,SACA,aACA,YAAY,aACZ,UACA,UACA,OAAO,WACP,UAAU,cACV,eAAe,mBACf,GAAG,QAEL,WACA,WACA,eACEC,wBAAAA,cAAc,KAAK;CACvB,MAAM,EACJ,aACA,MACA,iBAAiB,yBACjB,iBACA,cACA,SACA,WACEC,iCAAAA,YAAY;EACd;EACA,YAAY;EACZ,aAAa;EACb,aAAa,CAAC;EACd,aAAa,CAAC;EACd;EACA;EACA,eAAe;EACf,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;CACL,CAAC;CACD,MAAM,SACJ,eAAA,GAAA,oBAAA,cAAc,WAAA,CAAW,aAAa,gBAAgB,aAAa;CACrE,MAAM,QAAQ,OAAO,SAAS,GAAG;CACjC,MAAM,YAAA,GAAWC,MAAAA,OAAAA,CAAuB,IAAI;CAC5C,MAAM,cAAA,GAAaA,MAAAA,OAAAA,CAAuB,IAAI;CAC9C,MAAM,YAAA,GAAWA,MAAAA,OAAAA,CAAyB,IAAI;CAC9C,MA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AyBA,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA,kBAAA,GA9BkCH,MAAAA,YAAAA,EACjC,EAAE,KAAK,GAAG,UAAU,CAAC,MACpB,wBAAwB;GACtB,KAAKC,YAAAA,UAAU,KAAK,UAAU;GAC9B,MAAM;GACN,GAAG;EACL,CAAC,GACH,CAAC,uBAAuB,CAuBV;EACd;EACA;EACA;EACA;EACA,mBAAA,GAzB0DD,MAAAA,YAAAA,EACzD,QAAQ,CAAC,OAAO;GACf;GACA;GACA;GACA;GACA;GACA,GAAG;GACH,WAAA,GAAA,oBAAA,cAAU,WAAA,CAAW,MAAM,UAAU,QAAQ;EAC/C,IACA;GAAC;GAAU;GAAe;GAAQ;GAAU;GAAO;EAAQ,CAe5C;EACf;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"use-color-picker.cjs","names":["useI18n","useFieldProps","useCombobox","useRef","useControllableState","useEyeDropper","useCallback","mergeRefs","mergeProps","runKeyAction"],"sources":["../../../../src/components/color-picker/use-color-picker.ts"],"sourcesContent":["\"use client\"\n\nimport type { ChangeEvent, FocusEvent, MouseEvent } from \"react\"\nimport type { HTMLRefAttributes, PropGetter } from \"../../core\"\nimport type { UseComboboxProps } from \"../../hooks/use-combobox\"\nimport type { ColorFormat } from \"../../utils\"\nimport type { UseColorSelectorProps } from \"../color-selector\"\nimport type { FieldProps } from \"../field\"\nimport { useCallback, useEffect, useRef } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useCombobox } from \"../../hooks/use-combobox\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { useEyeDropper } from \"../../hooks/use-eye-dropper\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport {\n ariaAttr,\n calcFormat,\n contains,\n convertColor,\n focusTransfer,\n handlerAll,\n mergeRefs,\n runIfFn,\n runKeyAction,\n} from \"../../utils\"\nimport { useFieldProps } from \"../field\"\n\nexport interface UseColorPickerProps\n extends\n Omit<\n UseComboboxProps,\n | \"closeOnSelect\"\n | \"initialFocusValue\"\n | \"onChange\"\n | \"ref\"\n | \"selectFocusRef\"\n | \"selectOnSpace\"\n >,\n HTMLRefAttributes<\"input\">,\n FieldProps {\n /**\n * If `true`, allows input.\n *\n * @default true\n */\n allowInput?: boolean\n /**\n * If `true`, the color picker will be closed when the input value changes.\n *\n * @default false\n */\n closeOnChange?: ((ev: ChangeEvent<HTMLInputElement>) => boolean) | boolean\n /**\n * The initial value of the color picker.\n */\n defaultValue?: string\n /**\n * The fallback value of the color picker.\n *\n * @default '#FFFFFF'\n */\n fallbackValue?: string\n /**\n * The format of the color picker.\n * Automatically determines the format of `value` or `defaultValue`.\n *\n * @default 'hex'\n */\n format?: ColorFormat\n /**\n * The `id` attribute of the input element.\n */\n id?: string\n /**\n * The `name` attribute of the input element.\n */\n name?: string\n /**\n * If `true`, the color picker will be opened when the input value changes.\n *\n * @default true\n */\n openOnChange?: ((ev: ChangeEvent<HTMLInputElement>) => boolean) | boolean\n /**\n * If `true`, the color picker will be opened when the input is focused.\n *\n * @default false\n */\n openOnFocus?: boolean\n /**\n * The pattern used to check the input element.\n */\n pattern?: RegExp\n /**\n * The placeholder for color picker.\n */\n placeholder?: string\n /**\n * The value of the color picker.\n */\n value?: string\n /**\n * The function to format the input value.\n */\n formatInput?: (value: string) => string\n /**\n * The callback invoked when the value changes.\n */\n onChange?: (value: string) => void\n /**\n * The callback invoked when input value state changes.\n */\n onInputChange?: (ev: ChangeEvent<HTMLInputElement>) => void\n}\n\nexport const useColorPicker = (props: UseColorPickerProps) => {\n const { t } = useI18n(\"colorPicker\")\n const {\n props: {\n id,\n ref,\n name,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledby,\n allowInput = true,\n closeOnChange = false,\n defaultValue,\n disabled,\n fallbackValue = \"#FFFFFF\",\n format: formatProp,\n formatInput,\n openOnChange = true,\n openOnClick = true,\n openOnFocus = true,\n pattern,\n placeholder,\n placement = \"end-start\",\n readOnly,\n required,\n value: valueProp,\n onChange: onChangeProp,\n onInputChange: onInputChangeProp,\n ...rest\n },\n ariaProps,\n dataProps,\n eventProps,\n } = useFieldProps(props)\n const {\n interactive,\n open,\n getContentProps: getComboboxContentProps,\n getTriggerProps,\n popoverProps,\n onClose,\n onOpen,\n } = useCombobox({\n disabled,\n matchWidth: false,\n openOnClick: false,\n openOnEnter: !allowInput,\n openOnSpace: !allowInput,\n placement,\n readOnly,\n transferFocus: false,\n ...ariaProps,\n ...dataProps,\n ...eventProps,\n ...rest,\n })\n const format =\n formatProp ?? calcFormat(valueProp ?? defaultValue ?? fallbackValue)\n const alpha = format.endsWith(\"a\")\n const fieldRef = useRef<HTMLDivElement>(null)\n const contentRef = useRef<HTMLDivElement>(null)\n const inputRef = useRef<HTMLInputElement>(null)\n const focusByClickRef = useRef<boolean>(false)\n const [value, setValue] = useControllableState({\n defaultValue,\n value: valueProp,\n onChange: onChangeProp,\n })\n const { supported: supportedEyeDropper, onOpen: onOpenEyeDropper } =\n useEyeDropper()\n\n const onClick = useCallback(() => {\n if (!interactive) return\n\n focusByClickRef.current = true\n\n if (allowInput) inputRef.current?.focus()\n\n if (openOnClick) onOpen()\n }, [allowInput, interactive, onOpen, openOnClick])\n\n const onMouseDown = useCallback(\n (ev: MouseEvent<HTMLDivElement | HTMLInputElement>) => {\n if (!openOnFocus) return\n\n ev.preventDefault()\n ev.stopPropagation()\n },\n [openOnFocus],\n )\n\n const onFieldFocus = useCallback(() => {\n if (allowInput) return\n\n if (openOnFocus) onOpen()\n\n focusByClickRef.current = false\n }, [allowInput, onOpen, openOnFocus])\n\n const onInputFocus = useCallback(\n (ev: FocusEvent<HTMLInputElement>) => {\n ev.preventDefault()\n ev.stopPropagation()\n\n if (openOnFocus && !focusByClickRef.current) onOpen()\n\n focusByClickRef.current = false\n },\n [onOpen, openOnFocus],\n )\n\n const onBlur = useCallback(\n (ev: FocusEvent<HTMLInputElement>) => {\n if (\n contains(fieldRef.current, ev.relatedTarget) ||\n contains(contentRef.current, ev.relatedTarget)\n )\n ev.preventDefault()\n else\n setValue((prev) => {\n if (!prev) return prev\n\n let value = convertColor(prev)(format)\n\n if (!value) return prev\n\n if (formatInput) value = formatInput(value)\n\n if (pattern) value = value.replace(pattern, \"\")\n\n return value\n })\n },\n [format, formatInput, pattern, setValue],\n )\n\n const onInputChange = useCallback(\n (ev: ChangeEvent<HTMLInputElement>) => {\n if (!allowInput) return\n\n onInputChangeProp?.(ev)\n\n if (runIfFn(closeOnChange, ev)) onClose()\n else if (runIfFn(openOnChange, ev)) onOpen()\n\n let inputValue = ev.target.value\n\n if (formatInput) inputValue = formatInput(inputValue)\n\n if (pattern) inputValue = inputValue.replace(pattern, \"\")\n\n setValue(inputValue)\n },\n [\n allowInput,\n closeOnChange,\n formatInput,\n onClose,\n onInputChangeProp,\n onOpen,\n openOnChange,\n pattern,\n setValue,\n ],\n )\n\n const onEyeDropperClick = useCallback(async () => {\n if (!interactive) return\n\n const result = await onOpenEyeDropper()\n\n if (result?.sRGBHex) setValue(result.sRGBHex)\n }, [interactive, onOpenEyeDropper, setValue])\n\n useEffect(() => {\n if (!open) return\n\n return focusTransfer(\n contentRef.current,\n allowInput ? inputRef.current : fieldRef.current,\n )\n }, [allowInput, open])\n\n const getRootProps: PropGetter = useCallback(\n (props) => ({\n ...dataProps,\n ...props,\n }),\n [dataProps],\n )\n\n const getFieldProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) =>\n getTriggerProps({\n ref: mergeRefs(ref, fieldRef),\n \"aria-haspopup\": \"dialog\",\n tabIndex: !allowInput ? 0 : -1,\n ...props,\n onClick: handlerAll(props.onClick, onClick),\n onFocus: handlerAll(props.onFocus, onFieldFocus),\n onMouseDown: handlerAll(props.onMouseDown, onMouseDown),\n }),\n\n [allowInput, getTriggerProps, onClick, onFieldFocus, onMouseDown],\n )\n\n const getInputProps: PropGetter<\"input\"> = useCallback(\n (props = {}) =>\n mergeProps(\n dataProps,\n {\n id,\n ref,\n name,\n style: !allowInput ? { pointerEvents: \"none\" } : {},\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledby,\n autoComplete: \"off\",\n disabled,\n placeholder,\n readOnly,\n required,\n tabIndex: allowInput ? 0 : -1,\n value,\n },\n props,\n {\n ref: inputRef,\n onBlur,\n onChange: onInputChange,\n onFocus: onInputFocus,\n onMouseDown,\n },\n )(),\n [\n allowInput,\n ariaLabel,\n ariaLabelledby,\n dataProps,\n disabled,\n id,\n name,\n onBlur,\n onInputChange,\n onInputFocus,\n onMouseDown,\n placeholder,\n readOnly,\n ref,\n required,\n value,\n ],\n )\n\n const getEyeDropperProps: PropGetter = useCallback(\n (props = {}) => ({\n ...dataProps,\n \"aria-disabled\": ariaAttr(!interactive),\n \"aria-label\": t(\"Pick a color\"),\n hidden: !supportedEyeDropper,\n role: \"button\",\n tabIndex: interactive ? 0 : -1,\n ...props,\n onClick: handlerAll(props.onClick, onEyeDropperClick),\n onKeyDown: handlerAll(props.onKeyDown, (ev) =>\n runKeyAction(ev, {\n Enter: onEyeDropperClick,\n Space: onEyeDropperClick,\n }),\n ),\n }),\n [dataProps, interactive, onEyeDropperClick, supportedEyeDropper, t],\n )\n\n const getContentProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) =>\n getComboboxContentProps({\n ref: mergeRefs(ref, contentRef),\n role: \"dialog\",\n ...props,\n }),\n [getComboboxContentProps],\n )\n\n const getSelectorProps: PropGetter<UseColorSelectorProps> = useCallback(\n (props = {}) => ({\n disabled,\n fallbackValue,\n format,\n readOnly,\n value,\n ...props,\n onChange: handlerAll(props.onChange, setValue),\n }),\n [disabled, fallbackValue, format, readOnly, value, setValue],\n )\n\n return {\n alpha,\n format,\n interactive,\n open,\n setValue,\n value,\n getContentProps,\n getEyeDropperProps,\n getFieldProps,\n getInputProps,\n getRootProps,\n getSelectorProps,\n popoverProps,\n onClose,\n onOpen,\n }\n}\n\nexport type UseColorPickerReturn = ReturnType<typeof useColorPicker>\n"],"mappings":";;;;;;;;;;;;AAmHA,MAAa,kBAA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;GAAQ;GAAU;GAAO;EAAQ,CAe5C;EACf;EACA;EACA;CACF;AACF"}
@@ -45,12 +45,10 @@ const useCheckboxGroup = (props = {}) => {
45
45
  return {
46
46
  max,
47
47
  value,
48
- getInputProps: useCallback((props = {}) => {
48
+ getInputProps: useCallback(({ disabled, ...props } = {}) => {
49
49
  const checked = !(0, utils_exports.isUndefined)(value) && ((0, utils_exports.isString)(props.value) || (0, utils_exports.isNumber)(props.value)) && value.includes(props.value);
50
50
  const trulyDisabled = !checked && (0, utils_exports.isNumber)(max) && value.length >= max;
51
- return {
52
- ...dataProps,
53
- ...ariaProps,
51
+ return mergeProps(dataProps, ariaProps, {
54
52
  type: "checkbox",
55
53
  style: visuallyHiddenAttributes.style,
56
54
  "aria-checked": checked,
@@ -58,14 +56,10 @@ const useCheckboxGroup = (props = {}) => {
58
56
  "data-checked": (0, utils_exports.dataAttr)(checked),
59
57
  "data-disabled": (0, utils_exports.dataAttr)(trulyDisabled),
60
58
  checked,
59
+ disabled: Boolean(disabled || trulyDisabled),
61
60
  readOnly,
62
- required,
63
- ...props,
64
- disabled: Boolean(props.disabled || trulyDisabled),
65
- onBlur: (0, utils_exports.handlerAll)(props.onBlur, eventProps.onBlur),
66
- onChange: (0, utils_exports.handlerAll)(props.onChange, onChange),
67
- onFocus: (0, utils_exports.handlerAll)(props.onFocus, eventProps.onFocus)
68
- };
61
+ required
62
+ }, props, eventProps, { onChange })();
69
63
  }, [
70
64
  ariaProps,
71
65
  dataProps,
@@ -76,10 +70,7 @@ const useCheckboxGroup = (props = {}) => {
76
70
  required,
77
71
  value
78
72
  ]),
79
- getLabelProps: useCallback((props) => ({
80
- ...dataProps,
81
- ...props
82
- }), [dataProps]),
73
+ getLabelProps: useCallback((props = {}) => mergeProps(dataProps, props)(), [dataProps]),
83
74
  getRootProps,
84
75
  onChange
85
76
  };
@@ -1 +1 @@
1
- {"version":3,"file":"use-checkbox-group.js","names":["createContext","isObject","isNumber","isUndefined","isString","ariaAttr","dataAttr","handlerAll"],"sources":["../../../../src/components/checkbox/use-checkbox-group.ts"],"sourcesContent":["\"use client\"\n\nimport type { ChangeEvent } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { FieldProps } from \"../field\"\nimport { useCallback } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport {\n ariaAttr,\n createContext,\n dataAttr,\n handlerAll,\n isNumber,\n isObject,\n isString,\n isUndefined,\n visuallyHiddenAttributes,\n} from \"../../utils\"\nimport { useFieldProps } from \"../field\"\n\ninterface CheckboxGroupContext extends Omit<\n UseCheckboxGroupReturn,\n \"getRootProps\"\n> {}\n\nconst [CheckboxGroupContext, useCheckboxGroupContext] =\n createContext<CheckboxGroupContext>({\n name: \"CheckboxGroupContext\",\n strict: false,\n })\n\nexport { CheckboxGroupContext, useCheckboxGroupContext }\n\nexport interface UseCheckboxGroupProps<Y extends string = string>\n extends Omit<HTMLProps, \"defaultValue\" | \"onChange\" | \"value\">, FieldProps {\n /**\n * The initial value of the checkbox group.\n *\n * @default []\n */\n defaultValue?: Y[]\n /**\n * The maximum number of checkboxes that can be checked.\n */\n max?: number\n /**\n * The value of the checkbox group.\n */\n value?: Y[]\n /**\n * The callback fired when any children checkbox is checked or unchecked.\n */\n onChange?: (value: Y[]) => void\n}\n\nexport const useCheckboxGroup = <Y extends string = string>(\n props: UseCheckboxGroupProps<Y> = {},\n) => {\n const {\n context: { labelId } = {},\n props: {\n defaultValue = [],\n disabled,\n max,\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)) valueOrEv = valueOrEv.target.value as Y\n\n setValue((prev) => {\n if (prev.includes(valueOrEv))\n return prev.filter((prevValue) => prevValue !== valueOrEv)\n else if (!isNumber(max) || prev.length < max)\n return [...prev, valueOrEv]\n else return prev\n })\n },\n [interactive, max, setValue],\n )\n\n const getRootProps: PropGetter = useCallback(\n (props = {}) =>\n mergeProps(\n dataProps,\n {\n \"aria-describedby\": ariaDescribedby,\n \"aria-labelledby\": labelId,\n role: \"group\",\n },\n rest,\n props,\n )(),\n [ariaDescribedby, dataProps, labelId, rest],\n )\n\n const getInputProps: PropGetter<\"input\"> = useCallback(\n (props = {}) => {\n const checked =\n !isUndefined(value) &&\n (isString(props.value) || isNumber(props.value)) &&\n value.includes(props.value as Y)\n const trulyDisabled = !checked && isNumber(max) && value.length >= max\n\n return {\n ...dataProps,\n ...ariaProps,\n type: \"checkbox\",\n style: visuallyHiddenAttributes.style,\n \"aria-checked\": checked,\n \"aria-disabled\": ariaAttr(trulyDisabled),\n \"data-checked\": dataAttr(checked),\n \"data-disabled\": dataAttr(trulyDisabled),\n checked,\n readOnly,\n required,\n ...props,\n disabled: Boolean(props.disabled || trulyDisabled),\n onBlur: handlerAll(props.onBlur, eventProps.onBlur),\n onChange: handlerAll(props.onChange, onChange),\n onFocus: handlerAll(props.onFocus, eventProps.onFocus),\n }\n },\n [\n ariaProps,\n dataProps,\n eventProps,\n max,\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 max,\n value,\n getInputProps,\n getLabelProps,\n getRootProps,\n onChange,\n }\n}\n\nexport type UseCheckboxGroupReturn = ReturnType<typeof useCheckboxGroup>\n"],"mappings":";;;;;;;;;AA0BA,MAAM,CAAC,sBAAsB,2BAC3BA,gBAAoC;CAClC,MAAM;CACN,QAAQ;AACV,CAAC;AA0BH,MAAa,oBACX,QAAkC,CAAC,MAChC;C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O,yBAAyB;IAChC,gBAAgB;IAChB,kBAAA,GAAiBG,cAAAA,SAAAA,CAAS,aAAa;IACvC,iBAAA,GAAgBC,cAAAA,SAAAA,CAAS,OAAO;IAChC,kBAAA,GAAiBA,cAAAA,SAAAA,CAAS,aAAa;IACvC;IACA;IACA;IACA,GAAG;IACH,UAAU,QAAQ,MAAM,YAAY,aAAa;IACjD,SAAA,GAAQC,cAAAA,WAAAA,CAAW,MAAM,QAAQ,WAAW,MAAM;IAClD,WAAA,GAAUA,cAAAA,WAAAA,CAAW,MAAM,UAAU,QAAQ;IAC7C,UAAA,GAASA,cAAAA,WAAAA,CAAW,MAAM,SAAS,WAAW,OAAO;GACvD;EACF,GACA;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,CAcY;EACZ,eAZyC,aACxC,WAAW;GACV,GAAG;GACH,GAAG;EACL,IACA,CAAC,SAAS,CAOE;EACZ;EACA;CACF;AACF"}
1
+ {"version":3,"file":"use-checkbox-group.js","names":["createContext","isObject","isNumber","isUndefined","isString","ariaAttr","dataAttr"],"sources":["../../../../src/components/checkbox/use-checkbox-group.ts"],"sourcesContent":["\"use client\"\n\nimport type { ChangeEvent } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { FieldProps } from \"../field\"\nimport { useCallback } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport {\n ariaAttr,\n createContext,\n dataAttr,\n isNumber,\n isObject,\n isString,\n isUndefined,\n visuallyHiddenAttributes,\n} from \"../../utils\"\nimport { useFieldProps } from \"../field\"\n\ninterface CheckboxGroupContext extends Omit<\n UseCheckboxGroupReturn,\n \"getRootProps\"\n> {}\n\nconst [CheckboxGroupContext, useCheckboxGroupContext] =\n createContext<CheckboxGroupContext>({\n name: \"CheckboxGroupContext\",\n strict: false,\n })\n\nexport { CheckboxGroupContext, useCheckboxGroupContext }\n\nexport interface UseCheckboxGroupProps<Y extends string = string>\n extends Omit<HTMLProps, \"defaultValue\" | \"onChange\" | \"value\">, FieldProps {\n /**\n * The initial value of the checkbox group.\n *\n * @default []\n */\n defaultValue?: Y[]\n /**\n * The maximum number of checkboxes that can be checked.\n */\n max?: number\n /**\n * The value of the checkbox group.\n */\n value?: Y[]\n /**\n * The callback fired when any children checkbox is checked or unchecked.\n */\n onChange?: (value: Y[]) => void\n}\n\nexport const useCheckboxGroup = <Y extends string = string>(\n props: UseCheckboxGroupProps<Y> = {},\n) => {\n const {\n context: { labelId } = {},\n props: {\n defaultValue = [],\n disabled,\n max,\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)) valueOrEv = valueOrEv.target.value as Y\n\n setValue((prev) => {\n if (prev.includes(valueOrEv))\n return prev.filter((prevValue) => prevValue !== valueOrEv)\n else if (!isNumber(max) || prev.length < max)\n return [...prev, valueOrEv]\n else return prev\n })\n },\n [interactive, max, setValue],\n )\n\n const getRootProps: PropGetter = useCallback(\n (props = {}) =>\n mergeProps(\n dataProps,\n {\n \"aria-describedby\": ariaDescribedby,\n \"aria-labelledby\": labelId,\n role: \"group\",\n },\n rest,\n props,\n )(),\n [ariaDescribedby, dataProps, labelId, rest],\n )\n\n const getInputProps: PropGetter<\"input\"> = useCallback(\n ({ disabled, ...props } = {}) => {\n const checked =\n !isUndefined(value) &&\n (isString(props.value) || isNumber(props.value)) &&\n value.includes(props.value as Y)\n const trulyDisabled = !checked && isNumber(max) && value.length >= max\n\n return mergeProps(\n dataProps,\n ariaProps,\n {\n type: \"checkbox\",\n style: visuallyHiddenAttributes.style,\n \"aria-checked\": checked,\n \"aria-disabled\": ariaAttr(trulyDisabled),\n \"data-checked\": dataAttr(checked),\n \"data-disabled\": dataAttr(trulyDisabled),\n checked,\n disabled: Boolean(disabled || trulyDisabled),\n readOnly,\n required,\n },\n props,\n eventProps,\n { onChange },\n )()\n },\n [\n ariaProps,\n dataProps,\n eventProps,\n max,\n onChange,\n readOnly,\n required,\n value,\n ],\n )\n\n const getLabelProps: PropGetter<\"label\"> = useCallback(\n (props = {}) => mergeProps(dataProps, props)(),\n [dataProps],\n )\n\n return {\n max,\n value,\n getInputProps,\n getLabelProps,\n getRootProps,\n onChange,\n }\n}\n\nexport type UseCheckboxGroupReturn = ReturnType<typeof useCheckboxGroup>\n"],"mappings":";;;;;;;;;AAyBA,MAAM,CAAC,sBAAsB,2BAC3BA,gBAAoC;CAClC,MAAM;CACN,QAAQ;AACV,CAAC;AA0BH,MAAa,oBACX,QAAkC,CAAC,MAChC;CACH,MAAM,EACJ,SAAS,EAAE,YAAY,CAAC,GACxB,OAAO,EACL,eAAe,CAAC,GAChB,UACA,KACA,UACA,UACA,OAAO,WACP,UAAU,cACV,GAAG,QAEL,WAAW,EAAE,oBAAoB,iBAAiB,GAAG,aACrD,WACA,eACE,cAAc,KAAK;CACvB,MAAM,cAAc,EAAE,YAAY;CAClC,MAAM,CAAC,OAAO,YAAY,qBAAqB;EAC7C;EACA,OAAO;EACP,UAAU;CACZ,CAAC;CAED,MAAM,WAAW,aACd,cAAiD;EAChD,IAAI,CAAC,aAAa;EAElB,KAAA,GAAIC,cAAAA,SAAAA,CAAS,SAAS,GAAG,YAAY,UAAU,OAAO;EAEtD,UAAU,SAAS;GACjB,IAAI,KAAK,SAAS,SAAS,GACzB,OAAO,KAAK,QAAQ,cAAc,cAAc,SAAS;QACtD,IAAI,EAAA,GAACC,cAAAA,SAAAA,CAAS,GAAG,KAAK,KAAK,SAAS,KACvC,OAAO,CAAC,GAAG,MAAM,SAAS;QACvB,OAAO;EACd,CAAC;CACH,GACA;EAAC;EAAa;EAAK;CAAQ,CAC7B;CAEA,MAAM,eAA2B,aAC9B,QAAQ,CAAC,MACR,WACE,WACA;EACE,oBAAoB;EACpB,mBAAmB;EACnB,MAAM;CACR,GACA,MACA,KACF,CAAC,CAAC,GACJ;EAAC;EAAiB;EAAW;EAAS;CAAI,CAC5C;CA+CA,OAAO;EACL;EACA;EACA,eAhDyC,aACxC,EAAE,UAAU,GAAG,UAAU,CAAC,MAAM;GAC/B,MAAM,UACJ,EAAA,GAACC,cAAAA,YAAAA,CAAY,KAAK,OAAA,GACjBC,cAAAA,SAAAA,CAAS,MAAM,KAAK,MAAA,GAAKF,cAAAA,SAAAA,CAAS,MAAM,KAAK,MAC9C,MAAM,SAAS,MAAM,KAAU;GACjC,MAAM,gBAAgB,CAAC,YAAA,GAAWA,cAAAA,SAAAA,CAAS,GAAG,KAAK,MAAM,UAAU;GAEnE,OAAO,WACL,WACA,WACA;IACE,MAAM;IACN,OAAO,yBAAyB;IAChC,gBAAgB;IAChB,kBAAA,GAAiBG,cAAAA,SAAAA,CAAS,aAAa;IACvC,iBAAA,GAAgBC,cAAAA,SAAAA,CAAS,OAAO;IAChC,kBAAA,GAAiBA,cAAAA,SAAAA,CAAS,aAAa;IACvC;IACA,UAAU,QAAQ,YAAY,aAAa;IAC3C;IACA;GACF,GACA,OACA,YACA,EAAE,SAAS,CACb,CAAC,CAAC;EACJ,GACA;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,CAWY;EACZ,eATyC,aACxC,QAAQ,CAAC,MAAM,WAAW,WAAW,KAAK,CAAC,CAAC,GAC7C,CAAC,SAAS,CAOE;EACZ;EACA;CACF;AACF"}
@@ -1,6 +1,5 @@
1
1
  "use client";
2
2
  import { visuallyHiddenAttributes } from "../../utils/dom.js";
3
- import { mergeRefs } from "../../utils/ref.js";
4
3
  import { mergeProps } from "../../core/components/props.js";
5
4
  import { useControllableEventState } from "../../hooks/use-controllable-state/index.js";
6
5
  import { utils_exports } from "../../utils/index.js";
@@ -39,8 +38,7 @@ const useCheckbox = ({ "aria-describedby": ariaDescribedbyProp, ...props } = {})
39
38
  setChecked
40
39
  ]);
41
40
  const getRootProps = useCallback((props = {}) => {
42
- const merged = mergeProps({
43
- ...dataProps,
41
+ const merged = mergeProps(dataProps, {
44
42
  "data-checked": (0, utils_exports.dataAttr)(checked),
45
43
  "data-indeterminate": (0, utils_exports.dataAttr)(indeterminate)
46
44
  }, rest, props)();
@@ -53,11 +51,9 @@ const useCheckbox = ({ "aria-describedby": ariaDescribedbyProp, ...props } = {})
53
51
  getLabelProps
54
52
  ]);
55
53
  const getInputProps = useCallback((props = {}) => {
56
- const sharedProps = mergeProps({
57
- ...dataProps,
58
- ...ariaProps,
54
+ const sharedProps = mergeProps({ ref }, dataProps, ariaProps, {
59
55
  id,
60
- ref: mergeRefs(ref, indeterminateRef),
56
+ ref: indeterminateRef,
61
57
  type: "checkbox",
62
58
  name,
63
59
  style: visuallyHiddenAttributes.style,
@@ -74,10 +70,7 @@ const useCheckbox = ({ "aria-describedby": ariaDescribedbyProp, ...props } = {})
74
70
  required,
75
71
  tabIndex,
76
72
  value
77
- }, props, {
78
- ...eventProps,
79
- onChange
80
- })();
73
+ }, props, eventProps, { onChange })();
81
74
  return getGroupInputProps?.(sharedProps) ?? sharedProps;
82
75
  }, [
83
76
  dataProps,
@@ -104,13 +97,11 @@ const useCheckbox = ({ "aria-describedby": ariaDescribedbyProp, ...props } = {})
104
97
  return {
105
98
  checked,
106
99
  indeterminate,
107
- getIndicatorProps: useCallback((props = {}) => ({
108
- ...dataProps,
100
+ getIndicatorProps: useCallback((props = {}) => mergeProps(dataProps, {
109
101
  "aria-hidden": "true",
110
102
  "data-checked": (0, utils_exports.dataAttr)(checked),
111
- "data-indeterminate": (0, utils_exports.dataAttr)(indeterminate),
112
- ...props
113
- }), [
103
+ "data-indeterminate": (0, utils_exports.dataAttr)(indeterminate)
104
+ }, props)(), [
114
105
  dataProps,
115
106
  checked,
116
107
  indeterminate
@@ -1 +1 @@
1
- {"version":3,"file":"use-checkbox.js","names":["isUndefined","isNumber","dataAttr","ariaAttr"],"sources":["../../../../src/components/checkbox/use-checkbox.ts"],"sourcesContent":["\"use client\"\n\nimport type { ChangeEvent, ChangeEventHandler, FocusEventHandler } from \"react\"\nimport type { HTMLProps, HTMLRefAttributes, PropGetter } from \"../../core\"\nimport type { FieldProps } from \"../field\"\nimport { useCallback, useId } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useControllableEventState } from \"../../hooks/use-controllable-state\"\nimport {\n ariaAttr,\n dataAttr,\n isNumber,\n isUndefined,\n mergeRefs,\n visuallyHiddenAttributes,\n} from \"../../utils\"\nimport { useFieldProps } from \"../field\"\nimport { useCheckboxGroupContext } from \"./use-checkbox-group\"\n\nexport interface UseCheckboxProps<Y extends string = string>\n extends\n Omit<HTMLProps<\"label\">, \"onBlur\" | \"onChange\" | \"onFocus\" | \"ref\">,\n HTMLRefAttributes<\"input\">,\n FieldProps {\n /**\n * If `true`, the checkbox will be checked.\n */\n checked?: boolean\n /**\n * If `true`, the checkbox will be initially checked.\n *\n * @default false\n */\n defaultChecked?: boolean\n /**\n * id assigned to input.\n */\n id?: string\n /**\n * If `true`, the checkbox will be indeterminate.\n *\n * @default false\n */\n indeterminate?: boolean\n /**\n * The name of the input field in a checkbox.\n */\n name?: string\n /**\n * The value of the checkbox.\n */\n value?: Y\n /**\n * The callback invoked when the checkbox is blurred.\n */\n onBlur?: FocusEventHandler<HTMLInputElement>\n /**\n * The callback invoked when the checked state changes.\n */\n onChange?: ChangeEventHandler<HTMLInputElement>\n /**\n * The callback invoked when the checkbox is focused.\n */\n onFocus?: FocusEventHandler<HTMLInputElement>\n}\n\nexport const useCheckbox = <Y extends string = string>({\n \"aria-describedby\": ariaDescribedbyProp,\n ...props\n}: UseCheckboxProps<Y> = {}) => {\n const group = useCheckboxGroupContext()\n const {\n max,\n value: groupValue,\n getInputProps: getGroupInputProps,\n getLabelProps,\n } = group ?? {}\n const uuid = useId()\n const {\n props: {\n id,\n ref,\n name,\n \"aria-controls\": ariaControls,\n \"aria-labelledby\": ariaLabelledby,\n checked: checkedProp,\n defaultChecked = false,\n disabled,\n indeterminate = false,\n readOnly,\n required,\n tabIndex,\n value,\n onChange: onChangeProp,\n ...rest\n },\n ariaProps: { \"aria-describedby\": ariaDescribedby, ...ariaProps },\n dataProps,\n eventProps,\n } = useFieldProps({\n id: group ? uuid : undefined,\n ...props,\n notSupportReadOnly: true,\n })\n const resolvedAriaDescribedby = group ? ariaDescribedbyProp : ariaDescribedby\n const resolvedChecked =\n !isUndefined(groupValue) && !isUndefined(value)\n ? groupValue.includes(value)\n : checkedProp\n const [checked, setChecked] = useControllableEventState({\n defaultValue: defaultChecked,\n value: resolvedChecked,\n onChange: onChangeProp,\n })\n const trulyDisabled =\n !checked && isNumber(max) && group && group.value.length >= max\n const interactive = !(readOnly || trulyDisabled)\n const indeterminateRef = useCallback(\n (el: HTMLInputElement | null) => {\n if (el) el.indeterminate = indeterminate\n },\n [indeterminate],\n )\n\n const onChange = useCallback(\n (ev: ChangeEvent<HTMLInputElement>) => {\n if (!interactive) return (ev.defaultPrevented = true)\n\n if (indeterminate) ev.target.checked = true\n\n setChecked(ev)\n },\n [interactive, indeterminate, setChecked],\n )\n\n const getRootProps: PropGetter<\"label\"> = useCallback(\n (props = {}) => {\n const merged = mergeProps(\n {\n ...dataProps,\n \"data-checked\": dataAttr(checked),\n \"data-indeterminate\": dataAttr(indeterminate),\n },\n rest,\n props,\n )()\n\n return getLabelProps?.(merged) ?? merged\n },\n [dataProps, checked, indeterminate, rest, getLabelProps],\n )\n\n const getInputProps: PropGetter<\"input\"> = useCallback(\n (props = {}) => {\n const sharedProps = mergeProps(\n {\n ...dataProps,\n ...ariaProps,\n id,\n ref: mergeRefs(ref, indeterminateRef),\n type: \"checkbox\",\n name,\n style: visuallyHiddenAttributes.style,\n \"aria-checked\": indeterminate ? (\"mixed\" as const) : checked,\n \"aria-controls\": ariaControls,\n \"aria-describedby\": resolvedAriaDescribedby,\n \"aria-disabled\": ariaAttr(!interactive),\n \"aria-labelledby\": ariaLabelledby,\n \"data-checked\": dataAttr(checked),\n \"data-indeterminate\": dataAttr(indeterminate),\n checked,\n disabled,\n readOnly,\n required,\n tabIndex,\n value,\n },\n props,\n { ...eventProps, onChange },\n )()\n\n return getGroupInputProps?.(sharedProps) ?? sharedProps\n },\n [\n dataProps,\n ariaProps,\n id,\n name,\n indeterminate,\n checked,\n ariaControls,\n resolvedAriaDescribedby,\n interactive,\n ariaLabelledby,\n disabled,\n readOnly,\n required,\n tabIndex,\n value,\n ref,\n indeterminateRef,\n eventProps,\n onChange,\n getGroupInputProps,\n ],\n )\n\n const getIndicatorProps: PropGetter = useCallback(\n (props = {}) => ({\n ...dataProps,\n \"aria-hidden\": \"true\",\n \"data-checked\": dataAttr(checked),\n \"data-indeterminate\": dataAttr(indeterminate),\n ...props,\n }),\n [dataProps, checked, indeterminate],\n )\n\n return {\n checked,\n indeterminate,\n getIndicatorProps,\n getInputProps,\n getRootProps,\n onChange,\n }\n}\n\nexport type UseCheckboxReturn = ReturnType<typeof useCheckbox>\n"],"mappings":";;;;;;;;;;AAkEA,MAAa,eAA0C,EACrD,oBAAoB,qBACpB,GAAG,UACoB,CAAC,MAAM;CAC9B,MAAM,QAAQ,wBAAwB;CACtC,MAAM,EACJ,KACA,OAAO,YACP,eAAe,oBACf,kBACE,SAAS,CAAC;CACd,MAAM,OAAO,MAAM;CACnB,MAAM,EACJ,OAAO,EACL,IACA,KACA,MACA,iBAAiB,cACjB,mBAAmB,gBACnB,SAAS,aACT,iBAAiB,OACjB,UACA,gBAAgB,OAChB,UACA,UACA,UACA,OACA,UAAU,cACV,GAAG,QAEL,WAAW,EAAE,oBAAoB,iBAAiB,GAAG,aACrD,WACA,eACE,cAAc;EAChB,IAAI,QAAQ,OAAO,KAAA;EACnB,GAAG;EACH,oBAAoB;CACtB,CAAC;CACD,MAAM,0BAA0B,QAAQ,sBAAsB;CAC9D,MAAM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ChC,uBAAA,GAAsBA,cAAAA,SAAAA,CAAS,aAAa;GAC5C;GACA;GACA;GACA;GACA;GACA;EACF,GACA,OACA;GAAE,GAAG;GAAY;EAAS,CAC5B,CAAC,CAAC;EAEF,OAAO,qBAAqB,WAAW,KAAK;CAC9C,GACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CAaA,OAAO;EACL;EACA;EACA,mBAdoC,aACnC,QAAQ,CAAC,OAAO;GACf,GAAG;GACH,eAAe;GACf,iBAAA,GAAgBA,cAAAA,SAAAA,CAAS,OAAO;GAChC,uBAAA,GAAsBA,cAAAA,SAAAA,CAAS,aAAa;GAC5C,GAAG;EACL,IACA;GAAC;GAAW;GAAS;EAAa,CAMlB;EAChB;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"use-checkbox.js","names":["isUndefined","isNumber","dataAttr","ariaAttr"],"sources":["../../../../src/components/checkbox/use-checkbox.ts"],"sourcesContent":["\"use client\"\n\nimport type { ChangeEvent, ChangeEventHandler, FocusEventHandler } from \"react\"\nimport type { HTMLProps, HTMLRefAttributes, PropGetter } from \"../../core\"\nimport type { FieldProps } from \"../field\"\nimport { useCallback, useId } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useControllableEventState } from \"../../hooks/use-controllable-state\"\nimport {\n ariaAttr,\n dataAttr,\n isNumber,\n isUndefined,\n visuallyHiddenAttributes,\n} from \"../../utils\"\nimport { useFieldProps } from \"../field\"\nimport { useCheckboxGroupContext } from \"./use-checkbox-group\"\n\nexport interface UseCheckboxProps<Y extends string = string>\n extends\n Omit<HTMLProps<\"label\">, \"onBlur\" | \"onChange\" | \"onFocus\" | \"ref\">,\n HTMLRefAttributes<\"input\">,\n FieldProps {\n /**\n * If `true`, the checkbox will be checked.\n */\n checked?: boolean\n /**\n * If `true`, the checkbox will be initially checked.\n *\n * @default false\n */\n defaultChecked?: boolean\n /**\n * id assigned to input.\n */\n id?: string\n /**\n * If `true`, the checkbox will be indeterminate.\n *\n * @default false\n */\n indeterminate?: boolean\n /**\n * The name of the input field in a checkbox.\n */\n name?: string\n /**\n * The value of the checkbox.\n */\n value?: Y\n /**\n * The callback invoked when the checkbox is blurred.\n */\n onBlur?: FocusEventHandler<HTMLInputElement>\n /**\n * The callback invoked when the checked state changes.\n */\n onChange?: ChangeEventHandler<HTMLInputElement>\n /**\n * The callback invoked when the checkbox is focused.\n */\n onFocus?: FocusEventHandler<HTMLInputElement>\n}\n\nexport const useCheckbox = <Y extends string = string>({\n \"aria-describedby\": ariaDescribedbyProp,\n ...props\n}: UseCheckboxProps<Y> = {}) => {\n const group = useCheckboxGroupContext()\n const {\n max,\n value: groupValue,\n getInputProps: getGroupInputProps,\n getLabelProps,\n } = group ?? {}\n const uuid = useId()\n const {\n props: {\n id,\n ref,\n name,\n \"aria-controls\": ariaControls,\n \"aria-labelledby\": ariaLabelledby,\n checked: checkedProp,\n defaultChecked = false,\n disabled,\n indeterminate = false,\n readOnly,\n required,\n tabIndex,\n value,\n onChange: onChangeProp,\n ...rest\n },\n ariaProps: { \"aria-describedby\": ariaDescribedby, ...ariaProps },\n dataProps,\n eventProps,\n } = useFieldProps({\n id: group ? uuid : undefined,\n ...props,\n notSupportReadOnly: true,\n })\n const resolvedAriaDescribedby = group ? ariaDescribedbyProp : ariaDescribedby\n const resolvedChecked =\n !isUndefined(groupValue) && !isUndefined(value)\n ? groupValue.includes(value)\n : checkedProp\n const [checked, setChecked] = useControllableEventState({\n defaultValue: defaultChecked,\n value: resolvedChecked,\n onChange: onChangeProp,\n })\n const trulyDisabled =\n !checked && isNumber(max) && group && group.value.length >= max\n const interactive = !(readOnly || trulyDisabled)\n const indeterminateRef = useCallback(\n (el: HTMLInputElement | null) => {\n if (el) el.indeterminate = indeterminate\n },\n [indeterminate],\n )\n\n const onChange = useCallback(\n (ev: ChangeEvent<HTMLInputElement>) => {\n if (!interactive) return (ev.defaultPrevented = true)\n\n if (indeterminate) ev.target.checked = true\n\n setChecked(ev)\n },\n [interactive, indeterminate, setChecked],\n )\n\n const getRootProps: PropGetter<\"label\"> = useCallback(\n (props = {}) => {\n const merged = mergeProps(\n dataProps,\n {\n \"data-checked\": dataAttr(checked),\n \"data-indeterminate\": dataAttr(indeterminate),\n },\n rest,\n props,\n )()\n\n return getLabelProps?.(merged) ?? merged\n },\n [dataProps, checked, indeterminate, rest, getLabelProps],\n )\n\n const getInputProps: PropGetter<\"input\"> = useCallback(\n (props = {}) => {\n const sharedProps = mergeProps(\n { ref },\n dataProps,\n ariaProps,\n {\n id,\n ref: indeterminateRef,\n type: \"checkbox\",\n name,\n style: visuallyHiddenAttributes.style,\n \"aria-checked\": indeterminate ? (\"mixed\" as const) : checked,\n \"aria-controls\": ariaControls,\n \"aria-describedby\": resolvedAriaDescribedby,\n \"aria-disabled\": ariaAttr(!interactive),\n \"aria-labelledby\": ariaLabelledby,\n \"data-checked\": dataAttr(checked),\n \"data-indeterminate\": dataAttr(indeterminate),\n checked,\n disabled,\n readOnly,\n required,\n tabIndex,\n value,\n },\n props,\n eventProps,\n { onChange },\n )()\n\n return getGroupInputProps?.(sharedProps) ?? sharedProps\n },\n [\n dataProps,\n ariaProps,\n id,\n name,\n indeterminate,\n checked,\n ariaControls,\n resolvedAriaDescribedby,\n interactive,\n ariaLabelledby,\n disabled,\n readOnly,\n required,\n tabIndex,\n value,\n ref,\n indeterminateRef,\n eventProps,\n onChange,\n getGroupInputProps,\n ],\n )\n\n const getIndicatorProps: PropGetter = useCallback(\n (props = {}) =>\n mergeProps(\n dataProps,\n {\n \"aria-hidden\": \"true\",\n \"data-checked\": dataAttr(checked),\n \"data-indeterminate\": dataAttr(indeterminate),\n },\n props,\n )(),\n [dataProps, checked, indeterminate],\n )\n\n return {\n checked,\n indeterminate,\n getIndicatorProps,\n getInputProps,\n getRootProps,\n onChange,\n }\n}\n\nexport type UseCheckboxReturn = ReturnType<typeof useCheckbox>\n"],"mapp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,CAAS,OAAO;GAChC,uBAAA,GAAsBA,cAAAA,SAAAA,CAAS,aAAa;EAC9C,GACA,MACA,KACF,CAAC,CAAC;EAEF,OAAO,gBAAgB,MAAM,KAAK;CACpC,GACA;EAAC;EAAW;EAAS;EAAe;EAAM;CAAa,CACzD;CAEA,MAAM,gBAAqC,aACxC,QAAQ,CAAC,MAAM;EACd,MAAM,cAAc,WAClB,EAAE,IAAI,GACN,WACA,WACA;GACE;GACA,KAAK;GACL,MAAM;GACN;GACA,OAAO,yBAAyB;GAChC,gBAAgB,gBAAiB,UAAoB;GACrD,iBAAiB;GACjB,oBAAoB;GACpB,kBAAA,GAAiBC,cAAAA,SAAAA,CAAS,CAAC,WAAW;GACtC,mBAAmB;GACnB,iBAAA,GAAgBD,cAAAA,SAAAA,CAAS,OAAO;GAChC,uBAAA,GAAsBA,cAAAA,SAAAA,CAAS,aAAa;GAC5C;GACA;GACA;GACA;GACA;GACA;EACF,GACA,OACA,YACA,EAAE,SAAS,CACb,CAAC,CAAC;EAEF,OAAO,qBAAqB,WAAW,KAAK;CAC9C,GACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CAgBA,OAAO;EACL;EACA;EACA,mBAjBoC,aACnC,QAAQ,CAAC,MACR,WACE,WACA;GACE,eAAe;GACf,iBAAA,GAAgBA,cAAAA,SAAAA,CAAS,OAAO;GAChC,uBAAA,GAAsBA,cAAAA,SAAAA,CAAS,aAAa;EAC9C,GACA,KACF,CAAC,CAAC,GACJ;GAAC;GAAW;GAAS;EAAa,CAMlB;EAChB;EACA;EACA;CACF;AACF"}
@@ -138,9 +138,9 @@ const useColorPicker = (props) => {
138
138
  onFieldFocus,
139
139
  onMouseDown
140
140
  ]);
141
- const getInputProps = useCallback((props = {}) => mergeProps({
141
+ const getInputProps = useCallback((props = {}) => mergeProps(dataProps, {
142
142
  id,
143
- ref: mergeRefs(ref, inputRef),
143
+ ref,
144
144
  name,
145
145
  style: !allowInput ? { pointerEvents: "none" } : {},
146
146
  "aria-label": ariaLabel,
@@ -151,9 +151,9 @@ const useColorPicker = (props) => {
151
151
  readOnly,
152
152
  required,
153
153
  tabIndex: allowInput ? 0 : -1,
154
- value,
155
- ...dataProps
154
+ value
156
155
  }, props, {
156
+ ref: inputRef,
157
157
  onBlur,
158
158
  onChange: onInputChange,
159
159
  onFocus: onInputFocus,
@@ -1 +1 @@
1
- {"version":3,"file":"use-color-picker.js","names":["calcFormat","contains","convertColor","runIfFn","focusTransfer","handlerAll","ariaAttr"],"sources":["../../../../src/components/color-picker/use-color-picker.ts"],"sourcesContent":["\"use client\"\n\nimport type { ChangeEvent, FocusEvent, MouseEvent } from \"react\"\nimport type { HTMLRefAttributes, PropGetter } from \"../../core\"\nimport type { UseComboboxProps } from \"../../hooks/use-combobox\"\nimport type { ColorFormat } from \"../../utils\"\nimport type { UseColorSelectorProps } from \"../color-selector\"\nimport type { FieldProps } from \"../field\"\nimport { useCallback, useEffect, useRef } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useCombobox } from \"../../hooks/use-combobox\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { useEyeDropper } from \"../../hooks/use-eye-dropper\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport {\n ariaAttr,\n calcFormat,\n contains,\n convertColor,\n focusTransfer,\n handlerAll,\n mergeRefs,\n runIfFn,\n runKeyAction,\n} from \"../../utils\"\nimport { useFieldProps } from \"../field\"\n\nexport interface UseColorPickerProps\n extends\n Omit<\n UseComboboxProps,\n | \"closeOnSelect\"\n | \"initialFocusValue\"\n | \"onChange\"\n | \"ref\"\n | \"selectFocusRef\"\n | \"selectOnSpace\"\n >,\n HTMLRefAttributes<\"input\">,\n FieldProps {\n /**\n * If `true`, allows input.\n *\n * @default true\n */\n allowInput?: boolean\n /**\n * If `true`, the color picker will be closed when the input value changes.\n *\n * @default false\n */\n closeOnChange?: ((ev: ChangeEvent<HTMLInputElement>) => boolean) | boolean\n /**\n * The initial value of the color picker.\n */\n defaultValue?: string\n /**\n * The fallback value of the color picker.\n *\n * @default '#FFFFFF'\n */\n fallbackValue?: string\n /**\n * The format of the color picker.\n * Automatically determines the format of `value` or `defaultValue`.\n *\n * @default 'hex'\n */\n format?: ColorFormat\n /**\n * The `id` attribute of the input element.\n */\n id?: string\n /**\n * The `name` attribute of the input element.\n */\n name?: string\n /**\n * If `true`, the color picker will be opened when the input value changes.\n *\n * @default true\n */\n openOnChange?: ((ev: ChangeEvent<HTMLInputElement>) => boolean) | boolean\n /**\n * If `true`, the color picker will be opened when the input is focused.\n *\n * @default false\n */\n openOnFocus?: boolean\n /**\n * The pattern used to check the input element.\n */\n pattern?: RegExp\n /**\n * The placeholder for color picker.\n */\n placeholder?: string\n /**\n * The value of the color picker.\n */\n value?: string\n /**\n * The function to format the input value.\n */\n formatInput?: (value: string) => string\n /**\n * The callback invoked when the value changes.\n */\n onChange?: (value: string) => void\n /**\n * The callback invoked when input value state changes.\n */\n onInputChange?: (ev: ChangeEvent<HTMLInputElement>) => void\n}\n\nexport const useColorPicker = (props: UseColorPickerProps) => {\n const { t } = useI18n(\"colorPicker\")\n const {\n props: {\n id,\n ref,\n name,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledby,\n allowInput = true,\n closeOnChange = false,\n defaultValue,\n disabled,\n fallbackValue = \"#FFFFFF\",\n format: formatProp,\n formatInput,\n openOnChange = true,\n openOnClick = true,\n openOnFocus = true,\n pattern,\n placeholder,\n placement = \"end-start\",\n readOnly,\n required,\n value: valueProp,\n onChange: onChangeProp,\n onInputChange: onInputChangeProp,\n ...rest\n },\n ariaProps,\n dataProps,\n eventProps,\n } = useFieldProps(props)\n const {\n interactive,\n open,\n getContentProps: getComboboxContentProps,\n getTriggerProps,\n popoverProps,\n onClose,\n onOpen,\n } = useCombobox({\n disabled,\n matchWidth: false,\n openOnClick: false,\n openOnEnter: !allowInput,\n openOnSpace: !allowInput,\n placement,\n readOnly,\n transferFocus: false,\n ...ariaProps,\n ...dataProps,\n ...eventProps,\n ...rest,\n })\n const format =\n formatProp ?? calcFormat(valueProp ?? defaultValue ?? fallbackValue)\n const alpha = format.endsWith(\"a\")\n const fieldRef = useRef<HTMLDivElement>(null)\n const contentRef = useRef<HTMLDivElement>(null)\n const inputRef = useRef<HTMLInputElement>(null)\n const focusByClickRef = useRef<boolean>(false)\n const [value, setValue] = useControllableState({\n defaultValue,\n value: valueProp,\n onChange: onChangeProp,\n })\n const { supported: supportedEyeDropper, onOpen: onOpenEyeDropper } =\n useEyeDropper()\n\n const onClick = useCallback(() => {\n if (!interactive) return\n\n focusByClickRef.current = true\n\n if (allowInput) inputRef.current?.focus()\n\n if (openOnClick) onOpen()\n }, [allowInput, interactive, onOpen, openOnClick])\n\n const onMouseDown = useCallback(\n (ev: MouseEvent<HTMLDivElement | HTMLInputElement>) => {\n if (!openOnFocus) return\n\n ev.preventDefault()\n ev.stopPropagation()\n },\n [openOnFocus],\n )\n\n const onFieldFocus = useCallback(() => {\n if (allowInput) return\n\n if (openOnFocus) onOpen()\n\n focusByClickRef.current = false\n }, [allowInput, onOpen, openOnFocus])\n\n const onInputFocus = useCallback(\n (ev: FocusEvent<HTMLInputElement>) => {\n ev.preventDefault()\n ev.stopPropagation()\n\n if (openOnFocus && !focusByClickRef.current) onOpen()\n\n focusByClickRef.current = false\n },\n [onOpen, openOnFocus],\n )\n\n const onBlur = useCallback(\n (ev: FocusEvent<HTMLInputElement>) => {\n if (\n contains(fieldRef.current, ev.relatedTarget) ||\n contains(contentRef.current, ev.relatedTarget)\n )\n ev.preventDefault()\n else\n setValue((prev) => {\n if (!prev) return prev\n\n let value = convertColor(prev)(format)\n\n if (!value) return prev\n\n if (formatInput) value = formatInput(value)\n\n if (pattern) value = value.replace(pattern, \"\")\n\n return value\n })\n },\n [format, formatInput, pattern, setValue],\n )\n\n const onInputChange = useCallback(\n (ev: ChangeEvent<HTMLInputElement>) => {\n if (!allowInput) return\n\n onInputChangeProp?.(ev)\n\n if (runIfFn(closeOnChange, ev)) onClose()\n else if (runIfFn(openOnChange, ev)) onOpen()\n\n let inputValue = ev.target.value\n\n if (formatInput) inputValue = formatInput(inputValue)\n\n if (pattern) inputValue = inputValue.replace(pattern, \"\")\n\n setValue(inputValue)\n },\n [\n allowInput,\n closeOnChange,\n formatInput,\n onClose,\n onInputChangeProp,\n onOpen,\n openOnChange,\n pattern,\n setValue,\n ],\n )\n\n const onEyeDropperClick = useCallback(async () => {\n if (!interactive) return\n\n const result = await onOpenEyeDropper()\n\n if (result?.sRGBHex) setValue(result.sRGBHex)\n }, [interactive, onOpenEyeDropper, setValue])\n\n useEffect(() => {\n if (!open) return\n\n return focusTransfer(\n contentRef.current,\n allowInput ? inputRef.current : fieldRef.current,\n )\n }, [allowInput, open])\n\n const getRootProps: PropGetter = useCallback(\n (props) => ({\n ...dataProps,\n ...props,\n }),\n [dataProps],\n )\n\n const getFieldProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) =>\n getTriggerProps({\n ref: mergeRefs(ref, fieldRef),\n \"aria-haspopup\": \"dialog\",\n tabIndex: !allowInput ? 0 : -1,\n ...props,\n onClick: handlerAll(props.onClick, onClick),\n onFocus: handlerAll(props.onFocus, onFieldFocus),\n onMouseDown: handlerAll(props.onMouseDown, onMouseDown),\n }),\n\n [allowInput, getTriggerProps, onClick, onFieldFocus, onMouseDown],\n )\n\n const getInputProps: PropGetter<\"input\"> = useCallback(\n (props = {}) =>\n mergeProps(\n {\n id,\n ref: mergeRefs(ref, inputRef),\n name,\n style: !allowInput ? { pointerEvents: \"none\" } : {},\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledby,\n autoComplete: \"off\",\n disabled,\n placeholder,\n readOnly,\n required,\n tabIndex: allowInput ? 0 : -1,\n value,\n ...dataProps,\n },\n props,\n { onBlur, onChange: onInputChange, onFocus: onInputFocus, onMouseDown },\n )(),\n [\n allowInput,\n ariaLabel,\n ariaLabelledby,\n dataProps,\n disabled,\n id,\n name,\n onBlur,\n onInputChange,\n onInputFocus,\n onMouseDown,\n placeholder,\n readOnly,\n ref,\n required,\n value,\n ],\n )\n\n const getEyeDropperProps: PropGetter = useCallback(\n (props = {}) => ({\n ...dataProps,\n \"aria-disabled\": ariaAttr(!interactive),\n \"aria-label\": t(\"Pick a color\"),\n hidden: !supportedEyeDropper,\n role: \"button\",\n tabIndex: interactive ? 0 : -1,\n ...props,\n onClick: handlerAll(props.onClick, onEyeDropperClick),\n onKeyDown: handlerAll(props.onKeyDown, (ev) =>\n runKeyAction(ev, {\n Enter: onEyeDropperClick,\n Space: onEyeDropperClick,\n }),\n ),\n }),\n [dataProps, interactive, onEyeDropperClick, supportedEyeDropper, t],\n )\n\n const getContentProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) =>\n getComboboxContentProps({\n ref: mergeRefs(ref, contentRef),\n role: \"dialog\",\n ...props,\n }),\n [getComboboxContentProps],\n )\n\n const getSelectorProps: PropGetter<UseColorSelectorProps> = useCallback(\n (props = {}) => ({\n disabled,\n fallbackValue,\n format,\n readOnly,\n value,\n ...props,\n onChange: handlerAll(props.onChange, setValue),\n }),\n [disabled, fallbackValue, format, readOnly, value, setValue],\n )\n\n return {\n alpha,\n format,\n interactive,\n open,\n setValue,\n value,\n getContentProps,\n getEyeDropperProps,\n getFieldProps,\n getInputProps,\n getRootProps,\n getSelectorProps,\n popoverProps,\n onClose,\n onOpen,\n }\n}\n\nexport type UseColorPickerReturn = ReturnType<typeof useColorPicker>\n"],"mappings":";;;;;;;;;;;;AAmHA,MAAa,kBAAkB,UAA+B;CAC5D,MAAM,EAAE,MAAM,QAAQ,aAAa;CACnC,MAAM,EACJ,OAAO,EACL,IACA,KACA,MACA,cAAc,WACd,mBAAmB,gBACnB,aAAa,MACb,gBAAgB,OAChB,cACA,UACA,gBAAgB,WAChB,QAAQ,YACR,aACA,eAAe,MACf,cAAc,MACd,cAAc,MACd,SACA,aACA,Y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CAAW,MAAM,YAAY,OACtC,aAAa,IAAI;GACf,OAAO;GACP,OAAO;EACT,CAAC,CACH;CACF,IACA;EAAC;EAAW;EAAa;EAAmB;EAAqB;CAAC,CACpE;CAyBA,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA,iBA9BkC,aACjC,EAAE,KAAK,GAAG,UAAU,CAAC,MACpB,wBAAwB;GACtB,KAAK,UAAU,KAAK,UAAU;GAC9B,MAAM;GACN,GAAG;EACL,CAAC,GACH,CAAC,uBAAuB,CAuBV;EACd;EACA;EACA;EACA;EACA,kBAzB0D,aACzD,QAAQ,CAAC,OAAO;GACf;GACA;GACA;GACA;GACA;GACA,GAAG;GACH,WAAA,GAAUA,cAAAA,WAAAA,CAAW,MAAM,UAAU,QAAQ;EAC/C,IACA;GAAC;GAAU;GAAe;GAAQ;GAAU;GAAO;EAAQ,CAe5C;EACf;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"use-color-picker.js","names":["calcFormat","contains","convertColor","runIfFn","focusTransfer","handlerAll","ariaAttr"],"sources":["../../../../src/components/color-picker/use-color-picker.ts"],"sourcesContent":["\"use client\"\n\nimport type { ChangeEvent, FocusEvent, MouseEvent } from \"react\"\nimport type { HTMLRefAttributes, PropGetter } from \"../../core\"\nimport type { UseComboboxProps } from \"../../hooks/use-combobox\"\nimport type { ColorFormat } from \"../../utils\"\nimport type { UseColorSelectorProps } from \"../color-selector\"\nimport type { FieldProps } from \"../field\"\nimport { useCallback, useEffect, useRef } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useCombobox } from \"../../hooks/use-combobox\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { useEyeDropper } from \"../../hooks/use-eye-dropper\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport {\n ariaAttr,\n calcFormat,\n contains,\n convertColor,\n focusTransfer,\n handlerAll,\n mergeRefs,\n runIfFn,\n runKeyAction,\n} from \"../../utils\"\nimport { useFieldProps } from \"../field\"\n\nexport interface UseColorPickerProps\n extends\n Omit<\n UseComboboxProps,\n | \"closeOnSelect\"\n | \"initialFocusValue\"\n | \"onChange\"\n | \"ref\"\n | \"selectFocusRef\"\n | \"selectOnSpace\"\n >,\n HTMLRefAttributes<\"input\">,\n FieldProps {\n /**\n * If `true`, allows input.\n *\n * @default true\n */\n allowInput?: boolean\n /**\n * If `true`, the color picker will be closed when the input value changes.\n *\n * @default false\n */\n closeOnChange?: ((ev: ChangeEvent<HTMLInputElement>) => boolean) | boolean\n /**\n * The initial value of the color picker.\n */\n defaultValue?: string\n /**\n * The fallback value of the color picker.\n *\n * @default '#FFFFFF'\n */\n fallbackValue?: string\n /**\n * The format of the color picker.\n * Automatically determines the format of `value` or `defaultValue`.\n *\n * @default 'hex'\n */\n format?: ColorFormat\n /**\n * The `id` attribute of the input element.\n */\n id?: string\n /**\n * The `name` attribute of the input element.\n */\n name?: string\n /**\n * If `true`, the color picker will be opened when the input value changes.\n *\n * @default true\n */\n openOnChange?: ((ev: ChangeEvent<HTMLInputElement>) => boolean) | boolean\n /**\n * If `true`, the color picker will be opened when the input is focused.\n *\n * @default false\n */\n openOnFocus?: boolean\n /**\n * The pattern used to check the input element.\n */\n pattern?: RegExp\n /**\n * The placeholder for color picker.\n */\n placeholder?: string\n /**\n * The value of the color picker.\n */\n value?: string\n /**\n * The function to format the input value.\n */\n formatInput?: (value: string) => string\n /**\n * The callback invoked when the value changes.\n */\n onChange?: (value: string) => void\n /**\n * The callback invoked when input value state changes.\n */\n onInputChange?: (ev: ChangeEvent<HTMLInputElement>) => void\n}\n\nexport const useColorPicker = (props: UseColorPickerProps) => {\n const { t } = useI18n(\"colorPicker\")\n const {\n props: {\n id,\n ref,\n name,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledby,\n allowInput = true,\n closeOnChange = false,\n defaultValue,\n disabled,\n fallbackValue = \"#FFFFFF\",\n format: formatProp,\n formatInput,\n openOnChange = true,\n openOnClick = true,\n openOnFocus = true,\n pattern,\n placeholder,\n placement = \"end-start\",\n readOnly,\n required,\n value: valueProp,\n onChange: onChangeProp,\n onInputChange: onInputChangeProp,\n ...rest\n },\n ariaProps,\n dataProps,\n eventProps,\n } = useFieldProps(props)\n const {\n interactive,\n open,\n getContentProps: getComboboxContentProps,\n getTriggerProps,\n popoverProps,\n onClose,\n onOpen,\n } = useCombobox({\n disabled,\n matchWidth: false,\n openOnClick: false,\n openOnEnter: !allowInput,\n openOnSpace: !allowInput,\n placement,\n readOnly,\n transferFocus: false,\n ...ariaProps,\n ...dataProps,\n ...eventProps,\n ...rest,\n })\n const format =\n formatProp ?? calcFormat(valueProp ?? defaultValue ?? fallbackValue)\n const alpha = format.endsWith(\"a\")\n const fieldRef = useRef<HTMLDivElement>(null)\n const contentRef = useRef<HTMLDivElement>(null)\n const inputRef = useRef<HTMLInputElement>(null)\n const focusByClickRef = useRef<boolean>(false)\n const [value, setValue] = useControllableState({\n defaultValue,\n value: valueProp,\n onChange: onChangeProp,\n })\n const { supported: supportedEyeDropper, onOpen: onOpenEyeDropper } =\n useEyeDropper()\n\n const onClick = useCallback(() => {\n if (!interactive) return\n\n focusByClickRef.current = true\n\n if (allowInput) inputRef.current?.focus()\n\n if (openOnClick) onOpen()\n }, [allowInput, interactive, onOpen, openOnClick])\n\n const onMouseDown = useCallback(\n (ev: MouseEvent<HTMLDivElement | HTMLInputElement>) => {\n if (!openOnFocus) return\n\n ev.preventDefault()\n ev.stopPropagation()\n },\n [openOnFocus],\n )\n\n const onFieldFocus = useCallback(() => {\n if (allowInput) return\n\n if (openOnFocus) onOpen()\n\n focusByClickRef.current = false\n }, [allowInput, onOpen, openOnFocus])\n\n const onInputFocus = useCallback(\n (ev: FocusEvent<HTMLInputElement>) => {\n ev.preventDefault()\n ev.stopPropagation()\n\n if (openOnFocus && !focusByClickRef.current) onOpen()\n\n focusByClickRef.current = false\n },\n [onOpen, openOnFocus],\n )\n\n const onBlur = useCallback(\n (ev: FocusEvent<HTMLInputElement>) => {\n if (\n contains(fieldRef.current, ev.relatedTarget) ||\n contains(contentRef.current, ev.relatedTarget)\n )\n ev.preventDefault()\n else\n setValue((prev) => {\n if (!prev) return prev\n\n let value = convertColor(prev)(format)\n\n if (!value) return prev\n\n if (formatInput) value = formatInput(value)\n\n if (pattern) value = value.replace(pattern, \"\")\n\n return value\n })\n },\n [format, formatInput, pattern, setValue],\n )\n\n const onInputChange = useCallback(\n (ev: ChangeEvent<HTMLInputElement>) => {\n if (!allowInput) return\n\n onInputChangeProp?.(ev)\n\n if (runIfFn(closeOnChange, ev)) onClose()\n else if (runIfFn(openOnChange, ev)) onOpen()\n\n let inputValue = ev.target.value\n\n if (formatInput) inputValue = formatInput(inputValue)\n\n if (pattern) inputValue = inputValue.replace(pattern, \"\")\n\n setValue(inputValue)\n },\n [\n allowInput,\n closeOnChange,\n formatInput,\n onClose,\n onInputChangeProp,\n onOpen,\n openOnChange,\n pattern,\n setValue,\n ],\n )\n\n const onEyeDropperClick = useCallback(async () => {\n if (!interactive) return\n\n const result = await onOpenEyeDropper()\n\n if (result?.sRGBHex) setValue(result.sRGBHex)\n }, [interactive, onOpenEyeDropper, setValue])\n\n useEffect(() => {\n if (!open) return\n\n return focusTransfer(\n contentRef.current,\n allowInput ? inputRef.current : fieldRef.current,\n )\n }, [allowInput, open])\n\n const getRootProps: PropGetter = useCallback(\n (props) => ({\n ...dataProps,\n ...props,\n }),\n [dataProps],\n )\n\n const getFieldProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) =>\n getTriggerProps({\n ref: mergeRefs(ref, fieldRef),\n \"aria-haspopup\": \"dialog\",\n tabIndex: !allowInput ? 0 : -1,\n ...props,\n onClick: handlerAll(props.onClick, onClick),\n onFocus: handlerAll(props.onFocus, onFieldFocus),\n onMouseDown: handlerAll(props.onMouseDown, onMouseDown),\n }),\n\n [allowInput, getTriggerProps, onClick, onFieldFocus, onMouseDown],\n )\n\n const getInputProps: PropGetter<\"input\"> = useCallback(\n (props = {}) =>\n mergeProps(\n dataProps,\n {\n id,\n ref,\n name,\n style: !allowInput ? { pointerEvents: \"none\" } : {},\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledby,\n autoComplete: \"off\",\n disabled,\n placeholder,\n readOnly,\n required,\n tabIndex: allowInput ? 0 : -1,\n value,\n },\n props,\n {\n ref: inputRef,\n onBlur,\n onChange: onInputChange,\n onFocus: onInputFocus,\n onMouseDown,\n },\n )(),\n [\n allowInput,\n ariaLabel,\n ariaLabelledby,\n dataProps,\n disabled,\n id,\n name,\n onBlur,\n onInputChange,\n onInputFocus,\n onMouseDown,\n placeholder,\n readOnly,\n ref,\n required,\n value,\n ],\n )\n\n const getEyeDropperProps: PropGetter = useCallback(\n (props = {}) => ({\n ...dataProps,\n \"aria-disabled\": ariaAttr(!interactive),\n \"aria-label\": t(\"Pick a color\"),\n hidden: !supportedEyeDropper,\n role: \"button\",\n tabIndex: interactive ? 0 : -1,\n ...props,\n onClick: handlerAll(props.onClick, onEyeDropperClick),\n onKeyDown: handlerAll(props.onKeyDown, (ev) =>\n runKeyAction(ev, {\n Enter: onEyeDropperClick,\n Space: onEyeDropperClick,\n }),\n ),\n }),\n [dataProps, interactive, onEyeDropperClick, supportedEyeDropper, t],\n )\n\n const getContentProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) =>\n getComboboxContentProps({\n ref: mergeRefs(ref, contentRef),\n role: \"dialog\",\n ...props,\n }),\n [getComboboxContentProps],\n )\n\n const getSelectorProps: PropGetter<UseColorSelectorProps> = useCallback(\n (props = {}) => ({\n disabled,\n fallbackValue,\n format,\n readOnly,\n value,\n ...props,\n onChange: handlerAll(props.onChange, setValue),\n }),\n [disabled, fallbackValue, format, readOnly, value, setValue],\n )\n\n return {\n alpha,\n format,\n interactive,\n open,\n setValue,\n value,\n getContentProps,\n getEyeDropperProps,\n getFieldProps,\n getInputProps,\n getRootProps,\n getSelectorProps,\n popoverProps,\n onClose,\n onOpen,\n }\n}\n\nexport type UseColorPickerReturn = ReturnType<typeof useColorPic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,GAAG;EACH,kBAAA,GAAiBC,cAAAA,SAAAA,CAAS,CAAC,WAAW;EACtC,cAAc,EAAE,cAAc;EAC9B,QAAQ,CAAC;EACT,MAAM;EACN,UAAU,cAAc,IAAI;EAC5B,GAAG;EACH,UAAA,GAASD,cAAAA,WAAAA,CAAW,MAAM,SAAS,iBAAiB;EACpD,YAAA,GAAWA,cAAAA,WAAAA,CAAW,MAAM,YAAY,OACtC,aAAa,IAAI;GACf,OAAO;GACP,OAAO;EACT,CAAC,CACH;CACF,IACA;EAAC;EAAW;EAAa;EAAmB;EAAqB;CAAC,CACpE;CAyBA,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA,iBA9BkC,aACjC,EAAE,KAAK,GAAG,UAAU,CAAC,MACpB,wBAAwB;GACtB,KAAK,UAAU,KAAK,UAAU;GAC9B,MAAM;GACN,GAAG;EACL,CAAC,GACH,CAAC,uBAAuB,CAuBV;EACd;EACA;EACA;EACA;EACA,kBAzB0D,aACzD,QAAQ,CAAC,OAAO;GACf;GACA;GACA;GACA;GACA;GACA,GAAG;GACH,WAAA,GAAUA,cAAAA,WAAAA,CAAW,MAAM,UAAU,QAAQ;EAC/C,IACA;GAAC;GAAU;GAAe;GAAQ;GAAU;GAAO;EAAQ,CAe5C;EACf;EACA;EACA;CACF;AACF"}
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.type.js";
2
2
  import { CSSModifierObject, CSSPropObject, CSSSlotObject } from "../../core/css/index.type.js";
3
3
  import "../../index.js";
4
- export declare const accordionStyle: ComponentSlotStyle<"button" | "panel" | "icon" | "root" | "item", CSSPropObject<CSSSlotObject<"button" | "panel" | "icon" | "root" | "item">>, CSSModifierObject<CSSSlotObject<"button" | "panel" | "icon" | "root" | "item">>, {
4
+ export 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.type.js";
2
2
  import { CSSPropObject, CSSSlotObject } from "../../core/css/index.type.js";
3
3
  import "../../index.js";
4
- export declare const autocompleteStyle: ComponentSlotStyle<"input" | "label" | "option" | "content" | "group" | "separator" | "icon" | "root" | "empty" | "indicator" | "field" | "valueText", CSSPropObject<CSSSlotObject<"input" | "label" | "option" | "content" | "group" | "separator" | "icon" | "root" | "empty" | "indicator" | "field" | "valueText">>, {
4
+ export declare const autocompleteStyle: ComponentSlotStyle<"input" | "label" | "option" | "content" | "group" | "separator" | "icon" | "root" | "field" | "empty" | "indicator" | "valueText", CSSPropObject<CSSSlotObject<"input" | "label" | "option" | "content" | "group" | "separator" | "icon" | "root" | "field" | "empty" | "indicator" | "valueText">>, {
5
5
  xs: {
6
6
  empty: {
7
7
  gap: "1.5";
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.type.js";
2
2
  import { CSSPropObject, CSSSlotObject } from "../../core/css/index.type.js";
3
3
  import "../../index.js";
4
- export declare const breadcrumbStyle: ComponentSlotStyle<"link" | "list" | "separator" | "ellipsis" | "root" | "item", CSSPropObject<CSSSlotObject<"link" | "list" | "separator" | "ellipsis" | "root" | "item">>, {
4
+ export 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.type.js";
2
2
  import { CSSPropObject, CSSSlotObject } from "../../core/css/index.type.js";
3
3
  import "../../index.js";
4
- export declare const bubbleStyle: ComponentSlotStyle<"content" | "group" | "root" | "item" | "reactions", CSSPropObject<CSSSlotObject<"content" | "group" | "root" | "item" | "reactions">>, {
4
+ export declare const bubbleStyle: ComponentSlotStyle<"content" | "group" | "item" | "root" | "reactions", CSSPropObject<CSSSlotObject<"content" | "group" | "item" | "root" | "reactions">>, {
5
5
  sm: {
6
6
  content: {
7
7
  "--space-y": "spaces.2";
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.type.js";
2
2
  import { CSSModifierObject, CSSSlotObject } from "../../core/css/index.type.js";
3
3
  import "../../index.js";
4
- export declare const calendarStyle: ComponentSlotStyle<"button" | "select" | "cell" | "navigation" | "row" | "separator" | "next" | "prev" | "root" | "month" | "week" | "day" | "months" | "years" | "weeks" | "weekday" | "control", {
4
+ export declare const calendarStyle: ComponentSlotStyle<"button" | "select" | "cell" | "navigation" | "row" | "separator" | "next" | "prev" | "root" | "month" | "week" | "weekday" | "day" | "months" | "years" | "weeks" | "control", {
5
5
  /**
6
6
  * If `true`, the calendar will be fixed rows.
7
7
  *
@@ -73,5 +73,5 @@ export declare const calendarStyle: ComponentSlotStyle<"button" | "select" | "ce
73
73
  "--font-size": "fontSizes.xl";
74
74
  };
75
75
  };
76
- }, CSSModifierObject<CSSSlotObject<"button" | "select" | "cell" | "navigation" | "row" | "separator" | "next" | "prev" | "root" | "month" | "week" | "day" | "months" | "years" | "weeks" | "weekday" | "control">>>;
76
+ }, CSSModifierObject<CSSSlotObject<"button" | "select" | "cell" | "navigation" | "row" | "separator" | "next" | "prev" | "root" | "month" | "week" | "weekday" | "day" | "months" | "years" | "weeks" | "control">>>;
77
77
  export type CalendarStyle = typeof calendarStyle;
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.type.js";
2
2
  import { CSSModifierObject, CSSPropObject, CSSSlotObject } from "../../core/css/index.type.js";
3
3
  import "../../index.js";
4
- export declare const carouselStyle: ComponentSlotStyle<"list" | "next" | "prev" | "root" | "trigger" | "item" | "indicator" | "indicators", CSSPropObject<CSSSlotObject<"list" | "next" | "prev" | "root" | "trigger" | "item" | "indicator" | "indicators">>, {
4
+ export declare const carouselStyle: ComponentSlotStyle<"list" | "next" | "prev" | "item" | "root" | "indicator" | "trigger" | "indicators", CSSPropObject<CSSSlotObject<"list" | "next" | "prev" | "item" | "root" | "indicator" | "trigger" | "indicators">>, {
5
5
  sm: {
6
6
  root: {
7
7
  h: "sm";
@@ -17,5 +17,5 @@ export declare const carouselStyle: ComponentSlotStyle<"list" | "next" | "prev"
17
17
  h: "lg";
18
18
  };
19
19
  };
20
- }, CSSModifierObject<CSSSlotObject<"list" | "next" | "prev" | "root" | "trigger" | "item" | "indicator" | "indicators">>>;
20
+ }, CSSModifierObject<CSSSlotObject<"list" | "next" | "prev" | "item" | "root" | "indicator" | "trigger" | "indicators">>>;
21
21
  export type CarouselStyle = typeof carouselStyle;
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.type.js";
2
2
  import { CSSPropObject, CSSSlotObject } from "../../core/css/index.type.js";
3
3
  import "../../index.js";
4
- export declare const colorPickerStyle: ComponentSlotStyle<"input" | "content" | "icon" | "colorSwatch" | "root" | "field" | "eyeDropper", CSSPropObject<CSSSlotObject<"input" | "content" | "icon" | "colorSwatch" | "root" | "field" | "eyeDropper">>, {
4
+ export declare const colorPickerStyle: ComponentSlotStyle<"input" | "content" | "icon" | "root" | "eyeDropper" | "field" | "colorSwatch", CSSPropObject<CSSSlotObject<"input" | "content" | "icon" | "root" | "eyeDropper" | "field" | "colorSwatch">>, {
5
5
  xs: {
6
6
  field: {
7
7
  fontSize: "1em";
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.type.js";
2
2
  import { CSSModifierObject, CSSSlotObject } from "../../core/css/index.type.js";
3
3
  import "../../index.js";
4
- export declare const colorSelectorStyle: ComponentSlotStyle<"hueSlider" | "saturationSlider" | "root" | "eyeDropper" | "colorSwatchGroupLabel" | "alphaSlider" | "colorSwatchGroup" | "colorSwatchItem", {
4
+ export declare const colorSelectorStyle: ComponentSlotStyle<"root" | "eyeDropper" | "colorSwatchGroupLabel" | "alphaSlider" | "colorSwatchGroup" | "colorSwatchItem" | "hueSlider" | "saturationSlider", {
5
5
  /**
6
6
  * The shape of the thumb and color swatch.
7
7
  *
@@ -22,5 +22,5 @@ export declare const colorSelectorStyle: ComponentSlotStyle<"hueSlider" | "satur
22
22
  md: {};
23
23
  lg: {};
24
24
  xl: {};
25
- }, CSSModifierObject<CSSSlotObject<"hueSlider" | "saturationSlider" | "root" | "eyeDropper" | "colorSwatchGroupLabel" | "alphaSlider" | "colorSwatchGroup" | "colorSwatchItem">>>;
25
+ }, CSSModifierObject<CSSSlotObject<"root" | "eyeDropper" | "colorSwatchGroupLabel" | "alphaSlider" | "colorSwatchGroup" | "colorSwatchItem" | "hueSlider" | "saturationSlider">>>;
26
26
  export type ColorSelectorStyle = typeof colorSelectorStyle;
@@ -1,6 +1,6 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.type.js";
2
2
  import "../../index.js";
3
- export declare const dataListStyle: ComponentSlotStyle<"term" | "root" | "item" | "description", {
3
+ export declare const dataListStyle: ComponentSlotStyle<"term" | "item" | "root" | "description", {
4
4
  /**
5
5
  * The orientation of the data list.
6
6
  *
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.type.js";
2
2
  import { CSSModifierObject, CSSSlotObject } from "../../core/css/index.type.js";
3
3
  import "../../index.js";
4
- export declare const drawerStyle: ComponentSlotStyle<"body" | "footer" | "header" | "title" | "content" | "overlay" | "closeButton" | "root" | "dragBar", {
4
+ export 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,5 +117,5 @@ export declare const drawerStyle: ComponentSlotStyle<"body" | "footer" | "header
117
117
  rounded: "0";
118
118
  };
119
119
  };
120
- }, CSSModifierObject<CSSSlotObject<"body" | "footer" | "header" | "title" | "content" | "overlay" | "closeButton" | "root" | "dragBar">>>;
120
+ }, CSSModifierObject<CSSSlotObject<"body" | "footer" | "header" | "title" | "content" | "overlay" | "root" | "closeButton" | "dragBar">>>;
121
121
  export type DrawerStyle = typeof drawerStyle;
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.type.js";
2
2
  import { CSSModifierObject, CSSSlotObject } from "../../core/css/index.type.js";
3
3
  import "../../index.js";
4
- export declare const fieldStyle: ComponentSlotStyle<"label" | "root" | "errorMessage" | "helperMessage" | "requiredIndicator", {
4
+ export declare const fieldStyle: ComponentSlotStyle<"label" | "errorMessage" | "helperMessage" | "requiredIndicator" | "root", {
5
5
  /**
6
6
  * The orientation of the field.
7
7
  */
@@ -35,5 +35,5 @@ export declare const fieldStyle: ComponentSlotStyle<"label" | "root" | "errorMes
35
35
  };
36
36
  };
37
37
  };
38
- }, CSSModifierObject<CSSSlotObject<"label" | "root" | "errorMessage" | "helperMessage" | "requiredIndicator">>, CSSModifierObject<CSSSlotObject<"label" | "root" | "errorMessage" | "helperMessage" | "requiredIndicator">>>;
38
+ }, CSSModifierObject<CSSSlotObject<"label" | "errorMessage" | "helperMessage" | "requiredIndicator" | "root">>, CSSModifierObject<CSSSlotObject<"label" | "errorMessage" | "helperMessage" | "requiredIndicator" | "root">>>;
39
39
  export type FieldStyle = typeof fieldStyle;
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.type.js";
2
2
  import { CSSPropObject, CSSSlotObject } from "../../core/css/index.type.js";
3
3
  import "../../index.js";
4
- export declare const fieldsetStyle: ComponentSlotStyle<"header" | "legend" | "content" | "root" | "errorMessage" | "helperMessage", CSSPropObject<CSSSlotObject<"header" | "legend" | "content" | "root" | "errorMessage" | "helperMessage">>, {
4
+ export declare const fieldsetStyle: ComponentSlotStyle<"header" | "legend" | "content" | "errorMessage" | "helperMessage" | "root", CSSPropObject<CSSSlotObject<"header" | "legend" | "content" | "errorMessage" | "helperMessage" | "root">>, {
5
5
  sm: {
6
6
  content: {
7
7
  gap: "3";
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.type.js";
2
2
  import { CSSPropObject, CSSSlotObject } from "../../core/css/index.type.js";
3
3
  import "../../index.js";
4
- export declare const fileInputStyle: ComponentSlotStyle<"tag" | "root", CSSPropObject<CSSSlotObject<"tag" | "root">>, {
4
+ export declare const fileInputStyle: ComponentSlotStyle<"root" | "tag", CSSPropObject<CSSSlotObject<"root" | "tag">>, {
5
5
  xs: {
6
6
  root: {
7
7
  "&:has(~ [data-input-element])"?: {
@@ -67,5 +67,5 @@ declare const FlipPropsContext: import("react").Context<Partial<FlipProps> | und
67
67
  *
68
68
  * @see https://yamada-ui.com/docs/components/flip
69
69
  */
70
- export declare const Flip: Component<({ defaultValue, delay, disabled, duration, from, orientation, readOnly, to, transition, value: valueProp, onChange, onClick: onClickProp, ...rest }: WithoutThemeProps<FlipProps, ComponentSlotStyle<"from" | "to" | "root" | "item", CSSPropObject<CSSSlotObject<"from" | "to" | "root" | "item">>, CSSModifierObject<CSSSlotObject<"from" | "to" | "root" | "item">>, CSSModifierObject<CSSSlotObject<"from" | "to" | "root" | "item">>>, keyof FlipProps>) => import("react").JSX.Element, FlipProps>;
70
+ export declare const Flip: Component<({ defaultValue, delay, disabled, duration, from, orientation, readOnly, to, transition, value: valueProp, onChange, onClick: onClickProp, ...rest }: 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>) => import("react").JSX.Element, FlipProps>;
71
71
  export { FlipPropsContext, useFlipPropsContext };
@@ -1,5 +1,5 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.type.js";
2
2
  import { CSSModifierObject, CSSPropObject, CSSSlotObject } from "../../core/css/index.type.js";
3
3
  import "../../index.js";
4
- export declare const flipStyle: ComponentSlotStyle<"from" | "to" | "root" | "item", CSSPropObject<CSSSlotObject<"from" | "to" | "root" | "item">>, CSSModifierObject<CSSSlotObject<"from" | "to" | "root" | "item">>, CSSModifierObject<CSSSlotObject<"from" | "to" | "root" | "item">>>;
4
+ export 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
  export type FlipStyle = typeof flipStyle;
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.type.js";
2
2
  import { CSSModifierObject, CSSSlotObject } from "../../core/css/index.type.js";
3
3
  import "../../index.js";
4
- export declare const listStyle: ComponentSlotStyle<"icon" | "root" | "item", {
4
+ export declare const listStyle: ComponentSlotStyle<"icon" | "item" | "root", {
5
5
  styleType: {
6
6
  circle: {
7
7
  root: {
@@ -35,5 +35,5 @@ export declare const listStyle: ComponentSlotStyle<"icon" | "root" | "item", {
35
35
  };
36
36
  };
37
37
  };
38
- }, CSSModifierObject<CSSSlotObject<"icon" | "root" | "item">>, CSSModifierObject<CSSSlotObject<"icon" | "root" | "item">>>;
38
+ }, CSSModifierObject<CSSSlotObject<"icon" | "item" | "root">>, CSSModifierObject<CSSSlotObject<"icon" | "item" | "root">>>;
39
39
  export type ListStyle = typeof listStyle;
@@ -1,5 +1,5 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.type.js";
2
2
  import { CSSModifierObject, CSSPropObject, CSSSlotObject } from "../../core/css/index.type.js";
3
3
  import "../../index.js";
4
- export declare const marqueeStyle: ComponentSlotStyle<"content" | "group" | "root" | "item" | "edge", CSSPropObject<CSSSlotObject<"content" | "group" | "root" | "item" | "edge">>, CSSModifierObject<CSSSlotObject<"content" | "group" | "root" | "item" | "edge">>, CSSModifierObject<CSSSlotObject<"content" | "group" | "root" | "item" | "edge">>>;
4
+ export declare const marqueeStyle: ComponentSlotStyle<"content" | "group" | "item" | "root" | "edge", CSSPropObject<CSSSlotObject<"content" | "group" | "item" | "root" | "edge">>, CSSModifierObject<CSSSlotObject<"content" | "group" | "item" | "root" | "edge">>, CSSModifierObject<CSSSlotObject<"content" | "group" | "item" | "root" | "edge">>>;
5
5
  export type MarqueeStyle = typeof marqueeStyle;
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.type.js";
2
2
  import { CSSModifierObject, CSSSlotObject } from "../../core/css/index.type.js";
3
3
  import "../../index.js";
4
- export declare const modalStyle: ComponentSlotStyle<"body" | "footer" | "header" | "title" | "content" | "overlay" | "closeButton" | "root", {
4
+ export declare const modalStyle: ComponentSlotStyle<"body" | "footer" | "header" | "title" | "content" | "overlay" | "root" | "closeButton", {
5
5
  /**
6
6
  * The placement of the modal.
7
7
  *
@@ -155,5 +155,5 @@ export declare const modalStyle: ComponentSlotStyle<"body" | "footer" | "header"
155
155
  p: "0";
156
156
  };
157
157
  };
158
- }, CSSModifierObject<CSSSlotObject<"body" | "footer" | "header" | "title" | "content" | "overlay" | "closeButton" | "root">>>;
158
+ }, CSSModifierObject<CSSSlotObject<"body" | "footer" | "header" | "title" | "content" | "overlay" | "root" | "closeButton">>>;
159
159
  export type ModalStyle = typeof modalStyle;
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.type.js";
2
2
  import { CSSModifierObject, CSSSlotObject } from "../../core/css/index.type.js";
3
3
  import "../../index.js";
4
- export declare const nativeAccordionStyle: ComponentSlotStyle<"button" | "panel" | "icon" | "root" | "item", {
4
+ export 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 @@ export declare const nativeAccordionStyle: ComponentSlotStyle<"button" | "panel"
31
31
  };
32
32
  };
33
33
  };
34
- }, CSSModifierObject<CSSSlotObject<"button" | "panel" | "icon" | "root" | "item">>, {
34
+ }, CSSModifierObject<CSSSlotObject<"button" | "panel" | "icon" | "item" | "root">>, {
35
35
  panel: {
36
36
  button: {
37
37
  rounded: "l2";
@@ -1,5 +1,5 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.type.js";
2
2
  import { CSSModifierObject, CSSPropObject, CSSSlotObject } from "../../core/css/index.type.js";
3
3
  import "../../index.js";
4
- export declare const noticeStyle: ComponentSlotStyle<"content" | "closeButton" | "root" | "item", CSSPropObject<CSSSlotObject<"content" | "closeButton" | "root" | "item">>, CSSModifierObject<CSSSlotObject<"content" | "closeButton" | "root" | "item">>, CSSModifierObject<CSSSlotObject<"content" | "closeButton" | "root" | "item">>>;
4
+ export declare const noticeStyle: ComponentSlotStyle<"content" | "item" | "root" | "closeButton", CSSPropObject<CSSSlotObject<"content" | "item" | "root" | "closeButton">>, CSSModifierObject<CSSSlotObject<"content" | "item" | "root" | "closeButton">>, CSSModifierObject<CSSSlotObject<"content" | "item" | "root" | "closeButton">>>;
5
5
  export type NoticeStyle = typeof noticeStyle;
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.type.js";
2
2
  import { CSSPropObject, CSSSlotObject } from "../../core/css/index.type.js";
3
3
  import "../../index.js";
4
- export declare const paginationStyle: ComponentSlotStyle<"text" | "root" | "item", CSSPropObject<CSSSlotObject<"text" | "root" | "item">>, {
4
+ export declare const paginationStyle: ComponentSlotStyle<"text" | "item" | "root", CSSPropObject<CSSSlotObject<"text" | "item" | "root">>, {
5
5
  xs: {
6
6
  item: {
7
7
  fontSize: "{font-size}";
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.type.js";
2
2
  import { CSSModifierObject, CSSPropObject, CSSSlotObject } from "../../core/css/index.type.js";
3
3
  import "../../index.js";
4
- export declare const ratingStyle: ComponentSlotStyle<"group" | "icon" | "root" | "item", CSSPropObject<CSSSlotObject<"group" | "icon" | "root" | "item">>, {
4
+ export 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,5 +27,5 @@ export declare const ratingStyle: ComponentSlotStyle<"group" | "icon" | "root" |
27
27
  fontSize: "3xl";
28
28
  };
29
29
  };
30
- }, CSSModifierObject<CSSSlotObject<"group" | "icon" | "root" | "item">>>;
30
+ }, CSSModifierObject<CSSSlotObject<"group" | "icon" | "item" | "root">>>;
31
31
  export type RatingStyle = typeof ratingStyle;
@@ -1,6 +1,6 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.type.js";
2
2
  import "../../index.js";
3
- export declare const reorderStyle: ComponentSlotStyle<"root" | "trigger" | "item", {
3
+ export 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.type.js";
2
2
  import { CSSModifierObject, CSSSlotObject } from "../../core/css/index.type.js";
3
3
  import "../../index.js";
4
- export declare const resizableStyle: ComponentSlotStyle<"icon" | "root" | "trigger" | "item", {
4
+ export declare const resizableStyle: ComponentSlotStyle<"icon" | "item" | "root" | "trigger", {
5
5
  /**
6
6
  * The orientation of the resizable.
7
7
  *
@@ -19,7 +19,7 @@ export declare const resizableStyle: ComponentSlotStyle<"icon" | "root" | "trigg
19
19
  };
20
20
  };
21
21
  };
22
- }, CSSModifierObject<CSSSlotObject<"icon" | "root" | "trigger" | "item">>, {
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.type.js";
2
2
  import { CSSModifierObject, CSSSlotObject } from "../../core/css/index.type.js";
3
3
  import "../../index.js";
4
- export declare const segmentedControlStyle: ComponentSlotStyle<"root" | "item" | "indicator", {
4
+ export declare const segmentedControlStyle: ComponentSlotStyle<"item" | "root" | "indicator", {
5
5
  /**
6
6
  * If `true`, the segmented control will be full rounded.
7
7
  *
@@ -113,5 +113,5 @@ export declare const segmentedControlStyle: ComponentSlotStyle<"root" | "item" |
113
113
  };
114
114
  };
115
115
  };
116
- }, CSSModifierObject<CSSSlotObject<"root" | "item" | "indicator">>>;
116
+ }, CSSModifierObject<CSSSlotObject<"item" | "root" | "indicator">>>;
117
117
  export type SegmentedControlStyle = typeof segmentedControlStyle;
@@ -1,6 +1,6 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.type.js";
2
2
  import "../../index.js";
3
- export declare const selectStyle: ComponentSlotStyle<"label" | "option" | "content" | "group" | "separator" | "icon" | "root" | "indicator" | "field" | "valueText", {
3
+ export declare const selectStyle: ComponentSlotStyle<"label" | "option" | "content" | "group" | "separator" | "icon" | "root" | "field" | "indicator" | "valueText", {
4
4
  /**
5
5
  * If `true`, wrap the value text.
6
6
  *
@@ -1,7 +1,7 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.type.js";
2
2
  import { CSSModifierObject, CSSSlotObject } from "../../core/css/index.type.js";
3
3
  import "../../index.js";
4
- export declare const statStyle: ComponentSlotStyle<"label" | "value" | "icon" | "root" | "helperMessage" | "unit", {
4
+ export declare const statStyle: ComponentSlotStyle<"label" | "value" | "icon" | "helperMessage" | "root" | "unit", {
5
5
  /**
6
6
  * If `true`, container will center its children regardless of their width.
7
7
  *
@@ -92,5 +92,5 @@ export declare const statStyle: ComponentSlotStyle<"label" | "value" | "icon" |
92
92
  gap: "2";
93
93
  };
94
94
  };
95
- }, CSSModifierObject<CSSSlotObject<"label" | "value" | "icon" | "root" | "helperMessage" | "unit">>>;
95
+ }, CSSModifierObject<CSSSlotObject<"label" | "value" | "icon" | "helperMessage" | "root" | "unit">>>;
96
96
  export type StatStyle = typeof statStyle;
@@ -1,6 +1,6 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.type.js";
2
2
  import "../../index.js";
3
- export declare const stepsStyle: ComponentSlotStyle<"title" | "list" | "separator" | "root" | "item" | "description" | "indicator", {
3
+ export declare const stepsStyle: ComponentSlotStyle<"title" | "list" | "separator" | "item" | "root" | "description" | "indicator", {
4
4
  /**
5
5
  * The orientation of the steps.
6
6
  *
@@ -1,6 +1,6 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.type.js";
2
2
  import "../../index.js";
3
- export declare const tagStyle: ComponentSlotStyle<"content" | "icon" | "closeButton" | "root" | "endIcon" | "startIcon", {
3
+ export declare const tagStyle: ComponentSlotStyle<"content" | "icon" | "endIcon" | "startIcon" | "root" | "closeButton", {
4
4
  /**
5
5
  * If `true`, the tag is full rounded. Else, it'll be slightly round.
6
6
  *
@@ -61,7 +61,7 @@ declare const TimelinePropsContext: import("react").Context<Partial<TimelineRoot
61
61
  *
62
62
  * @see https://yamada-ui.com/docs/components/timeline
63
63
  */
64
- export declare const TimelineRoot: Component<({ variant: variantProp, children, index, items, ...rest }: WithoutThemeProps<TimelineRootProps, ComponentSlotStyle<"title" | "content" | "root" | "item" | "description" | "indicator" | "connector", {
64
+ export declare const TimelineRoot: Component<({ variant: variantProp, children, index, items, ...rest }: WithoutThemeProps<TimelineRootProps, ComponentSlotStyle<"title" | "content" | "item" | "root" | "description" | "indicator" | "connector", {
65
65
  align: {
66
66
  center: {
67
67
  content: {
@@ -1,6 +1,6 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.type.js";
2
2
  import "../../index.js";
3
- export declare const timelineStyle: ComponentSlotStyle<"title" | "content" | "root" | "item" | "description" | "indicator" | "connector", {
3
+ export declare const timelineStyle: ComponentSlotStyle<"title" | "content" | "item" | "root" | "description" | "indicator" | "connector", {
4
4
  /**
5
5
  * The alignment of the timeline.
6
6
  *
@@ -1,6 +1,6 @@
1
1
  import { ComponentSlotStyle } from "../../core/system/index.type.js";
2
2
  import "../../index.js";
3
- export declare const treeStyle: ComponentSlotStyle<"label" | "checkbox" | "group" | "end" | "start" | "element" | "root" | "item" | "indicator", {
3
+ export declare const treeStyle: ComponentSlotStyle<"label" | "checkbox" | "group" | "end" | "start" | "element" | "item" | "root" | "indicator", {
4
4
  /**
5
5
  * The shape of the component
6
6
  *
@@ -123,7 +123,7 @@ declare const I18nContext: import("react").Context<I18nContext<{
123
123
  readonly toggle: {
124
124
  readonly "Toggle button": "Toggle button";
125
125
  };
126
- }, "progress" | "select" | "table" | "toggle" | "slider" | "autocomplete" | "avatar" | "breadcrumb" | "calendar" | "carousel" | "closeButton" | "colorPicker" | "colorSelector" | "colorSwatch" | "datePicker" | "hueSlider" | "numberInput" | "pagination" | "passwordInput" | "saturationSlider" | "sidebar" | "stat" | "tag" | "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" | "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}" | "closeButton.Close" | "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}%" | "sidebar.Close sidebar" | "sidebar.Open sidebar" | "stat.Decreased by" | "stat.Increased by" | "tag.Close tag">>;
126
+ }, "progress" | "select" | "table" | "toggle" | "slider" | "colorSwatch" | "hueSlider" | "saturationSlider" | "tag" | "datePicker" | "autocomplete" | "avatar" | "breadcrumb" | "calendar" | "carousel" | "closeButton" | "colorPicker" | "colorSelector" | "numberInput" | "pagination" | "passwordInput" | "sidebar" | "stat" | "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" | "colorSwatch.Color swatch group" | "hueSlider.Blue" | "hueSlider.Cyan" | "hueSlider.Green" | "hueSlider.Magenta" | "hueSlider.Red" | "hueSlider.Yellow" | "saturationSlider.Saturation and brightness thumb" | "saturationSlider.Saturation {saturation}%, Brightness {brightness}%" | "tag.Close tag" | "datePicker.Clear value" | "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}" | "closeButton.Close" | "colorPicker.Pick a color" | "colorSelector.Pick a color" | "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" | "sidebar.Close sidebar" | "sidebar.Open sidebar" | "stat.Decreased by" | "stat.Increased by">>;
127
127
  export interface I18nProviderProps {
128
128
  children?: ReactNode;
129
129
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@yamada-ui/react",
3
3
  "type": "module",
4
- "version": "2.3.4-dev-20261116075346",
4
+ "version": "2.3.4-dev-20261116083348",
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",