@nypl/design-system-react-components 0.25.13 → 0.27.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 (305) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/README.md +10 -10
  3. package/dist/components/Accordion/Accordion.d.ts +1 -1
  4. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
  5. package/dist/components/Button/Button.d.ts +2 -2
  6. package/dist/components/Card/Card.d.ts +11 -9
  7. package/dist/components/Checkbox/Checkbox.d.ts +2 -2
  8. package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +5 -4
  9. package/dist/components/ComponentWrapper/ComponentWrapper.d.ts +1 -1
  10. package/dist/components/DatePicker/DatePicker.d.ts +5 -6
  11. package/dist/components/Fieldset/Fieldset.d.ts +5 -6
  12. package/dist/components/Form/Form.d.ts +6 -6
  13. package/dist/components/Grid/GridTypes.d.ts +7 -7
  14. package/dist/components/Grid/SimpleGrid.d.ts +1 -1
  15. package/dist/components/Heading/Heading.d.ts +1 -1
  16. package/dist/components/HelperErrorText/HelperErrorText.d.ts +9 -8
  17. package/dist/components/Hero/Hero.d.ts +2 -1
  18. package/dist/components/HorizontalRule/HorizontalRule.d.ts +2 -10
  19. package/dist/components/Icons/Icon.d.ts +2 -1
  20. package/dist/components/Image/Image.d.ts +2 -2
  21. package/dist/components/Label/Label.d.ts +7 -4
  22. package/dist/components/Link/Link.d.ts +1 -1
  23. package/dist/components/List/List.d.ts +11 -11
  24. package/dist/components/List/ListTypes.d.ts +1 -1
  25. package/dist/components/Logo/Logo.d.ts +2 -1
  26. package/dist/components/Logo/LogoSvgs.d.ts +2 -0
  27. package/dist/components/Logo/LogoTypes.d.ts +2 -0
  28. package/dist/components/Modal/Modal.d.ts +28 -8
  29. package/dist/components/Notification/Notification.d.ts +4 -4
  30. package/dist/components/Pagination/Pagination.d.ts +2 -2
  31. package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +3 -3
  32. package/dist/components/Radio/Radio.d.ts +4 -6
  33. package/dist/components/RadioGroup/RadioGroup.d.ts +12 -6
  34. package/dist/components/SearchBar/SearchBar.d.ts +4 -4
  35. package/dist/components/Select/Select.d.ts +10 -6
  36. package/dist/components/Select/SelectTypes.d.ts +4 -0
  37. package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +4 -3
  38. package/dist/components/Slider/Slider.d.ts +6 -4
  39. package/dist/components/StatusBadge/StatusBadge.d.ts +5 -1
  40. package/dist/components/StructuredContent/StructuredContent.d.ts +2 -2
  41. package/dist/components/Table/Table.d.ts +1 -1
  42. package/dist/components/Tabs/Tabs.d.ts +4 -3
  43. package/dist/components/Template/Template.d.ts +4 -3
  44. package/dist/components/Text/Text.d.ts +1 -1
  45. package/dist/components/TextInput/TextInput.d.ts +5 -5
  46. package/dist/components/Toggle/Toggle.d.ts +3 -4
  47. package/dist/components/VideoPlayer/VideoPlayer.d.ts +2 -1
  48. package/dist/design-system-react-components.cjs.development.js +1767 -1180
  49. package/dist/design-system-react-components.cjs.development.js.map +1 -1
  50. package/dist/design-system-react-components.cjs.production.min.js +1 -1
  51. package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
  52. package/dist/design-system-react-components.esm.js +1774 -1188
  53. package/dist/design-system-react-components.esm.js.map +1 -1
  54. package/dist/hooks/useCarouselStyles.d.ts +3 -2
  55. package/dist/hooks/useNYPLTheme.d.ts +12 -0
  56. package/dist/index.d.ts +5 -2
  57. package/dist/styles.css +1 -1
  58. package/dist/theme/components/button.d.ts +10 -2
  59. package/dist/theme/components/card.d.ts +42 -22
  60. package/dist/theme/components/checkbox.d.ts +5 -4
  61. package/dist/theme/components/checkboxGroup.d.ts +1 -1
  62. package/dist/theme/components/componentWrapper.d.ts +2 -2
  63. package/dist/theme/components/customTable.d.ts +84 -1
  64. package/dist/theme/components/fieldset.d.ts +4 -14
  65. package/dist/theme/components/global.d.ts +23 -17
  66. package/dist/theme/components/heading.d.ts +53 -0
  67. package/dist/theme/components/helperErrorText.d.ts +1 -0
  68. package/dist/theme/components/hero.d.ts +20 -14
  69. package/dist/theme/components/label.d.ts +9 -10
  70. package/dist/theme/components/list.d.ts +99 -9
  71. package/dist/theme/components/radio.d.ts +6 -4
  72. package/dist/theme/components/radioGroup.d.ts +1 -1
  73. package/dist/theme/components/select.d.ts +28 -5
  74. package/dist/theme/components/skeletonLoader.d.ts +2 -2
  75. package/dist/theme/components/slider.d.ts +6 -3
  76. package/dist/theme/components/structuredContent.d.ts +197 -0
  77. package/dist/theme/components/textInput.d.ts +18 -6
  78. package/dist/theme/components/toggle.d.ts +7 -4
  79. package/dist/theme/foundations/global.d.ts +2 -0
  80. package/dist/theme/foundations/radii.d.ts +1 -0
  81. package/dist/theme/foundations/spacing.d.ts +46 -43
  82. package/package.json +17 -19
  83. package/src/components/Accordion/Accordion.stories.mdx +9 -9
  84. package/src/components/Accordion/Accordion.test.tsx +21 -0
  85. package/src/components/Accordion/Accordion.tsx +13 -9
  86. package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +276 -27
  87. package/src/components/Autosuggest/Autosuggest.stories.mdx +4 -3
  88. package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +21 -5
  89. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +52 -31
  90. package/src/components/Breadcrumbs/Breadcrumbs.tsx +8 -7
  91. package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +211 -12
  92. package/src/components/Button/Button.stories.mdx +87 -23
  93. package/src/components/Button/Button.test.tsx +25 -0
  94. package/src/components/Button/Button.tsx +18 -7
  95. package/src/components/Button/__snapshots__/Button.test.tsx.snap +27 -7
  96. package/src/components/Card/Card.stories.mdx +287 -194
  97. package/src/components/Card/Card.test.tsx +102 -0
  98. package/src/components/Card/Card.tsx +73 -32
  99. package/src/components/Card/__snapshots__/Card.test.tsx.snap +196 -36
  100. package/src/components/Chakra/Grid.stories.mdx +4 -4
  101. package/src/components/Checkbox/Checkbox.stories.mdx +62 -10
  102. package/src/components/Checkbox/Checkbox.test.tsx +32 -9
  103. package/src/components/Checkbox/Checkbox.tsx +20 -15
  104. package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +134 -7
  105. package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +65 -17
  106. package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +137 -81
  107. package/src/components/CheckboxGroup/CheckboxGroup.tsx +31 -21
  108. package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +332 -97
  109. package/src/components/ComponentWrapper/ComponentWrapper.test.tsx +12 -0
  110. package/src/components/ComponentWrapper/ComponentWrapper.tsx +39 -41
  111. package/src/components/ComponentWrapper/__snapshots__/ComponentWrapper.test.tsx.snap +47 -34
  112. package/src/components/DatePicker/DatePicker.stories.mdx +63 -27
  113. package/src/components/DatePicker/DatePicker.test.tsx +89 -13
  114. package/src/components/DatePicker/DatePicker.tsx +62 -56
  115. package/src/components/DatePicker/_DatePicker.scss +71 -13
  116. package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +250 -206
  117. package/src/components/Fieldset/Fieldset.stories.mdx +33 -3
  118. package/src/components/Fieldset/Fieldset.test.tsx +58 -28
  119. package/src/components/Fieldset/Fieldset.tsx +35 -30
  120. package/src/components/Fieldset/__snapshots__/Fieldset.test.tsx.snap +40 -19
  121. package/src/components/Form/Form.stories.mdx +72 -39
  122. package/src/components/Form/Form.test.tsx +58 -15
  123. package/src/components/Form/Form.tsx +89 -67
  124. package/src/components/Form/__snapshots__/Form.test.tsx.snap +83 -5
  125. package/src/components/Grid/GridTypes.tsx +7 -7
  126. package/src/components/Grid/SimpleGrid.stories.mdx +34 -6
  127. package/src/components/Grid/SimpleGrid.test.tsx +9 -0
  128. package/src/components/Grid/SimpleGrid.tsx +29 -20
  129. package/src/components/Grid/__snapshots__/SimpleGrid.test.tsx.snap +16 -1
  130. package/src/components/Heading/Heading.stories.mdx +36 -3
  131. package/src/components/Heading/Heading.test.tsx +10 -0
  132. package/src/components/Heading/Heading.tsx +56 -50
  133. package/src/components/Heading/__snapshots__/Heading.test.tsx.snap +26 -7
  134. package/src/components/HelperErrorText/HelperErrorText.stories.mdx +64 -42
  135. package/src/components/HelperErrorText/HelperErrorText.test.tsx +15 -0
  136. package/src/components/HelperErrorText/HelperErrorText.tsx +40 -35
  137. package/src/components/HelperErrorText/__snapshots__/HelperErrorText.test.tsx.snap +35 -4
  138. package/src/components/Hero/Hero.stories.mdx +125 -95
  139. package/src/components/Hero/Hero.test.tsx +33 -0
  140. package/src/components/Hero/Hero.tsx +135 -126
  141. package/src/components/Hero/__snapshots__/Hero.test.tsx.snap +89 -17
  142. package/src/components/HorizontalRule/HorizontalRule.stories.mdx +26 -4
  143. package/src/components/HorizontalRule/HorizontalRule.test.tsx +9 -19
  144. package/src/components/HorizontalRule/HorizontalRule.tsx +9 -26
  145. package/src/components/HorizontalRule/__snapshots__/HorizontalRule.test.tsx.snap +18 -5
  146. package/src/components/Icons/Icon.stories.mdx +31 -6
  147. package/src/components/Icons/Icon.test.tsx +38 -0
  148. package/src/components/Icons/Icon.tsx +93 -76
  149. package/src/components/Icons/__snapshots__/Icon.test.tsx.snap +129 -0
  150. package/src/components/Image/Image.stories.mdx +29 -5
  151. package/src/components/Image/Image.test.tsx +8 -0
  152. package/src/components/Image/Image.tsx +38 -26
  153. package/src/components/Image/__snapshots__/Image.test.tsx.snap +24 -8
  154. package/src/components/Label/Label.stories.mdx +42 -20
  155. package/src/components/Label/Label.test.tsx +42 -17
  156. package/src/components/Label/Label.tsx +22 -13
  157. package/src/components/Label/__snapshots__/Label.test.tsx.snap +19 -15
  158. package/src/components/Link/Link.stories.mdx +25 -15
  159. package/src/components/Link/Link.test.tsx +21 -22
  160. package/src/components/Link/Link.tsx +8 -8
  161. package/src/components/Link/__snapshots__/Link.test.tsx.snap +37 -11
  162. package/src/components/List/List.stories.mdx +75 -40
  163. package/src/components/List/List.test.tsx +67 -19
  164. package/src/components/List/List.tsx +38 -25
  165. package/src/components/List/ListTypes.tsx +1 -1
  166. package/src/components/List/__snapshots__/List.test.tsx.snap +110 -8
  167. package/src/components/Logo/Logo.stories.mdx +30 -6
  168. package/src/components/Logo/Logo.test.tsx +17 -0
  169. package/src/components/Logo/Logo.tsx +18 -6
  170. package/src/components/Logo/LogoSvgs.tsx +4 -0
  171. package/src/components/Logo/LogoTypes.tsx +2 -0
  172. package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +73 -2
  173. package/src/components/Modal/Modal.stories.mdx +256 -136
  174. package/src/components/Modal/Modal.test.tsx +151 -9
  175. package/src/components/Modal/Modal.tsx +140 -20
  176. package/src/components/Modal/__snapshots__/Modal.test.tsx.snap +25 -0
  177. package/src/components/Notification/Notification.stories.mdx +25 -1
  178. package/src/components/Notification/Notification.test.tsx +23 -0
  179. package/src/components/Notification/Notification.tsx +46 -44
  180. package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +158 -29
  181. package/src/components/Pagination/Pagination.stories.mdx +25 -6
  182. package/src/components/Pagination/Pagination.test.tsx +25 -0
  183. package/src/components/Pagination/Pagination.tsx +6 -6
  184. package/src/components/Pagination/__snapshots__/Pagination.test.tsx.snap +244 -27
  185. package/src/components/Placeholder/Placeholder.tsx +3 -1
  186. package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +76 -10
  187. package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +81 -11
  188. package/src/components/ProgressIndicator/ProgressIndicator.tsx +17 -9
  189. package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +101 -14
  190. package/src/components/Radio/Radio.stories.mdx +64 -12
  191. package/src/components/Radio/Radio.test.tsx +28 -8
  192. package/src/components/Radio/Radio.tsx +66 -63
  193. package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +103 -6
  194. package/src/components/RadioGroup/RadioGroup.stories.mdx +224 -89
  195. package/src/components/RadioGroup/RadioGroup.test.tsx +122 -62
  196. package/src/components/RadioGroup/RadioGroup.tsx +106 -100
  197. package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +1236 -1020
  198. package/src/components/SearchBar/SearchBar.stories.mdx +101 -36
  199. package/src/components/SearchBar/{SearchBar.Test.tsx → SearchBar.test.tsx} +46 -4
  200. package/src/components/SearchBar/SearchBar.tsx +17 -8
  201. package/src/components/SearchBar/__snapshots__/SearchBar.test.tsx.snap +1039 -0
  202. package/src/components/Select/Select.stories.mdx +128 -49
  203. package/src/components/Select/Select.test.tsx +63 -16
  204. package/src/components/Select/Select.tsx +131 -92
  205. package/src/components/Select/SelectTypes.tsx +5 -0
  206. package/src/components/Select/__snapshots__/Select.test.tsx.snap +765 -425
  207. package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +42 -10
  208. package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +8 -0
  209. package/src/components/SkeletonLoader/SkeletonLoader.tsx +76 -72
  210. package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +169 -10
  211. package/src/components/Slider/Slider.stories.mdx +91 -42
  212. package/src/components/Slider/Slider.test.tsx +65 -17
  213. package/src/components/Slider/Slider.tsx +26 -19
  214. package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +403 -226
  215. package/src/components/StatusBadge/StatusBadge.stories.mdx +19 -1
  216. package/src/components/StatusBadge/StatusBadge.test.tsx +16 -0
  217. package/src/components/StatusBadge/StatusBadge.tsx +25 -20
  218. package/src/components/StatusBadge/__snapshots__/StatusBadge.test.tsx.snap +22 -3
  219. package/src/components/StructuredContent/StructuredContent.stories.mdx +131 -12
  220. package/src/components/StructuredContent/StructuredContent.test.tsx +34 -0
  221. package/src/components/StructuredContent/StructuredContent.tsx +80 -75
  222. package/src/components/StructuredContent/__snapshots__/StructuredContent.test.tsx.snap +102 -17
  223. package/src/components/StyleGuide/Bidirectionality.stories.mdx +5 -5
  224. package/src/components/StyleGuide/Breakpoints.stories.mdx +6 -6
  225. package/src/components/StyleGuide/Buttons.stories.mdx +2 -12
  226. package/src/components/StyleGuide/ColorCard.tsx +1 -1
  227. package/src/components/StyleGuide/Colors.stories.mdx +1 -2
  228. package/src/components/StyleGuide/DesignTokens.stories.mdx +56 -26
  229. package/src/components/StyleGuide/Forms.stories.mdx +27 -12
  230. package/src/components/StyleGuide/Iconography.stories.mdx +2 -12
  231. package/src/components/StyleGuide/Spacing.stories.mdx +80 -41
  232. package/src/components/StyleGuide/Typography.stories.mdx +30 -21
  233. package/src/components/Table/Table.stories.mdx +38 -11
  234. package/src/components/Table/Table.test.tsx +15 -0
  235. package/src/components/Table/Table.tsx +7 -7
  236. package/src/components/Table/__snapshots__/Table.test.tsx.snap +408 -5
  237. package/src/components/Tabs/Tabs.stories.mdx +52 -3
  238. package/src/components/Tabs/Tabs.test.tsx +16 -0
  239. package/src/components/Tabs/Tabs.tsx +10 -6
  240. package/src/components/Tabs/__snapshots__/Tabs.test.tsx.snap +394 -5
  241. package/src/components/Template/Template.stories.mdx +47 -43
  242. package/src/components/Template/Template.test.tsx +33 -0
  243. package/src/components/Template/Template.tsx +65 -60
  244. package/src/components/Template/__snapshots__/Template.test.tsx.snap +191 -20
  245. package/src/components/Text/Text.stories.mdx +20 -1
  246. package/src/components/Text/Text.test.tsx +12 -0
  247. package/src/components/Text/Text.tsx +6 -4
  248. package/src/components/Text/__snapshots__/Text.test.tsx.snap +21 -4
  249. package/src/components/TextInput/TextInput.stories.mdx +65 -19
  250. package/src/components/TextInput/TextInput.test.tsx +42 -28
  251. package/src/components/TextInput/TextInput.tsx +121 -113
  252. package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +96 -73
  253. package/src/components/Toggle/Toggle.stories.mdx +80 -22
  254. package/src/components/Toggle/Toggle.test.tsx +27 -9
  255. package/src/components/Toggle/Toggle.tsx +22 -18
  256. package/src/components/Toggle/__snapshots__/Toggle.test.tsx.snap +128 -5
  257. package/src/components/VideoPlayer/VideoPlayer.stories.mdx +52 -4
  258. package/src/components/VideoPlayer/VideoPlayer.test.tsx +23 -0
  259. package/src/components/VideoPlayer/VideoPlayer.tsx +133 -126
  260. package/src/components/VideoPlayer/__snapshots__/VideoPlayer.test.tsx.snap +81 -39
  261. package/src/docs/Chakra.stories.mdx +50 -9
  262. package/src/docs/Welcome.stories.mdx +160 -41
  263. package/src/hooks/useCarouselStyles.stories.mdx +22 -2
  264. package/src/hooks/useCarouselStyles.ts +3 -2
  265. package/src/hooks/useNYPLTheme.stories.mdx +101 -0
  266. package/src/hooks/useNYPLTheme.ts +30 -6
  267. package/src/hooks/useWindowSize.stories.mdx +23 -0
  268. package/src/index.ts +5 -2
  269. package/src/styles/base/_place-holder.scss +1 -1
  270. package/src/styles.scss +0 -1
  271. package/src/theme/components/button.ts +15 -7
  272. package/src/theme/components/card.ts +30 -19
  273. package/src/theme/components/checkbox.ts +10 -8
  274. package/src/theme/components/checkboxGroup.ts +1 -1
  275. package/src/theme/components/componentWrapper.ts +2 -2
  276. package/src/theme/components/customTable.ts +39 -31
  277. package/src/theme/components/fieldset.ts +1 -2
  278. package/src/theme/components/global.ts +25 -20
  279. package/src/theme/components/heading.ts +1 -1
  280. package/src/theme/components/helperErrorText.ts +1 -0
  281. package/src/theme/components/hero.ts +13 -15
  282. package/src/theme/components/label.ts +4 -3
  283. package/src/theme/components/list.ts +73 -66
  284. package/src/theme/components/notification.ts +2 -2
  285. package/src/theme/components/radio.ts +9 -9
  286. package/src/theme/components/radioGroup.ts +1 -1
  287. package/src/theme/components/select.ts +31 -22
  288. package/src/theme/components/skeletonLoader.ts +3 -3
  289. package/src/theme/components/slider.ts +8 -7
  290. package/src/theme/components/statusBadge.ts +2 -2
  291. package/src/theme/components/structuredContent.ts +66 -1
  292. package/src/theme/components/tabs.ts +2 -2
  293. package/src/theme/components/template.ts +9 -9
  294. package/src/theme/components/textInput.ts +13 -12
  295. package/src/theme/components/toggle.ts +17 -10
  296. package/src/theme/components/videoPlayer.ts +1 -1
  297. package/src/theme/foundations/colors.ts +1 -1
  298. package/src/theme/foundations/radii.ts +1 -0
  299. package/src/theme/foundations/spacing.ts +70 -22
  300. package/src/theme/foundations/typography.ts +2 -2
  301. package/src/utils/componentCategories.ts +1 -2
  302. package/dist/components/SearchBar/SearchBar.Test.d.ts +0 -1
  303. package/dist/helpers/generateUUID.d.ts +0 -1
  304. package/src/components/Modal/_Modal.scss +0 -18
  305. package/src/helpers/generateUUID.tsx +0 -5
