@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
@@ -1,4 +1,4 @@
1
- import { ButtonGroup, Flex, Spacer } from "@chakra-ui/react";
1
+ import { Flex, Spacer } from "@chakra-ui/react";
2
2
  import {
3
3
  ArgsTable,
4
4
  Canvas,
@@ -9,16 +9,13 @@ import {
9
9
  import { withDesign } from "storybook-addon-designs";
10
10
 
11
11
  import Button from "../Button/Button";
12
+ import ButtonGroup from "../ButtonGroup/ButtonGroup";
12
13
  import Form from "../Form/Form";
13
14
  import Radio from "../Radio/Radio";
14
15
  import RadioGroup from "./RadioGroup";
15
- import { LayoutTypes } from "../../helpers/enums";
16
16
  import SimpleGrid from "../Grid/SimpleGrid";
17
17
  import { getCategory } from "../../utils/componentCategories";
18
18
  import DSProvider from "../../theme/provider";
19
- import { getStorybookEnumValues } from "../../utils/utils";
20
-
21
- export const enumValues = getStorybookEnumValues(LayoutTypes, "LayoutTypes");
22
19
 
23
20
  <Meta
24
21
  title={getCategory("RadioGroup")}
@@ -48,9 +45,7 @@ export const enumValues = getStorybookEnumValues(LayoutTypes, "LayoutTypes");
48
45
  table: { defaultValue: { summary: false } },
49
46
  },
50
47
  layout: {
51
- control: { type: "select" },
52
- table: { defaultValue: { summary: "LayoutTypes.Column" } },
53
- options: enumValues.options,
48
+ table: { defaultValue: { summary: "column" } },
54
49
  },
55
50
  key: { table: { disable: true } },
56
51
  onChange: { control: false },
@@ -72,7 +67,7 @@ export const enumValues = getStorybookEnumValues(LayoutTypes, "LayoutTypes");
72
67
  | Component Version | DS Version |
73
68
  | ----------------- | ---------- |
74
69
  | Added | `0.25.0` |
75
- | Latest | `0.26.0` |
70
+ | Latest | `0.28.0` |
76
71
 
77
72
  ## Table of Contents
78
73
 
@@ -106,7 +101,7 @@ export const enumValues = getStorybookEnumValues(LayoutTypes, "LayoutTypes");
106
101
  isInvalid: false,
107
102
  isRequired: false,
108
103
  labelText: "Standard Radio Group",
109
- layout: "LayoutTypes.Column",
104
+ layout: "column",
110
105
  name: "radio-story",
111
106
  onChange: undefined,
112
107
  showHelperInvalidText: true,
@@ -115,7 +110,7 @@ export const enumValues = getStorybookEnumValues(LayoutTypes, "LayoutTypes");
115
110
  }}
116
111
  >
