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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (298) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/components/Accordion/Accordion.d.ts +1 -1
  3. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +1 -5
  4. package/dist/components/Button/Button.d.ts +2 -10
  5. package/dist/components/ButtonGroup/ButtonGroup.d.ts +22 -0
  6. package/dist/components/Card/Card.d.ts +2 -2
  7. package/dist/components/Checkbox/Checkbox.d.ts +10 -8
  8. package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +1 -1
  9. package/dist/components/DatePicker/DatePicker.d.ts +1 -1
  10. package/dist/components/Form/Form.d.ts +2 -2
  11. package/dist/components/Grid/SimpleGrid.d.ts +6 -3
  12. package/dist/components/Heading/Heading.d.ts +2 -5
  13. package/dist/components/HelperErrorText/HelperErrorText.d.ts +1 -5
  14. package/dist/components/Hero/Hero.d.ts +13 -9
  15. package/dist/components/Icons/Icon.d.ts +6 -5
  16. package/dist/components/Icons/IconSvgs.d.ts +21 -21
  17. package/dist/components/Image/Image.d.ts +8 -5
  18. package/dist/components/Link/Link.d.ts +1 -9
  19. package/dist/components/List/List.d.ts +7 -11
  20. package/dist/components/Logo/Logo.d.ts +2 -5
  21. package/dist/components/Logo/LogoSvgs.d.ts +39 -39
  22. package/dist/components/Notification/Notification.d.ts +1 -1
  23. package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +2 -1
  24. package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
  25. package/dist/components/SearchBar/SearchBar.d.ts +3 -2
  26. package/dist/components/Select/Select.d.ts +2 -5
  27. package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +4 -4
  28. package/dist/components/SkipNavigation/SkipNavigation.d.ts +17 -0
  29. package/dist/components/StatusBadge/StatusBadge.d.ts +2 -3
  30. package/dist/components/StructuredContent/StructuredContent.d.ts +2 -2
  31. package/dist/components/Table/Table.d.ts +1 -1
  32. package/dist/components/Template/Template.d.ts +2 -0
  33. package/dist/components/Text/Text.d.ts +1 -1
  34. package/dist/components/TextInput/TextInput.d.ts +21 -9
  35. package/dist/components/Toggle/Toggle.d.ts +1 -5
  36. package/dist/components/VideoPlayer/VideoPlayer.d.ts +2 -1
  37. package/dist/design-system-react-components.cjs.development.js +856 -1155
  38. package/dist/design-system-react-components.cjs.development.js.map +1 -1
  39. package/dist/design-system-react-components.cjs.production.min.js +1 -1
  40. package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
  41. package/dist/design-system-react-components.esm.js +858 -1220
  42. package/dist/design-system-react-components.esm.js.map +1 -1
  43. package/dist/helpers/types.d.ts +1 -0
  44. package/dist/index.d.ts +26 -47
  45. package/dist/theme/components/buttonGroup.d.ts +11 -0
  46. package/dist/theme/components/card.d.ts +104 -8
  47. package/dist/theme/components/componentWrapper.d.ts +4 -3
  48. package/dist/theme/components/customTable.d.ts +11 -14
  49. package/dist/theme/components/fieldset.d.ts +4 -3
  50. package/dist/theme/components/helperErrorText.d.ts +4 -3
  51. package/dist/theme/components/hero.d.ts +1 -1
  52. package/dist/theme/components/horizontalRule.d.ts +4 -3
  53. package/dist/theme/components/icon.d.ts +47743 -1
  54. package/dist/theme/components/image.d.ts +563 -10
  55. package/dist/theme/components/label.d.ts +4 -3
  56. package/dist/theme/components/list.d.ts +6 -7
  57. package/dist/theme/components/logo.d.ts +474 -1
  58. package/dist/theme/components/notification.d.ts +20 -16
  59. package/dist/theme/components/progressIndicator.d.ts +6 -4
  60. package/dist/theme/components/select.d.ts +4 -4
  61. package/dist/theme/components/skeletonLoader.d.ts +14 -10
  62. package/dist/theme/components/skipNavigation.d.ts +22 -0
  63. package/dist/theme/components/slider.d.ts +7 -6
  64. package/dist/theme/components/structuredContent.d.ts +10 -9
  65. package/dist/theme/components/text.d.ts +7 -1
  66. package/dist/theme/components/toggle.d.ts +6 -4
  67. package/dist/theme/provider.d.ts +2 -4
  68. package/dist/utils/componentCategories.d.ts +1 -1
  69. package/dist/utils/interfaces.d.ts +5 -0
  70. package/dist/utils/utils.d.ts +2 -18
  71. package/package.json +2 -2
  72. package/src/__tests__/setup.ts +3 -3
  73. package/src/__tests__/utils/utils.test.ts +1 -23
  74. package/src/components/AccessibilityGuide/SkipNavigation.stories.mdx +22 -14
  75. package/src/components/Accordion/Accordion.stories.mdx +43 -44
  76. package/src/components/Accordion/Accordion.test.tsx +5 -13
  77. package/src/components/Accordion/Accordion.tsx +14 -18
  78. package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +6 -6
  79. package/src/components/Autosuggest/Autosuggest.stories.mdx +1 -1
  80. package/src/components/Autosuggest/Autosuggest.stories.tsx +23 -25
  81. package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +21 -37
  82. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +4 -17
  83. package/src/components/Breadcrumbs/Breadcrumbs.tsx +18 -21
  84. package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +1 -100
  85. package/src/components/Button/Button.stories.mdx +89 -126
  86. package/src/components/Button/Button.test.tsx +16 -30
  87. package/src/components/Button/Button.tsx +14 -20
  88. package/src/components/ButtonGroup/ButtonGroup.stories.mdx +147 -0
  89. package/src/components/ButtonGroup/ButtonGroup.test.tsx +141 -0
  90. package/src/components/ButtonGroup/ButtonGroup.tsx +99 -0
  91. package/src/components/ButtonGroup/__snapshots__/ButtonGroup.test.tsx.snap +117 -0
  92. package/src/components/Card/Card.stories.mdx +143 -177
  93. package/src/components/Card/Card.test.tsx +36 -97
  94. package/src/components/Card/Card.tsx +78 -74
  95. package/src/components/Chakra/Box.stories.mdx +2 -6
  96. package/src/components/Chakra/Center.stories.mdx +5 -23
  97. package/src/components/Chakra/Flex.stories.mdx +4 -6
  98. package/src/components/Chakra/Stack.stories.mdx +9 -10
  99. package/src/components/Checkbox/Checkbox.stories.mdx +1 -1
  100. package/src/components/Checkbox/Checkbox.test.tsx +2 -2
  101. package/src/components/Checkbox/Checkbox.tsx +20 -13
  102. package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +6 -17
  103. package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +1 -7
  104. package/src/components/CheckboxGroup/CheckboxGroup.tsx +33 -29
  105. package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +0 -11
  106. package/src/components/ComponentWrapper/ComponentWrapper.tsx +3 -10
  107. package/src/components/DatePicker/DatePicker.stories.mdx +23 -37
  108. package/src/components/DatePicker/DatePicker.test.tsx +21 -19
  109. package/src/components/DatePicker/DatePicker.tsx +57 -49
  110. package/src/components/Form/Form.stories.mdx +46 -31
  111. package/src/components/Form/Form.test.tsx +1 -18
  112. package/src/components/Form/Form.tsx +7 -7
  113. package/src/components/Grid/SimpleGrid.stories.mdx +73 -49
  114. package/src/components/Grid/SimpleGrid.test.tsx +7 -9
  115. package/src/components/Grid/SimpleGrid.tsx +14 -11
  116. package/src/components/Heading/Heading.stories.mdx +27 -72
  117. package/src/components/Heading/Heading.test.tsx +18 -44
  118. package/src/components/Heading/Heading.tsx +7 -10
  119. package/src/components/HelperErrorText/HelperErrorText.stories.mdx +1 -3
  120. package/src/components/HelperErrorText/HelperErrorText.tsx +1 -5
  121. package/src/components/Hero/Hero.stories.mdx +219 -216
  122. package/src/components/Hero/Hero.test.tsx +107 -223
  123. package/src/components/Hero/Hero.tsx +63 -61
  124. package/src/components/Icons/Icon.stories.mdx +172 -118
  125. package/src/components/Icons/Icon.test.tsx +8 -16
  126. package/src/components/Icons/Icon.tsx +75 -29
  127. package/src/components/Icons/IconSvgs.tsx +42 -42
  128. package/src/components/Image/Image.stories.mdx +45 -132
  129. package/src/components/Image/Image.test.tsx +16 -31
  130. package/src/components/Image/Image.tsx +28 -12
  131. package/src/components/Link/Link.stories.mdx +30 -80
  132. package/src/components/Link/Link.test.tsx +25 -53
  133. package/src/components/Link/Link.tsx +43 -56
  134. package/src/components/Link/__snapshots__/Link.test.tsx.snap +1 -2
  135. package/src/components/List/List.stories.mdx +20 -31
  136. package/src/components/List/List.test.tsx +24 -43
  137. package/src/components/List/List.tsx +25 -36
  138. package/src/components/Logo/Logo.stories.mdx +94 -50
  139. package/src/components/Logo/Logo.test.tsx +10 -19
  140. package/src/components/Logo/Logo.tsx +50 -17
  141. package/src/components/Logo/LogoSvgs.tsx +78 -78
  142. package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +4 -4
  143. package/src/components/Modal/Modal.stories.mdx +8 -9
  144. package/src/components/Modal/Modal.test.tsx +5 -10
  145. package/src/components/Modal/Modal.tsx +1 -1
  146. package/src/components/Notification/Notification.stories.mdx +10 -28
  147. package/src/components/Notification/Notification.test.tsx +9 -12
  148. package/src/components/Notification/Notification.tsx +34 -37
  149. package/src/components/Pagination/Pagination.stories.mdx +2 -2
  150. package/src/components/Pagination/Pagination.tsx +15 -10
  151. package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +27 -53
  152. package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +9 -10
  153. package/src/components/ProgressIndicator/ProgressIndicator.tsx +17 -21
  154. package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +0 -10
  155. package/src/components/Radio/Radio.stories.mdx +1 -1
  156. package/src/components/Radio/Radio.tsx +9 -6
  157. package/src/components/RadioGroup/RadioGroup.stories.mdx +15 -16
  158. package/src/components/RadioGroup/RadioGroup.test.tsx +2 -8
  159. package/src/components/RadioGroup/RadioGroup.tsx +28 -24
  160. package/src/components/SearchBar/SearchBar.stories.mdx +1 -1
  161. package/src/components/SearchBar/SearchBar.test.tsx +1 -1
  162. package/src/components/SearchBar/SearchBar.tsx +14 -22
  163. package/src/components/SearchBar/__snapshots__/SearchBar.test.tsx.snap +0 -12
  164. package/src/components/Select/Select.stories.mdx +8 -23
  165. package/src/components/Select/Select.test.tsx +6 -7
  166. package/src/components/Select/Select.tsx +13 -26
  167. package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +17 -56
  168. package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +7 -21
  169. package/src/components/SkeletonLoader/SkeletonLoader.tsx +9 -8
  170. package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +33 -33
  171. package/src/components/SkipNavigation/SkipNavigation.stories.mdx +90 -0
  172. package/src/components/SkipNavigation/SkipNavigation.test.tsx +63 -0
  173. package/src/components/SkipNavigation/SkipNavigation.tsx +51 -0
  174. package/src/components/SkipNavigation/__snapshots__/SkipNavigation.test.tsx.snap +130 -0
  175. package/src/components/Slider/Slider.stories.mdx +19 -53
  176. package/src/components/Slider/Slider.test.tsx +2 -2
  177. package/src/components/Slider/Slider.tsx +10 -12
  178. package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +2 -9
  179. package/src/components/StatusBadge/StatusBadge.stories.mdx +6 -21
  180. package/src/components/StatusBadge/StatusBadge.test.tsx +2 -3
  181. package/src/components/StatusBadge/StatusBadge.tsx +3 -10
  182. package/src/components/StructuredContent/StructuredContent.stories.mdx +30 -58
  183. package/src/components/StructuredContent/StructuredContent.test.tsx +42 -44
  184. package/src/components/StructuredContent/StructuredContent.tsx +9 -18
  185. package/src/components/StyleGuide/Bidirectionality.stories.mdx +9 -23
  186. package/src/components/StyleGuide/Buttons.stories.mdx +62 -62
  187. package/src/components/StyleGuide/ColorCard.tsx +2 -4
  188. package/src/components/StyleGuide/Colors.stories.mdx +7 -8
  189. package/src/components/StyleGuide/DesignTokens.stories.mdx +5 -7
  190. package/src/components/StyleGuide/Forms.stories.mdx +0 -1
  191. package/src/components/StyleGuide/Iconography.stories.mdx +59 -77
  192. package/src/components/StyleGuide/Spacing.stories.mdx +0 -1
  193. package/src/components/StyleGuide/Typography.stories.mdx +15 -18
  194. package/src/components/Table/Table.stories.mdx +85 -1
  195. package/src/components/Table/Table.test.tsx +57 -1
  196. package/src/components/Table/Table.tsx +7 -4
  197. package/src/components/Table/__snapshots__/Table.test.tsx.snap +121 -0
  198. package/src/components/Tabs/Tabs.stories.mdx +1 -1
  199. package/src/components/Tabs/Tabs.test.tsx +2 -2
  200. package/src/components/Tabs/Tabs.tsx +26 -27
  201. package/src/components/Template/Template.stories.mdx +49 -54
  202. package/src/components/Template/Template.tsx +9 -3
  203. package/src/components/Text/Text.stories.mdx +5 -11
  204. package/src/components/Text/Text.test.tsx +3 -6
  205. package/src/components/Text/Text.tsx +3 -5
  206. package/src/components/TextInput/TextInput.stories.mdx +10 -22
  207. package/src/components/TextInput/TextInput.test.tsx +32 -62
  208. package/src/components/TextInput/TextInput.tsx +61 -30
  209. package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +1 -0
  210. package/src/components/Toggle/Toggle.stories.mdx +5 -16
  211. package/src/components/Toggle/Toggle.test.tsx +2 -3
  212. package/src/components/Toggle/Toggle.tsx +9 -10
  213. package/src/components/VideoPlayer/VideoPlayer.stories.mdx +13 -29
  214. package/src/components/VideoPlayer/VideoPlayer.test.tsx +18 -23
  215. package/src/components/VideoPlayer/VideoPlayer.tsx +13 -10
  216. package/src/docs/Chakra.stories.mdx +14 -11
  217. package/src/docs/Welcome.stories.mdx +23 -43
  218. package/src/helpers/types.ts +1 -0
  219. package/src/hooks/tests/useNYPLTheme.test.tsx +1 -1
  220. package/src/hooks/useNYPLTheme.stories.mdx +3 -6
  221. package/src/index.ts +51 -45
  222. package/src/theme/components/buttonGroup.ts +10 -0
  223. package/src/theme/components/card.ts +50 -15
  224. package/src/theme/components/componentWrapper.ts +5 -1
  225. package/src/theme/components/customTable.ts +8 -2
  226. package/src/theme/components/fieldset.ts +5 -1
  227. package/src/theme/components/helperErrorText.ts +5 -1
  228. package/src/theme/components/hero.ts +2 -2
  229. package/src/theme/components/horizontalRule.ts +5 -1
  230. package/src/theme/components/icon.ts +7 -1
  231. package/src/theme/components/image.ts +14 -3
  232. package/src/theme/components/label.ts +5 -1
  233. package/src/theme/components/list.ts +8 -2
  234. package/src/theme/components/logo.ts +5 -1
  235. package/src/theme/components/notification.ts +38 -14
  236. package/src/theme/components/progressIndicator.ts +10 -5
  237. package/src/theme/components/select.ts +5 -2
  238. package/src/theme/components/skeletonLoader.ts +8 -2
  239. package/src/theme/components/skipNavigation.ts +26 -0
  240. package/src/theme/components/slider.ts +13 -1
  241. package/src/theme/components/structuredContent.ts +11 -1
  242. package/src/theme/components/text.ts +12 -5
  243. package/src/theme/components/toggle.ts +9 -3
  244. package/src/theme/index.ts +4 -0
  245. package/src/theme/provider.tsx +1 -1
  246. package/src/utils/componentCategories.ts +13 -5
  247. package/src/utils/interfaces.ts +5 -0
  248. package/src/utils/utils.ts +2 -32
  249. package/dist/components/Accordion/AccordionTypes.d.ts +0 -5
  250. package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +0 -8
  251. package/dist/components/Button/ButtonTypes.d.ts +0 -8
  252. package/dist/components/DatePicker/DatePickerTypes.d.ts +0 -5
  253. package/dist/components/Form/FormTypes.d.ts +0 -2
  254. package/dist/components/Grid/GridTypes.d.ts +0 -9
  255. package/dist/components/Heading/HeadingTypes.d.ts +0 -14
  256. package/dist/components/Hero/HeroTypes.d.ts +0 -12
  257. package/dist/components/Icons/IconTypes.d.ts +0 -77
  258. package/dist/components/Image/ImageTypes.d.ts +0 -22
  259. package/dist/components/Link/LinkTypes.d.ts +0 -8
  260. package/dist/components/List/ListTypes.d.ts +0 -5
  261. package/dist/components/Logo/LogoTypes.d.ts +0 -54
  262. package/dist/components/Notification/NotificationTypes.d.ts +0 -5
  263. package/dist/components/ProgressIndicator/ProgressIndicatorTypes.d.ts +0 -8
  264. package/dist/components/Select/SelectTypes.d.ts +0 -8
  265. package/dist/components/SkeletonLoader/SkeletonLoaderTypes.d.ts +0 -5
  266. package/dist/components/StatusBadge/StatusBadgeTypes.d.ts +0 -5
  267. package/dist/components/StructuredContent/StructuredContentTypes.d.ts +0 -5
  268. package/dist/components/Text/TextTypes.d.ts +0 -6
  269. package/dist/components/TextInput/TextInputTypes.d.ts +0 -25
  270. package/dist/components/Toggle/ToggleTypes.d.ts +0 -4
  271. package/dist/components/VideoPlayer/VideoPlayerTypes.d.ts +0 -9
  272. package/dist/helpers/enums.d.ts +0 -4
  273. package/dist/utils/siteSections.d.ts +0 -2
  274. package/src/components/Accordion/AccordionTypes.tsx +0 -5
  275. package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +0 -8
  276. package/src/components/Button/ButtonTypes.tsx +0 -8
  277. package/src/components/DatePicker/DatePickerTypes.tsx +0 -5
  278. package/src/components/Form/FormTypes.tsx +0 -3
  279. package/src/components/Grid/GridTypes.tsx +0 -9
  280. package/src/components/Heading/HeadingTypes.tsx +0 -15
  281. package/src/components/Hero/HeroTypes.tsx +0 -20
  282. package/src/components/Icons/IconTypes.tsx +0 -83
  283. package/src/components/Image/ImageTypes.ts +0 -24
  284. package/src/components/Link/LinkTypes.tsx +0 -8
  285. package/src/components/List/ListTypes.tsx +0 -5
  286. package/src/components/Logo/LogoTypes.tsx +0 -56
  287. package/src/components/Notification/NotificationTypes.tsx +0 -5
  288. package/src/components/ProgressIndicator/ProgressIndicatorTypes.ts +0 -8
  289. package/src/components/Select/SelectTypes.tsx +0 -10
  290. package/src/components/SkeletonLoader/SkeletonLoaderTypes.tsx +0 -5
  291. package/src/components/StatusBadge/StatusBadgeTypes.tsx +0 -5
  292. package/src/components/StructuredContent/StructuredContentTypes.tsx +0 -5
  293. package/src/components/Text/TextTypes.tsx +0 -6
  294. package/src/components/TextInput/TextInputTypes.tsx +0 -48
  295. package/src/components/Toggle/ToggleTypes.tsx +0 -4
  296. package/src/components/VideoPlayer/VideoPlayerTypes.tsx +0 -10
  297. package/src/helpers/enums.ts +0 -4
  298. package/src/utils/siteSections.ts +0 -10
