@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.
Files changed (152) hide show
  1. package/dist/main.js +1 -0
  2. package/dist/main.js.map +1 -1
  3. package/dist/main.module.js +1 -0
  4. package/dist/main.module.js.map +1 -1
  5. package/dist/src/Alert/Alert.story.d.ts +1 -1
  6. package/dist/src/Alert/Alert.story.js +11 -0
  7. package/dist/src/AppTag/stories/AppTag.story.d.ts +2 -2
  8. package/dist/src/AppTag/stories/AppTag.story.js +6 -4
  9. package/dist/src/AppTag/stories/AppTag.usecases.story.d.ts +13 -10
  10. package/dist/src/AppTag/stories/AppTag.usecases.story.js +71 -51
  11. package/dist/src/AsyncSelect/AsyncSelect.graphql.story.js +4 -3
  12. package/dist/src/AsyncSelect/AsyncSelect.story.d.ts +17 -13
  13. package/dist/src/AsyncSelect/AsyncSelect.story.js +46 -23
  14. package/dist/src/BottomSheet/stories/BottomSheet.actions.story.d.ts +8 -1
  15. package/dist/src/BottomSheet/stories/BottomSheet.actions.story.js +22 -3
  16. package/dist/src/BottomSheet/stories/BottomSheet.features.story.d.ts +9 -2
  17. package/dist/src/BottomSheet/stories/BottomSheet.features.story.js +27 -12
  18. package/dist/src/BottomSheet/stories/BottomSheet.story.d.ts +7 -1
  19. package/dist/src/BottomSheet/stories/BottomSheet.story.js +20 -3
  20. package/dist/src/Box/Box.story.d.ts +22 -44
  21. package/dist/src/Box/Box.story.js +30 -30
  22. package/dist/src/BrandedNavBar/NavBar.story.d.ts +16 -28
  23. package/dist/src/BrandedNavBar/NavBar.story.js +41 -35
  24. package/dist/src/BrandedNavBar/SmallNavBar.story.d.ts +1 -1
  25. package/dist/src/Breadcrumbs/Breadcrumbs.story.d.ts +4 -8
  26. package/dist/src/Breadcrumbs/Breadcrumbs.story.js +4 -4
  27. package/dist/src/Button/Button.story.d.ts +14 -28
  28. package/dist/src/Button/Button.story.js +14 -14
  29. package/dist/src/Button/ControlIcon.story.js +1 -1
  30. package/dist/src/Button/IconicButton.story.d.ts +23 -45
  31. package/dist/src/Button/IconicButton.story.js +27 -25
  32. package/dist/src/ButtonGroup/ButtonGroup.story.d.ts +13 -23
  33. package/dist/src/ButtonGroup/ButtonGroup.story.js +10 -10
  34. package/dist/src/Card/Card.story.d.ts +3 -5
  35. package/dist/src/Card/Card.story.js +9 -7
  36. package/dist/src/Checkbox/Checkbox.story.d.ts +18 -34
  37. package/dist/src/Checkbox/Checkbox.story.js +28 -24
  38. package/dist/src/Checkbox/CheckboxGroup.story.d.ts +10 -20
  39. package/dist/src/Checkbox/CheckboxGroup.story.js +10 -10
  40. package/dist/src/DatePickers/stories/DatePicker.story.d.ts +9 -2
  41. package/dist/src/DatePickers/stories/DatePicker.story.js +43 -2
  42. package/dist/src/DatePickers/stories/MonthPicker.story.d.ts +8 -1
  43. package/dist/src/DatePickers/stories/MonthPicker.story.js +21 -2
  44. package/dist/src/DatePickers/stories/WeekPicker.story.d.ts +32 -4
  45. package/dist/src/DatePickers/stories/WeekPicker.story.js +57 -8
  46. package/dist/src/DateRange/DateRange.story.d.ts +16 -2
  47. package/dist/src/DateRange/DateRange.story.js +41 -3
  48. package/dist/src/DescriptionList/stories/DescriptionList.column.story.d.ts +1 -1
  49. package/dist/src/DescriptionList/stories/DescriptionList.column.story.js +10 -8
  50. package/dist/src/DescriptionList/stories/DescriptionList.group-min-width.story.d.ts +1 -1
  51. package/dist/src/DescriptionList/stories/DescriptionList.layout.story.d.ts +1 -1
  52. package/dist/src/DescriptionList/stories/DescriptionList.layout.story.js +12 -10
  53. package/dist/src/DescriptionList/stories/DescriptionList.playground.story.d.ts +1 -1
  54. package/dist/src/DescriptionList/stories/DescriptionList.story.d.ts +1 -0
  55. package/dist/src/DescriptionList/stories/DescriptionList.story.js +3 -0
  56. package/dist/src/DropdownMenu/DropdownMenu.story.d.ts +32 -32
  57. package/dist/src/DropdownMenu/DropdownMenu.story.js +58 -16
  58. package/dist/src/FieldLabel/FieldLabel.story.d.ts +2 -4
  59. package/dist/src/FieldLabel/FieldLabel.story.js +2 -2
  60. package/dist/src/Flex/Flex.story.d.ts +34 -68
  61. package/dist/src/Flex/Flex.story.js +36 -36
  62. package/dist/src/Form/Form.story.d.ts +8 -16
  63. package/dist/src/Form/Form.story.js +8 -8
  64. package/dist/src/Icon/Icon.story.d.ts +12 -24
  65. package/dist/src/Icon/Icon.story.js +15 -15
  66. package/dist/src/Input/Input.story.d.ts +16 -32
  67. package/dist/src/Input/Input.story.js +23 -23
  68. package/dist/src/Layout/Page.applicationFrame.story.d.ts +1 -1
  69. package/dist/src/Layout/Page.story.d.ts +1 -1
  70. package/dist/src/Layout/Sidebar.story.d.ts +1 -1
  71. package/dist/src/Link/Link.story.d.ts +16 -32
  72. package/dist/src/Link/Link.story.js +16 -17
  73. package/dist/src/List/List.story.d.ts +8 -16
  74. package/dist/src/List/List.story.js +8 -8
  75. package/dist/src/LoadingAnimation/LoadingAnimation.story.d.ts +4 -8
  76. package/dist/src/LoadingAnimation/LoadingAnimation.story.js +4 -4
  77. package/dist/src/MaybeTooltip/MaybeTooltip.story.d.ts +1 -1
  78. package/dist/src/Modal/Modal.story.d.ts +1 -1
  79. package/dist/src/Navigation/stories/Navigation.appSwitcher.story.d.ts +8 -1
  80. package/dist/src/Navigation/stories/Navigation.appSwitcher.story.js +19 -1
  81. package/dist/src/Navigation/stories/Navigation.logos.story.d.ts +2 -4
  82. package/dist/src/Navigation/stories/Navigation.logos.story.js +4 -4
  83. package/dist/src/Navigation/stories/Navigation.story.d.ts +7 -1
  84. package/dist/src/Navigation/stories/Navigation.story.js +145 -136
  85. package/dist/src/Navigation/stories/Navigation.userMenu.story.d.ts +8 -1
  86. package/dist/src/Navigation/stories/Navigation.userMenu.story.js +22 -1
  87. package/dist/src/Overlay/Overlay.story.d.ts +2 -4
  88. package/dist/src/Overlay/Overlay.story.js +2 -2
  89. package/dist/src/Pagination/Pagination.story.d.ts +14 -13
  90. package/dist/src/Pagination/Pagination.story.js +32 -11
  91. package/dist/src/Radio/Radio.story.d.ts +1 -1
  92. package/dist/src/Radio/Radio.story.js +44 -1
  93. package/dist/src/Radio/RadioGroup.story.d.ts +29 -21
  94. package/dist/src/Radio/RadioGroup.story.js +67 -14
  95. package/dist/src/RangeContainer/RangeContainer.story.d.ts +2 -4
  96. package/dist/src/RangeContainer/RangeContainer.story.js +2 -2
  97. package/dist/src/Select/Select.story.d.ts +37 -65
  98. package/dist/src/Select/Select.story.js +93 -49
  99. package/dist/src/StatusIndicator/StatusIndicator.story.d.ts +4 -8
  100. package/dist/src/StatusIndicator/StatusIndicator.story.js +4 -4
  101. package/dist/src/Switcher/Switcher.story.d.ts +8 -1
  102. package/dist/src/Switcher/Switcher.story.js +13 -1
  103. package/dist/src/Table/stories/BaseTable.story.d.ts +1 -1
  104. package/dist/src/Table/stories/BaseTable.story.js +1 -1
  105. package/dist/src/Table/stories/CustomContent.story.js +1 -1
  106. package/dist/src/Table/stories/Density.story.d.ts +4 -8
  107. package/dist/src/Table/stories/Density.story.js +4 -4
  108. package/dist/src/Table/stories/SortingColumnHeader.story.d.ts +1 -1
  109. package/dist/src/Table/stories/SortingColumnHeader.story.js +1 -1
  110. package/dist/src/Table/stories/Table.story.d.ts +1 -1
  111. package/dist/src/Table/stories/Table.story.js +37 -1
  112. package/dist/src/Table/stories/TableWithCustomSorting.story.d.ts +2 -4
  113. package/dist/src/Table/stories/TableWithCustomSorting.story.js +2 -2
  114. package/dist/src/Table/stories/TableWithExpandableRows.story.d.ts +4 -8
  115. package/dist/src/Table/stories/TableWithExpandableRows.story.js +5 -5
  116. package/dist/src/Table/stories/TableWithFiltering.story.d.ts +8 -8
  117. package/dist/src/Table/stories/TableWithFiltering.story.js +15 -4
  118. package/dist/src/Table/stories/TableWithSelectableRows.story.d.ts +8 -8
  119. package/dist/src/Table/stories/TableWithSelectableRows.story.js +22 -5
  120. package/dist/src/Table/stories/TableWithServerSidePagination.story.d.ts +2 -4
  121. package/dist/src/Table/stories/TableWithServerSidePagination.story.js +2 -2
  122. package/dist/src/Tabs/Tabs.story.d.ts +33 -33
  123. package/dist/src/Tabs/Tabs.story.js +52 -16
  124. package/dist/src/Textarea/Textarea.story.js +1 -1
  125. package/dist/src/TimePicker/TimePicker.js +2 -0
  126. package/dist/src/TimePicker/TimePicker.story.d.ts +24 -40
  127. package/dist/src/TimePicker/TimePicker.story.js +40 -27
  128. package/dist/src/TimeRange/TimeRange.story.d.ts +14 -20
  129. package/dist/src/TimeRange/TimeRange.story.js +34 -20
  130. package/dist/src/Toast/Toast.story.d.ts +24 -25
  131. package/dist/src/Toast/Toast.story.js +170 -142
  132. package/dist/src/ToastContainer/ToastContainer.story.d.ts +8 -1
  133. package/dist/src/ToastContainer/ToastContainer.story.js +13 -1
  134. package/dist/src/Toggle/Toggle.story.d.ts +25 -15
  135. package/dist/src/Toggle/Toggle.story.js +77 -43
  136. package/dist/src/Tooltip/Tooltip.story.d.ts +1 -1
  137. package/dist/src/Tooltip/Tooltip.story.js +16 -0
  138. package/dist/src/TopBar/stories/TopBar.story.d.ts +7 -1
  139. package/dist/src/TopBar/stories/TopBar.story.js +18 -1
  140. package/dist/src/TruncatedText/TruncatedText.story.d.ts +29 -34
  141. package/dist/src/TruncatedText/TruncatedText.story.js +46 -19
  142. package/dist/src/Type/Text.story.d.ts +10 -20
  143. package/dist/src/Type/Text.story.js +10 -10
  144. package/dist/src/Validation/InlineValidation.story.d.ts +6 -12
  145. package/dist/src/Validation/InlineValidation.story.js +6 -6
  146. package/dist/src/VisualTests/Select.story.d.ts +12 -24
  147. package/dist/src/VisualTests/Select.story.js +19 -19
  148. package/dist/src/pages/ErrorPage.story.d.ts +3 -5
  149. package/dist/src/pages/ErrorPage.story.js +10 -10
  150. package/dist/src/pages/LoginPage.story.d.ts +8 -16
  151. package/dist/src/pages/LoginPage.story.js +8 -8
  152. package/package.json +16 -24
