@nypl/design-system-react-components 2.0.1 → 2.1.0-rc

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.
@@ -0,0 +1,29 @@
1
+ import React from "react";
2
+ import { ImageProps } from "../Image/Image";
3
+ export declare const featuredContentWidthArray: string[];
4
+ export type featuredContentWidthType = typeof featuredContentWidthArray[number];
5
+ export declare const featuredContentPositionArray: readonly ["start", "end"];
6
+ export type featuredContentPositionType = typeof featuredContentPositionArray[number];
7
+ interface FeaturedContentImageProps extends ImageProps {
8
+ /** String value that specifies the width of the image rendered within the component. */
9
+ width?: featuredContentWidthType;
10
+ /** String value that specifies the position of the image rendered within the component. */
11
+ position?: featuredContentPositionType;
12
+ }
13
+ export interface FeaturedContentProps {
14
+ /** Optional CSS class name to add. */
15
+ className?: string;
16
+ /** ID that other components can cross reference for accessibility purposes. */
17
+ id?: string;
18
+ /** The text content rendered in the component. DS components and native HTML can be passed in this prop. */
19
+ textContent: string | JSX.Element;
20
+ /** Whether component will fill the full width of the browser window, instead of just its parent element.
21
+ * False by default. */
22
+ isFullWidth: boolean;
23
+ /** Data object that contains the props related to the image element: alt, position, src, width. */
24
+ imageProps: FeaturedContentImageProps;
25
+ }
26
+ export declare const FeaturedContent: import("@chakra-ui/react").ChakraComponent<React.ForwardRefExoticComponent<FeaturedContentProps & {
27
+ children?: React.ReactNode;
28
+ } & React.RefAttributes<HTMLDivElement>>, {}>;
29
+ export default FeaturedContent;
@@ -0,0 +1,46 @@
1
+ import React from "react";
2
+ import { SectionTypes } from "../../helpers/types";
3
+ interface NewsletterSignupProps {
4
+ /** Additional class name to add. */
5
+ className?: string;
6
+ /** Text displayed next to the confirmation icon after a successful email submission */
7
+ confirmationHeading: string;
8
+ /** Detail text for the confirmation view */
9
+ confirmationText: string;
10
+ /** Appears below the title to provide details about the newsletter. Accepts a string or an element. */
11
+ descriptionText?: string | JSX.Element;
12
+ /** Text displayed next to the error icon in case of an error in the email submission process*/
13
+ errorHeading?: string;
14
+ /** Appears below the title to provide details about next steps in case of an error. Accepts a string or an element. */
15
+ errorText?: string | JSX.Element;
16
+ /** Appears below the input field's example text to provide any additional instructions. Accepts a string or
17
+ * an element. */
18
+ formHelperText?: string | JSX.Element;
19
+ /** ID that other components can cross-reference for accessibility purposes */
20
+ id?: string;
21
+ /** Toggles the invalid state for the email field. */
22
+ isInvalidEmail?: boolean;
23
+ /** Value to determine the section color highlight. The default is set to "blogs" as it uses the
24
+ * "ui.border.deafult" color.
25
+ */
26
+ newsletterSignupType?: SectionTypes;
27
+ /** A handler function that will be called when the form is submitted. */
28
+ onSubmit: (event: React.FormEvent<any>) => void;
29
+ /** A handler function that will be called when the text input changes. */
30
+ onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
31
+ /** Link to the relevant privacy policy page. */
32
+ privacyPolicyLink?: string;
33
+ /** Used to populate the title of the Component*/
34
+ title?: JSX.Element;
35
+ /** The value of the email text input field. */
36
+ valueEmail?: string;
37
+ /** Used to specify what is displayed in the component form/feedback area. */
38
+ view?: NewsletterSignupViewType;
39
+ }
40
+ export type NewsletterSignupViewType = "form" | "submitting" | "confirmation" | "error";
41
+ /**
42
+ * The NewsletterSignup component provides a way for patrons to register for an
43
+ * email-based newsletter distribution list.
44
+ */
45
+ export declare const NewsletterSignup: import("@chakra-ui/react").ChakraComponent<React.ForwardRefExoticComponent<NewsletterSignupProps & React.RefAttributes<HTMLDivElement>>, {}>;
46
+ export default NewsletterSignup;
@@ -13,6 +13,9 @@ export declare const TextInputFormats: {
13
13
  };
14
14
  export type TextInputVariants = "default" | "searchBar" | "searchBarSelect";
