@nypl/design-system-react-components 0.23.4 → 0.25.1

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 (307) hide show
  1. package/CHANGELOG.md +98 -1
  2. package/README.md +46 -11
  3. package/dist/components/Accordion/Accordion.d.ts +14 -14
  4. package/dist/components/Autosuggest/Autosuggest.stories.d.ts +1 -0
  5. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +11 -14
  6. package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +6 -0
  7. package/dist/components/Button/Button.d.ts +6 -13
  8. package/dist/components/Button/ButtonTypes.d.ts +5 -3
  9. package/dist/components/Card/Card.d.ts +59 -10
  10. package/dist/components/Card/CardTypes.d.ts +19 -0
  11. package/dist/components/CardEdition/CardEdition.d.ts +21 -0
  12. package/dist/components/{StyleGuide/Colors.stories.d.ts → CardEdition/CardEdition.stories.d.ts} +5 -2
  13. package/dist/components/Checkbox/Checkbox.d.ts +21 -16
  14. package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +43 -0
  15. package/dist/components/CheckboxGroup/CheckboxGroupLayoutTypes.d.ts +4 -0
  16. package/dist/components/DatePicker/DatePicker.d.ts +79 -0
  17. package/dist/components/DatePicker/DatePickerTypes.d.ts +5 -0
  18. package/dist/components/Form/Form.d.ts +16 -8
  19. package/dist/components/Form/FormTypes.d.ts +2 -0
  20. package/dist/components/Grid/GridTypes.d.ts +9 -0
  21. package/dist/components/Grid/SimpleGrid.d.ts +14 -0
  22. package/dist/components/Heading/Heading.d.ts +9 -11
  23. package/dist/components/Heading/{HeadingDisplaySizes.d.ts → HeadingTypes.d.ts} +8 -0
  24. package/dist/components/HelperErrorText/HelperErrorText.stories.d.ts +2 -1
  25. package/dist/components/Hero/Hero.d.ts +19 -14
  26. package/dist/components/Hero/HeroTypes.d.ts +10 -5
  27. package/dist/components/Icons/Icon.d.ts +13 -16
  28. package/dist/components/Icons/IconSvgs.d.ts +4 -0
  29. package/dist/components/Icons/IconTypes.d.ts +78 -60
  30. package/dist/components/Image/Image.stories.d.ts +2 -1
  31. package/dist/components/Label/Label.d.ts +10 -26
  32. package/dist/components/Link/Link.d.ts +8 -12
  33. package/dist/components/List/List.stories.d.ts +1 -0
  34. package/dist/components/Radio/Radio.d.ts +30 -24
  35. package/dist/components/RadioGroup/RadioGroup.d.ts +40 -0
  36. package/dist/components/RadioGroup/RadioGroupLayoutTypes.d.ts +4 -0
  37. package/dist/components/SearchBar/SearchBar.d.ts +45 -27
  38. package/dist/components/Select/Select.d.ts +34 -35
  39. package/dist/components/Select/SelectTypes.d.ts +4 -0
  40. package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +1 -1
  41. package/dist/components/SkeletonLoader/SkeletonLoaderTypes.d.ts +2 -2
  42. package/dist/components/StatusBadge/StatusBadge.d.ts +8 -6
  43. package/dist/components/StatusBadge/StatusBadgeTypes.d.ts +5 -0
  44. package/dist/components/Tabs/Tabs.d.ts +25 -0
  45. package/dist/components/Template/Template.d.ts +91 -0
  46. package/dist/components/Text/Text.d.ts +16 -0
  47. package/dist/components/Text/TextTypes.d.ts +6 -0
  48. package/dist/components/TextInput/TextInput.d.ts +37 -30
  49. package/dist/components/TextInput/TextInputTypes.d.ts +5 -0
  50. package/dist/design-system-react-components.cjs.development.js +4102 -917
  51. package/dist/design-system-react-components.cjs.development.js.map +1 -1
  52. package/dist/design-system-react-components.cjs.production.min.js +1 -1
  53. package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
  54. package/dist/design-system-react-components.esm.js +4023 -920
  55. package/dist/design-system-react-components.esm.js.map +1 -1
  56. package/dist/index.d.ts +23 -5
  57. package/dist/resources.scss +133 -24
  58. package/dist/styles.css +1 -1
  59. package/dist/theme/components/accordion.d.ts +25 -0
  60. package/dist/theme/components/breadcrumb.d.ts +90 -0
  61. package/dist/theme/components/button.d.ts +109 -0
  62. package/dist/theme/components/checkbox.d.ts +91 -0
  63. package/dist/theme/components/customCheckboxGroup.d.ts +18 -0
  64. package/dist/theme/components/customRadioGroup.d.ts +18 -0
  65. package/dist/theme/components/global.d.ts +55 -0
  66. package/dist/theme/components/globalMixins.d.ts +15 -0
  67. package/dist/theme/components/heading.d.ts +110 -0
  68. package/dist/theme/components/hero.d.ts +492 -0
  69. package/dist/theme/components/icon.d.ts +13 -0
  70. package/dist/theme/components/label.d.ts +16 -0
  71. package/dist/theme/components/link.d.ts +45 -0
  72. package/dist/theme/components/radio.d.ts +95 -0
  73. package/dist/theme/components/searchBar.d.ts +20 -0
  74. package/dist/theme/components/select.d.ts +58 -0
  75. package/dist/theme/components/statusBadge.d.ts +25 -0
  76. package/dist/theme/components/tabs.d.ts +85 -0
  77. package/dist/theme/components/template.d.ts +105 -0
  78. package/dist/theme/components/text.d.ts +20 -0
  79. package/dist/theme/components/textInput.d.ts +105 -0
  80. package/dist/theme/foundations/breakpoints.d.ts +23 -0
  81. package/dist/theme/foundations/colors.d.ts +3 -0
  82. package/dist/theme/foundations/global.d.ts +23 -0
  83. package/dist/theme/foundations/shadows.d.ts +4 -0
  84. package/dist/theme/foundations/spacing.d.ts +77 -0
  85. package/dist/theme/foundations/typography.d.ts +8 -0
  86. package/dist/theme/index.d.ts +20 -0
  87. package/dist/theme/provider.d.ts +5 -0
  88. package/dist/theme/types.d.ts +1 -0
  89. package/dist/utils/utils.d.ts +6 -0
  90. package/package.json +9 -2
  91. package/src/components/Accordion/Accordion.stories.mdx +233 -33
  92. package/src/components/Accordion/Accordion.test.tsx +135 -19
  93. package/src/components/Accordion/Accordion.tsx +81 -56
  94. package/src/components/Autosuggest/Autosuggest.stories.mdx +4 -3
  95. package/src/components/Autosuggest/Autosuggest.stories.tsx +1 -1
  96. package/src/components/Autosuggest/_Autosuggest.scss +2 -2
  97. package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +57 -56
  98. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +31 -25
  99. package/src/components/Breadcrumbs/Breadcrumbs.tsx +71 -73
  100. package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +6 -0
  101. package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +100 -0
  102. package/src/components/Button/Button.stories.mdx +125 -138
  103. package/src/components/Button/Button.test.tsx +65 -11
  104. package/src/components/Button/Button.tsx +72 -68
  105. package/src/components/Button/ButtonTypes.tsx +4 -2
  106. package/src/components/Button/_Button.scss +7 -92
  107. package/src/components/Button/__snapshots__/Button.test.tsx.snap +58 -3
  108. package/src/components/Card/Card.stories.mdx +694 -0
  109. package/src/components/Card/Card.test.tsx +97 -102
  110. package/src/components/Card/Card.tsx +182 -31
  111. package/src/components/Card/CardTypes.tsx +21 -0
  112. package/src/components/Card/_Card.scss +234 -49
  113. package/src/components/{Card/Card.stories.tsx → CardEdition/CardEdition.stories.tsx} +32 -22
  114. package/src/components/CardEdition/CardEdition.test.tsx +395 -0
  115. package/src/components/CardEdition/CardEdition.tsx +60 -0
  116. package/src/components/CardEdition/_CardEdition.scss +138 -0
  117. package/src/components/Chakra/Box.stories.mdx +57 -0
  118. package/src/components/Chakra/Center.stories.mdx +99 -0
  119. package/src/components/Chakra/Grid.stories.mdx +79 -0
  120. package/src/components/Chakra/Stack.stories.mdx +93 -0
  121. package/src/components/Checkbox/Checkbox.stories.mdx +57 -35
  122. package/src/components/Checkbox/Checkbox.test.tsx +117 -147
  123. package/src/components/Checkbox/Checkbox.tsx +76 -50
  124. package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +325 -0
  125. package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +249 -0
  126. package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +345 -0
  127. package/src/components/CheckboxGroup/CheckboxGroup.tsx +148 -0
  128. package/src/components/CheckboxGroup/CheckboxGroupLayoutTypes.tsx +4 -0
  129. package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +1360 -0
  130. package/src/components/DatePicker/DatePicker.stories.mdx +284 -0
  131. package/src/components/DatePicker/DatePicker.test.tsx +657 -0
  132. package/src/components/DatePicker/DatePicker.tsx +396 -0
  133. package/src/components/DatePicker/DatePickerTypes.tsx +5 -0
  134. package/src/components/DatePicker/_DatePicker.scss +76 -0
  135. package/src/components/Form/Form.stories.mdx +130 -27
  136. package/src/components/Form/Form.test.tsx +78 -36
  137. package/src/components/Form/Form.tsx +53 -19
  138. package/src/components/Form/FormTypes.tsx +3 -0
  139. package/src/components/Form/__snapshots__/Form.test.tsx.snap +38 -0
  140. package/src/components/Grid/GridTypes.tsx +9 -0
  141. package/src/components/Grid/SimpleGrid.stories.mdx +275 -0
  142. package/src/components/Grid/SimpleGrid.test.tsx +66 -0
  143. package/src/components/Grid/SimpleGrid.tsx +37 -0
  144. package/src/components/Grid/__snapshots__/SimpleGrid.test.tsx.snap +8 -0
  145. package/src/components/Heading/Heading.stories.mdx +63 -33
  146. package/src/components/Heading/Heading.test.tsx +24 -16
  147. package/src/components/Heading/Heading.tsx +54 -38
  148. package/src/components/Heading/{HeadingDisplaySizes.tsx → HeadingTypes.tsx} +9 -0
  149. package/src/components/HelperErrorText/HelperErrorText.stories.tsx +2 -1
  150. package/src/components/HelperErrorText/_HelperErrorText.scss +1 -1
  151. package/src/components/Hero/Hero.stories.mdx +195 -85
  152. package/src/components/Hero/Hero.test.tsx +544 -113
  153. package/src/components/Hero/Hero.tsx +80 -93
  154. package/src/components/Hero/HeroTypes.tsx +17 -5
  155. package/src/components/Hero/__snapshots__/Hero.test.tsx.snap +307 -0
  156. package/src/components/HorizontalRule/HorizontalRule.stories.mdx +6 -1
  157. package/src/components/HorizontalRule/_HorizontalRule.scss +1 -1
  158. package/src/components/Icons/Icon.stories.mdx +89 -74
  159. package/src/components/Icons/Icon.test.tsx +30 -22
  160. package/src/components/Icons/Icon.tsx +63 -61
  161. package/src/components/Icons/IconSvgs.tsx +8 -0
  162. package/src/components/Icons/IconTypes.tsx +80 -60
  163. package/src/components/Image/Image.stories.tsx +2 -1
  164. package/src/components/Input/_Input.scss +2 -2
  165. package/src/components/Label/Label.stories.mdx +77 -0
  166. package/src/components/Label/Label.test.tsx +43 -12
  167. package/src/components/Label/Label.tsx +28 -45
  168. package/src/components/Label/__snapshots__/Label.test.tsx.snap +41 -0
  169. package/src/components/Link/Link.stories.mdx +47 -41
  170. package/src/components/Link/Link.test.tsx +33 -44
  171. package/src/components/Link/Link.tsx +114 -100
  172. package/src/components/List/List.stories.mdx +7 -3
  173. package/src/components/List/List.stories.tsx +14 -9
  174. package/src/components/List/List.test.tsx +12 -8
  175. package/src/components/List/List.tsx +9 -7
  176. package/src/components/List/_List.scss +3 -3
  177. package/src/components/Modal/Modal.stories.mdx +7 -3
  178. package/src/components/Modal/_Modal.scss +1 -1
  179. package/src/components/Notification/Notification.stories.mdx +99 -65
  180. package/src/components/Notification/Notification.test.tsx +3 -16
  181. package/src/components/Notification/Notification.tsx +12 -12
  182. package/src/components/Notification/_Notification.scss +5 -4
  183. package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +1 -1
  184. package/src/components/Pagination/Pagination.stories.mdx +7 -1
  185. package/src/components/Pagination/Pagination.test.tsx +16 -10
  186. package/src/components/Radio/Radio.stories.mdx +57 -46
  187. package/src/components/Radio/Radio.test.tsx +92 -138
  188. package/src/components/Radio/Radio.tsx +70 -69
  189. package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +250 -0
  190. package/src/components/RadioGroup/RadioGroup.stories.mdx +247 -0
  191. package/src/components/RadioGroup/RadioGroup.test.tsx +327 -0
  192. package/src/components/RadioGroup/RadioGroup.tsx +154 -0
  193. package/src/components/RadioGroup/RadioGroupLayoutTypes.tsx +4 -0
  194. package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +1101 -0
  195. package/src/components/SearchBar/SearchBar.Test.tsx +151 -16
  196. package/src/components/SearchBar/SearchBar.stories.mdx +196 -224
  197. package/src/components/SearchBar/SearchBar.tsx +151 -46
  198. package/src/components/Select/Select.stories.mdx +193 -168
  199. package/src/components/Select/Select.test.tsx +129 -324
  200. package/src/components/Select/Select.tsx +120 -160
  201. package/src/components/Select/SelectTypes.tsx +4 -0
  202. package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +18 -29
  203. package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +7 -7
  204. package/src/components/SkeletonLoader/SkeletonLoader.tsx +4 -2
  205. package/src/components/SkeletonLoader/SkeletonLoaderTypes.tsx +2 -2
  206. package/src/components/SkeletonLoader/_SkeletonLoader.scss +3 -3
  207. package/src/components/StatusBadge/StatusBadge.stories.mdx +91 -0
  208. package/src/components/StatusBadge/StatusBadge.test.tsx +35 -7
  209. package/src/components/StatusBadge/StatusBadge.tsx +24 -25
  210. package/src/components/StatusBadge/StatusBadgeTypes.tsx +5 -0
  211. package/src/components/StatusBadge/__snapshots__/StatusBadge.test.tsx.snap +28 -0
  212. package/src/components/StyleGuide/Bidirectionality.stories.mdx +112 -90
  213. package/src/components/StyleGuide/Buttons.stories.mdx +98 -100
  214. package/src/components/StyleGuide/Colors.stories.mdx +336 -0
  215. package/src/components/StyleGuide/Forms.stories.mdx +85 -0
  216. package/src/components/StyleGuide/Iconography.stories.mdx +86 -93
  217. package/src/components/StyleGuide/Spacing.stories.mdx +0 -1
  218. package/src/components/StyleGuide/Typography.stories.mdx +164 -166
  219. package/src/components/StyleGuide/UIDocCard.tsx +4 -4
  220. package/src/components/Tabs/Tabs.stories.mdx +221 -0
  221. package/src/components/Tabs/Tabs.test.tsx +264 -0
  222. package/src/components/Tabs/Tabs.tsx +220 -0
  223. package/src/components/Template/Template.stories.mdx +574 -0
  224. package/src/components/Template/Template.test.tsx +124 -0
  225. package/src/components/Template/Template.tsx +226 -0
  226. package/src/components/Text/Text.stories.mdx +70 -0
  227. package/src/components/Text/Text.test.tsx +63 -0
  228. package/src/components/Text/Text.tsx +55 -0
  229. package/src/components/Text/TextTypes.tsx +6 -0
  230. package/src/components/Text/__snapshots__/Text.test.tsx.snap +33 -0
  231. package/src/components/TextInput/TextInput.stories.mdx +90 -90
  232. package/src/components/TextInput/TextInput.test.tsx +103 -83
  233. package/src/components/TextInput/TextInput.tsx +108 -91
  234. package/src/components/TextInput/TextInputTypes.tsx +6 -0
  235. package/src/components/VideoPlayer/VideoPlayer.stories.mdx +2 -1
  236. package/src/components/VideoPlayer/VideoPlayer.tsx +4 -2
  237. package/src/components/VideoPlayer/_VideoPlayer.scss +1 -1
  238. package/src/docs/Chakra.stories.mdx +341 -0
  239. package/src/docs/Intro.stories.mdx +31 -24
  240. package/src/index.ts +70 -5
  241. package/src/styles/01-colors/_colors-brand.scss +6 -4
  242. package/src/styles/01-colors/_colors-utility.scss +14 -15
  243. package/src/styles/03-space/_space-inline.scss +47 -7
  244. package/src/styles/03-space/_space-inset.scss +33 -5
  245. package/src/styles/03-space/_space-stack.scss +48 -8
  246. package/src/styles/base/_02-breakpoints.scss +5 -4
  247. package/src/styles/base/_04-base.scss +2 -1
  248. package/src/styles/base/_place-holder.scss +1 -1
  249. package/src/styles/base/_typography.scss +1 -29
  250. package/src/styles.scss +22 -25
  251. package/src/theme/components/accordion.ts +30 -0
  252. package/src/theme/components/breadcrumb.ts +77 -0
  253. package/src/theme/components/button.ts +125 -0
  254. package/src/theme/components/checkbox.ts +107 -0
  255. package/src/theme/components/customCheckboxGroup.ts +12 -0
  256. package/src/theme/components/customRadioGroup.ts +12 -0
  257. package/src/theme/components/global.ts +71 -0
  258. package/src/theme/components/globalMixins.ts +16 -0
  259. package/src/theme/components/heading.ts +72 -0
  260. package/src/theme/components/hero.ts +239 -0
  261. package/src/theme/components/icon.ts +79 -0
  262. package/src/theme/components/label.ts +17 -0
  263. package/src/theme/components/link.ts +47 -0
  264. package/src/theme/components/radio.ts +106 -0
  265. package/src/theme/components/searchBar.ts +21 -0
  266. package/src/theme/components/select.ts +50 -0
  267. package/src/theme/components/statusBadge.ts +27 -0
  268. package/src/theme/components/tabs.ts +79 -0
  269. package/src/theme/components/template.ts +114 -0
  270. package/src/theme/components/text.ts +31 -0
  271. package/src/theme/components/textInput.ts +61 -0
  272. package/src/theme/foundations/breakpoints.ts +24 -0
  273. package/src/theme/foundations/colors.ts +208 -0
  274. package/src/theme/foundations/global.ts +26 -0
  275. package/src/theme/foundations/shadows.ts +5 -0
  276. package/src/theme/foundations/spacing.ts +85 -0
  277. package/src/theme/foundations/typography.ts +35 -0
  278. package/src/theme/index.ts +88 -0
  279. package/src/theme/provider.tsx +9 -0
  280. package/src/theme/types.ts +1 -0
  281. package/src/utils/componentCategories.ts +56 -21
  282. package/src/utils/utils.ts +13 -0
  283. package/dist/components/Accordion/Accordion.stories.d.ts +0 -5
  284. package/dist/components/Card/Card.stories.d.ts +0 -27
  285. package/dist/components/Label/Label.stories.d.ts +0 -12
  286. package/dist/components/StatusBadge/StatusBadge.stories.d.ts +0 -8
  287. package/dist/components/Template/Template.stories.d.ts +0 -29
  288. package/src/components/Accordion/Accordion.stories.tsx +0 -65
  289. package/src/components/Accordion/_Accordion.scss +0 -81
  290. package/src/components/Breadcrumbs/_Breadcrumbs.scss +0 -97
  291. package/src/components/Checkbox/_Checkbox.scss +0 -97
  292. package/src/components/Form/_Form.scss +0 -28
  293. package/src/components/Heading/_Heading.scss +0 -163
  294. package/src/components/Hero/_Hero.scss +0 -256
  295. package/src/components/Icons/_Icons.scss +0 -116
  296. package/src/components/Label/Label.stories.tsx +0 -30
  297. package/src/components/Label/_Label.scss +0 -22
  298. package/src/components/Link/_Link.scss +0 -73
  299. package/src/components/Radio/_Radio.scss +0 -84
  300. package/src/components/SearchBar/_SearchBar.scss +0 -16
  301. package/src/components/Select/_Select.scss +0 -82
  302. package/src/components/StatusBadge/StatusBadge.stories.tsx +0 -33
  303. package/src/components/StatusBadge/_StatusBadge.scss +0 -23
  304. package/src/components/StyleGuide/Colors.stories.tsx +0 -288
  305. package/src/components/Template/Template.stories.tsx +0 -85
  306. package/src/components/Template/_Template.scss +0 -63
  307. package/src/components/TextInput/_TextInput.scss +0 -59
