@nypl/design-system-react-components 0.27.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 (298) hide show
  1. package/CHANGELOG.md +29 -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/Notification/Notification.d.ts +1 -1
  23. package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +2 -1
  24. package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
  25. package/dist/components/SearchBar/SearchBar.d.ts +3 -2
  26. package/dist/components/Select/Select.d.ts +2 -5
  27. package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +4 -4
  28. package/dist/components/SkipNavigation/SkipNavigation.d.ts +17 -0
  29. package/dist/components/StatusBadge/StatusBadge.d.ts +2 -3
  30. package/dist/components/StructuredContent/StructuredContent.d.ts +2 -2
  31. package/dist/components/Table/Table.d.ts +1 -1
  32. package/dist/components/Template/Template.d.ts +2 -0
  33. package/dist/components/Text/Text.d.ts +1 -1
  34. package/dist/components/TextInput/TextInput.d.ts +21 -9
  35. package/dist/components/Toggle/Toggle.d.ts +1 -5
  36. package/dist/components/VideoPlayer/VideoPlayer.d.ts +2 -1
  37. package/dist/design-system-react-components.cjs.development.js +856 -1155
  38. package/dist/design-system-react-components.cjs.development.js.map +1 -1
  39. package/dist/design-system-react-components.cjs.production.min.js +1 -1
  40. package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
  41. package/dist/design-system-react-components.esm.js +858 -1220
  42. package/dist/design-system-react-components.esm.js.map +1 -1
  43. package/dist/helpers/types.d.ts +1 -0
  44. package/dist/index.d.ts +26 -47
  45. package/dist/theme/components/buttonGroup.d.ts +11 -0
  46. package/dist/theme/components/card.d.ts +104 -8
  47. package/dist/theme/components/componentWrapper.d.ts +4 -3
  48. package/dist/theme/components/customTable.d.ts +11 -14
  49. package/dist/theme/components/fieldset.d.ts +4 -3
  50. package/dist/theme/components/helperErrorText.d.ts +4 -3
  51. package/dist/theme/components/hero.d.ts +1 -1
  52. package/dist/theme/components/horizontalRule.d.ts +4 -3
  53. package/dist/theme/components/icon.d.ts +47743 -1
  54. package/dist/theme/components/image.d.ts +563 -10
  55. package/dist/theme/components/label.d.ts +4 -3
  56. package/dist/theme/components/list.d.ts +6 -7
  57. package/dist/theme/components/logo.d.ts +474 -1
  58. package/dist/theme/components/notification.d.ts +20 -16
  59. package/dist/theme/components/progressIndicator.d.ts +6 -4
  60. package/dist/theme/components/select.d.ts +4 -4
  61. package/dist/theme/components/skeletonLoader.d.ts +14 -10
  62. package/dist/theme/components/skipNavigation.d.ts +22 -0
  63. package/dist/theme/components/slider.d.ts +7 -6
  64. package/dist/theme/components/structuredContent.d.ts +10 -9
  65. package/dist/theme/components/text.d.ts +7 -1
  66. package/dist/theme/components/toggle.d.ts +6 -4
  67. package/dist/theme/provider.d.ts +2 -4
  68. package/dist/utils/componentCategories.d.ts +1 -1
  69. package/dist/utils/interfaces.d.ts +5 -0
  70. package/dist/utils/utils.d.ts +2 -18
  71. package/package.json +2 -2
  72. package/src/__tests__/setup.ts +3 -3
  73. package/src/__tests__/utils/utils.test.ts +1 -23
  74. package/src/components/AccessibilityGuide/SkipNavigation.stories.mdx +22 -14
  75. package/src/components/Accordion/Accordion.stories.mdx +43 -44
  76. package/src/components/Accordion/Accordion.test.tsx +5 -13
  77. package/src/components/Accordion/Accordion.tsx +14 -18
  78. package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +6 -6
  79. package/src/components/Autosuggest/Autosuggest.stories.mdx +1 -1
  80. package/src/components/Autosuggest/Autosuggest.stories.tsx +23 -25
  81. package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +21 -37
  82. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +4 -17
  83. package/src/components/Breadcrumbs/Breadcrumbs.tsx +18 -21
  84. package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +1 -100
  85. package/src/components/Button/Button.stories.mdx +89 -126
  86. package/src/components/Button/Button.test.tsx +16 -30
  87. package/src/components/Button/Button.tsx +14 -20
  88. package/src/components/ButtonGroup/ButtonGroup.stories.mdx +147 -0
  89. package/src/components/ButtonGroup/ButtonGroup.test.tsx +141 -0
  90. package/src/components/ButtonGroup/ButtonGroup.tsx +99 -0
  91. package/src/components/ButtonGroup/__snapshots__/ButtonGroup.test.tsx.snap +117 -0
  92. package/src/components/Card/Card.stories.mdx +143 -177
  93. package/src/components/Card/Card.test.tsx +36 -97
  94. package/src/components/Card/Card.tsx +78 -74
  95. package/src/components/Chakra/Box.stories.mdx +2 -6
  96. package/src/components/Chakra/Center.stories.mdx +5 -23
  97. package/src/components/Chakra/Flex.stories.mdx +4 -6
  98. package/src/components/Chakra/Stack.stories.mdx +9 -10
  99. package/src/components/Checkbox/Checkbox.stories.mdx +1 -1
  100. package/src/components/Checkbox/Checkbox.test.tsx +2 -2
  101. package/src/components/Checkbox/Checkbox.tsx +20 -13
  102. package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +6 -17
  103. package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +1 -7
  104. package/src/components/CheckboxGroup/CheckboxGroup.tsx +33 -29
  105. package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +0 -11
  106. package/src/components/ComponentWrapper/ComponentWrapper.tsx +3 -10
  107. package/src/components/DatePicker/DatePicker.stories.mdx +23 -37
  108. package/src/components/DatePicker/DatePicker.test.tsx +21 -19
  109. package/src/components/DatePicker/DatePicker.tsx +57 -49
  110. package/src/components/Form/Form.stories.mdx +46 -31
  111. package/src/components/Form/Form.test.tsx +1 -18
  112. package/src/components/Form/Form.tsx +7 -7
  113. package/src/components/Grid/SimpleGrid.stories.mdx +73 -49
  114. package/src/components/Grid/SimpleGrid.test.tsx +7 -9
  115. package/src/components/Grid/SimpleGrid.tsx +14 -11
  116. package/src/components/Heading/Heading.stories.mdx +27 -72
  117. package/src/components/Heading/Heading.test.tsx +18 -44
  118. package/src/components/Heading/Heading.tsx +7 -10
  119. package/src/components/HelperErrorText/HelperErrorText.stories.mdx +1 -3
  120. package/src/components/HelperErrorText/HelperErrorText.tsx +1 -5
  121. package/src/components/Hero/Hero.stories.mdx +219 -216
  122. package/src/components/Hero/Hero.test.tsx +107 -223
  123. package/src/components/Hero/Hero.tsx +63 -61
  124. package/src/components/Icons/Icon.stories.mdx +172 -118
  125. package/src/components/Icons/Icon.test.tsx +8 -16
  126. package/src/components/Icons/Icon.tsx +75 -29
  127. package/src/components/Icons/IconSvgs.tsx +42 -42
  128. package/src/components/Image/Image.stories.mdx +45 -132
  129. package/src/components/Image/Image.test.tsx +16 -31
  130. package/src/components/Image/Image.tsx +28 -12
  131. package/src/components/Link/Link.stories.mdx +30 -80
  132. package/src/components/Link/Link.test.tsx +25 -53
  133. package/src/components/Link/Link.tsx +43 -56
  134. package/src/components/Link/__snapshots__/Link.test.tsx.snap +1 -2
  135. package/src/components/List/List.stories.mdx +20 -31
  136. package/src/components/List/List.test.tsx +24 -43
  137. package/src/components/List/List.tsx +25 -36
  138. package/src/components/Logo/Logo.stories.mdx +94 -50
  139. package/src/components/Logo/Logo.test.tsx +10 -19
  140. package/src/components/Logo/Logo.tsx +50 -17
  141. package/src/components/Logo/LogoSvgs.tsx +78 -78
  142. package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +4 -4
  143. package/src/components/Modal/Modal.stories.mdx +8 -9
  144. package/src/components/Modal/Modal.test.tsx +5 -10
  145. package/src/components/Modal/Modal.tsx +1 -1
  146. package/src/components/Notification/Notification.stories.mdx +10 -28
  147. package/src/components/Notification/Notification.test.tsx +9 -12
  148. package/src/components/Notification/Notification.tsx +34 -37
  149. package/src/components/Pagination/Pagination.stories.mdx +2 -2
  150. package/src/components/Pagination/Pagination.tsx +15 -10
  151. package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +27 -53
  152. package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +9 -10
  153. package/src/components/ProgressIndicator/ProgressIndicator.tsx +17 -21
  154. package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +0 -10
  155. package/src/components/Radio/Radio.stories.mdx +1 -1
  156. package/src/components/Radio/Radio.tsx +9 -6
  157. package/src/components/RadioGroup/RadioGroup.stories.mdx +15 -16
  158. package/src/components/RadioGroup/RadioGroup.test.tsx +2 -8
  159. package/src/components/RadioGroup/RadioGroup.tsx +28 -24
  160. package/src/components/SearchBar/SearchBar.stories.mdx +1 -1
  161. package/src/components/SearchBar/SearchBar.test.tsx +1 -1
  162. package/src/components/SearchBar/SearchBar.tsx +14 -22
  163. package/src/components/SearchBar/__snapshots__/SearchBar.test.tsx.snap +0 -12
  164. package/src/components/Select/Select.stories.mdx +8 -23
  165. package/src/components/Select/Select.test.tsx +6 -7
  166. package/src/components/Select/Select.tsx +13 -26
  167. package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +17 -56
  168. package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +7 -21
  169. package/src/components/SkeletonLoader/SkeletonLoader.tsx +9 -8
  170. package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +33 -33
  171. package/src/components/SkipNavigation/SkipNavigation.stories.mdx +90 -0
  172. package/src/components/SkipNavigation/SkipNavigation.test.tsx +63 -0
  173. package/src/components/SkipNavigation/SkipNavigation.tsx +51 -0
  174. package/src/components/SkipNavigation/__snapshots__/SkipNavigation.test.tsx.snap +130 -0
  175. package/src/components/Slider/Slider.stories.mdx +19 -53
  176. package/src/components/Slider/Slider.test.tsx +2 -2
  177. package/src/components/Slider/Slider.tsx +10 -12
  178. package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +2 -9
  179. package/src/components/StatusBadge/StatusBadge.stories.mdx +6 -21
  180. package/src/components/StatusBadge/StatusBadge.test.tsx +2 -3
  181. package/src/components/StatusBadge/StatusBadge.tsx +3 -10
  182. package/src/components/StructuredContent/StructuredContent.stories.mdx +30 -58
  183. package/src/components/StructuredContent/StructuredContent.test.tsx +42 -44
  184. package/src/components/StructuredContent/StructuredContent.tsx +9 -18
  185. package/src/components/StyleGuide/Bidirectionality.stories.mdx +9 -23
  186. package/src/components/StyleGuide/Buttons.stories.mdx +62 -62
  187. package/src/components/StyleGuide/ColorCard.tsx +2 -4
  188. package/src/components/StyleGuide/Colors.stories.mdx +7 -8
  189. package/src/components/StyleGuide/DesignTokens.stories.mdx +5 -7
  190. package/src/components/StyleGuide/Forms.stories.mdx +0 -1
  191. package/src/components/StyleGuide/Iconography.stories.mdx +59 -77
  192. package/src/components/StyleGuide/Spacing.stories.mdx +0 -1
  193. package/src/components/StyleGuide/Typography.stories.mdx +15 -18
  194. package/src/components/Table/Table.stories.mdx +85 -1
  195. package/src/components/Table/Table.test.tsx +57 -1
  196. package/src/components/Table/Table.tsx +7 -4
  197. package/src/components/Table/__snapshots__/Table.test.tsx.snap +121 -0
  198. package/src/components/Tabs/Tabs.stories.mdx +1 -1
  199. package/src/components/Tabs/Tabs.test.tsx +2 -2
  200. package/src/components/Tabs/Tabs.tsx +26 -27
  201. package/src/components/Template/Template.stories.mdx +49 -54
  202. package/src/components/Template/Template.tsx +9 -3
  203. package/src/components/Text/Text.stories.mdx +5 -11
  204. package/src/components/Text/Text.test.tsx +3 -6
  205. package/src/components/Text/Text.tsx +3 -5
  206. package/src/components/TextInput/TextInput.stories.mdx +10 -22
  207. package/src/components/TextInput/TextInput.test.tsx +32 -62
  208. package/src/components/TextInput/TextInput.tsx +61 -30
  209. package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +1 -0
  210. package/src/components/Toggle/Toggle.stories.mdx +5 -16
  211. package/src/components/Toggle/Toggle.test.tsx +2 -3
  212. package/src/components/Toggle/Toggle.tsx +9 -10
  213. package/src/components/VideoPlayer/VideoPlayer.stories.mdx +13 -29
  214. package/src/components/VideoPlayer/VideoPlayer.test.tsx +18 -23
  215. package/src/components/VideoPlayer/VideoPlayer.tsx +13 -10
  216. package/src/docs/Chakra.stories.mdx +14 -11
  217. package/src/docs/Welcome.stories.mdx +23 -43
  218. package/src/helpers/types.ts +1 -0
  219. package/src/hooks/tests/useNYPLTheme.test.tsx +1 -1
  220. package/src/hooks/useNYPLTheme.stories.mdx +3 -6
  221. package/src/index.ts +51 -45
  222. package/src/theme/components/buttonGroup.ts +10 -0
  223. package/src/theme/components/card.ts +50 -15
  224. package/src/theme/components/componentWrapper.ts +5 -1
  225. package/src/theme/components/customTable.ts +8 -2
  226. package/src/theme/components/fieldset.ts +5 -1
  227. package/src/theme/components/helperErrorText.ts +5 -1
  228. package/src/theme/components/hero.ts +2 -2
  229. package/src/theme/components/horizontalRule.ts +5 -1
  230. package/src/theme/components/icon.ts +7 -1
  231. package/src/theme/components/image.ts +14 -3
  232. package/src/theme/components/label.ts +5 -1
  233. package/src/theme/components/list.ts +8 -2
  234. package/src/theme/components/logo.ts +5 -1
  235. package/src/theme/components/notification.ts +38 -14
  236. package/src/theme/components/progressIndicator.ts +10 -5
  237. package/src/theme/components/select.ts +5 -2
  238. package/src/theme/components/skeletonLoader.ts +8 -2
  239. package/src/theme/components/skipNavigation.ts +26 -0
  240. package/src/theme/components/slider.ts +13 -1
  241. package/src/theme/components/structuredContent.ts +11 -1
  242. package/src/theme/components/text.ts +12 -5
  243. package/src/theme/components/toggle.ts +9 -3
  244. package/src/theme/index.ts +4 -0
  245. package/src/theme/provider.tsx +1 -1
  246. package/src/utils/componentCategories.ts +13 -5
  247. package/src/utils/interfaces.ts +5 -0
  248. package/src/utils/utils.ts +2 -32
  249. package/dist/components/Accordion/AccordionTypes.d.ts +0 -5
  250. package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +0 -8
  251. package/dist/components/Button/ButtonTypes.d.ts +0 -8
  252. package/dist/components/DatePicker/DatePickerTypes.d.ts +0 -5
  253. package/dist/components/Form/FormTypes.d.ts +0 -2
  254. package/dist/components/Grid/GridTypes.d.ts +0 -9
  255. package/dist/components/Heading/HeadingTypes.d.ts +0 -14
  256. package/dist/components/Hero/HeroTypes.d.ts +0 -12
  257. package/dist/components/Icons/IconTypes.d.ts +0 -77
  258. package/dist/components/Image/ImageTypes.d.ts +0 -22
  259. package/dist/components/Link/LinkTypes.d.ts +0 -8
  260. package/dist/components/List/ListTypes.d.ts +0 -5
  261. package/dist/components/Logo/LogoTypes.d.ts +0 -54
  262. package/dist/components/Notification/NotificationTypes.d.ts +0 -5
  263. package/dist/components/ProgressIndicator/ProgressIndicatorTypes.d.ts +0 -8
  264. package/dist/components/Select/SelectTypes.d.ts +0 -8
  265. package/dist/components/SkeletonLoader/SkeletonLoaderTypes.d.ts +0 -5
  266. package/dist/components/StatusBadge/StatusBadgeTypes.d.ts +0 -5
  267. package/dist/components/StructuredContent/StructuredContentTypes.d.ts +0 -5
  268. package/dist/components/Text/TextTypes.d.ts +0 -6
  269. package/dist/components/TextInput/TextInputTypes.d.ts +0 -25
  270. package/dist/components/Toggle/ToggleTypes.d.ts +0 -4
  271. package/dist/components/VideoPlayer/VideoPlayerTypes.d.ts +0 -9
  272. package/dist/helpers/enums.d.ts +0 -4
  273. package/dist/utils/siteSections.d.ts +0 -2
  274. package/src/components/Accordion/AccordionTypes.tsx +0 -5
  275. package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +0 -8
  276. package/src/components/Button/ButtonTypes.tsx +0 -8
  277. package/src/components/DatePicker/DatePickerTypes.tsx +0 -5
  278. package/src/components/Form/FormTypes.tsx +0 -3
  279. package/src/components/Grid/GridTypes.tsx +0 -9
  280. package/src/components/Heading/HeadingTypes.tsx +0 -15
  281. package/src/components/Hero/HeroTypes.tsx +0 -20
  282. package/src/components/Icons/IconTypes.tsx +0 -83
  283. package/src/components/Image/ImageTypes.ts +0 -24
  284. package/src/components/Link/LinkTypes.tsx +0 -8
  285. package/src/components/List/ListTypes.tsx +0 -5
  286. package/src/components/Logo/LogoTypes.tsx +0 -56
  287. package/src/components/Notification/NotificationTypes.tsx +0 -5
  288. package/src/components/ProgressIndicator/ProgressIndicatorTypes.ts +0 -8
  289. package/src/components/Select/SelectTypes.tsx +0 -10
  290. package/src/components/SkeletonLoader/SkeletonLoaderTypes.tsx +0 -5
  291. package/src/components/StatusBadge/StatusBadgeTypes.tsx +0 -5
  292. package/src/components/StructuredContent/StructuredContentTypes.tsx +0 -5
  293. package/src/components/Text/TextTypes.tsx +0 -6
  294. package/src/components/TextInput/TextInputTypes.tsx +0 -48
  295. package/src/components/Toggle/ToggleTypes.tsx +0 -4
  296. package/src/components/VideoPlayer/VideoPlayerTypes.tsx +0 -10
  297. package/src/helpers/enums.ts +0 -4
  298. package/src/utils/siteSections.ts +0 -10