117
112
  {(args) => (
118
- <RadioGroup {...args} layout={enumValues.getValue(args.layout)}>
113
+ <RadioGroup {...args}>
119
114
  <Radio id="main-2" labelText="Radio 2" value="2" />
120
115
  <Radio id="main-3" labelText="Radio 3" value="3" />
121
116
  <Radio id="main-4" labelText="Radio 4" value="4" />
@@ -163,7 +158,7 @@ a row.
163
158
  id="row"
164
159
  labelText="Row"
165
160
  name="row-example"
166
- layout={LayoutTypes.Row}
161
+ layout="row"
167
162
  >
168
163
  <Radio id="row-2" labelText="Radio 2" value="2" />
169
164
  <Radio id="row-3" labelText="Radio 3" value="3" />
@@ -420,7 +415,7 @@ export function RadioGroupUncontrolledExample() {
420
415
  console.log(`Uncontrolled example. Selected: ${radioGroupValue}`);
421
416
  };
422
417
  return (
423
- <Form onSubmit={onSubmit}>
418
+ <Form id="form" onSubmit={onSubmit}>
424
419
  <SimpleGrid columns="1">
425
420
  <RadioGroup
426
421
  defaultValue="3"
@@ -434,7 +429,9 @@ export function RadioGroupUncontrolledExample() {
434
429
  <Radio id="4" labelText="Radio 4" value="4" />
435
430
  </RadioGroup>
436
431
  <ButtonGroup>
437
- <Button type="submit">Submit</Button>
432
+ <Button id="submit" type="submit">
433
+ Submit
434
+ </Button>
438
435
  </ButtonGroup>
439
436
  </SimpleGrid>
440
437
  </Form>
@@ -451,7 +448,7 @@ export function RadioGroupUncontrolledExample() {
451
448
  console.log(`Uncontrolled example. Selected: ${radioGroupValue}`);
452
449
  };
453
450
  return (
454
- <Form onSubmit={onSubmit}>
451
+ <Form id="form" onSubmit={onSubmit}>
455
452
  <SimpleGrid columns="1">
456
453
  <RadioGroup
457
454
  defaultValue="3"
@@ -465,7 +462,9 @@ export function RadioGroupUncontrolledExample() {
465
462
  <Radio id="4" labelText="Radio 4" value="4" />
466
463
  </RadioGroup>
467
464
  <ButtonGroup>
468
- <Button type="submit">Submit</Button>
465
+ <Button id="submit" type="submit">
466
+ Submit
467
+ </Button>
469
468
  </ButtonGroup>
470
469
  </SimpleGrid>
471
470
  </Form>
@@ -7,7 +7,6 @@ import renderer from "react-test-renderer";
7
7
 
8
8
  import Radio from "../Radio/Radio";
9
9
  import RadioGroup from "./RadioGroup";
10
- import { LayoutTypes } from "../../helpers/enums";
11
10
 
12
11
  describe("Radio Accessibility", () => {
13
12
  it("passes axe accessibility with string labels", async () => {
@@ -154,7 +153,7 @@ describe("Radio Button", () => {
154
153
 
155
154
  it("sets the next value through the onChange function", () => {
156
155
  let newValue = "";
157
- const onChange = (value) => {
156
+ const onChange = (value: string) => {
158
157
  newValue = value;
159
158
  };
160
159
  render(
@@ -275,12 +274,7 @@ describe("Radio Button", () => {
275
274
  .toJSON();
276
275
  const row = renderer
277
276
  .create(
278
- <RadioGroup
279
- labelText="row"
280
- name="row"
281
- id="row"
282
- layout={LayoutTypes.Row}
283
- >
277
+ <RadioGroup labelText="row" name="row" id="row" layout="row">
284
278
  <Radio value="2" labelText="Radio 2" id="radio-2" />
285
279
  <Radio value="3" labelText="Radio 3" id="radio-3" />
286
280
  </RadioGroup>
@@ -12,7 +12,8 @@ import HelperErrorText, {
12
12
  } from "../HelperErrorText/HelperErrorText";
13
13
  import { spacing } from "../../theme/foundations/spacing";
14
14
  import Radio from "../Radio/Radio";
15
- import { LayoutTypes } from "../../helpers/enums";
15
+ import { LayoutTypes } from "../../helpers/types";
16
+
16
17
  export interface RadioGroupProps {
17
18
  /** Additional class name. */
18
19
  className?: string;
@@ -75,7 +76,7 @@ export const RadioGroup = chakra(
75
76
  isInvalid = false,
76
77
  isRequired = false,
77
78
  labelText,
78
- layout = LayoutTypes.Column,
79
+ layout = "column",
79
80
  name,
80
81
  onChange,
81
82
  showHelperInvalidText = true,
@@ -87,7 +88,7 @@ export const RadioGroup = chakra(
87
88
  const footnote: HelperErrorTextType = isInvalid
88
89
  ? invalidText
89
90
  : helperText;
90
- const spacingProp = layout === LayoutTypes.Column ? spacing.s : spacing.l;
91
+ const spacingProp = layout === "column" ? spacing.s : spacing.l;
91
92
  const newChildren: JSX.Element[] = [];
92
93
  // Get the Chakra-based styles for the custom elements in this component.
93
94
  const styles = useMultiStyleConfig("RadioGroup", { isFullWidth });
@@ -110,29 +111,32 @@ export const RadioGroup = chakra(
110
111
  }
111
112
 
112
113
  // Go through the Radio children and update them as needed.
113
- React.Children.map(children, (child: React.ReactElement, key) => {
114
- if (child?.type !== Radio) {
115
- // Special case for Storybook MDX documentation.
116
- if (child.props?.mdxType && child.props?.mdxType === "Radio") {
117
- noop();
118
- } else {
119
- console.warn(
120
- "NYPL Reservoir RadioGroup: Only `Radio` components are allowed " +
121
- "inside the `RadioGroup` component."
122
- );
114
+ React.Children.map(
115
+ children as JSX.Element,
116
+ (child: React.ReactElement, key) => {
117
+ if (child?.type !== Radio) {
118
+ // Special case for Storybook MDX documentation.
119
+ if (child.props?.mdxType && child.props?.mdxType === "Radio") {
120
+ noop();
121
+ } else {
122
+ console.warn(
123
+ "NYPL Reservoir RadioGroup: Only `Radio` components are allowed " +
124
+ "inside the `RadioGroup` component."
125
+ );
126
+ }
123
127
  }
124
- }
125
128
 
126
- if (child !== undefined && child !== null) {
127
- const newProps = {
128
- key,
129
- isDisabled,
130
- isInvalid,
131
- isRequired,
132
- };
133
- newChildren.push(React.cloneElement(child, newProps));
129
+ if (child !== undefined && child !== null) {
130
+ const newProps = {
131
+ key,
132
+ isDisabled,
133
+ isInvalid,
134
+ isRequired,
135
+ };
136
+ newChildren.push(React.cloneElement(child, newProps));
137
+ }
134
138
  }
135
- });
139
+ );
136
140
 
137
141
  return (
138
142
  <Fieldset
@@ -151,10 +155,10 @@ export const RadioGroup = chakra(
151
155
  </ChakraRadioGroup>
152
156
  {footnote && showHelperInvalidText && (
153
157
  <HelperErrorText
154
- additionalStyles={styles.helperErrorText}
155
158
  id={`${id}-helperErrorText`}
156
159
  isInvalid={isInvalid}
157
160
  text={footnote}
161
+ __css={styles.helperErrorText}
158
162
  />
159
163
  )}
160
164
  </Fieldset>
@@ -60,7 +60,7 @@ import DSProvider from "../../theme/provider";
60
60
  | Component Version | DS Version |
61
61
  | ----------------- | ---------- |
62
62
  | Added | `0.0.4` |
63
- | Latest | `0.26.0` |
63
+ | Latest | `0.28.0` |
64
64
 
65
65
  ## Table of Contents
66
66
 
@@ -164,7 +164,7 @@ describe("SearchBar", () => {
164
164
 
165
165
  it("calls the Select onChange callback function", () => {
166
166
  let selectValue = "Songs";
167
- selectProps.onChange = (e) => (selectValue = e.target.value);
167
+ selectProps.onChange = (e) => (selectValue = (e.target as any).value);
168
168
  selectProps.value = selectValue;
169
169
 
170
170
  render(
@@ -2,15 +2,12 @@ import { Box, chakra, useMultiStyleConfig } from "@chakra-ui/react";
2
2
  import * as React from "react";
3
3
 
4
4
  import Button from "../Button/Button";
5
- import { ButtonTypes } from "../Button/ButtonTypes";
6
5
  import ComponentWrapper from "../ComponentWrapper/ComponentWrapper";
7
6
  import { HelperErrorTextType } from "../HelperErrorText/HelperErrorText";
8
7
  import Icon from "../Icons/Icon";
9
- import { IconAlign, IconNames, IconSizes } from "../Icons/IconTypes";
10
8
  import Select from "../Select/Select";
11
- import { SelectTypes } from "../Select/SelectTypes";
12
9
  import TextInput from "../TextInput/TextInput";
13
- import { TextInputTypes, TextInputVariants } from "../TextInput/TextInputTypes";
10
+
14
11
  interface BaseProps {
15
12
  labelText: string;
16
13
  name: string;
@@ -24,6 +21,7 @@ interface BaseProps {
24
21
  // Internal interfaces that are used only for `SearchBar` props.
25
22
  export interface SelectProps extends BaseProps {
26
23
  optionsData: string[];
24
+ onChange?: (event: React.FormEvent) => void;
27
25
  }
28
26
  export interface TextInputProps extends BaseProps {
29
27
  placeholder?: string;
@@ -57,8 +55,8 @@ export interface SearchBarProps {
57
55
  labelText: string;
58
56
  /** Adds 'method' property to the `form` element. */
59
57
  method?: string;
60
- /** Sets the `Button` variant type to `ButtonTypes.NoBrand` when true;
61
- * false by default which sets the type to `ButtonTypes.Primary`. */
58
+ /** Sets the `Button` variant type to `noBrand` when true;
59
+ * false by default which sets the type to `primary`. */
62
60
  noBrandButtonType?: boolean;
63
61
  /** Handler function when the form is submitted. */
64
62
  onSubmit: (event: React.FormEvent) => void;
@@ -77,7 +75,7 @@ export interface SearchBarProps {
77
75
  export const SearchBar = chakra((props: SearchBarProps) => {
78
76
  const {
79
77
  action,
80
- buttonOnClick = null,
78
+ buttonOnClick,
81
79
  className,
82
80
  descriptionText,
83
81
  headingText,
@@ -111,9 +109,7 @@ export const SearchBar = chakra((props: SearchBarProps) => {
111
109
  const textInputPlaceholder = `${inputPlaceholder} ${
112
110
  isRequired ? "(Required)" : ""
113
111
  }`;
114
- const buttonType = noBrandButtonType
115
- ? ButtonTypes.NoBrand
116
- : ButtonTypes.Primary;
112
+ const buttonType = noBrandButtonType ? "noBrand" : "primary";
117
113
  const searchBarButtonStyles = {
118
114
  borderLeftRadius: "none",
119
115
  borderRightRadius: { base: "none", md: "sm" },
@@ -129,13 +125,13 @@ export const SearchBar = chakra((props: SearchBarProps) => {
129
125
  // Render the `Select` component.
130
126
  const selectElem = selectProps && (
131
127
  <Select
132
- additionalStyles={styles.select}
133
128
  id={`searchbar-select-${id}`}
134
129
  labelText={selectProps?.labelText}
135
130
  name={selectProps?.name}
136
131
  onChange={selectProps?.onChange}
137
- selectType={SelectTypes.SearchBar}
132
+ selectType="searchbar"
138
133
  value={selectProps?.value}
134
+ __css={styles.select}
139
135
  {...stateProps}
140
136
  >
141
137
  {selectProps?.optionsData.map((option) => (
@@ -153,12 +149,8 @@ export const SearchBar = chakra((props: SearchBarProps) => {
153
149
  name={textInputProps?.name}
154
150
  onChange={textInputProps?.onChange}
155
151
  placeholder={textInputPlaceholder}
156
- textInputType={
157
- selectElem
158
- ? TextInputVariants.SearchBarSelect
159
- : TextInputVariants.SearchBar
160
- }
161
- type={TextInputTypes.text}
152
+ textInputType={selectElem ? "searchBarSelect" : "searchBar"}
153
+ type="text"
162
154
  value={textInputProps?.value}
163
155
  {...stateProps}
164
156
  />
@@ -166,18 +158,18 @@ export const SearchBar = chakra((props: SearchBarProps) => {
166
158
  // Render the `Button` component.
167
159
  const buttonElem = (
168
160
  <Button
169
- additionalStyles={searchBarButtonStyles}
170
161
  buttonType={buttonType}
171
162
  id={`searchbar-button-${id}`}
172
163
  isDisabled={isDisabled}
173
164
  onClick={buttonOnClick}
174
165
  type="submit"
166
+ __css={searchBarButtonStyles}
175
167
  >
176
168
  <Icon
177
- align={IconAlign.Left}
169
+ align="left"
178
170
  id={`searchbar-icon-${id}`}
179
- name={IconNames.Search}
180
- size={IconSizes.Small}
171
+ name="search"
172
+ size="small"
181
173
  />
182
174
  Search
183
175
  </Button>
@@ -34,7 +34,6 @@ exports[`SearchBar renders the UI snapshot correctly 1`] = `
34
34
  className="chakra-button css-1me3d5y"
35
35
  data-testid="button"
36
36
  id="searchbar-button-basic"
37
- onClick={null}
38
37
  type="submit"
39
38
  >
40
39
  <svg
@@ -240,7 +239,6 @@ exports[`SearchBar renders the UI snapshot correctly 2`] = `
240
239
  className="chakra-button css-1me3d5y"
241
240
  data-testid="button"
242
241
  id="searchbar-button-withSelect"
243
- onClick={null}
244
242
  type="submit"
245
243
  >
246
244
  <svg
@@ -327,7 +325,6 @@ exports[`SearchBar renders the UI snapshot correctly 3`] = `
327
325
  className="chakra-button css-1me3d5y"
328
326
  data-testid="button"
329
327
  id="searchbar-button-withoutHelperText"
330
- onClick={null}
331
328
  type="submit"
332
329
  >
333
330
  <svg
@@ -402,7 +399,6 @@ exports[`SearchBar renders the UI snapshot correctly 4`] = `
402
399
  className="chakra-button css-1me3d5y"
403
400
  data-testid="button"
404
401
  id="searchbar-button-invalidState"
405
- onClick={null}
406
402
  type="submit"
407
403
  >
408
404
  <svg
@@ -478,7 +474,6 @@ exports[`SearchBar renders the UI snapshot correctly 5`] = `
478
474
  data-testid="button"
479
475
  disabled={true}
480
476
  id="searchbar-button-disabledState"
481
- onClick={null}
482
477
  type="submit"
483
478
  >
484
479
  <svg
@@ -555,7 +550,6 @@ exports[`SearchBar renders the UI snapshot correctly 6`] = `
555
550
  data-testid="button"
556
551
  disabled={true}
557
552
  id="searchbar-button-requiredState"
558
- onClick={null}
559
553
  type="submit"
560
554
  >
561
555
  <svg
@@ -632,7 +626,6 @@ exports[`SearchBar renders the UI snapshot correctly 7`] = `
632
626
  data-testid="button"
633
627
  disabled={true}
634
628
  id="searchbar-button-noBrandButtonType"
635
- onClick={null}
636
629
  type="submit"
637
630
  >
638
631
  <svg
@@ -694,7 +687,6 @@ exports[`SearchBar renders the UI snapshot correctly 8`] = `
694
687
  className="chakra-button css-1me3d5y"
695
688
  data-testid="button"
696
689
  id="searchbar-button-withHeading"
697
- onClick={null}
698
690
  type="submit"
699
691
  >
700
692
  <svg
@@ -755,7 +747,6 @@ exports[`SearchBar renders the UI snapshot correctly 9`] = `
755
747
  className="chakra-button css-1me3d5y"
756
748
  data-testid="button"
757
749
  id="searchbar-button-withDescription"
758
- onClick={null}
759
750
  type="submit"
760
751
  >
761
752
  <svg
@@ -822,7 +813,6 @@ exports[`SearchBar renders the UI snapshot correctly 10`] = `
822
813
  className="chakra-button css-1me3d5y"
823
814
  data-testid="button"
824
815
  id="searchbar-button-withHeadingAndDescription"
825
- onClick={null}
826
816
  type="submit"
827
817
  >
828
818
  <svg
@@ -897,7 +887,6 @@ exports[`SearchBar renders the UI snapshot correctly 11`] = `
897
887
  className="chakra-button css-1me3d5y"
898
888
  data-testid="button"
899
889
  id="searchbar-button-chakra"
900
- onClick={null}
901
890
  type="submit"
902
891
  >
903
892
  <svg
@@ -985,7 +974,6 @@ exports[`SearchBar renders the UI snapshot correctly 12`] = `
985
974
  className="chakra-button css-1me3d5y"
986
975
  data-testid="button"
987
976
  id="searchbar-button-props"
988
- onClick={null}
989
977
  type="submit"
990
978
  >
991
979
  <svg
@@ -11,19 +11,8 @@ import { withDesign } from "storybook-addon-designs";
11
11
  import Button from "../Button/Button";
12
12
  import Form, { FormField } from "../Form/Form";
13
13
  import Select from "./Select";
14
- import { SelectTypes, LabelPositions } from "./SelectTypes";
15
14
  import { getCategory } from "../../utils/componentCategories";
16
15
  import DSProvider from "../../theme/provider";
17
- import { getStorybookEnumValues } from "../../utils/utils";
18
-
19
- export const selectTypesEnumValues = getStorybookEnumValues(
20
- SelectTypes,
21
- "SelectTypes"
22
- );
23
- export const labelPositionsEnumValues = getStorybookEnumValues(
24
- LabelPositions,
25
- "LabelPositions"
26
- );
27
16
 
28
17
  <Meta
29
18
  title={getCategory("Select")}
@@ -49,9 +38,7 @@ export const labelPositionsEnumValues = getStorybookEnumValues(
49
38
  table: { defaultValue: { summary: false } },
50
39
  },
51
40
  labelPosition: {
52
- control: { type: "select" },
53
- table: { defaultValue: { summary: "LabelPositions.Default" } },
54
- options: labelPositionsEnumValues.options,
41
+ table: { defaultValue: { summary: "default" } },
55
42
  },
56
43
  name: { control: false },
57
44
  key: { table: { disable: true } },
@@ -68,7 +55,7 @@ export const labelPositionsEnumValues = getStorybookEnumValues(
68
55
  },
69
56
  selectType: {
70
57
  control: false,
71
- table: { defaultValue: { summary: "SelectTypes.Default" } },
58
+ table: { defaultValue: { summary: "default" } },
72
59
  },
73
60
  value: { control: false },
74
61
  }}
@@ -79,7 +66,7 @@ export const labelPositionsEnumValues = getStorybookEnumValues(
79
66
  | Component Version | DS Version |
80
67
  | ----------------- | ---------- |
81
68
  | Added | `0.7.0` |
82
- | Latest | `0.27.0` |
69
+ | Latest | `0.28.0` |
83
70
 
84
71
  ## Table of Contents
85
72
 
@@ -115,22 +102,19 @@ is left blank, a value will be generated for you.
115
102
  isDisabled: false,
116
103
  isInvalid: false,
117
104
  isRequired: false,
118
- labelPosition: "LabelPositions.Default",
105
+ labelPosition: "default",
119
106
  labelText: "What is your favorite color?",
120
107
  name: "color",
121
108
  onChange: undefined,
122
109
  showHelperInvalidText: undefined,
123
110
  showLabel: true,
124
111
  showRequiredLabel: true,
125
- selectType: SelectTypes.Default,
112
+ selectType: "default",
126
113
  value: undefined,
127
114
  }}
128
115
  >
129
116
  {(args) => (
130
- <Select
131
- {...args}
132
- labelPosition={labelPositionsEnumValues.getValue(args.labelPosition)}
133
- >
117
+ <Select {...args}>
134
118
  <option value="red">Red</option>
135
119
  <option value="green">Green</option>
136
120
  <option value="blue">Blue</option>
@@ -248,10 +232,11 @@ can be used to show or hide the "Required" text within the `label` element.
248
232
  </Select>
249
233
  <Select
250
234
  helperText="Display the label inline"
235
+ id="label-example5"
251
236
  isRequired
252
237
  labelText="What is your favorite color?"
253
238
  name="color"
254
- labelPosition={LabelPositions.Inline}
239
+ labelPosition="inline"
255
240
  >
256
241
  <option value="red">Red</option>
257
242
  <option value="green">Green</option>
@@ -4,7 +4,6 @@ import { axe } from "jest-axe";
4
4
  import renderer from "react-test-renderer";
5
5
 
6
6
  import Select from "./Select";
7
- import { LabelPositions } from "./SelectTypes";
8
7
 
9
8
  const baseProps = {
10
9
  helperText: "This is the helper text.",
@@ -178,23 +177,23 @@ describe("Select", () => {
178
177
  </Select>
179
178
  );
180
179
 
181
- expect(selectRef.current.value).toEqual("red");
180
+ expect(selectRef.current?.value).toEqual("red");
182
181
 
183
182
  fireEvent.change(screen.getByRole("combobox"), {
184
183
  target: { value: "blue" },
185
184
  });
186
- expect(selectRef.current.value).toEqual("blue");
185
+ expect(selectRef.current?.value).toEqual("blue");
187
186
 
188
187
  fireEvent.change(screen.getByRole("combobox"), {
189
188
  target: { value: "white" },
190
189
  });
191
- expect(selectRef.current.value).toEqual("white");
190
+ expect(selectRef.current?.value).toEqual("white");
192
191
  });
193
192
 
194
193
  it("calls the onChange callback function", () => {
195
194
  let value = "";
196
- const changeCallback = (e) => {
197
- value = e.target.value;
195
+ const changeCallback = (e: React.FormEvent) => {
196
+ value = (e.target as HTMLInputElement).value;
198
197
  };
199
198
  render(
200
199
  <Select {...baseProps} onChange={changeCallback} value={value}>
@@ -300,7 +299,7 @@ describe("Select", () => {
300
299
  <Select
301
300
  id="select"
302
301
  isRequired
303
- labelPosition={LabelPositions.Inline}
302
+ labelPosition="inline"
304
303
  labelText="Which Succession sibling are you?"
305
304
  name="succession-sibling"
306
305
  >