@nypl/design-system-react-components 0.25.2 → 0.25.6

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 (238) hide show
  1. package/CHANGELOG.md +101 -0
  2. package/README.md +47 -11
  3. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +4 -0
  4. package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +1 -0
  5. package/dist/components/Button/Button.d.ts +9 -8
  6. package/dist/components/Button/ButtonTypes.d.ts +2 -1
  7. package/dist/components/Card/Card.d.ts +36 -52
  8. package/dist/components/Card/CardTypes.d.ts +0 -15
  9. package/dist/components/Checkbox/Checkbox.d.ts +8 -9
  10. package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +2 -2
  11. package/dist/components/DatePicker/DatePicker.d.ts +36 -36
  12. package/dist/components/Fieldset/Fieldset.d.ts +25 -0
  13. package/dist/components/HelperErrorText/HelperErrorText.d.ts +4 -0
  14. package/dist/components/HorizontalRule/HorizontalRule.d.ts +10 -3
  15. package/dist/components/Icons/Icon.d.ts +4 -0
  16. package/dist/components/Icons/IconSvgs.d.ts +11 -0
  17. package/dist/components/Icons/IconTypes.d.ts +11 -0
  18. package/dist/components/Image/Image.d.ts +19 -9
  19. package/dist/components/Image/ImageTypes.d.ts +20 -0
  20. package/dist/components/Link/Link.d.ts +4 -0
  21. package/dist/components/List/List.d.ts +7 -1
  22. package/dist/components/Notification/Notification.d.ts +6 -4
  23. package/dist/components/Pagination/Pagination.d.ts +16 -13
  24. package/dist/components/Pagination/Pagination.stories.d.ts +2 -0
  25. package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +29 -0
  26. package/dist/components/ProgressIndicator/ProgressIndicatorTypes.d.ts +8 -0
  27. package/dist/components/RadioGroup/RadioGroup.d.ts +2 -2
  28. package/dist/components/SearchBar/SearchBar.d.ts +3 -3
  29. package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +18 -14
  30. package/dist/components/Slider/Slider.d.ts +57 -0
  31. package/dist/components/Tabs/Tabs.d.ts +1 -1
  32. package/dist/components/TextInput/TextInput.d.ts +10 -0
  33. package/dist/design-system-react-components.cjs.development.js +3058 -936
  34. package/dist/design-system-react-components.cjs.development.js.map +1 -1
  35. package/dist/design-system-react-components.cjs.production.min.js +1 -1
  36. package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
  37. package/dist/design-system-react-components.esm.js +3049 -921
  38. package/dist/design-system-react-components.esm.js.map +1 -1
  39. package/dist/index.d.ts +12 -6
  40. package/dist/resources.scss +180 -170
  41. package/dist/styles.css +1 -1
  42. package/dist/theme/components/breadcrumb.d.ts +9 -0
  43. package/dist/theme/components/button.d.ts +22 -8
  44. package/dist/theme/components/card.d.ts +168 -0
  45. package/dist/theme/components/checkbox.d.ts +5 -1
  46. package/dist/theme/components/checkboxGroup.d.ts +12 -0
  47. package/dist/theme/components/datePicker.d.ts +16 -0
  48. package/dist/theme/components/fieldset.d.ts +27 -0
  49. package/dist/theme/components/global.d.ts +23 -13
  50. package/dist/theme/components/globalMixins.d.ts +9 -1
  51. package/dist/theme/components/heading.d.ts +5 -0
  52. package/dist/theme/components/image.d.ts +31 -0
  53. package/dist/theme/components/label.d.ts +5 -3
  54. package/dist/theme/components/link.d.ts +4 -0
  55. package/dist/theme/components/list.d.ts +5 -1
  56. package/dist/theme/components/notification.d.ts +4 -14
  57. package/dist/theme/components/pagination.d.ts +19 -0
  58. package/dist/theme/components/progressIndicator.d.ts +50 -0
  59. package/dist/theme/components/radioGroup.d.ts +12 -0
  60. package/dist/theme/components/select.d.ts +11 -2
  61. package/dist/theme/components/skeletonLoader.d.ts +98 -0
  62. package/dist/theme/components/slider.d.ts +51 -0
  63. package/dist/theme/components/textInput.d.ts +8 -0
  64. package/dist/theme/foundations/breakpoints.d.ts +8 -8
  65. package/dist/theme/foundations/global.d.ts +6 -1
  66. package/package.json +72 -84
  67. package/src/__tests__/setup.ts +2 -2
  68. package/src/components/Accordion/Accordion.stories.mdx +39 -42
  69. package/src/components/Autosuggest/Autosuggest.stories.mdx +3 -3
  70. package/src/components/Autosuggest/Autosuggest.stories.tsx +1 -0
  71. package/src/components/Autosuggest/_Autosuggest.scss +5 -5
  72. package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +24 -8
  73. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +33 -0
  74. package/src/components/Breadcrumbs/Breadcrumbs.tsx +5 -1
  75. package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +1 -0
  76. package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +298 -1
  77. package/src/components/Button/Button.stories.mdx +15 -10
  78. package/src/components/Button/Button.test.tsx +21 -7
  79. package/src/components/Button/Button.tsx +18 -33
  80. package/src/components/Button/ButtonTypes.tsx +1 -0
  81. package/src/components/Button/__snapshots__/Button.test.tsx.snap +41 -10
  82. package/src/components/Card/Card.stories.mdx +296 -259
  83. package/src/components/Card/Card.test.tsx +156 -84
  84. package/src/components/Card/Card.tsx +195 -145
  85. package/src/components/Card/CardTypes.tsx +0 -17
  86. package/src/components/Card/__snapshots__/Card.test.tsx.snap +410 -0
  87. package/src/components/CardEdition/CardEdition.stories.tsx +15 -47
  88. package/src/components/CardEdition/_CardEdition.scss +22 -23
  89. package/src/components/Chakra/Box.stories.mdx +14 -15
  90. package/src/components/Chakra/Center.stories.mdx +15 -8
  91. package/src/components/Chakra/Grid.stories.mdx +16 -7
  92. package/src/components/Chakra/Stack.stories.mdx +35 -18
  93. package/src/components/Checkbox/Checkbox.stories.mdx +33 -11
  94. package/src/components/Checkbox/Checkbox.test.tsx +30 -3
  95. package/src/components/Checkbox/Checkbox.tsx +27 -27
  96. package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +90 -2
  97. package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +82 -2
  98. package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +1 -1
  99. package/src/components/CheckboxGroup/CheckboxGroup.tsx +14 -15
  100. package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +44 -80
  101. package/src/components/DatePicker/DatePicker.stories.mdx +163 -62
  102. package/src/components/DatePicker/DatePicker.test.tsx +248 -65
  103. package/src/components/DatePicker/DatePicker.tsx +158 -130
  104. package/src/components/DatePicker/_DatePicker.scss +33 -67
  105. package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +818 -0
  106. package/src/components/Fieldset/Fieldset.stories.mdx +55 -0
  107. package/src/components/Fieldset/Fieldset.test.tsx +125 -0
  108. package/src/components/Fieldset/Fieldset.tsx +52 -0
  109. package/src/components/Fieldset/__snapshots__/Fieldset.test.tsx.snap +68 -0
  110. package/src/components/Form/Form.stories.mdx +4 -5
  111. package/src/components/Form/Form.tsx +1 -0
  112. package/src/components/Grid/SimpleGrid.stories.mdx +32 -39
  113. package/src/components/Grid/SimpleGrid.test.tsx +4 -4
  114. package/src/components/Heading/Heading.stories.mdx +3 -4
  115. package/src/components/HelperErrorText/HelperErrorText.stories.mdx +1 -1
  116. package/src/components/HelperErrorText/HelperErrorText.tsx +5 -1
  117. package/src/components/Hero/HeroTypes.tsx +1 -0
  118. package/src/components/Hero/__snapshots__/Hero.test.tsx.snap +7 -7
  119. package/src/components/HorizontalRule/HorizontalRule.stories.mdx +6 -5
  120. package/src/components/HorizontalRule/HorizontalRule.test.tsx +17 -0
  121. package/src/components/HorizontalRule/HorizontalRule.tsx +21 -4
  122. package/src/components/HorizontalRule/__snapshots__/HorizontalRule.test.tsx.snap +5 -5
  123. package/src/components/Icons/Icon.stories.mdx +11 -3
  124. package/src/components/Icons/Icon.test.tsx +18 -0
  125. package/src/components/Icons/Icon.tsx +6 -0
  126. package/src/components/Icons/IconSvgs.tsx +22 -0
  127. package/src/components/Icons/IconTypes.tsx +11 -0
  128. package/src/components/Image/Image.stories.mdx +220 -0
  129. package/src/components/Image/Image.test.tsx +131 -29
  130. package/src/components/Image/Image.tsx +84 -56
  131. package/src/components/Image/ImageTypes.ts +22 -0
  132. package/src/components/Image/__snapshots__/Image.test.tsx.snap +190 -0
  133. package/src/components/Input/Input.stories.tsx +20 -64
  134. package/src/components/Input/_Input.scss +23 -14
  135. package/src/components/Link/Link.tsx +4 -1
  136. package/src/components/List/List.stories.mdx +1 -1
  137. package/src/components/List/List.tsx +11 -4
  138. package/src/components/Modal/Modal.stories.mdx +3 -3
  139. package/src/components/Modal/_Modal.scss +2 -2
  140. package/src/components/Notification/Notification.stories.mdx +1 -3
  141. package/src/components/Notification/Notification.tsx +24 -9
  142. package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +2 -0
  143. package/src/components/Pagination/Pagination.stories.mdx +26 -27
  144. package/src/components/Pagination/Pagination.stories.tsx +11 -16
  145. package/src/components/Pagination/Pagination.test.tsx +276 -146
  146. package/src/components/Pagination/Pagination.tsx +174 -154
  147. package/src/components/Pagination/__snapshots__/Pagination.test.tsx.snap +285 -0
  148. package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +292 -0
  149. package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +225 -0
  150. package/src/components/ProgressIndicator/ProgressIndicator.tsx +126 -0
  151. package/src/components/ProgressIndicator/ProgressIndicatorTypes.ts +8 -0
  152. package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +357 -0
  153. package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +3 -0
  154. package/src/components/RadioGroup/RadioGroup.stories.mdx +3 -4
  155. package/src/components/RadioGroup/RadioGroup.tsx +11 -16
  156. package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +39 -71
  157. package/src/components/SearchBar/SearchBar.Test.tsx +66 -21
  158. package/src/components/SearchBar/SearchBar.stories.mdx +114 -10
  159. package/src/components/SearchBar/SearchBar.tsx +15 -5
  160. package/src/components/Select/SelectTypes.tsx +1 -0
  161. package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +28 -59
  162. package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +97 -177
  163. package/src/components/SkeletonLoader/SkeletonLoader.tsx +74 -71
  164. package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +739 -0
  165. package/src/components/Slider/Slider.stories.mdx +529 -0
  166. package/src/components/Slider/Slider.test.tsx +653 -0
  167. package/src/components/Slider/Slider.tsx +303 -0
  168. package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +1946 -0
  169. package/src/components/StyleGuide/Bidirectionality.stories.mdx +1 -1
  170. package/src/components/StyleGuide/Breakpoints.stories.mdx +21 -7
  171. package/src/components/StyleGuide/Buttons.stories.mdx +69 -15
  172. package/src/components/StyleGuide/ColorCard.tsx +0 -1
  173. package/src/components/StyleGuide/DesignTokens.stories.mdx +170 -0
  174. package/src/components/StyleGuide/Iconography.stories.mdx +51 -62
  175. package/src/components/Tabs/Tabs.tsx +5 -5
  176. package/src/components/Template/Template.stories.mdx +11 -16
  177. package/src/components/TextInput/TextInput.stories.mdx +1 -1
  178. package/src/components/TextInput/TextInput.tsx +23 -6
  179. package/src/components/TextInput/TextInputTypes.tsx +2 -0
  180. package/src/components/VideoPlayer/VideoPlayer.stories.mdx +2 -3
  181. package/src/docs/Chakra.stories.mdx +2 -2
  182. package/src/index.ts +20 -12
  183. package/src/resources.scss +5 -5
  184. package/src/styles/base/{_02-breakpoints.scss → _01-breakpoints.scss} +9 -10
  185. package/src/styles/base/{_03-mixins.scss → _02-mixins.scss} +16 -5
  186. package/src/styles/base/{_04-base.scss → _03-base.scss} +7 -2
  187. package/src/styles/base/{_05-focus.scss → _04-focus.scss} +0 -15
  188. package/src/styles/base/_place-holder.scss +14 -3
  189. package/src/styles/{03-space → space}/_space-inline.scss +14 -14
  190. package/src/styles/{03-space → space}/_space-inset.scss +10 -10
  191. package/src/styles/space/_space-stack.scss +116 -0
  192. package/src/styles.scss +13 -55
  193. package/src/theme/components/breadcrumb.ts +10 -0
  194. package/src/theme/components/button.ts +18 -12
  195. package/src/theme/components/card.ts +174 -0
  196. package/src/theme/components/checkbox.ts +7 -2
  197. package/src/theme/components/checkboxGroup.ts +8 -0
  198. package/src/theme/components/datePicker.ts +17 -0
  199. package/src/theme/components/fieldset.ts +18 -0
  200. package/src/theme/components/global.ts +26 -15
  201. package/src/theme/components/globalMixins.ts +9 -1
  202. package/src/theme/components/heading.ts +5 -0
  203. package/src/theme/components/image.ts +116 -0
  204. package/src/theme/components/label.ts +3 -10
  205. package/src/theme/components/link.ts +4 -0
  206. package/src/theme/components/list.ts +6 -3
  207. package/src/theme/components/notification.ts +12 -14
  208. package/src/theme/components/pagination.ts +20 -0
  209. package/src/theme/components/progressIndicator.ts +62 -0
  210. package/src/theme/components/radioGroup.ts +8 -0
  211. package/src/theme/components/select.ts +5 -2
  212. package/src/theme/components/skeletonLoader.ts +107 -0
  213. package/src/theme/components/slider.ts +79 -0
  214. package/src/theme/components/textInput.ts +2 -0
  215. package/src/theme/foundations/breakpoints.ts +8 -8
  216. package/src/theme/foundations/global.ts +6 -1
  217. package/src/theme/index.ts +22 -4
  218. package/src/utils/componentCategories.ts +4 -3
  219. package/dist/components/Image/Image.stories.d.ts +0 -18
  220. package/dist/theme/components/customCheckboxGroup.d.ts +0 -18
  221. package/dist/theme/components/customRadioGroup.d.ts +0 -18
  222. package/src/components/Button/_Button.scss +0 -32
  223. package/src/components/Card/_Card.scss +0 -308
  224. package/src/components/Image/Image.stories.tsx +0 -54
  225. package/src/components/Image/_Image.scss +0 -38
  226. package/src/components/Pagination/_Pagination.scss +0 -40
  227. package/src/components/SkeletonLoader/_SkeletonLoader.scss +0 -142
  228. package/src/styles/01-colors/_colors-brand.scss +0 -62
  229. package/src/styles/01-colors/_colors-utility.scss +0 -67
  230. package/src/styles/02-typography/_type-scale.css +0 -11
  231. package/src/styles/02-typography/_type-weight.css +0 -7
  232. package/src/styles/02-typography/_typefaces.css +0 -4
  233. package/src/styles/03-space/_space-stack.scss +0 -116
  234. package/src/styles/03-space/_space.css +0 -30
  235. package/src/styles/base/_card-grid.scss +0 -77
  236. package/src/styles/base/_typography.scss +0 -11
  237. package/src/theme/components/customCheckboxGroup.ts +0 -12
  238. package/src/theme/components/customRadioGroup.ts +0 -12
