@dxc-technology/halstack-react 0.0.0-f2bad31 → 0.0.0-f319e71
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/BackgroundColorContext.js +1 -1
- package/HalstackContext.d.ts +2 -5
- package/HalstackContext.js +6 -6
- package/accordion/Accordion.accessibility.test.d.ts +1 -0
- package/accordion/Accordion.accessibility.test.js +4 -4
- package/accordion/Accordion.js +9 -10
- package/accordion/Accordion.stories.tsx +4 -14
- package/accordion/Accordion.test.d.ts +1 -0
- package/accordion/Accordion.test.js +3 -3
- package/accordion-group/AccordionGroup.accessibility.test.d.ts +1 -0
- package/accordion-group/AccordionGroup.accessibility.test.js +11 -17
- package/accordion-group/AccordionGroup.js +1 -1
- package/accordion-group/AccordionGroup.stories.tsx +23 -23
- package/accordion-group/AccordionGroup.test.d.ts +1 -0
- package/accordion-group/AccordionGroup.test.js +5 -9
- package/accordion-group/AccordionGroupAccordion.js +1 -1
- package/action-icon/ActionIcon.accessibility.test.d.ts +1 -0
- package/action-icon/ActionIcon.accessibility.test.js +4 -4
- package/action-icon/ActionIcon.test.d.ts +1 -0
- package/action-icon/ActionIcon.test.js +1 -1
- package/alert/Alert.accessibility.test.d.ts +1 -0
- package/alert/Alert.accessibility.test.js +6 -6
- package/alert/Alert.js +6 -3
- package/alert/Alert.test.d.ts +1 -0
- package/alert/Alert.test.js +1 -1
- package/badge/Badge.accessibility.test.d.ts +1 -0
- package/badge/Badge.accessibility.test.js +5 -5
- package/badge/Badge.js +6 -4
- package/badge/Badge.stories.tsx +11 -11
- package/badge/Badge.test.d.ts +1 -0
- package/badge/Badge.test.js +2 -2
- package/badge/types.d.ts +1 -1
- package/box/Box.accessibility.test.d.ts +1 -0
- package/box/Box.accessibility.test.js +3 -3
- package/box/Box.js +1 -1
- package/box/Box.test.d.ts +1 -0
- package/box/Box.test.js +1 -1
- package/breadcrumbs/Breadcrumbs.accessibility.test.d.ts +1 -0
- package/breadcrumbs/Breadcrumbs.accessibility.test.js +96 -0
- package/breadcrumbs/Breadcrumbs.d.ts +4 -0
- package/breadcrumbs/Breadcrumbs.js +79 -0
- package/breadcrumbs/Breadcrumbs.stories.tsx +194 -0
- package/breadcrumbs/Breadcrumbs.test.d.ts +1 -0
- package/breadcrumbs/Breadcrumbs.test.js +168 -0
- package/breadcrumbs/Item.d.ts +4 -0
- package/breadcrumbs/Item.js +52 -0
- package/breadcrumbs/dropdownTheme.d.ts +53 -0
- package/breadcrumbs/dropdownTheme.js +62 -0
- package/breadcrumbs/types.d.ts +16 -0
- package/breadcrumbs/types.js +5 -0
- package/bulleted-list/BulletedList.accessibility.test.d.ts +1 -0
- package/bulleted-list/BulletedList.accessibility.test.js +18 -6
- package/bulleted-list/BulletedList.js +2 -2
- package/button/Button.accessibility.test.d.ts +1 -0
- package/button/Button.accessibility.test.js +6 -6
- package/button/Button.js +1 -1
- package/button/Button.stories.tsx +3 -3
- package/button/Button.test.d.ts +1 -0
- package/button/Button.test.js +1 -1
- package/card/Card.accessibility.test.d.ts +1 -0
- package/card/Card.accessibility.test.js +3 -3
- package/card/Card.js +3 -2
- package/card/Card.stories.tsx +1 -1
- package/card/Card.test.d.ts +1 -0
- package/card/Card.test.js +1 -1
- package/checkbox/Checkbox.accessibility.test.d.ts +1 -0
- package/checkbox/Checkbox.accessibility.test.js +5 -5
- package/checkbox/Checkbox.js +10 -13
- package/checkbox/Checkbox.test.d.ts +1 -0
- package/checkbox/Checkbox.test.js +1 -1
- package/chip/Chip.accessibility.test.d.ts +1 -0
- package/chip/Chip.accessibility.test.js +4 -4
- package/chip/Chip.js +3 -1
- package/chip/Chip.stories.tsx +1 -1
- package/chip/Chip.test.d.ts +1 -0
- package/chip/Chip.test.js +1 -1
- package/common/coreTokens.js +3 -3
- package/common/variables.d.ts +2 -5
- package/common/variables.js +68 -71
- package/container/Container.stories.tsx +3 -3
- package/contextual-menu/ContextualMenu.accessibility.test.d.ts +1 -0
- package/contextual-menu/ContextualMenu.accessibility.test.js +15 -3
- package/contextual-menu/ContextualMenu.d.ts +3 -5
- package/contextual-menu/ContextualMenu.js +89 -52
- package/contextual-menu/ContextualMenu.stories.tsx +115 -74
- package/contextual-menu/ContextualMenu.test.d.ts +1 -0
- package/contextual-menu/ContextualMenu.test.js +200 -24
- package/contextual-menu/GroupItem.d.ts +4 -0
- package/contextual-menu/GroupItem.js +67 -0
- package/contextual-menu/ItemAction.d.ts +4 -0
- package/contextual-menu/ItemAction.js +50 -0
- package/contextual-menu/MenuItem.d.ts +4 -0
- package/contextual-menu/MenuItem.js +29 -0
- package/contextual-menu/SingleItem.d.ts +4 -0
- package/contextual-menu/SingleItem.js +38 -0
- package/contextual-menu/types.d.ts +50 -11
- package/date-input/Calendar.js +47 -31
- package/date-input/DateInput.accessibility.test.d.ts +1 -0
- package/date-input/DateInput.accessibility.test.js +24 -11
- package/date-input/DateInput.js +28 -23
- package/date-input/DateInput.stories.tsx +18 -12
- package/date-input/DateInput.test.d.ts +1 -0
- package/date-input/DateInput.test.js +39 -39
- package/date-input/DatePicker.js +13 -7
- package/date-input/YearPicker.js +10 -5
- package/dialog/Dialog.accessibility.test.d.ts +1 -0
- package/dialog/Dialog.accessibility.test.js +5 -5
- package/dialog/Dialog.js +9 -20
- package/dialog/Dialog.stories.tsx +8 -4
- package/dialog/Dialog.test.d.ts +1 -0
- package/dialog/Dialog.test.js +111 -48
- package/divider/Divider.accessibility.test.d.ts +1 -0
- package/divider/Divider.accessibility.test.js +2 -2
- package/divider/Divider.stories.tsx +2 -1
- package/divider/Divider.test.d.ts +1 -0
- package/dropdown/Dropdown.accessibility.test.d.ts +1 -0
- package/dropdown/Dropdown.accessibility.test.js +12 -9
- package/dropdown/Dropdown.js +16 -15
- package/dropdown/Dropdown.stories.tsx +11 -11
- package/dropdown/Dropdown.test.d.ts +1 -0
- package/dropdown/Dropdown.test.js +101 -72
- package/dropdown/DropdownMenu.js +4 -4
- package/dropdown/DropdownMenuItem.js +2 -1
- package/file-input/FileInput.accessibility.test.d.ts +1 -0
- package/file-input/FileInput.accessibility.test.js +30 -23
- package/file-input/FileInput.js +6 -47
- package/file-input/FileInput.test.d.ts +1 -0
- package/file-input/FileInput.test.js +51 -106
- package/file-input/FileItem.js +18 -28
- package/file-input/types.d.ts +0 -4
- package/footer/Footer.accessibility.test.d.ts +1 -0
- package/footer/Footer.accessibility.test.js +13 -5
- package/footer/Footer.js +8 -6
- package/footer/Footer.stories.tsx +39 -1
- package/footer/Footer.test.d.ts +1 -0
- package/footer/Footer.test.js +1 -1
- package/footer/Icons.js +2 -30
- package/footer/types.d.ts +1 -1
- package/grid/Grid.stories.tsx +3 -1
- package/header/Header.accessibility.test.d.ts +1 -0
- package/header/Header.accessibility.test.js +16 -6
- package/header/Header.js +12 -22
- package/header/Header.stories.tsx +17 -1
- package/header/Header.test.d.ts +1 -0
- package/header/Header.test.js +1 -1
- package/header/Icons.js +1 -6
- package/heading/Heading.accessibility.test.d.ts +1 -0
- package/heading/Heading.accessibility.test.js +3 -3
- package/heading/Heading.js +1 -1
- package/heading/Heading.test.d.ts +1 -0
- package/heading/Heading.test.js +1 -14
- package/icon/Icon.accessibility.test.d.ts +1 -0
- package/icon/Icon.accessibility.test.js +2 -2
- package/icon/Icon.js +1 -1
- package/icon/Icon.stories.tsx +1 -1
- package/image/Image.accessibility.test.d.ts +1 -0
- package/image/Image.accessibility.test.js +3 -3
- package/image/Image.js +1 -1
- package/layout/ApplicationLayout.js +9 -6
- package/layout/Icons.d.ts +0 -1
- package/layout/Icons.js +1 -9
- package/link/Link.accessibility.test.d.ts +1 -0
- package/link/Link.accessibility.test.js +8 -12
- package/link/Link.js +8 -6
- package/link/Link.stories.tsx +4 -4
- package/link/Link.test.d.ts +1 -0
- package/link/Link.test.js +1 -1
- package/link/types.d.ts +1 -1
- package/main.d.ts +2 -1
- package/main.js +8 -1
- package/nav-tabs/NavTabs.accessibility.test.d.ts +1 -0
- package/nav-tabs/NavTabs.accessibility.test.js +8 -16
- package/nav-tabs/NavTabs.js +19 -4
- package/nav-tabs/NavTabs.stories.tsx +41 -23
- package/nav-tabs/NavTabs.test.d.ts +1 -0
- package/nav-tabs/NavTabs.test.js +10 -9
- package/nav-tabs/Tab.js +17 -18
- package/nav-tabs/types.d.ts +1 -1
- package/number-input/NumberInput.accessibility.test.d.ts +1 -0
- package/number-input/NumberInput.accessibility.test.js +9 -10
- package/number-input/NumberInput.js +6 -3
- package/number-input/NumberInput.stories.tsx +11 -16
- package/number-input/NumberInput.test.d.ts +1 -0
- package/number-input/NumberInput.test.js +6 -7
- package/package.json +25 -20
- package/paginator/Paginator.accessibility.test.d.ts +1 -0
- package/paginator/Paginator.accessibility.test.js +4 -5
- package/paginator/Paginator.js +13 -10
- package/paginator/Paginator.test.d.ts +1 -0
- package/paginator/Paginator.test.js +2 -3
- package/paragraph/Paragraph.accessibility.test.d.ts +1 -0
- package/paragraph/Paragraph.accessibility.test.js +2 -2
- package/password-input/PasswordInput.accessibility.test.d.ts +1 -0
- package/password-input/PasswordInput.accessibility.test.js +7 -8
- package/password-input/PasswordInput.js +11 -8
- package/password-input/PasswordInput.stories.tsx +10 -1
- package/password-input/PasswordInput.test.d.ts +1 -0
- package/password-input/PasswordInput.test.js +6 -7
- package/progress-bar/ProgressBar.accessibility.test.d.ts +1 -0
- package/progress-bar/ProgressBar.accessibility.test.js +3 -3
- package/progress-bar/ProgressBar.js +6 -4
- package/progress-bar/ProgressBar.test.d.ts +1 -0
- package/progress-bar/ProgressBar.test.js +1 -1
- package/quick-nav/QuickNav.accessibility.test.d.ts +1 -0
- package/quick-nav/QuickNav.accessibility.test.js +2 -2
- package/quick-nav/QuickNav.js +1 -1
- package/radio-group/Radio.js +6 -9
- package/radio-group/RadioGroup.accessibility.test.d.ts +1 -0
- package/radio-group/RadioGroup.accessibility.test.js +4 -4
- package/radio-group/RadioGroup.js +14 -16
- package/radio-group/RadioGroup.test.d.ts +1 -0
- package/radio-group/RadioGroup.test.js +3 -5
- package/resultset-table/ResultsetTable.accessibility.test.d.ts +1 -0
- package/resultset-table/ResultsetTable.accessibility.test.js +16 -6
- package/resultset-table/ResultsetTable.js +36 -11
- package/resultset-table/ResultsetTable.stories.tsx +14 -2
- package/resultset-table/ResultsetTable.test.d.ts +1 -0
- package/resultset-table/ResultsetTable.test.js +103 -34
- package/select/Listbox.js +24 -16
- package/select/Option.js +12 -10
- package/select/Select.accessibility.test.d.ts +1 -0
- package/select/Select.accessibility.test.js +18 -8
- package/select/Select.js +41 -29
- package/select/Select.stories.tsx +69 -111
- package/select/Select.test.d.ts +1 -0
- package/select/Select.test.js +371 -474
- package/select/types.d.ts +1 -1
- package/sidenav/Sidenav.accessibility.test.d.ts +1 -0
- package/sidenav/Sidenav.accessibility.test.js +3 -3
- package/sidenav/Sidenav.js +16 -12
- package/sidenav/Sidenav.stories.tsx +5 -9
- package/sidenav/Sidenav.test.d.ts +1 -0
- package/sidenav/Sidenav.test.js +1 -1
- package/sidenav/types.d.ts +2 -2
- package/slider/Slider.accessibility.test.d.ts +1 -0
- package/slider/Slider.accessibility.test.js +5 -6
- package/slider/Slider.js +11 -13
- package/slider/Slider.stories.tsx +180 -0
- package/slider/Slider.test.d.ts +1 -0
- package/slider/Slider.test.js +13 -11
- package/spinner/Spinner.accessibility.test.d.ts +1 -0
- package/spinner/Spinner.accessibility.test.js +6 -6
- package/spinner/Spinner.js +6 -2
- package/spinner/Spinner.test.d.ts +1 -0
- package/spinner/Spinner.test.js +1 -1
- package/status-light/StatusLight.accessibility.test.d.ts +1 -0
- package/status-light/StatusLight.accessibility.test.js +8 -8
- package/status-light/StatusLight.test.d.ts +1 -0
- package/status-light/StatusLight.test.js +1 -1
- package/switch/Switch.accessibility.test.d.ts +1 -0
- package/switch/Switch.accessibility.test.js +14 -5
- package/switch/Switch.js +6 -9
- package/switch/Switch.stories.tsx +12 -0
- package/switch/Switch.test.d.ts +1 -0
- package/switch/Switch.test.js +1 -1
- package/table/Table.accessibility.test.d.ts +1 -0
- package/table/Table.accessibility.test.js +16 -6
- package/table/Table.js +1 -1
- package/table/Table.stories.tsx +13 -1
- package/table/Table.test.d.ts +1 -0
- package/table/Table.test.js +2 -4
- package/tabs/Tab.js +6 -5
- package/tabs/Tabs.accessibility.test.d.ts +1 -0
- package/tabs/Tabs.accessibility.test.js +3 -3
- package/tabs/Tabs.js +9 -20
- package/tabs/Tabs.stories.tsx +7 -3
- package/tabs/Tabs.test.d.ts +1 -0
- package/tabs/Tabs.test.js +20 -38
- package/tabs/types.d.ts +2 -2
- package/tag/Tag.accessibility.test.d.ts +1 -0
- package/tag/Tag.accessibility.test.js +4 -4
- package/tag/Tag.js +7 -7
- package/tag/Tag.stories.tsx +5 -8
- package/tag/Tag.test.d.ts +1 -0
- package/tag/Tag.test.js +5 -13
- package/tag/types.d.ts +2 -2
- package/text-input/Suggestion.js +1 -1
- package/text-input/Suggestions.js +14 -6
- package/text-input/TextInput.accessibility.test.d.ts +1 -0
- package/text-input/TextInput.accessibility.test.js +11 -12
- package/text-input/TextInput.js +29 -25
- package/text-input/TextInput.stories.tsx +19 -7
- package/text-input/TextInput.test.d.ts +1 -0
- package/text-input/TextInput.test.js +2 -3
- package/textarea/Textarea.accessibility.test.d.ts +1 -0
- package/textarea/Textarea.accessibility.test.js +7 -7
- package/textarea/Textarea.js +14 -13
- package/textarea/Textarea.test.d.ts +1 -0
- package/textarea/Textarea.test.js +1 -1
- package/toggle-group/ToggleGroup.accessibility.test.d.ts +1 -0
- package/toggle-group/ToggleGroup.accessibility.test.js +5 -5
- package/toggle-group/ToggleGroup.js +10 -12
- package/toggle-group/ToggleGroup.stories.tsx +4 -4
- package/toggle-group/ToggleGroup.test.d.ts +1 -0
- package/toggle-group/ToggleGroup.test.js +1 -1
- package/toggle-group/types.d.ts +2 -2
- package/tooltip/Tooltip.accessibility.test.d.ts +1 -0
- package/tooltip/Tooltip.accessibility.test.js +144 -0
- package/tooltip/Tooltip.d.ts +4 -0
- package/tooltip/Tooltip.js +50 -0
- package/tooltip/Tooltip.stories.tsx +111 -0
- package/tooltip/Tooltip.test.d.ts +1 -0
- package/tooltip/Tooltip.test.js +112 -0
- package/tooltip/types.d.ts +16 -0
- package/tooltip/types.js +5 -0
- package/typography/Typography.accessibility.test.d.ts +1 -0
- package/typography/Typography.accessibility.test.js +12 -12
- package/typography/Typography.stories.tsx +1 -3
- package/useTheme.d.ts +2 -5
- package/utils/BaseTypography.js +1 -1
- package/utils/FocusLock.js +3 -2
- package/wizard/Wizard.accessibility.test.d.ts +1 -0
- package/wizard/Wizard.accessibility.test.js +3 -3
- package/wizard/Wizard.js +14 -25
- package/wizard/Wizard.stories.tsx +20 -1
- package/wizard/Wizard.test.d.ts +1 -0
- package/wizard/Wizard.test.js +1 -1
- package/wizard/types.d.ts +1 -1
- package/contextual-menu/MenuItemAction.d.ts +0 -4
- package/contextual-menu/MenuItemAction.js +0 -46
- package/date-input/Icons.d.ts +0 -6
- package/date-input/Icons.js +0 -58
- package/paginator/Icons.d.ts +0 -5
- package/paginator/Icons.js +0 -40
- package/password-input/Icons.d.ts +0 -6
- package/password-input/Icons.js +0 -35
- package/select/Icons.d.ts +0 -10
- package/select/Icons.js +0 -89
- package/sidenav/Icons.d.ts +0 -7
- package/sidenav/Icons.js +0 -47
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import DxcTooltip from "./Tooltip";
|
|
3
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
4
|
+
import DxcButton from "../button/Button";
|
|
5
|
+
import { userEvent, within } from "@storybook/test";
|
|
6
|
+
import DxcInset from "../inset/Inset";
|
|
7
|
+
import Title from "../../.storybook/components/Title";
|
|
8
|
+
import DxcFlex from "../flex/Flex";
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
title: "Tooltip",
|
|
12
|
+
component: DxcTooltip,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const Tooltip = () => (
|
|
16
|
+
<>
|
|
17
|
+
<Title title="Default tooltip" theme="light" level={4} />
|
|
18
|
+
<ExampleContainer>
|
|
19
|
+
<DxcInset bottom="3rem">
|
|
20
|
+
<DxcTooltip label="Tooltip Test">
|
|
21
|
+
<DxcButton label="Hoverable button" />
|
|
22
|
+
</DxcTooltip>
|
|
23
|
+
</DxcInset>
|
|
24
|
+
</ExampleContainer>
|
|
25
|
+
</>
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const LargeTextWithinTooltip = () => (
|
|
29
|
+
<>
|
|
30
|
+
<Title title="Multiple line tooltip" theme="light" level={4} />
|
|
31
|
+
<ExampleContainer>
|
|
32
|
+
<DxcInset bottom="5rem" left="1rem">
|
|
33
|
+
<DxcTooltip label="Tooltip Test with a large text to display in the container while hovering the component">
|
|
34
|
+
<DxcButton label="Hoverable button" />
|
|
35
|
+
</DxcTooltip>
|
|
36
|
+
</DxcInset>
|
|
37
|
+
</ExampleContainer>
|
|
38
|
+
</>
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const TopTooltip = () => (
|
|
42
|
+
<>
|
|
43
|
+
<Title title="Top tooltip" theme="light" level={4} />
|
|
44
|
+
<ExampleContainer>
|
|
45
|
+
<DxcInset top="3rem">
|
|
46
|
+
<DxcTooltip label="Tooltip Test" position="top">
|
|
47
|
+
<DxcButton label="Hoverable button" />
|
|
48
|
+
</DxcTooltip>
|
|
49
|
+
</DxcInset>
|
|
50
|
+
</ExampleContainer>
|
|
51
|
+
</>
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
const LeftTooltip = () => (
|
|
55
|
+
<>
|
|
56
|
+
<Title title="Left tooltip" theme="light" level={4} />
|
|
57
|
+
<ExampleContainer>
|
|
58
|
+
<DxcFlex justifyContent="center">
|
|
59
|
+
<DxcTooltip label="Tooltip Test" position="left">
|
|
60
|
+
<DxcButton label="Hoverable button" />
|
|
61
|
+
</DxcTooltip>
|
|
62
|
+
</DxcFlex>
|
|
63
|
+
</ExampleContainer>
|
|
64
|
+
</>
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const RightTooltip = () => (
|
|
68
|
+
<>
|
|
69
|
+
<Title title="Right tooltip" theme="light" level={4} />
|
|
70
|
+
<ExampleContainer>
|
|
71
|
+
<DxcTooltip label="Tooltip Test" position="right">
|
|
72
|
+
<DxcButton label="Hoverable button" />
|
|
73
|
+
</DxcTooltip>
|
|
74
|
+
</ExampleContainer>
|
|
75
|
+
</>
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
export const Chromatic = Tooltip.bind({});
|
|
79
|
+
Chromatic.play = async ({ canvasElement }) => {
|
|
80
|
+
const canvas = within(canvasElement);
|
|
81
|
+
const buttonList = canvas.getByRole("button");
|
|
82
|
+
await userEvent.hover(buttonList);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export const LargeTextTooltip = LargeTextWithinTooltip.bind({});
|
|
86
|
+
LargeTextTooltip.play = async ({ canvasElement }) => {
|
|
87
|
+
const canvas = within(canvasElement);
|
|
88
|
+
const buttonList = canvas.getByRole("button");
|
|
89
|
+
await userEvent.hover(buttonList);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export const TooltipPositionTop = TopTooltip.bind({});
|
|
93
|
+
TooltipPositionTop.play = async ({ canvasElement }) => {
|
|
94
|
+
const canvas = within(canvasElement);
|
|
95
|
+
const buttonList = canvas.getByRole("button");
|
|
96
|
+
await userEvent.hover(buttonList);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export const TooltipPositionLeft = LeftTooltip.bind({});
|
|
100
|
+
TooltipPositionLeft.play = async ({ canvasElement }) => {
|
|
101
|
+
const canvas = within(canvasElement);
|
|
102
|
+
const buttonList = canvas.getByRole("button");
|
|
103
|
+
await userEvent.hover(buttonList);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export const TooltipPositionRight = RightTooltip.bind({});
|
|
107
|
+
TooltipPositionRight.play = async ({ canvasElement }) => {
|
|
108
|
+
const canvas = within(canvasElement);
|
|
109
|
+
const buttonList = canvas.getByRole("button");
|
|
110
|
+
await userEvent.hover(buttonList);
|
|
111
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "@testing-library/jest-dom";
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
5
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
6
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
7
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _react2 = require("@testing-library/react");
|
|
10
|
+
var _Tooltip = _interopRequireDefault(require("./Tooltip"));
|
|
11
|
+
var _Button = _interopRequireDefault(require("../button/Button"));
|
|
12
|
+
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
13
|
+
require("@testing-library/jest-dom");
|
|
14
|
+
global.globalThis = global;
|
|
15
|
+
global.DOMRect = {
|
|
16
|
+
fromRect: function fromRect() {
|
|
17
|
+
return {
|
|
18
|
+
top: 0,
|
|
19
|
+
left: 0,
|
|
20
|
+
bottom: 0,
|
|
21
|
+
right: 0,
|
|
22
|
+
width: 0,
|
|
23
|
+
height: 0,
|
|
24
|
+
x: 0,
|
|
25
|
+
y: 0
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
global.ResizeObserver = /*#__PURE__*/function () {
|
|
30
|
+
function ResizeObserver() {
|
|
31
|
+
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
32
|
+
}
|
|
33
|
+
return (0, _createClass2["default"])(ResizeObserver, [{
|
|
34
|
+
key: "observe",
|
|
35
|
+
value: function observe() {}
|
|
36
|
+
}, {
|
|
37
|
+
key: "unobserve",
|
|
38
|
+
value: function unobserve() {}
|
|
39
|
+
}, {
|
|
40
|
+
key: "disconnect",
|
|
41
|
+
value: function disconnect() {}
|
|
42
|
+
}]);
|
|
43
|
+
}();
|
|
44
|
+
describe("Tooltip component tests", function () {
|
|
45
|
+
test("Tooltip does not render by default", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
46
|
+
var _render, queryByRole;
|
|
47
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
48
|
+
while (1) switch (_context.prev = _context.next) {
|
|
49
|
+
case 0:
|
|
50
|
+
_render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
51
|
+
label: "Tooltip Test"
|
|
52
|
+
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
53
|
+
label: "Hoverable button"
|
|
54
|
+
}))), queryByRole = _render.queryByRole;
|
|
55
|
+
_context.next = 3;
|
|
56
|
+
return (0, _react2.waitFor)(function () {
|
|
57
|
+
var tooltipElement = queryByRole("tooltip");
|
|
58
|
+
expect(tooltipElement).toBeFalsy();
|
|
59
|
+
});
|
|
60
|
+
case 3:
|
|
61
|
+
case "end":
|
|
62
|
+
return _context.stop();
|
|
63
|
+
}
|
|
64
|
+
}, _callee);
|
|
65
|
+
})));
|
|
66
|
+
test("Tooltip renders with correct label on hover", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
67
|
+
var _render2, getByText, triggerElement;
|
|
68
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
69
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
70
|
+
case 0:
|
|
71
|
+
_render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
72
|
+
label: "Tooltip Test"
|
|
73
|
+
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
74
|
+
label: "Hoverable button"
|
|
75
|
+
}))), getByText = _render2.getByText;
|
|
76
|
+
triggerElement = getByText("Hoverable button");
|
|
77
|
+
_userEvent["default"].hover(triggerElement);
|
|
78
|
+
_context2.next = 5;
|
|
79
|
+
return _react2.screen.findByRole("tooltip", {
|
|
80
|
+
name: "Tooltip Test"
|
|
81
|
+
});
|
|
82
|
+
case 5:
|
|
83
|
+
case "end":
|
|
84
|
+
return _context2.stop();
|
|
85
|
+
}
|
|
86
|
+
}, _callee2);
|
|
87
|
+
})));
|
|
88
|
+
test("Tooltip stops being rendered when hover is stopped", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
89
|
+
var _render3, getByText, queryByRole, triggerElement;
|
|
90
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
91
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
92
|
+
case 0:
|
|
93
|
+
_render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
94
|
+
label: "Tooltip Test"
|
|
95
|
+
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
96
|
+
label: "Hoverable button"
|
|
97
|
+
}))), getByText = _render3.getByText, queryByRole = _render3.queryByRole;
|
|
98
|
+
triggerElement = getByText("Hoverable button");
|
|
99
|
+
_userEvent["default"].hover(triggerElement);
|
|
100
|
+
_userEvent["default"].unhover(triggerElement);
|
|
101
|
+
_context3.next = 6;
|
|
102
|
+
return (0, _react2.waitFor)(function () {
|
|
103
|
+
var tooltipElement = queryByRole("tooltip");
|
|
104
|
+
expect(tooltipElement).toBeFalsy();
|
|
105
|
+
});
|
|
106
|
+
case 6:
|
|
107
|
+
case "end":
|
|
108
|
+
return _context3.stop();
|
|
109
|
+
}
|
|
110
|
+
}, _callee3);
|
|
111
|
+
})));
|
|
112
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type Props = {
|
|
3
|
+
/**
|
|
4
|
+
* Preferred position for displaying the tooltip. It may adjust automatically based on available space.
|
|
5
|
+
*/
|
|
6
|
+
position?: "bottom" | "top" | "left" | "right";
|
|
7
|
+
/**
|
|
8
|
+
* Text to be displayed inside the tooltip.
|
|
9
|
+
*/
|
|
10
|
+
label: string;
|
|
11
|
+
/**
|
|
12
|
+
* Content in which the Tooltip will be displayed.
|
|
13
|
+
*/
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
};
|
|
16
|
+
export default Props;
|
package/tooltip/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -5,7 +5,7 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
5
5
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
6
6
|
var _react = _interopRequireDefault(require("react"));
|
|
7
7
|
var _react2 = require("@testing-library/react");
|
|
8
|
-
var
|
|
8
|
+
var _axeHelper = require("../../test/accessibility/axe-helper.js");
|
|
9
9
|
var _Typography = _interopRequireDefault(require("./Typography"));
|
|
10
10
|
var _Flex = _interopRequireDefault(require("../flex/Flex"));
|
|
11
11
|
describe("Typography component accessibility tests", function () {
|
|
@@ -40,7 +40,7 @@ describe("Typography component accessibility tests", function () {
|
|
|
40
40
|
fontSize: "0.75rem"
|
|
41
41
|
}, "0.75rem."))), container = _render.container;
|
|
42
42
|
_context.next = 3;
|
|
43
|
-
return (0,
|
|
43
|
+
return (0, _axeHelper.axe)(container);
|
|
44
44
|
case 3:
|
|
45
45
|
results = _context.sent;
|
|
46
46
|
expect(results).toHaveNoViolations();
|
|
@@ -75,7 +75,7 @@ describe("Typography component accessibility tests", function () {
|
|
|
75
75
|
letterSpacing: "0.1em"
|
|
76
76
|
}, "0.1em."))), container = _render2.container;
|
|
77
77
|
_context2.next = 3;
|
|
78
|
-
return (0,
|
|
78
|
+
return (0, _axeHelper.axe)(container);
|
|
79
79
|
case 3:
|
|
80
80
|
results = _context2.sent;
|
|
81
81
|
expect(results).toHaveNoViolations();
|
|
@@ -110,7 +110,7 @@ describe("Typography component accessibility tests", function () {
|
|
|
110
110
|
lineHeight: "2em"
|
|
111
111
|
}, "2em."))), container = _render3.container;
|
|
112
112
|
_context3.next = 3;
|
|
113
|
-
return (0,
|
|
113
|
+
return (0, _axeHelper.axe)(container);
|
|
114
114
|
case 3:
|
|
115
115
|
results = _context3.sent;
|
|
116
116
|
expect(results).toHaveNoViolations();
|
|
@@ -139,7 +139,7 @@ describe("Typography component accessibility tests", function () {
|
|
|
139
139
|
fontWeight: "700"
|
|
140
140
|
}, "700."))), container = _render4.container;
|
|
141
141
|
_context4.next = 3;
|
|
142
|
-
return (0,
|
|
142
|
+
return (0, _axeHelper.axe)(container);
|
|
143
143
|
case 3:
|
|
144
144
|
results = _context4.sent;
|
|
145
145
|
expect(results).toHaveNoViolations();
|
|
@@ -162,7 +162,7 @@ describe("Typography component accessibility tests", function () {
|
|
|
162
162
|
textDecoration: "line-through"
|
|
163
163
|
}, "Line-through."))), container = _render5.container;
|
|
164
164
|
_context5.next = 3;
|
|
165
|
-
return (0,
|
|
165
|
+
return (0, _axeHelper.axe)(container);
|
|
166
166
|
case 3:
|
|
167
167
|
results = _context5.sent;
|
|
168
168
|
expect(results).toHaveNoViolations();
|
|
@@ -185,7 +185,7 @@ describe("Typography component accessibility tests", function () {
|
|
|
185
185
|
fontFamily: "Source Code Pro, monospace"
|
|
186
186
|
}, "Source Code Pro, monospace."))), container = _render6.container;
|
|
187
187
|
_context6.next = 3;
|
|
188
|
-
return (0,
|
|
188
|
+
return (0, _axeHelper.axe)(container);
|
|
189
189
|
case 3:
|
|
190
190
|
results = _context6.sent;
|
|
191
191
|
expect(results).toHaveNoViolations();
|
|
@@ -208,7 +208,7 @@ describe("Typography component accessibility tests", function () {
|
|
|
208
208
|
fontStyle: "normal"
|
|
209
209
|
}, "Normal."))), container = _render7.container;
|
|
210
210
|
_context7.next = 3;
|
|
211
|
-
return (0,
|
|
211
|
+
return (0, _axeHelper.axe)(container);
|
|
212
212
|
case 3:
|
|
213
213
|
results = _context7.sent;
|
|
214
214
|
expect(results).toHaveNoViolations();
|
|
@@ -234,7 +234,7 @@ describe("Typography component accessibility tests", function () {
|
|
|
234
234
|
textAlign: "right"
|
|
235
235
|
}, "Right."))), container = _render8.container;
|
|
236
236
|
_context8.next = 3;
|
|
237
|
-
return (0,
|
|
237
|
+
return (0, _axeHelper.axe)(container);
|
|
238
238
|
case 3:
|
|
239
239
|
results = _context8.sent;
|
|
240
240
|
expect(results).toHaveNoViolations();
|
|
@@ -265,7 +265,7 @@ describe("Typography component accessibility tests", function () {
|
|
|
265
265
|
fontSize: "2rem"
|
|
266
266
|
}, " ", " pre-wrap: A bunch of words you see."))), container = _render9.container;
|
|
267
267
|
_context9.next = 3;
|
|
268
|
-
return (0,
|
|
268
|
+
return (0, _axeHelper.axe)(container);
|
|
269
269
|
case 3:
|
|
270
270
|
results = _context9.sent;
|
|
271
271
|
expect(results).toHaveNoViolations();
|
|
@@ -288,7 +288,7 @@ describe("Typography component accessibility tests", function () {
|
|
|
288
288
|
textAlign: "left"
|
|
289
289
|
}, "Display Inline.", /*#__PURE__*/_react["default"].createElement(_Typography["default"], null, "A different text.")))), container = _render10.container;
|
|
290
290
|
_context10.next = 3;
|
|
291
|
-
return (0,
|
|
291
|
+
return (0, _axeHelper.axe)(container);
|
|
292
292
|
case 3:
|
|
293
293
|
results = _context10.sent;
|
|
294
294
|
expect(results).toHaveNoViolations();
|
|
@@ -326,7 +326,7 @@ describe("Typography component accessibility tests", function () {
|
|
|
326
326
|
textOverflow: "unset"
|
|
327
327
|
}, "Overflow unset.")))), container = _render11.container;
|
|
328
328
|
_context11.next = 3;
|
|
329
|
-
return (0,
|
|
329
|
+
return (0, _axeHelper.axe)(container);
|
|
330
330
|
case 3:
|
|
331
331
|
results = _context11.sent;
|
|
332
332
|
expect(results).toHaveNoViolations();
|
|
@@ -140,9 +140,7 @@ export const Chromatic = () => (
|
|
|
140
140
|
<ExampleContainer>
|
|
141
141
|
<Title title="Typography whitespace" theme="light" level={4} />
|
|
142
142
|
<div style={{ margin: "50px", border: "1px solid red", width: "125px" }}>
|
|
143
|
-
<DxcTypography fontSize="2rem">
|
|
144
|
-
{" "} Normal: A bunch of words you see.
|
|
145
|
-
</DxcTypography>
|
|
143
|
+
<DxcTypography fontSize="2rem">{" "} Normal: A bunch of words you see.</DxcTypography>
|
|
146
144
|
</div>
|
|
147
145
|
<div style={{ margin: "50px", border: "1px solid red", width: "125px" }}>
|
|
148
146
|
<DxcTypography whiteSpace="nowrap" fontSize="2rem">
|
package/useTheme.d.ts
CHANGED
|
@@ -251,8 +251,7 @@ declare const useTheme: () => {
|
|
|
251
251
|
dialog?: Partial<{
|
|
252
252
|
overlayColor: string;
|
|
253
253
|
backgroundColor: string;
|
|
254
|
-
|
|
255
|
-
closeIconHeight: string;
|
|
254
|
+
closeIconSize: string;
|
|
256
255
|
closeIconTopPosition: string;
|
|
257
256
|
closeIconRightPosition: string;
|
|
258
257
|
closeIconBackgroundColor: string;
|
|
@@ -290,7 +289,6 @@ declare const useTheme: () => {
|
|
|
290
289
|
disabledColor: string;
|
|
291
290
|
disabledButtonBackgroundColor: string;
|
|
292
291
|
disabledButtonBorderColor: string;
|
|
293
|
-
disabledBorderColor: string;
|
|
294
292
|
optionBackgroundColor: string;
|
|
295
293
|
hoverOptionBackgroundColor: string;
|
|
296
294
|
activeOptionBackgroundColor: string;
|
|
@@ -330,7 +328,6 @@ declare const useTheme: () => {
|
|
|
330
328
|
focusDropBorderColor: string;
|
|
331
329
|
disabledDropBorderColor: string;
|
|
332
330
|
dragoverDropBackgroundColor: string;
|
|
333
|
-
activeFileItemIconBackgrounColor: string;
|
|
334
331
|
errorFileItemBorderColor: string;
|
|
335
332
|
errorFileItemBackgroundColor: string;
|
|
336
333
|
errorFilePreviewBackgroundColor: string;
|
|
@@ -531,8 +528,8 @@ declare const useTheme: () => {
|
|
|
531
528
|
totalItemsContainerMarginLeft: string;
|
|
532
529
|
}>;
|
|
533
530
|
paragraph?: Partial<{
|
|
534
|
-
fontColor: string;
|
|
535
531
|
display: string;
|
|
532
|
+
fontColor: string;
|
|
536
533
|
fontSize: string;
|
|
537
534
|
fontWeight: string;
|
|
538
535
|
}>;
|
package/utils/BaseTypography.js
CHANGED
|
@@ -11,7 +11,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
12
12
|
var _templateObject;
|
|
13
13
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
14
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
14
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
15
15
|
var TypographyContext = /*#__PURE__*/_react["default"].createContext(null);
|
|
16
16
|
var BaseTypography = function BaseTypography(_ref) {
|
|
17
17
|
var as = _ref.as,
|
package/utils/FocusLock.js
CHANGED
|
@@ -9,7 +9,7 @@ exports["default"] = void 0;
|
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
12
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
13
13
|
var not = {
|
|
14
14
|
negTabIndex: ':not([tabindex^="-"])',
|
|
15
15
|
disabled: ":not(:disabled)"
|
|
@@ -95,7 +95,8 @@ var FocusLock = function FocusLock(_ref) {
|
|
|
95
95
|
});
|
|
96
96
|
}, [focusableElements]);
|
|
97
97
|
var focusLast = function focusLast() {
|
|
98
|
-
|
|
98
|
+
var _focusableElements$re;
|
|
99
|
+
focusableElements === null || focusableElements === void 0 ? void 0 : (_focusableElements$re = focusableElements.reverse()) === null || _focusableElements$re === void 0 ? void 0 : _focusableElements$re.some(function (element) {
|
|
99
100
|
return attemptFocus(element);
|
|
100
101
|
});
|
|
101
102
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -5,8 +5,8 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
5
5
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
6
6
|
var _react = _interopRequireDefault(require("react"));
|
|
7
7
|
var _react2 = require("@testing-library/react");
|
|
8
|
-
var
|
|
9
|
-
var _Wizard = _interopRequireDefault(require("./Wizard
|
|
8
|
+
var _axeHelper = require("../../test/accessibility/axe-helper.js");
|
|
9
|
+
var _Wizard = _interopRequireDefault(require("./Wizard"));
|
|
10
10
|
var favoriteSVG = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
11
11
|
viewBox: "0 0 24 24",
|
|
12
12
|
fill: "currentColor"
|
|
@@ -42,7 +42,7 @@ describe("Wizard component accessibility tests", function () {
|
|
|
42
42
|
margin: "medium"
|
|
43
43
|
})), container = _render.container;
|
|
44
44
|
_context.next = 3;
|
|
45
|
-
return (0,
|
|
45
|
+
return (0, _axeHelper.axe)(container);
|
|
46
46
|
case 3:
|
|
47
47
|
results = _context.sent;
|
|
48
48
|
expect(results).toHaveNoViolations();
|
package/wizard/Wizard.js
CHANGED
|
@@ -13,54 +13,47 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
13
13
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
14
14
|
var _variables = require("../common/variables");
|
|
15
15
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
16
|
-
var
|
|
16
|
+
var _Icon = _interopRequireDefault(require("../icon/Icon"));
|
|
17
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
|
|
17
18
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
18
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
19
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
19
20
|
var icons = {
|
|
20
21
|
validIcon: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
21
|
-
id: "check_circle_black_18dp",
|
|
22
22
|
xmlns: "http://www.w3.org/2000/svg",
|
|
23
23
|
width: "18",
|
|
24
24
|
height: "18",
|
|
25
25
|
viewBox: "0 0 18 18"
|
|
26
26
|
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
27
|
-
id: "Path_2946",
|
|
28
27
|
"data-name": "Path 2946",
|
|
29
28
|
d: "M0,0H18V18H0Z",
|
|
30
29
|
fill: "none"
|
|
31
30
|
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
32
|
-
id: "Path_2947",
|
|
33
31
|
"data-name": "Path 2947",
|
|
34
32
|
d: "M9.986,4a5.986,5.986,0,1,0,5.986,5.986A5.994,5.994,0,0,0,9.986,4Zm-1.5,9.727L5.5,10.734,6.551,9.679l1.938,1.93L13.42,6.679l1.055,1.063Z",
|
|
35
33
|
transform: "translate(-0.986 -0.986)",
|
|
36
34
|
fill: "#eafaef",
|
|
37
35
|
opacity: "0.999"
|
|
38
36
|
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
39
|
-
id: "Path_2948",
|
|
40
37
|
"data-name": "Path 2948",
|
|
41
38
|
d: "M9.493,2a7.493,7.493,0,1,0,7.493,7.493A7.5,7.5,0,0,0,9.493,2Zm0,13.487a5.994,5.994,0,1,1,5.994-5.994A6,6,0,0,1,9.493,15.487Zm3.439-9.306L7.994,11.119,6.054,9.186,5,10.242l3,3,5.994-5.994Z",
|
|
42
39
|
transform: "translate(-0.493 -0.493)",
|
|
43
40
|
fill: "#24a148"
|
|
44
41
|
})),
|
|
45
42
|
invalidIcon: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
46
|
-
id: "highlight_off_black_18dp",
|
|
47
43
|
xmlns: "http://www.w3.org/2000/svg",
|
|
48
44
|
width: "18",
|
|
49
45
|
height: "18",
|
|
50
46
|
viewBox: "0 0 18 18"
|
|
51
47
|
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
52
|
-
id: "Path_2943",
|
|
53
48
|
"data-name": "Path 2943",
|
|
54
49
|
d: "M0,0H18V18H0Z",
|
|
55
50
|
fill: "none"
|
|
56
51
|
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
57
|
-
id: "Path_2944",
|
|
58
52
|
"data-name": "Path 2944",
|
|
59
53
|
d: "M10,4a6,6,0,1,0,6,6A6.01,6.01,0,0,0,10,4Zm3,7.945L11.945,13,10,11.06,8.059,13,7,11.945,8.944,10,7,8.059,8.059,7,10,8.944,11.945,7,13,8.059,11.06,10Z",
|
|
60
54
|
transform: "translate(-1.002 -1.002)",
|
|
61
55
|
fill: "#ffe6e9"
|
|
62
56
|
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
63
|
-
id: "Path_2945",
|
|
64
57
|
"data-name": "Path 2945",
|
|
65
58
|
d: "M11.444,6.5,9.5,8.443,7.558,6.5,6.5,7.558,8.443,9.5,6.5,11.444,7.558,12.5,9.5,10.558,11.444,12.5,12.5,11.444,10.558,9.5,12.5,7.558ZM9.5,2A7.5,7.5,0,1,0,17,9.5,7.494,7.494,0,0,0,9.5,2Zm0,13.5a6,6,0,1,1,6-6A6.009,6.009,0,0,1,9.5,15.5Z",
|
|
66
59
|
transform: "translate(-0.501 -0.501)",
|
|
@@ -119,9 +112,9 @@ var DxcWizard = function DxcWizard(_ref) {
|
|
|
119
112
|
current: i === renderedCurrent,
|
|
120
113
|
visited: i < renderedCurrent,
|
|
121
114
|
disabled: step.disabled
|
|
122
|
-
}, step.icon ?
|
|
123
|
-
|
|
124
|
-
}) : step.icon
|
|
115
|
+
}, step.icon ? typeof step.icon === "string" ? /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
116
|
+
icon: step.icon
|
|
117
|
+
}) : step.icon : /*#__PURE__*/_react["default"].createElement(Number, null, i + 1)), step.valid !== undefined && (step.valid ? /*#__PURE__*/_react["default"].createElement(ValidityIconContainer, null, icons.validIcon) : /*#__PURE__*/_react["default"].createElement(ValidityIconContainer, null, icons.invalidIcon))), (step.label || step.description) && /*#__PURE__*/_react["default"].createElement(InfoContainer, null, step.label && /*#__PURE__*/_react["default"].createElement(Label, {
|
|
125
118
|
current: i === renderedCurrent,
|
|
126
119
|
disabled: step.disabled,
|
|
127
120
|
visited: i <= innerCurrent
|
|
@@ -172,7 +165,7 @@ var Step = _styledComponents["default"].button(_templateObject3 || (_templateObj
|
|
|
172
165
|
var StepHeader = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n position: relative;\n display: inline-flex;\n ", "\n"])), function (props) {
|
|
173
166
|
return props.validityIcon && "padding-bottom: 4px;";
|
|
174
167
|
});
|
|
175
|
-
var IconContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n height: ", ";\n\n ", "\n ", ";\n\n border-radius: ", ";\n\n display: flex;\n justify-content: center;\n align-items: center;\n"])), function (props) {
|
|
168
|
+
var IconContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n height: ", ";\n\n ", "\n ", ";\n\n border-radius: ", ";\n\n display: flex;\n justify-content: center;\n align-items: center;\n overflow: hidden;\n font-size: ", ";\n svg {\n width: ", ";\n height: ", ";\n }\n"])), function (props) {
|
|
176
169
|
return props.disabled ? props.theme.disabledStepWidth : props.current ? props.theme.selectedStepWidth : props.theme.stepWidth;
|
|
177
170
|
}, function (props) {
|
|
178
171
|
return props.disabled ? props.theme.disabledStepHeight : props.current ? props.theme.selectedStepHeight : props.theme.stepHeight;
|
|
@@ -182,18 +175,14 @@ var IconContainer = _styledComponents["default"].div(_templateObject5 || (_templ
|
|
|
182
175
|
return props.disabled ? "color: ".concat(props.theme.disabledStepFontColor, ";") : "color: ".concat(props.current ? props.theme.selectedStepFontColor : !props.visited ? props.theme.unvisitedStepFontColor : props.theme.visitedStepFontColor, ";");
|
|
183
176
|
}, function (props) {
|
|
184
177
|
return !props.current && !props.disabled ? props.theme.stepBorderRadius : props.current ? props.theme.selectedStepBorderRadius : props.disabled ? props.theme.disabledStepBorderRadius : "";
|
|
185
|
-
});
|
|
186
|
-
var Icon = _styledComponents["default"].img(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n height: ", ";\n"])), function (props) {
|
|
187
|
-
return props.theme.stepIconSize;
|
|
188
178
|
}, function (props) {
|
|
189
179
|
return props.theme.stepIconSize;
|
|
190
|
-
})
|
|
191
|
-
var StepIconContainer = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n height: ", ";\n overflow: hidden;\n img,\n svg {\n height: 100%;\n width: 100%;\n }\n"])), function (props) {
|
|
180
|
+
}, function (props) {
|
|
192
181
|
return props.theme.stepIconSize;
|
|
193
182
|
}, function (props) {
|
|
194
183
|
return props.theme.stepIconSize;
|
|
195
184
|
});
|
|
196
|
-
var Number = _styledComponents["default"].p(
|
|
185
|
+
var Number = _styledComponents["default"].p(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n font-size: ", ";\n font-family: ", ";\n font-style: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n opacity: 1;\n margin: 0px 0px 0px 1px;\n"])), function (props) {
|
|
197
186
|
return props.theme.stepFontSize;
|
|
198
187
|
}, function (props) {
|
|
199
188
|
return props.theme.stepFontFamily;
|
|
@@ -204,9 +193,9 @@ var Number = _styledComponents["default"].p(_templateObject8 || (_templateObject
|
|
|
204
193
|
}, function (props) {
|
|
205
194
|
return props.theme.stepFontTracking;
|
|
206
195
|
});
|
|
207
|
-
var ValidityIconContainer = _styledComponents["default"].div(
|
|
208
|
-
var InfoContainer = _styledComponents["default"].div(
|
|
209
|
-
var Label = _styledComponents["default"].p(
|
|
196
|
+
var ValidityIconContainer = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n width: 18px;\n height: 18px;\n position: absolute;\n top: 22.5px;\n left: 22.5px;\n"])));
|
|
197
|
+
var InfoContainer = _styledComponents["default"].div(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n margin-left: 12px;\n"])));
|
|
198
|
+
var Label = _styledComponents["default"].p(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n text-align: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n ", ";\n text-transform: ", ";\n margin: 0;\n"])), function (props) {
|
|
210
199
|
return props.theme.labelTextAlign;
|
|
211
200
|
}, function (props) {
|
|
212
201
|
return props.theme.labelFontFamily;
|
|
@@ -223,7 +212,7 @@ var Label = _styledComponents["default"].p(_templateObject11 || (_templateObject
|
|
|
223
212
|
}, function (props) {
|
|
224
213
|
return props.theme.labelFontTextTransform;
|
|
225
214
|
});
|
|
226
|
-
var Description = _styledComponents["default"].p(
|
|
215
|
+
var Description = _styledComponents["default"].p(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n text-align: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n text-transform: ", ";\n ", ";\n margin: 0;\n"])), function (props) {
|
|
227
216
|
return props.theme.helperTextTextAlign;
|
|
228
217
|
}, function (props) {
|
|
229
218
|
return props.theme.helperTextFontFamily;
|
|
@@ -240,7 +229,7 @@ var Description = _styledComponents["default"].p(_templateObject12 || (_template
|
|
|
240
229
|
}, function (props) {
|
|
241
230
|
return props.disabled ? "color: ".concat(props.theme.disabledHelperTextFontColor, ";") : "color: ".concat(!props.visited ? props.theme.unvisitedHelperTextFontColor : props.current ? props.theme.selectedHelperTextFontColor : props.theme.visitedHelperTextFontColor, ";");
|
|
242
231
|
});
|
|
243
|
-
var StepSeparator = _styledComponents["default"].div(
|
|
232
|
+
var StepSeparator = _styledComponents["default"].div(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])(["\n ", ";\n ", "\n border: ", ";\n opacity: 1;\n flex-grow: 1;\n"])), function (props) {
|
|
244
233
|
return props.mode === "horizontal" ? "height: 0;" : "width: 0;";
|
|
245
234
|
}, function (props) {
|
|
246
235
|
return props.mode === "vertical" && "margin: 0 18px;";
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import DxcWizard from "./Wizard";
|
|
3
3
|
import Title from "../../.storybook/components/Title";
|
|
4
4
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
|
-
import { userEvent, within } from "@storybook/
|
|
5
|
+
import { userEvent, within } from "@storybook/test";
|
|
6
6
|
import { HalstackProvider } from "../HalstackContext";
|
|
7
7
|
|
|
8
8
|
export default {
|
|
@@ -133,6 +133,21 @@ const stepLargeIcons = [
|
|
|
133
133
|
},
|
|
134
134
|
];
|
|
135
135
|
|
|
136
|
+
const stepMaterialSymbols = [
|
|
137
|
+
{
|
|
138
|
+
label: "First step",
|
|
139
|
+
icon: "filled_home",
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
label: "Second step",
|
|
143
|
+
icon: "filled_favorite",
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
label: "Third step",
|
|
147
|
+
icon: "filled_star",
|
|
148
|
+
},
|
|
149
|
+
];
|
|
150
|
+
|
|
136
151
|
const opinionatedTheme = {
|
|
137
152
|
wizard: {
|
|
138
153
|
baseColor: "#5f249f",
|
|
@@ -171,6 +186,10 @@ export const Chromatic = () => (
|
|
|
171
186
|
<Title title="With large icons" theme="light" level={4} />
|
|
172
187
|
<DxcWizard steps={stepLargeIcons}></DxcWizard>
|
|
173
188
|
</ExampleContainer>
|
|
189
|
+
<ExampleContainer>
|
|
190
|
+
<Title title="With Material Symbols" theme="light" level={4} />
|
|
191
|
+
<DxcWizard steps={stepMaterialSymbols}></DxcWizard>
|
|
192
|
+
</ExampleContainer>
|
|
174
193
|
<Title title="Margins horizontal" theme="light" level={2} />
|
|
175
194
|
<ExampleContainer>
|
|
176
195
|
<Title title="Xxsmall margin" theme="light" level={4} />
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|