@@ -2,7 +2,7 @@
2
2
 
3
3
  exports[`Card Renders the UI snapshot correctly 1`] = `
4
4
  <div
5
- className="css-0"
5
+ className="css-1xdhyk6"
6
6
  id="regularCard"
7
7
  >
8
8
  <div
@@ -18,21 +18,22 @@ exports[`Card Renders the UI snapshot correctly 1`] = `
18
18
  className="card-body css-0"
19
19
  >
20
20
  <h3
21
- className="chakra-heading css-0"
21
+ className="chakra-heading css-1xdhyk6"
22
22
  id="heading1"
23
+ layout="column"
23
24
  >
24
25
  The Card Heading
25
26
  </h3>
26
27
  <div
27
- className="css-0"
28
+ className="css-1xdhyk6"
28
29
  >
29
30
  middle column content
30
31
  </div>
31
32
  <div
32
- className="css-0"
33
+ className="css-1xdhyk6"
33
34
  >
34
35
  <button
35
- className="chakra-button css-0"
36
+ className="chakra-button css-1xdhyk6"
36
37
  data-testid="button"
37
38
  id="button1"
38
39
  onClick={[Function]}
@@ -47,7 +48,7 @@ exports[`Card Renders the UI snapshot correctly 1`] = `
47
48
 
48
49
  exports[`Card Renders the UI snapshot correctly 2`] = `