@@ -8,7 +8,8 @@ import {
8
8
  import Accordion from "./Accordion";
9
9
  import { withDesign } from "storybook-addon-designs";
10
10
  import Card, { CardHeading, CardContent } from "../Card/Card";
11
- import { CardImageRatios, CardLayouts } from "../Card/CardTypes";
11
+ import { CardLayouts } from "../Card/CardTypes";
12
+ import { ImageRatios } from "../Image/ImageTypes";
12
13
  import { HeadingLevels } from "../Heading/HeadingTypes";
13
14
  import { Source } from "@storybook/addon-docs/blocks";
14
15
  import ReactDOMServer from "react-dom/server";
@@ -59,36 +60,32 @@ necessary icon, Chakra components, and styles.
59
60
  name="Basic"
60
61
  args={{
61
62
  isDefaultOpen: false,
63
+ contentData: [
64
+ {
65
+ label: "Tom Nook",
66
+ panel: (
67
+ <Card
68
+ layout={CardLayouts.Row}
69
+ center
70
+ imageSrc="https://play.nintendo.com/images/AC_Tom_FRYtwIN.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png"
71
+ imageAlt="Alt text"
72
+ imageAspectRatio={ImageRatios.TwoByOne}
73
+ >
74
+ <CardHeading level={HeadingLevels.Four} id="heading1">
75
+ Tom Nook
76
+ </CardHeading>
77
+ <CardContent>
78
+ Tom Nook, <b>known in Japan as Tanukichi</b>, is a fictional
79
+ character in the Animal Crossing series who operates the village
80
+ store.
81
+ </CardContent>
82
+ </Card>
83
+ ),
84
+ },
85
+ ],
62
86
  }}
63
87
  >
64
- {(args) => (
65
- <Accordion
66
- {...args}
67
- contentData={[
68
- {
69
- label: "Tom Nook",
70
- panel: (
71
- <Card
72
- layout={CardLayouts.Row}
73
- center
74
- imageSrc="https://play.nintendo.com/images/AC_Tom_FRYtwIN.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png"
75
- imageAlt="Alt text"
76
- imageAspectRatio={CardImageRatios.TwoByOne}
77
- >
78
- <CardHeading level={HeadingLevels.Four} id="heading1">
79
- Tom Nook
80
- </CardHeading>
81
- <CardContent>
82
- Tom Nook, <b>known in Japan as Tanukichi</b>, is a fictional
83
- character in the Animal Crossing series who operates the
84
- village store.
85
- </CardContent>
86
- </Card>
87
- ),
88
- },
89
- ]}
90
- />
91
- )}
88
+ {(args) => <Accordion {...args} />}
92
89
  </Story>
93
90
  </Canvas>
94
91
 
@@ -102,7 +99,7 @@ const contentData = [
102
99
  center
103
100
  imageSrc="https://play.nintendo.com/images/AC_Tom_FRYtwIN.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png"
104
101
  imageAlt="Alt text"
105
- imageAspectRatio={CardImageRatios.TwoByOne}
102
+ imageAspectRatio={ImageRatios.TwoByOne}
106
103
  >
107
104
  <CardHeading level={HeadingLevels.Four} id="heading1">
108
105
  Tom Nook
@@ -135,9 +132,9 @@ export const faqContent = [
135
132
  center
136
133
  imageSrc="https://play.nintendo.com/images/AC_Tom_FRYtwIN.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png"
137
134
  imageAlt="Alt text"
138
- imageAspectRatio={CardImageRatios.TwoByOne}
135
+ imageAspectRatio={ImageRatios.TwoByOne}
139
136
  >
140
- <CardHeading level={HeadingLevels.Four} id="heading1">
137
+ <CardHeading level={HeadingLevels.Four} id="heading1-tom">
141
138
  Tom Nook
142
139
  </CardHeading>
143
140
  <CardContent>
@@ -155,9 +152,9 @@ export const faqContent = [
155
152
  center
156
153
  imageSrc="https://play.nintendo.com/images/AC_Isabelle_7XU6aGu.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png"
157
154
  imageAlt="Alt text"
158
- imageAspectRatio={CardImageRatios.TwoByOne}
155
+ imageAspectRatio={ImageRatios.TwoByOne}
159
156
  >
160
- <CardHeading level={HeadingLevels.Four} id="heading1">
157
+ <CardHeading level={HeadingLevels.Four} id="heading1-isabelle">
161
158
  Isabelle
162
159
  </CardHeading>
163
160
  <CardContent>
@@ -177,9 +174,9 @@ export const faqContent = [
177
174
  center
178
175
  imageSrc="https://play.nintendo.com/images/AC_KK_jh4yj5t.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png"
179
176
  imageAlt="Alt text"
180
- imageAspectRatio={CardImageRatios.TwoByOne}
177
+ imageAspectRatio={ImageRatios.TwoByOne}
181
178
  >
182
- <CardHeading level={HeadingLevels.Four} id="heading1">
179
+ <CardHeading level={HeadingLevels.Four} id="heading1-kkslider">
183
180
  K.K. Slider
184
181
  </CardHeading>
185
182
  <CardContent>
@@ -214,9 +211,9 @@ export const faqContent = [
214
211
  center
215
212
  imageSrc="https://play.nintendo.com/images/AC_Tom_FRYtwIN.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png"
216
213
  imageAlt="Alt text"
217
- imageAspectRatio={CardImageRatios.TwoByOne}
214
+ imageAspectRatio={ImageRatios.TwoByOne}
218
215
  >
219
- <CardHeading level={HeadingLevels.Four} id="heading1">
216
+ <CardHeading level={HeadingLevels.Four} id="heading1-tom">
220
217
  Tom Nook
221
218
  </CardHeading>
222
219
  <CardContent>
@@ -234,9 +231,9 @@ export const faqContent = [
234
231
  center
235
232
  imageSrc="https://play.nintendo.com/images/AC_Isabelle_7XU6aGu.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png"
236
233
  imageAlt="Alt text"
237
- imageAspectRatio={CardImageRatios.TwoByOne}
234
+ imageAspectRatio={ImageRatios.TwoByOne}
238
235
  >
239
- <CardHeading level={HeadingLevels.Four} id="heading1">
236
+ <CardHeading level={HeadingLevels.Four} id="heading1-isabelle">
240
237
  Isabelle
241
238
  </CardHeading>
242
239
  <CardContent>
@@ -256,9 +253,9 @@ export const faqContent = [
256
253
  center
257
254
  imageSrc="https://play.nintendo.com/images/AC_KK_jh4yj5t.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png"
258
255
  imageAlt="Alt text"
259
- imageAspectRatio={CardImageRatios.TwoByOne}
256
+ imageAspectRatio={ImageRatios.TwoByOne}
260
257
  >
261
- <CardHeading level={HeadingLevels.Four} id="heading1">
258
+ <CardHeading level={HeadingLevels.Four} id="heading1-kkslider">
262
259
  K.K. Slider
263
260
  </CardHeading>
264
261
  <CardContent>
@@ -1,4 +1,4 @@
1
- import { Meta, Story, Preview } from "@storybook/addon-docs/blocks";
1
+ import { Meta, Story, Canvas } from "@storybook/addon-docs/blocks";
2
2
  import Autosuggest from "react-autosuggest";
3
3
  import * as stories from "./Autosuggest.stories.tsx";
4
4
  import { getCategory } from "../../utils/componentCategories";
@@ -19,9 +19,9 @@ every input element. Since the suggestion dropdown will appear on top of page co
19
19
  we've added a min-height to make it easier to see the dropdown. This is for demonstration
20
20
  purposes only and you will not need to do this in your application.
21
21
 
22
- <Preview withToolbar>
22
+ <Canvas withToolbar>
23
23
  <Story name="Basic" story={stories.AutosuggestLibrary} />
24
- </Preview>
24
+ </Canvas>
25
25
 
26
26
  ## With custom icons
27
27
 
@@ -99,6 +99,7 @@ const LibraryExample = ({ renderInputComponent }) => {
99
99
  const renderSuggestion = (suggestion) => <span>{suggestion.label}</span>;
100
100
  // Autosuggest will pass through all these props to the Input component.
101
101
  const inputProps = {
102
+ "aria-label": "Home Library",
102
103
  placeholder: "Type a library name",
103
104
  value,
104
105
  onChange,
@@ -25,11 +25,11 @@
25
25
  }
26
26
 
27
27
  .react-autosuggest__suggestions-container--open {
28
- background-color: var(--ui-white);
28
+ background-color: var(--nypl-colors-ui-white);
29
29
  display: block;
30
30
  font-weight: 300;
31
31
  margin-top: -6px; // accounts for the focus ring on the input
32
- outline: 1px solid var(--ui-gray-light-cool);
32
+ outline: 1px solid var(--nypl-colors-ui-gray-light-cool);
33
33
  position: absolute;
34
34
  width: 100%;
35
35
  z-index: 2;
@@ -43,13 +43,13 @@
43
43
 
44
44
  .react-autosuggest__suggestion {
45
45
  cursor: pointer;
46
- padding: var(--space-xs);
46
+ padding: var(--nypl-space-xs);
47
47
  }
48
48
 
49
49
  .react-autosuggest__suggestion--highlighted {
50
- background-color: var(--ui-gray-light-cool);
50
+ background-color: var(--nypl-colors-ui-gray-light-cool);
51
51
  }
52
52
 
53
53
  .auto-suggest-bottom {
54
- padding: var(--space-xs);
54
+ padding: var(--nypl-space-xs);
55
55
  }
@@ -22,14 +22,14 @@ import { getCategory } from "../../utils/componentCategories";
22
22
  parameters={{
23
23
  design: {
24
24
  type: "figma",
25
- url:
26
- "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Main?node-id=10766%3A1031",
25
+ url: "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Main?node-id=10766%3A1031",
27
26
  },
28
27
  jest: ["Breadcrumbs.test.tsx"],
29
28
  }}
30
29
  argTypes={{
31
- id: { table: { disable: true } },
30
+ additionalStyles: { control: false },
32
31
  className: { table: { disable: true } },
32
+ id: { table: { disable: true } },
33
33
  }}
34
34
  />
35
35
 
@@ -38,7 +38,7 @@ import { getCategory } from "../../utils/componentCategories";
38
38
  | Component Version | DS Version |
39
39
  | ----------------- | ---------- |
40
40
  | Added | `0.0.3` |
41
- | Latest | `0.25.1` |
41
+ | Latest | `0.25.6` |
42
42
 
43
43
  <Description of={Breadcrumbs} />
44
44
 
@@ -76,8 +76,7 @@ The `Breadcrumbs` component is a navigation element that provides a breadcrumb p
76
76
  },
77
77
  {
78
78
  url: "#",
79
- text:
80
- "Great-Grandchild with the Longest Name That Will Wrap onto the Second Line of the Breadcrumb Component Under the Right Circumstances",
79
+ text: "Great-Grandchild with the Longest Name That Will Wrap onto the Second Line of the Breadcrumb Component Under the Right Circumstances",
81
80
  },
82
81
  ]}
83
82
  />
@@ -92,12 +91,12 @@ The `Breadcrumbs` component background color can be set using the `colorVariant`
92
91
  <Story
93
92
  name="Color Variations"
94
93
  args={{
95
- colorVariant: ColorVariants.BooksAndMore,
94
+ colorVariant: ColorVariants.Blogs,
96
95
  }}
97
96
  >
98
97
  {(args) => (
99
98
  <>
100
- <Heading level={HeadingLevels.Three}>Books and More</Heading>
99
+ <Heading level={HeadingLevels.Three}>Blogs</Heading>
101
100
  <Breadcrumbs
102
101
  breadcrumbsData={[
103
102
  { url: "#", text: "Parent" },
@@ -114,6 +113,23 @@ The `Breadcrumbs` component background color can be set using the `colorVariant`
114
113
  </Story>
115
114
  </Canvas>
116
115
 
116
+ <Canvas>
117
+ <DSProvider>
118
+ <Heading level={HeadingLevels.Three}>Books and More</Heading>
119
+ <Breadcrumbs
120
+ breadcrumbsData={[
121
+ { url: "#", text: "Parent" },
122
+ { url: "#", text: "Child" },
123
+ {
124
+ url: "#",
125
+ text: "Grandchild",
126
+ },
127
+ ]}
128
+ colorVariant={ColorVariants.BooksAndMore}
129
+ />
130
+ </DSProvider>
131
+ </Canvas>
132
+
117
133
  <Canvas>
118
134
  <DSProvider>
119
135
  <Heading level={HeadingLevels.Three}>Locations</Heading>
@@ -4,6 +4,7 @@ import renderer from "react-test-renderer";
4
4
  import { axe } from "jest-axe";
5
5
 
6
6
  import Breadcrumbs from "./Breadcrumbs";
7
+ import { ColorVariants } from "./BreadcrumbsTypes";
7
8
 
8
9
  describe("Breadcrumbs Accessibility", () => {
9
10
  const breadcrumbsData = [
@@ -31,8 +32,40 @@ describe("Breadcrumbs Snapshot", () => {
31
32
  <Breadcrumbs id="breadcrumbs-test" breadcrumbsData={breadcrumbsData} />
32
33
  )
33
34
  .toJSON();
35
+ const breadcrumbsVariantColor = renderer
36
+ .create(
37
+ <Breadcrumbs
38
+ breadcrumbsData={breadcrumbsData}
39
+ colorVariant={ColorVariants.BooksAndMore}
40
+ id="breadcrumbs-test"
41
+ />
42
+ )
43
+ .toJSON();
44
+ const breadcrumbsBlogsVariant = renderer
45
+ .create(
46
+ <Breadcrumbs
47
+ breadcrumbsData={breadcrumbsData}
48
+ colorVariant={ColorVariants.Blogs}
49
+ id="breadcrumbs-test"
50
+ />
51
+ )
52
+ .toJSON();
53
+ const breadcrumbsAdditionalStyles = renderer
54
+ .create(
55
+ <Breadcrumbs
56
+ additionalStyles={{
57
+ bg: "var(--nypl-colors-ui-error-primary)",
58
+ }}
59
+ breadcrumbsData={breadcrumbsData}
60
+ id="breadcrumbs-test"
61
+ />
62
+ )
63
+ .toJSON();
34
64
 
35
65
  expect(breadcrumbsSnapshot).toMatchSnapshot();
66
+ expect(breadcrumbsVariantColor).toMatchSnapshot();
67
+ expect(breadcrumbsBlogsVariant).toMatchSnapshot();
68
+ expect(breadcrumbsAdditionalStyles).toMatchSnapshot();
36
69
  });
37
70
  });
38
71
 
@@ -23,6 +23,8 @@ export interface BreadcrumbsDataProps {
23
23
  }
24
24
 
25
25
  export interface BreadcrumbProps {
26
+ /** Optionally pass in additional Chakra-based styles. */
27
+ additionalStyles?: { [key: string]: any };
26
28
  /** Breadcrumb links as an array */
27
29
  breadcrumbsData: BreadcrumbsDataProps[];
28
30
  /** className you can add in addition to 'input' */
@@ -64,6 +66,7 @@ const getElementsFromData = (data, breadcrumbsID) => {
64
66
 
65
67
  function Breadcrumbs(props: React.PropsWithChildren<BreadcrumbProps>) {
66
68
  const {
69
+ additionalStyles = {},
67
70
  breadcrumbsData,
68
71
  className,
69
72
  colorVariant,
@@ -78,10 +81,11 @@ function Breadcrumbs(props: React.PropsWithChildren<BreadcrumbProps>) {
78
81
  }
79
82
 
80
83
  const styles = useStyleConfig("Breadcrumb", { variant });
84
+ const finalStyles = { ...styles, ...additionalStyles };
81
85
  const breadcrumbItems = getElementsFromData(breadcrumbsData, id);
82
86
 
83
87
  return (
84
- <ChakraBreadcrumb className={className} __css={styles} id={id}>
88
+ <ChakraBreadcrumb className={className} __css={finalStyles} id={id}>
85
89
  {breadcrumbItems}
86
90
  </ChakraBreadcrumb>
87
91
  );
@@ -1,4 +1,5 @@
1
1
  export enum ColorVariants {
2
+ Blogs = "blogs",
2
3
  BooksAndMore = "booksAndMore",
3
4
  Locations = "locations",
4
5
  Research = "research",
@@ -42,6 +42,304 @@ exports[`Breadcrumbs Snapshot Renders the UI snapshot correctly 1`] = `
42
42
  focusable={false}
43
43
  id="breadcrumbs-test__backarrow"
44
44
  role="img"
45
+ title="arrow icon"
46
+ viewBox="0 0 24 24"
47
+ >
48
+ <g
49
+ stroke="currentColor"
50
+ strokeWidth="1.5"
51
+ >
52
+ <path
53
+ d="M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"
54
+ fill="none"
55
+ strokeLinecap="round"
56
+ />
57
+ <path
58
+ d="M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"
59
+ fill="currentColor"
60
+ strokeLinecap="round"
61
+ />
62
+ <circle
63
+ cx="12"
64
+ cy="12"
65
+ fill="none"
66
+ r="11.25"
67
+ strokeMiterlimit="10"
68
+ />
69
+ </g>
70
+ </svg>
71
+ <span
72
+ className="breadcrumb-label"
73
+ >
74
+ string2
75
+ </span>
76
+ </a>
77
+ <span
78
+ className="css-t4q1nq"
79
+ role="presentation"
80
+ >
81
+ /
82
+ </span>
83
+ </li>
84
+ <li
85
+ className="chakra-breadcrumb__list-item css-18biwo"
86
+ >
87
+ <span
88
+ aria-current="page"
89
+ className="chakra-breadcrumb__link css-0"
90
+ >
91
+ <span
92
+ className="breadcrumb-label"
93
+ >
94
+ string3
95
+ </span>
96
+ </span>
97
+ </li>
98
+ </ol>
99
+ </nav>
100
+ `;
101
+
102
+ exports[`Breadcrumbs Snapshot Renders the UI snapshot correctly 2`] = `
103
+ <nav
104
+ aria-label="breadcrumb"
105
+ className="chakra-breadcrumb css-0"
106
+ id="breadcrumbs-test"
107
+ >
108
+ <ol
109
+ className="chakra-breadcrumb__list css-0"
110
+ >
111
+ <li
112
+ className="chakra-breadcrumb__list-item css-18biwo"
113
+ >
114
+ <a
115
+ className="chakra-breadcrumb__link css-0"
116
+ href="#string1"
117
+ >
118
+ <span
119
+ className="breadcrumb-label"
120
+ >
121
+ string1
122
+ </span>
123
+ </a>
124
+ <span
125
+ className="css-t4q1nq"
126
+ role="presentation"
127
+ >
128
+ /
129
+ </span>
130
+ </li>
131
+ <li
132
+ className="chakra-breadcrumb__list-item css-18biwo"
133
+ >
134
+ <a
135
+ className="chakra-breadcrumb__link css-0"
136
+ href="#string2"
137
+ >
138
+ <svg
139
+ aria-hidden={true}
140
+ className="chakra-icon breadcrumbs-icon css-onkibi"
141
+ focusable={false}
142
+ id="breadcrumbs-test__backarrow"
143
+ role="img"
144
+ title="arrow icon"
145
+ viewBox="0 0 24 24"
146
+ >
147
+ <g
148
+ stroke="currentColor"
149
+ strokeWidth="1.5"
150
+ >
151
+ <path
152
+ d="M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"
153
+ fill="none"
154
+ strokeLinecap="round"
155
+ />
156
+ <path
157
+ d="M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"
158
+ fill="currentColor"
159
+ strokeLinecap="round"
160
+ />
161
+ <circle
162
+ cx="12"
163
+ cy="12"
164
+ fill="none"
165
+ r="11.25"
166
+ strokeMiterlimit="10"
167
+ />
168
+ </g>
169
+ </svg>
170
+ <span
171
+ className="breadcrumb-label"
172
+ >
173
+ string2
174
+ </span>
175
+ </a>
176
+ <span
177
+ className="css-t4q1nq"
178
+ role="presentation"
179
+ >
180
+ /
181
+ </span>
182
+ </li>
183
+ <li
184
+ className="chakra-breadcrumb__list-item css-18biwo"
185
+ >
186
+ <span
187
+ aria-current="page"
188
+ className="chakra-breadcrumb__link css-0"
189
+ >
190
+ <span
191
+ className="breadcrumb-label"
192
+ >
193
+ string3
194
+ </span>
195
+ </span>
196
+ </li>
197
+ </ol>
198
+ </nav>
199
+ `;
200
+
201
+ exports[`Breadcrumbs Snapshot Renders the UI snapshot correctly 3`] = `
202
+ <nav
203
+ aria-label="breadcrumb"
204
+ className="chakra-breadcrumb css-0"
205
+ id="breadcrumbs-test"
206
+ >
207
+ <ol
208
+ className="chakra-breadcrumb__list css-0"
209
+ >
210
+ <li
211
+ className="chakra-breadcrumb__list-item css-18biwo"
212
+ >
213
+ <a
214
+ className="chakra-breadcrumb__link css-0"
215
+ href="#string1"
216
+ >
217
+ <span
218
+ className="breadcrumb-label"
219
+ >
220
+ string1
221
+ </span>
222
+ </a>
223
+ <span
224
+ className="css-t4q1nq"
225
+ role="presentation"
226
+ >
227
+ /
228
+ </span>
229
+ </li>
230
+ <li
231
+ className="chakra-breadcrumb__list-item css-18biwo"
232
+ >
233
+ <a
234
+ className="chakra-breadcrumb__link css-0"
235
+ href="#string2"
236
+ >
237
+ <svg
238
+ aria-hidden={true}
239
+ className="chakra-icon breadcrumbs-icon css-onkibi"
240
+ focusable={false}
241
+ id="breadcrumbs-test__backarrow"
242
+ role="img"
243
+ title="arrow icon"
244
+ viewBox="0 0 24 24"
245
+ >
246
+ <g
247
+ stroke="currentColor"
248
+ strokeWidth="1.5"
249
+ >
250
+ <path
251
+ d="M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"
252
+ fill="none"
253
+ strokeLinecap="round"
254
+ />
255
+ <path
256
+ d="M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"
257
+ fill="currentColor"
258
+ strokeLinecap="round"
259
+ />
260
+ <circle
261
+ cx="12"
262
+ cy="12"
263
+ fill="none"
264
+ r="11.25"
265
+ strokeMiterlimit="10"
266
+ />
267
+ </g>
268
+ </svg>
269
+ <span
270
+ className="breadcrumb-label"
271
+ >
272
+ string2
273
+ </span>
274
+ </a>
275
+ <span
276
+ className="css-t4q1nq"
277
+ role="presentation"
278
+ >
279
+ /
280
+ </span>
281
+ </li>
282
+ <li
283
+ className="chakra-breadcrumb__list-item css-18biwo"
284
+ >
285
+ <span
286
+ aria-current="page"
287
+ className="chakra-breadcrumb__link css-0"
288
+ >
289
+ <span
290
+ className="breadcrumb-label"
291
+ >
292
+ string3
293
+ </span>
294
+ </span>
295
+ </li>
296
+ </ol>
297
+ </nav>
298
+ `;
299
+
300
+ exports[`Breadcrumbs Snapshot Renders the UI snapshot correctly 4`] = `
301
+ <nav
302
+ aria-label="breadcrumb"
303
+ className="chakra-breadcrumb css-1f2fw9u"
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"
45
343
  viewBox="0 0 24 24"
46
344
  >
47
345
  <g
@@ -86,7 +384,6 @@ exports[`Breadcrumbs Snapshot Renders the UI snapshot correctly 1`] = `
86
384
  <span
87
385
  aria-current="page"
88
386
  className="chakra-breadcrumb__link css-0"
89
- href="#string3"
90
387
  >
91
388
  <span
92
389
  className="breadcrumb-label"