@nypl/design-system-react-components 1.0.0 → 1.0.3-beta

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 (296) hide show
  1. package/README.md +3 -5
  2. package/dist/components/Checkbox/Checkbox.d.ts +0 -1
  3. package/dist/components/ComponentWrapper/ComponentWrapper.d.ts +8 -0
  4. package/dist/components/Heading/Heading.d.ts +2 -0
  5. package/dist/components/Logo/Logo.d.ts +1 -1
  6. package/dist/components/Logo/LogoSvgs.d.ts +4 -0
  7. package/dist/components/Slider/Slider.d.ts +1 -2
  8. package/dist/components/TextInput/TextInput.d.ts +2 -1
  9. package/dist/design-system-react-components.cjs.development.js +1038 -674
  10. package/dist/design-system-react-components.cjs.development.js.map +1 -1
  11. package/dist/design-system-react-components.cjs.production.min.js +1 -1
  12. package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
  13. package/dist/design-system-react-components.esm.js +1039 -675
  14. package/dist/design-system-react-components.esm.js.map +1 -1
  15. package/dist/hooks/{tests → __tests__}/useCarouselStyles.test.d.ts +0 -0
  16. package/dist/theme/components/button.d.ts +1 -0
  17. package/dist/theme/components/card.d.ts +98 -13
  18. package/dist/theme/components/checkboxGroup.d.ts +1 -1
  19. package/dist/theme/components/global.d.ts +2 -2
  20. package/dist/theme/components/heading.d.ts +4 -16
  21. package/dist/theme/components/image.d.ts +6 -0
  22. package/dist/theme/components/radio.d.ts +8 -0
  23. package/dist/theme/components/radioGroup.d.ts +1 -1
  24. package/dist/theme/components/skipNavigation.d.ts +3 -0
  25. package/dist/theme/components/structuredContent.d.ts +0 -5
  26. package/dist/theme/components/template.d.ts +4 -1
  27. package/dist/utils/utils.d.ts +15 -0
  28. package/package.json +6 -7
  29. package/CHANGELOG.md +0 -1399
  30. package/src/__tests__/fileMock.ts +0 -6
  31. package/src/__tests__/setup.ts +0 -27
  32. package/src/__tests__/utils/utils.test.ts +0 -18
  33. package/src/components/AccessibilityGuide/SkipNavigation.stories.mdx +0 -42
  34. package/src/components/Accordion/Accordion.stories.mdx +0 -361
  35. package/src/components/Accordion/Accordion.test.tsx +0 -237
  36. package/src/components/Accordion/Accordion.tsx +0 -136
  37. package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +0 -734
  38. package/src/components/Autosuggest/Autosuggest.stories.mdx +0 -75
  39. package/src/components/Autosuggest/Autosuggest.stories.tsx +0 -211
  40. package/src/components/Autosuggest/_Autosuggest.scss +0 -51
  41. package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +0 -231
  42. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +0 -144
  43. package/src/components/Breadcrumbs/Breadcrumbs.tsx +0 -98
  44. package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +0 -695
  45. package/src/components/Button/Button.stories.mdx +0 -320
  46. package/src/components/Button/Button.test.tsx +0 -184
  47. package/src/components/Button/Button.tsx +0 -95
  48. package/src/components/Button/__snapshots__/Button.test.tsx.snap +0 -106
  49. package/src/components/ButtonGroup/ButtonGroup.stories.mdx +0 -147
  50. package/src/components/ButtonGroup/ButtonGroup.test.tsx +0 -141
  51. package/src/components/ButtonGroup/ButtonGroup.tsx +0 -99
  52. package/src/components/ButtonGroup/__snapshots__/ButtonGroup.test.tsx.snap +0 -117
  53. package/src/components/Card/Card.stories.mdx +0 -1043
  54. package/src/components/Card/Card.test.tsx +0 -388
  55. package/src/components/Card/Card.tsx +0 -345
  56. package/src/components/Card/__snapshots__/Card.test.tsx.snap +0 -568
  57. package/src/components/Chakra/Box.stories.mdx +0 -52
  58. package/src/components/Chakra/Center.stories.mdx +0 -96
  59. package/src/components/Chakra/Flex.stories.mdx +0 -111
  60. package/src/components/Chakra/Grid.stories.mdx +0 -89
  61. package/src/components/Chakra/Stack.stories.mdx +0 -109
  62. package/src/components/Checkbox/Checkbox.stories.mdx +0 -243
  63. package/src/components/Checkbox/Checkbox.test.tsx +0 -319
  64. package/src/components/Checkbox/Checkbox.tsx +0 -166
  65. package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +0 -616
  66. package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +0 -462
  67. package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +0 -492
  68. package/src/components/CheckboxGroup/CheckboxGroup.tsx +0 -173
  69. package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +0 -1722
  70. package/src/components/ComponentWrapper/ComponentWrapper.test.tsx +0 -163
  71. package/src/components/ComponentWrapper/ComponentWrapper.tsx +0 -67
  72. package/src/components/ComponentWrapper/__snapshots__/ComponentWrapper.test.tsx.snap +0 -98
  73. package/src/components/DatePicker/DatePicker.stories.mdx +0 -452
  74. package/src/components/DatePicker/DatePicker.test.tsx +0 -940
  75. package/src/components/DatePicker/DatePicker.tsx +0 -450
  76. package/src/components/DatePicker/_DatePicker.scss +0 -100
  77. package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +0 -889
  78. package/src/components/Fieldset/Fieldset.stories.mdx +0 -96
  79. package/src/components/Fieldset/Fieldset.test.tsx +0 -155
  80. package/src/components/Fieldset/Fieldset.tsx +0 -55
  81. package/src/components/Fieldset/__snapshots__/Fieldset.test.tsx.snap +0 -89
  82. package/src/components/Form/Form.stories.mdx +0 -426
  83. package/src/components/Form/Form.test.tsx +0 -234
  84. package/src/components/Form/Form.tsx +0 -124
  85. package/src/components/Form/__snapshots__/Form.test.tsx.snap +0 -115
  86. package/src/components/Grid/SimpleGrid.stories.mdx +0 -338
  87. package/src/components/Grid/SimpleGrid.test.tsx +0 -79
  88. package/src/components/Grid/SimpleGrid.tsx +0 -49
  89. package/src/components/Grid/__snapshots__/SimpleGrid.test.tsx.snap +0 -23
  90. package/src/components/Heading/Heading.stories.mdx +0 -184
  91. package/src/components/Heading/Heading.test.tsx +0 -171
  92. package/src/components/Heading/Heading.tsx +0 -101
  93. package/src/components/Heading/__snapshots__/Heading.test.tsx.snap +0 -90
  94. package/src/components/HelperErrorText/HelperErrorText.stories.mdx +0 -172
  95. package/src/components/HelperErrorText/HelperErrorText.test.tsx +0 -114
  96. package/src/components/HelperErrorText/HelperErrorText.tsx +0 -62
  97. package/src/components/HelperErrorText/__snapshots__/HelperErrorText.test.tsx.snap +0 -93
  98. package/src/components/Hero/Hero.stories.mdx +0 -378
  99. package/src/components/Hero/Hero.test.tsx +0 -611
  100. package/src/components/Hero/Hero.tsx +0 -203
  101. package/src/components/Hero/__snapshots__/Hero.test.tsx.snap +0 -379
  102. package/src/components/HorizontalRule/HorizontalRule.stories.mdx +0 -73
  103. package/src/components/HorizontalRule/HorizontalRule.test.tsx +0 -54
  104. package/src/components/HorizontalRule/HorizontalRule.tsx +0 -27
  105. package/src/components/HorizontalRule/__snapshots__/HorizontalRule.test.tsx.snap +0 -44
  106. package/src/components/Icons/Icon.stories.mdx +0 -413
  107. package/src/components/Icons/Icon.test.tsx +0 -120
  108. package/src/components/Icons/Icon.tsx +0 -187
  109. package/src/components/Icons/IconSvgs.tsx +0 -64
  110. package/src/components/Icons/__snapshots__/Icon.test.tsx.snap +0 -129
  111. package/src/components/Image/Image.stories.mdx +0 -332
  112. package/src/components/Image/Image.test.tsx +0 -155
  113. package/src/components/Image/Image.tsx +0 -171
  114. package/src/components/Image/__snapshots__/Image.test.tsx.snap +0 -269
  115. package/src/components/Label/Label.stories.mdx +0 -100
  116. package/src/components/Label/Label.test.tsx +0 -116
  117. package/src/components/Label/Label.tsx +0 -55
  118. package/src/components/Label/__snapshots__/Label.test.tsx.snap +0 -45
  119. package/src/components/Link/Link.stories.mdx +0 -249
  120. package/src/components/Link/Link.test.tsx +0 -224
  121. package/src/components/Link/Link.tsx +0 -178
  122. package/src/components/Link/__snapshots__/Link.test.tsx.snap +0 -286
  123. package/src/components/List/List.stories.mdx +0 -393
  124. package/src/components/List/List.test.tsx +0 -265
  125. package/src/components/List/List.tsx +0 -156
  126. package/src/components/List/__snapshots__/List.test.tsx.snap +0 -213
  127. package/src/components/Logo/Logo.stories.mdx +0 -290
  128. package/src/components/Logo/Logo.test.tsx +0 -116
  129. package/src/components/Logo/Logo.tsx +0 -147
  130. package/src/components/Logo/LogoSvgs.tsx +0 -82
  131. package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +0 -142
  132. package/src/components/Modal/Modal.stories.mdx +0 -301
  133. package/src/components/Modal/Modal.test.tsx +0 -157
  134. package/src/components/Modal/Modal.tsx +0 -154
  135. package/src/components/Modal/__snapshots__/Modal.test.tsx.snap +0 -25
  136. package/src/components/Notification/Notification.stories.mdx +0 -358
  137. package/src/components/Notification/Notification.test.tsx +0 -279
  138. package/src/components/Notification/Notification.tsx +0 -224
  139. package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +0 -525
  140. package/src/components/Pagination/Pagination.stories.mdx +0 -184
  141. package/src/components/Pagination/Pagination.test.tsx +0 -419
  142. package/src/components/Pagination/Pagination.tsx +0 -269
  143. package/src/components/Pagination/__snapshots__/Pagination.test.tsx.snap +0 -544
  144. package/src/components/Placeholder/Placeholder.tsx +0 -19
  145. package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +0 -360
  146. package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +0 -298
  147. package/src/components/ProgressIndicator/ProgressIndicator.tsx +0 -132
  148. package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +0 -434
  149. package/src/components/Radio/Radio.stories.mdx +0 -216
  150. package/src/components/Radio/Radio.test.tsx +0 -247
  151. package/src/components/Radio/Radio.tsx +0 -128
  152. package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +0 -411
  153. package/src/components/RadioGroup/RadioGroup.stories.mdx +0 -478
  154. package/src/components/RadioGroup/RadioGroup.test.tsx +0 -471
  155. package/src/components/RadioGroup/RadioGroup.tsx +0 -170
  156. package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +0 -1430
  157. package/src/components/SearchBar/SearchBar.stories.mdx +0 -518
  158. package/src/components/SearchBar/SearchBar.test.tsx +0 -435
  159. package/src/components/SearchBar/SearchBar.tsx +0 -210
  160. package/src/components/SearchBar/__snapshots__/SearchBar.test.tsx.snap +0 -1027
  161. package/src/components/Select/Select.stories.mdx +0 -439
  162. package/src/components/Select/Select.test.tsx +0 -358
  163. package/src/components/Select/Select.tsx +0 -181
  164. package/src/components/Select/__snapshots__/Select.test.tsx.snap +0 -885
  165. package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +0 -142
  166. package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +0 -116
  167. package/src/components/SkeletonLoader/SkeletonLoader.tsx +0 -123
  168. package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +0 -898
  169. package/src/components/SkipNavigation/SkipNavigation.stories.mdx +0 -90
  170. package/src/components/SkipNavigation/SkipNavigation.test.tsx +0 -63
  171. package/src/components/SkipNavigation/SkipNavigation.tsx +0 -51
  172. package/src/components/SkipNavigation/__snapshots__/SkipNavigation.test.tsx.snap +0 -130
  173. package/src/components/Slider/Slider.stories.mdx +0 -628
  174. package/src/components/Slider/Slider.test.tsx +0 -736
  175. package/src/components/Slider/Slider.tsx +0 -322
  176. package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +0 -2153
  177. package/src/components/StatusBadge/StatusBadge.stories.mdx +0 -109
  178. package/src/components/StatusBadge/StatusBadge.test.tsx +0 -70
  179. package/src/components/StatusBadge/StatusBadge.tsx +0 -35
  180. package/src/components/StatusBadge/__snapshots__/StatusBadge.test.tsx.snap +0 -47
  181. package/src/components/StructuredContent/StructuredContent.stories.mdx +0 -567
  182. package/src/components/StructuredContent/StructuredContent.test.tsx +0 -435
  183. package/src/components/StructuredContent/StructuredContent.tsx +0 -139
  184. package/src/components/StructuredContent/__snapshots__/StructuredContent.test.tsx.snap +0 -368
  185. package/src/components/StyleGuide/Bidirectionality.stories.mdx +0 -206
  186. package/src/components/StyleGuide/Breakpoints.stories.mdx +0 -55
  187. package/src/components/StyleGuide/Buttons.stories.mdx +0 -194
  188. package/src/components/StyleGuide/ColorCard.tsx +0 -43
  189. package/src/components/StyleGuide/Colors.stories.mdx +0 -201
  190. package/src/components/StyleGuide/DesignTokens.stories.mdx +0 -193
  191. package/src/components/StyleGuide/Forms.stories.mdx +0 -94
  192. package/src/components/StyleGuide/Iconography.stories.mdx +0 -142
  193. package/src/components/StyleGuide/Spacing.stories.mdx +0 -116
  194. package/src/components/StyleGuide/Typography.stories.mdx +0 -419
  195. package/src/components/Table/Table.stories.mdx +0 -276
  196. package/src/components/Table/Table.test.tsx +0 -208
  197. package/src/components/Table/Table.tsx +0 -131
  198. package/src/components/Table/__snapshots__/Table.test.tsx.snap +0 -1703
  199. package/src/components/Tabs/Tabs.stories.mdx +0 -338
  200. package/src/components/Tabs/Tabs.test.tsx +0 -298
  201. package/src/components/Tabs/Tabs.tsx +0 -264
  202. package/src/components/Tabs/__snapshots__/Tabs.test.tsx.snap +0 -584
  203. package/src/components/Template/Template.stories.mdx +0 -691
  204. package/src/components/Template/Template.test.tsx +0 -309
  205. package/src/components/Template/Template.tsx +0 -326
  206. package/src/components/Template/__snapshots__/Template.test.tsx.snap +0 -342
  207. package/src/components/Text/Text.stories.mdx +0 -103
  208. package/src/components/Text/Text.test.tsx +0 -63
  209. package/src/components/Text/Text.tsx +0 -50
  210. package/src/components/Text/__snapshots__/Text.test.tsx.snap +0 -50
  211. package/src/components/TextInput/TextInput.stories.mdx +0 -268
  212. package/src/components/TextInput/TextInput.test.tsx +0 -451
  213. package/src/components/TextInput/TextInput.tsx +0 -240
  214. package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +0 -264
  215. package/src/components/Toggle/Toggle.stories.mdx +0 -237
  216. package/src/components/Toggle/Toggle.test.tsx +0 -170
  217. package/src/components/Toggle/Toggle.tsx +0 -126
  218. package/src/components/Toggle/__snapshots__/Toggle.test.tsx.snap +0 -442
  219. package/src/components/VideoPlayer/VideoPlayer.stories.mdx +0 -211
  220. package/src/components/VideoPlayer/VideoPlayer.test.tsx +0 -308
  221. package/src/components/VideoPlayer/VideoPlayer.tsx +0 -188
  222. package/src/components/VideoPlayer/__snapshots__/VideoPlayer.test.tsx.snap +0 -187
  223. package/src/docs/Chakra.stories.mdx +0 -563
  224. package/src/docs/Welcome.stories.mdx +0 -148
  225. package/src/helpers/types.ts +0 -1
  226. package/src/hooks/tests/useCarouselStyles.test.ts +0 -140
  227. package/src/hooks/tests/useNYPLTheme.test.tsx +0 -36
  228. package/src/hooks/useCarouselStyles.stories.mdx +0 -30
  229. package/src/hooks/useCarouselStyles.ts +0 -35
  230. package/src/hooks/useNYPLTheme.stories.mdx +0 -98
  231. package/src/hooks/useNYPLTheme.ts +0 -91
  232. package/src/hooks/useWindowSize.stories.mdx +0 -23
  233. package/src/hooks/useWindowSize.ts +0 -40
  234. package/src/index.ts +0 -136
  235. package/src/resources.scss +0 -6
  236. package/src/styles/base/_01-breakpoints.scss +0 -27
  237. package/src/styles/base/_02-mixins.scss +0 -103
  238. package/src/styles/base/_place-holder.scss +0 -33
  239. package/src/styles/space/_space-inline.scss +0 -79
  240. package/src/styles/space/_space-inset.scss +0 -57
  241. package/src/styles/space/_space-stack.scss +0 -116
  242. package/src/styles.scss +0 -23
  243. package/src/theme/components/accordion.ts +0 -25
  244. package/src/theme/components/breadcrumb.ts +0 -94
  245. package/src/theme/components/button.ts +0 -132
  246. package/src/theme/components/buttonGroup.ts +0 -10
  247. package/src/theme/components/card.ts +0 -231
  248. package/src/theme/components/checkbox.ts +0 -110
  249. package/src/theme/components/checkboxGroup.ts +0 -10
  250. package/src/theme/components/componentWrapper.ts +0 -14
  251. package/src/theme/components/customTable.ts +0 -77
  252. package/src/theme/components/datePicker.ts +0 -17
  253. package/src/theme/components/fieldset.ts +0 -23
  254. package/src/theme/components/global.ts +0 -91
  255. package/src/theme/components/globalMixins.ts +0 -24
  256. package/src/theme/components/heading.ts +0 -79
  257. package/src/theme/components/helperErrorText.ts +0 -14
  258. package/src/theme/components/hero.ts +0 -238
  259. package/src/theme/components/horizontalRule.ts +0 -17
  260. package/src/theme/components/icon.ts +0 -88
  261. package/src/theme/components/image.ts +0 -135
  262. package/src/theme/components/label.ts +0 -15
  263. package/src/theme/components/link.ts +0 -63
  264. package/src/theme/components/list.ts +0 -88
  265. package/src/theme/components/logo.ts +0 -58
  266. package/src/theme/components/notification.ts +0 -132
  267. package/src/theme/components/pagination.ts +0 -17
  268. package/src/theme/components/progressIndicator.ts +0 -67
  269. package/src/theme/components/radio.ts +0 -103
  270. package/src/theme/components/radioGroup.ts +0 -10
  271. package/src/theme/components/searchBar.ts +0 -19
  272. package/src/theme/components/select.ts +0 -72
  273. package/src/theme/components/skeletonLoader.ts +0 -113
  274. package/src/theme/components/skipNavigation.ts +0 -26
  275. package/src/theme/components/slider.ts +0 -95
  276. package/src/theme/components/statusBadge.ts +0 -26
  277. package/src/theme/components/structuredContent.ts +0 -149
  278. package/src/theme/components/tabs.ts +0 -109
  279. package/src/theme/components/template.ts +0 -114
  280. package/src/theme/components/text.ts +0 -38
  281. package/src/theme/components/textInput.ts +0 -65
  282. package/src/theme/components/toggle.ts +0 -109
  283. package/src/theme/components/videoPlayer.ts +0 -47
  284. package/src/theme/foundations/breakpoints.ts +0 -24
  285. package/src/theme/foundations/colors.ts +0 -212
  286. package/src/theme/foundations/global.ts +0 -43
  287. package/src/theme/foundations/radii.ts +0 -7
  288. package/src/theme/foundations/shadows.ts +0 -5
  289. package/src/theme/foundations/spacing.ts +0 -136
  290. package/src/theme/foundations/typography.ts +0 -107
  291. package/src/theme/index.ts +0 -131
  292. package/src/theme/provider.tsx +0 -9
  293. package/src/theme/types.ts +0 -1
  294. package/src/utils/componentCategories.ts +0 -152
  295. package/src/utils/interfaces.ts +0 -5
  296. package/src/utils/utils.ts +0 -44
