@nypl/design-system-react-components 0.25.7 → 0.25.10

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 (293) hide show
  1. package/CHANGELOG.md +119 -1
  2. package/README.md +1 -1
  3. package/dist/components/Button/Button.d.ts +6 -6
  4. package/dist/components/Button/ButtonTypes.d.ts +0 -1
  5. package/dist/components/Card/Card.d.ts +6 -4
  6. package/dist/components/Checkbox/Checkbox.d.ts +3 -2
  7. package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +3 -2
  8. package/dist/components/ComponentWrapper/ComponentWrapper.d.ts +8 -2
  9. package/dist/components/DatePicker/DatePicker.d.ts +4 -3
  10. package/dist/components/Fieldset/Fieldset.d.ts +1 -3
  11. package/dist/components/Form/Form.d.ts +15 -14
  12. package/dist/components/Form/FormTypes.d.ts +2 -2
  13. package/dist/components/Heading/Heading.d.ts +7 -3
  14. package/dist/components/Heading/HeadingTypes.d.ts +6 -6
  15. package/dist/components/HelperErrorText/HelperErrorText.d.ts +5 -2
  16. package/dist/components/HorizontalRule/HorizontalRule.d.ts +3 -3
  17. package/dist/components/Icons/Icon.d.ts +4 -4
  18. package/dist/components/Icons/IconSvgs.d.ts +1 -21
  19. package/dist/components/Icons/IconTypes.d.ts +1 -23
  20. package/dist/components/Image/Image.d.ts +11 -3
  21. package/dist/components/Image/ImageTypes.d.ts +3 -1
  22. package/dist/components/Link/LinkTypes.d.ts +1 -0
  23. package/dist/components/Logo/Logo.d.ts +28 -0
  24. package/dist/components/Logo/LogoSvgs.d.ts +18 -0
  25. package/dist/components/Logo/LogoTypes.d.ts +30 -0
  26. package/dist/components/Modal/Modal.d.ts +0 -4
  27. package/dist/components/Notification/Notification.d.ts +4 -2
  28. package/dist/components/Placeholder/Placeholder.d.ts +3 -5
  29. package/dist/components/Radio/Radio.d.ts +6 -5
  30. package/dist/components/RadioGroup/RadioGroup.d.ts +6 -5
  31. package/dist/components/SearchBar/SearchBar.d.ts +15 -7
  32. package/dist/components/Select/Select.d.ts +5 -2
  33. package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +8 -4
  34. package/dist/components/Slider/Slider.d.ts +3 -2
  35. package/dist/components/StatusBadge/StatusBadge.d.ts +2 -1
  36. package/dist/components/StructuredContent/StructuredContent.d.ts +41 -0
  37. package/dist/components/StructuredContent/StructuredContentTypes.d.ts +5 -0
  38. package/dist/components/Table/Table.d.ts +29 -0
  39. package/dist/components/Template/Template.d.ts +30 -6
  40. package/dist/components/Text/Text.d.ts +2 -2
  41. package/dist/components/TextInput/TextInput.d.ts +4 -3
  42. package/dist/components/Toggle/Toggle.d.ts +48 -0
  43. package/dist/components/Toggle/ToggleSizes.d.ts +4 -0
  44. package/dist/components/VideoPlayer/VideoPlayer.d.ts +17 -6
  45. package/dist/design-system-react-components.cjs.development.js +4698 -4405
  46. package/dist/design-system-react-components.cjs.development.js.map +1 -1
  47. package/dist/design-system-react-components.cjs.production.min.js +1 -1
  48. package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
  49. package/dist/design-system-react-components.esm.js +5862 -5573
  50. package/dist/design-system-react-components.esm.js.map +1 -1
  51. package/dist/index.d.ts +13 -8
  52. package/dist/resources.scss +0 -2
  53. package/dist/styles.css +2 -2
  54. package/dist/theme/components/breadcrumb.d.ts +1 -1
  55. package/dist/theme/components/button.d.ts +0 -12
  56. package/dist/theme/components/card.d.ts +14 -2
  57. package/dist/theme/components/customTable.d.ts +56 -0
  58. package/dist/theme/components/fieldset.d.ts +2 -2
  59. package/dist/theme/components/global.d.ts +1 -1
  60. package/dist/theme/components/heading.d.ts +4 -0
  61. package/dist/theme/components/label.d.ts +1 -1
  62. package/dist/theme/components/link.d.ts +14 -1
  63. package/dist/theme/components/list.d.ts +0 -2
  64. package/dist/theme/components/logo.d.ts +4 -0
  65. package/dist/theme/components/notification.d.ts +8 -4
  66. package/dist/theme/components/searchBar.d.ts +7 -13
  67. package/dist/theme/components/select.d.ts +1 -0
  68. package/dist/theme/components/structuredContent.d.ts +33 -0
  69. package/dist/theme/components/template.d.ts +10 -10
  70. package/dist/theme/components/textInput.d.ts +2 -0
  71. package/dist/theme/components/toggle.d.ts +71 -0
  72. package/dist/theme/foundations/spacing.d.ts +2 -0
  73. package/dist/utils/utils.d.ts +10 -0
  74. package/package.json +40 -37
  75. package/src/__tests__/utils/utils.test.ts +23 -1
  76. package/src/components/Accordion/Accordion.stories.mdx +16 -15
  77. package/src/components/Accordion/Accordion.test.tsx +45 -1
  78. package/src/components/Accordion/Accordion.tsx +20 -8
  79. package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +243 -0
  80. package/src/components/Autosuggest/Autosuggest.stories.mdx +2 -1
  81. package/src/components/Autosuggest/Autosuggest.stories.tsx +24 -48
  82. package/src/components/Autosuggest/_Autosuggest.scss +2 -6
  83. package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +43 -13
  84. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +25 -0
  85. package/src/components/Breadcrumbs/Breadcrumbs.tsx +9 -3
  86. package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +103 -4
  87. package/src/components/Button/Button.stories.mdx +93 -48
  88. package/src/components/Button/Button.test.tsx +0 -12
  89. package/src/components/Button/Button.tsx +7 -8
  90. package/src/components/Button/ButtonTypes.tsx +0 -1
  91. package/src/components/Button/__snapshots__/Button.test.tsx.snap +0 -12
  92. package/src/components/Card/Card.stories.mdx +246 -64
  93. package/src/components/Card/Card.test.tsx +45 -22
  94. package/src/components/Card/Card.tsx +30 -14
  95. package/src/components/Card/__snapshots__/Card.test.tsx.snap +75 -37
  96. package/src/components/Chakra/Box.stories.mdx +3 -3
  97. package/src/components/Chakra/Center.stories.mdx +5 -5
  98. package/src/components/Chakra/Flex.stories.mdx +113 -0
  99. package/src/components/Chakra/Grid.stories.mdx +14 -17
  100. package/src/components/Chakra/Stack.stories.mdx +2 -2
  101. package/src/components/Checkbox/Checkbox.stories.mdx +37 -15
  102. package/src/components/Checkbox/Checkbox.tsx +13 -8
  103. package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +48 -16
  104. package/src/components/CheckboxGroup/CheckboxGroup.tsx +14 -10
  105. package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +6 -3
  106. package/src/components/ComponentWrapper/ComponentWrapper.test.tsx +151 -0
  107. package/src/components/ComponentWrapper/ComponentWrapper.tsx +36 -23
  108. package/src/components/ComponentWrapper/__snapshots__/ComponentWrapper.test.tsx.snap +85 -0
  109. package/src/components/DatePicker/DatePicker.stories.mdx +63 -18
  110. package/src/components/DatePicker/DatePicker.test.tsx +14 -12
  111. package/src/components/DatePicker/DatePicker.tsx +13 -10
  112. package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +41 -22
  113. package/src/components/Fieldset/Fieldset.stories.mdx +20 -9
  114. package/src/components/Fieldset/Fieldset.tsx +2 -4
  115. package/src/components/Form/Form.stories.mdx +75 -49
  116. package/src/components/Form/Form.test.tsx +92 -3
  117. package/src/components/Form/Form.tsx +28 -23
  118. package/src/components/Form/FormTypes.tsx +2 -2
  119. package/src/components/Form/__snapshots__/Form.test.tsx.snap +0 -1
  120. package/src/components/Grid/SimpleGrid.stories.mdx +26 -26
  121. package/src/components/Heading/Heading.stories.mdx +59 -23
  122. package/src/components/Heading/Heading.test.tsx +82 -18
  123. package/src/components/Heading/Heading.tsx +31 -31
  124. package/src/components/Heading/HeadingTypes.tsx +6 -6
  125. package/src/components/Heading/__snapshots__/Heading.test.tsx.snap +71 -0
  126. package/src/components/HelperErrorText/HelperErrorText.stories.mdx +55 -27
  127. package/src/components/HelperErrorText/HelperErrorText.test.tsx +42 -15
  128. package/src/components/HelperErrorText/HelperErrorText.tsx +24 -24
  129. package/src/components/HelperErrorText/__snapshots__/HelperErrorText.test.tsx.snap +41 -4
  130. package/src/components/Hero/Hero.stories.mdx +72 -53
  131. package/src/components/HorizontalRule/HorizontalRule.stories.mdx +11 -9
  132. package/src/components/HorizontalRule/HorizontalRule.tsx +4 -6
  133. package/src/components/HorizontalRule/__snapshots__/HorizontalRule.test.tsx.snap +4 -4
  134. package/src/components/Icons/Icon.stories.mdx +77 -75
  135. package/src/components/Icons/Icon.tsx +4 -5
  136. package/src/components/Icons/IconSvgs.tsx +2 -42
  137. package/src/components/Icons/IconTypes.tsx +1 -24
  138. package/src/components/Image/Image.stories.mdx +214 -104
  139. package/src/components/Image/Image.test.tsx +10 -0
  140. package/src/components/Image/Image.tsx +21 -10
  141. package/src/components/Image/ImageTypes.ts +2 -0
  142. package/src/components/Image/__snapshots__/Image.test.tsx.snap +24 -8
  143. package/src/components/Label/Label.stories.mdx +21 -20
  144. package/src/components/Link/Link.stories.mdx +103 -53
  145. package/src/components/Link/Link.test.tsx +108 -7
  146. package/src/components/Link/Link.tsx +58 -19
  147. package/src/components/Link/LinkTypes.tsx +1 -0
  148. package/src/components/Link/__snapshots__/Link.test.tsx.snap +261 -0
  149. package/src/components/List/List.stories.mdx +37 -25
  150. package/src/components/List/List.tsx +1 -1
  151. package/src/components/Logo/Logo.stories.mdx +220 -0
  152. package/src/components/Logo/Logo.test.tsx +98 -0
  153. package/src/components/Logo/Logo.tsx +97 -0
  154. package/src/components/Logo/LogoSvgs.tsx +34 -0
  155. package/src/components/Logo/LogoTypes.tsx +32 -0
  156. package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +71 -0
  157. package/src/components/Modal/Modal.stories.mdx +20 -5
  158. package/src/components/Modal/Modal.tsx +2 -8
  159. package/src/components/Notification/Notification.stories.mdx +96 -40
  160. package/src/components/Notification/Notification.test.tsx +62 -16
  161. package/src/components/Notification/Notification.tsx +26 -9
  162. package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +121 -0
  163. package/src/components/Pagination/Pagination.stories.mdx +19 -9
  164. package/src/components/Pagination/Pagination.tsx +3 -3
  165. package/src/components/Pagination/__snapshots__/Pagination.test.tsx.snap +42 -0
  166. package/src/components/Placeholder/Placeholder.tsx +7 -14
  167. package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +74 -46
  168. package/src/components/Radio/Radio.stories.mdx +39 -19
  169. package/src/components/Radio/Radio.tsx +13 -9
  170. package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +5 -5
  171. package/src/components/RadioGroup/RadioGroup.stories.mdx +50 -16
  172. package/src/components/RadioGroup/RadioGroup.test.tsx +13 -11
  173. package/src/components/RadioGroup/RadioGroup.tsx +97 -94
  174. package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +24 -21
  175. package/src/components/SearchBar/SearchBar.Test.tsx +160 -34
  176. package/src/components/SearchBar/SearchBar.stories.mdx +116 -34
  177. package/src/components/SearchBar/SearchBar.tsx +70 -50
  178. package/src/components/Select/Select.stories.mdx +177 -66
  179. package/src/components/Select/Select.test.tsx +91 -2
  180. package/src/components/Select/Select.tsx +29 -13
  181. package/src/components/Select/__snapshots__/Select.test.tsx.snap +545 -0
  182. package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +50 -16
  183. package/src/components/SkeletonLoader/SkeletonLoader.tsx +8 -4
  184. package/src/components/Slider/Slider.stories.mdx +74 -23
  185. package/src/components/Slider/Slider.test.tsx +35 -0
  186. package/src/components/Slider/Slider.tsx +22 -11
  187. package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +67 -30
  188. package/src/components/StatusBadge/StatusBadge.stories.mdx +33 -18
  189. package/src/components/StatusBadge/StatusBadge.tsx +2 -1
  190. package/src/components/StructuredContent/StructuredContent.stories.mdx +427 -0
  191. package/src/components/StructuredContent/StructuredContent.test.tsx +376 -0
  192. package/src/components/StructuredContent/StructuredContent.tsx +153 -0
  193. package/src/components/StructuredContent/StructuredContentTypes.tsx +5 -0
  194. package/src/components/StructuredContent/__snapshots__/StructuredContent.test.tsx.snap +283 -0
  195. package/src/components/StyleGuide/Bidirectionality.stories.mdx +32 -83
  196. package/src/components/StyleGuide/Breakpoints.stories.mdx +1 -11
  197. package/src/components/StyleGuide/Buttons.stories.mdx +3 -18
  198. package/src/components/StyleGuide/ColorCard.tsx +1 -2
  199. package/src/components/StyleGuide/Colors.stories.mdx +3 -11
  200. package/src/components/StyleGuide/DesignTokens.stories.mdx +3 -8
  201. package/src/components/StyleGuide/Forms.stories.mdx +2 -10
  202. package/src/components/StyleGuide/Iconography.stories.mdx +8 -34
  203. package/src/components/StyleGuide/Spacing.stories.mdx +3 -14
  204. package/src/components/StyleGuide/Typography.stories.mdx +64 -76
  205. package/src/components/Table/Table.stories.mdx +165 -0
  206. package/src/components/Table/Table.test.tsx +137 -0
  207. package/src/components/Table/Table.tsx +126 -0
  208. package/src/components/Table/__snapshots__/Table.test.tsx.snap +1179 -0
  209. package/src/components/Tabs/Tabs.stories.mdx +20 -14
  210. package/src/components/Tabs/Tabs.test.tsx +21 -5
  211. package/src/components/Tabs/Tabs.tsx +33 -18
  212. package/src/components/Tabs/__snapshots__/Tabs.test.tsx.snap +195 -0
  213. package/src/components/Template/Template.stories.mdx +132 -49
  214. package/src/components/Template/Template.test.tsx +128 -6
  215. package/src/components/Template/Template.tsx +93 -13
  216. package/src/components/Template/__snapshots__/Template.test.tsx.snap +169 -0
  217. package/src/components/Text/Text.stories.mdx +33 -11
  218. package/src/components/Text/Text.tsx +2 -2
  219. package/src/components/TextInput/TextInput.stories.mdx +84 -17
  220. package/src/components/TextInput/TextInput.test.tsx +96 -0
  221. package/src/components/TextInput/TextInput.tsx +12 -8
  222. package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +240 -0
  223. package/src/components/Toggle/Toggle.stories.mdx +200 -0
  224. package/src/components/Toggle/Toggle.test.tsx +140 -0
  225. package/src/components/Toggle/Toggle.tsx +123 -0
  226. package/src/components/Toggle/ToggleSizes.tsx +4 -0
  227. package/src/components/Toggle/__snapshots__/Toggle.test.tsx.snap +255 -0
  228. package/src/components/VideoPlayer/VideoPlayer.stories.mdx +96 -25
  229. package/src/components/VideoPlayer/VideoPlayer.test.tsx +103 -1
  230. package/src/components/VideoPlayer/VideoPlayer.tsx +72 -22
  231. package/src/components/VideoPlayer/__snapshots__/VideoPlayer.test.tsx.snap +57 -3
  232. package/src/docs/Chakra.stories.mdx +5 -8
  233. package/src/docs/Intro.stories.mdx +2 -2
  234. package/src/index.ts +19 -6
  235. package/src/styles/base/_03-base.scss +1 -1
  236. package/src/styles/base/_place-holder.scss +7 -7
  237. package/src/styles.scss +1 -5
  238. package/src/theme/components/breadcrumb.ts +5 -5
  239. package/src/theme/components/button.ts +5 -12
  240. package/src/theme/components/card.ts +9 -7
  241. package/src/theme/components/checkbox.ts +1 -1
  242. package/src/theme/components/customTable.ts +63 -0
  243. package/src/theme/components/datePicker.ts +1 -1
  244. package/src/theme/components/global.ts +7 -7
  245. package/src/theme/components/heading.ts +13 -11
  246. package/src/theme/components/helperErrorText.ts +1 -1
  247. package/src/theme/components/icon.ts +2 -2
  248. package/src/theme/components/image.ts +9 -1
  249. package/src/theme/components/link.ts +17 -5
  250. package/src/theme/components/list.ts +1 -3
  251. package/src/theme/components/logo.ts +54 -0
  252. package/src/theme/components/notification.ts +9 -7
  253. package/src/theme/components/searchBar.ts +7 -13
  254. package/src/theme/components/select.ts +1 -0
  255. package/src/theme/components/statusBadge.ts +1 -1
  256. package/src/theme/components/structuredContent.ts +54 -0
  257. package/src/theme/components/template.ts +10 -10
  258. package/src/theme/components/text.ts +6 -6
  259. package/src/theme/components/textInput.ts +1 -0
  260. package/src/theme/components/toggle.ts +69 -0
  261. package/src/theme/components/videoPlayer.ts +0 -2
  262. package/src/theme/foundations/global.ts +2 -2
  263. package/src/theme/foundations/spacing.ts +3 -0
  264. package/src/theme/foundations/typography.ts +84 -12
  265. package/src/theme/index.ts +8 -0
  266. package/src/utils/componentCategories.ts +5 -2
  267. package/src/utils/utils.ts +17 -0
  268. package/dist/__tests__/utils/bem.test.d.ts +0 -1
  269. package/dist/components/CardEdition/CardEdition.d.ts +0 -21
  270. package/dist/components/CardEdition/CardEdition.stories.d.ts +0 -27
  271. package/dist/components/Input/Input.d.ts +0 -36
  272. package/dist/components/Input/Input.stories.d.ts +0 -29
  273. package/dist/components/Input/InputTypes.d.ts +0 -6
  274. package/dist/components/StyleGuide/UIDocCard.d.ts +0 -11
  275. package/dist/helpers/CSSVariablesHelper.d.ts +0 -3
  276. package/dist/helpers/getCSSVariable.d.ts +0 -1
  277. package/dist/interfaces.d.ts +0 -3
  278. package/dist/utils/bem.d.ts +0 -1
  279. package/src/__tests__/utils/bem.test.ts +0 -37
  280. package/src/components/CardEdition/CardEdition.stories.tsx +0 -122
  281. package/src/components/CardEdition/CardEdition.test.tsx +0 -395
  282. package/src/components/CardEdition/CardEdition.tsx +0 -60
  283. package/src/components/CardEdition/_CardEdition.scss +0 -137
  284. package/src/components/Input/Input.stories.tsx +0 -133
  285. package/src/components/Input/Input.test.tsx +0 -266
  286. package/src/components/Input/Input.tsx +0 -81
  287. package/src/components/Input/InputTypes.tsx +0 -8
  288. package/src/components/Input/_Input.scss +0 -78
  289. package/src/components/StyleGuide/UIDocCard.tsx +0 -36
  290. package/src/helpers/CSSVariablesHelper.tsx +0 -34
  291. package/src/helpers/getCSSVariable.tsx +0 -5
  292. package/src/interfaces.ts +0 -3
  293. package/src/utils/bem.ts +0 -44
