@godxjp/ui 13.9.3 → 13.11.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 (477) hide show
  1. package/dist/app/app-provider.d.ts +30 -0
  2. package/dist/app/app-provider.js +244 -0
  3. package/dist/app/date-format-labels.d.ts +8 -0
  4. package/dist/app/date-format-labels.js +16 -0
  5. package/dist/app/date-formats.d.ts +10 -0
  6. package/dist/app/date-formats.js +27 -0
  7. package/dist/app/index.d.ts +13 -136
  8. package/dist/app/index.js +65 -38
  9. package/dist/app/locales.d.ts +12 -0
  10. package/dist/app/locales.js +26 -0
  11. package/dist/app/request-headers.d.ts +7 -0
  12. package/dist/app/request-headers.js +27 -0
  13. package/dist/app/storage.d.ts +11 -0
  14. package/dist/app/storage.js +32 -0
  15. package/dist/app/time-format-labels.d.ts +8 -0
  16. package/dist/app/time-format-labels.js +14 -0
  17. package/dist/app/time-formats.d.ts +7 -0
  18. package/dist/app/time-formats.js +14 -0
  19. package/dist/app/timezones.d.ts +31 -0
  20. package/dist/app/timezones.js +161 -0
  21. package/dist/app/types.d.ts +21 -0
  22. package/dist/app/types.js +30 -0
  23. package/dist/app/use-formatting.d.ts +19 -0
  24. package/dist/app/use-formatting.js +37 -0
  25. package/dist/components/admin/index.d.ts +26 -66
  26. package/dist/components/admin/index.js +96 -49
  27. package/dist/components/data-display/accordion.d.ts +1 -0
  28. package/dist/components/data-display/accordion.js +7 -0
  29. package/dist/components/data-display/avatar.d.ts +1 -0
  30. package/dist/components/data-display/avatar.js +6 -0
  31. package/dist/components/data-display/badge.d.ts +9 -13
  32. package/dist/components/data-display/badge.js +111 -5
  33. package/dist/components/data-display/card.d.ts +22 -26
  34. package/dist/components/data-display/card.js +153 -2
  35. package/dist/components/data-display/carousel.d.ts +11 -13
  36. package/dist/components/data-display/carousel.js +220 -4
  37. package/dist/components/data-display/collapsible.d.ts +4 -0
  38. package/dist/components/data-display/collapsible.js +9 -0
  39. package/dist/components/data-display/data-table.d.ts +53 -0
  40. package/dist/components/data-display/data-table.js +424 -0
  41. package/dist/components/data-display/descriptions.d.ts +19 -0
  42. package/dist/components/data-display/descriptions.js +25 -0
  43. package/dist/components/data-display/empty-state.d.ts +3 -0
  44. package/dist/{chunk-YD7V2HGZ.js → components/data-display/empty-state.js} +5 -5
  45. package/dist/components/data-display/hover-card.d.ts +1 -0
  46. package/dist/components/data-display/hover-card.js +6 -0
  47. package/dist/components/data-display/index.d.ts +24 -79
  48. package/dist/components/data-display/index.js +95 -176
  49. package/dist/components/data-display/popover.d.ts +9 -13
  50. package/dist/components/data-display/popover.js +61 -2
  51. package/dist/components/data-display/progress.d.ts +7 -0
  52. package/dist/components/data-display/progress.js +27 -0
  53. package/dist/components/data-display/scroll-area.d.ts +4 -7
  54. package/dist/components/data-display/scroll-area.js +38 -2
  55. package/dist/components/data-display/table.d.ts +7 -10
  56. package/dist/components/data-display/table.js +36 -3
  57. package/dist/components/data-display/timeline.d.ts +12 -0
  58. package/dist/components/data-display/timeline.js +35 -0
  59. package/dist/components/data-display/tree-list.d.ts +13 -0
  60. package/dist/components/data-display/tree-list.js +30 -0
  61. package/dist/components/data-entry/calendar.d.ts +3 -19
  62. package/dist/components/data-entry/calendar.js +96 -6
  63. package/dist/components/data-entry/cascader.d.ts +4 -35
  64. package/dist/components/data-entry/cascader.js +327 -10
  65. package/dist/components/data-entry/checkbox-group.d.ts +3 -0
  66. package/dist/{chunk-BE6GJGKJ.js → components/data-entry/checkbox-group.js} +9 -26
  67. package/dist/components/data-entry/checkbox.d.ts +7 -16
  68. package/dist/components/data-entry/checkbox.js +26 -4
  69. package/dist/components/data-entry/choice-option.d.ts +10 -0
  70. package/dist/components/data-entry/choice-option.js +7 -0
  71. package/dist/components/data-entry/color-picker.d.ts +3 -19
  72. package/dist/components/data-entry/color-picker.js +75 -6
  73. package/dist/components/data-entry/command.d.ts +7 -10
  74. package/dist/components/data-entry/command.js +51 -3
  75. package/dist/components/data-entry/date-picker.d.ts +3 -19
  76. package/dist/components/data-entry/date-picker.js +153 -9
  77. package/dist/components/data-entry/date-range-picker.d.ts +3 -19
  78. package/dist/components/data-entry/date-range-picker.js +191 -8
  79. package/dist/components/data-entry/field.d.ts +4 -0
  80. package/dist/{chunk-44YRPSZ7.js → components/data-entry/field.js} +6 -11
  81. package/dist/components/data-entry/form-field.d.ts +3 -0
  82. package/dist/{chunk-LBYSX3VM.js → components/data-entry/form-field.js} +14 -47
  83. package/dist/components/data-entry/form.d.ts +29 -0
  84. package/dist/components/data-entry/form.js +41 -0
  85. package/dist/components/data-entry/index.d.ts +61 -164
  86. package/dist/components/data-entry/index.js +117 -37
  87. package/dist/components/data-entry/input-otp.d.ts +1 -0
  88. package/dist/components/data-entry/input-otp.js +7 -0
  89. package/dist/components/data-entry/input.d.ts +3 -6
  90. package/dist/components/data-entry/input.js +98 -4
  91. package/dist/components/data-entry/label.d.ts +4 -8
  92. package/dist/components/data-entry/label.js +25 -2
  93. package/dist/components/data-entry/month-picker.d.ts +9 -0
  94. package/dist/components/data-entry/month-picker.js +188 -0
  95. package/dist/components/data-entry/month-range-picker.d.ts +11 -0
  96. package/dist/components/data-entry/month-range-picker.js +245 -0
  97. package/dist/components/data-entry/number-input.d.ts +12 -0
  98. package/dist/components/data-entry/number-input.js +219 -0
  99. package/dist/components/data-entry/password-input.d.ts +2 -0
  100. package/dist/components/data-entry/password-input.js +4 -0
  101. package/dist/components/data-entry/password-strength.d.ts +20 -0
  102. package/dist/{chunk-VSUYVT2Q.js → components/data-entry/password-strength.js} +8 -62
  103. package/dist/components/data-entry/radio.d.ts +7 -20
  104. package/dist/components/data-entry/radio.js +93 -4
  105. package/dist/components/data-entry/rating.d.ts +2 -0
  106. package/dist/components/data-entry/rating.js +4 -0
  107. package/dist/components/data-entry/search-input.d.ts +18 -0
  108. package/dist/{chunk-LVLPNKJP.js → components/data-entry/search-input.js} +11 -11
  109. package/dist/components/data-entry/search-select.d.ts +11 -0
  110. package/dist/{chunk-6S2ZU26B.js → components/data-entry/search-select.js} +14 -239
  111. package/dist/components/data-entry/select.d.ts +14 -30
  112. package/dist/components/data-entry/select.js +243 -9
  113. package/dist/components/data-entry/slider.d.ts +4 -18
  114. package/dist/components/data-entry/slider.js +52 -2
  115. package/dist/components/data-entry/switch.d.ts +4 -18
  116. package/dist/components/data-entry/switch.js +40 -2
  117. package/dist/components/data-entry/tag-input.d.ts +2 -0
  118. package/dist/components/data-entry/tag-input.js +4 -0
  119. package/dist/components/data-entry/textarea.d.ts +3 -6
  120. package/dist/components/data-entry/textarea.js +86 -5
  121. package/dist/components/data-entry/time-input.d.ts +3 -6
  122. package/dist/components/data-entry/time-input.js +137 -3
  123. package/dist/components/data-entry/time-picker.d.ts +3 -19
  124. package/dist/components/data-entry/time-picker.js +329 -7
  125. package/dist/components/data-entry/toggle-group.d.ts +1 -0
  126. package/dist/components/data-entry/toggle-group.js +5 -0
  127. package/dist/components/data-entry/toggle.d.ts +2 -0
  128. package/dist/components/data-entry/toggle.js +4 -0
  129. package/dist/components/data-entry/transfer.d.ts +3 -20
  130. package/dist/components/data-entry/transfer.js +193 -13
  131. package/dist/components/data-entry/tree-select-strategy.d.ts +5 -0
  132. package/dist/components/data-entry/tree-select-strategy.js +8 -0
  133. package/dist/components/data-entry/tree-select.d.ts +5 -25
  134. package/dist/components/data-entry/tree-select.js +299 -13
  135. package/dist/components/data-entry/tree-utils.d.ts +48 -0
  136. package/dist/{chunk-SMLKNECP.js → components/data-entry/tree-utils.js} +33 -5
  137. package/dist/components/data-entry/upload-crop-dialog.d.ts +9 -0
  138. package/dist/components/data-entry/upload-crop-dialog.js +102 -0
  139. package/dist/components/data-entry/upload-types.d.ts +39 -0
  140. package/dist/components/data-entry/upload-types.js +41 -0
  141. package/dist/components/data-entry/upload.d.ts +6 -45
  142. package/dist/components/data-entry/upload.js +417 -12
  143. package/dist/components/data-entry/use-upload-draft.d.ts +25 -0
  144. package/dist/components/data-entry/use-upload-draft.js +64 -0
  145. package/dist/components/data-grid/data-grid.d.ts +67 -0
  146. package/dist/components/data-grid/data-grid.js +402 -0
  147. package/dist/components/data-grid/index.d.ts +2 -71
  148. package/dist/components/data-grid/index.js +3 -371
  149. package/dist/components/feedback/alert.d.ts +37 -42
  150. package/dist/components/feedback/alert.js +127 -7
  151. package/dist/components/feedback/dialog.d.ts +21 -25
  152. package/dist/components/feedback/dialog.js +356 -8
  153. package/dist/components/feedback/index.d.ts +10 -28
  154. package/dist/components/feedback/index.js +105 -18
  155. package/dist/components/feedback/overlay-header-tone.d.ts +7 -0
  156. package/dist/{chunk-VU4GFGDG.js → components/feedback/overlay-header-tone.js} +4 -4
  157. package/dist/components/feedback/sheet.d.ts +18 -23
  158. package/dist/components/feedback/sheet.js +192 -3
  159. package/dist/components/feedback/skeleton.d.ts +17 -0
  160. package/dist/{chunk-2BR7KFCP.js → components/feedback/skeleton.js} +10 -6
  161. package/dist/components/feedback/sonner.d.ts +2 -5
  162. package/dist/components/feedback/sonner.js +50 -1
  163. package/dist/components/feedback/tooltip.d.ts +10 -0
  164. package/dist/{chunk-32WO3YLB.js → components/feedback/tooltip.js} +12 -9
  165. package/dist/components/feedback/use-toast.d.ts +3 -0
  166. package/dist/components/feedback/use-toast.js +5 -0
  167. package/dist/components/general/button.d.ts +12 -18
  168. package/dist/components/general/button.js +118 -4
  169. package/dist/components/general/index.d.ts +4 -37
  170. package/dist/components/general/index.js +8 -48
  171. package/dist/components/general/typography.d.ts +30 -0
  172. package/dist/components/general/typography.js +46 -0
  173. package/dist/components/layout/app-shell.d.ts +3 -0
  174. package/dist/components/layout/app-shell.js +33 -0
  175. package/dist/components/layout/aspect-ratio.d.ts +1 -0
  176. package/dist/components/layout/aspect-ratio.js +4 -0
  177. package/dist/components/layout/breadcrumb.d.ts +7 -0
  178. package/dist/components/layout/breadcrumb.js +16 -0
  179. package/dist/components/layout/flex.d.ts +3 -0
  180. package/dist/components/layout/flex.js +29 -0
  181. package/dist/components/layout/index.d.ts +19 -60
  182. package/dist/components/layout/index.js +29 -12
  183. package/dist/components/layout/page-container.d.ts +8 -0
  184. package/dist/components/layout/page-container.js +77 -0
  185. package/dist/components/layout/resizable.d.ts +8 -12
  186. package/dist/components/layout/resizable.js +44 -2
  187. package/dist/components/layout/responsive-grid.d.ts +7 -0
  188. package/dist/{chunk-C3PKEV6S.js → components/layout/responsive-grid.js} +4 -5
  189. package/dist/components/layout/separator.d.ts +1 -0
  190. package/dist/components/layout/separator.js +4 -0
  191. package/dist/components/layout/sidebar.d.ts +21 -0
  192. package/dist/components/layout/sidebar.js +254 -0
  193. package/dist/components/layout/split-pane.d.ts +7 -0
  194. package/dist/components/layout/split-pane.js +10 -0
  195. package/dist/components/layout/topbar.d.ts +3 -0
  196. package/dist/components/layout/topbar.js +133 -0
  197. package/dist/components/navigation/app-setting-picker.d.ts +9 -0
  198. package/dist/{chunk-RHPFCKB2.js → components/navigation/app-setting-picker.js} +24 -49
  199. package/dist/components/navigation/context-menu.d.ts +16 -20
  200. package/dist/components/navigation/context-menu.js +144 -2
  201. package/dist/components/navigation/dropdown-menu.d.ts +17 -21
  202. package/dist/components/navigation/dropdown-menu.js +164 -2
  203. package/dist/components/navigation/filter-bar.d.ts +4 -0
  204. package/dist/components/navigation/filter-bar.js +43 -0
  205. package/dist/components/navigation/index.d.ts +12 -36
  206. package/dist/components/navigation/index.js +140 -17
  207. package/dist/components/navigation/menubar.d.ts +18 -23
  208. package/dist/components/navigation/menubar.js +135 -2
  209. package/dist/components/navigation/navigation-menu.d.ts +10 -13
  210. package/dist/components/navigation/navigation-menu.js +90 -2
  211. package/dist/components/navigation/pagination-utils.d.ts +2 -0
  212. package/dist/components/navigation/pagination-utils.js +25 -0
  213. package/dist/components/navigation/pagination.d.ts +6 -12
  214. package/dist/components/navigation/pagination.js +222 -10
  215. package/dist/components/navigation/steps.d.ts +3 -12
  216. package/dist/components/navigation/steps.js +150 -5
  217. package/dist/components/navigation/tabs.d.ts +8 -12
  218. package/dist/components/navigation/tabs.js +109 -2
  219. package/dist/components/query/data-state.d.ts +7 -0
  220. package/dist/components/query/data-state.js +44 -0
  221. package/dist/components/query/index.d.ts +10 -43
  222. package/dist/components/query/index.js +13 -195
  223. package/dist/components/query/infinite-query-state.d.ts +13 -0
  224. package/dist/components/query/infinite-query-state.js +70 -0
  225. package/dist/components/query/mutation-feedback.d.ts +7 -0
  226. package/dist/components/query/mutation-feedback.js +23 -0
  227. package/dist/components/query/prefetch-link.d.ts +7 -0
  228. package/dist/components/query/prefetch-link.js +36 -0
  229. package/dist/components/query/query-refetch-button.d.ts +4 -0
  230. package/dist/components/query/query-refetch-button.js +40 -0
  231. package/dist/components/ui/accordion.d.ts +6 -0
  232. package/dist/components/ui/accordion.js +47 -0
  233. package/dist/components/ui/alert-dialog.d.ts +1 -0
  234. package/dist/components/ui/alert-dialog.js +1 -0
  235. package/dist/components/ui/alert.d.ts +1 -0
  236. package/dist/components/ui/alert.js +1 -0
  237. package/dist/components/ui/aspect-ratio.d.ts +3 -0
  238. package/dist/components/ui/aspect-ratio.js +18 -0
  239. package/dist/components/ui/avatar.d.ts +5 -0
  240. package/dist/{chunk-QTUJSRDH.js → components/ui/avatar.js} +12 -10
  241. package/dist/components/ui/badge.d.ts +1 -0
  242. package/dist/components/ui/badge.js +1 -0
  243. package/dist/components/ui/button.d.ts +1 -0
  244. package/dist/components/ui/button.js +1 -0
  245. package/dist/components/ui/calendar.d.ts +1 -0
  246. package/dist/components/ui/calendar.js +1 -0
  247. package/dist/components/ui/card.d.ts +1 -0
  248. package/dist/components/ui/card.js +1 -0
  249. package/dist/components/ui/carousel.d.ts +1 -0
  250. package/dist/components/ui/carousel.js +1 -0
  251. package/dist/components/ui/checkbox.d.ts +1 -0
  252. package/dist/components/ui/checkbox.js +1 -0
  253. package/dist/components/ui/color-picker.d.ts +1 -0
  254. package/dist/components/ui/color-picker.js +1 -0
  255. package/dist/components/ui/command.d.ts +1 -0
  256. package/dist/components/ui/command.js +1 -0
  257. package/dist/components/ui/context-menu.d.ts +1 -0
  258. package/dist/components/ui/context-menu.js +1 -0
  259. package/dist/components/ui/date-picker.d.ts +1 -0
  260. package/dist/components/ui/date-picker.js +1 -0
  261. package/dist/components/ui/date-range-picker.d.ts +1 -0
  262. package/dist/components/ui/date-range-picker.js +1 -0
  263. package/dist/components/ui/dialog.d.ts +1 -0
  264. package/dist/components/ui/dialog.js +1 -0
  265. package/dist/components/ui/dropdown-menu.d.ts +1 -0
  266. package/dist/components/ui/dropdown-menu.js +1 -0
  267. package/dist/components/ui/hover-card.d.ts +10 -0
  268. package/dist/components/ui/hover-card.js +45 -0
  269. package/dist/components/ui/index.d.ts +43 -80
  270. package/dist/components/ui/index.js +50 -47
  271. package/dist/components/ui/input-otp.d.ts +33 -0
  272. package/dist/components/ui/input-otp.js +55 -0
  273. package/dist/components/ui/input.d.ts +1 -0
  274. package/dist/components/ui/input.js +1 -0
  275. package/dist/components/ui/label.d.ts +1 -0
  276. package/dist/components/ui/label.js +1 -0
  277. package/dist/components/ui/menubar.d.ts +1 -0
  278. package/dist/components/ui/menubar.js +1 -0
  279. package/dist/components/ui/navigation-menu.d.ts +1 -0
  280. package/dist/components/ui/navigation-menu.js +1 -0
  281. package/dist/components/ui/pagination.d.ts +1 -0
  282. package/dist/components/ui/pagination.js +1 -0
  283. package/dist/components/ui/password-input.d.ts +4 -0
  284. package/dist/components/ui/password-input.js +38 -0
  285. package/dist/components/ui/password-strength.d.ts +1 -0
  286. package/dist/components/ui/password-strength.js +1 -0
  287. package/dist/components/ui/popover.d.ts +1 -0
  288. package/dist/components/ui/popover.js +1 -0
  289. package/dist/components/ui/radio.d.ts +1 -0
  290. package/dist/components/ui/radio.js +1 -0
  291. package/dist/components/ui/rating.d.ts +13 -0
  292. package/dist/components/ui/rating.js +90 -0
  293. package/dist/components/ui/resizable.d.ts +1 -0
  294. package/dist/components/ui/resizable.js +1 -0
  295. package/dist/components/ui/scroll-area.d.ts +1 -0
  296. package/dist/components/ui/scroll-area.js +1 -0
  297. package/dist/components/ui/select.d.ts +1 -0
  298. package/dist/components/ui/select.js +1 -0
  299. package/dist/components/ui/separator.d.ts +3 -0
  300. package/dist/components/ui/separator.js +20 -0
  301. package/dist/components/ui/sheet.d.ts +1 -0
  302. package/dist/components/ui/sheet.js +1 -0
  303. package/dist/components/ui/skeleton.d.ts +1 -0
  304. package/dist/components/ui/skeleton.js +4 -0
  305. package/dist/components/ui/slider.d.ts +1 -0
  306. package/dist/components/ui/slider.js +1 -0
  307. package/dist/components/ui/sonner.d.ts +1 -0
  308. package/dist/components/ui/sonner.js +1 -0
  309. package/dist/components/ui/switch.d.ts +1 -0
  310. package/dist/components/ui/switch.js +1 -0
  311. package/dist/components/ui/table.d.ts +1 -0
  312. package/dist/components/ui/table.js +1 -0
  313. package/dist/components/ui/tabs.d.ts +1 -0
  314. package/dist/components/ui/tabs.js +1 -0
  315. package/dist/components/ui/tag-input.d.ts +13 -0
  316. package/dist/components/ui/tag-input.js +100 -0
  317. package/dist/components/ui/textarea.d.ts +1 -0
  318. package/dist/components/ui/textarea.js +1 -0
  319. package/dist/components/ui/time-input.d.ts +1 -0
  320. package/dist/components/ui/time-input.js +1 -0
  321. package/dist/components/ui/time-picker.d.ts +1 -0
  322. package/dist/components/ui/time-picker.js +1 -0
  323. package/dist/components/ui/toggle-group.d.ts +11 -0
  324. package/dist/components/ui/toggle-group.js +32 -0
  325. package/dist/components/ui/toggle.d.ts +13 -0
  326. package/dist/components/ui/toggle.js +36 -0
  327. package/dist/components/ui/upload.d.ts +1 -0
  328. package/dist/components/ui/upload.js +1 -0
  329. package/dist/form/form-field-control.d.ts +4 -0
  330. package/dist/form/form-field-control.js +42 -0
  331. package/dist/form/form-root.d.ts +4 -0
  332. package/dist/form/form-root.js +26 -0
  333. package/dist/form/index.d.ts +7 -21
  334. package/dist/form/index.js +8 -73
  335. package/dist/form/use-zod-form.d.ts +10 -0
  336. package/dist/form/use-zod-form.js +14 -0
  337. package/dist/i18n/index.d.ts +3 -326
  338. package/dist/i18n/index.js +17 -2
  339. package/dist/i18n/messages/en.json +279 -0
  340. package/dist/i18n/messages/ja.json +276 -0
  341. package/dist/i18n/messages/vi.json +276 -0
  342. package/dist/i18n/translate.d.ts +15 -0
  343. package/dist/i18n/translate.js +82 -0
  344. package/dist/i18n/use-translation.d.ts +19 -0
  345. package/dist/i18n/use-translation.js +46 -0
  346. package/dist/index.d.ts +11 -47
  347. package/dist/index.js +16 -62
  348. package/dist/lib/control-styles.d.ts +26 -0
  349. package/dist/lib/control-styles.js +34 -0
  350. package/dist/lib/datetime/detect.d.ts +4 -0
  351. package/dist/lib/datetime/detect.js +16 -0
  352. package/dist/lib/datetime/format-date.d.ts +22 -0
  353. package/dist/lib/datetime/format-date.js +73 -0
  354. package/dist/lib/datetime/format.d.ts +23 -0
  355. package/dist/lib/datetime/format.js +94 -0
  356. package/dist/lib/datetime/index.d.ts +5 -35
  357. package/dist/lib/datetime/index.js +50 -1
  358. package/dist/lib/datetime/parse.d.ts +12 -0
  359. package/dist/lib/datetime/parse.js +56 -0
  360. package/dist/lib/datetime/sync.d.ts +19 -0
  361. package/dist/lib/datetime/sync.js +45 -0
  362. package/dist/lib/format.d.ts +21 -0
  363. package/dist/{chunk-X6AJ5HEI.js → lib/format.js} +35 -5
  364. package/dist/lib/hooks.d.ts +4 -6
  365. package/dist/lib/hooks.js +70 -1
  366. package/dist/lib/utils.d.ts +2 -5
  367. package/dist/lib/utils.js +8 -1
  368. package/dist/lib/variants.d.ts +12 -0
  369. package/dist/lib/variants.js +38 -0
  370. package/dist/{app.prop-CVY8V4ss.d.ts → props/components/app.prop.d.ts} +8 -12
  371. package/dist/props/components/app.prop.js +0 -0
  372. package/dist/{data-display.prop-CT0nVMdp.d.ts → props/components/data-display.prop.d.ts} +7 -15
  373. package/dist/props/components/data-display.prop.js +0 -0
  374. package/dist/{data-entry.prop-BSUaseKh.d.ts → props/components/data-entry.prop.d.ts} +46 -91
  375. package/dist/props/components/data-entry.prop.js +0 -0
  376. package/dist/{feedback.prop-CHlHDYZK.d.ts → props/components/feedback.prop.d.ts} +10 -16
  377. package/dist/props/components/feedback.prop.js +0 -0
  378. package/dist/{form.prop-5cyL3bvT.d.ts → props/components/form.prop.d.ts} +10 -14
  379. package/dist/props/components/form.prop.js +0 -0
  380. package/dist/{general.prop-CzlQin6v.d.ts → props/components/general.prop.d.ts} +5 -10
  381. package/dist/props/components/general.prop.js +0 -0
  382. package/dist/props/components/index.d.ts +9 -27
  383. package/dist/props/components/index.js +0 -1
  384. package/dist/{layout.prop-fCz-Vlie.d.ts → props/components/layout.prop.d.ts} +19 -26
  385. package/dist/props/components/layout.prop.js +0 -0
  386. package/dist/{navigation.prop-FCsOVGrP.d.ts → props/components/navigation.prop.d.ts} +10 -15
  387. package/dist/props/components/navigation.prop.js +0 -0
  388. package/dist/{query.prop-CT2gFtr4.d.ts → props/components/query.prop.d.ts} +12 -15
  389. package/dist/props/components/query.prop.js +0 -0
  390. package/dist/props/index.d.ts +7 -28
  391. package/dist/props/index.js +12 -3
  392. package/dist/props/registry.d.ts +5 -7
  393. package/dist/props/registry.js +998 -1
  394. package/dist/{content.prop-DrV_zDy-.d.ts → props/vocabulary/content.prop.d.ts} +12 -16
  395. package/dist/props/vocabulary/content.prop.js +0 -0
  396. package/dist/props/vocabulary/data.prop.d.ts +45 -0
  397. package/dist/props/vocabulary/data.prop.js +0 -0
  398. package/dist/props/vocabulary/index.d.ts +7 -7
  399. package/dist/props/vocabulary/index.js +0 -1
  400. package/dist/props/vocabulary/interaction.prop.d.ts +45 -0
  401. package/dist/props/vocabulary/interaction.prop.js +0 -0
  402. package/dist/props/vocabulary/layout.prop.d.ts +14 -0
  403. package/dist/props/vocabulary/layout.prop.js +0 -0
  404. package/dist/{navigation.prop-CXDaVNaR.d.ts → props/vocabulary/navigation.prop.d.ts} +3 -7
  405. package/dist/props/vocabulary/navigation.prop.js +0 -0
  406. package/dist/{shared.prop-BvMSLFJ6.d.ts → props/vocabulary/shared.prop.d.ts} +23 -27
  407. package/dist/props/vocabulary/shared.prop.js +0 -0
  408. package/dist/styles/table-layout.css +38 -0
  409. package/dist/tokens/components/table.css +2 -0
  410. package/package.json +2 -2
  411. package/dist/aspect-ratio-CZZJd9Km.d.ts +0 -9
  412. package/dist/avatar-D9MdXzfF.d.ts +0 -8
  413. package/dist/checkbox-bBfLARyF.d.ts +0 -13
  414. package/dist/chunk-2H65B4JA.js +0 -1
  415. package/dist/chunk-2RGPEFAW.js +0 -46
  416. package/dist/chunk-3JORZPS7.js +0 -232
  417. package/dist/chunk-3VFNWVR7.js +0 -153
  418. package/dist/chunk-4FGE5XVC.js +0 -996
  419. package/dist/chunk-5732TWQF.js +0 -1206
  420. package/dist/chunk-57VDEN64.js +0 -881
  421. package/dist/chunk-5LTW2LWF.js +0 -182
  422. package/dist/chunk-65RWSIZF.js +0 -327
  423. package/dist/chunk-7PWBC4BY.js +0 -25
  424. package/dist/chunk-B4K4BXEF.js +0 -18
  425. package/dist/chunk-B6S6LTWT.js +0 -464
  426. package/dist/chunk-B73NA66T.js +0 -122
  427. package/dist/chunk-B775Y6BE.js +0 -1
  428. package/dist/chunk-D4JX6O2W.js +0 -114
  429. package/dist/chunk-DV52WNXO.js +0 -8
  430. package/dist/chunk-DY5C44UP.js +0 -55
  431. package/dist/chunk-EG3RDM6F.js +0 -288
  432. package/dist/chunk-ES4Q3KGL.js +0 -1
  433. package/dist/chunk-FQGGF7GQ.js +0 -320
  434. package/dist/chunk-GJXOBDER.js +0 -1
  435. package/dist/chunk-HIEGUYPP.js +0 -95
  436. package/dist/chunk-HL3G4SVG.js +0 -131
  437. package/dist/chunk-I6G4IO7V.js +0 -485
  438. package/dist/chunk-I7NQ2LIL.js +0 -40
  439. package/dist/chunk-IJ5ALJGA.js +0 -31
  440. package/dist/chunk-INIIF7F7.js +0 -47
  441. package/dist/chunk-ION2KFXK.js +0 -75
  442. package/dist/chunk-J2DEWIYY.js +0 -37
  443. package/dist/chunk-K24AQV4R.js +0 -98
  444. package/dist/chunk-LFW37FGG.js +0 -68
  445. package/dist/chunk-LMKUKCTN.js +0 -150
  446. package/dist/chunk-NU2SOVTU.js +0 -96
  447. package/dist/chunk-NVTZ2EDW.js +0 -389
  448. package/dist/chunk-NZBAFFWP.js +0 -214
  449. package/dist/chunk-OO5DZH45.js +0 -587
  450. package/dist/chunk-Q3KUZG4P.js +0 -86
  451. package/dist/chunk-QROC2RMH.js +0 -150
  452. package/dist/chunk-QVBOICFU.js +0 -145
  453. package/dist/chunk-R2TXLS7S.js +0 -137
  454. package/dist/chunk-RZ32HY5E.js +0 -331
  455. package/dist/chunk-S2IJKT3D.js +0 -89
  456. package/dist/chunk-TBJBVEIP.js +0 -52
  457. package/dist/chunk-TO7URV7U.js +0 -51
  458. package/dist/chunk-U7N2A7A3.js +0 -9
  459. package/dist/chunk-V3N266PT.js +0 -106
  460. package/dist/chunk-W4REF4TD.js +0 -42
  461. package/dist/chunk-WGWI7EGL.js +0 -83
  462. package/dist/chunk-WY3VYUMX.js +0 -193
  463. package/dist/chunk-XBFUROAY.js +0 -117
  464. package/dist/chunk-XK3M3VRR.js +0 -32
  465. package/dist/chunk-YXVJFYQE.js +0 -191
  466. package/dist/chunk-ZT5UEUBO.js +0 -1
  467. package/dist/data-table-DRr70ULe.d.ts +0 -80
  468. package/dist/data.prop-D0UEEczj.d.ts +0 -42
  469. package/dist/filter-bar-DoDtwYrr.d.ts +0 -7
  470. package/dist/flex-1Cy46L0M.d.ts +0 -12
  471. package/dist/format-date-ByyZoqI5.d.ts +0 -51
  472. package/dist/interaction.prop-DD46aTro.d.ts +0 -47
  473. package/dist/layout.prop-CXvl2rVR.d.ts +0 -16
  474. package/dist/password-strength-DVRvXEOK.d.ts +0 -47
  475. package/dist/search-input-D4v1JGOA.d.ts +0 -27
  476. package/dist/skeleton-cj9kh5wo.d.ts +0 -20
  477. package/dist/types-mvzYGrma.d.ts +0 -37
