@nypl/design-system-react-components 1.2.2 → 1.3.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.
- package/dist/components/FeedbackBox/FeedbackBox.d.ts +63 -0
- package/dist/components/FeedbackBox/useFeedbackBoxReducer.d.ts +19 -0
- package/dist/components/Icons/Icon.d.ts +4 -2
- package/dist/components/Icons/IconColors.d.ts +3 -0
- package/dist/components/Icons/IconNames.d.ts +3 -0
- package/dist/components/List/List.d.ts +7 -2
- package/dist/components/StyleGuide/ColorCard.d.ts +18 -6
- package/dist/components/StyledList/StyledList.d.ts +25 -0
- package/dist/components/Text/Text.d.ts +1 -1
- package/dist/design-system-react-components.cjs.development.js +405 -294
- package/dist/design-system-react-components.cjs.development.js.map +1 -1
- package/dist/design-system-react-components.cjs.production.min.js +1 -1
- package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
- package/dist/design-system-react-components.esm.js +406 -296
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/hooks/useStateWithDependencies.d.ts +5 -0
- package/dist/index.d.ts +1 -0
- package/dist/theme/components/feedbackBox.d.ts +57 -0
- package/dist/theme/components/styledList.d.ts +41 -0
- package/dist/theme/foundations/breakpoints.d.ts +1 -1
- package/package.json +8 -8
- package/CHANGELOG.md +0 -1696
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare type ViewType = "form" | "confirmation" | "error";
|
|
3
|
+
interface FeedbackBoxProps {
|
|
4
|
+
/** Additional class name to add. */
|
|
5
|
+
className?: string;
|
|
6
|
+
/** Used to add additional information to the default confirmation message in
|
|
7
|
+
* the confirmation view. */
|
|
8
|
+
confirmationText?: string | JSX.Element;
|
|
9
|
+
/** Used to add description text above the form input fields in
|
|
10
|
+
* the initial/form view. */
|
|
11
|
+
descriptionText?: string | JSX.Element;
|
|
12
|
+
/** A data object containing key/value pairs that will be added to the form
|
|
13
|
+
* field submitted data. */
|
|
14
|
+
hiddenFields?: any;
|
|
15
|
+
/** ID that other components can cross reference for accessibility purposes */
|
|
16
|
+
id?: string;
|
|
17
|
+
/** Toggles the invalid state for the email field. */
|
|
18
|
+
isInvalidComment?: boolean;
|
|
19
|
+
/** Toggles the invalid state for the comment field. */
|
|
20
|
+
isInvalidEmail?: boolean;
|
|
21
|
+
/** Only used for internal purposes. */
|
|
22
|
+
isOpen?: boolean;
|
|
23
|
+
/** Used to add a notification above the description in the
|
|
24
|
+
* initial/form view.*/
|
|
25
|
+
notificationText?: string | JSX.Element;
|
|
26
|
+
/** Only used for internal purposes. */
|
|
27
|
+
onClose?: any;
|
|
28
|
+
/** Only used for internal purposes. */
|
|
29
|
+
onOpen?: any;
|
|
30
|
+
/** Callback function that will be invoked when the form is submitted.
|
|
31
|
+
* The returned data object contains key/value pairs including the
|
|
32
|
+
* values from the `hiddenFields` prop.
|
|
33
|
+
*/
|
|
34
|
+
onSubmit: (values: {
|
|
35
|
+
[key: string]: string;
|
|
36
|
+
}) => any;
|
|
37
|
+
/** Toggles the category radio group field. */
|
|
38
|
+
showCategoryField?: boolean;
|
|
39
|
+
/** Toggles the email input field. When set to `true`, an additional
|
|
40
|
+
* confirmation message will be rendered. */
|
|
41
|
+
showEmailField?: boolean;
|
|
42
|
+
/** Used to populate the label on the open button and the `Drawer`'s
|
|
43
|
+
* header title. */
|
|
44
|
+
title: string;
|
|
45
|
+
/** Used to specify what screen should be displayed. */
|
|
46
|
+
view?: ViewType;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The `FeedbackBox` component renders a fixed-positioned button on the bottom
|
|
50
|
+
* right corner of a page that opens a Chakra `Drawer` popup component. Inside
|
|
51
|
+
* of the popup, a form is rendered with fields that allows users to provide
|
|
52
|
+
* feedback. The `FeedbackBox` component does *not* call any API with the
|
|
53
|
+
* submitted data; that feature is the responsibility of the consuming
|
|
54
|
+
* application.
|
|
55
|
+
*/
|
|
56
|
+
export declare const FeedbackBox: import("@chakra-ui/react").ChakraComponent<React.ForwardRefExoticComponent<FeedbackBoxProps & React.RefAttributes<any>>, {}>;
|
|
57
|
+
export declare function useFeedbackBox(): {
|
|
58
|
+
isOpen: boolean;
|
|
59
|
+
onClose: () => void;
|
|
60
|
+
onOpen: () => void;
|
|
61
|
+
FeedbackBox: import("@chakra-ui/react").ChakraComponent<(props: any) => JSX.Element, {}>;
|
|
62
|
+
};
|
|
63
|
+
export default FeedbackBox;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
interface FeedbackBoxState {
|
|
2
|
+
category?: string;
|
|
3
|
+
comment: string;
|
|
4
|
+
email?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* DS internal helper reducer hook to manage internal state for the FeedbackBox
|
|
8
|
+
* component. Note: this custom hook is not tested directly as it's an
|
|
9
|
+
* implementation detail of the FeedbackBox component, following the guidance
|
|
10
|
+
* of RTL: https://testing-library.com/docs/example-react-hooks-useReducer
|
|
11
|
+
*/
|
|
12
|
+
declare function useFeedbackBoxReducer(): {
|
|
13
|
+
state: FeedbackBoxState;
|
|
14
|
+
setCategory: (category: string) => void;
|
|
15
|
+
setComment: (comment: string) => void;
|
|
16
|
+
setEmail: (email: string) => void;
|
|
17
|
+
clearValues: () => void;
|
|
18
|
+
};
|
|
19
|
+
export default useFeedbackBoxReducer;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import iconColors from "./IconColors";
|
|
3
|
+
import iconNames from "./IconNames";
|
|
2
4
|
export declare type IconAlign = "left" | "right" | "none";
|
|
3
|
-
export declare type IconColors =
|
|
4
|
-
export declare type IconNames =
|
|
5
|
+
export declare type IconColors = typeof iconColors[number];
|
|
6
|
+
export declare type IconNames = typeof iconNames[number];
|
|
5
7
|
export declare type IconRotationTypes = "rotate0" | "rotate90" | "rotate180" | "rotate270";
|
|
6
8
|
export declare type IconSizes = "default" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge" | "xxxlarge";
|
|
7
9
|
export declare type IconTypes = "default" | "breadcrumbs";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const iconColors: readonly ["ui.black", "ui.white", "brand.primary", "brand.secondary", "ui.error.primary", "ui.error.secondary", "ui.status.primary", "ui.status.secondary", "ui.success.primary", "ui.success.secondary", "ui.warning.primary", "ui.warning.secondary", "section.blogs.primary", "section.blogs.secondary", "section.books-and-more.primary", "section.books-and-more.secondary", "section.education.primary", "section.education.secondary", "section.locations.primary", "section.locations.secondary", "section.research.primary", "section.research.secondary", "section.research-library.lpa", "section.research-library.schomburg", "section.research-library.schwartzman", "section.whats-on.primary", "section.whats-on.secondary", "dark.ui.error.primary", "dark.ui.error.secondary", "dark.ui.status.primary", "dark.ui.status.secondary", "dark.ui.success.primary", "dark.ui.success.secondary", "dark.ui.warning.primary", "dark.ui.warning.secondary"];
|
|
2
|
+
export declare const getIconColors: () => readonly ["ui.black", "ui.white", "brand.primary", "brand.secondary", "ui.error.primary", "ui.error.secondary", "ui.status.primary", "ui.status.secondary", "ui.success.primary", "ui.success.secondary", "ui.warning.primary", "ui.warning.secondary", "section.blogs.primary", "section.blogs.secondary", "section.books-and-more.primary", "section.books-and-more.secondary", "section.education.primary", "section.education.secondary", "section.locations.primary", "section.locations.secondary", "section.research.primary", "section.research.secondary", "section.research-library.lpa", "section.research-library.schomburg", "section.research-library.schwartzman", "section.whats-on.primary", "section.whats-on.secondary", "dark.ui.error.primary", "dark.ui.error.secondary", "dark.ui.status.primary", "dark.ui.status.secondary", "dark.ui.success.primary", "dark.ui.success.secondary", "dark.ui.warning.primary", "dark.ui.warning.secondary"];
|
|
3
|
+
export default iconColors;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const iconNames: readonly ["accessibilityFull", "accessibilityPartial", "actionCheckCircle", "actionCheckCircleFilled", "actionExit", "actionHelpDefault", "actionHelpOutline", "actionLaunch", "actionPower", "actionRegistration", "actionSettings", "alertNotificationImportant", "alertWarningFilled", "alertWarningOutline", "arrow", "building", "check", "clock", "close", "decorativeEnvelope", "decorativeLibraryCard", "decorativeShoppingBag", "download", "errorFilled", "errorOutline", "fileTypeAudio", "fileTypeDoc", "fileTypeGenericDoc", "fileTypeImage", "fileTypePdf", "fileTypeSpreadsheet", "fileTypeVideo", "headset", "legacyAccountFilled", "legacyAccountUnfilled", "legacySocialFacebook", "legacySocialInstagram", "legacySocialTwitter", "legacySocialYoutube", "locator", "minus", "plus", "search", "socialFacebook", "socialInstagram", "socialTumblr", "socialTwitter", "socialYoutube", "speakerNotes", "utilityAccountFilled", "utilityAccountUnfilled", "utilityHamburger", "utilitySearch"];
|
|
2
|
+
export declare const getIconNames: () => readonly ["accessibilityFull", "accessibilityPartial", "actionCheckCircle", "actionCheckCircleFilled", "actionExit", "actionHelpDefault", "actionHelpOutline", "actionLaunch", "actionPower", "actionRegistration", "actionSettings", "alertNotificationImportant", "alertWarningFilled", "alertWarningOutline", "arrow", "building", "check", "clock", "close", "decorativeEnvelope", "decorativeLibraryCard", "decorativeShoppingBag", "download", "errorFilled", "errorOutline", "fileTypeAudio", "fileTypeDoc", "fileTypeGenericDoc", "fileTypeImage", "fileTypePdf", "fileTypeSpreadsheet", "fileTypeVideo", "headset", "legacyAccountFilled", "legacyAccountUnfilled", "legacySocialFacebook", "legacySocialInstagram", "legacySocialTwitter", "legacySocialYoutube", "locator", "minus", "plus", "search", "socialFacebook", "socialInstagram", "socialTumblr", "socialTwitter", "socialYoutube", "speakerNotes", "utilityAccountFilled", "utilityAccountUnfilled", "utilityHamburger", "utilitySearch"];
|
|
3
|
+
export default iconNames;
|
|
@@ -11,9 +11,9 @@ export interface ListProps {
|
|
|
11
11
|
id?: string;
|
|
12
12
|
/** Display the list in a row. */
|
|
13
13
|
inline?: boolean;
|
|
14
|
-
/** Data to render if children are not passed. For `listTypes`
|
|
14
|
+
/** Data to render if children are not passed. For `listTypes` ordered `"ol"`
|
|
15
15
|
* and unordered `"ul"` `List` types, the data structure is an array of strings
|
|
16
|
-
* to renders as `li` items. For
|
|
16
|
+
* to renders as `li` items. For description `"dl"` `List` types, the data
|
|
17
17
|
* structure is an array of objects with `term` and `description` properties
|
|
18
18
|
* to render `dt` and `dd` elements, respectively.
|
|
19
19
|
*/
|
|
@@ -34,4 +34,9 @@ export interface ListProps {
|
|
|
34
34
|
export declare const List: import("@chakra-ui/react").ChakraComponent<React.ForwardRefExoticComponent<ListProps & {
|
|
35
35
|
children?: React.ReactNode;
|
|
36
36
|
} & React.RefAttributes<HTMLDivElement & HTMLUListElement & HTMLOListElement>>, {}>;
|
|
37
|
+
/**
|
|
38
|
+
* Checks for `li` elements and consoles a warning if the
|
|
39
|
+
* children are different HTML elements.
|
|
40
|
+
*/
|
|
41
|
+
export declare const checkListChildrenError: (children: React.ReactNode, listType?: string, componentName?: string) => void;
|
|
37
42
|
export default List;
|
|
@@ -1,20 +1,32 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
export interface DataTableProps {
|
|
3
|
-
/** Contrast and WCAG compliance data related to the color
|
|
3
|
+
/** Contrast and WCAG compliance data related to the color ui.bg.page when
|
|
4
4
|
* used with the current color. */
|
|
5
5
|
dataBgPageColor: string[];
|
|
6
|
-
/** Contrast and WCAG compliance data related to the color
|
|
6
|
+
/** Contrast and WCAG compliance data related to the color ui.bg.default when
|
|
7
7
|
* used with the current color. */
|
|
8
8
|
dataBgDefaultColor: string[];
|
|
9
|
+
/** Contrast and WCAG compliance data related to the color dark.ui.bg.page when
|
|
10
|
+
* used with the current color. */
|
|
11
|
+
dataDarkBgPageColor: string[];
|
|
12
|
+
/** Contrast and WCAG compliance data related to the color dark.ui.bg.default when
|
|
13
|
+
* used with the current color. */
|
|
14
|
+
dataDarkBgDefaultColor: string[];
|
|
9
15
|
/** Contrast and WCAG compliance data related to the color black when used
|
|
10
16
|
* with the current color. */
|
|
11
17
|
dataBlackColor: string[];
|
|
12
|
-
/** Contrast and WCAG compliance data related to the
|
|
13
|
-
*
|
|
14
|
-
|
|
18
|
+
/** Contrast and WCAG compliance data related to the NYPL Brand primary color
|
|
19
|
+
* when used with the current color. */
|
|
20
|
+
dataBrandPrimaryColor: string[];
|
|
15
21
|
/** Contrast and WCAG compliance data related to the default color for basic
|
|
16
22
|
* text elements when used with the current color. */
|
|
17
|
-
|
|
23
|
+
dataDarkBodyColor?: string[];
|
|
24
|
+
/** Contrast and WCAG compliance data related to the NYPL Brand secondary color
|
|
25
|
+
* when used with the current color. */
|
|
26
|
+
dataBrandSecondaryColor: string[];
|
|
27
|
+
/** Contrast and WCAG compliance data related to the default color for
|
|
28
|
+
* heading elements when used with the current color. */
|
|
29
|
+
dataDarkHeadingColor?: string[];
|
|
18
30
|
/** Contrast and WCAG compliance data related to the color white when used
|
|
19
31
|
* with the current color. */
|
|
20
32
|
dataWhiteColor: string[];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TextSizes } from "../Text/Text";
|
|
3
|
+
export interface StyledListProps {
|
|
4
|
+
/** Any child node passed to the component. */
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
/** A class name for the StyledList parent div. */
|
|
7
|
+
className?: string;
|
|
8
|
+
/** ID that other components can cross reference for accessibility purposes. */
|
|
9
|
+
id?: string;
|
|
10
|
+
/** Data to render if `li` children elements are not passed. It must be an
|
|
11
|
+
* array of strings or JSX elements. */
|
|
12
|
+
listItems?: (string | JSX.Element)[];
|
|
13
|
+
/** The style used to render the StyledList component. For its initial release,
|
|
14
|
+
* there is only one variant style which is the default, "capped". */
|
|
15
|
+
style?: "capped";
|
|
16
|
+
/** The font size of the `li` elements. */
|
|
17
|
+
textSize?: TextSizes;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The `StyledList` component renders an HTML list with styles that do not
|
|
21
|
+
* adhere to traditional numbered and bulleted list styles. Unlike
|
|
22
|
+
* the `List` component, `StyledList` only renders an unordered list.
|
|
23
|
+
*/
|
|
24
|
+
export declare const StyledList: import("@chakra-ui/react").ChakraComponent<React.ForwardRefExoticComponent<StyledListProps & React.RefAttributes<HTMLDivElement & HTMLUListElement>>, {}>;
|
|
25
|
+
export default StyledList;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export declare type TextSizes = "
|
|
2
|
+
export declare type TextSizes = "caption" | "default" | "mini" | "tag";
|
|
3
3
|
export interface TextProps {
|
|
4
4
|
/** Additional class name to render in the `Text` component. */
|
|
5
5
|
className?: string;
|