@raydenui/ui 0.9.7 → 0.10.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.
Files changed (308) hide show
  1. package/dist/Table-DCNSxua1.d.cts +31 -0
  2. package/dist/Table-DCNSxua1.d.ts +31 -0
  3. package/dist/blocks/ApplicationShellBlock.cjs +157 -0
  4. package/dist/blocks/ApplicationShellBlock.js +154 -0
  5. package/dist/blocks/CheckoutReviewBlock.cjs +16 -0
  6. package/dist/blocks/CheckoutReviewBlock.js +13 -0
  7. package/dist/blocks/CommandPaletteBlock.cjs +334 -0
  8. package/dist/blocks/CommandPaletteBlock.js +331 -0
  9. package/dist/blocks/CreateAccountBlock.cjs +147 -0
  10. package/dist/blocks/CreateAccountBlock.js +143 -0
  11. package/dist/blocks/EmptyStateBlock.cjs +19 -0
  12. package/dist/blocks/EmptyStateBlock.js +16 -0
  13. package/dist/blocks/FeatureOverviewBlock.cjs +54 -0
  14. package/dist/blocks/FeatureOverviewBlock.js +51 -0
  15. package/dist/blocks/HeaderBlock.cjs +230 -0
  16. package/dist/blocks/HeaderBlock.js +227 -0
  17. package/dist/blocks/KpiOverviewBlock.cjs +63 -0
  18. package/dist/blocks/KpiOverviewBlock.js +60 -0
  19. package/dist/blocks/LoginBlock.cjs +66 -0
  20. package/dist/blocks/LoginBlock.js +63 -0
  21. package/dist/blocks/NotificationsBlock.cjs +17 -0
  22. package/dist/blocks/NotificationsBlock.js +14 -0
  23. package/dist/blocks/PageHeaderBlock.cjs +121 -0
  24. package/dist/blocks/PageHeaderBlock.js +118 -0
  25. package/dist/blocks/PricingPlansBlock.cjs +146 -0
  26. package/dist/blocks/PricingPlansBlock.js +143 -0
  27. package/dist/blocks/ProductCollectionBlock.cjs +37 -0
  28. package/dist/blocks/ProductCollectionBlock.js +34 -0
  29. package/dist/blocks/ProductDetailBlock.cjs +30 -0
  30. package/dist/blocks/ProductDetailBlock.js +27 -0
  31. package/dist/blocks/ProductHeroBlock.cjs +83 -0
  32. package/dist/blocks/ProductHeroBlock.js +80 -0
  33. package/dist/blocks/ProfileSettingsBlock.cjs +130 -0
  34. package/dist/blocks/ProfileSettingsBlock.js +126 -0
  35. package/dist/blocks/QuickSendBlock.cjs +11 -0
  36. package/dist/blocks/QuickSendBlock.js +8 -0
  37. package/dist/blocks/RecentTransactionsBlock.cjs +13 -0
  38. package/dist/blocks/RecentTransactionsBlock.js +10 -0
  39. package/dist/blocks/SearchableTableBlock.cjs +91 -0
  40. package/dist/blocks/SearchableTableBlock.js +88 -0
  41. package/dist/blocks/ShoppingCartBlock.cjs +16 -0
  42. package/dist/blocks/ShoppingCartBlock.js +13 -0
  43. package/dist/blocks/SiteFooterBlock.cjs +69 -0
  44. package/dist/blocks/SiteFooterBlock.js +66 -0
  45. package/dist/blocks/TableBlock.cjs +20 -0
  46. package/dist/blocks/TableBlock.js +17 -0
  47. package/dist/blocks/TaskListBlock.cjs +198 -0
  48. package/dist/blocks/TaskListBlock.js +195 -0
  49. package/dist/blocks/WorkspaceSwitcherBlock.cjs +291 -0
  50. package/dist/blocks/WorkspaceSwitcherBlock.js +288 -0
  51. package/dist/blocks/commerce.cjs +44 -0
  52. package/dist/blocks/commerce.js +35 -0
  53. package/dist/blocks/index.cjs +53 -0
  54. package/dist/blocks/index.js +24 -0
  55. package/dist/blocks.d.cts +1820 -0
  56. package/dist/blocks.d.ts +1820 -0
  57. package/dist/chart.cjs +13 -0
  58. package/dist/chart.d.cts +59 -0
  59. package/dist/chart.d.ts +59 -0
  60. package/dist/chart.js +5 -0
  61. package/dist/components/Accordion/Accordion.cjs +94 -0
  62. package/dist/components/Accordion/Accordion.js +91 -0
  63. package/dist/components/Accordion/index.cjs +8 -0
  64. package/dist/components/Accordion/index.js +1 -0
  65. package/dist/components/ActivityFeed/ActivityContent.cjs +40 -0
  66. package/dist/components/ActivityFeed/ActivityContent.js +37 -0
  67. package/dist/components/ActivityFeed/ActivityItem.cjs +19 -0
  68. package/dist/components/ActivityFeed/ActivityItem.js +16 -0
  69. package/dist/components/ActivityFeed/index.cjs +7 -0
  70. package/dist/components/ActivityFeed/index.js +2 -0
  71. package/dist/components/Alert/Alert.cjs +42 -0
  72. package/dist/components/Alert/Alert.js +39 -0
  73. package/dist/components/Alert/index.cjs +5 -0
  74. package/dist/components/Alert/index.js +1 -0
  75. package/dist/components/Avatar/Avatar.cjs +101 -0
  76. package/dist/components/Avatar/Avatar.js +98 -0
  77. package/dist/components/Avatar/index.cjs +6 -0
  78. package/dist/components/Avatar/index.js +1 -0
  79. package/dist/components/Badge/Badge.cjs +53 -0
  80. package/dist/components/Badge/Badge.js +50 -0
  81. package/dist/components/Badge/index.cjs +5 -0
  82. package/dist/components/Badge/index.js +1 -0
  83. package/dist/components/Banner/Banner.cjs +83 -0
  84. package/dist/components/Banner/Banner.js +80 -0
  85. package/dist/components/Banner/index.cjs +5 -0
  86. package/dist/components/Banner/index.js +1 -0
  87. package/dist/components/Breadcrumb/Breadcrumb.cjs +31 -0
  88. package/dist/components/Breadcrumb/Breadcrumb.js +28 -0
  89. package/dist/components/Breadcrumb/index.cjs +5 -0
  90. package/dist/components/Breadcrumb/index.js +1 -0
  91. package/dist/components/Button/Button.cjs +88 -0
  92. package/dist/components/Button/Button.js +85 -0
  93. package/dist/components/Button/index.cjs +5 -0
  94. package/dist/components/Button/index.js +1 -0
  95. package/dist/components/ButtonGroup/ButtonGroup.cjs +8 -0
  96. package/dist/components/ButtonGroup/ButtonGroup.js +5 -0
  97. package/dist/components/ButtonGroup/ButtonGroupItem.cjs +15 -0
  98. package/dist/components/ButtonGroup/ButtonGroupItem.js +12 -0
  99. package/dist/components/ButtonGroup/index.cjs +7 -0
  100. package/dist/components/ButtonGroup/index.js +2 -0
  101. package/dist/components/Card/Card.cjs +94 -0
  102. package/dist/components/Card/Card.js +91 -0
  103. package/dist/components/Card/index.cjs +9 -0
  104. package/dist/components/Card/index.js +1 -0
  105. package/dist/components/Chart/Chart.cjs +160 -0
  106. package/dist/components/Chart/Chart.js +153 -0
  107. package/dist/components/Chart/index.cjs +10 -0
  108. package/dist/components/Chart/index.js +2 -0
  109. package/dist/components/Chart/theme.cjs +67 -0
  110. package/dist/components/Chart/theme.js +62 -0
  111. package/dist/components/Chip/Chip.cjs +18 -0
  112. package/dist/components/Chip/Chip.js +15 -0
  113. package/dist/components/Chip/index.cjs +5 -0
  114. package/dist/components/Chip/index.js +1 -0
  115. package/dist/components/Counter/Counter.cjs +74 -0
  116. package/dist/components/Counter/Counter.js +71 -0
  117. package/dist/components/Counter/index.cjs +6 -0
  118. package/dist/components/Counter/index.js +1 -0
  119. package/dist/components/DatePicker/DatePicker.cjs +343 -0
  120. package/dist/components/DatePicker/DatePicker.js +340 -0
  121. package/dist/components/DatePicker/index.cjs +5 -0
  122. package/dist/components/DatePicker/index.js +1 -0
  123. package/dist/components/Divider/Divider.cjs +31 -0
  124. package/dist/components/Divider/Divider.js +28 -0
  125. package/dist/components/Divider/index.cjs +5 -0
  126. package/dist/components/Divider/index.js +1 -0
  127. package/dist/components/DropdownMenu/DropdownMenu.cjs +108 -0
  128. package/dist/components/DropdownMenu/DropdownMenu.js +105 -0
  129. package/dist/components/DropdownMenu/index.cjs +11 -0
  130. package/dist/components/DropdownMenu/index.js +1 -0
  131. package/dist/components/EmptyStateIllustration/EmptyStateIllustration.cjs +42 -0
  132. package/dist/components/EmptyStateIllustration/EmptyStateIllustration.js +39 -0
  133. package/dist/components/EmptyStateIllustration/illustrations.cjs +3322 -0
  134. package/dist/components/EmptyStateIllustration/illustrations.js +3319 -0
  135. package/dist/components/EmptyStateIllustration/index.cjs +7 -0
  136. package/dist/components/EmptyStateIllustration/index.js +2 -0
  137. package/dist/components/FileUpload/FileUpload.cjs +116 -0
  138. package/dist/components/FileUpload/FileUpload.js +113 -0
  139. package/dist/components/FileUpload/FileUploadDropZone.cjs +58 -0
  140. package/dist/components/FileUpload/FileUploadDropZone.js +55 -0
  141. package/dist/components/FileUpload/FileUploadIcons.cjs +55 -0
  142. package/dist/components/FileUpload/FileUploadIcons.js +50 -0
  143. package/dist/components/FileUpload/FileUploadItem.cjs +34 -0
  144. package/dist/components/FileUpload/FileUploadItem.js +31 -0
  145. package/dist/components/FileUpload/index.cjs +9 -0
  146. package/dist/components/FileUpload/index.js +3 -0
  147. package/dist/components/FormControl/Checkbox.cjs +27 -0
  148. package/dist/components/FormControl/Checkbox.js +24 -0
  149. package/dist/components/FormControl/Radio.cjs +15 -0
  150. package/dist/components/FormControl/Radio.js +12 -0
  151. package/dist/components/FormControl/Toggle.cjs +15 -0
  152. package/dist/components/FormControl/Toggle.js +12 -0
  153. package/dist/components/FormControl/index.cjs +9 -0
  154. package/dist/components/FormControl/index.js +3 -0
  155. package/dist/components/Icon/Icon.cjs +70 -0
  156. package/dist/components/Icon/Icon.js +34 -0
  157. package/dist/components/Icon/catalog.cjs +1672 -0
  158. package/dist/components/Icon/catalog.js +1669 -0
  159. package/dist/components/Icon/icons.cjs +5621 -0
  160. package/dist/components/Icon/icons.js +5610 -0
  161. package/dist/components/Icon/index.cjs +8 -0
  162. package/dist/components/Icon/index.js +2 -0
  163. package/dist/components/Input/Input.cjs +64 -0
  164. package/dist/components/Input/Input.js +61 -0
  165. package/dist/components/Input/index.cjs +5 -0
  166. package/dist/components/Input/index.js +1 -0
  167. package/dist/components/MetricsCard/MetricsCard.cjs +107 -0
  168. package/dist/components/MetricsCard/MetricsCard.js +104 -0
  169. package/dist/components/MetricsCard/index.cjs +5 -0
  170. package/dist/components/MetricsCard/index.js +1 -0
  171. package/dist/components/Modal/Modal.cjs +126 -0
  172. package/dist/components/Modal/Modal.js +123 -0
  173. package/dist/components/Modal/index.cjs +5 -0
  174. package/dist/components/Modal/index.js +1 -0
  175. package/dist/components/Pagination/Pagination.cjs +42 -0
  176. package/dist/components/Pagination/Pagination.js +39 -0
  177. package/dist/components/Pagination/index.cjs +5 -0
  178. package/dist/components/Pagination/index.js +1 -0
  179. package/dist/components/ProgressBar/ProgressBar.cjs +34 -0
  180. package/dist/components/ProgressBar/ProgressBar.js +31 -0
  181. package/dist/components/ProgressBar/index.cjs +5 -0
  182. package/dist/components/ProgressBar/index.js +1 -0
  183. package/dist/components/ProgressCircle/ProgressCircle.cjs +34 -0
  184. package/dist/components/ProgressCircle/ProgressCircle.js +31 -0
  185. package/dist/components/ProgressCircle/index.cjs +5 -0
  186. package/dist/components/ProgressCircle/index.js +1 -0
  187. package/dist/components/Select/Select.cjs +84 -0
  188. package/dist/components/Select/Select.js +80 -0
  189. package/dist/components/Select/SelectOption.cjs +26 -0
  190. package/dist/components/Select/SelectOption.js +23 -0
  191. package/dist/components/Select/index.cjs +7 -0
  192. package/dist/components/Select/index.js +2 -0
  193. package/dist/components/SidebarMenu/SidebarMenu.cjs +85 -0
  194. package/dist/components/SidebarMenu/SidebarMenu.js +81 -0
  195. package/dist/components/SidebarMenu/SidebarMenuItem.cjs +126 -0
  196. package/dist/components/SidebarMenu/SidebarMenuItem.js +122 -0
  197. package/dist/components/SidebarMenu/SidebarMenuSection.cjs +14 -0
  198. package/dist/components/SidebarMenu/SidebarMenuSection.js +11 -0
  199. package/dist/components/SidebarMenu/index.cjs +12 -0
  200. package/dist/components/SidebarMenu/index.js +4 -0
  201. package/dist/components/Slider/Slider.cjs +161 -0
  202. package/dist/components/Slider/Slider.js +158 -0
  203. package/dist/components/Slider/index.cjs +6 -0
  204. package/dist/components/Slider/index.js +1 -0
  205. package/dist/components/Spinner/Spinner.cjs +93 -0
  206. package/dist/components/Spinner/Spinner.js +90 -0
  207. package/dist/components/Spinner/index.cjs +5 -0
  208. package/dist/components/Spinner/index.js +1 -0
  209. package/dist/components/Stepper/Stepper.cjs +82 -0
  210. package/dist/components/Stepper/Stepper.js +79 -0
  211. package/dist/components/Stepper/index.cjs +7 -0
  212. package/dist/components/Stepper/index.js +1 -0
  213. package/dist/components/Table/Table.cjs +25 -0
  214. package/dist/components/Table/Table.js +22 -0
  215. package/dist/components/Table/index.cjs +10 -0
  216. package/dist/components/Table/index.js +1 -0
  217. package/dist/components/Table/useTableSelection.cjs +60 -0
  218. package/dist/components/Table/useTableSelection.js +57 -0
  219. package/dist/components/Tabs/Tab.cjs +70 -0
  220. package/dist/components/Tabs/Tab.js +67 -0
  221. package/dist/components/Tabs/Tabs.cjs +133 -0
  222. package/dist/components/Tabs/Tabs.js +129 -0
  223. package/dist/components/Tabs/index.cjs +7 -0
  224. package/dist/components/Tabs/index.js +2 -0
  225. package/dist/components/Tooltip/Tooltip.cjs +101 -0
  226. package/dist/components/Tooltip/Tooltip.js +98 -0
  227. package/dist/components/Tooltip/index.cjs +5 -0
  228. package/dist/components/Tooltip/index.js +1 -0
  229. package/dist/context/ThemeContext.cjs +97 -0
  230. package/dist/context/ThemeContext.js +92 -0
  231. package/dist/fonts/README.md +13 -0
  232. package/dist/fonts/hanken-grotesk-cyrillic-ext-italic.woff2 +0 -0
  233. package/dist/fonts/hanken-grotesk-cyrillic-ext-normal.woff2 +0 -0
  234. package/dist/fonts/hanken-grotesk-latin-ext-italic.woff2 +0 -0
  235. package/dist/fonts/hanken-grotesk-latin-ext-normal.woff2 +0 -0
  236. package/dist/fonts/hanken-grotesk-latin-italic.woff2 +0 -0
  237. package/dist/fonts/hanken-grotesk-latin-normal.woff2 +0 -0
  238. package/dist/fonts/hanken-grotesk-vietnamese-italic.woff2 +0 -0
  239. package/dist/fonts/hanken-grotesk-vietnamese-normal.woff2 +0 -0
  240. package/dist/fonts/hankengrotesk-LICENSE.txt +94 -0
  241. package/dist/fonts/manrope-LICENSE.txt +93 -0
  242. package/dist/fonts/manrope-cyrillic-ext-normal.woff2 +0 -0
  243. package/dist/fonts/manrope-cyrillic-normal.woff2 +0 -0
  244. package/dist/fonts/manrope-greek-normal.woff2 +0 -0
  245. package/dist/fonts/manrope-latin-ext-normal.woff2 +0 -0
  246. package/dist/fonts/manrope-latin-normal.woff2 +0 -0
  247. package/dist/fonts/manrope-vietnamese-normal.woff2 +0 -0
  248. package/dist/fonts.css +148 -0
  249. package/dist/hooks/form/index.cjs +11 -0
  250. package/dist/hooks/form/index.js +3 -0
  251. package/dist/hooks/form/useRaydenFormControl.cjs +81 -0
  252. package/dist/hooks/form/useRaydenFormControl.js +76 -0
  253. package/dist/hooks/form/useRaydenInput.cjs +38 -0
  254. package/dist/hooks/form/useRaydenInput.js +35 -0
  255. package/dist/hooks/form/useRaydenSelect.cjs +45 -0
  256. package/dist/hooks/form/useRaydenSelect.js +42 -0
  257. package/dist/hooks/index.cjs +17 -0
  258. package/dist/hooks/index.js +1 -0
  259. package/dist/hooks/useBodyScrollLock.cjs +24 -0
  260. package/dist/hooks/useBodyScrollLock.js +21 -0
  261. package/dist/hooks/useCollisionAwareSide.cjs +72 -0
  262. package/dist/hooks/useCollisionAwareSide.js +69 -0
  263. package/dist/hooks/useControllableValue.cjs +16 -0
  264. package/dist/hooks/useControllableValue.js +13 -0
  265. package/dist/hooks/useDismissableLayer.cjs +100 -0
  266. package/dist/hooks/useDismissableLayer.js +97 -0
  267. package/dist/hooks/usePopupList.cjs +101 -0
  268. package/dist/hooks/usePopupList.js +98 -0
  269. package/dist/icons-8yD7I5jO.d.cts +430 -0
  270. package/dist/icons-8yD7I5jO.d.ts +430 -0
  271. package/dist/icons.cjs +2111 -418
  272. package/dist/icons.d.cts +1256 -429
  273. package/dist/icons.d.ts +1256 -429
  274. package/dist/icons.js +2089 -1
  275. package/dist/index.cjs +128 -15046
  276. package/dist/index.d.cts +697 -662
  277. package/dist/index.d.ts +697 -662
  278. package/dist/index.js +43 -14962
  279. package/dist/motion/Collapse.cjs +28 -0
  280. package/dist/motion/Collapse.js +25 -0
  281. package/dist/motion/MotionProvider.cjs +43 -0
  282. package/dist/motion/MotionProvider.js +38 -0
  283. package/dist/motion/Pressable.cjs +46 -0
  284. package/dist/motion/Pressable.js +43 -0
  285. package/dist/motion/Reveal.cjs +19 -0
  286. package/dist/motion/Reveal.js +16 -0
  287. package/dist/motion/SharedLayout.cjs +46 -0
  288. package/dist/motion/SharedLayout.js +43 -0
  289. package/dist/motion/index.cjs +19 -0
  290. package/dist/motion/index.js +6 -0
  291. package/dist/motion/presence.cjs +58 -0
  292. package/dist/motion/presence.js +55 -0
  293. package/dist/motion/presets.cjs +88 -0
  294. package/dist/motion/presets.js +84 -0
  295. package/dist/motion.d.cts +51 -0
  296. package/dist/motion.d.ts +51 -0
  297. package/dist/preset.cjs +356 -195
  298. package/dist/preset.d.cts +111 -32
  299. package/dist/preset.d.ts +111 -32
  300. package/dist/preset.js +353 -187
  301. package/dist/presets-Ba5QndHg.d.cts +144 -0
  302. package/dist/presets-Ba5QndHg.d.ts +144 -0
  303. package/dist/styles.css +1 -1
  304. package/dist/utils/cn.cjs +38 -0
  305. package/dist/utils/cn.js +35 -0
  306. package/dist/utils/resolveIcon.cjs +18 -0
  307. package/dist/utils/resolveIcon.js +15 -0
  308. package/package.json +79 -21
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.illustrationNames = exports.EmptyStateIllustration = void 0;
4
+ var EmptyStateIllustration_1 = require("./EmptyStateIllustration.cjs");
5
+ Object.defineProperty(exports, "EmptyStateIllustration", { enumerable: true, get: function () { return EmptyStateIllustration_1.EmptyStateIllustration; } });
6
+ var illustrations_1 = require("./illustrations.cjs");
7
+ Object.defineProperty(exports, "illustrationNames", { enumerable: true, get: function () { return illustrations_1.illustrationNames; } });
@@ -0,0 +1,2 @@
1
+ export { EmptyStateIllustration } from "./EmptyStateIllustration.js";
2
+ export { illustrationNames } from "./illustrations.js";
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FileUpload = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const cn_1 = require("../../utils/cn.cjs");
7
+ const Icon_1 = require("../Icon/index.cjs");
8
+ const Badge_1 = require("../Badge/index.cjs");
9
+ const FileUploadDropZone_1 = require("./FileUploadDropZone.cjs");
10
+ const FileUploadItem_1 = require("./FileUploadItem.cjs");
11
+ // ─── Component ───────────────────────────────────────────────────
12
+ exports.FileUpload = (0, react_1.forwardRef)(({ multiple = false, accept, maxSize, maxFiles, title = "Upload Documents", description, files, onFilesChange, onUpload, onError, disabled = false, onRemove, onRetry, onDownload, showHeader = false, onClose, className, ...rest }, ref) => {
13
+ const [rejections, setRejections] = (0, react_1.useState)([]);
14
+ const id = (0, react_1.useId)();
15
+ const sequence = (0, react_1.useRef)(0);
16
+ // Derive drop zone state for single-file mode
17
+ const deriveDropZoneState = () => {
18
+ if (!multiple && files.length > 0) {
19
+ const file = files[0];
20
+ if (file?.status === "uploading")
21
+ return "uploading";
22
+ if (file?.status === "complete")
23
+ return "success";
24
+ if (file?.status === "error")
25
+ return "error";
26
+ }
27
+ return "default";
28
+ };
29
+ const dropZoneState = deriveDropZoneState();
30
+ // Get uploading file info for drop zone
31
+ const uploadingFile = !multiple && files.length > 0 && files[0]?.status === "uploading"
32
+ ? {
33
+ name: files[0].name,
34
+ type: files[0].type,
35
+ progress: files[0].progress ?? 0,
36
+ }
37
+ : undefined;
38
+ const errorMessage = !multiple && files.length > 0 && files[0]?.status === "error" ? files[0].error : undefined;
39
+ const handleFilesSelected = (0, react_1.useCallback)((fileList) => {
40
+ if (disabled)
41
+ return;
42
+ const errors = [];
43
+ const accepted = [];
44
+ const types = accept
45
+ ?.split(",")
46
+ .map((type) => type.trim().toLowerCase())
47
+ .filter(Boolean) ?? [];
48
+ const capacity = multiple
49
+ ? Math.max(0, (maxFiles ?? Infinity) - files.length)
50
+ : Math.min(1, maxFiles ?? 1);
51
+ for (const file of Array.from(fileList)) {
52
+ let reason = "";
53
+ if (types.length &&
54
+ !types.some((type) => type.startsWith(".")
55
+ ? file.name.toLowerCase().endsWith(type)
56
+ : type.endsWith("/*")
57
+ ? file.type.toLowerCase().startsWith(type.slice(0, -1))
58
+ : file.type.toLowerCase() === type)) {
59
+ reason = `Choose a supported file type (${accept}).`;
60
+ }
61
+ else if (maxSize !== undefined && file.size > maxSize) {
62
+ const limit = maxSize < 1024 ? `${maxSize} byte` : `${Math.round(maxSize / 1024)} KB`;
63
+ reason = `File exceeds the ${limit} size limit.`;
64
+ }
65
+ else if (accepted.length >= capacity) {
66
+ reason = `You can select ${multiple ? (maxFiles ?? "no more") : 1} ${multiple ? "files" : "file"}. Remove a file before adding another.`;
67
+ }
68
+ if (reason) {
69
+ errors.push(`${file.name}: ${reason}`);
70
+ continue;
71
+ }
72
+ accepted.push({
73
+ file,
74
+ item: {
75
+ id: `${id}-${++sequence.current}`,
76
+ name: file.name,
77
+ size: file.size,
78
+ type: file.type,
79
+ status: "pending",
80
+ },
81
+ });
82
+ }
83
+ setRejections(errors);
84
+ errors.forEach((message) => onError?.(message));
85
+ if (!accepted.length)
86
+ return;
87
+ onFilesChange(multiple
88
+ ? [...files, ...accepted.map(({ item }) => item)]
89
+ : accepted.map(({ item }) => item));
90
+ accepted.forEach(({ file, item }) => onUpload?.(file, item));
91
+ }, [disabled, accept, multiple, maxFiles, maxSize, files, id, onFilesChange, onUpload, onError]);
92
+ const removeFile = (fileId) => {
93
+ onFilesChange(files.filter((file) => file.id !== fileId));
94
+ onRemove?.(fileId);
95
+ };
96
+ const handleClear = (0, react_1.useCallback)(() => {
97
+ if (!multiple && files.length > 0) {
98
+ onFilesChange([]);
99
+ onRemove?.(files[0].id);
100
+ }
101
+ }, [multiple, files, onRemove, onFilesChange]);
102
+ const handleRetry = (0, react_1.useCallback)(() => {
103
+ if (!multiple && files.length > 0) {
104
+ onRetry?.(files[0].id);
105
+ }
106
+ }, [multiple, files, onRetry]);
107
+ // In multiple mode, separate completed/in-progress files for display
108
+ const completedFiles = multiple
109
+ ? files.filter((f) => f.status === "complete" || f.status === "error")
110
+ : [];
111
+ const activeFiles = multiple
112
+ ? files.filter((f) => f.status === "uploading" || f.status === "pending")
113
+ : [];
114
+ return ((0, jsx_runtime_1.jsxs)("div", { ref: ref, className: (0, cn_1.cn)("flex flex-col gap-7 rounded-[10px] bg-surface p-4 sm:p-8 shadow-soft-xs", className), ...rest, children: [showHeader && ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-body-lg font-semibold text-grey-800", children: title }), onClose && ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: onClose, className: "flex size-7 items-center justify-center rounded-md text-on-surface-muted hover:bg-grey-100 cursor-pointer", "aria-label": "Close", children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: "multiply", size: "md" }) }))] })), (0, jsx_runtime_1.jsx)(FileUploadDropZone_1.FileUploadDropZone, { state: dropZoneState, description: description, accept: accept, multiple: multiple, disabled: disabled, uploadingFile: uploadingFile, errorMessage: errorMessage, onFilesSelected: handleFilesSelected, onClear: handleClear, onRetry: handleRetry }), rejections.length > 0 && ((0, jsx_runtime_1.jsx)("div", { role: "alert", className: "space-y-1 text-sm text-feedback-error", children: rejections.map((message) => ((0, jsx_runtime_1.jsx)("p", { children: message }, message))) })), !multiple && files[0]?.status === "pending" && ((0, jsx_runtime_1.jsx)(FileUploadItem_1.FileUploadItem, { file: files[0], onRemove: removeFile })), multiple && activeFiles.length > 0 && ((0, jsx_runtime_1.jsx)("div", { className: "flex flex-col", children: activeFiles.map((file) => ((0, jsx_runtime_1.jsx)(FileUploadItem_1.FileUploadItem, { file: file, onRemove: removeFile, onRetry: onRetry, onDownload: onDownload }, file.id))) })), multiple && completedFiles.length > 0 && ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-body-md font-medium text-grey-800", children: "Uploaded Files" }), (0, jsx_runtime_1.jsx)(Badge_1.Badge, { color: "orange", type: "filled", size: "sm", children: completedFiles.length })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex flex-col", children: completedFiles.map((file) => ((0, jsx_runtime_1.jsx)(FileUploadItem_1.FileUploadItem, { file: file, onRemove: removeFile, onRetry: onRetry, onDownload: onDownload }, file.id))) })] }))] }));
115
+ });
116
+ exports.FileUpload.displayName = "FileUpload";
@@ -0,0 +1,113 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef, useCallback, useId, useRef, useState } from "react";
3
+ import { cn } from "../../utils/cn.js";
4
+ import { Icon } from "../Icon/index.js";
5
+ import { Badge } from "../Badge/index.js";
6
+ import { FileUploadDropZone } from "./FileUploadDropZone.js";
7
+ import { FileUploadItem } from "./FileUploadItem.js";
8
+ // ─── Component ───────────────────────────────────────────────────
9
+ export const FileUpload = forwardRef(({ multiple = false, accept, maxSize, maxFiles, title = "Upload Documents", description, files, onFilesChange, onUpload, onError, disabled = false, onRemove, onRetry, onDownload, showHeader = false, onClose, className, ...rest }, ref) => {
10
+ const [rejections, setRejections] = useState([]);
11
+ const id = useId();
12
+ const sequence = useRef(0);
13
+ // Derive drop zone state for single-file mode
14
+ const deriveDropZoneState = () => {
15
+ if (!multiple && files.length > 0) {
16
+ const file = files[0];
17
+ if (file?.status === "uploading")
18
+ return "uploading";
19
+ if (file?.status === "complete")
20
+ return "success";
21
+ if (file?.status === "error")
22
+ return "error";
23
+ }
24
+ return "default";
25
+ };
26
+ const dropZoneState = deriveDropZoneState();
27
+ // Get uploading file info for drop zone
28
+ const uploadingFile = !multiple && files.length > 0 && files[0]?.status === "uploading"
29
+ ? {
30
+ name: files[0].name,
31
+ type: files[0].type,
32
+ progress: files[0].progress ?? 0,
33
+ }
34
+ : undefined;
35
+ const errorMessage = !multiple && files.length > 0 && files[0]?.status === "error" ? files[0].error : undefined;
36
+ const handleFilesSelected = useCallback((fileList) => {
37
+ if (disabled)
38
+ return;
39
+ const errors = [];
40
+ const accepted = [];
41
+ const types = accept
42
+ ?.split(",")
43
+ .map((type) => type.trim().toLowerCase())
44
+ .filter(Boolean) ?? [];
45
+ const capacity = multiple
46
+ ? Math.max(0, (maxFiles ?? Infinity) - files.length)
47
+ : Math.min(1, maxFiles ?? 1);
48
+ for (const file of Array.from(fileList)) {
49
+ let reason = "";
50
+ if (types.length &&
51
+ !types.some((type) => type.startsWith(".")
52
+ ? file.name.toLowerCase().endsWith(type)
53
+ : type.endsWith("/*")
54
+ ? file.type.toLowerCase().startsWith(type.slice(0, -1))
55
+ : file.type.toLowerCase() === type)) {
56
+ reason = `Choose a supported file type (${accept}).`;
57
+ }
58
+ else if (maxSize !== undefined && file.size > maxSize) {
59
+ const limit = maxSize < 1024 ? `${maxSize} byte` : `${Math.round(maxSize / 1024)} KB`;
60
+ reason = `File exceeds the ${limit} size limit.`;
61
+ }
62
+ else if (accepted.length >= capacity) {
63
+ reason = `You can select ${multiple ? (maxFiles ?? "no more") : 1} ${multiple ? "files" : "file"}. Remove a file before adding another.`;
64
+ }
65
+ if (reason) {
66
+ errors.push(`${file.name}: ${reason}`);
67
+ continue;
68
+ }
69
+ accepted.push({
70
+ file,
71
+ item: {
72
+ id: `${id}-${++sequence.current}`,
73
+ name: file.name,
74
+ size: file.size,
75
+ type: file.type,
76
+ status: "pending",
77
+ },
78
+ });
79
+ }
80
+ setRejections(errors);
81
+ errors.forEach((message) => onError?.(message));
82
+ if (!accepted.length)
83
+ return;
84
+ onFilesChange(multiple
85
+ ? [...files, ...accepted.map(({ item }) => item)]
86
+ : accepted.map(({ item }) => item));
87
+ accepted.forEach(({ file, item }) => onUpload?.(file, item));
88
+ }, [disabled, accept, multiple, maxFiles, maxSize, files, id, onFilesChange, onUpload, onError]);
89
+ const removeFile = (fileId) => {
90
+ onFilesChange(files.filter((file) => file.id !== fileId));
91
+ onRemove?.(fileId);
92
+ };
93
+ const handleClear = useCallback(() => {
94
+ if (!multiple && files.length > 0) {
95
+ onFilesChange([]);
96
+ onRemove?.(files[0].id);
97
+ }
98
+ }, [multiple, files, onRemove, onFilesChange]);
99
+ const handleRetry = useCallback(() => {
100
+ if (!multiple && files.length > 0) {
101
+ onRetry?.(files[0].id);
102
+ }
103
+ }, [multiple, files, onRetry]);
104
+ // In multiple mode, separate completed/in-progress files for display
105
+ const completedFiles = multiple
106
+ ? files.filter((f) => f.status === "complete" || f.status === "error")
107
+ : [];
108
+ const activeFiles = multiple
109
+ ? files.filter((f) => f.status === "uploading" || f.status === "pending")
110
+ : [];
111
+ return (_jsxs("div", { ref: ref, className: cn("flex flex-col gap-7 rounded-[10px] bg-surface p-4 sm:p-8 shadow-soft-xs", className), ...rest, children: [showHeader && (_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("h3", { className: "text-body-lg font-semibold text-grey-800", children: title }), onClose && (_jsx("button", { type: "button", onClick: onClose, className: "flex size-7 items-center justify-center rounded-md text-on-surface-muted hover:bg-grey-100 cursor-pointer", "aria-label": "Close", children: _jsx(Icon, { name: "multiply", size: "md" }) }))] })), _jsx(FileUploadDropZone, { state: dropZoneState, description: description, accept: accept, multiple: multiple, disabled: disabled, uploadingFile: uploadingFile, errorMessage: errorMessage, onFilesSelected: handleFilesSelected, onClear: handleClear, onRetry: handleRetry }), rejections.length > 0 && (_jsx("div", { role: "alert", className: "space-y-1 text-sm text-feedback-error", children: rejections.map((message) => (_jsx("p", { children: message }, message))) })), !multiple && files[0]?.status === "pending" && (_jsx(FileUploadItem, { file: files[0], onRemove: removeFile })), multiple && activeFiles.length > 0 && (_jsx("div", { className: "flex flex-col", children: activeFiles.map((file) => (_jsx(FileUploadItem, { file: file, onRemove: removeFile, onRetry: onRetry, onDownload: onDownload }, file.id))) })), multiple && completedFiles.length > 0 && (_jsxs("div", { className: "flex flex-col gap-4", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-body-md font-medium text-grey-800", children: "Uploaded Files" }), _jsx(Badge, { color: "orange", type: "filled", size: "sm", children: completedFiles.length })] }), _jsx("div", { className: "flex flex-col", children: completedFiles.map((file) => (_jsx(FileUploadItem, { file: file, onRemove: removeFile, onRetry: onRetry, onDownload: onDownload }, file.id))) })] }))] }));
112
+ });
113
+ FileUpload.displayName = "FileUpload";
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FileUploadDropZone = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const cn_1 = require("../../utils/cn.cjs");
7
+ const Button_1 = require("../Button/index.cjs");
8
+ const ProgressBar_1 = require("../ProgressBar/index.cjs");
9
+ const FileUploadIcons_1 = require("./FileUploadIcons.cjs");
10
+ // ─── Component ───────────────────────────────────────────────────
11
+ exports.FileUploadDropZone = (0, react_1.forwardRef)(({ state: controlledState, description, accept, multiple = false, disabled = false, uploadingFile, errorMessage, onFilesSelected, onClear, onRetry, className, ...rest }, ref) => {
12
+ const inputRef = (0, react_1.useRef)(null);
13
+ const [dragCounter, setDragCounter] = (0, react_1.useState)(0);
14
+ // Derive state: if dragging and state is default, show dragging
15
+ const isDragging = dragCounter > 0;
16
+ const state = isDragging && (controlledState === "default" || !controlledState)
17
+ ? "dragging"
18
+ : (controlledState ?? "default");
19
+ const handleBrowse = () => {
20
+ if (!disabled)
21
+ inputRef.current?.click();
22
+ };
23
+ const handleFileChange = (e) => {
24
+ if (e.target.files && e.target.files.length > 0) {
25
+ onFilesSelected?.(e.target.files);
26
+ // Reset the input so the same file can be re-selected
27
+ e.target.value = "";
28
+ }
29
+ };
30
+ const handleDragEnter = (0, react_1.useCallback)((e) => {
31
+ e.preventDefault();
32
+ e.stopPropagation();
33
+ setDragCounter((c) => c + 1);
34
+ }, []);
35
+ const handleDragLeave = (0, react_1.useCallback)((e) => {
36
+ e.preventDefault();
37
+ e.stopPropagation();
38
+ setDragCounter((c) => c - 1);
39
+ }, []);
40
+ const handleDragOver = (0, react_1.useCallback)((e) => {
41
+ e.preventDefault();
42
+ e.stopPropagation();
43
+ }, []);
44
+ const handleDrop = (0, react_1.useCallback)((e) => {
45
+ e.preventDefault();
46
+ e.stopPropagation();
47
+ setDragCounter(0);
48
+ if (!disabled && e.dataTransfer.files && e.dataTransfer.files.length > 0) {
49
+ onFilesSelected?.(e.dataTransfer.files);
50
+ }
51
+ }, [onFilesSelected, disabled]);
52
+ return ((0, jsx_runtime_1.jsxs)("div", { ref: ref, role: "region", "aria-label": "File upload dropzone", className: (0, cn_1.cn)("flex flex-col items-center justify-center rounded-xl p-4 sm:p-8 transition-colors", state === "dragging"
53
+ ? "border-2 border-dashed border-primary-400 bg-primary-50/10"
54
+ : state === "uploading" || state === "success" || state === "error"
55
+ ? "border border-grey-200 bg-surface"
56
+ : "border-2 border-dashed border-control-border bg-surface", className), onDragEnter: handleDragEnter, onDragLeave: handleDragLeave, onDragOver: handleDragOver, onDrop: handleDrop, ...rest, children: [(0, jsx_runtime_1.jsx)("input", { ref: inputRef, type: "file", accept: accept, multiple: multiple, disabled: disabled, onChange: handleFileChange, className: "sr-only", tabIndex: -1, "aria-label": multiple ? "Choose files to upload" : "Choose file to upload" }), (state === "default" || state === "dragging") && ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center gap-4", children: [(0, jsx_runtime_1.jsx)(FileUploadIcons_1.UploadStateIcon, { state: "default", size: 56, "aria-hidden": "true" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center gap-1", children: [(0, jsx_runtime_1.jsxs)("p", { className: "text-body-sm font-medium text-on-surface-secondary", children: ["Click to upload ", (0, jsx_runtime_1.jsx)("span", { className: "text-on-surface-secondary", children: "or drag and drop" })] }), description && ((0, jsx_runtime_1.jsx)("p", { className: "text-body-xs text-on-surface-secondary", children: description }))] }), (0, jsx_runtime_1.jsx)(Button_1.Button, { type: "button", disabled: disabled, variant: "primary", size: "sm", onClick: handleBrowse, children: "Browse Files" })] })), state === "uploading" && uploadingFile && ((0, jsx_runtime_1.jsxs)("div", { className: "flex w-full flex-col items-center gap-4", "aria-live": "polite", "aria-atomic": "true", children: [(0, jsx_runtime_1.jsx)(FileUploadIcons_1.FileTypeIcon, { type: (0, FileUploadIcons_1.getFileType)(uploadingFile.name), "aria-hidden": "true" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full max-w-xs flex-col gap-2", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-body-sm font-medium text-on-surface-body truncate", children: uploadingFile.name }), (0, jsx_runtime_1.jsxs)("span", { className: "text-body-xs font-medium text-on-surface-muted ml-2 shrink-0", "aria-label": `Upload progress: ${Math.round(uploadingFile.progress)} percent`, children: [Math.round(uploadingFile.progress), "%"] })] }), (0, jsx_runtime_1.jsx)(ProgressBar_1.ProgressBar, { value: uploadingFile.progress, size: "sm", showPercentage: false, "aria-label": `Uploading ${uploadingFile.name}` })] })] })), state === "success" && ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center gap-4", role: "status", children: [(0, jsx_runtime_1.jsx)(FileUploadIcons_1.UploadStateIcon, { state: "success", size: 56, "aria-hidden": "true" }), (0, jsx_runtime_1.jsx)("div", { className: "flex flex-col items-center gap-1", children: (0, jsx_runtime_1.jsx)("p", { className: "text-body-sm font-semibold text-grey-800", children: "Document Uploaded Successfully" }) }), (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: onClear, className: "text-body-xs font-semibold text-primary-500 cursor-pointer hover:text-primary-400", children: "Clear Upload" })] })), state === "error" && ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center gap-4", role: "alert", children: [(0, jsx_runtime_1.jsx)(FileUploadIcons_1.UploadStateIcon, { state: "error", size: 56, "aria-hidden": "true" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center gap-1", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-body-sm font-semibold text-grey-800", children: "Failed to Upload" }), errorMessage && ((0, jsx_runtime_1.jsx)("p", { className: "text-body-xs text-on-surface-secondary", children: errorMessage }))] }), (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: onRetry, className: "text-body-xs font-semibold text-primary-500 cursor-pointer hover:text-primary-400", children: "Try Again" })] }))] }));
57
+ });
58
+ exports.FileUploadDropZone.displayName = "FileUploadDropZone";
@@ -0,0 +1,55 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef, useRef, useState, useCallback } from "react";
3
+ import { cn } from "../../utils/cn.js";
4
+ import { Button } from "../Button/index.js";
5
+ import { ProgressBar } from "../ProgressBar/index.js";
6
+ import { FileTypeIcon, UploadStateIcon, getFileType } from "./FileUploadIcons.js";
7
+ // ─── Component ───────────────────────────────────────────────────
8
+ export const FileUploadDropZone = forwardRef(({ state: controlledState, description, accept, multiple = false, disabled = false, uploadingFile, errorMessage, onFilesSelected, onClear, onRetry, className, ...rest }, ref) => {
9
+ const inputRef = useRef(null);
10
+ const [dragCounter, setDragCounter] = useState(0);
11
+ // Derive state: if dragging and state is default, show dragging
12
+ const isDragging = dragCounter > 0;
13
+ const state = isDragging && (controlledState === "default" || !controlledState)
14
+ ? "dragging"
15
+ : (controlledState ?? "default");
16
+ const handleBrowse = () => {
17
+ if (!disabled)
18
+ inputRef.current?.click();
19
+ };
20
+ const handleFileChange = (e) => {
21
+ if (e.target.files && e.target.files.length > 0) {
22
+ onFilesSelected?.(e.target.files);
23
+ // Reset the input so the same file can be re-selected
24
+ e.target.value = "";
25
+ }
26
+ };
27
+ const handleDragEnter = useCallback((e) => {
28
+ e.preventDefault();
29
+ e.stopPropagation();
30
+ setDragCounter((c) => c + 1);
31
+ }, []);
32
+ const handleDragLeave = useCallback((e) => {
33
+ e.preventDefault();
34
+ e.stopPropagation();
35
+ setDragCounter((c) => c - 1);
36
+ }, []);
37
+ const handleDragOver = useCallback((e) => {
38
+ e.preventDefault();
39
+ e.stopPropagation();
40
+ }, []);
41
+ const handleDrop = useCallback((e) => {
42
+ e.preventDefault();
43
+ e.stopPropagation();
44
+ setDragCounter(0);
45
+ if (!disabled && e.dataTransfer.files && e.dataTransfer.files.length > 0) {
46
+ onFilesSelected?.(e.dataTransfer.files);
47
+ }
48
+ }, [onFilesSelected, disabled]);
49
+ return (_jsxs("div", { ref: ref, role: "region", "aria-label": "File upload dropzone", className: cn("flex flex-col items-center justify-center rounded-xl p-4 sm:p-8 transition-colors", state === "dragging"
50
+ ? "border-2 border-dashed border-primary-400 bg-primary-50/10"
51
+ : state === "uploading" || state === "success" || state === "error"
52
+ ? "border border-grey-200 bg-surface"
53
+ : "border-2 border-dashed border-control-border bg-surface", className), onDragEnter: handleDragEnter, onDragLeave: handleDragLeave, onDragOver: handleDragOver, onDrop: handleDrop, ...rest, children: [_jsx("input", { ref: inputRef, type: "file", accept: accept, multiple: multiple, disabled: disabled, onChange: handleFileChange, className: "sr-only", tabIndex: -1, "aria-label": multiple ? "Choose files to upload" : "Choose file to upload" }), (state === "default" || state === "dragging") && (_jsxs("div", { className: "flex flex-col items-center gap-4", children: [_jsx(UploadStateIcon, { state: "default", size: 56, "aria-hidden": "true" }), _jsxs("div", { className: "flex flex-col items-center gap-1", children: [_jsxs("p", { className: "text-body-sm font-medium text-on-surface-secondary", children: ["Click to upload ", _jsx("span", { className: "text-on-surface-secondary", children: "or drag and drop" })] }), description && (_jsx("p", { className: "text-body-xs text-on-surface-secondary", children: description }))] }), _jsx(Button, { type: "button", disabled: disabled, variant: "primary", size: "sm", onClick: handleBrowse, children: "Browse Files" })] })), state === "uploading" && uploadingFile && (_jsxs("div", { className: "flex w-full flex-col items-center gap-4", "aria-live": "polite", "aria-atomic": "true", children: [_jsx(FileTypeIcon, { type: getFileType(uploadingFile.name), "aria-hidden": "true" }), _jsxs("div", { className: "flex w-full max-w-xs flex-col gap-2", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "text-body-sm font-medium text-on-surface-body truncate", children: uploadingFile.name }), _jsxs("span", { className: "text-body-xs font-medium text-on-surface-muted ml-2 shrink-0", "aria-label": `Upload progress: ${Math.round(uploadingFile.progress)} percent`, children: [Math.round(uploadingFile.progress), "%"] })] }), _jsx(ProgressBar, { value: uploadingFile.progress, size: "sm", showPercentage: false, "aria-label": `Uploading ${uploadingFile.name}` })] })] })), state === "success" && (_jsxs("div", { className: "flex flex-col items-center gap-4", role: "status", children: [_jsx(UploadStateIcon, { state: "success", size: 56, "aria-hidden": "true" }), _jsx("div", { className: "flex flex-col items-center gap-1", children: _jsx("p", { className: "text-body-sm font-semibold text-grey-800", children: "Document Uploaded Successfully" }) }), _jsx("button", { type: "button", onClick: onClear, className: "text-body-xs font-semibold text-primary-500 cursor-pointer hover:text-primary-400", children: "Clear Upload" })] })), state === "error" && (_jsxs("div", { className: "flex flex-col items-center gap-4", role: "alert", children: [_jsx(UploadStateIcon, { state: "error", size: 56, "aria-hidden": "true" }), _jsxs("div", { className: "flex flex-col items-center gap-1", children: [_jsx("p", { className: "text-body-sm font-semibold text-grey-800", children: "Failed to Upload" }), errorMessage && (_jsx("p", { className: "text-body-xs text-on-surface-secondary", children: errorMessage }))] }), _jsx("button", { type: "button", onClick: onRetry, className: "text-body-xs font-semibold text-primary-500 cursor-pointer hover:text-primary-400", children: "Try Again" })] }))] }));
54
+ });
55
+ FileUploadDropZone.displayName = "FileUploadDropZone";
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FileTypeIcon = FileTypeIcon;
4
+ exports.UploadStateIcon = UploadStateIcon;
5
+ exports.getFileType = getFileType;
6
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const cn_1 = require("../../utils/cn.cjs");
8
+ // ─── SVG Data ────────────────────────────────────────────────────
9
+ // File type SVGs (24×24) from icon-assets/filetypes/
10
+ // Each is a document icon with a colored label bar in the lower half.
11
+ const fileTypeSvgs = {
12
+ pdf: `<path fill-rule="evenodd" clip-rule="evenodd" d="M3 0C2.44772 0 2 0.447716 2 1V23C2 23.5523 2.44772 24 3 24H21C21.5523 24 22 23.5523 22 23V4L18 0H3Z" fill="#E4E7EC"/><path fill-rule="evenodd" clip-rule="evenodd" d="M18 0V4H22L18 0Z" fill="#98A2B3"/><rect x="1" y="10" width="22" height="10" rx="1" fill="#CC400C"/><path d="M4.6637 17.9091V12.0909H6.84551C7.29248 12.0909 7.66748 12.1742 7.97051 12.3409C8.27544 12.5075 8.50555 12.7367 8.66086 13.0284C8.81805 13.3182 8.89665 13.6477 8.89665 14.017C8.89665 14.3901 8.81805 14.7216 8.66086 15.0113C8.50366 15.3011 8.27165 15.5293 7.96483 15.696C7.65801 15.8608 7.28017 15.9432 6.83131 15.9432H5.38529V15.0767H6.68926C6.95063 15.0767 7.16464 15.0312 7.33131 14.9403C7.49798 14.8494 7.62108 14.7244 7.70063 14.5653C7.78207 14.4062 7.82279 14.2235 7.82279 14.017C7.82279 13.8106 7.78207 13.6288 7.70063 13.4716C7.62108 13.3144 7.49703 13.1922 7.32847 13.1051C7.1618 13.0161 6.94684 12.9716 6.68358 12.9716H5.71767V17.9091H4.6637Z" fill="white"/><path d="M11.7837 17.9091H9.81213V12.0909H11.8235C12.4011 12.0909 12.8974 12.2074 13.3121 12.4403C13.7288 12.6714 14.0489 13.0038 14.2724 13.4375C14.4958 13.8712 14.6076 14.3901 14.6076 14.9943C14.6076 15.6004 14.4949 16.1212 14.2695 16.5568C14.046 16.9924 13.7231 17.3267 13.3008 17.5596C12.8803 17.7926 12.3746 17.9091 11.7837 17.9091ZM10.8661 16.9971H11.7326C12.1379 16.9971 12.476 16.9233 12.7468 16.7755C13.0176 16.6259 13.2212 16.4034 13.3576 16.1079C13.494 15.8106 13.5621 15.4394 13.5621 14.9943C13.5621 14.5492 13.494 14.1799 13.3576 13.8863C13.2212 13.5909 13.0195 13.3702 12.7525 13.2244C12.4873 13.0767 12.1578 13.0028 11.7638 13.0028H10.8661V16.9971Z" fill="white"/><path d="M15.609 17.9091V12.0909H19.3363V12.9744H16.663V14.5539H19.0806V15.4375H16.663V17.9091H15.609Z" fill="white"/>`,
13
+ png: `<path fill-rule="evenodd" clip-rule="evenodd" d="M3 0C2.44772 0 2 0.447716 2 1V23C2 23.5523 2.44772 24 3 24H21C21.5523 24 22 23.5523 22 23V4L18 0H3Z" fill="#E4E7EC"/><path fill-rule="evenodd" clip-rule="evenodd" d="M18 0V4H22L18 0Z" fill="#98A2B3"/><rect x="1" y="10" width="22" height="10" rx="1" fill="#1671D9"/><path d="M4.01527 18V12.1818H6.19709C6.64406 12.1818 7.01906 12.2652 7.32209 12.4318C7.62701 12.5985 7.85713 12.8277 8.01243 13.1193C8.16963 13.4091 8.24822 13.7386 8.24822 14.108C8.24822 14.4811 8.16963 14.8125 8.01243 15.1023C7.85523 15.392 7.62322 15.6203 7.31641 15.7869C7.00959 15.9517 6.63175 16.0341 6.18288 16.0341H4.73686V15.1676H6.04084C6.3022 15.1676 6.51622 15.1222 6.68288 15.0312C6.84955 14.9403 6.97266 14.8153 7.0522 14.6562C7.13364 14.4972 7.17436 14.3144 7.17436 14.108C7.17436 13.9015 7.13364 13.7197 7.0522 13.5625C6.97266 13.4053 6.8486 13.2831 6.68004 13.196C6.51338 13.107 6.29841 13.0625 6.03516 13.0625H5.06925V18H4.01527ZM13.945 12.1818V18H13.0075L10.266 14.0369H10.2177V18H9.16371V12.1818H10.1069L12.8455 16.1477H12.8967V12.1818H13.945ZM18.9911 14.0398C18.9438 13.8864 18.8784 13.7491 18.7951 13.6278C18.7137 13.5047 18.6152 13.3996 18.4996 13.3125C18.386 13.2254 18.2553 13.16 18.1076 13.1165C17.9599 13.071 17.7989 13.0483 17.6246 13.0483C17.3121 13.0483 17.0337 13.1269 16.7894 13.2841C16.5451 13.4413 16.3529 13.6723 16.2127 13.9773C16.0745 14.2803 16.0053 14.6496 16.0053 15.0852C16.0053 15.5246 16.0745 15.8968 16.2127 16.2017C16.351 16.5066 16.5432 16.7386 16.7894 16.8977C17.0356 17.0549 17.3216 17.1335 17.6474 17.1335C17.9428 17.1335 18.1985 17.0767 18.4144 16.9631C18.6322 16.8494 18.7998 16.6884 18.9173 16.4801C19.0347 16.2699 19.0934 16.0237 19.0934 15.7415L19.332 15.7784H17.7525V14.9545H20.1133V15.6534C20.1133 16.1515 20.0072 16.5824 19.7951 16.946C19.583 17.3097 19.2913 17.59 18.9201 17.7869C18.5489 17.982 18.1228 18.0795 17.6417 18.0795C17.1057 18.0795 16.6351 17.9593 16.2298 17.7188C15.8263 17.4763 15.511 17.1326 15.2837 16.6875C15.0584 16.2405 14.9457 15.7102 14.9457 15.0966C14.9457 14.6269 15.012 14.2074 15.1445 13.8381C15.279 13.4688 15.4665 13.1553 15.707 12.8977C15.9476 12.6383 16.2298 12.4413 16.5536 12.3068C16.8775 12.1705 17.2298 12.1023 17.6104 12.1023C17.9324 12.1023 18.2326 12.1496 18.511 12.2443C18.7894 12.3371 19.0366 12.4697 19.2525 12.642C19.4703 12.8144 19.6493 13.0189 19.7894 13.2557C19.9296 13.4924 20.0214 13.7538 20.065 14.0398H18.9911Z" fill="white"/>`,
14
+ jpg: `<path fill-rule="evenodd" clip-rule="evenodd" d="M3 0C2.44772 0 2 0.447716 2 1V23C2 23.5523 2.44772 24 3 24H21C21.5523 24 22 23.5523 22 23V4L18 0H3Z" fill="#E4E7EC"/><path fill-rule="evenodd" clip-rule="evenodd" d="M18 0V4H22L18 0Z" fill="#98A2B3"/><rect x="1" y="10" width="22" height="10" rx="1" fill="#C548F1"/><path d="M7.03338 12.1818H8.07884V16.2727C8.07694 16.6477 7.9974 16.9706 7.8402 17.2415C7.683 17.5104 7.4633 17.7178 7.18111 17.8636C6.9008 18.0076 6.5741 18.0795 6.20099 18.0795C5.86009 18.0795 5.55327 18.0189 5.28054 17.8977C5.00971 17.7746 4.79474 17.5928 4.63565 17.3523C4.47656 17.1117 4.39702 16.8125 4.39702 16.4545H5.44531C5.44721 16.6117 5.4813 16.7472 5.54759 16.8608C5.61577 16.9744 5.70952 17.0616 5.82884 17.1222C5.94815 17.1828 6.08546 17.2131 6.24077 17.2131C6.40933 17.2131 6.55232 17.178 6.66974 17.108C6.78717 17.036 6.87618 16.9299 6.93679 16.7898C6.99929 16.6496 7.03149 16.4773 7.03338 16.2727V12.1818ZM9.2223 18V12.1818H11.4041C11.8511 12.1818 12.2261 12.2652 12.5291 12.4318C12.834 12.5985 13.0642 12.8277 13.2195 13.1193C13.3767 13.4091 13.4553 13.7386 13.4553 14.108C13.4553 14.4811 13.3767 14.8125 13.2195 15.1023C13.0623 15.392 12.8303 15.6203 12.5234 15.7869C12.2166 15.9517 11.8388 16.0341 11.3899 16.0341H9.94389V15.1676H11.2479C11.5092 15.1676 11.7232 15.1222 11.8899 15.0312C12.0566 14.9403 12.1797 14.8153 12.2592 14.6562C12.3407 14.4972 12.3814 14.3144 12.3814 14.108C12.3814 13.9015 12.3407 13.7197 12.2592 13.5625C12.1797 13.4053 12.0556 13.2831 11.8871 13.196C11.7204 13.107 11.5054 13.0625 11.2422 13.0625H10.2763V18H9.2223ZM18.2685 14.0398C18.2211 13.8864 18.1558 13.7491 18.0724 13.6278C17.991 13.5047 17.8925 13.3996 17.777 13.3125C17.6634 13.2254 17.5327 13.16 17.3849 13.1165C17.2372 13.071 17.0762 13.0483 16.902 13.0483C16.5895 13.0483 16.3111 13.1269 16.0668 13.2841C15.8224 13.4413 15.6302 13.6723 15.4901 13.9773C15.3518 14.2803 15.2827 14.6496 15.2827 15.0852C15.2827 15.5246 15.3518 15.8968 15.4901 16.2017C15.6283 16.5066 15.8205 16.7386 16.0668 16.8977C16.313 17.0549 16.599 17.1335 16.9247 17.1335C17.2202 17.1335 17.4759 17.0767 17.6918 16.9631C17.9096 16.8494 18.0772 16.6884 18.1946 16.4801C18.312 16.2699 18.3707 16.0237 18.3707 15.7415L18.6094 15.7784H17.0298V14.9545H19.3906V15.6534C19.3906 16.1515 19.2846 16.5824 19.0724 16.946C18.8603 17.3097 18.5687 17.59 18.1974 17.7869C17.8262 17.982 17.4001 18.0795 16.919 18.0795C16.383 18.0795 15.9124 17.9593 15.5071 17.7188C15.1037 17.4763 14.7884 17.1326 14.5611 16.6875C14.3357 16.2405 14.223 15.7102 14.223 15.0966C14.223 14.6269 14.2893 14.2074 14.4219 13.8381C14.5563 13.4688 14.7438 13.1553 14.9844 12.8977C15.2249 12.6383 15.5071 12.4413 15.831 12.3068C16.1548 12.1705 16.5071 12.1023 16.8878 12.1023C17.2098 12.1023 17.5099 12.1496 17.7884 12.2443C18.0668 12.3371 18.3139 12.4697 18.5298 12.642C18.7476 12.8144 18.9266 13.0189 19.0668 13.2557C19.2069 13.4924 19.2988 13.7538 19.3423 14.0398H18.2685Z" fill="white"/>`,
15
+ gif: `<path fill-rule="evenodd" clip-rule="evenodd" d="M3 0C2.44772 0 2 0.447716 2 1V23C2 23.5523 2.44772 24 3 24H21C21.5523 24 22 23.5523 22 23V4L18 0H3Z" fill="#E4E7EC"/><path fill-rule="evenodd" clip-rule="evenodd" d="M18 0V4H22L18 0Z" fill="#98A2B3"/><rect x="1" y="10" width="22" height="10" rx="1" fill="#F77A4A"/><path d="M10.0107 14.0398C9.96331 13.8864 9.89796 13.7491 9.81463 13.6278C9.73319 13.5047 9.63471 13.3996 9.51918 13.3125C9.40554 13.2254 9.27486 13.16 9.12713 13.1165C8.9794 13.071 8.81842 13.0483 8.64418 13.0483C8.33168 13.0483 8.05327 13.1269 7.80895 13.2841C7.56463 13.4413 7.3724 13.6723 7.23224 13.9773C7.09399 14.2803 7.02486 14.6496 7.02486 15.0852C7.02486 15.5246 7.09399 15.8968 7.23224 16.2017C7.3705 16.5066 7.56274 16.7386 7.80895 16.8977C8.05516 17.0549 8.34115 17.1335 8.6669 17.1335C8.96236 17.1335 9.21804 17.0767 9.43395 16.9631C9.65175 16.8494 9.81937 16.6884 9.93679 16.4801C10.0542 16.2699 10.1129 16.0237 10.1129 15.7415L10.3516 15.7784H8.77202V14.9545H11.1328V15.6534C11.1328 16.1515 11.0268 16.5824 10.8146 16.946C10.6025 17.3097 10.3108 17.59 9.93963 17.7869C9.56842 17.982 9.14228 18.0795 8.66122 18.0795C8.12524 18.0795 7.65459 17.9593 7.24929 17.7188C6.84588 17.4763 6.53054 17.1326 6.30327 16.6875C6.07789 16.2405 5.9652 15.7102 5.9652 15.0966C5.9652 14.6269 6.03149 14.2074 6.16406 13.8381C6.29853 13.4688 6.48603 13.1553 6.72656 12.8977C6.96709 12.6383 7.24929 12.4413 7.57315 12.3068C7.89702 12.1705 8.24929 12.1023 8.62997 12.1023C8.95194 12.1023 9.25213 12.1496 9.53054 12.2443C9.80895 12.3371 10.0561 12.4697 10.272 12.642C10.4898 12.8144 10.6688 13.0189 10.8089 13.2557C10.9491 13.4924 11.041 13.7538 11.0845 14.0398H10.0107ZM13.206 12.1818V18H12.152V12.1818H13.206ZM14.3473 18V12.1818H18.0746V13.0653H15.4013V14.6449H17.8189V15.5284H15.4013V18H14.3473Z" fill="white"/>`,
16
+ xls: `<path fill-rule="evenodd" clip-rule="evenodd" d="M3 0C2.44772 0 2 0.447716 2 1V23C2 23.5523 2.44772 24 3 24H21C21.5523 24 22 23.5523 22 23V4L18 0H3Z" fill="#E4E7EC"/><path fill-rule="evenodd" clip-rule="evenodd" d="M18 0V4H22L18 0Z" fill="#98A2B3"/><rect x="1" y="10" width="22" height="10" rx="1" fill="#0F973D"/><path d="M5.82955 12.1818L7.1108 14.3125H7.15625L8.44318 12.1818H9.64489L7.85227 15.0909L9.6733 18H8.4517L7.15625 15.8835H7.1108L5.81534 18H4.59943L6.4375 15.0909L4.62216 12.1818H5.82955ZM10.4723 18V12.1818H11.5263V17.1165H14.0888V18H10.4723ZM18.1655 13.7812C18.139 13.5331 18.0272 13.34 17.8303 13.2017C17.6352 13.0634 17.3814 12.9943 17.0689 12.9943C16.8492 12.9943 16.6607 13.0275 16.5036 13.0938C16.3464 13.16 16.2261 13.25 16.1428 13.3636C16.0594 13.4773 16.0168 13.607 16.0149 13.7528C16.0149 13.8741 16.0424 13.9792 16.0973 14.0682C16.1541 14.1572 16.2308 14.233 16.3274 14.2955C16.424 14.3561 16.531 14.4072 16.6484 14.4489C16.7659 14.4905 16.8842 14.5256 17.0036 14.554L17.549 14.6903C17.7687 14.7415 17.9799 14.8106 18.1825 14.8977C18.3871 14.9848 18.5698 15.0947 18.7308 15.2273C18.8937 15.3598 19.0225 15.5199 19.1172 15.7074C19.2119 15.8949 19.2592 16.1146 19.2592 16.3665C19.2592 16.7074 19.1721 17.0076 18.9979 17.267C18.8236 17.5246 18.5717 17.7263 18.2422 17.8722C17.9145 18.0161 17.5178 18.0881 17.0518 18.0881C16.5992 18.0881 16.2062 18.018 15.8729 17.8778C15.5414 17.7377 15.282 17.5331 15.0945 17.2642C14.9089 16.9953 14.8085 16.6676 14.7933 16.2812H15.8303C15.8454 16.4839 15.9079 16.6525 16.0178 16.7869C16.1276 16.9214 16.2706 17.0218 16.4467 17.0881C16.6248 17.1544 16.8236 17.1875 17.0433 17.1875C17.2725 17.1875 17.4732 17.1534 17.6456 17.0852C17.8198 17.0152 17.9562 16.9186 18.0547 16.7955C18.1532 16.6705 18.2034 16.5246 18.2053 16.358C18.2034 16.2064 18.1589 16.0814 18.0717 15.983C17.9846 15.8826 17.8625 15.7992 17.7053 15.733C17.55 15.6648 17.3681 15.6042 17.1598 15.5511L16.4979 15.3807C16.0187 15.2576 15.6399 15.071 15.3615 14.821C15.085 14.5691 14.9467 14.2348 14.9467 13.8182C14.9467 13.4754 15.0395 13.1752 15.2251 12.9176C15.4126 12.66 15.6674 12.4602 15.9893 12.3182C16.3113 12.1742 16.6759 12.1023 17.0831 12.1023C17.496 12.1023 17.8577 12.1742 18.1683 12.3182C18.4808 12.4602 18.7261 12.6581 18.9041 12.9119C19.0821 13.1638 19.174 13.4536 19.1797 13.7812H18.1655Z" fill="white"/>`,
17
+ mp3: `<path fill-rule="evenodd" clip-rule="evenodd" d="M3 0C2.44772 0 2 0.447716 2 1V23C2 23.5523 2.44772 24 3 24H21C21.5523 24 22 23.5523 22 23V4L18 0H3Z" fill="#E4E7EC"/><path fill-rule="evenodd" clip-rule="evenodd" d="M18 0V4H22L18 0Z" fill="#98A2B3"/><rect x="1" y="10" width="22" height="10" rx="1" fill="#6D56F8"/><path d="M3.76918 12.1818H5.05895L6.78622 16.3977H6.8544L8.58168 12.1818H9.87145V18H8.86009V14.0028H8.80611L7.19815 17.983H6.44247L4.83452 13.9943H4.78054V18H3.76918V12.1818ZM11.0192 18V12.1818H13.201C13.648 12.1818 14.023 12.2652 14.326 12.4318C14.6309 12.5985 14.861 12.8277 15.0163 13.1193C15.1735 13.4091 15.2521 13.7386 15.2521 14.108C15.2521 14.4811 15.1735 14.8125 15.0163 15.1023C14.8591 15.392 14.6271 15.6203 14.3203 15.7869C14.0135 15.9517 13.6357 16.0341 13.1868 16.0341H11.7408V15.1676H13.0447C13.3061 15.1676 13.5201 15.1222 13.6868 15.0312C13.8535 14.9403 13.9766 14.8153 14.0561 14.6562C14.1375 14.4972 14.1783 14.3144 14.1783 14.108C14.1783 13.9015 14.1375 13.7197 14.0561 13.5625C13.9766 13.4053 13.8525 13.2831 13.6839 13.196C13.5173 13.107 13.3023 13.0625 13.0391 13.0625H12.0732V18H11.0192ZM18.1989 18.0795C17.7898 18.0795 17.4261 18.0095 17.108 17.8693C16.7917 17.7292 16.5417 17.5341 16.358 17.2841C16.1742 17.0341 16.0767 16.7453 16.0653 16.4176H17.1335C17.143 16.5748 17.1951 16.7121 17.2898 16.8295C17.3845 16.9451 17.5104 17.035 17.6676 17.0994C17.8248 17.1638 18.0009 17.196 18.196 17.196C18.4044 17.196 18.589 17.16 18.75 17.0881C18.911 17.0142 19.0369 16.9119 19.1278 16.7812C19.2188 16.6506 19.2633 16.5 19.2614 16.3295C19.2633 16.1534 19.2178 15.9981 19.125 15.8636C19.0322 15.7292 18.8977 15.6241 18.7216 15.5483C18.5473 15.4725 18.3371 15.4347 18.0909 15.4347H17.5767V14.6222H18.0909C18.2936 14.6222 18.4706 14.5871 18.6222 14.517C18.7756 14.447 18.8958 14.3485 18.983 14.2216C19.0701 14.0928 19.1127 13.9441 19.1108 13.7756C19.1127 13.6108 19.0758 13.4678 19 13.3466C18.9261 13.2235 18.821 13.1278 18.6847 13.0597C18.5502 12.9915 18.392 12.9574 18.2102 12.9574C18.0322 12.9574 17.8674 12.9896 17.7159 13.054C17.5644 13.1184 17.4422 13.2102 17.3494 13.3295C17.2566 13.447 17.2074 13.5871 17.2017 13.75H16.1875C16.1951 13.4242 16.2888 13.1383 16.4688 12.892C16.6506 12.6439 16.893 12.4508 17.196 12.3125C17.4991 12.1723 17.839 12.1023 18.2159 12.1023C18.6042 12.1023 18.9413 12.1752 19.2273 12.321C19.5152 12.465 19.7377 12.6591 19.8949 12.9034C20.0521 13.1477 20.1307 13.4176 20.1307 13.7131C20.1326 14.0407 20.036 14.3153 19.8409 14.5369C19.6477 14.7585 19.3939 14.9034 19.0795 14.9716V15.017C19.4886 15.0739 19.8021 15.2254 20.0199 15.4716C20.2396 15.7159 20.3485 16.0199 20.3466 16.3835C20.3466 16.7093 20.2538 17.0009 20.0682 17.2585C19.8845 17.5142 19.6307 17.715 19.3068 17.8608C18.9848 18.0066 18.6155 18.0795 18.1989 18.0795Z" fill="white"/>`,
18
+ generic: `<path fill-rule="evenodd" clip-rule="evenodd" d="M3 0C2.44772 0 2 0.447716 2 1V23C2 23.5523 2.44772 24 3 24H21C21.5523 24 22 23.5523 22 23V4L18 0H3Z" fill="#E4E7EC"/><path fill-rule="evenodd" clip-rule="evenodd" d="M18 0V4H22L18 0Z" fill="#98A2B3"/><rect x="1" y="10" width="22" height="10" rx="1" fill="#98A2B3"/>`,
19
+ };
20
+ const uploadStateSvgs = {
21
+ default: `<circle cx="16" cy="16" r="16" fill="#F0F2F5"/><path d="M12 14.3333C12 12.3083 13.6416 10.6666 15.6667 10.6666C17.4605 10.6666 18.9547 11.9554 19.2714 13.6578C19.3158 13.8965 19.4865 14.0922 19.7169 14.1686C21.0441 14.6088 22 15.8603 22 17.3333C22 19.1743 20.5076 20.6666 18.6667 20.6666C18.2985 20.6666 18 20.9651 18 21.3333C18 21.7015 18.2985 22 18.6667 22C21.244 22 23.3334 19.9106 23.3334 17.3333C23.3334 15.405 22.1642 13.7513 20.4976 13.0397C19.9273 10.9053 17.9812 9.33331 15.6667 9.33331C12.9053 9.33331 10.6667 11.5719 10.6667 14.3333C10.6667 14.4002 10.668 14.4667 10.6706 14.533C9.47367 15.2236 8.66669 16.5169 8.66669 18C8.66669 20.2091 10.4575 22 12.6667 22C13.0349 22 13.3334 21.7015 13.3334 21.3333C13.3334 20.9651 13.0349 20.6666 12.6667 20.6666C11.1939 20.6666 10 19.4727 10 18C10 16.8951 10.6721 15.9456 11.6325 15.5411C11.9103 15.424 12.0751 15.135 12.0341 14.8363C12.0117 14.6722 12 14.5043 12 14.3333Z" fill="#475367"/><path d="M15.5571 17.5017C15.8097 17.2772 16.1903 17.2772 16.4429 17.5017L17.4429 18.3906C17.7181 18.6352 17.7429 19.0566 17.4983 19.3318C17.2843 19.5725 16.935 19.6216 16.6667 19.4664V22.6666C16.6667 23.0348 16.3682 23.3333 16 23.3333C15.6318 23.3333 15.3334 23.0348 15.3334 22.6666V19.4664C15.065 19.6216 14.7157 19.5725 14.5017 19.3318C14.2571 19.0566 14.2819 18.6352 14.5571 18.3906L15.5571 17.5017Z" fill="#475367"/>`,
22
+ success: `<circle cx="16" cy="16" r="16" fill="#E7F6EC"/><path fill-rule="evenodd" clip-rule="evenodd" d="M16 23.5C20.1421 23.5 23.5 20.1421 23.5 16C23.5 11.8579 20.1421 8.5 16 8.5C11.8579 8.5 8.5 11.8579 8.5 16C8.5 20.1421 11.8579 23.5 16 23.5ZM19.0628 14.9479C19.4022 14.637 19.4254 14.1099 19.1145 13.7705C18.8037 13.4311 18.2766 13.4079 17.9372 13.7188L14.8604 16.5366L14.0628 15.8062C13.7234 15.4953 13.1963 15.5185 12.8855 15.8579C12.5746 16.1973 12.5978 16.7244 12.9372 17.0352L14.2976 18.2812C14.6161 18.5729 15.1047 18.5729 15.4233 18.2812L19.0628 14.9479Z" fill="#0F973D"/>`,
23
+ warning: `<circle cx="16" cy="16" r="16" fill="#FEF6E7"/><path fill-rule="evenodd" clip-rule="evenodd" d="M23.5 16C23.5 20.1421 20.1421 23.5 16 23.5C11.8579 23.5 8.5 20.1421 8.5 16C8.5 11.8579 11.8579 8.5 16 8.5C20.1421 8.5 23.5 11.8579 23.5 16ZM16 11C16.4602 11 16.8333 11.3731 16.8333 11.8333V17.6667C16.8333 18.1269 16.4602 18.5 16 18.5C15.5398 18.5 15.1667 18.1269 15.1667 17.6667L15.1667 11.8333C15.1667 11.3731 15.5398 11 16 11ZM14.9583 19.9583C14.9583 20.5336 15.4247 21 16 21C16.5753 21 17.0417 20.5336 17.0417 19.9583C17.0417 19.383 16.5753 18.9167 16 18.9167C15.4247 18.9167 14.9583 19.383 14.9583 19.9583Z" fill="#F3A218"/>`,
24
+ error: `<circle cx="16" cy="16" r="16" fill="#FBEAE9"/><path fill-rule="evenodd" clip-rule="evenodd" d="M10.2054 18.7851L14.4129 10.9364C15.0822 9.68788 16.9178 9.68788 17.5871 10.9364L21.7946 18.7851C22.4164 19.9451 21.5517 21.3333 20.2074 21.3333H11.7926C10.4483 21.3333 9.58363 19.9451 10.2054 18.7851ZM16 12C16.3682 12 16.6667 12.2985 16.6667 12.6667V17.3333C16.6667 17.7015 16.3682 18 16 18C15.6318 18 15.3333 17.7015 15.3333 17.3333V12.6667C15.3333 12.2985 15.6318 12 16 12ZM15.1667 19.1667C15.1667 19.6269 15.5398 20 16 20C16.4602 20 16.8333 19.6269 16.8333 19.1667C16.8333 18.7064 16.4602 18.3333 16 18.3333C15.5398 18.3333 15.1667 18.7064 15.1667 19.1667Z" fill="#D42620"/>`,
25
+ };
26
+ // ─── File Type Icon (24×24) ──────────────────────────────────────
27
+ function FileTypeIcon({ type, className }) {
28
+ return ((0, jsx_runtime_1.jsx)("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: (0, cn_1.cn)("shrink-0", className), dangerouslySetInnerHTML: { __html: fileTypeSvgs[type] } }));
29
+ }
30
+ // ─── Upload State Icon (32×32, scalable) ─────────────────────────
31
+ function UploadStateIcon({ state, size = 32, className, }) {
32
+ return ((0, jsx_runtime_1.jsx)("svg", { width: size, height: size, viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: (0, cn_1.cn)("shrink-0", className), dangerouslySetInnerHTML: { __html: uploadStateSvgs[state] } }));
33
+ }
34
+ // ─── Helper: filename → FileTypeName ─────────────────────────────
35
+ function getFileType(filename) {
36
+ const ext = filename.split(".").pop()?.toLowerCase();
37
+ switch (ext) {
38
+ case "png":
39
+ return "png";
40
+ case "jpg":
41
+ case "jpeg":
42
+ return "jpg";
43
+ case "gif":
44
+ return "gif";
45
+ case "xls":
46
+ case "xlsx":
47
+ return "xls";
48
+ case "mp3":
49
+ return "mp3";
50
+ case "pdf":
51
+ return "pdf";
52
+ default:
53
+ return "generic";
54
+ }
55
+ }
@@ -0,0 +1,50 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from "../../utils/cn.js";
3
+ // ─── SVG Data ────────────────────────────────────────────────────
4
+ // File type SVGs (24×24) from icon-assets/filetypes/
5
+ // Each is a document icon with a colored label bar in the lower half.
6
+ const fileTypeSvgs = {
7
+ pdf: `<path fill-rule="evenodd" clip-rule="evenodd" d="M3 0C2.44772 0 2 0.447716 2 1V23C2 23.5523 2.44772 24 3 24H21C21.5523 24 22 23.5523 22 23V4L18 0H3Z" fill="#E4E7EC"/><path fill-rule="evenodd" clip-rule="evenodd" d="M18 0V4H22L18 0Z" fill="#98A2B3"/><rect x="1" y="10" width="22" height="10" rx="1" fill="#CC400C"/><path d="M4.6637 17.9091V12.0909H6.84551C7.29248 12.0909 7.66748 12.1742 7.97051 12.3409C8.27544 12.5075 8.50555 12.7367 8.66086 13.0284C8.81805 13.3182 8.89665 13.6477 8.89665 14.017C8.89665 14.3901 8.81805 14.7216 8.66086 15.0113C8.50366 15.3011 8.27165 15.5293 7.96483 15.696C7.65801 15.8608 7.28017 15.9432 6.83131 15.9432H5.38529V15.0767H6.68926C6.95063 15.0767 7.16464 15.0312 7.33131 14.9403C7.49798 14.8494 7.62108 14.7244 7.70063 14.5653C7.78207 14.4062 7.82279 14.2235 7.82279 14.017C7.82279 13.8106 7.78207 13.6288 7.70063 13.4716C7.62108 13.3144 7.49703 13.1922 7.32847 13.1051C7.1618 13.0161 6.94684 12.9716 6.68358 12.9716H5.71767V17.9091H4.6637Z" fill="white"/><path d="M11.7837 17.9091H9.81213V12.0909H11.8235C12.4011 12.0909 12.8974 12.2074 13.3121 12.4403C13.7288 12.6714 14.0489 13.0038 14.2724 13.4375C14.4958 13.8712 14.6076 14.3901 14.6076 14.9943C14.6076 15.6004 14.4949 16.1212 14.2695 16.5568C14.046 16.9924 13.7231 17.3267 13.3008 17.5596C12.8803 17.7926 12.3746 17.9091 11.7837 17.9091ZM10.8661 16.9971H11.7326C12.1379 16.9971 12.476 16.9233 12.7468 16.7755C13.0176 16.6259 13.2212 16.4034 13.3576 16.1079C13.494 15.8106 13.5621 15.4394 13.5621 14.9943C13.5621 14.5492 13.494 14.1799 13.3576 13.8863C13.2212 13.5909 13.0195 13.3702 12.7525 13.2244C12.4873 13.0767 12.1578 13.0028 11.7638 13.0028H10.8661V16.9971Z" fill="white"/><path d="M15.609 17.9091V12.0909H19.3363V12.9744H16.663V14.5539H19.0806V15.4375H16.663V17.9091H15.609Z" fill="white"/>`,
8
+ png: `<path fill-rule="evenodd" clip-rule="evenodd" d="M3 0C2.44772 0 2 0.447716 2 1V23C2 23.5523 2.44772 24 3 24H21C21.5523 24 22 23.5523 22 23V4L18 0H3Z" fill="#E4E7EC"/><path fill-rule="evenodd" clip-rule="evenodd" d="M18 0V4H22L18 0Z" fill="#98A2B3"/><rect x="1" y="10" width="22" height="10" rx="1" fill="#1671D9"/><path d="M4.01527 18V12.1818H6.19709C6.64406 12.1818 7.01906 12.2652 7.32209 12.4318C7.62701 12.5985 7.85713 12.8277 8.01243 13.1193C8.16963 13.4091 8.24822 13.7386 8.24822 14.108C8.24822 14.4811 8.16963 14.8125 8.01243 15.1023C7.85523 15.392 7.62322 15.6203 7.31641 15.7869C7.00959 15.9517 6.63175 16.0341 6.18288 16.0341H4.73686V15.1676H6.04084C6.3022 15.1676 6.51622 15.1222 6.68288 15.0312C6.84955 14.9403 6.97266 14.8153 7.0522 14.6562C7.13364 14.4972 7.17436 14.3144 7.17436 14.108C7.17436 13.9015 7.13364 13.7197 7.0522 13.5625C6.97266 13.4053 6.8486 13.2831 6.68004 13.196C6.51338 13.107 6.29841 13.0625 6.03516 13.0625H5.06925V18H4.01527ZM13.945 12.1818V18H13.0075L10.266 14.0369H10.2177V18H9.16371V12.1818H10.1069L12.8455 16.1477H12.8967V12.1818H13.945ZM18.9911 14.0398C18.9438 13.8864 18.8784 13.7491 18.7951 13.6278C18.7137 13.5047 18.6152 13.3996 18.4996 13.3125C18.386 13.2254 18.2553 13.16 18.1076 13.1165C17.9599 13.071 17.7989 13.0483 17.6246 13.0483C17.3121 13.0483 17.0337 13.1269 16.7894 13.2841C16.5451 13.4413 16.3529 13.6723 16.2127 13.9773C16.0745 14.2803 16.0053 14.6496 16.0053 15.0852C16.0053 15.5246 16.0745 15.8968 16.2127 16.2017C16.351 16.5066 16.5432 16.7386 16.7894 16.8977C17.0356 17.0549 17.3216 17.1335 17.6474 17.1335C17.9428 17.1335 18.1985 17.0767 18.4144 16.9631C18.6322 16.8494 18.7998 16.6884 18.9173 16.4801C19.0347 16.2699 19.0934 16.0237 19.0934 15.7415L19.332 15.7784H17.7525V14.9545H20.1133V15.6534C20.1133 16.1515 20.0072 16.5824 19.7951 16.946C19.583 17.3097 19.2913 17.59 18.9201 17.7869C18.5489 17.982 18.1228 18.0795 17.6417 18.0795C17.1057 18.0795 16.6351 17.9593 16.2298 17.7188C15.8263 17.4763 15.511 17.1326 15.2837 16.6875C15.0584 16.2405 14.9457 15.7102 14.9457 15.0966C14.9457 14.6269 15.012 14.2074 15.1445 13.8381C15.279 13.4688 15.4665 13.1553 15.707 12.8977C15.9476 12.6383 16.2298 12.4413 16.5536 12.3068C16.8775 12.1705 17.2298 12.1023 17.6104 12.1023C17.9324 12.1023 18.2326 12.1496 18.511 12.2443C18.7894 12.3371 19.0366 12.4697 19.2525 12.642C19.4703 12.8144 19.6493 13.0189 19.7894 13.2557C19.9296 13.4924 20.0214 13.7538 20.065 14.0398H18.9911Z" fill="white"/>`,
9
+ jpg: `<path fill-rule="evenodd" clip-rule="evenodd" d="M3 0C2.44772 0 2 0.447716 2 1V23C2 23.5523 2.44772 24 3 24H21C21.5523 24 22 23.5523 22 23V4L18 0H3Z" fill="#E4E7EC"/><path fill-rule="evenodd" clip-rule="evenodd" d="M18 0V4H22L18 0Z" fill="#98A2B3"/><rect x="1" y="10" width="22" height="10" rx="1" fill="#C548F1"/><path d="M7.03338 12.1818H8.07884V16.2727C8.07694 16.6477 7.9974 16.9706 7.8402 17.2415C7.683 17.5104 7.4633 17.7178 7.18111 17.8636C6.9008 18.0076 6.5741 18.0795 6.20099 18.0795C5.86009 18.0795 5.55327 18.0189 5.28054 17.8977C5.00971 17.7746 4.79474 17.5928 4.63565 17.3523C4.47656 17.1117 4.39702 16.8125 4.39702 16.4545H5.44531C5.44721 16.6117 5.4813 16.7472 5.54759 16.8608C5.61577 16.9744 5.70952 17.0616 5.82884 17.1222C5.94815 17.1828 6.08546 17.2131 6.24077 17.2131C6.40933 17.2131 6.55232 17.178 6.66974 17.108C6.78717 17.036 6.87618 16.9299 6.93679 16.7898C6.99929 16.6496 7.03149 16.4773 7.03338 16.2727V12.1818ZM9.2223 18V12.1818H11.4041C11.8511 12.1818 12.2261 12.2652 12.5291 12.4318C12.834 12.5985 13.0642 12.8277 13.2195 13.1193C13.3767 13.4091 13.4553 13.7386 13.4553 14.108C13.4553 14.4811 13.3767 14.8125 13.2195 15.1023C13.0623 15.392 12.8303 15.6203 12.5234 15.7869C12.2166 15.9517 11.8388 16.0341 11.3899 16.0341H9.94389V15.1676H11.2479C11.5092 15.1676 11.7232 15.1222 11.8899 15.0312C12.0566 14.9403 12.1797 14.8153 12.2592 14.6562C12.3407 14.4972 12.3814 14.3144 12.3814 14.108C12.3814 13.9015 12.3407 13.7197 12.2592 13.5625C12.1797 13.4053 12.0556 13.2831 11.8871 13.196C11.7204 13.107 11.5054 13.0625 11.2422 13.0625H10.2763V18H9.2223ZM18.2685 14.0398C18.2211 13.8864 18.1558 13.7491 18.0724 13.6278C17.991 13.5047 17.8925 13.3996 17.777 13.3125C17.6634 13.2254 17.5327 13.16 17.3849 13.1165C17.2372 13.071 17.0762 13.0483 16.902 13.0483C16.5895 13.0483 16.3111 13.1269 16.0668 13.2841C15.8224 13.4413 15.6302 13.6723 15.4901 13.9773C15.3518 14.2803 15.2827 14.6496 15.2827 15.0852C15.2827 15.5246 15.3518 15.8968 15.4901 16.2017C15.6283 16.5066 15.8205 16.7386 16.0668 16.8977C16.313 17.0549 16.599 17.1335 16.9247 17.1335C17.2202 17.1335 17.4759 17.0767 17.6918 16.9631C17.9096 16.8494 18.0772 16.6884 18.1946 16.4801C18.312 16.2699 18.3707 16.0237 18.3707 15.7415L18.6094 15.7784H17.0298V14.9545H19.3906V15.6534C19.3906 16.1515 19.2846 16.5824 19.0724 16.946C18.8603 17.3097 18.5687 17.59 18.1974 17.7869C17.8262 17.982 17.4001 18.0795 16.919 18.0795C16.383 18.0795 15.9124 17.9593 15.5071 17.7188C15.1037 17.4763 14.7884 17.1326 14.5611 16.6875C14.3357 16.2405 14.223 15.7102 14.223 15.0966C14.223 14.6269 14.2893 14.2074 14.4219 13.8381C14.5563 13.4688 14.7438 13.1553 14.9844 12.8977C15.2249 12.6383 15.5071 12.4413 15.831 12.3068C16.1548 12.1705 16.5071 12.1023 16.8878 12.1023C17.2098 12.1023 17.5099 12.1496 17.7884 12.2443C18.0668 12.3371 18.3139 12.4697 18.5298 12.642C18.7476 12.8144 18.9266 13.0189 19.0668 13.2557C19.2069 13.4924 19.2988 13.7538 19.3423 14.0398H18.2685Z" fill="white"/>`,
10
+ gif: `<path fill-rule="evenodd" clip-rule="evenodd" d="M3 0C2.44772 0 2 0.447716 2 1V23C2 23.5523 2.44772 24 3 24H21C21.5523 24 22 23.5523 22 23V4L18 0H3Z" fill="#E4E7EC"/><path fill-rule="evenodd" clip-rule="evenodd" d="M18 0V4H22L18 0Z" fill="#98A2B3"/><rect x="1" y="10" width="22" height="10" rx="1" fill="#F77A4A"/><path d="M10.0107 14.0398C9.96331 13.8864 9.89796 13.7491 9.81463 13.6278C9.73319 13.5047 9.63471 13.3996 9.51918 13.3125C9.40554 13.2254 9.27486 13.16 9.12713 13.1165C8.9794 13.071 8.81842 13.0483 8.64418 13.0483C8.33168 13.0483 8.05327 13.1269 7.80895 13.2841C7.56463 13.4413 7.3724 13.6723 7.23224 13.9773C7.09399 14.2803 7.02486 14.6496 7.02486 15.0852C7.02486 15.5246 7.09399 15.8968 7.23224 16.2017C7.3705 16.5066 7.56274 16.7386 7.80895 16.8977C8.05516 17.0549 8.34115 17.1335 8.6669 17.1335C8.96236 17.1335 9.21804 17.0767 9.43395 16.9631C9.65175 16.8494 9.81937 16.6884 9.93679 16.4801C10.0542 16.2699 10.1129 16.0237 10.1129 15.7415L10.3516 15.7784H8.77202V14.9545H11.1328V15.6534C11.1328 16.1515 11.0268 16.5824 10.8146 16.946C10.6025 17.3097 10.3108 17.59 9.93963 17.7869C9.56842 17.982 9.14228 18.0795 8.66122 18.0795C8.12524 18.0795 7.65459 17.9593 7.24929 17.7188C6.84588 17.4763 6.53054 17.1326 6.30327 16.6875C6.07789 16.2405 5.9652 15.7102 5.9652 15.0966C5.9652 14.6269 6.03149 14.2074 6.16406 13.8381C6.29853 13.4688 6.48603 13.1553 6.72656 12.8977C6.96709 12.6383 7.24929 12.4413 7.57315 12.3068C7.89702 12.1705 8.24929 12.1023 8.62997 12.1023C8.95194 12.1023 9.25213 12.1496 9.53054 12.2443C9.80895 12.3371 10.0561 12.4697 10.272 12.642C10.4898 12.8144 10.6688 13.0189 10.8089 13.2557C10.9491 13.4924 11.041 13.7538 11.0845 14.0398H10.0107ZM13.206 12.1818V18H12.152V12.1818H13.206ZM14.3473 18V12.1818H18.0746V13.0653H15.4013V14.6449H17.8189V15.5284H15.4013V18H14.3473Z" fill="white"/>`,
11
+ xls: `<path fill-rule="evenodd" clip-rule="evenodd" d="M3 0C2.44772 0 2 0.447716 2 1V23C2 23.5523 2.44772 24 3 24H21C21.5523 24 22 23.5523 22 23V4L18 0H3Z" fill="#E4E7EC"/><path fill-rule="evenodd" clip-rule="evenodd" d="M18 0V4H22L18 0Z" fill="#98A2B3"/><rect x="1" y="10" width="22" height="10" rx="1" fill="#0F973D"/><path d="M5.82955 12.1818L7.1108 14.3125H7.15625L8.44318 12.1818H9.64489L7.85227 15.0909L9.6733 18H8.4517L7.15625 15.8835H7.1108L5.81534 18H4.59943L6.4375 15.0909L4.62216 12.1818H5.82955ZM10.4723 18V12.1818H11.5263V17.1165H14.0888V18H10.4723ZM18.1655 13.7812C18.139 13.5331 18.0272 13.34 17.8303 13.2017C17.6352 13.0634 17.3814 12.9943 17.0689 12.9943C16.8492 12.9943 16.6607 13.0275 16.5036 13.0938C16.3464 13.16 16.2261 13.25 16.1428 13.3636C16.0594 13.4773 16.0168 13.607 16.0149 13.7528C16.0149 13.8741 16.0424 13.9792 16.0973 14.0682C16.1541 14.1572 16.2308 14.233 16.3274 14.2955C16.424 14.3561 16.531 14.4072 16.6484 14.4489C16.7659 14.4905 16.8842 14.5256 17.0036 14.554L17.549 14.6903C17.7687 14.7415 17.9799 14.8106 18.1825 14.8977C18.3871 14.9848 18.5698 15.0947 18.7308 15.2273C18.8937 15.3598 19.0225 15.5199 19.1172 15.7074C19.2119 15.8949 19.2592 16.1146 19.2592 16.3665C19.2592 16.7074 19.1721 17.0076 18.9979 17.267C18.8236 17.5246 18.5717 17.7263 18.2422 17.8722C17.9145 18.0161 17.5178 18.0881 17.0518 18.0881C16.5992 18.0881 16.2062 18.018 15.8729 17.8778C15.5414 17.7377 15.282 17.5331 15.0945 17.2642C14.9089 16.9953 14.8085 16.6676 14.7933 16.2812H15.8303C15.8454 16.4839 15.9079 16.6525 16.0178 16.7869C16.1276 16.9214 16.2706 17.0218 16.4467 17.0881C16.6248 17.1544 16.8236 17.1875 17.0433 17.1875C17.2725 17.1875 17.4732 17.1534 17.6456 17.0852C17.8198 17.0152 17.9562 16.9186 18.0547 16.7955C18.1532 16.6705 18.2034 16.5246 18.2053 16.358C18.2034 16.2064 18.1589 16.0814 18.0717 15.983C17.9846 15.8826 17.8625 15.7992 17.7053 15.733C17.55 15.6648 17.3681 15.6042 17.1598 15.5511L16.4979 15.3807C16.0187 15.2576 15.6399 15.071 15.3615 14.821C15.085 14.5691 14.9467 14.2348 14.9467 13.8182C14.9467 13.4754 15.0395 13.1752 15.2251 12.9176C15.4126 12.66 15.6674 12.4602 15.9893 12.3182C16.3113 12.1742 16.6759 12.1023 17.0831 12.1023C17.496 12.1023 17.8577 12.1742 18.1683 12.3182C18.4808 12.4602 18.7261 12.6581 18.9041 12.9119C19.0821 13.1638 19.174 13.4536 19.1797 13.7812H18.1655Z" fill="white"/>`,
12
+ mp3: `<path fill-rule="evenodd" clip-rule="evenodd" d="M3 0C2.44772 0 2 0.447716 2 1V23C2 23.5523 2.44772 24 3 24H21C21.5523 24 22 23.5523 22 23V4L18 0H3Z" fill="#E4E7EC"/><path fill-rule="evenodd" clip-rule="evenodd" d="M18 0V4H22L18 0Z" fill="#98A2B3"/><rect x="1" y="10" width="22" height="10" rx="1" fill="#6D56F8"/><path d="M3.76918 12.1818H5.05895L6.78622 16.3977H6.8544L8.58168 12.1818H9.87145V18H8.86009V14.0028H8.80611L7.19815 17.983H6.44247L4.83452 13.9943H4.78054V18H3.76918V12.1818ZM11.0192 18V12.1818H13.201C13.648 12.1818 14.023 12.2652 14.326 12.4318C14.6309 12.5985 14.861 12.8277 15.0163 13.1193C15.1735 13.4091 15.2521 13.7386 15.2521 14.108C15.2521 14.4811 15.1735 14.8125 15.0163 15.1023C14.8591 15.392 14.6271 15.6203 14.3203 15.7869C14.0135 15.9517 13.6357 16.0341 13.1868 16.0341H11.7408V15.1676H13.0447C13.3061 15.1676 13.5201 15.1222 13.6868 15.0312C13.8535 14.9403 13.9766 14.8153 14.0561 14.6562C14.1375 14.4972 14.1783 14.3144 14.1783 14.108C14.1783 13.9015 14.1375 13.7197 14.0561 13.5625C13.9766 13.4053 13.8525 13.2831 13.6839 13.196C13.5173 13.107 13.3023 13.0625 13.0391 13.0625H12.0732V18H11.0192ZM18.1989 18.0795C17.7898 18.0795 17.4261 18.0095 17.108 17.8693C16.7917 17.7292 16.5417 17.5341 16.358 17.2841C16.1742 17.0341 16.0767 16.7453 16.0653 16.4176H17.1335C17.143 16.5748 17.1951 16.7121 17.2898 16.8295C17.3845 16.9451 17.5104 17.035 17.6676 17.0994C17.8248 17.1638 18.0009 17.196 18.196 17.196C18.4044 17.196 18.589 17.16 18.75 17.0881C18.911 17.0142 19.0369 16.9119 19.1278 16.7812C19.2188 16.6506 19.2633 16.5 19.2614 16.3295C19.2633 16.1534 19.2178 15.9981 19.125 15.8636C19.0322 15.7292 18.8977 15.6241 18.7216 15.5483C18.5473 15.4725 18.3371 15.4347 18.0909 15.4347H17.5767V14.6222H18.0909C18.2936 14.6222 18.4706 14.5871 18.6222 14.517C18.7756 14.447 18.8958 14.3485 18.983 14.2216C19.0701 14.0928 19.1127 13.9441 19.1108 13.7756C19.1127 13.6108 19.0758 13.4678 19 13.3466C18.9261 13.2235 18.821 13.1278 18.6847 13.0597C18.5502 12.9915 18.392 12.9574 18.2102 12.9574C18.0322 12.9574 17.8674 12.9896 17.7159 13.054C17.5644 13.1184 17.4422 13.2102 17.3494 13.3295C17.2566 13.447 17.2074 13.5871 17.2017 13.75H16.1875C16.1951 13.4242 16.2888 13.1383 16.4688 12.892C16.6506 12.6439 16.893 12.4508 17.196 12.3125C17.4991 12.1723 17.839 12.1023 18.2159 12.1023C18.6042 12.1023 18.9413 12.1752 19.2273 12.321C19.5152 12.465 19.7377 12.6591 19.8949 12.9034C20.0521 13.1477 20.1307 13.4176 20.1307 13.7131C20.1326 14.0407 20.036 14.3153 19.8409 14.5369C19.6477 14.7585 19.3939 14.9034 19.0795 14.9716V15.017C19.4886 15.0739 19.8021 15.2254 20.0199 15.4716C20.2396 15.7159 20.3485 16.0199 20.3466 16.3835C20.3466 16.7093 20.2538 17.0009 20.0682 17.2585C19.8845 17.5142 19.6307 17.715 19.3068 17.8608C18.9848 18.0066 18.6155 18.0795 18.1989 18.0795Z" fill="white"/>`,
13
+ generic: `<path fill-rule="evenodd" clip-rule="evenodd" d="M3 0C2.44772 0 2 0.447716 2 1V23C2 23.5523 2.44772 24 3 24H21C21.5523 24 22 23.5523 22 23V4L18 0H3Z" fill="#E4E7EC"/><path fill-rule="evenodd" clip-rule="evenodd" d="M18 0V4H22L18 0Z" fill="#98A2B3"/><rect x="1" y="10" width="22" height="10" rx="1" fill="#98A2B3"/>`,
14
+ };
15
+ const uploadStateSvgs = {
16
+ default: `<circle cx="16" cy="16" r="16" fill="#F0F2F5"/><path d="M12 14.3333C12 12.3083 13.6416 10.6666 15.6667 10.6666C17.4605 10.6666 18.9547 11.9554 19.2714 13.6578C19.3158 13.8965 19.4865 14.0922 19.7169 14.1686C21.0441 14.6088 22 15.8603 22 17.3333C22 19.1743 20.5076 20.6666 18.6667 20.6666C18.2985 20.6666 18 20.9651 18 21.3333C18 21.7015 18.2985 22 18.6667 22C21.244 22 23.3334 19.9106 23.3334 17.3333C23.3334 15.405 22.1642 13.7513 20.4976 13.0397C19.9273 10.9053 17.9812 9.33331 15.6667 9.33331C12.9053 9.33331 10.6667 11.5719 10.6667 14.3333C10.6667 14.4002 10.668 14.4667 10.6706 14.533C9.47367 15.2236 8.66669 16.5169 8.66669 18C8.66669 20.2091 10.4575 22 12.6667 22C13.0349 22 13.3334 21.7015 13.3334 21.3333C13.3334 20.9651 13.0349 20.6666 12.6667 20.6666C11.1939 20.6666 10 19.4727 10 18C10 16.8951 10.6721 15.9456 11.6325 15.5411C11.9103 15.424 12.0751 15.135 12.0341 14.8363C12.0117 14.6722 12 14.5043 12 14.3333Z" fill="#475367"/><path d="M15.5571 17.5017C15.8097 17.2772 16.1903 17.2772 16.4429 17.5017L17.4429 18.3906C17.7181 18.6352 17.7429 19.0566 17.4983 19.3318C17.2843 19.5725 16.935 19.6216 16.6667 19.4664V22.6666C16.6667 23.0348 16.3682 23.3333 16 23.3333C15.6318 23.3333 15.3334 23.0348 15.3334 22.6666V19.4664C15.065 19.6216 14.7157 19.5725 14.5017 19.3318C14.2571 19.0566 14.2819 18.6352 14.5571 18.3906L15.5571 17.5017Z" fill="#475367"/>`,
17
+ success: `<circle cx="16" cy="16" r="16" fill="#E7F6EC"/><path fill-rule="evenodd" clip-rule="evenodd" d="M16 23.5C20.1421 23.5 23.5 20.1421 23.5 16C23.5 11.8579 20.1421 8.5 16 8.5C11.8579 8.5 8.5 11.8579 8.5 16C8.5 20.1421 11.8579 23.5 16 23.5ZM19.0628 14.9479C19.4022 14.637 19.4254 14.1099 19.1145 13.7705C18.8037 13.4311 18.2766 13.4079 17.9372 13.7188L14.8604 16.5366L14.0628 15.8062C13.7234 15.4953 13.1963 15.5185 12.8855 15.8579C12.5746 16.1973 12.5978 16.7244 12.9372 17.0352L14.2976 18.2812C14.6161 18.5729 15.1047 18.5729 15.4233 18.2812L19.0628 14.9479Z" fill="#0F973D"/>`,
18
+ warning: `<circle cx="16" cy="16" r="16" fill="#FEF6E7"/><path fill-rule="evenodd" clip-rule="evenodd" d="M23.5 16C23.5 20.1421 20.1421 23.5 16 23.5C11.8579 23.5 8.5 20.1421 8.5 16C8.5 11.8579 11.8579 8.5 16 8.5C20.1421 8.5 23.5 11.8579 23.5 16ZM16 11C16.4602 11 16.8333 11.3731 16.8333 11.8333V17.6667C16.8333 18.1269 16.4602 18.5 16 18.5C15.5398 18.5 15.1667 18.1269 15.1667 17.6667L15.1667 11.8333C15.1667 11.3731 15.5398 11 16 11ZM14.9583 19.9583C14.9583 20.5336 15.4247 21 16 21C16.5753 21 17.0417 20.5336 17.0417 19.9583C17.0417 19.383 16.5753 18.9167 16 18.9167C15.4247 18.9167 14.9583 19.383 14.9583 19.9583Z" fill="#F3A218"/>`,
19
+ error: `<circle cx="16" cy="16" r="16" fill="#FBEAE9"/><path fill-rule="evenodd" clip-rule="evenodd" d="M10.2054 18.7851L14.4129 10.9364C15.0822 9.68788 16.9178 9.68788 17.5871 10.9364L21.7946 18.7851C22.4164 19.9451 21.5517 21.3333 20.2074 21.3333H11.7926C10.4483 21.3333 9.58363 19.9451 10.2054 18.7851ZM16 12C16.3682 12 16.6667 12.2985 16.6667 12.6667V17.3333C16.6667 17.7015 16.3682 18 16 18C15.6318 18 15.3333 17.7015 15.3333 17.3333V12.6667C15.3333 12.2985 15.6318 12 16 12ZM15.1667 19.1667C15.1667 19.6269 15.5398 20 16 20C16.4602 20 16.8333 19.6269 16.8333 19.1667C16.8333 18.7064 16.4602 18.3333 16 18.3333C15.5398 18.3333 15.1667 18.7064 15.1667 19.1667Z" fill="#D42620"/>`,
20
+ };
21
+ // ─── File Type Icon (24×24) ──────────────────────────────────────
22
+ export function FileTypeIcon({ type, className }) {
23
+ return (_jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: cn("shrink-0", className), dangerouslySetInnerHTML: { __html: fileTypeSvgs[type] } }));
24
+ }
25
+ // ─── Upload State Icon (32×32, scalable) ─────────────────────────
26
+ export function UploadStateIcon({ state, size = 32, className, }) {
27
+ return (_jsx("svg", { width: size, height: size, viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: cn("shrink-0", className), dangerouslySetInnerHTML: { __html: uploadStateSvgs[state] } }));
28
+ }
29
+ // ─── Helper: filename → FileTypeName ─────────────────────────────
30
+ export function getFileType(filename) {
31
+ const ext = filename.split(".").pop()?.toLowerCase();
32
+ switch (ext) {
33
+ case "png":
34
+ return "png";
35
+ case "jpg":
36
+ case "jpeg":
37
+ return "jpg";
38
+ case "gif":
39
+ return "gif";
40
+ case "xls":
41
+ case "xlsx":
42
+ return "xls";
43
+ case "mp3":
44
+ return "mp3";
45
+ case "pdf":
46
+ return "pdf";
47
+ default:
48
+ return "generic";
49
+ }
50
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FileUploadItem = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const cn_1 = require("../../utils/cn.cjs");
7
+ const Icon_1 = require("../Icon/index.cjs");
8
+ const ProgressCircle_1 = require("../ProgressCircle/index.cjs");
9
+ const FileUploadIcons_1 = require("./FileUploadIcons.cjs");
10
+ // ─── Helpers ─────────────────────────────────────────────────────
11
+ function formatFileSize(bytes) {
12
+ if (bytes === 0)
13
+ return "0 B";
14
+ const k = 1024;
15
+ const sizes = ["B", "KB", "MB", "GB"];
16
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
17
+ const value = bytes / Math.pow(k, i);
18
+ return `${value % 1 === 0 ? value : value.toFixed(1)} ${sizes[i]}`;
19
+ }
20
+ function formatDate(date) {
21
+ return date.toLocaleDateString("en-US", {
22
+ month: "short",
23
+ day: "numeric",
24
+ year: "numeric",
25
+ });
26
+ }
27
+ // ─── Component ───────────────────────────────────────────────────
28
+ exports.FileUploadItem = (0, react_1.forwardRef)(({ file, onRemove, onRetry, onDownload, className, ...rest }, ref) => {
29
+ const fileType = (0, FileUploadIcons_1.getFileType)(file.name);
30
+ return ((0, jsx_runtime_1.jsxs)("div", { ref: ref, className: (0, cn_1.cn)("flex items-center gap-3 py-3 border-b border-grey-100 last:border-b-0", className), ...rest, children: [(0, jsx_runtime_1.jsx)("div", { className: "flex size-10 shrink-0 items-center justify-center rounded-lg border border-grey-200 bg-surface", children: (0, jsx_runtime_1.jsx)(FileUploadIcons_1.FileTypeIcon, { type: fileType }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [(0, jsx_runtime_1.jsx)("span", { className: "truncate text-body-sm font-semibold text-grey-800", children: file.name }), file.status === "error" ? ((0, jsx_runtime_1.jsx)("span", { className: "text-body-xs font-medium text-feedback-error", children: file.error ?? "Failed to upload" })) : ((0, jsx_runtime_1.jsx)("span", { className: "text-body-xs text-on-surface-secondary", children: file.status === "complete" && file.uploadedAt
31
+ ? `${formatDate(file.uploadedAt)} \u2022 ${formatFileSize(file.size)}`
32
+ : formatFileSize(file.size) }))] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex shrink-0 items-center gap-2", children: [file.status === "pending" && ((0, jsx_runtime_1.jsx)("button", { type: "button", className: "flex size-7 items-center justify-center rounded-md text-on-surface-muted hover:bg-grey-100 cursor-pointer", "aria-label": `Remove ${file.name}`, onClick: () => onRemove?.(file.id), children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: "multiply", size: "md" }) })), file.status === "uploading" && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ProgressCircle_1.ProgressCircle, { value: file.progress ?? 0, size: "xs", showText: true, label: `Uploading ${file.name}` }), (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => onRemove?.(file.id), className: "flex size-7 items-center justify-center rounded-md text-on-surface-secondary hover:bg-grey-100 cursor-pointer", "aria-label": "Cancel upload", children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: "multiply", size: "sm" }) })] })), file.status === "complete" && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => onRemove?.(file.id), className: "flex size-7 items-center justify-center rounded-md text-on-surface-secondary hover:bg-grey-100 cursor-pointer", "aria-label": "Delete file", children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: "bin", size: "md" }) }), (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => onDownload?.(file.id), className: "flex size-7 items-center justify-center rounded-md text-on-surface-secondary hover:bg-grey-100 cursor-pointer", "aria-label": "Download file", children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: "download", size: "md" }) })] })), file.status === "error" && ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => onRetry?.(file.id), className: "text-body-xs font-semibold text-primary-500 cursor-pointer hover:text-primary-400", children: "Try again" }))] })] }));
33
+ });
34
+ exports.FileUploadItem.displayName = "FileUploadItem";