@nypl/design-system-react-components 0.26.1 → 1.0.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 (307) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/README.md +7 -7
  3. package/dist/components/Accordion/Accordion.d.ts +1 -1
  4. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +1 -5
  5. package/dist/components/Button/Button.d.ts +2 -10
  6. package/dist/components/ButtonGroup/ButtonGroup.d.ts +22 -0
  7. package/dist/components/Card/Card.d.ts +2 -2
  8. package/dist/components/Checkbox/Checkbox.d.ts +10 -8
  9. package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +1 -1
  10. package/dist/components/DatePicker/DatePicker.d.ts +1 -1
  11. package/dist/components/Form/Form.d.ts +2 -2
  12. package/dist/components/Grid/SimpleGrid.d.ts +6 -3
  13. package/dist/components/Heading/Heading.d.ts +2 -5
  14. package/dist/components/HelperErrorText/HelperErrorText.d.ts +1 -5
  15. package/dist/components/Hero/Hero.d.ts +13 -9
  16. package/dist/components/Icons/Icon.d.ts +6 -5
  17. package/dist/components/Icons/IconSvgs.d.ts +21 -21
  18. package/dist/components/Image/Image.d.ts +8 -5
  19. package/dist/components/Link/Link.d.ts +1 -9
  20. package/dist/components/List/List.d.ts +7 -11
  21. package/dist/components/Logo/Logo.d.ts +2 -5
  22. package/dist/components/Logo/LogoSvgs.d.ts +39 -39
  23. package/dist/components/Modal/Modal.d.ts +28 -8
  24. package/dist/components/Notification/Notification.d.ts +1 -1
  25. package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +2 -1
  26. package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
  27. package/dist/components/SearchBar/SearchBar.d.ts +3 -2
  28. package/dist/components/Select/Select.d.ts +2 -5
  29. package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +4 -4
  30. package/dist/components/SkipNavigation/SkipNavigation.d.ts +17 -0
  31. package/dist/components/StatusBadge/StatusBadge.d.ts +2 -3
  32. package/dist/components/StructuredContent/StructuredContent.d.ts +2 -2
  33. package/dist/components/Table/Table.d.ts +1 -1
  34. package/dist/components/Template/Template.d.ts +2 -0
  35. package/dist/components/Text/Text.d.ts +1 -1
  36. package/dist/components/TextInput/TextInput.d.ts +21 -9
  37. package/dist/components/Toggle/Toggle.d.ts +1 -5
  38. package/dist/components/VideoPlayer/VideoPlayer.d.ts +2 -1
  39. package/dist/design-system-react-components.cjs.development.js +983 -1222
  40. package/dist/design-system-react-components.cjs.development.js.map +1 -1
  41. package/dist/design-system-react-components.cjs.production.min.js +1 -1
  42. package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
  43. package/dist/design-system-react-components.esm.js +982 -1285
  44. package/dist/design-system-react-components.esm.js.map +1 -1
  45. package/dist/helpers/types.d.ts +1 -0
  46. package/dist/index.d.ts +27 -48
  47. package/dist/styles.css +1 -1
  48. package/dist/theme/components/buttonGroup.d.ts +11 -0
  49. package/dist/theme/components/card.d.ts +104 -8
  50. package/dist/theme/components/componentWrapper.d.ts +4 -3
  51. package/dist/theme/components/customTable.d.ts +11 -14
  52. package/dist/theme/components/fieldset.d.ts +4 -3
  53. package/dist/theme/components/helperErrorText.d.ts +4 -3
  54. package/dist/theme/components/hero.d.ts +1 -1
  55. package/dist/theme/components/horizontalRule.d.ts +4 -3
  56. package/dist/theme/components/icon.d.ts +47743 -1
  57. package/dist/theme/components/image.d.ts +563 -10
  58. package/dist/theme/components/label.d.ts +4 -3
  59. package/dist/theme/components/list.d.ts +6 -7
  60. package/dist/theme/components/logo.d.ts +474 -1
  61. package/dist/theme/components/notification.d.ts +20 -16
  62. package/dist/theme/components/progressIndicator.d.ts +6 -4
  63. package/dist/theme/components/select.d.ts +4 -10
  64. package/dist/theme/components/skeletonLoader.d.ts +14 -10
  65. package/dist/theme/components/skipNavigation.d.ts +22 -0
  66. package/dist/theme/components/slider.d.ts +7 -6
  67. package/dist/theme/components/structuredContent.d.ts +10 -9
  68. package/dist/theme/components/text.d.ts +7 -1
  69. package/dist/theme/components/toggle.d.ts +6 -4
  70. package/dist/theme/provider.d.ts +2 -4
  71. package/dist/utils/componentCategories.d.ts +1 -1
  72. package/dist/utils/interfaces.d.ts +5 -0
  73. package/dist/utils/utils.d.ts +2 -18
  74. package/package.json +15 -16
  75. package/src/__tests__/setup.ts +3 -3
  76. package/src/__tests__/utils/utils.test.ts +1 -23
  77. package/src/components/AccessibilityGuide/SkipNavigation.stories.mdx +22 -14
  78. package/src/components/Accordion/Accordion.stories.mdx +43 -44
  79. package/src/components/Accordion/Accordion.test.tsx +5 -13
  80. package/src/components/Accordion/Accordion.tsx +14 -18
  81. package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +6 -6
  82. package/src/components/Autosuggest/Autosuggest.stories.mdx +1 -1
  83. package/src/components/Autosuggest/Autosuggest.stories.tsx +23 -25
  84. package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +21 -37
  85. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +4 -17
  86. package/src/components/Breadcrumbs/Breadcrumbs.tsx +18 -21
  87. package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +1 -100
  88. package/src/components/Button/Button.stories.mdx +89 -126
  89. package/src/components/Button/Button.test.tsx +16 -30
  90. package/src/components/Button/Button.tsx +14 -20
  91. package/src/components/ButtonGroup/ButtonGroup.stories.mdx +147 -0
  92. package/src/components/ButtonGroup/ButtonGroup.test.tsx +141 -0
  93. package/src/components/ButtonGroup/ButtonGroup.tsx +99 -0
  94. package/src/components/ButtonGroup/__snapshots__/ButtonGroup.test.tsx.snap +117 -0
  95. package/src/components/Card/Card.stories.mdx +144 -178
  96. package/src/components/Card/Card.test.tsx +36 -97
  97. package/src/components/Card/Card.tsx +78 -74
  98. package/src/components/Chakra/Box.stories.mdx +3 -7
  99. package/src/components/Chakra/Center.stories.mdx +6 -24
  100. package/src/components/Chakra/Flex.stories.mdx +5 -7
  101. package/src/components/Chakra/Grid.stories.mdx +1 -1
  102. package/src/components/Chakra/Stack.stories.mdx +10 -11
  103. package/src/components/Checkbox/Checkbox.stories.mdx +1 -1
  104. package/src/components/Checkbox/Checkbox.test.tsx +2 -2
  105. package/src/components/Checkbox/Checkbox.tsx +20 -13
  106. package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +6 -17
  107. package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +1 -7
  108. package/src/components/CheckboxGroup/CheckboxGroup.tsx +33 -29
  109. package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +0 -11
  110. package/src/components/ComponentWrapper/ComponentWrapper.tsx +3 -10
  111. package/src/components/DatePicker/DatePicker.stories.mdx +23 -37
  112. package/src/components/DatePicker/DatePicker.test.tsx +21 -19
  113. package/src/components/DatePicker/DatePicker.tsx +57 -49
  114. package/src/components/Form/Form.stories.mdx +46 -31
  115. package/src/components/Form/Form.test.tsx +1 -18
  116. package/src/components/Form/Form.tsx +7 -7
  117. package/src/components/Grid/SimpleGrid.stories.mdx +73 -49
  118. package/src/components/Grid/SimpleGrid.test.tsx +7 -9
  119. package/src/components/Grid/SimpleGrid.tsx +14 -11
  120. package/src/components/Heading/Heading.stories.mdx +27 -72
  121. package/src/components/Heading/Heading.test.tsx +18 -44
  122. package/src/components/Heading/Heading.tsx +7 -10
  123. package/src/components/HelperErrorText/HelperErrorText.stories.mdx +1 -3
  124. package/src/components/HelperErrorText/HelperErrorText.tsx +1 -5
  125. package/src/components/Hero/Hero.stories.mdx +219 -216
  126. package/src/components/Hero/Hero.test.tsx +107 -223
  127. package/src/components/Hero/Hero.tsx +63 -61
  128. package/src/components/Icons/Icon.stories.mdx +172 -118
  129. package/src/components/Icons/Icon.test.tsx +8 -16
  130. package/src/components/Icons/Icon.tsx +75 -29
  131. package/src/components/Icons/IconSvgs.tsx +42 -42
  132. package/src/components/Image/Image.stories.mdx +45 -132
  133. package/src/components/Image/Image.test.tsx +16 -31
  134. package/src/components/Image/Image.tsx +28 -12
  135. package/src/components/Link/Link.stories.mdx +30 -94
  136. package/src/components/Link/Link.test.tsx +25 -75
  137. package/src/components/Link/Link.tsx +43 -56
  138. package/src/components/Link/__snapshots__/Link.test.tsx.snap +1 -2
  139. package/src/components/List/List.stories.mdx +20 -31
  140. package/src/components/List/List.test.tsx +24 -43
  141. package/src/components/List/List.tsx +25 -36
  142. package/src/components/Logo/Logo.stories.mdx +94 -50
  143. package/src/components/Logo/Logo.test.tsx +10 -19
  144. package/src/components/Logo/Logo.tsx +50 -17
  145. package/src/components/Logo/LogoSvgs.tsx +78 -78
  146. package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +4 -4
  147. package/src/components/Modal/Modal.stories.mdx +245 -139
  148. package/src/components/Modal/Modal.test.tsx +147 -10
  149. package/src/components/Modal/Modal.tsx +140 -20
  150. package/src/components/Modal/__snapshots__/Modal.test.tsx.snap +25 -0
  151. package/src/components/Notification/Notification.stories.mdx +10 -28
  152. package/src/components/Notification/Notification.test.tsx +9 -12
  153. package/src/components/Notification/Notification.tsx +34 -37
  154. package/src/components/Pagination/Pagination.stories.mdx +3 -4
  155. package/src/components/Pagination/Pagination.tsx +15 -10
  156. package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +27 -53
  157. package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +9 -10
  158. package/src/components/ProgressIndicator/ProgressIndicator.tsx +17 -21
  159. package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +0 -10
  160. package/src/components/Radio/Radio.stories.mdx +1 -1
  161. package/src/components/Radio/Radio.tsx +9 -6
  162. package/src/components/RadioGroup/RadioGroup.stories.mdx +15 -16
  163. package/src/components/RadioGroup/RadioGroup.test.tsx +2 -8
  164. package/src/components/RadioGroup/RadioGroup.tsx +28 -24
  165. package/src/components/SearchBar/SearchBar.stories.mdx +4 -4
  166. package/src/components/SearchBar/SearchBar.test.tsx +1 -1
  167. package/src/components/SearchBar/SearchBar.tsx +14 -22
  168. package/src/components/SearchBar/__snapshots__/SearchBar.test.tsx.snap +1 -13
  169. package/src/components/Select/Select.stories.mdx +10 -25
  170. package/src/components/Select/Select.test.tsx +6 -7
  171. package/src/components/Select/Select.tsx +28 -35
  172. package/src/components/Select/__snapshots__/Select.test.tsx.snap +24 -24
  173. package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +17 -56
  174. package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +7 -21
  175. package/src/components/SkeletonLoader/SkeletonLoader.tsx +9 -8
  176. package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +33 -33
  177. package/src/components/SkipNavigation/SkipNavigation.stories.mdx +90 -0
  178. package/src/components/SkipNavigation/SkipNavigation.test.tsx +63 -0
  179. package/src/components/SkipNavigation/SkipNavigation.tsx +51 -0
  180. package/src/components/SkipNavigation/__snapshots__/SkipNavigation.test.tsx.snap +130 -0
  181. package/src/components/Slider/Slider.stories.mdx +19 -53
  182. package/src/components/Slider/Slider.test.tsx +2 -2
  183. package/src/components/Slider/Slider.tsx +10 -12
  184. package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +2 -9
  185. package/src/components/StatusBadge/StatusBadge.stories.mdx +6 -21
  186. package/src/components/StatusBadge/StatusBadge.test.tsx +2 -3
  187. package/src/components/StatusBadge/StatusBadge.tsx +3 -10
  188. package/src/components/StructuredContent/StructuredContent.stories.mdx +30 -58
  189. package/src/components/StructuredContent/StructuredContent.test.tsx +42 -44
  190. package/src/components/StructuredContent/StructuredContent.tsx +9 -18
  191. package/src/components/StyleGuide/Bidirectionality.stories.mdx +9 -23
  192. package/src/components/StyleGuide/Buttons.stories.mdx +63 -63
  193. package/src/components/StyleGuide/ColorCard.tsx +2 -4
  194. package/src/components/StyleGuide/Colors.stories.mdx +9 -10
  195. package/src/components/StyleGuide/DesignTokens.stories.mdx +5 -7
  196. package/src/components/StyleGuide/Forms.stories.mdx +2 -2
  197. package/src/components/StyleGuide/Iconography.stories.mdx +60 -78
  198. package/src/components/StyleGuide/Spacing.stories.mdx +1 -2
  199. package/src/components/StyleGuide/Typography.stories.mdx +16 -19
  200. package/src/components/Table/Table.stories.mdx +85 -1
  201. package/src/components/Table/Table.test.tsx +57 -1
  202. package/src/components/Table/Table.tsx +7 -4
  203. package/src/components/Table/__snapshots__/Table.test.tsx.snap +121 -0
  204. package/src/components/Tabs/Tabs.stories.mdx +1 -1
  205. package/src/components/Tabs/Tabs.test.tsx +2 -2
  206. package/src/components/Tabs/Tabs.tsx +26 -27
  207. package/src/components/Template/Template.stories.mdx +49 -54
  208. package/src/components/Template/Template.tsx +9 -3
  209. package/src/components/Text/Text.stories.mdx +5 -11
  210. package/src/components/Text/Text.test.tsx +3 -6
  211. package/src/components/Text/Text.tsx +3 -5
  212. package/src/components/TextInput/TextInput.stories.mdx +10 -22
  213. package/src/components/TextInput/TextInput.test.tsx +32 -62
  214. package/src/components/TextInput/TextInput.tsx +61 -30
  215. package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +1 -0
  216. package/src/components/Toggle/Toggle.stories.mdx +5 -16
  217. package/src/components/Toggle/Toggle.test.tsx +2 -3
  218. package/src/components/Toggle/Toggle.tsx +9 -10
  219. package/src/components/VideoPlayer/VideoPlayer.stories.mdx +13 -29
  220. package/src/components/VideoPlayer/VideoPlayer.test.tsx +18 -23
  221. package/src/components/VideoPlayer/VideoPlayer.tsx +13 -10
  222. package/src/docs/Chakra.stories.mdx +14 -11
  223. package/src/docs/Welcome.stories.mdx +23 -43
  224. package/src/helpers/types.ts +1 -0
  225. package/src/hooks/tests/useNYPLTheme.test.tsx +1 -1
  226. package/src/hooks/useNYPLTheme.stories.mdx +3 -6
  227. package/src/index.ts +52 -46
  228. package/src/styles.scss +0 -1
  229. package/src/theme/components/buttonGroup.ts +10 -0
  230. package/src/theme/components/card.ts +50 -15
  231. package/src/theme/components/componentWrapper.ts +5 -1
  232. package/src/theme/components/customTable.ts +8 -2
  233. package/src/theme/components/fieldset.ts +5 -1
  234. package/src/theme/components/helperErrorText.ts +5 -1
  235. package/src/theme/components/hero.ts +2 -2
  236. package/src/theme/components/horizontalRule.ts +5 -1
  237. package/src/theme/components/icon.ts +7 -1
  238. package/src/theme/components/image.ts +14 -3
  239. package/src/theme/components/label.ts +5 -1
  240. package/src/theme/components/list.ts +8 -2
  241. package/src/theme/components/logo.ts +5 -1
  242. package/src/theme/components/notification.ts +38 -14
  243. package/src/theme/components/progressIndicator.ts +10 -5
  244. package/src/theme/components/select.ts +5 -6
  245. package/src/theme/components/skeletonLoader.ts +8 -2
  246. package/src/theme/components/skipNavigation.ts +26 -0
  247. package/src/theme/components/slider.ts +13 -1
  248. package/src/theme/components/structuredContent.ts +11 -1
  249. package/src/theme/components/text.ts +12 -5
  250. package/src/theme/components/toggle.ts +9 -3
  251. package/src/theme/foundations/colors.ts +6 -9
  252. package/src/theme/index.ts +4 -0
  253. package/src/theme/provider.tsx +1 -1
  254. package/src/utils/componentCategories.ts +13 -5
  255. package/src/utils/interfaces.ts +5 -0
  256. package/src/utils/utils.ts +2 -32
  257. package/dist/components/Accordion/AccordionTypes.d.ts +0 -5
  258. package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +0 -8
  259. package/dist/components/Button/ButtonTypes.d.ts +0 -8
  260. package/dist/components/DatePicker/DatePickerTypes.d.ts +0 -5
  261. package/dist/components/Form/FormTypes.d.ts +0 -2
  262. package/dist/components/Grid/GridTypes.d.ts +0 -9
  263. package/dist/components/Heading/HeadingTypes.d.ts +0 -14
  264. package/dist/components/Hero/HeroTypes.d.ts +0 -12
  265. package/dist/components/Icons/IconTypes.d.ts +0 -77
  266. package/dist/components/Image/ImageTypes.d.ts +0 -22
  267. package/dist/components/Link/LinkTypes.d.ts +0 -8
  268. package/dist/components/List/ListTypes.d.ts +0 -5
  269. package/dist/components/Logo/LogoTypes.d.ts +0 -54
  270. package/dist/components/Notification/NotificationTypes.d.ts +0 -5
  271. package/dist/components/ProgressIndicator/ProgressIndicatorTypes.d.ts +0 -8
  272. package/dist/components/Select/SelectTypes.d.ts +0 -8
  273. package/dist/components/SkeletonLoader/SkeletonLoaderTypes.d.ts +0 -5
  274. package/dist/components/StatusBadge/StatusBadgeTypes.d.ts +0 -5
  275. package/dist/components/StructuredContent/StructuredContentTypes.d.ts +0 -5
  276. package/dist/components/Text/TextTypes.d.ts +0 -6
  277. package/dist/components/TextInput/TextInputTypes.d.ts +0 -25
  278. package/dist/components/Toggle/ToggleTypes.d.ts +0 -4
  279. package/dist/components/VideoPlayer/VideoPlayerTypes.d.ts +0 -9
  280. package/dist/helpers/enums.d.ts +0 -4
  281. package/dist/utils/siteSections.d.ts +0 -2
  282. package/src/components/Accordion/AccordionTypes.tsx +0 -5
  283. package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +0 -8
  284. package/src/components/Button/ButtonTypes.tsx +0 -8
  285. package/src/components/DatePicker/DatePickerTypes.tsx +0 -5
  286. package/src/components/Form/FormTypes.tsx +0 -3
  287. package/src/components/Grid/GridTypes.tsx +0 -9
  288. package/src/components/Heading/HeadingTypes.tsx +0 -15
  289. package/src/components/Hero/HeroTypes.tsx +0 -20
  290. package/src/components/Icons/IconTypes.tsx +0 -83
  291. package/src/components/Image/ImageTypes.ts +0 -24
  292. package/src/components/Link/LinkTypes.tsx +0 -8
  293. package/src/components/List/ListTypes.tsx +0 -5
  294. package/src/components/Logo/LogoTypes.tsx +0 -56
  295. package/src/components/Modal/_Modal.scss +0 -18
  296. package/src/components/Notification/NotificationTypes.tsx +0 -5
  297. package/src/components/ProgressIndicator/ProgressIndicatorTypes.ts +0 -8
  298. package/src/components/Select/SelectTypes.tsx +0 -10
  299. package/src/components/SkeletonLoader/SkeletonLoaderTypes.tsx +0 -5
  300. package/src/components/StatusBadge/StatusBadgeTypes.tsx +0 -5
  301. package/src/components/StructuredContent/StructuredContentTypes.tsx +0 -5
  302. package/src/components/Text/TextTypes.tsx +0 -6
  303. package/src/components/TextInput/TextInputTypes.tsx +0 -48
  304. package/src/components/Toggle/ToggleTypes.tsx +0 -4
  305. package/src/components/VideoPlayer/VideoPlayerTypes.tsx +0 -10
  306. package/src/helpers/enums.ts +0 -4
  307. package/src/utils/siteSections.ts +0 -10
