@uipath/apollo-wind 0.9.0 → 0.10.0-pr257.2a4b17b

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.
Files changed (145) hide show
  1. package/dist/components/forms/field-renderer.cjs +120 -69
  2. package/dist/components/forms/field-renderer.js +120 -69
  3. package/dist/components/forms/form-designer.cjs +2352 -1488
  4. package/dist/components/forms/form-designer.js +2353 -1489
  5. package/dist/components/forms/form-examples.cjs +10 -10
  6. package/dist/components/forms/form-examples.js +10 -10
  7. package/dist/components/forms/form-state-viewer.cjs +988 -433
  8. package/dist/components/forms/form-state-viewer.js +988 -433
  9. package/dist/components/forms/metadata-form.cjs +446 -170
  10. package/dist/components/forms/metadata-form.js +446 -170
  11. package/dist/components/forms/schema-viewer.cjs +173 -80
  12. package/dist/components/forms/schema-viewer.js +173 -80
  13. package/dist/components/ui/accordion.cjs +131 -27
  14. package/dist/components/ui/accordion.js +131 -27
  15. package/dist/components/ui/alert-dialog.cjs +273 -45
  16. package/dist/components/ui/alert-dialog.js +273 -45
  17. package/dist/components/ui/alert.cjs +106 -17
  18. package/dist/components/ui/alert.js +106 -17
  19. package/dist/components/ui/avatar.cjs +100 -15
  20. package/dist/components/ui/avatar.js +100 -15
  21. package/dist/components/ui/badge.cjs +36 -6
  22. package/dist/components/ui/badge.js +36 -6
  23. package/dist/components/ui/breadcrumb.cjs +258 -52
  24. package/dist/components/ui/breadcrumb.js +258 -52
  25. package/dist/components/ui/button-group.cjs +119 -19
  26. package/dist/components/ui/button-group.js +119 -19
  27. package/dist/components/ui/button.cjs +48 -8
  28. package/dist/components/ui/button.js +48 -8
  29. package/dist/components/ui/calendar.cjs +88 -30
  30. package/dist/components/ui/calendar.js +88 -30
  31. package/dist/components/ui/card.cjs +199 -30
  32. package/dist/components/ui/card.js +199 -30
  33. package/dist/components/ui/checkbox.cjs +42 -8
  34. package/dist/components/ui/checkbox.js +42 -8
  35. package/dist/components/ui/combobox.cjs +150 -53
  36. package/dist/components/ui/combobox.js +150 -53
  37. package/dist/components/ui/command.cjs +291 -53
  38. package/dist/components/ui/command.js +291 -53
  39. package/dist/components/ui/context-menu.cjs +370 -72
  40. package/dist/components/ui/context-menu.js +370 -72
  41. package/dist/components/ui/data-table.cjs +76 -39
  42. package/dist/components/ui/data-table.js +76 -39
  43. package/dist/components/ui/date-picker.cjs +179 -68
  44. package/dist/components/ui/date-picker.js +179 -68
  45. package/dist/components/ui/datetime-picker.cjs +225 -104
  46. package/dist/components/ui/datetime-picker.js +225 -104
  47. package/dist/components/ui/dialog.cjs +290 -78
  48. package/dist/components/ui/dialog.js +290 -78
  49. package/dist/components/ui/drawer.cjs +220 -39
  50. package/dist/components/ui/drawer.js +220 -39
  51. package/dist/components/ui/dropdown-menu.cjs +376 -73
  52. package/dist/components/ui/dropdown-menu.js +376 -73
  53. package/dist/components/ui/editable-cell.cjs +106 -42
  54. package/dist/components/ui/editable-cell.js +106 -42
  55. package/dist/components/ui/empty-state.cjs +106 -33
  56. package/dist/components/ui/empty-state.js +106 -33
  57. package/dist/components/ui/file-upload.cjs +405 -187
  58. package/dist/components/ui/file-upload.d.ts +3 -1
  59. package/dist/components/ui/file-upload.js +405 -187
  60. package/dist/components/ui/hover-card.cjs +46 -7
  61. package/dist/components/ui/hover-card.js +46 -7
  62. package/dist/components/ui/index.cjs +4 -4
  63. package/dist/components/ui/input.cjs +39 -6
  64. package/dist/components/ui/input.js +39 -6
  65. package/dist/components/ui/label.cjs +34 -5
  66. package/dist/components/ui/label.js +34 -5
  67. package/dist/components/ui/layout/column.cjs +209 -41
  68. package/dist/components/ui/layout/column.js +209 -41
  69. package/dist/components/ui/layout/grid.cjs +275 -60
  70. package/dist/components/ui/layout/grid.js +275 -60
  71. package/dist/components/ui/layout/row.cjs +209 -41
  72. package/dist/components/ui/layout/row.js +209 -41
  73. package/dist/components/ui/menubar.cjs +540 -106
  74. package/dist/components/ui/menubar.js +540 -106
  75. package/dist/components/ui/multi-select.cjs +289 -135
  76. package/dist/components/ui/multi-select.js +289 -135
  77. package/dist/components/ui/navigation-menu.cjs +244 -47
  78. package/dist/components/ui/navigation-menu.js +244 -47
  79. package/dist/components/ui/pagination.cjs +301 -65
  80. package/dist/components/ui/pagination.js +301 -65
  81. package/dist/components/ui/popover.cjs +48 -9
  82. package/dist/components/ui/popover.js +48 -9
  83. package/dist/components/ui/progress.cjs +48 -8
  84. package/dist/components/ui/progress.js +48 -8
  85. package/dist/components/ui/radio-group.cjs +74 -12
  86. package/dist/components/ui/radio-group.js +74 -12
  87. package/dist/components/ui/resizable.cjs +75 -10
  88. package/dist/components/ui/resizable.js +75 -10
  89. package/dist/components/ui/scroll-area.cjs +113 -21
  90. package/dist/components/ui/scroll-area.js +113 -21
  91. package/dist/components/ui/search.cjs +280 -98
  92. package/dist/components/ui/search.js +280 -98
  93. package/dist/components/ui/select.cjs +334 -68
  94. package/dist/components/ui/select.js +334 -68
  95. package/dist/components/ui/separator.cjs +48 -7
  96. package/dist/components/ui/separator.js +48 -7
  97. package/dist/components/ui/sheet.cjs +236 -50
  98. package/dist/components/ui/sheet.js +236 -50
  99. package/dist/components/ui/skeleton.cjs +31 -5
  100. package/dist/components/ui/skeleton.js +31 -5
  101. package/dist/components/ui/slider.cjs +71 -21
  102. package/dist/components/ui/slider.js +71 -21
  103. package/dist/components/ui/sonner.cjs +43 -15
  104. package/dist/components/ui/sonner.js +43 -15
  105. package/dist/components/ui/spinner.cjs +83 -21
  106. package/dist/components/ui/spinner.js +83 -21
  107. package/dist/components/ui/stats-card.cjs +169 -60
  108. package/dist/components/ui/stats-card.js +169 -60
  109. package/dist/components/ui/stepper.cjs +126 -57
  110. package/dist/components/ui/stepper.js +126 -57
  111. package/dist/components/ui/switch.cjs +42 -8
  112. package/dist/components/ui/switch.js +42 -8
  113. package/dist/components/ui/table.cjs +267 -42
  114. package/dist/components/ui/table.js +267 -42
  115. package/dist/components/ui/tabs.cjs +100 -15
  116. package/dist/components/ui/tabs.js +100 -15
  117. package/dist/components/ui/textarea.cjs +34 -5
  118. package/dist/components/ui/textarea.js +34 -5
  119. package/dist/components/ui/toggle-group.cjs +112 -19
  120. package/dist/components/ui/toggle-group.js +112 -19
  121. package/dist/components/ui/toggle.cjs +43 -6
  122. package/dist/components/ui/toggle.js +43 -6
  123. package/dist/components/ui/tooltip.cjs +40 -6
  124. package/dist/components/ui/tooltip.js +40 -6
  125. package/dist/examples/admin-layout-example.cjs +879 -347
  126. package/dist/examples/admin-layout-example.js +879 -347
  127. package/dist/examples/app-shell-example.cjs +14 -14
  128. package/dist/examples/app-shell-example.js +14 -14
  129. package/dist/examples/dashboard-example.cjs +495 -334
  130. package/dist/examples/dashboard-example.js +495 -334
  131. package/dist/examples/data-management-example.cjs +501 -303
  132. package/dist/examples/data-management-example.js +502 -304
  133. package/dist/examples/flow-editor-layout-example.cjs +435 -231
  134. package/dist/examples/flow-editor-layout-example.js +436 -232
  135. package/dist/examples/flow-start-example.cjs +508 -251
  136. package/dist/examples/flow-start-example.js +509 -252
  137. package/dist/examples/form-builder-example.cjs +1006 -602
  138. package/dist/examples/form-builder-example.js +1007 -603
  139. package/dist/examples/new-project-example.cjs +806 -474
  140. package/dist/examples/new-project-example.js +807 -475
  141. package/dist/examples/settings-example.cjs +792 -704
  142. package/dist/examples/settings-example.js +792 -704
  143. package/dist/examples/vscode-example.cjs +731 -236
  144. package/dist/examples/vscode-example.js +731 -236
  145. package/package.json +4 -1
