@indico-data/design-system 1.0.47 → 1.0.48

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 (163) 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 -1
  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 -3
  9. package/lib/components/ListTable/Header/Header.d.ts +1 -1
  10. package/lib/components/ListTable/Header/Header.styles.d.ts +1 -1
  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 -1
  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 +544 -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 +273 -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/constants.d.ts +3 -0
  27. package/lib/components/Navigation/Drawer/index.d.ts +1 -0
  28. package/lib/components/Navigation/Drawer/types.d.ts +7 -0
  29. package/lib/components/Navigation/index.d.ts +1 -0
  30. package/lib/components/Pagination/Pagination.d.ts +1 -2
  31. package/lib/components/Pagination/Pagination.styles.d.ts +1 -1
  32. package/lib/components/Wizard/Wizard.d.ts +48 -0
  33. package/lib/components/Wizard/Wizard.stories.d.ts +29 -0
  34. package/lib/components/Wizard/Wizard.styles.d.ts +815 -0
  35. package/lib/components/Wizard/index.d.ts +2 -0
  36. package/lib/components/WizardWithSidebar/WizardWithSidebar.d.ts +58 -0
  37. package/lib/components/WizardWithSidebar/WizardWithSidebar.stories.d.ts +46 -0
  38. package/lib/components/WizardWithSidebar/WizardWithSidebar.styles.d.ts +9 -0
  39. package/lib/components/WizardWithSidebar/index.d.ts +2 -0
  40. package/lib/components/basic-section/Section/Section.d.ts +1 -1
  41. package/lib/components/basic-section/Section/Section.stories.d.ts +1 -1
  42. package/lib/components/basic-section/Section/Section.styles.d.ts +1 -1
  43. package/lib/components/basic-section/SectionBlock/SectionBlock.d.ts +1 -1
  44. package/lib/components/basic-section/SectionBlock/SectionBlock.styles.d.ts +1 -1
  45. package/lib/components/basic-section/SectionBody/SectionBody.d.ts +1 -1
  46. package/lib/components/basic-section/SectionBody/SectionBody.stories.d.ts +1 -2
  47. package/lib/components/basic-section/SectionBody/SectionBody.styles.d.ts +1 -1
  48. package/lib/components/basic-section/SectionHeader/SectionHeader.d.ts +1 -1
  49. package/lib/components/basic-section/SectionHeader/SectionHeader.stories.d.ts +1 -1
  50. package/lib/components/basic-section/SectionHeader/SectionHeader.styles.d.ts +1 -1
  51. package/lib/components/basic-section/SectionTable/SectionTable.d.ts +1 -2
  52. package/lib/components/basic-section/SectionTable/SectionTable.styles.d.ts +1 -1
  53. package/lib/components/buttons/Button/Button.styles.d.ts +1 -1
  54. package/lib/components/buttons/IconButton/IconButton.d.ts +4 -5
  55. package/lib/components/buttons/IconButton/IconButton.stories.d.ts +3 -3
  56. package/lib/components/buttons/IconButton/IconButton.styles.d.ts +5 -5
  57. package/lib/components/buttons/types.d.ts +2 -1
  58. package/lib/components/dropdowns/BorderSelect/BorderSelect.d.ts +1 -1
  59. package/lib/components/dropdowns/BorderSelect/BorderSelect.stories.d.ts +1 -1
  60. package/lib/components/dropdowns/BorderSelect/BorderSelect.styles.d.ts +2 -2
  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 -1
  64. package/lib/components/dropdowns/utils.d.ts +1 -2
  65. package/lib/components/index.d.ts +6 -1
  66. package/lib/components/inputs/EditableInput/EditableInput.d.ts +1 -1
  67. package/lib/components/inputs/EditableInput/EditableInput.stories.d.ts +1 -2
  68. package/lib/components/inputs/EditableInput/EditableInput.styles.d.ts +1 -1
  69. package/lib/components/inputs/NumberInput/NumberInput.styles.d.ts +1 -1
  70. package/lib/components/inputs/SearchInput/SearchInput.d.ts +1 -1
  71. package/lib/components/inputs/SearchInput/SearchInput.stories.d.ts +1 -1
  72. package/lib/components/inputs/SearchInput/SearchInput.styles.d.ts +272 -5
  73. package/lib/components/inputs/TextInput/TextInput.styles.d.ts +2 -2
  74. package/lib/components/loading-indicators/BarSpinner/BarSpinner.styles.d.ts +1 -1
  75. package/lib/components/loading-indicators/CirclePulse/CirclePulse.styles.d.ts +3 -3
  76. package/lib/components/loading-indicators/LoadingIndicator/LoadingIndicator.d.ts +10 -0
  77. package/lib/components/loading-indicators/LoadingIndicator/LoadingIndicator.stories.d.ts +11 -0
  78. package/lib/components/loading-indicators/LoadingIndicator/LoadingIndicator.styles.d.ts +8 -0
  79. package/lib/components/loading-indicators/LoadingIndicator/index.d.ts +1 -0
  80. package/lib/components/loading-indicators/LoadingList/LoadingList.d.ts +1 -2
  81. package/lib/components/loading-indicators/LoadingList/LoadingList.stories.d.ts +1 -2
  82. package/lib/components/loading-indicators/LoadingList/LoadingList.styles.d.ts +1 -1
  83. package/lib/components/loading-indicators/PercentageRing/PercentageRing.d.ts +1 -2
  84. package/lib/components/loading-indicators/PercentageRing/PercentageRing.styles.d.ts +1 -1
  85. package/lib/components/loading-indicators/RandomLoadingMessage/RandomLoadingMessage.d.ts +1 -2
  86. package/lib/components/loading-indicators/RandomLoadingMessage/RandomLoadingMessage.stories.d.ts +1 -2
  87. package/lib/components/loading-indicators/index.d.ts +1 -0
  88. package/lib/components/modals/ConfirmModal/ConfirmModal.d.ts +17 -0
  89. package/lib/components/modals/ConfirmModal/ConfirmModal.stories.d.ts +44 -0
  90. package/lib/components/modals/ConfirmModal/ConfirmModal.styles.d.ts +273 -0
  91. package/lib/components/modals/ConfirmModal/index.d.ts +1 -0
  92. package/lib/components/modals/ModalBase/ModalBase.d.ts +27 -0
  93. package/lib/components/modals/ModalBase/ModalBase.stories.d.ts +9 -0
  94. package/lib/components/modals/ModalBase/ModalBase.styles.d.ts +6 -0
  95. package/lib/components/modals/ModalBase/index.d.ts +2 -0
  96. package/lib/components/modals/index.d.ts +2 -0
  97. package/lib/components/user-feedback/Shrug/Shrug.stories.d.ts +1 -1
  98. package/lib/components/user-feedback/Shrug/Shrug.styles.d.ts +1 -1
  99. package/lib/index.d.ts +1293 -270
  100. package/lib/index.esm.js +4082 -622
  101. package/lib/index.esm.js.map +1 -1
  102. package/lib/index.js +4131 -661
  103. package/lib/index.js.map +1 -1
  104. package/lib/setupTests.d.ts +1 -0
  105. package/lib/styles/globals/index.d.ts +1 -2
  106. package/lib/tokens/colors.d.ts +7 -0
  107. package/lib/tokens/typography.d.ts +12 -0
  108. package/lib/types.d.ts +147 -125
  109. package/package.json +18 -3
  110. package/src/components/Icon/Icon.tsx +1 -0
  111. package/src/components/Icon/indicons.tsx +138 -15
  112. package/src/components/ListTable/ListTable.stories.tsx +1 -1
  113. package/src/components/LoadingAwareContainer/LoadingAwareContainer.stories.tsx +45 -0
  114. package/src/components/LoadingAwareContainer/LoadingAwareContainer.styles.ts +16 -0
  115. package/src/components/LoadingAwareContainer/LoadingAwareContainer.tsx +36 -0
  116. package/src/components/LoadingAwareContainer/index.ts +1 -0
  117. package/src/components/Navigation/Drawer/Drawer.stories.tsx +44 -0
  118. package/src/components/Navigation/Drawer/Drawer.styles.ts +75 -0
  119. package/src/components/Navigation/Drawer/Drawer.tsx +108 -0
  120. package/src/components/Navigation/Drawer/DrawerLinkList.styles.ts +66 -0
  121. package/src/components/Navigation/Drawer/DrawerLinkList.tsx +64 -0
  122. package/src/components/Navigation/Drawer/__mocks__/mocks.ts +49 -0
  123. package/src/components/Navigation/Drawer/__tests__/Drawer.test.tsx +175 -0
  124. package/src/components/Navigation/Drawer/__tests__/DrawerLinkList.test.tsx +66 -0
  125. package/src/components/Navigation/Drawer/index.ts +1 -0
  126. package/src/components/Navigation/Drawer/types.ts +8 -0
  127. package/src/components/Navigation/index.ts +1 -0
  128. package/src/components/Wizard/Wizard.stories.tsx +180 -0
  129. package/src/components/Wizard/Wizard.styles.ts +72 -0
  130. package/src/components/Wizard/Wizard.tsx +212 -0
  131. package/src/components/Wizard/index.ts +2 -0
  132. package/src/components/WizardWithSidebar/WizardWithSidebar.stories.tsx +143 -0
  133. package/src/components/WizardWithSidebar/WizardWithSidebar.styles.ts +123 -0
  134. package/src/components/WizardWithSidebar/WizardWithSidebar.tsx +261 -0
  135. package/src/components/WizardWithSidebar/index.ts +2 -0
  136. package/src/components/buttons/IconButton/IconButton.styles.ts +31 -0
  137. package/src/components/buttons/IconButton/IconButton.tsx +8 -6
  138. package/src/components/buttons/types.ts +2 -1
  139. package/src/components/index.ts +6 -0
  140. package/src/components/inputs/SearchInput/SearchInput.styles.ts +27 -41
  141. package/src/components/inputs/SearchInput/SearchInput.tsx +6 -4
  142. package/src/components/loading-indicators/CirclePulse/CirclePulse.styles.ts +7 -7
  143. package/src/components/loading-indicators/CirclePulse/CirclePulse.tsx +3 -3
  144. package/src/components/loading-indicators/LoadingIndicator/LoadingIndicator.stories.tsx +23 -0
  145. package/src/components/loading-indicators/LoadingIndicator/LoadingIndicator.styles.ts +81 -0
  146. package/src/components/loading-indicators/LoadingIndicator/LoadingIndicator.tsx +61 -0
  147. package/src/components/loading-indicators/LoadingIndicator/index.ts +1 -0
  148. package/src/components/loading-indicators/index.ts +1 -0
  149. package/src/components/modals/ConfirmModal/ConfirmModal.stories.tsx +76 -0
  150. package/src/components/modals/ConfirmModal/ConfirmModal.styles.ts +30 -0
  151. package/src/components/modals/ConfirmModal/ConfirmModal.tsx +84 -0
  152. package/src/components/modals/ConfirmModal/index.ts +1 -0
  153. package/src/components/modals/ModalBase/ModalBase.stories.tsx +47 -0
  154. package/src/components/modals/ModalBase/ModalBase.styles.tsx +73 -0
  155. package/src/components/modals/ModalBase/ModalBase.tsx +72 -0
  156. package/src/components/modals/ModalBase/index.ts +2 -0
  157. package/src/components/modals/index.ts +2 -0
  158. package/src/index.ts +9 -0
  159. package/src/setupTests.ts +4 -0
  160. package/src/tokens/colors.ts +7 -0
  161. package/src/tokens/typography.ts +7 -1
  162. package/src/types.ts +8 -0
  163. package/tsconfig.json +1 -1
