@dxc-technology/halstack-react 0.0.0-5aa300b → 0.0.0-5b32837
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 +1 -10
- package/BackgroundColorContext.js +5 -22
- package/HalstackContext.d.ts +1231 -6
- package/HalstackContext.js +121 -105
- package/README.md +47 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +30 -87
- package/accordion/Accordion.stories.tsx +52 -115
- package/accordion/Accordion.test.js +19 -34
- package/accordion/types.d.ts +5 -17
- package/accordion-group/AccordionGroup.d.ts +4 -3
- package/accordion-group/AccordionGroup.js +29 -77
- package/accordion-group/AccordionGroup.stories.tsx +78 -77
- package/accordion-group/AccordionGroup.test.js +44 -72
- package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
- package/accordion-group/AccordionGroupAccordion.js +31 -0
- package/accordion-group/types.d.ts +6 -18
- package/action-icon/ActionIcon.d.ts +4 -0
- package/action-icon/ActionIcon.js +47 -0
- package/action-icon/ActionIcon.stories.tsx +41 -0
- package/action-icon/ActionIcon.test.js +64 -0
- package/action-icon/types.d.ts +26 -0
- package/alert/Alert.js +19 -58
- package/alert/Alert.stories.tsx +28 -0
- package/alert/Alert.test.js +29 -46
- package/alert/types.d.ts +5 -5
- package/badge/Badge.d.ts +1 -1
- package/badge/Badge.js +141 -43
- package/badge/Badge.stories.tsx +210 -0
- package/badge/Badge.test.js +30 -0
- package/badge/types.d.ts +52 -3
- package/bleed/Bleed.js +13 -21
- package/bleed/Bleed.stories.tsx +1 -0
- package/bleed/types.d.ts +2 -2
- package/box/Box.d.ts +1 -1
- package/box/Box.js +18 -59
- package/box/Box.stories.tsx +38 -51
- package/box/Box.test.js +2 -7
- package/box/types.d.ts +3 -15
- package/bulleted-list/BulletedList.js +19 -53
- package/bulleted-list/BulletedList.stories.tsx +8 -93
- package/bulleted-list/types.d.ts +32 -5
- package/button/Button.d.ts +1 -1
- package/button/Button.js +68 -102
- package/button/Button.stories.tsx +104 -94
- package/button/Button.test.js +20 -17
- package/button/types.d.ts +8 -4
- package/card/Card.d.ts +1 -1
- package/card/Card.js +48 -89
- package/card/Card.stories.tsx +12 -42
- package/card/Card.test.js +11 -22
- package/card/types.d.ts +6 -12
- package/checkbox/Checkbox.js +87 -122
- package/checkbox/Checkbox.stories.tsx +68 -54
- package/checkbox/Checkbox.test.js +108 -64
- package/checkbox/types.d.ts +8 -4
- package/chip/Chip.js +36 -64
- package/chip/Chip.stories.tsx +80 -17
- package/chip/Chip.test.js +16 -31
- package/chip/types.d.ts +4 -4
- package/common/OpenSans.css +68 -80
- package/common/coreTokens.d.ts +237 -0
- package/common/coreTokens.js +184 -0
- package/common/utils.d.ts +1 -0
- package/common/utils.js +6 -12
- package/common/variables.d.ts +1383 -0
- package/common/variables.js +886 -1143
- package/container/Container.d.ts +4 -0
- package/container/Container.js +194 -0
- package/container/Container.stories.tsx +214 -0
- package/container/types.d.ts +74 -0
- package/date-input/Calendar.d.ts +1 -1
- package/date-input/Calendar.js +52 -96
- package/date-input/DateInput.js +103 -107
- package/date-input/DateInput.stories.tsx +194 -60
- package/date-input/DateInput.test.js +676 -620
- package/date-input/DatePicker.js +47 -92
- package/date-input/Icons.d.ts +6 -0
- package/date-input/Icons.js +58 -0
- package/date-input/YearPicker.d.ts +1 -1
- package/date-input/YearPicker.js +29 -44
- package/date-input/types.d.ts +31 -27
- package/dialog/Dialog.d.ts +1 -1
- package/dialog/Dialog.js +61 -119
- package/dialog/Dialog.stories.tsx +310 -212
- package/dialog/Dialog.test.js +269 -32
- package/dialog/types.d.ts +18 -26
- package/dropdown/Dropdown.js +50 -103
- package/dropdown/Dropdown.stories.tsx +200 -82
- package/dropdown/Dropdown.test.js +393 -379
- package/dropdown/DropdownMenu.js +20 -37
- package/dropdown/DropdownMenuItem.js +9 -34
- package/dropdown/types.d.ts +17 -19
- package/file-input/FileInput.js +184 -256
- package/file-input/FileInput.stories.tsx +86 -3
- package/file-input/FileInput.test.js +356 -395
- package/file-input/FileItem.js +15 -41
- package/file-input/types.d.ts +10 -10
- package/flex/Flex.js +27 -39
- package/flex/Flex.stories.tsx +35 -26
- package/flex/types.d.ts +74 -9
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +70 -117
- package/footer/Footer.stories.tsx +55 -21
- package/footer/Footer.test.js +33 -57
- package/footer/Icons.d.ts +3 -2
- package/footer/Icons.js +66 -7
- package/footer/types.d.ts +25 -27
- package/grid/Grid.d.ts +7 -0
- package/grid/Grid.js +76 -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 +48 -133
- package/header/Header.stories.tsx +115 -36
- package/header/Header.test.js +13 -26
- package/header/Icons.d.ts +2 -2
- package/header/Icons.js +2 -7
- package/header/types.d.ts +5 -20
- package/heading/Heading.js +10 -32
- package/heading/Heading.test.js +71 -88
- package/heading/types.d.ts +7 -7
- package/image/Image.d.ts +4 -0
- package/image/Image.js +70 -0
- package/image/Image.stories.tsx +127 -0
- package/image/types.d.ts +72 -0
- package/image/types.js +5 -0
- package/inset/Inset.js +13 -21
- package/inset/Inset.stories.tsx +2 -1
- package/inset/types.d.ts +2 -2
- package/layout/ApplicationLayout.d.ts +5 -5
- package/layout/ApplicationLayout.js +29 -66
- package/layout/ApplicationLayout.stories.tsx +1 -1
- package/layout/Icons.d.ts +8 -5
- package/layout/Icons.js +51 -59
- package/layout/SidenavContext.d.ts +1 -1
- package/layout/SidenavContext.js +3 -9
- package/layout/types.d.ts +5 -6
- package/link/Link.js +24 -45
- package/link/Link.stories.tsx +60 -0
- package/link/Link.test.js +24 -44
- package/link/types.d.ts +14 -14
- package/main.d.ts +8 -5
- package/main.js +33 -59
- package/{tabs-nav → nav-tabs}/NavTabs.d.ts +2 -2
- package/{tabs-nav → nav-tabs}/NavTabs.js +23 -55
- package/{tabs-nav → nav-tabs}/NavTabs.stories.tsx +109 -5
- package/{tabs-nav → nav-tabs}/NavTabs.test.js +39 -45
- package/nav-tabs/Tab.js +118 -0
- package/{tabs-nav → nav-tabs}/types.d.ts +14 -15
- package/nav-tabs/types.js +5 -0
- package/number-input/NumberInput.d.ts +7 -0
- package/number-input/NumberInput.js +26 -35
- package/number-input/NumberInput.stories.tsx +42 -26
- package/number-input/NumberInput.test.js +701 -413
- package/number-input/types.d.ts +11 -5
- package/package.json +31 -29
- package/paginator/Icons.d.ts +5 -5
- package/paginator/Icons.js +5 -19
- package/paginator/Paginator.js +17 -47
- package/paginator/Paginator.stories.tsx +24 -0
- package/paginator/Paginator.test.js +252 -225
- package/paginator/types.d.ts +3 -3
- package/paragraph/Paragraph.d.ts +3 -4
- package/paragraph/Paragraph.js +6 -22
- package/paragraph/Paragraph.stories.tsx +0 -17
- package/password-input/Icons.d.ts +6 -0
- package/password-input/Icons.js +35 -0
- package/password-input/PasswordInput.js +57 -126
- package/password-input/PasswordInput.stories.tsx +1 -33
- package/password-input/PasswordInput.test.js +158 -141
- package/password-input/types.d.ts +8 -7
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +23 -55
- package/progress-bar/{ProgressBar.stories.jsx → ProgressBar.stories.tsx} +36 -3
- package/progress-bar/ProgressBar.test.js +36 -53
- package/progress-bar/types.d.ts +4 -3
- package/quick-nav/QuickNav.js +4 -27
- package/quick-nav/QuickNav.stories.tsx +15 -1
- package/quick-nav/types.d.ts +10 -10
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +31 -63
- package/radio-group/RadioGroup.js +45 -93
- package/radio-group/RadioGroup.stories.tsx +131 -18
- package/radio-group/RadioGroup.test.js +505 -471
- package/radio-group/types.d.ts +8 -8
- package/resultset-table/Icons.d.ts +7 -0
- package/{resultsetTable → resultset-table}/Icons.js +1 -5
- package/resultset-table/ResultsetTable.d.ts +7 -0
- package/{resultsetTable → resultset-table}/ResultsetTable.js +38 -66
- package/{resultsetTable → resultset-table}/ResultsetTable.stories.tsx +86 -5
- package/{resultsetTable → resultset-table}/ResultsetTable.test.js +155 -114
- package/{resultsetTable → resultset-table}/types.d.ts +13 -7
- package/resultset-table/types.js +5 -0
- package/select/Icons.d.ts +7 -7
- package/select/Icons.js +1 -5
- package/select/Listbox.d.ts +1 -1
- package/select/Listbox.js +17 -72
- package/select/Option.js +19 -40
- package/select/Select.js +120 -175
- package/select/Select.stories.tsx +478 -190
- package/select/Select.test.js +1974 -1837
- package/select/types.d.ts +16 -17
- package/sidenav/Icons.d.ts +7 -0
- package/sidenav/Icons.js +47 -0
- package/sidenav/Sidenav.d.ts +2 -2
- package/sidenav/Sidenav.js +81 -151
- package/sidenav/Sidenav.stories.tsx +110 -17
- package/sidenav/Sidenav.test.js +3 -10
- package/sidenav/types.d.ts +31 -28
- package/slider/Slider.js +70 -128
- package/slider/Slider.test.js +108 -104
- package/slider/types.d.ts +4 -4
- package/spinner/Spinner.js +29 -73
- package/spinner/{Spinner.stories.jsx → Spinner.stories.tsx} +53 -27
- package/spinner/Spinner.test.js +26 -35
- package/spinner/types.d.ts +3 -3
- package/status-light/StatusLight.d.ts +4 -0
- package/status-light/StatusLight.js +51 -0
- package/status-light/StatusLight.stories.tsx +74 -0
- package/status-light/StatusLight.test.js +25 -0
- package/status-light/types.d.ts +17 -0
- package/status-light/types.js +5 -0
- package/switch/Switch.js +51 -99
- package/switch/Switch.stories.tsx +33 -34
- package/switch/Switch.test.js +52 -97
- package/switch/types.d.ts +4 -4
- package/table/ActionsCell.d.ts +4 -0
- package/table/ActionsCell.js +54 -0
- package/table/DropdownTheme.js +57 -0
- package/table/Table.d.ts +4 -1
- package/table/Table.js +27 -32
- package/table/Table.stories.tsx +615 -0
- package/table/Table.test.js +94 -7
- package/table/types.d.ts +45 -6
- package/tabs/Tab.js +23 -40
- package/tabs/Tabs.js +62 -145
- package/tabs/Tabs.stories.tsx +39 -1
- package/tabs/Tabs.test.js +66 -123
- package/tabs/types.d.ts +19 -19
- package/tag/Tag.js +28 -60
- package/tag/Tag.stories.tsx +14 -1
- package/tag/Tag.test.js +20 -31
- package/tag/types.d.ts +7 -7
- package/text-input/Icons.d.ts +5 -5
- package/text-input/Icons.js +1 -5
- package/text-input/Suggestion.js +11 -28
- package/text-input/Suggestions.d.ts +1 -1
- package/text-input/Suggestions.js +15 -65
- package/text-input/TextInput.js +219 -320
- package/text-input/TextInput.stories.tsx +117 -152
- package/text-input/TextInput.test.js +1211 -1196
- package/text-input/types.d.ts +25 -17
- package/textarea/Textarea.js +70 -113
- package/textarea/Textarea.stories.tsx +174 -0
- package/textarea/Textarea.test.js +152 -183
- package/textarea/types.d.ts +9 -5
- package/toggle-group/ToggleGroup.d.ts +2 -2
- package/toggle-group/ToggleGroup.js +92 -106
- package/toggle-group/ToggleGroup.stories.tsx +49 -4
- package/toggle-group/ToggleGroup.test.js +69 -88
- package/toggle-group/types.d.ts +26 -17
- package/typography/Typography.d.ts +2 -2
- package/typography/Typography.js +15 -123
- package/typography/Typography.stories.tsx +1 -1
- package/typography/types.d.ts +1 -1
- package/useTheme.d.ts +1135 -1
- package/useTheme.js +2 -9
- package/useTranslatedLabels.d.ts +84 -1
- package/useTranslatedLabels.js +1 -7
- package/utils/BaseTypography.d.ts +21 -0
- package/utils/BaseTypography.js +94 -0
- package/utils/FocusLock.d.ts +13 -0
- package/utils/FocusLock.js +124 -0
- package/wizard/Wizard.js +16 -51
- package/wizard/Wizard.stories.tsx +20 -0
- package/wizard/Wizard.test.js +54 -81
- package/wizard/types.d.ts +8 -9
- package/card/ice-cream.jpg +0 -0
- package/number-input/NumberInputContext.d.ts +0 -4
- package/number-input/NumberInputContext.js +0 -19
- package/number-input/numberInputContextTypes.d.ts +0 -19
- package/resultsetTable/Icons.d.ts +0 -7
- package/resultsetTable/ResultsetTable.d.ts +0 -4
- package/slider/Slider.stories.tsx +0 -183
- package/table/Table.stories.jsx +0 -277
- package/tabs-nav/Tab.js +0 -128
- package/textarea/Textarea.stories.jsx +0 -157
- /package/{resultsetTable → action-icon}/types.js +0 -0
- /package/{tabs-nav → container}/types.js +0 -0
- /package/{number-input/numberInputContextTypes.js → grid/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",
|
|
@@ -33,6 +36,16 @@ c-10.663,0-17.467,1.853-20.417,5.568c-2.949,3.711-4.428,10.23-4.428,19.558v31.11
|
|
|
33
36
|
</svg>
|
|
34
37
|
);
|
|
35
38
|
|
|
39
|
+
const TitleComponent = () => {
|
|
40
|
+
return <DxcSidenav.Title>Dxc technology</DxcSidenav.Title>;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const opinionatedTheme = {
|
|
44
|
+
sidenav: {
|
|
45
|
+
baseColor: "#f2f2f2",
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
36
49
|
export const Chromatic = () => (
|
|
37
50
|
<>
|
|
38
51
|
<ExampleContainer>
|
|
@@ -101,16 +114,51 @@ export const Chromatic = () => (
|
|
|
101
114
|
</DxcSidenav.Section>
|
|
102
115
|
</DxcSidenav>
|
|
103
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>
|
|
104
152
|
</>
|
|
105
153
|
);
|
|
106
154
|
|
|
107
|
-
const
|
|
155
|
+
const CollapsedGroupSidenav = () => (
|
|
108
156
|
<>
|
|
109
157
|
<ExampleContainer>
|
|
110
|
-
<Title title="
|
|
158
|
+
<Title title="Collapsed group with a selected link" theme="light" level={4} />
|
|
111
159
|
<DxcSidenav title={<DxcSidenav.Title>Dxc technology</DxcSidenav.Title>}>
|
|
112
160
|
<DxcSidenav.Section>
|
|
113
|
-
<DxcSidenav.Group collapsable={true} title="
|
|
161
|
+
<DxcSidenav.Group collapsable={true} title="Collapsed Group" icon={iconSVG}>
|
|
114
162
|
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
115
163
|
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
116
164
|
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
@@ -118,11 +166,11 @@ const CollapsedGroup = () => (
|
|
|
118
166
|
</DxcSidenav.Group>
|
|
119
167
|
</DxcSidenav.Section>
|
|
120
168
|
<DxcSidenav.Section>
|
|
121
|
-
<DxcSidenav.Group collapsable={true} title="
|
|
122
|
-
<DxcSidenav.Link selected>Group Link</DxcSidenav.Link>
|
|
169
|
+
<DxcSidenav.Group collapsable={true} title="Collapsed Group">
|
|
123
170
|
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
171
|
+
<DxcSidenav.Link selected>Group Link</DxcSidenav.Link>
|
|
124
172
|
</DxcSidenav.Group>
|
|
125
|
-
<DxcSidenav.Group collapsable={
|
|
173
|
+
<DxcSidenav.Group collapsable={true} title="Section Group">
|
|
126
174
|
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
127
175
|
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
128
176
|
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
@@ -133,14 +181,14 @@ const CollapsedGroup = () => (
|
|
|
133
181
|
</>
|
|
134
182
|
);
|
|
135
183
|
|
|
136
|
-
const
|
|
184
|
+
const HoveredGroupSidenav = () => (
|
|
137
185
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
138
|
-
<Title title="
|
|
186
|
+
<Title title="Hover state for groups (selected and not)" theme="light" level={4} />
|
|
139
187
|
<DxcSidenav title={<DxcSidenav.Title>Dxc technology</DxcSidenav.Title>}>
|
|
140
188
|
<DxcSidenav.Section>
|
|
141
189
|
<DxcSidenav.Link>Single Link</DxcSidenav.Link>
|
|
142
190
|
<DxcSidenav.Link>Single Link</DxcSidenav.Link>
|
|
143
|
-
<DxcSidenav.Group collapsable={true} title="
|
|
191
|
+
<DxcSidenav.Group collapsable={true} title="Collapsed Group">
|
|
144
192
|
<DxcSidenav.Link selected>Group Link</DxcSidenav.Link>
|
|
145
193
|
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
146
194
|
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
@@ -154,36 +202,81 @@ const HoverSidenav = () => (
|
|
|
154
202
|
</DxcSidenav.Group>
|
|
155
203
|
<DxcSidenav.Link>Single Link</DxcSidenav.Link>
|
|
156
204
|
<DxcSidenav.Link>Single Link</DxcSidenav.Link>
|
|
157
|
-
<DxcSidenav.Group collapsable={true} title="
|
|
205
|
+
<DxcSidenav.Group collapsable={true} title="Collapsed Group">
|
|
206
|
+
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
207
|
+
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
208
|
+
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
209
|
+
</DxcSidenav.Group>
|
|
210
|
+
<DxcSidenav.Group collapsable={true} title="Collapsed Group">
|
|
158
211
|
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
159
212
|
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
160
213
|
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
161
214
|
</DxcSidenav.Group>
|
|
215
|
+
</DxcSidenav.Section>
|
|
216
|
+
</DxcSidenav>
|
|
217
|
+
</ExampleContainer>
|
|
218
|
+
);
|
|
162
219
|
|
|
163
|
-
|
|
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>
|
|
164
241
|
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
165
242
|
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
166
243
|
<DxcSidenav.Link>Group Link</DxcSidenav.Link>
|
|
167
244
|
</DxcSidenav.Group>
|
|
168
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>
|
|
169
254
|
</DxcSidenav>
|
|
170
255
|
</ExampleContainer>
|
|
171
256
|
);
|
|
172
257
|
|
|
173
|
-
export const
|
|
174
|
-
|
|
258
|
+
export const CollapsableGroup = CollapsedGroupSidenav.bind({});
|
|
259
|
+
CollapsableGroup.play = async ({ canvasElement }) => {
|
|
175
260
|
const canvas = within(canvasElement);
|
|
176
|
-
const collapsableGroups = canvas.getAllByText("
|
|
261
|
+
const collapsableGroups = canvas.getAllByText("Collapsed Group");
|
|
177
262
|
collapsableGroups.forEach((group) => {
|
|
178
263
|
userEvent.click(group);
|
|
179
264
|
});
|
|
180
265
|
};
|
|
181
266
|
|
|
182
|
-
export const
|
|
183
|
-
|
|
267
|
+
export const CollapsedHoverGroup = HoveredGroupSidenav.bind({});
|
|
268
|
+
CollapsedHoverGroup.play = async ({ canvasElement }) => {
|
|
184
269
|
const canvas = within(canvasElement);
|
|
185
|
-
const collapsableGroups = canvas.getAllByText("
|
|
270
|
+
const collapsableGroups = canvas.getAllByText("Collapsed Group");
|
|
186
271
|
collapsableGroups.forEach((group) => {
|
|
187
272
|
userEvent.click(group);
|
|
188
273
|
});
|
|
274
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
189
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/Sidenav.test.js
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _react = _interopRequireDefault(require("react"));
|
|
6
|
-
|
|
7
5
|
var _react2 = require("@testing-library/react");
|
|
8
|
-
|
|
9
6
|
var _Sidenav = _interopRequireDefault(require("./Sidenav.tsx"));
|
|
10
|
-
|
|
11
7
|
describe("Sidenav component tests", function () {
|
|
12
8
|
test("Sidenav renders anchors and Section correctly", function () {
|
|
13
9
|
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Sidenav["default"], null, /*#__PURE__*/_react["default"].createElement(_Sidenav["default"].Section, null, /*#__PURE__*/_react["default"].createElement("p", null, "nav-content-test"), /*#__PURE__*/_react["default"].createElement(_Sidenav["default"].Link, {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
href: "#"
|
|
11
|
+
}, "Link")))),
|
|
12
|
+
getByText = _render.getByText;
|
|
18
13
|
expect(getByText("nav-content-test")).toBeTruthy();
|
|
19
14
|
var link = getByText("Link");
|
|
20
15
|
expect(link.closest("a").getAttribute("href")).toBe("#");
|
|
@@ -36,9 +31,7 @@ describe("Sidenav component tests", function () {
|
|
|
36
31
|
}, "Lorem ipsum")))));
|
|
37
32
|
expect(sidenav.getByText("Collapsable")).toBeTruthy();
|
|
38
33
|
expect(sidenav.getAllByRole("button")[0].getAttribute("aria-expanded")).toBe("true");
|
|
39
|
-
|
|
40
34
|
_react2.fireEvent.click(sidenav.getByText("Collapsable"));
|
|
41
|
-
|
|
42
35
|
expect(sidenav.getAllByRole("button")[0].getAttribute("aria-expanded")).toBe("false");
|
|
43
36
|
});
|
|
44
37
|
});
|
package/sidenav/types.d.ts
CHANGED
|
@@ -1,50 +1,37 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
/**
|
|
9
|
-
* The area assigned to render the sidenav title. It is highly recommended to use the sidenav title.
|
|
10
|
-
*/
|
|
11
|
-
title?: React.ReactNode;
|
|
12
|
-
};
|
|
13
|
-
export declare type SidenavTitlePropsType = {
|
|
2
|
+
type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
|
|
3
|
+
export type SidenavTitlePropsType = {
|
|
14
4
|
/**
|
|
15
5
|
* The area inside the sidenav title. This area can be used to render custom content.
|
|
16
6
|
*/
|
|
17
7
|
children: React.ReactNode;
|
|
18
8
|
};
|
|
19
|
-
export
|
|
9
|
+
export type SidenavSectionPropsType = {
|
|
20
10
|
/**
|
|
21
11
|
* The area inside the sidenav section. This area can be used to render sidenav groups, links and custom content.
|
|
22
12
|
*/
|
|
23
13
|
children: React.ReactNode;
|
|
24
14
|
};
|
|
25
|
-
export
|
|
26
|
-
/**
|
|
27
|
-
* The area inside the sidenav group. This area can be used to render sidenav links.
|
|
28
|
-
*/
|
|
29
|
-
children: React.ReactNode;
|
|
15
|
+
export type SidenavGroupPropsType = {
|
|
30
16
|
/**
|
|
31
17
|
* The title of the sidenav group.
|
|
32
18
|
*/
|
|
33
19
|
title?: string;
|
|
34
20
|
/**
|
|
35
|
-
* If true the sidenav group
|
|
21
|
+
* If true, the sidenav group will be a button that will allow you to collapse the links contained within it.
|
|
22
|
+
* In addition, if it's collapsed and contains the currently selected link, the group title will also be marked as selected.
|
|
36
23
|
*/
|
|
37
24
|
collapsable?: boolean;
|
|
38
25
|
/**
|
|
39
26
|
* The icon to be displayed next to the title of the group.
|
|
40
27
|
*/
|
|
41
28
|
icon?: string | SVG;
|
|
42
|
-
};
|
|
43
|
-
export declare type SidenavLinkPropsType = {
|
|
44
29
|
/**
|
|
45
|
-
*
|
|
30
|
+
* The area inside the sidenav group. This area can be used to render sidenav links.
|
|
46
31
|
*/
|
|
47
|
-
|
|
32
|
+
children: React.ReactNode;
|
|
33
|
+
};
|
|
34
|
+
export type SidenavLinkPropsType = {
|
|
48
35
|
/**
|
|
49
36
|
* Page to be opened when the user clicks on the link.
|
|
50
37
|
*/
|
|
@@ -58,16 +45,32 @@ export declare type SidenavLinkPropsType = {
|
|
|
58
45
|
*/
|
|
59
46
|
icon?: string | SVG;
|
|
60
47
|
/**
|
|
61
|
-
* If true, the link will be marked as selected.
|
|
48
|
+
* If true, the link will be marked as selected. Moreover, in that same case,
|
|
49
|
+
* if it is contained within a collapsed group, and consequently, the currently selected link is not visible,
|
|
50
|
+
* the group title will appear as selected too.
|
|
62
51
|
*/
|
|
63
52
|
selected?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* This function will be called when the user clicks the link and the event will be passed to this function.
|
|
55
|
+
*/
|
|
56
|
+
onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void;
|
|
64
57
|
/**
|
|
65
58
|
* The area inside the sidenav link.
|
|
66
59
|
*/
|
|
67
|
-
children:
|
|
60
|
+
children: React.ReactNode;
|
|
61
|
+
/**
|
|
62
|
+
* Value of the tabindex.
|
|
63
|
+
*/
|
|
64
|
+
tabIndex?: number;
|
|
65
|
+
};
|
|
66
|
+
type Props = {
|
|
67
|
+
/**
|
|
68
|
+
* The area assigned to render the sidenav title. It is highly recommended to use the sidenav title.
|
|
69
|
+
*/
|
|
70
|
+
title?: React.ReactNode;
|
|
68
71
|
/**
|
|
69
|
-
* This
|
|
72
|
+
* The area inside the sidenav. This area can be used to render the content inside the sidenav.
|
|
70
73
|
*/
|
|
71
|
-
|
|
74
|
+
children: React.ReactNode;
|
|
72
75
|
};
|
|
73
|
-
export default
|
|
76
|
+
export default Props;
|