@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
|
@@ -11,14 +11,10 @@ export declare const Success: () => import("react/jsx-runtime").JSX.Element;
|
|
|
11
11
|
export declare const Warning: () => import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
export declare const Danger: () => import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
export declare const FollowingText: {
|
|
14
|
-
()
|
|
15
|
-
|
|
16
|
-
name: string;
|
|
17
|
-
};
|
|
14
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
name: string;
|
|
18
16
|
};
|
|
19
17
|
export declare const InsideFlex: {
|
|
20
|
-
()
|
|
21
|
-
|
|
22
|
-
name: string;
|
|
23
|
-
};
|
|
18
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
name: string;
|
|
24
20
|
};
|
|
@@ -14,11 +14,11 @@ export const Informative = () => _jsx(StatusIndicator, { type: "informative", ch
|
|
|
14
14
|
export const Success = () => _jsx(StatusIndicator, { type: "success", children: "Success" });
|
|
15
15
|
export const Warning = () => _jsx(StatusIndicator, { type: "warning", children: "Warning" });
|
|
16
16
|
export const Danger = () => _jsx(StatusIndicator, { type: "danger", children: "Danger" });
|
|
17
|
-
export const FollowingText =
|
|
18
|
-
|
|
17
|
+
export const FollowingText = {
|
|
18
|
+
render: () => (_jsxs(_Fragment, { children: [_jsxs(Box, { mb: "x3", children: [_jsx(Heading2, { inline: true, mr: "x1", children: "Label" }), _jsx(StatusIndicator, { children: "Status" })] }), _jsxs(Box, { mb: "x3", children: [_jsx(Heading3, { inline: true, mr: "x1", children: "Label" }), _jsx(StatusIndicator, { children: "Status" })] }), _jsxs(Box, { mb: "x3", children: [_jsx(Text, { inline: true, mr: "x1", children: "Label" }), _jsx(StatusIndicator, { children: "Status" })] }), _jsxs(Box, { mb: "x3", children: [_jsx(Text, { fontSize: "small", lineHeight: "smallTextBase", inline: true, mr: "x1", children: "Label" }), _jsx(StatusIndicator, { children: "Status" })] }), _jsxs(Box, { mb: "x3", children: [_jsx(Text, { fontSize: "smaller", lineHeight: "smallerText", inline: true, mr: "x1", children: "Label" }), _jsx(StatusIndicator, { children: "Status" })] }), _jsxs(Box, { mb: "x3", children: [_jsx(Text, { inline: true, mr: "x1", children: "Long label Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus in eleifend metus, in tempus sapien. Morbi eget felis est. Nunc facilisis vel nisi nec ornare. Ut blandit ullamcorper enim sed fringilla. Quisque malesuada pharetra tincidunt. Mauris mauris tortor, maximus vitae tempor ac, tincidunt pharetra augue. In eget suscipit est. Suspendisse feugiat risus urna" }), _jsx(StatusIndicator, { children: "Status" })] })] })),
|
|
19
19
|
name: "Following text",
|
|
20
20
|
};
|
|
21
|
-
export const InsideFlex =
|
|
22
|
-
|
|
21
|
+
export const InsideFlex = {
|
|
22
|
+
render: () => (_jsxs(_Fragment, { children: [_jsxs(Flex, { mb: "x3", children: [_jsx(Heading2, { inline: true, mr: "x1", mb: "0", children: "Label" }), _jsx(StatusIndicator, { className: "my-test-classname", children: "Status" })] }), _jsxs(Flex, { mb: "x3", children: [_jsx(Heading3, { inline: true, mr: "x1", mb: "0", children: "Label" }), _jsx(StatusIndicator, { children: "Status" })] }), _jsxs(Flex, { mb: "x3", children: [_jsx(Text, { inline: true, mr: "x1", mb: "0", children: "Label" }), _jsx(StatusIndicator, { children: "Status" })] }), _jsxs(Flex, { mb: "x3", children: [_jsx(Text, { fontSize: "small", lineHeight: "smallTextBase", inline: true, mr: "x1", mb: "0", children: "Label" }), _jsx(StatusIndicator, { children: "Status" })] }), _jsxs(Flex, { mb: "x3", children: [_jsx(Text, { fontSize: "smaller", lineHeight: "smallerText", inline: true, mr: "x1", mb: "0", children: "Label" }), _jsx(StatusIndicator, { children: "Status" })] })] })),
|
|
23
23
|
name: "Inside flex",
|
|
24
24
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { BoxProps } from "../Box/Box";
|
|
3
2
|
type SummaryProps = Omit<BoxProps, "as"> & {
|
|
4
3
|
breakpoint?: number | string;
|
|
5
4
|
};
|
|
6
|
-
declare
|
|
5
|
+
declare function Summary({ breakpoint, children, ...rest }: SummaryProps): import("react/jsx-runtime").JSX.Element;
|
|
7
6
|
export default Summary;
|
|
@@ -21,10 +21,10 @@ const SummaryWrapper = styled(Box)(({ theme, breakpoint }) => ({
|
|
|
21
21
|
rowGap: 0,
|
|
22
22
|
},
|
|
23
23
|
}));
|
|
24
|
-
|
|
24
|
+
function Summary({ breakpoint, children, ...rest }) {
|
|
25
25
|
const theme = useTheme();
|
|
26
26
|
breakpoint || (breakpoint = theme.breakpoints.medium);
|
|
27
27
|
const breakpointPx = numberFromDimension(breakpoint);
|
|
28
28
|
return (_jsx(SummaryContextProvider, { breakpoint: breakpointPx, children: _jsx(SummaryWrapper, { breakpoint: breakpointPx, ...rest, children: children }) }));
|
|
29
|
-
}
|
|
29
|
+
}
|
|
30
30
|
export default Summary;
|
|
@@ -3,5 +3,7 @@ type SummaryContextValue = {
|
|
|
3
3
|
breakpoint: number;
|
|
4
4
|
};
|
|
5
5
|
export declare function useSummaryContext(): SummaryContextValue;
|
|
6
|
-
export declare
|
|
6
|
+
export declare function SummaryContextProvider({ breakpoint, children }: SummaryContextValue & {
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
7
9
|
export {};
|
|
@@ -8,8 +8,8 @@ export function useSummaryContext() {
|
|
|
8
8
|
}
|
|
9
9
|
return context;
|
|
10
10
|
}
|
|
11
|
-
export
|
|
11
|
+
export function SummaryContextProvider({ breakpoint, children }) {
|
|
12
12
|
return (_jsx(SummaryContext.Provider, { value: {
|
|
13
13
|
breakpoint,
|
|
14
14
|
}, children: children }));
|
|
15
|
-
}
|
|
15
|
+
}
|
|
@@ -4,5 +4,5 @@ type SummaryItemProps = Omit<FlexProps, "as"> & {
|
|
|
4
4
|
value: number | string;
|
|
5
5
|
status: React.ReactNode;
|
|
6
6
|
};
|
|
7
|
-
declare
|
|
7
|
+
declare function SummaryItem({ value, status, ...rest }: SummaryItemProps): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export default SummaryItem;
|
|
@@ -11,10 +11,10 @@ const SummaryItemWrapper = styled(Flex)(({ theme, breakpoint }) => ({
|
|
|
11
11
|
flexDirection: "row",
|
|
12
12
|
},
|
|
13
13
|
}));
|
|
14
|
-
|
|
14
|
+
function SummaryItem({ value, status, ...rest }) {
|
|
15
15
|
const { breakpoint } = useSummaryContext();
|
|
16
16
|
const matches = useMediaQuery(`(max-width: ${breakpoint}px)`);
|
|
17
17
|
delete rest["children"];
|
|
18
18
|
return (_jsxs(SummaryItemWrapper, { breakpoint: breakpoint, ...rest, children: [_jsx(Text, { fontWeight: "medium", fontSize: !matches ? "heading4" : undefined, children: value }), status] }));
|
|
19
|
-
}
|
|
19
|
+
}
|
|
20
20
|
export default SummaryItem;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ReactElement } from "react";
|
|
2
2
|
import type { ComponentVariant } from "../NDSProvider/ComponentVariantContext";
|
|
3
3
|
import type { SwitchProps } from "./Switch";
|
|
4
4
|
type SwitcherProps = {
|
|
@@ -7,5 +7,5 @@ type SwitcherProps = {
|
|
|
7
7
|
selected?: string;
|
|
8
8
|
onChange?: (value: string) => void;
|
|
9
9
|
};
|
|
10
|
-
declare
|
|
10
|
+
declare function Switcher({ variant, selected, onChange, ...rest }: SwitcherProps): import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
export default Switcher;
|
|
@@ -3,7 +3,7 @@ import React from "react";
|
|
|
3
3
|
import { Box } from "../Box";
|
|
4
4
|
import FocusManager from "../utils/ts/FocusManager";
|
|
5
5
|
import { useComponentVariant } from "../NDSProvider/ComponentVariantContext";
|
|
6
|
-
|
|
6
|
+
function Switcher({ variant, selected, onChange, ...rest }) {
|
|
7
7
|
const componentVariant = useComponentVariant(variant);
|
|
8
8
|
const optionRefs = [];
|
|
9
9
|
const isSelected = (value, index) => {
|
|
@@ -37,5 +37,5 @@ const Switcher = ({ variant, selected, onChange, ...rest }) => {
|
|
|
37
37
|
});
|
|
38
38
|
};
|
|
39
39
|
return (_jsx(Box, { display: "inline-flex", bg: "whiteGrey", borderRadius: "9999px", ...rest, children: _jsx(FocusManager, { refs: optionRefs, defaultFocusedIndex: getSelectedIndex(), children: ({ focusedIndex, setFocusedIndex, handleArrowNavigation }) => options(focusedIndex, setFocusedIndex, handleArrowNavigation) }) }));
|
|
40
|
-
}
|
|
40
|
+
}
|
|
41
41
|
export default Switcher;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
export declare const WithSelectedValue: () => import("react/jsx-runtime").JSX.Element;
|
|
2
|
-
export declare const WithOtherInteractiveElements:
|
|
2
|
+
export declare const WithOtherInteractiveElements: {
|
|
3
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
name: string;
|
|
5
|
+
play: ({ canvasElement, step }: {
|
|
6
|
+
canvasElement: any;
|
|
7
|
+
step: any;
|
|
8
|
+
}) => Promise<void>;
|
|
9
|
+
};
|
|
3
10
|
export declare const WithContent: () => import("react/jsx-runtime").JSX.Element;
|
|
4
11
|
declare const _default: {
|
|
5
12
|
title: string;
|
|
@@ -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, userEvent, within } from "storybook/test";
|
|
3
4
|
import { Box } from "../Box";
|
|
4
5
|
import { Text } from "../Type";
|
|
5
6
|
import { Button } from "../Button";
|
|
@@ -10,7 +11,18 @@ export const WithSelectedValue = () => {
|
|
|
10
11
|
const [selected, setSelected] = useState("option_2");
|
|
11
12
|
return (_jsxs(Switcher, { "aria-label": "storybook-switcher", selected: selected, onChange: setSelected, children: [_jsx(Switch, { value: "option_1", children: "Option 1" }), _jsx(Switch, { value: "option_2", children: "Option 2" })] }));
|
|
12
13
|
};
|
|
13
|
-
export const WithOtherInteractiveElements =
|
|
14
|
+
export const WithOtherInteractiveElements = {
|
|
15
|
+
render: () => (_jsxs(Flex, { gap: "x1", alignItems: "center", children: [_jsx(Button, { children: "Click me" }), _jsxs(Switcher, { "aria-label": "storybook-switcher", selected: "option_2", children: [_jsx(Switch, { value: "option_1", children: "Option 1" }), _jsx(Switch, { value: "option_2", children: "Option 2" })] })] })),
|
|
16
|
+
name: "with other interactive elements",
|
|
17
|
+
play: async ({ canvasElement, step }) => {
|
|
18
|
+
const canvas = within(canvasElement);
|
|
19
|
+
await step("focuses the selected switch when tabbing from another element", async () => {
|
|
20
|
+
canvas.getByText("Click me").focus();
|
|
21
|
+
await userEvent.tab();
|
|
22
|
+
await expect(document.activeElement).toHaveTextContent("Option 2");
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
};
|
|
14
26
|
export const WithContent = () => {
|
|
15
27
|
const [selected, setSelected] = useState("all");
|
|
16
28
|
return (_jsxs(_Fragment, { children: [_jsxs(Switcher, { "aria-label": "storybook-switcher", selected: selected, onChange: setSelected, children: [_jsx(Switch, { value: "all", children: "All" }), _jsx(Switch, { value: "option_1", children: "Option 1" }), _jsx(Switch, { value: "option_2", children: "Option 2" })] }), _jsxs(Box, { px: "x1", py: "x3", children: [["all", "option_1"].includes(selected) && _jsx(Text, { children: "Option 1 Content" }), ["all", "option_2"].includes(selected) && _jsx(Text, { children: "Option 2 Content" })] })] }));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { action } from "
|
|
2
|
+
import { action } from "storybook/actions";
|
|
3
3
|
import { Box, DropdownButton, DropdownMenu, Button, Text, Flex } from "../..";
|
|
4
4
|
import { getMockRows, mockColumns } from "../Table.mock-utils";
|
|
5
5
|
import { Table } from "..";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { action } from "
|
|
2
|
+
import { action } from "storybook/actions";
|
|
3
3
|
import { Input } from "../../Input";
|
|
4
4
|
import { Table } from "..";
|
|
5
5
|
import { Box } from "../../Box";
|
|
@@ -3,14 +3,10 @@ declare const _default: {
|
|
|
3
3
|
};
|
|
4
4
|
export default _default;
|
|
5
5
|
export declare const Default: {
|
|
6
|
-
()
|
|
7
|
-
|
|
8
|
-
name: string;
|
|
9
|
-
};
|
|
6
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
name: string;
|
|
10
8
|
};
|
|
11
9
|
export declare const Compact: {
|
|
12
|
-
()
|
|
13
|
-
|
|
14
|
-
name: string;
|
|
15
|
-
};
|
|
10
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
name: string;
|
|
16
12
|
};
|
|
@@ -58,11 +58,11 @@ const rowData = [
|
|
|
58
58
|
export default {
|
|
59
59
|
title: "Components/Table/Density",
|
|
60
60
|
};
|
|
61
|
-
export const Default =
|
|
62
|
-
|
|
61
|
+
export const Default = {
|
|
62
|
+
render: () => _jsx(Table, { columns: columns, rows: rowData }),
|
|
63
63
|
name: "Default",
|
|
64
64
|
};
|
|
65
|
-
export const Compact =
|
|
66
|
-
|
|
65
|
+
export const Compact = {
|
|
66
|
+
render: () => _jsx(Table, { columns: columns, rows: rowData, compact: true }),
|
|
67
67
|
name: "Compact",
|
|
68
68
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { expect, userEvent, waitFor, within } from "storybook/test";
|
|
3
|
+
import { action } from "storybook/actions";
|
|
3
4
|
import { useState } from "react";
|
|
4
5
|
import { Box, DropdownButton, DropdownMenu, Text } from "../..";
|
|
5
6
|
import { Table } from "..";
|
|
@@ -176,6 +177,21 @@ export const WithPagination = {
|
|
|
176
177
|
},
|
|
177
178
|
},
|
|
178
179
|
name: "with pagination",
|
|
180
|
+
play: async ({ canvasElement, step }) => {
|
|
181
|
+
const canvas = within(canvasElement);
|
|
182
|
+
await step("navigates to next page", async () => {
|
|
183
|
+
await userEvent.click(canvas.getByLabelText("Go to next results"));
|
|
184
|
+
await expect(canvas.getByTestId("table-body")).toHaveTextContent("2019-10-02");
|
|
185
|
+
});
|
|
186
|
+
await step("navigates to previous page", async () => {
|
|
187
|
+
await userEvent.click(canvas.getByLabelText("Go to previous results"));
|
|
188
|
+
await expect(canvas.getByTestId("table-body")).toHaveTextContent("2019-10-01");
|
|
189
|
+
});
|
|
190
|
+
await step("navigates to a specific page", async () => {
|
|
191
|
+
await userEvent.click(canvas.getByRole("button", { name: "Go to page 5" }));
|
|
192
|
+
await expect(canvas.getByTestId("table-body")).toHaveTextContent("2019-10-07");
|
|
193
|
+
});
|
|
194
|
+
},
|
|
179
195
|
};
|
|
180
196
|
export const WithEverything = {
|
|
181
197
|
args: {
|
|
@@ -204,6 +220,26 @@ export const WithEverything = {
|
|
|
204
220
|
},
|
|
205
221
|
},
|
|
206
222
|
name: "with everything",
|
|
223
|
+
play: async ({ canvasElement, step }) => {
|
|
224
|
+
const canvas = within(canvasElement);
|
|
225
|
+
await step("can expand a row", async () => {
|
|
226
|
+
await userEvent.click(canvas.getByLabelText("Expand row"));
|
|
227
|
+
await expect(canvas.getByTestId("table-body")).toHaveTextContent("Expands!");
|
|
228
|
+
});
|
|
229
|
+
await step("can collapse the expanded row", async () => {
|
|
230
|
+
await userEvent.click(canvas.getByLabelText("Collapse row"));
|
|
231
|
+
await waitFor(() => expect(canvas.getByTestId("table-body")).not.toHaveTextContent("Expands!"));
|
|
232
|
+
});
|
|
233
|
+
await step("saves row selections when navigating pages", async () => {
|
|
234
|
+
const tableHead = canvasElement.querySelector("[data-testid='table-head']");
|
|
235
|
+
await userEvent.click(within(tableHead).getByTestId("visual-checkbox"));
|
|
236
|
+
const headerInput = canvasElement.querySelector("[data-testid='table-head'] [type='checkbox']");
|
|
237
|
+
await expect(headerInput).toBeChecked();
|
|
238
|
+
await userEvent.click(canvas.getByLabelText("Go to next results"));
|
|
239
|
+
await userEvent.click(canvas.getByLabelText("Go to previous results"));
|
|
240
|
+
await expect(headerInput).toBeChecked();
|
|
241
|
+
});
|
|
242
|
+
},
|
|
207
243
|
};
|
|
208
244
|
export const WithOnHoverActions = {
|
|
209
245
|
render: (args) => {
|
|
@@ -58,7 +58,7 @@ const TableWithCustomSorting = () => {
|
|
|
58
58
|
export default {
|
|
59
59
|
title: "Components/Table/with custom sorting",
|
|
60
60
|
};
|
|
61
|
-
export const WithCustomSorting =
|
|
62
|
-
|
|
61
|
+
export const WithCustomSorting = {
|
|
62
|
+
render: () => _jsx(TableWithCustomSorting, {}),
|
|
63
63
|
name: "with custom sorting",
|
|
64
64
|
};
|
|
@@ -3,14 +3,10 @@ declare const _default: {
|
|
|
3
3
|
};
|
|
4
4
|
export default _default;
|
|
5
5
|
export declare const WithExpandableRows: {
|
|
6
|
-
()
|
|
7
|
-
|
|
8
|
-
name: string;
|
|
9
|
-
};
|
|
6
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
name: string;
|
|
10
8
|
};
|
|
11
9
|
export declare const WithRowsExpandedByDefault: {
|
|
12
|
-
()
|
|
13
|
-
|
|
14
|
-
name: string;
|
|
15
|
-
};
|
|
10
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
name: string;
|
|
16
12
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { action } from "
|
|
2
|
+
import { action } from "storybook/actions";
|
|
3
3
|
import { Table } from "..";
|
|
4
4
|
import { Box, Text } from "../..";
|
|
5
5
|
const columns = [
|
|
@@ -64,11 +64,11 @@ const rowDataWithExpandable = [
|
|
|
64
64
|
export default {
|
|
65
65
|
title: "Components/Table/with expandable rows",
|
|
66
66
|
};
|
|
67
|
-
export const WithExpandableRows =
|
|
68
|
-
|
|
67
|
+
export const WithExpandableRows = {
|
|
68
|
+
render: () => (_jsx(Table, { columns: columns, rows: rowDataWithExpandable, hasExpandableRows: true, onRowExpansionChange: action("toggled expand") })),
|
|
69
69
|
name: "with expandable rows",
|
|
70
70
|
};
|
|
71
|
-
export const WithRowsExpandedByDefault =
|
|
72
|
-
|
|
71
|
+
export const WithRowsExpandedByDefault = {
|
|
72
|
+
render: () => (_jsx(Table, { columns: columns, rows: rowDataWithExpandable, hasExpandableRows: true, expandedRows: ["2019-10-04", "2019-10-22"], keyField: "date", onRowSelectionChange: action("row selection changed") })),
|
|
73
73
|
name: "with rows expanded by default",
|
|
74
74
|
};
|
|
@@ -3,14 +3,14 @@ declare const _default: {
|
|
|
3
3
|
};
|
|
4
4
|
export default _default;
|
|
5
5
|
export declare const WithFiltering: {
|
|
6
|
-
()
|
|
7
|
-
|
|
8
|
-
name: string;
|
|
9
|
-
};
|
|
6
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
name: string;
|
|
10
8
|
};
|
|
11
9
|
export declare const WithFilteringAndPagination: {
|
|
12
|
-
()
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
name: string;
|
|
12
|
+
play: ({ canvasElement, step }: {
|
|
13
|
+
canvasElement: any;
|
|
14
|
+
step: any;
|
|
15
|
+
}) => Promise<void>;
|
|
16
16
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useEffect } from "react";
|
|
3
|
+
import { expect, userEvent, waitFor, within } from "storybook/test";
|
|
3
4
|
import { Table } from "../..";
|
|
4
5
|
import { Input } from "../../Input";
|
|
5
6
|
const COLUMNS = [
|
|
@@ -51,11 +52,21 @@ const TableWithFilters = ({ rowsPerPage }) => {
|
|
|
51
52
|
export default {
|
|
52
53
|
title: "Components/Table/with filtering",
|
|
53
54
|
};
|
|
54
|
-
export const WithFiltering =
|
|
55
|
-
|
|
55
|
+
export const WithFiltering = {
|
|
56
|
+
render: () => _jsx(TableWithFilters, {}),
|
|
56
57
|
name: "with filtering",
|
|
57
58
|
};
|
|
58
|
-
export const WithFilteringAndPagination =
|
|
59
|
-
|
|
59
|
+
export const WithFilteringAndPagination = {
|
|
60
|
+
render: () => _jsx(TableWithFilters, { rowsPerPage: 4 }),
|
|
60
61
|
name: "with filtering and pagination",
|
|
62
|
+
play: async ({ canvasElement, step }) => {
|
|
63
|
+
const canvas = within(canvasElement);
|
|
64
|
+
await step("shows multiple pages for unfiltered data", async () => {
|
|
65
|
+
await expect(canvas.getByRole("button", { name: "Go to page 3" })).toBeInTheDocument();
|
|
66
|
+
});
|
|
67
|
+
await step("filters down to fewer pages", async () => {
|
|
68
|
+
await userEvent.type(canvas.getByRole("textbox", { name: "Filter by Name" }), "a");
|
|
69
|
+
await waitFor(() => expect(canvas.queryByRole("button", { name: "Go to page 3" })).not.toBeInTheDocument());
|
|
70
|
+
});
|
|
71
|
+
},
|
|
61
72
|
};
|
|
@@ -3,14 +3,14 @@ declare const _default: {
|
|
|
3
3
|
};
|
|
4
4
|
export default _default;
|
|
5
5
|
export declare const WithSelectableRows: {
|
|
6
|
-
()
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
name: string;
|
|
8
|
+
play: ({ canvasElement, step }: {
|
|
9
|
+
canvasElement: any;
|
|
10
|
+
step: any;
|
|
11
|
+
}) => Promise<void>;
|
|
10
12
|
};
|
|
11
13
|
export declare const WithPreselectedRows: {
|
|
12
|
-
()
|
|
13
|
-
|
|
14
|
-
name: string;
|
|
15
|
-
};
|
|
14
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
name: string;
|
|
16
16
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { expect, userEvent, within } from "storybook/test";
|
|
3
|
+
import { action } from "storybook/actions";
|
|
3
4
|
import { Table } from "..";
|
|
4
5
|
const columns = [
|
|
5
6
|
{ label: "Date", dataKey: "date" },
|
|
@@ -59,11 +60,27 @@ const rowData = [
|
|
|
59
60
|
export default {
|
|
60
61
|
title: "Components/Table/with selectable rows",
|
|
61
62
|
};
|
|
62
|
-
export const WithSelectableRows =
|
|
63
|
-
|
|
63
|
+
export const WithSelectableRows = {
|
|
64
|
+
render: () => (_jsx(Table, { columns: columns, rows: rowData, hasSelectableRows: true, onRowSelectionChange: action("row selection changed") })),
|
|
64
65
|
name: "with selectable rows",
|
|
66
|
+
play: async ({ canvasElement, step }) => {
|
|
67
|
+
const canvas = within(canvasElement);
|
|
68
|
+
await step("can select a row by clicking its checkbox", async () => {
|
|
69
|
+
const tableBody = canvas.getByTestId("table-body");
|
|
70
|
+
const rowCheckboxes = within(tableBody).getAllByTestId("visual-checkbox");
|
|
71
|
+
await userEvent.click(rowCheckboxes[0]);
|
|
72
|
+
const rowInputs = canvasElement.querySelectorAll("[data-testid='table-body'] [type='checkbox']");
|
|
73
|
+
await expect(rowInputs[0]).toBeChecked();
|
|
74
|
+
});
|
|
75
|
+
await step("can select all rows using the header checkbox", async () => {
|
|
76
|
+
const tableHead = canvasElement.querySelector("[data-testid='table-head']");
|
|
77
|
+
await userEvent.click(within(tableHead).getByTestId("visual-checkbox"));
|
|
78
|
+
const headerInput = canvasElement.querySelector("[data-testid='table-head'] [type='checkbox']");
|
|
79
|
+
await expect(headerInput).toBeChecked();
|
|
80
|
+
});
|
|
81
|
+
},
|
|
65
82
|
};
|
|
66
|
-
export const WithPreselectedRows =
|
|
67
|
-
|
|
83
|
+
export const WithPreselectedRows = {
|
|
84
|
+
render: () => (_jsx(Table, { columns: columns, rows: rowData, hasSelectableRows: true, selectedRows: ["2019-10-01"], keyField: "date", onRowSelectionChange: action("row selection changed") })),
|
|
68
85
|
name: "with preselected rows",
|
|
69
86
|
};
|
|
@@ -3,8 +3,6 @@ declare const _default: {
|
|
|
3
3
|
};
|
|
4
4
|
export default _default;
|
|
5
5
|
export declare const WithServerSidePagination: {
|
|
6
|
-
()
|
|
7
|
-
|
|
8
|
-
name: string;
|
|
9
|
-
};
|
|
6
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
name: string;
|
|
10
8
|
};
|
|
@@ -55,7 +55,7 @@ class TableWithServerSidePagination extends React.Component {
|
|
|
55
55
|
export default {
|
|
56
56
|
title: "Components/Table/with server side pagination",
|
|
57
57
|
};
|
|
58
|
-
export const WithServerSidePagination =
|
|
59
|
-
|
|
58
|
+
export const WithServerSidePagination = {
|
|
59
|
+
render: () => _jsx(TableWithServerSidePagination, {}),
|
|
60
60
|
name: "with server-side pagination",
|
|
61
61
|
};
|
|
@@ -7,5 +7,5 @@ type TabScrollIndicatorProps = {
|
|
|
7
7
|
ariaLabelLeft?: string;
|
|
8
8
|
ariaLabelRight?: string;
|
|
9
9
|
};
|
|
10
|
-
declare
|
|
10
|
+
declare function TabScrollIndicator({ side, width, ariaLabelLeft, ariaLabelRight, onClick, ...props }: TabScrollIndicatorProps): import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
export default TabScrollIndicator;
|
|
@@ -36,7 +36,7 @@ const TabScrollIndicatorButton = styled.button(({ side, width, theme }) => ({
|
|
|
36
36
|
opacity: ".5",
|
|
37
37
|
},
|
|
38
38
|
}));
|
|
39
|
-
|
|
39
|
+
function TabScrollIndicator({ side = "left", width = 40, ariaLabelLeft, ariaLabelRight, onClick, ...props }) {
|
|
40
40
|
const { t } = useTranslation();
|
|
41
41
|
const rightArrowLabel = ariaLabelRight || t("next");
|
|
42
42
|
const leftArrowLabel = ariaLabelLeft || t("previous");
|
|
@@ -44,5 +44,5 @@ const TabScrollIndicator = ({ side = "left", width = 40, ariaLabelLeft, ariaLabe
|
|
|
44
44
|
event.preventDefault();
|
|
45
45
|
}
|
|
46
46
|
return (_jsx(TabScrollIndicatorButton, { ...props, width: width, tabIndex: -1, onClick: onClick, onMouseDown: preventFocusMovement, side: side, "aria-label": side === "right" ? rightArrowLabel : leftArrowLabel, children: _jsx(Icon, { icon: side === "right" ? "rightArrow" : "leftArrow" }) }));
|
|
47
|
-
}
|
|
47
|
+
}
|
|
48
48
|
export default TabScrollIndicator;
|