@astra-kit/ui 0.0.0-stage → 0.0.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 +15 -0
- package/LICENSE.md +21 -0
- package/README.md +384 -2
- package/THIRD_PARTY_NOTICES.md +31 -0
- package/assets/fonts/geist-LICENSE.txt +93 -0
- package/assets/fonts/geist-latin-variable.woff2 +0 -0
- package/assets/fonts/ibm-plex-mono-latin-400.woff2 +0 -0
- package/assets/fonts/ibm-plex-mono-latin-500.woff2 +0 -0
- package/assets/fonts/ibmplexmono-LICENSE.txt +93 -0
- package/assets/fonts/inter-LICENSE.txt +93 -0
- package/assets/fonts/inter-latin-variable.woff2 +0 -0
- package/dist/adapters/unpic-image.d.ts +3 -0
- package/dist/adapters/unpic-image.js +98 -0
- package/dist/components/account-menu.d.ts +67 -0
- package/dist/components/account-menu.js +440 -0
- package/dist/components/action-button.d.ts +25 -0
- package/dist/components/action-button.js +264 -0
- package/dist/components/alert.d.ts +31 -0
- package/dist/components/alert.js +503 -0
- package/dist/components/animated-collapse.d.ts +19 -0
- package/dist/components/animated-collapse.js +170 -0
- package/dist/components/animated-count.d.ts +13 -0
- package/dist/components/animated-count.js +105 -0
- package/dist/components/animated-list-item.d.ts +25 -0
- package/dist/components/animated-list-item.js +134 -0
- package/dist/components/animated-theme-toggler.d.ts +12 -0
- package/dist/components/animated-theme-toggler.js +200 -0
- package/dist/components/avatar.d.ts +65 -0
- package/dist/components/avatar.js +463 -0
- package/dist/components/badge.d.ts +21 -0
- package/dist/components/badge.js +297 -0
- package/dist/components/button-interaction.d.ts +23 -0
- package/dist/components/button-interaction.js +22 -0
- package/dist/components/button-label.d.ts +8 -0
- package/dist/components/button-label.js +203 -0
- package/dist/components/button.d.ts +23 -0
- package/dist/components/button.js +145 -0
- package/dist/components/calendar.d.ts +47 -0
- package/dist/components/calendar.js +155 -0
- package/dist/components/card.d.ts +38 -0
- package/dist/components/card.js +904 -0
- package/dist/components/carousel.d.ts +71 -0
- package/dist/components/carousel.js +585 -0
- package/dist/components/checkbox.d.ts +15 -0
- package/dist/components/checkbox.js +324 -0
- package/dist/components/control-button.d.ts +16 -0
- package/dist/components/control-button.js +215 -0
- package/dist/components/data-table.d.ts +118 -0
- package/dist/components/data-table.js +895 -0
- package/dist/components/dialog-surface.d.ts +49 -0
- package/dist/components/dialog-surface.js +220 -0
- package/dist/components/dialog.d.ts +92 -0
- package/dist/components/dialog.js +320 -0
- package/dist/components/dropdown-menu.d.ts +57 -0
- package/dist/components/dropdown-menu.js +107 -0
- package/dist/components/field.d.ts +53 -0
- package/dist/components/field.js +710 -0
- package/dist/components/file-upload.d.ts +88 -0
- package/dist/components/file-upload.js +776 -0
- package/dist/components/filter-presets-bar.d.ts +73 -0
- package/dist/components/filter-presets-bar.js +510 -0
- package/dist/components/filter-query-bar.d.ts +21 -0
- package/dist/components/filter-query-bar.js +881 -0
- package/dist/components/filter-query-grammar.d.ts +188 -0
- package/dist/components/filter-query-grammar.js +875 -0
- package/dist/components/form.d.ts +29 -0
- package/dist/components/form.js +330 -0
- package/dist/components/highlighter.d.ts +15 -0
- package/dist/components/highlighter.js +152 -0
- package/dist/components/hover-card.d.ts +50 -0
- package/dist/components/hover-card.js +80 -0
- package/dist/components/input-group.d.ts +16 -0
- package/dist/components/input-group.js +277 -0
- package/dist/components/input.d.ts +17 -0
- package/dist/components/input.js +120 -0
- package/dist/components/label.d.ts +4 -0
- package/dist/components/label.js +43 -0
- package/dist/components/link.d.ts +9 -0
- package/dist/components/link.js +43 -0
- package/dist/components/morph-text.d.ts +14 -0
- package/dist/components/morph-text.js +210 -0
- package/dist/components/pagination.d.ts +59 -0
- package/dist/components/pagination.js +190 -0
- package/dist/components/popover.d.ts +17 -0
- package/dist/components/popover.js +40 -0
- package/dist/components/presence-swap.d.ts +22 -0
- package/dist/components/presence-swap.js +209 -0
- package/dist/components/primitives/alert-dialog.d.ts +68 -0
- package/dist/components/primitives/alert-dialog.js +629 -0
- package/dist/components/primitives/avatar.d.ts +46 -0
- package/dist/components/primitives/avatar.js +265 -0
- package/dist/components/primitives/calendar.d.ts +37 -0
- package/dist/components/primitives/calendar.js +1250 -0
- package/dist/components/primitives/carousel.d.ts +106 -0
- package/dist/components/primitives/carousel.js +928 -0
- package/dist/components/primitives/dialog.d.ts +62 -0
- package/dist/components/primitives/dialog.js +490 -0
- package/dist/components/primitives/dropdown-menu-items.d.ts +59 -0
- package/dist/components/primitives/dropdown-menu-items.js +265 -0
- package/dist/components/primitives/dropdown-menu.d.ts +64 -0
- package/dist/components/primitives/dropdown-menu.js +560 -0
- package/dist/components/primitives/hover-card.d.ts +50 -0
- package/dist/components/primitives/hover-card.js +507 -0
- package/dist/components/primitives/pagination.d.ts +65 -0
- package/dist/components/primitives/pagination.js +373 -0
- package/dist/components/primitives/popover.d.ts +22 -0
- package/dist/components/primitives/popover.js +213 -0
- package/dist/components/primitives/select.d.ts +37 -0
- package/dist/components/primitives/select.js +428 -0
- package/dist/components/primitives/tooltip.d.ts +30 -0
- package/dist/components/primitives/tooltip.js +277 -0
- package/dist/components/progress-ring.d.ts +20 -0
- package/dist/components/progress-ring.js +53 -0
- package/dist/components/radio-group.d.ts +34 -0
- package/dist/components/radio-group.js +392 -0
- package/dist/components/reaction-button.d.ts +30 -0
- package/dist/components/reaction-button.js +189 -0
- package/dist/components/rich-link-editor.d.ts +25 -0
- package/dist/components/rich-link-editor.js +320 -0
- package/dist/components/rich-markdown-content.d.ts +10 -0
- package/dist/components/rich-markdown-content.js +56 -0
- package/dist/components/rich-text-content.d.ts +19 -0
- package/dist/components/rich-text-content.js +26 -0
- package/dist/components/select.d.ts +55 -0
- package/dist/components/select.js +188 -0
- package/dist/components/separator.d.ts +3 -0
- package/dist/components/separator.js +48 -0
- package/dist/components/sheet.d.ts +19 -0
- package/dist/components/sheet.js +420 -0
- package/dist/components/sidebar-panel-context.d.ts +17 -0
- package/dist/components/sidebar-panel-context.js +14 -0
- package/dist/components/sidebar.d.ts +195 -0
- package/dist/components/sidebar.js +2041 -0
- package/dist/components/skeleton.d.ts +23 -0
- package/dist/components/skeleton.js +334 -0
- package/dist/components/split-button.d.ts +36 -0
- package/dist/components/split-button.js +306 -0
- package/dist/components/svgs/whatsappIcon.d.ts +3 -0
- package/dist/components/svgs/whatsappIcon.js +14 -0
- package/dist/components/switch.d.ts +13 -0
- package/dist/components/switch.js +444 -0
- package/dist/components/table.d.ts +10 -0
- package/dist/components/table.js +298 -0
- package/dist/components/tabs.d.ts +36 -0
- package/dist/components/tabs.js +636 -0
- package/dist/components/textarea.d.ts +16 -0
- package/dist/components/textarea.js +111 -0
- package/dist/components/themed-toaster.d.ts +7 -0
- package/dist/components/themed-toaster.js +86 -0
- package/dist/components/toaster.d.ts +12 -0
- package/dist/components/toaster.js +62 -0
- package/dist/components/tooltip.d.ts +43 -0
- package/dist/components/tooltip.js +65 -0
- package/dist/components/typing-animation.d.ts +34 -0
- package/dist/components/typing-animation.js +389 -0
- package/dist/constants/action-button.d.ts +20 -0
- package/dist/constants/action-button.js +17 -0
- package/dist/constants/alert.d.ts +16 -0
- package/dist/constants/alert.js +13 -0
- package/dist/constants/avatar.d.ts +38 -0
- package/dist/constants/avatar.js +32 -0
- package/dist/constants/badge.d.ts +6 -0
- package/dist/constants/badge.js +6 -0
- package/dist/constants/button.d.ts +16 -0
- package/dist/constants/button.js +16 -0
- package/dist/constants/calendar.d.ts +36 -0
- package/dist/constants/calendar.js +34 -0
- package/dist/constants/card.d.ts +23 -0
- package/dist/constants/card.js +20 -0
- package/dist/constants/carousel.d.ts +55 -0
- package/dist/constants/carousel.js +74 -0
- package/dist/constants/checkbox.d.ts +17 -0
- package/dist/constants/checkbox.js +17 -0
- package/dist/constants/dialog.d.ts +11 -0
- package/dist/constants/dialog.js +10 -0
- package/dist/constants/dropdown-menu.d.ts +10 -0
- package/dist/constants/dropdown-menu.js +37 -0
- package/dist/constants/field.d.ts +24 -0
- package/dist/constants/field.js +24 -0
- package/dist/constants/hover-card.d.ts +37 -0
- package/dist/constants/hover-card.js +85 -0
- package/dist/constants/morph-text.d.ts +13 -0
- package/dist/constants/morph-text.js +13 -0
- package/dist/constants/motion.d.ts +12 -0
- package/dist/constants/motion.js +12 -0
- package/dist/constants/pagination.d.ts +20 -0
- package/dist/constants/pagination.js +20 -0
- package/dist/constants/popover.d.ts +7 -0
- package/dist/constants/popover.js +33 -0
- package/dist/constants/radio-group.d.ts +10 -0
- package/dist/constants/radio-group.js +10 -0
- package/dist/constants/select.d.ts +7 -0
- package/dist/constants/select.js +34 -0
- package/dist/constants/sidebar.d.ts +9 -0
- package/dist/constants/sidebar.js +17 -0
- package/dist/constants/skeleton.d.ts +17 -0
- package/dist/constants/skeleton.js +17 -0
- package/dist/constants/split-button.d.ts +7 -0
- package/dist/constants/split-button.js +5 -0
- package/dist/constants/switch.d.ts +33 -0
- package/dist/constants/switch.js +41 -0
- package/dist/constants/tabs.d.ts +17 -0
- package/dist/constants/tabs.js +17 -0
- package/dist/constants/toast.d.ts +3 -0
- package/dist/constants/toast.js +3 -0
- package/dist/constants/tooltip.d.ts +13 -0
- package/dist/constants/tooltip.js +52 -0
- package/dist/hooks/use-horizontal-swipe.d.ts +23 -0
- package/dist/hooks/use-horizontal-swipe.js +80 -0
- package/dist/hooks/use-is-hydrated.d.ts +6 -0
- package/dist/hooks/use-is-hydrated.js +20 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/use-mobile.js +19 -0
- package/dist/hooks/use-prefers-reduced-motion.d.ts +2 -0
- package/dist/hooks/use-prefers-reduced-motion.js +27 -0
- package/dist/hooks/use-rich-link-editor.d.ts +55 -0
- package/dist/hooks/use-rich-link-editor.js +515 -0
- package/dist/hooks/use-sidebar-persistence.d.ts +6 -0
- package/dist/hooks/use-sidebar-persistence.js +52 -0
- package/dist/hooks/use-today.d.ts +7 -0
- package/dist/hooks/use-today.js +50 -0
- package/dist/hooks/use-viewer-time-zone.d.ts +6 -0
- package/dist/hooks/use-viewer-time-zone.js +20 -0
- package/dist/hooks.d.ts +11 -0
- package/dist/hooks.js +11 -0
- package/dist/index.d.ts +71 -0
- package/dist/index.js +69 -0
- package/dist/lib/browser-clipboard.d.ts +13 -0
- package/dist/lib/browser-clipboard.js +48 -0
- package/dist/lib/column-filter-value.d.ts +12 -0
- package/dist/lib/column-filter-value.js +52 -0
- package/dist/lib/file-acceptance.d.ts +43 -0
- package/dist/lib/file-acceptance.js +107 -0
- package/dist/lib/format-file-size.d.ts +16 -0
- package/dist/lib/format-file-size.js +34 -0
- package/dist/lib/fuzzy-search.d.ts +17 -0
- package/dist/lib/fuzzy-search.js +183 -0
- package/dist/lib/horizontal-swipe.d.ts +23 -0
- package/dist/lib/horizontal-swipe.js +29 -0
- package/dist/lib/image-dimensions.d.ts +2 -0
- package/dist/lib/image-dimensions.js +7 -0
- package/dist/lib/name-initials.d.ts +7 -0
- package/dist/lib/name-initials.js +11 -0
- package/dist/lib/rich-text/link-markdown-constants.d.ts +147 -0
- package/dist/lib/rich-text/link-markdown-constants.js +458 -0
- package/dist/lib/rich-text/link-markdown-types.d.ts +53 -0
- package/dist/lib/rich-text/link-markdown-types.js +1 -0
- package/dist/lib/rich-text/link-markdown.d.ts +193 -0
- package/dist/lib/rich-text/link-markdown.js +592 -0
- package/dist/lib/rich-text/rich-markdown.d.ts +41 -0
- package/dist/lib/rich-text/rich-markdown.js +105 -0
- package/dist/lib/rich-text/rich-text-editor-dom.d.ts +26 -0
- package/dist/lib/rich-text/rich-text-editor-dom.js +79 -0
- package/dist/lib/toast-layer.d.ts +24 -0
- package/dist/lib/toast-layer.js +76 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +2 -0
- package/dist/lib/year-month-filter.d.ts +16 -0
- package/dist/lib/year-month-filter.js +46 -0
- package/dist/motion/arc-floating-slot.d.ts +40 -0
- package/dist/motion/arc-floating-slot.js +177 -0
- package/dist/motion/arc-press.d.ts +6 -0
- package/dist/motion/arc-press.js +59 -0
- package/dist/motion/arc-swap.d.ts +22 -0
- package/dist/motion/arc-swap.js +49 -0
- package/dist/motion/arc-tokens.d.ts +53 -0
- package/dist/motion/arc-tokens.js +73 -0
- package/dist/motion/glide-indicator.d.ts +69 -0
- package/dist/motion/glide-indicator.js +309 -0
- package/dist/motion/glide-slot.d.ts +9 -0
- package/dist/motion/glide-slot.js +71 -0
- package/dist/motion/motion-slot.d.ts +12 -0
- package/dist/motion/motion-slot.js +376 -0
- package/dist/motion/overlay-warmth.d.ts +24 -0
- package/dist/motion/overlay-warmth.js +70 -0
- package/dist/motion/presence.d.ts +40 -0
- package/dist/motion/presence.js +101 -0
- package/dist/motion/surface-keyframes.d.ts +24 -0
- package/dist/motion/surface-keyframes.js +141 -0
- package/dist/motion/tokens.d.ts +81 -0
- package/dist/motion/tokens.js +67 -0
- package/dist/motion/use-attached-element.d.ts +7 -0
- package/dist/motion/use-attached-element.js +22 -0
- package/dist/motion/use-morph-width.d.ts +13 -0
- package/dist/motion/use-morph-width.js +59 -0
- package/dist/next.d.ts +14 -0
- package/dist/next.js +79 -0
- package/dist/providers/astra-ui-provider.d.ts +27 -0
- package/dist/providers/astra-ui-provider.js +100 -0
- package/dist/providers/native-provider.d.ts +4 -0
- package/dist/providers/native-provider.js +45 -0
- package/dist/sonner.d.ts +7 -0
- package/dist/sonner.js +8 -0
- package/dist/styles.css +2 -0
- package/dist/tanstack.d.ts +11 -0
- package/dist/tanstack.js +50 -0
- package/dist/theme.d.ts +3 -0
- package/dist/theme.js +1 -0
- package/dist/types/data-table.d.ts +27 -0
- package/dist/types/data-table.js +1 -0
- package/fonts.css +5 -0
- package/package.json +450 -4
- package/styles.css +4 -0
- package/theme.css +248 -0
|
@@ -0,0 +1,776 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c as _c } from "react/compiler-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* File upload building blocks: a drop zone that validates picked or dropped files, and a list of
|
|
5
|
+
* files with upload progress, failure and retry. Uploading itself stays with the application.
|
|
6
|
+
*/
|
|
7
|
+
import { useId, useRef, useState } from "react";
|
|
8
|
+
import { AnimatePresence } from "motion/react";
|
|
9
|
+
import { CheckCircle2Icon, FileIcon, Trash2Icon, UploadCloudIcon, XCircleIcon } from "lucide-react";
|
|
10
|
+
import { cn } from "../lib/utils.js";
|
|
11
|
+
import { classifyFiles } from "../lib/file-acceptance.js";
|
|
12
|
+
import { formatFileSize } from "../lib/format-file-size.js";
|
|
13
|
+
import { AnimatedListItem } from "./animated-list-item.js";
|
|
14
|
+
import { ControlButton } from "./control-button.js";
|
|
15
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
const COMPLETE_PROGRESS = 100;
|
|
17
|
+
const FILE_UPLOAD_DROP_ZONE_DEFAULT_LABELS = {
|
|
18
|
+
uploadAction: "Elegí un archivo",
|
|
19
|
+
uploadActionMobileSuffix: "",
|
|
20
|
+
dragAndDrop: "o arrastralo acá",
|
|
21
|
+
input: "Subir archivos"
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Renders the drop zone. The action button and a click anywhere on the zone open the native file
|
|
25
|
+
* picker; the same file can be picked again after a failure.
|
|
26
|
+
* @param props - Constraints, callbacks and optional copy.
|
|
27
|
+
* @returns The drop zone.
|
|
28
|
+
*/
|
|
29
|
+
export function FileUploadDropZone(t0) {
|
|
30
|
+
const $ = _c(66);
|
|
31
|
+
const { hint, isDisabled: t1, accept, allowsMultiple: t2, maxSize, onDropFiles, onDropUnacceptedFiles, onSizeLimitExceed, inputId, labels, className } = t0;
|
|
32
|
+
const isDisabled = t1 === undefined ? false : t1;
|
|
33
|
+
const allowsMultiple = t2 === undefined ? true : t2;
|
|
34
|
+
let t3;
|
|
35
|
+
if ($[0] !== labels) {
|
|
36
|
+
t3 = {
|
|
37
|
+
...FILE_UPLOAD_DROP_ZONE_DEFAULT_LABELS,
|
|
38
|
+
...labels
|
|
39
|
+
};
|
|
40
|
+
$[0] = labels;
|
|
41
|
+
$[1] = t3;
|
|
42
|
+
} else {
|
|
43
|
+
t3 = $[1];
|
|
44
|
+
}
|
|
45
|
+
const resolvedLabels = t3;
|
|
46
|
+
const generatedInputId = useId();
|
|
47
|
+
const hintId = useId();
|
|
48
|
+
const resolvedInputId = inputId ?? generatedInputId;
|
|
49
|
+
const inputRef = useRef(null);
|
|
50
|
+
const [isInvalid, setIsInvalid] = useState(false);
|
|
51
|
+
const [isDraggingOver, setIsDraggingOver] = useState(false);
|
|
52
|
+
let t4;
|
|
53
|
+
if ($[2] !== accept || $[3] !== allowsMultiple || $[4] !== maxSize || $[5] !== onDropFiles || $[6] !== onDropUnacceptedFiles || $[7] !== onSizeLimitExceed) {
|
|
54
|
+
t4 = (files) => {
|
|
55
|
+
const { accepted, unaccepted, oversized } = classifyFiles(files, {
|
|
56
|
+
accept,
|
|
57
|
+
maxSize,
|
|
58
|
+
allowsMultiple
|
|
59
|
+
});
|
|
60
|
+
setIsInvalid(unaccepted.length > 0 || oversized.length > 0);
|
|
61
|
+
if (oversized.length > 0) {
|
|
62
|
+
onSizeLimitExceed?.(oversized);
|
|
63
|
+
}
|
|
64
|
+
if (accepted.length > 0) {
|
|
65
|
+
onDropFiles?.(accepted);
|
|
66
|
+
}
|
|
67
|
+
if (unaccepted.length > 0) {
|
|
68
|
+
onDropUnacceptedFiles?.(unaccepted);
|
|
69
|
+
}
|
|
70
|
+
if (inputRef.current) {
|
|
71
|
+
inputRef.current.value = "";
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
$[2] = accept;
|
|
75
|
+
$[3] = allowsMultiple;
|
|
76
|
+
$[4] = maxSize;
|
|
77
|
+
$[5] = onDropFiles;
|
|
78
|
+
$[6] = onDropUnacceptedFiles;
|
|
79
|
+
$[7] = onSizeLimitExceed;
|
|
80
|
+
$[8] = t4;
|
|
81
|
+
} else {
|
|
82
|
+
t4 = $[8];
|
|
83
|
+
}
|
|
84
|
+
const processFiles = t4;
|
|
85
|
+
let t5;
|
|
86
|
+
if ($[9] !== isDisabled) {
|
|
87
|
+
t5 = (event) => {
|
|
88
|
+
event.preventDefault();
|
|
89
|
+
if (!isDisabled) {
|
|
90
|
+
setIsDraggingOver(true);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
$[9] = isDisabled;
|
|
94
|
+
$[10] = t5;
|
|
95
|
+
} else {
|
|
96
|
+
t5 = $[10];
|
|
97
|
+
}
|
|
98
|
+
const handleDragOver = t5;
|
|
99
|
+
let t6;
|
|
100
|
+
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
101
|
+
t6 = (event_0) => {
|
|
102
|
+
event_0.preventDefault();
|
|
103
|
+
setIsDraggingOver(false);
|
|
104
|
+
};
|
|
105
|
+
$[11] = t6;
|
|
106
|
+
} else {
|
|
107
|
+
t6 = $[11];
|
|
108
|
+
}
|
|
109
|
+
const handleDragLeave = t6;
|
|
110
|
+
let t7;
|
|
111
|
+
if ($[12] !== isDisabled || $[13] !== processFiles) {
|
|
112
|
+
t7 = (event_1) => {
|
|
113
|
+
event_1.preventDefault();
|
|
114
|
+
setIsDraggingOver(false);
|
|
115
|
+
if (!isDisabled) {
|
|
116
|
+
processFiles(Array.from(event_1.dataTransfer.files));
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
$[12] = isDisabled;
|
|
120
|
+
$[13] = processFiles;
|
|
121
|
+
$[14] = t7;
|
|
122
|
+
} else {
|
|
123
|
+
t7 = $[14];
|
|
124
|
+
}
|
|
125
|
+
const handleDrop = t7;
|
|
126
|
+
let t8;
|
|
127
|
+
if ($[15] !== isDisabled) {
|
|
128
|
+
t8 = () => {
|
|
129
|
+
if (!isDisabled) {
|
|
130
|
+
inputRef.current?.click();
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
$[15] = isDisabled;
|
|
134
|
+
$[16] = t8;
|
|
135
|
+
} else {
|
|
136
|
+
t8 = $[16];
|
|
137
|
+
}
|
|
138
|
+
const openFilePicker = t8;
|
|
139
|
+
const t9 = isDraggingOver || undefined;
|
|
140
|
+
const t10 = isDisabled || undefined;
|
|
141
|
+
const t11 = isInvalid || undefined;
|
|
142
|
+
let t12;
|
|
143
|
+
if ($[17] !== className) {
|
|
144
|
+
t12 = cn("relative flex cursor-pointer flex-col items-center gap-3 rounded-xl bg-background px-6 py-4 text-muted-foreground ring-1 ring-border transition-[box-shadow,background-color] ring-inset data-dragging:ring-2 data-dragging:ring-primary data-disabled:cursor-not-allowed data-disabled:bg-muted", className);
|
|
145
|
+
$[17] = className;
|
|
146
|
+
$[18] = t12;
|
|
147
|
+
} else {
|
|
148
|
+
t12 = $[18];
|
|
149
|
+
}
|
|
150
|
+
const t13 = isDisabled && "opacity-50";
|
|
151
|
+
let t14;
|
|
152
|
+
if ($[19] !== t13) {
|
|
153
|
+
t14 = cn("inline-flex size-10 items-center justify-center rounded-lg border border-border bg-background shadow-xs", t13);
|
|
154
|
+
$[19] = t13;
|
|
155
|
+
$[20] = t14;
|
|
156
|
+
} else {
|
|
157
|
+
t14 = $[20];
|
|
158
|
+
}
|
|
159
|
+
let t15;
|
|
160
|
+
if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
|
|
161
|
+
t15 = /* @__PURE__ */ _jsx(UploadCloudIcon, {
|
|
162
|
+
"aria-hidden": true,
|
|
163
|
+
className: "size-5 text-foreground"
|
|
164
|
+
});
|
|
165
|
+
$[21] = t15;
|
|
166
|
+
} else {
|
|
167
|
+
t15 = $[21];
|
|
168
|
+
}
|
|
169
|
+
let t16;
|
|
170
|
+
if ($[22] !== t14) {
|
|
171
|
+
t16 = /* @__PURE__ */ _jsx("span", {
|
|
172
|
+
className: t14,
|
|
173
|
+
children: t15
|
|
174
|
+
});
|
|
175
|
+
$[22] = t14;
|
|
176
|
+
$[23] = t16;
|
|
177
|
+
} else {
|
|
178
|
+
t16 = $[23];
|
|
179
|
+
}
|
|
180
|
+
const t17 = hint ? hintId : undefined;
|
|
181
|
+
let t18;
|
|
182
|
+
if ($[24] !== processFiles) {
|
|
183
|
+
t18 = (event_2) => processFiles(Array.from(event_2.target.files ?? []));
|
|
184
|
+
$[24] = processFiles;
|
|
185
|
+
$[25] = t18;
|
|
186
|
+
} else {
|
|
187
|
+
t18 = $[25];
|
|
188
|
+
}
|
|
189
|
+
let t19;
|
|
190
|
+
if ($[26] !== accept || $[27] !== allowsMultiple || $[28] !== isDisabled || $[29] !== resolvedInputId || $[30] !== resolvedLabels.input || $[31] !== t17 || $[32] !== t18) {
|
|
191
|
+
t19 = /* @__PURE__ */ _jsx("input", {
|
|
192
|
+
ref: inputRef,
|
|
193
|
+
id: resolvedInputId,
|
|
194
|
+
type: "file",
|
|
195
|
+
className: "sr-only",
|
|
196
|
+
disabled: isDisabled,
|
|
197
|
+
"aria-label": resolvedLabels.input,
|
|
198
|
+
"aria-describedby": t17,
|
|
199
|
+
accept,
|
|
200
|
+
multiple: allowsMultiple,
|
|
201
|
+
onChange: t18,
|
|
202
|
+
onClick: _temp
|
|
203
|
+
});
|
|
204
|
+
$[26] = accept;
|
|
205
|
+
$[27] = allowsMultiple;
|
|
206
|
+
$[28] = isDisabled;
|
|
207
|
+
$[29] = resolvedInputId;
|
|
208
|
+
$[30] = resolvedLabels.input;
|
|
209
|
+
$[31] = t17;
|
|
210
|
+
$[32] = t18;
|
|
211
|
+
$[33] = t19;
|
|
212
|
+
} else {
|
|
213
|
+
t19 = $[33];
|
|
214
|
+
}
|
|
215
|
+
let t20;
|
|
216
|
+
if ($[34] !== openFilePicker) {
|
|
217
|
+
t20 = (event_4) => {
|
|
218
|
+
event_4.stopPropagation();
|
|
219
|
+
openFilePicker();
|
|
220
|
+
};
|
|
221
|
+
$[34] = openFilePicker;
|
|
222
|
+
$[35] = t20;
|
|
223
|
+
} else {
|
|
224
|
+
t20 = $[35];
|
|
225
|
+
}
|
|
226
|
+
let t21;
|
|
227
|
+
if ($[36] !== resolvedLabels.uploadActionMobileSuffix) {
|
|
228
|
+
t21 = resolvedLabels.uploadActionMobileSuffix ? /* @__PURE__ */ _jsxs(_Fragment, { children: [" ", /* @__PURE__ */ _jsx("span", {
|
|
229
|
+
className: "md:hidden",
|
|
230
|
+
children: resolvedLabels.uploadActionMobileSuffix
|
|
231
|
+
})] }) : null;
|
|
232
|
+
$[36] = resolvedLabels.uploadActionMobileSuffix;
|
|
233
|
+
$[37] = t21;
|
|
234
|
+
} else {
|
|
235
|
+
t21 = $[37];
|
|
236
|
+
}
|
|
237
|
+
let t22;
|
|
238
|
+
if ($[38] !== isDisabled || $[39] !== resolvedLabels.uploadAction || $[40] !== t20 || $[41] !== t21) {
|
|
239
|
+
t22 = /* @__PURE__ */ _jsxs(ControlButton, {
|
|
240
|
+
className: "h-auto p-0 font-medium",
|
|
241
|
+
disabled: isDisabled,
|
|
242
|
+
type: "button",
|
|
243
|
+
variant: "link",
|
|
244
|
+
onClick: t20,
|
|
245
|
+
children: [resolvedLabels.uploadAction, t21]
|
|
246
|
+
});
|
|
247
|
+
$[38] = isDisabled;
|
|
248
|
+
$[39] = resolvedLabels.uploadAction;
|
|
249
|
+
$[40] = t20;
|
|
250
|
+
$[41] = t21;
|
|
251
|
+
$[42] = t22;
|
|
252
|
+
} else {
|
|
253
|
+
t22 = $[42];
|
|
254
|
+
}
|
|
255
|
+
let t23;
|
|
256
|
+
if ($[43] !== resolvedLabels.dragAndDrop) {
|
|
257
|
+
t23 = /* @__PURE__ */ _jsx("span", {
|
|
258
|
+
className: "text-sm max-md:hidden",
|
|
259
|
+
children: resolvedLabels.dragAndDrop
|
|
260
|
+
});
|
|
261
|
+
$[43] = resolvedLabels.dragAndDrop;
|
|
262
|
+
$[44] = t23;
|
|
263
|
+
} else {
|
|
264
|
+
t23 = $[44];
|
|
265
|
+
}
|
|
266
|
+
let t24;
|
|
267
|
+
if ($[45] !== t19 || $[46] !== t22 || $[47] !== t23) {
|
|
268
|
+
t24 = /* @__PURE__ */ _jsxs("div", {
|
|
269
|
+
className: "flex flex-wrap items-center justify-center gap-1",
|
|
270
|
+
children: [
|
|
271
|
+
t19,
|
|
272
|
+
t22,
|
|
273
|
+
t23
|
|
274
|
+
]
|
|
275
|
+
});
|
|
276
|
+
$[45] = t19;
|
|
277
|
+
$[46] = t22;
|
|
278
|
+
$[47] = t23;
|
|
279
|
+
$[48] = t24;
|
|
280
|
+
} else {
|
|
281
|
+
t24 = $[48];
|
|
282
|
+
}
|
|
283
|
+
let t25;
|
|
284
|
+
if ($[49] !== hint || $[50] !== hintId || $[51] !== isInvalid) {
|
|
285
|
+
t25 = hint ? /* @__PURE__ */ _jsx("p", {
|
|
286
|
+
id: hintId,
|
|
287
|
+
className: cn("m-0 text-xs transition-colors", isInvalid && "text-destructive"),
|
|
288
|
+
children: hint
|
|
289
|
+
}) : null;
|
|
290
|
+
$[49] = hint;
|
|
291
|
+
$[50] = hintId;
|
|
292
|
+
$[51] = isInvalid;
|
|
293
|
+
$[52] = t25;
|
|
294
|
+
} else {
|
|
295
|
+
t25 = $[52];
|
|
296
|
+
}
|
|
297
|
+
let t26;
|
|
298
|
+
if ($[53] !== t24 || $[54] !== t25) {
|
|
299
|
+
t26 = /* @__PURE__ */ _jsxs("div", {
|
|
300
|
+
className: "flex flex-col gap-1 text-center",
|
|
301
|
+
children: [t24, t25]
|
|
302
|
+
});
|
|
303
|
+
$[53] = t24;
|
|
304
|
+
$[54] = t25;
|
|
305
|
+
$[55] = t26;
|
|
306
|
+
} else {
|
|
307
|
+
t26 = $[55];
|
|
308
|
+
}
|
|
309
|
+
let t27;
|
|
310
|
+
if ($[56] !== handleDragOver || $[57] !== handleDrop || $[58] !== openFilePicker || $[59] !== t10 || $[60] !== t11 || $[61] !== t12 || $[62] !== t16 || $[63] !== t26 || $[64] !== t9) {
|
|
311
|
+
t27 = /* @__PURE__ */ _jsxs("div", {
|
|
312
|
+
"data-slot": "file-upload-drop-zone",
|
|
313
|
+
"data-dragging": t9,
|
|
314
|
+
"data-disabled": t10,
|
|
315
|
+
"data-invalid": t11,
|
|
316
|
+
className: t12,
|
|
317
|
+
onClick: openFilePicker,
|
|
318
|
+
onDragEnter: handleDragOver,
|
|
319
|
+
onDragOver: handleDragOver,
|
|
320
|
+
onDragLeave: handleDragLeave,
|
|
321
|
+
onDragEnd: handleDragLeave,
|
|
322
|
+
onDrop: handleDrop,
|
|
323
|
+
children: [t16, t26]
|
|
324
|
+
});
|
|
325
|
+
$[56] = handleDragOver;
|
|
326
|
+
$[57] = handleDrop;
|
|
327
|
+
$[58] = openFilePicker;
|
|
328
|
+
$[59] = t10;
|
|
329
|
+
$[60] = t11;
|
|
330
|
+
$[61] = t12;
|
|
331
|
+
$[62] = t16;
|
|
332
|
+
$[63] = t26;
|
|
333
|
+
$[64] = t9;
|
|
334
|
+
$[65] = t27;
|
|
335
|
+
} else {
|
|
336
|
+
t27 = $[65];
|
|
337
|
+
}
|
|
338
|
+
return t27;
|
|
339
|
+
}
|
|
340
|
+
function _temp(event_3) {
|
|
341
|
+
return event_3.stopPropagation();
|
|
342
|
+
}
|
|
343
|
+
const FILE_UPLOAD_ITEM_DEFAULT_LABELS = {
|
|
344
|
+
complete: "Completado",
|
|
345
|
+
uploading: "Subiendo...",
|
|
346
|
+
failed: "Falló",
|
|
347
|
+
retry: "Reintentar",
|
|
348
|
+
delete: "Eliminar",
|
|
349
|
+
progress: "Progreso de subida"
|
|
350
|
+
};
|
|
351
|
+
/**
|
|
352
|
+
* Renders one file with its size, status, progress (a bar or a background fill), delete action
|
|
353
|
+
* and, after a failure, a retry action. Place it inside `FileUploadList` so additions and removals animate.
|
|
354
|
+
* @param props - File metadata, progress, callbacks and optional copy.
|
|
355
|
+
* @returns The list item.
|
|
356
|
+
*/
|
|
357
|
+
export function FileUploadItem(t0) {
|
|
358
|
+
const $ = _c(70);
|
|
359
|
+
const { name, size, progress, failed: t1, onDelete, isDeleteDisabled, onRetry, locale, labels, icon, progressVariant: t2, className } = t0;
|
|
360
|
+
const failed = t1 === undefined ? false : t1;
|
|
361
|
+
const progressVariant = t2 === undefined ? "bar" : t2;
|
|
362
|
+
let t3;
|
|
363
|
+
if ($[0] !== labels) {
|
|
364
|
+
t3 = {
|
|
365
|
+
...FILE_UPLOAD_ITEM_DEFAULT_LABELS,
|
|
366
|
+
...labels
|
|
367
|
+
};
|
|
368
|
+
$[0] = labels;
|
|
369
|
+
$[1] = t3;
|
|
370
|
+
} else {
|
|
371
|
+
t3 = $[1];
|
|
372
|
+
}
|
|
373
|
+
const resolvedLabels = t3;
|
|
374
|
+
const clampedProgress = Math.min(Math.max(progress, 0), COMPLETE_PROGRESS);
|
|
375
|
+
const isComplete = clampedProgress === COMPLETE_PROGRESS && !failed;
|
|
376
|
+
const isFillVariant = progressVariant === "fill";
|
|
377
|
+
let t4;
|
|
378
|
+
if ($[2] !== clampedProgress || $[3] !== resolvedLabels.progress) {
|
|
379
|
+
t4 = {
|
|
380
|
+
"aria-label": resolvedLabels.progress,
|
|
381
|
+
"aria-valuemax": COMPLETE_PROGRESS,
|
|
382
|
+
"aria-valuemin": 0,
|
|
383
|
+
"aria-valuenow": clampedProgress,
|
|
384
|
+
role: "progressbar"
|
|
385
|
+
};
|
|
386
|
+
$[2] = clampedProgress;
|
|
387
|
+
$[3] = resolvedLabels.progress;
|
|
388
|
+
$[4] = t4;
|
|
389
|
+
} else {
|
|
390
|
+
t4 = $[4];
|
|
391
|
+
}
|
|
392
|
+
const progressBarProps = t4;
|
|
393
|
+
const t5 = failed || undefined;
|
|
394
|
+
let t6;
|
|
395
|
+
if ($[5] !== className) {
|
|
396
|
+
t6 = cn("group/file-item relative flex w-full min-w-0 gap-3 overflow-hidden rounded-xl bg-background p-4", className);
|
|
397
|
+
$[5] = className;
|
|
398
|
+
$[6] = t6;
|
|
399
|
+
} else {
|
|
400
|
+
t6 = $[6];
|
|
401
|
+
}
|
|
402
|
+
let t7;
|
|
403
|
+
if ($[7] !== clampedProgress || $[8] !== failed || $[9] !== isComplete || $[10] !== isFillVariant || $[11] !== progressBarProps) {
|
|
404
|
+
t7 = isFillVariant && !failed ? /* @__PURE__ */ _jsx("div", {
|
|
405
|
+
...progressBarProps,
|
|
406
|
+
className: cn("absolute inset-0 bg-muted transition-[translate,opacity] duration-150", isComplete && "opacity-0"),
|
|
407
|
+
style: { translate: `${clampedProgress - COMPLETE_PROGRESS}% 0` }
|
|
408
|
+
}) : null;
|
|
409
|
+
$[7] = clampedProgress;
|
|
410
|
+
$[8] = failed;
|
|
411
|
+
$[9] = isComplete;
|
|
412
|
+
$[10] = isFillVariant;
|
|
413
|
+
$[11] = progressBarProps;
|
|
414
|
+
$[12] = t7;
|
|
415
|
+
} else {
|
|
416
|
+
t7 = $[12];
|
|
417
|
+
}
|
|
418
|
+
let t8;
|
|
419
|
+
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
420
|
+
t8 = /* @__PURE__ */ _jsx("span", {
|
|
421
|
+
"data-slot": "file-upload-item-outline",
|
|
422
|
+
"aria-hidden": true,
|
|
423
|
+
className: "pointer-events-none absolute inset-0 z-[1] rounded-[inherit] ring-1 ring-border ring-inset group-data-failed/file-item:ring-2 group-data-failed/file-item:ring-destructive"
|
|
424
|
+
});
|
|
425
|
+
$[13] = t8;
|
|
426
|
+
} else {
|
|
427
|
+
t8 = $[13];
|
|
428
|
+
}
|
|
429
|
+
let t9;
|
|
430
|
+
if ($[14] !== icon) {
|
|
431
|
+
t9 = icon ?? /* @__PURE__ */ _jsx(FileIcon, {
|
|
432
|
+
"aria-hidden": true,
|
|
433
|
+
className: "size-10 shrink-0 stroke-[1.25] text-muted-foreground"
|
|
434
|
+
});
|
|
435
|
+
$[14] = icon;
|
|
436
|
+
$[15] = t9;
|
|
437
|
+
} else {
|
|
438
|
+
t9 = $[15];
|
|
439
|
+
}
|
|
440
|
+
let t10;
|
|
441
|
+
if ($[16] !== t9) {
|
|
442
|
+
t10 = /* @__PURE__ */ _jsx("span", {
|
|
443
|
+
className: "relative flex shrink-0",
|
|
444
|
+
children: t9
|
|
445
|
+
});
|
|
446
|
+
$[16] = t9;
|
|
447
|
+
$[17] = t10;
|
|
448
|
+
} else {
|
|
449
|
+
t10 = $[17];
|
|
450
|
+
}
|
|
451
|
+
let t11;
|
|
452
|
+
if ($[18] !== name) {
|
|
453
|
+
t11 = /* @__PURE__ */ _jsx("p", {
|
|
454
|
+
className: "m-0 max-w-full text-sm font-medium break-words text-foreground",
|
|
455
|
+
children: name
|
|
456
|
+
});
|
|
457
|
+
$[18] = name;
|
|
458
|
+
$[19] = t11;
|
|
459
|
+
} else {
|
|
460
|
+
t11 = $[19];
|
|
461
|
+
}
|
|
462
|
+
let t12;
|
|
463
|
+
if ($[20] !== locale || $[21] !== size) {
|
|
464
|
+
t12 = formatFileSize(size, { locale });
|
|
465
|
+
$[20] = locale;
|
|
466
|
+
$[21] = size;
|
|
467
|
+
$[22] = t12;
|
|
468
|
+
} else {
|
|
469
|
+
t12 = $[22];
|
|
470
|
+
}
|
|
471
|
+
let t13;
|
|
472
|
+
if ($[23] !== t12) {
|
|
473
|
+
t13 = /* @__PURE__ */ _jsx("span", {
|
|
474
|
+
className: "truncate whitespace-nowrap text-muted-foreground",
|
|
475
|
+
children: t12
|
|
476
|
+
});
|
|
477
|
+
$[23] = t12;
|
|
478
|
+
$[24] = t13;
|
|
479
|
+
} else {
|
|
480
|
+
t13 = $[24];
|
|
481
|
+
}
|
|
482
|
+
let t14;
|
|
483
|
+
if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
|
|
484
|
+
t14 = /* @__PURE__ */ _jsx("span", {
|
|
485
|
+
"aria-hidden": true,
|
|
486
|
+
className: "h-3 w-px rounded-full bg-border"
|
|
487
|
+
});
|
|
488
|
+
$[25] = t14;
|
|
489
|
+
} else {
|
|
490
|
+
t14 = $[25];
|
|
491
|
+
}
|
|
492
|
+
let t15;
|
|
493
|
+
if ($[26] !== failed || $[27] !== isComplete || $[28] !== resolvedLabels.complete || $[29] !== resolvedLabels.failed || $[30] !== resolvedLabels.uploading) {
|
|
494
|
+
t15 = failed ? /* @__PURE__ */ _jsxs(_Fragment, { children: [/* @__PURE__ */ _jsx(XCircleIcon, {
|
|
495
|
+
"aria-hidden": true,
|
|
496
|
+
className: "size-4 text-destructive"
|
|
497
|
+
}), /* @__PURE__ */ _jsx("span", {
|
|
498
|
+
className: "text-destructive",
|
|
499
|
+
children: resolvedLabels.failed
|
|
500
|
+
})] }) : isComplete ? /* @__PURE__ */ _jsxs(_Fragment, { children: [/* @__PURE__ */ _jsx(CheckCircle2Icon, {
|
|
501
|
+
"aria-hidden": true,
|
|
502
|
+
className: "size-4 text-green-600 dark:text-green-500"
|
|
503
|
+
}), /* @__PURE__ */ _jsx("span", {
|
|
504
|
+
className: "text-green-700 dark:text-green-400",
|
|
505
|
+
children: resolvedLabels.complete
|
|
506
|
+
})] }) : /* @__PURE__ */ _jsxs(_Fragment, { children: [/* @__PURE__ */ _jsx(UploadCloudIcon, {
|
|
507
|
+
"aria-hidden": true,
|
|
508
|
+
className: "size-4 text-muted-foreground"
|
|
509
|
+
}), /* @__PURE__ */ _jsx("span", {
|
|
510
|
+
className: "text-muted-foreground",
|
|
511
|
+
children: resolvedLabels.uploading
|
|
512
|
+
})] });
|
|
513
|
+
$[26] = failed;
|
|
514
|
+
$[27] = isComplete;
|
|
515
|
+
$[28] = resolvedLabels.complete;
|
|
516
|
+
$[29] = resolvedLabels.failed;
|
|
517
|
+
$[30] = resolvedLabels.uploading;
|
|
518
|
+
$[31] = t15;
|
|
519
|
+
} else {
|
|
520
|
+
t15 = $[31];
|
|
521
|
+
}
|
|
522
|
+
let t16;
|
|
523
|
+
if ($[32] !== clampedProgress || $[33] !== failed || $[34] !== isFillVariant) {
|
|
524
|
+
t16 = isFillVariant && !failed ? /* @__PURE__ */ _jsxs("span", {
|
|
525
|
+
className: "font-normal text-muted-foreground tabular-nums",
|
|
526
|
+
children: [clampedProgress, "%"]
|
|
527
|
+
}) : null;
|
|
528
|
+
$[32] = clampedProgress;
|
|
529
|
+
$[33] = failed;
|
|
530
|
+
$[34] = isFillVariant;
|
|
531
|
+
$[35] = t16;
|
|
532
|
+
} else {
|
|
533
|
+
t16 = $[35];
|
|
534
|
+
}
|
|
535
|
+
let t17;
|
|
536
|
+
if ($[36] !== t15 || $[37] !== t16) {
|
|
537
|
+
t17 = /* @__PURE__ */ _jsxs("span", {
|
|
538
|
+
className: "flex items-center gap-1 font-medium",
|
|
539
|
+
role: "status",
|
|
540
|
+
children: [t15, t16]
|
|
541
|
+
});
|
|
542
|
+
$[36] = t15;
|
|
543
|
+
$[37] = t16;
|
|
544
|
+
$[38] = t17;
|
|
545
|
+
} else {
|
|
546
|
+
t17 = $[38];
|
|
547
|
+
}
|
|
548
|
+
let t18;
|
|
549
|
+
if ($[39] !== t13 || $[40] !== t17) {
|
|
550
|
+
t18 = /* @__PURE__ */ _jsxs("div", {
|
|
551
|
+
className: "mt-0.5 flex items-center gap-2 text-sm",
|
|
552
|
+
children: [
|
|
553
|
+
t13,
|
|
554
|
+
t14,
|
|
555
|
+
t17
|
|
556
|
+
]
|
|
557
|
+
});
|
|
558
|
+
$[39] = t13;
|
|
559
|
+
$[40] = t17;
|
|
560
|
+
$[41] = t18;
|
|
561
|
+
} else {
|
|
562
|
+
t18 = $[41];
|
|
563
|
+
}
|
|
564
|
+
let t19;
|
|
565
|
+
if ($[42] !== t11 || $[43] !== t18) {
|
|
566
|
+
t19 = /* @__PURE__ */ _jsxs("div", {
|
|
567
|
+
className: "min-w-0 flex-1",
|
|
568
|
+
children: [t11, t18]
|
|
569
|
+
});
|
|
570
|
+
$[42] = t11;
|
|
571
|
+
$[43] = t18;
|
|
572
|
+
$[44] = t19;
|
|
573
|
+
} else {
|
|
574
|
+
t19 = $[44];
|
|
575
|
+
}
|
|
576
|
+
let t20;
|
|
577
|
+
if ($[45] !== isDeleteDisabled || $[46] !== name || $[47] !== onDelete || $[48] !== resolvedLabels.delete) {
|
|
578
|
+
t20 = onDelete ? /* @__PURE__ */ _jsx(ControlButton, {
|
|
579
|
+
"aria-label": `${resolvedLabels.delete} ${name}`,
|
|
580
|
+
className: "-mt-2 -mr-2 self-start text-muted-foreground",
|
|
581
|
+
disabled: isDeleteDisabled,
|
|
582
|
+
size: "icon-sm",
|
|
583
|
+
type: "button",
|
|
584
|
+
variant: "ghost",
|
|
585
|
+
onClick: onDelete,
|
|
586
|
+
children: /* @__PURE__ */ _jsx(Trash2Icon, { "aria-hidden": true })
|
|
587
|
+
}) : null;
|
|
588
|
+
$[45] = isDeleteDisabled;
|
|
589
|
+
$[46] = name;
|
|
590
|
+
$[47] = onDelete;
|
|
591
|
+
$[48] = resolvedLabels.delete;
|
|
592
|
+
$[49] = t20;
|
|
593
|
+
} else {
|
|
594
|
+
t20 = $[49];
|
|
595
|
+
}
|
|
596
|
+
let t21;
|
|
597
|
+
if ($[50] !== t19 || $[51] !== t20) {
|
|
598
|
+
t21 = /* @__PURE__ */ _jsxs("div", {
|
|
599
|
+
className: "flex w-full min-w-0 flex-1",
|
|
600
|
+
children: [t19, t20]
|
|
601
|
+
});
|
|
602
|
+
$[50] = t19;
|
|
603
|
+
$[51] = t20;
|
|
604
|
+
$[52] = t21;
|
|
605
|
+
} else {
|
|
606
|
+
t21 = $[52];
|
|
607
|
+
}
|
|
608
|
+
let t22;
|
|
609
|
+
if ($[53] !== clampedProgress || $[54] !== failed || $[55] !== isFillVariant || $[56] !== onRetry || $[57] !== progressBarProps || $[58] !== resolvedLabels.retry) {
|
|
610
|
+
t22 = failed ? onRetry ? /* @__PURE__ */ _jsx(ControlButton, {
|
|
611
|
+
className: "mt-1.5 h-auto p-0 text-destructive",
|
|
612
|
+
size: "sm",
|
|
613
|
+
type: "button",
|
|
614
|
+
variant: "link",
|
|
615
|
+
onClick: onRetry,
|
|
616
|
+
children: resolvedLabels.retry
|
|
617
|
+
}) : null : isFillVariant ? null : /* @__PURE__ */ _jsxs("div", {
|
|
618
|
+
className: "mt-1 flex w-full items-center gap-3",
|
|
619
|
+
children: [/* @__PURE__ */ _jsx("div", {
|
|
620
|
+
...progressBarProps,
|
|
621
|
+
className: "h-2 flex-1 overflow-hidden rounded-full bg-muted",
|
|
622
|
+
children: /* @__PURE__ */ _jsx("div", {
|
|
623
|
+
className: "h-full rounded-full bg-primary transition-[width] duration-150",
|
|
624
|
+
style: { width: `${clampedProgress}%` }
|
|
625
|
+
})
|
|
626
|
+
}), /* @__PURE__ */ _jsxs("span", {
|
|
627
|
+
className: "text-sm font-medium text-foreground tabular-nums",
|
|
628
|
+
children: [clampedProgress, "%"]
|
|
629
|
+
})]
|
|
630
|
+
});
|
|
631
|
+
$[53] = clampedProgress;
|
|
632
|
+
$[54] = failed;
|
|
633
|
+
$[55] = isFillVariant;
|
|
634
|
+
$[56] = onRetry;
|
|
635
|
+
$[57] = progressBarProps;
|
|
636
|
+
$[58] = resolvedLabels.retry;
|
|
637
|
+
$[59] = t22;
|
|
638
|
+
} else {
|
|
639
|
+
t22 = $[59];
|
|
640
|
+
}
|
|
641
|
+
let t23;
|
|
642
|
+
if ($[60] !== t21 || $[61] !== t22) {
|
|
643
|
+
t23 = /* @__PURE__ */ _jsxs("div", {
|
|
644
|
+
className: "relative flex min-w-0 flex-1 flex-col items-start",
|
|
645
|
+
children: [t21, t22]
|
|
646
|
+
});
|
|
647
|
+
$[60] = t21;
|
|
648
|
+
$[61] = t22;
|
|
649
|
+
$[62] = t23;
|
|
650
|
+
} else {
|
|
651
|
+
t23 = $[62];
|
|
652
|
+
}
|
|
653
|
+
let t24;
|
|
654
|
+
if ($[63] !== progressVariant || $[64] !== t10 || $[65] !== t23 || $[66] !== t5 || $[67] !== t6 || $[68] !== t7) {
|
|
655
|
+
t24 = /* @__PURE__ */ _jsxs(AnimatedListItem, {
|
|
656
|
+
"data-slot": "file-upload-item",
|
|
657
|
+
"data-failed": t5,
|
|
658
|
+
"data-progress-variant": progressVariant,
|
|
659
|
+
className: t6,
|
|
660
|
+
children: [
|
|
661
|
+
t7,
|
|
662
|
+
t8,
|
|
663
|
+
t10,
|
|
664
|
+
t23
|
|
665
|
+
]
|
|
666
|
+
});
|
|
667
|
+
$[63] = progressVariant;
|
|
668
|
+
$[64] = t10;
|
|
669
|
+
$[65] = t23;
|
|
670
|
+
$[66] = t5;
|
|
671
|
+
$[67] = t6;
|
|
672
|
+
$[68] = t7;
|
|
673
|
+
$[69] = t24;
|
|
674
|
+
} else {
|
|
675
|
+
t24 = $[69];
|
|
676
|
+
}
|
|
677
|
+
return t24;
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* Lays out a drop zone and its file list.
|
|
681
|
+
* @param props - Native `div` attributes.
|
|
682
|
+
* @returns The container.
|
|
683
|
+
*/
|
|
684
|
+
export function FileUpload(t0) {
|
|
685
|
+
const $ = _c(8);
|
|
686
|
+
let className;
|
|
687
|
+
let props;
|
|
688
|
+
if ($[0] !== t0) {
|
|
689
|
+
({className, ...props} = t0);
|
|
690
|
+
$[0] = t0;
|
|
691
|
+
$[1] = className;
|
|
692
|
+
$[2] = props;
|
|
693
|
+
} else {
|
|
694
|
+
className = $[1];
|
|
695
|
+
props = $[2];
|
|
696
|
+
}
|
|
697
|
+
let t1;
|
|
698
|
+
if ($[3] !== className) {
|
|
699
|
+
t1 = cn("flex w-full min-w-0 flex-col gap-4", className);
|
|
700
|
+
$[3] = className;
|
|
701
|
+
$[4] = t1;
|
|
702
|
+
} else {
|
|
703
|
+
t1 = $[4];
|
|
704
|
+
}
|
|
705
|
+
let t2;
|
|
706
|
+
if ($[5] !== props || $[6] !== t1) {
|
|
707
|
+
t2 = /* @__PURE__ */ _jsx("div", {
|
|
708
|
+
"data-slot": "file-upload",
|
|
709
|
+
className: t1,
|
|
710
|
+
...props
|
|
711
|
+
});
|
|
712
|
+
$[5] = props;
|
|
713
|
+
$[6] = t1;
|
|
714
|
+
$[7] = t2;
|
|
715
|
+
} else {
|
|
716
|
+
t2 = $[7];
|
|
717
|
+
}
|
|
718
|
+
return t2;
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* Lists `FileUploadItem`s; only files added after the first render animate in.
|
|
722
|
+
* @param props - Native `ul` attributes and the items.
|
|
723
|
+
* @returns The list.
|
|
724
|
+
*/
|
|
725
|
+
export function FileUploadList(t0) {
|
|
726
|
+
const $ = _c(12);
|
|
727
|
+
let children;
|
|
728
|
+
let className;
|
|
729
|
+
let props;
|
|
730
|
+
if ($[0] !== t0) {
|
|
731
|
+
({className, children, ...props} = t0);
|
|
732
|
+
$[0] = t0;
|
|
733
|
+
$[1] = children;
|
|
734
|
+
$[2] = className;
|
|
735
|
+
$[3] = props;
|
|
736
|
+
} else {
|
|
737
|
+
children = $[1];
|
|
738
|
+
className = $[2];
|
|
739
|
+
props = $[3];
|
|
740
|
+
}
|
|
741
|
+
let t1;
|
|
742
|
+
if ($[4] !== className) {
|
|
743
|
+
t1 = cn("m-0 flex w-full min-w-0 list-none flex-col gap-3 p-0", className);
|
|
744
|
+
$[4] = className;
|
|
745
|
+
$[5] = t1;
|
|
746
|
+
} else {
|
|
747
|
+
t1 = $[5];
|
|
748
|
+
}
|
|
749
|
+
let t2;
|
|
750
|
+
if ($[6] !== children) {
|
|
751
|
+
t2 = /* @__PURE__ */ _jsx(AnimatePresence, {
|
|
752
|
+
initial: false,
|
|
753
|
+
children
|
|
754
|
+
});
|
|
755
|
+
$[6] = children;
|
|
756
|
+
$[7] = t2;
|
|
757
|
+
} else {
|
|
758
|
+
t2 = $[7];
|
|
759
|
+
}
|
|
760
|
+
let t3;
|
|
761
|
+
if ($[8] !== props || $[9] !== t1 || $[10] !== t2) {
|
|
762
|
+
t3 = /* @__PURE__ */ _jsx("ul", {
|
|
763
|
+
"data-slot": "file-upload-list",
|
|
764
|
+
className: t1,
|
|
765
|
+
...props,
|
|
766
|
+
children: t2
|
|
767
|
+
});
|
|
768
|
+
$[8] = props;
|
|
769
|
+
$[9] = t1;
|
|
770
|
+
$[10] = t2;
|
|
771
|
+
$[11] = t3;
|
|
772
|
+
} else {
|
|
773
|
+
t3 = $[11];
|
|
774
|
+
}
|
|
775
|
+
return t3;
|
|
776
|
+
}
|