@mrshmllw/smores-react 4.0.1 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- package/dist/.gitkeep +0 -0
- package/dist/Accordion/Accordion.js +90 -32
- package/dist/ActionDropdown/ActionDropdown.js +65 -25
- package/dist/ActionDropdown/List.js +8 -6
- package/dist/Banner/BannerContainer.js +40 -31
- package/dist/Banner/BannerItem.js +112 -54
- package/dist/Banner/hooks.js +7 -5
- package/dist/Box/Box.js +7 -5
- package/dist/BrandCard/BrandCard.js +61 -24
- package/dist/Button/Button.js +110 -40
- package/dist/Card/Card.js +86 -34
- package/dist/CheckBox/CheckBox.js +41 -20
- package/dist/CheckBoxGroup/CheckBoxGroup.js +22 -6
- package/dist/Chip/Chip.d.ts +1 -1
- package/dist/Chip/Chip.js +60 -26
- package/dist/CurrencyInput/CurrencyInput.js +89 -50
- package/dist/Datepicker/Datepicker.js +130 -83
- package/dist/Datepicker/DatesList.js +42 -26
- package/dist/Divider/Divider.js +17 -11
- package/dist/Dropdown/Dropdown.js +101 -54
- package/dist/Emoji/Emoji.js +27 -6
- package/dist/Icon/Icon.js +5522 -851
- package/dist/IconStrict/IconStrict.js +67 -38
- package/dist/IconWrapper/IconWrapper.js +28 -12
- package/dist/LabelledText/LabelledText.js +16 -8
- package/dist/Link/Link.js +87 -47
- package/dist/Loader/Loader.js +38 -12
- package/dist/Logo/Logo.js +154 -44
- package/dist/Modal/Modal.js +73 -27
- package/dist/Modal/useBodyScrollLock.js +23 -19
- package/dist/NumberInput/NumberInput.js +125 -78
- package/dist/Pagination/Pagination.js +144 -103
- package/dist/RadioGroup/RadioElement.js +33 -18
- package/dist/RadioGroup/RadioGroup.js +64 -33
- package/dist/RadioGroup/RadioItem.js +79 -47
- package/dist/RadioGroup/constants.js +3 -2
- package/dist/Row/Row.js +68 -27
- package/dist/SearchInput/SearchInput.js +102 -45
- package/dist/SearchInput/SearchOptions.js +18 -14
- package/dist/Snackbar/SnackbarContainer.js +49 -31
- package/dist/Snackbar/SnackbarItem.js +37 -17
- package/dist/Snackbar/hooks.js +7 -5
- package/dist/SupportMessage/SupportMessage.js +79 -52
- package/dist/Table/Table.js +73 -50
- package/dist/Table/components/RowActions.js +82 -43
- package/dist/Table/components/TableHeader.js +40 -7
- package/dist/Table/components/TableRow.js +111 -69
- package/dist/Table/components/commonComponents.js +31 -46
- package/dist/Table/helpers.js +14 -10
- package/dist/Tag/Tag.js +28 -9
- package/dist/Text/Text.js +53 -33
- package/dist/Text/fontMapping.js +19 -17
- package/dist/TextInput/TextInput.js +65 -16
- package/dist/Textarea/Textarea.js +50 -16
- package/dist/Toggle/Toggle.js +32 -16
- package/dist/Tooltip/Tooltip.js +202 -178
- package/dist/fields/Field/Field.js +7 -5
- package/dist/fields/Fieldset/Fieldset.js +21 -5
- package/dist/fields/commonFieldTypes.d.ts +1 -1
- package/dist/fields/components/CommonInput.js +17 -21
- package/dist/fields/components/InternalField.js +77 -29
- package/dist/fontStyle.js +5 -3
- package/dist/hooks/useClickOutside/index.js +30 -22
- package/dist/hooks/useEventListener/index.js +19 -12
- package/dist/hooks/useScript/index.js +16 -11
- package/dist/hooks/useTimeout/index.js +13 -11
- package/dist/index.d.ts +1 -1
- package/dist/index.js +49 -43
- package/dist/theme.js +87 -57
- package/dist/utils/date.js +8 -7
- package/dist/utils/debounce.js +13 -18
- package/dist/utils/flex.js +47 -30
- package/dist/utils/focusOutline.js +8 -4
- package/dist/utils/id.js +10 -8
- package/dist/utils/isReactElement.js +5 -3
- package/dist/utils/measure.js +11 -10
- package/dist/utils/responsiveProp.js +16 -17
- package/dist/utils/space.js +78 -62
- package/dist/utils/useControlledState.js +20 -12
- package/dist/utils/visuallyHidden.js +3 -6
- package/package.json +17 -16
- package/dist/Accordion/Accordion.js.map +0 -1
- package/dist/Accordion/Accordion.stories.d.ts +0 -9
- package/dist/Accordion/Accordion.stories.js +0 -11
- package/dist/Accordion/Accordion.stories.js.map +0 -1
- package/dist/Accordion/Collection.d.ts +0 -2
- package/dist/Accordion/Collection.js +0 -52
- package/dist/Accordion/Collection.js.map +0 -1
- package/dist/Accordion/__tests__/Accordion.d.ts +0 -1
- package/dist/Accordion/__tests__/Accordion.js +0 -9
- package/dist/Accordion/__tests__/Accordion.js.map +0 -1
- package/dist/Accordion/index.js +0 -2
- package/dist/Accordion/index.js.map +0 -1
- package/dist/ActionDropdown/ActionDropdown.js.map +0 -1
- package/dist/ActionDropdown/ActionDropdown.stories.d.ts +0 -7
- package/dist/ActionDropdown/ActionDropdown.stories.js +0 -13
- package/dist/ActionDropdown/ActionDropdown.stories.js.map +0 -1
- package/dist/ActionDropdown/Container.d.ts +0 -2
- package/dist/ActionDropdown/Container.js +0 -51
- package/dist/ActionDropdown/Container.js.map +0 -1
- package/dist/ActionDropdown/List.js.map +0 -1
- package/dist/ActionDropdown/__tests__/ActionDropdown.d.ts +0 -1
- package/dist/ActionDropdown/__tests__/ActionDropdown.js +0 -23
- package/dist/ActionDropdown/__tests__/ActionDropdown.js.map +0 -1
- package/dist/ActionDropdown/index.js +0 -2
- package/dist/ActionDropdown/index.js.map +0 -1
- package/dist/Banner/Banner.stories.d.ts +0 -9
- package/dist/Banner/Banner.stories.js +0 -86
- package/dist/Banner/Banner.stories.js.map +0 -1
- package/dist/Banner/BannerContainer.js.map +0 -1
- package/dist/Banner/BannerItem.js.map +0 -1
- package/dist/Banner/hooks.js.map +0 -1
- package/dist/Banner/index.js +0 -3
- package/dist/Banner/index.js.map +0 -1
- package/dist/Banner/types.js +0 -2
- package/dist/Banner/types.js.map +0 -1
- package/dist/Box/Box.js.map +0 -1
- package/dist/Box/Box.stories.d.ts +0 -7
- package/dist/Box/Box.stories.js +0 -38
- package/dist/Box/Box.stories.js.map +0 -1
- package/dist/Box/__tests__/Box.d.ts +0 -1
- package/dist/Box/__tests__/Box.js +0 -9
- package/dist/Box/__tests__/Box.js.map +0 -1
- package/dist/Box/index.js +0 -2
- package/dist/Box/index.js.map +0 -1
- package/dist/BrandCard/BrandCard.js.map +0 -1
- package/dist/BrandCard/BrandCard.stories.d.ts +0 -11
- package/dist/BrandCard/BrandCard.stories.js +0 -54
- package/dist/BrandCard/BrandCard.stories.js.map +0 -1
- package/dist/BrandCard/__tests__/BrandCard.d.ts +0 -1
- package/dist/BrandCard/__tests__/BrandCard.js +0 -9
- package/dist/BrandCard/__tests__/BrandCard.js.map +0 -1
- package/dist/BrandCard/index.js +0 -2
- package/dist/BrandCard/index.js.map +0 -1
- package/dist/Button/Button.js.map +0 -1
- package/dist/Button/Button.stories.d.ts +0 -16
- package/dist/Button/Button.stories.js +0 -28
- package/dist/Button/Button.stories.js.map +0 -1
- package/dist/Button/Collection.d.ts +0 -4
- package/dist/Button/Collection.js +0 -53
- package/dist/Button/Collection.js.map +0 -1
- package/dist/Button/InteractivePlayground.d.ts +0 -2
- package/dist/Button/InteractivePlayground.js +0 -17
- package/dist/Button/InteractivePlayground.js.map +0 -1
- package/dist/Button/__tests__/Button.d.ts +0 -1
- package/dist/Button/__tests__/Button.js +0 -9
- package/dist/Button/__tests__/Button.js.map +0 -1
- package/dist/Button/index.js +0 -2
- package/dist/Button/index.js.map +0 -1
- package/dist/Card/Card.js.map +0 -1
- package/dist/Card/Card.stories.d.ts +0 -17
- package/dist/Card/Card.stories.js +0 -92
- package/dist/Card/Card.stories.js.map +0 -1
- package/dist/Card/__tests__/Card.d.ts +0 -1
- package/dist/Card/__tests__/Card.js +0 -9
- package/dist/Card/__tests__/Card.js.map +0 -1
- package/dist/Card/index.js +0 -2
- package/dist/Card/index.js.map +0 -1
- package/dist/CheckBox/CheckBox.js.map +0 -1
- package/dist/CheckBox/CheckBox.stories.d.ts +0 -10
- package/dist/CheckBox/CheckBox.stories.js +0 -22
- package/dist/CheckBox/CheckBox.stories.js.map +0 -1
- package/dist/CheckBox/Container.d.ts +0 -2
- package/dist/CheckBox/Container.js +0 -7
- package/dist/CheckBox/Container.js.map +0 -1
- package/dist/CheckBox/__tests__/CheckBox.d.ts +0 -1
- package/dist/CheckBox/__tests__/CheckBox.js +0 -8
- package/dist/CheckBox/__tests__/CheckBox.js.map +0 -1
- package/dist/CheckBox/index.js +0 -2
- package/dist/CheckBox/index.js.map +0 -1
- package/dist/CheckBoxGroup/CheckBoxGroup.js.map +0 -1
- package/dist/CheckBoxGroup/CheckBoxGroup.stories.d.ts +0 -14
- package/dist/CheckBoxGroup/CheckBoxGroup.stories.js +0 -40
- package/dist/CheckBoxGroup/CheckBoxGroup.stories.js.map +0 -1
- package/dist/CheckBoxGroup/index.js +0 -2
- package/dist/CheckBoxGroup/index.js.map +0 -1
- package/dist/Chip/Chip.js.map +0 -1
- package/dist/Chip/Chip.stories.d.ts +0 -16
- package/dist/Chip/Chip.stories.js +0 -35
- package/dist/Chip/Chip.stories.js.map +0 -1
- package/dist/Chip/index.js +0 -2
- package/dist/Chip/index.js.map +0 -1
- package/dist/CurrencyInput/Collection.d.ts +0 -2
- package/dist/CurrencyInput/Collection.js +0 -65
- package/dist/CurrencyInput/Collection.js.map +0 -1
- package/dist/CurrencyInput/CurrencyInput.js.map +0 -1
- package/dist/CurrencyInput/CurrencyInput.stories.d.ts +0 -16
- package/dist/CurrencyInput/CurrencyInput.stories.js +0 -33
- package/dist/CurrencyInput/CurrencyInput.stories.js.map +0 -1
- package/dist/CurrencyInput/Example.d.ts +0 -2
- package/dist/CurrencyInput/Example.js +0 -8
- package/dist/CurrencyInput/Example.js.map +0 -1
- package/dist/CurrencyInput/__tests__/CurrencyInput.d.ts +0 -1
- package/dist/CurrencyInput/__tests__/CurrencyInput.js +0 -17
- package/dist/CurrencyInput/__tests__/CurrencyInput.js.map +0 -1
- package/dist/CurrencyInput/index.js +0 -2
- package/dist/CurrencyInput/index.js.map +0 -1
- package/dist/Datepicker/Datepicker.js.map +0 -1
- package/dist/Datepicker/Datepicker.stories.d.ts +0 -13
- package/dist/Datepicker/Datepicker.stories.js +0 -18
- package/dist/Datepicker/Datepicker.stories.js.map +0 -1
- package/dist/Datepicker/DatesList.js.map +0 -1
- package/dist/Datepicker/index.js +0 -2
- package/dist/Datepicker/index.js.map +0 -1
- package/dist/Datepicker/types.js +0 -2
- package/dist/Datepicker/types.js.map +0 -1
- package/dist/Divider/Divider.js.map +0 -1
- package/dist/Divider/Divier.stories.d.ts +0 -8
- package/dist/Divider/Divier.stories.js +0 -10
- package/dist/Divider/Divier.stories.js.map +0 -1
- package/dist/Divider/index.js +0 -2
- package/dist/Divider/index.js.map +0 -1
- package/dist/Dropdown/Collection.d.ts +0 -2
- package/dist/Dropdown/Collection.js +0 -101
- package/dist/Dropdown/Collection.js.map +0 -1
- package/dist/Dropdown/Container.d.ts +0 -2
- package/dist/Dropdown/Container.js +0 -98
- package/dist/Dropdown/Container.js.map +0 -1
- package/dist/Dropdown/Dropdown.js.map +0 -1
- package/dist/Dropdown/Dropdown.stories.d.ts +0 -15
- package/dist/Dropdown/Dropdown.stories.js +0 -54
- package/dist/Dropdown/Dropdown.stories.js.map +0 -1
- package/dist/Dropdown/index.js +0 -2
- package/dist/Dropdown/index.js.map +0 -1
- package/dist/Emoji/Emoji.js.map +0 -1
- package/dist/Emoji/Emoji.stories.d.ts +0 -8
- package/dist/Emoji/Emoji.stories.js +0 -18
- package/dist/Emoji/Emoji.stories.js.map +0 -1
- package/dist/Emoji/__tests__/Emoji.d.ts +0 -1
- package/dist/Emoji/__tests__/Emoji.js +0 -9
- package/dist/Emoji/__tests__/Emoji.js.map +0 -1
- package/dist/Emoji/index.js +0 -2
- package/dist/Emoji/index.js.map +0 -1
- package/dist/Icon/Container.d.ts +0 -2
- package/dist/Icon/Container.js +0 -638
- package/dist/Icon/Container.js.map +0 -1
- package/dist/Icon/Icon.js.map +0 -1
- package/dist/Icon/Icon.stories.d.ts +0 -9
- package/dist/Icon/Icon.stories.js +0 -31
- package/dist/Icon/Icon.stories.js.map +0 -1
- package/dist/Icon/__tests__/Icon.d.ts +0 -1
- package/dist/Icon/__tests__/Icon.js +0 -9
- package/dist/Icon/__tests__/Icon.js.map +0 -1
- package/dist/Icon/index.js +0 -2
- package/dist/Icon/index.js.map +0 -1
- package/dist/IconStrict/IconStrict.js.map +0 -1
- package/dist/IconStrict/IconStrict.stories.d.ts +0 -11
- package/dist/IconStrict/IconStrict.stories.js +0 -33
- package/dist/IconStrict/IconStrict.stories.js.map +0 -1
- package/dist/IconStrict/__tests__/IconStrict.d.ts +0 -1
- package/dist/IconStrict/__tests__/IconStrict.js +0 -9
- package/dist/IconStrict/__tests__/IconStrict.js.map +0 -1
- package/dist/IconStrict/index.js +0 -2
- package/dist/IconStrict/index.js.map +0 -1
- package/dist/IconWrapper/IconWrapper.js.map +0 -1
- package/dist/IconWrapper/IconWrapper.stories.d.ts +0 -13
- package/dist/IconWrapper/IconWrapper.stories.js +0 -45
- package/dist/IconWrapper/IconWrapper.stories.js.map +0 -1
- package/dist/IconWrapper/__tests__/IconWrapper.d.ts +0 -1
- package/dist/IconWrapper/__tests__/IconWrapper.js +0 -19
- package/dist/IconWrapper/__tests__/IconWrapper.js.map +0 -1
- package/dist/IconWrapper/index.js +0 -2
- package/dist/IconWrapper/index.js.map +0 -1
- package/dist/LabelledText/LabelledText.js.map +0 -1
- package/dist/LabelledText/LabelledText.stories.d.ts +0 -8
- package/dist/LabelledText/LabelledText.stories.js +0 -12
- package/dist/LabelledText/LabelledText.stories.js.map +0 -1
- package/dist/LabelledText/__tests__/LabelledText.d.ts +0 -1
- package/dist/LabelledText/__tests__/LabelledText.js +0 -9
- package/dist/LabelledText/__tests__/LabelledText.js.map +0 -1
- package/dist/LabelledText/index.js +0 -2
- package/dist/LabelledText/index.js.map +0 -1
- package/dist/Link/Link.js.map +0 -1
- package/dist/Link/Link.stories.d.ts +0 -16
- package/dist/Link/Link.stories.js +0 -38
- package/dist/Link/Link.stories.js.map +0 -1
- package/dist/Link/index.js +0 -2
- package/dist/Link/index.js.map +0 -1
- package/dist/Loader/Loader.js.map +0 -1
- package/dist/Loader/Loader.stories.d.ts +0 -9
- package/dist/Loader/Loader.stories.js +0 -17
- package/dist/Loader/Loader.stories.js.map +0 -1
- package/dist/Loader/__tests__/Loader.d.ts +0 -1
- package/dist/Loader/__tests__/Loader.js +0 -9
- package/dist/Loader/__tests__/Loader.js.map +0 -1
- package/dist/Loader/index.js +0 -2
- package/dist/Loader/index.js.map +0 -1
- package/dist/Logo/Collection.d.ts +0 -4
- package/dist/Logo/Collection.js +0 -33
- package/dist/Logo/Collection.js.map +0 -1
- package/dist/Logo/Logo.js.map +0 -1
- package/dist/Logo/Logo.stories.d.ts +0 -13
- package/dist/Logo/Logo.stories.js +0 -28
- package/dist/Logo/Logo.stories.js.map +0 -1
- package/dist/Logo/index.js +0 -2
- package/dist/Logo/index.js.map +0 -1
- package/dist/Modal/Modal.js.map +0 -1
- package/dist/Modal/Modal.stories.d.ts +0 -13
- package/dist/Modal/Modal.stories.js +0 -28
- package/dist/Modal/Modal.stories.js.map +0 -1
- package/dist/Modal/__tests__/Modal.d.ts +0 -1
- package/dist/Modal/__tests__/Modal.js +0 -9
- package/dist/Modal/__tests__/Modal.js.map +0 -1
- package/dist/Modal/index.js +0 -2
- package/dist/Modal/index.js.map +0 -1
- package/dist/Modal/useBodyScrollLock.js.map +0 -1
- package/dist/NumberInput/Collection.d.ts +0 -2
- package/dist/NumberInput/Collection.js +0 -97
- package/dist/NumberInput/Collection.js.map +0 -1
- package/dist/NumberInput/Container.d.ts +0 -2
- package/dist/NumberInput/Container.js +0 -10
- package/dist/NumberInput/Container.js.map +0 -1
- package/dist/NumberInput/NumberInput.js.map +0 -1
- package/dist/NumberInput/NumberInput.stories.d.ts +0 -16
- package/dist/NumberInput/NumberInput.stories.js +0 -33
- package/dist/NumberInput/NumberInput.stories.js.map +0 -1
- package/dist/NumberInput/__tests__/NumberInput.d.ts +0 -1
- package/dist/NumberInput/__tests__/NumberInput.js +0 -33
- package/dist/NumberInput/__tests__/NumberInput.js.map +0 -1
- package/dist/NumberInput/index.js +0 -2
- package/dist/NumberInput/index.js.map +0 -1
- package/dist/Pagination/Pagination.js.map +0 -1
- package/dist/Pagination/Pagination.stories.d.ts +0 -14
- package/dist/Pagination/Pagination.stories.js +0 -26
- package/dist/Pagination/Pagination.stories.js.map +0 -1
- package/dist/Pagination/__tests__/Pagination.d.ts +0 -1
- package/dist/Pagination/__tests__/Pagination.js +0 -9
- package/dist/Pagination/__tests__/Pagination.js.map +0 -1
- package/dist/Pagination/index.js +0 -2
- package/dist/Pagination/index.js.map +0 -1
- package/dist/RadioGroup/RadioElement.js.map +0 -1
- package/dist/RadioGroup/RadioGroup.js.map +0 -1
- package/dist/RadioGroup/RadioGroup.stories.d.ts +0 -33
- package/dist/RadioGroup/RadioGroup.stories.js +0 -76
- package/dist/RadioGroup/RadioGroup.stories.js.map +0 -1
- package/dist/RadioGroup/RadioItem.js.map +0 -1
- package/dist/RadioGroup/constants.js.map +0 -1
- package/dist/RadioGroup/index.js +0 -2
- package/dist/RadioGroup/index.js.map +0 -1
- package/dist/RadioGroup/types.js +0 -2
- package/dist/RadioGroup/types.js.map +0 -1
- package/dist/Row/Row.js.map +0 -1
- package/dist/Row/Row.stories.d.ts +0 -20
- package/dist/Row/Row.stories.js +0 -63
- package/dist/Row/Row.stories.js.map +0 -1
- package/dist/Row/__tests__/Row.d.ts +0 -1
- package/dist/Row/__tests__/Row.js +0 -10
- package/dist/Row/__tests__/Row.js.map +0 -1
- package/dist/Row/index.js +0 -2
- package/dist/Row/index.js.map +0 -1
- package/dist/SearchInput/Container.d.ts +0 -3
- package/dist/SearchInput/Container.js +0 -36
- package/dist/SearchInput/Container.js.map +0 -1
- package/dist/SearchInput/SearchInput.js.map +0 -1
- package/dist/SearchInput/SearchInput.stories.d.ts +0 -9
- package/dist/SearchInput/SearchInput.stories.js +0 -16
- package/dist/SearchInput/SearchInput.stories.js.map +0 -1
- package/dist/SearchInput/SearchOptions.js.map +0 -1
- package/dist/SearchInput/index.js +0 -2
- package/dist/SearchInput/index.js.map +0 -1
- package/dist/Snackbar/Snackbar.stories.d.ts +0 -9
- package/dist/Snackbar/Snackbar.stories.js +0 -26
- package/dist/Snackbar/Snackbar.stories.js.map +0 -1
- package/dist/Snackbar/SnackbarContainer.js.map +0 -1
- package/dist/Snackbar/SnackbarItem.js.map +0 -1
- package/dist/Snackbar/hooks.js.map +0 -1
- package/dist/Snackbar/index.js +0 -3
- package/dist/Snackbar/index.js.map +0 -1
- package/dist/Snackbar/types.js +0 -2
- package/dist/Snackbar/types.js.map +0 -1
- package/dist/SupportMessage/Collection.d.ts +0 -2
- package/dist/SupportMessage/Collection.js +0 -63
- package/dist/SupportMessage/Collection.js.map +0 -1
- package/dist/SupportMessage/SupportMessage.js.map +0 -1
- package/dist/SupportMessage/SupportMessage.stories.d.ts +0 -11
- package/dist/SupportMessage/SupportMessage.stories.js +0 -33
- package/dist/SupportMessage/SupportMessage.stories.js.map +0 -1
- package/dist/SupportMessage/SupportMessage.test.d.ts +0 -1
- package/dist/SupportMessage/SupportMessage.test.js +0 -29
- package/dist/SupportMessage/SupportMessage.test.js.map +0 -1
- package/dist/SupportMessage/index.js +0 -2
- package/dist/SupportMessage/index.js.map +0 -1
- package/dist/Table/Table.js.map +0 -1
- package/dist/Table/Table.stories.d.ts +0 -21
- package/dist/Table/Table.stories.js +0 -173
- package/dist/Table/Table.stories.js.map +0 -1
- package/dist/Table/components/RowActions.js.map +0 -1
- package/dist/Table/components/TableHeader.js.map +0 -1
- package/dist/Table/components/TableRow.js.map +0 -1
- package/dist/Table/components/commonComponents.js.map +0 -1
- package/dist/Table/helpers.js.map +0 -1
- package/dist/Table/index.js +0 -3
- package/dist/Table/index.js.map +0 -1
- package/dist/Table/storyUtils.d.ts +0 -68
- package/dist/Table/storyUtils.js +0 -204
- package/dist/Table/storyUtils.js.map +0 -1
- package/dist/Table/types.js +0 -2
- package/dist/Table/types.js.map +0 -1
- package/dist/Tag/Collection.d.ts +0 -2
- package/dist/Tag/Collection.js +0 -77
- package/dist/Tag/Collection.js.map +0 -1
- package/dist/Tag/Tag.js.map +0 -1
- package/dist/Tag/Tag.stories.d.ts +0 -9
- package/dist/Tag/Tag.stories.js +0 -22
- package/dist/Tag/Tag.stories.js.map +0 -1
- package/dist/Tag/__tests__/Tag.d.ts +0 -1
- package/dist/Tag/__tests__/Tag.js +0 -9
- package/dist/Tag/__tests__/Tag.js.map +0 -1
- package/dist/Tag/index.js +0 -2
- package/dist/Tag/index.js.map +0 -1
- package/dist/Text/Text.js.map +0 -1
- package/dist/Text/Text.stories.d.ts +0 -12
- package/dist/Text/Text.stories.js +0 -60
- package/dist/Text/Text.stories.js.map +0 -1
- package/dist/Text/__tests__/Text.d.ts +0 -1
- package/dist/Text/__tests__/Text.js +0 -9
- package/dist/Text/__tests__/Text.js.map +0 -1
- package/dist/Text/fontMapping.js.map +0 -1
- package/dist/Text/index.js +0 -2
- package/dist/Text/index.js.map +0 -1
- package/dist/TextInput/Collection.d.ts +0 -2
- package/dist/TextInput/Collection.js +0 -80
- package/dist/TextInput/Collection.js.map +0 -1
- package/dist/TextInput/Container.d.ts +0 -2
- package/dist/TextInput/Container.js +0 -8
- package/dist/TextInput/Container.js.map +0 -1
- package/dist/TextInput/TextInput.js.map +0 -1
- package/dist/TextInput/TextInput.stories.d.ts +0 -17
- package/dist/TextInput/TextInput.stories.js +0 -44
- package/dist/TextInput/TextInput.stories.js.map +0 -1
- package/dist/TextInput/__tests__/TextInput.d.ts +0 -1
- package/dist/TextInput/__tests__/TextInput.js +0 -9
- package/dist/TextInput/__tests__/TextInput.js.map +0 -1
- package/dist/TextInput/index.js +0 -2
- package/dist/TextInput/index.js.map +0 -1
- package/dist/Textarea/Container.d.ts +0 -2
- package/dist/Textarea/Container.js +0 -8
- package/dist/Textarea/Container.js.map +0 -1
- package/dist/Textarea/Textarea.js.map +0 -1
- package/dist/Textarea/Textarea.stories.d.ts +0 -13
- package/dist/Textarea/Textarea.stories.js +0 -66
- package/dist/Textarea/Textarea.stories.js.map +0 -1
- package/dist/Textarea/index.js +0 -2
- package/dist/Textarea/index.js.map +0 -1
- package/dist/Toggle/Container.d.ts +0 -2
- package/dist/Toggle/Container.js +0 -7
- package/dist/Toggle/Container.js.map +0 -1
- package/dist/Toggle/Toggle.js.map +0 -1
- package/dist/Toggle/Toggle.stories.d.ts +0 -11
- package/dist/Toggle/Toggle.stories.js +0 -10
- package/dist/Toggle/Toggle.stories.js.map +0 -1
- package/dist/Toggle/__tests__/Toggle.d.ts +0 -1
- package/dist/Toggle/__tests__/Toggle.js +0 -9
- package/dist/Toggle/__tests__/Toggle.js.map +0 -1
- package/dist/Toggle/index.js +0 -2
- package/dist/Toggle/index.js.map +0 -1
- package/dist/Tooltip/Tooltip.js.map +0 -1
- package/dist/Tooltip/Tooltip.stories.d.ts +0 -12
- package/dist/Tooltip/Tooltip.stories.js +0 -87
- package/dist/Tooltip/Tooltip.stories.js.map +0 -1
- package/dist/Tooltip/index.js +0 -2
- package/dist/Tooltip/index.js.map +0 -1
- package/dist/colors.stories.d.ts +0 -7
- package/dist/colors.stories.js +0 -100
- package/dist/colors.stories.js.map +0 -1
- package/dist/fields/Field/Field.js.map +0 -1
- package/dist/fields/Field/index.js +0 -2
- package/dist/fields/Field/index.js.map +0 -1
- package/dist/fields/Fieldset/Fieldset.js.map +0 -1
- package/dist/fields/Fieldset/Fieldset.stories.d.ts +0 -11
- package/dist/fields/Fieldset/Fieldset.stories.js +0 -34
- package/dist/fields/Fieldset/Fieldset.stories.js.map +0 -1
- package/dist/fields/Fieldset/index.js +0 -2
- package/dist/fields/Fieldset/index.js.map +0 -1
- package/dist/fields/commonFieldTypes.js +0 -2
- package/dist/fields/commonFieldTypes.js.map +0 -1
- package/dist/fields/components/CommonInput.js.map +0 -1
- package/dist/fields/components/InternalField.js.map +0 -1
- package/dist/fields/components/Placeholder.js +0 -25
- package/dist/fields/components/Placeholder.js.map +0 -1
- package/dist/fontStyle.js.map +0 -1
- package/dist/hooks/index.js +0 -5
- package/dist/hooks/index.js.map +0 -1
- package/dist/hooks/useClickOutside/index.js.map +0 -1
- package/dist/hooks/useClickOutside/useClickOutside.test.js +0 -46
- package/dist/hooks/useClickOutside/useClickOutside.test.js.map +0 -1
- package/dist/hooks/useEventListener/index.js.map +0 -1
- package/dist/hooks/useEventListener/useEventLitener.test.js +0 -36
- package/dist/hooks/useEventListener/useEventLitener.test.js.map +0 -1
- package/dist/hooks/useScript/index.js.map +0 -1
- package/dist/hooks/useScript/useScript.test.js +0 -17
- package/dist/hooks/useScript/useScript.test.js.map +0 -1
- package/dist/hooks/useTimeout/index.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/setupTests.d.ts +0 -1
- package/dist/setupTests.js +0 -2
- package/dist/setupTests.js.map +0 -1
- package/dist/theme.js.map +0 -1
- package/dist/tokenTest.spec.js +0 -8
- package/dist/tokenTest.spec.js.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/utils/date.js.map +0 -1
- package/dist/utils/debounce.js.map +0 -1
- package/dist/utils/deprecated.js +0 -30
- package/dist/utils/deprecated.js.map +0 -1
- package/dist/utils/flex.js.map +0 -1
- package/dist/utils/focusOutline.js.map +0 -1
- package/dist/utils/id.js.map +0 -1
- package/dist/utils/id.test.js +0 -21
- package/dist/utils/id.test.js.map +0 -1
- package/dist/utils/isReactElement.js.map +0 -1
- package/dist/utils/measure.js.map +0 -1
- package/dist/utils/noop.js +0 -3
- package/dist/utils/noop.js.map +0 -1
- package/dist/utils/responsiveProp.js.map +0 -1
- package/dist/utils/space.js.map +0 -1
- package/dist/utils/useControlledState.js.map +0 -1
- package/dist/utils/visuallyHidden.js.map +0 -1
package/README.md
CHANGED
@@ -131,7 +131,6 @@ yalc remove --all
|
|
131
131
|
* [Link](https://github.com/marshmallow-insurance/smores-react/tree/master/src/Link)
|
132
132
|
* [Loader](https://github.com/marshmallow-insurance/smores-react/tree/master/src/Loader)
|
133
133
|
* [Logo](https://github.com/marshmallow-insurance/smores-react/tree/master/src/Logo)
|
134
|
-
* [Message](https://github.com/marshmallow-insurance/smores-react/tree/master/src/Message) (deprecated - use Support Message instead)
|
135
134
|
* [Modal](https://github.com/marshmallow-insurance/smores-react/tree/master/src/Modal)
|
136
135
|
* [NumberInput](https://github.com/marshmallow-insurance/smores-react/tree/master/src/NumberInput)
|
137
136
|
* [Pagination](https://github.com/marshmallow-insurance/smores-react/tree/master/src/Pagination)
|
@@ -159,7 +158,6 @@ const App = () => (
|
|
159
158
|
<>
|
160
159
|
<Text>Hey you</Text>
|
161
160
|
<Button
|
162
|
-
color="green"
|
163
161
|
onClick={() => console.log('thanks for clicking :)')}
|
164
162
|
>
|
165
163
|
Click me!
|
package/dist/.gitkeep
ADDED
File without changes
|
@@ -1,49 +1,107 @@
|
|
1
|
-
import
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
2
|
+
import { useState } from 'react';
|
2
3
|
import styled, { css } from 'styled-components';
|
3
|
-
import { Box } from '../Box';
|
4
|
-
import { Icon } from '../Icon';
|
5
|
-
import { theme } from '../theme';
|
6
|
-
import { Text } from '../Text';
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
4
|
+
import { Box } from '../Box/Box.js';
|
5
|
+
import { Icon } from '../Icon/Icon.js';
|
6
|
+
import { theme } from '../theme.js';
|
7
|
+
import { Text } from '../Text/Text.js';
|
8
|
+
|
9
|
+
const Accordion = ({
|
10
|
+
title,
|
11
|
+
children,
|
12
|
+
onToggle,
|
13
|
+
filledBackground,
|
14
|
+
defaultIsOpen = false,
|
15
|
+
borderTop = false,
|
16
|
+
borderColor = "oatmeal",
|
17
|
+
backgroundColor = "custard",
|
18
|
+
subTitle,
|
19
|
+
fullBorder = false,
|
20
|
+
...marginProps
|
21
|
+
}) => {
|
22
|
+
const [isOpen, setIsOpen] = useState(defaultIsOpen);
|
23
|
+
const px = fullBorder ? "16px" : "0";
|
24
|
+
const handleToggle = () => {
|
25
|
+
const nextOpenState = !isOpen;
|
26
|
+
onToggle?.(nextOpenState);
|
27
|
+
setIsOpen(nextOpenState);
|
28
|
+
};
|
29
|
+
return /* @__PURE__ */ jsxs(
|
30
|
+
Wrapper,
|
31
|
+
{
|
32
|
+
borderTop,
|
33
|
+
fullBorder,
|
34
|
+
filledBackground,
|
35
|
+
borderColor,
|
36
|
+
backgroundColor,
|
37
|
+
...marginProps,
|
38
|
+
children: [
|
39
|
+
/* @__PURE__ */ jsxs(
|
40
|
+
TopContainer,
|
41
|
+
{
|
42
|
+
flex: true,
|
43
|
+
alignItems: "center",
|
44
|
+
justifyContent: "space-between",
|
45
|
+
onClick: handleToggle,
|
46
|
+
py: "16px",
|
47
|
+
pr: "16px",
|
48
|
+
pl: px,
|
49
|
+
children: [
|
50
|
+
/* @__PURE__ */ jsxs(TitleContainer, { children: [
|
51
|
+
/* @__PURE__ */ jsx(Text, { tag: "h2", typo: "headline-regular", color: "liquorice", children: title }),
|
52
|
+
subTitle && /* @__PURE__ */ jsx(Text, { tag: "label", color: "liquorice", typo: "label", mt: { custom: 4 }, children: subTitle })
|
53
|
+
] }),
|
54
|
+
/* @__PURE__ */ jsx(
|
55
|
+
CaretIcon,
|
56
|
+
{
|
57
|
+
render: "caret",
|
58
|
+
size: 24,
|
59
|
+
color: "marzipan",
|
60
|
+
isOpen,
|
61
|
+
borderTop
|
62
|
+
}
|
63
|
+
)
|
64
|
+
]
|
65
|
+
}
|
66
|
+
),
|
67
|
+
isOpen && /* @__PURE__ */ jsx(Box, { pt: "12px", pb: "16px", px, children })
|
68
|
+
]
|
69
|
+
}
|
70
|
+
);
|
22
71
|
};
|
23
|
-
const Wrapper = styled(Box)(
|
72
|
+
const Wrapper = styled(Box)(
|
73
|
+
({
|
74
|
+
borderTop,
|
75
|
+
fullBorder,
|
76
|
+
filledBackground,
|
77
|
+
borderColor = "oatmeal",
|
78
|
+
backgroundColor = "custard"
|
79
|
+
}) => css`
|
24
80
|
border-bottom: 1px solid ${theme.colors[borderColor]};
|
25
81
|
${borderTop && `border-top: 1px solid ${theme.colors[borderColor]};`}
|
26
82
|
|
27
|
-
${fullBorder &&
|
28
|
-
css `
|
83
|
+
${fullBorder && css`
|
29
84
|
border: 1px solid ${theme.colors[borderColor]};
|
30
85
|
border-radius: 16px;
|
31
86
|
`}
|
32
87
|
|
33
|
-
${filledBackground &&
|
34
|
-
css `
|
88
|
+
${filledBackground && css`
|
35
89
|
background-color: ${theme.colors[backgroundColor]};
|
36
90
|
`}
|
37
|
-
`
|
38
|
-
|
91
|
+
`
|
92
|
+
);
|
93
|
+
const TitleContainer = styled.div`
|
39
94
|
display: flex;
|
40
95
|
flex-direction: column;
|
41
96
|
`;
|
42
|
-
const TopContainer = styled(Box)
|
97
|
+
const TopContainer = styled(Box)`
|
43
98
|
cursor: pointer;
|
44
99
|
`;
|
45
|
-
const CaretIcon = styled(Icon)(
|
46
|
-
|
100
|
+
const CaretIcon = styled(Icon)(
|
101
|
+
({ isOpen }) => css`
|
102
|
+
transform: ${isOpen ? "rotate(180deg)" : "rotate(0deg)"};
|
47
103
|
transition: transform 0.6s ease;
|
48
|
-
`
|
49
|
-
|
104
|
+
`
|
105
|
+
);
|
106
|
+
|
107
|
+
export { Accordion };
|
@@ -1,21 +1,57 @@
|
|
1
|
-
import
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
2
|
+
import { useState } from 'react';
|
2
3
|
import styled, { css } from 'styled-components';
|
3
|
-
import { Box } from '../Box';
|
4
|
-
import { Icon } from '../Icon';
|
5
|
-
import { Text } from '../Text';
|
6
|
-
import { List } from './List';
|
7
|
-
import { theme } from '../theme';
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
4
|
+
import { Box } from '../Box/Box.js';
|
5
|
+
import { Icon } from '../Icon/Icon.js';
|
6
|
+
import { Text } from '../Text/Text.js';
|
7
|
+
import { List } from './List.js';
|
8
|
+
import { theme } from '../theme.js';
|
9
|
+
|
10
|
+
const ActionDropdown = ({
|
11
|
+
id,
|
12
|
+
className = "",
|
13
|
+
label,
|
14
|
+
value,
|
15
|
+
list,
|
16
|
+
onSelect,
|
17
|
+
...marginProps
|
18
|
+
}) => {
|
19
|
+
const [open, setOpen] = useState(false);
|
20
|
+
return /* @__PURE__ */ jsxs(
|
21
|
+
Container,
|
22
|
+
{
|
23
|
+
id,
|
24
|
+
className,
|
25
|
+
onClick: () => setOpen((currentOpen) => !currentOpen),
|
26
|
+
...marginProps,
|
27
|
+
children: [
|
28
|
+
label && /* @__PURE__ */ jsx(Text, { tag: "label", color: "sesame", typo: "label", children: label }),
|
29
|
+
/* @__PURE__ */ jsxs(
|
30
|
+
Label,
|
31
|
+
{
|
32
|
+
text: value.textColor ?? "liquorice",
|
33
|
+
bg: value.bgColor ?? "sesame",
|
34
|
+
children: [
|
35
|
+
/* @__PURE__ */ jsx(SelectedOption, { children: value.label }),
|
36
|
+
/* @__PURE__ */ jsx(
|
37
|
+
Icon,
|
38
|
+
{
|
39
|
+
render: "caret",
|
40
|
+
color: value.textColor ?? "sesame",
|
41
|
+
size: 24,
|
42
|
+
rotate: open ? 180 : 0
|
43
|
+
}
|
44
|
+
)
|
45
|
+
]
|
46
|
+
}
|
47
|
+
),
|
48
|
+
/* @__PURE__ */ jsx(OuterContainer, { open, children: /* @__PURE__ */ jsx(List, { options: list, selectOption: onSelect }) })
|
49
|
+
]
|
50
|
+
}
|
51
|
+
);
|
17
52
|
};
|
18
|
-
const Label = styled.div(
|
53
|
+
const Label = styled.div(
|
54
|
+
({ text, bg }) => css`
|
19
55
|
color: ${theme.colors[text]};
|
20
56
|
background-color: ${theme.colors[bg]};
|
21
57
|
position: relative;
|
@@ -29,15 +65,16 @@ const Label = styled.div(({ text, bg }) => css `
|
|
29
65
|
padding: 16px 16px 14px;
|
30
66
|
box-sizing: border-box;
|
31
67
|
user-select: none;
|
32
|
-
`
|
33
|
-
|
68
|
+
`
|
69
|
+
);
|
70
|
+
const SelectedOption = styled.span`
|
34
71
|
font-size: 14px;
|
35
72
|
font-weight: bold;
|
36
73
|
white-space: nowrap;
|
37
74
|
overflow: hidden;
|
38
75
|
text-overflow: ellipsis;
|
39
76
|
`;
|
40
|
-
const Container = styled(Box)
|
77
|
+
const Container = styled(Box)`
|
41
78
|
position: relative;
|
42
79
|
display: block;
|
43
80
|
width: 210px;
|
@@ -47,16 +84,19 @@ const Container = styled(Box) `
|
|
47
84
|
outline: none;
|
48
85
|
border-radius: 8px;
|
49
86
|
`;
|
50
|
-
const OuterContainer = styled.div(
|
87
|
+
const OuterContainer = styled.div(
|
88
|
+
({ open }) => css`
|
51
89
|
position: absolute;
|
52
90
|
width: 100%;
|
53
91
|
border-radius: 12px;
|
54
92
|
margin-top: 8px;
|
55
|
-
display: ${open ?
|
56
|
-
max-height: ${open ?
|
93
|
+
display: ${open ? "block" : "none"};
|
94
|
+
max-height: ${open ? "235px" : "48px"};
|
57
95
|
background-color: ${theme.colors.custard};
|
58
|
-
overflow-y: ${open ?
|
96
|
+
overflow-y: ${open ? "auto" : "hidden"};
|
59
97
|
z-index: 4;
|
60
98
|
transition: all 0.2s ease-in-out;
|
61
|
-
`
|
62
|
-
|
99
|
+
`
|
100
|
+
);
|
101
|
+
|
102
|
+
export { ActionDropdown };
|
@@ -1,14 +1,15 @@
|
|
1
|
-
import
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
2
2
|
import styled from 'styled-components';
|
3
|
-
import { theme } from '../theme';
|
3
|
+
import { theme } from '../theme.js';
|
4
4
|
import { darken } from 'polished';
|
5
|
-
|
6
|
-
const
|
5
|
+
|
6
|
+
const List = ({ options, selectOption }) => /* @__PURE__ */ jsx(Container, { children: options.map((option) => /* @__PURE__ */ jsx(ListItem, { onClick: () => selectOption(option), children: option.label }, option.value)) });
|
7
|
+
const Container = styled.ul`
|
7
8
|
padding: 0;
|
8
9
|
margin: 0;
|
9
10
|
max-height: 188px;
|
10
11
|
`;
|
11
|
-
const ListItem = styled.li
|
12
|
+
const ListItem = styled.li`
|
12
13
|
padding: 16px 24px;
|
13
14
|
text-align: left;
|
14
15
|
overflow: hidden;
|
@@ -27,4 +28,5 @@ const ListItem = styled.li `
|
|
27
28
|
border-bottom: none;
|
28
29
|
}
|
29
30
|
`;
|
30
|
-
|
31
|
+
|
32
|
+
export { List };
|
@@ -1,38 +1,46 @@
|
|
1
|
-
import
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
2
|
+
import { createContext, useContext, useState, useCallback } from 'react';
|
2
3
|
import styled from 'styled-components';
|
3
|
-
import { BannerItem } from './BannerItem';
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
import { BannerItem } from './BannerItem.js';
|
5
|
+
|
6
|
+
const BannerContext = createContext({
|
7
|
+
addBanner: () => {
|
8
|
+
throw new Error("Please add the BannerContainer to your application");
|
9
|
+
}
|
8
10
|
});
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
const
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
const
|
20
|
-
|
21
|
-
|
22
|
-
id: newBannerId(),
|
23
|
-
};
|
24
|
-
setBanner([newBanner]);
|
11
|
+
const useBannerContext = () => useContext(BannerContext);
|
12
|
+
const BannerContainer = ({ children }) => {
|
13
|
+
let bannerId = 0;
|
14
|
+
const [banner, setBanner] = useState([]);
|
15
|
+
const newBannerId = useCallback(() => {
|
16
|
+
const newId = `MM_BANNER_${bannerId}`;
|
17
|
+
bannerId++;
|
18
|
+
return newId;
|
19
|
+
}, [bannerId]);
|
20
|
+
const addBanner = (banner2) => {
|
21
|
+
const newBanner = {
|
22
|
+
...banner2,
|
23
|
+
id: newBannerId()
|
25
24
|
};
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
25
|
+
setBanner([newBanner]);
|
26
|
+
};
|
27
|
+
const deleteBanner = (id) => {
|
28
|
+
setBanner(banner.filter((banner2) => banner2.id !== id));
|
29
|
+
};
|
30
|
+
return /* @__PURE__ */ jsxs(
|
31
|
+
BannerContext.Provider,
|
32
|
+
{
|
33
|
+
value: {
|
34
|
+
addBanner
|
35
|
+
},
|
36
|
+
children: [
|
32
37
|
children,
|
33
|
-
|
38
|
+
/* @__PURE__ */ jsx(BannerWrapper, { children: banner.map((banner2) => /* @__PURE__ */ jsx(BannerItem, { ...banner2, deleteBanner }, banner2.id)) })
|
39
|
+
]
|
40
|
+
}
|
41
|
+
);
|
34
42
|
};
|
35
|
-
const BannerWrapper = styled.div
|
43
|
+
const BannerWrapper = styled.div`
|
36
44
|
position: fixed;
|
37
45
|
top: 0;
|
38
46
|
left: 0;
|
@@ -40,4 +48,5 @@ const BannerWrapper = styled.div `
|
|
40
48
|
width: 100%;
|
41
49
|
z-index: 99;
|
42
50
|
`;
|
43
|
-
|
51
|
+
|
52
|
+
export { BannerContainer, BannerContext, useBannerContext };
|
@@ -1,64 +1,122 @@
|
|
1
|
-
import {
|
2
|
-
import
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
2
|
+
import { Box } from '../Box/Box.js';
|
3
3
|
import styled, { css } from 'styled-components';
|
4
|
-
import { Icon } from '../Icon';
|
5
|
-
import { theme } from '../theme';
|
6
|
-
import { Text } from '../Text';
|
7
|
-
import
|
4
|
+
import { Icon } from '../Icon/Icon.js';
|
5
|
+
import { theme } from '../theme.js';
|
6
|
+
import { Text } from '../Text/Text.js';
|
7
|
+
import 'react';
|
8
|
+
import { useTimeout } from '../hooks/useTimeout/index.js';
|
9
|
+
|
8
10
|
const styles = {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
11
|
+
upsell: {
|
12
|
+
iconColor: "liquorice",
|
13
|
+
backgroundColor: theme.colors.marshmallowPink,
|
14
|
+
textColor: "liquorice"
|
15
|
+
},
|
16
|
+
critical: {
|
17
|
+
iconColor: "mascarpone",
|
18
|
+
backgroundColor: theme.colors.strawberry,
|
19
|
+
textColor: "mascarpone"
|
20
|
+
},
|
21
|
+
general: {
|
22
|
+
iconColor: "mascarpone",
|
23
|
+
backgroundColor: theme.colors.liquorice,
|
24
|
+
textColor: "mascarpone"
|
25
|
+
},
|
26
|
+
success: {
|
27
|
+
iconColor: "mascarpone",
|
28
|
+
backgroundColor: theme.colors.apple,
|
29
|
+
textColor: "mascarpone"
|
30
|
+
}
|
29
31
|
};
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
32
|
+
const BannerItem = ({
|
33
|
+
type,
|
34
|
+
autoCloseTime = 4,
|
35
|
+
id,
|
36
|
+
message,
|
37
|
+
topOffset,
|
38
|
+
exploreAction,
|
39
|
+
showExploreText,
|
40
|
+
showExploreIcon,
|
41
|
+
leadingIcon,
|
42
|
+
canManuallyClose,
|
43
|
+
showCloseIcon,
|
44
|
+
deleteBanner,
|
45
|
+
noTimeout
|
46
|
+
}) => {
|
47
|
+
const autoCloseBaner = () => {
|
48
|
+
if (noTimeout)
|
49
|
+
return;
|
50
|
+
if (type !== "critical")
|
51
|
+
return deleteBanner(id);
|
52
|
+
else {
|
53
|
+
return;
|
54
|
+
}
|
55
|
+
};
|
56
|
+
useTimeout(() => autoCloseBaner(), autoCloseTime * 1e3);
|
57
|
+
const textColor = styles[type].textColor;
|
58
|
+
const iconColor = styles[type].iconColor;
|
59
|
+
return /* @__PURE__ */ jsxs(
|
60
|
+
BannerWrapper,
|
61
|
+
{
|
62
|
+
p: "24px",
|
63
|
+
mt: { custom: topOffset },
|
64
|
+
flex: true,
|
65
|
+
justifyContent: "space-between",
|
66
|
+
type,
|
67
|
+
children: [
|
68
|
+
/* @__PURE__ */ jsxs(Box, { flex: true, alignItems: "center", children: [
|
69
|
+
leadingIcon && /* @__PURE__ */ jsx(Icon, { mr: "12px", render: leadingIcon, size: 24, color: iconColor }),
|
70
|
+
/* @__PURE__ */ jsx(Text, { typo: "headline-small", color: textColor, children: message })
|
71
|
+
] }),
|
72
|
+
/* @__PURE__ */ jsxs(Box, { flex: true, alignItems: "center", children: [
|
73
|
+
canManuallyClose && /* @__PURE__ */ jsx(
|
74
|
+
GenericButton,
|
75
|
+
{
|
76
|
+
onClick: () => deleteBanner(id),
|
77
|
+
"aria-label": `close banner ${message}`,
|
78
|
+
children: showCloseIcon ? /* @__PURE__ */ jsx(Icon, { render: "cross", size: 16, color: iconColor }) : /* @__PURE__ */ jsx(UnderlinedText, { tag: "span", typo: "desc-medium", color: textColor, children: "Dismiss" })
|
79
|
+
}
|
80
|
+
),
|
81
|
+
exploreAction && /* @__PURE__ */ jsx(GenericButton, { onClick: exploreAction, "aria-label": `cta ${message}`, children: /* @__PURE__ */ jsxs(Box, { flex: true, alignItems: "center", children: [
|
82
|
+
showExploreText && /* @__PURE__ */ jsx(
|
83
|
+
UnderlinedText,
|
84
|
+
{
|
85
|
+
ml: "12px",
|
86
|
+
tag: "span",
|
87
|
+
typo: "desc-medium",
|
88
|
+
color: textColor,
|
89
|
+
children: "Explore"
|
90
|
+
}
|
91
|
+
),
|
92
|
+
showExploreIcon && /* @__PURE__ */ jsx(
|
93
|
+
Icon,
|
94
|
+
{
|
95
|
+
render: "arrow",
|
96
|
+
ml: "12px",
|
97
|
+
size: 24,
|
98
|
+
color: iconColor,
|
99
|
+
rotate: 180
|
100
|
+
}
|
101
|
+
)
|
102
|
+
] }) })
|
103
|
+
] })
|
104
|
+
]
|
105
|
+
},
|
106
|
+
id
|
107
|
+
);
|
53
108
|
};
|
54
|
-
const BannerWrapper = styled(Box)(
|
109
|
+
const BannerWrapper = styled(Box)(
|
110
|
+
({ type }) => css`
|
55
111
|
border-radius: 0px 0px 16px 16px;
|
56
112
|
background-color: ${styles[type].backgroundColor};
|
57
|
-
`
|
58
|
-
|
113
|
+
`
|
114
|
+
);
|
115
|
+
const GenericButton = styled.button`
|
59
116
|
cursor: pointer;
|
60
117
|
`;
|
61
|
-
const UnderlinedText = styled(Text)
|
118
|
+
const UnderlinedText = styled(Text)`
|
62
119
|
text-decoration: underline;
|
63
120
|
`;
|
64
|
-
|
121
|
+
|
122
|
+
export { BannerItem };
|
package/dist/Banner/hooks.js
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
-
import { useBannerContext } from './BannerContainer';
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
import { useBannerContext } from './BannerContainer.js';
|
2
|
+
|
3
|
+
const useBanner = () => {
|
4
|
+
const { addBanner } = useBannerContext();
|
5
|
+
return { addBanner };
|
5
6
|
};
|
6
|
-
|
7
|
+
|
8
|
+
export { useBanner };
|
package/dist/Box/Box.js
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
import styled from 'styled-components';
|
2
|
-
import { flex } from '../utils/flex';
|
3
|
-
import { measure } from '../utils/measure';
|
4
|
-
import { margin, padding } from '../utils/space';
|
5
|
-
|
2
|
+
import { flex } from '../utils/flex.js';
|
3
|
+
import { measure } from '../utils/measure.js';
|
4
|
+
import { margin, padding } from '../utils/space.js';
|
5
|
+
|
6
|
+
const Box = styled.div`
|
6
7
|
${margin};
|
7
8
|
${padding};
|
8
9
|
${flex};
|
9
10
|
${measure};
|
10
11
|
`;
|
11
|
-
|
12
|
+
|
13
|
+
export { Box };
|