@newtonschool/grauity 0.1.11 → 1.0.1

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.
Files changed (159) hide show
  1. package/dist/index.d.ts +227 -227
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/main.cjs +1 -1
  4. package/dist/main.cjs.map +1 -1
  5. package/dist/module.mjs +1 -1
  6. package/dist/module.mjs.map +1 -1
  7. package/dist/stories/elements/Modal/ConfirmationDialog.stories.d.ts +1 -35
  8. package/dist/stories/elements/Modal/ConfirmationDialog.stories.d.ts.map +1 -1
  9. package/dist/stories/elements/Modal/ConfirmationDialogWithTrigger.stories.d.ts +2 -35
  10. package/dist/stories/elements/Modal/ConfirmationDialogWithTrigger.stories.d.ts.map +1 -1
  11. package/dist/stories/elements/Modal/MultiStepModal.stories.d.ts +0 -32
  12. package/dist/stories/elements/Modal/MultiStepModal.stories.d.ts.map +1 -1
  13. package/dist/stories/elements/Table/Manual.stories.d.ts +1 -31
  14. package/dist/stories/elements/Table/Manual.stories.d.ts.map +1 -1
  15. package/dist/stories/elements/Table/ManualColumnNesting.stories.d.ts +1 -31
  16. package/dist/stories/elements/Table/ManualColumnNesting.stories.d.ts.map +1 -1
  17. package/dist/stories/elements/Table/index.stories.d.ts +1 -31
  18. package/dist/stories/elements/Table/index.stories.d.ts.map +1 -1
  19. package/dist/stories/elements/Typography/TypographyGallery.stories.d.ts +1 -21
  20. package/dist/stories/elements/Typography/TypographyGallery.stories.d.ts.map +1 -1
  21. package/dist/stories/elements/Typography/index.stories.d.ts +1 -21
  22. package/dist/stories/elements/Typography/index.stories.d.ts.map +1 -1
  23. package/dist/stories/helper-components/ColorRenderer/index.d.ts +2 -11
  24. package/dist/stories/helper-components/ColorRenderer/index.d.ts.map +1 -1
  25. package/dist/stories/helper-components/DocPageWithPlayground.d.ts +3 -8
  26. package/dist/stories/helper-components/DocPageWithPlayground.d.ts.map +1 -1
  27. package/dist/stories/helper-components/TokenBlock/index.d.ts +2 -14
  28. package/dist/stories/helper-components/TokenBlock/index.d.ts.map +1 -1
  29. package/dist/ui/elements/Alert/Alert.d.ts.map +1 -1
  30. package/dist/ui/elements/Alert/types.d.ts +1 -1
  31. package/dist/ui/elements/Alert/types.d.ts.map +1 -1
  32. package/dist/ui/elements/AlertBanner/AlertBanner.d.ts.map +1 -1
  33. package/dist/ui/elements/Button/Button.d.ts.map +1 -1
  34. package/dist/ui/elements/Button/Button.styles.d.ts.map +1 -1
  35. package/dist/ui/elements/Button/ButtonGroup.d.ts +1 -8
  36. package/dist/ui/elements/Button/ButtonGroup.d.ts.map +1 -1
  37. package/dist/ui/elements/Button/IconButton.d.ts.map +1 -1
  38. package/dist/ui/elements/Button/constants.d.ts +14 -20
  39. package/dist/ui/elements/Button/constants.d.ts.map +1 -1
  40. package/dist/ui/elements/Button/types.d.ts +1 -0
  41. package/dist/ui/elements/Button/types.d.ts.map +1 -1
  42. package/dist/ui/elements/Icon/Icon.d.ts +0 -40
  43. package/dist/ui/elements/Icon/Icon.d.ts.map +1 -1
  44. package/dist/ui/elements/Modal/ConfirmationDialog/index.d.ts +1 -36
  45. package/dist/ui/elements/Modal/ConfirmationDialog/index.d.ts.map +1 -1
  46. package/dist/ui/elements/Modal/Modal.d.ts.map +1 -1
  47. package/dist/ui/elements/Modal/MultiStepModal/index.d.ts +0 -33
  48. package/dist/ui/elements/Modal/MultiStepModal/index.d.ts.map +1 -1
  49. package/dist/ui/elements/Table/Table.d.ts +1 -32
  50. package/dist/ui/elements/Table/Table.d.ts.map +1 -1
  51. package/dist/ui/elements/Typography/Typography.d.ts +1 -22
  52. package/dist/ui/elements/Typography/Typography.d.ts.map +1 -1
  53. package/dist/ui/elements/Typography/types.d.ts +1 -1
  54. package/dist/ui/index.d.ts +5 -3
  55. package/dist/ui/index.d.ts.map +1 -1
  56. package/dist/ui/init/GrauityInit.d.ts +2 -21
  57. package/dist/ui/init/GrauityInit.d.ts.map +1 -1
  58. package/dist/ui/themes/ThemeContext.d.ts +1 -13
  59. package/dist/ui/themes/ThemeContext.d.ts.map +1 -1
  60. package/package.json +2 -4
  61. package/ui/.gitkeep +0 -0
  62. package/ui/README.md +0 -3
  63. package/ui/core/README.md +0 -4
  64. package/ui/core/colors/colorTypes.ts +0 -3
  65. package/ui/core/colors/index.ts +0 -25
  66. package/ui/core/icons/iconTags.ts +0 -1600
  67. package/ui/core/icons/iconTypes.ts +0 -1188
  68. package/ui/core/icons/index.ts +0 -3
  69. package/ui/core/index.ts +0 -14
  70. package/ui/core/miscellaneous-choices/index.ts +0 -24
  71. package/ui/core/miscellaneous-choices/miscellaneousTypes.ts +0 -3
  72. package/ui/core/sizes/index.ts +0 -29
  73. package/ui/core/sizes/sizeTypes.ts +0 -26
  74. package/ui/css/animations.scss +0 -8
  75. package/ui/css/fonts.scss +0 -9
  76. package/ui/css/index.scss +0 -3
  77. package/ui/css/reset.scss +0 -512
  78. package/ui/elements/Alert/Alert.styles.ts +0 -66
  79. package/ui/elements/Alert/Alert.test.tsx +0 -81
  80. package/ui/elements/Alert/Alert.tsx +0 -153
  81. package/ui/elements/Alert/constants.ts +0 -169
  82. package/ui/elements/Alert/index.ts +0 -6
  83. package/ui/elements/Alert/types.ts +0 -150
  84. package/ui/elements/Alert/utils.ts +0 -0
  85. package/ui/elements/AlertBanner/AlertBanner.styles.ts +0 -35
  86. package/ui/elements/AlertBanner/AlertBanner.test.tsx +0 -70
  87. package/ui/elements/AlertBanner/AlertBanner.tsx +0 -137
  88. package/ui/elements/AlertBanner/constants.ts +0 -179
  89. package/ui/elements/AlertBanner/index.ts +0 -6
  90. package/ui/elements/AlertBanner/types.ts +0 -133
  91. package/ui/elements/AlertBanner/utils.ts +0 -52
  92. package/ui/elements/Button/Button.styles.ts +0 -88
  93. package/ui/elements/Button/Button.test.tsx +0 -78
  94. package/ui/elements/Button/Button.tsx +0 -134
  95. package/ui/elements/Button/ButtonGroup.styles.ts +0 -7
  96. package/ui/elements/Button/ButtonGroup.tsx +0 -21
  97. package/ui/elements/Button/IconButton.test.tsx +0 -39
  98. package/ui/elements/Button/IconButton.tsx +0 -118
  99. package/ui/elements/Button/constants.ts +0 -304
  100. package/ui/elements/Button/index.ts +0 -8
  101. package/ui/elements/Button/types.ts +0 -282
  102. package/ui/elements/Button/utils.ts +0 -0
  103. package/ui/elements/Icon/Icon.styles.ts +0 -99
  104. package/ui/elements/Icon/Icon.tsx +0 -139
  105. package/ui/elements/Icon/index.ts +0 -2
  106. package/ui/elements/Icon/types.ts +0 -96
  107. package/ui/elements/Modal/ConfirmationDialog/index.test.tsx +0 -116
  108. package/ui/elements/Modal/ConfirmationDialog/index.tsx +0 -151
  109. package/ui/elements/Modal/Modal.styles.ts +0 -230
  110. package/ui/elements/Modal/Modal.test.tsx +0 -117
  111. package/ui/elements/Modal/Modal.tsx +0 -179
  112. package/ui/elements/Modal/MultiStepModal/index.test.tsx +0 -116
  113. package/ui/elements/Modal/MultiStepModal/index.tsx +0 -184
  114. package/ui/elements/Modal/constants.ts +0 -0
  115. package/ui/elements/Modal/index.ts +0 -4
  116. package/ui/elements/Modal/types.ts +0 -379
  117. package/ui/elements/Modal/utils.tsx +0 -0
  118. package/ui/elements/MultiSelectDropdown/DropdownListItem.tsx +0 -33
  119. package/ui/elements/MultiSelectDropdown/MultiSelectDropdown.styles.ts +0 -127
  120. package/ui/elements/MultiSelectDropdown/MultiSelectDropdown.test.tsx +0 -224
  121. package/ui/elements/MultiSelectDropdown/MultiSelectDropdown.tsx +0 -156
  122. package/ui/elements/MultiSelectDropdown/index.ts +0 -2
  123. package/ui/elements/MultiSelectDropdown/types.ts +0 -87
  124. package/ui/elements/SelectDropdown/SelectDropdown.styles.ts +0 -99
  125. package/ui/elements/SelectDropdown/SelectDropdown.test.tsx +0 -86
  126. package/ui/elements/SelectDropdown/SelectDropdown.tsx +0 -94
  127. package/ui/elements/SelectDropdown/index.tsx +0 -2
  128. package/ui/elements/SelectDropdown/types.ts +0 -73
  129. package/ui/elements/Table/Table.styles.ts +0 -178
  130. package/ui/elements/Table/Table.test.tsx +0 -72
  131. package/ui/elements/Table/Table.tsx +0 -118
  132. package/ui/elements/Table/constants.ts +0 -0
  133. package/ui/elements/Table/index.ts +0 -2
  134. package/ui/elements/Table/types.ts +0 -270
  135. package/ui/elements/Table/utils.ts +0 -0
  136. package/ui/elements/Typography/Typography.styles.ts +0 -29
  137. package/ui/elements/Typography/Typography.tsx +0 -70
  138. package/ui/elements/Typography/constants.ts +0 -292
  139. package/ui/elements/Typography/index.ts +0 -9
  140. package/ui/elements/Typography/types.ts +0 -116
  141. package/ui/elements/Typography/utils.ts +0 -11
  142. package/ui/fonts/Switzer-Variable.ttf +0 -0
  143. package/ui/fonts/grauity-icons.eot +0 -0
  144. package/ui/fonts/grauity-icons.ttf +0 -0
  145. package/ui/fonts/grauity-icons.woff +0 -0
  146. package/ui/fonts/grauity-icons.woff2 +0 -0
  147. package/ui/helpers/README.md +0 -3
  148. package/ui/helpers/classNameBuilders.ts +0 -48
  149. package/ui/helpers/index.ts +0 -7
  150. package/ui/index.ts +0 -48
  151. package/ui/init/GrauityInit.tsx +0 -85
  152. package/ui/init/index.ts +0 -2
  153. package/ui/themes/GlobalStyle.ts +0 -273
  154. package/ui/themes/ThemeContext.tsx +0 -140
  155. package/ui/themes/constants.ts +0 -8
  156. package/ui/themes/darkThemeConstants.ts +0 -73
  157. package/ui/themes/lightThemeConstants.ts +0 -73
  158. package/ui/themes/tokens.ts +0 -0
  159. package/ui/themes/types.ts +0 -77
@@ -1,179 +0,0 @@
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;
@@ -1,116 +0,0 @@
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
- });
@@ -1,184 +0,0 @@
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
@@ -1,4 +0,0 @@
1
- export { default as ConfirmationDialog } from './ConfirmationDialog';
2
- export { default } from './Modal';
3
- export { default as MultiStepModal } from './MultiStepModal';
4
- export type { ConfirmationDialogProps, ModalProps } from './types';