@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
@@ -1,4 +1,4 @@
1
- // style object for base or default style
1
+ // Style object for base or default style
2
2
  const baseStyle = {
3
3
  borderRadius: "2px",
4
4
  lineHeight: "1.5",
@@ -6,10 +6,14 @@ const baseStyle = {
6
6
  cursor: "pointer",
7
7
  color: "ui.white",
8
8
  justifyContent: "center",
9
- py: 2, // var(--space-xs)
10
- px: 4, // var(--space-s)
9
+ py: "xs",
10
+ px: "s",
11
11
  textDecoration: "none",
12
12
  wordWrap: "normal",
13
+ svg: {
14
+ fill: "currentColor",
15
+ marginTop: "xxs",
16
+ },
13
17
  _hover: {
14
18
  bg: "ui.link.secondary",
15
19
  },
@@ -17,89 +21,99 @@ const baseStyle = {
17
21
  color: "ui.white",
18
22
  },
19
23
  _disabled: {
20
- bg: "ui.gray.light",
24
+ bg: "ui.gray.light-cool",
21
25
  color: "ui.gray.dark",
22
26
  pointerEvents: "none",
23
27
  opacity: "1",
24
28
  },
25
29
  };
26
- // styles for different sizes ("sm", "md", "lg")
30
+ // Styles for different "lg" size
27
31
  const sizes = {
28
32
  lg: {
29
33
  width: "150px",
30
34
  },
31
35
  };
32
- // styles for different visual variants:
33
- // primary, secondary, link, pill, icon-only
34
- const variants = {
35
- primary: {
36
- bg: "ui.link.primary",
37
- minWidth: "none",
38
- height: "none",
36
+ // Styles for different visual variants:
37
+ // primary, secondary, link, pill, icon-only, callout
38
+ const primary = {
39
+ bg: "ui.link.primary",
40
+ minWidth: "none",
41
+ height: "none",
42
+ };
43
+ const secondary = {
44
+ bg: "ui.white",
45
+ border: "1px solid",
46
+ borderColor: "ui.gray.light-cool",
47
+ color: "inherit",
48
+ _hover: {
49
+ bg: "ui.gray.xx-light-cool",
39
50
  },
40
- secondary: {
41
- bg: "ui.white",
42
- border: "1px solid",
43
- borderColor: "ui.gray.light",
44
- color: "inherit",
45
- _hover: {
46
- bg: "ui.gray.xxlight",
47
- },
51
+ };
52
+ const link = {
53
+ bg: "transparent",
54
+ lineHeight: "2.5",
55
+ color: "ui.link.primary",
56
+ textDecoration: "underline",
57
+ _disabled: {
58
+ bg: "transparent",
48
59
  },
49
- link: {
60
+ _hover: {
50
61
  bg: "transparent",
51
- lineHeight: "2.5",
52
- color: "ui.link.primary",
53
- textDecoration: "underline",
54
- _disabled: {
55
- bg: "transparent",
56
- },
57
- _hover: {
58
- bg: "transparent",
59
- color: "ui.link.secondary",
60
- },
62
+ color: "ui.link.secondary",
63
+ },
64
+ };
65
+ const pill = {
66
+ bg: "ui.white",
67
+ border: "1px solid",
68
+ borderColor: "ui.gray.light-cool",
69
+ color: "inherit",
70
+ borderRadius: "20px",
71
+ py: "xs",
72
+ paddingInlineStart: "m",
73
+ paddingInlineEnd: "m",
74
+ _hover: {
75
+ bg: "ui.gray.xx-light-cool",
61
76
  },
62
- pill: {
63
- bg: "ui.white",
64
- border: "1px solid",
65
- borderColor: "ui.gray.light",
66
- color: "inherit",
67
- borderRadius: "20px",
68
- py: 2, // var(--space-xs)
69
- paddingInlineStart: 6, // var(--space-m)
70
- paddingInlineEnd: 6, // var(--space-m)
71
- _hover: {
72
- bg: "ui.gray.xxlight",
73
- },
77
+ };
78
+ const iconOnly = {
79
+ bg: "ui.white",
80
+ border: "1px solid",
81
+ borderColor: "ui.gray.light-cool",
82
+ color: "inherit",
83
+ _hover: {
84
+ bg: "ui.gray.xx-light-cool",
74
85
  },
75
- "icon-only": {
76
- bg: "ui.white",
77
- border: "1px solid",
78
- borderColor: "ui.gray.light",
79
- color: "inherit",
80
- _hover: {
81
- bg: "ui.gray.xxlight",
82
- },
83
- paddingInlineStart: 1, // var(--space-xs)
84
- paddingInlineEnd: 1, //var(--space-xs)
86
+ paddingInlineStart: "xs",
87
+ paddingInlineEnd: "xs",
88
+ };
89
+ const callout = {
90
+ bg: "brand.primary",
91
+ _hover: {
92
+ bg: "brand.secondary",
85
93
  },
86
- callout: {
87
- bg: "brand.primary",
88
- _hover: {
89
- bg: "brand.secondary",
90
- },
91
- _active: {
92
- bg: "brand.secondary",
93
- },
94
+ _active: {
95
+ bg: "brand.secondary",
94
96
  },
95
97
  };
98
+ const searchBar = {
99
+ ...primary,
100
+ borderLeftRadius: "0",
101
+ };
96
102
 
97
103
  const Button = {
98
104
  baseStyle,
99
105
  sizes,
100
106
  // Available variants:
101
- // primary, secondary, link, pill, icon-only
102
- variants,
107
+ // primary, secondary, link, pill, icon-only, searchBar
108
+ variants: {
109
+ primary,
110
+ secondary,
111
+ link,
112
+ pill,
113
+ ["icon-only"]: iconOnly,
114
+ callout,
115
+ searchBar,
116
+ },
103
117
  // Default values
104
118
  defaultProps: {
105
119
  size: "md",
@@ -1,5 +1,11 @@
1
1
  // @see https://github.com/chakra-ui/chakra-ui/blob/main/packages/theme/src/components/checkbox.ts
2
- // For avail theme override options.
2
+ // for available theme override options.
3
+
4
+ import {
5
+ checkboxRadioLabelStyles,
6
+ checkboxRadioControlSize,
7
+ checkboxRadioHelperStyle,
8
+ } from "./global";
3
9
 
4
10
  // Style object for the Checkbox's visual icon.
5
11
  const baseStyleIcon = {
@@ -52,40 +58,19 @@ const baseStyleControl = {
52
58
  },
53
59
 
54
60
  _invalid: {
55
- borderColor: "ui.error",
56
- color: "ui.error",
61
+ borderColor: "ui.error.primary",
62
+ color: "ui.error.primary",
57
63
  },
58
64
  };
59
65
 
60
66
  // Style object for the Checkbox's label
61
67
  const baseStyleLabel = {
62
- userSelect: "none",
63
- fontSize: 0,
64
- fontWeight: "light",
65
- marginBottom: 0,
66
- marginLeft: 2,
67
- verticalAlign: "middle",
68
-
69
- _disabled: {
70
- color: "ui.gray.dark",
71
- opacity: 1,
72
- fontStyle: "italic",
73
- },
74
-
75
- _invalid: {
76
- color: "ui.error",
77
- },
68
+ ...checkboxRadioLabelStyles,
78
69
  };
79
70
 
80
71
  // Style object for the Checkbox's helper text
81
72
  const baseStyleHelper = {
82
- marginTop: 2, // var(--space-xs)
83
- marginBottom: 0,
84
- marginLeft: "30px", // calc(22px + var(--space-xs))
85
-
86
- _disabled: {
87
- fontStyle: "italic",
88
- },
73
+ ...checkboxRadioHelperStyle,
89
74
  };
90
75
 
91
76
  const baseStyle = {
@@ -99,7 +84,10 @@ const baseStyle = {
99
84
  const sizes = {
100
85
  lg: {
101
86
  // Controls the width/height of the checkbox itself.
102
- control: { w: "1.375rem", h: "1.375rem", borderRadius: "3px" },
87
+ control: {
88
+ ...checkboxRadioControlSize,
89
+ borderRadius: "3px",
90
+ },
103
91
  // Controls the font-size of the label only.
104
92
  label: { fontSize: "md" },
105
93
  },
@@ -0,0 +1,12 @@
1
+ import { checkboxRadioGroupLayout } from "./global";
2
+
3
+ const CustomCheckboxGroup = {
4
+ parts: ["legend", "required", "helper"],
5
+ baseStyle: {
6
+ ...checkboxRadioGroupLayout,
7
+ },
8
+ sizes: {},
9
+ defaultProps: {},
10
+ };
11
+
12
+ export default CustomCheckboxGroup;
@@ -1,15 +1,9 @@
1
+ import { checkboxRadioGroupLayout } from "./global";
2
+
1
3
  const CustomRadioGroup = {
2
- parts: ["required", "helper"],
4
+ parts: ["legend", "required", "helper"],
3
5
  baseStyle: {
4
- legend: {
5
- marginBottom: 4,
6
- },
7
- required: {
8
- marginLeft: 6,
9
- },
10
- helper: {
11
- marginTop: 4,
12
- },
6
+ ...checkboxRadioGroupLayout,
13
7
  },
14
8
  sizes: {},
15
9
  defaultProps: {},
@@ -0,0 +1,71 @@
1
+ /** Export "mixin" styles. */
2
+ export { wrapperStyles } from "./globalMixins";
3
+
4
+ /** Reusable component styles. */
5
+
6
+ // Used in `Select` and `TextInput`.
7
+ const activeFocus = {
8
+ border: "1px solid",
9
+ borderColor: "ui.focus",
10
+ zIndex: "9999",
11
+ outline: "1px solid",
12
+ outlineColor: "ui.focus",
13
+ };
14
+ // Used in `Select` and `TextInput`.
15
+ const helperTextMargin = {
16
+ marginTop: "xs",
17
+ marginBottom: "0",
18
+ };
19
+ // Used in `Checkbox` and `Radio`.
20
+ const checkboxRadioLabelStyles = {
21
+ userSelect: "none",
22
+ fontSize: "0",
23
+ fontWeight: "light",
24
+ marginBottom: "0",
25
+ marginLeft: "xs",
26
+ verticalAlign: "middle",
27
+ _disabled: {
28
+ color: "ui.gray.dark",
29
+ opacity: 1,
30
+ fontStyle: "italic",
31
+ },
32
+ _invalid: {
33
+ color: "ui.error.primary",
34
+ },
35
+ };
36
+ // Custom values not in the spacing theme.
37
+ // Used in `Checkbox` and `Radio`.
38
+ const checkboxRadioControlSize = {
39
+ h: "1.375rem",
40
+ w: "1.375rem",
41
+ };
42
+ // Used in `CheckboxGroup` and `RadioGroup`.
43
+ const checkboxRadioGroupLayout = {
44
+ legend: {
45
+ fontSize: "14px",
46
+ marginBottom: "s",
47
+ },
48
+ required: {
49
+ marginLeft: "m",
50
+ },
51
+ helper: {
52
+ marginTop: "s",
53
+ },
54
+ };
55
+ // Used in `Checkbox` and `Radio`.
56
+ const checkboxRadioHelperStyle = {
57
+ ...helperTextMargin,
58
+ marginLeft: "30px", // calc(22px + var(--space-xs))
59
+ _disabled: {
60
+ fontStyle: "italic",
61
+ },
62
+ };
63
+
64
+ export {
65
+ activeFocus,
66
+ checkboxRadioLabelStyles,
67
+ checkboxRadioControlSize,
68
+ checkboxRadioGroupLayout,
69
+ checkboxRadioHelperStyle,
70
+ helperTextMargin,
71
+ };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * These objects are also SCSS mixins but are now JS objects in the
3
+ * context of css-in-js and the custom NYPL-theme.
4
+ */
5
+ const wrapperStyles = {
6
+ marginY: "0",
7
+ marginX: "auto",
8
+ maxWidth: "1280px",
9
+ paddingTop: "0",
10
+ paddingBottom: "0",
11
+ paddingRight: "0",
12
+ paddingLeft: "0",
13
+ width: "100%",
14
+ };
15
+
16
+ export { wrapperStyles };
@@ -1,3 +1,10 @@
1
+ const margins = {
2
+ marginTop: "0",
3
+ marginLeft: "0",
4
+ marginRight: "0",
5
+ marginBottom: "s",
6
+ };
7
+
1
8
  // Heading Styles
2
9
  const headings = {
3
10
  h1: {
@@ -5,41 +12,40 @@ const headings = {
5
12
  fontWeight: "light",
6
13
  letterSpacing: "0",
7
14
  lineHeight: "1.1",
8
- margin: "0 0 0.5em",
15
+ ...margins,
9
16
  width: "auto",
10
17
  },
11
18
  h2: {
12
19
  fontSize: "3", // var(--font-size-3);
13
20
  fontWeight: "medium",
14
21
  lineHeight: "1.25",
15
- margin: "0 0 0.5em",
22
+ ...margins,
16
23
  width: "auto",
17
24
  },
18
25
  h3: {
19
26
  fontSize: "2", // var(--font-size-2);
20
27
  fontWeight: "medium",
21
28
  lineHeight: "1.25",
22
- margin: "0 0 0.5em",
29
+ ...margins,
23
30
  width: "auto",
24
31
  },
25
32
  h4: {
26
33
  fontSize: "1", // var(--font-size-1);
27
34
  fontWeight: "medium",
28
35
  lineHeight: "1.15",
29
- margin: "0 0 0.5em",
36
+ ...margins,
30
37
  width: "auto",
31
38
  },
32
39
  fallback: {
33
40
  fontSize: "1", // var(--font-size-1);
34
41
  fontWeight: "regular",
35
42
  lineHeight: "1.15",
36
- margin: "0 0 0.5em",
43
+ ...margins,
37
44
  width: "auto",
38
45
  },
39
46
  };
40
47
 
41
- // styles for different visual variants:
42
- // primary, secondary, tertiary, callout
48
+ // Styles for different visual variants
43
49
  const variants = {
44
50
  h1: headings.h1,
45
51
  h2: headings.h2,
@@ -55,7 +61,8 @@ const variants = {
55
61
 
56
62
  const Heading = {
57
63
  // Available variants:
58
- // primary, secondary, tertiary, callout
64
+ // h1, h2, h3, h4, h5, h6,
65
+ // primary, secondary, tertiary, callout
59
66
  variants,
60
67
  defaultProps: {
61
68
  variant: "secondary",
@@ -0,0 +1,239 @@
1
+ import { wrapperStyles } from "./global";
2
+
3
+ // Used for all "secondary" variants.
4
+ const secondaryBase = {
5
+ overflowX: "hidden",
6
+ content: {
7
+ ...wrapperStyles,
8
+ paddingRight: "s",
9
+ paddingLeft: "s",
10
+ display: "flex",
11
+ flexFlow: {
12
+ base: "column nowrap",
13
+ md: "row wrap",
14
+ },
15
+ img: {
16
+ flex: {
17
+ base: "1 1 100%",
18
+ md: "0 0 250px",
19
+ },
20
+ order: { md: "3" },
21
+ height: "150px",
22
+ minWidth: "0", // https://github.com/philipwalton/flexbugs/issues/41
23
+ objectFit: "cover",
24
+ width: "100%",
25
+ },
26
+ },
27
+ bodyText: {
28
+ marginTop: "xs",
29
+ marginRight: { md: "xs" },
30
+ flex: { md: "1 1 50%" },
31
+ order: { md: "2" },
32
+ },
33
+ };
34
+ // Used for all "secondary" variants' heading component.
35
+ const secondaryHeadingBase = {
36
+ marginBottom: "0",
37
+ bg: "ui.black",
38
+ color: "ui.white",
39
+ flex: "1 1 100%",
40
+ marginTop: "0",
41
+ paddingBottom: "xxs",
42
+ position: "relative",
43
+ zIndex: "0",
44
+ order: { md: "1" },
45
+ _before: {
46
+ bg: "ui.black",
47
+ content: `""`,
48
+ height: "100%",
49
+ left: "-2000px",
50
+ position: "absolute",
51
+ width: "4000px",
52
+ zIndex: "-1",
53
+ },
54
+ };
55
+ // Get all the styles for the specific Secondary variant but
56
+ // update the background color.
57
+ const getSecondaryVariantStyles = (bgColor: string) => ({
58
+ ...secondaryBase,
59
+ heading: {
60
+ ...secondaryHeadingBase,
61
+ bg: bgColor,
62
+ _before: {
63
+ ...secondaryHeadingBase["_before"],
64
+ bg: bgColor,
65
+ },
66
+ },
67
+ });
68
+ // Variant styling
69
+ const primary = {
70
+ alignItems: "center",
71
+ display: "flex",
72
+ flexFlow: {
73
+ base: "column nowrap",
74
+ md: "row nowrap",
75
+ },
76
+ justifyContent: "center",
77
+ minHeight: "350px",
78
+ content: {
79
+ bg: "ui.black",
80
+ color: "ui.white",
81
+ flex: {
82
+ base: "0 0 100%",
83
+ md: "0 0 60%",
84
+ },
85
+ maxWidth: { md: "960px" },
86
+ paddingTop: "xxl",
87
+ paddingBottom: "xxl",
88
+ paddingRight: "l",
89
+ paddingLeft: "l",
90
+ a: {
91
+ color: "inherit",
92
+ display: "inline-block",
93
+ },
94
+ heading: {
95
+ marginBottom: "0",
96
+ },
97
+ bodyText: {
98
+ marginBottom: "0",
99
+ },
100
+ },
101
+ };
102
+ const secondary = {
103
+ ...secondaryBase,
104
+ heading: {
105
+ ...secondaryHeadingBase,
106
+ },
107
+ };
108
+ const secondaryBooksAndMore = getSecondaryVariantStyles(
109
+ "section.books-and-more.primary"
110
+ );
111
+ const secondaryLocations = getSecondaryVariantStyles(
112
+ "section.locations.primary"
113
+ );
114
+ const secondaryResearch = getSecondaryVariantStyles("section.research.primary");
115
+ const secondaryWhatsOn = getSecondaryVariantStyles("section.whats-on.primary");
116
+ const tertiary = {
117
+ bg: "ui.gray.xdark",
118
+ content: {
119
+ ...wrapperStyles,
120
+ color: "ui.white",
121
+ display: "flex",
122
+ flexFlow: "column nowrap",
123
+ paddingTop: "l",
124
+ paddingBottom: "l",
125
+ paddingRight: "s",
126
+ paddingLeft: "s",
127
+ p: {
128
+ marginBottom: "0",
129
+ },
130
+ },
131
+ heading: {
132
+ marginBottom: "s",
133
+ _lastChild: {
134
+ marginBottom: "0",
135
+ },
136
+ },
137
+ p: {
138
+ marginBottom: "0",
139
+ },
140
+ };
141
+ const campaign = {
142
+ alignItems: "center",
143
+ display: "flex",
144
+ justifyContent: "center",
145
+ marginBottom: "xxl",
146
+ minHeight: "300px",
147
+ overflow: "visible",
148
+ padding: {
149
+ base: "l",
150
+ md: "0",
151
+ },
152
+ position: "relative",
153
+ content: {
154
+ alignItems: "center",
155
+ bg: "ui.black",
156
+ color: "ui.white",
157
+ display: "flex",
158
+ flexFlow: {
159
+ base: "column nowrap",
160
+ md: "row nowrap",
161
+ },
162
+ minHeight: "320px",
163
+ flex: { md: "0 0 90%" },
164
+ maxWidth: { md: "1280px" },
165
+ position: { md: "relative" },
166
+ top: { md: "xxl" },
167
+ },
168
+ a: {
169
+ color: "inherit",
170
+ display: "inline-block",
171
+ },
172
+ img: {
173
+ flex: {
174
+ base: "1 1 100%",
175
+ md: "0 0 50%",
176
+ },
177
+ minWidth: "0", // https://github.com/philipwalton/flexbugs/issues/41
178
+ objectFit: "cover",
179
+ width: "100%",
180
+ height: { md: "320px" },
181
+ },
182
+ interior: {
183
+ flex: {
184
+ base: "0 0 100%",
185
+ md: "0 0 50%",
186
+ },
187
+ padding: "l",
188
+ maxWidth: { md: "960px" },
189
+ },
190
+ };
191
+ const fiftyfifty = {
192
+ content: {
193
+ ...wrapperStyles,
194
+ alignItems: "center",
195
+ display: "flex",
196
+ flexFlow: {
197
+ base: "column nowrap",
198
+ lg: "row nowrap",
199
+ },
200
+ paddingBottom: "s",
201
+ paddingRight: "s",
202
+ paddingLeft: "s",
203
+ padding: {
204
+ lg: "unset",
205
+ },
206
+ },
207
+ img: {
208
+ marginBottom: {
209
+ base: "s",
210
+ lg: "unset",
211
+ },
212
+ marginRight: {
213
+ lg: "s",
214
+ },
215
+ maxWidth: {
216
+ base: "fit-content",
217
+ lg: "50%",
218
+ },
219
+ },
220
+ };
221
+ const Hero = {
222
+ baseStyle: {
223
+ bg: "ui.gray.x-light-warm",
224
+ },
225
+ // Available variants:
226
+ variants: {
227
+ primary,
228
+ secondary,
229
+ secondaryBooksAndMore,
230
+ secondaryLocations,
231
+ secondaryResearch,
232
+ secondaryWhatsOn,
233
+ tertiary,
234
+ campaign,
235
+ fiftyfifty,
236
+ },
237
+ };
238
+
239
+ export default Hero;