@nypl/design-system-react-components 0.27.0 → 0.28.0

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 (298) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/components/Accordion/Accordion.d.ts +1 -1
  3. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +1 -5
  4. package/dist/components/Button/Button.d.ts +2 -10
  5. package/dist/components/ButtonGroup/ButtonGroup.d.ts +22 -0
  6. package/dist/components/Card/Card.d.ts +2 -2
  7. package/dist/components/Checkbox/Checkbox.d.ts +10 -8
  8. package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +1 -1
  9. package/dist/components/DatePicker/DatePicker.d.ts +1 -1
  10. package/dist/components/Form/Form.d.ts +2 -2
  11. package/dist/components/Grid/SimpleGrid.d.ts +6 -3
  12. package/dist/components/Heading/Heading.d.ts +2 -5
  13. package/dist/components/HelperErrorText/HelperErrorText.d.ts +1 -5
  14. package/dist/components/Hero/Hero.d.ts +13 -9
  15. package/dist/components/Icons/Icon.d.ts +6 -5
  16. package/dist/components/Icons/IconSvgs.d.ts +21 -21
  17. package/dist/components/Image/Image.d.ts +8 -5
  18. package/dist/components/Link/Link.d.ts +1 -9
  19. package/dist/components/List/List.d.ts +7 -11
  20. package/dist/components/Logo/Logo.d.ts +2 -5
  21. package/dist/components/Logo/LogoSvgs.d.ts +39 -39
  22. package/dist/components/Notification/Notification.d.ts +1 -1
  23. package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +2 -1
  24. package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
  25. package/dist/components/SearchBar/SearchBar.d.ts +3 -2
  26. package/dist/components/Select/Select.d.ts +2 -5
  27. package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +4 -4
  28. package/dist/components/SkipNavigation/SkipNavigation.d.ts +17 -0
  29. package/dist/components/StatusBadge/StatusBadge.d.ts +2 -3
  30. package/dist/components/StructuredContent/StructuredContent.d.ts +2 -2
  31. package/dist/components/Table/Table.d.ts +1 -1
  32. package/dist/components/Template/Template.d.ts +2 -0
  33. package/dist/components/Text/Text.d.ts +1 -1
  34. package/dist/components/TextInput/TextInput.d.ts +21 -9
  35. package/dist/components/Toggle/Toggle.d.ts +1 -5
  36. package/dist/components/VideoPlayer/VideoPlayer.d.ts +2 -1
  37. package/dist/design-system-react-components.cjs.development.js +856 -1155
  38. package/dist/design-system-react-components.cjs.development.js.map +1 -1
  39. package/dist/design-system-react-components.cjs.production.min.js +1 -1
  40. package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
  41. package/dist/design-system-react-components.esm.js +858 -1220
  42. package/dist/design-system-react-components.esm.js.map +1 -1
  43. package/dist/helpers/types.d.ts +1 -0
  44. package/dist/index.d.ts +26 -47
  45. package/dist/theme/components/buttonGroup.d.ts +11 -0
  46. package/dist/theme/components/card.d.ts +104 -8
  47. package/dist/theme/components/componentWrapper.d.ts +4 -3
  48. package/dist/theme/components/customTable.d.ts +11 -14
  49. package/dist/theme/components/fieldset.d.ts +4 -3
  50. package/dist/theme/components/helperErrorText.d.ts +4 -3
  51. package/dist/theme/components/hero.d.ts +1 -1
  52. package/dist/theme/components/horizontalRule.d.ts +4 -3
  53. package/dist/theme/components/icon.d.ts +47743 -1
  54. package/dist/theme/components/image.d.ts +563 -10
  55. package/dist/theme/components/label.d.ts +4 -3
  56. package/dist/theme/components/list.d.ts +6 -7
  57. package/dist/theme/components/logo.d.ts +474 -1
  58. package/dist/theme/components/notification.d.ts +20 -16
  59. package/dist/theme/components/progressIndicator.d.ts +6 -4
  60. package/dist/theme/components/select.d.ts +4 -4
  61. package/dist/theme/components/skeletonLoader.d.ts +14 -10
  62. package/dist/theme/components/skipNavigation.d.ts +22 -0
  63. package/dist/theme/components/slider.d.ts +7 -6
  64. package/dist/theme/components/structuredContent.d.ts +10 -9
  65. package/dist/theme/components/text.d.ts +7 -1
  66. package/dist/theme/components/toggle.d.ts +6 -4
  67. package/dist/theme/provider.d.ts +2 -4
  68. package/dist/utils/componentCategories.d.ts +1 -1
  69. package/dist/utils/interfaces.d.ts +5 -0
  70. package/dist/utils/utils.d.ts +2 -18
  71. package/package.json +2 -2
  72. package/src/__tests__/setup.ts +3 -3
  73. package/src/__tests__/utils/utils.test.ts +1 -23
  74. package/src/components/AccessibilityGuide/SkipNavigation.stories.mdx +22 -14
  75. package/src/components/Accordion/Accordion.stories.mdx +43 -44
  76. package/src/components/Accordion/Accordion.test.tsx +5 -13
  77. package/src/components/Accordion/Accordion.tsx +14 -18
  78. package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +6 -6
  79. package/src/components/Autosuggest/Autosuggest.stories.mdx +1 -1
  80. package/src/components/Autosuggest/Autosuggest.stories.tsx +23 -25
  81. package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +21 -37
  82. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +4 -17
  83. package/src/components/Breadcrumbs/Breadcrumbs.tsx +18 -21
  84. package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +1 -100
  85. package/src/components/Button/Button.stories.mdx +89 -126
  86. package/src/components/Button/Button.test.tsx +16 -30
  87. package/src/components/Button/Button.tsx +14 -20
  88. package/src/components/ButtonGroup/ButtonGroup.stories.mdx +147 -0
  89. package/src/components/ButtonGroup/ButtonGroup.test.tsx +141 -0
  90. package/src/components/ButtonGroup/ButtonGroup.tsx +99 -0
  91. package/src/components/ButtonGroup/__snapshots__/ButtonGroup.test.tsx.snap +117 -0
  92. package/src/components/Card/Card.stories.mdx +143 -177
  93. package/src/components/Card/Card.test.tsx +36 -97
  94. package/src/components/Card/Card.tsx +78 -74
  95. package/src/components/Chakra/Box.stories.mdx +2 -6
  96. package/src/components/Chakra/Center.stories.mdx +5 -23
  97. package/src/components/Chakra/Flex.stories.mdx +4 -6
  98. package/src/components/Chakra/Stack.stories.mdx +9 -10
  99. package/src/components/Checkbox/Checkbox.stories.mdx +1 -1
  100. package/src/components/Checkbox/Checkbox.test.tsx +2 -2
  101. package/src/components/Checkbox/Checkbox.tsx +20 -13
  102. package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +6 -17
  103. package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +1 -7
  104. package/src/components/CheckboxGroup/CheckboxGroup.tsx +33 -29
  105. package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +0 -11
  106. package/src/components/ComponentWrapper/ComponentWrapper.tsx +3 -10
  107. package/src/components/DatePicker/DatePicker.stories.mdx +23 -37
  108. package/src/components/DatePicker/DatePicker.test.tsx +21 -19
  109. package/src/components/DatePicker/DatePicker.tsx +57 -49
  110. package/src/components/Form/Form.stories.mdx +46 -31
  111. package/src/components/Form/Form.test.tsx +1 -18
  112. package/src/components/Form/Form.tsx +7 -7
  113. package/src/components/Grid/SimpleGrid.stories.mdx +73 -49
  114. package/src/components/Grid/SimpleGrid.test.tsx +7 -9
  115. package/src/components/Grid/SimpleGrid.tsx +14 -11
  116. package/src/components/Heading/Heading.stories.mdx +27 -72
  117. package/src/components/Heading/Heading.test.tsx +18 -44
  118. package/src/components/Heading/Heading.tsx +7 -10
  119. package/src/components/HelperErrorText/HelperErrorText.stories.mdx +1 -3
  120. package/src/components/HelperErrorText/HelperErrorText.tsx +1 -5
  121. package/src/components/Hero/Hero.stories.mdx +219 -216
  122. package/src/components/Hero/Hero.test.tsx +107 -223
  123. package/src/components/Hero/Hero.tsx +63 -61
  124. package/src/components/Icons/Icon.stories.mdx +172 -118
  125. package/src/components/Icons/Icon.test.tsx +8 -16
  126. package/src/components/Icons/Icon.tsx +75 -29
  127. package/src/components/Icons/IconSvgs.tsx +42 -42
  128. package/src/components/Image/Image.stories.mdx +45 -132
  129. package/src/components/Image/Image.test.tsx +16 -31
  130. package/src/components/Image/Image.tsx +28 -12
  131. package/src/components/Link/Link.stories.mdx +30 -80
  132. package/src/components/Link/Link.test.tsx +25 -53
  133. package/src/components/Link/Link.tsx +43 -56
  134. package/src/components/Link/__snapshots__/Link.test.tsx.snap +1 -2
  135. package/src/components/List/List.stories.mdx +20 -31
  136. package/src/components/List/List.test.tsx +24 -43
  137. package/src/components/List/List.tsx +25 -36
  138. package/src/components/Logo/Logo.stories.mdx +94 -50
  139. package/src/components/Logo/Logo.test.tsx +10 -19
  140. package/src/components/Logo/Logo.tsx +50 -17
  141. package/src/components/Logo/LogoSvgs.tsx +78 -78
  142. package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +4 -4
  143. package/src/components/Modal/Modal.stories.mdx +8 -9
  144. package/src/components/Modal/Modal.test.tsx +5 -10
  145. package/src/components/Modal/Modal.tsx +1 -1
  146. package/src/components/Notification/Notification.stories.mdx +10 -28
  147. package/src/components/Notification/Notification.test.tsx +9 -12
  148. package/src/components/Notification/Notification.tsx +34 -37
  149. package/src/components/Pagination/Pagination.stories.mdx +2 -2
  150. package/src/components/Pagination/Pagination.tsx +15 -10
  151. package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +27 -53
  152. package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +9 -10
  153. package/src/components/ProgressIndicator/ProgressIndicator.tsx +17 -21
  154. package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +0 -10
  155. package/src/components/Radio/Radio.stories.mdx +1 -1
  156. package/src/components/Radio/Radio.tsx +9 -6
  157. package/src/components/RadioGroup/RadioGroup.stories.mdx +15 -16
  158. package/src/components/RadioGroup/RadioGroup.test.tsx +2 -8
  159. package/src/components/RadioGroup/RadioGroup.tsx +28 -24
  160. package/src/components/SearchBar/SearchBar.stories.mdx +1 -1
  161. package/src/components/SearchBar/SearchBar.test.tsx +1 -1
  162. package/src/components/SearchBar/SearchBar.tsx +14 -22
  163. package/src/components/SearchBar/__snapshots__/SearchBar.test.tsx.snap +0 -12
  164. package/src/components/Select/Select.stories.mdx +8 -23
  165. package/src/components/Select/Select.test.tsx +6 -7
  166. package/src/components/Select/Select.tsx +13 -26
  167. package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +17 -56
  168. package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +7 -21
  169. package/src/components/SkeletonLoader/SkeletonLoader.tsx +9 -8
  170. package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +33 -33
  171. package/src/components/SkipNavigation/SkipNavigation.stories.mdx +90 -0
  172. package/src/components/SkipNavigation/SkipNavigation.test.tsx +63 -0
  173. package/src/components/SkipNavigation/SkipNavigation.tsx +51 -0
  174. package/src/components/SkipNavigation/__snapshots__/SkipNavigation.test.tsx.snap +130 -0
  175. package/src/components/Slider/Slider.stories.mdx +19 -53
  176. package/src/components/Slider/Slider.test.tsx +2 -2
  177. package/src/components/Slider/Slider.tsx +10 -12
  178. package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +2 -9
  179. package/src/components/StatusBadge/StatusBadge.stories.mdx +6 -21
  180. package/src/components/StatusBadge/StatusBadge.test.tsx +2 -3
  181. package/src/components/StatusBadge/StatusBadge.tsx +3 -10
  182. package/src/components/StructuredContent/StructuredContent.stories.mdx +30 -58
  183. package/src/components/StructuredContent/StructuredContent.test.tsx +42 -44
  184. package/src/components/StructuredContent/StructuredContent.tsx +9 -18
  185. package/src/components/StyleGuide/Bidirectionality.stories.mdx +9 -23
  186. package/src/components/StyleGuide/Buttons.stories.mdx +62 -62
  187. package/src/components/StyleGuide/ColorCard.tsx +2 -4
  188. package/src/components/StyleGuide/Colors.stories.mdx +7 -8
  189. package/src/components/StyleGuide/DesignTokens.stories.mdx +5 -7
  190. package/src/components/StyleGuide/Forms.stories.mdx +0 -1
  191. package/src/components/StyleGuide/Iconography.stories.mdx +59 -77
  192. package/src/components/StyleGuide/Spacing.stories.mdx +0 -1
  193. package/src/components/StyleGuide/Typography.stories.mdx +15 -18
  194. package/src/components/Table/Table.stories.mdx +85 -1
  195. package/src/components/Table/Table.test.tsx +57 -1
  196. package/src/components/Table/Table.tsx +7 -4
  197. package/src/components/Table/__snapshots__/Table.test.tsx.snap +121 -0
  198. package/src/components/Tabs/Tabs.stories.mdx +1 -1
  199. package/src/components/Tabs/Tabs.test.tsx +2 -2
  200. package/src/components/Tabs/Tabs.tsx +26 -27
  201. package/src/components/Template/Template.stories.mdx +49 -54
  202. package/src/components/Template/Template.tsx +9 -3
  203. package/src/components/Text/Text.stories.mdx +5 -11
  204. package/src/components/Text/Text.test.tsx +3 -6
  205. package/src/components/Text/Text.tsx +3 -5
  206. package/src/components/TextInput/TextInput.stories.mdx +10 -22
  207. package/src/components/TextInput/TextInput.test.tsx +32 -62
  208. package/src/components/TextInput/TextInput.tsx +61 -30
  209. package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +1 -0
  210. package/src/components/Toggle/Toggle.stories.mdx +5 -16
  211. package/src/components/Toggle/Toggle.test.tsx +2 -3
  212. package/src/components/Toggle/Toggle.tsx +9 -10
  213. package/src/components/VideoPlayer/VideoPlayer.stories.mdx +13 -29
  214. package/src/components/VideoPlayer/VideoPlayer.test.tsx +18 -23
  215. package/src/components/VideoPlayer/VideoPlayer.tsx +13 -10
  216. package/src/docs/Chakra.stories.mdx +14 -11
  217. package/src/docs/Welcome.stories.mdx +23 -43
  218. package/src/helpers/types.ts +1 -0
  219. package/src/hooks/tests/useNYPLTheme.test.tsx +1 -1
  220. package/src/hooks/useNYPLTheme.stories.mdx +3 -6
  221. package/src/index.ts +51 -45
  222. package/src/theme/components/buttonGroup.ts +10 -0
  223. package/src/theme/components/card.ts +50 -15
  224. package/src/theme/components/componentWrapper.ts +5 -1
  225. package/src/theme/components/customTable.ts +8 -2
  226. package/src/theme/components/fieldset.ts +5 -1
  227. package/src/theme/components/helperErrorText.ts +5 -1
  228. package/src/theme/components/hero.ts +2 -2
  229. package/src/theme/components/horizontalRule.ts +5 -1
  230. package/src/theme/components/icon.ts +7 -1
  231. package/src/theme/components/image.ts +14 -3
  232. package/src/theme/components/label.ts +5 -1
  233. package/src/theme/components/list.ts +8 -2
  234. package/src/theme/components/logo.ts +5 -1
  235. package/src/theme/components/notification.ts +38 -14
  236. package/src/theme/components/progressIndicator.ts +10 -5
  237. package/src/theme/components/select.ts +5 -2
  238. package/src/theme/components/skeletonLoader.ts +8 -2
  239. package/src/theme/components/skipNavigation.ts +26 -0
  240. package/src/theme/components/slider.ts +13 -1
  241. package/src/theme/components/structuredContent.ts +11 -1
  242. package/src/theme/components/text.ts +12 -5
  243. package/src/theme/components/toggle.ts +9 -3
  244. package/src/theme/index.ts +4 -0
  245. package/src/theme/provider.tsx +1 -1
  246. package/src/utils/componentCategories.ts +13 -5
  247. package/src/utils/interfaces.ts +5 -0
  248. package/src/utils/utils.ts +2 -32
  249. package/dist/components/Accordion/AccordionTypes.d.ts +0 -5
  250. package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +0 -8
  251. package/dist/components/Button/ButtonTypes.d.ts +0 -8
  252. package/dist/components/DatePicker/DatePickerTypes.d.ts +0 -5
  253. package/dist/components/Form/FormTypes.d.ts +0 -2
  254. package/dist/components/Grid/GridTypes.d.ts +0 -9
  255. package/dist/components/Heading/HeadingTypes.d.ts +0 -14
  256. package/dist/components/Hero/HeroTypes.d.ts +0 -12
  257. package/dist/components/Icons/IconTypes.d.ts +0 -77
  258. package/dist/components/Image/ImageTypes.d.ts +0 -22
  259. package/dist/components/Link/LinkTypes.d.ts +0 -8
  260. package/dist/components/List/ListTypes.d.ts +0 -5
  261. package/dist/components/Logo/LogoTypes.d.ts +0 -54
  262. package/dist/components/Notification/NotificationTypes.d.ts +0 -5
  263. package/dist/components/ProgressIndicator/ProgressIndicatorTypes.d.ts +0 -8
  264. package/dist/components/Select/SelectTypes.d.ts +0 -8
  265. package/dist/components/SkeletonLoader/SkeletonLoaderTypes.d.ts +0 -5
  266. package/dist/components/StatusBadge/StatusBadgeTypes.d.ts +0 -5
  267. package/dist/components/StructuredContent/StructuredContentTypes.d.ts +0 -5
  268. package/dist/components/Text/TextTypes.d.ts +0 -6
  269. package/dist/components/TextInput/TextInputTypes.d.ts +0 -25
  270. package/dist/components/Toggle/ToggleTypes.d.ts +0 -4
  271. package/dist/components/VideoPlayer/VideoPlayerTypes.d.ts +0 -9
  272. package/dist/helpers/enums.d.ts +0 -4
  273. package/dist/utils/siteSections.d.ts +0 -2
  274. package/src/components/Accordion/AccordionTypes.tsx +0 -5
  275. package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +0 -8
  276. package/src/components/Button/ButtonTypes.tsx +0 -8
  277. package/src/components/DatePicker/DatePickerTypes.tsx +0 -5
  278. package/src/components/Form/FormTypes.tsx +0 -3
  279. package/src/components/Grid/GridTypes.tsx +0 -9
  280. package/src/components/Heading/HeadingTypes.tsx +0 -15
  281. package/src/components/Hero/HeroTypes.tsx +0 -20
  282. package/src/components/Icons/IconTypes.tsx +0 -83
  283. package/src/components/Image/ImageTypes.ts +0 -24
  284. package/src/components/Link/LinkTypes.tsx +0 -8
  285. package/src/components/List/ListTypes.tsx +0 -5
  286. package/src/components/Logo/LogoTypes.tsx +0 -56
  287. package/src/components/Notification/NotificationTypes.tsx +0 -5
  288. package/src/components/ProgressIndicator/ProgressIndicatorTypes.ts +0 -8
  289. package/src/components/Select/SelectTypes.tsx +0 -10
  290. package/src/components/SkeletonLoader/SkeletonLoaderTypes.tsx +0 -5
  291. package/src/components/StatusBadge/StatusBadgeTypes.tsx +0 -5
  292. package/src/components/StructuredContent/StructuredContentTypes.tsx +0 -5
  293. package/src/components/Text/TextTypes.tsx +0 -6
  294. package/src/components/TextInput/TextInputTypes.tsx +0 -48
  295. package/src/components/Toggle/ToggleTypes.tsx +0 -4
  296. package/src/components/VideoPlayer/VideoPlayerTypes.tsx +0 -10
  297. package/src/helpers/enums.ts +0 -4
  298. package/src/utils/siteSections.ts +0 -10
