@nypl/design-system-react-components 3.1.2 → 3.1.4
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 +47 -47
- package/dist/design-system-react-components.js +8607 -8498
- package/dist/src/components/List/List.d.ts +2 -0
- package/dist/src/components/Modal/Modal.d.ts +29 -6
- package/dist/src/components/MultiSelect/MultiSelect.d.ts +12 -10
- package/dist/src/components/MultiSelect/MultiSelectItemsCountButton.d.ts +2 -2
- package/dist/src/components/TextInput/TextInput.d.ts +1 -1
- package/dist/src/index.d.ts +2 -1
- package/dist/src/theme/components/buttonGroup.d.ts +4 -1
- package/dist/src/theme/components/checkbox.d.ts +2 -0
- package/dist/src/theme/components/list.d.ts +3 -3
- package/dist/src/theme/components/multiSelectItemsCountButton.d.ts +3 -0
- package/dist/src/theme/components/structuredContent.d.ts +5 -5
- package/package.json +1 -1
|
@@ -22,6 +22,8 @@ export interface ListProps {
|
|
|
22
22
|
listItems?: (string | JSX.Element | DescriptionProps)[];
|
|
23
23
|
/** Remove list styling. */
|
|
24
24
|
noStyling?: boolean;
|
|
25
|
+
/** Show dividers between rows for the description list variant. */
|
|
26
|
+
showRowDividers?: boolean;
|
|
25
27
|
/** Optional string value used to set the text for a `Heading` component, or
|
|
26
28
|
* a DS Heading component that can be passed in. This title only applies to
|
|
27
29
|
* to Description Lists and will render above the list. */
|
|
@@ -1,29 +1,52 @@
|
|
|
1
1
|
import { ChakraComponent } from "@chakra-ui/react";
|
|
2
2
|
import React from "react";
|
|
3
|
-
export interface
|
|
3
|
+
export interface BaseProps {
|
|
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;
|
|
8
6
|
/** The text to display in the modal heading, can be a string or JSX Element. */
|
|
9
7
|
headingText?: string | JSX.Element;
|
|
10
8
|
/** ID that other components can cross reference for accessibility purposes. */
|
|
11
9
|
id?: string;
|
|
12
10
|
/** Boolean to determine if the modal is open or closed. */
|
|
13
11
|
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;
|
|
14
28
|
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;
|
|
15
36
|
}
|
|
37
|
+
export type ModalTypeProps = ConfirmationModalProps | DefaultModalProps;
|
|
38
|
+
export type BaseModalProps = BaseProps & ModalTypeProps;
|
|
16
39
|
export interface ModalProps {
|
|
17
40
|
/** The text to display on the button that opens the modal. */
|
|
18
41
|
buttonText?: string;
|
|
19
42
|
/** ID that other components can cross reference for accessibility purposes */
|
|
20
43
|
id?: string;
|
|
21
44
|
/** Props to update the internal `Modal` component. This contains the
|
|
22
|
-
* `bodyContent`, `
|
|
23
|
-
* `onClose` props. */
|
|
45
|
+
* `bodyContent`, `headingText`, `isOpen`, and the modal type props. */
|
|
24
46
|
modalProps: BaseModalProps;
|
|
25
47
|
}
|
|
26
|
-
export declare
|
|
48
|
+
export declare function isDefaultType(type: BaseModalProps["type"]): type is "default";
|
|
49
|
+
export declare const BaseModal: ChakraComponent<React.FunctionComponent<BaseModalProps>, BaseModalProps>;
|
|
27
50
|
/**
|
|
28
51
|
* The `ModalTrigger` component renders a button that you click to open the
|
|
29
52
|
* internal `Modal` component. Note that props to update the internal `Modal`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { ChakraComponent } from "@chakra-ui/react";
|
|
2
|
+
import React from "react";
|
|
3
3
|
export interface MultiSelectItem {
|
|
4
4
|
id: string;
|
|
5
5
|
name: string;
|
|
@@ -18,7 +18,8 @@ export interface SelectedItems {
|
|
|
18
18
|
export interface MultiSelectProps {
|
|
19
19
|
/** The button text rendered within the MultiSelect. */
|
|
20
20
|
buttonText: string;
|
|
21
|
-
/** The number of items that will be visible in the list when the component
|
|
21
|
+
/** The number of items that will be visible in the list when the component
|
|
22
|
+
* first loads. */
|
|
22
23
|
defaultItemsVisible?: number;
|
|
23
24
|
/** The action to perform for the clear/reset button of individual MultiSelects. */
|
|
24
25
|
onClear?: () => void;
|
|
@@ -28,9 +29,8 @@ export interface MultiSelectProps {
|
|
|
28
29
|
onMixedStateChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
29
30
|
/** An ID string that other components can cross reference for accessibility purposes. */
|
|
30
31
|
id: string;
|
|
31
|
-
/** Boolean value used to control how the MultiSelect component will render
|
|
32
|
-
* and interact with other DOM elements.
|
|
33
|
-
* The default value is false. */
|
|
32
|
+
/** Boolean value used to control how the MultiSelect component will render
|
|
33
|
+
* within the page and interact with other DOM elements. The default value is false. */
|
|
34
34
|
isBlockElement?: boolean;
|
|
35
35
|
/** Set the default open or closed state of the Multiselect. */
|
|
36
36
|
isDefaultOpen?: boolean;
|
|
@@ -39,7 +39,8 @@ export interface MultiSelectProps {
|
|
|
39
39
|
isSearchable?: boolean;
|
|
40
40
|
/** The items to be rendered in the Multiselect as checkbox options. */
|
|
41
41
|
items: MultiSelectItem[];
|
|
42
|
-
/** listOverflow is a property indicating how the list should handle overflow,
|
|
42
|
+
/** listOverflow is a property indicating how the list should handle overflow,
|
|
43
|
+
* with options limited to either "scroll" or "expand." */
|
|
43
44
|
listOverflow?: MultiSelectListOverflowTypes;
|
|
44
45
|
/** The selected items state (items that were checked by user). */
|
|
45
46
|
selectedItems: SelectedItems;
|
|
@@ -47,9 +48,10 @@ export interface MultiSelectProps {
|
|
|
47
48
|
width?: MultiSelectWidths;
|
|
48
49
|
}
|
|
49
50
|
/**
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
* The MultiSelect component is a customizable form input that supports multiple
|
|
52
|
+
* configurations, including search functionality, checkbox options, and
|
|
53
|
+
* hierarchical structure, with a parent checkbox toggling all children and
|
|
54
|
+
* dynamic styling through Chakra UI.
|
|
55
|
+
*/
|
|
54
56
|
export declare const MultiSelect: ChakraComponent<React.ForwardRefExoticComponent<React.PropsWithChildren<MultiSelectProps> & React.RefAttributes<HTMLDivElement>>, React.PropsWithChildren<MultiSelectProps>>;
|
|
55
57
|
export default MultiSelect;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
export interface MultiSelectItemsCountButtonProps {
|
|
3
3
|
/** An ID string that other components can cross reference for accessibility purposes. */
|
|
4
4
|
id: string;
|
|
@@ -28,5 +28,5 @@ export interface MultiSelectItemsCountButtonProps {
|
|
|
28
28
|
* the selected items and the main button's close event will not be fired
|
|
29
29
|
* (as expected).
|
|
30
30
|
*/
|
|
31
|
-
declare const MultiSelectItemsCountButton:
|
|
31
|
+
declare const MultiSelectItemsCountButton: import("react").ForwardRefExoticComponent<MultiSelectItemsCountButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
32
32
|
export default MultiSelectItemsCountButton;
|
|
@@ -15,7 +15,7 @@ export declare const TextInputFormats: {
|
|
|
15
15
|
url: string;
|
|
16
16
|
};
|
|
17
17
|
export type TextInputVariants = "default" | "searchBar" | "searchBarSelect";
|
|
18
|
-
export interface InputProps {
|
|
18
|
+
export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
19
19
|
/** FOR INTERNAL DS USE ONLY: Adds an aria-label or appends to an existing aria-label for screen readers.*/
|
|
20
20
|
additionalAriaLabel?: string;
|
|
21
21
|
/** FOR INTERNAL DS USE ONLY: additional helper text id(s) to be used for the input's `aria-describedby` value.
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Box, Center, Circle, ColorModeScript, cookieStorageManager, cookieStorageManagerSSR, FocusLock, Flex, Grid, GridItem, HStack, localStorageManager, Spacer, Square, Stack, useColorMode, useColorModeValue, useStyleConfig, useMultiStyleConfig, VStack, } from "@chakra-ui/react";
|
|
1
|
+
export { Box, Center, chakra, Circle, ColorModeScript, cookieStorageManager, cookieStorageManagerSSR, FocusLock, Flex, Grid, GridItem, HStack, localStorageManager, Spacer, Square, Stack, useColorMode, useColorModeValue, useStyleConfig, useMediaQuery, useMultiStyleConfig, VStack, } from "@chakra-ui/react";
|
|
2
2
|
export { default as Accordion } from "./components/Accordion/Accordion";
|
|
3
3
|
export type { AccordionTypes } from "./components/Accordion/Accordion";
|
|
4
4
|
export { default as AlphabetFilter } from "./components/AlphabetFilter/AlphabetFilter";
|
|
@@ -46,6 +46,7 @@ export { default as MatchMedia } from "../src/__tests__/mediaMatchMock";
|
|
|
46
46
|
export { default as Menu } from "./components/Menu/Menu";
|
|
47
47
|
export type { ListItemsData, ActionItem, GroupItem, DividerItem, } from "./components/Menu/Menu";
|
|
48
48
|
export { ModalTrigger, useModal } from "./components/Modal/Modal";
|
|
49
|
+
export type { BaseModalProps, ConfirmationModalProps, DefaultModalProps, } from "./components/Modal/Modal";
|
|
49
50
|
export { default as MultiSelect } from "./components/MultiSelect/MultiSelect";
|
|
50
51
|
export type { MultiSelectItem, SelectedItems, } from "./components/MultiSelect/MultiSelect";
|
|
51
52
|
export { default as MultiSelectGroup } from "./components/MultiSelectGroup/MultiSelectGroup";
|
|
@@ -18,7 +18,7 @@ export declare const baseListStyles: (props?: ListBaseStyle) => {
|
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
|
-
export declare const baseSectionDescriptionStyles: {
|
|
21
|
+
export declare const baseSectionDescriptionStyles: (showRowDividers?: boolean) => {
|
|
22
22
|
borderBottom: string;
|
|
23
23
|
borderColor: string;
|
|
24
24
|
paddingStart: string;
|
|
@@ -57,7 +57,7 @@ export declare const unorderedStyles: (props?: ListBaseStyle) => {
|
|
|
57
57
|
margin: string;
|
|
58
58
|
marginBottom: string;
|
|
59
59
|
};
|
|
60
|
-
export declare const descriptionStyles: {
|
|
60
|
+
export declare const descriptionStyles: (showRowDividers?: boolean) => {
|
|
61
61
|
dl: {
|
|
62
62
|
display: string;
|
|
63
63
|
gridTemplateColumns: {
|
|
@@ -183,7 +183,7 @@ declare const List: {
|
|
|
183
183
|
marginBottom: string;
|
|
184
184
|
};
|
|
185
185
|
};
|
|
186
|
-
dl: {
|
|
186
|
+
dl: ({ showRowDividers }: StyleFunctionProps) => {
|
|
187
187
|
base: {
|
|
188
188
|
dl: {
|
|
189
189
|
display: string;
|
|
@@ -296,7 +296,10 @@ declare const StructuredContent: {
|
|
|
296
296
|
base: string;
|
|
297
297
|
md: string;
|
|
298
298
|
};
|
|
299
|
-
paddingTop: string;
|
|
299
|
+
paddingTop: string; /** The following styles are meant to target HTML elements that are
|
|
300
|
+
* not rendered from the Reservoir DS. Typically, these HTML elements
|
|
301
|
+
* are added from an API response.
|
|
302
|
+
*/
|
|
300
303
|
paddingEnd: {
|
|
301
304
|
md: string;
|
|
302
305
|
};
|
|
@@ -307,10 +310,7 @@ declare const StructuredContent: {
|
|
|
307
310
|
};
|
|
308
311
|
dd: {
|
|
309
312
|
margin: string;
|
|
310
|
-
paddingBottom: string;
|
|
311
|
-
* not rendered from the Reservoir DS. Typically, these HTML elements
|
|
312
|
-
* are added from an API response.
|
|
313
|
-
*/
|
|
313
|
+
paddingBottom: string;
|
|
314
314
|
borderTop: {
|
|
315
315
|
base: string;
|
|
316
316
|
md: string;
|