@@ -0,0 +1,261 @@
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
+ import classNames from 'classnames';
5
+
6
+ import { Button, ConfirmModal, Icon, IconButton } from '@/components';
7
+ import { PermafrostComponent } from '@/types';
8
+
9
+ import { StyledWizardWithSidebar } from './WizardWithSidebar.styles';
10
+
11
+ export type CancelText = {
12
+ // "confirm" button text
13
+ confirmText: string;
14
+ message?: string;
15
+ // "reject" button text
16
+ rejectText: string;
17
+ title: string;
18
+ // Optional, supporting text
19
+ };
20
+
21
+ type Props = PermafrostComponent & {
22
+ children: React.ReactNode;
23
+ /**
24
+ * text for the cancel confirmation modal
25
+ */
26
+ confirmCancel: CancelText;
27
+ disableNextStep?: boolean;
28
+ disablePrevStep?: boolean;
29
+ disableSubmit?: boolean;
30
+ isLastStep?: boolean;
31
+ /**
32
+ * for testing/mocking purposes
33
+ */
34
+ startingStep?: string;
35
+ stepSchema: {
36
+ [key: string]: {
37
+ inputsRequiringValidation: string[];
38
+ description: string[];
39
+ };
40
+ };
41
+ /**
42
+ * the text to appear on the submit button
43
+ */
44
+ submitButtonLabel: string;
45
+ /**
46
+ * Puts button in "busy" mode, and replaces button label with this text
47
+ */
48
+ submitProcessing?: string;
49
+ wizardTitle: string;
50
+ onCancel?(): void;
51
+ onNextPress?(): boolean;
52
+ /**
53
+ * returns the current step name to the parent component
54
+ */
55
+ onStepChange(stepName: string): void;
56
+ onSubmit(): void;
57
+ /**
58
+ * Allows for any custom attribute to be added directly to "next button" in wizard
59
+ */
60
+ nextButtonProps?: {
61
+ 'data-cy': string;
62
+ };
63
+
64
+ bottomNav?: boolean;
65
+ validationErrors?: any;
66
+ backgroundColor?: string;
67
+ color?: string;
68
+ buttonColor?: string;
69
+ };
70
+
71
+ export function WizardWithSidebar(props: Props) {
72
+ const {
73
+ children,
74
+ className,
75
+ confirmCancel,
76
+ disableNextStep,
77
+ disablePrevStep,
78
+ disableSubmit,
79
+ id,
80
+ isLastStep,
81
+ onCancel,
82
+ onNextPress,
83
+ onStepChange,
84
+ onSubmit,
85
+ startingStep,
86
+ stepSchema,
87
+ submitButtonLabel,
88
+ submitProcessing = '',
89
+ wizardTitle,
90
+ nextButtonProps,
91
+ validationErrors,
92
+ backgroundColor,
93
+ color,
94
+ buttonColor,
95
+ } = props;
96
+
97
+ const steps = Object.keys(stepSchema);
98
+ const [currentStep, setCurrentStep] = useState<string>(startingStep || steps[0]);
99
+ const [openCancelConfirm, setOpenCancelConfirm] = useState<boolean>(false);
100
+
101
+ const onLastStep: boolean = useMemo(() => {
102
+ if (isLastStep !== undefined) {
103
+ return isLastStep;
104
+ }
105
+
106
+ return steps.indexOf(currentStep) === steps.length - 1;
107
+ }, [isLastStep, steps, currentStep]);
108
+
109
+ const isBusy = !!(submitProcessing && submitProcessing.length > 0);
110
+
111
+ const nextStep = () => {
112
+ if (!onLastStep) {
113
+ const currentIndex = steps.indexOf(currentStep);
114
+
115
+ setCurrentStep(steps[currentIndex + 1]);
116
+ }
117
+ };
118
+
119
+ const prevStep = () => {
120
+ const currentIndex = steps.indexOf(currentStep);
121
+
122
+ if (currentIndex !== 0) {
123
+ setCurrentStep(steps[currentIndex - 1]);
124
+ }
125
+ };
126
+
127
+ // handles the user's selection in the cancel confirmation modal
128
+ const handleCancelRequest = (confirmCancel: boolean) => {
129
+ if (confirmCancel && onCancel) {
130
+ onCancel();
131
+ }
132
+
133
+ setOpenCancelConfirm(false);
134
+ };
135
+
136
+ const handleNextPress = () => {
137
+ const allowNext = onNextPress ? onNextPress() : true;
138
+
139
+ if (!allowNext) {
140
+ return;
141
+ }
142
+
143
+ if (onLastStep) {
144
+ handleSubmit();
145
+ } else {
146
+ nextStep();
147
+ }
148
+ };
149
+
150
+ const handleSubmit = () => {
151
+ onSubmit();
152
+ };
153
+
154
+ // report current step to the consuming component
155
+ useEffect(() => {
156
+ onStepChange(currentStep);
157
+ }, [currentStep]);
158
+
159
+ // ensures `currentStep` is reset on unmount, just in case
160
+ useEffect(() => {
161
+ return () => setCurrentStep(steps[0] || '');
162
+ }, []);
163
+
164
+ return (
165
+ <StyledWizardWithSidebar
166
+ className={className}
167
+ data-cy={props['data-cy']}
168
+ id={id}
169
+ backgroundcolor={backgroundColor}
170
+ color={color}
171
+ buttoncolor={buttonColor}
172
+ >
173
+ <div className="wizard-sidebar">
174
+ <h2> {wizardTitle}</h2>
175
+
176
+ {steps.map((step: string, index: number) => {
177
+ return (
178
+ <div
179
+ className={classNames('sidebar-step', {
180
+ ['current-step']: index === steps.indexOf(currentStep),
181
+ ['prior-step']: index < steps.indexOf(currentStep),
182
+ })}
183
+ key={step}
184
+ >
185
+ {(Object.keys(validationErrors ? validationErrors : []).some((error) =>
186
+ stepSchema[step].inputsRequiringValidation.includes(error),
187
+ ) ||
188
+ index > steps.indexOf(currentStep)) && (
189
+ <div className="sidebar-step__number-icon">{index + 1}</div>
190
+ )}
191
+
192
+ {!Object.keys(validationErrors ? validationErrors : []).some((error) =>
193
+ stepSchema[step].inputsRequiringValidation.includes(error),
194
+ ) &&
195
+ index <= steps.indexOf(currentStep) && (
196
+ <Icon name="fa-check-circle" className="sidebar-step__check-icon" />
197
+ )}
198
+ {step}
199
+ </div>
200
+ );
201
+ })}
202
+ </div>
203
+
204
+ <div className="wizard-content">
205
+ <div className="wizard-content__header">
206
+ <h2>{currentStep}</h2>
207
+ </div>
208
+ <div className="wizard-content__body">{children}</div>
209
+
210
+ <nav>
211
+ <div className="wizard-buttons">
212
+ <Button onClick={() => setOpenCancelConfirm(true)} variant="link-style">
213
+ Cancel
214
+ </Button>
215
+
216
+ {steps.indexOf(currentStep) !== 0 && (
217
+ <IconButton
218
+ variant="outline"
219
+ iconName="fa-arrow-left"
220
+ label="Previous Step"
221
+ onPress={prevStep}
222
+ isDisabled={disablePrevStep}
223
+ />
224
+ )}
225
+
226
+ {onLastStep ? (
227
+ <IconButton
228
+ variant="primary"
229
+ iconName="check"
230
+ busy={isBusy}
231
+ label={isBusy ? submitProcessing : submitButtonLabel}
232
+ onPress={handleNextPress}
233
+ isDisabled={disableSubmit}
234
+ />
235
+ ) : (
236
+ <IconButton
237
+ variant="primary"
238
+ iconSide="end"
239
+ iconName="fa-arrow-right"
240
+ label="Next Step"
241
+ onPress={handleNextPress}
242
+ isDisabled={disableNextStep}
243
+ {...nextButtonProps}
244
+ />
245
+ )}
246
+ </div>
247
+ </nav>
248
+ </div>
249
+
250
+ <ConfirmModal
251
+ title={confirmCancel.title}
252
+ message={confirmCancel.message}
253
+ confirmText={confirmCancel.confirmText}
254
+ rejectText={confirmCancel.rejectText}
255
+ open={openCancelConfirm}
256
+ clickOutsideHandler={() => setOpenCancelConfirm(false)}
257
+ responseHandler={handleCancelRequest}
258
+ />
259
+ </StyledWizardWithSidebar>
260
+ );
261
+ }
@@ -0,0 +1,2 @@
1
+ export { WizardWithSidebar } from './WizardWithSidebar';
2
+ export { StyledWizardWithSidebar } from './WizardWithSidebar.styles';
@@ -9,6 +9,7 @@ import {
9
9
  variantPrimary,
10
10
  disabledOverrides,
11
11
  } from '../commonStyles';