@@ -1,442 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`Toggle Renders the UI snapshot correctly 1`] = `
4
- <div
5
- className="css-1xdhyk6"
6
- >
7
- <label
8
- className="chakra-switch css-18x0has"
9
- onClick={[Function]}
10
- >
11
- <input
12
- aria-disabled={false}
13
- aria-invalid={false}
14
- aria-label="Test Label"
15
- checked={false}
16
- className="chakra-switch__input"
17
- disabled={false}
18
- id="inputID"
19
- name="default"
20
- onBlur={[Function]}
21
- onChange={[Function]}
22
- onFocus={[Function]}
23
- onKeyDown={[Function]}
24
- onKeyUp={[Function]}
25
- required={false}
26
- style={
27
- Object {
28
- "border": "0px",
29
- "clip": "rect(0px, 0px, 0px, 0px)",
30
- "height": "1px",
31
- "margin": "-1px",
32
- "overflow": "hidden",
33
- "padding": "0px",
34
- "position": "absolute",
35
- "whiteSpace": "nowrap",
36
- "width": "1px",
37
- }
38
- }
39
- type="checkbox"
40
- />
41
- <span
42
- aria-hidden={true}
43
- className="chakra-switch__track css-14qxnv8"
44
- onMouseDown={[Function]}
45
- onMouseEnter={[Function]}
46
- onMouseLeave={[Function]}
47
- onMouseUp={[Function]}
48
- >
49
- <span
50
- className="chakra-switch__thumb css-0"
51
- />
52
- </span>
53
- <span
54
- className="chakra-switch__label css-1y8kf23"
55
- onMouseDown={[Function]}
56
- onTouchStart={[Function]}
57
- >
58
- Test Label
59
- </span>
60
- </label>
61
- </div>
62
- `;
63
-
64
- exports[`Toggle Renders the UI snapshot correctly 2`] = `
65
- <div
66
- className="css-1xdhyk6"
67
- >
68
- <label
69
- className="chakra-switch css-18x0has"
70
- data-checked=""
71
- onClick={[Function]}
72
- >
73
- <input
74
- aria-disabled={false}
75
- aria-invalid={false}
76
- aria-label="Test Label"
77
- checked={true}
78
- className="chakra-switch__input"
79
- disabled={false}
80
- id="Toggle-checked"
81
- name="default"
82
- onBlur={[Function]}
83
- onChange={[Function]}
84
- onFocus={[Function]}
85
- onKeyDown={[Function]}
86
- onKeyUp={[Function]}
87
- required={false}
88
- style={
89
- Object {
90
- "border": "0px",
91
- "clip": "rect(0px, 0px, 0px, 0px)",
92
- "height": "1px",
93
- "margin": "-1px",
94
- "overflow": "hidden",
95
- "padding": "0px",
96
- "position": "absolute",
97
- "whiteSpace": "nowrap",
98
- "width": "1px",
99
- }
100
- }
101
- type="checkbox"
102
- />
103
- <span
104
- aria-hidden={true}
105
- className="chakra-switch__track css-14qxnv8"
106
- data-checked=""
107
- onMouseDown={[Function]}
108
- onMouseEnter={[Function]}
109
- onMouseLeave={[Function]}
110
- onMouseUp={[Function]}
111
- >
112
- <span
113
- className="chakra-switch__thumb css-0"
114
- data-checked=""
115
- />
116
- </span>
117
- <span
118
- className="chakra-switch__label css-1y8kf23"
119
- data-checked=""
120
- onMouseDown={[Function]}
121
- onTouchStart={[Function]}
122
- >
123
- Test Label
124
- </span>
125
- </label>
126
- </div>
127
- `;
128
-
129
- exports[`Toggle Renders the UI snapshot correctly 3`] = `
130
- <div
131
- className="css-1xdhyk6"
132
- >
133
- <label
134
- className="chakra-switch css-18x0has"
135
- data-invalid=""
136
- onClick={[Function]}
137
- >
138
- <input
139
- aria-disabled={false}
140
- aria-invalid={true}
141
- aria-label="Test Label"
142
- checked={false}
143
- className="chakra-switch__input"
144
- disabled={false}
145
- id="Toggle-invalid"
146
- name="default"
147
- onBlur={[Function]}
148
- onChange={[Function]}
149
- onFocus={[Function]}
150
- onKeyDown={[Function]}
151
- onKeyUp={[Function]}
152
- required={false}
153
- style={
154
- Object {
155
- "border": "0px",
156
- "clip": "rect(0px, 0px, 0px, 0px)",
157
- "height": "1px",
158
- "margin": "-1px",
159
- "overflow": "hidden",
160
- "padding": "0px",
161
- "position": "absolute",
162
- "whiteSpace": "nowrap",
163
- "width": "1px",
164
- }
165
- }
166
- type="checkbox"
167
- />
168
- <span
169
- aria-hidden={true}
170
- className="chakra-switch__track css-14qxnv8"
171
- data-invalid=""
172
- onMouseDown={[Function]}
173
- onMouseEnter={[Function]}
174
- onMouseLeave={[Function]}
175
- onMouseUp={[Function]}
176
- >
177
- <span
178
- className="chakra-switch__thumb css-0"
179
- />
180
- </span>
181
- <span
182
- className="chakra-switch__label css-1y8kf23"
183
- data-invalid=""
184
- onMouseDown={[Function]}
185
- onTouchStart={[Function]}
186
- >
187
- Test Label
188
- </span>
189
- </label>
190
- </div>
191
- `;
192
-
193
- exports[`Toggle Renders the UI snapshot correctly 4`] = `
194
- <div
195
- className="css-1xdhyk6"
196
- >
197
- <label
198
- className="chakra-switch css-18x0has"
199
- data-disabled=""
200
- onClick={[Function]}
201
- >
202
- <input
203
- aria-disabled={true}
204
- aria-invalid={false}
205
- aria-label="Test Label"
206
- checked={false}
207
- className="chakra-switch__input"
208
- disabled={true}
209
- id="Toggle-disabled"
210
- name="default"
211
- onBlur={[Function]}
212
- onChange={[Function]}
213
- onFocus={[Function]}
214
- onKeyDown={[Function]}
215
- onKeyUp={[Function]}
216
- required={false}
217
- style={
218
- Object {
219
- "border": "0px",
220
- "clip": "rect(0px, 0px, 0px, 0px)",
221
- "height": "1px",
222
- "margin": "-1px",
223
- "overflow": "hidden",
224
- "padding": "0px",
225
- "position": "absolute",
226
- "whiteSpace": "nowrap",
227
- "width": "1px",
228
- }
229
- }
230
- type="checkbox"
231
- />
232
- <span
233
- aria-hidden={true}
234
- className="chakra-switch__track css-14qxnv8"
235
- data-disabled=""
236
- onMouseDown={[Function]}
237
- onMouseEnter={[Function]}
238
- onMouseLeave={[Function]}
239
- onMouseUp={[Function]}
240
- >
241
- <span
242
- className="chakra-switch__thumb css-0"
243
- />
244
- </span>
245
- <span
246
- className="chakra-switch__label css-1y8kf23"
247
- data-disabled=""
248
- onMouseDown={[Function]}
249
- onTouchStart={[Function]}
250
- >
251
- Test Label
252
- </span>
253
- </label>
254
- </div>
255
- `;
256
-
257
- exports[`Toggle Renders the UI snapshot correctly 5`] = `
258
- <div
259
- className="css-1xdhyk6"
260
- >
261
- <label
262
- className="chakra-switch css-18x0has"
263
- data-disabled=""
264
- onClick={[Function]}
265
- >
266
- <input
267
- aria-disabled={true}
268
- aria-invalid={false}
269
- aria-label="Test Label"
270
- checked={false}
271
- className="chakra-switch__input"
272
- disabled={true}
273
- id="Toggle-disabled"
274
- name="default"
275
- onBlur={[Function]}
276
- onChange={[Function]}
277
- onFocus={[Function]}
278
- onKeyDown={[Function]}
279
- onKeyUp={[Function]}
280
- required={false}
281
- style={
282
- Object {
283
- "border": "0px",
284
- "clip": "rect(0px, 0px, 0px, 0px)",
285
- "height": "1px",
286
- "margin": "-1px",
287
- "overflow": "hidden",
288
- "padding": "0px",
289
- "position": "absolute",
290
- "whiteSpace": "nowrap",
291
- "width": "1px",
292
- }
293
- }
294
- type="checkbox"
295
- />
296
- <span
297
- aria-hidden={true}
298
- className="chakra-switch__track css-14qxnv8"
299
- data-disabled=""
300
- onMouseDown={[Function]}
301
- onMouseEnter={[Function]}
302
- onMouseLeave={[Function]}
303
- onMouseUp={[Function]}
304
- >
305
- <span
306
- className="chakra-switch__thumb css-0"
307
- />
308
- </span>
309
- <span
310
- className="chakra-switch__label css-1y8kf23"
311
- data-disabled=""
312
- onMouseDown={[Function]}
313
- onTouchStart={[Function]}
314
- >
315
- Test Label
316
- </span>
317
- </label>
318
- </div>
319
- `;
320
-
321
- exports[`Toggle Renders the UI snapshot correctly 6`] = `
322
- <div
323
- className="css-13xjm0o"
324
- >
325
- <label
326
- className="chakra-switch css-18x0has"
327
- onClick={[Function]}
328
- >
329
- <input
330
- aria-disabled={false}
331
- aria-invalid={false}
332
- aria-label="Test Label"
333
- checked={false}
334
- className="chakra-switch__input"
335
- disabled={false}
336
- id="chakra"
337
- name="default"
338
- onBlur={[Function]}
339
- onChange={[Function]}
340
- onFocus={[Function]}
341
- onKeyDown={[Function]}
342
- onKeyUp={[Function]}
343
- required={false}
344
- style={
345
- Object {
346
- "border": "0px",
347
- "clip": "rect(0px, 0px, 0px, 0px)",
348
- "height": "1px",
349
- "margin": "-1px",
350
- "overflow": "hidden",
351
- "padding": "0px",
352
- "position": "absolute",
353
- "whiteSpace": "nowrap",
354
- "width": "1px",
355
- }
356
- }
357
- type="checkbox"
358
- />
359
- <span
360
- aria-hidden={true}
361
- className="chakra-switch__track css-14qxnv8"
362
- onMouseDown={[Function]}
363
- onMouseEnter={[Function]}
364
- onMouseLeave={[Function]}
365
- onMouseUp={[Function]}
366
- >
367
- <span
368
- className="chakra-switch__thumb css-0"
369
- />
370
- </span>
371
- <span
372
- className="chakra-switch__label css-1y8kf23"
373
- onMouseDown={[Function]}
374
- onTouchStart={[Function]}
375
- >
376
- Test Label
377
- </span>
378
- </label>
379
- </div>
380
- `;
381
-
382
- exports[`Toggle Renders the UI snapshot correctly 7`] = `
383
- <div
384
- className="css-1xdhyk6"
385
- data-testid="props"
386
- >
387
- <label
388
- className="chakra-switch css-18x0has"
389
- onClick={[Function]}
390
- >
391
- <input
392
- aria-disabled={false}
393
- aria-invalid={false}
394
- aria-label="Test Label"
395
- checked={false}
396
- className="chakra-switch__input"
397
- disabled={false}
398
- id="props"
399
- name="default"
400
- onBlur={[Function]}
401
- onChange={[Function]}
402
- onFocus={[Function]}
403
- onKeyDown={[Function]}
404
- onKeyUp={[Function]}
405
- required={false}
406
- style={
407
- Object {
408
- "border": "0px",
409
- "clip": "rect(0px, 0px, 0px, 0px)",
410
- "height": "1px",
411
- "margin": "-1px",
412
- "overflow": "hidden",
413
- "padding": "0px",
414
- "position": "absolute",
415
- "whiteSpace": "nowrap",
416
- "width": "1px",
417
- }
418
- }
419
- type="checkbox"
420
- />
421
- <span
422
- aria-hidden={true}
423
- className="chakra-switch__track css-14qxnv8"
424
- onMouseDown={[Function]}
425
- onMouseEnter={[Function]}
426
- onMouseLeave={[Function]}
427
- onMouseUp={[Function]}
428
- >
429
- <span
430
- className="chakra-switch__thumb css-0"
431
- />
432
- </span>
433
- <span
434
- className="chakra-switch__label css-1y8kf23"
435
- onMouseDown={[Function]}
436
- onTouchStart={[Function]}
437
- >
438
- Test Label
439
- </span>
440
- </label>
441
- </div>
442
- `;
@@ -1,211 +0,0 @@
1
- import { action } from "@storybook/addon-actions";
2
- import {
3
- ArgsTable,
4
- Canvas,
5
- Description,
6
- Meta,
7
- Story,
8
- } from "@storybook/addon-docs";
9
- import { withDesign } from "storybook-addon-designs";
10
-
11
- import VideoPlayer from "./VideoPlayer";
12
- import { getCategory } from "../../utils/componentCategories";
13
- import DSProvider from "../../theme/provider";
14
-
15
- <Meta
16
- title={getCategory("VideoPlayer")}
17
- component={VideoPlayer}
18
- decorators={[withDesign]}
19
- parameters={{
20
- design: {
21
- type: "figma",
22
- url: "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Main?node-id=10968%3A3680",
23
- },
24
- jest: ["VideoPlayer.test.tsx"],
25
- }}
26
- argTypes={{
27
- aspectRatio: {
28
- table: {
29
- defaultValue: { summary: "sixteenByNine" },
30
- },
31
- },
32
- className: { control: false },
33
- id: { control: false },
34
- showHelperInvalidText: {
35
- table: { defaultValue: { summary: true } },
36
- },
37
- videoType: {},
38
- }}
39
- />
40
-
41
- # Video Player
42
-
43
- | Component Version | DS Version |
44
- | ----------------- | ---------- |
45
- | Added | `0.23.2` |
46
- | Latest | `0.28.0` |
47
-
48
- ## Table of Contents
49
-
50
- - [Overview](#overview)
51
- - [Component Props](#component-props)
52
- - [Accessibility](#accessibility)
53
- - [Extracting Video IDs](#extracting-video-ids)
54
- - [Example Embed Code Snippets](#example-embed-code-snippets)
55
- - [Errored](#errored)
56
- - [HTML in Helper Text](#html-in-helper-text)
57
-
58
- ## Overview
59
-
60
- <Description of={VideoPlayer} />
61
-
62
- The `VideoPlayer` component is used to embed a `Vimeo` or `YouTube` video player
63
- on a page. The component requires the `embedCode` prop or both the `videoType`
64
- and `videoId` props. The component will not function properly if you try to set
65
- all of them.
66
-
67
- You can extract the videoId from the video's URL. **IMPORTANT:** Do not try to
68
- enter the full video URL as the `videoId` value.
69
-
70
- The `aspectRatio` prop is used to control the sizing of the space allotted for
71
- the video rendering. Ultimately, the `aspectRatio` prop should be set to match
72
- the aspect ratio of the video that is being rendered. The default aspect ratio
73
- is `16:9`.
74
-
75
- ## Component Props
76
-
77
- <Canvas withToolbar>
78
- <Story
79
- name="VideoPlayer"
80
- args={{
81
- aspectRatio: "sixteenByNine",
82
- className: undefined,
83
- descriptionText:
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.",
85
- 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>`,
86
- headingText: "NYPL Video",
87
- helperText:
88
- "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.",
89
- id: "videoPlayer-id",
90
- iframeTitle: undefined,
91
- showHelperInvalidText: true,
92
- videoId: undefined,
93
- videoType: undefined,
94
- }}
95
- >
96
- {(args) => (
97
- <VideoPlayer
98
- {...args}
99
- aspectRatio={args.aspectRatio}
100
- embedCode={args.embedCode}
101
- videoType={args.videoType && args.videoType}
102
- />
103
- )}
104
- </Story>
105
- </Canvas>
106
-
107
- <ArgsTable story="VideoPlayer" />
108
-
109
- **Example Vimeo IDs:** `474719268`, `491405018`, `493795778` (square)<br />
110
- **Example YouTube IDs:** `PfqgDG1qrKg`, `roi5V8ppi7Y`, `nm-dD2tx6bk`
111
-
112
- ## Accessibility
113
-
114
- The `VideoPlayer` component renders an `iframe` element with either a Vimeo or
115
- YouTube video. `iframe`s can be accessible if a `title` attribute is provided.
116
- When passing in a video type and a video `id`, make sure to pass a title. Otherwise,
117
- the title must already be provided in the embed code value that is passed to the
118
- `embedCode` prop. A default one is provided but a custom one is recommended.
119
-
120
- Not all the Vimeo or YouTube videos passed to the `VideoPlayer` component will
121
- be owned by The New York Public Library. Because these videos are hosted on a
122
- third-party platform, we cannot guarantee that the video will be accessible.
123
- Besides setting the `title` in the embedded `iframe`, there are _some_ ways we
124
- can reduce accessibility issues.
125
-
126
- - Never use autoplay on videos; a user must click the play button to start the
127
- video.
128
- - Always show all the video player's controls for the user to interact with
129
- the video.
130
- - Keep the full screen option available.
131
-
132
- Resources:
133
-
134
- - [W3C Making Audio and Video Media Accessible](https://www.w3.org/WAI/media/av/)
135
- - [WebAIM Creating Accessible Frames and Iframes](https://webaim.org/techniques/frames/)
136
- - [MDN iframe: The Inline Frame element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe)
137
- - [Deque University Be Sure to Provide Titles for Iframes](https://dequeuniversity.com/tips/provide-iframe-titles)
138
-
139
- ## Extracting Video IDs
140
-
141
- ### Vimeo
142
-
143
- ```
144
- https://vimeo.com/[VIDEO_ID]
145
- https://vimeo.com/474719268
146
- ```
147
-
148
- ### YouTube
149
-
150
- ```
151
- https://www.youtube.com/watch?v=[VIDEO_ID]
152
- https://www.youtube.com/watch?v=nm-dD2tx6bk
153
- ```
154
-
155
- ## Example Embed Code Snippets
156
-
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.
160
-
161
- ### Vimeo
162
-
163
- ```html
164
- <iframe
165
- src="https://player.vimeo.com/video/421404144?h=5467db7edd"
166
- width="640"
167
- height="360"
168
- frameborder="0"
169
- allow="autoplay; fullscreen; picture-in-picture"
170
- allowfullscreen
171
- ></iframe>
172
- ```
173
-
174
- ### YouTube
175
-
176
- ```html
177
- <iframe
178
- width="560"
179
- height="315"
180
- src="https://www.youtube.com/embed/nm-dD2tx6bk"
181
- title="YouTube video player"
182
- frameborder="0"
183
- allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
184
- allowfullscreen
185
- ></iframe>
186
- ```
187
-
188
- ## Errored
189
-
190
- If the necessary props are not passed to the `VideoPlayer` component, the
191
- component UI will display an error message.
192
-
193
- <Canvas>
194
- <DSProvider>
195
- <VideoPlayer videoId="https://vimeo.com/474719268" videoType="vimeo" />
196
- </DSProvider>
197
- </Canvas>
198
-
199
- ## HTML in Helper Text
200
-
201
- It's possible to include HTML in the `helperText` prop.
202
-
203
- <Canvas>
204
- <DSProvider>
205
- <VideoPlayer
206
- helperText="This helper text <b>contains HTML</b>."
207
- videoId="474719268"
208
- videoType="vimeo"
209
- />
210
- </DSProvider>
211
- </Canvas>