@nypl/design-system-react-components 1.0.2 → 1.0.4

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 (309) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/README.md +171 -135
  3. package/dist/__tests__/mediaMatchMock.d.ts +79 -0
  4. package/dist/components/Card/Card.d.ts +8 -6
  5. package/dist/components/Heading/Heading.d.ts +6 -0
  6. package/dist/components/Icons/Icon.d.ts +1 -1
  7. package/dist/components/Icons/IconSvgs.d.ts +10 -0
  8. package/dist/components/Logo/Logo.d.ts +1 -1
  9. package/dist/components/Logo/LogoSvgs.d.ts +3 -0
  10. package/dist/components/Slider/Slider.d.ts +1 -2
  11. package/dist/components/Table/Table.d.ts +3 -2
  12. package/dist/components/Text/Text.d.ts +6 -0
  13. package/dist/components/TextInput/TextInput.d.ts +2 -1
  14. package/dist/design-system-react-components.cjs.development.js +1700 -878
  15. package/dist/design-system-react-components.cjs.development.js.map +1 -1
  16. package/dist/design-system-react-components.cjs.production.min.js +1 -1
  17. package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
  18. package/dist/design-system-react-components.esm.js +1672 -881
  19. package/dist/design-system-react-components.esm.js.map +1 -1
  20. package/dist/hooks/{tests → __tests__}/useCarouselStyles.test.d.ts +0 -0
  21. package/dist/hooks/__tests__/useNYPLBreakpoints.test.d.ts +1 -0
  22. package/dist/hooks/useNYPLBreakpoints.d.ts +13 -0
  23. package/dist/index.d.ts +2 -1
  24. package/dist/resources.scss +0 -4
  25. package/dist/styles.css +3 -2
  26. package/dist/theme/components/button.d.ts +7 -2
  27. package/dist/theme/components/checkbox.d.ts +1 -0
  28. package/dist/theme/components/customTable.d.ts +522 -34
  29. package/dist/theme/components/datePicker.d.ts +1 -0
  30. package/dist/theme/components/global.d.ts +5 -2
  31. package/dist/theme/components/heading.d.ts +5 -1
  32. package/dist/theme/components/image.d.ts +18 -0
  33. package/dist/theme/components/radio.d.ts +9 -0
  34. package/dist/theme/components/searchBar.d.ts +6 -0
  35. package/dist/theme/components/select.d.ts +4 -5
  36. package/dist/theme/components/structuredContent.d.ts +117 -17
  37. package/dist/theme/components/template.d.ts +4 -1
  38. package/dist/theme/components/text.d.ts +5 -1
  39. package/dist/theme/components/textInput.d.ts +4 -0
  40. package/dist/theme/components/toggle.d.ts +1 -0
  41. package/dist/theme/provider.d.ts +2 -1
  42. package/package.json +16 -16
  43. package/src/__tests__/fileMock.ts +0 -6
  44. package/src/__tests__/setup.ts +0 -27
  45. package/src/__tests__/utils/utils.test.ts +0 -18
  46. package/src/components/AccessibilityGuide/SkipNavigation.stories.mdx +0 -42
  47. package/src/components/Accordion/Accordion.stories.mdx +0 -333
  48. package/src/components/Accordion/Accordion.test.tsx +0 -237
  49. package/src/components/Accordion/Accordion.tsx +0 -137
  50. package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +0 -734
  51. package/src/components/Autosuggest/Autosuggest.stories.mdx +0 -75
  52. package/src/components/Autosuggest/Autosuggest.stories.tsx +0 -211
  53. package/src/components/Autosuggest/_Autosuggest.scss +0 -51
  54. package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +0 -231
  55. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +0 -144
  56. package/src/components/Breadcrumbs/Breadcrumbs.tsx +0 -98
  57. package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +0 -695
  58. package/src/components/Button/Button.stories.mdx +0 -320
  59. package/src/components/Button/Button.test.tsx +0 -184
  60. package/src/components/Button/Button.tsx +0 -95
  61. package/src/components/Button/__snapshots__/Button.test.tsx.snap +0 -106
  62. package/src/components/ButtonGroup/ButtonGroup.stories.mdx +0 -178
  63. package/src/components/ButtonGroup/ButtonGroup.test.tsx +0 -141
  64. package/src/components/ButtonGroup/ButtonGroup.tsx +0 -100
  65. package/src/components/ButtonGroup/__snapshots__/ButtonGroup.test.tsx.snap +0 -117
  66. package/src/components/Card/Card.stories.mdx +0 -1041
  67. package/src/components/Card/Card.test.tsx +0 -388
  68. package/src/components/Card/Card.tsx +0 -346
  69. package/src/components/Card/__snapshots__/Card.test.tsx.snap +0 -568
  70. package/src/components/Chakra/Box.stories.mdx +0 -52
  71. package/src/components/Chakra/Center.stories.mdx +0 -96
  72. package/src/components/Chakra/Flex.stories.mdx +0 -111
  73. package/src/components/Chakra/Grid.stories.mdx +0 -89
  74. package/src/components/Chakra/Stack.stories.mdx +0 -109
  75. package/src/components/Checkbox/Checkbox.stories.mdx +0 -243
  76. package/src/components/Checkbox/Checkbox.test.tsx +0 -350
  77. package/src/components/Checkbox/Checkbox.tsx +0 -152
  78. package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +0 -661
  79. package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +0 -462
  80. package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +0 -492
  81. package/src/components/CheckboxGroup/CheckboxGroup.tsx +0 -173
  82. package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +0 -1842
  83. package/src/components/ComponentWrapper/ComponentWrapper.test.tsx +0 -163
  84. package/src/components/ComponentWrapper/ComponentWrapper.tsx +0 -76
  85. package/src/components/ComponentWrapper/__snapshots__/ComponentWrapper.test.tsx.snap +0 -103
  86. package/src/components/DatePicker/DatePicker.stories.mdx +0 -452
  87. package/src/components/DatePicker/DatePicker.test.tsx +0 -940
  88. package/src/components/DatePicker/DatePicker.tsx +0 -450
  89. package/src/components/DatePicker/_DatePicker.scss +0 -100
  90. package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +0 -908
  91. package/src/components/Fieldset/Fieldset.stories.mdx +0 -96
  92. package/src/components/Fieldset/Fieldset.test.tsx +0 -155
  93. package/src/components/Fieldset/Fieldset.tsx +0 -55
  94. package/src/components/Fieldset/__snapshots__/Fieldset.test.tsx.snap +0 -89
  95. package/src/components/Form/Form.stories.mdx +0 -426
  96. package/src/components/Form/Form.test.tsx +0 -234
  97. package/src/components/Form/Form.tsx +0 -124
  98. package/src/components/Form/__snapshots__/Form.test.tsx.snap +0 -115
  99. package/src/components/Grid/SimpleGrid.stories.mdx +0 -336
  100. package/src/components/Grid/SimpleGrid.test.tsx +0 -79
  101. package/src/components/Grid/SimpleGrid.tsx +0 -49
  102. package/src/components/Grid/__snapshots__/SimpleGrid.test.tsx.snap +0 -23
  103. package/src/components/Heading/Heading.stories.mdx +0 -187
  104. package/src/components/Heading/Heading.test.tsx +0 -171
  105. package/src/components/Heading/Heading.tsx +0 -104
  106. package/src/components/Heading/__snapshots__/Heading.test.tsx.snap +0 -90
  107. package/src/components/HelperErrorText/HelperErrorText.stories.mdx +0 -172
  108. package/src/components/HelperErrorText/HelperErrorText.test.tsx +0 -114
  109. package/src/components/HelperErrorText/HelperErrorText.tsx +0 -62
  110. package/src/components/HelperErrorText/__snapshots__/HelperErrorText.test.tsx.snap +0 -93
  111. package/src/components/Hero/Hero.stories.mdx +0 -378
  112. package/src/components/Hero/Hero.test.tsx +0 -611
  113. package/src/components/Hero/Hero.tsx +0 -203
  114. package/src/components/Hero/__snapshots__/Hero.test.tsx.snap +0 -379
  115. package/src/components/HorizontalRule/HorizontalRule.stories.mdx +0 -73
  116. package/src/components/HorizontalRule/HorizontalRule.test.tsx +0 -54
  117. package/src/components/HorizontalRule/HorizontalRule.tsx +0 -27
  118. package/src/components/HorizontalRule/__snapshots__/HorizontalRule.test.tsx.snap +0 -44
  119. package/src/components/Icons/Icon.stories.mdx +0 -413
  120. package/src/components/Icons/Icon.test.tsx +0 -120
  121. package/src/components/Icons/Icon.tsx +0 -187
  122. package/src/components/Icons/IconSvgs.tsx +0 -64
  123. package/src/components/Icons/__snapshots__/Icon.test.tsx.snap +0 -129
  124. package/src/components/Image/Image.stories.mdx +0 -332
  125. package/src/components/Image/Image.test.tsx +0 -155
  126. package/src/components/Image/Image.tsx +0 -171
  127. package/src/components/Image/__snapshots__/Image.test.tsx.snap +0 -269
  128. package/src/components/Label/Label.stories.mdx +0 -100
  129. package/src/components/Label/Label.test.tsx +0 -116
  130. package/src/components/Label/Label.tsx +0 -55
  131. package/src/components/Label/__snapshots__/Label.test.tsx.snap +0 -45
  132. package/src/components/Link/Link.stories.mdx +0 -249
  133. package/src/components/Link/Link.test.tsx +0 -224
  134. package/src/components/Link/Link.tsx +0 -178
  135. package/src/components/Link/__snapshots__/Link.test.tsx.snap +0 -286
  136. package/src/components/List/List.stories.mdx +0 -393
  137. package/src/components/List/List.test.tsx +0 -265
  138. package/src/components/List/List.tsx +0 -156
  139. package/src/components/List/__snapshots__/List.test.tsx.snap +0 -213
  140. package/src/components/Logo/Logo.stories.mdx +0 -295
  141. package/src/components/Logo/Logo.test.tsx +0 -116
  142. package/src/components/Logo/Logo.tsx +0 -151
  143. package/src/components/Logo/LogoSvgs.tsx +0 -90
  144. package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +0 -142
  145. package/src/components/Modal/Modal.stories.mdx +0 -294
  146. package/src/components/Modal/Modal.test.tsx +0 -157
  147. package/src/components/Modal/Modal.tsx +0 -154
  148. package/src/components/Modal/__snapshots__/Modal.test.tsx.snap +0 -25
  149. package/src/components/Notification/Notification.stories.mdx +0 -358
  150. package/src/components/Notification/Notification.test.tsx +0 -279
  151. package/src/components/Notification/Notification.tsx +0 -224
  152. package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +0 -525
  153. package/src/components/Pagination/Pagination.stories.mdx +0 -184
  154. package/src/components/Pagination/Pagination.test.tsx +0 -419
  155. package/src/components/Pagination/Pagination.tsx +0 -269
  156. package/src/components/Pagination/__snapshots__/Pagination.test.tsx.snap +0 -544
  157. package/src/components/Placeholder/Placeholder.tsx +0 -19
  158. package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +0 -360
  159. package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +0 -298
  160. package/src/components/ProgressIndicator/ProgressIndicator.tsx +0 -132
  161. package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +0 -434
  162. package/src/components/Radio/Radio.stories.mdx +0 -216
  163. package/src/components/Radio/Radio.test.tsx +0 -247
  164. package/src/components/Radio/Radio.tsx +0 -119
  165. package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +0 -451
  166. package/src/components/RadioGroup/RadioGroup.stories.mdx +0 -479
  167. package/src/components/RadioGroup/RadioGroup.test.tsx +0 -471
  168. package/src/components/RadioGroup/RadioGroup.tsx +0 -171
  169. package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +0 -1550
  170. package/src/components/SearchBar/SearchBar.stories.mdx +0 -518
  171. package/src/components/SearchBar/SearchBar.test.tsx +0 -435
  172. package/src/components/SearchBar/SearchBar.tsx +0 -210
  173. package/src/components/SearchBar/__snapshots__/SearchBar.test.tsx.snap +0 -1049
  174. package/src/components/Select/Select.stories.mdx +0 -439
  175. package/src/components/Select/Select.test.tsx +0 -358
  176. package/src/components/Select/Select.tsx +0 -183
  177. package/src/components/Select/__snapshots__/Select.test.tsx.snap +0 -895
  178. package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +0 -142
  179. package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +0 -116
  180. package/src/components/SkeletonLoader/SkeletonLoader.tsx +0 -123
  181. package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +0 -898
  182. package/src/components/SkipNavigation/SkipNavigation.stories.mdx +0 -90
  183. package/src/components/SkipNavigation/SkipNavigation.test.tsx +0 -63
  184. package/src/components/SkipNavigation/SkipNavigation.tsx +0 -51
  185. package/src/components/SkipNavigation/__snapshots__/SkipNavigation.test.tsx.snap +0 -130
  186. package/src/components/Slider/Slider.stories.mdx +0 -628
  187. package/src/components/Slider/Slider.test.tsx +0 -736
  188. package/src/components/Slider/Slider.tsx +0 -322
  189. package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +0 -2186
  190. package/src/components/StatusBadge/StatusBadge.stories.mdx +0 -109
  191. package/src/components/StatusBadge/StatusBadge.test.tsx +0 -70
  192. package/src/components/StatusBadge/StatusBadge.tsx +0 -35
  193. package/src/components/StatusBadge/__snapshots__/StatusBadge.test.tsx.snap +0 -47
  194. package/src/components/StructuredContent/StructuredContent.stories.mdx +0 -567
  195. package/src/components/StructuredContent/StructuredContent.test.tsx +0 -435
  196. package/src/components/StructuredContent/StructuredContent.tsx +0 -139
  197. package/src/components/StructuredContent/__snapshots__/StructuredContent.test.tsx.snap +0 -368
  198. package/src/components/StyleGuide/Bidirectionality.stories.mdx +0 -206
  199. package/src/components/StyleGuide/Breakpoints.stories.mdx +0 -55
  200. package/src/components/StyleGuide/Buttons.stories.mdx +0 -194
  201. package/src/components/StyleGuide/ColorCard.tsx +0 -43
  202. package/src/components/StyleGuide/Colors.stories.mdx +0 -201
  203. package/src/components/StyleGuide/DesignTokens.stories.mdx +0 -193
  204. package/src/components/StyleGuide/Forms.stories.mdx +0 -94
  205. package/src/components/StyleGuide/Iconography.stories.mdx +0 -142
  206. package/src/components/StyleGuide/Spacing.stories.mdx +0 -116
  207. package/src/components/StyleGuide/Typography.stories.mdx +0 -419
  208. package/src/components/Table/Table.stories.mdx +0 -272
  209. package/src/components/Table/Table.test.tsx +0 -241
  210. package/src/components/Table/Table.tsx +0 -152
  211. package/src/components/Table/__snapshots__/Table.test.tsx.snap +0 -1703
  212. package/src/components/Tabs/Tabs.stories.mdx +0 -338
  213. package/src/components/Tabs/Tabs.test.tsx +0 -298
  214. package/src/components/Tabs/Tabs.tsx +0 -264
  215. package/src/components/Tabs/__snapshots__/Tabs.test.tsx.snap +0 -584
  216. package/src/components/Template/Template.stories.mdx +0 -695
  217. package/src/components/Template/Template.test.tsx +0 -309
  218. package/src/components/Template/Template.tsx +0 -326
  219. package/src/components/Template/__snapshots__/Template.test.tsx.snap +0 -342
  220. package/src/components/Text/Text.stories.mdx +0 -103
  221. package/src/components/Text/Text.test.tsx +0 -63
  222. package/src/components/Text/Text.tsx +0 -50
  223. package/src/components/Text/__snapshots__/Text.test.tsx.snap +0 -50
  224. package/src/components/TextInput/TextInput.stories.mdx +0 -268
  225. package/src/components/TextInput/TextInput.test.tsx +0 -451
  226. package/src/components/TextInput/TextInput.tsx +0 -240
  227. package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +0 -274
  228. package/src/components/Toggle/Toggle.stories.mdx +0 -237
  229. package/src/components/Toggle/Toggle.test.tsx +0 -170
  230. package/src/components/Toggle/Toggle.tsx +0 -128
  231. package/src/components/Toggle/__snapshots__/Toggle.test.tsx.snap +0 -470
  232. package/src/components/VideoPlayer/VideoPlayer.stories.mdx +0 -212
  233. package/src/components/VideoPlayer/VideoPlayer.test.tsx +0 -308
  234. package/src/components/VideoPlayer/VideoPlayer.tsx +0 -188
  235. package/src/components/VideoPlayer/__snapshots__/VideoPlayer.test.tsx.snap +0 -192
  236. package/src/docs/Chakra.stories.mdx +0 -563
  237. package/src/docs/Welcome.stories.mdx +0 -148
  238. package/src/helpers/types.ts +0 -1
  239. package/src/hooks/tests/useCarouselStyles.test.ts +0 -140
  240. package/src/hooks/tests/useNYPLTheme.test.tsx +0 -36
  241. package/src/hooks/useCarouselStyles.stories.mdx +0 -30
  242. package/src/hooks/useCarouselStyles.ts +0 -35
  243. package/src/hooks/useNYPLTheme.stories.mdx +0 -98
  244. package/src/hooks/useNYPLTheme.ts +0 -91
  245. package/src/hooks/useWindowSize.stories.mdx +0 -23
  246. package/src/hooks/useWindowSize.ts +0 -40
  247. package/src/index.ts +0 -136
  248. package/src/resources.scss +0 -6
  249. package/src/styles/base/_01-breakpoints.scss +0 -27
  250. package/src/styles/base/_02-mixins.scss +0 -103
  251. package/src/styles/base/_place-holder.scss +0 -33
  252. package/src/styles/space/_space-inline.scss +0 -79
  253. package/src/styles/space/_space-inset.scss +0 -57
  254. package/src/styles/space/_space-stack.scss +0 -116
  255. package/src/styles.scss +0 -23
  256. package/src/theme/components/accordion.ts +0 -25
  257. package/src/theme/components/breadcrumb.ts +0 -94
  258. package/src/theme/components/button.ts +0 -133
  259. package/src/theme/components/buttonGroup.ts +0 -10
  260. package/src/theme/components/card.ts +0 -237
  261. package/src/theme/components/checkbox.ts +0 -110
  262. package/src/theme/components/checkboxGroup.ts +0 -10
  263. package/src/theme/components/componentWrapper.ts +0 -14
  264. package/src/theme/components/customTable.ts +0 -77
  265. package/src/theme/components/datePicker.ts +0 -17
  266. package/src/theme/components/fieldset.ts +0 -23
  267. package/src/theme/components/global.ts +0 -91
  268. package/src/theme/components/globalMixins.ts +0 -24
  269. package/src/theme/components/heading.ts +0 -79
  270. package/src/theme/components/helperErrorText.ts +0 -14
  271. package/src/theme/components/hero.ts +0 -238
  272. package/src/theme/components/horizontalRule.ts +0 -17
  273. package/src/theme/components/icon.ts +0 -88
  274. package/src/theme/components/image.ts +0 -136
  275. package/src/theme/components/label.ts +0 -15
  276. package/src/theme/components/link.ts +0 -63
  277. package/src/theme/components/list.ts +0 -88
  278. package/src/theme/components/logo.ts +0 -58
  279. package/src/theme/components/notification.ts +0 -132
  280. package/src/theme/components/pagination.ts +0 -17
  281. package/src/theme/components/progressIndicator.ts +0 -67
  282. package/src/theme/components/radio.ts +0 -103
  283. package/src/theme/components/radioGroup.ts +0 -10
  284. package/src/theme/components/searchBar.ts +0 -19
  285. package/src/theme/components/select.ts +0 -72
  286. package/src/theme/components/skeletonLoader.ts +0 -113
  287. package/src/theme/components/skipNavigation.ts +0 -29
  288. package/src/theme/components/slider.ts +0 -95
  289. package/src/theme/components/statusBadge.ts +0 -26
  290. package/src/theme/components/structuredContent.ts +0 -149
  291. package/src/theme/components/tabs.ts +0 -109
  292. package/src/theme/components/template.ts +0 -114
  293. package/src/theme/components/text.ts +0 -38
  294. package/src/theme/components/textInput.ts +0 -65
  295. package/src/theme/components/toggle.ts +0 -109
  296. package/src/theme/components/videoPlayer.ts +0 -47
  297. package/src/theme/foundations/breakpoints.ts +0 -24
  298. package/src/theme/foundations/colors.ts +0 -212
  299. package/src/theme/foundations/global.ts +0 -43
  300. package/src/theme/foundations/radii.ts +0 -7
  301. package/src/theme/foundations/shadows.ts +0 -5
  302. package/src/theme/foundations/spacing.ts +0 -136
  303. package/src/theme/foundations/typography.ts +0 -107
  304. package/src/theme/index.ts +0 -131
  305. package/src/theme/provider.tsx +0 -9
  306. package/src/theme/types.ts +0 -1
  307. package/src/utils/componentCategories.ts +0 -152
  308. package/src/utils/interfaces.ts +0 -5
  309. package/src/utils/utils.ts +0 -84
