@nypl/design-system-react-components 0.25.11 → 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 (347) hide show
  1. package/CHANGELOG.md +151 -0
  2. package/README.md +14 -26
  3. package/dist/components/Accordion/Accordion.d.ts +6 -4
  4. package/dist/components/Accordion/AccordionTypes.d.ts +5 -0
  5. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +4 -4
  6. package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +2 -1
  7. package/dist/components/Button/Button.d.ts +2 -2
  8. package/dist/components/Card/Card.d.ts +22 -29
  9. package/dist/components/Checkbox/Checkbox.d.ts +3 -3
  10. package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +9 -6
  11. package/dist/components/ComponentWrapper/ComponentWrapper.d.ts +1 -1
  12. package/dist/components/DatePicker/DatePicker.d.ts +5 -6
  13. package/dist/components/Fieldset/Fieldset.d.ts +5 -6
  14. package/dist/components/Form/Form.d.ts +6 -6
  15. package/dist/components/Grid/GridTypes.d.ts +7 -7
  16. package/dist/components/Grid/SimpleGrid.d.ts +1 -1
  17. package/dist/components/Heading/Heading.d.ts +5 -5
  18. package/dist/components/Heading/HeadingTypes.d.ts +1 -1
  19. package/dist/components/HelperErrorText/HelperErrorText.d.ts +9 -8
  20. package/dist/components/Hero/Hero.d.ts +9 -5
  21. package/dist/components/HorizontalRule/HorizontalRule.d.ts +2 -10
  22. package/dist/components/Icons/Icon.d.ts +2 -1
  23. package/dist/components/Icons/IconTypes.d.ts +10 -7
  24. package/dist/components/Image/Image.d.ts +27 -9
  25. package/dist/components/Image/ImageTypes.d.ts +4 -4
  26. package/dist/components/Label/Label.d.ts +7 -4
  27. package/dist/components/Link/Link.d.ts +1 -1
  28. package/dist/components/List/List.d.ts +11 -11
  29. package/dist/components/List/ListTypes.d.ts +1 -1
  30. package/dist/components/Logo/Logo.d.ts +2 -1
  31. package/dist/components/Logo/LogoSvgs.d.ts +8 -0
  32. package/dist/components/Logo/LogoTypes.d.ts +10 -2
  33. package/dist/components/Notification/Notification.d.ts +7 -7
  34. package/dist/components/Pagination/Pagination.d.ts +8 -4
  35. package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +3 -3
  36. package/dist/components/Radio/Radio.d.ts +5 -7
  37. package/dist/components/RadioGroup/RadioGroup.d.ts +16 -8
  38. package/dist/components/SearchBar/SearchBar.d.ts +5 -5
  39. package/dist/components/Select/Select.d.ts +12 -8
  40. package/dist/components/Select/SelectTypes.d.ts +4 -0
  41. package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +8 -6
  42. package/dist/components/SkeletonLoader/SkeletonLoaderTypes.d.ts +0 -4
  43. package/dist/components/Slider/Slider.d.ts +6 -4
  44. package/dist/components/StatusBadge/StatusBadge.d.ts +5 -1
  45. package/dist/components/StructuredContent/StructuredContent.d.ts +10 -23
  46. package/dist/components/Table/Table.d.ts +1 -1
  47. package/dist/components/Tabs/Tabs.d.ts +7 -6
  48. package/dist/components/Template/Template.d.ts +18 -9
  49. package/dist/components/Text/Text.d.ts +4 -4
  50. package/dist/components/Text/TextTypes.d.ts +1 -1
  51. package/dist/components/TextInput/TextInput.d.ts +7 -7
  52. package/dist/components/Toggle/Toggle.d.ts +8 -10
  53. package/dist/components/Toggle/{ToggleSizes.d.ts → ToggleTypes.d.ts} +1 -1
  54. package/dist/components/VideoPlayer/VideoPlayer.d.ts +2 -1
  55. package/dist/design-system-react-components.cjs.development.js +2802 -1686
  56. package/dist/design-system-react-components.cjs.development.js.map +1 -1
  57. package/dist/design-system-react-components.cjs.production.min.js +1 -1
  58. package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
  59. package/dist/design-system-react-components.esm.js +2811 -1699
  60. package/dist/design-system-react-components.esm.js.map +1 -1
  61. package/dist/helpers/enums.d.ts +4 -0
  62. package/dist/hooks/useCarouselStyles.d.ts +3 -2
  63. package/dist/hooks/useNYPLTheme.d.ts +12 -0
  64. package/dist/index.d.ts +11 -9
  65. package/dist/styles.css +1 -1
  66. package/dist/theme/components/accordion.d.ts +7 -12
  67. package/dist/theme/components/breadcrumb.d.ts +6 -0
  68. package/dist/theme/components/button.d.ts +10 -2
  69. package/dist/theme/components/card.d.ts +44 -24
  70. package/dist/theme/components/checkbox.d.ts +6 -6
  71. package/dist/theme/components/checkboxGroup.d.ts +4 -2
  72. package/dist/theme/components/componentWrapper.d.ts +2 -2
  73. package/dist/theme/components/customTable.d.ts +84 -1
  74. package/dist/theme/components/fieldset.d.ts +6 -14
  75. package/dist/theme/components/global.d.ts +37 -29
  76. package/dist/theme/components/globalMixins.d.ts +8 -8
  77. package/dist/theme/components/heading.d.ts +53 -0
  78. package/dist/theme/components/helperErrorText.d.ts +1 -0
  79. package/dist/theme/components/hero.d.ts +21 -15
  80. package/dist/theme/components/image.d.ts +1 -1
  81. package/dist/theme/components/label.d.ts +9 -10
  82. package/dist/theme/components/list.d.ts +105 -9
  83. package/dist/theme/components/notification.d.ts +7 -4
  84. package/dist/theme/components/pagination.d.ts +2 -5
  85. package/dist/theme/components/radio.d.ts +10 -6
  86. package/dist/theme/components/radioGroup.d.ts +4 -2
  87. package/dist/theme/components/select.d.ts +38 -13
  88. package/dist/theme/components/skeletonLoader.d.ts +2 -2
  89. package/dist/theme/components/slider.d.ts +14 -7
  90. package/dist/theme/components/structuredContent.d.ts +197 -0
  91. package/dist/theme/components/textInput.d.ts +22 -14
  92. package/dist/theme/components/toggle.d.ts +25 -6
  93. package/dist/theme/foundations/global.d.ts +33 -3
  94. package/dist/theme/foundations/radii.d.ts +1 -0
  95. package/dist/theme/foundations/spacing.d.ts +46 -43
  96. package/dist/utils/utils.d.ts +10 -0
  97. package/package.json +5 -6
  98. package/src/components/AccessibilityGuide/SkipNavigation.stories.mdx +34 -0
  99. package/src/components/Accordion/Accordion.stories.mdx +150 -66
  100. package/src/components/Accordion/Accordion.test.tsx +65 -17
  101. package/src/components/Accordion/Accordion.tsx +61 -27
  102. package/src/components/Accordion/AccordionTypes.tsx +5 -0
  103. package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +505 -14
  104. package/src/components/Autosuggest/Autosuggest.stories.mdx +4 -3
  105. package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +53 -18
  106. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +66 -35
  107. package/src/components/Breadcrumbs/Breadcrumbs.tsx +14 -13
  108. package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +2 -1
  109. package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +308 -10
  110. package/src/components/Button/Button.stories.mdx +87 -23
  111. package/src/components/Button/Button.test.tsx +25 -0
  112. package/src/components/Button/Button.tsx +18 -7
  113. package/src/components/Button/__snapshots__/Button.test.tsx.snap +27 -7
  114. package/src/components/Card/Card.stories.mdx +493 -329
  115. package/src/components/Card/Card.test.tsx +138 -18
  116. package/src/components/Card/Card.tsx +151 -85
  117. package/src/components/Card/__snapshots__/Card.test.tsx.snap +220 -100
  118. package/src/components/Chakra/Center.stories.mdx +2 -2
  119. package/src/components/Chakra/Grid.stories.mdx +4 -4
  120. package/src/components/Checkbox/Checkbox.stories.mdx +73 -9
  121. package/src/components/Checkbox/Checkbox.test.tsx +89 -10
  122. package/src/components/Checkbox/Checkbox.tsx +27 -16
  123. package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +209 -6
  124. package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +135 -23
  125. package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +216 -90
  126. package/src/components/CheckboxGroup/CheckboxGroup.tsx +39 -26
  127. package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +493 -89
  128. package/src/components/ComponentWrapper/ComponentWrapper.test.tsx +12 -0
  129. package/src/components/ComponentWrapper/ComponentWrapper.tsx +39 -41
  130. package/src/components/ComponentWrapper/__snapshots__/ComponentWrapper.test.tsx.snap +47 -34
  131. package/src/components/DatePicker/DatePicker.stories.mdx +63 -27
  132. package/src/components/DatePicker/DatePicker.test.tsx +94 -15
  133. package/src/components/DatePicker/DatePicker.tsx +67 -58
  134. package/src/components/DatePicker/_DatePicker.scss +71 -13
  135. package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +250 -206
  136. package/src/components/Fieldset/Fieldset.stories.mdx +33 -3
  137. package/src/components/Fieldset/Fieldset.test.tsx +58 -28
  138. package/src/components/Fieldset/Fieldset.tsx +35 -30
  139. package/src/components/Fieldset/__snapshots__/Fieldset.test.tsx.snap +40 -19
  140. package/src/components/Form/Form.stories.mdx +118 -47
  141. package/src/components/Form/Form.test.tsx +59 -16
  142. package/src/components/Form/Form.tsx +89 -65
  143. package/src/components/Form/__snapshots__/Form.test.tsx.snap +83 -5
  144. package/src/components/Grid/GridTypes.tsx +7 -7
  145. package/src/components/Grid/SimpleGrid.stories.mdx +87 -41
  146. package/src/components/Grid/SimpleGrid.test.tsx +24 -9
  147. package/src/components/Grid/SimpleGrid.tsx +29 -20
  148. package/src/components/Grid/__snapshots__/SimpleGrid.test.tsx.snap +16 -1
  149. package/src/components/Heading/Heading.stories.mdx +56 -25
  150. package/src/components/Heading/Heading.test.tsx +17 -7
  151. package/src/components/Heading/Heading.tsx +60 -58
  152. package/src/components/Heading/HeadingTypes.tsx +1 -1
  153. package/src/components/Heading/__snapshots__/Heading.test.tsx.snap +27 -8
  154. package/src/components/HelperErrorText/HelperErrorText.stories.mdx +64 -42
  155. package/src/components/HelperErrorText/HelperErrorText.test.tsx +15 -0
  156. package/src/components/HelperErrorText/HelperErrorText.tsx +40 -35
  157. package/src/components/HelperErrorText/__snapshots__/HelperErrorText.test.tsx.snap +35 -4
  158. package/src/components/Hero/Hero.stories.mdx +143 -113
  159. package/src/components/Hero/Hero.test.tsx +146 -58
  160. package/src/components/Hero/Hero.tsx +144 -112
  161. package/src/components/Hero/__snapshots__/Hero.test.tsx.snap +89 -17
  162. package/src/components/HorizontalRule/HorizontalRule.stories.mdx +26 -4
  163. package/src/components/HorizontalRule/HorizontalRule.test.tsx +9 -17
  164. package/src/components/HorizontalRule/HorizontalRule.tsx +9 -25
  165. package/src/components/HorizontalRule/__snapshots__/HorizontalRule.test.tsx.snap +18 -5
  166. package/src/components/Icons/Icon.stories.mdx +80 -23
  167. package/src/components/Icons/Icon.test.tsx +51 -2
  168. package/src/components/Icons/Icon.tsx +93 -71
  169. package/src/components/Icons/IconTypes.tsx +9 -6
  170. package/src/components/Icons/__snapshots__/Icon.test.tsx.snap +129 -0
  171. package/src/components/Image/Image.stories.mdx +160 -71
  172. package/src/components/Image/Image.test.tsx +40 -48
  173. package/src/components/Image/Image.tsx +80 -48
  174. package/src/components/Image/ImageTypes.ts +4 -4
  175. package/src/components/Image/__snapshots__/Image.test.tsx.snap +84 -21
  176. package/src/components/Label/Label.stories.mdx +42 -20
  177. package/src/components/Label/Label.test.tsx +42 -17
  178. package/src/components/Label/Label.tsx +22 -13
  179. package/src/components/Label/__snapshots__/Label.test.tsx.snap +19 -15
  180. package/src/components/Link/Link.stories.mdx +25 -1
  181. package/src/components/Link/Link.test.tsx +21 -0
  182. package/src/components/Link/Link.tsx +16 -9
  183. package/src/components/Link/__snapshots__/Link.test.tsx.snap +37 -11
  184. package/src/components/List/List.stories.mdx +75 -40
  185. package/src/components/List/List.test.tsx +73 -22
  186. package/src/components/List/List.tsx +44 -28
  187. package/src/components/List/ListTypes.tsx +1 -1
  188. package/src/components/List/__snapshots__/List.test.tsx.snap +110 -8
  189. package/src/components/Logo/Logo.stories.mdx +40 -16
  190. package/src/components/Logo/Logo.test.tsx +29 -2
  191. package/src/components/Logo/Logo.tsx +28 -11
  192. package/src/components/Logo/LogoSvgs.tsx +16 -0
  193. package/src/components/Logo/LogoTypes.tsx +9 -1
  194. package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +73 -2
  195. package/src/components/Modal/Modal.stories.mdx +13 -0
  196. package/src/components/Notification/Notification.stories.mdx +34 -5
  197. package/src/components/Notification/Notification.test.tsx +43 -9
  198. package/src/components/Notification/Notification.tsx +59 -55
  199. package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +256 -32
  200. package/src/components/Pagination/Pagination.stories.mdx +76 -13
  201. package/src/components/Pagination/Pagination.test.tsx +116 -5
  202. package/src/components/Pagination/Pagination.tsx +54 -29
  203. package/src/components/Pagination/__snapshots__/Pagination.test.tsx.snap +247 -30
  204. package/src/components/Placeholder/Placeholder.tsx +3 -1
  205. package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +76 -10
  206. package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +87 -13
  207. package/src/components/ProgressIndicator/ProgressIndicator.tsx +20 -10
  208. package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +101 -14
  209. package/src/components/Radio/Radio.stories.mdx +75 -11
  210. package/src/components/Radio/Radio.test.tsx +83 -9
  211. package/src/components/Radio/Radio.tsx +70 -61
  212. package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +168 -10
  213. package/src/components/RadioGroup/RadioGroup.stories.mdx +293 -94
  214. package/src/components/RadioGroup/RadioGroup.test.tsx +193 -68
  215. package/src/components/RadioGroup/RadioGroup.tsx +110 -101
  216. package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +1258 -902
  217. package/src/components/SearchBar/SearchBar.stories.mdx +104 -39
  218. package/src/components/SearchBar/{SearchBar.Test.tsx → SearchBar.test.tsx} +66 -6
  219. package/src/components/SearchBar/SearchBar.tsx +23 -13
  220. package/src/components/SearchBar/__snapshots__/SearchBar.test.tsx.snap +1039 -0
  221. package/src/components/Select/Select.stories.mdx +151 -62
  222. package/src/components/Select/Select.test.tsx +56 -44
  223. package/src/components/Select/Select.tsx +125 -104
  224. package/src/components/Select/SelectTypes.tsx +5 -0
  225. package/src/components/Select/__snapshots__/Select.test.tsx.snap +749 -409
  226. package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +53 -23
  227. package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +14 -8
  228. package/src/components/SkeletonLoader/SkeletonLoader.tsx +80 -78
  229. package/src/components/SkeletonLoader/SkeletonLoaderTypes.tsx +0 -5
  230. package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +169 -10
  231. package/src/components/Slider/Slider.stories.mdx +123 -41
  232. package/src/components/Slider/Slider.test.tsx +65 -17
  233. package/src/components/Slider/Slider.tsx +34 -24
  234. package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +403 -226
  235. package/src/components/StatusBadge/StatusBadge.stories.mdx +19 -1
  236. package/src/components/StatusBadge/StatusBadge.test.tsx +19 -1
  237. package/src/components/StatusBadge/StatusBadge.tsx +25 -20
  238. package/src/components/StatusBadge/__snapshots__/StatusBadge.test.tsx.snap +22 -3
  239. package/src/components/StructuredContent/StructuredContent.stories.mdx +229 -61
  240. package/src/components/StructuredContent/StructuredContent.test.tsx +162 -101
  241. package/src/components/StructuredContent/StructuredContent.tsx +98 -103
  242. package/src/components/StructuredContent/__snapshots__/StructuredContent.test.tsx.snap +102 -17
  243. package/src/components/StyleGuide/Bidirectionality.stories.mdx +9 -9
  244. package/src/components/StyleGuide/Breakpoints.stories.mdx +6 -6
  245. package/src/components/StyleGuide/Buttons.stories.mdx +2 -12
  246. package/src/components/StyleGuide/ColorCard.tsx +4 -4
  247. package/src/components/StyleGuide/Colors.stories.mdx +34 -20
  248. package/src/components/StyleGuide/DesignTokens.stories.mdx +56 -26
  249. package/src/components/StyleGuide/Forms.stories.mdx +27 -12
  250. package/src/components/StyleGuide/Iconography.stories.mdx +2 -12
  251. package/src/components/StyleGuide/Spacing.stories.mdx +80 -41
  252. package/src/components/StyleGuide/Typography.stories.mdx +47 -33
  253. package/src/components/Table/Table.stories.mdx +38 -11
  254. package/src/components/Table/Table.test.tsx +16 -1
  255. package/src/components/Table/Table.tsx +10 -8
  256. package/src/components/Table/__snapshots__/Table.test.tsx.snap +408 -5
  257. package/src/components/Tabs/Tabs.stories.mdx +59 -10
  258. package/src/components/Tabs/Tabs.test.tsx +29 -11
  259. package/src/components/Tabs/Tabs.tsx +28 -21
  260. package/src/components/Tabs/__snapshots__/Tabs.test.tsx.snap +394 -5
  261. package/src/components/Template/Template.stories.mdx +73 -32
  262. package/src/components/Template/Template.test.tsx +68 -5
  263. package/src/components/Template/Template.tsx +86 -72
  264. package/src/components/Template/__snapshots__/Template.test.tsx.snap +195 -22
  265. package/src/components/Text/Text.stories.mdx +32 -15
  266. package/src/components/Text/Text.test.tsx +14 -11
  267. package/src/components/Text/Text.tsx +13 -16
  268. package/src/components/Text/TextTypes.tsx +1 -1
  269. package/src/components/Text/__snapshots__/Text.test.tsx.snap +21 -4
  270. package/src/components/TextInput/TextInput.stories.mdx +73 -27
  271. package/src/components/TextInput/TextInput.test.tsx +65 -50
  272. package/src/components/TextInput/TextInput.tsx +123 -115
  273. package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +96 -73
  274. package/src/components/Toggle/Toggle.stories.mdx +74 -26
  275. package/src/components/Toggle/Toggle.test.tsx +41 -10
  276. package/src/components/Toggle/Toggle.tsx +31 -27
  277. package/src/components/Toggle/{ToggleSizes.tsx → ToggleTypes.tsx} +1 -1
  278. package/src/components/Toggle/__snapshots__/Toggle.test.tsx.snap +195 -8
  279. package/src/components/VideoPlayer/VideoPlayer.stories.mdx +52 -4
  280. package/src/components/VideoPlayer/VideoPlayer.test.tsx +41 -6
  281. package/src/components/VideoPlayer/VideoPlayer.tsx +134 -120
  282. package/src/components/VideoPlayer/__snapshots__/VideoPlayer.test.tsx.snap +81 -39
  283. package/src/docs/Chakra.stories.mdx +51 -10
  284. package/src/docs/Welcome.stories.mdx +168 -0
  285. package/src/{components/Card/CardTypes.tsx → helpers/enums.ts} +2 -2
  286. package/src/hooks/tests/useNYPLTheme.test.tsx +1 -1
  287. package/src/hooks/useCarouselStyles.stories.mdx +30 -0
  288. package/src/hooks/useCarouselStyles.ts +3 -2
  289. package/src/hooks/useNYPLTheme.stories.mdx +101 -0
  290. package/src/hooks/useNYPLTheme.ts +31 -7
  291. package/src/hooks/useWindowSize.stories.mdx +23 -0
  292. package/src/index.ts +11 -15
  293. package/src/styles/base/_place-holder.scss +3 -1
  294. package/src/styles.scss +0 -2
  295. package/src/theme/components/accordion.ts +7 -12
  296. package/src/theme/components/breadcrumb.ts +7 -0
  297. package/src/theme/components/button.ts +15 -7
  298. package/src/theme/components/card.ts +56 -36
  299. package/src/theme/components/checkbox.ts +12 -14
  300. package/src/theme/components/checkboxGroup.ts +4 -2
  301. package/src/theme/components/componentWrapper.ts +2 -2
  302. package/src/theme/components/customTable.ts +39 -31
  303. package/src/theme/components/fieldset.ts +3 -2
  304. package/src/theme/components/global.ts +42 -33
  305. package/src/theme/components/globalMixins.ts +8 -8
  306. package/src/theme/components/heading.ts +1 -1
  307. package/src/theme/components/helperErrorText.ts +1 -0
  308. package/src/theme/components/hero.ts +14 -16
  309. package/src/theme/components/icon.ts +5 -2
  310. package/src/theme/components/image.ts +1 -1
  311. package/src/theme/components/label.ts +4 -3
  312. package/src/theme/components/list.ts +76 -65
  313. package/src/theme/components/notification.ts +10 -7
  314. package/src/theme/components/pagination.ts +2 -5
  315. package/src/theme/components/progressIndicator.ts +3 -3
  316. package/src/theme/components/radio.ts +11 -14
  317. package/src/theme/components/radioGroup.ts +4 -2
  318. package/src/theme/components/select.ts +37 -18
  319. package/src/theme/components/skeletonLoader.ts +3 -3
  320. package/src/theme/components/slider.ts +19 -15
  321. package/src/theme/components/statusBadge.ts +2 -2
  322. package/src/theme/components/structuredContent.ts +66 -1
  323. package/src/theme/components/tabs.ts +2 -2
  324. package/src/theme/components/template.ts +9 -9
  325. package/src/theme/components/textInput.ts +13 -12
  326. package/src/theme/components/toggle.ts +76 -42
  327. package/src/theme/components/videoPlayer.ts +1 -1
  328. package/src/theme/foundations/colors.ts +20 -13
  329. package/src/theme/foundations/global.ts +17 -5
  330. package/src/theme/foundations/radii.ts +1 -0
  331. package/src/theme/foundations/spacing.ts +70 -22
  332. package/src/theme/foundations/typography.ts +3 -3
  333. package/src/utils/componentCategories.ts +28 -21
  334. package/src/utils/utils.ts +28 -0
  335. package/dist/components/Card/CardTypes.d.ts +0 -4
  336. package/dist/components/CheckboxGroup/CheckboxGroupLayoutTypes.d.ts +0 -4
  337. package/dist/components/Pagination/Pagination.stories.d.ts +0 -13
  338. package/dist/components/RadioGroup/RadioGroupLayoutTypes.d.ts +0 -4
  339. package/dist/components/SearchBar/SearchBar.Test.d.ts +0 -1
  340. package/dist/helpers/generateUUID.d.ts +0 -1
  341. package/src/components/CheckboxGroup/CheckboxGroupLayoutTypes.tsx +0 -4
  342. package/src/components/Pagination/Pagination.stories.tsx +0 -54
  343. package/src/components/RadioGroup/RadioGroupLayoutTypes.tsx +0 -4
  344. package/src/docs/Intro.stories.mdx +0 -53
  345. package/src/helpers/generateUUID.tsx +0 -5
  346. package/src/styles/base/_03-base.scss +0 -25
  347. package/src/styles/base/_04-focus.scss +0 -22
