@dxc-technology/halstack-react 0.0.0-74ba970 → 0.0.0-752ca0a
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.d.ts +2 -2
- package/BackgroundColorContext.js +1 -1
- package/HalstackContext.d.ts +1349 -5
- package/HalstackContext.js +117 -77
- package/README.md +47 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +14 -37
- package/accordion/Accordion.stories.tsx +104 -113
- package/accordion/Accordion.test.js +1 -1
- package/accordion/types.d.ts +2 -13
- package/accordion-group/AccordionGroup.d.ts +4 -3
- package/accordion-group/AccordionGroup.js +23 -44
- package/accordion-group/AccordionGroup.stories.tsx +77 -76
- package/accordion-group/AccordionGroup.test.js +7 -17
- package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
- package/accordion-group/AccordionGroupAccordion.js +43 -0
- package/accordion-group/types.d.ts +2 -13
- package/alert/Alert.js +4 -8
- package/alert/Alert.stories.tsx +28 -0
- package/alert/Alert.test.js +1 -1
- package/bleed/Bleed.stories.tsx +1 -0
- package/box/Box.d.ts +1 -1
- package/box/Box.js +7 -26
- package/box/Box.stories.tsx +38 -51
- package/box/Box.test.js +1 -1
- package/box/types.d.ts +0 -11
- package/bulleted-list/BulletedList.js +4 -2
- package/bulleted-list/BulletedList.stories.tsx +7 -1
- package/bulleted-list/types.d.ts +31 -4
- package/button/Button.d.ts +1 -1
- package/button/Button.js +48 -60
- package/button/Button.stories.tsx +151 -9
- package/button/Button.test.js +12 -1
- package/button/types.d.ts +7 -3
- package/card/Card.d.ts +1 -1
- package/card/Card.js +27 -45
- package/card/Card.stories.tsx +12 -42
- package/card/Card.test.js +1 -1
- package/card/types.d.ts +1 -6
- package/checkbox/Checkbox.d.ts +2 -2
- package/checkbox/Checkbox.js +71 -51
- package/checkbox/Checkbox.stories.tsx +146 -58
- package/checkbox/Checkbox.test.js +84 -11
- package/checkbox/types.d.ts +10 -2
- package/chip/Chip.js +28 -49
- package/chip/Chip.stories.tsx +121 -26
- package/chip/Chip.test.js +3 -5
- package/common/OpenSans.css +68 -80
- package/common/coreTokens.d.ts +146 -0
- package/common/coreTokens.js +167 -0
- package/common/utils.d.ts +1 -0
- package/common/utils.js +4 -4
- package/common/variables.d.ts +1499 -0
- package/common/variables.js +1004 -1134
- package/date-input/Calendar.d.ts +4 -0
- package/date-input/Calendar.js +258 -0
- package/date-input/DateInput.js +138 -239
- package/date-input/DateInput.stories.tsx +209 -33
- package/date-input/DateInput.test.js +519 -149
- package/date-input/DatePicker.d.ts +4 -0
- package/date-input/DatePicker.js +146 -0
- package/date-input/Icons.d.ts +6 -0
- package/date-input/Icons.js +75 -0
- package/date-input/YearPicker.d.ts +4 -0
- package/date-input/YearPicker.js +126 -0
- package/date-input/types.d.ts +55 -0
- package/dialog/Dialog.d.ts +1 -1
- package/dialog/Dialog.js +54 -85
- package/dialog/Dialog.stories.tsx +154 -170
- package/dialog/Dialog.test.js +302 -3
- package/dialog/types.d.ts +0 -12
- package/dropdown/Dropdown.js +40 -39
- package/dropdown/Dropdown.stories.tsx +210 -84
- package/dropdown/Dropdown.test.js +21 -26
- package/dropdown/DropdownMenu.js +12 -18
- package/dropdown/DropdownMenuItem.js +4 -17
- package/dropdown/types.d.ts +3 -3
- package/file-input/FileInput.d.ts +2 -2
- package/file-input/FileInput.js +174 -220
- package/file-input/FileInput.stories.tsx +122 -11
- package/file-input/FileInput.test.js +14 -14
- package/file-input/FileItem.d.ts +4 -14
- package/file-input/FileItem.js +39 -63
- package/file-input/types.d.ts +18 -1
- package/flex/Flex.d.ts +1 -1
- package/flex/Flex.js +33 -19
- package/flex/Flex.stories.tsx +35 -26
- package/flex/types.d.ts +83 -7
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +44 -64
- package/footer/Footer.stories.tsx +36 -21
- package/footer/Footer.test.js +16 -26
- package/footer/types.d.ts +10 -11
- package/grid/Grid.d.ts +7 -0
- package/grid/Grid.js +91 -0
- package/grid/Grid.stories.tsx +219 -0
- package/grid/types.d.ts +115 -0
- package/header/Header.d.ts +4 -3
- package/header/Header.js +20 -49
- package/header/Header.stories.tsx +115 -36
- package/header/Header.test.js +2 -2
- package/header/types.d.ts +1 -14
- package/heading/Heading.js +1 -1
- package/heading/Heading.test.js +1 -1
- package/image/Image.d.ts +4 -0
- package/image/Image.js +85 -0
- package/image/Image.stories.tsx +127 -0
- package/image/types.d.ts +72 -0
- package/inset/Inset.stories.tsx +2 -1
- package/layout/ApplicationLayout.d.ts +5 -5
- package/layout/ApplicationLayout.js +15 -12
- package/layout/ApplicationLayout.stories.tsx +1 -1
- package/layout/Icons.d.ts +7 -4
- package/layout/Icons.js +52 -56
- package/layout/types.d.ts +2 -3
- package/link/Link.js +4 -4
- package/link/Link.stories.tsx +60 -0
- package/link/Link.test.js +2 -4
- package/link/types.d.ts +2 -2
- package/main.d.ts +4 -2
- package/main.js +17 -1
- package/{tabs-nav → nav-tabs}/NavTabs.d.ts +2 -2
- package/{tabs-nav → nav-tabs}/NavTabs.js +8 -11
- package/{tabs-nav → nav-tabs}/NavTabs.stories.tsx +110 -6
- package/{tabs-nav → nav-tabs}/NavTabs.test.js +1 -1
- package/{tabs-nav → nav-tabs}/Tab.js +48 -32
- package/{tabs-nav → nav-tabs}/types.d.ts +8 -9
- package/nav-tabs/types.js +5 -0
- package/number-input/NumberInput.d.ts +7 -0
- package/number-input/NumberInput.js +6 -4
- package/number-input/NumberInput.test.js +317 -98
- package/package.json +9 -14
- package/paginator/Icons.d.ts +5 -0
- package/paginator/Icons.js +16 -28
- package/paginator/Paginator.js +8 -16
- package/paginator/Paginator.stories.tsx +24 -0
- package/paginator/Paginator.test.js +58 -48
- package/paragraph/Paragraph.d.ts +3 -4
- package/paragraph/Paragraph.js +5 -5
- package/password-input/Icons.d.ts +6 -0
- package/password-input/Icons.js +39 -0
- package/password-input/PasswordInput.js +35 -82
- package/password-input/PasswordInput.stories.tsx +1 -0
- package/password-input/PasswordInput.test.js +34 -40
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +5 -5
- package/progress-bar/ProgressBar.stories.jsx +35 -2
- package/progress-bar/ProgressBar.test.js +1 -1
- package/progress-bar/types.d.ts +4 -3
- package/quick-nav/QuickNav.js +11 -12
- package/quick-nav/QuickNav.stories.tsx +111 -19
- package/radio-group/Radio.js +10 -10
- package/radio-group/RadioGroup.js +15 -13
- package/radio-group/RadioGroup.stories.tsx +131 -18
- package/radio-group/RadioGroup.test.js +117 -60
- package/resultsetTable/Icons.d.ts +7 -0
- package/resultsetTable/Icons.js +51 -0
- package/resultsetTable/ResultsetTable.js +49 -108
- package/resultsetTable/ResultsetTable.stories.tsx +50 -25
- package/resultsetTable/ResultsetTable.test.js +41 -64
- package/resultsetTable/types.d.ts +1 -1
- package/select/Listbox.d.ts +1 -1
- package/select/Listbox.js +5 -34
- package/select/Option.js +11 -24
- package/select/Select.js +59 -36
- package/select/Select.stories.tsx +497 -153
- package/select/Select.test.js +345 -292
- package/select/types.d.ts +2 -2
- package/sidenav/Icons.d.ts +7 -0
- package/sidenav/Icons.js +51 -0
- package/sidenav/Sidenav.d.ts +2 -2
- package/sidenav/Sidenav.js +66 -96
- package/sidenav/Sidenav.stories.tsx +165 -63
- package/sidenav/types.d.ts +21 -18
- package/slider/Slider.d.ts +2 -2
- package/slider/Slider.js +17 -14
- package/slider/Slider.stories.tsx +57 -0
- package/slider/Slider.test.js +1 -1
- package/slider/types.d.ts +6 -2
- package/spinner/Spinner.js +17 -23
- package/spinner/Spinner.stories.jsx +53 -27
- package/spinner/Spinner.test.js +1 -1
- package/switch/Switch.d.ts +3 -3
- package/switch/Switch.js +7 -6
- package/switch/Switch.stories.tsx +33 -0
- package/switch/Switch.test.js +1 -1
- package/switch/types.d.ts +8 -3
- package/table/Table.js +3 -3
- package/table/Table.stories.jsx +80 -1
- package/table/Table.test.js +2 -2
- package/tabs/Tab.js +12 -15
- package/tabs/Tabs.js +11 -17
- package/tabs/Tabs.stories.tsx +45 -5
- package/tabs/Tabs.test.js +4 -5
- package/tabs/types.d.ts +2 -2
- package/tag/Tag.js +7 -9
- package/tag/Tag.stories.tsx +14 -1
- package/tag/Tag.test.js +1 -1
- package/text-input/Suggestion.js +34 -7
- package/text-input/TextInput.js +224 -228
- package/text-input/TextInput.stories.tsx +132 -5
- package/text-input/TextInput.test.js +757 -658
- package/text-input/types.d.ts +9 -0
- package/textarea/Textarea.js +27 -26
- package/textarea/Textarea.stories.jsx +68 -1
- package/textarea/Textarea.test.js +61 -19
- package/textarea/types.d.ts +4 -0
- package/toggle-group/ToggleGroup.d.ts +2 -2
- package/toggle-group/ToggleGroup.js +85 -59
- package/toggle-group/ToggleGroup.stories.tsx +48 -3
- package/toggle-group/ToggleGroup.test.js +38 -24
- package/toggle-group/types.d.ts +22 -13
- package/typography/Typography.d.ts +2 -2
- package/typography/Typography.js +14 -113
- package/typography/Typography.stories.tsx +1 -1
- package/useTheme.d.ts +1251 -1
- package/useTheme.js +1 -1
- package/useTranslatedLabels.d.ts +84 -1
- package/utils/BaseTypography.d.ts +21 -0
- package/utils/BaseTypography.js +108 -0
- package/utils/FocusLock.d.ts +13 -0
- package/utils/FocusLock.js +138 -0
- package/wizard/Wizard.js +2 -2
- package/wizard/Wizard.stories.tsx +20 -0
- package/wizard/Wizard.test.js +1 -1
- package/wizard/types.d.ts +5 -6
- package/card/ice-cream.jpg +0 -0
- package/common/RequiredComponent.js +0 -32
- package/number-input/NumberInputContext.d.ts +0 -4
- package/number-input/NumberInputContext.js +0 -19
- package/number-input/numberInputContextTypes.d.ts +0 -19
- /package/{tabs-nav → grid}/types.js +0 -0
- /package/{number-input/numberInputContextTypes.js → image/types.js} +0 -0
- /package/{tabs-nav → nav-tabs}/Tab.d.ts +0 -0
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import DxcSidenav from "./Sidenav";
|
|
3
|
+
import DxcSelect from "../select/Select";
|
|
4
|
+
import DxcInset from "../inset/Inset";
|
|
3
5
|
import Title from "../../.storybook/components/Title";
|
|
4
6
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
7
|
import { userEvent, within } from "@storybook/testing-library";
|
|
8
|
+
import { HalstackProvider } from "../HalstackContext";
|
|
6
9
|
|
|
7
10
|
export default {
|
|
8
11
|
title: "Sidenav",
|
|
@@ -10,9 +13,26 @@ export default {
|
|
|
10
13
|
};
|
|
11
14
|
|
|
12
15
|
const iconSVG = (
|
|
13
|
-
<svg
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
<svg
|
|
17
|
+
version="1.1"
|
|
18
|
+
id="Capa_1"
|
|
19
|
+
x="0px"
|
|
20
|
+
y="0px"
|
|
21
|
+
width="438.536px"
|
|
22
|
+
height="438.536px"
|
|
23
|
+
viewBox="0 0 438.536 438.536"
|
|
24
|
+
fill="currentColor"
|
|
25
|
+
>
|
|
26
|
+
<g>
|
|
27
|
+
<path
|
|
28
|
+
d="M414.41,24.123C398.333,8.042,378.963,0,356.315,0H82.228C59.58,0,40.21,8.042,24.126,24.123
|
|
29
|
+
C8.045,40.207,0.003,59.576,0.003,82.225v274.084c0,22.647,8.042,42.018,24.123,58.102c16.084,16.084,35.454,24.126,58.102,24.126
|
|
30
|
+
h274.084c22.648,0,42.018-8.042,58.095-24.126c16.084-16.084,24.126-35.454,24.126-58.102V82.225
|
|
31
|
+
C438.532,59.576,430.49,40.204,414.41,24.123z M373.155,225.548h-49.963V406.84h-74.802V225.548H210.99V163.02h37.401v-37.402
|
|
32
|
+
c0-26.838,6.283-47.107,18.843-60.813c12.559-13.706,33.304-20.555,62.242-20.555h49.963v62.526h-31.401
|
|
33
|
+
c-10.663,0-17.467,1.853-20.417,5.568c-2.949,3.711-4.428,10.23-4.428,19.558v31.119h56.534L373.155,225.548z"
|
|
34
|
+
/>
|
|
35
|
+
</g>
|
|
16
36
|
</svg>
|
|
17
37
|
);
|
|
18
38
|
|
|
@@ -20,11 +40,17 @@ const TitleComponent = () => {
|
|
|
20
40
|
return <DxcSidenav.Title>Dxc technology</DxcSidenav.Title>;
|
|
21
41
|
};
|
|
22
42
|
|
|
43
|
+
const opinionatedTheme = {
|
|
44
|
+
sidenav: {
|
|
45
|
+
baseColor: "#f2f2f2",
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
23
49
|
export const Chromatic = () => (
|
|
24
50
|
<>
|
|
25
51
|
<ExampleContainer>
|
|
26
52
|
<Title title="Default sidenav" theme="light" level={4} />
|
|
27
|
-
<DxcSidenav title={<
|
|
53
|
+
<DxcSidenav title={<DxcSidenav.Title>Dxc technology</DxcSidenav.Title>}>
|
|
28
54
|
<DxcSidenav.Section>
|
|
29
55
|
<p>
|
|
30
56
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ullamcorper consectetur mollis. Suspendisse
|
|
@@ -41,12 +67,18 @@ export const Chromatic = () => (
|
|
|
41
67
|
</DxcSidenav.Group>
|
|
42
68
|
</DxcSidenav.Section>
|
|
43
69
|
<DxcSidenav.Section>
|
|
44
|
-
<DxcSidenav.Group
|
|
70
|
+
<DxcSidenav.Group
|
|
71
|
+
collapsable={true}
|
|
72
|
+
title="Section Group"
|
|
73
|
+
icon="https://cdn-icons-png.flaticon.com/512/5039/5039041.png"
|
|
74
|
+
>
|
|
45
75
|
<DxcSidenav.Link selected>Group Link</DxcSidenav.Link>
|
|
46
76
|
<DxcSidenav.Link icon={iconSVG}>Group Link</DxcSidenav.Link>
|
|
47
77
|
</DxcSidenav.Group>
|
|
48
|
-
<DxcSidenav.Link icon=
|
|
49
|
-
|
|
78
|
+
<DxcSidenav.Link icon="https://upload.wikimedia.org/wikipedia/commons/7/73/Flat_tick_icon.svg" newWindow>
|
|
79
|
+
Single Link
|
|
80
|
+
</DxcSidenav.Link>
|
|
81
|
+
<DxcSidenav.Link newWindow>Single Link</DxcSidenav.Link>
|
|
50
82
|
<DxcSidenav.Group collapsable={false} title="Section Group">
|
|
51
83
|
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
52
84
|
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
@@ -55,53 +87,78 @@ export const Chromatic = () => (
|
|
|
55
87
|
</DxcSidenav.Section>
|
|
56
88
|
</DxcSidenav>
|
|
57
89
|
</ExampleContainer>
|
|
90
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
91
|
+
<Title title="Focused options sidenav" theme="light" level={4} />
|
|
92
|
+
<DxcSidenav title={<DxcSidenav.Title>Dxc technology</DxcSidenav.Title>}>
|
|
93
|
+
<DxcSidenav.Section>
|
|
94
|
+
<p>
|
|
95
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ullamcorper consectetur mollis. Suspendisse
|
|
96
|
+
vitae lacinia libero.
|
|
97
|
+
</p>
|
|
98
|
+
</DxcSidenav.Section>
|
|
99
|
+
<DxcSidenav.Section>
|
|
100
|
+
<DxcSidenav.Link>Single Link</DxcSidenav.Link>
|
|
101
|
+
<DxcSidenav.Group collapsable={true} title="Collapsable Group">
|
|
102
|
+
<DxcSidenav.Link icon="https://cdn-icons-png.flaticon.com/512/5039/5039041.png">Group Link</DxcSidenav.Link>
|
|
103
|
+
</DxcSidenav.Group>
|
|
104
|
+
</DxcSidenav.Section>
|
|
105
|
+
<DxcSidenav.Section>
|
|
106
|
+
<DxcSidenav.Group collapsable={true} title="Collapsable Group">
|
|
107
|
+
<DxcSidenav.Link selected icon={iconSVG}>
|
|
108
|
+
Group Link
|
|
109
|
+
</DxcSidenav.Link>
|
|
110
|
+
</DxcSidenav.Group>
|
|
111
|
+
<DxcSidenav.Group collapsable={false} title="Section Group">
|
|
112
|
+
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
113
|
+
</DxcSidenav.Group>
|
|
114
|
+
</DxcSidenav.Section>
|
|
115
|
+
</DxcSidenav>
|
|
116
|
+
</ExampleContainer>
|
|
117
|
+
<Title title="Opinionated theme" theme="light" level={2} />
|
|
118
|
+
<ExampleContainer>
|
|
119
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
120
|
+
<DxcSidenav title={<TitleComponent />}>
|
|
121
|
+
<DxcSidenav.Section>
|
|
122
|
+
<p>
|
|
123
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ullamcorper consectetur mollis. Suspendisse
|
|
124
|
+
vitae lacinia libero.
|
|
125
|
+
</p>
|
|
126
|
+
</DxcSidenav.Section>
|
|
127
|
+
<DxcSidenav.Section>
|
|
128
|
+
<DxcSidenav.Link>Single Link</DxcSidenav.Link>
|
|
129
|
+
<DxcSidenav.Group collapsable={false} title="Single Group" icon={iconSVG}>
|
|
130
|
+
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
131
|
+
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
132
|
+
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
133
|
+
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
134
|
+
</DxcSidenav.Group>
|
|
135
|
+
</DxcSidenav.Section>
|
|
136
|
+
<DxcSidenav.Section>
|
|
137
|
+
<DxcSidenav.Group collapsable={true} title="Section Group" icon={iconSVG}>
|
|
138
|
+
<DxcSidenav.Link selected>Group Link</DxcSidenav.Link>
|
|
139
|
+
<DxcSidenav.Link icon={iconSVG}>Group Link</DxcSidenav.Link>
|
|
140
|
+
</DxcSidenav.Group>
|
|
141
|
+
<DxcSidenav.Link icon={iconSVG}>Single Link</DxcSidenav.Link>
|
|
142
|
+
<DxcSidenav.Link>Single Link</DxcSidenav.Link>
|
|
143
|
+
<DxcSidenav.Group collapsable={false} title="Section Group">
|
|
144
|
+
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
145
|
+
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
146
|
+
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
147
|
+
</DxcSidenav.Group>
|
|
148
|
+
</DxcSidenav.Section>
|
|
149
|
+
</DxcSidenav>
|
|
150
|
+
</HalstackProvider>
|
|
151
|
+
</ExampleContainer>
|
|
58
152
|
</>
|
|
59
153
|
);
|
|
60
154
|
|
|
61
|
-
|
|
62
|
-
<ExampleContainer pseudoState="pseudo-focus">
|
|
63
|
-
<Title title="Default sidenav" theme="light" level={4} />
|
|
64
|
-
<DxcSidenav title={<TitleComponent />}>
|
|
65
|
-
<DxcSidenav.Section>
|
|
66
|
-
<p>
|
|
67
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ullamcorper consectetur mollis. Suspendisse vitae
|
|
68
|
-
lacinia libero.
|
|
69
|
-
</p>
|
|
70
|
-
</DxcSidenav.Section>
|
|
71
|
-
<DxcSidenav.Section>
|
|
72
|
-
<DxcSidenav.Link>Single Link</DxcSidenav.Link>
|
|
73
|
-
<DxcSidenav.Link>Single Link</DxcSidenav.Link>
|
|
74
|
-
<DxcSidenav.Group collapsable={true} title="Collapsable Group">
|
|
75
|
-
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
76
|
-
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
77
|
-
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
78
|
-
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
79
|
-
</DxcSidenav.Group>
|
|
80
|
-
</DxcSidenav.Section>
|
|
81
|
-
<DxcSidenav.Section>
|
|
82
|
-
<DxcSidenav.Group collapsable={true} title="Collapsable Group">
|
|
83
|
-
<DxcSidenav.Link selected>Group Link</DxcSidenav.Link>
|
|
84
|
-
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
85
|
-
</DxcSidenav.Group>
|
|
86
|
-
<DxcSidenav.Link>Single Link</DxcSidenav.Link>
|
|
87
|
-
<DxcSidenav.Link>Single Link</DxcSidenav.Link>
|
|
88
|
-
<DxcSidenav.Group collapsable={false} title="Section Group">
|
|
89
|
-
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
90
|
-
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
91
|
-
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
92
|
-
</DxcSidenav.Group>
|
|
93
|
-
</DxcSidenav.Section>
|
|
94
|
-
</DxcSidenav>
|
|
95
|
-
</ExampleContainer>
|
|
96
|
-
);
|
|
97
|
-
|
|
98
|
-
const CollapsedGroup = () => (
|
|
155
|
+
const CollapsedGroupSidenav = () => (
|
|
99
156
|
<>
|
|
100
157
|
<ExampleContainer>
|
|
101
|
-
<Title title="
|
|
102
|
-
<DxcSidenav title={<
|
|
158
|
+
<Title title="Collapsed group with a selected link" theme="light" level={4} />
|
|
159
|
+
<DxcSidenav title={<DxcSidenav.Title>Dxc technology</DxcSidenav.Title>}>
|
|
103
160
|
<DxcSidenav.Section>
|
|
104
|
-
<DxcSidenav.Group collapsable={true} title="
|
|
161
|
+
<DxcSidenav.Group collapsable={true} title="Collapsed Group" icon={iconSVG}>
|
|
105
162
|
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
106
163
|
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
107
164
|
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
@@ -109,11 +166,11 @@ const CollapsedGroup = () => (
|
|
|
109
166
|
</DxcSidenav.Group>
|
|
110
167
|
</DxcSidenav.Section>
|
|
111
168
|
<DxcSidenav.Section>
|
|
112
|
-
<DxcSidenav.Group collapsable={true} title="
|
|
113
|
-
<DxcSidenav.Link selected>Group Link</DxcSidenav.Link>
|
|
169
|
+
<DxcSidenav.Group collapsable={true} title="Collapsed Group">
|
|
114
170
|
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
171
|
+
<DxcSidenav.Link selected>Group Link</DxcSidenav.Link>
|
|
115
172
|
</DxcSidenav.Group>
|
|
116
|
-
<DxcSidenav.Group collapsable={
|
|
173
|
+
<DxcSidenav.Group collapsable={true} title="Section Group">
|
|
117
174
|
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
118
175
|
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
119
176
|
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
@@ -124,14 +181,14 @@ const CollapsedGroup = () => (
|
|
|
124
181
|
</>
|
|
125
182
|
);
|
|
126
183
|
|
|
127
|
-
const
|
|
184
|
+
const HoveredGroupSidenav = () => (
|
|
128
185
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
129
|
-
<Title title="
|
|
130
|
-
<DxcSidenav title={<
|
|
186
|
+
<Title title="Hover state for groups (selected and not)" theme="light" level={4} />
|
|
187
|
+
<DxcSidenav title={<DxcSidenav.Title>Dxc technology</DxcSidenav.Title>}>
|
|
131
188
|
<DxcSidenav.Section>
|
|
132
189
|
<DxcSidenav.Link>Single Link</DxcSidenav.Link>
|
|
133
190
|
<DxcSidenav.Link>Single Link</DxcSidenav.Link>
|
|
134
|
-
<DxcSidenav.Group collapsable={true} title="
|
|
191
|
+
<DxcSidenav.Group collapsable={true} title="Collapsed Group">
|
|
135
192
|
<DxcSidenav.Link selected>Group Link</DxcSidenav.Link>
|
|
136
193
|
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
137
194
|
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
@@ -145,36 +202,81 @@ const HoverSidenav = () => (
|
|
|
145
202
|
</DxcSidenav.Group>
|
|
146
203
|
<DxcSidenav.Link>Single Link</DxcSidenav.Link>
|
|
147
204
|
<DxcSidenav.Link>Single Link</DxcSidenav.Link>
|
|
148
|
-
<DxcSidenav.Group collapsable={true} title="
|
|
205
|
+
<DxcSidenav.Group collapsable={true} title="Collapsed Group">
|
|
149
206
|
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
150
207
|
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
151
208
|
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
152
209
|
</DxcSidenav.Group>
|
|
210
|
+
<DxcSidenav.Group collapsable={true} title="Collapsed Group">
|
|
211
|
+
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
212
|
+
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
213
|
+
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
214
|
+
</DxcSidenav.Group>
|
|
215
|
+
</DxcSidenav.Section>
|
|
216
|
+
</DxcSidenav>
|
|
217
|
+
</ExampleContainer>
|
|
218
|
+
);
|
|
153
219
|
|
|
154
|
-
|
|
220
|
+
const ActiveGroupSidenav = () => (
|
|
221
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
222
|
+
<Title title="Active state for groups (selected and not)" theme="light" level={4} />
|
|
223
|
+
<DxcSidenav title={<DxcSidenav.Title>Dxc technology</DxcSidenav.Title>}>
|
|
224
|
+
<DxcSidenav.Section>
|
|
225
|
+
<DxcInset space="1rem">
|
|
226
|
+
<DxcSelect
|
|
227
|
+
defaultValue="1"
|
|
228
|
+
options={[
|
|
229
|
+
{ label: "v1.0.0", value: "1" },
|
|
230
|
+
{ label: "v2.0.0", value: "2" },
|
|
231
|
+
{ label: "v3.0.0", value: "3" },
|
|
232
|
+
{ label: "v4.0.0", value: "4" },
|
|
233
|
+
]}
|
|
234
|
+
size="fillParent"
|
|
235
|
+
/>
|
|
236
|
+
</DxcInset>
|
|
237
|
+
</DxcSidenav.Section>
|
|
238
|
+
<DxcSidenav.Section>
|
|
239
|
+
<DxcSidenav.Group collapsable={true} title="Collapsed Group">
|
|
240
|
+
<DxcSidenav.Link selected>Group Link</DxcSidenav.Link>
|
|
155
241
|
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
156
242
|
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
157
243
|
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
158
244
|
</DxcSidenav.Group>
|
|
159
245
|
</DxcSidenav.Section>
|
|
246
|
+
<DxcSidenav.Section>
|
|
247
|
+
<DxcSidenav.Group collapsable={true} title="Not Collapsed Group">
|
|
248
|
+
<DxcSidenav.Link selected>Group Link</DxcSidenav.Link>
|
|
249
|
+
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
250
|
+
</DxcSidenav.Group>
|
|
251
|
+
<DxcSidenav.Link>Single Link</DxcSidenav.Link>
|
|
252
|
+
<DxcSidenav.Link>Single Link</DxcSidenav.Link>
|
|
253
|
+
</DxcSidenav.Section>
|
|
160
254
|
</DxcSidenav>
|
|
161
255
|
</ExampleContainer>
|
|
162
256
|
);
|
|
163
257
|
|
|
164
|
-
export const
|
|
165
|
-
|
|
258
|
+
export const CollapsableGroup = CollapsedGroupSidenav.bind({});
|
|
259
|
+
CollapsableGroup.play = async ({ canvasElement }) => {
|
|
166
260
|
const canvas = within(canvasElement);
|
|
167
|
-
const collapsableGroups = canvas.getAllByText("
|
|
261
|
+
const collapsableGroups = canvas.getAllByText("Collapsed Group");
|
|
168
262
|
collapsableGroups.forEach((group) => {
|
|
169
263
|
userEvent.click(group);
|
|
170
264
|
});
|
|
171
265
|
};
|
|
172
266
|
|
|
173
|
-
export const
|
|
174
|
-
|
|
267
|
+
export const CollapsedHoverGroup = HoveredGroupSidenav.bind({});
|
|
268
|
+
CollapsedHoverGroup.play = async ({ canvasElement }) => {
|
|
175
269
|
const canvas = within(canvasElement);
|
|
176
|
-
const collapsableGroups = canvas.getAllByText("
|
|
270
|
+
const collapsableGroups = canvas.getAllByText("Collapsed Group");
|
|
177
271
|
collapsableGroups.forEach((group) => {
|
|
178
272
|
userEvent.click(group);
|
|
179
273
|
});
|
|
274
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
180
275
|
};
|
|
276
|
+
|
|
277
|
+
export const CollapsedActiveGroup = ActiveGroupSidenav.bind({});
|
|
278
|
+
CollapsedActiveGroup.play = async ({ canvasElement }) => {
|
|
279
|
+
const canvas = within(canvasElement);
|
|
280
|
+
const collapsableGroups = canvas.getAllByText("Collapsed Group");
|
|
281
|
+
userEvent.click(collapsableGroups[0]);
|
|
282
|
+
};
|
package/sidenav/types.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
declare type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
|
|
3
3
|
declare type SidenavPropsType = {
|
|
4
|
-
/**
|
|
5
|
-
* The area inside the sidenav. This area can be used to render the content inside the sidenav.
|
|
6
|
-
*/
|
|
7
|
-
children: React.ReactNode;
|
|
8
4
|
/**
|
|
9
5
|
* The area assigned to render the sidenav title. It is highly recommended to use the sidenav title.
|
|
10
6
|
*/
|
|
11
7
|
title?: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* The area inside the sidenav. This area can be used to render the content inside the sidenav.
|
|
10
|
+
*/
|
|
11
|
+
children: React.ReactNode;
|
|
12
12
|
};
|
|
13
13
|
export declare type SidenavTitlePropsType = {
|
|
14
14
|
/**
|
|
@@ -23,28 +23,25 @@ export declare type SidenavSectionPropsType = {
|
|
|
23
23
|
children: React.ReactNode;
|
|
24
24
|
};
|
|
25
25
|
export declare type SidenavGroupPropsType = {
|
|
26
|
-
/**
|
|
27
|
-
* The area inside the sidenav group. This area can be used to render sidenav links.
|
|
28
|
-
*/
|
|
29
|
-
children: React.ReactNode;
|
|
30
26
|
/**
|
|
31
27
|
* The title of the sidenav group.
|
|
32
28
|
*/
|
|
33
29
|
title?: string;
|
|
34
30
|
/**
|
|
35
|
-
* If true the sidenav group
|
|
31
|
+
* If true, the sidenav group will be a button that will allow you to collapse the links contained within it.
|
|
32
|
+
* In addition, if it's collapsed and contains the currently selected link, the group title will also be marked as selected.
|
|
36
33
|
*/
|
|
37
34
|
collapsable?: boolean;
|
|
38
35
|
/**
|
|
39
36
|
* The icon to be displayed next to the title of the group.
|
|
40
37
|
*/
|
|
41
38
|
icon?: string | SVG;
|
|
42
|
-
};
|
|
43
|
-
export declare type SidenavLinkPropsType = {
|
|
44
39
|
/**
|
|
45
|
-
*
|
|
40
|
+
* The area inside the sidenav group. This area can be used to render sidenav links.
|
|
46
41
|
*/
|
|
47
|
-
|
|
42
|
+
children: React.ReactNode;
|
|
43
|
+
};
|
|
44
|
+
export declare type SidenavLinkPropsType = {
|
|
48
45
|
/**
|
|
49
46
|
* Page to be opened when the user clicks on the link.
|
|
50
47
|
*/
|
|
@@ -58,16 +55,22 @@ export declare type SidenavLinkPropsType = {
|
|
|
58
55
|
*/
|
|
59
56
|
icon?: string | SVG;
|
|
60
57
|
/**
|
|
61
|
-
* If true, the link will be marked as selected.
|
|
58
|
+
* If true, the link will be marked as selected. Moreover, in that same case,
|
|
59
|
+
* if it is contained within a collapsed group, and consequently, the currently selected link is not visible,
|
|
60
|
+
* the group title will appear as selected too.
|
|
62
61
|
*/
|
|
63
62
|
selected?: boolean;
|
|
64
63
|
/**
|
|
65
|
-
*
|
|
64
|
+
* This function will be called when the user clicks the link and the event will be passed to this function.
|
|
66
65
|
*/
|
|
67
|
-
|
|
66
|
+
onClick?: ($event: React.MouseEvent<HTMLAnchorElement>) => void;
|
|
68
67
|
/**
|
|
69
|
-
*
|
|
68
|
+
* Value of the tabindex.
|
|
69
|
+
*/
|
|
70
|
+
tabIndex?: number;
|
|
71
|
+
/**
|
|
72
|
+
* The area inside the sidenav link.
|
|
70
73
|
*/
|
|
71
|
-
|
|
74
|
+
children: React.ReactNode;
|
|
72
75
|
};
|
|
73
76
|
export default SidenavPropsType;
|
package/slider/Slider.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from "react";
|
|
2
2
|
import SliderPropsType from "./types";
|
|
3
|
-
declare const DxcSlider:
|
|
3
|
+
declare const DxcSlider: React.ForwardRefExoticComponent<SliderPropsType & React.RefAttributes<HTMLDivElement>>;
|
|
4
4
|
export default DxcSlider;
|
package/slider/Slider.js
CHANGED
|
@@ -21,9 +21,9 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
21
21
|
|
|
22
22
|
var _TextInput = _interopRequireDefault(require("../text-input/TextInput"));
|
|
23
23
|
|
|
24
|
-
var _variables = require("../common/variables
|
|
24
|
+
var _variables = require("../common/variables");
|
|
25
25
|
|
|
26
|
-
var _utils = require("../common/utils
|
|
26
|
+
var _utils = require("../common/utils");
|
|
27
27
|
|
|
28
28
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
29
29
|
|
|
@@ -37,7 +37,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
37
37
|
|
|
38
38
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
39
39
|
|
|
40
|
-
var DxcSlider = function
|
|
40
|
+
var DxcSlider = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
41
41
|
var _ref$label = _ref.label,
|
|
42
42
|
label = _ref$label === void 0 ? "" : _ref$label,
|
|
43
43
|
_ref$name = _ref.name,
|
|
@@ -100,8 +100,9 @@ var DxcSlider = function DxcSlider(_ref) {
|
|
|
100
100
|
while (index <= numberOfMarks) {
|
|
101
101
|
ticks.push( /*#__PURE__*/_react["default"].createElement(TickMark, {
|
|
102
102
|
disabled: disabled,
|
|
103
|
-
stepPosition: step * index / range
|
|
104
|
-
backgroundType: backgroundType
|
|
103
|
+
stepPosition: step * index / range,
|
|
104
|
+
backgroundType: backgroundType,
|
|
105
|
+
stepValue: (value !== null && value !== void 0 ? value : innerValue) / maxValue
|
|
105
106
|
}));
|
|
106
107
|
index++;
|
|
107
108
|
}
|
|
@@ -110,7 +111,7 @@ var DxcSlider = function DxcSlider(_ref) {
|
|
|
110
111
|
} else {
|
|
111
112
|
return null;
|
|
112
113
|
}
|
|
113
|
-
}, [minValue, maxValue, step]);
|
|
114
|
+
}, [minValue, maxValue, step, value, innerValue]);
|
|
114
115
|
|
|
115
116
|
var handleSliderChange = function handleSliderChange(event) {
|
|
116
117
|
var valueToCheck = event.target.value;
|
|
@@ -146,7 +147,8 @@ var DxcSlider = function DxcSlider(_ref) {
|
|
|
146
147
|
theme: colorsTheme.slider
|
|
147
148
|
}, /*#__PURE__*/_react["default"].createElement(Container, {
|
|
148
149
|
margin: margin,
|
|
149
|
-
size: size
|
|
150
|
+
size: size,
|
|
151
|
+
ref: ref
|
|
150
152
|
}, /*#__PURE__*/_react["default"].createElement(Label, {
|
|
151
153
|
id: labelId,
|
|
152
154
|
disabled: disabled,
|
|
@@ -164,7 +166,6 @@ var DxcSlider = function DxcSlider(_ref) {
|
|
|
164
166
|
min: minValue,
|
|
165
167
|
max: maxValue,
|
|
166
168
|
step: step,
|
|
167
|
-
marks: marks,
|
|
168
169
|
disabled: disabled,
|
|
169
170
|
"aria-labelledby": labelId,
|
|
170
171
|
"aria-orientation": "horizontal",
|
|
@@ -188,7 +189,7 @@ var DxcSlider = function DxcSlider(_ref) {
|
|
|
188
189
|
onChange: handlerInputChange,
|
|
189
190
|
size: "fillParent"
|
|
190
191
|
})))));
|
|
191
|
-
};
|
|
192
|
+
});
|
|
192
193
|
|
|
193
194
|
var sizes = {
|
|
194
195
|
medium: "360px",
|
|
@@ -250,10 +251,10 @@ var HelperText = _styledComponents["default"].span(_templateObject3 || (_templat
|
|
|
250
251
|
return props.theme.helperTextLineHeight;
|
|
251
252
|
});
|
|
252
253
|
|
|
253
|
-
var SliderInput = _styledComponents["default"].input(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n width: 100%;\n min-width: 240px;\n height: ", ";\n display: inline-block;\n vertical-align: middle;\n -webkit-appearance: none;\n background-color: ", ";\n background-image: ", ";\n background-repeat: no-repeat;\n background-size: ", ";\n border-radius: 5px;\n
|
|
254
|
+
var SliderInput = _styledComponents["default"].input(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n width: 100%;\n min-width: 240px;\n height: ", ";\n display: inline-block;\n vertical-align: middle;\n -webkit-appearance: none;\n background-color: ", ";\n background-image: ", ";\n background-repeat: no-repeat;\n background-size: ", ";\n border-radius: 5px;\n cursor: ", ";\n &::-webkit-slider-runnable-track {\n -webkit-appearance: none;\n box-shadow: none;\n border: none;\n background: transparent;\n margin: 0px -8px;\n }\n\n &::-webkit-slider-thumb {\n -webkit-appearance: none;\n border: none;\n height: ", ";\n width: ", ";\n border-radius: 25px;\n background: ", ";\n &:active {\n ", "\n }\n &:hover {\n ", "\n }\n }\n &::-moz-range-track {\n -webkit-appearance: none;\n box-shadow: none;\n border: none;\n background: transparent;\n }\n &::-moz-range-thumb {\n -webkit-appearance: none;\n border: none;\n height: ", ";\n width: ", ";\n border-radius: 25px;\n background: ", ";\n &:active {\n background: ", ";\n transform: scale(1.16667);\n }\n &:hover {\n ", "\n }\n }\n &:focus {\n outline: none;\n &::-webkit-slider-thumb {\n outline: ", "\n auto 1px;\n outline-offset: 2px;\n }\n &::-moz-range-thumb {\n outline: ", "\n auto 1px;\n outline-offset: 2px;\n }\n }\n"])), function (props) {
|
|
254
255
|
return props.theme.trackLineThickness;
|
|
255
256
|
}, function (props) {
|
|
256
|
-
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledTotalLineColorOnDark + "61" : props.theme.disabledTotalLineColor + "61" : props.backgroundType === "dark" ? props.theme.totalLineColorOnDark + "61" : props.theme.totalLineColor
|
|
257
|
+
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledTotalLineColorOnDark + "61" : props.theme.disabledTotalLineColor + "61" : props.backgroundType === "dark" ? props.theme.totalLineColorOnDark + "61" : props.theme.totalLineColor;
|
|
257
258
|
}, function (props) {
|
|
258
259
|
return props.disabled ? props.backgroundType === "dark" ? "linear-gradient(".concat(props.theme.disabledTrackLineColorOnDark, ", ").concat(props.theme.disabledTrackLineColorOnDark, ")") : "linear-gradient(".concat(props.theme.disabledTrackLineColor, ", ").concat(props.theme.disabledTrackLineColor, ")") : props.backgroundType === "dark" ? "linear-gradient(".concat(props.theme.trackLineColorOnDark, ", ").concat(props.theme.trackLineColorOnDark, ")") : "linear-gradient(".concat(props.theme.trackLineColor, ", ").concat(props.theme.trackLineColor, ")");
|
|
259
260
|
}, function (props) {
|
|
@@ -315,20 +316,22 @@ var MaxLabelContainer = (0, _styledComponents["default"])(LimitLabelContainer)(_
|
|
|
315
316
|
return props.step === 1 ? props.theme.ceilLabelMarginLeft : "1.25rem";
|
|
316
317
|
});
|
|
317
318
|
|
|
318
|
-
var SliderInputContainer = _styledComponents["default"].div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n position: relative;\n width: 100%;\n height: 24px;\n display: flex;\n align-items: center;\n justify-content: center;\n margin-right: -2px;\n padding-top: 1px;\n"])));
|
|
319
|
+
var SliderInputContainer = _styledComponents["default"].div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n position: relative;\n width: 100%;\n height: 24px;\n display: flex;\n align-items: center;\n justify-content: center;\n margin-right: -2px;\n padding-top: 1px;\n z-index: 0;\n"])));
|
|
319
320
|
|
|
320
321
|
var MarksContainer = _styledComponents["default"].div(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n ", "\n position: absolute;\n pointer-events: none;\n height: 100%;\n display: flex;\n align-items: center;\n"])), function (props) {
|
|
321
322
|
return props.isFirefox ? getFireFoxStyles() : getChromeStyles();
|
|
322
323
|
});
|
|
323
324
|
|
|
324
|
-
var TickMark = _styledComponents["default"].span(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])(["\n position: absolute;\n background: ", ";\n height: ", ";\n width: ", ";\n border-radius: 18px;\n left: ", ";\n"])), function (props) {
|
|
325
|
+
var TickMark = _styledComponents["default"].span(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])(["\n position: absolute;\n background: ", ";\n height: ", ";\n width: ", ";\n border-radius: 18px;\n left: ", ";\n z-index: ", ";\n"])), function (props) {
|
|
325
326
|
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledTickBackgroundColorOnDark : props.theme.disabledTickBackgroundColor : props.backgroundType === "dark" ? props.theme.tickBackgroundColorOnDark : props.theme.tickBackgroundColor;
|
|
326
327
|
}, function (props) {
|
|
327
328
|
return props.theme.tickHeight;
|
|
328
329
|
}, function (props) {
|
|
329
330
|
return props.theme.tickWidth;
|
|
330
331
|
}, function (props) {
|
|
331
|
-
return "".concat(props.stepPosition, "%");
|
|
332
|
+
return "calc(".concat(props.stepPosition, " * 100%)");
|
|
333
|
+
}, function (props) {
|
|
334
|
+
return "".concat(props.stepPosition <= props.stepValue ? "-1" : "0");
|
|
332
335
|
});
|
|
333
336
|
|
|
334
337
|
var StyledTextInput = _styledComponents["default"].div(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2["default"])(["\n margin-left: ", ";\n max-width: 70px;\n"])), function (props) {
|
|
@@ -4,6 +4,7 @@ import { BackgroundColorProvider } from "../BackgroundColorContext";
|
|
|
4
4
|
import Title from "../../.storybook/components/Title";
|
|
5
5
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
6
6
|
import DarkContainer from "../../.storybook/components/DarkSection";
|
|
7
|
+
import { HalstackProvider } from "../HalstackContext";
|
|
7
8
|
|
|
8
9
|
export default {
|
|
9
10
|
title: "Slider",
|
|
@@ -12,6 +13,14 @@ export default {
|
|
|
12
13
|
|
|
13
14
|
const labelFormat = (value) => `${value}E100000000000000000000000`;
|
|
14
15
|
|
|
16
|
+
const opinionatedTheme = {
|
|
17
|
+
slider: {
|
|
18
|
+
baseColor: "#0067b3",
|
|
19
|
+
fontColor: "#000000",
|
|
20
|
+
totalLineColor: "#e6e6e6",
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
15
24
|
export const Chromatic = () => (
|
|
16
25
|
<>
|
|
17
26
|
<Title title="States" theme="light" level={2} />
|
|
@@ -179,5 +188,53 @@ export const Chromatic = () => (
|
|
|
179
188
|
size="large"
|
|
180
189
|
/>
|
|
181
190
|
</ExampleContainer>
|
|
191
|
+
<Title title="Opinionated theme" theme="light" level={2} />
|
|
192
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
193
|
+
<Title title="Hovered" theme="light" level={4} />
|
|
194
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
195
|
+
<DxcSlider label="Slider" helperText="Help message" showLimitsValues />
|
|
196
|
+
</HalstackProvider>
|
|
197
|
+
</ExampleContainer>
|
|
198
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
199
|
+
<Title title="Active" theme="light" level={4} />
|
|
200
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
201
|
+
<DxcSlider label="Slider" helperText="Help message" showLimitsValues />
|
|
202
|
+
</HalstackProvider>
|
|
203
|
+
</ExampleContainer>
|
|
204
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
205
|
+
<Title title="Focused" theme="light" level={4} />
|
|
206
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
207
|
+
<DxcSlider label="Slider" helperText="Help message" showLimitsValues />
|
|
208
|
+
</HalstackProvider>
|
|
209
|
+
</ExampleContainer>
|
|
210
|
+
<ExampleContainer>
|
|
211
|
+
<Title title="Disabled discrete slider with input" theme="light" level={4} />{" "}
|
|
212
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
213
|
+
<DxcSlider
|
|
214
|
+
label="Slider"
|
|
215
|
+
helperText="Help message"
|
|
216
|
+
disabled
|
|
217
|
+
defaultValue={40}
|
|
218
|
+
minValue={0}
|
|
219
|
+
maxValue={50}
|
|
220
|
+
showLimitsValues
|
|
221
|
+
showInput
|
|
222
|
+
marks
|
|
223
|
+
step={10}
|
|
224
|
+
/>
|
|
225
|
+
</HalstackProvider>
|
|
226
|
+
</ExampleContainer>
|
|
227
|
+
<ExampleContainer>
|
|
228
|
+
<Title title="Continuous slider" theme="light" level={4} />
|
|
229
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
230
|
+
<DxcSlider defaultValue={65} label="Slider" helperText="Help message" showLimitsValues />
|
|
231
|
+
</HalstackProvider>
|
|
232
|
+
</ExampleContainer>
|
|
233
|
+
<ExampleContainer>
|
|
234
|
+
<Title title="Discrete slider" theme="light" level={4} />
|
|
235
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
236
|
+
<DxcSlider defaultValue={20} label="Slider" helperText="Help message" showLimitsValues marks step={5} />
|
|
237
|
+
</HalstackProvider>
|
|
238
|
+
</ExampleContainer>
|
|
182
239
|
</>
|
|
183
240
|
);
|
package/slider/Slider.test.js
CHANGED
|
@@ -8,7 +8,7 @@ var _react2 = require("@testing-library/react");
|
|
|
8
8
|
|
|
9
9
|
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
10
10
|
|
|
11
|
-
var _Slider = _interopRequireDefault(require("./Slider"));
|
|
11
|
+
var _Slider = _interopRequireDefault(require("./Slider.tsx"));
|
|
12
12
|
|
|
13
13
|
describe("Slider component tests", function () {
|
|
14
14
|
test("Slider renders with correct text and label id", function () {
|
package/slider/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
2
|
+
declare type Margin = {
|
|
3
3
|
top?: Space;
|
|
4
4
|
bottom?: Space;
|
|
5
5
|
left?: Space;
|
|
@@ -79,4 +79,8 @@ declare type Props = {
|
|
|
79
79
|
*/
|
|
80
80
|
size?: "medium" | "large" | "fillParent";
|
|
81
81
|
};
|
|
82
|
+
/**
|
|
83
|
+
* Reference to the component.
|
|
84
|
+
*/
|
|
85
|
+
export declare type RefType = HTMLDivElement;
|
|
82
86
|
export default Props;
|