@nypl/design-system-react-components 0.25.3 → 0.25.4

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 (131) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +47 -11
  3. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +4 -0
  4. package/dist/components/Button/Button.d.ts +9 -6
  5. package/dist/components/Button/ButtonTypes.d.ts +2 -1
  6. package/dist/components/Card/Card.d.ts +0 -25
  7. package/dist/components/Icons/IconSvgs.d.ts +3 -0
  8. package/dist/components/Icons/IconTypes.d.ts +3 -0
  9. package/dist/components/Notification/Notification.d.ts +6 -4
  10. package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +29 -0
  11. package/dist/components/ProgressIndicator/ProgressIndicatorTypes.d.ts +8 -0
  12. package/dist/components/SearchBar/SearchBar.d.ts +3 -3
  13. package/dist/components/Slider/Slider.d.ts +57 -0
  14. package/dist/components/Tabs/Tabs.d.ts +1 -1
  15. package/dist/components/TextInput/TextInput.d.ts +6 -0
  16. package/dist/design-system-react-components.cjs.development.js +707 -454
  17. package/dist/design-system-react-components.cjs.development.js.map +1 -1
  18. package/dist/design-system-react-components.cjs.production.min.js +1 -1
  19. package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
  20. package/dist/design-system-react-components.esm.js +700 -441
  21. package/dist/design-system-react-components.esm.js.map +1 -1
  22. package/dist/index.d.ts +6 -3
  23. package/dist/resources.scss +180 -170
  24. package/dist/styles.css +1 -1
  25. package/dist/theme/components/button.d.ts +10 -0
  26. package/dist/theme/components/progressIndicator.d.ts +50 -0
  27. package/dist/theme/components/slider.d.ts +51 -0
  28. package/dist/theme/foundations/breakpoints.d.ts +8 -8
  29. package/dist/theme/foundations/global.d.ts +6 -1
  30. package/package.json +72 -84
  31. package/src/__tests__/setup.ts +2 -2
  32. package/src/components/Accordion/Accordion.stories.mdx +30 -34
  33. package/src/components/Autosuggest/Autosuggest.stories.mdx +3 -3
  34. package/src/components/Autosuggest/Autosuggest.stories.tsx +1 -0
  35. package/src/components/Autosuggest/_Autosuggest.scss +5 -5
  36. package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +5 -6
  37. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +23 -0
  38. package/src/components/Breadcrumbs/Breadcrumbs.tsx +5 -1
  39. package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +198 -1
  40. package/src/components/Button/Button.stories.mdx +8 -6
  41. package/src/components/Button/Button.test.tsx +20 -0
  42. package/src/components/Button/Button.tsx +14 -23
  43. package/src/components/Button/ButtonTypes.tsx +1 -0
  44. package/src/components/Button/__snapshots__/Button.test.tsx.snap +29 -4
  45. package/src/components/Card/Card.stories.mdx +1 -1
  46. package/src/components/Card/Card.tsx +3 -3
  47. package/src/components/CardEdition/CardEdition.stories.tsx +15 -47
  48. package/src/components/CardEdition/_CardEdition.scss +22 -23
  49. package/src/components/Chakra/Box.stories.mdx +14 -15
  50. package/src/components/Chakra/Center.stories.mdx +15 -8
  51. package/src/components/Chakra/Grid.stories.mdx +16 -7
  52. package/src/components/Chakra/Stack.stories.mdx +35 -18
  53. package/src/components/DatePicker/DatePicker.test.tsx +31 -30
  54. package/src/components/DatePicker/DatePicker.tsx +7 -4
  55. package/src/components/DatePicker/_DatePicker.scss +4 -4
  56. package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +19 -5
  57. package/src/components/Form/Form.stories.mdx +4 -5
  58. package/src/components/Grid/SimpleGrid.stories.mdx +1 -0
  59. package/src/components/Hero/HeroTypes.tsx +1 -0
  60. package/src/components/HorizontalRule/HorizontalRule.stories.mdx +2 -3
  61. package/src/components/Icons/Icon.stories.mdx +2 -3
  62. package/src/components/Icons/IconSvgs.tsx +6 -0
  63. package/src/components/Icons/IconTypes.tsx +3 -0
  64. package/src/components/Image/Image.stories.mdx +2 -3
  65. package/src/components/Input/Input.stories.tsx +20 -64
  66. package/src/components/Input/_Input.scss +23 -14
  67. package/src/components/Modal/Modal.stories.mdx +3 -3
  68. package/src/components/Modal/_Modal.scss +2 -2
  69. package/src/components/Notification/Notification.stories.mdx +1 -1
  70. package/src/components/Notification/Notification.tsx +13 -4
  71. package/src/components/Pagination/Pagination.stories.mdx +3 -2
  72. package/src/components/Pagination/Pagination.stories.tsx +1 -2
  73. package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +292 -0
  74. package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +225 -0
  75. package/src/components/ProgressIndicator/ProgressIndicator.tsx +126 -0
  76. package/src/components/ProgressIndicator/ProgressIndicatorTypes.ts +8 -0
  77. package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +357 -0
  78. package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +3 -0
  79. package/src/components/RadioGroup/RadioGroup.stories.mdx +2 -3
  80. package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +4 -0
  81. package/src/components/SearchBar/SearchBar.Test.tsx +2 -1
  82. package/src/components/SearchBar/SearchBar.stories.mdx +109 -9
  83. package/src/components/SearchBar/SearchBar.tsx +11 -4
  84. package/src/components/Select/SelectTypes.tsx +1 -0
  85. package/src/components/Slider/Slider.stories.mdx +529 -0
  86. package/src/components/Slider/Slider.test.tsx +653 -0
  87. package/src/components/Slider/Slider.tsx +303 -0
  88. package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +1946 -0
  89. package/src/components/StyleGuide/Bidirectionality.stories.mdx +1 -1
  90. package/src/components/StyleGuide/Breakpoints.stories.mdx +21 -7
  91. package/src/components/StyleGuide/Buttons.stories.mdx +9 -2
  92. package/src/components/StyleGuide/DesignTokens.stories.mdx +170 -0
  93. package/src/components/Tabs/Tabs.tsx +5 -5
  94. package/src/components/Template/Template.stories.mdx +6 -6
  95. package/src/components/TextInput/TextInput.stories.mdx +1 -1
  96. package/src/components/TextInput/TextInput.tsx +15 -2
  97. package/src/components/TextInput/TextInputTypes.tsx +2 -0
  98. package/src/components/VideoPlayer/VideoPlayer.stories.mdx +2 -3
  99. package/src/docs/Chakra.stories.mdx +2 -2
  100. package/src/index.ts +10 -6
  101. package/src/resources.scss +5 -5
  102. package/src/styles/base/{_02-breakpoints.scss → _01-breakpoints.scss} +9 -10
  103. package/src/styles/base/{_03-mixins.scss → _02-mixins.scss} +16 -5
  104. package/src/styles/base/{_04-base.scss → _03-base.scss} +7 -2
  105. package/src/styles/base/{_05-focus.scss → _04-focus.scss} +0 -15
  106. package/src/styles/base/_place-holder.scss +14 -3
  107. package/src/styles/{03-space → space}/_space-inline.scss +14 -14
  108. package/src/styles/{03-space → space}/_space-inset.scss +10 -10
  109. package/src/styles/space/_space-stack.scss +116 -0
  110. package/src/styles.scss +13 -44
  111. package/src/theme/components/button.ts +10 -2
  112. package/src/theme/components/card.ts +11 -9
  113. package/src/theme/components/datePicker.ts +1 -1
  114. package/src/theme/components/list.ts +2 -2
  115. package/src/theme/components/notification.ts +5 -3
  116. package/src/theme/components/progressIndicator.ts +62 -0
  117. package/src/theme/components/skeletonLoader.ts +1 -1
  118. package/src/theme/components/slider.ts +79 -0
  119. package/src/theme/foundations/breakpoints.ts +8 -8
  120. package/src/theme/foundations/global.ts +6 -1
  121. package/src/theme/index.ts +4 -0
  122. package/src/utils/componentCategories.ts +3 -3
  123. package/src/styles/01-colors/_colors-brand.scss +0 -62
  124. package/src/styles/01-colors/_colors-utility.scss +0 -67
  125. package/src/styles/02-typography/_type-scale.css +0 -11
  126. package/src/styles/02-typography/_type-weight.css +0 -7
  127. package/src/styles/02-typography/_typefaces.css +0 -4
  128. package/src/styles/03-space/_space-stack.scss +0 -116
  129. package/src/styles/03-space/_space.css +0 -30
  130. package/src/styles/base/_card-grid.scss +0 -77
  131. package/src/styles/base/_typography.scss +0 -11
