@nypl/design-system-react-components 0.26.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 (306) hide show
  1. package/CHANGELOG.md +56 -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/Modal/Modal.d.ts +28 -8
  23. package/dist/components/Notification/Notification.d.ts +1 -1
  24. package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +2 -1
  25. package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
  26. package/dist/components/SearchBar/SearchBar.d.ts +3 -2
  27. package/dist/components/Select/Select.d.ts +2 -5
  28. package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +4 -4
  29. package/dist/components/SkipNavigation/SkipNavigation.d.ts +17 -0
  30. package/dist/components/StatusBadge/StatusBadge.d.ts +2 -3
  31. package/dist/components/StructuredContent/StructuredContent.d.ts +2 -2
  32. package/dist/components/Table/Table.d.ts +1 -1
  33. package/dist/components/Template/Template.d.ts +2 -0
  34. package/dist/components/Text/Text.d.ts +1 -1
  35. package/dist/components/TextInput/TextInput.d.ts +21 -9
  36. package/dist/components/Toggle/Toggle.d.ts +1 -5
  37. package/dist/components/VideoPlayer/VideoPlayer.d.ts +2 -1
  38. package/dist/design-system-react-components.cjs.development.js +977 -1213
  39. package/dist/design-system-react-components.cjs.development.js.map +1 -1
  40. package/dist/design-system-react-components.cjs.production.min.js +1 -1
  41. package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
  42. package/dist/design-system-react-components.esm.js +976 -1276
  43. package/dist/design-system-react-components.esm.js.map +1 -1
  44. package/dist/helpers/types.d.ts +1 -0
  45. package/dist/index.d.ts +27 -48
  46. package/dist/styles.css +1 -1
  47. package/dist/theme/components/buttonGroup.d.ts +11 -0
  48. package/dist/theme/components/card.d.ts +104 -8
  49. package/dist/theme/components/componentWrapper.d.ts +4 -3
  50. package/dist/theme/components/customTable.d.ts +11 -14
  51. package/dist/theme/components/fieldset.d.ts +4 -3
  52. package/dist/theme/components/helperErrorText.d.ts +4 -3
  53. package/dist/theme/components/hero.d.ts +1 -1
  54. package/dist/theme/components/horizontalRule.d.ts +4 -3
  55. package/dist/theme/components/icon.d.ts +47743 -1
  56. package/dist/theme/components/image.d.ts +563 -10
  57. package/dist/theme/components/label.d.ts +4 -3
  58. package/dist/theme/components/list.d.ts +6 -7
  59. package/dist/theme/components/logo.d.ts +474 -1
  60. package/dist/theme/components/notification.d.ts +20 -16
  61. package/dist/theme/components/progressIndicator.d.ts +6 -4
  62. package/dist/theme/components/select.d.ts +4 -10
  63. package/dist/theme/components/skeletonLoader.d.ts +14 -10
  64. package/dist/theme/components/skipNavigation.d.ts +22 -0
  65. package/dist/theme/components/slider.d.ts +7 -6
  66. package/dist/theme/components/structuredContent.d.ts +10 -9
  67. package/dist/theme/components/text.d.ts +7 -1
  68. package/dist/theme/components/toggle.d.ts +6 -4
  69. package/dist/theme/provider.d.ts +2 -4
  70. package/dist/utils/componentCategories.d.ts +1 -1
  71. package/dist/utils/interfaces.d.ts +5 -0
  72. package/dist/utils/utils.d.ts +2 -18
  73. package/package.json +15 -16
  74. package/src/__tests__/setup.ts +3 -3
  75. package/src/__tests__/utils/utils.test.ts +1 -23
  76. package/src/components/AccessibilityGuide/SkipNavigation.stories.mdx +22 -14
  77. package/src/components/Accordion/Accordion.stories.mdx +43 -44
  78. package/src/components/Accordion/Accordion.test.tsx +5 -13
  79. package/src/components/Accordion/Accordion.tsx +14 -18
  80. package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +6 -6
  81. package/src/components/Autosuggest/Autosuggest.stories.mdx +1 -1
  82. package/src/components/Autosuggest/Autosuggest.stories.tsx +23 -25
  83. package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +21 -37
  84. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +4 -17
  85. package/src/components/Breadcrumbs/Breadcrumbs.tsx +18 -21
  86. package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +1 -100
  87. package/src/components/Button/Button.stories.mdx +89 -126
  88. package/src/components/Button/Button.test.tsx +16 -30
  89. package/src/components/Button/Button.tsx +14 -20
  90. package/src/components/ButtonGroup/ButtonGroup.stories.mdx +147 -0
  91. package/src/components/ButtonGroup/ButtonGroup.test.tsx +141 -0
  92. package/src/components/ButtonGroup/ButtonGroup.tsx +99 -0
  93. package/src/components/ButtonGroup/__snapshots__/ButtonGroup.test.tsx.snap +117 -0
  94. package/src/components/Card/Card.stories.mdx +143 -177
  95. package/src/components/Card/Card.test.tsx +36 -97
  96. package/src/components/Card/Card.tsx +78 -74
  97. package/src/components/Card/__snapshots__/Card.test.tsx.snap +1 -1
  98. package/src/components/Chakra/Box.stories.mdx +2 -6
  99. package/src/components/Chakra/Center.stories.mdx +5 -23
  100. package/src/components/Chakra/Flex.stories.mdx +4 -6
  101. package/src/components/Chakra/Stack.stories.mdx +9 -10
  102. package/src/components/Checkbox/Checkbox.stories.mdx +1 -1
  103. package/src/components/Checkbox/Checkbox.test.tsx +2 -2
  104. package/src/components/Checkbox/Checkbox.tsx +20 -13
  105. package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +9 -9
  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 +24 -35
  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 +1 -1
  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 +62 -62
  193. package/src/components/StyleGuide/ColorCard.tsx +2 -4
  194. package/src/components/StyleGuide/Colors.stories.mdx +7 -8
  195. package/src/components/StyleGuide/DesignTokens.stories.mdx +5 -7
  196. package/src/components/StyleGuide/Forms.stories.mdx +0 -1
  197. package/src/components/StyleGuide/Iconography.stories.mdx +59 -77
  198. package/src/components/StyleGuide/Spacing.stories.mdx +0 -1
  199. package/src/components/StyleGuide/Typography.stories.mdx +15 -18
  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/index.ts +4 -0
  252. package/src/theme/provider.tsx +1 -1
  253. package/src/utils/componentCategories.ts +13 -5
  254. package/src/utils/interfaces.ts +5 -0
  255. package/src/utils/utils.ts +2 -32
  256. package/dist/components/Accordion/AccordionTypes.d.ts +0 -5
  257. package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +0 -8
  258. package/dist/components/Button/ButtonTypes.d.ts +0 -8
  259. package/dist/components/DatePicker/DatePickerTypes.d.ts +0 -5
  260. package/dist/components/Form/FormTypes.d.ts +0 -2
  261. package/dist/components/Grid/GridTypes.d.ts +0 -9
  262. package/dist/components/Heading/HeadingTypes.d.ts +0 -14
  263. package/dist/components/Hero/HeroTypes.d.ts +0 -12
  264. package/dist/components/Icons/IconTypes.d.ts +0 -77
  265. package/dist/components/Image/ImageTypes.d.ts +0 -22
  266. package/dist/components/Link/LinkTypes.d.ts +0 -8
  267. package/dist/components/List/ListTypes.d.ts +0 -5
  268. package/dist/components/Logo/LogoTypes.d.ts +0 -54
  269. package/dist/components/Notification/NotificationTypes.d.ts +0 -5
  270. package/dist/components/ProgressIndicator/ProgressIndicatorTypes.d.ts +0 -8
  271. package/dist/components/Select/SelectTypes.d.ts +0 -8
  272. package/dist/components/SkeletonLoader/SkeletonLoaderTypes.d.ts +0 -5
  273. package/dist/components/StatusBadge/StatusBadgeTypes.d.ts +0 -5
  274. package/dist/components/StructuredContent/StructuredContentTypes.d.ts +0 -5
  275. package/dist/components/Text/TextTypes.d.ts +0 -6
  276. package/dist/components/TextInput/TextInputTypes.d.ts +0 -25
  277. package/dist/components/Toggle/ToggleTypes.d.ts +0 -4
  278. package/dist/components/VideoPlayer/VideoPlayerTypes.d.ts +0 -9
  279. package/dist/helpers/enums.d.ts +0 -4
  280. package/dist/utils/siteSections.d.ts +0 -2
  281. package/src/components/Accordion/AccordionTypes.tsx +0 -5
  282. package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +0 -8
  283. package/src/components/Button/ButtonTypes.tsx +0 -8
  284. package/src/components/DatePicker/DatePickerTypes.tsx +0 -5
  285. package/src/components/Form/FormTypes.tsx +0 -3
  286. package/src/components/Grid/GridTypes.tsx +0 -9
  287. package/src/components/Heading/HeadingTypes.tsx +0 -15
  288. package/src/components/Hero/HeroTypes.tsx +0 -20
  289. package/src/components/Icons/IconTypes.tsx +0 -83
  290. package/src/components/Image/ImageTypes.ts +0 -24
  291. package/src/components/Link/LinkTypes.tsx +0 -8
  292. package/src/components/List/ListTypes.tsx +0 -5
  293. package/src/components/Logo/LogoTypes.tsx +0 -56
  294. package/src/components/Modal/_Modal.scss +0 -18
  295. package/src/components/Notification/NotificationTypes.tsx +0 -5
  296. package/src/components/ProgressIndicator/ProgressIndicatorTypes.ts +0 -8
  297. package/src/components/Select/SelectTypes.tsx +0 -10
  298. package/src/components/SkeletonLoader/SkeletonLoaderTypes.tsx +0 -5
  299. package/src/components/StatusBadge/StatusBadgeTypes.tsx +0 -5
  300. package/src/components/StructuredContent/StructuredContentTypes.tsx +0 -5
  301. package/src/components/Text/TextTypes.tsx +0 -6
  302. package/src/components/TextInput/TextInputTypes.tsx +0 -48
  303. package/src/components/Toggle/ToggleTypes.tsx +0 -4
  304. package/src/components/VideoPlayer/VideoPlayerTypes.tsx +0 -10
  305. package/src/helpers/enums.ts +0 -4
  306. package/src/utils/siteSections.ts +0 -10
