@nypl/design-system-react-components 3.1.0 → 3.1.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.
@@ -4,7 +4,7 @@ import { ComponentImageProps } from "../Image/Image";
4
4
  export declare const heroTypesArray: readonly ["primary", "secondary", "secondaryBooksAndMore", "secondaryLocations", "secondaryResearch", "secondaryWhatsOn", "tertiary", "campaign", "fiftyFifty"];
5
5
  export type HeroTypes = typeof heroTypesArray[number];
6
6
  export declare const heroSecondaryTypes: string[];
7
- export interface HeroImageProps extends Pick<ComponentImageProps, "alt" | "src"> {
7
+ export interface HeroImageProps extends Pick<ComponentImageProps, "alt" | "fallbackSrc" | "src" | "onError"> {
8
8
  }
9
9
  export interface HeroProps {
10
10
  /**
@@ -30,13 +30,16 @@ export interface HeroProps {
30
30
  /** Used to control how the `Hero` component will be rendered. */
31
31
  heroType?: HeroTypes;
32
32
  /** Object used to create and render the `Image` component. Note that only
33
- * `src` and `alt` are the available attributes to pass. If `imageProps.alt`
34
- * is left blank, a warning will be logged to the console and will cause
35
- * accessibility issues. For `imageProps.src`, it will only work for the
36
- * "secondary", "fiftyFifty" and "campaign" `Hero` types; Note: `imageProps.src`
33
+ * `alt`, `component`, and `src` are the available attributes to pass. If
34
+ * `imageProps.alt` is left blank, a warning will be logged to the console and
35
+ * will cause accessibility issues. For `imageProps.src`, it will only work for
36
+ * the "secondary", "fiftyFifty" and "campaign" `Hero` types; Note: `imageProps.src`
37
37
  * can only be used in conjunction with `backgroundImageSrc` for the "campaign"
38
38
  * `Hero` type. Note: not all `Hero` variations utilize this prop. */
39
39
  imageProps?: HeroImageProps;
40
+ /** Optional boolean used to toggle the default text color from light to dark.
41
+ * Set isDarkText to `true` if the backgroundColor is set to a light color. */
42
+ isDarkText?: boolean;
40
43
  /** Optional boolean used to toggle the treatment of the background image in
41
44
  * the "campaign" variant. If true, the background image will be converted to
42
45
  * black & white and darkened to 60% black. */
@@ -20,8 +20,12 @@ export interface ComponentImageProps extends Partial<HTMLImageElement> {
20
20
  component?: JSX.Element;
21
21
  /** Optional value to render as a credit for the internal `Image` component. */
22
22
  credit?: string;
23
+ /** Fallback image path or URL. */
24
+ fallbackSrc?: string;
23
25
  /** Flag to set the internal `Image` component to `isLazy` mode. */
24
26
  isLazy?: boolean;
27
+ /** Additional action to perform in the `img`'s `onerror` attribute function. */
28
+ onError?: (event: React.SyntheticEvent<HTMLImageElement>) => void;
25
29
  /** Optional value to control the size of the internal `Image` component.
26
30
  * Defaults to `ImageSizes.Default`. */
27
31
  size?: ImageSizes;
@@ -64,10 +68,14 @@ export interface ImageProps extends ImageWrapperProps, ImgHTMLAttributes<HTMLIma
64
68
  component?: JSX.Element | null;
65
69
  /** Adding will wrap the image in a <figure> */
66
70
  credit?: string;
71
+ /** Fallback image path or URL. */
72
+ fallbackSrc?: string;
67
73
  /** Optional value for the image type */
68
74
  imageType?: ImageTypes;
69
75
  /** Flag to set the internal `Image` component to `isLazy` mode. */
70
76
  isLazy?: boolean;
77
+ /** Additional action to perform in the `img`'s `onerror` attribute function. */
78
+ onError?: (event: React.SyntheticEvent<HTMLImageElement>) => void;
71
79
  /** The src attribute is required, and contains the path to the image you want to embed. */
72
80
  src?: string;
73
81
  }
@@ -189,6 +189,7 @@ export declare const cssVars: {
189
189
  dataBgDefaultColor?: undefined;
190
190
  dataBrandPrimaryColor?: undefined;
191
191
  dataBrandSecondaryColor?: undefined;
192
+ notes?: undefined;
192
193
  } | {
193
194
  colorSource: string;
194
195
  name: string;
@@ -199,6 +200,7 @@ export declare const cssVars: {
199
200
  textColor: string;
200
201
  dataBrandPrimaryColor?: undefined;
201
202
  dataBrandSecondaryColor?: undefined;
203
+ notes?: undefined;
202
204
  } | {
203
205
  name: string;
204
206
  dataBlackColor: any[];
@@ -209,6 +211,7 @@ export declare const cssVars: {
209
211
  colorSource?: undefined;
210
212
  dataBrandPrimaryColor?: undefined;
211
213
  dataBrandSecondaryColor?: undefined;
214
+ notes?: undefined;
212
215
  } | {
213
216
  colorSource: string;
214
217
  name: string;
@@ -219,6 +222,18 @@ export declare const cssVars: {
219
222
  dataBgPageColor: string[];
220
223
  dataBgDefaultColor: any[];
221
224
  textColor: string;
225
+ notes?: undefined;
226
+ } | {
227
+ name: string;
228
+ dataBlackColor: any[];
229
+ dataWhiteColor: any[];
230
+ dataBgPageColor: any[];
231
+ dataBgDefaultColor: any[];
232
+ notes: string;
233
+ textColor: string;
234
+ colorSource?: undefined;
235
+ dataBrandPrimaryColor?: undefined;
236
+ dataBrandSecondaryColor?: undefined;
222
237
  })[];
223
238
  grayscaleRoot: {
224
239
  name: string;
@@ -343,6 +358,8 @@ export interface ColorCardProps extends DataTableProps {
343
358
  colorName: string;
344
359
  /** The name of the color that the current color is based on. */
345
360
  colorSource: string;
361
+ /** Details on how a color should be used. */
362
+ notes?: string;
346
363
  }
347
364
  export declare const DataTable: (props: PropsWithChildren<DataTableProps>) => import("react/jsx-runtime").JSX.Element;
348
365
  export declare const ColorCard: (props: PropsWithChildren<ColorCardProps>) => import("react/jsx-runtime").JSX.Element;
@@ -42,8 +42,8 @@ declare const Breadcrumb: {
42
42
  };
43
43
  "li:last-child": {
44
44
  fontWeight: {
45
- base: "breadcrumbs.default";
46
- md: "breadcrumbs.lastChild";
45
+ base: string;
46
+ md: string;
47
47
  };
48
48
  ".chakra-breadcrumb__link": {
49
49
  _hover: {
@@ -139,22 +139,22 @@ declare const _default: {
139
139
  marginBottom: string;
140
140
  a: {
141
141
  textDecoration: string;
142
- color: string;
143
- textDecorationStyle: string;
144
- textDecorationThickness: string;
145
- textUnderlineOffset: string;
146
142
  _dark: {
147
143
  color: string;
148
144
  };
149
145
  _hover: {
150
- color: string;
151
- textDecoration: string;
152
- textDecorationStyle: string;
153
- textDecorationThickness: string;
154
146
  _dark: {
155
147
  color: string;
156
148
  };
149
+ textDecoration: string;
150
+ textDecorationStyle: string;
151
+ textDecorationThickness: string;
152
+ color: string;
157
153
  };
154
+ textDecorationStyle: string;
155
+ textDecorationThickness: string;
156
+ color: string;
157
+ textUnderlineOffset: string;
158
158
  };
159
159
  };
160
160
  };
@@ -166,22 +166,22 @@ declare const Heading: {
166
166
  base: {
167
167
  a: {
168
168
  textDecoration: string;
169
- color: string;
170
- textDecorationStyle: string;
171
- textDecorationThickness: string;
172
- textUnderlineOffset: string;
173
169
  _dark: {
174
170
  color: string;
175
171
  };
176
172
  _hover: {
177
- color: string;
178
- textDecoration: string;
179
- textDecorationStyle: string;
180
- textDecorationThickness: string;
181
173
  _dark: {
182
174
  color: string;
183
175
  };
176
+ textDecoration: string;
177
+ textDecorationStyle: string;
178
+ textDecorationThickness: string;
179
+ color: string;
184
180
  };
181
+ textDecorationStyle: string;
182
+ textDecorationThickness: string;
183
+ color: string;
184
+ textUnderlineOffset: string;
185
185
  };
186
186
  color: string;
187
187
  margin: string;
@@ -1,12 +1,14 @@
1
+ export declare const getTextColor: (type: any, mode: any, foregroundColor: any, isDarkText: any) => any;
2
+ export declare const getLinkColor: (state: any, foregroundColor: any, isDarkText: any) => any;
1
3
  declare const Hero: {
2
4
  baseStyle?: {};
3
5
  sizes?: {
4
6
  [key: string]: import("@chakra-ui/styled-system").PartsStyleInterpolation<{
5
- keys: ("base" | "content" | "heading" | "imgWrapper" | "bodyText" | "interior")[];
7
+ keys: ("base" | "content" | "imgWrapper" | "bodyText" | "heading" | "interior")[];
6
8
  }>;
7
9
  };
8
10
  variants?: {
9
- primary: {
11
+ primary: ({ foregroundColor, isDarkText }: import("@chakra-ui/styled-system").StyleFunctionProps) => {
10
12
  base: {
11
13
  alignItems: string;
12
14
  backgroundSize: string;
@@ -18,10 +20,11 @@ declare const Hero: {
18
20
  };
19
21
  justifyContent: string;
20
22
  minHeight: string;
23
+ p: string;
21
24
  };
22
25
  content: {
23
26
  bg: string;
24
- color: string;
27
+ color: any;
25
28
  flex: {
26
29
  base: string;
27
30
  md: string;
@@ -40,13 +43,19 @@ declare const Hero: {
40
43
  bodyText: {
41
44
  marginBottom: string;
42
45
  };
46
+ ".chakra-heading": {
47
+ color: any;
48
+ };
43
49
  _dark: {
44
50
  bgColor: string;
45
- color: string;
51
+ color: any;
52
+ ".chakra-heading": {
53
+ color: any;
54
+ };
46
55
  };
47
56
  };
48
57
  heading: {
49
- color: string;
58
+ color: any;
50
59
  };
51
60
  };
52
61
  secondary: {
@@ -479,14 +488,14 @@ declare const Hero: {
479
488
  };
480
489
  };
481
490
  };
482
- tertiary: {
491
+ tertiary: ({ foregroundColor, isDarkText }: import("@chakra-ui/styled-system").StyleFunctionProps) => {
483
492
  base: {
484
493
  p: {
485
494
  marginBottom: "0";
486
495
  };
487
496
  };
488
497
  content: {
489
- color: string;
498
+ color: any;
490
499
  display: string;
491
500
  flexFlow: string;
492
501
  px: string;
@@ -494,6 +503,18 @@ declare const Hero: {
494
503
  base: "inset.default";
495
504
  xl: "inset.wide";
496
505
  };
506
+ a: {
507
+ color: any;
508
+ _hover: {
509
+ color: any;
510
+ };
511
+ _visited: {
512
+ color: any;
513
+ svg: {
514
+ fill: any;
515
+ };
516
+ };
517
+ };
497
518
  p: {
498
519
  marginBottom: "0";
499
520
  marginTop: {
@@ -501,9 +522,27 @@ declare const Hero: {
501
522
  xl: "xs";
502
523
  };
503
524
  };
525
+ ".chakra-heading": {
526
+ color: any;
527
+ };
504
528
  _dark: {
529
+ a: {
530
+ color: any;
531
+ _hover: {
532
+ color: any;
533
+ };
534
+ _visited: {
535
+ color: any;
536
+ svg: {
537
+ fill: any;
538
+ };
539
+ };
540
+ };
505
541
  p: {
506
- color: "dark.ui.typography.body";
542
+ color: any;
543
+ };
544
+ ".chakra-heading": {
545
+ color: any;
507
546
  };
508
547
  };
509
548
  marginY: string;
@@ -520,7 +559,7 @@ declare const Hero: {
520
559
  };
521
560
  };
522
561
  };
523
- campaign: {
562
+ campaign: ({ foregroundColor, isDarkText }: import("@chakra-ui/styled-system").StyleFunctionProps) => {
524
563
  base: {
525
564
  alignItems: string;
526
565
  display: string;
@@ -555,7 +594,7 @@ declare const Hero: {
555
594
  content: {
556
595
  alignItems: string;
557
596
  bg: string;
558
- color: string;
597
+ color: any;
559
598
  display: string;
560
599
  flexFlow: {
561
600
  base: "column nowrap";
@@ -572,8 +611,38 @@ declare const Hero: {
572
611
  md: "relative";
573
612
  };
574
613
  zIndex: number;
614
+ a: {
615
+ color: any;
616
+ _hover: {
617
+ color: any;
618
+ };
619
+ _visited: {
620
+ color: any;
621
+ svg: {
622
+ fill: any;
623
+ };
624
+ };
625
+ };
626
+ ".chakra-heading": {
627
+ color: any;
628
+ };
575
629
  _dark: {
576
- color: string;
630
+ color: any;
631
+ a: {
632
+ color: any;
633
+ _hover: {
634
+ color: any;
635
+ };
636
+ _visited: {
637
+ color: any;
638
+ svg: {
639
+ fill: any;
640
+ };
641
+ };
642
+ };
643
+ ".chakra-heading": {
644
+ color: any;
645
+ };
577
646
  };
578
647
  };
579
648
  heading: {
@@ -666,6 +735,6 @@ declare const Hero: {
666
735
  variant?: "primary" | "secondary" | "tertiary" | "secondaryBooksAndMore" | "secondaryLocations" | "secondaryResearch" | "secondaryWhatsOn" | "campaign" | "fiftyFifty";
667
736
  colorScheme?: string;
668
737
  };
669
- parts: ("base" | "content" | "heading" | "imgWrapper" | "bodyText" | "interior")[];
738
+ parts: ("base" | "content" | "imgWrapper" | "bodyText" | "heading" | "interior")[];
670
739
  };
671
740
  export default Hero;
@@ -3,24 +3,29 @@ interface CustomLinkStyleProps extends StyleFunctionProps {
3
3
  finalIsUnderlined: boolean;
4
4
  hasVisitedState: boolean;
5
5
  }
6
- export declare const baseLinkStyles: {
7
- color: string;
6
+ export declare const linkUnderlineStyles: {
8
7
  textDecoration: string;
9
8
  textDecorationStyle: string;
10
9
  textDecorationThickness: string;
11
- textUnderlineOffset: string;
10
+ };
11
+ export declare const baseLinkStyles: {
12
12
  _dark: {
13
13
  color: string;
14
14
  };
15
15
  _hover: {
16
- color: string;
17
- textDecoration: string;
18
- textDecorationStyle: string;
19
- textDecorationThickness: string;
20
16
  _dark: {
21
17
  color: string;
22
18
  };
19
+ textDecoration: string;
20
+ textDecorationStyle: string;
21
+ textDecorationThickness: string;
22
+ color: string;
23
23
  };
24
+ textDecoration: string;
25
+ textDecorationStyle: string;
26
+ textDecorationThickness: string;
27
+ color: string;
28
+ textUnderlineOffset: string;
24
29
  };
25
30
  declare const Link: {
26
31
  baseStyle?: ({ finalIsUnderlined, hasVisitedState }: CustomLinkStyleProps) => {
@@ -42,22 +47,22 @@ declare const Link: {
42
47
  color: string;
43
48
  };
44
49
  };
45
- color: string;
46
- textDecorationStyle: string;
47
- textDecorationThickness: string;
48
- textUnderlineOffset: string;
49
50
  _dark: {
50
51
  color: string;
51
52
  };
52
53
  _hover: {
53
- color: string;
54
- textDecoration: string;
55
- textDecorationStyle: string;
56
- textDecorationThickness: string;
57
54
  _dark: {
58
55
  color: string;
59
56
  };
57
+ textDecoration: string;
58
+ textDecorationStyle: string;
59
+ textDecorationThickness: string;
60
+ color: string;
60
61
  };
62
+ textDecorationStyle: string;
63
+ textDecorationThickness: string;
64
+ color: string;
65
+ textUnderlineOffset: string;
61
66
  };
62
67
  /** The element will handle descriptive text added to aid
63
68
  * screen readers. */
@@ -153,7 +153,7 @@ declare const List: {
153
153
  }>;
154
154
  };
155
155
  variants?: {
156
- ul: (props: import("@chakra-ui/styled-system").StyleFunctionProps) => {
156
+ ul: (props: StyleFunctionProps) => {
157
157
  base: {
158
158
  listStyle: string;
159
159
  li: {
@@ -201,23 +201,23 @@ declare const StructuredContent: {
201
201
  marginInlineStart: string;
202
202
  };
203
203
  a: {
204
- color: string;
205
- textDecoration: string;
206
- textDecorationStyle: string;
207
- textDecorationThickness: string;
208
- textUnderlineOffset: string;
209
204
  _dark: {
210
205
  color: string;
211
206
  };
212
207
  _hover: {
213
- color: string;
214
- textDecoration: string;
215
- textDecorationStyle: string;
216
- textDecorationThickness: string;
217
208
  _dark: {
218
209
  color: string;
219
210
  };
211
+ textDecoration: string;
212
+ textDecorationStyle: string;
213
+ textDecorationThickness: string;
214
+ color: string;
220
215
  };
216
+ textDecoration: string;
217
+ textDecorationStyle: string;
218
+ textDecorationThickness: string;
219
+ color: string;
220
+ textUnderlineOffset: string;
221
221
  };
222
222
  ul: {
223
223
  listStyle: string;
@@ -5,6 +5,7 @@ interface TagSetFilterProps extends StyleFunctionProps {
5
5
  declare const _default: {
6
6
  TagSet: {
7
7
  baseStyle?: {
8
+ alignItems: string;
8
9
  display: string;
9
10
  flexWrap: string;
10
11
  gap: string;
@@ -23,26 +24,6 @@ declare const _default: {
23
24
  };
24
25
  TagSetExplore: {
25
26
  baseStyle?: {
26
- display: string;
27
- alignItems: string;
28
- justifyContent: string;
29
- bg: string;
30
- border: string;
31
- borderColor: string;
32
- borderRadius: string;
33
- color: string;
34
- cursor: string;
35
- fontSize: string;
36
- height: {
37
- base: "32px";
38
- md: "22px";
39
- };
40
- minHeight: string;
41
- maxWidth: string;
42
- py: string;
43
- px: string;
44
- textDecoration: string;
45
- transition: string;
46
27
  _focusWithin: {
47
28
  boxShadow: string;
48
29
  outline: string;
@@ -103,6 +84,30 @@ declare const _default: {
103
84
  };
104
85
  };
105
86
  };
87
+ transitionDuration: string;
88
+ transitionTimingFunction: string;
89
+ textDecoration: string;
90
+ textDecorationStyle: string;
91
+ textDecorationThickness: string;
92
+ display: string;
93
+ alignItems: string;
94
+ justifyContent: string;
95
+ bg: string;
96
+ border: string;
97
+ borderColor: string;
98
+ borderRadius: string;
99
+ color: string;
100
+ cursor: string;
101
+ fontSize: string;
102
+ height: {
103
+ base: "32px";
104
+ md: "22px";
105
+ };
106
+ minHeight: string;
107
+ maxWidth: string;
108
+ py: string;
109
+ px: string;
110
+ textUnderlineOffset: string;
106
111
  };
107
112
  sizes?: {
108
113
  [key: string]: import("@chakra-ui/styled-system").SystemStyleInterpolation;
@@ -119,28 +124,6 @@ declare const _default: {
119
124
  TagSetFilter: {
120
125
  baseStyle?: ({ isDismissible }: TagSetFilterProps) => {
121
126
  base: {
122
- display: string;
123
- alignItems: string;
124
- justifyContent: string;
125
- bg: string;
126
- border: string;
127
- borderColor: string;
128
- borderRadius: string;
129
- color: string;
130
- cursor: string;
131
- height: {
132
- base: "32px";
133
- md: "22px";
134
- };
135
- minHeight: string;
136
- maxWidth: string;
137
- py: string;
138
- paddingLeft: string;
139
- paddingRight: string | {
140
- base: "8px";
141
- md: "6px";
142
- };
143
- fontSize: string;
144
127
  "> span": {
145
128
  display: string;
146
129
  overflow: string;
@@ -158,19 +141,32 @@ declare const _default: {
158
141
  _hover: {
159
142
  bg: string;
160
143
  borderColor: string;
144
+ color: string;
161
145
  };
162
146
  };
163
- };
164
- clearAll: {
147
+ transitionDuration: string;
148
+ transitionTimingFunction: string;
149
+ alignItems: string;
150
+ bg: string;
151
+ border: string;
152
+ borderColor: string;
153
+ borderRadius: string;
165
154
  color: string;
155
+ cursor: string;
156
+ display: string;
157
+ fontSize: string;
166
158
  height: {
167
159
  base: "32px";
168
160
  md: "22px";
169
161
  };
170
- fontSize: string;
162
+ justifyContent: string;
171
163
  minHeight: string;
172
- _dark: {
173
- color: string;
164
+ maxWidth: string;
165
+ py: string;
166
+ paddingLeft: string;
167
+ paddingRight: string | {
168
+ base: "8px";
169
+ md: "6px";
174
170
  };
175
171
  };
176
172
  };
@@ -40,4 +40,7 @@ export declare const contrastRatio: (hex1: string, hex2: string) => string;
40
40
  export declare const truncateText: (text: string, truncateTextLength?: number) => string;
41
41
  /** Prepare a string for use in an ID or class attribute */
42
42
  export declare const sanitizeStringForAttribute: (str: string) => string;
43
+ /** Provides a random image to use as a placeholder. */
44
+ export type GetPlaceholderImageProps = "smaller" | "default";
45
+ export declare const getPlaceholderImage: (size?: GetPlaceholderImageProps, index?: number) => string;
43
46
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nypl/design-system-react-components",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "description": "NYPL Reservoir Design System React Components",
5
5
  "repository": {
6
6
  "type": "git",
@@ -53,7 +53,7 @@
53
53
  "types-ramda": "0.29.4"
54
54
  },
55
55
  "dependencies": {
56
- "@chakra-ui/react": "2.8.1",
56
+ "@chakra-ui/react": "2.8.2",
57
57
  "@chakra-ui/system": "2.6.2",
58
58
  "@charlietango/use-native-lazy-loading": "1.10.0",
59
59
  "@emotion/react": "11.11.1",
@@ -68,7 +68,7 @@
68
68
  "vite-plugin-svgr": "2.4.0"
69
69
  },
70
70
  "peerDependencies": {
71
- "@chakra-ui/react": ">=2.8.1",
71
+ "@chakra-ui/react": ">=2.8.2",
72
72
  "@chakra-ui/system": ">=2.6.2",
73
73
  "@emotion/react": ">=11.11.1",
74
74
  "@emotion/styled": ">=11.11.0",
@@ -88,9 +88,10 @@
88
88
  "@storybook/addon-jest": "7.5.1",
89
89
  "@storybook/addon-links": "7.5.1",
90
90
  "@storybook/blocks": "7.5.1",
91
+ "@storybook/jest": "0.2.3",
91
92
  "@storybook/react": "7.5.1",
92
93
  "@storybook/react-vite": "7.5.1",
93
- "@storybook/testing-library": "0.2.2",
94
+ "@storybook/test": "7.6.12",
94
95
  "@svgr/webpack": "5.5.0",
95
96
  "@testing-library/dom": "9.2.0",
96
97
  "@testing-library/jest-dom": "5.14.1",