@@ -29,7 +29,7 @@ exports[`SkeletonLoader renders the UI snapshot correctly 1`] = `
29
29
  className="css-0"
30
30
  style={
31
31
  Object {
32
- "marginBottom": null,
32
+ "marginBottom": undefined,
33
33
  }
34
34
  }
35
35
  />
@@ -45,7 +45,7 @@ exports[`SkeletonLoader renders the UI snapshot correctly 1`] = `
45
45
  className="css-0"
46
46
  style={
47
47
  Object {
48
- "marginBottom": null,
48
+ "marginBottom": undefined,
49
49
  }
50
50
  }
51
51
  />
@@ -57,7 +57,7 @@ exports[`SkeletonLoader renders the UI snapshot correctly 1`] = `
57
57
  className="css-0"
58
58
  style={
59
59
  Object {
60
- "marginBottom": null,
60
+ "marginBottom": undefined,
61
61
  }
62
62
  }
63
63
  />
@@ -108,7 +108,7 @@ exports[`SkeletonLoader renders the UI snapshot correctly 2`] = `
108
108
  className="css-0"
109
109
  style={
110
110
  Object {
111
- "marginBottom": null,
111
+ "marginBottom": undefined,
112
112
  }
113
113
  }
114
114
  />
@@ -124,7 +124,7 @@ exports[`SkeletonLoader renders the UI snapshot correctly 2`] = `
124
124
  className="css-0"
125
125
  style={
126
126
  Object {
127
- "marginBottom": null,
127
+ "marginBottom": undefined,
128
128
  }
129
129
  }
130
130
  />
@@ -136,7 +136,7 @@ exports[`SkeletonLoader renders the UI snapshot correctly 2`] = `
136
136
  className="css-0"
