@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,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from "react";
|
|
3
|
+
import { expect, screen, waitFor } from "storybook/test";
|
|
3
4
|
import { Input } from "../../Input";
|
|
4
5
|
import { Navigation } from "..";
|
|
5
6
|
import { ApplicationFrame, Page, Sidebar } from "../../Layout";
|
|
@@ -16,169 +17,177 @@ export default {
|
|
|
16
17
|
layout: "fullscreen",
|
|
17
18
|
},
|
|
18
19
|
};
|
|
19
|
-
export const BasicUsage =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
20
|
+
export const BasicUsage = {
|
|
21
|
+
render: () => (_jsx(ApplicationFrame, { navBar: _jsx(Navigation, { appSwitcher: {
|
|
22
|
+
apps: {
|
|
23
|
+
"production-scheduling": {
|
|
24
|
+
url: "https://nulogy.com/",
|
|
25
|
+
},
|
|
26
|
+
"supplier-collaboration": {
|
|
27
|
+
url: "https://nulogy.com/",
|
|
28
|
+
},
|
|
29
|
+
"digital-quality-inspection": {
|
|
30
|
+
url: "https://nulogy.com/",
|
|
31
|
+
},
|
|
32
|
+
"shop-floor": {
|
|
33
|
+
url: "https://nulogy.com/",
|
|
34
|
+
},
|
|
35
|
+
"smart-factory": {
|
|
36
|
+
url: "https://nulogy.com/",
|
|
37
|
+
},
|
|
38
|
+
connections: {
|
|
39
|
+
url: "https://nulogy.com/",
|
|
40
|
+
},
|
|
41
|
+
data: {
|
|
42
|
+
url: "https://nulogy.com/",
|
|
43
|
+
},
|
|
41
44
|
},
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
}, primaryNavigation: [
|
|
46
|
+
{
|
|
47
|
+
key: "dashboard",
|
|
48
|
+
label: "Dashboard",
|
|
49
|
+
type: "link",
|
|
50
|
+
props: {
|
|
51
|
+
href: "https://nulogy.com/",
|
|
52
|
+
},
|
|
50
53
|
},
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
{
|
|
55
|
+
key: "inspector",
|
|
56
|
+
label: "Inspector",
|
|
57
|
+
type: "link",
|
|
58
|
+
props: {
|
|
59
|
+
href: "https://nulogy.com/",
|
|
60
|
+
},
|
|
58
61
|
},
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
{
|
|
63
|
+
key: "reports",
|
|
64
|
+
label: "Reports",
|
|
65
|
+
type: "link",
|
|
66
|
+
props: {
|
|
67
|
+
href: "https://nulogy.com/",
|
|
68
|
+
},
|
|
66
69
|
},
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
{
|
|
71
|
+
key: "sheets",
|
|
72
|
+
label: "Sheets",
|
|
73
|
+
type: "button",
|
|
74
|
+
props: {
|
|
75
|
+
onClick: () => {
|
|
76
|
+
alert("You clicked Sheets");
|
|
77
|
+
},
|
|
75
78
|
},
|
|
76
79
|
},
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
80
|
+
{
|
|
81
|
+
key: "forms",
|
|
82
|
+
label: "Forms",
|
|
83
|
+
type: "button",
|
|
84
|
+
items: [
|
|
85
|
+
{
|
|
86
|
+
key: "quality-inspection-form",
|
|
87
|
+
label: "Quality Inspection Form",
|
|
88
|
+
type: "button",
|
|
89
|
+
props: {
|
|
90
|
+
onClick: () => {
|
|
91
|
+
alert("You clicked Quality Inspection Form");
|
|
92
|
+
},
|
|
90
93
|
},
|
|
91
94
|
},
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
95
|
+
{
|
|
96
|
+
key: "production-report-form",
|
|
97
|
+
label: "Production Report Form",
|
|
98
|
+
type: "button",
|
|
99
|
+
props: {
|
|
100
|
+
onClick: () => {
|
|
101
|
+
alert("You clicked Production Report Form");
|
|
102
|
+
},
|
|
100
103
|
},
|
|
101
104
|
},
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
105
|
+
{
|
|
106
|
+
key: "maintenance-request-form",
|
|
107
|
+
label: "Maintenance Request Form",
|
|
108
|
+
type: "button",
|
|
109
|
+
props: {
|
|
110
|
+
onClick: () => {
|
|
111
|
+
alert("You clicked Maintenance Request Form");
|
|
112
|
+
},
|
|
110
113
|
},
|
|
111
114
|
},
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
],
|
|
119
|
-
},
|
|
120
|
-
], secondaryNavigation: [
|
|
121
|
-
{
|
|
122
|
-
key: "search",
|
|
123
|
-
type: "button",
|
|
124
|
-
icon: "search",
|
|
125
|
-
tooltip: "Search",
|
|
126
|
-
props: {
|
|
127
|
-
onClick: () => {
|
|
128
|
-
alert("You clicked Search");
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
key: "settings",
|
|
134
|
-
type: "button",
|
|
135
|
-
icon: "settings",
|
|
136
|
-
tooltip: "Settings",
|
|
137
|
-
props: {
|
|
138
|
-
onClick: () => {
|
|
139
|
-
alert("You clicked Settings");
|
|
140
|
-
},
|
|
115
|
+
{
|
|
116
|
+
key: "inventory-count-form",
|
|
117
|
+
label: "Inventory Count Form",
|
|
118
|
+
type: "link",
|
|
119
|
+
},
|
|
120
|
+
],
|
|
141
121
|
},
|
|
142
|
-
|
|
143
|
-
], secondaryLogo: _jsx(CustomLogo3, { style: { width: "auto", height: 32 } }), userMenu: {
|
|
144
|
-
triggerText: { title: "haidera@nulogy.com", subtitle2: "Toronto, ON" },
|
|
145
|
-
header: {
|
|
146
|
-
title: "Haider Alshamma",
|
|
147
|
-
subtitle1: "haidera@nulogy.com",
|
|
148
|
-
subtitle2: "Nulogy",
|
|
149
|
-
},
|
|
150
|
-
controls: () => (_jsxs(Flex, { gap: "x2", flexDirection: "column", width: "100%", pt: "x1", children: [_jsx(Select, { labelText: "Company", defaultValue: ["Nulogy Canada"], options: [
|
|
151
|
-
{ value: "Nulogy Canada", label: "Nulogy - Canada" },
|
|
152
|
-
{ value: "Nulogy US", label: "Nulogy - US" },
|
|
153
|
-
{ value: "Nulogy UK", label: "Nulogy - UK" },
|
|
154
|
-
] }), _jsx(Select, { labelText: "User group", defaultValue: ["super-user"], options: [
|
|
155
|
-
{ value: "super-user", label: "Super User" },
|
|
156
|
-
{ value: "admin", label: "Admin" },
|
|
157
|
-
{ value: "user", label: "User" },
|
|
158
|
-
] })] })),
|
|
159
|
-
menuItems: [
|
|
122
|
+
], secondaryNavigation: [
|
|
160
123
|
{
|
|
161
|
-
key: "
|
|
162
|
-
label: "Preferences",
|
|
124
|
+
key: "search",
|
|
163
125
|
type: "button",
|
|
126
|
+
icon: "search",
|
|
127
|
+
tooltip: "Search",
|
|
164
128
|
props: {
|
|
165
129
|
onClick: () => {
|
|
166
|
-
|
|
130
|
+
alert("You clicked Search");
|
|
167
131
|
},
|
|
168
132
|
},
|
|
169
133
|
},
|
|
170
134
|
{
|
|
171
|
-
key: "
|
|
172
|
-
label: "Sign out",
|
|
135
|
+
key: "settings",
|
|
173
136
|
type: "button",
|
|
137
|
+
icon: "settings",
|
|
138
|
+
tooltip: "Settings",
|
|
174
139
|
props: {
|
|
175
140
|
onClick: () => {
|
|
176
|
-
|
|
141
|
+
alert("You clicked Settings");
|
|
177
142
|
},
|
|
178
143
|
},
|
|
179
144
|
},
|
|
180
|
-
],
|
|
181
|
-
|
|
145
|
+
], secondaryLogo: _jsx(CustomLogo3, { style: { width: "auto", height: 32 } }), userMenu: {
|
|
146
|
+
triggerText: { title: "haidera@nulogy.com", subtitle2: "Toronto, ON" },
|
|
147
|
+
header: {
|
|
148
|
+
title: "Haider Alshamma",
|
|
149
|
+
subtitle1: "haidera@nulogy.com",
|
|
150
|
+
subtitle2: "Nulogy",
|
|
151
|
+
},
|
|
152
|
+
controls: () => (_jsxs(Flex, { gap: "x2", flexDirection: "column", width: "100%", pt: "x1", children: [_jsx(Select, { labelText: "Company", defaultValue: ["Nulogy Canada"], options: [
|
|
153
|
+
{ value: "Nulogy Canada", label: "Nulogy - Canada" },
|
|
154
|
+
{ value: "Nulogy US", label: "Nulogy - US" },
|
|
155
|
+
{ value: "Nulogy UK", label: "Nulogy - UK" },
|
|
156
|
+
] }), _jsx(Select, { labelText: "User group", defaultValue: ["super-user"], options: [
|
|
157
|
+
{ value: "super-user", label: "Super User" },
|
|
158
|
+
{ value: "admin", label: "Admin" },
|
|
159
|
+
{ value: "user", label: "User" },
|
|
160
|
+
] })] })),
|
|
161
|
+
menuItems: [
|
|
162
|
+
{
|
|
163
|
+
key: "preferences",
|
|
164
|
+
label: "Preferences",
|
|
165
|
+
type: "button",
|
|
166
|
+
props: {
|
|
167
|
+
onClick: () => {
|
|
168
|
+
console.log("You clicked preferences");
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
key: "sign-out",
|
|
174
|
+
label: "Sign out",
|
|
175
|
+
type: "button",
|
|
176
|
+
props: {
|
|
177
|
+
onClick: () => {
|
|
178
|
+
console.log("You clicked sign out");
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
],
|
|
183
|
+
} }), children: _jsx(Page, { fullHeight: true, children: _jsx(Placeholder, {}) }) })),
|
|
184
|
+
play: async ({ canvasElement: _canvasElement, step }) => {
|
|
185
|
+
await step("renders primary navigation items", async () => {
|
|
186
|
+
await waitFor(() => expect(screen.getByText("Dashboard")).toBeVisible());
|
|
187
|
+
await expect(screen.getByText("Inspector")).toBeVisible();
|
|
188
|
+
});
|
|
189
|
+
},
|
|
190
|
+
};
|
|
182
191
|
export const WithACustomBreakpoint = () => {
|
|
183
192
|
const [breakpoint, setBreakpoint] = useState("1000px");
|
|
184
193
|
return (_jsx(ApplicationFrame, { navBar: _jsx(Navigation, { primaryNavigation: [{ key: "dashboard", label: "Dashboard", type: "link" }], secondaryNavigation: [{ key: "settings", icon: "settings", tooltip: "Settings", type: "button" }], breakpoint: breakpoint }), children: _jsx(Page, { fullHeight: true, children: _jsx(Sidebar, { height: "100%", width: "350px", hideCloseButton: true, isOpen: true, title: "Story information", overlay: "hide", top: "64px", bottom: "0px", children: _jsxs(Flex, { flexDirection: "column", gap: "x2", children: [_jsx(Input, { labelText: "Breakpoint", value: breakpoint, onChange: (e) => setBreakpoint(e.target.value) }), _jsxs(Text, { fontSize: "small", color: "darkGrey", children: ["The navigation will transition to desktop when the viewport is wider than ", _jsx(Code, { children: breakpoint }), "."] }), _jsxs(Text, { fontSize: "small", color: "darkGrey", children: ["You can also use any valid key from the ", _jsx("a", { href: "/?path=/story/tokens--breakpoints", children: "theme breakpoints" }), " ", "as a breakpoint value."] })] }) }) }) }));
|
|
@@ -5,7 +5,14 @@ declare const _default: {
|
|
|
5
5
|
};
|
|
6
6
|
};
|
|
7
7
|
export default _default;
|
|
8
|
-
export declare const BasicUsage:
|
|
8
|
+
export declare const BasicUsage: {
|
|
9
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
name: string;
|
|
11
|
+
play: ({ canvasElement: _canvasElement, step }: {
|
|
12
|
+
canvasElement: any;
|
|
13
|
+
step: any;
|
|
14
|
+
}) => Promise<void>;
|
|
15
|
+
};
|
|
9
16
|
export declare const WithoutATrigger: () => import("react/jsx-runtime").JSX.Element;
|
|
10
17
|
export declare const Header: () => import("react/jsx-runtime").JSX.Element;
|
|
11
18
|
export declare const Controls: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from "react";
|
|
3
|
+
import { expect, screen, waitFor } from "storybook/test";
|
|
3
4
|
import { BrowserRouter, Link } from "react-router-dom";
|
|
4
5
|
import { Flex } from "../../Flex";
|
|
5
6
|
import { Input } from "../../Input";
|
|
@@ -16,7 +17,7 @@ export default {
|
|
|
16
17
|
},
|
|
17
18
|
};
|
|
18
19
|
const userMenuToggleSelector = 'button[aria-label="Toggle user menu"]';
|
|
19
|
-
|
|
20
|
+
const BasicUsageComponent = () => {
|
|
20
21
|
useConditionalAutoClick({
|
|
21
22
|
selector: userMenuToggleSelector,
|
|
22
23
|
condition: {
|
|
@@ -64,6 +65,26 @@ export const BasicUsage = () => {
|
|
|
64
65
|
],
|
|
65
66
|
} }));
|
|
66
67
|
};
|
|
68
|
+
export const BasicUsage = {
|
|
69
|
+
render: () => _jsx(BasicUsageComponent, {}),
|
|
70
|
+
name: "Basic Usage",
|
|
71
|
+
play: async ({ canvasElement: _canvasElement, step }) => {
|
|
72
|
+
await step("auto-opens the user menu", async () => {
|
|
73
|
+
await waitFor(() => expect(screen.getByText("Haider Alshamma")).toBeVisible(), { timeout: 3000 });
|
|
74
|
+
});
|
|
75
|
+
await step("displays full user information in header", async () => {
|
|
76
|
+
await expect(screen.getAllByText("haidera@nulogy.com")[0]).toBeVisible();
|
|
77
|
+
});
|
|
78
|
+
await step("shows select controls", async () => {
|
|
79
|
+
await expect(screen.getByText("Company")).toBeVisible();
|
|
80
|
+
await expect(screen.getByText("User group")).toBeVisible();
|
|
81
|
+
});
|
|
82
|
+
await step("shows menu items", async () => {
|
|
83
|
+
await expect(screen.getByText("Preferences")).toBeVisible();
|
|
84
|
+
await expect(screen.getByText("Sign out")).toBeVisible();
|
|
85
|
+
});
|
|
86
|
+
},
|
|
87
|
+
};
|
|
67
88
|
export const WithoutATrigger = () => {
|
|
68
89
|
const [title, setTitle] = React.useState("haidera@nulogy.com");
|
|
69
90
|
const [subtitle1, setSubtitle1] = React.useState("Nulogy");
|
|
@@ -3,9 +3,7 @@ declare const _default: {
|
|
|
3
3
|
};
|
|
4
4
|
export default _default;
|
|
5
5
|
export declare const LightDefault: {
|
|
6
|
-
()
|
|
7
|
-
|
|
8
|
-
name: string;
|
|
9
|
-
};
|
|
6
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
name: string;
|
|
10
8
|
};
|
|
11
9
|
export declare const Dark: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,8 +4,8 @@ import { Text, Card } from "../index";
|
|
|
4
4
|
export default {
|
|
5
5
|
title: "Components/Overlay",
|
|
6
6
|
};
|
|
7
|
-
export const LightDefault =
|
|
8
|
-
|
|
7
|
+
export const LightDefault = {
|
|
8
|
+
render: () => (_jsxs(_Fragment, { children: [_jsx(Text, { children: "Background content" }), _jsx(Overlay, { children: "Overlay content" })] })),
|
|
9
9
|
name: "Light (default)",
|
|
10
10
|
};
|
|
11
11
|
export const Dark = () => (_jsxs(_Fragment, { children: [_jsx(Text, { children: "Background content" }), _jsx(Overlay, { dark: true, children: _jsx(Card, { children: _jsx(Text, { children: "Overlay content" }) }) })] }));
|
|
@@ -4,22 +4,23 @@ declare const _default: {
|
|
|
4
4
|
export default _default;
|
|
5
5
|
export declare const _Pagination: () => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export declare const OnTheFirstPage: {
|
|
7
|
-
()
|
|
8
|
-
|
|
9
|
-
name: string;
|
|
10
|
-
};
|
|
7
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
name: string;
|
|
11
9
|
};
|
|
12
10
|
export declare const OnTheLastPage: {
|
|
13
|
-
()
|
|
14
|
-
|
|
15
|
-
name: string;
|
|
16
|
-
};
|
|
11
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
name: string;
|
|
17
13
|
};
|
|
18
14
|
export declare const WithLessThan5Pages: {
|
|
19
|
-
()
|
|
20
|
-
|
|
21
|
-
name: string;
|
|
22
|
-
};
|
|
15
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
name: string;
|
|
23
17
|
};
|
|
24
18
|
export declare const CustomMaxVisiblePages: () => import("react/jsx-runtime").JSX.Element;
|
|
25
|
-
export declare
|
|
19
|
+
export declare const ScrollAfterPagination: {
|
|
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
|
+
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
import { expect, userEvent, waitFor, within } from "storybook/test";
|
|
3
4
|
import { styled } from "styled-components";
|
|
4
|
-
import { action } from "
|
|
5
|
+
import { action } from "storybook/actions";
|
|
5
6
|
import { Switch, Switcher } from "../Switcher";
|
|
6
7
|
import { Flex } from "../Flex";
|
|
7
8
|
import { Heading1, Text } from "../Type";
|
|
@@ -11,15 +12,18 @@ export default {
|
|
|
11
12
|
title: "Components/Pagination",
|
|
12
13
|
};
|
|
13
14
|
export const _Pagination = () => (_jsxs(Flex, { gap: "x2", flexDirection: "column", children: [_jsx(Pagination, { currentPage: 1, totalPages: 7, onNext: action("next"), onPrevious: action("previous"), onSelectPage: action("selected") }), _jsx(Pagination, { currentPage: 2, totalPages: 7 }), _jsx(Pagination, { currentPage: 3, totalPages: 7 }), _jsx(Pagination, { currentPage: 4, totalPages: 7 }), _jsx(Pagination, { currentPage: 5, totalPages: 7 }), _jsx(Pagination, { currentPage: 6, totalPages: 7 }), _jsx(Pagination, { currentPage: 7, totalPages: 7 })] }));
|
|
14
|
-
export const OnTheFirstPage =
|
|
15
|
-
|
|
15
|
+
export const OnTheFirstPage = {
|
|
16
|
+
render: () => _jsx(Pagination, { currentPage: 1, totalPages: 10 }),
|
|
16
17
|
name: "on the first page",
|
|
17
18
|
};
|
|
18
|
-
export const OnTheLastPage =
|
|
19
|
-
|
|
19
|
+
export const OnTheLastPage = {
|
|
20
|
+
render: () => _jsx(Pagination, { currentPage: 10, totalPages: 10 }),
|
|
20
21
|
name: "on the last page",
|
|
21
22
|
};
|
|
22
|
-
export const WithLessThan5Pages =
|
|
23
|
+
export const WithLessThan5Pages = {
|
|
24
|
+
render: () => _jsx(Pagination, { currentPage: 3, totalPages: 4 }),
|
|
25
|
+
name: "with less than 5 pages",
|
|
26
|
+
};
|
|
23
27
|
const AccentedRange = styled.input.attrs({ type: "range" }) `
|
|
24
28
|
accent-color: ${({ theme }) => theme.colors.darkBlue};
|
|
25
29
|
`;
|
|
@@ -34,10 +38,7 @@ export const CustomMaxVisiblePages = () => {
|
|
|
34
38
|
setCurrentPage(Number(page));
|
|
35
39
|
} })] }));
|
|
36
40
|
};
|
|
37
|
-
|
|
38
|
-
name: "with less than 5 pages",
|
|
39
|
-
};
|
|
40
|
-
export function ScrollAfterPagination() {
|
|
41
|
+
const ScrollAfterPaginationComponent = () => {
|
|
41
42
|
const [currentPage, setCurrentPage] = useState(1);
|
|
42
43
|
const [scrollTarget, setScrollTarget] = useState("none");
|
|
43
44
|
const ref = useRef(null);
|
|
@@ -58,4 +59,24 @@ export function ScrollAfterPagination() {
|
|
|
58
59
|
return (_jsxs(Flex, { gap: "x2", flexDirection: "column", alignItems: "flex-end", children: [_jsxs(Flex, { flexDirection: "column", gap: "x1", alignSelf: "flex-start", mb: "x2", children: [_jsx(Text, { fontSize: "small", fontWeight: "bold", children: "Scroll target after pagination" }), _jsxs(Switcher, { selected: scrollTarget, onChange: setScrollTarget, "aria-label": "scroll target", children: [_jsx(Switch, { value: "none", children: "None" }), _jsx(Switch, { value: "topOfPage", children: "Top of page" }), _jsx(Switch, { value: "topOfSection", children: "Top of section" })] })] }), _jsx(Box, { height: "180px", width: "100%", children: _jsx(Heading1, { "data-testid": "page-heading", children: messages[scrollTarget].page }) }), _jsx(Box, { ref: ref, p: "x4", height: "1400px", width: "100%", bg: "lightBlue", children: _jsx(Heading1, { "data-testid": "section-heading", children: messages[scrollTarget].section }) }), _jsx(Pagination, { scrollToTopAfterPagination: scrollTarget !== "none", scrollTargetRef: scrollTarget === "topOfSection" ? ref : undefined, currentPage: currentPage, totalPages: 7, onNext: () => setCurrentPage((p) => p + 1), onPrevious: () => setCurrentPage((p) => p - 1), onSelectPage: (page) => {
|
|
59
60
|
setCurrentPage(Number(page));
|
|
60
61
|
} })] }));
|
|
61
|
-
}
|
|
62
|
+
};
|
|
63
|
+
export const ScrollAfterPagination = {
|
|
64
|
+
render: () => _jsx(ScrollAfterPaginationComponent, {}),
|
|
65
|
+
name: "Scroll After Pagination",
|
|
66
|
+
play: async ({ canvasElement, step }) => {
|
|
67
|
+
const canvas = within(canvasElement);
|
|
68
|
+
await step("renders pagination with scroll target switcher", async () => {
|
|
69
|
+
await expect(canvas.getByRole("navigation", { name: "Pagination navigation" })).toBeInTheDocument();
|
|
70
|
+
});
|
|
71
|
+
await step("can switch scroll target to top of page", async () => {
|
|
72
|
+
await userEvent.click(canvas.getByText("Top of page"));
|
|
73
|
+
});
|
|
74
|
+
await step("can navigate to next page", async () => {
|
|
75
|
+
await userEvent.click(canvas.getByLabelText("Go to next results"));
|
|
76
|
+
await waitFor(() => expect(canvas.getByLabelText("Go to previous results")).not.toBeDisabled());
|
|
77
|
+
});
|
|
78
|
+
await step("can navigate back to previous page", async () => {
|
|
79
|
+
await userEvent.click(canvas.getByLabelText("Go to previous results"));
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
};
|
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
import { StoryObj } from "@storybook/react";
|
|
1
|
+
import { StoryObj } from "@storybook/react-vite";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Radio } from "../index";
|
|
4
4
|
declare const _default: {
|
|
5
5
|
title: string;
|
|
6
6
|
component: React.ForwardRefExoticComponent<Omit<{
|
|
7
|
-
children?: React.ReactNode
|
|
7
|
+
children?: React.ReactNode;
|
|
8
8
|
value?: string | readonly string[] | number | undefined;
|
|
9
9
|
ref?: React.Ref<HTMLInputElement>;
|
|
10
|
-
form?: string | undefined;
|
|
11
|
-
slot?: string | undefined;
|
|
12
|
-
style?: React.CSSProperties | undefined;
|
|
13
|
-
title?: string | undefined;
|
|
14
|
-
pattern?: string | undefined;
|
|
15
10
|
property?: string | undefined;
|
|
16
11
|
color?: string | undefined;
|
|
17
12
|
content?: string | undefined;
|
|
@@ -19,6 +14,11 @@ declare const _default: {
|
|
|
19
14
|
translate?: "yes" | "no" | undefined;
|
|
20
15
|
width?: number | string | undefined;
|
|
21
16
|
hidden?: boolean | undefined;
|
|
17
|
+
form?: string | undefined;
|
|
18
|
+
slot?: string | undefined;
|
|
19
|
+
style?: React.CSSProperties | undefined;
|
|
20
|
+
title?: string | undefined;
|
|
21
|
+
pattern?: string | undefined;
|
|
22
22
|
key?: React.Key | null | undefined;
|
|
23
23
|
defaultChecked?: boolean | undefined;
|
|
24
24
|
defaultValue?: string | number | readonly string[] | undefined;
|
|
@@ -28,7 +28,7 @@ declare const _default: {
|
|
|
28
28
|
autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {});
|
|
29
29
|
autoFocus?: boolean | undefined;
|
|
30
30
|
className?: string | undefined;
|
|
31
|
-
contentEditable?: (boolean | "true" | "false") | "inherit" | undefined;
|
|
31
|
+
contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
|
|
32
32
|
contextMenu?: string | undefined;
|
|
33
33
|
dir?: string | undefined;
|
|
34
34
|
draggable?: (boolean | "true" | "false") | undefined;
|
|
@@ -36,7 +36,6 @@ declare const _default: {
|
|
|
36
36
|
id?: string | undefined;
|
|
37
37
|
lang?: string | undefined;
|
|
38
38
|
nonce?: string | undefined;
|
|
39
|
-
placeholder?: string | undefined;
|
|
40
39
|
spellCheck?: (boolean | "true" | "false") | undefined;
|
|
41
40
|
tabIndex?: number | undefined;
|
|
42
41
|
radioGroup?: string | undefined;
|
|
@@ -257,9 +256,7 @@ declare const _default: {
|
|
|
257
256
|
onPointerCancel?: React.PointerEventHandler<HTMLInputElement>;
|
|
258
257
|
onPointerCancelCapture?: React.PointerEventHandler<HTMLInputElement>;
|
|
259
258
|
onPointerEnter?: React.PointerEventHandler<HTMLInputElement>;
|
|
260
|
-
onPointerEnterCapture?: React.PointerEventHandler<HTMLInputElement>;
|
|
261
259
|
onPointerLeave?: React.PointerEventHandler<HTMLInputElement>;
|
|
262
|
-
onPointerLeaveCapture?: React.PointerEventHandler<HTMLInputElement>;
|
|
263
260
|
onPointerOver?: React.PointerEventHandler<HTMLInputElement>;
|
|
264
261
|
onPointerOverCapture?: React.PointerEventHandler<HTMLInputElement>;
|
|
265
262
|
onPointerOut?: React.PointerEventHandler<HTMLInputElement>;
|
|
@@ -283,23 +280,24 @@ declare const _default: {
|
|
|
283
280
|
list?: string | undefined;
|
|
284
281
|
name?: string | undefined;
|
|
285
282
|
type?: React.HTMLInputTypeAttribute | undefined;
|
|
283
|
+
max?: number | string | undefined;
|
|
284
|
+
min?: number | string | undefined;
|
|
286
285
|
alt?: string | undefined;
|
|
287
286
|
src?: string | undefined;
|
|
288
287
|
disabled?: boolean | undefined;
|
|
289
|
-
formAction?: string | undefined;
|
|
288
|
+
formAction?: string | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS] | undefined;
|
|
290
289
|
formEncType?: string | undefined;
|
|
291
290
|
formMethod?: string | undefined;
|
|
292
291
|
formNoValidate?: boolean | undefined;
|
|
293
292
|
formTarget?: string | undefined;
|
|
294
|
-
autoComplete?:
|
|
293
|
+
autoComplete?: React.HTMLInputAutoCompleteAttribute | undefined;
|
|
295
294
|
accept?: string | undefined;
|
|
296
295
|
capture?: boolean | "user" | "environment" | undefined;
|
|
297
296
|
checked?: boolean | undefined;
|
|
298
|
-
max?: number | string | undefined;
|
|
299
297
|
maxLength?: number | undefined;
|
|
300
|
-
min?: number | string | undefined;
|
|
301
298
|
minLength?: number | undefined;
|
|
302
299
|
multiple?: boolean | undefined;
|
|
300
|
+
placeholder?: string | undefined;
|
|
303
301
|
readOnly?: boolean | undefined;
|
|
304
302
|
required?: boolean | undefined;
|
|
305
303
|
step?: number | string | undefined;
|