@@ -1,4 +1,3 @@
1
- import { Box, VStack } from "@chakra-ui/react";
2
1
  import {
3
2
  ArgsTable,
4
3
  Canvas,
@@ -9,14 +8,11 @@ import {
9
8
  import { withDesign } from "storybook-addon-designs";
10
9
 
11
10
  import Heading from "../Heading/Heading";
12
- import { HeadingLevels } from "../Heading/HeadingTypes";
13
- import Hero from "./Hero";
14
- import { HeroTypes, HeroSecondaryTypes } from "./HeroTypes";
11
+ import Hero, { heroSecondaryTypes } from "./Hero";
12
+ import SimpleGrid from "../Grid/SimpleGrid";
13
+ import Text from "../Text/Text";
15
14
  import { getCategory } from "../../utils/componentCategories";
16
15
  import DSProvider from "../../theme/provider";
17
- import { getStorybookEnumValues } from "../../utils/utils";
18
-
19
- export const enumValues = getStorybookEnumValues(HeroTypes, "HeroTypes");
20
16
 
21
17
  <Meta
22
18
  title={getCategory("Hero")}
@@ -34,12 +30,9 @@ export const enumValues = getStorybookEnumValues(HeroTypes, "HeroTypes");
34
30
  foregroundColor: { control: false },
35
31
  heading: { control: false },
36
32
  heroType: {
37
- control: { type: "select" },
38
- table: { defaultValue: { summary: "HeroTypes.Primary" } },
39
- options: enumValues.options,
33
+ table: { defaultValue: { summary: "primary" } },
40
34
  },
41
- imageAlt: { control: false },
42
- imageSrc: { control: false },
35
+ imageProps: { control: false },
43
36
  locationDetails: { control: false },
44
37
  subHeaderText: { control: false },
45
38
  }}