137
137
  style={
138
138
  Object {
139
- "marginBottom": null,
139
+ "marginBottom": undefined,
140
140
  }
141
141
  }
142
142
  />
@@ -187,7 +187,7 @@ exports[`SkeletonLoader renders the UI snapshot correctly 3`] = `
187
187
  className="css-0"
188
188
  style={
189
189
  Object {
190
- "marginBottom": null,
190
+ "marginBottom": undefined,
191
191
  }
192
192
  }
193
193
  />
@@ -203,7 +203,7 @@ exports[`SkeletonLoader renders the UI snapshot correctly 3`] = `
203
203
  className="css-0"
204
204
  style={
205
205
  Object {
206
- "marginBottom": null,
206
+ "marginBottom": undefined,
207
207
  }
208
208
  }
209
209
  />
@@ -215,7 +215,7 @@ exports[`SkeletonLoader renders the UI snapshot correctly 3`] = `
215
215
  className="css-0"
216
216
  style={
217
217
  Object {
218
- "marginBottom": null,
218
+ "marginBottom": undefined,
219
219
  }
220
220
  }
221
221
  />
@@ -259,7 +259,7 @@ exports[`SkeletonLoader renders the UI snapshot correctly 4`] = `
259
259
  className="css-0"
260
260
  style={
261
261
  Object {
262
- "marginBottom": null,
262
+ "marginBottom": undefined,
263
263
  }
264
264
  }
