@nulogy/components 15.2.1 → 15.2.2
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/README.md +3 -3
- package/dist/main.js +5733 -5627
- package/dist/main.module.js +5729 -5623
- package/dist/src/Alert/Alert.story.d.ts +15 -19
- package/dist/src/Alert/Alert.story.js +25 -14
- package/dist/src/BrandedNavBar/NavBar.story.d.ts +4 -6
- package/dist/src/BrandedNavBar/NavBar.story.js +11 -3
- package/dist/src/BrandedNavBar/SmallNavBar.story.d.ts +5 -2
- package/dist/src/BrandedNavBar/SmallNavBar.story.js +26 -5
- package/dist/src/DatePickers/stories/DatePicker.story.d.ts +7 -3
- package/dist/src/DatePickers/stories/DatePicker.story.js +54 -22
- package/dist/src/DescriptionList/lib/utils.js +1 -1
- package/dist/src/DescriptionList/stories/DescriptionList.column.story.js +1 -1
- package/dist/src/DescriptionList/stories/DescriptionList.group-min-width.story.d.ts +7 -8
- package/dist/src/DescriptionList/stories/DescriptionList.group-min-width.story.js +15 -12
- package/dist/src/DescriptionList/stories/DescriptionList.layout.story.js +1 -1
- package/dist/src/DescriptionList/stories/DescriptionList.playground.story.d.ts +7 -8
- package/dist/src/DescriptionList/stories/DescriptionList.playground.story.js +200 -195
- package/dist/src/Layout/Header.d.ts +1 -1
- package/dist/src/Layout/Header.story.d.ts +10 -9
- package/dist/src/Layout/Header.story.js +9 -8
- package/dist/src/Layout/Sidebar.story.d.ts +4 -1
- package/dist/src/Layout/Sidebar.story.js +10 -3
- package/dist/src/Modal/Modal.story.d.ts +39 -61
- package/dist/src/Modal/Modal.story.js +110 -85
- package/dist/src/NDSProvider/renderWithNDSProvider.spec-utils.d.ts +2 -1
- package/dist/src/Radio/Radio.story.d.ts +316 -32
- package/dist/src/Radio/Radio.story.js +36 -22
- package/dist/src/Select/MenuList.js +1 -1
- package/dist/src/Select/Select.d.ts +1 -1
- package/dist/src/Select/Select.spec-utils.js +1 -0
- package/dist/src/Select/Select.story.d.ts +5 -1
- package/dist/src/Select/Select.story.js +93 -2
- package/dist/src/Table/stories/BaseTable.story.d.ts +11 -7
- package/dist/src/Table/stories/BaseTable.story.js +156 -34
- package/dist/src/Table/stories/SortingColumnHeader.story.d.ts +5 -2
- package/dist/src/Table/stories/SortingColumnHeader.story.js +20 -3
- package/dist/src/Table/stories/Table.story.d.ts +7 -14
- package/dist/src/Table/stories/Table.story.js +172 -127
- package/dist/src/Tooltip/Tooltip.story.d.ts +15 -52
- package/dist/src/Tooltip/Tooltip.story.js +79 -71
- package/dist/src/testing/matchers/toHaveStyle.d.ts +15 -0
- package/dist/src/testing/matchers/toHaveStyle.js +50 -0
- package/dist/src/testing/matchers/toMatchDate.d.ts +1 -0
- package/dist/src/testing/matchers/toMatchDate.js +1 -1
- package/dist/src/utils/DetectOutsideClick.d.ts +3 -0
- package/dist/src/utils/DetectOutsideClick.js +3 -0
- package/dist/src/utils/ScrollIndicators.js +1 -1
- package/dist/src/utils/generateId.d.ts +5 -0
- package/dist/src/utils/generateId.js +5 -0
- package/dist/src/utils/index.d.ts +0 -1
- package/dist/src/utils/index.js +0 -1
- package/dist/src/utils/numberFromDimension/numberFromDimension.spec.js +1 -0
- package/dist/vitest.config.d.ts +2 -0
- package/dist/vitest.config.js +11 -0
- package/package.json +24 -61
- package/dist/src/NDSProvider/mountWithNDSProvider.spec-utils.d.ts +0 -1
- package/dist/src/NDSProvider/mountWithNDSProvider.spec-utils.js +0 -4
- package/dist/src/utils/withWindowDimensions.d.ts +0 -3
- package/dist/src/utils/withWindowDimensions.js +0 -28
|
@@ -1,66 +1,44 @@
|
|
|
1
|
+
import type { StoryObj } from "@storybook/react";
|
|
1
2
|
import React from "react";
|
|
3
|
+
import { Modal as NDSModal } from "../index";
|
|
2
4
|
declare const _default: {
|
|
3
5
|
title: string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
name: string;
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
export declare const WithNoFooterContent: {
|
|
32
|
-
(): React.JSX.Element;
|
|
33
|
-
story: {
|
|
34
|
-
name: string;
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
export declare const WithCustomMaxWidth: {
|
|
38
|
-
(): React.JSX.Element;
|
|
39
|
-
story: {
|
|
40
|
-
name: string;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
export declare const WithSelect: {
|
|
44
|
-
(): React.JSX.Element;
|
|
45
|
-
story: {
|
|
46
|
-
name: string;
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
export declare const WithSelectAndScrollingContent: {
|
|
50
|
-
(): React.JSX.Element;
|
|
51
|
-
story: {
|
|
52
|
-
name: string;
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
export declare const WithParentSelector: {
|
|
56
|
-
(): React.JSX.Element;
|
|
57
|
-
story: {
|
|
58
|
-
name: string;
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
export declare const ExampleControlledModal: {
|
|
62
|
-
(): React.JSX.Element;
|
|
63
|
-
story: {
|
|
64
|
-
name: string;
|
|
6
|
+
component: React.FC<React.PropsWithChildren<{
|
|
7
|
+
isOpen?: boolean;
|
|
8
|
+
title?: string;
|
|
9
|
+
ariaLabel?: string;
|
|
10
|
+
onRequestClose?: (...args: any[]) => any;
|
|
11
|
+
closeAriaLabel?: string;
|
|
12
|
+
onAfterOpen?: (...args: any[]) => any;
|
|
13
|
+
shouldFocusAfterRender?: boolean;
|
|
14
|
+
shouldReturnFocusAfterClose?: boolean;
|
|
15
|
+
ariaDescribedBy?: string;
|
|
16
|
+
maxWidth?: string;
|
|
17
|
+
portalClassName?: string;
|
|
18
|
+
overlayClassName?: string;
|
|
19
|
+
className?: string;
|
|
20
|
+
id?: string;
|
|
21
|
+
appElement?: JSX.Element;
|
|
22
|
+
ariaHideApp?: boolean;
|
|
23
|
+
footerContent?: React.ReactNode;
|
|
24
|
+
parentSelector?: (...args: any) => HTMLElement;
|
|
25
|
+
}>> & {
|
|
26
|
+
setAppElement: (element: string | HTMLElement) => void;
|
|
27
|
+
};
|
|
28
|
+
args: {
|
|
29
|
+
ariaHideApp: false;
|
|
65
30
|
};
|
|
66
31
|
};
|
|
32
|
+
export default _default;
|
|
33
|
+
type Story = StoryObj<typeof NDSModal>;
|
|
34
|
+
export declare const Default: Story;
|
|
35
|
+
export declare const WithCloseButton: Story;
|
|
36
|
+
export declare const WithScrollingContent: Story;
|
|
37
|
+
export declare const WithScrollingContentWithoutFooterContent: Story;
|
|
38
|
+
export declare const WithNoTitle: Story;
|
|
39
|
+
export declare const WithNoFooterContent: Story;
|
|
40
|
+
export declare const WithCustomMaxWidth: Story;
|
|
41
|
+
export declare const WithSelect: Story;
|
|
42
|
+
export declare const WithSelectAndScrollingContent: Story;
|
|
43
|
+
export declare const WithParentSelector: Story;
|
|
44
|
+
export declare const ExampleControlledModal: Story;
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useState } from "react";
|
|
2
2
|
import { Modal as NDSModal, Button, QuietButton, PrimaryButton, ButtonGroup, Form, Input, Select, Text, DatePicker, } from "../index";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
NDSModal.setAppElement("#root");
|
|
6
|
-
const envProps = {
|
|
7
|
-
ariaHideApp: env === "test" ? false : undefined,
|
|
8
|
-
};
|
|
9
|
-
const Modal = (props) => React.createElement(NDSModal, Object.assign({}, envProps, props));
|
|
3
|
+
if (process.env.NODE_ENV !== "test")
|
|
4
|
+
NDSModal.setAppElement("#storybook-root");
|
|
10
5
|
const options = [
|
|
11
6
|
{ value: "accepted", label: "Accepted" },
|
|
12
7
|
{ value: "assigned", label: "Assigned to a line" },
|
|
@@ -16,105 +11,135 @@ const options = [
|
|
|
16
11
|
{ value: "progress", label: "In progress" },
|
|
17
12
|
{ value: "quarantine", label: "In quarantine" },
|
|
18
13
|
];
|
|
19
|
-
|
|
20
|
-
constructor(props) {
|
|
21
|
-
super(props);
|
|
22
|
-
this.state = {
|
|
23
|
-
isOpen: false,
|
|
24
|
-
};
|
|
25
|
-
this.openModal = this.openModal.bind(this);
|
|
26
|
-
this.closeModal = this.closeModal.bind(this);
|
|
27
|
-
}
|
|
28
|
-
openModal() {
|
|
29
|
-
this.setState({ isOpen: true });
|
|
30
|
-
}
|
|
31
|
-
closeModal() {
|
|
32
|
-
this.setState({ isOpen: false });
|
|
33
|
-
}
|
|
34
|
-
render() {
|
|
35
|
-
const { isOpen } = this.state;
|
|
36
|
-
const controlledModalButtons = (React.createElement(ButtonGroup, null,
|
|
37
|
-
React.createElement(PrimaryButton, { type: "submit", form: "myForm" }, "Add job to line"),
|
|
38
|
-
React.createElement(QuietButton, { onClick: this.closeModal }, "Cancel")));
|
|
39
|
-
return (React.createElement(React.Fragment, null,
|
|
40
|
-
React.createElement(Button, { onClick: this.openModal }, "Open Modal"),
|
|
41
|
-
React.createElement(Modal, { title: "Edit Profile", footerContent: controlledModalButtons, onRequestClose: this.closeModal, isOpen: isOpen, maxWidth: "456px" },
|
|
42
|
-
React.createElement(Form, { id: "myForm", mb: "x2" },
|
|
43
|
-
React.createElement(Input, { name: "name", id: "name", labelText: "Name" }),
|
|
44
|
-
React.createElement(Input, { type: "number", name: "age", id: "age", labelText: "Age" }),
|
|
45
|
-
React.createElement(DatePicker, { selected: new Date("Fri, 01 Jan 2019"), dateFormat: "MMMM d, yyyy", onChange: (val) => val, onInputChange: (val) => val })))));
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
const modalButtons = (React.createElement(ButtonGroup, null,
|
|
14
|
+
const ModalButtons = (React.createElement(ButtonGroup, null,
|
|
49
15
|
React.createElement(PrimaryButton, null, "Add job to line"),
|
|
50
16
|
React.createElement(QuietButton, null, "Cancel")));
|
|
51
17
|
export default {
|
|
52
18
|
title: "Components/Modal",
|
|
19
|
+
component: NDSModal,
|
|
20
|
+
args: {
|
|
21
|
+
ariaHideApp: process.env.NODE_ENV === "test" ? false : undefined,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
export const Default = {
|
|
25
|
+
args: {
|
|
26
|
+
children: "Content Content Content",
|
|
27
|
+
title: "Modal Title",
|
|
28
|
+
footerContent: ModalButtons,
|
|
29
|
+
onRequestClose: () => { },
|
|
30
|
+
},
|
|
53
31
|
};
|
|
54
|
-
export const
|
|
55
|
-
|
|
56
|
-
|
|
32
|
+
export const WithCloseButton = {
|
|
33
|
+
args: {
|
|
34
|
+
children: "Content Content Content",
|
|
35
|
+
title: "Modal Title",
|
|
36
|
+
footerContent: ModalButtons,
|
|
37
|
+
onRequestClose: () => { },
|
|
38
|
+
},
|
|
57
39
|
name: "with close button",
|
|
58
40
|
};
|
|
59
|
-
export const WithScrollingContent =
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
41
|
+
export const WithScrollingContent = {
|
|
42
|
+
args: {
|
|
43
|
+
title: "Modal Title",
|
|
44
|
+
footerContent: ModalButtons,
|
|
45
|
+
children: (React.createElement(React.Fragment, null,
|
|
46
|
+
React.createElement(Text, null, "Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content"),
|
|
47
|
+
React.createElement(Text, null, "Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content"),
|
|
48
|
+
React.createElement(Text, null, "Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content"),
|
|
49
|
+
React.createElement(Text, null, "Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content"),
|
|
50
|
+
React.createElement(Text, null, "Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content"),
|
|
51
|
+
React.createElement(Text, null, "Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content"))),
|
|
52
|
+
},
|
|
67
53
|
name: "with scrolling content",
|
|
68
54
|
};
|
|
69
|
-
export const WithScrollingContentWithoutFooterContent =
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
55
|
+
export const WithScrollingContentWithoutFooterContent = {
|
|
56
|
+
args: {
|
|
57
|
+
title: "Modal Title",
|
|
58
|
+
children: (React.createElement(React.Fragment, null,
|
|
59
|
+
React.createElement(Text, null, "Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content"),
|
|
60
|
+
React.createElement(Text, null, "Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content"),
|
|
61
|
+
React.createElement(Text, null, "Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content"),
|
|
62
|
+
React.createElement(Text, null, "Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content"),
|
|
63
|
+
React.createElement(Text, null, "Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content"),
|
|
64
|
+
React.createElement(Text, null, "Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content"))),
|
|
65
|
+
},
|
|
77
66
|
name: "with scrolling content without footer content",
|
|
78
67
|
};
|
|
79
|
-
export const WithNoTitle =
|
|
80
|
-
|
|
68
|
+
export const WithNoTitle = {
|
|
69
|
+
args: {
|
|
70
|
+
children: "Content Content Content",
|
|
71
|
+
footerContent: ModalButtons,
|
|
72
|
+
},
|
|
81
73
|
name: "with no title",
|
|
82
74
|
};
|
|
83
|
-
export const WithNoFooterContent =
|
|
84
|
-
|
|
75
|
+
export const WithNoFooterContent = {
|
|
76
|
+
args: {
|
|
77
|
+
children: "Content Content Content",
|
|
78
|
+
title: "Without footerContent",
|
|
79
|
+
onRequestClose: () => { },
|
|
80
|
+
},
|
|
85
81
|
name: "with no footerContent",
|
|
86
82
|
};
|
|
87
|
-
export const WithCustomMaxWidth =
|
|
88
|
-
|
|
83
|
+
export const WithCustomMaxWidth = {
|
|
84
|
+
args: {
|
|
85
|
+
children: "Content Content Content",
|
|
86
|
+
title: "Modal Title",
|
|
87
|
+
footerContent: ModalButtons,
|
|
88
|
+
maxWidth: "1000px",
|
|
89
|
+
},
|
|
89
90
|
name: "with custom maxWidth",
|
|
90
91
|
};
|
|
91
|
-
export const WithSelect =
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
export const WithSelect = {
|
|
93
|
+
args: {
|
|
94
|
+
title: "Edit Profile",
|
|
95
|
+
footerContent: ModalButtons,
|
|
96
|
+
maxWidth: "456px",
|
|
97
|
+
onRequestClose: () => { },
|
|
98
|
+
children: (React.createElement(Form, { id: "myForm", mb: "x2" },
|
|
99
|
+
React.createElement(Select, { maxHeight: "96px", placeholder: "Please select inventory status", options: options, labelText: "Inventory status" }))),
|
|
100
|
+
},
|
|
95
101
|
name: "with select",
|
|
96
102
|
};
|
|
97
|
-
export const WithSelectAndScrollingContent =
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
React.createElement(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
export const WithSelectAndScrollingContent = {
|
|
104
|
+
args: {
|
|
105
|
+
title: "Edit Profile",
|
|
106
|
+
footerContent: ModalButtons,
|
|
107
|
+
maxWidth: "456px",
|
|
108
|
+
onRequestClose: () => { },
|
|
109
|
+
children: (React.createElement(Form, { id: "myForm", mb: "x2" },
|
|
110
|
+
React.createElement(Input, { name: "name", id: "name", labelText: "Name" }),
|
|
111
|
+
React.createElement(Input, { type: "number", name: "age", id: "age", labelText: "Age" }),
|
|
112
|
+
React.createElement(Input, { name: "name", id: "name", labelText: "Name" }),
|
|
113
|
+
React.createElement(Input, { type: "number", name: "age", id: "age", labelText: "Age" }),
|
|
114
|
+
React.createElement(Input, { name: "name", id: "name", labelText: "Name" }),
|
|
115
|
+
React.createElement(Input, { type: "number", name: "age", id: "age", labelText: "Age" }),
|
|
116
|
+
React.createElement(Select, { maxHeight: "96px", placeholder: "Please select inventory status", options: options, labelText: "Inventory status" }))),
|
|
117
|
+
},
|
|
107
118
|
name: "with select and scrolling content",
|
|
108
119
|
};
|
|
109
|
-
export const WithParentSelector =
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
120
|
+
export const WithParentSelector = {
|
|
121
|
+
args: {
|
|
122
|
+
title: "Modal Title",
|
|
123
|
+
footerContent: ModalButtons,
|
|
124
|
+
parentSelector: () => document.getElementById("parent-selector"),
|
|
125
|
+
},
|
|
115
126
|
name: "with a parent selector",
|
|
127
|
+
render: (args) => (React.createElement("div", { id: "parent-selector" },
|
|
128
|
+
React.createElement(NDSModal, Object.assign({}, args), "Content"))),
|
|
116
129
|
};
|
|
117
|
-
export const ExampleControlledModal =
|
|
118
|
-
|
|
130
|
+
export const ExampleControlledModal = {
|
|
131
|
+
render: () => React.createElement(ModalExample, null),
|
|
119
132
|
name: "example controlled modal",
|
|
120
133
|
};
|
|
134
|
+
const ModalExample = () => {
|
|
135
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
136
|
+
return (React.createElement(React.Fragment, null,
|
|
137
|
+
React.createElement(Button, { onClick: () => setIsOpen(true) }, "Open Modal"),
|
|
138
|
+
React.createElement(NDSModal, { title: "Edit Profile", footerContent: React.createElement(ButtonGroup, null,
|
|
139
|
+
React.createElement(PrimaryButton, { type: "submit", form: "myForm" }, "Add job to line"),
|
|
140
|
+
React.createElement(QuietButton, { onClick: () => setIsOpen(false) }, "Cancel")), onRequestClose: () => setIsOpen(false), isOpen: isOpen, maxWidth: "456px" },
|
|
141
|
+
React.createElement(Form, { id: "myForm", mb: "x2" },
|
|
142
|
+
React.createElement(Input, { name: "name", id: "name", labelText: "Name" }),
|
|
143
|
+
React.createElement(Input, { type: "number", name: "age", id: "age", labelText: "Age" }),
|
|
144
|
+
React.createElement(DatePicker, { selected: new Date("Fri, 01 Jan 2019"), dateFormat: "MMMM d, yyyy", onChange: (val) => val, onInputChange: (val) => val })))));
|
|
145
|
+
};
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export declare const renderWithNDSProvider: (component: ReactNode, locale?: string) => import("@testing-library/react").RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement, HTMLElement>;
|