@nypl/design-system-react-components 0.25.9 → 0.25.12

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/CHANGELOG.md +96 -0
  2. package/README.md +4 -16
  3. package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +1 -0
  4. package/dist/components/DatePicker/DatePicker.d.ts +1 -1
  5. package/dist/components/Fieldset/Fieldset.d.ts +1 -3
  6. package/dist/components/Form/Form.d.ts +13 -12
  7. package/dist/components/Form/FormTypes.d.ts +2 -2
  8. package/dist/components/HorizontalRule/HorizontalRule.d.ts +1 -1
  9. package/dist/components/Icons/IconTypes.d.ts +9 -7
  10. package/dist/components/List/List.d.ts +1 -1
  11. package/dist/components/Logo/LogoSvgs.d.ts +23 -1
  12. package/dist/components/Logo/LogoTypes.d.ts +23 -1
  13. package/dist/components/Notification/Notification.d.ts +2 -0
  14. package/dist/components/Pagination/Pagination.d.ts +6 -2
  15. package/dist/components/RadioGroup/RadioGroup.d.ts +3 -3
  16. package/dist/components/SearchBar/SearchBar.d.ts +6 -6
  17. package/dist/components/Select/Select.d.ts +4 -0
  18. package/dist/components/Table/Table.d.ts +9 -3
  19. package/dist/components/Template/Template.d.ts +24 -5
  20. package/dist/design-system-react-components.cjs.development.js +2063 -548
  21. package/dist/design-system-react-components.cjs.development.js.map +1 -1
  22. package/dist/design-system-react-components.cjs.production.min.js +1 -1
  23. package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
  24. package/dist/design-system-react-components.esm.js +2056 -554
  25. package/dist/design-system-react-components.esm.js.map +1 -1
  26. package/dist/index.d.ts +4 -4
  27. package/dist/resources.scss +0 -2
  28. package/dist/styles.css +1 -1
  29. package/dist/theme/components/breadcrumb.d.ts +4 -1
  30. package/dist/theme/components/checkbox.d.ts +0 -2
  31. package/dist/theme/components/customTable.d.ts +12 -3
  32. package/dist/theme/components/fieldset.d.ts +2 -0
  33. package/dist/theme/components/global.d.ts +15 -14
  34. package/dist/theme/components/globalMixins.d.ts +8 -8
  35. package/dist/theme/components/list.d.ts +6 -0
  36. package/dist/theme/components/notification.d.ts +16 -4
  37. package/dist/theme/components/radio.d.ts +3 -2
  38. package/dist/theme/components/searchBar.d.ts +4 -0
  39. package/dist/theme/components/select.d.ts +2 -9
  40. package/dist/theme/components/slider.d.ts +8 -4
  41. package/dist/theme/components/structuredContent.d.ts +9 -9
  42. package/dist/theme/components/textInput.d.ts +10 -12
  43. package/dist/theme/components/toggle.d.ts +6 -2
  44. package/dist/theme/foundations/global.d.ts +31 -3
  45. package/dist/utils/utils.d.ts +10 -0
  46. package/package.json +40 -36
  47. package/src/components/Accordion/Accordion.stories.mdx +1 -1
  48. package/src/components/Accordion/Accordion.test.tsx +45 -1
  49. package/src/components/Accordion/Accordion.tsx +20 -8
  50. package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +243 -0
  51. package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +30 -2
  52. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +25 -0
  53. package/src/components/Breadcrumbs/Breadcrumbs.tsx +9 -3
  54. package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +1 -0
  55. package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +104 -5
  56. package/src/components/Card/Card.stories.mdx +1 -1
  57. package/src/components/Card/Card.tsx +4 -1
  58. package/src/components/Card/__snapshots__/Card.test.tsx.snap +1 -1
  59. package/src/components/Chakra/Flex.stories.mdx +113 -0
  60. package/src/components/Checkbox/Checkbox.stories.mdx +1 -1
  61. package/src/components/Checkbox/Checkbox.tsx +1 -0
  62. package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +6 -6
  63. package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +1 -1
  64. package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +18 -18
  65. package/src/components/DatePicker/DatePicker.stories.mdx +1 -1
  66. package/src/components/DatePicker/DatePicker.test.tsx +6 -6
  67. package/src/components/DatePicker/DatePicker.tsx +12 -10
  68. package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +28 -20
  69. package/src/components/Fieldset/Fieldset.stories.mdx +1 -1
  70. package/src/components/Fieldset/Fieldset.tsx +2 -4
  71. package/src/components/Form/Form.stories.mdx +34 -16
  72. package/src/components/Form/Form.test.tsx +92 -3
  73. package/src/components/Form/Form.tsx +25 -21
  74. package/src/components/Form/FormTypes.tsx +2 -2
  75. package/src/components/Form/__snapshots__/Form.test.tsx.snap +0 -1
  76. package/src/components/HelperErrorText/HelperErrorText.stories.mdx +1 -1
  77. package/src/components/Hero/Hero.stories.mdx +1 -1
  78. package/src/components/HorizontalRule/HorizontalRule.stories.mdx +3 -2
  79. package/src/components/HorizontalRule/HorizontalRule.tsx +2 -2
  80. package/src/components/HorizontalRule/__snapshots__/HorizontalRule.test.tsx.snap +4 -4
  81. package/src/components/Icons/Icon.stories.mdx +1 -1
  82. package/src/components/Icons/Icon.test.tsx +1 -1
  83. package/src/components/Icons/Icon.tsx +1 -1
  84. package/src/components/Icons/IconTypes.tsx +8 -6
  85. package/src/components/List/List.stories.mdx +24 -5
  86. package/src/components/List/List.test.tsx +1 -1
  87. package/src/components/List/List.tsx +2 -2
  88. package/src/components/List/__snapshots__/List.test.tsx.snap +3 -1
  89. package/src/components/Logo/Logo.stories.mdx +7 -5
  90. package/src/components/Logo/LogoSvgs.tsx +45 -1
  91. package/src/components/Logo/LogoTypes.tsx +22 -0
  92. package/src/components/Notification/Notification.stories.mdx +73 -1
  93. package/src/components/Notification/Notification.test.tsx +64 -5
  94. package/src/components/Notification/Notification.tsx +21 -11
  95. package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +103 -8
  96. package/src/components/Pagination/Pagination.stories.mdx +54 -12
  97. package/src/components/Pagination/Pagination.test.tsx +63 -5
  98. package/src/components/Pagination/Pagination.tsx +46 -24
  99. package/src/components/Pagination/__snapshots__/Pagination.test.tsx.snap +3 -3
  100. package/src/components/Radio/Radio.stories.mdx +1 -1
  101. package/src/components/Radio/Radio.tsx +1 -0
  102. package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +5 -5
  103. package/src/components/RadioGroup/RadioGroup.stories.mdx +1 -1
  104. package/src/components/RadioGroup/RadioGroup.test.tsx +13 -11
  105. package/src/components/RadioGroup/RadioGroup.tsx +88 -89
  106. package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +18 -18
  107. package/src/components/SearchBar/SearchBar.Test.tsx +124 -28
  108. package/src/components/SearchBar/SearchBar.stories.mdx +9 -6
  109. package/src/components/SearchBar/SearchBar.tsx +24 -23
  110. package/src/components/Select/Select.stories.mdx +1 -1
  111. package/src/components/Select/Select.test.tsx +89 -0
  112. package/src/components/Select/Select.tsx +11 -2
  113. package/src/components/Select/__snapshots__/Select.test.tsx.snap +545 -0
  114. package/src/components/Slider/Slider.stories.mdx +1 -1
  115. package/src/components/Slider/Slider.tsx +4 -1
  116. package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +7 -0
  117. package/src/components/StructuredContent/StructuredContent.stories.mdx +1 -1
  118. package/src/components/StyleGuide/Bidirectionality.stories.mdx +4 -4
  119. package/src/components/StyleGuide/Colors.stories.mdx +33 -18
  120. package/src/components/Table/Table.stories.mdx +118 -19
  121. package/src/components/Table/Table.test.tsx +80 -3
  122. package/src/components/Table/Table.tsx +26 -16
  123. package/src/components/Table/__snapshots__/Table.test.tsx.snap +1179 -0
  124. package/src/components/Tabs/Tabs.stories.mdx +1 -1
  125. package/src/components/Tabs/Tabs.test.tsx +21 -5
  126. package/src/components/Tabs/Tabs.tsx +35 -20
  127. package/src/components/Tabs/__snapshots__/Tabs.test.tsx.snap +195 -0
  128. package/src/components/Template/Template.stories.mdx +79 -4
  129. package/src/components/Template/Template.test.tsx +65 -3
  130. package/src/components/Template/Template.tsx +60 -14
  131. package/src/components/Template/__snapshots__/Template.test.tsx.snap +94 -1
  132. package/src/components/TextInput/TextInput.stories.mdx +1 -1
  133. package/src/components/Toggle/Toggle.stories.mdx +1 -1
  134. package/src/components/Toggle/Toggle.tsx +2 -1
  135. package/src/components/Toggle/__snapshots__/Toggle.test.tsx.snap +4 -4
  136. package/src/docs/Chakra.stories.mdx +1 -1
  137. package/src/index.ts +8 -2
  138. package/src/styles/base/_place-holder.scss +2 -0
  139. package/src/styles.scss +0 -2
  140. package/src/theme/components/breadcrumb.ts +5 -1
  141. package/src/theme/components/checkbox.ts +3 -7
  142. package/src/theme/components/customTable.ts +16 -3
  143. package/src/theme/components/fieldset.ts +2 -0
  144. package/src/theme/components/global.ts +19 -16
  145. package/src/theme/components/globalMixins.ts +8 -8
  146. package/src/theme/components/list.ts +6 -2
  147. package/src/theme/components/notification.ts +21 -8
  148. package/src/theme/components/radio.ts +3 -6
  149. package/src/theme/components/searchBar.ts +4 -0
  150. package/src/theme/components/select.ts +3 -3
  151. package/src/theme/components/slider.ts +12 -9
  152. package/src/theme/components/structuredContent.ts +26 -6
  153. package/src/theme/components/textInput.ts +3 -2
  154. package/src/theme/components/toggle.ts +42 -38
  155. package/src/theme/foundations/colors.ts +19 -12
  156. package/src/theme/foundations/global.ts +17 -5
  157. package/src/theme/foundations/typography.ts +2 -2
  158. package/src/utils/componentCategories.ts +2 -1
  159. package/src/utils/utils.ts +28 -0
  160. package/dist/components/Pagination/Pagination.stories.d.ts +0 -13
  161. package/src/components/Pagination/Pagination.stories.tsx +0 -54
  162. package/src/styles/base/_03-base.scss +0 -25
  163. package/src/styles/base/_04-focus.scss +0 -22
