jaci-ui 0.3.0 → 0.4.0
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/CHANGELOG.md +6 -0
- package/README.md +48 -0
- package/dist/components/calendar/calendar.cjs +377 -0
- package/dist/components/calendar/calendar.cjs.map +1 -0
- package/dist/components/calendar/calendar.d.cts +56 -0
- package/dist/components/calendar/calendar.d.ts +56 -0
- package/dist/components/calendar/calendar.js +368 -0
- package/dist/components/calendar/calendar.js.map +1 -0
- package/dist/components/calendar/index.d.cts +2 -0
- package/dist/components/calendar/index.d.ts +2 -0
- package/dist/components/combobox/combobox.cjs +13 -1
- package/dist/components/combobox/combobox.cjs.map +1 -1
- package/dist/components/combobox/combobox.d.cts +7 -2
- package/dist/components/combobox/combobox.d.ts +7 -2
- package/dist/components/combobox/combobox.js +13 -2
- package/dist/components/combobox/combobox.js.map +1 -1
- package/dist/components/combobox/index.d.cts +2 -2
- package/dist/components/combobox/index.d.ts +2 -2
- package/dist/components/controls/input.cjs +26 -5
- package/dist/components/controls/input.cjs.map +1 -1
- package/dist/components/controls/input.d.cts +5 -2
- package/dist/components/controls/input.d.ts +5 -2
- package/dist/components/controls/input.js +28 -7
- package/dist/components/controls/input.js.map +1 -1
- package/dist/components/controls/textarea.cjs +26 -5
- package/dist/components/controls/textarea.cjs.map +1 -1
- package/dist/components/controls/textarea.d.cts +5 -2
- package/dist/components/controls/textarea.d.ts +5 -2
- package/dist/components/controls/textarea.js +28 -7
- package/dist/components/controls/textarea.js.map +1 -1
- package/dist/components/date-picker/date-picker.cjs +9 -9
- package/dist/components/date-picker/date-picker.cjs.map +1 -1
- package/dist/components/date-picker/date-picker.d.cts +3 -1
- package/dist/components/date-picker/date-picker.d.ts +3 -1
- package/dist/components/date-picker/date-picker.js +9 -9
- package/dist/components/date-picker/date-picker.js.map +1 -1
- package/dist/components/date-range-picker/date-range-picker.cjs +589 -0
- package/dist/components/date-range-picker/date-range-picker.cjs.map +1 -0
- package/dist/components/date-range-picker/date-range-picker.d.cts +134 -0
- package/dist/components/date-range-picker/date-range-picker.d.ts +134 -0
- package/dist/components/date-range-picker/date-range-picker.js +568 -0
- package/dist/components/date-range-picker/date-range-picker.js.map +1 -0
- package/dist/components/date-range-picker/index.d.cts +2 -0
- package/dist/components/date-range-picker/index.d.ts +2 -0
- package/dist/components/field/field.cjs +106 -11
- package/dist/components/field/field.cjs.map +1 -1
- package/dist/components/field/field.d.cts +22 -4
- package/dist/components/field/field.d.ts +22 -4
- package/dist/components/field/field.js +107 -13
- package/dist/components/field/field.js.map +1 -1
- package/dist/components/field/index.d.cts +2 -2
- package/dist/components/field/index.d.ts +2 -2
- package/dist/components/pin-input/index.d.cts +2 -0
- package/dist/components/pin-input/index.d.ts +2 -0
- package/dist/components/pin-input/pin-input.cjs +266 -0
- package/dist/components/pin-input/pin-input.cjs.map +1 -0
- package/dist/components/pin-input/pin-input.d.cts +46 -0
- package/dist/components/pin-input/pin-input.d.ts +46 -0
- package/dist/components/pin-input/pin-input.js +258 -0
- package/dist/components/pin-input/pin-input.js.map +1 -0
- package/dist/components/select/index.d.cts +2 -2
- package/dist/components/select/index.d.ts +2 -2
- package/dist/components/select/select.cjs +80 -3
- package/dist/components/select/select.cjs.map +1 -1
- package/dist/components/select/select.d.cts +18 -3
- package/dist/components/select/select.d.ts +18 -3
- package/dist/components/select/select.js +78 -5
- package/dist/components/select/select.js.map +1 -1
- package/dist/components/tags-input/tags-input.cjs +83 -5
- package/dist/components/tags-input/tags-input.cjs.map +1 -1
- package/dist/components/tags-input/tags-input.d.cts +3 -0
- package/dist/components/tags-input/tags-input.d.ts +3 -0
- package/dist/components/tags-input/tags-input.js +83 -5
- package/dist/components/tags-input/tags-input.js.map +1 -1
- package/dist/components/upload/index.d.cts +2 -2
- package/dist/components/upload/index.d.ts +2 -2
- package/dist/components/upload/upload.cjs +90 -10
- package/dist/components/upload/upload.cjs.map +1 -1
- package/dist/components/upload/upload.d.cts +25 -2
- package/dist/components/upload/upload.d.ts +25 -2
- package/dist/components/upload/upload.js +89 -11
- package/dist/components/upload/upload.js.map +1 -1
- package/dist/index.cjs +52 -1
- package/dist/index.d.cts +11 -5
- package/dist/index.d.ts +11 -5
- package/dist/index.js +9 -6
- package/dist/styled-system/recipes/calendar.cjs +43 -0
- package/dist/styled-system/recipes/calendar.cjs.map +1 -0
- package/dist/styled-system/recipes/calendar.js +43 -0
- package/dist/styled-system/recipes/calendar.js.map +1 -0
- package/dist/styled-system/recipes/combobox.cjs +1 -0
- package/dist/styled-system/recipes/combobox.cjs.map +1 -1
- package/dist/styled-system/recipes/combobox.js +1 -0
- package/dist/styled-system/recipes/combobox.js.map +1 -1
- package/dist/styled-system/recipes/date-range-picker.cjs +52 -0
- package/dist/styled-system/recipes/date-range-picker.cjs.map +1 -0
- package/dist/styled-system/recipes/date-range-picker.js +52 -0
- package/dist/styled-system/recipes/date-range-picker.js.map +1 -0
- package/dist/styled-system/recipes/pin-input.cjs +39 -0
- package/dist/styled-system/recipes/pin-input.cjs.map +1 -0
- package/dist/styled-system/recipes/pin-input.js +39 -0
- package/dist/styled-system/recipes/pin-input.js.map +1 -0
- package/dist/styled-system/recipes/select.cjs +5 -1
- package/dist/styled-system/recipes/select.cjs.map +1 -1
- package/dist/styled-system/recipes/select.js +5 -1
- package/dist/styled-system/recipes/select.js.map +1 -1
- package/dist/styled-system/recipes/upload.cjs +2 -0
- package/dist/styled-system/recipes/upload.cjs.map +1 -1
- package/dist/styled-system/recipes/upload.js +2 -0
- package/dist/styled-system/recipes/upload.js.map +1 -1
- package/dist/styles.css +745 -81
- package/package.json +3 -2
|
@@ -30,7 +30,7 @@ function acceptsFile(file, accept) {
|
|
|
30
30
|
return pattern === fileType;
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
-
const UploadRoot = forwardRef(function UploadRoot({ accept, children, className, defaultFiles = [], disabled = false, files: controlledFiles, maxFiles, maxSize, multiple = false, onFilesChange, onReject, ...props }, ref) {
|
|
33
|
+
const UploadRoot = forwardRef(function UploadRoot({ accept, fileState, children, className, defaultFiles = [], disabled = false, files: controlledFiles, maxFiles, maxSize, multiple = false, onFilesChange, onCancel, onReject, validateFile, ...props }, ref) {
|
|
34
34
|
const [uncontrolledFiles, setUncontrolledFiles] = useState(defaultFiles);
|
|
35
35
|
const [dropActive, setDropActive] = useState(false);
|
|
36
36
|
const [rejections, setRejections] = useState([]);
|
|
@@ -43,14 +43,18 @@ const UploadRoot = forwardRef(function UploadRoot({ accept, children, className,
|
|
|
43
43
|
const currentFiles = controlledFiles ?? uncontrolledFiles;
|
|
44
44
|
const fileLimit = maxFiles ?? (multiple ? void 0 : 1);
|
|
45
45
|
const updateFiles = useCallback((nextFiles) => {
|
|
46
|
-
setUncontrolledFiles(nextFiles);
|
|
46
|
+
if (controlledFiles === void 0) setUncontrolledFiles(nextFiles);
|
|
47
47
|
onFilesChange?.(nextFiles);
|
|
48
|
-
}, [onFilesChange]);
|
|
48
|
+
}, [controlledFiles, onFilesChange]);
|
|
49
|
+
const removeFile = useCallback((file) => {
|
|
50
|
+
updateFiles(currentFiles.filter((current) => fileKey(current) !== fileKey(file)));
|
|
51
|
+
}, [currentFiles, updateFiles]);
|
|
49
52
|
const addFiles = useCallback((fileList) => {
|
|
50
53
|
if (disabled) return;
|
|
51
54
|
const candidates = Array.from(fileList);
|
|
52
55
|
const acceptedFiles = [];
|
|
53
56
|
const nextRejections = [];
|
|
57
|
+
const pendingValidations = /* @__PURE__ */ new Map();
|
|
54
58
|
const existingKeys = new Set(currentFiles.map(fileKey));
|
|
55
59
|
for (const file of candidates) {
|
|
56
60
|
const key = fileKey(file);
|
|
@@ -86,10 +90,46 @@ const UploadRoot = forwardRef(function UploadRoot({ accept, children, className,
|
|
|
86
90
|
});
|
|
87
91
|
continue;
|
|
88
92
|
}
|
|
93
|
+
if (validateFile) {
|
|
94
|
+
const validation = validateFile(file);
|
|
95
|
+
if (validation && typeof validation !== "object") {
|
|
96
|
+
nextRejections.push({
|
|
97
|
+
file,
|
|
98
|
+
reason: "validation",
|
|
99
|
+
message: validation
|
|
100
|
+
});
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
if (validation && typeof validation === "object" && "then" in validation) pendingValidations.set(file, Promise.resolve(validation));
|
|
104
|
+
}
|
|
89
105
|
acceptedFiles.push(file);
|
|
90
106
|
}
|
|
91
107
|
const nextFiles = multiple ? [...currentFiles, ...acceptedFiles] : acceptedFiles.slice(0, 1);
|
|
92
108
|
if (acceptedFiles.length > 0) updateFiles(nextFiles);
|
|
109
|
+
if (validateFile) for (const file of acceptedFiles) {
|
|
110
|
+
const validation = pendingValidations.get(file);
|
|
111
|
+
if (validation) validation.then((message) => {
|
|
112
|
+
if (!message) return;
|
|
113
|
+
const rejection = {
|
|
114
|
+
file,
|
|
115
|
+
reason: "validation",
|
|
116
|
+
message
|
|
117
|
+
};
|
|
118
|
+
updateFiles(nextFiles.filter((current) => fileKey(current) !== fileKey(file)));
|
|
119
|
+
setRejections((current) => [...current, rejection]);
|
|
120
|
+
onReject?.([rejection]);
|
|
121
|
+
}).catch((error) => {
|
|
122
|
+
const message = error instanceof Error ? error.message : "File validation failed.";
|
|
123
|
+
const rejection = {
|
|
124
|
+
file,
|
|
125
|
+
reason: "validation",
|
|
126
|
+
message
|
|
127
|
+
};
|
|
128
|
+
updateFiles(nextFiles.filter((current) => fileKey(current) !== fileKey(file)));
|
|
129
|
+
setRejections((current) => [...current, rejection]);
|
|
130
|
+
onReject?.([rejection]);
|
|
131
|
+
});
|
|
132
|
+
}
|
|
93
133
|
if (nextRejections.length > 0) {
|
|
94
134
|
setRejections(nextRejections);
|
|
95
135
|
onReject?.(nextRejections);
|
|
@@ -102,19 +142,20 @@ const UploadRoot = forwardRef(function UploadRoot({ accept, children, className,
|
|
|
102
142
|
maxSize,
|
|
103
143
|
multiple,
|
|
104
144
|
onReject,
|
|
105
|
-
updateFiles
|
|
145
|
+
updateFiles,
|
|
146
|
+
validateFile
|
|
106
147
|
]);
|
|
107
|
-
const
|
|
108
|
-
updateFiles(currentFiles.filter((current) => fileKey(current) !== fileKey(file)));
|
|
109
|
-
}, [currentFiles, updateFiles]);
|
|
148
|
+
const cancelFile = useCallback((file) => onCancel?.(file), [onCancel]);
|
|
110
149
|
const context = useMemo(() => ({
|
|
111
150
|
accept,
|
|
112
151
|
addFiles,
|
|
152
|
+
cancelFile,
|
|
113
153
|
disabled,
|
|
114
154
|
dropActive,
|
|
115
155
|
files: currentFiles,
|
|
116
156
|
inputId,
|
|
117
157
|
inputRef,
|
|
158
|
+
fileState,
|
|
118
159
|
maxFiles: fileLimit,
|
|
119
160
|
maxSize,
|
|
120
161
|
multiple,
|
|
@@ -125,10 +166,12 @@ const UploadRoot = forwardRef(function UploadRoot({ accept, children, className,
|
|
|
125
166
|
}), [
|
|
126
167
|
accept,
|
|
127
168
|
addFiles,
|
|
169
|
+
cancelFile,
|
|
128
170
|
currentFiles,
|
|
129
171
|
disabled,
|
|
130
172
|
dropActive,
|
|
131
173
|
fileLimit,
|
|
174
|
+
fileState,
|
|
132
175
|
inputId,
|
|
133
176
|
maxSize,
|
|
134
177
|
multiple,
|
|
@@ -285,9 +328,10 @@ const UploadPreview = forwardRef(function UploadPreview({ alt, className, fallba
|
|
|
285
328
|
}) : fallback
|
|
286
329
|
});
|
|
287
330
|
});
|
|
288
|
-
const UploadProgress = forwardRef(function UploadProgress({ className, label = "Uploading", value, ...props }, ref) {
|
|
289
|
-
const { styles } = useUploadContext();
|
|
290
|
-
const
|
|
331
|
+
const UploadProgress = forwardRef(function UploadProgress({ className, file, label = "Uploading", value, ...props }, ref) {
|
|
332
|
+
const { fileState, styles } = useUploadContext();
|
|
333
|
+
const state = file ? fileState?.(file) : void 0;
|
|
334
|
+
const normalizedValue = value === void 0 ? state?.progress === void 0 ? void 0 : Math.min(100, Math.max(0, state.progress)) : Math.min(100, Math.max(0, value));
|
|
291
335
|
return /* @__PURE__ */ jsxs("div", {
|
|
292
336
|
...props,
|
|
293
337
|
ref,
|
|
@@ -365,6 +409,38 @@ const UploadRemove = forwardRef(function UploadRemove({ children = "×", classNa
|
|
|
365
409
|
children
|
|
366
410
|
});
|
|
367
411
|
});
|
|
412
|
+
const UploadStatus = forwardRef(function UploadStatus({ children, className, file, ...props }, ref) {
|
|
413
|
+
const { fileState, styles } = useUploadContext();
|
|
414
|
+
const state = fileState?.(file);
|
|
415
|
+
const content = children ?? state?.error ?? state?.status ?? "queued";
|
|
416
|
+
return /* @__PURE__ */ jsx("span", {
|
|
417
|
+
...props,
|
|
418
|
+
"aria-live": "polite",
|
|
419
|
+
className: cx(styles.status, className),
|
|
420
|
+
"data-status": state?.status,
|
|
421
|
+
"data-slot": "upload-status",
|
|
422
|
+
ref,
|
|
423
|
+
children: content
|
|
424
|
+
});
|
|
425
|
+
});
|
|
426
|
+
const UploadCancel = forwardRef(function UploadCancel({ children = "Cancel", className, file, onClick, ...props }, ref) {
|
|
427
|
+
const { cancelFile, disabled, fileState, styles } = useUploadContext();
|
|
428
|
+
const state = fileState?.(file);
|
|
429
|
+
return /* @__PURE__ */ jsx("button", {
|
|
430
|
+
...props,
|
|
431
|
+
"aria-label": props["aria-label"] ?? `Cancel ${file.name}`,
|
|
432
|
+
className: cx(styles.cancel, className),
|
|
433
|
+
"data-slot": "upload-cancel",
|
|
434
|
+
disabled: disabled || state?.status === "canceled" || state?.status === "success",
|
|
435
|
+
onClick: (event) => {
|
|
436
|
+
cancelFile(file);
|
|
437
|
+
onClick?.(event);
|
|
438
|
+
},
|
|
439
|
+
ref,
|
|
440
|
+
type: "button",
|
|
441
|
+
children
|
|
442
|
+
});
|
|
443
|
+
});
|
|
368
444
|
const UploadError = forwardRef(function UploadError({ children, className, ...props }, ref) {
|
|
369
445
|
const { rejections, styles } = useUploadContext();
|
|
370
446
|
if (children === void 0 && rejections.length === 0) return null;
|
|
@@ -390,9 +466,11 @@ const Upload = {
|
|
|
390
466
|
List: UploadList,
|
|
391
467
|
Item: UploadItem,
|
|
392
468
|
Remove: UploadRemove,
|
|
469
|
+
Status: UploadStatus,
|
|
470
|
+
Cancel: UploadCancel,
|
|
393
471
|
Error: UploadError
|
|
394
472
|
};
|
|
395
473
|
//#endregion
|
|
396
|
-
export { Upload, UploadDropzone, UploadError, UploadHint, UploadIcon, UploadInput, UploadItem, UploadList, UploadPreview, UploadProgress, UploadRemove, UploadRoot, UploadText, UploadTrigger };
|
|
474
|
+
export { Upload, UploadCancel, UploadDropzone, UploadError, UploadHint, UploadIcon, UploadInput, UploadItem, UploadList, UploadPreview, UploadProgress, UploadRemove, UploadRoot, UploadStatus, UploadText, UploadTrigger };
|
|
397
475
|
|
|
398
476
|
//# sourceMappingURL=upload.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload.js","names":[],"sources":["../../../src/components/upload/upload.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport type { ChangeEvent, ComponentPropsWithoutRef, ReactNode, RefObject } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { upload } from \"../../styled-system/recipes\";\n\nexport type UploadRejectionReason = \"type\" | \"size\" | \"count\" | \"duplicate\";\n\nexport interface UploadRejection {\n file: File;\n message: string;\n reason: UploadRejectionReason;\n}\n\ninterface UploadContextValue {\n accept: string | undefined;\n addFiles: (files: FileList | File[]) => void;\n disabled: boolean;\n dropActive: boolean;\n files: File[];\n inputId: string;\n inputRef: RefObject<HTMLInputElement | null>;\n maxFiles: number | undefined;\n maxSize: number | undefined;\n multiple: boolean;\n removeFile: (file: File) => void;\n rejections: UploadRejection[];\n setDropActive: (active: boolean) => void;\n styles: ReturnType<typeof upload>;\n}\n\nconst UploadContext = createContext<UploadContextValue | null>(null);\n\nfunction useUploadContext() {\n const context = useContext(UploadContext);\n if (!context) {\n throw new Error(\"Upload parts must be rendered inside Upload.Root.\");\n }\n\n return context;\n}\n\nfunction fileKey(file: File) {\n return `${file.name}-${file.size}-${file.lastModified}`;\n}\n\nfunction formatBytes(bytes: number) {\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${Math.round(bytes / 1024)} KB`;\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n}\n\nfunction acceptsFile(file: File, accept: string | undefined) {\n if (!accept) {\n return true;\n }\n\n const fileName = file.name.toLowerCase();\n const fileType = file.type.toLowerCase();\n\n return accept.split(\",\").some((entry) => {\n const pattern = entry.trim().toLowerCase();\n if (!pattern) return true;\n if (pattern.startsWith(\".\")) return fileName.endsWith(pattern);\n if (pattern.endsWith(\"/*\")) return fileType.startsWith(pattern.slice(0, -1));\n return pattern === fileType;\n });\n}\n\nexport interface UploadRootProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"onChange\"> {\n /** Accepted MIME types or file extensions, using the native input syntax. */\n accept?: string;\n /** Controlled files. Use with `onFilesChange`. */\n files?: File[];\n /** Initial files for an uncontrolled upload. */\n defaultFiles?: File[];\n /** Called whenever accepted files are added or removed. */\n onFilesChange?: (files: File[]) => void;\n /** Called with files rejected by `accept`, `maxSize`, `maxFiles` or duplicates. */\n onReject?: (rejections: UploadRejection[]) => void;\n /** Maximum number of accepted files. Defaults to one when `multiple` is false. */\n maxFiles?: number;\n /** Maximum size per file, in bytes. */\n maxSize?: number;\n /** Allows selecting more than one file. */\n multiple?: boolean;\n /** Disables file selection and drag-and-drop. */\n disabled?: boolean;\n children?: ReactNode;\n}\n\nexport const UploadRoot = forwardRef<HTMLDivElement, UploadRootProps>(function UploadRoot(\n {\n accept,\n children,\n className,\n defaultFiles = [],\n disabled = false,\n files: controlledFiles,\n maxFiles,\n maxSize,\n multiple = false,\n onFilesChange,\n onReject,\n ...props\n },\n ref,\n) {\n const [uncontrolledFiles, setUncontrolledFiles] = useState<File[]>(defaultFiles);\n const [dropActive, setDropActive] = useState(false);\n const [rejections, setRejections] = useState<UploadRejection[]>([]);\n const inputRef = useRef<HTMLInputElement>(null);\n const inputId = useId();\n const styles = upload({ disabled, dropActive });\n const currentFiles = controlledFiles ?? uncontrolledFiles;\n const fileLimit = maxFiles ?? (multiple ? undefined : 1);\n\n const updateFiles = useCallback(\n (nextFiles: File[]) => {\n setUncontrolledFiles(nextFiles);\n onFilesChange?.(nextFiles);\n },\n [onFilesChange],\n );\n\n const addFiles = useCallback(\n (fileList: FileList | File[]) => {\n if (disabled) return;\n\n const candidates = Array.from(fileList);\n const acceptedFiles: File[] = [];\n const nextRejections: UploadRejection[] = [];\n const existingKeys = new Set(currentFiles.map(fileKey));\n\n for (const file of candidates) {\n const key = fileKey(file);\n if (existingKeys.has(key) || acceptedFiles.some((accepted) => fileKey(accepted) === key)) {\n nextRejections.push({\n file,\n reason: \"duplicate\",\n message: `${file.name} was already added.`,\n });\n continue;\n }\n if (!acceptsFile(file, accept)) {\n nextRejections.push({\n file,\n reason: \"type\",\n message: `${file.name} is not an accepted file type.`,\n });\n continue;\n }\n if (maxSize !== undefined && file.size > maxSize) {\n nextRejections.push({\n file,\n reason: \"size\",\n message: `${file.name} is larger than the allowed limit.`,\n });\n continue;\n }\n if (\n fileLimit !== undefined &&\n (multiple ? currentFiles.length + acceptedFiles.length : acceptedFiles.length) >=\n fileLimit\n ) {\n nextRejections.push({\n file,\n reason: \"count\",\n message: `Only ${fileLimit} file${fileLimit === 1 ? \"\" : \"s\"} can be selected.`,\n });\n continue;\n }\n acceptedFiles.push(file);\n }\n\n const nextFiles = multiple ? [...currentFiles, ...acceptedFiles] : acceptedFiles.slice(0, 1);\n if (acceptedFiles.length > 0) {\n updateFiles(nextFiles);\n }\n if (nextRejections.length > 0) {\n setRejections(nextRejections);\n onReject?.(nextRejections);\n } else {\n setRejections([]);\n }\n },\n [accept, currentFiles, disabled, fileLimit, maxSize, multiple, onReject, updateFiles],\n );\n\n const removeFile = useCallback(\n (file: File) => {\n updateFiles(currentFiles.filter((current) => fileKey(current) !== fileKey(file)));\n },\n [currentFiles, updateFiles],\n );\n\n const context = useMemo<UploadContextValue>(\n () => ({\n accept,\n addFiles,\n disabled,\n dropActive,\n files: currentFiles,\n inputId,\n inputRef,\n maxFiles: fileLimit,\n maxSize,\n multiple,\n removeFile,\n rejections,\n setDropActive,\n styles,\n }),\n [\n accept,\n addFiles,\n currentFiles,\n disabled,\n dropActive,\n fileLimit,\n inputId,\n maxSize,\n multiple,\n rejections,\n removeFile,\n styles,\n ],\n );\n\n return (\n <UploadContext.Provider value={context}>\n <div\n {...props}\n ref={ref}\n className={cx(styles.root, className)}\n data-disabled={disabled || undefined}\n data-jaci-component=\"upload\"\n data-slot=\"upload\"\n >\n {children}\n </div>\n </UploadContext.Provider>\n );\n});\n\nexport interface UploadDropzoneProps extends ComponentPropsWithoutRef<\"label\"> {\n children?: ReactNode;\n}\n\nexport const UploadDropzone = forwardRef<HTMLLabelElement, UploadDropzoneProps>(\n function UploadDropzone(\n { children, className, htmlFor, onDragEnter, onDragLeave, onDragOver, onDrop, ...props },\n ref,\n ) {\n const { addFiles, disabled, dropActive, inputId, setDropActive, styles } = useUploadContext();\n\n return (\n <label\n {...props}\n ref={ref}\n aria-disabled={disabled || undefined}\n className={cx(styles.dropzone, className)}\n data-drag-active={dropActive || undefined}\n data-slot=\"upload-dropzone\"\n htmlFor={htmlFor ?? inputId}\n onDragEnter={(event) => {\n event.preventDefault();\n if (!disabled) {\n setDropActive(true);\n event.currentTarget.dataset.dragActive = \"true\";\n }\n onDragEnter?.(event);\n }}\n onDragLeave={(event) => {\n event.preventDefault();\n if (event.currentTarget === event.target) {\n setDropActive(false);\n event.currentTarget.dataset.dragActive = \"false\";\n }\n onDragLeave?.(event);\n }}\n onDragOver={(event) => {\n event.preventDefault();\n if (!disabled) setDropActive(true);\n onDragOver?.(event);\n }}\n onDrop={(event) => {\n event.preventDefault();\n setDropActive(false);\n event.currentTarget.dataset.dragActive = \"false\";\n if (!disabled) addFiles(event.dataTransfer.files);\n onDrop?.(event);\n }}\n >\n {children}\n </label>\n );\n },\n);\n\nexport type UploadInputProps = ComponentPropsWithoutRef<\"input\">;\n\nexport const UploadInput = forwardRef<HTMLInputElement, UploadInputProps>(function UploadInput(\n { accept, className, id, multiple, onChange, ...props },\n ref,\n) {\n const {\n addFiles,\n accept: rootAccept,\n disabled,\n inputId,\n inputRef,\n multiple: rootMultiple,\n styles,\n } = useUploadContext();\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n if (event.currentTarget.files) addFiles(event.currentTarget.files);\n event.currentTarget.value = \"\";\n onChange?.(event);\n };\n\n return (\n <input\n {...props}\n accept={accept ?? rootAccept}\n aria-label={props[\"aria-label\"] ?? \"Select files\"}\n className={cx(styles.input, className)}\n disabled={disabled}\n id={id ?? inputId}\n multiple={multiple ?? rootMultiple}\n onChange={handleChange}\n ref={(node) => {\n inputRef.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n }}\n tabIndex={-1}\n type=\"file\"\n />\n );\n});\n\nexport type UploadTriggerProps = ComponentPropsWithoutRef<\"button\">;\n\nexport const UploadTrigger = forwardRef<HTMLButtonElement, UploadTriggerProps>(\n function UploadTrigger(\n { children = \"Choose files\", className, disabled, onClick, ...props },\n ref,\n ) {\n const { disabled: rootDisabled, inputRef, styles } = useUploadContext();\n\n return (\n <button\n {...props}\n className={cx(styles.trigger, className)}\n data-slot=\"upload-trigger\"\n disabled={disabled ?? rootDisabled}\n onClick={(event) => {\n inputRef.current?.click();\n onClick?.(event);\n }}\n ref={ref}\n type=\"button\"\n >\n {children}\n </button>\n );\n },\n);\n\nexport type UploadIconProps = ComponentPropsWithoutRef<\"span\">;\n\nexport const UploadIcon = forwardRef<HTMLSpanElement, UploadIconProps>(function UploadIcon(\n { children = \"↥\", className, ...props },\n ref,\n) {\n const { styles } = useUploadContext();\n return (\n <span\n {...props}\n ref={ref}\n aria-hidden=\"true\"\n className={cx(styles.icon, className)}\n data-slot=\"upload-icon\"\n >\n {children}\n </span>\n );\n});\n\nexport type UploadTextProps = ComponentPropsWithoutRef<\"span\">;\n\nexport const UploadText = forwardRef<HTMLSpanElement, UploadTextProps>(function UploadText(\n { className, ...props },\n ref,\n) {\n const { styles } = useUploadContext();\n return (\n <span {...props} ref={ref} className={cx(styles.text, className)} data-slot=\"upload-text\" />\n );\n});\n\nexport type UploadHintProps = ComponentPropsWithoutRef<\"span\">;\n\nexport const UploadHint = forwardRef<HTMLSpanElement, UploadHintProps>(function UploadHint(\n { className, ...props },\n ref,\n) {\n const { styles } = useUploadContext();\n return (\n <span {...props} ref={ref} className={cx(styles.hint, className)} data-slot=\"upload-hint\" />\n );\n});\n\nexport interface UploadPreviewProps extends ComponentPropsWithoutRef<\"span\"> {\n /** File whose preview should be rendered. Image files use a temporary object URL. */\n file: File;\n /** Alternative text for image previews. Defaults to the file name. */\n alt?: string;\n /** Content rendered while the preview is unavailable or the file is not an image. */\n fallback?: ReactNode;\n}\n\nexport const UploadPreview = forwardRef<HTMLSpanElement, UploadPreviewProps>(function UploadPreview(\n { alt, className, fallback = \"Preview unavailable\", file, ...props },\n ref,\n) {\n const { styles } = useUploadContext();\n const [src, setSrc] = useState<string | null>(null);\n\n useEffect(() => {\n if (\n !file.type.startsWith(\"image/\") ||\n typeof URL === \"undefined\" ||\n typeof URL.createObjectURL !== \"function\"\n ) {\n setSrc(null);\n return;\n }\n\n const objectUrl = URL.createObjectURL(file);\n setSrc(objectUrl);\n return () => URL.revokeObjectURL(objectUrl);\n }, [file]);\n\n return (\n <span\n {...props}\n ref={ref}\n aria-hidden={props[\"aria-label\"] ? undefined : true}\n className={cx(styles.preview, className)}\n data-slot=\"upload-preview\"\n role={props[\"aria-label\"] ? \"img\" : undefined}\n >\n {src ? <img alt={alt ?? file.name} src={src} /> : fallback}\n </span>\n );\n});\n\nexport interface UploadProgressProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> {\n /** Progress from 0 to 100. Omit it for an indeterminate upload. */\n value?: number;\n /** Accessible label and optional visible status text. */\n label?: ReactNode;\n}\n\nexport const UploadProgress = forwardRef<HTMLDivElement, UploadProgressProps>(\n function UploadProgress({ className, label = \"Uploading\", value, ...props }, ref) {\n const { styles } = useUploadContext();\n const normalizedValue = value === undefined ? undefined : Math.min(100, Math.max(0, value));\n\n return (\n <div\n {...props}\n ref={ref}\n aria-label={typeof label === \"string\" ? label : \"Upload progress\"}\n aria-valuemax={100}\n aria-valuemin={0}\n aria-valuenow={normalizedValue}\n className={cx(styles.progress, className)}\n data-indeterminate={normalizedValue === undefined || undefined}\n data-slot=\"upload-progress\"\n role=\"progressbar\"\n >\n <span className={styles.progressTrack} data-slot=\"upload-progress-track\">\n <span\n className={styles.progressIndicator}\n data-indeterminate={normalizedValue === undefined || undefined}\n data-slot=\"upload-progress-indicator\"\n style={{ width: normalizedValue === undefined ? undefined : `${normalizedValue}%` }}\n />\n </span>\n <span className={styles.progressLabel} data-slot=\"upload-progress-label\">\n {label}\n </span>\n </div>\n );\n },\n);\n\nexport type UploadListProps = ComponentPropsWithoutRef<\"ul\">;\n\nexport const UploadList = forwardRef<HTMLUListElement, UploadListProps>(function UploadList(\n { children, className, ...props },\n ref,\n) {\n const { files, styles } = useUploadContext();\n return (\n <ul {...props} ref={ref} className={cx(styles.list, className)} data-slot=\"upload-list\">\n {children ?? files.map((file) => <UploadItem file={file} key={fileKey(file)} />)}\n </ul>\n );\n});\n\nexport interface UploadItemProps extends Omit<ComponentPropsWithoutRef<\"li\">, \"children\"> {\n file: File;\n children?: ReactNode;\n}\n\nexport const UploadItem = forwardRef<HTMLLIElement, UploadItemProps>(function UploadItem(\n { children, className, file, ...props },\n ref,\n) {\n const { styles } = useUploadContext();\n return (\n <li {...props} ref={ref} className={cx(styles.item, className)} data-slot=\"upload-item\">\n {children ?? (\n <>\n <span className={styles.itemName} data-slot=\"upload-item-name\" title={file.name}>\n {file.name}\n </span>\n <span className={styles.itemMeta} data-slot=\"upload-item-meta\">\n {formatBytes(file.size)}\n </span>\n <UploadRemove file={file} />\n </>\n )}\n </li>\n );\n});\n\nexport interface UploadRemoveProps extends ComponentPropsWithoutRef<\"button\"> {\n file: File;\n}\n\nexport const UploadRemove = forwardRef<HTMLButtonElement, UploadRemoveProps>(function UploadRemove(\n { children = \"×\", className, file, onClick, ...props },\n ref,\n) {\n const { disabled, removeFile, styles } = useUploadContext();\n return (\n <button\n {...props}\n aria-label={props[\"aria-label\"] ?? `Remove ${file.name}`}\n className={cx(styles.remove, className)}\n data-slot=\"upload-remove\"\n disabled={disabled}\n onClick={(event) => {\n removeFile(file);\n onClick?.(event);\n }}\n ref={ref}\n type=\"button\"\n >\n {children}\n </button>\n );\n});\n\nexport type UploadErrorProps = ComponentPropsWithoutRef<\"p\">;\n\nexport const UploadError = forwardRef<HTMLParagraphElement, UploadErrorProps>(function UploadError(\n { children, className, ...props },\n ref,\n) {\n const { rejections, styles } = useUploadContext();\n if (children === undefined && rejections.length === 0) return null;\n\n return (\n <p\n {...props}\n ref={ref}\n className={cx(styles.error, className)}\n data-slot=\"upload-error\"\n role=\"alert\"\n >\n {children ?? rejections.map((rejection) => rejection.message).join(\" \")}\n </p>\n );\n});\n\nexport const Upload = {\n Root: UploadRoot,\n Dropzone: UploadDropzone,\n Input: UploadInput,\n Trigger: UploadTrigger,\n Icon: UploadIcon,\n Text: UploadText,\n Hint: UploadHint,\n Preview: UploadPreview,\n Progress: UploadProgress,\n List: UploadList,\n Item: UploadItem,\n Remove: UploadRemove,\n Error: UploadError,\n};\n"],"mappings":";;;;;;AA2CA,MAAM,gBAAgB,cAAyC,IAAI;AAEnE,SAAS,mBAAmB;CAC1B,MAAM,UAAU,WAAW,aAAa;CACxC,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,mDAAmD;CAGrE,OAAO;AACT;AAEA,SAAS,QAAQ,MAAY;CAC3B,OAAO,GAAG,KAAK,KAAK,GAAG,KAAK,KAAK,GAAG,KAAK;AAC3C;AAEA,SAAS,YAAY,OAAe;CAClC,IAAI,QAAQ,MAAM,OAAO,GAAG,MAAM;CAClC,IAAI,QA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/components/upload/upload.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport type { ChangeEvent, ComponentPropsWithoutRef, ReactNode, RefObject } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { upload } from \"../../styled-system/recipes\";\n\nexport type UploadRejectionReason = \"type\" | \"size\" | \"count\" | \"duplicate\" | \"validation\";\n\nexport type UploadFileStatus = \"queued\" | \"uploading\" | \"success\" | \"error\" | \"canceled\";\n\nexport interface UploadFileState {\n status: UploadFileStatus;\n progress?: number;\n error?: ReactNode;\n}\n\nexport interface UploadRejection {\n file: File;\n message: string;\n reason: UploadRejectionReason;\n}\n\ninterface UploadContextValue {\n accept: string | undefined;\n addFiles: (files: FileList | File[]) => void;\n disabled: boolean;\n dropActive: boolean;\n files: File[];\n inputId: string;\n inputRef: RefObject<HTMLInputElement | null>;\n fileState: ((file: File) => UploadFileState | undefined) | undefined;\n maxFiles: number | undefined;\n maxSize: number | undefined;\n multiple: boolean;\n removeFile: (file: File) => void;\n cancelFile: (file: File) => void;\n rejections: UploadRejection[];\n setDropActive: (active: boolean) => void;\n styles: ReturnType<typeof upload>;\n}\n\nconst UploadContext = createContext<UploadContextValue | null>(null);\n\nfunction useUploadContext() {\n const context = useContext(UploadContext);\n if (!context) {\n throw new Error(\"Upload parts must be rendered inside Upload.Root.\");\n }\n\n return context;\n}\n\nfunction fileKey(file: File) {\n return `${file.name}-${file.size}-${file.lastModified}`;\n}\n\nfunction formatBytes(bytes: number) {\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${Math.round(bytes / 1024)} KB`;\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n}\n\nfunction acceptsFile(file: File, accept: string | undefined) {\n if (!accept) {\n return true;\n }\n\n const fileName = file.name.toLowerCase();\n const fileType = file.type.toLowerCase();\n\n return accept.split(\",\").some((entry) => {\n const pattern = entry.trim().toLowerCase();\n if (!pattern) return true;\n if (pattern.startsWith(\".\")) return fileName.endsWith(pattern);\n if (pattern.endsWith(\"/*\")) return fileType.startsWith(pattern.slice(0, -1));\n return pattern === fileType;\n });\n}\n\nexport interface UploadRootProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"onChange\"> {\n /** Accepted MIME types or file extensions, using the native input syntax. */\n accept?: string;\n /** Controlled files. Use with `onFilesChange`. */\n files?: File[];\n /** Initial files for an uncontrolled upload. */\n defaultFiles?: File[];\n /** Called whenever accepted files are added or removed. */\n onFilesChange?: (files: File[]) => void;\n /** Called with files rejected by `accept`, `maxSize`, `maxFiles` or duplicates. */\n onReject?: (rejections: UploadRejection[]) => void;\n /** Maximum number of accepted files. Defaults to one when `multiple` is false. */\n maxFiles?: number;\n /** Maximum size per file, in bytes. */\n maxSize?: number;\n /** Allows selecting more than one file. */\n multiple?: boolean;\n /** Disables file selection and drag-and-drop. */\n disabled?: boolean;\n /** Optional asynchronous validation. Return an error message to reject a file. */\n validateFile?: (file: File) => string | null | Promise<string | null>;\n /** Controlled status used by the status, progress and cancel slots. */\n fileState?: (file: File) => UploadFileState | undefined;\n /** Called when a consumer cancels an upload. */\n onCancel?: (file: File) => void;\n children?: ReactNode;\n}\n\nexport const UploadRoot = forwardRef<HTMLDivElement, UploadRootProps>(function UploadRoot(\n {\n accept,\n fileState,\n children,\n className,\n defaultFiles = [],\n disabled = false,\n files: controlledFiles,\n maxFiles,\n maxSize,\n multiple = false,\n onFilesChange,\n onCancel,\n onReject,\n validateFile,\n ...props\n },\n ref,\n) {\n const [uncontrolledFiles, setUncontrolledFiles] = useState<File[]>(defaultFiles);\n const [dropActive, setDropActive] = useState(false);\n const [rejections, setRejections] = useState<UploadRejection[]>([]);\n const inputRef = useRef<HTMLInputElement>(null);\n const inputId = useId();\n const styles = upload({ disabled, dropActive });\n const currentFiles = controlledFiles ?? uncontrolledFiles;\n const fileLimit = maxFiles ?? (multiple ? undefined : 1);\n\n const updateFiles = useCallback(\n (nextFiles: File[]) => {\n if (controlledFiles === undefined) setUncontrolledFiles(nextFiles);\n onFilesChange?.(nextFiles);\n },\n [controlledFiles, onFilesChange],\n );\n\n const removeFile = useCallback(\n (file: File) => {\n updateFiles(currentFiles.filter((current) => fileKey(current) !== fileKey(file)));\n },\n [currentFiles, updateFiles],\n );\n\n const addFiles = useCallback(\n (fileList: FileList | File[]) => {\n if (disabled) return;\n\n const candidates = Array.from(fileList);\n const acceptedFiles: File[] = [];\n const nextRejections: UploadRejection[] = [];\n const pendingValidations = new Map<File, Promise<string | null>>();\n const existingKeys = new Set(currentFiles.map(fileKey));\n\n for (const file of candidates) {\n const key = fileKey(file);\n if (existingKeys.has(key) || acceptedFiles.some((accepted) => fileKey(accepted) === key)) {\n nextRejections.push({\n file,\n reason: \"duplicate\",\n message: `${file.name} was already added.`,\n });\n continue;\n }\n if (!acceptsFile(file, accept)) {\n nextRejections.push({\n file,\n reason: \"type\",\n message: `${file.name} is not an accepted file type.`,\n });\n continue;\n }\n if (maxSize !== undefined && file.size > maxSize) {\n nextRejections.push({\n file,\n reason: \"size\",\n message: `${file.name} is larger than the allowed limit.`,\n });\n continue;\n }\n if (\n fileLimit !== undefined &&\n (multiple ? currentFiles.length + acceptedFiles.length : acceptedFiles.length) >=\n fileLimit\n ) {\n nextRejections.push({\n file,\n reason: \"count\",\n message: `Only ${fileLimit} file${fileLimit === 1 ? \"\" : \"s\"} can be selected.`,\n });\n continue;\n }\n if (validateFile) {\n const validation = validateFile(file);\n if (validation && typeof validation !== \"object\") {\n nextRejections.push({ file, reason: \"validation\", message: validation });\n continue;\n }\n if (validation && typeof validation === \"object\" && \"then\" in validation) {\n pendingValidations.set(file, Promise.resolve(validation));\n }\n }\n acceptedFiles.push(file);\n }\n\n const nextFiles = multiple ? [...currentFiles, ...acceptedFiles] : acceptedFiles.slice(0, 1);\n if (acceptedFiles.length > 0) {\n updateFiles(nextFiles);\n }\n if (validateFile) {\n for (const file of acceptedFiles) {\n const validation = pendingValidations.get(file);\n if (validation) {\n void validation\n .then((message) => {\n if (!message) return;\n const rejection = { file, reason: \"validation\" as const, message };\n updateFiles(nextFiles.filter((current) => fileKey(current) !== fileKey(file)));\n setRejections((current) => [...current, rejection]);\n onReject?.([rejection]);\n })\n .catch((error: unknown) => {\n const message = error instanceof Error ? error.message : \"File validation failed.\";\n const rejection = { file, reason: \"validation\" as const, message };\n updateFiles(nextFiles.filter((current) => fileKey(current) !== fileKey(file)));\n setRejections((current) => [...current, rejection]);\n onReject?.([rejection]);\n });\n }\n }\n }\n if (nextRejections.length > 0) {\n setRejections(nextRejections);\n onReject?.(nextRejections);\n } else {\n setRejections([]);\n }\n },\n [\n accept,\n currentFiles,\n disabled,\n fileLimit,\n maxSize,\n multiple,\n onReject,\n updateFiles,\n validateFile,\n ],\n );\n\n const cancelFile = useCallback((file: File) => onCancel?.(file), [onCancel]);\n\n const context = useMemo<UploadContextValue>(\n () => ({\n accept,\n addFiles,\n cancelFile,\n disabled,\n dropActive,\n files: currentFiles,\n inputId,\n inputRef,\n fileState,\n maxFiles: fileLimit,\n maxSize,\n multiple,\n removeFile,\n rejections,\n setDropActive,\n styles,\n }),\n [\n accept,\n addFiles,\n cancelFile,\n currentFiles,\n disabled,\n dropActive,\n fileLimit,\n fileState,\n inputId,\n maxSize,\n multiple,\n rejections,\n removeFile,\n styles,\n ],\n );\n\n return (\n <UploadContext.Provider value={context}>\n <div\n {...props}\n ref={ref}\n className={cx(styles.root, className)}\n data-disabled={disabled || undefined}\n data-jaci-component=\"upload\"\n data-slot=\"upload\"\n >\n {children}\n </div>\n </UploadContext.Provider>\n );\n});\n\nexport interface UploadDropzoneProps extends ComponentPropsWithoutRef<\"label\"> {\n children?: ReactNode;\n}\n\nexport const UploadDropzone = forwardRef<HTMLLabelElement, UploadDropzoneProps>(\n function UploadDropzone(\n { children, className, htmlFor, onDragEnter, onDragLeave, onDragOver, onDrop, ...props },\n ref,\n ) {\n const { addFiles, disabled, dropActive, inputId, setDropActive, styles } = useUploadContext();\n\n return (\n <label\n {...props}\n ref={ref}\n aria-disabled={disabled || undefined}\n className={cx(styles.dropzone, className)}\n data-drag-active={dropActive || undefined}\n data-slot=\"upload-dropzone\"\n htmlFor={htmlFor ?? inputId}\n onDragEnter={(event) => {\n event.preventDefault();\n if (!disabled) {\n setDropActive(true);\n event.currentTarget.dataset.dragActive = \"true\";\n }\n onDragEnter?.(event);\n }}\n onDragLeave={(event) => {\n event.preventDefault();\n if (event.currentTarget === event.target) {\n setDropActive(false);\n event.currentTarget.dataset.dragActive = \"false\";\n }\n onDragLeave?.(event);\n }}\n onDragOver={(event) => {\n event.preventDefault();\n if (!disabled) setDropActive(true);\n onDragOver?.(event);\n }}\n onDrop={(event) => {\n event.preventDefault();\n setDropActive(false);\n event.currentTarget.dataset.dragActive = \"false\";\n if (!disabled) addFiles(event.dataTransfer.files);\n onDrop?.(event);\n }}\n >\n {children}\n </label>\n );\n },\n);\n\nexport type UploadInputProps = ComponentPropsWithoutRef<\"input\">;\n\nexport const UploadInput = forwardRef<HTMLInputElement, UploadInputProps>(function UploadInput(\n { accept, className, id, multiple, onChange, ...props },\n ref,\n) {\n const {\n addFiles,\n accept: rootAccept,\n disabled,\n inputId,\n inputRef,\n multiple: rootMultiple,\n styles,\n } = useUploadContext();\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n if (event.currentTarget.files) addFiles(event.currentTarget.files);\n event.currentTarget.value = \"\";\n onChange?.(event);\n };\n\n return (\n <input\n {...props}\n accept={accept ?? rootAccept}\n aria-label={props[\"aria-label\"] ?? \"Select files\"}\n className={cx(styles.input, className)}\n disabled={disabled}\n id={id ?? inputId}\n multiple={multiple ?? rootMultiple}\n onChange={handleChange}\n ref={(node) => {\n inputRef.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n }}\n tabIndex={-1}\n type=\"file\"\n />\n );\n});\n\nexport type UploadTriggerProps = ComponentPropsWithoutRef<\"button\">;\n\nexport const UploadTrigger = forwardRef<HTMLButtonElement, UploadTriggerProps>(\n function UploadTrigger(\n { children = \"Choose files\", className, disabled, onClick, ...props },\n ref,\n ) {\n const { disabled: rootDisabled, inputRef, styles } = useUploadContext();\n\n return (\n <button\n {...props}\n className={cx(styles.trigger, className)}\n data-slot=\"upload-trigger\"\n disabled={disabled ?? rootDisabled}\n onClick={(event) => {\n inputRef.current?.click();\n onClick?.(event);\n }}\n ref={ref}\n type=\"button\"\n >\n {children}\n </button>\n );\n },\n);\n\nexport type UploadIconProps = ComponentPropsWithoutRef<\"span\">;\n\nexport const UploadIcon = forwardRef<HTMLSpanElement, UploadIconProps>(function UploadIcon(\n { children = \"↥\", className, ...props },\n ref,\n) {\n const { styles } = useUploadContext();\n return (\n <span\n {...props}\n ref={ref}\n aria-hidden=\"true\"\n className={cx(styles.icon, className)}\n data-slot=\"upload-icon\"\n >\n {children}\n </span>\n );\n});\n\nexport type UploadTextProps = ComponentPropsWithoutRef<\"span\">;\n\nexport const UploadText = forwardRef<HTMLSpanElement, UploadTextProps>(function UploadText(\n { className, ...props },\n ref,\n) {\n const { styles } = useUploadContext();\n return (\n <span {...props} ref={ref} className={cx(styles.text, className)} data-slot=\"upload-text\" />\n );\n});\n\nexport type UploadHintProps = ComponentPropsWithoutRef<\"span\">;\n\nexport const UploadHint = forwardRef<HTMLSpanElement, UploadHintProps>(function UploadHint(\n { className, ...props },\n ref,\n) {\n const { styles } = useUploadContext();\n return (\n <span {...props} ref={ref} className={cx(styles.hint, className)} data-slot=\"upload-hint\" />\n );\n});\n\nexport interface UploadPreviewProps extends ComponentPropsWithoutRef<\"span\"> {\n /** File whose preview should be rendered. Image files use a temporary object URL. */\n file: File;\n /** Alternative text for image previews. Defaults to the file name. */\n alt?: string;\n /** Content rendered while the preview is unavailable or the file is not an image. */\n fallback?: ReactNode;\n}\n\nexport const UploadPreview = forwardRef<HTMLSpanElement, UploadPreviewProps>(function UploadPreview(\n { alt, className, fallback = \"Preview unavailable\", file, ...props },\n ref,\n) {\n const { styles } = useUploadContext();\n const [src, setSrc] = useState<string | null>(null);\n\n useEffect(() => {\n if (\n !file.type.startsWith(\"image/\") ||\n typeof URL === \"undefined\" ||\n typeof URL.createObjectURL !== \"function\"\n ) {\n setSrc(null);\n return;\n }\n\n const objectUrl = URL.createObjectURL(file);\n setSrc(objectUrl);\n return () => URL.revokeObjectURL(objectUrl);\n }, [file]);\n\n return (\n <span\n {...props}\n ref={ref}\n aria-hidden={props[\"aria-label\"] ? undefined : true}\n className={cx(styles.preview, className)}\n data-slot=\"upload-preview\"\n role={props[\"aria-label\"] ? \"img\" : undefined}\n >\n {src ? <img alt={alt ?? file.name} src={src} /> : fallback}\n </span>\n );\n});\n\nexport interface UploadProgressProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> {\n /** Progress from 0 to 100. Omit it for an indeterminate upload. */\n value?: number;\n /** Accessible label and optional visible status text. */\n label?: ReactNode;\n file?: File;\n}\n\nexport const UploadProgress = forwardRef<HTMLDivElement, UploadProgressProps>(\n function UploadProgress({ className, file, label = \"Uploading\", value, ...props }, ref) {\n const { fileState, styles } = useUploadContext();\n const state = file ? fileState?.(file) : undefined;\n const normalizedValue =\n value === undefined\n ? state?.progress === undefined\n ? undefined\n : Math.min(100, Math.max(0, state.progress))\n : Math.min(100, Math.max(0, value));\n\n return (\n <div\n {...props}\n ref={ref}\n aria-label={typeof label === \"string\" ? label : \"Upload progress\"}\n aria-valuemax={100}\n aria-valuemin={0}\n aria-valuenow={normalizedValue}\n className={cx(styles.progress, className)}\n data-indeterminate={normalizedValue === undefined || undefined}\n data-slot=\"upload-progress\"\n role=\"progressbar\"\n >\n <span className={styles.progressTrack} data-slot=\"upload-progress-track\">\n <span\n className={styles.progressIndicator}\n data-indeterminate={normalizedValue === undefined || undefined}\n data-slot=\"upload-progress-indicator\"\n style={{ width: normalizedValue === undefined ? undefined : `${normalizedValue}%` }}\n />\n </span>\n <span className={styles.progressLabel} data-slot=\"upload-progress-label\">\n {label}\n </span>\n </div>\n );\n },\n);\n\nexport type UploadListProps = ComponentPropsWithoutRef<\"ul\">;\n\nexport const UploadList = forwardRef<HTMLUListElement, UploadListProps>(function UploadList(\n { children, className, ...props },\n ref,\n) {\n const { files, styles } = useUploadContext();\n return (\n <ul {...props} ref={ref} className={cx(styles.list, className)} data-slot=\"upload-list\">\n {children ?? files.map((file) => <UploadItem file={file} key={fileKey(file)} />)}\n </ul>\n );\n});\n\nexport interface UploadItemProps extends Omit<ComponentPropsWithoutRef<\"li\">, \"children\"> {\n file: File;\n children?: ReactNode;\n}\n\nexport const UploadItem = forwardRef<HTMLLIElement, UploadItemProps>(function UploadItem(\n { children, className, file, ...props },\n ref,\n) {\n const { styles } = useUploadContext();\n return (\n <li {...props} ref={ref} className={cx(styles.item, className)} data-slot=\"upload-item\">\n {children ?? (\n <>\n <span className={styles.itemName} data-slot=\"upload-item-name\" title={file.name}>\n {file.name}\n </span>\n <span className={styles.itemMeta} data-slot=\"upload-item-meta\">\n {formatBytes(file.size)}\n </span>\n <UploadRemove file={file} />\n </>\n )}\n </li>\n );\n});\n\nexport interface UploadRemoveProps extends ComponentPropsWithoutRef<\"button\"> {\n file: File;\n}\n\nexport const UploadRemove = forwardRef<HTMLButtonElement, UploadRemoveProps>(function UploadRemove(\n { children = \"×\", className, file, onClick, ...props },\n ref,\n) {\n const { disabled, removeFile, styles } = useUploadContext();\n return (\n <button\n {...props}\n aria-label={props[\"aria-label\"] ?? `Remove ${file.name}`}\n className={cx(styles.remove, className)}\n data-slot=\"upload-remove\"\n disabled={disabled}\n onClick={(event) => {\n removeFile(file);\n onClick?.(event);\n }}\n ref={ref}\n type=\"button\"\n >\n {children}\n </button>\n );\n});\n\nexport interface UploadStatusProps extends ComponentPropsWithoutRef<\"span\"> {\n file: File;\n}\n\nexport const UploadStatus = forwardRef<HTMLSpanElement, UploadStatusProps>(function UploadStatus(\n { children, className, file, ...props },\n ref,\n) {\n const { fileState, styles } = useUploadContext();\n const state = fileState?.(file);\n const content = children ?? state?.error ?? state?.status ?? \"queued\";\n return (\n <span\n {...props}\n aria-live=\"polite\"\n className={cx(styles.status, className)}\n data-status={state?.status}\n data-slot=\"upload-status\"\n ref={ref}\n >\n {content}\n </span>\n );\n});\n\nexport interface UploadCancelProps extends ComponentPropsWithoutRef<\"button\"> {\n file: File;\n}\n\nexport const UploadCancel = forwardRef<HTMLButtonElement, UploadCancelProps>(function UploadCancel(\n { children = \"Cancel\", className, file, onClick, ...props },\n ref,\n) {\n const { cancelFile, disabled, fileState, styles } = useUploadContext();\n const state = fileState?.(file);\n return (\n <button\n {...props}\n aria-label={props[\"aria-label\"] ?? `Cancel ${file.name}`}\n className={cx(styles.cancel, className)}\n data-slot=\"upload-cancel\"\n disabled={disabled || state?.status === \"canceled\" || state?.status === \"success\"}\n onClick={(event) => {\n cancelFile(file);\n onClick?.(event);\n }}\n ref={ref}\n type=\"button\"\n >\n {children}\n </button>\n );\n});\n\nexport type UploadErrorProps = ComponentPropsWithoutRef<\"p\">;\n\nexport const UploadError = forwardRef<HTMLParagraphElement, UploadErrorProps>(function UploadError(\n { children, className, ...props },\n ref,\n) {\n const { rejections, styles } = useUploadContext();\n if (children === undefined && rejections.length === 0) return null;\n\n return (\n <p\n {...props}\n ref={ref}\n className={cx(styles.error, className)}\n data-slot=\"upload-error\"\n role=\"alert\"\n >\n {children ?? rejections.map((rejection) => rejection.message).join(\" \")}\n </p>\n );\n});\n\nexport const Upload = {\n Root: UploadRoot,\n Dropzone: UploadDropzone,\n Input: UploadInput,\n Trigger: UploadTrigger,\n Icon: UploadIcon,\n Text: UploadText,\n Hint: UploadHint,\n Preview: UploadPreview,\n Progress: UploadProgress,\n List: UploadList,\n Item: UploadItem,\n Remove: UploadRemove,\n Status: UploadStatus,\n Cancel: UploadCancel,\n Error: UploadError,\n};\n"],"mappings":";;;;;;AAqDA,MAAM,gBAAgB,cAAyC,IAAI;AAEnE,SAAS,mBAAmB;CAC1B,MAAM,UAAU,WAAW,aAAa;CACx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AAC;AAMD,MAAa,eAAe,WAAiD,SAAS,aACpF,EAAE,WAAW,UAAU,WAAW,MAAM,SAAS,GAAG,SACpD,KACA;CACA,MAAM,EAAE,YAAY,UAAU,WAAW,WAAW,iBAAiB;CACrE,MAAM,QAAQ,YAAY,IAAI;CAC9B,OACE,oBAAC,UAAD;EACE,GAAI;EACJ,cAAY,MAAM,iBAAiB,UAAU,KAAK;EAClD,WAAW,GAAG,OAAO,QAAQ,SAAS;EACtC,aAAU;EACV,UAAU,YAAY,OAAO,WAAW,cAAc,OAAO,WAAW;EACxE,UAAU,UAAU;GAClB,WAAW,IAAI;GACf,UAAU,KAAK;EACjB;EACK;EACL,MAAK;EAEJ;CACK,CAAA;AAEZ,CAAC;AAID,MAAa,cAAc,WAAmD,SAAS,YACrF,EAAE,UAAU,WAAW,GAAG,SAC1B,KACA;CACA,MAAM,EAAE,YAAY,WAAW,iBAAiB;CAChD,IAAI,aAAa,KAAA,KAAa,WAAW,WAAW,GAAG,OAAO;CAE9D,OACE,oBAAC,KAAD;EACE,GAAI;EACC;EACL,WAAW,GAAG,OAAO,OAAO,SAAS;EACrC,aAAU;EACV,MAAK;YAEJ,YAAY,WAAW,KAAK,cAAc,UAAU,OAAO,CAAC,CAAC,KAAK,GAAG;CACrE,CAAA;AAEP,CAAC;AAED,MAAa,SAAS;CACpB,MAAM;CACN,UAAU;CACV,OAAO;CACP,SAAS;CACT,MAAM;CACN,MAAM;CACN,MAAM;CACN,SAAS;CACT,UAAU;CACV,MAAM;CACN,MAAM;CACN,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,OAAO;AACT"}
|
package/dist/index.cjs
CHANGED
|
@@ -7,6 +7,7 @@ const require_breadcrumbs = require("./components/breadcrumbs/breadcrumbs.cjs");
|
|
|
7
7
|
const require_index = require("./components/layout/index.cjs");
|
|
8
8
|
const require_button = require("./components/button/button.cjs");
|
|
9
9
|
const require_button_group = require("./components/button-group/button-group.cjs");
|
|
10
|
+
const require_calendar = require("./components/calendar/calendar.cjs");
|
|
10
11
|
const require_card = require("./components/card/card.cjs");
|
|
11
12
|
const require_form = require("./components/form/form.cjs");
|
|
12
13
|
const require_field = require("./components/field/field.cjs");
|
|
@@ -14,12 +15,14 @@ const require_checkbox_group = require("./components/checkbox-group/checkbox-gro
|
|
|
14
15
|
const require_collapsible = require("./components/collapsible/collapsible.cjs");
|
|
15
16
|
const require_combobox = require("./components/combobox/combobox.cjs");
|
|
16
17
|
const require_checkbox = require("./components/controls/checkbox.cjs");
|
|
18
|
+
const require_input_group = require("./components/input-group/input-group.cjs");
|
|
17
19
|
const require_input = require("./components/controls/input.cjs");
|
|
18
20
|
const require_radio = require("./components/controls/radio.cjs");
|
|
19
21
|
const require_switch = require("./components/controls/switch.cjs");
|
|
20
22
|
const require_textarea = require("./components/controls/textarea.cjs");
|
|
21
23
|
const require_dialog = require("./components/dialog/dialog.cjs");
|
|
22
24
|
const require_date_picker = require("./components/date-picker/date-picker.cjs");
|
|
25
|
+
const require_date_range_picker = require("./components/date-range-picker/date-range-picker.cjs");
|
|
23
26
|
const require_drawer = require("./components/drawer/drawer.cjs");
|
|
24
27
|
const require_badge = require("./components/feedback/badge.cjs");
|
|
25
28
|
const require_fieldset = require("./components/fieldset/fieldset.cjs");
|
|
@@ -32,7 +35,6 @@ const require_copyable = require("./components/copyable/copyable.cjs");
|
|
|
32
35
|
const require_data_view = require("./components/data-view/data-view.cjs");
|
|
33
36
|
const require_empty_state = require("./components/empty-state/empty-state.cjs");
|
|
34
37
|
const require_icon_button = require("./components/icon-button/icon-button.cjs");
|
|
35
|
-
const require_input_group = require("./components/input-group/input-group.cjs");
|
|
36
38
|
const require_list = require("./components/list/list.cjs");
|
|
37
39
|
const require_menubar = require("./components/menubar/menubar.cjs");
|
|
38
40
|
const require_meter = require("./components/meter/meter.cjs");
|
|
@@ -41,6 +43,7 @@ const require_navigation = require("./components/navigation/navigation.cjs");
|
|
|
41
43
|
const require_navigation_menu = require("./components/navigation-menu/navigation-menu.cjs");
|
|
42
44
|
const require_option_selector = require("./components/option-selector/option-selector.cjs");
|
|
43
45
|
const require_pagination = require("./components/pagination/pagination.cjs");
|
|
46
|
+
const require_pin_input = require("./components/pin-input/pin-input.cjs");
|
|
44
47
|
const require_popover = require("./components/popover/popover.cjs");
|
|
45
48
|
const require_progress = require("./components/progress/progress.cjs");
|
|
46
49
|
const require_radio_group = require("./components/radio-group/radio-group.cjs");
|
|
@@ -111,6 +114,16 @@ exports.BreadcrumbsSeparator = require_breadcrumbs.BreadcrumbsSeparator;
|
|
|
111
114
|
exports.Button = require_button.Button;
|
|
112
115
|
exports.ButtonGroup = require_button_group.ButtonGroup;
|
|
113
116
|
exports.ButtonGroupRoot = require_button_group.ButtonGroupRoot;
|
|
117
|
+
exports.Calendar = require_calendar.Calendar;
|
|
118
|
+
exports.CalendarCaption = require_calendar.CalendarCaption;
|
|
119
|
+
exports.CalendarDay = require_calendar.CalendarDay;
|
|
120
|
+
exports.CalendarGrid = require_calendar.CalendarGrid;
|
|
121
|
+
exports.CalendarHeader = require_calendar.CalendarHeader;
|
|
122
|
+
exports.CalendarMonthSelect = require_calendar.CalendarMonthSelect;
|
|
123
|
+
exports.CalendarNext = require_calendar.CalendarNext;
|
|
124
|
+
exports.CalendarPrevious = require_calendar.CalendarPrevious;
|
|
125
|
+
exports.CalendarRoot = require_calendar.CalendarRoot;
|
|
126
|
+
exports.CalendarYearSelect = require_calendar.CalendarYearSelect;
|
|
114
127
|
exports.Card = require_card.Card;
|
|
115
128
|
exports.CardContent = require_card.CardContent;
|
|
116
129
|
exports.CardFooter = require_card.CardFooter;
|
|
@@ -159,6 +172,7 @@ exports.ComboboxItem = require_combobox.ComboboxItem;
|
|
|
159
172
|
exports.ComboboxItemIndicator = require_combobox.ComboboxItemIndicator;
|
|
160
173
|
exports.ComboboxLabel = require_combobox.ComboboxLabel;
|
|
161
174
|
exports.ComboboxList = require_combobox.ComboboxList;
|
|
175
|
+
exports.ComboboxLoading = require_combobox.ComboboxLoading;
|
|
162
176
|
exports.ComboboxPopup = require_combobox.ComboboxPopup;
|
|
163
177
|
exports.ComboboxPortal = require_combobox.ComboboxPortal;
|
|
164
178
|
exports.ComboboxPositioner = require_combobox.ComboboxPositioner;
|
|
@@ -227,6 +241,27 @@ exports.DatePickerTimeField = require_date_picker.DatePickerTimeField;
|
|
|
227
241
|
exports.DatePickerTrigger = require_date_picker.DatePickerTrigger;
|
|
228
242
|
exports.DatePickerValue = require_date_picker.DatePickerValue;
|
|
229
243
|
exports.DatePickerYearSelect = require_date_picker.DatePickerYearSelect;
|
|
244
|
+
exports.DateRangePicker = require_date_range_picker.DateRangePicker;
|
|
245
|
+
exports.DateRangePickerCalendar = require_date_range_picker.DateRangePickerCalendar;
|
|
246
|
+
exports.DateRangePickerClear = require_date_range_picker.DateRangePickerClear;
|
|
247
|
+
exports.DateRangePickerClose = require_date_range_picker.DateRangePickerClose;
|
|
248
|
+
exports.DateRangePickerControl = require_date_range_picker.DateRangePickerControl;
|
|
249
|
+
exports.DateRangePickerDay = require_date_range_picker.DateRangePickerDay;
|
|
250
|
+
exports.DateRangePickerEndInput = require_date_range_picker.DateRangePickerEndInput;
|
|
251
|
+
exports.DateRangePickerHeader = require_date_range_picker.DateRangePickerHeader;
|
|
252
|
+
exports.DateRangePickerLabel = require_date_range_picker.DateRangePickerLabel;
|
|
253
|
+
exports.DateRangePickerMonthSelect = require_date_range_picker.DateRangePickerMonthSelect;
|
|
254
|
+
exports.DateRangePickerNext = require_date_range_picker.DateRangePickerNext;
|
|
255
|
+
exports.DateRangePickerPopup = require_date_range_picker.DateRangePickerPopup;
|
|
256
|
+
exports.DateRangePickerPortal = require_date_range_picker.DateRangePickerPortal;
|
|
257
|
+
exports.DateRangePickerPositioner = require_date_range_picker.DateRangePickerPositioner;
|
|
258
|
+
exports.DateRangePickerPreview = require_date_range_picker.DateRangePickerPreview;
|
|
259
|
+
exports.DateRangePickerPrevious = require_date_range_picker.DateRangePickerPrevious;
|
|
260
|
+
exports.DateRangePickerRoot = require_date_range_picker.DateRangePickerRoot;
|
|
261
|
+
exports.DateRangePickerStartInput = require_date_range_picker.DateRangePickerStartInput;
|
|
262
|
+
exports.DateRangePickerTrigger = require_date_range_picker.DateRangePickerTrigger;
|
|
263
|
+
exports.DateRangePickerValue = require_date_range_picker.DateRangePickerValue;
|
|
264
|
+
exports.DateRangePickerYearSelect = require_date_range_picker.DateRangePickerYearSelect;
|
|
230
265
|
exports.Dialog = require_dialog.Dialog;
|
|
231
266
|
exports.DialogBackdrop = require_dialog.DialogBackdrop;
|
|
232
267
|
exports.DialogBody = require_dialog.DialogBody;
|
|
@@ -260,6 +295,7 @@ exports.EmptyStateIcon = require_empty_state.EmptyStateIcon;
|
|
|
260
295
|
exports.EmptyStateRoot = require_empty_state.EmptyStateRoot;
|
|
261
296
|
exports.EmptyStateTitle = require_empty_state.EmptyStateTitle;
|
|
262
297
|
exports.Field = require_field.Field;
|
|
298
|
+
exports.FieldControl = require_field.FieldControl;
|
|
263
299
|
exports.FieldDescription = require_field.FieldDescription;
|
|
264
300
|
exports.FieldError = require_field.FieldError;
|
|
265
301
|
exports.FieldLabel = require_field.FieldLabel;
|
|
@@ -365,6 +401,15 @@ exports.PaginationNext = require_pagination.PaginationNext;
|
|
|
365
401
|
exports.PaginationPrevious = require_pagination.PaginationPrevious;
|
|
366
402
|
exports.PaginationRoot = require_pagination.PaginationRoot;
|
|
367
403
|
exports.Paragraph = require_paragraph.Paragraph;
|
|
404
|
+
exports.PinInput = require_pin_input.PinInput;
|
|
405
|
+
exports.PinInputControl = require_pin_input.PinInputControl;
|
|
406
|
+
exports.PinInputDescription = require_pin_input.PinInputDescription;
|
|
407
|
+
exports.PinInputError = require_pin_input.PinInputError;
|
|
408
|
+
exports.PinInputHiddenInput = require_pin_input.PinInputHiddenInput;
|
|
409
|
+
exports.PinInputInput = require_pin_input.PinInputInput;
|
|
410
|
+
exports.PinInputInputs = require_pin_input.PinInputInputs;
|
|
411
|
+
exports.PinInputLabel = require_pin_input.PinInputLabel;
|
|
412
|
+
exports.PinInputRoot = require_pin_input.PinInputRoot;
|
|
368
413
|
exports.Popover = require_popover.Popover;
|
|
369
414
|
exports.PopoverArrow = require_popover.PopoverArrow;
|
|
370
415
|
exports.PopoverClose = require_popover.PopoverClose;
|
|
@@ -400,6 +445,8 @@ exports.ScrollAreaScrollbar = require_scroll_area.ScrollAreaScrollbar;
|
|
|
400
445
|
exports.ScrollAreaThumb = require_scroll_area.ScrollAreaThumb;
|
|
401
446
|
exports.ScrollAreaViewport = require_scroll_area.ScrollAreaViewport;
|
|
402
447
|
exports.Select = require_select.Select;
|
|
448
|
+
exports.SelectClear = require_select.SelectClear;
|
|
449
|
+
exports.SelectEmpty = require_select.SelectEmpty;
|
|
403
450
|
exports.SelectGroup = require_select.SelectGroup;
|
|
404
451
|
exports.SelectGroupLabel = require_select.SelectGroupLabel;
|
|
405
452
|
exports.SelectIcon = require_select.SelectIcon;
|
|
@@ -408,11 +455,13 @@ exports.SelectItemIndicator = require_select.SelectItemIndicator;
|
|
|
408
455
|
exports.SelectItemText = require_select.SelectItemText;
|
|
409
456
|
exports.SelectLabel = require_select.SelectLabel;
|
|
410
457
|
exports.SelectList = require_select.SelectList;
|
|
458
|
+
exports.SelectLoading = require_select.SelectLoading;
|
|
411
459
|
exports.SelectPopup = require_select.SelectPopup;
|
|
412
460
|
exports.SelectPortal = require_select.SelectPortal;
|
|
413
461
|
exports.SelectPositioner = require_select.SelectPositioner;
|
|
414
462
|
exports.SelectRoot = require_select.SelectRoot;
|
|
415
463
|
exports.SelectSeparator = require_select.SelectSeparator;
|
|
464
|
+
exports.SelectStatus = require_select.SelectStatus;
|
|
416
465
|
exports.SelectTrigger = require_select.SelectTrigger;
|
|
417
466
|
exports.SelectValue = require_select.SelectValue;
|
|
418
467
|
exports.Separator = require_index.Separator;
|
|
@@ -494,6 +543,7 @@ exports.TreeViewLabel = require_tree_view.TreeViewLabel;
|
|
|
494
543
|
exports.TreeViewRoot = require_tree_view.TreeViewRoot;
|
|
495
544
|
exports.TreeViewToggle = require_tree_view.TreeViewToggle;
|
|
496
545
|
exports.Upload = require_upload.Upload;
|
|
546
|
+
exports.UploadCancel = require_upload.UploadCancel;
|
|
497
547
|
exports.UploadDropzone = require_upload.UploadDropzone;
|
|
498
548
|
exports.UploadError = require_upload.UploadError;
|
|
499
549
|
exports.UploadHint = require_upload.UploadHint;
|
|
@@ -505,6 +555,7 @@ exports.UploadPreview = require_upload.UploadPreview;
|
|
|
505
555
|
exports.UploadProgress = require_upload.UploadProgress;
|
|
506
556
|
exports.UploadRemove = require_upload.UploadRemove;
|
|
507
557
|
exports.UploadRoot = require_upload.UploadRoot;
|
|
558
|
+
exports.UploadStatus = require_upload.UploadStatus;
|
|
508
559
|
exports.UploadText = require_upload.UploadText;
|
|
509
560
|
exports.UploadTrigger = require_upload.UploadTrigger;
|
|
510
561
|
exports.VisuallyHidden = require_visually_hidden.VisuallyHidden;
|