12
+ import { COLORS, ANIMATION } from '@/tokens';
12
13
 
13
14
  const iconMargin = '0.5em';
14
15
 
@@ -43,6 +44,36 @@ export const iconButton = css`
43
44
  ${variantPrimary};
44
45
  }
45
46
 
47
+ &.outline {
48
+ color: ${COLORS.midFontColor};
49
+ background: transparent;
50
+ border: 1px solid ${COLORS.midFontColor};
51
+ transition:
52
+ border ${ANIMATION.duration} ${ANIMATION.timing},
53
+ color ${ANIMATION.duration} ${ANIMATION.timing};
54
+
55
+ &:hover,
56
+ &:focus {
57
+ border: 1px solid ${COLORS.defaultFontColor};
58
+ color: ${COLORS.defaultFontColor};
59
+ background: transparent;
60
+ }
61
+
62
+ &:disabled {
63
+ border: 1px solid ${COLORS.midFontColor};
64
+ color: ${COLORS.midFontColor};
65
+ background: transparent;
66
+ opacity: 0.6;
67
+
68
+ &:hover {
69
+ background: transparent;
70
+ border: 1px solid ${COLORS.midFontColor};
71
+ color: ${COLORS.midFontColor};
72
+ opacity: 0.6;
73
+ }
74
+ }
75
+ }
76
+
46
77
  // todo: use this rule/selector after global styling removed
47
78
  //:not(:disabled):hover {
48
79
  // background-color: #bebebe;
@@ -6,11 +6,10 @@ import { useButton } from '@react-aria/button';
6
6
  import { useFocusRing } from '@react-aria/focus';
7
7
  import { AriaButtonProps } from '@react-types/button';
8
8
 
9
- import { IconName } from '@/types';
10
- import { Icon } from '@/components/Icon';
11
- import { CircleSpinner } from '@/components/loading-indicators';
12
- import { PermafrostComponent } from '@/types';
13
- import { ButtonSize, ButtonVariant } from '../types';
9
+ import { SPACING } from '@/tokens';
10
+ import { IconName, PermafrostComponent } from '@/types';
11
+ import { Icon, CircleSpinner } from '@/components';
12
+ import { ButtonSize, IconButtonVariant } from '../types';
14
13
 
15
14
  import { StyledIconButton, StyledIconButtonLink } from './IconButton.styles';
16
15
 
@@ -30,7 +29,7 @@ type Props = PermafrostComponent & {
30
29
  label?: string;
31
30
  size?: ButtonSize;
32
31
  style?: React.CSSProperties;
33
- variant?: ButtonVariant;
32
+ variant?: IconButtonVariant;
34
33
  } & AriaButtonProps;
35
34
 
36
35
  /**
@@ -60,6 +59,7 @@ export function IconButton(props: Props) {
60
59
  const buttonEl = useRef();
61
60
  const { buttonProps } = useButton(
62
61
  { ...props, onPress: busy ? undefined : props.onPress },
62
+ // @ts-ignore
63
63
  buttonEl,
64
64
  );
65
65
  const { isFocusVisible, focusProps } = useFocusRing();
@@ -85,6 +85,7 @@ export function IconButton(props: Props) {
85
85
  style={{
86
86
  marginTop: `${adjustAlignment}px`,
87
87
  marginBottom: `${Math.abs(adjustAlignment)}px`,
88
+ marginRight: `${SPACING.xs}`,
88
89
  }}
89
90
  />
90
91
  ) : (
@@ -105,6 +106,7 @@ export function IconButton(props: Props) {
105
106
  }
106
107
 
107
108
  return (
109
+ // @ts-ignore
108
110
  <StyledIconButton {...commonProps}>
109
111
  {iconElement} {labelElement}
110
112
  </StyledIconButton>
@@ -1,2 +1,3 @@
1
- export type ButtonVariant = 'default' | 'primary' | 'destructive';
1
+ export type ButtonVariant = 'primary' | 'cta' | 'normal' | 'link-style' | 'no-style' | 'outline';
2
+ export type IconButtonVariant = 'default' | 'primary' | 'destructive' | 'outline';
2
3
  export type ButtonSize = 'normal' | 'large';
@@ -11,7 +11,13 @@ export {
11
11
  LoadingList,
12
12
  PercentageRing,
13
13
  RandomLoadingMessage,
14
+ LoadingIndicator,
14
15
  } from './loading-indicators';
15
16
  export { ListTable } from './ListTable';
16
17
  export { Pagination } from './Pagination';
17
18
  export { Shrug } from './user-feedback';
19
+ export { ConfirmModal, ModalBase } from './modals';
20
+ export { LoadingAwareContainer } from './LoadingAwareContainer';
21
+ export { Wizard, WizardCard, WizardSection, StyledWizard } from './Wizard';
22
+ export { WizardWithSidebar } from './WizardWithSidebar';
23
+ export { Drawer } from './Navigation/Drawer';
@@ -4,11 +4,7 @@ import { TYPOGRAPHY } from '@/tokens';
4
4
 
5
5
  import { inputCommon } from '../inputsCommon.styles';
6
6
 
7
- export const StyledSearchField = styled.div<{
8
- border?: boolean;
9
- showSearchIcon?: boolean;
10
- showClearInputIcon?: boolean;
11
- }>`
7
+ export const StyledSearchField = styled.div`
12
8
  position: relative;
13
9
  background: transparent;
14
10
 
@@ -17,49 +13,39 @@ export const StyledSearchField = styled.div<{
17
13
  top: 4px;
18
14
  left: 0;
19
15
  font-size: ${TYPOGRAPHY.fontSize.subheadSmall};
20
-
21
- ${(props) =>
22
- props.border &&
23
- props.showSearchIcon &&
24
- css`
25
- top: 7px;
26
- left: 5px;
27
- `}
28
16
  }
29
17
 
30
18
  input {
31
19
  ${inputCommon};
32
-
33
20
  padding: 5px;
34
21
  font-size: ${TYPOGRAPHY.fontSize.base};
35
22
  margin-bottom: 0;
36
- ${(props) =>
37
- props.border &&
38
- css`
39
- border: 1px solid currentColor;
40
- border-radius: 4px;
41
- `}
42
- ${(props) =>
43
- props.showSearchIcon &&
44
- css`
45
- padding: 5px 5px 5px 25px;
46
- `}
47
23
  }
48
24
 
49
- ${(props) =>
50
- props.showClearInputIcon &&
51
- css`
52
- .clear-input {
53
- cursor: pointer;
54
- height: 10px;
55
- width: 10px;
56
- position: absolute;
57
- right: 10px;
58
- top: 50%;
59
- transform: translateY(-50%);
60
- &:hover {
61
- opacity: 0.5;
62
- }
63
- }
64
- `}
25
+ &.border.showSearchIcon label {
26
+ top: 7px;
27
+ left: 5px;
28
+ }
29
+
30
+ &.border input {
31
+ border: 1px solid currentColor;
32
+ border-radius: 4px;
33
+ }
34
+
35
+ &.showSearchIcon input {
36
+ padding: 5px 5px 5px 25px;
37
+ }
38
+
39
+ &.showClearInputIcon .clear-input {
40
+ cursor: pointer;
41
+ height: 10px;
42
+ width: 10px;
43
+ position: absolute;
44
+ right: 10px;
45
+ top: 50%;
46
+ transform: translateY(-50%);
47
+ &:hover {
48
+ opacity: 0.5;
49
+ }
50
+ }
65
51
  `;
