@soyfri/shared-library 1.5.0 → 1.6.0-beta.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/Button-C17mExpd.cjs.map +1 -0
- package/Button-UkkP-bNw.js.map +1 -0
- package/components/ActionMenu/ActionMenu.cjs +107 -0
- package/components/ActionMenu/ActionMenu.cjs.map +1 -0
- package/components/ActionMenu/ActionMenu.d.ts +44 -0
- package/components/ActionMenu/ActionMenu.js +107 -0
- package/components/ActionMenu/ActionMenu.js.map +1 -0
- package/components/ActionMenu/index.d.ts +2 -0
- package/components/ActionMenu.d.ts +6 -0
- package/components/AppBar/AppBar.cjs +129 -0
- package/components/AppBar/AppBar.cjs.map +1 -0
- package/components/AppBar/AppBar.d.ts +55 -0
- package/components/AppBar/AppBar.js +129 -0
- package/components/AppBar/AppBar.js.map +1 -0
- package/components/AppBar/AppBar.sx.d.ts +12 -0
- package/components/AppBar/AppBarContext.d.ts +18 -0
- package/components/AppBar/AppBarMenuToggle.d.ts +39 -0
- package/components/AppBar/index.d.ts +6 -0
- package/components/AppBar.d.ts +6 -0
- package/components/Autocomplete/Autocomplete.cjs +313 -0
- package/components/Autocomplete/Autocomplete.cjs.map +1 -0
- package/components/Autocomplete/Autocomplete.d.ts +86 -0
- package/components/Autocomplete/Autocomplete.definitions.d.ts +16 -0
- package/components/Autocomplete/Autocomplete.helpers.d.ts +22 -0
- package/components/Autocomplete/Autocomplete.js +313 -0
- package/components/Autocomplete/Autocomplete.js.map +1 -0
- package/components/Autocomplete/Autocomplete.sx.d.ts +7 -0
- package/components/Autocomplete/_parts/AutocompleteChips.d.ts +20 -0
- package/components/Autocomplete/_parts/AutocompleteLoader.d.ts +9 -0
- package/components/Autocomplete/_parts/AutocompleteOption.d.ts +16 -0
- package/components/Autocomplete/index.d.ts +2 -0
- package/components/Autocomplete.d.ts +6 -0
- package/components/Avatar/Avatar.cjs +162 -0
- package/components/Avatar/Avatar.cjs.map +1 -0
- package/components/Avatar/Avatar.d.ts +33 -0
- package/components/Avatar/Avatar.definitions.d.ts +11 -0
- package/components/Avatar/Avatar.js +162 -0
- package/components/Avatar/Avatar.js.map +1 -0
- package/components/Avatar/index.d.ts +2 -0
- package/{dist/components → components}/Button/Button.d.ts +5 -5
- package/{dist/components → components}/Button/index.d.ts +1 -0
- package/components/Card/Card.cjs +99 -0
- package/components/Card/Card.cjs.map +1 -0
- package/components/Card/Card.d.ts +36 -0
- package/components/Card/Card.js +99 -0
- package/components/Card/Card.js.map +1 -0
- package/components/Card/Card.sx.d.ts +14 -0
- package/components/Card/index.d.ts +4 -0
- package/components/Card.d.ts +6 -0
- package/components/Checkbox/Checkbox.cjs +189 -0
- package/components/Checkbox/Checkbox.cjs.map +1 -0
- package/components/Checkbox/Checkbox.d.ts +55 -0
- package/components/Checkbox/Checkbox.js +189 -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/{dist/components → components}/Chip/Chip.cjs +2 -1
- package/components/Chip/Chip.cjs.map +1 -0
- package/{dist/components → components}/Chip/Chip.js +2 -1
- package/components/Chip/Chip.js.map +1 -0
- package/components/Chip/index.d.ts +2 -0
- package/components/Chip.d.ts +6 -0
- package/components/DatePicker/DatePicker.cjs +180 -0
- package/components/DatePicker/DatePicker.cjs.map +1 -0
- package/components/DatePicker/DatePicker.d.ts +44 -0
- package/{dist/components → components}/DatePicker/DatePicker.definitions.d.ts +1 -0
- package/components/DatePicker/DatePicker.helpers.d.ts +7 -0
- package/components/DatePicker/DatePicker.js +180 -0
- package/components/DatePicker/DatePicker.js.map +1 -0
- package/components/DatePicker/DatePicker.sx.d.ts +9 -0
- package/components/DatePicker/index.d.ts +2 -0
- package/components/DatePicker.d.ts +6 -0
- package/components/DateTimePicker/DateTimePicker.cjs +198 -0
- package/components/DateTimePicker/DateTimePicker.cjs.map +1 -0
- package/components/DateTimePicker/DateTimePicker.d.ts +57 -0
- package/{dist/components → components}/DateTimePicker/DateTimePicker.definitions.d.ts +3 -0
- package/components/DateTimePicker/DateTimePicker.helpers.d.ts +13 -0
- package/components/DateTimePicker/DateTimePicker.js +198 -0
- package/components/DateTimePicker/DateTimePicker.js.map +1 -0
- package/components/DateTimePicker/DateTimePicker.sx.d.ts +7 -0
- package/components/DateTimePicker/index.d.ts +2 -0
- package/components/DateTimePicker.d.ts +6 -0
- package/components/Drawer/Drawer.cjs +272 -0
- package/components/Drawer/Drawer.cjs.map +1 -0
- package/components/Drawer/Drawer.d.ts +58 -0
- package/components/Drawer/Drawer.js +272 -0
- package/components/Drawer/Drawer.js.map +1 -0
- package/components/Drawer/Drawer.sx.d.ts +23 -0
- package/components/Drawer/DrawerContext.d.ts +18 -0
- package/components/Drawer/DrawerItem.d.ts +40 -0
- package/components/Drawer/index.d.ts +6 -0
- package/components/Drawer.d.ts +6 -0
- package/{dist/components → components}/Gallery/Gallery.cjs +154 -79
- package/components/Gallery/Gallery.cjs.map +1 -0
- package/components/Gallery/Gallery.d.ts +28 -0
- package/{dist/components → components}/Gallery/Gallery.js +154 -79
- package/components/Gallery/Gallery.js.map +1 -0
- package/components/Gallery/GalleryLightbox.d.ts +16 -0
- package/{dist/components → components}/Gallery/GalleryMain.d.ts +3 -7
- package/components/Gallery/GalleryThumbnails.d.ts +13 -0
- package/components/Gallery/index.d.ts +2 -0
- package/components/Gallery.d.ts +6 -0
- package/{dist/components → components}/Icon/Icon.cjs +49 -10
- package/components/Icon/Icon.cjs.map +1 -0
- package/components/Icon/Icon.d.ts +48 -0
- package/{dist/components → components}/Icon/Icon.js +49 -10
- package/components/Icon/Icon.js.map +1 -0
- package/components/Icon/index.d.ts +2 -0
- package/components/Icon.d.ts +6 -0
- package/components/Input/Input.cjs +188 -0
- package/components/Input/Input.cjs.map +1 -0
- package/components/Input/Input.d.ts +44 -0
- package/{dist/components → components}/Input/Input.definitions.d.ts +6 -2
- package/components/Input/Input.helpers.d.ts +14 -0
- package/components/Input/Input.js +188 -0
- package/components/Input/Input.js.map +1 -0
- package/components/Input/Input.sx.d.ts +8 -0
- package/components/Input/index.d.ts +2 -0
- package/components/Input.d.ts +6 -0
- package/components/InputGroup/InputGroup.cjs +140 -0
- package/components/InputGroup/InputGroup.cjs.map +1 -0
- package/components/InputGroup/InputGroup.d.ts +42 -0
- package/components/InputGroup/InputGroup.definitions.d.ts +6 -0
- package/components/InputGroup/InputGroup.js +140 -0
- package/components/InputGroup/InputGroup.js.map +1 -0
- package/components/InputGroup/index.d.ts +2 -0
- package/components/InputGroup.d.ts +6 -0
- package/components/Modal/Modal.cjs +348 -0
- package/components/Modal/Modal.cjs.map +1 -0
- package/components/Modal/Modal.d.ts +80 -0
- package/components/Modal/Modal.js +348 -0
- package/components/Modal/Modal.js.map +1 -0
- package/components/Modal/ModalBody.d.ts +11 -0
- package/components/Modal/ModalFooter.d.ts +27 -0
- package/components/Modal/ModalHeader.d.ts +11 -0
- package/components/Modal/index.d.ts +8 -0
- package/components/Modal.d.ts +6 -0
- package/components/RadioGroup/RadioGroup.cjs +204 -0
- package/components/RadioGroup/RadioGroup.cjs.map +1 -0
- package/components/RadioGroup/RadioGroup.d.ts +59 -0
- package/components/RadioGroup/RadioGroup.definitions.d.ts +6 -0
- package/components/RadioGroup/RadioGroup.js +204 -0
- package/components/RadioGroup/RadioGroup.js.map +1 -0
- package/components/RadioGroup/RadioGroup.sx.d.ts +20 -0
- package/components/RadioGroup/index.d.ts +2 -0
- package/components/RadioGroup.d.ts +6 -0
- package/components/Select/Select.cjs +313 -0
- package/components/Select/Select.cjs.map +1 -0
- package/components/Select/Select.d.ts +95 -0
- package/components/Select/Select.helpers.d.ts +15 -0
- package/components/Select/Select.js +313 -0
- package/components/Select/Select.js.map +1 -0
- package/components/Select/Select.sx.d.ts +7 -0
- package/components/Select/_parts/SelectMenuItem.d.ts +20 -0
- package/components/Select/index.d.ts +2 -0
- package/components/Select.d.ts +6 -0
- package/{dist/components → components}/Stat/Stat.cjs +2 -2
- package/{dist/components → components}/Stat/Stat.cjs.map +1 -1
- package/{dist/components → components}/Stat/Stat.js +2 -2
- package/{dist/components → components}/Stat/Stat.js.map +1 -1
- package/components/Stat/index.d.ts +2 -0
- package/components/Stat.d.ts +6 -0
- package/components/StatusMessage/StatusMessage.cjs +90 -0
- package/components/StatusMessage/StatusMessage.cjs.map +1 -0
- package/components/StatusMessage/StatusMessage.d.ts +28 -0
- package/components/StatusMessage/StatusMessage.js +90 -0
- package/components/StatusMessage/StatusMessage.js.map +1 -0
- package/components/StatusMessage/index.d.ts +2 -0
- package/components/StatusMessage.d.ts +6 -0
- package/components/Stepper/Stepper.cjs +302 -0
- package/components/Stepper/Stepper.cjs.map +1 -0
- package/components/Stepper/Stepper.d.ts +17 -0
- package/components/Stepper/Stepper.js +302 -0
- package/components/Stepper/Stepper.js.map +1 -0
- package/components/Stepper/StepperContext.d.ts +73 -0
- 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 -0
- package/components/Stepper.d.ts +6 -0
- package/components/Switch/Switch.cjs +184 -0
- package/components/Switch/Switch.cjs.map +1 -0
- package/components/Switch/Switch.d.ts +48 -0
- package/components/Switch/Switch.definitions.d.ts +7 -0
- package/components/Switch/Switch.js +184 -0
- package/components/Switch/Switch.js.map +1 -0
- package/components/Switch/Switch.sx.d.ts +22 -0
- package/components/Switch/Switch.types.d.ts +1 -0
- package/components/Switch/index.d.ts +2 -0
- package/components/Switch.d.ts +6 -0
- package/components/Tabs/Tabs.cjs +112 -0
- package/components/Tabs/Tabs.cjs.map +1 -0
- package/components/Tabs/Tabs.d.ts +24 -0
- package/components/Tabs/Tabs.js +112 -0
- package/components/Tabs/Tabs.js.map +1 -0
- package/components/Tabs/index.d.ts +4 -0
- package/components/Tabs.d.ts +6 -0
- package/{dist/components → components}/Timeline/Timeline.cjs +3 -2
- package/components/Timeline/Timeline.cjs.map +1 -0
- package/components/Timeline/Timeline.d.ts +9 -0
- package/{dist/components → components}/Timeline/Timeline.js +3 -2
- package/components/Timeline/Timeline.js.map +1 -0
- package/components/Timeline/index.d.ts +4 -0
- package/components/Timeline.d.ts +6 -0
- package/components/_shared/formField.sx.d.ts +33 -0
- package/components/_shared/mergeSx.d.ts +7 -0
- package/components/_shared/resolvePreset.d.ts +18 -0
- package/formField.sx-8_QRnKxv.js +68 -0
- package/formField.sx-8_QRnKxv.js.map +1 -0
- package/formField.sx-BAX7KwMR.cjs +67 -0
- package/formField.sx-BAX7KwMR.cjs.map +1 -0
- package/index.cjs +145 -0
- package/index.cjs.map +1 -0
- package/index.d.ts +4 -0
- package/index.js +49 -0
- package/index.js.map +1 -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 +7 -0
- package/package.json +164 -43
- package/resolvePreset-B-IB0ehH.js +15 -0
- package/resolvePreset-B-IB0ehH.js.map +1 -0
- package/resolvePreset-CT3kU-K2.cjs +14 -0
- package/resolvePreset-CT3kU-K2.cjs.map +1 -0
- package/theme/componentStyles.d.ts +32 -0
- package/theme/tokens.d.ts +28 -0
- 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/utils/scrollToTop.d.ts +28 -0
- package/.dockerignore +0 -8
- package/.github/workflows/publish.yml +0 -107
- package/.prettierrc +0 -3
- package/.storybook/main.ts +0 -19
- package/.storybook/preview.ts +0 -14
- package/.storybook/vitest.setup.ts +0 -9
- package/Dockerfile +0 -37
- package/build.js +0 -102
- package/chromatic.config.json +0 -5
- package/cleanDirectories.js +0 -40
- package/dist/Button-C17mExpd.cjs.map +0 -1
- package/dist/Button-UkkP-bNw.js.map +0 -1
- package/dist/DatePicker-BSNboVhN.js +0 -201
- package/dist/DatePicker-BSNboVhN.js.map +0 -1
- package/dist/DatePicker-BoqxWAhj.cjs +0 -200
- package/dist/DatePicker-BoqxWAhj.cjs.map +0 -1
- package/dist/Input-DFHs7cJ_.js +0 -171
- package/dist/Input-DFHs7cJ_.js.map +0 -1
- package/dist/Input-c8MwNNPg.cjs +0 -170
- package/dist/Input-c8MwNNPg.cjs.map +0 -1
- package/dist/Select-BO2N56sm.cjs +0 -411
- package/dist/Select-BO2N56sm.cjs.map +0 -1
- package/dist/Select-BcLkyHSE.js +0 -412
- package/dist/Select-BcLkyHSE.js.map +0 -1
- package/dist/components/Autocomplete/Autocomplete.cjs +0 -109
- package/dist/components/Autocomplete/Autocomplete.cjs.map +0 -1
- package/dist/components/Autocomplete/Autocomplete.d.ts +0 -28
- package/dist/components/Autocomplete/Autocomplete.definitions.d.ts +0 -9
- package/dist/components/Autocomplete/Autocomplete.js +0 -109
- package/dist/components/Autocomplete/Autocomplete.js.map +0 -1
- package/dist/components/Autocomplete/index.d.ts +0 -1
- package/dist/components/Autocomplete.d.ts +0 -2
- package/dist/components/Avatar/Avatar.cjs +0 -126
- package/dist/components/Avatar/Avatar.cjs.map +0 -1
- package/dist/components/Avatar/Avatar.d.ts +0 -19
- package/dist/components/Avatar/Avatar.js +0 -126
- package/dist/components/Avatar/Avatar.js.map +0 -1
- package/dist/components/Avatar/index.d.ts +0 -1
- package/dist/components/Card/Card.cjs +0 -28
- package/dist/components/Card/Card.cjs.map +0 -1
- package/dist/components/Card/Card.d.ts +0 -13
- package/dist/components/Card/Card.js +0 -28
- package/dist/components/Card/Card.js.map +0 -1
- package/dist/components/Card/index.d.ts +0 -1
- package/dist/components/Card.d.ts +0 -2
- package/dist/components/Chip/Chip.cjs.map +0 -1
- package/dist/components/Chip/Chip.js.map +0 -1
- package/dist/components/Chip/index.d.ts +0 -1
- package/dist/components/Chip.d.ts +0 -2
- package/dist/components/DatePicker/DatePicker.cjs +0 -5
- package/dist/components/DatePicker/DatePicker.cjs.map +0 -1
- package/dist/components/DatePicker/DatePicker.d.ts +0 -18
- package/dist/components/DatePicker/DatePicker.js +0 -5
- package/dist/components/DatePicker/DatePicker.js.map +0 -1
- package/dist/components/DatePicker/index.d.ts +0 -1
- package/dist/components/DatePicker.d.ts +0 -2
- package/dist/components/DateTimePicker/DateTimePicker.cjs +0 -208
- package/dist/components/DateTimePicker/DateTimePicker.cjs.map +0 -1
- package/dist/components/DateTimePicker/DateTimePicker.d.ts +0 -28
- package/dist/components/DateTimePicker/DateTimePicker.js +0 -208
- package/dist/components/DateTimePicker/DateTimePicker.js.map +0 -1
- package/dist/components/DateTimePicker/index.d.ts +0 -1
- package/dist/components/DateTimePicker.d.ts +0 -2
- package/dist/components/Gallery/Gallery.cjs.map +0 -1
- package/dist/components/Gallery/Gallery.d.ts +0 -12
- package/dist/components/Gallery/Gallery.js.map +0 -1
- package/dist/components/Gallery/GalleryLightbox.d.ts +0 -20
- package/dist/components/Gallery/GalleryThumbnails.d.ts +0 -17
- package/dist/components/Gallery/index.d.ts +0 -1
- package/dist/components/Gallery.d.ts +0 -2
- package/dist/components/Icon/Icon.cjs.map +0 -1
- package/dist/components/Icon/Icon.d.ts +0 -21
- package/dist/components/Icon/Icon.js.map +0 -1
- package/dist/components/Icon/index.d.ts +0 -1
- package/dist/components/Icon.d.ts +0 -2
- package/dist/components/Input/Input.cjs +0 -5
- package/dist/components/Input/Input.cjs.map +0 -1
- package/dist/components/Input/Input.d.ts +0 -32
- package/dist/components/Input/Input.js +0 -5
- package/dist/components/Input/Input.js.map +0 -1
- package/dist/components/Input/index.d.ts +0 -1
- package/dist/components/Input.d.ts +0 -2
- package/dist/components/InputGroup/InputGroup.cjs +0 -126
- package/dist/components/InputGroup/InputGroup.cjs.map +0 -1
- package/dist/components/InputGroup/InputGroup.d.ts +0 -6
- package/dist/components/InputGroup/InputGroup.js +0 -126
- package/dist/components/InputGroup/InputGroup.js.map +0 -1
- package/dist/components/InputGroup/index.d.ts +0 -1
- package/dist/components/InputGroup.d.ts +0 -2
- package/dist/components/Modal/Modal.cjs +0 -209
- package/dist/components/Modal/Modal.cjs.map +0 -1
- package/dist/components/Modal/Modal.d.ts +0 -29
- package/dist/components/Modal/Modal.js +0 -209
- package/dist/components/Modal/Modal.js.map +0 -1
- package/dist/components/Modal/ModalBody.d.ts +0 -6
- package/dist/components/Modal/ModalFooter.d.ts +0 -19
- package/dist/components/Modal/ModalHeader.d.ts +0 -6
- package/dist/components/Modal/index.d.ts +0 -1
- package/dist/components/Modal.d.ts +0 -2
- package/dist/components/Select/Select.cjs +0 -6
- package/dist/components/Select/Select.cjs.map +0 -1
- package/dist/components/Select/Select.d.ts +0 -60
- package/dist/components/Select/Select.definitions.d.ts +0 -14
- package/dist/components/Select/Select.js +0 -6
- package/dist/components/Select/Select.js.map +0 -1
- package/dist/components/Select/index.d.ts +0 -1
- package/dist/components/Select.d.ts +0 -2
- package/dist/components/Stat/index.d.ts +0 -1
- package/dist/components/Stat.d.ts +0 -2
- package/dist/components/StatusMessage/StatusMessage.cjs +0 -79
- package/dist/components/StatusMessage/StatusMessage.cjs.map +0 -1
- package/dist/components/StatusMessage/StatusMessage.d.ts +0 -44
- package/dist/components/StatusMessage/StatusMessage.js +0 -79
- package/dist/components/StatusMessage/StatusMessage.js.map +0 -1
- package/dist/components/StatusMessage/index.d.ts +0 -1
- package/dist/components/StatusMessage.d.ts +0 -2
- package/dist/components/Stepper/Stepper.cjs +0 -46
- package/dist/components/Stepper/Stepper.cjs.map +0 -1
- package/dist/components/Stepper/Stepper.d.ts +0 -11
- package/dist/components/Stepper/Stepper.js +0 -46
- package/dist/components/Stepper/Stepper.js.map +0 -1
- package/dist/components/Stepper/index.d.ts +0 -2
- package/dist/components/Stepper.d.ts +0 -2
- package/dist/components/Tabs/Tabs.cjs +0 -96
- package/dist/components/Tabs/Tabs.cjs.map +0 -1
- package/dist/components/Tabs/Tabs.d.ts +0 -19
- package/dist/components/Tabs/Tabs.js +0 -96
- package/dist/components/Tabs/Tabs.js.map +0 -1
- package/dist/components/Tabs/index.d.ts +0 -2
- package/dist/components/Tabs.d.ts +0 -2
- package/dist/components/Timeline/Timeline.cjs.map +0 -1
- package/dist/components/Timeline/Timeline.d.ts +0 -13
- package/dist/components/Timeline/Timeline.js.map +0 -1
- package/dist/components/Timeline/index.d.ts +0 -2
- package/dist/components/Timeline.d.ts +0 -2
- package/dist/index.cjs +0 -2
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts +0 -0
- package/dist/index.js +0 -2
- package/dist/index.js.map +0 -1
- package/dist/styles.css +0 -112
- package/rollup.config.cjs +0 -87
- package/src/components/Autocomplete/Autocomplete.definitions.ts +0 -254
- package/src/components/Autocomplete/Autocomplete.stories.tsx +0 -387
- package/src/components/Autocomplete/Autocomplete.tsx +0 -139
- package/src/components/Autocomplete/index.ts +0 -1
- package/src/components/Avatar/Avatar.stories.tsx +0 -54
- package/src/components/Avatar/Avatar.tsx +0 -143
- package/src/components/Avatar/index.ts +0 -1
- package/src/components/Button/Button.definition.ts +0 -97
- package/src/components/Button/Button.stories.tsx +0 -285
- package/src/components/Button/Button.tsx +0 -67
- package/src/components/Button/index.ts +0 -1
- package/src/components/Card/Card.definition.ts +0 -5
- package/src/components/Card/Card.stories.tsx +0 -32
- package/src/components/Card/Card.tsx +0 -44
- package/src/components/Card/index.ts +0 -1
- package/src/components/Chip/Chip.definitions.ts +0 -167
- package/src/components/Chip/Chip.stories.tsx +0 -265
- package/src/components/Chip/Chip.tsx +0 -61
- package/src/components/Chip/index.ts +0 -1
- package/src/components/Column/Column.tsx +0 -29
- package/src/components/Column/index.ts +0 -1
- package/src/components/DatePicker/DatePicker.definitions.ts +0 -205
- package/src/components/DatePicker/DatePicker.stories.tsx +0 -282
- package/src/components/DatePicker/DatePicker.tsx +0 -165
- package/src/components/DatePicker/index.ts +0 -1
- package/src/components/DateRangePicker/DateRangePicker.definitions.ts +0 -191
- package/src/components/DateRangePicker/DateRangePicker.stories.tsx +0 -252
- package/src/components/DateRangePicker/DateRangePicker.tsx +0 -56
- package/src/components/DateRangePicker/index.ts +0 -1
- package/src/components/DateTimePicker/DateTimePicker.definitions.ts +0 -232
- package/src/components/DateTimePicker/DateTimePicker.stories.tsx +0 -390
- package/src/components/DateTimePicker/DateTimePicker.tsx +0 -191
- package/src/components/DateTimePicker/index.ts +0 -1
- package/src/components/Flyout/Flyout.stories.tsx +0 -274
- package/src/components/Flyout/Flyout.tsx +0 -122
- package/src/components/Flyout/index.ts +0 -1
- package/src/components/Gallery/Gallery.definition.tsx +0 -37
- package/src/components/Gallery/Gallery.stories.tsx +0 -82
- package/src/components/Gallery/Gallery.tsx +0 -118
- package/src/components/Gallery/GalleryLightbox.tsx +0 -170
- package/src/components/Gallery/GalleryMain.tsx +0 -84
- package/src/components/Gallery/GalleryThumbnails.tsx +0 -106
- package/src/components/Gallery/index.ts +0 -1
- package/src/components/Icon/Icon.stories.tsx +0 -54
- package/src/components/Icon/Icon.tsx +0 -94
- package/src/components/Icon/index.ts +0 -2
- package/src/components/Input/Input.definitions.ts +0 -252
- package/src/components/Input/Input.stories.tsx +0 -387
- package/src/components/Input/Input.tsx +0 -186
- package/src/components/Input/index.ts +0 -1
- package/src/components/InputGroup/InputGroup.stories.tsx +0 -136
- package/src/components/InputGroup/InputGroup.tsx +0 -136
- package/src/components/InputGroup/index.ts +0 -1
- package/src/components/MenuButton/MenuButton.stories.tsx +0 -197
- package/src/components/MenuButton/MenuButton.tsx +0 -100
- package/src/components/MenuButton/index.ts +0 -1
- package/src/components/Modal/Modal.stories.tsx +0 -293
- package/src/components/Modal/Modal.tsx +0 -173
- package/src/components/Modal/ModalBody.tsx +0 -16
- package/src/components/Modal/ModalFooter.tsx +0 -61
- package/src/components/Modal/ModalHeader.tsx +0 -18
- package/src/components/Modal/index.ts +0 -1
- package/src/components/Select/Select.definitions.ts +0 -488
- package/src/components/Select/Select.stories.tsx +0 -569
- package/src/components/Select/Select.tsx +0 -468
- package/src/components/Select/index.ts +0 -1
- package/src/components/Stat/Stat.stories.tsx +0 -85
- package/src/components/Stat/Stat.tsx +0 -117
- package/src/components/Stat/index.ts +0 -2
- package/src/components/StatusMessage/StatusMessage.stories.tsx +0 -130
- package/src/components/StatusMessage/StatusMessage.tsx +0 -162
- package/src/components/StatusMessage/index.ts +0 -2
- package/src/components/Stepper/Step.tsx +0 -21
- package/src/components/Stepper/Stepper.definition.ts +0 -75
- package/src/components/Stepper/Stepper.stories.tsx +0 -122
- package/src/components/Stepper/Stepper.tsx +0 -59
- package/src/components/Stepper/index.ts +0 -2
- package/src/components/Table/EmptyTable.png +0 -0
- package/src/components/Table/Table.definition.ts +0 -580
- package/src/components/Table/Table.stories.tsx +0 -853
- package/src/components/Table/Table.tsx +0 -495
- package/src/components/Table/data.ts +0 -134
- package/src/components/Table/exportsUtils.ts +0 -195
- package/src/components/Table/index.ts +0 -3
- package/src/components/Table/types.ts +0 -34
- package/src/components/Tabs/Tab.definition.ts +0 -53
- package/src/components/Tabs/Tab.tsx +0 -19
- package/src/components/Tabs/Tabs.stories.tsx +0 -118
- package/src/components/Tabs/Tabs.tsx +0 -99
- package/src/components/Tabs/_tabUtils.tsx +0 -4
- package/src/components/Tabs/index.ts +0 -2
- package/src/components/Timeline/Timeline.definition.ts +0 -43
- package/src/components/Timeline/Timeline.stories.tsx +0 -108
- package/src/components/Timeline/Timeline.tsx +0 -49
- package/src/components/Timeline/TimelineItem.tsx +0 -31
- package/src/components/Timeline/index.ts +0 -2
- package/src/components/Tooltip/Tooltip.stories.tsx +0 -117
- package/src/components/Tooltip/Tooltip.tsx +0 -58
- package/src/components/Tooltip/index.ts +0 -1
- package/src/hooks/ClipBoard/ClipBoard.stories.tsx +0 -168
- package/src/hooks/ClipBoard/ClipBoard.tsx +0 -131
- package/src/hooks/ClipBoard/ClipboardUnifiedDemo.tsx +0 -111
- package/src/hooks/ClipBoard/index.ts +0 -1
- package/src/index.ts +0 -1
- package/src/styles.css +0 -3
- package/tailwind.config.js +0 -10
- package/tsconfig.json +0 -48
- package/tsup.config.js +0 -41
- package/vite.config.js +0 -132
- package/vitest.config.ts +0 -35
- /package/{dist/Button-C17mExpd.cjs → Button-C17mExpd.cjs} +0 -0
- /package/{dist/Button-UkkP-bNw.js → Button-UkkP-bNw.js} +0 -0
- /package/{Readme.md → README.md} +0 -0
- /package/{dist/components → components}/Avatar.d.ts +0 -0
- /package/{dist/components → components}/Button/Button.cjs +0 -0
- /package/{dist/components → components}/Button/Button.cjs.map +0 -0
- /package/{dist/components → components}/Button/Button.definition.d.ts +0 -0
- /package/{dist/components → components}/Button/Button.js +0 -0
- /package/{dist/components → components}/Button/Button.js.map +0 -0
- /package/{dist/components → components}/Button.d.ts +0 -0
- /package/{dist/components → components}/Card/Card.definition.d.ts +0 -0
- /package/{dist/components → components}/Chip/Chip.d.ts +0 -0
- /package/{dist/components → components}/Chip/Chip.definitions.d.ts +0 -0
- /package/{dist/components → components}/Column/Column.cjs +0 -0
- /package/{dist/components → components}/Column/Column.cjs.map +0 -0
- /package/{dist/components → components}/Column/Column.d.ts +0 -0
- /package/{dist/components → components}/Column/Column.js +0 -0
- /package/{dist/components → components}/Column/Column.js.map +0 -0
- /package/{dist/components → components}/Column/index.d.ts +0 -0
- /package/{dist/components → components}/Column.d.ts +0 -0
- /package/{dist/components → components}/DateRangePicker/DateRangePicker.cjs +0 -0
- /package/{dist/components → components}/DateRangePicker/DateRangePicker.cjs.map +0 -0
- /package/{dist/components → components}/DateRangePicker/DateRangePicker.d.ts +0 -0
- /package/{dist/components → components}/DateRangePicker/DateRangePicker.definitions.d.ts +0 -0
- /package/{dist/components → components}/DateRangePicker/DateRangePicker.js +0 -0
- /package/{dist/components → components}/DateRangePicker/DateRangePicker.js.map +0 -0
- /package/{dist/components → components}/DateRangePicker/index.d.ts +0 -0
- /package/{dist/components → components}/DateRangePicker.d.ts +0 -0
- /package/{dist/components → components}/Flyout/Flyout.cjs +0 -0
- /package/{dist/components → components}/Flyout/Flyout.cjs.map +0 -0
- /package/{dist/components → components}/Flyout/Flyout.d.ts +0 -0
- /package/{dist/components → components}/Flyout/Flyout.js +0 -0
- /package/{dist/components → components}/Flyout/Flyout.js.map +0 -0
- /package/{dist/components → components}/Flyout/index.d.ts +0 -0
- /package/{dist/components → components}/Flyout.d.ts +0 -0
- /package/{dist/components → components}/Gallery/Gallery.definition.d.ts +0 -0
- /package/{dist/components → components}/MenuButton/MenuButton.cjs +0 -0
- /package/{dist/components → components}/MenuButton/MenuButton.cjs.map +0 -0
- /package/{dist/components → components}/MenuButton/MenuButton.d.ts +0 -0
- /package/{dist/components → components}/MenuButton/MenuButton.js +0 -0
- /package/{dist/components → components}/MenuButton/MenuButton.js.map +0 -0
- /package/{dist/components → components}/MenuButton/index.d.ts +0 -0
- /package/{dist/components → components}/MenuButton.d.ts +0 -0
- /package/{dist/components → components}/Stat/Stat.d.ts +0 -0
- /package/{dist/components → components}/Stepper/Step.d.ts +0 -0
- /package/{dist/components → components}/Stepper/Stepper.definition.d.ts +0 -0
- /package/{dist/components → components}/Table/Table.cjs +0 -0
- /package/{dist/components → components}/Table/Table.cjs.map +0 -0
- /package/{dist/components → components}/Table/Table.d.ts +0 -0
- /package/{dist/components → components}/Table/Table.definition.d.ts +0 -0
- /package/{dist/components → components}/Table/Table.js +0 -0
- /package/{dist/components → components}/Table/Table.js.map +0 -0
- /package/{dist/components → components}/Table/data.d.ts +0 -0
- /package/{dist/components → components}/Table/exportsUtils.d.ts +0 -0
- /package/{dist/components → components}/Table/index.d.ts +0 -0
- /package/{dist/components → components}/Table/types.d.ts +0 -0
- /package/{dist/components → components}/Table.d.ts +0 -0
- /package/{dist/components → components}/Tabs/Tab.d.ts +0 -0
- /package/{dist/components → components}/Tabs/Tab.definition.d.ts +0 -0
- /package/{dist/components → components}/Tabs/_tabUtils.d.ts +0 -0
- /package/{dist/components → components}/Timeline/Timeline.definition.d.ts +0 -0
- /package/{dist/components → components}/Timeline/TimelineItem.d.ts +0 -0
- /package/{dist/components → components}/Tooltip/Tooltip.cjs +0 -0
- /package/{dist/components → components}/Tooltip/Tooltip.cjs.map +0 -0
- /package/{dist/components → components}/Tooltip/Tooltip.d.ts +0 -0
- /package/{dist/components → components}/Tooltip/Tooltip.js +0 -0
- /package/{dist/components → components}/Tooltip/Tooltip.js.map +0 -0
- /package/{dist/components → components}/Tooltip/index.d.ts +0 -0
- /package/{dist/components → components}/Tooltip.d.ts +0 -0
- /package/{dist/hooks → hooks}/ClipBoard/ClipBoard.cjs +0 -0
- /package/{dist/hooks → hooks}/ClipBoard/ClipBoard.cjs.map +0 -0
- /package/{dist/hooks → hooks}/ClipBoard/ClipBoard.d.ts +0 -0
- /package/{dist/hooks → hooks}/ClipBoard/ClipBoard.js +0 -0
- /package/{dist/hooks → hooks}/ClipBoard/ClipBoard.js.map +0 -0
- /package/{dist/hooks → hooks}/ClipBoard/ClipboardUnifiedDemo.d.ts +0 -0
- /package/{dist/hooks → hooks}/ClipBoard/index.d.ts +0 -0
- /package/{dist/hooks → hooks}/ClipBoard.d.ts +0 -0
- /package/{dist/index.css → index.css} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppBar.js","sources":["../../../src/components/AppBar/AppBarContext.ts","../../../src/components/AppBar/AppBar.sx.ts","../../../src/components/AppBar/AppBar.tsx","../../../src/components/AppBar/AppBarMenuToggle.tsx"],"sourcesContent":["import { createContext, useContext } from 'react';\n\n/**\n * Context interno del AppBar. Permite que sub-componentes (MenuToggle, etc.)\n * consuman callbacks registrados en el AppBar padre sin tener que pasarlos\n * por props explícitas.\n */\nexport interface AppBarContextValue {\n /** Handler del botón hamburguesa. Si es undefined, el toggle se oculta. */\n onMenuToggle?: () => void;\n /** Estado actual del drawer asociado (usado por el icono del toggle). */\n menuOpen?: boolean;\n}\n\nexport const AppBarContext = createContext<AppBarContextValue | null>(null);\n\n/**\n * Hook para leer el contexto del AppBar. Si se llama fuera de un `<AppBar>`,\n * devuelve un objeto vacío — los sub-componentes caen en modo \"standalone\"\n * con sus defaults en lugar de romper.\n */\nexport function useAppBarContext(): AppBarContextValue {\n const ctx = useContext(AppBarContext);\n return ctx ?? {};\n}\n","import type { SxProps, Theme } from '@mui/material/styles';\n\nexport interface BuildAppBarSxArgs {\n /** Altura en px. Default: 64. */\n height?: number;\n /** Color del AppBar (se pasa al MuiAppBar). */\n transparent?: boolean;\n}\n\n/**\n * sx del root del MuiAppBar. Define altura fija y layout flex del Toolbar\n * interno. El color/elevación se dejan a las props nativas de MuiAppBar.\n */\nexport function buildAppBarSx({\n height = 64,\n transparent = false,\n}: BuildAppBarSxArgs): SxProps<Theme> {\n return (theme) => ({\n minHeight: height,\n justifyContent: 'center',\n backgroundImage: 'none',\n ...(transparent && {\n backgroundColor: 'transparent',\n boxShadow: 'none',\n borderBottom: `1px solid ${theme.palette.divider}`,\n }),\n '& .MuiToolbar-root': {\n minHeight: height,\n gap: 1.5,\n },\n });\n}\n","import React, { useMemo, type ReactNode } from 'react';\nimport {\n AppBar as MuiAppBar,\n Toolbar,\n type AppBarProps as MuiAppBarProps,\n} from '@mui/material';\nimport {\n useTheme,\n type SxProps,\n type Theme,\n} from '@mui/material/styles';\n\nimport { AppBarContext } from './AppBarContext';\nimport { buildAppBarSx } from './AppBar.sx';\nimport { resolvePreset } from '../_shared/resolvePreset';\n\nexport type AppBarPosition = 'fixed' | 'sticky' | 'static' | 'absolute' | 'relative';\nexport type AppBarColor =\n | 'default'\n | 'primary'\n | 'secondary'\n | 'transparent'\n | 'inherit';\n\nexport interface AppBarProps {\n /** Contenido del AppBar (típicamente sub-componentes + acciones custom). */\n children?: ReactNode;\n /** Posicionamiento. Default: `'sticky'`. */\n position?: AppBarPosition;\n /** Color. Default: `'default'`. */\n color?: AppBarColor;\n /** Nivel de sombra. Default: 1. */\n elevation?: number;\n /** Altura en px. Default: 64. */\n height?: number;\n /**\n * Handler del botón hamburguesa. Se expone vía AppBarContext para que el\n * sub-componente `<AppBarMenuToggle>` lo consuma sin prop drilling.\n */\n onMenuToggle?: () => void;\n /** Estado del drawer asociado (para que el icono del toggle cambie). */\n menuOpen?: boolean;\n /**\n * Nombre del preset de estilo registrado en `theme.styles.AppBar`.\n * - `\"default\"` (o ausente) = estilo built-in del paquete.\n */\n preset?: string;\n /** sx del root (se mergea después del preset). */\n sx?: SxProps<Theme>;\n /** sx del Toolbar interno. */\n toolbarSx?: SxProps<Theme>;\n className?: string;\n /** Otras props nativas del MuiAppBar (ej. `enableColorOnDark`). */\n appBarProps?: Omit<\n MuiAppBarProps,\n 'position' | 'color' | 'elevation' | 'sx' | 'children' | 'className'\n >;\n}\n\n/**\n * AppBar (header superior) del paquete. Se diseñó como un shell compositivo\n * — el consumer arma el contenido libremente (logo, título, menú de usuario,\n * etc.) y puede usar `<AppBarMenuToggle>` para el botón hamburguesa\n * integrado con el contexto.\n *\n * Patrón recomendado para navegación en dashboards:\n *\n * ```tsx\n * <AppBar onMenuToggle={toggleDrawer}>\n * <AppBarMenuToggle />\n * <MyBrand />\n * <Box sx={{ flex: 1 }} />\n * <MyUserMenu />\n * </AppBar>\n * ```\n */\nexport function AppBar({\n children,\n position = 'sticky',\n color = 'default',\n elevation = 1,\n height = 64,\n onMenuToggle,\n menuOpen,\n preset,\n sx,\n toolbarSx,\n appBarProps,\n}: AppBarProps) {\n const theme = useTheme();\n const presetSx = resolvePreset('AppBar', preset, theme);\n\n const rootSx: SxProps<Theme> = [\n buildAppBarSx({ height, transparent: color === 'transparent' }),\n ...(presetSx ? [presetSx] : []),\n ...(Array.isArray(sx) ? sx : sx ? [sx] : []),\n ];\n\n const contextValue = useMemo(\n () => ({ onMenuToggle, menuOpen }),\n [onMenuToggle, menuOpen],\n );\n\n return (\n <AppBarContext.Provider value={contextValue}>\n <MuiAppBar\n position={position}\n color={color}\n elevation={elevation}\n sx={rootSx}\n {...appBarProps}\n >\n <Toolbar sx={toolbarSx}>{children}</Toolbar>\n </MuiAppBar>\n </AppBarContext.Provider>\n );\n}\n\nexport default AppBar;\n","import { type ReactNode } from 'react';\nimport { IconButton, Tooltip } from '@mui/material';\nimport MenuIcon from '@mui/icons-material/Menu';\nimport MenuOpenIcon from '@mui/icons-material/MenuOpen';\nimport type { SxProps, Theme } from '@mui/material/styles';\n\nimport { useAppBarContext } from './AppBarContext';\n\nexport interface AppBarMenuToggleProps {\n /**\n * Callback explícito. Si se omite, se consume del `AppBarContext`. Útil para\n * usar el toggle fuera de un `<AppBar>` (p.ej. en un header custom).\n */\n onClick?: () => void;\n /** Estado del drawer asociado. Si se omite, se lee del `AppBarContext`. */\n menuOpen?: boolean;\n /** Icono custom cuando el drawer está cerrado. Default: `<MenuIcon />`. */\n closedIcon?: ReactNode;\n /** Icono custom cuando el drawer está abierto. Default: `<MenuOpenIcon />`. */\n openIcon?: ReactNode;\n /** Texto de tooltip. Default: \"Menú\". */\n tooltip?: string;\n /** aria-label del botón. Default: el mismo tooltip. */\n ariaLabel?: string;\n /** Tamaño del IconButton. Default: `'medium'`. */\n size?: 'small' | 'medium' | 'large';\n /** Oculta el botón cuando no hay handler disponible. Default: true. */\n hideIfNoHandler?: boolean;\n sx?: SxProps<Theme>;\n className?: string;\n}\n\n/**\n * Botón hamburguesa del AppBar. Por default consume `onMenuToggle` y\n * `menuOpen` del `AppBarContext` (pattern composicional), pero permite\n * overrides explícitos si se usa fuera de un `<AppBar>`.\n *\n * ```tsx\n * <AppBar onMenuToggle={toggleDrawer} menuOpen={open}>\n * <AppBarMenuToggle />\n * ...\n * </AppBar>\n * ```\n */\nexport function AppBarMenuToggle({\n onClick,\n menuOpen,\n closedIcon,\n openIcon,\n tooltip = 'Menú',\n ariaLabel,\n size = 'medium',\n hideIfNoHandler = true,\n sx,\n className,\n}: AppBarMenuToggleProps) {\n const ctx = useAppBarContext();\n\n const handler = onClick ?? ctx.onMenuToggle;\n const open = menuOpen ?? ctx.menuOpen ?? false;\n\n if (!handler && hideIfNoHandler) {\n return null;\n }\n\n const icon = open\n ? (openIcon ?? <MenuOpenIcon />)\n : (closedIcon ?? <MenuIcon />);\n\n return (\n <Tooltip title={tooltip} arrow>\n <span>\n <IconButton\n size={size}\n edge=\"start\"\n color=\"inherit\"\n aria-label={ariaLabel ?? tooltip}\n onClick={handler}\n disabled={!handler}\n className={className}\n sx={sx}\n >\n {icon}\n </IconButton>\n </span>\n </Tooltip>\n );\n}\n\nexport default AppBarMenuToggle;\n"],"names":["MuiAppBar"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAcO,MAAM,gBAAgB,cAAyC,IAAI;AAOnE,SAAS,mBAAuC;AACrD,QAAM,MAAM,WAAW,aAAa;AACpC,SAAO,oBAAO,CAAA;AAChB;ACXO,SAAS,cAAc;AAAA,EAC5B,SAAS;AAAA,EACT,cAAc;AAChB,GAAsC;AACpC,SAAO,CAAC,UAAW;AAAA,IACjB,WAAW;AAAA,IACX,gBAAgB;AAAA,IAChB,iBAAiB;AAAA,KACb,eAAe;AAAA,IACjB,iBAAiB;AAAA,IACjB,WAAW;AAAA,IACX,cAAc,aAAa,MAAM,QAAQ,OAAO;AAAA,EAAA,IAPjC;AAAA,IASjB,sBAAsB;AAAA,MACpB,WAAW;AAAA,MACX,KAAK;AAAA,IAAA;AAAA,EACP;AAEJ;AC6CO,SAAS,OAAO;AAAA,EACrB;AAAA,EACA,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAgB;AACd,QAAM,QAAQ,SAAA;AACd,QAAM,WAAW,cAAc,UAAU,QAAQ,KAAK;AAEtD,QAAM,SAAyB;AAAA,IAC7B,cAAc,EAAE,QAAQ,aAAa,UAAU,eAAe;AAAA,IAC9D,GAAI,WAAW,CAAC,QAAQ,IAAI,CAAA;AAAA,IAC5B,GAAI,MAAM,QAAQ,EAAE,IAAI,KAAK,KAAK,CAAC,EAAE,IAAI,CAAA;AAAA,EAAC;AAG5C,QAAM,eAAe;AAAA,IACnB,OAAO,EAAE,cAAc;IACvB,CAAC,cAAc,QAAQ;AAAA,EAAA;AAGzB,SACE,oBAAC,cAAc,UAAd,EAAuB,OAAO,cAC7B,UAAA;AAAA,IAACA;AAAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA,IAAI;AAAA,OACA,cALL;AAAA,MAOC,UAAA,oBAAC,SAAA,EAAQ,IAAI,WAAY,SAAA,CAAS;AAAA,IAAA;AAAA,EAAA,GAEtC;AAEJ;ACxEO,SAAS,iBAAiB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA,OAAO;AAAA,EACP,kBAAkB;AAAA,EAClB;AAAA,EACA;AACF,GAA0B;;AACxB,QAAM,MAAM,iBAAA;AAEZ,QAAM,UAAU,4BAAW,IAAI;AAC/B,QAAM,QAAO,mCAAY,IAAI,aAAhB,YAA4B;AAEzC,MAAI,CAAC,WAAW,iBAAiB;AAC/B,WAAO;AAAA,EACT;AAEA,QAAM,OAAO,OACR,8BAAY,oBAAC,gBAAa,IAC1B,sDAAe,UAAA,CAAA,CAAS;AAE7B,6BACG,SAAA,EAAQ,OAAO,SAAS,OAAK,MAC5B,8BAAC,QAAA,EACC,UAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,MAAK;AAAA,MACL,OAAM;AAAA,MACN,cAAY,gCAAa;AAAA,MACzB,SAAS;AAAA,MACT,UAAU,CAAC;AAAA,MACX;AAAA,MACA;AAAA,MAEC,UAAA;AAAA,IAAA;AAAA,EAAA,GAEL,EAAA,CACF;AAEJ;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SxProps, Theme } from '@mui/material/styles';
|
|
2
|
+
export interface BuildAppBarSxArgs {
|
|
3
|
+
/** Altura en px. Default: 64. */
|
|
4
|
+
height?: number;
|
|
5
|
+
/** Color del AppBar (se pasa al MuiAppBar). */
|
|
6
|
+
transparent?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* sx del root del MuiAppBar. Define altura fija y layout flex del Toolbar
|
|
10
|
+
* interno. El color/elevación se dejan a las props nativas de MuiAppBar.
|
|
11
|
+
*/
|
|
12
|
+
export declare function buildAppBarSx({ height, transparent, }: BuildAppBarSxArgs): SxProps<Theme>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context interno del AppBar. Permite que sub-componentes (MenuToggle, etc.)
|
|
3
|
+
* consuman callbacks registrados en el AppBar padre sin tener que pasarlos
|
|
4
|
+
* por props explícitas.
|
|
5
|
+
*/
|
|
6
|
+
export interface AppBarContextValue {
|
|
7
|
+
/** Handler del botón hamburguesa. Si es undefined, el toggle se oculta. */
|
|
8
|
+
onMenuToggle?: () => void;
|
|
9
|
+
/** Estado actual del drawer asociado (usado por el icono del toggle). */
|
|
10
|
+
menuOpen?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const AppBarContext: import('react').Context<AppBarContextValue | null>;
|
|
13
|
+
/**
|
|
14
|
+
* Hook para leer el contexto del AppBar. Si se llama fuera de un `<AppBar>`,
|
|
15
|
+
* devuelve un objeto vacío — los sub-componentes caen en modo "standalone"
|
|
16
|
+
* con sus defaults en lugar de romper.
|
|
17
|
+
*/
|
|
18
|
+
export declare function useAppBarContext(): AppBarContextValue;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { SxProps, Theme } from '@mui/material/styles';
|
|
3
|
+
export interface AppBarMenuToggleProps {
|
|
4
|
+
/**
|
|
5
|
+
* Callback explícito. Si se omite, se consume del `AppBarContext`. Útil para
|
|
6
|
+
* usar el toggle fuera de un `<AppBar>` (p.ej. en un header custom).
|
|
7
|
+
*/
|
|
8
|
+
onClick?: () => void;
|
|
9
|
+
/** Estado del drawer asociado. Si se omite, se lee del `AppBarContext`. */
|
|
10
|
+
menuOpen?: boolean;
|
|
11
|
+
/** Icono custom cuando el drawer está cerrado. Default: `<MenuIcon />`. */
|
|
12
|
+
closedIcon?: ReactNode;
|
|
13
|
+
/** Icono custom cuando el drawer está abierto. Default: `<MenuOpenIcon />`. */
|
|
14
|
+
openIcon?: ReactNode;
|
|
15
|
+
/** Texto de tooltip. Default: "Menú". */
|
|
16
|
+
tooltip?: string;
|
|
17
|
+
/** aria-label del botón. Default: el mismo tooltip. */
|
|
18
|
+
ariaLabel?: string;
|
|
19
|
+
/** Tamaño del IconButton. Default: `'medium'`. */
|
|
20
|
+
size?: 'small' | 'medium' | 'large';
|
|
21
|
+
/** Oculta el botón cuando no hay handler disponible. Default: true. */
|
|
22
|
+
hideIfNoHandler?: boolean;
|
|
23
|
+
sx?: SxProps<Theme>;
|
|
24
|
+
className?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Botón hamburguesa del AppBar. Por default consume `onMenuToggle` y
|
|
28
|
+
* `menuOpen` del `AppBarContext` (pattern composicional), pero permite
|
|
29
|
+
* overrides explícitos si se usa fuera de un `<AppBar>`.
|
|
30
|
+
*
|
|
31
|
+
* ```tsx
|
|
32
|
+
* <AppBar onMenuToggle={toggleDrawer} menuOpen={open}>
|
|
33
|
+
* <AppBarMenuToggle />
|
|
34
|
+
* ...
|
|
35
|
+
* </AppBar>
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare function AppBarMenuToggle({ onClick, menuOpen, closedIcon, openIcon, tooltip, ariaLabel, size, hideIfNoHandler, sx, className, }: AppBarMenuToggleProps): import("react/jsx-runtime").JSX.Element | null;
|
|
39
|
+
export default AppBarMenuToggle;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { AppBar, default } from './AppBar';
|
|
2
|
+
export type { AppBarProps, AppBarPosition, AppBarColor, } from './AppBar';
|
|
3
|
+
export { AppBarMenuToggle } from './AppBarMenuToggle';
|
|
4
|
+
export type { AppBarMenuToggleProps } from './AppBarMenuToggle';
|
|
5
|
+
export { AppBarContext, useAppBarContext } from './AppBarContext';
|
|
6
|
+
export type { AppBarContextValue } from './AppBarContext';
|
|
@@ -0,0 +1,313 @@
|
|
|
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
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
34
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
35
|
+
const React = require("react");
|
|
36
|
+
const material = require("@mui/material");
|
|
37
|
+
const styles = require("@mui/material/styles");
|
|
38
|
+
const formField_sx = require("../../formField.sx-BAX7KwMR.cjs");
|
|
39
|
+
const resolvePreset = require("../../resolvePreset-CT3kU-K2.cjs");
|
|
40
|
+
const ClearIcon = require("@mui/icons-material/Clear");
|
|
41
|
+
const buildAutocompleteSx = (borderRadius, labelPosition) => formField_sx.buildFormFieldSx({
|
|
42
|
+
borderRadius,
|
|
43
|
+
labelPosition,
|
|
44
|
+
extraOutsideSx: {
|
|
45
|
+
// El input interno del Autocomplete.
|
|
46
|
+
"& .MuiAutocomplete-input": {
|
|
47
|
+
paddingTop: "4px",
|
|
48
|
+
paddingBottom: "4px"
|
|
49
|
+
},
|
|
50
|
+
// Contenedor del input (donde viven los chips en modo multiple).
|
|
51
|
+
"& .MuiAutocomplete-inputRoot": {
|
|
52
|
+
paddingTop: "4px",
|
|
53
|
+
paddingBottom: "4px"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
const resolveSingleValue = (options, value, getKey) => {
|
|
58
|
+
var _a;
|
|
59
|
+
if (value === null || value === void 0) return null;
|
|
60
|
+
const key = getKey(value);
|
|
61
|
+
return (_a = options.find((o) => getKey(o.value) === key)) != null ? _a : null;
|
|
62
|
+
};
|
|
63
|
+
const resolveMultipleValue = (options, value, getKey) => {
|
|
64
|
+
if (!Array.isArray(value)) return [];
|
|
65
|
+
const keys = new Set(value.map(getKey));
|
|
66
|
+
return options.filter((o) => keys.has(getKey(o.value)));
|
|
67
|
+
};
|
|
68
|
+
const areOptionsShallowEqual = (a, b, getKey) => {
|
|
69
|
+
const keysA = Object.keys(a);
|
|
70
|
+
const keysB = Object.keys(b);
|
|
71
|
+
if (keysA.length !== keysB.length) return false;
|
|
72
|
+
return keysA.every((k) => {
|
|
73
|
+
if (k === "value") return getKey(a.value) === getKey(b.value);
|
|
74
|
+
return a[k] === b[k];
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
const areResolvedValuesEqual = (prev, next, multiple, getKey) => {
|
|
78
|
+
if (multiple) {
|
|
79
|
+
if (!Array.isArray(prev) || !Array.isArray(next)) return false;
|
|
80
|
+
if (prev.length !== next.length) return false;
|
|
81
|
+
return prev.every((o, i) => {
|
|
82
|
+
const n2 = next[i];
|
|
83
|
+
return !!n2 && areOptionsShallowEqual(o, n2, getKey);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
const p = prev;
|
|
87
|
+
const n = next;
|
|
88
|
+
if (p === n) return true;
|
|
89
|
+
if (!p || !n) return false;
|
|
90
|
+
return areOptionsShallowEqual(p, n, getKey);
|
|
91
|
+
};
|
|
92
|
+
const isResolvedValueEmpty = (resolvedValue, multiple) => {
|
|
93
|
+
if (multiple) {
|
|
94
|
+
return !Array.isArray(resolvedValue) || resolvedValue.length === 0;
|
|
95
|
+
}
|
|
96
|
+
return !resolvedValue;
|
|
97
|
+
};
|
|
98
|
+
const AutocompleteOption = ({
|
|
99
|
+
liProps,
|
|
100
|
+
option,
|
|
101
|
+
customRender
|
|
102
|
+
}) => {
|
|
103
|
+
return /* @__PURE__ */ jsxRuntime.jsx("li", __spreadProps(__spreadValues({}, liProps), { children: customRender ? customRender(option) : option.label }));
|
|
104
|
+
};
|
|
105
|
+
const AutocompleteChips = ({
|
|
106
|
+
value,
|
|
107
|
+
getTagProps,
|
|
108
|
+
size,
|
|
109
|
+
maxChipsToShow,
|
|
110
|
+
renderChipLabel,
|
|
111
|
+
getKey
|
|
112
|
+
}) => {
|
|
113
|
+
const displayed = value.slice(0, maxChipsToShow);
|
|
114
|
+
const hidden = value.length - maxChipsToShow;
|
|
115
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
116
|
+
displayed.map((option, index) => {
|
|
117
|
+
const _a = getTagProps({ index }), { key: _ignored } = _a, tagProps = __objRest(_a, ["key"]);
|
|
118
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
119
|
+
material.Chip,
|
|
120
|
+
__spreadProps(__spreadValues({}, tagProps), {
|
|
121
|
+
size,
|
|
122
|
+
label: renderChipLabel ? renderChipLabel(option) : option.label,
|
|
123
|
+
avatar: option.img ? /* @__PURE__ */ jsxRuntime.jsx(material.Avatar, { src: option.img }) : void 0,
|
|
124
|
+
deleteIcon: /* @__PURE__ */ jsxRuntime.jsx(ClearIcon, {})
|
|
125
|
+
}),
|
|
126
|
+
getKey(option.value)
|
|
127
|
+
);
|
|
128
|
+
}),
|
|
129
|
+
hidden > 0 && /* @__PURE__ */ jsxRuntime.jsx(material.Chip, { size, label: `+${hidden} más` })
|
|
130
|
+
] });
|
|
131
|
+
};
|
|
132
|
+
const AutocompleteLoader = ({
|
|
133
|
+
text = "Cargando..."
|
|
134
|
+
}) => /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
135
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 16 }),
|
|
136
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "body2", children: text })
|
|
137
|
+
] });
|
|
138
|
+
function Autocomplete(props) {
|
|
139
|
+
const {
|
|
140
|
+
label,
|
|
141
|
+
options,
|
|
142
|
+
placeholder,
|
|
143
|
+
multiple = false,
|
|
144
|
+
disabled = false,
|
|
145
|
+
readOnly = false,
|
|
146
|
+
loading = false,
|
|
147
|
+
error: errorProp = false,
|
|
148
|
+
helperText,
|
|
149
|
+
maxChipsToShow = 3,
|
|
150
|
+
renderOptionItem,
|
|
151
|
+
renderChipLabel,
|
|
152
|
+
renderSingleValue,
|
|
153
|
+
borderRadius = 10,
|
|
154
|
+
labelPosition = "outside",
|
|
155
|
+
size = "small",
|
|
156
|
+
noOptionsText = "No hay opciones",
|
|
157
|
+
loadingText,
|
|
158
|
+
sx,
|
|
159
|
+
preset,
|
|
160
|
+
textFieldProps,
|
|
161
|
+
onInputChange,
|
|
162
|
+
inputValue,
|
|
163
|
+
filterOptions,
|
|
164
|
+
freeSolo,
|
|
165
|
+
open,
|
|
166
|
+
onOpen,
|
|
167
|
+
onClose,
|
|
168
|
+
getOptionKey
|
|
169
|
+
} = props;
|
|
170
|
+
const getKey = getOptionKey != null ? getOptionKey : ((v) => v);
|
|
171
|
+
const [isFocused, setIsFocused] = React.useState(false);
|
|
172
|
+
const seenOptionsRef = React.useRef(/* @__PURE__ */ new Map());
|
|
173
|
+
for (const opt of options) {
|
|
174
|
+
seenOptionsRef.current.set(getKey(opt.value), opt);
|
|
175
|
+
}
|
|
176
|
+
const resolvePool = React.useMemo(() => {
|
|
177
|
+
const merged = new Map(seenOptionsRef.current);
|
|
178
|
+
for (const opt of options) merged.set(getKey(opt.value), opt);
|
|
179
|
+
return Array.from(merged.values());
|
|
180
|
+
}, [options]);
|
|
181
|
+
const prevResolvedRef = React.useRef(multiple ? [] : null);
|
|
182
|
+
const stabilizeResolved = (newVal) => {
|
|
183
|
+
if (areResolvedValuesEqual(prevResolvedRef.current, newVal, multiple, getKey)) {
|
|
184
|
+
return prevResolvedRef.current;
|
|
185
|
+
}
|
|
186
|
+
prevResolvedRef.current = newVal;
|
|
187
|
+
return newVal;
|
|
188
|
+
};
|
|
189
|
+
const theme = styles.useTheme();
|
|
190
|
+
const presetSx = resolvePreset.resolvePreset("Autocomplete", preset, theme);
|
|
191
|
+
const mergedSx = [
|
|
192
|
+
buildAutocompleteSx(borderRadius, labelPosition),
|
|
193
|
+
...presetSx ? [presetSx] : [],
|
|
194
|
+
...Array.isArray(sx) ? sx : sx ? [sx] : []
|
|
195
|
+
];
|
|
196
|
+
const renderAutocomplete = (resolvedValue2, handleChange) => {
|
|
197
|
+
const isEmpty = isResolvedValueEmpty(resolvedValue2, multiple);
|
|
198
|
+
const showPlaceholder = isEmpty && isFocused && !!placeholder;
|
|
199
|
+
const singleAdornment = !multiple && resolvedValue2 && renderSingleValue ? renderSingleValue(resolvedValue2) : null;
|
|
200
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
201
|
+
material.Autocomplete,
|
|
202
|
+
{
|
|
203
|
+
multiple,
|
|
204
|
+
options,
|
|
205
|
+
value: resolvedValue2,
|
|
206
|
+
disabled,
|
|
207
|
+
readOnly,
|
|
208
|
+
loading,
|
|
209
|
+
sx: mergedSx,
|
|
210
|
+
freeSolo,
|
|
211
|
+
open,
|
|
212
|
+
onOpen,
|
|
213
|
+
onClose,
|
|
214
|
+
inputValue,
|
|
215
|
+
onInputChange,
|
|
216
|
+
filterOptions,
|
|
217
|
+
getOptionLabel: (opt) => {
|
|
218
|
+
var _a;
|
|
219
|
+
return typeof opt === "string" ? opt : (_a = opt == null ? void 0 : opt.label) != null ? _a : "";
|
|
220
|
+
},
|
|
221
|
+
isOptionEqualToValue: (a, b) => {
|
|
222
|
+
if (typeof a === "string" || typeof b === "string") return a === b;
|
|
223
|
+
if (!a || !b) return a === b;
|
|
224
|
+
return getKey(a.value) === getKey(b.value);
|
|
225
|
+
},
|
|
226
|
+
getOptionDisabled: (opt) => typeof opt === "string" ? false : !!(opt == null ? void 0 : opt.disabled),
|
|
227
|
+
onChange: handleChange,
|
|
228
|
+
onFocus: () => setIsFocused(true),
|
|
229
|
+
onBlur: () => setIsFocused(false),
|
|
230
|
+
renderOption: (liProps, option) => {
|
|
231
|
+
const _a = liProps, { key: _muiKey } = _a, liRest = __objRest(_a, ["key"]);
|
|
232
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
233
|
+
AutocompleteOption,
|
|
234
|
+
{
|
|
235
|
+
liProps: liRest,
|
|
236
|
+
option,
|
|
237
|
+
customRender: renderOptionItem
|
|
238
|
+
},
|
|
239
|
+
getKey(option.value)
|
|
240
|
+
);
|
|
241
|
+
},
|
|
242
|
+
renderValue: multiple ? (value, getItemProps) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
243
|
+
AutocompleteChips,
|
|
244
|
+
{
|
|
245
|
+
value,
|
|
246
|
+
getTagProps: getItemProps,
|
|
247
|
+
size,
|
|
248
|
+
maxChipsToShow,
|
|
249
|
+
renderChipLabel,
|
|
250
|
+
getKey
|
|
251
|
+
}
|
|
252
|
+
) : void 0,
|
|
253
|
+
noOptionsText,
|
|
254
|
+
loadingText: loadingText != null ? loadingText : /* @__PURE__ */ jsxRuntime.jsx(AutocompleteLoader, {}),
|
|
255
|
+
renderInput: (params) => {
|
|
256
|
+
var _a, _b, _c, _d;
|
|
257
|
+
const paramsInputLabel = params.InputLabelProps;
|
|
258
|
+
const consumerInputLabel = (_b = (_a = textFieldProps == null ? void 0 : textFieldProps.slotProps) == null ? void 0 : _a.inputLabel) != null ? _b : textFieldProps == null ? void 0 : textFieldProps.InputLabelProps;
|
|
259
|
+
const muiInputProps = params.InputProps;
|
|
260
|
+
const consumerInputProps = (_d = (_c = textFieldProps == null ? void 0 : textFieldProps.slotProps) == null ? void 0 : _c.input) != null ? _d : textFieldProps == null ? void 0 : textFieldProps.InputProps;
|
|
261
|
+
const inputSlot = singleAdornment ? __spreadProps(__spreadValues(__spreadValues({}, muiInputProps), consumerInputProps), {
|
|
262
|
+
startAdornment: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
263
|
+
singleAdornment,
|
|
264
|
+
consumerInputProps == null ? void 0 : consumerInputProps.startAdornment,
|
|
265
|
+
muiInputProps == null ? void 0 : muiInputProps.startAdornment
|
|
266
|
+
] })
|
|
267
|
+
}) : void 0;
|
|
268
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
269
|
+
material.TextField,
|
|
270
|
+
__spreadProps(__spreadValues(__spreadProps(__spreadValues({}, params), {
|
|
271
|
+
label,
|
|
272
|
+
size,
|
|
273
|
+
variant: "outlined",
|
|
274
|
+
placeholder: showPlaceholder ? placeholder : void 0,
|
|
275
|
+
error: !!errorProp,
|
|
276
|
+
helperText
|
|
277
|
+
}), textFieldProps), {
|
|
278
|
+
slotProps: __spreadProps(__spreadValues(__spreadValues({}, textFieldProps == null ? void 0 : textFieldProps.slotProps), inputSlot ? { input: inputSlot } : {}), {
|
|
279
|
+
inputLabel: __spreadProps(__spreadValues(__spreadValues({}, paramsInputLabel), consumerInputLabel), {
|
|
280
|
+
shrink: labelPosition === "outside" ? !isEmpty || isFocused : paramsInputLabel == null ? void 0 : paramsInputLabel.shrink
|
|
281
|
+
})
|
|
282
|
+
})
|
|
283
|
+
})
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
);
|
|
288
|
+
};
|
|
289
|
+
const extractValue = (opt) => {
|
|
290
|
+
var _a;
|
|
291
|
+
if (opt === null || opt === void 0) return null;
|
|
292
|
+
if (typeof opt === "string") return opt;
|
|
293
|
+
return (_a = opt == null ? void 0 : opt.value) != null ? _a : null;
|
|
294
|
+
};
|
|
295
|
+
const handleControlledChange = (_event, newValue) => {
|
|
296
|
+
const { onChange } = props;
|
|
297
|
+
if (multiple) {
|
|
298
|
+
const values = (newValue != null ? newValue : []).map((opt) => extractValue(opt)).filter((v) => v !== null);
|
|
299
|
+
onChange(values);
|
|
300
|
+
} else {
|
|
301
|
+
onChange(extractValue(newValue));
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
const resolvedValue = stabilizeResolved(
|
|
305
|
+
multiple ? resolveMultipleValue(resolvePool, props.value, getKey) : resolveSingleValue(resolvePool, props.value, getKey)
|
|
306
|
+
);
|
|
307
|
+
return renderAutocomplete(resolvedValue, handleControlledChange);
|
|
308
|
+
}
|
|
309
|
+
const AutocompleteSelect = Autocomplete;
|
|
310
|
+
exports.Autocomplete = Autocomplete;
|
|
311
|
+
exports.AutocompleteSelect = AutocompleteSelect;
|
|
312
|
+
exports.default = Autocomplete;
|
|
313
|
+
//# sourceMappingURL=Autocomplete.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Autocomplete.cjs","sources":["../../../src/components/Autocomplete/Autocomplete.sx.ts","../../../src/components/Autocomplete/Autocomplete.helpers.ts","../../../src/components/Autocomplete/_parts/AutocompleteOption.tsx","../../../src/components/Autocomplete/_parts/AutocompleteChips.tsx","../../../src/components/Autocomplete/_parts/AutocompleteLoader.tsx","../../../src/components/Autocomplete/Autocomplete.tsx"],"sourcesContent":["import type { SxProps, Theme } from '@mui/material/styles';\n\nimport { buildFormFieldSx } from '../_shared/formField.sx';\nimport type { LabelPosition } from './Autocomplete';\n\n/**\n * Builder del sx del Autocomplete. Reutiliza `buildFormFieldSx` y añade\n * los paddings propios del Autocomplete (chips + input interno).\n */\nexport const buildAutocompleteSx = (\n borderRadius: number | string,\n labelPosition: LabelPosition,\n): SxProps<Theme> =>\n buildFormFieldSx({\n borderRadius,\n labelPosition,\n extraOutsideSx: {\n // El input interno del Autocomplete.\n '& .MuiAutocomplete-input': {\n paddingTop: '4px',\n paddingBottom: '4px',\n },\n\n // Contenedor del input (donde viven los chips en modo multiple).\n '& .MuiAutocomplete-inputRoot': {\n paddingTop: '4px',\n paddingBottom: '4px',\n },\n },\n });\n","import type { SxProps, Theme } from '@mui/material/styles';\nimport type { AutocompleteValueKey, SelectOption } from './Autocomplete';\n\n/** Resuelve un value único a su SelectOption dentro del pool. */\nexport const resolveSingleValue = <TValue,>(\n options: SelectOption<TValue>[],\n value: TValue | null | undefined,\n getKey: (v: TValue) => AutocompleteValueKey,\n): SelectOption<TValue> | null => {\n if (value === null || value === undefined) return null;\n const key = getKey(value);\n return options.find((o) => getKey(o.value) === key) ?? null;\n};\n\n/** Resuelve un array de values a sus SelectOption dentro del pool. */\nexport const resolveMultipleValue = <TValue,>(\n options: SelectOption<TValue>[],\n value: TValue[] | null | undefined,\n getKey: (v: TValue) => AutocompleteValueKey,\n): SelectOption<TValue>[] => {\n if (!Array.isArray(value)) return [];\n const keys = new Set(value.map(getKey));\n return options.filter((o) => keys.has(getKey(o.value)));\n};\n\n/** Merge de sx base + extra del consumer, respetando el contrato de MUI. */\nexport const mergeSx = (\n base: SxProps<Theme>,\n extra?: SxProps<Theme>,\n): SxProps<Theme> => {\n if (!extra) return base;\n return [base, ...(Array.isArray(extra) ? extra : [extra])] as SxProps<Theme>;\n};\n\n/**\n * Compara dos SelectOption por todas sus props (shallow). Se usa para detectar\n * cambios de metadata (p.ej. `label`, `img`) cuando `value` no cambió, para\n * que la estabilización no tape datos frescos del server. Para `value` se\n * compara vía `getKey` (no por `===`), de modo que values objeto con misma\n * identidad lógica pero referencia distinta no rompan la estabilización.\n */\nconst areOptionsShallowEqual = <TValue,>(\n a: SelectOption<TValue>,\n b: SelectOption<TValue>,\n getKey: (v: TValue) => AutocompleteValueKey,\n): boolean => {\n const keysA = Object.keys(a);\n const keysB = Object.keys(b);\n if (keysA.length !== keysB.length) return false;\n return keysA.every((k) => {\n if (k === 'value') return getKey(a.value) === getKey(b.value);\n return a[k] === b[k];\n });\n};\n\n/**\n * Compara dos valores resueltos (single o multiple) estructuralmente para\n * decidir si se puede reusar la referencia previa. Se usa para estabilizar la\n * referencia que se pasa a MUI Autocomplete (MUI compara value por referencia\n * con `!==`, y una nueva referencia — aunque el contenido sea igual — dispara\n * `resetInputValue` y borra el texto mientras el usuario tipea).\n *\n * Comparamos todas las props del SelectOption, no solo `value`, para que un\n * refresh de metadata (label/img/etc.) invalide la referencia estabilizada\n * y la UI muestre los datos actualizados.\n */\nexport const areResolvedValuesEqual = <TValue,>(\n prev: SelectOption<TValue> | SelectOption<TValue>[] | null,\n next: SelectOption<TValue> | SelectOption<TValue>[] | null,\n multiple: boolean,\n getKey: (v: TValue) => AutocompleteValueKey,\n): boolean => {\n if (multiple) {\n if (!Array.isArray(prev) || !Array.isArray(next)) return false;\n if (prev.length !== next.length) return false;\n return prev.every((o, i) => {\n const n = next[i];\n return !!n && areOptionsShallowEqual(o, n, getKey);\n });\n }\n const p = prev as SelectOption<TValue> | null;\n const n = next as SelectOption<TValue> | null;\n if (p === n) return true;\n if (!p || !n) return false;\n return areOptionsShallowEqual(p, n, getKey);\n};\n\n/** Determina si un valor resuelto está vacío (para placeholder/shrink). */\nexport const isResolvedValueEmpty = (\n resolvedValue: unknown,\n multiple: boolean,\n): boolean => {\n if (multiple) {\n return !Array.isArray(resolvedValue) || resolvedValue.length === 0;\n }\n return !resolvedValue;\n};\n","import React from 'react';\nimport type {\n AutocompleteValueKey,\n RenderOptionItem,\n SelectOption,\n} from '../Autocomplete';\n\ninterface AutocompleteOptionProps<TValue = AutocompleteValueKey> {\n liProps: React.HTMLAttributes<HTMLLIElement>;\n option: SelectOption<TValue>;\n customRender?: RenderOptionItem<TValue>;\n}\n\n/**\n * Render por defecto de un `<li>` del dropdown del Autocomplete.\n * MUI lo invoca desde `renderOption={(props, option) => ...}` en el padre.\n *\n * La `key` la maneja el padre (`renderOption` en Autocomplete.tsx). Este\n * componente solo recibe los props restantes del `<li>` para spread.\n */\nexport const AutocompleteOption = <TValue,>({\n liProps,\n option,\n customRender,\n}: AutocompleteOptionProps<TValue>) => {\n return (\n <li {...liProps}>\n {customRender ? customRender(option) : option.label}\n </li>\n );\n};\n\nexport default AutocompleteOption;\n","import { Avatar, Chip } from '@mui/material';\nimport ClearIcon from '@mui/icons-material/Clear';\n\nimport type {\n AutocompleteSize,\n AutocompleteValueKey,\n RenderChipLabel,\n SelectOption,\n} from '../Autocomplete';\n\ninterface AutocompleteChipsProps<TValue = AutocompleteValueKey> {\n value: SelectOption<TValue>[];\n getTagProps: (args: { index: number }) => Record<string, any>;\n size: AutocompleteSize;\n maxChipsToShow: number;\n renderChipLabel?: RenderChipLabel<TValue>;\n /** Extrae la React key estable a partir del value (necesario para values objeto). */\n getKey: (value: TValue) => AutocompleteValueKey;\n}\n\n/**\n * Render de los chips del Autocomplete en modo multiple.\n * Trunca después de `maxChipsToShow` con un chip \"+N más\".\n * El `getTagProps({ index })` viene de MUI y contiene el handler de delete,\n * la key, etc. — se spreadea tal cual al Chip.\n */\nexport const AutocompleteChips = <TValue,>({\n value,\n getTagProps,\n size,\n maxChipsToShow,\n renderChipLabel,\n getKey,\n}: AutocompleteChipsProps<TValue>) => {\n const displayed = value.slice(0, maxChipsToShow);\n const hidden = value.length - maxChipsToShow;\n\n return (\n <>\n {displayed.map((option, index) => {\n const { key: _ignored, ...tagProps } = getTagProps({ index });\n return (\n <Chip\n key={getKey(option.value)}\n {...tagProps}\n size={size}\n label={renderChipLabel ? renderChipLabel(option) : option.label}\n avatar={option.img ? <Avatar src={option.img} /> : undefined}\n deleteIcon={<ClearIcon />}\n />\n );\n })}\n {hidden > 0 && <Chip size={size} label={`+${hidden} más`} />}\n </>\n );\n};\n\nexport default AutocompleteChips;\n","import React from 'react';\nimport { Box, CircularProgress, Typography } from '@mui/material';\n\n/**\n * Loader por defecto para el `loadingText` del Autocomplete.\n * El consumer puede sobrescribirlo pasando `loadingText` al componente padre.\n */\nexport const AutocompleteLoader: React.FC<{ text?: string }> = ({\n text = 'Cargando...',\n}) => (\n <Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>\n <CircularProgress size={16} />\n <Typography variant=\"body2\">{text}</Typography>\n </Box>\n);\n\nexport default AutocompleteLoader;\n","import React, {\n useMemo,\n useRef,\n useState,\n type ReactNode,\n type SyntheticEvent,\n} from 'react';\nimport {\n Autocomplete as MuiAutocomplete,\n TextField,\n type TextFieldProps,\n} from '@mui/material';\nimport { useTheme, type SxProps, type Theme } from '@mui/material/styles';\n\nimport { buildAutocompleteSx } from './Autocomplete.sx';\nimport {\n areResolvedValuesEqual,\n isResolvedValueEmpty,\n resolveMultipleValue,\n resolveSingleValue,\n} from './Autocomplete.helpers';\nimport { resolvePreset } from '../_shared/resolvePreset';\nimport { AutocompleteOption } from './_parts/AutocompleteOption';\nimport { AutocompleteChips } from './_parts/AutocompleteChips';\nimport { AutocompleteLoader } from './_parts/AutocompleteLoader';\n\n// ── Tipos de dominio ─────────────────────────────────────────────────────\n/** Key estable usada para comparar values, indexar caches y como React key. */\nexport type AutocompleteValueKey = string | number;\n\nexport interface SelectOption<TValue = AutocompleteValueKey> {\n value: TValue;\n label: string;\n img?: string;\n disabled?: boolean;\n group?: string;\n [key: string]: any; //campos extras que puede tener la opcion\n}\n\nexport type LabelPosition = 'outside' | 'floating';\nexport type AutocompleteSize = 'small' | 'medium';\n\n// ── Render slots ─────────────────────────────────────────────────────────\nexport type RenderOptionItem<TValue = AutocompleteValueKey> = (\n item: SelectOption<TValue>,\n) => ReactNode;\nexport type RenderChipLabel<TValue = AutocompleteValueKey> = (\n item: SelectOption<TValue>,\n) => ReactNode;\nexport type RenderSingleValue<TValue = AutocompleteValueKey> = (\n item: SelectOption<TValue>,\n) => ReactNode;\n\n// ── Props base ───────────────────────────────────────────────────────────\nexport type BaseAutocompleteProps<TValue = AutocompleteValueKey> = {\n label?: string;\n options: SelectOption<TValue>[];\n placeholder?: string;\n multiple?: boolean;\n disabled?: boolean;\n readOnly?: boolean;\n loading?: boolean;\n error?: boolean;\n helperText?: string;\n maxChipsToShow?: number;\n renderOptionItem?: RenderOptionItem<TValue>;\n renderChipLabel?: RenderChipLabel<TValue>;\n /**\n * Renderiza JSX custom como `startAdornment` del input en single mode.\n * Recibe la `SelectOption` seleccionada. Útil para mostrar avatars, iconos,\n * etc. junto al texto del label. En `multiple` no aplica (se usa `renderChipLabel`).\n */\n renderSingleValue?: RenderSingleValue<TValue>;\n /**\n * Extrae una key estable (string | number) desde el `value`. Obligatorio\n * cuando `TValue` es un objeto: se usa para comparar values (`isOptionEqualToValue`,\n * resolución desde el value del form), indexar el cache interno de opciones\n * vistas y como React key en chips/options del dropdown. Para primitivos se\n * puede omitir (default: identidad, o sea `===`).\n */\n getOptionKey?: (value: TValue) => AutocompleteValueKey;\n /** Border radius del input. Default: 10. */\n borderRadius?: number | string;\n /** \"outside\" (default) = label arriba del input; \"floating\" = comportamiento nativo MUI. */\n labelPosition?: LabelPosition;\n /** Tamaño del TextField. Default: 'small'. */\n size?: AutocompleteSize;\n /** Texto cuando no hay coincidencias. */\n noOptionsText?: ReactNode;\n /** Texto cuando está cargando. */\n loadingText?: ReactNode;\n sx?: SxProps<Theme>;\n /**\n * Nombre del preset de estilo registrado en `theme.styles.Autocomplete`.\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 /** Props para el TextField subyacente. */\n textFieldProps?: Partial<TextFieldProps>;\n\n // ── Búsqueda asíncrona / remota ──────────────────────────────────────\n /** Se dispara cada vez que el usuario escribe. Útil para llamadas a servicios\n * (debounce recomendado en el consumer). */\n onInputChange?: (\n event: SyntheticEvent,\n value: string,\n reason: 'input' | 'reset' | 'clear' | 'blur' | 'selectOption' | 'removeOption',\n ) => void;\n /** Valor controlado del texto de búsqueda. */\n inputValue?: string;\n /** Filtro custom. Para búsqueda remota pasar `(x) => x` y confiar sólo en el servicio. */\n filterOptions?: (\n options: SelectOption<TValue>[],\n state: any,\n ) => SelectOption<TValue>[];\n /** Permite valores arbitrarios (no solo de la lista). */\n freeSolo?: boolean;\n open?: boolean;\n onOpen?: (event: SyntheticEvent) => void;\n onClose?: (event: SyntheticEvent, reason: string) => void;\n};\n\n// ── API pública final ────────────────────────────────────────────────────\nexport interface AutocompleteProps<TValue = AutocompleteValueKey>\n extends BaseAutocompleteProps<TValue> {\n value: TValue | TValue[] | null;\n onChange: (val: TValue | TValue[] | null) => void;\n name?: string;\n}\n\nexport function Autocomplete<TValue = AutocompleteValueKey>(\n props: AutocompleteProps<TValue>,\n) {\n const {\n label,\n options,\n placeholder,\n multiple = false,\n disabled = false,\n readOnly = false,\n loading = false,\n error: errorProp = false,\n helperText,\n maxChipsToShow = 3,\n renderOptionItem,\n renderChipLabel,\n renderSingleValue,\n borderRadius = 10,\n labelPosition = 'outside',\n size = 'small',\n noOptionsText = 'No hay opciones',\n loadingText,\n sx,\n preset,\n textFieldProps,\n onInputChange,\n inputValue,\n filterOptions,\n freeSolo,\n open,\n onOpen,\n onClose,\n getOptionKey,\n } = props as BaseAutocompleteProps<TValue>;\n\n // Default identidad: para primitivos (string|number) funciona como `===`.\n // Para values objeto, el consumer DEBE pasar `getOptionKey` o la igualdad\n // caerá a referencia (Map/Set agruparían por identidad).\n const getKey = (getOptionKey ??\n ((v: TValue) => v as unknown as AutocompleteValueKey)) as (\n v: TValue,\n ) => AutocompleteValueKey;\n\n // Focus tracking para mostrar placeholder solo cuando el label sube.\n const [isFocused, setIsFocused] = useState(false);\n\n // Cache interno de opciones vistas (indexado por key estable). Crítico para\n // async multiple: cuando `options` cambian por un nuevo search, los items\n // ya seleccionados no desaparecen de los chips porque los recordamos acá.\n const seenOptionsRef = useRef<\n Map<AutocompleteValueKey, SelectOption<TValue>>\n >(new Map());\n for (const opt of options) {\n seenOptionsRef.current.set(getKey(opt.value), opt);\n }\n\n // Pool de opciones para resolver values (merge de options + vistas).\n const resolvePool = useMemo<SelectOption<TValue>[]>(() => {\n const merged = new Map(seenOptionsRef.current);\n for (const opt of options) merged.set(getKey(opt.value), opt);\n return Array.from(merged.values());\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [options]);\n\n // Estabiliza la referencia del resolvedValue que pasamos a MUI Autocomplete.\n // MUI compara value con `!==`: una referencia nueva con mismo contenido\n // dispara resetInputValue() y borra el texto que el usuario está escribiendo.\n const prevResolvedRef = useRef<\n SelectOption<TValue>[] | SelectOption<TValue> | null\n >(multiple ? [] : null);\n\n const stabilizeResolved = (\n newVal: SelectOption<TValue>[] | SelectOption<TValue> | null,\n ): SelectOption<TValue>[] | SelectOption<TValue> | null => {\n if (\n areResolvedValuesEqual(prevResolvedRef.current, newVal, multiple, getKey)\n ) {\n return prevResolvedRef.current;\n }\n prevResolvedRef.current = newVal;\n return newVal;\n };\n\n const theme = useTheme();\n const presetSx = resolvePreset('Autocomplete', preset, theme);\n\n const mergedSx = [\n buildAutocompleteSx(borderRadius, labelPosition),\n ...(presetSx ? [presetSx] : []),\n ...(Array.isArray(sx) ? sx : sx ? [sx] : []),\n ];\n\n const renderAutocomplete = (\n resolvedValue: any,\n handleChange: (event: any, newValue: any) => void,\n ) => {\n const isEmpty = isResolvedValueEmpty(resolvedValue, multiple);\n const showPlaceholder = isEmpty && isFocused && !!placeholder;\n const singleAdornment =\n !multiple && resolvedValue && renderSingleValue\n ? renderSingleValue(resolvedValue as SelectOption<TValue>)\n : null;\n\n return (\n <MuiAutocomplete\n multiple={multiple}\n options={options}\n value={resolvedValue}\n disabled={disabled}\n readOnly={readOnly}\n loading={loading}\n sx={mergedSx}\n freeSolo={freeSolo as any}\n open={open}\n onOpen={onOpen}\n onClose={onClose}\n inputValue={inputValue}\n onInputChange={onInputChange}\n filterOptions={filterOptions as any}\n getOptionLabel={(opt) =>\n typeof opt === 'string' ? opt : (opt?.label ?? '')\n }\n isOptionEqualToValue={(a, b) => {\n if (typeof a === 'string' || typeof b === 'string') return a === b;\n if (!a || !b) return a === b;\n return getKey(a.value) === getKey(b.value);\n }}\n getOptionDisabled={(opt) =>\n typeof opt === 'string' ? false : !!opt?.disabled\n }\n onChange={handleChange}\n onFocus={() => setIsFocused(true)}\n onBlur={() => setIsFocused(false)}\n renderOption={(liProps, option) => {\n // MUI inyecta la `key` dentro de `liProps`. React necesita la key\n // en el elemento más externo que devuelve `renderOption` (acá el\n // wrapper), no en el `<li>` interno. El resto de `liProps` viaja\n // al `<li>`. La key auto-generada por MUI cae a `getOptionLabel`,\n // que colisiona si hay opciones con label duplicado. Usamos\n // `option.value` (único por contrato de SelectOption) para\n // garantizar uniqueness aunque haya labels repetidos.\n const { key: _muiKey, ...liRest } = liProps as React.HTMLAttributes<HTMLLIElement> & {\n key?: React.Key;\n };\n return (\n <AutocompleteOption<TValue>\n key={getKey(option.value)}\n liProps={liRest}\n option={option}\n customRender={renderOptionItem}\n />\n );\n }}\n renderValue={\n multiple\n ? (value, getItemProps) => (\n <AutocompleteChips<TValue>\n value={value as SelectOption<TValue>[]}\n getTagProps={getItemProps}\n size={size}\n maxChipsToShow={maxChipsToShow}\n renderChipLabel={renderChipLabel}\n getKey={getKey}\n />\n )\n : undefined\n }\n noOptionsText={noOptionsText}\n loadingText={loadingText ?? <AutocompleteLoader />}\n renderInput={(params) => {\n const paramsInputLabel =\n (params as any).InputLabelProps as Record<string, any> | undefined;\n const consumerInputLabel =\n (textFieldProps?.slotProps as any)?.inputLabel ??\n (textFieldProps as any)?.InputLabelProps;\n // Para inyectar `singleAdornment` necesitamos pasar `slotProps.input`\n // a TextField, pero `slotProps.input` gana sobre `params.InputProps`\n // (que trae endAdornment con chevron + clear). Por eso, cuando hay\n // adornment custom, mergeamos params.InputProps + lo que el consumer\n // haya pasado por textFieldProps + nuestro startAdornment. Si no hay\n // adornment, no tocamos `slotProps.input` y se preserva el flujo legacy.\n const muiInputProps = (params as any).InputProps as\n | Record<string, any>\n | undefined;\n const consumerInputProps =\n (textFieldProps?.slotProps as any)?.input ??\n (textFieldProps as any)?.InputProps;\n const inputSlot = singleAdornment\n ? {\n ...muiInputProps,\n ...consumerInputProps,\n startAdornment: (\n <>\n {singleAdornment}\n {consumerInputProps?.startAdornment}\n {muiInputProps?.startAdornment}\n </>\n ),\n }\n : undefined;\n\n return (\n <TextField\n {...params}\n label={label}\n size={size}\n variant=\"outlined\"\n placeholder={showPlaceholder ? placeholder : undefined}\n error={!!errorProp}\n helperText={helperText}\n {...textFieldProps}\n slotProps={{\n ...textFieldProps?.slotProps,\n ...(inputSlot ? { input: inputSlot } : {}),\n inputLabel: {\n ...paramsInputLabel,\n ...consumerInputLabel,\n shrink:\n labelPosition === 'outside'\n ? !isEmpty || isFocused\n : paramsInputLabel?.shrink,\n },\n }}\n />\n );\n }}\n />\n );\n };\n\n //obtiene el primitivo (o objeto) value desde la opción seleccionada\n const extractValue = (opt: any): TValue | null => {\n if (opt === null || opt === undefined) return null;\n if (typeof opt === 'string') return opt as unknown as TValue;\n return (opt?.value ?? null) as TValue | null;\n };\n\n const handleControlledChange = (_event: any, newValue: any) => {\n const { onChange } = props;\n if (multiple) {\n const values = (newValue ?? [])\n .map((opt: SelectOption<TValue> | string) => extractValue(opt))\n .filter((v: TValue | null): v is TValue => v !== null);\n onChange(values);\n } else {\n onChange(extractValue(newValue));\n }\n };\n\n const resolvedValue = stabilizeResolved(\n multiple\n ? resolveMultipleValue(resolvePool, props.value as TValue[], getKey)\n : resolveSingleValue(resolvePool, props.value as TValue, getKey),\n );\n\n return renderAutocomplete(resolvedValue, handleControlledChange);\n}\n\n/** Alias de `Autocomplete`. Ambos nombres son equivalentes. */\nexport const AutocompleteSelect = Autocomplete;\n\nexport default Autocomplete;\n"],"names":["buildFormFieldSx","n","jsx","jsxs","Fragment","Chip","Avatar","Box","CircularProgress","Typography","useState","useRef","useMemo","useTheme","resolvePreset","resolvedValue","MuiAutocomplete","TextField"],"mappings":"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"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { ReactNode, SyntheticEvent } from 'react';
|
|
2
|
+
import { TextFieldProps } from '@mui/material';
|
|
3
|
+
import { SxProps, Theme } from '@mui/material/styles';
|
|
4
|
+
/** Key estable usada para comparar values, indexar caches y como React key. */
|
|
5
|
+
export type AutocompleteValueKey = string | number;
|
|
6
|
+
export interface SelectOption<TValue = AutocompleteValueKey> {
|
|
7
|
+
value: TValue;
|
|
8
|
+
label: string;
|
|
9
|
+
img?: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
group?: string;
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}
|
|
14
|
+
export type LabelPosition = 'outside' | 'floating';
|
|
15
|
+
export type AutocompleteSize = 'small' | 'medium';
|
|
16
|
+
export type RenderOptionItem<TValue = AutocompleteValueKey> = (item: SelectOption<TValue>) => ReactNode;
|
|
17
|
+
export type RenderChipLabel<TValue = AutocompleteValueKey> = (item: SelectOption<TValue>) => ReactNode;
|
|
18
|
+
export type RenderSingleValue<TValue = AutocompleteValueKey> = (item: SelectOption<TValue>) => ReactNode;
|
|
19
|
+
export type BaseAutocompleteProps<TValue = AutocompleteValueKey> = {
|
|
20
|
+
label?: string;
|
|
21
|
+
options: SelectOption<TValue>[];
|
|
22
|
+
placeholder?: string;
|
|
23
|
+
multiple?: boolean;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
readOnly?: boolean;
|
|
26
|
+
loading?: boolean;
|
|
27
|
+
error?: boolean;
|
|
28
|
+
helperText?: string;
|
|
29
|
+
maxChipsToShow?: number;
|
|
30
|
+
renderOptionItem?: RenderOptionItem<TValue>;
|
|
31
|
+
renderChipLabel?: RenderChipLabel<TValue>;
|
|
32
|
+
/**
|
|
33
|
+
* Renderiza JSX custom como `startAdornment` del input en single mode.
|
|
34
|
+
* Recibe la `SelectOption` seleccionada. Útil para mostrar avatars, iconos,
|
|
35
|
+
* etc. junto al texto del label. En `multiple` no aplica (se usa `renderChipLabel`).
|
|
36
|
+
*/
|
|
37
|
+
renderSingleValue?: RenderSingleValue<TValue>;
|
|
38
|
+
/**
|
|
39
|
+
* Extrae una key estable (string | number) desde el `value`. Obligatorio
|
|
40
|
+
* cuando `TValue` es un objeto: se usa para comparar values (`isOptionEqualToValue`,
|
|
41
|
+
* resolución desde el value del form), indexar el cache interno de opciones
|
|
42
|
+
* vistas y como React key en chips/options del dropdown. Para primitivos se
|
|
43
|
+
* puede omitir (default: identidad, o sea `===`).
|
|
44
|
+
*/
|
|
45
|
+
getOptionKey?: (value: TValue) => AutocompleteValueKey;
|
|
46
|
+
/** Border radius del input. Default: 10. */
|
|
47
|
+
borderRadius?: number | string;
|
|
48
|
+
/** "outside" (default) = label arriba del input; "floating" = comportamiento nativo MUI. */
|
|
49
|
+
labelPosition?: LabelPosition;
|
|
50
|
+
/** Tamaño del TextField. Default: 'small'. */
|
|
51
|
+
size?: AutocompleteSize;
|
|
52
|
+
/** Texto cuando no hay coincidencias. */
|
|
53
|
+
noOptionsText?: ReactNode;
|
|
54
|
+
/** Texto cuando está cargando. */
|
|
55
|
+
loadingText?: ReactNode;
|
|
56
|
+
sx?: SxProps<Theme>;
|
|
57
|
+
/**
|
|
58
|
+
* Nombre del preset de estilo registrado en `theme.styles.Autocomplete`.
|
|
59
|
+
* - `"default"` (o ausente) = estilo built-in del paquete.
|
|
60
|
+
* - Cualquier otro string = mergea el preset encima del estilo built-in.
|
|
61
|
+
*/
|
|
62
|
+
preset?: string;
|
|
63
|
+
/** Props para el TextField subyacente. */
|
|
64
|
+
textFieldProps?: Partial<TextFieldProps>;
|
|
65
|
+
/** Se dispara cada vez que el usuario escribe. Útil para llamadas a servicios
|
|
66
|
+
* (debounce recomendado en el consumer). */
|
|
67
|
+
onInputChange?: (event: SyntheticEvent, value: string, reason: 'input' | 'reset' | 'clear' | 'blur' | 'selectOption' | 'removeOption') => void;
|
|
68
|
+
/** Valor controlado del texto de búsqueda. */
|
|
69
|
+
inputValue?: string;
|
|
70
|
+
/** Filtro custom. Para búsqueda remota pasar `(x) => x` y confiar sólo en el servicio. */
|
|
71
|
+
filterOptions?: (options: SelectOption<TValue>[], state: any) => SelectOption<TValue>[];
|
|
72
|
+
/** Permite valores arbitrarios (no solo de la lista). */
|
|
73
|
+
freeSolo?: boolean;
|
|
74
|
+
open?: boolean;
|
|
75
|
+
onOpen?: (event: SyntheticEvent) => void;
|
|
76
|
+
onClose?: (event: SyntheticEvent, reason: string) => void;
|
|
77
|
+
};
|
|
78
|
+
export interface AutocompleteProps<TValue = AutocompleteValueKey> extends BaseAutocompleteProps<TValue> {
|
|
79
|
+
value: TValue | TValue[] | null;
|
|
80
|
+
onChange: (val: TValue | TValue[] | null) => void;
|
|
81
|
+
name?: string;
|
|
82
|
+
}
|
|
83
|
+
export declare function Autocomplete<TValue = AutocompleteValueKey>(props: AutocompleteProps<TValue>): import("react/jsx-runtime").JSX.Element;
|
|
84
|
+
/** Alias de `Autocomplete`. Ambos nombres son equivalentes. */
|
|
85
|
+
export declare const AutocompleteSelect: typeof Autocomplete;
|
|
86
|
+
export default Autocomplete;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const SimpleAutocompleteDefinition = "\nimport React, { useState } from 'react';\nimport Autocomplete from './Autocomplete';\nimport { Box, Typography } from '@mui/material';\n\nconst options = [\n { value: '10', label: '10' },\n { value: '25', label: '25' },\n];\n\nexport const SimpleExample = () => {\n const [value, setValue] = useState(options[1]);\n\n return (\n <Box sx={{ width: 250 }}>\n <Autocomplete\n label=\"Registros por p\u00E1gina\"\n options={options}\n value={value}\n onChange={(val) => {\n setValue(val as string);\n }}\n />\n <Typography sx={{ mt: 2 }}>\n Valor: {value}\n </Typography>\n </Box>\n );\n};\n";
|
|
2
|
+
export declare const WithPlaceholderAutocompleteDefinition = "\nimport React, { useState } from 'react';\nimport Autocomplete from './Autocomplete';\nimport { Box, Typography } from '@mui/material';\n\nexport const WithPlaceholderExample = () => {\n const [value, setValue] = useState(null);\n\n return (\n <Box sx={{ width: 300 }}>\n <Autocomplete\n label=\"Seleccione una opci\u00F3n\"\n options={[]}\n value={value}\n onChange={(val) => {\n setValue(val as string);\n }}\n placeholder=\"Ninguna opci\u00F3n seleccionada\"\n />\n <Typography sx={{ mt: 2 }}>\n {value || 'Ninguno'}\n </Typography>\n </Box>\n );\n};\n";
|
|
3
|
+
export declare const MultipleAutocompleteDefinition = "\nimport React, { useState } from 'react';\nimport Autocomplete from './Autocomplete';\nimport { Box } from '@mui/material';\n\nconst options = [\n { value: 'pending', label: 'Pendiente' },\n { value: 'approved', label: 'Aprobado' },\n];\n\nexport const MultipleExample = () => {\n const [value, setValue] = useState([]);\n\n return (\n <Box sx={{ width: 400 }}>\n <Autocomplete\n multiple\n options={options}\n value={value}\n onChange={(val) => {\n setValue(val as string[]);\n }}\n />\n </Box>\n );\n};\n";
|
|
4
|
+
export declare const MultipleWithLimitAutocompleteDefinition = "\nimport React, { useState } from 'react';\nimport Autocomplete from './Autocomplete';\n\nexport const MultipleWithLimitExample = () => {\n const [value, setValue] = useState([]);\n\n return (\n <Autocomplete\n multiple\n maxChipsToShow={2}\n options={[]}\n value={value}\n onChange={(val) => {\n setValue(val as string[]);\n }}\n />\n );\n};\n";
|
|
5
|
+
export declare const CustomRenderOptionAutocompleteDefinition = "\nimport React, { useState } from 'react';\nimport Autocomplete from './Autocomplete';\nimport { Avatar, Box } from '@mui/material';\n\nconst users = [\n { value: 'admin', label: 'Administrador', img: '...' },\n];\n\nexport const CustomRenderExample = () => {\n const [value, setValue] = useState([]);\n\n return (\n <Autocomplete\n multiple\n options={users}\n value={value}\n onChange={(val) => {\n setValue(val as string[]);\n }}\n renderOptionItem={(item) => (\n <Box sx={{ display: 'flex', gap: 1 }}>\n <Avatar src={item.img} />\n {item.label}\n </Box>\n )}\n />\n );\n};\n";
|
|
6
|
+
export declare const CustomChipRenderAutocompleteDefinition = "\nimport React, { useState } from 'react';\nimport Autocomplete from './Autocomplete';\nimport { Typography } from '@mui/material';\n\nexport const CustomChipExample = () => {\n const [value, setValue] = useState([]);\n\n return (\n <Autocomplete\n multiple\n options={[]}\n value={value}\n onChange={(val) => {\n setValue(val as string[]);\n }}\n renderChipLabel={(item) => (\n <Typography variant=\"caption\">\n {item.label.charAt(0)}\n </Typography>\n )}\n />\n );\n};\n";
|
|
7
|
+
export declare const LoadingAutocompleteDefinition = "\nimport React, { useState } from 'react';\nimport Autocomplete from './Autocomplete';\n\nexport const LoadingExample = () => {\n const [value, setValue] = useState(null);\n\n return (\n <Autocomplete\n loading\n options={[]}\n value={value}\n onChange={(val) => {\n\t\t\t\tsetValue(val as string);\n\t\t\t}}\n />\n );\n};\n";
|
|
8
|
+
export declare const EmptyOptionsAutocompleteDefinition = "\nimport React, { useState } from 'react';\nimport Autocomplete from './Autocomplete';\n\nexport const EmptyExample = () => {\n const [value, setValue] = useState(null);\n\n return (\n <Autocomplete\n options={[]}\n value={value}\n onChange={(val) => {\n\t\t\t\tsetValue(val as string);\n\t\t\t}}\n placeholder=\"No hay opciones\"\n />\n );\n};\n";
|
|
9
|
+
export declare const ManyOptionsAutocompleteDefinition = "\nimport React, { useState } from 'react';\nimport Autocomplete from './Autocomplete';\n\nconst options = Array.from({ length: 50 }, (_, i) => ({\n value: i,\n label: 'Opci\u00F3n ' + i,\n}));\n\nexport const ManyOptionsExample = () => {\n const [value, setValue] = useState(null);\n\n return (\n <Autocomplete\n options={options}\n value={value}\n onChange={(val) => {\n\t\t\t\tsetValue(val as string);\n\t\t\t}}\n />\n );\n};\n";
|
|
10
|
+
export declare const WithErrorAutocompleteDefinition = "\nimport React, { useState } from 'react';\nimport Autocomplete from './Autocomplete';\nimport { Box } from '@mui/material';\n\nconst options = [\n { value: '10', label: '10' },\n { value: '25', label: '25' },\n];\n\nexport const WithErrorExample = () => {\n const [value, setValue] = useState<string | null>(null);\n return (\n <Box sx={{ width: 300 }}>\n <Autocomplete\n label=\"Cantidad\"\n options={options}\n value={value}\n onChange={(val) => setValue(val as string | null)}\n error={!value}\n helperText={!value ? 'Debes seleccionar una cantidad' : ' '}\n />\n </Box>\n );\n};\n";
|
|
11
|
+
export declare const LabelPositionAutocompleteDefinition = "\nimport React, { useState } from 'react';\nimport Autocomplete from './Autocomplete';\nimport { Box, Stack } from '@mui/material';\n\nconst options = [\n { value: 'a', label: 'Opci\u00F3n A' },\n { value: 'b', label: 'Opci\u00F3n B' },\n];\n\nexport const LabelPositionExample = () => {\n const [a, setA] = useState<string | null>(null);\n const [b, setB] = useState<string | null>(null);\n return (\n <Stack spacing={3} sx={{ width: 320 }}>\n <Autocomplete\n label=\"Outside (default)\"\n labelPosition=\"outside\"\n options={options}\n value={a}\n onChange={(val) => setA(val as string | null)}\n />\n <Autocomplete\n label=\"Floating\"\n labelPosition=\"floating\"\n options={options}\n value={b}\n onChange={(val) => setB(val as string | null)}\n />\n </Stack>\n );\n};\n";
|
|
12
|
+
export declare const CustomBorderRadiusAutocompleteDefinition = "\nimport React, { useState } from 'react';\nimport Autocomplete from './Autocomplete';\nimport { Box, Stack } from '@mui/material';\n\nconst options = [\n { value: '10', label: '10' },\n { value: '25', label: '25' },\n];\n\nexport const CustomBorderRadiusExample = () => {\n const [a, setA] = useState<string | null>(null);\n const [b, setB] = useState<string | null>(null);\n const [c, setC] = useState<string | null>(null);\n return (\n <Stack spacing={2} sx={{ width: 300 }}>\n <Autocomplete label=\"0\" borderRadius={0} options={options} value={a} onChange={(v) => setA(v as string | null)} />\n <Autocomplete label=\"10 (default)\" borderRadius={10} options={options} value={b} onChange={(v) => setB(v as string | null)} />\n <Autocomplete label=\"24 (pill)\" borderRadius={24} options={options} value={c} onChange={(v) => setC(v as string | null)} />\n </Stack>\n );\n};\n";
|
|
13
|
+
export declare const EmptyWithPlaceholderAutocompleteDefinition = "\nimport React, { useState } from 'react';\nimport Autocomplete from './Autocomplete';\nimport { Box } from '@mui/material';\n\nconst options = [\n { value: 'mx', label: 'M\u00E9xico' },\n { value: 'co', label: 'Colombia' },\n { value: 'ar', label: 'Argentina' },\n];\n\nexport const EmptyWithPlaceholderExample = () => {\n const [value, setValue] = useState<string | null>(null);\n return (\n <Box sx={{ width: 300 }}>\n <Autocomplete\n label=\"Pa\u00EDs\"\n placeholder=\"Buscar pa\u00EDs...\"\n options={options}\n value={value}\n onChange={(val) => setValue(val as string | null)}\n />\n </Box>\n );\n};\n";
|
|
14
|
+
export declare const RHFAutocompleteDefinition = "\nimport React from 'react';\nimport { Controller, useForm } from 'react-hook-form';\nimport Autocomplete from './Autocomplete';\nimport { Box, Button, Stack } from '@mui/material';\n\nconst options = [\n { value: 'mx', label: 'M\u00E9xico' },\n { value: 'co', label: 'Colombia' },\n { value: 'ar', label: 'Argentina' },\n];\n\ntype FormValues = { country: string | null };\n\nexport const RHFExample = () => {\n const { control, handleSubmit } = useForm<FormValues>({\n defaultValues: { country: null },\n });\n\n return (\n <Box component=\"form\" onSubmit={handleSubmit((data) => console.log(data))}>\n <Stack spacing={2} sx={{ width: 320 }}>\n <Controller\n name=\"country\"\n control={control}\n rules={{ required: 'Campo requerido' }}\n render={({ field, fieldState }) => (\n <Autocomplete\n label=\"Pa\u00EDs\"\n placeholder=\"Seleccione...\"\n options={options}\n value={field.value}\n onChange={(v) => field.onChange(v as string | null)}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n />\n )}\n />\n <Button type=\"submit\" variant=\"contained\">Guardar</Button>\n </Stack>\n </Box>\n );\n};\n";
|
|
15
|
+
export declare const ObjectValueAutocompleteDefinition = "\nimport React, { useState } from 'react';\nimport Autocomplete, { SelectOption } from './Autocomplete';\nimport { Box, Typography } from '@mui/material';\n\ntype Country = { id: string; iso: string; name: string };\n\nconst options: SelectOption<Country>[] = [\n { value: { id: '1', iso: 'MX', name: 'M\u00E9xico' }, label: 'M\u00E9xico' },\n { value: { id: '2', iso: 'CO', name: 'Colombia' }, label: 'Colombia' },\n { value: { id: '3', iso: 'AR', name: 'Argentina' }, label: 'Argentina' },\n];\n\n// Obligatorio cuando TValue es objeto: extrae una key estable (string|number).\nconst getCountryKey = (c: Country) => c.id;\n\nexport const ObjectValueExample = () => {\n const [value, setValue] = useState<Country | null>(null);\n\n return (\n <Box sx={{ width: 320 }}>\n <Autocomplete<Country>\n label=\"Pa\u00EDs\"\n options={options}\n value={value}\n onChange={(v) => setValue(v as Country | null)}\n getOptionKey={getCountryKey}\n />\n <Typography>{value ? value.iso : 'Ninguno'}</Typography>\n </Box>\n );\n};\n";
|
|
16
|
+
export declare const AsyncServiceAutocompleteDefinition: string;
|