@nulogy/components 16.0.2 → 16.0.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/main.js +1 -0
- package/dist/main.js.map +1 -1
- package/dist/main.module.js +1 -0
- package/dist/main.module.js.map +1 -1
- package/dist/src/Alert/Alert.story.d.ts +1 -1
- package/dist/src/Alert/Alert.story.js +11 -0
- package/dist/src/AppTag/stories/AppTag.story.d.ts +2 -2
- package/dist/src/AppTag/stories/AppTag.story.js +6 -4
- package/dist/src/AppTag/stories/AppTag.usecases.story.d.ts +13 -10
- package/dist/src/AppTag/stories/AppTag.usecases.story.js +71 -51
- package/dist/src/AsyncSelect/AsyncSelect.graphql.story.js +4 -3
- package/dist/src/AsyncSelect/AsyncSelect.story.d.ts +17 -13
- package/dist/src/AsyncSelect/AsyncSelect.story.js +46 -23
- package/dist/src/BottomSheet/stories/BottomSheet.actions.story.d.ts +8 -1
- package/dist/src/BottomSheet/stories/BottomSheet.actions.story.js +22 -3
- package/dist/src/BottomSheet/stories/BottomSheet.features.story.d.ts +9 -2
- package/dist/src/BottomSheet/stories/BottomSheet.features.story.js +27 -12
- package/dist/src/BottomSheet/stories/BottomSheet.story.d.ts +7 -1
- package/dist/src/BottomSheet/stories/BottomSheet.story.js +20 -3
- package/dist/src/Box/Box.story.d.ts +22 -44
- package/dist/src/Box/Box.story.js +30 -30
- package/dist/src/BrandedNavBar/NavBar.story.d.ts +16 -28
- package/dist/src/BrandedNavBar/NavBar.story.js +41 -35
- package/dist/src/BrandedNavBar/SmallNavBar.story.d.ts +1 -1
- package/dist/src/Breadcrumbs/Breadcrumbs.story.d.ts +4 -8
- package/dist/src/Breadcrumbs/Breadcrumbs.story.js +4 -4
- package/dist/src/Button/Button.story.d.ts +14 -28
- package/dist/src/Button/Button.story.js +14 -14
- package/dist/src/Button/ControlIcon.story.js +1 -1
- package/dist/src/Button/IconicButton.story.d.ts +23 -45
- package/dist/src/Button/IconicButton.story.js +27 -25
- package/dist/src/ButtonGroup/ButtonGroup.story.d.ts +13 -23
- package/dist/src/ButtonGroup/ButtonGroup.story.js +10 -10
- package/dist/src/Card/Card.story.d.ts +3 -5
- package/dist/src/Card/Card.story.js +9 -7
- package/dist/src/Checkbox/Checkbox.story.d.ts +18 -34
- package/dist/src/Checkbox/Checkbox.story.js +28 -24
- package/dist/src/Checkbox/CheckboxGroup.story.d.ts +10 -20
- package/dist/src/Checkbox/CheckboxGroup.story.js +10 -10
- package/dist/src/DatePickers/stories/DatePicker.story.d.ts +9 -2
- package/dist/src/DatePickers/stories/DatePicker.story.js +43 -2
- package/dist/src/DatePickers/stories/MonthPicker.story.d.ts +8 -1
- package/dist/src/DatePickers/stories/MonthPicker.story.js +21 -2
- package/dist/src/DatePickers/stories/WeekPicker.story.d.ts +32 -4
- package/dist/src/DatePickers/stories/WeekPicker.story.js +57 -8
- package/dist/src/DateRange/DateRange.story.d.ts +16 -2
- package/dist/src/DateRange/DateRange.story.js +41 -3
- package/dist/src/DescriptionList/stories/DescriptionList.column.story.d.ts +1 -1
- package/dist/src/DescriptionList/stories/DescriptionList.column.story.js +10 -8
- package/dist/src/DescriptionList/stories/DescriptionList.group-min-width.story.d.ts +1 -1
- package/dist/src/DescriptionList/stories/DescriptionList.layout.story.d.ts +1 -1
- package/dist/src/DescriptionList/stories/DescriptionList.layout.story.js +12 -10
- package/dist/src/DescriptionList/stories/DescriptionList.playground.story.d.ts +1 -1
- package/dist/src/DescriptionList/stories/DescriptionList.story.d.ts +1 -0
- package/dist/src/DescriptionList/stories/DescriptionList.story.js +3 -0
- package/dist/src/DropdownMenu/DropdownMenu.story.d.ts +32 -32
- package/dist/src/DropdownMenu/DropdownMenu.story.js +58 -16
- package/dist/src/FieldLabel/FieldLabel.story.d.ts +2 -4
- package/dist/src/FieldLabel/FieldLabel.story.js +2 -2
- package/dist/src/Flex/Flex.story.d.ts +34 -68
- package/dist/src/Flex/Flex.story.js +36 -36
- package/dist/src/Form/Form.story.d.ts +8 -16
- package/dist/src/Form/Form.story.js +8 -8
- package/dist/src/Icon/Icon.story.d.ts +12 -24
- package/dist/src/Icon/Icon.story.js +15 -15
- package/dist/src/Input/Input.story.d.ts +16 -32
- package/dist/src/Input/Input.story.js +23 -23
- package/dist/src/Layout/Page.applicationFrame.story.d.ts +1 -1
- package/dist/src/Layout/Page.story.d.ts +1 -1
- package/dist/src/Layout/Sidebar.story.d.ts +1 -1
- package/dist/src/Link/Link.story.d.ts +16 -32
- package/dist/src/Link/Link.story.js +16 -17
- package/dist/src/List/List.story.d.ts +8 -16
- package/dist/src/List/List.story.js +8 -8
- package/dist/src/LoadingAnimation/LoadingAnimation.story.d.ts +4 -8
- package/dist/src/LoadingAnimation/LoadingAnimation.story.js +4 -4
- package/dist/src/MaybeTooltip/MaybeTooltip.story.d.ts +1 -1
- package/dist/src/Modal/Modal.story.d.ts +1 -1
- package/dist/src/Navigation/stories/Navigation.appSwitcher.story.d.ts +8 -1
- package/dist/src/Navigation/stories/Navigation.appSwitcher.story.js +19 -1
- package/dist/src/Navigation/stories/Navigation.logos.story.d.ts +2 -4
- package/dist/src/Navigation/stories/Navigation.logos.story.js +4 -4
- package/dist/src/Navigation/stories/Navigation.story.d.ts +7 -1
- package/dist/src/Navigation/stories/Navigation.story.js +145 -136
- package/dist/src/Navigation/stories/Navigation.userMenu.story.d.ts +8 -1
- package/dist/src/Navigation/stories/Navigation.userMenu.story.js +22 -1
- package/dist/src/Overlay/Overlay.story.d.ts +2 -4
- package/dist/src/Overlay/Overlay.story.js +2 -2
- package/dist/src/Pagination/Pagination.story.d.ts +14 -13
- package/dist/src/Pagination/Pagination.story.js +32 -11
- package/dist/src/Radio/Radio.story.d.ts +1 -1
- package/dist/src/Radio/Radio.story.js +44 -1
- package/dist/src/Radio/RadioGroup.story.d.ts +29 -21
- package/dist/src/Radio/RadioGroup.story.js +67 -14
- package/dist/src/RangeContainer/RangeContainer.story.d.ts +2 -4
- package/dist/src/RangeContainer/RangeContainer.story.js +2 -2
- package/dist/src/Select/Select.story.d.ts +37 -65
- package/dist/src/Select/Select.story.js +93 -49
- package/dist/src/StatusIndicator/StatusIndicator.story.d.ts +4 -8
- package/dist/src/StatusIndicator/StatusIndicator.story.js +4 -4
- package/dist/src/Switcher/Switcher.story.d.ts +8 -1
- package/dist/src/Switcher/Switcher.story.js +13 -1
- package/dist/src/Table/stories/BaseTable.story.d.ts +1 -1
- package/dist/src/Table/stories/BaseTable.story.js +1 -1
- package/dist/src/Table/stories/CustomContent.story.js +1 -1
- package/dist/src/Table/stories/Density.story.d.ts +4 -8
- package/dist/src/Table/stories/Density.story.js +4 -4
- package/dist/src/Table/stories/SortingColumnHeader.story.d.ts +1 -1
- package/dist/src/Table/stories/SortingColumnHeader.story.js +1 -1
- package/dist/src/Table/stories/Table.story.d.ts +1 -1
- package/dist/src/Table/stories/Table.story.js +37 -1
- package/dist/src/Table/stories/TableWithCustomSorting.story.d.ts +2 -4
- package/dist/src/Table/stories/TableWithCustomSorting.story.js +2 -2
- package/dist/src/Table/stories/TableWithExpandableRows.story.d.ts +4 -8
- package/dist/src/Table/stories/TableWithExpandableRows.story.js +5 -5
- package/dist/src/Table/stories/TableWithFiltering.story.d.ts +8 -8
- package/dist/src/Table/stories/TableWithFiltering.story.js +15 -4
- package/dist/src/Table/stories/TableWithSelectableRows.story.d.ts +8 -8
- package/dist/src/Table/stories/TableWithSelectableRows.story.js +22 -5
- package/dist/src/Table/stories/TableWithServerSidePagination.story.d.ts +2 -4
- package/dist/src/Table/stories/TableWithServerSidePagination.story.js +2 -2
- package/dist/src/Tabs/Tabs.story.d.ts +33 -33
- package/dist/src/Tabs/Tabs.story.js +52 -16
- package/dist/src/Textarea/Textarea.story.js +1 -1
- package/dist/src/TimePicker/TimePicker.js +2 -0
- package/dist/src/TimePicker/TimePicker.story.d.ts +24 -40
- package/dist/src/TimePicker/TimePicker.story.js +40 -27
- package/dist/src/TimeRange/TimeRange.story.d.ts +14 -20
- package/dist/src/TimeRange/TimeRange.story.js +34 -20
- package/dist/src/Toast/Toast.story.d.ts +24 -25
- package/dist/src/Toast/Toast.story.js +170 -142
- package/dist/src/ToastContainer/ToastContainer.story.d.ts +8 -1
- package/dist/src/ToastContainer/ToastContainer.story.js +13 -1
- package/dist/src/Toggle/Toggle.story.d.ts +25 -15
- package/dist/src/Toggle/Toggle.story.js +77 -43
- package/dist/src/Tooltip/Tooltip.story.d.ts +1 -1
- package/dist/src/Tooltip/Tooltip.story.js +16 -0
- package/dist/src/TopBar/stories/TopBar.story.d.ts +7 -1
- package/dist/src/TopBar/stories/TopBar.story.js +18 -1
- package/dist/src/TruncatedText/TruncatedText.story.d.ts +29 -34
- package/dist/src/TruncatedText/TruncatedText.story.js +46 -19
- package/dist/src/Type/Text.story.d.ts +10 -20
- package/dist/src/Type/Text.story.js +10 -10
- package/dist/src/Validation/InlineValidation.story.d.ts +6 -12
- package/dist/src/Validation/InlineValidation.story.js +6 -6
- package/dist/src/VisualTests/Select.story.d.ts +12 -24
- package/dist/src/VisualTests/Select.story.js +19 -19
- package/dist/src/pages/ErrorPage.story.d.ts +3 -5
- package/dist/src/pages/ErrorPage.story.js +10 -10
- package/dist/src/pages/LoginPage.story.d.ts +8 -16
- package/dist/src/pages/LoginPage.story.js +8 -8
- package/package.json +16 -24
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { expect, userEvent, waitFor, within } from "storybook/test";
|
|
2
3
|
import { Alert, Flex } from "../index";
|
|
3
4
|
import { Link } from "../Link";
|
|
4
5
|
export default {
|
|
@@ -15,6 +16,16 @@ export const WithACloseButton = {
|
|
|
15
16
|
children: "This is an alert with a close button",
|
|
16
17
|
},
|
|
17
18
|
name: "With a close button",
|
|
19
|
+
play: async ({ canvasElement, step }) => {
|
|
20
|
+
const canvas = within(canvasElement);
|
|
21
|
+
await step("shows an alert", async () => {
|
|
22
|
+
await expect(canvas.getByRole("alert")).toBeVisible();
|
|
23
|
+
});
|
|
24
|
+
await step("hides the alert when closed", async () => {
|
|
25
|
+
await userEvent.click(canvas.getByLabelText("Close"));
|
|
26
|
+
await waitFor(() => expect(canvas.queryByRole("alert")).not.toBeInTheDocument());
|
|
27
|
+
});
|
|
28
|
+
},
|
|
18
29
|
};
|
|
19
30
|
export const WithATitle = {
|
|
20
31
|
args: {
|
|
@@ -6,6 +6,6 @@ declare const _default: {
|
|
|
6
6
|
export default _default;
|
|
7
7
|
export declare const Default: () => import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export declare const WithoutATooltip: {
|
|
9
|
-
()
|
|
10
|
-
|
|
9
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
name: string;
|
|
11
11
|
};
|
|
@@ -25,8 +25,10 @@ export const Default = () => {
|
|
|
25
25
|
}));
|
|
26
26
|
return _jsx(Table, { rowHovers: false, columns: columns, rows: rows });
|
|
27
27
|
};
|
|
28
|
-
export const WithoutATooltip =
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
export const WithoutATooltip = {
|
|
29
|
+
render: () => {
|
|
30
|
+
const appNames = Object.keys(APP_DISPLAY_NAMES);
|
|
31
|
+
return (_jsxs(Flex, { flexDirection: "column", gap: "x2", children: [_jsx(Heading1, { compact: true, children: "AppTag without tooltip" }), _jsx(Flex, { gap: "x2", children: appNames.map((appName) => (_jsx(AppTag, { app: appName, type: "active", hideTooltip: true }, appName))) })] }));
|
|
32
|
+
},
|
|
33
|
+
name: "Without a tooltip",
|
|
31
34
|
};
|
|
32
|
-
WithoutATooltip.storyName = "Without a tooltip";
|
|
@@ -5,22 +5,25 @@ declare const _default: {
|
|
|
5
5
|
};
|
|
6
6
|
export default _default;
|
|
7
7
|
export declare const WithALink: {
|
|
8
|
-
()
|
|
9
|
-
|
|
8
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
name: string;
|
|
10
10
|
};
|
|
11
11
|
export declare const WithText: {
|
|
12
|
-
()
|
|
13
|
-
|
|
12
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
name: string;
|
|
14
14
|
};
|
|
15
15
|
export declare const WithMessages: {
|
|
16
|
-
()
|
|
17
|
-
|
|
16
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
name: string;
|
|
18
18
|
};
|
|
19
19
|
export declare const WithTooltip: {
|
|
20
|
-
()
|
|
21
|
-
storyName: string;
|
|
20
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
22
21
|
};
|
|
23
22
|
export declare const InsideAModal: {
|
|
24
|
-
()
|
|
25
|
-
|
|
23
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
name: string;
|
|
25
|
+
play: ({ canvasElement: _canvasElement, step }: {
|
|
26
|
+
canvasElement: any;
|
|
27
|
+
step: any;
|
|
28
|
+
}) => Promise<void>;
|
|
26
29
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { expect, screen, userEvent, waitFor } from "storybook/test";
|
|
2
3
|
import { AppTag } from "..";
|
|
3
4
|
import { Flex, InlineFlex } from "../../Flex";
|
|
4
5
|
import { Icon } from "../../Icon";
|
|
@@ -14,59 +15,78 @@ export default {
|
|
|
14
15
|
title: "Components/AppTag/Usecases",
|
|
15
16
|
component: AppTag,
|
|
16
17
|
};
|
|
17
|
-
export const WithALink =
|
|
18
|
-
|
|
18
|
+
export const WithALink = {
|
|
19
|
+
render: () => {
|
|
20
|
+
return (_jsxs(Flex, { flexDirection: "column", gap: "x2", children: [_jsxs(Flex, { flexDirection: "column", gap: "x1", children: [_jsx(Heading1, { compact: true, children: "AppTag with Link" }), _jsxs(Text, { fontSize: "sm", children: ["These examples show the ", _jsx(Code, { children: "Link" }), " component used with the ", _jsx(Code, { children: "forApp" }), " prop. See the", " ", _jsx(Link, { href: "/?path=/story/components-link--with-app-tag", children: "With AppTag" }), " Link story for more examples."] })] }), _jsxs(InlineFlex, { flexDirection: "column", gap: "x2", children: [_jsx(Link, { href: "#app", forApp: "digital-quality-inspection", children: "POLI-120392" }), _jsx(Link, { underline: false, href: "#app", forApp: "supplier-collaboration", children: "POLI-120392" })] })] }));
|
|
21
|
+
},
|
|
22
|
+
name: "With a Link",
|
|
19
23
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
export const WithText = {
|
|
25
|
+
render: () => {
|
|
26
|
+
return (_jsxs(InlineFlex, { flexDirection: "column", gap: "x2", children: [_jsxs(InlineFlex, { alignItems: "center", gap: "half", children: [_jsx(Text, { children: "Entity reference" }), _jsx(AppTag, { app: "digital-quality-inspection", type: "active" })] }), _jsxs(InlineFlex, { alignItems: "center", gap: "half", children: [_jsx(Text, { color: "midGrey", children: "Inactive entity reference" }), _jsx(AppTag, { app: "supplier-collaboration", type: "inactive" })] })] }));
|
|
27
|
+
},
|
|
28
|
+
name: "With text",
|
|
23
29
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
30
|
+
export const WithMessages = {
|
|
31
|
+
render: () => {
|
|
32
|
+
const columns = [
|
|
33
|
+
{ label: "Use-case", dataKey: "type", width: "20%" },
|
|
34
|
+
{ label: "Example", dataKey: "example", width: "80%" },
|
|
35
|
+
];
|
|
36
|
+
const rows = [
|
|
37
|
+
{
|
|
38
|
+
id: "status-indicator",
|
|
39
|
+
type: "Using a StatusIndicator",
|
|
40
|
+
example: (_jsxs(InlineFlex, { alignItems: "center", gap: "half", children: [_jsx(AppTag, { app: "digital-quality-inspection", type: "active" }), _jsx(StatusIndicator, { type: "informative", children: "New" })] })),
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: "custom-component",
|
|
44
|
+
type: "Using a custom component",
|
|
45
|
+
example: (_jsxs(InlineFlex, { alignItems: "center", gap: "half", children: [_jsx(AppTag, { app: "digital-quality-inspection", type: "active" }), _jsxs(InlineFlex, { alignItems: "center", gap: "x0_25", bg: "lightRed", pl: "x0_5", pr: "x1", borderRadius: "rounded", children: [_jsx(Icon, { icon: "error", size: "x2", color: "red" }), _jsx(Text, { fontSize: "smaller", letterSpacing: "0.05em", textTransform: "uppercase", fontWeight: "medium", color: "red", children: "Transaction failed" })] })] })),
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: "icon-text",
|
|
49
|
+
type: "Using Icon and Text",
|
|
50
|
+
example: (_jsxs(InlineFlex, { alignItems: "center", gap: "half", children: [_jsx(AppTag, { app: "digital-quality-inspection", type: "active" }), _jsxs(InlineFlex, { alignItems: "center", gap: "x0_25", pl: "x0_5", pr: "x1", borderRadius: "rounded", children: [_jsx(Icon, { icon: "warning", size: "x2", color: "yellow" }), _jsx(Text, { fontSize: "small", color: "black", children: "Requires attention" })] })] })),
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: "text-icon",
|
|
54
|
+
type: "Using Text and Icon",
|
|
55
|
+
example: (_jsxs(InlineFlex, { alignItems: "center", gap: "half", children: [_jsx(AppTag, { app: "digital-quality-inspection", type: "active" }), _jsxs(InlineFlex, { alignItems: "center", gap: "x0_75", children: [_jsx(Text, { fontSize: "small", children: "Processing" }), _jsx(Icon, { icon: "loading" })] })] })),
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: "text-only",
|
|
59
|
+
type: "Using Text",
|
|
60
|
+
example: (_jsxs(InlineFlex, { alignItems: "center", gap: "half", children: [_jsx(AppTag, { app: "digital-quality-inspection", type: "active" }), _jsx(Text, { fontSize: "small", children: "Processed" })] })),
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: "truncated-text",
|
|
64
|
+
type: "Using TruncatedText",
|
|
65
|
+
example: (_jsxs(InlineFlex, { alignItems: "center", gap: "half", children: [_jsx(AppTag, { app: "digital-quality-inspection", type: "active" }), _jsx(TruncatedText, { fontSize: "small", color: "red", children: "Transaction failed because the supplier did not provide the required information." })] })),
|
|
66
|
+
},
|
|
67
|
+
];
|
|
68
|
+
return (_jsx(Flex, { flexDirection: "column", gap: "x2", children: _jsx(Table, { rowHovers: false, columns: columns, rows: rows }) }));
|
|
69
|
+
},
|
|
70
|
+
name: "With messages",
|
|
63
71
|
};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
72
|
+
export const WithTooltip = {
|
|
73
|
+
render: () => {
|
|
74
|
+
return (_jsx(Flex, { flexDirection: "column", gap: "x2", children: _jsx(Tooltip, { tooltip: "This is a tooltip", children: _jsxs(InlineFlex, { alignItems: "center", gap: "half", alignSelf: "flex-start", children: [_jsx(Text, { children: "Entity reference" }), _jsx(AppTag, { app: "digital-quality-inspection", type: "active" })] }) }) }));
|
|
75
|
+
},
|
|
67
76
|
};
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
77
|
+
export const InsideAModal = {
|
|
78
|
+
render: () => {
|
|
79
|
+
return (_jsx(Modal, { title: "Modal Title", children: _jsxs(Flex, { flexDirection: "column", gap: "half", children: [_jsx(Text, { children: "The point of this test is to see if the tooltip is visible and shown over the modal and its overlay" }), _jsx(AppTag, { app: "digital-quality-inspection", type: "active" })] }) }));
|
|
80
|
+
},
|
|
81
|
+
name: "Inside a Modal",
|
|
82
|
+
play: async ({ canvasElement: _canvasElement, step }) => {
|
|
83
|
+
await step("shows the modal with the app tag", async () => {
|
|
84
|
+
await expect(screen.getByRole("dialog")).toBeVisible();
|
|
85
|
+
await expect(screen.getByText("DQI")).toBeVisible();
|
|
86
|
+
});
|
|
87
|
+
await step("shows a tooltip with the app name on hover", async () => {
|
|
88
|
+
await userEvent.hover(screen.getByText("DQI"));
|
|
89
|
+
await waitFor(() => expect(screen.getByRole("tooltip")).toHaveTextContent("Digital Quality Inspection"));
|
|
90
|
+
});
|
|
91
|
+
},
|
|
71
92
|
};
|
|
72
|
-
InsideAModal.storyName = "Inside a Modal";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { gql
|
|
3
|
-
import {
|
|
2
|
+
import { gql } from "@apollo/client";
|
|
3
|
+
import { useLazyQuery } from "@apollo/client/react";
|
|
4
|
+
import { MockedProvider } from "@apollo/client/testing/react";
|
|
4
5
|
import { useCallback } from "react";
|
|
5
6
|
import { AsyncSelect } from "../index";
|
|
6
7
|
export default {
|
|
@@ -49,4 +50,4 @@ const AsyncSelectWithApollo = () => {
|
|
|
49
50
|
}, [data, getCountries]);
|
|
50
51
|
return _jsx(AsyncSelect, { placeholder: "Search for a country", loadOptions: loadOptions, labelText: "Country" });
|
|
51
52
|
};
|
|
52
|
-
export const WithApolloClientExample = () => (_jsx(MockedProvider, { mocks: mocks,
|
|
53
|
+
export const WithApolloClientExample = () => (_jsx(MockedProvider, { mocks: mocks, children: _jsx(AsyncSelectWithApollo, {}) }));
|
|
@@ -4,24 +4,28 @@ declare const _default: {
|
|
|
4
4
|
export default _default;
|
|
5
5
|
export declare const Default: () => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export declare const WithDefaultOptions: {
|
|
7
|
-
()
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
name: string;
|
|
9
|
+
play: ({ canvasElement, step }: {
|
|
10
|
+
canvasElement: any;
|
|
11
|
+
step: any;
|
|
12
|
+
}) => Promise<void>;
|
|
11
13
|
};
|
|
12
14
|
export declare const WithADefaultValue: {
|
|
13
|
-
()
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
name: string;
|
|
17
|
+
};
|
|
18
|
+
export declare const Multiselect: {
|
|
19
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
play: ({ canvasElement, step }: {
|
|
21
|
+
canvasElement: any;
|
|
22
|
+
step: any;
|
|
23
|
+
}) => Promise<void>;
|
|
17
24
|
};
|
|
18
|
-
export declare const Multiselect: () => import("react/jsx-runtime").JSX.Element;
|
|
19
25
|
export declare const WithAClearButton: () => import("react/jsx-runtime").JSX.Element;
|
|
20
26
|
export declare const UsingRefToControlFocus: {
|
|
21
|
-
()
|
|
22
|
-
|
|
23
|
-
name: string;
|
|
24
|
-
};
|
|
27
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
name: string;
|
|
25
29
|
};
|
|
26
30
|
export declare const Controlled: () => import("react/jsx-runtime").JSX.Element;
|
|
27
31
|
export declare const WithIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useRef } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { expect, screen, userEvent, waitFor, within } from "storybook/test";
|
|
4
|
+
import { action } from "storybook/actions";
|
|
4
5
|
import { useState } from "react";
|
|
5
6
|
import { AsyncSelect, Button, Flex } from "../index";
|
|
6
7
|
import { loadMatchingProvinces } from "./fixtures";
|
|
@@ -8,33 +9,55 @@ export default {
|
|
|
8
9
|
title: "Components/AsyncSelect",
|
|
9
10
|
};
|
|
10
11
|
export const Default = () => (_jsx(AsyncSelect, { placeholder: "Enter a province", onChange: action("selection changed"), onBlur: action("blurred"), className: "Select", classNamePrefix: "SelectTest", labelText: "Province", onInputChange: action("typed input value changed"), loadOptions: loadMatchingProvinces }));
|
|
11
|
-
export const WithDefaultOptions =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
export const WithDefaultOptions = {
|
|
13
|
+
render: () => (_jsx(AsyncSelect, { placeholder: "Enter a province", onChange: action("selection changed"), onBlur: action("blurred"), className: "Select", classNamePrefix: "SelectTest", labelText: "Province", onInputChange: action("typed input value changed"), isClearable: true, defaultOptions: [
|
|
14
|
+
{
|
|
15
|
+
value: "ON",
|
|
16
|
+
label: "Ontario",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
value: "QC",
|
|
20
|
+
label: "Quebec",
|
|
21
|
+
},
|
|
22
|
+
], loadOptions: loadMatchingProvinces })),
|
|
22
23
|
name: "With default options",
|
|
24
|
+
play: async ({ canvasElement, step }) => {
|
|
25
|
+
const canvas = within(canvasElement);
|
|
26
|
+
await step("shows the dropdown arrow when there are default options", async () => {
|
|
27
|
+
await expect(canvas.getByTestId("select-arrow")).toBeVisible();
|
|
28
|
+
});
|
|
29
|
+
},
|
|
23
30
|
};
|
|
24
|
-
export const WithADefaultValue =
|
|
25
|
-
|
|
31
|
+
export const WithADefaultValue = {
|
|
32
|
+
render: () => (_jsx(AsyncSelect, { placeholder: "Enter a province", onChange: action("selection changed"), onBlur: action("blurred"), className: "Select", classNamePrefix: "SelectTest", labelText: "Province", defaultValue: "Ontario", onInputChange: action("typed input value changed"), loadOptions: loadMatchingProvinces })),
|
|
26
33
|
name: "With a default value",
|
|
27
34
|
};
|
|
28
|
-
export const Multiselect =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
export const Multiselect = {
|
|
36
|
+
render: () => (_jsx(AsyncSelect, { placeholder: "Enter a province", onChange: action("selection changed"), onBlur: action("blurred"), className: "Select", classNamePrefix: "SelectTest", labelText: "Provinces", multiselect: true, onInputChange: action("typed input value changed"), loadOptions: loadMatchingProvinces })),
|
|
37
|
+
play: async ({ canvasElement, step }) => {
|
|
38
|
+
const canvas = within(canvasElement);
|
|
39
|
+
await step("can select multiple values", async () => {
|
|
40
|
+
await userEvent.click(canvas.getByTestId("select-container"));
|
|
41
|
+
await userEvent.type(canvas.getByTestId("select-input"), "on");
|
|
42
|
+
await waitFor(() => expect(screen.getByText("Ontario")).toBeInTheDocument());
|
|
43
|
+
await userEvent.keyboard("{Enter}");
|
|
44
|
+
await expect(canvas.getByTestId("select-container")).toHaveTextContent("Ontario");
|
|
45
|
+
await userEvent.type(canvas.getByTestId("select-input"), "qu");
|
|
46
|
+
await waitFor(() => expect(screen.getByText("Quebec")).toBeInTheDocument());
|
|
47
|
+
await userEvent.keyboard("{Enter}");
|
|
48
|
+
await expect(canvas.getByTestId("select-container")).toHaveTextContent("Quebec");
|
|
49
|
+
});
|
|
50
|
+
},
|
|
36
51
|
};
|
|
37
|
-
|
|
52
|
+
export const WithAClearButton = () => (_jsx(AsyncSelect, { placeholder: "Enter a province", onChange: action("selection changed"), onBlur: action("blurred"), className: "Select", classNamePrefix: "SelectTest", labelText: "Provinces", isClearable: true, onInputChange: action("typed input value changed"), loadOptions: loadMatchingProvinces }));
|
|
53
|
+
export const UsingRefToControlFocus = {
|
|
54
|
+
render: () => {
|
|
55
|
+
const ref = useRef(null);
|
|
56
|
+
const handleClick = () => {
|
|
57
|
+
ref.current.focus();
|
|
58
|
+
};
|
|
59
|
+
return (_jsxs(Flex, { gap: "x2", flexDirection: "column", children: [_jsx(AsyncSelect, { ref: ref, placeholder: "Enter a province", onChange: action("selection changed"), onBlur: action("blurred"), className: "Select", classNamePrefix: "SelectTest", labelText: "Province", defaultValue: "Ontario", onInputChange: action("typed input value changed"), loadOptions: loadMatchingProvinces }), _jsx(Button, { onClick: handleClick, children: "Focus the Input" })] }));
|
|
60
|
+
},
|
|
38
61
|
name: "using ref to control focus",
|
|
39
62
|
};
|
|
40
63
|
export const Controlled = () => {
|
|
@@ -8,5 +8,12 @@ declare const _default: {
|
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
10
|
export default _default;
|
|
11
|
-
export declare const WithAHiddenCloseButton:
|
|
11
|
+
export declare const WithAHiddenCloseButton: {
|
|
12
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
name: string;
|
|
14
|
+
play: ({ canvasElement, step }: {
|
|
15
|
+
canvasElement: any;
|
|
16
|
+
step: any;
|
|
17
|
+
}) => Promise<void>;
|
|
18
|
+
};
|
|
12
19
|
export declare const WithButtons: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from "react";
|
|
3
|
+
import { expect, screen, userEvent, waitFor, within } from "storybook/test";
|
|
3
4
|
import { Button, PrimaryButton, QuietButton } from "../../Button";
|
|
4
5
|
import { Placeholder } from "../../utils/story/placeholder";
|
|
5
6
|
import BottomSheet from "../BottomSheet";
|
|
@@ -10,9 +11,27 @@ export default {
|
|
|
10
11
|
chromatic: { delay: 3000 },
|
|
11
12
|
},
|
|
12
13
|
};
|
|
13
|
-
export const WithAHiddenCloseButton =
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
export const WithAHiddenCloseButton = {
|
|
15
|
+
render: () => {
|
|
16
|
+
const [isOpen, setIsOpen] = React.useState(true);
|
|
17
|
+
return (_jsxs(_Fragment, { children: [_jsx(Button, { onClick: () => setIsOpen(true), children: "Open Sheet" }), _jsx(BottomSheet, { title: "User Feedback", helpText: "Please provide your feedback to help us improve our services", isOpen: isOpen, onClose: () => setIsOpen(false), primaryAction: ({ onClose }) => _jsx(PrimaryButton, { onClick: onClose, children: "Submit" }), hideCloseButton: true, children: _jsx(Placeholder, {}) })] }));
|
|
18
|
+
},
|
|
19
|
+
name: "With a hidden close button",
|
|
20
|
+
play: async ({ canvasElement, step }) => {
|
|
21
|
+
const canvas = within(canvasElement);
|
|
22
|
+
await step("is open initially without a close button", async () => {
|
|
23
|
+
await waitFor(() => expect(screen.getByRole("dialog")).toBeVisible());
|
|
24
|
+
await expect(screen.queryByText("Close")).not.toBeInTheDocument();
|
|
25
|
+
});
|
|
26
|
+
await step("can be closed using primary action", async () => {
|
|
27
|
+
await userEvent.click(screen.getByText("Submit"));
|
|
28
|
+
await waitFor(() => expect(screen.queryByRole("dialog")).not.toBeInTheDocument());
|
|
29
|
+
});
|
|
30
|
+
await step("opens when trigger button is clicked", async () => {
|
|
31
|
+
await userEvent.click(canvas.getByText("Open Sheet"));
|
|
32
|
+
await waitFor(() => expect(screen.getByRole("dialog")).toBeVisible());
|
|
33
|
+
});
|
|
34
|
+
},
|
|
16
35
|
};
|
|
17
36
|
export const WithButtons = () => {
|
|
18
37
|
const [isOpen, setIsOpen] = React.useState(true);
|
|
@@ -10,10 +10,17 @@ declare const _default: {
|
|
|
10
10
|
export default _default;
|
|
11
11
|
export declare const WithCustomWidths: () => import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
export declare const WithAnApplicationFrame: {
|
|
13
|
-
()
|
|
13
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
parameters: {
|
|
15
15
|
layout: string;
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
|
-
export declare const DisableCloseOnOverlayClick:
|
|
18
|
+
export declare const DisableCloseOnOverlayClick: {
|
|
19
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
name: string;
|
|
21
|
+
play: ({ canvasElement: _canvasElement, step }: {
|
|
22
|
+
canvasElement: any;
|
|
23
|
+
step: any;
|
|
24
|
+
}) => Promise<void>;
|
|
25
|
+
};
|
|
19
26
|
export declare const AdvancedUsage: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from "react";
|
|
3
|
+
import { expect, screen, userEvent, waitFor } from "storybook/test";
|
|
3
4
|
import { Box } from "../../Box";
|
|
4
5
|
import { Button, IconicButton } from "../../Button";
|
|
5
6
|
import { Flex } from "../../Flex";
|
|
@@ -24,19 +25,33 @@ export const WithCustomWidths = () => {
|
|
|
24
25
|
const [isOpen, setIsOpen] = React.useState(true);
|
|
25
26
|
return (_jsxs(_Fragment, { children: [_jsx(Button, { onClick: () => setIsOpen(true), children: "Open Sheet" }), _jsx(BottomSheet, { "aria-label": "Example BottomSheet", title: "Edit Profile", sheetWidth: { extraSmall: "100%", small: 480, medium: 640, large: 768 }, contentWidth: { small: 320, medium: 420, large: 600 }, isOpen: isOpen, onClose: () => setIsOpen(false), children: _jsx(Placeholder, {}) })] }));
|
|
26
27
|
};
|
|
27
|
-
export const WithAnApplicationFrame =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
export const WithAnApplicationFrame = {
|
|
29
|
+
render: () => {
|
|
30
|
+
const [isOpen, setIsOpen] = React.useState(true);
|
|
31
|
+
const navBar = (_jsxs(TopBar.Root, { children: [_jsx(TopBar.BackLink, { href: "/cycle-counts", children: "Cycle counts" }), _jsx(TopBar.PageTitle, { children: "Cycle count #3992" }), _jsx(TopBar.Menu, { children: _jsx(TopBar.MenuItem, { children: _jsx(TopBar.MenuItemLink, { title: "Home", description: "Go to the home page", icon: "home", href: "/home" }) }) })] }));
|
|
32
|
+
return (_jsx(ApplicationFrame, { navBar: navBar, children: _jsxs(Page, { children: [_jsx(Button, { onClick: () => setIsOpen(true), children: "Open Sheet" }), _jsx(BottomSheet, { "aria-label": "Example BottomSheet", title: "Edit Profile", helpText: "Update your profile information to access exclusive features.", isOpen: isOpen, onClose: () => setIsOpen(false), children: _jsx(Placeholder, {}) })] }) }));
|
|
33
|
+
},
|
|
34
|
+
parameters: {
|
|
35
|
+
layout: "fullscreen",
|
|
36
|
+
},
|
|
34
37
|
};
|
|
35
|
-
export const DisableCloseOnOverlayClick =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
export const DisableCloseOnOverlayClick = {
|
|
39
|
+
render: () => {
|
|
40
|
+
const [isOpen, setIsOpen] = React.useState(true);
|
|
41
|
+
return (_jsxs(Box, { children: [_jsx(Button, { onClick: () => setIsOpen(true), children: "Open Sheet" }), _jsx(BottomSheet, { disableCloseOnOverlayClick: true, "aria-label": "Example BottomSheet", title: "Disabled overlay", helpText: "This BottomSheet can not be dismissed by clicking on the overlay", isOpen: isOpen, onClose: () => {
|
|
42
|
+
setIsOpen(false);
|
|
43
|
+
}, children: _jsx(Placeholder, {}) })] }));
|
|
44
|
+
},
|
|
45
|
+
name: "Disable close on overlay click",
|
|
46
|
+
play: async ({ canvasElement: _canvasElement, step }) => {
|
|
47
|
+
await step("is open initially", async () => {
|
|
48
|
+
await waitFor(() => expect(screen.getByRole("dialog")).toBeVisible(), { timeout: 3000 });
|
|
49
|
+
});
|
|
50
|
+
await step("closes when close button is clicked", async () => {
|
|
51
|
+
await userEvent.click(screen.getByText("Close"));
|
|
52
|
+
await waitFor(() => expect(screen.queryByRole("dialog")).not.toBeInTheDocument());
|
|
53
|
+
});
|
|
54
|
+
},
|
|
40
55
|
};
|
|
41
56
|
export const AdvancedUsage = () => {
|
|
42
57
|
const [isOpen, setIsOpen] = React.useState(true);
|
|
@@ -8,4 +8,10 @@ declare const _default: {
|
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
10
|
export default _default;
|
|
11
|
-
export declare const BasicUsage:
|
|
11
|
+
export declare const BasicUsage: {
|
|
12
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
play: ({ canvasElement, step }: {
|
|
14
|
+
canvasElement: any;
|
|
15
|
+
step: any;
|
|
16
|
+
}) => Promise<void>;
|
|
17
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from "react";
|
|
3
|
+
import { expect, screen, userEvent, waitFor, within } from "storybook/test";
|
|
3
4
|
import { Button } from "../../Button";
|
|
4
5
|
import { Placeholder } from "../../utils/story/placeholder";
|
|
5
6
|
import BottomSheet from "../BottomSheet";
|
|
@@ -10,7 +11,23 @@ export default {
|
|
|
10
11
|
chromatic: { delay: 3000 },
|
|
11
12
|
},
|
|
12
13
|
};
|
|
13
|
-
export const BasicUsage =
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
export const BasicUsage = {
|
|
15
|
+
render: () => {
|
|
16
|
+
const [isOpen, setIsOpen] = React.useState(true);
|
|
17
|
+
return (_jsxs(_Fragment, { children: [_jsx(Button, { onClick: () => setIsOpen(true), children: "Open Sheet" }), _jsx(BottomSheet, { title: "Edit Profile", isOpen: isOpen, onClose: () => setIsOpen(false), children: _jsx(Placeholder, {}) })] }));
|
|
18
|
+
},
|
|
19
|
+
play: async ({ canvasElement, step }) => {
|
|
20
|
+
const canvas = within(canvasElement);
|
|
21
|
+
await step("is open initially", async () => {
|
|
22
|
+
await waitFor(() => expect(screen.getByRole("dialog")).toBeVisible());
|
|
23
|
+
});
|
|
24
|
+
await step("closes when Close button is clicked", async () => {
|
|
25
|
+
await userEvent.click(screen.getByText("Close"));
|
|
26
|
+
await waitFor(() => expect(screen.queryByRole("dialog")).not.toBeInTheDocument());
|
|
27
|
+
});
|
|
28
|
+
await step("opens when trigger button is clicked", async () => {
|
|
29
|
+
await userEvent.click(canvas.getByText("Open Sheet"));
|
|
30
|
+
await waitFor(() => expect(screen.getByRole("dialog")).toBeVisible());
|
|
31
|
+
});
|
|
32
|
+
},
|
|
16
33
|
};
|