@@ -2,6 +2,7 @@
2
2
 
3
3
  import React from 'react';
4
4
  import { v4 as uuid } from 'uuid';
5
+ import classNames from 'classnames';
5
6
 
6
7
  import { Icon } from '@/components/Icon';
7
8
  import { PermafrostComponent } from '@/types';
@@ -39,10 +40,11 @@ export const SearchInput = (props: Props) => {
39
40
 
40
41
  return (
41
42
  <StyledSearchField
42
- className={className}
43
- border={border}
44
- showSearchIcon={showSearchIcon}
45
- showClearInputIcon={showClearInputIcon}
43
+ className={classNames(className, {
44
+ border,
45
+ showSearchIcon,
46
+ showClearInputIcon,
47
+ })}
46
48
  data-cy={props['data-cy']}
47
49
  >
48
50
  {showSearchIcon && (
@@ -23,14 +23,14 @@ const ripple = (size: string) => keyframes`
23
23
  const animationSpeed = 1.4;
24
24
 
25
25
  export const StyledLoadingIndicator = styled.div<{
26
- overallSize: string;
27
- rippleSize: string;
26
+ overallsize: string;
27
+ ripplesize: string;
28
28
  }>`
29
29
  display: grid;
30
30
  place-items: center;
31
31
 
32
- width: ${(props) => props.overallSize};
33
- height: ${(props) => props.overallSize};
32
+ width: ${(props) => props.overallsize};
33
+ height: ${(props) => props.overallsize};
34
34
 
35
35
  margin-left: auto;
36
36
  margin-right: auto;
@@ -43,7 +43,7 @@ export const StyledLoadingIndicator = styled.div<{
43
43
 
44
44
  grid-area: 1 / 1;
45
45
 
46
- animation: ${(props) => ripple(props.rippleSize)} ${animationSpeed}s
46
+ animation: ${(props) => ripple(props.ripplesize)} ${animationSpeed}s
47
47
  cubic-bezier(0, 0.2, 0.8, 1) infinite;
48
48
 
49
49
  @media (prefers-reduced-motion) {
@@ -60,7 +60,7 @@ export const StyledLoadingIndicator = styled.div<{
60
60
  }
61
61
  `;
62
62
 
63
- export const StyledMessageLoadingIndicator = styled.div<{ overallSize: string }>`
63
+ export const StyledMessageLoadingIndicator = styled.div<{ overallsize: string }>`
64
64
  display: block;
65
65
 
66
66
  > * {
@@ -71,7 +71,7 @@ export const StyledMessageLoadingIndicator = styled.div<{ overallSize: string }>
71
71
  .message {
72
72
  text-align: center;
73
73
  display: block;
74
- width: ${(props) => props.overallSize};
74
+ width: ${(props) => props.overallsize};
75
75
  margin-top: -50px;
76
76
 
77
77
  color: ${COLORS.lightFontColor};
@@ -32,8 +32,8 @@ export function CirclePulse(props: Props): React.ReactElement {
32
32
  className={className}
33
33
  data-cy={props['data-cy']}
34
34
  id={id}
35
- overallSize={returnSizeString(overallSize)}
36
- rippleSize={returnSizeString(rippleSize)}
35
+ overallsize={returnSizeString(overallSize)}
36
+ ripplesize={returnSizeString(rippleSize)}
37
37
  style={color ? { color } : { color: COLORS.curiousBlue }}
38
38
  />
39
39
  );
@@ -41,7 +41,7 @@ export function CirclePulse(props: Props): React.ReactElement {
41
41
 
42
42
  if (showRandomMessage) {
43
43
  return (
44
- <StyledMessageLoadingIndicator overallSize={returnSizeString(overallSize)}>
44
+ <StyledMessageLoadingIndicator overallsize={returnSizeString(overallSize)}>
45
45
  {loadingIndicator()}
46
46
 
47
47
  <RandomLoadingMessage />
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
+
4
+ import { LoadingIndicator } from './LoadingIndicator';
5
+
6
+ const meta = {
7
+ component: LoadingIndicator,
8
+ title: 'LoadingIndicator',
9
+ } satisfies Meta<typeof LoadingIndicator>;
10
+
11
+ export default meta;
12
+ type Story = StoryObj<typeof LoadingIndicator>;
13
+
14
+ export const Normal: Story = {
15
+ args: {},
16
+ };
17
+ export const CustomColor: Story = {
18
+ args: { color: '#f0f' },
19
+ };
20
+
21
+ export const WithRandomMessage: Story = {
22
+ args: { showRandomMessage: true },
23
+ };
@@ -0,0 +1,81 @@
1
+ import styled, { keyframes } from 'styled-components';
2
+
3
+ import { COLORS, TYPOGRAPHY } from '@/tokens';
4
+
5
+ const ripple = (size: string) => keyframes`
6
+ 0% {
7
+ width: 0;
8
+ height: 0;
9
+ opacity: 0;
10
+ }
11
+
12
+ 20% {
13
+ opacity: 1;
14
+ }
15
+
16
+ 100% {
17
+ width: ${size};
18
+ height: ${size};
19
+ opacity: 0;
20
+ }
21
+ `;
22
+
23
+ const animationSpeed = 1.4;
24
+
25
+ export const StyledLoadingIndicator = styled.div<{
26
+ overallsize: string;
27
+ ripplesize: string;
28
+ }>`
29
+ display: grid;
30
+ place-items: center;
31
+
32
+ width: ${(props) => props.overallsize};
33
+ height: ${(props) => props.overallsize};
34
+
35
+ margin-left: auto;
36
+ margin-right: auto;
37
+
38
+ &:before,
39
+ &:after {
40
+ content: '';
41
+ border: 4px solid currentColor;
42
+ border-radius: 50%;
43
+
44
+ grid-area: 1 / 1;
45
+
46
+ animation: ${(props) => ripple(props.ripplesize)} ${animationSpeed}s
47
+ cubic-bezier(0, 0.2, 0.8, 1) infinite;
48
+
49
+ @media (prefers-reduced-motion) {
50
+ animation-duration: ${animationSpeed * 2}s;
51
+ }
52
+ }
53
+
54
+ &:after {
55
+ animation-delay: -${animationSpeed / 2}s;
56
+
57
+ @media (prefers-reduced-motion) {
58
+ animation-delay: -${animationSpeed}s;
59
+ }
60
+ }
61
+ `;
62
+
63
+ export const StyledMessageLoadingIndicator = styled.div<{ overallsize: string }>`
64
+ display: block;
65
+
66
+ > * {
67
+ margin-left: auto;
68
+ margin-right: auto;
69
+ }
70
+
71
+ .message {
72
+ text-align: center;
73
+ display: block;
74
+ width: ${(props) => props.overallsize};
75
+ margin-top: -50px;
76
+
77
+ color: ${COLORS.lightFontColor};
78
+ font-size: ${TYPOGRAPHY.fontSize.base};
79
+ font-style: italic;
80
+ }
81
+ `;