@nypl/design-system-react-components 0.25.0 → 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 (236) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/components/Accordion/Accordion.d.ts +14 -14
  3. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +11 -14
  4. package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +6 -0
  5. package/dist/components/Button/ButtonTypes.d.ts +2 -1
  6. package/dist/components/Card/Card.d.ts +1 -1
  7. package/dist/components/Card/CardTypes.d.ts +2 -2
  8. package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +43 -0
  9. package/dist/components/CheckboxGroup/CheckboxGroupLayoutTypes.d.ts +4 -0
  10. package/dist/components/DatePicker/DatePicker.d.ts +3 -3
  11. package/dist/components/Form/Form.d.ts +13 -8
  12. package/dist/components/Form/FormTypes.d.ts +2 -8
  13. package/dist/components/Grid/GridTypes.d.ts +9 -0
  14. package/dist/components/Grid/SimpleGrid.d.ts +14 -0
  15. package/dist/components/Heading/Heading.d.ts +4 -4
  16. package/dist/components/Hero/Hero.d.ts +19 -14
  17. package/dist/components/Hero/HeroTypes.d.ts +10 -5
  18. package/dist/components/Icons/Icon.d.ts +13 -16
  19. package/dist/components/Icons/IconTypes.d.ts +78 -64
  20. package/dist/components/Label/Label.d.ts +5 -17
  21. package/dist/components/Link/Link.d.ts +8 -12
  22. package/dist/components/SearchBar/SearchBar.d.ts +45 -27
  23. package/dist/components/Select/Select.d.ts +32 -35
  24. package/dist/components/Select/SelectTypes.d.ts +4 -0
  25. package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +1 -1
  26. package/dist/components/SkeletonLoader/SkeletonLoaderTypes.d.ts +2 -2
  27. package/dist/components/StatusBadge/StatusBadge.d.ts +8 -6
  28. package/dist/components/StatusBadge/StatusBadgeTypes.d.ts +5 -0
  29. package/dist/components/Template/Template.d.ts +91 -0
  30. package/dist/components/Text/Text.d.ts +16 -0
  31. package/dist/components/Text/TextTypes.d.ts +6 -0
  32. package/dist/components/TextInput/TextInput.d.ts +32 -31
  33. package/dist/components/TextInput/TextInputTypes.d.ts +5 -0
  34. package/dist/design-system-react-components.cjs.development.js +2597 -1170
  35. package/dist/design-system-react-components.cjs.development.js.map +1 -1
  36. package/dist/design-system-react-components.cjs.production.min.js +1 -1
  37. package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
  38. package/dist/design-system-react-components.esm.js +2580 -1173
  39. package/dist/design-system-react-components.esm.js.map +1 -1
  40. package/dist/index.d.ts +8 -1
  41. package/dist/styles.css +1 -1
  42. package/dist/theme/components/accordion.d.ts +25 -0
  43. package/dist/theme/components/breadcrumb.d.ts +90 -0
  44. package/dist/theme/components/button.d.ts +17 -7
  45. package/dist/theme/components/checkbox.d.ts +7 -7
  46. package/dist/theme/components/customCheckboxGroup.d.ts +18 -0
  47. package/dist/theme/components/customRadioGroup.d.ts +4 -3
  48. package/dist/theme/components/global.d.ts +55 -0
  49. package/dist/theme/components/globalMixins.d.ts +15 -0
  50. package/dist/theme/components/heading.d.ts +50 -20
  51. package/dist/theme/components/hero.d.ts +492 -0
  52. package/dist/theme/components/icon.d.ts +13 -0
  53. package/dist/theme/components/label.d.ts +16 -0
  54. package/dist/theme/components/link.d.ts +45 -0
  55. package/dist/theme/components/radio.d.ts +8 -7
  56. package/dist/theme/components/searchBar.d.ts +20 -0
  57. package/dist/theme/components/select.d.ts +58 -0
  58. package/dist/theme/components/statusBadge.d.ts +25 -0
  59. package/dist/theme/components/tabs.d.ts +9 -9
  60. package/dist/theme/components/template.d.ts +105 -0
  61. package/dist/theme/components/text.d.ts +20 -0
  62. package/dist/theme/components/textInput.d.ts +105 -0
  63. package/dist/theme/foundations/global.d.ts +3 -0
  64. package/dist/theme/foundations/shadows.d.ts +4 -0
  65. package/dist/utils/utils.d.ts +6 -0
  66. package/package.json +3 -2
  67. package/src/components/Accordion/Accordion.stories.mdx +227 -33
  68. package/src/components/Accordion/Accordion.test.tsx +135 -19
  69. package/src/components/Accordion/Accordion.tsx +81 -56
  70. package/src/components/Autosuggest/Autosuggest.stories.mdx +1 -1
  71. package/src/components/Autosuggest/Autosuggest.stories.tsx +1 -1
  72. package/src/components/Autosuggest/_Autosuggest.scss +2 -2
  73. package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +46 -52
  74. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +31 -25
  75. package/src/components/Breadcrumbs/Breadcrumbs.tsx +71 -73
  76. package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +6 -0
  77. package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +100 -0
  78. package/src/components/Button/Button.stories.mdx +31 -27
  79. package/src/components/Button/Button.test.tsx +17 -5
  80. package/src/components/Button/ButtonTypes.tsx +1 -0
  81. package/src/components/Button/_Button.scss +3 -27
  82. package/src/components/Button/__snapshots__/Button.test.tsx.snap +11 -0
  83. package/src/components/Card/Card.stories.mdx +24 -20
  84. package/src/components/Card/Card.test.tsx +13 -19
  85. package/src/components/Card/Card.tsx +1 -1
  86. package/src/components/Card/CardTypes.tsx +2 -2
  87. package/src/components/Card/_Card.scss +1 -1
  88. package/src/components/CardEdition/CardEdition.stories.tsx +11 -6
  89. package/src/components/CardEdition/CardEdition.test.tsx +23 -31
  90. package/src/components/CardEdition/_CardEdition.scss +2 -2
  91. package/src/components/Chakra/Center.stories.mdx +31 -14
  92. package/src/components/Chakra/Grid.stories.mdx +79 -0
  93. package/src/components/Chakra/Stack.stories.mdx +4 -4
  94. package/src/components/Checkbox/Checkbox.tsx +9 -12
  95. package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +2 -5
  96. package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +249 -0
  97. package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +345 -0
  98. package/src/components/CheckboxGroup/CheckboxGroup.tsx +148 -0
  99. package/src/components/CheckboxGroup/CheckboxGroupLayoutTypes.tsx +4 -0
  100. package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +1360 -0
  101. package/src/components/DatePicker/DatePicker.test.tsx +4 -4
  102. package/src/components/DatePicker/DatePicker.tsx +13 -13
  103. package/src/components/DatePicker/_DatePicker.scss +1 -0
  104. package/src/components/Form/Form.stories.mdx +46 -21
  105. package/src/components/Form/Form.test.tsx +58 -45
  106. package/src/components/Form/Form.tsx +49 -21
  107. package/src/components/Form/FormTypes.tsx +3 -8
  108. package/src/components/Form/__snapshots__/Form.test.tsx.snap +24 -14
  109. package/src/components/Grid/GridTypes.tsx +9 -0
  110. package/src/components/Grid/SimpleGrid.stories.mdx +275 -0
  111. package/src/components/Grid/SimpleGrid.test.tsx +66 -0
  112. package/src/components/Grid/SimpleGrid.tsx +37 -0
  113. package/src/components/Grid/__snapshots__/SimpleGrid.test.tsx.snap +8 -0
  114. package/src/components/Heading/Heading.stories.mdx +1 -0
  115. package/src/components/Heading/Heading.tsx +12 -6
  116. package/src/components/HelperErrorText/_HelperErrorText.scss +1 -1
  117. package/src/components/Hero/Hero.stories.mdx +188 -121
  118. package/src/components/Hero/Hero.test.tsx +537 -107
  119. package/src/components/Hero/Hero.tsx +79 -92
  120. package/src/components/Hero/HeroTypes.tsx +17 -5
  121. package/src/components/Hero/__snapshots__/Hero.test.tsx.snap +307 -0
  122. package/src/components/HorizontalRule/_HorizontalRule.scss +1 -1
  123. package/src/components/Icons/Icon.stories.mdx +83 -74
  124. package/src/components/Icons/Icon.test.tsx +30 -22
  125. package/src/components/Icons/Icon.tsx +63 -61
  126. package/src/components/Icons/IconTypes.tsx +80 -64
  127. package/src/components/Input/_Input.scss +2 -2
  128. package/src/components/Label/Label.stories.mdx +28 -7
  129. package/src/components/Label/Label.test.tsx +43 -12
  130. package/src/components/Label/Label.tsx +21 -34
  131. package/src/components/Label/__snapshots__/Label.test.tsx.snap +41 -0
  132. package/src/components/Link/Link.stories.mdx +41 -41
  133. package/src/components/Link/Link.test.tsx +33 -44
  134. package/src/components/Link/Link.tsx +114 -100
  135. package/src/components/List/List.stories.mdx +0 -2
  136. package/src/components/List/List.stories.tsx +5 -5
  137. package/src/components/List/_List.scss +3 -3
  138. package/src/components/Modal/_Modal.scss +1 -1
  139. package/src/components/Notification/Notification.stories.mdx +12 -1
  140. package/src/components/Notification/Notification.test.tsx +3 -16
  141. package/src/components/Notification/Notification.tsx +9 -10
  142. package/src/components/Notification/_Notification.scss +4 -4
  143. package/src/components/Pagination/Pagination.test.tsx +16 -10
  144. package/src/components/RadioGroup/RadioGroup.stories.mdx +1 -1
  145. package/src/components/RadioGroup/RadioGroup.tsx +2 -10
  146. package/src/components/SearchBar/SearchBar.Test.tsx +151 -16
  147. package/src/components/SearchBar/SearchBar.stories.mdx +189 -219
  148. package/src/components/SearchBar/SearchBar.tsx +151 -46
  149. package/src/components/Select/Select.stories.mdx +188 -170
  150. package/src/components/Select/Select.test.tsx +125 -380
  151. package/src/components/Select/Select.tsx +118 -165
  152. package/src/components/Select/SelectTypes.tsx +4 -0
  153. package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +13 -25
  154. package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +7 -7
  155. package/src/components/SkeletonLoader/SkeletonLoader.tsx +4 -2
  156. package/src/components/SkeletonLoader/SkeletonLoaderTypes.tsx +2 -2
  157. package/src/components/SkeletonLoader/_SkeletonLoader.scss +3 -3
  158. package/src/components/StatusBadge/StatusBadge.stories.mdx +91 -0
  159. package/src/components/StatusBadge/StatusBadge.test.tsx +35 -7
  160. package/src/components/StatusBadge/StatusBadge.tsx +24 -25
  161. package/src/components/StatusBadge/StatusBadgeTypes.tsx +5 -0
  162. package/src/components/StatusBadge/__snapshots__/StatusBadge.test.tsx.snap +28 -0
  163. package/src/components/StyleGuide/Bidirectionality.stories.mdx +16 -16
  164. package/src/components/StyleGuide/Buttons.stories.mdx +15 -15
  165. package/src/components/StyleGuide/Colors.stories.mdx +336 -0
  166. package/src/components/StyleGuide/Iconography.stories.mdx +88 -90
  167. package/src/components/StyleGuide/UIDocCard.tsx +1 -1
  168. package/src/components/Tabs/Tabs.tsx +7 -9
  169. package/src/components/Template/Template.stories.mdx +574 -0
  170. package/src/components/Template/Template.test.tsx +124 -0
  171. package/src/components/Template/Template.tsx +226 -0
  172. package/src/components/Text/Text.stories.mdx +70 -0
  173. package/src/components/Text/Text.test.tsx +63 -0
  174. package/src/components/Text/Text.tsx +55 -0
  175. package/src/components/Text/TextTypes.tsx +6 -0
  176. package/src/components/Text/__snapshots__/Text.test.tsx.snap +33 -0
  177. package/src/components/TextInput/TextInput.stories.mdx +89 -90
  178. package/src/components/TextInput/TextInput.test.tsx +65 -86
  179. package/src/components/TextInput/TextInput.tsx +101 -95
  180. package/src/components/TextInput/TextInputTypes.tsx +6 -0
  181. package/src/components/VideoPlayer/_VideoPlayer.scss +1 -1
  182. package/src/docs/Chakra.stories.mdx +4 -4
  183. package/src/docs/Intro.stories.mdx +15 -13
  184. package/src/index.ts +20 -0
  185. package/src/styles/01-colors/_colors-brand.scss +6 -0
  186. package/src/styles/01-colors/_colors-utility.scss +14 -12
  187. package/src/styles/base/_04-base.scss +2 -1
  188. package/src/styles/base/_place-holder.scss +1 -1
  189. package/src/styles.scss +10 -12
  190. package/src/theme/components/accordion.ts +30 -0
  191. package/src/theme/components/breadcrumb.ts +77 -0
  192. package/src/theme/components/button.ts +77 -63
  193. package/src/theme/components/checkbox.ts +15 -27
  194. package/src/theme/components/customCheckboxGroup.ts +12 -0
  195. package/src/theme/components/customRadioGroup.ts +4 -10
  196. package/src/theme/components/global.ts +71 -0
  197. package/src/theme/components/globalMixins.ts +16 -0
  198. package/src/theme/components/heading.ts +15 -8
  199. package/src/theme/components/hero.ts +239 -0
  200. package/src/theme/components/icon.ts +79 -0
  201. package/src/theme/components/label.ts +17 -0
  202. package/src/theme/components/link.ts +47 -0
  203. package/src/theme/components/radio.ts +20 -31
  204. package/src/theme/components/searchBar.ts +21 -0
  205. package/src/theme/components/select.ts +50 -0
  206. package/src/theme/components/statusBadge.ts +27 -0
  207. package/src/theme/components/tabs.ts +72 -69
  208. package/src/theme/components/template.ts +114 -0
  209. package/src/theme/components/text.ts +31 -0
  210. package/src/theme/components/textInput.ts +61 -0
  211. package/src/theme/foundations/colors.ts +29 -13
  212. package/src/theme/foundations/global.ts +3 -0
  213. package/src/theme/foundations/shadows.ts +5 -0
  214. package/src/theme/index.ts +37 -7
  215. package/src/utils/componentCategories.ts +8 -2
  216. package/src/utils/utils.ts +13 -0
  217. package/dist/components/Accordion/Accordion.stories.d.ts +0 -6
  218. package/dist/components/StatusBadge/StatusBadge.stories.d.ts +0 -8
  219. package/dist/components/StyleGuide/Colors.stories.d.ts +0 -25
  220. package/dist/components/Template/Template.stories.d.ts +0 -30
  221. package/src/components/Accordion/Accordion.stories.tsx +0 -66
  222. package/src/components/Accordion/_Accordion.scss +0 -81
  223. package/src/components/Breadcrumbs/_Breadcrumbs.scss +0 -97
  224. package/src/components/Form/_Form.scss +0 -67
  225. package/src/components/Hero/_Hero.scss +0 -256
  226. package/src/components/Icons/_Icons.scss +0 -116
  227. package/src/components/Label/_Label.scss +0 -22
  228. package/src/components/Link/_Link.scss +0 -73
  229. package/src/components/SearchBar/_SearchBar.scss +0 -16
  230. package/src/components/Select/_Select.scss +0 -82
  231. package/src/components/StatusBadge/StatusBadge.stories.tsx +0 -34
  232. package/src/components/StatusBadge/_StatusBadge.scss +0 -23
  233. package/src/components/StyleGuide/Colors.stories.tsx +0 -289
  234. package/src/components/Template/Template.stories.tsx +0 -86
  235. package/src/components/Template/_Template.scss +0 -63
  236. package/src/components/TextInput/_TextInput.scss +0 -59