@@ -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 { action } from "@storybook/addon-actions";
3
+ import { expect, userEvent, waitFor, within } from "storybook/test";
4
+ import { action } from "storybook/actions";
4
5
  import { DatePicker } from "../index";
5
6
  import { Button } from "../..";
6
7
  const selectedDateExamples = [
@@ -27,6 +28,22 @@ export const Default = {
27
28
  options: selectedDateExamples,
28
29
  },
29
30
  },
31
+ play: async ({ canvasElement, step }) => {
32
+ const canvas = within(canvasElement);
33
+ await step("has the correct date selected by default", async () => {
34
+ await expect(canvas.getByLabelText("select a date")).toHaveValue("2019-Jan-01");
35
+ });
36
+ await step("can open a calendar on click", async () => {
37
+ expect(document.querySelector(".react-datepicker-popper")).toBeNull();
38
+ await userEvent.click(canvas.getByLabelText("select a date"));
39
+ await waitFor(() => expect(document.querySelector(".react-datepicker-popper")).toBeInTheDocument());
40
+ });
41
+ await step("closes the calendar after selecting a date", async () => {
42
+ const day2 = document.querySelector(".react-datepicker__day--002");
43
+ await userEvent.click(day2);
44
+ await waitFor(() => expect(document.querySelector(".react-datepicker-popper")).not.toBeInTheDocument());
45
+ });
46
+ },
30
47
  };
