@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
@@ -11,9 +11,8 @@ import { withDesign } from "storybook-addon-designs";
11
11
  import Button from "../Button/Button";
12
12
  import { ButtonTypes } from "../Button/ButtonTypes";
13
13
  import Card, { CardHeading, CardContent, CardActions } from "./Card";
14
- import { CardLayouts } from "./CardTypes";
15
14
  import Heading from "../Heading/Heading";
16
- import { HeadingDisplaySizes, HeadingLevels } from "../Heading/HeadingTypes";
15
+ import { HeadingSizes, HeadingLevels } from "../Heading/HeadingTypes";
17
16
  import HorizontalRule from "../HorizontalRule/HorizontalRule";
18
17
  import Icon from "../Icons/Icon";
19
18
  import Image from "../Image/Image";
@@ -21,6 +20,7 @@ import { ImageRatios, ImageSizes } from "../Image/ImageTypes";
21
20
  import Link from "../Link/Link";
22
21
  import { LinkTypes } from "../Link/LinkTypes";
23
22
  import SimpleGrid from "../Grid/SimpleGrid";
23
+ import { LayoutTypes } from "../../helpers/enums";
24
24
  import { getCategory } from "../../utils/componentCategories";
25
25
  import DSProvider from "../../theme/provider";
26
26
  import { getStorybookEnumValues } from "../../utils/utils";
@@ -33,9 +33,9 @@ export const imageSizesEnumValues = getStorybookEnumValues(
33
33
  ImageSizes,
34
34
  "ImageSizes"
35
35
  );
36
- export const cardLayoutsEnumValues = getStorybookEnumValues(
37
- CardLayouts,
38
- "CardLayouts"
36
+ export const LayoutTypesEnumValues = getStorybookEnumValues(
37
+ LayoutTypes,
38
+ "LayoutTypes"
39
39
  );
40
40
 
41
41
  <Meta
@@ -51,39 +51,46 @@ export const cardLayoutsEnumValues = getStorybookEnumValues(
51
51
  }}
