@indico-data/design-system 1.0.47 → 1.0.49

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 (182) hide show
  1. package/README.md +5 -0
  2. package/jest.config.js +15 -0
  3. package/lib/components/Accordion/Accordion.d.ts +1 -1
  4. package/lib/components/Accordion/Accordion.stories.d.ts +2 -2
  5. package/lib/components/Accordion/Accordion.styles.d.ts +1 -275
  6. package/lib/components/Icon/Icon.stories.d.ts +3 -4
  7. package/lib/components/Icon/indicons.d.ts +143 -125
  8. package/lib/components/Icon/storyHelpers.d.ts +3 -813
  9. package/lib/components/ListTable/Header/Header.d.ts +1 -1
  10. package/lib/components/ListTable/Header/Header.styles.d.ts +1 -272
  11. package/lib/components/ListTable/ListTable.d.ts +1 -1
  12. package/lib/components/ListTable/ListTable.stories.d.ts +1 -1
  13. package/lib/components/ListTable/ListTable.styles.d.ts +1 -272
  14. package/lib/components/LoadingAwareContainer/LoadingAwareContainer.d.ts +15 -0
  15. package/lib/components/LoadingAwareContainer/LoadingAwareContainer.stories.d.ts +22 -0
  16. package/lib/components/LoadingAwareContainer/LoadingAwareContainer.styles.d.ts +3 -0
  17. package/lib/components/LoadingAwareContainer/index.d.ts +1 -0
  18. package/lib/components/Navigation/Drawer/Drawer.d.ts +15 -0
  19. package/lib/components/Navigation/Drawer/Drawer.stories.d.ts +6 -0
  20. package/lib/components/Navigation/Drawer/Drawer.styles.d.ts +7 -0
  21. package/lib/components/Navigation/Drawer/DrawerLinkList.d.ts +9 -0
  22. package/lib/components/Navigation/Drawer/DrawerLinkList.styles.d.ts +2 -0
  23. package/lib/components/Navigation/Drawer/__mocks__/mocks.d.ts +3 -0
  24. package/lib/components/Navigation/Drawer/__tests__/Drawer.test.d.ts +1 -0
  25. package/lib/components/Navigation/Drawer/__tests__/DrawerLinkList.test.d.ts +1 -0
  26. package/lib/components/Navigation/Drawer/index.d.ts +1 -0
  27. package/lib/components/Navigation/Drawer/types.d.ts +7 -0
  28. package/lib/components/Navigation/index.d.ts +1 -0
  29. package/lib/components/Pagination/Pagination.d.ts +1 -2
  30. package/lib/components/Pagination/Pagination.styles.d.ts +1 -272
  31. package/lib/components/Wizard/Wizard.d.ts +48 -0
  32. package/lib/components/Wizard/Wizard.stories.d.ts +29 -0
  33. package/lib/components/Wizard/Wizard.styles.d.ts +4 -0
  34. package/lib/components/Wizard/index.d.ts +2 -0
  35. package/lib/components/WizardWithSidebar/WizardWithSidebar.d.ts +58 -0
  36. package/lib/components/WizardWithSidebar/WizardWithSidebar.stories.d.ts +46 -0
  37. package/lib/components/WizardWithSidebar/WizardWithSidebar.styles.d.ts +9 -0
  38. package/lib/components/WizardWithSidebar/index.d.ts +2 -0
  39. package/lib/components/basic-section/Section/Section.d.ts +1 -1
  40. package/lib/components/basic-section/Section/Section.stories.d.ts +1 -1
  41. package/lib/components/basic-section/Section/Section.styles.d.ts +1 -272
  42. package/lib/components/basic-section/SectionBlock/SectionBlock.d.ts +1 -1
  43. package/lib/components/basic-section/SectionBlock/SectionBlock.styles.d.ts +1 -272
  44. package/lib/components/basic-section/SectionBody/SectionBody.d.ts +1 -1
  45. package/lib/components/basic-section/SectionBody/SectionBody.stories.d.ts +1 -2
  46. package/lib/components/basic-section/SectionBody/SectionBody.styles.d.ts +1 -272
  47. package/lib/components/basic-section/SectionHeader/SectionHeader.d.ts +1 -1
  48. package/lib/components/basic-section/SectionHeader/SectionHeader.stories.d.ts +1 -1
  49. package/lib/components/basic-section/SectionHeader/SectionHeader.styles.d.ts +1 -272
  50. package/lib/components/basic-section/SectionTable/SectionTable.d.ts +1 -2
  51. package/lib/components/basic-section/SectionTable/SectionTable.styles.d.ts +1 -272
  52. package/lib/components/buttons/Button/Button.styles.d.ts +1 -282
  53. package/lib/components/buttons/IconButton/IconButton.d.ts +4 -5
  54. package/lib/components/buttons/IconButton/IconButton.stories.d.ts +3 -3
  55. package/lib/components/buttons/IconButton/IconButton.styles.d.ts +2 -567
  56. package/lib/components/buttons/types.d.ts +2 -1
  57. package/lib/components/dropdowns/BorderSelect/BorderSelect.d.ts +1 -1
  58. package/lib/components/dropdowns/BorderSelect/BorderSelect.stories.d.ts +1 -1
  59. package/lib/components/dropdowns/BorderSelect/BorderSelect.styles.d.ts +2 -543
  60. package/lib/components/dropdowns/MultiCombobox/MultiCombobox.styles.d.ts +1 -84
  61. package/lib/components/dropdowns/Select/Select.d.ts +1 -1
  62. package/lib/components/dropdowns/Select/Select.stories.d.ts +1 -1
  63. package/lib/components/dropdowns/Select/Select.styles.d.ts +1 -272
  64. package/lib/components/dropdowns/SingleCombobox/SingleCombobox.styles.d.ts +1 -84
  65. package/lib/components/dropdowns/utils.d.ts +1 -2
  66. package/lib/components/index.d.ts +7 -2
  67. package/lib/components/inputs/EditableInput/EditableInput.d.ts +1 -1
  68. package/lib/components/inputs/EditableInput/EditableInput.stories.d.ts +1 -2
  69. package/lib/components/inputs/EditableInput/EditableInput.styles.d.ts +1 -272
  70. package/lib/components/inputs/NumberInput/NumberInput.styles.d.ts +1 -272
  71. package/lib/components/inputs/RadioButtons/RadioButtons.d.ts +24 -0
  72. package/lib/components/inputs/RadioButtons/RadioButtons.stories.d.ts +15 -0
  73. package/lib/components/inputs/RadioButtons/RadioButtons.styles.d.ts +14 -0
  74. package/lib/components/inputs/RadioButtons/index.d.ts +1 -0
  75. package/lib/components/inputs/RadioGroup/RadioGroup.d.ts +27 -0
  76. package/lib/components/inputs/RadioGroup/RadioGroup.stories.d.ts +16 -0
  77. package/lib/components/inputs/RadioGroup/RadioGroup.styles.d.ts +2 -0
  78. package/lib/components/inputs/RadioGroup/index.d.ts +1 -0
  79. package/lib/components/inputs/SearchInput/SearchInput.d.ts +1 -1
  80. package/lib/components/inputs/SearchInput/SearchInput.stories.d.ts +1 -1
  81. package/lib/components/inputs/SearchInput/SearchInput.styles.d.ts +1 -5
  82. package/lib/components/inputs/TextInput/TextInput.styles.d.ts +2 -543
  83. package/lib/components/inputs/index.d.ts +2 -0
  84. package/lib/components/loading-indicators/BarSpinner/BarSpinner.styles.d.ts +1 -272
  85. package/lib/components/loading-indicators/CirclePulse/CirclePulse.styles.d.ts +3 -3
  86. package/lib/components/loading-indicators/LoadingIndicator/LoadingIndicator.d.ts +10 -0
  87. package/lib/components/loading-indicators/LoadingIndicator/LoadingIndicator.stories.d.ts +11 -0
  88. package/lib/components/loading-indicators/LoadingIndicator/LoadingIndicator.styles.d.ts +8 -0
  89. package/lib/components/loading-indicators/LoadingIndicator/index.d.ts +1 -0
  90. package/lib/components/loading-indicators/LoadingList/LoadingList.d.ts +1 -2
  91. package/lib/components/loading-indicators/LoadingList/LoadingList.stories.d.ts +1 -2
  92. package/lib/components/loading-indicators/LoadingList/LoadingList.styles.d.ts +1 -272
  93. package/lib/components/loading-indicators/PercentageRing/PercentageRing.d.ts +1 -2
  94. package/lib/components/loading-indicators/PercentageRing/PercentageRing.styles.d.ts +1 -272
  95. package/lib/components/loading-indicators/RandomLoadingMessage/RandomLoadingMessage.d.ts +1 -2
  96. package/lib/components/loading-indicators/RandomLoadingMessage/RandomLoadingMessage.stories.d.ts +1 -2
  97. package/lib/components/loading-indicators/index.d.ts +1 -0
  98. package/lib/components/modals/ConfirmModal/ConfirmModal.d.ts +17 -0
  99. package/lib/components/modals/ConfirmModal/ConfirmModal.stories.d.ts +44 -0
  100. package/lib/components/modals/ConfirmModal/ConfirmModal.styles.d.ts +2 -0
  101. package/lib/components/modals/ConfirmModal/index.d.ts +1 -0
  102. package/lib/components/modals/ModalBase/ModalBase.d.ts +27 -0
  103. package/lib/components/modals/ModalBase/ModalBase.stories.d.ts +9 -0
  104. package/lib/components/modals/ModalBase/ModalBase.styles.d.ts +4 -0
  105. package/lib/components/modals/ModalBase/index.d.ts +2 -0
  106. package/lib/components/modals/index.d.ts +2 -0
  107. package/lib/components/user-feedback/Shrug/Shrug.stories.d.ts +1 -1
  108. package/lib/components/user-feedback/Shrug/Shrug.styles.d.ts +1 -272
  109. package/lib/index.d.ts +531 -270
  110. package/lib/index.esm.js +5722 -824
  111. package/lib/index.esm.js.map +1 -1
  112. package/lib/index.js +5779 -867
  113. package/lib/index.js.map +1 -1
  114. package/lib/setupTests.d.ts +1 -0
  115. package/lib/styles/globals/index.d.ts +1 -2
  116. package/lib/tokens/colors.d.ts +9 -0
  117. package/lib/tokens/typography.d.ts +12 -0
  118. package/lib/types.d.ts +147 -125
  119. package/package.json +60 -42
  120. package/src/components/Icon/Icon.tsx +1 -0
  121. package/src/components/Icon/indicons.tsx +138 -15
  122. package/src/components/ListTable/ListTable.stories.tsx +1 -1
  123. package/src/components/LoadingAwareContainer/LoadingAwareContainer.stories.tsx +45 -0
  124. package/src/components/LoadingAwareContainer/LoadingAwareContainer.styles.ts +16 -0
  125. package/src/components/LoadingAwareContainer/LoadingAwareContainer.tsx +36 -0
  126. package/src/components/LoadingAwareContainer/index.ts +1 -0
  127. package/src/components/Navigation/Drawer/Drawer.stories.tsx +44 -0
  128. package/src/components/Navigation/Drawer/Drawer.styles.ts +75 -0
  129. package/src/components/Navigation/Drawer/Drawer.tsx +108 -0
  130. package/src/components/Navigation/Drawer/DrawerLinkList.styles.ts +66 -0
  131. package/src/components/Navigation/Drawer/DrawerLinkList.tsx +64 -0
  132. package/src/components/Navigation/Drawer/__mocks__/mocks.ts +49 -0
  133. package/src/components/Navigation/Drawer/__tests__/Drawer.test.tsx +175 -0
  134. package/src/components/Navigation/Drawer/__tests__/DrawerLinkList.test.tsx +66 -0
  135. package/src/components/Navigation/Drawer/index.ts +1 -0
  136. package/src/components/Navigation/Drawer/types.ts +8 -0
  137. package/src/components/Navigation/index.ts +1 -0
  138. package/src/components/Wizard/Wizard.stories.tsx +180 -0
  139. package/src/components/Wizard/Wizard.styles.ts +72 -0
  140. package/src/components/Wizard/Wizard.tsx +211 -0
  141. package/src/components/Wizard/index.ts +2 -0
  142. package/src/components/WizardWithSidebar/WizardWithSidebar.stories.tsx +143 -0
  143. package/src/components/WizardWithSidebar/WizardWithSidebar.styles.ts +123 -0
  144. package/src/components/WizardWithSidebar/WizardWithSidebar.tsx +262 -0
  145. package/src/components/WizardWithSidebar/index.ts +2 -0
  146. package/src/components/buttons/IconButton/IconButton.styles.ts +31 -0
  147. package/src/components/buttons/IconButton/IconButton.tsx +8 -6
  148. package/src/components/buttons/types.ts +2 -1
  149. package/src/components/index.ts +16 -1
  150. package/src/components/inputs/RadioButtons/RadioButtons.stories.tsx +84 -0
  151. package/src/components/inputs/RadioButtons/RadioButtons.styles.ts +82 -0
  152. package/src/components/inputs/RadioButtons/RadioButtons.tsx +61 -0
  153. package/src/components/inputs/RadioButtons/index.tsx +1 -0
  154. package/src/components/inputs/RadioGroup/RadioGroup.stories.tsx +66 -0
  155. package/src/components/inputs/RadioGroup/RadioGroup.styles.ts +11 -0
  156. package/src/components/inputs/RadioGroup/RadioGroup.tsx +120 -0
  157. package/src/components/inputs/RadioGroup/index.ts +1 -0
  158. package/src/components/inputs/SearchInput/SearchInput.styles.ts +28 -42
  159. package/src/components/inputs/SearchInput/SearchInput.tsx +6 -4
  160. package/src/components/inputs/index.ts +2 -0
  161. package/src/components/loading-indicators/CirclePulse/CirclePulse.styles.ts +7 -7
  162. package/src/components/loading-indicators/CirclePulse/CirclePulse.tsx +3 -3
  163. package/src/components/loading-indicators/LoadingIndicator/LoadingIndicator.stories.tsx +22 -0
  164. package/src/components/loading-indicators/LoadingIndicator/LoadingIndicator.styles.ts +81 -0
  165. package/src/components/loading-indicators/LoadingIndicator/LoadingIndicator.tsx +61 -0
  166. package/src/components/loading-indicators/LoadingIndicator/index.ts +1 -0
  167. package/src/components/loading-indicators/index.ts +1 -0
  168. package/src/components/modals/ConfirmModal/ConfirmModal.stories.tsx +76 -0
  169. package/src/components/modals/ConfirmModal/ConfirmModal.styles.ts +30 -0
  170. package/src/components/modals/ConfirmModal/ConfirmModal.tsx +84 -0
  171. package/src/components/modals/ConfirmModal/index.ts +1 -0
  172. package/src/components/modals/ModalBase/ModalBase.stories.tsx +47 -0
  173. package/src/components/modals/ModalBase/ModalBase.styles.tsx +73 -0
  174. package/src/components/modals/ModalBase/ModalBase.tsx +72 -0
  175. package/src/components/modals/ModalBase/index.ts +2 -0
  176. package/src/components/modals/index.ts +2 -0
  177. package/src/index.ts +13 -0
  178. package/src/setupTests.ts +4 -0
  179. package/src/tokens/colors.ts +9 -0
  180. package/src/tokens/typography.ts +7 -1
  181. package/src/types.ts +8 -0
  182. package/tsconfig.json +1 -1