@@ -2,10 +2,16 @@ import { Colors } from "@chakra-ui/react";
2
2
 
3
3
  /**
4
4
  * Colors taken from "../../styles/01-colors/*.scss"
5
+ *
5
6
  * All UI colors can be found in Storybook:
6
- * https://nypl.github.io/nypl-design-system/storybook-static/?path=/story/style-guide-colors--colors-utility
7
+ * https://nypl.github.io/nypl-design-system/storybook-static/?path=/story/documentation-style-guide-colors--colors-utility
8
+ * and in Figma:
9
+ * https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=14989%3A37
10
+ *
7
11
  * All Brand colors can be found in Storybook:
8
- * https://nypl.github.io/nypl-design-system/storybook-static/?path=/story/style-guide-colors--colors-brand
12
+ * https://nypl.github.io/nypl-design-system/storybook-static/?path=/story/documentation-style-guide-colors--colors-brand
13
+ * and in Figma:
14
+ * https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=15454%3A47007
9
15
  *
10
16
  * At the end of this file, there are objects that extend Chakra's default
11
17
  * color shade palette for individual colors. WE DO NOT RECOMMEND to use them
@@ -14,8 +20,9 @@ import { Colors } from "@chakra-ui/react";
14
20
  */
15
21
 
16
22
  // Reusable variables:
17
- const grayLight = "#E0E0E0";
18
- const grayxxlight = "#FAFAFA";
23
+ const grayLightCool = "#E0E0E0";
24
+ const grayxxLightCool = "#FAFAFA";
25
+ const grayMedium = "#BDBDBD";
19
26
  const brandPrimary = "#C60917";
20
27
  const brandSecondary = "#760000";
21
28
  const brandObj = {
@@ -32,10 +39,13 @@ const colors: Colors = {
32
39
  white: "#fff",
33
40
  /// State and link utilities
34
41
  disabled: {
35
- primary: grayLight,
36
- secondary: grayxxlight,
42
+ primary: grayLightCool,
43
+ secondary: grayxxLightCool,
44
+ },
45
+ error: {
46
+ primary: "#97272C",
47
+ secondary: "#6F0106",
37
48
  },
38
- error: "#97272C",
39
49
  focus: "#4181F1",
40
50
  link: {
41
51
  primary: "#0576D3",
@@ -58,12 +68,12 @@ const colors: Colors = {
58
68
  gray: {
59
69
  xdark: "#424242",
60
70
  dark: "#616161",
61
- medium: "#BDBDBD",
62
- light: grayLight,
63
- "warm-light": "#EFEDEB",
64
- xlight: "#F5F5F5",
65
- "warm-xlight": "#F8F8F7",
66
- xxlight: grayxxlight,
71
+ medium: grayMedium,
72
+ "light-cool": grayLightCool,
73
+ "light-warm": "#EFEDEB",
74
+ "x-light-cool": "#F5F5F5",
75
+ "x-light-warm": "#F8F8F7",
76
+ "xx-light-cool": grayxxLightCool,
67
77
  },
68
78
  },
69
79
 
@@ -92,6 +102,12 @@ const colors: Colors = {
92
102
  * the exceptions of some research libraries. */
93
103
  locations: brandObj,
94
104
 
105
+ /** Blogs is used for the Blogs section. */
106
+ blogs: {
107
+ primary: grayLightCool,
108
+ secondary: grayMedium,
109
+ },
110
+
95
111
  /** Research libraries with specific brand colors to adhere to. */
96
112
  "research-library": {
97
113
  lpa: "#005d53",
@@ -10,6 +10,9 @@ const global = {
10
10
  bg: "ui.white",
11
11
  color: "ui.black",
12
12
  fontFamily: "body",
13
+ fontSize: 0,
14
+ fontWeight: "300",
15
+ lineHeight: "1.5",
13
16
  },
14
17
  // styles for the `a` element
15
18
  a: {
@@ -0,0 +1,5 @@
1
+ const shadows = {
2
+ outline: "none",
3
+ };
4
+
5
+ export default shadows;
@@ -1,15 +1,31 @@
1
1
  import { extendTheme } from "@chakra-ui/react";
2
- import colors from "./foundations/colors";
2
+ /** Global theme styles */
3
3
  import global from "./foundations/global";
4
- import typography from "./foundations/typography";
5
- import { spacing } from "./foundations/spacing";
6
4
  import breakpoints from "./foundations/breakpoints";
5
+ import colors from "./foundations/colors";
6
+ import shadows from "./foundations/shadows";
7
+ import { spacing } from "./foundations/spacing";
8
+ import typography from "./foundations/typography";
9
+ /** Component styles */
10
+ import Accordion from "./components/accordion";
11
+ import Breadcrumb from "./components/breadcrumb";
7
12
  import Button from "./components/button";
8
13
  import Checkbox from "./components/checkbox";
9
- import Radio from "./components/radio";
14
+ import CustomCheckboxGroup from "./components/customCheckboxGroup";
10
15
  import CustomRadioGroup from "./components/customRadioGroup";
11
- import Tabs from "./components/tabs";
16
+ import CustomSelect from "./components/select";
12
17
  import Heading from "./components/heading";
18
+ import Hero from "./components/hero";
19
+ import Icon from "./components/icon";
20
+ import Label from "./components/label";
21
+ import Link from "./components/link";
22
+ import Radio from "./components/radio";
23
+ import SearchBar from "./components/searchBar";
24
+ import StatusBadge from "./components/statusBadge";
25
+ import Tabs from "./components/tabs";
26
+ import TemplateStyles from "./components/template";
27
+ import Text from "./components/text";
28
+ import TextInput from "./components/textInput";
13
29
 
14
30
  /**
15
31
  * See Chakra default theme for shape of theme object:
@@ -33,19 +49,33 @@ const theme = extendTheme({
33
49
  styles: { global },
34
50
  breakpoints,
35
51
  colors,
36
- ...typography,
52
+ shadows,
37
53
  space: spacing,
54
+ ...typography,
38
55
  /**
39
56
  * Chakra documentation on component styles:
40
57
  * https://chakra-ui.com/docs/theming/component-style
41
58
  */
42
59
  components: {
60
+ Accordion,
61
+ Breadcrumb,
43
62
  Button,
44
63
  Checkbox,
64
+ CustomCheckboxGroup,
65
+ CustomRadioGroup,
66
+ CustomSelect,
45
67
  Heading,
68
+ Hero,
69
+ Icon,
70
+ Label,
71
+ Link,
46
72
  Radio,
47
- CustomRadioGroup,
73
+ SearchBar,
74
+ StatusBadge,
48
75
  Tabs,
76
+ ...TemplateStyles,
77
+ Text,
78
+ TextInput,
49
79
  },
50
80
  // Chakra prefixes its own CSS variables with `--chakra` by default but this
51
81
  // can be updated to be anything we want. This can be "nypl" to have the
@@ -64,6 +64,7 @@ const categories = {
64
64
  "Header",
65
65
  "HorizontalRule",
66
66
  "Section",
67
+ "SimpleGrid",
67
68
  "Template",
68
69
  ],
69
70
  },
@@ -88,11 +89,16 @@ const categories = {
88
89
  },
89
90
  chakra: {
90
91
  title: "Chakra/Layout",
91
- components: ["Box", "Center, Circle, Square", "Stack, HStack, VStack"],
92
+ components: [
93
+ "Box",
94
+ "Grid",
95
+ "Center, Circle, Square",
96
+ "Stack, HStack, VStack",
97
+ ],
92
98
  },
93
99
  typography: {
94
100
  title: "Components/Typography & Styles",
95
- components: ["Heading", "List"],
101
+ components: ["Heading", "List", "Text"],
96
102
  },
97
103
  devguide: {
98
104
  title: "Documentation/Development Guide",
@@ -14,3 +14,16 @@ export const range = (start: number, stop: number, step = 1): number[] => {
14
14
  .fill(start)
15
15
  .map((x, y) => x + y * step);
16
16
  };
17
+
18
+ /**
19
+ * Map an enum value to a component's Chakra theme variant object. If a wrong
20
+ * value is passed (typically in non-Typescript scenarios), then the "fallback"
21
+ * value, if provided, will be used.
22
+ */
23
+ export const getVariant = (variant, collection, fallback = null) => {
24
+ const variantMap = {};
25
+ for (const type in collection) {
26
+ variantMap[collection[type]] = collection[type];
27
+ }
28
+ return variantMap[variant] || fallback;
29
+ };
@@ -1,6 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const AccordionAsFAQSet: any;
3
- export declare const AccordionScroll: {
4
- (_props: any): JSX.Element;
5
- storyName: string;
6
- };
@@ -1,8 +0,0 @@
1
- import StatusBadge from "./StatusBadge";
2
- declare const _default: {
3
- title: any;
4
- component: typeof StatusBadge;
5
- decorators: ((...args: any) => any)[];
6
- };
7
- export default _default;
8
- export declare const statusBadge: any;
@@ -1,25 +0,0 @@
1
- /// <reference types="react" />
2
- declare const _default: {
3
- title: any;
4
- };
5
- export default _default;
6
- export declare const colorsBrand: {
7
- (): JSX.Element;
8
- storyName: string;
9
- parameters: {
10
- design: {
11
- type: string;
12
- url: string;
13
- };
14
- };
15
- };
16
- export declare const colorsUtility: {
17
- (): JSX.Element;
18
- storyName: string;
19
- parameters: {
20
- design: {
21
- type: string;
22
- url: string;
23
- };
24
- };
25
- };
@@ -1,30 +0,0 @@
1
- /// <reference types="react" />
2
- import { Meta } from "@storybook/react/types-6-0";
3
- declare const _default: Meta<import("@storybook/react/types-6-0").Args>;
4
- export default _default;
5
- export declare const Template: {
6
- ({ showSidebar, sidebarSide }: {
7
- showSidebar: any;
8
- sidebarSide: any;
9
- }): JSX.Element;
10
- args: {
11
- showSidebar: boolean;
12
- sidebarSide: string;
13
- };
14
- argTypes: {
15
- sidebarSide: {
16
- control: {
17
- type: string;
18
- options: string[];
19
- };
20
- };
21
- };
22
- storyName: string;
23
- parameters: {
24
- design: {
25
- type: string;
26
- url: string;
27
- };
28
- layout: string;
29
- };
30
- };
@@ -1,66 +0,0 @@
1
- import * as React from "react";
2
-
3
- import Accordion from "./Accordion";
4
- import List from "../List/List";
5
- import { ListTypes } from "../List/ListTypes";
6
- import Link from "../Link/Link";
7
- import { listRenderer as ListStory } from "../List/List.stories";
8
- import { range } from "../../utils/utils";
9
-
10
- // Set up the reusable template to create a list of Accordion components.
11
- const AccordionListTemplate = ({ count, children, ...args }) => (
12
- <List type={ListTypes.Unordered} modifiers={["no-list-styling"]}>
13
- {range(1, count + 1).map((i) => (
14
- <li key={i}>
15
- <Accordion {...args} inputId={`${args.inputId}-${i}`}>
16
- {children}
17
- </Accordion>
18
- </li>
19
- ))}
20
- </List>
21
- );
22
-
23
- const faqContent = (
24
- <>
25
- <p>
26
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
27
- tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit
28
- amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
29
- labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur
30
- adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
31
- magna aliqua.
32
- </p>
33
-
34
- <p>
35
- <Link href="#">Learn More</Link>
36
- </p>
37
- </>
38
- );
39
-
40
- // This is one specific story where it will render a list of FAQs.
41
- export const AccordionAsFAQSet = AccordionListTemplate.bind({});
42
- AccordionAsFAQSet.args = {
43
- accordionLabel: "FAQ Question Lorem Ipsum",
44
- modifiers: ["faq"],
45
- inputId: "accordionBtn",
46
- children: faqContent,
47
- count: 3,
48
- };
49
-
50
- // One accordion with scrollable list
51
- export const AccordionScroll = (_props) => (
52
- <>
53
- <div style={{ maxHeight: "300px", width: "500px" }}>
54
- <Accordion
55
- accordionLabel={"Content"}
56
- modifiers={["fixed-height"]}
57
- defaultOpen={true}
58
- >
59
- <ListStory type={ListTypes.Unordered} />
60
- </Accordion>
61
- </div>
62
- <div>Example content underneath</div>
63
- </>
64
- );
65
-
66
- AccordionScroll.storyName = "Accordion with Scrollable Content";
@@ -1,81 +0,0 @@
1
- .accordion {
2
- border: 1px solid var(--ui-gray-medium);
3
- color: inherit;
4
- width: 100%;
5
-
6
- &--fixed-height {
7
- display: flex;
8
- flex-direction: column;
9
- max-height: inherit;
10
- }
11
-
12
- &__content {
13
- display: none;
14
- padding: var(--space-xxs) var(--space-xxxl) var(--space-xs) var(--space-s);
15
- transition: all 0.35s;
16
- }
17
-
18
- &__label {
19
- @include button--outline;
20
-
21
- align-items: center;
22
- border: none;
23
- cursor: pointer;
24
- font-weight: 500;
25
- justify-content: space-between;
26
-
27
- .icon--minus {
28
- display: none;
29
- }
30
-
31
- &:focus {
32
- position: relative;
33
- }
34
-
35
- &:hover {
36
- background-color: var(--ui-gray-light);
37
- }
38
-
39
- &--faq {
40
- font-size: var(--font-size-1);
41
- padding: var(--space-s);
42
- }
43
- }
44
-
45
- &__input {
46
- opacity: 0;
47
- position: absolute;
48
- z-index: -1;
49
-
50
- &:focus {
51
- + .accordion__label {
52
- @include focus-outline;
53
- }
54
- }
55
-
56
- &:checked {
57
- + .accordion__label .icon--minus {
58
- display: inline;
59
- }
60
-
61
- + .accordion__label .icon--plus {
62
- display: none;
63
- }
64
-
65
- ~ .accordion__content {
66
- display: inline-block;
67
-
68
- &--fixed-height {
69
- // Adds margin so that content always appears outside the focus ring
70
- margin-top: var(--space-xxs);
71
- overflow-y: auto;
72
- }
73
- }
74
- }
75
- }
76
-
77
- // Eliminates the double border on accordion sets in ul-lis
78
- li:not(:first-of-type) & {
79
- margin-top: -1px;
80
- }
81
- }
@@ -1,97 +0,0 @@
1
- .breadcrumbs {
2
- background-color: var(--ui-black);
3
- padding-bottom: var(--space-xs);
4
- padding-top: var(--space-xs);
5
-
6
- &__item {
7
- @include space-inline-xxs;
8
-
9
- align-items: center;
10
- display: inline;
11
- font-size: var(--font-size--1);
12
- line-height: 1.5;
13
- position: relative;
14
- word-break: break-word;
15
-
16
- &:not(:last-child) {
17
- &::after {
18
- content: "/";
19
- padding-left: var(--space-xxs);
20
- }
21
-
22
- display: none;
23
-
24
- @include breakpoint($breakpoint-medium) {
25
- display: inline;
26
- }
27
- }
28
-
29
- &:last-child {
30
- display: block;
31
- padding-left: var(--space-m);
32
-
33
- @include breakpoint($breakpoint-medium) {
34
- display: inline;
35
- padding-left: 0;
36
- }
37
- }
38
- }
39
-
40
- &__icon {
41
- @include icon;
42
-
43
- left: 0;
44
- position: absolute;
45
- top: 50%;
46
- transform: rotate(90deg) translateX(-50%);
47
-
48
- @include breakpoint($breakpoint-medium) {
49
- display: none;
50
- }
51
- }
52
-
53
- &__link,
54
- &__link:link,
55
- &__link:visited,
56
- &__link:focus {
57
- color: var(--ui-white);
58
- text-decoration: none;
59
- }
60
-
61
- &__item a:hover {
62
- color: var(--ui-gray-light);
63
- text-decoration: underline;
64
- }
65
-
66
- &__list {
67
- @include list-reset;
68
- @include wrapper;
69
-
70
- color: var(--ui-white);
71
- }
72
-
73
- .nypl--books-and-more & {
74
- background-color: var(--section-books-and-more-secondary);
75
- }
76
-
77
- .nypl--locations & {
78
- background-color: var(--section-locations-secondary);
79
- }
80
-
81
- .nypl--research & {
82
- background-color: var(--section-research-secondary);
83
- }
84
-
85
- .nypl--whats-on & {
86
- background-color: var(--section-whats-on-secondary);
87
- }
88
- }
89
-
90
- .storybook-breadcrumbsExample {
91
- .breadcrumbs {
92
- flex: 1 1 50%;
93
- margin-left: unset;
94
- margin-right: var(--space-l);
95
- max-height: 42px;
96
- }
97
- }
@@ -1,67 +0,0 @@
1
- @mixin form-space-classes($map) {
2
- @each $name, $id in $map {
3
- &--spacing-#{$name} {
4
- .form-field {
5
- @include get-space-stack($id);
6
- }
7
-
8
- .form-row {
9
- @include get-space-stack($id);
10
-
11
- .form-field {
12
- @include breakpoint($breakpoint-medium) {
13
- &:not(:last-child) {
14
- @include get-space-inline($id);
15
- }
16
- }
17
- }
18
- }
19
- }
20
- }
21
- }
22
-
23
- $sizes: (
24
- "extra-extra-small": "xxs",
25
- "extra-small": "xs",
26
- "small": "s",
27
- "medium": "m",
28
- "large": "l",
29
- "extra-large": "xl",
30
- );
31
-
32
- .form {
33
- > .form-field {
34
- &:not(:last-child) {
35
- @include space-stack-l;
36
- }
37
- }
38
-
39
- > .form-row {
40
- &:not(:last-child) {
41
- @include space-stack-l;
42
- }
43
-
44
- display: block;
45
-
46
- @include breakpoint($breakpoint-medium) {
47
- display: flex;
48
- }
49
-
50
- .form-field {
51
- &:not(:last-child) {
52
- @include space-stack-l;
53
- }
54
-
55
- @include breakpoint($breakpoint-medium) {
56
- flex: 1 0;
57
-
58
- &:not(:last-child) {
59
- @include space-inline-l;
60
- @include space-stack-none;
61
- }
62
- }
63
- }
64
- }
65
-
66
- @include form-space-classes($sizes);
67
- }