@@ -9,19 +9,8 @@ import {
9
9
  import { withDesign } from "storybook-addon-designs";
10
10
 
11
11
  import VideoPlayer from "./VideoPlayer";
12
- import { VideoPlayerAspectRatios, VideoPlayerTypes } from "./VideoPlayerTypes";
13
12
  import { getCategory } from "../../utils/componentCategories";
14
13
  import DSProvider from "../../theme/provider";
15
- import { getStorybookEnumValues } from "../../utils/utils";
16
-
17
- export const ratiosEnumValues = getStorybookEnumValues(
18
- VideoPlayerAspectRatios,
19
- "VideoPlayerAspectRatios"
20
- );
21
- export const typesEnumValues = getStorybookEnumValues(
22
- VideoPlayerTypes,
23
- "VideoPlayerTypes"
24
- );
25
14
 
26
15
  <Meta
27
16
  title={getCategory("VideoPlayer")}
@@ -36,21 +25,16 @@ export const typesEnumValues = getStorybookEnumValues(
36
25
  }}
37
26
  argTypes={{
38
27
  aspectRatio: {
39
- control: { type: "select" },
40
28
  table: {
41
- defaultValue: { summary: "VideoPlayerAspectRatios.SixteenByNine" },
29
+ defaultValue: { summary: "sixteenByNine" },
42
30
  },
43
- options: ratiosEnumValues.options,
44
31
  },
45
32
  className: { control: false },
46
33
  id: { control: false },
47
34
  showHelperInvalidText: {
48
35
  table: { defaultValue: { summary: true } },
49
36
  },
50
- videoType: {
51
- control: { type: "select" },
52
- options: typesEnumValues.options,
53
- },
37
+ videoType: {},
54
38
  }}
