@nypl/design-system-react-components 0.26.0 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (306) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/dist/components/Accordion/Accordion.d.ts +1 -1
  3. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +1 -5
  4. package/dist/components/Button/Button.d.ts +2 -10
  5. package/dist/components/ButtonGroup/ButtonGroup.d.ts +22 -0
  6. package/dist/components/Card/Card.d.ts +2 -2
  7. package/dist/components/Checkbox/Checkbox.d.ts +10 -8
  8. package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +1 -1
  9. package/dist/components/DatePicker/DatePicker.d.ts +1 -1
  10. package/dist/components/Form/Form.d.ts +2 -2
  11. package/dist/components/Grid/SimpleGrid.d.ts +6 -3
  12. package/dist/components/Heading/Heading.d.ts +2 -5
  13. package/dist/components/HelperErrorText/HelperErrorText.d.ts +1 -5
  14. package/dist/components/Hero/Hero.d.ts +13 -9
  15. package/dist/components/Icons/Icon.d.ts +6 -5
  16. package/dist/components/Icons/IconSvgs.d.ts +21 -21
  17. package/dist/components/Image/Image.d.ts +8 -5
  18. package/dist/components/Link/Link.d.ts +1 -9
  19. package/dist/components/List/List.d.ts +7 -11
  20. package/dist/components/Logo/Logo.d.ts +2 -5
  21. package/dist/components/Logo/LogoSvgs.d.ts +39 -39
  22. package/dist/components/Modal/Modal.d.ts +28 -8
  23. package/dist/components/Notification/Notification.d.ts +1 -1
  24. package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +2 -1
  25. package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
  26. package/dist/components/SearchBar/SearchBar.d.ts +3 -2
  27. package/dist/components/Select/Select.d.ts +2 -5
  28. package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +4 -4
  29. package/dist/components/SkipNavigation/SkipNavigation.d.ts +17 -0
  30. package/dist/components/StatusBadge/StatusBadge.d.ts +2 -3
  31. package/dist/components/StructuredContent/StructuredContent.d.ts +2 -2
  32. package/dist/components/Table/Table.d.ts +1 -1
  33. package/dist/components/Template/Template.d.ts +2 -0
  34. package/dist/components/Text/Text.d.ts +1 -1
  35. package/dist/components/TextInput/TextInput.d.ts +21 -9
  36. package/dist/components/Toggle/Toggle.d.ts +1 -5
  37. package/dist/components/VideoPlayer/VideoPlayer.d.ts +2 -1
  38. package/dist/design-system-react-components.cjs.development.js +977 -1213
  39. package/dist/design-system-react-components.cjs.development.js.map +1 -1
  40. package/dist/design-system-react-components.cjs.production.min.js +1 -1
  41. package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
  42. package/dist/design-system-react-components.esm.js +976 -1276
  43. package/dist/design-system-react-components.esm.js.map +1 -1
  44. package/dist/helpers/types.d.ts +1 -0
  45. package/dist/index.d.ts +27 -48
  46. package/dist/styles.css +1 -1
  47. package/dist/theme/components/buttonGroup.d.ts +11 -0
  48. package/dist/theme/components/card.d.ts +104 -8
  49. package/dist/theme/components/componentWrapper.d.ts +4 -3
  50. package/dist/theme/components/customTable.d.ts +11 -14
  51. package/dist/theme/components/fieldset.d.ts +4 -3
  52. package/dist/theme/components/helperErrorText.d.ts +4 -3
  53. package/dist/theme/components/hero.d.ts +1 -1
  54. package/dist/theme/components/horizontalRule.d.ts +4 -3
  55. package/dist/theme/components/icon.d.ts +47743 -1
  56. package/dist/theme/components/image.d.ts +563 -10
  57. package/dist/theme/components/label.d.ts +4 -3
  58. package/dist/theme/components/list.d.ts +6 -7
  59. package/dist/theme/components/logo.d.ts +474 -1
  60. package/dist/theme/components/notification.d.ts +20 -16
  61. package/dist/theme/components/progressIndicator.d.ts +6 -4
  62. package/dist/theme/components/select.d.ts +4 -10
  63. package/dist/theme/components/skeletonLoader.d.ts +14 -10
  64. package/dist/theme/components/skipNavigation.d.ts +22 -0
  65. package/dist/theme/components/slider.d.ts +7 -6
  66. package/dist/theme/components/structuredContent.d.ts +10 -9
  67. package/dist/theme/components/text.d.ts +7 -1
  68. package/dist/theme/components/toggle.d.ts +6 -4
  69. package/dist/theme/provider.d.ts +2 -4
  70. package/dist/utils/componentCategories.d.ts +1 -1
  71. package/dist/utils/interfaces.d.ts +5 -0
  72. package/dist/utils/utils.d.ts +2 -18
  73. package/package.json +15 -16
  74. package/src/__tests__/setup.ts +3 -3
  75. package/src/__tests__/utils/utils.test.ts +1 -23
  76. package/src/components/AccessibilityGuide/SkipNavigation.stories.mdx +22 -14
  77. package/src/components/Accordion/Accordion.stories.mdx +43 -44
  78. package/src/components/Accordion/Accordion.test.tsx +5 -13
  79. package/src/components/Accordion/Accordion.tsx +14 -18
  80. package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +6 -6
  81. package/src/components/Autosuggest/Autosuggest.stories.mdx +1 -1
  82. package/src/components/Autosuggest/Autosuggest.stories.tsx +23 -25
  83. package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +21 -37
  84. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +4 -17
  85. package/src/components/Breadcrumbs/Breadcrumbs.tsx +18 -21
  86. package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +1 -100
  87. package/src/components/Button/Button.stories.mdx +89 -126
  88. package/src/components/Button/Button.test.tsx +16 -30
  89. package/src/components/Button/Button.tsx +14 -20
  90. package/src/components/ButtonGroup/ButtonGroup.stories.mdx +147 -0
  91. package/src/components/ButtonGroup/ButtonGroup.test.tsx +141 -0
  92. package/src/components/ButtonGroup/ButtonGroup.tsx +99 -0
  93. package/src/components/ButtonGroup/__snapshots__/ButtonGroup.test.tsx.snap +117 -0
  94. package/src/components/Card/Card.stories.mdx +143 -177
  95. package/src/components/Card/Card.test.tsx +36 -97
  96. package/src/components/Card/Card.tsx +78 -74
  97. package/src/components/Card/__snapshots__/Card.test.tsx.snap +1 -1
  98. package/src/components/Chakra/Box.stories.mdx +2 -6
  99. package/src/components/Chakra/Center.stories.mdx +5 -23
  100. package/src/components/Chakra/Flex.stories.mdx +4 -6
  101. package/src/components/Chakra/Stack.stories.mdx +9 -10
  102. package/src/components/Checkbox/Checkbox.stories.mdx +1 -1
  103. package/src/components/Checkbox/Checkbox.test.tsx +2 -2
  104. package/src/components/Checkbox/Checkbox.tsx +20 -13
  105. package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +9 -9
  106. package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +6 -17
  107. package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +1 -7
  108. package/src/components/CheckboxGroup/CheckboxGroup.tsx +33 -29
  109. package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +24 -35
  110. package/src/components/ComponentWrapper/ComponentWrapper.tsx +3 -10
  111. package/src/components/DatePicker/DatePicker.stories.mdx +23 -37
  112. package/src/components/DatePicker/DatePicker.test.tsx +21 -19
  113. package/src/components/DatePicker/DatePicker.tsx +57 -49
  114. package/src/components/Form/Form.stories.mdx +46 -31
  115. package/src/components/Form/Form.test.tsx +1 -18
  116. package/src/components/Form/Form.tsx +7 -7
  117. package/src/components/Grid/SimpleGrid.stories.mdx +73 -49
  118. package/src/components/Grid/SimpleGrid.test.tsx +7 -9
  119. package/src/components/Grid/SimpleGrid.tsx +14 -11
  120. package/src/components/Heading/Heading.stories.mdx +27 -72
  121. package/src/components/Heading/Heading.test.tsx +18 -44
  122. package/src/components/Heading/Heading.tsx +7 -10
  123. package/src/components/HelperErrorText/HelperErrorText.stories.mdx +1 -3
  124. package/src/components/HelperErrorText/HelperErrorText.tsx +1 -5
  125. package/src/components/Hero/Hero.stories.mdx +219 -216
  126. package/src/components/Hero/Hero.test.tsx +107 -223
  127. package/src/components/Hero/Hero.tsx +63 -61
  128. package/src/components/Icons/Icon.stories.mdx +172 -118
  129. package/src/components/Icons/Icon.test.tsx +8 -16
  130. package/src/components/Icons/Icon.tsx +75 -29
  131. package/src/components/Icons/IconSvgs.tsx +42 -42
  132. package/src/components/Image/Image.stories.mdx +45 -132
  133. package/src/components/Image/Image.test.tsx +16 -31
  134. package/src/components/Image/Image.tsx +28 -12
  135. package/src/components/Link/Link.stories.mdx +30 -94
  136. package/src/components/Link/Link.test.tsx +25 -75
  137. package/src/components/Link/Link.tsx +43 -56
  138. package/src/components/Link/__snapshots__/Link.test.tsx.snap +1 -2
  139. package/src/components/List/List.stories.mdx +20 -31
  140. package/src/components/List/List.test.tsx +24 -43
  141. package/src/components/List/List.tsx +25 -36
  142. package/src/components/Logo/Logo.stories.mdx +94 -50
  143. package/src/components/Logo/Logo.test.tsx +10 -19
  144. package/src/components/Logo/Logo.tsx +50 -17
  145. package/src/components/Logo/LogoSvgs.tsx +78 -78
  146. package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +4 -4
  147. package/src/components/Modal/Modal.stories.mdx +245 -139
  148. package/src/components/Modal/Modal.test.tsx +147 -10
  149. package/src/components/Modal/Modal.tsx +140 -20
  150. package/src/components/Modal/__snapshots__/Modal.test.tsx.snap +25 -0
  151. package/src/components/Notification/Notification.stories.mdx +10 -28
  152. package/src/components/Notification/Notification.test.tsx +9 -12
  153. package/src/components/Notification/Notification.tsx +34 -37
  154. package/src/components/Pagination/Pagination.stories.mdx +3 -4
  155. package/src/components/Pagination/Pagination.tsx +15 -10
  156. package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +27 -53
  157. package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +9 -10
  158. package/src/components/ProgressIndicator/ProgressIndicator.tsx +17 -21
  159. package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +0 -10
  160. package/src/components/Radio/Radio.stories.mdx +1 -1
  161. package/src/components/Radio/Radio.tsx +9 -6
  162. package/src/components/RadioGroup/RadioGroup.stories.mdx +15 -16
  163. package/src/components/RadioGroup/RadioGroup.test.tsx +2 -8
  164. package/src/components/RadioGroup/RadioGroup.tsx +28 -24
  165. package/src/components/SearchBar/SearchBar.stories.mdx +1 -1
  166. package/src/components/SearchBar/SearchBar.test.tsx +1 -1
  167. package/src/components/SearchBar/SearchBar.tsx +14 -22
  168. package/src/components/SearchBar/__snapshots__/SearchBar.test.tsx.snap +1 -13
  169. package/src/components/Select/Select.stories.mdx +10 -25
  170. package/src/components/Select/Select.test.tsx +6 -7
  171. package/src/components/Select/Select.tsx +28 -35
  172. package/src/components/Select/__snapshots__/Select.test.tsx.snap +24 -24
  173. package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +17 -56
  174. package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +7 -21
  175. package/src/components/SkeletonLoader/SkeletonLoader.tsx +9 -8
  176. package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +33 -33
  177. package/src/components/SkipNavigation/SkipNavigation.stories.mdx +90 -0
  178. package/src/components/SkipNavigation/SkipNavigation.test.tsx +63 -0
  179. package/src/components/SkipNavigation/SkipNavigation.tsx +51 -0
  180. package/src/components/SkipNavigation/__snapshots__/SkipNavigation.test.tsx.snap +130 -0
  181. package/src/components/Slider/Slider.stories.mdx +19 -53
  182. package/src/components/Slider/Slider.test.tsx +2 -2
  183. package/src/components/Slider/Slider.tsx +10 -12
  184. package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +2 -9
  185. package/src/components/StatusBadge/StatusBadge.stories.mdx +6 -21
  186. package/src/components/StatusBadge/StatusBadge.test.tsx +2 -3
  187. package/src/components/StatusBadge/StatusBadge.tsx +3 -10
  188. package/src/components/StructuredContent/StructuredContent.stories.mdx +30 -58
  189. package/src/components/StructuredContent/StructuredContent.test.tsx +42 -44
  190. package/src/components/StructuredContent/StructuredContent.tsx +9 -18
  191. package/src/components/StyleGuide/Bidirectionality.stories.mdx +9 -23
  192. package/src/components/StyleGuide/Buttons.stories.mdx +62 -62
  193. package/src/components/StyleGuide/ColorCard.tsx +2 -4
  194. package/src/components/StyleGuide/Colors.stories.mdx +7 -8
  195. package/src/components/StyleGuide/DesignTokens.stories.mdx +5 -7
  196. package/src/components/StyleGuide/Forms.stories.mdx +0 -1
  197. package/src/components/StyleGuide/Iconography.stories.mdx +59 -77
  198. package/src/components/StyleGuide/Spacing.stories.mdx +0 -1
  199. package/src/components/StyleGuide/Typography.stories.mdx +15 -18
  200. package/src/components/Table/Table.stories.mdx +85 -1
  201. package/src/components/Table/Table.test.tsx +57 -1
  202. package/src/components/Table/Table.tsx +7 -4
  203. package/src/components/Table/__snapshots__/Table.test.tsx.snap +121 -0
  204. package/src/components/Tabs/Tabs.stories.mdx +1 -1
  205. package/src/components/Tabs/Tabs.test.tsx +2 -2
  206. package/src/components/Tabs/Tabs.tsx +26 -27
  207. package/src/components/Template/Template.stories.mdx +49 -54
  208. package/src/components/Template/Template.tsx +9 -3
  209. package/src/components/Text/Text.stories.mdx +5 -11
  210. package/src/components/Text/Text.test.tsx +3 -6
  211. package/src/components/Text/Text.tsx +3 -5
  212. package/src/components/TextInput/TextInput.stories.mdx +10 -22
  213. package/src/components/TextInput/TextInput.test.tsx +32 -62
  214. package/src/components/TextInput/TextInput.tsx +61 -30
  215. package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +1 -0
  216. package/src/components/Toggle/Toggle.stories.mdx +5 -16
  217. package/src/components/Toggle/Toggle.test.tsx +2 -3
  218. package/src/components/Toggle/Toggle.tsx +9 -10
  219. package/src/components/VideoPlayer/VideoPlayer.stories.mdx +13 -29
  220. package/src/components/VideoPlayer/VideoPlayer.test.tsx +18 -23
  221. package/src/components/VideoPlayer/VideoPlayer.tsx +13 -10
  222. package/src/docs/Chakra.stories.mdx +14 -11
  223. package/src/docs/Welcome.stories.mdx +23 -43
  224. package/src/helpers/types.ts +1 -0
  225. package/src/hooks/tests/useNYPLTheme.test.tsx +1 -1
  226. package/src/hooks/useNYPLTheme.stories.mdx +3 -6
  227. package/src/index.ts +52 -46
  228. package/src/styles.scss +0 -1
  229. package/src/theme/components/buttonGroup.ts +10 -0
  230. package/src/theme/components/card.ts +50 -15
  231. package/src/theme/components/componentWrapper.ts +5 -1
  232. package/src/theme/components/customTable.ts +8 -2
  233. package/src/theme/components/fieldset.ts +5 -1
  234. package/src/theme/components/helperErrorText.ts +5 -1
  235. package/src/theme/components/hero.ts +2 -2
  236. package/src/theme/components/horizontalRule.ts +5 -1
  237. package/src/theme/components/icon.ts +7 -1
  238. package/src/theme/components/image.ts +14 -3
  239. package/src/theme/components/label.ts +5 -1
  240. package/src/theme/components/list.ts +8 -2
  241. package/src/theme/components/logo.ts +5 -1
  242. package/src/theme/components/notification.ts +38 -14
  243. package/src/theme/components/progressIndicator.ts +10 -5
  244. package/src/theme/components/select.ts +5 -6
  245. package/src/theme/components/skeletonLoader.ts +8 -2
  246. package/src/theme/components/skipNavigation.ts +26 -0
  247. package/src/theme/components/slider.ts +13 -1
  248. package/src/theme/components/structuredContent.ts +11 -1
  249. package/src/theme/components/text.ts +12 -5
  250. package/src/theme/components/toggle.ts +9 -3
  251. package/src/theme/index.ts +4 -0
  252. package/src/theme/provider.tsx +1 -1
  253. package/src/utils/componentCategories.ts +13 -5
  254. package/src/utils/interfaces.ts +5 -0
  255. package/src/utils/utils.ts +2 -32
  256. package/dist/components/Accordion/AccordionTypes.d.ts +0 -5
  257. package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +0 -8
  258. package/dist/components/Button/ButtonTypes.d.ts +0 -8
  259. package/dist/components/DatePicker/DatePickerTypes.d.ts +0 -5
  260. package/dist/components/Form/FormTypes.d.ts +0 -2
  261. package/dist/components/Grid/GridTypes.d.ts +0 -9
  262. package/dist/components/Heading/HeadingTypes.d.ts +0 -14
  263. package/dist/components/Hero/HeroTypes.d.ts +0 -12
  264. package/dist/components/Icons/IconTypes.d.ts +0 -77
  265. package/dist/components/Image/ImageTypes.d.ts +0 -22
  266. package/dist/components/Link/LinkTypes.d.ts +0 -8
  267. package/dist/components/List/ListTypes.d.ts +0 -5
  268. package/dist/components/Logo/LogoTypes.d.ts +0 -54
  269. package/dist/components/Notification/NotificationTypes.d.ts +0 -5
  270. package/dist/components/ProgressIndicator/ProgressIndicatorTypes.d.ts +0 -8
  271. package/dist/components/Select/SelectTypes.d.ts +0 -8
  272. package/dist/components/SkeletonLoader/SkeletonLoaderTypes.d.ts +0 -5
  273. package/dist/components/StatusBadge/StatusBadgeTypes.d.ts +0 -5
  274. package/dist/components/StructuredContent/StructuredContentTypes.d.ts +0 -5
  275. package/dist/components/Text/TextTypes.d.ts +0 -6
  276. package/dist/components/TextInput/TextInputTypes.d.ts +0 -25
  277. package/dist/components/Toggle/ToggleTypes.d.ts +0 -4
  278. package/dist/components/VideoPlayer/VideoPlayerTypes.d.ts +0 -9
  279. package/dist/helpers/enums.d.ts +0 -4
  280. package/dist/utils/siteSections.d.ts +0 -2
  281. package/src/components/Accordion/AccordionTypes.tsx +0 -5
  282. package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +0 -8
  283. package/src/components/Button/ButtonTypes.tsx +0 -8
  284. package/src/components/DatePicker/DatePickerTypes.tsx +0 -5
  285. package/src/components/Form/FormTypes.tsx +0 -3
  286. package/src/components/Grid/GridTypes.tsx +0 -9
  287. package/src/components/Heading/HeadingTypes.tsx +0 -15
  288. package/src/components/Hero/HeroTypes.tsx +0 -20
  289. package/src/components/Icons/IconTypes.tsx +0 -83
  290. package/src/components/Image/ImageTypes.ts +0 -24
  291. package/src/components/Link/LinkTypes.tsx +0 -8
  292. package/src/components/List/ListTypes.tsx +0 -5
  293. package/src/components/Logo/LogoTypes.tsx +0 -56
  294. package/src/components/Modal/_Modal.scss +0 -18
  295. package/src/components/Notification/NotificationTypes.tsx +0 -5
  296. package/src/components/ProgressIndicator/ProgressIndicatorTypes.ts +0 -8
  297. package/src/components/Select/SelectTypes.tsx +0 -10
  298. package/src/components/SkeletonLoader/SkeletonLoaderTypes.tsx +0 -5
  299. package/src/components/StatusBadge/StatusBadgeTypes.tsx +0 -5
  300. package/src/components/StructuredContent/StructuredContentTypes.tsx +0 -5
  301. package/src/components/Text/TextTypes.tsx +0 -6
  302. package/src/components/TextInput/TextInputTypes.tsx +0 -48
  303. package/src/components/Toggle/ToggleTypes.tsx +0 -4
  304. package/src/components/VideoPlayer/VideoPlayerTypes.tsx +0 -10
  305. package/src/helpers/enums.ts +0 -4
  306. package/src/utils/siteSections.ts +0 -10
