@nypl/design-system-react-components 0.25.0 → 0.25.4

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 (392) hide show
  1. package/CHANGELOG.md +142 -1
  2. package/README.md +98 -50
  3. package/dist/components/Accordion/Accordion.d.ts +14 -14
  4. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +15 -14
  5. package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +6 -0
  6. package/dist/components/Button/Button.d.ts +13 -8
  7. package/dist/components/Button/ButtonTypes.d.ts +3 -1
  8. package/dist/components/Card/Card.d.ts +36 -52
  9. package/dist/components/Card/CardTypes.d.ts +2 -17
  10. package/dist/components/Checkbox/Checkbox.d.ts +17 -13
  11. package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +45 -0
  12. package/dist/components/CheckboxGroup/CheckboxGroupLayoutTypes.d.ts +4 -0
  13. package/dist/components/ComponentWrapper/ComponentWrapper.d.ts +15 -0
  14. package/dist/components/DatePicker/DatePicker.d.ts +37 -35
  15. package/dist/components/Fieldset/Fieldset.d.ts +25 -0
  16. package/dist/components/Form/Form.d.ts +13 -8
  17. package/dist/components/Form/FormTypes.d.ts +2 -8
  18. package/dist/components/Grid/GridTypes.d.ts +9 -0
  19. package/dist/components/Grid/SimpleGrid.d.ts +14 -0
  20. package/dist/components/Heading/Heading.d.ts +4 -4
  21. package/dist/components/HelperErrorText/HelperErrorText.d.ts +17 -14
  22. package/dist/components/Hero/Hero.d.ts +19 -14
  23. package/dist/components/Hero/HeroTypes.d.ts +10 -5
  24. package/dist/components/HorizontalRule/HorizontalRule.d.ts +10 -9
  25. package/dist/components/Icons/Icon.d.ts +19 -14
  26. package/dist/components/Icons/IconSvgs.d.ts +11 -0
  27. package/dist/components/Icons/IconTypes.d.ts +89 -64
  28. package/dist/components/Image/Image.d.ts +19 -9
  29. package/dist/components/Image/ImageTypes.d.ts +20 -0
  30. package/dist/components/Label/Label.d.ts +5 -17
  31. package/dist/components/Link/Link.d.ts +12 -12
  32. package/dist/components/List/List.d.ts +19 -14
  33. package/dist/components/Notification/Notification.d.ts +37 -16
  34. package/dist/components/Pagination/Pagination.d.ts +16 -13
  35. package/dist/components/Pagination/Pagination.stories.d.ts +2 -0
  36. package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +29 -0
  37. package/dist/components/ProgressIndicator/ProgressIndicatorTypes.d.ts +8 -0
  38. package/dist/components/Radio/Radio.d.ts +2 -0
  39. package/dist/components/RadioGroup/RadioGroup.d.ts +4 -2
  40. package/dist/components/SearchBar/SearchBar.d.ts +45 -27
  41. package/dist/components/Select/Select.d.ts +34 -35
  42. package/dist/components/Select/SelectTypes.d.ts +4 -0
  43. package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +18 -14
  44. package/dist/components/SkeletonLoader/SkeletonLoaderTypes.d.ts +2 -2
  45. package/dist/components/Slider/Slider.d.ts +57 -0
  46. package/dist/components/StatusBadge/StatusBadge.d.ts +8 -6
  47. package/dist/components/StatusBadge/StatusBadgeTypes.d.ts +5 -0
  48. package/dist/components/StyleGuide/ColorCard.d.ts +12 -0
  49. package/dist/components/Tabs/Tabs.d.ts +1 -1
  50. package/dist/components/Template/Template.d.ts +91 -0
  51. package/dist/components/Text/Text.d.ts +16 -0
  52. package/dist/components/Text/TextTypes.d.ts +6 -0
  53. package/dist/components/TextInput/TextInput.d.ts +44 -31
  54. package/dist/components/TextInput/TextInputTypes.d.ts +5 -0
  55. package/dist/components/VideoPlayer/VideoPlayer.d.ts +6 -8
  56. package/dist/components/VideoPlayer/VideoPlayerTypes.d.ts +2 -2
  57. package/dist/design-system-react-components.cjs.development.js +6473 -2630
  58. package/dist/design-system-react-components.cjs.development.js.map +1 -1
  59. package/dist/design-system-react-components.cjs.production.min.js +1 -1
  60. package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
  61. package/dist/design-system-react-components.esm.js +6463 -2631
  62. package/dist/design-system-react-components.esm.js.map +1 -1
  63. package/dist/hooks/tests/useCarouselStyles.test.d.ts +1 -0
  64. package/dist/hooks/useCarouselStyles.d.ts +16 -0
  65. package/dist/hooks/useNYPLTheme.d.ts +54 -0
  66. package/dist/hooks/useWindowSize.d.ts +10 -0
  67. package/dist/index.d.ts +19 -7
  68. package/dist/resources.scss +180 -170
  69. package/dist/styles.css +1 -1
  70. package/dist/theme/components/accordion.d.ts +25 -0
  71. package/dist/theme/components/breadcrumb.d.ts +90 -0
  72. package/dist/theme/components/button.d.ts +39 -15
  73. package/dist/theme/components/card.d.ts +168 -0
  74. package/dist/theme/components/checkbox.d.ts +12 -8
  75. package/dist/theme/components/checkboxGroup.d.ts +12 -0
  76. package/dist/theme/components/componentWrapper.d.ts +11 -0
  77. package/dist/theme/components/datePicker.d.ts +16 -0
  78. package/dist/theme/components/fieldset.d.ts +27 -0
  79. package/dist/theme/components/global.d.ts +65 -0
  80. package/dist/theme/components/globalMixins.d.ts +23 -0
  81. package/dist/theme/components/heading.d.ts +55 -20
  82. package/dist/theme/components/helperErrorText.d.ts +10 -0
  83. package/dist/theme/components/hero.d.ts +493 -0
  84. package/dist/theme/components/horizontalRule.d.ts +14 -0
  85. package/dist/theme/components/icon.d.ts +13 -0
  86. package/dist/theme/components/image.d.ts +31 -0
  87. package/dist/theme/components/label.d.ts +18 -0
  88. package/dist/theme/components/link.d.ts +49 -0
  89. package/dist/theme/components/list.d.ts +89 -0
  90. package/dist/theme/components/notification.d.ts +75 -0
  91. package/dist/theme/components/pagination.d.ts +19 -0
  92. package/dist/theme/components/progressIndicator.d.ts +50 -0
  93. package/dist/theme/components/radio.d.ts +8 -7
  94. package/dist/theme/components/radioGroup.d.ts +12 -0
  95. package/dist/theme/components/searchBar.d.ts +20 -0
  96. package/dist/theme/components/select.d.ts +67 -0
  97. package/dist/theme/components/skeletonLoader.d.ts +98 -0
  98. package/dist/theme/components/slider.d.ts +51 -0
  99. package/dist/theme/components/statusBadge.d.ts +25 -0
  100. package/dist/theme/components/tabs.d.ts +63 -12
  101. package/dist/theme/components/template.d.ts +105 -0
  102. package/dist/theme/components/text.d.ts +20 -0
  103. package/dist/theme/components/textInput.d.ts +112 -0
  104. package/dist/theme/components/videoPlayer.d.ts +40 -0
  105. package/dist/theme/foundations/breakpoints.d.ts +8 -8
  106. package/dist/theme/foundations/global.d.ts +8 -0
  107. package/dist/theme/foundations/radii.d.ts +5 -0
  108. package/dist/theme/foundations/shadows.d.ts +4 -0
  109. package/dist/theme/foundations/spacing.d.ts +16 -16
  110. package/dist/utils/utils.d.ts +6 -0
  111. package/package.json +72 -82
  112. package/src/__tests__/setup.ts +2 -2
  113. package/src/components/Accordion/Accordion.stories.mdx +223 -34
  114. package/src/components/Accordion/Accordion.test.tsx +135 -19
  115. package/src/components/Accordion/Accordion.tsx +81 -56
  116. package/src/components/Autosuggest/Autosuggest.stories.mdx +4 -4
  117. package/src/components/Autosuggest/Autosuggest.stories.tsx +3 -2
  118. package/src/components/Autosuggest/_Autosuggest.scss +5 -5
  119. package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +48 -50
  120. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +54 -25
  121. package/src/components/Breadcrumbs/Breadcrumbs.tsx +75 -73
  122. package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +6 -0
  123. package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +298 -0
  124. package/src/components/Button/Button.stories.mdx +45 -36
  125. package/src/components/Button/Button.test.tsx +37 -11
  126. package/src/components/Button/Button.tsx +22 -34
  127. package/src/components/Button/ButtonTypes.tsx +2 -0
  128. package/src/components/Button/__snapshots__/Button.test.tsx.snap +50 -8
  129. package/src/components/Card/Card.stories.mdx +314 -273
  130. package/src/components/Card/Card.test.tsx +157 -91
  131. package/src/components/Card/Card.tsx +195 -145
  132. package/src/components/Card/CardTypes.tsx +2 -19
  133. package/src/components/Card/__snapshots__/Card.test.tsx.snap +410 -0
  134. package/src/components/CardEdition/CardEdition.stories.tsx +26 -53
  135. package/src/components/CardEdition/CardEdition.test.tsx +23 -31
  136. package/src/components/CardEdition/_CardEdition.scss +22 -23
  137. package/src/components/Chakra/Box.stories.mdx +15 -16
  138. package/src/components/Chakra/Center.stories.mdx +56 -24
  139. package/src/components/Chakra/Grid.stories.mdx +92 -0
  140. package/src/components/Chakra/Stack.stories.mdx +38 -21
  141. package/src/components/Checkbox/Checkbox.stories.mdx +33 -11
  142. package/src/components/Checkbox/Checkbox.test.tsx +47 -2
  143. package/src/components/Checkbox/Checkbox.tsx +44 -41
  144. package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +92 -7
  145. package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +329 -0
  146. package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +372 -0
  147. package/src/components/CheckboxGroup/CheckboxGroup.tsx +152 -0
  148. package/src/components/CheckboxGroup/CheckboxGroupLayoutTypes.tsx +4 -0
  149. package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +1326 -0
  150. package/src/components/ComponentWrapper/ComponentWrapper.tsx +63 -0
  151. package/src/components/DatePicker/DatePicker.stories.mdx +163 -62
  152. package/src/components/DatePicker/DatePicker.test.tsx +264 -64
  153. package/src/components/DatePicker/DatePicker.tsx +165 -134
  154. package/src/components/DatePicker/_DatePicker.scss +33 -66
  155. package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +818 -0
  156. package/src/components/Fieldset/Fieldset.stories.mdx +55 -0
  157. package/src/components/Fieldset/Fieldset.test.tsx +125 -0
  158. package/src/components/Fieldset/Fieldset.tsx +52 -0
  159. package/src/components/Fieldset/__snapshots__/Fieldset.test.tsx.snap +68 -0
  160. package/src/components/Form/Form.stories.mdx +70 -27
  161. package/src/components/Form/Form.test.tsx +58 -45
  162. package/src/components/Form/Form.tsx +50 -21
  163. package/src/components/Form/FormTypes.tsx +3 -8
  164. package/src/components/Form/__snapshots__/Form.test.tsx.snap +24 -14
  165. package/src/components/Grid/GridTypes.tsx +9 -0
  166. package/src/components/Grid/SimpleGrid.stories.mdx +268 -0
  167. package/src/components/Grid/SimpleGrid.test.tsx +66 -0
  168. package/src/components/Grid/SimpleGrid.tsx +37 -0
  169. package/src/components/Grid/__snapshots__/SimpleGrid.test.tsx.snap +8 -0
  170. package/src/components/Heading/Heading.stories.mdx +3 -3
  171. package/src/components/Heading/Heading.tsx +12 -6
  172. package/src/components/HelperErrorText/HelperErrorText.stories.mdx +124 -0
  173. package/src/components/HelperErrorText/HelperErrorText.test.tsx +39 -44
  174. package/src/components/HelperErrorText/HelperErrorText.tsx +37 -39
  175. package/src/components/HelperErrorText/__snapshots__/HelperErrorText.test.tsx.snap +25 -0
  176. package/src/components/Hero/Hero.stories.mdx +198 -121
  177. package/src/components/Hero/Hero.test.tsx +537 -107
  178. package/src/components/Hero/Hero.tsx +79 -92
  179. package/src/components/Hero/HeroTypes.tsx +18 -5
  180. package/src/components/Hero/__snapshots__/Hero.test.tsx.snap +307 -0
  181. package/src/components/HorizontalRule/HorizontalRule.stories.mdx +8 -6
  182. package/src/components/HorizontalRule/HorizontalRule.test.tsx +33 -28
  183. package/src/components/HorizontalRule/HorizontalRule.tsx +27 -29
  184. package/src/components/HorizontalRule/__snapshots__/HorizontalRule.test.tsx.snap +27 -9
  185. package/src/components/Icons/Icon.stories.mdx +94 -77
  186. package/src/components/Icons/Icon.test.tsx +48 -22
  187. package/src/components/Icons/Icon.tsx +78 -61
  188. package/src/components/Icons/IconSvgs.tsx +22 -0
  189. package/src/components/Icons/IconTypes.tsx +91 -64
  190. package/src/components/Image/Image.stories.mdx +220 -0
  191. package/src/components/Image/Image.test.tsx +131 -29
  192. package/src/components/Image/Image.tsx +84 -56
  193. package/src/components/Image/ImageTypes.ts +22 -0
  194. package/src/components/Image/__snapshots__/Image.test.tsx.snap +190 -0
  195. package/src/components/Input/Input.stories.tsx +23 -67
  196. package/src/components/Input/Input.test.tsx +4 -4
  197. package/src/components/Input/_Input.scss +23 -14
  198. package/src/components/Label/Label.stories.mdx +28 -7
  199. package/src/components/Label/Label.test.tsx +43 -12
  200. package/src/components/Label/Label.tsx +21 -34
  201. package/src/components/Label/__snapshots__/Label.test.tsx.snap +41 -0
  202. package/src/components/Link/Link.stories.mdx +41 -41
  203. package/src/components/Link/Link.test.tsx +33 -44
  204. package/src/components/Link/Link.tsx +117 -100
  205. package/src/components/List/List.stories.mdx +124 -51
  206. package/src/components/List/List.test.tsx +142 -63
  207. package/src/components/List/List.tsx +89 -93
  208. package/src/components/List/__snapshots__/List.test.tsx.snap +109 -0
  209. package/src/components/Modal/Modal.stories.mdx +3 -3
  210. package/src/components/Modal/_Modal.scss +2 -2
  211. package/src/components/Notification/Notification.stories.mdx +119 -111
  212. package/src/components/Notification/Notification.test.tsx +102 -126
  213. package/src/components/Notification/Notification.tsx +157 -161
  214. package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +159 -8
  215. package/src/components/Pagination/Pagination.stories.mdx +26 -27
  216. package/src/components/Pagination/Pagination.stories.tsx +11 -16
  217. package/src/components/Pagination/Pagination.test.tsx +276 -140
  218. package/src/components/Pagination/Pagination.tsx +174 -154
  219. package/src/components/Pagination/__snapshots__/Pagination.test.tsx.snap +285 -0
  220. package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +292 -0
  221. package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +225 -0
  222. package/src/components/ProgressIndicator/ProgressIndicator.tsx +126 -0
  223. package/src/components/ProgressIndicator/ProgressIndicatorTypes.ts +8 -0
  224. package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +357 -0
  225. package/src/components/Radio/Radio.test.tsx +20 -4
  226. package/src/components/Radio/Radio.tsx +6 -3
  227. package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +3 -0
  228. package/src/components/RadioGroup/RadioGroup.stories.mdx +4 -5
  229. package/src/components/RadioGroup/RadioGroup.test.tsx +24 -1
  230. package/src/components/RadioGroup/RadioGroup.tsx +21 -29
  231. package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +42 -72
  232. package/src/components/SearchBar/SearchBar.Test.tsx +170 -16
  233. package/src/components/SearchBar/SearchBar.stories.mdx +294 -219
  234. package/src/components/SearchBar/SearchBar.tsx +161 -46
  235. package/src/components/Select/Select.stories.mdx +188 -170
  236. package/src/components/Select/Select.test.tsx +132 -375
  237. package/src/components/Select/Select.tsx +121 -165
  238. package/src/components/Select/SelectTypes.tsx +5 -0
  239. package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +33 -76
  240. package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +97 -177
  241. package/src/components/SkeletonLoader/SkeletonLoader.tsx +75 -70
  242. package/src/components/SkeletonLoader/SkeletonLoaderTypes.tsx +2 -2
  243. package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +739 -0
  244. package/src/components/Slider/Slider.stories.mdx +529 -0
  245. package/src/components/Slider/Slider.test.tsx +653 -0
  246. package/src/components/Slider/Slider.tsx +303 -0
  247. package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +1946 -0
  248. package/src/components/StatusBadge/StatusBadge.stories.mdx +91 -0
  249. package/src/components/StatusBadge/StatusBadge.test.tsx +35 -7
  250. package/src/components/StatusBadge/StatusBadge.tsx +24 -25
  251. package/src/components/StatusBadge/StatusBadgeTypes.tsx +5 -0
  252. package/src/components/StatusBadge/__snapshots__/StatusBadge.test.tsx.snap +28 -0
  253. package/src/components/StyleGuide/Bidirectionality.stories.mdx +17 -17
  254. package/src/components/StyleGuide/Breakpoints.stories.mdx +34 -10
  255. package/src/components/StyleGuide/Buttons.stories.mdx +102 -86
  256. package/src/components/StyleGuide/ColorCard.tsx +46 -0
  257. package/src/components/StyleGuide/Colors.stories.mdx +196 -0
  258. package/src/components/StyleGuide/DesignTokens.stories.mdx +170 -0
  259. package/src/components/StyleGuide/Forms.stories.mdx +9 -7
  260. package/src/components/StyleGuide/Iconography.stories.mdx +119 -127
  261. package/src/components/StyleGuide/Spacing.stories.mdx +31 -23
  262. package/src/components/StyleGuide/Typography.stories.mdx +202 -189
  263. package/src/components/StyleGuide/UIDocCard.tsx +1 -1
  264. package/src/components/Tabs/Tabs.stories.mdx +73 -11
  265. package/src/components/Tabs/Tabs.tsx +88 -67
  266. package/src/components/Template/Template.stories.mdx +572 -0
  267. package/src/components/Template/Template.test.tsx +124 -0
  268. package/src/components/Template/Template.tsx +226 -0
  269. package/src/components/Text/Text.stories.mdx +70 -0
  270. package/src/components/Text/Text.test.tsx +63 -0
  271. package/src/components/Text/Text.tsx +55 -0
  272. package/src/components/Text/TextTypes.tsx +6 -0
  273. package/src/components/Text/__snapshots__/Text.test.tsx.snap +33 -0
  274. package/src/components/TextInput/TextInput.stories.mdx +89 -90
  275. package/src/components/TextInput/TextInput.test.tsx +84 -85
  276. package/src/components/TextInput/TextInput.tsx +121 -95
  277. package/src/components/TextInput/TextInputTypes.tsx +8 -0
  278. package/src/components/VideoPlayer/VideoPlayer.stories.mdx +17 -4
  279. package/src/components/VideoPlayer/VideoPlayer.test.tsx +54 -53
  280. package/src/components/VideoPlayer/VideoPlayer.tsx +50 -51
  281. package/src/components/VideoPlayer/VideoPlayerTypes.tsx +2 -2
  282. package/src/components/VideoPlayer/__snapshots__/VideoPlayer.test.tsx.snap +91 -0
  283. package/src/docs/Chakra.stories.mdx +246 -65
  284. package/src/docs/Intro.stories.mdx +18 -13
  285. package/src/hooks/tests/useCarouselStyles.test.ts +140 -0
  286. package/src/hooks/tests/useNYPLTheme.test.tsx +36 -0
  287. package/src/hooks/useCarouselStyles.ts +34 -0
  288. package/src/hooks/useNYPLTheme.ts +67 -0
  289. package/src/hooks/useWindowSize.ts +40 -0
  290. package/src/index.ts +39 -16
  291. package/src/resources.scss +5 -5
  292. package/src/styles/base/{_02-breakpoints.scss → _01-breakpoints.scss} +9 -10
  293. package/src/styles/base/{_03-mixins.scss → _02-mixins.scss} +16 -5
  294. package/src/styles/base/_03-base.scss +25 -0
  295. package/src/styles/base/{_05-focus.scss → _04-focus.scss} +0 -15
  296. package/src/styles/base/_place-holder.scss +14 -3
  297. package/src/styles/{03-space → space}/_space-inline.scss +14 -14
  298. package/src/styles/{03-space → space}/_space-inset.scss +10 -10
  299. package/src/styles/space/_space-stack.scss +116 -0
  300. package/src/styles.scss +13 -62
  301. package/src/theme/components/accordion.ts +30 -0
  302. package/src/theme/components/breadcrumb.ts +77 -0
  303. package/src/theme/components/button.ts +91 -71
  304. package/src/theme/components/card.ts +174 -0
  305. package/src/theme/components/checkbox.ts +22 -29
  306. package/src/theme/components/checkboxGroup.ts +8 -0
  307. package/src/theme/components/componentWrapper.ts +10 -0
  308. package/src/theme/components/datePicker.ts +17 -0
  309. package/src/theme/components/fieldset.ts +18 -0
  310. package/src/theme/components/global.ts +82 -0
  311. package/src/theme/components/globalMixins.ts +24 -0
  312. package/src/theme/components/heading.ts +25 -13
  313. package/src/theme/components/helperErrorText.ts +9 -0
  314. package/src/theme/components/hero.ts +240 -0
  315. package/src/theme/components/horizontalRule.ts +13 -0
  316. package/src/theme/components/icon.ts +79 -0
  317. package/src/theme/components/image.ts +116 -0
  318. package/src/theme/components/label.ts +10 -0
  319. package/src/theme/components/link.ts +51 -0
  320. package/src/theme/components/list.ts +73 -0
  321. package/src/theme/components/notification.ts +93 -0
  322. package/src/theme/components/pagination.ts +20 -0
  323. package/src/theme/components/progressIndicator.ts +62 -0
  324. package/src/theme/components/radio.ts +22 -33
  325. package/src/theme/components/radioGroup.ts +8 -0
  326. package/src/theme/components/searchBar.ts +21 -0
  327. package/src/theme/components/select.ts +53 -0
  328. package/src/theme/components/skeletonLoader.ts +107 -0
  329. package/src/theme/components/slider.ts +79 -0
  330. package/src/theme/components/statusBadge.ts +26 -0
  331. package/src/theme/components/tabs.ts +102 -69
  332. package/src/theme/components/template.ts +114 -0
  333. package/src/theme/components/text.ts +31 -0
  334. package/src/theme/components/textInput.ts +62 -0
  335. package/src/theme/components/videoPlayer.ts +49 -0
  336. package/src/theme/foundations/breakpoints.ts +8 -8
  337. package/src/theme/foundations/colors.ts +29 -13
  338. package/src/theme/foundations/global.ts +8 -0
  339. package/src/theme/foundations/radii.ts +6 -0
  340. package/src/theme/foundations/shadows.ts +5 -0
  341. package/src/theme/foundations/spacing.ts +24 -24
  342. package/src/theme/index.ts +74 -13
  343. package/src/utils/componentCategories.ts +12 -5
  344. package/src/utils/utils.ts +13 -0
  345. package/dist/components/Accordion/Accordion.stories.d.ts +0 -6
  346. package/dist/components/HelperErrorText/HelperErrorText.stories.d.ts +0 -16
  347. package/dist/components/Image/Image.stories.d.ts +0 -18
  348. package/dist/components/List/List.stories.d.ts +0 -7
  349. package/dist/components/StatusBadge/StatusBadge.stories.d.ts +0 -8
  350. package/dist/components/StyleGuide/Colors.stories.d.ts +0 -25
  351. package/dist/components/Template/Template.stories.d.ts +0 -30
  352. package/dist/theme/components/customRadioGroup.d.ts +0 -17
  353. package/src/components/Accordion/Accordion.stories.tsx +0 -66
  354. package/src/components/Accordion/_Accordion.scss +0 -81
  355. package/src/components/Breadcrumbs/_Breadcrumbs.scss +0 -97
  356. package/src/components/Button/_Button.scss +0 -56
  357. package/src/components/Card/_Card.scss +0 -308
  358. package/src/components/Form/_Form.scss +0 -67
  359. package/src/components/HelperErrorText/HelperErrorText.stories.tsx +0 -48
  360. package/src/components/HelperErrorText/_HelperErrorText.scss +0 -9
  361. package/src/components/Hero/_Hero.scss +0 -256
  362. package/src/components/HorizontalRule/_HorizontalRule.scss +0 -15
  363. package/src/components/Icons/_Icons.scss +0 -116
  364. package/src/components/Image/Image.stories.tsx +0 -54
  365. package/src/components/Image/_Image.scss +0 -38
  366. package/src/components/Label/_Label.scss +0 -22
  367. package/src/components/Link/_Link.scss +0 -73
  368. package/src/components/List/List.stories.tsx +0 -139
  369. package/src/components/List/_List.scss +0 -76
  370. package/src/components/Notification/_Notification.scss +0 -110
  371. package/src/components/Pagination/_Pagination.scss +0 -40
  372. package/src/components/SearchBar/_SearchBar.scss +0 -16
  373. package/src/components/Select/_Select.scss +0 -82
  374. package/src/components/SkeletonLoader/_SkeletonLoader.scss +0 -142
  375. package/src/components/StatusBadge/StatusBadge.stories.tsx +0 -34
  376. package/src/components/StatusBadge/_StatusBadge.scss +0 -23
  377. package/src/components/StyleGuide/Colors.stories.tsx +0 -289
  378. package/src/components/Template/Template.stories.tsx +0 -86
  379. package/src/components/Template/_Template.scss +0 -63
  380. package/src/components/TextInput/_TextInput.scss +0 -59
  381. package/src/components/VideoPlayer/_VideoPlayer.scss +0 -38
  382. package/src/styles/01-colors/_colors-brand.scss +0 -56
  383. package/src/styles/01-colors/_colors-utility.scss +0 -65
  384. package/src/styles/02-typography/_type-scale.css +0 -11
  385. package/src/styles/02-typography/_type-weight.css +0 -7
  386. package/src/styles/02-typography/_typefaces.css +0 -4
  387. package/src/styles/03-space/_space-stack.scss +0 -116
  388. package/src/styles/03-space/_space.css +0 -30
  389. package/src/styles/base/_04-base.scss +0 -19
  390. package/src/styles/base/_card-grid.scss +0 -78
  391. package/src/styles/base/_typography.scss +0 -11
  392. package/src/theme/components/customRadioGroup.ts +0 -18
