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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (305) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/README.md +10 -10
  3. package/dist/components/Accordion/Accordion.d.ts +1 -1
  4. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
  5. package/dist/components/Button/Button.d.ts +2 -2
  6. package/dist/components/Card/Card.d.ts +11 -9
  7. package/dist/components/Checkbox/Checkbox.d.ts +2 -2
  8. package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +5 -4
  9. package/dist/components/ComponentWrapper/ComponentWrapper.d.ts +1 -1
  10. package/dist/components/DatePicker/DatePicker.d.ts +5 -6
  11. package/dist/components/Fieldset/Fieldset.d.ts +5 -6
  12. package/dist/components/Form/Form.d.ts +6 -6
  13. package/dist/components/Grid/GridTypes.d.ts +7 -7
  14. package/dist/components/Grid/SimpleGrid.d.ts +1 -1
  15. package/dist/components/Heading/Heading.d.ts +1 -1
  16. package/dist/components/HelperErrorText/HelperErrorText.d.ts +9 -8
  17. package/dist/components/Hero/Hero.d.ts +2 -1
  18. package/dist/components/HorizontalRule/HorizontalRule.d.ts +2 -10
  19. package/dist/components/Icons/Icon.d.ts +2 -1
  20. package/dist/components/Image/Image.d.ts +2 -2
  21. package/dist/components/Label/Label.d.ts +7 -4
  22. package/dist/components/Link/Link.d.ts +1 -1
  23. package/dist/components/List/List.d.ts +11 -11
  24. package/dist/components/List/ListTypes.d.ts +1 -1
  25. package/dist/components/Logo/Logo.d.ts +2 -1
  26. package/dist/components/Logo/LogoSvgs.d.ts +2 -0
  27. package/dist/components/Logo/LogoTypes.d.ts +2 -0
  28. package/dist/components/Modal/Modal.d.ts +28 -8
  29. package/dist/components/Notification/Notification.d.ts +4 -4
  30. package/dist/components/Pagination/Pagination.d.ts +2 -2
  31. package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +3 -3
  32. package/dist/components/Radio/Radio.d.ts +4 -6
  33. package/dist/components/RadioGroup/RadioGroup.d.ts +12 -6
  34. package/dist/components/SearchBar/SearchBar.d.ts +4 -4
  35. package/dist/components/Select/Select.d.ts +10 -6
  36. package/dist/components/Select/SelectTypes.d.ts +4 -0
  37. package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +4 -3
  38. package/dist/components/Slider/Slider.d.ts +6 -4
  39. package/dist/components/StatusBadge/StatusBadge.d.ts +5 -1
  40. package/dist/components/StructuredContent/StructuredContent.d.ts +2 -2
  41. package/dist/components/Table/Table.d.ts +1 -1
  42. package/dist/components/Tabs/Tabs.d.ts +4 -3
  43. package/dist/components/Template/Template.d.ts +4 -3
  44. package/dist/components/Text/Text.d.ts +1 -1
  45. package/dist/components/TextInput/TextInput.d.ts +5 -5
  46. package/dist/components/Toggle/Toggle.d.ts +3 -4
  47. package/dist/components/VideoPlayer/VideoPlayer.d.ts +2 -1
  48. package/dist/design-system-react-components.cjs.development.js +1767 -1180
  49. package/dist/design-system-react-components.cjs.development.js.map +1 -1
  50. package/dist/design-system-react-components.cjs.production.min.js +1 -1
  51. package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
  52. package/dist/design-system-react-components.esm.js +1774 -1188
  53. package/dist/design-system-react-components.esm.js.map +1 -1
  54. package/dist/hooks/useCarouselStyles.d.ts +3 -2
  55. package/dist/hooks/useNYPLTheme.d.ts +12 -0
  56. package/dist/index.d.ts +5 -2
  57. package/dist/styles.css +1 -1
  58. package/dist/theme/components/button.d.ts +10 -2
  59. package/dist/theme/components/card.d.ts +42 -22
  60. package/dist/theme/components/checkbox.d.ts +5 -4
  61. package/dist/theme/components/checkboxGroup.d.ts +1 -1
  62. package/dist/theme/components/componentWrapper.d.ts +2 -2
  63. package/dist/theme/components/customTable.d.ts +84 -1
  64. package/dist/theme/components/fieldset.d.ts +4 -14
  65. package/dist/theme/components/global.d.ts +23 -17
  66. package/dist/theme/components/heading.d.ts +53 -0
  67. package/dist/theme/components/helperErrorText.d.ts +1 -0
  68. package/dist/theme/components/hero.d.ts +20 -14
  69. package/dist/theme/components/label.d.ts +9 -10
  70. package/dist/theme/components/list.d.ts +99 -9
  71. package/dist/theme/components/radio.d.ts +6 -4
  72. package/dist/theme/components/radioGroup.d.ts +1 -1
  73. package/dist/theme/components/select.d.ts +28 -5
  74. package/dist/theme/components/skeletonLoader.d.ts +2 -2
  75. package/dist/theme/components/slider.d.ts +6 -3
  76. package/dist/theme/components/structuredContent.d.ts +197 -0
  77. package/dist/theme/components/textInput.d.ts +18 -6
  78. package/dist/theme/components/toggle.d.ts +7 -4
  79. package/dist/theme/foundations/global.d.ts +2 -0
  80. package/dist/theme/foundations/radii.d.ts +1 -0
  81. package/dist/theme/foundations/spacing.d.ts +46 -43
  82. package/package.json +17 -19
  83. package/src/components/Accordion/Accordion.stories.mdx +9 -9
  84. package/src/components/Accordion/Accordion.test.tsx +21 -0
  85. package/src/components/Accordion/Accordion.tsx +13 -9
  86. package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +276 -27
  87. package/src/components/Autosuggest/Autosuggest.stories.mdx +4 -3
  88. package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +21 -5
  89. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +52 -31
  90. package/src/components/Breadcrumbs/Breadcrumbs.tsx +8 -7
  91. package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +211 -12
  92. package/src/components/Button/Button.stories.mdx +87 -23
  93. package/src/components/Button/Button.test.tsx +25 -0
  94. package/src/components/Button/Button.tsx +18 -7
  95. package/src/components/Button/__snapshots__/Button.test.tsx.snap +27 -7
  96. package/src/components/Card/Card.stories.mdx +287 -194
  97. package/src/components/Card/Card.test.tsx +102 -0
  98. package/src/components/Card/Card.tsx +73 -32
  99. package/src/components/Card/__snapshots__/Card.test.tsx.snap +196 -36
  100. package/src/components/Chakra/Grid.stories.mdx +4 -4
  101. package/src/components/Checkbox/Checkbox.stories.mdx +62 -10
  102. package/src/components/Checkbox/Checkbox.test.tsx +32 -9
  103. package/src/components/Checkbox/Checkbox.tsx +20 -15
  104. package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +134 -7
  105. package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +65 -17
  106. package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +137 -81
  107. package/src/components/CheckboxGroup/CheckboxGroup.tsx +31 -21
  108. package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +332 -97
  109. package/src/components/ComponentWrapper/ComponentWrapper.test.tsx +12 -0
  110. package/src/components/ComponentWrapper/ComponentWrapper.tsx +39 -41
  111. package/src/components/ComponentWrapper/__snapshots__/ComponentWrapper.test.tsx.snap +47 -34
  112. package/src/components/DatePicker/DatePicker.stories.mdx +63 -27
  113. package/src/components/DatePicker/DatePicker.test.tsx +89 -13
  114. package/src/components/DatePicker/DatePicker.tsx +62 -56
  115. package/src/components/DatePicker/_DatePicker.scss +71 -13
  116. package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +250 -206
  117. package/src/components/Fieldset/Fieldset.stories.mdx +33 -3
  118. package/src/components/Fieldset/Fieldset.test.tsx +58 -28
  119. package/src/components/Fieldset/Fieldset.tsx +35 -30
  120. package/src/components/Fieldset/__snapshots__/Fieldset.test.tsx.snap +40 -19
  121. package/src/components/Form/Form.stories.mdx +72 -39
  122. package/src/components/Form/Form.test.tsx +58 -15
  123. package/src/components/Form/Form.tsx +89 -67
  124. package/src/components/Form/__snapshots__/Form.test.tsx.snap +83 -5
  125. package/src/components/Grid/GridTypes.tsx +7 -7
  126. package/src/components/Grid/SimpleGrid.stories.mdx +34 -6
  127. package/src/components/Grid/SimpleGrid.test.tsx +9 -0
  128. package/src/components/Grid/SimpleGrid.tsx +29 -20
  129. package/src/components/Grid/__snapshots__/SimpleGrid.test.tsx.snap +16 -1
  130. package/src/components/Heading/Heading.stories.mdx +36 -3
  131. package/src/components/Heading/Heading.test.tsx +10 -0
  132. package/src/components/Heading/Heading.tsx +56 -50
  133. package/src/components/Heading/__snapshots__/Heading.test.tsx.snap +26 -7
  134. package/src/components/HelperErrorText/HelperErrorText.stories.mdx +64 -42
  135. package/src/components/HelperErrorText/HelperErrorText.test.tsx +15 -0
  136. package/src/components/HelperErrorText/HelperErrorText.tsx +40 -35
  137. package/src/components/HelperErrorText/__snapshots__/HelperErrorText.test.tsx.snap +35 -4
  138. package/src/components/Hero/Hero.stories.mdx +125 -95
  139. package/src/components/Hero/Hero.test.tsx +33 -0
  140. package/src/components/Hero/Hero.tsx +135 -126
  141. package/src/components/Hero/__snapshots__/Hero.test.tsx.snap +89 -17
  142. package/src/components/HorizontalRule/HorizontalRule.stories.mdx +26 -4
  143. package/src/components/HorizontalRule/HorizontalRule.test.tsx +9 -19
  144. package/src/components/HorizontalRule/HorizontalRule.tsx +9 -26
  145. package/src/components/HorizontalRule/__snapshots__/HorizontalRule.test.tsx.snap +18 -5
  146. package/src/components/Icons/Icon.stories.mdx +31 -6
  147. package/src/components/Icons/Icon.test.tsx +38 -0
  148. package/src/components/Icons/Icon.tsx +93 -76
  149. package/src/components/Icons/__snapshots__/Icon.test.tsx.snap +129 -0
  150. package/src/components/Image/Image.stories.mdx +29 -5
  151. package/src/components/Image/Image.test.tsx +8 -0
  152. package/src/components/Image/Image.tsx +38 -26
  153. package/src/components/Image/__snapshots__/Image.test.tsx.snap +24 -8
  154. package/src/components/Label/Label.stories.mdx +42 -20
  155. package/src/components/Label/Label.test.tsx +42 -17
  156. package/src/components/Label/Label.tsx +22 -13
  157. package/src/components/Label/__snapshots__/Label.test.tsx.snap +19 -15
  158. package/src/components/Link/Link.stories.mdx +25 -15
  159. package/src/components/Link/Link.test.tsx +21 -22
  160. package/src/components/Link/Link.tsx +8 -8
  161. package/src/components/Link/__snapshots__/Link.test.tsx.snap +37 -11
  162. package/src/components/List/List.stories.mdx +75 -40
  163. package/src/components/List/List.test.tsx +67 -19
  164. package/src/components/List/List.tsx +38 -25
  165. package/src/components/List/ListTypes.tsx +1 -1
  166. package/src/components/List/__snapshots__/List.test.tsx.snap +110 -8
  167. package/src/components/Logo/Logo.stories.mdx +30 -6
  168. package/src/components/Logo/Logo.test.tsx +17 -0
  169. package/src/components/Logo/Logo.tsx +18 -6
  170. package/src/components/Logo/LogoSvgs.tsx +4 -0
  171. package/src/components/Logo/LogoTypes.tsx +2 -0
  172. package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +73 -2
  173. package/src/components/Modal/Modal.stories.mdx +256 -136
  174. package/src/components/Modal/Modal.test.tsx +151 -9
  175. package/src/components/Modal/Modal.tsx +140 -20
  176. package/src/components/Modal/__snapshots__/Modal.test.tsx.snap +25 -0
  177. package/src/components/Notification/Notification.stories.mdx +25 -1
  178. package/src/components/Notification/Notification.test.tsx +23 -0
  179. package/src/components/Notification/Notification.tsx +46 -44
  180. package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +158 -29
  181. package/src/components/Pagination/Pagination.stories.mdx +25 -6
  182. package/src/components/Pagination/Pagination.test.tsx +25 -0
  183. package/src/components/Pagination/Pagination.tsx +6 -6
  184. package/src/components/Pagination/__snapshots__/Pagination.test.tsx.snap +244 -27
  185. package/src/components/Placeholder/Placeholder.tsx +3 -1
  186. package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +76 -10
  187. package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +81 -11
  188. package/src/components/ProgressIndicator/ProgressIndicator.tsx +17 -9
  189. package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +101 -14
  190. package/src/components/Radio/Radio.stories.mdx +64 -12
  191. package/src/components/Radio/Radio.test.tsx +28 -8
  192. package/src/components/Radio/Radio.tsx +66 -63
  193. package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +103 -6
  194. package/src/components/RadioGroup/RadioGroup.stories.mdx +224 -89
  195. package/src/components/RadioGroup/RadioGroup.test.tsx +122 -62
  196. package/src/components/RadioGroup/RadioGroup.tsx +106 -100
  197. package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +1236 -1020
  198. package/src/components/SearchBar/SearchBar.stories.mdx +101 -36
  199. package/src/components/SearchBar/{SearchBar.Test.tsx → SearchBar.test.tsx} +46 -4
  200. package/src/components/SearchBar/SearchBar.tsx +17 -8
  201. package/src/components/SearchBar/__snapshots__/SearchBar.test.tsx.snap +1039 -0
  202. package/src/components/Select/Select.stories.mdx +128 -49
  203. package/src/components/Select/Select.test.tsx +63 -16
  204. package/src/components/Select/Select.tsx +131 -92
  205. package/src/components/Select/SelectTypes.tsx +5 -0
  206. package/src/components/Select/__snapshots__/Select.test.tsx.snap +765 -425
  207. package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +42 -10
  208. package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +8 -0
  209. package/src/components/SkeletonLoader/SkeletonLoader.tsx +76 -72
  210. package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +169 -10
  211. package/src/components/Slider/Slider.stories.mdx +91 -42
  212. package/src/components/Slider/Slider.test.tsx +65 -17
  213. package/src/components/Slider/Slider.tsx +26 -19
  214. package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +403 -226
  215. package/src/components/StatusBadge/StatusBadge.stories.mdx +19 -1
  216. package/src/components/StatusBadge/StatusBadge.test.tsx +16 -0
  217. package/src/components/StatusBadge/StatusBadge.tsx +25 -20
  218. package/src/components/StatusBadge/__snapshots__/StatusBadge.test.tsx.snap +22 -3
  219. package/src/components/StructuredContent/StructuredContent.stories.mdx +131 -12
  220. package/src/components/StructuredContent/StructuredContent.test.tsx +34 -0
  221. package/src/components/StructuredContent/StructuredContent.tsx +80 -75
  222. package/src/components/StructuredContent/__snapshots__/StructuredContent.test.tsx.snap +102 -17
  223. package/src/components/StyleGuide/Bidirectionality.stories.mdx +5 -5
  224. package/src/components/StyleGuide/Breakpoints.stories.mdx +6 -6
  225. package/src/components/StyleGuide/Buttons.stories.mdx +2 -12
  226. package/src/components/StyleGuide/ColorCard.tsx +1 -1
  227. package/src/components/StyleGuide/Colors.stories.mdx +1 -2
  228. package/src/components/StyleGuide/DesignTokens.stories.mdx +56 -26
  229. package/src/components/StyleGuide/Forms.stories.mdx +27 -12
  230. package/src/components/StyleGuide/Iconography.stories.mdx +2 -12
  231. package/src/components/StyleGuide/Spacing.stories.mdx +80 -41
  232. package/src/components/StyleGuide/Typography.stories.mdx +30 -21
  233. package/src/components/Table/Table.stories.mdx +38 -11
  234. package/src/components/Table/Table.test.tsx +15 -0
  235. package/src/components/Table/Table.tsx +7 -7
  236. package/src/components/Table/__snapshots__/Table.test.tsx.snap +408 -5
  237. package/src/components/Tabs/Tabs.stories.mdx +52 -3
  238. package/src/components/Tabs/Tabs.test.tsx +16 -0
  239. package/src/components/Tabs/Tabs.tsx +10 -6
  240. package/src/components/Tabs/__snapshots__/Tabs.test.tsx.snap +394 -5
  241. package/src/components/Template/Template.stories.mdx +47 -43
  242. package/src/components/Template/Template.test.tsx +33 -0
  243. package/src/components/Template/Template.tsx +65 -60
  244. package/src/components/Template/__snapshots__/Template.test.tsx.snap +191 -20
  245. package/src/components/Text/Text.stories.mdx +20 -1
  246. package/src/components/Text/Text.test.tsx +12 -0
  247. package/src/components/Text/Text.tsx +6 -4
  248. package/src/components/Text/__snapshots__/Text.test.tsx.snap +21 -4
  249. package/src/components/TextInput/TextInput.stories.mdx +65 -19
  250. package/src/components/TextInput/TextInput.test.tsx +42 -28
  251. package/src/components/TextInput/TextInput.tsx +121 -113
  252. package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +96 -73
  253. package/src/components/Toggle/Toggle.stories.mdx +80 -22
  254. package/src/components/Toggle/Toggle.test.tsx +27 -9
  255. package/src/components/Toggle/Toggle.tsx +22 -18
  256. package/src/components/Toggle/__snapshots__/Toggle.test.tsx.snap +128 -5
  257. package/src/components/VideoPlayer/VideoPlayer.stories.mdx +52 -4
  258. package/src/components/VideoPlayer/VideoPlayer.test.tsx +23 -0
  259. package/src/components/VideoPlayer/VideoPlayer.tsx +133 -126
  260. package/src/components/VideoPlayer/__snapshots__/VideoPlayer.test.tsx.snap +81 -39
  261. package/src/docs/Chakra.stories.mdx +50 -9
  262. package/src/docs/Welcome.stories.mdx +160 -41
  263. package/src/hooks/useCarouselStyles.stories.mdx +22 -2
  264. package/src/hooks/useCarouselStyles.ts +3 -2
  265. package/src/hooks/useNYPLTheme.stories.mdx +101 -0
  266. package/src/hooks/useNYPLTheme.ts +30 -6
  267. package/src/hooks/useWindowSize.stories.mdx +23 -0
  268. package/src/index.ts +5 -2
  269. package/src/styles/base/_place-holder.scss +1 -1
  270. package/src/styles.scss +0 -1
  271. package/src/theme/components/button.ts +15 -7
  272. package/src/theme/components/card.ts +30 -19
  273. package/src/theme/components/checkbox.ts +10 -8
  274. package/src/theme/components/checkboxGroup.ts +1 -1
  275. package/src/theme/components/componentWrapper.ts +2 -2
  276. package/src/theme/components/customTable.ts +39 -31
  277. package/src/theme/components/fieldset.ts +1 -2
  278. package/src/theme/components/global.ts +25 -20
  279. package/src/theme/components/heading.ts +1 -1
  280. package/src/theme/components/helperErrorText.ts +1 -0
  281. package/src/theme/components/hero.ts +13 -15
  282. package/src/theme/components/label.ts +4 -3
  283. package/src/theme/components/list.ts +73 -66
  284. package/src/theme/components/notification.ts +2 -2
  285. package/src/theme/components/radio.ts +9 -9
  286. package/src/theme/components/radioGroup.ts +1 -1
  287. package/src/theme/components/select.ts +31 -22
  288. package/src/theme/components/skeletonLoader.ts +3 -3
  289. package/src/theme/components/slider.ts +8 -7
  290. package/src/theme/components/statusBadge.ts +2 -2
  291. package/src/theme/components/structuredContent.ts +66 -1
  292. package/src/theme/components/tabs.ts +2 -2
  293. package/src/theme/components/template.ts +9 -9
  294. package/src/theme/components/textInput.ts +13 -12
  295. package/src/theme/components/toggle.ts +17 -10
  296. package/src/theme/components/videoPlayer.ts +1 -1
  297. package/src/theme/foundations/colors.ts +1 -1
  298. package/src/theme/foundations/radii.ts +1 -0
  299. package/src/theme/foundations/spacing.ts +70 -22
  300. package/src/theme/foundations/typography.ts +2 -2
  301. package/src/utils/componentCategories.ts +1 -2
  302. package/dist/components/SearchBar/SearchBar.Test.d.ts +0 -1
  303. package/dist/helpers/generateUUID.d.ts +0 -1
  304. package/src/components/Modal/_Modal.scss +0 -18
  305. package/src/helpers/generateUUID.tsx +0 -5