52
52
  argTypes={{
53
53
  backgroundColor: { control: { type: "color" } },
54
- border: {
55
- table: { defaultValue: { summary: false } },
56
- },
57
- center: {
58
- table: { defaultValue: { summary: false } },
59
- },
60
54
  className: { control: false },
61
55
  foregroundColor: { control: { type: "color" } },
62
56
  id: { control: false },
63
- imageAlt: {
57
+ imageProps: { disable: true },
58
+ "imageProps.alt": {
59
+ control: { type: "text" },
64
60
  table: { defaultValue: { summary: "" } },
65
61
  },
66
- imageAspectRatio: {
62
+ "imageProps.aspectRatio": {
67
63
  control: { type: "select" },
68
64
  table: { defaultValue: { summary: "ImageRatios.Square" } },
69
65
  options: imageRatiosEnumValues.options,
70
66
  },
71
- imageAtEnd: {
67
+ "imageProps.caption": { control: false },
68
+ "imageProps.component": { control: false },
69
+ "imageProps.credit": { control: false },
70
+ "imageProps.isAtEnd": {
72
71
  table: { defaultValue: { summary: false } },
73
72
  },
74
- imageComponent: { control: false },
75
- imageSize: {
73
+ "imageProps.size": {
76
74
  control: { type: "select" },
77
75
  table: { defaultValue: { summary: "ImageSizes.Default" } },
78
76
  options: imageSizesEnumValues.options,
79
77
  },
80
- imageSrc: {
78
+ "imageProps.src": {
81
79
  table: { defaultValue: { summary: "" } },
82
80
  },
81
+ isAlignedRightActions: {
82
+ table: { defaultValue: { summary: false } },
83
+ },
84
+ isBordered: {
85
+ table: { defaultValue: { summary: false } },
86
+ },
87
+ isCentered: {
88
+ table: { defaultValue: { summary: false } },
89
+ },
83
90
  layout: {
84
91
  control: { type: "radio" },
85
- table: { defaultValue: { summary: "CardLayouts.Column" } },
86
- options: cardLayoutsEnumValues.options,
92
+ table: { defaultValue: { summary: "LayoutTypes.Column" } },
93
+ options: LayoutTypesEnumValues.options,
87
94
  },
88
95
  }}
89
96
  />
@@ -93,7 +100,24 @@ export const cardLayoutsEnumValues = getStorybookEnumValues(
93
100
  | Component Version | DS Version |
94
101
  | ----------------- | ---------- |
95
102
  | Added | `0.24.0` |
96
- | Latest | `0.25.10` |
103
+ | Latest | `0.26.0` |
104
+
105
+ ## Table of Contents
106
+
107
+ - [Overview](#overview)
108
+ - [Component Props](#component-props)
109
+ - [Accessibility](#accessibility)
110
+ - [Image Position](#image-position)
111
+ - [Image Size](#image-size)
112
+ - [Custom Image Component](#custom-image-component)
113
+ - [Card With Link Heading](#card-with-link-heading)
114
+ - [Card With Full-Click Functionality](#card-with-full-click-functionality)
115
+ - [Card with Right Side CardActions](#card-with-right-side-cardactions)
116
+ - [Cards in a Grid](#cards-in-a-grid)
117
+ - [Cards in a Stack](#cards-in-a-stack)
118
+ - [Card Without Images](#card-without-images)
119
+
120
+ ## Overview
97
121
 
98
122
  <Description of={Card} />
99
123
 
@@ -105,48 +129,63 @@ order and each child component may be used multiple times within the content
105
129
  area. Although a `Card` is a self-contained unit, `Card` components are often
106
130
  grouped together and displayed in some type of grid layout.
107
131
 
108
- #### CardHeading
132
+ ### CardHeading
109
133
 
110
- The `CardHeading` component mirrors the standard DS `Heading` component and
111
- accepts the [same props](https://nypl.github.io/nypl-design-system/storybook-static/?path=/story/components-typography-styles-heading--heading-with-controls).
134
+ The `CardHeading` component mirrors the standard Reservoir Design System (DS)
135
+ `Heading` component and accepts the [same props](https://nypl.github.io/nypl-design-system/storybook-static/?path=/story/components-typography-styles-heading--heading-with-controls).
112
136
 
113
- #### CardActions
137
+ ### CardActions
114
138
 
115
139
  The `CardActions` component is used to display "call to action" (CTA) buttons
116
140
  and links for the card. The DS `Button` and `Link` components should be passed
117
141
  as children into the `CardActions` component.
118
142
 
119
- #### CardContent
143
+ Set the `isAlignedRightActions` prop to true in the `Card` component to align the
144
+ `CardActions` to the right of the the main content area. This is only applicable
145
+ in the row layout of the `Card` component.
146
+
147
+ ### CardContent
120
148
 
121
149
  The `CardContent` component should be used to display all content other than
122
150
  headings and CTAs.
123
151
 
152
+ ## Component Props
153
+
124
154
  <Canvas withToolbar>
125
155
  <Story
126
156
  name="Card with Controls"
127
157
  args={{
128
158
  backgroundColor: undefined,
129
- border: false,
130
- center: false,
131
159
  className: undefined,
132
160
  foregroundColor: undefined,
133
161
  id: "card-id",
134
- imageAlt: "Alt text",
135
- imageAspectRatio: "ImageRatios.Square",
136
- imageAtEnd: false,
137
- imageComponent: undefined,
138
- imageSize: "ImageSizes.Default",
139
- imageSrc: "https://placeimg.com/400/300/animals",
140
- layout: "CardLayouts.Row",
162
+ "imageProps.alt": "Alt text",
163
+ "imageProps.aspectRatio": "ImageRatios.Square",
164
+ "imageProps.component": undefined,
165
+ "imageProps.isAtEnd": false,
166
+ "imageProps.size": "ImageSizes.Default",
167
+ "imageProps.src": "https://placeimg.com/400/300/animals",
168
+ isAlignedRightActions: false,
169
+ isBordered: false,
170
+ isCentered: false,
171
+ layout: "LayoutTypes.Row",
141
172
  mainActionLink: undefined,
142
173
  }}
143
174
  >
144
175
  {(args) => (
145
176
  <Card
146
177
  {...args}
147
- imageAspectRatio={imageRatiosEnumValues.getValue(args.imageAspectRatio)}
148
- imageSize={imageSizesEnumValues.getValue(args.imageSize)}
149
- layout={cardLayoutsEnumValues.getValue(args.layout)}
178
+ imageProps={{
179
+ alt: args["imageProps.alt"],
180
+ aspectRatio: imageRatiosEnumValues.getValue(
181
+ args["imageProps.aspectRatio"]
182
+ ),
183
+ component: args["imageProps.component"],
184
+ isAtEnd: args["imageProps.isAtEnd"],
185
+ size: imageSizesEnumValues.getValue(args["imageProps.size"]),
186
+ src: args["imageProps.src"],
187
+ }}
188
+ layout={LayoutTypesEnumValues.getValue(args.layout)}
150
189
  >
151
190
  <CardHeading level={HeadingLevels.Two} id="main-heading1">
152
191
  Optional Header
@@ -161,17 +200,17 @@ headings and CTAs.
161
200
  </CardContent>
162
201
  <CardActions topBorder bottomBorder>
163
202
  <Button
164
- onClick={action("clicked")}
165
- id="main-button1"
166
203
  buttonType={ButtonTypes.Primary}
204
+ id="main-button1"
205
+ onClick={action("clicked")}
167
206
  type="submit"
168
207
  >
169
208
  Primary
170
209
  </Button>
171
210
  <Button
172
- onClick={action("clicked")}
173
- id="main-button2"
174
211
  buttonType={ButtonTypes.Secondary}
212
+ id="main-button2"
213
+ onClick={action("clicked")}
175
214
  type="submit"
176
215
  >
177
216
  Secondary
@@ -188,11 +227,45 @@ headings and CTAs.
188
227
 
189
228
  <ArgsTable story="Card with Controls" />
190
229
 
230
+ ## Accessibility
231
+
232
+ ### Headings
233
+
234
+ In general, headings from `h1` through `h6` must be in sequential order in the
235
+ DOM tree. Rendering an `h4` following an `h2` will throw an accessibility error.
236
+ Therefore, when adding `CardHeading` components, make sure to add them in
237
+ sequential order with the proper `level` prop.
238
+
239
+ ```tsx
240
+ // Correct
241
+ <CardHeading level={HeadingLevels.Three} id="headingthree">
242
+ Heading level three
243
+ </CardHeading>
244
+ <CardHeading level={HeadingLevels.Four} id="headingfour">
245
+ Heading level four
246
+ </CardHeading>
247
+
248
+ // Incorrect
249
+ <CardHeading level={HeadingLevels.Two} id="headingtwo">
250
+ Heading level Two
251
+ </CardHeading>
252
+ <CardHeading level={HeadingLevels.Four} id="headingfour">
253
+ Heading level four
254
+ </CardHeading>
255
+ ```
256
+
257
+ ### Full-Click Functionality
258
+
259
+ Passing in a URL in the `mainActionLink` prop will make the entire `Card`
260
+ clickable. Other links in the `CardActions` component can still be accessed by
261
+ tabbing through and pressing "enter" or by clicking as you normally would on a
262
+ link.
263
+
191
264
  ## Image Position
192
265
 
193
266
  By default, the image is always the first element within a `Card`. This means
194
267
  the image is at the top of a `Card` with a column layout and on the left side of
195
- a `Card` with a row layout. However, you can use the `imageAtEnd` boolean prop
268
+ a `Card` with a row layout. However, you can use the `imageProps.isAtEnd` boolean prop
196
269
  to override the default placement and move the image to the last element within
197
270
  a `Card`.
198
271
 
@@ -202,9 +275,11 @@ a `Card`.
202
275
  <Story name="Card Image Position">
203
276
  <SimpleGrid columns={2}>
204
277
  <Card
205
- imageAlt="Alt text"
206
- imageAspectRatio={ImageRatios.TwoByOne}
207
- imageSrc="https://placeimg.com/400/200/animals"
278
+ imageProps={{
279
+ alt: "Alt text",
280
+ aspectRatio: ImageRatios.TwoByOne,
281
+ src: "https://placeimg.com/400/200/animals",
282
+ }}
208
283
  >
209
284
  <CardHeading level={HeadingLevels.Three} id="props-heading1">
210
285
  Image on Top (default)
@@ -215,10 +290,12 @@ a `Card`.
215
290
  </CardContent>
216
291
  </Card>
217
292
  <Card
218
- imageAlt="Alt text"
219
- imageAspectRatio={ImageRatios.TwoByOne}
220
- imageAtEnd
221
- imageSrc="https://placeimg.com/410/210/animals"
293
+ imageProps={{
294
+ alt: "Alt text",
295
+ aspectRatio: ImageRatios.TwoByOne,
296
+ isAtEnd: true,
297
+ src: "https://placeimg.com/400/200/animals",
298
+ }}
222
299
  >
223
300
  <CardHeading level={HeadingLevels.Three} id="props-heading2">
224
301
  Image on Bottom
@@ -238,11 +315,13 @@ a `Card`.
238
315
  <DSProvider>
239
316
  <SimpleGrid columns={1}>
240
317
  <Card
241
- center
242
- imageAlt="Alt text"
243
- imageAspectRatio={ImageRatios.TwoByOne}
244
- imageSrc="https://placeimg.com/400/200/animals"
245
- layout={CardLayouts.Row}
318
+ imageProps={{
319
+ alt: "Alt text",
320
+ aspectRatio: ImageRatios.TwoByOne,
321
+ src: "https://placeimg.com/400/200/animals",
322
+ }}
323
+ isCentered
324
+ layout={LayoutTypes.Row}
246
325
  >
247
326
  <CardHeading level={HeadingLevels.Four} id="row-heading1">
248
327
  Image on Left (default)
@@ -254,12 +333,14 @@ a `Card`.
254
333
  </CardContent>
255
334
  </Card>
256
335
  <Card
257
- center
258
- imageAlt="Alt text"
259
- imageAspectRatio={ImageRatios.TwoByOne}
260
- imageAtEnd
261
- imageSrc="https://placeimg.com/410/210/animals"
262
- layout={CardLayouts.Row}
336
+ imageProps={{
337
+ alt: "Alt text",
338
+ aspectRatio: ImageRatios.TwoByOne,
339
+ isAtEnd: true,
340
+ src: "https://placeimg.com/400/200/animals",
341
+ }}
342
+ isCentered
343
+ layout={LayoutTypes.Row}
263
344
  >
264
345
  <CardHeading level={HeadingLevels.Four} id="row-heading2">
265
346
  Image on Right
@@ -277,7 +358,7 @@ a `Card`.
277
358
  ## Image Size
278
359
 
279
360
  By default, the image width is `100%` for a `Card` with a column layout and
280
- `225px` for a `Card` with a row layout. However, you can use the `imageSize`
361
+ `225px` for a `Card` with a row layout. However, you can use the `imageProps.size`
281
362
  prop to override the default width.
282
363
 
283
364
  ### Column Cards
@@ -286,11 +367,13 @@ prop to override the default width.
286
367
  <Story name="Card Image Size">
287
368
  <SimpleGrid columns={1}>
288
369
  <Card
289
- center
290
- imageAlt="Alt text"
291
- imageAspectRatio={ImageRatios.Square}
292
- imageSize={ImageSizes.ExtraExtraSmall}
293
- imageSrc="https://placeimg.com/400/200/animals"
370
+ imageProps={{
371
+ alt: "Alt text",
372
+ aspectRatio: ImageRatios.Square,
373
+ size: ImageSizes.ExtraExtraSmall,
374
+ src: "https://placeimg.com/400/200/animals",
375
+ }}
376
+ isCentered
294
377
  >
295
378
  <CardHeading level={HeadingLevels.Three} id="column-heading1">
296
379
  Extra Extra Small Image
@@ -305,11 +388,13 @@ prop to override the default width.
305
388
  </Card>
306
389
  <HorizontalRule />
307
390
  <Card
308
- center
309
- imageAlt="Alt text"
310
- imageAspectRatio={ImageRatios.Square}
311
- imageSize={ImageSizes.ExtraSmall}
312
- imageSrc="https://placeimg.com/400/200/animals"
391
+ imageProps={{
392
+ alt: "Alt text",
393
+ aspectRatio: ImageRatios.Square,
394
+ size: ImageSizes.ExtraSmall,
395
+ src: "https://placeimg.com/400/200/animals",
396
+ }}
397
+ isCentered
313
398
  >
314
399
  <CardHeading level={HeadingLevels.Three} id="column-heading1">
315
400
  Extra Small Image
@@ -324,11 +409,13 @@ prop to override the default width.
324
409
  </Card>
325
410
  <HorizontalRule />
326
411
  <Card
327
- center
328
- imageAlt="Alt text"
329
- imageAspectRatio={ImageRatios.Square}
330
- imageSize={ImageSizes.Small}
331
- imageSrc="https://placeimg.com/400/200/animals"
412
+ imageProps={{
413
+ alt: "Alt text",
414
+ aspectRatio: ImageRatios.Square,
415
+ size: ImageSizes.Small,
416
+ src: "https://placeimg.com/400/200/animals",
417
+ }}
418
+ isCentered
332
419
  >
333
420
  <CardHeading level={HeadingLevels.Three} id="column-heading1">
334
421
  Small Image
@@ -343,11 +430,13 @@ prop to override the default width.
343
430
  </Card>
344
431
  <HorizontalRule />
345
432
  <Card
346
- center
347
- imageAlt="Alt text"
348
- imageAspectRatio={ImageRatios.Square}
349
- imageSize={ImageSizes.Medium}
350
- imageSrc="https://placeimg.com/400/200/animals"
433
+ imageProps={{
434
+ alt: "Alt text",
435
+ aspectRatio: ImageRatios.Square,
436
+ size: ImageSizes.Medium,
437
+ src: "https://placeimg.com/400/200/animals",
438
+ }}
439
+ isCentered
351
440
  >
352
441
  <CardHeading level={HeadingLevels.Three} id="column2-heading1">
353
442
  Medium Image
@@ -362,11 +451,13 @@ prop to override the default width.
362
451
  </Card>
363
452
  <HorizontalRule />
364
453
  <Card
365
- center
366
- imageAlt="Alt text"
367
- imageAspectRatio={ImageRatios.Square}
368
- imageSize={ImageSizes.Large}
369
- imageSrc="https://placeimg.com/410/210/animals"
454
+ imageProps={{
455
+ alt: "Alt text",
456
+ aspectRatio: ImageRatios.Square,
457
+ size: ImageSizes.Large,
458
+ src: "https://placeimg.com/400/200/animals",
459
+ }}
460
+ isCentered
370
461
  >
371
462
  <CardHeading level={HeadingLevels.Three} id="column3-heading1">
372
463
  Large Image
@@ -381,10 +472,12 @@ prop to override the default width.
381
472
  </Card>
382
473
  <HorizontalRule />
383
474
  <Card
384
- center
385
- imageAlt="Alt text"
386
- imageAspectRatio={ImageRatios.Square}
387
- imageSrc="https://placeimg.com/410/210/animals"
475
+ imageProps={{
476
+ alt: "Alt text",
477
+ aspectRatio: ImageRatios.Square,
478
+ src: "https://placeimg.com/400/200/animals",
479
+ }}
480
+ isCentered
388
481
  >
389
482
  <CardHeading level={HeadingLevels.Three} id="column-4heading1">
390
483
  Default Image
@@ -407,12 +500,14 @@ prop to override the default width.
407
500
  <DSProvider>
408
501
  <SimpleGrid columns={1}>
409
502
  <Card
410
- center
411
- imageAlt="Alt text"
412
- imageAspectRatio={ImageRatios.TwoByOne}
413
- imageSize={ImageSizes.ExtraExtraSmall}
414
- imageSrc="https://placeimg.com/400/200/animals"
415
- layout={CardLayouts.Row}
503
+ imageProps={{
504
+ alt: "Alt text",
505
+ aspectRatio: ImageRatios.TwoByOne,
506
+ size: ImageSizes.ExtraExtraSmall,
507
+ src: "https://placeimg.com/400/200/animals",
508
+ }}
509
+ isCentered
510
+ layout={LayoutTypes.Row}
416
511
  >
417
512
  <CardHeading level={HeadingLevels.Three} id="row2-heading1">
418
513
  Extra Extra Small Image
@@ -425,12 +520,14 @@ prop to override the default width.
425
520
  </CardContent>
426
521
  </Card>
427
522
  <Card
428
- center
429
- imageAlt="Alt text"
430
- imageAspectRatio={ImageRatios.TwoByOne}
431
- imageSize={ImageSizes.ExtraSmall}
432
- imageSrc="https://placeimg.com/400/200/animals"
433
- layout={CardLayouts.Row}
523
+ imageProps={{
524
+ alt: "Alt text",
525
+ aspectRatio: ImageRatios.TwoByOne,
526
+ size: ImageSizes.ExtraSmall,
527
+ src: "https://placeimg.com/400/200/animals",
528
+ }}
529
+ isCentered
530
+ layout={LayoutTypes.Row}
434
531
  >
435
532
  <CardHeading level={HeadingLevels.Three} id="row2-heading1">
436
533
  Extra Small Image
@@ -443,12 +540,14 @@ prop to override the default width.
443
540
  </CardContent>
444
541
  </Card>
445
542
  <Card
446
- center
447
- imageAlt="Alt text"
448
- imageAspectRatio={ImageRatios.TwoByOne}
449
- imageSize={ImageSizes.Small}
450
- imageSrc="https://placeimg.com/400/200/animals"
451
- layout={CardLayouts.Row}
543
+ imageProps={{
544
+ alt: "Alt text",
545
+ aspectRatio: ImageRatios.TwoByOne,
546
+ size: ImageSizes.Small,
547
+ src: "https://placeimg.com/400/200/animals",
548
+ }}
549
+ isCentered
550
+ layout={LayoutTypes.Row}
452
551
  >
453
552
  <CardHeading level={HeadingLevels.Three} id="row2-heading1">
454
553
  Small Image
@@ -461,12 +560,14 @@ prop to override the default width.
461
560
  </CardContent>
462
561
  </Card>
463
562
  <Card
464
- center
465
- imageAlt="Alt text"
466
- imageAspectRatio={ImageRatios.TwoByOne}
467
- imageSize={ImageSizes.Medium}
468
- imageSrc="https://placeimg.com/410/210/animals"
469
- layout={CardLayouts.Row}
563
+ imageProps={{
564
+ alt: "Alt text",
565
+ aspectRatio: ImageRatios.TwoByOne,
566
+ size: ImageSizes.Medium,
567
+ src: "https://placeimg.com/400/200/animals",
568
+ }}
569
+ isCentered
570
+ layout={LayoutTypes.Row}
470
571
  >
471
572
  <CardHeading level={HeadingLevels.Three} id="row3-heading2">
472
573
  Medium Image
@@ -480,12 +581,14 @@ prop to override the default width.
480
581
  </CardContent>
481
582
  </Card>
482
583
  <Card
483
- center
484
- imageAlt="Alt text"
485
- imageAspectRatio={ImageRatios.TwoByOne}
486
- imageSize={ImageSizes.Large}
487
- imageSrc="https://placeimg.com/400/250/animals"
488
- layout={CardLayouts.Row}
584
+ imageProps={{
585
+ alt: "Alt text",
586
+ aspectRatio: ImageRatios.TwoByOne,
587
+ size: ImageSizes.Large,
588
+ src: "https://placeimg.com/400/200/animals",
589
+ }}
590
+ isCentered
591
+ layout={LayoutTypes.Row}
489
592
  >
490
593
  <CardHeading level={HeadingLevels.Three} id="row4-heading1">
491
594
  Large Image
@@ -500,11 +603,13 @@ prop to override the default width.
500
603
  </CardContent>
501
604
  </Card>
502
605
  <Card
503
- center
504
- imageAlt="Alt text"
505
- imageAspectRatio={ImageRatios.TwoByOne}
506
- imageSrc="https://placeimg.com/450/250/animals"
507
- layout={CardLayouts.Row}
606
+ imageProps={{
607
+ alt: "Alt text",
608
+ aspectRatio: ImageRatios.TwoByOne,
609
+ src: "https://placeimg.com/400/200/animals",
610
+ }}
611
+ isCentered
612
+ layout={LayoutTypes.Row}
508
613
  >
509
614
  <CardHeading level={HeadingLevels.Three} id="row5-heading2">
510
615
  Default Image
@@ -522,15 +627,223 @@ prop to override the default width.
522
627
  </DSProvider>
523
628
  </Canvas>
524
629
 
630
+ ## Custom Image Component
631
+
632
+ Instead of passing a path for the `imageProps.src` prop, you can pass a custom
633
+ image component in using the `imageProps.component` prop.
634
+
635
+ <Canvas withToolbar>
636
+ <Story name="Custom Image Component">
637
+ <Card
638
+ imageProps={{
639
+ alt: "Alt text",
640
+ aspectRatio: ImageRatios.SixteenByNine,
641
+ component: (
642
+ <Image src="https://placeimg.com/400/400/animals" alt="Alt text" />
643
+ ),
644
+ src: "https://placeimg.com/400/200/animals",
645
+ }}
646
+ >
647
+ <CardHeading level={HeadingLevels.Two} id="img1-heading1">
648
+ Card Component with Custom Image Component
649
+ </CardHeading>
650
+ <CardHeading level={HeadingLevels.Three} id="img2-heading2">
651
+ Secondary Heading
652
+ </CardHeading>
653
+ <CardContent>
654
+ Nulla vitae elit libero, a pharetra augue. Lorem ipsum dolor sit amet,
655
+ consectetur adipiscing elit. Aenean lacinia bibendum nulla sed
656
+ consectetur. Vestibulum id ligula porta felis euismod semper. Cras justo
657
+ odio, dapibus ac facilisis in, egestas eget quam. Sed posuere
658
+ consectetur est at lobortis.
659
+ </CardContent>
660
+ <CardActions>
661
+ <Link type={LinkTypes.Button} href="#">
662
+ Reserve
663
+ </Link>
664
+ <Link href="#url" type={LinkTypes.Forwards}>
665
+ View Book Details
666
+ </Link>
667
+ </CardActions>
668
+ </Card>
669
+ </Story>
670
+ </Canvas>
671
+
672
+ ## Card with Link Heading
673
+
674
+ The `CardHeading` component works just like the DS `Heading` component. This
675
+ means that a URL can be passed in the `url` prop for `CardHeading` or a `Link`
676
+ component can be used as a child. Click on "Show code" in the example below to
677
+ see both patterns.
678
+
679
+ <Canvas>
680
+ <Story name="Card With Link Heading">
681
+ <Card
682
+ imageProps={{
683
+ alt: "Alt text",
684
+ aspectRatio: ImageRatios.TwoByOne,
685
+ src: "https://placeimg.com/400/200/animals",
686
+ }}
687
+ >
688
+ <CardHeading
689
+ level={HeadingLevels.Three}
690
+ id="link-heading1"
691
+ url="http://nypl.org"
692
+ >
693
+ Go to NYPL home page.
694
+ </CardHeading>
695
+ <CardHeading level={HeadingLevels.Four} id="link-heading2">
696
+ <>
697
+ Go to NYPL <Link href="http://nypl.org">home page</Link>.
698
+ </>
699
+ </CardHeading>
700
+ <CardContent>
701
+ This entire `Card` component is clickable, but the links below are still
702
+ accessible by tabbing through the `Card` and pressing `enter` or
703
+ clicking with a mouse.
704
+ </CardContent>
705
+ <CardActions>
706
+ <Link href="#" type={LinkTypes.Button}>
707
+ Button
708
+ </Link>
709
+ <Link href="#" type={LinkTypes.Forwards}>
710
+ Other link
711
+ </Link>
712
+ </CardActions>
713
+ </Card>
714
+ </Story>
715
+ </Canvas>
716
+
717
+ ## Card With Full-Click Functionality
718
+
719
+ To enable the full-click functionality in the `Card` component, pass a URL in
720
+ the `mainActionLink` prop. This will make the entire `Card` component clickable.
721
+ If the `Card` has action links or buttons, they can still be accessed by tabbing
722
+ through the `Card` and pressing `enter` or clicking like a regular link.
723
+
724
+ Internally, if multiple `CardHeading` components are passed, only the first one
725
+ will have the full-click link. This, however, does not affect the `Card` itself
726
+ from being having the full-click functionality.
727
+
728
+ <Canvas>
729
+ <Story name="Card With Full-Click Functionality">
730
+ <SimpleGrid columns={2}>
731
+ <Card
732
+ imageProps={{
733
+ alt: "Alt text",
734
+ aspectRatio: ImageRatios.TwoByOne,
735
+ src: "https://placeimg.com/400/200/animals",
736
+ }}
737
+ mainActionLink="http://nypl.org"
738
+ >
739
+ <CardHeading level={HeadingLevels.Three} id="fullclick1-heading1">
740
+ Go to NYPL home page.
741
+ </CardHeading>
742
+ <CardHeading level={HeadingLevels.Four} id="fullclick1-heading2">
743
+ Some other heading.
744
+ </CardHeading>
745
+ <CardContent>
746
+ This entire `Card` component is clickable, but the links below are
747
+ still accessible by tabbing through the `Card` and pressing `enter` or
748
+ clicking with a mouse.
749
+ </CardContent>
750
+ <CardActions>
751
+ <Link href="#" type={LinkTypes.Button}>
752
+ Button
753
+ </Link>
754
+ <Link href="#" type={LinkTypes.Forwards}>
755
+ Other link
756
+ </Link>
757
+ </CardActions>
758
+ </Card>
759
+ <Card
760
+ imageProps={{
761
+ alt: "Alt text",
762
+ aspectRatio: ImageRatios.TwoByOne,
763
+ isAtEnd: true,
764
+ src: "https://placeimg.com/410/210/animals",
765
+ }}
766
+ mainActionLink="http://nypl.org"
767
+ >
768
+ <CardHeading level={HeadingLevels.Three} id="fullclick2-heading1">
769
+ Go to NYPL home page.
770
+ </CardHeading>
771
+ <CardContent>
772
+ This `Card` component does not have any extra links.
773
+ </CardContent>
774
+ </Card>
775
+ </SimpleGrid>
776
+ </Story>
777
+ </Canvas>
778
+
779
+ ## Card with Right Side CardActions
780
+
781
+ It's possible to set only the `CardActions` component on the right side of the
782
+ main content area of the `Card`. This is possible only in the "LayoutTypes.Row"
783
+ layout and through the `Card` component's `isAlignedRightActions` prop which
784
+ must be set to `true`.
785
+
786
+ <Canvas>
787
+ <Story name="Card with Right Side CardActions">
788
+ <Card
789
+ imageProps={{
790
+ alt: "Alt text",
791
+ aspectRatio: ImageRatios.TwoByOne,
792
+ size: ImageSizes.Medium,
793
+ src: "https://placeimg.com/400/200/animals",
794
+ }}
795
+ isAlignedRightActions
796
+ isCentered
797
+ layout={LayoutTypes.Row}
798
+ >
799
+ <CardHeading level={HeadingLevels.Two} id="main-heading1">
800
+ Optional Header
801
+ </CardHeading>
802
+ <CardHeading level={HeadingLevels.Three} id="main-heading2">
803
+ Sollicitudin Lorem Tortor Purus Ornare
804
+ </CardHeading>
805
+ <CardContent>
806
+ Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
807
+ libero, a pharetra augue. Nullam quis risus eget urna mollis ornare vel
808
+ eu leo. Nulla vitae elit libero, a pharetra augue.
809
+ </CardContent>
810
+ <CardActions topBorder bottomBorder>
811
+ <Button
812
+ onClick={action("clicked")}
813
+ id="main-button1"
814
+ buttonType={ButtonTypes.Primary}
815
+ type="submit"
816
+ >
817
+ Primary
818
+ </Button>
819
+ <Button
820
+ onClick={action("clicked")}
821
+ id="main-button2"
822
+ buttonType={ButtonTypes.Secondary}
823
+ type="submit"
824
+ >
825
+ Secondary
826
+ </Button>
827
+ </CardActions>
828
+ <CardActions>
829
+ <Link href="#">#hash1</Link>,<Link href="#">#hash2</Link>,
830
+ <Link href="#">#hash3</Link>
831
+ </CardActions>
832
+ </Card>
833
+ </Story>
834
+ </Canvas>
835
+
525
836
  ## Cards in a Grid
526
837
 
527
838
  <Canvas>
528
839
  <Story name="Cards in a Grid">
529
840
  <SimpleGrid columns={3}>
530
841
  <Card
531
- imageAlt="Alt text"
532
- imageAspectRatio={ImageRatios.TwoByOne}
533
- imageSrc="https://placeimg.com/400/200/animals"
842
+ imageProps={{
843
+ alt: "Alt text",
844
+ aspectRatio: ImageRatios.TwoByOne,
845
+ src: "https://placeimg.com/400/200/animals",
846
+ }}
534
847
  >
535
848
  <CardHeading level={HeadingLevels.Three} id="grid1-heading1">
536
849
  Card Heading
@@ -541,9 +854,11 @@ prop to override the default width.
541
854
  </CardContent>
542
855
  </Card>
543
856
  <Card
544
- imageAlt="Alt text"
545
- imageAspectRatio={ImageRatios.TwoByOne}
546
- imageSrc="https://placeimg.com/410/210/animals"
857
+ imageProps={{
858
+ alt: "Alt text",
859
+ aspectRatio: ImageRatios.TwoByOne,
860
+ src: "https://placeimg.com/410/210/animals",
861
+ }}
547
862
  >
548
863
  <CardHeading level={HeadingLevels.Three} id="grid2-heading1">
549
864
  Card Heading
@@ -554,9 +869,11 @@ prop to override the default width.
554
869
  </CardContent>
555
870
  </Card>
556
871
  <Card
557
- imageAlt="Alt text"
558
- imageAspectRatio={ImageRatios.TwoByOne}
559
- imageSrc="https://placeimg.com/420/220/animals"
872
+ imageProps={{
873
+ alt: "Alt text",
874
+ aspectRatio: ImageRatios.TwoByOne,
875
+ src: "https://placeimg.com/420/220/animals",
876
+ }}
560
877
  >
561
878
  <CardHeading level={HeadingLevels.Three} id="grid3-heading1">
562
879
  Card Heading
@@ -567,9 +884,11 @@ prop to override the default width.
567
884
  </CardContent>
568
885
  </Card>
569
886
  <Card
570
- imageAlt="Alt text"
571
- imageAspectRatio={ImageRatios.TwoByOne}
572
- imageSrc="https://placeimg.com/430/230/animals"
887
+ imageProps={{
888
+ alt: "Alt text",
889
+ aspectRatio: ImageRatios.TwoByOne,
890
+ src: "https://placeimg.com/430/230/animals",
891
+ }}
573
892
  >
574
893
  <CardHeading level={HeadingLevels.Three} id="grid4-heading1">
575
894
  Card Heading
@@ -580,9 +899,11 @@ prop to override the default width.
580
899
  </CardContent>
581
900
  </Card>
582
901
  <Card
583
- imageAlt="Alt text"
584
- imageAspectRatio={ImageRatios.TwoByOne}
585
- imageSrc="https://placeimg.com/440/240/animals"
902
+ imageProps={{
903
+ alt: "Alt text",
904
+ aspectRatio: ImageRatios.TwoByOne,
905
+ src: "https://placeimg.com/440/200/animals",
906
+ }}
586
907
  >
587
908
  <CardHeading level={HeadingLevels.Three} id="grid5-heading1">
588
909
  Card Heading
@@ -593,9 +914,11 @@ prop to override the default width.
593
914
  </CardContent>
594
915
  </Card>
595
916
  <Card
596
- imageAlt="Alt text"
597
- imageAspectRatio={ImageRatios.TwoByOne}
598
- imageSrc="https://placeimg.com/450/250/animals"
917
+ imageProps={{
918
+ alt: "Alt text",
919
+ aspectRatio: ImageRatios.TwoByOne,
920
+ src: "https://placeimg.com/450/200/animals",
921
+ }}
599
922
  >
600
923
  <CardHeading level={HeadingLevels.Three} id="grid6-heading1">
601
924
  Card Heading
@@ -615,11 +938,13 @@ prop to override the default width.
615
938
  <Story name="Cards in a Stack">
616
939
  <SimpleGrid columns={1}>
617
940
  <Card
618
- center
619
- imageAlt="Alt text"
620
- imageAspectRatio={ImageRatios.TwoByOne}
621
- imageSrc="https://placeimg.com/400/200/animals"
622
- layout={CardLayouts.Row}
941
+ imageProps={{
942
+ alt: "Alt text",
943
+ aspectRatio: ImageRatios.TwoByOne,
944
+ src: "https://placeimg.com/400/200/animals",
945
+ }}
946
+ isCentered
947
+ layout={LayoutTypes.Row}
623
948
  >
624
949
  <CardHeading level={HeadingLevels.Four} id="stack1-heading1">
625
950
  Card Heading
@@ -631,11 +956,13 @@ prop to override the default width.
631
956
  </CardContent>
632
957
  </Card>
633
958
  <Card
634
- center
635
- imageAlt="Alt text"
636
- imageAspectRatio={ImageRatios.TwoByOne}
637
- imageSrc="https://placeimg.com/410/210/animals"
638
- layout={CardLayouts.Row}
959
+ imageProps={{
960
+ alt: "Alt text",
961
+ aspectRatio: ImageRatios.TwoByOne,
962
+ src: "https://placeimg.com/410/210/animals",
963
+ }}
964
+ isCentered
965
+ layout={LayoutTypes.Row}
639
966
  >
640
967
  <CardHeading level={HeadingLevels.Four} id="stack2-heading2">
641
968
  Card Heading
@@ -647,11 +974,13 @@ prop to override the default width.
647
974
  </CardContent>
648
975
  </Card>
649
976
  <Card
650
- center
651
- imageAlt="Alt text"
652
- imageAspectRatio={ImageRatios.TwoByOne}
653
- imageSrc="https://placeimg.com/420/220/animals"
654
- layout={CardLayouts.Row}
977
+ imageProps={{
978
+ alt: "Alt text",
979
+ aspectRatio: ImageRatios.TwoByOne,
980
+ src: "https://placeimg.com/420/220/animals",
981
+ }}
982
+ isCentered
983
+ layout={LayoutTypes.Row}
655
984
  >
656
985
  <CardHeading level={HeadingLevels.Four} id="stack3-heading3">
657
986
  Card Heading
@@ -666,51 +995,12 @@ prop to override the default width.
666
995
  </Story>
667
996
  </Canvas>
668
997
 
669
- ## Custom Image Component
670
-
671
- Instead of passing a path for the `imageSrc` prop, you can pass a custom image
672
- component in using the `imageComponent` prop.
673
-
674
- <Canvas withToolbar>
675
- <Story name="Custom Image Component">
676
- <Card
677
- imageAlt="Alt text"
678
- imageAspectRatio={ImageRatios.SixteenByNine}
679
- imageComponent={
680
- <Image src="https://placeimg.com/400/400/animals" alt="Alt text" />
681
- }
682
- >
683
- <CardHeading level={HeadingLevels.Two} id="img1-heading1">
684
- Card Component with Custom Image Component
685
- </CardHeading>
686
- <CardHeading level={HeadingLevels.Three} id="img2-heading2">
687
- Secondary Heading
688
- </CardHeading>
689
- <CardContent>
690
- Nulla vitae elit libero, a pharetra augue. Lorem ipsum dolor sit amet,
691
- consectetur adipiscing elit. Aenean lacinia bibendum nulla sed
692
- consectetur. Vestibulum id ligula porta felis euismod semper. Cras justo
693
- odio, dapibus ac facilisis in, egestas eget quam. Sed posuere
694
- consectetur est at lobortis.
695
- </CardContent>
696
- <CardActions>
697
- <Link type={LinkTypes.Button} href="#">
698
- Reserve
699
- </Link>
700
- <Link href="#url" type={LinkTypes.Forwards}>
701
- View Book Details
702
- </Link>
703
- </CardActions>
704
- </Card>
705
- </Story>
706
- </Canvas>
707
-
708
998
  ## Cards Without Images
709
999
 
710
1000
  <Canvas>
711
1001
  <Story name="Cards Without Images">
712
1002
  <SimpleGrid columns={3}>
713
- <Card border>
1003
+ <Card isBordered>
714
1004
  <CardHeading level={HeadingLevels.Three} id="no-img1-heading1">
715
1005
  Card Heading
716
1006
  </CardHeading>
@@ -720,7 +1010,7 @@ component in using the `imageComponent` prop.
720
1010
  Praesent commodo cursus magna, vel scelerisque nisl.
721
1011
  </CardContent>
722
1012
  </Card>
723
- <Card border>
1013
+ <Card isBordered>
724
1014
  <CardHeading level={HeadingLevels.Three} id="no-img2-heading1">
725
1015
  Card Heading
726
1016
  </CardHeading>
@@ -730,7 +1020,7 @@ component in using the `imageComponent` prop.
730
1020
  Praesent commodo cursus magna, vel scelerisque nisl.
731
1021
  </CardContent>
732
1022
  </Card>
733
- <Card border>
1023
+ <Card isBordered>
734
1024
  <CardHeading level={HeadingLevels.Three} id="no-img3-heading1">
735
1025
  Card Heading
736
1026
  </CardHeading>
@@ -743,7 +1033,7 @@ component in using the `imageComponent` prop.
743
1033
  </SimpleGrid>
744
1034
  <br />
745
1035
  <SimpleGrid columns={1}>
746
- <Card layout={CardLayouts.Row} border>
1036
+ <Card layout={LayoutTypes.Row} isBordered>
747
1037
  <CardHeading level={HeadingLevels.Three} id="no-img4-heading1">
748
1038
  Card Heading
749
1039
  </CardHeading>
@@ -756,7 +1046,7 @@ component in using the `imageComponent` prop.
756
1046
  eget metus.
757
1047
  </CardContent>
758
1048
  </Card>
759
- <Card layout={CardLayouts.Row} border>
1049
+ <Card layout={LayoutTypes.Row} isBordered>
760
1050
  <CardHeading level={HeadingLevels.Three} id="no-img5-heading1">
761
1051
  Card Heading
762
1052
  </CardHeading>
@@ -769,7 +1059,7 @@ component in using the `imageComponent` prop.
769
1059
  eget metus.
770
1060
  </CardContent>
771
1061
  </Card>
772
- <Card layout={CardLayouts.Row} border>
1062
+ <Card layout={LayoutTypes.Row} isBordered>
773
1063
  <CardHeading level={HeadingLevels.Three} id="no-img6-heading1">
774
1064
  Card Heading
775
1065
  </CardHeading>
@@ -785,129 +1075,3 @@ component in using the `imageComponent` prop.
785
1075
  </SimpleGrid>
786
1076
  </Story>
787
1077
  </Canvas>
788
-
789
- ## Card with Link Heading
790
-
791
- The `CardHeading` component works just like the DS `Heading` component. This
792
- means that a URL can be passed in the `url` prop for `CardHeading` or a `Link`
793
- component can be used as a child. Click on "Show code" in the example below to
794
- see both patterns.
795
-
796
- <Canvas>
797
- <Story name="Card With Link Heading">
798
- <Card
799
- imageSrc="https://placeimg.com/400/200/animals"
800
- imageAlt="Alt text"
801
- imageAspectRatio={ImageRatios.TwoByOne}
802
- >
803
- <CardHeading
804
- level={HeadingLevels.Three}
805
- id="link-heading1"
806
- url="http://nypl.org"
807
- >
808
- Go to NYPL home page.
809
- </CardHeading>
810
- <CardHeading level={HeadingLevels.Four} id="link-heading2">
811
- <>
812
- Go to NYPL <Link href="http://nypl.org">home page</Link>.
813
- </>
814
- </CardHeading>
815
- <CardContent>
816
- This entire `Card` component is clickable, but the links below are still
817
- accessible by tabbing through the `Card` and pressing `enter` or
818
- clicking with a mouse.
819
- </CardContent>
820
- <CardActions>
821
- <Link href="#" type={LinkTypes.Button}>
822
- Button
823
- </Link>
824
- <Link href="#" type={LinkTypes.Forwards}>
825
- Other link
826
- </Link>
827
- </CardActions>
828
- </Card>
829
- </Story>
830
- </Canvas>
831
-
832
- ## Card With Full-Click Functionality
833
-
834
- To enable the full-click functionality in the `Card` component, pass a URL in
835
- the `mainActionLink` prop. This will make the entire `Card` component clickable.
836
- If the `Card` has action links or buttons, they can still be accessed by tabbing
837
- through the `Card` and pressing `enter` or clicking like a regular link.
838
-
839
- Internally, if multiple `CardHeading` components are passed, only the first one
840
- will have the full-click link. This, however, does not affect the `Card` itself
841
- from being having the full-click functionality.
842
-
843
- <Canvas>
844
- <Story name="Card With Full-Click Functionality">
845
- <SimpleGrid columns={2}>
846
- <Card
847
- imageAlt="Alt text"
848
- imageAspectRatio={ImageRatios.TwoByOne}
849
- imageSrc="https://placeimg.com/400/200/animals"
850
- mainActionLink="http://nypl.org"
851
- >
852
- <CardHeading level={HeadingLevels.Three} id="fullclick1-heading1">
853
- Go to NYPL home page.
854
- </CardHeading>
855
- <CardHeading level={HeadingLevels.Four} id="fullclick1-heading2">
856
- Some other heading.
857
- </CardHeading>
858
- <CardContent>
859
- This entire `Card` component is clickable, but the links below are
860
- still accessible by tabbing through the `Card` and pressing `enter` or
861
- clicking with a mouse.
862
- </CardContent>
863
- <CardActions>
864
- <Link href="#" type={LinkTypes.Button}>
865
- Button
866
- </Link>
867
- <Link href="#" type={LinkTypes.Forwards}>
868
- Other link
869
- </Link>
870
- </CardActions>
871
- </Card>
872
- <Card
873
- imageAlt="Alt text"
874
- imageAspectRatio={ImageRatios.TwoByOne}
875
- imageAtEnd
876
- imageSrc="https://placeimg.com/410/210/animals"
877
- mainActionLink="http://nypl.org"
878
- >
879
- <CardHeading level={HeadingLevels.Three} id="fullclick2-heading1">
880
- Go to NYPL home page.
881
- </CardHeading>
882
- <CardContent>
883
- This `Card` component does not have any extra links.
884
- </CardContent>
885
- </Card>
886
- </SimpleGrid>
887
- </Story>
888
- </Canvas>
889
-
890
- ## Accessibility
891
-
892
- ### Headings
893
-
894
- In general, headings from `h1` through `h6` must be in sequential order in the
895
- DOM tree. Rendering an `h4` following an `h2` will throw an error. Therefore,
896
- when adding `CardHeading` components, make sure to add them in sequential order
897
- with the `level` prop.
898
-
899
- ```tsx
900
- <CardHeading level={HeadingLevels.Three} id="headingthree">
901
- Heading level three
902
- </CardHeading>
903
- <CardHeading level={HeadingLevels.Four} id="headingfour">
904
- Heading level four
905
- </CardHeading>
906
- ```
907
-
908
- ### Full-Click Functionality
909
-
910
- Passing in a URL in the `mainActionLink` prop will make the entire `Card`
911
- clickable. Other links in the `CardActions` component can still be accessed by
912
- tabbing through and pressing "enter" or by clicking as you normally would on a
913
- link.