@@ -87,7 +87,204 @@ exports[`Breadcrumbs Snapshot Renders the UI snapshot correctly 1`] = `
87
87
  <span
88
88
  aria-current="page"
89
89
  className="chakra-breadcrumb__link css-0"
90
- href="#string3"
90
+ >
91
+ <span
92
+ className="breadcrumb-label"
93
+ >
94
+ string3
95
+ </span>
96
+ </span>
97
+ </li>
98
+ </ol>
99
+ </nav>
100
+ `;
101
+
102
+ exports[`Breadcrumbs Snapshot Renders the UI snapshot correctly 2`] = `
103
+ <nav
104
+ aria-label="breadcrumb"
105
+ className="chakra-breadcrumb css-0"
106
+ id="breadcrumbs-test"
107
+ >
108
+ <ol
109
+ className="chakra-breadcrumb__list css-0"
110
+ >
111
+ <li
112
+ className="chakra-breadcrumb__list-item css-18biwo"
113
+ >
114
+ <a
115
+ className="chakra-breadcrumb__link css-0"
116
+ href="#string1"
117
+ >
118
+ <span
119
+ className="breadcrumb-label"
120
+ >
121
+ string1
122
+ </span>
123
+ </a>
124
+ <span
125
+ className="css-t4q1nq"
126
+ role="presentation"
127
+ >
128
+ /
129
+ </span>
130
+ </li>
131
+ <li
132
+ className="chakra-breadcrumb__list-item css-18biwo"
133
+ >
134
+ <a
135
+ className="chakra-breadcrumb__link css-0"
136
+ href="#string2"
137
+ >
138
+ <svg
139
+ aria-hidden={true}
140
+ className="chakra-icon breadcrumbs-icon css-onkibi"
141
+ focusable={false}
142
+ id="breadcrumbs-test__backarrow"
143
+ role="img"
144
+ title="arrow icon"
145
+ viewBox="0 0 24 24"
146
+ >
147
+ <g
148
+ stroke="currentColor"
149
+ strokeWidth="1.5"
150
+ >
151
+ <path
152
+ d="M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"
153
+ fill="none"
154
+ strokeLinecap="round"
155
+ />
156
+ <path
157
+ d="M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"
158
+ fill="currentColor"
159
+ strokeLinecap="round"
160
+ />
161
+ <circle
162
+ cx="12"
163
+ cy="12"
164
+ fill="none"
165
+ r="11.25"
166
+ strokeMiterlimit="10"
167
+ />
168
+ </g>
169
+ </svg>
170
+ <span
171
+ className="breadcrumb-label"
172
+ >
173
+ string2
174
+ </span>
175
+ </a>
176
+ <span
177
+ className="css-t4q1nq"
178
+ role="presentation"
179
+ >
180
+ /
181
+ </span>
182
+ </li>
183
+ <li
184
+ className="chakra-breadcrumb__list-item css-18biwo"
185
+ >
186
+ <span
187
+ aria-current="page"
188
+ className="chakra-breadcrumb__link css-0"
189
+ >
190
+ <span
191
+ className="breadcrumb-label"
192
+ >
193
+ string3
194
+ </span>
195
+ </span>
196
+ </li>
197
+ </ol>
198
+ </nav>
199
+ `;
200
+
201
+ exports[`Breadcrumbs Snapshot Renders the UI snapshot correctly 3`] = `
202
+ <nav
203
+ aria-label="breadcrumb"
204
+ className="chakra-breadcrumb css-1f2fw9u"
205
+ id="breadcrumbs-test"
206
+ >
207
+ <ol
208
+ className="chakra-breadcrumb__list css-0"
209
+ >
210
+ <li
211
+ className="chakra-breadcrumb__list-item css-18biwo"
212
+ >
213
+ <a
214
+ className="chakra-breadcrumb__link css-0"
215
+ href="#string1"
216
+ >
217
+ <span
218
+ className="breadcrumb-label"
219
+ >
220
+ string1
221
+ </span>
222
+ </a>
223
+ <span
224
+ className="css-t4q1nq"
225
+ role="presentation"
226
+ >
227
+ /
228
+ </span>
229
+ </li>
230
+ <li
231
+ className="chakra-breadcrumb__list-item css-18biwo"
232
+ >
233
+ <a
234
+ className="chakra-breadcrumb__link css-0"
235
+ href="#string2"
236
+ >
237
+ <svg
238
+ aria-hidden={true}
239
+ className="chakra-icon breadcrumbs-icon css-onkibi"
240
+ focusable={false}
241
+ id="breadcrumbs-test__backarrow"
242
+ role="img"
243
+ title="arrow icon"
244
+ viewBox="0 0 24 24"
245
+ >
246
+ <g
247
+ stroke="currentColor"
248
+ strokeWidth="1.5"
249
+ >
250
+ <path
251
+ d="M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"
252
+ fill="none"
253
+ strokeLinecap="round"
254
+ />
255
+ <path
256
+ d="M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"
257
+ fill="currentColor"
258
+ strokeLinecap="round"
259
+ />
260
+ <circle
261
+ cx="12"
262
+ cy="12"
263
+ fill="none"
264
+ r="11.25"
265
+ strokeMiterlimit="10"
266
+ />
267
+ </g>
268
+ </svg>
269
+ <span
270
+ className="breadcrumb-label"
271
+ >
272
+ string2
273
+ </span>
274
+ </a>
275
+ <span
276
+ className="css-t4q1nq"
277
+ role="presentation"
278
+ >
279
+ /
280
+ </span>
281
+ </li>
282
+ <li
283
+ className="chakra-breadcrumb__list-item css-18biwo"
284
+ >
285
+ <span
286
+ aria-current="page"
287
+ className="chakra-breadcrumb__link css-0"
91
288
  >
92
289
  <span
93
290
  className="breadcrumb-label"
@@ -28,8 +28,7 @@ import DSProvider from "../../theme/provider";
28
28
  parameters={{
29
29
  design: {
30
30
  type: "figma",
31
- url:
32
- "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=11477%3A2298",
31
+ url: "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=11477%3A2298",
33
32
  },
34
33
  jest: ["Button.test.tsx"],
35
34
  }}
@@ -40,7 +39,7 @@ import DSProvider from "../../theme/provider";
40
39
  | Component Version | DS Version |
41
40
  | ----------------- | ---------- |
42
41
  | Added | `0.0.4` |
43
- | Latest | `0.25.3` |
42
+ | Latest | `0.25.4` |
44
43
 
45
44
  <Description of={Button} />
46
45
 
@@ -53,6 +52,8 @@ that can be rendered.
53
52
  - `ButtonTypes.Pill` is used for equally weighted actions within cards and always in a set.
54
53
  - `ButtonTypes.Link` is used for equally weighted actions in a text based list.
55
54
  - `ButtonTypes.SearchBar` is a variant only used in the `SearchBar` component.
55
+ - `ButtonTypes.NoBrand` is a variant used when there is no brand and will display
56
+ the background color as black.
56
57
 
57
58
  When one and only one `Icon` component is passed inside a `Button` component with
58
59
  no text, it will automatically be configured to use the `"iconOnly"` type.
@@ -230,17 +231,18 @@ The different `ButtonTypes` modified by the `buttonType` prop:
230
231
  <Button buttonType={ButtonTypes.Callout}>Callout</Button>
231
232
  <Button buttonType={ButtonTypes.Pill}>Pill</Button>
232
233
  <Button buttonType={ButtonTypes.Link}>Link</Button>
234
+ <Button buttonType={ButtonTypes.NoBrand}>NoBrand</Button>
233
235
  </ButtonGroup>
234
236
  </DSProvider>
235
237
  </Canvas>
236
238
 
237
- Modifying the `disabled` prop:
239
+ Modifying the `isDisabled` prop:
238
240
 
239
241
  <Canvas>
240
242
  <DSProvider>
241
243
  <ButtonGroup>
242
- <Button disabled={false}>Enabled</Button>
243
- <Button disabled={true}>Disabled</Button>
244
+ <Button isDisabled={false}>Enabled</Button>
245
+ <Button isDisabled>isDisabled</Button>
244
246
  </ButtonGroup>
245
247
  </DSProvider>
246
248
  </Canvas>
@@ -107,6 +107,13 @@ describe("Button Snapshot", () => {
107
107
  </Button>
108
108
  )
109
109
  .toJSON();
110
+ const disabled = renderer
111
+ .create(
112
+ <Button id="button" onClick={jest.fn()} isDisabled>
113
+ Disabled
114
+ </Button>
115
+ )
116
+ .toJSON();
110
117
  const secondary = renderer
111
118
  .create(
112
119
  <Button
@@ -154,12 +161,25 @@ describe("Button Snapshot", () => {
154
161
  </Button>
155
162
  )
156
163
  .toJSON();
164
+ const noBrand = renderer
165
+ .create(
166
+ <Button
167
+ id="button"
168
+ onClick={jest.fn()}
169
+ buttonType={ButtonTypes.NoBrand}
170
+ >
171
+ NoBrand
172
+ </Button>
173
+ )
174
+ .toJSON();
157
175
 
158
176
  expect(primary).toMatchSnapshot();
177
+ expect(disabled).toMatchSnapshot();
159
178
  expect(secondary).toMatchSnapshot();
160
179
  expect(callout).toMatchSnapshot();
161
180
  expect(pill).toMatchSnapshot();
162
181
  expect(link).toMatchSnapshot();
163
182
  expect(searchBar).toMatchSnapshot();
183
+ expect(noBrand).toMatchSnapshot();
164
184
  });
165
185
  });
@@ -3,6 +3,8 @@ import { Button as ChakraButton, useStyleConfig } from "@chakra-ui/react";
3
3
 
4
4
  import { ButtonTypes } from "./ButtonTypes";
5
5
  import Icon from "../Icons/Icon";
6
+ import { getVariant } from "../../utils/utils";
7
+ import generateUUID from "../../helpers/generateUUID";
6
8
 
7
9
  type ButtonElementType = "submit" | "button" | "reset";
8
10
 
@@ -13,35 +15,24 @@ interface ButtonProps {
13
15
  attributes?: { [key: string]: any };
14
16
  /** The kind of button assigned through the `ButtonTypes` enum */
15
17
  buttonType?: ButtonTypes;
16
- /** Additional className for use with BEM. See how to work with blockNames and BEM here: http://getbem.com/introduction/ */
18
+ /** Additional className to use. */
17
19
  className?: string;
18
- /** Adds 'disabled' property to the button */
19
- disabled?: boolean;
20
20
  /** ID that other components can cross reference for accessibility purposes */
21
21
  id?: string;
22
- /** Trigger the Button's action through the `mouseDown` event handler instead of `onClick`. `false` by default. */
22
+ /** Adds 'disabled' property to the button */
23
+ isDisabled?: boolean;
24
+ /** Trigger the Button's action through the `mouseDown` event handler instead
25
+ * of `onClick`. `false` by default. */
23
26
  mouseDown?: boolean;
24
27
  /** The action to perform on the `<button>`'s onClick function */
25
28
  onClick?: (event: React.MouseEvent | React.KeyboardEvent) => void;
26
- /** The html button attribute */
29
+ /** The HTML button type attribute. */
27
30
  type?: ButtonElementType;
28
31
  }
29
32
 
30
- // Used to map between ButtonTypes enum values and Chakra variant options.
31
- const variantMap = {};
32
- for (const type in ButtonTypes) {
33
- variantMap[ButtonTypes[type]] = ButtonTypes[type];
34
- }
35
-
36
33
  /**
37
- * Map the ButtonType to the Button Chakra theme variant object. If a wrong
38
- * value is passed (typically in non-Typescript scenarios), then the default
39
- * is the "primary" variant.
34
+ * Renders a simple `button` element with custom variant styles.
40
35
  */
41
- const getVariant = (buttonType) =>
42
- variantMap[buttonType] || ButtonTypes.Primary;
43
-
44
- /** Renders a simple `button` element with custom classes and modifiers. */
45
36
  function Button(props: React.PropsWithChildren<ButtonProps>) {
46
37
  const {
47
38
  additionalStyles = {},
@@ -49,8 +40,8 @@ function Button(props: React.PropsWithChildren<ButtonProps>) {
49
40
  buttonType,
50
41
  children,
51
42
  className = "",
52
- disabled,
53
- id,
43
+ isDisabled,
44
+ id = generateUUID(),
54
45
  mouseDown = false,
55
46
  onClick,
56
47
  type = "button",
@@ -59,7 +50,7 @@ function Button(props: React.PropsWithChildren<ButtonProps>) {
59
50
  let childCount = 0;
60
51
  let hasIcon = false;
61
52
  let variant;
62
- let styles;
53
+ let styles = {};
63
54
 
64
55
  React.Children.map(children, (child: React.ReactElement) => {
65
56
  childCount++;
@@ -76,7 +67,7 @@ function Button(props: React.PropsWithChildren<ButtonProps>) {
76
67
  if (childCount === 1 && hasIcon) {
77
68
  variant = "iconOnly";
78
69
  } else {
79
- variant = getVariant(buttonType);
70
+ variant = getVariant(buttonType, ButtonTypes, ButtonTypes.Primary);
80
71
  }
81
72
 
82
73
  styles = useStyleConfig("Button", { variant });
@@ -87,7 +78,7 @@ function Button(props: React.PropsWithChildren<ButtonProps>) {
87
78
  data-testid="button"
88
79
  className={className}
89
80
  type={type}
90
- disabled={disabled}
81
+ isDisabled={isDisabled}
91
82
  __css={{ ...styles, ...additionalStyles }}
92
83
  {...attributes}
93
84
  {...btnCallback}
@@ -5,4 +5,5 @@ export enum ButtonTypes {
5
5
  Pill = "pill",
6
6
  Link = "link",
7
7
  SearchBar = "searchBar",
8
+ NoBrand = "noBrand",
8
9
  }
@@ -16,11 +16,12 @@ exports[`Button Snapshot Renders the UI snapshot correctly 2`] = `
16
16
  <button
