@nypl/design-system-react-components 0.25.12 → 0.26.1

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 (337) hide show
  1. package/CHANGELOG.md +131 -1
  2. package/README.md +10 -10
  3. package/dist/components/Accordion/Accordion.d.ts +6 -4
  4. package/dist/components/Accordion/AccordionTypes.d.ts +5 -0
  5. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +4 -4
  6. package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +1 -1
  7. package/dist/components/Button/Button.d.ts +2 -2
  8. package/dist/components/Card/Card.d.ts +22 -29
  9. package/dist/components/Checkbox/Checkbox.d.ts +3 -3
  10. package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +9 -6
  11. package/dist/components/ComponentWrapper/ComponentWrapper.d.ts +1 -1
  12. package/dist/components/DatePicker/DatePicker.d.ts +5 -6
  13. package/dist/components/Fieldset/Fieldset.d.ts +5 -6
  14. package/dist/components/Form/Form.d.ts +6 -6
  15. package/dist/components/Grid/GridTypes.d.ts +7 -7
  16. package/dist/components/Grid/SimpleGrid.d.ts +1 -1
  17. package/dist/components/Heading/Heading.d.ts +5 -5
  18. package/dist/components/Heading/HeadingTypes.d.ts +1 -1
  19. package/dist/components/HelperErrorText/HelperErrorText.d.ts +9 -8
  20. package/dist/components/Hero/Hero.d.ts +9 -5
  21. package/dist/components/HorizontalRule/HorizontalRule.d.ts +2 -10
  22. package/dist/components/Icons/Icon.d.ts +2 -1
  23. package/dist/components/Icons/IconTypes.d.ts +1 -0
  24. package/dist/components/Image/Image.d.ts +27 -9
  25. package/dist/components/Image/ImageTypes.d.ts +4 -4
  26. package/dist/components/Label/Label.d.ts +7 -4
  27. package/dist/components/Link/Link.d.ts +1 -1
  28. package/dist/components/List/List.d.ts +11 -11
  29. package/dist/components/List/ListTypes.d.ts +1 -1
  30. package/dist/components/Logo/Logo.d.ts +2 -1
  31. package/dist/components/Logo/LogoSvgs.d.ts +2 -0
  32. package/dist/components/Logo/LogoTypes.d.ts +4 -2
  33. package/dist/components/Notification/Notification.d.ts +7 -7
  34. package/dist/components/Pagination/Pagination.d.ts +2 -2
  35. package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +3 -3
  36. package/dist/components/Radio/Radio.d.ts +5 -7
  37. package/dist/components/RadioGroup/RadioGroup.d.ts +16 -8
  38. package/dist/components/SearchBar/SearchBar.d.ts +4 -4
  39. package/dist/components/Select/Select.d.ts +12 -8
  40. package/dist/components/Select/SelectTypes.d.ts +4 -0
  41. package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +8 -6
  42. package/dist/components/SkeletonLoader/SkeletonLoaderTypes.d.ts +0 -4
  43. package/dist/components/Slider/Slider.d.ts +6 -4
  44. package/dist/components/StatusBadge/StatusBadge.d.ts +5 -1
  45. package/dist/components/StructuredContent/StructuredContent.d.ts +10 -23
  46. package/dist/components/Table/Table.d.ts +1 -1
  47. package/dist/components/Tabs/Tabs.d.ts +7 -6
  48. package/dist/components/Template/Template.d.ts +17 -8
  49. package/dist/components/Text/Text.d.ts +4 -4
  50. package/dist/components/Text/TextTypes.d.ts +1 -1
  51. package/dist/components/TextInput/TextInput.d.ts +7 -7
  52. package/dist/components/Toggle/Toggle.d.ts +8 -10
  53. package/dist/components/Toggle/{ToggleSizes.d.ts → ToggleTypes.d.ts} +1 -1
  54. package/dist/components/VideoPlayer/VideoPlayer.d.ts +2 -1
  55. package/dist/design-system-react-components.cjs.development.js +2075 -1468
  56. package/dist/design-system-react-components.cjs.development.js.map +1 -1
  57. package/dist/design-system-react-components.cjs.production.min.js +1 -1
  58. package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
  59. package/dist/design-system-react-components.esm.js +2086 -1483
  60. package/dist/design-system-react-components.esm.js.map +1 -1
  61. package/dist/helpers/enums.d.ts +4 -0
  62. package/dist/hooks/useCarouselStyles.d.ts +3 -2
  63. package/dist/hooks/useNYPLTheme.d.ts +12 -0
  64. package/dist/index.d.ts +11 -9
  65. package/dist/styles.css +1 -1
  66. package/dist/theme/components/accordion.d.ts +7 -12
  67. package/dist/theme/components/breadcrumb.d.ts +3 -0
  68. package/dist/theme/components/button.d.ts +10 -2
  69. package/dist/theme/components/card.d.ts +44 -24
  70. package/dist/theme/components/checkbox.d.ts +6 -4
  71. package/dist/theme/components/checkboxGroup.d.ts +4 -2
  72. package/dist/theme/components/componentWrapper.d.ts +2 -2
  73. package/dist/theme/components/customTable.d.ts +84 -1
  74. package/dist/theme/components/fieldset.d.ts +4 -14
  75. package/dist/theme/components/global.d.ts +25 -18
  76. package/dist/theme/components/heading.d.ts +53 -0
  77. package/dist/theme/components/helperErrorText.d.ts +1 -0
  78. package/dist/theme/components/hero.d.ts +21 -15
  79. package/dist/theme/components/image.d.ts +1 -1
  80. package/dist/theme/components/label.d.ts +9 -10
  81. package/dist/theme/components/list.d.ts +99 -9
  82. package/dist/theme/components/notification.d.ts +4 -4
  83. package/dist/theme/components/pagination.d.ts +2 -5
  84. package/dist/theme/components/radio.d.ts +7 -4
  85. package/dist/theme/components/radioGroup.d.ts +4 -2
  86. package/dist/theme/components/select.d.ts +37 -5
  87. package/dist/theme/components/skeletonLoader.d.ts +2 -2
  88. package/dist/theme/components/slider.d.ts +6 -3
  89. package/dist/theme/components/structuredContent.d.ts +197 -0
  90. package/dist/theme/components/textInput.d.ts +18 -6
  91. package/dist/theme/components/toggle.d.ts +20 -5
  92. package/dist/theme/foundations/global.d.ts +2 -0
  93. package/dist/theme/foundations/radii.d.ts +1 -0
  94. package/dist/theme/foundations/spacing.d.ts +46 -43
  95. package/package.json +5 -6
  96. package/src/components/AccessibilityGuide/SkipNavigation.stories.mdx +34 -0
  97. package/src/components/Accordion/Accordion.stories.mdx +150 -66
  98. package/src/components/Accordion/Accordion.test.tsx +65 -17
  99. package/src/components/Accordion/Accordion.tsx +61 -27
  100. package/src/components/Accordion/AccordionTypes.tsx +5 -0
  101. package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +505 -14
  102. package/src/components/Autosuggest/Autosuggest.stories.mdx +4 -3
  103. package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +37 -19
  104. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +57 -36
  105. package/src/components/Breadcrumbs/Breadcrumbs.tsx +14 -13
  106. package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +1 -1
  107. package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +211 -12
  108. package/src/components/Button/Button.stories.mdx +87 -23
  109. package/src/components/Button/Button.test.tsx +25 -0
  110. package/src/components/Button/Button.tsx +18 -7
  111. package/src/components/Button/__snapshots__/Button.test.tsx.snap +27 -7
  112. package/src/components/Card/Card.stories.mdx +493 -329
  113. package/src/components/Card/Card.test.tsx +138 -18
  114. package/src/components/Card/Card.tsx +151 -85
  115. package/src/components/Card/__snapshots__/Card.test.tsx.snap +221 -101
  116. package/src/components/Chakra/Center.stories.mdx +2 -2
  117. package/src/components/Chakra/Grid.stories.mdx +4 -4
  118. package/src/components/Checkbox/Checkbox.stories.mdx +73 -9
  119. package/src/components/Checkbox/Checkbox.test.tsx +89 -10
  120. package/src/components/Checkbox/Checkbox.tsx +26 -16
  121. package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +209 -6
  122. package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +135 -23
  123. package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +216 -90
  124. package/src/components/CheckboxGroup/CheckboxGroup.tsx +39 -26
  125. package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +493 -89
  126. package/src/components/ComponentWrapper/ComponentWrapper.test.tsx +12 -0
  127. package/src/components/ComponentWrapper/ComponentWrapper.tsx +39 -41
  128. package/src/components/ComponentWrapper/__snapshots__/ComponentWrapper.test.tsx.snap +47 -34
  129. package/src/components/DatePicker/DatePicker.stories.mdx +63 -27
  130. package/src/components/DatePicker/DatePicker.test.tsx +94 -15
  131. package/src/components/DatePicker/DatePicker.tsx +67 -58
  132. package/src/components/DatePicker/_DatePicker.scss +71 -13
  133. package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +250 -206
  134. package/src/components/Fieldset/Fieldset.stories.mdx +33 -3
  135. package/src/components/Fieldset/Fieldset.test.tsx +58 -28
  136. package/src/components/Fieldset/Fieldset.tsx +35 -30
  137. package/src/components/Fieldset/__snapshots__/Fieldset.test.tsx.snap +40 -19
  138. package/src/components/Form/Form.stories.mdx +118 -47
  139. package/src/components/Form/Form.test.tsx +59 -16
  140. package/src/components/Form/Form.tsx +89 -65
  141. package/src/components/Form/__snapshots__/Form.test.tsx.snap +83 -5
  142. package/src/components/Grid/GridTypes.tsx +7 -7
  143. package/src/components/Grid/SimpleGrid.stories.mdx +87 -41
  144. package/src/components/Grid/SimpleGrid.test.tsx +24 -9
  145. package/src/components/Grid/SimpleGrid.tsx +29 -20
  146. package/src/components/Grid/__snapshots__/SimpleGrid.test.tsx.snap +16 -1
  147. package/src/components/Heading/Heading.stories.mdx +56 -25
  148. package/src/components/Heading/Heading.test.tsx +17 -7
  149. package/src/components/Heading/Heading.tsx +60 -58
  150. package/src/components/Heading/HeadingTypes.tsx +1 -1
  151. package/src/components/Heading/__snapshots__/Heading.test.tsx.snap +27 -8
  152. package/src/components/HelperErrorText/HelperErrorText.stories.mdx +64 -42
  153. package/src/components/HelperErrorText/HelperErrorText.test.tsx +15 -0
  154. package/src/components/HelperErrorText/HelperErrorText.tsx +40 -35
  155. package/src/components/HelperErrorText/__snapshots__/HelperErrorText.test.tsx.snap +35 -4
  156. package/src/components/Hero/Hero.stories.mdx +143 -113
  157. package/src/components/Hero/Hero.test.tsx +146 -58
  158. package/src/components/Hero/Hero.tsx +144 -112
  159. package/src/components/Hero/__snapshots__/Hero.test.tsx.snap +89 -17
  160. package/src/components/HorizontalRule/HorizontalRule.stories.mdx +26 -4
  161. package/src/components/HorizontalRule/HorizontalRule.test.tsx +9 -17
  162. package/src/components/HorizontalRule/HorizontalRule.tsx +9 -25
  163. package/src/components/HorizontalRule/__snapshots__/HorizontalRule.test.tsx.snap +18 -5
  164. package/src/components/Icons/Icon.stories.mdx +80 -23
  165. package/src/components/Icons/Icon.test.tsx +51 -2
  166. package/src/components/Icons/Icon.tsx +93 -71
  167. package/src/components/Icons/IconTypes.tsx +1 -0
  168. package/src/components/Icons/__snapshots__/Icon.test.tsx.snap +129 -0
  169. package/src/components/Image/Image.stories.mdx +160 -71
  170. package/src/components/Image/Image.test.tsx +40 -48
  171. package/src/components/Image/Image.tsx +80 -48
  172. package/src/components/Image/ImageTypes.ts +4 -4
  173. package/src/components/Image/__snapshots__/Image.test.tsx.snap +84 -21
  174. package/src/components/Label/Label.stories.mdx +42 -20
  175. package/src/components/Label/Label.test.tsx +42 -17
  176. package/src/components/Label/Label.tsx +22 -13
  177. package/src/components/Label/__snapshots__/Label.test.tsx.snap +19 -15
  178. package/src/components/Link/Link.stories.mdx +25 -1
  179. package/src/components/Link/Link.test.tsx +21 -0
  180. package/src/components/Link/Link.tsx +16 -9
  181. package/src/components/Link/__snapshots__/Link.test.tsx.snap +37 -11
  182. package/src/components/List/List.stories.mdx +75 -40
  183. package/src/components/List/List.test.tsx +73 -22
  184. package/src/components/List/List.tsx +44 -28
  185. package/src/components/List/ListTypes.tsx +1 -1
  186. package/src/components/List/__snapshots__/List.test.tsx.snap +110 -8
  187. package/src/components/Logo/Logo.stories.mdx +40 -16
  188. package/src/components/Logo/Logo.test.tsx +29 -2
  189. package/src/components/Logo/Logo.tsx +28 -11
  190. package/src/components/Logo/LogoSvgs.tsx +4 -0
  191. package/src/components/Logo/LogoTypes.tsx +3 -1
  192. package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +73 -2
  193. package/src/components/Modal/Modal.stories.mdx +13 -0
  194. package/src/components/Notification/Notification.stories.mdx +29 -5
  195. package/src/components/Notification/Notification.test.tsx +23 -0
  196. package/src/components/Notification/Notification.tsx +53 -51
  197. package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +158 -29
  198. package/src/components/Pagination/Pagination.stories.mdx +27 -6
  199. package/src/components/Pagination/Pagination.test.tsx +55 -2
  200. package/src/components/Pagination/Pagination.tsx +12 -9
  201. package/src/components/Pagination/__snapshots__/Pagination.test.tsx.snap +244 -27
  202. package/src/components/Placeholder/Placeholder.tsx +3 -1
  203. package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +76 -10
  204. package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +87 -13
  205. package/src/components/ProgressIndicator/ProgressIndicator.tsx +20 -10
  206. package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +101 -14
  207. package/src/components/Radio/Radio.stories.mdx +75 -11
  208. package/src/components/Radio/Radio.test.tsx +83 -9
  209. package/src/components/Radio/Radio.tsx +70 -62
  210. package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +163 -5
  211. package/src/components/RadioGroup/RadioGroup.stories.mdx +293 -94
  212. package/src/components/RadioGroup/RadioGroup.test.tsx +193 -68
  213. package/src/components/RadioGroup/RadioGroup.tsx +110 -101
  214. package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +1258 -902
  215. package/src/components/SearchBar/SearchBar.stories.mdx +101 -36
  216. package/src/components/SearchBar/{SearchBar.Test.tsx → SearchBar.test.tsx} +46 -4
  217. package/src/components/SearchBar/SearchBar.tsx +20 -11
  218. package/src/components/SearchBar/__snapshots__/SearchBar.test.tsx.snap +1039 -0
  219. package/src/components/Select/Select.stories.mdx +151 -62
  220. package/src/components/Select/Select.test.tsx +56 -44
  221. package/src/components/Select/Select.tsx +125 -104
  222. package/src/components/Select/SelectTypes.tsx +5 -0
  223. package/src/components/Select/__snapshots__/Select.test.tsx.snap +749 -409
  224. package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +53 -23
  225. package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +14 -8
  226. package/src/components/SkeletonLoader/SkeletonLoader.tsx +80 -78
  227. package/src/components/SkeletonLoader/SkeletonLoaderTypes.tsx +0 -5
  228. package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +169 -10
  229. package/src/components/Slider/Slider.stories.mdx +123 -41
  230. package/src/components/Slider/Slider.test.tsx +65 -17
  231. package/src/components/Slider/Slider.tsx +30 -23
  232. package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +403 -226
  233. package/src/components/StatusBadge/StatusBadge.stories.mdx +19 -1
  234. package/src/components/StatusBadge/StatusBadge.test.tsx +19 -1
  235. package/src/components/StatusBadge/StatusBadge.tsx +25 -20
  236. package/src/components/StatusBadge/__snapshots__/StatusBadge.test.tsx.snap +22 -3
  237. package/src/components/StructuredContent/StructuredContent.stories.mdx +229 -61
  238. package/src/components/StructuredContent/StructuredContent.test.tsx +162 -101
  239. package/src/components/StructuredContent/StructuredContent.tsx +98 -103
  240. package/src/components/StructuredContent/__snapshots__/StructuredContent.test.tsx.snap +102 -17
  241. package/src/components/StyleGuide/Bidirectionality.stories.mdx +5 -5
  242. package/src/components/StyleGuide/Breakpoints.stories.mdx +6 -6
  243. package/src/components/StyleGuide/Buttons.stories.mdx +2 -12
  244. package/src/components/StyleGuide/ColorCard.tsx +4 -4
  245. package/src/components/StyleGuide/Colors.stories.mdx +1 -2
  246. package/src/components/StyleGuide/DesignTokens.stories.mdx +56 -26
  247. package/src/components/StyleGuide/Forms.stories.mdx +27 -12
  248. package/src/components/StyleGuide/Iconography.stories.mdx +2 -12
  249. package/src/components/StyleGuide/Spacing.stories.mdx +80 -41
  250. package/src/components/StyleGuide/Typography.stories.mdx +47 -33
  251. package/src/components/Table/Table.stories.mdx +38 -11
  252. package/src/components/Table/Table.test.tsx +16 -1
  253. package/src/components/Table/Table.tsx +10 -8
  254. package/src/components/Table/__snapshots__/Table.test.tsx.snap +408 -5
  255. package/src/components/Tabs/Tabs.stories.mdx +59 -10
  256. package/src/components/Tabs/Tabs.test.tsx +29 -11
  257. package/src/components/Tabs/Tabs.tsx +28 -21
  258. package/src/components/Tabs/__snapshots__/Tabs.test.tsx.snap +394 -5
  259. package/src/components/Template/Template.stories.mdx +73 -32
  260. package/src/components/Template/Template.test.tsx +68 -5
  261. package/src/components/Template/Template.tsx +89 -71
  262. package/src/components/Template/__snapshots__/Template.test.tsx.snap +195 -22
  263. package/src/components/Text/Text.stories.mdx +32 -15
  264. package/src/components/Text/Text.test.tsx +14 -11
  265. package/src/components/Text/Text.tsx +13 -16
  266. package/src/components/Text/TextTypes.tsx +1 -1
  267. package/src/components/Text/__snapshots__/Text.test.tsx.snap +21 -4
  268. package/src/components/TextInput/TextInput.stories.mdx +73 -27
  269. package/src/components/TextInput/TextInput.test.tsx +65 -50
  270. package/src/components/TextInput/TextInput.tsx +123 -115
  271. package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +96 -73
  272. package/src/components/Toggle/Toggle.stories.mdx +74 -26
  273. package/src/components/Toggle/Toggle.test.tsx +41 -10
  274. package/src/components/Toggle/Toggle.tsx +29 -26
  275. package/src/components/Toggle/{ToggleSizes.tsx → ToggleTypes.tsx} +1 -1
  276. package/src/components/Toggle/__snapshots__/Toggle.test.tsx.snap +191 -4
  277. package/src/components/VideoPlayer/VideoPlayer.stories.mdx +52 -4
  278. package/src/components/VideoPlayer/VideoPlayer.test.tsx +41 -6
  279. package/src/components/VideoPlayer/VideoPlayer.tsx +134 -120
  280. package/src/components/VideoPlayer/__snapshots__/VideoPlayer.test.tsx.snap +81 -39
  281. package/src/docs/Chakra.stories.mdx +50 -9
  282. package/src/docs/Welcome.stories.mdx +168 -0
  283. package/src/{components/Card/CardTypes.tsx → helpers/enums.ts} +2 -2
  284. package/src/hooks/tests/useNYPLTheme.test.tsx +1 -1
  285. package/src/hooks/useCarouselStyles.stories.mdx +30 -0
  286. package/src/hooks/useCarouselStyles.ts +3 -2
  287. package/src/hooks/useNYPLTheme.stories.mdx +101 -0
  288. package/src/hooks/useNYPLTheme.ts +31 -7
  289. package/src/hooks/useWindowSize.stories.mdx +23 -0
  290. package/src/index.ts +11 -15
  291. package/src/styles/base/_place-holder.scss +1 -1
  292. package/src/theme/components/accordion.ts +7 -12
  293. package/src/theme/components/breadcrumb.ts +3 -0
  294. package/src/theme/components/button.ts +15 -7
  295. package/src/theme/components/card.ts +56 -36
  296. package/src/theme/components/checkbox.ts +10 -8
  297. package/src/theme/components/checkboxGroup.ts +4 -2
  298. package/src/theme/components/componentWrapper.ts +2 -2
  299. package/src/theme/components/customTable.ts +39 -31
  300. package/src/theme/components/fieldset.ts +1 -2
  301. package/src/theme/components/global.ts +29 -23
  302. package/src/theme/components/heading.ts +1 -1
  303. package/src/theme/components/helperErrorText.ts +1 -0
  304. package/src/theme/components/hero.ts +14 -16
  305. package/src/theme/components/icon.ts +5 -2
  306. package/src/theme/components/image.ts +1 -1
  307. package/src/theme/components/label.ts +4 -3
  308. package/src/theme/components/list.ts +73 -66
  309. package/src/theme/components/notification.ts +7 -7
  310. package/src/theme/components/pagination.ts +2 -5
  311. package/src/theme/components/progressIndicator.ts +3 -3
  312. package/src/theme/components/radio.ts +9 -9
  313. package/src/theme/components/radioGroup.ts +4 -2
  314. package/src/theme/components/select.ts +35 -16
  315. package/src/theme/components/skeletonLoader.ts +3 -3
  316. package/src/theme/components/slider.ts +8 -7
  317. package/src/theme/components/statusBadge.ts +2 -2
  318. package/src/theme/components/structuredContent.ts +66 -1
  319. package/src/theme/components/tabs.ts +2 -2
  320. package/src/theme/components/template.ts +9 -9
  321. package/src/theme/components/textInput.ts +13 -12
  322. package/src/theme/components/toggle.ts +43 -13
  323. package/src/theme/components/videoPlayer.ts +1 -1
  324. package/src/theme/foundations/colors.ts +1 -1
  325. package/src/theme/foundations/radii.ts +1 -0
  326. package/src/theme/foundations/spacing.ts +70 -22
  327. package/src/theme/foundations/typography.ts +2 -2
  328. package/src/utils/componentCategories.ts +28 -21
  329. package/dist/components/Card/CardTypes.d.ts +0 -4
  330. package/dist/components/CheckboxGroup/CheckboxGroupLayoutTypes.d.ts +0 -4
  331. package/dist/components/RadioGroup/RadioGroupLayoutTypes.d.ts +0 -4
  332. package/dist/components/SearchBar/SearchBar.Test.d.ts +0 -1
  333. package/dist/helpers/generateUUID.d.ts +0 -1
  334. package/src/components/CheckboxGroup/CheckboxGroupLayoutTypes.tsx +0 -4
  335. package/src/components/RadioGroup/RadioGroupLayoutTypes.tsx +0 -4
  336. package/src/docs/Intro.stories.mdx +0 -53
  337. package/src/helpers/generateUUID.tsx +0 -5