55
39
  />
56
40
 
@@ -59,7 +43,7 @@ export const typesEnumValues = getStorybookEnumValues(
59
43
  | Component Version | DS Version |
60
44
  | ----------------- | ---------- |
61
45
  | Added | `0.23.2` |
62
- | Latest | `0.26.0` |
46
+ | Latest | `0.28.0` |
63
47
 
64
48
  ## Table of Contents
65
49
 
@@ -94,7 +78,7 @@ is `16:9`.
94
78
  <Story
95
79
  name="VideoPlayer"
96
80
  args={{
97
- aspectRatio: "VideoPlayerAspectRatios.SixteenByNine",
81
+ aspectRatio: "sixteenByNine",
98
82
  className: undefined,
99
83
  descriptionText:
100
84
  "Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.",
@@ -112,9 +96,9 @@ is `16:9`.
112
96
  {(args) => (
113
97
  <VideoPlayer
114
98
  {...args}
115
- aspectRatio={ratiosEnumValues.getValue(args.aspectRatio)}
99
+ aspectRatio={args.aspectRatio}
116
100
  embedCode={args.embedCode}
117
- videoType={args.videoType && typesEnumValues.getValue(args.videoType)}
101
+ videoType={args.videoType && args.videoType}
118
102
  />
119
103
  )}
120
104
  </Story>
@@ -170,7 +154,9 @@ https://www.youtube.com/watch?v=nm-dD2tx6bk
170
154
 
171
155
  ## Example Embed Code Snippets
172
156
 
173
- The examples below are shown with precise HTML formatting. However, often the embed code snippets provided by 3rd party video services are delivered as one long string.
157
+ The examples below are shown with precise HTML formatting. However, often the
158
+ embed code snippets provided by 3rd party video services are delivered as one
159
+ long string.
174
160
 
175
161
  ### Vimeo
176
162
 
@@ -201,14 +187,12 @@ The examples below are shown with precise HTML formatting. However, often the em
201
187
 
202
188
  ## Errored
203
189
 
204
- If the necessary props are not passed to the `VideoPlayer` component, the component UI will display an error message.
190
+ If the necessary props are not passed to the `VideoPlayer` component, the
191
+ component UI will display an error message.
205
192
 
206
193
  <Canvas>
207
194
  <DSProvider>
208
- <VideoPlayer
209
- videoId="https://vimeo.com/474719268"
210
- videoType={VideoPlayerTypes.Vimeo}
211
- />
195
+ <VideoPlayer videoId="https://vimeo.com/474719268" videoType="vimeo" />
212
196
  </DSProvider>
213
197
  </Canvas>
214
198
 
@@ -221,7 +205,7 @@ It's possible to include HTML in the `helperText` prop.
221
205
  <VideoPlayer
222
206
  helperText="This helper text <b>contains HTML</b>."
223
207
  videoId="474719268"
224
- videoType={VideoPlayerTypes.Vimeo}
208
+ videoType="vimeo"
225
209
  />
226
210
  </DSProvider>
227
211
  </Canvas>
@@ -1,15 +1,14 @@
1
1
  import * as React from "react";
2
- import { render, screen } from "@testing-library/react";
2
+ import { render, RenderResult, screen } from "@testing-library/react";
3
3
  import { axe } from "jest-axe";
4
4
  import renderer from "react-test-renderer";
5
5
 
6
6
  import VideoPlayer from "./VideoPlayer";
7
- import { VideoPlayerAspectRatios, VideoPlayerTypes } from "./VideoPlayerTypes";
8
7
 
9
8
  describe("VideoPlayer Accessibility", () => {
10
9
  it("passes axe accessibility test", async () => {
11
10
  const { container } = render(
12
- <VideoPlayer videoType={VideoPlayerTypes.YouTube} videoId="nm-dD2tx6bk" />
11
+ <VideoPlayer videoType="youtube" videoId="nm-dD2tx6bk" />
13
12
  );
14
13
  expect(await axe(container)).toHaveNoViolations();
15
14
  });
@@ -17,13 +16,11 @@ describe("VideoPlayer Accessibility", () => {
17
16
 
18
17
  describe("VideoPlayer", () => {
19
18
  const videoId = "nm-dD2tx6bk";
20
- let utils;
19
+ let utils: RenderResult;
21
20
 
22
21
  describe("YouTube player", () => {
23
22
  beforeEach(() => {
24
- utils = render(
25
- <VideoPlayer videoType={VideoPlayerTypes.YouTube} videoId={videoId} />
26
- );
23
+ utils = render(<VideoPlayer videoType="youtube" videoId={videoId} />);
27
24
  });
28
25
 
29
26
  it("Renders VideoPlayer container", () => {
@@ -46,9 +43,7 @@ describe("VideoPlayer", () => {
46
43
  const videoId = "474719268";
47
44
 
48
45
  beforeEach(() => {
49
- utils = render(
50
- <VideoPlayer videoType={VideoPlayerTypes.Vimeo} videoId={videoId} />
51
- );
46
+ utils = render(<VideoPlayer videoType="vimeo" videoId={videoId} />);
52
47
  });
53
48
 
54
49
  it("Renders VideoPlayer iframe", () => {
@@ -107,7 +102,7 @@ describe("VideoPlayer", () => {
107
102
  beforeEach(() => {
108
103
  utils = render(
109
104
  <VideoPlayer
110
- videoType={VideoPlayerTypes.YouTube}
105
+ videoType="youtube"
111
106
  videoId={videoId}
112
107
  headingText="Video Player Heading"
113
108
  descriptionText="Video Player description text."
@@ -133,7 +128,7 @@ describe("VideoPlayer", () => {
133
128
  it("does not render the helper text", () => {
134
129
  utils.rerender(
135
130
  <VideoPlayer
136
- videoType={VideoPlayerTypes.YouTube}
131
+ videoType="youtube"
137
132
  videoId={videoId}
138
133
  headingText="Video Player Heading"
139
134
  descriptionText="Video Player description text."
@@ -151,7 +146,7 @@ describe("VideoPlayer", () => {
151
146
  it("Uses iframeTitle prop to add custom title attribute to iframe", () => {
152
147
  render(
153
148
  <VideoPlayer
154
- videoType={VideoPlayerTypes.Vimeo}
149
+ videoType="vimeo"
155
150
  videoId="474719268"
156
151
  iframeTitle="My custom iframe title."
157
152
  />
@@ -164,9 +159,9 @@ describe("VideoPlayer", () => {
164
159
  it("Throws error if the videoId prop not is formatted properly", () => {
165
160
  render(
166
161
  <VideoPlayer
167
- videoType={VideoPlayerTypes.Vimeo}
162
+ videoType="vimeo"
168
163
  videoId="http://vimeo.com/474719268"
169
- aspectRatio={VideoPlayerAspectRatios.FourByThree}
164
+ aspectRatio="fourByThree"
170
165
  />
171
166
  );
172
167
  expect(
@@ -191,7 +186,7 @@ describe("VideoPlayer", () => {
191
186
  "Only the `videoId` prop was set."
192
187
  );
193
188
 
194
- render(<VideoPlayer videoType={VideoPlayerTypes.Vimeo} />);
189
+ render(<VideoPlayer videoType="vimeo" />);
195
190
  expect(warn).toHaveBeenCalledWith(
196
191
  "NYPL Reservoir VideoPlayer: The `videoId` prop is also required. " +
197
192
  "Only the `videoType` prop was set."
@@ -200,7 +195,7 @@ describe("VideoPlayer", () => {
200
195
  render(
201
196
  <VideoPlayer
202
197
  embedCode="<iframe src='https://player.vimeo.com/video/421404144?h=5467db7edd' width='640' height='360' frameborder='0' allow='autoplay; fullscreen; picture-in-picture' allowfullscreen></iframe>"
203
- videoType={VideoPlayerTypes.Vimeo}
198
+ videoType="vimeo"
204
199
  videoId="http://vimeo.com/474719268"
205
200
  />
206
201
  );
@@ -212,7 +207,7 @@ describe("VideoPlayer", () => {
212
207
  render(
213
208
  <VideoPlayer
214
209
  embedCode="<iframe src='https://player.vimeo.com/video/421404144?h=5467db7edd' width='640' height='360' frameborder='0' allow='autoplay; fullscreen; picture-in-picture' allowfullscreen></iframe>"
215
- videoType={VideoPlayerTypes.Vimeo}
210
+ videoType="vimeo"
216
211
  />
217
212
  );
218
213
  expect(warn).toHaveBeenCalledWith(
@@ -245,7 +240,7 @@ describe("VideoPlayer", () => {
245
240
  <VideoPlayer
246
241
  id="video-player-without-text"
247
242
  videoId="474719268"
248
- videoType={VideoPlayerTypes.Vimeo}
243
+ videoType="vimeo"
249
244
  />
250
245
  )
251
246
  .toJSON();
@@ -257,7 +252,7 @@ describe("VideoPlayer", () => {
257
252
  id="video-player-with-text"
258
253
  helperText="VideoPlayer helper test."
259
254
  videoId="474719268"
260
- videoType={VideoPlayerTypes.Vimeo}
255
+ videoType="vimeo"
261
256
  />
262
257
  )
263
258
  .toJSON();
@@ -277,7 +272,7 @@ describe("VideoPlayer", () => {
277
272
  <VideoPlayer
278
273
  id="video-player-error"
279
274
  videoId="https://vimeo.com/474719268"
280
- videoType={VideoPlayerTypes.Vimeo}
275
+ videoType="vimeo"
281
276
  />
282
277
  )
283
278
  .toJSON();
@@ -286,7 +281,7 @@ describe("VideoPlayer", () => {
286
281
  <VideoPlayer
287
282
  id="chakra"
288
283
  videoId="474719268"
289
- videoType={VideoPlayerTypes.Vimeo}
284
+ videoType="vimeo"
290
285
  p="20px"
291
286
  color="ui.error.primary"
292
287
  />
@@ -297,7 +292,7 @@ describe("VideoPlayer", () => {
297
292
  <VideoPlayer
298
293
  id="props"
299
294
  videoId="474719268"
300
- videoType={VideoPlayerTypes.Vimeo}
295
+ videoType="vimeo"
301
296
  data-testid="props"
302
297
  />
303
298
  )
@@ -3,9 +3,12 @@ import * as React from "react";
3
3
 
4
4
  import ComponentWrapper from "../ComponentWrapper/ComponentWrapper";
5
5
  import { HelperErrorTextType } from "../HelperErrorText/HelperErrorText";
6
- import { VideoPlayerAspectRatios, VideoPlayerTypes } from "./VideoPlayerTypes";
7
- import { getVariant } from "../../utils/utils";
8
6
 
7
+ export type VideoPlayerTypes = "vimeo" | "youtube";
8
+ export type VideoPlayerAspectRatios =
9
+ | "fourByThree"
10
+ | "sixteenByNine"
11
+ | "square";
9
12
  export interface VideoPlayerProps {
10
13
  /** Optional aspect ratio prop to control the sizing of the video player; if
11
14
  * omitted, the video player defaults to `sixteen-by-nine` */
@@ -57,12 +60,12 @@ export const VideoPlayer = chakra(
57
60
  } = props;
58
61
 
59
62
  const iframeTitleFinal =
60
- videoType === VideoPlayerTypes.Vimeo
63
+ videoType === "vimeo"
61
64
  ? iframeTitle || "Vimeo video player"
62
65
  : iframeTitle || "YouTube video player";
63
66
 
64
67
  const videoSrc =
65
- videoType === VideoPlayerTypes.Vimeo
68
+ videoType === "vimeo"
66
69
  ? `https://player.vimeo.com/video/${videoId}?autoplay=0&loop=0`
67
70
  : `https://www.youtube.com/embed/${videoId}?disablekb=1&autoplay=0&fs=1&modestbranding=0`;
68
71
 
@@ -138,9 +141,7 @@ export const VideoPlayer = chakra(
138
141
  isInvalid = true;
139
142
  }
140
143
 
141
- const variant = isInvalid
142
- ? "invalid"
143
- : getVariant(aspectRatio, VideoPlayerAspectRatios);
144
+ const variant = isInvalid ? "invalid" : aspectRatio;
144
145
  const styles = useMultiStyleConfig("VideoPlayer", { variant });
145
146
 
146
147
  const embedElement = embedCodeFinal ? (
@@ -169,9 +170,11 @@ export const VideoPlayer = chakra(
169
170
  <span dangerouslySetInnerHTML={{ __html: errorMessage }} />
170
171
  ) : (
171
172
  <ComponentWrapper
172
- headingText={headingText ? headingText : null}
173
- descriptionText={descriptionText ? descriptionText : null}
174
- helperText={helperText && showHelperInvalidText ? helperText : null}
173
+ headingText={headingText ? headingText : undefined}
174
+ descriptionText={descriptionText ? descriptionText : undefined}
175
+ helperText={
176
+ helperText && showHelperInvalidText ? helperText : undefined
177
+ }
175
178
  id={`${id}-componentWrapper`}
176
179
  >
177
180
  <Box __css={styles.inside}>{embedElement}</Box>
@@ -92,8 +92,12 @@ wrap the elements in the `DSProvider` component.
92
92
  <Canvas>
93
93
  <DSProvider>
94
94
  <ButtonGroup>
95
- <Button isDisabled={false}>Enabled</Button>
96
- <Button isDisabled>Disabled</Button>
95
+ <Button id="enabled" isDisabled={false}>
96
+ Enabled
97
+ </Button>
98
+ <Button id="disabled" isDisabled>
99
+ Disabled
100
+ </Button>
97
101
  </ButtonGroup>
98
102
  </DSProvider>
99
103
  </Canvas>
@@ -259,7 +263,9 @@ const Button = {
259
263
  Now this variant can be rendered:
260
264
 
261
265
  ```tsx
262
- <Button buttonType={ButtonTypes.Secondary}>Press me</Button>
266
+ <Button buttonType="secondary" id="secondary">
267
+ Press me
268
+ </Button>
263
269
  ```
264
270
 
265
271
  ### Breakpoints
@@ -438,13 +444,13 @@ In the following example, the `Button` component has been passed `p` and `maxW`
438
444
  props which are shorthand for "padding" and "max-width", respectively.
439
445
 
440
446
  ```jsx
441
- <Button p="s" maxW="200px">
447
+ <Button id="styleprops" p="s" maxW="200px">
442
448
  Button
443
449
  </Button>
444
450
  ```
445
451
 
446
452
  <DSProvider>
447
- <Button p="s" maxW="200px">
453
+ <Button id="styleprops" p="s" maxW="200px">
448
454
  Button
449
455
  </Button>
450
456
  </DSProvider>
@@ -507,8 +513,7 @@ _Note: more patterns will be added._
507
513
  All DS components _should_ be used with their current styles. If a DS component
508
514
  needs an updated style, first contact the Design System and UX teams about this
509
515
  update. If you really _need_ to update a style and there is no available
510
- variant, then you can add styles directly to the `additionalStyles` prop. At the
511
- moment, not all DS components have this prop or feature.
516
+ variant, then you can add styles directly as style prop.
512
517
 
513
518
  For example, if the `Heading` component should render the text in NYPL's green
514
519
  color used for "success primary" and add a bold font weight, then you can do
@@ -522,10 +527,8 @@ return (
522
527
  <div>
523
528
  <Heading
524
529
  level={2}
525
- additionalStyles={{
526
- color: theme.colors.ui.sucess.primary,
527
- fontWeight: theme.fontWeights.bold,
528
- }}
530
+ color={theme.colors.ui.success.primary}
531
+ fontWeight={theme.fontWeights.bold}
529
532
  >
530
533
  Get a Digital Library Card Today in a Few Easy Steps
531
534
  </Heading>
@@ -2,27 +2,13 @@ import { Meta } from "@storybook/addon-docs";
2
2
 
3
3
  import { Box, Center, Circle, VStack, Square } from "@chakra-ui/react";
4
4
  import Card, { CardHeading, CardContent } from "../components/Card/Card";
5
- import Hero from "../components/Hero/Hero";
6
- import { HeroTypes } from "../components/Hero/HeroTypes";
7
5
  import Heading from "../components/Heading/Heading";
8
- import {
9
- HeadingLevels,
10
- HeadingSizes,
11
- } from "../components/Heading/HeadingTypes";
12
6
  import Icon from "../components/Icons/Icon";
13
- import {
14
- IconColors,
15
- IconNames,
16
- IconSizes,
17
- } from "../components/Icons/IconTypes";
18
7
  import Image from "../components/Image/Image";
19
8
  import Link from "../components/Link/Link";
20
- import { LinkTypes } from "../components/Link/LinkTypes";
21
9
  import Logo from "../components/Logo/Logo";
22
- import { LogoNames, LogoSizes } from "../components/Logo/LogoTypes";
23
10
  import SimpleGrid from "../components/Grid/SimpleGrid";
24
11
  import Text from "../components/Text/Text";
25
- import { TextSizes } from "../components/Text/TextTypes";
26
12
  import DSProvider from "../theme/provider";
27
13
 
28
14
  <Meta title="Welcome" />
@@ -30,11 +16,11 @@ import DSProvider from "../theme/provider";
30
16
  <DSProvider>
31
17
  <VStack spacing="s">
32
18
  <Center>
33
- <Logo name={LogoNames.ReservoirVerticalColor} size={LogoSizes.Small} />
19
+ <Logo name="reservoirVerticalColor" size="small" />
34
20
  </Center>
35
21
  <Box>
36
22
  <Center>
37
- <Heading level={HeadingLevels.One} size={HeadingSizes.Tertiary}>
23
+ <Heading level="one" size="tertiary">
38
24
  The React Component Library of the New York Public Library
39
25
  </Heading>
40
26
  </Center>
@@ -57,31 +43,29 @@ import DSProvider from "../theme/provider";
57
43
  }}
58
44
  >
59
45
  <Icon
60
- name={IconNames.ActionCheckCircle}
61
- size={IconSizes.ExtraExtraLarge}
62
- color={IconColors.SectionEducationSecondary}
63
- additionalStyles={{
64
- marginBottom: "s",
65
- }}
46
+ name="actionCheckCircle"
47
+ size="xxlarge"
48
+ color="section.education.secondary"
49
+ marginBottom="s"
66
50
  />
67
51
  <Card isCentered>
68
- <CardHeading id="main-heading1" level={HeadingLevels.Three}>
52
+ <CardHeading id="main-heading1" level="three">
69
53
  Get Started
70
54
  </CardHeading>
71
55
  <CardContent>
72
- <Text size={TextSizes.Caption}>
56
+ <Text size="caption">
73
57
  To start using Reservoir Design System, refer to Reservoir's
74
58
  Github{" "}
75
59
  <Link
76
60
  href="https://github.com/NYPL/nypl-design-system/wiki"
77
- type={LinkTypes.External}
61
+ type="external"
78
62
  >
79
63
  Wiki
80
64
  </Link>{" "}
81
65
  and{" "}
82
66
  <Link
83
67
  href="https://github.com/NYPL/nypl-design-system/blob/development/README.md"
84
- type={LinkTypes.External}
68
+ type="external"
85
69
  >
86
70
  ReadMe
87
71
  </Link>{" "}
@@ -101,19 +85,17 @@ import DSProvider from "../theme/provider";
101
85
  }}
102
86
  >
103
87
  <Icon
104
- name={IconNames.Search}
105
- size={IconSizes.ExtraExtraLarge}
106
- color={IconColors.SectionEducationSecondary}
107
- additionalStyles={{
108
- marginBottom: "s",
109
- }}
88
+ name="search"
89
+ size="xxlarge"
90
+ color="section.education.secondary"
91
+ marginBottom="s"
110
92
  />
111
93
  <Card isCentered>
112
- <CardHeading id="main-heading1" level={HeadingLevels.Three}>
94
+ <CardHeading id="main-heading1" level="three">
113
95
  Find Components
114
96
  </CardHeading>
115
97
  <CardContent>
116
- <Text size={TextSizes.Caption}>
98
+ <Text size="caption">
117
99
  For your convenience, the Reservoir Design System components have
118
100
  been organized into logical categories based on both form and
119
101
  function. Please refer to the <b>COMPONENTS</b> section in the
@@ -132,15 +114,13 @@ import DSProvider from "../theme/provider";
132
114
  }}
133
115
  >
134
116
  <Icon
135
- name={IconNames.FileTypeSpreadsheet}
136
- size={IconSizes.ExtraExtraLarge}
137
- color={IconColors.SectionEducationSecondary}
138
- additionalStyles={{
139
- marginBottom: "s",
140
- }}
117
+ name="fileTypeSpreadsheet"
118
+ size="xxlarge"
119
+ color="section.education.secondary"
120
+ marginBottom="s"
141
121
  />
142
122
  <Card isCentered>
143
- <CardHeading id="main-heading1" level={HeadingLevels.Three}>
123
+ <CardHeading id="main-heading1" level="three">
144
124
  View the Code
145
125
  </CardHeading>
146
126
  <CardContent>
@@ -149,13 +129,13 @@ import DSProvider from "../theme/provider";
149
129
  published on{" "}
150
130
  <Link
151
131
  href="https://www.npmjs.com/package/@nypl/design-system-react-components"
152
- type={LinkTypes.External}
132
+ type="external"
153
133
  >
154
134
  npm
155
135
  </Link>
156
136
  . If you're looking to contribute to this project, checkout the <Link
157
137
  href="https://github.com/NYPL/nypl-design-system"
158
- type={LinkTypes.External}
138
+ type="external"
159
139
  >
160
140
  nypl-design-system
161
141
  </Link> repo on Github for more information.
@@ -0,0 +1 @@
1
+ export type LayoutTypes = "column" | "row";
@@ -20,7 +20,7 @@ describe("useNYPLTheme", () => {
20
20
  wrapper: ({ children }) => <DSProvider>{children}</DSProvider>,
21
21
  });
22
22
  const allKeys = Object.keys(result.current);
23
- const colorsKeys = Object.keys(result.current.colors);
23
+ const colorsKeys = Object.keys((result.current as any).colors);
24
24
 
25
25
  expect(allKeys).toEqual([
26
26
  "breakpoints",
@@ -55,8 +55,7 @@ This will allow you to use NYPL-specific styles in your components through CSS-i
55
55
  All DS components _should_ be used with their current styles. If a DS component
56
56
  needs an updated style, first contact the Design System and UX teams about this
57
57
  update. If you really _need_ to update a style and there is no available
58
- variant, then you can add styles directly to the `additionalStyles` prop. At the
59
- moment, not all DS components have this prop or feature.
58
+ variant, then you can add styles directly as style prop.
60
59
 
61
60
  For example, if the `Heading` component should render the text in NYPL's green
62
61
  color used for "success primary" and add a bold font weight, then you can do
@@ -70,10 +69,8 @@ return (
70
69
  <div>
71
70
  <Heading
72
71
  level={2}
73
- additionalStyles={{
74
- color: theme.colors.ui.sucess.primary,
75
- fontWeight: theme.fontWeights.bold,
76
- }}
72
+ color={theme.colors.ui.success.primary}
73
+ fontWeight={theme.fontWeights.bold}
77
74
  >
78
75
  Get a Digital Library Card Today in a Few Easy Steps
79
76
  </Heading>