@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
@@ -237,7 +237,7 @@ help reduce any visual mistakes.
237
237
 
238
238
  <Canvas>
239
239
  <DSProvider>
240
- <div style={{ display: "flex", "flex-direction": "column" }}>
240
+ <div style={{ display: "flex", flexDirection: "column" }}>
241
241
  <div style={{ width: "300px" }}>
242
242
  A regular button:
243
243
  <Button buttonType={ButtonTypes.Primary} id="button-ex4" type="submit">
@@ -28,20 +28,34 @@ import { getCategory } from "../../utils/componentCategories";
28
28
 
29
29
  The DS adheres to four global breakpoints for responsive layouts and typography.
30
30
 
31
- - Desktop: 1280px
32
- - Tablet Landscape: 960px
33
- - Tablet Portrait: 600px
34
31
  - Mobile: 320px
32
+ - Tablet Portrait: 600px
33
+ - Tablet Landscape: 960px
34
+ - Desktop: 1280px
35
35
 
36
36
  ## CSS Variables
37
37
 
38
38
  The following CSS variables are available through the DS.
39
39
 
40
+ ```scss
41
+ --nypl-breakpoint-small: 320px;
42
+ --nypl-breakpoint-medium: 600px;
43
+ --nypl-breakpoint-large: 960px;
44
+ --nypl-breakpoint-xl: 1280px;
40
45
  ```
41
- --breakpoint-xl: 1280px;
42
- --breakpoint-large: 960px;
43
- --breakpoint-medium: 600px;
44
- --breakpoint-small: 320px;
46
+
47
+ ## SCSS Variables
48
+
49
+ If you are using SCSS and imported the NYPL Design System `/dist/resources.scss`
50
+ file, then you can use the following SCSS variables in your media queries or
51
+ SCSS `breakpoint` function (if used).
52
+
53
+ ```scss
54
+ $nypl-breakpoint-small: 320px;
55
+ $nypl-breakpoint-medium: 600px;
56
+ $nypl-breakpoint-large: 960px;
57
+ $nypl-breakpoint-xl: 1280px;
58
+ $nypl-max-width: $nypl-breakpoint-xl;
45
59
  ```
46
60
 
47
61
  ## Figma Reference
@@ -6,18 +6,19 @@ import {
6
6
  Description,
7
7
  } from "@storybook/addon-docs/blocks";
8
8
  import { withDesign } from "storybook-addon-designs";
9
+ import { ButtonGroup } from "@chakra-ui/react";
9
10
 
10
- import { getCategory } from "../../utils/componentCategories";
11
- import Button, { ButtonGroup } from "../Button/Button";
11
+ import Button from "../Button/Button";
12
12
  import { ButtonTypes } from "../Button/ButtonTypes";
13
13
  import Icon from "../Icons/Icon";
14
14
  import {
15
+ IconAlign,
15
16
  IconNames,
16
17
  IconRotationTypes,
17
18
  IconSizes,
18
- IconAlign,
19
19
  } from "../Icons/IconTypes";
20
20
  import getCSSVariable from "../../helpers/getCSSVariable";
21
+ import { getCategory } from "../../utils/componentCategories";
21
22
  import DSProvider from "../../theme/provider";
22
23
 
23
24
  <Meta
@@ -26,8 +27,7 @@ import DSProvider from "../../theme/provider";
26
27
  parameters={{
27
28
  design: {
28
29
  type: "figma",
29
- url:
30
- "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=11477%3A2298",
30
+ url: "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=11477%3A2298",
31
31
  },
32
32
  }}
33
33
  />
@@ -45,7 +45,8 @@ import DSProvider from "../../theme/provider";
45
45
 
46
46
  ## General Information
47
47
 
