@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
@@ -28,7 +28,10 @@ const monthArray = [
28
28
  describe("DatePicker Accessibility", () => {
29
29
  it("passes axe accessibility for a single date input", async () => {
30
30
  const { container } = render(
31
- <DatePicker labelText="Select the date you want to visit NYPL" />
31
+ <DatePicker
32
+ id="datePicker"
33
+ labelText="Select the date you want to visit NYPL"
34
+ />
32
35
  );
33
36
  expect(await axe(container)).toHaveNoViolations();
34
37
  });
@@ -36,6 +39,7 @@ describe("DatePicker Accessibility", () => {
36
39
  it("passes axe accessibility for a date range", async () => {
37
40
  const { container } = render(
38
41
  <DatePicker
42
+ id="datePicker"
39
43
  labelText="Select the date range you want to visit NYPL"
40
44
  isDateRange
41
45
  />
@@ -67,7 +71,10 @@ describe("DatePicker", () => {
67
71
  describe("Single input", () => {
68
72
  it("should render the basic date input field including a date", () => {
69
73
  render(
70
- <DatePicker labelText="Select the full date you want to visit NYPL" />
74
+ <DatePicker
75
+ id="datePicker"
76
+ labelText="Select the full date you want to visit NYPL"
77
+ />
71
78
  );
72
79
  const [year, month, day] = getTodaysValues();
73
80
  const date = getTodaysDateDisplay();
@@ -85,6 +92,7 @@ describe("DatePicker", () => {
85
92
  it("should render with an initial date", () => {
86
93
  render(
87
94
  <DatePicker
95
+ id="datePicker"
88
96
  labelText="Select the full date you want to visit NYPL"
89
97
  initialDate="1/2/1988"
90
98
  />
@@ -97,6 +105,7 @@ describe("DatePicker", () => {
97
105
  it("should render the 'month' DatePicker type", () => {
98
106
  render(
99
107
  <DatePicker
108
+ id="datePicker"
100
109
  dateType={DatePickerTypes.Month}
101
110
  labelText="Select the month you want to visit NYPL"
102
111
  />
@@ -115,6 +124,7 @@ describe("DatePicker", () => {
115
124
  it("should render the 'year' DatePicker type", () => {
116
125
  render(
117
126
  <DatePicker
127
+ id="datePicker"
118
128
  dateType={DatePickerTypes.Year}
119
129
  labelText="Select the month you want to visit NYPL"
120
130
  />
@@ -135,6 +145,7 @@ describe("DatePicker", () => {
135
145
  const customDateFormat2 = "MM/dd/yyyy";
136
146
  const { rerender } = render(
137
147
  <DatePicker
148
+ id="datePicker"
138
149
  labelText="Select the date you want to visit NYPL"
139
150
  dateFormat={customDateFormat1}
140
151
  />
@@ -147,6 +158,7 @@ describe("DatePicker", () => {
147
158
  const dateFormat2 = `${month}/${day}/${year}`;
148
159
  rerender(
149
160
  <DatePicker
161
+ id="datePicker"
150
162
  labelText="Select the date you want to visit NYPL"
151
163
  dateFormat={customDateFormat2}
152
164
  />
@@ -157,6 +169,7 @@ describe("DatePicker", () => {
157
169
  it("should hide the input label but add an aria-label", () => {
158
170
  render(
159
171
  <DatePicker
172
+ id="datePicker"
160
173
  labelText="Select the date you want to visit NYPL"
161
174
  showLabel={false}
162
175
  />
@@ -174,6 +187,7 @@ describe("DatePicker", () => {
174
187
  it("should render with helper text and error text", () => {
175
188
  const { rerender } = render(
176
189
  <DatePicker
190
+ id="datePicker"
177
191
  labelText="Select the date you want to visit NYPL"
178
192
  helperText="Note that the Library may be closed on Sundays."
179
193
  invalidText="Please select a valid date."
@@ -193,6 +207,7 @@ describe("DatePicker", () => {
193
207
 
194
208
  rerender(
195
209
  <DatePicker
210
+ id="datePicker"
196
211
  labelText="Select the date you want to visit NYPL"
197
212
  helperText="Note that the Library may be closed on Sundays."
198
213
  invalidText="Please select a valid date."
@@ -211,6 +226,7 @@ describe("DatePicker", () => {
211
226
  it("should not render the helper text or invalid text when 'showHelperInvalidText' is false", () => {
212
227
  const { rerender } = render(
213
228
  <DatePicker
229
+ id="datePicker"
214
230
  labelText="Select the date you want to visit NYPL"
215
231
  helperText="Note that the Library may be closed on Sundays."
216
232
  invalidText="Please select a valid date."
@@ -226,6 +242,7 @@ describe("DatePicker", () => {
226
242
 
227
243
  rerender(
228
244
  <DatePicker
245
+ id="datePicker"
229
246
  labelText="Select the date you want to visit NYPL"
230
247
  helperText="Note that the Library may be closed on Sundays."
231
248
  invalidText="Please select a valid date."
@@ -244,6 +261,7 @@ describe("DatePicker", () => {
244
261
  it("should render a disabled input field", () => {
245
262
  render(
246
263
  <DatePicker
264
+ id="datePicker"
247
265
  labelText="Select the date you want to visit NYPL"
248
266
  helperText="Note that the Library may be closed on Sundays."
249
267
  isDisabled
@@ -258,6 +276,7 @@ describe("DatePicker", () => {
258
276
  it("should render a required label", () => {
259
277
  render(
260
278
  <DatePicker
279
+ id="datePicker"
261
280
  labelText="Select the date you want to visit NYPL"
262
281
  helperText="Note that the Library may be closed on Sundays."
263
282
  isRequired
@@ -267,22 +286,18 @@ describe("DatePicker", () => {
267
286
  expect(screen.getByText(/required/i)).toBeInTheDocument();
268
287
  });
269
288
 
270
- it("should hide the Optional/Required text in the label with `showOptReqLabel`", () => {
289
+ it("should hide the (Required) text in the label with `showRequiredLabel`", () => {
271
290
  const { rerender } = render(
272
- <DatePicker labelText="Select the date you want to visit NYPL" />
273
- );
274
- expect(screen.getByText(/Optional/i)).toBeInTheDocument();
275
-
276
- rerender(
277
291
  <DatePicker
292
+ id="datePicker"
278
293
  labelText="Select the date you want to visit NYPL"
279
- showOptReqLabel={false}
280
294
  />
281
295
  );
282
- expect(screen.queryByText(/Optional/i)).not.toBeInTheDocument();
296
+ expect(screen.queryByText(/Required/i)).not.toBeInTheDocument();
283
297
 
284
298
  rerender(
285
299
  <DatePicker
300
+ id="datePicker"
286
301
  labelText="Select the date you want to visit NYPL"
287
302
  isRequired
288
303
  />
@@ -291,8 +306,9 @@ describe("DatePicker", () => {
291
306
 
292
307
  rerender(
293
308
  <DatePicker
309
+ id="datePicker"
294
310
  labelText="Select the date you want to visit NYPL"
295
- showOptReqLabel={false}
311
+ showRequiredLabel={false}
296
312
  isRequired
297
313
  />
298
314
  );
@@ -306,6 +322,7 @@ describe("DatePicker", () => {
306
322
  };
307
323
  render(
308
324
  <DatePicker
325
+ id="datePicker"
309
326
  labelText="Select the date you want to visit NYPL"
310
327
  helperText="Note that the Library may be closed on Sundays."
311
328
  onChange={onChange}
@@ -339,12 +356,14 @@ describe("DatePicker", () => {
339
356
  const ref = React.createRef<TextInputRefType>();
340
357
  render(
341
358
  <DatePicker
359
+ id="datePicker"
342
360
  labelText="Select the date you want to visit NYPL"
343
361
  ref={ref}
344
362
  />
345
363
  );
346
364
  expect(warn).toHaveBeenCalledWith(
347
- "A `ref` or `refTo` prop was passed but not the equivalent `nameFrom` or `nameTo` prop."
365
+ "NYPL Reservoir DatePicker: A `ref` or `refTo` prop was passed but " +
366
+ "not the equivalent `nameFrom` or `nameTo` prop."
348
367
  );
349
368
  });
350
369
 
@@ -354,6 +373,7 @@ describe("DatePicker", () => {
354
373
  const onChange = (_data) => {};
355
374
  render(
356
375
  <DatePicker
376
+ id="datePicker"
357
377
  labelText="Select the date you want to visit NYPL"
358
378
  ref={ref}
359
379
  nameFrom="start-date"
@@ -361,7 +381,9 @@ describe("DatePicker", () => {
361
381
  />
362
382
  );
363
383
  expect(warn).toHaveBeenCalledWith(
364
- "React `ref` props were passed and an `onChange` prop as well. Use whichever is best for your app but not both."
384
+ "NYPL Reservoir DatePicker: A `ref`, `refTo`, `nameFrom`, or `nameTo` " +
385
+ "prop was passed and an `onChange` prop as well. Use whichever is best " +
386
+ "for your app but not both."
365
387
  );
366
388
  });
367
389
 
@@ -422,11 +444,39 @@ describe("DatePicker", () => {
422
444
  />
423
445
  )
424
446
  .toJSON();
447
+ const withChakraProps = renderer
448
+ .create(
449
+ <DatePicker
450
+ id="chakra"
451
+ labelText="Select the date you want to visit NYPL"
452
+ helperText="Note that the Library may be closed on Sundays."
453
+ invalidText="Please select a valid date."
454
+ initialDate="1/2/1988"
455
+ p="20px"
456
+ color="ui.error.primary"
457
+ />
458
+ )
459
+ .toJSON();
460
+ const withOtherProps = renderer
461
+ .create(
462
+ <DatePicker
463
+ id="props"
464
+ labelText="Select the date you want to visit NYPL"
465
+ helperText="Note that the Library may be closed on Sundays."
466
+ invalidText="Please select a valid date."
467
+ initialDate="1/2/1988"
468
+ data-testid="datepicker"
469
+ />
470
+ )
471
+ .toJSON();
472
+
425
473
  expect(basic).toMatchSnapshot();
426
474
  expect(withoutLabel).toMatchSnapshot();
427
475
  expect(withCustomFormat).toMatchSnapshot();
428
476
  expect(invalid).toMatchSnapshot();
429
477
  expect(disabled).toMatchSnapshot();
478
+ expect(withChakraProps).toMatchSnapshot();
479
+ expect(withOtherProps).toMatchSnapshot();
430
480
  });
431
481
  });
432
482
 
@@ -434,6 +484,7 @@ describe("DatePicker", () => {
434
484
  it("should render the date range with two input fields", () => {
435
485
  render(
436
486
  <DatePicker
487
+ id="datePicker"
437
488
  labelText="Select the date range you want to visit NYPL"
438
489
  isDateRange
439
490
  />
@@ -453,6 +504,7 @@ describe("DatePicker", () => {
453
504
  it("should render the initial dates", () => {
454
505
  render(
455
506
  <DatePicker
507
+ id="datePicker"
456
508
  labelText="Select the full date you want to visit NYPL"
457
509
  isDateRange
458
510
  initialDate="1/2/1988"
@@ -469,6 +521,7 @@ describe("DatePicker", () => {
469
521
  it("should render two input labels and three separate helper text", () => {
470
522
  render(
471
523
  <DatePicker
524
+ id="datePicker"
472
525
  labelText="Select the date range you want to visit NYPL"
473
526
  helperText="Note that the Library may be closed on Sundays."
474
527
  helperTextFrom="Note for the 'from' field."
@@ -495,6 +548,7 @@ describe("DatePicker", () => {
495
548
  it("should render different states based on respective props", () => {
496
549
  const { rerender } = render(
497
550
  <DatePicker
551
+ id="datePicker"
498
552
  labelText="Select the date range you want to visit NYPL"
499
553
  helperText="Note that the Library may be closed on Sundays."
500
554
  helperTextTo="Note for the 'to' field."
@@ -511,6 +565,7 @@ describe("DatePicker", () => {
511
565
 
512
566
  rerender(
513
567
  <DatePicker
568
+ id="datePicker"
514
569
  labelText="Select the date range you want to visit NYPL"
515
570
  helperText="Note that the Library may be closed on Sundays."
516
571
  helperTextTo="Note for the 'to' field."
@@ -525,6 +580,7 @@ describe("DatePicker", () => {
525
580
 
526
581
  rerender(
527
582
  <DatePicker
583
+ id="datePicker"
528
584
  labelText="Select the date range you want to visit NYPL"
529
585
  helperText="Note that the Library may be closed on Sundays."
530
586
  helperTextTo="Note for the 'to' field."
@@ -535,7 +591,7 @@ describe("DatePicker", () => {
535
591
  );
536
592
  // Both input fields are required.
537
593
  // The "Required" text is only displayed once in the `legend`.
538
- expect(screen.getAllByText(/required/i)).toHaveLength(1);
594
+ expect(screen.getAllByText(/Required/i)).toHaveLength(1);
539
595
  expect(screen.getByLabelText(/From/i)).toHaveAttribute("required");
540
596
  expect(screen.getByLabelText(/To/i)).toHaveAttribute("required");
541
597
  });
@@ -617,6 +673,7 @@ describe("DatePicker", () => {
617
673
  it("should select two new dates", () => {
618
674
  render(
619
675
  <DatePicker
676
+ id="datePicker"
620
677
  initialDate="3/2/1988"
621
678
  initialDateTo="3/28/1988"
622
679
  isDateRange
@@ -659,7 +716,12 @@ describe("DatePicker", () => {
659
716
 
660
717
  describe("Popup Calendar", () => {
661
718
  it("should render a popup calendar for the full date", () => {
662
- render(<DatePicker labelText="Select the date you want to visit NYPL" />);
719
+ render(
720
+ <DatePicker
721
+ id="datePicker"
722
+ labelText="Select the date you want to visit NYPL"
723
+ />
724
+ );
663
725
  const input = screen.getByLabelText(
664
726
  /Select the date you want to visit NYPL/i
665
727
  );
@@ -689,6 +751,7 @@ describe("DatePicker", () => {
689
751
  it("should select a new date from the calendar", () => {
690
752
  render(
691
753
  <DatePicker
754
+ id="datePicker"
692
755
  labelText="Select the date you want to visit NYPL"
693
756
  initialDate="08/01/2021"
694
757
  />
@@ -733,6 +796,7 @@ describe("DatePicker", () => {
733
796
  it("should render a popup calendar for the month date", () => {
734
797
  render(
735
798
  <DatePicker
799
+ id="datePicker"
736
800
  dateType={DatePickerTypes.Month}
737
801
  labelText="Select the month you want to visit NYPL"
738
802
  />
@@ -759,6 +823,7 @@ describe("DatePicker", () => {
759
823
  it("should select a new month from the calendar", () => {
760
824
  render(
761
825
  <DatePicker
826
+ id="datePicker"
762
827
  dateType={DatePickerTypes.Month}
763
828
  initialDate="4/1/1988"
764
829
  labelText="Select the month you want to visit NYPL"
@@ -798,6 +863,7 @@ describe("DatePicker", () => {
798
863
  it("should render a popup calendar for the year date", () => {
799
864
  render(
800
865
  <DatePicker
866
+ id="datePicker"
801
867
  dateType={DatePickerTypes.Year}
802
868
  labelText="Select the year you want to visit NYPL"
803
869
  />
@@ -835,6 +901,7 @@ describe("DatePicker", () => {
835
901
  it("should select a new year from the calendar", () => {
836
902
  render(
837
903
  <DatePicker
904
+ id="datePicker"
838
905
  dateType={DatePickerTypes.Year}
839
906
  labelText="Select the year you want to visit NYPL"
840
907
  />
@@ -855,5 +922,17 @@ describe("DatePicker", () => {
855
922
 
856
923
  expect(screen.getByDisplayValue("2024")).toBeInTheDocument();
857
924
  });
925
+
926
+ it("logs a warning when there is no `id` passed", () => {
927
+ const warn = jest.spyOn(console, "warn");
928
+ render(
929
+ // @ts-ignore: Typescript complains when a required prop is not passed, but
930
+ // here we don't want to pass the required prop to make sure the warning appears.
931
+ <DatePicker labelText="Select the year you want to visit NYPL" />
932
+ );
933
+ expect(warn).toHaveBeenCalledWith(
934
+ "NYPL Reservoir DatePicker: This component's required `id` prop was not passed."
935
+ );
936
+ });
858
937
  });
859
938
  });
@@ -1,3 +1,4 @@
1
+ import { chakra, useMultiStyleConfig } from "@chakra-ui/react";
1
2
  import React, { useState, forwardRef } from "react";
2
3
  import ReactDatePicker from "react-datepicker";
3
4
 
@@ -8,13 +9,10 @@ import { FormGaps } from "../Form/FormTypes";
8
9
  import HelperErrorText, {
9
10
  HelperErrorTextType,
10
11
  } from "../HelperErrorText/HelperErrorText";
11
- import { helperTextMargin } from "../../theme/components/global";
12
12
  import TextInput, {
13
13
  InputProps,
14
14
  TextInputRefType,
15
15
  } from "../TextInput/TextInput";
16
- import generateUUID from "../../helpers/generateUUID";
17
- import { Box, useMultiStyleConfig } from "@chakra-ui/react";
18
16
 
19
17
  // The object shape for the DatePicker's start and end date state values.
20
18
  export interface FullDateType {
@@ -28,7 +26,7 @@ export interface FullDateType {
28
26
  // Used for the input fields' parent wrapper. Internal use only.
29
27
  interface DateRangeRowProps {
30
28
  /** ID that other components can cross reference for accessibility purposes. */
31
- id?: string;
29
+ id: string;
32
30
  /** Whether to render a single date input or two for a range of two dates. */
33
31
  isDateRange?: boolean;
34
32
  }
@@ -44,16 +42,17 @@ interface DatePickerWrapperProps extends DateRangeRowProps {
44
42
  labelText: string;
45
43
  /** Offers the ability to show the label onscreen or hide it. */
46
44
  showLabel?: boolean;
47
- /** Whether or not to display the "Required"/"Optional" text in the label text. */
48
- showOptReqLabel?: boolean;
45
+ /** Whether or not to display the "(Required)" text in the label text.
46
+ * True by default. */
47
+ showRequiredLabel?: boolean;
49
48
  }
50
49
 
51
50
  // Interface used by the internal DS `TextInput` component as a custom
52
51
  // component for the ReactDatePicker plugin component. Internal use only.
53
- interface CustomTextInputProps extends InputProps {
52
+ interface CustomTextInputProps extends Partial<InputProps> {
54
53
  /** The ReactDatePicker plugin has its own `id` prop so we use this to pass the
55
54
  * value from the parent `DatePicker` component. */
56
- dsId?: string;
55
+ dsId: string;
57
56
  /** The ReactDatePicker plugin manipulates the ref value so we declare our
58
57
  * own for some cases. */
59
58
  dsRef?: React.Ref<TextInputRefType>;
@@ -62,8 +61,6 @@ interface CustomTextInputProps extends InputProps {
62
61
  isRequired?: boolean;
63
62
  /** Event handler used by the ReactDatePicker plugin to open the popup calendar. */
64
63
  onClick?: (data: any) => any;
65
- /** Whether or not to display the "Required"/"Optional" text in the label text. */
66
- showOptReqLabel?: boolean;
67
64
  /** Data value used by the ReactDatePicker plugin and the custom TextInput component. */
68
65
  value?: string;
69
66
  }
@@ -114,8 +111,6 @@ export interface DatePickerProps extends DatePickerWrapperProps {
114
111
  refTo?: React.Ref<TextInputRefType>;
115
112
  /** Offers the ability to hide the helper/invalid text. */
116
113
  showHelperInvalidText?: boolean;
117
- /** Whether or not to display the "Required"/"Optional" text in the label text. */
118
- showOptReqLabel?: boolean;
119
114
  }
120
115
 
121
116
  /**
@@ -143,7 +138,7 @@ const CustomTextInput = forwardRef<TextInputRefType, CustomTextInputProps>(
143
138
  onClick,
144
139
  showLabel,
145
140
  showHelperInvalidText,
146
- showOptReqLabel,
141
+ showRequiredLabel,
147
142
  value,
148
143
  },
149
144
  ref: React.Ref<TextInputRefType>
@@ -157,7 +152,7 @@ const CustomTextInput = forwardRef<TextInputRefType, CustomTextInputProps>(
157
152
  isDisabled={isDisabled}
158
153
  isRequired={isRequired}
159
154
  showHelperInvalidText={showHelperInvalidText}
160
- showOptReqLabel={showOptReqLabel}
155
+ showRequiredLabel={showRequiredLabel}
161
156
  isInvalid={isInvalid}
162
157
  helperText={helperText}
163
158
  invalidText={invalidText}
@@ -177,32 +172,36 @@ const CustomTextInput = forwardRef<TextInputRefType, CustomTextInputProps>(
177
172
  * for a date range we render a "fieldset".
178
173
  * @note This is only used internally for this file.
179
174
  */
180
- const DatePickerWrapper: React.FC<DatePickerWrapperProps> = ({
181
- children,
182
- className,
183
- id,
184
- isDateRange,
185
- isRequired,
186
- labelText,
187
- showLabel,
188
- showOptReqLabel,
189
- }) => (
190
- <FormField id={`${id}-form-field}`}>
191
- {isDateRange ? (
192
- <Fieldset
193
- id={id}
194
- className={className}
195
- isLegendHidden={!showLabel}
196
- legendText={labelText}
197
- optReqFlag={showOptReqLabel}
198
- isRequired={isRequired}
199
- >
200
- {children}
201
- </Fieldset>
202
- ) : (
203
- children
204
- )}
205
- </FormField>
175
+ const DatePickerWrapper: React.FC<DatePickerWrapperProps> = chakra(
176
+ ({
177
+ children,
178
+ className,
179
+ id,
180
+ isDateRange,
181
+ isRequired,
182
+ labelText,
183
+ showLabel,
184
+ showRequiredLabel,
185
+ ...rest
186
+ }) => (
187
+ <FormField id={`${id}-form-field`} {...rest}>
188
+ {isDateRange ? (
189
+ <Fieldset
190
+ className={className}
191
+ id={id}
192
+ isLegendHidden={!showLabel}
193
+ isRequired={isRequired}
194
+ legendText={labelText}
195
+ showRequiredLabel={showRequiredLabel}
196
+ >
197
+ {children}
198
+ </Fieldset>
199
+ ) : (
200
+ children
201
+ )}
202
+ </FormField>
203
+ ),
204
+ { shouldForwardProp: () => true }
206
205
  );
207
206
 
208
207
  /**
@@ -227,8 +226,8 @@ const DateRangeRow: React.FC<DateRangeRowProps> = ({
227
226
  /**
228
227
  * Returns a single date input field or two date input fields for a date range.
229
228
  */
230
- const DatePicker = React.forwardRef<TextInputRefType, DatePickerProps>(
231
- (props, ref?) => {
229
+ export const DatePicker = chakra(
230
+ React.forwardRef<TextInputRefType, DatePickerProps>((props, ref?) => {
232
231
  const {
233
232
  className,
234
233
  dateFormat = "yyyy-MM-dd",
@@ -236,7 +235,7 @@ const DatePicker = React.forwardRef<TextInputRefType, DatePickerProps>(
236
235
  helperText,
237
236
  helperTextFrom,
238
237
  helperTextTo,
239
- id = generateUUID(),
238
+ id,
240
239
  initialDate,
241
240
  initialDateTo,
242
241
  invalidText,
@@ -253,7 +252,8 @@ const DatePicker = React.forwardRef<TextInputRefType, DatePickerProps>(
253
252
  refTo,
254
253
  showHelperInvalidText = true,
255
254
  showLabel = true,
256
- showOptReqLabel = true,
255
+ showRequiredLabel = true,
256
+ ...rest
257
257
  } = props;
258
258
  const styles = useMultiStyleConfig("DatePicker", {});
259
259
  const finalStyles = isDateRange ? styles : {};
@@ -294,9 +294,9 @@ const DatePicker = React.forwardRef<TextInputRefType, DatePickerProps>(
294
294
  let baseCustomTextInputAttrs = {
295
295
  dsId: `${id}-start`,
296
296
  isRequired,
297
- // In the date range type, don't display the "required"/"optional" text
298
- // in individual input labels. It'll display in the legend element.
299
- showOptReqLabel: isDateRange ? false : showOptReqLabel,
297
+ // In the date range type, don't display the "(Required)" text in
298
+ // individual input labels. It'll display in the legend element.
299
+ showRequiredLabel: isDateRange ? false : showRequiredLabel,
300
300
  // Always display the labels for the input fields when
301
301
  // the DatePicker component is a date range type.
302
302
  showLabel: isDateRange ? true : showLabel,
@@ -325,14 +325,23 @@ const DatePicker = React.forwardRef<TextInputRefType, DatePickerProps>(
325
325
  baseDatePickerAttrs.dateFormat = "yyyy";
326
326
  }
327
327
 
328
+ if (!id) {
329
+ console.warn(
330
+ "NYPL Reservoir DatePicker: This component's required `id` prop was not passed."
331
+ );
332
+ }
333
+
328
334
  if ((ref && !nameFrom) || (refTo && !nameTo)) {
329
335
  console.warn(
330
- "A `ref` or `refTo` prop was passed but not the equivalent `nameFrom` or `nameTo` prop."
336
+ "NYPL Reservoir DatePicker: A `ref` or `refTo` prop was passed but " +
337
+ "not the equivalent `nameFrom` or `nameTo` prop."
331
338
  );
332
339
  }
333
340
  if (onChange && (ref || refTo || nameFrom || nameTo)) {
334
341
  console.warn(
335
- "React `ref` props were passed and an `onChange` prop as well. Use whichever is best for your app but not both."
342
+ "NYPL Reservoir DatePicker: A `ref`, `refTo`, `nameFrom`, or `nameTo` " +
343
+ "prop was passed and an `onChange` prop as well. Use whichever is best " +
344
+ "for your app but not both."
336
345
  );
337
346
  }
338
347
 
@@ -405,7 +414,8 @@ const DatePicker = React.forwardRef<TextInputRefType, DatePickerProps>(
405
414
  labelText={labelText}
406
415
  className={className}
407
416
  isRequired={isRequired}
408
- showOptReqLabel={showOptReqLabel}
417
+ showRequiredLabel={showRequiredLabel}
418
+ {...rest}
409
419
  >
410
420
  <DateRangeRow id={id} isDateRange={isDateRange}>
411
421
  <FormField id={`${id}-start-form`}>
@@ -417,17 +427,16 @@ const DatePicker = React.forwardRef<TextInputRefType, DatePickerProps>(
417
427
  )}
418
428
  </DateRangeRow>
419
429
  {helperText && isDateRange && showHelperInvalidText && (
420
- <Box __css={helperTextMargin}>
421
- <HelperErrorText
422
- id={`${id}-helper-text`}
423
- isInvalid={false}
424
- text={helperText}
425
- />
426
- </Box>
430
+ <HelperErrorText
431
+ id={`${id}-helper-text`}
432
+ isInvalid={false}
433
+ text={helperText}
434
+ />
427
435
  )}
428
436
  </DatePickerWrapper>
429
437
  );
430
- }
438
+ }),
439
+ { shouldForwardProp: () => true }
431
440
  );
432
441
 
433
442
  export default DatePicker;