@@ -14,12 +14,9 @@ import Button from "../Button/Button";
14
14
  import Card, { CardHeading, CardContent, CardActions } from "../Card/Card";
15
15
  import Form, { FormRow, FormField } from "../Form/Form";
16
16
  import Heading from "../Heading/Heading";
17
- import { HeadingLevels } from "../Heading/HeadingTypes";
18
17
  import Hero from "../Hero/Hero";
19
18
  import HorizontalRule from "../HorizontalRule/HorizontalRule";
20
- import { HeroTypes } from "../Hero/HeroTypes";
21
19
  import Image from "../Image/Image";
22
- import { ImageRatios, ImageSizes } from "../Image/ImageTypes";
23
20
  import Link from "../Link/Link";
24
21
  import Notification, {
25
22
  NotificationContent,
@@ -27,6 +24,7 @@ import Notification, {
27
24
  NotificationProps,
28
25
  } from "../Notification/Notification";
29
26
  import Placeholder from "../Placeholder/Placeholder";
27
+ import SkipNavigation from "../SkipNavigation/SkipNavigation";
30
28
  import {
31
29
  Template,
32
30
  TemplateAboveHeader,
@@ -40,7 +38,6 @@ import {
40
38
  TemplateAppContainer,
41
39
  } from "./Template";
42
40
  import TextInput from "../TextInput/TextInput";
43
- import { NotificationTypes } from "../Notification/NotificationTypes";
44
41
  import { getCategory } from "../../utils/componentCategories";
45
42
 
46
43
  <Meta
@@ -79,6 +76,9 @@ If you have a custom `Header` component that _already_ renders an HTML `<header>
79
76
  element, set `renderHeaderElement` to false so only one `<header>` element is
80
77
  rendered.
81
78
 
79
+ If you need to render the `SkipNavigation` component, set `renderSkipNavigation`
80
+ to true.
81
+
82
82
  Likewise, if you have a custom `Footer` component that _already_ renders an HTML
83
83
  `<footer>` element, set `renderFooterElement` to false so only one `<footer>`
84
84
  element is rendered.
@@ -107,6 +107,7 @@ import { TemplateAppContainer } from "@nypl/design-system-react-components";
107
107
  </>
108
108
  }
109
109
  footer={<Placeholder variant="short">Footer</Placeholder>}
110
+ renderSkipNavigation={true}
110
111
  />;
111
112
  ```
112
113
 
@@ -137,6 +138,7 @@ import { TemplateAppContainer } from "@nypl/design-system-react-components";
137
138
  sidebar: "left",
138
139
  renderFooterElement: true,
139
140
  renderHeaderElement: true,
141
+ renderSkipNavigation: false,
140
142
  }}