@@ -1,587 +0,0 @@
1
- import { Slider } from './chunk-TBJBVEIP.js';
2
- import { formatBytes } from './chunk-X6AJ5HEI.js';
3
- import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter } from './chunk-RZ32HY5E.js';
4
- import { Button } from './chunk-XBFUROAY.js';
5
- import { controlIconClass } from './chunk-B4K4BXEF.js';
6
- import { useTranslation } from './chunk-B6S6LTWT.js';
7
- import { cn } from './chunk-U7N2A7A3.js';
8
- import * as React2 from 'react';
9
- import { Upload as Upload$1, ImagePlus, Camera, Trash2, RotateCcw, X } from 'lucide-react';
10
- import { jsx, jsxs } from 'react/jsx-runtime';
11
-
12
- function UploadCropDialog({ open, onOpenChange, file, onConfirm }) {
13
- const { t } = useTranslation();
14
- const [scale, setScale] = React2.useState(1.2);
15
- const [src, setSrc] = React2.useState(null);
16
- const imgRef = React2.useRef(null);
17
- React2.useEffect(() => {
18
- if (!file) {
19
- setSrc(null);
20
- return;
21
- }
22
- const url = URL.createObjectURL(file);
23
- setSrc(url);
24
- return () => URL.revokeObjectURL(url);
25
- }, [file]);
26
- const handleConfirm = async () => {
27
- const img = imgRef.current;
28
- if (!img || !file) return;
29
- const size = 256;
30
- const canvas = document.createElement("canvas");
31
- canvas.width = size;
32
- canvas.height = size;
33
- const ctx = canvas.getContext("2d");
34
- if (!ctx) return;
35
- const iw = img.naturalWidth;
36
- const ih = img.naturalHeight;
37
- const side = Math.min(iw, ih) / scale;
38
- const sx = (iw - side) / 2;
39
- const sy = (ih - side) / 2;
40
- ctx.drawImage(img, sx, sy, side, side, 0, 0, size, size);
41
- const blob = await new Promise(
42
- (resolve) => canvas.toBlob(resolve, "image/jpeg", 0.92)
43
- );
44
- if (!blob) return;
45
- const cropped = new File([blob], file.name.replace(/\.\w+$/, "") + ".jpg", {
46
- type: "image/jpeg"
47
- });
48
- onConfirm(cropped);
49
- onOpenChange(false);
50
- };
51
- return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-w-sm", children: [
52
- /* @__PURE__ */ jsxs(DialogHeader, { children: [
53
- /* @__PURE__ */ jsx(DialogTitle, { children: t("dataEntry.upload.cropTitle") }),
54
- /* @__PURE__ */ jsx(DialogDescription, { children: t("dataEntry.upload.cropDescription") })
55
- ] }),
56
- /* @__PURE__ */ jsxs("div", { className: "ui-stack-sm", children: [
57
- /* @__PURE__ */ jsx(
58
- "div",
59
- {
60
- className: cn(
61
- "bg-muted relative mx-auto size-48 overflow-hidden rounded-full border",
62
- "flex items-center justify-center"
63
- ),
64
- children: src ? /* @__PURE__ */ jsx(
65
- "img",
66
- {
67
- ref: imgRef,
68
- src,
69
- alt: "",
70
- className: "size-full object-cover transition-transform duration-150",
71
- style: { transform: `scale(${scale})` }
72
- }
73
- ) : null
74
- }
75
- ),
76
- /* @__PURE__ */ jsxs("div", { className: "ui-stack-xs px-2", children: [
77
- /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-xs", children: t("dataEntry.upload.cropZoom") }),
78
- /* @__PURE__ */ jsx(
79
- Slider,
80
- {
81
- min: 1,
82
- max: 2.5,
83
- step: 0.05,
84
- value: [scale],
85
- onValueChange: (v) => setScale(v[0] ?? 1),
86
- "aria-label": t("dataEntry.upload.cropZoom")
87
- }
88
- )
89
- ] })
90
- ] }),
91
- /* @__PURE__ */ jsxs(DialogFooter, { children: [
92
- /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: () => onOpenChange(false), children: t("common.cancel") }),
93
- /* @__PURE__ */ jsx(Button, { onClick: () => void handleConfirm(), children: t("dataEntry.upload.cropConfirm") })
94
- ] })
95
- ] }) });
96
- }
97
-
98
- // src/components/data-entry/upload-types.ts
99
- function createUploadItem(file, partial) {
100
- const previewUrl = file.type.startsWith("image/") ? URL.createObjectURL(file) : void 0;
101
- return {
102
- uid: partial?.uid ?? crypto.randomUUID(),
103
- name: file.name,
104
- size: file.size,
105
- mimeType: file.type,
106
- previewUrl,
107
- status: "idle",
108
- file,
109
- ...partial
110
- };
111
- }
112
- function revokePreviewUrl(item) {
113
- if (item?.previewUrl?.startsWith("blob:")) URL.revokeObjectURL(item.previewUrl);
114
- }
115
- function collectUploadCommitActions(items) {
116
- const deleteMediaIds = [];
117
- const promoteMediaIds = [];
118
- for (const item of items) {
119
- if (item.pendingDelete && item.mediaId) {
120
- deleteMediaIds.push(item.mediaId);
121
- continue;
122
- }
123
- if (item.pendingReplace && item.replacesMediaId) {
124
- deleteMediaIds.push(item.replacesMediaId);
125
- }
126
- if (item.mediaId && !item.pendingDelete && item.status !== "error") {
127
- promoteMediaIds.push(item.mediaId);
128
- }
129
- }
130
- return {
131
- deleteMediaIds: [...new Set(deleteMediaIds)],
132
- promoteMediaIds: [...new Set(promoteMediaIds)]
133
- };
134
- }
135
- function useUploadDraft({ value, onChange }) {
136
- const [baseline, setBaseline] = React2.useState(value ?? null);
137
- React2.useEffect(() => {
138
- if (value && !value.pendingDelete && !value.pendingReplace && value.mediaId) {
139
- setBaseline(value);
140
- }
141
- }, [value]);
142
- const markRemove = React2.useCallback(() => {
143
- if (!value) return;
144
- onChange?.({ ...value, pendingDelete: true, pendingReplace: false, status: "removed" });
145
- }, [onChange, value]);
146
- const undoRemove = React2.useCallback(() => {
147
- if (!baseline) {
148
- onChange?.(null);
149
- return;
150
- }
151
- onChange?.({ ...baseline, pendingDelete: false, pendingReplace: false, status: "done" });
152
- }, [baseline, onChange]);
153
- const stageReplace = React2.useCallback(
154
- (file) => {
155
- revokePreviewUrl(value);
156
- const next = createUploadItem(file, {
157
- pendingReplace: Boolean(value?.mediaId),
158
- replacesMediaId: value?.mediaId,
159
- status: "idle"
160
- });
161
- onChange?.({ ...next, pendingDelete: false });
162
- },
163
- [onChange, value]
164
- );
165
- const undoReplace = React2.useCallback(() => {
166
- revokePreviewUrl(value);
167
- onChange?.(baseline ? { ...baseline, pendingReplace: false, pendingDelete: false } : null);
168
- }, [baseline, onChange, value]);
169
- const getCommitActions = React2.useCallback(() => {
170
- if (!value) return { deleteMediaIds: [], promoteMediaIds: [] };
171
- const deleteMediaIds = [];
172
- if (value.pendingDelete && value.mediaId) deleteMediaIds.push(value.mediaId);
173
- if (value.pendingReplace && value.replacesMediaId) deleteMediaIds.push(value.replacesMediaId);
174
- const promoteMediaIds = value.mediaId && !value.pendingDelete && value.status !== "error" ? [value.mediaId] : [];
175
- return {
176
- deleteMediaIds: [...new Set(deleteMediaIds)],
177
- promoteMediaIds: [...new Set(promoteMediaIds)]
178
- };
179
- }, [value]);
180
- const state = React2.useMemo(
181
- () => ({
182
- display: value ?? null,
183
- baseline,
184
- canUndoRemove: Boolean(value?.pendingDelete),
185
- canUndoReplace: Boolean(value?.pendingReplace)
186
- }),
187
- [baseline, value]
188
- );
189
- return { state, markRemove, undoRemove, stageReplace, undoReplace, getCommitActions };
190
- }
191
- function defaultAcceptForVariant(variant) {
192
- if (variant === "avatar" || variant === "avatar-crop" || variant === "picture" || variant === "picture-card") {
193
- return "image/*";
194
- }
195
- return void 0;
196
- }
197
- function defaultMaxCount(variant) {
198
- if (variant === "avatar" || variant === "avatar-crop" || variant === "picture") return 1;
199
- return void 0;
200
- }
201
- function fileMatchesAccept(file, accept) {
202
- if (!accept) return true;
203
- return accept.split(",").some((rule) => {
204
- const trimmed = rule.trim();
205
- if (trimmed.endsWith("/*")) return file.type.startsWith(trimmed.slice(0, -1));
206
- return file.type === trimmed || file.name.endsWith(trimmed);
207
- });
208
- }
209
- function useUploadList(controlled, defaultValue, onValueChange) {
210
- const [internal, setInternal] = React2.useState(defaultValue ?? []);
211
- const items = controlled ?? internal;
212
- const itemsRef = React2.useRef(items);
213
- itemsRef.current = items;
214
- const setItems = React2.useCallback(
215
- (next) => {
216
- const resolved = typeof next === "function" ? next(itemsRef.current) : next;
217
- itemsRef.current = resolved;
218
- if (controlled === void 0) setInternal(resolved);
219
- onValueChange?.(resolved);
220
- },
221
- [controlled, onValueChange]
222
- );
223
- return [items, setItems];
224
- }
225
- async function runUpload(file, item, onUpload, setItems) {
226
- const uid = item.uid;
227
- setItems((prev) => prev.map((it) => it.uid === uid ? { ...it, status: "uploading" } : it));
228
- try {
229
- const result = await onUpload(file, item);
230
- setItems(
231
- (prev) => prev.map(
232
- (it) => it.uid === uid ? {
233
- ...it,
234
- status: "done",
235
- mediaId: result.mediaId,
236
- previewUrl: result.previewUrl ?? it.previewUrl,
237
- file: void 0
238
- } : it
239
- )
240
- );
241
- } catch (err) {
242
- const message = err instanceof Error ? err.message : String(err);
243
- setItems(
244
- (prev) => prev.map((it) => it.uid === uid ? { ...it, status: "error", error: message } : it)
245
- );
246
- }
247
- }
248
- function Upload({
249
- variant = "dropzone",
250
- value,
251
- defaultValue,
252
- onValueChange,
253
- accept: acceptProp,
254
- multiple: multipleProp,
255
- maxCount: maxCountProp,
256
- maxSizeBytes,
257
- disabled,
258
- removable = true,
259
- onUpload,
260
- className,
261
- children
262
- }) {
263
- const { t } = useTranslation();
264
- const accept = acceptProp ?? defaultAcceptForVariant(variant);
265
- const maxCount = maxCountProp ?? defaultMaxCount(variant);
266
- const multiple = multipleProp ?? (maxCount === 1 ? false : true);
267
- const inputRef = React2.useRef(null);
268
- const [dragActive, setDragActive] = React2.useState(false);
269
- const [cropFile, setCropFile] = React2.useState(null);
270
- const [items, setItems] = useUploadList(value, defaultValue, onValueChange);
271
- const isSingleAvatar = variant === "avatar" || variant === "avatar-crop" || variant === "picture" && maxCount === 1;
272
- const singleItem = isSingleAvatar ? items[0] ?? null : null;
273
- const draft = useUploadDraft({
274
- value: singleItem,
275
- onChange: (next) => {
276
- setItems(next ? [next] : []);
277
- }
278
- });
279
- const pickFiles = (fileList) => {
280
- if (!fileList?.length || disabled) return;
281
- const slotsLeft = maxCount != null ? Math.max(0, maxCount - items.length) : fileList.length;
282
- const candidates = Array.from(fileList).slice(0, multiple ? slotsLeft || fileList.length : 1);
283
- for (const file of candidates) {
284
- if (!fileMatchesAccept(file, accept)) continue;
285
- if (maxSizeBytes != null && file.size > maxSizeBytes) continue;
286
- if (variant === "avatar-crop") {
287
- setCropFile(file);
288
- return;
289
- }
290
- if (isSingleAvatar) {
291
- const baseline = items[0];
292
- const item3 = createUploadItem(file, {
293
- pendingReplace: Boolean(baseline?.mediaId),
294
- replacesMediaId: baseline?.mediaId
295
- });
296
- setItems([item3]);
297
- if (onUpload) void runUpload(file, item3, onUpload, setItems);
298
- return;
299
- }
300
- const item2 = createUploadItem(file);
301
- setItems((prev) => [...prev, item2]);
302
- if (onUpload) void runUpload(file, item2, onUpload, setItems);
303
- }
304
- };
305
- const removeItem = (uid) => {
306
- if (isSingleAvatar) {
307
- draft.markRemove();
308
- return;
309
- }
310
- setItems((prev) => {
311
- const target = prev.find((it) => it.uid === uid);
312
- revokePreviewUrl(target);
313
- return prev.filter((it) => it.uid !== uid);
314
- });
315
- };
316
- const hiddenInput = /* @__PURE__ */ jsx(
317
- "input",
318
- {
319
- ref: inputRef,
320
- type: "file",
321
- className: "sr-only",
322
- accept,
323
- multiple: multiple && !isSingleAvatar,
324
- disabled,
325
- "aria-label": t("dataEntry.upload.inputLabel"),
326
- onChange: (e) => {
327
- pickFiles(e.target.files);
328
- e.target.value = "";
329
- }
330
- }
331
- );
332
- const uploadingCount = items.filter((it) => it.status === "uploading").length;
333
- const doneCount = items.filter((it) => it.status === "done").length;
334
- const errorCount = items.filter((it) => it.status === "error").length;
335
- const liveRegion = /* @__PURE__ */ jsx("span", { "aria-live": "polite", className: "sr-only", "data-slot": "upload-status", children: errorCount > 0 ? t("dataEntry.upload.statusFailed", { count: errorCount }) : uploadingCount > 0 ? t("dataEntry.upload.statusUploading", { count: uploadingCount }) : items.length > 0 ? t("dataEntry.upload.statusReady", { count: items.length, done: doneCount }) : "" });
336
- const openPicker = () => {
337
- if (!disabled) inputRef.current?.click();
338
- };
339
- if (variant === "dropzone") {
340
- return /* @__PURE__ */ jsxs("div", { className: cn("ui-stack-sm", className), children: [
341
- hiddenInput,
342
- liveRegion,
343
- /* @__PURE__ */ jsxs(
344
- "div",
345
- {
346
- role: "button",
347
- tabIndex: disabled ? -1 : 0,
348
- "aria-disabled": disabled,
349
- "aria-label": t("dataEntry.upload.dropzoneLabel"),
350
- onClick: openPicker,
351
- onKeyDown: (e) => {
352
- if (e.key === "Enter" || e.key === " ") {
353
- e.preventDefault();
354
- openPicker();
355
- }
356
- },
357
- onDragOver: (e) => {
358
- e.preventDefault();
359
- setDragActive(true);
360
- },
361
- onDragLeave: () => setDragActive(false),
362
- onDrop: (e) => {
363
- e.preventDefault();
364
- setDragActive(false);
365
- pickFiles(e.dataTransfer.files);
366
- },
367
- className: cn(
368
- "cursor-pointer rounded-lg border-2 border-dashed p-10 text-center transition-colors",
369
- dragActive ? "border-primary bg-primary/5" : "border-border hover:border-primary/50",
370
- disabled && "pointer-events-none opacity-50"
371
- ),
372
- children: [
373
- /* @__PURE__ */ jsx(Upload$1, { className: "text-muted-foreground mx-auto size-10", "aria-hidden": "true" }),
374
- /* @__PURE__ */ jsx("p", { className: "mt-3 text-sm", children: t("dataEntry.upload.dropzoneHint") }),
375
- /* @__PURE__ */ jsx("p", { className: "text-muted-foreground mt-1 text-xs", children: t("dataEntry.upload.dropzoneMeta") })
376
- ]
377
- }
378
- ),
379
- items.length > 0 && /* @__PURE__ */ jsx(UploadFileList, { items, onRemove: removable ? removeItem : void 0 })
380
- ] });
381
- }
382
- if (variant === "button") {
383
- return /* @__PURE__ */ jsxs("div", { className: cn("ui-stack-sm", className), children: [
384
- hiddenInput,
385
- liveRegion,
386
- /* @__PURE__ */ jsxs(Button, { type: "button", variant: "outline", disabled, onClick: openPicker, children: [
387
- /* @__PURE__ */ jsx(Upload$1, { className: "me-2 size-4", "aria-hidden": "true" }),
388
- children ?? t("dataEntry.upload.buttonLabel")
389
- ] }),
390
- items.length > 0 && /* @__PURE__ */ jsx(UploadFileList, { items, onRemove: removable ? removeItem : void 0 })
391
- ] });
392
- }
393
- if (variant === "picture-card") {
394
- const canAdd = maxCount == null || items.length < maxCount;
395
- return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-wrap gap-3", className), children: [
396
- hiddenInput,
397
- liveRegion,
398
- items.map((item2) => /* @__PURE__ */ jsx(
399
- UploadPictureCard,
400
- {
401
- item: item2,
402
- onRemove: removable ? () => removeItem(item2.uid) : void 0
403
- },
404
- item2.uid
405
- )),
406
- canAdd && /* @__PURE__ */ jsxs(
407
- "button",
408
- {
409
- type: "button",
410
- disabled,
411
- onClick: openPicker,
412
- className: cn(
413
- "flex size-24 flex-col items-center justify-center rounded-md border border-dashed",
414
- "text-muted-foreground hover:border-primary hover:text-primary transition-colors",
415
- disabled && "pointer-events-none opacity-50"
416
- ),
417
- "aria-label": t("dataEntry.upload.addImage"),
418
- children: [
419
- /* @__PURE__ */ jsx(ImagePlus, { className: "size-6", "aria-hidden": "true" }),
420
- /* @__PURE__ */ jsx("span", { className: "mt-1 text-xs", children: t("dataEntry.upload.addImage") })
421
- ]
422
- }
423
- )
424
- ] });
425
- }
426
- if (variant === "picture") {
427
- const item2 = draft.state.display;
428
- return /* @__PURE__ */ jsxs("div", { className: cn("ui-stack-sm max-w-xs", className), children: [
429
- hiddenInput,
430
- liveRegion,
431
- item2?.previewUrl && !item2.pendingDelete ? /* @__PURE__ */ jsxs("div", { className: "relative overflow-hidden rounded-md border", children: [
432
- /* @__PURE__ */ jsx("img", { src: item2.previewUrl, alt: "", className: "max-h-48 w-full object-cover" }),
433
- item2.status === "uploading" && /* @__PURE__ */ jsx("div", { className: "bg-background/70 absolute inset-0 flex items-center justify-center text-sm", children: t("dataEntry.upload.uploading") }),
434
- item2.pendingReplace && /* @__PURE__ */ jsx("div", { className: "bg-warning text-warning-foreground absolute start-2 top-2 rounded px-2 py-0.5 text-xs", children: t("dataEntry.upload.pendingReplace") })
435
- ] }) : /* @__PURE__ */ jsxs(
436
- "button",
437
- {
438
- type: "button",
439
- disabled,
440
- onClick: openPicker,
441
- className: "text-muted-foreground hover:border-primary flex h-32 w-full flex-col items-center justify-center rounded-md border border-dashed",
442
- children: [
443
- /* @__PURE__ */ jsx(ImagePlus, { className: controlIconClass, "aria-hidden": "true" }),
444
- /* @__PURE__ */ jsx("span", { className: "mt-2 text-sm", children: t("dataEntry.upload.addImage") })
445
- ]
446
- }
447
- ),
448
- /* @__PURE__ */ jsx(UploadDraftActions, { draft, disabled, onPick: openPicker })
449
- ] });
450
- }
451
- const item = draft.state.display;
452
- const showPlaceholder = !item?.previewUrl || item.pendingDelete;
453
- return /* @__PURE__ */ jsxs("div", { className: cn("ui-stack-sm items-start", className), children: [
454
- hiddenInput,
455
- liveRegion,
456
- /* @__PURE__ */ jsx(
457
- UploadCropDialog,
458
- {
459
- open: variant === "avatar-crop" && cropFile != null,
460
- onOpenChange: (open) => !open && setCropFile(null),
461
- file: cropFile,
462
- onConfirm: (cropped) => {
463
- const baseline = items[0];
464
- const item2 = createUploadItem(cropped, {
465
- pendingReplace: Boolean(baseline?.mediaId),
466
- replacesMediaId: baseline?.mediaId
467
- });
468
- setItems([item2]);
469
- setCropFile(null);
470
- if (onUpload) void runUpload(cropped, item2, onUpload, setItems);
471
- }
472
- }
473
- ),
474
- /* @__PURE__ */ jsxs("div", { className: "relative inline-block", children: [
475
- /* @__PURE__ */ jsxs(
476
- "button",
477
- {
478
- type: "button",
479
- disabled,
480
- onClick: openPicker,
481
- className: cn(
482
- "border-border bg-muted relative size-24 overflow-hidden rounded-full border-2",
483
- "focus-visible:ring-ring focus-visible:ring-2 focus-visible:outline-none",
484
- item?.pendingDelete && "opacity-40",
485
- disabled && "pointer-events-none opacity-50"
486
- ),
487
- "aria-label": t("dataEntry.upload.avatarLabel"),
488
- children: [
489
- !showPlaceholder && item?.previewUrl ? /* @__PURE__ */ jsx("img", { src: item.previewUrl, alt: "", className: "size-full object-cover" }) : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground flex size-full items-center justify-center", children: /* @__PURE__ */ jsx(Camera, { className: controlIconClass, "aria-hidden": "true" }) }),
490
- !disabled && /* @__PURE__ */ jsx("span", { className: "text-2xs absolute inset-x-0 bottom-0 bg-black/50 py-1 text-center text-white", children: t("dataEntry.upload.change") })
491
- ]
492
- }
493
- ),
494
- removable && item && !item.pendingDelete && /* @__PURE__ */ jsx(
495
- "button",
496
- {
497
- type: "button",
498
- disabled,
499
- onClick: () => draft.markRemove(),
500
- className: "bg-background hover:bg-destructive hover:text-destructive-foreground absolute -end-1 -top-1 rounded-full border p-1 shadow-sm",
501
- "aria-label": t("dataEntry.upload.removeAvatar"),
502
- children: /* @__PURE__ */ jsx(Trash2, { className: "size-3.5", "aria-hidden": "true" })
503
- }
504
- )
505
- ] }),
506
- /* @__PURE__ */ jsx(UploadDraftActions, { draft, disabled, onPick: openPicker })
507
- ] });
508
- }
509
- function UploadDraftActions({
510
- draft,
511
- disabled,
512
- onPick
513
- }) {
514
- const { t } = useTranslation();
515
- const { state, undoRemove, undoReplace } = draft;
516
- if (state.canUndoRemove) {
517
- return /* @__PURE__ */ jsxs("div", { className: "border-destructive/40 bg-destructive/5 flex flex-wrap items-center gap-2 rounded-md border border-dashed px-3 py-2 text-sm", children: [
518
- /* @__PURE__ */ jsx("span", { className: "text-destructive", children: t("dataEntry.upload.markedForDelete") }),
519
- /* @__PURE__ */ jsxs(Button, { type: "button", size: "sm", variant: "outline", disabled, onClick: undoRemove, children: [
520
- /* @__PURE__ */ jsx(RotateCcw, { className: "me-1 size-3.5", "aria-hidden": "true" }),
521
- t("dataEntry.upload.undo")
522
- ] })
523
- ] });
524
- }
525
- if (state.canUndoReplace) {
526
- return /* @__PURE__ */ jsxs("div", { className: "text-muted-foreground flex flex-wrap items-center gap-2 text-sm", children: [
527
- /* @__PURE__ */ jsx("span", { children: t("dataEntry.upload.pendingReplaceHint") }),
528
- /* @__PURE__ */ jsx(Button, { type: "button", size: "sm", variant: "ghost", disabled, onClick: undoReplace, children: t("dataEntry.upload.undo") }),
529
- /* @__PURE__ */ jsx(Button, { type: "button", size: "sm", variant: "outline", disabled, onClick: onPick, children: t("dataEntry.upload.change") })
530
- ] });
531
- }
532
- return null;
533
- }
534
- function UploadPictureCard({ item, onRemove }) {
535
- const { t } = useTranslation();
536
- return /* @__PURE__ */ jsxs("div", { className: "bg-muted relative size-24 overflow-hidden rounded-md border", children: [
537
- item.previewUrl ? /* @__PURE__ */ jsx("img", { src: item.previewUrl, alt: "", className: "size-full object-cover" }) : /* @__PURE__ */ jsx("div", { className: "text-muted-foreground flex size-full items-center justify-center text-xs", children: "\u2026" }),
538
- item.status === "uploading" && /* @__PURE__ */ jsx("div", { className: "bg-background/70 absolute inset-0 flex items-center justify-center text-xs", children: "\u2026" }),
539
- onRemove && /* @__PURE__ */ jsx(
540
- "button",
541
- {
542
- type: "button",
543
- onClick: onRemove,
544
- className: "bg-background/90 hover:bg-destructive hover:text-destructive-foreground absolute end-1 top-1 rounded-full p-0.5 shadow",
545
- "aria-label": t("dataEntry.upload.removeImage"),
546
- children: /* @__PURE__ */ jsx(X, { className: "size-3.5", "aria-hidden": "true" })
547
- }
548
- )
549
- ] });
550
- }
551
- function UploadFileList({
552
- items,
553
- onRemove
554
- }) {
555
- const { t } = useTranslation();
556
- return /* @__PURE__ */ jsx("ul", { className: "ui-stack-xs", children: items.map((item) => /* @__PURE__ */ jsxs("li", { className: "flex items-center gap-3 rounded-md border px-3 py-2 text-sm", children: [
557
- /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
558
- /* @__PURE__ */ jsx("div", { className: "truncate font-medium", children: item.name }),
559
- /* @__PURE__ */ jsxs("div", { className: "text-muted-foreground text-xs", children: [
560
- formatBytes(item.size),
561
- item.status === "uploading" && " \xB7 \u2026",
562
- item.status === "error" && item.error && /* @__PURE__ */ jsxs("span", { className: "text-destructive", children: [
563
- " \xB7 ",
564
- item.error
565
- ] }),
566
- item.mediaId && /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
567
- " \xB7 ",
568
- item.mediaId.slice(0, 8),
569
- "\u2026"
570
- ] })
571
- ] })
572
- ] }),
573
- onRemove && /* @__PURE__ */ jsx(
574
- Button,
575
- {
576
- type: "button",
577
- size: "sm",
578
- variant: "ghost",
579
- "aria-label": t("dataEntry.upload.removeFile", { name: item.name }),
580
- onClick: () => onRemove(item.uid),
581
- children: /* @__PURE__ */ jsx(X, { className: "size-4", "aria-hidden": "true" })
582
- }
583
- )
584
- ] }, item.uid)) });
585
- }
586
-
587
- export { Upload, collectUploadCommitActions, createUploadItem, useUploadDraft };
@@ -1,86 +0,0 @@
1
- import { controlMultilineClass } from './chunk-B4K4BXEF.js';
2
- import { useTranslation } from './chunk-B6S6LTWT.js';
3
- import { cn } from './chunk-U7N2A7A3.js';
4
- import * as React from 'react';
5
- import { X } from 'lucide-react';
6
- import { jsx, jsxs } from 'react/jsx-runtime';
7
-
8
- var Textarea = React.forwardRef(
9
- ({ className, allowClear = false, onClear, value, defaultValue, onChange, ...props }, ref) => {
10
- const { t } = useTranslation();
11
- const innerRef = React.useRef(null);
12
- const setRefs = React.useCallback(
13
- (node) => {
14
- innerRef.current = node;
15
- if (typeof ref === "function") ref(node);
16
- else if (ref) ref.current = node;
17
- },
18
- [ref]
19
- );
20
- const [hasText, setHasText] = React.useState(
21
- () => String(value ?? defaultValue ?? "").length > 0
22
- );
23
- React.useEffect(() => {
24
- if (value !== void 0) setHasText(String(value).length > 0);
25
- }, [value]);
26
- const handleChange = (event) => {
27
- if (value === void 0) setHasText(event.target.value.length > 0);
28
- onChange?.(event);
29
- };
30
- const clear = () => {
31
- const el = innerRef.current;
32
- if (el) {
33
- const setter = Object.getOwnPropertyDescriptor(
34
- window.HTMLTextAreaElement.prototype,
35
- "value"
36
- )?.set;
37
- setter?.call(el, "");
38
- el.dispatchEvent(new Event("input", { bubbles: true }));
39
- el.focus();
40
- }
41
- setHasText(false);
42
- onClear?.();
43
- };
44
- if (!allowClear) {
45
- return /* @__PURE__ */ jsx(
46
- "textarea",
47
- {
48
- ref: setRefs,
49
- value,
50
- defaultValue,
51
- onChange,
52
- className: cn(controlMultilineClass, className),
53
- ...props
54
- }
55
- );
56
- }
57
- const showClear = hasText && !props.disabled && !props.readOnly;
58
- return /* @__PURE__ */ jsxs("span", { "data-slot": "textarea-affix-wrapper", className: "relative block w-full", children: [
59
- /* @__PURE__ */ jsx(
60
- "textarea",
61
- {
62
- ref: setRefs,
63
- value,
64
- defaultValue,
65
- onChange: handleChange,
66
- className: cn(controlMultilineClass, showClear && "pe-9", className),
67
- ...props
68
- }
69
- ),
70
- showClear ? /* @__PURE__ */ jsx(
71
- "button",
72
- {
73
- type: "button",
74
- tabIndex: -1,
75
- "aria-label": t("common.clear") ?? "Clear",
76
- onClick: clear,
77
- className: "text-muted-foreground hover:text-foreground absolute end-2 top-2 inline-flex size-5 items-center justify-center rounded-sm opacity-70 transition-opacity hover:opacity-100 focus-visible:opacity-100",
78
- children: /* @__PURE__ */ jsx(X, { className: "size-4", "aria-hidden": "true" })
79
- }
80
- ) : null
81
- ] });
82
- }
83
- );
84
- Textarea.displayName = "Textarea";
85
-
86
- export { Textarea };