package/CHANGELOG.md CHANGED
@@ -8,7 +8,148 @@ Currently, this repo is in Prerelease. When it is released, this project will ad
8
8
 
9
9
  ## Prerelease
10
10
 
11
- ## 0.25.0
11
+ ## 0.25.4 (December 9, 2021)
12
+
13
+ ### Adds
14
+
15
+ - Adds the `ProgressIndicator` component.
16
+ - Adds documentation for using `NYPL Design Tokens`.
17
+ - Adds the `ActionHelpDefault`, `ActionHelpOutline` and `ActionLaunch` icons to the `Icon` component.
18
+ - Adds the DS `Slider` component based on the Chakra `Slider` and `RangeSlider` components.
19
+ - Adds the `ButtonTypes.NoBrand` variant to the `Button` component.
20
+ - Adds the `additionalStyles` prop to the `Breadcrumbs` component.
21
+
22
+ ### Changes
23
+
24
+ - Updates the organization of SCSS files by deleting some files and combining others.
25
+ - Updates `@chakra-ui/react` to version 1.7.1 and `@chakra-ui/system` to version 1.8.1.
26
+ - Updates the `TextInput` component to now have `defaultValue` and `step` props.
27
+ - Updates `Latest Version` number for `Image`, `Notification` and `Pagination` components.
28
+ - Removes the Storybook "Knobs" addon.
29
+ - Updates the margin for labels in the `DatePicker` component when it is in the "date range" state.
30
+ - Updates the `DatePicker` component to have proper form spacing when in the "date range" state.
31
+ - Updates the `Tabs` component to comply with linting rules -- no functional or visual changes were made.
32
+ - Removes the `alignText` prop from the `Notification` component. Storybook was incorrectly displaying `alignText` as an available prop.
33
+
34
+ ### Fixes
35
+
36
+ - Exports components and variables that were initially missed when they were added: `ColorVariants`, `Fieldset`, `IconAlign`, `StatusBadgeTypes`,
37
+ - Fixes `SearchBar` by passing necessary props down to its `TextInput` through the `textInputProps` prop.
38
+ - Fixes `DatePicker` component unit tests.
39
+ - Removes the `showLabel` prop from the `SearchBar` component to prevent confusion. Labels for the `Select` and `TextInput` components are never shown but are added through the `aria-label` attribute.
40
+
41
+ ### Breaking Changes
42
+
43
+ - Updates the breakpoint CSS variable names by adding the `--nypl` prefix and the SCSS variables by adding the `$nypl` prefix. Updates references throughout the codebase.
44
+ - Changes the `Button`'s `disabled` prop to `isDisabled`.
45
+ - Updates npm packages in `package.json`. Removes `cpy-cli`, `react-uid`, `react-is`, `stylelint` and related packages, and `ts-loader` (already added through TSDX). Updates other packages such as `sass-loader`, `prettier`, `jest`, `jest-axe`, and the majority of Storybook addon packages.
46
+
47
+ ### Deprecates
48
+
49
+ - Deprecates the `Input` component. The `Input` component will be removed from the NYPL Design System React Library in the first release of January 2022.
50
+ - Deprecates the `CardEdition` component. The `CardEdition` component will be removed from the NYPL Design System React Library in the first release of January 2022.
51
+
52
+ ## 0.25.3 (November 18, 2021)
53
+
54
+ ### Adds
55
+
56
+ - Adds the `ImageRatios`, `ImageSizes`, and `ImageTypes` enums.
57
+ - Composes the DS `Fieldset` component with Chakra. This always renders a `legend` element as its first child but it can be optionally hidden from the screen.
58
+ - Adds the ability to make an entire `Card` component clickable with Chakra's `LinkBox` and `LinkOverlay` components. Links in the `CardActions` component can still be accessed in this state by clicking with the mouse or tabbing and pressing "enter".
59
+ - Adds new file type SVG files to use in the `Icon` component: Audio, Doc, GenericDoc, Image, PDF, Spreadsheet, Video.
60
+ - Adds `ActionCheckCircle` SVG file to use in the `Icon` component.
61
+
62
+ ### Changes
63
+
64
+ - Updates the Github Action for the changelog reminder.
65
+ - Updates the `Checkbox` component with an "indeterminate" state through the `isIndeterminate` prop.
66
+ - Updates the `CheckboxGroup` component story with an "indeterminate" state example.
67
+ - Updates the `CheckboxGroup` and `RadioGroup` components to use the `Fieldset` component.
68
+ - Updates the `HelperErrorText` and `TextInput` components with added `additionalStyles` prop.
69
+ - Updates the `Button` Style Guide documentation.
70
+ - Updates the `Iconography` Style Guide story documentation.
71
+ - Updates the `Button` font weight to "regular".
72
+
73
+ ### Fixes
74
+
75
+ - Fixes nondeterministic unit test in the `DatePicker` component.
76
+ - Version of latest `List` component release in its storybook page.
77
+ - Adds validation to the `height` prop in the `HorizontalRule` so percentage values are not used. If a percentage value is used, the default "2px" value is set.
78
+ - Fixes styling issues for the `Notification` dismissible button.
79
+ - Fixes `SearchBar` mobile styling for the `Select`, `TextInput`, and `Button` components.
80
+ - Fixes `SearchBar` focus flicker when the `Select` component is selected.
81
+
82
+ ### Breaking Changes
83
+
84
+ - Updates the `Notification` component to fix the custom icon alignment.
85
+ - Adds the `title` prop to the `Icon` component to render a `title` HTML element for accessible SVG icons.
86
+ - Updates the default font size of the `Button` component to `"-1"` (14px) for all variants except the `Link` variant. Removes the `bem` function from internal use and makes it clearer that the `ButtonGroup` Chakra component is exported in the Design System.
87
+ - Updates the `errorText` prop to `invalidText` for the `Checkbox` component.
88
+ - Composes the DS `Pagination` component with Chakra. Removes the BEM-related props and updates the `currentPage` prop to `initialPage`. The current selected page is now kept in state inside the `Pagination` component and returned to the user through `getPageHref` or `onPageChange`. This also adds better aria attributes to the list inside the `Pagination` component.
89
+ - Composes the DS `Image` component with Chakra styling and updates all `Image` references in other DS components. The `attributes` prop and the BEM related props `blockname` and `modifiers` have been removed. Adds the following new props: `additionalStyles`, `component`, `imageAspectRatio`, `imageSize`, `imageType`.
90
+ - Composes the DS `Card` component with Chakra. BEM related props `modifiers` and `blockname` have been removed. Replaces the `CardImageRatios` with `ImageRatios`. Removes the `CardImageSizes` enum.
91
+ - Composes the DS `DatePicker` component with Chakra. Adds more tests, documentation, and examples. This component now uses the `Fieldset` component for the date range type, and better `Form` components for layout. Prop name changes: `dateRange` is now `isDateRange` and `required` is now `isRequired`. BEM related props `modifiers` and `blockname` have been removed. The "Required"/"Optional" text in the date range legend can now be hidden with the `showOptReqLabel` prop.
92
+ - Composes the DS `SkeletonLoader` with Chakra's `Skeleton` component. BEM related prop `modifiers` has been removed. Chakra's default `Skeleton` styles have been updated with NYPL's theme.
93
+ - Removes deprecated CSS variables. Now the DS repo only uses the CSS variables exposed by Chakra that contain the `--nypl` prefix.
94
+
95
+ ## 0.25.2 (October 28, 2021)
96
+
97
+ ### Adds
98
+
99
+ - Adds custom `useCarouselStyles` hook for the `Tabs` mobile carousel functionality.
100
+ - Adds custom NYPL-theme radii values to use within Chakra, mostly for border radius values.
101
+ - Adds the `showHelperInvalidText` prop to form components to control displaying or hiding the content in the `HelperErrorText` component.
102
+ - Adds `useNYPLTheme` hook for consuming applications to use NYPL DS values.
103
+ - Adds the DS `ComponentWrapper` helper component for internal use.
104
+ - Adds `useWindowSize` hook for responsive styles and functionality.
105
+ - Adds Chakra Migration Guide for version `0.25.0` and greater.
106
+
107
+ ### Changes
108
+
109
+ - Updates the CSS vars name prefix to use `nypl`.
110
+ - Updates documentation in the README and updates the issue contribution template.
111
+ - Updates the following components to use the `showHelperInvalidText` prop: `Checkbox`, `CheckboxGroup`, `DatePicker`, `Radio`, `RadioGroup`, `SearchBar`, `Select`, `TextInput`, `VideoPlayer`.
112
+
113
+ ### Breaking Changes
114
+
115
+ - Composes the DS `Notification` component with Chakra components. Removes the `NotificationHeading` and `NotificationContent` components as exports and are only used internally in `Notification`. Instead of children component, `Notification` accepts the heading and content values through the `notificationHeading` and `notificationContent` props, respectively.
116
+ - Composes the DS `HelperErrorText` component with Chakra. BEM related props `modifiers` and `blockname` have been removed. The `isError` prop has been renamed to `isInvalid`.
117
+ - Composes the DS `VideoPlayer` component with Chakra. BEM related prop `modifiers` has been removed.
118
+ - Composes the DS `HorizontalRule` component with Chakra. BEM related prop `modifiers` has been removed, as well as the `attributes` prop.
119
+ - Composes the DS `List` component with Chakra. BEM related props `modifiers` and `blockname` have been removed. The `noStyling` prop is now used for the no list style variant style.
120
+
121
+ ## 0.25.1 (October 14, 2021)
122
+
123
+ ### Adds
124
+
125
+ - Updates the `Accordion` component to internally use Chakra components.
126
+ - Adds DS `SimpleGrid` component composed from Chakra's `Simplegrid` component.
127
+ - Adds DS `Text` component composed from Chakra's `Text` component.
128
+ - Update the NYPL Colors with updated color names and values.
129
+ - Composes the DS `TextInput` component from Chakra's `Input` and `Textarea` components.
130
+ - Composes the DS `Select` component from Chakra's `Select` component.
131
+ - Composes the DS `Hero` component from Chakra's component.
132
+ - Composes the DS `CheckboxGroup` component from Chakra's `CheckboxGroup` component.
133
+ - Composes the DS "Template" components (`Template`, `TemplateHeader`, `TemplateBreakout`, `TemplateContent`, `TemplateContentPrimary`, `TemplateContentSidebar`, `TemplateFooter`) from Chakra's `Box` component for page layouts through children components.
134
+ - Composes the DS `TemplateAppContainer` component from Chakra's `Box` component for page layouts through props.
135
+ - Composes the DS `Link` component with Chakra component and fixes the `Button` type.
136
+ - Exports Chakra's `Grid` and `GridItem` components.
137
+ - Composes the DS `Label` component with Chakra component and updates the font size.
138
+ - Composes the DS `StatusBadge` component from Chakra's component.
139
+ - Composes the DS `Forms` component using DS and Chakra components.
140
+ - Composes the DS `Icon` component with Chakra's `Icon` component. Added new props for `Icon` sizing, alignment, name, and rotation.
141
+ - Composes the DS `SearchBar` component from DS `Select`, `TextInput`, `Button`, and `HelperErrorText` components.
142
+ - Composes the DS `Breadcrumbs` component from Chakra's `Breadcumb`, `BreadcrumbItem` and `BreadcrumbLink` components.
143
+
144
+ ### Changes
145
+
146
+ - Updates spacing values to use NYPL spacing rather than "em"s.
147
+ - Updates the `SkeletonLoaderLayouts` enum values from `Horizontal` and `Vertical` to `Row` and `Column`, respectively.
148
+ - Updates the `CardLayouts` enum values from `Horizontal` and `Vertical` to `Row` and `Column`, respectively.
149
+ - Updates font size of the `legend` element used in `CheckboxGroup`, `DatePicker` and `RadioGroup`.
150
+ - Updates the radius values through Chakra's theme object.
151
+
152
+ ## 0.25.0 (September 30, 2021)
12
153
 