@@ -10,7 +10,7 @@ import { withDesign } from "storybook-addon-designs";
10
10
 
11
11
  import { getCategory } from "../../utils/componentCategories";
12
12
  import Heading from "../Heading/Heading";
13
- import { HeadingDisplaySizes } from "../Heading/HeadingDisplaySizes";
13
+ import { HeadingDisplaySizes, HeadingLevels } from "../Heading/HeadingTypes";
14
14
  import List from "../List/List";
15
15
 
16
16
  <Meta
@@ -31,6 +31,16 @@ Consuming applications should utilize the DS standard text components as much as
31
31
 
32
32
  The sizing of all text elements in the Design System is based on `1rem` being equal to `16px`.
33
33
 
34
+ ## Style Guide Topics
35
+
36
+ - [Standard Text Component](#standard-text-components)
37
+ - [Font Family](#font-family)
38
+ - [Font Color](#font-color)
39
+ - [Font Weight](#font-weight)
40
+ - [Font Sizes](#font-sizes)
41
+ - [Text Case](#text-case)
42
+ - [Character Count](#character-count)
43
+
34
44
  ## Standard Text Components
35
45
 
36
46
  ### Headings
@@ -38,19 +48,19 @@ The sizing of all text elements in the Design System is based on `1rem` being eq
38
48
  Use the NYPL Design System [Heading](https://nypl.github.io/nypl-design-system/storybook-static/?path=/docs/heading--basic) component to render a standard HTML `<h>` tag. The `level` prop can be used to set the specific `<h>` tag that you require.
39
49
 
40
50
  <Preview>
41
- <Story name="Standard Text Components">
42
- <Heading level={1}>Heading Level 1</Heading>
43
- <Heading level={2}>Heading Level 2</Heading>
44
- <Heading level={3}>Heading Level 3</Heading>
45
- <Heading level={4}>Heading Level 4</Heading>
46
- </Story>
51
+ <>
52
+ <Heading level={HeadingLevels.One}>Heading Level 1</Heading>
53
+ <Heading level={HeadingLevels.Two}>Heading Level 2</Heading>
54
+ <Heading level={HeadingLevels.Three}>Heading Level 3</Heading>
55
+ <Heading level={HeadingLevels.Four}>Heading Level 4</Heading>
56
+ </>
47
57
  </Preview>
48
58
 
49
59
  #### Heading Display Sizes
50
60
 
51
61
  Each heading level has a default style and size, but those styles can be overridden using the `displaySize` prop. The display sizes are separate from semantic elements and may be used to override the default size and styling of the semantic HTML heading elements. For example, the `h1` element has the `Primary` style applied by default, but a new style can be applied through the `displaySize` prop. Any `displaySize` style can be applied to any `Heading` element.
52
62
 
53
- <Heading level={1} displaySize={HeadingDisplaySizes.Primary}>
63
+ <Heading level={HeadingLevels.One} displaySize={HeadingDisplaySizes.Primary}>
54
64
  Primary Heading
55
65
  </Heading>
56
66
 
@@ -60,7 +70,7 @@ Each heading level has a default style and size, but those styles can be overrid
60
70
  | `font-weight` | `300` | `--font-weight-light` |
61
71
  | `line-height` | `1.1` | n/a |
62
72
 
63
- <Heading level={1} displaySize={HeadingDisplaySizes.Secondary}>
73
+ <Heading level={HeadingLevels.One} displaySize={HeadingDisplaySizes.Secondary}>
64
74
  Secondary Heading
65
75
  </Heading>
66
76
 
@@ -70,7 +80,7 @@ Each heading level has a default style and size, but those styles can be overrid
70
80
  | `font-weight` | `500` | `--font-weight-medium` |
71
81
  | `line-height` | `1.25` | n/a |
72
82
 
73
- <Heading level={1} displaySize={HeadingDisplaySizes.Tertiary}>
83
+ <Heading level={HeadingLevels.One} displaySize={HeadingDisplaySizes.Tertiary}>
74
84
  Tertiary Heading
75
85
  </Heading>
76
86
 
@@ -80,7 +90,7 @@ Each heading level has a default style and size, but those styles can be overrid
80
90
  | `font-weight` | `500` | `--font-weight-medium` |
81
91
  | `line-height` | `1.25` | n/a |
82
92
 
83
- <Heading level={1} displaySize={HeadingDisplaySizes.Callout}>
93
+ <Heading level={HeadingLevels.One} displaySize={HeadingDisplaySizes.Callout}>
84
94
  Callout Heading
85
95
  </Heading>
86
96
 
@@ -158,17 +168,15 @@ The `displaySize` prop can be used to render a specific style from the DS defaul
158
168
  With website accessibility in mind, font choices for the DS were made with an eye toward clarity and readability. Headings and body content use the following font family assignment:
159
169
 
160
170
  <Preview>
161
- <Story name="Font Family">
162
- <p
163
- style={{
164
- fontSize: "var(--font-size--0)",
165
- fontWeight: "var(--font-weight-light)",
166
- fontFamily: "var(--typeface-body)",
167
- }}
168
- >
169
- system-ui, sans-serif
170
- </p>
171
- </Story>
171
+ <p
172
+ style={{
173
+ fontSize: "var(--font-size--0)",
174
+ fontWeight: "var(--font-weight-light)",
175
+ fontFamily: "var(--typeface-body)",
176
+ }}
177
+ >
178
+ system-ui, sans-serif
179
+ </p>
172
180
  </Preview>
173
181
 
174
182
  The following CSS variables are available through the DS.
@@ -181,23 +189,21 @@ The following CSS variables are available through the DS.
181
189
  > **RECOMMENDATIONS**
182
190
  > When making font selections for project based components outside the DS, sans serif fonts display better on computers and mobile devices. Avoid decorative or overly stylized fonts, as they are often difficult to read even for users without visual impairments or reading Standard Text Default
183
191
 
184
- ## Font Colors
192
+ ## Font Color
185
193
 
186
194
  All text within a project, unless specifically noted in mockups, should be black on a white background.
187
195
 
188
196
  <Preview>
189
- <Story name="Font Colors">
190
- <>
191
- <Heading level={3}>Default Heading Color</Heading>
192
- <p>
193
- This paragraph shows the default body text color. Curabitur blandit
194
- tempus porttitor. Praesent commodo cursus magna, vel scelerisque nisl
195
- consectetur et. Integer posuere erat a ante venenatis dapibus posuere
196
- velit aliquet. Duis mollis, est non commodo luctus, nisi erat porttitor
197
- ligula, eget lacinia odio sem nec elit.
198
- </p>
199
- </>
200
- </Story>
197
+ <>
198
+ <Heading level={HeadingLevels.Three}>Default Heading Color</Heading>
199
+ <p>
200
+ This paragraph shows the default body text color. Curabitur blandit tempus
201
+ porttitor. Praesent commodo cursus magna, vel scelerisque nisl consectetur
202
+ et. Integer posuere erat a ante venenatis dapibus posuere velit aliquet.
203
+ Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget
204
+ lacinia odio sem nec elit.
205
+ </p>
206
+ </>
201
207
  </Preview>
202
208
 
203
209
  In cases where specific colors must be applied to text elements, the DS provides CSS variables for the full NYPL color palette. Refer to the [Colors](https://nypl.github.io/nypl-design-system/storybook-static/?path=/docs/style-guide-colors--colors-brand) section of the Style Guide for details.
@@ -207,46 +213,44 @@ In cases where specific colors must be applied to text elements, the DS provides
207
213
  The DS uses four font weights to render text. The default font-weight is 300.
208
214
 
209
215
  <Preview>
210
- <Story name="Font Weight">
211
- <>
212
- <p
213
- style={{
214
- fontSize: "1rem",
215
- fontWeight: "var(--font-weight-light)",
216
- fontFamily: "system-ui, sans-serif",
217
- }}
218
- >
219
- Light / 300
220
- </p>
221
- <p
222
- style={{
223
- fontSize: "1rem",
224
- fontWeight: "var(--font-weight-regular)",
225
- fontFamily: "system-ui, sans-serif",
226
- }}
227
- >
228
- Regular / 400
229
- </p>
230
- <p
231
- style={{
232
- fontSize: "1rem",
233
- fontWeight: "var(--font-weight-medium)",
234
- fontFamily: "system-ui, sans-serif",
235
- }}
236
- >
237
- Medium / 500
238
- </p>
239
- <p
240
- style={{
241
- fontSize: "1rem",
242
- fontWeight: "var(--font-weight-bold)",
243
- fontFamily: "system-ui, sans-serif",
244
- }}
245
- >
246
- Bold / 700
247
- </p>
248
- </>
249
- </Story>
216
+ <>
217
+ <p
218
+ style={{
219
+ fontSize: "1rem",
220
+ fontWeight: "var(--font-weight-light)",
221
+ fontFamily: "system-ui, sans-serif",
222
+ }}
223
+ >
224
+ Light / 300
225
+ </p>
226
+ <p
227
+ style={{
228
+ fontSize: "1rem",
229
+ fontWeight: "var(--font-weight-regular)",
230
+ fontFamily: "system-ui, sans-serif",
231
+ }}
232
+ >
233
+ Regular / 400
234
+ </p>
235
+ <p
236
+ style={{
237
+ fontSize: "1rem",
238
+ fontWeight: "var(--font-weight-medium)",
239
+ fontFamily: "system-ui, sans-serif",
240
+ }}
241
+ >
242
+ Medium / 500
243
+ </p>
244
+ <p
245
+ style={{
246
+ fontSize: "1rem",
247
+ fontWeight: "var(--font-weight-bold)",
248
+ fontFamily: "system-ui, sans-serif",
249
+ }}
250
+ >
251
+ Bold / 700
252
+ </p>
253
+ </>
250
254
  </Preview>
251
255
 
252
256
  The following CSS variables are available through the DS.
@@ -258,87 +262,85 @@ The following CSS variables are available through the DS.
258
262
  --font-weight-bold: 700;
259
263
  ```
260
264
 
261
- ## Font Sizing
265
+ ## Font Sizes
262
266
 
263
267
  Font sizing is based on a root font size of 16px (1rem = 16px).
264
268
 
265
269
  <Preview>
266
- <Story name="Font Sizing">
267
- <>
268
- <p
269
- style={{
270
- fontSize: "var(--font-size--3)",
271
- fontWeight: "var(--font-weight-light)",
272
- fontFamily: "var(--typeface-body)",
273
- }}
274
- >
275
- Font size -3
276
- </p>
277
- <p
278
- style={{
279
- fontSize: "var(--font-size--2)",
280
- fontWeight: "var(--font-weight-light)",
281
- fontFamily: "var(--typeface-body)",
282
- }}
283
- >
284
- Font size -2
285
- </p>
286
- <p
287
- style={{
288
- fontSize: "var(--font-size--1)",
289
- fontWeight: "var(--font-weight-light)",
290
- fontFamily: "var(--typeface-body)",
291
- }}
292
- >
293
- Font size -1
294
- </p>
295
- <p
296
- style={{
297
- fontSize: "var(--font-size--0)",
298
- fontWeight: "var(--font-weight-light)",
299
- fontFamily: "var(--typeface-body)",
300
- }}
301
- >
302
- Font size 0
303
- </p>
304
- <p
305
- style={{
306
- fontSize: "var(--font-size-1)",
307
- fontWeight: "var(--font-weight-light)",
308
- fontFamily: "var(--typeface-body)",
309
- }}
310
- >
311
- Font size 1
312
- </p>
313
- <p
314
- style={{
315
- fontSize: "var(--font-size-2)",
316
- fontWeight: "var(--font-weight-light)",
317
- fontFamily: "var(--typeface-body)",
318
- }}
319
- >
320
- Font size 2
321
- </p>
322
- <p
323
- style={{
324
- fontSize: "var(--font-size-3)",
325
- fontWeight: "var(--font-weight-light)",
326
- fontFamily: "var(--typeface-body)",
327
- }}
328
- >
329
- Font size 3
330
- </p>
331
- <p
332
- style={{
333
- fontSize: "var(--font-size-4)",
334
- fontWeight: "var(--font-weight-light)",
335
- fontFamily: "var(--typeface-body)",
336
- }}
337
- >
338
- Font size 4
339
- </p>
340
- </>
341
- </Story>
270
+ <>
271
+ <p
272
+ style={{
273
+ fontSize: "var(--font-size--3)",
274
+ fontWeight: "var(--font-weight-light)",
275
+ fontFamily: "var(--typeface-body)",
276
+ }}
277
+ >
278
+ Font size -3
279
+ </p>
280
+ <p
281
+ style={{
282
+ fontSize: "var(--font-size--2)",
283
+ fontWeight: "var(--font-weight-light)",
284
+ fontFamily: "var(--typeface-body)",
285
+ }}
286
+ >
287
+ Font size -2
288
+ </p>
289
+ <p
290
+ style={{
291
+ fontSize: "var(--font-size--1)",
292
+ fontWeight: "var(--font-weight-light)",
293
+ fontFamily: "var(--typeface-body)",
294
+ }}
295
+ >
296
+ Font size -1
297
+ </p>
298
+ <p
299
+ style={{
300
+ fontSize: "var(--font-size--0)",
301
+ fontWeight: "var(--font-weight-light)",
302
+ fontFamily: "var(--typeface-body)",
303
+ }}
304
+ >
305
+ Font size 0
306
+ </p>
307
+ <p
308
+ style={{
309
+ fontSize: "var(--font-size-1)",
310
+ fontWeight: "var(--font-weight-light)",
311
+ fontFamily: "var(--typeface-body)",
312
+ }}
313
+ >
314
+ Font size 1
315
+ </p>
316
+ <p
317
+ style={{
318
+ fontSize: "var(--font-size-2)",
319
+ fontWeight: "var(--font-weight-light)",
320
+ fontFamily: "var(--typeface-body)",
321
+ }}
322
+ >
323
+ Font size 2
324
+ </p>
325
+ <p
326
+ style={{
327
+ fontSize: "var(--font-size-3)",
328
+ fontWeight: "var(--font-weight-light)",
329
+ fontFamily: "var(--typeface-body)",
330
+ }}
331
+ >
332
+ Font size 3
333
+ </p>
334
+ <p
335
+ style={{
336
+ fontSize: "var(--font-size-4)",
337
+ fontWeight: "var(--font-weight-light)",
338
+ fontFamily: "var(--typeface-body)",
339
+ }}
340
+ >
341
+ Font size 4
342
+ </p>
343
+ </>
342
344
  </Preview>
343
345
 
344
346
  The following CSS variables are available through the DS.
@@ -359,15 +361,13 @@ The following CSS variables are available through the DS.
359
361
  In general, the New York Public Library uses Title Case for titles. This means only using capital letters for the principal words. Articles, conjunctions, and prepositions do not get capital letters unless they start the title. For example:
360
362
 
361
363
  <Preview>
362
- <Story name="Text Case">
363
- <ul>
364
- <li>Snow White and the Seven Dwarfs</li>
365
- <li>The Last of the Mohicans</li>
366
- <li>Spooky Books for Kids: The Ultimate Creepy Guide</li>
367
- <li>The Future Teen Stars of America Live on TikTok</li>
368
- <li>How Jacqueline Woodson Captures Every Side of Brooklyn</li>
369
- </ul>
370
- </Story>
364
+ <ul>
365
+ <li>Snow White and the Seven Dwarfs</li>
366
+ <li>The Last of the Mohicans</li>
367
+ <li>Spooky Books for Kids: The Ultimate Creepy Guide</li>
368
+ <li>The Future Teen Stars of America Live on TikTok</li>
369
+ <li>How Jacqueline Woodson Captures Every Side of Brooklyn</li>
370
+ </ul>
371
371
  </Preview>
372
372
 
373
373
  ## Character Count
@@ -377,11 +377,9 @@ In general, the New York Public Library uses Title Case for titles. This means o
377
377
  80 characters max, 60 characters recommended
378
378
 
379
379
  <Preview>
380
- <Story name="Character Count">
381
- <Heading level={4}>
382
- This is a Long Title to Show What 58 Characters Looks Like
383
- </Heading>
384
- </Story>
380
+ <Heading level={HeadingLevels.Four}>
381
+ This is a Long Title to Show What 58 Characters Looks Like
382
+ </Heading>
385
383
  </Preview>
386
384
 
387
385
  ### Summaries
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import Card from "../Card/Card";
2
+ import CardEdition from "../CardEdition/CardEdition";
3
3
 
4
4
  interface UIDocCardProps {
5
5
  /** backgroundColor of the doc card */
@@ -16,12 +16,12 @@ export default function UIDocCard(
16
16
  const { backgroundColor, children } = props;
17
17
 
18
18
  return (
19
- <Card className="var-docs">
19
+ <CardEdition className="var-docs">
20
20
  <div
21
21
  style={{
22
22
  alignItems: "center",
23
23
  backgroundColor: backgroundColor,
24
- borderBottom: "1px solid var(--ui-gray-light)",
24
+ borderBottom: "1px solid var(--ui-gray-light-cool)",
25
25
  color: "white",
26
26
  display: "flex",
27
27
  height: "100px",
@@ -31,6 +31,6 @@ export default function UIDocCard(
31
31
  }}
32
32
  ></div>
33
33
  {children}
34
- </Card>
34
+ </CardEdition>
35
35
  );
36
36
  }
@@ -0,0 +1,221 @@
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
+
10
+ import { Tabs, TabList, Tab, TabPanels, TabPanel } from "./Tabs";
11
+ import { getCategory } from "../../utils/componentCategories";
12
+ import DSProvider from "../../theme/provider";
13
+
14
+ <Meta
15
+ title={getCategory("Tabs")}
16
+ component={Tabs}
17
+ decorators={[withDesign]}
18
+ parameters={{
19
+ design: {
20
+ type: "figma",
21
+ url:
22
+ "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Main?node-id=36835%3A26464",
23
+ },
24
+ jest: ["Tabs.test.tsx"],
25
+ }}
26
+ argTypes={{
27
+ children: { table: { disable: true } },
28
+ id: { table: { disable: true } },
29
+ className: { table: { disable: true } },
30
+ data: { table: { disable: true } },
31
+ onChange: { table: { disable: true } },
32
+ }}
33
+ />
34
+
35
+ # Tabs
36
+
37
+ | Component Version | DS Version |
38
+ | ----------------- | ---------- |
39
+ | Added | `0.24.0` |
40
+ | Latest | `0.25.0` |
41
+
42
+ <Description of={Tabs} />
43
+
44
+ export const animalCrossing = [
45
+ {
46
+ label: "Tom Nook",
47
+ content: (
48
+ <p>
49
+ Tom Nook, <b>known in Japan as Tanukichi</b>, is a fictional character
50
+ in the Animal Crossing series who operates the village store.
51
+ </p>
52
+ ),
53
+ },
54
+ {
55
+ label: "Isabelle",
56
+ content:
57
+ "Isabelle, known as Shizue in Japan, is a fictional character " +
58
+ "from the Animal Crossing series of video games. She is a kindly Shih " +
59
+ "Tzu that debuted in the 2012 release Animal Crossing: New Leaf, where " +
60
+ "she serves as the secretary to the player character.",
61
+ },
62
+ {
63
+ label: "K.K. Slider",
64
+ content:
65
+ "<p>Totakeke, more commonly known as <b>K.K. Slider or K.K.</b>, is a " +
66
+ "fictional character within the Animal Crossing franchise. One of the " +
67
+ "franchise's most popular characters, he debuted in the title Animal " +
68
+ "Crossing, and has appeared in every installment since.</p>",
69
+ },
70
+ {
71
+ label: "Mr. Resetti",
72
+ content:
73
+ "<strong>Mr. Resetti</strong>, full name Sonny Resetti, is a fictional character from the Animal Crossing series of video games by Nintendo. His first appearance was in the Nintendo 64 game Dōbutsu no Mori, released in Europe and North America on the GameCube as Animal Crossing.",
74
+ },
75
+ {
76
+ label: "Zucker",
77
+ content:
78
+ "<strong>Zucker</strong> is a lazy octopus villager who first appeared in New Leaf. His Japanese name and general appearance refers to the Japanese snack takoyaki, which is a fried ball of dough commonly filled with minced octopus. His catchphrase is a reference to how he is an underwater animal. He has the same initial phrase as Bertha. He has the nature hobby.",
79
+ },
80
+ ];
81
+
82
+ <Canvas withToolbar>
83
+ <Story
84
+ name="Basic with props"
85
+ args={{
86
+ defaultIndex: 0,
87
+ useHash: false,
88
+ contentData: animalCrossing,
89
+ }}
90
+ >
91
+ {(args) => <Tabs {...args} />}
92
+ </Story>
93
+ </Canvas>
94
+
95
+ <ArgsTable story="Basic with props" />
96
+
97
+ ## Composing with a Data Object
98
+
99
+ _Note: this is the recommended approach._
100
+
101
+ We recommended passing in the data for the `Tabs` component through the `data`
102
+ prop. This allows the consumer to pass in well-formed data and always generate
103
+ the correct DOM. Internally in the DS `Tabs` component, we map through the data
104
+ array and generate the appropriate components needed for the layout.
105
+
106
+ Note that HTML is allowed in the `content` property in each object as part of the
107
+ string or as straight HTML.
108
+
109
+ ```jsx
110
+ import { Tabs } from "@nypl/design-system-react-components";
111
+
112
+ const animalCrossing = [
113
+ {
114
+ label: "Tom Nook",
115
+ content: <p>Tom Nook, <b>known in Japan as Tanukichi</b>, is a ...,
116
+ {
117
+ label: "Isabelle",
118
+ content: "Isabelle, known as Shizue in Japan, is a fictional ...",
119
+ },
120
+ {
121
+ label: "K.K. Slider",
122
+ content:
123
+ "<p>Totakeke, more commonly known as <b>K.K. Slider or K.K.</b>, is ...",
124
+ },
125
+ ];
126
+
127
+ // ...
128
+ <Tabs contentData={animalCrossing} />;
129
+ ```
130
+
131
+ ## With Callback Event Function
132
+
133
+ If you need to keep track of the index of current tab that was selected, pass
134
+ an `onChange` event handler to the `onChange` prop. This will return the index
135
+ (0-based) of the tab selected.
136
+
137
+ ```jsx
138
+ export const onChange = (value) => {
139
+ window.alert(`Tab index selected was ${value}`);
140
+ };
141
+
142
+ // ...
143
+ <Tabs contentData={animalCrossing} onChange={onChange} />;
144
+ ```
145
+
146
+ export const onChange = (value) => {
147
+ window.alert(`Tab index selected was ${value}`);
148
+ };
149
+
150
+ <Canvas>
151
+ <Story name="With Callback Event Function">
152
+ <Tabs contentData={animalCrossing} onChange={onChange} />
153
+ </Story>
154
+ </Canvas>
155
+
156
+ ## With URL Hash Option
157
+
158
+ In some situations, each selected tab should update the URL with a hash value.
159
+ To enable this, set the `useHash` prop to true.
160
+
161
+ <Canvas>
162
+ <Story name="With URL Hash Option">
163
+ <Tabs contentData={animalCrossing} useHash={true} />
164
+ </Story>
165
+ </Canvas>
166
+
167
+ ## With Children Components
168
+
169
+ _Note: not recommended but available._
170
+
171
+ There are five components that make up the Design System `Tabs` component:
172
+ `Tabs`, `TabList`, `Tab`, `TabPanels`, `TabPanel`. The general layout is always
173
+ the same such that the `Tabs` component has `TabList` and `TabPanels` as children.
174
+
175
+ `TabList` only takes `Tab` components as children and `TabPanels` only take
176
+ `TabPanel` as children. While you can compose the DS `Tabs` components with these
177
+ available components, you will probably have to iterate or map through an array
178
+ to get the desired outcome. The DS `Tabs` component does this internally for
179
+ you so this should be a last resort option.
180
+
181
+ Make sure all five components are imported to use this approach.
182
+
183
+ ```jsx
184
+ import {
185
+ Tabs,
186
+ TabList,
187
+ Tab,
188
+ TabPanels,
189
+ TabPanel,
190
+ } from "@nypl/design-system-react-components";
191
+ ```
192
+
193
+ <Canvas>
194
+ <Story name="With Children Components">
195
+ <Tabs>
196
+ <TabList>
197
+ <Tab>Tom Nook</Tab>
198
+ <Tab>Isabelle</Tab>
199
+ <Tab>K.K. Slider</Tab>
200
+ </TabList>
201
+ <TabPanels>
202
+ <TabPanel>
203
+ Tom Nook, known in Japan as Tanukichi, is a fictional character in the
204
+ Animal Crossing series who operates the village store.
205
+ </TabPanel>
206
+ <TabPanel>
207
+ Isabelle, known as Shizue in Japan, is a fictional character from the
208
+ Animal Crossing series of video games. She is a kindly Shih Tzu that
209
+ debuted in the 2012 release Animal Crossing: New Leaf, where she
210
+ serves as the secretary to the player character.
211
+ </TabPanel>
212
+ <TabPanel>
213
+ Totakeke, more commonly known as K.K. Slider or K.K., is a fictional
214
+ character within the Animal Crossing franchise. One of the franchise's
215
+ most popular characters, he debuted in the title Animal Crossing, and
216
+ has appeared in every installment since.
217
+ </TabPanel>
218
+ </TabPanels>
219
+ </Tabs>
220
+ </Story>
221
+ </Canvas>