@@ -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,5 +1,4 @@
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
4
  import { HeadingSizes, HeadingLevels } from "../Heading/HeadingTypes";
@@ -10,16 +9,7 @@ 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>
@@ -110,7 +105,9 @@ applied to any `Heading` element.
110
105
 
111
106
  ## Text Component
112
107
 
113
- 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.
114
111
 
115
112
  <Canvas>
116
113
  <DSProvider>
@@ -168,7 +165,9 @@ The `size` prop can be used to render a specific style from the DS default text
168
165
 
169
166
  ## Font Family
170
167
 
171
- 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:
172
171
 
173
172
  <Canvas>
174
173
  <DSProvider>
@@ -184,11 +183,15 @@ The following CSS variables are available through the DS.
184
183
  ```
185
184
 
186
185
  > **RECOMMENDATIONS**
187
- > 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
188
190
 
189
191
  ## Font Color
190
192
 
191
- 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.
192
195
 
193
196
  <Canvas>
194
197
  <DSProvider>
@@ -203,7 +206,10 @@ All text within a project, unless specifically noted in mockups, should be black
203
206
  </DSProvider>
204
207
  </Canvas>
205
208
 
206
- 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.
207
213
 
208
214
  ## Font Weight
209
215
 
@@ -347,7 +353,9 @@ The following font size design tokens are available through the DS.
347
353
 
348
354
  ## Text Case
349
355
 
350
- 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:
351
359
 
352
360
  <Canvas>
353
361
  <DSProvider>
@@ -378,7 +386,8 @@ In general, the New York Public Library uses Title Case for titles. This means o
378
386
  ### Summaries
379
387
 
380
388
  140 characters max<br />
381
- 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.
382
391
 
383
392
  <Canvas>
384
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
 
@@ -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 = {};
@@ -117,12 +117,12 @@ function Table(props: React.PropsWithChildren<TableProps>) {
117
117
  };
118
118
 
119
119
  return (
120
- <ChakraTable id={id} sx={styles} className={className}>
120
+ <ChakraTable id={id} sx={styles} className={className} {...rest}>
121
121
  {tableCaption}
122
122
  {columnHeadersElems}
123
123
  {tableBodyElems()}
124
124
  </ChakraTable>
125
125
  );
126
- }
126
+ });
127
127
 
128
128
  export default Table;