17
17
  className="chakra-button css-0"
18
18
  data-testid="button"
19
+ disabled={true}
19
20
  id="button"
20
21
  onClick={[MockFunction]}
21
22
  type="button"
22
23
  >
23
- Seconday
24
+ Disabled
24
25
  </button>
25
26
  `;
26
27
 
@@ -32,7 +33,7 @@ exports[`Button Snapshot Renders the UI snapshot correctly 3`] = `
32
33
  onClick={[MockFunction]}
33
34
  type="button"
34
35
  >
35
- Callout
36
+ Seconday
36
37
  </button>
37
38
  `;
38
39
 
@@ -44,7 +45,7 @@ exports[`Button Snapshot Renders the UI snapshot correctly 4`] = `
44
45
  onClick={[MockFunction]}
45
46
  type="button"
46
47
  >
47
- Pill
48
+ Callout
48
49
  </button>
49
50
  `;
50
51
 
@@ -56,11 +57,23 @@ exports[`Button Snapshot Renders the UI snapshot correctly 5`] = `
56
57
  onClick={[MockFunction]}
57
58
  type="button"
58
59
  >
59
- Link
60
+ Pill
60
61
  </button>
61
62
  `;
62
63
 
63
64
  exports[`Button Snapshot Renders the UI snapshot correctly 6`] = `