@@ -143,9 +143,21 @@ describe("ComponentWrapper", () => {
143
143
  </ComponentWrapper>
144
144
  )
145
145
  .toJSON();
146
+ const withChakraProps = renderer.create(
147
+ <ComponentWrapper id="chakra" p="20px" color="ui.error.primary">
148
+ <div>children elements</div>
149
+ </ComponentWrapper>
150
+ );
151
+ const withOtherProps = renderer.create(
152
+ <ComponentWrapper id="props" data-testid="props">
153
+ <div>children elements</div>
154
+ </ComponentWrapper>
155
+ );
146
156
 
147
157
  expect(basic).toMatchSnapshot();
148
158
  expect(onlyWithChildren).toMatchSnapshot();
149
159
  expect(isInvalid).toMatchSnapshot();
160
+ expect(withChakraProps).toMatchSnapshot();
161
+ expect(withOtherProps).toMatchSnapshot();
150
162
  });
151
163
  });
@@ -1,4 +1,4 @@
1
- import { Box, useMultiStyleConfig } from "@chakra-ui/react";
1
+ import { Box, chakra, useMultiStyleConfig } from "@chakra-ui/react";
2
2
  import * as React from "react";
3
3
 
4
4
  import Heading from "../Heading/Heading";
@@ -7,8 +7,6 @@ import HelperErrorText, {
7
7
  HelperErrorTextType,
8
8
  } from "../HelperErrorText/HelperErrorText";