13
154
  ### Breaking Changes
14
155
 
package/README.md CHANGED
@@ -6,6 +6,8 @@
6
6
 
7
7
  The NYPL Design System (DS) is NYPL’s open-source extensible React library for products and experiences with the accessibility as its foundation. It ships functional, stateless components with consistent NYPL styling. You can learn more about the project and its goals [on the project's wiki](https://github.com/NYPL/nypl-design-system/wiki).
8
8
 
9
+ _Note: This library is still in beta. Until we release the stable `1.0.0` version, we are loosely using semantic versioning._
10
+
9
11
  Storybook documentation
10
12
 
11
13
  - [Production - deployed to Github Pages](https://nypl.github.io/nypl-design-system/storybook-static/?path=/story/introduction--page)
@@ -17,11 +19,11 @@ Storybook documentation
17
19
  | 2. | [Developing with NPM Link](#developing-with-npm-link) |
18
20
  | 3. | [Using the Design System in Your Product](#using-the-design-system-in-your-product) |
19
21
  | 4. | [Using Chakra UI Components](#using-chakra-ui-components) |
20
- | 5. | [CDN](#cdn) |
21
- | 6. | [Accessibility Product Requirements](#accessibility-product-requirements) |
22
- | 7. | [Storybook](#storybook) |
23
- | 8. | [Typescript Usage](#typescript-usage) |
24
- | 9. | [Unit Testing](#unit-testing) |
22
+ | 5. | [Storybook](#storybook) |
23
+ | 6. | [Typescript Usage](#typescript-usage) |
24
+ | 7. | [Unit Testing](#unit-testing) |
25
+ | 8. | [Accessibility](#accessibility) |
26
+ | 9. | [CDN](#cdn) |
25
27
 
26
28
  ## Contributing Quickstart
27
29
 
@@ -51,6 +53,12 @@ Information about active maintainers, how we run reviews, and more can be found
51
53
 
52
54
  Follow the [contribution document](/.github/CONTRIBUTING.md) to follow git branching convetions, component creation and update guidelines, testing methodoly, and documentation guidelines.
53
55
 
56
+ ### Node Version
57
+
58
+ We recommend using Node version 12.22.x since the DS has some issues with versions higher than 12.x. The Github Actions for linting, automated testing, deploying to Github Pages, and releasing to npm are all running on Node 12.x.
59
+
60
+ If you are using `nvm`, the local `.nvmrc` file can be use to set your local Node version with the `nvm use` command (will be set to `12.22.x`).
61
+
54
62
  ## Developing with NPM Link
55
63
 
56
64
  To develop with a local version of the Design System:
@@ -108,32 +116,7 @@ $ npm install @nypl/design-system-react-components
108
116
  @import "~@nypl/design-system-react-components/dist/styles.css";
109
117
  ```
110
118
 
111
- 3. Consult Storybook for the list of available components and props that they require.
112
-
113
- Here's an example with the `Link` component:
114
-
115
- ```jsx
116
- import { Link } from "@nypl/design-system-react-components";
117
-
118
- function NewComponent(props) {
119
- return <Link href="https://www.hathitrust.org/">HathiTrust</Link>;
120
- }
121
- ```
122
-
123
- Sometimes you may have conflicts, perhaps with `React-Router`. In that case, you can alias your imports:
124
-
125
- ```jsx
126
- import * as DS from "@nypl/design-system-react-components";
127
- import { Link } from "react-router";
128
-
129
- function NewComponent(props) {
130
- return (
131
- <DS.Link>
132
- <Link to="/license">public domain</Link>
133
- </DS.Link>
134
- );
135
- }
136
- ```
119
+ 3. Add the `nypl-ds` CSS class
137
120
 
138
121
  Some CSS rules in the Design System, such as the universal focus styling and the box-model, are namespaced to the `.nypl-ds` class. To include those in your app, add `.nypl-ds` to whichever wrapper tag makes sense in your application (e.g., `<div class="app">` or `<div class="container">`).
139
122
 
@@ -145,7 +128,7 @@ Some CSS rules in the Design System, such as the universal focus styling and the
145
128
 
146
129
  4. Import the `DSProvider` component
147
130
 
148
- While the Chakra UI integration into the DS is a work-in-progress, there is one necessary step consuming applications need to take for component styles to properly render. In order render styles properly, consuming applications need to wrap all the DS components with a simple provider component. Fortunately, this only needs to be done once at the top level of the consuming application.
131
+ In order to use DS components in a consuming application, there is a necessary step that must be done for component styles to properly render. Consuming applications need to wrap all the DS components with a simple provider component. Fortunately, this only needs to be done once at the top level of the consuming application.
149
132
 
150
133
  Once the following is completed, DS components that internally use Chakra UI will render styles properly.
151
134
 
@@ -167,9 +150,38 @@ const ApplicationContainer = (props) => {
167
150
  };
168
151
  ```
169
152
 
153
+ 5. Use DS components!
154
+
155
+ Consult Storybook for the list of available components and props that they require.
156
+
157
+ Here's an example with the `Link` component:
158
+
159
+ ```jsx
160
+ import { Link } from "@nypl/design-system-react-components";
161
+
162
+ function NewComponent(props) {
163
+ return <Link href="https://www.hathitrust.org/">HathiTrust</Link>;
164
+ }
165
+ ```
166
+
167
+ Sometimes you may have conflicts, perhaps with `React-Router`. In that case, you can alias your imports:
168
+
169
+ ```jsx
170
+ import * as DS from "@nypl/design-system-react-components";
171
+ import { Link } from "react-router";
172
+
173
+ function NewComponent(props) {
174
+ return (
175
+ <DS.Link>
176
+ <Link to="/license">public domain</Link>
177
+ </DS.Link>
178
+ );
179
+ }
180
+ ```
181
+
170
182
  ### NYPL DS, NYPL Header, and NYPL Footer
171
183
 
172
- Please note that the NYPL Header and Footer should be _outside_ of the `.nypl-ds` wrapper class.
184
+ Please note that, if used, the NYPL Header and Footer components should be _outside_ of the `.nypl-ds` wrapper class.
173
185
 
174
186
  ```jsx
175
187
  <body>
@@ -185,13 +197,18 @@ Please note that the NYPL Header and Footer should be _outside_ of the `.nypl-ds
185
197
 
186
198
  ## Using Chakra UI Components
187
199
 
188
- The Chakra UI component library is integrated into the NYPL Design System and is currently a work-in-progress. We
189
- are in the middle of the process of using Chakra components and patterns to build DS components, and therefore documentation and features are expected to change. While the implementation details of DS components will use Chakra, the DS package itself will export _some_ Chakra components.
200
+ The Chakra UI component library has been integrated into the NYPL Design System. We are still progressing towards using Chakra components and patterns to build DS components, and therefore documentation and features are expected to change. While the implementation details of DS components will use Chakra, the DS package itself will export _some_ Chakra components.
201
+
202
+ The list of re-exported Chakra components can be found in the main [index.ts](/src/index.ts) file. They include:
203
+
204
+ - `Box`, `Center`, `Circle`, `Grid`, `GridItem`, `HStack`, `Square`, `Stack`, `VStack`
205
+
206
+ Find more information about the Design System's internal use of Chakra to create and refactor components in the Storybook documentation page. The following two links have the same information but in different formats for your reading preference:
190
207
 
191
- The list of re-exported Chakra components can be found in the main
192
- [index.ts](/index.ts) file.
208
+ - [MDX format](/src/docs/Chakra.stories.mdx)
209
+ - [Storybook page](https://nypl.github.io/nypl-design-system/storybook-static/?path=/story/chakra-ui--page)
193
210
 
194
- Find more information about the Design System's use of [Chakra](/src/docs/Chakra.stories.mdx).
211
+ Chakra was integrated into the Design System in version `0.25.0`. For those looking to update to a version greater than or equal `0.25.0`, check out our [Chakra Migration Guide](/CHAKRA_MIGRATION_GUIDE.md).
195
212
 
196
213
  ## CDN
197
214
 
@@ -209,12 +226,6 @@ If you need to reference a particular version you can do do by including the ver
209
226
 
210
227
  You can check out a working Codepen with unpkg [here](https://codepen.io/edwinguzman/pen/ExmXGKx).
211
228
 
212
- ## Accessibility Product Requirements
213
-
214
- The NYPL Design System provides accessible stories, but real live data can necessitate additional accessibility requirements beyond what we're committed to in our generic, extensible components. To ensure your products' final result is accessible, please adhere to the accessibility requirements put together by NYPL's accessibility coordinator on [Metronome](http://themetronome.co/).
215
-
216
- NYPL's Metronome instance is currently password protected. For access to Metronome, please contact NYPL's UX team or Design System team.
217
-
218
229
  ## Storybook
219
230
 
220
231
  The NYPL Design System leverages Storybook to document all the React components and style guidelines. The Storybook documentation can be found [here](https://nypl.github.io/nypl-design-system/storybook-static/?path=/story/introduction--page). For your convenience, the NYPL Design System components have been organized into logical categories based on both form and function. Please refer to the COMPONENTS section in the Storybook sidebar.
@@ -308,7 +319,7 @@ The NYPL DS implements snapshot testing with `react-test-renderer` and `jest`. U
308
319
 
309
320
  The `react-test-renderer` package, will create a directory and a file to hold `.snap` files after a unit test is created. Using the `Notification` component as an example, this is the basic layout for a snapshot test:
310
321
 
311
- ```jsx
322
+ ```tsx
312
323
  import renderer from "react-test-renderer";
313
324
 
314
325
  // ...
@@ -316,10 +327,11 @@ import renderer from "react-test-renderer";
316
327
  it("Renders the UI snapshot correctly", () => {
317
328
  const tree = renderer
318
329
  .create(
319
- <Notification id="notificationID">
320
- <NotificationHeading>Notification Heading</NotificationHeading>
321
- <NotificationContent>Notification content.</NotificationContent>
322
- </Notification>
330
+ <Notification
331
+ id="notificationID"
332
+ notificationHeading="Notification Heading"
333
+ notificationContent={<>Notification content.</>}
334
+ />
323
335
  )
324
336
  .toJSON();
325
337
  expect(tree).toMatchSnapshot();
@@ -328,7 +340,7 @@ it("Renders the UI snapshot correctly", () => {
328
340
 
329
341
  If this is a new test and we run `npm test`, a [`/__snapshots__/Notification.test.tsx.snap`](/src/components/Notification/__snapshots__/Notification.test.tsx.snap) file is created. This holds the DOM structure as well as any inline CSS that was added.
330
342
 
331
- ```jsx
343
+ ```tsx
332
344
  exports[`Notification Snapshot Renders the UI snapshot correctly 1`] = `
333
345
  <aside
334
346
  className="notification notification--standard "
@@ -354,3 +366,39 @@ Each snapshot file also includes a link to its [Jest Snapshot documentation](htt
354
366
  Through the [`@storybook/addon-jest`](https://www.npmjs.com/package/@storybook/addon-jest) plugin, we can see a component's suite of unit tests right Storybook. In the "Addons" panel, a "Test" tab will display all the tests for the current component and whether they pass or fail.
355
367
 
356
368
  After writing new tests, run `npm run test:generate-output` to create a new JSON file that is used by Storybook. This JSON file contains all the test suites for all the components and Storybook picks this up and automatically combines a component with its relevant unit tests. Make sure to commit this file although new builds on Github Pages will recreate this file for the production Storybook instance.
369
+
370
+ ## Accessibility
371
+
372
+ ### Development and Storybook
373
+
374
+ The NYPL Design System is built with accessibility in mind. By using Chakra UI as our foundational base, the custom DS components built with Chakra have accessibility concerns already implemented. On top of built-in accessible elements, DS components internally work to link labels with input elements, to add correct `aria-*` attributes, to visually hide text but still associate it with the correct element for titles and descriptions, to auto-generate a random `id` attribute if none was passed, and much more.
375
+
376
+ We make use of:
377
+
378
+ - `eslint-plugin-jsx-a11y` for finding accessibility errors through linting and through IDE environments.
379
+ - `jest-axe` for running [`axe-core`](https://github.com/dequelabs/axe-core) on _every_ component's unit test file. This is part of the automated tests that run in Github Actions through the `npm test` command.
380
+ - `@storybook/addon-a11y` for real-time accessibility testing in the browser through Storybook. _Every_ component has a tab that displays violations, passes, and incomplete checks performed by `axe-core`.
381
+
382
+ If applicable, DS components have section(s) on accessibility in their Storybook documentation. For example, in the `Slider`'s [Storybook file](/src/components/Slider/Slider.stories.mdx), there are two "Accessibility" sections for each of the two `Slider` types, "single" and "range". This gives an explanation on additional changes we made to make the combination of elements in the `Slider` component accessible.
383
+
384
+ ### Product Requirements
385
+
386
+ The NYPL Design System provides accessible stories, but real live data can necessitate additional accessibility requirements beyond what we're committed to in our generic, extensible components. To ensure your products' final result is accessible, please adhere to the accessibility requirements put together by NYPL's accessibility coordinator on [Metronome](http://themetronome.co/).
387
+
388
+ NYPL's Metronome instance is currently password protected. For access to Metronome, please contact NYPL's UX team or Design System team.
389
+
390
+ ## CDN
391
+
392
+ You can also use the Design System styles in your project through the `unpkg` CDN:
393
+
394
+ ```jsx
395
+ <link href="https://unpkg.com/@nypl/design-system-react-components/dist/styles.css">
396
+ ```
397
+
398
+ If you need to reference a particular version you can do do by including the version number in the URL:
399
+
400
+ ```jsx
401
+ <link href="https://unpkg.com/@nypl/design-system-react-components@0.9.1/dist/styles.css">
402
+ ```
403
+
404
+ You can check out a working Codepen with unpkg [here](https://codepen.io/edwinguzman/pen/ExmXGKx).
@@ -1,19 +1,19 @@
1
1
  import * as React from "react";
2
+ export interface AccordionContentDataProps {
3
+ label: string;
4
+ panel: string | React.ReactNode;
5
+ }
2
6
  export interface AccordionProps {
3
- /** Inner label on the button that opens the accordion */
4
- accordionLabel?: React.ReactNode;
5
- /** BlockName for use with BEM. See how to work with blockNames and BEM here: http://getbem.com/introduction/ */
6
- blockName?: string;
7
- /** className you can add in addition to 'input' */
8
- className?: string;
9
- /** Whether the accordion is open by default */
10
- defaultOpen?: boolean;
7
+ /** Array of data to display */
8
+ contentData: AccordionContentDataProps[];
11
9
  /** ID that other components can cross reference for accessibility purposes */
12
10
  id?: string;
13
- /** accordionLabel's input ID */
14
- inputId?: string;
15
- /** Modifiers array for use with BEM. See how to work with modifiers and BEM here: http://getbem.com/introduction/ */
16
- modifiers?: string[];
11
+ /** Whether the accordion is open by default only on its initial rendering */
12
+ isDefaultOpen?: boolean;
17
13
  }
18
- /** Accordion component that shows content on toggle */
19
- export default function Accordion(props: React.PropsWithChildren<AccordionProps>): JSX.Element;
14
+ /**
15
+ * Accordion component that shows content on toggle. Can be used to display
16
+ * multiple accordion items together.
17
+ */
18
+ declare function Accordion(props: React.PropsWithChildren<AccordionProps>): JSX.Element;
19
+ export default Accordion;
@@ -1,21 +1,22 @@
1
1
  import * as React from "react";
2
- declare type breadcrumb = {
2
+ import { ColorVariants } from "./BreadcrumbsTypes";
3
+ export interface BreadcrumbsDataProps {
3
4
  url: string;
4
- text: string;
5
- };
5
+ text: string | React.ReactNode;
6
+ }
6
7
  export interface BreadcrumbProps {
7
- /** BlockName for use with BEM. See how to work with blockNames and BEM here: http://getbem.com/introduction/ */
8
- blockName?: string;
8
+ /** Optionally pass in additional Chakra-based styles. */
9
+ additionalStyles?: {
10
+ [key: string]: any;
11
+ };
9
12
  /** Breadcrumb links as an array */
10
- breadcrumbs: breadcrumb[] | JSX.Element[];
13
+ breadcrumbsData: BreadcrumbsDataProps[];
11
14
  /** className you can add in addition to 'input' */
12
15
  className?: string;
13
- /** Modifiers array for use with BEM. See how to work with modifiers and BEM here: http://getbem.com/introduction/ */
14
- modifiers?: string[];
15
- }
16
- export default class Breadcrumbs extends React.Component<BreadcrumbProps, any> {
17
- static defaultProps: {};
18
- constructor(props: BreadcrumbProps);
19
- render(): JSX.Element;
16
+ /** ID that other components can cross reference for accessibility purposes */
17
+ id?: string;
18
+ /** Used to control how the `Hero` component will be rendered. */
19
+ colorVariant?: ColorVariants;
20
20
  }
21
- export {};
21
+ declare function Breadcrumbs(props: React.PropsWithChildren<BreadcrumbProps>): JSX.Element;
22
+ export default Breadcrumbs;
@@ -0,0 +1,6 @@
1
+ export declare enum ColorVariants {
2
+ BooksAndMore = "booksAndMore",
3
+ Locations = "locations",
4
+ Research = "research",
5
+ WhatsOn = "whatsOn"
6
+ }
@@ -1,28 +1,33 @@
1
1
  import * as React from "react";
2
- import { ButtonGroup } from "@chakra-ui/react";
3
2
  import { ButtonTypes } from "./ButtonTypes";
4
3
  declare type ButtonElementType = "submit" | "button" | "reset";
5
4
  interface ButtonProps {
5
+ /** Optionally pass in additional Chakra-based styles. */
6
+ additionalStyles?: {
7
+ [key: string]: any;
8
+ };
6
9
  /** Additional attributes passed to the button */
7
10
  attributes?: {
8
11
  [key: string]: any;
9
12
  };
10
13
  /** The kind of button assigned through the `ButtonTypes` enum */
11
14
  buttonType?: ButtonTypes;
12
- /** Additional className for use with BEM. See how to work with blockNames and BEM here: http://getbem.com/introduction/ */
15
+ /** Additional className to use. */
13
16
  className?: string;
14
- /** Adds 'disabled' property to the button */
15
- disabled?: boolean;
16
17
  /** ID that other components can cross reference for accessibility purposes */
17
18
  id?: string;
18
- /** Trigger the Button's action through the `mouseDown` event handler instead of `onClick`. `false` by default. */
19
+ /** Adds 'disabled' property to the button */
20
+ isDisabled?: boolean;
21
+ /** Trigger the Button's action through the `mouseDown` event handler instead
22
+ * of `onClick`. `false` by default. */
19
23
  mouseDown?: boolean;
20
24
  /** The action to perform on the `<button>`'s onClick function */
21
25
  onClick?: (event: React.MouseEvent | React.KeyboardEvent) => void;
22
- /** The html button attribute */
26
+ /** The HTML button type attribute. */
23
27
  type?: ButtonElementType;
24
28
  }
25
- /** Renders a simple `button` element with custom classes and modifiers. */
29
+ /**
30
+ * Renders a simple `button` element with custom variant styles.
31
+ */
26
32
  declare function Button(props: React.PropsWithChildren<ButtonProps>): JSX.Element;
27
- export { ButtonGroup };
28
33
  export default Button;
@@ -3,5 +3,7 @@ export declare enum ButtonTypes {
3
3
  Secondary = "secondary",
4
4
  Callout = "callout",
5
5
  Pill = "pill",
6
- Link = "link"
6
+ Link = "link",
7
+ SearchBar = "searchBar",
8
+ NoBrand = "noBrand"
7
9
  }
@@ -1,70 +1,54 @@
1
1
  import * as React from "react";
2
- import { CardImageRatios, CardImageSizes, CardLayouts } from "./CardTypes";
3
- interface CardImageProps {
4
- /** Text description of the image */
5
- alt: string;
6
- /** Custom image component used in place of DS `Image` component */
7
- component?: React.ReactNode;
8
- /** ClassName you can add in addition to 'image' */
9
- className?: string;
10
- /** Optional value to control the aspect ratio of the cartd image; default value is `square` */
11
- imageAspectRatio?: CardImageRatios;
12
- /** Optional value to control the size of the card image */
13
- imageSize?: CardImageSizes;
14
- /** The src attribute is required, and contains the path to the image you want to embed. */
15
- src: string;
2
+ import { CardLayouts } from "./CardTypes";
3
+ import Heading from "../Heading/Heading";
4
+ import { ImageRatios, ImageSizes } from "../Image/ImageTypes";
5
+ interface CardBaseProps {
6
+ /** Optional value to control the alignment of the text and elements. */
7
+ center?: boolean;
8
+ /** Optional value to render the layout in a row or column (default). */
9
+ layout?: CardLayouts;
16
10
  }
17
- interface CardContentProps {
18
- /** Optional className that would be applied to the `card-content` element */
19
- className?: string;
11
+ interface CardLinkBoxProps {
12
+ /** Main link to use when the full `Card` component should be clickable. */
13
+ mainActionLink?: string;
20
14
  }
21
- interface CardActionsProps {
22
- /** Optional boolean value to control visibility of border on the bottom edge of the card actions element */
15
+ interface CardActionsProps extends CardBaseProps {
16
+ /** Optional boolean value to control visibility of border on the bottom edge
17
+ * of the card actions element */
23
18
  bottomBorder?: boolean;
24
- /** Optional className that would be applied to the `card-actions` element */
25
- className?: string;
26
- /** Modifiers array for use with BEM. See how to work with modifiers and BEM here: http://getbem.com/introduction/ */
27
- modifiers?: string[];
28
- /** Optional boolean value to control visibility of border on the top edge of the card actions element */
19
+ /** Optional boolean value to control visibility of border on the top edge of
20
+ * the card actions element */
29
21
  topBorder?: boolean;
30
22
  }
31
- export interface CardProps {
32
- /** Optional hex color value used to set the card background color */
23
+ export interface CardProps extends CardBaseProps, CardLinkBoxProps {
24
+ /** Optional hex color value used to set the card background color. */
33
25
  backgroundColor?: string;
34
- /** BlockName for use with BEM. See how to work with blockNames and BEM here: http://getbem.com/introduction/ */
35
- blockName?: string;
36
- /** Optional boolean value to control the visibility of a border around the card */
26
+ /** Optional boolean value to control the visibility of a border around
27
+ * the card. */
37
28
  border?: boolean;
38
- /** Optional boolean value to control the alignment of the text and elements within the card */
39
- center?: boolean;
40
- /** ClassName that appears in addition to "card" */
29
+ /** Optional CSS class name to add. */
41
30
  className?: string;
42
- /** Optional hex color value used to override the default text color */
31
+ /** Optional hex color value used to override the default text color. */
43
32
  foregroundColor?: string;
44
- /** ID that other components can cross reference for accessibility purposes */
33
+ /** ID that other components can cross reference for accessibility purposes. */
45
34
  id?: string;
46
- /** Text description of the image; to follow best practices for accessibility, this prop should not be left blank if `imageSrc` is passed */
35
+ /** Text description of the image; to follow best practices for accessibility,
36
+ * this prop should not be left blank if `imageSrc` is passed. */
47
37
  imageAlt?: string;
48
- /** Optional value to control the aspect ratio of the card image; default value is `square` */
49
- imageAspectRatio?: CardImageRatios;
50
- /** Optional boolean value to control the position of the card image */
38
+ /** Optional value to control the aspect ratio of the `CardIage`; default
39
+ * value is `square`. */
40
+ imageAspectRatio?: ImageRatios;
41
+ /** Optional boolean value to control the position of the `CardImage`. */
51
42
  imageAtEnd?: boolean;
52
- /** Custom image component used in place of DS `Image` component */
53
- imageComponent?: React.ReactNode;
54
- /** Optional value to control the size of the card image */
55
- imageSize?: CardImageSizes;
56
- /** The path to the image displayed with the card */
43
+ /** Custom image component used in place of DS `Image` component. */
44
+ imageComponent?: JSX.Element;
45
+ /** Optional value to control the size of the `CardImage`. */
46
+ imageSize?: ImageSizes;
47
+ /** The path to the image displayed within the `Card` component. */
57
48
  imageSrc?: string;
58
- /** Optional value to control the position of the image placeholder; default value is `vertical` */
59
- layout?: CardLayouts;
60
- /** Modifiers array for use with BEM. See how to work with modifiers and BEM here: http://getbem.com/introduction/ */
61
- modifiers?: string[];
62
- /** Optional padding value. This value should be entered with the same formatting as a CSS padding attribute (ex. `5%`, `20px`, `2rem`). If omitted, the Card will use the default padding. */
63
- padding?: string;
64
49
  }
65
- export declare function CardImage(props: React.PropsWithChildren<CardImageProps>): JSX.Element;
66
- export declare const CardHeading: (props: any) => JSX.Element;
67
- export declare function CardContent(props: React.PropsWithChildren<CardContentProps>): JSX.Element;
50
+ export declare const CardHeading: typeof Heading;
51
+ export declare function CardContent(props: React.PropsWithChildren<{}>): JSX.Element;
68
52
  export declare function CardActions(props: React.PropsWithChildren<CardActionsProps>): JSX.Element;
69
53
  export default function Card(props: React.PropsWithChildren<CardProps>): JSX.Element;
70
54
  export {};