265
265
  />
@@ -275,7 +275,7 @@ exports[`SkeletonLoader renders the UI snapshot correctly 4`] = `
275
275
  className="css-0"
276
276
  style={
277
277
  Object {
278
- "marginBottom": null,
278
+ "marginBottom": undefined,
279
279
  }
280
280
  }
281
281
  />
@@ -287,7 +287,7 @@ exports[`SkeletonLoader renders the UI snapshot correctly 4`] = `
287
287
  className="css-0"
288
288
  style={
289
289
  Object {
290
- "marginBottom": null,
290
+ "marginBottom": undefined,
291
291
  }
292
292
  }
293
293
  />
@@ -338,7 +338,7 @@ exports[`SkeletonLoader renders the UI snapshot correctly 5`] = `
338
338
  className="css-0"
339
339
  style={
340
340
  Object {
341
- "marginBottom": null,
341
+ "marginBottom": undefined,
342
342
  }
343
343
  }
344
344
  />
@@ -350,7 +350,7 @@ exports[`SkeletonLoader renders the UI snapshot correctly 5`] = `
350
350
  className="css-0"
351
351
  style={
352
352
  Object {
353
- "marginBottom": null,
353
+ "marginBottom": undefined,
354
354
  }
355
355
  }
356
356
  />
@@ -401,7 +401,7 @@ exports[`SkeletonLoader renders the UI snapshot correctly 6`] = `
401
401
  className="css-0"
402
402
  style={
403
403
  Object {
404
- "marginBottom": null,
404
+ "marginBottom": undefined,
405
405
  }
406
406
  }
407
407
  />
@@ -440,7 +440,7 @@ exports[`SkeletonLoader renders the UI snapshot correctly 7`] = `
440
440
  className="css-0"