@@ -1,295 +0,0 @@
1
- import {
2
- ArgsTable,
3
- Canvas,
4
- Description,
5
- Meta,
6
- Story,
7
- } from "@storybook/addon-docs";
8
- import { withDesign } from "storybook-addon-designs";
9
-
10
- import Logo from "./Logo";
11
- import logoSvgs from "./LogoSvgs";
12
- import Heading from "../Heading/Heading";
13
- import List from "../List/List";
14
- import SimpleGrid from "../Grid/SimpleGrid";
15
- import { getCategory } from "../../utils/componentCategories";
16
-
17
- <Meta
18
- title={getCategory("Logo")}
19
- component={Logo}
20
- decorators={[withDesign]}
21
- parameters={{
22
- design: {
23
- type: "figma",
24
- url: "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Main?node-id=10734%3A3945",
25
- },
26
- jest: ["Logo.test.tsx"],
27
- }}
28
- argTypes={{
29
- children: { table: { disable: true } },
30
- className: { control: false },
31
- id: { control: false },
32
- size: {
33
- table: { defaultValue: { summary: "medium" } },
34
- },
35
- title: {
36
- control: false,
37
- table: { defaultValue: { summary: "`${name} logo`" } },
38
- },
39
- }}
40
- />
41
-
42
- # Logo
43
-
44
- | Component Version | DS Version |
45
- | ----------------- | ---------- |
46
- | Added | `0.25.9` |
47
- | Latest | `1.0.2` |
48
-
49
- ## Table of Contents
50
-
51
- - [Overview](#overview)
52
- - [Component Props](#component-props)
53
- - [Accessibility](#accessibility)
54
- - [Logo Sizes](#logo-sizes)
55
- - [All Logos](#all-logos)
56
- - [Custom Logos](#custom-logos)
57
-
58
- ## Overview
59
-
60
- <Description of={Logo} />
61
-
62
- ## Component Props
63
-
64
- <Canvas withToolbar>
65
- <Story
66
- name="Logo with Controls"
67
- args={{
68
- className: undefined,
69
- decorative: true,
70
- id: "logo-id",
71
- name: "nyplFullBlack",
72
- size: "large",
73
- title: undefined,
74
- }}
75
- >
76
- {(args) => (
77
- <div
78
- style={
79
- args.name.indexOf("white") !== -1 ||
80
- args.name.indexOf("negative") !== -1
81
- ? {
82
- backgroundColor: "var(--nypl-colors-ui-gray-xdark)",
83
- display: "inline-block",
84
- padding: "var(--nypl-space-l)",
85
- width: "100%",
86
- }
87
- : undefined
88
- }
89
- >
90
- <Logo {...args} />
91
- </div>
92
- )}
93
- </Story>
94
- </Canvas>
95
-
96
- <ArgsTable story="Logo with Controls" />
97
-
98
- export const logoRow = (logo, opts = {}) => {
99
- // We'll use this setup function to render all the logos in a list item.
100
- // Some logos display better with a dark background.
101
- const styles = { textAlign: "center" };
102
- const { size = "large", displayValue } = opts;
103
- let key = logo;
104
- if (logo.indexOf("White") !== -1 || logo.indexOf("Negative") !== -1) {
105
- styles.backgroundColor = "var(--nypl-colors-ui-gray-xdark)";
106
- styles.color = "var(--nypl-colors-ui-white)";
107
- styles.paddingBottom = "var(--nypl-space-l)";
108
- styles.paddingTop = "var(--nypl-space-l)";
109
- }
110
- if (size !== "large") {
111
- key += `-${size}`;
112
- }
113
- return (
114
- <div style={styles} key={key}>
115
- <Heading level="four">{displayValue}</Heading>
116
- <Logo name={logo} size={size} />
117
- </div>
118
- );
119
- };
120
- export const logos = [];
121
- export const sizes = [];
122
- export const logoNameValues = [
123
- "appleAppStoreBlack",
124
- "appleAppStoreWhite",
125
- "bplBlack",
126
- "bplWhite",
127
- "cleverBadgeColor",
128
- "cleverColor",
129
- "cleverWhite",
130
- "firstbookColor",
131
- "firstbookColorNegative",
132
- "googlePlayBlack",
133
- "lpaColor",
134
- "lpaBlack",
135
- "lpaWhite",
136
- "mlnBlack",
137
- "mlnWhite",
138
- "nyplFullBlack",
139
- "nyplFullWhite",
140
- "nyplLionBlack",
141
- "nyplLionWhite",
142
- "openebooksColor",
143
- "openebooksNegative",
144
- "openebooksWithTextColor",
145
- "openebooksWithTextNegative",
146
- "qplColor",
147
- "qplBlack",
148
- "qplWhite",
149
- "qplAltBlack",
150
- "qplAltWhite",
151
- "reservoirIconColor",
152
- "reservoirVerticalColor",
153
- "schomburgColor",
154
- "schomburgBlack",
155
- "schomburgWhite",
156
- "schomburgCircleColor",
157
- "schomburgCircleBlack",
158
- "schomburgCircleWhite",
159
- "simplyeColor",
160
- "simplyeBlack",
161
- "simplyeWhite",
162
- "snflBlack",
163
- "snflWhite",
164
- "treasuresColor",
165
- "treasuresColorNegative",
166
- ];
167
- export const logoSizeValues = [
168
- "default",
169
- "xxsmall",
170
- "xsmall",
171
- "small",
172
- "medium",
173
- "large",
174
- ];
175
- for (const logo in logoNameValues) {
176
- logos.push(
177
- logoRow(logoNameValues[logo], { displayValue: logoNameValues[logo] })
178
- );
179
- }
180
- for (const logoSize in logoSizeValues) {
181
- sizes.push(
182
- logoRow("nyplFullBlack", {
183
- displayValue: logoSizeValues[logoSize],
184
- size: logoSizeValues[logoSize],
185
- })
186
- );
187
- }
188
-
189
- export const allLogosGrid = (list) => (
190
- <SimpleGrid columns={1}>{list}</SimpleGrid>
191
- );
192
-
193
- ## Accessibility
194
-
195
- For accessibility purposes, every Reservoir Design System (DS) `Logo` will
196
- render the `svg` element with its `svg` file name in the `title` element. The
197
- default text in the `title` element is the logo's code name. Pass in better
198
- descriptive text in the `title` prop when using the `Logo` component in your
199
- application. This will give screenreaders a better descriptive title for the
200
- `svg` graphic.
201
-
202
- `Logos`s are decorative by default. This means that they are presentational and
203
- screenreaders will not read them because the `aria-hidden` attribute is set to
204
- `true`.
205
-
206
- Resources:
207
-
208
- - [W3C Design System SVG Icons](https://design-system.w3.org/styles/svg-icons.html)
209
- - [CSS-Tricks Accessible SVG Icons](https://css-tricks.com/accessible-svg-icons/)
210
- - [Chakra UI Icon](https://chakra-ui.com/docs/components/media-and-icons/icon)
211
-
212
- ## Logo Sizes
213
-
214
- Update the size of the `Logo` component by passing the `size` prop with a value
215
- from the `LogoSizes` type. The values are `"default"`, `"xxsmall"`, `"xsmall"`,
216
- `"small"`, `"medium"`, and `"large"`.
217
-
218
- Note: `"default"` sets the width to `100%` and the rendered logo will expand to
219
- fill the full width of the parent element.
220
-
221
- ```jsx
222
- // Example
223
- <Logo name="nyplFullBlack" size="large" />
224
- ```
225
-
226
- <Canvas>
227
- <Story name="Logo Sizes">{allLogosGrid(sizes)}</Story>
228
- </Canvas>
229
-
230
- ## All Logos
231
-
232
- Update the icon of the `Logo` component by passing the `name` prop with a value
233
- from the `LogoNames` type. The values are `"appleAppStoreBlack"`,
234
- `"appleAppStoreWhite"`,`"bplBlack"`, `"bplWhite"`, `"cleverBadgeColor"`, `"cleverColor"`,
235
- `"cleverWhite"`, `"firstbookColor"`, `"firstbookColorNegative"`, `"googlePlayBlack"`,
236
- `"lpaBlack"`, `"lpaColor"`, `"lpaWhite"`, `"mlnBlack"`, `"mlnWhite"`,
237
- `"nyplFullBlack"`, `"nyplFullWhite"`, `"nyplLionBlack"`, `"nyplLionWhite"`,
238
- `"openebooksColor"`, `"openebooksNegative"`, `"openebooksWithTextColor"`,
239
- `"openebooksWithTextNegative"`, `"qplAltBlack"`, `"qplAltWhite"`, `"qplBlack"`,
240
- `"qplColor"`, `"qplWhite"`, `"reservoirIconColor"`, `"reservoirVerticalColor"`,
241
- `"schomburgBlack"`, `"schomburgCircleBlack"`, `"schomburgCircleColor"`,
242
- `"schomburgCircleWhite"`, `"schomburgColor"`, `"schomburgWhite"`, `"simplyeBlack"`,
243
- `"simplyeWhite"`, `"simplyeColor"`, `"snflBlack"`, `"snflWhite"`, `"treasuresColor"`,
244
- `"treasuresColorNegative"`.
245
-
246
- If you feel a necessary logo should be added to the `Logo` component, please
247
- reach out to the DS team.
248
-
249
- <Canvas withToolbar>
250
- <Story name="All Logos">{allLogosGrid(logos)}</Story>
251
- </Canvas>
252
-
253
- ## Custom Logos
254
-
255
- If you'd like to pass a custom `svg` to your application, you can pass it a
256
- child to the `Logo` component.
257
-
258
- ```jsx
259
- <Logo {...props}>
260
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 192.756 192.756">
261
- <g fillRule="evenodd" clipRule="evenodd">
262
- <path fill="#fff" d="M0 0h192.756v192.756H0V0z" />
263
- <path
264
- d="M59.73 117.578c-9.859-4.912-23.261-15.887-23.413-27.06C36.149 78.129 44.451 75.087 50 75.087c5.701 0 8.286 3.345 10.637 5.777 2.352-2.433 4.936-5.777 10.637-5.777 5.549 0 13.851 3.042 13.682 15.431-.151 11.173-13.553 22.148-23.412 27.06-.35.174-.629.262-.907.262s-.557-.088-.907-.262z"
265
- fill="#c23c40"
266
- />
267
- <path d="M184.252 78.225c-.027 1.111-.355 1.921-.799 2.399-.871.945-3.1 1.067-4.283.854-.668-.12-1.309-.167-1.66-.137-1.551.136-2.398 1.115-3.242 2.45l-10.377 16.423-.154 6.727c-.033 1.535.287 2.881 2.066 2.799l2.865-.135c1.725-.08 3.35 1.029 3.4 2.867.064 2.359-1.807 3.393-3.943 3.275-1.338-.072-2.559-.275-3.666-.477-2.355-.428-3.977-.279-6.332 0-2.189.262-3.879.43-5.055.4-1.895-.045-3.725-.988-3.91-2.957-.178-1.898 1.297-3.191 3.186-3.041l2.5.199c.963.076 2.232-.406 2.256-1.533l.152-7.555-10.803-17.373c-.588-.948-1.52-1.538-2.42-1.877-1.156-.435-2.35-.464-3.568-.309-.988.125-1.16.01-1.414-.001-2.166-.093-3.1-1.048-2.988-3.064.139-2.505 1.543-2.885 3.936-2.885.412 0 1.391.005 3.344.285 1.43.206 2.609.099 3.531.067 2.436-.083 4.973-.545 7.377-.479 1.334.037 2.285.338 2.943.667.92.459 1.506 1.161 1.473 2.348-.031 1.144-.484 2.161-1.139 2.645-.496.367-1.848.417-2.902.417-1.92-.046-1.844 1.094-1.24 1.651l7.008 11.204 7.336-11.487c.148-.59.916-1.602-1.146-1.365-.637.073-.715.087-1.48.064-1.1-.033-1.854-.247-2.266-.544-1.348-.974-1.18-1.916-.943-3.322.17-1.019.986-1.48 1.877-1.744.928-.275 1.896-.259 2.871-.267 1.105-.009 2.221.111 3.295.272 1.99.297 3.414.306 5.398.066 1.379-.167 3.006-.5 4.559-.488 1.062.008 2.092.056 2.984.551.867.484 1.4 1.278 1.373 2.41zM31.561 112.531c-.116 2.684-2.242 2.799-4.345 2.799-2.14 0-4.302-.387-6.455-.387-2.396 0-4.788.17-7.178.396-2.739.262-4.681-.342-4.576-2.869.07-1.703 1.047-2.818 3.117-2.814l2.783.004c1.497.002 2.085-1.572 2.082-2.721l-.098-23.305c-.004-1.258-.422-2.46-1.917-2.431l-3.169.064c-2.091.042-3.322-1.33-3.301-3.214.026-2.372 1.934-2.958 3.873-2.897.678.021 2.127.043 3.023.136 1.53.157 3.13.141 4.67.141 2.369 0 4.682-.372 7.012-.372 2.197 0 4.145.564 4.274 3.233.078 1.624-1.636 2.807-3.479 2.776l-2.155-.035c-1.634-.027-2.604 1.158-2.587 2.501l.294 23.462c.028 2.24 1.216 2.869 3.008 2.85l2.109-.025c1.58-.02 3.098.777 3.015 2.708zM135.311 78.065c-.084 2.73-1.73 3.344-4.244 3.344 0-.041-4.09-.461-4.09 1.686v26.908c0 3.244-1.57 6.314-5.01 6.314-2.217 0-4.641-1.143-5.557-3.271l-12.846-29.84-.061 23.363c-.004 1.895.496 2.963 2.393 2.908l2.344-.066c2.098-.061 3.543 1.082 3.482 3.266-.066 2.418-1.879 2.932-3.93 2.932-2.467 0-4.818-.783-7.248-.666-2.58.123-5.081.484-7.668.484-2.227 0-3.915-.693-3.915-3.283 0-2.166 1.352-2.596 3.254-2.637l2.58-.055c1.54-.031 2.489-.662 2.489-1.975V82.78c0-1.262-.493-1.895-2.204-1.835l-2.213.079c-2.608.092-3.612-.421-3.543-3.023.061-2.28 1.595-3.273 4.478-3.052 1.569.12 3.148.301 4.722.301 1.721 0 3.434-.042 5.148-.042 2.891 0 4.029 1.753 5.182 4.37l11.777 26.751V83.664c0-1.012-.412-1.794-.732-2.11-.322-.316-.822-.481-1.475-.478l-2.693.019c-1.971.012-3.658-.844-3.623-2.685.055-3.006 2.82-3.496 5.285-3.399 2.385.094 4.965.742 7.32.667 2.227-.071 4.461-.646 6.697-.533 2.885.147 3.951 1.244 3.901 2.92zM179.455 107.746c1.111 0 2.096.396 2.951 1.186.896.832 1.346 1.836 1.346 3.012 0 1.426-.506 2.523-1.518 3.297a4.258 4.258 0 0 1-2.643.902h-.211c-1.004 0-1.926-.42-2.766-1.26-.838-.84-1.258-1.791-1.258-2.852v-.174c0-1.16.398-2.135 1.197-2.926.801-.788 1.767-1.185 2.902-1.185zm.408 3.951c.346 0 .615-.082.809-.246.193-.166.291-.363.291-.594a.77.77 0 0 0-.266-.58c-.178-.164-.422-.246-.736-.246h-1.543v1.666h1.445zm-.308-3.345c-.814 0-1.576.279-2.283.84-.891.699-1.334 1.646-1.334 2.84 0 .914.359 1.742 1.08 2.486.721.746 1.533 1.117 2.438 1.117h.148c.906 0 1.723-.367 2.451-1.104s1.092-1.6 1.092-2.588c0-.971-.359-1.812-1.08-2.523-.719-.713-1.557-1.068-2.512-1.068zm-1.741 1.171h2.221c.504 0 .902.141 1.199.42.264.256.395.561.395.914 0 .338-.125.633-.377.883-.25.252-.6.377-1.043.377l-.174-.012 1.408 2.172h-.703l-1.359-2.074h-.963v2.074h-.604v-4.754z" />
268
- </g>
269
- </svg>
270
- </Logo>
271
- ```
272
-
273
- <Canvas>
274
- <Story
275
- name="Custom Logos"
276
- args={{
277
- size: "large",
278
- }}
279
- >
280
- {(args) => (
281
- <Logo {...args}>
282
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 192.756 192.756">
283
- <g fillRule="evenodd" clipRule="evenodd">
284
- <path fill="#fff" d="M0 0h192.756v192.756H0V0z" />
285
- <path
286
- d="M59.73 117.578c-9.859-4.912-23.261-15.887-23.413-27.06C36.149 78.129 44.451 75.087 50 75.087c5.701 0 8.286 3.345 10.637 5.777 2.352-2.433 4.936-5.777 10.637-5.777 5.549 0 13.851 3.042 13.682 15.431-.151 11.173-13.553 22.148-23.412 27.06-.35.174-.629.262-.907.262s-.557-.088-.907-.262z"
287
- fill="#c23c40"
288
- />
289
- <path d="M184.252 78.225c-.027 1.111-.355 1.921-.799 2.399-.871.945-3.1 1.067-4.283.854-.668-.12-1.309-.167-1.66-.137-1.551.136-2.398 1.115-3.242 2.45l-10.377 16.423-.154 6.727c-.033 1.535.287 2.881 2.066 2.799l2.865-.135c1.725-.08 3.35 1.029 3.4 2.867.064 2.359-1.807 3.393-3.943 3.275-1.338-.072-2.559-.275-3.666-.477-2.355-.428-3.977-.279-6.332 0-2.189.262-3.879.43-5.055.4-1.895-.045-3.725-.988-3.91-2.957-.178-1.898 1.297-3.191 3.186-3.041l2.5.199c.963.076 2.232-.406 2.256-1.533l.152-7.555-10.803-17.373c-.588-.948-1.52-1.538-2.42-1.877-1.156-.435-2.35-.464-3.568-.309-.988.125-1.16.01-1.414-.001-2.166-.093-3.1-1.048-2.988-3.064.139-2.505 1.543-2.885 3.936-2.885.412 0 1.391.005 3.344.285 1.43.206 2.609.099 3.531.067 2.436-.083 4.973-.545 7.377-.479 1.334.037 2.285.338 2.943.667.92.459 1.506 1.161 1.473 2.348-.031 1.144-.484 2.161-1.139 2.645-.496.367-1.848.417-2.902.417-1.92-.046-1.844 1.094-1.24 1.651l7.008 11.204 7.336-11.487c.148-.59.916-1.602-1.146-1.365-.637.073-.715.087-1.48.064-1.1-.033-1.854-.247-2.266-.544-1.348-.974-1.18-1.916-.943-3.322.17-1.019.986-1.48 1.877-1.744.928-.275 1.896-.259 2.871-.267 1.105-.009 2.221.111 3.295.272 1.99.297 3.414.306 5.398.066 1.379-.167 3.006-.5 4.559-.488 1.062.008 2.092.056 2.984.551.867.484 1.4 1.278 1.373 2.41zM31.561 112.531c-.116 2.684-2.242 2.799-4.345 2.799-2.14 0-4.302-.387-6.455-.387-2.396 0-4.788.17-7.178.396-2.739.262-4.681-.342-4.576-2.869.07-1.703 1.047-2.818 3.117-2.814l2.783.004c1.497.002 2.085-1.572 2.082-2.721l-.098-23.305c-.004-1.258-.422-2.46-1.917-2.431l-3.169.064c-2.091.042-3.322-1.33-3.301-3.214.026-2.372 1.934-2.958 3.873-2.897.678.021 2.127.043 3.023.136 1.53.157 3.13.141 4.67.141 2.369 0 4.682-.372 7.012-.372 2.197 0 4.145.564 4.274 3.233.078 1.624-1.636 2.807-3.479 2.776l-2.155-.035c-1.634-.027-2.604 1.158-2.587 2.501l.294 23.462c.028 2.24 1.216 2.869 3.008 2.85l2.109-.025c1.58-.02 3.098.777 3.015 2.708zM135.311 78.065c-.084 2.73-1.73 3.344-4.244 3.344 0-.041-4.09-.461-4.09 1.686v26.908c0 3.244-1.57 6.314-5.01 6.314-2.217 0-4.641-1.143-5.557-3.271l-12.846-29.84-.061 23.363c-.004 1.895.496 2.963 2.393 2.908l2.344-.066c2.098-.061 3.543 1.082 3.482 3.266-.066 2.418-1.879 2.932-3.93 2.932-2.467 0-4.818-.783-7.248-.666-2.58.123-5.081.484-7.668.484-2.227 0-3.915-.693-3.915-3.283 0-2.166 1.352-2.596 3.254-2.637l2.58-.055c1.54-.031 2.489-.662 2.489-1.975V82.78c0-1.262-.493-1.895-2.204-1.835l-2.213.079c-2.608.092-3.612-.421-3.543-3.023.061-2.28 1.595-3.273 4.478-3.052 1.569.12 3.148.301 4.722.301 1.721 0 3.434-.042 5.148-.042 2.891 0 4.029 1.753 5.182 4.37l11.777 26.751V83.664c0-1.012-.412-1.794-.732-2.11-.322-.316-.822-.481-1.475-.478l-2.693.019c-1.971.012-3.658-.844-3.623-2.685.055-3.006 2.82-3.496 5.285-3.399 2.385.094 4.965.742 7.32.667 2.227-.071 4.461-.646 6.697-.533 2.885.147 3.951 1.244 3.901 2.92zM179.455 107.746c1.111 0 2.096.396 2.951 1.186.896.832 1.346 1.836 1.346 3.012 0 1.426-.506 2.523-1.518 3.297a4.258 4.258 0 0 1-2.643.902h-.211c-1.004 0-1.926-.42-2.766-1.26-.838-.84-1.258-1.791-1.258-2.852v-.174c0-1.16.398-2.135 1.197-2.926.801-.788 1.767-1.185 2.902-1.185zm.408 3.951c.346 0 .615-.082.809-.246.193-.166.291-.363.291-.594a.77.77 0 0 0-.266-.58c-.178-.164-.422-.246-.736-.246h-1.543v1.666h1.445zm-.308-3.345c-.814 0-1.576.279-2.283.84-.891.699-1.334 1.646-1.334 2.84 0 .914.359 1.742 1.08 2.486.721.746 1.533 1.117 2.438 1.117h.148c.906 0 1.723-.367 2.451-1.104s1.092-1.6 1.092-2.588c0-.971-.359-1.812-1.08-2.523-.719-.713-1.557-1.068-2.512-1.068zm-1.741 1.171h2.221c.504 0 .902.141 1.199.42.264.256.395.561.395.914 0 .338-.125.633-.377.883-.25.252-.6.377-1.043.377l-.174-.012 1.408 2.172h-.703l-1.359-2.074h-.963v2.074h-.604v-4.754z" />
290
- </g>
291
- </svg>
292
- </Logo>
293
- )}
294
- </Story>
295
- </Canvas>
@@ -1,116 +0,0 @@
1
- import * as React from "react";
2
- import { render } from "@testing-library/react";
3
- import { axe } from "jest-axe";
4
- import renderer from "react-test-renderer";
5
-
6
- import Logo from "./Logo";
7
-
8
- describe("Logo Accessibility", () => {
9
- it("passes axe accessibility test", async () => {
10
- const { container } = render(<Logo name="nyplFullBlack" />);
11
- expect(await axe(container)).toHaveNoViolations();
12
- });
13
- });
14
-
15
- describe("Logo", () => {
16
- it("consoles a warning if both name and children are passed to Logo", () => {
17
- const warn = jest.spyOn(console, "warn");
18
- render(
19
- <Logo name="nyplFullBlack">
20
- <svg viewBox="0 0 24 14" xmlns="http://www.w3.org/2000/svg">
21
- <path
22
- fillRule="evenodd"
23
- clipRule="evenodd"
24
- d="M10.526 12.871L.263 1.676 1.737.324 12 11.52 22.263.324l1.474 1.352L13.474 12.87a2 2 0 01-2.948 0z"
25
- />
26
- </svg>
27
- </Logo>
28
- );
29
- expect(warn).toHaveBeenCalledWith(
30
- "NYPL Reservoir Logo: Pass either a `name` prop or an `svg` element child. Do not pass both."
31
- );
32
- });
33
-
34
- it("consoles a warning if both name and children are not passed", () => {
35
- const warn = jest.spyOn(console, "warn");
36
- render(<Logo />);
37
- expect(warn).toHaveBeenCalledWith(
38
- "NYPL Reservoir Logo: Pass a logo `name` prop or an SVG child to " +
39
- "`Logo` to ensure a logo appears."
40
- );
41
- });
42
-
43
- it("consoles a warning if name is not passed and a child is but it's not an SVG element", () => {
44
- const warn = jest.spyOn(console, "warn");
45
- render(<Logo>Not an SVG</Logo>);
46
- expect(warn).toHaveBeenCalledWith(
47
- "NYPL Reservoir Logo: An `svg` element must be passed to the `Logo` " +
48
- "component as its child."
49
- );
50
- });
51
-
52
- it("renders a logo based on the logo `name` prop", () => {
53
- const { container } = render(<Logo name="nyplFullBlack" />);
54
- expect(container.querySelector("svg")).toBeInTheDocument();
55
- });
56
-
57
- // NOTE: the svg logo is dynamically generated by the "svgr" package. At build
58
- // time, it generate the `title` element but it doesn't generate it for tests.
59
- // In order to test this, we can check the `title` attribute in the svg
60
- // element itself. Inspect the `Logo` in Storybook to see the `title` element.
61
- it("renders a title element", () => {
62
- const { container, rerender } = render(<Logo name="nyplFullBlack" />);
63
- expect(container.querySelector("svg")).toHaveAttribute(
64
- "title",
65
- "nyplFullBlack logo"
66
- );
67
-
68
- rerender(<Logo name="nyplFullBlack" title="title content" />);
69
- expect(container.querySelector("svg")).toHaveAttribute(
70
- "title",
71
- "title content"
72
- );
73
- });
74
-
75
- it("renders a logo based on the child", () => {
76
- const { container } = render(
77
- <Logo>
78
- <svg viewBox="0 0 24 14" xmlns="http://www.w3.org/2000/svg">
79
- <path
80
- fillRule="evenodd"
81
- clipRule="evenodd"
82
- d="M10.526 12.871L.263 1.676 1.737.324 12 11.52 22.263.324l1.474 1.352L13.474 12.87a2 2 0 01-2.948 0z"
83
- />
84
- </svg>
85
- </Logo>
86
- );
87
- expect(container.querySelector("svg")).toBeInTheDocument();
88
- });
89
-
90
- it("renders the UI snapshot correctly", () => {
91
- const standard = renderer
92
- .create(<Logo id="test-logo" name="nyplFullBlack" />)
93
- .toJSON();
94
- const withCustomSize = renderer
95
- .create(<Logo id="test-logo-size" name="nyplFullBlack" size="large" />)
96
- .toJSON();
97
- const withChakraProps = renderer
98
- .create(
99
- <Logo
100
- id="chakra"
101
- name="nyplFullBlack"
102
- p="20px"
103
- color="ui.error.primary"
104
- />
105
- )
106
- .toJSON();
107
- const withOtherProps = renderer
108
- .create(<Logo id="props" name="nyplFullBlack" data-testid="props" />)
109
- .toJSON();
110
-
111
- expect(standard).toMatchSnapshot();
112
- expect(withCustomSize).toMatchSnapshot();
113
- expect(withChakraProps).toMatchSnapshot();
114
- expect(withOtherProps).toMatchSnapshot();
115
- });
116
- });
@@ -1,151 +0,0 @@
1
- import {
2
- Box,
3
- chakra,
4
- Icon as ChakraIcon,
5
- useStyleConfig,
6
- } from "@chakra-ui/react";
7
- import * as React from "react";
8
-
9
- import logoSvgs from "./LogoSvgs";
10
-
11
- export type LogoNames =
12
- | "appleAppStoreBlack"
13
- | "appleAppStoreWhite"
14
- | "bplBlack"
15
- | "bplWhite"
16
- | "cleverBadgeColor"
17
- | "cleverColor"
18
- | "cleverWhite"
19
- | "firstbookColor"
20
- | "firstbookColorNegative"
21
- | "googlePlayBlack"
22
- | "lpaBlack"
23
- | "lpaColor"
24
- | "lpaWhite"
25
- | "mlnBlack"
26
- | "mlnWhite"
27
- | "nyplFullBlack"
28
- | "nyplFullWhite"
29
- | "nyplLionBlack"
30
- | "nyplLionWhite"
31
- | "openebooksColor"
32
- | "openebooksNegative"
33
- | "openebooksWithTextColor"
34
- | "openebooksWithTextNegative"
35
- | "qplAltBlack"
36
- | "qplAltWhite"
37
- | "qplBlack"
38
- | "qplColor"
39
- | "qplWhite"
40
- | "reservoirIconColor"
41
- | "reservoirVerticalColor"
42
- | "schomburgBlack"
43
- | "schomburgCircleBlack"
44
- | "schomburgCircleColor"
45
- | "schomburgCircleWhite"
46
- | "schomburgColor"
47
- | "schomburgWhite"
48
- | "simplyeBlack"
49
- | "simplyeWhite"
50
- | "simplyeColor"
51
- | "snflBlack"
52
- | "snflWhite"
53
- | "treasuresColor"
54
- | "treasuresColorNegative";
55
- export type LogoSizes =
56
- | "default"
57
- | "xxsmall"
58
- | "xsmall"
59
- | "small"
60
- | "medium"
61
- | "large";
62
- export interface LogoProps {
63
- /** Optional className that will be added to the parent element */
64
- className?: string;
65
- /** Logos designated as decorative will be ignored by screenreaders. False
66
- * by default. */
67
- decorative?: boolean;
68
- /** ID that other components can cross reference for accessibility purposes */
69
- id?: string;
70
- /** The name of the logo you want to use. */
71
- name?: LogoNames;
72
- /** Sets the logo size. */
73
- size?: LogoSizes;
74
- /** For accessibility purposes, the text passed in the `title` prop gets
75
- * rendered in a `title` element in the SVG. This descriptive text is not
76
- * visible but is needed for screenreaders to describe the graphic. */
77
- title?: string;
78
- }
79
-
80
- /**
81
- * The `Logo` component renders SVG-based logos and color variants that are
82
- * commonly used by the New York Public Library.
83
- */
84
- export const Logo = chakra((props: React.PropsWithChildren<LogoProps>) => {
85
- const {
86
- children,
87
- className,
88
- decorative = false,
89
- id,
90
- name,
91
- size = "medium",
92
- title = `${name} logo`,
93
- ...rest
94
- } = props;
95
- const styles = useStyleConfig("Logo", {
96
- size,
97
- });
98
- const logoProps = {
99
- "aria-hidden": decorative,
100
- className,
101
- id,
102
- role: "img",
103
- title,
104
- ...rest,
105
- };
106
- let childSVG = null;
107
-
108
- // Component prop validation
109
- if (name && children) {
110
- console.warn(
111
- "NYPL Reservoir Logo: Pass either a `name` prop or an `svg` element " +
112
- "child. Do not pass both."
113
- );
114
- return null;
115
- } else if (!name && !children) {
116
- console.warn(
117
- "NYPL Reservoir Logo: Pass a logo `name` prop or an SVG child to " +
118
- "`Logo` to ensure a logo appears."
119
- );
120
- return null;
121
- }
122
-
123
- // The user wants to render an existing logo. Load the logo and render it
124
- // as a component through Chakra's Icon component. Otherwise, we're going to
125
- // render the SVG child with NYPL-theme styling.
126
- if (name) {
127
- const SvgComponent: any = logoSvgs[name];
128
- return <ChakraIcon as={SvgComponent} {...logoProps} __css={styles} />;
129
- }
130
-
131
- // If no `name` prop was passed, we expect a child SVG element to be passed.
132
- // Apply logo props to the SVG child.
133
- if (
134
- (children as JSX.Element).type === "svg" ||
135
- (children as JSX.Element).props?.type === "svg" ||
136
- (children as JSX.Element).props?.mdxType === "svg"
137
- ) {
138
- childSVG = React.cloneElement(children as JSX.Element, {
139
- ...logoProps,
140
- });
141
- } else {
142
- console.warn(
143
- "NYPL Reservoir Logo: An `svg` element must be passed to the `Logo` " +
144
- "component as its child."
145
- );
146
- }
147
-
148
- return <Box __css={styles}>{childSVG}</Box>;
149
- });
150
-
151
- export default Logo;
@@ -1,90 +0,0 @@
1
- /* eslint-disable camelcase */
2
- import appleAppStoreBlack from "../../../icons/svg/logo-apple-app-store-black.svg";
3
- import appleAppStoreWhite from "../../../icons/svg/logo-apple-app-store-white.svg";
4
- import bplBlack from "../../../icons/svg/logo-bpl-black.svg";
5
- import bplWhite from "../../../icons/svg/logo-bpl-white.svg";
6
- import cleverBadgeColor from "../../../icons/svg/logo-clever-badge-color.svg";
7
- import cleverColor from "../../../icons/svg/logo-clever-color.svg";
8
- import cleverWhite from "../../../icons/svg/logo-clever-white.svg";
9
- import firstbookColor from "../../../icons/svg/logo-firstbook-color.svg";
10
- import firstbookColorNegative from "../../../icons/svg/logo-firstbook-color-negative.svg";
11
- import googlePlayBlack from "../../../icons/svg/logo-google-play-black.svg";
12
- import lpaColor from "../../../icons/svg/logo-lpa-color.svg";
13
- import lpaBlack from "../../../icons/svg/logo-lpa-black.svg";
14
- import lpaWhite from "../../../icons/svg/logo-lpa-white.svg";
15
- import mlnBlack from "../../../icons/svg/logo-mln-black.svg";
16
- import mlnWhite from "../../../icons/svg/logo-mln-white.svg";
17
- import nyplFullBlack from "../../../icons/svg/logo-nypl-full-black.svg";
18
- import nyplFullWhite from "../../../icons/svg/logo-nypl-full-white.svg";
19
- import nyplLionBlack from "../../../icons/svg/logo-nypl-lion-black.svg";
20
- import nyplLionWhite from "../../../icons/svg/logo-nypl-lion-white.svg";
21
- import openebooksColor from "../../../icons/svg/logo-openebooks-color.svg";
22
- import openebooksNegative from "../../../icons/svg/logo-openebooks-negative.svg";
23
- import openebooksWithTextColor from "../../../icons/svg/logo-openebooks-with-text-color.svg";
24
- import openebooksWithTextNegative from "../../../icons/svg/logo-openebooks-with-text-negative.svg";
25
- import qplAltBlack from "../../../icons/svg/logo-qpl-alt-black.svg";
26
- import qplAltWhite from "../../../icons/svg/logo-qpl-alt-white.svg";
27
- import qplBlack from "../../../icons/svg/logo-qpl-black.svg";
28
- import qplColor from "../../../icons/svg/logo-qpl-color.svg";
29
- import qplWhite from "../../../icons/svg/logo-qpl-white.svg";
30
- import reservoirIconColor from "../../../icons/svg/logo-reservoir-icon-color.svg";
31
- import reservoirVerticalColor from "../../../icons/svg/logo-reservoir-vertical-color.svg";
32
- import schomburgBlack from "../../../icons/svg/logo-schomburg-black.svg";
33
- import schomburgCircleBlack from "../../../icons/svg/logo-schomburg-circle-black.svg";
34
- import schomburgCircleColor from "../../../icons/svg/logo-schomburg-circle-color.svg";
35
- import schomburgCircleWhite from "../../../icons/svg/logo-schomburg-circle-white.svg";
36
- import schomburgColor from "../../../icons/svg/logo-schomburg-color.svg";
37
- import schomburgWhite from "../../../icons/svg/logo-schomburg-white.svg";
38
- import simplyeBlack from "../../../icons/svg/logo-simplye-black.svg";
39
- import simplyeWhite from "../../../icons/svg/logo-simplye-white.svg";
40
- import simplyeColor from "../../../icons/svg/logo-simplye-color.svg";
41
- import snflBlack from "../../../icons/svg/logo-snfl-black.svg";
42
- import snflWhite from "../../../icons/svg/logo-snfl-white.svg";
43
- import treasuresColor from "../../../icons/svg/logo-treasures-color.svg";
44
- import treasuresColorNegative from "../../../icons/svg/logo-treasures-color-negative.svg";
45
-
46
- export default {
47
- appleAppStoreBlack,
48
- appleAppStoreWhite,
49
- bplBlack,
50
- bplWhite,
51
- cleverBadgeColor,
52
- cleverColor,
53
- cleverWhite,
54
- firstbookColor,
55
- firstbookColorNegative,
56
- googlePlayBlack,
57
- lpaBlack,
58
- lpaColor,
59
- lpaWhite,
60
- mlnBlack,
61
- mlnWhite,
62
- nyplFullBlack,
63
- nyplFullWhite,
64
- nyplLionBlack,
65
- nyplLionWhite,
66
- openebooksColor,
67
- openebooksNegative,
68
- openebooksWithTextColor,
69
- openebooksWithTextNegative,
70
- qplAltBlack,
71
- qplAltWhite,
72
- qplBlack,
73
- qplColor,
74
- qplWhite,
75
- reservoirIconColor,
76
- reservoirVerticalColor,
77
- schomburgBlack,
78
- schomburgCircleBlack,
79
- schomburgCircleColor,
80
- schomburgCircleWhite,
81
- schomburgColor,
82
- schomburgWhite,
83
- simplyeBlack,
84
- simplyeWhite,
85
- simplyeColor,
86
- snflBlack,
87
- snflWhite,
88
- treasuresColor,
89
- treasuresColorNegative,
90
- };