@nypl/design-system-react-components 2.1.1 → 2.1.3
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.
- package/dist/design-system-react-components.cjs +62 -62
- package/dist/design-system-react-components.js +10020 -9803
- package/dist/src/components/AlphabetFilter/AlphabetFilter.d.ts +4 -2
- package/dist/src/components/AudioPlayer/AudioPlayer.d.ts +4 -2
- package/dist/src/components/ComponentWrapper/ComponentWrapper.d.ts +4 -2
- package/dist/src/components/Hero/Hero.d.ts +4 -0
- package/dist/src/components/Image/Image.d.ts +3 -0
- package/dist/src/components/Link/Link.d.ts +2 -0
- package/dist/src/components/List/List.d.ts +4 -3
- package/dist/src/components/Logo/Logo.d.ts +3 -0
- package/dist/src/components/NewsletterSignup/NewsletterSignup.d.ts +4 -2
- package/dist/src/components/Notification/Notification.d.ts +6 -3
- package/dist/src/components/SearchBar/SearchBar.d.ts +4 -2
- package/dist/src/components/StructuredContent/StructuredContent.d.ts +5 -3
- package/dist/src/components/TextInput/TextInput.d.ts +4 -0
- package/dist/src/components/VideoPlayer/VideoPlayer.d.ts +4 -2
- package/dist/src/helpers/types.d.ts +3 -1
- package/dist/src/hooks/useDSHeading.d.ts +16 -0
- package/dist/src/hooks/useStateWithDependencies.d.ts +4 -2
- package/dist/src/theme/components/card.d.ts +0 -24
- package/dist/src/theme/components/featuredContent.d.ts +27 -10
- package/dist/src/theme/components/heading.d.ts +0 -6
- package/dist/src/theme/components/hero.d.ts +1 -8
- package/dist/src/theme/components/image.d.ts +2008 -201
- package/dist/src/theme/components/link.d.ts +58 -48
- package/dist/src/theme/components/list.d.ts +10 -0
- package/dist/src/theme/components/logo.d.ts +35 -383
- package/dist/src/theme/components/searchBar.d.ts +3 -0
- package/dist/src/theme/components/structuredContent.d.ts +0 -6
- package/dist/src/utils/getSectionColors.d.ts +13 -0
- package/dist/styles.css +1 -1
- package/package.json +3 -3
- package/dist/src/helpers/getSectionColors.d.ts +0 -8
|
@@ -10,8 +10,10 @@ export interface AlphabetFilterProps {
|
|
|
10
10
|
currentLetter?: string;
|
|
11
11
|
/** Value used to set the text for a `Text` component that will be displayed above the letter buttons. */
|
|
12
12
|
descriptionText?: string | JSX.Element;
|
|
13
|
-
/**
|
|
14
|
-
|
|
13
|
+
/** Optional string value used to set the text for a `Heading` component, or
|
|
14
|
+
* a DS Heading component that can be passed in.
|
|
15
|
+
*/
|
|
16
|
+
headingText?: string | JSX.Element;
|
|
15
17
|
/** ID that other components can cross reference for accessibility purposes. */
|
|
16
18
|
id?: string;
|
|
17
19
|
/** Adds the `disabled` prop to the AlphabetFilter when true. */
|
|
@@ -18,8 +18,10 @@ export interface AudioPlayerProps {
|
|
|
18
18
|
* or to another domain altogether.
|
|
19
19
|
* TODO: This prop won't be used until a future version.
|
|
20
20
|
*/
|
|
21
|
-
/** Optional string to set the text for a `Heading` component
|
|
22
|
-
|
|
21
|
+
/** Optional string value used to set the text for a `Heading` component, or
|
|
22
|
+
* a DS Heading component that can be passed in.
|
|
23
|
+
*/
|
|
24
|
+
headingText?: string | JSX.Element;
|
|
23
25
|
/** Optional string to set the text for a `HelperErrorText` component. */
|
|
24
26
|
helperText?: string;
|
|
25
27
|
/** ID that other components can cross reference for accessibility purposes. */
|
|
@@ -7,8 +7,10 @@ export interface ComponentWrapperProps {
|
|
|
7
7
|
className?: string;
|
|
8
8
|
/** Optional string to set the text for the component's description */
|
|
9
9
|
descriptionText?: string | JSX.Element;
|
|
10
|
-
/** Optional string to set the text for a `Heading` component
|
|
11
|
-
|
|
10
|
+
/** Optional string value used to set the text for a `Heading` component, or
|
|
11
|
+
* a DS Heading component that can be passed in.
|
|
12
|
+
*/
|
|
13
|
+
headingText?: string | JSX.Element;
|
|
12
14
|
/** Optional string to set the text for a `HelperErrorText` component */
|
|
13
15
|
helperText?: HelperErrorTextType;
|
|
14
16
|
/** Styles that target the helper text. */
|
|
@@ -36,6 +36,10 @@ export interface HeroProps {
|
|
|
36
36
|
* can only be used in conjunction with `backgroundImageSrc` for the "campaign"
|
|
37
37
|
* `Hero` type. Note: not all `Hero` variations utilize this prop. */
|
|
38
38
|
imageProps?: HeroImageProps;
|
|
39
|
+
/** Optional boolean used to toggle the treatment of the background image in
|
|
40
|
+
* the "campaign" variant. If true, the background image will be converted to
|
|
41
|
+
* black & white and darkened to 60% black. */
|
|
42
|
+
isDarkBackgroundImage?: boolean;
|
|
39
43
|
/** Optional details area that contains location data.
|
|
40
44
|
* Note: not all `Hero` variations utilize this prop. */
|
|
41
45
|
locationDetails?: JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { ImgHTMLAttributes } from "react";
|
|
2
|
+
import { DimensionTypes } from "../../helpers/types";
|
|
2
3
|
export declare const imageRatiosArray: readonly ["fourByThree", "oneByTwo", "original", "sixteenByNine", "square", "threeByFour", "threeByTwo", "twoByOne"];
|
|
3
4
|
export declare const imageSizesArray: readonly ["default", "xxxsmall", "xxsmall", "xsmall", "small", "medium", "large"];
|
|
4
5
|
export declare const imageTypesArray: readonly ["default", "circle"];
|
|
@@ -39,6 +40,8 @@ interface ImageWrapperProps {
|
|
|
39
40
|
aspectRatio?: ImageRatios;
|
|
40
41
|
/** Optional value to control the size of the image */
|
|
41
42
|
size?: ImageSizes;
|
|
43
|
+
/** Sets the image size based on the width or height. Width by default. */
|
|
44
|
+
sizeBasedOn?: DimensionTypes;
|
|
42
45
|
}
|
|
43
46
|
export interface ImageProps extends ImageWrapperProps, ImgHTMLAttributes<HTMLImageElement> {
|
|
44
47
|
/** Optionally pass in additional Chakra-based styles only for the figure. */
|
|
@@ -6,6 +6,8 @@ export interface LinkProps {
|
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
/** Additional class name to render in the `Link` component. */
|
|
8
8
|
className?: string;
|
|
9
|
+
/** Used to include or remove visited state styles. Default is true. */
|
|
10
|
+
hasVisitedState?: boolean;
|
|
9
11
|
/** The `href` attribute for the anchor element. */
|
|
10
12
|
href?: string;
|
|
11
13
|
/** ID used for accessibility purposes. */
|
|
@@ -21,9 +21,10 @@ export interface ListProps {
|
|
|
21
21
|
listItems?: (string | JSX.Element | DescriptionProps)[];
|
|
22
22
|
/** Remove list styling. */
|
|
23
23
|
noStyling?: boolean;
|
|
24
|
-
/**
|
|
25
|
-
*
|
|
26
|
-
|
|
24
|
+
/** Optional string value used to set the text for a `Heading` component, or
|
|
25
|
+
* a DS Heading component that can be passed in. This title only applies to
|
|
26
|
+
* to Description Lists and will render above the list. */
|
|
27
|
+
title?: string | JSX.Element;
|
|
27
28
|
/** The type of list: "ol", "ul", or "dl". "ul" by default. */
|
|
28
29
|
type: ListTypes;
|
|
29
30
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { DimensionTypes } from "../../helpers/types";
|
|
2
3
|
import { logoNamesArray, logoSizesArray } from "./logoVariables";
|
|
3
4
|
export type LogoNames = typeof logoNamesArray[number];
|
|
4
5
|
export type LogoSizes = typeof logoSizesArray[number];
|
|
@@ -14,6 +15,8 @@ export interface LogoProps {
|
|
|
14
15
|
name?: LogoNames;
|
|
15
16
|
/** Sets the logo size. */
|
|
16
17
|
size?: LogoSizes;
|
|
18
|
+
/** Sets the logo size based on the width or height. Width by default. */
|
|
19
|
+
sizeBasedOn?: DimensionTypes;
|
|
17
20
|
/** For accessibility purposes, the text passed in the `title` prop gets
|
|
18
21
|
* rendered in a `title` element in the SVG. This descriptive text is not
|
|
19
22
|
* visible but is needed for screenreaders to describe the graphic. */
|
|
@@ -30,8 +30,10 @@ interface NewsletterSignupProps {
|
|
|
30
30
|
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
31
31
|
/** Link to the relevant privacy policy page. */
|
|
32
32
|
privacyPolicyLink?: string;
|
|
33
|
-
/**
|
|
34
|
-
|
|
33
|
+
/** Optional string value used to set the text for a `Heading` component, or
|
|
34
|
+
* a DS Heading component that can be passed in.
|
|
35
|
+
*/
|
|
36
|
+
title?: JSX.Element | string;
|
|
35
37
|
/** The value of the email text input field. */
|
|
36
38
|
valueEmail?: string;
|
|
37
39
|
/** Used to specify what is displayed in the component form/feedback area. */
|
|
@@ -10,15 +10,18 @@ interface BaseProps {
|
|
|
10
10
|
id?: string;
|
|
11
11
|
/** Optional prop to control horizontal alignment of the `Notification` content */
|
|
12
12
|
isCentered?: boolean;
|
|
13
|
-
/**
|
|
14
|
-
|
|
13
|
+
/** Optional content to be rendered in a `NotificationHeading` component. A
|
|
14
|
+
* string value is used to set the text for a `Heading` component, or
|
|
15
|
+
* a DS Heading component that can be passed in.
|
|
16
|
+
*/
|
|
17
|
+
notificationHeading?: string | JSX.Element;
|
|
15
18
|
/** Optional prop to control the coloring of the `Notification` text and the
|
|
16
19
|
* visibility of an applicable icon. */
|
|
17
20
|
notificationType?: NotificationTypes;
|
|
18
21
|
/** Prop to display the `Notification` icon. Defaults to `true`. */
|
|
19
22
|
showIcon?: boolean;
|
|
20
23
|
}
|
|
21
|
-
type NotificationHeadingProps = Omit<BasePropsWithoutAlignText, "
|
|
24
|
+
type NotificationHeadingProps = Omit<BasePropsWithoutAlignText, "showIcon">;
|
|
22
25
|
type NotificationContentProps = Omit<BaseProps, "icon">;
|
|
23
26
|
type BasePropsWithoutAlignText = Omit<BaseProps, "alignText">;
|
|
24
27
|
export interface NotificationProps extends BasePropsWithoutAlignText {
|
|
@@ -19,8 +19,10 @@ export interface SearchBarProps {
|
|
|
19
19
|
className?: string;
|
|
20
20
|
/** Optional string for the SearchBar's description above the component. */
|
|
21
21
|
descriptionText?: string;
|
|
22
|
-
/** Optional string
|
|
23
|
-
|
|
22
|
+
/** Optional string value used to set the text for a `Heading` component, or
|
|
23
|
+
* a DS Heading component that can be passed in.
|
|
24
|
+
*/
|
|
25
|
+
headingText?: string | JSX.Element;
|
|
24
26
|
/** The text to display below the form in a `HelperErrorText` component. */
|
|
25
27
|
helperText?: HelperErrorTextType;
|
|
26
28
|
/** ID that other components can cross reference for accessibility purposes */
|
|
@@ -8,11 +8,13 @@ interface StructuredContentImageProps extends ComponentImageProps {
|
|
|
8
8
|
}
|
|
9
9
|
export interface StructuredContentProps {
|
|
10
10
|
/** Optional value to set the text for the callout heading text. */
|
|
11
|
-
calloutText?: string;
|
|
11
|
+
calloutText?: string | JSX.Element;
|
|
12
12
|
/** Additional class name for the `StructuredContent` component. */
|
|
13
13
|
className?: string;
|
|
14
|
-
/** Optional value to set the text for
|
|
15
|
-
|
|
14
|
+
/** Optional string value used to set the text for a `Heading` component, or
|
|
15
|
+
* a DS Heading component that can be passed in.
|
|
16
|
+
*/
|
|
17
|
+
headingText?: string | JSX.Element;
|
|
16
18
|
/** ID that other components can cross reference for accessibility purposes. */
|
|
17
19
|
id?: string;
|
|
18
20
|
/** Object used to create and render the `Image` component. */
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { HelperErrorTextType } from "../HelperErrorText/HelperErrorText";
|
|
3
|
+
export declare const autoCompleteValuesArray: readonly ["on", "off", "additional-name", "address-level1", "address-level2", "address-level3", "address-level4", "address-line1", "address-line2", "address-line3", "bday-day", "bday-month", "bday-year", "bday", "cc-additional-name", "cc-csc", "cc-exp-month", "cc-exp-year", "cc-exp", "cc-family-name", "cc-given-name", "cc-name", "cc-number", "cc-type", "country-name", "country", "current-password", "email", "family-name", "given-name", "honorific-prefix", "honorific-suffix", "impp", "language", "name", "new-password", "nickname", "organization-title", "organization", "photo", "postal-code", "sex", "street-address", "tel-area-code", "tel-country-code", "tel-extension", "tel-local-prefix", "tel-local-suffix", "tel-local", "tel-national", "tel", "transaction-amount", "transaction-currency", "url", "username"];
|
|
4
|
+
export type AutoCompleteValues = typeof autoCompleteValuesArray[number];
|
|
3
5
|
export declare const textInputTypesArray: readonly ["email", "hidden", "number", "password", "text", "textarea", "tel", "url"];
|
|
4
6
|
export type TextInputTypes = typeof textInputTypesArray[number];
|
|
5
7
|
export declare const TextInputFormats: {
|
|
@@ -18,6 +20,8 @@ export interface InputProps {
|
|
|
18
20
|
/** FOR INTERNAL DS USE ONLY: additional helper text id(s) to be used for the input's `aria-describedby` value.
|
|
19
21
|
* If more than one, separate each with a space */
|
|
20
22
|
additionalHelperTextIds?: string;
|
|
23
|
+
/** String value used to set the autocomplete attribute. */
|
|
24
|
+
autoComplete?: AutoCompleteValues;
|
|
21
25
|
/** A class name for the TextInput parent div. */
|
|
22
26
|
className?: string;
|
|
23
27
|
/** The starting value of the input field. */
|
|
@@ -16,8 +16,10 @@ export interface VideoPlayerProps {
|
|
|
16
16
|
* `videoPlayer` component will accept the `embedCode` prop or the `videoId`
|
|
17
17
|
* and `videoType` props */
|
|
18
18
|
embedCode?: string;
|
|
19
|
-
/** Optional string to set the text for a `Heading` component
|
|
20
|
-
|
|
19
|
+
/** Optional string value used to set the text for a `Heading` component, or
|
|
20
|
+
* a DS Heading component that can be passed in.
|
|
21
|
+
*/
|
|
22
|
+
headingText?: string | JSX.Element;
|
|
21
23
|
/** Optional string to set the text for a `HelperErrorText` component */
|
|
22
24
|
helperText?: HelperErrorTextType;
|
|
23
25
|
/** ID that other components can cross reference for accessibility purposes */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const layoutTypesArray: readonly ["column", "row"];
|
|
2
2
|
export type LayoutTypes = typeof layoutTypesArray[number];
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const sectionColorsDataMap: {
|
|
4
4
|
blogs: {
|
|
5
5
|
primary: string;
|
|
6
6
|
secondary: string;
|
|
@@ -48,3 +48,5 @@ export declare const sectionDataMap: {
|
|
|
48
48
|
};
|
|
49
49
|
export declare const sectionTypeArray: string[];
|
|
50
50
|
export type SectionTypes = typeof sectionTypeArray[number];
|
|
51
|
+
export declare const dimensionTypeArray: readonly ["height", "width"];
|
|
52
|
+
export type DimensionTypes = typeof dimensionTypeArray[number];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface UseDSHeadingProps {
|
|
3
|
+
title: string | JSX.Element;
|
|
4
|
+
id?: string;
|
|
5
|
+
customDefaultHeading?: string | JSX.Element;
|
|
6
|
+
additionalStyles?: {
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* DS internal helper hook to render a default `h2` heading element if the
|
|
12
|
+
* passed title is a string. Otherwise, it will return the title as is if it
|
|
13
|
+
* is a JSX element.
|
|
14
|
+
*/
|
|
15
|
+
declare function useDSHeading({ title, id, customDefaultHeading, additionalStyles, }: UseDSHeadingProps): string | JSX.Element;
|
|
16
|
+
export default useDSHeading;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* DS internal helper hook to use state with prop dependencies.
|
|
3
3
|
*
|
|
4
|
-
* This hook should NOT be used by consuming apps. DS components should use
|
|
5
|
-
*
|
|
4
|
+
* This hook should NOT be used by consuming apps. DS components should use
|
|
5
|
+
* this hook rather than useState() whenever a change in state is expected
|
|
6
|
+
* for a given prop from a consuming app. The hook updates the DS component
|
|
7
|
+
* with useEffect().
|
|
6
8
|
*/
|
|
7
9
|
declare function useStateWithDependencies(initialValue: any): typeof initialValue;
|
|
8
10
|
export default useStateWithDependencies;
|
|
@@ -120,12 +120,6 @@ declare const _default: {
|
|
|
120
120
|
color: string;
|
|
121
121
|
};
|
|
122
122
|
};
|
|
123
|
-
_visited: {
|
|
124
|
-
color: string;
|
|
125
|
-
_dark: {
|
|
126
|
-
color: string;
|
|
127
|
-
};
|
|
128
|
-
};
|
|
129
123
|
};
|
|
130
124
|
};
|
|
131
125
|
} | {
|
|
@@ -194,12 +188,6 @@ declare const _default: {
|
|
|
194
188
|
color: string;
|
|
195
189
|
};
|
|
196
190
|
};
|
|
197
|
-
_visited: {
|
|
198
|
-
color: string;
|
|
199
|
-
_dark: {
|
|
200
|
-
color: string;
|
|
201
|
-
};
|
|
202
|
-
};
|
|
203
191
|
};
|
|
204
192
|
};
|
|
205
193
|
} | {
|
|
@@ -269,12 +257,6 @@ declare const _default: {
|
|
|
269
257
|
color: string;
|
|
270
258
|
};
|
|
271
259
|
};
|
|
272
|
-
_visited: {
|
|
273
|
-
color: string;
|
|
274
|
-
_dark: {
|
|
275
|
-
color: string;
|
|
276
|
-
};
|
|
277
|
-
};
|
|
278
260
|
};
|
|
279
261
|
};
|
|
280
262
|
} | {
|
|
@@ -341,12 +323,6 @@ declare const _default: {
|
|
|
341
323
|
color: string;
|
|
342
324
|
};
|
|
343
325
|
};
|
|
344
|
-
_visited: {
|
|
345
|
-
color: string;
|
|
346
|
-
_dark: {
|
|
347
|
-
color: string;
|
|
348
|
-
};
|
|
349
|
-
};
|
|
350
326
|
};
|
|
351
327
|
};
|
|
352
328
|
};
|
|
@@ -6,24 +6,32 @@ interface FeaturedContentBaseStyleProps {
|
|
|
6
6
|
declare const FeaturedContent: {
|
|
7
7
|
baseStyle: ({ imagePosition, imageWidth, isFullWidth, }: FeaturedContentBaseStyleProps) => {
|
|
8
8
|
bgColor: string;
|
|
9
|
-
_dark: {
|
|
10
|
-
bgColor: string;
|
|
11
|
-
};
|
|
12
|
-
width: string;
|
|
13
9
|
left: string;
|
|
14
|
-
right: string;
|
|
15
|
-
position: string;
|
|
16
10
|
marginLeft: string;
|
|
17
11
|
marginRight: string;
|
|
12
|
+
position: string;
|
|
13
|
+
right: string;
|
|
14
|
+
width: string;
|
|
15
|
+
_dark: {
|
|
16
|
+
bgColor: string;
|
|
17
|
+
};
|
|
18
18
|
wrapper: {
|
|
19
|
-
minHeight: string;
|
|
20
|
-
maxWidth: string;
|
|
21
|
-
display: string;
|
|
22
19
|
alignItems: string;
|
|
20
|
+
display: string;
|
|
23
21
|
flexDirection: {
|
|
24
22
|
sm: string;
|
|
25
23
|
md: string;
|
|
26
24
|
};
|
|
25
|
+
maxWidth: string;
|
|
26
|
+
minHeight: string;
|
|
27
|
+
paddingLeft: {
|
|
28
|
+
base: any;
|
|
29
|
+
md: string;
|
|
30
|
+
};
|
|
31
|
+
paddingRight: {
|
|
32
|
+
base: any;
|
|
33
|
+
md: string;
|
|
34
|
+
};
|
|
27
35
|
marginY: string;
|
|
28
36
|
marginX: string;
|
|
29
37
|
padding: string;
|
|
@@ -31,10 +39,19 @@ declare const FeaturedContent: {
|
|
|
31
39
|
};
|
|
32
40
|
text: {
|
|
33
41
|
display: string;
|
|
34
|
-
padding: string;
|
|
35
42
|
flex: number;
|
|
36
43
|
flexDirection: string;
|
|
37
44
|
justifyContent: string;
|
|
45
|
+
padding: string;
|
|
46
|
+
/** The `paddingLeft` attribute is used to adjust the spacing around the
|
|
47
|
+
* text when the image is positioned at the end. For aesthetic reasons,
|
|
48
|
+
* we opted to not adjust the spacing around the text when the image is
|
|
49
|
+
* positioned at the start.
|
|
50
|
+
* */
|
|
51
|
+
paddingStart: {
|
|
52
|
+
base: any;
|
|
53
|
+
md: number;
|
|
54
|
+
};
|
|
38
55
|
};
|
|
39
56
|
imgWrapper: {
|
|
40
57
|
backgroundPosition: string;
|
|
@@ -503,13 +503,8 @@ declare const Hero: {
|
|
|
503
503
|
};
|
|
504
504
|
campaign: {
|
|
505
505
|
alignItems: string;
|
|
506
|
-
backgroundSize: string;
|
|
507
|
-
backgroundPosition: string;
|
|
508
506
|
display: string;
|
|
509
507
|
justifyContent: string;
|
|
510
|
-
marginBottom: string[];
|
|
511
|
-
minHeight: string;
|
|
512
|
-
overflow: string;
|
|
513
508
|
padding: {
|
|
514
509
|
base: string;
|
|
515
510
|
md: string;
|
|
@@ -534,9 +529,7 @@ declare const Hero: {
|
|
|
534
529
|
position: {
|
|
535
530
|
md: string;
|
|
536
531
|
};
|
|
537
|
-
|
|
538
|
-
md: string;
|
|
539
|
-
};
|
|
532
|
+
zIndex: number;
|
|
540
533
|
_dark: {
|
|
541
534
|
color: string;
|
|
542
535
|
};
|