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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (298) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/components/Accordion/Accordion.d.ts +1 -1
  3. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +1 -5
  4. package/dist/components/Button/Button.d.ts +2 -10
  5. package/dist/components/ButtonGroup/ButtonGroup.d.ts +22 -0
  6. package/dist/components/Card/Card.d.ts +2 -2
  7. package/dist/components/Checkbox/Checkbox.d.ts +10 -8
  8. package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +1 -1
  9. package/dist/components/DatePicker/DatePicker.d.ts +1 -1
  10. package/dist/components/Form/Form.d.ts +2 -2
  11. package/dist/components/Grid/SimpleGrid.d.ts +6 -3
  12. package/dist/components/Heading/Heading.d.ts +2 -5
  13. package/dist/components/HelperErrorText/HelperErrorText.d.ts +1 -5
  14. package/dist/components/Hero/Hero.d.ts +13 -9
  15. package/dist/components/Icons/Icon.d.ts +6 -5
  16. package/dist/components/Icons/IconSvgs.d.ts +21 -21
  17. package/dist/components/Image/Image.d.ts +8 -5
  18. package/dist/components/Link/Link.d.ts +1 -9
  19. package/dist/components/List/List.d.ts +7 -11
  20. package/dist/components/Logo/Logo.d.ts +2 -5
  21. package/dist/components/Logo/LogoSvgs.d.ts +39 -39
  22. package/dist/components/Notification/Notification.d.ts +1 -1
  23. package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +2 -1
  24. package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
  25. package/dist/components/SearchBar/SearchBar.d.ts +3 -2
  26. package/dist/components/Select/Select.d.ts +2 -5
  27. package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +4 -4
  28. package/dist/components/SkipNavigation/SkipNavigation.d.ts +17 -0
  29. package/dist/components/StatusBadge/StatusBadge.d.ts +2 -3
  30. package/dist/components/StructuredContent/StructuredContent.d.ts +2 -2
  31. package/dist/components/Table/Table.d.ts +1 -1
  32. package/dist/components/Template/Template.d.ts +2 -0
  33. package/dist/components/Text/Text.d.ts +1 -1
  34. package/dist/components/TextInput/TextInput.d.ts +21 -9
  35. package/dist/components/Toggle/Toggle.d.ts +1 -5
  36. package/dist/components/VideoPlayer/VideoPlayer.d.ts +2 -1
  37. package/dist/design-system-react-components.cjs.development.js +856 -1155
  38. package/dist/design-system-react-components.cjs.development.js.map +1 -1
  39. package/dist/design-system-react-components.cjs.production.min.js +1 -1
  40. package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
  41. package/dist/design-system-react-components.esm.js +858 -1220
  42. package/dist/design-system-react-components.esm.js.map +1 -1
  43. package/dist/helpers/types.d.ts +1 -0
  44. package/dist/index.d.ts +26 -47
  45. package/dist/theme/components/buttonGroup.d.ts +11 -0
  46. package/dist/theme/components/card.d.ts +104 -8
  47. package/dist/theme/components/componentWrapper.d.ts +4 -3
  48. package/dist/theme/components/customTable.d.ts +11 -14
  49. package/dist/theme/components/fieldset.d.ts +4 -3
  50. package/dist/theme/components/helperErrorText.d.ts +4 -3
  51. package/dist/theme/components/hero.d.ts +1 -1
  52. package/dist/theme/components/horizontalRule.d.ts +4 -3
  53. package/dist/theme/components/icon.d.ts +47743 -1
  54. package/dist/theme/components/image.d.ts +563 -10
  55. package/dist/theme/components/label.d.ts +4 -3
  56. package/dist/theme/components/list.d.ts +6 -7
  57. package/dist/theme/components/logo.d.ts +474 -1
  58. package/dist/theme/components/notification.d.ts +20 -16
  59. package/dist/theme/components/progressIndicator.d.ts +6 -4
  60. package/dist/theme/components/select.d.ts +4 -4
  61. package/dist/theme/components/skeletonLoader.d.ts +14 -10
  62. package/dist/theme/components/skipNavigation.d.ts +22 -0
  63. package/dist/theme/components/slider.d.ts +7 -6
  64. package/dist/theme/components/structuredContent.d.ts +10 -9
  65. package/dist/theme/components/text.d.ts +7 -1
  66. package/dist/theme/components/toggle.d.ts +6 -4
  67. package/dist/theme/provider.d.ts +2 -4
  68. package/dist/utils/componentCategories.d.ts +1 -1
  69. package/dist/utils/interfaces.d.ts +5 -0
  70. package/dist/utils/utils.d.ts +2 -18
  71. package/package.json +2 -2
  72. package/src/__tests__/setup.ts +3 -3
  73. package/src/__tests__/utils/utils.test.ts +1 -23
  74. package/src/components/AccessibilityGuide/SkipNavigation.stories.mdx +22 -14
  75. package/src/components/Accordion/Accordion.stories.mdx +43 -44
  76. package/src/components/Accordion/Accordion.test.tsx +5 -13
  77. package/src/components/Accordion/Accordion.tsx +14 -18
  78. package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +6 -6
  79. package/src/components/Autosuggest/Autosuggest.stories.mdx +1 -1
  80. package/src/components/Autosuggest/Autosuggest.stories.tsx +23 -25
  81. package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +21 -37
  82. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +4 -17
  83. package/src/components/Breadcrumbs/Breadcrumbs.tsx +18 -21
  84. package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +1 -100
  85. package/src/components/Button/Button.stories.mdx +89 -126
  86. package/src/components/Button/Button.test.tsx +16 -30
  87. package/src/components/Button/Button.tsx +14 -20
  88. package/src/components/ButtonGroup/ButtonGroup.stories.mdx +147 -0
  89. package/src/components/ButtonGroup/ButtonGroup.test.tsx +141 -0
  90. package/src/components/ButtonGroup/ButtonGroup.tsx +99 -0
  91. package/src/components/ButtonGroup/__snapshots__/ButtonGroup.test.tsx.snap +117 -0
  92. package/src/components/Card/Card.stories.mdx +143 -177
  93. package/src/components/Card/Card.test.tsx +36 -97
  94. package/src/components/Card/Card.tsx +78 -74
  95. package/src/components/Chakra/Box.stories.mdx +2 -6
  96. package/src/components/Chakra/Center.stories.mdx +5 -23
  97. package/src/components/Chakra/Flex.stories.mdx +4 -6
  98. package/src/components/Chakra/Stack.stories.mdx +9 -10
  99. package/src/components/Checkbox/Checkbox.stories.mdx +1 -1
  100. package/src/components/Checkbox/Checkbox.test.tsx +2 -2
  101. package/src/components/Checkbox/Checkbox.tsx +20 -13
  102. package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +6 -17
  103. package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +1 -7
  104. package/src/components/CheckboxGroup/CheckboxGroup.tsx +33 -29
  105. package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +0 -11
  106. package/src/components/ComponentWrapper/ComponentWrapper.tsx +3 -10
  107. package/src/components/DatePicker/DatePicker.stories.mdx +23 -37
  108. package/src/components/DatePicker/DatePicker.test.tsx +21 -19
  109. package/src/components/DatePicker/DatePicker.tsx +57 -49
  110. package/src/components/Form/Form.stories.mdx +46 -31
  111. package/src/components/Form/Form.test.tsx +1 -18
  112. package/src/components/Form/Form.tsx +7 -7
  113. package/src/components/Grid/SimpleGrid.stories.mdx +73 -49
  114. package/src/components/Grid/SimpleGrid.test.tsx +7 -9
  115. package/src/components/Grid/SimpleGrid.tsx +14 -11
  116. package/src/components/Heading/Heading.stories.mdx +27 -72
  117. package/src/components/Heading/Heading.test.tsx +18 -44
  118. package/src/components/Heading/Heading.tsx +7 -10
  119. package/src/components/HelperErrorText/HelperErrorText.stories.mdx +1 -3
  120. package/src/components/HelperErrorText/HelperErrorText.tsx +1 -5
  121. package/src/components/Hero/Hero.stories.mdx +219 -216
  122. package/src/components/Hero/Hero.test.tsx +107 -223
  123. package/src/components/Hero/Hero.tsx +63 -61
  124. package/src/components/Icons/Icon.stories.mdx +172 -118
  125. package/src/components/Icons/Icon.test.tsx +8 -16
  126. package/src/components/Icons/Icon.tsx +75 -29
  127. package/src/components/Icons/IconSvgs.tsx +42 -42
  128. package/src/components/Image/Image.stories.mdx +45 -132
  129. package/src/components/Image/Image.test.tsx +16 -31
  130. package/src/components/Image/Image.tsx +28 -12
  131. package/src/components/Link/Link.stories.mdx +30 -80
  132. package/src/components/Link/Link.test.tsx +25 -53
  133. package/src/components/Link/Link.tsx +43 -56
  134. package/src/components/Link/__snapshots__/Link.test.tsx.snap +1 -2
  135. package/src/components/List/List.stories.mdx +20 -31
  136. package/src/components/List/List.test.tsx +24 -43
  137. package/src/components/List/List.tsx +25 -36
  138. package/src/components/Logo/Logo.stories.mdx +94 -50
  139. package/src/components/Logo/Logo.test.tsx +10 -19
  140. package/src/components/Logo/Logo.tsx +50 -17
  141. package/src/components/Logo/LogoSvgs.tsx +78 -78
  142. package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +4 -4
  143. package/src/components/Modal/Modal.stories.mdx +8 -9
  144. package/src/components/Modal/Modal.test.tsx +5 -10
  145. package/src/components/Modal/Modal.tsx +1 -1
  146. package/src/components/Notification/Notification.stories.mdx +10 -28
  147. package/src/components/Notification/Notification.test.tsx +9 -12
  148. package/src/components/Notification/Notification.tsx +34 -37
  149. package/src/components/Pagination/Pagination.stories.mdx +2 -2
  150. package/src/components/Pagination/Pagination.tsx +15 -10
  151. package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +27 -53
  152. package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +9 -10
  153. package/src/components/ProgressIndicator/ProgressIndicator.tsx +17 -21
  154. package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +0 -10
  155. package/src/components/Radio/Radio.stories.mdx +1 -1
  156. package/src/components/Radio/Radio.tsx +9 -6
  157. package/src/components/RadioGroup/RadioGroup.stories.mdx +15 -16
  158. package/src/components/RadioGroup/RadioGroup.test.tsx +2 -8
  159. package/src/components/RadioGroup/RadioGroup.tsx +28 -24
  160. package/src/components/SearchBar/SearchBar.stories.mdx +1 -1
  161. package/src/components/SearchBar/SearchBar.test.tsx +1 -1
  162. package/src/components/SearchBar/SearchBar.tsx +14 -22
  163. package/src/components/SearchBar/__snapshots__/SearchBar.test.tsx.snap +0 -12
  164. package/src/components/Select/Select.stories.mdx +8 -23
  165. package/src/components/Select/Select.test.tsx +6 -7
  166. package/src/components/Select/Select.tsx +13 -26
  167. package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +17 -56
  168. package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +7 -21
  169. package/src/components/SkeletonLoader/SkeletonLoader.tsx +9 -8
  170. package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +33 -33
  171. package/src/components/SkipNavigation/SkipNavigation.stories.mdx +90 -0
  172. package/src/components/SkipNavigation/SkipNavigation.test.tsx +63 -0
  173. package/src/components/SkipNavigation/SkipNavigation.tsx +51 -0
  174. package/src/components/SkipNavigation/__snapshots__/SkipNavigation.test.tsx.snap +130 -0
  175. package/src/components/Slider/Slider.stories.mdx +19 -53
  176. package/src/components/Slider/Slider.test.tsx +2 -2
  177. package/src/components/Slider/Slider.tsx +10 -12
  178. package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +2 -9
  179. package/src/components/StatusBadge/StatusBadge.stories.mdx +6 -21
  180. package/src/components/StatusBadge/StatusBadge.test.tsx +2 -3
  181. package/src/components/StatusBadge/StatusBadge.tsx +3 -10
  182. package/src/components/StructuredContent/StructuredContent.stories.mdx +30 -58
  183. package/src/components/StructuredContent/StructuredContent.test.tsx +42 -44
  184. package/src/components/StructuredContent/StructuredContent.tsx +9 -18
  185. package/src/components/StyleGuide/Bidirectionality.stories.mdx +9 -23
  186. package/src/components/StyleGuide/Buttons.stories.mdx +62 -62
  187. package/src/components/StyleGuide/ColorCard.tsx +2 -4
  188. package/src/components/StyleGuide/Colors.stories.mdx +7 -8
  189. package/src/components/StyleGuide/DesignTokens.stories.mdx +5 -7
  190. package/src/components/StyleGuide/Forms.stories.mdx +0 -1
  191. package/src/components/StyleGuide/Iconography.stories.mdx +59 -77
  192. package/src/components/StyleGuide/Spacing.stories.mdx +0 -1
  193. package/src/components/StyleGuide/Typography.stories.mdx +15 -18
  194. package/src/components/Table/Table.stories.mdx +85 -1
  195. package/src/components/Table/Table.test.tsx +57 -1
  196. package/src/components/Table/Table.tsx +7 -4
  197. package/src/components/Table/__snapshots__/Table.test.tsx.snap +121 -0
  198. package/src/components/Tabs/Tabs.stories.mdx +1 -1
  199. package/src/components/Tabs/Tabs.test.tsx +2 -2
  200. package/src/components/Tabs/Tabs.tsx +26 -27
  201. package/src/components/Template/Template.stories.mdx +49 -54
  202. package/src/components/Template/Template.tsx +9 -3
  203. package/src/components/Text/Text.stories.mdx +5 -11
  204. package/src/components/Text/Text.test.tsx +3 -6
  205. package/src/components/Text/Text.tsx +3 -5
  206. package/src/components/TextInput/TextInput.stories.mdx +10 -22
  207. package/src/components/TextInput/TextInput.test.tsx +32 -62
  208. package/src/components/TextInput/TextInput.tsx +61 -30
  209. package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +1 -0
  210. package/src/components/Toggle/Toggle.stories.mdx +5 -16
  211. package/src/components/Toggle/Toggle.test.tsx +2 -3
  212. package/src/components/Toggle/Toggle.tsx +9 -10
  213. package/src/components/VideoPlayer/VideoPlayer.stories.mdx +13 -29
  214. package/src/components/VideoPlayer/VideoPlayer.test.tsx +18 -23
  215. package/src/components/VideoPlayer/VideoPlayer.tsx +13 -10
  216. package/src/docs/Chakra.stories.mdx +14 -11
  217. package/src/docs/Welcome.stories.mdx +23 -43
  218. package/src/helpers/types.ts +1 -0
  219. package/src/hooks/tests/useNYPLTheme.test.tsx +1 -1
  220. package/src/hooks/useNYPLTheme.stories.mdx +3 -6
  221. package/src/index.ts +51 -45
  222. package/src/theme/components/buttonGroup.ts +10 -0
  223. package/src/theme/components/card.ts +50 -15
  224. package/src/theme/components/componentWrapper.ts +5 -1
  225. package/src/theme/components/customTable.ts +8 -2
  226. package/src/theme/components/fieldset.ts +5 -1
  227. package/src/theme/components/helperErrorText.ts +5 -1
  228. package/src/theme/components/hero.ts +2 -2
  229. package/src/theme/components/horizontalRule.ts +5 -1
  230. package/src/theme/components/icon.ts +7 -1
  231. package/src/theme/components/image.ts +14 -3
  232. package/src/theme/components/label.ts +5 -1
  233. package/src/theme/components/list.ts +8 -2
  234. package/src/theme/components/logo.ts +5 -1
  235. package/src/theme/components/notification.ts +38 -14
  236. package/src/theme/components/progressIndicator.ts +10 -5
  237. package/src/theme/components/select.ts +5 -2
  238. package/src/theme/components/skeletonLoader.ts +8 -2
  239. package/src/theme/components/skipNavigation.ts +26 -0
  240. package/src/theme/components/slider.ts +13 -1
  241. package/src/theme/components/structuredContent.ts +11 -1
  242. package/src/theme/components/text.ts +12 -5
  243. package/src/theme/components/toggle.ts +9 -3
  244. package/src/theme/index.ts +4 -0
  245. package/src/theme/provider.tsx +1 -1
  246. package/src/utils/componentCategories.ts +13 -5
  247. package/src/utils/interfaces.ts +5 -0
  248. package/src/utils/utils.ts +2 -32
  249. package/dist/components/Accordion/AccordionTypes.d.ts +0 -5
  250. package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +0 -8
  251. package/dist/components/Button/ButtonTypes.d.ts +0 -8
  252. package/dist/components/DatePicker/DatePickerTypes.d.ts +0 -5
  253. package/dist/components/Form/FormTypes.d.ts +0 -2
  254. package/dist/components/Grid/GridTypes.d.ts +0 -9
  255. package/dist/components/Heading/HeadingTypes.d.ts +0 -14
  256. package/dist/components/Hero/HeroTypes.d.ts +0 -12
  257. package/dist/components/Icons/IconTypes.d.ts +0 -77
  258. package/dist/components/Image/ImageTypes.d.ts +0 -22
  259. package/dist/components/Link/LinkTypes.d.ts +0 -8
  260. package/dist/components/List/ListTypes.d.ts +0 -5
  261. package/dist/components/Logo/LogoTypes.d.ts +0 -54
  262. package/dist/components/Notification/NotificationTypes.d.ts +0 -5
  263. package/dist/components/ProgressIndicator/ProgressIndicatorTypes.d.ts +0 -8
  264. package/dist/components/Select/SelectTypes.d.ts +0 -8
  265. package/dist/components/SkeletonLoader/SkeletonLoaderTypes.d.ts +0 -5
  266. package/dist/components/StatusBadge/StatusBadgeTypes.d.ts +0 -5
  267. package/dist/components/StructuredContent/StructuredContentTypes.d.ts +0 -5
  268. package/dist/components/Text/TextTypes.d.ts +0 -6
  269. package/dist/components/TextInput/TextInputTypes.d.ts +0 -25
  270. package/dist/components/Toggle/ToggleTypes.d.ts +0 -4
  271. package/dist/components/VideoPlayer/VideoPlayerTypes.d.ts +0 -9
  272. package/dist/helpers/enums.d.ts +0 -4
  273. package/dist/utils/siteSections.d.ts +0 -2
  274. package/src/components/Accordion/AccordionTypes.tsx +0 -5
  275. package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +0 -8
  276. package/src/components/Button/ButtonTypes.tsx +0 -8
  277. package/src/components/DatePicker/DatePickerTypes.tsx +0 -5
  278. package/src/components/Form/FormTypes.tsx +0 -3
  279. package/src/components/Grid/GridTypes.tsx +0 -9
  280. package/src/components/Heading/HeadingTypes.tsx +0 -15
  281. package/src/components/Hero/HeroTypes.tsx +0 -20
  282. package/src/components/Icons/IconTypes.tsx +0 -83
  283. package/src/components/Image/ImageTypes.ts +0 -24
  284. package/src/components/Link/LinkTypes.tsx +0 -8
  285. package/src/components/List/ListTypes.tsx +0 -5
  286. package/src/components/Logo/LogoTypes.tsx +0 -56
  287. package/src/components/Notification/NotificationTypes.tsx +0 -5
  288. package/src/components/ProgressIndicator/ProgressIndicatorTypes.ts +0 -8
  289. package/src/components/Select/SelectTypes.tsx +0 -10
  290. package/src/components/SkeletonLoader/SkeletonLoaderTypes.tsx +0 -5
  291. package/src/components/StatusBadge/StatusBadgeTypes.tsx +0 -5
  292. package/src/components/StructuredContent/StructuredContentTypes.tsx +0 -5
  293. package/src/components/Text/TextTypes.tsx +0 -6
  294. package/src/components/TextInput/TextInputTypes.tsx +0 -48
  295. package/src/components/Toggle/ToggleTypes.tsx +0 -4
  296. package/src/components/VideoPlayer/VideoPlayerTypes.tsx +0 -10
  297. package/src/helpers/enums.ts +0 -4
  298. package/src/utils/siteSections.ts +0 -10
