@nypl/design-system-react-components 0.26.1 → 1.0.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 (307) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/README.md +7 -7
  3. package/dist/components/Accordion/Accordion.d.ts +1 -1
  4. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +1 -5
  5. package/dist/components/Button/Button.d.ts +2 -10
  6. package/dist/components/ButtonGroup/ButtonGroup.d.ts +22 -0
  7. package/dist/components/Card/Card.d.ts +2 -2
  8. package/dist/components/Checkbox/Checkbox.d.ts +10 -8
  9. package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +1 -1
  10. package/dist/components/DatePicker/DatePicker.d.ts +1 -1
  11. package/dist/components/Form/Form.d.ts +2 -2
  12. package/dist/components/Grid/SimpleGrid.d.ts +6 -3
  13. package/dist/components/Heading/Heading.d.ts +2 -5
  14. package/dist/components/HelperErrorText/HelperErrorText.d.ts +1 -5
  15. package/dist/components/Hero/Hero.d.ts +13 -9
  16. package/dist/components/Icons/Icon.d.ts +6 -5
  17. package/dist/components/Icons/IconSvgs.d.ts +21 -21
  18. package/dist/components/Image/Image.d.ts +8 -5
  19. package/dist/components/Link/Link.d.ts +1 -9
  20. package/dist/components/List/List.d.ts +7 -11
  21. package/dist/components/Logo/Logo.d.ts +2 -5
  22. package/dist/components/Logo/LogoSvgs.d.ts +39 -39
  23. package/dist/components/Modal/Modal.d.ts +28 -8
  24. package/dist/components/Notification/Notification.d.ts +1 -1
  25. package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +2 -1
  26. package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
  27. package/dist/components/SearchBar/SearchBar.d.ts +3 -2
  28. package/dist/components/Select/Select.d.ts +2 -5
  29. package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +4 -4
  30. package/dist/components/SkipNavigation/SkipNavigation.d.ts +17 -0
  31. package/dist/components/StatusBadge/StatusBadge.d.ts +2 -3
  32. package/dist/components/StructuredContent/StructuredContent.d.ts +2 -2
  33. package/dist/components/Table/Table.d.ts +1 -1
  34. package/dist/components/Template/Template.d.ts +2 -0
  35. package/dist/components/Text/Text.d.ts +1 -1
  36. package/dist/components/TextInput/TextInput.d.ts +21 -9
  37. package/dist/components/Toggle/Toggle.d.ts +1 -5
  38. package/dist/components/VideoPlayer/VideoPlayer.d.ts +2 -1
  39. package/dist/design-system-react-components.cjs.development.js +983 -1222
  40. package/dist/design-system-react-components.cjs.development.js.map +1 -1
  41. package/dist/design-system-react-components.cjs.production.min.js +1 -1
  42. package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
  43. package/dist/design-system-react-components.esm.js +982 -1285
  44. package/dist/design-system-react-components.esm.js.map +1 -1
  45. package/dist/helpers/types.d.ts +1 -0
  46. package/dist/index.d.ts +27 -48
  47. package/dist/styles.css +1 -1
  48. package/dist/theme/components/buttonGroup.d.ts +11 -0
  49. package/dist/theme/components/card.d.ts +104 -8
  50. package/dist/theme/components/componentWrapper.d.ts +4 -3
  51. package/dist/theme/components/customTable.d.ts +11 -14
  52. package/dist/theme/components/fieldset.d.ts +4 -3
  53. package/dist/theme/components/helperErrorText.d.ts +4 -3
  54. package/dist/theme/components/hero.d.ts +1 -1
  55. package/dist/theme/components/horizontalRule.d.ts +4 -3
  56. package/dist/theme/components/icon.d.ts +47743 -1
  57. package/dist/theme/components/image.d.ts +563 -10
  58. package/dist/theme/components/label.d.ts +4 -3
  59. package/dist/theme/components/list.d.ts +6 -7
  60. package/dist/theme/components/logo.d.ts +474 -1
  61. package/dist/theme/components/notification.d.ts +20 -16
  62. package/dist/theme/components/progressIndicator.d.ts +6 -4
  63. package/dist/theme/components/select.d.ts +4 -10
  64. package/dist/theme/components/skeletonLoader.d.ts +14 -10
  65. package/dist/theme/components/skipNavigation.d.ts +22 -0
  66. package/dist/theme/components/slider.d.ts +7 -6
  67. package/dist/theme/components/structuredContent.d.ts +10 -9
  68. package/dist/theme/components/text.d.ts +7 -1
  69. package/dist/theme/components/toggle.d.ts +6 -4
  70. package/dist/theme/provider.d.ts +2 -4
  71. package/dist/utils/componentCategories.d.ts +1 -1
  72. package/dist/utils/interfaces.d.ts +5 -0
  73. package/dist/utils/utils.d.ts +2 -18
  74. package/package.json +15 -16
  75. package/src/__tests__/setup.ts +3 -3
  76. package/src/__tests__/utils/utils.test.ts +1 -23
  77. package/src/components/AccessibilityGuide/SkipNavigation.stories.mdx +22 -14
  78. package/src/components/Accordion/Accordion.stories.mdx +43 -44
  79. package/src/components/Accordion/Accordion.test.tsx +5 -13
  80. package/src/components/Accordion/Accordion.tsx +14 -18
  81. package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +6 -6
  82. package/src/components/Autosuggest/Autosuggest.stories.mdx +1 -1
  83. package/src/components/Autosuggest/Autosuggest.stories.tsx +23 -25
  84. package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +21 -37
  85. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +4 -17
  86. package/src/components/Breadcrumbs/Breadcrumbs.tsx +18 -21
  87. package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +1 -100
  88. package/src/components/Button/Button.stories.mdx +89 -126
  89. package/src/components/Button/Button.test.tsx +16 -30
  90. package/src/components/Button/Button.tsx +14 -20
  91. package/src/components/ButtonGroup/ButtonGroup.stories.mdx +147 -0
  92. package/src/components/ButtonGroup/ButtonGroup.test.tsx +141 -0
  93. package/src/components/ButtonGroup/ButtonGroup.tsx +99 -0
  94. package/src/components/ButtonGroup/__snapshots__/ButtonGroup.test.tsx.snap +117 -0
  95. package/src/components/Card/Card.stories.mdx +144 -178
  96. package/src/components/Card/Card.test.tsx +36 -97
  97. package/src/components/Card/Card.tsx +78 -74
  98. package/src/components/Chakra/Box.stories.mdx +3 -7
  99. package/src/components/Chakra/Center.stories.mdx +6 -24
  100. package/src/components/Chakra/Flex.stories.mdx +5 -7
  101. package/src/components/Chakra/Grid.stories.mdx +1 -1
  102. package/src/components/Chakra/Stack.stories.mdx +10 -11
  103. package/src/components/Checkbox/Checkbox.stories.mdx +1 -1
  104. package/src/components/Checkbox/Checkbox.test.tsx +2 -2
  105. package/src/components/Checkbox/Checkbox.tsx +20 -13
  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 +0 -11
  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 +4 -4
  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 +63 -63
  193. package/src/components/StyleGuide/ColorCard.tsx +2 -4
  194. package/src/components/StyleGuide/Colors.stories.mdx +9 -10
  195. package/src/components/StyleGuide/DesignTokens.stories.mdx +5 -7
  196. package/src/components/StyleGuide/Forms.stories.mdx +2 -2
  197. package/src/components/StyleGuide/Iconography.stories.mdx +60 -78
  198. package/src/components/StyleGuide/Spacing.stories.mdx +1 -2
  199. package/src/components/StyleGuide/Typography.stories.mdx +16 -19
  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/foundations/colors.ts +6 -9
  252. package/src/theme/index.ts +4 -0
  253. package/src/theme/provider.tsx +1 -1
  254. package/src/utils/componentCategories.ts +13 -5
  255. package/src/utils/interfaces.ts +5 -0
  256. package/src/utils/utils.ts +2 -32
  257. package/dist/components/Accordion/AccordionTypes.d.ts +0 -5
  258. package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +0 -8
  259. package/dist/components/Button/ButtonTypes.d.ts +0 -8
  260. package/dist/components/DatePicker/DatePickerTypes.d.ts +0 -5
  261. package/dist/components/Form/FormTypes.d.ts +0 -2
  262. package/dist/components/Grid/GridTypes.d.ts +0 -9
  263. package/dist/components/Heading/HeadingTypes.d.ts +0 -14
  264. package/dist/components/Hero/HeroTypes.d.ts +0 -12
  265. package/dist/components/Icons/IconTypes.d.ts +0 -77
  266. package/dist/components/Image/ImageTypes.d.ts +0 -22
  267. package/dist/components/Link/LinkTypes.d.ts +0 -8
  268. package/dist/components/List/ListTypes.d.ts +0 -5
  269. package/dist/components/Logo/LogoTypes.d.ts +0 -54
  270. package/dist/components/Notification/NotificationTypes.d.ts +0 -5
  271. package/dist/components/ProgressIndicator/ProgressIndicatorTypes.d.ts +0 -8
  272. package/dist/components/Select/SelectTypes.d.ts +0 -8
  273. package/dist/components/SkeletonLoader/SkeletonLoaderTypes.d.ts +0 -5
  274. package/dist/components/StatusBadge/StatusBadgeTypes.d.ts +0 -5
  275. package/dist/components/StructuredContent/StructuredContentTypes.d.ts +0 -5
  276. package/dist/components/Text/TextTypes.d.ts +0 -6
  277. package/dist/components/TextInput/TextInputTypes.d.ts +0 -25
  278. package/dist/components/Toggle/ToggleTypes.d.ts +0 -4
  279. package/dist/components/VideoPlayer/VideoPlayerTypes.d.ts +0 -9
  280. package/dist/helpers/enums.d.ts +0 -4
  281. package/dist/utils/siteSections.d.ts +0 -2
  282. package/src/components/Accordion/AccordionTypes.tsx +0 -5
  283. package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +0 -8
  284. package/src/components/Button/ButtonTypes.tsx +0 -8
  285. package/src/components/DatePicker/DatePickerTypes.tsx +0 -5
  286. package/src/components/Form/FormTypes.tsx +0 -3
  287. package/src/components/Grid/GridTypes.tsx +0 -9
  288. package/src/components/Heading/HeadingTypes.tsx +0 -15
  289. package/src/components/Hero/HeroTypes.tsx +0 -20
  290. package/src/components/Icons/IconTypes.tsx +0 -83
  291. package/src/components/Image/ImageTypes.ts +0 -24
  292. package/src/components/Link/LinkTypes.tsx +0 -8
  293. package/src/components/List/ListTypes.tsx +0 -5
  294. package/src/components/Logo/LogoTypes.tsx +0 -56
  295. package/src/components/Modal/_Modal.scss +0 -18
  296. package/src/components/Notification/NotificationTypes.tsx +0 -5
  297. package/src/components/ProgressIndicator/ProgressIndicatorTypes.ts +0 -8
  298. package/src/components/Select/SelectTypes.tsx +0 -10
  299. package/src/components/SkeletonLoader/SkeletonLoaderTypes.tsx +0 -5
  300. package/src/components/StatusBadge/StatusBadgeTypes.tsx +0 -5
  301. package/src/components/StructuredContent/StructuredContentTypes.tsx +0 -5
  302. package/src/components/Text/TextTypes.tsx +0 -6
  303. package/src/components/TextInput/TextInputTypes.tsx +0 -48
  304. package/src/components/Toggle/ToggleTypes.tsx +0 -4
  305. package/src/components/VideoPlayer/VideoPlayerTypes.tsx +0 -10
  306. package/src/helpers/enums.ts +0 -4
  307. package/src/utils/siteSections.ts +0 -10
