tembro 2.0.5 → 2.1.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 (381) hide show
  1. package/dist/components/calendar/calendar.cjs +1 -1
  2. package/dist/components/calendar/calendar.d.ts +2 -1
  3. package/dist/components/calendar/calendar.js +126 -122
  4. package/dist/components/calendar/date-range-picker.cjs +1 -1
  5. package/dist/components/calendar/date-range-picker.d.ts +2 -1
  6. package/dist/components/calendar/date-range-picker.js +39 -39
  7. package/dist/components/charts/charts.cjs +1 -1
  8. package/dist/components/charts/charts.d.ts +13 -4
  9. package/dist/components/charts/charts.js +76 -46
  10. package/dist/components/charts/progress-ring.cjs +1 -1
  11. package/dist/components/charts/progress-ring.d.ts +3 -1
  12. package/dist/components/charts/progress-ring.js +11 -10
  13. package/dist/components/data-table/data-table-column-visibility-menu.cjs +1 -1
  14. package/dist/components/data-table/data-table-column-visibility-menu.d.ts +4 -1
  15. package/dist/components/data-table/data-table-column-visibility-menu.js +36 -8
  16. package/dist/components/data-table/data-table-pagination.cjs +1 -1
  17. package/dist/components/data-table/data-table-pagination.js +4 -4
  18. package/dist/components/data-table/data-table-toolbar.cjs +1 -1
  19. package/dist/components/data-table/data-table-toolbar.js +12 -13
  20. package/dist/components/data-table/data-table.cjs +1 -1
  21. package/dist/components/data-table/data-table.d.ts +2 -2
  22. package/dist/components/data-table/data-table.js +2 -1
  23. package/dist/components/display/carousel.cjs +1 -1
  24. package/dist/components/display/carousel.d.ts +15 -1
  25. package/dist/components/display/carousel.js +128 -86
  26. package/dist/components/display/code-block.cjs +2 -2
  27. package/dist/components/display/code-block.d.ts +2 -1
  28. package/dist/components/display/code-block.js +17 -12
  29. package/dist/components/display/delta-badge.cjs +1 -1
  30. package/dist/components/display/delta-badge.d.ts +2 -1
  31. package/dist/components/display/delta-badge.js +11 -7
  32. package/dist/components/display/kanban.cjs +1 -1
  33. package/dist/components/display/kanban.d.ts +4 -1
  34. package/dist/components/display/kanban.js +60 -33
  35. package/dist/components/display/metric-grid.cjs +1 -1
  36. package/dist/components/display/metric-grid.d.ts +1 -0
  37. package/dist/components/display/metric-grid.js +1 -1
  38. package/dist/components/display/qr-code.cjs +1 -1
  39. package/dist/components/display/qr-code.d.ts +2 -1
  40. package/dist/components/display/qr-code.js +19 -16
  41. package/dist/components/display/smart-card.d.ts +1 -1
  42. package/dist/components/display/status-legend.d.ts +1 -1
  43. package/dist/components/display/tag.cjs +1 -1
  44. package/dist/components/display/tag.d.ts +2 -1
  45. package/dist/components/display/tag.js +28 -22
  46. package/dist/components/display/tree-view.cjs +1 -1
  47. package/dist/components/display/tree-view.d.ts +9 -1
  48. package/dist/components/display/tree-view.js +104 -40
  49. package/dist/components/display/trend-card.cjs +1 -1
  50. package/dist/components/display/trend-card.js +27 -41
  51. package/dist/components/feedback/alert.cjs +1 -1
  52. package/dist/components/feedback/alert.d.ts +2 -1
  53. package/dist/components/feedback/alert.js +6 -6
  54. package/dist/components/feedback/loading-state.cjs +1 -1
  55. package/dist/components/feedback/loading-state.d.ts +3 -1
  56. package/dist/components/feedback/loading-state.js +23 -10
  57. package/dist/components/feedback/page-state.cjs +1 -1
  58. package/dist/components/feedback/page-state.d.ts +2 -1
  59. package/dist/components/feedback/page-state.js +7 -4
  60. package/dist/components/form/form-field-shell.cjs +1 -1
  61. package/dist/components/form/form-field-shell.d.ts +4 -2
  62. package/dist/components/form/form-field-shell.js +57 -41
  63. package/dist/components/form/form-input.cjs +1 -1
  64. package/dist/components/form/form-input.d.ts +3 -4
  65. package/dist/components/form/form-input.js +259 -257
  66. package/dist/components/form/form-select.cjs +1 -1
  67. package/dist/components/form/form-select.d.ts +2 -2
  68. package/dist/components/form/form-select.js +8 -6
  69. package/dist/components/form/form-switch.cjs +1 -1
  70. package/dist/components/form/form-switch.d.ts +1 -1
  71. package/dist/components/form/form-switch.js +58 -54
  72. package/dist/components/form/form-textarea.cjs +1 -1
  73. package/dist/components/form/form-textarea.d.ts +1 -1
  74. package/dist/components/form/form-textarea.js +29 -27
  75. package/dist/components/inputs/async-select.d.ts +3 -0
  76. package/dist/components/inputs/search-input.d.ts +3 -0
  77. package/dist/components/inputs/simple-select.cjs +1 -1
  78. package/dist/components/inputs/simple-select.d.ts +10 -32
  79. package/dist/components/inputs/simple-select.js +5 -101
  80. package/dist/components/layout/app-sidebar.cjs +1 -1
  81. package/dist/components/layout/app-sidebar.d.ts +1 -0
  82. package/dist/components/layout/app-sidebar.js +36 -36
  83. package/dist/components/layout/breadcrumbs.cjs +1 -1
  84. package/dist/components/layout/breadcrumbs.d.ts +2 -1
  85. package/dist/components/layout/breadcrumbs.js +7 -7
  86. package/dist/components/modern/calendar-scheduler.cjs +1 -1
  87. package/dist/components/modern/calendar-scheduler.d.ts +5 -1
  88. package/dist/components/modern/calendar-scheduler.js +47 -28
  89. package/dist/components/modern/dual-list-picker.cjs +1 -1
  90. package/dist/components/modern/dual-list-picker.d.ts +5 -1
  91. package/dist/components/modern/dual-list-picker.js +81 -23
  92. package/dist/components/modern/rich-text-editor.cjs +1 -1
  93. package/dist/components/modern/rich-text-editor.d.ts +3 -1
  94. package/dist/components/modern/rich-text-editor.js +12 -9
  95. package/dist/components/modern/tour.cjs +1 -1
  96. package/dist/components/modern/tour.d.ts +5 -1
  97. package/dist/components/modern/tour.js +57 -35
  98. package/dist/components/navigation/command-bar.cjs +1 -1
  99. package/dist/components/navigation/command-bar.d.ts +3 -1
  100. package/dist/components/navigation/command-bar.js +10 -7
  101. package/dist/components/navigation/demo.cjs +1 -1
  102. package/dist/components/navigation/demo.js +0 -1
  103. package/dist/components/navigation/nav-tabs.cjs +1 -1
  104. package/dist/components/navigation/nav-tabs.js +39 -27
  105. package/dist/components/navigation/page-tabs.cjs +1 -1
  106. package/dist/components/navigation/page-tabs.js +41 -30
  107. package/dist/components/navigation/pagination.cjs +1 -1
  108. package/dist/components/navigation/pagination.d.ts +7 -1
  109. package/dist/components/navigation/pagination.js +48 -25
  110. package/dist/components/notifications/notification-center.cjs +1 -1
  111. package/dist/components/notifications/notification-center.d.ts +3 -1
  112. package/dist/components/notifications/notification-center.js +56 -38
  113. package/dist/components/notifications/toast.cjs +1 -1
  114. package/dist/components/notifications/toast.d.ts +1 -0
  115. package/dist/components/notifications/toast.js +4 -0
  116. package/dist/components/overlay/alert-dialog.cjs +1 -1
  117. package/dist/components/overlay/alert-dialog.js +1 -1
  118. package/dist/components/overlay/confirm-dialog.cjs +1 -1
  119. package/dist/components/overlay/confirm-dialog.d.ts +4 -2
  120. package/dist/components/overlay/confirm-dialog.js +31 -22
  121. package/dist/components/overlay/drawer.cjs +1 -1
  122. package/dist/components/overlay/drawer.d.ts +3 -1
  123. package/dist/components/overlay/drawer.js +24 -16
  124. package/dist/components/ui/accordion/index.d.ts +4 -0
  125. package/dist/components/ui/badge/index.cjs +1 -1
  126. package/dist/components/ui/badge/index.d.ts +1 -1
  127. package/dist/components/ui/badge/index.js +2 -1
  128. package/dist/components/ui/button/index.cjs +1 -1
  129. package/dist/components/ui/button/index.d.ts +2 -1
  130. package/dist/components/ui/button/index.js +13 -10
  131. package/dist/components/ui/card/index.cjs +1 -1
  132. package/dist/components/ui/card/index.d.ts +13 -2
  133. package/dist/components/ui/card/index.js +74 -49
  134. package/dist/components/ui/dialog/index.cjs +1 -1
  135. package/dist/components/ui/dialog/index.js +2 -1
  136. package/dist/components/ui/hover-card.cjs +1 -1
  137. package/dist/components/ui/hover-card.d.ts +11 -3
  138. package/dist/components/ui/hover-card.js +29 -24
  139. package/dist/components/ui/input/index.cjs +1 -1
  140. package/dist/components/ui/input/index.d.ts +9 -1
  141. package/dist/components/ui/input/index.js +63 -30
  142. package/dist/components/ui/popover/index.cjs +1 -1
  143. package/dist/components/ui/popover/index.d.ts +2 -2
  144. package/dist/components/ui/popover/index.js +6 -5
  145. package/dist/components/ui/radio-group/index.cjs +1 -1
  146. package/dist/components/ui/radio-group/index.d.ts +5 -1
  147. package/dist/components/ui/radio-group/index.js +50 -16
  148. package/dist/components/ui/right-click-menu/index.cjs +1 -1
  149. package/dist/components/ui/right-click-menu/index.d.ts +5 -1
  150. package/dist/components/ui/right-click-menu/index.js +77 -23
  151. package/dist/components/ui/segmented-control/index.cjs +1 -1
  152. package/dist/components/ui/segmented-control/index.d.ts +2 -1
  153. package/dist/components/ui/segmented-control/index.js +23 -11
  154. package/dist/components/ui/select/index.cjs +1 -1
  155. package/dist/components/ui/select/index.d.ts +40 -1
  156. package/dist/components/ui/select/index.js +159 -48
  157. package/dist/components/ui/switch/index.cjs +1 -1
  158. package/dist/components/ui/switch/index.d.ts +18 -0
  159. package/dist/components/ui/switch/index.js +47 -17
  160. package/dist/components/ui/tabs/index.cjs +1 -1
  161. package/dist/components/ui/tabs/index.d.ts +14 -4
  162. package/dist/components/ui/tabs/index.js +11 -8
  163. package/dist/components/ui/textarea/index.cjs +1 -1
  164. package/dist/components/ui/textarea/index.d.ts +10 -2
  165. package/dist/components/ui/textarea/index.js +37 -8
  166. package/dist/components/ui/textarea.cjs +1 -0
  167. package/dist/components/ui/textarea.d.ts +1 -0
  168. package/dist/components/ui/textarea.js +2 -0
  169. package/dist/components/ui/tooltip/index.cjs +1 -1
  170. package/dist/components/ui/tooltip/index.d.ts +11 -3
  171. package/dist/components/ui/tooltip/index.js +41 -20
  172. package/dist/components/upload/file-upload.cjs +1 -1
  173. package/dist/components/upload/file-upload.d.ts +8 -1
  174. package/dist/components/upload/file-upload.js +132 -100
  175. package/dist/components/upload/image-upload.cjs +1 -1
  176. package/dist/components/upload/image-upload.d.ts +5 -1
  177. package/dist/components/upload/image-upload.js +34 -9
  178. package/dist/index.cjs +1 -1
  179. package/dist/index.js +31 -31
  180. package/dist/public-component-surface.cjs +1 -1
  181. package/dist/public-component-surface.js +15 -0
  182. package/dist/showcase/component-api-schema.cjs +1 -1
  183. package/dist/showcase/component-api-schema.js +187 -10
  184. package/dist/showcase/create-demo.cjs +5 -4
  185. package/dist/showcase/create-demo.js +2 -2
  186. package/dist/showcase/fallback.cjs +3 -3
  187. package/dist/showcase/fallback.js +221 -243
  188. package/dist/showcase/premium/alert/showcase.cjs +1 -1
  189. package/dist/showcase/premium/alert/showcase.js +1 -0
  190. package/dist/showcase/premium/app-sidebar/showcase.cjs +1 -1
  191. package/dist/showcase/premium/app-sidebar/showcase.js +1 -0
  192. package/dist/showcase/premium/badge/showcase.cjs +1 -1
  193. package/dist/showcase/premium/badge/showcase.js +7 -0
  194. package/dist/showcase/premium/badge/types.d.ts +1 -1
  195. package/dist/showcase/premium/breadcrumbs/showcase.cjs +1 -1
  196. package/dist/showcase/premium/breadcrumbs/showcase.js +12 -1
  197. package/dist/showcase/premium/button/mock.cjs +1 -4
  198. package/dist/showcase/premium/button/mock.js +1 -1
  199. package/dist/showcase/premium/button/showcase.cjs +1 -1
  200. package/dist/showcase/premium/button/showcase.js +2 -2
  201. package/dist/showcase/premium/card/showcase.cjs +1 -1
  202. package/dist/showcase/premium/card/showcase.js +96 -47
  203. package/dist/showcase/premium/carousel/showcase.cjs +1 -1
  204. package/dist/showcase/premium/carousel/showcase.js +76 -49
  205. package/dist/showcase/premium/command-bar/showcase.cjs +1 -1
  206. package/dist/showcase/premium/command-bar/showcase.js +2 -0
  207. package/dist/showcase/premium/data-table/mock.cjs +12 -11
  208. package/dist/showcase/premium/data-table/mock.js +1 -1
  209. package/dist/showcase/premium/data-table/showcase.cjs +1 -1
  210. package/dist/showcase/premium/data-table/showcase.js +1 -1
  211. package/dist/showcase/premium/data-table-parts/showcase.cjs +1 -1
  212. package/dist/showcase/premium/data-table-parts/showcase.js +3 -1
  213. package/dist/showcase/premium/file-upload/showcase.cjs +1 -1
  214. package/dist/showcase/premium/file-upload/showcase.js +25 -4
  215. package/dist/showcase/premium/image-upload/showcase.cjs +1 -1
  216. package/dist/showcase/premium/image-upload/showcase.js +4 -1
  217. package/dist/showcase/premium/index.cjs +1 -1
  218. package/dist/showcase/premium/index.js +396 -402
  219. package/dist/showcase/premium/loading-state/showcase.cjs +1 -1
  220. package/dist/showcase/premium/loading-state/showcase.js +3 -1
  221. package/dist/showcase/premium/metric-grid/showcase.cjs +1 -1
  222. package/dist/showcase/premium/metric-grid/showcase.js +96 -28
  223. package/dist/showcase/premium/notification-center/showcase.cjs +1 -1
  224. package/dist/showcase/premium/notification-center/showcase.js +7 -3
  225. package/dist/showcase/premium/page-state/showcase.cjs +1 -1
  226. package/dist/showcase/premium/page-state/showcase.js +5 -1
  227. package/dist/showcase/premium/pagination/showcase.cjs +1 -1
  228. package/dist/showcase/premium/pagination/showcase.js +15 -2
  229. package/dist/showcase/premium/popover/showcase.cjs +1 -1
  230. package/dist/showcase/premium/popover/showcase.js +85 -50
  231. package/dist/showcase/premium/radio-group/showcase.cjs +1 -1
  232. package/dist/showcase/premium/radio-group/showcase.js +27 -4
  233. package/dist/showcase/premium/right-click-menu/showcase.cjs +1 -1
  234. package/dist/showcase/premium/right-click-menu/showcase.js +56 -43
  235. package/dist/showcase/premium/segmented-control/showcase.cjs +1 -1
  236. package/dist/showcase/premium/segmented-control/showcase.js +1 -0
  237. package/dist/showcase/premium/select/data.cjs +1 -1
  238. package/dist/showcase/premium/select/data.js +69 -34
  239. package/dist/showcase/premium/select/mock.cjs +20 -8
  240. package/dist/showcase/premium/select/mock.js +3 -2
  241. package/dist/showcase/premium/select/showcase.cjs +1 -1
  242. package/dist/showcase/premium/select/showcase.js +101 -86
  243. package/dist/showcase/premium/select/types.d.ts +3 -0
  244. package/dist/showcase/premium/statistic/showcase.cjs +1 -1
  245. package/dist/showcase/premium/statistic/showcase.js +57 -25
  246. package/dist/showcase/premium/switch/showcase.cjs +1 -1
  247. package/dist/showcase/premium/switch/showcase.js +25 -14
  248. package/dist/showcase/premium/tabs/showcase.cjs +1 -1
  249. package/dist/showcase/premium/tabs/showcase.js +171 -48
  250. package/dist/showcase/premium/textarea/mock.cjs +12 -4
  251. package/dist/showcase/premium/textarea/mock.js +1 -1
  252. package/dist/showcase/premium/textarea/showcase.cjs +1 -1
  253. package/dist/showcase/premium/textarea/showcase.js +8 -3
  254. package/dist/showcase/premium/toast/showcase.cjs +1 -1
  255. package/dist/showcase/premium/toast/showcase.js +32 -6
  256. package/dist/showcase/premium/types.d.ts +1 -1
  257. package/dist/showcase/registry-quality.cjs +1 -1
  258. package/dist/showcase/registry-quality.js +1 -0
  259. package/dist/showcase/registry-specific.cjs +1 -1
  260. package/dist/showcase/registry-specific.js +78 -74
  261. package/dist/showcase/render-registry-preview.cjs +1 -1
  262. package/dist/showcase/render-registry-preview.js +90 -108
  263. package/dist/showcase/site-data.cjs +1 -1
  264. package/dist/showcase/site-data.js +60 -21
  265. package/dist/showcase/tembro-registry.json.cjs +1 -1
  266. package/dist/showcase/tembro-registry.json.js +34 -20
  267. package/dist/showcase/types.d.ts +1 -1
  268. package/package.json +1 -1
  269. package/packages/cli/dist/index.cjs +31 -31
  270. package/packages/cli/vendor/src/components/calendar/calendar.tsx +59 -50
  271. package/packages/cli/vendor/src/components/calendar/date-range-picker.tsx +7 -4
  272. package/packages/cli/vendor/src/components/charts/charts.tsx +109 -66
  273. package/packages/cli/vendor/src/components/charts/progress-ring.tsx +37 -26
  274. package/packages/cli/vendor/src/components/data-table/data-table-column-visibility-menu.tsx +41 -22
  275. package/packages/cli/vendor/src/components/data-table/data-table-pagination.tsx +7 -7
  276. package/packages/cli/vendor/src/components/data-table/data-table-toolbar.tsx +8 -6
  277. package/packages/cli/vendor/src/components/data-table/data-table.tsx +21 -20
  278. package/packages/cli/vendor/src/components/display/carousel.tsx +102 -9
  279. package/packages/cli/vendor/src/components/display/code-block.tsx +22 -2
  280. package/packages/cli/vendor/src/components/display/delta-badge.tsx +11 -11
  281. package/packages/cli/vendor/src/components/display/kanban.tsx +103 -57
  282. package/packages/cli/vendor/src/components/display/metric-grid.tsx +16 -13
  283. package/packages/cli/vendor/src/components/display/qr-code.tsx +17 -15
  284. package/packages/cli/vendor/src/components/display/smart-card.tsx +1 -1
  285. package/packages/cli/vendor/src/components/display/status-legend.tsx +1 -1
  286. package/packages/cli/vendor/src/components/display/tag.tsx +39 -21
  287. package/packages/cli/vendor/src/components/display/tree-view.tsx +221 -84
  288. package/packages/cli/vendor/src/components/display/trend-card.tsx +6 -40
  289. package/packages/cli/vendor/src/components/feedback/alert.tsx +3 -1
  290. package/packages/cli/vendor/src/components/feedback/loading-state.tsx +33 -17
  291. package/packages/cli/vendor/src/components/feedback/page-state.tsx +8 -7
  292. package/packages/cli/vendor/src/components/form/form-field-shell.tsx +37 -8
  293. package/packages/cli/vendor/src/components/form/form-input.tsx +11 -12
  294. package/packages/cli/vendor/src/components/form/form-select.tsx +6 -4
  295. package/packages/cli/vendor/src/components/form/form-switch.tsx +9 -3
  296. package/packages/cli/vendor/src/components/form/form-textarea.tsx +6 -2
  297. package/packages/cli/vendor/src/components/inputs/async-select.tsx +11 -8
  298. package/packages/cli/vendor/src/components/inputs/search-input.tsx +5 -2
  299. package/packages/cli/vendor/src/components/inputs/simple-select.tsx +20 -190
  300. package/packages/cli/vendor/src/components/layout/app-sidebar.tsx +3 -1
  301. package/packages/cli/vendor/src/components/layout/breadcrumbs.tsx +3 -1
  302. package/packages/cli/vendor/src/components/modern/calendar-scheduler.tsx +28 -13
  303. package/packages/cli/vendor/src/components/modern/dual-list-picker.tsx +103 -35
  304. package/packages/cli/vendor/src/components/modern/rich-text-editor.tsx +25 -22
  305. package/packages/cli/vendor/src/components/modern/tour.tsx +47 -29
  306. package/packages/cli/vendor/src/components/navigation/command-bar.tsx +6 -0
  307. package/packages/cli/vendor/src/components/navigation/demo.tsx +0 -1
  308. package/packages/cli/vendor/src/components/navigation/nav-tabs.tsx +38 -29
  309. package/packages/cli/vendor/src/components/navigation/page-tabs.tsx +35 -23
  310. package/packages/cli/vendor/src/components/navigation/pagination.tsx +65 -31
  311. package/packages/cli/vendor/src/components/notifications/notification-center.tsx +64 -39
  312. package/packages/cli/vendor/src/components/notifications/toast.tsx +23 -21
  313. package/packages/cli/vendor/src/components/overlay/alert-dialog.tsx +1 -1
  314. package/packages/cli/vendor/src/components/overlay/confirm-dialog.tsx +45 -22
  315. package/packages/cli/vendor/src/components/overlay/drawer.tsx +18 -5
  316. package/packages/cli/vendor/src/components/ui/accordion/index.tsx +4 -0
  317. package/packages/cli/vendor/src/components/ui/badge/index.tsx +2 -1
  318. package/packages/cli/vendor/src/components/ui/button/index.tsx +11 -5
  319. package/packages/cli/vendor/src/components/ui/card/index.tsx +95 -25
  320. package/packages/cli/vendor/src/components/ui/dialog/index.tsx +2 -1
  321. package/packages/cli/vendor/src/components/ui/hover-card.tsx +54 -28
  322. package/packages/cli/vendor/src/components/ui/input/index.tsx +98 -0
  323. package/packages/cli/vendor/src/components/ui/popover/index.tsx +10 -8
  324. package/packages/cli/vendor/src/components/ui/radio-group/index.tsx +55 -6
  325. package/packages/cli/vendor/src/components/ui/right-click-menu/index.tsx +120 -9
  326. package/packages/cli/vendor/src/components/ui/segmented-control/index.tsx +29 -3
  327. package/packages/cli/vendor/src/components/ui/select/index.tsx +260 -34
  328. package/packages/cli/vendor/src/components/ui/switch/index.tsx +71 -6
  329. package/packages/cli/vendor/src/components/ui/tabs/index.tsx +22 -6
  330. package/packages/cli/vendor/src/components/ui/textarea/index.tsx +105 -15
  331. package/packages/cli/vendor/src/components/ui/textarea.tsx +2 -0
  332. package/packages/cli/vendor/src/components/ui/tooltip/index.tsx +67 -22
  333. package/packages/cli/vendor/src/components/upload/file-upload.tsx +120 -57
  334. package/packages/cli/vendor/src/components/upload/image-upload.tsx +71 -24
  335. package/packages/cli/vendor/src/public-component-surface.ts +3 -0
  336. package/packages/cli/vendor/src/showcase/component-api-schema.ts +79 -41
  337. package/packages/cli/vendor/src/showcase/create-demo.tsx +16 -15
  338. package/packages/cli/vendor/src/showcase/fallback.tsx +4 -19
  339. package/packages/cli/vendor/src/showcase/premium/alert/showcase.tsx +1 -0
  340. package/packages/cli/vendor/src/showcase/premium/app-sidebar/showcase.tsx +1 -0
  341. package/packages/cli/vendor/src/showcase/premium/badge/showcase.tsx +4 -2
  342. package/packages/cli/vendor/src/showcase/premium/badge/types.ts +1 -1
  343. package/packages/cli/vendor/src/showcase/premium/breadcrumbs/showcase.tsx +3 -1
  344. package/packages/cli/vendor/src/showcase/premium/button/mock.ts +2 -5
  345. package/packages/cli/vendor/src/showcase/premium/button/showcase.tsx +2 -2
  346. package/packages/cli/vendor/src/showcase/premium/card/showcase.tsx +26 -1
  347. package/packages/cli/vendor/src/showcase/premium/carousel/showcase.tsx +19 -3
  348. package/packages/cli/vendor/src/showcase/premium/command-bar/showcase.tsx +1 -1
  349. package/packages/cli/vendor/src/showcase/premium/data-table/mock.ts +26 -25
  350. package/packages/cli/vendor/src/showcase/premium/data-table/showcase.tsx +3 -3
  351. package/packages/cli/vendor/src/showcase/premium/data-table-parts/showcase.tsx +3 -3
  352. package/packages/cli/vendor/src/showcase/premium/file-upload/showcase.tsx +21 -1
  353. package/packages/cli/vendor/src/showcase/premium/image-upload/showcase.tsx +4 -1
  354. package/packages/cli/vendor/src/showcase/premium/index.ts +0 -2
  355. package/packages/cli/vendor/src/showcase/premium/loading-state/showcase.tsx +1 -1
  356. package/packages/cli/vendor/src/showcase/premium/metric-grid/showcase.tsx +36 -4
  357. package/packages/cli/vendor/src/showcase/premium/notification-center/showcase.tsx +4 -3
  358. package/packages/cli/vendor/src/showcase/premium/page-state/showcase.tsx +1 -0
  359. package/packages/cli/vendor/src/showcase/premium/pagination/showcase.tsx +13 -1
  360. package/packages/cli/vendor/src/showcase/premium/popover/showcase.tsx +27 -11
  361. package/packages/cli/vendor/src/showcase/premium/radio-group/showcase.tsx +13 -1
  362. package/packages/cli/vendor/src/showcase/premium/right-click-menu/showcase.tsx +8 -5
  363. package/packages/cli/vendor/src/showcase/premium/segmented-control/showcase.tsx +1 -0
  364. package/packages/cli/vendor/src/showcase/premium/select/data.ts +12 -3
  365. package/packages/cli/vendor/src/showcase/premium/select/mock.ts +4 -4
  366. package/packages/cli/vendor/src/showcase/premium/select/showcase.tsx +35 -22
  367. package/packages/cli/vendor/src/showcase/premium/select/types.ts +3 -0
  368. package/packages/cli/vendor/src/showcase/premium/statistic/showcase.tsx +10 -1
  369. package/packages/cli/vendor/src/showcase/premium/switch/showcase.tsx +15 -6
  370. package/packages/cli/vendor/src/showcase/premium/tabs/showcase.tsx +48 -1
  371. package/packages/cli/vendor/src/showcase/premium/textarea/mock.ts +12 -4
  372. package/packages/cli/vendor/src/showcase/premium/textarea/showcase.tsx +5 -0
  373. package/packages/cli/vendor/src/showcase/premium/toast/showcase.tsx +17 -1
  374. package/packages/cli/vendor/src/showcase/premium/types.ts +1 -1
  375. package/packages/cli/vendor/src/showcase/registry-quality.ts +3 -2
  376. package/packages/cli/vendor/src/showcase/registry-specific.tsx +7 -8
  377. package/packages/cli/vendor/src/showcase/render-registry-preview.tsx +5 -21
  378. package/packages/cli/vendor/src/showcase/site-data.tsx +21 -15
  379. package/packages/cli/vendor/src/showcase/tembro-registry.json +42 -20
  380. package/packages/cli/vendor/src/showcase/types.ts +1 -1
  381. package/registry.json +18 -6
