@nypl/design-system-react-components 1.0.2 → 1.0.3-beta

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 (282) hide show
  1. package/README.md +0 -2
  2. package/dist/components/Slider/Slider.d.ts +1 -2
  3. package/dist/components/TextInput/TextInput.d.ts +2 -1
  4. package/dist/design-system-react-components.cjs.development.js +33 -10
  5. package/dist/design-system-react-components.cjs.development.js.map +1 -1
  6. package/dist/design-system-react-components.cjs.production.min.js +1 -1
  7. package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
  8. package/dist/design-system-react-components.esm.js +33 -10
  9. package/dist/design-system-react-components.esm.js.map +1 -1
  10. package/dist/hooks/{tests → __tests__}/useCarouselStyles.test.d.ts +0 -0
  11. package/dist/theme/components/global.d.ts +1 -1
  12. package/dist/theme/components/radio.d.ts +8 -0
  13. package/dist/theme/components/template.d.ts +4 -1
  14. package/package.json +2 -3
  15. package/CHANGELOG.md +0 -1430
  16. package/src/__tests__/fileMock.ts +0 -6
  17. package/src/__tests__/setup.ts +0 -27
  18. package/src/__tests__/utils/utils.test.ts +0 -18
  19. package/src/components/AccessibilityGuide/SkipNavigation.stories.mdx +0 -42
  20. package/src/components/Accordion/Accordion.stories.mdx +0 -333
  21. package/src/components/Accordion/Accordion.test.tsx +0 -237
  22. package/src/components/Accordion/Accordion.tsx +0 -137
  23. package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +0 -734
  24. package/src/components/Autosuggest/Autosuggest.stories.mdx +0 -75
  25. package/src/components/Autosuggest/Autosuggest.stories.tsx +0 -211
  26. package/src/components/Autosuggest/_Autosuggest.scss +0 -51
  27. package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +0 -231
  28. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +0 -144
  29. package/src/components/Breadcrumbs/Breadcrumbs.tsx +0 -98
  30. package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +0 -695
  31. package/src/components/Button/Button.stories.mdx +0 -320
  32. package/src/components/Button/Button.test.tsx +0 -184
  33. package/src/components/Button/Button.tsx +0 -95
  34. package/src/components/Button/__snapshots__/Button.test.tsx.snap +0 -106
  35. package/src/components/ButtonGroup/ButtonGroup.stories.mdx +0 -178
  36. package/src/components/ButtonGroup/ButtonGroup.test.tsx +0 -141
  37. package/src/components/ButtonGroup/ButtonGroup.tsx +0 -100
  38. package/src/components/ButtonGroup/__snapshots__/ButtonGroup.test.tsx.snap +0 -117
  39. package/src/components/Card/Card.stories.mdx +0 -1041
  40. package/src/components/Card/Card.test.tsx +0 -388
  41. package/src/components/Card/Card.tsx +0 -346
  42. package/src/components/Card/__snapshots__/Card.test.tsx.snap +0 -568
  43. package/src/components/Chakra/Box.stories.mdx +0 -52
  44. package/src/components/Chakra/Center.stories.mdx +0 -96
  45. package/src/components/Chakra/Flex.stories.mdx +0 -111
  46. package/src/components/Chakra/Grid.stories.mdx +0 -89
  47. package/src/components/Chakra/Stack.stories.mdx +0 -109
  48. package/src/components/Checkbox/Checkbox.stories.mdx +0 -243
  49. package/src/components/Checkbox/Checkbox.test.tsx +0 -350
  50. package/src/components/Checkbox/Checkbox.tsx +0 -152
  51. package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +0 -661
  52. package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +0 -462
  53. package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +0 -492
  54. package/src/components/CheckboxGroup/CheckboxGroup.tsx +0 -173
  55. package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +0 -1842
  56. package/src/components/ComponentWrapper/ComponentWrapper.test.tsx +0 -163
  57. package/src/components/ComponentWrapper/ComponentWrapper.tsx +0 -76
  58. package/src/components/ComponentWrapper/__snapshots__/ComponentWrapper.test.tsx.snap +0 -103
  59. package/src/components/DatePicker/DatePicker.stories.mdx +0 -452
  60. package/src/components/DatePicker/DatePicker.test.tsx +0 -940
  61. package/src/components/DatePicker/DatePicker.tsx +0 -450
  62. package/src/components/DatePicker/_DatePicker.scss +0 -100
  63. package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +0 -908
  64. package/src/components/Fieldset/Fieldset.stories.mdx +0 -96
  65. package/src/components/Fieldset/Fieldset.test.tsx +0 -155
  66. package/src/components/Fieldset/Fieldset.tsx +0 -55
  67. package/src/components/Fieldset/__snapshots__/Fieldset.test.tsx.snap +0 -89
  68. package/src/components/Form/Form.stories.mdx +0 -426
  69. package/src/components/Form/Form.test.tsx +0 -234
  70. package/src/components/Form/Form.tsx +0 -124
  71. package/src/components/Form/__snapshots__/Form.test.tsx.snap +0 -115
  72. package/src/components/Grid/SimpleGrid.stories.mdx +0 -336
  73. package/src/components/Grid/SimpleGrid.test.tsx +0 -79
  74. package/src/components/Grid/SimpleGrid.tsx +0 -49
  75. package/src/components/Grid/__snapshots__/SimpleGrid.test.tsx.snap +0 -23
  76. package/src/components/Heading/Heading.stories.mdx +0 -187
  77. package/src/components/Heading/Heading.test.tsx +0 -171
  78. package/src/components/Heading/Heading.tsx +0 -104
  79. package/src/components/Heading/__snapshots__/Heading.test.tsx.snap +0 -90
  80. package/src/components/HelperErrorText/HelperErrorText.stories.mdx +0 -172
  81. package/src/components/HelperErrorText/HelperErrorText.test.tsx +0 -114
  82. package/src/components/HelperErrorText/HelperErrorText.tsx +0 -62
  83. package/src/components/HelperErrorText/__snapshots__/HelperErrorText.test.tsx.snap +0 -93
  84. package/src/components/Hero/Hero.stories.mdx +0 -378
  85. package/src/components/Hero/Hero.test.tsx +0 -611
  86. package/src/components/Hero/Hero.tsx +0 -203
  87. package/src/components/Hero/__snapshots__/Hero.test.tsx.snap +0 -379
  88. package/src/components/HorizontalRule/HorizontalRule.stories.mdx +0 -73
  89. package/src/components/HorizontalRule/HorizontalRule.test.tsx +0 -54
  90. package/src/components/HorizontalRule/HorizontalRule.tsx +0 -27
  91. package/src/components/HorizontalRule/__snapshots__/HorizontalRule.test.tsx.snap +0 -44
  92. package/src/components/Icons/Icon.stories.mdx +0 -413
  93. package/src/components/Icons/Icon.test.tsx +0 -120
  94. package/src/components/Icons/Icon.tsx +0 -187
  95. package/src/components/Icons/IconSvgs.tsx +0 -64
  96. package/src/components/Icons/__snapshots__/Icon.test.tsx.snap +0 -129
  97. package/src/components/Image/Image.stories.mdx +0 -332
  98. package/src/components/Image/Image.test.tsx +0 -155
  99. package/src/components/Image/Image.tsx +0 -171
  100. package/src/components/Image/__snapshots__/Image.test.tsx.snap +0 -269
  101. package/src/components/Label/Label.stories.mdx +0 -100
  102. package/src/components/Label/Label.test.tsx +0 -116
  103. package/src/components/Label/Label.tsx +0 -55
  104. package/src/components/Label/__snapshots__/Label.test.tsx.snap +0 -45
  105. package/src/components/Link/Link.stories.mdx +0 -249
  106. package/src/components/Link/Link.test.tsx +0 -224
  107. package/src/components/Link/Link.tsx +0 -178
  108. package/src/components/Link/__snapshots__/Link.test.tsx.snap +0 -286
  109. package/src/components/List/List.stories.mdx +0 -393
  110. package/src/components/List/List.test.tsx +0 -265
  111. package/src/components/List/List.tsx +0 -156
  112. package/src/components/List/__snapshots__/List.test.tsx.snap +0 -213
  113. package/src/components/Logo/Logo.stories.mdx +0 -295
  114. package/src/components/Logo/Logo.test.tsx +0 -116
  115. package/src/components/Logo/Logo.tsx +0 -151
  116. package/src/components/Logo/LogoSvgs.tsx +0 -90
  117. package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +0 -142
  118. package/src/components/Modal/Modal.stories.mdx +0 -294
  119. package/src/components/Modal/Modal.test.tsx +0 -157
  120. package/src/components/Modal/Modal.tsx +0 -154
  121. package/src/components/Modal/__snapshots__/Modal.test.tsx.snap +0 -25
  122. package/src/components/Notification/Notification.stories.mdx +0 -358
  123. package/src/components/Notification/Notification.test.tsx +0 -279
  124. package/src/components/Notification/Notification.tsx +0 -224
  125. package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +0 -525
  126. package/src/components/Pagination/Pagination.stories.mdx +0 -184
  127. package/src/components/Pagination/Pagination.test.tsx +0 -419
  128. package/src/components/Pagination/Pagination.tsx +0 -269
  129. package/src/components/Pagination/__snapshots__/Pagination.test.tsx.snap +0 -544
  130. package/src/components/Placeholder/Placeholder.tsx +0 -19
  131. package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +0 -360
  132. package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +0 -298
  133. package/src/components/ProgressIndicator/ProgressIndicator.tsx +0 -132
  134. package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +0 -434
  135. package/src/components/Radio/Radio.stories.mdx +0 -216
  136. package/src/components/Radio/Radio.test.tsx +0 -247
  137. package/src/components/Radio/Radio.tsx +0 -119
  138. package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +0 -451
  139. package/src/components/RadioGroup/RadioGroup.stories.mdx +0 -479
  140. package/src/components/RadioGroup/RadioGroup.test.tsx +0 -471
  141. package/src/components/RadioGroup/RadioGroup.tsx +0 -171
  142. package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +0 -1550
  143. package/src/components/SearchBar/SearchBar.stories.mdx +0 -518
  144. package/src/components/SearchBar/SearchBar.test.tsx +0 -435
  145. package/src/components/SearchBar/SearchBar.tsx +0 -210
  146. package/src/components/SearchBar/__snapshots__/SearchBar.test.tsx.snap +0 -1049
  147. package/src/components/Select/Select.stories.mdx +0 -439
  148. package/src/components/Select/Select.test.tsx +0 -358
  149. package/src/components/Select/Select.tsx +0 -183
  150. package/src/components/Select/__snapshots__/Select.test.tsx.snap +0 -895
  151. package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +0 -142
  152. package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +0 -116
  153. package/src/components/SkeletonLoader/SkeletonLoader.tsx +0 -123
  154. package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +0 -898
  155. package/src/components/SkipNavigation/SkipNavigation.stories.mdx +0 -90
  156. package/src/components/SkipNavigation/SkipNavigation.test.tsx +0 -63
  157. package/src/components/SkipNavigation/SkipNavigation.tsx +0 -51
  158. package/src/components/SkipNavigation/__snapshots__/SkipNavigation.test.tsx.snap +0 -130
  159. package/src/components/Slider/Slider.stories.mdx +0 -628
  160. package/src/components/Slider/Slider.test.tsx +0 -736
  161. package/src/components/Slider/Slider.tsx +0 -322
  162. package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +0 -2186
  163. package/src/components/StatusBadge/StatusBadge.stories.mdx +0 -109
  164. package/src/components/StatusBadge/StatusBadge.test.tsx +0 -70
  165. package/src/components/StatusBadge/StatusBadge.tsx +0 -35
  166. package/src/components/StatusBadge/__snapshots__/StatusBadge.test.tsx.snap +0 -47
  167. package/src/components/StructuredContent/StructuredContent.stories.mdx +0 -567
  168. package/src/components/StructuredContent/StructuredContent.test.tsx +0 -435
  169. package/src/components/StructuredContent/StructuredContent.tsx +0 -139
  170. package/src/components/StructuredContent/__snapshots__/StructuredContent.test.tsx.snap +0 -368
  171. package/src/components/StyleGuide/Bidirectionality.stories.mdx +0 -206
  172. package/src/components/StyleGuide/Breakpoints.stories.mdx +0 -55
  173. package/src/components/StyleGuide/Buttons.stories.mdx +0 -194
  174. package/src/components/StyleGuide/ColorCard.tsx +0 -43
  175. package/src/components/StyleGuide/Colors.stories.mdx +0 -201
  176. package/src/components/StyleGuide/DesignTokens.stories.mdx +0 -193
  177. package/src/components/StyleGuide/Forms.stories.mdx +0 -94
  178. package/src/components/StyleGuide/Iconography.stories.mdx +0 -142
  179. package/src/components/StyleGuide/Spacing.stories.mdx +0 -116
  180. package/src/components/StyleGuide/Typography.stories.mdx +0 -419
  181. package/src/components/Table/Table.stories.mdx +0 -272
  182. package/src/components/Table/Table.test.tsx +0 -241
  183. package/src/components/Table/Table.tsx +0 -152
  184. package/src/components/Table/__snapshots__/Table.test.tsx.snap +0 -1703
  185. package/src/components/Tabs/Tabs.stories.mdx +0 -338
  186. package/src/components/Tabs/Tabs.test.tsx +0 -298
  187. package/src/components/Tabs/Tabs.tsx +0 -264
  188. package/src/components/Tabs/__snapshots__/Tabs.test.tsx.snap +0 -584
  189. package/src/components/Template/Template.stories.mdx +0 -695
  190. package/src/components/Template/Template.test.tsx +0 -309
  191. package/src/components/Template/Template.tsx +0 -326
  192. package/src/components/Template/__snapshots__/Template.test.tsx.snap +0 -342
  193. package/src/components/Text/Text.stories.mdx +0 -103
  194. package/src/components/Text/Text.test.tsx +0 -63
  195. package/src/components/Text/Text.tsx +0 -50
  196. package/src/components/Text/__snapshots__/Text.test.tsx.snap +0 -50
  197. package/src/components/TextInput/TextInput.stories.mdx +0 -268
  198. package/src/components/TextInput/TextInput.test.tsx +0 -451
  199. package/src/components/TextInput/TextInput.tsx +0 -240
  200. package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +0 -274
  201. package/src/components/Toggle/Toggle.stories.mdx +0 -237
  202. package/src/components/Toggle/Toggle.test.tsx +0 -170
  203. package/src/components/Toggle/Toggle.tsx +0 -128
  204. package/src/components/Toggle/__snapshots__/Toggle.test.tsx.snap +0 -470
  205. package/src/components/VideoPlayer/VideoPlayer.stories.mdx +0 -212
  206. package/src/components/VideoPlayer/VideoPlayer.test.tsx +0 -308
  207. package/src/components/VideoPlayer/VideoPlayer.tsx +0 -188
  208. package/src/components/VideoPlayer/__snapshots__/VideoPlayer.test.tsx.snap +0 -192
  209. package/src/docs/Chakra.stories.mdx +0 -563
  210. package/src/docs/Welcome.stories.mdx +0 -148
  211. package/src/helpers/types.ts +0 -1
  212. package/src/hooks/tests/useCarouselStyles.test.ts +0 -140
  213. package/src/hooks/tests/useNYPLTheme.test.tsx +0 -36
  214. package/src/hooks/useCarouselStyles.stories.mdx +0 -30
  215. package/src/hooks/useCarouselStyles.ts +0 -35
  216. package/src/hooks/useNYPLTheme.stories.mdx +0 -98
  217. package/src/hooks/useNYPLTheme.ts +0 -91
  218. package/src/hooks/useWindowSize.stories.mdx +0 -23
  219. package/src/hooks/useWindowSize.ts +0 -40
  220. package/src/index.ts +0 -136
  221. package/src/resources.scss +0 -6
  222. package/src/styles/base/_01-breakpoints.scss +0 -27
  223. package/src/styles/base/_02-mixins.scss +0 -103
  224. package/src/styles/base/_place-holder.scss +0 -33
  225. package/src/styles/space/_space-inline.scss +0 -79
  226. package/src/styles/space/_space-inset.scss +0 -57
  227. package/src/styles/space/_space-stack.scss +0 -116
  228. package/src/styles.scss +0 -23
  229. package/src/theme/components/accordion.ts +0 -25
  230. package/src/theme/components/breadcrumb.ts +0 -94
  231. package/src/theme/components/button.ts +0 -133
  232. package/src/theme/components/buttonGroup.ts +0 -10
  233. package/src/theme/components/card.ts +0 -237
  234. package/src/theme/components/checkbox.ts +0 -110
  235. package/src/theme/components/checkboxGroup.ts +0 -10
  236. package/src/theme/components/componentWrapper.ts +0 -14
  237. package/src/theme/components/customTable.ts +0 -77
  238. package/src/theme/components/datePicker.ts +0 -17
  239. package/src/theme/components/fieldset.ts +0 -23
  240. package/src/theme/components/global.ts +0 -91
  241. package/src/theme/components/globalMixins.ts +0 -24
  242. package/src/theme/components/heading.ts +0 -79
  243. package/src/theme/components/helperErrorText.ts +0 -14
  244. package/src/theme/components/hero.ts +0 -238
  245. package/src/theme/components/horizontalRule.ts +0 -17
  246. package/src/theme/components/icon.ts +0 -88
  247. package/src/theme/components/image.ts +0 -136
  248. package/src/theme/components/label.ts +0 -15
  249. package/src/theme/components/link.ts +0 -63
  250. package/src/theme/components/list.ts +0 -88
  251. package/src/theme/components/logo.ts +0 -58
  252. package/src/theme/components/notification.ts +0 -132
  253. package/src/theme/components/pagination.ts +0 -17
  254. package/src/theme/components/progressIndicator.ts +0 -67
  255. package/src/theme/components/radio.ts +0 -103
  256. package/src/theme/components/radioGroup.ts +0 -10
  257. package/src/theme/components/searchBar.ts +0 -19
  258. package/src/theme/components/select.ts +0 -72
  259. package/src/theme/components/skeletonLoader.ts +0 -113
  260. package/src/theme/components/skipNavigation.ts +0 -29
  261. package/src/theme/components/slider.ts +0 -95
  262. package/src/theme/components/statusBadge.ts +0 -26
  263. package/src/theme/components/structuredContent.ts +0 -149
  264. package/src/theme/components/tabs.ts +0 -109
  265. package/src/theme/components/template.ts +0 -114
  266. package/src/theme/components/text.ts +0 -38
  267. package/src/theme/components/textInput.ts +0 -65
  268. package/src/theme/components/toggle.ts +0 -109
  269. package/src/theme/components/videoPlayer.ts +0 -47
  270. package/src/theme/foundations/breakpoints.ts +0 -24
  271. package/src/theme/foundations/colors.ts +0 -212
  272. package/src/theme/foundations/global.ts +0 -43
  273. package/src/theme/foundations/radii.ts +0 -7
  274. package/src/theme/foundations/shadows.ts +0 -5
  275. package/src/theme/foundations/spacing.ts +0 -136
  276. package/src/theme/foundations/typography.ts +0 -107
  277. package/src/theme/index.ts +0 -131
  278. package/src/theme/provider.tsx +0 -9
  279. package/src/theme/types.ts +0 -1
  280. package/src/utils/componentCategories.ts +0 -152
  281. package/src/utils/interfaces.ts +0 -5
  282. package/src/utils/utils.ts +0 -84