141
143
  argTypes={{
142
144
  aboveHeader: { control: false },
@@ -176,11 +178,15 @@ accessibility violation.
176
178
 
177
179
  The `TemplateAppContainer` component renders a full DOM and one of the children
178
180
  is the `main` HTML element with a default "id" of `"mainContent"`. This should
179
- be used as the anchor element that the skip navigation link points to. As of
180
- v0.25.13, the consuming application is responsible for adding the skip
181
- navigation feature to the application. If your application is using the current
182
- NYPL Header, it already contains the skip navigation feature but make sure it is
183
- pointing to the correct anchor element.
181
+ be used as the anchor element that the skip navigation link points to. If your
182
+ application is using the current NYPL Header, it already contains the skip
183
+ navigation feature but make sure it is pointing to the correct anchor element.
184
+
185
+ If you are using a custom header component or you need to use the Reservoir
186
+ Design System (DS) `SkipNavigation` component, then set the `renderSkipNavigation`
187
+ prop to true. This will render the `SkipNavigation` component at the top of the
188
+ page before any other elements. The main link will point to the `#mainContent`
189
+ `main` element.
184
190
 
185
191
  Resources
186
192
 
@@ -191,13 +197,17 @@ Resources
191
197
 
192
198
  ## Template Children Overview
193
199
 
194
- The Reservoir Design System (DS) also provides a set of "template" components
195
- that work together to render a consistent mobile and desktop layout. More
196
- information on individual components and how they should be composed can be
197
- found below. Even though these component are available for use, we recommend
198
- using the `TemplateAppContainer` component and passing down children component
200
+ The Reservoir Design System (DS) also provides a set of "template" components
201
+ that work together to render a consistent mobile and desktop layout. More
202
+ information on individual components and how they should be composed can be
203
+ found below. Even though these component are available for use, we recommend
204
+ using the `TemplateAppContainer` component and passing down children component
199
205
  as props as needed.
200
206
 
207
+ Note: If you need to render the `SkipNavigation` component, you need to explicitly
208
+ render it immediately before the `TemplateAboveHeader` component. This is done
209
+ automatically in the `TemplateAppContainer` component.
210
+
201
211
  Basic "template" components structure:
202
212
 
203
213
  ```
@@ -215,6 +225,7 @@ import {
215
225
 
216
226
 
217
227
  <Template>
228
+ <SkipNavigation />
218
229
  <TemplateAboveHeader>
219
230
  // ...
220
231
  </TemplateAboveHeader>
@@ -263,6 +274,7 @@ import {
263
274
  >
264
275
  {(args) => (
265
276
  <Template>
277
+ <SkipNavigation />
266
278
  <TemplateAboveHeader>
267
279
  <Placeholder variant="short">Above Header</Placeholder>
268
280
  </TemplateAboveHeader>
@@ -524,9 +536,9 @@ This is best viewed in the Storybook "Canvas" and not "Docs" section.
524
536
  <Canvas>
525
537
  <Story name="Full Example with Template Children Components">
526
538
  <Template>
539
+ <SkipNavigation />
527
540
  <TemplateAboveHeader>
528
541
  <Notification
529
- notificationType={NotificationTypes.Standard}
530
542
  notificationHeading="Standard Notification"
531
543
  notificationContent={
532
544
  <>
@@ -555,12 +567,12 @@ This is best viewed in the Storybook "Canvas" and not "Docs" section.
555
567
  />
556
568
  <Hero
557
569
  backgroundImageSrc="https://placeimg.com/2400/800/nature/grayscale"
558
- heroType={HeroTypes.Campaign}
559
- heading={
560
- <Heading level={HeadingLevels.One} id="1" text="Hero Campaign" />
561
- }
562
- imageAlt="Image example"
563
- imageSrc="https://placeimg.com/800/400/animals"
570
+ heroType="campaign"
571
+ heading={<Heading level="one" id="1" text="Hero Campaign" />}
572
+ imageProps={{
573
+ alt: "Image example",
574
+ src: "https://placeimg.com/800/400/animals",
575
+ }}
564
576
  subHeaderText={otherSubHeaderText}
565
577
  />
566
578
  </TemplateBreakout>
@@ -568,7 +580,7 @@ This is best viewed in the Storybook "Canvas" and not "Docs" section.
568
580
  <TemplateContent sidebar="right">
569
581
  <TemplateContentTop>
570
582
  <Notification
571
- notificationType={NotificationTypes.Announcement}
583
+ notificationType="announcement"
572
584
  notificationHeading="Announcement Notification"
573
585
  notificationContent={
574
586
  <>
@@ -587,18 +599,20 @@ This is best viewed in the Storybook "Canvas" and not "Docs" section.
587
599
  <Accordion accordionData={faqContent} />
588
600
  <HorizontalRule />
589
601
  <p>Fill out the form!</p>
590
- <Form action="/end/point">
602
+ <Form id="form1" action="/end/point">
591
603
  <FormField>
592
604
  <TextInput
593
- labelText="Username"
594
605
  helperText="Make sure to complete this field."
606
+ id="username"
607
+ labelText="Username"
595
608
  required
596
609
  />
597
610
  </FormField>
598
611
  <FormField>
599
612
  <TextInput
600
- labelText="Password"
601
613
  helperText="Make sure to complete this field."
614
+ id="password"
615
+ labelText="Password"
602
616
  required
603
617
  />
604
618
  </FormField>
@@ -614,7 +628,7 @@ This is best viewed in the Storybook "Canvas" and not "Docs" section.
614
628
  </FormField>
615
629
  </FormRow>
616
630
  <FormField>
617
- <Button>Submit</Button>
631
+ <Button id="submit">Submit</Button>
618
632
  </FormField>
619
633
  </Form>
620
634
  </TemplateContentPrimary>
@@ -623,16 +637,14 @@ This is best viewed in the Storybook "Canvas" and not "Docs" section.
623
637
  <Card
624
638
  imageProps={{
625
639
  alt: "Alt text",
626
- aspectRatio: ImageRatios.Square,
627
- size: ImageSizes.Small,
640
+ aspectRatio: "square",
641
+ size: "small",
628
642
  src: "https://placeimg.com/400/200/animals",
629
643
  }}
630
644
  isCentered
631
645
  >
632
- <CardHeading level={HeadingLevels.Two} id="heading1">
633
- Small Animal Image
634
- </CardHeading>
635
- <CardHeading level={HeadingLevels.Three} id="heading2">
646
+ <CardHeading id="heading1">Small Animal Image</CardHeading>
647
+ <CardHeading level="three" id="heading2">
636
648
  Animal info
637
649
  </CardHeading>
638
650
  <CardContent>
@@ -647,16 +659,14 @@ This is best viewed in the Storybook "Canvas" and not "Docs" section.
647
659
  id="custom-card"
648
660
  imageProps={{
649
661
  alt: "Alt text",
650
- aspectRatio: ImageRatios.SixteenByNine,
662
+ aspectRatio: "sixteenByNine",
651
663
  src: "https://cdn-d8.nypl.org/s3fs-public/2020-05/NYPL_MainFacadeRev2Cam2.png",
652
664
  }}
653
665
  layout="horizontal"
654
666
  backgroundColor="#616161"
655
667
  foregroundColor="#FFF"
656
668
  >
657
- <CardHeading id="heading1-footer" level={HeadingLevels.Two}>
658
- Footer
659
- </CardHeading>
669
+ <CardHeading id="heading1-footer">Footer</CardHeading>
660
670
  <CardContent>
661
671
  <p>This is an example footer using the `Card` component.</p>
662
672
  <p>
@@ -665,27 +675,12 @@ This is best viewed in the Storybook "Canvas" and not "Docs" section.
665
675
  </p>
666
676
  </CardContent>
667
677
  <CardActions>
668
- <Link
669
- attributes={{
670
- style: { color: "#FFF", textDecoration: "underline" },
671
- }}
672
- href="#"
673
- >
678
+ <Link color="#FFF" href="#" textDecoration="underline">
674
679
  Facebook
675
680
  </Link>
676
- ,<Link
677
- attributes={{
678
- style: { color: "#FFF", textDecoration: "underline" },
679
- }}
680
- href="#"
681
- >
681
+ ,<Link color="#FFF" href="#" textDecoration="underline">
682
682
  Instagram
683
- </Link>,<Link
684
- attributes={{
685
- style: { color: "#FFF", textDecoration: "underline" },
686
- }}
687
- href="#"
688
- >
683
+ </Link>,<Link color="#FFF" href="#" textDecoration="underline">
689
684
  Twitter
690
685
  </Link>
691
686
  </CardActions>
@@ -1,6 +1,8 @@
1
1
  import { Box, chakra, useStyleConfig } from "@chakra-ui/react";
2
2
  import * as React from "react";
3
3
 
4
+ import SkipNavigation from "../SkipNavigation/SkipNavigation";
5
+
4
6
  export interface TemplateProps {}
5
7
  export interface TemplateHeaderProps {
6
8
  /** Flag to render an HTML header element. True by default. */
@@ -43,6 +45,8 @@ export interface TemplateAppContainerProps
43
45
  footer?: React.ReactElement;
44
46
  /** DOM that will be rendered in the `TemplateHeader` component section. */
45
47
  header?: React.ReactElement;
48
+ /** Render the `SkipNavigation` component or not. False by default. */
49
+ renderSkipNavigation?: boolean;
46
50
  }
47
51
 
48
52
  /**
@@ -89,7 +93,7 @@ const TemplateHeader = ({
89
93
  if (renderHeaderElement) {
90
94
  // But if they passed in a component that renders an HTML `<header>`,
91
95
  // then log a warning.
92
- React.Children.map(children, (child: React.ReactElement) => {
96
+ React.Children.map(children as JSX.Element, (child: React.ReactElement) => {
93
97
  if (child?.type === "header" || child?.props?.mdxType === "header") {
94
98
  console.warn(
95
99
  "NYPL Reservoir TemplateHeader: An HTML `header` element was passed " +
@@ -137,7 +141,7 @@ const TemplateContent = (
137
141
  // Manually pass in the `sidebar` prop to the `TemplateContentPrimary` and
138
142
  // `TemplateContentSidebar` components.
139
143
  const newChildren = React.Children.map(
140
- children,
144
+ children as JSX.Element,
141
145
  (child: React.ReactElement) => {
142
146
  let newChild = child;
143
147
  if (
@@ -224,7 +228,7 @@ const TemplateFooter = ({
224
228
  // The user wants to render the `footer` HTML element.
225
229
  if (renderFooterElement) {
226
230
  // But give a warning if one was passed.
227
- React.Children.map(children, (child: React.ReactElement) => {
231
+ React.Children.map(children as JSX.Element, (child: React.ReactElement) => {
228
232
  if (child?.type === "footer" || child?.props?.mdxType === "footer") {
229
233
  console.warn(
230
234
  "NYPL Reservoir TemplateFooter: An HTML `footer` element was passed " +
@@ -259,6 +263,7 @@ export const TemplateAppContainer = chakra(
259
263
  sidebar = "none",
260
264
  renderFooterElement = true,
261
265
  renderHeaderElement = true,
266
+ renderSkipNavigation = false,
262
267
  ...rest
263
268
  } = props;
264
269
  const aboveHeaderElem = aboveHeader && (
@@ -278,6 +283,7 @@ export const TemplateAppContainer = chakra(
278
283
  );
279
284
  return (
280
285
  <Template {...rest}>
286
+ {renderSkipNavigation ? <SkipNavigation /> : null}
281
287
  {aboveHeaderElem}
282
288
  {(header || breakoutElem) && (
283
289
  <TemplateHeader renderHeaderElement={renderHeaderElement}>
@@ -8,11 +8,7 @@ import {
8
8
  import { withDesign } from "storybook-addon-designs";
9
9
 
10
10
  import Text from "./Text";
11
- import { TextSizes } from "./TextTypes";
12
11
  import { getCategory } from "../../utils/componentCategories";
13
- import { getStorybookEnumValues } from "../../utils/utils";
14
-
15
- export const enumValues = getStorybookEnumValues(TextSizes, "TextSizes");
16
12
 
17
13
  <Meta
18
14
  title={getCategory("Text")}
@@ -30,9 +26,7 @@ export const enumValues = getStorybookEnumValues(TextSizes, "TextSizes");
30
26
  isItalic: { table: { defaultValue: { summary: false } } },
31
27
  noSpace: { table: { defaultValue: { summary: false } } },
32
28
  size: {
33
- control: { type: "select" },
34
- options: enumValues.options,
35
- table: { defaultValue: { summary: "TextSizes.Default" } },
29
+ table: { defaultValue: { summary: "default" } },
36
30
  },
37
31
  }}
38
32
  />
@@ -42,7 +36,7 @@ export const enumValues = getStorybookEnumValues(TextSizes, "TextSizes");
42
36
  | Component Version | DS Version |
43
37
  | ----------------- | ---------- |
44
38
  | Added | `0.25.1` |
45
- | Latest | `0.26.0` |
39
+ | Latest | `0.28.0` |
46
40
 
47
41
  ## Table of Contents
48
42
 
@@ -64,7 +58,7 @@ The `Text` component renders a basic `<p>` element. As its name indicates, the
64
58
  name="Text"
65
59
  args={{
66
60
  className: undefined,
67
- size: "TextSizes.Default",
61
+ size: "default",
68
62
  isBold: false,
69
63
  isItalic: false,
70
64
  noSpace: false,
@@ -72,7 +66,7 @@ The `Text` component renders a basic `<p>` element. As its name indicates, the
72
66
  >
73
67
  {(args) => (
74
68
  <>
75
- <Text {...args} size={enumValues.getValue(args.size)}>
69
+ <Text {...args}>
76
70
  Animal Crossing[a] is a social simulation video game series developed
77
71
  and published by Nintendo. The series was conceptualized and created
78
72
  by Katsuya Eguchi and Hisashi Nogami. In Animal Crossing, the player
@@ -82,7 +76,7 @@ The `Text` component renders a basic `<p>` element. As its name indicates, the
82
76
  open-ended gameplay and use of the video game console's internal clock
83
77
  and calendar to simulate real passage of time.
84
78
  </Text>
85
- <Text {...args} size={enumValues.getValue(args.size)}>
79
+ <Text {...args}>
86
80
  Since its initial release in 2001, five Animal Crossing games have
87
81
  been released worldwide, one each for the Nintendo 64/iQue Player
88
82
  (enhanced and reissued for the GameCube), Nintendo DS, Wii, Nintendo
@@ -4,7 +4,6 @@ import { axe } from "jest-axe";
4
4
  import renderer from "react-test-renderer";
5
5
 
6
6
  import Text from "./Text";
7
- import { TextSizes } from "./TextTypes";
8
7
 
9
8
  describe("Text Accessibility", () => {
10
9
  it("passes axe accessibility test", async () => {
@@ -35,15 +34,13 @@ describe("Text", () => {
35
34
  .create(<Text>Animal Crossing is all that!</Text>)
36
35
  .toJSON();
37
36
  const caption = renderer
38
- .create(
39
- <Text size={TextSizes.Caption}>Animal Crossing is all that!</Text>
40
- )
37
+ .create(<Text size="caption">Animal Crossing is all that!</Text>)
41
38
  .toJSON();
42
39
  const tag = renderer
43
- .create(<Text size={TextSizes.Tag}>Animal Crossing is all that!</Text>)
40
+ .create(<Text size="tag">Animal Crossing is all that!</Text>)
44
41
  .toJSON();
45
42
  const mini = renderer
46
- .create(<Text size={TextSizes.Mini}>Animal Crossing is all that!</Text>)
43
+ .create(<Text size="mini">Animal Crossing is all that!</Text>)
47
44
  .toJSON();
48
45
  const withChakraProps = renderer
49
46
  .create(
@@ -1,8 +1,7 @@
1
1
  import { Text as ChakraText, chakra, useStyleConfig } from "@chakra-ui/react";
2
2
  import * as React from "react";
3
3
 
4
- import { TextSizes } from "./TextTypes";
5
- import { getVariant } from "../../utils/utils";
4
+ export type TextSizes = "default" | "caption" | "tag" | "mini";
6
5
 
7
6
  export interface TextProps {
8
7
  /** Additional class name to render in the `Text` component. */
@@ -24,12 +23,11 @@ export const Text = chakra((props: React.PropsWithChildren<TextProps>) => {
24
23
  isBold,
25
24
  isItalic,
26
25
  noSpace,
27
- size = TextSizes.Default,
26
+ size = "default",
28
27
  ...rest
29
28
  } = props;
30
- const variant = getVariant(size, TextSizes, TextSizes.Default);
31
29
  const styles = useStyleConfig("Text", {
32
- variant,
30
+ variant: size,
33
31
  isBold,
34
32
  isItalic,
35
33
  noSpace,
@@ -9,15 +9,8 @@ import {
9
9
  import { withDesign } from "storybook-addon-designs";
10
10
 
11
11
  import TextInput from "./TextInput";
12
- import { TextInputTypes, TextInputVariants } from "./TextInputTypes";
13
12
  import { getCategory } from "../../utils/componentCategories";
14
13
  import DSProvider from "../../theme/provider";
15
- import { getStorybookEnumValues } from "../../utils/utils";
16
-
17
- export const enumValues = getStorybookEnumValues(
18
- TextInputTypes,
19
- "TextInputTypes"
20
- );
21
14
 
22
15
  <Meta
23
16
  title={getCategory("TextInput")}
@@ -31,7 +24,6 @@ export const enumValues = getStorybookEnumValues(
31
24
  jest: ["TextInput.test.tsx"],
32
25
  }}
33
26
  argTypes={{
34
- attributes: { control: false },
35
27
  id: { control: false },
36
28
  isDisabled: { table: { defaultValue: { summary: false } } },
37
29
  isInvalid: { table: { defaultValue: { summary: false } } },
@@ -45,12 +37,10 @@ export const enumValues = getStorybookEnumValues(
45
37
  step: { table: { defaultValue: { summary: 1 } } },
46
38
  textInputType: {
47
39
  control: false,
48
- table: { defaultValue: { summary: "TextInputVariants.Default" } },
40
+ table: { defaultValue: { summary: "default" } },
49
41
  },
50
42
  type: {
51
- control: { type: "select" },
52
- table: { defaultValue: { summary: "TextInputTypes.text" } },
53
- options: enumValues.options,
43
+ table: { defaultValue: { summary: "text" } },
54
44
  },
55
45
  value: { control: false },
56
46
  }}
@@ -61,7 +51,7 @@ export const enumValues = getStorybookEnumValues(
61
51
  | Component Version | DS Version |
62
52
  | ----------------- | ---------- |
63
53
  | Added | `0.22.0` |
64
- | Latest | `0.26.0` |
54
+ | Latest | `0.28.0` |
65
55
 
66
56
  ## Table of Contents
67
57
 
@@ -88,8 +78,6 @@ is left blank, a value will be generated for you.
88
78
  <Story
89
79
  name="TextInput with Controls"
90
80
  args={{
91
- additionalStyles: undefined,
92
- attributes: undefined,
93
81
  className: undefined,
94
82
  defaultValue: undefined,
95
83
  helperText: "Choose wisely.",
@@ -106,12 +94,12 @@ is left blank, a value will be generated for you.
106
94
  showLabel: true,
107
95
  showRequiredLabel: true,
108
96
  step: 1,
109
- type: "TextInputTypes.text",
97
+ type: "text",
110
98
  value: undefined,
111
- textInputType: TextInputVariants.Default,
99
+ textInputType: "default",
112
100
  }}
113
101
  >
114
- {(args) => <TextInput {...args} type={enumValues.getValue(args.type)} />}
102
+ {(args) => <TextInput {...args} />}
115
103
  </Story>
116
104
  </Canvas>
117
105
 
@@ -129,7 +117,7 @@ Internally, a `Label` is associated with the `<input>` element. When `showLabel`
129
117
  is set to false, the `<input>` element's `aria-label` attribute is set to the
130
118
  required `labelText` value.
131
119
 
132
- When the `type` prop is set to `TextInputTypes.textarea`, the `<textarea>` element
120
+ When the `type` prop is set to `"textarea"`, the `<textarea>` element
133
121
  is rendered instead of the `<input>` element. This element follows all the same
134
122
  accessibility rules described above.
135
123
 
@@ -251,8 +239,8 @@ helperText={<>Choose <b>wisely!</b></>}
251
239
  ## Textarea
252
240
 
253
241
  The TextInput component includes a multiline `textarea` form field. To render a
254
- `textarea` element, pass `TextInputTypes.textarea` for the `type` prop.
255
- All the variations described above are available for the `textarea` option.
242
+ `textarea` element, pass `"textarea"` for the `type` prop. All the variations
243
+ described above are available for the `textarea` option.
256
244
 
257
245
  <Canvas withToolbar>
258
246
  <Story
@@ -268,7 +256,7 @@ All the variations described above are available for the `textarea` option.
268
256
  placeholder: "Essay question...",
269
257
  showLabel: true,
270
258
  showRequiredLabel: true,
271
- type: TextInputTypes.textarea,
259
+ type: "textarea",
272
260
  }}
273
261
  argTypes={{
274
262
  type: { control: false },