@@ -1,5 +1,4 @@
1
1
  import { Meta } from "@storybook/addon-docs";
2
- import { withDesign } from "storybook-addon-designs";
3
2
 
4
3
  import Card from "../Card/Card";
5
4
  import List from "../List/List";
@@ -20,46 +19,62 @@ import { getCategory } from "../../utils/componentCategories";
20
19
 
21
20
  ## General Information
22
21
 
23
- Use the NYPL Design System [Form](https://nypl.github.io/nypl-design-system/storybook-static/?path=/story/form-elements-form--form) component to control the placement and spacing for standard HTML forms.
22
+ Use the [Form](https://nypl.github.io/nypl-design-system/storybook-static/?path=/story/form-elements-form--form) component to control the placement and spacing for standard HTML forms.
24
23
 
25
24
  ## Form Layout
26
25
 
27
- The `Form` component offers two child-components to assist with layout: `FormRow` and `FormField`.
26
+ The `Form` component offers two child-components to assist with layout:
27
+ `FormRow` and `FormField`.
28
28
 
29
- The `FormField` component is used as a parent for all input components from the NYPL Design System (`Button`, `Select`, `TextInput`, etc.). When using the `Form` is it is necessary to wrap each individual form input component within a `FormField` component to ensure proper spacing and responsiveness.
29
+ The `FormField` component is used as a parent for all input components from
30
+ the Reservoir Design System (DS) (`Button`, `Select`, `TextInput`, etc.). When using the
31
+ `Form` is it is necessary to wrap each individual form input component within
32
+ a `FormField` component to ensure proper spacing and responsiveness.
30
33
 
31
- The `FormRow` component is used as a parent of multiple `FormField` components when you need to render more than one input component in a horizontal row.
34
+ The `FormRow` component is used as a parent of multiple `FormField` components
35
+ when you need to render more than one input component in a horizontal row.
32
36
 
33
- The recommended layout and spacing within individual form input components is built into the components. Consuming apps should rely on the components to handle NYPL best practices for layout and responsiveness.
37
+ The recommended layout and spacing within individual form input components is
38
+ built into the components. Consuming apps should rely on the components to
39
+ handle NYPL best practices for layout and responsiveness.
34
40
 
35
41
  ## Form Input Components
36
42
 
37
- The list of form input fields available in the DS includes, but is not limited to, the following:
43
+ The list of form input fields available in the Reservoir Design System (DS)
44
+ includes, but is not limited to, the following:
38
45
 
39
46
  - Button
40
47
  - Checkbox
41
48
  - CheckboxGroup
42
49
  - DatePicker
43
50
  - Dropdown \*\*\*
51
+ - Fieldset
44
52
  - FileUploader \*\*\*
53
+ - Form
45
54
  - Label
46
55
  - Radio
47
56
  - RadioGroup
48
57
  - SearchBar
49
58
  - Select
50
- - Slider \*\*\*
59
+ - Slider
51
60
  - TextInput (text, tel, url, number, password, textarea)
52
- - Toggle \*\*\*
61
+ - Toggle
53
62
 
54
63
  \*\*\* currently under development
55
64
 
56
65
  ## Input Labelling
57
66
 
58
- Most form components in the NYPL Design System will have the option to show a label, basic helper text and error text.
67
+ Most form components in the DS will have the option to show a
68
+ label, basic helper text and error text.
59
69
 
60
- For accessibility compliance, a text value for the label is always required. If necessary, the label can be hidden from the screen. In cases where the label is hidden, appropriate ARIA tags will be added to the form input component.
70
+ For accessibility compliance, a text value for the label is always required. If
71
+ necessary, the label can be hidden from the screen. In cases where the label is
72
+ hidden, appropriate ARIA tags will be added to the form input component.
61
73
 
62
- When the label is visible, `CheckboxGroup`, `DatePicker`, `FileUploader`, `RadioGroup`, `Select`, `Slider` and `TextInput` will show the label at the top of the rendered component. While `Checkbox`, `Radio` and `Toggle` will show the label to the right of the input field.
74
+ When the label is visible, `CheckboxGroup`, `DatePicker`, `FileUploader`,
75
+ `RadioGroup`, `Select`, `Slider` and `TextInput` will show the label at the top
76
+ of the rendered component. While `Checkbox`, `Radio` and `Toggle` will show the
77
+ label to the right of the input field.
63
78
 
64
79
  The helper and error text will always be rendered below the input field.
65
80
 
@@ -1,22 +1,12 @@
1
1
  import { Stack } from "@chakra-ui/react";
2
2
  import { Canvas, Meta } from "@storybook/addon-docs";
3
- import { withDesign } from "storybook-addon-designs";
4
3
 
5
4
  import Icon from "../Icons/Icon";
6
5
  import { IconColors, IconSizes, IconNames } from "../Icons/IconTypes";
7
6
  import { getCategory } from "../../utils/componentCategories";
8
7
  import DSProvider from "../../theme/provider";
9
8
 
10
- <Meta
11
- title={getCategory("Iconography")}
12
- decorators={[withDesign]}
13
- parameters={{
14
- design: {
15
- type: "figma",
16
- url: "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=10975%3A16",
17
- },
18
- }}
19
- />
9
+ <Meta title={getCategory("Iconography")} />
20
10
 
21
11
  # Iconography
22
12
 
@@ -31,7 +21,7 @@ import DSProvider from "../../theme/provider";
31
21
 
32
22
  ## General Information
33
23
 
34
- Use the NYPL Design System [Icon](https://nypl.github.io/nypl-design-system/storybook-static/?path=/docs/icon--control-props)
24
+ Use the Reservoir Design System (DS) [Icon](https://nypl.github.io/nypl-design-system/storybook-static/?path=/docs/icon--control-props)
35
25
  component to render and control icons as `<svg>` elements within consuming apps.
36
26
 
37
27
  The DS utilizes the `Filled` icons available in the [Material UI Design System](https://material-ui.com/components/material-icons/).
@@ -1,5 +1,4 @@
1
1
  import { Meta } from "@storybook/addon-docs";
2
- import { withDesign } from "storybook-addon-designs";
3
2
 
4
3
  import Card from "../Card/Card";
5
4
  import List from "../List/List";
@@ -7,66 +6,106 @@ import { ListTypes } from "../List/ListTypes";
7
6
  import { getCategory } from "../../utils/componentCategories";
8
7
  import DSProvider from "../../theme/provider";
9
8
 
10
- <Meta
11
- title={getCategory("Spacing")}
12
- decorators={[withDesign]}
13
- parameters={{
14
- design: {
15
- type: "figma",
16
- url: "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=17249%3A13",
17
- },
18
- }}
19
- />
9
+ <Meta title={getCategory("Spacing")} />
20
10
 
21
11
  # Spacing
22
12
 
23
- | Table of Contents |
24
- | ------------------------------------------------ |
25
- | 1. [General Information](#general-information) |
26
- | 2. [CSS Variables](#css-variables) |
27
- | 3. [Section Spacing](#section-spacing) |
28
- | 4. [Grid Spacing](#grid-spacing) |
29
- | 5. [Tabular Data Spacing](#tabular-data-spacing) |
30
- | 6. [Form Spacing](#form-spacing) |
31
- | 7. [Figma Reference](#figma-reference) |
13
+ | Table of Contents |
14
+ | ---------------------------------------------------- |
15
+ | 1. [General Information](#general-information) |
16
+ | 2. [Default Spacing Values](#default-spacing-values) |
17
+ | 3. [Page Section Spacing](#page-section-spacing) |
18
+ | 4. [Grid Spacing](#grid-spacing) |
19
+ | 5. [Form Spacing](#form-spacing) |
20
+ | 6. [Tabular Data Spacing](#tabular-data-spacing) |
21
+ | 7. [Figma Reference](#figma-reference) |
32
22
 
33
23
  ## General Information
34
24
 
35
- The DS spacing values are based on a root font size of `16px` (`1rem` = `16px`).
25
+ The Reservoir Design System (DS) spacing values are based on a root unit
26
+ of `16px` (`1rem` = `16px`).
36
27
 
37
- ## CSS Variables
28
+ ## Default Spacing Values
38
29
 
39
30
  <DSProvider>
40
- The following CSS variables are available through the DS.
41
-
42
- | Variable Name | REM Equivalent | Pixel Equivalent | Visual Reference |
43
- | ------------------- | -------------- | ---------------- | ------------------------------------------------------------------------------------------------------------- |
44
- | `--nypl-space-xxs` | `0.25rem` | `4px` | <div style={{ width: "var(--nypl-space-xxs)", backgroundColor: "var(--nypl-colors-ui-focus)" }}>&nbsp;</div> |
45
- | `--nypl-space-xs` | `0.5rem` | `8px` | <div style={{ width: "var(--nypl-space-xs)", backgroundColor: "var(--nypl-colors-ui-focus)" }}>&nbsp;</div> |
46
- | `--nypl-space-s` | `1rem` | `16px` | <div style={{ width: "var(--nypl-space-s)", backgroundColor: "var(--nypl-colors-ui-focus)" }}>&nbsp;</div> |
47
- | `--nypl-space-m` | `1.5rem` | `24px` | <div style={{ width: "var(--nypl-space-m)", backgroundColor: "var(--nypl-colors-ui-focus)" }}>&nbsp;</div> |
48
- | `--nypl-space-l` | `2rem` | `32px` | <div style={{ width: "var(--nypl-space-l)", backgroundColor: "var(--nypl-colors-ui-focus)" }}>&nbsp;</div> |
49
- | `--nypl-space-xl` | `3rem` | `48px` | <div style={{ width: "var(--nypl-space-xl)", backgroundColor: "var(--nypl-colors-ui-focus)" }}>&nbsp;</div> |
50
- | `--nypl-space-xxl` | `4rem` | `64px` | <div style={{ width: "var(--nypl-space-xxl)", backgroundColor: "var(--nypl-colors-ui-focus)" }}>&nbsp;</div> |
51
- | `--nypl-space-xxxl` | `6rem` | `96px` | <div style={{ width: "var(--nypl-space-xxxl)", backgroundColor: "var(--nypl-colors-ui-focus)" }}>&nbsp;</div> |
31
+ The following default spacing values are available through the DS.
32
+
33
+ | JS Theme Object | CSS Variable | REM Equivalent | Pixel Equivalent | Visual Reference |
34
+ | --------------- | ------------------- | -------------- | ---------------- | ------------------------------------------------------------------------------------------------------------- |
35
+ | `xxxs` | `--nypl-space-xxxs` | `0.125rem` | `2px` | <div style={{ width: "var(--nypl-space-xxxs)", backgroundColor: "var(--nypl-colors-ui-focus)" }}>&nbsp;</div> |
36
+ | `xxs` | `--nypl-space-xxs` | `0.25rem` | `4px` | <div style={{ width: "var(--nypl-space-xxs)", backgroundColor: "var(--nypl-colors-ui-focus)" }}>&nbsp;</div> |
37
+ | `xs` | `--nypl-space-xs` | `0.5rem` | `8px` | <div style={{ width: "var(--nypl-space-xs)", backgroundColor: "var(--nypl-colors-ui-focus)" }}>&nbsp;</div> |
38
+ | `s` | `--nypl-space-s` | `1rem` | `16px` | <div style={{ width: "var(--nypl-space-s)", backgroundColor: "var(--nypl-colors-ui-focus)" }}>&nbsp;</div> |
39
+ | `m` | `--nypl-space-m` | `1.5rem` | `24px` | <div style={{ width: "var(--nypl-space-m)", backgroundColor: "var(--nypl-colors-ui-focus)" }}>&nbsp;</div> |
40
+ | `l` | `--nypl-space-l` | `2rem` | `32px` | <div style={{ width: "var(--nypl-space-l)", backgroundColor: "var(--nypl-colors-ui-focus)" }}>&nbsp;</div> |
41
+ | `xl` | `--nypl-space-xl` | `3rem` | `48px` | <div style={{ width: "var(--nypl-space-xl)", backgroundColor: "var(--nypl-colors-ui-focus)" }}>&nbsp;</div> |
42
+ | `xxl` | `--nypl-space-xxl` | `4rem` | `64px` | <div style={{ width: "var(--nypl-space-xxl)", backgroundColor: "var(--nypl-colors-ui-focus)" }}>&nbsp;</div> |
43
+ | `xxxl` | `--nypl-space-xxxl` | `6rem` | `96px` | <div style={{ width: "var(--nypl-space-xxxl)", backgroundColor: "var(--nypl-colors-ui-focus)" }}>&nbsp;</div> |
52
44
 
53
45
  </DSProvider>
54
46
 
55
- ## Section Spacing
47
+ ## Page Section Spacing
56
48
 
57
- In consuming apps, the major page sections should be separated vertically by `3rem` `(--nypl-space-xl`). This includes the space after the page global `header` and the space before the global `footer`.
49
+ In consuming apps, the major page sections should be separated vertically by
50
+ `2rem`. This includes the space after the page global `header` and the space
51
+ before the global `footer`. Similarly, the major page sections should be
52
+ separated horizontally by `2rem`.
58
53
 
59
- ## Grid Spacing
54
+ | | Value | JS Theme Object | CSS Variable |
55
+ | ---------------------- | ------ | --------------- | ---------------------------- |
56
+ | **Vertical Spacing** | `2rem` | `page.vstack` | `--nypl-spacing-page-vstack` |
57
+ | **Horizontal Spacing** | `2rem` | `page.hstack` | `--nypl-spacing-page-hstack` |
60
58
 
61
- When elements are displayed in a grid (i.e. Cards, Images, etc.), the space between elements, both horizontal and vertical, should be `2rem` (`--nypl-space-l`).
59
+ ## Grid Spacing
62
60
 
63
- ## Tabular Data Spacing
61
+ When elements are displayed in a grid (i.e. Cards, Images, etc.), the space
62
+ between elements, both horizontal and vertical, should be `2rem`.
64
63
 
65
- When data is displayed in a tabular layout (i.e. rows and columns in a table, a definition list, etc.), the space between data cells in a row should be `1.5rem` (`--nypl-space-m`) and the space between rows should be `2rem` (`--nypl-space-l`).
64
+ | | Value | JS Theme Object | CSS Variable |
65
+ | --------------- | ------ | --------------- | ----------------------------- |
66
+ | **Default Gap** | `2rem` | `grid.default` | `--nypl-spacing-grid-default` |
66
67
 
67
68
  ## Form Spacing
68
69
 
69
- Form input components should have a `2rem` (`--nypl-space-l`) space between each component. This includes both vertical (column) and horizontal (row) stacking. The DS [Form](https://nypl.github.io/nypl-design-system/storybook-static/?path=/story/form-elements-form--form) component has correct spacing incorporated into its UI structure and should always be used when building forms.
70
+ Form input components should have a `2rem` space between each form input
71
+ component. This includes both vertical (column) and horizontal (row) stacking.
72
+ The DS [Form](https://nypl.github.io/nypl-design-system/storybook-static/?path=/docs/components-form-elements-form--form-with-controls)
73
+ component has correct spacing incorporated into its UI structure and should
74
+ always be used when building forms. Please note that the spacing in the `Form`
75
+ component is identical to the spacing in the `Grid` component.
76
+
77
+ When `Checkbox` and `Radio` components are grouped together, the components
78
+ should have a `1rem` space between components for vertical (column) stacking
79
+ and a `2rem` space between components for horizontal (row) stacking. The DS
80
+ `CheckboxGroup` and `RadioGroup` components have the correct spacing built
81
+
82
+ in and should be used respectively when multiple `Checkbox` or `radio`
83
+ components are being used together.
84
+
85
+ When `Button` components are grouped together, the `Button` components should
86
+ have a `0.5rem` space between component. This includes both vertical (column)
87
+ and horizontal (row) stacking. The DS `ButtonGroup` component has the correct
88
+ spacing built in and should be used when multiple `Button` components are being
89
+ used together.
90
+
91
+ | | Value | JS Theme Object | CSS Variable |
92
+ | -------------------------------------- | -------- | ---------------------------- | ------------------------------------------- |
93
+ | **Default Form Gap** | `2rem` | `grid.default` | `--nypl-spacing-grid-default` |
94
+ | **Input Group Default Row Spacing** | `2rem` | `input.group.default.hstack` | `--nypl-spacing-input-group-default-hstack` |
95
+ | **Input Group Default Column Spacing** | `1rem` | `input.group.default.vstack` | `--nypl-spacing-input-group-default-vstack` |
96
+ | **Button Group Row Spacing** | `0.5rem` | `input.group.button.hstack` | `--nypl-spacing-input-group-button-hstack` |
97
+ | **Button Group Column Spacing** | `0.5rem` | `input.group.button.vstack` | `--nypl-spacing-input-group-button-vstack` |
98
+
99
+ ## Tabular Data Spacing
100
+
101
+ When data is displayed in a tabular layout (i.e. rows and columns in a table,
102
+ a description list, etc.), the space between data cells in a row should be
103
+ `1.5rem` and the space between rows should be `2rem`.
104
+
105
+ | | Value | JS Theme Object | CSS Variable |
106
+ | -------------- | -------- | --------------- | ----------------------------- |
107
+ | **Column Gap** | `1.5rem` | `table.column` | `--nypl-spacing-table-column` |
108
+ | **Row Gap** | `2rem` | `table.row` | `--nypl-spacing-table-row` |
70
109
 
71
110
  ## Figma Reference
72
111
 
@@ -1,25 +1,15 @@
1
1
  import { Canvas, Meta } from "@storybook/addon-docs";
2
- import { withDesign } from "storybook-addon-designs";
3
2
 
4
3
  import Heading from "../Heading/Heading";
5
- import { HeadingDisplaySizes, HeadingLevels } from "../Heading/HeadingTypes";
4
+ import { HeadingSizes, HeadingLevels } from "../Heading/HeadingTypes";
6
5
  import List from "../List/List";
7
6
  import { ListTypes } from "../List/ListTypes";
8
7
  import Text from "../Text/Text";
9
- import { TextDisplaySizes } from "../Text/TextTypes";
8
+ import { TextSizes } from "../Text/TextTypes";
10
9
  import { getCategory } from "../../utils/componentCategories";
11
10
  import DSProvider from "../../theme/provider";
12
11
 
13
- <Meta
14
- title={getCategory("Typography")}
15
- decorators={[withDesign]}
16
- parameters={{
17
- design: {
18
- type: "figma",
19
- url: "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=10975%3A16",
20
- },
21
- }}
22
- />
12
+ <Meta title={getCategory("Typography")} />
23
13
 
24
14
  # Typography
25
15
 
@@ -38,13 +28,18 @@ import DSProvider from "../../theme/provider";
38
28
 
39
29
  ## General Information
40
30
 
41
- Consuming applications should utilize the DS standard text components as much as possible. In cases where that is not possible, the DS exposes CSS variables to assist with formatting text elements.
31
+ Consuming applications should utilize the Reservoir Design System (DS) standard
32
+ text components as much as possible. In cases where that is not possible, the
33
+ DS exposes CSS variables to assist with formatting text elements.
42
34
 
43
- The sizing of all text elements in the Design System is based on `1rem` being equal to `16px`.
35
+ The sizing of all text elements in the Design System is based on `1rem` being
36
+ equal to `16px`.
44
37
 
45
38
  ## Heading Component
46
39
 
47
- Use the NYPL Design System [Heading](/docs/components-typography-styles-heading--heading-props) component to render a standard HTML `<h>` tag. The `level` prop can be used to set the specific `<h>` tag that you require.
40
+ Use the DS [Heading](/docs/components-typography-styles-heading--heading-props)
41
+ component to render a standard HTML `<h>` tag. The `level` prop can be used to
42
+ set the specific `<h>` tag that you require.
48
43
 
49
44
  <Canvas>
50
45
  <DSProvider>
@@ -59,9 +54,14 @@ Use the NYPL Design System [Heading](/docs/components-typography-styles-heading-
59
54
 
60
55
  <DSProvider>
61
56
 
62
- Each heading level has a default style and size, but those styles can be overridden using the `displaySize` prop. The display sizes are separate from semantic elements and may be used to override the default size and styling of the semantic HTML heading elements. For example, the `h1` element has the `Primary` style applied by default, but a new style can be applied through the `displaySize` prop. Any `displaySize` style can be applied to any `Heading` element.
57
+ Each heading level has a default style and size, but those styles can be overridden
58
+ using the `size` prop. The display sizes are separate from semantic elements and
59
+ may be used to override the default size and styling of the semantic HTML heading
60
+ elements. For example, the `h1` element has the `Primary` style applied by default,
61
+ but a new style can be applied through the `size` prop. Any `size` style can be
62
+ applied to any `Heading` element.
63
63
 
64
- <Heading level={HeadingLevels.One} displaySize={HeadingDisplaySizes.Primary}>
64
+ <Heading level={HeadingLevels.One} size={HeadingSizes.Primary}>
65
65
  Primary Heading
66
66
  </Heading>
67
67
 
@@ -71,7 +71,7 @@ Each heading level has a default style and size, but those styles can be overrid
71
71
  | **Font Weight** | `300` | `fontWeight: "heading.primary"` | `font-weight: var(--nypl-fontWeights-heading-primary)` |
72
72
  | **Line Height** | `1.1` | n/a | n/a |
73
73
 
74
- <Heading level={HeadingLevels.One} displaySize={HeadingDisplaySizes.Secondary}>
74
+ <Heading level={HeadingLevels.One} size={HeadingSizes.Secondary}>
75
75
  Secondary Heading
76
76
  </Heading>
77
77
 
@@ -81,7 +81,7 @@ Each heading level has a default style and size, but those styles can be overrid
81
81
  | **Font Weight** | `500` | `fontWeight: "heading.secondary"` | `font-weight: var(--nypl-fontWeights-heading-secondary)` |
82
82
  | **Line Height** | `1.25` | n/a | n/a |
83
83
 
84
- <Heading level={HeadingLevels.One} displaySize={HeadingDisplaySizes.Tertiary}>
84
+ <Heading level={HeadingLevels.One} size={HeadingSizes.Tertiary}>
85
85
  Tertiary Heading
86
86
  </Heading>
87
87
 
@@ -91,7 +91,7 @@ Each heading level has a default style and size, but those styles can be overrid
91
91
  | **Font Weight** | `500` | `fontWeight: "heading.tertiary"` | `font-weight: var(--nypl-fontWeights-heading-tertiary)` |
92
92
  | **Line Height** | `1.25` | n/a | n/a |
93
93
 
94
- <Heading level={HeadingLevels.One} displaySize={HeadingDisplaySizes.Callout}>
94
+ <Heading level={HeadingLevels.One} size={HeadingSizes.Callout}>
95
95
  Callout Heading
96
96
  </Heading>
97
97
 
@@ -105,7 +105,9 @@ Each heading level has a default style and size, but those styles can be overrid
105
105
 
106
106
  ## Text Component
107
107
 
108
- Use the NYPL Design System [Text](/docs/components-typography-styles-text--text) component to render a standard HTML `<p>` tag. The Text component is generally used for body copy, captions and secondary captions.
108
+ Use the DS [Text](/docs/components-typography-styles-text--text)
109
+ component to render a standard HTML `<p>` tag. The Text component is generally
110
+ used for body copy, captions and secondary captions.
109
111
 
110
112
  <Canvas>
111
113
  <DSProvider>
@@ -122,12 +124,12 @@ Use the NYPL Design System [Text](/docs/components-typography-styles-text--text)
122
124
 
123
125
  <DSProvider>
124
126
 
125
- The `displaySize` prop can be used to render a specific style from the DS default text styles.
127
+ The `size` prop can be used to render a specific style from the DS default text styles.
126
128
 
127
129
  - [Typography: Body Styles](https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Main?node-id=10975%3A52)
128
130
  - [Typography: Other Styles](https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Main?node-id=10975%3A100)
129
131
 
130
- <Text displaySize={TextDisplaySizes.Default}>Default</Text>
132
+ <Text size={TextSizes.Default}>Default</Text>
131
133
 
132
134
  | | Value | JS Theme Object | CSS Variable |
133
135
  | --------------- | ------ | ---------------------------- | --------------------------------------------------- |
@@ -135,7 +137,7 @@ The `displaySize` prop can be used to render a specific style from the DS defaul
135
137
  | **Font Weight** | `300` | `fontWeight: "text.default"` | `font-weight: var(--nypl-fontWeights-text-default)` |
136
138
  | **Line Height** | `1.5` | `fontWeight: 1.5` | `font-weight: 1.5` |
137
139
 
138
- <Text displaySize={TextDisplaySizes.Caption}>Caption</Text>
140
+ <Text size={TextSizes.Caption}>Caption</Text>
139
141
 
140
142
  | | Value | JS Theme Object | CSS Variable |
141
143
  | --------------- | ---------- | ---------------------------- | --------------------------------------------------- |
@@ -143,7 +145,7 @@ The `displaySize` prop can be used to render a specific style from the DS defaul
143
145
  | **Font Weight** | `300` | `fontWeight: "text.caption"` | `font-weight: var(--nypl-fontWeights-text-caption)` |
144
146
  | **Line Height** | `1.25` | `fontWeight: 1.25` | `font-weight: 1.25` |
145
147
 
146
- <Text displaySize={TextDisplaySizes.Tag}>Tag</Text>
148
+ <Text size={TextSizes.Tag}>Tag</Text>
147
149
 
148
150
  | | Value | JS Theme Object | CSS Variable |
149
151
  | --------------- | --------- | ------------------------ | ----------------------------------------------- |
@@ -151,7 +153,7 @@ The `displaySize` prop can be used to render a specific style from the DS defaul
151
153
  | **Font Weight** | `400` | `fontWeight: "text.tag"` | `font-weight: var(--nypl-fontWeights-text-tag)` |
152
154
  | **Line Height** | `1.5` | `fontWeight: 1.5` | `font-weight: 1.5` |
153
155
 
154
- <Text displaySize={TextDisplaySizes.Mini}>Mini</Text>
156
+ <Text size={TextSizes.Mini}>Mini</Text>
155
157
 
156
158
  | | Value | JS Theme Object | CSS Variable |
157
159
  | --------------- | ---------- | ------------------------- | ------------------------------------------------ |
@@ -163,7 +165,9 @@ The `displaySize` prop can be used to render a specific style from the DS defaul
163
165
 
164
166
  ## Font Family
165
167
 
166
- With website accessibility in mind, font choices for the DS were made with an eye toward clarity and readability. Headings and body content use the following font family assignment:
168
+ With website accessibility in mind, font choices for the DS were made with an
169
+ eye toward clarity and readability. Headings and body content use the
170
+ following font family assignment:
167
171
 
168
172
  <Canvas>
169
173
  <DSProvider>
@@ -179,11 +183,15 @@ The following CSS variables are available through the DS.
179
183
  ```
180
184
 
181
185
  > **RECOMMENDATIONS**
182
- > When making font selections for project based components outside the DS, sans serif fonts display better on computers and mobile devices. Avoid decorative or overly stylized fonts, as they are often difficult to read even for users without visual impairments or reading Standard Text Default
186
+ > When making font selections for project based components outside the DS,
187
+ > sans serif fonts display better on computers and mobile devices. Avoid
188
+ > decorative or overly stylized fonts, as they are often difficult to read even
189
+ > for users without visual impairments or reading Standard Text Default
183
190
 
184
191
  ## Font Color
185
192
 
186
- All text within a project, unless specifically noted in mockups, should be black on a white background.
193
+ All text within a project, unless specifically noted in mockups, should be
194
+ black on a white background.
187
195
 
188
196
  <Canvas>
189
197
  <DSProvider>
@@ -198,7 +206,10 @@ All text within a project, unless specifically noted in mockups, should be black
198
206
  </DSProvider>
199
207
  </Canvas>
200
208
 
201
- In cases where specific colors must be applied to text elements, the DS provides CSS variables for the full NYPL color palette. Refer to the [Colors](https://nypl.github.io/nypl-design-system/storybook-static/?path=/docs/style-guide-colors--colors-brand) section of the Style Guide for details.
209
+ In cases where specific colors must be applied to text elements, the DS
210
+ provides CSS variables for the full NYPL color palette. Refer to the
211
+ [Colors](https://nypl.github.io/nypl-design-system/storybook-static/?path=/docs/style-guide-colors--colors-brand)
212
+ section of the Style Guide for details.
202
213
 
203
214
  ## Font Weight
204
215
 
@@ -342,7 +353,9 @@ The following font size design tokens are available through the DS.
342
353
 
343
354
  ## Text Case
344
355
 
345
- In general, the New York Public Library uses Title Case for titles. This means only using capital letters for the principal words. Articles, conjunctions, and prepositions do not get capital letters unless they start the title. For example:
356
+ In general, the New York Public Library uses Title Case for titles. This means
357
+ only using capital letters for the principal words. Articles, conjunctions, and
358
+ prepositions do not get capital letters unless they start the title. For example:
346
359
 
347
360
  <Canvas>
348
361
  <DSProvider>
@@ -373,7 +386,8 @@ In general, the New York Public Library uses Title Case for titles. This means o
373
386
  ### Summaries
374
387
 
375
388
  140 characters max<br />
376
- Note: Online Exhibitions, with their longer, legacy summaries are an exception to this.
389
+ Note: Online Exhibitions, with their longer, legacy summaries are an exception
390
+ to this.
377
391
 
378
392
  <Canvas>
379
393
  <DSProvider>
@@ -36,7 +36,19 @@ import { getCategory } from "../../utils/componentCategories";
36
36
  | Component Version | DS Version |
37
37
  | ----------------- | ---------- |
38
38
  | Added | `0.25.9` |
39
- | Latest | `0.25.10` |
39
+ | Latest | `0.26.0` |
40
+
41
+ ## Table of Contents
42
+
43
+ - [Overview](#overview)
44
+ - [Component Props](#component-props)
45
+ - [Accessibility](#accessibility)
46
+ - [With a title](#with-a-title)
47
+ - [With Row Dividers](#with-row-dividers)
48
+ - [With Row Headers](#with-row-headers)
49
+ - [With Custom Header Colors](#with-custom-header-colors)
50
+
51
+ ## Overview
40
52
 
41
53
  <Description of={Table} />
42
54
 
@@ -64,6 +76,8 @@ export const tableData = [
64
76
  ],
65
77
  ];
66
78
 
79
+ ## Component Props
80
+
67
81
  <Canvas withToolbar>
68
82
  <Story
69
83
  name="Table"
@@ -87,16 +101,29 @@ export const tableData = [
87
101
 
88
102
  ## Accessibility
89
103
 
90
- - The HTML for the `Table` element is structured with proper semantic use of the
91
- `table`, `caption`, `thead`, `tbody`, `tr`, and `td` HTML elements.
92
- - When titles are added through the `titleText` prop, the `caption` element will
93
- be rendered on the page.
94
- - The first row and/or the first cell in a `tr` row can be headers. Each `th`
95
- header cell has an appropriate scope attribute set to either `scope="col"` or
96
- `scope="row"`. For example, every `th` cell in a `thead` `tr` row will have
97
- `scope="col"`. Every `th` cell in a `tbody` `tr` row will have `scope="row"`.
98
- These headers are visually different from the data. Use the `useRowHeaders`
99
- prop to render the first cell in every row as a header.
104
+ Internally, the HTML for the `Table` element is structured with proper semantic
105
+ use of the `table`, `caption`, `thead`, `tbody`, `tr`, and `td` HTML elements.
106
+ When titles are added through the `titleText` prop, the `caption` element will
107
+ be rendered above the `thead` element.
108
+
109
+ This component should be used to render tabular data only and not used for layout
110
+ purposes.
111
+
112
+ The first row and/or the first cell in a `tr` row can be headers. Each `th`
113
+ header cell has an appropriate scope attribute set to either `scope="col"` or
114
+ `scope="row"`. For example, every `th` cell in a `thead` `tr` row will have
115
+ `scope="col"`. Every `th` cell in a `tbody` `tr` row will have `scope="row"`.
116
+ These headers are visually different from the data. Use the `useRowHeaders`
117
+ prop to render the first cell in every row as a header. If a table has two levels
118
+ of headers (such as two levels of horizontal headers), break the data into two
119
+ separate tables.
120
+
121
+ Resources:
122
+
123
+ - [W3C Tables Tutorial](https://www.w3.org/WAI/tutorials/tables/)
124
+ - [MDN table: The Table element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table)
125
+ - [MDN HTML table advance features and accessibility](https://developer.mozilla.org/en-US/docs/Learn/HTML/Tables/Advanced)
126
+ - [Chakra UI Table](https://chakra-ui.com/docs/components/data-display/table)
100
127
 
101
128
  ## With a title
102
129
 
@@ -76,7 +76,7 @@ describe("Table", () => {
76
76
  const warn = jest.spyOn(console, "warn");
77
77
  render(<Table tableData={[]} />);
78
78
  expect(warn).toHaveBeenCalledWith(
79
- "Table: data should be two dimensional array."
79
+ "NYPL Reservoir Table: Data in the `tableData` prop must be a two dimensional array."
80
80
  );
81
81
  });
82
82
 
@@ -127,11 +127,26 @@ describe("Table", () => {
127
127
  />
128
128
  )
129
129
  .toJSON();
130
+ const withChakraProps = renderer
131
+ .create(
132
+ <Table
133
+ id="chakra"
134
+ tableData={tableData}
135
+ p="20px"
136
+ color="ui.error.primary"
137
+ />
138
+ )
139
+ .toJSON();
140
+ const withOtherProps = renderer
141
+ .create(<Table id="props" tableData={tableData} data-testid="props" />)
142
+ .toJSON();
130
143
 
131
144
  expect(basic).toMatchSnapshot();
132
145
  expect(withCaption).toMatchSnapshot();
133
146
  expect(withHeaders).toMatchSnapshot();
134
147
  expect(withRowHeaders).toMatchSnapshot();
135
148
  expect(withCustomHeaderColors).toMatchSnapshot();
149
+ expect(withChakraProps).toMatchSnapshot();
150
+ expect(withOtherProps).toMatchSnapshot();
136
151
  });
137
152
  });
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
1
  import {
2
+ chakra,
3
3
  Table as ChakraTable,
4
4
  TableCaption as ChakraTableCaption,
5
5
  Tbody as ChakraTbody,
@@ -9,8 +9,7 @@ import {
9
9
  Tr as ChakraTr,
10
10
  useMultiStyleConfig,
11
11
  } from "@chakra-ui/react";
12
-
13
- import generateUUID from "../../helpers/generateUUID";
12
+ import * as React from "react";
14
13
 
15
14
  export interface TableProps {
16
15
  /** Additional class name for the `Table` component. */
@@ -39,17 +38,18 @@ export interface TableProps {
39
38
  * Basic `Table` component used to organize and display tabular data in
40
39
  * rows and columns.
41
40
  */
42
- function Table(props: React.PropsWithChildren<TableProps>) {
41
+ export const Table = chakra((props: React.PropsWithChildren<TableProps>) => {
43
42
  const {
44
43
  className,
45
44
  columnHeaders,
46
45
  columnHeadersBackgroundColor,
47
46
  columnHeadersTextColor,
48
- id = generateUUID(),
47
+ id,
49
48
  showRowDividers = false,
50
49
  tableData,
51
50
  titleText,
52
51
  useRowHeaders = false,
52
+ ...rest
53
53
  } = props;
54
54
 
55
55
  const customColors = {};
@@ -91,7 +91,9 @@ function Table(props: React.PropsWithChildren<TableProps>) {
91
91
  tableData.length <= 0 ||
92
92
  tableData[0].constructor !== Array
93
93
  ) {
94
- console.warn("Table: data should be two dimensional array.");
94
+ console.warn(
95
+ "NYPL Reservoir Table: Data in the `tableData` prop must be a two dimensional array."
96
+ );
95
97
  return null;
96
98
  }
97
99
 
@@ -115,12 +117,12 @@ function Table(props: React.PropsWithChildren<TableProps>) {
115
117
  };
116
118
 
117
119
  return (
118
- <ChakraTable id={id} sx={styles} className={className}>
120
+ <ChakraTable id={id} sx={styles} className={className} {...rest}>
119
121
  {tableCaption}
120
122
  {columnHeadersElems}
121
123
  {tableBodyElems()}
122
124
  </ChakraTable>
123
125
  );
124
- }
126
+ });
125
127
 
126
128
  export default Table;