@nypl/design-system-react-components 3.1.0-rc2 → 3.1.1-modal-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.
|
@@ -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.ForwardRefExoticComponent<BaseModalProps & React.RefAttributes<HTMLButtonElement>>, 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`
|
|
@@ -189,6 +189,7 @@ export declare const cssVars: {
|
|
|
189
189
|
dataBgDefaultColor?: undefined;
|
|
190
190
|
dataBrandPrimaryColor?: undefined;
|
|
191
191
|
dataBrandSecondaryColor?: undefined;
|
|
192
|
+
notes?: undefined;
|
|
192
193
|
} | {
|
|
193
194
|
colorSource: string;
|
|
194
195
|
name: string;
|
|
@@ -199,6 +200,7 @@ export declare const cssVars: {
|
|
|
199
200
|
textColor: string;
|
|
200
201
|
dataBrandPrimaryColor?: undefined;
|
|
201
202
|
dataBrandSecondaryColor?: undefined;
|
|
203
|
+
notes?: undefined;
|
|
202
204
|
} | {
|
|
203
205
|
name: string;
|
|
204
206
|
dataBlackColor: any[];
|
|
@@ -209,6 +211,7 @@ export declare const cssVars: {
|
|
|
209
211
|
colorSource?: undefined;
|
|
210
212
|
dataBrandPrimaryColor?: undefined;
|
|
211
213
|
dataBrandSecondaryColor?: undefined;
|
|
214
|
+
notes?: undefined;
|
|
212
215
|
} | {
|
|
213
216
|
colorSource: string;
|
|
214
217
|
name: string;
|
|
@@ -219,6 +222,18 @@ export declare const cssVars: {
|
|
|
219
222
|
dataBgPageColor: string[];
|
|
220
223
|
dataBgDefaultColor: any[];
|
|
221
224
|
textColor: string;
|
|
225
|
+
notes?: undefined;
|
|
226
|
+
} | {
|
|
227
|
+
name: string;
|
|
228
|
+
dataBlackColor: any[];
|
|
229
|
+
dataWhiteColor: any[];
|
|
230
|
+
dataBgPageColor: any[];
|
|
231
|
+
dataBgDefaultColor: any[];
|
|
232
|
+
notes: string;
|
|
233
|
+
textColor: string;
|
|
234
|
+
colorSource?: undefined;
|
|
235
|
+
dataBrandPrimaryColor?: undefined;
|
|
236
|
+
dataBrandSecondaryColor?: undefined;
|
|
222
237
|
})[];
|
|
223
238
|
grayscaleRoot: {
|
|
224
239
|
name: string;
|
|
@@ -343,6 +358,8 @@ export interface ColorCardProps extends DataTableProps {
|
|
|
343
358
|
colorName: string;
|
|
344
359
|
/** The name of the color that the current color is based on. */
|
|
345
360
|
colorSource: string;
|
|
361
|
+
/** Details on how a color should be used. */
|
|
362
|
+
notes?: string;
|
|
346
363
|
}
|
|
347
364
|
export declare const DataTable: (props: PropsWithChildren<DataTableProps>) => import("react/jsx-runtime").JSX.Element;
|
|
348
365
|
export declare const ColorCard: (props: PropsWithChildren<ColorCardProps>) => import("react/jsx-runtime").JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nypl/design-system-react-components",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.1-modal-rc",
|
|
4
4
|
"description": "NYPL Reservoir Design System React Components",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -88,9 +88,10 @@
|
|
|
88
88
|
"@storybook/addon-jest": "7.5.1",
|
|
89
89
|
"@storybook/addon-links": "7.5.1",
|
|
90
90
|
"@storybook/blocks": "7.5.1",
|
|
91
|
+
"@storybook/jest": "0.2.3",
|
|
91
92
|
"@storybook/react": "7.5.1",
|
|
92
93
|
"@storybook/react-vite": "7.5.1",
|
|
93
|
-
"@storybook/
|
|
94
|
+
"@storybook/test": "7.6.12",
|
|
94
95
|
"@svgr/webpack": "5.5.0",
|
|
95
96
|
"@testing-library/dom": "9.2.0",
|
|
96
97
|
"@testing-library/jest-dom": "5.14.1",
|