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

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"}
@@ -12,15 +12,10 @@ const useTextarea = ({ autosize, maxRows, minRows, resizeRef, ...rest } = {}) =>
12
12
  });
13
13
  require_ref.assignRef(resizeRef, onResizeTextarea);
14
14
  return {
15
- getTextareaProps: (0, react.useCallback)((props = {}) => {
16
- return require_props.mergeProps(rest, props, {
17
- ref: require_ref.mergeRefs(ref),
18
- ...autosize ? {
19
- style: { resize: "none" },
20
- onChange: onResizeTextarea
21
- } : {}
22
- })();
23
- }, [
15
+ getTextareaProps: (0, react.useCallback)((props = {}) => require_props.mergeProps(rest, props, { ref }, autosize ? {
16
+ style: { resize: "none" },
17
+ onChange: onResizeTextarea
18
+ } : void 0)(), [
24
19
  autosize,
25
20
  onResizeTextarea,
26
21
  rest,
@@ -1 +1 @@
1
- {"version":3,"file":"use-textarea.cjs","names":["useAutosize","useCallback","mergeProps","mergeRefs"],"sources":["../../../../src/components/textarea/use-textarea.ts"],"sourcesContent":["\"use client\"\n\nimport type { ForwardedRef } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { UseAutosizeProps } from \"./use-autosize\"\nimport { useCallback } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { assignRef, mergeRefs } from \"../../utils\"\nimport { useAutosize } from \"./use-autosize\"\n\nexport interface UseTextareaProps\n extends HTMLProps<\"textarea\">, Omit<UseAutosizeProps, \"disabled\" | \"ref\"> {\n /**\n * If `true`, the Textarea height auto-adjusts to text height.\n */\n autosize?: boolean\n /**\n * Ref to a resize function.\n */\n resizeRef?: ForwardedRef<() => void>\n}\n\nexport const useTextarea = ({\n autosize,\n maxRows,\n minRows,\n resizeRef,\n ...rest\n}: UseTextareaProps = {}) => {\n const { ref, onResizeTextarea } = useAutosize({\n disabled: !autosize,\n maxRows,\n minRows,\n })\n\n assignRef(resizeRef, onResizeTextarea)\n\n const getTextareaProps: PropGetter<\"textarea\"> = useCallback(\n (props = {}) => {\n const textareaProps = mergeProps(rest, props, {\n ref: mergeRefs(ref),\n ...(autosize\n ? {\n style: { resize: \"none\" as const },\n onChange: onResizeTextarea,\n }\n : {}),\n })()\n\n return textareaProps\n },\n [autosize, onResizeTextarea, rest, ref],\n )\n\n return {\n getTextareaProps,\n onResizeTextarea,\n }\n}\n\nexport type UseTextareaReturn = ReturnType<typeof useTextarea>\n"],"mappings":";;;;;;AAsBA,MAAa,eAAe,EAC1B,UACA,SACA,SACA,WACA,GAAG,SACiB,CAAC,MAAM;CAC3B,MAAM,EAAE,KAAK,qBAAqBA,qBAAAA,YAAY;EAC5C,UAAU,CAAC;EACX;EACA;CACF,CAAC;CAED,YAAA,UAAU,WAAW,gBAAgB;CAmBrC,OAAO;EACL,mBAAA,GAlB+CC,MAAAA,YAAAA,EAC9C,QAAQ,CAAC,MAAM;GAWd,OAVsBC,cAAAA,WAAW,MAAM,OAAO;IAC5C,KAAKC,YAAAA,UAAU,GAAG;IAClB,GAAI,WACA;KACE,OAAO,EAAE,QAAQ,OAAgB;KACjC,UAAU;IACZ,IACA,CAAC;GACP,CAAC,CAAC,CAEiB;EACrB,GACA;GAAC;GAAU;GAAkB;GAAM;EAAG,CAIvB;EACf;CACF;AACF"}
1
+ {"version":3,"file":"use-textarea.cjs","names":["useAutosize","useCallback","mergeProps"],"sources":["../../../../src/components/textarea/use-textarea.ts"],"sourcesContent":["\"use client\"\n\nimport type { ForwardedRef } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { UseAutosizeProps } from \"./use-autosize\"\nimport { useCallback } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { assignRef } from \"../../utils\"\nimport { useAutosize } from \"./use-autosize\"\n\nexport interface UseTextareaProps\n extends HTMLProps<\"textarea\">, Omit<UseAutosizeProps, \"disabled\" | \"ref\"> {\n /**\n * If `true`, the Textarea height auto-adjusts to text height.\n */\n autosize?: boolean\n /**\n * Ref to a resize function.\n */\n resizeRef?: ForwardedRef<() => void>\n}\n\nexport const useTextarea = ({\n autosize,\n maxRows,\n minRows,\n resizeRef,\n ...rest\n}: UseTextareaProps = {}) => {\n const { ref, onResizeTextarea } = useAutosize({\n disabled: !autosize,\n maxRows,\n minRows,\n })\n\n assignRef(resizeRef, onResizeTextarea)\n\n const getTextareaProps: PropGetter<\"textarea\"> = useCallback(\n (props = {}) =>\n mergeProps(\n rest,\n props,\n { ref },\n autosize\n ? { style: { resize: \"none\" as const }, onChange: onResizeTextarea }\n : undefined,\n )(),\n [autosize, onResizeTextarea, rest, ref],\n )\n\n return {\n getTextareaProps,\n onResizeTextarea,\n }\n}\n\nexport type UseTextareaReturn = ReturnType<typeof useTextarea>\n"],"mappings":";;;;;;AAsBA,MAAa,eAAe,EAC1B,UACA,SACA,SACA,WACA,GAAG,SACiB,CAAC,MAAM;CAC3B,MAAM,EAAE,KAAK,qBAAqBA,qBAAAA,YAAY;EAC5C,UAAU,CAAC;EACX;EACA;CACF,CAAC;CAED,YAAA,UAAU,WAAW,gBAAgB;CAerC,OAAO;EACL,mBAAA,GAd+CC,MAAAA,YAAAA,EAC9C,QAAQ,CAAC,MACRC,cAAAA,WACE,MACA,OACA,EAAE,IAAI,GACN,WACI;GAAE,OAAO,EAAE,QAAQ,OAAgB;GAAG,UAAU;EAAiB,IACjE,KAAA,CACN,CAAC,CAAC,GACJ;GAAC;GAAU;GAAkB;GAAM;EAAG,CAIvB;EACf;CACF;AACF"}
@@ -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,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,IAAI,WAAW,MAAM;IACnB,MAAM,EAAE,OAAO,OAAO,GAAG,SAAS;IAElC,OAAO,aAAa,oBAAC,YAAD,CAAW,CAAA,GAAG;KAChC,KAAK;KACL,UAAU,MAAM,KAAK,EAAE,OAAO,GAAG,QAAQ,UACvC,aAAa,oBAAC,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,OAAO,aAAa,oBAAC,UAAD,EAAQ,cAAY,MAAQ,CAAA,GAAG;KACjD,KAAK;KACL,UAAU;KACV,GAAG;IACL,CAAC;GACH;EACF,CAAC;EAEH,OACE,qBAAA,YAAA,EAAA,UAAA,CACG,cACC,oBAAC,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,eAA2B,aAC9B,WAAW;EAAE,GAAG;EAAW,GAAG;CAAM,IACrC,CAAC,SAAS,CACZ;CA2CA,OAAO;EAAE,eAzCmC,aACzC,EAAE,KAAK,GAAG,UAAU,CAAC,MACpB,WACE;GACE;GACA;GACA,UAAU,cAAc,KAAA,IAAY;GACpC,GAAG;GACH,GAAG;GACH,kBAAA,GAAiBA,cAAAA,SAAAA,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,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,IAAI,WAAW,MAAM;IACnB,MAAM,EAAE,OAAO,OAAO,GAAG,SAAS;IAElC,OAAO,aAAa,oBAAC,YAAD,CAAW,CAAA,GAAG;KAChC,KAAK;KACL,UAAU,MAAM,KAAK,EAAE,OAAO,GAAG,QAAQ,UACvC,aAAa,oBAAC,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,OAAO,aAAa,oBAAC,UAAD,EAAQ,cAAY,MAAQ,CAAA,GAAG;KACjD,KAAK;KACL,UAAU;KACV,GAAG;IACL,CAAC;GACH;EACF,CAAC;EAEH,OACE,qBAAA,YAAA,EAAA,UAAA,CACG,cACC,oBAAC,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,eAA2B,aAC9B,WAAW;EAAE,GAAG;EAAW,GAAG;CAAM,IACrC,CAAC,SAAS,CACZ;CAuCA,OAAO;EAAE,eArCmC,aACzC,QAAQ,CAAC,MACR,WACE,WACA,WACA,YACA;GACE,kBAAA,GAAiBA,cAAAA,SAAAA,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,cALS,aAC9B,WAAW;GAAE,GAAG;GAAW,GAAG;EAAM,IACrC,CAAC,SAAS,CAGuB;EAAG;CAAa;AACrD"}
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { assignRef, mergeRefs } from "../../utils/ref.js";
2
+ import { assignRef } from "../../utils/ref.js";
3
3
  import { mergeProps } from "../../core/components/props.js";
4
4
  import { useAutosize } from "./use-autosize.js";
5
5
  import { useCallback } from "react";
@@ -12,15 +12,10 @@ const useTextarea = ({ autosize, maxRows, minRows, resizeRef, ...rest } = {}) =>
12
12
  });
13
13
  assignRef(resizeRef, onResizeTextarea);
14
14
  return {
15
- getTextareaProps: useCallback((props = {}) => {
16
- return mergeProps(rest, props, {
17
- ref: mergeRefs(ref),
18
- ...autosize ? {
19
- style: { resize: "none" },
20
- onChange: onResizeTextarea
21
- } : {}
22
- })();
23
- }, [
15
+ getTextareaProps: useCallback((props = {}) => mergeProps(rest, props, { ref }, autosize ? {
16
+ style: { resize: "none" },
17
+ onChange: onResizeTextarea
18
+ } : void 0)(), [
24
19
  autosize,
25
20
  onResizeTextarea,
26
21
  rest,
@@ -1 +1 @@
1
- {"version":3,"file":"use-textarea.js","names":[],"sources":["../../../../src/components/textarea/use-textarea.ts"],"sourcesContent":["\"use client\"\n\nimport type { ForwardedRef } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { UseAutosizeProps } from \"./use-autosize\"\nimport { useCallback } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { assignRef, mergeRefs } from \"../../utils\"\nimport { useAutosize } from \"./use-autosize\"\n\nexport interface UseTextareaProps\n extends HTMLProps<\"textarea\">, Omit<UseAutosizeProps, \"disabled\" | \"ref\"> {\n /**\n * If `true`, the Textarea height auto-adjusts to text height.\n */\n autosize?: boolean\n /**\n * Ref to a resize function.\n */\n resizeRef?: ForwardedRef<() => void>\n}\n\nexport const useTextarea = ({\n autosize,\n maxRows,\n minRows,\n resizeRef,\n ...rest\n}: UseTextareaProps = {}) => {\n const { ref, onResizeTextarea } = useAutosize({\n disabled: !autosize,\n maxRows,\n minRows,\n })\n\n assignRef(resizeRef, onResizeTextarea)\n\n const getTextareaProps: PropGetter<\"textarea\"> = useCallback(\n (props = {}) => {\n const textareaProps = mergeProps(rest, props, {\n ref: mergeRefs(ref),\n ...(autosize\n ? {\n style: { resize: \"none\" as const },\n onChange: onResizeTextarea,\n }\n : {}),\n })()\n\n return textareaProps\n },\n [autosize, onResizeTextarea, rest, ref],\n )\n\n return {\n getTextareaProps,\n onResizeTextarea,\n }\n}\n\nexport type UseTextareaReturn = ReturnType<typeof useTextarea>\n"],"mappings":";;;;;;AAsBA,MAAa,eAAe,EAC1B,UACA,SACA,SACA,WACA,GAAG,SACiB,CAAC,MAAM;CAC3B,MAAM,EAAE,KAAK,qBAAqB,YAAY;EAC5C,UAAU,CAAC;EACX;EACA;CACF,CAAC;CAED,UAAU,WAAW,gBAAgB;CAmBrC,OAAO;EACL,kBAlB+C,aAC9C,QAAQ,CAAC,MAAM;GAWd,OAVsB,WAAW,MAAM,OAAO;IAC5C,KAAK,UAAU,GAAG;IAClB,GAAI,WACA;KACE,OAAO,EAAE,QAAQ,OAAgB;KACjC,UAAU;IACZ,IACA,CAAC;GACP,CAAC,CAAC,CAEiB;EACrB,GACA;GAAC;GAAU;GAAkB;GAAM;EAAG,CAIvB;EACf;CACF;AACF"}
1
+ {"version":3,"file":"use-textarea.js","names":[],"sources":["../../../../src/components/textarea/use-textarea.ts"],"sourcesContent":["\"use client\"\n\nimport type { ForwardedRef } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { UseAutosizeProps } from \"./use-autosize\"\nimport { useCallback } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { assignRef } from \"../../utils\"\nimport { useAutosize } from \"./use-autosize\"\n\nexport interface UseTextareaProps\n extends HTMLProps<\"textarea\">, Omit<UseAutosizeProps, \"disabled\" | \"ref\"> {\n /**\n * If `true`, the Textarea height auto-adjusts to text height.\n */\n autosize?: boolean\n /**\n * Ref to a resize function.\n */\n resizeRef?: ForwardedRef<() => void>\n}\n\nexport const useTextarea = ({\n autosize,\n maxRows,\n minRows,\n resizeRef,\n ...rest\n}: UseTextareaProps = {}) => {\n const { ref, onResizeTextarea } = useAutosize({\n disabled: !autosize,\n maxRows,\n minRows,\n })\n\n assignRef(resizeRef, onResizeTextarea)\n\n const getTextareaProps: PropGetter<\"textarea\"> = useCallback(\n (props = {}) =>\n mergeProps(\n rest,\n props,\n { ref },\n autosize\n ? { style: { resize: \"none\" as const }, onChange: onResizeTextarea }\n : undefined,\n )(),\n [autosize, onResizeTextarea, rest, ref],\n )\n\n return {\n getTextareaProps,\n onResizeTextarea,\n }\n}\n\nexport type UseTextareaReturn = ReturnType<typeof useTextarea>\n"],"mappings":";;;;;;AAsBA,MAAa,eAAe,EAC1B,UACA,SACA,SACA,WACA,GAAG,SACiB,CAAC,MAAM;CAC3B,MAAM,EAAE,KAAK,qBAAqB,YAAY;EAC5C,UAAU,CAAC;EACX;EACA;CACF,CAAC;CAED,UAAU,WAAW,gBAAgB;CAerC,OAAO;EACL,kBAd+C,aAC9C,QAAQ,CAAC,MACR,WACE,MACA,OACA,EAAE,IAAI,GACN,WACI;GAAE,OAAO,EAAE,QAAQ,OAAgB;GAAG,UAAU;EAAiB,IACjE,KAAA,CACN,CAAC,CAAC,GACJ;GAAC;GAAU;GAAkB;GAAM;EAAG,CAIvB;EACf;CACF;AACF"}
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-20261111232831",
4
+ "version": "2.3.4-dev-20261114103548",
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",