49
50
  <div
50
- className="edition-card css-0"
51
+ className="edition-card css-1xdhyk6"
51
52
  id="cardWithExtendedStyles"
52
53
  >
53
54
  <div
@@ -63,13 +64,14 @@ exports[`Card Renders the UI snapshot correctly 2`] = `
63
64
  className="card-body css-0"
64
65
  >
65
66
  <h2
66
- className="chakra-heading css-0"
67
+ className="chakra-heading css-1xdhyk6"
67
68
  id="editioncardheading1"
69
+ layout="column"
68
70
  >
69
71
  The Card Heading
70
72
  </h2>
71
73
  <div
72
- className="css-0"
74
+ className="css-1xdhyk6"
73
75
  >
74
76
  <div>
75
77
  Published in New York by Random House
@@ -82,10 +84,10 @@ exports[`Card Renders the UI snapshot correctly 2`] = `
82
84
  </div>
83
85
  </div>
84
86
  <div
85
- className="css-0"
87
+ className="css-1xdhyk6"
86
88
  >
87
89
  <a
88
- className="css-0"
90
+ className="css-1xdhyk6"
89
91
  href="online"
90
92
  id="link-online"
91
93
  rel={null}
@@ -94,7 +96,7 @@ exports[`Card Renders the UI snapshot correctly 2`] = `
94
96
  Read Online
95
97
  </a>
96
98
  <a
97
- className="css-0"
99
+ className="css-1xdhyk6"
98
100
  href="#url"
99
101
  id="link-icon"
100
102
  rel={null}
@@ -102,7 +104,7 @@ exports[`Card Renders the UI snapshot correctly 2`] = `
102
104
  >
