@soyfri/shared-library 2.0.0-beta.9 → 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-C_lW1VER.js +337 -0
- package/Autocomplete-C_lW1VER.js.map +1 -0
- package/Autocomplete-CejWztBY.cjs +336 -0
- package/Autocomplete-CejWztBY.cjs.map +1 -0
- package/Avatar-Dw5rzayR.cjs +166 -0
- package/Avatar-Dw5rzayR.cjs.map +1 -0
- package/Avatar-H8akSege.js +167 -0
- 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/{components/DateRangePicker/DateRangePicker.js → Chip-OPYQ1uQ_.js} +33 -35
- package/Chip-OPYQ1uQ_.js.map +1 -0
- package/{components/DateRangePicker/DateRangePicker.cjs → Chip-qoJLDiva.cjs} +33 -36
- package/Chip-qoJLDiva.cjs.map +1 -0
- package/DatePicker-_IGWc3I5.js +178 -0
- package/DatePicker-_IGWc3I5.js.map +1 -0
- package/DatePicker-t7uDTZMl.cjs +177 -0
- package/DatePicker-t7uDTZMl.cjs.map +1 -0
- package/DateTimePicker-BxQyjTCY.cjs +229 -0
- package/DateTimePicker-BxQyjTCY.cjs.map +1 -0
- package/DateTimePicker-CrmWav_j.js +230 -0
- 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-CScC87J5.cjs +185 -0
- package/Input-CScC87J5.cjs.map +1 -0
- package/Input-DP_fKl38.js +186 -0
- package/Input-DP_fKl38.js.map +1 -0
- package/Modal-C_QY7ZzY.js +352 -0
- package/Modal-C_QY7ZzY.js.map +1 -0
- package/Modal-D_6ZdSzw.cjs +351 -0
- package/Modal-D_6ZdSzw.cjs.map +1 -0
- package/README.md +188 -172
- package/RadioGroup-Dd0rHXSX.cjs +202 -0
- package/RadioGroup-Dd0rHXSX.cjs.map +1 -0
- package/RadioGroup-bO-ahP9T.js +203 -0
- package/RadioGroup-bO-ahP9T.js.map +1 -0
- package/Select-BY5Y0qZ1.js +376 -0
- package/Select-BY5Y0qZ1.js.map +1 -0
- package/Select-CURrHSyl.cjs +375 -0
- 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/Stat-BUcFCGrz.cjs +83 -0
- package/Stat-BUcFCGrz.cjs.map +1 -0
- package/Stat-C06A_izS.js +84 -0
- package/Stat-C06A_izS.js.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-CQFOopYy.cjs +182 -0
- package/Switch-CQFOopYy.cjs.map +1 -0
- package/Switch-D72dpkH2.js +183 -0
- 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/Table-C2LbW0B1.js +531 -0
- package/Table-C2LbW0B1.js.map +1 -0
- package/Table-C4OM6rrC.cjs +530 -0
- package/Table-C4OM6rrC.cjs.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 +3 -220
- package/components/AppBar/AppBar.cjs.map +1 -1
- package/components/AppBar/AppBar.d.ts +6 -6
- package/components/AppBar/AppBar.js +6 -223
- package/components/AppBar/AppBar.js.map +1 -1
- package/components/AppBar/index.d.ts +0 -6
- package/components/Autocomplete/Autocomplete.cjs +4 -311
- package/components/Autocomplete/Autocomplete.cjs.map +1 -1
- package/components/Autocomplete/Autocomplete.d.ts +8 -6
- package/components/Autocomplete/Autocomplete.helpers.d.ts +8 -4
- package/components/Autocomplete/Autocomplete.js +4 -311
- package/components/Autocomplete/Autocomplete.js.map +1 -1
- package/components/Autocomplete/_parts/AutocompleteOption.d.ts +5 -8
- package/components/Autocomplete/index.d.ts +1 -1
- package/components/Avatar/Avatar.cjs +2 -160
- package/components/Avatar/Avatar.cjs.map +1 -1
- package/components/Avatar/Avatar.d.ts +16 -1
- package/components/Avatar/Avatar.js +2 -160
- package/components/Avatar/Avatar.js.map +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 +4 -184
- package/components/Card/Card.cjs.map +1 -1
- package/components/Card/Card.d.ts +21 -50
- package/components/Card/Card.js +4 -184
- package/components/Card/Card.js.map +1 -1
- 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 +4 -72
- package/components/Chip/Chip.cjs.map +1 -1
- package/components/Chip/Chip.js +3 -71
- package/components/Chip/Chip.js.map +1 -1
- package/components/Chip/index.d.ts +2 -1
- package/components/Chip.d.ts +4 -0
- package/components/Column/Column.cjs +1 -1
- package/components/Column/Column.cjs.map +1 -1
- package/components/Column/Column.d.ts +1 -1
- package/components/Column/Column.js +1 -1
- package/components/Column/Column.js.map +1 -1
- package/components/Column/index.d.ts +1 -0
- package/components/DatePicker/DatePicker.cjs +3 -200
- package/components/DatePicker/DatePicker.cjs.map +1 -1
- package/components/DatePicker/DatePicker.d.ts +1 -13
- package/components/DatePicker/DatePicker.js +3 -200
- package/components/DatePicker/DatePicker.js.map +1 -1
- package/components/DatePicker/index.d.ts +1 -1
- package/components/DateTimePicker/DateTimePicker.cjs +3 -219
- package/components/DateTimePicker/DateTimePicker.cjs.map +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 +3 -219
- package/components/DateTimePicker/DateTimePicker.js.map +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 +11 -7
- package/components/Drawer/Drawer.cjs.map +1 -1
- package/components/Drawer/Drawer.js +12 -8
- 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 +3 -172
- package/components/Input/Input.cjs.map +1 -1
- package/components/Input/Input.d.ts +9 -2
- package/components/Input/Input.helpers.d.ts +3 -3
- package/components/Input/Input.js +3 -172
- package/components/Input/Input.js.map +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 +7 -317
- package/components/Modal/Modal.cjs.map +1 -1
- package/components/Modal/Modal.d.ts +27 -5
- package/components/Modal/Modal.js +6 -316
- package/components/Modal/Modal.js.map +1 -1
- 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 -1
- package/components/Modal.d.ts +4 -0
- package/components/RadioGroup/RadioGroup.cjs +3 -199
- package/components/RadioGroup/RadioGroup.cjs.map +1 -1
- package/components/RadioGroup/RadioGroup.d.ts +9 -3
- package/components/RadioGroup/RadioGroup.js +3 -199
- package/components/RadioGroup/RadioGroup.js.map +1 -1
- package/components/RadioGroup/index.d.ts +1 -1
- package/components/Select/Select.cjs +4 -445
- package/components/Select/Select.cjs.map +1 -1
- package/components/Select/Select.d.ts +37 -18
- package/components/Select/Select.helpers.d.ts +5 -19
- package/components/Select/Select.js +4 -445
- package/components/Select/Select.js.map +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 +4 -83
- package/components/Stat/Stat.cjs.map +1 -1
- package/components/Stat/Stat.js +3 -82
- 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 +4 -77
- package/components/StatusMessage/StatusMessage.cjs.map +1 -1
- package/components/StatusMessage/StatusMessage.d.ts +20 -36
- package/components/StatusMessage/StatusMessage.js +3 -76
- package/components/StatusMessage/StatusMessage.js.map +1 -1
- package/components/StatusMessage/index.d.ts +2 -1
- package/components/StatusMessage.d.ts +4 -0
- package/components/Stepper/Stepper.cjs +8 -90
- package/components/Stepper/Stepper.cjs.map +1 -1
- package/components/Stepper/Stepper.d.ts +9 -20
- package/components/Stepper/Stepper.js +7 -89
- package/components/Stepper/Stepper.js.map +1 -1
- package/{hooks/Wizard/WizardContext.d.ts → components/Stepper/StepperContext.d.ts} +29 -23
- 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 +3 -178
- package/components/Switch/Switch.cjs.map +1 -1
- package/components/Switch/Switch.d.ts +7 -2
- package/components/Switch/Switch.js +3 -178
- package/components/Switch/Switch.js.map +1 -1
- package/components/Table/Table.cjs +2 -528
- package/components/Table/Table.cjs.map +1 -1
- package/components/Table/Table.d.ts +1 -1
- package/components/Table/Table.js +2 -528
- package/components/Table/Table.js.map +1 -1
- package/components/Tabs/Tab.d.ts +13 -2
- package/components/Tabs/Tabs.cjs +5 -94
- package/components/Tabs/Tabs.cjs.map +1 -1
- package/components/Tabs/Tabs.d.ts +33 -16
- package/components/Tabs/Tabs.js +4 -93
- package/components/Tabs/Tabs.js.map +1 -1
- 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 +78 -10
- package/index.cjs.map +1 -1
- package/index.d.ts +42 -0
- package/index.js +70 -5
- 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 +85 -76
- package/{resolvePreset-CT3kU-K2.cjs → resolvePreset-CxTI6_Ln.cjs} +3 -3
- package/{resolvePreset-CT3kU-K2.cjs.map → resolvePreset-CxTI6_Ln.cjs.map} +1 -1
- package/{resolvePreset-B-IB0ehH.js → resolvePreset-K6_BfWHD.js} +3 -3
- package/{resolvePreset-B-IB0ehH.js.map → resolvePreset-K6_BfWHD.js.map} +1 -1
- 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/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.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.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
|
@@ -1,28 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
orientation?: "horizontal" | "vertical";
|
|
7
|
-
sx?: object;
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
export interface StepperProps {
|
|
3
|
+
/** Uno o varios `<Step>`. Children que no sean `<Step>` se ignoran. */
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
orientation?: 'horizontal' | 'vertical';
|
|
8
6
|
alternateLabel?: boolean;
|
|
9
7
|
/**
|
|
10
8
|
* Índice 0-based del paso activo. Si no se provee, el Stepper intenta
|
|
11
|
-
* leerlo del `
|
|
9
|
+
* leerlo del `StepperContext` (si está dentro de un `<StepperProvider>`).
|
|
12
10
|
* Si tampoco hay provider, el default es 0.
|
|
13
11
|
*/
|
|
14
12
|
currentStep?: number;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
* el stepper horizontal automáticamente:
|
|
18
|
-
* - cambia a orientación vertical si hay >3 steps, o
|
|
19
|
-
* - oculta los labels (solo dots) si hay ≤3 steps,
|
|
20
|
-
* para evitar que se desborde del contenedor.
|
|
21
|
-
* Si pasas `orientation="vertical"` explícito, no se altera.
|
|
22
|
-
*/
|
|
23
|
-
responsive?: boolean;
|
|
24
|
-
/** Breakpoint debajo del cual aplica el modo mobile. Default: "sm". */
|
|
25
|
-
mobileBreakpoint?: Breakpoint;
|
|
13
|
+
keepMounted?: boolean;
|
|
14
|
+
sx?: object;
|
|
26
15
|
}
|
|
27
|
-
export declare const Stepper:
|
|
16
|
+
export declare const Stepper: FC<StepperProps>;
|
|
28
17
|
export default Stepper;
|
|
@@ -1,92 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
21
|
-
import { useTheme, useMediaQuery, Box, Stepper as Stepper$1, Step as Step$1, StepLabel } from "@mui/material";
|
|
22
|
-
import { u as useWizard } from "../../useWizard-CWq--C3o.js";
|
|
23
|
-
const Stepper = ({
|
|
24
|
-
children,
|
|
25
|
-
orientation = "horizontal",
|
|
26
|
-
alternateLabel = false,
|
|
27
|
-
responsive = true,
|
|
28
|
-
mobileBreakpoint = "sm",
|
|
29
|
-
sx,
|
|
30
|
-
currentStep: currentStepProp
|
|
31
|
-
}) => {
|
|
32
|
-
const theme = useTheme();
|
|
33
|
-
const isMobile = useMediaQuery(theme.breakpoints.down(mobileBreakpoint));
|
|
34
|
-
const mobileAdapt = responsive && isMobile && orientation === "horizontal";
|
|
35
|
-
const effectiveOrientation = mobileAdapt && children.length > 3 ? "vertical" : orientation;
|
|
36
|
-
const hideLabelsOnMobile = mobileAdapt && children.length <= 3;
|
|
37
|
-
const effectiveAlternateLabel = alternateLabel && effectiveOrientation === "horizontal";
|
|
38
|
-
const wizard = useWizard();
|
|
39
|
-
const currentStep = currentStepProp !== void 0 ? currentStepProp : wizard.totalSteps > 0 ? wizard.currentStep : 0;
|
|
40
|
-
return /* @__PURE__ */ jsxs(Box, { sx: __spreadValues({ width: "100%", overflowX: "hidden" }, sx), children: [
|
|
41
|
-
/* @__PURE__ */ jsx(
|
|
42
|
-
Stepper$1,
|
|
43
|
-
{
|
|
44
|
-
activeStep: currentStep,
|
|
45
|
-
orientation: effectiveOrientation,
|
|
46
|
-
alternativeLabel: effectiveAlternateLabel,
|
|
47
|
-
sx: __spreadValues({}, effectiveOrientation === "horizontal" && {
|
|
48
|
-
flexWrap: "wrap",
|
|
49
|
-
rowGap: 1,
|
|
50
|
-
"& .MuiStepLabel-label": { textAlign: "center" }
|
|
51
|
-
}),
|
|
52
|
-
children: children.map((child, idx) => {
|
|
53
|
-
const { label, completed, disabled, className, sx: stepSx, dotColor, activeDotColor, completedDotColor, iconTextColor } = child.props;
|
|
54
|
-
return /* @__PURE__ */ jsx(Step$1, { completed, disabled, className, sx: stepSx, children: /* @__PURE__ */ jsx(
|
|
55
|
-
StepLabel,
|
|
56
|
-
{
|
|
57
|
-
sx: __spreadProps(__spreadValues({
|
|
58
|
-
pointerEvents: "none"
|
|
59
|
-
}, hideLabelsOnMobile && {
|
|
60
|
-
"& .MuiStepLabel-labelContainer": { display: "none" }
|
|
61
|
-
}), {
|
|
62
|
-
"& .MuiStepIcon-root": {
|
|
63
|
-
color: dotColor
|
|
64
|
-
},
|
|
65
|
-
"& .MuiStepIcon-active": {
|
|
66
|
-
color: activeDotColor
|
|
67
|
-
},
|
|
68
|
-
"& .MuiStepIcon-completed": {
|
|
69
|
-
color: completedDotColor
|
|
70
|
-
},
|
|
71
|
-
"& .MuiStepIcon-text": {
|
|
72
|
-
fill: iconTextColor
|
|
73
|
-
}
|
|
74
|
-
}),
|
|
75
|
-
children: label
|
|
76
|
-
}
|
|
77
|
-
) }, idx);
|
|
78
|
-
})
|
|
79
|
-
}
|
|
80
|
-
),
|
|
81
|
-
/* @__PURE__ */ jsx(Box, { mt: 2, children: children.map(
|
|
82
|
-
(child, idx) => idx === currentStep ? /* @__PURE__ */ jsx(Box, { children: child.props.children }, idx) : null
|
|
83
|
-
) })
|
|
84
|
-
] });
|
|
85
|
-
};
|
|
86
|
-
const Step = (_) => null;
|
|
87
|
-
Step.displayName = "Step";
|
|
1
|
+
import { a, S, c, b, S as S2, u } from "../../Step-BArsou1V.js";
|
|
88
2
|
export {
|
|
89
|
-
Step,
|
|
90
|
-
Stepper
|
|
3
|
+
a as Step,
|
|
4
|
+
S as Stepper,
|
|
5
|
+
c as StepperContext,
|
|
6
|
+
b as StepperProvider,
|
|
7
|
+
S2 as default,
|
|
8
|
+
u as useStepper
|
|
91
9
|
};
|
|
92
10
|
//# sourceMappingURL=Stepper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stepper.js","sources":[
|
|
1
|
+
{"version":3,"file":"Stepper.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
2
|
/**
|
|
3
|
-
* API expuesta por `
|
|
4
|
-
*
|
|
5
|
-
* Nota de retro-compatibilidad: los nombres `submitStep`, `nextStep`,
|
|
6
|
-
* `prevStep`, `goToStep` se mantienen idénticos al `WizardContext` de
|
|
7
|
-
* `@soyfri/fri-web-components` para que consumers migrando no tengan que
|
|
8
|
-
* cambiar sus llamadas. Se agregan campos extra opcionales que antes no
|
|
9
|
-
* existían (`currentStep`, `totalSteps`, `isFirst`, `isLast`, `completed`).
|
|
3
|
+
* API expuesta por `useStepper()`.
|
|
10
4
|
*/
|
|
11
|
-
export interface
|
|
5
|
+
export interface StepperContextValue {
|
|
12
6
|
/** Índice del paso actual (0-based). */
|
|
13
7
|
currentStep: number;
|
|
14
|
-
/** Total de pasos del
|
|
8
|
+
/** Total de pasos del stepper. */
|
|
15
9
|
totalSteps: number;
|
|
16
10
|
/** True si `currentStep === 0`. */
|
|
17
11
|
isFirst: boolean;
|
|
@@ -26,16 +20,25 @@ export interface WizardContextValue {
|
|
|
26
20
|
/** Salta a un paso específico (0-based). No-op si fuera de rango. */
|
|
27
21
|
goToStep: (stepNumber: number) => void;
|
|
28
22
|
/**
|
|
29
|
-
* Envía el
|
|
23
|
+
* Envía el stepper. Marca `completed = true` y dispara el callback
|
|
30
24
|
* `onSubmit` del provider. En el último paso suele reemplazar a `nextStep`.
|
|
31
25
|
*/
|
|
32
26
|
submitStep: () => void;
|
|
33
|
-
/** Resetea
|
|
27
|
+
/** Resetea al paso inicial y limpia `completed`. */
|
|
34
28
|
reset: () => void;
|
|
35
29
|
}
|
|
36
|
-
export declare const
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
export declare const StepperContext: import('react').Context<StepperContextValue>;
|
|
31
|
+
/**
|
|
32
|
+
* Hook para consumir el `StepperContext` desde cualquier descendiente de
|
|
33
|
+
* `<StepperProvider>`.
|
|
34
|
+
*
|
|
35
|
+
* Si se llama fuera de un provider, devuelve los valores por defecto (no-op)
|
|
36
|
+
* para que componentes como `<Stepper>` puedan leerlo sin romper cuando no
|
|
37
|
+
* hay provider envolvente.
|
|
38
|
+
*/
|
|
39
|
+
export declare function useStepper(): StepperContextValue;
|
|
40
|
+
export interface StepperProviderProps {
|
|
41
|
+
/** Número total de pasos. Requerido. */
|
|
39
42
|
totalSteps: number;
|
|
40
43
|
/** Paso inicial (0-based). Default: 0. */
|
|
41
44
|
initialStep?: number;
|
|
@@ -52,16 +55,19 @@ export interface WizardProviderProps {
|
|
|
52
55
|
children?: ReactNode;
|
|
53
56
|
}
|
|
54
57
|
/**
|
|
55
|
-
* Provider del
|
|
56
|
-
* no necesita gestionar estado —
|
|
58
|
+
* Provider del stepper. Administra el `currentStep` internamente. El consumer
|
|
59
|
+
* no necesita gestionar estado — solo consumirlo con `useStepper()` desde
|
|
57
60
|
* cualquier descendiente.
|
|
58
61
|
*
|
|
59
62
|
* ```tsx
|
|
60
|
-
* <
|
|
61
|
-
* <Stepper
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
63
|
+
* <StepperProvider totalSteps={3} onSubmit={handleFinalSubmit}>
|
|
64
|
+
* <Stepper>
|
|
65
|
+
* <Step label="Paso 1"><StepOne /></Step>
|
|
66
|
+
* <Step label="Paso 2"><StepTwo /></Step>
|
|
67
|
+
* <Step label="Paso 3"><StepThree /></Step>
|
|
68
|
+
* </Stepper>
|
|
69
|
+
* <StepperControls />
|
|
70
|
+
* </StepperProvider>
|
|
65
71
|
* ```
|
|
66
72
|
*/
|
|
67
|
-
export declare const
|
|
73
|
+
export declare const StepperProvider: FC<StepperProviderProps>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook interno del Stepper para manejar scroll horizontal cuando los steps
|
|
3
|
+
* no caben en el contenedor. No se exporta desde el barrel — es un detalle
|
|
4
|
+
* de implementación.
|
|
5
|
+
*
|
|
6
|
+
* @param enabled - Si el scroll está activo (típicamente sólo en orientación horizontal).
|
|
7
|
+
* @param deps - Cosas que afectan el layout y disparan un recompute (ej. cantidad de steps, paso activo).
|
|
8
|
+
*
|
|
9
|
+
* Retorna:
|
|
10
|
+
* - `scrollRef`: ref a asignar al contenedor con `overflow-x: auto`.
|
|
11
|
+
* - `canScrollLeft` / `canScrollRight`: flags para habilitar/deshabilitar flechas.
|
|
12
|
+
* - `scrollBy(delta)`: imperativo con scroll suave.
|
|
13
|
+
*/
|
|
14
|
+
export declare function useHorizontalScroll(enabled: boolean, deps?: unknown[]): {
|
|
15
|
+
scrollRef: import('react').RefObject<HTMLDivElement | null>;
|
|
16
|
+
canScrollLeft: boolean;
|
|
17
|
+
canScrollRight: boolean;
|
|
18
|
+
scrollBy: (delta: number) => void;
|
|
19
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
interface StepperScrollArrowProps {
|
|
2
|
+
direction: 'left' | 'right';
|
|
3
|
+
/** Cuando `false`, el botón está deshabilitado (por ejemplo, ya estás al inicio). */
|
|
4
|
+
enabled: boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Cuando `false`, el botón queda con `visibility: hidden` (reserva su
|
|
7
|
+
* espacio pero no se ve). Útil para que el área de scroll no se corra
|
|
8
|
+
* horizontalmente cuando no hay overflow en ningún lado.
|
|
9
|
+
*/
|
|
10
|
+
visible: boolean;
|
|
11
|
+
onClick: () => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Flecha de scroll (`<` / `>`) del Stepper horizontal. Se muestra a los
|
|
15
|
+
* costados del área scrollable cuando hay overflow. Componente privado —
|
|
16
|
+
* no se exporta del barrel.
|
|
17
|
+
*/
|
|
18
|
+
export declare const StepperScrollArrow: ({ direction, enabled, visible, onClick, }: StepperScrollArrowProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
export { default
|
|
2
|
-
export {
|
|
1
|
+
export { Stepper, default } from './Stepper';
|
|
2
|
+
export type { StepperProps } from './Stepper';
|
|
3
|
+
export { Step } from './Step';
|
|
4
|
+
export type { StepProps } from './Step';
|
|
5
|
+
export { StepperProvider, StepperContext, useStepper, } from './StepperContext';
|
|
6
|
+
export type { StepperContextValue, StepperProviderProps, } from './StepperContext';
|
package/components/Stepper.d.ts
CHANGED
|
@@ -1,181 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
-
var __objRest = (source, exclude) => {
|
|
22
|
-
var target = {};
|
|
23
|
-
for (var prop in source)
|
|
24
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
25
|
-
target[prop] = source[prop];
|
|
26
|
-
if (source != null && __getOwnPropSymbols)
|
|
27
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
28
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
29
|
-
target[prop] = source[prop];
|
|
30
|
-
}
|
|
31
|
-
return target;
|
|
32
|
-
};
|
|
33
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const reactHookForm = require("react-hook-form");
|
|
38
|
-
const resolvePreset = require("../../resolvePreset-CT3kU-K2.cjs");
|
|
39
|
-
const toRadius = (borderRadius) => typeof borderRadius === "number" ? `${borderRadius}px` : borderRadius;
|
|
40
|
-
const FOCUS_TRANSITION = "border-color 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms, box-shadow 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms";
|
|
41
|
-
const buildSwitchSx = ({
|
|
42
|
-
bordered,
|
|
43
|
-
borderRadius,
|
|
44
|
-
hasLabel,
|
|
45
|
-
error
|
|
46
|
-
}) => {
|
|
47
|
-
const radius = toRadius(borderRadius);
|
|
48
|
-
if (!bordered) {
|
|
49
|
-
return {
|
|
50
|
-
"& .MuiFormHelperText-root": { marginLeft: 0 }
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
return (theme) => ({
|
|
54
|
-
"& .MuiFormControlLabel-root": __spreadValues(__spreadProps(__spreadValues({
|
|
55
|
-
marginLeft: 0,
|
|
56
|
-
marginRight: 0,
|
|
57
|
-
paddingX: 1.5,
|
|
58
|
-
paddingY: 1.25,
|
|
59
|
-
border: `1px solid ${error ? theme.palette.error.main : theme.palette.divider}`,
|
|
60
|
-
borderRadius: radius,
|
|
61
|
-
transition: FOCUS_TRANSITION
|
|
62
|
-
}, error && {
|
|
63
|
-
boxShadow: `0 0 0 1px ${theme.palette.error.main}`
|
|
64
|
-
}), {
|
|
65
|
-
// Focus del usuario sobre el switch interno.
|
|
66
|
-
"&:focus-within": {
|
|
67
|
-
borderColor: error ? theme.palette.error.main : theme.palette.primary.main,
|
|
68
|
-
boxShadow: `0 0 0 1px ${error ? theme.palette.error.main : theme.palette.primary.main}`
|
|
69
|
-
}
|
|
70
|
-
}), hasLabel && {
|
|
71
|
-
width: "100%",
|
|
72
|
-
justifyContent: "space-between"
|
|
73
|
-
}),
|
|
74
|
-
"& .MuiFormHelperText-root": {
|
|
75
|
-
marginLeft: 0
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
|
-
const Switch = (props) => {
|
|
80
|
-
const _a = props, {
|
|
81
|
-
label,
|
|
82
|
-
size = "medium",
|
|
83
|
-
labelPlacement = "end",
|
|
84
|
-
disabled = false,
|
|
85
|
-
error = false,
|
|
86
|
-
helperText,
|
|
87
|
-
bordered = false,
|
|
88
|
-
borderRadius = 10,
|
|
89
|
-
defaultChecked,
|
|
90
|
-
preset,
|
|
91
|
-
sx
|
|
92
|
-
} = _a, rest = __objRest(_a, [
|
|
93
|
-
"label",
|
|
94
|
-
"size",
|
|
95
|
-
"labelPlacement",
|
|
96
|
-
"disabled",
|
|
97
|
-
"error",
|
|
98
|
-
"helperText",
|
|
99
|
-
"bordered",
|
|
100
|
-
"borderRadius",
|
|
101
|
-
"defaultChecked",
|
|
102
|
-
"preset",
|
|
103
|
-
"sx"
|
|
104
|
-
]);
|
|
105
|
-
const theme = styles.useTheme();
|
|
106
|
-
const presetSx = resolvePreset.resolvePreset("Switch", preset, theme);
|
|
107
|
-
const buildSx = (effectiveError) => [
|
|
108
|
-
buildSwitchSx({
|
|
109
|
-
bordered,
|
|
110
|
-
borderRadius,
|
|
111
|
-
hasLabel: !!label,
|
|
112
|
-
error: effectiveError
|
|
113
|
-
}),
|
|
114
|
-
...presetSx ? [presetSx] : [],
|
|
115
|
-
...Array.isArray(sx) ? sx : [sx]
|
|
116
|
-
];
|
|
117
|
-
const renderSwitch = (checked2, onChange2, onBlur, inputRef) => {
|
|
118
|
-
const switchEl = /* @__PURE__ */ jsxRuntime.jsx(
|
|
119
|
-
material.Switch,
|
|
120
|
-
__spreadProps(__spreadValues({}, rest), {
|
|
121
|
-
size,
|
|
122
|
-
checked: !!checked2,
|
|
123
|
-
onChange: (_e, next) => onChange2(next),
|
|
124
|
-
onBlur,
|
|
125
|
-
inputRef,
|
|
126
|
-
disabled
|
|
127
|
-
})
|
|
128
|
-
);
|
|
129
|
-
return label ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
130
|
-
material.FormControlLabel,
|
|
131
|
-
{
|
|
132
|
-
control: switchEl,
|
|
133
|
-
label,
|
|
134
|
-
labelPlacement,
|
|
135
|
-
disabled
|
|
136
|
-
}
|
|
137
|
-
) : switchEl;
|
|
138
|
-
};
|
|
139
|
-
if ("control" in props && props.control) {
|
|
140
|
-
const { name, control, validation } = props;
|
|
141
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
142
|
-
reactHookForm.Controller,
|
|
143
|
-
{
|
|
144
|
-
name,
|
|
145
|
-
control,
|
|
146
|
-
rules: validation,
|
|
147
|
-
defaultValue: defaultChecked,
|
|
148
|
-
render: ({ field, fieldState: { error: fieldError } }) => {
|
|
149
|
-
var _a2;
|
|
150
|
-
const finalError = !!fieldError || error;
|
|
151
|
-
const finalHelperText = (_a2 = fieldError == null ? void 0 : fieldError.message) != null ? _a2 : helperText;
|
|
152
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
153
|
-
material.FormControl,
|
|
154
|
-
{
|
|
155
|
-
error: finalError,
|
|
156
|
-
disabled,
|
|
157
|
-
sx: buildSx(finalError),
|
|
158
|
-
children: [
|
|
159
|
-
renderSwitch(
|
|
160
|
-
!!field.value,
|
|
161
|
-
(next) => field.onChange(next),
|
|
162
|
-
field.onBlur,
|
|
163
|
-
field.ref
|
|
164
|
-
),
|
|
165
|
-
finalHelperText && /* @__PURE__ */ jsxRuntime.jsx(material.FormHelperText, { children: finalHelperText })
|
|
166
|
-
]
|
|
167
|
-
}
|
|
168
|
-
);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
);
|
|
172
|
-
}
|
|
173
|
-
const { checked, onChange } = props;
|
|
174
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(material.FormControl, { error, disabled, sx: buildSx(error), children: [
|
|
175
|
-
renderSwitch(checked, onChange),
|
|
176
|
-
helperText && /* @__PURE__ */ jsxRuntime.jsx(material.FormHelperText, { children: helperText })
|
|
177
|
-
] });
|
|
178
|
-
};
|
|
179
|
-
exports.Switch = Switch;
|
|
180
|
-
exports.default = Switch;
|
|
3
|
+
const Switch = require("../../Switch-CQFOopYy.cjs");
|
|
4
|
+
exports.Switch = Switch.Switch;
|
|
5
|
+
exports.default = Switch.Switch;
|
|
181
6
|
//# sourceMappingURL=Switch.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.cjs","sources":["../../../src/components/Switch/Switch.sx.ts","../../../src/components/Switch/Switch.tsx"],"sourcesContent":["import type { SxProps, Theme } from '@mui/material/styles';\n\nexport interface BuildSwitchSxOptions {\n bordered: boolean;\n borderRadius: number | string;\n hasLabel: boolean;\n error: boolean;\n}\n\nconst toRadius = (borderRadius: number | string) =>\n typeof borderRadius === 'number' ? `${borderRadius}px` : borderRadius;\n\n/**\n * Transición compartida (matchea el InputGroup y el RadioGroup).\n */\nconst FOCUS_TRANSITION =\n 'border-color 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms, ' +\n 'box-shadow 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms';\n\n/**\n * Builder de sx para Switch. Reproduce el estilo del antiguo\n * `FormToggleInput` legacy cuando `bordered=true`: contenedor con borde,\n * label a la izquierda y switch a la derecha (vía justify-content: space-between).\n *\n * Cuando `bordered=true`, el contenedor gana:\n * - `:focus-within` → borde + shadow primario (mismo patrón que `InputGroup`).\n * - `error=true` → borde + shadow de error (palette.error.main).\n *\n * El shadow es de 1px, así que no hay shift de layout — sólo se intensifica\n * visualmente el borde sin empujar nada alrededor.\n *\n * Si `bordered=false`, sólo aplica un reset de margin del helper text.\n */\nexport const buildSwitchSx = ({\n bordered,\n borderRadius,\n hasLabel,\n error,\n}: BuildSwitchSxOptions): SxProps<Theme> => {\n const radius = toRadius(borderRadius);\n\n if (!bordered) {\n return {\n '& .MuiFormHelperText-root': { marginLeft: 0 },\n };\n }\n\n return (theme) => ({\n '& .MuiFormControlLabel-root': {\n marginLeft: 0,\n marginRight: 0,\n paddingX: 1.5,\n paddingY: 1.25,\n border: `1px solid ${\n error ? theme.palette.error.main : theme.palette.divider\n }`,\n borderRadius: radius,\n transition: FOCUS_TRANSITION,\n ...(error && {\n boxShadow: `0 0 0 1px ${theme.palette.error.main}`,\n }),\n // Focus del usuario sobre el switch interno.\n '&:focus-within': {\n borderColor: error\n ? theme.palette.error.main\n : theme.palette.primary.main,\n boxShadow: `0 0 0 1px ${\n error ? theme.palette.error.main : theme.palette.primary.main\n }`,\n },\n // Si hay label, separar el switch al borde opuesto.\n ...(hasLabel && {\n width: '100%',\n justifyContent: 'space-between',\n }),\n },\n '& .MuiFormHelperText-root': {\n marginLeft: 0,\n },\n });\n};\n","import { useTheme } from '@mui/material/styles';\nimport {\n FormControl,\n FormControlLabel,\n FormHelperText,\n Switch as MuiSwitch,\n type SwitchProps as MuiSwitchProps,\n type SxProps,\n type Theme,\n} from '@mui/material';\nimport { Controller, type Control, type RegisterOptions } from 'react-hook-form';\n\nimport { buildSwitchSx } from './Switch.sx';\nimport { resolvePreset } from '../_shared/resolvePreset';\n\n// ── Tipos de dominio ─────────────────────────────────────────────────────\nexport type SwitchSize = 'small' | 'medium';\nexport type SwitchLabelPlacement = 'start' | 'end' | 'top' | 'bottom';\n\n// ── Props base (todo lo común entre RHF y controlado) ────────────────────\nexport interface BaseSwitchProps\n extends Omit<MuiSwitchProps, 'value' | 'onChange' | 'checked' | 'defaultChecked' | 'size'> {\n /** Texto al lado del switch. Si está ausente, no se renderiza FormControlLabel. */\n label?: string;\n size?: SwitchSize;\n /** Posición del label. Default: 'end' (legacy `FormToggleInput` lo ponía a la izquierda con su flex-stack). */\n labelPlacement?: SwitchLabelPlacement;\n disabled?: boolean;\n error?: boolean;\n helperText?: string;\n /** Renderiza un contenedor con borde alrededor del switch + label. Default: false. */\n bordered?: boolean;\n /** Border radius del contenedor (cuando bordered). Default: 10. */\n borderRadius?: number | string;\n defaultChecked?: boolean;\n /**\n * Nombre del preset de estilo registrado en `theme.styles.Switch`.\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 sx?: SxProps<Theme>;\n}\n\n// ── Variantes discriminadas (RHF vs controlado) ──────────────────────────\nexport interface RHFSwitchProps extends BaseSwitchProps {\n name: string;\n control: Control<any>;\n validation?: RegisterOptions;\n checked?: never;\n onChange?: never;\n}\n\nexport interface ControlledSwitchProps extends BaseSwitchProps {\n name?: string;\n control?: never;\n validation?: never;\n checked: boolean;\n onChange: (checked: boolean) => void;\n}\n\n// ── API pública final ────────────────────────────────────────────────────\nexport type SwitchProps = RHFSwitchProps | ControlledSwitchProps;\n\nexport const Switch: React.FC<SwitchProps> = (props) => {\n const {\n label,\n size = 'medium',\n labelPlacement = 'end',\n disabled = false,\n error = false,\n helperText,\n bordered = false,\n borderRadius = 10,\n defaultChecked,\n preset,\n sx,\n ...rest\n } = props as ControlledSwitchProps & {\n control?: Control<any>;\n validation?: RegisterOptions;\n };\n\n const theme = useTheme();\n const presetSx = resolvePreset('Switch', preset, theme);\n\n // Construye el sx con el estado de error efectivo; se llama por rama\n // (RHF usa el error del Controller, controlado usa el prop `error`).\n const buildSx = (effectiveError: boolean) => [\n buildSwitchSx({\n bordered,\n borderRadius,\n hasLabel: !!label,\n error: effectiveError,\n }),\n ...(presetSx ? [presetSx] : []),\n ...(Array.isArray(sx) ? sx : [sx]),\n ];\n\n const renderSwitch = (\n checked: boolean,\n onChange: (next: boolean) => void,\n onBlur?: () => void,\n inputRef?: React.Ref<HTMLInputElement>,\n ) => {\n const switchEl = (\n <MuiSwitch\n {...rest}\n size={size}\n checked={!!checked}\n onChange={(_e, next) => onChange(next)}\n onBlur={onBlur}\n inputRef={inputRef}\n disabled={disabled}\n />\n );\n\n return label ? (\n <FormControlLabel\n control={switchEl}\n label={label}\n labelPlacement={labelPlacement}\n disabled={disabled}\n />\n ) : (\n switchEl\n );\n };\n\n // ── RHF mode ──────────────────────────────────────────────────────────\n if ('control' in props && props.control) {\n const { name, control, validation } = props as RHFSwitchProps;\n return (\n <Controller\n name={name}\n control={control}\n rules={validation}\n defaultValue={defaultChecked}\n render={({ field, fieldState: { error: fieldError } }) => {\n const finalError = !!fieldError || error;\n const finalHelperText = fieldError?.message ?? helperText;\n return (\n <FormControl\n error={finalError}\n disabled={disabled}\n sx={buildSx(finalError)}\n >\n {renderSwitch(\n !!field.value,\n (next) => field.onChange(next),\n field.onBlur,\n field.ref,\n )}\n {finalHelperText && <FormHelperText>{finalHelperText}</FormHelperText>}\n </FormControl>\n );\n }}\n />\n );\n }\n\n // ── Controlled mode ───────────────────────────────────────────────────\n const { checked, onChange } = props as ControlledSwitchProps;\n return (\n <FormControl error={error} disabled={disabled} sx={buildSx(error)}>\n {renderSwitch(checked, onChange)}\n {helperText && <FormHelperText>{helperText}</FormHelperText>}\n </FormControl>\n );\n};\n\nexport default Switch;\n"],"names":["useTheme","resolvePreset","checked","onChange","jsx","MuiSwitch","FormControlLabel","Controller","_a","jsxs","FormControl","FormHelperText"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"Switch.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SwitchProps as MuiSwitchProps, SxProps, Theme } from '@mui/material';
|
|
2
|
-
import {
|
|
2
|
+
import { RegisterOptions } from 'react-hook-form';
|
|
3
3
|
export type SwitchSize = 'small' | 'medium';
|
|
4
4
|
export type SwitchLabelPlacement = 'start' | 'end' | 'top' | 'bottom';
|
|
5
5
|
export interface BaseSwitchProps extends Omit<MuiSwitchProps, 'value' | 'onChange' | 'checked' | 'defaultChecked' | 'size'> {
|
|
@@ -26,8 +26,13 @@ export interface BaseSwitchProps extends Omit<MuiSwitchProps, 'value' | 'onChang
|
|
|
26
26
|
}
|
|
27
27
|
export interface RHFSwitchProps extends BaseSwitchProps {
|
|
28
28
|
name: string;
|
|
29
|
-
control:
|
|
29
|
+
control: any;
|
|
30
30
|
validation?: RegisterOptions;
|
|
31
|
+
/**
|
|
32
|
+
* Side-effect que corre después de que RHF actualiza el form state.
|
|
33
|
+
* Útil para cascadas entre campos. NO reemplaza al handler de RHF.
|
|
34
|
+
*/
|
|
35
|
+
onValueChange?: (checked: boolean) => void;
|
|
31
36
|
checked?: never;
|
|
32
37
|
onChange?: never;
|
|
33
38
|
}
|