@@ -1,563 +0,0 @@
1
- import { Meta } from "@storybook/addon-docs";
2
-
3
- import Button from "../components/Button/Button";
4
- import Text from "../components/Text/Text";
5
- import DSProvider from "../theme/provider";
6
-
7
- <Meta title="Chakra UI" />
8
-
9
- # Chakra UI
10
-
11
- | Table of Contents |
12
- | ----------------------------------- |
13
- | 1. [Why Chakra UI?](#why-chakra-ui) |
14
- | 2. [DSProvider](#dsprovider) |
15
- | 3. [Components](#components) |
16
- | 4. [Styling](#styling) |
17
- | 5. [Style Props](#style-props) |
18
- | 6. [Hooks](#hooks) |
19
- | 7. [Testing](#testing) |
20
-
21
- ## Why Chakra UI?
22
-
23
- The Reservoir Design System (DS) project was influenced by other design systems but
24
- ultimately we decided to initially build DS components from scratch rather than
25
- use another design system as its foundation. To better help all the projects at
26
- NYPL and to better scale with all the components we have built and still need to
27
- build, we decided to integrate Chakra UI into the DS.
28
-
29
- Chakra UI is an open source component library that is opinionated and uses design
30
- and development patterns that various projects at NYPL use. Since the DS
31
- will be the foundation for all NYPL projects moving forward, using Chakra will
32
- help us align all projects so similar patterns are used throughout various teams
33
- and projects.
34
-
35
- Chakra follows WAI-ARIA and WCAG 2.1 standards and guidelines which aligns with
36
- the standards that NYPL follows for its own components and applications.
37
-
38
- With design and development consistency, the ability to customize components
39
- _if necessary_, and accessibility standards in place, developers at NYPL using
40
- the Design System will be able to build out applications faster.
41
-
42
- We recommend to read Chakra's own [documentation](https://chakra-ui.com/docs/getting-started)
43
- to get up to speed on it. This file will provide information on how it is used
44
- in the DS but we rely on Chakra's documentation.
45
-
46
- If you need help updating to a newer version of the DS, check out
47
- our [Chakra Migration Guide](https://github.com/NYPL/nypl-design-system/blob/development/CHAKRA_MIGRATION_GUIDE.md).
48
-
49
- ## DSProvider
50
-
51
- In order to use DS components in a consuming application, there is a necessary
52
- step that must be done for component styles to properly render. Consuming
53
- applications need to wrap all the DS components with a simple provider
54
- component. Fortunately, this only needs to be done once at the top level of the
55
- consuming application.
56
-
57
- Once the following is completed, DS components that internally use Chakra UI
58
- will render styles properly. Internally, the `DSProvider` is built on top of
59
- Chakra's `ChakraProvider` component with NYPL's custom theme as input. This sets
60
- up the style context to propogate through all the children nodes in the DOM tree.
61
-
62
- ```tsx
63
- // your main application file
64
- import { DSProvider } from "@nypl/design-system-react-components";
65
-
66
- // ...
67
- const Application = (props) => {
68
- // ...
69
- return (
70
- <DSProvider>
71
- <header>...</header>
72
- <div className="my-app">
73
- // ...
74
- {children}
75
- </div>
76
- <footer>...</footer>
77
- </DSProvider>
78
- );
79
- };
80
- ```
81
-
82
- ### Chakra Components in Storybook
83
-
84
- Storybook is configured to use the `DSProvider` so that components can render
85
- appropriately. Unfortunately, this only works within the `Story` component.
86
- When rendering components in documentation examples within a `Canvas` component,
87
- wrap the elements in the `DSProvider` component.
88
-
89
- ```tsx
90
- // These buttons are not a part of a "story" but still appear only
91
- // in the documentation.
92
- <Canvas>
93
- <DSProvider>
94
- <ButtonGroup>
95
- <Button id="enabled" isDisabled={false}>
96
- Enabled
97
- </Button>
98
- <Button id="disabled" isDisabled>
99
- Disabled
100
- </Button>
101
- </ButtonGroup>
102
- </DSProvider>
103
- </Canvas>
104
- ```
105
-
106
- ## Components
107
-
108
- Although Chakra is integrated into the DS repo, we are still working to compose
109
- DS components with Chakra components or patterns. For example, both the DS and
110
- Chakra have a `Button` component so we will use Chakra's `Button` component to
111
- compose the DS `Button` component. However, the DS has a `Hero` component that
112
- is not already built by Chakra. In this case, the DS `Hero` component will
113
- internally use `Chakra` components such as `Box`.
114
-
115
- ### Components Composed with Chakra
116
-
117
- While we can directly use Chakra components that align with DS components, we
118
- want to compose DS components using the Chakra component as a base instead. This
119
- pattern allows the Design System to have control over props and standard styles.
120
-
121
- These components composed from Chakra, therefore, do not have all styled props
122
- available. For example, whereas `m` (`margin`), `mr` (`marginright`), and similar
123
- props can be used in Chakra components, those props are not available for DS
124
- components that internally are composed with Chakra components.
125
-
126
- Components built from Chakra rename the component with the `Chakra` name prefix.
127
-
128
- ```tsx
129
- import { Tabs as ChakraTabs, useStyleConfig } from "@chakra-ui/react";
130
- ```
131
-
132
- In this example, the `ChakraTabs` component is returned with NYPL specific
133
- functionality, styles, and other requirements.
134
-
135
- ```tsx
136
- function Tabs(props) {
137
- // ...
138
- const styles = useStyleConfig("Tabs", { variant: props.tabsType });
139
-
140
- return (
141
- <ChakraTabs
142
- id={id}
143
- __css={styles}
144
- // ... other props
145
- >
146
- {children}
147
- </ChakraTabs>
148
- }
149
- ```
150
-
151
- #### Patterns
152
-
153
- We are writing CSS style object rules into Javascript objects that work with
154
- Chakra's theme. Instead of creating a variant for a component with a class name,
155
- now different props or internal logic are used to get the appropriate variant.
156
- Internally, the right variant will be mapped to a Chakra theme variant that will
157
- provide all the necessary styles.
158
-
159
- For the `Button` component, for example, we would convert a SCSS class rule such
160
- as `.button-outline` to a Javascript object (more on this in the [Anatomy of a
161
- Component Styling Object](#anatomy-of-a-component-styling-object) section).
162
-
163
- ### Components re-exported from Chakra
164
-
165
- Some components are directly exported from Chakra. These components can be found
166
- in the `/src/index.ts` file. Note that not _all_ Chakra components are re-exported
167
- because we want to limit what developers should use in consuming applications.
168
- They include:
169
-
170
- - `Box`, `Center`, `Circle`, `Grid`, `GridItem`, `HStack`, `Square`, `Stack`, `VStack`
171
-
172
- Note: These components are harder to have snapshot tests for because, internally,
173
- these components autogenerate ids and class names on every new render. We can't
174
- override them so snapshot tests will fail.
175
-
176
- Update: Newer Chakra UI versions have mostly fixed this issue. Still, since
177
- Chakra components have already been tested, we don't necessarily want or need
178
- to test them ourselves.
179
-
180
- ## Styling
181
-
182
- The NYPL DS' theme file can be found at `src/theme/index.ts`. This creates a new
183
- theme that extends Chakra's theme and is set in the `DSProvider` component. Note
184
- that the example below is the general structure of the `theme` object but the DS
185
- `theme` object has values already set so it may look different. You would generally
186
- only work and add new object values in the `components` obejct key for new
187
- components and their theme or variants.
188
-
189
- _Note_: There are some SCSS files used to style third party plugins and to
190
- generate SCSS mixins.
191
-
192
- ```ts
193
- const theme = extendTheme({
194
- styles: { ... },
195
- breakpoints: { ... },
196
- colors: { ... },
197
- typography: { ... },
198
- space: { ... },
199
- components: {
200
- Button,
201
- // ...
202
- },
203
- });
204
- ```
205
-
206
- ### Anatomy of a Component Styling Object
207
-
208
- For in-depth information, read Chakra's [Component Style documentation](https://chakra-ui.com/docs/theming/component-style).
209
-
210
- Component theme files can be found in the `src/theme/components/` directory.
211
- Here is an example using the `Button` component.
212
-
213
- ```ts
214
- // The basic structure for all component style objects.
215
- const Button = {
216
- baseStyle: {},
217
- sizes: {},
218
- variants: {},
219
- defaultProps: {},
220
- };
221
- ```
222
-
223
- A current variant class rule can be converted to a Javascript object and go in
224
- the `variants` object as in the following example.
225
-
226
- ```scss
227
- // Button.scss
228
- // This is the "Secondary" variant.
229
- .button--outline {
230
- @include button-base;
231
-
232
- background-color: var(--nypl-colors-ui-white);
233
- border: 1px solid var(--nypl-colors-ui-gray-light-cool);
234
- color: inherit;
235
-
236
- &:hover {
237
- background-color: var(--nypl-colors-ui-gray-xx-light-cool);
238
- }
239
- }
240
- ```
241
-
242
- ```ts
243
- // button.ts
244
- const Button = {
245
- baseStyle: { ... },
246
- sizes: { ... },
247
- variants: {
248
- secondary: {
249
- bg: "ui.white",
250
- border: "1px solid",
251
- borderColor: "ui.gray.light-cool",
252
- color: "inherit",
253
- _hover: {
254
- bg: "ui.gray.xx-light-cool",
255
- },
256
- },
257
- // ... other variants,
258
- },
259
- defaultProps: { ... },
260
- };
261
- ```
262
-
263
- Now this variant can be rendered:
264
-
265
- ```tsx
266
- <Button buttonType="secondary" id="secondary">
267
- Press me
268
- </Button>
269
- ```
270
-
271
- ### Breakpoints
272
-
273
- There are currently five (5) breakpoint values used in the DS:
274
-
275
- | Key Name | EM/PX value |
276
- | -------- | ----------- |
277
- | sm | 20em/320px |
278
- | md | 38em/600px |
279
- | lg | 60em/960px |
280
- | xl | 80em/1280px |
281
- | 2xl | 96em/1536px |
282
-
283
- There are two ways to set breakpoint values for a style rule: the array method
284
- and the object method. We prefer the object method and recommend to use the
285
- object method since it is easier to read and readily know what values take
286
- effect at defined breakpoint values. Note that the Chakra `"base"` key value is
287
- the same as `"sm"`.
288
-
289
- #### Object Method
290
-
291
- We recommend and follow this pattern in the DS. As an example, let's say we want
292
- to increase the width of the `Button` component as the device width increases.
293
- We start at value "100px" and increase by "50px" at every breakpoint. In the
294
- `button.ts` style file, we can define it as in the example below:
295
-
296
- ```ts
297
- // button.ts
298
- const Button = {
299
- baseStyle: {
300
- width: {
301
- base: "100px",
302
- md: "150px",
303
- lg: "200px",
304
- xl: "250px",
305
- "2xl": "300px",
306
- },
307
- },
308
- // ...
309
- };
310
- ```
311
-
312
- You do not have to define every breakpoint. If you only want to change the width
313
- of the `Button` at the `lg` breakpoint, it can be defined as:
314
-
315
- ```ts
316
- // button.ts
317
- const Button = {
318
- baseStyle: {
319
- width: {
320
- base: "100px",
321
- lg: "200px",
322
- },
323
- },
324
- // ...
325
- };
326
- ```
327
-
328
- #### Array Method
329
-
330
- We do not recommend this pattern because it is harder to read and implicit on
331
- breakpoint values. Following the same example as the one above, the width of the
332
- `Button` component can be updated wiht all five values in an array:
333
-
334
- ```ts
335
- // button.ts
336
- const Button = {
337
- baseStyle: {
338
- width: ["100px", "150px", "200px", "250px", "300px"],
339
- },
340
- // ...
341
- };
342
- ```
343
-
344
- ### Colors
345
-
346
- All available colors can be found in `src/theme/foundations/colors.ts`. Chakra
347
- autogenerates the `colors` object into CSS variables. We will rely on these
348
- variables rather than creating our own.
349
-
350
- ```tsx
351
- const colors: Colors = {
352
- // ui fills
353
- ui: {
354
- /// State and link utilities
355
- focus: "#4181F1",
356
- link: {
357
- primary: "#0576D3",
358
- secondary: "#004B98",
359
- },
360
- // ...
361
- },
362
- section: {
363
- /** What's On is used for Exhibitions & Events. */
364
- "whats-on": {
365
- primary: "#242424",
366
- secondary: "#000000",
367
- },
368
- },
369
- // ...
370
- };
371
- ```
372
-
373
- In the shorten object example above, the following will be generated by Chakra:
374
-
375
- | Theme object value | CSS variable |
376
- | -------------------------------------- | ------------------------------------------ |
377
- | `colors.ui.focus` | `--nypl-colors-ui-focus` |
378
- | `colors.ui.link.primary` | `--nypl-colors-ui-link-primary` |
379
- | `colors.ui.link.secondary` | `--nypl-colors-ui-link-secondary` |
380
- | `colors.section["whats-on"].primary` | `--nypl-colors-section-whats-on-primary` |
381
- | `colors.section["whats-on"].secondary` | `--nypl-colors-section-whats-on-secondary` |
382
-
383
- Note: while each Chakra color has number range values from 50 to 900 (such as
384
- `red.400`, `blue.600`, etc) and each one is based on the color coming from
385
- DS' Figma documentation, we recommend NOT to use them.
386
-
387
- ### Spacing
388
-
389
- All the spacing values can be found in the `src/theme/foundations/spacing.ts`
390
- file. While Chakra provides many values, only use the eight DS defined values.
391
-
392
- | NYPL name Value | Chakra Value | DS Variable |
393
- | --------------- | ------------ | ----------------- |
394
- | xxs | 1 | --nypl-space-xxs |
395
- | xs | 2 | --nypl-space-xs |
396
- | s | 4 | --nypl-space-s |
397
- | m | 6 | --nypl-space-m |
398
- | l | 8 | --nypl-space-l |
399
- | xl | 12 | --nypl-space-xl |
400
- | xxl | 16 | --nypl-space-xxl |
401
- | xxxl | 24 | --nypl-space-xxxl |
402
-
403
- For example, to make all `button`s have a `padding: 8px 16px` value:
404
-
405
- ```jsx
406
- // src/theme/components/button.ts
407
- const Button = {
408
- baseStyle: {
409
- py: "xs", // var(--nypl-space-xs) which results in a value of 8px or 0.5rem.
410
- px: "s", // var(--nypl-space-s) which results in a value of 16px or 1rem.
411
- // ... other styles
412
- },
413
- sizes: { ... },
414
- variants: { ... },
415
- defaultProps: { ... },
416
- };
417
- ```
418
-
419
- ### Typography
420
-
421
- All typography values can be found in the `src/theme/foundations/typography.ts`
422
- file. These values declare the font family, font sizes, and font weights to use
423
- for all text.
424
-
425
- ## Style Props
426
-
427
- NYPL Reservoir components are built around the Chakra UI library. While Reservoir
428
- components may use the corresponding Chakra UI component, that is not always the
429
- case. Every Reservoir component, however, does make use of the Chakra UI
430
- "style props" pattern. This means that it is possible to pass in CSS rules to a
431
- component, including the shorthand versions. These style props will target the
432
- wrapper element of the component; this means if you want to target a specific
433
- element or component in a Reservoir component, you won't be able to with style
434
- props.
435
-
436
- <DSProvider>
437
- <Text isBold>
438
- While this is available to use, it is not recommended. If you see a need to
439
- override styles, please reach out to the NYPL Reservoir team for assistance.
440
- </Text>
441
- </DSProvider>
442
-
443
- In the following example, the `Button` component has been passed `p` and `maxW`
444
- props which are shorthand for "padding" and "max-width", respectively.
445
-
446
- ```jsx
447
- <Button id="styled-button" p="s" maxH="none" maxW="200px">
448
- Button
449
- </Button>
450
- ```
451
-
452
- <DSProvider>
453
- <Button id="styled-button" p="s" maxH="none" maxW="200px">
454
- Button
455
- </Button>
456
- </DSProvider>
457
-
458
- Find more information and a full list of all the available props, check the Chakra
459
- UI [Style Props page](https://chakra-ui.com/docs/styled-system/features/style-props).
460
-
461
- ## Hooks
462
-
463
- The following hooks are available to use and can be imported from
464
- `@nypl/design-system-react-components`.
465
-
466
- ### useNYPLTheme
467
-
468
- If your application does not use CSS or SCSS files and you want to write
469
- CSS-in-JS styles in your React components, the `useNYPLTheme` hook will provide
470
- you with NYPL-specific style values. This hook depends on the `DSProvider`
471
- component and if the function is used outside of this wrapper component, then
472
- the theme object will be empty.
473
-
474
- After importing and rendering the `DSProvider` wrapper component, as explained
475
- in the [DSProvider](#dsprovider) section, your children components can use this
476
- hook function.
477
-
478
- ```tsx
479
- import { useNYPLTheme } from "@nypl/design-system-react-components";
480
- // ...
481
-
482
- const theme = useNYPLTheme();
483
- ```
484
-
485
- The `theme` variable will be a JS object with style values discussed in the
486
- sections above. This will allow you to use NYPL-specific styles in your
487
- components through CSS-in-JS.
488
-
489
- ```ts
490
- // theme:
491
- {
492
- breakpoints: { ... },
493
- colors: {
494
- brand: { ... },
495
- section: { ... },
496
- transparent: { ... },
497
- ui: { ... },
498
- },
499
- fontSizes: { ... },
500
- fontWeights: { ... },
501
- fonts: { ... },
502
- radii: { ... },
503
- space: { ... },
504
- }
505
- ```
506
-
507
- #### Usage
508
-
509
- _Note: more patterns will be added._
510
-
511
- 1. NYPL DS Components
512
-
513
- All DS components _should_ be used with their current styles. If a DS component
514
- needs an updated style, first contact the Design System and UX teams about this
515
- update. If you really _need_ to update a style and there is no available
516
- variant, then you can add styles directly as style prop.
517
-
518
- For example, if the `Heading` component should render the text in NYPL's green
519
- color used for "success primary" and add a bold font weight, then you can do
520
- the following:
521
-
522
- ```tsx
523
- const theme = useNYPLTheme();
524
-
525
- // ...
526
- return (
527
- <div>
528
- <Heading
529
- level={2}
530
- color={theme.colors.ui.success.primary}
531
- fontWeight={theme.fontWeights.bold}
532
- >
533
- Get a Digital Library Card Today in a Few Easy Steps
534
- </Heading>
535
-
536
- {/* Other components */}
537
- </div>
538
- );
539
- ```
540
-
541
- Of course, you can destructure the `theme` object to only get the object keys
542
- you need for your component (this is a general example). Log the object to the
543
- console to see all the available styles.
544
-
545
- 2. HTML Components
546
-
547
- Use the `style` attribute in HTML components to add inline styles.
548
-
549
- ```tsx
550
- <p style={{ color: theme.colors.ui.success.primary }}>
551
- If you are 13 or older and live, work, attend school, or pay property taxes in
552
- New York State, you can get a free digital library card right now using this
553
- online form. Visitors to New York State can also use this form to apply for a
554
- temporary card.
555
- </p>
556
- ```
557
-
558
- ## Testing
559
-
560
- Do not re-test Chakra components that are re-exported since they are already
561
- tested in the `@chakra-ui/react` package. We expect all new components composed
562
- with Chakra components to have tests for functionality and styling, including
563
- snapshot tests.
@@ -1,148 +0,0 @@
1
- import { Meta } from "@storybook/addon-docs";
2
-
3
- import { Box, Center, Circle, VStack, Square } from "@chakra-ui/react";
4
- import Card, { CardHeading, CardContent } from "../components/Card/Card";
5
- import Heading from "../components/Heading/Heading";
6
- import Icon from "../components/Icons/Icon";
7
- import Image from "../components/Image/Image";
8
- import Link from "../components/Link/Link";
9
- import Logo from "../components/Logo/Logo";
10
- import SimpleGrid from "../components/Grid/SimpleGrid";
11
- import Text from "../components/Text/Text";
12
- import DSProvider from "../theme/provider";
13
-
14
- <Meta title="Welcome" />
15
-
16
- <DSProvider>
17
- <VStack spacing="s">
18
- <Center>
19
- <Logo name="reservoirVerticalColor" size="small" />
20
- </Center>
21
- <Box>
22
- <Center>
23
- <Heading level="one" size="tertiary">
24
- The React Component Library of the New York Public Library
25
- </Heading>
26
- </Center>
27
- <Text>
28
- Reservoir is NYPL's open-source extensible React component library for
29
- products and experiences, with accessibility as its core. Aiming to
30
- provide design and user experience consistency, Reservoir is the
31
- foundation for all digital properties in the NYPL landscape, offering
32
- functional components that implement the NYPL style standards.
33
- </Text>
34
- </Box>
35
- <SimpleGrid>
36
- <Box
37
- style={{
38
- alignItems: "center",
39
- border: "1px solid #ccc",
40
- display: "flex",
41
- flexDirection: "column",
42
- padding: "24px",
43
- }}
44
- >
45
- <Icon
46
- name="actionCheckCircle"
47
- size="xxlarge"
48
- color="section.education.secondary"
49
- marginBottom="s"
50
- />
51
- <Card isCentered>
52
- <CardHeading id="main-heading1" level="three">
53
- Get Started
54
- </CardHeading>
55
- <CardContent>
56
- <Text size="caption">
57
- To start using Reservoir Design System, refer to Reservoir's
58
- Github{" "}
59
- <Link
60
- href="https://github.com/NYPL/nypl-design-system/wiki"
61
- type="external"
62
- >
63
- Wiki
64
- </Link>{" "}
65
- and{" "}
66
- <Link
67
- href="https://github.com/NYPL/nypl-design-system/blob/development/README.md"
68
- type="external"
69
- >
70
- ReadMe
71
- </Link>{" "}
72
- to setup your project. You can also learn about our component
73
- architecture and additional documentation.
74
- </Text>
75
- </CardContent>
76
- </Card>
77
- </Box>
78
- <Box
79
- style={{
80
- alignItems: "center",
81
- border: "1px solid #ccc",
82
- display: "flex",
83
- flexDirection: "column",
84
- padding: "24px",
85
- }}
86
- >
87
- <Icon
88
- name="search"
89
- size="xxlarge"
90
- color="section.education.secondary"
91
- marginBottom="s"
92
- />
93
- <Card isCentered>
94
- <CardHeading id="main-heading1" level="three">
95
- Find Components
96
- </CardHeading>
97
- <CardContent>
98
- <Text size="caption">
99
- For your convenience, the Reservoir Design System components have
100
- been organized into logical categories based on both form and
101
- function. Please refer to the <b>COMPONENTS</b> section in the
102
- Storybook sidebar.
103
- </Text>
104
- </CardContent>
105
- </Card>
106
- </Box>
107
- <Box
108
- style={{
109
- alignItems: "center",
110
- border: "1px solid #ccc",
111
- display: "flex",
112
- flexDirection: "column",
113
- padding: "24px",
114
- }}
115
- >
116
- <Icon
117
- name="fileTypeSpreadsheet"
118
- size="xxlarge"
119
- color="section.education.secondary"
120
- marginBottom="s"
121
- />
122
- <Card isCentered>
123
- <CardHeading id="main-heading1" level="three">
124
- View the Code
125
- </CardHeading>
126
- <CardContent>
127
- <Text size="caption">
128
- The Reservoir Design System React component library is currently
129
- published on{" "}
130
- <Link
131
- href="https://www.npmjs.com/package/@nypl/design-system-react-components"
132
- type="external"
133
- >
134
- npm
135
- </Link>
136
- . If you're looking to contribute to this project, checkout the <Link
137
- href="https://github.com/NYPL/nypl-design-system"
138
- type="external"
139
- >
140
- nypl-design-system
141
- </Link> repo on Github for more information.
142
- </Text>
143
- </CardContent>
144
- </Card>
145
- </Box>
146
- </SimpleGrid>
147
- </VStack>
148
- </DSProvider>
@@ -1 +0,0 @@
1
- export type LayoutTypes = "column" | "row";