@@ -55,15 +48,17 @@ export const secondarySubHeaderText = (
55
48
  );
56
49
  export const otherSubHeaderText =
57
50
  "With 92 locations across the Bronx, Manhattan, and Staten Island, The New York Public Library is an essential part of neighborhoods across the city. Visit us today.";
58
- const imageAlt = "Image example";
59
- const imageSrc = "https://placeimg.com/800/400/animals";
51
+ export const imageProps = {
52
+ alt: "Image example",
53
+ src: "https://placeimg.com/800/400/animals",
54
+ };
60
55
 
61
56
  # Hero
62
57
 
63
58
  | Component Version | DS Version |
64
59
  | ----------------- | ---------- |
65
60
  | Added | `0.2.0` |
66
- | Latest | `0.26.0` |
61
+ | Latest | `0.28.0` |
67
62
 
68
63
  ## Table of Contents
69
64
 
@@ -81,6 +76,31 @@ The `Hero` component is used to display a full width banner at the top of a page
81
76
  The `Hero` will contain a required `h1` page title and may also include optional
82
77
  descriptive text and images.
83
78
 
79
+ There are currently five main hero types: `"primary"`, `"secondary"`,
80
+ `"tertiary"`, `"campaign"`, and `"fiftyFifty"`. Under the `"secondary"` hero type,
81
+ there are four additional subtypes: `"secondaryBooksAndMore"`, `"secondaryLocations"`,
82
+ `"secondaryResearch"`, and `"secondaryWhatsOn"`.
83
+
84
+ For the variations that use image "alt" and "src" attributes, the `imageProps`
85
+ prop should be used:
86
+
87
+ ```jsx
88
+ <Hero
89
+ backgroundImageSrc="https://placeimg.com/2400/800/nature/grayscale"
90
+ heroType="campaign"
91
+ heading={<Heading level="one" id="campaign-hero" text="Hero Campaign" />}
92
+ imageProps={{
93
+ alt: "Image example",
94
+ src: "https://placeimg.com/800/400/animals",
95
+ }}
96
+ subHeaderText="Campaign Hero Subheader Text"
97
+ />
98
+ ```
99
+
100
+ Note: the `imageProps` prop is not the same as the `backgroundImageSrc` prop used
101
+ for some variations. For a full list of what props to use for each variant, check
102
+ the [All Variations](#all-variations) section.
103
+
84
104
  ## Component Props
85
105
 
86
106
  <Canvas withToolbar>
@@ -91,68 +111,56 @@ descriptive text and images.
91
111
  backgroundImageSrc: undefined,
92
112
  foregroundColor: undefined,
93
113
  heading: undefined,
94
- heroType: "HeroTypes.Primary",
95
- imageAlt: undefined,
96
- imageSrc: undefined,
114
+ heroType: "primary",
115
+ imageProps: undefined,
97
116
  locationDetails: undefined,
98
117
  subHeaderText: undefined,
99
118
  }}
