@povio/ui 6.0.0-rc.11 → 6.0.0-rc.13
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.
- package/README.md +470 -43
- package/dist/{Accordion-Cup5eRZz.d.ts → Accordion-CR9oomZY.d.ts} +29 -17
- package/dist/{Accordion-ORBin0EZ.js → Accordion-gUW7u1Zn.js} +41 -41
- package/dist/Alert-DwnALnFY.d.ts +36 -0
- package/dist/AlertDialog-BcRiqY_n.d.ts +70 -0
- package/dist/Autocomplete-CV4Aa1Ok.js +319 -0
- package/dist/Autocomplete-DRwQxx0U.d.ts +123 -0
- package/dist/Badge-CO-ZsmbR.d.ts +67 -0
- package/dist/{BottomSheet-CGipksM_.js → BottomSheet-APVu5TUd.js} +8 -8
- package/dist/BottomSheet-Be0HtQzP.d.ts +65 -0
- package/dist/{BottomSheet.lazy-CuJMUeJP.d.ts → BottomSheet.lazy-NNB7ivkW.d.ts} +1 -1
- package/dist/{Breadcrumbs-CcB0oOF8.d.ts → Breadcrumbs-Bn3fqVYx.d.ts} +6 -3
- package/dist/{Breadcrumbs-a1-q_he0.js → Breadcrumbs-Cd75RPbS.js} +33 -17
- package/dist/{Button-C1YB5dOw.js → Button-BJJkLVNj.js} +1 -5
- package/dist/{Button-BaODzvZd.js → Button-CzEs3tcV.js} +1 -1
- package/dist/{Button-0SswSdDg.d.ts → Button-Hk8zm9q_.d.ts} +2 -2
- package/dist/ButtonBase-Cp1w00t2.d.ts +47 -0
- package/dist/{ButtonBase-s-VV7oCa.js → ButtonBase-aGz6DYum.js} +10 -18
- package/dist/{ButtonContent-Dztbuz3q.js → ButtonContent-2KsbdWRO.js} +5 -5
- package/dist/{Calendar-DX0dVo6z.js → Calendar-DN-i_b-_.js} +19 -17
- package/dist/{Calendar.lazy-W51M56GQ.js → Calendar.lazy-CqmyDSND.js} +4 -4
- package/dist/{Checkbox-Bjsbx-wK.js → Checkbox-CzKXZw_w.js} +35 -9
- package/dist/Checkbox-D32MOIhF.d.ts +49 -0
- package/dist/CheckboxCheckmark-DDU_Ie7-.js +42 -0
- package/dist/CheckboxGroup-B5Mn1G3u.d.ts +52 -0
- package/dist/{CheckboxGroup-B3O3IUiu.js → CheckboxGroup-BqWt09kZ.js} +75 -35
- package/dist/DatePicker-CmoVbapu.d.ts +80 -0
- package/dist/{DatePicker-CqNS7lgR.js → DatePicker-DQewd1By.js} +80 -41
- package/dist/{DatePickerInput-vLlL5ATh.d.ts → DatePickerInput-B9VnExeA.d.ts} +3 -3
- package/dist/{DatePickerInput-B2Pc_aJr.js → DatePickerInput-Bp9ZIN5E.js} +37 -26
- package/dist/{DateRangePicker-C3ClfSfj.js → DateRangePicker-DRZ1hLlR.js} +93 -169
- package/dist/DateRangePicker-LX1VJlnD.d.ts +102 -0
- package/dist/DateTimePicker-D9pODhAj.d.ts +83 -0
- package/dist/{DateTimePicker-CYa2J-1r.js → DateTimePicker-DWtKPaE6.js} +70 -35
- package/dist/{Dialog-C9H9_BmK.js → Dialog-BJ13KRQo.js} +1 -1
- package/dist/{Dialog-96c4Pzfm.js → Dialog-BzQYDPJ9.js} +23 -19
- package/dist/Dialog-D0SeePPz.d.ts +66 -0
- package/dist/{Disclosure-BRSkMbZQ.js → Disclosure-Bjm5IOpg.js} +1 -1
- package/dist/Drawer-o018RqIt.d.ts +42 -0
- package/dist/DropdownMenu-DTr7b-XO.d.ts +51 -0
- package/dist/{DropdownMenu-DS0RaEfH.js → DropdownMenu-DrshB60h.js} +33 -21
- package/dist/{DropdownMenuDesktop-DGPIfex-.js → DropdownMenuDesktop-DxGA0yvx.js} +14 -8
- package/dist/FileInput-Bokcp9nH.d.ts +61 -0
- package/dist/{FileInput-IRM0C9W6.js → FileInput-LMhFxlqB.js} +75 -80
- package/dist/FileUpload-BqXd4_nz.d.ts +181 -0
- package/dist/FileUpload-CJZrkr_U.js +679 -0
- package/dist/{FormField-dduTMkNH.js → FormField-TI8Vx5aC.js} +10 -10
- package/dist/FormField-XQbjfGSv.d.ts +70 -0
- package/dist/{FormFieldError-BT4uxbKY.d.ts → FormFieldError-C7yOdjzQ.d.ts} +1 -0
- package/dist/FormFieldHeaderTooltip-DB7KrrcD.js +22 -0
- package/dist/HiddenFormValue-DZ2d9eoA.js +20 -0
- package/dist/IconButton-CQLHX8-Y.d.ts +24 -0
- package/dist/{IconSlot-CqNuZl0E.js → IconSlot-TAWTJ6iK.js} +2 -4
- package/dist/{InlineTooltipWrapper-CKTiFpZn.js → InlineTooltipWrapper-CjDUsi2I.js} +1 -1
- package/dist/{Input-UbFhc_J2.js → Input-CeRJeAoR.js} +94 -59
- package/dist/Input-onUj0DKg.d.ts +56 -0
- package/dist/{InputContent-D7lnNLWk.js → InputContent-B8OCdbVP.js} +15 -13
- package/dist/InputContent-D5ZkB9hO.d.ts +39 -0
- package/dist/Link-BdnWVYL9.d.ts +15 -0
- package/dist/{ListBox-DhR5kojP.js → ListBox-gR4iSV7N.js} +3 -3
- package/dist/{Modal-DcLWF9cB.js → Modal-DAMsCwzb.js} +1 -1
- package/dist/{NumberField-twW8zuJ9.js → NumberField-6Q9LHGSo.js} +91 -62
- package/dist/NumberField-Sb30Qao3.d.ts +41 -0
- package/dist/{NumberRangeInput-gT6gEJIz.js → NumberRangeInput-BDSkcHVJ.js} +152 -101
- package/dist/NumberRangeInput-Dvq8mOUY.d.ts +89 -0
- package/dist/{PageHeader-DTfzf-dA.d.ts → PageHeader-eJk6GNK6.d.ts} +6 -5
- package/dist/{PasswordInput.bound-CXtbMCD6.js → PasswordInput-BcHpV0Ie.js} +6 -6
- package/dist/PasswordInput-VHzP4VPU.d.ts +16 -0
- package/dist/Popover-qplPGDnR.d.ts +51 -0
- package/dist/Progress-DH-w99MU.d.ts +26 -0
- package/dist/Progress-WzWvbvtp.js +180 -0
- package/dist/ProgressBar-BsSimmJF.js +46 -0
- package/dist/RadioGroup-CC8bKtBN.d.ts +52 -0
- package/dist/{RadioGroup-IL4Y8XHO.js → RadioGroup-PKqFHoKP.js} +66 -26
- package/dist/{RangeCalendar-0W1YFZqn.js → RangeCalendar-DqCTlIuy.js} +42 -13
- package/dist/Select-CSyfDyxG.d.ts +248 -0
- package/dist/{Select-B-TuE_Fh.js → Select-D3fuXwVt.js} +435 -184
- package/dist/{SelectListBox-Dlonoc5z.js → SelectListBox-DqAxkT1f.js} +46 -37
- package/dist/{SidebarWorkspaces-DJknAfS9.js → SidebarWorkspaces-BGl_PIsH.js} +280 -363
- package/dist/{SidebarWorkspaces-DDHJAdNH.d.ts → SidebarWorkspaces-CdtK2M-C.d.ts} +31 -17
- package/dist/{Slider-DCsCCPFx.js → Slider-BCUiALjE.js} +69 -12
- package/dist/Slider-DxalZD3o.d.ts +57 -0
- package/dist/Spinner-BTrEbNFy.d.ts +13 -0
- package/dist/SplitButton-Dv5l8p5t.d.ts +25 -0
- package/dist/Stepper-B1IOUcSI.d.ts +49 -0
- package/dist/{Stepper-Dyhxp0Tl.js → Stepper-DA2G546I.js} +116 -88
- package/dist/{Switch-BfpSMMpv.js → Switch-Ce-bJOVw.js} +54 -12
- package/dist/Switch-urNrop0P.d.ts +42 -0
- package/dist/{TabsFilters-CWUNeqYa.js → TabsFilters-Cweij8He.js} +44 -33
- package/dist/TabsFilters-M5Ld7eb8.d.ts +59 -0
- package/dist/Tag-BKR1AZFa.d.ts +26 -0
- package/dist/TextArea-D7YVclaz.d.ts +33 -0
- package/dist/{TextArea-DakA3nzZ.js → TextArea-P8F0oD_A.js} +59 -32
- package/dist/TimePicker-Ai1M2TGW.d.ts +63 -0
- package/dist/{TimePicker-RFzfDezn.js → TimePicker-l4Ysk2AX.js} +99 -50
- package/dist/{TimePickerForm-DohOZViU.js → TimePickerForm-BMqNpDPT.js} +5 -5
- package/dist/{ToastContainer-Dd0LPykL.js → ToastContainer-BeklfvlK.js} +4 -4
- package/dist/{ToggleButton-HUZ8ij6i.d.ts → ToggleButton-DWw53pTt.d.ts} +2 -2
- package/dist/ToggleGroup-BQk3k0at.d.ts +95 -0
- package/dist/ToggleGroup-BdIgqoqA.js +500 -0
- package/dist/{Tooltip-DRB6lo0U.js → Tooltip-BkXPEBqw.js} +2 -2
- package/dist/Tooltip-H8OB7CqY.d.ts +33 -0
- package/dist/TooltipEllipsis-7QF00kXk.d.ts +21 -0
- package/dist/{TooltipWrapper-DLBksJsF.js → TooltipWrapper-ubbBHHVD.js} +6 -6
- package/dist/{Typography-DJojwiXV.d.ts → Typography-Cx1oRGxd.d.ts} +5 -1
- package/dist/{badgeButton.cva-t5PQOH4M.js → badge.cva-BpoxNggB.js} +20 -22
- package/dist/{button.cva-Ciga0rdG.js → button.cva-C2aoXMh-.js} +10 -16
- package/dist/{buttonContent.cva-BapnODby.d.ts → buttonContent.cva-Dyy_RUZU.d.ts} +1 -1
- package/dist/{checkbox.cva-aLJS7v4z.js → checkbox.cva-qU_q0lSX.js} +14 -14
- package/dist/components/accordion.d.ts +1 -1
- package/dist/components/accordion.js +1 -1
- package/dist/components/alert-dialog.d.ts +2 -2
- package/dist/components/alert-dialog.js +174 -128
- package/dist/components/alert.d.ts +1 -1
- package/dist/components/alert.js +17 -15
- package/dist/components/autocomplete.d.ts +2 -2
- package/dist/components/autocomplete.js +1 -1
- package/dist/components/badge.d.ts +2 -2
- package/dist/components/badge.js +159 -81
- package/dist/components/bottom-sheet-header.d.ts +1 -1
- package/dist/components/bottom-sheet-header.js +4 -4
- package/dist/components/bottom-sheet.d.ts +2 -2
- package/dist/components/bottom-sheet.js +2 -2
- package/dist/components/breadcrumbs.d.ts +1 -1
- package/dist/components/breadcrumbs.js +1 -1
- package/dist/components/button.d.ts +2 -2
- package/dist/components/button.js +1 -1
- package/dist/components/checkbox-group.d.ts +2 -2
- package/dist/components/checkbox-group.js +1 -1
- package/dist/components/checkbox.d.ts +2 -2
- package/dist/components/checkbox.js +1 -1
- package/dist/components/date-picker.d.ts +2 -2
- package/dist/components/date-picker.js +1 -1
- package/dist/components/date-range-picker.d.ts +4 -41
- package/dist/components/date-range-picker.js +4 -2
- package/dist/components/date-range-presets.d.ts +2 -0
- package/dist/components/date-range-presets.js +3 -0
- package/dist/components/date-time-picker.d.ts +2 -2
- package/dist/components/date-time-picker.js +1 -1
- package/dist/components/dialog.d.ts +1 -1
- package/dist/components/dialog.js +1 -1
- package/dist/components/drawer.d.ts +1 -1
- package/dist/components/drawer.js +16 -80
- package/dist/components/dropdown-menu.d.ts +2 -3
- package/dist/components/dropdown-menu.js +2 -3
- package/dist/components/file-input.d.ts +2 -2
- package/dist/components/file-input.js +1 -1
- package/dist/components/file-upload.d.ts +2 -3
- package/dist/components/file-upload.js +1 -1
- package/dist/components/form-field.d.ts +3 -2
- package/dist/components/form-field.js +1 -1
- package/dist/components/icon-button.d.ts +1 -1
- package/dist/components/icon-button.js +22 -25
- package/dist/components/icon-slot.d.ts +1 -2
- package/dist/components/icon-slot.js +2 -2
- package/dist/components/input-frame.d.ts +6 -10
- package/dist/components/input-frame.js +29 -26
- package/dist/components/input.d.ts +2 -2
- package/dist/components/input.js +2 -2
- package/dist/components/link.d.ts +1 -1
- package/dist/components/link.js +1 -1
- package/dist/components/number-field.d.ts +2 -2
- package/dist/components/number-field.js +2 -2
- package/dist/components/number-range-input.d.ts +2 -2
- package/dist/components/number-range-input.js +1 -1
- package/dist/components/page-header.d.ts +1 -1
- package/dist/components/page-header.js +5 -5
- package/dist/components/password-input.d.ts +2 -2
- package/dist/components/password-input.js +1 -22
- package/dist/components/popover.d.ts +1 -1
- package/dist/components/popover.js +105 -87
- package/dist/components/progress.d.ts +2 -2
- package/dist/components/progress.js +1 -1
- package/dist/components/radio-group.d.ts +2 -2
- package/dist/components/radio-group.js +1 -1
- package/dist/components/select.d.ts +2 -2
- package/dist/components/select.js +1 -1
- package/dist/components/sidebar.d.ts +1 -1
- package/dist/components/sidebar.js +1 -1
- package/dist/components/slider.d.ts +2 -2
- package/dist/components/slider.js +1 -1
- package/dist/components/spinner.d.ts +1 -1
- package/dist/components/spinner.js +71 -1
- package/dist/components/split-button.d.ts +1 -1
- package/dist/components/split-button.js +15 -4
- package/dist/components/stepper.d.ts +1 -1
- package/dist/components/stepper.js +1 -1
- package/dist/components/style-definitions.d.ts +2 -2
- package/dist/components/style-definitions.js +33 -18
- package/dist/components/switch.d.ts +2 -2
- package/dist/components/switch.js +1 -1
- package/dist/components/tabs-filters.d.ts +1 -1
- package/dist/components/tabs-filters.js +1 -1
- package/dist/components/tag.d.ts +1 -1
- package/dist/components/tag.js +50 -64
- package/dist/components/text-area.d.ts +2 -2
- package/dist/components/text-area.js +1 -1
- package/dist/components/time-picker.d.ts +2 -2
- package/dist/components/time-picker.js +1 -1
- package/dist/components/toast.d.ts +3 -3
- package/dist/components/toast.js +4 -3
- package/dist/components/toggle-button.d.ts +1 -1
- package/dist/components/toggle-button.js +1 -1
- package/dist/components/toggle-group.d.ts +2 -2
- package/dist/components/toggle-group.js +1 -1
- package/dist/components/tooltip-ellipsis.d.ts +1 -1
- package/dist/components/tooltip-ellipsis.js +1 -1
- package/dist/components/tooltip.d.ts +1 -1
- package/dist/components/tooltip.js +1 -1
- package/dist/components/typography.d.ts +2 -2
- package/dist/components/use-toast.d.ts +2 -2
- package/dist/components/use-toast.js +1 -41
- package/dist/config/component-configuration.d.ts +1 -1
- package/dist/config/component-configuration.js +53 -2
- package/dist/config/confirmation.d.ts +1 -1
- package/dist/config/confirmation.js +1 -1
- package/dist/config/link-context.d.ts +3 -3
- package/dist/config/link-context.js +1 -1
- package/dist/config/resources.d.ts +1 -1
- package/dist/config/resources.js +1 -1
- package/dist/config/ui-config.d.ts +2 -2
- package/dist/config/ui-config.js +1 -1
- package/dist/config/ui-router.d.ts +1 -1
- package/dist/config/ui-router.js +1 -1
- package/dist/confirmation.context-BflM4Vxg.js +93 -0
- package/dist/confirmation.context-C_js9qNv.d.ts +32 -0
- package/dist/{datePickerInput.cva-Du0Zn04v.js → datePickerInput.cva-CWkV2fut.js} +1 -1
- package/dist/dateRangePreset.utils-Bnb-rjTt.js +116 -0
- package/dist/{dialog.cva-BIpz6HcA.js → dialog.cva-BjVggO5l.js} +1 -1
- package/dist/{dist-DEZzXa0W.js → dist-DZOoWaZz.js} +63 -38
- package/dist/{dropdownMenu.cva-DwSOcbmR.js → dropdownMenu.cva-BopsvbOy.js} +19 -7
- package/dist/{exports-BNrTn8Tj.js → exports-DeBGRThC.js} +3 -3
- package/dist/{file.utils-Crb-mIHs.d.ts → file.utils-DUADtzdt.d.ts} +3 -3
- package/dist/{file.utils-DqQxnuAm.js → file.utils-X6tkeWaz.js} +2 -6
- package/dist/fileInputButton.cva-gbqRUf1g.js +39 -0
- package/dist/{fileUpload.cva-BYzXGc9C.js → fileUpload.cva-MH5ziWUe.js} +2 -2
- package/dist/form-field-Bw7U_ZPI.d.ts +1 -0
- package/dist/form.binding-Brdjq2yr.js +161 -0
- package/dist/form.binding-DSXB2AOD.d.ts +127 -0
- package/dist/form.types-a2WVJDQX.d.ts +43 -0
- package/dist/formReset-CnZl_yze.js +35 -0
- package/dist/hints-B09_WDhL.d.ts +17 -0
- package/dist/hooks/use-async-list.d.ts +1 -1
- package/dist/hooks/use-async-list.js +1 -1
- package/dist/hooks/use-breakpoint.d.ts +3 -0
- package/dist/hooks/use-breakpoint.js +2 -0
- package/dist/hooks/use-filters.d.ts +2 -2
- package/dist/hooks/use-filters.js +1 -1
- package/dist/{i18n-EDC8xyfH.d.ts → i18n-B3PeqBM7.d.ts} +100 -20
- package/dist/{i18n-BE9Wvs9L.js → i18n-DQs7jPjv.js} +99 -25
- package/dist/iconSlot.cva-DyhOI7EK.js +5 -0
- package/dist/{import-Dkfk7PHt.js → import-C73fI3WD.js} +2 -2
- package/dist/index.d.ts +64 -85
- package/dist/index.js +55 -92
- package/dist/{input.cva-DZii82eS.js → input.cva-mm1dnfKP.js} +27 -23
- package/dist/inputLayout-CIVpuUBq.js +7 -0
- package/dist/inputRow.clsx-BbcaXVta.js +6 -0
- package/dist/{label.cva-DTfT6FrX.js → label.cva-DJ5Dmbz5.js} +7 -7
- package/dist/link.context-BcBuP9ZT.d.ts +20 -0
- package/dist/{link.context-TPjDtjw3.js → link.context-CD5h_b5O.js} +12 -11
- package/dist/link.cva-D6L1c2wq.d.ts +2157 -0
- package/dist/{logger-CqZjM-sn.js → logger-CW24po62.js} +10 -1
- package/dist/{progress.cva-CsGaGVJ-.js → progress.cva-mkJxrrac.js} +2 -2
- package/dist/{radio.cva-DistaZtZ.js → radio.cva-Dt5N2ul2.js} +7 -7
- package/dist/rich-text-editor.d.ts +44 -2
- package/dist/rich-text-editor.js +733 -1
- package/dist/router.context-B6j_M4cN.js +151 -0
- package/dist/router.context-CSd9JYQ4.d.ts +33 -0
- package/dist/{selectDesktop.cva-DStkOdwm.js → selectDesktop.cva-30JAvtgB.js} +1 -1
- package/dist/sidebar.cva-BgxTCejU.js +150 -0
- package/dist/spinner.cva-j4kGmIWC.js +17 -0
- package/dist/{staticDateTimeSegments-4tIzPL8l.js → staticDateTimeSegments-BYk1tcxs.js} +43 -13
- package/dist/{status.cva-CYgi3Htz.js → status.cva-WLEqUAjH.js} +9 -9
- package/dist/styles/input.d.ts +1 -1
- package/dist/tanstack/form.d.ts +3 -3
- package/dist/tanstack/form.js +3 -3
- package/dist/tanstack/table.d.ts +5 -3
- package/dist/tanstack/table.js +2 -2
- package/dist/tanstack-ABeiJISz.js +10 -0
- package/dist/tanstack-bLXoUPDY.d.ts +165 -0
- package/dist/tanstack.d.ts +64 -85
- package/dist/tanstack.js +55 -92
- package/dist/{toast.cva-B6NXTwbZ.js → toast.cva-C3oA7He3.js} +8 -8
- package/dist/toast.runtime-BHXdSTXV.js +25 -0
- package/dist/{toggleGroup.cva-CJ-3Ps7j.js → toggleGroup.cva-CvNS5QO1.js} +2 -2
- package/dist/uiConfig.context-CN_QgxGO.d.ts +19 -0
- package/dist/{uiConfig.context-3DN9w6oU.js → uiConfig.context-CjnLnQOo.js} +5 -7
- package/dist/{uiConfig.context-BnCORTNm.d.ts → uiConfig.types-B0sPL7nN.d.ts} +34 -34
- package/dist/{useAsyncList-Ct74ve3i.js → useAsyncList-CQgkDfjW.js} +140 -35
- package/dist/useAsyncList-F-328rtE.d.ts +25 -0
- package/dist/useAutoFocus-K-bfNxa2.js +16 -0
- package/dist/{useBreakpoint-CJ3mx7UF.js → useBreakpoint-BrJrvp9_.js} +5 -1
- package/dist/useBreakpoint-D-SVcBeQ.d.ts +9 -0
- package/dist/useDebounceCallback-BjePw6y4.js +90 -0
- package/dist/useFilters-CybBXUAA.js +217 -0
- package/dist/useFilters-DrfBFNLw.d.ts +57 -0
- package/dist/useFormAutosave-BN-zueci.js +419 -0
- package/dist/{useFormAutosave-BBLm3Ujo.d.ts → useFormAutosave-ClMnzVE7.d.ts} +1 -1
- package/dist/{useIntersectionObserver-DFAhTsV0.js → useIntersectionObserver-B8msnQTR.js} +15 -3
- package/dist/{numberStatic.utils-BIyZuILs.js → useLiveNumberFieldState-B7qGzySj.js} +103 -2
- package/dist/useRemoveButton-B6-IGvpY.js +98 -0
- package/dist/useResolveDateRangePreset-C_L-doA6.js +26 -0
- package/dist/useResolveDateRangePreset-DOSzJR-N.d.ts +64 -0
- package/dist/{useScrollableListBox-oYKqU3Hp.js → useScrollableListBox-C8chM7c-.js} +1 -1
- package/dist/{useStaticInputHandoff-BN0fOerH.js → useStaticInputHandoff-DrNFrvD7.js} +6 -1
- package/dist/{useTableColumnConfig-D3KH4Rpo.js → useTableColumnConfig-B9cYBKo3.js} +956 -689
- package/dist/useTableNav-rP1wDkhV.d.ts +372 -0
- package/dist/useToast-D2C9pROU.d.ts +78 -0
- package/dist/useToast-DSoOiSw0.js +63 -0
- package/dist/utils/file.d.ts +1 -1
- package/dist/utils/file.js +1 -1
- package/dist/utils/logger.js +1 -1
- package/llms.txt +3116 -0
- package/package.json +13 -131
- package/MIGRATION.md +0 -673
- package/dist/Alert-D4X7OWiv.d.ts +0 -34
- package/dist/AlertDialog-DklLDjmw.d.ts +0 -26
- package/dist/Autocomplete-BgFz3kuR.d.ts +0 -23
- package/dist/Autocomplete-BxRjxjtp.js +0 -145
- package/dist/Autocomplete.bound-CpHZZ3C9.d.ts +0 -9
- package/dist/Autocomplete.bound-DweyHUI5.js +0 -28
- package/dist/Badge-Db1ndK67.d.ts +0 -30
- package/dist/BadgeButton-BPhWDAnc.d.ts +0 -15
- package/dist/BottomSheet-BZmDJBR-.d.ts +0 -33
- package/dist/ButtonBase-CZuEy3Pk.d.ts +0 -32
- package/dist/Checkbox-w2j5hLOQ.d.ts +0 -27
- package/dist/Checkbox.bound-D2nBglJz.js +0 -33
- package/dist/Checkbox.bound-DD_RCjVm.d.ts +0 -9
- package/dist/CheckboxCheckmark-DWsYVZuu.js +0 -25
- package/dist/CheckboxGroup-BYI15Y09.d.ts +0 -30
- package/dist/CheckboxGroup.bound-DY0HKGSh.js +0 -32
- package/dist/CheckboxGroup.bound-QiJ-P0KR.d.ts +0 -9
- package/dist/ComboBox-ChsdI0lt.js +0 -212
- package/dist/DatePicker-QzfQf21b.d.ts +0 -56
- package/dist/DatePicker.bound-DoCAqhM4.d.ts +0 -9
- package/dist/DatePicker.bound-Dxg2LM89.js +0 -36
- package/dist/DateRangePicker-32D4pWJg.d.ts +0 -97
- package/dist/DateRangePicker.bound-CVtoVsho.d.ts +0 -9
- package/dist/DateRangePicker.bound-PR9rBoXc.js +0 -35
- package/dist/DateTimePicker-BTRIUagV.d.ts +0 -55
- package/dist/DateTimePicker.bound-CQxnRveH.js +0 -32
- package/dist/DateTimePicker.bound-X4DTyQ1b.d.ts +0 -9
- package/dist/Dialog-CO9xljD3.d.ts +0 -21
- package/dist/Drawer-D1cHiBFO.d.ts +0 -18
- package/dist/DropdownMenu-D_9z9ond.d.ts +0 -25
- package/dist/FileInput-BEaECoBS.d.ts +0 -75
- package/dist/FileInput.bound-CctyulN9.js +0 -30
- package/dist/FileInput.bound-D2HuuqSb.d.ts +0 -8
- package/dist/FileUpload-BUTSqHVk.d.ts +0 -11
- package/dist/FileUpload-Dfs3FvJ7.js +0 -749
- package/dist/FileUpload.bound-CGQXb4iT.d.ts +0 -16
- package/dist/FileUpload.bound-vik_sTkm.js +0 -30
- package/dist/FileUploadContainer-Dzg5aXXZ.d.ts +0 -5
- package/dist/FormField-DGyCDxOp.d.ts +0 -42
- package/dist/FormFieldHeaderTooltip-Dt-g40Tc.js +0 -17
- package/dist/IconButton-shH_9wcl.d.ts +0 -25
- package/dist/Input-CTp_9mS9.d.ts +0 -34
- package/dist/Input.bound-0iJO2-ia.js +0 -31
- package/dist/Input.bound-B9a62ylL.d.ts +0 -9
- package/dist/InputContent-BCNkN4Fx.d.ts +0 -27
- package/dist/Link-PvYB_M-j.d.ts +0 -30
- package/dist/MenuItem-U3-pu1j5.d.ts +0 -6
- package/dist/NumberField-WXebfxjK.d.ts +0 -34
- package/dist/NumberField.bound-DHDsBNvI.js +0 -32
- package/dist/NumberField.bound-Dy0A5iVc.d.ts +0 -9
- package/dist/NumberRangeInput-BCKQaGpy.d.ts +0 -50
- package/dist/NumberRangeInput.bound-5Yv3Og73.js +0 -32
- package/dist/NumberRangeInput.bound-BNXxIQ0b.d.ts +0 -9
- package/dist/Pagination-BCGUVYOF.d.ts +0 -12
- package/dist/PaginationList-CvlSkJGn.d.ts +0 -18
- package/dist/PaginationList-D7SRwySe.js +0 -220
- package/dist/PasswordInput-EhQjYyJS.d.ts +0 -11
- package/dist/PasswordInput.bound-CK5GwKL4.d.ts +0 -9
- package/dist/Popover-D_t1XDPA.d.ts +0 -20
- package/dist/Progress-Ckfpi_-M.d.ts +0 -45
- package/dist/Progress-RiEGGxNG.js +0 -119
- package/dist/RadioGroup-6e-Z6jW8.d.ts +0 -26
- package/dist/RadioGroup.bound-BFWSq-on.js +0 -32
- package/dist/RadioGroup.bound-w3SZqSkH.d.ts +0 -9
- package/dist/RichTextEditor-BuqZth3X.js +0 -651
- package/dist/RichTextEditor-DHhuBeT6.d.ts +0 -28
- package/dist/Select-C34ENdjq.d.ts +0 -119
- package/dist/Select.bound-CNCChZww.js +0 -34
- package/dist/Select.bound-qOihchei.d.ts +0 -17
- package/dist/Slider-DRg8zKRM.d.ts +0 -23
- package/dist/Slider.bound-CByTXPTr.js +0 -31
- package/dist/Slider.bound-CaEF19um.d.ts +0 -9
- package/dist/Spinner-Cvy_6zgD.d.ts +0 -30
- package/dist/Spinner-DqjP06T1.js +0 -101
- package/dist/SplitButton-V1f2NWfh.d.ts +0 -15
- package/dist/Stepper-k91x_m-E.d.ts +0 -114
- package/dist/Switch-ELVPkPx0.d.ts +0 -24
- package/dist/Switch.bound-DeEdVvZV.d.ts +0 -9
- package/dist/Switch.bound-Dv0cHsMM.js +0 -33
- package/dist/TableDnd-CuHxANWh.js +0 -133
- package/dist/TableRowDetails-D8HFTghI.d.ts +0 -109
- package/dist/TabsFilters-DePddjCk.d.ts +0 -30
- package/dist/Tag-B2_ZiSE-.d.ts +0 -44
- package/dist/TextArea-iqUeB2QY.d.ts +0 -26
- package/dist/TextArea.bound-BJHyCogp.d.ts +0 -9
- package/dist/TextArea.bound-CDVPP_qb.js +0 -28
- package/dist/TimePicker-BZ1ocsBX.d.ts +0 -45
- package/dist/TimePicker.bound-8DmjMXuE.d.ts +0 -9
- package/dist/TimePicker.bound-DPia51Qs.js +0 -32
- package/dist/Toast-D9pdadZ4.d.ts +0 -16
- package/dist/ToggleGroup-CrDoeLN0.js +0 -333
- package/dist/ToggleGroup-DvjnSinl.d.ts +0 -42
- package/dist/ToggleGroup.bound-B03ISHQ8.d.ts +0 -9
- package/dist/ToggleGroup.bound-DCnYwmBt.js +0 -67
- package/dist/Tooltip-B8DTURLQ.d.ts +0 -16
- package/dist/TooltipEllipsis-Di9Dvd4x.d.ts +0 -11
- package/dist/badgeButton.cva-CBFIhr1S.d.ts +0 -41
- package/dist/button.cva-C8LGtNJ3.d.ts +0 -94
- package/dist/checkbox.cva-CCh_UlrC.d.ts +0 -76
- package/dist/components/badge-button.d.ts +0 -2
- package/dist/components/badge-button.js +0 -74
- package/dist/components/file-upload-container.d.ts +0 -3
- package/dist/components/file-upload-container.js +0 -15
- package/dist/components/pagination-list.d.ts +0 -2
- package/dist/components/pagination-list.js +0 -2
- package/dist/components/pagination.d.ts +0 -2
- package/dist/components/pagination.js +0 -138
- package/dist/confirmation.context-BwlIEVeF.js +0 -114
- package/dist/confirmation.context-C_GDRn3a.d.ts +0 -23
- package/dist/fileUpload.types-C-ke21yY.d.ts +0 -110
- package/dist/form.binding-DOR5gIQf.js +0 -49
- package/dist/form.types-C8P4sznq.d.ts +0 -22
- package/dist/formFieldHelper.cva-DRmSyRZN.js +0 -14
- package/dist/iconSlot.cva-CLB5Tlsr.d.ts +0 -9
- package/dist/icons.d.ts +0 -4
- package/dist/icons.js +0 -3
- package/dist/input.cva-BjuHsDGy.d.ts +0 -80
- package/dist/inputLayout-KdAtunGk.js +0 -5
- package/dist/link.context-BCHn7NSy.d.ts +0 -12
- package/dist/radio.cva-D7M1hqLe.d.ts +0 -56
- package/dist/router.context-CtafjXV7.d.ts +0 -16
- package/dist/router.context-MckTbHw9.js +0 -63
- package/dist/routing.utils-DfxEt0_Y.js +0 -30
- package/dist/style-definitions-Dx6aFDiR.d.ts +0 -1038
- package/dist/switch.cva-r6vcS25Q.d.ts +0 -16
- package/dist/tanstack/autocomplete.d.ts +0 -3
- package/dist/tanstack/autocomplete.js +0 -2
- package/dist/tanstack/checkbox-group.d.ts +0 -3
- package/dist/tanstack/checkbox-group.js +0 -2
- package/dist/tanstack/checkbox.d.ts +0 -3
- package/dist/tanstack/checkbox.js +0 -2
- package/dist/tanstack/date-picker.d.ts +0 -3
- package/dist/tanstack/date-picker.js +0 -2
- package/dist/tanstack/date-range-picker.d.ts +0 -3
- package/dist/tanstack/date-range-picker.js +0 -2
- package/dist/tanstack/date-time-picker.d.ts +0 -3
- package/dist/tanstack/date-time-picker.js +0 -2
- package/dist/tanstack/file-input.d.ts +0 -3
- package/dist/tanstack/file-input.js +0 -2
- package/dist/tanstack/file-upload.d.ts +0 -4
- package/dist/tanstack/file-upload.js +0 -2
- package/dist/tanstack/input.d.ts +0 -3
- package/dist/tanstack/input.js +0 -2
- package/dist/tanstack/number-field.d.ts +0 -3
- package/dist/tanstack/number-field.js +0 -2
- package/dist/tanstack/number-range-input.d.ts +0 -3
- package/dist/tanstack/number-range-input.js +0 -2
- package/dist/tanstack/password-input.d.ts +0 -2
- package/dist/tanstack/password-input.js +0 -2
- package/dist/tanstack/radio-group.d.ts +0 -3
- package/dist/tanstack/radio-group.js +0 -2
- package/dist/tanstack/rich-text-editor.d.ts +0 -9
- package/dist/tanstack/rich-text-editor.js +0 -28
- package/dist/tanstack/select.d.ts +0 -3
- package/dist/tanstack/select.js +0 -2
- package/dist/tanstack/slider.d.ts +0 -3
- package/dist/tanstack/slider.js +0 -2
- package/dist/tanstack/switch.d.ts +0 -3
- package/dist/tanstack/switch.js +0 -2
- package/dist/tanstack/text-area.d.ts +0 -3
- package/dist/tanstack/text-area.js +0 -2
- package/dist/tanstack/time-picker.d.ts +0 -3
- package/dist/tanstack/time-picker.js +0 -2
- package/dist/tanstack/toggle-group.d.ts +0 -3
- package/dist/tanstack/toggle-group.js +0 -2
- package/dist/tanstack-Bgdv0qU1.js +0 -19
- package/dist/tanstack-CtuKX9Ss.d.ts +0 -568
- package/dist/toast.cva-AmLw6Cf5.d.ts +0 -61
- package/dist/toast.runtime-Drd2IJ_j.js +0 -17
- package/dist/toastActivation.store-BELtcr76.js +0 -16
- package/dist/toggleGroup.cva-DA4U21gn.d.ts +0 -26
- package/dist/typography.cva-BCHlTHdM.d.ts +0 -36
- package/dist/useAsyncList-Cu-Y8If2.d.ts +0 -9
- package/dist/useFilters-BxRScJdn.d.ts +0 -11
- package/dist/useFilters-DMi94RZK.js +0 -190
- package/dist/useForm-Cb7KWLds.js +0 -217
- package/dist/useForm-I6z23FXf.d.ts +0 -51
- package/dist/useFormAutosave-BPGlChiY.js +0 -216
- package/dist/useTableNav-H5DrogZU.d.ts +0 -215
- package/dist/useToast-DsA8CVoY.d.ts +0 -16
|
@@ -0,0 +1,679 @@
|
|
|
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-DlryDp2T.js";
|
|
5
|
+
import { t as Typography } from "./Typography-DCLnPa3P.js";
|
|
6
|
+
import "./i18n-DQs7jPjv.js";
|
|
7
|
+
import { t as UIConfig } from "./uiConfig.context-CjnLnQOo.js";
|
|
8
|
+
import { t as Button } from "./Button-CzEs3tcV.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-TI8Vx5aC.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-WzWvbvtp.js";
|
|
16
|
+
import { t as fileUploadDropZoneDefinition } from "./fileUpload.cva-MH5ziWUe.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/FileUploadContentFilled.tsx
|
|
23
|
+
const FileUploadContentFilled = ({ orientation, actionStyle, isDisabled, file, browseText, fileTriggerProps, removeWithIcon = false, onRemove, browseButtonProps }) => {
|
|
24
|
+
const { t } = useTranslation("ui");
|
|
25
|
+
const { size: browseButtonSize = "sm", variant: browseButtonVariant = "outlined", width: browseButtonWidth = "hug", ...browseButtonRestProps } = browseButtonProps ?? {};
|
|
26
|
+
return /* @__PURE__ */ jsx("div", {
|
|
27
|
+
className: clsx("flex w-full flex-fill flex-col items-start"),
|
|
28
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
29
|
+
className: clsx("flex w-full items-center", orientation === "horizontal" && "flex-row gap-4", orientation === "vertical" && "flex-col", orientation === "vertical" && actionStyle === "button" && "gap-4", orientation === "vertical" && actionStyle === "link" && "gap-1"),
|
|
30
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
31
|
+
className: clsx("flex min-w-0 max-w-full grow items-center gap-2", orientation === "vertical" && "flex-col", orientation === "horizontal" && "flex-row", isDisabled && "opacity-50"),
|
|
32
|
+
children: [/* @__PURE__ */ jsx(IconSlot, {
|
|
33
|
+
icon: CheckCircle,
|
|
34
|
+
className: "text-muted-foreground"
|
|
35
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
36
|
+
className: clsx("flex flex-col gap-1", orientation === "vertical" && "max-w-full items-center", orientation === "horizontal" && "max-w-[calc(100%-32px)]"),
|
|
37
|
+
children: [/* @__PURE__ */ jsx(Typography, {
|
|
38
|
+
size: "large",
|
|
39
|
+
as: "span",
|
|
40
|
+
className: "self-stretch truncate text-center text-foreground font-medium",
|
|
41
|
+
children: file.name
|
|
42
|
+
}), /* @__PURE__ */ jsx(Typography, {
|
|
43
|
+
size: "small",
|
|
44
|
+
as: "span",
|
|
45
|
+
className: "text-foreground",
|
|
46
|
+
children: FileUtils.getFileDisplaySize(file)
|
|
47
|
+
})]
|
|
48
|
+
})]
|
|
49
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
50
|
+
className: clsx("flex flex-none items-center justify-end", orientation === "vertical" && actionStyle === "button" && "flex-col", actionStyle === "link" && orientation === "vertical" && "gap-1", actionStyle === "button" && orientation === "vertical" && "gap-4", orientation === "horizontal" && "gap-2"),
|
|
51
|
+
children: actionStyle === "link" ? /* @__PURE__ */ jsxs(Fragment$1, { children: [fileTriggerProps && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx($b325d7bd7e74496a$export$6fb4a10d2c950550, {
|
|
52
|
+
...fileTriggerProps,
|
|
53
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
54
|
+
className: clsx("text-primary", orientation === "vertical" && "[&>span>span]:font-medium!"),
|
|
55
|
+
variant: "text",
|
|
56
|
+
width: "hug",
|
|
57
|
+
children: browseText ?? ""
|
|
58
|
+
})
|
|
59
|
+
}), orientation === "vertical" && /* @__PURE__ */ jsx(Typography, {
|
|
60
|
+
size: "small",
|
|
61
|
+
as: "span",
|
|
62
|
+
className: "text-muted-foreground",
|
|
63
|
+
children: t(($) => $.ui.fileUpload.or)
|
|
64
|
+
})] }), removeWithIcon ? /* @__PURE__ */ jsx(IconButton, {
|
|
65
|
+
label: t(($) => $.ui.fileUpload.removeFile),
|
|
66
|
+
color: "secondary",
|
|
67
|
+
onPress: onRemove,
|
|
68
|
+
icon: X,
|
|
69
|
+
variant: "text",
|
|
70
|
+
width: "hug",
|
|
71
|
+
disableTooltip: true,
|
|
72
|
+
size: "sm"
|
|
73
|
+
}) : /* @__PURE__ */ jsx(Button, {
|
|
74
|
+
className: clsx(orientation === "vertical" && "text-primary lowercase [&>span>span]:font-medium!"),
|
|
75
|
+
color: orientation === "horizontal" ? "secondary" : "primary",
|
|
76
|
+
onPress: onRemove,
|
|
77
|
+
variant: "text",
|
|
78
|
+
width: "hug",
|
|
79
|
+
children: t(($) => $.ui.fileUpload.removeFile)
|
|
80
|
+
})] }) : /* @__PURE__ */ jsxs("div", {
|
|
81
|
+
className: "flex items-center justify-center gap-2 self-stretch",
|
|
82
|
+
children: [fileTriggerProps && /* @__PURE__ */ jsx($b325d7bd7e74496a$export$6fb4a10d2c950550, {
|
|
83
|
+
...fileTriggerProps,
|
|
84
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
85
|
+
variant: browseButtonVariant,
|
|
86
|
+
size: browseButtonSize,
|
|
87
|
+
width: browseButtonWidth,
|
|
88
|
+
...browseButtonRestProps,
|
|
89
|
+
isDisabled,
|
|
90
|
+
children: browseText ?? ""
|
|
91
|
+
})
|
|
92
|
+
}), removeWithIcon ? /* @__PURE__ */ jsx(IconButton, {
|
|
93
|
+
label: t(($) => $.ui.fileUpload.removeFile),
|
|
94
|
+
color: "secondary",
|
|
95
|
+
onPress: onRemove,
|
|
96
|
+
icon: X,
|
|
97
|
+
isDisabled,
|
|
98
|
+
variant: "text",
|
|
99
|
+
width: "hug",
|
|
100
|
+
disableTooltip: true,
|
|
101
|
+
size: "sm"
|
|
102
|
+
}) : /* @__PURE__ */ jsx(Button, {
|
|
103
|
+
color: "secondary",
|
|
104
|
+
onPress: onRemove,
|
|
105
|
+
isDisabled,
|
|
106
|
+
variant: "text",
|
|
107
|
+
width: "hug",
|
|
108
|
+
children: t(($) => $.ui.fileUpload.removeFile)
|
|
109
|
+
})]
|
|
110
|
+
})
|
|
111
|
+
})]
|
|
112
|
+
})
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region src/components/inputs/File/shared/FileUploadContentLoading.tsx
|
|
117
|
+
const FileUploadContentLoading = ({ orientation, actionStyle, file, isDisabled, onCancel, cancelButtonProps }) => {
|
|
118
|
+
const { t } = useTranslation("ui");
|
|
119
|
+
const { color: cancelButtonColor = "secondary", size: cancelButtonSize = "sm", variant: cancelButtonVariant = "outlined", width: cancelButtonWidth = "hug", ...cancelButtonRestProps } = cancelButtonProps ?? {};
|
|
120
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
121
|
+
className: clsx("flex w-full flex-col items-center", orientation === "vertical" && "flex-col", orientation === "horizontal" && "flex-row", actionStyle === "button" && "gap-4"),
|
|
122
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
123
|
+
className: clsx("flex w-full items-center justify-between", orientation === "vertical" && "flex-col gap-1", orientation === "horizontal" && "flex-row gap-4", isDisabled && "opacity-50"),
|
|
124
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
125
|
+
className: clsx("flex items-center gap-2", orientation === "vertical" && "w-full flex-col", orientation === "horizontal" && "w-1/2"),
|
|
126
|
+
children: [/* @__PURE__ */ jsx(IconSlot, {
|
|
127
|
+
icon: File,
|
|
128
|
+
className: "text-muted-foreground"
|
|
129
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
130
|
+
className: clsx("flex flex-col", orientation === "vertical" && "max-w-full gap-2 text-center", orientation === "horizontal" && "max-w-[calc(100%-32px)] gap-1"),
|
|
131
|
+
children: [/* @__PURE__ */ jsx(Typography, {
|
|
132
|
+
size: "large",
|
|
133
|
+
as: "span",
|
|
134
|
+
className: "self-stretch truncate text-center text-foreground font-medium",
|
|
135
|
+
children: file.name
|
|
136
|
+
}), /* @__PURE__ */ jsx(Typography, {
|
|
137
|
+
size: "small",
|
|
138
|
+
as: "span",
|
|
139
|
+
className: "text-muted-foreground",
|
|
140
|
+
children: FileUtils.getFileDisplaySize(file)
|
|
141
|
+
})]
|
|
142
|
+
})]
|
|
143
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
144
|
+
className: clsx("flex items-center gap-1", orientation === "horizontal" && "w-1/2", orientation === "vertical" && "w-full"),
|
|
145
|
+
children: [/* @__PURE__ */ jsx(Progress, {
|
|
146
|
+
value: file.progress,
|
|
147
|
+
label: file.name,
|
|
148
|
+
hideLabel: true
|
|
149
|
+
}), (actionStyle === "link" || orientation === "horizontal") && /* @__PURE__ */ jsx(IconButton, {
|
|
150
|
+
label: t(($) => $.ui.fileUpload.cancel),
|
|
151
|
+
color: "secondary",
|
|
152
|
+
onPress: onCancel,
|
|
153
|
+
icon: X,
|
|
154
|
+
variant: "text",
|
|
155
|
+
width: "hug",
|
|
156
|
+
disableTooltip: true,
|
|
157
|
+
size: "sm"
|
|
158
|
+
})]
|
|
159
|
+
})]
|
|
160
|
+
}), actionStyle === "button" && orientation === "vertical" && /* @__PURE__ */ jsx(Button, {
|
|
161
|
+
variant: cancelButtonVariant,
|
|
162
|
+
size: cancelButtonSize,
|
|
163
|
+
color: cancelButtonColor,
|
|
164
|
+
width: cancelButtonWidth,
|
|
165
|
+
...cancelButtonRestProps,
|
|
166
|
+
onPress: onCancel,
|
|
167
|
+
children: t(($) => $.ui.fileUpload.cancel)
|
|
168
|
+
})]
|
|
169
|
+
});
|
|
170
|
+
};
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region src/components/inputs/File/shared/FileCard.tsx
|
|
173
|
+
const FileCardComponent = ({ actionStyle, file, onRemove, isDisabled, browseButtonProps, cancelButtonProps, onCancel }) => /* @__PURE__ */ jsx("div", {
|
|
174
|
+
className: clsx("flex items-center self-stretch", "bg-card", "px-3", "py-4", "rounded-lg border border-border border-solid"),
|
|
175
|
+
children: file.status === "uploading" ? /* @__PURE__ */ jsx(FileUploadContentLoading, {
|
|
176
|
+
orientation: "horizontal",
|
|
177
|
+
actionStyle,
|
|
178
|
+
isDisabled,
|
|
179
|
+
file,
|
|
180
|
+
cancelButtonProps,
|
|
181
|
+
onCancel: () => onCancel?.(file)
|
|
182
|
+
}) : /* @__PURE__ */ jsx(FileUploadContentFilled, {
|
|
183
|
+
actionStyle,
|
|
184
|
+
removeWithIcon: true,
|
|
185
|
+
orientation: "horizontal",
|
|
186
|
+
isDisabled,
|
|
187
|
+
file,
|
|
188
|
+
browseButtonProps,
|
|
189
|
+
onRemove: () => onRemove?.(file)
|
|
190
|
+
})
|
|
191
|
+
});
|
|
192
|
+
const FileCard = memo(FileCardComponent);
|
|
193
|
+
//#endregion
|
|
194
|
+
//#region src/components/inputs/File/shared/FileCardList.tsx
|
|
195
|
+
const FileCardList = memo(({ files, actionStyle, isDisabled, browseButtonProps, cancelButtonProps, className, onRemove, onCancel }) => {
|
|
196
|
+
return /* @__PURE__ */ jsx("div", {
|
|
197
|
+
className: clsx("mt-4 flex flex-col items-start gap-2 self-stretch", className),
|
|
198
|
+
children: files.map((file) => /* @__PURE__ */ jsx(FileCard, {
|
|
199
|
+
actionStyle,
|
|
200
|
+
file,
|
|
201
|
+
isDisabled,
|
|
202
|
+
browseButtonProps,
|
|
203
|
+
cancelButtonProps,
|
|
204
|
+
onRemove,
|
|
205
|
+
onCancel
|
|
206
|
+
}, file.key))
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
//#endregion
|
|
210
|
+
//#region src/components/inputs/File/shared/FileUploadContentEmpty.tsx
|
|
211
|
+
const FileUploadContentEmpty = ({ orientation, actionStyle, isDisabled, title, browseText, uploadText, hideButton = false, className, browseButtonProps }) => {
|
|
212
|
+
const { size: browseButtonSize = "sm", variant: browseButtonVariant = "outlined", width: browseButtonWidth = "hug", ...browseButtonRestProps } = browseButtonProps ?? {};
|
|
213
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
214
|
+
className: clsx("flex w-full items-center gap-1", className, orientation === "vertical" && "flex-col", orientation === "horizontal" && "min-h-11 flex-row justify-between"),
|
|
215
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
216
|
+
className: clsx("flex items-center gap-2", orientation === "vertical" && "flex-col", orientation === "horizontal" && "flex-row", isDisabled && "opacity-50"),
|
|
217
|
+
children: [/* @__PURE__ */ jsx(IconSlot, {
|
|
218
|
+
icon: Upload,
|
|
219
|
+
className: "text-foreground"
|
|
220
|
+
}), /* @__PURE__ */ jsx(Typography, {
|
|
221
|
+
size: "lead",
|
|
222
|
+
as: "span",
|
|
223
|
+
className: clsx("self-stretch text-foreground font-normal", orientation === "vertical" && "text-center"),
|
|
224
|
+
children: title
|
|
225
|
+
})]
|
|
226
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
227
|
+
className: clsx("flex items-center justify-center", orientation === "vertical" && actionStyle === "button" && "flex-col", actionStyle === "link" && "gap-1", actionStyle === "button" && "gap-4"),
|
|
228
|
+
children: [/* @__PURE__ */ jsx(Typography, {
|
|
229
|
+
size: "large",
|
|
230
|
+
as: "span",
|
|
231
|
+
className: clsx("text-muted-foreground font-normal", orientation === "vertical" && "text-center", isDisabled && "opacity-50"),
|
|
232
|
+
children: uploadText
|
|
233
|
+
}), !hideButton && browseText && (actionStyle === "link" ? /* @__PURE__ */ jsx(Button, {
|
|
234
|
+
className: "text-primary lowercase",
|
|
235
|
+
isDisabled,
|
|
236
|
+
variant: "text",
|
|
237
|
+
width: "hug",
|
|
238
|
+
children: browseText
|
|
239
|
+
}) : /* @__PURE__ */ jsx(Button, {
|
|
240
|
+
variant: browseButtonVariant,
|
|
241
|
+
size: browseButtonSize,
|
|
242
|
+
width: browseButtonWidth,
|
|
243
|
+
...browseButtonRestProps,
|
|
244
|
+
isDisabled,
|
|
245
|
+
children: browseText
|
|
246
|
+
}))]
|
|
247
|
+
})]
|
|
248
|
+
});
|
|
249
|
+
};
|
|
250
|
+
//#endregion
|
|
251
|
+
//#region src/components/inputs/File/shared/FileUploadContent.tsx
|
|
252
|
+
const FileUploadContent = ({ orientation, actionStyle, isDisabled, browseText, uploadText, emptyText, files, browseButtonProps, cancelButtonProps, onCancel, onRemove, acceptedFileTypes, allowsMultiple, onSelect, ...rest }) => {
|
|
253
|
+
const currentFile = allowsMultiple ? void 0 : files.at(0);
|
|
254
|
+
const fileTriggerProps = {
|
|
255
|
+
...rest,
|
|
256
|
+
acceptedFileTypes,
|
|
257
|
+
allowsMultiple,
|
|
258
|
+
onSelect
|
|
259
|
+
};
|
|
260
|
+
if (currentFile?.status === "uploading") return /* @__PURE__ */ jsx(FileUploadContentLoading, {
|
|
261
|
+
orientation,
|
|
262
|
+
actionStyle,
|
|
263
|
+
isDisabled,
|
|
264
|
+
file: currentFile,
|
|
265
|
+
cancelButtonProps,
|
|
266
|
+
onCancel: () => onCancel(currentFile)
|
|
267
|
+
});
|
|
268
|
+
if (currentFile) return /* @__PURE__ */ jsx(FileUploadContentFilled, {
|
|
269
|
+
actionStyle,
|
|
270
|
+
orientation,
|
|
271
|
+
isDisabled,
|
|
272
|
+
file: currentFile,
|
|
273
|
+
browseText,
|
|
274
|
+
browseButtonProps,
|
|
275
|
+
fileTriggerProps,
|
|
276
|
+
onRemove: () => onRemove(currentFile)
|
|
277
|
+
});
|
|
278
|
+
return /* @__PURE__ */ jsx($b325d7bd7e74496a$export$6fb4a10d2c950550, {
|
|
279
|
+
...fileTriggerProps,
|
|
280
|
+
children: /* @__PURE__ */ jsx(FileUploadContentEmpty, {
|
|
281
|
+
actionStyle,
|
|
282
|
+
orientation,
|
|
283
|
+
isDisabled,
|
|
284
|
+
title: emptyText,
|
|
285
|
+
uploadText,
|
|
286
|
+
browseText,
|
|
287
|
+
browseButtonProps
|
|
288
|
+
})
|
|
289
|
+
});
|
|
290
|
+
};
|
|
291
|
+
//#endregion
|
|
292
|
+
//#region src/components/inputs/File/FileUpload.tsx
|
|
293
|
+
const NO_FILES = [];
|
|
294
|
+
/** Identifies stored files by their ids, so a re-created or re-ordered array of the same files compares equal. */
|
|
295
|
+
const getIdsKey = (files) => JSON.stringify(files.map((file) => file.id).sort());
|
|
296
|
+
const getFailureMessage = (failure) => {
|
|
297
|
+
if (typeof failure === "string") return failure;
|
|
298
|
+
if (typeof failure !== "object" || failure === null) return void 0;
|
|
299
|
+
if ("serverMessage" in failure && typeof failure.serverMessage === "string" && failure.serverMessage.trim()) return failure.serverMessage;
|
|
300
|
+
return "message" in failure && typeof failure.message === "string" ? failure.message : void 0;
|
|
301
|
+
};
|
|
302
|
+
const FileUploadBase = (props) => {
|
|
303
|
+
const { t } = useTranslation("ui");
|
|
304
|
+
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;
|
|
305
|
+
const ui = UIConfig.useConfig();
|
|
306
|
+
const fileUploadDropZoneCva = UIOverrides.useCva("fileUpload.dropZoneCva", fileUploadDropZoneDefinition);
|
|
307
|
+
const generatedErrorId = useId();
|
|
308
|
+
const resolvedErrorId = errorMessageId ?? generatedErrorId;
|
|
309
|
+
const generatedHelperTextId = useId();
|
|
310
|
+
const helperTextId = helperText ? `field-helper-${generatedHelperTextId}` : void 0;
|
|
311
|
+
const uploadKeyPrefix = useId();
|
|
312
|
+
const [uploadError, setUploadError] = useState();
|
|
313
|
+
const resolvedError = error ?? uploadError ?? fieldError;
|
|
314
|
+
const isControlled = value !== void 0;
|
|
315
|
+
const [ownFiles, setOwnFiles] = useState(defaultValue ?? NO_FILES);
|
|
316
|
+
const storedFiles = value ?? ownFiles;
|
|
317
|
+
const [uploads, setUploads] = useState([]);
|
|
318
|
+
const [sessionFiles, setSessionFiles] = useState({});
|
|
319
|
+
const latest = useRef({
|
|
320
|
+
onChange,
|
|
321
|
+
onUpload,
|
|
322
|
+
onRemove,
|
|
323
|
+
onInvalidFileType,
|
|
324
|
+
onUploadingChange,
|
|
325
|
+
isControlled,
|
|
326
|
+
allowsMultiple
|
|
327
|
+
});
|
|
328
|
+
const storedRef = useRef(storedFiles);
|
|
329
|
+
const uploadsRef = useRef(uploads);
|
|
330
|
+
const controllers = useRef(/* @__PURE__ */ new Map());
|
|
331
|
+
const uploadCount = useRef(0);
|
|
332
|
+
const resetCount = useRef(0);
|
|
333
|
+
const emittedKeys = useRef([]);
|
|
334
|
+
const seenValueKey = useRef(value ? getIdsKey(value) : void 0);
|
|
335
|
+
useLayoutEffect(() => {
|
|
336
|
+
latest.current = {
|
|
337
|
+
onChange,
|
|
338
|
+
onUpload,
|
|
339
|
+
onRemove,
|
|
340
|
+
onInvalidFileType,
|
|
341
|
+
onUploadingChange,
|
|
342
|
+
isControlled,
|
|
343
|
+
allowsMultiple
|
|
344
|
+
};
|
|
345
|
+
});
|
|
346
|
+
const updateUploads = useCallback((update) => {
|
|
347
|
+
const wasUploading = uploadsRef.current.length > 0;
|
|
348
|
+
uploadsRef.current = update(uploadsRef.current);
|
|
349
|
+
setUploads(uploadsRef.current);
|
|
350
|
+
const isUploading = uploadsRef.current.length > 0;
|
|
351
|
+
if (isUploading !== wasUploading) latest.current.onUploadingChange?.(isUploading);
|
|
352
|
+
}, []);
|
|
353
|
+
const cancelUploads = useCallback(() => {
|
|
354
|
+
controllers.current.forEach((controller) => controller.abort());
|
|
355
|
+
controllers.current.clear();
|
|
356
|
+
if (uploadsRef.current.length > 0) updateUploads(() => []);
|
|
357
|
+
}, [updateUploads]);
|
|
358
|
+
const endUpload = useCallback((key) => {
|
|
359
|
+
controllers.current.delete(key);
|
|
360
|
+
updateUploads((previous) => previous.filter((upload) => upload.key !== key));
|
|
361
|
+
}, [updateUploads]);
|
|
362
|
+
/** The owner replaced or reset the files: uploads meant for the old ones stop, and so does their error. */
|
|
363
|
+
const discardUploads = useCallback(() => {
|
|
364
|
+
emittedKeys.current = [];
|
|
365
|
+
resetCount.current += 1;
|
|
366
|
+
cancelUploads();
|
|
367
|
+
setUploadError(void 0);
|
|
368
|
+
}, [cancelUploads]);
|
|
369
|
+
/** Makes `next` the stored files. `onChange` runs first, so nothing is recorded when it throws. */
|
|
370
|
+
const commit = useCallback((next) => {
|
|
371
|
+
const key = getIdsKey(next);
|
|
372
|
+
if (latest.current.isControlled) emittedKeys.current.push(key);
|
|
373
|
+
try {
|
|
374
|
+
latest.current.onChange?.(next);
|
|
375
|
+
} catch (failure) {
|
|
376
|
+
const index = emittedKeys.current.lastIndexOf(key);
|
|
377
|
+
if (latest.current.isControlled && index !== -1) emittedKeys.current.splice(index, 1);
|
|
378
|
+
throw failure;
|
|
379
|
+
}
|
|
380
|
+
storedRef.current = next;
|
|
381
|
+
if (!latest.current.isControlled) setOwnFiles(next);
|
|
382
|
+
}, []);
|
|
383
|
+
useLayoutEffect(() => {
|
|
384
|
+
if (value === void 0) return;
|
|
385
|
+
const key = getIdsKey(value);
|
|
386
|
+
const emitted = emittedKeys.current.lastIndexOf(key);
|
|
387
|
+
if (emitted !== -1) emittedKeys.current.splice(0, emitted + 1);
|
|
388
|
+
else if (key !== seenValueKey.current) discardUploads();
|
|
389
|
+
seenValueKey.current = key;
|
|
390
|
+
if (emittedKeys.current.length === 0) storedRef.current = value;
|
|
391
|
+
});
|
|
392
|
+
useEffect(() => subscribeReset?.(discardUploads), [subscribeReset, discardUploads]);
|
|
393
|
+
useEffect(() => {
|
|
394
|
+
const activeControllers = controllers.current;
|
|
395
|
+
return () => activeControllers.forEach((controller) => controller.abort());
|
|
396
|
+
}, []);
|
|
397
|
+
const formFieldProps = {
|
|
398
|
+
error: resolvedError,
|
|
399
|
+
errorMessageId: resolvedErrorId,
|
|
400
|
+
label: label ?? "",
|
|
401
|
+
tooltipText,
|
|
402
|
+
helperText,
|
|
403
|
+
helperTextId,
|
|
404
|
+
isRequired,
|
|
405
|
+
hideLabel: hideLabel ?? (label ? ui.input.hideLabel : true),
|
|
406
|
+
isDisabled,
|
|
407
|
+
headerClassName,
|
|
408
|
+
errorClassName
|
|
409
|
+
};
|
|
410
|
+
const labelProps = $a8ea2faf2ebe4d2f$re_export$useLabels({ "aria-label": label });
|
|
411
|
+
const reportUploadError = useCallback((failure) => {
|
|
412
|
+
const message = getFailureMessage(failure);
|
|
413
|
+
setUploadError(message?.trim() ? message : t(($) => $.ui.fileUpload.uploadFailed));
|
|
414
|
+
}, [t]);
|
|
415
|
+
const handleUpload = async (inputFiles) => {
|
|
416
|
+
setUploadError(void 0);
|
|
417
|
+
try {
|
|
418
|
+
const validFiles = inputFiles.filter((file) => FileUtils.isFileTypeAccepted(file, acceptedFileTypes));
|
|
419
|
+
const invalidFiles = inputFiles.filter((file) => !FileUtils.isFileTypeAccepted(file, acceptedFileTypes));
|
|
420
|
+
if (invalidFiles.length > 0) latest.current.onInvalidFileType?.(invalidFiles.map((file) => file.name));
|
|
421
|
+
const acceptedFiles = allowsMultiple ? validFiles : validFiles.slice(0, 1);
|
|
422
|
+
if (acceptedFiles.length === 0) return;
|
|
423
|
+
if (!allowsMultiple) cancelUploads();
|
|
424
|
+
const batch = acceptedFiles.map((file) => {
|
|
425
|
+
const upload = {
|
|
426
|
+
status: "uploading",
|
|
427
|
+
key: `${uploadKeyPrefix}${uploadCount.current += 1}`,
|
|
428
|
+
name: file.name,
|
|
429
|
+
size: file.size,
|
|
430
|
+
type: file.type,
|
|
431
|
+
file,
|
|
432
|
+
progress: 0
|
|
433
|
+
};
|
|
434
|
+
const controller = new AbortController();
|
|
435
|
+
controllers.current.set(upload.key, controller);
|
|
436
|
+
return {
|
|
437
|
+
upload,
|
|
438
|
+
controller
|
|
439
|
+
};
|
|
440
|
+
});
|
|
441
|
+
updateUploads((previous) => [...previous, ...batch.map(({ upload }) => upload)]);
|
|
442
|
+
const succeeded = await Promise.all(batch.map(async ({ upload, controller }) => {
|
|
443
|
+
const isCurrent = () => !controller.signal.aborted;
|
|
444
|
+
try {
|
|
445
|
+
const result = await latest.current.onUpload(upload.file, {
|
|
446
|
+
signal: controller.signal,
|
|
447
|
+
onProgress: ({ loaded, total }) => {
|
|
448
|
+
if (!total || !isCurrent()) return;
|
|
449
|
+
const progress = Math.min(100, Math.round(loaded / total * 100));
|
|
450
|
+
updateUploads((previous) => previous.map((item) => item.key === upload.key ? {
|
|
451
|
+
...item,
|
|
452
|
+
progress
|
|
453
|
+
} : item));
|
|
454
|
+
}
|
|
455
|
+
});
|
|
456
|
+
if (!isCurrent()) return false;
|
|
457
|
+
const stored = {
|
|
458
|
+
id: result.id,
|
|
459
|
+
name: upload.name,
|
|
460
|
+
size: upload.size
|
|
461
|
+
};
|
|
462
|
+
if (upload.type) stored.type = upload.type;
|
|
463
|
+
if (result.url) stored.url = result.url;
|
|
464
|
+
const isMultiple = latest.current.allowsMultiple;
|
|
465
|
+
flushSync(() => {
|
|
466
|
+
commit(isMultiple ? [...storedRef.current.filter((file) => file.id !== stored.id), stored] : [stored]);
|
|
467
|
+
setSessionFiles((previous) => ({
|
|
468
|
+
...isMultiple ? previous : {},
|
|
469
|
+
[stored.id]: {
|
|
470
|
+
key: upload.key,
|
|
471
|
+
file: upload.file
|
|
472
|
+
}
|
|
473
|
+
}));
|
|
474
|
+
endUpload(upload.key);
|
|
475
|
+
});
|
|
476
|
+
return true;
|
|
477
|
+
} catch (failure) {
|
|
478
|
+
if (!isCurrent()) return false;
|
|
479
|
+
endUpload(upload.key);
|
|
480
|
+
reportUploadError(failure);
|
|
481
|
+
return false;
|
|
482
|
+
}
|
|
483
|
+
}));
|
|
484
|
+
if (clearOnSuccess && succeeded.every(Boolean) && uploadsRef.current.length === 0) commit([]);
|
|
485
|
+
} catch (failure) {
|
|
486
|
+
reportUploadError(failure);
|
|
487
|
+
}
|
|
488
|
+
};
|
|
489
|
+
const handleSelect = (inputFiles) => {
|
|
490
|
+
if (inputFiles) handleUpload(Array.from(inputFiles));
|
|
491
|
+
};
|
|
492
|
+
const handleDrop = async (e) => {
|
|
493
|
+
const resets = resetCount.current;
|
|
494
|
+
if (!e.items) return;
|
|
495
|
+
setUploadError(void 0);
|
|
496
|
+
try {
|
|
497
|
+
const inputFiles = await Promise.all(e.items.flatMap((item) => item.kind === "file" ? [Promise.resolve().then(() => item.getFile())] : []));
|
|
498
|
+
if (resets !== resetCount.current) return;
|
|
499
|
+
await handleUpload(inputFiles);
|
|
500
|
+
} catch (failure) {
|
|
501
|
+
reportUploadError(failure);
|
|
502
|
+
}
|
|
503
|
+
};
|
|
504
|
+
const handleCancel = useCallback((item) => {
|
|
505
|
+
const controller = controllers.current.get(item.key);
|
|
506
|
+
if (item.status !== "uploading" || !controller) return;
|
|
507
|
+
controller.abort();
|
|
508
|
+
endUpload(item.key);
|
|
509
|
+
}, [endUpload]);
|
|
510
|
+
const handleRemove = useCallback((item) => {
|
|
511
|
+
if (item.status === "uploading") {
|
|
512
|
+
handleCancel(item);
|
|
513
|
+
return;
|
|
514
|
+
}
|
|
515
|
+
const removed = storedRef.current.find((file) => file.id === item.id);
|
|
516
|
+
if (!removed) return;
|
|
517
|
+
setUploadError(void 0);
|
|
518
|
+
try {
|
|
519
|
+
commit(storedRef.current.filter((file) => file.id !== removed.id));
|
|
520
|
+
Promise.resolve(latest.current.onRemove?.(removed)).catch(reportUploadError);
|
|
521
|
+
} catch (failure) {
|
|
522
|
+
reportUploadError(failure);
|
|
523
|
+
}
|
|
524
|
+
}, [
|
|
525
|
+
commit,
|
|
526
|
+
handleCancel,
|
|
527
|
+
reportUploadError
|
|
528
|
+
]);
|
|
529
|
+
const files = useMemo(() => {
|
|
530
|
+
const toItem = (file) => ({
|
|
531
|
+
status: "uploaded",
|
|
532
|
+
key: sessionFiles[file.id]?.key ?? file.id,
|
|
533
|
+
id: file.id,
|
|
534
|
+
name: file.name,
|
|
535
|
+
size: file.size,
|
|
536
|
+
type: file.type,
|
|
537
|
+
url: file.url,
|
|
538
|
+
file: sessionFiles[file.id]?.file
|
|
539
|
+
});
|
|
540
|
+
if (allowsMultiple) return [...storedFiles.map(toItem), ...uploads];
|
|
541
|
+
return uploads.length > 0 ? uploads.slice(-1) : storedFiles.slice(0, 1).map(toItem);
|
|
542
|
+
}, [
|
|
543
|
+
allowsMultiple,
|
|
544
|
+
sessionFiles,
|
|
545
|
+
storedFiles,
|
|
546
|
+
uploads
|
|
547
|
+
]);
|
|
548
|
+
return /* @__PURE__ */ jsxs(FormField, {
|
|
549
|
+
ref,
|
|
550
|
+
onBlurCapture: onBlur,
|
|
551
|
+
...formFieldProps,
|
|
552
|
+
labelProps,
|
|
553
|
+
className: clsx("w-full", className),
|
|
554
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
555
|
+
role: "group",
|
|
556
|
+
"aria-label": label,
|
|
557
|
+
"aria-describedby": [
|
|
558
|
+
rest["aria-describedby"],
|
|
559
|
+
helperTextId,
|
|
560
|
+
resolvedError ? resolvedErrorId : void 0
|
|
561
|
+
].filter(Boolean).join(" ") || void 0,
|
|
562
|
+
className: "flex w-full items-center justify-between gap-2",
|
|
563
|
+
children: /* @__PURE__ */ jsx($070c0dd15dc89b58$export$3c6489d84dc98b6, {
|
|
564
|
+
...rest,
|
|
565
|
+
"data-rac": "",
|
|
566
|
+
"data-disabled": isDisabled || void 0,
|
|
567
|
+
"data-is-disabled": isDisabled || void 0,
|
|
568
|
+
"data-invalid": !!resolvedError || void 0,
|
|
569
|
+
"data-multiple": allowsMultiple || void 0,
|
|
570
|
+
"data-has-files": files.length > 0 || void 0,
|
|
571
|
+
"data-filled": !allowsMultiple && files[0]?.status === "uploaded" || void 0,
|
|
572
|
+
isDisabled,
|
|
573
|
+
onDrop: handleDrop,
|
|
574
|
+
className: fileUploadDropZoneCva({
|
|
575
|
+
orientation,
|
|
576
|
+
isContainer: !!children,
|
|
577
|
+
className: "group/upload-drop-zone"
|
|
578
|
+
}),
|
|
579
|
+
children: children ? /* @__PURE__ */ jsxs(Fragment$1, { children: [children({
|
|
580
|
+
files,
|
|
581
|
+
onRemove: handleRemove,
|
|
582
|
+
onCancel: handleCancel
|
|
583
|
+
}), /* @__PURE__ */ jsx(FileUploadContentEmpty, {
|
|
584
|
+
actionStyle,
|
|
585
|
+
orientation,
|
|
586
|
+
hideButton: true,
|
|
587
|
+
isDisabled,
|
|
588
|
+
title: emptyText,
|
|
589
|
+
uploadText,
|
|
590
|
+
browseText,
|
|
591
|
+
browseButtonProps,
|
|
592
|
+
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"
|
|
593
|
+
})] }) : /* @__PURE__ */ jsx(FileUploadContent, {
|
|
594
|
+
...rest,
|
|
595
|
+
orientation,
|
|
596
|
+
actionStyle,
|
|
597
|
+
isDisabled,
|
|
598
|
+
browseText,
|
|
599
|
+
uploadText,
|
|
600
|
+
emptyText,
|
|
601
|
+
browseButtonProps,
|
|
602
|
+
cancelButtonProps,
|
|
603
|
+
files,
|
|
604
|
+
onSelect: handleSelect,
|
|
605
|
+
onCancel: handleCancel,
|
|
606
|
+
onRemove: handleRemove,
|
|
607
|
+
acceptedFileTypes,
|
|
608
|
+
allowsMultiple
|
|
609
|
+
})
|
|
610
|
+
})
|
|
611
|
+
}), !children && allowsMultiple && files.length > 0 && /* @__PURE__ */ jsx(FileCardList, {
|
|
612
|
+
actionStyle,
|
|
613
|
+
files,
|
|
614
|
+
isDisabled,
|
|
615
|
+
browseButtonProps,
|
|
616
|
+
cancelButtonProps,
|
|
617
|
+
onRemove: handleRemove,
|
|
618
|
+
onCancel: handleCancel
|
|
619
|
+
})]
|
|
620
|
+
});
|
|
621
|
+
};
|
|
622
|
+
const ControlledFileUpload = (props) => {
|
|
623
|
+
const { field, ref, ...innerProps } = props;
|
|
624
|
+
const { t } = useTranslation("ui");
|
|
625
|
+
const form = field.form;
|
|
626
|
+
const name = field.name;
|
|
627
|
+
const subscribeReset = useCallback((onReset) => subscribeFormReset(form, (refresh) => {
|
|
628
|
+
if (!refresh) onReset();
|
|
629
|
+
}), [form]);
|
|
630
|
+
const uploadInProgress = t(($) => $.ui.fileUpload.uploadInProgress);
|
|
631
|
+
const submissionAttempts = useStoreSelector(form.store, selectSubmissionAttempts);
|
|
632
|
+
const [uploadsStartedAt, setUploadsStartedAt] = useState();
|
|
633
|
+
const isUploading = useRef(false);
|
|
634
|
+
const validateUploads = useCallback(() => isUploading.current ? uploadInProgress : void 0, [uploadInProgress]);
|
|
635
|
+
const handleUploadingChange = useCallback((uploading) => {
|
|
636
|
+
isUploading.current = uploading;
|
|
637
|
+
setUploadsStartedAt(uploading ? form.state.submissionAttempts : void 0);
|
|
638
|
+
if (uploading || form.getFieldMeta(name)?.errorSourceMap?.onSubmit !== "field") return;
|
|
639
|
+
form.setFieldMeta(name, (meta) => ({
|
|
640
|
+
...meta,
|
|
641
|
+
errorMap: {
|
|
642
|
+
...meta.errorMap,
|
|
643
|
+
onSubmit: void 0
|
|
644
|
+
},
|
|
645
|
+
errorSourceMap: {
|
|
646
|
+
...meta.errorSourceMap,
|
|
647
|
+
onSubmit: void 0
|
|
648
|
+
}
|
|
649
|
+
}));
|
|
650
|
+
form.validateField(name, "change");
|
|
651
|
+
}, [form, name]);
|
|
652
|
+
const isWaitingForUploads = uploadsStartedAt !== void 0 && submissionAttempts > uploadsStartedAt;
|
|
653
|
+
return /* @__PURE__ */ jsx(FieldController, {
|
|
654
|
+
control: field.form,
|
|
655
|
+
name: field.name,
|
|
656
|
+
onValueChange: field.onValueChange,
|
|
657
|
+
onBlur: field.onBlur,
|
|
658
|
+
validateOnSubmit: uploadsStartedAt === void 0 ? void 0 : validateUploads,
|
|
659
|
+
render: ({ field, fieldState: { error } }) => /* @__PURE__ */ jsx(FileUploadBase, {
|
|
660
|
+
...innerProps,
|
|
661
|
+
subscribeReset,
|
|
662
|
+
onUploadingChange: handleUploadingChange,
|
|
663
|
+
ref: $a8ea2faf2ebe4d2f$re_export$mergeRefs(ref, field.ref),
|
|
664
|
+
onBlur: field.onBlur,
|
|
665
|
+
value: field.value ?? NO_FILES,
|
|
666
|
+
onChange: (files) => {
|
|
667
|
+
field.onChange(files);
|
|
668
|
+
field.onValueCommit();
|
|
669
|
+
},
|
|
670
|
+
isDisabled: field.disabled || props.isDisabled,
|
|
671
|
+
error: props.error ?? (isWaitingForUploads ? uploadInProgress : void 0),
|
|
672
|
+
fieldError: error?.message
|
|
673
|
+
})
|
|
674
|
+
});
|
|
675
|
+
};
|
|
676
|
+
const FileUploadComponent = (props) => props.field ? /* @__PURE__ */ jsx(ControlledFileUpload, { ...props }) : /* @__PURE__ */ jsx(FileUploadBase, { ...props });
|
|
677
|
+
const FileUpload = memo(FileUploadComponent);
|
|
678
|
+
//#endregion
|
|
679
|
+
export { FileUpload as t };
|