@yamada-ui/react 2.3.4-dev-20261116083348 → 2.3.4-dev-20261116090813
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/dropzone/use-dropzone.cjs +8 -12
- package/dist/cjs/components/dropzone/use-dropzone.cjs.map +1 -1
- package/dist/cjs/components/file-input/use-file-input.cjs +5 -12
- package/dist/cjs/components/file-input/use-file-input.cjs.map +1 -1
- package/dist/esm/components/dropzone/use-dropzone.js +8 -12
- package/dist/esm/components/dropzone/use-dropzone.js.map +1 -1
- package/dist/esm/components/file-input/use-file-input.js +5 -12
- package/dist/esm/components/file-input/use-file-input.js.map +1 -1
- package/dist/types/components/avatar/avatar.d.ts +3 -3
- package/dist/types/components/avatar/avatar.style.d.ts +1 -1
- package/dist/types/components/calendar/calendar.style.d.ts +2 -2
- package/dist/types/components/carousel/carousel.style.d.ts +2 -2
- package/dist/types/components/chart/cartesian-chart.style.d.ts +1 -1
- package/dist/types/components/chart/polar-chart.style.d.ts +1 -1
- package/dist/types/components/checkbox/checkbox.d.ts +1 -1
- package/dist/types/components/checkbox-card/checkbox-card.d.ts +1 -1
- package/dist/types/components/icon/icon.d.ts +1 -1
- package/dist/types/components/loading/loading.d.ts +1 -1
- package/dist/types/components/number-input/number-input.style.d.ts +1 -1
- package/dist/types/components/radio/radio.d.ts +1 -1
- package/dist/types/components/radio-card/radio-card.d.ts +1 -1
- package/dist/types/components/toggle/toggle.d.ts +1 -1
- package/dist/types/providers/i18n-provider/i18n-provider.d.ts +1 -1
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ let file_selector = require("file-selector");
|
|
|
8
8
|
let react_dropzone = require("react-dropzone");
|
|
9
9
|
// src/components/dropzone/use-dropzone.ts
|
|
10
10
|
const useDropzone = (props = {}) => {
|
|
11
|
-
const { props: { id, name, accept, autoFocus = false, disabled, getFilesFromEvent = file_selector.fromEvent, loading, maxFiles = 0, maxSize = Infinity, minSize = 0, multiple = false, noClick = false, noDrag = false, noDragEventsBubbling = false, noKeyboard = false, openRef, preventDropOnDocument = true, readOnly, useFsAccessApi = false, validator, onDragEnter, onDragLeave, onDragOver, onDrop, onDropAccepted, onDropRejected, onError, onFileDialogCancel, onFileDialogOpen, ...rest }, ariaProps, dataProps, eventProps } = require_use_field_props.useFieldProps(props);
|
|
11
|
+
const { props: { id, ref: refProp, name, accept, autoFocus = false, disabled, getFilesFromEvent = file_selector.fromEvent, loading, maxFiles = 0, maxSize = Infinity, minSize = 0, multiple = false, noClick = false, noDrag = false, noDragEventsBubbling = false, noKeyboard = false, openRef, preventDropOnDocument = true, readOnly, useFsAccessApi = false, validator, onDragEnter, onDragLeave, onDragOver, onDrop, onDropAccepted, onDropRejected, onError, onFileDialogCancel, onFileDialogOpen, ...rest }, ariaProps, dataProps, eventProps } = require_use_field_props.useFieldProps(props);
|
|
12
12
|
const labelledbyId = (0, react.useId)();
|
|
13
13
|
const interactive = !(loading || readOnly || disabled);
|
|
14
14
|
const { acceptedFiles, fileRejections, isDragAccept: dragAccept, isDragActive: dragActive, isDragReject: dragReject, isFocused: focused, open, getInputProps: getOriginalInputProps, getRootProps: getOriginalRootProps } = (0, react_dropzone.useDropzone)({
|
|
@@ -43,20 +43,17 @@ const useDropzone = (props = {}) => {
|
|
|
43
43
|
const dragIdle = !dragAccept && !dragReject;
|
|
44
44
|
require_ref.assignRef(openRef, open);
|
|
45
45
|
const getRootProps = (0, react.useCallback)(({ ref, ...props } = {}) => {
|
|
46
|
-
const { ref:
|
|
47
|
-
const { ref: rootRef, ...rootProps } = getOriginalRootProps(require_props.mergeProps({
|
|
46
|
+
const { ref: rootRef, ...rootProps } = getOriginalRootProps(require_props.mergeProps(dataProps, eventProps, {
|
|
48
47
|
id: labelledbyId,
|
|
49
|
-
...dataProps,
|
|
50
|
-
...eventProps,
|
|
51
48
|
"aria-disabled": (0, require_utils_index.utils_exports.ariaAttr)(!interactive),
|
|
52
49
|
"data-accept": (0, require_utils_index.utils_exports.dataAttr)(dragAccept),
|
|
53
50
|
"data-idle": (0, require_utils_index.utils_exports.dataAttr)(dragIdle),
|
|
54
51
|
"data-loading": (0, require_utils_index.utils_exports.dataAttr)(loading),
|
|
55
52
|
"data-reject": (0, require_utils_index.utils_exports.dataAttr)(dragReject)
|
|
56
|
-
},
|
|
53
|
+
}, rest, props)());
|
|
57
54
|
return {
|
|
58
55
|
...rootProps,
|
|
59
|
-
ref: require_ref.mergeRefs(
|
|
56
|
+
ref: require_ref.mergeRefs(refProp, ref, rootRef)
|
|
60
57
|
};
|
|
61
58
|
}, [
|
|
62
59
|
getOriginalRootProps,
|
|
@@ -68,6 +65,7 @@ const useDropzone = (props = {}) => {
|
|
|
68
65
|
dragIdle,
|
|
69
66
|
loading,
|
|
70
67
|
dragReject,
|
|
68
|
+
refProp,
|
|
71
69
|
rest
|
|
72
70
|
]);
|
|
73
71
|
return {
|
|
@@ -80,14 +78,12 @@ const useDropzone = (props = {}) => {
|
|
|
80
78
|
focused,
|
|
81
79
|
loading,
|
|
82
80
|
open,
|
|
83
|
-
getInputProps: (0, react.useCallback)((props = {}) => getOriginalInputProps(require_props.mergeProps({
|
|
81
|
+
getInputProps: (0, react.useCallback)((props = {}) => getOriginalInputProps(require_props.mergeProps(ariaProps, dataProps, {
|
|
84
82
|
id,
|
|
85
83
|
name,
|
|
84
|
+
"aria-labelledby": labelledbyId,
|
|
86
85
|
disabled,
|
|
87
|
-
readOnly
|
|
88
|
-
...ariaProps,
|
|
89
|
-
...dataProps,
|
|
90
|
-
"aria-labelledby": labelledbyId
|
|
86
|
+
readOnly
|
|
91
87
|
}, props)()), [
|
|
92
88
|
getOriginalInputProps,
|
|
93
89
|
id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-dropzone.cjs","names":["fromEvent","useFieldProps","useId","useOriginalDropzone","useCallback","mergeProps","mergeRefs"],"sources":["../../../../src/components/dropzone/use-dropzone.ts"],"sourcesContent":["\"use client\"\n\nimport type { RefObject } from \"react\"\nimport type { Accept, DropzoneOptions } from \"react-dropzone\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { FieldProps } from \"../field\"\nimport { fromEvent } from \"file-selector\"\nimport { useCallback, useId } from \"react\"\nimport { useDropzone as useOriginalDropzone } from \"react-dropzone\"\nimport { mergeProps } from \"../../core\"\nimport { ariaAttr, assignRef, dataAttr, isArray, mergeRefs } from \"../../utils\"\nimport { useFieldProps } from \"../field\"\n\nexport interface UseDropzoneProps\n extends Omit<HTMLProps, \"onDrop\" | \"onError\">, FieldProps {\n /**\n * Set accepted file types.\n */\n accept?: Accept | string[]\n /**\n * Set to true to focus the root element on render.\n *\n * @default false\n */\n autoFocus?: boolean\n /**\n * Use this to provide a custom file aggregator.\n */\n getFilesFromEvent?: DropzoneOptions[\"getFilesFromEvent\"]\n /**\n * If `true`, display the dropzone loading icon.\n *\n * @default false\n */\n loading?: boolean\n /**\n * Maximum accepted number of files.\n * The default value is 0 which means there is no limitation to how many files are accepted.\n *\n * @default 0\n */\n maxFiles?: number\n /**\n * Maximum file size (in bytes).\n *\n * @default Infinity\n */\n maxSize?: number\n /**\n * Minimum file size (in bytes).\n *\n * @default 0\n */\n minSize?: number\n /**\n * Allow drag and drop (or selection from the file dialog) of multiple files.\n *\n * @default false\n */\n multiple?: boolean\n /**\n * The HTML `name` attribute used for forms.\n */\n name?: string\n /**\n * If true, disables click to open the native file selection dialog.\n *\n * @default false\n */\n noClick?: boolean\n /**\n * If true, disables drag and drop.\n *\n * @default false\n */\n noDrag?: boolean\n /**\n * If true, stops drag event propagation to parents.\n *\n * @default false\n */\n noDragEventsBubbling?: boolean\n /**\n * If true, disables `space` and `enter` to open the native file selection dialog.\n * Note that it also stops tracking the focus state.\n *\n * @default false\n */\n noKeyboard?: boolean\n /**\n * Ref to a open function.\n */\n openRef?: RefObject<() => void>\n /**\n * If false, allow dropped items to take over the current browser window.\n *\n * @default true\n */\n preventDropOnDocument?: boolean\n /**\n * If true, use the [File System API](https://developer.mozilla.org/en-US/docs/Web/API/File_System_API) to read files.\n *\n * @default false\n */\n useFsAccessApi?: boolean\n /**\n * Custom validation function.\n * It must return null if there's no errors.\n */\n validator?: DropzoneOptions[\"validator\"]\n /**\n * Callback for when the dragenter event occurs.\n */\n onDragEnter?: DropzoneOptions[\"onDragEnter\"]\n /**\n * Callback for when the dragleave event occurs.\n */\n onDragLeave?: DropzoneOptions[\"onDragLeave\"]\n /**\n * Callback for when the dragover event occurs.\n */\n onDragOver?: DropzoneOptions[\"onDragOver\"]\n /**\n * Callback for when the drop event occurs.\n * Note that this callback is invoked after the `getFilesFromEvent` callback is done.\n */\n onDrop?: DropzoneOptions[\"onDrop\"]\n /**\n * Callback for when the drop event occurs.\n * Note that if no files are accepted, this callback is not invoked.\n */\n onDropAccepted?: DropzoneOptions[\"onDropAccepted\"]\n /**\n * Callback for when the drop event occurs.\n * Note that if no files are rejected, this callback is not invoked.\n */\n onDropRejected?: DropzoneOptions[\"onDropRejected\"]\n /**\n * Callback for when there's some error from any of the promises.\n */\n onError?: DropzoneOptions[\"onError\"]\n /**\n * Callback for when closing the file dialog with no selection.\n */\n onFileDialogCancel?: DropzoneOptions[\"onFileDialogCancel\"]\n /**\n * Callback for when opening the file dialog.\n */\n onFileDialogOpen?: DropzoneOptions[\"onFileDialogOpen\"]\n}\n\nexport const useDropzone = (props: UseDropzoneProps = {}) => {\n const {\n props: {\n id,\n name,\n accept,\n autoFocus = false,\n disabled,\n getFilesFromEvent = fromEvent,\n loading,\n maxFiles = 0,\n maxSize = Infinity,\n minSize = 0,\n multiple = false,\n noClick = false,\n noDrag = false,\n noDragEventsBubbling = false,\n noKeyboard = false,\n openRef,\n preventDropOnDocument = true,\n readOnly,\n useFsAccessApi = false,\n validator,\n onDragEnter,\n onDragLeave,\n onDragOver,\n onDrop,\n onDropAccepted,\n onDropRejected,\n onError,\n onFileDialogCancel,\n onFileDialogOpen,\n ...rest\n },\n ariaProps,\n dataProps,\n eventProps,\n } = useFieldProps(props)\n const labelledbyId = useId()\n const interactive = !(loading || readOnly || disabled)\n const {\n acceptedFiles,\n fileRejections,\n isDragAccept: dragAccept,\n isDragActive: dragActive,\n isDragReject: dragReject,\n isFocused: focused,\n open,\n getInputProps: getOriginalInputProps,\n getRootProps: getOriginalRootProps,\n } = useOriginalDropzone({\n accept: isArray(accept)\n ? accept.reduce((prev, current) => ({ ...prev, [current]: [] }), {})\n : accept,\n autoFocus,\n disabled: !interactive,\n getFilesFromEvent,\n maxFiles,\n maxSize,\n minSize,\n multiple,\n noClick,\n noDrag,\n noDragEventsBubbling,\n noKeyboard,\n preventDropOnDocument,\n useFsAccessApi,\n validator,\n onDragEnter,\n onDragLeave,\n onDragOver,\n onDrop,\n onDropAccepted,\n onDropRejected,\n onError,\n onFileDialogCancel,\n onFileDialogOpen,\n })\n const dragIdle = !dragAccept && !dragReject\n\n assignRef(openRef, open)\n\n const getRootProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) => {\n const { ref:
|
|
1
|
+
{"version":3,"file":"use-dropzone.cjs","names":["fromEvent","useFieldProps","useId","useOriginalDropzone","useCallback","mergeProps","mergeRefs"],"sources":["../../../../src/components/dropzone/use-dropzone.ts"],"sourcesContent":["\"use client\"\n\nimport type { RefObject } from \"react\"\nimport type { Accept, DropzoneOptions } from \"react-dropzone\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { FieldProps } from \"../field\"\nimport { fromEvent } from \"file-selector\"\nimport { useCallback, useId } from \"react\"\nimport { useDropzone as useOriginalDropzone } from \"react-dropzone\"\nimport { mergeProps } from \"../../core\"\nimport { ariaAttr, assignRef, dataAttr, isArray, mergeRefs } from \"../../utils\"\nimport { useFieldProps } from \"../field\"\n\nexport interface UseDropzoneProps\n extends Omit<HTMLProps, \"onDrop\" | \"onError\">, FieldProps {\n /**\n * Set accepted file types.\n */\n accept?: Accept | string[]\n /**\n * Set to true to focus the root element on render.\n *\n * @default false\n */\n autoFocus?: boolean\n /**\n * Use this to provide a custom file aggregator.\n */\n getFilesFromEvent?: DropzoneOptions[\"getFilesFromEvent\"]\n /**\n * If `true`, display the dropzone loading icon.\n *\n * @default false\n */\n loading?: boolean\n /**\n * Maximum accepted number of files.\n * The default value is 0 which means there is no limitation to how many files are accepted.\n *\n * @default 0\n */\n maxFiles?: number\n /**\n * Maximum file size (in bytes).\n *\n * @default Infinity\n */\n maxSize?: number\n /**\n * Minimum file size (in bytes).\n *\n * @default 0\n */\n minSize?: number\n /**\n * Allow drag and drop (or selection from the file dialog) of multiple files.\n *\n * @default false\n */\n multiple?: boolean\n /**\n * The HTML `name` attribute used for forms.\n */\n name?: string\n /**\n * If true, disables click to open the native file selection dialog.\n *\n * @default false\n */\n noClick?: boolean\n /**\n * If true, disables drag and drop.\n *\n * @default false\n */\n noDrag?: boolean\n /**\n * If true, stops drag event propagation to parents.\n *\n * @default false\n */\n noDragEventsBubbling?: boolean\n /**\n * If true, disables `space` and `enter` to open the native file selection dialog.\n * Note that it also stops tracking the focus state.\n *\n * @default false\n */\n noKeyboard?: boolean\n /**\n * Ref to a open function.\n */\n openRef?: RefObject<() => void>\n /**\n * If false, allow dropped items to take over the current browser window.\n *\n * @default true\n */\n preventDropOnDocument?: boolean\n /**\n * If true, use the [File System API](https://developer.mozilla.org/en-US/docs/Web/API/File_System_API) to read files.\n *\n * @default false\n */\n useFsAccessApi?: boolean\n /**\n * Custom validation function.\n * It must return null if there's no errors.\n */\n validator?: DropzoneOptions[\"validator\"]\n /**\n * Callback for when the dragenter event occurs.\n */\n onDragEnter?: DropzoneOptions[\"onDragEnter\"]\n /**\n * Callback for when the dragleave event occurs.\n */\n onDragLeave?: DropzoneOptions[\"onDragLeave\"]\n /**\n * Callback for when the dragover event occurs.\n */\n onDragOver?: DropzoneOptions[\"onDragOver\"]\n /**\n * Callback for when the drop event occurs.\n * Note that this callback is invoked after the `getFilesFromEvent` callback is done.\n */\n onDrop?: DropzoneOptions[\"onDrop\"]\n /**\n * Callback for when the drop event occurs.\n * Note that if no files are accepted, this callback is not invoked.\n */\n onDropAccepted?: DropzoneOptions[\"onDropAccepted\"]\n /**\n * Callback for when the drop event occurs.\n * Note that if no files are rejected, this callback is not invoked.\n */\n onDropRejected?: DropzoneOptions[\"onDropRejected\"]\n /**\n * Callback for when there's some error from any of the promises.\n */\n onError?: DropzoneOptions[\"onError\"]\n /**\n * Callback for when closing the file dialog with no selection.\n */\n onFileDialogCancel?: DropzoneOptions[\"onFileDialogCancel\"]\n /**\n * Callback for when opening the file dialog.\n */\n onFileDialogOpen?: DropzoneOptions[\"onFileDialogOpen\"]\n}\n\nexport const useDropzone = (props: UseDropzoneProps = {}) => {\n const {\n props: {\n id,\n ref: refProp,\n name,\n accept,\n autoFocus = false,\n disabled,\n getFilesFromEvent = fromEvent,\n loading,\n maxFiles = 0,\n maxSize = Infinity,\n minSize = 0,\n multiple = false,\n noClick = false,\n noDrag = false,\n noDragEventsBubbling = false,\n noKeyboard = false,\n openRef,\n preventDropOnDocument = true,\n readOnly,\n useFsAccessApi = false,\n validator,\n onDragEnter,\n onDragLeave,\n onDragOver,\n onDrop,\n onDropAccepted,\n onDropRejected,\n onError,\n onFileDialogCancel,\n onFileDialogOpen,\n ...rest\n },\n ariaProps,\n dataProps,\n eventProps,\n } = useFieldProps(props)\n const labelledbyId = useId()\n const interactive = !(loading || readOnly || disabled)\n const {\n acceptedFiles,\n fileRejections,\n isDragAccept: dragAccept,\n isDragActive: dragActive,\n isDragReject: dragReject,\n isFocused: focused,\n open,\n getInputProps: getOriginalInputProps,\n getRootProps: getOriginalRootProps,\n } = useOriginalDropzone({\n accept: isArray(accept)\n ? accept.reduce((prev, current) => ({ ...prev, [current]: [] }), {})\n : accept,\n autoFocus,\n disabled: !interactive,\n getFilesFromEvent,\n maxFiles,\n maxSize,\n minSize,\n multiple,\n noClick,\n noDrag,\n noDragEventsBubbling,\n noKeyboard,\n preventDropOnDocument,\n useFsAccessApi,\n validator,\n onDragEnter,\n onDragLeave,\n onDragOver,\n onDrop,\n onDropAccepted,\n onDropRejected,\n onError,\n onFileDialogCancel,\n onFileDialogOpen,\n })\n const dragIdle = !dragAccept && !dragReject\n\n assignRef(openRef, open)\n\n const getRootProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) => {\n const { ref: rootRef, ...rootProps } = getOriginalRootProps(\n mergeProps(\n dataProps,\n eventProps,\n {\n id: labelledbyId,\n \"aria-disabled\": ariaAttr(!interactive),\n \"data-accept\": dataAttr(dragAccept),\n \"data-idle\": dataAttr(dragIdle),\n \"data-loading\": dataAttr(loading),\n \"data-reject\": dataAttr(dragReject),\n },\n rest,\n props,\n )(),\n ) as HTMLProps\n\n return { ...rootProps, ref: mergeRefs(refProp, ref, rootRef) }\n },\n [\n getOriginalRootProps,\n labelledbyId,\n dataProps,\n eventProps,\n interactive,\n dragAccept,\n dragIdle,\n loading,\n dragReject,\n refProp,\n rest,\n ],\n )\n\n const getInputProps: PropGetter<\"input\"> = useCallback(\n (props = {}) =>\n getOriginalInputProps(\n mergeProps(\n ariaProps,\n dataProps,\n {\n id,\n name,\n \"aria-labelledby\": labelledbyId,\n disabled,\n readOnly,\n },\n props,\n )(),\n ),\n [\n getOriginalInputProps,\n id,\n name,\n disabled,\n readOnly,\n ariaProps,\n dataProps,\n labelledbyId,\n ],\n )\n\n return {\n acceptedFiles,\n dragAccept,\n dragActive,\n dragIdle,\n dragReject,\n fileRejections,\n focused,\n loading,\n open,\n getInputProps,\n getRootProps,\n }\n}\n\nexport type UseDropzoneReturn = ReturnType<typeof useDropzone>\n"],"mappings":";;;;;;;;;AAuJA,MAAa,eAAe,QAA0B,CAAC,MAAM;CAC3D,MAAM,EACJ,OAAO,EACL,IACA,KAAK,SACL,MACA,QACA,YAAY,OACZ,UACA,oBAAoBA,cAAAA,WACpB,SACA,WAAW,GACX,UAAU,UACV,UAAU,GACV,WAAW,OACX,UAAU,OACV,SAAS,OACT,uBAAuB,OACvB,aAAa,OACb,SACA,wBAAwB,MACxB,UACA,iBAAiB,OACjB,WACA,aACA,aACA,YACA,QACA,gBACA,gBACA,SACA,oBACA,kBACA,GAAG,QAEL,WACA,WACA,eACEC,wBAAAA,cAAc,KAAK;CACvB,MAAM,gBAAA,GAAeC,MAAAA,MAAAA,CAAM;CAC3B,MAAM,cAAc,EAAE,WAAW,YAAY;CAC7C,MAAM,EACJ,eACA,gBACA,cAAc,YACd,cAAc,YACd,cAAc,YACd,WAAW,SACX,MACA,eAAe,uBACf,cAAc,0BAAA,GACZC,eAAAA,YAAAA,CAAoB;EACtB,SAAA,GAAA,oBAAA,cAAQ,QAAA,CAAQ,MAAM,IAClB,OAAO,QAAQ,MAAM,aAAa;GAAE,GAAG;IAAO,UAAU,CAAC;EAAE,IAAI,CAAC,CAAC,IACjE;EACJ;EACA,UAAU,CAAC;EACX;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CACD,MAAM,WAAW,CAAC,cAAc,CAAC;CAEjC,YAAA,UAAU,SAAS,IAAI;CAEvB,MAAM,gBAAA,GAA2BC,MAAAA,YAAAA,EAC9B,EAAE,KAAK,GAAG,UAAU,CAAC,MAAM;EAC1B,MAAM,EAAE,KAAK,SAAS,GAAG,cAAc,qBACrCC,cAAAA,WACE,WACA,YACA;GACE,IAAI;GACJ,kBAAA,GAAA,oBAAA,cAAiB,SAAA,CAAS,CAAC,WAAW;GACtC,gBAAA,GAAA,oBAAA,cAAe,SAAA,CAAS,UAAU;GAClC,cAAA,GAAA,oBAAA,cAAa,SAAA,CAAS,QAAQ;GAC9B,iBAAA,GAAA,oBAAA,cAAgB,SAAA,CAAS,OAAO;GAChC,gBAAA,GAAA,oBAAA,cAAe,SAAA,CAAS,UAAU;EACpC,GACA,MACA,KACF,CAAC,CAAC,CACJ;EAEA,OAAO;GAAE,GAAG;GAAW,KAAKC,YAAAA,UAAU,SAAS,KAAK,OAAO;EAAE;CAC/D,GACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CA8BA,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,gBAAA,GAtCyCF,MAAAA,YAAAA,EACxC,QAAQ,CAAC,MACR,sBACEC,cAAAA,WACE,WACA,WACA;GACE;GACA;GACA,mBAAmB;GACnB;GACA;EACF,GACA,KACF,CAAC,CAAC,CACJ,GACF;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,CAaY;EACZ;CACF;AACF"}
|
|
@@ -9,7 +9,7 @@ const require_use_field_props = require("../field/use-field-props.cjs");
|
|
|
9
9
|
let react = require("react");
|
|
10
10
|
// src/components/file-input/use-file-input.ts
|
|
11
11
|
const useFileInput = (props) => {
|
|
12
|
-
const { context: { labelId } = {}, props: { id, ref, form, name, accept, defaultValue, disabled, multiple, placeholder, readOnly, required, resetRef, value, onChange: onChangeProp,
|
|
12
|
+
const { context: { labelId } = {}, props: { id, ref, form, name, accept, defaultValue, disabled, multiple, placeholder, readOnly, required, resetRef, value, onChange: onChangeProp, ...rest }, ariaProps, dataProps, eventProps } = require_use_field_props.useFieldProps({
|
|
13
13
|
...props,
|
|
14
14
|
notSupportReadOnly: true
|
|
15
15
|
});
|
|
@@ -33,21 +33,14 @@ const useFileInput = (props) => {
|
|
|
33
33
|
const files = !(0, require_utils_index.utils_exports.isNull)(ev.currentTarget.files) ? Array.from(ev.currentTarget.files) : void 0;
|
|
34
34
|
setValues(files?.length ? files : void 0);
|
|
35
35
|
}, [setValues]);
|
|
36
|
-
const clickableProps = require_hooks_use_clickable_index.useClickable({
|
|
37
|
-
...ariaProps,
|
|
38
|
-
...dataProps,
|
|
39
|
-
...eventProps,
|
|
40
|
-
...rest,
|
|
36
|
+
const clickableProps = require_hooks_use_clickable_index.useClickable(require_props.mergeProps(ariaProps, dataProps, eventProps, rest, {
|
|
41
37
|
disabled: !interactive,
|
|
42
38
|
focusable: readOnly && !disabled,
|
|
43
39
|
focusOnClick: interactive,
|
|
44
|
-
onClick
|
|
45
|
-
});
|
|
40
|
+
onClick
|
|
41
|
+
})());
|
|
46
42
|
require_ref.assignRef(resetRef, onReset);
|
|
47
|
-
const getInputProps = (0, react.useCallback)((props = {}) => require_props.mergeProps({
|
|
48
|
-
...require_dom.visuallyHiddenAttributes,
|
|
49
|
-
...ariaProps,
|
|
50
|
-
...dataProps,
|
|
43
|
+
const getInputProps = (0, react.useCallback)((props = {}) => require_props.mergeProps(require_dom.visuallyHiddenAttributes, ariaProps, dataProps, {
|
|
51
44
|
id,
|
|
52
45
|
ref: inputRef,
|
|
53
46
|
form,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-file-input.cjs","names":["useFieldProps","useRef","useControllableState","useCallback","useClickable","mergeProps","visuallyHiddenAttributes"],"sources":["../../../../src/components/file-input/use-file-input.ts"],"sourcesContent":["\"use client\"\n\nimport type { ChangeEvent, RefObject } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { Dict } from \"../../utils\"\nimport type { FieldProps } from \"../field\"\nimport { useCallback, useRef } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useClickable } from \"../../hooks/use-clickable\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport {\n assignRef,\n dataAttr,\n
|
|
1
|
+
{"version":3,"file":"use-file-input.cjs","names":["useFieldProps","useRef","useControllableState","useCallback","useClickable","mergeProps","visuallyHiddenAttributes"],"sources":["../../../../src/components/file-input/use-file-input.ts"],"sourcesContent":["\"use client\"\n\nimport type { ChangeEvent, RefObject } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { Dict } from \"../../utils\"\nimport type { FieldProps } from \"../field\"\nimport { useCallback, useRef } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useClickable } from \"../../hooks/use-clickable\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport {\n assignRef,\n dataAttr,\n has,\n isNull,\n visuallyHiddenAttributes,\n} from \"../../utils\"\nimport { useFieldProps } from \"../field\"\n\nexport type UseFileInputProps<Y extends \"button\" | \"input\" = \"input\"> =\n FieldProps &\n Omit<HTMLProps<Y>, \"defaultValue\" | \"onChange\" | \"ref\" | \"value\"> &\n Pick<HTMLProps<\"input\">, \"accept\" | \"multiple\" | \"placeholder\" | \"ref\"> & {\n /**\n * The initial value of the file input.\n */\n defaultValue?: File[]\n /**\n * Ref to a reset function.\n */\n resetRef?: RefObject<(() => void) | null>\n /**\n * The value of the file input.\n */\n value?: File[]\n /**\n * Function to be called when a file change event occurs.\n */\n onChange?: (files: File[] | undefined) => void\n }\n\nexport const useFileInput = <Y extends \"button\" | \"input\" = \"input\">(\n props: UseFileInputProps<Y>,\n) => {\n const {\n context: { labelId } = {},\n props: {\n id,\n ref,\n form,\n name,\n accept,\n defaultValue,\n disabled,\n multiple,\n placeholder,\n readOnly,\n required,\n resetRef,\n value,\n onChange: onChangeProp,\n ...rest\n },\n ariaProps,\n dataProps,\n eventProps,\n } = useFieldProps<HTMLElement, UseFileInputProps<Y>>({\n ...props,\n notSupportReadOnly: true,\n })\n const interactive = !(readOnly || disabled)\n const inputRef = useRef<HTMLInputElement>(null)\n const [values, setValues] = useControllableState<File[] | undefined>({\n defaultValue,\n value,\n onChange: onChangeProp,\n })\n const count = values?.length ?? 0\n\n const onClick = useCallback(() => {\n if (!interactive) return\n\n inputRef.current?.click()\n }, [interactive])\n\n const onReset = useCallback(() => {\n if (inputRef.current) inputRef.current.value = \"\"\n\n setValues(undefined)\n }, [setValues])\n\n const onChange = useCallback(\n (ev: ChangeEvent<HTMLInputElement>) => {\n const files = !isNull(ev.currentTarget.files)\n ? Array.from(ev.currentTarget.files)\n : undefined\n\n setValues(files?.length ? files : undefined)\n },\n [setValues],\n )\n\n const clickableProps = useClickable<HTMLElement, Dict>(\n mergeProps(ariaProps, dataProps, eventProps, rest, {\n disabled: !interactive,\n focusable: readOnly && !disabled,\n focusOnClick: interactive,\n onClick,\n })(),\n )\n\n assignRef(resetRef, onReset)\n\n const getInputProps: PropGetter<\"input\"> = useCallback(\n (props = {}) =>\n mergeProps(\n visuallyHiddenAttributes,\n ariaProps,\n dataProps,\n {\n id,\n ref: inputRef,\n form,\n type: \"file\",\n name,\n accept,\n disabled,\n multiple,\n readOnly,\n required,\n },\n props,\n { ref, onChange },\n )(),\n [\n required,\n ariaProps,\n dataProps,\n id,\n form,\n name,\n accept,\n disabled,\n multiple,\n readOnly,\n ref,\n onChange,\n ],\n )\n\n const getFieldProps: PropGetter = useCallback(\n (props = {}) => {\n const hasLabel =\n has(props, [\"aria-label\", \"aria-labelledby\"], { truthy: true }) ||\n has(clickableProps, [\"aria-label\", \"aria-labelledby\"], { truthy: true })\n const hasPlaceholder = !!placeholder?.trim()\n const hasValues = !!count\n\n return mergeProps(\n {\n \"data-placeholder\": dataAttr(!count),\n ...clickableProps,\n \"aria-labelledby\":\n clickableProps[\"aria-labelledby\"] ??\n (!hasLabel && !hasPlaceholder && !hasValues ? labelId : undefined),\n tabIndex: interactive ? 0 : clickableProps.tabIndex,\n },\n props,\n )()\n },\n [clickableProps, count, interactive, labelId, placeholder],\n )\n\n return {\n disabled,\n interactive,\n readOnly,\n required,\n values,\n clickableProps,\n getFieldProps,\n getInputProps,\n }\n}\n\nexport type UseFileInputReturn = ReturnType<typeof useFileInput>\n"],"mappings":";;;;;;;;;;AAyCA,MAAa,gBACX,UACG;CACH,MAAM,EACJ,SAAS,EAAE,YAAY,CAAC,GACxB,OAAO,EACL,IACA,KACA,MACA,MACA,QACA,cACA,UACA,UACA,aACA,UACA,UACA,UACA,OACA,UAAU,cACV,GAAG,QAEL,WACA,WACA,eACEA,wBAAAA,cAAiD;EACnD,GAAG;EACH,oBAAoB;CACtB,CAAC;CACD,MAAM,cAAc,EAAE,YAAY;CAClC,MAAM,YAAA,GAAWC,MAAAA,OAAAA,CAAyB,IAAI;CAC9C,MAAM,CAAC,QAAQ,aAAaC,2CAAAA,qBAAyC;EACnE;EACA;EACA,UAAU;CACZ,CAAC;CACD,MAAM,QAAQ,QAAQ,UAAU;CAEhC,MAAM,WAAA,GAAUC,MAAAA,YAAAA,OAAkB;EAChC,IAAI,CAAC,aAAa;EAElB,SAAS,SAAS,MAAM;CAC1B,GAAG,CAAC,WAAW,CAAC;CAEhB,MAAM,WAAA,GAAUA,MAAAA,YAAAA,OAAkB;EAChC,IAAI,SAAS,SAAS,SAAS,QAAQ,QAAQ;EAE/C,UAAU,KAAA,CAAS;CACrB,GAAG,CAAC,SAAS,CAAC;CAEd,MAAM,YAAA,GAAWA,MAAAA,YAAAA,EACd,OAAsC;EACrC,MAAM,QAAQ,EAAA,GAAA,oBAAA,cAAC,OAAA,CAAO,GAAG,cAAc,KAAK,IACxC,MAAM,KAAK,GAAG,cAAc,KAAK,IACjC,KAAA;EAEJ,UAAU,OAAO,SAAS,QAAQ,KAAA,CAAS;CAC7C,GACA,CAAC,SAAS,CACZ;CAEA,MAAM,iBAAiBC,kCAAAA,aACrBC,cAAAA,WAAW,WAAW,WAAW,YAAY,MAAM;EACjD,UAAU,CAAC;EACX,WAAW,YAAY,CAAC;EACxB,cAAc;EACd;CACF,CAAC,CAAC,CAAC,CACL;CAEA,YAAA,UAAU,UAAU,OAAO;CAE3B,MAAM,iBAAA,GAAqCF,MAAAA,YAAAA,EACxC,QAAQ,CAAC,MACRE,cAAAA,WACEC,YAAAA,0BACA,WACA,WACA;EACE;EACA,KAAK;EACL;EACA,MAAM;EACN;EACA;EACA;EACA;EACA;EACA;CACF,GACA,OACA;EAAE;EAAK;CAAS,CAClB,CAAC,CAAC,GACJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CAyBA,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA,gBAAA,GA9BgCH,MAAAA,YAAAA,EAC/B,QAAQ,CAAC,MAAM;GACd,MAAM,YAAA,GAAA,oBAAA,cACJ,IAAA,CAAI,OAAO,CAAC,cAAc,iBAAiB,GAAG,EAAE,QAAQ,KAAK,CAAC,MAAA,GAAA,oBAAA,cAC9D,IAAA,CAAI,gBAAgB,CAAC,cAAc,iBAAiB,GAAG,EAAE,QAAQ,KAAK,CAAC;GACzE,MAAM,iBAAiB,CAAC,CAAC,aAAa,KAAK;GAC3C,MAAM,YAAY,CAAC,CAAC;GAEpB,OAAOE,cAAAA,WACL;IACE,qBAAA,GAAA,oBAAA,cAAoB,SAAA,CAAS,CAAC,KAAK;IACnC,GAAG;IACH,mBACE,eAAe,uBACd,CAAC,YAAY,CAAC,kBAAkB,CAAC,YAAY,UAAU,KAAA;IAC1D,UAAU,cAAc,IAAI,eAAe;GAC7C,GACA,KACF,CAAC,CAAC;EACJ,GACA;GAAC;GAAgB;GAAO;GAAa;GAAS;EAAW,CAU7C;EACZ;CACF;AACF"}
|
|
@@ -8,7 +8,7 @@ import { fromEvent } from "file-selector";
|
|
|
8
8
|
import { useDropzone } from "react-dropzone";
|
|
9
9
|
// src/components/dropzone/use-dropzone.ts
|
|
10
10
|
const useDropzone$1 = (props = {}) => {
|
|
11
|
-
const { props: { id, name, accept, autoFocus = false, disabled, getFilesFromEvent = fromEvent, loading, maxFiles = 0, maxSize = Infinity, minSize = 0, multiple = false, noClick = false, noDrag = false, noDragEventsBubbling = false, noKeyboard = false, openRef, preventDropOnDocument = true, readOnly, useFsAccessApi = false, validator, onDragEnter, onDragLeave, onDragOver, onDrop, onDropAccepted, onDropRejected, onError, onFileDialogCancel, onFileDialogOpen, ...rest }, ariaProps, dataProps, eventProps } = useFieldProps(props);
|
|
11
|
+
const { props: { id, ref: refProp, name, accept, autoFocus = false, disabled, getFilesFromEvent = fromEvent, loading, maxFiles = 0, maxSize = Infinity, minSize = 0, multiple = false, noClick = false, noDrag = false, noDragEventsBubbling = false, noKeyboard = false, openRef, preventDropOnDocument = true, readOnly, useFsAccessApi = false, validator, onDragEnter, onDragLeave, onDragOver, onDrop, onDropAccepted, onDropRejected, onError, onFileDialogCancel, onFileDialogOpen, ...rest }, ariaProps, dataProps, eventProps } = useFieldProps(props);
|
|
12
12
|
const labelledbyId = useId();
|
|
13
13
|
const interactive = !(loading || readOnly || disabled);
|
|
14
14
|
const { acceptedFiles, fileRejections, isDragAccept: dragAccept, isDragActive: dragActive, isDragReject: dragReject, isFocused: focused, open, getInputProps: getOriginalInputProps, getRootProps: getOriginalRootProps } = useDropzone({
|
|
@@ -43,20 +43,17 @@ const useDropzone$1 = (props = {}) => {
|
|
|
43
43
|
const dragIdle = !dragAccept && !dragReject;
|
|
44
44
|
assignRef(openRef, open);
|
|
45
45
|
const getRootProps = useCallback(({ ref, ...props } = {}) => {
|
|
46
|
-
const { ref:
|
|
47
|
-
const { ref: rootRef, ...rootProps } = getOriginalRootProps(mergeProps({
|
|
46
|
+
const { ref: rootRef, ...rootProps } = getOriginalRootProps(mergeProps(dataProps, eventProps, {
|
|
48
47
|
id: labelledbyId,
|
|
49
|
-
...dataProps,
|
|
50
|
-
...eventProps,
|
|
51
48
|
"aria-disabled": (0, utils_exports.ariaAttr)(!interactive),
|
|
52
49
|
"data-accept": (0, utils_exports.dataAttr)(dragAccept),
|
|
53
50
|
"data-idle": (0, utils_exports.dataAttr)(dragIdle),
|
|
54
51
|
"data-loading": (0, utils_exports.dataAttr)(loading),
|
|
55
52
|
"data-reject": (0, utils_exports.dataAttr)(dragReject)
|
|
56
|
-
},
|
|
53
|
+
}, rest, props)());
|
|
57
54
|
return {
|
|
58
55
|
...rootProps,
|
|
59
|
-
ref: mergeRefs(
|
|
56
|
+
ref: mergeRefs(refProp, ref, rootRef)
|
|
60
57
|
};
|
|
61
58
|
}, [
|
|
62
59
|
getOriginalRootProps,
|
|
@@ -68,6 +65,7 @@ const useDropzone$1 = (props = {}) => {
|
|
|
68
65
|
dragIdle,
|
|
69
66
|
loading,
|
|
70
67
|
dragReject,
|
|
68
|
+
refProp,
|
|
71
69
|
rest
|
|
72
70
|
]);
|
|
73
71
|
return {
|
|
@@ -80,14 +78,12 @@ const useDropzone$1 = (props = {}) => {
|
|
|
80
78
|
focused,
|
|
81
79
|
loading,
|
|
82
80
|
open,
|
|
83
|
-
getInputProps: useCallback((props = {}) => getOriginalInputProps(mergeProps({
|
|
81
|
+
getInputProps: useCallback((props = {}) => getOriginalInputProps(mergeProps(ariaProps, dataProps, {
|
|
84
82
|
id,
|
|
85
83
|
name,
|
|
84
|
+
"aria-labelledby": labelledbyId,
|
|
86
85
|
disabled,
|
|
87
|
-
readOnly
|
|
88
|
-
...ariaProps,
|
|
89
|
-
...dataProps,
|
|
90
|
-
"aria-labelledby": labelledbyId
|
|
86
|
+
readOnly
|
|
91
87
|
}, props)()), [
|
|
92
88
|
getOriginalInputProps,
|
|
93
89
|
id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-dropzone.js","names":["useDropzone","useOriginalDropzone","isArray","ariaAttr","dataAttr"],"sources":["../../../../src/components/dropzone/use-dropzone.ts"],"sourcesContent":["\"use client\"\n\nimport type { RefObject } from \"react\"\nimport type { Accept, DropzoneOptions } from \"react-dropzone\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { FieldProps } from \"../field\"\nimport { fromEvent } from \"file-selector\"\nimport { useCallback, useId } from \"react\"\nimport { useDropzone as useOriginalDropzone } from \"react-dropzone\"\nimport { mergeProps } from \"../../core\"\nimport { ariaAttr, assignRef, dataAttr, isArray, mergeRefs } from \"../../utils\"\nimport { useFieldProps } from \"../field\"\n\nexport interface UseDropzoneProps\n extends Omit<HTMLProps, \"onDrop\" | \"onError\">, FieldProps {\n /**\n * Set accepted file types.\n */\n accept?: Accept | string[]\n /**\n * Set to true to focus the root element on render.\n *\n * @default false\n */\n autoFocus?: boolean\n /**\n * Use this to provide a custom file aggregator.\n */\n getFilesFromEvent?: DropzoneOptions[\"getFilesFromEvent\"]\n /**\n * If `true`, display the dropzone loading icon.\n *\n * @default false\n */\n loading?: boolean\n /**\n * Maximum accepted number of files.\n * The default value is 0 which means there is no limitation to how many files are accepted.\n *\n * @default 0\n */\n maxFiles?: number\n /**\n * Maximum file size (in bytes).\n *\n * @default Infinity\n */\n maxSize?: number\n /**\n * Minimum file size (in bytes).\n *\n * @default 0\n */\n minSize?: number\n /**\n * Allow drag and drop (or selection from the file dialog) of multiple files.\n *\n * @default false\n */\n multiple?: boolean\n /**\n * The HTML `name` attribute used for forms.\n */\n name?: string\n /**\n * If true, disables click to open the native file selection dialog.\n *\n * @default false\n */\n noClick?: boolean\n /**\n * If true, disables drag and drop.\n *\n * @default false\n */\n noDrag?: boolean\n /**\n * If true, stops drag event propagation to parents.\n *\n * @default false\n */\n noDragEventsBubbling?: boolean\n /**\n * If true, disables `space` and `enter` to open the native file selection dialog.\n * Note that it also stops tracking the focus state.\n *\n * @default false\n */\n noKeyboard?: boolean\n /**\n * Ref to a open function.\n */\n openRef?: RefObject<() => void>\n /**\n * If false, allow dropped items to take over the current browser window.\n *\n * @default true\n */\n preventDropOnDocument?: boolean\n /**\n * If true, use the [File System API](https://developer.mozilla.org/en-US/docs/Web/API/File_System_API) to read files.\n *\n * @default false\n */\n useFsAccessApi?: boolean\n /**\n * Custom validation function.\n * It must return null if there's no errors.\n */\n validator?: DropzoneOptions[\"validator\"]\n /**\n * Callback for when the dragenter event occurs.\n */\n onDragEnter?: DropzoneOptions[\"onDragEnter\"]\n /**\n * Callback for when the dragleave event occurs.\n */\n onDragLeave?: DropzoneOptions[\"onDragLeave\"]\n /**\n * Callback for when the dragover event occurs.\n */\n onDragOver?: DropzoneOptions[\"onDragOver\"]\n /**\n * Callback for when the drop event occurs.\n * Note that this callback is invoked after the `getFilesFromEvent` callback is done.\n */\n onDrop?: DropzoneOptions[\"onDrop\"]\n /**\n * Callback for when the drop event occurs.\n * Note that if no files are accepted, this callback is not invoked.\n */\n onDropAccepted?: DropzoneOptions[\"onDropAccepted\"]\n /**\n * Callback for when the drop event occurs.\n * Note that if no files are rejected, this callback is not invoked.\n */\n onDropRejected?: DropzoneOptions[\"onDropRejected\"]\n /**\n * Callback for when there's some error from any of the promises.\n */\n onError?: DropzoneOptions[\"onError\"]\n /**\n * Callback for when closing the file dialog with no selection.\n */\n onFileDialogCancel?: DropzoneOptions[\"onFileDialogCancel\"]\n /**\n * Callback for when opening the file dialog.\n */\n onFileDialogOpen?: DropzoneOptions[\"onFileDialogOpen\"]\n}\n\nexport const useDropzone = (props: UseDropzoneProps = {}) => {\n const {\n props: {\n id,\n name,\n accept,\n autoFocus = false,\n disabled,\n getFilesFromEvent = fromEvent,\n loading,\n maxFiles = 0,\n maxSize = Infinity,\n minSize = 0,\n multiple = false,\n noClick = false,\n noDrag = false,\n noDragEventsBubbling = false,\n noKeyboard = false,\n openRef,\n preventDropOnDocument = true,\n readOnly,\n useFsAccessApi = false,\n validator,\n onDragEnter,\n onDragLeave,\n onDragOver,\n onDrop,\n onDropAccepted,\n onDropRejected,\n onError,\n onFileDialogCancel,\n onFileDialogOpen,\n ...rest\n },\n ariaProps,\n dataProps,\n eventProps,\n } = useFieldProps(props)\n const labelledbyId = useId()\n const interactive = !(loading || readOnly || disabled)\n const {\n acceptedFiles,\n fileRejections,\n isDragAccept: dragAccept,\n isDragActive: dragActive,\n isDragReject: dragReject,\n isFocused: focused,\n open,\n getInputProps: getOriginalInputProps,\n getRootProps: getOriginalRootProps,\n } = useOriginalDropzone({\n accept: isArray(accept)\n ? accept.reduce((prev, current) => ({ ...prev, [current]: [] }), {})\n : accept,\n autoFocus,\n disabled: !interactive,\n getFilesFromEvent,\n maxFiles,\n maxSize,\n minSize,\n multiple,\n noClick,\n noDrag,\n noDragEventsBubbling,\n noKeyboard,\n preventDropOnDocument,\n useFsAccessApi,\n validator,\n onDragEnter,\n onDragLeave,\n onDragOver,\n onDrop,\n onDropAccepted,\n onDropRejected,\n onError,\n onFileDialogCancel,\n onFileDialogOpen,\n })\n const dragIdle = !dragAccept && !dragReject\n\n assignRef(openRef, open)\n\n const getRootProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) => {\n const { ref:
|
|
1
|
+
{"version":3,"file":"use-dropzone.js","names":["useDropzone","useOriginalDropzone","isArray","ariaAttr","dataAttr"],"sources":["../../../../src/components/dropzone/use-dropzone.ts"],"sourcesContent":["\"use client\"\n\nimport type { RefObject } from \"react\"\nimport type { Accept, DropzoneOptions } from \"react-dropzone\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { FieldProps } from \"../field\"\nimport { fromEvent } from \"file-selector\"\nimport { useCallback, useId } from \"react\"\nimport { useDropzone as useOriginalDropzone } from \"react-dropzone\"\nimport { mergeProps } from \"../../core\"\nimport { ariaAttr, assignRef, dataAttr, isArray, mergeRefs } from \"../../utils\"\nimport { useFieldProps } from \"../field\"\n\nexport interface UseDropzoneProps\n extends Omit<HTMLProps, \"onDrop\" | \"onError\">, FieldProps {\n /**\n * Set accepted file types.\n */\n accept?: Accept | string[]\n /**\n * Set to true to focus the root element on render.\n *\n * @default false\n */\n autoFocus?: boolean\n /**\n * Use this to provide a custom file aggregator.\n */\n getFilesFromEvent?: DropzoneOptions[\"getFilesFromEvent\"]\n /**\n * If `true`, display the dropzone loading icon.\n *\n * @default false\n */\n loading?: boolean\n /**\n * Maximum accepted number of files.\n * The default value is 0 which means there is no limitation to how many files are accepted.\n *\n * @default 0\n */\n maxFiles?: number\n /**\n * Maximum file size (in bytes).\n *\n * @default Infinity\n */\n maxSize?: number\n /**\n * Minimum file size (in bytes).\n *\n * @default 0\n */\n minSize?: number\n /**\n * Allow drag and drop (or selection from the file dialog) of multiple files.\n *\n * @default false\n */\n multiple?: boolean\n /**\n * The HTML `name` attribute used for forms.\n */\n name?: string\n /**\n * If true, disables click to open the native file selection dialog.\n *\n * @default false\n */\n noClick?: boolean\n /**\n * If true, disables drag and drop.\n *\n * @default false\n */\n noDrag?: boolean\n /**\n * If true, stops drag event propagation to parents.\n *\n * @default false\n */\n noDragEventsBubbling?: boolean\n /**\n * If true, disables `space` and `enter` to open the native file selection dialog.\n * Note that it also stops tracking the focus state.\n *\n * @default false\n */\n noKeyboard?: boolean\n /**\n * Ref to a open function.\n */\n openRef?: RefObject<() => void>\n /**\n * If false, allow dropped items to take over the current browser window.\n *\n * @default true\n */\n preventDropOnDocument?: boolean\n /**\n * If true, use the [File System API](https://developer.mozilla.org/en-US/docs/Web/API/File_System_API) to read files.\n *\n * @default false\n */\n useFsAccessApi?: boolean\n /**\n * Custom validation function.\n * It must return null if there's no errors.\n */\n validator?: DropzoneOptions[\"validator\"]\n /**\n * Callback for when the dragenter event occurs.\n */\n onDragEnter?: DropzoneOptions[\"onDragEnter\"]\n /**\n * Callback for when the dragleave event occurs.\n */\n onDragLeave?: DropzoneOptions[\"onDragLeave\"]\n /**\n * Callback for when the dragover event occurs.\n */\n onDragOver?: DropzoneOptions[\"onDragOver\"]\n /**\n * Callback for when the drop event occurs.\n * Note that this callback is invoked after the `getFilesFromEvent` callback is done.\n */\n onDrop?: DropzoneOptions[\"onDrop\"]\n /**\n * Callback for when the drop event occurs.\n * Note that if no files are accepted, this callback is not invoked.\n */\n onDropAccepted?: DropzoneOptions[\"onDropAccepted\"]\n /**\n * Callback for when the drop event occurs.\n * Note that if no files are rejected, this callback is not invoked.\n */\n onDropRejected?: DropzoneOptions[\"onDropRejected\"]\n /**\n * Callback for when there's some error from any of the promises.\n */\n onError?: DropzoneOptions[\"onError\"]\n /**\n * Callback for when closing the file dialog with no selection.\n */\n onFileDialogCancel?: DropzoneOptions[\"onFileDialogCancel\"]\n /**\n * Callback for when opening the file dialog.\n */\n onFileDialogOpen?: DropzoneOptions[\"onFileDialogOpen\"]\n}\n\nexport const useDropzone = (props: UseDropzoneProps = {}) => {\n const {\n props: {\n id,\n ref: refProp,\n name,\n accept,\n autoFocus = false,\n disabled,\n getFilesFromEvent = fromEvent,\n loading,\n maxFiles = 0,\n maxSize = Infinity,\n minSize = 0,\n multiple = false,\n noClick = false,\n noDrag = false,\n noDragEventsBubbling = false,\n noKeyboard = false,\n openRef,\n preventDropOnDocument = true,\n readOnly,\n useFsAccessApi = false,\n validator,\n onDragEnter,\n onDragLeave,\n onDragOver,\n onDrop,\n onDropAccepted,\n onDropRejected,\n onError,\n onFileDialogCancel,\n onFileDialogOpen,\n ...rest\n },\n ariaProps,\n dataProps,\n eventProps,\n } = useFieldProps(props)\n const labelledbyId = useId()\n const interactive = !(loading || readOnly || disabled)\n const {\n acceptedFiles,\n fileRejections,\n isDragAccept: dragAccept,\n isDragActive: dragActive,\n isDragReject: dragReject,\n isFocused: focused,\n open,\n getInputProps: getOriginalInputProps,\n getRootProps: getOriginalRootProps,\n } = useOriginalDropzone({\n accept: isArray(accept)\n ? accept.reduce((prev, current) => ({ ...prev, [current]: [] }), {})\n : accept,\n autoFocus,\n disabled: !interactive,\n getFilesFromEvent,\n maxFiles,\n maxSize,\n minSize,\n multiple,\n noClick,\n noDrag,\n noDragEventsBubbling,\n noKeyboard,\n preventDropOnDocument,\n useFsAccessApi,\n validator,\n onDragEnter,\n onDragLeave,\n onDragOver,\n onDrop,\n onDropAccepted,\n onDropRejected,\n onError,\n onFileDialogCancel,\n onFileDialogOpen,\n })\n const dragIdle = !dragAccept && !dragReject\n\n assignRef(openRef, open)\n\n const getRootProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) => {\n const { ref: rootRef, ...rootProps } = getOriginalRootProps(\n mergeProps(\n dataProps,\n eventProps,\n {\n id: labelledbyId,\n \"aria-disabled\": ariaAttr(!interactive),\n \"data-accept\": dataAttr(dragAccept),\n \"data-idle\": dataAttr(dragIdle),\n \"data-loading\": dataAttr(loading),\n \"data-reject\": dataAttr(dragReject),\n },\n rest,\n props,\n )(),\n ) as HTMLProps\n\n return { ...rootProps, ref: mergeRefs(refProp, ref, rootRef) }\n },\n [\n getOriginalRootProps,\n labelledbyId,\n dataProps,\n eventProps,\n interactive,\n dragAccept,\n dragIdle,\n loading,\n dragReject,\n refProp,\n rest,\n ],\n )\n\n const getInputProps: PropGetter<\"input\"> = useCallback(\n (props = {}) =>\n getOriginalInputProps(\n mergeProps(\n ariaProps,\n dataProps,\n {\n id,\n name,\n \"aria-labelledby\": labelledbyId,\n disabled,\n readOnly,\n },\n props,\n )(),\n ),\n [\n getOriginalInputProps,\n id,\n name,\n disabled,\n readOnly,\n ariaProps,\n dataProps,\n labelledbyId,\n ],\n )\n\n return {\n acceptedFiles,\n dragAccept,\n dragActive,\n dragIdle,\n dragReject,\n fileRejections,\n focused,\n loading,\n open,\n getInputProps,\n getRootProps,\n }\n}\n\nexport type UseDropzoneReturn = ReturnType<typeof useDropzone>\n"],"mappings":";;;;;;;;;AAuJA,MAAaA,iBAAe,QAA0B,CAAC,MAAM;CAC3D,MAAM,EACJ,OAAO,EACL,IACA,KAAK,SACL,MACA,QACA,YAAY,OACZ,UACA,oBAAoB,WACpB,SACA,WAAW,GACX,UAAU,UACV,UAAU,GACV,WAAW,OACX,UAAU,OACV,SAAS,OACT,uBAAuB,OACvB,aAAa,OACb,SACA,wBAAwB,MACxB,UACA,iBAAiB,OACjB,WACA,aACA,aACA,YACA,QACA,gBACA,gBACA,SACA,oBACA,kBACA,GAAG,QAEL,WACA,WACA,eACE,cAAc,KAAK;CACvB,MAAM,eAAe,MAAM;CAC3B,MAAM,cAAc,EAAE,WAAW,YAAY;CAC7C,MAAM,EACJ,eACA,gBACA,cAAc,YACd,cAAc,YACd,cAAc,YACd,WAAW,SACX,MACA,eAAe,uBACf,cAAc,yBACZC,YAAoB;EACtB,SAAA,GAAQC,cAAAA,QAAAA,CAAQ,MAAM,IAClB,OAAO,QAAQ,MAAM,aAAa;GAAE,GAAG;IAAO,UAAU,CAAC;EAAE,IAAI,CAAC,CAAC,IACjE;EACJ;EACA,UAAU,CAAC;EACX;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CACD,MAAM,WAAW,CAAC,cAAc,CAAC;CAEjC,UAAU,SAAS,IAAI;CAEvB,MAAM,eAA2B,aAC9B,EAAE,KAAK,GAAG,UAAU,CAAC,MAAM;EAC1B,MAAM,EAAE,KAAK,SAAS,GAAG,cAAc,qBACrC,WACE,WACA,YACA;GACE,IAAI;GACJ,kBAAA,GAAiBC,cAAAA,SAAAA,CAAS,CAAC,WAAW;GACtC,gBAAA,GAAeC,cAAAA,SAAAA,CAAS,UAAU;GAClC,cAAA,GAAaA,cAAAA,SAAAA,CAAS,QAAQ;GAC9B,iBAAA,GAAgBA,cAAAA,SAAAA,CAAS,OAAO;GAChC,gBAAA,GAAeA,cAAAA,SAAAA,CAAS,UAAU;EACpC,GACA,MACA,KACF,CAAC,CAAC,CACJ;EAEA,OAAO;GAAE,GAAG;GAAW,KAAK,UAAU,SAAS,KAAK,OAAO;EAAE;CAC/D,GACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CA8BA,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,eAtCyC,aACxC,QAAQ,CAAC,MACR,sBACE,WACE,WACA,WACA;GACE;GACA;GACA,mBAAmB;GACnB;GACA;EACF,GACA,KACF,CAAC,CAAC,CACJ,GACF;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,CAaY;EACZ;CACF;AACF"}
|
|
@@ -9,7 +9,7 @@ import { useFieldProps } from "../field/use-field-props.js";
|
|
|
9
9
|
import { useCallback, useRef } from "react";
|
|
10
10
|
// src/components/file-input/use-file-input.ts
|
|
11
11
|
const useFileInput = (props) => {
|
|
12
|
-
const { context: { labelId } = {}, props: { id, ref, form, name, accept, defaultValue, disabled, multiple, placeholder, readOnly, required, resetRef, value, onChange: onChangeProp,
|
|
12
|
+
const { context: { labelId } = {}, props: { id, ref, form, name, accept, defaultValue, disabled, multiple, placeholder, readOnly, required, resetRef, value, onChange: onChangeProp, ...rest }, ariaProps, dataProps, eventProps } = useFieldProps({
|
|
13
13
|
...props,
|
|
14
14
|
notSupportReadOnly: true
|
|
15
15
|
});
|
|
@@ -33,21 +33,14 @@ const useFileInput = (props) => {
|
|
|
33
33
|
const files = !(0, utils_exports.isNull)(ev.currentTarget.files) ? Array.from(ev.currentTarget.files) : void 0;
|
|
34
34
|
setValues(files?.length ? files : void 0);
|
|
35
35
|
}, [setValues]);
|
|
36
|
-
const clickableProps = useClickable({
|
|
37
|
-
...ariaProps,
|
|
38
|
-
...dataProps,
|
|
39
|
-
...eventProps,
|
|
40
|
-
...rest,
|
|
36
|
+
const clickableProps = useClickable(mergeProps(ariaProps, dataProps, eventProps, rest, {
|
|
41
37
|
disabled: !interactive,
|
|
42
38
|
focusable: readOnly && !disabled,
|
|
43
39
|
focusOnClick: interactive,
|
|
44
|
-
onClick
|
|
45
|
-
});
|
|
40
|
+
onClick
|
|
41
|
+
})());
|
|
46
42
|
assignRef(resetRef, onReset);
|
|
47
|
-
const getInputProps = useCallback((props = {}) => mergeProps({
|
|
48
|
-
...visuallyHiddenAttributes,
|
|
49
|
-
...ariaProps,
|
|
50
|
-
...dataProps,
|
|
43
|
+
const getInputProps = useCallback((props = {}) => mergeProps(visuallyHiddenAttributes, ariaProps, dataProps, {
|
|
51
44
|
id,
|
|
52
45
|
ref: inputRef,
|
|
53
46
|
form,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-file-input.js","names":["isNull","
|
|
1
|
+
{"version":3,"file":"use-file-input.js","names":["isNull","has","dataAttr"],"sources":["../../../../src/components/file-input/use-file-input.ts"],"sourcesContent":["\"use client\"\n\nimport type { ChangeEvent, RefObject } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { Dict } from \"../../utils\"\nimport type { FieldProps } from \"../field\"\nimport { useCallback, useRef } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useClickable } from \"../../hooks/use-clickable\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport {\n assignRef,\n dataAttr,\n has,\n isNull,\n visuallyHiddenAttributes,\n} from \"../../utils\"\nimport { useFieldProps } from \"../field\"\n\nexport type UseFileInputProps<Y extends \"button\" | \"input\" = \"input\"> =\n FieldProps &\n Omit<HTMLProps<Y>, \"defaultValue\" | \"onChange\" | \"ref\" | \"value\"> &\n Pick<HTMLProps<\"input\">, \"accept\" | \"multiple\" | \"placeholder\" | \"ref\"> & {\n /**\n * The initial value of the file input.\n */\n defaultValue?: File[]\n /**\n * Ref to a reset function.\n */\n resetRef?: RefObject<(() => void) | null>\n /**\n * The value of the file input.\n */\n value?: File[]\n /**\n * Function to be called when a file change event occurs.\n */\n onChange?: (files: File[] | undefined) => void\n }\n\nexport const useFileInput = <Y extends \"button\" | \"input\" = \"input\">(\n props: UseFileInputProps<Y>,\n) => {\n const {\n context: { labelId } = {},\n props: {\n id,\n ref,\n form,\n name,\n accept,\n defaultValue,\n disabled,\n multiple,\n placeholder,\n readOnly,\n required,\n resetRef,\n value,\n onChange: onChangeProp,\n ...rest\n },\n ariaProps,\n dataProps,\n eventProps,\n } = useFieldProps<HTMLElement, UseFileInputProps<Y>>({\n ...props,\n notSupportReadOnly: true,\n })\n const interactive = !(readOnly || disabled)\n const inputRef = useRef<HTMLInputElement>(null)\n const [values, setValues] = useControllableState<File[] | undefined>({\n defaultValue,\n value,\n onChange: onChangeProp,\n })\n const count = values?.length ?? 0\n\n const onClick = useCallback(() => {\n if (!interactive) return\n\n inputRef.current?.click()\n }, [interactive])\n\n const onReset = useCallback(() => {\n if (inputRef.current) inputRef.current.value = \"\"\n\n setValues(undefined)\n }, [setValues])\n\n const onChange = useCallback(\n (ev: ChangeEvent<HTMLInputElement>) => {\n const files = !isNull(ev.currentTarget.files)\n ? Array.from(ev.currentTarget.files)\n : undefined\n\n setValues(files?.length ? files : undefined)\n },\n [setValues],\n )\n\n const clickableProps = useClickable<HTMLElement, Dict>(\n mergeProps(ariaProps, dataProps, eventProps, rest, {\n disabled: !interactive,\n focusable: readOnly && !disabled,\n focusOnClick: interactive,\n onClick,\n })(),\n )\n\n assignRef(resetRef, onReset)\n\n const getInputProps: PropGetter<\"input\"> = useCallback(\n (props = {}) =>\n mergeProps(\n visuallyHiddenAttributes,\n ariaProps,\n dataProps,\n {\n id,\n ref: inputRef,\n form,\n type: \"file\",\n name,\n accept,\n disabled,\n multiple,\n readOnly,\n required,\n },\n props,\n { ref, onChange },\n )(),\n [\n required,\n ariaProps,\n dataProps,\n id,\n form,\n name,\n accept,\n disabled,\n multiple,\n readOnly,\n ref,\n onChange,\n ],\n )\n\n const getFieldProps: PropGetter = useCallback(\n (props = {}) => {\n const hasLabel =\n has(props, [\"aria-label\", \"aria-labelledby\"], { truthy: true }) ||\n has(clickableProps, [\"aria-label\", \"aria-labelledby\"], { truthy: true })\n const hasPlaceholder = !!placeholder?.trim()\n const hasValues = !!count\n\n return mergeProps(\n {\n \"data-placeholder\": dataAttr(!count),\n ...clickableProps,\n \"aria-labelledby\":\n clickableProps[\"aria-labelledby\"] ??\n (!hasLabel && !hasPlaceholder && !hasValues ? labelId : undefined),\n tabIndex: interactive ? 0 : clickableProps.tabIndex,\n },\n props,\n )()\n },\n [clickableProps, count, interactive, labelId, placeholder],\n )\n\n return {\n disabled,\n interactive,\n readOnly,\n required,\n values,\n clickableProps,\n getFieldProps,\n getInputProps,\n }\n}\n\nexport type UseFileInputReturn = ReturnType<typeof useFileInput>\n"],"mappings":";;;;;;;;;;AAyCA,MAAa,gBACX,UACG;CACH,MAAM,EACJ,SAAS,EAAE,YAAY,CAAC,GACxB,OAAO,EACL,IACA,KACA,MACA,MACA,QACA,cACA,UACA,UACA,aACA,UACA,UACA,UACA,OACA,UAAU,cACV,GAAG,QAEL,WACA,WACA,eACE,cAAiD;EACnD,GAAG;EACH,oBAAoB;CACtB,CAAC;CACD,MAAM,cAAc,EAAE,YAAY;CAClC,MAAM,WAAW,OAAyB,IAAI;CAC9C,MAAM,CAAC,QAAQ,aAAa,qBAAyC;EACnE;EACA;EACA,UAAU;CACZ,CAAC;CACD,MAAM,QAAQ,QAAQ,UAAU;CAEhC,MAAM,UAAU,kBAAkB;EAChC,IAAI,CAAC,aAAa;EAElB,SAAS,SAAS,MAAM;CAC1B,GAAG,CAAC,WAAW,CAAC;CAEhB,MAAM,UAAU,kBAAkB;EAChC,IAAI,SAAS,SAAS,SAAS,QAAQ,QAAQ;EAE/C,UAAU,KAAA,CAAS;CACrB,GAAG,CAAC,SAAS,CAAC;CAEd,MAAM,WAAW,aACd,OAAsC;EACrC,MAAM,QAAQ,EAAA,GAACA,cAAAA,OAAAA,CAAO,GAAG,cAAc,KAAK,IACxC,MAAM,KAAK,GAAG,cAAc,KAAK,IACjC,KAAA;EAEJ,UAAU,OAAO,SAAS,QAAQ,KAAA,CAAS;CAC7C,GACA,CAAC,SAAS,CACZ;CAEA,MAAM,iBAAiB,aACrB,WAAW,WAAW,WAAW,YAAY,MAAM;EACjD,UAAU,CAAC;EACX,WAAW,YAAY,CAAC;EACxB,cAAc;EACd;CACF,CAAC,CAAC,CAAC,CACL;CAEA,UAAU,UAAU,OAAO;CAE3B,MAAM,gBAAqC,aACxC,QAAQ,CAAC,MACR,WACE,0BACA,WACA,WACA;EACE;EACA,KAAK;EACL;EACA,MAAM;EACN;EACA;EACA;EACA;EACA;EACA;CACF,GACA,OACA;EAAE;EAAK;CAAS,CAClB,CAAC,CAAC,GACJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CAyBA,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA,eA9BgC,aAC/B,QAAQ,CAAC,MAAM;GACd,MAAM,YAAA,GACJC,cAAAA,IAAAA,CAAI,OAAO,CAAC,cAAc,iBAAiB,GAAG,EAAE,QAAQ,KAAK,CAAC,MAAA,GAC9DA,cAAAA,IAAAA,CAAI,gBAAgB,CAAC,cAAc,iBAAiB,GAAG,EAAE,QAAQ,KAAK,CAAC;GACzE,MAAM,iBAAiB,CAAC,CAAC,aAAa,KAAK;GAC3C,MAAM,YAAY,CAAC,CAAC;GAEpB,OAAO,WACL;IACE,qBAAA,GAAoBC,cAAAA,SAAAA,CAAS,CAAC,KAAK;IACnC,GAAG;IACH,mBACE,eAAe,uBACd,CAAC,YAAY,CAAC,kBAAkB,CAAC,YAAY,UAAU,KAAA;IAC1D,UAAU,cAAc,IAAI,eAAe;GAC7C,GACA,KACF,CAAC,CAAC;EACJ,GACA;GAAC;GAAgB;GAAO;GAAa;GAAS;EAAW,CAU7C;EACZ;CACF;AACF"}
|
|
@@ -21,7 +21,7 @@ export interface AvatarProps extends HTMLStyledProps, ThemeProps<AvatarStyle>, U
|
|
|
21
21
|
*/
|
|
22
22
|
imageProps?: AvatarImageProps;
|
|
23
23
|
}
|
|
24
|
-
declare const component: <H extends
|
|
24
|
+
declare const component: <H extends "fragment" | As = "div", R extends import("@yamada-ui/utils").Dict = import("@yamada-ui/utils").Dict<any>>(el: H | import("react").FC<R>, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"image" | "group" | "root" | "fallback", {
|
|
25
25
|
shape: {
|
|
26
26
|
circle: {
|
|
27
27
|
root: {
|
|
@@ -140,7 +140,7 @@ declare const component: <H extends As | "fragment" = "div", R extends import("@
|
|
|
140
140
|
};
|
|
141
141
|
};
|
|
142
142
|
};
|
|
143
|
-
}>>> | undefined, { name, className, ...options }?: ComponentOptions) => (initialProps?: InitialProps<R>, ...superProps: SuperProps<R>[]) => H extends "fragment" ? import("react").FunctionComponent<R> : Component<Exclude<H, "fragment">, R>, AvatarPropsContext: import("react").Context<Partial<AvatarProps> | undefined>, useAvatarPropsContext: () => Partial<AvatarProps> | undefined, useRootComponentProps: <Y extends import("@yamada-ui/utils").Dict = {}, R extends keyof Y = keyof Y>(props: Y, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"image" | "group" | "
|
|
143
|
+
}>>> | undefined, { name, className, ...options }?: ComponentOptions) => (initialProps?: InitialProps<R>, ...superProps: SuperProps<R>[]) => H extends "fragment" ? import("react").FunctionComponent<R> : Component<Exclude<H, "fragment">, R>, AvatarPropsContext: import("react").Context<Partial<AvatarProps> | undefined>, useAvatarPropsContext: () => Partial<AvatarProps> | undefined, useRootComponentProps: <Y extends import("@yamada-ui/utils").Dict = {}, R extends keyof Y = keyof Y>(props: Y, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"image" | "group" | "root" | "fallback", {
|
|
144
144
|
shape: {
|
|
145
145
|
circle: {
|
|
146
146
|
root: {
|
|
@@ -259,7 +259,7 @@ declare const component: <H extends As | "fragment" = "div", R extends import("@
|
|
|
259
259
|
};
|
|
260
260
|
};
|
|
261
261
|
};
|
|
262
|
-
}>>> | undefined, { className, withContext, transferProps }?: UseComponentPropsOptions<R>) => [CSSSlotObject, import("@yamada-ui/utils").Merge<WithoutThemeProps<Y, ComponentSlotStyle<"image" | "group" | "
|
|
262
|
+
}>>> | undefined, { className, withContext, transferProps }?: UseComponentPropsOptions<R>) => [CSSSlotObject, import("@yamada-ui/utils").Merge<WithoutThemeProps<Y, ComponentSlotStyle<"image" | "group" | "root" | "fallback", {
|
|
263
263
|
shape: {
|
|
264
264
|
circle: {
|
|
265
265
|
root: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.type.js";
|
|
2
2
|
import "../../index.js";
|
|
3
|
-
export declare const avatarStyle: ComponentSlotStyle<"image" | "group" | "
|
|
3
|
+
export declare const avatarStyle: ComponentSlotStyle<"image" | "group" | "root" | "fallback", {
|
|
4
4
|
/**
|
|
5
5
|
* The shape of the component
|
|
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 calendarStyle: ComponentSlotStyle<"button" | "select" | "cell" | "navigation" | "row" | "separator" | "next" | "
|
|
4
|
+
export declare const calendarStyle: ComponentSlotStyle<"button" | "select" | "cell" | "navigation" | "row" | "separator" | "next" | "root" | "month" | "weekday" | "day" | "months" | "years" | "week" | "weeks" | "control" | "prev", {
|
|
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" | "
|
|
76
|
+
}, CSSModifierObject<CSSSlotObject<"button" | "select" | "cell" | "navigation" | "row" | "separator" | "next" | "root" | "month" | "weekday" | "day" | "months" | "years" | "week" | "weeks" | "control" | "prev">>>;
|
|
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" | "
|
|
4
|
+
export declare const carouselStyle: ComponentSlotStyle<"list" | "next" | "item" | "root" | "indicator" | "trigger" | "indicators" | "prev", CSSPropObject<CSSSlotObject<"list" | "next" | "item" | "root" | "indicator" | "trigger" | "indicators" | "prev">>, {
|
|
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" | "
|
|
20
|
+
}, CSSModifierObject<CSSSlotObject<"list" | "next" | "item" | "root" | "indicator" | "trigger" | "indicators" | "prev">>>;
|
|
21
21
|
export type CarouselStyle = typeof carouselStyle;
|
|
@@ -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 cartesianChartStyle: ComponentSlotStyle<"area" | "line" | "grid" | "bar" | "dot" | "root" | "
|
|
4
|
+
export declare const cartesianChartStyle: ComponentSlotStyle<"area" | "line" | "grid" | "bar" | "dot" | "root" | "activeDot" | "labelList" | "referenceLine" | "referenceLineLabel" | "xAxis" | "xAxisLabel" | "xAxisTick" | "xAxisTickLine" | "yAxis" | "yAxisLabel" | "yAxisTick" | "yAxisTickLine", CSSPropObject<CSSSlotObject<"area" | "line" | "grid" | "bar" | "dot" | "root" | "activeDot" | "labelList" | "referenceLine" | "referenceLineLabel" | "xAxis" | "xAxisLabel" | "xAxisTick" | "xAxisTickLine" | "yAxis" | "yAxisLabel" | "yAxisTick" | "yAxisTickLine">>, CSSModifierObject<CSSSlotObject<"area" | "line" | "grid" | "bar" | "dot" | "root" | "activeDot" | "labelList" | "referenceLine" | "referenceLineLabel" | "xAxis" | "xAxisLabel" | "xAxisTick" | "xAxisTickLine" | "yAxis" | "yAxisLabel" | "yAxisTick" | "yAxisTickLine">>, CSSModifierObject<CSSSlotObject<"area" | "line" | "grid" | "bar" | "dot" | "root" | "activeDot" | "labelList" | "referenceLine" | "referenceLineLabel" | "xAxis" | "xAxisLabel" | "xAxisTick" | "xAxisTickLine" | "yAxis" | "yAxisLabel" | "yAxisTick" | "yAxisTickLine">>>;
|
|
5
5
|
export type CartesianChartStyle = typeof cartesianChartStyle;
|
|
@@ -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 polarChartStyle: ComponentSlotStyle<"label" | "grid" | "dot" | "root" | "
|
|
4
|
+
export declare const polarChartStyle: ComponentSlotStyle<"label" | "grid" | "dot" | "root" | "radial" | "labelLine" | "activeDot" | "labelList" | "angleAxis" | "angleAxisLabel" | "angleAxisLine" | "angleAxisTick" | "angleAxisTickLine" | "pie" | "radar" | "radialBackground" | "radiusAxis" | "radiusAxisLabel" | "radiusAxisLine" | "radiusAxisTick" | "radiusAxisTickLine" | "sector", CSSPropObject<CSSSlotObject<"label" | "grid" | "dot" | "root" | "radial" | "labelLine" | "activeDot" | "labelList" | "angleAxis" | "angleAxisLabel" | "angleAxisLine" | "angleAxisTick" | "angleAxisTickLine" | "pie" | "radar" | "radialBackground" | "radiusAxis" | "radiusAxisLabel" | "radiusAxisLine" | "radiusAxisTick" | "radiusAxisTickLine" | "sector">>, CSSModifierObject<CSSSlotObject<"label" | "grid" | "dot" | "root" | "radial" | "labelLine" | "activeDot" | "labelList" | "angleAxis" | "angleAxisLabel" | "angleAxisLine" | "angleAxisTick" | "angleAxisTickLine" | "pie" | "radar" | "radialBackground" | "radiusAxis" | "radiusAxisLabel" | "radiusAxisLine" | "radiusAxisTick" | "radiusAxisTickLine" | "sector">>, CSSModifierObject<CSSSlotObject<"label" | "grid" | "dot" | "root" | "radial" | "labelLine" | "activeDot" | "labelList" | "angleAxis" | "angleAxisLabel" | "angleAxisLine" | "angleAxisTick" | "angleAxisTickLine" | "pie" | "radar" | "radialBackground" | "radiusAxis" | "radiusAxisLabel" | "radiusAxisLine" | "radiusAxisTick" | "radiusAxisTickLine" | "sector">>>;
|
|
5
5
|
export type PolarChartStyle = typeof polarChartStyle;
|
|
@@ -36,7 +36,7 @@ export interface CheckboxProps<Y extends string = string> extends Merge<HTMLStyl
|
|
|
36
36
|
*/
|
|
37
37
|
rootProps?: HTMLStyledProps<"label">;
|
|
38
38
|
}
|
|
39
|
-
declare const component: <H extends
|
|
39
|
+
declare const component: <H extends "fragment" | As = "div", R extends import("@yamada-ui/utils").Dict = import("@yamada-ui/utils").Dict<any>>(el: H | import("react").FC<R>, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"label" | "group" | "root" | "indicator", {
|
|
40
40
|
shape: {
|
|
41
41
|
rounded: {
|
|
42
42
|
indicator: {
|
|
@@ -63,7 +63,7 @@ export interface CheckboxCardRootProps<Y extends string = string> extends Merge<
|
|
|
63
63
|
*/
|
|
64
64
|
rootProps?: HTMLStyledProps<"label">;
|
|
65
65
|
}
|
|
66
|
-
declare const component: <H extends
|
|
66
|
+
declare const component: <H extends "fragment" | As = "div", R extends import("@yamada-ui/utils").Dict = import("@yamada-ui/utils").Dict<any>>(el: H | import("react").FC<R>, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"group" | "root" | "description" | "indicator" | "addon", {
|
|
67
67
|
justify: {
|
|
68
68
|
end: {
|
|
69
69
|
addon: {
|
|
@@ -6,7 +6,7 @@ import "../../index.js";
|
|
|
6
6
|
import "../../core/index.js";
|
|
7
7
|
import { IconStyle } from "./icon.style.js";
|
|
8
8
|
export interface IconProps extends HTMLStyledProps<"svg">, ThemeProps<IconStyle> {}
|
|
9
|
-
declare const component: <D extends
|
|
9
|
+
declare const component: <D extends "fragment" | As = "div", H extends import("@yamada-ui/utils").Dict = IconProps>(el: D | import("react").FC<H>, { name, className, ...options }?: ComponentOptions) => (initialProps?: InitialProps<H>, ...superProps: SuperProps<H>[]) => D extends "fragment" ? import("react").FunctionComponent<H> : Component<Exclude<D, "fragment">, H>, IconPropsContext: import("react").Context<Partial<IconProps> | undefined>, useIconPropsContext: () => Partial<IconProps> | undefined, withContext: <D extends "fragment" | As = "div", H extends IconProps = IconProps, R extends keyof H = keyof H>(el: D | import("react").FC<WithoutThemeProps<H, ComponentStyle<CSSPropObject<CSSObject>, CSSModifierObject, CSSModifierObject>, R>>, { name, className, withContext, transferProps, ...options }?: ComponentWithContextOptions<R>) => (initialProps?: InitialProps<H>, ...superProps: SuperWithoutThemeProps<H, ComponentStyle<CSSPropObject<CSSObject>, CSSModifierObject, CSSModifierObject>, R>[]) => D extends "fragment" ? import("react").FunctionComponent<H> : Component<Exclude<D, "fragment">, H>;
|
|
10
10
|
/**
|
|
11
11
|
* `Icon` is a general icon component that can be used in your projects.
|
|
12
12
|
*
|
|
@@ -17,5 +17,5 @@ export interface LoadingProps extends WithoutThemeProps<IconProps>, ThemeProps<L
|
|
|
17
17
|
*/
|
|
18
18
|
secondaryColor?: CSSProps["color"];
|
|
19
19
|
}
|
|
20
|
-
declare const LoadingPropsContext: import("react").Context<Partial<LoadingProps> | undefined>, useLoadingPropsContext: () => Partial<LoadingProps> | undefined, withContext: <D extends
|
|
20
|
+
declare const LoadingPropsContext: import("react").Context<Partial<LoadingProps> | undefined>, useLoadingPropsContext: () => Partial<LoadingProps> | undefined, withContext: <D extends "fragment" | As = "div", H extends LoadingProps = LoadingProps, R extends keyof H = keyof H>(el: D | import("react").FC<WithoutThemeProps<H, ComponentStyle<CSSPropObject<CSSObject>, CSSModifierObject, CSSModifierObject>, R>>, { name, className, withContext, transferProps, ...options }?: ComponentWithContextOptions<R>) => (initialProps?: InitialProps<H>, ...superProps: SuperWithoutThemeProps<H, ComponentStyle<CSSPropObject<CSSObject>, CSSModifierObject, CSSModifierObject>, R>[]) => D extends "fragment" ? import("react").FunctionComponent<H> : Component<Exclude<D, "fragment">, H>;
|
|
21
21
|
export { LoadingPropsContext, useLoadingPropsContext };
|
|
@@ -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 numberInputStyle: ComponentSlotStyle<"button" | "root" | "field" | "
|
|
4
|
+
export declare const numberInputStyle: ComponentSlotStyle<"button" | "root" | "field" | "decrement" | "increment" | "control", CSSPropObject<CSSSlotObject<"button" | "root" | "field" | "decrement" | "increment" | "control">>, {
|
|
5
5
|
xs: {
|
|
6
6
|
control: {
|
|
7
7
|
boxSize: "calc({--height} - {spaces.2})";
|
|
@@ -28,7 +28,7 @@ export interface RadioProps<Y extends string = string> extends Merge<HTMLStyledP
|
|
|
28
28
|
*/
|
|
29
29
|
rootProps?: HTMLStyledProps<"label">;
|
|
30
30
|
}
|
|
31
|
-
declare const component: <H extends
|
|
31
|
+
declare const component: <H extends "fragment" | As = "div", R extends import("@yamada-ui/utils").Dict = import("@yamada-ui/utils").Dict<any>>(el: H | import("react").FC<R>, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"label" | "group" | "root" | "indicator", {
|
|
32
32
|
shape: {
|
|
33
33
|
circle: {
|
|
34
34
|
indicator: {
|
|
@@ -55,7 +55,7 @@ export interface RadioCardRootProps<Y extends string = string> extends Merge<HTM
|
|
|
55
55
|
*/
|
|
56
56
|
rootProps?: HTMLStyledProps<"label">;
|
|
57
57
|
}
|
|
58
|
-
declare const component: <H extends
|
|
58
|
+
declare const component: <H extends "fragment" | As = "div", R extends import("@yamada-ui/utils").Dict = import("@yamada-ui/utils").Dict<any>>(el: H | import("react").FC<R>, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"group" | "root" | "description" | "indicator" | "addon", {
|
|
59
59
|
justify: {
|
|
60
60
|
end: {
|
|
61
61
|
addon: {
|
|
@@ -12,7 +12,7 @@ import { ToggleStyle } from "./toggle.style.js";
|
|
|
12
12
|
import { UseToggleProps } from "./use-toggle.js";
|
|
13
13
|
import { ReactElement } from "react";
|
|
14
14
|
export interface ToggleProps<Y extends string = string> extends Omit<WithoutThemeProps<IconButtonProps, ToggleStyle>, "aria-label" | "onChange" | "ref" | "value">, UseToggleProps<Y>, Pick<UseInputBorderProps, "errorBorderColor">, ThemeProps<ToggleStyle> {}
|
|
15
|
-
declare const component: <H extends
|
|
15
|
+
declare const component: <H extends "fragment" | As = "div", R extends import("@yamada-ui/utils").Dict = import("@yamada-ui/utils").Dict<any>>(el: H | import("react").FC<R>, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"group" | "root", {
|
|
16
16
|
fullRounded: {
|
|
17
17
|
true: {
|
|
18
18
|
root: {
|
|
@@ -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" | "colorSwatch" | "hueSlider" | "saturationSlider" | "
|
|
126
|
+
}, "progress" | "select" | "table" | "toggle" | "slider" | "colorSwatch" | "hueSlider" | "saturationSlider" | "datePicker" | "autocomplete" | "avatar" | "breadcrumb" | "calendar" | "carousel" | "closeButton" | "colorPicker" | "colorSelector" | "numberInput" | "pagination" | "passwordInput" | "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" | "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}%" | "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" | "tag.Close tag">>;
|
|
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-
|
|
4
|
+
"version": "2.3.4-dev-20261116090813",
|
|
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",
|