15
15
  export interface InputProps {
16
+ /** FOR INTERNAL DS USE ONLY: additional helper text id(s) to be used for the input's `aria-describedby` value.
17
+ * If more than one, separate each with a space */
18
+ additionalHelperTextIds?: string;
16
19
  /** A class name for the TextInput parent div. */
17
20
  className?: string;
18
21
  /** The starting value of the input field. */
@@ -0,0 +1,8 @@
1
+ import { SectionTypes } from "./types";
2
+ type ColorSection = {
3
+ primary: string;
4
+ secondary: string | null;
5
+ };
6
+ type ColorVal = string;
7
+ export declare function getSectionColors(type: SectionTypes, colorVal?: "primary" | "secondary"): ColorSection | ColorVal;
8
+ export {};
@@ -1,2 +1,50 @@
1
1
  export declare const layoutTypesArray: readonly ["column", "row"];
2
2
  export type LayoutTypes = typeof layoutTypesArray[number];
3
+ export declare const sectionDataMap: {
4
+ blogs: {
5
+ primary: string;
6
+ secondary: string;
7
+ };
8
+ booksAndMore: {
9
+ primary: string;
10
+ secondary: string;
11
+ };
12
+ brand: {
13
+ primary: string;
14
+ secondary: string;
15
+ };
16
+ connect: {
17
+ primary: string;
18
+ secondary: string;
19
+ };
20
+ education: {
21
+ primary: string;
22
+ secondary: string;
23
+ };
24
+ locations: {
25
+ primary: string;
26
+ secondary: string;
27
+ };
28
+ research: {
29
+ primary: string;
30
+ secondary: string;
31
+ };
32
+ researchLibraryLpa: {
33
+ primary: string;
34
+ secondary: any;
35
+ };
36
+ researchLibrarySchomburg: {
37
+ primary: string;
38
+ secondary: any;
39
+ };
40
+ researchLibrarySchwarzman: {
41
+ primary: string;
42
+ secondary: any;
43
+ };
44
+ whatsOn: {
45
+ primary: string;
46
+ secondary: string;
47
+ };
48
+ };
49
+ export declare const sectionTypeArray: string[];
50
+ export type SectionTypes = typeof sectionTypeArray[number];
@@ -1,5 +1,8 @@
1
1
  /**
2
2
  * DS internal helper hook to use state with prop dependencies.
3
+ *
4
+ * This hook should NOT be used by consuming apps. DS components should use this hook rather than useState() whenever
5
+ * a change in state is expected for a given prop from a consuming app. The hook updates the DS component with useEffect().
3
6
  */
4
7
  declare function useStateWithDependencies(initialValue: any): typeof initialValue;
5
8
  export default useStateWithDependencies;
@@ -16,6 +16,8 @@ export { default as ColorCard } from "./components/StyleGuide/ColorCard";
16
16
  export { default as DatePicker } from "./components/DatePicker/DatePicker";
17
17
  export type { DatePickerTypes, FullDateType, } from "./components/DatePicker/DatePicker";
18
18
  export { default as DSProvider } from "./theme/provider";
19
+ export type { FeaturedContentProps } from "./components/FeaturedContent/FeaturedContent";
20
+ export { default as FeaturedContent } from "./components/FeaturedContent/FeaturedContent";
19
21
  export { default as FeedbackBox, useFeedbackBox, } from "./components/FeedbackBox/FeedbackBox";
20
22
  export type { FeedbackBoxViewType } from "./components/FeedbackBox/FeedbackBox";
21
23
  export { default as Fieldset } from "./components/Fieldset/Fieldset";
@@ -39,6 +41,8 @@ export type { DescriptionProps, ListTypes } from "./components/List/List";
39
41
  export { default as Logo } from "./components/Logo/Logo";
40
42
  export type { LogoNames, LogoSizes } from "./components/Logo/Logo";
41
43
  export { ModalTrigger, useModal } from "./components/Modal/Modal";
44
+ export { default as NewsletterSignup } from "./components/NewsletterSignup/NewsletterSignup";
45
+ export type { NewsletterSignupViewType } from "./components/NewsletterSignup/NewsletterSignup";
42
46
  export { default as Notification } from "./components/Notification/Notification";
43
47
  export type { NotificationTypes } from "./components/Notification/Notification";
44
48
  export { default as Pagination } from "./components/Pagination/Pagination";
@@ -0,0 +1,70 @@
1
+ interface FeaturedContentBaseStyleProps {
2
+ imagePosition: string;
3
+ imageWidth: string;
4
+ isFullWidth: boolean;
5
+ }
6
+ declare const FeaturedContent: {
7
+ baseStyle: ({ imagePosition, imageWidth, isFullWidth, }: FeaturedContentBaseStyleProps) => {
8
+ bgColor: string;
9
+ _dark: {
10
+ bgColor: string;
11
+ };
12
+ width: string;
13
+ left: string;
14
+ right: string;
15
+ position: string;
16
+ marginLeft: string;
17
+ marginRight: string;
18
+ wrapper: {
19
+ minHeight: string;
20
+ maxWidth: string;
21
+ display: string;
22
+ alignItems: string;
23
+ flexDirection: {
24
+ sm: string;
25
+ md: string;
26
+ };
27
+ marginY: string;
28
+ marginX: string;
29
+ padding: string;
30
+ width: string;
31
+ };
32
+ text: {
33
+ display: string;
34
+ padding: string;
35
+ flex: number;
36
+ flexDirection: string;
37
+ justifyContent: string;
38
+ };
39
+ imgWrapper: {
40
+ backgroundPosition: string;
41
+ backgroundSize: string;
42
+ height: {
43
+ sm: string;
44
+ md: string;
45
+ };
46
+ width: {
47
+ sm: string;
48
+ md: string;
49
+ };
50
+ };
51
+ img: {
52
+ clip: string;
53
+ height: {
54
+ base: string;
55
+ md: string;
56
+ };
57
+ overflow: string;
58
+ position: {
59
+ base: string;
60
+ md: string;
61
+ };
62
+ width: {
63
+ base: string;
64
+ md: string;
65
+ };
66
+ wordWrap: string;
67
+ };
68
+ };
69
+ };
70
+ export default FeaturedContent;
@@ -0,0 +1,93 @@
1
+ import { SectionTypes } from "../../helpers/types";
2
+ interface NewsLetterStyleProps {
3
+ newsletterSignupType: SectionTypes;
4
+ }
5
+ declare const NewsletterSignup: {
6
+ parts: string[];
7
+ baseStyle: ({ newsletterSignupType }: NewsLetterStyleProps) => {
8
+ alignItems: string;
9
+ borderWidth: {
10
+ base: string;
11
+ md: string;
12
+ };
13
+ maxWidth: string;
14
+ width: string;
15
+ pitch: {
16
+ width: {
17
+ base: string;
18
+ md: string;
19
+ };
20
+ bg: string;
21
+ borderWidth: {
22
+ base: string;
23
+ md: string;
24
+ };
25
+ borderLeftColor: {
26
+ md: string | {
27
+ primary: string;
28
+ secondary: string;
29
+ };
30
+ };
31
+ borderTopColor: {
32
+ base: string | {
33
+ primary: string;
34
+ secondary: string;
35
+ };
36
+ md: string;
37
+ };
38
+ _dark: {
39
+ bg: string;
40
+ borderTopColor: {
41
+ md: string;
42
+ };
43
+ borderLeftColor: {
44
+ md: string | {
45
+ primary: string;
46
+ secondary: string;
47
+ };
48
+ };
49
+ };
50
+ padding: {
51
+ base: string;
52
+ md: string;
53
+ lg: string;
54
+ };
55
+ alignItems: string;
56
+ gap: string;
57
+ };
58
+ privacy: {
59
+ fontSize: string;
60
+ fontWeight: string;
61
+ };
62
+ action: {
63
+ padding: {
64
+ base: string;
65
+ lg: string;
66
+ };
67
+ width: {
68
+ base: string;
69
+ md: string;
70
+ };
71
+ };
72
+ form: {
73
+ width: string;
74
+ };
75
+ "#newsletter-form-parent": {
76
+ gridTemplateColumns: {
77
+ base: any;
78
+ lg: string;
79
+ };
80
+ gap: {
81
+ base: string;
82
+ lg: string;
83
+ };
84
+ };
85
+ button: {
86
+ marginTop: {
87
+ base: any;
88
+ lg: string;
89
+ };
90
+ };
91
+ };
92
+ };
93
+ export default NewsletterSignup;
@@ -21,13 +21,14 @@ interface GetAriaAttrsProps {
21
21
  id: string;
22
22
  labelText: HelperErrorTextType;
23
23
  name: string;
24
+ additionalHelperTextIds?: string;
24
25
  showLabel: boolean;
25
26
  }
26
27
  /**
27
28
  * Get aria-* attributes for input components. This sets the `aria-label` and
28
29
  * `aria-describedby` attributes, based on the label and footnote values.
29
30
  */
30
- export declare const getAriaAttrs: ({ footnote, id, labelText, name, showLabel, }: GetAriaAttrsProps) => AriaAttributes;
31
+ export declare const getAriaAttrs: ({ footnote, id, labelText, name, additionalHelperTextIds, showLabel, }: GetAriaAttrsProps) => AriaAttributes;
31
32
  /** Convert a hex color value to an rgb or rgba value */
32
33
  export declare const hexToRGB: (hex: string, alpha: number) => string;
33
34
  /** Calculate color luminance */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nypl/design-system-react-components",
3
- "version": "2.0.1",
3
+ "version": "2.1.0-rc",
4
4
  "description": "NYPL Reservoir Design System React Components",
5
5
  "repository": {
6
6
  "type": "git",
@@ -52,6 +52,9 @@
52
52
  "singleQuote": false,
53
53
  "trailingComma": "es5"
54
54
  },
55
+ "overrides": {
56
+ "types-ramda": "0.29.4"
57
+ },
55
58
  "dependencies": {
56
59
  "@chakra-ui/focus-lock": ">=1.2.6 <2.0.0",
57
60
  "@chakra-ui/react": ">=1.8.5 <=1.8.8",
@@ -103,7 +106,7 @@
103
106
  "@types/jest-axe": "3.5.3",
104
107
  "@types/node": "18.13.0",
105
108
  "@types/react": "16.9.41",
106
- "@types/testing-library__jest-dom": "^5.14.1",
109
+ "@types/testing-library__jest-dom": "5.14.1",
107
110
  "@typescript-eslint/eslint-plugin": "5.57.0",
108
111
  "@typescript-eslint/parser": "5.57.0",
109
112
  "@vitejs/plugin-react": "3.1.0",