@newtonschool/grauity 0.0.13 → 0.1.10
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 +138 -9
- package/dist/fonts/grauity-icons.eot +0 -0
- package/dist/fonts/grauity-icons.ttf +0 -0
- package/dist/fonts/grauity-icons.woff +0 -0
- package/dist/fonts/grauity-icons.woff2 +0 -0
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/useClickAway.d.ts +15 -0
- package/dist/hooks/useClickAway.d.ts.map +1 -0
- package/dist/hooks/useDisableBodyScroll.d.ts +7 -0
- package/dist/hooks/useDisableBodyScroll.d.ts.map +1 -0
- package/dist/hooks/useKeyboardEvent.d.ts +17 -0
- package/dist/hooks/useKeyboardEvent.d.ts.map +1 -0
- package/dist/index.d.ts +830 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/main.cjs +1 -1
- package/dist/main.cjs.map +1 -1
- package/dist/main.css +10 -1
- package/dist/main.css.map +1 -1
- package/dist/module.css +10 -1
- package/dist/module.css.map +1 -1
- package/dist/module.mjs +1 -1
- package/dist/module.mjs.map +1 -1
- package/dist/stories/atoms/Colors/FoundationColors.stories.d.ts +7 -0
- package/dist/stories/atoms/Colors/FoundationColors.stories.d.ts.map +1 -0
- package/dist/stories/atoms/Colors/index.stories.d.ts +18 -0
- package/dist/stories/atoms/Colors/index.stories.d.ts.map +1 -0
- package/dist/stories/atoms/CornerRadius/index.stories.d.ts +7 -0
- package/dist/stories/atoms/CornerRadius/index.stories.d.ts.map +1 -0
- package/dist/stories/atoms/Spacing/index.stories.d.ts +7 -0
- package/dist/stories/atoms/Spacing/index.stories.d.ts.map +1 -0
- package/dist/stories/decorators/withEnableBodyScroll.d.ts +8 -0
- package/dist/stories/decorators/withEnableBodyScroll.d.ts.map +1 -0
- package/dist/stories/decorators/withInlineContainer.d.ts +15 -0
- package/dist/stories/decorators/withInlineContainer.d.ts.map +1 -0
- package/dist/stories/elements/Alert/Gallery.stories.d.ts +30 -0
- package/dist/stories/elements/Alert/Gallery.stories.d.ts.map +1 -0
- package/dist/stories/elements/Alert/index.stories.d.ts +30 -0
- package/dist/stories/elements/Alert/index.stories.d.ts.map +1 -0
- package/dist/stories/elements/AlertBanner/Gallery.stories.d.ts +33 -0
- package/dist/stories/elements/AlertBanner/Gallery.stories.d.ts.map +1 -0
- package/dist/stories/elements/AlertBanner/index.stories.d.ts +30 -0
- package/dist/stories/elements/AlertBanner/index.stories.d.ts.map +1 -0
- package/dist/stories/elements/Button/Gallery.stories.d.ts +10 -0
- package/dist/stories/elements/Button/Gallery.stories.d.ts.map +1 -0
- package/dist/stories/elements/Button/index.stories.d.ts +9 -0
- package/dist/stories/elements/Button/index.stories.d.ts.map +1 -0
- package/dist/stories/elements/Icon/index.stories.d.ts +14 -0
- package/dist/stories/elements/Icon/index.stories.d.ts.map +1 -0
- package/dist/stories/elements/IconButton/Gallery.stories.d.ts +10 -0
- package/dist/stories/elements/IconButton/Gallery.stories.d.ts.map +1 -0
- package/dist/stories/elements/IconButton/index.stories.d.ts +9 -0
- package/dist/stories/elements/IconButton/index.stories.d.ts.map +1 -0
- package/dist/stories/elements/Modal/ConfirmationDialog.source.d.ts +3 -0
- package/dist/stories/elements/Modal/ConfirmationDialog.source.d.ts.map +1 -0
- package/dist/stories/elements/Modal/ConfirmationDialog.stories.d.ts +43 -0
- package/dist/stories/elements/Modal/ConfirmationDialog.stories.d.ts.map +1 -0
- package/dist/stories/elements/Modal/ConfirmationDialogWithTrigger.stories.d.ts +42 -0
- package/dist/stories/elements/Modal/ConfirmationDialogWithTrigger.stories.d.ts.map +1 -0
- package/dist/stories/elements/Modal/MultiStepModal.stories.d.ts +46 -0
- package/dist/stories/elements/Modal/MultiStepModal.stories.d.ts.map +1 -0
- package/dist/stories/elements/Modal/index.stories.d.ts +32 -0
- package/dist/stories/elements/Modal/index.stories.d.ts.map +1 -0
- package/dist/stories/elements/Modal/multiStepArgs.d.ts +4 -0
- package/dist/stories/elements/Modal/multiStepArgs.d.ts.map +1 -0
- package/dist/stories/elements/Modal/singleStepArgs.d.ts +4 -0
- package/dist/stories/elements/Modal/singleStepArgs.d.ts.map +1 -0
- package/dist/stories/elements/Table/Manual.source.d.ts +3 -0
- package/dist/stories/elements/Table/Manual.source.d.ts.map +1 -0
- package/dist/stories/elements/Table/Manual.stories.d.ts +54 -0
- package/dist/stories/elements/Table/Manual.stories.d.ts.map +1 -0
- package/dist/stories/elements/Table/ManualColumnNesting.source.d.ts +3 -0
- package/dist/stories/elements/Table/ManualColumnNesting.source.d.ts.map +1 -0
- package/dist/stories/elements/Table/ManualColumnNesting.stories.d.ts +53 -0
- package/dist/stories/elements/Table/ManualColumnNesting.stories.d.ts.map +1 -0
- package/dist/stories/elements/Table/index.stories.d.ts +46 -0
- package/dist/stories/elements/Table/index.stories.d.ts.map +1 -0
- package/dist/stories/elements/Table/simpleArgs.d.ts +4 -0
- package/dist/stories/elements/Table/simpleArgs.d.ts.map +1 -0
- package/dist/stories/elements/Typography/TypographyGallery.stories.d.ts +29 -0
- package/dist/stories/elements/Typography/TypographyGallery.stories.d.ts.map +1 -0
- package/dist/stories/elements/Typography/index.stories.d.ts +28 -0
- package/dist/stories/elements/Typography/index.stories.d.ts.map +1 -0
- package/dist/stories/helper-components/ColorRenderer/index.d.ts +15 -0
- package/dist/stories/helper-components/ColorRenderer/index.d.ts.map +1 -0
- package/dist/stories/helper-components/DocPageWithPlayground.d.ts +12 -0
- package/dist/stories/helper-components/DocPageWithPlayground.d.ts.map +1 -0
- package/dist/stories/helper-components/TokenBlock/index.d.ts +21 -0
- package/dist/stories/helper-components/TokenBlock/index.d.ts.map +1 -0
- package/dist/stories/helper-components/TokenBlock/index.styles.d.ts +4 -0
- package/dist/stories/helper-components/TokenBlock/index.styles.d.ts.map +1 -0
- package/dist/stories/utils/index.d.ts +82 -0
- package/dist/stories/utils/index.d.ts.map +1 -0
- package/dist/ui/core/colors/colorTypes.d.ts +1 -0
- package/dist/ui/core/colors/colorTypes.d.ts.map +1 -0
- package/dist/ui/core/colors/index.d.ts +1 -0
- package/dist/ui/core/colors/index.d.ts.map +1 -0
- package/dist/ui/core/icons/iconTags.d.ts.map +1 -0
- package/dist/ui/core/icons/iconTypes.d.ts.map +1 -0
- package/dist/{core → ui/core}/icons/index.d.ts +1 -1
- package/dist/ui/core/icons/index.d.ts.map +1 -0
- package/dist/ui/core/index.d.ts +7 -0
- package/dist/ui/core/index.d.ts.map +1 -0
- package/dist/ui/core/miscellaneous-choices/index.d.ts.map +1 -0
- package/dist/ui/core/miscellaneous-choices/miscellaneousTypes.d.ts.map +1 -0
- package/dist/ui/core/sizes/index.d.ts.map +1 -0
- package/dist/ui/core/sizes/sizeTypes.d.ts +3 -0
- package/dist/ui/core/sizes/sizeTypes.d.ts.map +1 -0
- package/dist/ui/elements/Alert/Alert.d.ts +8 -0
- package/dist/ui/elements/Alert/Alert.d.ts.map +1 -0
- package/dist/ui/elements/Alert/Alert.styles.d.ts +7 -0
- package/dist/ui/elements/Alert/Alert.styles.d.ts.map +1 -0
- package/dist/ui/elements/Alert/Alert.test.d.ts +2 -0
- package/dist/ui/elements/Alert/Alert.test.d.ts.map +1 -0
- package/dist/ui/elements/Alert/constants.d.ts +140 -0
- package/dist/ui/elements/Alert/constants.d.ts.map +1 -0
- package/dist/ui/elements/Alert/index.d.ts +7 -0
- package/dist/ui/elements/Alert/index.d.ts.map +1 -0
- package/dist/ui/elements/Alert/types.d.ts +125 -0
- package/dist/ui/elements/Alert/types.d.ts.map +1 -0
- package/dist/ui/elements/Alert/utils.d.ts +1 -0
- package/dist/ui/elements/Alert/utils.d.ts.map +1 -0
- package/dist/ui/elements/AlertBanner/AlertBanner.d.ts +9 -0
- package/dist/ui/elements/AlertBanner/AlertBanner.d.ts.map +1 -0
- package/dist/ui/elements/AlertBanner/AlertBanner.styles.d.ts +4 -0
- package/dist/ui/elements/AlertBanner/AlertBanner.styles.d.ts.map +1 -0
- package/dist/ui/elements/AlertBanner/AlertBanner.test.d.ts +2 -0
- package/dist/ui/elements/AlertBanner/AlertBanner.test.d.ts.map +1 -0
- package/dist/ui/elements/AlertBanner/constants.d.ts +140 -0
- package/dist/ui/elements/AlertBanner/constants.d.ts.map +1 -0
- package/dist/ui/elements/AlertBanner/index.d.ts +7 -0
- package/dist/ui/elements/AlertBanner/index.d.ts.map +1 -0
- package/dist/ui/elements/AlertBanner/types.d.ts +111 -0
- package/dist/ui/elements/AlertBanner/types.d.ts.map +1 -0
- package/dist/ui/elements/AlertBanner/utils.d.ts +105 -0
- package/dist/ui/elements/AlertBanner/utils.d.ts.map +1 -0
- package/dist/ui/elements/Button/Button.d.ts +11 -0
- package/dist/ui/elements/Button/Button.d.ts.map +1 -0
- package/dist/ui/elements/Button/Button.styles.d.ts +4 -0
- package/dist/ui/elements/Button/Button.styles.d.ts.map +1 -0
- package/dist/ui/elements/Button/Button.test.d.ts +2 -0
- package/dist/ui/elements/Button/Button.test.d.ts.map +1 -0
- package/dist/ui/elements/Button/ButtonGroup.d.ts +11 -0
- package/dist/ui/elements/Button/ButtonGroup.d.ts.map +1 -0
- package/dist/ui/elements/Button/ButtonGroup.styles.d.ts +2 -0
- package/dist/ui/elements/Button/ButtonGroup.styles.d.ts.map +1 -0
- package/dist/ui/elements/Button/IconButton.d.ts +8 -0
- package/dist/ui/elements/Button/IconButton.d.ts.map +1 -0
- package/dist/ui/elements/Button/IconButton.test.d.ts +2 -0
- package/dist/ui/elements/Button/IconButton.test.d.ts.map +1 -0
- package/dist/ui/elements/Button/constants.d.ts +54 -0
- package/dist/ui/elements/Button/constants.d.ts.map +1 -0
- package/dist/ui/elements/Button/index.d.ts +9 -0
- package/dist/ui/elements/Button/index.d.ts.map +1 -0
- package/dist/ui/elements/Button/types.d.ts +226 -0
- package/dist/ui/elements/Button/types.d.ts.map +1 -0
- package/dist/ui/elements/Button/utils.d.ts +1 -0
- package/dist/ui/elements/Button/utils.d.ts.map +1 -0
- package/dist/ui/elements/Icon/Icon.d.ts +48 -0
- package/dist/ui/elements/Icon/Icon.d.ts.map +1 -0
- package/dist/ui/elements/Icon/Icon.styles.d.ts +5 -0
- package/dist/ui/elements/Icon/Icon.styles.d.ts.map +1 -0
- package/dist/ui/elements/Icon/index.d.ts +3 -0
- package/dist/ui/elements/Icon/index.d.ts.map +1 -0
- package/dist/ui/elements/Icon/types.d.ts +74 -0
- package/dist/ui/elements/Icon/types.d.ts.map +1 -0
- package/dist/ui/elements/Modal/ConfirmationDialog/index.d.ts +43 -0
- package/dist/ui/elements/Modal/ConfirmationDialog/index.d.ts.map +1 -0
- package/dist/ui/elements/Modal/ConfirmationDialog/index.test.d.ts +2 -0
- package/dist/ui/elements/Modal/ConfirmationDialog/index.test.d.ts.map +1 -0
- package/dist/ui/elements/Modal/Modal.d.ts +21 -0
- package/dist/ui/elements/Modal/Modal.d.ts.map +1 -0
- package/dist/ui/elements/Modal/Modal.styles.d.ts +18 -0
- package/dist/ui/elements/Modal/Modal.styles.d.ts.map +1 -0
- package/dist/ui/elements/Modal/Modal.test.d.ts +2 -0
- package/dist/ui/elements/Modal/Modal.test.d.ts.map +1 -0
- package/dist/ui/elements/Modal/MultiStepModal/index.d.ts +46 -0
- package/dist/ui/elements/Modal/MultiStepModal/index.d.ts.map +1 -0
- package/dist/ui/elements/Modal/MultiStepModal/index.test.d.ts +2 -0
- package/dist/ui/elements/Modal/MultiStepModal/index.test.d.ts.map +1 -0
- package/dist/ui/elements/Modal/constants.d.ts +1 -0
- package/dist/ui/elements/Modal/constants.d.ts.map +1 -0
- package/dist/ui/elements/Modal/index.d.ts +5 -0
- package/dist/ui/elements/Modal/index.d.ts.map +1 -0
- package/dist/ui/elements/Modal/types.d.ts +312 -0
- package/dist/ui/elements/Modal/types.d.ts.map +1 -0
- package/dist/ui/elements/Modal/utils.d.ts +1 -0
- package/dist/ui/elements/Modal/utils.d.ts.map +1 -0
- package/dist/ui/elements/Table/Table.d.ts +47 -0
- package/dist/ui/elements/Table/Table.d.ts.map +1 -0
- package/dist/ui/elements/Table/Table.styles.d.ts +8 -0
- package/dist/ui/elements/Table/Table.styles.d.ts.map +1 -0
- package/dist/ui/elements/Table/Table.test.d.ts +2 -0
- package/dist/ui/elements/Table/Table.test.d.ts.map +1 -0
- package/dist/ui/elements/Table/constants.d.ts +1 -0
- package/dist/ui/elements/Table/constants.d.ts.map +1 -0
- package/dist/ui/elements/Table/index.d.ts +3 -0
- package/dist/ui/elements/Table/index.d.ts.map +1 -0
- package/dist/ui/elements/Table/types.d.ts +223 -0
- package/dist/ui/elements/Table/types.d.ts.map +1 -0
- package/dist/ui/elements/Table/utils.d.ts +1 -0
- package/dist/ui/elements/Table/utils.d.ts.map +1 -0
- package/dist/ui/elements/Typography/Typography.d.ts +36 -0
- package/dist/ui/elements/Typography/Typography.d.ts.map +1 -0
- package/dist/ui/elements/Typography/Typography.styles.d.ts +6 -0
- package/dist/ui/elements/Typography/Typography.styles.d.ts.map +1 -0
- package/dist/ui/elements/Typography/constants.d.ts +22 -0
- package/dist/ui/elements/Typography/constants.d.ts.map +1 -0
- package/dist/ui/elements/Typography/index.d.ts +5 -0
- package/dist/ui/elements/Typography/index.d.ts.map +1 -0
- package/dist/ui/elements/Typography/types.d.ts +50 -0
- package/dist/ui/elements/Typography/types.d.ts.map +1 -0
- package/dist/ui/elements/Typography/utils.d.ts +2 -0
- package/dist/ui/elements/Typography/utils.d.ts.map +1 -0
- package/dist/ui/helpers/classNameBuilders.d.ts.map +1 -0
- package/dist/ui/helpers/index.d.ts +3 -0
- package/dist/ui/helpers/index.d.ts.map +1 -0
- package/dist/ui/index.d.ts +11 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/{init → ui/init}/GrauityInit.d.ts +15 -3
- package/dist/ui/init/GrauityInit.d.ts.map +1 -0
- package/dist/ui/init/index.d.ts.map +1 -0
- package/dist/ui/themes/GlobalStyle.d.ts +5 -0
- package/dist/ui/themes/GlobalStyle.d.ts.map +1 -0
- package/dist/ui/themes/ThemeContext.d.ts +24 -0
- package/dist/ui/themes/ThemeContext.d.ts.map +1 -0
- package/dist/ui/themes/constants.d.ts +6 -0
- package/dist/ui/themes/constants.d.ts.map +1 -0
- package/dist/ui/themes/darkThemeConstants.d.ts +70 -0
- package/dist/ui/themes/darkThemeConstants.d.ts.map +1 -0
- package/dist/ui/themes/lightThemeConstants.d.ts +70 -0
- package/dist/ui/themes/lightThemeConstants.d.ts.map +1 -0
- package/dist/ui/themes/tokens.d.ts +1 -0
- package/dist/ui/themes/tokens.d.ts.map +1 -0
- package/dist/ui/themes/types.d.ts +73 -0
- package/dist/ui/themes/types.d.ts.map +1 -0
- package/package.json +53 -28
- package/ui/core/colors/colorTypes.ts +2 -20
- package/ui/core/colors/index.ts +23 -23
- package/ui/core/icons/index.ts +1 -3
- package/ui/core/index.ts +7 -10
- package/ui/core/sizes/sizeTypes.ts +1 -0
- package/ui/css/fonts.scss +0 -8
- package/ui/css/index.scss +0 -8
- package/ui/css/reset.scss +2 -5
- package/ui/elements/Alert/Alert.styles.ts +66 -0
- package/ui/elements/Alert/Alert.test.tsx +81 -0
- package/ui/elements/Alert/Alert.tsx +153 -0
- package/ui/elements/Alert/constants.ts +169 -0
- package/ui/elements/Alert/index.ts +6 -0
- package/ui/elements/Alert/types.ts +150 -0
- package/ui/elements/AlertBanner/AlertBanner.styles.ts +35 -0
- package/ui/elements/AlertBanner/AlertBanner.test.tsx +70 -0
- package/ui/elements/AlertBanner/AlertBanner.tsx +137 -0
- package/ui/elements/AlertBanner/constants.ts +179 -0
- package/ui/elements/AlertBanner/index.ts +6 -0
- package/ui/elements/AlertBanner/types.ts +133 -0
- package/ui/elements/AlertBanner/utils.ts +52 -0
- package/ui/elements/Button/Button.styles.ts +88 -0
- package/ui/elements/Button/Button.test.tsx +78 -0
- package/ui/elements/Button/Button.tsx +134 -0
- package/ui/elements/Button/ButtonGroup.styles.ts +7 -0
- package/ui/elements/Button/ButtonGroup.tsx +21 -0
- package/ui/elements/Button/IconButton.test.tsx +39 -0
- package/ui/elements/Button/IconButton.tsx +118 -0
- package/ui/elements/Button/constants.ts +304 -0
- package/ui/elements/Button/index.ts +8 -0
- package/ui/elements/Button/types.ts +282 -0
- package/ui/elements/Button/utils.ts +0 -0
- package/ui/elements/Icon/Icon.styles.ts +98 -0
- package/ui/elements/Icon/Icon.tsx +17 -107
- package/ui/elements/Icon/index.ts +1 -2
- package/ui/elements/Icon/types.ts +96 -0
- package/ui/elements/Modal/ConfirmationDialog/index.test.tsx +116 -0
- package/ui/elements/Modal/ConfirmationDialog/index.tsx +151 -0
- package/ui/elements/Modal/Modal.styles.ts +230 -0
- package/ui/elements/Modal/Modal.test.tsx +117 -0
- package/ui/elements/Modal/Modal.tsx +179 -0
- package/ui/elements/Modal/MultiStepModal/index.test.tsx +116 -0
- package/ui/elements/Modal/MultiStepModal/index.tsx +184 -0
- package/ui/elements/Modal/constants.ts +0 -0
- package/ui/elements/Modal/index.ts +4 -0
- package/ui/elements/Modal/types.ts +379 -0
- package/ui/elements/Modal/utils.tsx +0 -0
- package/ui/elements/Table/Table.styles.ts +178 -0
- package/ui/elements/Table/Table.test.tsx +72 -0
- package/ui/elements/Table/Table.tsx +118 -0
- package/ui/elements/Table/constants.ts +0 -0
- package/ui/elements/Table/index.ts +2 -0
- package/ui/elements/Table/types.ts +270 -0
- package/ui/elements/Table/utils.ts +0 -0
- package/ui/elements/Typography/Typography.styles.ts +29 -0
- package/ui/elements/Typography/Typography.tsx +70 -0
- package/ui/elements/Typography/constants.ts +292 -0
- package/ui/elements/Typography/index.ts +9 -0
- package/ui/elements/Typography/types.ts +116 -0
- package/ui/elements/Typography/utils.ts +11 -0
- package/ui/fonts/grauity-icons.eot +0 -0
- package/ui/fonts/grauity-icons.ttf +0 -0
- package/ui/fonts/grauity-icons.woff +0 -0
- package/ui/fonts/grauity-icons.woff2 +0 -0
- package/ui/helpers/index.ts +1 -7
- package/ui/index.ts +42 -3
- package/ui/init/GrauityInit.tsx +30 -7
- package/ui/init/index.ts +0 -1
- package/ui/themes/GlobalStyle.ts +273 -0
- package/ui/themes/ThemeContext.tsx +140 -0
- package/ui/themes/constants.ts +8 -0
- package/ui/themes/darkThemeConstants.ts +73 -0
- package/ui/themes/lightThemeConstants.ts +73 -0
- package/ui/themes/tokens.ts +0 -0
- package/ui/themes/types.ts +77 -0
- package/dist/core/colors/colorTypes.d.ts +0 -3
- package/dist/core/colors/colorTypes.d.ts.map +0 -1
- package/dist/core/colors/index.d.ts +0 -14
- package/dist/core/colors/index.d.ts.map +0 -1
- package/dist/core/icons/iconTags.d.ts.map +0 -1
- package/dist/core/icons/iconTypes.d.ts.map +0 -1
- package/dist/core/icons/index.d.ts.map +0 -1
- package/dist/core/index.d.ts +0 -9
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/miscellaneous-choices/index.d.ts.map +0 -1
- package/dist/core/miscellaneous-choices/miscellaneousTypes.d.ts.map +0 -1
- package/dist/core/sizes/index.d.ts.map +0 -1
- package/dist/core/sizes/sizeTypes.d.ts +0 -3
- package/dist/core/sizes/sizeTypes.d.ts.map +0 -1
- package/dist/elements/Icon/Icon.d.ts +0 -115
- package/dist/elements/Icon/Icon.d.ts.map +0 -1
- package/dist/elements/Icon/index.d.ts +0 -3
- package/dist/elements/Icon/index.d.ts.map +0 -1
- package/dist/elements/index.d.ts +0 -3
- package/dist/elements/index.d.ts.map +0 -1
- package/dist/helpers/classNameBuilders.d.ts.map +0 -1
- package/dist/helpers/getElementTypeFromProps.d.ts +0 -14
- package/dist/helpers/getElementTypeFromProps.d.ts.map +0 -1
- package/dist/helpers/index.d.ts +0 -4
- package/dist/helpers/index.d.ts.map +0 -1
- package/dist/init/GrauityInit.d.ts.map +0 -1
- package/dist/init/index.d.ts.map +0 -1
- package/ui/css/colors.scss +0 -131
- package/ui/css/icons.scss +0 -92
- package/ui/elements/index.ts +0 -2
- package/ui/helpers/getElementTypeFromProps.ts +0 -32
- /package/dist/{core → ui/core}/icons/iconTags.d.ts +0 -0
- /package/dist/{core → ui/core}/icons/iconTypes.d.ts +0 -0
- /package/dist/{core → ui/core}/miscellaneous-choices/index.d.ts +0 -0
- /package/dist/{core → ui/core}/miscellaneous-choices/miscellaneousTypes.d.ts +0 -0
- /package/dist/{core → ui/core}/sizes/index.d.ts +0 -0
- /package/dist/{helpers → ui/helpers}/classNameBuilders.d.ts +0 -0
- /package/dist/{init → ui/init}/index.d.ts +0 -0
- /package/ui/{css/sizes.scss → elements/Alert/utils.ts} +0 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React, { forwardRef, useId, useImperativeHandle, useRef } from 'react';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
useClickAway,
|
|
6
|
+
useDisableBodyScroll,
|
|
7
|
+
useKeyboardEvent,
|
|
8
|
+
} from '../../../hooks';
|
|
9
|
+
import { IconButton } from '../Button';
|
|
10
|
+
import {
|
|
11
|
+
StyledModal,
|
|
12
|
+
StyledModalAction,
|
|
13
|
+
StyledModalBanner,
|
|
14
|
+
StyledModalBody,
|
|
15
|
+
StyledModalDescription,
|
|
16
|
+
StyledModalDivider,
|
|
17
|
+
StyledModalMain,
|
|
18
|
+
StyledModalTitle,
|
|
19
|
+
StyledModalWrapper,
|
|
20
|
+
} from './Modal.styles';
|
|
21
|
+
import { ModalProps } from './types';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* A modal is used to display content that temporarily blocks
|
|
25
|
+
* interactions with the main view of a site or to get user attention
|
|
26
|
+
* on a specific action or information.
|
|
27
|
+
*/
|
|
28
|
+
const Modal = forwardRef<HTMLDivElement, ModalProps>((props, ref) => {
|
|
29
|
+
const {
|
|
30
|
+
banner,
|
|
31
|
+
title,
|
|
32
|
+
description,
|
|
33
|
+
body,
|
|
34
|
+
action,
|
|
35
|
+
width,
|
|
36
|
+
height,
|
|
37
|
+
minHeight,
|
|
38
|
+
onHide,
|
|
39
|
+
mobileBottomFullWidth,
|
|
40
|
+
modalPadding,
|
|
41
|
+
modalBodyMargin,
|
|
42
|
+
showCloseButton,
|
|
43
|
+
hideOnClickAway,
|
|
44
|
+
blurBackground,
|
|
45
|
+
} = props;
|
|
46
|
+
const modalRef = useRef<HTMLDivElement>(null);
|
|
47
|
+
|
|
48
|
+
useImperativeHandle(ref, () => modalRef.current);
|
|
49
|
+
|
|
50
|
+
useDisableBodyScroll();
|
|
51
|
+
|
|
52
|
+
useKeyboardEvent(() => {
|
|
53
|
+
if (hideOnClickAway) {
|
|
54
|
+
onHide();
|
|
55
|
+
}
|
|
56
|
+
}, ['Escape']);
|
|
57
|
+
|
|
58
|
+
useClickAway(modalRef, () => {
|
|
59
|
+
if (hideOnClickAway) {
|
|
60
|
+
onHide();
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const id = useId();
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<StyledModalWrapper blurBackground={blurBackground} data-testid="testid-modalwrapper">
|
|
68
|
+
<StyledModal
|
|
69
|
+
onClick={(e: Event) => e.stopPropagation()}
|
|
70
|
+
ref={modalRef}
|
|
71
|
+
width={width}
|
|
72
|
+
height={height}
|
|
73
|
+
minHeight={minHeight}
|
|
74
|
+
mobileBottomFullWidth={mobileBottomFullWidth}
|
|
75
|
+
modalPadding={modalPadding}
|
|
76
|
+
aria-labelledby={`modal-title-${id}`}
|
|
77
|
+
aria-describedby={`modal-description-${id}`}
|
|
78
|
+
aria-modal="true"
|
|
79
|
+
role="dialog"
|
|
80
|
+
data-testid="testid-modal"
|
|
81
|
+
>
|
|
82
|
+
<StyledModalMain>
|
|
83
|
+
{showCloseButton && (
|
|
84
|
+
<StyledModalAction justifyContent="end">
|
|
85
|
+
<IconButton
|
|
86
|
+
onClick={onHide}
|
|
87
|
+
variant="secondary-outlined"
|
|
88
|
+
icon="close"
|
|
89
|
+
ariaLabel="Close"
|
|
90
|
+
/>
|
|
91
|
+
</StyledModalAction>
|
|
92
|
+
)}
|
|
93
|
+
|
|
94
|
+
{banner && <StyledModalBanner>{banner}</StyledModalBanner>}
|
|
95
|
+
|
|
96
|
+
{title && (
|
|
97
|
+
<StyledModalTitle id={`modal-title-${id}`}>
|
|
98
|
+
{title}
|
|
99
|
+
</StyledModalTitle>
|
|
100
|
+
)}
|
|
101
|
+
|
|
102
|
+
{description && (
|
|
103
|
+
<StyledModalDescription id={`modal-description-${id}`}>
|
|
104
|
+
{description}
|
|
105
|
+
</StyledModalDescription>
|
|
106
|
+
)}
|
|
107
|
+
|
|
108
|
+
{body && (
|
|
109
|
+
<StyledModalBody modalBodyMargin={modalBodyMargin}>
|
|
110
|
+
{body}
|
|
111
|
+
</StyledModalBody>
|
|
112
|
+
)}
|
|
113
|
+
</StyledModalMain>
|
|
114
|
+
|
|
115
|
+
{action && <StyledModalAction>{action}</StyledModalAction>}
|
|
116
|
+
</StyledModal>
|
|
117
|
+
</StyledModalWrapper>
|
|
118
|
+
);
|
|
119
|
+
}) as React.ForwardRefExoticComponent<
|
|
120
|
+
ModalProps & React.RefAttributes<HTMLDivElement>
|
|
121
|
+
> & {
|
|
122
|
+
Wrapper: typeof StyledModalWrapper;
|
|
123
|
+
Modal: typeof StyledModal;
|
|
124
|
+
Main: typeof StyledModalMain;
|
|
125
|
+
Banner: typeof StyledModalBanner;
|
|
126
|
+
Title: typeof StyledModalTitle;
|
|
127
|
+
Description: typeof StyledModalDescription;
|
|
128
|
+
Body: typeof StyledModalBody;
|
|
129
|
+
Action: typeof StyledModalAction;
|
|
130
|
+
Divider: typeof StyledModalDivider;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
Modal.propTypes = {
|
|
134
|
+
banner: PropTypes.string || PropTypes.node,
|
|
135
|
+
title: PropTypes.string || PropTypes.node,
|
|
136
|
+
description: PropTypes.string,
|
|
137
|
+
body: PropTypes.string || PropTypes.node,
|
|
138
|
+
action: PropTypes.string || PropTypes.node,
|
|
139
|
+
hideOnClickAway: PropTypes.bool,
|
|
140
|
+
blurBackground: PropTypes.bool,
|
|
141
|
+
onHide: PropTypes.func,
|
|
142
|
+
mobileBottomFullWidth: PropTypes.bool,
|
|
143
|
+
modalPadding: PropTypes.string,
|
|
144
|
+
modalBodyMargin: PropTypes.string,
|
|
145
|
+
width: PropTypes.string,
|
|
146
|
+
height: PropTypes.string,
|
|
147
|
+
minHeight: PropTypes.string,
|
|
148
|
+
showCloseButton: PropTypes.bool,
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
Modal.defaultProps = {
|
|
152
|
+
banner: null,
|
|
153
|
+
title: null,
|
|
154
|
+
description: null,
|
|
155
|
+
body: null,
|
|
156
|
+
action: null,
|
|
157
|
+
hideOnClickAway: false,
|
|
158
|
+
blurBackground: false,
|
|
159
|
+
onHide: () => {},
|
|
160
|
+
mobileBottomFullWidth: false,
|
|
161
|
+
modalPadding: '20px',
|
|
162
|
+
modalBodyMargin: null,
|
|
163
|
+
width: null,
|
|
164
|
+
height: null,
|
|
165
|
+
minHeight: null,
|
|
166
|
+
showCloseButton: false,
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
Modal.Wrapper = StyledModalWrapper;
|
|
170
|
+
Modal.Modal = StyledModal;
|
|
171
|
+
Modal.Main = StyledModalMain;
|
|
172
|
+
Modal.Banner = StyledModalBanner;
|
|
173
|
+
Modal.Title = StyledModalTitle;
|
|
174
|
+
Modal.Description = StyledModalDescription;
|
|
175
|
+
Modal.Body = StyledModalBody;
|
|
176
|
+
Modal.Action = StyledModalAction;
|
|
177
|
+
Modal.Divider = StyledModalDivider;
|
|
178
|
+
|
|
179
|
+
export default Modal;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
2
|
+
|
|
3
|
+
import { fireEvent, render, screen } from '@testing-library/react';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
import { MultiStepModalProps } from '../types';
|
|
7
|
+
import MultiStepModal from '.';
|
|
8
|
+
|
|
9
|
+
describe('MultiStepModal', () => {
|
|
10
|
+
const defaultProps: MultiStepModalProps = {
|
|
11
|
+
modalSteps: [
|
|
12
|
+
{
|
|
13
|
+
banner: (
|
|
14
|
+
<img
|
|
15
|
+
src="https://via.placeholder.com/300x100"
|
|
16
|
+
alt="Banner"
|
|
17
|
+
/>
|
|
18
|
+
),
|
|
19
|
+
title: 'Step 1',
|
|
20
|
+
description: 'Description for step 1',
|
|
21
|
+
body: 'Body for step 1',
|
|
22
|
+
nextButtonText: 'Next',
|
|
23
|
+
showBackButton: false,
|
|
24
|
+
buttonVariant: 'primary',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
banner: 'Banner 2',
|
|
28
|
+
title: 'Step 2',
|
|
29
|
+
description: 'Description for step 2',
|
|
30
|
+
body: <div>Body for step 2</div>,
|
|
31
|
+
nextButtonText: 'Finish',
|
|
32
|
+
showBackButton: true,
|
|
33
|
+
buttonVariant: 'secondary',
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
hideOnClickAway: false,
|
|
37
|
+
blurBackground: false,
|
|
38
|
+
onHide: jest.fn(),
|
|
39
|
+
onFinalStep: jest.fn(),
|
|
40
|
+
mobileBottomFullWidth: false,
|
|
41
|
+
onStepChange: jest.fn(),
|
|
42
|
+
showModalStepsPagination: true,
|
|
43
|
+
modalPadding: '20px',
|
|
44
|
+
modalBodyMargin: '12px 0 0 0',
|
|
45
|
+
width: '500px',
|
|
46
|
+
height: 'auto',
|
|
47
|
+
minHeight: 'auto',
|
|
48
|
+
showCloseButton: true,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
it('renders the first step correctly', () => {
|
|
52
|
+
render(<MultiStepModal {...defaultProps} />);
|
|
53
|
+
expect(screen.getByText('Step 1')).toBeInTheDocument();
|
|
54
|
+
expect(screen.getByText('Description for step 1')).toBeInTheDocument();
|
|
55
|
+
expect(screen.getByAltText('Banner')).toBeInTheDocument();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('navigates to the next step when the next button is clicked', () => {
|
|
59
|
+
render(<MultiStepModal {...defaultProps} />);
|
|
60
|
+
fireEvent.click(screen.getByText('Next'));
|
|
61
|
+
expect(screen.getByText('Step 2')).toBeInTheDocument();
|
|
62
|
+
expect(screen.getByText('Description for step 2')).toBeInTheDocument();
|
|
63
|
+
expect(screen.getByText('Body for step 2')).toBeInTheDocument();
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('navigates to the previous step when the back button is clicked', () => {
|
|
67
|
+
render(<MultiStepModal {...defaultProps} />);
|
|
68
|
+
fireEvent.click(screen.getByText('Next'));
|
|
69
|
+
fireEvent.click(screen.getByText('Back'));
|
|
70
|
+
expect(screen.getByText('Step 1')).toBeInTheDocument();
|
|
71
|
+
expect(screen.getByText('Description for step 1')).toBeInTheDocument();
|
|
72
|
+
expect(screen.getByAltText('Banner')).toBeInTheDocument();
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('calls onStepChange when the step changes', () => {
|
|
76
|
+
const onStepChange = jest.fn();
|
|
77
|
+
render(<MultiStepModal {...defaultProps} onStepChange={onStepChange} />);
|
|
78
|
+
fireEvent.click(screen.getByText('Next'));
|
|
79
|
+
expect(onStepChange).toHaveBeenCalledTimes(1);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('calls onFinalStep and onHide when the final step button is clicked', () => {
|
|
83
|
+
const onFinalStep = jest.fn();
|
|
84
|
+
const onHide = jest.fn();
|
|
85
|
+
render(
|
|
86
|
+
<MultiStepModal
|
|
87
|
+
{...defaultProps}
|
|
88
|
+
onFinalStep={onFinalStep}
|
|
89
|
+
onHide={onHide}
|
|
90
|
+
/>
|
|
91
|
+
);
|
|
92
|
+
fireEvent.click(screen.getByText('Next'));
|
|
93
|
+
fireEvent.click(screen.getByText('Finish'));
|
|
94
|
+
expect(onFinalStep).toHaveBeenCalledTimes(1);
|
|
95
|
+
expect(onHide).toHaveBeenCalledTimes(1);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it('renders the close button when stated', () => {
|
|
99
|
+
render(<MultiStepModal {...defaultProps} showCloseButton />);
|
|
100
|
+
expect(screen.getByTestId('testid-iconbutton')).toBeInTheDocument();
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('renders the close button and calls onHide when clicked', () => {
|
|
104
|
+
const onHide = jest.fn();
|
|
105
|
+
render(<MultiStepModal {...defaultProps} showCloseButton onHide={onHide} />);
|
|
106
|
+
fireEvent.click(screen.getByTestId('testid-iconbutton'));
|
|
107
|
+
expect(onHide).toHaveBeenCalledTimes(1);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it('does not render the close button when showCloseButton is false', () => {
|
|
111
|
+
render(<MultiStepModal {...defaultProps} showCloseButton={false} />);
|
|
112
|
+
expect(
|
|
113
|
+
screen.queryByTestId('testid-iconbutton')
|
|
114
|
+
).not.toBeInTheDocument();
|
|
115
|
+
});
|
|
116
|
+
});
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
3
|
+
|
|
4
|
+
import useClickAway from '../../../../hooks/useClickAway';
|
|
5
|
+
import useDisableBodyScroll from '../../../../hooks/useDisableBodyScroll';
|
|
6
|
+
import Button from '../../Button';
|
|
7
|
+
import Modal from '../Modal';
|
|
8
|
+
import {
|
|
9
|
+
StyledModalPaginatedActions,
|
|
10
|
+
StyledModalPagination,
|
|
11
|
+
StyledModalPaginationItem,
|
|
12
|
+
} from '../Modal.styles';
|
|
13
|
+
import { MultiStepModalProps } from '../types';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A multi-step modal is a modal that has multiple steps.
|
|
17
|
+
*/
|
|
18
|
+
const MultiStepModal = ({
|
|
19
|
+
modalSteps,
|
|
20
|
+
showModalStepsPagination,
|
|
21
|
+
hideOnClickAway,
|
|
22
|
+
blurBackground,
|
|
23
|
+
onHide,
|
|
24
|
+
onFinalStep,
|
|
25
|
+
mobileBottomFullWidth,
|
|
26
|
+
onStepChange,
|
|
27
|
+
modalPadding,
|
|
28
|
+
modalBodyMargin,
|
|
29
|
+
width,
|
|
30
|
+
height,
|
|
31
|
+
minHeight,
|
|
32
|
+
showCloseButton,
|
|
33
|
+
}: MultiStepModalProps) => {
|
|
34
|
+
const [currentStep, setCurrentStep] = useState(0);
|
|
35
|
+
const hasMounted = useRef(false);
|
|
36
|
+
const modalRef = useRef(null);
|
|
37
|
+
|
|
38
|
+
const {
|
|
39
|
+
banner,
|
|
40
|
+
title,
|
|
41
|
+
description,
|
|
42
|
+
body,
|
|
43
|
+
nextButtonText,
|
|
44
|
+
showBackButton,
|
|
45
|
+
buttonVariant,
|
|
46
|
+
} = modalSteps[currentStep] || {};
|
|
47
|
+
|
|
48
|
+
const isLastStep = currentStep === modalSteps.length - 1;
|
|
49
|
+
const isFirstStep = currentStep === 0;
|
|
50
|
+
|
|
51
|
+
useDisableBodyScroll();
|
|
52
|
+
|
|
53
|
+
useClickAway(modalRef, () => {
|
|
54
|
+
if (hideOnClickAway) {
|
|
55
|
+
onHide();
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
if (
|
|
61
|
+
hasMounted.current &&
|
|
62
|
+
onStepChange &&
|
|
63
|
+
typeof onStepChange === 'function'
|
|
64
|
+
) {
|
|
65
|
+
onStepChange();
|
|
66
|
+
} else {
|
|
67
|
+
hasMounted.current = true;
|
|
68
|
+
}
|
|
69
|
+
}, [currentStep]);
|
|
70
|
+
|
|
71
|
+
if (modalSteps.length === 0) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<Modal
|
|
77
|
+
banner={banner}
|
|
78
|
+
title={title}
|
|
79
|
+
description={description}
|
|
80
|
+
body={body}
|
|
81
|
+
hideOnClickAway={hideOnClickAway}
|
|
82
|
+
blurBackground={blurBackground}
|
|
83
|
+
onHide={onHide}
|
|
84
|
+
mobileBottomFullWidth={mobileBottomFullWidth}
|
|
85
|
+
modalPadding={modalPadding}
|
|
86
|
+
modalBodyMargin={modalBodyMargin}
|
|
87
|
+
width={width}
|
|
88
|
+
height={height}
|
|
89
|
+
minHeight={minHeight}
|
|
90
|
+
showCloseButton={showCloseButton}
|
|
91
|
+
action={
|
|
92
|
+
<StyledModalPaginatedActions>
|
|
93
|
+
{showModalStepsPagination && modalSteps.length > 1 && (
|
|
94
|
+
<StyledModalPagination>
|
|
95
|
+
{modalSteps.map((item, index) => (
|
|
96
|
+
<StyledModalPaginationItem
|
|
97
|
+
key={`modal-pagination-item-${index + 1}`}
|
|
98
|
+
active={index === currentStep}
|
|
99
|
+
onClick={() => setCurrentStep(index)}
|
|
100
|
+
/>
|
|
101
|
+
))}
|
|
102
|
+
</StyledModalPagination>
|
|
103
|
+
)}
|
|
104
|
+
|
|
105
|
+
<Modal.Action>
|
|
106
|
+
{showBackButton && !isFirstStep && (
|
|
107
|
+
<Button
|
|
108
|
+
variant="secondary-outlined"
|
|
109
|
+
onClick={() => {
|
|
110
|
+
setCurrentStep(currentStep - 1);
|
|
111
|
+
}}
|
|
112
|
+
icon="arrow-right"
|
|
113
|
+
iconPosition="left"
|
|
114
|
+
>
|
|
115
|
+
Back
|
|
116
|
+
</Button>
|
|
117
|
+
)}
|
|
118
|
+
|
|
119
|
+
{nextButtonText && (
|
|
120
|
+
<Button
|
|
121
|
+
variant={buttonVariant || 'secondary'}
|
|
122
|
+
fullWidth
|
|
123
|
+
onClick={() => {
|
|
124
|
+
if (isLastStep) {
|
|
125
|
+
onFinalStep();
|
|
126
|
+
onHide();
|
|
127
|
+
} else {
|
|
128
|
+
setCurrentStep(currentStep + 1);
|
|
129
|
+
}
|
|
130
|
+
}}
|
|
131
|
+
icon={isLastStep ? null : 'arrow-left'}
|
|
132
|
+
iconPosition="right"
|
|
133
|
+
>
|
|
134
|
+
{nextButtonText}
|
|
135
|
+
</Button>
|
|
136
|
+
)}
|
|
137
|
+
</Modal.Action>
|
|
138
|
+
</StyledModalPaginatedActions>
|
|
139
|
+
}
|
|
140
|
+
/>
|
|
141
|
+
);
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
MultiStepModal.propTypes = {
|
|
145
|
+
modalSteps: PropTypes.array,
|
|
146
|
+
showModalStepsPagination: PropTypes.bool,
|
|
147
|
+
hideOnClickAway: PropTypes.bool,
|
|
148
|
+
blurBackground: PropTypes.bool,
|
|
149
|
+
onHide: PropTypes.func,
|
|
150
|
+
onFinalStep: PropTypes.func,
|
|
151
|
+
mobileBottomFullWidth: PropTypes.bool,
|
|
152
|
+
onStepChange: PropTypes.func,
|
|
153
|
+
modalPadding: PropTypes.string,
|
|
154
|
+
modalBodyMargin: PropTypes.string,
|
|
155
|
+
width: PropTypes.string,
|
|
156
|
+
height: PropTypes.string,
|
|
157
|
+
minHeight: PropTypes.string,
|
|
158
|
+
showCloseButton: PropTypes.bool,
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
MultiStepModal.defaultProps = {
|
|
162
|
+
modalSteps: [],
|
|
163
|
+
showModalStepsPagination: true,
|
|
164
|
+
hideOnClickAway: false,
|
|
165
|
+
blurBackground: false,
|
|
166
|
+
onHide: () => {},
|
|
167
|
+
onFinalStep: () => {},
|
|
168
|
+
mobileBottomFullWidth: false,
|
|
169
|
+
onStepChange: () => {},
|
|
170
|
+
modalPadding: '20px',
|
|
171
|
+
modalBodyMargin: '12px 0 0 0',
|
|
172
|
+
width: null,
|
|
173
|
+
height: null,
|
|
174
|
+
minHeight: null,
|
|
175
|
+
showCloseButton: false,
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
MultiStepModal.PaginatedActions = StyledModalPaginatedActions;
|
|
179
|
+
MultiStepModal.Pagination = StyledModalPagination;
|
|
180
|
+
MultiStepModal.PaginationItem = StyledModalPaginationItem;
|
|
181
|
+
|
|
182
|
+
export { MultiStepModalProps };
|
|
183
|
+
|
|
184
|
+
export default MultiStepModal;
|
|
File without changes
|