@@ -0,0 +1,243 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Accordion Renders the UI snapshot correctly 1`] = `
4
+ <div
5
+ className="chakra-accordion css-0"
6
+ id="accordian"
7
+ >
8
+ <div
9
+ className="chakra-accordion__item css-1fsnuue"
10
+ >
11
+ <button
12
+ aria-controls="accordion-panel-accordian-item-0"
13
+ aria-expanded={false}
14
+ className="chakra-accordion__button css-ubg1nw"
15
+ disabled={false}
16
+ id="accordion-button-accordian-item-0"
17
+ onClick={[Function]}
18
+ onFocus={[Function]}
19
+ onKeyDown={[Function]}
20
+ type="button"
21
+ >
22
+ <div
23
+ className="css-1eziwv"
24
+ >
25
+ Gerry Kellman
26
+ </div>
27
+ <svg
28
+ aria-hidden={true}
29
+ className="chakra-icon css-onkibi"
30
+ focusable={false}
31
+ id="accordion-accordian-icon-0"
32
+ role="img"
33
+ title="plus icon"
34
+ viewBox="0 0 24 24"
35
+ >
36
+ <g
37
+ stroke="currentColor"
38
+ strokeWidth="1.5"
39
+ >
40
+ <path
41
+ d="M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"
42
+ fill="none"
43
+ strokeLinecap="round"
44
+ />
45
+ <path
46
+ d="M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"
47
+ fill="currentColor"
48
+ strokeLinecap="round"
49
+ />
50
+ <circle
51
+ cx="12"
52
+ cy="12"
53
+ fill="none"
54
+ r="11.25"
55
+ strokeMiterlimit="10"
56
+ />
57
+ </g>
58
+ </svg>
59
+ </button>
60
+ <div
61
+ className="chakra-collapse"
62
+ style={
63
+ Object {
64
+ "display": "none",
65
+ "height": "0px",
66
+ "opacity": 0,
67
+ "overflow": "hidden",
68
+ }
69
+ }
70
+ >
71
+ <div
72
+ aria-labelledby="accordion-button-accordian-item-0"
73
+ className="chakra-accordion__panel css-0"
74
+ id="accordion-panel-accordian-item-0"
75
+ role="region"
76
+ >
77
+ <div
78
+ className="css-0"
79
+ id="card"
80
+ >
81
+ <div
82
+ className="css-0"
83
+ >
84
+ <div
85
+ className="the-wrap css-0"
86
+ >
87
+ <div
88
+ className="the-crop css-0"
89
+ >
90
+ <img
91
+ alt="Alt text"
92
+ className="css-0"
93
+ src="https://cdn.onebauer.media/one/media/6176/76fd/405b/ab5f/f20f/2d52/gerri-1500-1.jpg?format=jpg&quality=80&width=850&ratio=1-1&resize=aspectfit"
94
+ />
95
+ </div>
96
+ </div>
97
+ </div>
98
+ <div
99
+ className="card-body css-0"
100
+ >
101
+ <h4
102
+ className="chakra-heading css-0"
103
+ id="heading1"
104
+ >
105
+ Gerry Kellman
106
+ </h4>
107
+ <div
108
+ className="css-0"
109
+ >
110
+ Gerri is
111
+ <b>
112
+ one of Logan's most trusted confidantes
113
+ </b>
114
+ , one who serves many roles within the company. She's one of the most powerful people at Waystar Royco outside of the family itself.
115
+ </div>
116
+ </div>
117
+ </div>
118
+ </div>
119
+ </div>
120
+ </div>
121
+ </div>
122
+ `;
123
+
124
+ exports[`Accordion Renders the UI snapshot correctly 2`] = `
125
+ <div
126
+ className="chakra-accordion css-0"
127
+ id="accordian"
128
+ >
129
+ <div
130
+ className="chakra-accordion__item css-1fsnuue"
131
+ >
132
+ <button
133
+ aria-controls="accordion-panel-accordian-item-0"
134
+ aria-expanded={false}
135
+ className="chakra-accordion__button css-ubg1nw"
136
+ disabled={false}
137
+ id="accordion-button-accordian-item-0"
138
+ onClick={[Function]}
139
+ onFocus={[Function]}
140
+ onKeyDown={[Function]}
141
+ type="button"
142
+ >
143
+ <div
144
+ className="css-1eziwv"
145
+ >
146
+ Gerry Kellman
147
+ </div>
148
+ <svg
149
+ aria-hidden={true}
150
+ className="chakra-icon css-onkibi"
151
+ focusable={false}
152
+ id="accordion-accordian-icon-0"
153
+ role="img"
154
+ title="plus icon"
155
+ viewBox="0 0 24 24"
156
+ >
157
+ <g
158
+ stroke="currentColor"
159
+ strokeWidth="1.5"
160
+ >
161
+ <path
162
+ d="M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"
163
+ fill="none"
164
+ strokeLinecap="round"
165
+ />
166
+ <path
167
+ d="M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"
168
+ fill="currentColor"
169
+ strokeLinecap="round"
170
+ />
171
+ <circle
172
+ cx="12"
173
+ cy="12"
174
+ fill="none"
175
+ r="11.25"
176
+ strokeMiterlimit="10"
177
+ />
178
+ </g>
179
+ </svg>
180
+ </button>
181
+ <div
182
+ className="chakra-collapse"
183
+ style={
184
+ Object {
185
+ "display": "none",
186
+ "height": "0px",
187
+ "opacity": 0,
188
+ "overflow": "hidden",
189
+ }
190
+ }
191
+ >
192
+ <div
193
+ aria-labelledby="accordion-button-accordian-item-0"
194
+ className="chakra-accordion__panel css-0"
195
+ id="accordion-panel-accordian-item-0"
196
+ role="region"
197
+ >
198
+ <div
199
+ className="css-0"
200
+ id="card"
201
+ >
202
+ <div
203
+ className="css-0"
204
+ >
205
+ <div
206
+ className="the-wrap css-0"
207
+ >
208
+ <div
209
+ className="the-crop css-0"
210
+ >
211
+ <img
212
+ alt="Alt text"
213
+ className="css-0"
214
+ src="https://cdn.onebauer.media/one/media/6176/76fd/405b/ab5f/f20f/2d52/gerri-1500-1.jpg?format=jpg&quality=80&width=850&ratio=1-1&resize=aspectfit"
215
+ />
216
+ </div>
217
+ </div>
218
+ </div>
219
+ <div
220
+ className="card-body css-0"
221
+ >
222
+ <h4
223
+ className="chakra-heading css-0"
224
+ id="heading1"
225
+ >
226
+ Gerry Kellman
227
+ </h4>
228
+ <div
229
+ className="css-0"
230
+ >
231
+ Gerri is
232
+ <b>
233
+ one of Logan's most trusted confidantes
234
+ </b>
235
+ , one who serves many roles within the company. She's one of the most powerful people at Waystar Royco outside of the family itself.
236
+ </div>
237
+ </div>
238
+ </div>
239
+ </div>
240
+ </div>
241
+ </div>
242
+ </div>
243
+ `;
@@ -1,5 +1,6 @@
1
- import { Meta, Story, Canvas } from "@storybook/addon-docs/blocks";
1
+ import { Canvas, Meta, Story } from "@storybook/addon-docs";
2
2
  import Autosuggest from "react-autosuggest";
3
+
3
4
  import * as stories from "./Autosuggest.stories.tsx";
4
5
  import { getCategory } from "../../utils/componentCategories";
5
6
 
@@ -3,10 +3,7 @@ import React, { useState } from "react";
3
3
  import Autosuggest from "react-autosuggest";
4
4
  import Icon from "../Icons/Icon";
5
5
  import { IconNames } from "../Icons/IconTypes";
6
- import Label from "../Label/Label";
7
- import Input from "../Input/Input";
8
- import { InputTypes } from "../Input/InputTypes";
9
- import HelperErrorText from "../HelperErrorText/HelperErrorText";
6
+ import TextInput from "../TextInput/TextInput";
10
7
 
11
8
  /**
12
9
  * StoryWrapper
@@ -21,29 +18,16 @@ const libraryRenderInputComponent = (
21
18
  inputProps: React.HTMLProps<HTMLInputElement>
22
19
  ) => {
23
20
  return (
24
- <>
25
- <Label
26
- htmlFor="library-autosuggest"
27
- id="library-autosuggest-label"
28
- optReqFlag={"Required"}
29
- >
30
- Home Library
31
- </Label>
32
- <HelperErrorText id="id-helperText" isInvalid={false}>
33
- Select your home library. Start by typing the name of the library. Try{" "}
34
- {'"'}ba{'"'}.
35
- </HelperErrorText>
36
- <Input
37
- type={InputTypes.text}
38
- id="library-autosuggest"
39
- aria-required={true}
40
- aria-labelledby="library-autosuggest-label id-helperText"
41
- attributes={{
42
- name: "homeLibraryName",
43
- ...inputProps,
44
- }}
45
- />
46
- </>
21
+ <TextInput
22
+ attributes={{
23
+ ...inputProps,
24
+ }}
25
+ id="library-autosuggest"
26
+ isRequired
27
+ labelText="Home Library"
28
+ name="homeLibraryName"
29
+ helperText="Select your home library. Start by typing the name of the library. Try 'ba'."
30
+ />
47
31
  );
48
32
  };
49
33
 
@@ -148,20 +132,14 @@ const FishExample = () => {
148
132
  ];
149
133
  const renderInputComponent = (inputProps) => {
150
134
  return (
151
- <>
152
- <Label htmlFor="input-fish-autosuggest" id="fish-autosuggest-label">
153
- Fish in Animal Crossing
154
- </Label>
155
- <Input
156
- type={InputTypes.text}
157
- id="input-fish-autosuggest"
158
- aria-required={false}
159
- attributes={{
160
- name: "favoriteFish",
161
- ...inputProps,
162
- }}
163
- />
164
- </>
135
+ <TextInput
136
+ attributes={{
137
+ ...inputProps,
138
+ }}
139
+ id="library-fish-autosuggest"
140
+ labelText="Fish in Animal Crossing"
141
+ name="favoriteFish"
142
+ />
165
143
  );
166
144
  };
167
145
  const onChange = (_: any, { newValue }) => setValue(newValue);
@@ -218,16 +196,14 @@ const searchBarRenderInputComponent = (
218
196
  inputProps: React.HTMLProps<HTMLInputElement>
219
197
  ) => {
220
198
  return (
221
- <Input
222
- type={InputTypes.text}
223
- id="autosuggest-searchBar"
224
- aria-required={true}
225
- ariaLabelledBy="autosuggest-button"
199
+ <TextInput
226
200
  attributes={{
227
- name: "homeLibraryName",
228
- "aria-describedby": "autosuggest-helperText",
229
201
  ...inputProps,
230
202
  }}
203
+ id="autosuggest-searchBar"
204
+ isRequired
205
+ labelText="home library"
206
+ name="homeLibraryName"
231
207
  />
232
208
  );
233
209
  };
@@ -5,10 +5,6 @@
5
5
  width: 100%;
6
6
  }
7
7
 
8
- .react-autosuggest__input {
9
- @extend .input;
10
- }
11
-
12
8
  .react-autosuggest__input--focused {
13
9
  outline: none;
14
10
  }
@@ -28,9 +24,9 @@
28
24
  background-color: var(--nypl-colors-ui-white);
29
25
  display: block;
30
26
  font-weight: 300;
31
- margin-top: -6px; // accounts for the focus ring on the input
27
+ margin-top: 1px; // accounts for the focus ring on the input
32
28
  outline: 1px solid var(--nypl-colors-ui-gray-light-cool);
33
- position: absolute;
29
+ position: relative;
34
30
  width: 100%;
35
31
  z-index: 2;
36
32
  }
@@ -1,19 +1,25 @@
1
1
  import {
2
- Meta,
3
- Story,
4
- Canvas,
5
2
  ArgsTable,
3
+ Canvas,
6
4
  Description,
7
- } from "@storybook/addon-docs/blocks";
5
+ Meta,
6
+ Story,
7
+ } from "@storybook/addon-docs";
8
8
  import { withDesign } from "storybook-addon-designs";
9
9
 
10
10
  import Breadcrumbs from "./Breadcrumbs";
11
11
  import { ColorVariants } from "./BreadcrumbsTypes";
12
- import DSProvider from "../../theme/provider";
13
12
  import Heading from "../Heading/Heading";
14
13
  import { HeadingLevels } from "../Heading/HeadingTypes";
15
14
  import Link from "../Link/Link";
16
15
  import { getCategory } from "../../utils/componentCategories";
16
+ import DSProvider from "../../theme/provider";
17
+ import { getStorybookEnumValues } from "../../utils/utils";
18
+
19
+ export const enumValues = getStorybookEnumValues(
20
+ ColorVariants,
21
+ "ColorVariants"
22
+ );
17
23
 
18
24
  <Meta
19
25
  title={getCategory("Breadcrumbs")}
@@ -28,8 +34,13 @@ import { getCategory } from "../../utils/componentCategories";
28
34
  }}
29
35
  argTypes={{
30
36
  additionalStyles: { control: false },
31
- className: { table: { disable: true } },
32
- id: { table: { disable: true } },
37
+ breadcrumbsData: { control: false },
38
+ className: { control: false },
39
+ colorVariant: {
40
+ control: { type: "select" },
41
+ options: enumValues.options,
42
+ },
43
+ id: { control: false },
33
44
  }}
34
45
  />
35
46
 
@@ -38,29 +49,48 @@ import { getCategory } from "../../utils/componentCategories";
38
49
  | Component Version | DS Version |
39
50
  | ----------------- | ---------- |
40
51
  | Added | `0.0.3` |
41
- | Latest | `0.25.6` |
52
+ | Latest | `0.25.10` |
42
53
 
43
54
  <Description of={Breadcrumbs} />
44
55
 
45
- The `Breadcrumbs` component is a navigation element that provides a breadcrumb path that reflects the site structure and allows a user to navigate to any page available in the breadcrumb hierarchy.
56
+ The `Breadcrumbs` component is a navigation element that provides a breadcrumb
57
+ path that reflects the site structure and allows a user to navigate to any page
58
+ available in the breadcrumb hierarchy.
46
59
 
47
60
  <Canvas withToolbar>
48
61
  <Story
49
- name="Breadcrumbs Props"
62
+ name="Breadcrumbs with Controls"
50
63
  args={{
64
+ additionalStyles: undefined,
51
65
  breadcrumbsData: [
52
66
  { url: "#", text: "Parent" },
53
67
  { url: "#", text: "Child" },
54
68
  { url: "#", text: "Grandchild" },
55
69
  ],
56
- id: "init-breadcrumbs",
70
+ className: undefined,
71
+ colorVariant: undefined,
72
+ id: "breadcrumbs-id",
57
73
  }}
58
74
  >
59
- {(args) => <Breadcrumbs {...args} />}
75
+ {(args) => (
76
+ <Breadcrumbs
77
+ {...args}
78
+ colorVariant={enumValues.getValue(args.colorVariant)}
79
+ />
80
+ )}
60
81
  </Story>
61
82
  </Canvas>
62
83
 
63
- <ArgsTable story="Breadcrumbs Props" />
84
+ <ArgsTable story="Breadcrumbs with Controls" />
85
+
86
+ ### Accessibility
87
+
88
+ Only one `Breadcrumbs` component should be rendered on a page. This is because
89
+ only one HTML `<nav>` element with `aria-label` attribute of "Breadcrumbs"
90
+ should be rendered. The DS `Breadcrumbs` component renders this HTML landmark
91
+ so only one component must be rendered on a page.
92
+
93
+ - [W3 Breadcrumbs Practice](https://www.w3.org/TR/wai-aria-practices/examples/breadcrumb/index.html)
64
94
 
65
95
  ### Long Titles
66
96
 
@@ -11,12 +11,27 @@ describe("Breadcrumbs Accessibility", () => {
11
11
  { url: "#string1", text: "string1" },
12
12
  { url: "#string2", text: "string2" },
13
13
  ];
14
+
14
15
  it("passes axe accessibility test", async () => {
15
16
  const { container } = render(
16
17
  <Breadcrumbs breadcrumbsData={breadcrumbsData} />
17
18
  );
18
19
  expect(await axe(container)).toHaveNoViolations();
19
20
  });
21
+
22
+ // This fails because there MUST only be one "breadcrumb" landmark item
23
+ // on a page. This specifically means there should be one `<nav>` element
24
+ // with `aria-label="Breadcrumb"`.
25
+ // https://www.w3.org/TR/wai-aria-practices/examples/breadcrumb/index.html
26
+ it("does not pass axe accessibility test", async () => {
27
+ const { container } = render(
28
+ <>
29
+ <Breadcrumbs breadcrumbsData={breadcrumbsData} />
30
+ <Breadcrumbs breadcrumbsData={breadcrumbsData} />
31
+ </>
32
+ );
33
+ expect(await axe(container)).not.toHaveNoViolations();
34
+ });
20
35
  });
21
36
 
22
37
  describe("Breadcrumbs Snapshot", () => {
@@ -50,6 +65,15 @@ describe("Breadcrumbs Snapshot", () => {
50
65
  />
51
66
  )
52
67
  .toJSON();
68
+ const breadcrumbsLocationsVariant = renderer
69
+ .create(
70
+ <Breadcrumbs
71
+ breadcrumbsData={breadcrumbsData}
72
+ colorVariant={ColorVariants.Blogs}
73
+ id="breadcrumbs-test"
74
+ />
75
+ )
76
+ .toJSON();
53
77
  const breadcrumbsAdditionalStyles = renderer
54
78
  .create(
55
79
  <Breadcrumbs
@@ -65,6 +89,7 @@ describe("Breadcrumbs Snapshot", () => {
65
89
  expect(breadcrumbsSnapshot).toMatchSnapshot();
66
90
  expect(breadcrumbsVariantColor).toMatchSnapshot();
67
91
  expect(breadcrumbsBlogsVariant).toMatchSnapshot();
92
+ expect(breadcrumbsLocationsVariant).toMatchSnapshot();
68
93
  expect(breadcrumbsAdditionalStyles).toMatchSnapshot();
69
94
  });
70
95
  });
@@ -6,8 +6,6 @@ import {
6
6
  useStyleConfig,
7
7
  } from "@chakra-ui/react";
8
8
 
9
- import generateUUID from "../../helpers/generateUUID";
10
- import { ColorVariants } from "./BreadcrumbsTypes";
11
9
  import Icon from "../Icons/Icon";
12
10
  import {
13
11
  IconNames,
@@ -15,6 +13,8 @@ import {
15
13
  IconSizes,
16
14
  IconTypes,
17
15
  } from "../Icons/IconTypes";
16
+ import generateUUID from "../../helpers/generateUUID";
17
+ import { ColorVariants } from "./BreadcrumbsTypes";
18
18
  import { getVariant } from "../../utils/utils";
19
19
 
20
20
  export interface BreadcrumbsDataProps {
@@ -83,9 +83,15 @@ function Breadcrumbs(props: React.PropsWithChildren<BreadcrumbProps>) {
83
83
  const styles = useStyleConfig("Breadcrumb", { variant });
84
84
  const finalStyles = { ...styles, ...additionalStyles };
85
85
  const breadcrumbItems = getElementsFromData(breadcrumbsData, id);
86
+ const ariaAttrs = { "aria-label": "Breadcrumb" };
86
87
 
87
88
  return (
88
- <ChakraBreadcrumb className={className} __css={finalStyles} id={id}>
89
+ <ChakraBreadcrumb
90
+ className={className}
91
+ id={id}
92
+ {...ariaAttrs}
93
+ __css={finalStyles}
94
+ >
89
95
  {breadcrumbItems}
90
96
  </ChakraBreadcrumb>
91
97
  );
@@ -2,7 +2,7 @@
2
2
 
3
3
  exports[`Breadcrumbs Snapshot Renders the UI snapshot correctly 1`] = `
