@nulogy/components 16.0.1 → 16.0.3
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 +46 -59
- package/dist/main.js.map +1 -1
- package/dist/main.module.js +46 -59
- 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.story.d.ts +17 -13
- package/dist/src/AsyncSelect/AsyncSelect.story.js +46 -23
- package/dist/src/BottomSheet/BottomSheet.parts.d.ts +2 -2
- package/dist/src/BottomSheet/BottomSheet.styled.d.ts +10 -6
- 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.d.ts +12 -13
- package/dist/src/Box/Box.story.d.ts +22 -44
- package/dist/src/Box/Box.story.js +30 -30
- package/dist/src/BrandedNavBar/DesktopMenu.d.ts +3 -1
- package/dist/src/BrandedNavBar/NavBar.js +2 -2
- 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/DangerButton.d.ts +3 -1
- package/dist/src/Button/IconicButton.story.d.ts +23 -45
- package/dist/src/Button/IconicButton.story.js +27 -25
- package/dist/src/Button/PrimaryButton.d.ts +3 -1
- package/dist/src/Button/QuietButton.d.ts +3 -1
- 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/DateRange/EndTime.d.ts +5 -7
- package/dist/src/DateRange/StartTime.d.ts +5 -7
- 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/DescriptionList/stories/fixtures.d.ts +2 -2
- package/dist/src/DropdownMenu/DropdownMenu.story.d.ts +32 -32
- package/dist/src/DropdownMenu/DropdownMenu.story.js +58 -16
- package/dist/src/DropdownMenu/DropdownMenuContainer.d.ts +1 -1
- package/dist/src/DropdownMenu/DropdownText.d.ts +1 -1
- package/dist/src/FieldLabel/FieldLabel.story.d.ts +2 -4
- package/dist/src/FieldLabel/FieldLabel.story.js +2 -2
- package/dist/src/FieldLabel/HelpText.d.ts +1 -1
- 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.d.ts +6 -2
- 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.d.ts +5 -3
- package/dist/src/Modal/Modal.js +2 -2
- package/dist/src/Modal/Modal.story.d.ts +2 -24
- package/dist/src/Modal/ModalCloseButton.d.ts +4 -2
- package/dist/src/Modal/ModalContent.d.ts +1 -1
- package/dist/src/Navigation/components/AppSwitcher/parts/Item.d.ts +3 -1
- package/dist/src/Navigation/components/AppSwitcher/parts/index.d.ts +15 -7
- package/dist/src/Navigation/components/DesktopNav/parts/MoreMenuItem.d.ts +5 -1
- package/dist/src/Navigation/components/MenuSubItem/parts/styled.d.ts +17 -5
- package/dist/src/Navigation/components/MobileNav/parts/styled.d.ts +10 -4
- package/dist/src/Navigation/components/UserMenu/UserMenu.d.ts +5 -1
- package/dist/src/Navigation/components/UserMenu/parts/styled.d.ts +6 -2
- package/dist/src/Navigation/components/shared/NavigationMenuContent.d.ts +5 -1
- package/dist/src/Navigation/components/shared/NavigationMenuItem.d.ts +3 -1
- package/dist/src/Navigation/components/shared/components.d.ts +35 -9
- 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 +13 -15
- 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/Summary/Summary.d.ts +1 -2
- package/dist/src/Summary/Summary.js +2 -2
- package/dist/src/Summary/SummaryContext.d.ts +3 -1
- package/dist/src/Summary/SummaryContext.js +2 -2
- package/dist/src/Summary/SummaryItem.d.ts +1 -1
- package/dist/src/Summary/SummaryItem.js +2 -2
- package/dist/src/Switcher/Switcher.d.ts +2 -2
- package/dist/src/Switcher/Switcher.js +2 -2
- 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/TabScrollIndicator.d.ts +1 -1
- package/dist/src/Tabs/TabScrollIndicator.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.d.ts +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/TimePicker/TimePickerInput.d.ts +3 -1
- package/dist/src/TimeRange/TimeRange.d.ts +3 -2
- 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/ToastContainer/ToastFunction.js +2 -2
- package/dist/src/Toggle/Toggle.story.d.ts +25 -15
- package/dist/src/Toggle/Toggle.story.js +77 -43
- package/dist/src/Toggle/ToggleButton.js +2 -2
- package/dist/src/Tooltip/Tooltip.story.d.ts +1 -1
- package/dist/src/Tooltip/Tooltip.story.js +16 -0
- package/dist/src/TopBar/TopBar.styled.d.ts +16 -15
- package/dist/src/TopBar/components/BackLink.d.ts +3 -1
- package/dist/src/TopBar/components/MenuItemLink.d.ts +3 -1
- package/dist/src/TopBar/stories/TopBar.backButton.story.js +1 -1
- package/dist/src/TopBar/stories/TopBar.menu.story.js +1 -1
- 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/Headings.d.ts +4 -4
- 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/dist/src/utils/story/dashed.d.ts +1 -3
- package/dist/src/utils/story/resizable.d.ts +4 -2
- package/dist/src/utils/ts/FocusManager.d.ts +1 -1
- package/dist/src/utils/ts/FocusManager.js +2 -2
- package/package.json +25 -34
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useRef } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { expect, userEvent, within } from "storybook/test";
|
|
4
|
+
import { action } from "storybook/actions";
|
|
4
5
|
import { Radio, Button } from "../index";
|
|
5
6
|
export default {
|
|
6
7
|
title: "Components/Radio",
|
|
@@ -14,6 +15,15 @@ export const Default = {
|
|
|
14
15
|
args: {
|
|
15
16
|
labelText: "I am a radio button",
|
|
16
17
|
},
|
|
18
|
+
play: async ({ canvasElement, step }) => {
|
|
19
|
+
const canvas = within(canvasElement);
|
|
20
|
+
await step("can be checked", async () => {
|
|
21
|
+
const radio = canvas.getByRole("radio");
|
|
22
|
+
await expect(radio).not.toBeChecked();
|
|
23
|
+
await userEvent.click(radio);
|
|
24
|
+
await expect(radio).toBeChecked();
|
|
25
|
+
});
|
|
26
|
+
},
|
|
17
27
|
};
|
|
18
28
|
export const SetToDefaultChecked = {
|
|
19
29
|
args: {
|
|
@@ -21,10 +31,27 @@ export const SetToDefaultChecked = {
|
|
|
21
31
|
labelText: "I am checked by default",
|
|
22
32
|
},
|
|
23
33
|
name: "Set to default checked",
|
|
34
|
+
play: async ({ canvasElement }) => {
|
|
35
|
+
const canvas = within(canvasElement);
|
|
36
|
+
await expect(canvas.getByRole("radio")).toBeChecked();
|
|
37
|
+
},
|
|
24
38
|
};
|
|
25
39
|
export const SetToDisabled = {
|
|
26
40
|
render: (args) => (_jsxs(_Fragment, { children: [_jsx(Radio, { ...args, id: "radio-1", disabled: true, labelText: "I am disabled" }), _jsx(Radio, { ...args, id: "radio-2", checked: true, disabled: true, labelText: "I am disabled" })] })),
|
|
27
41
|
name: "Set to disabled",
|
|
42
|
+
play: async ({ canvasElement, step }) => {
|
|
43
|
+
const canvas = within(canvasElement);
|
|
44
|
+
await step("shows checked value", async () => {
|
|
45
|
+
const radios = canvas.getAllByRole("radio");
|
|
46
|
+
await expect(radios[0]).not.toBeChecked();
|
|
47
|
+
await expect(radios[1]).toBeChecked();
|
|
48
|
+
});
|
|
49
|
+
await step("inputs are disabled", async () => {
|
|
50
|
+
const radios = canvas.getAllByRole("radio");
|
|
51
|
+
await expect(radios[0]).toBeDisabled();
|
|
52
|
+
await expect(radios[1]).toBeDisabled();
|
|
53
|
+
});
|
|
54
|
+
},
|
|
28
55
|
};
|
|
29
56
|
export const SetToError = {
|
|
30
57
|
render: (args) => (_jsxs(_Fragment, { children: [_jsx(Radio, { ...args, id: "radio", error: true, labelText: "I am error" }), _jsx(Radio, { ...args, id: "radio", defaultChecked: true, error: true, labelText: "I am error" })] })),
|
|
@@ -36,6 +63,14 @@ export const SetToRequired = {
|
|
|
36
63
|
};
|
|
37
64
|
export const Controlled = {
|
|
38
65
|
render: (args) => (_jsxs(_Fragment, { children: [_jsx(Radio, { ...args, id: "radio-1", checked: true, onChange: action("onChange"), labelText: "I am controlled and checked" }), _jsx(Radio, { ...args, id: "radio-2", checked: false, onChange: action("onChange"), labelText: "I am controlled and unchecked" })] })),
|
|
66
|
+
play: async ({ canvasElement, step }) => {
|
|
67
|
+
const canvas = within(canvasElement);
|
|
68
|
+
await step("shows checked value", async () => {
|
|
69
|
+
const radios = canvas.getAllByRole("radio");
|
|
70
|
+
await expect(radios[0]).toBeChecked();
|
|
71
|
+
await expect(radios[1]).not.toBeChecked();
|
|
72
|
+
});
|
|
73
|
+
},
|
|
39
74
|
};
|
|
40
75
|
const UsingRefToControlFocusComponent = () => {
|
|
41
76
|
const ref = useRef(null);
|
|
@@ -47,4 +82,12 @@ const UsingRefToControlFocusComponent = () => {
|
|
|
47
82
|
export const UsingRefToControlFocus = {
|
|
48
83
|
render: (args) => _jsx(UsingRefToControlFocusComponent, { ...args }),
|
|
49
84
|
name: "using ref to control focus",
|
|
85
|
+
play: async ({ canvasElement, step }) => {
|
|
86
|
+
const canvas = within(canvasElement);
|
|
87
|
+
await step("focus can be set via ref", async () => {
|
|
88
|
+
const radio = canvas.getByRole("radio");
|
|
89
|
+
await userEvent.click(canvas.getByTestId("the-button"));
|
|
90
|
+
await expect(radio).toHaveFocus();
|
|
91
|
+
});
|
|
92
|
+
},
|
|
50
93
|
};
|
|
@@ -8,38 +8,46 @@ declare const _default: {
|
|
|
8
8
|
};
|
|
9
9
|
export default _default;
|
|
10
10
|
export declare const _RadioGroup: {
|
|
11
|
-
()
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
name: string;
|
|
13
|
+
play: ({ canvasElement, step }: {
|
|
14
|
+
canvasElement: any;
|
|
15
|
+
step: any;
|
|
16
|
+
}) => Promise<void>;
|
|
15
17
|
};
|
|
16
18
|
export declare const RadioGroupWithAllProps: {
|
|
17
|
-
()
|
|
18
|
-
|
|
19
|
-
name: string;
|
|
20
|
-
};
|
|
19
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
name: string;
|
|
21
21
|
parameters: {
|
|
22
22
|
chromatic: {
|
|
23
23
|
diffThreshold: number;
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
|
+
play: ({ canvasElement, step }: {
|
|
27
|
+
canvasElement: any;
|
|
28
|
+
step: any;
|
|
29
|
+
}) => Promise<void>;
|
|
26
30
|
};
|
|
27
31
|
export declare const WithErrorMessage: {
|
|
28
|
-
()
|
|
29
|
-
|
|
30
|
-
name: string;
|
|
31
|
-
};
|
|
32
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
name: string;
|
|
32
34
|
};
|
|
33
35
|
export declare const WithErrorList: {
|
|
34
|
-
()
|
|
35
|
-
|
|
36
|
-
name: string;
|
|
37
|
-
};
|
|
36
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
name: string;
|
|
38
38
|
};
|
|
39
39
|
export declare const SetToDisabled: {
|
|
40
|
-
()
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
name: string;
|
|
42
|
+
play: ({ canvasElement, step }: {
|
|
43
|
+
canvasElement: any;
|
|
44
|
+
step: any;
|
|
45
|
+
}) => Promise<void>;
|
|
46
|
+
};
|
|
47
|
+
export declare const Controlled: {
|
|
48
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
49
|
+
play: ({ canvasElement, step }: {
|
|
50
|
+
canvasElement: any;
|
|
51
|
+
step: any;
|
|
52
|
+
}) => Promise<void>;
|
|
44
53
|
};
|
|
45
|
-
export declare const Controlled: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { expect, userEvent, within } from "storybook/test";
|
|
2
3
|
import { Radio, RadioGroup, Icon, Tooltip, Flex } from "../index";
|
|
3
4
|
const errorList = ["Error message 1", "Error message 2"];
|
|
4
5
|
export default {
|
|
@@ -7,27 +8,79 @@ export default {
|
|
|
7
8
|
chromatic: { diffThreshold: 0.3 },
|
|
8
9
|
},
|
|
9
10
|
};
|
|
10
|
-
export const _RadioGroup =
|
|
11
|
-
|
|
11
|
+
export const _RadioGroup = {
|
|
12
|
+
render: () => (_jsxs(RadioGroup, { labelText: "Setting Selection", name: "settingSelection", children: [_jsx(Radio, { value: "a", labelText: "Option A" }), _jsx(Radio, { value: "b", labelText: "Option B" }), _jsx(Radio, { value: "c", labelText: "Option C" })] })),
|
|
12
13
|
name: "RadioGroup",
|
|
14
|
+
play: async ({ canvasElement, step }) => {
|
|
15
|
+
const canvas = within(canvasElement);
|
|
16
|
+
await step("has the correct initial values", async () => {
|
|
17
|
+
const radios = canvas.getAllByRole("radio");
|
|
18
|
+
await expect(radios[0]).not.toBeChecked();
|
|
19
|
+
await expect(radios[1]).not.toBeChecked();
|
|
20
|
+
await expect(radios[2]).not.toBeChecked();
|
|
21
|
+
});
|
|
22
|
+
await step("can be checked", async () => {
|
|
23
|
+
const radios = canvas.getAllByRole("radio");
|
|
24
|
+
await userEvent.click(radios[1]);
|
|
25
|
+
await expect(radios[1]).toBeChecked();
|
|
26
|
+
await userEvent.click(radios[2]);
|
|
27
|
+
await expect(radios[2]).toBeChecked();
|
|
28
|
+
await expect(radios[1]).not.toBeChecked();
|
|
29
|
+
});
|
|
30
|
+
},
|
|
13
31
|
};
|
|
14
|
-
export const RadioGroupWithAllProps =
|
|
15
|
-
|
|
32
|
+
export const RadioGroupWithAllProps = {
|
|
33
|
+
render: () => (_jsxs(RadioGroup, { labelText: "Setting Selection", name: "settingSelection", helpText: "Select a setting from the menu below:", required: true, requirementText: "(Required)", defaultValue: "a", children: [_jsx(Radio, { value: "a", labelText: _jsxs(Flex, { alignItems: "center", children: ["Option A", _jsx(Tooltip, { placement: "bottom", tooltip: "Option A is a special option with extra information", defaultOpen: true, children: _jsx(Icon, { icon: "help", color: "darkBlue", size: "x2", ml: "x1" }) })] }) }), _jsx(Radio, { value: "b", labelText: "Option B" }), _jsx(Radio, { value: "c", labelText: "Option C" })] })),
|
|
16
34
|
name: "RadioGroup with all props",
|
|
35
|
+
parameters: {
|
|
36
|
+
chromatic: { diffThreshold: 0.3 },
|
|
37
|
+
},
|
|
38
|
+
play: async ({ canvasElement, step }) => {
|
|
39
|
+
const canvas = within(canvasElement);
|
|
40
|
+
await step("has the correct initial values", async () => {
|
|
41
|
+
const radios = canvas.getAllByRole("radio");
|
|
42
|
+
await expect(radios[0]).toBeChecked();
|
|
43
|
+
await expect(radios[1]).not.toBeChecked();
|
|
44
|
+
await expect(radios[2]).not.toBeChecked();
|
|
45
|
+
});
|
|
46
|
+
},
|
|
17
47
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
export const WithErrorMessage = () => (_jsxs(RadioGroup, { errorMessage: "Please select an option", labelText: "Setting Selection", name: "settingSelection", defaultValue: "a", children: [_jsx(Radio, { value: "a", labelText: "Option A" }), _jsx(Radio, { value: "b", labelText: "Option B" }), _jsx(Radio, { value: "c", labelText: "Option C" })] }));
|
|
22
|
-
WithErrorMessage.story = {
|
|
48
|
+
export const WithErrorMessage = {
|
|
49
|
+
render: () => (_jsxs(RadioGroup, { errorMessage: "Please select an option", labelText: "Setting Selection", name: "settingSelection", defaultValue: "a", children: [_jsx(Radio, { value: "a", labelText: "Option A" }), _jsx(Radio, { value: "b", labelText: "Option B" }), _jsx(Radio, { value: "c", labelText: "Option C" })] })),
|
|
23
50
|
name: "with error message",
|
|
24
51
|
};
|
|
25
|
-
export const WithErrorList =
|
|
26
|
-
|
|
52
|
+
export const WithErrorList = {
|
|
53
|
+
render: () => (_jsxs(RadioGroup, { errorMessage: "Please select an option", errorList: errorList, labelText: "Setting Selection", name: "settingSelection", defaultValue: "a", children: [_jsx(Radio, { value: "a", labelText: "Option A" }), _jsx(Radio, { value: "b", labelText: "Option B" }), _jsx(Radio, { value: "c", labelText: "Option C" })] })),
|
|
27
54
|
name: "with error list",
|
|
28
55
|
};
|
|
29
|
-
export const SetToDisabled =
|
|
30
|
-
|
|
56
|
+
export const SetToDisabled = {
|
|
57
|
+
render: () => (_jsxs(RadioGroup, { disabled: true, labelText: "Setting Selection", name: "settingSelection", defaultValue: "a", children: [_jsx(Radio, { value: "a", labelText: "Option A" }), _jsx(Radio, { value: "b", labelText: "Option B" }), _jsx(Radio, { value: "c", labelText: "Option C" })] })),
|
|
31
58
|
name: "Set to disabled",
|
|
59
|
+
play: async ({ canvasElement, step }) => {
|
|
60
|
+
const canvas = within(canvasElement);
|
|
61
|
+
await step("has the correct initial values", async () => {
|
|
62
|
+
const radios = canvas.getAllByRole("radio");
|
|
63
|
+
await expect(radios[0]).toBeChecked();
|
|
64
|
+
await expect(radios[1]).not.toBeChecked();
|
|
65
|
+
await expect(radios[2]).not.toBeChecked();
|
|
66
|
+
});
|
|
67
|
+
await step("all inputs are disabled", async () => {
|
|
68
|
+
const radios = canvas.getAllByRole("radio");
|
|
69
|
+
await expect(radios[0]).toBeDisabled();
|
|
70
|
+
await expect(radios[1]).toBeDisabled();
|
|
71
|
+
await expect(radios[2]).toBeDisabled();
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
export const Controlled = {
|
|
76
|
+
render: () => (_jsxs(RadioGroup, { labelText: "Setting Selection", name: "settingSelection", checkedValue: "a", onChange: () => { }, children: [_jsx(Radio, { value: "a", labelText: "Option A" }), _jsx(Radio, { value: "b", labelText: "Option B" }), _jsx(Radio, { value: "c", labelText: "Option C" })] })),
|
|
77
|
+
play: async ({ canvasElement, step }) => {
|
|
78
|
+
const canvas = within(canvasElement);
|
|
79
|
+
await step("has the correct initial values", async () => {
|
|
80
|
+
const radios = canvas.getAllByRole("radio");
|
|
81
|
+
await expect(radios[0]).toBeChecked();
|
|
82
|
+
await expect(radios[1]).not.toBeChecked();
|
|
83
|
+
await expect(radios[2]).not.toBeChecked();
|
|
84
|
+
});
|
|
85
|
+
},
|
|
32
86
|
};
|
|
33
|
-
export const Controlled = () => (_jsxs(RadioGroup, { labelText: "Setting Selection", name: "settingSelection", checkedValue: "a", onChange: () => { }, children: [_jsx(Radio, { value: "a", labelText: "Option A" }), _jsx(Radio, { value: "b", labelText: "Option B" }), _jsx(Radio, { value: "c", labelText: "Option C" })] }));
|
|
@@ -3,7 +3,7 @@ import { RangeContainer } from ".";
|
|
|
3
3
|
export default {
|
|
4
4
|
title: "Components/RangeContainer",
|
|
5
5
|
};
|
|
6
|
-
export const _RangeContainer =
|
|
7
|
-
|
|
6
|
+
export const _RangeContainer = {
|
|
7
|
+
render: () => _jsx(RangeContainer, { children: "Example" }),
|
|
8
8
|
name: "RangeContainer",
|
|
9
9
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type { StoryObj } from "@storybook/react";
|
|
2
|
+
import type { StoryObj } from "@storybook/react-vite";
|
|
3
3
|
import Select, { NDSSelectProps } from "./Select";
|
|
4
4
|
declare const _default: {
|
|
5
5
|
title: string;
|
|
@@ -10,102 +10,74 @@ type Story = StoryObj<typeof Select>;
|
|
|
10
10
|
export declare const _Select: Story;
|
|
11
11
|
export declare const WithStyledProps: () => import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
export declare const WithABlankValue: {
|
|
13
|
-
()
|
|
14
|
-
|
|
15
|
-
name: string;
|
|
16
|
-
};
|
|
13
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
name: string;
|
|
17
15
|
};
|
|
18
16
|
export declare const WithAnOptionSelected: {
|
|
19
|
-
()
|
|
20
|
-
|
|
21
|
-
name: string;
|
|
22
|
-
};
|
|
17
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
name: string;
|
|
23
19
|
};
|
|
24
20
|
export declare const WithState: {
|
|
25
|
-
()
|
|
26
|
-
|
|
27
|
-
name: string;
|
|
28
|
-
};
|
|
21
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
name: string;
|
|
29
23
|
};
|
|
30
24
|
export declare const SetToDisabled: {
|
|
31
|
-
()
|
|
32
|
-
|
|
33
|
-
name: string;
|
|
34
|
-
};
|
|
25
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
name: string;
|
|
35
27
|
};
|
|
36
28
|
export declare const WithErrorMessage: {
|
|
37
|
-
()
|
|
38
|
-
|
|
39
|
-
name: string;
|
|
40
|
-
};
|
|
29
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
name: string;
|
|
41
31
|
};
|
|
42
32
|
export declare const WithErrorList: {
|
|
43
|
-
()
|
|
44
|
-
|
|
45
|
-
name: string;
|
|
46
|
-
};
|
|
33
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
name: string;
|
|
47
35
|
};
|
|
48
36
|
export declare const Required: {
|
|
49
|
-
()
|
|
50
|
-
|
|
51
|
-
name: string;
|
|
52
|
-
};
|
|
37
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
name: string;
|
|
53
39
|
};
|
|
54
40
|
export declare const WithAClearButton: () => import("react/jsx-runtime").JSX.Element;
|
|
55
41
|
export declare const WithAllFieldLabelProps: {
|
|
56
|
-
()
|
|
57
|
-
|
|
58
|
-
name: string;
|
|
59
|
-
};
|
|
42
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
43
|
+
name: string;
|
|
60
44
|
};
|
|
61
45
|
export declare const WithCustomId: {
|
|
62
|
-
()
|
|
63
|
-
|
|
64
|
-
name: string;
|
|
65
|
-
};
|
|
46
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
47
|
+
name: string;
|
|
66
48
|
};
|
|
67
49
|
export declare const WithSmallerMaxHeight: {
|
|
68
|
-
()
|
|
69
|
-
|
|
70
|
-
name: string;
|
|
71
|
-
};
|
|
50
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
51
|
+
name: string;
|
|
72
52
|
};
|
|
73
53
|
export declare const WithWrappingText: {
|
|
74
|
-
()
|
|
75
|
-
|
|
76
|
-
name: string;
|
|
77
|
-
};
|
|
54
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
55
|
+
name: string;
|
|
78
56
|
};
|
|
79
57
|
export declare const WithMultiselect: {
|
|
80
|
-
(props: any)
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
58
|
+
render: (props: any) => import("react/jsx-runtime").JSX.Element;
|
|
59
|
+
name: string;
|
|
60
|
+
play: ({ canvasElement, step }: {
|
|
61
|
+
canvasElement: any;
|
|
62
|
+
step: any;
|
|
63
|
+
}) => Promise<void>;
|
|
84
64
|
};
|
|
85
65
|
export declare const WithCloseMenuOnSelectTurnedOff: {
|
|
86
|
-
()
|
|
87
|
-
|
|
88
|
-
name: string;
|
|
89
|
-
};
|
|
66
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
67
|
+
name: string;
|
|
90
68
|
};
|
|
91
69
|
export declare const TestMultiselectOverflow: {
|
|
92
|
-
()
|
|
93
|
-
|
|
94
|
-
name: string;
|
|
95
|
-
};
|
|
70
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
71
|
+
name: string;
|
|
96
72
|
};
|
|
97
73
|
export declare const WithFixedPositioning: {
|
|
98
|
-
()
|
|
99
|
-
|
|
100
|
-
name: string;
|
|
101
|
-
};
|
|
74
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
75
|
+
name: string;
|
|
102
76
|
};
|
|
103
77
|
export declare const WithFetchedOptions: () => import("react/jsx-runtime").JSX.Element;
|
|
104
78
|
export declare const WithCustomOptionComponent: {
|
|
105
|
-
()
|
|
106
|
-
|
|
107
|
-
name: string;
|
|
108
|
-
};
|
|
79
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
80
|
+
name: string;
|
|
109
81
|
};
|
|
110
82
|
export declare const UsingRefToControlFocus: () => import("react/jsx-runtime").JSX.Element;
|
|
111
83
|
export declare const WithTopMenuPlacement: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import React, { useEffect, useRef, useState } from "react";
|
|
3
|
-
import { action } from "
|
|
3
|
+
import { action } from "storybook/actions";
|
|
4
|
+
import { expect, screen, userEvent, waitFor, within } from "storybook/test";
|
|
4
5
|
import { Box } from "../Box";
|
|
5
6
|
import { Flex } from "../Flex";
|
|
6
7
|
import { Button } from "../index";
|
|
@@ -130,90 +131,133 @@ export const _Select = {
|
|
|
130
131
|
control: { type: "boolean" },
|
|
131
132
|
},
|
|
132
133
|
},
|
|
134
|
+
play: async ({ canvasElement, step }) => {
|
|
135
|
+
const canvas = within(canvasElement);
|
|
136
|
+
await step("dropdown is closed initially", async () => {
|
|
137
|
+
await expect(screen.queryByTestId("select-dropdown")).not.toBeInTheDocument();
|
|
138
|
+
});
|
|
139
|
+
await step("opens dropdown on click", async () => {
|
|
140
|
+
// Click the combobox input — the most reliable way to open react-select
|
|
141
|
+
await userEvent.click(canvas.getByRole("combobox"));
|
|
142
|
+
await waitFor(() => expect(screen.getByTestId("select-dropdown")).toBeInTheDocument());
|
|
143
|
+
});
|
|
144
|
+
await step("closes dropdown on Escape key", async () => {
|
|
145
|
+
await userEvent.keyboard("{Escape}");
|
|
146
|
+
await waitFor(() => expect(screen.queryByTestId("select-dropdown")).not.toBeInTheDocument());
|
|
147
|
+
});
|
|
148
|
+
await step("selects an option by clicking and closes the dropdown", async () => {
|
|
149
|
+
await userEvent.click(canvas.getByRole("combobox"));
|
|
150
|
+
await userEvent.click(screen.getByText("Assigned to a line"));
|
|
151
|
+
await waitFor(() => expect(screen.queryByTestId("select-dropdown")).not.toBeInTheDocument());
|
|
152
|
+
});
|
|
153
|
+
},
|
|
133
154
|
};
|
|
134
155
|
export const WithStyledProps = () => {
|
|
135
156
|
return (_jsx(Select, { initialIsOpen: true, placeholder: "Please select inventory status", onChange: action("selection changed"), onBlur: action("blurred"), maxWidth: "300px", options: options, labelText: "Default size", onInputChange: action("typed input value changed") }));
|
|
136
157
|
};
|
|
137
|
-
export const WithABlankValue =
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
};
|
|
141
|
-
|
|
158
|
+
export const WithABlankValue = {
|
|
159
|
+
render: () => {
|
|
160
|
+
const optionsWithBlank = [{ value: null, label: "" }, ...options];
|
|
161
|
+
return (_jsx(Select, { placeholder: "Please select inventory status", onChange: action("selection changed"), onBlur: action("blurred"), options: optionsWithBlank, labelText: "Inventory status", onInputChange: action("typed input value changed") }));
|
|
162
|
+
},
|
|
142
163
|
name: "with a blank value",
|
|
143
164
|
};
|
|
144
|
-
export const WithAnOptionSelected =
|
|
145
|
-
|
|
165
|
+
export const WithAnOptionSelected = {
|
|
166
|
+
render: () => (_jsxs(_Fragment, { children: [_jsx(Select, { value: options[0].value, placeholder: "Please select inventory status", options: options, labelText: "Inventory status", onChange: action("selection changed"), onBlur: action("blurred"), onInputChange: action("typed input value changed") }), _jsx("br", {}), _jsx(Select, { value: options[0].value, placeholder: "Please select inventory status", options: options, labelText: "Inventory status", initialIsOpen: true, onChange: action("selection changed"), onBlur: action("blurred"), onInputChange: action("typed input value changed") })] })),
|
|
146
167
|
name: "with an option selected",
|
|
147
168
|
};
|
|
148
|
-
export const WithState =
|
|
149
|
-
|
|
169
|
+
export const WithState = {
|
|
170
|
+
render: () => (_jsx(SelectWithState, { selectedValue: "foo", placeholder: "Please select inventory status", options: options, labelText: "Inventory status" })),
|
|
150
171
|
name: "with state",
|
|
151
172
|
};
|
|
152
|
-
export const SetToDisabled =
|
|
153
|
-
|
|
173
|
+
export const SetToDisabled = {
|
|
174
|
+
render: () => (_jsx(Select, { placeholder: "Please select inventory status", options: options, onChange: action("selection changed"), onBlur: action("blurred"), disabled: true, labelText: "Inventory status", onInputChange: action("typed input value changed") })),
|
|
154
175
|
name: "set to disabled",
|
|
155
176
|
};
|
|
156
|
-
export const WithErrorMessage =
|
|
157
|
-
|
|
177
|
+
export const WithErrorMessage = {
|
|
178
|
+
render: () => (_jsxs(_Fragment, { children: [_jsx(Select, { placeholder: "Please select inventory status", options: options, errorMessage: "Please select an inventory status", labelText: "Inventory status", onChange: action("selection changed"), onBlur: action("blurred"), onInputChange: action("typed input value changed") }), _jsx("br", {}), _jsx(Select, { placeholder: "Please select inventory status", options: options, errorMessage: "Please select an inventory status", initialIsOpen: true, onChange: action("selection changed"), onBlur: action("blurred"), onInputChange: action("typed input value changed") })] })),
|
|
158
179
|
name: "with error message",
|
|
159
180
|
};
|
|
160
|
-
export const WithErrorList =
|
|
161
|
-
|
|
181
|
+
export const WithErrorList = {
|
|
182
|
+
render: () => (_jsxs(_Fragment, { children: [_jsx(Select, { placeholder: "Please select inventory status", options: options, errorMessage: "Please select an inventory status", errorList: errorList, labelText: "Inventory status", onChange: action("selection changed"), onBlur: action("blurred"), onInputChange: action("typed input value changed") }), _jsx("br", {}), _jsx(Select, { placeholder: "Please select inventory status", options: options, errorMessage: "Please select an inventory status", errorList: errorList, initialIsOpen: true, onChange: action("selection changed"), onBlur: action("blurred"), onInputChange: action("typed input value changed") })] })),
|
|
162
183
|
name: "with error list",
|
|
163
184
|
};
|
|
164
|
-
export const Required =
|
|
165
|
-
Required
|
|
185
|
+
export const Required = {
|
|
186
|
+
render: () => (_jsx(Select, { placeholder: "Please select inventory status", options: options, required: true, requirementText: "(Required)", labelText: "Inventory status", onChange: action("selection changed"), onBlur: action("blurred"), onInputChange: action("typed input value changed") })),
|
|
166
187
|
name: "set to required",
|
|
167
188
|
};
|
|
168
189
|
export const WithAClearButton = () => (_jsx(Select, { isClearable: true, placeholder: "Please select inventory status", options: options, labelText: "Inventory status", onChange: action("selection changed"), onBlur: action("blurred"), onInputChange: action("typed input value changed") }));
|
|
169
|
-
export const WithAllFieldLabelProps =
|
|
170
|
-
|
|
190
|
+
export const WithAllFieldLabelProps = {
|
|
191
|
+
render: () => (_jsx(Select, { placeholder: "Please select inventory status", options: options, labelText: "Inventory status", helpText: "Additional information about input", hint: "This is a hint for the input field", requirementText: "(Required)", onChange: action("selection changed"), onBlur: action("blurred"), onInputChange: action("typed input value changed") })),
|
|
171
192
|
name: "with all field label props",
|
|
172
193
|
};
|
|
173
|
-
export const WithCustomId =
|
|
174
|
-
|
|
194
|
+
export const WithCustomId = {
|
|
195
|
+
render: () => (_jsx(Select, { id: "my-custom-id", placeholder: "Please select inventory status", options: options, labelText: "Inventory status", helpText: "Additional information about input", onChange: action("selection changed"), onBlur: action("blurred"), onInputChange: action("typed input value changed") })),
|
|
175
196
|
name: "with custom id",
|
|
176
197
|
};
|
|
177
|
-
export const WithSmallerMaxHeight =
|
|
178
|
-
|
|
198
|
+
export const WithSmallerMaxHeight = {
|
|
199
|
+
render: () => (_jsx(Select, { initialIsOpen: true, maxHeight: "132px", value: options[0].value, placeholder: "Please select inventory status", options: options, labelText: "Inventory status", onChange: action("selection changed"), onBlur: action("blurred"), onInputChange: action("typed input value changed") })),
|
|
179
200
|
name: "with smaller maxHeight",
|
|
180
201
|
};
|
|
181
|
-
export const WithWrappingText =
|
|
182
|
-
|
|
202
|
+
export const WithWrappingText = {
|
|
203
|
+
render: () => (_jsx(Select, { initialIsOpen: true, value: wrappingOptions[0].value, placeholder: "Please select inventory status", options: wrappingOptions, labelText: "Inventory status", onChange: action("selection changed"), onBlur: action("blurred"), onInputChange: action("typed input value changed") })),
|
|
183
204
|
name: "With wrapping text",
|
|
184
205
|
};
|
|
185
|
-
export const WithMultiselect =
|
|
186
|
-
|
|
187
|
-
};
|
|
188
|
-
|
|
206
|
+
export const WithMultiselect = {
|
|
207
|
+
render: (props) => {
|
|
208
|
+
return (_jsx(Select, { defaultValue: [partnerCompanyName[0].value, partnerCompanyName[2].value], noOptionsMessage: () => "Nothing to see here", placeholder: "Please select inventory status", options: PCNList, labelText: "Select PCN", className: "Select", multiselect: true, ...props }));
|
|
209
|
+
},
|
|
189
210
|
name: "with multiselect",
|
|
211
|
+
play: async ({ canvasElement, step }) => {
|
|
212
|
+
const canvas = within(canvasElement);
|
|
213
|
+
await step("shows initial default values and excludes unselected ones", async () => {
|
|
214
|
+
await expect(canvas.getByText("PCN2")).toBeInTheDocument();
|
|
215
|
+
await expect(canvas.getByText("PCN1")).toBeInTheDocument();
|
|
216
|
+
// PCN4 is an unselected option — should not be visible while dropdown is closed
|
|
217
|
+
await expect(canvas.queryByText("PCN4")).not.toBeInTheDocument();
|
|
218
|
+
});
|
|
219
|
+
await step("removes a selected value via its remove button", async () => {
|
|
220
|
+
const [firstMultivalue] = canvas.getAllByTestId("select-multivalue");
|
|
221
|
+
// Click the react-select MultiValueRemove element (direct child of our NDS wrapper)
|
|
222
|
+
const removeBtn = firstMultivalue.querySelector('[class*="multi-value__remove"]');
|
|
223
|
+
await userEvent.click(removeBtn);
|
|
224
|
+
await waitFor(() => expect(canvas.getAllByTestId("select-multivalue")).toHaveLength(1));
|
|
225
|
+
});
|
|
226
|
+
await step("clears all remaining values with the clear button", async () => {
|
|
227
|
+
const clearWrapper = canvas.getByTestId("select-clear");
|
|
228
|
+
// Click the react-select ClearIndicator element (direct child of our NDS wrapper)
|
|
229
|
+
const clearBtn = clearWrapper.querySelector('[class*="clear-indicator"]');
|
|
230
|
+
await userEvent.click(clearBtn);
|
|
231
|
+
await waitFor(() => expect(canvas.queryByTestId("select-multivalue")).not.toBeInTheDocument());
|
|
232
|
+
});
|
|
233
|
+
},
|
|
190
234
|
};
|
|
191
|
-
export const WithCloseMenuOnSelectTurnedOff =
|
|
192
|
-
|
|
193
|
-
};
|
|
194
|
-
|
|
235
|
+
export const WithCloseMenuOnSelectTurnedOff = {
|
|
236
|
+
render: () => {
|
|
237
|
+
return (_jsx(Select, { defaultValue: [partnerCompanyName[0].value, partnerCompanyName[2].value], noOptionsMessage: () => "No options", placeholder: "Please select inventory status", options: PCNList, labelText: "Select PCN", className: "Select", multiselect: true, closeMenuOnSelect: false }));
|
|
238
|
+
},
|
|
195
239
|
name: "with closeMenuOnSelect turned off",
|
|
196
240
|
};
|
|
197
|
-
export const TestMultiselectOverflow =
|
|
198
|
-
|
|
241
|
+
export const TestMultiselectOverflow = {
|
|
242
|
+
render: () => (_jsxs(_Fragment, { children: [_jsx(Select, { defaultValue: ["accepted", "assigned"], noOptionsMessage: () => "No options", placeholder: "Please select inventory status", options: options, labelText: "Inventory status", onChange: action("selection changed"), onBlur: action("blurred"), multiselect: true, onInputChange: action("typed input value changed") }), _jsx(Box, { width: "300px", children: _jsx(Select, { defaultValue: partnerCompanyName.map((item) => item.value), noOptionsMessage: () => "No options", placeholder: "Please select inventory status", options: partnerCompanyName, labelText: "PCN", onChange: action("selection changed"), onBlur: action("blurred"), multiselect: true, onInputChange: action("typed input value changed") }) }), _jsx(Box, { width: "400px", children: _jsx(Select, { defaultValue: options.map((item) => item.value), noOptionsMessage: () => "No options", placeholder: "Please select inventory status", options: options, labelText: "Inventory status", onChange: action("selection changed"), onBlur: action("blurred"), multiselect: true, onInputChange: action("typed input value changed") }) })] })),
|
|
199
243
|
name: "test multiselect overflow",
|
|
200
244
|
};
|
|
201
|
-
export const WithFixedPositioning =
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
245
|
+
export const WithFixedPositioning = {
|
|
246
|
+
render: () => (_jsx(_Fragment, { children: _jsx(Box, { style: {
|
|
247
|
+
position: "relative",
|
|
248
|
+
overflow: "hidden",
|
|
249
|
+
width: "300px",
|
|
250
|
+
height: "100px",
|
|
251
|
+
}, children: _jsx(Select, { defaultValue: ["accepted", "assigned"], noOptionsMessage: () => "No options", placeholder: "Please select inventory status", options: options, labelText: "Inventory status", menuPosition: "fixed" }) }) })),
|
|
208
252
|
name: "with fixed positioning",
|
|
209
253
|
};
|
|
210
254
|
export const WithFetchedOptions = () => (_jsxs(Box, { style: { width: "300px" }, children: [_jsx(SelectWithManyOptions, { labelText: "Select from many options:" }), _jsx(SelectWithManyOptions, { multiselect: true, labelText: "Multiselect many options:" })] }));
|
|
211
|
-
export const WithCustomOptionComponent =
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
};
|
|
216
|
-
|
|
255
|
+
export const WithCustomOptionComponent = {
|
|
256
|
+
render: () => {
|
|
257
|
+
return (_jsx(Box, { position: "relative", overflow: "hidden", width: "300px", height: "600px", children: _jsx(Select, { defaultValue: ["accepted"], noOptionsMessage: () => "No options", placeholder: "Please select inventory status", options: options, components: {
|
|
258
|
+
Option: CustomOption,
|
|
259
|
+
}, multiselect: true, labelText: "Inventory status", menuPosition: "fixed" }) }));
|
|
260
|
+
},
|
|
217
261
|
name: "with custom option component",
|
|
218
262
|
};
|
|
219
263
|
export const UsingRefToControlFocus = () => {
|