@povio/ui 5.0.0-rc.9 → 6.0.0-rc.2
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/MIGRATION.md +673 -0
- package/README.md +206 -55
- package/dist/{Accordion-BzwO4_ml.js → Accordion-DycXjzGK.js} +10 -10
- package/dist/{Alert-DfiJbKH0.d.ts → Alert-BpPHCE5-.d.ts} +3 -3
- package/dist/{AlertDialog-OWTbR4km.d.ts → AlertDialog-CDCbfARJ.d.ts} +3 -3
- package/dist/Autocomplete-BUslodfn.d.ts +23 -0
- package/dist/Autocomplete-DSwAc7jF.js +142 -0
- package/dist/Autocomplete.bound-Db5C6Jph.d.ts +9 -0
- package/dist/Autocomplete.bound-e5WbxlBm.js +28 -0
- package/dist/{Badge-CBNpj823.d.ts → Badge-Dp091PcC.d.ts} +2 -2
- package/dist/{BadgeButton-Ccgt3oGO.d.ts → BadgeButton-DZm_aw29.d.ts} +2 -2
- package/dist/{BottomSheet-DbQuzfAB.d.ts → BottomSheet-C-jdDmO7.d.ts} +1 -1
- package/dist/{BottomSheet-BXLE3161.js → BottomSheet-DB0Cdlgx.js} +10 -84
- package/dist/{BottomSheet.lazy-D9LCEo7s.d.ts → BottomSheet.lazy-C0_6p_UQ.d.ts} +1 -1
- package/dist/{Breadcrumbs-CUV6CU8Q.d.ts → Breadcrumbs-CuupIZuv.d.ts} +1 -1
- package/dist/{Breadcrumbs-FF8hMfXd.js → Breadcrumbs-V-Bea_bs.js} +16 -13
- package/dist/Button-BL5ils-5.d.ts +13 -0
- package/dist/{Button-D6KlWSFL.js → Button-C1YB5dOw.js} +3 -3
- package/dist/Button-DU1Q8GDB.js +16 -0
- package/dist/ButtonBase-BhlpPPDi.js +87 -0
- package/dist/ButtonBase-C_ODj77A.d.ts +32 -0
- package/dist/{ButtonContent-c7lJayVQ.js → ButtonContent-BBup-vN6.js} +4 -13
- package/dist/{Calendar-BTjajO6i.js → Calendar-ChmIflXX.js} +31 -31
- package/dist/{CheckContent-D7sZPmzx.js → CheckContent-DHKG_FY6.js} +1 -1
- package/dist/{Checkbox-DVTWaMKa.d.ts → Checkbox-BjZVQ-6_.d.ts} +9 -8
- package/dist/{Checkbox-CV1ILXXO.js → Checkbox-Bo03jrPX.js} +20 -37
- package/dist/Checkbox.bound-DN4OVaMs.js +33 -0
- package/dist/Checkbox.bound-DTO008Tl.d.ts +9 -0
- package/dist/CheckboxCheckmark-C4yFclkZ.js +44 -0
- package/dist/CheckboxGroup-B_rzZgta.d.ts +30 -0
- package/dist/CheckboxGroup-D3LxgocB.js +139 -0
- package/dist/CheckboxGroup.bound-8hjoP-xP.js +32 -0
- package/dist/CheckboxGroup.bound-CiA60XsD.d.ts +9 -0
- package/dist/ComboBox-DFlz6HJ8.js +212 -0
- package/dist/{DatePicker-8xSs_jNd.d.ts → DatePicker-B_caFHFY.d.ts} +21 -10
- package/dist/{DatePicker-DOLL7mkc.js → DatePicker-Bc_E4UZ1.js} +40 -50
- package/dist/DatePicker.bound-C5-DL4SJ.d.ts +9 -0
- package/dist/DatePicker.bound-CtBL5w-8.js +36 -0
- package/dist/{DatePickerInput-D81ZJ3fT.d.ts → DatePickerInput-8gKhZdGY.d.ts} +3 -3
- package/dist/{DatePickerInput-BLBcySA2.js → DatePickerInput-TND0rEMc.js} +68 -48
- package/dist/{DateRangePicker-BF-1CztH.js → DateRangePicker-BNMTOQ2N.js} +81 -70
- package/dist/{DateRangePicker-Bfq-yDm7.d.ts → DateRangePicker-CzWwO5bA.d.ts} +30 -10
- package/dist/DateRangePicker.bound-C4mHtr-b.d.ts +9 -0
- package/dist/DateRangePicker.bound-GeRw9Iuj.js +35 -0
- package/dist/{DateTimePicker-Cj0qvJUz.js → DateTimePicker-B3YjV4uj.js} +40 -44
- package/dist/{DateTimePicker-D4lHyf6P.d.ts → DateTimePicker-CzGdmamp.d.ts} +21 -11
- package/dist/DateTimePicker.bound-ByjHsAnf.js +32 -0
- package/dist/DateTimePicker.bound-DwClL-pe.d.ts +9 -0
- package/dist/Dialog-2XpWsphI.d.ts +21 -0
- package/dist/{Dialog-9manOgMA.js → Dialog-COvYzwNU.js} +11 -8
- package/dist/{Dialog-CKLkS00H.js → Dialog-lFYX-7Ax.js} +22 -27
- package/dist/{DropdownMenu-5jmtgLXd.js → DropdownMenu-DtZdv5mo.js} +7 -7
- package/dist/DropdownMenu-gKIXzj63.d.ts +25 -0
- package/dist/{DropdownMenuDesktop-Cl9gZVq0.js → DropdownMenuDesktop-BMkiHEuY.js} +4 -4
- package/dist/{FileInput-C4CE5kuP.d.ts → FileInput-0o8-IJUh.d.ts} +26 -22
- package/dist/{FileInput-Br5DQaGQ.js → FileInput-Bpm2HJSB.js} +34 -47
- package/dist/FileInput.bound-B6oGPCP8.js +30 -0
- package/dist/FileInput.bound-BEeceBBO.d.ts +8 -0
- package/dist/{FileTrigger-Cthk5_Wp.js → FileTrigger-DBX1Io6E.js} +36 -7
- package/dist/FileUpload--AQJW3vz.d.ts +11 -0
- package/dist/{FileUpload--7ub3EZO.js → FileUpload-G7tdtNKN.js} +276 -165
- package/dist/FileUpload.bound-DqqPejvc.js +30 -0
- package/dist/FileUpload.bound-i5zfLhoY.d.ts +16 -0
- package/dist/{FileUploadContainer-042ztsaL.d.ts → FileUploadContainer-D1eYflb2.d.ts} +1 -1
- package/dist/{Form-DlQcyN1f.js → Form-CqF1SaVw.js} +2 -2
- package/dist/{FormField-Byiehm9y.d.ts → FormField-BsR2Cjxm.d.ts} +4 -2
- package/dist/FormField-DyqEbqx3.js +119 -0
- package/dist/{FormFieldError-DeOHHLo2.js → FormFieldError-BaVgIKrv.js} +2 -13
- package/dist/FormFieldHeaderTooltip-Bxc4f9i4.js +47 -0
- package/dist/{Heading-nI1_VOaE.js → Heading-D4XFYv__.js} +2 -2
- package/dist/IconButton-DdvODpP7.d.ts +25 -0
- package/dist/{IconSlot-DSK7qNxc.js → IconSlot-Cuvpj1gd.js} +2 -2
- package/dist/{InlineTooltipWrapper-BpApaGXV.js → InlineTooltipWrapper-HDHIaQtS.js} +1 -1
- package/dist/{Input-BsbLZDtC.js → Input-BG0Xjw5X.js} +2 -2
- package/dist/Input-BdCci6BF.js +229 -0
- package/dist/{Input-DOanwj3l.d.ts → Input-Bu4G9gcn.d.ts} +13 -9
- package/dist/Input.bound-CnqI-L-b.js +31 -0
- package/dist/Input.bound-CxfKRXzI.d.ts +9 -0
- package/dist/{InputContent-CXuP1ghQ.d.ts → InputContent-BGTEvv6a.d.ts} +4 -4
- package/dist/{useFieldAccessibility-ScC6Mtd5.js → InputContent-Ca4oVqIe.js} +24 -37
- package/dist/{Label-B2-B-uFY.js → Label-BGvF9vWx.js} +2 -2
- package/dist/{Link-FupWOW1f.js → Link-Chux-Clm.js} +2 -2
- package/dist/{Link-Ow9H7kNv.d.ts → Link-D0Kk3F5w.d.ts} +3 -3
- package/dist/{ListBox-CL8Ar4Q_.js → ListBox-CoUk0kkt.js} +10 -11
- package/dist/{MenuItem-DHyqOqln.d.ts → MenuItem-Bo5a7_Nw.d.ts} +1 -1
- package/dist/{Modal-w60dVQcb.js → Modal-B4p1zFqi.js} +58 -20
- package/dist/NumberField-BLAwsjns.js +225 -0
- package/dist/{NumberField-Cb9Gf6QJ.d.ts → NumberField-DCMQZPY9.d.ts} +13 -9
- package/dist/NumberField.bound-DiDYEZM4.js +32 -0
- package/dist/NumberField.bound-fZLE6Odv.d.ts +9 -0
- package/dist/{NumberFormatter-CLDS_LRZ.js → NumberFormatter-DYarfm5F.js} +2 -36
- package/dist/{NumberRangeInput-BfbJQqzn.d.ts → NumberRangeInput-CtSYPK2e.d.ts} +13 -8
- package/dist/{NumberRangeInput-B8-LHfg3.js → NumberRangeInput-al32ZeSy.js} +23 -51
- package/dist/NumberRangeInput.bound-B0e7yUDI.js +32 -0
- package/dist/NumberRangeInput.bound-CxAk_1_K.d.ts +9 -0
- package/dist/{OverlayArrow-D8z7cCsw.js → OverlayArrow-DF0jMwul.js} +2 -2
- package/dist/{Pagination-CwQu5Py8.d.ts → Pagination-DikJEIWD.d.ts} +1 -1
- package/dist/{PaginationList-DMRUGtf8.d.ts → PaginationList-D7PVQ5WX.d.ts} +1 -1
- package/dist/PaginationList-vfqgyTIP.js +258 -0
- package/dist/PasswordInput-Dy5hMeFP.d.ts +11 -0
- package/dist/{PasswordInput-CLwFUgl0.d.ts → PasswordInput.bound-B5sHHU26.d.ts} +5 -6
- package/dist/PasswordInput.bound-Bj3WO1zC.js +23 -0
- package/dist/{Popover-BTHPteIh.d.ts → Popover-DxTsc2y6.d.ts} +2 -2
- package/dist/{Progress-CjWOR38H.d.ts → Progress-CtxPBAgr.d.ts} +4 -4
- package/dist/{Progress-B3mY9rIP.js → Progress-ZsKwo9ne.js} +3 -28
- package/dist/RadioGroup-BYS8ha2C.d.ts +26 -0
- package/dist/{RadioGroup-DOw3PRoX.js → RadioGroup-D0X47mm7.js} +13 -117
- package/dist/RadioGroup.bound-CibzUsQL.d.ts +9 -0
- package/dist/RadioGroup.bound-aK3GC6i7.js +32 -0
- package/dist/RichTextEditor-k9LvNCjg.d.ts +28 -0
- package/dist/{RichTextEditor-D4yN7Wj7.js → RichTextEditor-qoxzWBFP.js} +154 -85
- package/dist/{staticSelect.utils-uHa8f_c6.js → Select-BAlYMh4h.js} +218 -252
- package/dist/{SelectBase-Omiq2D3M.d.ts → Select-NNohxr1t.d.ts} +32 -11
- package/dist/Select.bound-CQPG2sWV.js +34 -0
- package/dist/Select.bound-Dh5kywfV.d.ts +17 -0
- package/dist/{SelectionIndicator-JblvLKCu.js → SelectionIndicator-B7C5Y0JM.js} +1 -1
- package/dist/{SharedElementTransition-Da1c_cOO.js → SharedElementTransition-DJ9CCbEa.js} +1 -1
- package/dist/{Slider-CzEmKYBF.js → Slider-DMrnZn3I.js} +16 -40
- package/dist/{Slider-EYlGCLWe.d.ts → Slider-zbLmrW6J.d.ts} +9 -8
- package/dist/Slider.bound-BaJHbE6d.d.ts +9 -0
- package/dist/Slider.bound-BoIYW8I5.js +31 -0
- package/dist/{Spinner-BeVTUzzx.js → Spinner-CFj5Iu77.js} +28 -40
- package/dist/{Spinner-DbXeDOa2.d.ts → Spinner-b365xHHG.d.ts} +5 -5
- package/dist/{SplitButton-D9ngY1rJ.d.ts → SplitButton-CzvD7LIK.d.ts} +3 -3
- package/dist/{Stepper-TATlHZhQ.d.ts → Stepper-Bk1JUf6K.d.ts} +18 -18
- package/dist/{Stepper-Cp5vbL5g.js → Stepper-DlyScdAM.js} +11 -10
- package/dist/{Switch-CqnGEdeD.js → Switch-Ck_zSDuw.js} +9 -58
- package/dist/Switch-uqTGk-H6.d.ts +24 -0
- package/dist/Switch.bound-Brw5UUA6.js +33 -0
- package/dist/Switch.bound-DWuDmr2C.d.ts +9 -0
- package/dist/Tag--FasSNEh.d.ts +44 -0
- package/dist/{Text-D2MPZ3sY.js → Text-D72yc4S6.js} +1 -1
- package/dist/{TextArea-D8WkKsGn.js → TextArea-33uOXvnc.js} +30 -33
- package/dist/{TextArea-l_keyLK7.d.ts → TextArea-t5IYaVds.d.ts} +11 -9
- package/dist/TextArea.bound-DPALjcvO.js +28 -0
- package/dist/TextArea.bound-DcflHR7X.d.ts +9 -0
- package/dist/TextArea.cva-Bb73hriz.js +5 -0
- package/dist/TimePicker-BK4AnHQa.d.ts +45 -0
- package/dist/{TimePicker-C4taAOFQ.js → TimePicker-CmBGkxDC.js} +59 -51
- package/dist/TimePicker.bound-3i1DJgrU.js +32 -0
- package/dist/TimePicker.bound-BMZWRtpJ.d.ts +9 -0
- package/dist/{Toast-ruXqONDA.d.ts → Toast-6rYk8AAG.d.ts} +1 -1
- package/dist/{ToastContainer-qgpzMFD4.js → ToastContainer-D1Jl3PPk.js} +3 -3
- package/dist/{ToggleButton-BW1ensey.js → ToggleButton-DUQ8nwKY.js} +5 -5
- package/dist/ToggleButton-DZ340rQr.d.ts +17 -0
- package/dist/{toggleGroup.types-Bp43zbSQ.d.ts → ToggleGroup-BTqYh6FH.d.ts} +16 -15
- package/dist/{ToggleGroup-DOk27fgI.js → ToggleGroup-cvzIyIhi.js} +136 -162
- package/dist/ToggleGroup.bound-BEtnF-L-.d.ts +9 -0
- package/dist/ToggleGroup.bound-DjwakG--.js +67 -0
- package/dist/{Tooltip-CpG1nz7Y.js → Tooltip-CqbyoJhl.js} +45 -10
- package/dist/Tooltip-DP5RDkXs.d.ts +16 -0
- package/dist/{TooltipWrapper-3jyN0Wss.js → TooltipWrapper-BrftXInI.js} +7 -7
- package/dist/{Typography-XljT9s02.d.ts → Typography-BD-MSuTp.d.ts} +1 -1
- package/dist/{Typography-LU4z2pR1.js → Typography-Ba5l4rmj.js} +1 -1
- package/dist/{accordion.cva-CL1bVscW.js → accordion.cva-C-gUiXk5.js} +16 -24
- package/dist/badgeButton.cva-C1BuYx1N.js +138 -0
- package/dist/{badgeButton.cva-B2bgCQP6.d.ts → badgeButton.cva-Cj5AWgfv.d.ts} +8 -8
- package/dist/{breadcrumbs.cva-7zzdDhVR.js → breadcrumbs.cva-DCAdmxWR.js} +8 -8
- package/dist/{button.cva-C7kEhgoA.d.ts → button.cva-YpNNY6C-.d.ts} +21 -16
- package/dist/button.cva-fkUW5b2d.js +267 -0
- package/dist/{buttonContent.cva-DPIlROA9.d.ts → buttonContent.cva-CxgT-rxJ.d.ts} +2 -2
- package/dist/{checkbox.cva-t1Ox50hy.d.ts → checkbox.cva-CZnnBl8g.d.ts} +6 -6
- package/dist/checkbox.cva-DCVi4-4z.js +128 -0
- package/dist/components/accordion.js +1 -1
- package/dist/components/alert-dialog.d.ts +1 -1
- package/dist/components/alert-dialog.js +102 -100
- package/dist/components/alert.d.ts +1 -1
- package/dist/components/alert.js +116 -1
- package/dist/components/autocomplete.d.ts +2 -2
- package/dist/components/autocomplete.js +1 -134
- package/dist/components/badge-button.d.ts +1 -1
- package/dist/components/badge-button.js +4 -4
- package/dist/components/badge.d.ts +1 -1
- package/dist/components/badge.js +8 -8
- package/dist/components/bottom-sheet-header.d.ts +16 -0
- package/dist/components/bottom-sheet-header.js +80 -0
- package/dist/components/bottom-sheet.d.ts +2 -2
- package/dist/components/bottom-sheet.js +2 -2
- package/dist/components/breadcrumb/react-aria.js +1 -1
- package/dist/components/breadcrumbs.d.ts +1 -1
- package/dist/components/breadcrumbs.js +1 -1
- package/dist/components/button-group.d.ts +12 -0
- package/dist/components/button-group.js +46 -0
- 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 -163
- package/dist/components/checkbox.d.ts +2 -2
- package/dist/components/checkbox.js +2 -2
- package/dist/components/combo-box/react-aria.js +1 -1
- package/dist/components/date-picker/react-aria.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/react-aria.js +1 -1
- package/dist/components/date-range-picker.d.ts +2 -2
- package/dist/components/date-range-picker.js +1 -1
- package/dist/components/date-time-picker.d.ts +2 -2
- package/dist/components/date-time-picker.js +1 -1
- package/dist/components/dialog-trigger/react-aria.js +1 -1
- package/dist/components/dialog.d.ts +1 -1
- package/dist/components/dialog.js +1 -1
- package/dist/components/drawer.js +4 -4
- package/dist/components/dropdown-menu.d.ts +2 -2
- package/dist/components/dropdown-menu.js +2 -2
- package/dist/components/file-input.d.ts +2 -2
- package/dist/components/file-input.js +1 -1
- package/dist/components/file-upload-container.d.ts +2 -2
- package/dist/components/file-upload-container.js +1 -1
- package/dist/components/file-upload.d.ts +3 -3
- package/dist/components/file-upload.js +1 -1
- package/dist/components/form-field.d.ts +1 -1
- package/dist/components/form-field.js +1 -1
- package/dist/components/icon-button.d.ts +1 -1
- package/dist/components/icon-button.js +17 -15
- package/dist/components/icon-slot.d.ts +1 -1
- package/dist/components/icon-slot.js +1 -1
- package/dist/components/input-frame.d.ts +93 -0
- package/dist/{useStaticInputHandoff-NeZVnci-.js → components/input-frame.js} +50 -99
- package/dist/components/input.d.ts +2 -2
- package/dist/components/input.js +1 -241
- package/dist/components/link.d.ts +1 -1
- package/dist/components/link.js +2 -2
- package/dist/components/menu-trigger/react-aria.js +1 -1
- package/dist/components/modal/react-aria.js +1 -1
- package/dist/components/modal-overlay/react-aria.js +1 -1
- package/dist/components/number-field.d.ts +2 -2
- package/dist/components/number-field.js +1 -245
- package/dist/components/number-range-input.d.ts +2 -2
- package/dist/components/number-range-input.js +1 -1
- package/dist/components/pagination-list.d.ts +1 -1
- package/dist/components/pagination-list.js +1 -1
- package/dist/components/pagination.d.ts +1 -1
- package/dist/components/pagination.js +14 -10
- package/dist/components/password-input.d.ts +2 -2
- package/dist/components/password-input.js +22 -1
- package/dist/components/popover/react-aria.js +1 -1
- package/dist/components/popover.d.ts +1 -1
- package/dist/components/popover.js +39 -31
- package/dist/components/progress.d.ts +1 -1
- 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/react-aria.js +1 -1
- package/dist/components/select.d.ts +2 -3
- package/dist/components/select.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 +1 -1
- package/dist/components/split-button.d.ts +1 -1
- package/dist/components/split-button.js +2 -2
- package/dist/components/stepper.d.ts +1 -1
- package/dist/components/stepper.js +1 -1
- package/dist/components/style-definitions.d.ts +3 -0
- package/dist/components/style-definitions.js +121 -0
- package/dist/components/submenu-trigger/react-aria.js +1 -1
- package/dist/components/switch.d.ts +2 -2
- package/dist/components/switch.js +1 -1
- package/dist/components/tag.d.ts +1 -1
- package/dist/components/tag.js +93 -1
- 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 +2 -2
- package/dist/components/toast.js +2 -2
- package/dist/components/toggle-button.d.ts +1 -1
- package/dist/components/toggle-button.js +17 -30
- package/dist/components/toggle-group.d.ts +2 -3
- package/dist/components/toggle-group.js +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/typography.js +1 -1
- package/dist/components/use-toast.d.ts +1 -1
- package/dist/components/use-toast.js +2 -2
- package/dist/config/component-configuration.d.ts +30 -0
- package/dist/config/component-configuration.js +69 -0
- package/dist/config/confirmation.d.ts +1 -1
- package/dist/config/confirmation.js +1 -1
- package/dist/config/link-context.d.ts +2 -2
- 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-overrides.d.ts +1 -1
- package/dist/{confirmation.context-BuzgCfYl.js → confirmation.context-BSn1s-ip.js} +1 -1
- package/dist/{confirmation.context-BOeEVczb.d.ts → confirmation.context-DdxzxDWB.d.ts} +1 -1
- package/dist/{datePickerInput.cva-Cd7UUN61.js → datePickerInput.cva--gCeAsRx.js} +1 -1
- package/dist/{datePickerValue.utils-DCgoSrP3.js → datePickerValue.utils-BxHR_BQZ.js} +21 -13
- package/dist/{dialog.cva-COhDZaVl.js → dialog.cva-DzJlaK5a.js} +6 -6
- package/dist/{dist-CAdwxJbe.js → dist-D35rjADF.js} +54 -1
- package/dist/{dom.utils-D1AopHx9.js → dom.utils-BbfrA6RP.js} +1 -1
- package/dist/dropdownMenu.cva-CS5Q2b_3.js +31 -0
- package/dist/{PasswordInput-DYwUZ4-k.js → eye-BA4nRlMX.js} +1 -22
- package/dist/{fileUpload.cva-ujmStxB1.js → fileUpload.cva-DVJcCCYz.js} +10 -10
- package/dist/{fileUpload.types-n5FxK_F-.d.ts → fileUpload.types-DKICER1J.d.ts} +17 -17
- package/dist/form.binding-B-2id68q.js +49 -0
- package/dist/form.types-C8P4sznq.d.ts +22 -0
- package/dist/formFieldError.cva-Cc-dELdU.js +14 -0
- package/dist/formFieldHelper.cva-5YaiUEcL.js +97 -0
- package/dist/hooks/use-async-list.d.ts +2 -0
- package/dist/hooks/use-async-list.js +2 -0
- package/dist/hooks/use-filters.js +1 -1
- package/dist/{i18n-CX1vFM9r.d.ts → i18n-2z5on9No.d.ts} +18 -0
- package/dist/{i18n-CX2EjhJI.js → i18n-BjNKHh_D.js} +20 -2
- package/dist/{iconSlot.cva-CnpFzAOR.d.ts → iconSlot.cva-BrT0X2qq.d.ts} +4 -3
- package/dist/icons.d.ts +1 -1
- package/dist/icons.js +1 -1
- package/dist/index.d.ts +95 -91
- package/dist/index.js +87 -85
- package/dist/input.cva-AHLI_M3K.js +185 -0
- package/dist/{input.cva-BsHgYa-L.d.ts → input.cva-CEFEpKml.d.ts} +10 -10
- package/dist/{intlStrings-chfsan9H.js → intlStrings-Cu1YN1tA.js} +35 -35
- package/dist/isEqual-LFw0W5rU.js +97 -0
- package/dist/{link.context-D5qyz9Rf.d.ts → link.context-pIX2TUSb.d.ts} +1 -1
- package/dist/link.cva-isgDrId6.js +12 -0
- package/dist/{numberStatic.utils-BX50PSee.js → numberStatic.utils-BIyZuILs.js} +5 -5
- package/dist/outline.clsx-DGGQQRkM.js +6 -0
- package/dist/{popover.cva-Bhud1wnp.js → popover.cva-Ciu9Ro5G.js} +1 -1
- package/dist/progress.cva-D0PKV_ET.js +28 -0
- package/dist/radio.cva-Dn2Auqxw.js +79 -0
- package/dist/{radio.cva-DN9VQ3Kb.d.ts → radio.cva-VUie6k1Y.d.ts} +4 -4
- package/dist/rich-text-editor.d.ts +2 -2
- package/dist/rich-text-editor.js +1 -1
- package/dist/{routing.utils-UTQonIhB.js → routing.utils-DfxEt0_Y.js} +5 -0
- package/dist/selectDesktop.cva-CGBkscBY.js +14 -0
- package/dist/selectItem.cva-Ch6oK4jP.js +27 -0
- package/dist/{staticDateTimeSegments-DtU63_dw.js → staticDateTimeSegments-CA_lwN-O.js} +60 -56
- package/dist/status.cva-CUpcOT4W.js +130 -0
- package/dist/{stepper.cva-CZ0Kj-s7.js → stepper.cva-CQGechUm.js} +22 -34
- package/dist/style-definitions-DzsmGccZ.d.ts +1028 -0
- package/dist/styles/editor.css +9 -9
- package/dist/styles/input.d.ts +1 -1
- package/dist/styles/outline.js +1 -1
- package/dist/switch.cva-C9bO_QI-.js +24 -0
- package/dist/switch.cva-x4SdjrQp.d.ts +16 -0
- package/dist/table.cva-BMIizuGy.js +111 -0
- package/dist/table.cva-HHTd92di.d.ts +84 -0
- package/dist/tag.cva-BVa0EWBU.js +24 -0
- package/dist/tanstack/autocomplete.d.ts +3 -2
- package/dist/tanstack/autocomplete.js +1 -1
- package/dist/tanstack/checkbox-group.d.ts +3 -2
- package/dist/tanstack/checkbox-group.js +1 -1
- package/dist/tanstack/checkbox.d.ts +3 -2
- package/dist/tanstack/checkbox.js +2 -2
- package/dist/tanstack/date-picker.d.ts +3 -2
- package/dist/tanstack/date-picker.js +1 -1
- package/dist/tanstack/date-range-picker.d.ts +3 -2
- package/dist/tanstack/date-range-picker.js +1 -1
- package/dist/tanstack/date-time-picker.d.ts +3 -2
- package/dist/tanstack/date-time-picker.js +1 -1
- package/dist/tanstack/file-input.d.ts +3 -2
- package/dist/tanstack/file-input.js +1 -1
- package/dist/tanstack/file-upload.d.ts +4 -3
- package/dist/tanstack/file-upload.js +1 -1
- package/dist/tanstack/form.d.ts +3 -3
- package/dist/tanstack/form.js +3 -3
- package/dist/tanstack/input.d.ts +3 -2
- package/dist/tanstack/input.js +1 -1
- package/dist/tanstack/number-field.d.ts +3 -2
- package/dist/tanstack/number-field.js +1 -1
- package/dist/tanstack/number-range-input.d.ts +3 -2
- package/dist/tanstack/number-range-input.js +1 -1
- package/dist/tanstack/password-input.d.ts +1 -1
- package/dist/tanstack/password-input.js +1 -1
- package/dist/tanstack/radio-group.d.ts +3 -2
- package/dist/tanstack/radio-group.js +1 -1
- package/dist/tanstack/rich-text-editor.d.ts +9 -2
- package/dist/tanstack/rich-text-editor.js +27 -1
- package/dist/tanstack/select.d.ts +3 -2
- package/dist/tanstack/select.js +1 -1
- package/dist/tanstack/slider.d.ts +3 -2
- package/dist/tanstack/slider.js +1 -1
- package/dist/tanstack/switch.d.ts +3 -2
- package/dist/tanstack/switch.js +1 -1
- package/dist/tanstack/table.d.ts +3 -2
- package/dist/tanstack/table.js +2 -3
- package/dist/tanstack/text-area.d.ts +3 -2
- package/dist/tanstack/text-area.js +1 -1
- package/dist/tanstack/time-picker.d.ts +3 -2
- package/dist/tanstack/time-picker.js +1 -1
- package/dist/tanstack/toggle-group.d.ts +3 -3
- package/dist/tanstack/toggle-group.js +1 -1
- package/dist/tanstack-CSiB125i.d.ts +469 -0
- package/dist/tanstack.d.ts +79 -78
- package/dist/tanstack.js +87 -83
- package/dist/{toast.cva-By5lvAfr.d.ts → toast.cva-B8i61tEN.d.ts} +10 -10
- package/dist/{toast.cva-C_L_RffH.js → toast.cva-BMOx7_9f.js} +21 -37
- package/dist/{toast.runtime-cxex9e4E.js → toast.runtime-D18gn2Ty.js} +1 -2
- package/dist/toggleGroup.cva-C9Y5-kpk.js +26 -0
- package/dist/{tooltip.cva-BIzlOXHH.js → tooltip.cva-Clfcn_r2.js} +10 -10
- package/dist/tw-ui-plugin.js +5 -1
- package/dist/typography.cva-CKCCpIMj.d.ts +36 -0
- package/dist/typography.cva-CXolEQdT.js +31 -0
- package/dist/{uiConfig.context-DeBX2beU.d.ts → uiConfig.context-B1SCCG5j.d.ts} +12 -20
- package/dist/{uiConfig.context-BS3r_kTS.js → uiConfig.context-dxsO9puE.js} +12 -118
- package/dist/{uiOverrides.context-DEp139He.d.ts → uiOverrides.context-Dmev7iRS.d.ts} +44 -6
- package/dist/useAsyncList-Cu-Y8If2.d.ts +9 -0
- package/dist/useAsyncList-yHz7twsj.js +445 -0
- package/dist/{useBreakpoint-DQoMN-BG.js → useBreakpoint-DOUmXVZ2.js} +5 -5
- package/dist/{useControlledState-CzXkZCX8.js → useControlledState-CuU1VIh1.js} +2 -2
- package/dist/useFieldAccessibility-eZIMECmG.js +19 -0
- package/dist/{useFilters-XNH27Md2.js → useFilters-HIngImwn.js} +1 -1
- package/dist/{form.binding-DVJ5F0JE.d.ts → useForm-I6z23FXf.d.ts} +15 -15
- package/dist/{form.binding-CG1RPv6o.js → useForm-eW4KpH1u.js} +79 -42
- package/dist/useFormAutosave-BBLm3Ujo.d.ts +34 -0
- package/dist/useFormAutosave-XEQqk1lK.js +216 -0
- package/dist/useStaticInputHandoff-DyYxfwv6.js +77 -0
- package/dist/useTableColumnConfig-DoTYVxqG.js +1349 -0
- package/dist/{useTableNav-Ckj5PBRk.d.ts → useTableNav-D2zCwy63.d.ts} +34 -96
- package/dist/{useToast-yreVCUer.d.ts → useToast-CA0BGCDK.d.ts} +1 -1
- package/dist/{utils-Czcqspm7.js → utils-BkLF-JA3.js} +1 -1
- package/package.json +66 -234
- package/.rulesync/rules/ui-buttons-and-content.md +0 -56
- package/.rulesync/rules/ui-inputs-and-forms.md +0 -62
- package/.rulesync/rules/ui-overlays-navigation-and-styling.md +0 -49
- package/.rulesync/rules/ui-overview.md +0 -33
- package/dist/Alert-CnvEb1D_.js +0 -244
- package/dist/AppCanvasPage--RG31Yyv.js +0 -2421
- package/dist/AppCanvasPage-BIFYeEeS.d.ts +0 -80
- package/dist/Autocomplete-BwNHp8fy.d.ts +0 -15
- package/dist/Button-C5rv4Cr2.js +0 -506
- package/dist/Button-D-4qb0IR.d.ts +0 -42
- package/dist/CheckboxCheckmark-CpC3wlMs.js +0 -178
- package/dist/CheckboxGroup-DGF12cmB.d.ts +0 -28
- package/dist/ComponentGallery-C6exitZN.js +0 -3513
- package/dist/Dialog-CW93T9X1.d.ts +0 -56
- package/dist/DropdownMenu-JNpYT4-3.d.ts +0 -62
- package/dist/FileUpload-CR7bZxV1.d.ts +0 -7
- package/dist/Form-DbEWnCKc.d.ts +0 -49
- package/dist/FormField-B99dLt8o.js +0 -212
- package/dist/FormFieldHeaderTooltip-BV2Ju4oB.js +0 -17
- package/dist/IconButton-D4thBurp.d.ts +0 -16
- package/dist/InlineIconButton-BeJCjl-q.d.ts +0 -15
- package/dist/InputItem-CIxbTxZu.js +0 -63
- package/dist/Inputs-DJSKiaWY.js +0 -17
- package/dist/Inputs-O84btFJL.d.ts +0 -13
- package/dist/PaginationList-DtvuP63b.js +0 -220
- package/dist/QuerySelect-BGxb6Y0K.d.ts +0 -24
- package/dist/RadioGroup-CZg2kIMk.d.ts +0 -24
- package/dist/RichTextEditor-YxuRUlI7.d.ts +0 -26
- package/dist/Select-UR0ec2Ux.js +0 -154
- package/dist/Select-pHbyJdZJ.d.ts +0 -15
- package/dist/Switch-s_EPn0Jz.d.ts +0 -22
- package/dist/Table-BN2_J_Ne.js +0 -636
- package/dist/Tag-AHfV_XSf.d.ts +0 -44
- package/dist/Tag-DPg5sL1Z.js +0 -146
- package/dist/TextButton-XUhV_1s0.d.ts +0 -15
- package/dist/TimePicker-B1POvGWs.d.ts +0 -33
- package/dist/Toast-DtG3pA61.js +0 -53
- package/dist/ToggleButton-7aP8Jb11.d.ts +0 -11
- package/dist/ToggleGroup-CRFDIPGZ.d.ts +0 -7
- package/dist/Tooltip-DHv6vAqW.d.ts +0 -57
- package/dist/UIConfigurator-BwLRfe-a.js +0 -6704
- package/dist/autocomplete-DeERHN8W.d.ts +0 -16
- package/dist/badgeButton.cva-CvN4CTx5.js +0 -300
- package/dist/checkbox-DxIPDTK5.d.ts +0 -9
- package/dist/checkbox-group-B3BOVshI.d.ts +0 -9
- package/dist/chevron-left-Dgo_b9wJ.js +0 -20
- package/dist/chevron-up-D_Gqpb5M.js +0 -20
- package/dist/components/inline-icon-button.d.ts +0 -2
- package/dist/components/inline-icon-button.js +0 -40
- package/dist/components/query-autocomplete.d.ts +0 -8
- package/dist/components/query-autocomplete.js +0 -134
- package/dist/components/query-select.d.ts +0 -2
- package/dist/components/query-select.js +0 -147
- package/dist/components/text-button.d.ts +0 -2
- package/dist/components/text-button.js +0 -35
- package/dist/config/app-canvas-tanstack.d.ts +0 -23
- package/dist/config/app-canvas-tanstack.js +0 -62
- package/dist/config/app-canvas.d.ts +0 -12
- package/dist/config/app-canvas.js +0 -2
- package/dist/config/ui-configurator-theme.d.ts +0 -2
- package/dist/config/ui-configurator-theme.js +0 -2
- package/dist/config/ui-configurator-vite.d.ts +0 -10
- package/dist/config/ui-configurator-vite.js +0 -174
- package/dist/config/ui-configurator.d.ts +0 -15
- package/dist/config/ui-configurator.js +0 -3
- package/dist/configuration.context-f_FSPWhQ.d.ts +0 -926
- package/dist/date-picker-DnxDmlOW.d.ts +0 -9
- package/dist/date-range-picker-DHDOSvHN.d.ts +0 -9
- package/dist/date-time-picker-UkTa0OJ8.d.ts +0 -9
- package/dist/date.transforms-DLg-eFcE.js +0 -15
- package/dist/dropdownMenu.cva-DvEmX0bs.js +0 -34
- package/dist/dynamicInputs-ByVMnx4Z.d.ts +0 -772
- package/dist/dynamicInputs-CRMWIpHA.js +0 -194
- package/dist/dynamicInputs-m_DQu5q0.js +0 -214
- package/dist/fieldAdapter-C4sDFC8f.d.ts +0 -9
- package/dist/fieldAdapter-DjYls12j.js +0 -63
- package/dist/file-input-DkbkdI7l.d.ts +0 -9
- package/dist/file-upload-CTsPhxJk.d.ts +0 -10
- package/dist/form.types-CecYaerF.d.ts +0 -13
- package/dist/form.types-ZNGbcqJS.d.ts +0 -13
- package/dist/info-iUmX3uDk.js +0 -32
- package/dist/input-CdQNCPgH.d.ts +0 -8
- package/dist/input.cva-DJA8ovm_.js +0 -208
- package/dist/link.cva-DMTHZiJG.js +0 -12
- package/dist/number-field-CUDbenNV.d.ts +0 -8
- package/dist/number-range-input-DZGrcvjL.d.ts +0 -8
- package/dist/outline.clsx-50W_vNDl.js +0 -6
- package/dist/password-input-fYN20cQO.d.ts +0 -8
- package/dist/query-autocomplete-CfuQeiYG.d.ts +0 -14
- package/dist/query-select-CuT_sE6a.d.ts +0 -15
- package/dist/queryAutocomplete.types-tl3r6iaY.d.ts +0 -27
- package/dist/radio-group-B3ccPf0p.d.ts +0 -9
- package/dist/rhf/autocomplete.d.ts +0 -3
- package/dist/rhf/autocomplete.js +0 -8
- package/dist/rhf/checkbox-group.d.ts +0 -3
- package/dist/rhf/checkbox-group.js +0 -8
- package/dist/rhf/checkbox.d.ts +0 -3
- package/dist/rhf/checkbox.js +0 -8
- package/dist/rhf/date-picker.d.ts +0 -3
- package/dist/rhf/date-picker.js +0 -9
- package/dist/rhf/date-range-picker.d.ts +0 -3
- package/dist/rhf/date-range-picker.js +0 -9
- package/dist/rhf/date-time-picker.d.ts +0 -3
- package/dist/rhf/date-time-picker.js +0 -9
- package/dist/rhf/file-input.d.ts +0 -3
- package/dist/rhf/file-input.js +0 -6
- package/dist/rhf/file-upload.d.ts +0 -3
- package/dist/rhf/file-upload.js +0 -6
- package/dist/rhf/input.d.ts +0 -3
- package/dist/rhf/input.js +0 -6
- package/dist/rhf/inputs.d.ts +0 -4
- package/dist/rhf/inputs.js +0 -2
- package/dist/rhf/number-field.d.ts +0 -3
- package/dist/rhf/number-field.js +0 -6
- package/dist/rhf/number-range-input.d.ts +0 -3
- package/dist/rhf/number-range-input.js +0 -6
- package/dist/rhf/password-input.d.ts +0 -3
- package/dist/rhf/password-input.js +0 -6
- package/dist/rhf/query-autocomplete.d.ts +0 -2
- package/dist/rhf/query-autocomplete.js +0 -8
- package/dist/rhf/query-select.d.ts +0 -2
- package/dist/rhf/query-select.js +0 -8
- package/dist/rhf/radio-group.d.ts +0 -3
- package/dist/rhf/radio-group.js +0 -8
- package/dist/rhf/rich-text-editor.d.ts +0 -3
- package/dist/rhf/rich-text-editor.js +0 -6
- package/dist/rhf/select.d.ts +0 -3
- package/dist/rhf/select.js +0 -8
- package/dist/rhf/slider.d.ts +0 -3
- package/dist/rhf/slider.js +0 -6
- package/dist/rhf/switch.d.ts +0 -3
- package/dist/rhf/switch.js +0 -8
- package/dist/rhf/text-area.d.ts +0 -3
- package/dist/rhf/text-area.js +0 -6
- package/dist/rhf/time-picker.d.ts +0 -3
- package/dist/rhf/time-picker.js +0 -9
- package/dist/rhf/toggle-group.d.ts +0 -3
- package/dist/rhf/toggle-group.js +0 -6
- package/dist/rhf-t348TCCL.js +0 -256
- package/dist/rhf.d.ts +0 -106
- package/dist/rhf.js +0 -112
- package/dist/rich-text-editor-B-Onl7T8.d.ts +0 -8
- package/dist/select-B4a52eWW.d.ts +0 -16
- package/dist/selectDesktop.cva-CHAMxhfO.js +0 -69
- package/dist/slider-dNj9jruO.d.ts +0 -8
- package/dist/style-merge.util-zLimKwt6.d.ts +0 -40
- package/dist/styles/app-canvas.css +0 -740
- package/dist/styles/color-utilities.css +0 -20
- package/dist/styles/configurator.css +0 -3280
- package/dist/switch-C--iWnY8.d.ts +0 -9
- package/dist/switch.cva-CWNzmdRc.d.ts +0 -16
- package/dist/table.cva-D5oQ-QvA.js +0 -101
- package/dist/tanstack/inputs.d.ts +0 -5
- package/dist/tanstack/inputs.js +0 -3
- package/dist/tanstack/query-autocomplete.d.ts +0 -2
- package/dist/tanstack/query-autocomplete.js +0 -2
- package/dist/tanstack/query-select.d.ts +0 -2
- package/dist/tanstack/query-select.js +0 -2
- package/dist/text-area-DQAtpOQp.d.ts +0 -8
- package/dist/theme-model-DtYPxNvH.js +0 -406
- package/dist/theme-model-T1zIdBg8.d.ts +0 -12
- package/dist/time-picker-DoGfbil6.d.ts +0 -9
- package/dist/toggle-group-C1nMDOwz.d.ts +0 -9
- package/dist/toggleGroup.cva-MbpaEBg1.js +0 -35
- package/dist/typography.cva-D1JOEYl-.d.ts +0 -36
- package/dist/typography.cva-iD15k56p.js +0 -51
- package/dist/underline-66hmELxa.js +0 -81
- package/dist/upload-CXU83BJ4.js +0 -30
- package/dist/useFormAutosave-DfuP7drj.js +0 -198
- package/dist/useQueryAutocomplete-CraXvRm_.js +0 -152
- package/dist/useTableColumnConfig-Di0_w80v.js +0 -892
- package/dist/zod.utils-DrrPDT9v.js +0 -24
- package/rulesync.jsonc +0 -11
- package/scripts/generate-rules.mjs +0 -34
- package/src/configurator/README.md +0 -77
- package/dist/{import-BE0r63d8.js → import-D_3dPATF.js} +2 -2
- /package/dist/{queries.utils-CmbhAoHU.js → tanstack-CmbhAoHU.js} +0 -0
|
@@ -1,8 +1,67 @@
|
|
|
1
|
+
import { t as logger } from "./logger-CqZjM-sn.js";
|
|
2
|
+
import { n as ObjectUtils, t as isEqual } from "./isEqual-LFw0W5rU.js";
|
|
1
3
|
import { useEffect, useLayoutEffect, useMemo, useRef } from "react";
|
|
2
4
|
import { c } from "react/compiler-runtime";
|
|
3
|
-
import {
|
|
4
|
-
import { useForm, useStore } from "@tanstack/react-form";
|
|
5
|
+
import { getBy, setBy, useForm, useStore } from "@tanstack/react-form";
|
|
5
6
|
import { Store } from "@tanstack/store";
|
|
7
|
+
//#region src/hooks/autosaveFields.ts
|
|
8
|
+
/** Raw fields edited since a submitted snapshot. Arrays and dates are replaced whole. */
|
|
9
|
+
function getChangedAutosaveFields(current, submitted, path = "") {
|
|
10
|
+
if (isEqual(current, submitted)) return [];
|
|
11
|
+
if (!ObjectUtils.isObject(current) || Array.isArray(current) || ObjectUtils.isDate(current) || ObjectUtils.isRegExp(current) || ObjectUtils.isEmpty(current)) return [[path, current]];
|
|
12
|
+
const values = current;
|
|
13
|
+
const previous = ObjectUtils.isObject(submitted) ? submitted : {};
|
|
14
|
+
return [.../* @__PURE__ */ new Set([...Object.keys(values), ...Object.keys(previous)])].flatMap((key) => getChangedAutosaveFields(values[key], previous[key], path ? `${path}.${key}` : key));
|
|
15
|
+
}
|
|
16
|
+
/** Select raw field paths included by a parsed patch, stopping at atomic raw fields. */
|
|
17
|
+
function getSubmittedAutosaveFields(patch, raw, path = "") {
|
|
18
|
+
if (!ObjectUtils.isObject(raw) || Array.isArray(raw) || ObjectUtils.isDate(raw) || ObjectUtils.isRegExp(raw) || !ObjectUtils.isObject(patch) || Array.isArray(patch)) return [[path, raw]];
|
|
19
|
+
return Object.entries(patch).flatMap(([key, value]) => getSubmittedAutosaveFields(value, raw[key], path ? `${path}.${key}` : key));
|
|
20
|
+
}
|
|
21
|
+
/** Project raw changes into parsed values, retaining explicit undefined clears. */
|
|
22
|
+
function getAutosavePatch(parsed, changes) {
|
|
23
|
+
let patch = {};
|
|
24
|
+
for (const [path] of changes) {
|
|
25
|
+
if (!path) return parsed;
|
|
26
|
+
patch = setBy(patch, path, getBy(parsed, path));
|
|
27
|
+
}
|
|
28
|
+
return patch;
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/hooks/formReset.ts
|
|
32
|
+
const listeners = /* @__PURE__ */ new WeakMap();
|
|
33
|
+
const refreshing = /* @__PURE__ */ new WeakSet();
|
|
34
|
+
const versions = /* @__PURE__ */ new WeakMap();
|
|
35
|
+
function getFormResetVersion(form) {
|
|
36
|
+
return versions.get(form) ?? 0;
|
|
37
|
+
}
|
|
38
|
+
function subscribeFormReset(form, listener) {
|
|
39
|
+
let callbacks = listeners.get(form);
|
|
40
|
+
if (!callbacks) {
|
|
41
|
+
callbacks = /* @__PURE__ */ new Set();
|
|
42
|
+
listeners.set(form, callbacks);
|
|
43
|
+
}
|
|
44
|
+
callbacks.add(listener);
|
|
45
|
+
return () => callbacks.delete(listener);
|
|
46
|
+
}
|
|
47
|
+
function notifyFormReset(form) {
|
|
48
|
+
if (refreshing.has(form)) return;
|
|
49
|
+
versions.set(form, getFormResetVersion(form) + 1);
|
|
50
|
+
listeners.get(form)?.forEach((listener) => listener());
|
|
51
|
+
}
|
|
52
|
+
function refreshAutosaveForm(form, baseline, refresh, acknowledged = []) {
|
|
53
|
+
refreshing.add(form);
|
|
54
|
+
try {
|
|
55
|
+
refresh();
|
|
56
|
+
} finally {
|
|
57
|
+
refreshing.delete(form);
|
|
58
|
+
}
|
|
59
|
+
listeners.get(form)?.forEach((listener) => listener({
|
|
60
|
+
baseline,
|
|
61
|
+
acknowledged
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
6
65
|
//#region src/hooks/useForm.ts
|
|
7
66
|
const disabledStores = /* @__PURE__ */ new WeakMap();
|
|
8
67
|
function useForm$1({ defaultValues, disabled = false, mode = "onSubmit", onSubmitAsync, zodSchema } = {}) {
|
|
@@ -82,6 +141,7 @@ function useForm$1({ defaultValues, disabled = false, mode = "onSubmit", onSubmi
|
|
|
82
141
|
touchedFieldsRef.current.clear();
|
|
83
142
|
if (args[0] !== void 0 && !args[1]?.keepDefaultValues) defaultValuesRef.current = args[0];
|
|
84
143
|
originalReset(...args);
|
|
144
|
+
notifyFormReset(uiForm);
|
|
85
145
|
};
|
|
86
146
|
uiForm.subscribeBlur = (listener_0) => {
|
|
87
147
|
blurListenersRef.current.add(listener_0);
|
|
@@ -95,7 +155,22 @@ function useForm$1({ defaultValues, disabled = false, mode = "onSubmit", onSubmi
|
|
|
95
155
|
await originalHandleSubmit();
|
|
96
156
|
};
|
|
97
157
|
useEffect(() => {
|
|
98
|
-
|
|
158
|
+
let active = true;
|
|
159
|
+
const revision = getFormResetVersion(form);
|
|
160
|
+
const valuesAtLoad = structuredClone(form.state.values);
|
|
161
|
+
if (typeof initialDefaultValues === "function") initialDefaultValues().then((values_0) => {
|
|
162
|
+
if (!active || revision !== getFormResetVersion(form)) return;
|
|
163
|
+
const edits = getChangedAutosaveFields(form.state.values, valuesAtLoad);
|
|
164
|
+
form.reset(values_0);
|
|
165
|
+
for (const [path, value_3] of edits) {
|
|
166
|
+
if (!path) continue;
|
|
167
|
+
const name_1 = path;
|
|
168
|
+
form.setFieldValue(name_1, value_3);
|
|
169
|
+
}
|
|
170
|
+
}).catch((error) => logger.warn("Unable to load form defaults", error));
|
|
171
|
+
return () => {
|
|
172
|
+
active = false;
|
|
173
|
+
};
|
|
99
174
|
}, [form, initialDefaultValues]);
|
|
100
175
|
useLayoutEffect(() => {
|
|
101
176
|
if (disabledStore.state !== disabled) disabledStore.setState(() => disabled);
|
|
@@ -139,42 +214,4 @@ const getSchemaAtPath = (rootSchema, path) => {
|
|
|
139
214
|
const parsePath = (path) => path.replaceAll("[", ".").replaceAll("]", "").split(".").filter(Boolean).map((segment) => /^\d+$/.test(segment) ? Number(segment) : segment);
|
|
140
215
|
const pathToString = (path) => path.reduce((result, segment) => typeof segment === "number" ? `${result}[${segment}]` : result ? `${result}.${String(segment)}` : String(segment), "");
|
|
141
216
|
//#endregion
|
|
142
|
-
|
|
143
|
-
const getFieldError = (errors) => errors.flatMap((error) => {
|
|
144
|
-
if (typeof error === "string") return [error];
|
|
145
|
-
if (error && typeof error === "object" && "message" in error) return [String(error.message)];
|
|
146
|
-
return [];
|
|
147
|
-
}).at(0);
|
|
148
|
-
//#endregion
|
|
149
|
-
//#region src/components/inputs/shared/form.binding.tsx
|
|
150
|
-
function FieldController({ control: form, name, render }) {
|
|
151
|
-
const isFormDisabled = useFormDisabled(form);
|
|
152
|
-
const submissionAttempts = useFormState(form, (state) => state.submissionAttempts);
|
|
153
|
-
return /* @__PURE__ */ jsx(form.Field, {
|
|
154
|
-
name,
|
|
155
|
-
validators: form.getFieldValidators(name),
|
|
156
|
-
children: (field) => {
|
|
157
|
-
const validators = form.getFieldValidators(name);
|
|
158
|
-
const validationError = submissionAttempts > 0 ? getFieldError(field.state.meta.errors) : validators?.onChange && field.state.meta.isDirty ? validators.onChange({ value: field.state.value }) : validators?.onBlur && field.state.meta.isTouched ? validators.onBlur({ value: field.state.value }) : void 0;
|
|
159
|
-
return render({
|
|
160
|
-
field: {
|
|
161
|
-
disabled: isFormDisabled,
|
|
162
|
-
name: field.name,
|
|
163
|
-
onBlur: () => {
|
|
164
|
-
field.handleBlur();
|
|
165
|
-
form.notifyBlur(name);
|
|
166
|
-
},
|
|
167
|
-
onChange: field.handleChange,
|
|
168
|
-
ref: () => void 0,
|
|
169
|
-
value: field.state.value
|
|
170
|
-
},
|
|
171
|
-
fieldState: {
|
|
172
|
-
error: validationError ? { message: validationError } : void 0,
|
|
173
|
-
isDirty: field.state.meta.isDirty
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
//#endregion
|
|
180
|
-
export { useFormValue as i, useForm$1 as n, useFormState as r, FieldController as t };
|
|
217
|
+
export { getFormResetVersion as a, getAutosavePatch as c, useFormValue as i, getChangedAutosaveFields as l, useFormDisabled as n, refreshAutosaveForm as o, useFormState as r, subscribeFormReset as s, useForm$1 as t, getSubmittedAutosaveFields as u };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { a as UIForm, o as UseFormProps } from "./useForm-I6z23FXf.js";
|
|
2
|
+
import { DependencyList } from "react";
|
|
3
|
+
//#region src/hooks/useAutosave.d.ts
|
|
4
|
+
type MissingOutputKeys<TInput, TOutput> = TInput extends Date | RegExp | readonly unknown[] ? never : TInput extends object ? TOutput extends object ? { [K in keyof TInput]-?: K extends keyof TOutput ? MissingOutputKeys<NonNullable<TInput[K]>, NonNullable<TOutput[K]>> : K; }[keyof TInput] : keyof TInput : never;
|
|
5
|
+
/** Changed object paths are recursive patches; arrays, dates and regular expressions are replaced whole. */
|
|
6
|
+
type AutosavePatch<T> = T extends Date | RegExp | readonly unknown[] ? T : T extends object ? { [K in keyof T]?: AutosavePatch<T[K]>; } : T;
|
|
7
|
+
type AutosaveHandler<TInput, TOutput, TResponse> = [TOutput] extends [object] ? [MissingOutputKeys<TInput, TOutput>] extends [never] ? (data: AutosavePatch<TOutput>) => Promise<TResponse> : never : never;
|
|
8
|
+
interface UseAutosaveProps<TFieldValues extends Record<string, unknown>, TTransformedValues = TFieldValues, TResponse = unknown> {
|
|
9
|
+
form: UIForm<TFieldValues, TTransformedValues>;
|
|
10
|
+
delay?: number;
|
|
11
|
+
enabled?: boolean;
|
|
12
|
+
trigger?: "change" | "blur";
|
|
13
|
+
/** Parsed output must remain an object preserving every raw field path; optional output fields are supported. */
|
|
14
|
+
onSave: AutosaveHandler<TFieldValues, TTransformedValues, TResponse>;
|
|
15
|
+
onSaveSuccess?: () => void;
|
|
16
|
+
}
|
|
17
|
+
/** Autosaves changed fields only. Schemas must preserve raw field paths in their object output. */
|
|
18
|
+
declare function useAutosave<TFieldValues extends Record<string, unknown>, TTransformedValues = TFieldValues, TResponse = unknown>({ form, delay, enabled, trigger, onSave, onSaveSuccess }: UseAutosaveProps<TFieldValues, TTransformedValues, TResponse>): void;
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/hooks/useFormAutosave.d.ts
|
|
21
|
+
type UseFormAutosaveProps<TFieldValues extends Record<string, unknown> = Record<string, unknown>, TTransformedValues = TFieldValues, TResponse = unknown> = Omit<UseFormProps<TFieldValues, TTransformedValues>, "defaultValues"> & {
|
|
22
|
+
autosaveDelay?: UseAutosaveProps<TFieldValues, TTransformedValues, TResponse>["delay"];
|
|
23
|
+
enableAutosave?: UseAutosaveProps<TFieldValues, TTransformedValues, TResponse>["enabled"];
|
|
24
|
+
autosaveOn?: UseAutosaveProps<TFieldValues, TTransformedValues, TResponse>["trigger"];
|
|
25
|
+
normalizeAutosaveData?: (data: AutosavePatch<NoInfer<TTransformedValues>>) => AutosavePatch<NoInfer<TTransformedValues>> | undefined;
|
|
26
|
+
onAutosave: UseAutosaveProps<TFieldValues, TTransformedValues, TResponse>["onSave"];
|
|
27
|
+
getResetValues: () => UseFormProps<TFieldValues, TTransformedValues>["defaultValues"];
|
|
28
|
+
resetDeps: DependencyList;
|
|
29
|
+
resetTimeout?: number;
|
|
30
|
+
};
|
|
31
|
+
/** Autosave schemas must produce objects preserving every raw field path, including optional fields. */
|
|
32
|
+
declare function useFormAutosave<TFieldValues extends Record<string, unknown> = Record<string, unknown>, TTransformedValues = TFieldValues, TResponse = unknown>({ autosaveDelay, enableAutosave, autosaveOn, normalizeAutosaveData, onAutosave, getResetValues, resetDeps, resetTimeout, ...props }: UseFormAutosaveProps<TFieldValues, TTransformedValues, TResponse>): UIForm<TFieldValues, TTransformedValues>;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { UseAutosaveProps as a, AutosavePatch as i, useFormAutosave as n, useAutosave as o, AutosaveHandler as r, UseFormAutosaveProps as t };
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { t as logger } from "./logger-CqZjM-sn.js";
|
|
2
|
+
import { n as ObjectUtils, t as isEqual } from "./isEqual-LFw0W5rU.js";
|
|
3
|
+
import { a as getFormResetVersion, c as getAutosavePatch, l as getChangedAutosaveFields, o as refreshAutosaveForm, s as subscribeFormReset, t as useForm$1, u as getSubmittedAutosaveFields } from "./useForm-eW4KpH1u.js";
|
|
4
|
+
import { useCallback, useEffect, useRef } from "react";
|
|
5
|
+
import { getBy, setBy } from "@tanstack/react-form";
|
|
6
|
+
//#region src/hooks/useAutosave.ts
|
|
7
|
+
const snapshot = (value) => structuredClone(value);
|
|
8
|
+
/** Autosaves changed fields only. Schemas must preserve raw field paths in their object output. */
|
|
9
|
+
function useAutosave({ form, delay = 500, enabled = true, trigger = "change", onSave, onSaveSuccess }) {
|
|
10
|
+
const timeoutRef = useRef(void 0);
|
|
11
|
+
const savedSnapshotRef = useRef(snapshot(form.state.values));
|
|
12
|
+
const saveQueueRef = useRef(Promise.resolve());
|
|
13
|
+
const acknowledgedFieldsRef = useRef(/* @__PURE__ */ new Map());
|
|
14
|
+
const resetRevisionRef = useRef(getFormResetVersion(form));
|
|
15
|
+
const latestSaveRef = useRef({
|
|
16
|
+
onSave,
|
|
17
|
+
onSaveSuccess
|
|
18
|
+
});
|
|
19
|
+
latestSaveRef.current = {
|
|
20
|
+
onSave,
|
|
21
|
+
onSaveSuccess
|
|
22
|
+
};
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
let active = true;
|
|
25
|
+
const clearPending = () => {
|
|
26
|
+
if (timeoutRef.current) {
|
|
27
|
+
clearTimeout(timeoutRef.current);
|
|
28
|
+
timeoutRef.current = void 0;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const queueSave = () => {
|
|
32
|
+
if (!enabled) return;
|
|
33
|
+
clearPending();
|
|
34
|
+
const revision = resetRevisionRef.current;
|
|
35
|
+
timeoutRef.current = setTimeout(() => {
|
|
36
|
+
saveQueueRef.current = saveQueueRef.current.then(async () => {
|
|
37
|
+
if (!active || revision !== resetRevisionRef.current) return;
|
|
38
|
+
const valuesAtSaveTime = snapshot(form.state.values);
|
|
39
|
+
const previousSavedValues = savedSnapshotRef.current;
|
|
40
|
+
const changedFields = getChangedAutosaveFields(valuesAtSaveTime, previousSavedValues);
|
|
41
|
+
if (changedFields.length === 0) return;
|
|
42
|
+
let transformedValues;
|
|
43
|
+
try {
|
|
44
|
+
transformedValues = form.parseValues(valuesAtSaveTime);
|
|
45
|
+
} catch {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const payload = getAutosavePatch(transformedValues, changedFields);
|
|
49
|
+
if (ObjectUtils.isEmpty(payload)) return;
|
|
50
|
+
acknowledgedFieldsRef.current.clear();
|
|
51
|
+
try {
|
|
52
|
+
await latestSaveRef.current.onSave(payload);
|
|
53
|
+
if (!active || revision !== resetRevisionRef.current) return;
|
|
54
|
+
for (const [path, value] of getChangedAutosaveFields(valuesAtSaveTime, previousSavedValues)) {
|
|
55
|
+
if (acknowledgedFieldsRef.current.has(path) && isEqual(acknowledgedFieldsRef.current.get(path), value)) continue;
|
|
56
|
+
savedSnapshotRef.current = setBy(savedSnapshotRef.current, path, value);
|
|
57
|
+
}
|
|
58
|
+
for (const name of Object.keys(form.state.fieldMeta)) {
|
|
59
|
+
const submittedValue = getBy(valuesAtSaveTime, name);
|
|
60
|
+
if (!isEqual(getBy(previousSavedValues, name), submittedValue) && isEqual(form.getFieldValue(name), submittedValue)) form.setFieldMeta(name, (meta) => ({
|
|
61
|
+
...meta,
|
|
62
|
+
isDirty: false
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
latestSaveRef.current.onSaveSuccess?.();
|
|
66
|
+
} catch {}
|
|
67
|
+
});
|
|
68
|
+
}, delay);
|
|
69
|
+
};
|
|
70
|
+
const unsubscribeStore = trigger === "change" ? form.store.subscribe(() => {
|
|
71
|
+
if (!isEqual(form.state.values, savedSnapshotRef.current)) queueSave();
|
|
72
|
+
}) : void 0;
|
|
73
|
+
const unsubscribeBlur = trigger === "blur" ? form.subscribeBlur(queueSave) : void 0;
|
|
74
|
+
const syncReset = (refresh) => {
|
|
75
|
+
if (refresh) {
|
|
76
|
+
for (const [path_0, value_0] of refresh.acknowledged) acknowledgedFieldsRef.current.set(path_0, value_0);
|
|
77
|
+
savedSnapshotRef.current = snapshot(refresh.baseline);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
resetRevisionRef.current = getFormResetVersion(form);
|
|
81
|
+
acknowledgedFieldsRef.current.clear();
|
|
82
|
+
clearPending();
|
|
83
|
+
savedSnapshotRef.current = snapshot(form.state.values);
|
|
84
|
+
};
|
|
85
|
+
if (resetRevisionRef.current !== getFormResetVersion(form)) syncReset();
|
|
86
|
+
const unsubscribeReset = subscribeFormReset(form, syncReset);
|
|
87
|
+
return () => {
|
|
88
|
+
active = false;
|
|
89
|
+
clearPending();
|
|
90
|
+
unsubscribeStore?.unsubscribe();
|
|
91
|
+
unsubscribeBlur?.();
|
|
92
|
+
unsubscribeReset();
|
|
93
|
+
};
|
|
94
|
+
}, [
|
|
95
|
+
delay,
|
|
96
|
+
enabled,
|
|
97
|
+
form,
|
|
98
|
+
trigger
|
|
99
|
+
]);
|
|
100
|
+
}
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/hooks/useFormAutosave.ts
|
|
103
|
+
const getResetTimeoutErrorMessage = (resetTimeout) => `Form Reset Timeout (${resetTimeout}ms) - Action Required
|
|
104
|
+
Problem: Form values weren't reset after submission.
|
|
105
|
+
|
|
106
|
+
Likely causes:
|
|
107
|
+
• Missing variables in reset dependency array
|
|
108
|
+
• Reset dependencies not updating after form save
|
|
109
|
+
• Async operations blocking timely reset
|
|
110
|
+
|
|
111
|
+
Solutions:
|
|
112
|
+
1. Ensure reset dependencies include all relevant state variables
|
|
113
|
+
2. Confirm your submission handler updates state properly (check query invalidation)
|
|
114
|
+
3. For slower operations, consider increasing the timeout threshold`;
|
|
115
|
+
/** Autosave schemas must produce objects preserving every raw field path, including optional fields. */
|
|
116
|
+
function useFormAutosave({ autosaveDelay, enableAutosave, autosaveOn = "change", normalizeAutosaveData, onAutosave, getResetValues, resetDeps, resetTimeout = 5e3, ...props }) {
|
|
117
|
+
const initialValues = getResetValues();
|
|
118
|
+
const form = useForm$1(...[{
|
|
119
|
+
...props,
|
|
120
|
+
defaultValues: typeof initialValues === "function" ? void 0 : initialValues
|
|
121
|
+
}]);
|
|
122
|
+
const serverBaselineRef = useRef(structuredClone(form.state.values));
|
|
123
|
+
const pendingRefreshesRef = useRef([]);
|
|
124
|
+
const resetFormValuesTimeoutRef = useRef(void 0);
|
|
125
|
+
useEffect(() => {
|
|
126
|
+
const clearRefreshes = () => {
|
|
127
|
+
pendingRefreshesRef.current = [];
|
|
128
|
+
if (resetFormValuesTimeoutRef.current) clearTimeout(resetFormValuesTimeoutRef.current);
|
|
129
|
+
};
|
|
130
|
+
const unsubscribe = subscribeFormReset(form, (refresh) => {
|
|
131
|
+
if (!refresh) {
|
|
132
|
+
serverBaselineRef.current = structuredClone(form.state.values);
|
|
133
|
+
clearRefreshes();
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
return () => {
|
|
137
|
+
unsubscribe();
|
|
138
|
+
clearRefreshes();
|
|
139
|
+
};
|
|
140
|
+
}, [form]);
|
|
141
|
+
useEffect(() => {
|
|
142
|
+
const resetValues = getResetValues();
|
|
143
|
+
if (resetValues === void 0) return;
|
|
144
|
+
let active = true;
|
|
145
|
+
const revision = getFormResetVersion(form);
|
|
146
|
+
const resetFormValues = async () => {
|
|
147
|
+
let values;
|
|
148
|
+
if (ObjectUtils.isFunction(resetValues)) values = await resetValues();
|
|
149
|
+
else values = resetValues;
|
|
150
|
+
if (!active || revision !== getFormResetVersion(form)) return;
|
|
151
|
+
const refreshedIndex = Math.max(0, pendingRefreshesRef.current.findLastIndex((pending) => pending.completed));
|
|
152
|
+
const submitted = pendingRefreshesRef.current[refreshedIndex];
|
|
153
|
+
pendingRefreshesRef.current.splice(0, refreshedIndex + 1);
|
|
154
|
+
const edits = getChangedAutosaveFields(form.state.values, submitted?.values ?? serverBaselineRef.current);
|
|
155
|
+
serverBaselineRef.current = structuredClone(values);
|
|
156
|
+
for (const pending_0 of pendingRefreshesRef.current) {
|
|
157
|
+
pending_0.values = structuredClone(values);
|
|
158
|
+
for (const [path, value] of pending_0.fields) pending_0.values = setBy(pending_0.values, path, value);
|
|
159
|
+
}
|
|
160
|
+
const applyRefresh = () => {
|
|
161
|
+
form.reset(values);
|
|
162
|
+
for (const [path_0, value_0] of edits) {
|
|
163
|
+
const name = path_0;
|
|
164
|
+
form.setFieldValue(name, value_0);
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
refreshAutosaveForm(form, values, applyRefresh, submitted?.fields);
|
|
168
|
+
if (pendingRefreshesRef.current.length === 0 && resetFormValuesTimeoutRef.current) clearTimeout(resetFormValuesTimeoutRef.current);
|
|
169
|
+
};
|
|
170
|
+
resetFormValues().catch((error) => logger.warn("Unable to refresh autosave form", error));
|
|
171
|
+
return () => {
|
|
172
|
+
active = false;
|
|
173
|
+
};
|
|
174
|
+
}, [...resetDeps]);
|
|
175
|
+
const prepareForSaveReset = () => {
|
|
176
|
+
if (resetFormValuesTimeoutRef.current) clearTimeout(resetFormValuesTimeoutRef.current);
|
|
177
|
+
resetFormValuesTimeoutRef.current = setTimeout(() => {
|
|
178
|
+
if (pendingRefreshesRef.current.length > 0) logger.warn(getResetTimeoutErrorMessage(resetTimeout));
|
|
179
|
+
}, resetTimeout);
|
|
180
|
+
};
|
|
181
|
+
useAutosave({
|
|
182
|
+
form,
|
|
183
|
+
delay: autosaveDelay,
|
|
184
|
+
enabled: enableAutosave,
|
|
185
|
+
trigger: autosaveOn,
|
|
186
|
+
onSave: useCallback(async (data) => {
|
|
187
|
+
const normalizedData = normalizeAutosaveData ? normalizeAutosaveData(data) : data;
|
|
188
|
+
if (!normalizedData || ObjectUtils.isEmpty(normalizedData)) return;
|
|
189
|
+
const values_0 = structuredClone(form.state.values);
|
|
190
|
+
const submitted_0 = {
|
|
191
|
+
values: values_0,
|
|
192
|
+
fields: getSubmittedAutosaveFields(normalizedData, values_0),
|
|
193
|
+
completed: false
|
|
194
|
+
};
|
|
195
|
+
pendingRefreshesRef.current.push(submitted_0);
|
|
196
|
+
prepareForSaveReset();
|
|
197
|
+
try {
|
|
198
|
+
const response = await onAutosave(normalizedData);
|
|
199
|
+
submitted_0.completed = true;
|
|
200
|
+
pendingRefreshesRef.current = pendingRefreshesRef.current.filter((pending_2) => !pending_2.completed || pending_2 === submitted_0);
|
|
201
|
+
return response;
|
|
202
|
+
} catch (error_0) {
|
|
203
|
+
pendingRefreshesRef.current = pendingRefreshesRef.current.filter((pending_1) => pending_1 !== submitted_0);
|
|
204
|
+
if (pendingRefreshesRef.current.length === 0 && resetFormValuesTimeoutRef.current) clearTimeout(resetFormValuesTimeoutRef.current);
|
|
205
|
+
throw error_0;
|
|
206
|
+
}
|
|
207
|
+
}, [
|
|
208
|
+
normalizeAutosaveData,
|
|
209
|
+
onAutosave,
|
|
210
|
+
resetTimeout
|
|
211
|
+
])
|
|
212
|
+
});
|
|
213
|
+
return form;
|
|
214
|
+
}
|
|
215
|
+
//#endregion
|
|
216
|
+
export { useAutosave as n, useFormAutosave as t };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { useLayoutEffect, useRef, useState } from "react";
|
|
2
|
+
import { useFocusRing as $32daac5f69beb98a$re_export$useFocusRing } from "react-aria/useFocusRing";
|
|
3
|
+
import "react-aria/FocusScope";
|
|
4
|
+
import "react-aria/private/interactions/focusSafely";
|
|
5
|
+
import "react-aria/private/utils/isFocusable";
|
|
6
|
+
import "react-aria/private/interactions/useFocusable";
|
|
7
|
+
import "react-aria/Focusable";
|
|
8
|
+
import { getFocusableTreeWalker as $32daac5f69beb98a$re_export$getFocusableTreeWalker } from "react-aria/private/focus/FocusScope";
|
|
9
|
+
import "react-aria/FocusRing";
|
|
10
|
+
import "react-aria/private/focus/useHasTabbableChild";
|
|
11
|
+
import "react-aria/private/focus/virtualFocus";
|
|
12
|
+
import "react-aria/useFocusable";
|
|
13
|
+
//#region src/components/inputs/shared/useStaticInputHandoff.ts
|
|
14
|
+
const useStaticInputHandoff = ({ inputRef, renderInput, setRenderInput, getFocusTarget, getPressTarget }) => {
|
|
15
|
+
const [shouldFocus, setShouldFocus] = useState(false);
|
|
16
|
+
const pendingStaticChangeRef = useRef(null);
|
|
17
|
+
const pendingStaticFocusTargetRef = useRef(null);
|
|
18
|
+
const focusFromEndRef = useRef(false);
|
|
19
|
+
const shouldReplayStaticPressRef = useRef(false);
|
|
20
|
+
useLayoutEffect(() => {
|
|
21
|
+
if (!renderInput || !shouldFocus) return;
|
|
22
|
+
const input = inputRef.current;
|
|
23
|
+
if (!input) return;
|
|
24
|
+
const pendingValue = pendingStaticChangeRef.current;
|
|
25
|
+
const focusTarget = getFocusTarget?.(input, pendingStaticFocusTargetRef.current, focusFromEndRef.current) ?? (input instanceof HTMLElement ? getStaticInputFocusTarget(input, focusFromEndRef.current) : input);
|
|
26
|
+
const replayPress = shouldReplayStaticPressRef.current;
|
|
27
|
+
pendingStaticChangeRef.current = null;
|
|
28
|
+
pendingStaticFocusTargetRef.current = null;
|
|
29
|
+
shouldReplayStaticPressRef.current = false;
|
|
30
|
+
setShouldFocus(false);
|
|
31
|
+
if (focusTarget instanceof HTMLInputElement && pendingValue != null) {
|
|
32
|
+
(Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")?.set)?.call(focusTarget, pendingValue);
|
|
33
|
+
focusTarget.dispatchEvent(new Event("input", { bubbles: true }));
|
|
34
|
+
}
|
|
35
|
+
focusTarget?.focus();
|
|
36
|
+
if (replayPress) (getPressTarget?.(input) ?? focusTarget)?.click();
|
|
37
|
+
}, [
|
|
38
|
+
getFocusTarget,
|
|
39
|
+
getPressTarget,
|
|
40
|
+
inputRef,
|
|
41
|
+
renderInput,
|
|
42
|
+
shouldFocus
|
|
43
|
+
]);
|
|
44
|
+
return {
|
|
45
|
+
renderRealInput: (focus, target, fromEnd = false) => {
|
|
46
|
+
if (!focus && shouldFocus) return;
|
|
47
|
+
focusFromEndRef.current = fromEnd;
|
|
48
|
+
pendingStaticFocusTargetRef.current = target ?? null;
|
|
49
|
+
setShouldFocus(focus);
|
|
50
|
+
setRenderInput(true);
|
|
51
|
+
},
|
|
52
|
+
replayStaticInputChange: (value) => {
|
|
53
|
+
pendingStaticChangeRef.current = value;
|
|
54
|
+
setShouldFocus(true);
|
|
55
|
+
setRenderInput(true);
|
|
56
|
+
},
|
|
57
|
+
replayStaticInputPress: () => {
|
|
58
|
+
shouldReplayStaticPressRef.current = true;
|
|
59
|
+
setShouldFocus(true);
|
|
60
|
+
setRenderInput(true);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
const getStaticInputFocusTarget = (container, fromEnd = false) => {
|
|
65
|
+
const walker = $32daac5f69beb98a$re_export$getFocusableTreeWalker(container, { tabbable: true });
|
|
66
|
+
let target = walker.nextNode();
|
|
67
|
+
if (fromEnd) {
|
|
68
|
+
let next = walker.nextNode();
|
|
69
|
+
while (next) {
|
|
70
|
+
target = next;
|
|
71
|
+
next = walker.nextNode();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return target ?? container;
|
|
75
|
+
};
|
|
76
|
+
//#endregion
|
|
77
|
+
export { useStaticInputHandoff as n, $32daac5f69beb98a$re_export$useFocusRing as r, getStaticInputFocusTarget as t };
|