@soyfri/shared-library 2.0.0-beta8 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Alert-B3SMPD1s.cjs +31 -0
- package/Alert-B3SMPD1s.cjs.map +1 -0
- package/Alert-YsPScpSE.js +32 -0
- package/Alert-YsPScpSE.js.map +1 -0
- package/{Autocomplete-BA-cGASd.js → Autocomplete-C_lW1VER.js} +57 -36
- package/Autocomplete-C_lW1VER.js.map +1 -0
- package/{Autocomplete-C2x-lBvZ.cjs → Autocomplete-CejWztBY.cjs} +56 -35
- package/Autocomplete-CejWztBY.cjs.map +1 -0
- package/{Avatar-9L7YMxya.cjs → Avatar-Dw5rzayR.cjs} +28 -24
- package/Avatar-Dw5rzayR.cjs.map +1 -0
- package/{Avatar-BJTr-PBd.js → Avatar-H8akSege.js} +28 -24
- package/Avatar-H8akSege.js.map +1 -0
- package/Breadcrumbs-B9I3vxPb.cjs +25 -0
- package/Breadcrumbs-B9I3vxPb.cjs.map +1 -0
- package/Breadcrumbs-C41SPbtX.js +26 -0
- package/Breadcrumbs-C41SPbtX.js.map +1 -0
- package/Button-C17mExpd.cjs.map +1 -1
- package/Button-UkkP-bNw.js.map +1 -1
- package/ButtonGroup-CNunDofQ.cjs +33 -0
- package/ButtonGroup-CNunDofQ.cjs.map +1 -0
- package/ButtonGroup-CcKUZ-lT.js +34 -0
- package/ButtonGroup-CcKUZ-lT.js.map +1 -0
- package/Card-DYKGY-NG.js +116 -0
- package/Card-DYKGY-NG.js.map +1 -0
- package/Card-Dr1-ATRY.cjs +115 -0
- package/Card-Dr1-ATRY.cjs.map +1 -0
- package/Checkbox-BCqMFWt4.cjs +187 -0
- package/Checkbox-BCqMFWt4.cjs.map +1 -0
- package/Checkbox-gB5YKkVo.js +188 -0
- package/Checkbox-gB5YKkVo.js.map +1 -0
- package/{DatePicker-8f_9bwhS.js → DatePicker-_IGWc3I5.js} +38 -62
- package/DatePicker-_IGWc3I5.js.map +1 -0
- package/{DatePicker-DLSfkgGA.cjs → DatePicker-t7uDTZMl.cjs} +42 -66
- package/DatePicker-t7uDTZMl.cjs.map +1 -0
- package/{DateTimePicker-CWNW09-O.cjs → DateTimePicker-BxQyjTCY.cjs} +33 -24
- package/DateTimePicker-BxQyjTCY.cjs.map +1 -0
- package/{DateTimePicker-D4L9GAod.js → DateTimePicker-CrmWav_j.js} +29 -20
- package/DateTimePicker-CrmWav_j.js.map +1 -0
- package/Divider-BApcM5CV.js +28 -0
- package/Divider-BApcM5CV.js.map +1 -0
- package/Divider-CIY0JK4U.cjs +27 -0
- package/Divider-CIY0JK4U.cjs.map +1 -0
- package/{Input-DI0jfq5X.cjs → Input-CScC87J5.cjs} +28 -16
- package/Input-CScC87J5.cjs.map +1 -0
- package/{Input-Cp911l23.js → Input-DP_fKl38.js} +25 -13
- package/Input-DP_fKl38.js.map +1 -0
- package/{Modal-Bnz6d9m9.js → Modal-C_QY7ZzY.js} +137 -105
- package/Modal-C_QY7ZzY.js.map +1 -0
- package/{Modal-Bm_HH9cv.cjs → Modal-D_6ZdSzw.cjs} +132 -100
- package/Modal-D_6ZdSzw.cjs.map +1 -0
- package/README.md +188 -172
- package/{RadioGroup-CxqDHap1.cjs → RadioGroup-Dd0rHXSX.cjs} +10 -8
- package/RadioGroup-Dd0rHXSX.cjs.map +1 -0
- package/{RadioGroup-DMi9FvMP.js → RadioGroup-bO-ahP9T.js} +10 -8
- package/RadioGroup-bO-ahP9T.js.map +1 -0
- package/{Select-3CBOfM2H.js → Select-BY5Y0qZ1.js} +160 -231
- package/Select-BY5Y0qZ1.js.map +1 -0
- package/{Select-Bku4f4f8.cjs → Select-CURrHSyl.cjs} +155 -226
- package/Select-CURrHSyl.cjs.map +1 -0
- package/Spinner-B6sThC1p.js +74 -0
- package/Spinner-B6sThC1p.js.map +1 -0
- package/Spinner-D7qRmNS9.cjs +73 -0
- package/Spinner-D7qRmNS9.cjs.map +1 -0
- package/StatusMessage-B3nXpuRl.cjs +88 -0
- package/StatusMessage-B3nXpuRl.cjs.map +1 -0
- package/StatusMessage-D0WgSBx7.js +89 -0
- package/StatusMessage-D0WgSBx7.js.map +1 -0
- package/Step-BArsou1V.js +301 -0
- package/Step-BArsou1V.js.map +1 -0
- package/Step-Nd7SJbRZ.cjs +300 -0
- package/Step-Nd7SJbRZ.cjs.map +1 -0
- package/{Switch-BIeobv6i.cjs → Switch-CQFOopYy.cjs} +6 -3
- package/Switch-CQFOopYy.cjs.map +1 -0
- package/{Switch-DQEOxM2R.js → Switch-D72dpkH2.js} +6 -3
- package/Switch-D72dpkH2.js.map +1 -0
- package/Tab-D1S7kxXI.cjs +137 -0
- package/Tab-D1S7kxXI.cjs.map +1 -0
- package/Tab-DycIMXmQ.js +138 -0
- package/Tab-DycIMXmQ.js.map +1 -0
- package/components/ActionMenu/ActionMenu.cjs +52 -52
- package/components/ActionMenu/ActionMenu.cjs.map +1 -1
- package/components/ActionMenu/ActionMenu.d.ts +20 -36
- package/components/ActionMenu/ActionMenu.js +55 -55
- package/components/ActionMenu/ActionMenu.js.map +1 -1
- package/components/ActionMenu/index.d.ts +2 -2
- package/components/Alert/Alert.cjs +6 -0
- package/components/Alert/Alert.cjs.map +1 -0
- package/components/Alert/Alert.d.ts +31 -0
- package/components/Alert/Alert.js +6 -0
- package/components/Alert/Alert.js.map +1 -0
- package/components/Alert/index.d.ts +2 -0
- package/components/Alert.d.ts +6 -0
- package/components/AppBar/AppBar.cjs +2 -219
- package/components/AppBar/AppBar.cjs.map +1 -1
- package/components/AppBar/AppBar.d.ts +6 -6
- package/components/AppBar/AppBar.js +5 -222
- package/components/AppBar/AppBar.js.map +1 -1
- package/components/AppBar/index.d.ts +0 -6
- package/components/Autocomplete/Autocomplete.cjs +1 -1
- package/components/Autocomplete/Autocomplete.d.ts +8 -6
- package/components/Autocomplete/Autocomplete.helpers.d.ts +8 -4
- package/components/Autocomplete/Autocomplete.js +1 -1
- package/components/Autocomplete/_parts/AutocompleteOption.d.ts +5 -8
- package/components/Autocomplete/index.d.ts +1 -1
- package/components/Avatar/Avatar.cjs +1 -1
- package/components/Avatar/Avatar.d.ts +16 -1
- package/components/Avatar/Avatar.js +1 -1
- package/components/Avatar/index.d.ts +1 -0
- package/components/Breadcrumbs/Breadcrumbs.cjs +6 -0
- package/components/Breadcrumbs/Breadcrumbs.cjs.map +1 -0
- package/components/Breadcrumbs/Breadcrumbs.d.ts +16 -0
- package/components/Breadcrumbs/Breadcrumbs.js +6 -0
- package/components/Breadcrumbs/Breadcrumbs.js.map +1 -0
- package/components/Breadcrumbs/index.d.ts +2 -0
- package/components/Breadcrumbs.d.ts +6 -0
- package/components/Button/Button.d.ts +5 -5
- package/components/Button/index.d.ts +1 -0
- package/components/ButtonGroup/ButtonGroup.cjs +6 -0
- package/components/ButtonGroup/ButtonGroup.cjs.map +1 -0
- package/components/ButtonGroup/ButtonGroup.d.ts +18 -0
- package/components/ButtonGroup/ButtonGroup.js +6 -0
- package/components/ButtonGroup/ButtonGroup.js.map +1 -0
- package/components/ButtonGroup/index.d.ts +2 -0
- package/components/ButtonGroup.d.ts +6 -0
- package/components/Card/Card.cjs +1 -4
- package/components/Card/Card.cjs.map +1 -1
- package/components/Card/Card.d.ts +21 -50
- package/components/Card/Card.js +1 -4
- package/components/Card/Card.sx.d.ts +3 -6
- package/components/Card/index.d.ts +1 -1
- package/components/Checkbox/Checkbox.cjs +6 -0
- package/components/Checkbox/Checkbox.cjs.map +1 -0
- package/components/Checkbox/Checkbox.d.ts +55 -0
- package/components/Checkbox/Checkbox.js +6 -0
- package/components/Checkbox/Checkbox.js.map +1 -0
- package/components/Checkbox/Checkbox.sx.d.ts +13 -0
- package/components/Checkbox/index.d.ts +2 -0
- package/components/Checkbox.d.ts +6 -0
- package/components/Chip/Chip.cjs +2 -1
- package/components/Chip/Chip.cjs.map +1 -1
- package/components/Chip/Chip.js +3 -2
- package/components/Chip/index.d.ts +2 -1
- package/components/Chip.d.ts +4 -0
- package/components/DatePicker/DatePicker.cjs +1 -1
- package/components/DatePicker/DatePicker.d.ts +1 -13
- package/components/DatePicker/DatePicker.js +1 -1
- package/components/DatePicker/index.d.ts +1 -1
- package/components/DateTimePicker/DateTimePicker.cjs +1 -1
- package/components/DateTimePicker/DateTimePicker.d.ts +10 -6
- package/components/DateTimePicker/DateTimePicker.definitions.d.ts +2 -0
- package/components/DateTimePicker/DateTimePicker.helpers.d.ts +4 -2
- package/components/DateTimePicker/DateTimePicker.js +1 -1
- package/components/DateTimePicker/index.d.ts +1 -1
- package/components/Divider/Divider.cjs +6 -0
- package/components/Divider/Divider.cjs.map +1 -0
- package/components/Divider/Divider.d.ts +17 -0
- package/components/Divider/Divider.js +6 -0
- package/components/Divider/Divider.js.map +1 -0
- package/components/Divider/index.d.ts +2 -0
- package/components/Divider.d.ts +6 -0
- package/components/Drawer/Drawer.cjs +10 -6
- package/components/Drawer/Drawer.cjs.map +1 -1
- package/components/Drawer/Drawer.js +11 -7
- package/components/Drawer/Drawer.js.map +1 -1
- package/components/Drawer/DrawerItem.d.ts +6 -1
- package/components/Gallery/Gallery.cjs +154 -79
- package/components/Gallery/Gallery.cjs.map +1 -1
- package/components/Gallery/Gallery.d.ts +25 -9
- package/components/Gallery/Gallery.js +154 -79
- package/components/Gallery/Gallery.js.map +1 -1
- package/components/Gallery/GalleryLightbox.d.ts +6 -10
- package/components/Gallery/GalleryMain.d.ts +3 -7
- package/components/Gallery/GalleryThumbnails.d.ts +7 -11
- package/components/Gallery/index.d.ts +2 -1
- package/components/Gallery.d.ts +4 -0
- package/components/Icon/Icon.cjs +6 -8
- package/components/Icon/Icon.cjs.map +1 -1
- package/components/Icon/Icon.d.ts +11 -17
- package/components/Icon/Icon.js +6 -8
- package/components/Icon/Icon.js.map +1 -1
- package/components/Icon/index.d.ts +2 -1
- package/components/Icon.d.ts +4 -0
- package/components/Input/Input.cjs +1 -1
- package/components/Input/Input.d.ts +9 -2
- package/components/Input/Input.helpers.d.ts +3 -3
- package/components/Input/Input.js +1 -1
- package/components/Input/index.d.ts +1 -1
- package/components/InputGroup/InputGroup.cjs +23 -22
- package/components/InputGroup/InputGroup.cjs.map +1 -1
- package/components/InputGroup/InputGroup.d.ts +4 -4
- package/components/InputGroup/InputGroup.js +22 -21
- package/components/InputGroup/InputGroup.js.map +1 -1
- package/components/InputGroup/index.d.ts +2 -1
- package/components/InputGroup.d.ts +4 -0
- package/components/Modal/Modal.cjs +2 -2
- package/components/Modal/Modal.d.ts +27 -5
- package/components/Modal/Modal.js +2 -2
- package/components/Modal/ModalBody.d.ts +6 -1
- package/components/Modal/ModalFooter.d.ts +4 -4
- package/components/Modal/ModalHeader.d.ts +6 -1
- package/components/Modal/index.d.ts +3 -2
- package/components/RadioGroup/RadioGroup.cjs +1 -1
- package/components/RadioGroup/RadioGroup.d.ts +9 -3
- package/components/RadioGroup/RadioGroup.js +1 -1
- package/components/RadioGroup/index.d.ts +1 -1
- package/components/Select/Select.cjs +1 -1
- package/components/Select/Select.d.ts +37 -18
- package/components/Select/Select.helpers.d.ts +5 -19
- package/components/Select/Select.js +1 -1
- package/components/Select/index.d.ts +1 -1
- package/components/Spinner/Spinner.cjs +6 -0
- package/components/Spinner/Spinner.cjs.map +1 -0
- package/components/Spinner/Spinner.d.ts +26 -0
- package/components/Spinner/Spinner.js +6 -0
- package/components/Spinner/Spinner.js.map +1 -0
- package/components/Spinner/index.d.ts +2 -0
- package/components/Spinner.d.ts +6 -0
- package/components/Stat/Stat.cjs +2 -2
- package/components/Stat/Stat.js +3 -3
- package/components/Stat/Stat.js.map +1 -1
- package/components/Stat/index.d.ts +2 -1
- package/components/Stat.d.ts +4 -0
- package/components/StatusMessage/StatusMessage.cjs +1 -1
- package/components/StatusMessage/StatusMessage.d.ts +20 -36
- package/components/StatusMessage/StatusMessage.js +1 -1
- package/components/Stepper/Stepper.cjs +6 -2
- package/components/Stepper/Stepper.cjs.map +1 -1
- package/components/Stepper/Stepper.d.ts +9 -8
- package/components/Stepper/Stepper.js +6 -2
- package/{hooks/Wizard/WizardContext.d.ts → components/Stepper/StepperContext.d.ts} +28 -22
- package/components/Stepper/_hooks/useHorizontalScroll.d.ts +19 -0
- package/components/Stepper/_parts/StepperScrollArrow.d.ts +19 -0
- package/components/Stepper/index.d.ts +6 -2
- package/components/Stepper.d.ts +4 -0
- package/components/Switch/Switch.cjs +1 -1
- package/components/Switch/Switch.d.ts +7 -2
- package/components/Switch/Switch.js +1 -1
- package/components/Tabs/Tab.d.ts +13 -2
- package/components/Tabs/Tabs.cjs +3 -2
- package/components/Tabs/Tabs.cjs.map +1 -1
- package/components/Tabs/Tabs.d.ts +33 -16
- package/components/Tabs/Tabs.js +3 -2
- package/components/Tabs/index.d.ts +4 -2
- package/components/Tabs.d.ts +4 -0
- package/components/Timeline/Timeline.cjs +3 -2
- package/components/Timeline/Timeline.cjs.map +1 -1
- package/components/Timeline/Timeline.d.ts +4 -8
- package/components/Timeline/Timeline.js +3 -2
- package/components/Timeline/Timeline.js.map +1 -1
- package/components/Timeline/index.d.ts +4 -2
- package/components/Timeline.d.ts +4 -0
- package/components/_shared/mergeSx.d.ts +7 -0
- package/{formField.sx-DfVbMe0V.js → formField.sx-8_QRnKxv.js} +2 -11
- package/formField.sx-8_QRnKxv.js.map +1 -0
- package/{formField.sx-CQ1mbk9M.cjs → formField.sx-BAX7KwMR.cjs} +10 -19
- package/formField.sx-BAX7KwMR.cjs.map +1 -0
- package/index.cjs +49 -26
- package/index.cjs.map +1 -1
- package/index.d.ts +13 -1
- package/index.js +45 -25
- package/index.js.map +1 -1
- package/local/affiliations/affiliations.dev.soyfri.com-key.pem +28 -0
- package/local/affiliations/affiliations.dev.soyfri.com.pem +27 -0
- package/local/aficiliaciones/afiliaciones.dev.soyfri.com-key.pem +28 -0
- package/local/aficiliaciones/afiliaciones.dev.soyfri.com.pem +27 -0
- package/local/afiliaciones/afiliaciones.dev.soyfri.com-key.pem +28 -0
- package/local/afiliaciones/afiliaciones.dev.soyfri.com.pem +27 -0
- package/local/root/rootCA-key.pem +40 -0
- package/local/root/rootCA.pem +30 -0
- package/local/soporte/supportweb.dev.soyfri.com-key.pem +28 -0
- package/local/soporte/supportweb.dev.soyfri.com.pem +27 -0
- package/local/support/supportweb.dev.soyfri.com-key.pem +28 -0
- package/local/support/supportweb.dev.soyfri.com.pem +27 -0
- package/mergeSx-BXoNZjB_.js +10 -0
- package/mergeSx-BXoNZjB_.js.map +1 -0
- package/mergeSx-Dbccoo_H.cjs +9 -0
- package/mergeSx-Dbccoo_H.cjs.map +1 -0
- package/mui.d.ts +2 -1
- package/package.json +83 -76
- package/theme/componentStyles.d.ts +1 -1
- package/tokens-BRrcP_p_.js +21 -0
- package/tokens-BRrcP_p_.js.map +1 -0
- package/tokens-jaWWNk39.cjs +20 -0
- package/tokens-jaWWNk39.cjs.map +1 -0
- package/utils/index.d.ts +2 -0
- package/{components/ScrollTopButton → utils}/scrollToTop.d.ts +6 -7
- package/Autocomplete-BA-cGASd.js.map +0 -1
- package/Autocomplete-C2x-lBvZ.cjs.map +0 -1
- package/Avatar-9L7YMxya.cjs.map +0 -1
- package/Avatar-BJTr-PBd.js.map +0 -1
- package/Card-DG_crfkK.cjs +0 -185
- package/Card-DG_crfkK.cjs.map +0 -1
- package/Card-Ug-ttVSh.js +0 -186
- package/Card-Ug-ttVSh.js.map +0 -1
- package/DatePicker-8f_9bwhS.js.map +0 -1
- package/DatePicker-DLSfkgGA.cjs.map +0 -1
- package/DateRangePicker-BVpeJCHI.js +0 -76
- package/DateRangePicker-BVpeJCHI.js.map +0 -1
- package/DateRangePicker-B_hKQhbj.cjs +0 -75
- package/DateRangePicker-B_hKQhbj.cjs.map +0 -1
- package/DateTimePicker-CWNW09-O.cjs.map +0 -1
- package/DateTimePicker-D4L9GAod.js.map +0 -1
- package/Input-Cp911l23.js.map +0 -1
- package/Input-DI0jfq5X.cjs.map +0 -1
- package/Modal-Bm_HH9cv.cjs.map +0 -1
- package/Modal-Bnz6d9m9.js.map +0 -1
- package/RadioGroup-CxqDHap1.cjs.map +0 -1
- package/RadioGroup-DMi9FvMP.js.map +0 -1
- package/Select-3CBOfM2H.js.map +0 -1
- package/Select-Bku4f4f8.cjs.map +0 -1
- package/StatusMessage-C5B6oGZ_.cjs +0 -78
- package/StatusMessage-C5B6oGZ_.cjs.map +0 -1
- package/StatusMessage-D1GlfQdz.js +0 -79
- package/StatusMessage-D1GlfQdz.js.map +0 -1
- package/Step-Dq0N72YB.js +0 -49
- package/Step-Dq0N72YB.js.map +0 -1
- package/Step-a8U8O-91.cjs +0 -48
- package/Step-a8U8O-91.cjs.map +0 -1
- package/Switch-BIeobv6i.cjs.map +0 -1
- package/Switch-DQEOxM2R.js.map +0 -1
- package/Tab-Co31KY2k.cjs +0 -95
- package/Tab-Co31KY2k.cjs.map +0 -1
- package/Tab-DiK62gRz.js +0 -96
- package/Tab-DiK62gRz.js.map +0 -1
- package/components/AppBar/AppBarBrand.d.ts +0 -31
- package/components/AppBar/AppBarUserMenu.d.ts +0 -65
- package/components/Autocomplete/Autocomplete.types.d.ts +0 -1
- package/components/DatePicker/DatePicker.types.d.ts +0 -1
- package/components/DateRangePicker/DateRangePicker.cjs +0 -5
- package/components/DateRangePicker/DateRangePicker.cjs.map +0 -1
- package/components/DateRangePicker/DateRangePicker.d.ts +0 -15
- package/components/DateRangePicker/DateRangePicker.definitions.d.ts +0 -6
- package/components/DateRangePicker/DateRangePicker.js +0 -5
- package/components/DateRangePicker/DateRangePicker.js.map +0 -1
- package/components/DateRangePicker/index.d.ts +0 -1
- package/components/DateRangePicker.d.ts +0 -2
- package/components/DateTimePicker/DateTimePicker.types.d.ts +0 -1
- package/components/Input/Input.types.d.ts +0 -1
- package/components/PageLoader/PageLoader.cjs +0 -61
- package/components/PageLoader/PageLoader.cjs.map +0 -1
- package/components/PageLoader/PageLoader.d.ts +0 -38
- package/components/PageLoader/PageLoader.js +0 -61
- package/components/PageLoader/PageLoader.js.map +0 -1
- package/components/PageLoader/index.d.ts +0 -2
- package/components/PageLoader.d.ts +0 -6
- package/components/RadioGroup/RadioGroup.types.d.ts +0 -1
- package/components/ScrollTopButton/ScrollTopButton.cjs +0 -79
- package/components/ScrollTopButton/ScrollTopButton.cjs.map +0 -1
- package/components/ScrollTopButton/ScrollTopButton.d.ts +0 -48
- package/components/ScrollTopButton/ScrollTopButton.js +0 -79
- package/components/ScrollTopButton/ScrollTopButton.js.map +0 -1
- package/components/ScrollTopButton/index.d.ts +0 -4
- package/components/ScrollTopButton.d.ts +0 -6
- package/components/Select/Select.definitions.d.ts +0 -17
- package/components/Select/Select.types.d.ts +0 -1
- package/components/Select/_parts/SelectSearchHeader.d.ts +0 -15
- package/formField.sx-CQ1mbk9M.cjs.map +0 -1
- package/formField.sx-DfVbMe0V.js.map +0 -1
- package/hooks/Wizard/Wizard.cjs +0 -7
- package/hooks/Wizard/Wizard.cjs.map +0 -1
- package/hooks/Wizard/Wizard.js +0 -7
- package/hooks/Wizard/Wizard.js.map +0 -1
- package/hooks/Wizard/index.d.ts +0 -3
- package/hooks/Wizard/useWizard.d.ts +0 -9
- package/hooks/Wizard.d.ts +0 -2
- package/useWizard-CWdIxZzX.cjs +0 -94
- package/useWizard-CWdIxZzX.cjs.map +0 -1
- package/useWizard-CWq--C3o.js +0 -95
- package/useWizard-CWq--C3o.js.map +0 -1
- /package/{styles.css → index.css} +0 -0
|
@@ -33,18 +33,14 @@ var __objRest = (source, exclude) => {
|
|
|
33
33
|
const jsxRuntime = require("react/jsx-runtime");
|
|
34
34
|
const React = require("react");
|
|
35
35
|
const material = require("@mui/material");
|
|
36
|
+
const SearchIcon = require("@mui/icons-material/Search");
|
|
36
37
|
const styles = require("@mui/material/styles");
|
|
37
38
|
const reactHookForm = require("react-hook-form");
|
|
38
|
-
const formField_sx = require("./formField.sx-
|
|
39
|
+
const formField_sx = require("./formField.sx-BAX7KwMR.cjs");
|
|
39
40
|
const resolvePreset = require("./resolvePreset-CxTI6_Ln.cjs");
|
|
40
|
-
const ClearIcon = require("@mui/icons-material/Clear");
|
|
41
41
|
const CheckIcon = require("@mui/icons-material/Check");
|
|
42
|
+
const ClearIcon = require("@mui/icons-material/Clear");
|
|
42
43
|
const buildSelectSx = (borderRadius, labelPosition) => formField_sx.buildFormFieldSx({ borderRadius, labelPosition });
|
|
43
|
-
const filterOptionsByLabel = (options, search) => {
|
|
44
|
-
if (!search) return options;
|
|
45
|
-
const needle = search.toLowerCase();
|
|
46
|
-
return options.filter((opt) => opt.label.toLowerCase().includes(needle));
|
|
47
|
-
};
|
|
48
44
|
const groupOptions = (options) => {
|
|
49
45
|
const groups = {};
|
|
50
46
|
options.forEach((opt) => {
|
|
@@ -54,58 +50,25 @@ const groupOptions = (options) => {
|
|
|
54
50
|
});
|
|
55
51
|
return groups;
|
|
56
52
|
};
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
value
|
|
75
|
-
|
|
76
|
-
placeholder = "Buscar...",
|
|
77
|
-
inputRef
|
|
78
|
-
}) => {
|
|
79
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
80
|
-
material.ListSubheader,
|
|
81
|
-
{
|
|
82
|
-
sx: {
|
|
83
|
-
px: 2,
|
|
84
|
-
pt: 1,
|
|
85
|
-
pb: 1,
|
|
86
|
-
backgroundColor: "background.paper",
|
|
87
|
-
zIndex: 1,
|
|
88
|
-
position: "sticky",
|
|
89
|
-
top: 0
|
|
90
|
-
},
|
|
91
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
92
|
-
material.TextField,
|
|
93
|
-
{
|
|
94
|
-
inputRef,
|
|
95
|
-
placeholder,
|
|
96
|
-
variant: "standard",
|
|
97
|
-
size: "small",
|
|
98
|
-
fullWidth: true,
|
|
99
|
-
value,
|
|
100
|
-
onChange: (e) => onChange(e.target.value),
|
|
101
|
-
slotProps: { htmlInput: { autoFocus: true } },
|
|
102
|
-
onClick: (e) => e.stopPropagation(),
|
|
103
|
-
onKeyDown: (e) => e.stopPropagation()
|
|
104
|
-
}
|
|
105
|
-
)
|
|
106
|
-
}
|
|
107
|
-
);
|
|
108
|
-
};
|
|
53
|
+
const normalizeSelectValue = (value) => value != null ? value : "";
|
|
54
|
+
const isSelectValueEmpty = (normalizedValue) => normalizedValue === "" || normalizedValue === null || normalizedValue === void 0;
|
|
55
|
+
const renderSelectMenuItem = ({
|
|
56
|
+
option,
|
|
57
|
+
selected,
|
|
58
|
+
customRender
|
|
59
|
+
}) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
60
|
+
material.MenuItem,
|
|
61
|
+
{
|
|
62
|
+
value: option.value,
|
|
63
|
+
disabled: option.disabled,
|
|
64
|
+
selected,
|
|
65
|
+
children: [
|
|
66
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.ListItemIcon, { sx: { minWidth: 32 }, children: selected && /* @__PURE__ */ jsxRuntime.jsx(CheckIcon, { color: "success", fontSize: "small" }) }),
|
|
67
|
+
customRender ? customRender(option) : option.label
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
String(option.value)
|
|
71
|
+
);
|
|
109
72
|
function SelectValue(props) {
|
|
110
73
|
var _a;
|
|
111
74
|
const {
|
|
@@ -156,23 +119,6 @@ function SelectValue(props) {
|
|
|
156
119
|
hiddenChipsCount > 0 && /* @__PURE__ */ jsxRuntime.jsx(material.Chip, { size: "small", variant: chipVariant, label: `+${hiddenChipsCount} más` })
|
|
157
120
|
] });
|
|
158
121
|
}
|
|
159
|
-
const renderSelectMenuItem = ({
|
|
160
|
-
option,
|
|
161
|
-
selected,
|
|
162
|
-
customRender
|
|
163
|
-
}) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
164
|
-
material.MenuItem,
|
|
165
|
-
{
|
|
166
|
-
value: option.value,
|
|
167
|
-
disabled: option.disabled,
|
|
168
|
-
selected,
|
|
169
|
-
children: [
|
|
170
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.ListItemIcon, { sx: { minWidth: 32 }, children: selected && /* @__PURE__ */ jsxRuntime.jsx(CheckIcon, { color: "success", fontSize: "small" }) }),
|
|
171
|
-
customRender ? customRender(option) : option.label
|
|
172
|
-
]
|
|
173
|
-
},
|
|
174
|
-
String(option.value)
|
|
175
|
-
);
|
|
176
122
|
function Option(_props) {
|
|
177
123
|
return null;
|
|
178
124
|
}
|
|
@@ -181,63 +127,65 @@ function Select(props) {
|
|
|
181
127
|
const _a = props, {
|
|
182
128
|
label,
|
|
183
129
|
options = [],
|
|
184
|
-
value,
|
|
185
|
-
onChange,
|
|
186
130
|
defaultValue,
|
|
187
131
|
size = "small",
|
|
188
|
-
multiple = false,
|
|
189
|
-
filterable = false,
|
|
190
132
|
placeholder,
|
|
191
133
|
children,
|
|
192
134
|
maxHeight = 300,
|
|
193
135
|
maxWidth,
|
|
194
|
-
maxChipsToShow = 3,
|
|
195
|
-
renderChipLabel,
|
|
196
|
-
chipVariant = "outlined",
|
|
197
|
-
loadOptions,
|
|
198
|
-
loadingMessage = "Cargando opciones...",
|
|
199
|
-
noOptionsMessage = "No hay opciones",
|
|
200
|
-
debounceTimeout = 300,
|
|
201
136
|
disabled = false,
|
|
202
137
|
error = false,
|
|
203
138
|
helperText,
|
|
204
139
|
borderRadius = 10,
|
|
205
140
|
labelPosition = "outside",
|
|
206
141
|
preset,
|
|
142
|
+
variant = "outlined",
|
|
207
143
|
sx,
|
|
208
|
-
className
|
|
144
|
+
className,
|
|
145
|
+
multiple = false,
|
|
146
|
+
maxChipsToShow = 3,
|
|
147
|
+
chipVariant = "filled",
|
|
148
|
+
renderChipLabel,
|
|
149
|
+
filterable = false,
|
|
150
|
+
name: _nameIgnored,
|
|
151
|
+
control: _controlIgnored,
|
|
152
|
+
validation: _validationIgnored,
|
|
153
|
+
value: _valueIgnored,
|
|
154
|
+
onChange: _onChangeIgnored
|
|
209
155
|
} = _a, rest = __objRest(_a, [
|
|
210
156
|
"label",
|
|
211
157
|
"options",
|
|
212
|
-
"value",
|
|
213
|
-
"onChange",
|
|
214
158
|
"defaultValue",
|
|
215
159
|
"size",
|
|
216
|
-
"multiple",
|
|
217
|
-
"filterable",
|
|
218
160
|
"placeholder",
|
|
219
161
|
"children",
|
|
220
162
|
"maxHeight",
|
|
221
163
|
"maxWidth",
|
|
222
|
-
"maxChipsToShow",
|
|
223
|
-
"renderChipLabel",
|
|
224
|
-
"chipVariant",
|
|
225
|
-
"loadOptions",
|
|
226
|
-
"loadingMessage",
|
|
227
|
-
"noOptionsMessage",
|
|
228
|
-
"debounceTimeout",
|
|
229
164
|
"disabled",
|
|
230
165
|
"error",
|
|
231
166
|
"helperText",
|
|
232
167
|
"borderRadius",
|
|
233
168
|
"labelPosition",
|
|
234
169
|
"preset",
|
|
170
|
+
"variant",
|
|
235
171
|
"sx",
|
|
236
|
-
"className"
|
|
172
|
+
"className",
|
|
173
|
+
"multiple",
|
|
174
|
+
"maxChipsToShow",
|
|
175
|
+
"chipVariant",
|
|
176
|
+
"renderChipLabel",
|
|
177
|
+
"filterable",
|
|
178
|
+
// Separamos estos aunque no se usen directamente acá — evita que lleguen
|
|
179
|
+
// al DOM del MuiSelect via `{...rest}` y generen warnings de React.
|
|
180
|
+
"name",
|
|
181
|
+
"control",
|
|
182
|
+
"validation",
|
|
183
|
+
"value",
|
|
184
|
+
"onChange"
|
|
237
185
|
]);
|
|
238
186
|
const theme = styles.useTheme();
|
|
239
187
|
const presetSx = resolvePreset.resolvePreset("Select", preset, theme);
|
|
240
|
-
const isRHFMode = "control" in
|
|
188
|
+
const isRHFMode = "control" in props && props.control !== void 0;
|
|
241
189
|
const customRender = React.useMemo(() => {
|
|
242
190
|
var _a2;
|
|
243
191
|
if (React.Children.count(children) === 1) {
|
|
@@ -248,119 +196,49 @@ function Select(props) {
|
|
|
248
196
|
}
|
|
249
197
|
return null;
|
|
250
198
|
}, [children]);
|
|
251
|
-
const [search, setSearch] = React.useState("");
|
|
252
|
-
const [asyncOptions, setAsyncOptions] = React.useState([]);
|
|
253
|
-
const [loading, setLoading] = React.useState(false);
|
|
254
|
-
const debounceTimerRef = React.useRef(null);
|
|
255
|
-
const searchInputRef = React.useRef(null);
|
|
256
199
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
257
200
|
const [isFocused, setIsFocused] = React.useState(false);
|
|
258
|
-
const
|
|
259
|
-
const currentOptions = isAsync ? asyncOptions : options;
|
|
260
|
-
React.useEffect(() => {
|
|
261
|
-
var _a2;
|
|
262
|
-
if (!isAsync) return;
|
|
263
|
-
if (debounceTimerRef.current) clearTimeout(debounceTimerRef.current);
|
|
264
|
-
if (search) {
|
|
265
|
-
setLoading(true);
|
|
266
|
-
debounceTimerRef.current = window.setTimeout(() => {
|
|
267
|
-
loadOptions(search).then(setAsyncOptions).finally(() => {
|
|
268
|
-
var _a3;
|
|
269
|
-
setLoading(false);
|
|
270
|
-
(_a3 = searchInputRef.current) == null ? void 0 : _a3.focus();
|
|
271
|
-
});
|
|
272
|
-
}, debounceTimeout);
|
|
273
|
-
} else {
|
|
274
|
-
setAsyncOptions([]);
|
|
275
|
-
setLoading(false);
|
|
276
|
-
(_a2 = searchInputRef.current) == null ? void 0 : _a2.focus();
|
|
277
|
-
}
|
|
278
|
-
}, [search, isAsync, loadOptions, debounceTimeout]);
|
|
201
|
+
const [searchText, setSearchText] = React.useState("");
|
|
279
202
|
const filteredOptions = React.useMemo(() => {
|
|
280
|
-
if (
|
|
281
|
-
|
|
282
|
-
return
|
|
283
|
-
}, [
|
|
284
|
-
const groupedOptions = React.useMemo(
|
|
285
|
-
|
|
203
|
+
if (!filterable || !searchText.trim()) return options;
|
|
204
|
+
const q = searchText.trim().toLowerCase();
|
|
205
|
+
return options.filter((opt) => opt.label.toLowerCase().includes(q));
|
|
206
|
+
}, [options, filterable, searchText]);
|
|
207
|
+
const groupedOptions = React.useMemo(
|
|
208
|
+
() => groupOptions(filteredOptions),
|
|
209
|
+
[filteredOptions]
|
|
210
|
+
);
|
|
211
|
+
const buildMenuItems = (currentValue) => {
|
|
286
212
|
const items = [];
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
items.push(
|
|
303
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.MenuItem, { disabled: true, children: /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
304
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 20 }),
|
|
305
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.Typography, { children: loadingMessage })
|
|
306
|
-
] }) }, "loading-message")
|
|
307
|
-
);
|
|
308
|
-
} else if (noOptions) {
|
|
309
|
-
items.push(
|
|
310
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.MenuItem, { disabled: true, children: /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { children: noOptionsMessage }) }, "no-options-message")
|
|
311
|
-
);
|
|
312
|
-
} else {
|
|
313
|
-
Object.entries(groupedOptions).forEach(([group, opts]) => {
|
|
314
|
-
if (group !== "__default") {
|
|
315
|
-
items.push(
|
|
316
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.ListSubheader, { disableSticky: true, children: group }, group)
|
|
317
|
-
);
|
|
318
|
-
}
|
|
319
|
-
opts.forEach((opt) => {
|
|
320
|
-
var _a2;
|
|
321
|
-
const isSelected = multiple ? (_a2 = value == null ? void 0 : value.includes(opt.value)) != null ? _a2 : false : value === opt.value;
|
|
322
|
-
items.push(
|
|
323
|
-
renderSelectMenuItem({
|
|
324
|
-
option: opt,
|
|
325
|
-
selected: isSelected,
|
|
326
|
-
customRender
|
|
327
|
-
})
|
|
328
|
-
);
|
|
329
|
-
});
|
|
213
|
+
Object.entries(groupedOptions).forEach(([group, opts]) => {
|
|
214
|
+
if (group !== "__default") {
|
|
215
|
+
items.push(
|
|
216
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.ListSubheader, { disableSticky: true, children: group }, group)
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
opts.forEach((opt) => {
|
|
220
|
+
const selected = Array.isArray(currentValue) ? currentValue.includes(opt.value) : currentValue === opt.value;
|
|
221
|
+
items.push(
|
|
222
|
+
renderSelectMenuItem({
|
|
223
|
+
option: opt,
|
|
224
|
+
selected,
|
|
225
|
+
customRender
|
|
226
|
+
})
|
|
227
|
+
);
|
|
330
228
|
});
|
|
331
|
-
}
|
|
229
|
+
});
|
|
332
230
|
return items;
|
|
333
|
-
}, [
|
|
334
|
-
groupedOptions,
|
|
335
|
-
customRender,
|
|
336
|
-
filterable,
|
|
337
|
-
isAsync,
|
|
338
|
-
search,
|
|
339
|
-
loading,
|
|
340
|
-
loadingMessage,
|
|
341
|
-
noOptionsMessage,
|
|
342
|
-
multiple,
|
|
343
|
-
value
|
|
344
|
-
]);
|
|
345
|
-
const handleChangeInternal = (event, rhfOnChange) => {
|
|
346
|
-
const newValue = event.target.value;
|
|
347
|
-
if (isRHFMode) {
|
|
348
|
-
rhfOnChange == null ? void 0 : rhfOnChange(newValue);
|
|
349
|
-
} else {
|
|
350
|
-
onChange == null ? void 0 : onChange(newValue);
|
|
351
|
-
}
|
|
352
231
|
};
|
|
353
232
|
const mergedSx = [
|
|
354
|
-
buildSelectSx(borderRadius, labelPosition),
|
|
355
|
-
...
|
|
356
|
-
...Array.isArray(sx) ? sx : [sx]
|
|
233
|
+
...presetSx ? [presetSx] : [buildSelectSx(borderRadius, labelPosition)],
|
|
234
|
+
...Array.isArray(sx) ? sx : sx ? [sx] : []
|
|
357
235
|
];
|
|
358
|
-
const renderSelect = (selectValue, selectOnChange, onBlur, inputRef, rhfError, rhfHelperText) => {
|
|
359
|
-
const finalError = rhfError
|
|
236
|
+
const renderSelect = (selectValue, selectOnChange, onBlur, inputRef, rhfError, rhfHelperText, onValuesChange) => {
|
|
237
|
+
const finalError = !!rhfError || !!error;
|
|
360
238
|
const finalHelperText = rhfHelperText != null ? rhfHelperText : helperText;
|
|
361
|
-
const inputElement = labelPosition === "floating" ? /* @__PURE__ */ jsxRuntime.jsx(material.OutlinedInput, { label }) : /* @__PURE__ */ jsxRuntime.jsx(material.OutlinedInput, {});
|
|
362
|
-
const normalizedValue = normalizeSelectValue(selectValue
|
|
363
|
-
const isEmpty = isSelectValueEmpty(normalizedValue
|
|
239
|
+
const inputElement = variant === "filled" ? /* @__PURE__ */ jsxRuntime.jsx(material.FilledInput, {}) : labelPosition === "floating" ? /* @__PURE__ */ jsxRuntime.jsx(material.OutlinedInput, { label }) : /* @__PURE__ */ jsxRuntime.jsx(material.OutlinedInput, {});
|
|
240
|
+
const normalizedValue = multiple ? selectValue != null ? selectValue : [] : normalizeSelectValue(selectValue);
|
|
241
|
+
const isEmpty = multiple ? normalizedValue.length === 0 : isSelectValueEmpty(normalizedValue);
|
|
364
242
|
const shouldShrink = !isEmpty || isFocused || isOpen;
|
|
365
243
|
const shouldDisplayPlaceholder = isEmpty && (isFocused || isOpen) && !!placeholder;
|
|
366
244
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -368,18 +246,18 @@ function Select(props) {
|
|
|
368
246
|
{
|
|
369
247
|
fullWidth: true,
|
|
370
248
|
size,
|
|
249
|
+
variant,
|
|
371
250
|
error: finalError,
|
|
372
251
|
disabled,
|
|
373
252
|
className,
|
|
374
253
|
sx: mergedSx,
|
|
375
254
|
children: [
|
|
376
255
|
label && /* @__PURE__ */ jsxRuntime.jsx(material.InputLabel, { shrink: shouldShrink, children: label }),
|
|
377
|
-
/* @__PURE__ */ jsxRuntime.
|
|
256
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
378
257
|
material.Select,
|
|
379
258
|
__spreadProps(__spreadValues({
|
|
380
|
-
value: normalizedValue,
|
|
381
|
-
defaultValue,
|
|
382
259
|
multiple,
|
|
260
|
+
value: normalizedValue,
|
|
383
261
|
onChange: selectOnChange,
|
|
384
262
|
onBlur: (e) => {
|
|
385
263
|
setIsFocused(false);
|
|
@@ -387,19 +265,22 @@ function Select(props) {
|
|
|
387
265
|
},
|
|
388
266
|
onFocus: () => setIsFocused(true),
|
|
389
267
|
onOpen: () => setIsOpen(true),
|
|
390
|
-
onClose: () =>
|
|
268
|
+
onClose: () => {
|
|
269
|
+
setIsOpen(false);
|
|
270
|
+
if (filterable) setSearchText("");
|
|
271
|
+
},
|
|
391
272
|
renderValue: (selected) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
392
273
|
SelectValue,
|
|
393
274
|
{
|
|
394
275
|
selected,
|
|
395
|
-
options
|
|
276
|
+
options,
|
|
396
277
|
multiple,
|
|
397
278
|
placeholder,
|
|
398
279
|
maxChipsToShow,
|
|
399
280
|
chipVariant,
|
|
400
281
|
renderChipLabel,
|
|
401
|
-
currentValues:
|
|
402
|
-
onDeleteChip:
|
|
282
|
+
currentValues: multiple ? selected : void 0,
|
|
283
|
+
onDeleteChip: onValuesChange
|
|
403
284
|
}
|
|
404
285
|
),
|
|
405
286
|
displayEmpty: shouldDisplayPlaceholder,
|
|
@@ -412,7 +293,33 @@ function Select(props) {
|
|
|
412
293
|
},
|
|
413
294
|
inputRef
|
|
414
295
|
}, rest), {
|
|
415
|
-
children:
|
|
296
|
+
children: [
|
|
297
|
+
filterable && /* @__PURE__ */ jsxRuntime.jsx(
|
|
298
|
+
material.Box,
|
|
299
|
+
{
|
|
300
|
+
sx: { px: 1.5, py: 1, position: "sticky", top: 0, zIndex: 1, bgcolor: "background.paper" },
|
|
301
|
+
onClick: (e) => e.stopPropagation(),
|
|
302
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
303
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
304
|
+
material.TextField,
|
|
305
|
+
{
|
|
306
|
+
size: "small",
|
|
307
|
+
fullWidth: true,
|
|
308
|
+
autoFocus: true,
|
|
309
|
+
placeholder: "Buscar...",
|
|
310
|
+
value: searchText,
|
|
311
|
+
onChange: (e) => setSearchText(e.target.value),
|
|
312
|
+
slotProps: {
|
|
313
|
+
input: {
|
|
314
|
+
startAdornment: /* @__PURE__ */ jsxRuntime.jsx(material.InputAdornment, { position: "start", children: /* @__PURE__ */ jsxRuntime.jsx(SearchIcon, { fontSize: "small" }) })
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
)
|
|
319
|
+
}
|
|
320
|
+
),
|
|
321
|
+
buildMenuItems(normalizedValue)
|
|
322
|
+
]
|
|
416
323
|
})
|
|
417
324
|
),
|
|
418
325
|
finalHelperText && /* @__PURE__ */ jsxRuntime.jsx(material.FormHelperText, { children: finalHelperText })
|
|
@@ -421,26 +328,48 @@ function Select(props) {
|
|
|
421
328
|
);
|
|
422
329
|
};
|
|
423
330
|
if (isRHFMode) {
|
|
424
|
-
const
|
|
331
|
+
const { name, control, validation, onValueChange } = props;
|
|
425
332
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
426
333
|
reactHookForm.Controller,
|
|
427
334
|
{
|
|
428
|
-
name
|
|
429
|
-
control
|
|
430
|
-
rules:
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
335
|
+
name,
|
|
336
|
+
control,
|
|
337
|
+
rules: validation,
|
|
338
|
+
defaultValue,
|
|
339
|
+
render: ({ field, fieldState: { error: fieldError } }) => {
|
|
340
|
+
var _a2;
|
|
341
|
+
return renderSelect(
|
|
342
|
+
(_a2 = field.value) != null ? _a2 : null,
|
|
343
|
+
(e) => {
|
|
344
|
+
const next = e.target.value;
|
|
345
|
+
field.onChange(next);
|
|
346
|
+
onValueChange == null ? void 0 : onValueChange(next);
|
|
347
|
+
},
|
|
348
|
+
field.onBlur,
|
|
349
|
+
field.ref,
|
|
350
|
+
!!fieldError,
|
|
351
|
+
fieldError == null ? void 0 : fieldError.message,
|
|
352
|
+
(nextVals) => {
|
|
353
|
+
field.onChange(nextVals);
|
|
354
|
+
onValueChange == null ? void 0 : onValueChange(nextVals);
|
|
355
|
+
}
|
|
356
|
+
);
|
|
357
|
+
}
|
|
439
358
|
}
|
|
440
359
|
);
|
|
441
360
|
}
|
|
442
|
-
|
|
361
|
+
const { value, onChange } = props;
|
|
362
|
+
const handleChange = onChange;
|
|
363
|
+
return renderSelect(
|
|
364
|
+
value,
|
|
365
|
+
(e) => handleChange(e.target.value),
|
|
366
|
+
void 0,
|
|
367
|
+
void 0,
|
|
368
|
+
void 0,
|
|
369
|
+
void 0,
|
|
370
|
+
(next) => onChange(next)
|
|
371
|
+
);
|
|
443
372
|
}
|
|
444
373
|
exports.Option = Option;
|
|
445
374
|
exports.Select = Select;
|
|
446
|
-
//# sourceMappingURL=Select-
|
|
375
|
+
//# sourceMappingURL=Select-CURrHSyl.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Select-CURrHSyl.cjs","sources":["../src/components/Select/Select.sx.ts","../src/components/Select/Select.helpers.ts","../src/components/Select/_parts/SelectMenuItem.tsx","../src/components/Select/_parts/SelectValue.tsx","../src/components/Select/Select.tsx"],"sourcesContent":["import type { SelectProps as MuiSelectProps } from '@mui/material';\n\nimport { buildFormFieldSx } from '../_shared/formField.sx';\nimport type { LabelPosition } from './Select';\n\n/**\n * Builder de sx para el Select. Usa el builder compartido\n * `buildFormFieldSx`. El Select no necesita overrides específicos.\n */\nexport const buildSelectSx = (\n borderRadius: number | string,\n labelPosition: LabelPosition,\n): MuiSelectProps['sx'] =>\n buildFormFieldSx({ borderRadius, labelPosition }) as MuiSelectProps['sx'];\n","import type { SelectOption } from './Select';\n\n/**\n * Agrupa opciones por la propiedad `group`. Las opciones sin group caen\n * bajo la key especial `__default`. Devuelve un Record para iterar en orden\n * de inserción con Object.entries.\n */\nexport const groupOptions = (\n options: SelectOption[],\n): Record<string, SelectOption[]> => {\n const groups: Record<string, SelectOption[]> = {};\n options.forEach((opt) => {\n const group = opt.group || '__default';\n if (!groups[group]) groups[group] = [];\n groups[group].push(opt);\n });\n return groups;\n};\n\n/**\n * Normaliza el valor single al shape que espera MUI Select: string vacío si\n * el valor es `null`/`undefined`.\n */\nexport const normalizeSelectValue = <T>(value: T | null | undefined): T | '' =>\n (value ?? '') as T | '';\n\n/** `true` si el valor está vacío (para shrink del label + placeholder). */\nexport const isSelectValueEmpty = (normalizedValue: unknown): boolean =>\n normalizedValue === '' ||\n normalizedValue === null ||\n normalizedValue === undefined;\n","import React from 'react';\nimport { ListItemIcon, MenuItem } from '@mui/material';\nimport CheckIcon from '@mui/icons-material/Check';\n\nimport type { SelectOption, RenderOptionItem } from '../Select';\n\ninterface RenderSelectMenuItemArgs {\n option: SelectOption;\n selected: boolean;\n customRender?: RenderOptionItem | null;\n}\n\n/**\n * Render helper (no componente) que devuelve un <MenuItem> listo para\n * colocarse como hijo directo del <MuiSelect>. Se implementa como función\n * y no como componente porque MUI Select inspecciona `props.value` de sus\n * children para resolver la selección, y envolverlo en un componente extra\n * rompe esa detección.\n *\n * Incluye el icono de check a la izquierda cuando `selected` es true. Si el\n * consumer pasó un `<Option>{(opt) => ...}</Option>`, usa ese render para el\n * contenido principal; de lo contrario muestra `option.label`.\n */\nexport const renderSelectMenuItem = ({\n option,\n selected,\n customRender,\n}: RenderSelectMenuItemArgs): React.ReactElement => (\n <MenuItem\n key={String(option.value)}\n value={option.value}\n disabled={option.disabled}\n selected={selected}\n >\n <ListItemIcon sx={{ minWidth: 32 }}>\n {selected && <CheckIcon color=\"success\" fontSize=\"small\" />}\n </ListItemIcon>\n {customRender ? customRender(option) : option.label}\n </MenuItem>\n);\n","import { Avatar, Box, Chip, Typography } from '@mui/material';\nimport ClearIcon from '@mui/icons-material/Clear';\n\nimport type {\n SelectOption,\n RenderChipLabel,\n ChipVariant,\n} from '../Select';\n\ninterface SelectValueProps<TValue extends SelectOption['value']> {\n selected: TValue | TValue[] | null | undefined;\n options: SelectOption[];\n multiple: boolean;\n placeholder?: string;\n maxChipsToShow: number;\n chipVariant: ChipVariant;\n renderChipLabel?: RenderChipLabel;\n /** Solo relevante en modo multiple. Recibe el nuevo array de valores. */\n onDeleteChip?: (nextValues: TValue[]) => void;\n /** Array de valores actuales (para componer el nuevo array al borrar chips). */\n currentValues?: TValue[];\n}\n\n/**\n * Render del valor seleccionado del Select.\n * - single: texto (label) o lo que devuelva `renderChipLabel`.\n * - multiple: chips con delete. Trunca después de `maxChipsToShow` mostrando \"+N más\".\n * - empty: placeholder en color disabled.\n */\nexport function SelectValue<TValue extends SelectOption['value']>(\n props: SelectValueProps<TValue>,\n) {\n const {\n selected,\n options,\n multiple,\n placeholder,\n maxChipsToShow,\n chipVariant,\n renderChipLabel,\n onDeleteChip,\n currentValues,\n } = props;\n\n const isEmpty =\n !selected || (Array.isArray(selected) && selected.length === 0);\n\n if (isEmpty) {\n return (\n <Typography sx={{ color: 'text.disabled' }}>{placeholder || ''}</Typography>\n );\n }\n\n if (!multiple) {\n const item = options.find((opt) => opt.value === selected);\n if (renderChipLabel && item) return <>{renderChipLabel(item)}</>;\n return <>{item?.label ?? String(selected)}</>;\n }\n\n const selectedValuesArray = selected as TValue[];\n const displayedChips = selectedValuesArray.slice(0, maxChipsToShow);\n const hiddenChipsCount = selectedValuesArray.length - maxChipsToShow;\n\n const handleDelete = (chipValue: TValue) => {\n if (!onDeleteChip || !currentValues) return;\n onDeleteChip(currentValues.filter((v) => v !== chipValue));\n };\n\n return (\n <Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 0.5 }}>\n {displayedChips.map((val) => {\n const item = options.find((o) => o.value === val);\n if (!item) return null;\n\n return (\n <Chip\n variant={chipVariant}\n color=\"primary\"\n size=\"small\"\n key={String(val)}\n label={renderChipLabel ? renderChipLabel(item) : item.label}\n avatar={item.img ? <Avatar src={item.img} /> : undefined}\n onDelete={() => handleDelete(val)}\n deleteIcon={<ClearIcon fontSize=\"small\" />}\n />\n );\n })}\n {hiddenChipsCount > 0 && (\n <Chip size=\"small\" variant={chipVariant} label={`+${hiddenChipsCount} más`} />\n )}\n </Box>\n );\n}\n\nexport default SelectValue;\n","import {\n Children,\n isValidElement,\n useMemo,\n useState,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport {\n FilledInput,\n FormControl,\n FormHelperText,\n InputLabel,\n ListSubheader,\n OutlinedInput,\n Select as MuiSelect,\n TextField,\n InputAdornment,\n Box,\n type SelectChangeEvent,\n type SelectProps as MuiSelectProps,\n} from '@mui/material';\nimport SearchIcon from '@mui/icons-material/Search';\nimport { useTheme } from '@mui/material/styles';\nimport { Controller, type Control, type RegisterOptions } from 'react-hook-form';\n\nimport { buildSelectSx } from './Select.sx';\nimport { resolvePreset } from '../_shared/resolvePreset';\nimport {\n groupOptions,\n isSelectValueEmpty,\n normalizeSelectValue,\n} from './Select.helpers';\nimport { renderSelectMenuItem } from './_parts/SelectMenuItem';\nimport { SelectValue } from './_parts/SelectValue';\n\n// ── Tipos de dominio ─────────────────────────────────────────────────────\nexport interface SelectOption {\n value: string | number;\n label: string;\n img?: string;\n disabled?: boolean;\n group?: string;\n [key: string]: any;\n}\n\nexport type LabelPosition = 'outside' | 'floating';\nexport type SelectSize = 'small' | 'medium';\n\n// ── Render slots ─────────────────────────────────────────────────────────\nexport type RenderOptionItem = (item: SelectOption) => ReactNode;\n\n/** Variante visual de los chips en modo `multiple`. */\nexport type ChipVariant = 'filled' | 'outlined';\n/** Render custom del label de cada chip/valor seleccionado. */\nexport type RenderChipLabel = (item: SelectOption) => ReactNode;\n\n// ── Sub-componente declarativo <Option> ──────────────────────────────────\nexport interface OptionProps {\n children: RenderOptionItem;\n}\n\n// ── Props base ───────────────────────────────────────────────────────────\nexport interface BaseSelectProps<\n TValue extends SelectOption['value'] = SelectOption['value'],\n> {\n label?: string;\n options?: SelectOption[];\n defaultValue?: TValue;\n size?: SelectSize;\n placeholder?: string;\n children?: ReactElement<{ children: RenderOptionItem }>;\n maxHeight?: number | string;\n maxWidth?: number | string;\n /** Si `true`, muestra un buscador arriba del menú para filtrar opciones. */\n filterable?: boolean;\n disabled?: boolean;\n error?: boolean;\n helperText?: string;\n /** Border radius del input (px o string CSS). Default: 10 */\n borderRadius?: number | string;\n /**\n * Posición del label.\n * - \"outside\" (default): label arriba del input, sin animación.\n * - \"floating\": label clásico de MUI (flota dentro del notched outline).\n */\n labelPosition?: LabelPosition;\n /**\n * Nombre del preset de estilo registrado en `theme.styles.Select`.\n * - `\"default\"` (o ausente) = estilo built-in del paquete.\n * - Cualquier otro string = mergea el preset encima del estilo built-in.\n */\n preset?: string;\n /** MUI input variant. Default: 'outlined'. */\n variant?: 'outlined' | 'filled';\n sx?: MuiSelectProps['sx'];\n className?: string;\n}\n\n// ── Variantes discriminadas (RHF vs controlado) ──────────────────────────\nexport interface RHFSelectProps<\n TValue extends SelectOption['value'] = SelectOption['value'],\n> extends BaseSelectProps<TValue> {\n name: string;\n // `any` plano (no `Control<any>`): RHF tipa `Control<T>` con generics en\n // posiciones tanto contravariantes como covariantes (ej. `_subjects.state`).\n // Cuando el componente tiene generics propios (como `TValue` acá), TS se\n // confunde narroweando el discriminated union y `Control<any>` no logra\n // absorber `Control<MyForm>` en la comparación estructural profunda.\n // El `any` plano elimina ese ruido. RHF adentro sigue teniendo sus tipos\n // fuertes — solo degradamos la superficie del prop del Select.\n control: any;\n validation?: RegisterOptions;\n /**\n * Side-effect que corre después de que RHF actualiza el form state.\n * Útil para cascadas entre campos (ej. reset de municipio al cambiar\n * departamento). NO reemplaza al handler de RHF.\n */\n onValueChange?: (value: TValue) => void;\n multiple?: false;\n value?: never;\n onChange?: never;\n}\n\nexport interface StandardSelectProps<\n TValue extends SelectOption['value'] = SelectOption['value'],\n> extends BaseSelectProps<TValue> {\n name?: string;\n control?: never;\n validation?: never;\n multiple?: false;\n value: TValue;\n onChange: (val: TValue) => void;\n}\n\nexport interface MultipleSelectProps<\n TValue extends SelectOption['value'] = SelectOption['value'],\n> extends BaseSelectProps<TValue> {\n name?: string;\n control?: never;\n validation?: never;\n multiple: true;\n value: TValue[];\n onChange: (val: TValue[]) => void;\n /** Máximo de chips visibles antes de truncar con \"+N más\". Default: 3. */\n maxChipsToShow?: number;\n /** Variante visual de los chips. Default: 'filled'. */\n chipVariant?: ChipVariant;\n /** Render custom del label de cada chip. */\n renderChipLabel?: RenderChipLabel;\n}\n\n// ── API pública final ────────────────────────────────────────────────────\nexport type SelectProps<\n TValue extends SelectOption['value'] = SelectOption['value'],\n> =\n | RHFSelectProps<TValue>\n | StandardSelectProps<TValue>\n | MultipleSelectProps<TValue>;\n\n// ── Sub-componente declarativo <Option> ──────────────────────────────────\nexport function Option(_props: OptionProps) {\n return null;\n}\nOption.displayName = 'Option';\n\n// ── Componente ───────────────────────────────────────────────────────────\nexport function Select<\n TValue extends SelectOption['value'] = SelectOption['value'],\n>(props: SelectProps<TValue>) {\n const {\n label,\n options = [],\n defaultValue,\n size = 'small',\n placeholder,\n children,\n maxHeight = 300,\n maxWidth,\n disabled = false,\n error = false,\n helperText,\n borderRadius = 10,\n labelPosition = 'outside',\n preset,\n variant = 'outlined',\n sx,\n className,\n multiple = false,\n maxChipsToShow = 3,\n chipVariant = 'filled',\n renderChipLabel,\n filterable = false,\n // Separamos estos aunque no se usen directamente acá — evita que lleguen\n // al DOM del MuiSelect via `{...rest}` y generen warnings de React.\n name: _nameIgnored,\n control: _controlIgnored,\n validation: _validationIgnored,\n value: _valueIgnored,\n onChange: _onChangeIgnored,\n ...rest\n } = props as StandardSelectProps<TValue> & {\n name?: string;\n control?: Control<any>;\n validation?: RegisterOptions;\n multiple?: boolean;\n maxChipsToShow?: number;\n chipVariant?: ChipVariant;\n renderChipLabel?: RenderChipLabel;\n filterable?: boolean;\n };\n\n const theme = useTheme();\n const presetSx = resolvePreset('Select', preset, theme);\n\n const isRHFMode = 'control' in props && (props as RHFSelectProps<TValue>).control !== undefined;\n\n // Custom render opcional vía <Option>{item => ...}</Option>\n const customRender: RenderOptionItem | null = useMemo(() => {\n if (Children.count(children) === 1) {\n const child = Children.only(children);\n if (isValidElement(child) && (child.type as any)?.displayName === 'Option') {\n return (child.props as OptionProps).children;\n }\n }\n return null;\n }, [children]);\n\n // Focus/open tracking para el comportamiento del label \"outside\".\n const [isOpen, setIsOpen] = useState(false);\n const [isFocused, setIsFocused] = useState(false);\n // Texto del buscador (modo `filterable`).\n const [searchText, setSearchText] = useState('');\n\n const filteredOptions = useMemo(() => {\n if (!filterable || !searchText.trim()) return options;\n const q = searchText.trim().toLowerCase();\n return options.filter((opt) => opt.label.toLowerCase().includes(q));\n }, [options, filterable, searchText]);\n\n const groupedOptions = useMemo(\n () => groupOptions(filteredOptions),\n [filteredOptions],\n );\n\n // Items del menú (grupos + opciones). El buscador se inyecta aparte.\n const buildMenuItems = (currentValue: TValue | TValue[] | '') => {\n const items: ReactNode[] = [];\n Object.entries(groupedOptions).forEach(([group, opts]) => {\n if (group !== '__default') {\n items.push(\n <ListSubheader key={group} disableSticky>\n {group}\n </ListSubheader>,\n );\n }\n opts.forEach((opt) => {\n const selected = Array.isArray(currentValue)\n ? currentValue.includes(opt.value as TValue)\n : currentValue === opt.value;\n items.push(\n renderSelectMenuItem({\n option: opt,\n selected,\n customRender,\n }),\n );\n });\n });\n return items;\n };\n\n const mergedSx = [\n ...(presetSx ? [presetSx] : [buildSelectSx(borderRadius, labelPosition)]),\n ...(Array.isArray(sx) ? sx : sx ? [sx] : []),\n ];\n\n // Render base (común a RHF y controlled)\n const renderSelect = (\n selectValue: TValue | TValue[] | null | undefined,\n selectOnChange: (event: SelectChangeEvent<TValue | TValue[]>) => void,\n onBlur?: (event: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void,\n inputRef?: React.Ref<HTMLInputElement>,\n rhfError?: boolean,\n rhfHelperText?: string,\n onValuesChange?: (next: TValue[]) => void,\n ) => {\n const finalError = !!rhfError || !!error;\n const finalHelperText = rhfHelperText ?? helperText;\n\n const inputElement =\n variant === 'filled'\n ? <FilledInput />\n : labelPosition === 'floating'\n ? <OutlinedInput label={label} />\n : <OutlinedInput />;\n\n const normalizedValue = multiple\n ? ((selectValue as TValue[] | null | undefined) ?? [])\n : normalizeSelectValue(selectValue as TValue | null | undefined);\n const isEmpty = multiple\n ? (normalizedValue as TValue[]).length === 0\n : isSelectValueEmpty(normalizedValue);\n\n // Shrink cuando hay valor, foco, o dropdown abierto.\n const shouldShrink = !isEmpty || isFocused || isOpen;\n // Placeholder solo cuando el label ya subió.\n const shouldDisplayPlaceholder =\n isEmpty && (isFocused || isOpen) && !!placeholder;\n\n return (\n <FormControl\n fullWidth\n size={size}\n variant={variant}\n error={finalError}\n disabled={disabled}\n className={className}\n sx={mergedSx}\n >\n {label && <InputLabel shrink={shouldShrink}>{label}</InputLabel>}\n <MuiSelect<TValue | TValue[]>\n multiple={multiple}\n value={normalizedValue as TValue | TValue[]}\n onChange={selectOnChange}\n onBlur={(e) => {\n setIsFocused(false);\n onBlur?.(e);\n }}\n onFocus={() => setIsFocused(true)}\n onOpen={() => setIsOpen(true)}\n onClose={() => {\n setIsOpen(false);\n if (filterable) setSearchText('');\n }}\n renderValue={(selected) => (\n <SelectValue<TValue>\n selected={selected as TValue | TValue[]}\n options={options}\n multiple={multiple}\n placeholder={placeholder}\n maxChipsToShow={maxChipsToShow}\n chipVariant={chipVariant}\n renderChipLabel={renderChipLabel}\n currentValues={multiple ? (selected as TValue[]) : undefined}\n onDeleteChip={onValuesChange}\n />\n )}\n displayEmpty={shouldDisplayPlaceholder}\n input={inputElement}\n disabled={disabled}\n MenuProps={{\n PaperProps: {\n style: { maxHeight, maxWidth },\n },\n }}\n inputRef={inputRef}\n {...(rest as any)}\n >\n {filterable && (\n <Box\n sx={{ px: 1.5, py: 1, position: 'sticky', top: 0, zIndex: 1, bgcolor: 'background.paper' }}\n onClick={(e) => e.stopPropagation()}\n onKeyDown={(e) => e.stopPropagation()}\n >\n <TextField\n size=\"small\"\n fullWidth\n autoFocus\n placeholder=\"Buscar...\"\n value={searchText}\n onChange={(e) => setSearchText(e.target.value)}\n slotProps={{\n input: {\n startAdornment: (\n <InputAdornment position=\"start\">\n <SearchIcon fontSize=\"small\" />\n </InputAdornment>\n ),\n },\n }}\n />\n </Box>\n )}\n {buildMenuItems(normalizedValue as TValue | TValue[] | '')}\n </MuiSelect>\n {finalHelperText && <FormHelperText>{finalHelperText}</FormHelperText>}\n </FormControl>\n );\n };\n\n // ── RHF mode ──────────────────────────────────────────────────────────\n if (isRHFMode) {\n const { name, control, validation, onValueChange } = props as RHFSelectProps<TValue>;\n return (\n <Controller\n name={name}\n control={control}\n rules={validation}\n defaultValue={defaultValue}\n render={({ field, fieldState: { error: fieldError } }) =>\n renderSelect(\n field.value ?? null,\n (e) => {\n const next = e.target.value as TValue;\n field.onChange(next);\n onValueChange?.(next);\n },\n field.onBlur,\n field.ref,\n !!fieldError,\n fieldError?.message,\n (nextVals) => {\n field.onChange(nextVals);\n onValueChange?.(nextVals as unknown as TValue);\n },\n )\n }\n />\n );\n }\n\n // ── Controlled mode (single o multiple) ───────────────────────────────\n const { value, onChange } = props as\n | StandardSelectProps<TValue>\n | MultipleSelectProps<TValue>;\n const handleChange = onChange as (val: TValue | TValue[]) => void;\n return renderSelect(\n value as TValue | TValue[],\n (e) => handleChange(e.target.value as TValue | TValue[]),\n undefined,\n undefined,\n undefined,\n undefined,\n (next) => (onChange as (val: TValue[]) => void)(next),\n );\n}\n\nexport default Select;\n"],"names":["buildFormFieldSx","jsxs","MenuItem","jsx","ListItemIcon","Typography","Fragment","Box","Chip","Avatar","useTheme","resolvePreset","useMemo","Children","isValidElement","_a","useState","ListSubheader","FilledInput","OutlinedInput","FormControl","InputLabel","MuiSelect","TextField","InputAdornment","FormHelperText","Controller"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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SAAAA,gBAAA,EAAgB,UAAA,gBAAA,CAAgB;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAG3D;AAGA,MAAI,WAAW;AACb,UAAM,EAAE,MAAM,SAAS,YAAY,kBAAkB;AACrD,WACEtB,2BAAAA;AAAAA,MAACuB,cAAAA;AAAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,OAAO;AAAA,QACP;AAAA,QACA,QAAQ,CAAC,EAAE,OAAO,YAAY,EAAE,OAAO,WAAA,EAAW;;AAChD;AAAA,aACEX,MAAA,MAAM,UAAN,OAAAA,MAAe;AAAA,YACf,CAAC,MAAM;AACL,oBAAM,OAAO,EAAE,OAAO;AACtB,oBAAM,SAAS,IAAI;AACnB,6DAAgB;AAAA,YAClB;AAAA,YACA,MAAM;AAAA,YACN,MAAM;AAAA,YACN,CAAC,CAAC;AAAA,YACF,yCAAY;AAAA,YACZ,CAAC,aAAa;AACZ,oBAAM,SAAS,QAAQ;AACvB,6DAAgB;AAAA,YAClB;AAAA,UAAA;AAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAIR;AAGA,QAAM,EAAE,OAAO,SAAA,IAAa;AAG5B,QAAM,eAAe;AACrB,SAAO;AAAA,IACL;AAAA,IACA,CAAC,MAAM,aAAa,EAAE,OAAO,KAA0B;AAAA,IACvD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,CAAC,SAAU,SAAqC,IAAI;AAAA,EAAA;AAExD;;;"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
18
|
+
import { Box, Typography, CircularProgress } from "@mui/material";
|
|
19
|
+
const sizeMap = {
|
|
20
|
+
sm: 20,
|
|
21
|
+
md: 40,
|
|
22
|
+
lg: 56
|
|
23
|
+
};
|
|
24
|
+
const resolveSize = (size) => typeof size === "number" ? size : sizeMap[size];
|
|
25
|
+
function Spinner({
|
|
26
|
+
size = "md",
|
|
27
|
+
color = "primary",
|
|
28
|
+
thickness,
|
|
29
|
+
centered = false,
|
|
30
|
+
label,
|
|
31
|
+
sx,
|
|
32
|
+
className,
|
|
33
|
+
"aria-label": ariaLabel = "Cargando"
|
|
34
|
+
}) {
|
|
35
|
+
const px = resolveSize(size);
|
|
36
|
+
const spinner = /* @__PURE__ */ jsx(
|
|
37
|
+
CircularProgress,
|
|
38
|
+
{
|
|
39
|
+
size: px,
|
|
40
|
+
color,
|
|
41
|
+
thickness,
|
|
42
|
+
role: "status",
|
|
43
|
+
"aria-label": ariaLabel,
|
|
44
|
+
sx: centered || label ? void 0 : sx
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
if (!centered && !label) {
|
|
48
|
+
return /* @__PURE__ */ jsx(Box, { component: "span", className, children: spinner });
|
|
49
|
+
}
|
|
50
|
+
return /* @__PURE__ */ jsxs(
|
|
51
|
+
Box,
|
|
52
|
+
{
|
|
53
|
+
className,
|
|
54
|
+
sx: [
|
|
55
|
+
__spreadValues({
|
|
56
|
+
display: "flex",
|
|
57
|
+
flexDirection: "column",
|
|
58
|
+
alignItems: "center",
|
|
59
|
+
justifyContent: "center",
|
|
60
|
+
gap: 1.5
|
|
61
|
+
}, centered && { width: "100%", minHeight: 120 }),
|
|
62
|
+
...Array.isArray(sx) ? sx : sx ? [sx] : []
|
|
63
|
+
],
|
|
64
|
+
children: [
|
|
65
|
+
spinner,
|
|
66
|
+
label != null && /* @__PURE__ */ jsx(Typography, { variant: "body2", sx: { color: "text.secondary" }, children: label })
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
export {
|
|
72
|
+
Spinner as S
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=Spinner-B6sThC1p.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Spinner-B6sThC1p.js","sources":["../src/components/Spinner/Spinner.tsx"],"sourcesContent":["import { type ReactNode } from 'react';\nimport { Box, CircularProgress, Typography } from '@mui/material';\nimport type { SxProps, Theme } from '@mui/material/styles';\n\nexport type SpinnerSize = 'sm' | 'md' | 'lg' | number;\n\nexport type SpinnerColor =\n | 'primary'\n | 'secondary'\n | 'inherit'\n | 'error'\n | 'info'\n | 'success'\n | 'warning';\n\nexport interface SpinnerProps {\n /** Tamaño: `sm`=20, `md`=40, `lg`=56, o un número de px. Default: `md`. */\n size?: SpinnerSize;\n /** Color del indicador. Default: `primary`. */\n color?: SpinnerColor;\n /** Grosor del trazo. Default: 3.6 (default de MUI). */\n thickness?: number;\n /**\n * Si `true`, centra el spinner en un contenedor flex de ancho completo.\n * Útil para estados de carga de página/sección.\n */\n centered?: boolean;\n /** Texto opcional debajo del spinner. */\n label?: ReactNode;\n /** sx del contenedor (o del propio spinner si no hay `centered`/`label`). */\n sx?: SxProps<Theme>;\n className?: string;\n /** Texto accesible. Default: \"Cargando\". */\n 'aria-label'?: string;\n}\n\nconst sizeMap: Record<Exclude<SpinnerSize, number>, number> = {\n sm: 20,\n md: 40,\n lg: 56,\n};\n\nconst resolveSize = (size: SpinnerSize): number =>\n typeof size === 'number' ? size : sizeMap[size];\n\nexport function Spinner({\n size = 'md',\n color = 'primary',\n thickness,\n centered = false,\n label,\n sx,\n className,\n 'aria-label': ariaLabel = 'Cargando',\n}: SpinnerProps) {\n const px = resolveSize(size);\n\n const spinner = (\n <CircularProgress\n size={px}\n color={color}\n thickness={thickness}\n role=\"status\"\n aria-label={ariaLabel}\n // Cuando no hay contenedor (ni centered ni label), el sx va al spinner.\n sx={centered || label ? undefined : sx}\n />\n );\n\n if (!centered && !label) {\n return <Box component=\"span\" className={className}>{spinner}</Box>;\n }\n\n return (\n <Box\n className={className}\n sx={[\n {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n gap: 1.5,\n ...(centered && { width: '100%', minHeight: 120 }),\n },\n ...(Array.isArray(sx) ? sx : sx ? [sx] : []),\n ]}\n >\n {spinner}\n {label != null && (\n <Typography variant=\"body2\" sx={{ color: 'text.secondary' }}>\n {label}\n </Typography>\n )}\n </Box>\n );\n}\n\nexport default Spinner;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAoCA,MAAM,UAAwD;AAAA,EAC5D,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAEA,MAAM,cAAc,CAAC,SACnB,OAAO,SAAS,WAAW,OAAO,QAAQ,IAAI;AAEzC,SAAS,QAAQ;AAAA,EACtB,OAAO;AAAA,EACP,QAAQ;AAAA,EACR;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA,cAAc,YAAY;AAC5B,GAAiB;AACf,QAAM,KAAK,YAAY,IAAI;AAE3B,QAAM,UACJ;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAM;AAAA,MACN;AAAA,MACA;AAAA,MACA,MAAK;AAAA,MACL,cAAY;AAAA,MAEZ,IAAI,YAAY,QAAQ,SAAY;AAAA,IAAA;AAAA,EAAA;AAIxC,MAAI,CAAC,YAAY,CAAC,OAAO;AACvB,WAAO,oBAAC,KAAA,EAAI,WAAU,QAAO,WAAuB,UAAA,SAAQ;AAAA,EAC9D;AAEA,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,IAAI;AAAA,QACF;AAAA,UACE,SAAS;AAAA,UACT,eAAe;AAAA,UACf,YAAY;AAAA,UACZ,gBAAgB;AAAA,UAChB,KAAK;AAAA,WACD,YAAY,EAAE,OAAO,QAAQ,WAAW,IAAA;AAAA,QAE9C,GAAI,MAAM,QAAQ,EAAE,IAAI,KAAK,KAAK,CAAC,EAAE,IAAI,CAAA;AAAA,MAAC;AAAA,MAG3C,UAAA;AAAA,QAAA;AAAA,QACA,SAAS,QACR,oBAAC,YAAA,EAAW,SAAQ,SAAQ,IAAI,EAAE,OAAO,oBACtC,UAAA,MAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR;"}
|