9
9
  import Text from "../Text/Text";
10
- import generateUUID from "../../helpers/generateUUID";
11
-
12
10
  export interface ComponentWrapperProps {
13
11
  /** The UI elements that will be wrapped by this component */
14
12
  children: React.ReactNode;
@@ -27,50 +25,50 @@ export interface ComponentWrapperProps {
27
25
  isInvalid?: boolean;
28
26
  }
29
27
 
30
- function ComponentWrapper(
31
- props: React.PropsWithChildren<ComponentWrapperProps>
32
- ) {
33
- const {
34
- children,
35
- descriptionText,
36
- headingText,
37
- helperText,
38
- id = generateUUID(),
39
- invalidText,
40
- isInvalid = false,
41
- } = props;
42
- const hasChildren = !!children;
43
- const styles = useMultiStyleConfig("ComponentWrapper", { hasChildren });
44
- const footnote: HelperErrorTextType = isInvalid ? invalidText : helperText;
28
+ export const ComponentWrapper = chakra(
29
+ (props: React.PropsWithChildren<ComponentWrapperProps>) => {
30
+ const {
31
+ children,
32
+ descriptionText,
33
+ headingText,
34
+ helperText,
35
+ id,
36
+ invalidText,
37
+ isInvalid = false,
38
+ ...rest
39
+ } = props;
40
+ const hasChildren = !!children;
41
+ const styles = useMultiStyleConfig("ComponentWrapper", { hasChildren });
42
+ const footnote: HelperErrorTextType = isInvalid ? invalidText : helperText;
45
43
 
46
- // Note: Typescript warns when there are no children passed and
47
- // doesn't compile. This is meant to log in non-Typescript apps.
48
- if (!hasChildren) {
49
- console.warn("`ComponentWrapper` has no children.");
50
- }
44
+ // Note: Typescript warns when there are no children passed and
45
+ // doesn't compile. This is meant to log in non-Typescript apps.
46
+ if (!hasChildren) {
47
+ console.warn("NYPL Reservoir ComponentWrapper: No children were passed.");
48
+ }
51
49
 
52
- return (
53
- <Box __css={styles}>
54
- {headingText && (
55
- <Heading
56
- id={`${id}-heading`}
57
- level={HeadingLevels.Two}
58
- text={headingText}
59
- />
60
- )}
61
- {descriptionText && <Text>{descriptionText}</Text>}
62
- {children}
63
- {footnote && (
64
- <Box __css={styles.helperText}>
50
+ return (
51
+ <Box __css={styles} {...rest}>
52
+ {headingText && (
53
+ <Heading
54
+ id={`${id}-heading`}
55
+ level={HeadingLevels.Two}
56
+ text={headingText}
57
+ />
58
+ )}
59
+ {descriptionText && <Text>{descriptionText}</Text>}
60
+ {children}
61
+ {footnote && (
65
62
  <HelperErrorText
63
+ additionalStyles={styles.helperErrorText}
66
64
  id={`${id}-helperText`}
67
65
  isInvalid={isInvalid}
68
66
  text={footnote}
69
67
  />
70
- </Box>
71
- )}
72
- </Box>
73
- );
74
- }
68
+ )}
69
+ </Box>
70
+ );
71
+ }
72
+ );
75
73
 
76
74
  export default ComponentWrapper;
@@ -2,16 +2,16 @@
2
2
 
3
3
  exports[`ComponentWrapper Renders the UI snapshot correctly 1`] = `
4
4
  <div
5
- className="css-0"
5
+ className="css-1xdhyk6"
6
6
  >
7
7
  <h2
8
- className="chakra-heading css-0"
8
+ className="chakra-heading css-1xdhyk6"
9
9
  id="id-heading"
10
10
  >
11
11
  heading text
12
12
  </h2>
13
13
  <p
14
- className="chakra-text css-0"
14
+ className="chakra-text css-1xdhyk6"
15
15
  >
16
16
  description text
17
17
  </p>
@@ -19,27 +19,23 @@ exports[`ComponentWrapper Renders the UI snapshot correctly 1`] = `
19
19
  children elements
20
20
  </div>
21
21
  <div
22
- className="css-0"
23
- >
24
- <div
25
- aria-atomic={true}
26
- aria-live="off"
27
- className=" css-0"
28
- dangerouslySetInnerHTML={
29
- Object {
30
- "__html": "helper text",
31
- }
22
+ aria-atomic={true}
23
+ aria-live="off"
24
+ className="css-1xdhyk6"
25
+ dangerouslySetInnerHTML={
26
+ Object {
27
+ "__html": "helper text",
32
28
  }
33
- data-isinvalid={false}
34
- id="id-helperText"
35
- />
36
- </div>
29
+ }
30
+ data-isinvalid={false}
31
+ id="id-helperText"
32
+ />
37
33
  </div>
38
34
  `;
39
35
 
40
36
  exports[`ComponentWrapper Renders the UI snapshot correctly 2`] = `
41
37
  <div
42
- className="css-0"
38
+ className="css-1xdhyk6"
43
39
  >
44
40
  <div>
45
41
  children elements
@@ -49,16 +45,16 @@ exports[`ComponentWrapper Renders the UI snapshot correctly 2`] = `
49
45
 
50
46
  exports[`ComponentWrapper Renders the UI snapshot correctly 3`] = `
51
47
  <div
52
- className="css-0"
48
+ className="css-1xdhyk6"
53
49
  >
54
50
  <h2
55
- className="chakra-heading css-0"
51
+ className="chakra-heading css-1xdhyk6"
56
52
  id="id-heading"
57
53
  >
58
54
  heading text
59
55
  </h2>
60
56
  <p
61
- className="chakra-text css-0"
57
+ className="chakra-text css-1xdhyk6"
62
58
  >
63
59
  description text
64
60
  </p>
@@ -66,20 +62,37 @@ exports[`ComponentWrapper Renders the UI snapshot correctly 3`] = `
66
62
  children elements
67
63
  </div>
68
64
  <div
69
- className="css-0"
70
- >
71
- <div
72
- aria-atomic={true}
73
- aria-live="polite"
74
- className=" css-0"
75
- dangerouslySetInnerHTML={
76
- Object {
77
- "__html": "invalid text",
78
- }
65
+ aria-atomic={true}
66
+ aria-live="polite"
67
+ className="css-1xdhyk6"
68
+ dangerouslySetInnerHTML={
69
+ Object {
70
+ "__html": "invalid text",
79
71
  }
80
- data-isinvalid={true}
81
- id="id-helperText"
82
- />
72
+ }
73
+ data-isinvalid={true}
74
+ id="id-helperText"
75
+ />
76
+ </div>
77
+ `;
78
+
79
+ exports[`ComponentWrapper Renders the UI snapshot correctly 4`] = `
80
+ <div
81
+ className="css-kle7zy"
82
+ >
83
+ <div>
84
+ children elements
85
+ </div>
86
+ </div>
87
+ `;
88
+
89
+ exports[`ComponentWrapper Renders the UI snapshot correctly 5`] = `
90
+ <div
91
+ className="css-1xdhyk6"
92
+ data-testid="props"
93
+ >
94
+ <div>
95
+ children elements
83
96
  </div>
84
97
  </div>
85
98
  `;
@@ -67,7 +67,7 @@ export const enumValues = getStorybookEnumValues(
67
67
  showLabel: {
68
68
  table: { defaultValue: { summary: true } },
69
69
  },
70
- showOptReqLabel: {
70
+ showRequiredLabel: {
71
71
  table: { defaultValue: { summary: true } },
72
72
  },
73
73
  }}
@@ -78,7 +78,20 @@ export const enumValues = getStorybookEnumValues(
78
78
  | Component Version | DS Version |
79
79
  | ----------------- | ---------- |
80
80
  | Added | `0.24.0` |
81
- | Latest | `0.25.10` |
81
+ | Latest | `0.26.0` |
82
+
83
+ ## Table of Contents
84
+
85
+ - [Overview](#overview)
86
+ - [Component Props](#component-props)
87
+ - [Accessibility](#accessibility)
88
+ - [Date Range](#date-range)
89
+ - [Calendar Types](#calendar-types)
90
+ - [Other States](#other-states)
91
+ - [Date Inputs and Output](#date-inputs-and-output)
92
+ - [Getting Date Input Values](#getting-date-input-values)
93
+
94
+ ## Overview
82
95
 
83
96
  <Description of={DatePicker} />
84
97
 
@@ -86,6 +99,8 @@ This is fully customizable to allow selectable full dates, only the month, or
86
99
  only they year as input. Initial date values and max and min date values can
87
100
  also be added through props.
88
101
 
102
+ ## Component Props
103
+
89
104
  <Canvas withToolbar>
90
105
  <Story
91
106
  name="DatePicker with Controls"
@@ -97,33 +112,58 @@ also be added through props.
97
112
  helperTextFrom: "Select start date.",
98
113
  helperTextTo: "Select end date.",
99
114
  id: "datePicker-id",
100
- initialDate: "1/1/2021",
101
- initialDateTo: "1/30/2021",
115
+ initialDate: "4/1/2022",
116
+ initialDateTo: "12/1/2022",
102
117
  invalidText: "Please select a valid date.",
103
118
  isDateRange: false,
104
119
  isDisabled: false,
105
120
  isInvalid: false,
106
121
  isRequired: false,
107
122
  labelText: "Select the date you want to visit NYPL",
108
- maxDate: "1/1/2022",
109
- minDate: "1/1/2021",
123
+ maxDate: "1/1/2023",
124
+ minDate: "1/1/2022",
110
125
  nameFrom: "visit-dates-from",
111
126
  nameTo: "visit-dates-to",
112
127
  onChange: undefined,
113
128
  refTo: undefined,
114
129
  showHelperInvalidText: true,
115
130
  showLabel: true,
116
- showOptReqLabel: true,
131
+ showRequiredLabel: true,
117
132
  }}
118
133
  >
119
134
  {(args) => (
120
- <DatePicker {...args} dateType={enumValues.getValue(args.dateType)} />
135
+ <DatePicker
136
+ {...args}
137
+ dateType={enumValues.getValue(args.dateType)}
138
+ onChange={undefined}
139
+ />
121
140
  )}
122
141
  </Story>
123
142
  </Canvas>
124
143
 
125
144
  <ArgsTable story="DatePicker with Controls" />
126
145
 
146
+ ## Accessibility
147
+
148
+ The Reservoir `DatePicker` component implements the `react-datepicker` npm package.
149
+ This package exports a component that is used internally to display the popup
150
+ calendar, manage its data, and associate the `<label>` element with its corresponding
151
+ `<input>` element. This component is accessible through keyboard navigation.
152
+
153
+ The Reservoir `DatePicker` handles the grouping of the two `<input>` elements in
154
+ the "date range" mode by wrapping the elements in a `<fieldset>` element with
155
+ its own `<legend>` label for the group. Note that this is in addition to the two
156
+ labels that each `<input>` element is associated with.
157
+
158
+ When `showLabel` is set to false, the single `<input>` element's `aria-label`
159
+ attribute is set to the required `labelText` value. In the "date range" mode,
160
+ when `showLabel` is set to false, the `<fieldset>`'s `<legend>` will have the
161
+ `labelText` visually hidden.
162
+
163
+ Resources:
164
+
165
+ - [react-datepicker Accessibility](https://github.com/Hacker0x01/react-datepicker#accessibility)
166
+
127
167
  ## Date Range
128
168
 
129
169
  A date range can be rendered by setting the `isDateRange` prop to `true`. This
@@ -133,8 +173,8 @@ will share the props and styling. Note that for date range types, a `fieldset`
133
173
  is used as the parent wrapper and the `labelText` is used for the `legend`
134
174
  element text.
135
175
 
136
- Note: In the following example, the minimum date is "1/1/2021" and the max date
137
- is "3/1/21". This means only values within this range are selectable from the
176
+ Note: In the following example, the minimum date is "1/1/2022" and the max date
177
+ is "7/1/22". This means only values within this range are selectable from the
138
178
  popup calendar.
139
179
 
140
180
  <Canvas withToolbar>
@@ -143,8 +183,8 @@ popup calendar.
143
183
  id="date-range"
144
184
  dateFormat="yyyy-MM-dd"
145
185
  dateType={DatePickerTypes.Full}
146
- minDate="1/1/2021"
147
- maxDate="3/1/2021"
186
+ minDate="1/1/2022"
187
+ maxDate="7/1/2022"
148
188
  labelText="Select the date range you want to visit NYPL"
149
189
  nameFrom="visit-dates-from"
150
190
  nameTo="visit-dates-to"
@@ -152,7 +192,6 @@ popup calendar.
152
192
  helperTextTo="To this date."
153
193
  helperText="Select a valid date range."
154
194
  invalidText="There was an error with the date range :("
155
- showOptReqLabel={false}
156
195
  isDateRange
157
196
  />
158
197
  </Story>
@@ -198,7 +237,6 @@ calendar; the four previous years, the current year, and the next seven years.
198
237
  dateType={DatePickerTypes.Year}
199
238
  labelText="Select the year you want to visit NYPL"
200
239
  helperText="Note that the Library may be closed on Sundays."
201
- showOptReqLabel={false}
202
240
  />
203
241
  </Story>
204
242
  </Canvas>
@@ -215,7 +253,6 @@ calendar; the four previous years, the current year, and the next seven years.
215
253
  labelText="Select the year you want to visit NYPL"
216
254
  helperText="Note that the Library may be closed on Sundays."
217
255
  invalidText="Please select a valid date."
218
- showOptReqLabel={false}
219
256
  isInvalid
220
257
  isDateRange
221
258
  />
@@ -230,7 +267,6 @@ calendar; the four previous years, the current year, and the next seven years.
230
267
  id="disabled-date"
231
268
  dateType={DatePickerTypes.Full}
232
269
  labelText="Select the year you want to visit NYPL"
233
- showOptReqLabel={false}
234
270
  isDateRange
235
271
  isDisabled
236
272
  />
@@ -239,8 +275,8 @@ calendar; the four previous years, the current year, and the next seven years.
239
275
 
240
276
  ### Required State
241
277
 
242
- The "Required" or "Optional" text in the legend in the date range, or the label
243
- in a normal date input, can be hidden when `showOptReqLabel` is set to `false`.
278
+ The "Required" text in the legend in the date range, or the label in a normal
279
+ date input, can be hidden when `showRequiredLabel` is set to `false`.
244
280
 
245
281
  <Canvas>
246
282
  <DSProvider>
@@ -302,7 +338,7 @@ written in [ISO-8601 format](https://www.w3.org/TR/NOTE-datetime).
302
338
 
303
339
  The maximum and minimum date values can be set through the `maxDate` and
304
340
  `minDate` props, respectively. In this example, go back to January through
305
- February to see the dates that are available to select.
341
+ February to see the dates that are available to select in 2022.
306
342
 
307
343
  <Canvas>
308
344
  <DSProvider>
@@ -311,22 +347,22 @@ February to see the dates that are available to select.
311
347
  dateFormat="MM-dd-yyyy"
312
348
  dateType={DatePickerTypes.Full}
313
349
  labelText="Select the date you want to visit NYPL"
314
- minDate="1/1/2021"
315
- maxDate="3/1/2021"
350
+ minDate="1/1/2022"
351
+ maxDate="3/1/2022"
316
352
  isDateRange
317
353
  />
318
354
  </DSProvider>
319
355
  </Canvas>
320
356
 
321
- ## Getting Date Data Values
357
+ ## Getting Date Input Values
322
358
 
323
359
  ### Controlled Component Using `onChange` prop
324
360
 
325
- If your application uses controlled React components and the DS DatePicker must
326
- be controlled, you can extract the data through the `onChange` prop function.
327
- This will be called every time the date is updated in either the start date
328
- input field or the end date input field. The returned data is an object with
329
- `startDate` and `endDate` keys and `Date` object values.
361
+ If your application uses controlled React components and the Reservoir Design
362
+ System (DS) DatePicker must be controlled, you can extract the data through the
363
+ `onChange` prop function. This will be called every time the date is updated in
364
+ either the start date input field or the end date input field. The returned
365
+ data is an object with `startDate` and `endDate` keys and `Date` object values.
330
366
 
331
367
  ```tsx
332
368
  const onChange = (data) => {