@@ -1,202 +1,420 @@
1
1
  'use client';
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { c } from "react/compiler-runtime";
3
4
  import { Upload, X } from "lucide-react";
4
5
  import { useRef, useState } from "react";
5
6
  import { Button } from "./button.js";
6
7
  import { cn } from "../../lib/index.js";
7
- function FileUpload({ onFilesChange, accept, multiple = false, disabled = false, maxSize, className, showPreview = false }) {
8
- const [files, setFiles] = useState([]);
8
+ function FileUpload(t0) {
9
+ const $ = c(72);
10
+ const { onFilesChange, accept, multiple: t1, disabled: t2, maxSize, className, showPreview: t3, errors } = t0;
11
+ const multiple = void 0 === t1 ? false : t1;
12
+ const disabled = void 0 === t2 ? false : t2;
13
+ const showPreview = void 0 === t3 ? false : t3;
14
+ let t4;
15
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
16
+ t4 = [];
17
+ $[0] = t4;
18
+ } else t4 = $[0];
19
+ const [files, setFiles] = useState(t4);
9
20
  const [isDragging, setIsDragging] = useState(false);
10
- const [error, setError] = useState('');
11
- const [previews, setPreviews] = useState([]);
21
+ let t5;
22
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
23
+ t5 = new Map();
24
+ $[1] = t5;
25
+ } else t5 = $[1];
26
+ const [fileErrors, setFileErrors] = useState(t5);
27
+ let t6;
28
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
29
+ t6 = [];
30
+ $[2] = t6;
31
+ } else t6 = $[2];
32
+ const [previews, setPreviews] = useState(t6);
12
33
  const inputRef = useRef(null);