@@ -11,15 +11,8 @@ import { withDesign } from "storybook-addon-designs";
11
11
  import Heading from "../Heading/Heading";
12
12
  import SimpleGrid from "../Grid/SimpleGrid";
13
13
  import Toggle from "./Toggle";
14
- import { ToggleSizes } from "./ToggleTypes";
15
14
  import { getCategory } from "../../utils/componentCategories";
16
15
  import DSProvider from "../../theme/provider";
17
- import { getStorybookEnumValues } from "../../utils/utils";
18
-
19
- export const sizeEnumValues = getStorybookEnumValues(
20
- ToggleSizes,
21
- "ToggleSizes"
22
- );
23
16
 
24
17
  <Meta
25
18
  title={getCategory("Toggle")}
@@ -33,7 +26,6 @@ export const sizeEnumValues = getStorybookEnumValues(
33
26
  jest: ["Toggle.test.tsx"],
34
27
  }}
35
28
  argTypes={{
36
- additionalStyles: { control: false },
37
29
  defaultChecked: { control: false },
38
30
  id: { control: false },
39
31
  key: { table: { disable: true } },
@@ -42,9 +34,7 @@ export const sizeEnumValues = getStorybookEnumValues(
42
34
  ref: { table: { disable: true } },
43
35
  size: {
44
36
  control: {
45
- type: "select",
46
- table: { defaultValue: { summary: "ToggleSizes.Default" } },
47
- options: sizeEnumValues.options,
37
+ table: { defaultValue: { summary: "default" } },
48
38
  },
49
39
  },
50
40
  }}
@@ -55,7 +45,7 @@ export const sizeEnumValues = getStorybookEnumValues(
55
45
  | Component Version | DS Version |
56
46
  | ----------------- | ---------- |
57
47
  | Added | `0.25.8` |
58
- | Latest | `0.26.0` |
48
+ | Latest | `0.28.0` |
59
49
 
60
50
  ## Table of Contents
61
51
 
@@ -89,7 +79,6 @@ should be short and to the point, often three words or less.
89
79
  <Story
90
80
  name="Toggle"
91
81
  args={{
92
- additionalStyles: undefined,
93
82
  defaultChecked: false,
94
83
  helperText: "This is the helper text!",
95
84
  id: "toggle-1",
@@ -104,7 +93,7 @@ should be short and to the point, often three words or less.
104
93
  size: "ToogleSizes.Large",
105
94
  }}
106
95
  >
107
- {(args) => <Toggle {...args} size={sizeEnumValues.getValue(args.size)} />}
96
+ {(args) => <Toggle {...args} />}
108
97
  </Story>
109
98
  </Canvas>
110
99
 
@@ -143,10 +132,10 @@ Resources:
143
132
  <Toggle
144
133
  defaultChecked={true}
145
134
  id="small-checked"
146
- size={ToggleSizes.Small}
135
+ size="small"
147
136
  labelText="On"
148
137
  />
149
- <Toggle id="default-small" size={ToggleSizes.Small} labelText="Off" />
138
+ <Toggle id="default-small" size="small" labelText="Off" />
150
139
  </VStack>
151
140
  </SimpleGrid>
152
141
  </DSProvider>
@@ -5,7 +5,6 @@ import * as React from "react";
5
5
  import renderer from "react-test-renderer";
6
6
 
7
7
  import Toggle from "./Toggle";
8
- import { ToggleSizes } from "./ToggleTypes";
9
8
 
10
9
  describe("Toggle Accessibility", () => {
11
10
  it("Passes axe accessibility test", async () => {
@@ -17,7 +16,7 @@ describe("Toggle Accessibility", () => {
17
16
  });
18
17
 
19
18
  describe("Toggle", () => {
20
- let changeHandler;
19
+ let changeHandler: jest.MockedFunction<() => void>;
21
20
 
22
21
  beforeEach(() => {
23
22
  changeHandler = jest.fn();
@@ -142,7 +141,7 @@ describe("Toggle", () => {
142
141
  id="Toggle-disabled"
143
142
  labelText="Test Label"
144
143
  isDisabled
145
- size={ToggleSizes.Small}
144
+ size="small"
146
145
  />
147
146
  )
148
147
  .toJSON();
@@ -10,10 +10,10 @@ import * as React from "react";
10
10
  import HelperErrorText, {
11
11
  HelperErrorTextType,
12
12
  } from "../HelperErrorText/HelperErrorText";
13
- import { ToggleSizes } from "./ToggleTypes";
13
+ import { AriaAttributes } from "../../utils/interfaces";
14
+
15
+ export type ToggleSizes = "default" | "small";
14
16
  export interface ToggleProps {
15
- /** Optionally pass in additional Chakra-based styles. */
16
- additionalStyles?: { [key: string]: any };
17
17
  /** Used for uncontrolled scenarios. Sets the state of the Toggle when the page first loads.
18
18
  * If true, the toggle will be initially set to the "on" position. */
19
19
  defaultChecked?: boolean;
@@ -57,7 +57,6 @@ export const onChangeDefault = () => {
57
57
  export const Toggle = chakra(
58
58
  React.forwardRef<HTMLInputElement, ToggleProps>((props, ref?) => {
59
59
  const {
60
- additionalStyles = {},
61
60
  defaultChecked = false,
62
61
  helperText,
63
62
  id,
@@ -69,11 +68,11 @@ export const Toggle = chakra(
69
68
  labelText,
70
69
  name,
71
70
  onChange = onChangeDefault,
72
- size = ToggleSizes.Default,
71
+ size = "default",
73
72
  ...rest
74
73
  } = props;
75
- const footnote: HelperErrorTextType = isInvalid ? invalidText : helperText;
76
- const ariaAttributes = {};
74
+ const footnote = isInvalid ? invalidText : helperText;
75
+ const ariaAttributes: AriaAttributes = {};
77
76
  const styles = useMultiStyleConfig("Toggle", { isDisabled, size });
78
77
  const switchStyles = useStyleConfig("Switch", { size });
79
78
  ariaAttributes["aria-label"] =
@@ -87,7 +86,7 @@ export const Toggle = chakra(
87
86
 
88
87
  return (
89
88
  <>
90
- <Box __css={{ ...styles, ...additionalStyles }} {...rest}>
89
+ <Box __css={styles} {...rest}>
91
90
  <Switch
92
91
  id={id}
93
92
  name={name || "default"}
@@ -95,7 +94,7 @@ export const Toggle = chakra(
95
94
  isInvalid={isInvalid}
96
95
  isRequired={isRequired}
97
96
  ref={ref}
98
- size={size === ToggleSizes.Default ? "lg" : "sm"}
97
+ size={size === "default" ? "lg" : "sm"}
99
98
  lineHeight="1.5"
100
99
  {...(isChecked !== undefined
101
100
  ? {
@@ -113,10 +112,10 @@ export const Toggle = chakra(
113
112
  </Box>
114
113
  {footnote && (
115
114
  <HelperErrorText
116
- additionalStyles={styles.helperErrorText}
117
115
  id={`${id}-helperText`}
118
116
  isInvalid={isInvalid}
119
117
  text={footnote}
118
+ __css={styles.helperErrorText}
120
119
  />
121
120
  )}
122
121
  </>
@@ -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>