@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,27 +1,25 @@
1
1
  import { As, Box, chakra, useStyleConfig } from "@chakra-ui/react";
2
2
  import * as React from "react";
3
3
 
4
- import { ListTypes } from "./ListTypes";
5
4
  import Heading from "../Heading/Heading";
6
- import { HeadingLevels } from "../Heading/HeadingTypes";
5
+
6
+ export type ListTypes = "ol" | "ul" | "dl";
7
7
  interface DescriptionProps {
8
8
  term: string;
9
9
  description: string | JSX.Element;
10
10
  }
11
11
  export interface ListProps {
12
- /** Optionally pass in additional Chakra-based styles. */
13
- additionalStyles?: { [key: string]: any };
14
12
  /** ClassName you can add in addition to 'list' */
15
13
  className?: string;
16
14
  /** ID that other components can cross reference for accessibility purposes */
17
15
  id?: string;
18
16
  /** Display the list in a row. */
19
17
  inline?: boolean;
20
- /** Data to render if children are not passed. For `ListTypes.Ordered` and
21
- * `ListTypes.Unordered` `List` types, the data structure is an array of
22
- * strings to renders as `li` items. For `ListTypes.Description` `List` types,
23
- * the data structure is an array of objects with `term` and `description`
24
- * properties to render `dt` and `dd` elements, respectively.
18
+ /** Data to render if children are not passed. For `listTypes` orderd `"ol"`
19
+ * and unordered `"ul"` `List` types, the data structure is an array of strings
20
+ * to renders as `li` items. For descroption `"dl"` `List` types, the data
21
+ * structure is an array of objects with `term` and `description` properties
22
+ * to render `dt` and `dd` elements, respectively.
25
23
  */
26
24
  listItems?: (string | JSX.Element | DescriptionProps)[];
27
25
  /** Remove list styling. */
@@ -29,7 +27,7 @@ export interface ListProps {
29
27
  /** An optional title that will appear over the list. This prop only applies
30
28
  * to Description Lists. */
31
29
  title?: string;
32
- /** The type of list: Ordered, Unordered, or Description. Unordered by default. */
30
+ /** The type of list: "ol", "ul", or "dl". "ul" by default. */
33
31
  type: ListTypes;
34
32
  }
35
33
 
@@ -40,7 +38,6 @@ export interface ListProps {
40
38
  */
41
39
  export const List = chakra((props: React.PropsWithChildren<ListProps>) => {
42
40
  const {
43
- additionalStyles = {},
44
41
  children,
45
42
  className,
46
43
  id,
@@ -48,16 +45,15 @@ export const List = chakra((props: React.PropsWithChildren<ListProps>) => {
48
45
  listItems,
49
46
  noStyling = false,
50
47
  title,
51
- type = ListTypes.Unordered,
48
+ type = "ul",
52
49
  ...rest
53
50
  } = props;
54
51
  const styles = useStyleConfig("List", { inline, noStyling, variant: type });
55
- const finalStyles = { ...styles, ...additionalStyles };
56
52
  let listElement = null;
57
53
 
58
54
  // Either li/dt/dd children elements must be passed or the `listItems`
59
55
  // prop must be used.
60
- if (children && (listItems || listItems?.length > 0)) {
56
+ if (children && listItems && listItems?.length > 0) {
61
57
  console.warn(
62
58
  "NYPL Reservoir List: Pass in either `<li>`, `<dt>`, or `<dd>` " +
63
59
  "children or use the `listItems` data prop. Do not use both."
@@ -75,17 +71,20 @@ export const List = chakra((props: React.PropsWithChildren<ListProps>) => {
75
71
  /**
76
72
  * This returns either the `children` elements passed to the `List` component
77
73
  * first, otherwise it will check and render the data passed into the
78
- * `listItems` props based on the `ListType` type. If it is of type "Unordered"
79
- * or "Ordered", it will return `li` elements. Otherwise, it will return a
80
- * combination of `dt` and `dd` elements for the "Description" type.
74
+ * `listItems` props based on the `ListType` type. If it is of type unordered
75
+ * or ordered, it will return `li` elements. Otherwise, it will return a
76
+ * combination of `dt` and `dd` elements for the description type.
81
77
  */
82
78
  const listChildrenElms = (listType: ListTypes) => {
83
79
  if (children) {
84
80
  return children;
85
81
  }
86
- if (listType === ListTypes.Ordered || listType === ListTypes.Unordered) {
82
+ if (!listItems) {
83
+ return null;
84
+ }
85
+ if (listType === "ol" || listType === "ul") {
87
86
  return listItems.map((item, i) => <li key={i}>{item}</li>);
88
- } else if (listType === ListTypes.Description) {
87
+ } else if (listType === "dl") {
89
88
  return (listItems as DescriptionProps[]).map((item, i) => [
90
89
  <dt key={`${i}-term`}>{item.term}</dt>,
91
90
  <dd key={`${i}-des`}>{item.description}</dd>,
@@ -98,7 +97,7 @@ export const List = chakra((props: React.PropsWithChildren<ListProps>) => {
98
97
  * children are different HTML elements.
99
98
  */
100
99
  const checkListChildrenError = (listType: ListTypes) => {
101
- React.Children.map(children, (child: React.ReactElement) => {
100
+ React.Children.map(children as JSX.Element, (child: React.ReactElement) => {
102
101
  if (child && child?.type !== "li" && child?.props?.mdxType !== "li") {
103
102
  console.warn(
104
103
  `NYPL Reservoir List: Direct children of \`List\` (${listType}) must be \`<li>\`s.`
@@ -111,7 +110,7 @@ export const List = chakra((props: React.PropsWithChildren<ListProps>) => {
111
110
  * children are different HTML elements.
112
111
  */
113
112
  const checkDescriptionChildrenError = () => {
114
- React.Children.map(children, function (child: React.ReactElement) {
113
+ React.Children.map(children as JSX.Element, (child: React.ReactElement) => {
115
114
  if (
116
115
  child.type !== "dt" &&
117
116
  child.type !== "dd" &&
@@ -128,34 +127,24 @@ export const List = chakra((props: React.PropsWithChildren<ListProps>) => {
128
127
  });
129
128
  };
130
129
 
131
- if (type === ListTypes.Ordered || type === ListTypes.Unordered) {
130
+ if (type === "ol" || type === "ul") {
132
131
  checkListChildrenError(type);
133
132
  listElement = (
134
133
  <Box
135
134
  as={type as As}
136
135
  id={id}
137
136
  className={className}
138
- __css={finalStyles}
137
+ __css={styles}
139
138
  {...rest}
140
139
  >
141
140
  {listChildrenElms(type)}
142
141
  </Box>
143
142
  );
144
- } else if (type === ListTypes.Description) {
143
+ } else if (type === "dl") {
145
144
  checkDescriptionChildrenError();
146
145
  listElement = (
147
- <Box
148
- as="section"
149
- id={id}
150
- className={className}
151
- __css={finalStyles}
152
- {...rest}
153
- >
154
- {title && (
155
- <Heading id={`${id}-heading`} level={HeadingLevels.Two}>
156
- {title}
157
- </Heading>
158
- )}
146
+ <Box as="section" id={id} className={className} __css={styles} {...rest}>
147
+ {title && <Heading id={`${id}-heading`}>{title}</Heading>}
159
148
  <dl>{listChildrenElms(type)}</dl>
160
149
  </Box>
161
150
  );
@@ -8,18 +8,11 @@ import {
8
8
  import { withDesign } from "storybook-addon-designs";
9
9
 
10
10
  import Logo from "./Logo";
11
- import { LogoNames, LogoSizes } from "./LogoTypes";
12
11
  import logoSvgs from "./LogoSvgs";
13
12
  import Heading from "../Heading/Heading";
14
- import { HeadingLevels } from "../Heading/HeadingTypes";
15
13
  import List from "../List/List";
16
- import { ListTypes } from "../List/ListTypes";
17
14
  import SimpleGrid from "../Grid/SimpleGrid";
18
15
  import { getCategory } from "../../utils/componentCategories";
19
- import { getStorybookEnumValues } from "../../utils/utils";
20
-
21
- export const namesEnumValues = getStorybookEnumValues(LogoNames, "LogoNames");
22
- export const sizesEnumValues = getStorybookEnumValues(LogoSizes, "LogoSizes");
23
16
 
24
17
  <Meta
25
18
  title={getCategory("Logo")}
@@ -36,14 +29,8 @@ export const sizesEnumValues = getStorybookEnumValues(LogoSizes, "LogoSizes");
36
29
  children: { table: { disable: true } },
37
30
  className: { control: false },
38
31
  id: { control: false },
39
- name: {
40
- control: { type: "select" },
41
- options: namesEnumValues.options,
42
- },
43
32
  size: {
44
- control: { type: "select" },
45
- table: { defaultValue: { summary: "LogoSizes.Medium" } },
46
- options: sizesEnumValues.options,
33
+ table: { defaultValue: { summary: "medium" } },
47
34
  },
48
35
  title: {
49
36
  control: false,
@@ -57,7 +44,7 @@ export const sizesEnumValues = getStorybookEnumValues(LogoSizes, "LogoSizes");
57
44
  | Component Version | DS Version |
58
45
  | ----------------- | ---------- |
59
46
  | Added | `0.25.9` |
60
- | Latest | `0.26.0` |
47
+ | Latest | `0.28.0` |
61
48
 
62
49
  ## Table of Contents
63
50
 
@@ -78,20 +65,19 @@ export const sizesEnumValues = getStorybookEnumValues(LogoSizes, "LogoSizes");
78
65
  <Story
79
66
  name="Logo with Controls"
80
67
  args={{
81
- additionalStyles: undefined,
82
68
  className: undefined,
83
69
  decorative: true,
84
70
  id: "logo-id",
85
- name: "LogoNames.NYPLBlack",
86
- size: "LogoSizes.Large",
71
+ name: "nyplFullBlack",
72
+ size: "large",
87
73
  title: undefined,
88
74
  }}
89
75
  >
90
76
  {(args) => (
91
77
  <div
92
78
  style={
93
- args.name.indexOf("White") !== -1 ||
94
- args.name.indexOf("Negative") !== -1
79
+ args.name.indexOf("white") !== -1 ||
80
+ args.name.indexOf("negative") !== -1
95
81
  ? {
96
82
  backgroundColor: "var(--nypl-colors-ui-gray-xdark)",
97
83
  display: "inline-block",
@@ -101,11 +87,7 @@ export const sizesEnumValues = getStorybookEnumValues(LogoSizes, "LogoSizes");
101
87
  : undefined
102
88
  }
103
89
  >
104
- <Logo
105
- name={namesEnumValues.getValue(args.name)}
106
- size={sizesEnumValues.getValue(args.size)}
107
- title={args.title}
108
- />
90
+ <Logo {...args} />
109
91
  </div>
110
92
  )}
111
93
  </Story>
@@ -117,7 +99,7 @@ export const logoRow = (logo, opts = {}) => {
117
99
  // We'll use this setup function to render all the logos in a list item.
118
100
  // Some logos display better with a dark background.
119
101
  const styles = { textAlign: "center" };
120
- const { size = LogoSizes.Large, displayValue } = opts;
102
+ const { size = "large", displayValue } = opts;
121
103
  let key = logo;
122
104
  if (logo.indexOf("White") !== -1 || logo.indexOf("Negative") !== -1) {
123
105
  styles.backgroundColor = "var(--nypl-colors-ui-gray-xdark)";
@@ -125,26 +107,77 @@ export const logoRow = (logo, opts = {}) => {
125
107
  styles.paddingBottom = "var(--nypl-space-l)";
126
108
  styles.paddingTop = "var(--nypl-space-l)";
127
109
  }
128
- if (size !== LogoSizes.Large) {
110
+ if (size !== "large") {
129
111
  key += `-${size}`;
130
112
  }
131
113
  return (
132
114
  <div style={styles} key={key}>
133
- <Heading level={HeadingLevels.Four}>{displayValue}</Heading>
134
- <Logo name={LogoNames[logo]} size={size} />
115
+ <Heading level="four">{displayValue}</Heading>
116
+ <Logo name={logo} size={size} />
135
117
  </div>
136
118
  );
137
119
  };
138
120
  export const logos = [];
139
121
  export const sizes = [];
140
- for (const logo in LogoNames) {
141
- logos.push(logoRow(logo, { displayValue: `LogoNames.${logo}` }));
122
+ export const logoNameValues = [
123
+ "bplBlack",
124
+ "bplWhite",
125
+ "cleverColor",
126
+ "cleverWhite",
127
+ "firstbookColor",
128
+ "firstbookColorNegative",
129
+ "lpaColor",
130
+ "lpaBlack",
131
+ "lpaWhite",
132
+ "mlnBlack",
133
+ "mlnWhite",
134
+ "nyplFullBlack",
135
+ "nyplFullWhite",
136
+ "nyplLionBlack",
137
+ "nyplLionWhite",
138
+ "openebooksColor",
139
+ "openebooksNegative",
140
+ "openebooksWithTextColor",
141
+ "openebooksWithTextNegative",
142
+ "qplColor",
143
+ "qplBlack",
144
+ "qplWhite",
145
+ "qplAltBlack",
146
+ "qplAltWhite",
147
+ "reservoirIconColor",
148
+ "reservoirVerticalColor",
149
+ "schomburgColor",
150
+ "schomburgBlack",
151
+ "schomburgWhite",
152
+ "schomburgCircleColor",
153
+ "schomburgCircleBlack",
154
+ "schomburgCircleWhite",
155
+ "simplyeColor",
156
+ "simplyeBlack",
157
+ "simplyeWhite",
158
+ "snflBlack",
159
+ "snflWhite",
160
+ "treasuresColor",
161
+ "treasuresColorNegative",
162
+ ];
163
+ export const logoSizeValues = [
164
+ "default",
165
+ "xxsmall",
166
+ "xsmall",
167
+ "small",
168
+ "medium",
169
+ "large",
170
+ ];
171
+ for (const logo in logoNameValues) {
172
+ logos.push(
173
+ logoRow(logoNameValues[logo], { displayValue: logoNameValues[logo] })
174
+ );
142
175
  }
143
- for (const logoSize in LogoSizes) {
176
+ for (const logoSize in logoSizeValues) {
144
177
  sizes.push(
145
- logoRow("NYPLBlack", {
146
- displayValue: `LogoSizes.${logoSize}`,
147
- size: LogoSizes[logoSize],
178
+ logoRow("nyplFullBlack", {
179
+ displayValue: logoSizeValues[logoSize],
180
+ size: logoSizeValues[logoSize],
148
181
  })
149
182
  );
150
183
  }
@@ -155,11 +188,11 @@ export const allLogosGrid = (list) => (
155
188
 
156
189
  ## Accessibility
157
190
 
158
- For accessibility purposes, every Reservoir Design System (DS) `Logo` will
159
- render the `svg` element with its `svg` file name in the `title` element. The
160
- default text in the `title` element is the logo's code name. Pass in better
161
- descriptive text in the `title` prop when using the `Logo` component in your
162
- application. This will give screenreaders a better descriptive title for the
191
+ For accessibility purposes, every Reservoir Design System (DS) `Logo` will
192
+ render the `svg` element with its `svg` file name in the `title` element. The
193
+ default text in the `title` element is the logo's code name. Pass in better
194
+ descriptive text in the `title` prop when using the `Logo` component in your
195
+ application. This will give screenreaders a better descriptive title for the
163
196
  `svg` graphic.
164
197
 
165
198
  `Logos`s are decorative by default. This means that they are presentational and
@@ -174,15 +207,16 @@ Resources:
174
207
 
175
208
  ## Logo Sizes
176
209
 
177
- Update the size of the `Logo` component by passing the `size` prop with a value from
178
- `LogoSizes`. The `LogoSizes` enum can be found in`src/components/Logo/LogoTypes.tsx`.
210
+ Update the size of the `Logo` component by passing the `size` prop with a value
211
+ from the `LogoSizes` type. The values are `"default"`, `"xxsmall"`, `"xsmall"`,
212
+ `"small"`, `"medium"`, and `"large"`.
179
213
 
180
- Note: `LogoSizes.Default` sets the width to `100%` and the rendered logo will expand to
214
+ Note: `"default"` sets the width to `100%` and the rendered logo will expand to
181
215
  fill the full width of the parent element.
182
216
 
183
217
  ```jsx
184
218
  // Example
185
- <Logo name={LogoNames.NYPLBlack} size={LogoSizes.Large} />
219
+ <Logo name="nyplFullBlack" size="large" />
186
220
  ```
187
221
 
188
222
  <Canvas>
@@ -191,11 +225,21 @@ fill the full width of the parent element.
191
225
 
192
226
  ## All Logos
193
227
 
194
- The `Logo` component contains the logos most commonly used by are listed available
195
- logos are listed in the `LogoNames` enum in `src/components/Logos/LogoTypes.tsx`.
196
-
197
- If you feel a necessary logo should be added to the `Logo` component, please reach out
198
- to the DS team.
228
+ Update the icon of the `Logo` component by passing the `name` prop with a value
229
+ from the `LogoNames` type. The values are `"bplBlack"`, `"bplWhite"`,
230
+ `"cleverColor"`, `"cleverWhite"`, `"firstbookColor"`, `"firstbookColorNegative"`,
231
+ `"lpaBlack"`, `"lpaColor"`, `"lpaWhite"`, `"mlnBlack"`, `"mlnWhite"`,
232
+ `"nyplFullBlack"`, `"nyplFullWhite"`, `"nyplLionBlack"`, `"nyplLionWhite"`,
233
+ `"openebooksColor"`, `"openebooksNegative"`, `"openebooksWithTextColor"`,
234
+ `"openebooksWithTextNegative"`, `"qplAltBlack"`, `"qplAltWhite"`, `"qplBlack"`,
235
+ `"qplColor"`, `"qplWhite"`, `"reservoirIconColor"`, `"reservoirVerticalColor"`,
236
+ `"schomburgBlack"`, `"schomburgCircleBlack"`, `"schomburgCircleColor"`,
237
+ `"schomburgCircleWhite"`, `"schomburgColor"`, `"schomburgWhite"`, `"simplyeBlack"`,
238
+ `"simplyeWhite"`, `"simplyeColor"`, `"snflBlack"`, `"snflWhite"`, `"treasuresColor"`,
239
+ `"treasuresColorNegative"`.
240
+
241
+ If you feel a necessary logo should be added to the `Logo` component, please
242
+ reach out to the DS team.
199
243
 
200
244
  <Canvas withToolbar>
201
245
  <Story name="All Logos">{allLogosGrid(logos)}</Story>
@@ -225,7 +269,7 @@ child to the `Logo` component.
225
269
  <Story
226
270
  name="Custom Logos"
227
271
  args={{
228
- size: LogoSizes.Large,
272
+ size: "large",
229
273
  }}
230
274
  >
231
275
  {(args) => (
@@ -4,11 +4,10 @@ import { axe } from "jest-axe";
4
4
  import renderer from "react-test-renderer";
5
5
 
6
6
  import Logo from "./Logo";
7
- import { LogoNames, LogoSizes } from "./LogoTypes";
8
7
 
9
8
  describe("Logo Accessibility", () => {
10
9
  it("passes axe accessibility test", async () => {
11
- const { container } = render(<Logo name={LogoNames.NYPLBlack} />);
10
+ const { container } = render(<Logo name="nyplFullBlack" />);
12
11
  expect(await axe(container)).toHaveNoViolations();
13
12
  });
14
13
  });
@@ -17,7 +16,7 @@ describe("Logo", () => {
17
16
  it("consoles a warning if both name and children are passed to Logo", () => {
18
17
  const warn = jest.spyOn(console, "warn");
19
18
  render(
20
- <Logo name={LogoNames.NYPLBlack}>
19
+ <Logo name="nyplFullBlack">
21
20
  <svg viewBox="0 0 24 14" xmlns="http://www.w3.org/2000/svg">
22
21
  <path
23
22
  fillRule="evenodd"
@@ -51,7 +50,7 @@ describe("Logo", () => {
51
50
  });
52
51
 
53
52
  it("renders a logo based on the logo `name` prop", () => {
54
- const { container } = render(<Logo name={LogoNames.NYPLBlack} />);
53
+ const { container } = render(<Logo name="nyplFullBlack" />);
55
54
  expect(container.querySelector("svg")).toBeInTheDocument();
56
55
  });
57
56
 
@@ -60,13 +59,13 @@ describe("Logo", () => {
60
59
  // In order to test this, we can check the `title` attribute in the svg
61
60
  // element itself. Inspect the `Logo` in Storybook to see the `title` element.
62
61
  it("renders a title element", () => {
63
- const { container, rerender } = render(<Logo name={LogoNames.NYPLBlack} />);
62
+ const { container, rerender } = render(<Logo name="nyplFullBlack" />);
64
63
  expect(container.querySelector("svg")).toHaveAttribute(
65
64
  "title",
66
- "logo_nypl_full_black logo"
65
+ "nyplFullBlack logo"
67
66
  );
68
67
 
69
- rerender(<Logo name={LogoNames.NYPLBlack} title="title content" />);
68
+ rerender(<Logo name="nyplFullBlack" title="title content" />);
70
69
  expect(container.querySelector("svg")).toHaveAttribute(
71
70
  "title",
72
71
  "title content"
@@ -90,31 +89,23 @@ describe("Logo", () => {
90
89
 
91
90
  it("renders the UI snapshot correctly", () => {
92
91
  const standard = renderer
93
- .create(<Logo id="test-logo" name={LogoNames.NYPLBlack} />)
92
+ .create(<Logo id="test-logo" name="nyplFullBlack" />)
94
93
  .toJSON();
95
94
  const withCustomSize = renderer
96
- .create(
97
- <Logo
98
- id="test-logo-size"
99
- name={LogoNames.NYPLBlack}
100
- size={LogoSizes.Large}
101
- />
102
- )
95
+ .create(<Logo id="test-logo-size" name="nyplFullBlack" size="large" />)
103
96
  .toJSON();
104
97
  const withChakraProps = renderer
105
98
  .create(
106
99
  <Logo
107
100
  id="chakra"
108
- name={LogoNames.NYPLBlack}
101
+ name="nyplFullBlack"
109
102
  p="20px"
110
103
  color="ui.error.primary"
111
104
  />
112
105
  )
113
106
  .toJSON();
114
107
  const withOtherProps = renderer
115
- .create(
116
- <Logo id="props" name={LogoNames.NYPLBlack} data-testid="props" />
117
- )
108
+ .create(<Logo id="props" name="nyplFullBlack" data-testid="props" />)
118
109
  .toJSON();
119
110
 
120
111
  expect(standard).toMatchSnapshot();
@@ -6,12 +6,56 @@ import {
6
6
  } from "@chakra-ui/react";
7
7
  import * as React from "react";
8
8
 
9
- import { LogoNames, LogoSizes } from "./LogoTypes";
10
9
  import logoSvgs from "./LogoSvgs";
11
10
 
11
+ export type LogoNames =
12
+ | "bplBlack"
13
+ | "bplWhite"
14
+ | "cleverColor"
15
+ | "cleverWhite"
16
+ | "firstbookColor"
17
+ | "firstbookColorNegative"
18
+ | "lpaBlack"
19
+ | "lpaColor"
20
+ | "lpaWhite"
21
+ | "mlnBlack"
22
+ | "mlnWhite"
23
+ | "nyplFullBlack"
24
+ | "nyplFullWhite"
25
+ | "nyplLionBlack"
26
+ | "nyplLionWhite"
27
+ | "openebooksColor"
28
+ | "openebooksNegative"
29
+ | "openebooksWithTextColor"
30
+ | "openebooksWithTextNegative"
31
+ | "qplAltBlack"
32
+ | "qplAltWhite"
33
+ | "qplBlack"
34
+ | "qplColor"
35
+ | "qplWhite"
36
+ | "reservoirIconColor"
37
+ | "reservoirVerticalColor"
38
+ | "schomburgBlack"
39
+ | "schomburgCircleBlack"
40
+ | "schomburgCircleColor"
41
+ | "schomburgCircleWhite"
42
+ | "schomburgColor"
43
+ | "schomburgWhite"
44
+ | "simplyeBlack"
45
+ | "simplyeWhite"
46
+ | "simplyeColor"
47
+ | "snflBlack"
48
+ | "snflWhite"
49
+ | "treasuresColor"
50
+ | "treasuresColorNegative";
51
+ export type LogoSizes =
52
+ | "default"
53
+ | "xxsmall"
54
+ | "xsmall"
55
+ | "small"
56
+ | "medium"
57
+ | "large";
12
58
  export interface LogoProps {
13
- /** Optionally pass in additional Chakra-based styles. */
14
- additionalStyles?: { [key: string]: any };
15
59
  /** Optional className that will be added to the parent element */
16
60
  className?: string;
17
61
  /** Logos designated as decorative will be ignored by screenreaders. False
@@ -35,13 +79,12 @@ export interface LogoProps {
35
79
  */
36
80
  export const Logo = chakra((props: React.PropsWithChildren<LogoProps>) => {
37
81
  const {
38
- additionalStyles = {},
39
82
  children,
40
83
  className,
41
84
  decorative = false,
42
85
  id,
43
86
  name,
44
- size = LogoSizes.Medium,
87
+ size = "medium",
45
88
  title = `${name} logo`,
46
89
  ...rest
47
90
  } = props;
@@ -78,13 +121,7 @@ export const Logo = chakra((props: React.PropsWithChildren<LogoProps>) => {
78
121
  // render the SVG child with NYPL-theme styling.
79
122
  if (name) {
80
123
  const SvgComponent: any = logoSvgs[name];
81
- return (
82
- <ChakraIcon
83
- as={SvgComponent}
84
- {...logoProps}
85
- __css={{ ...styles, ...additionalStyles }}
86
- />
87
- );
124
+ return <ChakraIcon as={SvgComponent} {...logoProps} __css={styles} />;
88
125
  }
89
126
 
90
127
  // If no `name` prop was passed, we expect a child SVG element to be passed.
@@ -104,11 +141,7 @@ export const Logo = chakra((props: React.PropsWithChildren<LogoProps>) => {
104
141
  );
105
142
  }
106
143
 
107
- return (
108
- <Box __css={styles} {...rest}>
109
- {childSVG}
110
- </Box>
111
- );
144
+ return <Box __css={styles}>{childSVG}</Box>;
112
145
  });
113
146
 
114
147
  export default Logo;