100
119
  >
101
120
  {(args) =>
102
- (args.heroType === "HeroTypes.Primary" && (
121
+ (args.heroType === "primary" && (
103
122
  <Hero
104
123
  {...args}
105
124
  backgroundImageSrc="https://placeimg.com/2400/800/nature"
106
- heading={
107
- <Heading level={HeadingLevels.One} id="1" text="Hero Primary" />
108
- }
109
- heroType={enumValues.getValue(args.heroType)}
125
+ heading={<Heading level="one" id="1" text="Hero Primary" />}
126
+ heroType={args.heroType}
110
127
  subHeaderText="Example Subtitle"
111
128
  />
112
129
  )) ||
113
- (HeroSecondaryTypes.includes(enumValues.getValue(args.heroType)) && (
130
+ (heroSecondaryTypes.includes(args.heroType) && (
114
131
  <div className="nypl--books-and-more">
115
132
  <Hero
116
133
  {...args}
117
- heading={
118
- <Heading level={HeadingLevels.One} id="1" text="Hero Secondary" />
119
- }
120
- heroType={enumValues.getValue(args.heroType)}
121
- imageAlt={args.imageAlt}
122
- imageSrc={args.imageSrc}
134
+ heading={<Heading level="one" id="1" text="Hero Secondary" />}
135
+ heroType={args.heroType}
136
+ imageProps={args.imageProps}
123
137
  subHeaderText={secondarySubHeaderText}
124
138
  />
125
139
  </div>
126
140
  )) ||
127
- (args.heroType === "HeroTypes.Tertiary" && (
141
+ (args.heroType === "tertiary" && (
128
142
  <Hero
129
143
  {...args}
130
- heading={
131
- <Heading level={HeadingLevels.One} id="1" text="Hero Tertiary" />
132
- }
133
- heroType={enumValues.getValue(args.heroType)}
144
+ heading={<Heading level="one" id="1" text="Hero Tertiary" />}
145
+ heroType={args.heroType}
134
146
  subHeaderText={otherSubHeaderText}
135
147
  />
136
148
  )) ||
137
- (args.heroType === "HeroTypes.Campaign" && (
149
+ (args.heroType === "campaign" && (
138
150
  <Hero
139
151
  {...args}
140
152
  backgroundImageSrc="https://placeimg.com/2400/800/nature"
141
- heading={
142
- <Heading level={HeadingLevels.One} id="1" text="Hero Campaign" />
143
- }
144
- heroType={enumValues.getValue(args.heroType)}
145
- imageAlt={args.imageAlt}
146
- imageSrc={args.imageSrc}
153
+ heading={<Heading level="one" id="1" text="Hero Campaign" />}
154
+ heroType={args.heroType}
155
+ imageProps={args.imageProps}
147
156
  subHeaderText={otherSubHeaderText}
148
157
  />
149
158
  )) ||
150
- (args.heroType === "HeroTypes.FiftyFifty" && (
159
+ (args.heroType === "fiftyFifty" && (
151
160
  <Hero
152
161
  {...args}
153
- heroType={enumValues.getValue(args.heroType)}
154
- imageAlt={args.imageAlt}
155
- imageSrc={args.imageSrc}
162
+ heroType={args.heroType}
163
+ imageProps={args.imageProps}
156
164
  subHeaderText={otherSubHeaderText}
157
165
  />
158
166
  ))
@@ -167,209 +175,204 @@ descriptive text and images.
167
175
  The `Hero` component is commonly used as a banner below the page's header and
168
176
  breadcrumbs and above the main content. This means that if the `Hero` displays
169
177
  a heading element, it should be the first on the page and an `h1` element set
170
- through `Heading`'s `level={HeadingLevels.One}`.
178
+ through `Heading`'s `level="one"`.
171
179
 
172
180
  ## All Variations
173
181
 
182
+ Each `Hero` variation can be rendered through the `heroType` prop.
183
+
184
+ ### Primary
185
+
186
+ The `"primary"` hero type can be used with the `backgroundColor`, `backgroundImageSrc`,
187
+ `foregroundColor`, `heading`, `locationDetails`, and `subHeaderText` props. The
188
+ minimum props that should be used are `backgroundImageSrc` and `heading`.
189
+
190
+ ```jsx
191
+ backgroundImageSrc="https://placeimg.com/1600/800/arch"
192
+ heading={<Heading level="one" id="primary-hero" text="Hero Primary" />}
193
+ ```
194
+
174
195
  <Canvas>
175
196
  <DSProvider>
176
- <VStack spacing={10} align="stretch">
177
- <Heading level={HeadingLevels.Two} text="Primary" id="primary-heading" />
178
- <Hero
179
- backgroundImageSrc="https://placeimg.com/1600/800/arch"
180
- heading={
181
- <Heading
182
- level={HeadingLevels.One}
183
- id="primary-hero"
184
- text="Hero Primary"
185
- />
186
- }
187
- heroType={HeroTypes.Primary}
188
- />
189
- <Heading
190
- id="secondary-heading"
191
- level={HeadingLevels.Two}
192
- text="Secondary"
193
- />
194
- <div className="nypl--locations">
195
- <Hero
196
- heading={
197
- <Heading
198
- level={HeadingLevels.One}
199
- id="secondary-hero"
200
- text="Hero Secondary"
201
- />
202
- }
203
- heroType={HeroTypes.Secondary}
204
- imageAlt={imageAlt}
205
- imageSrc={imageSrc}
206
- subHeaderText={secondarySubHeaderText}
197
+ <Hero
198
+ backgroundImageSrc="https://placeimg.com/1600/800/arch"
199
+ heading={<Heading level="one" id="primary-hero" text="Hero Primary" />}
200
+ heroType="primary"
201
+ />
202
+ </DSProvider>
203
+ </Canvas>
204
+
205
+ ### Secondary
206
+
207
+ The `"secondary"` hero type can be used with the `heading`, `imageProps`, and
208
+ `subHeaderText` props.
209
+
210
+ ```jsx
211
+ heading={
212
+ <Heading level="one" id="secondary-hero" text="Hero Secondary" />
213
+ }
214
+ imageProps={imageProps}
215
+ subHeaderText={secondarySubHeaderText}
216
+ ```
217
+
218
+ <Canvas>
219
+ <DSProvider>
220
+ <Hero
221
+ heading={
222
+ <Heading level="one" id="secondary-hero" text="Hero Secondary" />
223
+ }
224
+ heroType="secondary"
225
+ imageProps={imageProps}
226
+ subHeaderText={secondarySubHeaderText}
227
+ />
228
+ </DSProvider>
229
+ </Canvas>
230
+
231
+ ### Tertiary
232
+
233
+ The `"tertiary"` hero type can be used with the `backgroundColor`, `foregroundColor`,
234
+ `heading`, and `subHeaderText` props. The minimum prop to use is the `heading`
235
+ prop.
236
+
237
+ ```jsx
238
+ heading={
239
+ <Heading
240
+ level="one"
241
+ id="tertiary-hero"
242
+ text="Hero Tertiary with Sub-Header"
243
+ />
244
+ }
245
+ subHeaderText={otherSubHeaderText}
246
+ ```
247
+
248
+ <Canvas>
249
+ <DSProvider>
250
+ <Hero
251
+ heading={
252
+ <Heading
253
+ level="one"
254
+ id="tertiary-hero"
255
+ text="Hero Tertiary with Sub-Header"
207
256
  />
208
- </div>
209
- <Heading
210
- id="tertiary-heading"
211
- level={HeadingLevels.Two}
212
- text="Tertiary"
213
- />
214
- <Hero
215
- heading={
216
- <Heading
217
- level={HeadingLevels.One}
218
- id="tertiary-hero"
219
- text="Hero Tertiary with Sub-Header"
220
- />
221
- }
222
- heroType={HeroTypes.Tertiary}
223
- subHeaderText={otherSubHeaderText}
224
- />
225
- <Hero
226
- heading={
227
- <Heading
228
- level={HeadingLevels.One}
229
- id="tertiary-hero"
230
- text="Hero Tertiary without Sub-Header"
231
- />
232
- }
233
- heroType={HeroTypes.Tertiary}
234
- />
235
- <Heading
236
- id="campaign-heading"
237
- level={HeadingLevels.Two}
238
- text="Campaign"
239
- />
240
- <Hero
241
- backgroundImageSrc="https://placeimg.com/2400/800/nature/grayscale"
242
- heroType={HeroTypes.Campaign}
243
- heading={
244
- <Heading
245
- level={HeadingLevels.One}
246
- id="campaign-hero"
247
- text="Hero Campaign"
248
- />
249
- }
250
- imageAlt={imageAlt}
251
- imageSrc={imageSrc}
252
- subHeaderText={otherSubHeaderText}
253
- />
254
- <Box marginTop="30px" />
255
- <Heading
256
- id="fiftyfifty-heading"
257
- level={HeadingLevels.Two}
258
- text="FiftyFifty"
259
- />
260
- <Hero
261
- heroType={HeroTypes.FiftyFifty}
262
- imageAlt={imageAlt}
263
- imageSrc={imageSrc}
264
- subHeaderText={otherSubHeaderText}
265
- />
266
- </VStack>
257
+ }
258
+ heroType="tertiary"
259
+ subHeaderText={otherSubHeaderText}
260
+ />
261
+ <br />
262
+ <Hero
263
+ heading={
264
+ <Heading
265
+ level="one"
266
+ id="tertiary-hero"
267
+ text="Hero Tertiary without Sub-Header text"
268
+ />
269
+ }
270
+ heroType="tertiary"
271
+ />
272
+ </DSProvider>
273
+ </Canvas>
274
+
275
+ ### Campaign
276
+
277
+ The `"campaign"` hero type can be used with the `backgroundColor`,
278
+ `backgroundImageSrc`, `foregroundColor`, `heading`, `imageProps`, and
279
+ `subHeaderText` props. The minimum props to use are `backgroundImageSrc`,
280
+ `heading`, and `imageProps`.
281
+
282
+ ```jsx
283
+ backgroundImageSrc="https://placeimg.com/2400/800/nature/grayscale"
284
+ heading={
285
+ <Heading level="one" id="campaign-hero" text="Hero Campaign" />
286
+ }
287
+ imageProps={imageProps}
288
+ subHeaderText={otherSubHeaderText}
289
+ ```
290
+
291
+ <Canvas>
292
+ <DSProvider>
293
+ <Hero
294
+ backgroundImageSrc="https://placeimg.com/2400/800/nature/grayscale"
295
+ heroType="campaign"
296
+ heading={<Heading level="one" id="campaign-hero" text="Hero Campaign" />}
297
+ imageProps={imageProps}
298
+ subHeaderText={otherSubHeaderText}
299
+ />
300
+ </DSProvider>
301
+ </Canvas>
302
+
303
+ ### FiftyFifty
304
+
305
+ The `"fiftyFifty"` hero type can be used with the `backgroundColor`,
306
+ `foregroundColor`, `heading`, `imageProps`, and `subHeaderText` props. The
307
+ minimum props to use are `imageProps` and `subHeaderText`.
308
+
309
+ ```
310
+ imageProps={imageProps}
311
+ subHeaderText={otherSubHeaderText}
312
+ ```
313
+
314
+ <Canvas>
315
+ <DSProvider>
316
+ <Hero
317
+ heroType="fiftyFifty"
318
+ imageProps={imageProps}
319
+ subHeaderText={otherSubHeaderText}
320
+ />
267
321
  </DSProvider>
268
322
  </Canvas>
269
323
 
270
324
  ## Color Variations for Secondary Hero
271
325
 
272
- The background color for the title bar in the "Secondary" `Hero` changes based
273
- on the `HeroTypes` variants for the `Secondary` main variant.
326
+ The background color for the title bar in the `"secondary"` `Hero` changes based
327
+ on the `heroType` variants for the `"secondary"` main variant. There are four
328
+ subtypes: `"secondaryBooksAndMore"`, `"secondaryLocations"`, `"secondaryResearch"`,
329
+ and `"secondaryWhatsOn"`.
274
330
 
275
331
  ```jsx
276
- // Example `HeroTypes` "Secondary" variant.
277
- <Hero heroType={HeroTypes.SecondaryBooksAndMore} {...props} />
332
+ // Example `heroType` "secondary" variant.
333
+ <Hero heroType="secondaryBooksAndMore" {...props} />
278
334
  ```
279
335
 
280
336
  <Canvas>
281
337
  <Story name="Color Variations for Secondary Hero">
282
- <VStack spacing={10} align="stretch">
283
- <Heading
284
- id="main-secondary-heading"
285
- level={HeadingLevels.Two}
286
- text="HeroTypes.Secondary"
287
- />
338
+ <SimpleGrid columns={1}>
339
+ <Heading id="main-secondary-heading" text="secondary" />
288
340
  <Hero
289
341
  heading={
290
- <Heading
291
- level={HeadingLevels.One}
292
- id="main-secondary-hero"
293
- text="Secondary"
294
- />
342
+ <Heading level="one" id="main-secondary-hero" text="Secondary" />
295
343
  }
296
- heroType={HeroTypes.Secondary}
297
- imageAlt={imageAlt}
298
- imageSrc={imageSrc}
344
+ heroType="secondary"
345
+ imageProps={imageProps}
299
346
  subHeaderText={secondarySubHeaderText}
300
347
  />
301
- <Heading
302
- id="books-heading"
303
- level={HeadingLevels.Two}
304
- text="HeroTypes.SecondaryBooksAndMore"
305
- />
348
+ <Heading id="books-heading" text="secondaryBooksAndMore" />
306
349
  <Hero
307
- heading={
308
- <Heading
309
- level={HeadingLevels.One}
310
- id="books-hero"
311
- text="Books and More"
312
- />
313
- }
314
- heroType={HeroTypes.SecondaryBooksAndMore}
315
- imageAlt={imageAlt}
316
- imageSrc={imageSrc}
350
+ heading={<Heading level="one" id="books-hero" text="Books and More" />}
351
+ heroType="secondaryBooksAndMore"
352
+ imageProps={imageProps}
317
353
  subHeaderText={secondarySubHeaderText}
318
354
  />
319
- <Heading
320
- id="location-heading"
321
- level={HeadingLevels.Two}
322
- text="HeroTypes.SecondaryLocations"
323
- />
355
+ <Heading id="location-heading" text="secondaryLocations" />
324
356
  <Hero
325
- heading={
326
- <Heading
327
- level={HeadingLevels.One}
328
- id="locations-hero"
329
- text="Locations"
330
- />
331
- }
332
- heroType={HeroTypes.SecondaryLocations}
333
- imageAlt={imageAlt}
334
- imageSrc={imageSrc}
357
+ heading={<Heading level="one" id="locations-hero" text="Locations" />}
358
+ heroType="secondaryLocations"
359
+ imageProps={imageProps}
335
360
  subHeaderText={secondarySubHeaderText}
336
361
  />
337
- <Heading
338
- id="research-heading"
339
- level={HeadingLevels.Two}
340
- text="HeroTypes.SecondaryResearch"
341
- />
362
+ <Heading id="research-heading" text="secondaryResearch" />
342
363
  <Hero
343
- heading={
344
- <Heading
345
- level={HeadingLevels.One}
346
- id="research-hero"
347
- text="Research"
348
- />
349
- }
350
- heroType={HeroTypes.SecondaryResearch}
351
- imageAlt={imageAlt}
352
- imageSrc={imageSrc}
364
+ heading={<Heading level="one" id="research-hero" text="Research" />}
365
+ heroType="secondaryResearch"
366
+ imageProps={imageProps}
353
367
  subHeaderText={secondarySubHeaderText}
354
368
  />
355
- <Heading
356
- id="whats-on-heading"
357
- level={HeadingLevels.Two}
358
- text="HeroTypes.SecondaryWhatsOn"
359
- />
369
+ <Heading id="whats-on-heading" text="secondaryWhatsOn" />
360
370
  <Hero
361
- heading={
362
- <Heading
363
- level={HeadingLevels.One}
364
- id="whats-on-hero"
365
- text="What's On"
366
- />
367
- }
368
- heroType={HeroTypes.SecondaryWhatsOn}
369
- imageAlt={imageAlt}
370
- imageSrc={imageSrc}
371
+ heading={<Heading level="one" id="whats-on-hero" text="What's On" />}
372
+ heroType="secondaryWhatsOn"
373
+ imageProps={imageProps}
371
374
  subHeaderText={secondarySubHeaderText}
372
375
  />
373
- </VStack>
376
+ </SimpleGrid>
374
377
  </Story>
375
378
  </Canvas>