@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
@@ -0,0 +1,410 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Card Renders the UI snapshot correctly 1`] = `
4
+ <div
5
+ className="css-0"
6
+ id="regularCard"
7
+ >
8
+ <div
9
+ className="the-wrap css-0"
10
+ >
11
+ <div
12
+ className="the-crop css-0"
13
+ >
14
+ <img
15
+ alt="Alt text"
16
+ className="css-0"
17
+ src="https://placeimg.com/400/200/arch"
18
+ />
19
+ </div>
20
+ </div>
21
+ <div
22
+ className="card-body css-0"
23
+ >
24
+ <h3
25
+ className="chakra-heading css-0"
26
+ id="heading1"
27
+ >
28
+ The Card Heading
29
+ </h3>
30
+ <div
31
+ className="css-0"
32
+ >
33
+ middle column content
34
+ </div>
35
+ <div
36
+ className="css-0"
37
+ >
38
+ <button
39
+ className="chakra-button css-0"
40
+ data-testid="button"
41
+ id="button1"
42
+ onClick={[Function]}
43
+ type="submit"
44
+ >
45
+ Example CTA
46
+ </button>
47
+ </div>
48
+ </div>
49
+ </div>
50
+ `;
51
+
52
+ exports[`Card Renders the UI snapshot correctly 2`] = `
53
+ <div
54
+ className="edition-card css-0"
55
+ id="cardWithExtendedStyles"
56
+ >
57
+ <div
58
+ className="the-wrap css-0"
59
+ >
60
+ <div
61
+ className="the-crop css-0"
62
+ >
63
+ <img
64
+ alt="Alt text"
65
+ className="css-0"
66
+ src="https://placeimg.com/300/400/arch"
67
+ />
68
+ </div>
69
+ </div>
70
+ <div
71
+ className="card-body css-0"
72
+ >
73
+ <h2
74
+ className="chakra-heading css-0"
75
+ id="editioncardheading1"
76
+ >
77
+ The Card Heading
78
+ </h2>
79
+ <div
80
+ className="css-0"
81
+ >
82
+ <div>
83
+ Published in New York by Random House
84
+ </div>
85
+ <div>
86
+ Written in English
87
+ </div>
88
+ <div>
89
+ License: Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International
90
+ </div>
91
+ </div>
92
+ <div
93
+ className="css-0"
94
+ >
95
+ <a
96
+ className="css-0"
97
+ href="online"
98
+ id="link-online"
99
+ >
100
+ Read Online
101
+ </a>
102
+ <a
103
+ className="css-0"
104
+ href="#url"
105
+ id="link-icon"
106
+ >
107
+ <svg
108
+ aria-hidden={true}
109
+ className="chakra-icon css-onkibi"
110
+ focusable={false}
111
+ id="icon-cardWithExtendedStyles"
112
+ role="img"
113
+ title="download icon"
114
+ viewBox="0 0 24 24"
115
+ >
116
+ <g
117
+ stroke="currentColor"
118
+ strokeWidth="1.5"
119
+ >
120
+ <path
121
+ d="M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"
122
+ fill="none"
123
+ strokeLinecap="round"
124
+ />
125
+ <path
126
+ d="M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"
127
+ fill="currentColor"
128
+ strokeLinecap="round"
129
+ />
130
+ <circle
131
+ cx="12"
132
+ cy="12"
133
+ fill="none"
134
+ r="11.25"
135
+ strokeMiterlimit="10"
136
+ />
137
+ </g>
138
+ </svg>
139
+ Download
140
+ </a>
141
+ </div>
142
+ </div>
143
+ </div>
144
+ `;
145
+
146
+ exports[`Card Renders the UI snapshot correctly 3`] = `
147
+ <div
148
+ className="edition-card css-0"
149
+ id="cardWithNoCTAs"
150
+ >
151
+ <div
152
+ className="the-wrap css-0"
153
+ >
154
+ <div
155
+ className="the-crop css-0"
156
+ >
157
+ <img
158
+ alt="Alt text"
159
+ className="css-0"
160
+ src="https://placeimg.com/300/400/arch"
161
+ />
162
+ </div>
163
+ </div>
164
+ <div
165
+ className="card-body css-0"
166
+ >
167
+ <h2
168
+ className="chakra-heading css-0"
169
+ id="editioncardheading1"
170
+ >
171
+ The Card Heading
172
+ </h2>
173
+ <div
174
+ className="css-0"
175
+ >
176
+ <p>
177
+ Published in New York by Random House
178
+ </p>
179
+ <p>
180
+ Written in English
181
+ </p>
182
+ <p>
183
+ Under Creative Commons License
184
+ </p>
185
+ </div>
186
+ </div>
187
+ </div>
188
+ `;
189
+
190
+ exports[`Card Renders the UI snapshot correctly 4`] = `
191
+ <div
192
+ className="edition-card css-0"
193
+ id="cardWithNoContent"
194
+ >
195
+ <div
196
+ className="the-wrap css-0"
197
+ >
198
+ <div
199
+ className="the-crop css-0"
200
+ >
201
+ <img
202
+ alt="Alt text"
203
+ className="css-0"
204
+ src="https://placeimg.com/300/400/arch"
205
+ />
206
+ </div>
207
+ </div>
208
+ <div
209
+ className="card-body css-0"
210
+ >
211
+ <h2
212
+ className="chakra-heading css-0"
213
+ id="editioncardheading1"
214
+ >
215
+ <a
216
+ className="chakra-link css-1xdhyk6"
217
+ href="#edition-link"
218
+ >
219
+ The Card Heading
220
+ </a>
221
+ </h2>
222
+ <div
223
+ className="css-0"
224
+ >
225
+ <a
226
+ className="css-0"
227
+ href="online"
228
+ id="link-online"
229
+ >
230
+ Read Online
231
+ </a>
232
+ <a
233
+ className="css-0"
234
+ href="#url"
235
+ id="link-icon"
236
+ >
237
+ <svg
238
+ aria-hidden={true}
239
+ className="chakra-icon css-onkibi"
240
+ focusable={false}
241
+ id="icon-cardWithNoContent"
242
+ role="img"
243
+ title="download 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
+ Download
270
+ </a>
271
+ </div>
272
+ </div>
273
+ </div>
274
+ `;
275
+
276
+ exports[`Card Renders the UI snapshot correctly 5`] = `
277
+ <div
278
+ className="edition-card css-0"
279
+ id="cardWithNoImage"
280
+ >
281
+ <div
282
+ className="card-body css-0"
283
+ >
284
+ <h2
285
+ className="chakra-heading css-0"
286
+ id="editioncardheading1"
287
+ >
288
+ <a
289
+ className="chakra-link css-1xdhyk6"
290
+ href="#edition-link"
291
+ >
292
+ The Card Heading
293
+ </a>
294
+ </h2>
295
+ <div
296
+ className="css-0"
297
+ >
298
+ middle column content
299
+ </div>
300
+ <div
301
+ className="css-0"
302
+ >
303
+ <a
304
+ className="css-0"
305
+ href="online"
306
+ id="link-online"
307
+ >
308
+ Read Online
309
+ </a>
310
+ <a
311
+ className="css-0"
312
+ href="#url"
313
+ id="link-icon"
314
+ >
315
+ <svg
316
+ aria-hidden={true}
317
+ className="chakra-icon css-onkibi"
318
+ focusable={false}
319
+ id="icon-cardWithNoImage"
320
+ role="img"
321
+ title="download icon"
322
+ viewBox="0 0 24 24"
323
+ >
324
+ <g
325
+ stroke="currentColor"
326
+ strokeWidth="1.5"
327
+ >
328
+ <path
329
+ d="M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"
330
+ fill="none"
331
+ strokeLinecap="round"
332
+ />
333
+ <path
334
+ d="M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"
335
+ fill="currentColor"
336
+ strokeLinecap="round"
337
+ />
338
+ <circle
339
+ cx="12"
340
+ cy="12"
341
+ fill="none"
342
+ r="11.25"
343
+ strokeMiterlimit="10"
344
+ />
345
+ </g>
346
+ </svg>
347
+ Download
348
+ </a>
349
+ </div>
350
+ </div>
351
+ </div>
352
+ `;
353
+
354
+ exports[`Card Renders the UI snapshot correctly 6`] = `
355
+ <div
356
+ className="chakra-linkbox css-10n1vic"
357
+ >
358
+ <div
359
+ className="css-0"
360
+ id="fullclick"
361
+ >
362
+ <div
363
+ className="the-wrap css-0"
364
+ >
365
+ <div
366
+ className="the-crop css-0"
367
+ >
368
+ <img
369
+ alt="Alt text"
370
+ className="css-0"
371
+ src="https://placeimg.com/400/200/arch"
372
+ />
373
+ </div>
374
+ </div>
375
+ <div
376
+ className="card-body css-0"
377
+ >
378
+ <h3
379
+ className="chakra-heading css-0"
380
+ id="heading1"
381
+ >
382
+ <a
383
+ className="chakra-linkbox__overlay css-1hnz6hu"
384
+ href="http://nypl.org"
385
+ >
386
+ The Card Heading
387
+ </a>
388
+ </h3>
389
+ <div
390
+ className="css-0"
391
+ >
392
+ middle column content
393
+ </div>
394
+ <div
395
+ className="css-0"
396
+ >
397
+ <button
398
+ className="chakra-button css-0"
399
+ data-testid="button"
400
+ id="button1"
401
+ onClick={[Function]}
402
+ type="submit"
403
+ >
404
+ Example CTA
405
+ </button>
406
+ </div>
407
+ </div>
408
+ </div>
409
+ </div>
410
+ `;
@@ -1,6 +1,5 @@
1
1
  import * as React from "react";
2
2
  import { action } from "@storybook/addon-actions";
3
- import { text, boolean, select } from "@storybook/addon-knobs";
4
3
 
5
4
  import CardEdition from "./CardEdition";
6
5
  import Heading from "../Heading/Heading";
@@ -24,10 +23,6 @@ export default {
24
23
  component: CardEdition,
25
24
  };
26
25
 
27
- let showCTAs, showImage, showHeader, showFooter;
28
-
29
- const headerLevels = [1, 2, 3, 4, 5, 6];
30
-
31
26
  const imageRatios = {
32
27
  "1x1": "https://placeimg.com/100/100/animals",
33
28
  "2x1": "https://placeimg.com/200/100/animals",
@@ -39,48 +34,23 @@ const imageRatios = {
39
34
 
40
35
  export const cardEdition = () => (
41
36
  <>
42
- {boolean("Show Header", true) ? (showHeader = true) : (showHeader = false)}
43
- {boolean("Show Image", true) ? (showImage = true) : (showImage = false)}
44
- {boolean("Show CTAs", true) ? (showCTAs = true) : (showCTAs = false)}
45
- {boolean("Show Footer", true) ? (showFooter = true) : (showFooter = false)}
46
37
  <CardEdition
47
38
  id="cardID"
48
- heading={
49
- showHeader ? (
50
- <Heading
51
- level={select("Header Level", headerLevels, headerLevels[2])}
52
- id="heading1"
53
- text={text("Header Content", "Optional Header")}
54
- />
55
- ) : (
56
- false
57
- )
58
- }
59
- image={
60
- showImage ? (
61
- <Image
62
- src={select("Image Ratio", imageRatios, imageRatios[2])}
63
- alt={""}
64
- />
65
- ) : null
66
- }
39
+ heading={<Heading level={2} id="heading1" text="Header Content" />}
40
+ image={<Image src={imageRatios[2]} alt="" />}
67
41
  ctas={
68
- showCTAs ? (
69
- <Button
70
- onClick={action("clicked")}
71
- id="button1"
72
- buttonType={ButtonTypes.Primary}
73
- type="submit"
74
- >
75
- {text("CTA Button Text: ", "Example CTA")}
76
- </Button>
77
- ) : null
78
- }
79
- footer={
80
- showFooter ? <>{text("Footer content: ", "Optional footer")}</> : null
42
+ <Button
43
+ onClick={action("clicked")}
44
+ id="button1"
45
+ buttonType={ButtonTypes.Primary}
46
+ type="submit"
47
+ >
48
+ CTA Button Text
49
+ </Button>
81
50
  }
51
+ footer={<>Footer content: </>}
82
52
  >
83
- {text("Card Content: ", "Middle column content")}
53
+ Card Content:
84
54
  </CardEdition>
85
55
  </>
86
56
  );
@@ -90,8 +60,7 @@ cardEdition.storyName = "CardEdition";
90
60
  cardEdition.parameters = {
91
61
  design: {
92
62
  type: "figma",
93
- url:
94
- "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=17167%3A58131",
63
+ url: "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=17167%3A58131",
95
64
  },
96
65
  };
97
66
 
@@ -117,7 +86,7 @@ export const ExampleCardEdition = () => (
117
86
  <Heading
118
87
  level={HeadingLevels.Two}
119
88
  id="heading1"
120
- text={"The Year of Magical Thinking"}
89
+ text="The Year of Magical Thinking"
121
90
  />
122
91
  <div className="book__callout">A portrait of loss and grief</div>
123
92
  <div>
@@ -148,7 +117,6 @@ ExampleCardEdition.storyName = "Example Card Edition";
148
117
  ExampleCardEdition.parameters = {
149
118
  design: {
150
119
  type: "figma",
151
- url:
152
- "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=17167%3A58131",
120
+ url: "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=17167%3A58131",
153
121
  },
154
122
  };
@@ -1,12 +1,12 @@
1
1
  .card-edition {
2
- @include space-stack-s;
2
+ margin-bottom: var(--nypl-space-s);
3
3
 
4
4
  align-items: flex-start;
5
- border: 1px solid var(--ui-gray-light-cool);
5
+ border: 1px solid var(--nypl-colors-ui-gray-light-cool);
6
6
  border-radius: 5px;
7
7
  display: flex;
8
8
  flex-flow: column wrap;
9
- padding: var(--space) var(--space-l);
9
+ padding: var(--nypl-space-s) var(--nypl-space-l);
10
10
 
11
11
  &__heading,
12
12
  &__footer {
@@ -19,20 +19,20 @@
19
19
  justify-content: space-between;
20
20
  width: 100%;
21
21
 
22
- @include breakpoint($breakpoint-medium) {
22
+ @include breakpoint($nypl-breakpoint-medium) {
23
23
  flex-flow: row wrap;
24
24
  }
25
25
  }
26
26
 
27
27
  &__columns + &__footer {
28
- margin-top: var(--space-xs);
28
+ margin-top: var(--nypl-space-xs);
29
29
  }
30
30
 
31
31
  &__image {
32
- @include space-stack-s;
32
+ margin-bottom: var(--nypl-space-s);
33
33
 
34
34
  align-items: center;
35
- background-color: var(--ui-gray-x-light-cool);
35
+ background-color: var(--nypl-colors-ui-gray-x-light-cool);
36
36
  display: flex;
37
37
  flex: 0 0 150px;
38
38
  height: 150px;
@@ -43,9 +43,9 @@
43
43
  max-width: 100%;
44
44
  }
45
45
 
46
- @include breakpoint($breakpoint-medium) {
47
- @include space-stack-none;
48
- @include space-inline-s;
46
+ @include breakpoint($nypl-breakpoint-medium) {
47
+ margin-bottom: 0;
48
+ margin-right: var(--nypl-space-s);
49
49
 
50
50
  align-self: center;
51
51
  width: 150px;
@@ -53,45 +53,44 @@
53
53
  }
54
54
 
55
55
  &__content {
56
- @include space-stack-s;
56
+ margin-bottom: var(--nypl-space-s);
57
57
 
58
58
  flex: 1 1;
59
59
 
60
- @include breakpoint($breakpoint-medium) {
61
- @include space-inline-s;
62
- @include space-stack-none;
60
+ @include breakpoint($nypl-breakpoint-medium) {
61
+ margin-right: var(--nypl-space-s);
62
+ margin-bottom: 0;
63
63
  }
64
64
  }
65
65
 
66
66
  &__ctas {
67
67
  flex: 0 1 20%;
68
68
 
69
- @include breakpoint($breakpoint-medium) {
70
- @include space-inline-s;
69
+ @include breakpoint($nypl-breakpoint-medium) {
70
+ margin-right: var(--nypl-space-s);
71
71
  }
72
72
  }
73
73
 
74
74
  &__content + &__ctas {
75
- @include space-inline-s;
75
+ margin-right: var(--nypl-space-s);
76
76
  }
77
77
  }
78
78
 
79
79
  // Stories-only styles
80
80
  .sb-show-main {
81
81
  .var-docs {
82
- padding: 0 0 var(--space) 0;
82
+ padding: 0 0 var(--nypl-space-s) 0;
83
83
  }
84
84
 
85
85
  .example-card-edition {
86
86
  .card__content {
87
87
  > * {
88
- @include space-stack-xxs;
88
+ margin-bottom: var(--nypl-space-xxs);
89
89
  }
90
90
  }
91
91
 
92
92
  .book__callout {
93
- // formerly imported with @include heading-xs;
94
- font-size: var(--font-size-1);
93
+ font-size: var(--nypl-fontSizes-1);
95
94
  font-weight: 400;
96
95
  line-height: 1.15;
97
96
  margin: 0 0 0.5em;
@@ -123,12 +122,12 @@
123
122
  }
124
123
 
125
124
  > * {
126
- @include space-stack-xxs;
125
+ margin-bottom: var(--nypl-space-xxs);
127
126
  }
128
127
  }
129
128
 
130
129
  .book__filetype {
131
- @include space-stack-s;
130
+ margin-bottom: var(--nypl-space-s);
132
131
  }
133
132
 
134
133
  .book__description {
@@ -7,6 +7,7 @@ import {
7
7
  VideoPlayerTypes,
8
8
  VideoPlayerAspectRatios,
9
9
  } from "../VideoPlayer/VideoPlayerTypes";
10
+ import DSProvider from "../../theme/provider";
10
11
 
11
12
  <Meta title={getCategory("Box")} component={Box} />
12
13
 
@@ -16,7 +17,8 @@ import {
16
17
  | ----------------- | ---------- |
17
18
  | Added | `0.24.0` |
18
19
 
19
- Note: This needs the use of the `DSProvider` component. See the [README](https://github.com/NYPL/nypl-design-system#using-the-design-system-in-your-product)
20
+ Note: This needs the use of the `DSProvider` component. See the
21
+ [README](https://nypl.github.io/nypl-design-system/storybook-static/?path=/story/chakra-ui--page#dsprovider)
20
22
  for more information.
21
23
 
22
24
  This component is directly exported from Chakra UI. The `Box` is a simple and
@@ -30,28 +32,25 @@ guide on the Chakra UI site.
30
32
  <Story
31
33
  name="Box"
32
34
  args={{
33
- p: "5",
35
+ padding: "s",
34
36
  bg: "var(--nypl-colors-brand-primary)",
35
37
  color: "white",
36
38
  }}
37
39
  >
38
- {(args) => (
39
- <Box {...args}>
40
- So when I look up at the stars, I just wonder...what will they all
41
- become someday?
42
- </Box>
43
- )}
40
+ {(args) => <Box {...args}>This text is inside a `Box` component.</Box>}
44
41
  </Story>
45
42
  </Canvas>
46
43
 
47
44
  ## With VideoPlayer Component Example
48
45
 
49
46
  <Canvas>
50
- <Box borderWidth="3px" padding="6" borderRadius="lg" overflow="hidden">
51
- <VideoPlayer
52
- videoId="nm-dD2tx6bk"
53
- videoType={VideoPlayerTypes.YouTube}
54
- aspectRatio={VideoPlayerAspectRatios.SixteenByNine}
55
- />
56
- </Box>
47
+ <DSProvider>
48
+ <Box borderWidth="3px" padding="s" borderRadius="lg" overflow="hidden">
49
+ <VideoPlayer
50
+ videoId="nm-dD2tx6bk"
51
+ videoType={VideoPlayerTypes.YouTube}
52
+ aspectRatio={VideoPlayerAspectRatios.SixteenByNine}
53
+ />
54
+ </Box>
55
+ </DSProvider>
57
56
  </Canvas>