103
105
  <svg
104
106
  aria-hidden={true}
105
- className="chakra-icon css-onkibi"
107
+ className="chakra-icon css-1grhd2q"
106
108
  focusable={false}
107
109
  id="icon-cardWithExtendedStyles"
108
110
  role="img"
@@ -141,7 +143,7 @@ exports[`Card Renders the UI snapshot correctly 2`] = `
141
143
 
142
144
  exports[`Card Renders the UI snapshot correctly 3`] = `
143
145
  <div
144
- className="edition-card css-0"
146
+ className="edition-card css-1xdhyk6"
145
147
  id="cardWithNoCTAs"
146
148
  >
147
149
  <div
@@ -157,13 +159,14 @@ exports[`Card Renders the UI snapshot correctly 3`] = `
157
159
  className="card-body css-0"
158
160
  >
159
161
  <h2
160
- className="chakra-heading css-0"
162
+ className="chakra-heading css-1xdhyk6"
161
163
  id="editioncardheading1"
164
+ layout="column"
162
165
  >
163
166
  The Card Heading
164
167
  </h2>
165
168
  <div
166
- className="css-0"
169
+ className="css-1xdhyk6"
167
170
  >
168
171
  <p>
169
172
  Published in New York by Random House
@@ -181,7 +184,7 @@ exports[`Card Renders the UI snapshot correctly 3`] = `
181
184
 