4
4
  <nav
5
- aria-label="breadcrumb"
5
+ aria-label="Breadcrumb"
6
6
  className="chakra-breadcrumb css-0"
7
7
  id="breadcrumbs-test"
8
8
  >
@@ -101,7 +101,7 @@ exports[`Breadcrumbs Snapshot Renders the UI snapshot correctly 1`] = `
101
101
 
102
102
  exports[`Breadcrumbs Snapshot Renders the UI snapshot correctly 2`] = `
103
103
  <nav
104
- aria-label="breadcrumb"
104
+ aria-label="Breadcrumb"
105
105
  className="chakra-breadcrumb css-0"
106
106
  id="breadcrumbs-test"
107
107
  >
@@ -200,7 +200,7 @@ exports[`Breadcrumbs Snapshot Renders the UI snapshot correctly 2`] = `
200
200
 
201
201
  exports[`Breadcrumbs Snapshot Renders the UI snapshot correctly 3`] = `
202
202
  <nav
203
- aria-label="breadcrumb"
203
+ aria-label="Breadcrumb"
204
204
  className="chakra-breadcrumb css-0"
205
205
  id="breadcrumbs-test"
206
206
  >
@@ -299,7 +299,106 @@ exports[`Breadcrumbs Snapshot Renders the UI snapshot correctly 3`] = `
299
299
 
300
300
  exports[`Breadcrumbs Snapshot Renders the UI snapshot correctly 4`] = `
