@povio/ui 6.0.0-rc.12 → 6.0.0-rc.14

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 (523) hide show
  1. package/README.md +523 -42
  2. package/dist/{Accordion-ORBin0EZ.js → Accordion-BNHpv7Zj.js} +42 -42
  3. package/dist/{Accordion-Cup5eRZz.d.ts → Accordion-CR9oomZY.d.ts} +29 -17
  4. package/dist/Alert-xHGPLUpt.d.ts +36 -0
  5. package/dist/AlertDialog-CKcUZ6l9.d.ts +70 -0
  6. package/dist/Autocomplete-CkWTSFoj.d.ts +123 -0
  7. package/dist/Autocomplete-CrNDRxvg.js +319 -0
  8. package/dist/Badge-B25YEMEw.d.ts +67 -0
  9. package/dist/BottomSheet-CtcPZG82.d.ts +65 -0
  10. package/dist/{BottomSheet-CGipksM_.js → BottomSheet-tUXH3NjS.js} +9 -9
  11. package/dist/{BottomSheet.lazy-CuJMUeJP.d.ts → BottomSheet.lazy-DuwAJSaI.d.ts} +1 -1
  12. package/dist/{Breadcrumbs-CcB0oOF8.d.ts → Breadcrumbs-BrtRh_dX.d.ts} +6 -3
  13. package/dist/{Breadcrumbs-a1-q_he0.js → Breadcrumbs-D8WXqOLN.js} +36 -20
  14. package/dist/{Button-BaODzvZd.js → Button-C1Jv1Plk.js} +1 -1
  15. package/dist/{Button-0SswSdDg.d.ts → Button-DDuk3hJ3.d.ts} +2 -2
  16. package/dist/{Button-C1YB5dOw.js → Button-DF6sbTuF.js} +3 -7
  17. package/dist/{ButtonBase-s-VV7oCa.js → ButtonBase-BYJz1JkH.js} +12 -20
  18. package/dist/ButtonBase-Bn_FT89h.d.ts +47 -0
  19. package/dist/{ButtonContent-Dztbuz3q.js → ButtonContent-2KsbdWRO.js} +5 -5
  20. package/dist/{Calendar-yaQubCWK.js → Calendar-DdneUEhM.js} +71 -35
  21. package/dist/{Calendar.lazy-DcVss9Bk.js → Calendar.lazy-BY0kLoYH.js} +7 -7
  22. package/dist/Checkbox-Bwl6MA-V.d.ts +49 -0
  23. package/dist/{Checkbox-Bjsbx-wK.js → Checkbox-E2bns_n0.js} +40 -14
  24. package/dist/CheckboxCheckmark-Beu8T1g9.js +42 -0
  25. package/dist/CheckboxGroup-0rzsn-bA.d.ts +52 -0
  26. package/dist/{CheckboxGroup-B3O3IUiu.js → CheckboxGroup-C7epIEpW.js} +75 -35
  27. package/dist/ColumnConfigContent-LNq-6Brf.js +1025 -0
  28. package/dist/ColumnListContent-Dzze5R7T.js +133 -0
  29. package/dist/DatePicker-B70SCKfT.d.ts +80 -0
  30. package/dist/{DatePicker-bme8zGBo.js → DatePicker-BU-34fCk.js} +117 -46
  31. package/dist/{DatePickerInput-vLlL5ATh.d.ts → DatePickerInput-BCuz08Ws.d.ts} +3 -3
  32. package/dist/{DatePickerInput-C2881tvS.js → DatePickerInput-CMEJmZSQ.js} +41 -30
  33. package/dist/{DateRangePicker-Blg158JD.js → DateRangePicker-D0RtqeBM.js} +90 -162
  34. package/dist/DateRangePicker-jovxcWGk.d.ts +102 -0
  35. package/dist/{DateTimePicker-CdRFt8WM.js → DateTimePicker-Cbdt76CL.js} +94 -40
  36. package/dist/DateTimePicker-Cfi3ruFy.d.ts +83 -0
  37. package/dist/Dialog-BWNQjIgo.d.ts +66 -0
  38. package/dist/{Dialog-C9H9_BmK.js → Dialog-Bpwr1nuy.js} +15 -15
  39. package/dist/{Dialog-DN5703sy.js → Dialog-ebjPH22i.js} +23 -19
  40. package/dist/{Disclosure-BRSkMbZQ.js → Disclosure-D_aym2zh.js} +3 -3
  41. package/dist/Drawer-o018RqIt.d.ts +42 -0
  42. package/dist/DropdownMenu-3V-G7fZ7.d.ts +51 -0
  43. package/dist/{DropdownMenu-DS0RaEfH.js → DropdownMenu-C4WitobV.js} +33 -21
  44. package/dist/{DropdownMenuDesktop-DGPIfex-.js → DropdownMenuDesktop-BM7659Sk.js} +14 -8
  45. package/dist/{FileInput-BUwtAF2-.js → FileInput-Bc_E1M1X.js} +76 -81
  46. package/dist/FileInput-CWRW7OzZ.d.ts +61 -0
  47. package/dist/{FileTrigger-DlryDp2T.js → FileTrigger-tGSUFrb2.js} +6 -6
  48. package/dist/FileUpload-DVnp9xxv.d.ts +181 -0
  49. package/dist/FileUpload-Dk6ZmgWF.js +1105 -0
  50. package/dist/{Form-CqF1SaVw.js → Form-4jZarkjk.js} +2 -2
  51. package/dist/FormField-BgiWLGjf.d.ts +70 -0
  52. package/dist/{FormField-dduTMkNH.js → FormField-DOZ7eXjA.js} +11 -11
  53. package/dist/{FormFieldError-BT4uxbKY.d.ts → FormFieldError-C7yOdjzQ.d.ts} +1 -0
  54. package/dist/FormFieldHeaderTooltip-DW9sqJWl.js +22 -0
  55. package/dist/{Heading-D4XFYv__.js → Heading-B9G3z6Es.js} +2 -2
  56. package/dist/HiddenFormValue-DZ2d9eoA.js +20 -0
  57. package/dist/IconButton-Bjjf5cQL.d.ts +24 -0
  58. package/dist/{IconSlot-CqNuZl0E.js → IconSlot-TAWTJ6iK.js} +2 -4
  59. package/dist/{InlineTooltipWrapper-CKTiFpZn.js → InlineTooltipWrapper-CcdpMJa6.js} +1 -1
  60. package/dist/{Input-BG0Xjw5X.js → Input-BkR3jkvt.js} +2 -2
  61. package/dist/{Input-CG5LQ0zs.js → Input-CvYyjMWx.js} +95 -60
  62. package/dist/Input-lppNS8wM.d.ts +56 -0
  63. package/dist/{InputContent-Fx2E4UXl.js → InputContent-B5YjsLDE.js} +15 -13
  64. package/dist/InputContent-Bgalf6R1.d.ts +39 -0
  65. package/dist/{Label-BGvF9vWx.js → Label-VTcaaLO8.js} +2 -2
  66. package/dist/{Link-Chux-Clm.js → Link-8zP_NC_c.js} +2 -2
  67. package/dist/Link-HJ4y-xiW.d.ts +15 -0
  68. package/dist/{ListBox-DhR5kojP.js → ListBox-Ck-B1Jae.js} +9 -9
  69. package/dist/{Modal-DcLWF9cB.js → Modal-xT-Wz5GH.js} +3 -3
  70. package/dist/{NumberField-DxuikBcr.js → NumberField-BXLzNb2T.js} +92 -63
  71. package/dist/NumberField-Q-4y3jpb.d.ts +41 -0
  72. package/dist/{NumberFormatter-DYarfm5F.js → NumberFormatter-D5csbNXm.js} +1 -1
  73. package/dist/{NumberRangeInput-8bOjNEnS.js → NumberRangeInput-BBzZCC54.js} +153 -102
  74. package/dist/NumberRangeInput-DuWOdSdU.d.ts +89 -0
  75. package/dist/{OverlayArrow-DF0jMwul.js → OverlayArrow-BptI-A_7.js} +2 -2
  76. package/dist/{PageHeader-DTfzf-dA.d.ts → PageHeader-jVaC3Z9L.d.ts} +6 -5
  77. package/dist/PasswordInput-DtTnGHRD.d.ts +16 -0
  78. package/dist/{PasswordInput.bound-Dfq5c3JQ.js → PasswordInput-U0QhNsMp.js} +6 -6
  79. package/dist/Popover-ClCEOP3e.d.ts +51 -0
  80. package/dist/Progress-DlXY0dv_.js +180 -0
  81. package/dist/Progress-VkkXbIh7.d.ts +26 -0
  82. package/dist/ProgressBar-mpNpV7ow.js +46 -0
  83. package/dist/{RadioGroup-IL4Y8XHO.js → RadioGroup-BPPJyA1s.js} +72 -32
  84. package/dist/RadioGroup-BbcrP56w.d.ts +52 -0
  85. package/dist/{RangeCalendar-DT63UD8K.js → RangeCalendar-DIVjIl0T.js} +12 -10
  86. package/dist/Select-D1qIWZCv.d.ts +248 -0
  87. package/dist/{Select-BM8PNrjC.js → Select-DlbVDCz8.js} +452 -191
  88. package/dist/{SelectListBox-BFSZxDSi.js → SelectListBox-CCr5YY86.js} +55 -43
  89. package/dist/{SelectionIndicator-C3hniBa2.js → SelectionIndicator-CvuKjZRP.js} +3 -3
  90. package/dist/{SharedElementTransition-CZ2bE7yo.js → SharedElementTransition-BkyYit3Q.js} +2 -2
  91. package/dist/{SidebarWorkspaces-DJknAfS9.js → SidebarWorkspaces-CIpFJGOa.js} +283 -366
  92. package/dist/{SidebarWorkspaces-DDHJAdNH.d.ts → SidebarWorkspaces-DcwA_jv7.d.ts} +31 -17
  93. package/dist/Slider-CLViwkE1.d.ts +57 -0
  94. package/dist/{Slider-DCsCCPFx.js → Slider-_RsgBJcg.js} +72 -15
  95. package/dist/Spinner-GMEauCHv.d.ts +13 -0
  96. package/dist/SplitButton-BdP4xjFQ.d.ts +25 -0
  97. package/dist/{Stepper-Dyhxp0Tl.js → Stepper-D4z7JNsD.js} +116 -88
  98. package/dist/Stepper-DBb0qfla.d.ts +49 -0
  99. package/dist/{Switch-BfpSMMpv.js → Switch-Bi3_bUw1.js} +56 -14
  100. package/dist/Switch-DCxONL2Q.d.ts +42 -0
  101. package/dist/TableDnd-CG1yOlxh.js +238 -0
  102. package/dist/TableDragHandle-CXApnuUm.js +51 -0
  103. package/dist/{TabsFilters-DybNturW.js → TabsFilters-BPogry73.js} +46 -35
  104. package/dist/TabsFilters-CPfGBODw.d.ts +59 -0
  105. package/dist/Tag-xhcJOv_X.d.ts +26 -0
  106. package/dist/{Text-D72yc4S6.js → Text-D7Nqkw1l.js} +1 -1
  107. package/dist/TextArea-BYX9Kk_v.d.ts +33 -0
  108. package/dist/{TextArea-Blsip3ZC.js → TextArea-CuJS3-Nv.js} +62 -35
  109. package/dist/{TimePicker-4hV5zbgd.js → TimePicker-ByfjqkLp.js} +120 -56
  110. package/dist/TimePicker-UTo9C6gz.d.ts +64 -0
  111. package/dist/TimePickerForm-CaIHR0PV.js +532 -0
  112. package/dist/{ToastContainer-Dd0LPykL.js → ToastContainer-tr7Zxahc.js} +4 -4
  113. package/dist/{ToggleButton-HUZ8ij6i.d.ts → ToggleButton-BX8o7ECO.d.ts} +2 -2
  114. package/dist/{ToggleButton-P1z1pxzT.js → ToggleButton-D8BT67FO.js} +5 -5
  115. package/dist/ToggleGroup-18c-FZ_r.js +500 -0
  116. package/dist/ToggleGroup-UazUtgU1.d.ts +95 -0
  117. package/dist/{Tooltip-DRB6lo0U.js → Tooltip-Dl3sf8fq.js} +5 -5
  118. package/dist/Tooltip-FcJ29dhq.d.ts +33 -0
  119. package/dist/TooltipEllipsis-7QF00kXk.d.ts +21 -0
  120. package/dist/{TooltipWrapper-BSY31JMc.js → TooltipWrapper-bvNpM6ku.js} +6 -6
  121. package/dist/{Typography-DJojwiXV.d.ts → Typography-auHWN282.d.ts} +5 -1
  122. package/dist/{badgeButton.cva-t5PQOH4M.js → badge.cva-C9mE8CMf.js} +23 -24
  123. package/dist/{button.cva-Ciga0rdG.js → button.cva-C2aoXMh-.js} +10 -16
  124. package/dist/{buttonContent.cva-BapnODby.d.ts → buttonContent.cva-CeGnrjoA.d.ts} +2 -2
  125. package/dist/calendarHeader.cva-D3sXR7ox.js +23 -0
  126. package/dist/{checkbox.cva-aLJS7v4z.js → checkbox.cva-qU_q0lSX.js} +14 -14
  127. package/dist/columnConfig.cva-CERwSZRN.js +29 -0
  128. package/dist/components/accordion.d.ts +1 -1
  129. package/dist/components/accordion.js +1 -1
  130. package/dist/components/alert-dialog.d.ts +2 -2
  131. package/dist/components/alert-dialog.js +174 -128
  132. package/dist/components/alert.d.ts +1 -1
  133. package/dist/components/alert.js +17 -15
  134. package/dist/components/autocomplete.d.ts +2 -2
  135. package/dist/components/autocomplete.js +1 -1
  136. package/dist/components/badge.d.ts +2 -2
  137. package/dist/components/badge.js +166 -81
  138. package/dist/components/bottom-sheet-header.d.ts +1 -1
  139. package/dist/components/bottom-sheet-header.js +25 -21
  140. package/dist/components/bottom-sheet.d.ts +2 -2
  141. package/dist/components/bottom-sheet.js +2 -2
  142. package/dist/components/breadcrumbs.d.ts +1 -1
  143. package/dist/components/breadcrumbs.js +1 -1
  144. package/dist/components/button.d.ts +2 -2
  145. package/dist/components/button.js +1 -1
  146. package/dist/components/checkbox-group.d.ts +2 -2
  147. package/dist/components/checkbox-group.js +1 -1
  148. package/dist/components/checkbox.d.ts +2 -2
  149. package/dist/components/checkbox.js +1 -1
  150. package/dist/components/date-picker.d.ts +2 -2
  151. package/dist/components/date-picker.js +1 -1
  152. package/dist/components/date-range-picker.d.ts +4 -41
  153. package/dist/components/date-range-picker.js +4 -2
  154. package/dist/components/date-range-presets.d.ts +2 -0
  155. package/dist/components/date-range-presets.js +3 -0
  156. package/dist/components/date-time-picker.d.ts +2 -2
  157. package/dist/components/date-time-picker.js +1 -1
  158. package/dist/components/dialog.d.ts +1 -1
  159. package/dist/components/dialog.js +1 -1
  160. package/dist/components/drawer.d.ts +1 -1
  161. package/dist/components/drawer.js +16 -80
  162. package/dist/components/dropdown-menu.d.ts +2 -3
  163. package/dist/components/dropdown-menu.js +2 -3
  164. package/dist/components/file-input.d.ts +2 -2
  165. package/dist/components/file-input.js +1 -1
  166. package/dist/components/file-upload.d.ts +2 -3
  167. package/dist/components/file-upload.js +1 -1
  168. package/dist/components/form-field.d.ts +3 -2
  169. package/dist/components/form-field.js +1 -1
  170. package/dist/components/icon-button.d.ts +1 -1
  171. package/dist/components/icon-button.js +22 -25
  172. package/dist/components/icon-slot.d.ts +1 -2
  173. package/dist/components/icon-slot.js +2 -2
  174. package/dist/components/input-frame.d.ts +6 -10
  175. package/dist/components/input-frame.js +31 -28
  176. package/dist/components/input.d.ts +2 -2
  177. package/dist/components/input.js +2 -2
  178. package/dist/components/link.d.ts +1 -1
  179. package/dist/components/link.js +2 -2
  180. package/dist/components/number-field.d.ts +2 -2
  181. package/dist/components/number-field.js +2 -2
  182. package/dist/components/number-range-input.d.ts +2 -2
  183. package/dist/components/number-range-input.js +1 -1
  184. package/dist/components/page-header.d.ts +1 -1
  185. package/dist/components/page-header.js +5 -5
  186. package/dist/components/password-input.d.ts +2 -2
  187. package/dist/components/password-input.js +1 -22
  188. package/dist/components/popover.d.ts +1 -1
  189. package/dist/components/popover.js +105 -87
  190. package/dist/components/progress.d.ts +2 -2
  191. package/dist/components/progress.js +1 -1
  192. package/dist/components/radio-group.d.ts +2 -2
  193. package/dist/components/radio-group.js +1 -1
  194. package/dist/components/select.d.ts +2 -2
  195. package/dist/components/select.js +1 -1
  196. package/dist/components/sidebar.d.ts +1 -1
  197. package/dist/components/sidebar.js +1 -1
  198. package/dist/components/slider.d.ts +2 -2
  199. package/dist/components/slider.js +1 -1
  200. package/dist/components/spinner.d.ts +1 -1
  201. package/dist/components/spinner.js +71 -1
  202. package/dist/components/split-button.d.ts +1 -1
  203. package/dist/components/split-button.js +15 -4
  204. package/dist/components/stepper.d.ts +1 -1
  205. package/dist/components/stepper.js +1 -1
  206. package/dist/components/style-definitions.d.ts +3 -3
  207. package/dist/components/style-definitions.js +62 -20
  208. package/dist/components/switch.d.ts +2 -2
  209. package/dist/components/switch.js +1 -1
  210. package/dist/components/tabs-filters.d.ts +1 -1
  211. package/dist/components/tabs-filters.js +1 -1
  212. package/dist/components/tag.d.ts +1 -1
  213. package/dist/components/tag.js +50 -64
  214. package/dist/components/text-area.d.ts +2 -2
  215. package/dist/components/text-area.js +1 -1
  216. package/dist/components/time-picker.d.ts +2 -2
  217. package/dist/components/time-picker.js +1 -1
  218. package/dist/components/toast.d.ts +3 -3
  219. package/dist/components/toast.js +4 -3
  220. package/dist/components/toggle-button.d.ts +1 -1
  221. package/dist/components/toggle-button.js +1 -1
  222. package/dist/components/toggle-group.d.ts +2 -2
  223. package/dist/components/toggle-group.js +1 -1
  224. package/dist/components/tooltip-ellipsis.d.ts +1 -1
  225. package/dist/components/tooltip-ellipsis.js +1 -1
  226. package/dist/components/tooltip.d.ts +1 -1
  227. package/dist/components/tooltip.js +1 -1
  228. package/dist/components/typography.d.ts +2 -2
  229. package/dist/components/use-toast.d.ts +2 -2
  230. package/dist/components/use-toast.js +1 -41
  231. package/dist/config/component-configuration.d.ts +2 -2
  232. package/dist/config/component-configuration.js +53 -2
  233. package/dist/config/confirmation.d.ts +1 -1
  234. package/dist/config/confirmation.js +1 -1
  235. package/dist/config/link-context.d.ts +3 -3
  236. package/dist/config/link-context.js +1 -1
  237. package/dist/config/resources.d.ts +1 -1
  238. package/dist/config/resources.js +1 -1
  239. package/dist/config/ui-config.d.ts +2 -2
  240. package/dist/config/ui-config.js +1 -1
  241. package/dist/config/ui-overrides.d.ts +1 -1
  242. package/dist/config/ui-router.d.ts +1 -1
  243. package/dist/config/ui-router.js +1 -1
  244. package/dist/confirmation.context-C_-uADGJ.js +93 -0
  245. package/dist/confirmation.context-DkWyR2aT.d.ts +32 -0
  246. package/dist/{datePickerInput.cva-Du0Zn04v.js → datePickerInput.cva-CWkV2fut.js} +1 -1
  247. package/dist/dateRangePreset.utils-Bnb-rjTt.js +116 -0
  248. package/dist/{dialog.cva-BIpz6HcA.js → dialog.cva-BjVggO5l.js} +1 -1
  249. package/dist/{dist-DEZzXa0W.js → dist-CP6vV22I.js} +68 -39
  250. package/dist/{dom.utils-BPooTXtC.js → dom.utils-CqejLWIQ.js} +1 -1
  251. package/dist/{dropdownMenu.cva-DwSOcbmR.js → dropdownMenu.cva-BopsvbOy.js} +19 -7
  252. package/dist/{exports-BNrTn8Tj.js → exports-DeBGRThC.js} +3 -3
  253. package/dist/{file.utils-Crb-mIHs.d.ts → file.utils-DUADtzdt.d.ts} +3 -3
  254. package/dist/{file.utils-DqQxnuAm.js → file.utils-X6tkeWaz.js} +2 -6
  255. package/dist/fileInputButton.cva-gbqRUf1g.js +39 -0
  256. package/dist/{fileUpload.cva-BYzXGc9C.js → fileUpload.cva-SrF6v406.js} +3 -3
  257. package/dist/form-field-C735uXsi.d.ts +1 -0
  258. package/dist/form.binding-Brdjq2yr.js +161 -0
  259. package/dist/form.binding-DSXB2AOD.d.ts +127 -0
  260. package/dist/form.types-a2WVJDQX.d.ts +43 -0
  261. package/dist/formReset-CnZl_yze.js +35 -0
  262. package/dist/hints-B09_WDhL.d.ts +17 -0
  263. package/dist/hooks/use-async-list.d.ts +1 -1
  264. package/dist/hooks/use-async-list.js +1 -1
  265. package/dist/hooks/use-breakpoint.d.ts +3 -0
  266. package/dist/hooks/use-breakpoint.js +2 -0
  267. package/dist/hooks/use-filters.d.ts +2 -2
  268. package/dist/hooks/use-filters.js +1 -1
  269. package/dist/{i18n-D8vXIoiq.js → i18n-DaIHnR2n.js} +123 -9
  270. package/dist/{i18n-DM-PUcxQ.d.ts → i18n-xXkHgzet.d.ts} +124 -4
  271. package/dist/iconSlot.cva-DyhOI7EK.js +5 -0
  272. package/dist/{import-C7W0Wv2r.js → import-Cz8NlFqm.js} +40 -16
  273. package/dist/index.d.ts +66 -84
  274. package/dist/index.js +57 -92
  275. package/dist/{input.cva-DZii82eS.js → input.cva-mm1dnfKP.js} +27 -23
  276. package/dist/inputLayout-CIVpuUBq.js +7 -0
  277. package/dist/inputRow.clsx-BbcaXVta.js +6 -0
  278. package/dist/{intlStrings-Cu1YN1tA.js → intlStrings-ClpdCJmU.js} +35 -35
  279. package/dist/{isEqual-LFw0W5rU.js → isEqual-BdJdNr5O.js} +1 -1
  280. package/dist/{label.cva-DTfT6FrX.js → label.cva-DJ5Dmbz5.js} +7 -7
  281. package/dist/link.context-BxVK2yQ5.d.ts +20 -0
  282. package/dist/{link.context-TPjDtjw3.js → link.context-CD5h_b5O.js} +12 -11
  283. package/dist/link.cva-ZhpQz3P0.d.ts +2277 -0
  284. package/dist/{progress.cva-CsGaGVJ-.js → progress.cva-mkJxrrac.js} +2 -2
  285. package/dist/{radio.cva-DistaZtZ.js → radio.cva-Dt5N2ul2.js} +7 -7
  286. package/dist/rich-text-editor.d.ts +44 -2
  287. package/dist/rich-text-editor.js +733 -1
  288. package/dist/router.context-B6j_M4cN.js +151 -0
  289. package/dist/router.context-CSd9JYQ4.d.ts +33 -0
  290. package/dist/{selectDesktop.cva-DStkOdwm.js → selectDesktop.cva-30JAvtgB.js} +1 -1
  291. package/dist/{selectItem.cva-B6vxey2R.js → selectItem.cva-DsOZSSPx.js} +2 -1
  292. package/dist/sidebar.cva-BgxTCejU.js +150 -0
  293. package/dist/spinner.cva-j4kGmIWC.js +17 -0
  294. package/dist/{staticDateTimeSegments-CVuAhDDl.js → staticDateTimeSegments-BgUrcqXD.js} +379 -94
  295. package/dist/{status.cva-CYgi3Htz.js → status.cva-WLEqUAjH.js} +9 -9
  296. package/dist/styles/input.d.ts +1 -1
  297. package/dist/{table.cva-DkcsOmZG.js → table.cva-n9TO_vu1.js} +68 -17
  298. package/dist/tableCells.cva-Br0_kgRM.js +18 -0
  299. package/dist/tableColumnConfigStorage-Cciq8gVe.js +215 -0
  300. package/dist/tableVirtualStore-whSmFzTV.js +67 -0
  301. package/dist/tanstack/form.d.ts +3 -3
  302. package/dist/tanstack/form.js +3 -3
  303. package/dist/tanstack/table-context.d.ts +2 -0
  304. package/dist/tanstack/table-context.js +2 -0
  305. package/dist/tanstack/table-types.d.ts +55 -0
  306. package/dist/tanstack/table.d.ts +5 -3
  307. package/dist/tanstack/table.js +3 -2
  308. package/dist/tanstack-JB8VmS9j.js +73 -0
  309. package/dist/tanstack-cQOW9-Q2.d.ts +165 -0
  310. package/dist/tanstack-table-DdWYwCZM.d.ts +858 -0
  311. package/dist/tanstack-table-M1M26UQJ.js +5299 -0
  312. package/dist/tanstack.d.ts +66 -84
  313. package/dist/tanstack.js +57 -92
  314. package/dist/{toast.cva-B6NXTwbZ.js → toast.cva-DusQwZw-.js} +13 -9
  315. package/dist/toast.runtime-ZN5q4T9X.js +25 -0
  316. package/dist/{toggleGroup.cva-CJ-3Ps7j.js → toggleGroup.cva-CvNS5QO1.js} +2 -2
  317. package/dist/{uiConfig.context-3DN9w6oU.js → uiConfig.context-NWmBJ2Hc.js} +72 -10
  318. package/dist/uiConfig.context-ykH4E2js.d.ts +19 -0
  319. package/dist/uiConfig.types-BsyPKepP.d.ts +291 -0
  320. package/dist/{uiOverrides.context-DHHzLSnq.d.ts → uiOverrides.context-C5Maic5Q.d.ts} +106 -0
  321. package/dist/{useAsyncList-Ct74ve3i.js → useAsyncList-DkIjhlce.js} +142 -37
  322. package/dist/useAsyncList-F-328rtE.d.ts +25 -0
  323. package/dist/useAutoFocus-K-bfNxa2.js +16 -0
  324. package/dist/useBreakpoint-BPrZNuNl.d.ts +9 -0
  325. package/dist/{useBreakpoint-CJ3mx7UF.js → useBreakpoint-DtYSRweq.js} +6 -2
  326. package/dist/{useControlledState-CuU1VIh1.js → useControlledState-C1-Mt2i0.js} +1 -1
  327. package/dist/useDebounceCallback-C7YKfjXW.js +96 -0
  328. package/dist/useFilters-CybBXUAA.js +217 -0
  329. package/dist/useFilters-DrfBFNLw.d.ts +57 -0
  330. package/dist/useFormAutosave-BzCGqFqi.js +419 -0
  331. package/dist/{useFormAutosave-BBLm3Ujo.d.ts → useFormAutosave-ClMnzVE7.d.ts} +1 -1
  332. package/dist/{useIntersectionObserver-DFAhTsV0.js → useIntersectionObserver-B8msnQTR.js} +15 -3
  333. package/dist/{numberStatic.utils-BIyZuILs.js → useLiveNumberFieldState-npiqOvyB.js} +107 -6
  334. package/dist/useRemoveButton-zhlA1Pbc.js +98 -0
  335. package/dist/useResolveDateRangePreset-DOSzJR-N.d.ts +64 -0
  336. package/dist/useResolveDateRangePreset-k_h_XJBG.js +26 -0
  337. package/dist/{useScrollableListBox-oYKqU3Hp.js → useScrollableListBox-4pieApqz.js} +1 -1
  338. package/dist/{useStaticInputHandoff-BN0fOerH.js → useStaticInputHandoff-DrNFrvD7.js} +6 -1
  339. package/dist/useTableVirtualizer-sFInQiH-.d.ts +162 -0
  340. package/dist/useToast-BHqkSByv.d.ts +78 -0
  341. package/dist/useToast-DgqC6Ta_.js +63 -0
  342. package/dist/utils/file.d.ts +1 -1
  343. package/dist/utils/file.js +1 -1
  344. package/dist/{utils-BkLF-JA3.js → utils-Q5Oc6oX2.js} +1 -1
  345. package/llms.txt +3201 -0
  346. package/package.json +22 -118
  347. package/MIGRATION.md +0 -655
  348. package/dist/Alert-D4X7OWiv.d.ts +0 -34
  349. package/dist/AlertDialog-DklLDjmw.d.ts +0 -26
  350. package/dist/Autocomplete-BgFz3kuR.d.ts +0 -23
  351. package/dist/Autocomplete-Bn13u0zu.js +0 -145
  352. package/dist/Autocomplete.bound-CpHZZ3C9.d.ts +0 -9
  353. package/dist/Autocomplete.bound-Dwh__y-Z.js +0 -28
  354. package/dist/Badge-Db1ndK67.d.ts +0 -30
  355. package/dist/BadgeButton-BPhWDAnc.d.ts +0 -15
  356. package/dist/BottomSheet-BZmDJBR-.d.ts +0 -33
  357. package/dist/ButtonBase-CZuEy3Pk.d.ts +0 -32
  358. package/dist/Checkbox-w2j5hLOQ.d.ts +0 -27
  359. package/dist/Checkbox.bound-D2nBglJz.js +0 -33
  360. package/dist/Checkbox.bound-DD_RCjVm.d.ts +0 -9
  361. package/dist/CheckboxCheckmark-DWsYVZuu.js +0 -25
  362. package/dist/CheckboxGroup-BYI15Y09.d.ts +0 -30
  363. package/dist/CheckboxGroup.bound-DY0HKGSh.js +0 -32
  364. package/dist/CheckboxGroup.bound-QiJ-P0KR.d.ts +0 -9
  365. package/dist/ComboBox-ChsdI0lt.js +0 -212
  366. package/dist/DatePicker-QzfQf21b.d.ts +0 -56
  367. package/dist/DatePicker.bound-DoCAqhM4.d.ts +0 -9
  368. package/dist/DatePicker.bound-M2cjR37s.js +0 -36
  369. package/dist/DateRangePicker-32D4pWJg.d.ts +0 -97
  370. package/dist/DateRangePicker.bound-CVtoVsho.d.ts +0 -9
  371. package/dist/DateRangePicker.bound-CkIDsAUf.js +0 -35
  372. package/dist/DateTimePicker-BTRIUagV.d.ts +0 -55
  373. package/dist/DateTimePicker.bound-X4DTyQ1b.d.ts +0 -9
  374. package/dist/DateTimePicker.bound-nSCVUqd0.js +0 -32
  375. package/dist/Dialog-CO9xljD3.d.ts +0 -21
  376. package/dist/Drawer-D1cHiBFO.d.ts +0 -18
  377. package/dist/DropdownMenu-D_9z9ond.d.ts +0 -25
  378. package/dist/FileInput-BEaECoBS.d.ts +0 -75
  379. package/dist/FileInput.bound-C12mOKpg.js +0 -30
  380. package/dist/FileInput.bound-D2HuuqSb.d.ts +0 -8
  381. package/dist/FileUpload-BUTSqHVk.d.ts +0 -11
  382. package/dist/FileUpload-D7FMYm-k.js +0 -749
  383. package/dist/FileUpload.bound-CGQXb4iT.d.ts +0 -16
  384. package/dist/FileUpload.bound-DmkuulOi.js +0 -30
  385. package/dist/FileUploadContainer-Dzg5aXXZ.d.ts +0 -5
  386. package/dist/FormField-DGyCDxOp.d.ts +0 -42
  387. package/dist/FormFieldHeaderTooltip-Dt-g40Tc.js +0 -17
  388. package/dist/IconButton-shH_9wcl.d.ts +0 -25
  389. package/dist/Input-CTp_9mS9.d.ts +0 -34
  390. package/dist/Input.bound-B9a62ylL.d.ts +0 -9
  391. package/dist/Input.bound-DYoXyRGy.js +0 -31
  392. package/dist/InputContent-BCNkN4Fx.d.ts +0 -27
  393. package/dist/Link-PvYB_M-j.d.ts +0 -30
  394. package/dist/MenuItem-U3-pu1j5.d.ts +0 -6
  395. package/dist/NumberField-WXebfxjK.d.ts +0 -34
  396. package/dist/NumberField.bound-ChJnNyJS.js +0 -32
  397. package/dist/NumberField.bound-Dy0A5iVc.d.ts +0 -9
  398. package/dist/NumberRangeInput-BCKQaGpy.d.ts +0 -50
  399. package/dist/NumberRangeInput.bound-BF6P_ega.js +0 -32
  400. package/dist/NumberRangeInput.bound-BNXxIQ0b.d.ts +0 -9
  401. package/dist/PasswordInput-EhQjYyJS.d.ts +0 -11
  402. package/dist/PasswordInput.bound-CK5GwKL4.d.ts +0 -9
  403. package/dist/Popover-D_t1XDPA.d.ts +0 -20
  404. package/dist/Progress-Ckfpi_-M.d.ts +0 -45
  405. package/dist/Progress-RiEGGxNG.js +0 -119
  406. package/dist/RadioGroup-6e-Z6jW8.d.ts +0 -26
  407. package/dist/RadioGroup.bound-BFWSq-on.js +0 -32
  408. package/dist/RadioGroup.bound-w3SZqSkH.d.ts +0 -9
  409. package/dist/RichTextEditor-DHhuBeT6.d.ts +0 -28
  410. package/dist/RichTextEditor-DfwVdm45.js +0 -651
  411. package/dist/Select-C34ENdjq.d.ts +0 -119
  412. package/dist/Select.bound--Az1Xwgm.js +0 -34
  413. package/dist/Select.bound-qOihchei.d.ts +0 -17
  414. package/dist/Slider-DRg8zKRM.d.ts +0 -23
  415. package/dist/Slider.bound-CByTXPTr.js +0 -31
  416. package/dist/Slider.bound-CaEF19um.d.ts +0 -9
  417. package/dist/Spinner-Cvy_6zgD.d.ts +0 -30
  418. package/dist/Spinner-DqjP06T1.js +0 -101
  419. package/dist/SplitButton-V1f2NWfh.d.ts +0 -15
  420. package/dist/Stepper-k91x_m-E.d.ts +0 -114
  421. package/dist/Switch-ELVPkPx0.d.ts +0 -24
  422. package/dist/Switch.bound-DeEdVvZV.d.ts +0 -9
  423. package/dist/Switch.bound-Dv0cHsMM.js +0 -33
  424. package/dist/TableDnd-CuHxANWh.js +0 -133
  425. package/dist/TableRowDetails-D8HFTghI.d.ts +0 -109
  426. package/dist/TabsFilters-DePddjCk.d.ts +0 -30
  427. package/dist/Tag-B2_ZiSE-.d.ts +0 -44
  428. package/dist/TextArea-iqUeB2QY.d.ts +0 -26
  429. package/dist/TextArea.bound-BJHyCogp.d.ts +0 -9
  430. package/dist/TextArea.bound-DeaskY6r.js +0 -28
  431. package/dist/TimePicker-BZ1ocsBX.d.ts +0 -45
  432. package/dist/TimePicker.bound-8DmjMXuE.d.ts +0 -9
  433. package/dist/TimePicker.bound-BFSXJvE_.js +0 -32
  434. package/dist/TimePickerForm-DD9VA_td.js +0 -225
  435. package/dist/Toast-D9pdadZ4.d.ts +0 -16
  436. package/dist/ToggleGroup-CrDoeLN0.js +0 -333
  437. package/dist/ToggleGroup-DvjnSinl.d.ts +0 -42
  438. package/dist/ToggleGroup.bound-B03ISHQ8.d.ts +0 -9
  439. package/dist/ToggleGroup.bound-DCnYwmBt.js +0 -67
  440. package/dist/Tooltip-B8DTURLQ.d.ts +0 -16
  441. package/dist/TooltipEllipsis-Di9Dvd4x.d.ts +0 -11
  442. package/dist/badgeButton.cva-CBFIhr1S.d.ts +0 -41
  443. package/dist/button.cva-C8LGtNJ3.d.ts +0 -94
  444. package/dist/checkbox.cva-CCh_UlrC.d.ts +0 -76
  445. package/dist/components/badge-button.d.ts +0 -2
  446. package/dist/components/badge-button.js +0 -74
  447. package/dist/components/file-upload-container.d.ts +0 -3
  448. package/dist/components/file-upload-container.js +0 -15
  449. package/dist/confirmation.context-Bc2yEVp_.js +0 -114
  450. package/dist/confirmation.context-C_GDRn3a.d.ts +0 -23
  451. package/dist/fileUpload.types-C-ke21yY.d.ts +0 -110
  452. package/dist/form.binding-DOR5gIQf.js +0 -49
  453. package/dist/form.types-C8P4sznq.d.ts +0 -22
  454. package/dist/formFieldHelper.cva-DRmSyRZN.js +0 -14
  455. package/dist/iconSlot.cva-CLB5Tlsr.d.ts +0 -9
  456. package/dist/icons.d.ts +0 -4
  457. package/dist/icons.js +0 -3
  458. package/dist/input.cva-BjuHsDGy.d.ts +0 -80
  459. package/dist/inputLayout-KdAtunGk.js +0 -5
  460. package/dist/link.context-BCHn7NSy.d.ts +0 -12
  461. package/dist/radio.cva-D7M1hqLe.d.ts +0 -56
  462. package/dist/router.context-CtafjXV7.d.ts +0 -16
  463. package/dist/router.context-MckTbHw9.js +0 -63
  464. package/dist/routing.utils-DfxEt0_Y.js +0 -30
  465. package/dist/style-definitions-Dx6aFDiR.d.ts +0 -1038
  466. package/dist/switch.cva-r6vcS25Q.d.ts +0 -16
  467. package/dist/tanstack/autocomplete.d.ts +0 -3
  468. package/dist/tanstack/autocomplete.js +0 -2
  469. package/dist/tanstack/checkbox-group.d.ts +0 -3
  470. package/dist/tanstack/checkbox-group.js +0 -2
  471. package/dist/tanstack/checkbox.d.ts +0 -3
  472. package/dist/tanstack/checkbox.js +0 -2
  473. package/dist/tanstack/date-picker.d.ts +0 -3
  474. package/dist/tanstack/date-picker.js +0 -2
  475. package/dist/tanstack/date-range-picker.d.ts +0 -3
  476. package/dist/tanstack/date-range-picker.js +0 -2
  477. package/dist/tanstack/date-time-picker.d.ts +0 -3
  478. package/dist/tanstack/date-time-picker.js +0 -2
  479. package/dist/tanstack/file-input.d.ts +0 -3
  480. package/dist/tanstack/file-input.js +0 -2
  481. package/dist/tanstack/file-upload.d.ts +0 -4
  482. package/dist/tanstack/file-upload.js +0 -2
  483. package/dist/tanstack/input.d.ts +0 -3
  484. package/dist/tanstack/input.js +0 -2
  485. package/dist/tanstack/number-field.d.ts +0 -3
  486. package/dist/tanstack/number-field.js +0 -2
  487. package/dist/tanstack/number-range-input.d.ts +0 -3
  488. package/dist/tanstack/number-range-input.js +0 -2
  489. package/dist/tanstack/password-input.d.ts +0 -2
  490. package/dist/tanstack/password-input.js +0 -2
  491. package/dist/tanstack/radio-group.d.ts +0 -3
  492. package/dist/tanstack/radio-group.js +0 -2
  493. package/dist/tanstack/rich-text-editor.d.ts +0 -9
  494. package/dist/tanstack/rich-text-editor.js +0 -28
  495. package/dist/tanstack/select.d.ts +0 -3
  496. package/dist/tanstack/select.js +0 -2
  497. package/dist/tanstack/slider.d.ts +0 -3
  498. package/dist/tanstack/slider.js +0 -2
  499. package/dist/tanstack/switch.d.ts +0 -3
  500. package/dist/tanstack/switch.js +0 -2
  501. package/dist/tanstack/text-area.d.ts +0 -3
  502. package/dist/tanstack/text-area.js +0 -2
  503. package/dist/tanstack/time-picker.d.ts +0 -3
  504. package/dist/tanstack/time-picker.js +0 -2
  505. package/dist/tanstack/toggle-group.d.ts +0 -3
  506. package/dist/tanstack/toggle-group.js +0 -2
  507. package/dist/tanstack-Bgdv0qU1.js +0 -19
  508. package/dist/tanstack-wNbE6b-h.d.ts +0 -566
  509. package/dist/toast.cva-AmLw6Cf5.d.ts +0 -61
  510. package/dist/toast.runtime-Drd2IJ_j.js +0 -17
  511. package/dist/toastActivation.store-BELtcr76.js +0 -16
  512. package/dist/toggleGroup.cva-DA4U21gn.d.ts +0 -26
  513. package/dist/typography.cva-BCHlTHdM.d.ts +0 -36
  514. package/dist/uiConfig.context-BnCORTNm.d.ts +0 -132
  515. package/dist/useAsyncList-Cu-Y8If2.d.ts +0 -9
  516. package/dist/useFilters-BxRScJdn.d.ts +0 -11
  517. package/dist/useFilters-DMi94RZK.js +0 -190
  518. package/dist/useForm-Cb7KWLds.js +0 -217
  519. package/dist/useForm-I6z23FXf.d.ts +0 -51
  520. package/dist/useFormAutosave-BPGlChiY.js +0 -216
  521. package/dist/useTableColumnConfig-CXYgj5xi.js +0 -1906
  522. package/dist/useTableNav-BusSFEVC.d.ts +0 -197
  523. package/dist/useToast-DsA8CVoY.d.ts +0 -16