182
185
  exports[`Card Renders the UI snapshot correctly 4`] = `
183
186
  <div
184
- className="edition-card css-0"
187
+ className="edition-card css-1xdhyk6"
185
188
  id="cardWithNoContent"
186
189
  >
187
190
  <div
@@ -197,11 +200,12 @@ exports[`Card Renders the UI snapshot correctly 4`] = `
197
200
  className="card-body css-0"
198
201
  >
199
202
  <h2
200
- className="chakra-heading css-0"
203
+ className="chakra-heading css-1xdhyk6"
201
204
  id="editioncardheading1"
205
+ layout="column"
202
206
  >
203
207
  <a
204
- className="css-0"
208
+ className="css-1xdhyk6"
205
209
  href="#edition-link"
206
210
  id="editioncardheading1-link"
207
211
  rel={null}
@@ -211,10 +215,10 @@ exports[`Card Renders the UI snapshot correctly 4`] = `
211
215
  </a>
212
216
  </h2>
213
217
  <div
214
- className="css-0"
218
+ className="css-1xdhyk6"
215
219
  >
216
220
  <a
217
- className="css-0"
221
+ className="css-1xdhyk6"
218
222
  href="online"
219
223
  id="link-online"
220
224
  rel={null}
@@ -223,7 +227,7 @@ exports[`Card Renders the UI snapshot correctly 4`] = `
223
227
  Read Online
224
228
  </a>
225
229
  <a
226
- className="css-0"
230
+ className="css-1xdhyk6"
227
231
  href="#url"
228
232
  id="link-icon"
229
233
  rel={null}
@@ -231,7 +235,7 @@ exports[`Card Renders the UI snapshot correctly 4`] = `
231
235
  >
232
236
  <svg
233
237
  aria-hidden={true}
234
- className="chakra-icon css-onkibi"
238
+ className="chakra-icon css-1grhd2q"
235
239
  focusable={false}
236
240
  id="icon-cardWithNoContent"
237
241
  role="img"
@@ -270,18 +274,19 @@ exports[`Card Renders the UI snapshot correctly 4`] = `
270
274
 
271
275
  exports[`Card Renders the UI snapshot correctly 5`] = `
272
276
  <div
273
- className="edition-card css-0"
277
+ className="edition-card css-1xdhyk6"
274
278
  id="cardWithNoImage"
275
279
  >
276
280
  <div
277
281
  className="card-body css-0"
278
282
  >
279
283
  <h2
280
- className="chakra-heading css-0"
284
+ className="chakra-heading css-1xdhyk6"
281
285
  id="editioncardheading1"
286
+ layout="column"
282
287
  >
283
288
  <a
284
- className="css-0"
289
+ className="css-1xdhyk6"
285
290
  href="#edition-link"
286
291
  id="editioncardheading1-link"
287
292
  rel={null}
@@ -291,15 +296,15 @@ exports[`Card Renders the UI snapshot correctly 5`] = `
291
296
  </a>
292
297
  </h2>
293
298
  <div
294
- className="css-0"
299
+ className="css-1xdhyk6"
295
300
  >
296
301
  middle column content
297
302
  </div>
298
303
  <div
299
- className="css-0"
304
+ className="css-1xdhyk6"
300
305
  >
301
306
  <a
302
- className="css-0"
307
+ className="css-1xdhyk6"
303
308
  href="online"
304
309
  id="link-online"
305
310
  rel={null}
@@ -308,7 +313,7 @@ exports[`Card Renders the UI snapshot correctly 5`] = `
308
313
  Read Online
309
314
  </a>
310
315
  <a
311
- className="css-0"
316
+ className="css-1xdhyk6"
312
317
  href="#url"
313
318
  id="link-icon"
314
319
  rel={null}
@@ -316,7 +321,7 @@ exports[`Card Renders the UI snapshot correctly 5`] = `
316
321
  >