@@ -41,7 +41,7 @@ import DSProvider from "../../theme/provider";
41
41
  | Component Version | DS Version |
42
42
  | ----------------- | ---------- |
43
43
  | Added | `0.24.0` |
44
- | Latest | `0.25.0` |
44
+ | Latest | `0.25.11` |
45
45
 
46
46
  <Description of={Tabs} />
47
47
 
@@ -1,7 +1,8 @@
1
1
  import * as React from "react";
2
2
  import { render, screen } from "@testing-library/react";
3
- import { axe } from "jest-axe";
4
3
  import userEvent from "@testing-library/user-event";
4
+ import { axe } from "jest-axe";
5
+ import renderer from "react-test-renderer";
5
6
 
6
7
  import { Tabs, TabList, Tab, TabPanels, TabPanel } from "./Tabs";
7
8
 
@@ -208,7 +209,15 @@ describe("Tabs", () => {
208
209
  expect(selectedIndex).toEqual(1);
209
210
  });
210
211
 
211
- it("should throw warning when both the 'data' prop and children are passed", () => {
212
+ it("should throw a warning when no data is passed", () => {
213
+ const warn = jest.spyOn(console, "warn");
214
+ render(<Tabs />);
215
+ expect(warn).toHaveBeenCalledWith(
216
+ "Tabs: Pass data in the `data` props or as children."
217
+ );
218
+ });
219
+
220
+ it("should throw a warning when both the 'data' prop and children are passed", () => {
212
221
  const warn = jest.spyOn(console, "warn");
213
222
  render(
214
223
  <Tabs contentData={animalCrossing}>
@@ -238,11 +247,11 @@ describe("Tabs", () => {
238
247
  </Tabs>
239
248
  );
240
249
  expect(warn).toHaveBeenCalledWith(
241
- "Only pass children or data in the `data` props but not both."
250
+ "Tabs: Only pass children or data in the `data` props but not both."
242
251
  );
243
252
  });
244
253
 
245
- it("should throw warning when more than six object tabs are passed", () => {
254
+ it("should throw a warning when more than six object tabs are passed", () => {
246
255
  const warn = jest.spyOn(console, "warn");
247
256
  render(
248
257
  <Tabs
@@ -258,7 +267,14 @@ describe("Tabs", () => {
258
267
  />
259
268
  );
260
269
  expect(warn).toHaveBeenCalledWith(
261
- "We recommend to use no more than six tabs. If more than six tabs are needed, consider other navigational patterns."
270
+ "Tabs: We recommend to use no more than six tabs. If more than six tabs are needed, consider other navigational patterns."
262
271
  );
263
272
  });
273
+
274
+ it("renders the UI snapshot correctly", () => {
275
+ const basic = renderer
276
+ .create(<Tabs contentData={animalCrossing} id="basic" />)
277
+ .toJSON();
278
+ expect(basic).toMatchSnapshot();
279
+ });
264
280
  });
@@ -17,6 +17,12 @@ import Button from "../Button/Button";
17
17
  import useCarouselStyles from "../../hooks/useCarouselStyles";
18
18
  import useWindowSize from "../../hooks/useWindowSize";
19
19
 
20
+ // Internal interface used for rendering `Tabs` tab and panel
21
+ // elements, either from data or from children.
22
+ interface TabPanelProps {
23
+ tabs: React.ReactNode[] | React.ReactNode;
24
+ panels: React.ReactNode[] | React.ReactNode;
25
+ }
20
26
  // The general shape of the data object for each Tab.
21
27
  export interface TabsContentDataProps {
22
28
  label: string;
@@ -49,18 +55,18 @@ const onClickHash = (tabHash) => {
49
55
  * This returns an object with `Tab` and `TabPanel` components to rendered in
50
56
  * `TabList` and `TabPanels` components respectively.
51
57
  */
52
- const getElementsFromContentData = (data, useHash) => {
58
+ const getElementsFromContentData = (data, useHash): TabPanelProps => {
53
59
  const tabs = [];
54
60
  const panels = [];
55
61
 
56
62
  if (!data?.length) {
57
- return {};
63
+ return { tabs: [], panels: [] };
58
64
  }
59
65
 
60
66
  if (data?.length > 6) {
61
67
  console.warn(
62
- "We recommend to use no more than six tabs. If more than six tabs are " +
63
- "needed, consider other navigational patterns."
68
+ "Tabs: We recommend to use no more than six tabs. If more than six tabs " +
69
+ "are needed, consider other navigational patterns."
64
70
  );
65
71
  }
66
72
  data.forEach((tab, index) => {
@@ -78,8 +84,8 @@ const getElementsFromContentData = (data, useHash) => {
78
84
  if (typeof tab.content === "string") {
79
85
  tempPanel = (
80
86
  <TabPanel
81
- key={index}
82
87
  dangerouslySetInnerHTML={{ __html: tab.content }}
88
+ key={index}
83
89
  />
84
90
  );
85
91
  } else {
@@ -91,8 +97,8 @@ const getElementsFromContentData = (data, useHash) => {
91
97
  });
92
98
 
93
99
  return {
94
- tabs: <TabList>{tabs}</TabList>,
95
- panels: <TabPanels>{panels}</TabPanels>,
100
+ tabs: [<TabList key="list">{tabs}</TabList>],
101
+ panels: [<TabPanels key="panels">{panels}</TabPanels>],
96
102
  };
97
103
  };
98
104
 
@@ -100,12 +106,12 @@ const getElementsFromContentData = (data, useHash) => {
100
106
  * This returns an object with `TabList` and `TabPanels` components to help format
101
107
  * the DOM when building up the `Tabs` component using child component.
102
108
  */
103
- const getElementsFromChildren = (children) => {
109
+ const getElementsFromChildren = (children): TabPanelProps => {
104
110
  const tabs = [];
105
111
  const panels = [];
106
112
 
107
113
  if (!children?.length) {
108
- return {};
114
+ return { tabs: [], panels: [] };
109
115
  }
110
116
 
111
117
  children.forEach((child) => {
@@ -115,8 +121,8 @@ const getElementsFromChildren = (children) => {
115
121
  const childTabs = React.Children.count(child.props.children);
116
122
  if (childTabs > 6) {
117
123
  console.warn(
118
- "We recommend to use no more than six tabs. If more than six tabs are " +
119
- "needed, consider other navigational patterns."
124
+ "Tabs: We recommend to use no more than six tabs. If more than six " +
125
+ "tabs are needed, consider other navigational patterns."
120
126
  );
121
127
  }
122
128
  }
@@ -149,9 +155,14 @@ function Tabs(props: React.PropsWithChildren<TabsProps>) {
149
155
  const mediumTabWidth = 40;
150
156
  const [tabWidth, setTabWidth] = React.useState(initTabWidth);
151
157
  const windowDimensions = useWindowSize();
152
- const { tabs, panels } = contentData
158
+ const { tabs, panels }: any = contentData
153
159
  ? getElementsFromContentData(contentData, useHash)
154
160
  : getElementsFromChildren(children);
161
+
162
+ if (tabs.length === 0 || panels.length === 0) {
163
+ console.warn("Tabs: Pass data in the `data` props or as children.");
164
+ }
165
+
155
166
  // `tabs` is an array for the children component approach but an object for
156
167
  // the `contentData` prop approach. We need to get the right props key value
157
168
  // to set the carousel's length.
@@ -173,34 +184,38 @@ function Tabs(props: React.PropsWithChildren<TabsProps>) {
173
184
  }, [goToStart, windowDimensions.width]);
174
185
  const previousButton = (
175
186
  <Button
176
- buttonType={ButtonTypes.Primary}
177
187
  attributes={{
178
188
  "aria-label": "Previous",
179
189
  ...styles.buttonArrows,
180
190
  left: "0",
181
191
  }}
192
+ buttonType={ButtonTypes.Primary}
193
+ id={`tabs-previous-${id}`}
182
194
  onClick={prevSlide}
183
195
  >
184
196
  <Icon
185
- name={IconNames.Arrow}
186
197
  iconRotation={IconRotationTypes.Rotate90}
198
+ id={`tabs-previous-icon-${id}`}
199
+ name={IconNames.Arrow}
187
200
  size={IconSizes.Small}
188
201
  />
189
202
  </Button>
190
203
  );
191
204
  const nextButton = (
192
205
  <Button
193
- buttonType={ButtonTypes.Primary}
194
206
  attributes={{
195
207
  "aria-label": "Next",
196
208
  ...styles.buttonArrows,
197
209
  right: "0",
198
210
  }}
211
+ buttonType={ButtonTypes.Primary}
212
+ id={`tabs-next-${id}`}
199
213
  onClick={nextSlide}
200
214
  >
201
215
  <Icon
202
- name={IconNames.Arrow}
203
216
  iconRotation={IconRotationTypes.Rotate270}
217
+ id={`tabs-next-icon-${id}`}
218
+ name={IconNames.Arrow}
204
219
  size={IconSizes.Small}
205
220
  />
206
221
  </Button>
@@ -208,18 +223,18 @@ function Tabs(props: React.PropsWithChildren<TabsProps>) {
208
223
 
209
224
  if (children && contentData?.length) {
210
225
  console.warn(
211
- "Only pass children or data in the `data` props but not both."
226
+ "Tabs: Only pass children or data in the `data` props but not both."
212
227
  );
213
228
  }
214
229
 
215
230
  return (
216
231
  <ChakraTabs
217
- id={id}
218
- onChange={onChange}
219
232
  defaultIndex={defaultIndex}
220
- variant="enclosed"
233
+ id={id}
221
234
  // The following lazy loads each panel whenever it is needed.
222
235
  isLazy
236
+ onChange={onChange}
237
+ variant="enclosed"
223
238
  >
224
239
  <Box
225
240
  __css={styles.tablistWrapper}
@@ -0,0 +1,195 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Tabs renders the UI snapshot correctly 1`] = `
4
+ <div
5
+ className="chakra-tabs css-0"
6
+ id="basic"
7
+ >
8
+ <div
9
+ className="css-l3f8vc"
10
+ >
11
+ <button
12
+ aria-label="Previous"
13
+ className="chakra-button css-fg6w03"
14
+ data-testid="button"
15
+ id="tabs-previous-basic"
16
+ onClick={[Function]}
17
+ type="button"
18
+ >
19
+ <svg
20
+ aria-hidden={true}
21
+ className="chakra-icon css-onkibi"
22
+ focusable={false}
23
+ id="tabs-previous-icon-basic"
24
+ role="img"
25
+ title="arrow icon"
26
+ viewBox="0 0 24 24"
27
+ >
28
+ <g
29
+ stroke="currentColor"
30
+ strokeWidth="1.5"
31
+ >
32
+ <path
33
+ d="M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"
34
+ fill="none"
35
+ strokeLinecap="round"
36
+ />
37
+ <path
38
+ d="M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"
39
+ fill="currentColor"
40
+ strokeLinecap="round"
41
+ />
42
+ <circle
43
+ cx="12"
44
+ cy="12"
45
+ fill="none"
46
+ r="11.25"
47
+ strokeMiterlimit="10"
48
+ />
49
+ </g>
50
+ </svg>
51
+ </button>
52
+ <div
53
+ className="css-0"
54
+ >
55
+ <div
56
+ className="css-16fuzwj"
57
+ >
58
+ <div
59
+ aria-orientation="horizontal"
60
+ className="chakra-tabs__tablist css-k008qs"
61
+ onKeyDown={[Function]}
62
+ role="tablist"
63
+ >
64
+ <button
65
+ aria-controls="basic--tabpanel--1"
66
+ aria-selected={false}
67
+ className="chakra-tabs__tab css-abpfcx"
68
+ id="basic--tab--1"
69
+ onClick={[Function]}
70
+ onFocus={[Function]}
71
+ role="tab"
72
+ tabIndex={-1}
73
+ type="button"
74
+ >
75
+ Tom Nook
76
+ </button>
77
+ <button
78
+ aria-controls="basic--tabpanel--1"
79
+ aria-selected={false}
80
+ className="chakra-tabs__tab css-abpfcx"
81
+ id="basic--tab--1"
82
+ onClick={[Function]}
83
+ onFocus={[Function]}
84
+ role="tab"
85
+ tabIndex={-1}
86
+ type="button"
87
+ >
88
+ Isabelle
89
+ </button>
90
+ <button
91
+ aria-controls="basic--tabpanel--1"
92
+ aria-selected={false}
93
+ className="chakra-tabs__tab css-abpfcx"
94
+ id="basic--tab--1"
95
+ onClick={[Function]}
96
+ onFocus={[Function]}
97
+ role="tab"
98
+ tabIndex={-1}
99
+ type="button"
100
+ >
101
+ K.K. Slider
102
+ </button>
103
+ </div>
104
+ </div>
105
+ </div>
106
+ <button
107
+ aria-label="Next"
108
+ className="chakra-button css-1whvqek"
109
+ data-testid="button"
110
+ id="tabs-next-basic"
111
+ onClick={[Function]}
112
+ type="button"
113
+ >
114
+ <svg
115
+ aria-hidden={true}
116
+ className="chakra-icon css-onkibi"
117
+ focusable={false}
118
+ id="tabs-next-icon-basic"
119
+ role="img"
120
+ title="arrow icon"
121
+ viewBox="0 0 24 24"
122
+ >
123
+ <g
124
+ stroke="currentColor"
125
+ strokeWidth="1.5"
126
+ >
127
+ <path
128
+ d="M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"
129
+ fill="none"
130
+ strokeLinecap="round"
131
+ />
132
+ <path
133
+ d="M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"
134
+ fill="currentColor"
135
+ strokeLinecap="round"
136
+ />
137
+ <circle
138
+ cx="12"
139
+ cy="12"
140
+ fill="none"
141
+ r="11.25"
142
+ strokeMiterlimit="10"
143
+ />
144
+ </g>
145
+ </svg>
146
+ </button>
147
+ </div>
148
+ <div
149
+ className="chakra-tabs__tab-panels css-8atqhb"
150
+ >
151
+ <div
152
+ aria-labelledby="basic--tab-0"
153
+ className="chakra-tabs__tab-panel css-sjt5nk"
154
+ hidden={false}
155
+ id="basic--tabpanel-0"
156
+ role="tabpanel"
157
+ tabIndex={0}
158
+ >
159
+ <p>
160
+ Tom Nook,
161
+ <b>
162
+ known in Japan as Tanukichi
163
+ </b>
164
+ , is a fictional character in the Animal Crossing series who operates the village store.
165
+ </p>
166
+ </div>
167
+ <div
168
+ aria-labelledby="basic--tab-1"
169
+ className="chakra-tabs__tab-panel css-sjt5nk"
170
+ dangerouslySetInnerHTML={
171
+ Object {
172
+ "__html": "Isabelle, known as Shizue in Japan, is a fictional character from the Animal Crossing series of video games. She is a kindly Shih Tzu that debuted in the 2012 release Animal Crossing: New Leaf, where she serves as the secretary to the player character.",
173
+ }
174
+ }
175
+ hidden={true}
176
+ id="basic--tabpanel-1"
177
+ role="tabpanel"
178
+ tabIndex={0}
179
+ />
180
+ <div
181
+ aria-labelledby="basic--tab-2"
182
+ className="chakra-tabs__tab-panel css-sjt5nk"
183
+ dangerouslySetInnerHTML={
184
+ Object {
185
+ "__html": "<p>Totakeke, more commonly known as <b>K.K. Slider or K.K.</b>, is a fictional character within the Animal Crossing franchise. One of the franchise's most popular characters, he debuted in the title Animal Crossing, and has appeared in every installment since.</p>",
186
+ }
187
+ }
188
+ hidden={true}
189
+ id="basic--tabpanel-2"
190
+ role="tabpanel"
191
+ tabIndex={0}
192
+ />
193
+ </div>
194
+ </div>
195
+ `;
@@ -29,6 +29,7 @@ import Notification, {
29
29
  import Placeholder from "../Placeholder/Placeholder";
30
30
  import {
31
31
  Template,
32
+ TemplateAboveHeader,
32
33
  TemplateHeader,
33
34
  TemplateBreakout,
34
35
  TemplateContent,
@@ -49,7 +50,7 @@ import { getCategory } from "../../utils/componentCategories";
49
50
  parameters={{
50
51
  design: {
51
52
  type: "figma",
52
- url: "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=11982%3A47778",
53
+ url: "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Main?node-id=36835%3A26688",
53
54
  },
54
55
  }}
55
56
  />
@@ -59,14 +60,25 @@ import { getCategory } from "../../utils/componentCategories";
59
60
  | Component Version | DS Version |
60
61
  | ----------------- | ---------- |
61
62
  | Added | `0.3.6` |
62
- | Latest | `0.25.9` |
63
+ | Latest | `0.25.12` |
63
64
 
64
65
  ## TemplateAppContainer Component
65
66
 
66
67
  <Description of={TemplateAppContainer} />
67
68
 
68
- If you have a custom `Footer` component that _already_ renders an HTML `<footer>`
69
- element, set `renderFooterElement` to false so only one `<footer>` element is rendered.
69
+ If you have a custom `Header` component that _already_ renders an HTML `<header>`
70
+ element, set `renderHeaderElement` to false so only one `<header>` element is
71
+ rendered.
72
+
73
+ Likewise, if you have a custom `Footer` component that _already_ renders an HTML
74
+ `<footer>` element, set `renderFooterElement` to false so only one `<footer>`
75
+ element is rendered.
76
+
77
+ If you need to render an alert or notification at the top of the page with an
78
+ `aside` HTML element or HTML element with the `role="complementary"` attribute,
79
+ then pass that alert or notification component to the `aboveHeader` prop. These
80
+ elements should _not_ be rendered in the `header` HTML section since that's an
81
+ accessibility violation.
70
82
 
71
83
  <b>This is the recommended way to render an app page template.</b>
72
84
 
@@ -74,6 +86,7 @@ element, set `renderFooterElement` to false so only one `<footer>` element is re
74
86
  import { TemplateAppContainer } from "@nypl/design-system-react-components";
75
87
 
76
88
  <TemplateAppContainer
89
+ aboveHeader={<Placeholder variant="short">Above Header</Placeholder>}
77
90
  header={<Placeholder variant="short">NYPL Header</Placeholder>}
78
91
  breakout={
79
92
  <>
@@ -98,6 +111,7 @@ import { TemplateAppContainer } from "@nypl/design-system-react-components";
98
111
  <Story
99
112
  name="TemplateAppContainer Component"
100
113
  args={{
114
+ aboveHeader: <Placeholder variant="short">Above Header</Placeholder>,
101
115
  breakout: (
102
116
  <>
103
117
  <Placeholder variant="short">Breadcrumbs</Placeholder>
@@ -116,8 +130,10 @@ import { TemplateAppContainer } from "@nypl/design-system-react-components";
116
130
  header: <Placeholder variant="short">NYPL Header</Placeholder>,
117
131
  sidebar: "left",
118
132
  renderFooterElement: true,
133
+ renderHeaderElement: true,
119
134
  }}
120
135
  argTypes={{
136
+ aboveHeader: { control: false },
121
137
  breakout: { control: false },
122
138
  contentPrimary: { control: false },
123
139
  contentSidebar: { control: false },
@@ -149,6 +165,7 @@ Basic "template" components structure:
149
165
  ```
150
166
  import {
151
167
  Template,
168
+ TemplateAboveHeader,
152
169
  TemplateHeader,
153
170
  TemplateBreakout,
154
171
  TemplateContent,
@@ -160,6 +177,9 @@ import {
160
177
 
161
178
 
162
179
  <Template>
180
+ <TemplateAboveHeader>
181
+ // ...
182
+ </TemplateAboveHeader>
163
183
  <TemplateHeader>
164
184
  // ...
165
185
  <TemplateBreakout>
@@ -190,6 +210,7 @@ import {
190
210
  sidebar: "left",
191
211
  }}
192
212
  argTypes={{
213
+ aboveHeader: { table: { disable: true } },
193
214
  breakout: { table: { disable: true } },
194
215
  contentPrimary: { table: { disable: true } },
195
216
  contentSidebar: { table: { disable: true } },
@@ -201,6 +222,9 @@ import {
201
222
  >
202
223
  {(args) => (
203
224
  <Template>
225
+ <TemplateAboveHeader>
226
+ <Placeholder variant="short">Above Header</Placeholder>
227
+ </TemplateAboveHeader>
204
228
  <TemplateHeader>
205
229
  <Placeholder variant="short">NYPL Header</Placeholder>
206
230
  <TemplateBreakout>
@@ -242,6 +266,7 @@ import {
242
266
  The components consist of:
243
267
 
244
268
  - `Template`
269
+ - `TemplateAboveHeader`
245
270
  - `TemplateHeader`
246
271
  - `TemplateBreakout`
247
272
  - `TemplateContent`
@@ -260,10 +285,25 @@ The components consist of:
260
285
 
261
286
  <Description of={Template} />
262
287
 
288
+ #### TemplateAboveHeader
289
+
290
+ ```
291
+ <Template>
292
+ <TemplateAboveHeader>
293
+ // ...
294
+ </TemplateAboveHeader>
295
+ <Template>
296
+ ```
297
+
298
+ <Description of={TemplateAboveHeader} />
299
+
263
300
  #### TemplateHeader
264
301
 
265
302
  ```
266
303
  <Template>
304
+ <TemplateAboveHeader>
305
+ // ...
306
+ </TemplateAboveHeader>
267
307
  <TemplateHeader>
268
308
  // ...
269
309
  </TemplateHeader>
@@ -276,6 +316,9 @@ The components consist of:
276
316
 
277
317
  ```
278
318
  <Template>
319
+ <TemplateAboveHeader>
320
+ // ...
321
+ </TemplateAboveHeader>
279
322
  <TemplateHeader>
280
323
  <TemplateBreakout>
281
324
  // ...
@@ -303,6 +346,9 @@ The components consist of:
303
346
 
304
347
  ```
305
348
  <Template>
349
+ <TemplateAboveHeader>
350
+ // ...
351
+ </TemplateAboveHeader>
306
352
  <TemplateHeader>...</TemplateHeader>
307
353
  <TemplateContent>
308
354
  <TemplateContentTop>
@@ -318,6 +364,9 @@ The components consist of:
318
364
 
319
365
  ```
320
366
  <Template>
367
+ <TemplateAboveHeader>
368
+ // ...
369
+ </TemplateAboveHeader>
321
370
  <TemplateHeader>...</TemplateHeader>
322
371
  <TemplateContent>
323
372
  <TemplateContentPrimary>
@@ -333,6 +382,9 @@ The components consist of:
333
382
 
334
383
  ```
335
384
  <Template>
385
+ <TemplateAboveHeader>
386
+ // ...
387
+ </TemplateAboveHeader>
336
388
  <TemplateHeader>...</TemplateHeader>
337
389
  <TemplateContent sidebar="right">
338
390
  <TemplateContentPrimary>
@@ -345,6 +397,9 @@ The components consist of:
345
397
  <Template>
346
398
 
347
399
  <Template>
400
+ <TemplateAboveHeader>
401
+ // ...
402
+ </TemplateAboveHeader>
348
403
  <TemplateHeader>...</TemplateHeader>
349
404
  <TemplateContent sidebar="left">
350
405
  <TemplateContentSidebar>
@@ -363,6 +418,9 @@ The components consist of:
363
418
 
364
419
  ```
365
420
  <Template>
421
+ <TemplateAboveHeader>
422
+ // ...
423
+ </TemplateAboveHeader>
366
424
  <TemplateHeader>
367
425
  // ...
368
426
  </TemplateHeader>
@@ -425,6 +483,23 @@ This is best viewed in the Storybook "Canvas" and not "Docs" section.
425
483
  <Canvas>
426
484
  <Story name="Full Example with Template Children Components">
427
485
  <Template>
486
+ <TemplateAboveHeader>
487
+ <Notification
488
+ notificationType={NotificationTypes.Standard}
489
+ notificationHeading="Standard Notification"
490
+ notificationContent={
491
+ <>
492
+ This is an "announcement" Notification with a heading. Cras mattis
493
+ consectetur purus sit amet fermentum. Maecenas faucibus mollis
494
+ interdum. Morbi leo risus, porta ac consectetur ac, vestibulum at
495
+ eros. Cum sociis natoque penatibus et magnis dis parturient
496
+ montes, nascetur ridiculus mus. Vivamus sagittis lacus vel augue
497
+ laoreet rutrum faucibus dolor auctor.
498
+ </>
499
+ }
500
+ showIcon={false}
501
+ />
502
+ </TemplateAboveHeader>
428
503
  <TemplateHeader>
429
504
  <TemplateBreakout>
430
505
  <Breadcrumbs