@@ -0,0 +1,1105 @@
1
+ import { t as clsx } from "./clsx-CnD0nOiA.js";
2
+ import { t as UIOverrides } from "./uiOverrides.context-DNEQlTx0.js";
3
+ import { t as IconSlot } from "./IconSlot-TAWTJ6iK.js";
4
+ import { n as $070c0dd15dc89b58$export$3c6489d84dc98b6, t as $b325d7bd7e74496a$export$6fb4a10d2c950550 } from "./FileTrigger-tGSUFrb2.js";
5
+ import { t as Typography } from "./Typography-DCLnPa3P.js";
6
+ import "./i18n-DaIHnR2n.js";
7
+ import { t as UIConfig } from "./uiConfig.context-NWmBJ2Hc.js";
8
+ import { t as Button } from "./Button-C1Jv1Plk.js";
9
+ import { IconButton } from "./components/icon-button.js";
10
+ import { n as FieldController, o as useStoreSelector, r as selectSubmissionAttempts } from "./form.binding-Brdjq2yr.js";
11
+ import { i as $a8ea2faf2ebe4d2f$re_export$useLabels, r as $a8ea2faf2ebe4d2f$re_export$mergeRefs } from "./import-D_3dPATF.js";
12
+ import { t as FormField } from "./FormField-DOZ7eXjA.js";
13
+ import { i as subscribeFormReset } from "./formReset-CnZl_yze.js";
14
+ import { t as FileUtils } from "./file.utils-X6tkeWaz.js";
15
+ import { t as Progress } from "./Progress-DlXY0dv_.js";
16
+ import { t as fileUploadDropZoneDefinition } from "./fileUpload.cva-SrF6v406.js";
17
+ import { memo, useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
18
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
19
+ import { CheckCircle, File, Upload, X } from "lucide-react";
20
+ import { flushSync } from "react-dom";
21
+ import { useTranslation } from "react-i18next";
22
+ //#region src/components/inputs/File/shared/fileUploadContent.cva.ts
23
+ const content = {
24
+ empty: "",
25
+ filled: "",
26
+ loading: ""
27
+ };
28
+ const orientation = {
29
+ vertical: "",
30
+ horizontal: ""
31
+ };
32
+ const actionStyle = {
33
+ button: "",
34
+ link: ""
35
+ };
36
+ const isDisabled = {
37
+ true: "",
38
+ false: ""
39
+ };
40
+ const fileUploadContentDefinition = UIOverrides.defineConfig({
41
+ base: [""],
42
+ config: {
43
+ variants: {
44
+ content,
45
+ orientation,
46
+ actionStyle
47
+ },
48
+ compoundVariants: [
49
+ {
50
+ content: "empty",
51
+ className: "flex w-full items-center"
52
+ },
53
+ {
54
+ content: "empty",
55
+ orientation: "vertical",
56
+ className: "flex-col gap-3"
57
+ },
58
+ {
59
+ content: "empty",
60
+ orientation: "horizontal",
61
+ className: "min-h-9 flex-row justify-between gap-4"
62
+ },
63
+ {
64
+ content: "filled",
65
+ className: "flex w-full items-center"
66
+ },
67
+ {
68
+ content: "filled",
69
+ orientation: "horizontal",
70
+ className: "flex-row gap-4"
71
+ },
72
+ {
73
+ content: "filled",
74
+ orientation: "vertical",
75
+ className: "flex-col"
76
+ },
77
+ {
78
+ content: "filled",
79
+ orientation: "vertical",
80
+ actionStyle: "button",
81
+ className: "gap-4"
82
+ },
83
+ {
84
+ content: "filled",
85
+ orientation: "vertical",
86
+ actionStyle: "link",
87
+ className: "gap-1"
88
+ },
89
+ {
90
+ content: "loading",
91
+ className: "flex w-full flex-col items-center"
92
+ },
93
+ {
94
+ content: "loading",
95
+ orientation: "vertical",
96
+ className: "flex-col"
97
+ },
98
+ {
99
+ content: "loading",
100
+ orientation: "horizontal",
101
+ className: "flex-row"
102
+ },
103
+ {
104
+ content: "loading",
105
+ actionStyle: "button",
106
+ className: "gap-4"
107
+ }
108
+ ]
109
+ }
110
+ });
111
+ const fileUploadContentBodyDefinition = UIOverrides.defineConfig({
112
+ base: ["flex w-full items-center justify-between"],
113
+ config: { variants: {
114
+ orientation: {
115
+ vertical: "flex-col gap-1",
116
+ horizontal: "flex-row gap-4"
117
+ },
118
+ isDisabled: {
119
+ true: "opacity-50",
120
+ false: ""
121
+ }
122
+ } }
123
+ });
124
+ const fileUploadContentLeadDefinition = UIOverrides.defineConfig({
125
+ base: [""],
126
+ config: {
127
+ variants: {
128
+ content,
129
+ orientation,
130
+ isDisabled
131
+ },
132
+ compoundVariants: [
133
+ {
134
+ content: "empty",
135
+ className: "flex min-w-0 items-center gap-2"
136
+ },
137
+ {
138
+ content: "filled",
139
+ className: "flex min-w-0 max-w-full grow items-center gap-2"
140
+ },
141
+ {
142
+ content: ["empty", "filled"],
143
+ orientation: "vertical",
144
+ className: "flex-col"
145
+ },
146
+ {
147
+ content: ["empty", "filled"],
148
+ orientation: "horizontal",
149
+ className: "flex-row"
150
+ },
151
+ {
152
+ content: ["empty", "filled"],
153
+ isDisabled: true,
154
+ className: "opacity-50"
155
+ },
156
+ {
157
+ content: "loading",
158
+ className: "flex items-center gap-2"
159
+ },
160
+ {
161
+ content: "loading",
162
+ orientation: "vertical",
163
+ className: "w-full flex-col"
164
+ },
165
+ {
166
+ content: "loading",
167
+ orientation: "horizontal",
168
+ className: "w-1/2"
169
+ }
170
+ ]
171
+ }
172
+ });
173
+ const fileUploadContentIconDefinition = UIOverrides.defineConfig({
174
+ base: [""],
175
+ config: { variants: { content: {
176
+ empty: "text-muted-foreground",
177
+ filled: "text-muted-foreground",
178
+ loading: "text-muted-foreground"
179
+ } } }
180
+ });
181
+ const fileUploadContentTextDefinition = UIOverrides.defineConfig({
182
+ base: [""],
183
+ config: {
184
+ variants: {
185
+ content,
186
+ orientation
187
+ },
188
+ compoundVariants: [
189
+ {
190
+ content: "empty",
191
+ className: "flex min-w-0 flex-col gap-0.5"
192
+ },
193
+ {
194
+ content: "empty",
195
+ orientation: "vertical",
196
+ className: "items-center text-center"
197
+ },
198
+ {
199
+ content: "filled",
200
+ className: "flex flex-col gap-1"
201
+ },
202
+ {
203
+ content: "filled",
204
+ orientation: "vertical",
205
+ className: "max-w-full items-center"
206
+ },
207
+ {
208
+ content: "filled",
209
+ orientation: "horizontal",
210
+ className: "max-w-[calc(100%-32px)]"
211
+ },
212
+ {
213
+ content: "loading",
214
+ className: "flex flex-col"
215
+ },
216
+ {
217
+ content: "loading",
218
+ orientation: "vertical",
219
+ className: "max-w-full gap-2 text-center"
220
+ },
221
+ {
222
+ content: "loading",
223
+ orientation: "horizontal",
224
+ className: "max-w-[calc(100%-32px)] gap-1"
225
+ }
226
+ ]
227
+ }
228
+ });
229
+ const fileUploadContentTitleDefinition = UIOverrides.defineConfig({
230
+ base: [""],
231
+ config: {
232
+ variants: {
233
+ content,
234
+ orientation
235
+ },
236
+ compoundVariants: [
237
+ {
238
+ content: "empty",
239
+ className: "text-foreground font-medium"
240
+ },
241
+ {
242
+ content: ["filled", "loading"],
243
+ className: "self-stretch truncate text-center text-foreground font-medium"
244
+ },
245
+ {
246
+ content: "empty",
247
+ orientation: "vertical",
248
+ className: "text-center"
249
+ }
250
+ ]
251
+ }
252
+ });
253
+ const fileUploadContentDescriptionDefinition = UIOverrides.defineConfig({
254
+ base: [""],
255
+ config: {
256
+ variants: {
257
+ content,
258
+ orientation,
259
+ isDisabled
260
+ },
261
+ compoundVariants: [
262
+ {
263
+ content: "empty",
264
+ className: "text-muted-foreground font-normal"
265
+ },
266
+ {
267
+ content: "filled",
268
+ className: "text-foreground"
269
+ },
270
+ {
271
+ content: "loading",
272
+ className: "text-muted-foreground"
273
+ },
274
+ {
275
+ content: "empty",
276
+ orientation: "vertical",
277
+ className: "text-center"
278
+ }
279
+ ]
280
+ }
281
+ });
282
+ const fileUploadContentActionsDefinition = UIOverrides.defineConfig({
283
+ base: [""],
284
+ config: {
285
+ variants: {
286
+ content,
287
+ orientation,
288
+ actionStyle
289
+ },
290
+ compoundVariants: [
291
+ {
292
+ content: "empty",
293
+ className: "flex flex-wrap items-center gap-1"
294
+ },
295
+ {
296
+ content: "filled",
297
+ className: "flex flex-none items-center justify-end"
298
+ },
299
+ {
300
+ content: "filled",
301
+ orientation: "vertical",
302
+ actionStyle: "button",
303
+ className: "flex-col"
304
+ },
305
+ {
306
+ content: "empty",
307
+ orientation: "vertical",
308
+ className: "justify-center"
309
+ },
310
+ {
311
+ content: "filled",
312
+ orientation: "vertical",
313
+ actionStyle: "link",
314
+ className: "gap-1"
315
+ },
316
+ {
317
+ content: "filled",
318
+ orientation: "vertical",
319
+ actionStyle: "button",
320
+ className: "gap-4"
321
+ },
322
+ {
323
+ content: "filled",
324
+ orientation: "horizontal",
325
+ className: "gap-2"
326
+ }
327
+ ]
328
+ }
329
+ });
330
+ const fileUploadContentLinkDefinition = UIOverrides.defineConfig({
331
+ base: [""],
332
+ config: {
333
+ variants: {
334
+ content,
335
+ orientation,
336
+ action: {
337
+ browse: "",
338
+ remove: ""
339
+ }
340
+ },
341
+ compoundVariants: [
342
+ {
343
+ content: "empty",
344
+ action: "browse",
345
+ className: "text-xs text-primary lowercase"
346
+ },
347
+ {
348
+ content: "filled",
349
+ action: "browse",
350
+ className: "text-primary"
351
+ },
352
+ {
353
+ content: "filled",
354
+ action: "browse",
355
+ orientation: "vertical",
356
+ className: "[&>span>span]:font-medium!"
357
+ },
358
+ {
359
+ content: "filled",
360
+ action: "remove",
361
+ orientation: "vertical",
362
+ className: "text-primary lowercase [&>span>span]:font-medium!"
363
+ }
364
+ ]
365
+ }
366
+ });
367
+ const fileUploadContentSeparatorDefinition = UIOverrides.defineConfig({
368
+ base: [""],
369
+ config: { variants: { content: {
370
+ empty: "",
371
+ filled: "text-muted-foreground",
372
+ loading: ""
373
+ } } }
374
+ });
375
+ const fileUploadContentButtonsDefinition = UIOverrides.defineConfig({ base: ["flex items-center justify-center gap-2 self-stretch"] });
376
+ const fileUploadCardDefinition = UIOverrides.defineConfig({ base: [
377
+ "flex items-center self-stretch",
378
+ "bg-card",
379
+ "px-3",
380
+ "py-4",
381
+ "rounded-lg border border-border border-solid"
382
+ ] });
383
+ const fileUploadCardListDefinition = UIOverrides.defineConfig({ base: ["mt-4 flex flex-col items-start gap-2 self-stretch"] });
384
+ const fileUploadGroupDefinition = UIOverrides.defineConfig({ base: ["flex w-full items-center justify-between gap-2"] });
385
+ //#endregion
386
+ //#region src/components/inputs/File/shared/useFileUploadContentStyles.ts
387
+ /** The class builders of a file upload content's parts, with the app's `fileUpload.*` overrides. */
388
+ const useFileUploadContentStyles = () => ({
389
+ content: UIOverrides.useCva("fileUpload.contentCva", fileUploadContentDefinition),
390
+ body: UIOverrides.useCva("fileUpload.contentBodyCva", fileUploadContentBodyDefinition),
391
+ lead: UIOverrides.useCva("fileUpload.contentLeadCva", fileUploadContentLeadDefinition),
392
+ icon: UIOverrides.useCva("fileUpload.contentIconCva", fileUploadContentIconDefinition),
393
+ text: UIOverrides.useCva("fileUpload.contentTextCva", fileUploadContentTextDefinition),
394
+ title: UIOverrides.useCva("fileUpload.contentTitleCva", fileUploadContentTitleDefinition),
395
+ description: UIOverrides.useCva("fileUpload.contentDescriptionCva", fileUploadContentDescriptionDefinition),
396
+ actions: UIOverrides.useCva("fileUpload.contentActionsCva", fileUploadContentActionsDefinition),
397
+ link: UIOverrides.useCva("fileUpload.contentLinkCva", fileUploadContentLinkDefinition),
398
+ separator: UIOverrides.useCva("fileUpload.contentSeparatorCva", fileUploadContentSeparatorDefinition),
399
+ buttons: UIOverrides.useCva("fileUpload.contentButtonsCva", fileUploadContentButtonsDefinition)
400
+ });
401
+ const useFileUploadCardStyles = () => ({
402
+ card: UIOverrides.useCva("fileUpload.cardCva", fileUploadCardDefinition),
403
+ list: UIOverrides.useCva("fileUpload.cardListCva", fileUploadCardListDefinition)
404
+ });
405
+ //#endregion
406
+ //#region src/components/inputs/File/shared/FileUploadContentFilled.tsx
407
+ const FileUploadContentFilled = ({ orientation, actionStyle, isDisabled, file, browseText, fileTriggerProps, removeWithIcon = false, onRemove, browseButtonProps }) => {
408
+ const { t } = useTranslation("ui");
409
+ const { size: browseButtonSize = "sm", variant: browseButtonVariant = "outlined", width: browseButtonWidth = "hug", ...browseButtonRestProps } = browseButtonProps ?? {};
410
+ const styles = useFileUploadContentStyles();
411
+ const parts = {
412
+ content: "filled",
413
+ orientation,
414
+ actionStyle,
415
+ isDisabled
416
+ };
417
+ return /* @__PURE__ */ jsx("div", {
418
+ className: clsx("flex w-full flex-fill flex-col items-start"),
419
+ children: /* @__PURE__ */ jsxs("div", {
420
+ className: styles.content(parts),
421
+ children: [/* @__PURE__ */ jsxs("div", {
422
+ className: styles.lead(parts),
423
+ children: [/* @__PURE__ */ jsx(IconSlot, {
424
+ icon: CheckCircle,
425
+ className: styles.icon(parts)
426
+ }), /* @__PURE__ */ jsxs("div", {
427
+ className: styles.text(parts),
428
+ children: [/* @__PURE__ */ jsx(Typography, {
429
+ size: "large",
430
+ as: "span",
431
+ className: styles.title(parts),
432
+ children: file.name
433
+ }), /* @__PURE__ */ jsx(Typography, {
434
+ size: "small",
435
+ as: "span",
436
+ className: styles.description(parts),
437
+ children: FileUtils.getFileDisplaySize(file)
438
+ })]
439
+ })]
440
+ }), /* @__PURE__ */ jsx("div", {
441
+ className: styles.actions(parts),
442
+ children: actionStyle === "link" ? /* @__PURE__ */ jsxs(Fragment$1, { children: [fileTriggerProps && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx($b325d7bd7e74496a$export$6fb4a10d2c950550, {
443
+ ...fileTriggerProps,
444
+ children: /* @__PURE__ */ jsx(Button, {
445
+ className: styles.link({
446
+ ...parts,
447
+ action: "browse"
448
+ }),
449
+ variant: "text",
450
+ width: "hug",
451
+ children: browseText ?? ""
452
+ })
453
+ }), orientation === "vertical" && /* @__PURE__ */ jsx(Typography, {
454
+ size: "small",
455
+ as: "span",
456
+ className: styles.separator(parts),
457
+ children: t(($) => $.ui.fileUpload.or)
458
+ })] }), removeWithIcon ? /* @__PURE__ */ jsx(IconButton, {
459
+ label: t(($) => $.ui.fileUpload.removeFile),
460
+ color: "secondary",
461
+ onPress: onRemove,
462
+ icon: X,
463
+ variant: "text",
464
+ width: "hug",
465
+ disableTooltip: true,
466
+ size: "sm"
467
+ }) : /* @__PURE__ */ jsx(Button, {
468
+ className: styles.link({
469
+ ...parts,
470
+ action: "remove"
471
+ }),
472
+ color: orientation === "horizontal" ? "secondary" : "primary",
473
+ onPress: onRemove,
474
+ variant: "text",
475
+ width: "hug",
476
+ children: t(($) => $.ui.fileUpload.removeFile)
477
+ })] }) : /* @__PURE__ */ jsxs("div", {
478
+ className: styles.buttons(parts),
479
+ children: [fileTriggerProps && /* @__PURE__ */ jsx($b325d7bd7e74496a$export$6fb4a10d2c950550, {
480
+ ...fileTriggerProps,
481
+ children: /* @__PURE__ */ jsx(Button, {
482
+ variant: browseButtonVariant,
483
+ size: browseButtonSize,
484
+ width: browseButtonWidth,
485
+ ...browseButtonRestProps,
486
+ isDisabled,
487
+ children: browseText ?? ""
488
+ })
489
+ }), removeWithIcon ? /* @__PURE__ */ jsx(IconButton, {
490
+ label: t(($) => $.ui.fileUpload.removeFile),
491
+ color: "secondary",
492
+ onPress: onRemove,
493
+ icon: X,
494
+ isDisabled,
495
+ variant: "text",
496
+ width: "hug",
497
+ disableTooltip: true,
498
+ size: "sm"
499
+ }) : /* @__PURE__ */ jsx(Button, {
500
+ color: "secondary",
501
+ onPress: onRemove,
502
+ isDisabled,
503
+ variant: "text",
504
+ width: "hug",
505
+ children: t(($) => $.ui.fileUpload.removeFile)
506
+ })]
507
+ })
508
+ })]
509
+ })
510
+ });
511
+ };
512
+ //#endregion
513
+ //#region src/components/inputs/File/shared/FileUploadContentLoading.tsx
514
+ const FileUploadContentLoading = ({ orientation, actionStyle, file, isDisabled, onCancel, cancelButtonProps }) => {
515
+ const { t } = useTranslation("ui");
516
+ const { color: cancelButtonColor = "secondary", size: cancelButtonSize = "sm", variant: cancelButtonVariant = "outlined", width: cancelButtonWidth = "hug", ...cancelButtonRestProps } = cancelButtonProps ?? {};
517
+ const styles = useFileUploadContentStyles();
518
+ const parts = {
519
+ content: "loading",
520
+ orientation,
521
+ actionStyle,
522
+ isDisabled
523
+ };
524
+ return /* @__PURE__ */ jsxs("div", {
525
+ className: styles.content(parts),
526
+ children: [/* @__PURE__ */ jsxs("div", {
527
+ className: styles.body(parts),
528
+ children: [/* @__PURE__ */ jsxs("div", {
529
+ className: styles.lead(parts),
530
+ children: [/* @__PURE__ */ jsx(IconSlot, {
531
+ icon: File,
532
+ className: styles.icon(parts)
533
+ }), /* @__PURE__ */ jsxs("div", {
534
+ className: styles.text(parts),
535
+ children: [/* @__PURE__ */ jsx(Typography, {
536
+ size: "large",
537
+ as: "span",
538
+ className: styles.title(parts),
539
+ children: file.name
540
+ }), /* @__PURE__ */ jsx(Typography, {
541
+ size: "small",
542
+ as: "span",
543
+ className: styles.description(parts),
544
+ children: FileUtils.getFileDisplaySize(file)
545
+ })]
546
+ })]
547
+ }), /* @__PURE__ */ jsxs("div", {
548
+ className: clsx("flex items-center gap-1", orientation === "horizontal" && "w-1/2", orientation === "vertical" && "w-full"),
549
+ children: [/* @__PURE__ */ jsx(Progress, {
550
+ value: file.progress,
551
+ label: file.name,
552
+ hideLabel: true
553
+ }), (actionStyle === "link" || orientation === "horizontal") && /* @__PURE__ */ jsx(IconButton, {
554
+ label: t(($) => $.ui.fileUpload.cancel),
555
+ color: "secondary",
556
+ onPress: onCancel,
557
+ icon: X,
558
+ variant: "text",
559
+ width: "hug",
560
+ disableTooltip: true,
561
+ size: "sm"
562
+ })]
563
+ })]
564
+ }), actionStyle === "button" && orientation === "vertical" && /* @__PURE__ */ jsx(Button, {
565
+ variant: cancelButtonVariant,
566
+ size: cancelButtonSize,
567
+ color: cancelButtonColor,
568
+ width: cancelButtonWidth,
569
+ ...cancelButtonRestProps,
570
+ onPress: onCancel,
571
+ children: t(($) => $.ui.fileUpload.cancel)
572
+ })]
573
+ });
574
+ };
575
+ //#endregion
576
+ //#region src/components/inputs/File/shared/FileCard.tsx
577
+ const FileCardComponent = ({ actionStyle, file, onRemove, isDisabled, browseButtonProps, cancelButtonProps, onCancel }) => {
578
+ const { card } = useFileUploadCardStyles();
579
+ return /* @__PURE__ */ jsx("div", {
580
+ className: card(),
581
+ children: file.status === "uploading" ? /* @__PURE__ */ jsx(FileUploadContentLoading, {
582
+ orientation: "horizontal",
583
+ actionStyle,
584
+ isDisabled,
585
+ file,
586
+ cancelButtonProps,
587
+ onCancel: () => onCancel?.(file)
588
+ }) : /* @__PURE__ */ jsx(FileUploadContentFilled, {
589
+ actionStyle,
590
+ removeWithIcon: true,
591
+ orientation: "horizontal",
592
+ isDisabled,
593
+ file,
594
+ browseButtonProps,
595
+ onRemove: () => onRemove?.(file)
596
+ })
597
+ });
598
+ };
599
+ const FileCard = memo(FileCardComponent);
600
+ //#endregion
601
+ //#region src/components/inputs/File/shared/FileCardList.tsx
602
+ const FileCardList = memo(({ files, actionStyle, isDisabled, browseButtonProps, cancelButtonProps, className, onRemove, onCancel }) => {
603
+ const { list } = useFileUploadCardStyles();
604
+ return /* @__PURE__ */ jsx("div", {
605
+ className: list({ className }),
606
+ children: files.map((file) => /* @__PURE__ */ jsx(FileCard, {
607
+ actionStyle,
608
+ file,
609
+ isDisabled,
610
+ browseButtonProps,
611
+ cancelButtonProps,
612
+ onRemove,
613
+ onCancel
614
+ }, file.key))
615
+ });
616
+ });
617
+ //#endregion
618
+ //#region src/components/inputs/File/shared/FileUploadContentEmpty.tsx
619
+ const FileUploadContentEmpty = ({ orientation, actionStyle, isDisabled, title, browseText, uploadText, hideButton = false, className, browseButtonProps }) => {
620
+ const { size: browseButtonSize = "sm", variant: browseButtonVariant = "outlined", width: browseButtonWidth = "hug", ...browseButtonRestProps } = browseButtonProps ?? {};
621
+ const styles = useFileUploadContentStyles();
622
+ const parts = {
623
+ content: "empty",
624
+ orientation,
625
+ actionStyle,
626
+ isDisabled
627
+ };
628
+ const showButton = !hideButton && !!browseText;
629
+ return /* @__PURE__ */ jsxs("div", {
630
+ className: styles.content({
631
+ ...parts,
632
+ className
633
+ }),
634
+ children: [/* @__PURE__ */ jsxs("div", {
635
+ className: styles.lead(parts),
636
+ children: [/* @__PURE__ */ jsx(IconSlot, {
637
+ icon: Upload,
638
+ className: styles.icon(parts)
639
+ }), /* @__PURE__ */ jsxs("div", {
640
+ className: styles.text(parts),
641
+ children: [/* @__PURE__ */ jsx(Typography, {
642
+ size: "large",
643
+ as: "span",
644
+ className: styles.title(parts),
645
+ children: title
646
+ }), (uploadText || showButton && actionStyle === "link") && /* @__PURE__ */ jsxs("span", {
647
+ className: styles.actions(parts),
648
+ children: [uploadText && /* @__PURE__ */ jsx(Typography, {
649
+ size: "small",
650
+ as: "span",
651
+ className: styles.description(parts),
652
+ children: uploadText
653
+ }), showButton && actionStyle === "link" && /* @__PURE__ */ jsx(Button, {
654
+ className: styles.link({
655
+ ...parts,
656
+ action: "browse"
657
+ }),
658
+ isDisabled,
659
+ variant: "text",
660
+ width: "hug",
661
+ children: browseText
662
+ })]
663
+ })]
664
+ })]
665
+ }), showButton && actionStyle === "button" && /* @__PURE__ */ jsx(Button, {
666
+ variant: browseButtonVariant,
667
+ size: browseButtonSize,
668
+ width: browseButtonWidth,
669
+ ...browseButtonRestProps,
670
+ isDisabled,
671
+ children: browseText
672
+ })]
673
+ });
674
+ };
675
+ //#endregion
676
+ //#region src/components/inputs/File/shared/FileUploadContent.tsx
677
+ const FileUploadContent = ({ orientation, actionStyle, isDisabled, browseText, uploadText, emptyText, files, browseButtonProps, cancelButtonProps, onCancel, onRemove, acceptedFileTypes, allowsMultiple, onSelect, ...rest }) => {
678
+ const currentFile = allowsMultiple ? void 0 : files.at(0);
679
+ const fileTriggerProps = {
680
+ ...rest,
681
+ acceptedFileTypes,
682
+ allowsMultiple,
683
+ onSelect
684
+ };
685
+ if (currentFile?.status === "uploading") return /* @__PURE__ */ jsx(FileUploadContentLoading, {
686
+ orientation,
687
+ actionStyle,
688
+ isDisabled,
689
+ file: currentFile,
690
+ cancelButtonProps,
691
+ onCancel: () => onCancel(currentFile)
692
+ });
693
+ if (currentFile) return /* @__PURE__ */ jsx(FileUploadContentFilled, {
694
+ actionStyle,
695
+ orientation,
696
+ isDisabled,
697
+ file: currentFile,
698
+ browseText,
699
+ browseButtonProps,
700
+ fileTriggerProps,
701
+ onRemove: () => onRemove(currentFile)
702
+ });
703
+ return /* @__PURE__ */ jsx($b325d7bd7e74496a$export$6fb4a10d2c950550, {
704
+ ...fileTriggerProps,
705
+ children: /* @__PURE__ */ jsx(FileUploadContentEmpty, {
706
+ actionStyle,
707
+ orientation,
708
+ isDisabled,
709
+ title: emptyText,
710
+ uploadText,
711
+ browseText,
712
+ browseButtonProps
713
+ })
714
+ });
715
+ };
716
+ //#endregion
717
+ //#region src/components/inputs/File/FileUpload.tsx
718
+ const NO_FILES = [];
719
+ /** Identifies stored files by their ids, so a re-created or re-ordered array of the same files compares equal. */
720
+ const getIdsKey = (files) => JSON.stringify(files.map((file) => file.id).sort());
721
+ const getFailureMessage = (failure) => {
722
+ if (typeof failure === "string") return failure;
723
+ if (typeof failure !== "object" || failure === null) return void 0;
724
+ if ("serverMessage" in failure && typeof failure.serverMessage === "string" && failure.serverMessage.trim()) return failure.serverMessage;
725
+ return "message" in failure && typeof failure.message === "string" ? failure.message : void 0;
726
+ };
727
+ const FileUploadBase = (props) => {
728
+ const { t } = useTranslation("ui");
729
+ const { ref, label, tooltipText, orientation = "vertical", actionStyle = "button", helperText, isRequired, isDisabled, headerClassName, errorClassName, error, errorMessageId, className, allowsMultiple = false, hideLabel, acceptedFileTypes, clearOnSuccess, emptyText = t(($) => $.ui.fileUpload.emptyText), uploadText = t(($) => $.ui.fileUpload.uploadText), browseText = t(($) => $.ui.fileUpload.browse), onUpload, onRemove, children, browseButtonProps, cancelButtonProps, onInvalidFileType, onChange, onBlur, value, defaultValue, subscribeReset, onUploadingChange, fieldError, ...rest } = props;
730
+ const ui = UIConfig.useConfig();
731
+ const fileUploadDropZoneCva = UIOverrides.useCva("fileUpload.dropZoneCva", fileUploadDropZoneDefinition);
732
+ const fileUploadGroupCva = UIOverrides.useCva("fileUpload.groupCva", fileUploadGroupDefinition);
733
+ const generatedErrorId = useId();
734
+ const resolvedErrorId = errorMessageId ?? generatedErrorId;
735
+ const generatedHelperTextId = useId();
736
+ const helperTextId = helperText ? `field-helper-${generatedHelperTextId}` : void 0;
737
+ const uploadKeyPrefix = useId();
738
+ const [uploadError, setUploadError] = useState();
739
+ const resolvedError = error ?? uploadError ?? fieldError;
740
+ const isControlled = value !== void 0;
741
+ const [ownFiles, setOwnFiles] = useState(defaultValue ?? NO_FILES);
742
+ const storedFiles = value ?? ownFiles;
743
+ const [uploads, setUploads] = useState([]);
744
+ const [sessionFiles, setSessionFiles] = useState({});
745
+ const latest = useRef({
746
+ onChange,
747
+ onUpload,
748
+ onRemove,
749
+ onInvalidFileType,
750
+ onUploadingChange,
751
+ isControlled,
752
+ allowsMultiple
753
+ });
754
+ const storedRef = useRef(storedFiles);
755
+ const uploadsRef = useRef(uploads);
756
+ const controllers = useRef(/* @__PURE__ */ new Map());
757
+ const uploadCount = useRef(0);
758
+ const resetCount = useRef(0);
759
+ const emittedKeys = useRef([]);
760
+ const seenValueKey = useRef(value ? getIdsKey(value) : void 0);
761
+ useLayoutEffect(() => {
762
+ latest.current = {
763
+ onChange,
764
+ onUpload,
765
+ onRemove,
766
+ onInvalidFileType,
767
+ onUploadingChange,
768
+ isControlled,
769
+ allowsMultiple
770
+ };
771
+ });
772
+ const updateUploads = useCallback((update) => {
773
+ const wasUploading = uploadsRef.current.length > 0;
774
+ uploadsRef.current = update(uploadsRef.current);
775
+ setUploads(uploadsRef.current);
776
+ const isUploading = uploadsRef.current.length > 0;
777
+ if (isUploading !== wasUploading) latest.current.onUploadingChange?.(isUploading);
778
+ }, []);
779
+ const cancelUploads = useCallback(() => {
780
+ controllers.current.forEach((controller) => controller.abort());
781
+ controllers.current.clear();
782
+ if (uploadsRef.current.length > 0) updateUploads(() => []);
783
+ }, [updateUploads]);
784
+ const endUpload = useCallback((key) => {
785
+ controllers.current.delete(key);
786
+ updateUploads((previous) => previous.filter((upload) => upload.key !== key));
787
+ }, [updateUploads]);
788
+ /** The owner replaced or reset the files: uploads meant for the old ones stop, and so does their error. */
789
+ const discardUploads = useCallback(() => {
790
+ emittedKeys.current = [];
791
+ resetCount.current += 1;
792
+ cancelUploads();
793
+ setUploadError(void 0);
794
+ }, [cancelUploads]);
795
+ /** Makes `next` the stored files. `onChange` runs first, so nothing is recorded when it throws. */
796
+ const commit = useCallback((next) => {
797
+ const key = getIdsKey(next);
798
+ if (latest.current.isControlled) emittedKeys.current.push(key);
799
+ try {
800
+ latest.current.onChange?.(next);
801
+ } catch (failure) {
802
+ const index = emittedKeys.current.lastIndexOf(key);
803
+ if (latest.current.isControlled && index !== -1) emittedKeys.current.splice(index, 1);
804
+ throw failure;
805
+ }
806
+ storedRef.current = next;
807
+ if (!latest.current.isControlled) setOwnFiles(next);
808
+ }, []);
809
+ useLayoutEffect(() => {
810
+ if (value === void 0) return;
811
+ const key = getIdsKey(value);
812
+ const emitted = emittedKeys.current.lastIndexOf(key);
813
+ if (emitted !== -1) emittedKeys.current.splice(0, emitted + 1);
814
+ else if (key !== seenValueKey.current) discardUploads();
815
+ seenValueKey.current = key;
816
+ if (emittedKeys.current.length === 0) storedRef.current = value;
817
+ });
818
+ useEffect(() => subscribeReset?.(discardUploads), [subscribeReset, discardUploads]);
819
+ useEffect(() => {
820
+ const activeControllers = controllers.current;
821
+ return () => activeControllers.forEach((controller) => controller.abort());
822
+ }, []);
823
+ const formFieldProps = {
824
+ error: resolvedError,
825
+ errorMessageId: resolvedErrorId,
826
+ label: label ?? "",
827
+ tooltipText,
828
+ helperText,
829
+ helperTextId,
830
+ isRequired,
831
+ hideLabel: hideLabel ?? (label ? ui.input.hideLabel : true),
832
+ isDisabled,
833
+ headerClassName,
834
+ errorClassName
835
+ };
836
+ const labelProps = $a8ea2faf2ebe4d2f$re_export$useLabels({ "aria-label": label });
837
+ const reportUploadError = useCallback((failure) => {
838
+ const message = getFailureMessage(failure);
839
+ setUploadError(message?.trim() ? message : t(($) => $.ui.fileUpload.uploadFailed));
840
+ }, [t]);
841
+ const handleUpload = async (inputFiles) => {
842
+ setUploadError(void 0);
843
+ try {
844
+ const validFiles = inputFiles.filter((file) => FileUtils.isFileTypeAccepted(file, acceptedFileTypes));
845
+ const invalidFiles = inputFiles.filter((file) => !FileUtils.isFileTypeAccepted(file, acceptedFileTypes));
846
+ if (invalidFiles.length > 0) latest.current.onInvalidFileType?.(invalidFiles.map((file) => file.name));
847
+ const acceptedFiles = allowsMultiple ? validFiles : validFiles.slice(0, 1);
848
+ if (acceptedFiles.length === 0) return;
849
+ if (!allowsMultiple) cancelUploads();
850
+ const batch = acceptedFiles.map((file) => {
851
+ const upload = {
852
+ status: "uploading",
853
+ key: `${uploadKeyPrefix}${uploadCount.current += 1}`,
854
+ name: file.name,
855
+ size: file.size,
856
+ type: file.type,
857
+ file,
858
+ progress: 0
859
+ };
860
+ const controller = new AbortController();
861
+ controllers.current.set(upload.key, controller);
862
+ return {
863
+ upload,
864
+ controller
865
+ };
866
+ });
867
+ updateUploads((previous) => [...previous, ...batch.map(({ upload }) => upload)]);
868
+ const succeeded = await Promise.all(batch.map(async ({ upload, controller }) => {
869
+ const isCurrent = () => !controller.signal.aborted;
870
+ try {
871
+ const result = await latest.current.onUpload(upload.file, {
872
+ signal: controller.signal,
873
+ onProgress: ({ loaded, total }) => {
874
+ if (!total || !isCurrent()) return;
875
+ const progress = Math.min(100, Math.round(loaded / total * 100));
876
+ updateUploads((previous) => previous.map((item) => item.key === upload.key ? {
877
+ ...item,
878
+ progress
879
+ } : item));
880
+ }
881
+ });
882
+ if (!isCurrent()) return false;
883
+ const stored = {
884
+ id: result.id,
885
+ name: upload.name,
886
+ size: upload.size
887
+ };
888
+ if (upload.type) stored.type = upload.type;
889
+ if (result.url) stored.url = result.url;
890
+ const isMultiple = latest.current.allowsMultiple;
891
+ flushSync(() => {
892
+ commit(isMultiple ? [...storedRef.current.filter((file) => file.id !== stored.id), stored] : [stored]);
893
+ setSessionFiles((previous) => ({
894
+ ...isMultiple ? previous : {},
895
+ [stored.id]: {
896
+ key: upload.key,
897
+ file: upload.file
898
+ }
899
+ }));
900
+ endUpload(upload.key);
901
+ });
902
+ return true;
903
+ } catch (failure) {
904
+ if (!isCurrent()) return false;
905
+ endUpload(upload.key);
906
+ reportUploadError(failure);
907
+ return false;
908
+ }
909
+ }));
910
+ if (clearOnSuccess && succeeded.every(Boolean) && uploadsRef.current.length === 0) commit([]);
911
+ } catch (failure) {
912
+ reportUploadError(failure);
913
+ }
914
+ };
915
+ const handleSelect = (inputFiles) => {
916
+ if (inputFiles) handleUpload(Array.from(inputFiles));
917
+ };
918
+ const handleDrop = async (e) => {
919
+ const resets = resetCount.current;
920
+ if (!e.items) return;
921
+ setUploadError(void 0);
922
+ try {
923
+ const inputFiles = await Promise.all(e.items.flatMap((item) => item.kind === "file" ? [Promise.resolve().then(() => item.getFile())] : []));
924
+ if (resets !== resetCount.current) return;
925
+ await handleUpload(inputFiles);
926
+ } catch (failure) {
927
+ reportUploadError(failure);
928
+ }
929
+ };
930
+ const handleCancel = useCallback((item) => {
931
+ const controller = controllers.current.get(item.key);
932
+ if (item.status !== "uploading" || !controller) return;
933
+ controller.abort();
934
+ endUpload(item.key);
935
+ }, [endUpload]);
936
+ const handleRemove = useCallback((item) => {
937
+ if (item.status === "uploading") {
938
+ handleCancel(item);
939
+ return;
940
+ }
941
+ const removed = storedRef.current.find((file) => file.id === item.id);
942
+ if (!removed) return;
943
+ setUploadError(void 0);
944
+ try {
945
+ commit(storedRef.current.filter((file) => file.id !== removed.id));
946
+ Promise.resolve(latest.current.onRemove?.(removed)).catch(reportUploadError);
947
+ } catch (failure) {
948
+ reportUploadError(failure);
949
+ }
950
+ }, [
951
+ commit,
952
+ handleCancel,
953
+ reportUploadError
954
+ ]);
955
+ const files = useMemo(() => {
956
+ const toItem = (file) => ({
957
+ status: "uploaded",
958
+ key: sessionFiles[file.id]?.key ?? file.id,
959
+ id: file.id,
960
+ name: file.name,
961
+ size: file.size,
962
+ type: file.type,
963
+ url: file.url,
964
+ file: sessionFiles[file.id]?.file
965
+ });
966
+ if (allowsMultiple) return [...storedFiles.map(toItem), ...uploads];
967
+ return uploads.length > 0 ? uploads.slice(-1) : storedFiles.slice(0, 1).map(toItem);
968
+ }, [
969
+ allowsMultiple,
970
+ sessionFiles,
971
+ storedFiles,
972
+ uploads
973
+ ]);
974
+ return /* @__PURE__ */ jsxs(FormField, {
975
+ ref,
976
+ onBlurCapture: onBlur,
977
+ ...formFieldProps,
978
+ labelProps,
979
+ className: clsx("w-full", className),
980
+ children: [/* @__PURE__ */ jsx("div", {
981
+ role: "group",
982
+ "aria-label": label,
983
+ "aria-describedby": [
984
+ rest["aria-describedby"],
985
+ helperTextId,
986
+ resolvedError ? resolvedErrorId : void 0
987
+ ].filter(Boolean).join(" ") || void 0,
988
+ className: fileUploadGroupCva(),
989
+ children: /* @__PURE__ */ jsx($070c0dd15dc89b58$export$3c6489d84dc98b6, {
990
+ ...rest,
991
+ "data-rac": "",
992
+ "data-disabled": isDisabled || void 0,
993
+ "data-is-disabled": isDisabled || void 0,
994
+ "data-invalid": !!resolvedError || void 0,
995
+ "data-multiple": allowsMultiple || void 0,
996
+ "data-has-files": files.length > 0 || void 0,
997
+ "data-filled": !allowsMultiple && files[0]?.status === "uploaded" || void 0,
998
+ isDisabled,
999
+ onDrop: handleDrop,
1000
+ className: fileUploadDropZoneCva({
1001
+ orientation,
1002
+ isContainer: !!children,
1003
+ className: "group/upload-drop-zone"
1004
+ }),
1005
+ children: children ? /* @__PURE__ */ jsxs(Fragment$1, { children: [children({
1006
+ files,
1007
+ onRemove: handleRemove,
1008
+ onCancel: handleCancel
1009
+ }), /* @__PURE__ */ jsx(FileUploadContentEmpty, {
1010
+ actionStyle,
1011
+ orientation,
1012
+ hideButton: true,
1013
+ isDisabled,
1014
+ title: emptyText,
1015
+ uploadText,
1016
+ browseText,
1017
+ browseButtonProps,
1018
+ className: "group-drop-target/upload-drop-zone:flex! absolute top-1/2 left-1/2 z-overlay-above hidden -translate-x-1/2 -translate-y-1/2 flex-col"
1019
+ })] }) : /* @__PURE__ */ jsx(FileUploadContent, {
1020
+ ...rest,
1021
+ orientation,
1022
+ actionStyle,
1023
+ isDisabled,
1024
+ browseText,
1025
+ uploadText,
1026
+ emptyText,
1027
+ browseButtonProps,
1028
+ cancelButtonProps,
1029
+ files,
1030
+ onSelect: handleSelect,
1031
+ onCancel: handleCancel,
1032
+ onRemove: handleRemove,
1033
+ acceptedFileTypes,
1034
+ allowsMultiple
1035
+ })
1036
+ })
1037
+ }), !children && allowsMultiple && files.length > 0 && /* @__PURE__ */ jsx(FileCardList, {
1038
+ actionStyle,
1039
+ files,
1040
+ isDisabled,
1041
+ browseButtonProps,
1042
+ cancelButtonProps,
1043
+ onRemove: handleRemove,
1044
+ onCancel: handleCancel
1045
+ })]
1046
+ });
1047
+ };
1048
+ const ControlledFileUpload = (props) => {
1049
+ const { field, ref, ...innerProps } = props;
1050
+ const { t } = useTranslation("ui");
1051
+ const form = field.form;
1052
+ const name = field.name;
1053
+ const subscribeReset = useCallback((onReset) => subscribeFormReset(form, (refresh) => {
1054
+ if (!refresh) onReset();
1055
+ }), [form]);
1056
+ const uploadInProgress = t(($) => $.ui.fileUpload.uploadInProgress);
1057
+ const submissionAttempts = useStoreSelector(form.store, selectSubmissionAttempts);
1058
+ const [uploadsStartedAt, setUploadsStartedAt] = useState();
1059
+ const isUploading = useRef(false);
1060
+ const validateUploads = useCallback(() => isUploading.current ? uploadInProgress : void 0, [uploadInProgress]);
1061
+ const handleUploadingChange = useCallback((uploading) => {
1062
+ isUploading.current = uploading;
1063
+ setUploadsStartedAt(uploading ? form.state.submissionAttempts : void 0);
1064
+ if (uploading || form.getFieldMeta(name)?.errorSourceMap?.onSubmit !== "field") return;
1065
+ form.setFieldMeta(name, (meta) => ({
1066
+ ...meta,
1067
+ errorMap: {
1068
+ ...meta.errorMap,
1069
+ onSubmit: void 0
1070
+ },
1071
+ errorSourceMap: {
1072
+ ...meta.errorSourceMap,
1073
+ onSubmit: void 0
1074
+ }
1075
+ }));
1076
+ form.validateField(name, "change");
1077
+ }, [form, name]);
1078
+ const isWaitingForUploads = uploadsStartedAt !== void 0 && submissionAttempts > uploadsStartedAt;
1079
+ return /* @__PURE__ */ jsx(FieldController, {
1080
+ control: field.form,
1081
+ name: field.name,
1082
+ onValueChange: field.onValueChange,
1083
+ onBlur: field.onBlur,
1084
+ validateOnSubmit: uploadsStartedAt === void 0 ? void 0 : validateUploads,
1085
+ render: ({ field, fieldState: { error } }) => /* @__PURE__ */ jsx(FileUploadBase, {
1086
+ ...innerProps,
1087
+ subscribeReset,
1088
+ onUploadingChange: handleUploadingChange,
1089
+ ref: $a8ea2faf2ebe4d2f$re_export$mergeRefs(ref, field.ref),
1090
+ onBlur: field.onBlur,
1091
+ value: field.value ?? NO_FILES,
1092
+ onChange: (files) => {
1093
+ field.onChange(files);
1094
+ field.onValueCommit();
1095
+ },
1096
+ isDisabled: field.disabled || props.isDisabled,
1097
+ error: props.error ?? (isWaitingForUploads ? uploadInProgress : void 0),
1098
+ fieldError: error?.message
1099
+ })
1100
+ });
1101
+ };
1102
+ const FileUploadComponent = (props) => props.field ? /* @__PURE__ */ jsx(ControlledFileUpload, { ...props }) : /* @__PURE__ */ jsx(FileUploadBase, { ...props });
1103
+ const FileUpload = memo(FileUploadComponent);
1104
+ //#endregion
1105
+ export { FileUpload as t };