301
301
  <nav
302
- aria-label="breadcrumb"
302
+ aria-label="Breadcrumb"
303
+ className="chakra-breadcrumb css-0"
304
+ id="breadcrumbs-test"
305
+ >
306
+ <ol
307
+ className="chakra-breadcrumb__list css-0"
308
+ >
309
+ <li
310
+ className="chakra-breadcrumb__list-item css-18biwo"
311
+ >
312
+ <a
313
+ className="chakra-breadcrumb__link css-0"
314
+ href="#string1"
315
+ >
316
+ <span
317
+ className="breadcrumb-label"
318
+ >
319
+ string1
320
+ </span>
321
+ </a>
322
+ <span
323
+ className="css-t4q1nq"
324
+ role="presentation"
325
+ >
326
+ /
327
+ </span>
328
+ </li>
329
+ <li
330
+ className="chakra-breadcrumb__list-item css-18biwo"
331
+ >
332
+ <a
333
+ className="chakra-breadcrumb__link css-0"
334
+ href="#string2"
335
+ >
336
+ <svg
337
+ aria-hidden={true}
338
+ className="chakra-icon breadcrumbs-icon css-onkibi"
339
+ focusable={false}
340
+ id="breadcrumbs-test__backarrow"
341
+ role="img"
342
+ title="arrow icon"
343
+ viewBox="0 0 24 24"
344
+ >
345
+ <g
346
+ stroke="currentColor"
347
+ strokeWidth="1.5"
348
+ >
349
+ <path
350
+ d="M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"
351
+ fill="none"
352
+ strokeLinecap="round"
353
+ />
354
+ <path
355
+ d="M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"
356
+ fill="currentColor"
357
+ strokeLinecap="round"
358
+ />
359
+ <circle
360
+ cx="12"
361
+ cy="12"
362
+ fill="none"
363
+ r="11.25"
364
+ strokeMiterlimit="10"
365
+ />
366
+ </g>
367
+ </svg>
368
+ <span
369
+ className="breadcrumb-label"
370
+ >
371
+ string2
372
+ </span>
373
+ </a>
374
+ <span
375
+ className="css-t4q1nq"
376
+ role="presentation"
377
+ >
378
+ /
379
+ </span>
380
+ </li>
381
+ <li
382
+ className="chakra-breadcrumb__list-item css-18biwo"
383
+ >
384
+ <span
385
+ aria-current="page"
386
+ className="chakra-breadcrumb__link css-0"
387
+ >
388
+ <span
389
+ className="breadcrumb-label"
390
+ >
391
+ string3
392
+ </span>
393
+ </span>
394
+ </li>
395
+ </ol>
396
+ </nav>
397
+ `;
398
+
399
+ exports[`Breadcrumbs Snapshot Renders the UI snapshot correctly 5`] = `
400
+ <nav
401
+ aria-label="Breadcrumb"
303
402
  className="chakra-breadcrumb css-1f2fw9u"
304
403
  id="breadcrumbs-test"
305
404
  >