@nypl/design-system-react-components 3.1.1-modal-rc-2 → 3.1.2

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.
@@ -1,10 +1,10 @@
1
- import { ChakraComponent } from "@chakra-ui/react";
1
+ import { ChakraComponent, HeadingProps as ChakraHeadingProps } from "@chakra-ui/react";
2
2
  import React from "react";
3
3
  export declare const headingSizesArray: readonly ["display1", "heading1", "heading2", "heading3", "heading4", "heading5", "heading6", "primary", "secondary", "tertiary", "callout"];
4
4
  export declare const headingLevelsArray: readonly ["h1", "h2", "h3", "h4", "h5", "h6", "one", "two", "three", "four", "five", "six"];
5
5
  export type HeadingSizes = typeof headingSizesArray[number];
6
6
  export type HeadingLevels = typeof headingLevelsArray[number];
7
- export interface HeadingProps {
7
+ export interface HeadingProps extends ChakraHeadingProps {
8
8
  /** Optional className that appears in addition to `heading` */
9
9
  className?: string;
10
10
  /** Optional ID that other components can cross reference for accessibility
@@ -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" | "id" | "src" | "onError"> {
8
8
  }
9
9
  export interface HeroProps {
10
10
  /**
@@ -29,14 +29,19 @@ export interface HeroProps {
29
29
  heading?: JSX.Element;
30
30
  /** Used to control how the `Hero` component will be rendered. */
31
31
  heroType?: HeroTypes;
32
+ /** ID that other components can cross reference for accessibility purposes. */
33
+ id?: string;
32
34
  /** 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`
35
+ * `alt`, `component`, and `src` are the available attributes to pass. If
36
+ * `imageProps.alt` is left blank, a warning will be logged to the console and
37
+ * will cause accessibility issues. For `imageProps.src`, it will only work for
38
+ * the "secondary", "fiftyFifty" and "campaign" `Hero` types; Note: `imageProps.src`
37
39
  * can only be used in conjunction with `backgroundImageSrc` for the "campaign"
38
40
  * `Hero` type. Note: not all `Hero` variations utilize this prop. */
39
41
  imageProps?: HeroImageProps;
42
+ /** Optional boolean used to toggle the default text color from light to dark.
43
+ * Set isDarkText to `true` if the backgroundColor is set to a light color. */
44
+ isDarkText?: boolean;
40
45
  /** Optional boolean used to toggle the treatment of the background image in
41
46
  * the "campaign" variant. If true, the background image will be converted to
42
47
  * black & white and darkened to 60% black. */
@@ -7,6 +7,8 @@ export interface HorizontalRuleProps {
7
7
  align?: "left" | "right";
8
8
  /** ClassName you can add in addition to `horizontal-rule` */
9
9
  className?: string;
10
+ /** ID that other components can cross reference for accessibility purposes. */
11
+ id?: string;
10
12
  }
11
13
  export declare const HorizontalRule: ChakraComponent<React.ForwardRefExoticComponent<React.PropsWithChildren<HorizontalRuleProps> & React.RefAttributes<HTMLDivElement & HTMLHRElement>>, React.PropsWithChildren<HorizontalRuleProps>>;
12
14
  export default HorizontalRule;
@@ -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
  }
@@ -1,52 +1,29 @@
1
1
  import { ChakraComponent } from "@chakra-ui/react";
2
2
  import React from "react";
3
- export interface BaseProps {
3
+ export interface BaseModalProps {
4
4
  /** The content to display in the modal body. */
5
5
  bodyContent?: string | JSX.Element;
6
+ /** The label for the close button. */
7
+ closeButtonLabel?: string;
6
8
  /** The text to display in the modal heading, can be a string or JSX Element. */
7
9
  headingText?: string | JSX.Element;
8
10
  /** ID that other components can cross reference for accessibility purposes. */
9
11
  id?: string;
10
12
  /** Boolean to determine if the modal is open or closed. */
11
13
  isOpen?: boolean;
12
- }
13
- export interface ConfirmationModalProps {
14
- /** The label for the confirm button. */
15
- confirmButtonLabel?: string;
16
- onCancel: () => void;
17
- onConfirm: () => void;
18
- /** The `Modal` variant to render. */
19
- type: "confirmation";
20
- /** The label for the close button. This prop is used for the
21
- * "cancel" button in the confirmation variant. */
22
- closeButtonLabel?: string;
23
- onClose?: never;
24
- }
25
- export interface DefaultModalProps {
26
- /** The label for the close button. */
27
- closeButtonLabel?: string;
28
14
  onClose?: () => void;
29
- /** The `Modal` variant to render. */
30
- type: "default";
31
- /** The label for the confirm button. This prop is not used
32
- * in the default variant. */
33
- confirmButtonLabel?: never;
34
- onCancel?: never;
35
- onConfirm?: never;
36
15
  }
37
- export type ModalTypeProps = ConfirmationModalProps | DefaultModalProps;
38
- export type BaseModalProps = BaseProps & ModalTypeProps;
39
16
  export interface ModalProps {
40
17
  /** The text to display on the button that opens the modal. */
41
18
  buttonText?: string;
42
19
  /** ID that other components can cross reference for accessibility purposes */
43
20
  id?: string;
44
21
  /** Props to update the internal `Modal` component. This contains the
45
- * `bodyContent`, `headingText`, `isOpen`, and the modal type props. */
22
+ * `bodyContent`, `closeButtonLabel`, `headingText`, `isOpen`, and
23
+ * `onClose` props. */
46
24
  modalProps: BaseModalProps;
47
25
  }
48
- export declare function isDefaultType(type: BaseModalProps["type"]): type is "default";
49
- export declare const BaseModal: ChakraComponent<React.FunctionComponent<BaseModalProps>, BaseModalProps>;
26
+ export declare const BaseModal: ChakraComponent<React.ForwardRefExoticComponent<React.PropsWithChildren<BaseModalProps> & React.RefAttributes<HTMLButtonElement>>, React.PropsWithChildren<BaseModalProps>>;
50
27
  /**
51
28
  * The `ModalTrigger` component renders a button that you click to open the
52
29
  * internal `Modal` component. Note that props to update the internal `Modal`
@@ -12,6 +12,8 @@ export interface SkeletonLoaderProps {
12
12
  /** Optional numeric value to control the number of lines for heading
13
13
  * placeholder; default value is `1`. */
14
14
  headingSize?: number;
15
+ /** ID that other components can cross reference for accessibility purposes. */
16
+ id?: string;
15
17
  /** Optional value to control the aspect ratio of the image placeholder;
16
18
  * default value is `"square"`. */
17
19
  imageAspectRatio?: SkeletonLoaderImageRatios;
@@ -1,6 +1,8 @@
1
1
  import { ChakraComponent } from "@chakra-ui/react";
2
2
  import React from "react";
3
3
  export interface TemplateProps {
4
+ /** ID that other components can cross reference for accessibility purposes. */
5
+ id?: string;
4
6
  }
5
7
  export interface TemplateHeaderProps {
6
8
  /** Flag to render an HTML header element. True by default. */
@@ -41,6 +43,8 @@ export interface TemplateAppContainerProps extends TemplateFooterProps, Template
41
43
  footer?: React.ReactElement;
42
44
  /** DOM that will be rendered in the `TemplateHeader` component section. */
43
45
  header?: React.ReactElement;
46
+ /** ID that other components can cross reference for accessibility purposes. */
47
+ id?: string;
44
48
  /** Render the `SkipNavigation` component or not. False by default. */
45
49
  renderSkipNavigation?: boolean;
46
50
  }
@@ -5,6 +5,8 @@ export type TextSizes = typeof textSizesArray[number];
5
5
  export interface TextProps {
6
6
  /** Additional class name to render in the `Text` component. */
7
7
  className?: string;
8
+ /** ID that other components can cross reference for accessibility purposes. */
9
+ id?: string;
8
10
  /** Optional prop used to show bolded text */
9
11
  isBold?: boolean;
10
12
  /** Optional prop used to show itlicized text */
@@ -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: {
@@ -196,7 +196,7 @@ declare const Button: {
196
196
  };
197
197
  defaultProps?: {
198
198
  size?: string | number;
199
- variant?: "primary" | "secondary" | "callout" | "link" | "text" | "pill" | "iconOnly" | "noBrand";
199
+ variant?: "link" | "text" | "primary" | "secondary" | "callout" | "pill" | "iconOnly" | "noBrand";
200
200
  colorScheme?: string;
201
201
  };
202
202
  parts: ("base" | "screenreaderOnly")[];
@@ -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;
@@ -513,7 +513,7 @@ declare const Heading: {
513
513
  };
514
514
  defaultProps?: {
515
515
  size?: string | number;
516
- variant?: "display1" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "primary" | "secondary" | "tertiary" | "callout" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "one" | "two" | "three" | "four" | "five" | "six";
516
+ variant?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "display1" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "primary" | "secondary" | "tertiary" | "callout" | "one" | "two" | "three" | "four" | "five" | "six";
517
517
  colorScheme?: string;
518
518
  };
519
519
  parts: ("base" | "headingWrapper")[];
@@ -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: {
@@ -65,7 +65,7 @@ declare const SkeletonLoader: {
65
65
  };
66
66
  sizes?: {
67
67
  [key: string]: import("@chakra-ui/styled-system").PartsStyleInterpolation<{
68
- keys: ("base" | "button" | "section" | "content" | "container" | "image" | "heading" | "loader")[];
68
+ keys: ("base" | "button" | "section" | "image" | "content" | "container" | "heading" | "loader")[];
69
69
  }>;
70
70
  };
71
71
  variants?: {
@@ -113,6 +113,6 @@ declare const SkeletonLoader: {
113
113
  variant?: "row";
114
114
  colorScheme?: string;
115
115
  };
116
- parts: ("base" | "button" | "section" | "content" | "container" | "image" | "heading" | "loader")[];
116
+ parts: ("base" | "button" | "section" | "image" | "content" | "container" | "heading" | "loader")[];
117
117
  };
118
118
  export default SkeletonLoader;
@@ -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;