@@ -9,15 +9,8 @@ import {
9
9
  import { withDesign } from "storybook-addon-designs";
10
10
 
11
11
  import StatusBadge from "./StatusBadge";
12
- import { StatusBadgeTypes } from "./StatusBadgeTypes";
13
12
  import { getCategory } from "../../utils/componentCategories";
14
13
  import DSProvider from "../../theme/provider";
15
- import { getStorybookEnumValues } from "../../utils/utils";
16
-
17
- export const enumValues = getStorybookEnumValues(
18
- StatusBadgeTypes,
19
- "StatusBadgeTypes"
20
- );
21
14
 
22
15
  <Meta
23
16
  title={getCategory("StatusBadge")}
@@ -34,9 +27,7 @@ export const enumValues = getStorybookEnumValues(
34
27
  className: { control: false },
35
28
  id: { control: false },
36
29
  level: {
37
- control: { type: "select" },
38
- table: { defaultValue: { summary: "StatusBadgeTypes.Low" } },
39
- options: enumValues.options,
30
+ table: { defaultValue: { summary: "low" } },
40
31
  },
41
32
  text: {
42
33
  description: "Only used for Storybook",
@@ -49,7 +40,7 @@ export const enumValues = getStorybookEnumValues(
49
40
  | Component Version | DS Version |
50
41
  | ----------------- | ---------- |
51
42
  | Added | `0.18.7` |
52
- | Latest | `0.26.0` |
43
+ | Latest | `0.28.0` |
53
44
 
54
45
  ## Table of Contents
55
46
 
@@ -70,15 +61,11 @@ export const enumValues = getStorybookEnumValues(
70
61
  args={{
71
62
  className: undefined,
72
63
  id: "statusBadge-id",
73
- level: "StatusBadgeTypes.Low",
64
+ level: "low",
74
65
  text: "Registration Required",
75
66
  }}
76
67
  >
77
- {(args) => (
78
- <StatusBadge level={enumValues.getValue(args.level)}>
79
- {args.text}
80
- </StatusBadge>
81
- )}
68
+ {(args) => <StatusBadge level={args.level}>{args.text}</StatusBadge>}
82
69
  </Story>
83
70
  </Canvas>
84
71
 
@@ -101,10 +88,8 @@ Used in instances where the associated message is the highest barrier. Use
101
88
  <Canvas>
102
89
  <DSProvider>
103
90
  <VStack spacing="s" align="stretch">
104
- <StatusBadge level={StatusBadgeTypes.High}>
105
- On-Site Access Only
106
- </StatusBadge>
107
- <StatusBadge level={StatusBadgeTypes.Medium}>Cancelled</StatusBadge>
91
+ <StatusBadge level="high">On-Site Access Only</StatusBadge>
92
+ <StatusBadge level="medium">Cancelled</StatusBadge>
108
93
  </VStack>
109
94
  </DSProvider>
110
95
  </Canvas>
@@ -4,7 +4,6 @@ import { axe } from "jest-axe";
4
4
  import renderer from "react-test-renderer";
5
5
 
6
6
  import StatusBadge from "./StatusBadge";
7
- import { StatusBadgeTypes } from "./StatusBadgeTypes";
8
7
 
9
8
  describe("StatusBadge Accessibility", () => {
10
9
  it("passes axe accessibility test", async () => {
@@ -35,14 +34,14 @@ describe("StatusBadge", () => {
35
34
  .toJSON();
36
35
  const medium = renderer
37
36
  .create(
38
- <StatusBadge id="medium" level={StatusBadgeTypes.Medium}>
37
+ <StatusBadge id="medium" level="medium">
39
38
  Registration Required
40
39
  </StatusBadge>
41
40
  )
42
41
  .toJSON();
43
42
  const high = renderer
44
43
  .create(
45
- <StatusBadge id="high" level={StatusBadgeTypes.High}>
44
+ <StatusBadge id="high" level="high">
46
45
  Registration Required
47
46
  </StatusBadge>
48
47
  )
@@ -1,14 +1,13 @@
1
1
  import { Box, chakra, useStyleConfig } from "@chakra-ui/react";
2
2
  import * as React from "react";
3
3
 
4
- import { StatusBadgeTypes } from "./StatusBadgeTypes";
4
+ export type StatusBadgeTypes = "low" | "medium" | "high";
5
5
  export interface StatusBadgeProps {
6
6
  /** Additional class for the component */
7
7
  className?: string;
8
8
  /** ID that other components can cross reference for accessibility purposes */
9
9
  id?: string;
10
- /** Level of the status badge through StatusBadgeTypes. Defaults to
11
- * `StatusBadgeTypes.Low`. */
10
+ /** Level of the status badge. Defaults to `"low"`. */
12
11
  level?: StatusBadgeTypes;
13
12
  }
14
13
 
@@ -18,13 +17,7 @@ export interface StatusBadgeProps {
18
17
  */
19
18
  export const StatusBadge = chakra(
20
19
  (props: React.PropsWithChildren<StatusBadgeProps>) => {
21
- const {
22
- children,
23
- className,
24
- id,
25
- level = StatusBadgeTypes.Low,
26
- ...rest
27
- } = props;
20
+ const { children, className, id, level = "low", ...rest } = props;
28
21
  const styles = useStyleConfig("StatusBadge", { variant: level });
29
22
 
30
23
  if (!children) {
@@ -7,25 +7,9 @@ import {
7
7
  } from "@storybook/addon-docs";
8
8
  import { withDesign } from "storybook-addon-designs";
9
9
 
10
- import { ImageRatios, ImageSizes, ImageTypes } from "../Image/ImageTypes";
11
10
  import StructuredContent from "./StructuredContent";
12
- import { StructuredContentImagePosition } from "./StructuredContentTypes";
13
11
  import DSProvider from "../../theme/provider";
14
12
  import { getCategory } from "../../utils/componentCategories";
15
- import { getStorybookEnumValues } from "../../utils/utils";
16
-
17
- export const imageAspectRatioEnumValues = getStorybookEnumValues(
18
- ImageRatios,
19
- "ImageRatios"
20
- );
21
- export const imagePositionEnumValues = getStorybookEnumValues(
22
- StructuredContentImagePosition,
23
- "StructuredContentImagePosition"
24
- );
25
- export const imageSizeEnumValues = getStorybookEnumValues(
26
- ImageSizes,
27
- "ImageSizes"
28
- );
29
13
 
30
14
  <Meta
31
15
  title={getCategory("StructuredContent")}
@@ -42,32 +26,20 @@ export const imageSizeEnumValues = getStorybookEnumValues(
42
26
  className: { control: false },
43
27
  id: { control: false },
44
28
  "imageProps.aspectRatio": {
45
- control: {
46
- type: "select",
47
- },
48
29
  table: {
49
- defaultValue: { summary: "ImageRatios.Square" },
30
+ defaultValue: { summary: "square" },
50
31
  },
51
- options: imageAspectRatioEnumValues.options,
52
32
  },
53
33
  "imageProps.component": { control: false },
54
34
  "imageProps.position": {
55
- control: {
56
- type: "select",
57
- },
58
35
  table: {
59
- defaultValue: { summary: "StructuredContentImagePosition.Left" },
36
+ defaultValue: { summary: "left" },
60
37
  },
61
- options: imagePositionEnumValues.options,
62
38
  },
63
39
  "imageProps.size": {
64
- control: {
65
- type: "select",
66
- },
67
40
  table: {
68
- defaultValue: { summary: "ImageSizes.Medium" },
41
+ defaultValue: { summary: "medium" },
69
42
  },
70
- options: imageSizeEnumValues.options,
71
43
  },
72
44
  }}
73
45
  />
@@ -77,7 +49,7 @@ export const imageSizeEnumValues = getStorybookEnumValues(
77
49
  | Component Version | DS Version |
78
50
  | ----------------- | ---------- |
79
51
  | Added | `0.25.9` |
80
- | Latest | `0.26.0` |
52
+ | Latest | `0.28.0` |
81
53
 
82
54
  ## Table of Contents
83
55
 
@@ -127,29 +99,29 @@ export const imageSizeEnumValues = getStorybookEnumValues(
127
99
  headingText: "Heading text",
128
100
  id: "structured-content",
129
101
  "imageProps.alt": "Image alt text",
130
- "imageProps.aspectRatio": "ImageRatios.Square",
102
+ "imageProps.aspectRatio": "square",
131
103
  "imageProps.caption": "Image caption",
132
104
  "imageProps.component": undefined,
133
105
  "imageProps.credit": "Image credit",
134
- "imageProps.position": "StructuredContentImagePosition.Left",
135
- "imageProps.size": "ImageSizes.Medium",
106
+ "imageProps.position": "left",
107
+ "imageProps.size": "medium",
136
108
  "imageProps.src": "https://placeimg.com/400/300/animals",
137
109
  }}
138
110
  >
139
111
  {(args) => (
140
112
  <StructuredContent
141
- {...args}
113
+ bodyContent={args.bodyContent}
114
+ calloutText={args.calloutText}
115
+ className={args.className}
116
+ headingText={args.headingText}
117
+ id={args.id}
142
118
  imageProps={{
143
119
  alt: args["imageProps.alt"],
144
- aspectRatio: imageAspectRatioEnumValues.getValue(
145
- args["imageProps.aspectRatio"]
146
- ),
120
+ aspectRatio: args["imageProps.aspectRatio"],
147
121
  caption: args["imageProps.caption"],
148
122
  credit: args["imageProps.credit"],
149
- position: imagePositionEnumValues.getValue(
150
- args["imageProps.position"]
151
- ),
152
- size: imageSizeEnumValues.getValue(args["imageProps.size"]),
123
+ position: args["imageProps.position"],
124
+ size: args["imageProps.size"],
153
125
  src: args["imageProps.src"],
154
126
  }}
155
127
  />
@@ -187,11 +159,11 @@ includes HTML tags in the string.
187
159
  headingText="Heading text"
188
160
  imageProps={{
189
161
  alt: "Image alt text",
190
- aspectRatio: ImageRatios.Original,
162
+ aspectRatio: "original",
191
163
  caption: "Image caption",
192
164
  credit: "Image credit",
193
- position: StructuredContentImagePosition.Left,
194
- size: ImageSizes.Medium,
165
+ position: "left",
166
+ size: "medium",
195
167
  src: "https://placeimg.com/400/300/animals",
196
168
  }}
197
169
  bodyContent={
@@ -236,11 +208,11 @@ The following content is passed as HTML DOM elements to the `bodyContent` prop.
236
208
  headingText="Heading text"
237
209
  imageProps={{
238
210
  alt: "Image alt text",
239
- aspectRatio: ImageRatios.Original,
211
+ aspectRatio: "original",
240
212
  caption: "Image caption",
241
213
  credit: "Image credit",
242
- position: StructuredContentImagePosition.Left,
243
- size: ImageSizes.Medium,
214
+ position: "left",
215
+ size: "medium",
244
216
  src: "https://placeimg.com/400/300/animals",
245
217
  }}
246
218
  bodyContent={
@@ -419,11 +391,11 @@ but no callout content. The second component does not have an image.
419
391
  headingText="Heading text"
420
392
  imageProps={{
421
393
  alt: "Image alt text",
422
- aspectRatio: ImageRatios.Original,
394
+ aspectRatio: "original",
423
395
  caption: "Image caption",
424
396
  credit: "Image credit",
425
- position: StructuredContentImagePosition.Left,
426
- size: ImageSizes.Medium,
397
+ position: "left",
398
+ size: "medium",
427
399
  src: "https://placeimg.com/400/300/animals",
428
400
  }}
429
401
  bodyContent={
@@ -485,11 +457,11 @@ The third one does not contain an image.
485
457
  headingText="Heading text"
486
458
  imageProps={{
487
459
  alt: "Image alt text",
488
- aspectRatio: ImageRatios.Original,
460
+ aspectRatio: "original",
489
461
  caption: "Image caption",
490
462
  credit: "Image credit",
491
- position: StructuredContentImagePosition.Left,
492
- size: ImageSizes.Medium,
463
+ position: "left",
464
+ size: "medium",
493
465
  src: "https://placeimg.com/400/300/animals",
494
466
  }}
495
467
  bodyContent={
@@ -558,9 +530,9 @@ text content. The second one has a callout content and image spanning full width
558
530
  headingText="Heading text"
559
531
  imageProps={{
560
532
  alt: "Image alt text",
561
- aspectRatio: ImageRatios.Original,
562
- position: StructuredContentImagePosition.Center,
563
- size: ImageSizes.Medium,
533
+ aspectRatio: "original",
534
+ position: "center",
535
+ size: "medium",
564
536
  src: "https://placeimg.com/400/300/animals",
565
537
  }}
566
538
  bodyContent={
@@ -3,9 +3,7 @@ import { render, screen } from "@testing-library/react";
3
3
  import { axe } from "jest-axe";
4
4
  import renderer from "react-test-renderer";
5
5
 
6
- import { ImageRatios, ImageSizes } from "../Image/ImageTypes";
7
6
  import StructuredContent from "./StructuredContent";
8
- import { StructuredContentImagePosition } from "./StructuredContentTypes";
9
7
 
10
8
  const htmlStringBodyContent =
11
9
  "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do" +
@@ -88,11 +86,11 @@ describe("StructuredContent Accessibility", () => {
88
86
  headingText="Heading text"
89
87
  imageProps={{
90
88
  alt: "Image alt text",
91
- aspectRatio: ImageRatios.Original,
89
+ aspectRatio: "original",
92
90
  caption: "Image caption",
93
91
  credit: "Image credit",
94
- position: StructuredContentImagePosition.Left,
95
- size: ImageSizes.Medium,
92
+ position: "left",
93
+ size: "medium",
96
94
  src: "https://placeimg.com/400/300/animals",
97
95
  }}
98
96
  />
@@ -108,11 +106,11 @@ describe("StructuredContent Accessibility", () => {
108
106
  headingText="Heading text"
109
107
  imageProps={{
110
108
  alt: "Image alt text",
111
- aspectRatio: ImageRatios.Original,
109
+ aspectRatio: "original",
112
110
  caption: "Image caption",
113
111
  credit: "Image credit",
114
- position: StructuredContentImagePosition.Left,
115
- size: ImageSizes.Medium,
112
+ position: "left",
113
+ size: "medium",
116
114
  src: "https://placeimg.com/400/300/animals",
117
115
  }}
118
116
  />
@@ -141,11 +139,11 @@ describe("StructuredContent", () => {
141
139
  headingText="Heading text"
142
140
  imageProps={{
143
141
  alt: "Image alt text",
144
- aspectRatio: ImageRatios.Original,
142
+ aspectRatio: "original",
145
143
  caption: "Image caption",
146
144
  credit: "Image credit",
147
- position: StructuredContentImagePosition.Left,
148
- size: ImageSizes.Medium,
145
+ position: "left",
146
+ size: "medium",
149
147
  src: "https://placeimg.com/400/300/animals",
150
148
  }}
151
149
  />
@@ -165,11 +163,11 @@ describe("StructuredContent", () => {
165
163
  bodyContent={htmlStringBodyContent}
166
164
  imageProps={{
167
165
  alt: "Image alt text",
168
- aspectRatio: ImageRatios.Original,
166
+ aspectRatio: "original",
169
167
  caption: "Image caption",
170
168
  credit: "Image credit",
171
- position: StructuredContentImagePosition.Left,
172
- size: ImageSizes.Medium,
169
+ position: "left",
170
+ size: "medium",
173
171
  src: "https://placeimg.com/400/300/animals",
174
172
  }}
175
173
  />
@@ -208,11 +206,11 @@ describe("StructuredContent", () => {
208
206
  calloutText="This is the callout text"
209
207
  headingText="Heading text"
210
208
  imageProps={{
211
- aspectRatio: ImageRatios.Original,
209
+ aspectRatio: "original",
212
210
  caption: "Image caption",
213
211
  credit: "Image credit",
214
- position: StructuredContentImagePosition.Left,
215
- size: ImageSizes.Medium,
212
+ position: "left",
213
+ size: "medium",
216
214
  src: "https://placeimg.com/400/300/animals",
217
215
  }}
218
216
  />
@@ -233,11 +231,11 @@ describe("StructuredContent", () => {
233
231
  headingText="Heading text"
234
232
  imageProps={{
235
233
  alt: "Image alt text",
236
- aspectRatio: ImageRatios.Original,
234
+ aspectRatio: "original",
237
235
  caption: "Image caption",
238
236
  credit: "Image credit",
239
- position: StructuredContentImagePosition.Left,
240
- size: ImageSizes.Medium,
237
+ position: "left",
238
+ size: "medium",
241
239
  src: "https://placeimg.com/400/300/animals",
242
240
  }}
243
241
  />
@@ -255,10 +253,10 @@ describe("StructuredContent", () => {
255
253
  headingText="Heading text"
256
254
  imageProps={{
257
255
  alt: "Image alt text",
258
- aspectRatio: ImageRatios.Original,
256
+ aspectRatio: "original",
259
257
  credit: "Image credit",
260
- position: StructuredContentImagePosition.Left,
261
- size: ImageSizes.Medium,
258
+ position: "left",
259
+ size: "medium",
262
260
  src: "https://placeimg.com/400/300/animals",
263
261
  }}
264
262
  />
@@ -277,9 +275,9 @@ describe("StructuredContent", () => {
277
275
  headingText="Heading text"
278
276
  imageProps={{
279
277
  alt: "Image alt text",
280
- aspectRatio: ImageRatios.Original,
281
- position: StructuredContentImagePosition.Left,
282
- size: ImageSizes.Medium,
278
+ aspectRatio: "original",
279
+ position: "left",
280
+ size: "medium",
283
281
  src: "https://placeimg.com/400/300/animals",
284
282
  }}
285
283
  />
@@ -300,11 +298,11 @@ describe("StructuredContent", () => {
300
298
  id="withHTMLStringContent"
301
299
  imageProps={{
302
300
  alt: "Image alt text",
303
- aspectRatio: ImageRatios.Original,
301
+ aspectRatio: "original",
304
302
  caption: "Image caption",
305
303
  credit: "Image credit",
306
- position: StructuredContentImagePosition.Left,
307
- size: ImageSizes.Medium,
304
+ position: "left",
305
+ size: "medium",
308
306
  src: "https://placeimg.com/400/300/animals",
309
307
  }}
310
308
  />
@@ -319,11 +317,11 @@ describe("StructuredContent", () => {
319
317
  id="withHTMLDOMContent"
320
318
  imageProps={{
321
319
  alt: "Image alt text",
322
- aspectRatio: ImageRatios.Original,
320
+ aspectRatio: "original",
323
321
  caption: "Image caption",
324
322
  credit: "Image credit",
325
- position: StructuredContentImagePosition.Left,
326
- size: ImageSizes.Medium,
323
+ position: "left",
324
+ size: "medium",
327
325
  src: "https://placeimg.com/400/300/animals",
328
326
  }}
329
327
  />
@@ -348,9 +346,9 @@ describe("StructuredContent", () => {
348
346
  id="withImageWithoutCaptionOrCredit"
349
347
  imageProps={{
350
348
  alt: "Image alt text",
351
- aspectRatio: ImageRatios.Original,
352
- position: StructuredContentImagePosition.Left,
353
- size: ImageSizes.Medium,
349
+ aspectRatio: "original",
350
+ position: "left",
351
+ size: "medium",
354
352
  src: "https://placeimg.com/400/300/animals",
355
353
  }}
356
354
  />
@@ -364,11 +362,11 @@ describe("StructuredContent", () => {
364
362
  id="withoutHeading"
365
363
  imageProps={{
366
364
  alt: "Image alt text",
367
- aspectRatio: ImageRatios.Original,
365
+ aspectRatio: "original",
368
366
  caption: "Image caption",
369
367
  credit: "Image credit",
370
- position: StructuredContentImagePosition.Left,
371
- size: ImageSizes.Medium,
368
+ position: "left",
369
+ size: "medium",
372
370
  src: "https://placeimg.com/400/300/animals",
373
371
  }}
374
372
  />
@@ -391,11 +389,11 @@ describe("StructuredContent", () => {
391
389
  id="withChakraProps"
392
390
  imageProps={{
393
391
  alt: "Image alt text",
394
- aspectRatio: ImageRatios.Original,
392
+ aspectRatio: "original",
395
393
  caption: "Image caption",
396
394
  credit: "Image credit",
397
- position: StructuredContentImagePosition.Left,
398
- size: ImageSizes.Medium,
395
+ position: "left",
396
+ size: "medium",
399
397
  src: "https://placeimg.com/400/300/animals",
400
398
  }}
401
399
  bodyContent={htmlStringBodyContent}
@@ -412,11 +410,11 @@ describe("StructuredContent", () => {
412
410
  id="withOtherProps"
413
411
  imageProps={{
414
412
  alt: "Image alt text",
415
- aspectRatio: ImageRatios.Original,
413
+ aspectRatio: "original",
416
414
  caption: "Image caption",
417
415
  credit: "Image credit",
418
- position: StructuredContentImagePosition.Left,
419
- size: ImageSizes.Medium,
416
+ position: "left",
417
+ size: "medium",
420
418
  src: "https://placeimg.com/400/300/animals",
421
419
  }}
422
420
  bodyContent={htmlStringBodyContent}
@@ -2,14 +2,13 @@ import { Box, chakra, useMultiStyleConfig } from "@chakra-ui/react";
2
2
  import * as React from "react";
3
3
 
4
4
  import Heading from "../Heading/Heading";
5
- import { HeadingSizes, HeadingLevels } from "../Heading/HeadingTypes";
6
5
  import Image, { ComponentImageProps, ImageProps } from "../Image/Image";
7
- import { ImageRatios, ImageSizes } from "../Image/ImageTypes";
8
- import { StructuredContentImagePosition } from "./StructuredContentTypes";
6
+
7
+ export type StructuredContentImagePosition = "left" | "right" | "center";
9
8
 
10
9
  interface StructuredContentImageProps extends ComponentImageProps {
11
10
  /** Optional value to control the positioning of the internal `Image` component.
12
- * Defaults to `StructuredContentImagePosition.Left`. */
11
+ * Defaults to `"left"`. */
13
12
  position?: StructuredContentImagePosition;
14
13
  }
15
14
 
@@ -74,12 +73,12 @@ export const StructuredContent = chakra(
74
73
  id,
75
74
  imageProps = {
76
75
  alt: "",
77
- aspectRatio: ImageRatios.Square,
76
+ aspectRatio: "square",
78
77
  caption: undefined,
79
78
  component: undefined,
80
79
  credit: undefined,
81
- position: StructuredContentImagePosition.Left,
82
- size: ImageSizes.Medium,
80
+ position: "left",
81
+ size: "medium",
83
82
  src: "",
84
83
  },
85
84
  bodyContent,
@@ -111,17 +110,9 @@ export const StructuredContent = chakra(
111
110
 
112
111
  return (
113
112
  <Box id={id} className={className} __css={styles} {...rest}>
114
- {headingText && (
115
- <Heading id={`${id}-heading`} level={HeadingLevels.Two}>
116
- {headingText}
117
- </Heading>
118
- )}
113
+ {headingText && <Heading id={`${id}-heading`}>{headingText}</Heading>}
119
114
  {calloutText && (
120
- <Heading
121
- id={`${id}-callout`}
122
- level={HeadingLevels.Three}
123
- size={HeadingSizes.Callout}
124
- >
115
+ <Heading id={`${id}-callout`} level="three" size="callout">
125
116
  {calloutText}
126
117
  </Heading>
127
118
  )}
@@ -136,7 +127,7 @@ export const StructuredContent = chakra(
136
127
  caption={imageProps.caption}
137
128
  credit={imageProps.credit}
138
129
  size={imageProps.size}
139
- src={imageProps.src ? imageProps.src : null}
130
+ src={imageProps.src ? imageProps.src : undefined}
140
131
  />
141
132
  )}
142
133
  {finalBodyContent}
@@ -1,11 +1,9 @@
1
1
  import { Canvas, Meta } from "@storybook/addon-docs";
2
2
 
3
- import SearchBar from "../SearchBar/SearchBar";
4
- import Icon from "../Icons/Icon";
5
- import { IconNames, IconSizes, IconAlign } from "../Icons/IconTypes";
6
3
  import Button from "../Button/Button";
7
- import { ButtonTypes } from "../Button/ButtonTypes";
8
4
  import HelperErrorText from "../HelperErrorText/HelperErrorText";
5
+ import Icon from "../Icons/Icon";
6
+ import SearchBar from "../SearchBar/SearchBar";
9
7
  import { getCategory } from "../../utils/componentCategories";
10
8
  import DSProvider from "../../theme/provider";
11
9
 
@@ -37,9 +35,9 @@ components should work appropriately in RTL configurations in any browser.
37
35
 
38
36
  ## Application Implementation
39
37
 
40
- Components in the DS will support layout and component mirroring, but application
41
- directionality should be implemented at the application level. The following are
42
- general guidelines on how to set up directionality but implementation will be up
38
+ Components in the DS will support layout and component mirroring, but application
39
+ directionality should be implemented at the application level. The following are
40
+ general guidelines on how to set up directionality but implementation will be up
43
41
  to the application and its architecture.
44
42
 
45
43
  ### `dir` HTML attribute
@@ -191,26 +189,14 @@ help reduce any visual mistakes.
191
189
  <div style={{ display: "flex", flexDirection: "column" }}>
192
190
  <div style={{ width: "300px" }}>
193
191
  A regular button:
194
- <Button buttonType={ButtonTypes.Primary} id="button-ex4" type="submit">
195
- <Icon
196
- name={IconNames.Search}
197
- size={IconSizes.Small}
198
- align={IconAlign.Left}
199
- />
192
+ <Button id="button-ex4" type="submit">
193
+ <Icon name="search" size="small" align="left" />
200
194
  Search
201
195
  </Button>
202
196
  <div dir="rtl">
203
197
  An RTL button:
204
- <Button
205
- buttonType={ButtonTypes.Primary}
206
- id="button-ex5"
207
- type="submit"
208
- >
209
- <Icon
210
- name={IconNames.Search}
211
- size={IconSizes.Small}
212
- align={IconAlign.Left}
213
- />
198
+ <Button id="button-ex5" type="submit">
199
+ <Icon name="search" size="small" align="left" />
214
200
  Search
215
201
  </Button>
216
202
  </div>