@@ -0,0 +1,211 @@
1
+ // TODO: This component's migration was fast-tracked for Insights. Assess for potential refactor and documentation.
2
+
3
+ import React, { useEffect, useMemo, useState } from 'react';
4
+
5
+ import { Button, ConfirmModal, IconButton } from '@/components';
6
+ import { PermafrostComponent, ButtonSize } from '@/types';
7
+
8
+ import { StyledWizard } from './Wizard.styles';
9
+
10
+ export type CancelText = {
11
+ // "confirm" button text
12
+ confirmText: string;
13
+ message?: string;
14
+ // "reject" button text
15
+ rejectText: string;
16
+ title: string;
17
+ // Optional, supporting text
18
+ };
19
+
20
+ type Props = PermafrostComponent & {
21
+ children: React.ReactNode;
22
+ /**
23
+ * text for the cancel confirmation modal
24
+ */
25
+ confirmCancel: CancelText;
26
+ disableNextStep?: boolean;
27
+ disablePrevStep?: boolean;
28
+ disableSubmit?: boolean;
29
+ isLastStep?: boolean;
30
+ /**
31
+ * for testing/mocking purposes
32
+ */
33
+ startingStep?: string;
34
+ steps: string[];
35
+ /**
36
+ * the text to appear on the submit button
37
+ */
38
+ submitButtonLabel: string;
39
+ /**
40
+ * Puts button in "busy" mode, and replaces button label with this text
41
+ */
42
+ submitProcessing?: string;
43
+ wizardTitle: string;
44
+ onCancel?(): void;
45
+ onNextPress?(): boolean;
46
+ /**
47
+ * returns the current step name to the parent component
48
+ */
49
+ onStepChange(stepName: string): void;
50
+ onSubmit(): void;
51
+ /**
52
+ * Allows for any custom attribute to be added directly to "next button" in wizard
53
+ */
54
+ nextButtonProps?: {
55
+ 'data-cy': string;
56
+ };
57
+ };
58
+
59
+ const commonButtonProps = {
60
+ size: 'large' as ButtonSize,
61
+ };
62
+
63
+ export function Wizard(props: Props) {
64
+ const {
65
+ children,
66
+ className,
67
+ confirmCancel,
68
+ disableNextStep,
69
+ disablePrevStep,
70
+ disableSubmit,
71
+ id,
72
+ isLastStep,
73
+ onCancel,
74
+ onNextPress,
75
+ onStepChange,
76
+ onSubmit,
77
+ startingStep,
78
+ steps,
79
+ submitButtonLabel,
80
+ submitProcessing = '',
81
+ wizardTitle,
82
+ nextButtonProps,
83
+ } = props;
84
+
85
+ const [currentStep, setCurrentStep] = useState<string>(startingStep || steps[0]);
86
+ const [openCancelConfirm, setOpenCancelConfirm] = useState<boolean>(false);
87
+
88
+ const onLastStep: boolean = useMemo(() => {
89
+ if (isLastStep !== undefined) {
90
+ return isLastStep;
91
+ }
92
+
93
+ return steps.indexOf(currentStep) === steps.length - 1;
94
+ }, [isLastStep, steps, currentStep]);
95
+
96
+ const isBusy = !!(submitProcessing && submitProcessing.length > 0);
97
+
98
+ const nextStep = () => {
99
+ if (!onLastStep) {
100
+ const currentIndex = steps.indexOf(currentStep);
101
+
102
+ setCurrentStep(steps[currentIndex + 1]);
103
+ }
104
+ };
105
+
106
+ const prevStep = () => {
107
+ const currentIndex = steps.indexOf(currentStep);
108
+
109
+ if (currentIndex !== 0) {
110
+ setCurrentStep(steps[currentIndex - 1]);
111
+ }
112
+ };
113
+
114
+ // handles the user's selection in the cancel confirmation modal
115
+ const handleCancelRequest = (confirmCancel: boolean) => {
116
+ if (confirmCancel && onCancel) {
117
+ onCancel();
118
+ }
119
+
120
+ setOpenCancelConfirm(false);
121
+ };
122
+
123
+ const handleNextPress = () => {
124
+ const allowNext = onNextPress ? onNextPress() : true;
125
+
126
+ if (!allowNext) {
127
+ return;
128
+ }
129
+
130
+ if (onLastStep) {
131
+ handleSubmit();
132
+ } else {
133
+ nextStep();
134
+ }
135
+ };
136
+
137
+ const handleSubmit = () => {
138
+ onSubmit();
139
+ };
140
+
141
+ // report current step to the consuming component
142
+ useEffect(() => {
143
+ onStepChange(currentStep);
144
+ }, [currentStep]);
145
+
146
+ // ensures `currentStep` is reset on unmount, just in case
147
+ useEffect(() => {
148
+ return () => setCurrentStep(steps[0] || '');
149
+ }, []);
150
+
151
+ return (
152
+ <StyledWizard className={className} data-cy={props['data-cy']} id={id}>
153
+ <nav>
154
+ <h1>
155
+ {wizardTitle}: {currentStep}
156
+ </h1>
157
+
158
+ <div className="wizard-buttons">
159
+ <Button onClick={() => setOpenCancelConfirm(true)} variant="link-style">
160
+ Cancel
161
+ </Button>
162
+
163
+ {steps.indexOf(currentStep) !== 0 && (
164
+ <IconButton
165
+ {...commonButtonProps}
166
+ iconName="fa-arrow-left"
167
+ label="Previous Step"
168
+ onPress={prevStep}
169
+ isDisabled={disablePrevStep}
170
+ />
171
+ )}
172
+
173
+ {onLastStep ? (
174
+ <IconButton
175
+ {...commonButtonProps}
176
+ variant="primary"
177
+ iconName="check"
178
+ busy={isBusy}
179
+ label={isBusy ? submitProcessing : submitButtonLabel}
180
+ onPress={handleNextPress}
181
+ isDisabled={disableSubmit}
182
+ />
183
+ ) : (
184
+ <IconButton
185
+ {...commonButtonProps}
186
+ variant="primary"
187
+ iconSide="end"
188
+ iconName="fa-arrow-right"
189
+ label="Next Step"
190
+ onPress={handleNextPress}
191
+ isDisabled={disableNextStep}
192
+ {...nextButtonProps}
193
+ />
194
+ )}
195
+ </div>
196
+ </nav>
197
+
198
+ <>{children}</>
199
+
200
+ <ConfirmModal
201
+ title={confirmCancel.title}
202
+ message={confirmCancel.message}
203
+ confirmText={confirmCancel.confirmText}
204
+ rejectText={confirmCancel.rejectText}
205
+ open={openCancelConfirm}
206
+ clickOutsideHandler={() => setOpenCancelConfirm(false)}
207
+ responseHandler={handleCancelRequest}
208
+ />
209
+ </StyledWizard>
210
+ );
211
+ }
@@ -0,0 +1,2 @@
1
+ export { Wizard } from './Wizard';
2
+ export { WizardCard, WizardSection, StyledWizard } from './Wizard.styles';
@@ -0,0 +1,143 @@
1
+ import React, { useState } from 'react';
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
+
4
+ import { WizardWithSidebar } from './WizardWithSidebar';
5
+ import { COLORS } from '@/tokens';
6
+
7
+ const meta = {
8
+ component: WizardWithSidebar,
9
+ title: 'wizards/WizardWithSidebar',
10
+ args: {
11
+ buttonColor: `${COLORS.blueDarknut}`,
12
+ backgroundColor: '#ffffff',
13
+ color: '#000000',
14
+ stepSchema: {
15
+ 'Library Details': { inputsRequiringValidation: ['libraryName'], description: [] },
16
+ 'Configure Source': {
17
+ inputsRequiringValidation: [],
18
+ description: [
19
+ 'Select workflows to use for document ingestion to build your library.',
20
+ 'Select a folder to use for document ingestion to build your library.',
21
+ ],
22
+ },
23
+ Summary: { inputsRequiringValidation: [], description: [] },
24
+ },
25
+ onCancel: () => console.info('cancelling'),
26
+ onSubmit: () => console.info('submitting'),
27
+ wizardTitle: 'New Teach Task',
28
+ confirmCancel: {
29
+ title: 'Are you sure you want to stop creating this Task?',
30
+ message: 'Your Task will not be saved, nor available to be labeled.',
31
+ confirmText: 'Yes, go ahead',
32
+ rejectText: 'No, go back',
33
+ },
34
+ submitButtonLabel: 'Add Teach Task',
35
+ // Evidently, we need to add this prop or its corresponding logic within the component evaluates to false in storybook.
36
+ // Was not happening in earlier version, so was not necessary.
37
+ onNextPress: () => true,
38
+ },
39
+ } satisfies Meta<typeof WizardWithSidebar>;
40
+
41
+ export default meta;
42
+ type Story = StoryObj<typeof WizardWithSidebar>;
43
+
44
+ const steps = Object.keys(meta.args.stepSchema);
45
+ function StoryRender(props: any) {
46
+ const [currentStep, setCurrentStep] = useState('');
47
+
48
+ const currentStepContent = () => {
49
+ if (currentStep === steps[0]) {
50
+ return <div style={{ height: '300px', width: '500px' }}>First step content</div>;
51
+ }
52
+
53
+ if (currentStep === steps[1]) {
54
+ return <div style={{ height: '300px', width: '500px' }}>Second step content</div>;
55
+ }
56
+
57
+ if (currentStep === steps[2]) {
58
+ return <div style={{ height: '300px', width: '500px' }}>Third step content</div>;
59
+ }
60
+ };
61
+
62
+ return (
63
+ <WizardWithSidebar {...props} onStepChange={(step) => setCurrentStep(step)}>
64
+ {currentStepContent()}
65
+ </WizardWithSidebar>
66
+ );
67
+ }
68
+
69
+ export const FirstStep: Story = {
70
+ render: (args) => {
71
+ return <StoryRender {...args} />;
72
+ },
73
+ };
74
+
75
+ export const SecondStep: Story = {
76
+ args: {
77
+ startingStep: steps[1],
78
+ },
79
+ render: (args) => {
80
+ return <StoryRender {...args} />;
81
+ },
82
+ };
83
+
84
+ export const LastStep: Story = {
85
+ args: {
86
+ startingStep: steps[2],
87
+ },
88
+ render: (args) => {
89
+ return <StoryRender {...args} />;
90
+ },
91
+ };
92
+
93
+ export const DisabledNextStep: Story = {
94
+ args: {
95
+ disableNextStep: true,
96
+ },
97
+ render: (args) => {
98
+ return <StoryRender {...args} />;
99
+ },
100
+ };
101
+
102
+ export const DisabledPreviousStep: Story = {
103
+ args: {
104
+ startingStep: steps[1],
105
+ disablePrevStep: true,
106
+ },
107
+ render: (args) => {
108
+ return <StoryRender {...args} />;
109
+ },
110
+ };
111
+
112
+ export const SubmitProcessing: Story = {
113
+ args: {
114
+ submitProcessing: 'Adding Library',
115
+ startingStep: steps[2],
116
+ },
117
+ render: (args) => {
118
+ return <StoryRender {...args} />;
119
+ },
120
+ };
121
+
122
+ export const LastStepOverride: Story = {
123
+ args: {
124
+ startingStep: steps[2],
125
+ isLastStep: false,
126
+ },
127
+ render: (args) => {
128
+ return <StoryRender {...args} />;
129
+ },
130
+ };
131
+
132
+ export const WithValidationErrors: Story = {
133
+ args: {
134
+ startingStep: steps[2],
135
+ validationErrors: {
136
+ libraryName: ['Library name must be at least 6 characters.'],
137
+ },
138
+ isLastStep: false,
139
+ },
140
+ render: (args) => {
141
+ return <StoryRender {...args} />;
142
+ },
143
+ };
@@ -0,0 +1,123 @@
1
+ import styled, { css } from 'styled-components';
2
+
3
+ import { TYPOGRAPHY, SPACING, COLORS } from '@/tokens';
4
+
5
+ export const StyledWizardWithSidebar = styled.div<{
6
+ backgroundcolor?: string;
7
+ color?: string;
8
+ buttoncolor?: string;
9
+ className?: string;
10
+ ['data-cy']?: string;
11
+ id?: string;
12
+ }>`
13
+ display: inline-flex;
14
+ /* min-height: 455px; */
15
+ background-color: ${(props) => (props.backgroundcolor ? props.backgroundcolor : 'currentColor')};
16
+ color: ${(props) => (props.color ? props.color : 'inherit')};
17
+ border-radius: 4px;
18
+
19
+ h2 {
20
+ font-size: ${TYPOGRAPHY.fontSize.subheadLarge};
21
+ margin-bottom: ${SPACING.md};
22
+ color: ${(props) => (props.color ? props.color : 'inherit')};
23
+ font-weight: bold;
24
+ }
25
+
26
+ .wizard-sidebar {
27
+ width: 245px;
28
+ padding: 30px;
29
+ border-right: 1px solid #aaaaaa;
30
+
31
+ .sidebar-step {
32
+ margin-bottom: ${SPACING.sm};
33
+ display: flex;
34
+ align-items: center;
35
+ color: #aaaaaa;
36
+ &.current-step,
37
+ &.prior-step {
38
+ color: ${COLORS.black};
39
+ }
40
+
41
+ &:last-child {
42
+ margin-bottom: 0;
43
+ }
44
+
45
+ .sidebar-step__check-icon {
46
+ fill: ${COLORS.green};
47
+ margin-right: ${SPACING.sm};
48
+ width: 24px;
49
+ height: 24px;
50
+ }
51
+
52
+ .sidebar-step__number-icon {
53
+ margin-right: ${SPACING.sm};
54
+ width: 24px;
55
+ height: 24px;
56
+ border-radius: 50%;
57
+ border: 1px solid currentColor;
58
+ display: flex;
59
+ align-items: center;
60
+ justify-content: center;
61
+ font-size: ${TYPOGRAPHY.fontSize.caption};
62
+ }
63
+ }
64
+ }
65
+
66
+ .wizard-content {
67
+ /* min-width: 660px; */
68
+ padding: 30px;
69
+
70
+ .wizard-content__header {
71
+ /* min-height: 70px; */
72
+ }
73
+ .wizard-content__body {
74
+ /* min-height: 520px; */
75
+ }
76
+ }
77
+
78
+ nav {
79
+ display: flex;
80
+ align-items: center;
81
+ justify-content: end;
82
+ // override for some styling in AppChrome IPA component
83
+ padding-left: 0 !important;
84
+ padding-right: 0 !important;
85
+ margin-top: ${SPACING.md};
86
+ }
87
+
88
+ .wizard-buttons {
89
+ display: flex;
90
+ align-items: center;
91
+ font-size: ${TYPOGRAPHY.fontSize.subheadSmall};
92
+
93
+ button {
94
+ ${(props) =>
95
+ props.buttoncolor &&
96
+ css`
97
+ background-color: ${props.buttoncolor};
98
+ color: ${props.backgroundcolor || 'inherit'};
99
+ `}
100
+ }
101
+
102
+ button.outline {
103
+ background-color: inherit;
104
+ ${(props) =>
105
+ props.buttoncolor &&
106
+ css`
107
+ color: ${props.buttoncolor};
108
+ border-color: ${props.buttoncolor};
109
+ `};
110
+ }
111
+
112
+ button.link-style {
113
+ font-size: inherit;
114
+ margin-right: 1em;
115
+ background-color: inherit;
116
+ ${(props) =>
117
+ props.buttoncolor &&
118
+ css`
119
+ color: ${props.buttoncolor};
120
+ `};
121
+ }
122
+ }
123
+ `;