@soyfri/shared-library 2.0.0-beta.2 → 2.0.0-beta.21
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/.dockerignore +8 -0
- package/.github/workflows/publish.yml +107 -0
- package/.prettierrc +3 -0
- package/.storybook/main.ts +19 -0
- package/.storybook/preview.ts +14 -0
- package/.storybook/vitest.setup.ts +9 -0
- package/Dockerfile +37 -0
- package/build.js +117 -0
- package/chromatic.config.json +5 -0
- package/cleanDirectories.js +40 -0
- package/dist/Autocomplete-C_lW1VER.js +337 -0
- package/dist/Autocomplete-C_lW1VER.js.map +1 -0
- package/dist/Autocomplete-CejWztBY.cjs +336 -0
- package/dist/Autocomplete-CejWztBY.cjs.map +1 -0
- package/dist/Avatar-CgT7955R.js +162 -0
- package/dist/Avatar-CgT7955R.js.map +1 -0
- package/dist/Avatar-CuSrK8Wn.cjs +161 -0
- package/dist/Avatar-CuSrK8Wn.cjs.map +1 -0
- package/dist/Button-C17mExpd.cjs.map +1 -1
- package/dist/Button-UkkP-bNw.js.map +1 -1
- package/dist/Card-B1wtavyl.js +98 -0
- package/dist/Card-B1wtavyl.js.map +1 -0
- package/dist/Card-DfdU610V.cjs +97 -0
- package/dist/Card-DfdU610V.cjs.map +1 -0
- package/dist/Checkbox-BCqMFWt4.cjs +187 -0
- package/dist/Checkbox-BCqMFWt4.cjs.map +1 -0
- package/dist/Checkbox-gB5YKkVo.js +188 -0
- package/dist/Checkbox-gB5YKkVo.js.map +1 -0
- package/dist/{components/DateRangePicker/DateRangePicker.js → Chip-OPYQ1uQ_.js} +33 -35
- package/dist/Chip-OPYQ1uQ_.js.map +1 -0
- package/dist/{components/DateRangePicker/DateRangePicker.cjs → Chip-qoJLDiva.cjs} +33 -36
- package/dist/Chip-qoJLDiva.cjs.map +1 -0
- package/dist/DatePicker-_IGWc3I5.js +178 -0
- package/dist/DatePicker-_IGWc3I5.js.map +1 -0
- package/dist/DatePicker-t7uDTZMl.cjs +177 -0
- package/dist/DatePicker-t7uDTZMl.cjs.map +1 -0
- package/dist/DateTimePicker-BxQyjTCY.cjs +229 -0
- package/dist/DateTimePicker-BxQyjTCY.cjs.map +1 -0
- package/dist/DateTimePicker-CrmWav_j.js +230 -0
- package/dist/DateTimePicker-CrmWav_j.js.map +1 -0
- package/dist/Input-CScC87J5.cjs +185 -0
- package/dist/Input-CScC87J5.cjs.map +1 -0
- package/dist/Input-DP_fKl38.js +186 -0
- package/dist/Input-DP_fKl38.js.map +1 -0
- package/dist/Modal-BN5s-Tfk.cjs +347 -0
- package/dist/Modal-BN5s-Tfk.cjs.map +1 -0
- package/dist/Modal-BRZMPwDj.js +348 -0
- package/dist/Modal-BRZMPwDj.js.map +1 -0
- package/dist/README.md +243 -0
- package/dist/RadioGroup-Dd0rHXSX.cjs +202 -0
- package/dist/RadioGroup-Dd0rHXSX.cjs.map +1 -0
- package/dist/RadioGroup-bO-ahP9T.js +203 -0
- package/dist/RadioGroup-bO-ahP9T.js.map +1 -0
- package/dist/Select-Dycmh9vt.js +256 -0
- package/dist/Select-Dycmh9vt.js.map +1 -0
- package/dist/Select-kqR48jZU.cjs +255 -0
- package/dist/Select-kqR48jZU.cjs.map +1 -0
- package/dist/Stat-BUcFCGrz.cjs +83 -0
- package/dist/Stat-BUcFCGrz.cjs.map +1 -0
- package/dist/Stat-C06A_izS.js +84 -0
- package/dist/Stat-C06A_izS.js.map +1 -0
- package/dist/StatusMessage-B3nXpuRl.cjs +88 -0
- package/dist/StatusMessage-B3nXpuRl.cjs.map +1 -0
- package/dist/StatusMessage-D0WgSBx7.js +89 -0
- package/dist/StatusMessage-D0WgSBx7.js.map +1 -0
- package/dist/Step-BArsou1V.js +301 -0
- package/dist/Step-BArsou1V.js.map +1 -0
- package/dist/Step-Nd7SJbRZ.cjs +300 -0
- package/dist/Step-Nd7SJbRZ.cjs.map +1 -0
- package/dist/Switch-CQFOopYy.cjs +182 -0
- package/dist/Switch-CQFOopYy.cjs.map +1 -0
- package/dist/Switch-D72dpkH2.js +183 -0
- package/dist/Switch-D72dpkH2.js.map +1 -0
- package/dist/Tab-BbP8jBcK.cjs +110 -0
- package/dist/Tab-BbP8jBcK.cjs.map +1 -0
- package/dist/Tab-BxSxKJsP.js +111 -0
- package/dist/Tab-BxSxKJsP.js.map +1 -0
- package/dist/Table-C2LbW0B1.js +531 -0
- package/dist/Table-C2LbW0B1.js.map +1 -0
- package/dist/Table-C4OM6rrC.cjs +530 -0
- package/dist/Table-C4OM6rrC.cjs.map +1 -0
- package/dist/components/ActionMenu/ActionMenu.cjs +52 -52
- package/dist/components/ActionMenu/ActionMenu.cjs.map +1 -1
- package/dist/components/ActionMenu/ActionMenu.d.ts +20 -36
- package/dist/components/ActionMenu/ActionMenu.js +55 -55
- package/dist/components/ActionMenu/ActionMenu.js.map +1 -1
- package/dist/components/ActionMenu/index.d.ts +2 -2
- package/dist/components/AppBar/AppBar.cjs +3 -220
- package/dist/components/AppBar/AppBar.cjs.map +1 -1
- package/dist/components/AppBar/AppBar.d.ts +6 -6
- package/dist/components/AppBar/AppBar.js +6 -223
- package/dist/components/AppBar/AppBar.js.map +1 -1
- package/dist/components/AppBar/index.d.ts +0 -6
- package/dist/components/Autocomplete/Autocomplete.cjs +4 -311
- package/dist/components/Autocomplete/Autocomplete.cjs.map +1 -1
- package/dist/components/Autocomplete/Autocomplete.d.ts +8 -6
- package/dist/components/Autocomplete/Autocomplete.helpers.d.ts +8 -4
- package/dist/components/Autocomplete/Autocomplete.js +4 -311
- package/dist/components/Autocomplete/Autocomplete.js.map +1 -1
- package/dist/components/Autocomplete/_parts/AutocompleteOption.d.ts +5 -8
- package/dist/components/Autocomplete/index.d.ts +1 -1
- package/dist/components/Avatar/Avatar.cjs +2 -160
- package/dist/components/Avatar/Avatar.cjs.map +1 -1
- package/dist/components/Avatar/Avatar.js +2 -160
- package/dist/components/Avatar/Avatar.js.map +1 -1
- package/dist/components/Avatar/index.d.ts +1 -0
- package/dist/components/Button/Button.d.ts +5 -5
- package/dist/components/Button/index.d.ts +1 -0
- package/dist/components/Card/Card.cjs +4 -184
- package/dist/components/Card/Card.cjs.map +1 -1
- package/dist/components/Card/Card.d.ts +3 -50
- package/dist/components/Card/Card.js +4 -184
- package/dist/components/Card/Card.js.map +1 -1
- package/dist/components/Card/Card.sx.d.ts +3 -6
- package/dist/components/Card/index.d.ts +1 -1
- package/dist/components/Checkbox/Checkbox.cjs +6 -0
- package/dist/components/Checkbox/Checkbox.cjs.map +1 -0
- package/dist/components/Checkbox/Checkbox.d.ts +55 -0
- package/dist/components/Checkbox/Checkbox.js +6 -0
- package/dist/components/Checkbox/Checkbox.js.map +1 -0
- package/dist/components/Checkbox/Checkbox.sx.d.ts +13 -0
- package/dist/components/Checkbox/index.d.ts +2 -0
- package/dist/components/Checkbox.d.ts +6 -0
- package/dist/components/Chip/Chip.cjs +4 -72
- package/dist/components/Chip/Chip.cjs.map +1 -1
- package/dist/components/Chip/Chip.js +3 -71
- package/dist/components/Chip/Chip.js.map +1 -1
- package/dist/components/Chip/index.d.ts +2 -1
- package/dist/components/Chip.d.ts +4 -0
- package/dist/components/Column/Column.cjs +1 -1
- package/dist/components/Column/Column.cjs.map +1 -1
- package/dist/components/Column/Column.d.ts +1 -1
- package/dist/components/Column/Column.js +1 -1
- package/dist/components/Column/Column.js.map +1 -1
- package/dist/components/Column/index.d.ts +1 -0
- package/dist/components/DatePicker/DatePicker.cjs +3 -200
- package/dist/components/DatePicker/DatePicker.cjs.map +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +1 -13
- package/dist/components/DatePicker/DatePicker.js +3 -200
- package/dist/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/components/DatePicker/index.d.ts +1 -1
- package/dist/components/DateTimePicker/DateTimePicker.cjs +3 -219
- package/dist/components/DateTimePicker/DateTimePicker.cjs.map +1 -1
- package/dist/components/DateTimePicker/DateTimePicker.d.ts +10 -6
- package/dist/components/DateTimePicker/DateTimePicker.definitions.d.ts +2 -0
- package/dist/components/DateTimePicker/DateTimePicker.helpers.d.ts +4 -2
- package/dist/components/DateTimePicker/DateTimePicker.js +3 -219
- package/dist/components/DateTimePicker/DateTimePicker.js.map +1 -1
- package/dist/components/DateTimePicker/index.d.ts +1 -1
- package/dist/components/Drawer/Drawer.cjs +25 -24
- package/dist/components/Drawer/Drawer.cjs.map +1 -1
- package/dist/components/Drawer/Drawer.d.ts +8 -1
- package/dist/components/Drawer/Drawer.js +26 -25
- package/dist/components/Drawer/Drawer.js.map +1 -1
- package/dist/components/Drawer/DrawerItem.d.ts +6 -1
- package/dist/components/Gallery/Gallery.cjs +154 -79
- package/dist/components/Gallery/Gallery.cjs.map +1 -1
- package/dist/components/Gallery/Gallery.d.ts +25 -9
- package/dist/components/Gallery/Gallery.js +154 -79
- package/dist/components/Gallery/Gallery.js.map +1 -1
- package/dist/components/Gallery/GalleryLightbox.d.ts +6 -10
- package/dist/components/Gallery/GalleryMain.d.ts +3 -7
- package/dist/components/Gallery/GalleryThumbnails.d.ts +7 -11
- package/dist/components/Gallery/index.d.ts +2 -1
- package/dist/components/Gallery.d.ts +4 -0
- package/dist/components/Icon/Icon.cjs +6 -8
- package/dist/components/Icon/Icon.cjs.map +1 -1
- package/dist/components/Icon/Icon.d.ts +11 -17
- package/dist/components/Icon/Icon.js +7 -9
- package/dist/components/Icon/Icon.js.map +1 -1
- package/dist/components/Icon/index.d.ts +2 -1
- package/dist/components/Icon.d.ts +4 -0
- package/dist/components/Input/Input.cjs +3 -172
- package/dist/components/Input/Input.cjs.map +1 -1
- package/dist/components/Input/Input.d.ts +9 -2
- package/dist/components/Input/Input.definitions.d.ts +1 -0
- package/dist/components/Input/Input.helpers.d.ts +3 -3
- package/dist/components/Input/Input.js +3 -172
- package/dist/components/Input/Input.js.map +1 -1
- package/dist/components/Input/index.d.ts +1 -1
- package/dist/components/InputGroup/InputGroup.cjs +23 -22
- package/dist/components/InputGroup/InputGroup.cjs.map +1 -1
- package/dist/components/InputGroup/InputGroup.d.ts +4 -4
- package/dist/components/InputGroup/InputGroup.js +22 -21
- package/dist/components/InputGroup/InputGroup.js.map +1 -1
- package/dist/components/InputGroup/index.d.ts +2 -1
- package/dist/components/InputGroup.d.ts +4 -0
- package/dist/components/Modal/Modal.cjs +7 -317
- package/dist/components/Modal/Modal.cjs.map +1 -1
- package/dist/components/Modal/Modal.d.ts +20 -5
- package/dist/components/Modal/Modal.js +6 -316
- package/dist/components/Modal/Modal.js.map +1 -1
- package/dist/components/Modal/ModalBody.d.ts +6 -1
- package/dist/components/Modal/ModalFooter.d.ts +4 -4
- package/dist/components/Modal/ModalHeader.d.ts +6 -1
- package/dist/components/Modal/index.d.ts +4 -1
- package/dist/components/Modal.d.ts +4 -0
- package/dist/components/RadioGroup/RadioGroup.cjs +6 -0
- package/dist/components/RadioGroup/RadioGroup.cjs.map +1 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +59 -0
- package/dist/components/RadioGroup/RadioGroup.definitions.d.ts +6 -0
- package/dist/components/RadioGroup/RadioGroup.js +6 -0
- package/dist/components/RadioGroup/RadioGroup.js.map +1 -0
- package/dist/components/RadioGroup/RadioGroup.sx.d.ts +20 -0
- package/dist/components/RadioGroup/index.d.ts +2 -0
- package/dist/components/RadioGroup.d.ts +6 -0
- package/dist/components/Select/Select.cjs +4 -445
- package/dist/components/Select/Select.cjs.map +1 -1
- package/dist/components/Select/Select.d.ts +15 -18
- package/dist/components/Select/Select.helpers.d.ts +5 -19
- package/dist/components/Select/Select.js +4 -445
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/Select/index.d.ts +1 -1
- package/dist/components/Stat/Stat.cjs +4 -83
- package/dist/components/Stat/Stat.cjs.map +1 -1
- package/dist/components/Stat/Stat.js +3 -82
- package/dist/components/Stat/Stat.js.map +1 -1
- package/dist/components/Stat/index.d.ts +2 -1
- package/dist/components/Stat.d.ts +4 -0
- package/dist/components/StatusMessage/StatusMessage.cjs +4 -77
- package/dist/components/StatusMessage/StatusMessage.cjs.map +1 -1
- package/dist/components/StatusMessage/StatusMessage.d.ts +20 -36
- package/dist/components/StatusMessage/StatusMessage.js +3 -76
- package/dist/components/StatusMessage/StatusMessage.js.map +1 -1
- package/dist/components/StatusMessage/index.d.ts +2 -1
- package/dist/components/StatusMessage.d.ts +4 -0
- package/dist/components/Stepper/Stepper.cjs +8 -47
- package/dist/components/Stepper/Stepper.cjs.map +1 -1
- package/dist/components/Stepper/Stepper.d.ts +9 -8
- package/dist/components/Stepper/Stepper.js +7 -46
- package/dist/components/Stepper/Stepper.js.map +1 -1
- package/dist/{hooks/Wizard/WizardContext.d.ts → components/Stepper/StepperContext.d.ts} +29 -23
- package/dist/components/Stepper/_hooks/useHorizontalScroll.d.ts +19 -0
- package/dist/components/Stepper/_parts/StepperScrollArrow.d.ts +19 -0
- package/dist/components/Stepper/index.d.ts +6 -2
- package/dist/components/Stepper.d.ts +4 -0
- package/dist/components/Switch/Switch.cjs +6 -0
- package/dist/components/Switch/Switch.cjs.map +1 -0
- package/dist/components/Switch/Switch.d.ts +48 -0
- package/dist/components/Switch/Switch.definitions.d.ts +7 -0
- package/dist/components/Switch/Switch.js +6 -0
- package/dist/components/Switch/Switch.js.map +1 -0
- package/dist/components/Switch/Switch.sx.d.ts +22 -0
- package/dist/components/Switch/Switch.types.d.ts +1 -0
- package/dist/components/Switch/index.d.ts +2 -0
- package/dist/components/Switch.d.ts +6 -0
- package/dist/components/Table/Table.cjs +2 -528
- package/dist/components/Table/Table.cjs.map +1 -1
- package/dist/components/Table/Table.d.ts +1 -1
- package/dist/components/Table/Table.js +2 -528
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/Tabs/Tabs.cjs +5 -94
- package/dist/components/Tabs/Tabs.cjs.map +1 -1
- package/dist/components/Tabs/Tabs.d.ts +21 -16
- package/dist/components/Tabs/Tabs.js +4 -93
- package/dist/components/Tabs/Tabs.js.map +1 -1
- package/dist/components/Tabs/index.d.ts +4 -2
- package/dist/components/Tabs.d.ts +4 -0
- package/dist/components/Timeline/Timeline.cjs +3 -2
- package/dist/components/Timeline/Timeline.cjs.map +1 -1
- package/dist/components/Timeline/Timeline.d.ts +4 -8
- package/dist/components/Timeline/Timeline.js +3 -2
- package/dist/components/Timeline/Timeline.js.map +1 -1
- package/dist/components/Timeline/index.d.ts +4 -2
- package/dist/components/Timeline.d.ts +4 -0
- package/dist/components/_shared/mergeSx.d.ts +7 -0
- package/dist/{formField.sx-DfVbMe0V.js → formField.sx-8_QRnKxv.js} +2 -11
- package/dist/formField.sx-8_QRnKxv.js.map +1 -0
- package/dist/{formField.sx-CQ1mbk9M.cjs → formField.sx-BAX7KwMR.cjs} +10 -19
- package/dist/formField.sx-BAX7KwMR.cjs.map +1 -0
- package/dist/index.cjs +92 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +32 -0
- package/dist/index.js +66 -3
- package/dist/index.js.map +1 -1
- package/dist/mergeSx-BXoNZjB_.js +10 -0
- package/dist/mergeSx-BXoNZjB_.js.map +1 -0
- package/dist/mergeSx-Dbccoo_H.cjs +9 -0
- package/dist/mergeSx-Dbccoo_H.cjs.map +1 -0
- package/dist/mui.d.ts +3 -1
- package/dist/package.json +190 -0
- package/dist/{resolvePreset-CT3kU-K2.cjs → resolvePreset-CxTI6_Ln.cjs} +3 -3
- package/dist/{resolvePreset-CT3kU-K2.cjs.map → resolvePreset-CxTI6_Ln.cjs.map} +1 -1
- package/dist/{resolvePreset-B-IB0ehH.js → resolvePreset-K6_BfWHD.js} +3 -3
- package/dist/{resolvePreset-B-IB0ehH.js.map → resolvePreset-K6_BfWHD.js.map} +1 -1
- package/dist/theme/componentStyles.d.ts +1 -1
- package/dist/tokens-BRrcP_p_.js +21 -0
- package/dist/tokens-BRrcP_p_.js.map +1 -0
- package/dist/tokens-jaWWNk39.cjs +20 -0
- package/dist/tokens-jaWWNk39.cjs.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/{components/ScrollTopButton → utils}/scrollToTop.d.ts +6 -7
- package/package.json +25 -48
- package/rollup.config.cjs +87 -0
- package/scripts/gen-dist-pkg.mjs +15 -0
- package/shared-library-comercios-MUI.code-workspace +10 -0
- package/src/components/ActionMenu/ActionMenu.stories.tsx +427 -0
- package/src/components/ActionMenu/ActionMenu.tsx +153 -0
- package/src/components/ActionMenu/index.ts +2 -0
- package/src/components/AppBar/AppBar.stories.tsx +316 -0
- package/src/components/AppBar/AppBar.sx.ts +32 -0
- package/src/components/AppBar/AppBar.tsx +119 -0
- package/src/components/AppBar/AppBarContext.ts +25 -0
- package/src/components/AppBar/AppBarMenuToggle.tsx +90 -0
- package/src/components/AppBar/index.ts +12 -0
- package/src/components/Autocomplete/Autocomplete.definitions.ts +477 -0
- package/src/components/Autocomplete/Autocomplete.helpers.ts +80 -0
- package/src/components/Autocomplete/Autocomplete.stories.tsx +784 -0
- package/src/components/Autocomplete/Autocomplete.sx.ts +30 -0
- package/src/components/Autocomplete/Autocomplete.tsx +393 -0
- package/src/components/Autocomplete/_parts/AutocompleteChips.tsx +55 -0
- package/src/components/Autocomplete/_parts/AutocompleteLoader.tsx +17 -0
- package/src/components/Autocomplete/_parts/AutocompleteOption.tsx +29 -0
- package/src/components/Autocomplete/index.ts +12 -0
- package/src/components/Avatar/Avatar.definitions.ts +162 -0
- package/src/components/Avatar/Avatar.stories.tsx +258 -0
- package/src/components/Avatar/Avatar.tsx +206 -0
- package/src/components/Avatar/index.ts +2 -0
- package/src/components/Button/Button.definition.ts +97 -0
- package/src/components/Button/Button.stories.tsx +285 -0
- package/src/components/Button/Button.tsx +66 -0
- package/src/components/Button/index.ts +2 -0
- package/src/components/Card/Card.definition.ts +5 -0
- package/src/components/Card/Card.stories.tsx +102 -0
- package/src/components/Card/Card.sx.ts +58 -0
- package/src/components/Card/Card.tsx +85 -0
- package/src/components/Card/index.ts +4 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +212 -0
- package/src/components/Checkbox/Checkbox.sx.ts +67 -0
- package/src/components/Checkbox/Checkbox.tsx +208 -0
- package/src/components/Checkbox/index.ts +10 -0
- package/src/components/Chip/Chip.definitions.ts +167 -0
- package/src/components/Chip/Chip.stories.tsx +265 -0
- package/src/components/Chip/Chip.tsx +61 -0
- package/src/components/Chip/index.ts +2 -0
- package/src/components/Column/Column.tsx +29 -0
- package/src/components/Column/index.ts +2 -0
- package/src/components/DatePicker/DatePicker.definitions.ts +228 -0
- package/src/components/DatePicker/DatePicker.helpers.ts +24 -0
- package/src/components/DatePicker/DatePicker.stories.tsx +309 -0
- package/src/components/DatePicker/DatePicker.sx.ts +33 -0
- package/src/components/DatePicker/DatePicker.tsx +133 -0
- package/src/components/DatePicker/index.ts +7 -0
- package/src/components/DateTimePicker/DateTimePicker.definitions.ts +317 -0
- package/src/components/DateTimePicker/DateTimePicker.helpers.ts +45 -0
- package/src/components/DateTimePicker/DateTimePicker.stories.tsx +415 -0
- package/src/components/DateTimePicker/DateTimePicker.sx.ts +30 -0
- package/src/components/DateTimePicker/DateTimePicker.tsx +240 -0
- package/src/components/DateTimePicker/index.ts +9 -0
- package/src/components/Drawer/Drawer.stories.tsx +438 -0
- package/src/components/Drawer/Drawer.sx.ts +106 -0
- package/src/components/Drawer/Drawer.tsx +224 -0
- package/src/components/Drawer/DrawerContext.ts +26 -0
- package/src/components/Drawer/DrawerItem.tsx +120 -0
- package/src/components/Drawer/index.ts +10 -0
- package/src/components/Flyout/Flyout.stories.tsx +282 -0
- package/src/components/Flyout/Flyout.tsx +122 -0
- package/src/components/Flyout/index.ts +1 -0
- package/src/components/Gallery/Gallery.definition.tsx +37 -0
- package/src/components/Gallery/Gallery.stories.tsx +82 -0
- package/src/components/Gallery/Gallery.tsx +158 -0
- package/src/components/Gallery/GalleryLightbox.tsx +186 -0
- package/src/components/Gallery/GalleryMain.tsx +87 -0
- package/src/components/Gallery/GalleryThumbnails.tsx +122 -0
- package/src/components/Gallery/index.ts +2 -0
- package/src/components/Icon/Icon.stories.tsx +121 -0
- package/src/components/Icon/Icon.tsx +163 -0
- package/src/components/Icon/index.ts +2 -0
- package/src/components/Input/Input.definitions.ts +348 -0
- package/src/components/Input/Input.helpers.ts +50 -0
- package/src/components/Input/Input.stories.tsx +528 -0
- package/src/components/Input/Input.sx.ts +42 -0
- package/src/components/Input/Input.tsx +162 -0
- package/src/components/Input/index.ts +10 -0
- package/src/components/InputGroup/InputGroup.definitions.ts +158 -0
- package/src/components/InputGroup/InputGroup.stories.tsx +267 -0
- package/src/components/InputGroup/InputGroup.tsx +180 -0
- package/src/components/InputGroup/index.ts +2 -0
- package/src/components/MenuButton/MenuButton.stories.tsx +197 -0
- package/src/components/MenuButton/MenuButton.tsx +100 -0
- package/src/components/MenuButton/index.ts +1 -0
- package/src/components/Modal/Modal.stories.tsx +721 -0
- package/src/components/Modal/Modal.tsx +407 -0
- package/src/components/Modal/ModalBody.tsx +23 -0
- package/src/components/Modal/ModalFooter.tsx +83 -0
- package/src/components/Modal/ModalHeader.tsx +33 -0
- package/src/components/Modal/index.ts +11 -0
- package/src/components/RadioGroup/RadioGroup.definitions.ts +177 -0
- package/src/components/RadioGroup/RadioGroup.stories.tsx +231 -0
- package/src/components/RadioGroup/RadioGroup.sx.ts +75 -0
- package/src/components/RadioGroup/RadioGroup.tsx +207 -0
- package/src/components/RadioGroup/index.ts +10 -0
- package/src/components/Select/Select.helpers.ts +31 -0
- package/src/components/Select/Select.stories.tsx +393 -0
- package/src/components/Select/Select.sx.ts +14 -0
- package/src/components/Select/Select.tsx +332 -0
- package/src/components/Select/_parts/SelectMenuItem.tsx +40 -0
- package/src/components/Select/_parts/SelectValue.tsx +95 -0
- package/src/components/Select/index.ts +12 -0
- package/src/components/Stat/Stat.stories.tsx +85 -0
- package/src/components/Stat/Stat.tsx +117 -0
- package/src/components/Stat/index.ts +2 -0
- package/src/components/StatusMessage/StatusMessage.stories.tsx +159 -0
- package/src/components/StatusMessage/StatusMessage.tsx +143 -0
- package/src/components/StatusMessage/index.ts +3 -0
- package/src/components/Stepper/Step.tsx +21 -0
- package/src/components/Stepper/Stepper.definition.ts +75 -0
- package/src/components/Stepper/Stepper.stories.tsx +194 -0
- package/src/components/Stepper/Stepper.tsx +194 -0
- package/src/components/Stepper/StepperContext.tsx +176 -0
- package/src/components/Stepper/StepperProvider.stories.tsx +286 -0
- package/src/components/Stepper/_hooks/useHorizontalScroll.ts +56 -0
- package/src/components/Stepper/_parts/StepperScrollArrow.tsx +50 -0
- package/src/components/Stepper/index.ts +15 -0
- package/src/components/Switch/Switch.definitions.ts +134 -0
- package/src/components/Switch/Switch.stories.tsx +213 -0
- package/src/components/Switch/Switch.sx.ts +81 -0
- package/src/components/Switch/Switch.tsx +188 -0
- package/src/components/Switch/Switch.types.ts +10 -0
- package/src/components/Switch/index.ts +9 -0
- package/src/components/Table/EmptyTable.png +0 -0
- package/src/components/Table/Table.definition.ts +580 -0
- package/src/components/Table/Table.stories.tsx +853 -0
- package/src/components/Table/Table.tsx +494 -0
- package/src/components/Table/data.ts +134 -0
- package/src/components/Table/exportsUtils.ts +195 -0
- package/src/components/Table/index.ts +3 -0
- package/src/components/Table/types.ts +34 -0
- package/src/components/Tabs/Tab.definition.ts +53 -0
- package/src/components/Tabs/Tab.tsx +19 -0
- package/src/components/Tabs/Tabs.stories.tsx +118 -0
- package/src/components/Tabs/Tabs.tsx +163 -0
- package/src/components/Tabs/_tabUtils.tsx +4 -0
- package/src/components/Tabs/index.ts +5 -0
- package/src/components/Timeline/Timeline.definition.ts +43 -0
- package/src/components/Timeline/Timeline.stories.tsx +108 -0
- package/src/components/Timeline/Timeline.tsx +44 -0
- package/src/components/Timeline/TimelineItem.tsx +31 -0
- package/src/components/Timeline/index.ts +5 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +129 -0
- package/src/components/Tooltip/Tooltip.tsx +58 -0
- package/src/components/Tooltip/index.ts +1 -0
- package/src/components/_shared/formField.sx.ts +118 -0
- package/src/components/_shared/mergeSx.ts +16 -0
- package/src/components/_shared/resolvePreset.ts +38 -0
- package/src/hooks/ClipBoard/ClipBoard.stories.tsx +168 -0
- package/src/hooks/ClipBoard/ClipBoard.tsx +131 -0
- package/src/hooks/ClipBoard/ClipboardUnifiedDemo.tsx +111 -0
- package/src/hooks/ClipBoard/index.ts +1 -0
- package/src/index.ts +51 -0
- package/src/mui.ts +57 -0
- package/src/styles.css +3 -0
- package/src/theme/componentStyles.ts +50 -0
- package/src/theme/tokens.ts +43 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/scrollToTop.ts +36 -0
- package/storybook-static/addon-visual-tests-assets/visual-test-illustration.mp4 +0 -0
- package/storybook-static/assets/AccountCircle-BDZFsbTw.js +1 -0
- package/storybook-static/assets/ActionMenu-EynP8yU1.js +19 -0
- package/storybook-static/assets/ActionMenu.stories-DqSqRGix.js +185 -0
- package/storybook-static/assets/Alert-3zvTPc0p.js +1 -0
- package/storybook-static/assets/AppBar.stories-DcX3M5th.js +172 -0
- package/storybook-static/assets/Autocomplete.stories-CXJm8FOT.js +788 -0
- package/storybook-static/assets/Avatar-NbFfkZws.js +1 -0
- package/storybook-static/assets/Avatar.stories-CwOYCzqU.js +390 -0
- package/storybook-static/assets/Box-BnhEcfFm.js +1 -0
- package/storybook-static/assets/Button-D9h7OggD.js +1 -0
- package/storybook-static/assets/Button-DBpqmVB_.js +1 -0
- package/storybook-static/assets/Button.stories-F20dmnjq.js +320 -0
- package/storybook-static/assets/ButtonBase-qyaMEhe4.js +74 -0
- package/storybook-static/assets/Card.stories-B3NpAhO0.js +154 -0
- package/storybook-static/assets/CheckCircleOutline-CEj5mDsl.js +1 -0
- package/storybook-static/assets/Chip-C3vKPpzR.js +1 -0
- package/storybook-static/assets/Chip.stories-sxcfHVo9.js +333 -0
- package/storybook-static/assets/CircularProgress-DC7ZNWwl.js +28 -0
- package/storybook-static/assets/Clear-4kYcKvT3.js +1 -0
- package/storybook-static/assets/ClipBoard-DvLBdNHe.js +1 -0
- package/storybook-static/assets/ClipBoard.stories-BGUo47r6.js +108 -0
- package/storybook-static/assets/Close-CgHeRgmh.js +1 -0
- package/storybook-static/assets/Close-Cy8nELYU.js +1 -0
- package/storybook-static/assets/Color-AVL7NMMY-BJKvwERm.js +1 -0
- package/storybook-static/assets/ContentCopy-BfLTDb10.js +1 -0
- package/storybook-static/assets/DatePicker-Clkpr-Ku.js +1 -0
- package/storybook-static/assets/DatePicker.stories-EaUCMkh3.js +444 -0
- package/storybook-static/assets/DateRangePicker.stories-BMlkj-8K.js +390 -0
- package/storybook-static/assets/DateTimePicker.stories-B6gdzKq5.js +555 -0
- package/storybook-static/assets/DefaultPropsProvider-BGoQxtDa.js +16 -0
- package/storybook-static/assets/Delete-D2SMMmIA.js +1 -0
- package/storybook-static/assets/DialogContent-BeCDKgax.js +1 -0
- package/storybook-static/assets/Divider-BbCj9wT4.js +1 -0
- package/storybook-static/assets/DocsRenderer-PQXLIZUC-BebLK5Y_.js +1243 -0
- package/storybook-static/assets/Drawer-DcFwy73r.js +1 -0
- package/storybook-static/assets/Drawer.stories-C5AZkJBk.js +173 -0
- package/storybook-static/assets/EmptyTable-B-RKtgVs.png +0 -0
- package/storybook-static/assets/ErrorOutline-D9gM7ART.js +1 -0
- package/storybook-static/assets/Fade-Ll96CvH8.js +1 -0
- package/storybook-static/assets/Flyout.stories-Cf7z6MNw.js +163 -0
- package/storybook-static/assets/Gallery.stories-DdpWVTF6.js +127 -0
- package/storybook-static/assets/Grow-8y4FglGK.js +1 -0
- package/storybook-static/assets/Home-BRvJEp2L.js +1 -0
- package/storybook-static/assets/Icon.stories-D0mUiW_t.js +78 -0
- package/storybook-static/assets/IconButton-9OYSTH58.js +1 -0
- package/storybook-static/assets/Input-CjX0t4h-.js +1 -0
- package/storybook-static/assets/Input.stories-BRxekliy.js +650 -0
- package/storybook-static/assets/InputGroup.stories-DH6gUfmn.js +306 -0
- package/storybook-static/assets/KeyboardArrowRight-WO_attK2.js +1 -0
- package/storybook-static/assets/KeyboardArrowUp-DsyVef-i.js +1 -0
- package/storybook-static/assets/ListItem-D3O0103N.js +1 -0
- package/storybook-static/assets/ListItemIcon-hca6xN79.js +1 -0
- package/storybook-static/assets/ListItemText-BFLAwLdl.js +1 -0
- package/storybook-static/assets/Logout-gj-P3AfU.js +1 -0
- package/storybook-static/assets/Menu-ClzfjLc3.js +1 -0
- package/storybook-static/assets/MenuButton.stories-B-W_QVDt.js +162 -0
- package/storybook-static/assets/MenuItem-iU6tAqJI.js +1 -0
- package/storybook-static/assets/Modal-3okp9H2i.js +1 -0
- package/storybook-static/assets/Modal.stories-DIWzm4qR.js +468 -0
- package/storybook-static/assets/MoreVert-BoIVG4gh.js +1 -0
- package/storybook-static/assets/Notifications-DY_A-Sho.js +1 -0
- package/storybook-static/assets/PageLoader.stories-DmtO1mlm.js +158 -0
- package/storybook-static/assets/Paper-SwQBhqI7.js +1 -0
- package/storybook-static/assets/Person-CkQl-mpq.js +1 -0
- package/storybook-static/assets/PickersModalDialog-Tjnr_cu5.js +10 -0
- package/storybook-static/assets/PickersToolbarButton-Tt185-si.js +1 -0
- package/storybook-static/assets/Popper-CnCTYXxy.js +1 -0
- package/storybook-static/assets/Portal-Cj8XF9Lf.js +1 -0
- package/storybook-static/assets/ScrollTopButton.stories-BflQCwNP.js +90 -0
- package/storybook-static/assets/Select-CjcuMAY0.js +4 -0
- package/storybook-static/assets/Select-DJh2biEb.js +3 -0
- package/storybook-static/assets/Select.stories-DU1Gb3I2.js +1103 -0
- package/storybook-static/assets/Settings-BLKc1CnO.js +1 -0
- package/storybook-static/assets/Snackbar-BtVeKTw6.js +1 -0
- package/storybook-static/assets/Stack-D01OUIXi.js +1 -0
- package/storybook-static/assets/Stat.stories-Bn9-iuPT.js +60 -0
- package/storybook-static/assets/StatusMessage.stories-hnfX8FeU.js +73 -0
- package/storybook-static/assets/Stepper-BtKB5ykn.js +2 -0
- package/storybook-static/assets/Stepper.stories-CTEZbgPc.js +165 -0
- package/storybook-static/assets/Table.stories-CTn2Ktmn.js +1260 -0
- package/storybook-static/assets/TableContainer-CzLNaEU-.js +1 -0
- package/storybook-static/assets/TableRow-CS88-1HF.js +2 -0
- package/storybook-static/assets/Tabs-DLpDOu_n.js +1 -0
- package/storybook-static/assets/Tabs.stories-BFVuFy_5.js +159 -0
- package/storybook-static/assets/TextField-22T-xHBm.js +1 -0
- package/storybook-static/assets/Timeline.stories-DJU_U2Hv.js +97 -0
- package/storybook-static/assets/Tooltip-DbnHUxNj.js +1 -0
- package/storybook-static/assets/Tooltip.stories-B7tA3dnV.js +66 -0
- package/storybook-static/assets/Typography-BgntX2Ep.js +1 -0
- package/storybook-static/assets/Wizard.stories-CVrJLK_D.js +23 -0
- package/storybook-static/assets/createSimplePaletteValueFilter-bm0fmN_7.js +1 -0
- package/storybook-static/assets/createSvgIcon-D_Gca4vA.js +1 -0
- package/storybook-static/assets/debounce-Be36O1Ab.js +1 -0
- package/storybook-static/assets/emotion-react.browser.esm--g-C9cX9.js +8 -0
- package/storybook-static/assets/extendSxProp-CEpa30hT.js +1 -0
- package/storybook-static/assets/formField.sx-DMCmZIAa.js +1 -0
- package/storybook-static/assets/getReactElementRef-BQ3ANZdy.js +1 -0
- package/storybook-static/assets/iframe-BAJnc_4n.js +1079 -0
- package/storybook-static/assets/index-B1tlhOpe.js +240 -0
- package/storybook-static/assets/index-BF3FAXTk.js +9 -0
- package/storybook-static/assets/index-CIeucmOB.js +2 -0
- package/storybook-static/assets/index-CY7j4a7o.js +1 -0
- package/storybook-static/assets/index-CxkKctw5.js +1 -0
- package/storybook-static/assets/isFocusVisible-B8k4qzLc.js +1 -0
- package/storybook-static/assets/isMuiElement-CTZSFcY5.js +1 -0
- package/storybook-static/assets/jsx-runtime-D_zvdyIk.js +9 -0
- package/storybook-static/assets/listItemTextClasses-CC_rwJam.js +1 -0
- package/storybook-static/assets/mergeSlotProps-B0UBKBMe.js +1 -0
- package/storybook-static/assets/ownerDocument-DW-IO8s5.js +1 -0
- package/storybook-static/assets/ownerWindow-HkKU3E4x.js +1 -0
- package/storybook-static/assets/preload-helper-PPVm8Dsz.js +1 -0
- package/storybook-static/assets/react-18-BUJ64QCV.js +25 -0
- package/storybook-static/assets/resolvePreset-CN2aOJJr.js +1 -0
- package/storybook-static/assets/useControlled-DsVh1a5j.js +1 -0
- package/storybook-static/assets/useForkRef-0ANIrxcF.js +1 -0
- package/storybook-static/assets/useId-b4fZxjOL.js +1 -0
- package/storybook-static/assets/useMobilePicker-DK-c8xbD.js +1 -0
- package/storybook-static/assets/usePreviousProps-WR0rG4aR.js +1 -0
- package/storybook-static/assets/useSlot-b6pXgp5_.js +1 -0
- package/storybook-static/assets/useSlotProps-C0uMfuBt.js +1 -0
- package/storybook-static/assets/useTheme-BmOJK7ra.js +1 -0
- package/storybook-static/assets/useThemeProps-DYtxXiUU.js +1 -0
- package/storybook-static/assets/useThemeProps-U4yXiZ_5.js +1 -0
- package/storybook-static/assets/useTimeout-DNjRaOWc.js +1 -0
- package/storybook-static/assets/visuallyHidden-Dan1xhjv.js +1 -0
- package/storybook-static/favicon-wrapper.svg +46 -0
- package/storybook-static/favicon.svg +1 -0
- package/storybook-static/iframe.html +686 -0
- package/storybook-static/index.html +160 -0
- package/storybook-static/index.json +1 -0
- package/storybook-static/nunito-sans-bold-italic.woff2 +0 -0
- package/storybook-static/nunito-sans-bold.woff2 +0 -0
- package/storybook-static/nunito-sans-italic.woff2 +0 -0
- package/storybook-static/nunito-sans-regular.woff2 +0 -0
- package/storybook-static/project.json +1 -0
- package/storybook-static/sb-addons/chromatic-com-storybook-2/manager-bundle.js +356 -0
- package/storybook-static/sb-addons/chromatic-com-storybook-2/manager-bundle.js.LEGAL.txt +40 -0
- package/storybook-static/sb-addons/docs-4/manager-bundle.js +151 -0
- package/storybook-static/sb-addons/onboarding-1/manager-bundle.js +127 -0
- package/storybook-static/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +971 -0
- package/storybook-static/sb-addons/vitest-3/manager-bundle.js +3 -0
- package/storybook-static/sb-common-assets/favicon-wrapper.svg +46 -0
- package/storybook-static/sb-common-assets/favicon.svg +1 -0
- package/storybook-static/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-bold.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-italic.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-regular.woff2 +0 -0
- package/storybook-static/sb-manager/globals-module-info.js +797 -0
- package/storybook-static/sb-manager/globals-runtime.js +69679 -0
- package/storybook-static/sb-manager/globals.js +34 -0
- package/storybook-static/sb-manager/runtime.js +13195 -0
- package/storybook-static/vite-inject-mocker-entry.js +18 -0
- package/tailwind.config.js +10 -0
- package/tsconfig.json +48 -0
- package/tsup.config.js +41 -0
- package/vite.config.js +132 -0
- package/vitest.config.ts +35 -0
- package/dist/components/AppBar/AppBarBrand.d.ts +0 -31
- package/dist/components/AppBar/AppBarUserMenu.d.ts +0 -65
- package/dist/components/Autocomplete/Autocomplete.types.d.ts +0 -1
- package/dist/components/DatePicker/DatePicker.types.d.ts +0 -1
- package/dist/components/DateRangePicker/DateRangePicker.cjs.map +0 -1
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +0 -15
- package/dist/components/DateRangePicker/DateRangePicker.definitions.d.ts +0 -6
- package/dist/components/DateRangePicker/DateRangePicker.js.map +0 -1
- package/dist/components/DateRangePicker/index.d.ts +0 -1
- package/dist/components/DateRangePicker.d.ts +0 -2
- package/dist/components/DateTimePicker/DateTimePicker.types.d.ts +0 -1
- package/dist/components/Input/Input.types.d.ts +0 -1
- package/dist/components/PageLoader/PageLoader.cjs +0 -61
- package/dist/components/PageLoader/PageLoader.cjs.map +0 -1
- package/dist/components/PageLoader/PageLoader.d.ts +0 -38
- package/dist/components/PageLoader/PageLoader.js +0 -61
- package/dist/components/PageLoader/PageLoader.js.map +0 -1
- package/dist/components/PageLoader/index.d.ts +0 -2
- package/dist/components/PageLoader.d.ts +0 -6
- package/dist/components/ScrollTopButton/ScrollTopButton.cjs +0 -79
- package/dist/components/ScrollTopButton/ScrollTopButton.cjs.map +0 -1
- package/dist/components/ScrollTopButton/ScrollTopButton.d.ts +0 -48
- package/dist/components/ScrollTopButton/ScrollTopButton.js +0 -79
- package/dist/components/ScrollTopButton/ScrollTopButton.js.map +0 -1
- package/dist/components/ScrollTopButton/index.d.ts +0 -4
- package/dist/components/ScrollTopButton.d.ts +0 -6
- package/dist/components/Select/Select.definitions.d.ts +0 -17
- package/dist/components/Select/Select.types.d.ts +0 -1
- package/dist/components/Select/_parts/SelectSearchHeader.d.ts +0 -15
- package/dist/formField.sx-CQ1mbk9M.cjs.map +0 -1
- package/dist/formField.sx-DfVbMe0V.js.map +0 -1
- package/dist/hooks/Wizard/Wizard.cjs +0 -7
- package/dist/hooks/Wizard/Wizard.cjs.map +0 -1
- package/dist/hooks/Wizard/Wizard.js +0 -7
- package/dist/hooks/Wizard/Wizard.js.map +0 -1
- package/dist/hooks/Wizard/index.d.ts +0 -3
- package/dist/hooks/Wizard/useWizard.d.ts +0 -9
- package/dist/hooks/Wizard.d.ts +0 -2
- package/dist/useWizard-CWdIxZzX.cjs +0 -94
- package/dist/useWizard-CWdIxZzX.cjs.map +0 -1
- package/dist/useWizard-CWq--C3o.js +0 -95
- package/dist/useWizard-CWq--C3o.js.map +0 -1
- /package/dist/{styles.css → index.css} +0 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { TimelineItem } from "./TimelineItem";
|
|
3
|
+
import { DefaultTimelineDefinition } from "./Timeline.definition";
|
|
4
|
+
import { Timeline } from "./Timeline";
|
|
5
|
+
import { Box } from "@mui/material";
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof Timeline> = {
|
|
8
|
+
title: "Components/Timeline",
|
|
9
|
+
component: Timeline,
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: "centered"
|
|
12
|
+
},
|
|
13
|
+
tags: ["autodocs"]
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default meta;
|
|
17
|
+
|
|
18
|
+
type Story = StoryObj<typeof Timeline>;
|
|
19
|
+
|
|
20
|
+
export const Default: Story = {
|
|
21
|
+
args: {
|
|
22
|
+
position: "right"
|
|
23
|
+
},
|
|
24
|
+
render: (args) => (
|
|
25
|
+
<Box sx={{ width: 300 }}>
|
|
26
|
+
<Timeline {...args}>
|
|
27
|
+
<TimelineItem>
|
|
28
|
+
eat
|
|
29
|
+
</TimelineItem>
|
|
30
|
+
<TimelineItem>
|
|
31
|
+
code
|
|
32
|
+
</TimelineItem>
|
|
33
|
+
<TimelineItem>
|
|
34
|
+
sleep
|
|
35
|
+
</TimelineItem>
|
|
36
|
+
</Timeline>
|
|
37
|
+
</Box>
|
|
38
|
+
),
|
|
39
|
+
parameters: {
|
|
40
|
+
docs: {
|
|
41
|
+
description: {
|
|
42
|
+
story: "Ejemplo básico de timeline"
|
|
43
|
+
},
|
|
44
|
+
source: {
|
|
45
|
+
code: DefaultTimelineDefinition
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const ColorVariant: Story = {
|
|
52
|
+
render: () => (
|
|
53
|
+
<Box sx={{ width: 300 }}>
|
|
54
|
+
<Timeline>
|
|
55
|
+
<TimelineItem dotColor="success" connectorColor="error">
|
|
56
|
+
eat
|
|
57
|
+
</TimelineItem>
|
|
58
|
+
<TimelineItem dotColor="primary" connectorColor="success">
|
|
59
|
+
code
|
|
60
|
+
</TimelineItem>
|
|
61
|
+
<TimelineItem dotColor="warning">
|
|
62
|
+
repeat
|
|
63
|
+
</TimelineItem>
|
|
64
|
+
</Timeline>
|
|
65
|
+
</Box>
|
|
66
|
+
),
|
|
67
|
+
parameters: {
|
|
68
|
+
docs: {
|
|
69
|
+
description: {
|
|
70
|
+
story: "Variantes de color en los dots y conectores"
|
|
71
|
+
},
|
|
72
|
+
source: {
|
|
73
|
+
code: DefaultTimelineDefinition
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const PositionVariant: Story = {
|
|
80
|
+
render: () => (
|
|
81
|
+
<Box sx={{ width: 300 }}>
|
|
82
|
+
<Timeline position="alternate">
|
|
83
|
+
<TimelineItem>
|
|
84
|
+
eat
|
|
85
|
+
</TimelineItem>
|
|
86
|
+
<TimelineItem>
|
|
87
|
+
code
|
|
88
|
+
</TimelineItem>
|
|
89
|
+
<TimelineItem>
|
|
90
|
+
repeat
|
|
91
|
+
</TimelineItem>
|
|
92
|
+
</Timeline>
|
|
93
|
+
</Box>
|
|
94
|
+
),
|
|
95
|
+
args: {
|
|
96
|
+
position: "alternate"
|
|
97
|
+
},
|
|
98
|
+
parameters: {
|
|
99
|
+
docs: {
|
|
100
|
+
description: {
|
|
101
|
+
story: "Variantes de color en los dots y conectores"
|
|
102
|
+
},
|
|
103
|
+
source: {
|
|
104
|
+
code: DefaultTimelineDefinition
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import MuiTimeline from '@mui/lab/Timeline';
|
|
3
|
+
import { timelineItemClasses } from '@mui/lab/TimelineItem';
|
|
4
|
+
|
|
5
|
+
import type { TimelineItemProps } from './TimelineItem';
|
|
6
|
+
|
|
7
|
+
export interface TimelineProps {
|
|
8
|
+
children: React.ReactElement<TimelineItemProps>[];
|
|
9
|
+
position?: 'left' | 'right' | 'alternate' | 'alternate-reverse';
|
|
10
|
+
sx?: object;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const Timeline: React.FC<TimelineProps> = ({ children, position = "right", sx }) => {
|
|
14
|
+
const count = React.Children.count(children);
|
|
15
|
+
|
|
16
|
+
const customSx = (position === "left" || position === "right")
|
|
17
|
+
? {
|
|
18
|
+
[`& .${timelineItemClasses.root}:before`]: {
|
|
19
|
+
flex: 0,
|
|
20
|
+
padding: 0,
|
|
21
|
+
},
|
|
22
|
+
...sx,
|
|
23
|
+
}
|
|
24
|
+
: sx;
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<MuiTimeline position={position}
|
|
28
|
+
sx={{...customSx}}
|
|
29
|
+
>
|
|
30
|
+
{React.Children.map(children, (child, idx) =>
|
|
31
|
+
React.isValidElement(child)
|
|
32
|
+
? React.cloneElement(child, {
|
|
33
|
+
connectorColor: idx < count - 1
|
|
34
|
+
? child.props.connectorColor ?? 'grey'
|
|
35
|
+
: undefined,
|
|
36
|
+
})
|
|
37
|
+
: null
|
|
38
|
+
)}
|
|
39
|
+
</MuiTimeline>
|
|
40
|
+
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export default Timeline;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
import MuiTimelineItem from "@mui/lab/TimelineItem";
|
|
3
|
+
import MuiTimelineSeparator from "@mui/lab/TimelineSeparator";
|
|
4
|
+
import MuiTimelineConnector from "@mui/lab/TimelineConnector";
|
|
5
|
+
import MuiTimelineContent from "@mui/lab/TimelineContent";
|
|
6
|
+
import MuiTimelineDot from "@mui/lab/TimelineDot";
|
|
7
|
+
|
|
8
|
+
export interface TimelineItemProps {
|
|
9
|
+
dotColor?: 'primary' | 'secondary' | 'grey' | 'inherit' | 'success' | 'error' | 'info' | 'warning';
|
|
10
|
+
connectorColor?: 'success' | 'error' | 'info' | 'warning' | 'primary' | 'secondary' | 'grey';
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const TimelineItem: React.FC<TimelineItemProps> = ({
|
|
15
|
+
dotColor = 'grey',
|
|
16
|
+
connectorColor,
|
|
17
|
+
children
|
|
18
|
+
}) => {
|
|
19
|
+
const color = connectorColor ? `${connectorColor}.main` : 'secondary.main';
|
|
20
|
+
return (
|
|
21
|
+
<MuiTimelineItem>
|
|
22
|
+
<MuiTimelineSeparator>
|
|
23
|
+
<MuiTimelineDot color={dotColor} />
|
|
24
|
+
{connectorColor !== undefined && <MuiTimelineConnector sx={{ bgcolor: color }} />}
|
|
25
|
+
</MuiTimelineSeparator>
|
|
26
|
+
<MuiTimelineContent>{children}</MuiTimelineContent>
|
|
27
|
+
</MuiTimelineItem>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default TimelineItem
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import Tooltip from './Tooltip'; // Asegúrate que la ruta sea correcta
|
|
4
|
+
import Button from '@mui/material/Button';
|
|
5
|
+
import Stack from '@mui/material/Stack';
|
|
6
|
+
import { Input } from '../Input/Input';
|
|
7
|
+
|
|
8
|
+
// Helper controlado para envolver nuestro Input propio con estado local
|
|
9
|
+
const TooltipNameInput: React.FC = () => {
|
|
10
|
+
const [value, setValue] = useState<string | number>('');
|
|
11
|
+
return (
|
|
12
|
+
<Input
|
|
13
|
+
label="Nombre"
|
|
14
|
+
value={value}
|
|
15
|
+
onChange={(next) => setValue(next)}
|
|
16
|
+
/>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// --- Metadatos de la Historia ---
|
|
21
|
+
// Define la configuración global de tu componente en Storybook
|
|
22
|
+
const meta: Meta<typeof Tooltip> = {
|
|
23
|
+
// Título que aparecerá en el sidebar de Storybook
|
|
24
|
+
title: 'Components/Tooltip',
|
|
25
|
+
component: Tooltip,
|
|
26
|
+
// Parámetros para configurar el comportamiento en la documentación
|
|
27
|
+
parameters: {
|
|
28
|
+
layout: 'centered', // Centra el componente en el lienzo
|
|
29
|
+
},
|
|
30
|
+
// Documentación de los argumentos (props)
|
|
31
|
+
|
|
32
|
+
tags: ["autodocs"]
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default meta;
|
|
36
|
+
|
|
37
|
+
// Define el tipo de tu historia para inferir los argumentos (props)
|
|
38
|
+
type Story = StoryObj<typeof Tooltip>;
|
|
39
|
+
|
|
40
|
+
// --- Definición de Historias ---
|
|
41
|
+
|
|
42
|
+
const textoLargo = "Este es un texto de Tooltip muy largo para demostrar cómo el 'maxWidth' limita la longitud de la línea y obliga al texto a saltar a la siguiente línea, mejorando la legibilidad en tooltips largos.";
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Historia 1: Tooltip Básico
|
|
47
|
+
* Muestra el Tooltip sobre un botón sin especificar un ancho máximo.
|
|
48
|
+
*/
|
|
49
|
+
export const TooltipBasico: Story = {
|
|
50
|
+
args: {
|
|
51
|
+
text: 'Información corta y concisa.',
|
|
52
|
+
children: <Button variant="contained">Pasa el ratón aquí</Button>,
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Historia 2: Tooltip con Ancho Máximo Específico
|
|
58
|
+
* Muestra un texto largo y aplica un ancho máximo para forzar el salto de línea.
|
|
59
|
+
*/
|
|
60
|
+
export const TooltipConAnchoMaximo: Story = {
|
|
61
|
+
args: {
|
|
62
|
+
text: textoLargo,
|
|
63
|
+
maxWidth: 200, // Aplicamos el ancho máximo
|
|
64
|
+
children: <Button variant="outlined">Tooltip con Ancho Máximo (200px)</Button>,
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Historia 3: Tooltip Aplicado a un Campo de Texto (TextField)
|
|
70
|
+
* Demuestra que el componente funciona con cualquier elemento.
|
|
71
|
+
*/
|
|
72
|
+
export const AplicadoAElementoDeFormulario: Story = {
|
|
73
|
+
args: {
|
|
74
|
+
text: 'Introduce tu nombre completo y validado.',
|
|
75
|
+
maxWidth: 300,
|
|
76
|
+
children: <TooltipNameInput />,
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Historia 4: Ejemplo en un Contenedor con Estilos
|
|
82
|
+
* Muestra el uso de la propiedad 'sx' opcional en el contenedor.
|
|
83
|
+
*/
|
|
84
|
+
export const ContenedorEstilizado: Story = {
|
|
85
|
+
args: {
|
|
86
|
+
text: 'Este texto se muestra al pasar el ratón sobre el span estilizado.',
|
|
87
|
+
maxWidth: 250,
|
|
88
|
+
sx: { // Estilos aplicados al Box que envuelve el children
|
|
89
|
+
border: '2px dashed #007bff',
|
|
90
|
+
padding: '8px',
|
|
91
|
+
borderRadius: '4px',
|
|
92
|
+
backgroundColor: '#e6f7ff',
|
|
93
|
+
},
|
|
94
|
+
children: <span>Contenedor Estilizado (Hover aquí)</span>,
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Historia 5: Variantes Múltiples
|
|
101
|
+
* Utiliza el 'render' para mostrar varios ejemplos a la vez.
|
|
102
|
+
*/
|
|
103
|
+
export const VariantesMultiples: Story = {
|
|
104
|
+
// Necesitamos un Stack para organizar los elementos
|
|
105
|
+
render: (args) => (
|
|
106
|
+
<Stack spacing={4} alignItems="flex-start" sx={{ padding: '20px' }}>
|
|
107
|
+
<Tooltip {...args} text="Tooltip #1: Básico" maxWidth={150}>
|
|
108
|
+
<Button variant="contained" color="primary">Botón A</Button>
|
|
109
|
+
</Tooltip>
|
|
110
|
+
|
|
111
|
+
<Tooltip {...args} text="Tooltip #2: Un poco más de info" maxWidth={180}>
|
|
112
|
+
<Button variant="contained" color="secondary">Botón B</Button>
|
|
113
|
+
</Tooltip>
|
|
114
|
+
|
|
115
|
+
<Tooltip {...args} text={textoLargo} maxWidth={280}>
|
|
116
|
+
<Button variant="text">Texto Largo</Button>
|
|
117
|
+
</Tooltip>
|
|
118
|
+
</Stack>
|
|
119
|
+
),
|
|
120
|
+
// Eliminamos el layout centered para esta historia
|
|
121
|
+
parameters: {
|
|
122
|
+
layout: 'padded',
|
|
123
|
+
},
|
|
124
|
+
// Dejamos el 'args' de 'text' vacío ya que se sobrescribe en el render
|
|
125
|
+
args: {
|
|
126
|
+
text: '',
|
|
127
|
+
children: undefined,
|
|
128
|
+
}
|
|
129
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import MuiTooltip from '@mui/material/Tooltip';
|
|
3
|
+
import Typography from '@mui/material/Typography';
|
|
4
|
+
import Box from '@mui/material/Box';
|
|
5
|
+
import { SxProps, Theme } from '@mui/material';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Propiedades del componente Tooltip.
|
|
9
|
+
* @param {string} text - El texto a mostrar dentro del Tooltip.
|
|
10
|
+
* @param {number} [maxWidth] - El ancho máximo opcional del Tooltip en píxeles.
|
|
11
|
+
* @param {React.ReactNode} children - El elemento al que se le aplicará el Tooltip.
|
|
12
|
+
* @param {SxProps<Theme>} [sx] - Estilos opcionales para el Box contenedor.
|
|
13
|
+
*/
|
|
14
|
+
interface TooltipProps {
|
|
15
|
+
text: string;
|
|
16
|
+
maxWidth?: number;
|
|
17
|
+
children: React.ReactNode;
|
|
18
|
+
sx?: SxProps<Theme>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Componente Tooltip reutilizable.
|
|
23
|
+
* Muestra un texto al pasar el ratón sobre su elemento hijo,
|
|
24
|
+
* permitiendo un ancho máximo configurable.
|
|
25
|
+
* * @param {TooltipProps} props - Propiedades del Tooltip.
|
|
26
|
+
*/
|
|
27
|
+
const Tooltip: React.FC<TooltipProps> = ({ text, maxWidth, children, sx }) => {
|
|
28
|
+
|
|
29
|
+
const tooltipContentStyle: SxProps<Theme> = {
|
|
30
|
+
|
|
31
|
+
...(maxWidth && { maxWidth: maxWidth }),
|
|
32
|
+
padding: '4px 8px',
|
|
33
|
+
textAlign: 'center',
|
|
34
|
+
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
|
|
39
|
+
<MuiTooltip
|
|
40
|
+
title={
|
|
41
|
+
|
|
42
|
+
<Typography variant="caption" component="span" sx={tooltipContentStyle}>
|
|
43
|
+
{text}
|
|
44
|
+
</Typography>
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
placement="top"
|
|
48
|
+
arrow
|
|
49
|
+
>
|
|
50
|
+
|
|
51
|
+
<Box component="span" sx={{ display: 'inline-block', ...sx }}>
|
|
52
|
+
{children}
|
|
53
|
+
</Box>
|
|
54
|
+
</MuiTooltip>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export default Tooltip;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Tooltip } from './Tooltip';
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { SxProps, Theme } from '@mui/material/styles';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
LABEL_COLOR_FILLED,
|
|
5
|
+
LABEL_COLOR_FOCUSED,
|
|
6
|
+
LABEL_COLOR_REST,
|
|
7
|
+
LABEL_FONT_WEIGHT_FILLED,
|
|
8
|
+
LABEL_MARGIN_TOP,
|
|
9
|
+
LABEL_SHRINK_TRANSFORM,
|
|
10
|
+
LABEL_TRANSFORM_ORIGIN,
|
|
11
|
+
LABEL_TRANSITION,
|
|
12
|
+
} from '../../theme/tokens';
|
|
13
|
+
|
|
14
|
+
export type LabelPosition = 'outside' | 'floating';
|
|
15
|
+
|
|
16
|
+
export interface BuildFormFieldSxOptions {
|
|
17
|
+
borderRadius: number | string;
|
|
18
|
+
labelPosition: LabelPosition;
|
|
19
|
+
/**
|
|
20
|
+
* Si es `true`, los selectores incluyen también la API nueva de MUI X
|
|
21
|
+
* Pickers (v8): `MuiPickersInputBase-root`, `MuiPickersOutlinedInput-*`.
|
|
22
|
+
*/
|
|
23
|
+
includePickersApi?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Selectores/valores extra que se mergean SOLO cuando labelPosition === 'outside'.
|
|
26
|
+
* Usar para paddings específicos del componente (p.ej. MuiAutocomplete-input).
|
|
27
|
+
*/
|
|
28
|
+
extraOutsideSx?: Record<string, any>;
|
|
29
|
+
/**
|
|
30
|
+
* Selectores/valores extra que se mergean SOLO cuando labelPosition === 'floating'.
|
|
31
|
+
*/
|
|
32
|
+
extraFloatingSx?: Record<string, any>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const toRadius = (borderRadius: number | string) =>
|
|
36
|
+
typeof borderRadius === 'number' ? `${borderRadius}px` : borderRadius;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Builder del sx compartido por todos los campos de formulario
|
|
40
|
+
* (Input/Select/Autocomplete/DatePicker/DateTimePicker).
|
|
41
|
+
*
|
|
42
|
+
* Produce:
|
|
43
|
+
* - en modo "floating": sólo el border-radius del outlined input;
|
|
44
|
+
* - en modo "outside": todo el pack (margen superior, label flotante afuera,
|
|
45
|
+
* input base, notched outline oculto, helper text sin margen izquierdo).
|
|
46
|
+
*
|
|
47
|
+
* Componentes con paddings o selectores propios pueden inyectarlos vía
|
|
48
|
+
* `extraOutsideSx` / `extraFloatingSx`.
|
|
49
|
+
*/
|
|
50
|
+
export const buildFormFieldSx = ({
|
|
51
|
+
borderRadius,
|
|
52
|
+
labelPosition,
|
|
53
|
+
includePickersApi = false,
|
|
54
|
+
extraOutsideSx,
|
|
55
|
+
extraFloatingSx,
|
|
56
|
+
}: BuildFormFieldSxOptions): SxProps<Theme> => {
|
|
57
|
+
const radius = toRadius(borderRadius);
|
|
58
|
+
|
|
59
|
+
// ── Selectores (alternan según la API de pickers) ────────────────────
|
|
60
|
+
const outlinedRootSelector = includePickersApi
|
|
61
|
+
? '& .MuiOutlinedInput-root, & .MuiPickersOutlinedInput-root'
|
|
62
|
+
: '& .MuiOutlinedInput-root';
|
|
63
|
+
|
|
64
|
+
const inputBaseSelector = includePickersApi
|
|
65
|
+
? '& .MuiInputBase-root, & .MuiPickersInputBase-root'
|
|
66
|
+
: '& .MuiInputBase-root';
|
|
67
|
+
|
|
68
|
+
const notchedOutlineSelector = includePickersApi
|
|
69
|
+
? '& .MuiOutlinedInput-notchedOutline, & .MuiPickersOutlinedInput-notchedOutline'
|
|
70
|
+
: '& .MuiOutlinedInput-notchedOutline';
|
|
71
|
+
|
|
72
|
+
// ── Floating ─────────────────────────────────────────────────────────
|
|
73
|
+
if (labelPosition === 'floating') {
|
|
74
|
+
return {
|
|
75
|
+
[outlinedRootSelector]: { borderRadius: radius },
|
|
76
|
+
...(extraFloatingSx ?? {}),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// ── Outside ──────────────────────────────────────────────────────────
|
|
81
|
+
return {
|
|
82
|
+
marginTop: LABEL_MARGIN_TOP,
|
|
83
|
+
|
|
84
|
+
'& .MuiInputLabel-root': {
|
|
85
|
+
color: LABEL_COLOR_REST,
|
|
86
|
+
transition: LABEL_TRANSITION,
|
|
87
|
+
|
|
88
|
+
// Estado shrunk (focused o con valor): flota ARRIBA del input.
|
|
89
|
+
'&.MuiInputLabel-shrink': {
|
|
90
|
+
transform: LABEL_SHRINK_TRANSFORM,
|
|
91
|
+
transformOrigin: LABEL_TRANSFORM_ORIGIN,
|
|
92
|
+
color: LABEL_COLOR_FILLED,
|
|
93
|
+
fontWeight: LABEL_FONT_WEIGHT_FILLED,
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
'&.Mui-focused': { color: LABEL_COLOR_FOCUSED },
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
// Input base — centra verticalmente (clásico y, si aplica, pickers).
|
|
100
|
+
[inputBaseSelector]: {
|
|
101
|
+
borderRadius: radius,
|
|
102
|
+
display: 'flex',
|
|
103
|
+
alignItems: 'center',
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
// El label flota afuera: ocultar legend del notch.
|
|
107
|
+
[notchedOutlineSelector]: {
|
|
108
|
+
top: 0,
|
|
109
|
+
'& legend': { display: 'none' },
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
'& .MuiFormHelperText-root': {
|
|
113
|
+
marginLeft: 0,
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
...(extraOutsideSx ?? {}),
|
|
117
|
+
};
|
|
118
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SxProps, Theme } from '@mui/material/styles';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Merge helper para props `sx` de MUI. Acepta formatos objeto o array y
|
|
5
|
+
* devuelve un array combinado. El `extra` se aplica después del `base` —
|
|
6
|
+
* el consumer puede pisar los defaults del componente.
|
|
7
|
+
*/
|
|
8
|
+
export const mergeSx = (
|
|
9
|
+
base: SxProps<Theme>,
|
|
10
|
+
extra?: SxProps<Theme>,
|
|
11
|
+
): SxProps<Theme> => {
|
|
12
|
+
if (!extra) return base;
|
|
13
|
+
const baseArr = Array.isArray(base) ? base : [base];
|
|
14
|
+
const extraArr = Array.isArray(extra) ? extra : [extra];
|
|
15
|
+
return [...baseArr, ...extraArr] as SxProps<Theme>;
|
|
16
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { SxProps, Theme } from '@mui/material/styles';
|
|
2
|
+
|
|
3
|
+
import type { LibraryComponentName, PresetStyle } from '../../theme/componentStyles';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Nombre del preset built-in del paquete. No se registra en el theme: si un
|
|
7
|
+
* componente recibe `preset="default"` (o no recibe preset), sólo aplica el
|
|
8
|
+
* estilo base de fábrica.
|
|
9
|
+
*/
|
|
10
|
+
export const DEFAULT_PRESET_NAME = 'default';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Resuelve el sx de un preset registrado en `theme.styles[componentName]`.
|
|
14
|
+
*
|
|
15
|
+
* - Si `presetName` es `"default"` o `undefined`, devuelve `undefined`
|
|
16
|
+
* (caller sólo aplicará el estilo base del paquete).
|
|
17
|
+
* - Si la entrada en el theme es una función `(theme) => sx`, se ejecuta.
|
|
18
|
+
* - Si la entrada no existe, devuelve `undefined` silenciosamente (no se
|
|
19
|
+
* rompe el componente — la responsabilidad de registrarlo es del consumer).
|
|
20
|
+
*/
|
|
21
|
+
export function resolvePreset(
|
|
22
|
+
componentName: LibraryComponentName,
|
|
23
|
+
presetName: string | undefined,
|
|
24
|
+
theme: Theme,
|
|
25
|
+
): SxProps<Theme> | undefined {
|
|
26
|
+
// Si no hay preset explícito, intentar aplicar el preset "default" del theme.
|
|
27
|
+
// Esto permite que el consumer registre estilos globales sin necesidad de
|
|
28
|
+
// pasar `preset` en cada instancia del componente.
|
|
29
|
+
const nameToResolve = presetName || DEFAULT_PRESET_NAME;
|
|
30
|
+
|
|
31
|
+
const componentPresets = theme.styles?.[componentName];
|
|
32
|
+
if (!componentPresets) return undefined;
|
|
33
|
+
|
|
34
|
+
const entry: PresetStyle | undefined = componentPresets[nameToResolve];
|
|
35
|
+
if (!entry) return undefined;
|
|
36
|
+
|
|
37
|
+
return typeof entry === 'function' ? entry(theme) : entry;
|
|
38
|
+
}
|