@yamada-ui/react 2.3.4-dev-20261111232831 → 2.3.4-dev-20261114075014

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.
@@ -49,21 +49,13 @@ const useNativeSelect = (props = {}) => {
49
49
  ...props
50
50
  }), [dataProps]);
51
51
  return {
52
- getFieldProps: (0, react.useCallback)(({ ref, ...props } = {}) => require_props.mergeProps({
52
+ getFieldProps: (0, react.useCallback)((props = {}) => require_props.mergeProps(ariaProps, dataProps, eventProps, {
53
+ "aria-disabled": (0, require_utils_index.utils_exports.ariaAttr)(!interactive),
54
+ "aria-label": placeholder,
53
55
  disabled,
54
56
  readOnly,
55
- tabIndex: interactive ? void 0 : -1,
56
- ...ariaProps,
57
- ...dataProps,
58
- "aria-disabled": (0, require_utils_index.utils_exports.ariaAttr)(!interactive),
59
- "aria-label": placeholder
60
- }, {
61
- onBlur: eventProps.onBlur,
62
- onFocus: eventProps.onFocus
63
- }, rest, props, {
64
- ref,
65
- children: props.children ?? computedChildren
66
- })(), [
57
+ tabIndex: interactive ? void 0 : -1
58
+ }, rest, props, { children: props.children ?? computedChildren })(), [
67
59
  interactive,
68
60
  ariaProps,
69
61
  computedChildren,
@@ -1 +1 @@
1
- {"version":3,"file":"use-native-select.cjs","names":["useFieldProps","useMemo","cloneElement","useCallback","mergeProps"],"sources":["../../../../src/components/native-select/use-native-select.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactNode } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { FieldProps } from \"../field\"\nimport { cloneElement, useCallback, useMemo } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { ariaAttr } from \"../../utils\"\nimport { useFieldProps } from \"../field\"\n\ninterface NativeSelectSharedItem extends Omit<\n HTMLProps<\"option\">,\n \"children\" | \"label\" | \"value\"\n> {\n label: string\n}\n\ninterface NativeSelectItemWithValue extends NativeSelectSharedItem {\n value?: HTMLProps<\"option\">[\"value\"]\n}\n\ninterface NativeSelectItemWithItems extends NativeSelectSharedItem {\n items: NativeSelectItemWithValue[]\n}\n\nexport type NativeSelectItem =\n | NativeSelectItemWithItems\n | NativeSelectItemWithValue\n\nexport interface UseNativeSelectProps extends HTMLProps<\"select\">, FieldProps {\n /**\n * If `true`, include placeholder in options.\n *\n * @default true\n */\n includePlaceholder?: boolean\n /**\n * If provided, generate options based on items.\n *\n * @default []\n */\n items?: NativeSelectItem[]\n /**\n * The placeholder for select.\n */\n placeholder?: string\n}\n\nexport const useNativeSelect = (props: UseNativeSelectProps = {}) => {\n const {\n props: {\n children,\n disabled,\n includePlaceholder = true,\n items = [],\n placeholder,\n readOnly,\n ...rest\n },\n ariaProps,\n dataProps,\n eventProps,\n } = useFieldProps(props)\n const interactive = !(readOnly || disabled)\n\n const computedChildren = useMemo(() => {\n let computedChildren: ReactNode = null\n\n if (children) computedChildren = children\n else if (items.length)\n computedChildren = items.map((item, index) => {\n if (\"items\" in item) {\n const { items, label, ...rest } = item\n\n return cloneElement(<optgroup />, {\n key: index,\n children: items.map(({ label, ...rest }, index) =>\n cloneElement(<option aria-label={label} />, {\n key: index,\n children: label,\n ...rest,\n }),\n ),\n label,\n ...rest,\n })\n } else {\n const { label, ...rest } = item\n\n return cloneElement(<option aria-label={label} />, {\n key: index,\n children: label,\n ...rest,\n })\n }\n })\n\n return (\n <>\n {placeholder ? (\n <option hidden={!includePlaceholder} value=\"\">\n {placeholder}\n </option>\n ) : null}\n\n {computedChildren}\n </>\n )\n }, [children, items, placeholder, includePlaceholder])\n\n const getRootProps: PropGetter = useCallback(\n (props) => ({ ...dataProps, ...props }),\n [dataProps],\n )\n\n const getFieldProps: PropGetter<\"select\"> = useCallback(\n ({ ref, ...props } = {}) =>\n mergeProps(\n {\n disabled,\n readOnly,\n tabIndex: interactive ? undefined : -1,\n ...ariaProps,\n ...dataProps,\n \"aria-disabled\": ariaAttr(!interactive),\n \"aria-label\": placeholder,\n },\n {\n onBlur: eventProps.onBlur,\n onFocus: eventProps.onFocus,\n },\n rest,\n props,\n {\n ref,\n children: props.children ?? computedChildren,\n },\n )(),\n [\n interactive,\n ariaProps,\n computedChildren,\n dataProps,\n eventProps,\n rest,\n placeholder,\n disabled,\n readOnly,\n ],\n )\n\n const getIconProps: PropGetter = useCallback(\n (props) => ({ ...dataProps, ...props }),\n [dataProps],\n )\n\n return { getFieldProps, getIconProps, getRootProps }\n}\n\nexport type UseNativeSelectReturn = ReturnType<typeof useNativeSelect>\n"],"mappings":";;;;;;;AAgDA,MAAa,mBAAmB,QAA8B,CAAC,MAAM;CACnE,MAAM,EACJ,OAAO,EACL,UACA,UACA,qBAAqB,MACrB,QAAQ,CAAC,GACT,aACA,UACA,GAAG,QAEL,WACA,WACA,eACEA,wBAAAA,cAAc,KAAK;CACvB,MAAM,cAAc,EAAE,YAAY;CAElC,MAAM,oBAAA,GAAmBC,MAAAA,QAAAA,OAAc;EACrC,IAAI,mBAA8B;EAElC,IAAI,UAAU,mBAAmB;OAC5B,IAAI,MAAM,QACb,mBAAmB,MAAM,KAAK,MAAM,UAAU;GAC5C,IAAI,WAAW,MAAM;IACnB,MAAM,EAAE,OAAO,OAAO,GAAG,SAAS;IAElC,QAAA,GAAOC,MAAAA,aAAAA,CAAa,iBAAA,GAAA,kBAAA,IAAA,CAAC,YAAD,CAAW,CAAA,GAAG;KAChC,KAAK;KACL,UAAU,MAAM,KAAK,EAAE,OAAO,GAAG,QAAQ,WAAA,GACvCA,MAAAA,aAAAA,CAAa,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD,EAAQ,cAAY,MAAQ,CAAA,GAAG;MAC1C,KAAK;MACL,UAAU;MACV,GAAG;KACL,CAAC,CACH;KACA;KACA,GAAG;IACL,CAAC;GACH,OAAO;IACL,MAAM,EAAE,OAAO,GAAG,SAAS;IAE3B,QAAA,GAAOA,MAAAA,aAAAA,CAAa,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD,EAAQ,cAAY,MAAQ,CAAA,GAAG;KACjD,KAAK;KACL,UAAU;KACV,GAAG;IACL,CAAC;GACH;EACF,CAAC;EAEH,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAA,kBAAA,UAAA,EAAA,UAAA,CACG,cACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD;GAAQ,QAAQ,CAAC;GAAoB,OAAM;GACxC,UAAA;EACK,CAAA,IACN,MAEH,gBACD,EAAA,CAAA;CAEN,GAAG;EAAC;EAAU;EAAO;EAAa;CAAkB,CAAC;CAErD,MAAM,gBAAA,GAA2BC,MAAAA,YAAAA,EAC9B,WAAW;EAAE,GAAG;EAAW,GAAG;CAAM,IACrC,CAAC,SAAS,CACZ;CA2CA,OAAO;EAAE,gBAAA,GAzCmCA,MAAAA,YAAAA,EACzC,EAAE,KAAK,GAAG,UAAU,CAAC,MACpBC,cAAAA,WACE;GACE;GACA;GACA,UAAU,cAAc,KAAA,IAAY;GACpC,GAAG;GACH,GAAG;GACH,kBAAA,GAAA,oBAAA,cAAiB,SAAA,CAAS,CAAC,WAAW;GACtC,cAAc;EAChB,GACA;GACE,QAAQ,WAAW;GACnB,SAAS,WAAW;EACtB,GACA,MACA,OACA;GACE;GACA,UAAU,MAAM,YAAY;EAC9B,CACF,CAAC,CAAC,GACJ;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,CAQmB;EAAG,eAAA,GALSD,MAAAA,YAAAA,EAC9B,WAAW;GAAE,GAAG;GAAW,GAAG;EAAM,IACrC,CAAC,SAAS,CAGuB;EAAG;CAAa;AACrD"}
1
+ {"version":3,"file":"use-native-select.cjs","names":["useFieldProps","useMemo","cloneElement","useCallback","mergeProps"],"sources":["../../../../src/components/native-select/use-native-select.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactNode } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { FieldProps } from \"../field\"\nimport { cloneElement, useCallback, useMemo } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { ariaAttr } from \"../../utils\"\nimport { useFieldProps } from \"../field\"\n\ninterface NativeSelectSharedItem extends Omit<\n HTMLProps<\"option\">,\n \"children\" | \"label\" | \"value\"\n> {\n label: string\n}\n\ninterface NativeSelectItemWithValue extends NativeSelectSharedItem {\n value?: HTMLProps<\"option\">[\"value\"]\n}\n\ninterface NativeSelectItemWithItems extends NativeSelectSharedItem {\n items: NativeSelectItemWithValue[]\n}\n\nexport type NativeSelectItem =\n | NativeSelectItemWithItems\n | NativeSelectItemWithValue\n\nexport interface UseNativeSelectProps extends HTMLProps<\"select\">, FieldProps {\n /**\n * If `true`, include placeholder in options.\n *\n * @default true\n */\n includePlaceholder?: boolean\n /**\n * If provided, generate options based on items.\n *\n * @default []\n */\n items?: NativeSelectItem[]\n /**\n * The placeholder for select.\n */\n placeholder?: string\n}\n\nexport const useNativeSelect = (props: UseNativeSelectProps = {}) => {\n const {\n props: {\n children,\n disabled,\n includePlaceholder = true,\n items = [],\n placeholder,\n readOnly,\n ...rest\n },\n ariaProps,\n dataProps,\n eventProps,\n } = useFieldProps(props)\n const interactive = !(readOnly || disabled)\n\n const computedChildren = useMemo(() => {\n let computedChildren: ReactNode = null\n\n if (children) computedChildren = children\n else if (items.length)\n computedChildren = items.map((item, index) => {\n if (\"items\" in item) {\n const { items, label, ...rest } = item\n\n return cloneElement(<optgroup />, {\n key: index,\n children: items.map(({ label, ...rest }, index) =>\n cloneElement(<option aria-label={label} />, {\n key: index,\n children: label,\n ...rest,\n }),\n ),\n label,\n ...rest,\n })\n } else {\n const { label, ...rest } = item\n\n return cloneElement(<option aria-label={label} />, {\n key: index,\n children: label,\n ...rest,\n })\n }\n })\n\n return (\n <>\n {placeholder ? (\n <option hidden={!includePlaceholder} value=\"\">\n {placeholder}\n </option>\n ) : null}\n\n {computedChildren}\n </>\n )\n }, [children, items, placeholder, includePlaceholder])\n\n const getRootProps: PropGetter = useCallback(\n (props) => ({ ...dataProps, ...props }),\n [dataProps],\n )\n\n const getFieldProps: PropGetter<\"select\"> = useCallback(\n (props = {}) =>\n mergeProps(\n ariaProps,\n dataProps,\n eventProps,\n {\n \"aria-disabled\": ariaAttr(!interactive),\n \"aria-label\": placeholder,\n disabled,\n readOnly,\n tabIndex: interactive ? undefined : -1,\n },\n rest,\n props,\n {\n children: props.children ?? computedChildren,\n },\n )(),\n [\n interactive,\n ariaProps,\n computedChildren,\n dataProps,\n eventProps,\n rest,\n placeholder,\n disabled,\n readOnly,\n ],\n )\n\n const getIconProps: PropGetter = useCallback(\n (props) => ({ ...dataProps, ...props }),\n [dataProps],\n )\n\n return { getFieldProps, getIconProps, getRootProps }\n}\n\nexport type UseNativeSelectReturn = ReturnType<typeof useNativeSelect>\n"],"mappings":";;;;;;;AAgDA,MAAa,mBAAmB,QAA8B,CAAC,MAAM;CACnE,MAAM,EACJ,OAAO,EACL,UACA,UACA,qBAAqB,MACrB,QAAQ,CAAC,GACT,aACA,UACA,GAAG,QAEL,WACA,WACA,eACEA,wBAAAA,cAAc,KAAK;CACvB,MAAM,cAAc,EAAE,YAAY;CAElC,MAAM,oBAAA,GAAmBC,MAAAA,QAAAA,OAAc;EACrC,IAAI,mBAA8B;EAElC,IAAI,UAAU,mBAAmB;OAC5B,IAAI,MAAM,QACb,mBAAmB,MAAM,KAAK,MAAM,UAAU;GAC5C,IAAI,WAAW,MAAM;IACnB,MAAM,EAAE,OAAO,OAAO,GAAG,SAAS;IAElC,QAAA,GAAOC,MAAAA,aAAAA,CAAa,iBAAA,GAAA,kBAAA,IAAA,CAAC,YAAD,CAAW,CAAA,GAAG;KAChC,KAAK;KACL,UAAU,MAAM,KAAK,EAAE,OAAO,GAAG,QAAQ,WAAA,GACvCA,MAAAA,aAAAA,CAAa,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD,EAAQ,cAAY,MAAQ,CAAA,GAAG;MAC1C,KAAK;MACL,UAAU;MACV,GAAG;KACL,CAAC,CACH;KACA;KACA,GAAG;IACL,CAAC;GACH,OAAO;IACL,MAAM,EAAE,OAAO,GAAG,SAAS;IAE3B,QAAA,GAAOA,MAAAA,aAAAA,CAAa,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD,EAAQ,cAAY,MAAQ,CAAA,GAAG;KACjD,KAAK;KACL,UAAU;KACV,GAAG;IACL,CAAC;GACH;EACF,CAAC;EAEH,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAA,kBAAA,UAAA,EAAA,UAAA,CACG,cACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD;GAAQ,QAAQ,CAAC;GAAoB,OAAM;GACxC,UAAA;EACK,CAAA,IACN,MAEH,gBACD,EAAA,CAAA;CAEN,GAAG;EAAC;EAAU;EAAO;EAAa;CAAkB,CAAC;CAErD,MAAM,gBAAA,GAA2BC,MAAAA,YAAAA,EAC9B,WAAW;EAAE,GAAG;EAAW,GAAG;CAAM,IACrC,CAAC,SAAS,CACZ;CAuCA,OAAO;EAAE,gBAAA,GArCmCA,MAAAA,YAAAA,EACzC,QAAQ,CAAC,MACRC,cAAAA,WACE,WACA,WACA,YACA;GACE,kBAAA,GAAA,oBAAA,cAAiB,SAAA,CAAS,CAAC,WAAW;GACtC,cAAc;GACd;GACA;GACA,UAAU,cAAc,KAAA,IAAY;EACtC,GACA,MACA,OACA,EACE,UAAU,MAAM,YAAY,iBAC9B,CACF,CAAC,CAAC,GACJ;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,CAQmB;EAAG,eAAA,GALSD,MAAAA,YAAAA,EAC9B,WAAW;GAAE,GAAG;GAAW,GAAG;EAAM,IACrC,CAAC,SAAS,CAGuB;EAAG;CAAa;AACrD"}
@@ -49,21 +49,13 @@ const useNativeSelect = (props = {}) => {
49
49
  ...props
50
50
  }), [dataProps]);
51
51
  return {
52
- getFieldProps: useCallback(({ ref, ...props } = {}) => mergeProps({
52
+ getFieldProps: useCallback((props = {}) => mergeProps(ariaProps, dataProps, eventProps, {
53
+ "aria-disabled": (0, utils_exports.ariaAttr)(!interactive),
54
+ "aria-label": placeholder,
53
55
  disabled,
54
56
  readOnly,
55
- tabIndex: interactive ? void 0 : -1,
56
- ...ariaProps,
57
- ...dataProps,
58
- "aria-disabled": (0, utils_exports.ariaAttr)(!interactive),
59
- "aria-label": placeholder
60
- }, {
61
- onBlur: eventProps.onBlur,
62
- onFocus: eventProps.onFocus
63
- }, rest, props, {
64
- ref,
65
- children: props.children ?? computedChildren
66
- })(), [
57
+ tabIndex: interactive ? void 0 : -1
58
+ }, rest, props, { children: props.children ?? computedChildren })(), [
67
59
  interactive,
68
60
  ariaProps,
69
61
  computedChildren,
@@ -1 +1 @@
1
- {"version":3,"file":"use-native-select.js","names":["ariaAttr"],"sources":["../../../../src/components/native-select/use-native-select.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactNode } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { FieldProps } from \"../field\"\nimport { cloneElement, useCallback, useMemo } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { ariaAttr } from \"../../utils\"\nimport { useFieldProps } from \"../field\"\n\ninterface NativeSelectSharedItem extends Omit<\n HTMLProps<\"option\">,\n \"children\" | \"label\" | \"value\"\n> {\n label: string\n}\n\ninterface NativeSelectItemWithValue extends NativeSelectSharedItem {\n value?: HTMLProps<\"option\">[\"value\"]\n}\n\ninterface NativeSelectItemWithItems extends NativeSelectSharedItem {\n items: NativeSelectItemWithValue[]\n}\n\nexport type NativeSelectItem =\n | NativeSelectItemWithItems\n | NativeSelectItemWithValue\n\nexport interface UseNativeSelectProps extends HTMLProps<\"select\">, FieldProps {\n /**\n * If `true`, include placeholder in options.\n *\n * @default true\n */\n includePlaceholder?: boolean\n /**\n * If provided, generate options based on items.\n *\n * @default []\n */\n items?: NativeSelectItem[]\n /**\n * The placeholder for select.\n */\n placeholder?: string\n}\n\nexport const useNativeSelect = (props: UseNativeSelectProps = {}) => {\n const {\n props: {\n children,\n disabled,\n includePlaceholder = true,\n items = [],\n placeholder,\n readOnly,\n ...rest\n },\n ariaProps,\n dataProps,\n eventProps,\n } = useFieldProps(props)\n const interactive = !(readOnly || disabled)\n\n const computedChildren = useMemo(() => {\n let computedChildren: ReactNode = null\n\n if (children) computedChildren = children\n else if (items.length)\n computedChildren = items.map((item, index) => {\n if (\"items\" in item) {\n const { items, label, ...rest } = item\n\n return cloneElement(<optgroup />, {\n key: index,\n children: items.map(({ label, ...rest }, index) =>\n cloneElement(<option aria-label={label} />, {\n key: index,\n children: label,\n ...rest,\n }),\n ),\n label,\n ...rest,\n })\n } else {\n const { label, ...rest } = item\n\n return cloneElement(<option aria-label={label} />, {\n key: index,\n children: label,\n ...rest,\n })\n }\n })\n\n return (\n <>\n {placeholder ? (\n <option hidden={!includePlaceholder} value=\"\">\n {placeholder}\n </option>\n ) : null}\n\n {computedChildren}\n </>\n )\n }, [children, items, placeholder, includePlaceholder])\n\n const getRootProps: PropGetter = useCallback(\n (props) => ({ ...dataProps, ...props }),\n [dataProps],\n )\n\n const getFieldProps: PropGetter<\"select\"> = useCallback(\n ({ ref, ...props } = {}) =>\n mergeProps(\n {\n disabled,\n readOnly,\n tabIndex: interactive ? undefined : -1,\n ...ariaProps,\n ...dataProps,\n \"aria-disabled\": ariaAttr(!interactive),\n \"aria-label\": placeholder,\n },\n {\n onBlur: eventProps.onBlur,\n onFocus: eventProps.onFocus,\n },\n rest,\n props,\n {\n ref,\n children: props.children ?? computedChildren,\n },\n )(),\n [\n interactive,\n ariaProps,\n computedChildren,\n dataProps,\n eventProps,\n rest,\n placeholder,\n disabled,\n readOnly,\n ],\n )\n\n const getIconProps: PropGetter = useCallback(\n (props) => ({ ...dataProps, ...props }),\n [dataProps],\n )\n\n return { getFieldProps, getIconProps, getRootProps }\n}\n\nexport type UseNativeSelectReturn = ReturnType<typeof useNativeSelect>\n"],"mappings":";;;;;;;AAgDA,MAAa,mBAAmB,QAA8B,CAAC,MAAM;CACnE,MAAM,EACJ,OAAO,EACL,UACA,UACA,qBAAqB,MACrB,QAAQ,CAAC,GACT,aAC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OACA;GACE;GACA,UAAU,MAAM,YAAY;EAC9B,CACF,CAAC,CAAC,GACJ;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,CAQmB;EAAG,cALS,aAC9B,WAAW;GAAE,GAAG;GAAW,GAAG;EAAM,IACrC,CAAC,SAAS,CAGuB;EAAG;CAAa;AACrD"}
1
+ {"version":3,"file":"use-native-select.js","names":["ariaAttr"],"sources":["../../../../src/components/native-select/use-native-select.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactNode } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { FieldProps } from \"../field\"\nimport { cloneElement, useCallback, useMemo } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { ariaAttr } from \"../../utils\"\nimport { useFieldProps } from \"../field\"\n\ninterface NativeSelectSharedItem extends Omit<\n HTMLProps<\"option\">,\n \"children\" | \"label\" | \"value\"\n> {\n label: string\n}\n\ninterface NativeSelectItemWithValue extends NativeSelectSharedItem {\n value?: HTMLProps<\"option\">[\"value\"]\n}\n\ninterface NativeSelectItemWithItems extends NativeSelectSharedItem {\n items: NativeSelectItemWithValue[]\n}\n\nexport type NativeSelectItem =\n | NativeSelectItemWithItems\n | NativeSelectItemWithValue\n\nexport interface UseNativeSelectProps extends HTMLProps<\"select\">, FieldProps {\n /**\n * If `true`, include placeholder in options.\n *\n * @default true\n */\n includePlaceholder?: boolean\n /**\n * If provided, generate options based on items.\n *\n * @default []\n */\n items?: NativeSelectItem[]\n /**\n * The placeholder for select.\n */\n placeholder?: string\n}\n\nexport const useNativeSelect = (props: UseNativeSelectProps = {}) => {\n const {\n props: {\n children,\n disabled,\n includePlaceholder = true,\n items = [],\n placeholder,\n readOnly,\n ...rest\n },\n ariaProps,\n dataProps,\n eventProps,\n } = useFieldProps(props)\n const interactive = !(readOnly || disabled)\n\n const computedChildren = useMemo(() => {\n let computedChildren: ReactNode = null\n\n if (children) computedChildren = children\n else if (items.length)\n computedChildren = items.map((item, index) => {\n if (\"items\" in item) {\n const { items, label, ...rest } = item\n\n return cloneElement(<optgroup />, {\n key: index,\n children: items.map(({ label, ...rest }, index) =>\n cloneElement(<option aria-label={label} />, {\n key: index,\n children: label,\n ...rest,\n }),\n ),\n label,\n ...rest,\n })\n } else {\n const { label, ...rest } = item\n\n return cloneElement(<option aria-label={label} />, {\n key: index,\n children: label,\n ...rest,\n })\n }\n })\n\n return (\n <>\n {placeholder ? (\n <option hidden={!includePlaceholder} value=\"\">\n {placeholder}\n </option>\n ) : null}\n\n {computedChildren}\n </>\n )\n }, [children, items, placeholder, includePlaceholder])\n\n const getRootProps: PropGetter = useCallback(\n (props) => ({ ...dataProps, ...props }),\n [dataProps],\n )\n\n const getFieldProps: PropGetter<\"select\"> = useCallback(\n (props = {}) =>\n mergeProps(\n ariaProps,\n dataProps,\n eventProps,\n {\n \"aria-disabled\": ariaAttr(!interactive),\n \"aria-label\": placeholder,\n disabled,\n readOnly,\n tabIndex: interactive ? undefined : -1,\n },\n rest,\n props,\n {\n children: props.children ?? computedChildren,\n },\n )(),\n [\n interactive,\n ariaProps,\n computedChildren,\n dataProps,\n eventProps,\n rest,\n placeholder,\n disabled,\n readOnly,\n ],\n )\n\n const getIconProps: PropGetter = useCallback(\n (props) => ({ ...dataProps, ...props }),\n [dataProps],\n )\n\n return { getFieldProps, getIconProps, getRootProps }\n}\n\nexport type UseNativeSelectReturn = ReturnType<typeof useNativeSelect>\n"],"mappings":";;;;;;;AAgDA,MAAa,mBAAmB,QAA8B,CAAC,MAAM;CACnE,MAAM,EACJ,OAAO,EACL,UACA,UACA,qBAAqB,MACrB,QAAQ,CAAC,GACT,aACA,UACA,GAAG,QAEL,WACA,WACA,eACE,cAAc,KAAK;CACvB,MAAM,cAAc,EAAE,YAAY;CAElC,MAAM,mBAAmB,cAAc;EACrC,IAAI,mBAA8B;EAElC,IAAI,UAAU,mBAAmB;OAC5B,IAAI,MAAM,QACb,mBAAmB,MAAM,KAAK,MAAM,UAAU;GAC5C,IA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module",
4
- "version": "2.3.4-dev-20261111232831",
4
+ "version": "2.3.4-dev-20261114075014",
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",