13
- const validateFiles = (fileList)=>{
14
- setError('');
15
- const validFiles = [];
16
- for (const file of fileList){
17
- if (maxSize && file.size > maxSize) {
18
- setError(`File "${file.name}" exceeds maximum size of ${formatFileSize(maxSize)}`);
19
- continue;
34
+ let t7;
35
+ if ($[3] !== accept) {
36
+ t7 = (file)=>{
37
+ if (!accept) return true;
38
+ const acceptedTypes = accept.split(",").map(_temp);
39
+ for (const acceptedType of acceptedTypes)if (acceptedType.endsWith("/*")) {
40
+ const baseType = acceptedType.slice(0, -2);
41
+ if (file.type.toLowerCase().startsWith(baseType)) return true;
42
+ } else if (acceptedType.includes("/")) {
43
+ if (file.type.toLowerCase() === acceptedType) return true;
44
+ } else if (acceptedType.startsWith(".")) {
45
+ if (file.name.toLowerCase().endsWith(acceptedType)) return true;
20
46
  }
21
- const isDuplicate = files.some((existingFile)=>existingFile.name === file.name && existingFile.size === file.size);
22
- if (!isDuplicate) validFiles.push(file);
23
- }
24
- return validFiles;
25
- };
26
- const handleFiles = (fileList)=>{
27
- if (!fileList || 0 === fileList.length) return;
28
- const filesArray = Array.from(fileList);
29
- const validFiles = validateFiles(filesArray);
30
- if (0 === validFiles.length) return;
31
- const newFiles = multiple ? [
32
- ...files,
33
- ...validFiles
34
- ] : validFiles;
35
- setFiles(newFiles);
36
- onFilesChange?.(newFiles);
37
- if (showPreview) {
38
- const newPreviews = [];
39
- validFiles.forEach((file)=>{
40
- if (file.type.startsWith('image/')) {
41
- const reader = new FileReader();
42
- reader.onloadend = ()=>{
43
- newPreviews.push(reader.result);
44
- if (newPreviews.length === validFiles.filter((f)=>f.type.startsWith('image/')).length) setPreviews(multiple ? [
45
- ...previews,
46
- ...newPreviews
47
- ] : newPreviews);
48
- };
49
- reader.readAsDataURL(file);
47
+ return false;
48
+ };
49
+ $[3] = accept;
50
+ $[4] = t7;
51
+ } else t7 = $[4];
52
+ const isFileTypeAccepted = t7;
53
+ let formatFileSize;
54
+ let handleClick;
55
+ let handleDragEnter;
56
+ let handleDragLeave;
57
+ let handleDragOver;
58
+ let handleDrop;
59
+ let handleInputChange;
60
+ let removeFile;
61
+ if ($[5] !== disabled || $[6] !== fileErrors || $[7] !== files || $[8] !== isFileTypeAccepted || $[9] !== maxSize || $[10] !== multiple || $[11] !== onFilesChange || $[12] !== previews || $[13] !== showPreview) {
62
+ const validateFiles = (fileList, startIndex, existingErrors)=>{
63
+ const validFiles = [];
64
+ const errors_0 = multiple ? new Map(existingErrors) : new Map();
65
+ for (const file_0 of fileList){
66
+ const fileIndex = startIndex + validFiles.length;
67
+ if (!isFileTypeAccepted(file_0)) {
68
+ errors_0.set(fileIndex, "File type not accepted");
69
+ validFiles.push(file_0);
70
+ continue;
50
71
  }
51
- });
52
- }
53
- };
54
- const removeFile = (index)=>{
55
- const newFiles = files.filter((_, i)=>i !== index);
56
- setFiles(newFiles);
57
- onFilesChange?.(newFiles);
58
- if (showPreview) {
59
- const newPreviews = previews.filter((_, i)=>i !== index);
60
- setPreviews(newPreviews);
61
- }
62
- setError('');
63
- };
64
- const handleDragEnter = (e)=>{
65
- e.preventDefault();
66
- e.stopPropagation();
67
- if (!disabled) setIsDragging(true);
68
- };
69
- const handleDragLeave = (e)=>{
70
- e.preventDefault();
71
- e.stopPropagation();
72
- setIsDragging(false);
73
- };
74
- const handleDragOver = (e)=>{
75
- e.preventDefault();
76
- e.stopPropagation();
77
- };
78
- const handleDrop = (e)=>{
79
- e.preventDefault();
80
- e.stopPropagation();
81
- setIsDragging(false);
82
- if (!disabled) handleFiles(e.dataTransfer.files);
83
- };
84
- const handleInputChange = (e)=>{
85
- handleFiles(e.target.files);
86
- if (inputRef.current) inputRef.current.value = '';
87
- };
88
- const handleClick = ()=>{
89
- if (!disabled) inputRef.current?.click();
90
- };
91
- const formatFileSize = (bytes)=>{
92
- if (0 === bytes) return '0 Bytes';
93
- const k = 1024;
94
- const sizes = [
95
- 'Bytes',
96
- 'KB',
97
- 'MB',
98
- 'GB'
99
- ];
100
- const i = Math.floor(Math.log(bytes) / Math.log(k));
101
- return Math.round(bytes / k ** i * 100) / 100 + ' ' + sizes[i];
102
- };
103
- return /*#__PURE__*/ jsxs("div", {
104
- className: cn('w-full', className),
105
- children: [
106
- /*#__PURE__*/ jsxs("div", {
107
- className: cn('relative flex flex-col items-center justify-center w-full h-32 px-4 py-6 border-2 border-dashed rounded-lg cursor-pointer transition-colors', isDragging ? 'border-primary bg-primary/5' : 'border-input bg-background hover:bg-accent/50', disabled && 'opacity-50 cursor-not-allowed hover:bg-background', error && 'border-destructive'),
108
- onDragEnter: handleDragEnter,
109
- onDragOver: handleDragOver,
110
- onDragLeave: handleDragLeave,
111
- onDrop: handleDrop,
112
- onClick: handleClick,
113
- children: [
114
- /*#__PURE__*/ jsx("input", {
115
- ref: inputRef,
116
- type: "file",
117
- className: "hidden",
118
- accept: accept,
119
- multiple: multiple,
120
- disabled: disabled,
121
- onChange: handleInputChange,
122
- "aria-label": "File upload"
123
- }),
124
- /*#__PURE__*/ jsx(Upload, {
125
- className: "w-8 h-8 mb-2 text-muted-foreground"
126
- }),
127
- /*#__PURE__*/ jsxs("p", {
128
- className: "text-sm text-muted-foreground text-center",
129
- children: [
130
- /*#__PURE__*/ jsx("span", {
131
- className: "font-semibold",
132
- children: "Click to upload"
133
- }),
134
- " or drag and drop"
135
- ]
136
- }),
137
- accept && /*#__PURE__*/ jsx("p", {
138
- className: "text-xs text-muted-foreground mt-1",
139
- children: accept.split(',').join(', ')
140
- }),
141
- maxSize && /*#__PURE__*/ jsxs("p", {
142
- className: "text-xs text-muted-foreground",
143
- children: [
144
- "Max size: ",
145
- formatFileSize(maxSize)
146
- ]
147
- })
148
- ]
149
- }),
150
- error && /*#__PURE__*/ jsx("p", {
151
- className: "text-sm text-destructive mt-2",
152
- children: error
153
- }),
154
- files.length > 0 && /*#__PURE__*/ jsx("div", {
155
- className: "mt-4 space-y-2",
156
- children: files.map((file, index)=>/*#__PURE__*/ jsxs("div", {
157
- className: "flex items-center justify-between p-3 bg-accent/50 rounded-md",
158
- children: [
159
- /*#__PURE__*/ jsxs("div", {
160
- className: "flex items-center gap-3 flex-1 min-w-0",
161
- children: [
162
- showPreview && previews[index] && /*#__PURE__*/ jsx("img", {
163
- src: previews[index],
164
- alt: file.name,
165
- className: "w-10 h-10 object-cover rounded"
166
- }),
167
- /*#__PURE__*/ jsxs("div", {
168
- className: "flex-1 min-w-0",
169
- children: [
170
- /*#__PURE__*/ jsx("p", {
171
- className: "text-sm font-medium truncate",
172
- children: file.name
173
- }),
174
- /*#__PURE__*/ jsx("p", {
175
- className: "text-xs text-muted-foreground",
176
- children: formatFileSize(file.size)
177
- })
178
- ]
72
+ if (maxSize && file_0.size > maxSize) {
73
+ errors_0.set(fileIndex, `Exceeds maximum size of ${formatFileSize(maxSize)}`);
74
+ validFiles.push(file_0);
75
+ continue;
76
+ }
77
+ const isDuplicate = files.some((existingFile)=>existingFile.name === file_0.name && existingFile.size === file_0.size);
78
+ if (!isDuplicate) validFiles.push(file_0);
79
+ }
80
+ return {
81
+ validFiles,
82
+ errors: errors_0
83
+ };
84
+ };
85
+ const handleFiles = (fileList_0)=>{
86
+ if (!fileList_0 || 0 === fileList_0.length) return;
87
+ const filesArray = Array.from(fileList_0);
88
+ const startIndex_0 = multiple ? files.length : 0;
89
+ const { validFiles: validFiles_0, errors: errors_1 } = validateFiles(filesArray, startIndex_0, fileErrors);
90
+ if (0 === validFiles_0.length) return;
91
+ const newFiles = multiple ? [
92
+ ...files,
93
+ ...validFiles_0
94
+ ] : validFiles_0;
95
+ setFiles(newFiles);
96
+ onFilesChange?.(newFiles);
97
+ setFileErrors(errors_1);
98
+ if (showPreview) {
99
+ const newPreviews = [];
100
+ validFiles_0.forEach((file_1)=>{
101
+ if (file_1.type.startsWith("image/")) {
102
+ const reader = new FileReader();
103
+ reader.onloadend = ()=>{
104
+ newPreviews.push(reader.result);
105
+ if (newPreviews.length === validFiles_0.filter(_temp2).length) setPreviews(multiple ? [
106
+ ...previews,
107
+ ...newPreviews
108
+ ] : newPreviews);
109
+ };
110
+ reader.readAsDataURL(file_1);
111
+ }
112
+ });
113
+ }
114
+ };
115
+ let t8;
116
+ if ($[22] !== files || $[23] !== onFilesChange || $[24] !== previews || $[25] !== showPreview) {
117
+ t8 = (index)=>{
118
+ const newFiles_0 = files.filter((_, i)=>i !== index);
119
+ setFiles(newFiles_0);
120
+ onFilesChange?.(newFiles_0);
121
+ if (showPreview) {
122
+ const newPreviews_0 = previews.filter((__0, i_0)=>i_0 !== index);
123
+ setPreviews(newPreviews_0);
124
+ }
125
+ setFileErrors((prev)=>{
126
+ const updated = new Map();
127
+ prev.forEach((error, i_1)=>{
128
+ if (i_1 < index) updated.set(i_1, error);
129
+ else if (i_1 > index) updated.set(i_1 - 1, error);
130
+ });
131
+ return updated;
132
+ });
133
+ };
134
+ $[22] = files;
135
+ $[23] = onFilesChange;
136
+ $[24] = previews;
137
+ $[25] = showPreview;
138
+ $[26] = t8;
139
+ } else t8 = $[26];
140
+ removeFile = t8;
141
+ let t9;
142
+ if ($[27] !== disabled) {
143
+ t9 = (e)=>{
144
+ e.preventDefault();
145
+ e.stopPropagation();
146
+ if (!disabled) setIsDragging(true);
147
+ };
148
+ $[27] = disabled;
149
+ $[28] = t9;
150
+ } else t9 = $[28];
151
+ handleDragEnter = t9;
152
+ let t10;
153
+ if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
154
+ t10 = (e_0)=>{
155
+ e_0.preventDefault();
156
+ e_0.stopPropagation();
157
+ setIsDragging(false);
158
+ };
159
+ $[29] = t10;
160
+ } else t10 = $[29];
161
+ handleDragLeave = t10;
162
+ handleDragOver = _temp3;
163
+ handleDrop = (e_2)=>{
164
+ e_2.preventDefault();
165
+ e_2.stopPropagation();
166
+ setIsDragging(false);
167
+ if (!disabled) handleFiles(e_2.dataTransfer.files);
168
+ };
169
+ handleInputChange = (e_3)=>{
170
+ handleFiles(e_3.target.files);
171
+ if (inputRef.current) inputRef.current.value = "";
172
+ };
173
+ let t11;
174
+ if ($[30] !== disabled) {
175
+ t11 = ()=>{
176
+ if (!disabled) inputRef.current?.click();
177
+ };
178
+ $[30] = disabled;
179
+ $[31] = t11;
180
+ } else t11 = $[31];
181
+ handleClick = t11;
182
+ formatFileSize = _temp4;
183
+ $[5] = disabled;
184
+ $[6] = fileErrors;
185
+ $[7] = files;
186
+ $[8] = isFileTypeAccepted;
187
+ $[9] = maxSize;
188
+ $[10] = multiple;
189
+ $[11] = onFilesChange;
190
+ $[12] = previews;
191
+ $[13] = showPreview;
192
+ $[14] = formatFileSize;
193
+ $[15] = handleClick;
194
+ $[16] = handleDragEnter;
195
+ $[17] = handleDragLeave;
196
+ $[18] = handleDragOver;
197
+ $[19] = handleDrop;
198
+ $[20] = handleInputChange;
199
+ $[21] = removeFile;
200
+ } else {
201
+ formatFileSize = $[14];
202
+ handleClick = $[15];
203
+ handleDragEnter = $[16];
204
+ handleDragLeave = $[17];
205
+ handleDragOver = $[18];
206
+ handleDrop = $[19];
207
+ handleInputChange = $[20];
208
+ removeFile = $[21];
209
+ }
210
+ let t8;
211
+ if ($[32] !== className) {
212
+ t8 = cn("w-full", className);
213
+ $[32] = className;
214
+ $[33] = t8;
215
+ } else t8 = $[33];
216
+ const t9 = isDragging ? "border-primary bg-primary/5" : "border-input bg-background hover:bg-accent/50";
217
+ const t10 = disabled && "opacity-50 cursor-not-allowed hover:bg-background";
218
+ let t11;
219
+ if ($[34] !== t10 || $[35] !== t9) {
220
+ t11 = cn("relative flex flex-col items-center justify-center w-full h-32 px-4 py-6 border-2 border-dashed rounded-lg cursor-pointer transition-colors", t9, t10);
221
+ $[34] = t10;
222
+ $[35] = t9;
223
+ $[36] = t11;
224
+ } else t11 = $[36];
225
+ let t12;
226
+ if ($[37] !== accept || $[38] !== disabled || $[39] !== handleInputChange || $[40] !== multiple) {
227
+ t12 = /*#__PURE__*/ jsx("input", {
228
+ ref: inputRef,
229
+ type: "file",
230
+ className: "hidden",
231
+ accept: accept,
232
+ multiple: multiple,
233
+ disabled: disabled,
234
+ onChange: handleInputChange,
235
+ "aria-label": "File upload"
236
+ });
237
+ $[37] = accept;
238
+ $[38] = disabled;
239
+ $[39] = handleInputChange;
240
+ $[40] = multiple;
241
+ $[41] = t12;
242
+ } else t12 = $[41];
243
+ let t13;
244
+ if ($[42] === Symbol.for("react.memo_cache_sentinel")) {
245
+ t13 = /*#__PURE__*/ jsx(Upload, {
246
+ className: "w-8 h-8 mb-2 text-muted-foreground"
247
+ });
248
+ $[42] = t13;
249
+ } else t13 = $[42];
250
+ let t14;
251
+ if ($[43] === Symbol.for("react.memo_cache_sentinel")) {
252
+ t14 = /*#__PURE__*/ jsxs("p", {
253
+ className: "text-sm text-muted-foreground text-center",
254
+ children: [
255
+ /*#__PURE__*/ jsx("span", {
256
+ className: "font-semibold",
257
+ children: "Click to upload"
258
+ }),
259
+ " or drag and drop"
260
+ ]
261
+ });
262
+ $[43] = t14;
263
+ } else t14 = $[43];
264
+ let t15;
265
+ if ($[44] !== accept) {
266
+ t15 = accept && /*#__PURE__*/ jsx("p", {
267
+ className: "text-xs text-muted-foreground mt-1",
268
+ children: accept.split(",").join(", ")
269
+ });
270
+ $[44] = accept;
271
+ $[45] = t15;
272
+ } else t15 = $[45];
273
+ let t16;
274
+ if ($[46] !== formatFileSize || $[47] !== maxSize) {
275
+ t16 = maxSize && /*#__PURE__*/ jsxs("p", {
276
+ className: "text-xs text-muted-foreground",
277
+ children: [
278
+ "Max size: ",
279
+ formatFileSize(maxSize)
280
+ ]
281
+ });
282
+ $[46] = formatFileSize;
283
+ $[47] = maxSize;
284
+ $[48] = t16;
285
+ } else t16 = $[48];
286
+ let t17;
287
+ if ($[49] !== handleClick || $[50] !== handleDragEnter || $[51] !== handleDragLeave || $[52] !== handleDragOver || $[53] !== handleDrop || $[54] !== t11 || $[55] !== t12 || $[56] !== t15 || $[57] !== t16) {
288
+ t17 = /*#__PURE__*/ jsxs("div", {
289
+ className: t11,
290
+ onDragEnter: handleDragEnter,
291
+ onDragOver: handleDragOver,
292
+ onDragLeave: handleDragLeave,
293
+ onDrop: handleDrop,
294
+ onClick: handleClick,
295
+ children: [
296
+ t12,
297
+ t13,
298
+ t14,
299
+ t15,
300
+ t16
301
+ ]
302
+ });
303
+ $[49] = handleClick;
304
+ $[50] = handleDragEnter;
305
+ $[51] = handleDragLeave;
306
+ $[52] = handleDragOver;
307
+ $[53] = handleDrop;
308
+ $[54] = t11;
309
+ $[55] = t12;
310
+ $[56] = t15;
311
+ $[57] = t16;
312
+ $[58] = t17;
313
+ } else t17 = $[58];
314
+ let t18;
315
+ if ($[59] !== disabled || $[60] !== errors || $[61] !== fileErrors || $[62] !== files || $[63] !== formatFileSize || $[64] !== previews || $[65] !== removeFile || $[66] !== showPreview) {
316
+ t18 = files.length > 0 && /*#__PURE__*/ jsx("div", {
317
+ className: "mt-4 space-y-2",
318
+ children: files.map((file_2, index_0)=>{
319
+ const fileError = errors?.[file_2.name] ?? fileErrors.get(index_0);
320
+ return /*#__PURE__*/ jsxs("div", {
321
+ className: cn("flex flex-col p-3 rounded-md", fileError ? "bg-destructive/10 border border-destructive/20" : "bg-accent/50"),
322
+ children: [
323
+ /*#__PURE__*/ jsxs("div", {
324
+ className: "flex items-center justify-between",
325
+ children: [
326
+ /*#__PURE__*/ jsxs("div", {
327
+ className: "flex items-center gap-3 flex-1 min-w-0",
328
+ children: [
329
+ showPreview && previews[index_0] && /*#__PURE__*/ jsx("img", {
330
+ src: previews[index_0],
331
+ alt: file_2.name,
332
+ className: "w-10 h-10 object-cover rounded"
333
+ }),
334
+ /*#__PURE__*/ jsxs("div", {
335
+ className: "flex-1 min-w-0",
336
+ children: [
337
+ /*#__PURE__*/ jsx("p", {
338
+ className: "text-sm font-medium truncate",
339
+ children: file_2.name
340
+ }),
341
+ /*#__PURE__*/ jsx("p", {
342
+ className: "text-xs text-muted-foreground",
343
+ children: formatFileSize(file_2.size)
344
+ })
345
+ ]
346
+ })
347
+ ]
348
+ }),
349
+ /*#__PURE__*/ jsx(Button, {
350
+ variant: "ghost",
351
+ size: "icon",
352
+ className: "h-8 w-8",
353
+ "aria-label": `Remove ${file_2.name}`,
354
+ onClick: (e_4)=>{
355
+ e_4.stopPropagation();
356
+ removeFile(index_0);
357
+ },
358
+ disabled: disabled,
359
+ children: /*#__PURE__*/ jsx(X, {
360
+ className: "h-4 w-4"
179
361
  })
180
- ]
181
- }),
182
- /*#__PURE__*/ jsx(Button, {
183
- variant: "ghost",
184
- size: "icon",
185
- className: "h-8 w-8",
186
- "aria-label": `Remove ${file.name}`,
187
- onClick: (e)=>{
188
- e.stopPropagation();
189
- removeFile(index);
190
- },
191
- disabled: disabled,
192
- children: /*#__PURE__*/ jsx(X, {
193
- className: "h-4 w-4"
194
362
  })
195
- })
196
- ]
197
- }, index))
363
+ ]
364
+ }),
365
+ fileError && /*#__PURE__*/ jsx("p", {
366
+ className: "text-xs text-destructive mt-2",
367
+ children: fileError
368
+ })
369
+ ]
370
+ }, index_0);
198
371
  })
199
- ]
200
- });
372
+ });
373
+ $[59] = disabled;
374
+ $[60] = errors;
375
+ $[61] = fileErrors;
376
+ $[62] = files;
377
+ $[63] = formatFileSize;
378
+ $[64] = previews;
379
+ $[65] = removeFile;
380
+ $[66] = showPreview;
381
+ $[67] = t18;
382
+ } else t18 = $[67];
383
+ let t19;
384
+ if ($[68] !== t17 || $[69] !== t18 || $[70] !== t8) {
385
+ t19 = /*#__PURE__*/ jsxs("div", {
386
+ className: t8,
387
+ children: [
388
+ t17,
389
+ t18
390
+ ]
391
+ });
392
+ $[68] = t17;
393
+ $[69] = t18;
394
+ $[70] = t8;
395
+ $[71] = t19;
396
+ } else t19 = $[71];
397
+ return t19;
398
+ }
399
+ function _temp4(bytes) {
400
+ if (0 === bytes) return "0 Bytes";
401
+ const sizes = [
402
+ "Bytes",
403
+ "KB",
404
+ "MB",
405
+ "GB"
406
+ ];
407
+ const i_2 = Math.floor(Math.log(bytes) / Math.log(1024));
408
+ return Math.round(bytes / 1024 ** i_2 * 100) / 100 + " " + sizes[i_2];
409
+ }
410
+ function _temp3(e_1) {
411
+ e_1.preventDefault();
412
+ e_1.stopPropagation();
413
+ }
414
+ function _temp2(f) {
415
+ return f.type.startsWith("image/");
416
+ }
417
+ function _temp(type) {
418
+ return type.trim().toLowerCase();
201
419
  }
202
420
  export { FileUpload };