48
- Use the NYPL Design System [Button](https://nypl.github.io/nypl-design-system/storybook-static/?path=/docs/form-elements-button--basic) component to render form buttons.
48
+ Use the NYPL Design System [Button](https://nypl.github.io/nypl-design-system/storybook-static/?path=/docs/form-elements-button--basic)
49
+ component to render form buttons.
49
50
 
50
51
  ```jsx
51
52
  import { Button, ButtonTypes } from "@nypl/design-system-react-components";
@@ -59,15 +60,23 @@ import { Button, ButtonTypes } from "@nypl/design-system-react-components";
59
60
  - Button text should be title case.
60
61
  - Button icon is optional.
61
62
  - Buttons may have an icon on either the left or the right.
62
- - Buttons by default are blue. However, Donation buttons are red.
63
- - Buttons used for Back to Top actions have a Secondary button style with an arrow icon pointing up.
64
- - When buttons are used in a set (where the user can move forward or backward), the `Primary` button is on the right and the `Secondary` button on the left (i.e. cancel = secondary, submit = primary).
63
+ - Buttons by default are blue. However, Donation callout buttons are red.
64
+ - Buttons used for Back to Top actions have a Secondary button style with an
65
+ arrow icon pointing up.
66
+ - When buttons are used in a group, they should be wrapped in a `ButtonGroup`.
67
+ - When buttons are used in a group where the user can move forward or backward,
68
+ the `Primary` button is on the right and the `Secondary` button on the left
69
+ (i.e. cancel = secondary, submit = primary).
65
70
 
66
71
  ## Button Groups
67
72
 
68
- When `Button` components are displayed in a group, use the `ButtonGroup` component to handle the spacing and layout. The `ButtonGroup` component will use `--nypl-space-xs` (0.5rem) for spacing in horizontal group layouts.
73
+ When `Button` components are displayed in a group, use the `ButtonGroup`
74
+ component to handle the spacing and layout. The `ButtonGroup` component will use
75
+ `--nypl-space-xs` (0.5rem) for spacing in horizontal group layouts.
69
76
 
70
- Standalone `Button` components and the `ButtonGroup` component should use `--nypl-space-l` (2rem) for spacing between all other UI elements. This spacing can be achieved by using the `Form` component.
77
+ Standalone `Button` components and the `ButtonGroup` component should use
78
+ `--nypl-space-l` (2rem) for spacing between all other UI elements. This spacing
79
+ can be achieved by using the `Form` component to wrap the `Button`s.
71
80
 
72
81
  <Canvas>
73
82
  <DSProvider>
@@ -84,7 +93,7 @@ Standalone `Button` components and the `ButtonGroup` component should use `--nyp
84
93
  <Button buttonType={ButtonTypes.Primary}>
85
94
  <Icon name={IconNames.Close} size={IconSizes.Medium} />
86
95
  </Button>
87
- <Button buttonType={ButtonTypes.Callout}>Button Text</Button>
96
+ <Button buttonType={ButtonTypes.Callout}>Donate</Button>
88
97
  <Button buttonType={ButtonTypes.Secondary}>
89
98
  Back to Top
90
99
  <Icon
@@ -100,15 +109,20 @@ Standalone `Button` components and the `ButtonGroup` component should use `--nyp
100
109
 
101
110
  ## Button Types
102
111
 
103
- The `buttonType` prop should be used to render various forms of the button component.
112
+ The `buttonType` prop should be used to render various forms of the button
113
+ component. Note that the `SearchBar` type is only used internally in the
114
+ `SearchBar` component.
104
115
 
105
116
  <Canvas>
106
117
  <DSProvider>
107
118
  <ButtonGroup>
108
119
  <Button buttonType={ButtonTypes.Primary}>Primary Button</Button>
109
120
  <Button buttonType={ButtonTypes.Secondary}>Secondary Button</Button>
121
+ <Button buttonType={ButtonTypes.Callout}>Callout Button</Button>
110
122
  <Button buttonType={ButtonTypes.Pill}>Pill Button</Button>
111
123
  <Button buttonType={ButtonTypes.Link}>Link Button</Button>
124
+ <Button buttonType={ButtonTypes.SearchBar}>SearchBar Button</Button>
125
+ <Button buttonType={ButtonTypes.NoBrand}>NoBrand Button</Button>
112
126
  </ButtonGroup>
113
127
  </DSProvider>
114
128
  </Canvas>
@@ -124,6 +138,11 @@ The `buttonType` prop should be used to render various forms of the button compo
124
138
  - often paired with a Primary button
125
139
  - Visual Treatment: rectangular, outlined
126
140
 
141
+ ### ButtonTypes.Callout
142
+
143
+ - used for call to actions such as donation buttons
144
+ - Visual Treatment: rectangular, NYPL red background
145
+
127
146
  ### ButtonTypes.Pill
128
147
 
129
148
  - used for equally weighted actions
@@ -135,11 +154,28 @@ The `buttonType` prop should be used to render various forms of the button compo
135
154
  - used for equally weighted actions
136
155
  - Visual Treatment: text link with underline
137
156
 
157
+ ### ButtonTypes.SearchBar
158
+
159
+ - used internally in the `SearchBar` component for visual flow when it is next
160
+ to the `TextInput` component
161
+ - Visual Treatment: rectangular, filled, no border radius on the left side
162
+
163
+ ### ButtonTypes.NoBrand
164
+
165
+ - used in cases where there is no brand color
166
+ - Visual Treatment: rectangular, filled with a black background
167
+
138
168
  ## Patterns
139
169
 
140
170
  - Buttons are blue by default.
141
- - Buttons that are intended as a call out (i.e. Donation buttons) shoud be set as `ButtonTypes.Callout`.
142
- - The "Back to Top" button must be set as `ButtonTypes.Secondary` and must include an up arrow icon.
171
+ - Buttons that are intended as a call out (i.e. Donation buttons) should be set
172
+ as `ButtonTypes.Callout`.
173
+ - The "Back to Top" button must be set as `ButtonTypes.Secondary` and must
174
+ include an up arrow icon.
175
+ - Previous and Next buttons should be set as `ButtonTypes.Secondary` and be
176
+ wrapped in a `ButtonGroup`.
177
+ - Only use the `ButtonTypes.NoBrand` style where there is no brand color. _This
178
+ should be rarely used._
143
179
 
144
180
  <Canvas>
145
181
  <DSProvider>
@@ -154,6 +190,24 @@ The `buttonType` prop should be used to render various forms of the button compo
154
190
  align={IconAlign.Right}
155
191
  />
156
192
  </Button>
193
+ <Button buttonType={ButtonTypes.Secondary}>
194
+ <Icon
195
+ name={IconNames.Arrow}
196
+ iconRotation={IconRotationTypes.Rotate90}
197
+ align={IconAlign.Left}
198
+ size={IconSizes.Small}
199
+ />
200
+ Previous
201
+ </Button>
202
+ <Button buttonType={ButtonTypes.Secondary}>
203
+ Next
204
+ <Icon
205
+ name={IconNames.Arrow}
206
+ iconRotation={IconRotationTypes.Rotate270}
207
+ align={IconAlign.Right}
208
+ size={IconSizes.Small}
209
+ />
210
+ </Button>
157
211
  </ButtonGroup>
158
212
  </DSProvider>
159
213
  </Canvas>
@@ -28,7 +28,6 @@ export default function ColorCard(
28
28
  backgroundColor={backgroundColor}
29
29
  center
30
30
  layout={CardLayouts.Column}
31
- padding="3rem"
32
31
  border
33
32
  />
34
33
  <div style={{ marginLeft: "1rem" }}>
@@ -0,0 +1,170 @@
1
+ import {
2
+ Meta,
3
+ Story,
4
+ Canvas,
5
+ ArgsTable,
6
+ Description,
7
+ } from "@storybook/addon-docs/blocks";
8
+ import { withDesign } from "storybook-addon-designs";
9
+ import { getCategory } from "../../utils/componentCategories";
10
+
11
+ <Meta title={getCategory("Design Tokens")} />
12
+
13
+ # Design Tokens
14
+
15
+ | Table of Contents |
16
+ | ------------------------------------------------------------------------------------ |
17
+ | 1. [What are Design Tokens?](#what-are-design-tokens) |
18
+ | 2. [Why Use Design Tokens?](#why-use-design-tokens) |
19
+ | 3. [How to Use the NYPL Design Tokens](#figma-reference) |
20
+ | 4. [Using NYPL Design Tokens in CSS](#using-nypl-design-tokens-in-css) |
21
+ | 5. [Using NYPL Design Tokens in Javascript](#using-nypl-design-tokens-in-javascript) |
22
+ | 6. [NYPL Design Token Categories](#nypl-design-token-categories) |
23
+
24
+ ## What are Design Tokens?
25
+
26
+ Design tokens are the style values that define a design system. These values can include, but may not be limited to, spacing, color, typography, breakpoints and object styles. Ultimately, these values are used to construct and maintain the components that make up our system.
27
+
28
+ ## Why Use Design Tokens?
29
+
30
+ _"With design tokens, you can capture low-level values and then use them to create the styles for your product or app. You can maintain a scalable and consistent visual system for UI development."_ – Jina Bolton, Lead Designer for the Salesforce Design System
31
+
32
+ Design tokens are a single source of truth when it comes to styles. They allow an organization to more easily build multiple applications – web and/or native – that feel and look the same without slowing down the development team.
33
+
34
+ ## How to Use the NYPL Design Tokens
35
+
36
+ The NYPL design tokens are built into the NYPL Design System (the DS) and are offered in two formats for consumption: CSS variables and javascript data objects. To access either of these formats, the DS v0.25.2 or higher needs to be properly installed in a consuming React application.
37
+
38
+ ## Using NYPL Design Tokens in CSS
39
+
40
+ If your app uses CSS or SCSS to handle styles, the DS creates standard CSS custom properties (e.g. variables) for consumption in your stylesheets. If the DS is properly installed, the CSS custom properties will be available for you to use. Nothing more needs to be done to your app.
41
+
42
+ To assist with CSS scope isolation, all of the CSS custom properties created by the DS are prefixed with "nypl." Please see the examples below.
43
+
44
+ ```css
45
+ --nypl-colors-brand-primary
46
+ --nypl-colors-brand-secondary
47
+ --nypl-fontSizes-sm
48
+ --nypl-fontSizes-md
49
+ --nypl-fontSizes-lg
50
+ --nypl-fontSizes-xl
51
+ --nypl-space-xxs
52
+ --nypl-space-xs
53
+ --nypl-space-s
54
+ --nypl-space-m
55
+ --nypl-space-l
56
+ ```
57
+
58
+ The CSS custom properties are defined on the :root pseudo-class and should be implemented using standard CSS custom properties conventions.
59
+
60
+ ```css
61
+ /* Property Declaration in the DS */
62
+ :root {
63
+ --nypl-colors-brand-primary: #c60917;
64
+ }
65
+
66
+ /* Property Usage in Your Application */
67
+ .custom-button {
68
+ background: var(--nypl-colors-brand-primary);
69
+ }
70
+ ```
71
+
72
+ ## Using NYPL Design Tokens in Javascript
73
+
74
+ If you would like to use CSS-in-JS styles in your React components, the `useNYPLTheme` hook will provide you with NYPL design token values. The hook depends on the `DSProvider` component and will not work properly outside of the `DSProvider` wrapper component.
75
+
76
+ After importing and implementing the `DSProvider` wrapper component, as explained in the `DSProvider` section of the [DS Chakra UI](?path=/story/chakra-ui--page#dsprovider) document, your children components can use this hook function.
77
+
78
+ ```tsx
79
+ import { useNYPLTheme } from "@nypl/design-system-react-components";
80
+ const theme = useNYPLTheme();
81
+ ```
82
+
83
+ The theme variable will be a javascript object containing the NYPL design token style values. This will allow you to use design token values in your components through CSS-in-JS.
84
+
85
+ ```tsx
86
+ // theme
87
+ {
88
+ breakpoints: { ... },
89
+ colors: {
90
+ brand: { ... },
91
+ section: { ... },
92
+ transparent: { ... },
93
+ ui: { ... },
94
+ },
95
+ fontSizes: { ... },
96
+ fontWeights: { ... },
97
+ fonts: { ... },
98
+ radii: { ... },
99
+ space: { ... },
100
+ }
101
+ ```
102
+
103
+ #### Using in DS Components
104
+
105
+ The general rule of thumb is that DS components and the available variants should be used with the styles and variants as they are shown in Storybook, but there may be rare times when a component does require a modification. That said, if a DS component does need an updated style, first contact the Design System and UX teams about this update.
106
+
107
+ If you receive approval to make a change in a consuming app, then you can add styles directly to the `additionalStyles` prop. For example, if the `Heading` component needs to render text in NYPL's "success primary" green color and add a bold font weight, then you can do the following:
108
+
109
+ ```tsx
110
+ const theme = useNYPLTheme();
111
+
112
+ // ...
113
+ return (
114
+ <div>
115
+ <Heading
116
+ level={2}
117
+ additionalStyles={{
118
+ color: theme.colors.ui.success.primary,
119
+ fontWeight: theme.fontWeights.bold,
120
+ }}
121
+ >
122
+ Get a Digital Library Card Today in a Few Easy Steps
123
+ </Heading>
124
+ </div>
125
+ );
126
+ ```
127
+
128
+ IMPORTANT: At the moment, not all DS components have this prop or feature.
129
+
130
+ #### Using in HTML Components
131
+
132
+ For styling standard HTML elements, use the `style` attribute to add inline styles.
133
+
134
+ ```html
135
+ <p style={{ color: theme.colors.ui.success.primary }}>
136
+ If you are 13 or older and live, work, attend school, or pay property
137
+ taxes in New York State, you can get a free digital library card right
138
+ now using this online form. Visitors to New York State can also use this
139
+ form to apply for a temporary card.
140
+ </p>
141
+ ```
142
+
143
+ #### Using in Styled Components
144
+
145
+ For adding theme styles to styled-objects, use the theme object as a standard javascript variable.
146
+
147
+ ```tsx
148
+ const CustomButton = styled.button`
149
+ background: ${theme.colors.brand.primary};
150
+ `;
151
+ ```
152
+
153
+ ## NYPL Design Token Categories
154
+
155
+ The DS design tokens are broken into the following categories:
156
+
157
+ - [breakpoints](?path=/story/documentation-style-guide-breakpoints--page)
158
+ - [colors](?path=/story/documentation-style-guide-colors--page)
159
+ - brand
160
+ - section
161
+ - transparent
162
+ - ui
163
+ - radii
164
+ - [spacing](?path=/story/documentation-style-guide-spacing--page)
165
+ - [typography](?path=/story/documentation-style-guide-typography--page)
166
+ - font families
167
+ - font sizes
168
+ - font weights
169
+
170
+ For details related to a specific category, please refer to the corresponding section in the Style Guide available in the DS Storybook.
@@ -6,6 +6,7 @@ import {
6
6
  Description,
7
7
  } from "@storybook/addon-docs/blocks";
8
8
  import { withDesign } from "storybook-addon-designs";
9
+ import { Stack } from "@chakra-ui/react";
9
10
 
10
11
  import { getCategory } from "../../utils/componentCategories";
11
12
  import Icon from "../Icons/Icon";
@@ -42,63 +43,53 @@ import DSProvider from "../../theme/provider";
42
43
 
43
44
  ## General Information
44
45
 
45
- Use the NYPL Design System [Icon](https://nypl.github.io/nypl-design-system/storybook-static/?path=/docs/icon--control-props) component to render and control icons and NYPL logos as `<svg>` elements within consuming apps.
46
+ Use the NYPL Design System [Icon](https://nypl.github.io/nypl-design-system/storybook-static/?path=/docs/icon--control-props)
47
+ component to render and control icons and NYPL logos as `<svg>` elements within
48
+ consuming apps.
46
49
 
47
50
  The DS utilizes the `Filled` icons available in the [Material UI Design System](https://material-ui.com/components/material-icons/).
48
51
 
49
52
  ## Icon Examples
50
53
 
51
- The graphic of the `Icon` component is handled through the `IconNames` and `LogoNames` enums. To see all graphic options for `Icon`, please refer to the [Icon](https://nypl.github.io/nypl-design-system/storybook-static/?path=/docs/icon--control-props) Storybook page.
54
+ The graphic of the `Icon` component is handled through the `IconNames` and
55
+ `LogoNames` enums. To see all graphic options for `Icon`, please refer to the
56
+ [Icon](https://nypl.github.io/nypl-design-system/storybook-static/?path=/docs/icon--control-props)
57
+ Storybook page.
52
58
 
53
59
  <Canvas>
54
60
  <DSProvider>
55
- <span style={{ marginRight: "1rem" }}>
61
+ <Stack spacing="s" direction="row">
56
62
  <Icon
57
63
  decorative
58
64
  size={IconSizes.ExtraExtraExtraLarge}
59
65
  name={IconNames.Check}
60
- style={{ marginRight: "1rem" }}
61
66
  />
62
- </span>
63
- <span style={{ marginRight: "1rem" }}>
64
67
  <Icon
65
68
  decorative
66
69
  size={IconSizes.ExtraExtraExtraLarge}
67
70
  name={IconNames.Close}
68
- style={{ marginRight: "1rem" }}
69
71
  />
70
- </span>
71
- <span style={{ marginRight: "1rem" }}>
72
72
  <Icon
73
73
  decorative
74
74
  size={IconSizes.ExtraExtraExtraLarge}
75
75
  name={IconNames.ErrorOutline}
76
- style={{ marginRight: "1rem" }}
77
76
  />
78
- </span>
79
- <span style={{ marginRight: "1rem" }}>
80
77
  <Icon
81
78
  decorative
82
79
  size={IconSizes.ExtraExtraExtraLarge}
83
80
  name={IconNames.SpeakerNotes}
84
- style={{ marginRight: "1rem" }}
85
81
  />
86
- </span>
87
- <span style={{ marginRight: "1rem" }}>
88
82
  <Icon
89
83
  decorative
90
84
  size={IconSizes.ExtraExtraExtraLarge}
91
85
  name={LogoNames.LogoNypl}
92
- style={{ marginRight: "1rem" }}
93
86
  />
94
- </span>
95
- <span style={{ marginRight: "1rem" }}>
96
87
  <Icon
97
88
  decorative
98
89
  size={IconSizes.ExtraExtraExtraLarge}
99
90
  name={LogoNames.LogoBrooklyn}
100
91
  />
101
- </span>
92
+ </Stack>
102
93
  </DSProvider>
103
94
  </Canvas>
104
95
 
@@ -117,26 +108,14 @@ The size of the `Icon` component is handled through the `IconSizes` enum.
117
108
 
118
109
  <Canvas>
119
110
  <DSProvider>
120
- <div style={{ display: "flex", alignItems: "center" }}>
121
- <span style={{ marginRight: "1rem" }}>
122
- <Icon size={IconSizes.Small} name={IconNames.Check} />
123
- </span>
124
- <span style={{ marginRight: "1rem" }}>
125
- <Icon size={IconSizes.Medium} name={IconNames.Check} />
126
- </span>
127
- <span style={{ marginRight: "1rem" }}>
128
- <Icon size={IconSizes.Large} name={IconNames.Check} />
129
- </span>
130
- <span style={{ marginRight: "1rem" }}>
131
- <Icon size={IconSizes.ExtraLarge} name={IconNames.Check} />
132
- </span>
133
- <span style={{ marginRight: "1rem" }}>
134
- <Icon size={IconSizes.ExtraExtraLarge} name={IconNames.Check} />
135
- </span>
136
- <span style={{ marginRight: "1rem" }}>
137
- <Icon size={IconSizes.ExtraExtraExtraLarge} name={IconNames.Check} />
138
- </span>
139
- </div>
111
+ <Stack spacing="s" direction="row" alignItems="center">
112
+ <Icon size={IconSizes.Small} name={IconNames.Check} />
113
+ <Icon size={IconSizes.Medium} name={IconNames.Check} />
114
+ <Icon size={IconSizes.Large} name={IconNames.Check} />
115
+ <Icon size={IconSizes.ExtraLarge} name={IconNames.Check} />
116
+ <Icon size={IconSizes.ExtraExtraLarge} name={IconNames.Check} />
117
+ <Icon size={IconSizes.ExtraExtraExtraLarge} name={IconNames.Check} />
118
+ </Stack>
140
119
  </DSProvider>
141
120
  </Canvas>
142
121
 
@@ -151,31 +130,34 @@ The size of the `Icon` component is handled through the `IconSizes` enum.
151
130
 
152
131
  ## Icon Colors
153
132
 
154
- The color of the `Icon` component is handled through the `IconColors` enum. Icons in NYPL projects should always be rendered with one color.
133
+ The color of the `Icon` component is handled through the `IconColors` enum.
134
+ Icons in NYPL projects should always be rendered with one color.
155
135
 
156
136
  <Canvas>
157
137
  <DSProvider>
158
- <Icon size={IconSizes.ExtraExtraExtraLarge} name={IconNames.Check} />
159
- <Icon
160
- name={IconNames.Check}
161
- size={IconSizes.ExtraExtraExtraLarge}
162
- color={IconColors.BrandPrimary}
163
- />
164
- <Icon
165
- name={IconNames.Check}
166
- size={IconSizes.ExtraExtraExtraLarge}
167
- color={IconColors.SectionResearchPrimary}
168
- />
169
- <Icon
170
- name={IconNames.Check}
171
- size={IconSizes.ExtraExtraExtraLarge}
172
- color={IconColors.SectionResearchLibrarySchwartzman}
173
- />
174
- <Icon
175
- name={IconNames.Check}
176
- size={IconSizes.ExtraExtraExtraLarge}
177
- color={IconColors.SectionResearchLibrarySchomburg}
178
- />
138
+ <Stack spacing="s" direction="row">
139
+ <Icon size={IconSizes.ExtraExtraExtraLarge} name={IconNames.Check} />
140
+ <Icon
141
+ name={IconNames.Check}
142
+ size={IconSizes.ExtraExtraExtraLarge}
143
+ color={IconColors.BrandPrimary}
144
+ />
145
+ <Icon
146
+ name={IconNames.Check}
147
+ size={IconSizes.ExtraExtraExtraLarge}
148
+ color={IconColors.SectionResearchPrimary}
149
+ />
150
+ <Icon
151
+ name={IconNames.Check}
152
+ size={IconSizes.ExtraExtraExtraLarge}
153
+ color={IconColors.SectionResearchLibrarySchwartzman}
154
+ />
155
+ <Icon
156
+ name={IconNames.Check}
157
+ size={IconSizes.ExtraExtraExtraLarge}
158
+ color={IconColors.SectionResearchLibrarySchomburg}
159
+ />
160
+ </Stack>
179
161
  </DSProvider>
180
162
  </Canvas>
181
163
 
@@ -196,7 +178,14 @@ The color of the `Icon` component is handled through the `IconColors` enum. Icon
196
178
 
197
179
  ## Development Notes
198
180
 
199
- Icons have been added to the Icon component as they have been needed within NYPL development project, so not all of the [NYPL icons](https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/?node-id=10734%3A3945) and [NYPL Brand](https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Main?node-id=15454%3A47007) and [NYPL UI](https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Main?node-id=14989%3A37) colors are currently available through the DS Icon component. If your project requires an icon or color that is not currently available in the Icon component, please inform your project manager or reach out directly to the NYPL Design System team.
181
+ Icons have been added to the Icon component as they have been needed within NYPL
182
+ development project, so not all of the [NYPL icons](https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/?node-id=10734%3A3945)
183
+ and [NYPL Brand](https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Main?node-id=15454%3A47007)
184
+ and [NYPL UI](https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Main?node-id=14989%3A37)
185
+ colors are currently available through the DS Icon component. If your project
186
+ requires an icon or color that is not currently available in the Icon component,
187
+ please inform your project manager or reach out directly to the NYPL Design
188
+ System team.
200
189
 
201
190
  ## Figma Reference
202
191
 
@@ -1,11 +1,11 @@
1
1
  import * as React from "react";
2
2
  import {
3
3
  Box,
4
- Tabs as ChakraTabs,
5
- TabList,
6
4
  Tab,
5
+ TabList,
7
6
  TabPanels,
8
7
  TabPanel,
8
+ Tabs as ChakraTabs,
9
9
  useMultiStyleConfig,
10
10
  } from "@chakra-ui/react";
11
11
 
@@ -63,7 +63,7 @@ const getElementsFromContentData = (data, useHash) => {
63
63
  "needed, consider other navigational patterns."
64
64
  );
65
65
  }
66
- data.map((tab, index) => {
66
+ data.forEach((tab, index) => {
67
67
  let tempPanel;
68
68
  // For URL hash enabled tabs, we need to add a custom `onClick` to handle the URL hash.
69
69
  const tempTab = (
@@ -108,7 +108,7 @@ const getElementsFromChildren = (children) => {
108
108
  return {};
109
109
  }
110
110
 
111
- children.map((child) => {
111
+ children.forEach((child) => {
112
112
  if (child.type === TabList || child.props.mdxType === "TabList") {
113
113
  tabs.push(child);
114
114
 
@@ -170,7 +170,7 @@ function Tabs(props: React.PropsWithChildren<TabsProps>) {
170
170
  if (windowDimensions.width > 600) {
171
171
  goToStart();
172
172
  }
173
- }, [windowDimensions.width]);
173
+ }, [goToStart, windowDimensions.width]);
174
174
  const previousButton = (
175
175
  <Button
176
176
  buttonType={ButtonTypes.Primary}