@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,379 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { ButtonVariants } from '../Button/types';
|
|
4
|
+
|
|
5
|
+
type ModalContentType = React.ReactNode;
|
|
6
|
+
|
|
7
|
+
interface ModalStep {
|
|
8
|
+
/**
|
|
9
|
+
* Banner for the modal, can be a valid React node
|
|
10
|
+
* */
|
|
11
|
+
banner?: ModalContentType;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Title for the modal, can be a valid React node
|
|
15
|
+
* */
|
|
16
|
+
title: ModalContentType;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Description for the modal, can be a string
|
|
20
|
+
* */
|
|
21
|
+
description?: string | null;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Body for the modal, can be a valid React node
|
|
25
|
+
* */
|
|
26
|
+
body?: ModalContentType;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Text for the next button
|
|
30
|
+
* */
|
|
31
|
+
nextButtonText?: string;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Determines if the back button should be shown
|
|
35
|
+
* Available choices: `true`, `false`
|
|
36
|
+
*
|
|
37
|
+
* Default: `false`
|
|
38
|
+
* */
|
|
39
|
+
showBackButton?: boolean;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Variant for the button
|
|
43
|
+
* */
|
|
44
|
+
buttonVariant?: ButtonVariants | null;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface ModalProps {
|
|
48
|
+
/**
|
|
49
|
+
* Banner for the modal, can be a valid React node
|
|
50
|
+
* */
|
|
51
|
+
banner?: ModalContentType;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Title for the modal, can be a valid React node
|
|
55
|
+
* */
|
|
56
|
+
title?: ModalContentType;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Description for the modal, can be a string
|
|
60
|
+
* */
|
|
61
|
+
description?: string;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Body for the modal, can be a valid React node
|
|
65
|
+
* */
|
|
66
|
+
body?: ModalContentType;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Action for the modal, can be a valid React node
|
|
70
|
+
* */
|
|
71
|
+
action?: ModalContentType;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Determines if the modal should hide on click away
|
|
75
|
+
* Available choices: `true`, `false`
|
|
76
|
+
*
|
|
77
|
+
* Default: `false`
|
|
78
|
+
* */
|
|
79
|
+
hideOnClickAway: boolean;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Determines if the modal should blur the background
|
|
83
|
+
* Available choices: `true`, `false`
|
|
84
|
+
*
|
|
85
|
+
* Default: `false`
|
|
86
|
+
* */
|
|
87
|
+
blurBackground?: boolean;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Callback function to be called when the modal is hidden
|
|
91
|
+
* */
|
|
92
|
+
onHide?: () => void;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Determines if the modal should be full width on mobile
|
|
96
|
+
* Available choices: `true`, `false`
|
|
97
|
+
*
|
|
98
|
+
* Default: `false`
|
|
99
|
+
* */
|
|
100
|
+
mobileBottomFullWidth?: boolean;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Padding for the modal
|
|
104
|
+
* */
|
|
105
|
+
modalPadding?: string;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Margin for the modal body
|
|
109
|
+
* */
|
|
110
|
+
modalBodyMargin?: string;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Width of the modal
|
|
114
|
+
* */
|
|
115
|
+
width?: string;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Height of the modal
|
|
119
|
+
* */
|
|
120
|
+
height?: string;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Minimum height of the modal
|
|
124
|
+
* */
|
|
125
|
+
minHeight?: string;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Determines if the close button should be shown
|
|
129
|
+
*
|
|
130
|
+
* Available choices: `true`, `false`
|
|
131
|
+
*
|
|
132
|
+
* Default: `false`
|
|
133
|
+
* */
|
|
134
|
+
showCloseButton?: boolean;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export interface MultiStepModalProps {
|
|
138
|
+
/**
|
|
139
|
+
* Modal steps
|
|
140
|
+
* */
|
|
141
|
+
modalSteps: ModalStep[];
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Determines if the modal should show pagination if there are multiple modal steps
|
|
145
|
+
* Available choices: true, false
|
|
146
|
+
*
|
|
147
|
+
* Default: `true`
|
|
148
|
+
* */
|
|
149
|
+
showModalStepsPagination?: boolean;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Determines if the modal should hide on click away
|
|
153
|
+
* Available choices: true, false
|
|
154
|
+
*
|
|
155
|
+
* Default: `false`
|
|
156
|
+
* */
|
|
157
|
+
hideOnClickAway?: boolean;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Determines if the modal should blur the background
|
|
161
|
+
* Available choices: true, false
|
|
162
|
+
*
|
|
163
|
+
* Default: `false`
|
|
164
|
+
* */
|
|
165
|
+
blurBackground?: boolean;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Callback function to be called when the modal is hidden
|
|
169
|
+
* */
|
|
170
|
+
onHide?: () => void;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Callback function to be called when the final step is reached
|
|
174
|
+
* */
|
|
175
|
+
onFinalStep?: () => void;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Determines if the modal should be full width on mobile
|
|
179
|
+
* Available choices: true, false
|
|
180
|
+
*
|
|
181
|
+
* Default: `false`
|
|
182
|
+
* */
|
|
183
|
+
mobileBottomFullWidth?: boolean;
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Callback function to be called when the step changes
|
|
187
|
+
* */
|
|
188
|
+
onStepChange?: () => void;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Determines if the modal buttons should be shown
|
|
192
|
+
* Available choices: true, false
|
|
193
|
+
*
|
|
194
|
+
* Default: `true`
|
|
195
|
+
* */
|
|
196
|
+
showModalButtons?: boolean;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Determines if the modal header should be shown
|
|
200
|
+
* Available choices: true, false
|
|
201
|
+
*
|
|
202
|
+
* Default: `true`
|
|
203
|
+
* */
|
|
204
|
+
showHeader?: boolean;
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Padding for the modal
|
|
208
|
+
* */
|
|
209
|
+
modalPadding?: string;
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Margin for the modal body
|
|
213
|
+
* */
|
|
214
|
+
modalBodyMargin?: string;
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Width of the modal
|
|
218
|
+
* */
|
|
219
|
+
width?: string;
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Height of the modal
|
|
223
|
+
* */
|
|
224
|
+
height?: string;
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Minimum height of the modal
|
|
228
|
+
* */
|
|
229
|
+
minHeight?: string;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Determines if the close button should be shown
|
|
233
|
+
*
|
|
234
|
+
* Available choices: true, false
|
|
235
|
+
*
|
|
236
|
+
* NOTE: If Modal has a banner, the close button will be hidden by default
|
|
237
|
+
*
|
|
238
|
+
* Default: `false`
|
|
239
|
+
* */
|
|
240
|
+
showCloseButton?: boolean;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export interface StyleData {
|
|
244
|
+
position?: string;
|
|
245
|
+
backgroundColor?: string;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// Components interface for ModalWrapper
|
|
249
|
+
export interface ModalWrapperProps {
|
|
250
|
+
blurBackground?: boolean;
|
|
251
|
+
children: React.ReactNode;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// Components interface for ModalContainer
|
|
255
|
+
export interface ModalContainerProps {
|
|
256
|
+
width?: string;
|
|
257
|
+
height?: string;
|
|
258
|
+
minHeight?: string;
|
|
259
|
+
mobileBottomFullWidth?: boolean;
|
|
260
|
+
modalPadding?: string;
|
|
261
|
+
onClick?: (e: Event) => void;
|
|
262
|
+
ref?: React.MutableRefObject<any>;
|
|
263
|
+
children: React.ReactNode;
|
|
264
|
+
role: string;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// Components interface for ModalTitle
|
|
268
|
+
export interface ModalTitleProps {
|
|
269
|
+
id: string;
|
|
270
|
+
children: React.ReactNode;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// Components interface for ModalDescription
|
|
274
|
+
export interface ModalDescriptionProps {
|
|
275
|
+
id: string;
|
|
276
|
+
children: React.ReactNode;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// Components interface for ModalBody
|
|
280
|
+
export interface ModalBodyProps {
|
|
281
|
+
modalBodyMargin?: string;
|
|
282
|
+
children: React.ReactNode;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// Components interface for ModalBodyMain
|
|
286
|
+
export interface ModalBodyMainProps {
|
|
287
|
+
children: React.ReactNode;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// Components interface for ModalPaginationItemProps
|
|
291
|
+
export interface ModalPaginationItemProps {
|
|
292
|
+
key: string | number;
|
|
293
|
+
active: boolean;
|
|
294
|
+
onClick: () => void;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
export interface ConfirmationDialogProps {
|
|
298
|
+
/**
|
|
299
|
+
* Text for the cancel button
|
|
300
|
+
* */
|
|
301
|
+
cancelText?: string;
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Text for the confirm button
|
|
305
|
+
* */
|
|
306
|
+
confirmText?: string;
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Callback function to be called when the cancel button is clicked
|
|
310
|
+
* */
|
|
311
|
+
onCancel: () => void;
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Callback function to be called when the confirm button is clicked
|
|
315
|
+
* */
|
|
316
|
+
onConfirm: () => void;
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Banner for the modal, can be a valid React node
|
|
320
|
+
* */
|
|
321
|
+
banner?: ModalContentType;
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Title for the modal, can be a valid React node
|
|
325
|
+
* */
|
|
326
|
+
title?: ModalContentType;
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Description for the modal, can be a string
|
|
330
|
+
* */
|
|
331
|
+
description?: string;
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Body for the modal, can be a valid React node
|
|
335
|
+
* */
|
|
336
|
+
body?: ModalContentType;
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Variant for the cancel button
|
|
340
|
+
* */
|
|
341
|
+
cancelButtonVariant?: ButtonVariants;
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Variant for the confirm button
|
|
345
|
+
* */
|
|
346
|
+
confirmButtonVariant?: ButtonVariants;
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Determines if the close button should be shown
|
|
350
|
+
* Available choices: `true`, `false`
|
|
351
|
+
*
|
|
352
|
+
* Default: `false`
|
|
353
|
+
* */
|
|
354
|
+
showCloseButton?: boolean;
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Determines if the modal should hide on click away
|
|
358
|
+
* Available choices: `true`, `false`
|
|
359
|
+
*
|
|
360
|
+
* Default: `false`
|
|
361
|
+
* */
|
|
362
|
+
hideOnClickAway?: boolean;
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Determines if the modal should blur the background
|
|
366
|
+
* Available choices: `true`, `false`
|
|
367
|
+
*
|
|
368
|
+
* Default: `false`
|
|
369
|
+
* */
|
|
370
|
+
blurBackground?: boolean;
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Determines if the modal should be at bottom with full width on mobile
|
|
374
|
+
* Available choices: `true`, `false`
|
|
375
|
+
*
|
|
376
|
+
* Default: `false`
|
|
377
|
+
* */
|
|
378
|
+
mobileBottomFullWidth?: boolean;
|
|
379
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
TableBodyComponentProps,
|
|
6
|
+
TableComponentProps,
|
|
7
|
+
TableDataCellComponentProps,
|
|
8
|
+
TableHeadComponentProps,
|
|
9
|
+
TableHeadingCellComponentProps,
|
|
10
|
+
TableRowComponentProps,
|
|
11
|
+
} from './types';
|
|
12
|
+
|
|
13
|
+
export const StyledTableDataCell = styled.td<TableDataCellComponentProps>`
|
|
14
|
+
color: var(--text-primary, #16191d);
|
|
15
|
+
font-size: var(--font-size-12px, 12px);
|
|
16
|
+
font-weight: var(--font-weight-450, 450);
|
|
17
|
+
line-height: 120%;
|
|
18
|
+
letter-spacing: 0.4px;
|
|
19
|
+
padding: var(--spacing-10px, 10px);
|
|
20
|
+
|
|
21
|
+
&:last-of-type {
|
|
22
|
+
border-right: none;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
${({ align }) => align && `text-align: ${align};`}
|
|
26
|
+
|
|
27
|
+
${({ flexAlign }) =>
|
|
28
|
+
flexAlign &&
|
|
29
|
+
css`
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: row;
|
|
32
|
+
align-items: ${flexAlign};
|
|
33
|
+
`}
|
|
34
|
+
|
|
35
|
+
${({ vAlign }) => vAlign && `vertical-align: ${vAlign};`}
|
|
36
|
+
`;
|
|
37
|
+
|
|
38
|
+
export const StyledTableHeadingCell = styled.th<TableHeadingCellComponentProps>`
|
|
39
|
+
color: var(--text-secondary, #5b6271);
|
|
40
|
+
font-size: var(--font-size-12px, 12px);
|
|
41
|
+
font-weight: var(--font-weight-550, 550);
|
|
42
|
+
line-height: 120%;
|
|
43
|
+
letter-spacing: 0.4px;
|
|
44
|
+
padding: var(--spacing-10px, 10px);
|
|
45
|
+
|
|
46
|
+
${({ align }) => `text-align: ${align};`}
|
|
47
|
+
`;
|
|
48
|
+
|
|
49
|
+
export const StyledTableRow = styled.tr<TableRowComponentProps>`
|
|
50
|
+
${({ condensed }) =>
|
|
51
|
+
!condensed &&
|
|
52
|
+
css`
|
|
53
|
+
${StyledTableDataCell} {
|
|
54
|
+
padding: 18px;
|
|
55
|
+
}
|
|
56
|
+
${StyledTableHeadingCell} {
|
|
57
|
+
padding: 18px;
|
|
58
|
+
}
|
|
59
|
+
`}
|
|
60
|
+
|
|
61
|
+
&:last-of-type ${StyledTableDataCell}:first-of-type {
|
|
62
|
+
border-bottom-left-radius: var(--corner-radius-8px, 8px);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&:last-of-type ${StyledTableDataCell}:last-of-type {
|
|
66
|
+
border-bottom-right-radius: var(--corner-radius-8px, 8px);
|
|
67
|
+
}
|
|
68
|
+
`;
|
|
69
|
+
|
|
70
|
+
export const StyledTable = styled.table<TableComponentProps>`
|
|
71
|
+
border-collapse: collapse;
|
|
72
|
+
font-size: var(--font-size-12px, 12px);
|
|
73
|
+
width: 100%;
|
|
74
|
+
border-radius: var(--corner-radius-10px, 10px);
|
|
75
|
+
overflow: hidden;
|
|
76
|
+
outline: var(--spacing-1px, 1px) solid var(--border, #e1e5ea);
|
|
77
|
+
font-family: var(--font-family, 'Mona Sans');
|
|
78
|
+
|
|
79
|
+
${StyledTableRow}:not(:last-child) {
|
|
80
|
+
border-bottom: var(--spacing-1px, 1px) solid var(--border, #e1e5ea);
|
|
81
|
+
}
|
|
82
|
+
${StyledTableDataCell}:not(:last-child) {
|
|
83
|
+
border-right: var(--spacing-1px, 1px) solid var(--border, #e1e5ea);
|
|
84
|
+
}
|
|
85
|
+
${StyledTableHeadingCell} {
|
|
86
|
+
border-right: var(--spacing-1px, 1px) solid var(--border, #e1e5ea);
|
|
87
|
+
border-bottom: var(--spacing-1px, 1px) solid var(--border, #e1e5ea);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
${({ borderAround }) =>
|
|
91
|
+
borderAround === false &&
|
|
92
|
+
css`
|
|
93
|
+
outline: none;
|
|
94
|
+
${StyledTableDataCell}:last-of-type {
|
|
95
|
+
border-right: none;
|
|
96
|
+
}
|
|
97
|
+
`}
|
|
98
|
+
|
|
99
|
+
${({ borderHorizontal }) =>
|
|
100
|
+
borderHorizontal === false &&
|
|
101
|
+
css`
|
|
102
|
+
${StyledTableRow} {
|
|
103
|
+
border-bottom: none !important;
|
|
104
|
+
}
|
|
105
|
+
${StyledTableDataCell} {
|
|
106
|
+
border-bottom: none;
|
|
107
|
+
}
|
|
108
|
+
${StyledTableHeadingCell} {
|
|
109
|
+
border-bottom: none;
|
|
110
|
+
}
|
|
111
|
+
`}
|
|
112
|
+
|
|
113
|
+
${({ borderVertical }) =>
|
|
114
|
+
borderVertical === false &&
|
|
115
|
+
css`
|
|
116
|
+
${StyledTableRow} {
|
|
117
|
+
border-right: none !important;
|
|
118
|
+
}
|
|
119
|
+
${StyledTableDataCell} {
|
|
120
|
+
border-right: none !important;
|
|
121
|
+
}
|
|
122
|
+
${StyledTableHeadingCell} {
|
|
123
|
+
border-right: none;
|
|
124
|
+
}
|
|
125
|
+
`}
|
|
126
|
+
|
|
127
|
+
${({ borderWithin }) =>
|
|
128
|
+
borderWithin === false &&
|
|
129
|
+
css`
|
|
130
|
+
${StyledTableRow} {
|
|
131
|
+
border-bottom: none !important;
|
|
132
|
+
border-right: none !important;
|
|
133
|
+
}
|
|
134
|
+
${StyledTableDataCell} {
|
|
135
|
+
border-bottom: none !important;
|
|
136
|
+
border-right: none !important;
|
|
137
|
+
}
|
|
138
|
+
${StyledTableHeadingCell} {
|
|
139
|
+
border-bottom: none !important;
|
|
140
|
+
border-right: none !important;
|
|
141
|
+
}
|
|
142
|
+
`}
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
${({ striped }) =>
|
|
146
|
+
striped &&
|
|
147
|
+
css`
|
|
148
|
+
${StyledTableBody} ${StyledTableRow}:nth-child(even) {
|
|
149
|
+
background-color: var(--bg-secondary, #f6f7f9);
|
|
150
|
+
}
|
|
151
|
+
`}
|
|
152
|
+
`;
|
|
153
|
+
|
|
154
|
+
export const StyledTableHead = styled.thead<TableHeadComponentProps>`
|
|
155
|
+
background: var(--bg-secondary, #f6f7f9);
|
|
156
|
+
|
|
157
|
+
${({ highlightHeaders }) =>
|
|
158
|
+
highlightHeaders === false && 'background: var(--bg-primary, #ffffff);'}
|
|
159
|
+
|
|
160
|
+
${({ capitalizeHeaders }) =>
|
|
161
|
+
capitalizeHeaders !== false && 'text-transform: uppercase;'}
|
|
162
|
+
|
|
163
|
+
${StyledTableRow} ${StyledTableHeadingCell}:last-child {
|
|
164
|
+
border-right: none;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
${StyledTableRow}:first-child ${StyledTableHeadingCell}:first-child {
|
|
168
|
+
border-top-left-radius: var(--corner-radius-8px, 8px);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
${StyledTableRow}:first-child ${StyledTableHeadingCell}&:last-child {
|
|
172
|
+
border-top-right-radius: var(--corner-radius-8px, 8px);
|
|
173
|
+
}
|
|
174
|
+
`;
|
|
175
|
+
|
|
176
|
+
export const StyledTableBody = styled.tbody<TableBodyComponentProps>`
|
|
177
|
+
background-color: var(--bg-primary, #fff);
|
|
178
|
+
`;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
2
|
+
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
import Table from '.';
|
|
7
|
+
import { TableProps } from './types';
|
|
8
|
+
|
|
9
|
+
describe('Table', () => {
|
|
10
|
+
const columns: TableProps['columns'] = [
|
|
11
|
+
{ key: 'col1', display: 'Column 1' },
|
|
12
|
+
{ key: 'col2', display: 'Column 2' },
|
|
13
|
+
{ key: 'col3', display: 'Column 3' },
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
const rows: TableProps['rows'] = [
|
|
17
|
+
{
|
|
18
|
+
col1: { display: 'Row 1, Cell 1' },
|
|
19
|
+
col2: { display: 'Row 1, Cell 2' },
|
|
20
|
+
col3: { display: 'Row 1, Cell 3' },
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
col1: { display: 'Row 2, Cell 1' },
|
|
24
|
+
col2: { display: 'Row 2, Cell 2' },
|
|
25
|
+
col3: { display: 'Row 2, Cell 3' },
|
|
26
|
+
},
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
it('renders table with columns and rows', () => {
|
|
30
|
+
render(<Table columns={columns} rows={rows} />);
|
|
31
|
+
|
|
32
|
+
columns.forEach((column) => {
|
|
33
|
+
expect(screen.getByText(column.display)).toBeInTheDocument();
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
rows.forEach((row) => {
|
|
37
|
+
Object.values(row).forEach((cell) => {
|
|
38
|
+
expect(screen.getByText(cell.display as string)).toBeInTheDocument();
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
it('renders custom cell content using render function', () => {
|
|
45
|
+
const customRows: TableProps['rows'] = [
|
|
46
|
+
{
|
|
47
|
+
col1: { render: () => <span>Custom Cell 1</span> },
|
|
48
|
+
col2: { display: 'Row 1, Cell 2' },
|
|
49
|
+
col3: { display: 'Row 1, Cell 3' },
|
|
50
|
+
},
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
render(<Table columns={columns} rows={customRows} />);
|
|
54
|
+
|
|
55
|
+
expect(screen.getByText('Custom Cell 1')).toBeInTheDocument();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('applies custom styles and classes', () => {
|
|
59
|
+
render(
|
|
60
|
+
<Table
|
|
61
|
+
columns={columns}
|
|
62
|
+
rows={rows}
|
|
63
|
+
className="custom-class"
|
|
64
|
+
style={{ backgroundColor: 'red' }}
|
|
65
|
+
/>
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
const tableElement = screen.getByRole('table');
|
|
69
|
+
expect(tableElement).toHaveClass('custom-class');
|
|
70
|
+
expect(tableElement).toHaveStyle('background-color: red');
|
|
71
|
+
});
|
|
72
|
+
});
|