65
+ <button
66
+ className="chakra-button css-0"
67
+ data-testid="button"
68
+ id="button"
69
+ onClick={[MockFunction]}
70
+ type="button"
71
+ >
72
+ Link
73
+ </button>
74
+ `;
75
+
76
+ exports[`Button Snapshot Renders the UI snapshot correctly 7`] = `
64
77
  <button
65
78
  className="chakra-button css-0"
66
79
  data-testid="button"
@@ -71,3 +84,15 @@ exports[`Button Snapshot Renders the UI snapshot correctly 6`] = `
71
84
  SearchBar
72
85
  </button>
73
86
  `;
87
+
88
+ exports[`Button Snapshot Renders the UI snapshot correctly 8`] = `
89
+ <button
90
+ className="chakra-button css-0"
91
+ data-testid="button"
92
+ id="button"
93
+ onClick={[MockFunction]}
94
+ type="button"
95
+ >
96
+ NoBrand
97
+ </button>
98
+ `;
@@ -544,7 +544,7 @@ Instead of passing a path for the `imageSrc` prop, you can pass a custom image c
544
544
  <CardHeading level={HeadingLevels.Two} id="img1-heading1">
545
545
  Card Component with Custom Image Component
546
546
  </CardHeading>
547
- <CardHeading level={HeadingLevels.Four} id="img2-heading2">
547
+ <CardHeading level={HeadingLevels.Three} id="img2-heading2">
548
548
  Secondary Heading