31
48
  export const WithCustomDateFormat = {
32
49
  args: {
@@ -47,7 +64,31 @@ export const WithCustomDateFormat = {
47
64
  };
48
65
  export const WithCustomPlaceholder = () => (_jsx(DatePicker, { dateFormat: "MMMM d, yyyy", onFocus: action("date selector focused"), onBlur: action("date selector blurred"), onChange: action("date changed"), onInputChange: action("input changed"), inputProps: { labelText: "Expiry Date", placeholder: "Month day, year" } }));
49
66
  export const WithErrorState = () => (_jsx(DatePicker, { dateFormat: "MMMM d, yyyy", onFocus: action("date selector focused"), onBlur: action("date selector blurred"), onChange: action("date changed"), onInputChange: action("input changed"), inputProps: { labelText: "Expiry Date" }, errorMessage: "The date is invalid" }));
50
- export const WithMinAndMaxDate = () => (_jsx(DatePicker, { selected: new Date("2019-01-05T05:00:00.000Z"), minDate: new Date("2019-01-03T05:00:00.000Z"), maxDate: new Date("2019-01-10T05:00:00.000Z"), onFocus: action("date selector focused"), onBlur: action("date selector blurred"), onChange: action("date changed"), onInputChange: action("input changed"), inputProps: { labelText: "Expiry Date" } }));
67
+ export const WithMinAndMaxDate = {
68
+ render: () => (_jsx(DatePicker, { selected: new Date("2019-01-05T05:00:00.000Z"), minDate: new Date("2019-01-03T05:00:00.000Z"), maxDate: new Date("2019-01-10T05:00:00.000Z"), onFocus: action("date selector focused"), onBlur: action("date selector blurred"), onChange: action("date changed"), onInputChange: action("input changed"), inputProps: { labelText: "Expiry Date" } })),
69
+ name: "with min and max date",
70
+ play: async ({ canvasElement, step }) => {
71
+ const canvas = within(canvasElement);
72
+ await step("has the correct date selected", async () => {
73
+ await expect(canvas.getByLabelText("select a date")).toHaveValue("2019-Jan-05");
74
+ });
75
+ await step("cannot navigate past the max date with arrow keys", async () => {
76
+ const input = canvas.getByLabelText("select a date");
77
+ await userEvent.click(input);
78
+ for (let i = 0; i < 6; i++) {
79
+ await userEvent.keyboard("{ArrowUp}");
80
+ }
81
+ await expect(input).toHaveValue("2019-Jan-10");
82
+ });
83
+ await step("cannot navigate past the min date with arrow keys", async () => {
84
+ const input = canvas.getByLabelText("select a date");
85
+ for (let i = 0; i < 10; i++) {
86
+ await userEvent.keyboard("{ArrowDown}");
87
+ }
88
+ await expect(input).toHaveValue("2019-Jan-03");
89
+ });
90
+ },
91
+ };
51
92
  export const DisableFlipping = {
52
93
  args: {
53
94
  selected: selectedDateExamples[0],
@@ -2,7 +2,14 @@ declare const _default: {
2
2
  title: string;
3
3
  };
4
4
  export default _default;
5
- export declare const Default: () => import("react/jsx-runtime").JSX.Element;
5
+ export declare const Default: {
6
+ render: () => import("react/jsx-runtime").JSX.Element;
7
+ name: string;
8
+ play: ({ canvasElement, step }: {
9
+ canvasElement: any;
10
+ step: any;
11
+ }) => Promise<void>;
12
+ };
6
13
  export declare const WithPlaceholder: () => import("react/jsx-runtime").JSX.Element;
7
14
  export declare const Disabled: () => import("react/jsx-runtime").JSX.Element;
8
15
  export declare const WithDefaultValue: () => import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,31 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useState } from "react";
3
+ import { expect, userEvent, waitFor, within } from "storybook/test";
3
4
  import { format } from "date-fns";
4
5
  import MonthPicker from "../MonthPicker";
5
6
  export default {
6
7
  title: "Components/DatePickers/MonthPicker",
7
8
  };
8
- export const Default = () => {
9
- return _jsx(MonthPicker, { inputProps: { labelText: "Expiry Date" } });
9
+ export const Default = {
10
+ render: () => _jsx(MonthPicker, { inputProps: { labelText: "Expiry Date" } }),
11
+ name: "Default",
12
+ play: async ({ canvasElement, step }) => {
13
+ const canvas = within(canvasElement);
14
+ await step("can open a month picker on click", async () => {
15
+ expect(document.querySelector(".react-datepicker-popper")).toBeNull();
16
+ await userEvent.click(canvas.getByLabelText("select a date"));
17
+ await waitFor(() => expect(document.querySelector(".react-datepicker-popper")).toBeInTheDocument());
18
+ });
19
+ await step("displays 12 months", async () => {
20
+ const monthElements = document.querySelectorAll(".react-datepicker__month-text");
21
+ expect(monthElements).toHaveLength(12);
22
+ });
23
+ await step("can select a month by clicking", async () => {
24
+ const marchOption = Array.from(document.querySelectorAll(".react-datepicker__month-text")).find((el) => el.textContent === "Mar");
25
+ await userEvent.click(marchOption);
26
+ await waitFor(() => expect(document.querySelector(".react-datepicker-popper")).not.toBeInTheDocument());
27
+ });
28
+ },
10
29
  };
11
30
  export const WithPlaceholder = () => {
12
31
  return _jsx(MonthPicker, { inputProps: { labelText: "Expiry Date", placeholder: "Select month" } });
@@ -2,11 +2,39 @@ declare const _default: {
2
2
  title: string;
3
3
  };
4
4
  export default _default;
5
- export declare const Default: () => import("react/jsx-runtime").JSX.Element;
5
+ export declare const Default: {
6
+ render: () => import("react/jsx-runtime").JSX.Element;
7
+ name: string;
8
+ play: ({ canvasElement, step }: {
9
+ canvasElement: any;
10
+ step: any;
11
+ }) => Promise<void>;
12
+ };
6
13
  export declare const WithError: () => import("react/jsx-runtime").JSX.Element;
7
- export declare const WithMinMaxDates: () => import("react/jsx-runtime").JSX.Element;
14
+ export declare const WithMinMaxDates: {
15
+ render: () => import("react/jsx-runtime").JSX.Element;
16
+ name: string;
17
+ play: ({ canvasElement, step }: {
18
+ canvasElement: any;
19
+ step: any;
20
+ }) => Promise<void>;
21
+ };
8
22
  export declare const WithCustomDateFormat: () => import("react/jsx-runtime").JSX.Element;
9
23
  export declare const WithPreselectedDate: () => import("react/jsx-runtime").JSX.Element;
10
- export declare const WithCustomLocale: () => import("react/jsx-runtime").JSX.Element;
11
- export declare const Disabled: () => import("react/jsx-runtime").JSX.Element;
24
+ export declare const WithCustomLocale: {
25
+ render: () => import("react/jsx-runtime").JSX.Element;
26
+ name: string;
27
+ play: ({ canvasElement, step }: {
28
+ canvasElement: any;
29
+ step: any;
30
+ }) => Promise<void>;
31
+ };
32
+ export declare const Disabled: {
33
+ render: () => import("react/jsx-runtime").JSX.Element;
34
+ name: string;
35
+ play: ({ canvasElement, step }: {
36
+ canvasElement: any;
37
+ step: any;
38
+ }) => Promise<void>;
39
+ };
12
40
  export declare const AdvancedUsage: () => import("react/jsx-runtime").JSX.Element;
@@ -1,23 +1,72 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState } from "react";
3
+ import { expect, userEvent, waitFor, within } from "storybook/test";
3
4
  import { format } from "date-fns";
4
5
  import { Text } from "../../Type";
5
6
  import WeekPicker from "../WeekPicker";
6
7
  export default {
7
8
  title: "Components/DatePickers/WeekPicker",
8
9
  };
9
- export const Default = () => _jsx(WeekPicker, { inputProps: { labelText: "Expiry Date" } });
10
+ export const Default = {
11
+ render: () => _jsx(WeekPicker, { inputProps: { labelText: "Expiry Date" } }),
12
+ name: "Default",
13
+ play: async ({ canvasElement, step }) => {
14
+ const canvas = within(canvasElement);
15
+ await step("can open a calendar on click", async () => {
16
+ expect(document.querySelector(".react-datepicker-popper")).toBeNull();
17
+ await userEvent.click(canvas.getByLabelText("select a date"));
18
+ await waitFor(() => expect(document.querySelector(".react-datepicker-popper")).toBeInTheDocument());
19
+ });
20
+ await step("shows week numbers in the calendar", async () => {
21
+ expect(document.querySelector(".react-datepicker__week-number")).toBeTruthy();
22
+ });
23
+ },
24
+ };
10
25
  export const WithError = () => (_jsx(WeekPicker, { inputProps: { labelText: "Week Selection" }, errorMessage: "Please select a valid week" }));
11
- export const WithMinMaxDates = () => {
12
- return (_jsxs(_Fragment, { children: [_jsx(Text, { mb: "x2", children: "If a min or a max day falls in the middle of the week, no day in the week will be selectable." }), _jsx(WeekPicker, { inputProps: { labelText: "Select Week" }, minDate: new Date("01/15/2025"), maxDate: new Date("01/29/2025") })] }));
26
+ export const WithMinMaxDates = {
27
+ render: () => (_jsxs(_Fragment, { children: [_jsx(Text, { mb: "x2", children: "If a min or a max day falls in the middle of the week, no day in the week will be selectable." }), _jsx(WeekPicker, { inputProps: { labelText: "Select Week" }, minDate: new Date("01/15/2025"), maxDate: new Date("01/29/2025") })] })),
28
+ name: "with min max dates",
29
+ play: async ({ canvasElement, step }) => {
30
+ const canvas = within(canvasElement);
31
+ await step("disables dates outside min/max range", async () => {
32
+ await userEvent.click(canvas.getByLabelText("select a date"));
33
+ await waitFor(() => expect(document.querySelector(".react-datepicker-popper")).toBeInTheDocument());
34
+ expect(document.querySelector(".react-datepicker__day--disabled")).toBeTruthy();
35
+ });
36
+ },
13
37
  };
14
38
  export const WithCustomDateFormat = () => (_jsx(WeekPicker, { inputProps: { labelText: "Week", inputWidth: "320px" }, dateFormat: "'Week starting' dd/MM/yyyy" }));
15
39
  export const WithPreselectedDate = () => (_jsx(WeekPicker, { inputProps: { labelText: "Selected Week" }, selected: new Date("01/21/2025") }));
16
- export const WithCustomLocale = () => _jsx(WeekPicker, { inputProps: { labelText: "Semaine" }, locale: "fr_FR" });
17
- export const Disabled = () => (_jsx(WeekPicker, { inputProps: {
18
- labelText: "Week Selection",
19
- disabled: true,
20
- } }));
40
+ export const WithCustomLocale = {
41
+ render: () => _jsx(WeekPicker, { inputProps: { labelText: "Semaine" }, locale: "fr_FR" }),
42
+ name: "with custom locale",
43
+ play: async ({ canvasElement, step }) => {
44
+ const canvas = within(canvasElement);
45
+ await step("displays weekdays in French", async () => {
46
+ await userEvent.click(canvas.getByLabelText("select a date"));
47
+ await waitFor(() => expect(document.querySelector(".react-datepicker-popper")).toBeInTheDocument());
48
+ const dayNames = document.querySelectorAll(".react-datepicker__day-name");
49
+ expect(dayNames[1].textContent).toContain("lu");
50
+ });
51
+ },
52
+ };
53
+ export const Disabled = {
54
+ render: () => (_jsx(WeekPicker, { inputProps: {
55
+ labelText: "Week Selection",
56
+ disabled: true,
57
+ } })),
58
+ name: "disabled",
59
+ play: async ({ canvasElement, step }) => {
60
+ const canvas = within(canvasElement);
61
+ await step("has a disabled input", async () => {
62
+ await expect(canvas.getByLabelText("select a date")).toBeDisabled();
63
+ });
64
+ await step("cannot open the calendar when disabled", async () => {
65
+ await userEvent.click(canvas.getByLabelText("select a date"), { pointerEventsCheck: 0 });
66
+ expect(document.querySelector(".react-datepicker-popper")).toBeNull();
67
+ });
68
+ },
69
+ };
21
70
  export const AdvancedUsage = () => {
22
71
  const [selectedWeek, setSelectedWeek] = useState(null);
23
72
  const [inputValue, setInputValue] = useState("");
@@ -3,13 +3,27 @@ declare const _default: {
3
3
  };
4
4
  export default _default;
5
5
  export declare const Default: () => import("react/jsx-runtime").JSX.Element;
6
- export declare const DefaultStartAndEndDate: () => import("react/jsx-runtime").JSX.Element;
6
+ export declare const DefaultStartAndEndDate: {
7
+ render: () => import("react/jsx-runtime").JSX.Element;
8
+ name: string;
9
+ play: ({ canvasElement, step }: {
10
+ canvasElement: any;
11
+ step: any;
12
+ }) => Promise<void>;
13
+ };
7
14
  export declare const DisabledRangeValidation: () => import("react/jsx-runtime").JSX.Element;
8
15
  export declare const WithCustomError: () => import("react/jsx-runtime").JSX.Element;
9
16
  export declare const CustomizingInputProps: () => import("react/jsx-runtime").JSX.Element;
10
17
  export declare const Disabled: () => import("react/jsx-runtime").JSX.Element;
11
18
  export declare const IndividualInputError: () => import("react/jsx-runtime").JSX.Element;
12
- export declare const WithTimes: () => import("react/jsx-runtime").JSX.Element;
19
+ export declare const WithTimes: {
20
+ render: () => import("react/jsx-runtime").JSX.Element;
21
+ name: string;
22
+ play: ({ canvasElement, step }: {
23
+ canvasElement: any;
24
+ step: any;
25
+ }) => Promise<void>;
26
+ };
13
27
  export declare const CustomizingInputPropsWithTimes: () => import("react/jsx-runtime").JSX.Element;
14
28
  export declare const WithDefaultStartAndEndTimes: () => import("react/jsx-runtime").JSX.Element;
15
29
  export declare const WithTimeError: () => import("react/jsx-runtime").JSX.Element;
@@ -1,13 +1,30 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useRef } from "react";
3
- import { action } from "@storybook/addon-actions";
3
+ import { expect, userEvent, waitFor, within } from "storybook/test";
4
+ import { action } from "storybook/actions";
4
5
  import { Button, Box, Flex, PrimaryButton } from "..";
5
6
  import DateRange from "./DateRange";
6
7
  export default {
7
8
  title: "Components/DateRange",
8
9
  };
9
10
  export const Default = () => (_jsx(DateRange, { p: "x3", onRangeChange: action("range changed"), onStartDateChange: action("start date changed"), onEndDateChange: action("end date changed") }));
10
- export const DefaultStartAndEndDate = () => (_jsx(DateRange, { defaultStartDate: new Date("2019-01-01T05:00:00.000Z"), defaultEndDate: new Date("2019-01-05T05:00:00.000Z"), onRangeChange: action("range changed"), onStartDateChange: action("start date changed"), onEndDateChange: action("end date changed") }));
11
+ export const DefaultStartAndEndDate = {
12
+ render: () => (_jsx(DateRange, { defaultStartDate: new Date("2019-01-01T05:00:00.000Z"), defaultEndDate: new Date("2019-01-05T05:00:00.000Z"), onRangeChange: action("range changed"), onStartDateChange: action("start date changed"), onEndDateChange: action("end date changed") })),
13
+ name: "default start and end date",
14
+ play: async ({ canvasElement, step }) => {
15
+ const canvas = within(canvasElement);
16
+ await step("shows start date marker in calendar when end date input is clicked", async () => {
17
+ await userEvent.click(canvas.getByLabelText("Select an end date"));
18
+ await waitFor(() => expect(document.querySelector(".nds-datepicker-day--start-date")).toBeInTheDocument());
19
+ });
20
+ await step("shows an error when start date is set after end date", async () => {
21
+ await userEvent.click(canvas.getByLabelText("Select a start date"));
22
+ const day8 = document.querySelector(".react-datepicker__day--008");
23
+ await userEvent.click(day8);
24
+ await waitFor(() => expect(canvas.getByText("End date is before start date")).toBeVisible());
25
+ });
26
+ },
27
+ };
11
28
  export const DisabledRangeValidation = () => (_jsx(DateRange, { disableRangeValidation: true, defaultEndDate: new Date("2019-07-05T05:00:00.000Z"), defaultStartDate: new Date("2019-09-10T05:00:00.000Z"), onRangeChange: action("range changed"), onStartDateChange: action("start date changed"), onEndDateChange: action("end date changed") }));
12
29
  export const WithCustomError = () => (_jsx(DateRange, { errorMessage: "This range conflicts with another range", defaultStartDate: new Date("2019-07-05T05:00:00.000Z"), defaultEndDate: new Date("2019-09-10T05:00:00.000Z"), onRangeChange: action("range changed"), onStartDateChange: action("start date changed"), onEndDateChange: action("end date changed") }));
13
30
  export const CustomizingInputProps = () => (_jsx(DateRange, { startDateInputProps: {
@@ -39,7 +56,28 @@ export const Disabled = () => {
39
56
  } }));
40
57
  };
41
58
  export const IndividualInputError = () => (_jsx(DateRange, { errorMessage: "Start date is required", startDateInputProps: { required: true }, defaultEndDate: new Date("2019-09-10T05:00:00.000Z"), onRangeChange: action("range changed"), onStartDateChange: action("start date changed"), onEndDateChange: action("end date changed") }));
42
- export const WithTimes = () => (_jsx(DateRange, { defaultStartDate: new Date("2019-01-01T05:00:00.000Z"), defaultEndDate: new Date("2019-01-05T05:00:00.000Z"), onRangeChange: action("range changed"), onStartDateChange: action("start date changed"), onEndDateChange: action("end date changed"), showTimes: true }));
59
+ export const WithTimes = {
60
+ render: () => (_jsx(DateRange, { defaultStartDate: new Date("2019-01-01T05:00:00.000Z"), defaultEndDate: new Date("2019-01-05T05:00:00.000Z"), onRangeChange: action("range changed"), onStartDateChange: action("start date changed"), onEndDateChange: action("end date changed"), showTimes: true })),
61
+ name: "with times",
62
+ play: async ({ canvasElement, step }) => {
63
+ const canvas = within(canvasElement);
64
+ await step("shows an error when start time is after end time on the same day", async () => {
65
+ await userEvent.click(canvas.getByLabelText("Select a start date"));
66
+ const day8Start = document.querySelector(".react-datepicker__day--008");
67
+ await userEvent.click(day8Start);
68
+ await userEvent.click(canvas.getByLabelText("Select a start time"));
69
+ const startOptions = within(canvas.getByTestId("daterange-start-time")).getAllByTestId(/select-option/);
70
+ await userEvent.click(startOptions[4]);
71
+ await userEvent.click(canvas.getByLabelText("Select an end time"));
72
+ const endOptions = within(canvas.getByTestId("daterange-end-time")).getAllByTestId(/select-option/);
73
+ await userEvent.click(endOptions[3]);
74
+ await userEvent.click(canvas.getByLabelText("Select an end date"));
75
+ const day8End = document.querySelector(".react-datepicker__day--008");
76
+ await userEvent.click(day8End);
77
+ await waitFor(() => expect(canvas.getByText("End time is before start time")).toBeVisible());
78
+ });
79
+ },
80
+ };
43
81
  export const CustomizingInputPropsWithTimes = () => (_jsx(DateRange, { startDateInputProps: { placeholder: "From", inputWidth: "280px" }, endDateInputProps: { placeholder: "To", inputWidth: "280px" }, onRangeChange: action("range changed"), onStartDateChange: action("start date changed"), onEndDateChange: action("end date changed"), showTimes: true }));
44
82
  export const WithDefaultStartAndEndTimes = () => (_jsx(DateRange, { onRangeChange: action("range changed"), onStartDateChange: action("start date changed"), onEndDateChange: action("end date changed"), defaultStartDate: new Date("2019-07-05T05:00:00.000Z"), defaultEndDate: new Date("2019-09-10T05:00:00.000Z"), showTimes: true, defaultStartTime: "03:30", defaultEndTime: "13:30" }));
45
83
  export const WithTimeError = () => (_jsx(DateRange, { onRangeChange: action("range changed"), onStartDateChange: action("start date changed"), onEndDateChange: action("end date changed"), defaultStartDate: new Date("2019-07-05T05:00:00.000Z"), defaultEndDate: new Date("2019-07-05T05:00:00.000Z"), showTimes: true, defaultStartTime: "13:30", defaultEndTime: "10:30" }));
@@ -7,7 +7,7 @@ export default _default;
7
7
  export declare const TwoColumns: () => import("react/jsx-runtime").JSX.Element;
8
8
  export declare const ThreeColumns: () => import("react/jsx-runtime").JSX.Element;
9
9
  export declare const ResponsiveColumns: {
10
- (): import("react/jsx-runtime").JSX.Element;
10
+ render: () => import("react/jsx-runtime").JSX.Element;
11
11
  parameters: {
12
12
  chromatic: {
13
13
  viewports: number[];
@@ -22,13 +22,15 @@ const ColumnDemo = ({ resizable = false, columns, title, description, info, }) =
22
22
  };
23
23
  export const TwoColumns = () => _jsx(ColumnDemo, { title: "Two Columns", columns: 2 });
24
24
  export const ThreeColumns = () => _jsx(ColumnDemo, { title: "Three Columns", columns: 3 });
25
- export const ResponsiveColumns = () => (_jsx(ColumnDemo, { resizable: true, title: "Responsive Columns", columns: { small: 1, medium: 3, large: 6 }, description: "Small: 1 column, Medium: 3 columns, Large: 6 columns", info: _jsxs(Text, { fontSize: "sm", color: "darkGrey", children: ["The breakpoint is based on the container width, not the viewport width. See component", " ", _jsx(Link, { href: "https://github.com/nulogy/design-system/blob/main/src/DescriptionList/README.md", children: "documentation" }), "."] }) }));
26
- ResponsiveColumns.parameters = {
27
- chromatic: {
28
- viewports: [
29
- parseInt(legacy.breakpoints.small),
30
- parseInt(legacy.breakpoints.medium),
31
- parseInt(legacy.breakpoints.large),
32
- ],
25
+ export const ResponsiveColumns = {
26
+ render: () => (_jsx(ColumnDemo, { resizable: true, title: "Responsive Columns", columns: { small: 1, medium: 3, large: 6 }, description: "Small: 1 column, Medium: 3 columns, Large: 6 columns", info: _jsxs(Text, { fontSize: "sm", color: "darkGrey", children: ["The breakpoint is based on the container width, not the viewport width. See component", " ", _jsx(Link, { href: "https://github.com/nulogy/design-system/blob/main/src/DescriptionList/README.md", children: "documentation" }), "."] }) })),
27
+ parameters: {
28
+ chromatic: {
29
+ viewports: [
30
+ parseInt(legacy.breakpoints.small),
31
+ parseInt(legacy.breakpoints.medium),
32
+ parseInt(legacy.breakpoints.large),
33
+ ],
34
+ },
33
35
  },
34
36
  };
@@ -1,4 +1,4 @@
1
- import type { StoryObj } from "@storybook/react";
1
+ import type { StoryObj } from "@storybook/react-vite";
2
2
  import DescriptionList from "../DescriptionList";
3
3
  declare const _default: {
4
4
  title: string;
@@ -7,7 +7,7 @@ export default _default;
7
7
  export declare const Inline: () => import("react/jsx-runtime").JSX.Element;
8
8
  export declare const Stacked: () => import("react/jsx-runtime").JSX.Element;
9
9
  export declare const Auto: {
10
- (): import("react/jsx-runtime").JSX.Element;
10
+ render: () => import("react/jsx-runtime").JSX.Element;
11
11
  parameters: {
12
12
  chromatic: {
13
13
  viewports: number[];
@@ -18,15 +18,17 @@ export const Inline = () => {
18
18
  export const Stacked = () => {
19
19
  return (_jsxs(Flex, { flexDirection: "column", gap: "x2", children: [_jsx(Heading1, { compact: true, children: "Stacked Layout" }), _jsx(DescriptionList, { layout: "stacked", children: _jsx(SampleContent, {}) })] }));
20
20
  };
21
- export const Auto = () => {
22
- return (_jsxs(Flex, { flexDirection: "column", gap: "x2", children: [_jsxs(Flex, { flexDirection: "column", gap: "x1", children: [_jsx(Heading1, { compact: true, children: "Auto Layout" }), _jsxs(Text, { fontSize: "sm", children: ["Automatically switches between ", _jsx(Code, { children: "stacked" }), " and ", _jsx(Code, { children: "inline" }), " layouts based on the specified container width. Default breakpoint is set to ", _jsx(Code, { children: "640px" }), "."] }), _jsxs(Flex, { alignItems: "center", gap: "half", mb: "x2", children: [_jsx(Icon, { icon: "info", color: "midGrey" }), _jsxs(Text, { fontSize: "sm", color: "darkGrey", children: ["The breakpoint is based on the container width, not the viewport width. See component", " ", _jsx(Link, { href: "https://github.com/nulogy/design-system/blob/main/src/DescriptionList/README.md", children: "documentation" }), "."] })] })] }), _jsx(Resizable, { containerWidth: "100%", showContainerOutline: true, children: _jsx(DescriptionList, { layout: "auto", autoLayoutBreakpoint: "640px", children: _jsx(SampleContent, {}) }) })] }));
23
- };
24
- Auto.parameters = {
25
- chromatic: {
26
- viewports: [
27
- parseInt(legacy.breakpoints.extraSmall),
28
- parseInt(legacy.breakpoints.small),
29
- parseInt(legacy.breakpoints.medium),
30
- ],
21
+ export const Auto = {
22
+ render: () => {
23
+ return (_jsxs(Flex, { flexDirection: "column", gap: "x2", children: [_jsxs(Flex, { flexDirection: "column", gap: "x1", children: [_jsx(Heading1, { compact: true, children: "Auto Layout" }), _jsxs(Text, { fontSize: "sm", children: ["Automatically switches between ", _jsx(Code, { children: "stacked" }), " and ", _jsx(Code, { children: "inline" }), " layouts based on the specified container width. Default breakpoint is set to ", _jsx(Code, { children: "640px" }), "."] }), _jsxs(Flex, { alignItems: "center", gap: "half", mb: "x2", children: [_jsx(Icon, { icon: "info", color: "midGrey" }), _jsxs(Text, { fontSize: "sm", color: "darkGrey", children: ["The breakpoint is based on the container width, not the viewport width. See component", " ", _jsx(Link, { href: "https://github.com/nulogy/design-system/blob/main/src/DescriptionList/README.md", children: "documentation" }), "."] })] })] }), _jsx(Resizable, { containerWidth: "100%", showContainerOutline: true, children: _jsx(DescriptionList, { layout: "auto", autoLayoutBreakpoint: "640px", children: _jsx(SampleContent, {}) }) })] }));
24
+ },
25
+ parameters: {
26
+ chromatic: {
27
+ viewports: [
28
+ parseInt(legacy.breakpoints.extraSmall),
29
+ parseInt(legacy.breakpoints.small),
30
+ parseInt(legacy.breakpoints.medium),
31
+ ],
32
+ },
31
33
  },
32
34
  };
@@ -1,4 +1,4 @@
1
- import type { StoryObj } from "@storybook/react";
1
+ import type { StoryObj } from "@storybook/react-vite";
2
2
  import DescriptionList from "../DescriptionList";
3
3
  declare const _default: {
4
4
  title: string;
@@ -2,6 +2,7 @@ import DescriptionList from "../DescriptionList";
2
2
  declare const _default: {
3
3
  title: string;
4
4
  component: typeof DescriptionList;
5
+ tags: string[];
5
6
  };
6
7
  export default _default;
7
8
  export { GroupMinWidth } from "./DescriptionList.group-min-width.story";
@@ -2,6 +2,9 @@ import DescriptionList from "../DescriptionList";
2
2
  export default {
3
3
  title: "Components/DescriptionList",
4
4
  component: DescriptionList,
5
+ // This file only re-exports stories defined in sibling files — the Storybook
6
+ // Vitest plugin can't transform re-exported stories, so we opt out of testing.
7
+ tags: ["!test"],
5
8
  };
6
9
  export { GroupMinWidth } from "./DescriptionList.group-min-width.story";
7
10
  export { Playground } from "./DescriptionList.playground.story";
@@ -6,54 +6,54 @@ declare const _default: {
6
6
  };
7
7
  export default _default;
8
8
  export declare const _DropdownMenu: {
9
- (): import("react/jsx-runtime").JSX.Element;
10
- story: {
11
- name: string;
12
- };
9
+ render: () => import("react/jsx-runtime").JSX.Element;
10
+ name: string;
11
+ play: ({ canvasElement, step }: {
12
+ canvasElement: any;
13
+ step: any;
14
+ }) => Promise<void>;
13
15
  };
14
16
  export declare const WithCustomTrigger: {
15
- (): import("react/jsx-runtime").JSX.Element;
16
- story: {
17
- name: string;
18
- };
17
+ render: () => import("react/jsx-runtime").JSX.Element;
18
+ name: string;
19
+ play: ({ canvasElement, step }: {
20
+ canvasElement: any;
21
+ step: any;
22
+ }) => Promise<void>;
19
23
  };
20
24
  export declare const WithCustomColors: {
21
- (): import("react/jsx-runtime").JSX.Element;
22
- story: {
23
- name: string;
24
- };
25
+ render: () => import("react/jsx-runtime").JSX.Element;
26
+ name: string;
25
27
  };
26
28
  export declare const WithButtonClosingMenu: {
27
- (): import("react/jsx-runtime").JSX.Element;
28
- story: {
29
- name: string;
30
- };
29
+ render: () => import("react/jsx-runtime").JSX.Element;
30
+ name: string;
31
+ play: ({ canvasElement, step }: {
32
+ canvasElement: any;
33
+ step: any;
34
+ }) => Promise<void>;
31
35
  };
32
36
  export declare const WithCustomLink: () => import("react/jsx-runtime").JSX.Element;
33
37
  export declare const WithCustomText: () => import("react/jsx-runtime").JSX.Element;
34
38
  export declare const SetToDefaultOpen: {
35
- (): import("react/jsx-runtime").JSX.Element;
36
- story: {
37
- name: string;
38
- };
39
+ render: () => import("react/jsx-runtime").JSX.Element;
40
+ name: string;
39
41
  };
40
42
  export declare const WithSubmenu: {
41
- (): import("react/jsx-runtime").JSX.Element;
42
- story: {
43
- name: string;
44
- };
43
+ render: () => import("react/jsx-runtime").JSX.Element;
44
+ name: string;
45
+ play: ({ canvasElement, step }: {
46
+ canvasElement: any;
47
+ step: any;
48
+ }) => Promise<void>;
45
49
  };
46
50
  export declare const WithVisitedLinks: () => import("react/jsx-runtime").JSX.Element;
47
51
  export declare const SetToDisabled: {
48
- (): import("react/jsx-runtime").JSX.Element;
49
- story: {
50
- name: string;
51
- };
52
+ render: () => import("react/jsx-runtime").JSX.Element;
53
+ name: string;
52
54
  };
53
55
  export declare const WithConditionallyRenderedMenuItems: () => import("react/jsx-runtime").JSX.Element;
54
56
  export declare const WithRenderProps: {
55
- (): import("react/jsx-runtime").JSX.Element;
56
- story: {
57
- name: string;
58
- };
57
+ render: () => import("react/jsx-runtime").JSX.Element;
58
+ name: string;
59
59
  };