@@ -1,19 +1,16 @@
1
1
  import { Box, chakra, useStyleConfig } from "@chakra-ui/react";
2
2
  import * as React from "react";
3
3
 
4
- import { LinkTypes } from "./LinkTypes";
5
4
  import Icon from "../Icons/Icon";
6
- import {
7
- IconRotationTypes,
8
- IconNames,
9
- IconAlign,
10
- IconSizes,
11
- } from "../Icons/IconTypes";
5
+
6
+ export type LinkTypes =
7
+ | "action"
8
+ | "backwards"
9
+ | "button"
10
+ | "default"
11
+ | "external"
12
+ | "forwards";
12
13
  export interface LinkProps {
13
- /** Optionally pass in additional Chakra-based styles. */
14
- additionalStyles?: { [key: string]: any };
15
- /** Additional attributes, such as `rel=nofollow`, to pass to the `<a>` tag. */
16
- attributes?: { [key: string]: any };
17
14
  /** Any child node passed to the component. */
18
15
  children: React.ReactNode;
19
16
  /** Additional class name to render in the `Link` component. */
@@ -28,21 +25,25 @@ export interface LinkProps {
28
25
 
29
26
  /**
30
27
  * Renders the `Link` children components with a direction arrow icon based
31
- * on the `Backwards` or `Forwards` `LinkTypes` type.
28
+ * on the `"backwards"` or `"forwards"` `linkType` value.
32
29
  */
33
- function getWithDirectionIcon(children, type: LinkTypes, linkId) {
30
+ function getWithDirectionIcon(
31
+ children: JSX.Element,
32
+ type: LinkTypes,
33
+ linkId: string
34
+ ) {
34
35
  let iconRotation;
35
36
  let iconAlign;
36
37
  let icon = null;
37
38
 
38
39
  // An icon needs a position in order for it to be created and
39
40
  // rendered in the link.
40
- if (type === LinkTypes.Backwards) {
41
- iconRotation = IconRotationTypes.Rotate90;
42
- iconAlign = IconAlign.Left;
43
- } else if (type === LinkTypes.Forwards) {
44
- iconRotation = IconRotationTypes.Rotate270;
45
- iconAlign = IconAlign.Right;
41
+ if (type === "backwards") {
42
+ iconRotation = "rotate90";
43
+ iconAlign = "left";
44
+ } else if (type === "forwards") {
45
+ iconRotation = "rotate270";
46
+ iconAlign = "right";
46
47
  }
47
48
 
48
49
  const iconId = `${linkId}-icon`;
@@ -53,29 +54,29 @@ function getWithDirectionIcon(children, type: LinkTypes, linkId) {
53
54
  className="more-link"
54
55
  iconRotation={iconRotation}
55
56
  id={iconId}
56
- name={IconNames.Arrow}
57
- size={IconSizes.Medium}
57
+ name="arrow"
58
+ size="medium"
58
59
  />
59
60
  );
60
61
 
61
62
  return (
62
63
  <>
63
- {type === LinkTypes.Backwards && icon}
64
+ {type === "backwards" && icon}
64
65
  {children}
65
- {type === LinkTypes.Forwards && icon}
66
+ {type === "forwards" && icon}
66
67
  </>
67
68
  );
68
69
  }
69
70
 
70
- function getExternalIcon(children, linkId) {
71
+ function getExternalIcon(children: JSX.Element, linkId: string) {
71
72
  const iconId = `${linkId}-icon`;
72
73
  const icon = (
73
74
  <Icon
74
- align={IconAlign.Right}
75
+ align={"right"}
75
76
  className="more-link"
76
77
  id={iconId}
77
- name={IconNames.ActionLaunch}
78
- size={IconSizes.Medium}
78
+ name="actionLaunch"
79
+ size="medium"
79
80
  />
80
81
  );
81
82
 
@@ -93,25 +94,16 @@ function getExternalIcon(children, linkId) {
93
94
  */
94
95
  export const Link = chakra(
95
96
  React.forwardRef<HTMLAnchorElement, LinkProps>((props, ref: any) => {
96
- const {
97
- additionalStyles = {},
98
- attributes,
99
- children,
100
- className,
101
- href,
102
- id,
103
- type = LinkTypes.Default,
104
- ...rest
105
- } = props;
97
+ const { children, className, href, id, type = "default", ...rest } = props;
106
98
 
107
99
  // Merge the necessary props alongside any extra props for the
108
100
  // anchor element.
109
101
  const linkProps = {
110
102
  id,
111
103
  href,
112
- ...attributes,
104
+ ...rest,
113
105
  };
114
- // The LinkTypes.Default type.
106
+ // The "default" type.
115
107
  let variant = "link";
116
108
 
117
109
  if (typeof children === "string" && !href) {
@@ -119,28 +111,27 @@ export const Link = chakra(
119
111
  }
120
112
 
121
113
  if (
122
- type === LinkTypes.Action ||
123
- type === LinkTypes.Forwards ||
124
- type === LinkTypes.Backwards ||
125
- type === LinkTypes.External
114
+ type === "action" ||
115
+ type === "forwards" ||
116
+ type === "backwards" ||
117
+ type === "external"
126
118
  ) {
127
119
  variant = "moreLink";
128
- } else if (type === LinkTypes.Button) {
120
+ } else if (type === "button") {
129
121
  variant = "button";
130
122
  }
131
123
  const style = useStyleConfig("Link", { variant });
124
+ const rel = type === "external" ? "nofollow" : null;
125
+ const target = type === "external" ? "_blank" : null;
132
126
  // Render with specific direction arrows if the type is
133
127
  // Forwards or Backwards. Or render with the launch icon
134
128
  // if the type is External. Otherwise, do not add an icon.
135
129
  const newChildren =
136
- ((type === LinkTypes.Forwards || type === LinkTypes.Backwards) &&
137
- getWithDirectionIcon(children, type, id)) ||
138
- (type === LinkTypes.External && getExternalIcon(children, id)) ||
130
+ ((type === "forwards" || type === "backwards") &&
131
+ getWithDirectionIcon(children as JSX.Element, type, id)) ||
132
+ (type === "external" && getExternalIcon(children as JSX.Element, id)) ||
139
133
  children;
140
134
 
141
- const rel = type === LinkTypes.External ? "nofollow" : null;
142
- const target = type === LinkTypes.External ? "_blank" : null;
143
-
144
135
  if (!href) {
145
136
  // React Types error makes this fail:
146
137
  // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/32832
@@ -151,7 +142,7 @@ export const Link = chakra(
151
142
  const childrenToClone: any = children[0] ? children[0] : children;
152
143
  const childProps = childrenToClone.props;
153
144
  return (
154
- <Box as="span" __css={style} {...rest}>
145
+ <Box as="span" __css={style}>
155
146
  {React.cloneElement(
156
147
  childrenToClone,
157
148
  {
@@ -161,9 +152,6 @@ export const Link = chakra(
161
152
  ref,
162
153
  rel,
163
154
  target,
164
- // Useful if more styles are needed for the custom
165
- // anchor element or link component.
166
- style: additionalStyles,
167
155
  },
168
156
  [childrenToClone.props.children]
169
157
  )}
@@ -178,8 +166,7 @@ export const Link = chakra(
178
166
  rel={rel}
179
167
  target={target}
180
168
  {...linkProps}
181
- __css={{ ...style, ...additionalStyles }}
182
- {...rest}
169
+ __css={style}
183
170
  >
184
171
  {newChildren}
185
172
  </Box>
@@ -115,7 +115,7 @@ exports[`Link renders the UI snapshot correctly 4`] = `
115
115
  focusable={false}
116
116
  id="external-link-icon"
117
117
  role="img"
118
- title="action_launch icon"
118
+ title="actionLaunch icon"
119
119
  viewBox="0 0 24 24"
120
120
  >
121
121
  <g
@@ -209,7 +209,6 @@ exports[`Link renders the UI snapshot correctly 7`] = `
209
209
  href="#existing-anchor-tag"
210
210
  id="anchor-link"
211
211
  rel={null}
212
- style={Object {}}
213
212
  target={null}
214
213
  >
215
214
  check link
@@ -8,16 +8,10 @@ import {
8
8
  import { withDesign } from "storybook-addon-designs";
9
9
 
10
10
  import Heading from "../Heading/Heading";
11
- import { HeadingLevels } from "../Heading/HeadingTypes";
12
11
  import Image from "../Image/Image";
13
12
  import Link from "../Link/Link";
14
- import { LinkTypes } from "../Link/LinkTypes";
15
13
  import List from "./List";
16
- import { ListTypes } from "./ListTypes";
17
14
  import { getCategory } from "../../utils/componentCategories";
18
- import { getStorybookEnumValues } from "../../utils/utils";
19
-
20
- export const enumValues = getStorybookEnumValues(ListTypes, "ListTypes");
21
15
 
22
16
  <Meta
23
17
  title={getCategory("List")}
@@ -31,7 +25,6 @@ export const enumValues = getStorybookEnumValues(ListTypes, "ListTypes");
31
25
  jest: ["List.test.tsx"],
32
26
  }}
33
27
  argTypes={{
34
- additionalStyles: { control: false },
35
28
  children: { table: { disable: true } },
36
29
  className: { control: false },
37
30
  id: { control: false },
@@ -39,9 +32,7 @@ export const enumValues = getStorybookEnumValues(ListTypes, "ListTypes");
39
32
  listItems: { control: false },
40
33
  noStyling: { table: { defaultValue: { summary: false } } },
41
34
  type: {
42
- control: { type: "select" },
43
- options: enumValues.options,
44
- table: { defaultValue: { summary: "ListTypes.Unordered" } },
35
+ table: { defaultValue: { summary: "ul" } },
45
36
  },
46
37
  }}
47
38
  />
@@ -51,7 +42,7 @@ export const enumValues = getStorybookEnumValues(ListTypes, "ListTypes");
51
42
  | Component Version | DS Version |
52
43
  | ----------------- | ---------- |
53
44
  | Added | `0.7.0` |
54
- | Latest | `0.26.0` |
45
+ | Latest | `0.28.0` |
55
46
 
56
47
  ## Table of Contents
57
48
 
@@ -154,19 +145,18 @@ export const descriptions = [
154
145
  <Story
155
146
  name="List with Controls"
156
147
  args={{
157
- additionalStyles: undefined,
158
148
  className: undefined,
159
149
  id: "nypl-list",
160
150
  inline: false,
161
151
  listItems: undefined,
162
152
  noStyling: false,
163
153
  title: "Middle-Earth Peoples",
164
- type: "ListTypes.Unordered",
154
+ type: "ul",
165
155
  }}
166
156
  >
167
157
  {(args) => (
168
- <List {...args} type={enumValues.getValue(args.type)}>
169
- {args.type !== "ListTypes.Description"
158
+ <List {...args}>
159
+ {args.type !== "dl"
170
160
  ? itemGroups.map((item, i) => <li key={i}>{item}</li>)
171
161
  : descriptions.map((item, i) => [
172
162
  <dt key={`dt_${i}`}>{item.term}</dt>,
@@ -205,12 +195,12 @@ may still use this name. In the Reservoir Design System, we will use the
205
195
  - [W3C Using description lists](https://www.w3.org/WAI/WCAG21/Techniques/html/H40.html)
206
196
  - [MDN dl: The Description List element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dl)
207
197
 
208
- To render a description list, pass in `ListTypes.Description` to the `type` prop.
209
- The optional `title` prop will now render above the description list element.
210
- This type of list renders `dt` and `dd` elements.
198
+ To render a description list, pass in `"dl"` to the `type` prop. The optional
199
+ `title` prop will now render above the description list element. This type of
200
+ list renders `dt` and `dd` elements.
211
201
 
212
202
  ```jsx
213
- <List type={ListTypes.Description}>
203
+ <List type="dl">
214
204
  <dt>Term</dt>
215
205
  <dd>Description</dd>
216
206
  </List>
@@ -237,7 +227,7 @@ This type of list renders `dt` and `dd` elements.
237
227
  }}
238
228
  >
239
229
  {(args) => (
240
- <List {...args} type={ListTypes.Description}>
230
+ <List {...args} type="dl">
241
231
  {descriptions.map((item, i) => [
242
232
  <dt key={`dt_${i}`}>{item.term}</dt>,
243
233
  <dd key={`dd_${i}`}>{item.description}</dd>,
@@ -271,7 +261,7 @@ An example with HTML elements inside of the `dd` elements.
271
261
  }}
272
262
  >
273
263
  {(args) => (
274
- <List {...args} type={ListTypes.Description}>
264
+ <List {...args} type="dl">
275
265
  <dt>Authors</dt>
276
266
  <dd>
277
267
  <a href="#">Chirwa, Ephraim Wadonda, author</a>
@@ -320,14 +310,13 @@ children elements or the `listItems` prop should be passed but not both.
320
310
 
321
311
  ### Unordered and Ordered
322
312
 
323
- For lists of type `ListTypes.Unordered` (ul) or `ListTypes.Ordered` (ol), `li`
324
- list item elements can be passed as children. If that's not possible but the
325
- data to render is stored as an array of strings, then that data array can be
326
- passed into `listItems`.
313
+ For lists of type `"ul"` (unorderd) or `"ol"` (ordered), `li` list item elements
314
+ can be passed as children. If that's not possible but the data to render is
315
+ stored as an array of strings, then that data array can be passed into `listItems`.
327
316
 
328
317
  ```jsx
329
318
  <!-- With `li` elements -->
330
- <List type={ListTypes.Unordered}>
319
+ <List type={ul}>
331
320
  <li>Mahi-mahi</li>
332
321
  <li>Golden trout</li>
333
322
  <li>Rainbowfish</li>
@@ -336,19 +325,19 @@ passed into `listItems`.
336
325
 
337
326
  <!-- With `itemList` data prop -->
338
327
  const fishArray = ["Mahi-mahi", "Golden trout", "Rainbowfish", "Suckerfish"];
339
- <List type={ListTypes.Unordered} listItems={fishArray} />
328
+ <List type={ul} listItems={fishArray} />
340
329
  ```
341
330
 
342
331
  ### Description
343
332
 
344
- For lists of type `ListTypes.Description` (dl), `dt` and `dd` elements can be
333
+ For lists of type `"dl"` (description), `dt` and `dd` elements can be
345
334
  passed as children. If that's not possible but the data to render is stored as
346
335
  an array of objects, then that data array can be passed into `listItems`. The
347
336
  object must have two keys, `term` and `description`.
348
337
 
349
338
  ```jsx
350
339
  // With `dt`/`dd` elements
351
- <List type={ListTypes.Description} title="Animal Crossing Fish">
340
+ <List type="dl" title="Animal Crossing Fish">
352
341
  <dt>Mahi-mahi</dt>
353
342
  <dd>The mahi-mahi is an ocean fish known...</dd>
354
343
  <dt>Golden trout</dt>
@@ -381,7 +370,7 @@ const fishDescriptions = [
381
370
  <List
382
371
  listItems={fishDescriptions}
383
372
  title="Animal Crossing Fish"
384
- type={ListTypes.Description}
373
+ type="dl"
385
374
  />
386
375
  ```
387
376
 
@@ -399,6 +388,6 @@ const fishDescriptions = [
399
388
  type: { control: false },
400
389
  }}
401
390
  >
402
- {(args) => <List {...args} type={ListTypes.Description} />}
391
+ {(args) => <List {...args} type="dl" />}
403
392
  </Story>
404
393
  </Canvas>
@@ -4,7 +4,6 @@ import { axe } from "jest-axe";
4
4
  import renderer from "react-test-renderer";
5
5
 
6
6
  import List from "./List";
7
- import { ListTypes } from "./ListTypes";
8
7
 
9
8
  const fishArray = ["Mahi-mahi", "Golden trout", "Rainbowfish", "Suckerfish"];
10
9
  const fishDescriptions = [
@@ -21,32 +20,32 @@ const fishDescriptions = [
21
20
  describe("List Accessibility", () => {
22
21
  it("passes axe accessibility test for unordered list", async () => {
23
22
  const { container, rerender } = render(
24
- <List type={ListTypes.Unordered}>
23
+ <List type="ul">
25
24
  <li>Mahi-mahi</li>
26
25
  <li>Golden trout</li>
27
26
  </List>
28
27
  );
29
28
  expect(await axe(container)).toHaveNoViolations();
30
29
 
31
- rerender(<List type={ListTypes.Unordered} listItems={fishArray} />);
30
+ rerender(<List type="ul" listItems={fishArray} />);
32
31
  expect(await axe(container)).toHaveNoViolations();
33
32
  });
34
33
  it("passes axe accessibility test for ordered list", async () => {
35
34
  const { container, rerender } = render(
36
- <List type={ListTypes.Ordered}>
35
+ <List type="ol">
37
36
  <li>Mahi-mahi</li>
38
37
  <li>Golden trout</li>
39
38
  </List>
40
39
  );
41
40
  expect(await axe(container)).toHaveNoViolations();
42
41
 
43
- rerender(<List type={ListTypes.Ordered} listItems={fishArray} />);
42
+ rerender(<List type="ol" listItems={fishArray} />);
44
43
  expect(await axe(container)).toHaveNoViolations();
45
44
  });
46
45
  it("passes axe accessibility test for description list", async () => {
47
46
  const { container } = render(
48
47
  <List
49
- type={ListTypes.Description}
48
+ type="dl"
50
49
  title="Animal Crossing Fish"
51
50
  listItems={fishDescriptions}
52
51
  />
@@ -58,7 +57,7 @@ describe("List Accessibility", () => {
58
57
  describe("List", () => {
59
58
  it("renders unordered list", () => {
60
59
  render(
61
- <List type={ListTypes.Unordered}>
60
+ <List type="ul">
62
61
  <li>Mahi-mahi</li>
63
62
  <li>Golden trout</li>
64
63
  </List>
@@ -70,7 +69,7 @@ describe("List", () => {
70
69
  });
71
70
 
72
71
  it("renders unordered list with the `listItems` prop", () => {
73
- render(<List type={ListTypes.Unordered} listItems={fishArray} />);
72
+ render(<List type="ul" listItems={fishArray} />);
74
73
 
75
74
  expect(screen.getAllByRole("listitem")).toHaveLength(4);
76
75
  expect(screen.getByText("Mahi-mahi")).toBeInTheDocument();
@@ -81,7 +80,7 @@ describe("List", () => {
81
80
 
82
81
  it("renders ordered list", () => {
83
82
  render(
84
- <List type={ListTypes.Ordered}>
83
+ <List type="ol">
85
84
  <li>Mahi-mahi</li>
86
85
  <li>Golden trout</li>
87
86
  </List>
@@ -93,7 +92,7 @@ describe("List", () => {
93
92
  });
94
93
 
95
94
  it("renders ordered list with the `listItems` prop", () => {
96
- render(<List type={ListTypes.Ordered} listItems={fishArray} />);
95
+ render(<List type="ol" listItems={fishArray} />);
97
96
 
98
97
  expect(screen.getAllByRole("listitem")).toHaveLength(4);
99
98
  expect(screen.getByText("Mahi-mahi")).toBeInTheDocument();
@@ -104,7 +103,7 @@ describe("List", () => {
104
103
 
105
104
  it("returns description list", () => {
106
105
  render(
107
- <List type={ListTypes.Description}>
106
+ <List type="dl">
108
107
  <dt>Mahi-mahi</dt>
109
108
  <dd>The mahi-mahi is an ocean fish known...</dd>
110
109
  </List>
@@ -119,7 +118,7 @@ describe("List", () => {
119
118
  it("returns description list with the `listItems` prop", () => {
120
119
  render(
121
120
  <List
122
- type={ListTypes.Description}
121
+ type="dl"
123
122
  title="Animal Crossing Fish"
124
123
  listItems={fishDescriptions}
125
124
  />
@@ -130,7 +129,7 @@ describe("List", () => {
130
129
  it("consoles a warning when children and the `listItems` prop are both passed", () => {
131
130
  const warn = jest.spyOn(console, "warn");
132
131
  render(
133
- <List type={ListTypes.Ordered} listItems={fishArray}>
132
+ <List type="ol" listItems={fishArray}>
134
133
  <li>Mahi-mahi</li>
135
134
  <li>Golden trout</li>
136
135
  <li>Rainbowfish</li>
@@ -145,7 +144,7 @@ describe("List", () => {
145
144
 
146
145
  it("consoles a warning when no children are passed or the `listItems` prop is not passed", () => {
147
146
  const warn = jest.spyOn(console, "warn");
148
- render(<List type={ListTypes.Ordered}></List>);
147
+ render(<List type="ol"></List>);
149
148
  expect(warn).toHaveBeenCalledWith(
150
149
  "NYPL Reservoir List: Pass in either `<li>` children or pass data in " +
151
150
  "the `listItems` prop, not both."
@@ -155,7 +154,7 @@ describe("List", () => {
155
154
  it("consoles a warning when you pass an ordered or unordered list children that aren't <li>s", () => {
156
155
  const warn = jest.spyOn(console, "warn");
157
156
  render(
158
- <List type={ListTypes.Ordered}>
157
+ <List type="ol">
159
158
  <span>Mahi-mahi</span>
160
159
  <span>Golden trout</span>
161
160
  <span>Rainbowfish</span>
@@ -169,7 +168,7 @@ describe("List", () => {
169
168
  it("consoles a warning when you pass a description list children that aren't `<dt>`s or `<dd>`s", () => {
170
169
  const warn = jest.spyOn(console, "warn");
171
170
  render(
172
- <List type={ListTypes.Description}>
171
+ <List type="dl">
173
172
  <span>Mahi-mahi</span>
174
173
  <span>Golden trout</span>
175
174
  <span>Rainbowfish</span>
@@ -183,34 +182,21 @@ describe("List", () => {
183
182
 
184
183
  it("Renders the UI snapshot correctly", () => {
185
184
  const unordered = renderer
186
- .create(
187
- <List id="unordered" type={ListTypes.Unordered} listItems={fishArray} />
188
- )
185
+ .create(<List id="unordered" type="ul" listItems={fishArray} />)
189
186
  .toJSON();
190
187
  const unorderedNoStyling = renderer
191
- .create(
192
- <List
193
- id="ordered"
194
- type={ListTypes.Unordered}
195
- listItems={fishArray}
196
- noStyling
197
- />
198
- )
188
+ .create(<List id="ordered" type="ul" listItems={fishArray} noStyling />)
199
189
  .toJSON();
200
190
  const ordered = renderer
201
191
  .create(
202
- <List
203
- id="unordered-no-styling"
204
- type={ListTypes.Ordered}
205
- listItems={fishArray}
206
- />
192
+ <List id="unordered-no-styling" type="ol" listItems={fishArray} />
207
193
  )
208
194
  .toJSON();
209
195
  const orderedNoStyling = renderer
210
196
  .create(
211
197
  <List
212
198
  id="ordered-no-styling"
213
- type={ListTypes.Ordered}
199
+ type="ol"
214
200
  listItems={fishArray}
215
201
  noStyling
216
202
  />
@@ -220,7 +206,7 @@ describe("List", () => {
220
206
  .create(
221
207
  <List
222
208
  id="description"
223
- type={ListTypes.Description}
209
+ type="dl"
224
210
  title="Animal Crossing Fish"
225
211
  listItems={fishDescriptions}
226
212
  />
@@ -230,7 +216,7 @@ describe("List", () => {
230
216
  .create(
231
217
  <List
232
218
  id="chakra"
233
- type={ListTypes.Unordered}
219
+ type="ul"
234
220
  listItems={fishArray}
235
221
  p="20px"
236
222
  color="ui.error.primary"
@@ -239,19 +225,14 @@ describe("List", () => {
239
225
  .toJSON();
240
226
  const withOtherPropsUnordered = renderer
241
227
  .create(
242
- <List
243
- id="other"
244
- type={ListTypes.Unordered}
245
- listItems={fishArray}
246
- data-testid="other"
247
- />
228
+ <List id="other" type="ul" listItems={fishArray} data-testid="other" />
248
229
  )
249
230
  .toJSON();
250
231
  const withChakraPropsDescription = renderer
251
232
  .create(
252
233
  <List
253
234
  id="chakra"
254
- type={ListTypes.Description}
235
+ type="dl"
255
236
  title="Animal Crossing Fish"
256
237
  listItems={fishDescriptions}
257
238
  p="20px"
@@ -263,7 +244,7 @@ describe("List", () => {
263
244
  .create(
264
245
  <List
265
246
  id="other"
266
- type={ListTypes.Description}
247
+ type="dl"
267
248
  title="Animal Crossing Fish"
268
249
  listItems={fishDescriptions}
269
250
  data-testid="other"