441
441
  style={
442
442
  Object {
443
- "marginBottom": null,
443
+ "marginBottom": undefined,
444
444
  }
445
445
  }
446
446
  />
@@ -456,7 +456,7 @@ exports[`SkeletonLoader renders the UI snapshot correctly 7`] = `
456
456
  className="css-0"
457
457
  style={
458
458
  Object {
459
- "marginBottom": null,
459
+ "marginBottom": undefined,
460
460
  }
461
461
  }
462
462
  />
@@ -468,7 +468,7 @@ exports[`SkeletonLoader renders the UI snapshot correctly 7`] = `
468
468
  className="css-0"
469
469
  style={
470
470
  Object {
471
- "marginBottom": null,
471
+ "marginBottom": undefined,
472
472
  }
473
473
  }
474
474
  />
@@ -530,7 +530,7 @@ exports[`SkeletonLoader renders the UI snapshot correctly 8`] = `
530
530
  className="css-0"
531
531
  style={
532
532
  Object {
533
- "marginBottom": null,
533
+ "marginBottom": undefined,
534
534
  }
535
535
  }
536
536
  />
@@ -546,7 +546,7 @@ exports[`SkeletonLoader renders the UI snapshot correctly 8`] = `
546
546
  className="css-0"
547
547
  style={
548
548
  Object {
549
- "marginBottom": null,
549
+ "marginBottom": undefined,
550
550
  }
551
551
  }
