@nypl/design-system-react-components 0.25.13 → 0.26.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 (299) hide show
  1. package/CHANGELOG.md +58 -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/Notification/Notification.d.ts +4 -4
  29. package/dist/components/Pagination/Pagination.d.ts +2 -2
  30. package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +3 -3
  31. package/dist/components/Radio/Radio.d.ts +4 -6
  32. package/dist/components/RadioGroup/RadioGroup.d.ts +12 -6
  33. package/dist/components/SearchBar/SearchBar.d.ts +4 -4
  34. package/dist/components/Select/Select.d.ts +10 -6
  35. package/dist/components/Select/SelectTypes.d.ts +4 -0
  36. package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +4 -3
  37. package/dist/components/Slider/Slider.d.ts +6 -4
  38. package/dist/components/StatusBadge/StatusBadge.d.ts +5 -1
  39. package/dist/components/StructuredContent/StructuredContent.d.ts +2 -2
  40. package/dist/components/Table/Table.d.ts +1 -1
  41. package/dist/components/Tabs/Tabs.d.ts +4 -3
  42. package/dist/components/Template/Template.d.ts +4 -3
  43. package/dist/components/Text/Text.d.ts +1 -1
  44. package/dist/components/TextInput/TextInput.d.ts +5 -5
  45. package/dist/components/Toggle/Toggle.d.ts +3 -4
  46. package/dist/components/VideoPlayer/VideoPlayer.d.ts +2 -1
  47. package/dist/design-system-react-components.cjs.development.js +1663 -1139
  48. package/dist/design-system-react-components.cjs.development.js.map +1 -1
  49. package/dist/design-system-react-components.cjs.production.min.js +1 -1
  50. package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
  51. package/dist/design-system-react-components.esm.js +1667 -1143
  52. package/dist/design-system-react-components.esm.js.map +1 -1
  53. package/dist/hooks/useCarouselStyles.d.ts +3 -2
  54. package/dist/hooks/useNYPLTheme.d.ts +12 -0
  55. package/dist/index.d.ts +4 -1
  56. package/dist/styles.css +1 -1
  57. package/dist/theme/components/button.d.ts +10 -2
  58. package/dist/theme/components/card.d.ts +42 -22
  59. package/dist/theme/components/checkbox.d.ts +5 -4
  60. package/dist/theme/components/checkboxGroup.d.ts +1 -1
  61. package/dist/theme/components/componentWrapper.d.ts +2 -2
  62. package/dist/theme/components/customTable.d.ts +84 -1
  63. package/dist/theme/components/fieldset.d.ts +4 -14
  64. package/dist/theme/components/global.d.ts +23 -17
  65. package/dist/theme/components/heading.d.ts +53 -0
  66. package/dist/theme/components/helperErrorText.d.ts +1 -0
  67. package/dist/theme/components/hero.d.ts +20 -14
  68. package/dist/theme/components/label.d.ts +9 -10
  69. package/dist/theme/components/list.d.ts +99 -9
  70. package/dist/theme/components/radio.d.ts +6 -4
  71. package/dist/theme/components/radioGroup.d.ts +1 -1
  72. package/dist/theme/components/select.d.ts +34 -5
  73. package/dist/theme/components/skeletonLoader.d.ts +2 -2
  74. package/dist/theme/components/slider.d.ts +6 -3
  75. package/dist/theme/components/structuredContent.d.ts +197 -0
  76. package/dist/theme/components/textInput.d.ts +18 -6
  77. package/dist/theme/components/toggle.d.ts +7 -4
  78. package/dist/theme/foundations/global.d.ts +2 -0
  79. package/dist/theme/foundations/radii.d.ts +1 -0
  80. package/dist/theme/foundations/spacing.d.ts +46 -43
  81. package/package.json +5 -6
  82. package/src/components/Accordion/Accordion.stories.mdx +9 -9
  83. package/src/components/Accordion/Accordion.test.tsx +21 -0
  84. package/src/components/Accordion/Accordion.tsx +13 -9
  85. package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +276 -27
  86. package/src/components/Autosuggest/Autosuggest.stories.mdx +4 -3
  87. package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +21 -5
  88. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +52 -31
  89. package/src/components/Breadcrumbs/Breadcrumbs.tsx +8 -7
  90. package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +211 -12
  91. package/src/components/Button/Button.stories.mdx +87 -23
  92. package/src/components/Button/Button.test.tsx +25 -0
  93. package/src/components/Button/Button.tsx +18 -7
  94. package/src/components/Button/__snapshots__/Button.test.tsx.snap +27 -7
  95. package/src/components/Card/Card.stories.mdx +287 -194
  96. package/src/components/Card/Card.test.tsx +102 -0
  97. package/src/components/Card/Card.tsx +73 -32
  98. package/src/components/Card/__snapshots__/Card.test.tsx.snap +195 -35
  99. package/src/components/Chakra/Grid.stories.mdx +4 -4
  100. package/src/components/Checkbox/Checkbox.stories.mdx +62 -10
  101. package/src/components/Checkbox/Checkbox.test.tsx +32 -9
  102. package/src/components/Checkbox/Checkbox.tsx +20 -15
  103. package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +134 -7
  104. package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +65 -17
  105. package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +137 -81
  106. package/src/components/CheckboxGroup/CheckboxGroup.tsx +31 -21
  107. package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +332 -97
  108. package/src/components/ComponentWrapper/ComponentWrapper.test.tsx +12 -0
  109. package/src/components/ComponentWrapper/ComponentWrapper.tsx +39 -41
  110. package/src/components/ComponentWrapper/__snapshots__/ComponentWrapper.test.tsx.snap +47 -34
  111. package/src/components/DatePicker/DatePicker.stories.mdx +63 -27
  112. package/src/components/DatePicker/DatePicker.test.tsx +89 -13
  113. package/src/components/DatePicker/DatePicker.tsx +62 -56
  114. package/src/components/DatePicker/_DatePicker.scss +71 -13
  115. package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +250 -206
  116. package/src/components/Fieldset/Fieldset.stories.mdx +33 -3
  117. package/src/components/Fieldset/Fieldset.test.tsx +58 -28
  118. package/src/components/Fieldset/Fieldset.tsx +35 -30
  119. package/src/components/Fieldset/__snapshots__/Fieldset.test.tsx.snap +40 -19
  120. package/src/components/Form/Form.stories.mdx +72 -39
  121. package/src/components/Form/Form.test.tsx +58 -15
  122. package/src/components/Form/Form.tsx +89 -67
  123. package/src/components/Form/__snapshots__/Form.test.tsx.snap +83 -5
  124. package/src/components/Grid/GridTypes.tsx +7 -7
  125. package/src/components/Grid/SimpleGrid.stories.mdx +34 -6
  126. package/src/components/Grid/SimpleGrid.test.tsx +9 -0
  127. package/src/components/Grid/SimpleGrid.tsx +29 -20
  128. package/src/components/Grid/__snapshots__/SimpleGrid.test.tsx.snap +16 -1
  129. package/src/components/Heading/Heading.stories.mdx +36 -3
  130. package/src/components/Heading/Heading.test.tsx +10 -0
  131. package/src/components/Heading/Heading.tsx +56 -50
  132. package/src/components/Heading/__snapshots__/Heading.test.tsx.snap +26 -7
  133. package/src/components/HelperErrorText/HelperErrorText.stories.mdx +64 -42
  134. package/src/components/HelperErrorText/HelperErrorText.test.tsx +15 -0
  135. package/src/components/HelperErrorText/HelperErrorText.tsx +40 -35
  136. package/src/components/HelperErrorText/__snapshots__/HelperErrorText.test.tsx.snap +35 -4
  137. package/src/components/Hero/Hero.stories.mdx +125 -95
  138. package/src/components/Hero/Hero.test.tsx +33 -0
  139. package/src/components/Hero/Hero.tsx +135 -126
  140. package/src/components/Hero/__snapshots__/Hero.test.tsx.snap +89 -17
  141. package/src/components/HorizontalRule/HorizontalRule.stories.mdx +26 -4
  142. package/src/components/HorizontalRule/HorizontalRule.test.tsx +9 -19
  143. package/src/components/HorizontalRule/HorizontalRule.tsx +9 -26
  144. package/src/components/HorizontalRule/__snapshots__/HorizontalRule.test.tsx.snap +18 -5
  145. package/src/components/Icons/Icon.stories.mdx +31 -6
  146. package/src/components/Icons/Icon.test.tsx +38 -0
  147. package/src/components/Icons/Icon.tsx +93 -76
  148. package/src/components/Icons/__snapshots__/Icon.test.tsx.snap +129 -0
  149. package/src/components/Image/Image.stories.mdx +29 -5
  150. package/src/components/Image/Image.test.tsx +8 -0
  151. package/src/components/Image/Image.tsx +38 -26
  152. package/src/components/Image/__snapshots__/Image.test.tsx.snap +24 -8
  153. package/src/components/Label/Label.stories.mdx +42 -20
  154. package/src/components/Label/Label.test.tsx +42 -17
  155. package/src/components/Label/Label.tsx +22 -13
  156. package/src/components/Label/__snapshots__/Label.test.tsx.snap +19 -15
  157. package/src/components/Link/Link.stories.mdx +25 -1
  158. package/src/components/Link/Link.test.tsx +21 -0
  159. package/src/components/Link/Link.tsx +8 -8
  160. package/src/components/Link/__snapshots__/Link.test.tsx.snap +37 -11
  161. package/src/components/List/List.stories.mdx +75 -40
  162. package/src/components/List/List.test.tsx +67 -19
  163. package/src/components/List/List.tsx +38 -25
  164. package/src/components/List/ListTypes.tsx +1 -1
  165. package/src/components/List/__snapshots__/List.test.tsx.snap +110 -8
  166. package/src/components/Logo/Logo.stories.mdx +30 -6
  167. package/src/components/Logo/Logo.test.tsx +17 -0
  168. package/src/components/Logo/Logo.tsx +18 -6
  169. package/src/components/Logo/LogoSvgs.tsx +4 -0
  170. package/src/components/Logo/LogoTypes.tsx +2 -0
  171. package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +73 -2
  172. package/src/components/Modal/Modal.stories.mdx +13 -0
  173. package/src/components/Notification/Notification.stories.mdx +25 -1
  174. package/src/components/Notification/Notification.test.tsx +23 -0
  175. package/src/components/Notification/Notification.tsx +46 -44
  176. package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +158 -29
  177. package/src/components/Pagination/Pagination.stories.mdx +24 -4
  178. package/src/components/Pagination/Pagination.test.tsx +25 -0
  179. package/src/components/Pagination/Pagination.tsx +6 -6
  180. package/src/components/Pagination/__snapshots__/Pagination.test.tsx.snap +244 -27
  181. package/src/components/Placeholder/Placeholder.tsx +3 -1
  182. package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +76 -10
  183. package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +81 -11
  184. package/src/components/ProgressIndicator/ProgressIndicator.tsx +17 -9
  185. package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +101 -14
  186. package/src/components/Radio/Radio.stories.mdx +64 -12
  187. package/src/components/Radio/Radio.test.tsx +28 -8
  188. package/src/components/Radio/Radio.tsx +66 -63
  189. package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +103 -6
  190. package/src/components/RadioGroup/RadioGroup.stories.mdx +224 -89
  191. package/src/components/RadioGroup/RadioGroup.test.tsx +122 -62
  192. package/src/components/RadioGroup/RadioGroup.tsx +106 -100
  193. package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +1236 -1020
  194. package/src/components/SearchBar/SearchBar.stories.mdx +101 -36
  195. package/src/components/SearchBar/{SearchBar.Test.tsx → SearchBar.test.tsx} +46 -4
  196. package/src/components/SearchBar/SearchBar.tsx +17 -8
  197. package/src/components/SearchBar/__snapshots__/SearchBar.test.tsx.snap +1039 -0
  198. package/src/components/Select/Select.stories.mdx +128 -49
  199. package/src/components/Select/Select.test.tsx +63 -16
  200. package/src/components/Select/Select.tsx +125 -92
  201. package/src/components/Select/SelectTypes.tsx +5 -0
  202. package/src/components/Select/__snapshots__/Select.test.tsx.snap +749 -409
  203. package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +42 -10
  204. package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +8 -0
  205. package/src/components/SkeletonLoader/SkeletonLoader.tsx +76 -72
  206. package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +169 -10
  207. package/src/components/Slider/Slider.stories.mdx +91 -42
  208. package/src/components/Slider/Slider.test.tsx +65 -17
  209. package/src/components/Slider/Slider.tsx +26 -19
  210. package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +403 -226
  211. package/src/components/StatusBadge/StatusBadge.stories.mdx +19 -1
  212. package/src/components/StatusBadge/StatusBadge.test.tsx +16 -0
  213. package/src/components/StatusBadge/StatusBadge.tsx +25 -20
  214. package/src/components/StatusBadge/__snapshots__/StatusBadge.test.tsx.snap +22 -3
  215. package/src/components/StructuredContent/StructuredContent.stories.mdx +131 -12
  216. package/src/components/StructuredContent/StructuredContent.test.tsx +34 -0
  217. package/src/components/StructuredContent/StructuredContent.tsx +80 -75
  218. package/src/components/StructuredContent/__snapshots__/StructuredContent.test.tsx.snap +102 -17
  219. package/src/components/StyleGuide/Bidirectionality.stories.mdx +5 -5
  220. package/src/components/StyleGuide/Breakpoints.stories.mdx +6 -6
  221. package/src/components/StyleGuide/Buttons.stories.mdx +2 -12
  222. package/src/components/StyleGuide/ColorCard.tsx +1 -1
  223. package/src/components/StyleGuide/Colors.stories.mdx +1 -2
  224. package/src/components/StyleGuide/DesignTokens.stories.mdx +56 -26
  225. package/src/components/StyleGuide/Forms.stories.mdx +27 -12
  226. package/src/components/StyleGuide/Iconography.stories.mdx +2 -12
  227. package/src/components/StyleGuide/Spacing.stories.mdx +80 -41
  228. package/src/components/StyleGuide/Typography.stories.mdx +30 -21
  229. package/src/components/Table/Table.stories.mdx +38 -11
  230. package/src/components/Table/Table.test.tsx +15 -0
  231. package/src/components/Table/Table.tsx +7 -7
  232. package/src/components/Table/__snapshots__/Table.test.tsx.snap +408 -5
  233. package/src/components/Tabs/Tabs.stories.mdx +52 -3
  234. package/src/components/Tabs/Tabs.test.tsx +16 -0
  235. package/src/components/Tabs/Tabs.tsx +10 -6
  236. package/src/components/Tabs/__snapshots__/Tabs.test.tsx.snap +394 -5
  237. package/src/components/Template/Template.stories.mdx +47 -43
  238. package/src/components/Template/Template.test.tsx +33 -0
  239. package/src/components/Template/Template.tsx +65 -60
  240. package/src/components/Template/__snapshots__/Template.test.tsx.snap +191 -20
  241. package/src/components/Text/Text.stories.mdx +20 -1
  242. package/src/components/Text/Text.test.tsx +12 -0
  243. package/src/components/Text/Text.tsx +6 -4
  244. package/src/components/Text/__snapshots__/Text.test.tsx.snap +21 -4
  245. package/src/components/TextInput/TextInput.stories.mdx +65 -19
  246. package/src/components/TextInput/TextInput.test.tsx +42 -28
  247. package/src/components/TextInput/TextInput.tsx +121 -113
  248. package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +96 -73
  249. package/src/components/Toggle/Toggle.stories.mdx +80 -22
  250. package/src/components/Toggle/Toggle.test.tsx +27 -9
  251. package/src/components/Toggle/Toggle.tsx +22 -18
  252. package/src/components/Toggle/__snapshots__/Toggle.test.tsx.snap +128 -5
  253. package/src/components/VideoPlayer/VideoPlayer.stories.mdx +52 -4
  254. package/src/components/VideoPlayer/VideoPlayer.test.tsx +23 -0
  255. package/src/components/VideoPlayer/VideoPlayer.tsx +133 -126
  256. package/src/components/VideoPlayer/__snapshots__/VideoPlayer.test.tsx.snap +81 -39
  257. package/src/docs/Chakra.stories.mdx +50 -9
  258. package/src/docs/Welcome.stories.mdx +160 -41
  259. package/src/hooks/useCarouselStyles.stories.mdx +22 -2
  260. package/src/hooks/useCarouselStyles.ts +3 -2
  261. package/src/hooks/useNYPLTheme.stories.mdx +101 -0
  262. package/src/hooks/useNYPLTheme.ts +30 -6
  263. package/src/hooks/useWindowSize.stories.mdx +23 -0
  264. package/src/index.ts +4 -1
  265. package/src/styles/base/_place-holder.scss +1 -1
  266. package/src/theme/components/button.ts +15 -7
  267. package/src/theme/components/card.ts +30 -19
  268. package/src/theme/components/checkbox.ts +10 -8
  269. package/src/theme/components/checkboxGroup.ts +1 -1
  270. package/src/theme/components/componentWrapper.ts +2 -2
  271. package/src/theme/components/customTable.ts +39 -31
  272. package/src/theme/components/fieldset.ts +1 -2
  273. package/src/theme/components/global.ts +25 -20
  274. package/src/theme/components/heading.ts +1 -1
  275. package/src/theme/components/helperErrorText.ts +1 -0
  276. package/src/theme/components/hero.ts +13 -15
  277. package/src/theme/components/label.ts +4 -3
  278. package/src/theme/components/list.ts +73 -66
  279. package/src/theme/components/notification.ts +2 -2
  280. package/src/theme/components/radio.ts +9 -9
  281. package/src/theme/components/radioGroup.ts +1 -1
  282. package/src/theme/components/select.ts +35 -22
  283. package/src/theme/components/skeletonLoader.ts +3 -3
  284. package/src/theme/components/slider.ts +8 -7
  285. package/src/theme/components/statusBadge.ts +2 -2
  286. package/src/theme/components/structuredContent.ts +66 -1
  287. package/src/theme/components/tabs.ts +2 -2
  288. package/src/theme/components/template.ts +9 -9
  289. package/src/theme/components/textInput.ts +13 -12
  290. package/src/theme/components/toggle.ts +17 -10
  291. package/src/theme/components/videoPlayer.ts +1 -1
  292. package/src/theme/foundations/colors.ts +1 -1
  293. package/src/theme/foundations/radii.ts +1 -0
  294. package/src/theme/foundations/spacing.ts +70 -22
  295. package/src/theme/foundations/typography.ts +2 -2
  296. package/src/utils/componentCategories.ts +1 -2
  297. package/dist/components/SearchBar/SearchBar.Test.d.ts +0 -1
  298. package/dist/helpers/generateUUID.d.ts +0 -1
  299. package/src/helpers/generateUUID.tsx +0 -5