@@ -1,25 +1,46 @@
1
1
  import { cn as e } from "../../../lib/utils.js";
2
- import "react";
3
- import { jsx as t, jsxs as n } from "react/jsx-runtime";
2
+ import * as t from "react";
3
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
+ import { Tooltip as i } from "@base-ui/react/tooltip";
4
5
  //#region src/components/ui/tooltip/index.tsx
5
- var r = {
6
- top: "bottom-full left-1/2 mb-2 -translate-x-1/2",
7
- bottom: "left-1/2 top-full mt-2 -translate-x-1/2",
8
- left: "right-full top-1/2 mr-2 -translate-y-1/2",
9
- right: "left-full top-1/2 ml-2 -translate-y-1/2"
10
- };
11
- function i({ content: i, side: a = "top", disabled: o = !1, className: s, children: c, ...l }) {
12
- return /* @__PURE__ */ n("span", {
13
- "data-slot": "tooltip",
14
- className: e("group/tooltip relative inline-flex", s),
15
- ...l,
16
- children: [c, !o && /* @__PURE__ */ t("span", {
17
- "data-slot": "tooltip-content",
18
- role: "tooltip",
19
- className: e("pointer-events-none absolute z-50 hidden max-w-64 whitespace-nowrap rounded-xl border border-border/75 bg-popover/98 px-2.5 py-1.5 text-[11px] font-medium text-popover-foreground shadow-[0_16px_42px_color-mix(in_oklch,var(--foreground),transparent_86%)] backdrop-blur group-hover/tooltip:block group-focus-within/tooltip:block", r[a]),
20
- children: i
21
- })]
6
+ function a(e) {
7
+ return typeof e == "string" || typeof e == "number" ? String(e) : Array.isArray(e) ? e.map(a).join("") : t.isValidElement(e) ? a(e.props.children) : "";
8
+ }
9
+ function o({ content: o, side: s = "top", align: c = "center", sideOffset: l = 8, alignOffset: u = 0, collisionPadding: d = 8, delay: f = 500, closeDelay: p = 0, disabled: m = !1, className: h, children: g, ..._ }) {
10
+ let v = t.isValidElement(g) ? g : /* @__PURE__ */ n("span", {
11
+ className: "inline-flex",
12
+ children: g
13
+ }), y = a(o), b = !m && y.length > 0 && !a(g).includes(y);
14
+ return /* @__PURE__ */ r(i.Root, {
15
+ disabled: m,
16
+ children: [/* @__PURE__ */ r(i.Trigger, {
17
+ "data-slot": "tooltip-trigger",
18
+ delay: f,
19
+ closeDelay: p,
20
+ disabled: m,
21
+ render: /* @__PURE__ */ n("span", {
22
+ "data-slot": "tooltip",
23
+ className: e("inline-flex", h),
24
+ ..._
25
+ }),
26
+ children: [v, b ? /* @__PURE__ */ n("span", {
27
+ className: "sr-only",
28
+ children: o
29
+ }) : null]
30
+ }), /* @__PURE__ */ n(i.Portal, { children: /* @__PURE__ */ n(i.Positioner, {
31
+ className: "isolate z-50",
32
+ side: s,
33
+ align: c,
34
+ sideOffset: l,
35
+ alignOffset: u,
36
+ collisionPadding: d,
37
+ children: /* @__PURE__ */ n(i.Popup, {
38
+ "data-slot": "tooltip-content",
39
+ className: "z-50 max-w-64 origin-(--transform-origin) rounded-[var(--radius-lg)] border border-border/75 bg-popover/98 px-2.5 py-1.5 text-[11px] font-medium leading-4 text-popover-foreground shadow-[0_16px_42px_color-mix(in_oklch,var(--foreground),transparent_86%)] outline-hidden backdrop-blur duration-100 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
40
+ children: o
41
+ })
42
+ }) })]
22
43
  });
23
44
  }
24
45
  //#endregion
25
- export { i as Tooltip };
46
+ export { o as Tooltip };
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/utils.cjs"),n=require("../ui/button/index.cjs");let r=require("react");r=e.__toESM(r,1);let i=require("lucide-react"),a=require("react/jsx-runtime");function o(e){if(e===0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`],n=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1),r=e/1024**n;return`${r.toFixed(r>=10||n===0?0:1)} ${t[n]}`}function s(e){return e?.split(`,`).map(e=>e.trim().toLowerCase()).filter(Boolean)??[]}function c(e,t){let n=s(t);if(n.length===0)return!0;let r=e.name.toLowerCase(),i=e.type.toLowerCase();return n.some(e=>e.startsWith(`.`)?r.endsWith(e):e.endsWith(`/*`)?i.startsWith(e.slice(0,-1)):i===e)}function l(e){return`${e.name}-${e.size}-${e.lastModified}`}function u(e,t){return typeof e==`number`?e:e?.[l(t)]??e?.[t.name]}function d(e,t,n){let r=n?.[e],i={...t,reason:e};if(typeof r==`function`)return r(i);if(typeof r==`string`)return r;switch(e){case`max-files`:return`Maximum ${t.maxFiles} file${t.maxFiles===1?``:`s`} allowed.`;case`max-size`:return`File is larger than ${o(t.maxSize??0)}.`;case`type`:return t.accept?`File type is not allowed. Expected: ${t.accept}.`:`File type is not allowed.`}}function f({currentFiles:e,incomingFiles:t,accept:n,maxFiles:r,maxSize:i,appendFiles:a,rejectionMessages:o}){let s=[],l=[],u=a?e:[],f=r??(a?void 0:t.length);for(let e of t){if(f!==void 0&&u.length+s.length>=f){l.push({file:e,reason:`max-files`,message:d(`max-files`,{file:e,maxFiles:f,maxSize:i,accept:n},o)});continue}if(i!==void 0&&e.size>i){l.push({file:e,reason:`max-size`,message:d(`max-size`,{file:e,maxFiles:f,maxSize:i,accept:n},o)});continue}if(!c(e,n)){l.push({file:e,reason:`type`,message:d(`type`,{file:e,maxFiles:f,maxSize:i,accept:n},o)});continue}s.push(e)}return{accepted:s,rejected:l,nextFiles:a?[...e,...s]:s}}function p({file:e,progress:r,remove:s,removeLabel:c=`Remove file`}){return(0,a.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,a.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-full border border-border/70 bg-background/90 shadow-sm`,children:(0,a.jsx)(i.FileIcon,{className:`size-4 text-muted-foreground`})}),(0,a.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,a.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:e.name}),(0,a.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:o(e.size)}),typeof r==`number`&&(0,a.jsx)(`div`,{className:`mt-2 h-1.5 overflow-hidden rounded-full bg-muted/80`,children:(0,a.jsx)(`div`,{className:`h-full rounded-full bg-primary shadow-[0_8px_18px_color-mix(in_oklch,var(--primary),transparent_82%)]`,style:{width:`${Math.min(Math.max(r,0),100)}%`}})})]}),(0,a.jsxs)(n.Button,{type:`button`,variant:`ghost`,size:`icon-xs`,className:`rounded-full`,onClick:e=>{t.stopInteractivePropagation(e),s()},onMouseDown:t.stopInteractivePropagation,onDoubleClick:t.stopInteractivePropagation,children:[(0,a.jsx)(i.XIcon,{}),(0,a.jsx)(`span`,{className:`sr-only`,children:c})]})]})}function m({files:e=[],onFilesChange:s,rejectedFiles:c,onRejectedFilesChange:l,buttonLabel:d=`Choose files`,dropzoneLabel:m=`Drop files here or click to upload`,dropzoneDescription:h,dragActiveLabel:g=`Drop files to upload`,helperText:_,clearLabel:v=`Clear all`,removeLabel:ee=`Remove file`,dropzoneAriaLabel:y,rejectionMessages:b,maxFiles:x,maxSize:S,appendFiles:C=!0,showFileList:w=!0,showClearButton:T=!0,loading:te=!1,progress:ne,renderFile:re,renderRejectedFile:ie,renderActions:ae,className:oe,inputClassName:E,dropzoneClassName:D,fileListClassName:O,fileItemClassName:k,rejectedListClassName:A,accept:j,multiple:M,disabled:N,onDragEnter:P,onDragLeave:F,onDragOver:I,onDrop:L,...R}){let z=r.useRef(null),B=r.useRef(0),[V,H]=r.useState(!1),[U,W]=r.useState([]),G=c??U,K=N||te,q=M??x!==1;r.useEffect(()=>{K&&(B.current=0,H(!1))},[K]);let J=r.useCallback(e=>{c===void 0&&W(e),l?.(e)},[l,c]),Y=r.useCallback(()=>{K||z.current?.click()},[K]),X=r.useCallback(()=>{s?.([]),J([])},[s,J]),Z=r.useCallback(t=>{let n=f({currentFiles:e,incomingFiles:t,accept:j,maxFiles:x,maxSize:S,appendFiles:C,rejectionMessages:b});s?.(n.nextFiles),J(n.rejected)},[j,C,e,x,S,s,b,J]),se=r.useCallback(t=>{s?.(e.filter((e,n)=>n!==t))},[e,s]),ce=e=>{K||(Z(Array.from(e.target.files??[])),e.target.value=``)},Q=e=>K?(e.preventDefault(),t.stopInteractivePropagation(e),!0):!1,le=e=>{P?.(e),!(e.defaultPrevented||Q(e))&&(e.preventDefault(),B.current+=1,H(!0))},$=e=>{F?.(e),!(e.defaultPrevented||Q(e))&&(B.current=Math.max(B.current-1,0),B.current===0&&H(!1))},ue=e=>{I?.(e),!(e.defaultPrevented||Q(e))&&e.preventDefault()},de=e=>{L?.(e),!(e.defaultPrevented||Q(e))&&(e.preventDefault(),B.current=0,H(!1),Z(Array.from(e.dataTransfer.files??[])))};return(0,a.jsxs)(`div`,{"data-slot":`file-upload`,className:t.cn(`grid gap-3`,oe),children:[(0,a.jsx)(`input`,{ref:z,type:`file`,className:t.cn(`sr-only`,E),disabled:K,accept:j,multiple:q,onChange:ce,...R}),(0,a.jsxs)(`div`,{"data-slot":`file-upload-dropzone`,"data-dragging":V||void 0,"data-disabled":K||void 0,role:`button`,"aria-disabled":K||void 0,"aria-label":y,tabIndex:K?-1:0,className:t.cn(`grid cursor-pointer gap-4 rounded-[var(--radius-2xl)] border border-dashed border-border/80 bg-[linear-gradient(180deg,color-mix(in_oklch,var(--card),white_12%),var(--card))] p-6 text-center shadow-sm ring-1 ring-foreground/5 outline-none transition-[background-color,border-color,box-shadow,transform] hover:-translate-y-px hover:border-primary/35 hover:bg-muted/25 hover:shadow-[0_14px_36px_rgba(15,23,42,0.08)] focus-visible:ring-2 focus-visible:ring-ring data-[dragging=true]:border-primary data-[dragging=true]:bg-primary/6 data-[dragging=true]:shadow-[0_18px_50px_color-mix(in_oklch,var(--primary),transparent_84%)] data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-60`,D),onClick:Y,onKeyDown:e=>{K||(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),Y())},onDragEnter:le,onDragLeave:$,onDragOver:ue,onDrop:de,children:[(0,a.jsx)(`div`,{className:`mx-auto flex size-13 items-center justify-center rounded-full border border-border/75 bg-[linear-gradient(180deg,color-mix(in_oklch,var(--background),white_14%),var(--background))] text-muted-foreground shadow-[0_1px_0_rgba(255,255,255,0.12),0_10px_24px_rgba(15,23,42,0.06)]`,children:(0,a.jsx)(i.UploadCloudIcon,{className:`size-5`})}),(0,a.jsxs)(`div`,{className:`grid gap-1`,children:[(0,a.jsx)(`div`,{className:`text-sm font-semibold text-foreground`,children:V?g:m}),h&&(0,a.jsx)(`div`,{className:`text-sm leading-6 text-muted-foreground`,children:h}),(j||S||x||_)&&(0,a.jsx)(`div`,{className:`text-xs leading-5 text-muted-foreground`,children:_??[j?`Types: ${j}`:null,S?`Max size: ${o(S)}`:null,x?`Max files: ${x}`:null].filter(Boolean).join(` • `)})]}),ae?.({openFileDialog:Y,clearFiles:X,files:e})??(0,a.jsxs)(`div`,{className:`flex justify-center gap-2`,children:[(0,a.jsx)(n.Button,{type:`button`,variant:`outline`,size:`sm`,disabled:K,onClick:e=>{t.stopInteractivePropagation(e),Y()},onMouseDown:t.stopInteractivePropagation,onDoubleClick:t.stopInteractivePropagation,children:d}),T&&e.length>0&&(0,a.jsx)(n.Button,{type:`button`,variant:`ghost`,size:`sm`,disabled:K,onClick:e=>{t.stopInteractivePropagation(e),X()},onMouseDown:t.stopInteractivePropagation,onDoubleClick:t.stopInteractivePropagation,children:v})]})]}),w&&e.length>0&&(0,a.jsx)(`div`,{"data-slot":`file-upload-list`,className:t.cn(`grid gap-2`,O),children:e.map((e,n)=>{let r={file:e,index:n,progress:u(ne,e),remove:()=>se(n),removeLabel:ee};return(0,a.jsx)(`div`,{"data-slot":`file-upload-item`,className:t.cn(`rounded-[min(var(--radius-xl),18px)] border border-border/80 bg-[linear-gradient(180deg,color-mix(in_oklch,var(--card),white_10%),var(--card))] p-3.5 shadow-sm ring-1 ring-foreground/5`,k),children:re?.(r)??p(r)},`${e.name}-${e.lastModified}-${n}`)})}),G.length>0&&(0,a.jsx)(`div`,{"data-slot":`file-upload-rejected-list`,className:t.cn(`grid gap-2`,A),children:G.map((e,t)=>(0,a.jsx)(`div`,{className:`rounded-[min(var(--radius-lg),12px)] border border-destructive/22 bg-destructive/8 px-3 py-2.5 text-xs leading-5 text-destructive shadow-[inset_0_1px_0_rgba(255,255,255,0.08)]`,children:ie?.({rejectedFile:e,index:t})??(0,a.jsxs)(`span`,{children:[e.file.name,`: `,e.message]})},`${e.file.name}-${t}`))})]})}exports.FileUpload=m,exports.fileMatchesAccept=c,exports.formatBytes=o,exports.getFileKey=l;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/utils.cjs"),n=require("../ui/button/index.cjs");let r=require("react");r=e.__toESM(r,1);let i=require("lucide-react"),a=require("react/jsx-runtime");function o(e){if(e===0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`],n=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1),r=e/1024**n;return`${r.toFixed(r>=10||n===0?0:1)} ${t[n]}`}function s(e){return e?.split(`,`).map(e=>e.trim().toLowerCase()).filter(Boolean)??[]}function c(e,t){let n=s(t);if(n.length===0)return!0;let r=e.name.toLowerCase(),i=e.type.toLowerCase();return n.some(e=>e.startsWith(`.`)?r.endsWith(e):e.endsWith(`/*`)?i.startsWith(e.slice(0,-1)):i===e)}function l(e){return`${e.name}-${e.size}-${e.lastModified}`}function u(e,t){return typeof e==`number`?e:e?.[l(t)]??e?.[t.name]}function d(e,t){return typeof e==`string`?e:e?.[l(t)]??e?.[t.name]??`idle`}function f(e,t,n){let r=n?.[e],i={...t,reason:e};if(typeof r==`function`)return r(i);if(typeof r==`string`)return r;switch(e){case`max-files`:return`Maximum ${t.maxFiles} file${t.maxFiles===1?``:`s`} allowed.`;case`max-size`:return`File is larger than ${o(t.maxSize??0)}.`;case`type`:return t.accept?`File type is not allowed. Expected: ${t.accept}.`:`File type is not allowed.`}}function p({currentFiles:e,incomingFiles:t,accept:n,maxFiles:r,maxSize:i,appendFiles:a,rejectionMessages:o,validateFile:s}){let l=[],u=[],d=a?e:[],p=r??(a?void 0:t.length);for(let e of t){if(p!==void 0&&d.length+l.length>=p){u.push({file:e,reason:`max-files`,message:f(`max-files`,{file:e,maxFiles:p,maxSize:i,accept:n},o)});continue}if(i!==void 0&&e.size>i){u.push({file:e,reason:`max-size`,message:f(`max-size`,{file:e,maxFiles:p,maxSize:i,accept:n},o)});continue}if(!c(e,n)){u.push({file:e,reason:`type`,message:f(`type`,{file:e,maxFiles:p,maxSize:i,accept:n},o)});continue}let t=s?.(e);if(typeof t==`string`&&t){u.push({file:e,reason:`type`,message:t});continue}l.push(e)}return{accepted:l,rejected:u,nextFiles:a?[...e,...l]:l}}function m({file:e,progress:r,status:s,remove:c,retry:l,removeLabel:u=`Remove file`}){return(0,a.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,a.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-full border border-border/70 bg-background/90 shadow-sm`,children:(0,a.jsx)(i.FileIcon,{className:`size-4 text-muted-foreground`})}),(0,a.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,a.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,a.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:e.name}),(0,a.jsx)(`span`,{className:t.cn(`rounded-full px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.16em]`,s===`uploading`&&`bg-primary/10 text-primary`,s===`success`&&`bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`,s===`error`&&`bg-destructive/10 text-destructive`,s===`idle`&&`bg-muted text-muted-foreground`),children:s})]}),(0,a.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:o(e.size)}),typeof r==`number`&&(0,a.jsx)(`div`,{className:`mt-2 h-1.5 overflow-hidden rounded-full bg-muted/80`,children:(0,a.jsx)(`div`,{className:`h-full rounded-full bg-primary shadow-[0_8px_18px_color-mix(in_oklch,var(--primary),transparent_82%)]`,style:{width:`${Math.min(Math.max(r,0),100)}%`}})})]}),s===`error`&&l?(0,a.jsx)(n.Button,{type:`button`,variant:`outline`,size:`sm`,className:`rounded-full`,onClick:l,children:`Retry`}):null,(0,a.jsxs)(n.Button,{type:`button`,variant:`ghost`,size:`icon-xs`,className:`rounded-full`,onClick:e=>{t.stopInteractivePropagation(e),c()},onMouseDown:t.stopInteractivePropagation,onDoubleClick:t.stopInteractivePropagation,children:[(0,a.jsx)(i.XIcon,{}),(0,a.jsx)(`span`,{className:`sr-only`,children:u})]})]})}function h({files:e=[],onFilesChange:s,rejectedFiles:c,onRejectedFilesChange:l,buttonLabel:f=`Choose files`,dropzoneLabel:h=`Drop files here or click to upload`,dropzoneDescription:g,dragActiveLabel:_=`Drop files to upload`,helperText:v,clearLabel:ee=`Clear all`,removeLabel:te=`Remove file`,dropzoneAriaLabel:ne,rejectionMessages:y,maxFiles:b,maxSize:x,appendFiles:S=!0,showFileList:C=!0,showClearButton:re=!0,loading:ie=!1,progress:w,status:T,validateFile:E,onRetryFile:D,fileTriggerLabel:O=`Open file picker`,renderFile:ae,renderRejectedFile:oe,renderActions:se,className:ce,inputClassName:k,dropzoneClassName:A,fileListClassName:j,fileItemClassName:M,rejectedListClassName:N,accept:P,multiple:F,disabled:I,onDragEnter:L,onDragLeave:R,onDragOver:z,onDrop:B,...V}){let H=r.useRef(null),U=r.useRef(0),[W,G]=r.useState(!1),[le,ue]=r.useState([]),K=c??le,q=I||ie,de=F??b!==1;r.useEffect(()=>{q&&(U.current=0,G(!1))},[q]);let J=r.useCallback(e=>{c===void 0&&ue(e),l?.(e)},[l,c]),Y=r.useCallback(()=>{q||H.current?.click()},[q]),X=r.useCallback(()=>{s?.([]),J([])},[s,J]),Z=r.useCallback(t=>{let n=p({currentFiles:e,incomingFiles:t,accept:P,maxFiles:b,maxSize:x,appendFiles:S,rejectionMessages:y,validateFile:E});s?.(n.nextFiles),J(n.rejected)},[P,S,e,b,x,s,y,J,E]),fe=r.useCallback(t=>{s?.(e.filter((e,n)=>n!==t))},[e,s]),Q=e=>{q||(Z(Array.from(e.target.files??[])),e.target.value=``)},$=e=>q?(e.preventDefault(),t.stopInteractivePropagation(e),!0):!1,pe=e=>{L?.(e),!(e.defaultPrevented||$(e))&&(e.preventDefault(),U.current+=1,G(!0))},me=e=>{R?.(e),!(e.defaultPrevented||$(e))&&(U.current=Math.max(U.current-1,0),U.current===0&&G(!1))},he=e=>{z?.(e),!(e.defaultPrevented||$(e))&&e.preventDefault()},ge=e=>{B?.(e),!(e.defaultPrevented||$(e))&&(e.preventDefault(),U.current=0,G(!1),Z(Array.from(e.dataTransfer.files??[])))};return(0,a.jsxs)(`div`,{"data-slot":`file-upload`,className:t.cn(`grid gap-3`,ce),children:[(0,a.jsx)(`input`,{ref:H,type:`file`,className:t.cn(`sr-only`,k),disabled:q,accept:P,multiple:de,onChange:Q,...V}),(0,a.jsxs)(`div`,{"data-slot":`file-upload-dropzone`,"data-dragging":W||void 0,"data-disabled":q||void 0,role:`button`,"aria-disabled":q||void 0,"aria-label":ne??O,tabIndex:q?-1:0,className:t.cn(`grid cursor-pointer gap-4 rounded-[var(--radius-2xl)] border border-dashed border-border/80 bg-[linear-gradient(180deg,color-mix(in_oklch,var(--card),white_12%),var(--card))] p-6 text-center shadow-sm ring-1 ring-foreground/5 outline-none transition-[background-color,border-color,box-shadow,transform] hover:-translate-y-px hover:border-primary/35 hover:bg-muted/25 hover:shadow-[0_14px_36px_rgba(15,23,42,0.08)] focus-visible:ring-2 focus-visible:ring-ring data-[dragging=true]:border-primary data-[dragging=true]:bg-primary/6 data-[dragging=true]:shadow-[0_18px_50px_color-mix(in_oklch,var(--primary),transparent_84%)] data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-60`,A),onClick:Y,onKeyDown:e=>{q||(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),Y())},onDragEnter:pe,onDragLeave:me,onDragOver:he,onDrop:ge,children:[(0,a.jsx)(`div`,{className:`mx-auto flex size-13 items-center justify-center rounded-full border border-border/75 bg-[linear-gradient(180deg,color-mix(in_oklch,var(--background),white_14%),var(--background))] text-muted-foreground shadow-[0_1px_0_rgba(255,255,255,0.12),0_10px_24px_rgba(15,23,42,0.06)]`,children:(0,a.jsx)(i.UploadCloudIcon,{className:`size-5`})}),(0,a.jsxs)(`div`,{className:`grid gap-1`,children:[(0,a.jsx)(`div`,{className:`text-sm font-semibold text-foreground`,children:W?_:h}),g&&(0,a.jsx)(`div`,{className:`text-sm leading-6 text-muted-foreground`,children:g}),(P||x||b||v)&&(0,a.jsx)(`div`,{className:`text-xs leading-5 text-muted-foreground`,children:v??[P?`Types: ${P}`:null,x?`Max size: ${o(x)}`:null,b?`Max files: ${b}`:null].filter(Boolean).join(` • `)})]}),se?.({openFileDialog:Y,clearFiles:X,files:e})??(0,a.jsxs)(`div`,{className:`flex justify-center gap-2`,children:[(0,a.jsx)(n.Button,{type:`button`,variant:`outline`,size:`sm`,disabled:q,"aria-label":typeof f==`string`?f:O,onClick:e=>{t.stopInteractivePropagation(e),Y()},onMouseDown:t.stopInteractivePropagation,onDoubleClick:t.stopInteractivePropagation,children:f}),re&&e.length>0&&(0,a.jsx)(n.Button,{type:`button`,variant:`ghost`,size:`sm`,disabled:q,onClick:e=>{t.stopInteractivePropagation(e),X()},onMouseDown:t.stopInteractivePropagation,onDoubleClick:t.stopInteractivePropagation,children:ee})]})]}),C&&e.length>0&&(0,a.jsx)(`div`,{"data-slot":`file-upload-list`,className:t.cn(`grid gap-2`,j),children:e.map((e,n)=>{let r={file:e,index:n,progress:u(w,e),status:d(T,e),remove:()=>fe(n),retry:D?()=>D(e,n):void 0,removeLabel:te};return(0,a.jsx)(`div`,{"data-slot":`file-upload-item`,"data-status":r.status,className:t.cn(`rounded-[min(var(--radius-xl),18px)] border border-border/80 bg-[linear-gradient(180deg,color-mix(in_oklch,var(--card),white_10%),var(--card))] p-3.5 shadow-sm ring-1 ring-foreground/5`,M),children:ae?.(r)??m(r)},`${e.name}-${e.lastModified}-${n}`)})}),K.length>0&&(0,a.jsx)(`div`,{"data-slot":`file-upload-rejected-list`,className:t.cn(`grid gap-2`,N),children:K.map((e,t)=>(0,a.jsx)(`div`,{className:`rounded-[min(var(--radius-lg),12px)] border border-destructive/22 bg-destructive/8 px-3 py-2.5 text-xs leading-5 text-destructive shadow-[inset_0_1px_0_rgba(255,255,255,0.08)]`,children:oe?.({rejectedFile:e,index:t})??(0,a.jsxs)(`span`,{children:[e.file.name,`: `,e.message]})},`${e.file.name}-${t}`))})]})}exports.FileUpload=h,exports.fileMatchesAccept=c,exports.formatBytes=o,exports.getFileKey=l;
@@ -1,5 +1,6 @@
1
1
  import * as React from "react";
2
2
  export type FileUploadRejectReason = "max-files" | "max-size" | "type";
3
+ export type FileUploadItemStatus = "idle" | "uploading" | "success" | "error";
3
4
  export type FileUploadRejectedFile = {
4
5
  file: File;
5
6
  reason: FileUploadRejectReason;
@@ -17,7 +18,9 @@ export type FileUploadRenderFileState = {
17
18
  file: File;
18
19
  index: number;
19
20
  progress?: number;
21
+ status: FileUploadItemStatus;
20
22
  remove: () => void;
23
+ retry?: () => void;
21
24
  removeLabel?: string;
22
25
  };
23
26
  export type FileUploadRenderRejectedFileState = {
@@ -50,6 +53,10 @@ export type FileUploadProps = NativeFileInputProps & {
50
53
  showClearButton?: boolean;
51
54
  loading?: boolean;
52
55
  progress?: number | Record<string, number>;
56
+ status?: FileUploadItemStatus | Record<string, FileUploadItemStatus>;
57
+ validateFile?: (file: File) => string | null | Promise<string | null>;
58
+ onRetryFile?: (file: File, index: number) => void;
59
+ fileTriggerLabel?: string;
53
60
  renderFile?: (state: FileUploadRenderFileState) => React.ReactNode;
54
61
  renderRejectedFile?: (state: FileUploadRenderRejectedFileState) => React.ReactNode;
55
62
  renderActions?: (state: {
@@ -67,5 +74,5 @@ export type FileUploadProps = NativeFileInputProps & {
67
74
  declare function formatBytes(bytes: number): string;
68
75
  declare function fileMatchesAccept(file: File, accept?: string): boolean;
69
76
  declare function getFileKey(file: File): string;
70
- declare function FileUpload({ files, onFilesChange, rejectedFiles, onRejectedFilesChange, buttonLabel, dropzoneLabel, dropzoneDescription, dragActiveLabel, helperText, clearLabel, removeLabel, dropzoneAriaLabel, rejectionMessages, maxFiles, maxSize, appendFiles, showFileList, showClearButton, loading, progress, renderFile, renderRejectedFile, renderActions, className, inputClassName, dropzoneClassName, fileListClassName, fileItemClassName, rejectedListClassName, accept, multiple, disabled, onDragEnter, onDragLeave, onDragOver, onDrop, ...props }: FileUploadProps): React.JSX.Element;
77
+ declare function FileUpload({ files, onFilesChange, rejectedFiles, onRejectedFilesChange, buttonLabel, dropzoneLabel, dropzoneDescription, dragActiveLabel, helperText, clearLabel, removeLabel, dropzoneAriaLabel, rejectionMessages, maxFiles, maxSize, appendFiles, showFileList, showClearButton, loading, progress, status, validateFile, onRetryFile, fileTriggerLabel, renderFile, renderRejectedFile, renderActions, className, inputClassName, dropzoneClassName, fileListClassName, fileItemClassName, rejectedListClassName, accept, multiple, disabled, onDragEnter, onDragLeave, onDragOver, onDrop, ...props }: FileUploadProps): React.JSX.Element;
71
78
  export { FileUpload, fileMatchesAccept, formatBytes, getFileKey };
@@ -29,6 +29,9 @@ function f(e) {
29
29
  function p(e, t) {
30
30
  return typeof e == "number" ? e : e?.[f(t)] ?? e?.[t.name];
31
31
  }
32
+ function ee(e, t) {
33
+ return typeof e == "string" ? e : e?.[f(t)] ?? e?.[t.name] ?? "idle";
34
+ }
32
35
  function m(e, t, n) {
33
36
  let r = n?.[e], i = {
34
37
  ...t,
@@ -42,16 +45,16 @@ function m(e, t, n) {
42
45
  case "type": return t.accept ? `File type is not allowed. Expected: ${t.accept}.` : "File type is not allowed.";
43
46
  }
44
47
  }
45
- function ee({ currentFiles: e, incomingFiles: t, accept: n, maxFiles: r, maxSize: i, appendFiles: a, rejectionMessages: o }) {
46
- let s = [], c = [], l = a ? e : [], u = r ?? (a ? void 0 : t.length);
48
+ function te({ currentFiles: e, incomingFiles: t, accept: n, maxFiles: r, maxSize: i, appendFiles: a, rejectionMessages: o, validateFile: s }) {
49
+ let c = [], l = [], u = a ? e : [], f = r ?? (a ? void 0 : t.length);
47
50
  for (let e of t) {
48
- if (u !== void 0 && l.length + s.length >= u) {
49
- c.push({
51
+ if (f !== void 0 && u.length + c.length >= f) {
52
+ l.push({
50
53
  file: e,
51
54
  reason: "max-files",
52
55
  message: m("max-files", {
53
56
  file: e,
54
- maxFiles: u,
57
+ maxFiles: f,
55
58
  maxSize: i,
56
59
  accept: n
57
60
  }, o)
@@ -59,12 +62,12 @@ function ee({ currentFiles: e, incomingFiles: t, accept: n, maxFiles: r, maxSize
59
62
  continue;
60
63
  }
61
64
  if (i !== void 0 && e.size > i) {
62
- c.push({
65
+ l.push({
63
66
  file: e,
64
67
  reason: "max-size",
65
68
  message: m("max-size", {
66
69
  file: e,
67
- maxFiles: u,
70
+ maxFiles: f,
68
71
  maxSize: i,
69
72
  accept: n
70
73
  }, o)
@@ -72,27 +75,36 @@ function ee({ currentFiles: e, incomingFiles: t, accept: n, maxFiles: r, maxSize
72
75
  continue;
73
76
  }
74
77
  if (!d(e, n)) {
75
- c.push({
78
+ l.push({
76
79
  file: e,
77
80
  reason: "type",
78
81
  message: m("type", {
79
82
  file: e,
80
- maxFiles: u,
83
+ maxFiles: f,
81
84
  maxSize: i,
82
85
  accept: n
83
86
  }, o)
84
87
  });
85
88
  continue;
86
89
  }
87
- s.push(e);
90
+ let t = s?.(e);
91
+ if (typeof t == "string" && t) {
92
+ l.push({
93
+ file: e,
94
+ reason: "type",
95
+ message: t
96
+ });
97
+ continue;
98
+ }
99
+ c.push(e);
88
100
  }
89
101
  return {
90
- accepted: s,
91
- rejected: c,
92
- nextFiles: a ? [...e, ...s] : s
102
+ accepted: c,
103
+ rejected: l,
104
+ nextFiles: a ? [...e, ...c] : c
93
105
  };
94
106
  }
95
- function h({ file: e, progress: r, remove: a, removeLabel: u = "Remove file" }) {
107
+ function h({ file: r, progress: a, status: u, remove: d, retry: f, removeLabel: p = "Remove file" }) {
96
108
  return /* @__PURE__ */ c("div", {
97
109
  className: "flex min-w-0 items-center gap-3",
98
110
  children: [
@@ -103,116 +115,132 @@ function h({ file: e, progress: r, remove: a, removeLabel: u = "Remove file" })
103
115
  /* @__PURE__ */ c("div", {
104
116
  className: "min-w-0 flex-1",
105
117
  children: [
106
- /* @__PURE__ */ s("div", {
107
- className: "truncate text-sm font-medium text-foreground",
108
- children: e.name
118
+ /* @__PURE__ */ c("div", {
119
+ className: "flex flex-wrap items-center gap-2",
120
+ children: [/* @__PURE__ */ s("div", {
121
+ className: "truncate text-sm font-medium text-foreground",
122
+ children: r.name
123
+ }), /* @__PURE__ */ s("span", {
124
+ className: e("rounded-full px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.16em]", u === "uploading" && "bg-primary/10 text-primary", u === "success" && "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400", u === "error" && "bg-destructive/10 text-destructive", u === "idle" && "bg-muted text-muted-foreground"),
125
+ children: u
126
+ })]
109
127
  }),
110
128
  /* @__PURE__ */ s("div", {
111
129
  className: "text-xs text-muted-foreground",
112
- children: l(e.size)
130
+ children: l(r.size)
113
131
  }),
114
- typeof r == "number" && /* @__PURE__ */ s("div", {
132
+ typeof a == "number" && /* @__PURE__ */ s("div", {
115
133
  className: "mt-2 h-1.5 overflow-hidden rounded-full bg-muted/80",
116
134
  children: /* @__PURE__ */ s("div", {
117
135
  className: "h-full rounded-full bg-primary shadow-[0_8px_18px_color-mix(in_oklch,var(--primary),transparent_82%)]",
118
- style: { width: `${Math.min(Math.max(r, 0), 100)}%` }
136
+ style: { width: `${Math.min(Math.max(a, 0), 100)}%` }
119
137
  })
120
138
  })
121
139
  ]
122
140
  }),
141
+ u === "error" && f ? /* @__PURE__ */ s(n, {
142
+ type: "button",
143
+ variant: "outline",
144
+ size: "sm",
145
+ className: "rounded-full",
146
+ onClick: f,
147
+ children: "Retry"
148
+ }) : null,
123
149
  /* @__PURE__ */ c(n, {
124
150
  type: "button",
125
151
  variant: "ghost",
126
152
  size: "icon-xs",
127
153
  className: "rounded-full",
128
154
  onClick: (e) => {
129
- t(e), a();
155
+ t(e), d();
130
156
  },
131
157
  onMouseDown: t,
132
158
  onDoubleClick: t,
133
159
  children: [/* @__PURE__ */ s(o, {}), /* @__PURE__ */ s("span", {
134
160
  className: "sr-only",
135
- children: u
161
+ children: p
136
162
  })]
137
163
  })
138
164
  ]
139
165
  });
140
166
  }
141
- function g({ files: i = [], onFilesChange: o, rejectedFiles: u, onRejectedFilesChange: d, buttonLabel: f = "Choose files", dropzoneLabel: m = "Drop files here or click to upload", dropzoneDescription: g, dragActiveLabel: te = "Drop files to upload", helperText: _, clearLabel: ne = "Clear all", removeLabel: re = "Remove file", dropzoneAriaLabel: ie, rejectionMessages: v, maxFiles: y, maxSize: b, appendFiles: x = !0, showFileList: S = !0, showClearButton: C = !0, loading: w = !1, progress: T, renderFile: ae, renderRejectedFile: oe, renderActions: E, className: D, inputClassName: O, dropzoneClassName: k, fileListClassName: A, fileItemClassName: j, rejectedListClassName: M, accept: N, multiple: P, disabled: F, onDragEnter: I, onDragLeave: L, onDragOver: R, onDrop: z, ...B }) {
142
- let V = r.useRef(null), H = r.useRef(0), [U, W] = r.useState(!1), [G, K] = r.useState([]), q = u ?? G, J = F || w, se = P ?? y !== 1;
167
+ function g({ files: i = [], onFilesChange: o, rejectedFiles: u, onRejectedFilesChange: d, buttonLabel: f = "Choose files", dropzoneLabel: m = "Drop files here or click to upload", dropzoneDescription: g, dragActiveLabel: _ = "Drop files to upload", helperText: v, clearLabel: ne = "Clear all", removeLabel: re = "Remove file", dropzoneAriaLabel: ie, rejectionMessages: y, maxFiles: b, maxSize: x, appendFiles: S = !0, showFileList: ae = !0, showClearButton: oe = !0, loading: se = !1, progress: ce, status: le, validateFile: C, onRetryFile: w, fileTriggerLabel: T = "Open file picker", renderFile: ue, renderRejectedFile: E, renderActions: D, className: O, inputClassName: k, dropzoneClassName: A, fileListClassName: j, fileItemClassName: M, rejectedListClassName: N, accept: P, multiple: F, disabled: I, onDragEnter: L, onDragLeave: R, onDragOver: z, onDrop: B, ...V }) {
168
+ let H = r.useRef(null), U = r.useRef(0), [W, G] = r.useState(!1), [de, fe] = r.useState([]), K = u ?? de, q = I || se, pe = F ?? b !== 1;
143
169
  r.useEffect(() => {
144
- J && (H.current = 0, W(!1));
145
- }, [J]);
146
- let Y = r.useCallback((e) => {
147
- u === void 0 && K(e), d?.(e);
148
- }, [d, u]), X = r.useCallback(() => {
149
- J || V.current?.click();
150
- }, [J]), Z = r.useCallback(() => {
151
- o?.([]), Y([]);
152
- }, [o, Y]), Q = r.useCallback((e) => {
153
- let t = ee({
170
+ q && (U.current = 0, G(!1));
171
+ }, [q]);
172
+ let J = r.useCallback((e) => {
173
+ u === void 0 && fe(e), d?.(e);
174
+ }, [d, u]), Y = r.useCallback(() => {
175
+ q || H.current?.click();
176
+ }, [q]), X = r.useCallback(() => {
177
+ o?.([]), J([]);
178
+ }, [o, J]), Z = r.useCallback((e) => {
179
+ let t = te({
154
180
  currentFiles: i,
155
181
  incomingFiles: e,
156
- accept: N,
157
- maxFiles: y,
158
- maxSize: b,
159
- appendFiles: x,
160
- rejectionMessages: v
182
+ accept: P,
183
+ maxFiles: b,
184
+ maxSize: x,
185
+ appendFiles: S,
186
+ rejectionMessages: y,
187
+ validateFile: C
161
188
  });
162
- o?.(t.nextFiles), Y(t.rejected);
189
+ o?.(t.nextFiles), J(t.rejected);
163
190
  }, [
164
- N,
165
- x,
191
+ P,
192
+ S,
166
193
  i,
167
- y,
168
194
  b,
195
+ x,
169
196
  o,
170
- v,
171
- Y
172
- ]), ce = r.useCallback((e) => {
197
+ y,
198
+ J,
199
+ C
200
+ ]), me = r.useCallback((e) => {
173
201
  o?.(i.filter((t, n) => n !== e));
174
- }, [i, o]), le = (e) => {
175
- J || (Q(Array.from(e.target.files ?? [])), e.target.value = "");
176
- }, $ = (e) => J ? (e.preventDefault(), t(e), !0) : !1, ue = (e) => {
177
- I?.(e), !(e.defaultPrevented || $(e)) && (e.preventDefault(), H.current += 1, W(!0));
178
- }, de = (e) => {
179
- L?.(e), !(e.defaultPrevented || $(e)) && (H.current = Math.max(H.current - 1, 0), H.current === 0 && W(!1));
180
- }, fe = (e) => {
181
- R?.(e), !(e.defaultPrevented || $(e)) && e.preventDefault();
182
- }, pe = (e) => {
183
- z?.(e), !(e.defaultPrevented || $(e)) && (e.preventDefault(), H.current = 0, W(!1), Q(Array.from(e.dataTransfer.files ?? [])));
202
+ }, [i, o]), he = (e) => {
203
+ q || (Z(Array.from(e.target.files ?? [])), e.target.value = "");
204
+ }, Q = (e) => q ? (e.preventDefault(), t(e), !0) : !1, ge = (e) => {
205
+ L?.(e), !(e.defaultPrevented || Q(e)) && (e.preventDefault(), U.current += 1, G(!0));
206
+ }, $ = (e) => {
207
+ R?.(e), !(e.defaultPrevented || Q(e)) && (U.current = Math.max(U.current - 1, 0), U.current === 0 && G(!1));
208
+ }, _e = (e) => {
209
+ z?.(e), !(e.defaultPrevented || Q(e)) && e.preventDefault();
210
+ }, ve = (e) => {
211
+ B?.(e), !(e.defaultPrevented || Q(e)) && (e.preventDefault(), U.current = 0, G(!1), Z(Array.from(e.dataTransfer.files ?? [])));
184
212
  };
185
213
  return /* @__PURE__ */ c("div", {
186
214
  "data-slot": "file-upload",
187
- className: e("grid gap-3", D),
215
+ className: e("grid gap-3", O),
188
216
  children: [
189
217
  /* @__PURE__ */ s("input", {
190
- ref: V,
218
+ ref: H,
191
219
  type: "file",
192
- className: e("sr-only", O),
193
- disabled: J,
194
- accept: N,
195
- multiple: se,
196
- onChange: le,
197
- ...B
220
+ className: e("sr-only", k),
221
+ disabled: q,
222
+ accept: P,
223
+ multiple: pe,
224
+ onChange: he,
225
+ ...V
198
226
  }),
199
227
  /* @__PURE__ */ c("div", {
200
228
  "data-slot": "file-upload-dropzone",
201
- "data-dragging": U || void 0,
202
- "data-disabled": J || void 0,
229
+ "data-dragging": W || void 0,
230
+ "data-disabled": q || void 0,
203
231
  role: "button",
204
- "aria-disabled": J || void 0,
205
- "aria-label": ie,
206
- tabIndex: J ? -1 : 0,
207
- className: e("grid cursor-pointer gap-4 rounded-[var(--radius-2xl)] border border-dashed border-border/80 bg-[linear-gradient(180deg,color-mix(in_oklch,var(--card),white_12%),var(--card))] p-6 text-center shadow-sm ring-1 ring-foreground/5 outline-none transition-[background-color,border-color,box-shadow,transform] hover:-translate-y-px hover:border-primary/35 hover:bg-muted/25 hover:shadow-[0_14px_36px_rgba(15,23,42,0.08)] focus-visible:ring-2 focus-visible:ring-ring data-[dragging=true]:border-primary data-[dragging=true]:bg-primary/6 data-[dragging=true]:shadow-[0_18px_50px_color-mix(in_oklch,var(--primary),transparent_84%)] data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-60", k),
208
- onClick: X,
232
+ "aria-disabled": q || void 0,
233
+ "aria-label": ie ?? T,
234
+ tabIndex: q ? -1 : 0,
235
+ className: e("grid cursor-pointer gap-4 rounded-[var(--radius-2xl)] border border-dashed border-border/80 bg-[linear-gradient(180deg,color-mix(in_oklch,var(--card),white_12%),var(--card))] p-6 text-center shadow-sm ring-1 ring-foreground/5 outline-none transition-[background-color,border-color,box-shadow,transform] hover:-translate-y-px hover:border-primary/35 hover:bg-muted/25 hover:shadow-[0_14px_36px_rgba(15,23,42,0.08)] focus-visible:ring-2 focus-visible:ring-ring data-[dragging=true]:border-primary data-[dragging=true]:bg-primary/6 data-[dragging=true]:shadow-[0_18px_50px_color-mix(in_oklch,var(--primary),transparent_84%)] data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-60", A),
236
+ onClick: Y,
209
237
  onKeyDown: (e) => {
210
- J || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), X());
238
+ q || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), Y());
211
239
  },
212
- onDragEnter: ue,
213
- onDragLeave: de,
214
- onDragOver: fe,
215
- onDrop: pe,
240
+ onDragEnter: ge,
241
+ onDragLeave: $,
242
+ onDragOver: _e,
243
+ onDrop: ve,
216
244
  children: [
217
245
  /* @__PURE__ */ s("div", {
218
246
  className: "mx-auto flex size-13 items-center justify-center rounded-full border border-border/75 bg-[linear-gradient(180deg,color-mix(in_oklch,var(--background),white_14%),var(--background))] text-muted-foreground shadow-[0_1px_0_rgba(255,255,255,0.12),0_10px_24px_rgba(15,23,42,0.06)]",
@@ -223,25 +251,25 @@ function g({ files: i = [], onFilesChange: o, rejectedFiles: u, onRejectedFilesC
223
251
  children: [
224
252
  /* @__PURE__ */ s("div", {
225
253
  className: "text-sm font-semibold text-foreground",
226
- children: U ? te : m
254
+ children: W ? _ : m
227
255
  }),
228
256
  g && /* @__PURE__ */ s("div", {
229
257
  className: "text-sm leading-6 text-muted-foreground",
230
258
  children: g
231
259
  }),
232
- (N || b || y || _) && /* @__PURE__ */ s("div", {
260
+ (P || x || b || v) && /* @__PURE__ */ s("div", {
233
261
  className: "text-xs leading-5 text-muted-foreground",
234
- children: _ ?? [
235
- N ? `Types: ${N}` : null,
236
- b ? `Max size: ${l(b)}` : null,
237
- y ? `Max files: ${y}` : null
262
+ children: v ?? [
263
+ P ? `Types: ${P}` : null,
264
+ x ? `Max size: ${l(x)}` : null,
265
+ b ? `Max files: ${b}` : null
238
266
  ].filter(Boolean).join(" • ")
239
267
  })
240
268
  ]
241
269
  }),
242
- E?.({
243
- openFileDialog: X,
244
- clearFiles: Z,
270
+ D?.({
271
+ openFileDialog: Y,
272
+ clearFiles: X,
245
273
  files: i
246
274
  }) ?? /* @__PURE__ */ c("div", {
247
275
  className: "flex justify-center gap-2",
@@ -249,20 +277,21 @@ function g({ files: i = [], onFilesChange: o, rejectedFiles: u, onRejectedFilesC
249
277
  type: "button",
250
278
  variant: "outline",
251
279
  size: "sm",
252
- disabled: J,
280
+ disabled: q,
281
+ "aria-label": typeof f == "string" ? f : T,
253
282
  onClick: (e) => {
254
- t(e), X();
283
+ t(e), Y();
255
284
  },
256
285
  onMouseDown: t,
257
286
  onDoubleClick: t,
258
287
  children: f
259
- }), C && i.length > 0 && /* @__PURE__ */ s(n, {
288
+ }), oe && i.length > 0 && /* @__PURE__ */ s(n, {
260
289
  type: "button",
261
290
  variant: "ghost",
262
291
  size: "sm",
263
- disabled: J,
292
+ disabled: q,
264
293
  onClick: (e) => {
265
- t(e), Z();
294
+ t(e), X();
266
295
  },
267
296
  onMouseDown: t,
268
297
  onDoubleClick: t,
@@ -271,30 +300,33 @@ function g({ files: i = [], onFilesChange: o, rejectedFiles: u, onRejectedFilesC
271
300
  })
272
301
  ]
273
302
  }),
274
- S && i.length > 0 && /* @__PURE__ */ s("div", {
303
+ ae && i.length > 0 && /* @__PURE__ */ s("div", {
275
304
  "data-slot": "file-upload-list",
276
- className: e("grid gap-2", A),
305
+ className: e("grid gap-2", j),
277
306
  children: i.map((t, n) => {
278
307
  let r = {
279
308
  file: t,
280
309
  index: n,
281
- progress: p(T, t),
282
- remove: () => ce(n),
310
+ progress: p(ce, t),
311
+ status: ee(le, t),
312
+ remove: () => me(n),
313
+ retry: w ? () => w(t, n) : void 0,
283
314
  removeLabel: re
284
315
  };
285
316
  return /* @__PURE__ */ s("div", {
286
317
  "data-slot": "file-upload-item",
287
- className: e("rounded-[min(var(--radius-xl),18px)] border border-border/80 bg-[linear-gradient(180deg,color-mix(in_oklch,var(--card),white_10%),var(--card))] p-3.5 shadow-sm ring-1 ring-foreground/5", j),
288
- children: ae?.(r) ?? h(r)
318
+ "data-status": r.status,
319
+ className: e("rounded-[min(var(--radius-xl),18px)] border border-border/80 bg-[linear-gradient(180deg,color-mix(in_oklch,var(--card),white_10%),var(--card))] p-3.5 shadow-sm ring-1 ring-foreground/5", M),
320
+ children: ue?.(r) ?? h(r)
289
321
  }, `${t.name}-${t.lastModified}-${n}`);
290
322
  })
291
323
  }),
292
- q.length > 0 && /* @__PURE__ */ s("div", {
324
+ K.length > 0 && /* @__PURE__ */ s("div", {
293
325
  "data-slot": "file-upload-rejected-list",
294
- className: e("grid gap-2", M),
295
- children: q.map((e, t) => /* @__PURE__ */ s("div", {
326
+ className: e("grid gap-2", N),
327
+ children: K.map((e, t) => /* @__PURE__ */ s("div", {
296
328
  className: "rounded-[min(var(--radius-lg),12px)] border border-destructive/22 bg-destructive/8 px-3 py-2.5 text-xs leading-5 text-destructive shadow-[inset_0_1px_0_rgba(255,255,255,0.08)]",
297
- children: oe?.({
329
+ children: E?.({
298
330
  rejectedFile: e,
299
331
  index: t
300
332
  }) ?? /* @__PURE__ */ c("span", { children: [
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/utils.cjs"),n=require("../ui/button/index.cjs"),r=require("./file-upload.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("lucide-react"),o=require("react/jsx-runtime");function s(e,t=!0){let[n,a]=i.useState({});return i.useEffect(()=>{if(!t){a({});return}let n=e.filter(e=>e.type.startsWith(`image/`)).map(e=>[r.getFileKey(e),URL.createObjectURL(e)]);return a(Object.fromEntries(n)),()=>{n.forEach(([,e])=>URL.revokeObjectURL(e))}},[t,e]),n}function c({file:e,previewUrl:i,progress:s,remove:c,previewClassName:l,imageClassName:u}){return(0,o.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,o.jsx)(`div`,{className:t.cn(`flex size-14 shrink-0 items-center justify-center overflow-hidden rounded-[min(var(--radius-xl),16px)] border border-border/75 bg-muted/45 text-muted-foreground shadow-[0_1px_0_rgba(255,255,255,0.05)]`,l),children:i?(0,o.jsx)(`img`,{src:i,alt:e.name,className:t.cn(`size-full object-cover`,u)}):(0,o.jsx)(a.ImageIcon,{className:`size-5`})}),(0,o.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,o.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:e.name}),(0,o.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:r.formatBytes(e.size)}),typeof s==`number`&&(0,o.jsx)(`div`,{className:`mt-2 h-1.5 overflow-hidden rounded-full bg-muted/80`,children:(0,o.jsx)(`div`,{className:`h-full rounded-full bg-primary shadow-[0_8px_18px_color-mix(in_oklch,var(--primary),transparent_82%)]`,style:{width:`${Math.min(Math.max(s,0),100)}%`}})})]}),(0,o.jsxs)(n.Button,{type:`button`,variant:`ghost`,size:`icon-xs`,className:`rounded-full`,onClick:e=>{t.stopInteractivePropagation(e),c()},onMouseDown:t.stopInteractivePropagation,onDoubleClick:t.stopInteractivePropagation,children:[(0,o.jsx)(a.XIcon,{}),(0,o.jsx)(`span`,{className:`sr-only`,children:`Remove image`})]})]})}function l({accept:e=`image/*`,buttonLabel:t=`Choose image`,dropzoneLabel:n=`Drop images here or click to upload`,preview:i=!0,previewClassName:a,imageClassName:l,files:u=[],renderImageFile:d,...f}){let p=s(u,i);return(0,o.jsx)(r.FileUpload,{accept:e,buttonLabel:t,dropzoneLabel:n,files:u,renderFile:e=>{let t=p[r.getFileKey(e.file)];return d?.({...e,previewUrl:t})??c({...e,previewUrl:t,previewClassName:a,imageClassName:l})},...f})}exports.ImageUpload=l,exports.useImagePreviewUrls=s;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/utils.cjs"),n=require("../ui/button/index.cjs"),r=require("./file-upload.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("lucide-react"),o=require("react/jsx-runtime");function s(e){return new Promise((t,n)=>{let r=URL.createObjectURL(e),i=new Image;i.onload=()=>{t({width:i.width,height:i.height}),URL.revokeObjectURL(r)},i.onerror=()=>{URL.revokeObjectURL(r),n(Error(`Image metadata could not be read`))},i.src=r})}function c(e,t=!0){let[n,a]=i.useState({});return i.useEffect(()=>{if(!t){a({});return}let n=e.filter(e=>e.type.startsWith(`image/`)).map(e=>[r.getFileKey(e),URL.createObjectURL(e)]);return a(Object.fromEntries(n)),()=>{n.forEach(([,e])=>URL.revokeObjectURL(e))}},[t,e]),n}function l({file:e,previewUrl:i,progress:s,remove:c,previewClassName:l,imageClassName:u}){return(0,o.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,o.jsx)(`div`,{className:t.cn(`flex size-14 shrink-0 items-center justify-center overflow-hidden rounded-[min(var(--radius-xl),16px)] border border-border/75 bg-muted/45 text-muted-foreground shadow-[0_1px_0_rgba(255,255,255,0.05)]`,l),children:i?(0,o.jsx)(`img`,{src:i,alt:e.name,className:t.cn(`size-full object-cover`,u)}):(0,o.jsx)(a.ImageIcon,{className:`size-5`})}),(0,o.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,o.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:e.name}),(0,o.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:r.formatBytes(e.size)}),typeof s==`number`&&(0,o.jsx)(`div`,{className:`mt-2 h-1.5 overflow-hidden rounded-full bg-muted/80`,children:(0,o.jsx)(`div`,{className:`h-full rounded-full bg-primary shadow-[0_8px_18px_color-mix(in_oklch,var(--primary),transparent_82%)]`,style:{width:`${Math.min(Math.max(s,0),100)}%`}})})]}),(0,o.jsxs)(n.Button,{type:`button`,variant:`ghost`,size:`icon-xs`,className:`rounded-full`,onClick:e=>{t.stopInteractivePropagation(e),c()},onMouseDown:t.stopInteractivePropagation,onDoubleClick:t.stopInteractivePropagation,children:[(0,o.jsx)(a.XIcon,{}),(0,o.jsx)(`span`,{className:`sr-only`,children:`Remove image`})]})]})}function u({accept:e=`image/*`,buttonLabel:t=`Choose image`,dropzoneLabel:n=`Drop images here or click to upload`,preview:i=!0,previewClassName:a,imageClassName:u,files:d=[],minImageWidth:f,minImageHeight:p,aspectRatio:m,aspectRatioTolerance:h=.04,renderImageFile:g,..._}){let v=c(d,i);return(0,o.jsx)(r.FileUpload,{accept:e,buttonLabel:t,dropzoneLabel:n,files:d,validateFile:async e=>{if(!e.type.startsWith(`image/`))return`Only image files are allowed.`;if(!f&&!p&&!m)return null;let{width:t,height:n}=await s(e);if(f&&t<f)return`Image width must be at least ${f}px.`;if(p&&n<p)return`Image height must be at least ${p}px.`;if(m){let e=t/n;if(Math.abs(e-m)>h)return`Image ratio must be close to ${m.toFixed(2)}:1.`}return null},renderFile:e=>{let t=v[r.getFileKey(e.file)];return g?.({...e,previewUrl:t})??l({...e,previewUrl:t,previewClassName:a,imageClassName:u})},..._})}exports.ImageUpload=u,exports.useImagePreviewUrls=c;
@@ -5,10 +5,14 @@ export type ImageUploadProps = Omit<FileUploadProps, "accept" | "renderFile"> &
5
5
  preview?: boolean;
6
6
  previewClassName?: string;
7
7
  imageClassName?: string;
8
+ minImageWidth?: number;
9
+ minImageHeight?: number;
10
+ aspectRatio?: number;
11
+ aspectRatioTolerance?: number;
8
12
  renderImageFile?: (state: FileUploadRenderFileState & {
9
13
  previewUrl?: string;
10
14
  }) => React.ReactNode;
11
15
  };
12
16
  declare function useImagePreviewUrls(files: File[], enabled?: boolean): Record<string, string>;
13
- declare function ImageUpload({ accept, buttonLabel, dropzoneLabel, preview, previewClassName, imageClassName, files, renderImageFile, ...props }: ImageUploadProps): React.JSX.Element;
17
+ declare function ImageUpload({ accept, buttonLabel, dropzoneLabel, preview, previewClassName, imageClassName, files, minImageWidth, minImageHeight, aspectRatio, aspectRatioTolerance, renderImageFile, ...props }: ImageUploadProps): React.JSX.Element;
14
18
  export { ImageUpload, useImagePreviewUrls };