552
552
  />
@@ -558,7 +558,7 @@ exports[`SkeletonLoader renders the UI snapshot correctly 8`] = `
558
558
  className="css-0"
559
559
  style={
560
560
  Object {
561
- "marginBottom": null,
561
+ "marginBottom": undefined,
562
562
  }
563
563
  }
564
564
  />
@@ -609,7 +609,7 @@ exports[`SkeletonLoader renders the UI snapshot correctly 9`] = `
609
609
  className="css-0"
610
610
  style={
611
611
  Object {
612
- "marginBottom": null,
612
+ "marginBottom": undefined,
613
613
  }
614
614
  }
615
615
  />
@@ -625,7 +625,7 @@ exports[`SkeletonLoader renders the UI snapshot correctly 9`] = `
625
625
  className="css-0"
626
626
  style={
627
627
  Object {
628
- "marginBottom": null,
628
+ "marginBottom": undefined,
629
629
  }
630
630
  }
631
631
  />
@@ -637,7 +637,7 @@ exports[`SkeletonLoader renders the UI snapshot correctly 9`] = `
637
637
  className="css-0"
638
638
  style={
639
639
  Object {
640
- "marginBottom": null,
640
+ "marginBottom": undefined,
641
641
  }
642
642
  }
643
643
  />
@@ -688,7 +688,7 @@ exports[`SkeletonLoader renders the UI snapshot correctly 10`] = `
688
688
  className="css-0"
689
689
  style={
690
690
  Object {
691
- "marginBottom": null,
691
+ "marginBottom": undefined,
692
692
  }
693
693
  }
694
694
  />
@@ -704,7 +704,7 @@ exports[`SkeletonLoader renders the UI snapshot correctly 10`] = `
704
704
  className="css-0"
705
705
  style={
706
706
  Object {
707
- "marginBottom": null,
707
+ "marginBottom": undefined,
708
708
  }
709
709
  }
710
710
  />
@@ -716,7 +716,7 @@ exports[`SkeletonLoader renders the UI snapshot correctly 10`] = `
716
716
  className="css-0"
717
717
  style={
718
718
  Object {
719
- "marginBottom": null,
719
+ "marginBottom": undefined,
720
720
  }
721
721
  }
722
722
  />
@@ -767,7 +767,7 @@ exports[`SkeletonLoader renders the UI snapshot correctly 11`] = `
767
767
  className="css-0"
768
768
  style={
769
769
  Object {
770
- "marginBottom": null,
770
+ "marginBottom": undefined,
771
771
  }
772
772
  }
773
773
  />
@@ -783,7 +783,7 @@ exports[`SkeletonLoader renders the UI snapshot correctly 11`] = `
783
783
  className="css-0"
784
784
  style={
785
785
  Object {
786
- "marginBottom": null,
786
+ "marginBottom": undefined,
787
787
  }
788
788
  }
789
789
  />
@@ -795,7 +795,7 @@ exports[`SkeletonLoader renders the UI snapshot correctly 11`] = `
795
795
  className="css-0"
796
796
  style={
797
797
  Object {
798
- "marginBottom": null,
798
+ "marginBottom": undefined,
799
799
  }
800
800
  }
801
801
  />
@@ -847,7 +847,7 @@ exports[`SkeletonLoader renders the UI snapshot correctly 12`] = `
847
847
  className="css-0"
848
848
  style={
849
849
  Object {
850
- "marginBottom": null,
850
+ "marginBottom": undefined,
851
851
  }
852
852
  }
853
853
  />
@@ -863,7 +863,7 @@ exports[`SkeletonLoader renders the UI snapshot correctly 12`] = `
863
863
  className="css-0"
864
864
  style={
865
865
  Object {
866
- "marginBottom": null,
866
+ "marginBottom": undefined,
867
867
  }
868
868
  }
869
869
  />