@@ -2,12 +2,12 @@
2
2
 
3
3
  exports[`VideoPlayer renders the UI snapshot correctly 1`] = `
4
4
  <div
5
- className="css-0"
5
+ className="css-1xdhyk6"
6
6
  data-testid="video-player-component"
7
7
  id="video-player-without-text"
8
8
  >
9
9
  <div
10
- className="css-0"
10
+ className="css-1xdhyk6"
11
11
  >
12
12
  <div
13
13
  className="css-0"
@@ -27,21 +27,21 @@ exports[`VideoPlayer renders the UI snapshot correctly 1`] = `
27
27
 
28
28
  exports[`VideoPlayer renders the UI snapshot correctly 2`] = `
29
29
  <div
30
- className="css-0"
30
+ className="css-1xdhyk6"
31
31
  data-testid="video-player-component"
32
32
  id="video-player-with-text"
33
33
  >
34
34
  <div
35
- className="css-0"
35
+ className="css-1xdhyk6"
36
36
  >
37
37
  <h2
38
- className="chakra-heading css-0"
38
+ className="chakra-heading css-1xdhyk6"
39
39
  id="video-player-with-text-componentWrapper-heading"
40
40
  >
41
41
  VideoPlayer Heading
42
42
  </h2>
43
43
  <p
44
- className="chakra-text css-0"
44
+ className="chakra-text css-1xdhyk6"
45
45
  >
46
46
  VideoPlayer description
47
47
  </p>
@@ -58,42 +58,38 @@ exports[`VideoPlayer renders the UI snapshot correctly 2`] = `
58
58
  />