317
322
  <svg
318
323
  aria-hidden={true}
319
- className="chakra-icon css-onkibi"
324
+ className="chakra-icon css-1grhd2q"
320
325
  focusable={false}
321
326
  id="icon-cardWithNoImage"
322
327
  role="img"
@@ -355,10 +360,10 @@ exports[`Card Renders the UI snapshot correctly 5`] = `
355
360
 
356
361
  exports[`Card Renders the UI snapshot correctly 6`] = `
357
362
  <div
358
- className="chakra-linkbox css-10n1vic"
363
+ className="chakra-linkbox css-hng3kb"
359
364
  >
360
365
  <div
361
- className="css-0"
366
+ className="css-1xdhyk6"
362
367
  id="fullclick"
363
368
  >
364
369
  <div
@@ -374,8 +379,9 @@ exports[`Card Renders the UI snapshot correctly 6`] = `
374
379
  className="card-body css-0"
375
380
  >
376
381
  <h3
377
- className="chakra-heading css-0"
382
+ className="chakra-heading css-1xdhyk6"
378
383
  id="heading1"
384
+ layout="column"
379
385
  >
380
386
  <a
381
387
  className="chakra-linkbox__overlay css-kvj8dg"
@@ -385,15 +391,15 @@ exports[`Card Renders the UI snapshot correctly 6`] = `
385
391
  </a>
386
392
  </h3>
387
393
  <div
388
- className="css-0"
394
+ className="css-1xdhyk6"
389
395
  >
390
396
  middle column content
391
397
  </div>
392
398
  <div
393
- className="css-0"
399
+ className="css-1xdhyk6"
394
400
  >
395
401
  <button
396
- className="chakra-button css-0"
402
+ className="chakra-button css-1xdhyk6"
397
403
  data-testid="button"
398
404
  id="button1"
399
405
  onClick={[Function]}
@@ -406,3 +412,157 @@ exports[`Card Renders the UI snapshot correctly 6`] = `
406
412
  </div>
407
413
  </div>
408
414
  `;
415
+
416
+ exports[`Card Renders the UI snapshot correctly 7`] = `
417
+ <div
418
+ className="css-1xdhyk6"
419
+ id="cardID"
420
+ >
421
+ <div
422
+ className="css-0"
423
+ >
424
+ <img
425
+ alt="Alt text"
426
+ className="css-0"
427
+ src="https://placeimg.com/400/200/arch"
428
+ />
429
+ </div>
430
+ <div
431
+ className="card-body css-0"
432
+ >
433
+ <h3
434
+ className="chakra-heading css-1xdhyk6"
435
+ id="heading1"
436
+ layout="column"
437
+ >
438
+ The Card Heading
439
+ </h3>
440
+ <div
441
+ className="css-1xdhyk6"
442
+ >
443
+ middle column content
444
+ </div>
445
+ <div
446
+ className="css-1xdhyk6"
447
+ >
448
+ <button
449
+ className="chakra-button css-1xdhyk6"
450
+ data-testid="button"
451
+ id="button1"
452
+ onClick={[Function]}
453
+ type="submit"
454
+ >
455
+ Example CTA
456
+ </button>
457
+ </div>
458
+ <div
459
+ className="css-1xdhyk6"
460
+ >
461
+ <button
462
+ className="chakra-button css-1xdhyk6"
463
+ data-testid="button"
464
+ id="button2"
465
+ onClick={[Function]}
466
+ type="submit"
467
+ >
468
+ Example CTA
469
+ </button>
470
+ </div>
471
+ </div>
472
+ </div>
473
+ `;
474
+
475
+ exports[`Card Renders the UI snapshot correctly 8`] = `
476
+ <div
477
+ className="css-1t0bvx9"
478
+ id="chakraProps"
479
+ >
480
+ <div
481
+ className="css-0"
482
+ >
483
+ <img
484
+ alt="Alt text"
485
+ className="css-0"
486
+ src="https://placeimg.com/400/200/arch"
487
+ />
488
+ </div>
489
+ <div
490
+ className="card-body css-0"
491
+ >
492
+ <h3
493
+ className="chakra-heading css-1ss7kwh"
494
+ id="heading1"
495
+ layout="column"
496
+ >
497
+ The Card Heading
498
+ </h3>
499
+ <div
500
+ className="css-1rn2qcq"
501
+ >
502
+ middle column content
503
+ </div>
504
+ <div
505
+ className="css-1avkygu"
506
+ >
507
+ <button
508
+ className="chakra-button css-1xdhyk6"
509
+ data-testid="button"
510
+ id="button1"
511
+ onClick={[Function]}
512
+ type="submit"
513
+ >
514
+ Example CTA
515
+ </button>
516
+ </div>
517
+ </div>
518
+ </div>
519
+ `;
520
+
521
+ exports[`Card Renders the UI snapshot correctly 9`] = `
522
+ <div
523
+ className="css-1xdhyk6"
524
+ data-testid="card-testid"
525
+ id="otherProps"
526
+ >
527
+ <div
528
+ className="css-0"
529
+ >
530
+ <img
531
+ alt="Alt text"
532
+ className="css-0"
533
+ src="https://placeimg.com/400/200/arch"
534
+ />
535
+ </div>
536
+ <div
537
+ className="card-body css-0"
538
+ >
539
+ <h3
540
+ className="chakra-heading css-1ss7kwh"
541
+ id="heading1"
542
+ layout="column"
543
+ >
544
+ The Card Heading
545
+ </h3>
546
+ <div
547
+ className="css-1xdhyk6"
548
+ data-testid="cardcontent-testid"
549
+ >
550
+ middle column content
551
+ </div>
552
+ <div
553
+ className="css-1xdhyk6"
554
+ data-testid="cardaction-testid"
555
+ >
556
+ <button
557
+ className="chakra-button css-1xdhyk6"
558
+ data-testid="button"
559
+ id="button1"
560
+ onClick={[Function]}
561
+ type="submit"
562
+ >
563
+ Example CTA
564
+ </button>
565
+ </div>
566
+ </div>
567
+ </div>
568
+ `;
@@ -19,7 +19,7 @@ for more information.
19
19
 