@@ -4,15 +4,10 @@ import { axe } from "jest-axe";
4
4
  import renderer from "react-test-renderer";
5
5
 
6
6
  import Button from "../Button/Button";
7
- import { ButtonTypes } from "../Button/ButtonTypes";
8
7
  import Card, { CardHeading, CardContent, CardActions } from "./Card";
9
- import { HeadingLevels } from "../Heading/HeadingTypes";
10
8
  import Icon from "../Icons/Icon";
11
- import { IconRotationTypes, IconNames, IconAlign } from "../Icons/IconTypes";
12
9
  import Image from "../Image/Image";
13
10
  import Link from "../Link/Link";
14
- import { LinkTypes } from "../Link/LinkTypes";
15
- import { ImageRatios } from "../Image/ImageTypes";
16
11
 
17
12
  describe("Card Accessibility", () => {
18
13
  it("passes axe accessibility test", async () => {
@@ -24,17 +19,12 @@ describe("Card Accessibility", () => {
24
19
  src: "https://placeimg.com/400/200/arch",
25
20
  }}
26
21
  >
27
- <CardHeading level={HeadingLevels.Three} id="heading1">
22
+ <CardHeading level="three" id="heading1">
28
23
  The Card Heading
29
24
  </CardHeading>
30
25
  <CardContent>middle column content</CardContent>
31
26
  <CardActions>
32
- <Button
33
- onClick={() => {}}
34
- id="button1"
35
- buttonType={ButtonTypes.Primary}
36
- type="submit"
37
- >
27
+ <Button onClick={() => {}} id="button1" type="submit">
38
28
  Example CTA
39
29
  </Button>
40
30
  </CardActions>
@@ -53,17 +43,12 @@ describe("Card Accessibility", () => {
53
43
  }}
54
44
  mainActionLink="http://nypl.org"
55
45
  >
56
- <CardHeading level={HeadingLevels.Three} id="heading1">
46
+ <CardHeading level="three" id="heading1">
57
47
  The Card Heading
58
48
  </CardHeading>
59
49
  <CardContent>middle column content</CardContent>
60
50
  <CardActions>
61
- <Button
62
- onClick={() => {}}
63
- id="button1"
64
- buttonType={ButtonTypes.Primary}
65
- type="submit"
66
- >
51
+ <Button onClick={() => {}} id="button1" type="submit">
67
52
  Example CTA
68
53
  </Button>
69
54
  </CardActions>
@@ -82,17 +67,12 @@ describe("Card", () => {
82
67
  src: "https://placeimg.com/400/200/arch",
83
68
  }}
84
69
  >
85
- <CardHeading level={HeadingLevels.Three} id="heading1">
70
+ <CardHeading level="three" id="heading1">
86
71
  The Card Heading
87
72
  </CardHeading>
88
73
  <CardContent>middle column content</CardContent>
89
74
  <CardActions>
90
- <Button
91
- onClick={() => {}}
92
- id="button1"
93
- buttonType={ButtonTypes.Primary}
94
- type="submit"
95
- >
75
+ <Button onClick={() => {}} id="button1" type="submit">
96
76
  Example CTA
97
77
  </Button>
98
78
  </CardActions>
@@ -107,7 +87,7 @@ describe("Card", () => {
107
87
  src: "https://placeimg.com/300/400/arch",
108
88
  }}
109
89
  >
110
- <CardHeading id="editioncardheading1" level={HeadingLevels.Two}>
90
+ <CardHeading id="editioncardheading1" level="two">
111
91
  The Card Heading
112
92
  </CardHeading>
113
93
  <CardContent>
@@ -119,15 +99,15 @@ describe("Card", () => {
119
99
  </div>
120
100
  </CardContent>
121
101
  <CardActions>
122
- <Link id="link-online" href="online" type={LinkTypes.Button}>
102
+ <Link id="link-online" href="online" type="button">
123
103
  Read Online
124
104
  </Link>
125
- <Link id="link-icon" href="#url" type={LinkTypes.Action}>
105
+ <Link id="link-icon" href="#url" type="action">
126
106
  <Icon
127
- align={IconAlign.Left}
128
- iconRotation={IconRotationTypes.Rotate0}
107
+ align="left"
108
+ iconRotation="rotate0"
129
109
  id="icon-cardWithExtendedStyles"
130
- name={IconNames.Download}
110
+ name="download"
131
111
  />
132
112
  Download
133
113
  </Link>
@@ -143,7 +123,7 @@ describe("Card", () => {
143
123
  src: "https://placeimg.com/300/400/arch",
144
124
  }}
145
125
  >
146
- <CardHeading id="editioncardheading1" level={HeadingLevels.Two}>
126
+ <CardHeading id="editioncardheading1" level="two">
147
127
  The Card Heading
148
128
  </CardHeading>
149
129
  <CardContent>
@@ -162,23 +142,19 @@ describe("Card", () => {
162
142
  src: "https://placeimg.com/300/400/arch",
163
143
  }}
164
144
  >
165
- <CardHeading
166
- id="editioncardheading1"
167
- level={HeadingLevels.Two}
168
- url="#edition-link"
169
- >
145
+ <CardHeading id="editioncardheading1" level="two" url="#edition-link">
170
146
  The Card Heading
171
147
  </CardHeading>
172
148
  <CardActions>
173
- <Link id="link-online" href="online" type={LinkTypes.Button}>
149
+ <Link id="link-online" href="online" type="button">
174
150
  Read Online
175
151
  </Link>
176
- <Link id="link-icon" href="#url" type={LinkTypes.Action}>
152
+ <Link id="link-icon" href="#url" type="action">
177
153
  <Icon
178
- align={IconAlign.Left}
179
- iconRotation={IconRotationTypes.Rotate0}
154
+ align="left"
155
+ iconRotation="rotate0"
180
156
  id="icon-cardWithNoContent"
181
- name={IconNames.Download}
157
+ name="download"
182
158
  />
183
159
  Download
184
160
  </Link>
@@ -187,24 +163,20 @@ describe("Card", () => {
187
163
  );
188
164
  const cardWithNoImage = (
189
165
  <Card id="cardWithNoImage" className="edition-card">
190
- <CardHeading
191
- id="editioncardheading1"
192
- level={HeadingLevels.Two}
193
- url="#edition-link"
194
- >
166
+ <CardHeading id="editioncardheading1" level="two" url="#edition-link">
195
167
  The Card Heading
196
168
  </CardHeading>
197
169
  <CardContent>middle column content</CardContent>
198
170
  <CardActions>
199
- <Link id="link-online" href="online" type={LinkTypes.Button}>
171
+ <Link id="link-online" href="online" type="button">
200
172
  Read Online
201
173
  </Link>
202
- <Link id="link-icon" href="#url" type={LinkTypes.Action}>
174
+ <Link id="link-icon" href="#url" type="action">
203
175
  <Icon
204
- align={IconAlign.Left}
205
- iconRotation={IconRotationTypes.Rotate0}
176
+ align="left"
177
+ iconRotation="rotate0"
206
178
  id="icon-cardWithNoImage"
207
- name={IconNames.Download}
179
+ name="download"
208
180
  />
209
181
  Download
210
182
  </Link>
@@ -220,17 +192,12 @@ describe("Card", () => {
220
192
  }}
221
193
  mainActionLink="http://nypl.org"
222
194
  >
223
- <CardHeading level={HeadingLevels.Three} id="heading1">
195
+ <CardHeading level="three" id="heading1">
224
196
  The Card Heading
225
197
  </CardHeading>
226
198
  <CardContent>middle column content</CardContent>
227
199
  <CardActions>
228
- <Button
229
- buttonType={ButtonTypes.Primary}
230
- id="button1"
231
- onClick={() => {}}
232
- type="submit"
233
- >
200
+ <Button id="button1" onClick={() => {}} type="submit">
234
201
  Example CTA
235
202
  </Button>
236
203
  </CardActions>
@@ -240,11 +207,11 @@ describe("Card", () => {
240
207
  <Card
241
208
  id="fullclick"
242
209
  imageProps={{
243
- aspectRatio: ImageRatios.ThreeByTwo,
210
+ aspectRatio: "threeByTwo",
244
211
  component: <Image alt="" src="https://placeimg.com/400/200/arch" />,
245
212
  }}
246
213
  >
247
- <CardHeading level={HeadingLevels.Three} id="heading1">
214
+ <CardHeading level="three" id="heading1">
248
215
  The Card Heading
249
216
  </CardHeading>
250
217
  <CardContent>middle column content</CardContent>
@@ -259,27 +226,17 @@ describe("Card", () => {
259
226
  }}
260
227
  isAlignedRightActions
261
228
  >
262
- <CardHeading level={HeadingLevels.Three} id="heading1">
229
+ <CardHeading level="three" id="heading1">
263
230
  The Card Heading
264
231
  </CardHeading>
265
232
  <CardContent>middle column content</CardContent>
266
233
  <CardActions>
267
- <Button
268
- onClick={() => {}}
269
- id="button1"
270
- buttonType={ButtonTypes.Primary}
271
- type="submit"
272
- >
234
+ <Button onClick={() => {}} id="button1" type="submit">
273
235
  Example CTA
274
236
  </Button>
275
237
  </CardActions>
276
238
  <CardActions>
277
- <Button
278
- onClick={() => {}}
279
- id="button2"
280
- buttonType={ButtonTypes.Primary}
281
- type="submit"
282
- >
239
+ <Button onClick={() => {}} id="button2" type="submit">
283
240
  Example CTA
284
241
  </Button>
285
242
  </CardActions>
@@ -295,21 +252,12 @@ describe("Card", () => {
295
252
  p="s"
296
253
  color="ui.error.primary"
297
254
  >
298
- <CardHeading
299
- level={HeadingLevels.Three}
300
- id="heading1"
301
- color="ui.error.secondary"
302
- >
255
+ <CardHeading level="three" id="heading1" color="ui.error.secondary">
303
256
  The Card Heading
304
257
  </CardHeading>
305
258
  <CardContent p="20px">middle column content</CardContent>
306
259
  <CardActions m="20px">
307
- <Button
308
- onClick={() => {}}
309
- id="button1"
310
- buttonType={ButtonTypes.Primary}
311
- type="submit"
312
- >
260
+ <Button onClick={() => {}} id="button1" type="submit">
313
261
  Example CTA
314
262
  </Button>
315
263
  </CardActions>
@@ -324,23 +272,14 @@ describe("Card", () => {
324
272
  }}
325
273
  data-testid="card-testid"
326
274
  >
327
- <CardHeading
328
- level={HeadingLevels.Three}
329
- id="heading1"
330
- color="ui.error.secondary"
331
- >
275
+ <CardHeading level="three" id="heading1" color="ui.error.secondary">
332
276
  The Card Heading
333
277
  </CardHeading>
334
278
  <CardContent data-testid="cardcontent-testid">
335
279
  middle column content
336
280
  </CardContent>
337
281
  <CardActions data-testid="cardaction-testid">
338
- <Button
339
- onClick={() => {}}
340
- id="button1"
341
- buttonType={ButtonTypes.Primary}
342
- type="submit"
343
- >
282
+ <Button onClick={() => {}} id="button1" type="submit">
344
283
  Example CTA
345
284
  </Button>
346
285
  </CardActions>
@@ -8,16 +8,25 @@ import {
8
8
  } from "@chakra-ui/react";
9
9
  import * as React from "react";
10
10
 
11
- import { LayoutTypes } from "../../helpers/enums";
11
+ import { LayoutTypes } from "../../helpers/types";
12
12
  import Heading from "../Heading/Heading";
13
- import Image, { ComponentImageProps, ImageProps } from "../Image/Image";
14
- import { ImageRatios, ImageSizes } from "../Image/ImageTypes";
13
+ import Image, {
14
+ ComponentImageProps,
15
+ ImageProps,
16
+ ImageSizes,
17
+ } from "../Image/Image";
15
18
  import useWindowSize from "../../hooks/useWindowSize";
19
+
20
+ interface CustomColorProps {
21
+ backgroundColor?: string;
22
+ color?: string;
23
+ }
24
+
16
25
  interface CardBaseProps {
17
26
  /** Optional value to control the alignment of the text and elements. */
18
27
  isCentered?: boolean;
19
28
  /** Optional value to render the layout in a row or column.
20
- * Default is `LayoutTypes.Column`. */
29
+ * Default is `"column"`. */
21
30
  layout?: LayoutTypes;
22
31
  }
23
32
 
@@ -115,13 +124,11 @@ export const CardHeading = chakra(Heading);
115
124
  export const CardContent = chakra((props: React.PropsWithChildren<{}>) => {
116
125
  const { children, ...rest } = props;
117
126
  const styles = useStyleConfig("CardContent");
118
- return (
119
- children && (
120
- <Box __css={styles} {...rest}>
121
- {children}
122
- </Box>
123
- )
124
- );
127
+ return children ? (
128
+ <Box __css={styles} {...rest}>
129
+ {children}
130
+ </Box>
131
+ ) : null;
125
132
  });
126
133
 
127
134
  // CardActions child-component
@@ -136,13 +143,11 @@ export const CardActions = chakra(
136
143
  topBorder,
137
144
  });
138
145
 
139
- return (
140
- children && (
141
- <Box __css={styles} {...rest}>
142
- {children}
143
- </Box>
144
- )
145
- );
146
+ return children ? (
147
+ <Box __css={styles} {...rest}>
148
+ {children}
149
+ </Box>
150
+ ) : null;
146
151
  }
147
152
  );
148
153
 
@@ -189,35 +194,35 @@ export const Card = chakra((props: React.PropsWithChildren<CardProps>) => {
189
194
  id,
190
195
  imageProps = {
191
196
  alt: "",
192
- aspectRatio: ImageRatios.Square,
197
+ aspectRatio: "square",
193
198
  caption: undefined,
194
199
  component: undefined,
195
200
  credit: undefined,
196
201
  isAtEnd: false,
197
- size: ImageSizes.Default,
202
+ size: "default",
198
203
  src: "",
199
204
  },
200
205
  isAlignedRightActions = false,
201
206
  isBordered,
202
207
  isCentered = false,
203
- layout = LayoutTypes.Column,
208
+ layout = "column",
204
209
  mainActionLink,
205
210
  ...rest
206
211
  } = props;
207
212
  const hasImage = imageProps.src || imageProps.component;
208
213
  const [finalImageSize, setFinalImageSize] = React.useState<ImageSizes>(
209
- imageProps.size
214
+ imageProps.size || "default"
210
215
  );
211
216
  const finalImageAspectRatio = imageProps.component
212
- ? ImageRatios.Original
217
+ ? "original"
213
218
  : imageProps.aspectRatio;
214
- const customColors = {};
215
- const cardContents = [];
216
- const cardRightContents = [];
219
+ const customColors: CustomColorProps = {};
220
+ const cardContents: JSX.Element[] = [];
221
+ const cardRightContents: JSX.Element[] = [];
217
222
  const windowDimensions = useWindowSize();
218
223
  let cardHeadingCount = 0;
219
224
 
220
- if (imageProps.component && imageProps.aspectRatio !== ImageRatios.Square) {
225
+ if (imageProps.component && imageProps.aspectRatio !== "square") {
221
226
  console.warn(
222
227
  "NYPL Reservoir Card: Both the `imageProps.component` and `imageProps.aspectRatio` " +
223
228
  "props were set but `imageProps.aspectRatio` will be ignored in favor " +
@@ -226,12 +231,12 @@ export const Card = chakra((props: React.PropsWithChildren<CardProps>) => {
226
231
  }
227
232
 
228
233
  // The `Card`'s image should always display as 100% width on mobile. To
229
- // achieve this, we set the size to `ImageSizes.Default` only when the
234
+ // achieve this, we set the size to `"default"` only when the
230
235
  // viewport is less than "600px". Otherwise, we set the size to
231
236
  // the value passed in via `imageSize`.
232
237
  React.useEffect(() => {
233
238
  if (windowDimensions.width < 600) {
234
- setFinalImageSize(ImageSizes.Default);
239
+ setFinalImageSize("default");
235
240
  } else {
236
241
  setFinalImageSize(imageProps.size);
237
242
  }
@@ -249,54 +254,53 @@ export const Card = chakra((props: React.PropsWithChildren<CardProps>) => {
249
254
  mainActionLink,
250
255
  });
251
256
 
252
- React.Children.map(children, (child: React.ReactElement, key) => {
253
- const isCardActions =
254
- child.type === CardActions || child.props.mdxType === "CardActions";
255
-
256
- if (child.type === CardHeading || child.props.mdxType === "CardHeading") {
257
- // If the child is a `CardHeading` component, then we add the
258
- // `CardLinkOverlay` inside of the `Heading` component and wrap its text.
259
- // This allows other links in the `CardActions` to be clickable. This is
260
- // only done for the first `CardHeading` component but does not affect
261
- // the full-click feature.
262
- const newChildren =
263
- cardHeadingCount === 0 ? (
264
- <CardLinkOverlay mainActionLink={mainActionLink}>
265
- {child.props.children}
266
- </CardLinkOverlay>
267
- ) : (
268
- child.props.children
269
- );
270
- const elem = React.cloneElement(child, {
271
- additionalStyles: {
272
- ...styles.heading,
273
- ...child.props.additionalStyles,
274
- },
275
- key,
276
- // Override the child text with the potential `CardLinkOverlay`.
277
- children: newChildren,
278
- layout,
279
- });
280
- cardContents.push(elem);
281
- cardHeadingCount++;
282
- } else if (
283
- child.type === CardContent ||
284
- child.props.mdxType === "CardContent"
285
- ) {
286
- const elem = React.cloneElement(child, { key });
287
- cardContents.push(elem);
288
- } else if (isCardActions) {
289
- const elem = React.cloneElement(child, { key, isCentered, layout });
290
-
291
- // Only allow `CardActions` to align to the right of the main
292
- // `CardContent` component when in the row layout.
293
- if (isAlignedRightActions && layout === LayoutTypes.Row) {
294
- cardRightContents.push(elem);
295
- } else {
257
+ React.Children.map(
258
+ children as JSX.Element,
259
+ (child: React.ReactElement, key) => {
260
+ const isCardActions =
261
+ child.type === CardActions || child.props.mdxType === "CardActions";
262
+ if (child.type === CardHeading || child.props.mdxType === "CardHeading") {
263
+ // If the child is a `CardHeading` component, then we add the
264
+ // `CardLinkOverlay` inside of the `Heading` component and wrap its text.
265
+ // This allows other links in the `CardActions` to be clickable. This is
266
+ // only done for the first `CardHeading` component but does not affect
267
+ // the full-click feature.
268
+ const newChildren =
269
+ cardHeadingCount === 0 ? (
270
+ <CardLinkOverlay mainActionLink={mainActionLink}>
271
+ {child.props.children}
272
+ </CardLinkOverlay>
273
+ ) : (
274
+ child.props.children
275
+ );
276
+ const elem = React.cloneElement(child, {
277
+ key,
278
+ // Override the child text with the potential `CardLinkOverlay`.
279
+ children: newChildren,
280
+ layout,
281
+ __css: styles.heading,
282
+ });
283
+ cardContents.push(elem);
284
+ cardHeadingCount++;
285
+ } else if (
286
+ child.type === CardContent ||
287
+ child.props.mdxType === "CardContent"
288
+ ) {
289
+ const elem = React.cloneElement(child, { key });
296
290
  cardContents.push(elem);
291
+ } else if (isCardActions) {
292
+ const elem = React.cloneElement(child, { key, isCentered, layout });
293
+
294
+ // Only allow `CardActions` to align to the right of the main
295
+ // `CardContent` component when in the row layout.
296
+ if (isAlignedRightActions && layout === "row") {
297
+ cardRightContents.push(elem);
298
+ } else {
299
+ cardContents.push(elem);
300
+ }
297
301
  }
298
302
  }
299
- });
303
+ );
300
304
 
301
305
  return (
302
306
  <CardLinkBox mainActionLink={mainActionLink}>
@@ -360,7 +360,7 @@ exports[`Card Renders the UI snapshot correctly 5`] = `
360
360
 
361
361
  exports[`Card Renders the UI snapshot correctly 6`] = `
362
362
  <div
363
- className="chakra-linkbox css-10n1vic"
363
+ className="chakra-linkbox css-hng3kb"
364
364
  >
365
365
  <div
366
366
  className="css-1xdhyk6"
@@ -2,10 +2,6 @@ import { Box } from "@chakra-ui/react";
2
2
  import { Canvas, Meta, Story } from "@storybook/addon-docs";
3
3
 
4
4
  import VideoPlayer from "../VideoPlayer/VideoPlayer";
5
- import {
6
- VideoPlayerAspectRatios,
7
- VideoPlayerTypes,
8
- } from "../VideoPlayer/VideoPlayerTypes";
9
5
  import { getCategory } from "../../utils/componentCategories";
10
6
  import DSProvider from "../../theme/provider";
11
7
 
@@ -48,8 +44,8 @@ guide on the Chakra UI site.
48
44
  <Box borderWidth="3px" padding="s" borderRadius="lg" overflow="hidden">
49
45
  <VideoPlayer
50
46
  videoId="nm-dD2tx6bk"
51
- videoType={VideoPlayerTypes.YouTube}
52
- aspectRatio={VideoPlayerAspectRatios.SixteenByNine}
47
+ videoType="youTube"
48
+ aspectRatio="sixteenByNine"
53
49
  />
54
50
  </Box>
55
51
  </DSProvider>
@@ -2,9 +2,7 @@ import { Box, Center, Circle, HStack, Square } from "@chakra-ui/react";
2
2
  import { Canvas, Meta, Story } from "@storybook/addon-docs";
3
3
 
4
4
  import Icon from "../Icons/Icon";
5
- import { IconColors, IconNames, IconSizes } from "../Icons/IconTypes";
6
5
  import Image from "../Image/Image";
7
- import { ImageSizes } from "../Image/ImageTypes";
8
6
  import { getCategory } from "../../utils/componentCategories";
9
7
  import DSProvider from "../../theme/provider";
10
8
 
@@ -54,7 +52,7 @@ guide on the Chakra UI site.
54
52
  <Center border="1px solid" borderColor="var(--nypl-colors-ui-gray-medium)">
55
53
  <Image
56
54
  alt="Centered Image"
57
- size={ImageSizes.Medium}
55
+ size="medium"
58
56
  src="https://placeimg.com/300/400/arch"
59
57
  />
60
58
  </Center>
@@ -70,18 +68,10 @@ a circle.
70
68
  <DSProvider>
71
69
  <HStack spacing="s">
72
70
  <Circle size="50px" bg="var(--nypl-colors-brand-secondary)">
73
- <Icon
74
- name={IconNames.Download}
75
- color={IconColors.UiWhite}
76
- size={IconSizes.Large}
77
- />
71
+ <Icon name="download" color="ui.white" size="large" />
78
72
  </Circle>
79
73
  <Circle size="50px" bg="var(--nypl-colors-ui-link-primary)">
80
- <Icon
81
- name={IconNames.Check}
82
- color={IconColors.UiWhite}
83
- size={IconSizes.Large}
84
- />
74
+ <Icon name="check" color="ui.white" size="large" />
85
75
  </Circle>
86
76
  </HStack>
87
77
  </DSProvider>
@@ -96,18 +86,10 @@ and width.
96
86
  <DSProvider>
97
87
  <HStack spacing="s">
98
88
  <Square size="50px" bg="var(--nypl-colors-brand-secondary)">
99
- <Icon
100
- name={IconNames.Download}
101
- color={IconColors.UiWhite}
102
- size={IconSizes.Large}
103
- />
89
+ <Icon name="download" color="ui.white" size="large" />
104
90
  </Square>
105
91
  <Square size="50px" bg="var(--nypl-colors-ui-link-primary)">
106
- <Icon
107
- name={IconNames.Check}
108
- color={IconColors.UiWhite}
109
- size={IconSizes.Large}
110
- />
92
+ <Icon name="check" color="ui.white" size="large" />
111
93
  </Square>
112
94
  </HStack>
113
95
  </DSProvider>
@@ -2,9 +2,7 @@ import { Box, Flex, Spacer, VStack } from "@chakra-ui/react";
2
2
  import { Canvas, Meta, Story } from "@storybook/addon-docs";
3
3
 
4
4
  import Heading from "../Heading/Heading";
5
- import { HeadingLevels } from "../Heading/HeadingTypes";
6
5
  import Link from "../Link/Link";
7
- import { LinkTypes } from "../Link/LinkTypes";
8
6
  import { getCategory } from "../../utils/componentCategories";
9
7
  import DSProvider from "../../theme/provider";
10
8
 
@@ -89,11 +87,11 @@ the `Spacer` component is more flexible for most situations.
89
87
  <Canvas>
90
88
  <DSProvider>
91
89
  <Flex alignItems="baseline">
92
- <Heading id="row-heading" level={HeadingLevels.Three}>
90
+ <Heading id="row-heading" level="three">
93
91
  Heading
94
92
  </Heading>
95
93
  <Spacer />
96
- <Link href="#viewmore" type={LinkTypes.Forwards}>
94
+ <Link href="#viewmore" type="forwards">
97
95
  View more
98
96
  </Link>
99
97
  </Flex>
@@ -102,11 +100,11 @@ the `Spacer` component is more flexible for most situations.
102
100
 
103
101
  ```jsx
104
102
  <Flex alignItems="baseline">
105
- <Heading id="row-heading" level={HeadingLevels.Three}>
103
+ <Heading id="row-heading" level="three">
106
104
  Heading
107
105
  </Heading>
108
106
  <Spacer />
109
- <Link href="#viewmore" type={LinkTypes.Forwards}>
107
+ <Link href="#viewmore" type="forwards">
110
108
  View more
111
109
  </Link>
112
110
  </Flex>