549
549
  </CardHeading>
550
550
  <CardContent>
@@ -72,7 +72,7 @@ export interface CardProps extends CardBaseProps, CardLinkBoxProps {
72
72
  * renders an `Image` component but with overriding styles specific to the
73
73
  * `Card` component.
74
74
  */
75
- export function CardImage(props: React.ComponentProps<"img"> & CardImageProps) {
75
+ function CardImage(props: React.ComponentProps<"img"> & CardImageProps) {
76
76
  const {
77
77
  alt,
78
78
  center,
@@ -130,7 +130,7 @@ export function CardActions(props: React.PropsWithChildren<CardActionsProps>) {
130
130
  * component to the entire `Card` component. This works together with the
131
131
  * `CardLinkOverlay` component to provide a clickable overlay.
132
132
  */
133
- export function CardLinkBox({
133
+ function CardLinkBox({
134
134
  children,
135
135
  mainActionLink,
136
136
  }: React.PropsWithChildren<CardLinkBoxProps>) {
@@ -148,7 +148,7 @@ export function CardLinkBox({
148
148
  * the `Card` component while still allowing links in the `CardActions` to be
149
149
  * clickable.
150
150
  */
151
- export function CardLinkOverlay({
151
+ function CardLinkOverlay({
152
152
  children,
153
153
  mainActionLink,
154
154
  }: React.PropsWithChildren<CardLinkBoxProps>) {
@@ -1,6 +1,5 @@
1
1
  import * as React from "react";
2
2
  import { action } from "@storybook/addon-actions";
3
- import { text, boolean, select } from "@storybook/addon-knobs";
4
3
 
5
4
  import CardEdition from "./CardEdition";
6
5
  import Heading from "../Heading/Heading";
@@ -24,10 +23,6 @@ export default {
24
23
  component: CardEdition,
25
24
  };
26
25
 
27
- let showCTAs, showImage, showHeader, showFooter;
28
-
29
- const headerLevels = [1, 2, 3, 4, 5, 6];
30
-
31
26
  const imageRatios = {
32
27
  "1x1": "https://placeimg.com/100/100/animals",
33
28
  "2x1": "https://placeimg.com/200/100/animals",
@@ -39,48 +34,23 @@ const imageRatios = {
39
34
 
40
35
  export const cardEdition = () => (
41
36
  <>
42
- {boolean("Show Header", true) ? (showHeader = true) : (showHeader = false)}
43
- {boolean("Show Image", true) ? (showImage = true) : (showImage = false)}
44
- {boolean("Show CTAs", true) ? (showCTAs = true) : (showCTAs = false)}
45
- {boolean("Show Footer", true) ? (showFooter = true) : (showFooter = false)}
46
37
  <CardEdition
47
38
  id="cardID"
48
- heading={
49
- showHeader ? (
50
- <Heading
51
- level={select("Header Level", headerLevels, headerLevels[2])}
52
- id="heading1"
53
- text={text("Header Content", "Optional Header")}
54
- />
55
- ) : (
56
- false
57
- )
58
- }
59
- image={
60
- showImage ? (
61
- <Image
62
- src={select("Image Ratio", imageRatios, imageRatios[2])}
63
- alt={""}
64
- />
65
- ) : null
66
- }
39
+ heading={<Heading level={2} id="heading1" text="Header Content" />}
40
+ image={<Image src={imageRatios[2]} alt="" />}
67
41
  ctas={
68
- showCTAs ? (
69
- <Button
70
- onClick={action("clicked")}
71
- id="button1"
72
- buttonType={ButtonTypes.Primary}
73
- type="submit"
74
- >
75
- {text("CTA Button Text: ", "Example CTA")}
76
- </Button>
77
- ) : null
78
- }
79
- footer={
80
- showFooter ? <>{text("Footer content: ", "Optional footer")}</> : null
42
+ <Button
43
+ onClick={action("clicked")}
44
+ id="button1"
45
+ buttonType={ButtonTypes.Primary}
46
+ type="submit"
47
+ >
48
+ CTA Button Text
49
+ </Button>
81
50
  }
51
+ footer={<>Footer content: </>}
82
52
  >
83
- {text("Card Content: ", "Middle column content")}
53
+ Card Content:
84
54
  </CardEdition>
85
55
  </>
86
56
  );
@@ -90,8 +60,7 @@ cardEdition.storyName = "CardEdition";
90
60
  cardEdition.parameters = {
91
61
  design: {
92
62
  type: "figma",
93
- url:
94
- "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=17167%3A58131",
63
+ url: "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=17167%3A58131",
95
64
  },
96
65
  };
97
66
 
@@ -117,7 +86,7 @@ export const ExampleCardEdition = () => (
117
86
  <Heading
118
87
  level={HeadingLevels.Two}
119
88
  id="heading1"
120
- text={"The Year of Magical Thinking"}
89
+ text="The Year of Magical Thinking"
121
90
  />
122
91
  <div className="book__callout">A portrait of loss and grief</div>
123
92
  <div>
@@ -148,7 +117,6 @@ ExampleCardEdition.storyName = "Example Card Edition";
148
117
  ExampleCardEdition.parameters = {
149
118
  design: {
150
119
  type: "figma",
151
- url:
152
- "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=17167%3A58131",
120
+ url: "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=17167%3A58131",
153
121
  },
154
122
  };