20
20
  This component is directly exported from Chakra UI. The `Grid` component is
21
21
  useful for grid layouts and offers more complexity and formatting options than
22
- the DS `SimpleGrid` component. `Grid` is `Box` with `display: grid` and it comes
22
+ the Reservoir Design System (DS) `SimpleGrid` component. `Grid` is `Box` with `display: grid` and it comes
23
23
  with helpful style shorthand. It renders a `div` element.
24
24
 
25
25
  Details about available props and related child components can be found on the
@@ -30,7 +30,7 @@ Details about available props and related child components can be found on the
30
30
  name="Grid"
31
31
  args={{
32
32
  templateColumns: "repeat(5, 1fr)",
33
- gap: "l",
33
+ gap: "grid.default",
34
34
  }}
35
35
  >
36
36
  {(args) => (
@@ -64,7 +64,7 @@ the `templateColumns` and `templateRows`.
64
64
  height="200px"
65
65
  templateRows="repeat(2, 1fr)"
66
66
  templateColumns="repeat(5, 1fr)"
67
- gap="l"
67
+ gap="grid.default"
68
68
  >
69
69
  <GridItem rowSpan={2} colSpan={1} bg="ui.link.primary" />
70
70
  <GridItem colSpan={2} bg="ui.success.primary" />
@@ -79,7 +79,7 @@ the `templateColumns` and `templateRows`.
79
79
  height="200px"
80
80
  templateRows="repeat(2, 1fr)"
81
81
  templateColumns="repeat(5, 1fr)"
82
- gap="l"
82
+ gap="grid.default"
83
83
  >
84
84
  <GridItem rowSpan={2} colSpan={1} bg="ui.link.primary" />
85
85
  <GridItem colSpan={2} bg="ui.success.primary" />
@@ -57,12 +57,31 @@ import DSProvider from "../../theme/provider";
57
57
  | Component Version | DS Version |
58
58
  | ----------------- | ---------- |
59
59
  | Added | `0.1.0` |
60
- | Latest | `0.25.13` |
60
+ | Latest | `0.26.0` |
61
+
62
+ ## Table of Contents
63
+
64
+ - [Overview](#overview)
65
+ - [Component Props](#component-props)
66
+ - [Accessibility](#accessibility)
67
+ - [Checked](#checked)
68
+ - [Indeterminate](#indeterminate)
69
+ - [Focused](#focused)
70
+ - [Errored](#errored)
71
+ - [Disabled](#disabled)
72
+ - [Helper Text](#helper-text)
73
+ - [Error Text](#error-text)
74
+ - [With JSX Element Label](#with-jsx-element-label)
75
+
76
+ ## Overview
61
77
 
62
78
  <Description of={Checkbox} />
63
79
 
64
- This component renders a Checkbox button form element. See below for configuration information. Note that the `id` property, while optional, will
65
- cause an accessibility violation if none is present.
80
+ This component renders a Checkbox button form element. See below for configuration
81
+ information. Note that the `id` property, while optional, will cause an
82
+ accessibility violation if none is present.
83
+
84
+ ## Component Props
66
85
 
67
86
  <Canvas withToolbar>
68
87
  <Story
@@ -91,6 +110,24 @@ cause an accessibility violation if none is present.
91
110
 
92
111
  <ArgsTable story="Checkbox" />
93
112
 
113
+ ## Accessibility
114
+
115
+ The `Checkbox` component renders `<label>` and `<input type="checkbox" />`
116
+ elements that are associated with each other; the label has a `for` attribute
117
+ with the value of the `input`'s `id` element. If there is helper or invalid text,
118
+ the `<input>` element will have a `aria-describedby` attribute with the value of
119
+ the helper or invalid text.
120
+
121
+ When `showLabel` is set to false, the `labelText` value will be set to the
122
+ `<input>`'s `aria-label` attribute.
123
+
124
+ Resources:
125
+
126
+ - [W3C WAI ARIA Checkbox Example](https://www.w3.org/TR/wai-aria-practices-1.1/examples/checkbox/checkbox-1/checkbox-1.html)
127
+ - [a11ymatters Accessible Checkbox](https://www.a11ymatters.com/pattern/checkbox/)
128
+ - [MDN ARIA: checkbox role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/checkbox_role)
129
+ - [Chakra UI Checkbox](https://chakra-ui.com/docs/components/form/checkbox)
130
+
94
131
  ## Checked
95
132
 
96
133
  Note that the `isChecked` property in this example is set to `true` and clicking
@@ -123,7 +160,10 @@ now be controlled and removed by the parent component in order to remove this st
123
160
 
124
161
  <Canvas>
125
162
  <DSProvider>
126
- <Checkbox labelText="Click or tab to the Checkbox to see its focus state" />
163
+ <Checkbox
164
+ id="focused"
165
+ labelText="Click or tab to the Checkbox to see its focus state"
166
+ />
127
167
  </DSProvider>
128
168
  </Canvas>
129
169
 
@@ -132,8 +172,9 @@ now be controlled and removed by the parent component in order to remove this st
132
172
  <Canvas>
133
173
  <DSProvider>
134
174
  <HStack>
135
- <Checkbox isInvalid labelText="I am in an error state" />
175
+ <Checkbox id="invalid" isInvalid labelText="I am in an error state" />
136
176
  <Checkbox
177
+ id="invalid-checked"
137
178
  isInvalid
138
179
  isChecked
139
180
  labelText="I am checked in an error state"
@@ -147,8 +188,13 @@ now be controlled and removed by the parent component in order to remove this st
147
188
  <Canvas>
148
189
  <DSProvider>
149
190
  <HStack>
150
- <Checkbox isDisabled labelText="I am disabled" />
151
- <Checkbox isDisabled isChecked labelText="I am checked and disabled" />
191
+ <Checkbox id="disabled" isDisabled labelText="I am disabled" />
192
+ <Checkbox
193
+ id="disabled-checked"
194
+ isDisabled
195
+ isChecked
196
+ labelText="I am checked and disabled"
197
+ />
152
198
  </HStack>
153
199
  </DSProvider>
154
200
  </Canvas>
@@ -158,6 +204,7 @@ now be controlled and removed by the parent component in order to remove this st
158
204
  <Canvas>
159
205
  <DSProvider>
160
206
  <Checkbox
207
+ id="helpertext"
161
208
  name="testHelperText"
162
209
  labelText="I have helper text"
163
210
  helperText="I am the helper text for this Checkbox"
@@ -170,10 +217,11 @@ now be controlled and removed by the parent component in order to remove this st
170
217
  <Canvas>
171
218
  <DSProvider>
172
219
  <Checkbox
173
- name="testinvalidText"
174
- labelText="I have error text"
220
+ id="invalid-text"
175
221
  invalidText="I am the error text for this Checkbox"
176
222
  isInvalid
223
+ name="testinvalidText"
224
+ labelText="I have error text"
177
225
  />
178
226
  </DSProvider>
179
227
  </Canvas>
@@ -186,6 +234,10 @@ usage.
186
234
 
187
235
  <Canvas>
188
236
  <DSProvider>
189
- <Checkbox labelText={<span>Arts</span>} name="jsxElementLabel" />
237
+ <Checkbox
238
+ id="jsx-label"
239
+ labelText={<span>Arts</span>}
240
+ name="jsxElementLabel"
241
+ />
190
242
  </DSProvider>
191
243
  </Canvas>
@@ -6,7 +6,6 @@ import { axe } from "jest-axe";
6
6
  import renderer from "react-test-renderer";
7
7
 
8
8
  import Checkbox from "./Checkbox";
9
- import * as generateUUID from "../../helpers/generateUUID";
10
9
 
11
10
  describe("Checkbox Accessibility", () => {
12
11
  it("passes axe accessibility test with string label", async () => {
@@ -41,11 +40,9 @@ describe("Checkbox Accessibility", () => {
41
40
 
42
41
  describe("Checkbox", () => {
43
42
  let changeHandler;
44
- let generateUUIDSpy;
45
43
 
46
44
  beforeEach(() => {
47
45
  changeHandler = jest.fn();
48
- generateUUIDSpy = jest.spyOn(generateUUID, "default");
49
46
  });
50
47
 
51
48
  it("Renders with a checkbox input and label", () => {
@@ -110,12 +107,6 @@ describe("Checkbox", () => {
110
107
  expect(screen.getByRole("checkbox")).toHaveAttribute("id", "inputID");
111
108
  });
112
109
 
113
- it("Calls the UUID generation function if no id prop value is passed", () => {
114
- expect(generateUUIDSpy).toHaveBeenCalledTimes(0);
115
- render(<Checkbox labelText="Test Label" />);
116
- expect(generateUUIDSpy).toHaveBeenCalledTimes(1);
117
- });
118
-
119
110
  it("Sets the 'checked' attribute", () => {
120
111
  render(
121
112
  <Checkbox
@@ -218,6 +209,7 @@ describe("Checkbox", () => {
218
209
  const warn = jest.spyOn(console, "warn");
219
210
  render(
220
211
  <Checkbox
212
+ id="checkbox"
221
213
  value="arts"
222
214
  labelText={
223
215
  <Flex>
@@ -235,6 +227,16 @@ describe("Checkbox", () => {
235
227
  );
236
228
  });
237
229
 
230
+ it("Logs a warning when there is no `id` passed", () => {
231
+ const warn = jest.spyOn(console, "warn");
232
+ // @ts-ignore: Typescript complains when a required prop is not passed, but
233
+ // here we don't want to pass the required prop to make sure the warning appears.
234
+ render(<Checkbox labelText="checkbox" />);
235
+ expect(warn).toHaveBeenCalledWith(
236
+ "NYPL Reservoir Checkbox: This component's required `id` prop was not passed."
237
+ );
238
+ });
239
+
238
240
  it("Renders the UI snapshot correctly", () => {
239
241
  const primary = renderer
240
242
  .create(<Checkbox id="inputID" labelText="Test Label" />)
@@ -284,6 +286,25 @@ describe("Checkbox", () => {
284
286
  />
285
287
  )
286
288
  .toJSON();
289
+ const withChakraProps = renderer
290
+ .create(
291
+ <Checkbox
292
+ id="checkbox-chakra"
293
+ labelText="Test Label"
294
+ p="s"
295
+ color="ui.error.primary"
296
+ />
297
+ )
298
+ .toJSON();
299
+ const withOtherProps = renderer
300
+ .create(
301
+ <Checkbox
302
+ id="checkbox-props"
303
+ labelText="Test Label"
304
+ data-testid="testid"
305
+ />
306
+ )
307
+ .toJSON();
287
308
 
288
309
  expect(primary).toMatchSnapshot();
289
310
  expect(isChecked).toMatchSnapshot();
@@ -292,5 +313,7 @@ describe("Checkbox", () => {
292
313
  expect(isInvalid).toMatchSnapshot();
293
314
  expect(isDisabled).toMatchSnapshot();
294
315
  expect(withJSXLabel).toMatchSnapshot();
316
+ expect(withChakraProps).toMatchSnapshot();
317
+ expect(withOtherProps).toMatchSnapshot();
295
318
  });
296
319
  });