@@ -875,7 +875,7 @@ exports[`SkeletonLoader renders the UI snapshot correctly 12`] = `
875
875
  className="css-0"
876
876
  style={
877
877
  Object {
878
- "marginBottom": null,
878
+ "marginBottom": undefined,
879
879
  }
880
880
  }
881
881
  />
@@ -0,0 +1,90 @@
1
+ import { Box, VStack } from "@chakra-ui/react";
2
+ import {
3
+ ArgsTable,
4
+ Canvas,
5
+ Description,
6
+ Meta,
7
+ Story,
8
+ } from "@storybook/addon-docs";
9
+
10
+ import Button from "../Button/Button";
11
+ import SkipNavigation from "./SkipNavigation";
12
+ import { getCategory } from "../../utils/componentCategories";
13
+
14
+ <Meta
15
+ title={getCategory("SkipNavigation")}
16
+ component={SkipNavigation}
17
+ parameters={{
18
+ jest: ["SkipNavigation.test.tsx"],
19
+ }}
20
+ argTypes={{
21
+ className: { control: false },
22
+ id: { control: false },
23
+ target: { control: false },
24
+ }}
25
+ />
26
+
27
+ # SkipNavigation
28
+
29
+ | Component Version | DS Version |
30
+ | ----------------- | ---------- |
31
+ | Added | `0.28.0` |
32
+ | Latest | `0.28.0` |
33
+
34
+ ## Table of Contents
35
+
36
+ - [Overview](#overview)
37
+ - [Component Props](#component-props)
38
+ - [Accessibility](#accessibility)
39
+
40
+ ## Overview
41
+
42
+ <Description of={SkipNavigation} />
43
+
44
+ **NOTE: In order to see the links in the `SkipNavigation` component, start by focusing
45
+ on the button below by tabbing or clicking on it. Then press "tab" to see the
46
+ first link and press "tab" again to see the second link. Hiding the links
47
+ intentional as the links should initially be visually hidden.**
48
+
49
+ ## Component Props
50
+
51
+ <Canvas>
52
+ <Story
53
+ name="SkipNavigation with Controls"
54
+ args={{
55
+ className: undefined,
56
+ id: "skip-nav",
57
+ target: "mainContent",
58
+ }}
59
+ >
60
+ {(args) => (
61
+ <>
62
+ <Button>Focus on me and then press "tab"</Button>
63
+ <SkipNavigation {...args} />
64
+ </>
65
+ )}
66
+ </Story>
67
+ </Canvas>
68
+
69
+ <ArgsTable story="SkipNavigation with Controls" />
70
+
71
+ ## Accessibility
72
+
73
+ To create a useable page for screen readers, a link or a navigational list of
74
+ links should be added before all the content on a page. The Reservoir Design
75
+ System (DS) achieves this through the `SkipNavigation` component which renders
76
+ a `<nav>` element with an `aria-label` of "Skip Navigation". Inside the `<nav>`
77
+ element, an unordered list is rendered.
78
+
79
+ The reason this is a navigation list of links is because the first main link
80
+ points to the anchor of the main content, in this case `"#mainContent"`. The
81
+ second link points to accessibility information on [NYPL.org/accessibility](https://nypl.org/accessibility).
82
+
83
+ See the [Skip Navigation accessibility guide](https://nypl.github.io/nypl-design-system/storybook-static/?path=/story/accessibility-guide-skip-navigation--page)
84
+ for more information on how to use this component with other DS components.
85
+
86
+ Resources:
87
+
88
+ - [WebAIM Skip Navigation Links](https://webaim.org/techniques/skipnav/)
89
+ - [WebAIM CSS in Action "Skip" links](https://webaim.org/techniques/css/invisiblecontent/#skipnavlinks)
90
+ - [CSS-Tricks A Deep Dive on Skipping to Content](https://css-tricks.com/a-deep-dive-on-skipping-to-content/)
@@ -0,0 +1,63 @@
1
+ import * as React from "react";
2
+ import { render, screen, within } from "@testing-library/react";
3
+ import { axe } from "jest-axe";
4
+ import renderer from "react-test-renderer";
5
+
6
+ import SkipNavigation from "./SkipNavigation";
7
+
8
+ describe("SkipNavigation Accessibility", () => {
9
+ it("passes axe accessibility test", async () => {
10
+ const { container } = render(<SkipNavigation />);
11
+ expect(await axe(container)).toHaveNoViolations();
12
+ });
13
+ });
14
+
15
+ describe("Label", () => {
16
+ it("renders a nav element with an unordered list", () => {
17
+ render(<SkipNavigation />);
18
+ const nav = screen.getByRole("navigation");
19
+
20
+ expect(nav).toBeInTheDocument();
21
+ expect(nav).toHaveAttribute("aria-label", "Skip Navigation");
22
+ // Chakra renders other lists so we only want the list we
23
+ // created within the nav element.
24
+ const { getByRole } = within(nav);
25
+ expect(getByRole("list")).toBeInTheDocument();
26
+ });
27
+
28
+ it("renders two links", () => {
29
+ render(<SkipNavigation />);
30
+ const links = screen.getAllByRole("link");
31
+
32
+ expect(links[0]).toHaveAttribute("href", "#mainContent");
33
+ expect(links[1]).toHaveAttribute(
34
+ "href",
35
+ "https://www.nypl.org/accessibility"
36
+ );
37
+ });
38
+
39
+ it("renders a custom main link target", () => {
40
+ render(<SkipNavigation target="customId" />);
41
+ const links = screen.getAllByRole("link");
42
+
43
+ expect(links[0]).toHaveAttribute("href", "customId");
44
+ });
45
+
46
+ it("Renders the UI snapshot correctly", () => {
47
+ const simple = renderer.create(<SkipNavigation />).toJSON();
48
+ const customTarget = renderer
49
+ .create(<SkipNavigation target="customId" />)
50
+ .toJSON();
51
+ const withChakraProps = renderer
52
+ .create(<SkipNavigation p="20px" color="ui.error.primary" />)
53
+ .toJSON();
54
+ const withOtherProps = renderer
55
+ .create(<SkipNavigation data-testid="props" />)
56
+ .toJSON();
57
+
58
+ expect(simple).toMatchSnapshot();
59
+ expect(customTarget).toMatchSnapshot();
60
+ expect(withChakraProps).toMatchSnapshot();
61
+ expect(withOtherProps).toMatchSnapshot();
62
+ });
63
+ });
@@ -0,0 +1,51 @@
1
+ import { Box, chakra, useStyleConfig } from "@chakra-ui/react";
2
+ import * as React from "react";
3
+
4
+ import Link from "../Link/Link";
5
+ import List from "../List/List";
6
+
7
+ interface SkipNavigationProps {
8
+ /** Additional CSS class name to render in the `nav` element. */
9
+ className?: string;
10
+ /** ID that other components can cross reference for accessibility purposes */
11
+ id?: string;
12
+ /** The anchor target for the main skip link. The default is "#mainContent". */
13
+ target?: string;
14
+ }
15
+
16
+ /**
17
+ * SkipNavigation is a component that is used to provide a navigational list of
18
+ * links. The first link is used to skip to the main content of the page using
19
+ * the `#mainContent` id, and the second link points to accessibility information
20
+ * on NYPL.org. These links are visually hidden but can be read by screenreaders.
21
+ */
22
+ export const SkipNavigation = chakra(
23
+ (props: React.PropsWithChildren<SkipNavigationProps>) => {
24
+ const { className, id, target = "#mainContent", ...rest } = props;
25
+ const styles = useStyleConfig("SkipNavigation");
26
+
27
+ return (
28
+ <Box
29
+ as="nav"
30
+ aria-label="Skip Navigation"
31
+ className={className}
32
+ id={id}
33
+ __css={styles}
34
+ {...rest}
35
+ >
36
+ <List inline noStyling type="ul">
37
+ <li>
38
+ <Link href={target}>Skip to Main Content</Link>
39
+ </li>
40
+ <li>
41
+ <Link href="https://www.nypl.org/accessibility">
42
+ Click to learn about accessibility at the Library
43
+ </Link>
44
+ </li>
45
+ </List>
46
+ </Box>
47
+ );
48
+ }
49
+ );
50
+
51
+ export default SkipNavigation;
@@ -0,0 +1,130 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Label Renders the UI snapshot correctly 1`] = `
4
+ <nav
5
+ aria-label="Skip Navigation"
6
+ className="css-1xdhyk6"
7
+ >
8
+ <ul
9
+ className="css-1xdhyk6"
10
+ >
11
+ <li>
12
+ <a
13
+ className="css-1xdhyk6"
14
+ href="#mainContent"
15
+ rel={null}
16
+ target={null}
17
+ >
18
+ Skip to Main Content
19
+ </a>
20
+ </li>
21
+ <li>
22
+ <a
23
+ className="css-1xdhyk6"
24
+ href="https://www.nypl.org/accessibility"
25
+ rel={null}
26
+ target={null}
27
+ >
28
+ Click to learn about accessibility at the Library
29
+ </a>
30
+ </li>
31
+ </ul>
32
+ </nav>
33
+ `;
34
+
35
+ exports[`Label Renders the UI snapshot correctly 2`] = `
36
+ <nav
37
+ aria-label="Skip Navigation"
38
+ className="css-1xdhyk6"
39
+ >
40
+ <ul
41
+ className="css-1xdhyk6"
42
+ >
43
+ <li>
44
+ <a
45
+ className="css-1xdhyk6"
46
+ href="customId"
47
+ rel={null}
48
+ target={null}
49
+ >
50
+ Skip to Main Content
51
+ </a>
52
+ </li>
53
+ <li>
54
+ <a
55
+ className="css-1xdhyk6"
56
+ href="https://www.nypl.org/accessibility"
57
+ rel={null}
58
+ target={null}
59
+ >
60
+ Click to learn about accessibility at the Library
61
+ </a>
62
+ </li>
63
+ </ul>
64
+ </nav>
65
+ `;
66
+
67
+ exports[`Label Renders the UI snapshot correctly 3`] = `
68
+ <nav
69
+ aria-label="Skip Navigation"
70
+ className="css-kle7zy"
71
+ >
72
+ <ul
73
+ className="css-1xdhyk6"
74
+ >
75
+ <li>
76
+ <a
77
+ className="css-1xdhyk6"
78
+ href="#mainContent"
79
+ rel={null}
80
+ target={null}
81
+ >
82
+ Skip to Main Content
83
+ </a>
84
+ </li>
85
+ <li>
86
+ <a
87
+ className="css-1xdhyk6"
88
+ href="https://www.nypl.org/accessibility"
89
+ rel={null}
90
+ target={null}
91
+ >
92
+ Click to learn about accessibility at the Library
93
+ </a>
94
+ </li>
95
+ </ul>
96
+ </nav>
97
+ `;
98
+
99
+ exports[`Label Renders the UI snapshot correctly 4`] = `
100
+ <nav
101
+ aria-label="Skip Navigation"
102
+ className="css-1xdhyk6"
103
+ data-testid="props"
104
+ >
105
+ <ul
106
+ className="css-1xdhyk6"
107
+ >
108
+ <li>
109
+ <a
110
+ className="css-1xdhyk6"
111
+ href="#mainContent"
112
+ rel={null}
113
+ target={null}
114
+ >
115
+ Skip to Main Content
116
+ </a>
117
+ </li>
118
+ <li>
119
+ <a
120
+ className="css-1xdhyk6"
121
+ href="https://www.nypl.org/accessibility"
122
+ rel={null}
123
+ target={null}
124
+ >
125
+ Click to learn about accessibility at the Library
126
+ </a>
127
+ </li>
128
+ </ul>
129
+ </nav>
130
+ `;