59
59
  </div>
60
60
  <div
61
- className="css-0"
62
- >
63
- <div
64
- aria-atomic={true}
65
- aria-live="off"
66
- className=" css-0"
67
- dangerouslySetInnerHTML={
68
- Object {
69
- "__html": "VideoPlayer helper test.",
70
- }
61
+ aria-atomic={true}
62
+ aria-live="off"
63
+ className="css-1xdhyk6"
64
+ dangerouslySetInnerHTML={
65
+ Object {
66
+ "__html": "VideoPlayer helper test.",
71
67
  }
72
- data-isinvalid={false}
73
- id="video-player-with-text-componentWrapper-helperText"
74
- />
75
- </div>
68
+ }
69
+ data-isinvalid={false}
70
+ id="video-player-with-text-componentWrapper-helperText"
71
+ />
76
72
  </div>
77
73
  </div>
78
74
  `;
79
75
 
80
76
  exports[`VideoPlayer renders the UI snapshot correctly 3`] = `
81
77
  <div
82
- className="css-0"
78
+ className="css-1xdhyk6"
83
79
  data-testid="video-player-component"
84
80
  id="video-player-with-text"
85
81
  >
86
82
  <div
87
- className="css-0"
83
+ className="css-1xdhyk6"
88
84
  >
89
85
  <h2
90
- className="chakra-heading css-0"
86
+ className="chakra-heading css-1xdhyk6"
91
87
  id="video-player-with-text-componentWrapper-heading"
92
88
  >
93
89
  VideoPlayer Heading
94
90
  </h2>
95
91
  <p
96
- className="chakra-text css-0"
92
+ className="chakra-text css-1xdhyk6"
97
93
  >
98
94
  VideoPlayer description
99
95
  </p>
@@ -109,28 +105,24 @@ exports[`VideoPlayer renders the UI snapshot correctly 3`] = `
109
105
  />
110
106
  </div>
111
107
  <div
112
- className="css-0"
113
- >
114
- <div
115
- aria-atomic={true}
116
- aria-live="off"
117
- className=" css-0"
118
- dangerouslySetInnerHTML={
119
- Object {
120
- "__html": "VideoPlayer helper test.",
121
- }
108
+ aria-atomic={true}
109
+ aria-live="off"
110
+ className="css-1xdhyk6"
111
+ dangerouslySetInnerHTML={
112
+ Object {
113
+ "__html": "VideoPlayer helper test.",
122
114
  }
123
- data-isinvalid={false}
124
- id="video-player-with-text-componentWrapper-helperText"
125
- />
126
- </div>
115
+ }
116
+ data-isinvalid={false}
117
+ id="video-player-with-text-componentWrapper-helperText"
118
+ />
127
119
  </div>
128
120
  </div>
129
121
  `;
130
122
 
131
123
  exports[`VideoPlayer renders the UI snapshot correctly 4`] = `
132
124
  <div
133
- className="css-0"
125
+ className="css-1xdhyk6"
134
126
  data-testid="video-player-component"
135
127
  id="video-player-error"
136
128
  >
@@ -143,3 +135,53 @@ exports[`VideoPlayer renders the UI snapshot correctly 4`] = `
143
135
  />
144
136
  </div>
145
137
  `;
138
+
139
+ exports[`VideoPlayer renders the UI snapshot correctly 5`] = `
140
+ <div
141
+ className="css-kle7zy"
142
+ data-testid="video-player-component"
143
+ id="chakra"
144
+ >
145
+ <div
146
+ className="css-1xdhyk6"
147
+ >
148
+ <div
149
+ className="css-0"
150
+ >
151
+ <iframe
152
+ allow="accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture"
153
+ allowFullScreen={true}
154
+ className="css-0"
155
+ frameBorder="0"
156
+ src="https://player.vimeo.com/video/474719268?autoplay=0&loop=0"
157
+ title="Vimeo video player"
158
+ />
159
+ </div>
160
+ </div>
161
+ </div>
162
+ `;
163
+
164
+ exports[`VideoPlayer renders the UI snapshot correctly 6`] = `
165
+ <div
166
+ className="css-1xdhyk6"
167
+ data-testid="props"
168
+ id="props"
169
+ >
170
+ <div
171
+ className="css-1xdhyk6"
172
+ >
173
+ <div
174
+ className="css-0"
175
+ >
176
+ <iframe
177
+ allow="accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture"
178
+ allowFullScreen={true}
179
+ className="css-0"
180
+ frameBorder="0"
181
+ src="https://player.vimeo.com/video/474719268?autoplay=0&loop=0"
182
+ title="Vimeo video player"
183
+ />
184
+ </div>
185
+ </div>
186
+ </div>
187
+ `;
@@ -1,5 +1,9 @@
1
1
  import { Meta } from "@storybook/addon-docs";
2
2
 
3
+ import Button from "../components/Button/Button";
4
+ import Text from "../components/Text/Text";
5
+ import DSProvider from "../theme/provider";
6
+
3
7
  <Meta title="Chakra UI" />
4
8
 
5
9
  # Chakra UI
@@ -10,19 +14,20 @@ import { Meta } from "@storybook/addon-docs";
10
14
  | 2. [DSProvider](#dsprovider) |
11
15
  | 3. [Components](#components) |
12
16
  | 4. [Styling](#styling) |
13
- | 5. [Hooks](#hooks) |
14
- | 5. [Testing](#testing) |
17
+ | 5. [Style Props](#style-props) |
18
+ | 6. [Hooks](#hooks) |
19
+ | 7. [Testing](#testing) |
15
20
 
16
21
  ## Why Chakra UI?
17
22
 
18
- The NYPL Design System (DS) project was influenced by other design systems but
23
+ The Reservoir Design System (DS) project was influenced by other design systems but
19
24
  ultimately we decided to initially build DS components from scratch rather than
20
25
  use another design system as its foundation. To better help all the projects at
21
26
  NYPL and to better scale with all the components we have built and still need to
22
- build, we decided to integrate Chakra UI into the NYPL Design System.
27
+ build, we decided to integrate Chakra UI into the DS.
23
28
 
24
29
  Chakra UI is an open source component library that is opinionated and uses design
25
- and development patterns that various projects at NYPL use. Since the NYPL DS
30
+ and development patterns that various projects at NYPL use. Since the DS
26
31
  will be the foundation for all NYPL projects moving forward, using Chakra will
27
32
  help us align all projects so similar patterns are used throughout various teams
28
33
  and projects.
@@ -38,7 +43,7 @@ We recommend to read Chakra's own [documentation](https://chakra-ui.com/docs/get
38
43
  to get up to speed on it. This file will provide information on how it is used
39
44
  in the DS but we rely on Chakra's documentation.
40
45
 
41
- If you need help updating to a newer version of the NYPL Design System, check out
46
+ If you need help updating to a newer version of the DS, check out
42
47
  our [Chakra Migration Guide](https://github.com/NYPL/nypl-design-system/blob/development/CHAKRA_MIGRATION_GUIDE.md).
43
48
 
44
49
  ## DSProvider
@@ -411,6 +416,42 @@ All typography values can be found in the `src/theme/foundations/typography.ts`
411
416
  file. These values declare the font family, font sizes, and font weights to use
412
417
  for all text.
413
418
 
419
+ ## Style Props
420
+
421
+ NYPL Reservoir components are built around the Chakra UI library. While Reservoir
422
+ components may use the corresponding Chakra UI component, that is not always the
423
+ case. Every Reservoir component, however, does make use of the Chakra UI
424
+ "style props" pattern. This means that it is possible to pass in CSS rules to a
425
+ component, including the shorthand versions. These style props will target the
426
+ wrapper element of the component; this means if you want to target a specific
427
+ element or component in a Reservoir component, you won't be able to with style
428
+ props.
429
+
430
+ <DSProvider>
431
+ <Text isBold>
432
+ While this is available to use, it is not recommended. If you see a need to
433
+ override styles, please reach out to the NYPL Reservoir team for assistance.
434
+ </Text>
435
+ </DSProvider>
436
+
437
+ In the following example, the `Button` component has been passed `p` and `maxW`
438
+ props which are shorthand for "padding" and "max-width", respectively.
439
+
440
+ ```jsx
441
+ <Button p="s" maxW="200px">
442
+ Button
443
+ </Button>
444
+ ```
445
+
446
+ <DSProvider>
447
+ <Button p="s" maxW="200px">
448
+ Button
449
+ </Button>
450
+ </DSProvider>
451
+
452
+ Find more information and a full list of all the available props, check the Chakra
453
+ UI [Style Props page](https://chakra-ui.com/docs/styled-system/features/style-props).
454
+
414
455
  ## Hooks
415
456
 
416
457
  The following hooks are available to use and can be imported from
@@ -514,6 +555,6 @@ Use the `style` attribute in HTML components to add inline styles.
514
555
  ## Testing
515
556
 
516
557
  Do not re-test Chakra components that are re-exported since they are already
517
- tested in the `@chakra-ui/react` package. We do expect all new components
518
- composed from Chakra to have tests for functionality and styling
519
- (such as snapshots).
558
+ tested in the `@chakra-ui/react` package. We expect all new components composed
559
+ with Chakra components to have tests for functionality and styling, including
560
+ snapshot tests.
@@ -1,49 +1,168 @@
1
1
  import { Meta } from "@storybook/addon-docs";
2
2
 
3
- import Hero from "../components/Hero/Hero.tsx";
4
- import { HeroTypes } from "../components/Hero/HeroTypes.tsx";
5
- import Heading from "../components/Heading/Heading.tsx";
6
- import Image from "../components/Image/Image.tsx";
3
+ import { Box, Center, Circle, VStack, Square } from "@chakra-ui/react";
4
+ import Card, { CardHeading, CardContent } from "../components/Card/Card";
5
+ import Hero from "../components/Hero/Hero";
6
+ import { HeroTypes } from "../components/Hero/HeroTypes";
7
+ import Heading from "../components/Heading/Heading";
8
+ import {
9
+ HeadingLevels,
10
+ HeadingSizes,
11
+ } from "../components/Heading/HeadingTypes";
12
+ import Icon from "../components/Icons/Icon";
13
+ import {
14
+ IconColors,
15
+ IconNames,
16
+ IconSizes,
17
+ } from "../components/Icons/IconTypes";
18
+ import Image from "../components/Image/Image";
19
+ import Link from "../components/Link/Link";
20
+ import { LinkTypes } from "../components/Link/LinkTypes";
21
+ import Logo from "../components/Logo/Logo";
22
+ import { LogoNames, LogoSizes } from "../components/Logo/LogoTypes";
23
+ import SimpleGrid from "../components/Grid/SimpleGrid";
24
+ import Text from "../components/Text/Text";
25
+ import { TextSizes } from "../components/Text/TextTypes";
7
26
  import DSProvider from "../theme/provider";
8
27
 
9
28
  <Meta title="Welcome" />
10
29
 
11
- # NYPL Design System
12
-
13
- export const heroBackgroundColor = `var(--nypl-colors-section-books-and-more-primary)`;
14
- export const heroForegroundColor = `var(--nypl-colors-ui-white)`;
15
-
16
30
  <DSProvider>
17
- <Hero
18
- backgroundColor={heroBackgroundColor}
19
- foregroundColor={heroForegroundColor}
20
- heroType={HeroTypes.FiftyFifty}
21
- imageAlt="NYPL Lion with mask on"
22
- imageSrc="https://cdn-d8.nypl.org/s3fs-public/styles/2_1_960/public/2020-07/SASB_06_29_2020_Lions_mask-00207%20copy_0.jpeg?h=c8e955ed&itok=n_GLQgoe"
23
- subHeaderText="With 92 locations across the Bronx, Manhattan, and Staten Island, The New York Public Library is an essential part of neighborhoods across the city. Visit us today."
24
- />
31
+ <VStack spacing="s">
32
+ <Center>
33
+ <Logo name={LogoNames.ReservoirVerticalColor} size={LogoSizes.Small} />
34
+ </Center>
35
+ <Box>
36
+ <Center>
37
+ <Heading level={HeadingLevels.One} size={HeadingSizes.Tertiary}>
38
+ The React Component Library of the New York Public Library
39
+ </Heading>
40
+ </Center>
41
+ <Text>
42
+ Reservoir is NYPL's open-source extensible React component library for
43
+ products and experiences, with accessibility as its core. Aiming to
44
+ provide design and user experience consistency, Reservoir is the
45
+ foundation for all digital properties in the NYPL landscape, offering
46
+ functional components that implement the NYPL style standards.
47
+ </Text>
48
+ </Box>
49
+ <SimpleGrid>
50
+ <Box
51
+ style={{
52
+ alignItems: "center",
53
+ border: "1px solid #ccc",
54
+ display: "flex",
55
+ flexDirection: "column",
56
+ padding: "24px",
57
+ }}
58
+ >
59
+ <Icon
60
+ name={IconNames.ActionCheckCircle}
61
+ size={IconSizes.ExtraExtraLarge}
62
+ color={IconColors.SectionEducationSecondary}
63
+ additionalStyles={{
64
+ marginBottom: "s",
65
+ }}
66
+ />
67
+ <Card isCentered>
68
+ <CardHeading id="main-heading1" level={HeadingLevels.Three}>
69
+ Get Started
70
+ </CardHeading>
71
+ <CardContent>
72
+ <Text size={TextSizes.Caption}>
73
+ To start using Reservoir Design System, refer to Reservoir's
74
+ Github{" "}
75
+ <Link
76
+ href="https://github.com/NYPL/nypl-design-system/wiki"
77
+ type={LinkTypes.External}
78
+ >
79
+ Wiki
80
+ </Link>{" "}
81
+ and{" "}
82
+ <Link
83
+ href="https://github.com/NYPL/nypl-design-system/blob/development/README.md"
84
+ type={LinkTypes.External}
85
+ >
86
+ ReadMe
87
+ </Link>{" "}
88
+ to setup your project. You can also learn about our component
89
+ architecture and additional documentation.
90
+ </Text>
91
+ </CardContent>
92
+ </Card>
93
+ </Box>
94
+ <Box
95
+ style={{
96
+ alignItems: "center",
97
+ border: "1px solid #ccc",
98
+ display: "flex",
99
+ flexDirection: "column",
100
+ padding: "24px",
101
+ }}
102
+ >
103
+ <Icon
104
+ name={IconNames.Search}
105
+ size={IconSizes.ExtraExtraLarge}
106
+ color={IconColors.SectionEducationSecondary}
107
+ additionalStyles={{
108
+ marginBottom: "s",
109
+ }}
110
+ />
111
+ <Card isCentered>
112
+ <CardHeading id="main-heading1" level={HeadingLevels.Three}>
113
+ Find Components
114
+ </CardHeading>
115
+ <CardContent>
116
+ <Text size={TextSizes.Caption}>
117
+ For your convenience, the Reservoir Design System components have
118
+ been organized into logical categories based on both form and
119
+ function. Please refer to the <b>COMPONENTS</b> section in the
120
+ Storybook sidebar.
121
+ </Text>
122
+ </CardContent>
123
+ </Card>
124
+ </Box>
125
+ <Box
126
+ style={{
127
+ alignItems: "center",
128
+ border: "1px solid #ccc",
129
+ display: "flex",
130
+ flexDirection: "column",
131
+ padding: "24px",
132
+ }}
133
+ >
134
+ <Icon
135
+ name={IconNames.FileTypeSpreadsheet}
136
+ size={IconSizes.ExtraExtraLarge}
137
+ color={IconColors.SectionEducationSecondary}
138
+ additionalStyles={{
139
+ marginBottom: "s",
140
+ }}
141
+ />
142
+ <Card isCentered>
143
+ <CardHeading id="main-heading1" level={HeadingLevels.Three}>
144
+ View the Code
145
+ </CardHeading>
146
+ <CardContent>
147
+ <Text size="caption">
148
+ The Reservoir Design System React component library is currently
149
+ published on{" "}
150
+ <Link
151
+ href="https://www.npmjs.com/package/@nypl/design-system-react-components"
152
+ type={LinkTypes.External}
153
+ >
154
+ npm
155
+ </Link>
156
+ . If you're looking to contribute to this project, checkout the <Link
157
+ href="https://github.com/NYPL/nypl-design-system"
158
+ type={LinkTypes.External}
159
+ >
160
+ nypl-design-system
161
+ </Link> repo on Github for more information.
162
+ </Text>
163
+ </CardContent>
164
+ </Card>
165
+ </Box>
166
+ </SimpleGrid>
167
+ </VStack>
25
168
  </DSProvider>
26
-
27
- <br />
28
-
29
- Welcome to the New York Public Library's Design System React component library.
30
- This design system is NYPL's open-source extensible React library for products
31
- and experiences, with accessibility as its foundation. It ships functional components
32
- with consistent NYPL styling. You can learn more about the project and its goals
33
- [on our Confluence page](https://confluence.nypl.org/display/DIGTL/NYPL+Design+System)
34
- (needs a log in).
35
-
36
- The best way to get started is through the [Design System's Wiki](https://github.com/NYPL/nypl-design-system/wiki)
37
- to learn about design and implementation at NYPL. The Hero above is just
38
- one example of how we use the NYPL Design System on NYPL.org.
39
-
40
- For your convenience, the DS components have been organized into logical categories
41
- based on both form and function. Please refer to the **COMPONENTS** section in the
42
- Storybook sidebar.
43
-
44
- ## @nypl/design-system-react-components
45
-
46
- This React design system library is currently published on [npm](https://www.npmjs.com/package/@nypl/design-system-react-components).
47
- If you're looking to contribute to this project, checkout the
48
- [nypl-design-system](https://github.com/NYPL/nypl-design-system) repo on Github
49
- for more information.
@@ -1,3 +1,5 @@
1
+ import { Meta, Description } from "@storybook/addon-docs";
2
+
1
3
  import { getCategory } from "../utils/componentCategories";
2
4
 
3
5
  <Meta title={getCategory("useCarouselStyles")} />
@@ -6,5 +8,23 @@ import { getCategory } from "../utils/componentCategories";
6
8
 
7
9
  | Hook Version | DS Version |
8
10
  | ------------ | ---------- |
9
- | Added | `?` |
10
- | Latest | `?` |
11
+ | Added | `0.25.2` |
12
+ | Latest | `0.25.2` |
13
+
14
+ This custom hook, inspired by this [codesandbox example](https://codesandbox.io/s/fxjeo),
15
+ exposes functions used for carousel-like components that have sliding features.
16
+ The two main functions are `prevSlide` and `nextSlide` used for buttons to
17
+ navigate between slides, and a `carouselStyle` style object for the main wrapper
18
+ element. If the carousel should programmatically slide to the first slide, use
19
+ the `goToStart` function.
20
+
21
+ ## Usage
22
+
23
+ For a full implementation examle, view the [`Tabs` component](https://github.com/NYPL/nypl-design-system/blob/development/src/components/Tabs/Tabs.tsx).
24
+
25
+ ```tsx
26
+ const { prevSlide, nextSlide, carouselStyle, goToStart } = useCarouselStyles(
27
+ slidesCount,
28
+ slideWidth
29
+ );
30
+ ```
@@ -3,10 +3,11 @@ import React from "react";
3
3
  /**
4
4
  * Custom hook that controls the sliding function for the carousel wrapper.
5
5
  * This returns functions to use for the "previous" and "next" buttons as well
6
- * as a CSS style object that should be use to transition between slides.
6
+ * as a CSS style object that should be use to transition between slides. There
7
+ * is also a function to programmatically slide to the first slide.
7
8
  * Inspired by: https://codesandbox.io/s/fxjeo
8
9
  */
9
- const useCarouselStyles = (slidesCount = 0, slideWidth = 100) => {
10
+ export const useCarouselStyles = (slidesCount = 0, slideWidth = 100) => {
10
11
  const [currentSlide, setCurrentSlide] = React.useState(0);
11
12
  // This wraps around to the last slide if this is invoked while the
12
13
  // first slide is active.
@@ -0,0 +1,101 @@
1
+ import { Meta } from "@storybook/addon-docs";
2
+ import { getCategory } from "../utils/componentCategories";
3
+
4
+ <Meta title={getCategory("useNYPLTheme")} />
5
+
6
+ # useNYPLTheme
7
+
8
+ | Hook Version | DS Version |
9
+ | ------------ | ---------- |
10
+ | Added | `0.25.2` |
11
+ | Latest | `0.25.2` |
12
+
13
+ This custom hook is based on Chakra UI's `useTheme` hook. If your application
14
+ does not use CSS or SCSS files and you want to write CSS-in-JS styles in your
15
+ React components, the `useNYPLTheme` hook will provide you with NYPL-specific
16
+ style values.
17
+
18
+ ## Usage
19
+
20
+ This hook depends on the `DSProvider` component and if the function is used
21
+ outside of this wrapper component, then the theme object will be empty. After
22
+ importing and rendering the `DSProvider` wrapper component, your children
23
+ components can use this hook function.
24
+
25
+ ```tsx
26
+ import { useNYPLTheme } from "@nypl/design-system-react-components";
27
+ // ...
28
+
29
+ const theme = useNYPLTheme();
30
+ ```
31
+
32
+ The `theme` variable will be a JS object with design token style values.
33
+ This will allow you to use NYPL-specific styles in your components through CSS-in-JS.
34
+
35
+ ```ts
36
+ // theme:
37
+ {
38
+ breakpoints: { ... },
39
+ colors: {
40
+ brand: { ... },
41
+ section: { ... },
42
+ transparent: { ... },
43
+ ui: { ... },
44
+ },
45
+ fontSizes: { ... },
46
+ fontWeights: { ... },
47
+ fonts: { ... },
48
+ radii: { ... },
49
+ space: { ... },
50
+ }
51
+ ```
52
+
53
+ 1. NYPL DS Components
54
+
55
+ All DS components _should_ be used with their current styles. If a DS component
56
+ needs an updated style, first contact the Design System and UX teams about this
57
+ update. If you really _need_ to update a style and there is no available
58
+ variant, then you can add styles directly to the `additionalStyles` prop. At the
59
+ moment, not all DS components have this prop or feature.
60
+
61
+ For example, if the `Heading` component should render the text in NYPL's green
62
+ color used for "success primary" and add a bold font weight, then you can do
63
+ the following:
64
+
65
+ ```tsx
66
+ const theme = useNYPLTheme();
67
+
68
+ // ...
69
+ return (
70
+ <div>
71
+ <Heading
72
+ level={2}
73
+ additionalStyles={{
74
+ color: theme.colors.ui.sucess.primary,
75
+ fontWeight: theme.fontWeights.bold,
76
+ }}
77
+ >
78
+ Get a Digital Library Card Today in a Few Easy Steps
79
+ </Heading>
80
+
81
+ {/* Other components */}
82
+ </div>
83
+ );
84
+ ```
85
+
86
+ Of course, you can destructure the `theme` object to only get the object keys
87
+ you need for your component (this is a general example). Log the object to the
88
+ console to see all the available styles.
89
+
90
+ 2. HTML Components
91
+
92
+ Use the `style` attribute in HTML components to add inline styles.
93
+
94
+ ```tsx
95
+ <p style={{ color: theme.colors.ui.success.primary }}>
96
+ If you are 13 or older and live, work, attend school, or pay property taxes in
97
+ New York State, you can get a free digital library card right now using this
98
+ online form. Visitors to New York State can also use this form to apply for a
99
+ temporary card.
100
+ </p>
101
+ ```