@dxc-technology/halstack-react 0.0.0-d3554d7 → 0.0.0-d3ac293
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 +1336 -0
- package/HalstackContext.js +335 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +118 -126
- package/accordion/Accordion.stories.tsx +115 -27
- package/accordion/Accordion.test.js +26 -12
- package/accordion/types.d.ts +9 -4
- package/accordion-group/AccordionGroup.d.ts +1 -1
- package/accordion-group/AccordionGroup.js +17 -38
- package/accordion-group/AccordionGroup.stories.tsx +28 -2
- package/accordion-group/AccordionGroup.test.js +31 -38
- package/accordion-group/types.d.ts +14 -3
- package/alert/Alert.js +7 -4
- package/alert/Alert.stories.tsx +28 -0
- package/alert/Alert.test.js +1 -1
- package/badge/Badge.d.ts +1 -1
- package/badge/Badge.js +5 -3
- package/badge/types.d.ts +1 -0
- package/bleed/Bleed.js +1 -34
- package/bleed/Bleed.stories.tsx +94 -95
- package/bleed/types.d.ts +25 -1
- package/box/Box.js +25 -37
- package/box/Box.stories.tsx +15 -0
- package/box/Box.test.js +1 -1
- package/box/types.d.ts +1 -0
- package/bulleted-list/BulletedList.d.ts +7 -0
- package/bulleted-list/BulletedList.js +123 -0
- package/bulleted-list/BulletedList.stories.tsx +200 -0
- package/bulleted-list/types.d.ts +11 -0
- package/button/Button.js +52 -69
- package/button/Button.stories.tsx +159 -8
- package/button/Button.test.js +1 -1
- package/button/types.d.ts +7 -7
- package/card/Card.js +25 -28
- package/card/Card.test.js +1 -1
- package/card/types.d.ts +1 -0
- package/checkbox/Checkbox.d.ts +2 -2
- package/checkbox/Checkbox.js +107 -110
- package/checkbox/Checkbox.stories.tsx +198 -130
- package/checkbox/Checkbox.test.js +101 -11
- package/checkbox/types.d.ts +13 -5
- package/chip/Chip.js +18 -24
- package/chip/Chip.stories.tsx +96 -9
- package/chip/Chip.test.js +3 -5
- package/chip/types.d.ts +1 -1
- package/common/utils.d.ts +1 -0
- package/common/utils.js +4 -4
- package/common/variables.d.ts +1625 -0
- package/common/variables.js +483 -352
- package/date-input/Calendar.d.ts +4 -0
- package/date-input/Calendar.js +258 -0
- package/date-input/DateInput.js +169 -258
- package/date-input/DateInput.stories.tsx +199 -33
- package/date-input/DateInput.test.js +521 -155
- 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 +67 -9
- package/dialog/Dialog.js +76 -93
- package/dialog/Dialog.stories.tsx +230 -123
- package/dialog/Dialog.test.js +334 -5
- package/dialog/types.d.ts +3 -2
- package/dropdown/Dropdown.d.ts +1 -1
- package/dropdown/Dropdown.js +246 -253
- package/dropdown/Dropdown.stories.tsx +245 -56
- package/dropdown/Dropdown.test.js +507 -110
- package/dropdown/DropdownMenu.d.ts +4 -0
- package/dropdown/DropdownMenu.js +70 -0
- package/dropdown/DropdownMenuItem.d.ts +4 -0
- package/dropdown/DropdownMenuItem.js +81 -0
- package/dropdown/types.d.ts +25 -5
- package/file-input/FileInput.d.ts +2 -2
- package/file-input/FileInput.js +181 -223
- 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 +44 -66
- package/file-input/types.d.ts +17 -0
- package/flex/Flex.d.ts +4 -0
- package/flex/Flex.js +69 -0
- package/flex/Flex.stories.tsx +103 -0
- package/flex/types.d.ts +32 -0
- package/footer/Footer.js +16 -89
- package/footer/Footer.stories.tsx +99 -1
- package/footer/Footer.test.js +14 -26
- package/footer/Icons.js +1 -1
- package/footer/types.d.ts +2 -1
- package/header/Header.js +108 -129
- package/header/Header.stories.tsx +189 -36
- package/header/Header.test.js +20 -4
- package/header/Icons.js +2 -2
- package/header/types.d.ts +3 -2
- package/heading/Heading.js +1 -1
- package/heading/Heading.test.js +1 -1
- package/inset/Inset.js +1 -34
- package/inset/Inset.stories.tsx +36 -36
- package/inset/types.d.ts +25 -1
- package/layout/ApplicationLayout.d.ts +16 -6
- package/layout/ApplicationLayout.js +72 -132
- package/layout/ApplicationLayout.stories.tsx +84 -93
- package/layout/Icons.d.ts +5 -0
- package/layout/Icons.js +13 -2
- package/layout/SidenavContext.d.ts +5 -0
- package/layout/SidenavContext.js +19 -0
- package/layout/types.d.ts +18 -33
- package/link/Link.d.ts +3 -2
- package/link/Link.js +59 -76
- package/link/Link.stories.tsx +155 -53
- package/link/Link.test.js +9 -19
- package/link/types.d.ts +7 -23
- package/main.d.ts +8 -10
- package/main.js +46 -56
- package/nav-tabs/NavTabs.d.ts +8 -0
- package/nav-tabs/NavTabs.js +125 -0
- package/nav-tabs/NavTabs.stories.tsx +260 -0
- package/nav-tabs/NavTabs.test.js +82 -0
- package/nav-tabs/Tab.d.ts +4 -0
- package/nav-tabs/Tab.js +150 -0
- package/nav-tabs/types.d.ts +53 -0
- package/number-input/NumberInput.js +11 -18
- package/number-input/NumberInput.stories.tsx +5 -5
- package/number-input/NumberInput.test.js +46 -12
- package/number-input/types.d.ts +17 -10
- package/package.json +20 -23
- package/paginator/Icons.d.ts +5 -0
- package/paginator/Icons.js +16 -28
- package/paginator/Paginator.js +19 -46
- package/paginator/Paginator.stories.tsx +24 -0
- package/paginator/Paginator.test.js +78 -39
- package/paragraph/Paragraph.d.ts +6 -0
- package/paragraph/Paragraph.js +38 -0
- package/paragraph/Paragraph.stories.tsx +44 -0
- package/password-input/PasswordInput.js +7 -4
- package/password-input/PasswordInput.test.js +17 -19
- package/password-input/types.d.ts +14 -11
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +61 -55
- package/progress-bar/ProgressBar.stories.jsx +47 -12
- package/progress-bar/ProgressBar.test.js +68 -23
- package/progress-bar/types.d.ts +3 -4
- package/quick-nav/QuickNav.d.ts +4 -0
- package/quick-nav/QuickNav.js +117 -0
- package/quick-nav/QuickNav.stories.tsx +356 -0
- package/quick-nav/types.d.ts +21 -0
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +43 -28
- package/radio-group/RadioGroup.js +32 -28
- package/radio-group/RadioGroup.stories.tsx +135 -17
- package/radio-group/RadioGroup.test.js +145 -117
- package/radio-group/types.d.ts +79 -2
- 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 +61 -42
- package/resultsetTable/types.d.ts +2 -2
- package/select/Icons.d.ts +10 -0
- package/select/Icons.js +93 -0
- package/select/Listbox.d.ts +4 -0
- package/select/Listbox.js +169 -0
- package/select/Option.d.ts +4 -0
- package/select/Option.js +97 -0
- package/select/Select.js +179 -384
- package/select/Select.stories.tsx +531 -142
- package/select/Select.test.js +652 -324
- package/select/types.d.ts +53 -13
- package/sidenav/Sidenav.d.ts +6 -5
- package/sidenav/Sidenav.js +183 -53
- package/sidenav/Sidenav.stories.tsx +249 -149
- package/sidenav/Sidenav.test.js +25 -37
- package/sidenav/types.d.ts +50 -27
- package/slider/Slider.d.ts +2 -2
- package/slider/Slider.js +124 -98
- package/slider/Slider.stories.tsx +72 -9
- package/slider/Slider.test.js +143 -22
- package/slider/types.d.ts +10 -2
- package/spinner/Spinner.js +4 -4
- package/spinner/Spinner.stories.jsx +27 -1
- package/spinner/Spinner.test.js +1 -1
- package/switch/Switch.d.ts +2 -2
- package/switch/Switch.js +152 -69
- package/switch/Switch.stories.tsx +53 -42
- package/switch/Switch.test.js +156 -4
- package/switch/types.d.ts +12 -4
- package/table/Table.js +3 -3
- package/table/Table.stories.jsx +80 -1
- package/table/Table.test.js +2 -2
- package/tabs/Tab.d.ts +4 -0
- package/tabs/Tab.js +133 -0
- package/tabs/Tabs.d.ts +1 -1
- package/tabs/Tabs.js +363 -109
- package/tabs/Tabs.stories.tsx +119 -13
- package/tabs/Tabs.test.js +241 -14
- package/tabs/types.d.ts +19 -5
- package/tag/Tag.js +17 -22
- package/tag/Tag.stories.tsx +25 -8
- package/tag/Tag.test.js +1 -1
- package/tag/types.d.ts +1 -1
- package/text-input/Icons.d.ts +8 -0
- package/text-input/Icons.js +60 -0
- package/text-input/Suggestion.d.ts +4 -0
- package/text-input/Suggestion.js +84 -0
- package/text-input/Suggestions.d.ts +4 -0
- package/text-input/Suggestions.js +134 -0
- package/text-input/TextInput.js +221 -344
- package/text-input/TextInput.stories.tsx +290 -195
- package/text-input/TextInput.test.js +763 -731
- package/text-input/types.d.ts +50 -12
- package/textarea/Textarea.js +17 -26
- package/textarea/Textarea.stories.jsx +65 -6
- package/textarea/Textarea.test.js +38 -37
- package/textarea/types.d.ts +18 -11
- package/toggle-group/ToggleGroup.d.ts +1 -1
- package/toggle-group/ToggleGroup.js +6 -5
- package/toggle-group/ToggleGroup.stories.tsx +46 -4
- package/toggle-group/ToggleGroup.test.js +36 -5
- package/toggle-group/types.d.ts +9 -1
- package/typography/Typography.d.ts +4 -0
- package/typography/Typography.js +32 -0
- package/typography/Typography.stories.tsx +198 -0
- package/typography/types.d.ts +18 -0
- package/typography/types.js +5 -0
- package/useTheme.d.ts +1234 -1
- package/useTheme.js +3 -3
- package/useTranslatedLabels.d.ts +85 -0
- package/useTranslatedLabels.js +20 -0
- package/utils/BaseTypography.d.ts +21 -0
- package/utils/BaseTypography.js +108 -0
- package/utils/FocusLock.d.ts +13 -0
- package/utils/FocusLock.js +139 -0
- package/wizard/Wizard.d.ts +1 -1
- package/wizard/Wizard.js +59 -55
- package/wizard/Wizard.stories.tsx +48 -19
- package/wizard/Wizard.test.js +37 -24
- package/wizard/types.d.ts +10 -5
- package/ThemeContext.d.ts +0 -10
- package/ThemeContext.js +0 -243
- package/common/RequiredComponent.js +0 -32
- package/list/List.d.ts +0 -4
- package/list/List.js +0 -47
- package/list/List.stories.tsx +0 -95
- package/list/types.d.ts +0 -7
- package/radio/Radio.d.ts +0 -4
- package/radio/Radio.js +0 -174
- package/radio/Radio.stories.tsx +0 -192
- package/radio/Radio.test.js +0 -71
- package/radio/types.d.ts +0 -54
- package/row/Row.d.ts +0 -3
- package/row/Row.js +0 -127
- package/row/Row.stories.tsx +0 -237
- package/row/types.d.ts +0 -10
- package/stack/Stack.d.ts +0 -3
- package/stack/Stack.js +0 -97
- package/stack/Stack.stories.tsx +0 -164
- package/stack/types.d.ts +0 -9
- package/text/Text.d.ts +0 -7
- package/text/Text.js +0 -30
- package/text/Text.stories.tsx +0 -19
- /package/{list → bulleted-list}/types.js +0 -0
- /package/{radio → flex}/types.js +0 -0
- /package/{row → nav-tabs}/types.js +0 -0
- /package/{stack → quick-nav}/types.js +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
|
-
import { userEvent, within, waitFor } from "@storybook/testing-library";
|
|
4
|
-
import { fireEvent } from "@testing-library/react";
|
|
5
|
-
|
|
2
|
+
import { userEvent, within } from "@storybook/testing-library";
|
|
6
3
|
import Title from "../../.storybook/components/Title";
|
|
7
4
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
8
|
-
|
|
9
5
|
import DxcSelect from "./Select";
|
|
6
|
+
import Listbox from "./Listbox";
|
|
7
|
+
import { ThemeProvider } from "styled-components";
|
|
8
|
+
import useTheme from "../useTheme";
|
|
9
|
+
import { HalstackProvider } from "../HalstackContext";
|
|
10
10
|
|
|
11
11
|
export default {
|
|
12
12
|
title: "Select",
|
|
@@ -14,12 +14,14 @@ export default {
|
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
const one_option = [{ label: "Option 01", value: "1" }];
|
|
17
|
+
|
|
17
18
|
const single_options = [
|
|
18
19
|
{ label: "Option 01", value: "1" },
|
|
19
20
|
{ label: "Option 02", value: "2" },
|
|
20
21
|
{ label: "Option 03", value: "3" },
|
|
21
22
|
{ label: "Option 04", value: "4" },
|
|
22
23
|
];
|
|
24
|
+
|
|
23
25
|
const group_options = [
|
|
24
26
|
{
|
|
25
27
|
label: "Group 001",
|
|
@@ -62,6 +64,7 @@ const group_options = [
|
|
|
62
64
|
],
|
|
63
65
|
},
|
|
64
66
|
];
|
|
67
|
+
|
|
65
68
|
const icon_options_grouped = [
|
|
66
69
|
{
|
|
67
70
|
label: "Group 001",
|
|
@@ -125,6 +128,7 @@ const icon_options_grouped = [
|
|
|
125
128
|
],
|
|
126
129
|
},
|
|
127
130
|
];
|
|
131
|
+
|
|
128
132
|
const icon_options = [
|
|
129
133
|
{
|
|
130
134
|
label: "3G Mobile",
|
|
@@ -173,6 +177,7 @@ const icon_options = [
|
|
|
173
177
|
),
|
|
174
178
|
},
|
|
175
179
|
];
|
|
180
|
+
|
|
176
181
|
const url_options = [
|
|
177
182
|
{
|
|
178
183
|
label: "Social Media",
|
|
@@ -190,7 +195,29 @@ const url_options = [
|
|
|
190
195
|
{
|
|
191
196
|
label: "Facebook",
|
|
192
197
|
value: "facebook",
|
|
193
|
-
icon:
|
|
198
|
+
icon: (
|
|
199
|
+
<svg
|
|
200
|
+
version="1.1"
|
|
201
|
+
id="Capa_1"
|
|
202
|
+
x="0px"
|
|
203
|
+
y="0px"
|
|
204
|
+
width="438.536px"
|
|
205
|
+
height="438.536px"
|
|
206
|
+
viewBox="0 0 438.536 438.536"
|
|
207
|
+
fill="#4267B2"
|
|
208
|
+
>
|
|
209
|
+
<g>
|
|
210
|
+
<path
|
|
211
|
+
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
|
|
212
|
+
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
|
|
213
|
+
h274.084c22.648,0,42.018-8.042,58.095-24.126c16.084-16.084,24.126-35.454,24.126-58.102V82.225
|
|
214
|
+
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
|
|
215
|
+
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
|
|
216
|
+
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"
|
|
217
|
+
/>
|
|
218
|
+
</g>
|
|
219
|
+
</svg>
|
|
220
|
+
),
|
|
194
221
|
},
|
|
195
222
|
{
|
|
196
223
|
label: "Pinterest",
|
|
@@ -220,13 +247,22 @@ const url_options = [
|
|
|
220
247
|
],
|
|
221
248
|
},
|
|
222
249
|
];
|
|
250
|
+
|
|
223
251
|
const optionsWithEllipsisMedium = [
|
|
224
252
|
{ label: "Optiond1234567890123456789012345678901234", value: "1" },
|
|
225
253
|
{ label: "Optiond12345678901234567890123456789012345", value: "2" },
|
|
226
254
|
{ label: "Option 031111111111111111111111111111222", value: "3" },
|
|
227
|
-
{ label: "Option 03111111111111111111111111111222", value: "4" },
|
|
228
255
|
];
|
|
229
256
|
|
|
257
|
+
const opinionatedTheme = {
|
|
258
|
+
select: {
|
|
259
|
+
selectedOptionBackgroundColor: "#e6f4ff",
|
|
260
|
+
fontColor: "#000000",
|
|
261
|
+
optionFontColor: "#000000",
|
|
262
|
+
hoverBorderColor: "#a46ede",
|
|
263
|
+
},
|
|
264
|
+
};
|
|
265
|
+
|
|
230
266
|
const Select = () => (
|
|
231
267
|
<>
|
|
232
268
|
<Title title="States" theme="light" level={2} />
|
|
@@ -244,7 +280,7 @@ const Select = () => (
|
|
|
244
280
|
</ExampleContainer>
|
|
245
281
|
<ExampleContainer>
|
|
246
282
|
<Title title="Disabled with value" theme="light" level={4} />
|
|
247
|
-
<DxcSelect label="Disabled with value" disabled options={single_options}
|
|
283
|
+
<DxcSelect label="Disabled with value" disabled options={single_options} defaultValue="1" />
|
|
248
284
|
</ExampleContainer>
|
|
249
285
|
<ExampleContainer>
|
|
250
286
|
<Title title="Error" theme="light" level={4} />
|
|
@@ -274,19 +310,19 @@ const Select = () => (
|
|
|
274
310
|
<Title title="Variants" theme="light" level={2} />
|
|
275
311
|
<ExampleContainer>
|
|
276
312
|
<Title title="Simple selection" theme="light" level={4} />
|
|
277
|
-
<DxcSelect label="Simple selection" searchable options={single_options}
|
|
313
|
+
<DxcSelect label="Simple selection" searchable options={single_options} defaultValue="2" />
|
|
278
314
|
</ExampleContainer>
|
|
279
315
|
<ExampleContainer>
|
|
280
316
|
<Title title="Multiple selection" theme="light" level={4} />
|
|
281
|
-
<DxcSelect label="Multiple select" searchable options={single_options} multiple
|
|
317
|
+
<DxcSelect label="Multiple select" searchable options={single_options} multiple defaultValue={["1", "2"]} />
|
|
282
318
|
</ExampleContainer>
|
|
283
319
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
284
320
|
<Title title="Multiple clear hovered" theme="light" level={4} />
|
|
285
|
-
<DxcSelect label="Multiple select" options={single_options} multiple
|
|
321
|
+
<DxcSelect label="Multiple select" options={single_options} multiple defaultValue={["1", "2"]} />
|
|
286
322
|
</ExampleContainer>
|
|
287
323
|
<ExampleContainer pseudoState="pseudo-active">
|
|
288
324
|
<Title title="Multiple clear actived" theme="light" level={4} />
|
|
289
|
-
<DxcSelect label="Multiple select" options={single_options} multiple
|
|
325
|
+
<DxcSelect label="Multiple select" options={single_options} multiple defaultValue={["1", "2"]} />
|
|
290
326
|
</ExampleContainer>
|
|
291
327
|
<Title title="Sizes" theme="light" level={2} />
|
|
292
328
|
<ExampleContainer>
|
|
@@ -337,41 +373,407 @@ const Select = () => (
|
|
|
337
373
|
<ExampleContainer expanded>
|
|
338
374
|
<Title title="Ellipsis" theme="light" level={2} />
|
|
339
375
|
<Title title="Multiple selection with ellipsis" theme="light" level={4} />
|
|
340
|
-
<DxcSelect label="Label" options={single_options} multiple
|
|
376
|
+
<DxcSelect label="Label" options={single_options} multiple defaultValue={["1", "2", "3", "4"]} />
|
|
341
377
|
<Title title="Value with ellipsis" theme="light" level={4} />
|
|
342
|
-
<DxcSelect label="Label" options={optionsWithEllipsisMedium}
|
|
343
|
-
<Title title="
|
|
378
|
+
<DxcSelect label="Label" options={optionsWithEllipsisMedium} defaultValue="1" />
|
|
379
|
+
<Title title="Options with ellipsis" theme="light" level={4} />
|
|
344
380
|
<DxcSelect
|
|
345
381
|
label="Label"
|
|
346
382
|
placeholder="Choose an option"
|
|
347
|
-
|
|
383
|
+
defaultValue="1"
|
|
348
384
|
options={optionsWithEllipsisMedium}
|
|
349
|
-
|
|
385
|
+
margin={{ top: "xxlarge" }}
|
|
350
386
|
/>
|
|
351
387
|
</ExampleContainer>
|
|
388
|
+
<Title title="Opinionated theme" theme="light" level={2} />
|
|
389
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
390
|
+
<Title title="Hovered" theme="light" level={4} />
|
|
391
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
392
|
+
<DxcSelect label="Hovered" options={single_options} />
|
|
393
|
+
</HalstackProvider>
|
|
394
|
+
</ExampleContainer>
|
|
395
|
+
<ExampleContainer pseudoState="pseudo-focus-within">
|
|
396
|
+
<Title title="Focused" theme="light" level={4} />
|
|
397
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
398
|
+
<DxcSelect label="Focused" options={single_options} />
|
|
399
|
+
</HalstackProvider>
|
|
400
|
+
</ExampleContainer>
|
|
401
|
+
<ExampleContainer>
|
|
402
|
+
<Title title="Disabled" theme="light" level={4} />
|
|
403
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
404
|
+
<DxcSelect label="Disabled" placeholder="Placeholder" disabled options={single_options} />
|
|
405
|
+
</HalstackProvider>
|
|
406
|
+
</ExampleContainer>
|
|
407
|
+
<ExampleContainer>
|
|
408
|
+
<Title title="Disabled with value" theme="light" level={4} />
|
|
409
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
410
|
+
<DxcSelect label="Disabled with value" disabled options={single_options} defaultValue="1" />
|
|
411
|
+
</HalstackProvider>
|
|
412
|
+
</ExampleContainer>
|
|
413
|
+
<ExampleContainer>
|
|
414
|
+
<Title title="Error" theme="light" level={4} />
|
|
415
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
416
|
+
<DxcSelect
|
|
417
|
+
label="Label"
|
|
418
|
+
options={single_options}
|
|
419
|
+
error="Error message."
|
|
420
|
+
helperText="Helper text"
|
|
421
|
+
placeholder="Placeholder"
|
|
422
|
+
/>
|
|
423
|
+
<ExampleContainer>
|
|
424
|
+
<Title title="Multiple selection" theme="light" level={4} />
|
|
425
|
+
<DxcSelect label="Multiple select" searchable options={single_options} multiple defaultValue={["1", "2"]} />
|
|
426
|
+
</ExampleContainer>
|
|
427
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
428
|
+
<Title title="Multiple clear hovered" theme="light" level={4} />
|
|
429
|
+
<DxcSelect label="Multiple select" options={single_options} multiple defaultValue={["1", "2"]} />
|
|
430
|
+
</ExampleContainer>
|
|
431
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
432
|
+
<Title title="Multiple clear actived" theme="light" level={4} />
|
|
433
|
+
<DxcSelect label="Multiple select" options={single_options} multiple defaultValue={["1", "2"]} />
|
|
434
|
+
</ExampleContainer>
|
|
435
|
+
</HalstackProvider>
|
|
436
|
+
</ExampleContainer>
|
|
352
437
|
</>
|
|
353
438
|
);
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
const
|
|
357
|
-
|
|
439
|
+
|
|
440
|
+
const SelectListbox = () => {
|
|
441
|
+
const colorsTheme: any = useTheme();
|
|
442
|
+
|
|
443
|
+
return (
|
|
444
|
+
<>
|
|
445
|
+
<ThemeProvider theme={colorsTheme.select}>
|
|
446
|
+
<Title title="Listbox" theme="light" level={2} />
|
|
447
|
+
<ExampleContainer>
|
|
448
|
+
<Title
|
|
449
|
+
title="List dialog uses a Radix Popover to appear over elements with a certain z-index"
|
|
450
|
+
theme="light"
|
|
451
|
+
level={3}
|
|
452
|
+
/>
|
|
453
|
+
<div
|
|
454
|
+
style={{
|
|
455
|
+
position: "relative",
|
|
456
|
+
display: "flex",
|
|
457
|
+
flexDirection: "column",
|
|
458
|
+
gap: "20px",
|
|
459
|
+
height: "150px",
|
|
460
|
+
width: "min-content",
|
|
461
|
+
marginBottom: "100px",
|
|
462
|
+
padding: "20px",
|
|
463
|
+
border: "1px solid black",
|
|
464
|
+
borderRadius: "4px",
|
|
465
|
+
overflow: "auto",
|
|
466
|
+
zIndex: "1300",
|
|
467
|
+
}}
|
|
468
|
+
>
|
|
469
|
+
<DxcSelect label="Label" options={single_options} optional placeholder="Choose an option" />
|
|
470
|
+
<button style={{ zIndex: "1", width: "100px" }}>Submit</button>
|
|
471
|
+
</div>
|
|
472
|
+
</ExampleContainer>
|
|
473
|
+
<Title title="Listbox option states" theme="light" level={3} />
|
|
474
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
475
|
+
<Title title="Hovered option" theme="light" level={4} />
|
|
476
|
+
<Listbox
|
|
477
|
+
id="x"
|
|
478
|
+
currentValue=""
|
|
479
|
+
options={one_option}
|
|
480
|
+
visualFocusIndex={-1}
|
|
481
|
+
lastOptionIndex={0}
|
|
482
|
+
multiple={false}
|
|
483
|
+
optional={false}
|
|
484
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
485
|
+
searchable={false}
|
|
486
|
+
handleOptionOnClick={() => {}}
|
|
487
|
+
styles={{ width: 360 }}
|
|
488
|
+
/>
|
|
489
|
+
</ExampleContainer>
|
|
490
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
491
|
+
<Title title="Active option" theme="light" level={4} />
|
|
492
|
+
<Listbox
|
|
493
|
+
id="x"
|
|
494
|
+
currentValue=""
|
|
495
|
+
options={one_option}
|
|
496
|
+
visualFocusIndex={-1}
|
|
497
|
+
lastOptionIndex={0}
|
|
498
|
+
multiple={false}
|
|
499
|
+
optional={false}
|
|
500
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
501
|
+
searchable={false}
|
|
502
|
+
handleOptionOnClick={() => {}}
|
|
503
|
+
styles={{ width: 360 }}
|
|
504
|
+
/>
|
|
505
|
+
</ExampleContainer>
|
|
506
|
+
<ExampleContainer>
|
|
507
|
+
<Title title="Focused option" theme="light" level={4} />
|
|
508
|
+
<Listbox
|
|
509
|
+
id="x"
|
|
510
|
+
currentValue=""
|
|
511
|
+
options={one_option}
|
|
512
|
+
visualFocusIndex={0}
|
|
513
|
+
lastOptionIndex={0}
|
|
514
|
+
multiple={false}
|
|
515
|
+
optional={false}
|
|
516
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
517
|
+
searchable={false}
|
|
518
|
+
handleOptionOnClick={() => {}}
|
|
519
|
+
styles={{ width: 360 }}
|
|
520
|
+
/>
|
|
521
|
+
</ExampleContainer>
|
|
522
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
523
|
+
<Title title="Hovered selected option" theme="light" level={4} />
|
|
524
|
+
<Listbox
|
|
525
|
+
id="x"
|
|
526
|
+
currentValue="1"
|
|
527
|
+
options={single_options}
|
|
528
|
+
visualFocusIndex={-1}
|
|
529
|
+
lastOptionIndex={3}
|
|
530
|
+
multiple={false}
|
|
531
|
+
optional={false}
|
|
532
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
533
|
+
searchable={false}
|
|
534
|
+
handleOptionOnClick={() => {}}
|
|
535
|
+
styles={{ width: 360 }}
|
|
536
|
+
/>
|
|
537
|
+
</ExampleContainer>
|
|
538
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
539
|
+
<Title title="Active selected option" theme="light" level={4} />
|
|
540
|
+
<Listbox
|
|
541
|
+
id="x"
|
|
542
|
+
currentValue="2"
|
|
543
|
+
options={single_options}
|
|
544
|
+
visualFocusIndex={0}
|
|
545
|
+
lastOptionIndex={3}
|
|
546
|
+
multiple={false}
|
|
547
|
+
optional={false}
|
|
548
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
549
|
+
searchable={false}
|
|
550
|
+
handleOptionOnClick={() => {}}
|
|
551
|
+
styles={{ width: 360 }}
|
|
552
|
+
/>
|
|
553
|
+
</ExampleContainer>
|
|
554
|
+
<Title title="Listbox with icons" theme="light" level={3} />
|
|
555
|
+
<ExampleContainer>
|
|
556
|
+
<Title title="Icons (SVGs)" theme="light" level={4} />
|
|
557
|
+
<Listbox
|
|
558
|
+
id="x"
|
|
559
|
+
currentValue="3"
|
|
560
|
+
options={icon_options}
|
|
561
|
+
visualFocusIndex={-1}
|
|
562
|
+
lastOptionIndex={3}
|
|
563
|
+
multiple={false}
|
|
564
|
+
optional={false}
|
|
565
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
566
|
+
searchable={false}
|
|
567
|
+
handleOptionOnClick={() => {}}
|
|
568
|
+
styles={{ width: 360 }}
|
|
569
|
+
/>
|
|
570
|
+
</ExampleContainer>
|
|
571
|
+
<ExampleContainer>
|
|
572
|
+
<Title title="Icons (Images)" theme="light" level={4} />
|
|
573
|
+
<Listbox
|
|
574
|
+
id="x"
|
|
575
|
+
currentValue="facebook"
|
|
576
|
+
options={url_options}
|
|
577
|
+
visualFocusIndex={-1}
|
|
578
|
+
lastOptionIndex={6}
|
|
579
|
+
multiple={false}
|
|
580
|
+
optional={false}
|
|
581
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
582
|
+
searchable={false}
|
|
583
|
+
handleOptionOnClick={() => {}}
|
|
584
|
+
styles={{ width: 360 }}
|
|
585
|
+
/>
|
|
586
|
+
</ExampleContainer>
|
|
587
|
+
<ExampleContainer>
|
|
588
|
+
<Title title="Grouped icons (SVGs)" theme="light" level={4} />
|
|
589
|
+
<Listbox
|
|
590
|
+
id="x"
|
|
591
|
+
currentValue={["0", "3"]}
|
|
592
|
+
options={icon_options_grouped}
|
|
593
|
+
visualFocusIndex={-1}
|
|
594
|
+
lastOptionIndex={3}
|
|
595
|
+
multiple={false}
|
|
596
|
+
optional={false}
|
|
597
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
598
|
+
searchable={false}
|
|
599
|
+
handleOptionOnClick={() => {}}
|
|
600
|
+
styles={{ width: 360 }}
|
|
601
|
+
/>
|
|
602
|
+
</ExampleContainer>
|
|
603
|
+
<ExampleContainer>
|
|
604
|
+
<Title title="Grouped icons (Images)" theme="light" level={4} />
|
|
605
|
+
<Listbox
|
|
606
|
+
id="x"
|
|
607
|
+
currentValue={["facebook", "figma"]}
|
|
608
|
+
options={url_options}
|
|
609
|
+
visualFocusIndex={-1}
|
|
610
|
+
lastOptionIndex={6}
|
|
611
|
+
multiple={true}
|
|
612
|
+
optional={false}
|
|
613
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
614
|
+
searchable={false}
|
|
615
|
+
handleOptionOnClick={() => {}}
|
|
616
|
+
styles={{ width: 360 }}
|
|
617
|
+
/>
|
|
618
|
+
</ExampleContainer>
|
|
619
|
+
</ThemeProvider>
|
|
620
|
+
<ThemeProvider theme={colorsTheme.select}>
|
|
621
|
+
<Title title="Opinionated theme" theme="light" level={2} />
|
|
622
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
623
|
+
<Title title="Hovered option" theme="light" level={4} />
|
|
624
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
625
|
+
<Listbox
|
|
626
|
+
id="x"
|
|
627
|
+
currentValue=""
|
|
628
|
+
options={one_option}
|
|
629
|
+
visualFocusIndex={-1}
|
|
630
|
+
lastOptionIndex={0}
|
|
631
|
+
multiple={false}
|
|
632
|
+
optional={false}
|
|
633
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
634
|
+
searchable={false}
|
|
635
|
+
handleOptionOnClick={() => {}}
|
|
636
|
+
styles={{ width: 360 }}
|
|
637
|
+
/>
|
|
638
|
+
</HalstackProvider>
|
|
639
|
+
</ExampleContainer>
|
|
640
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
641
|
+
<Title title="Active option" theme="light" level={4} />{" "}
|
|
642
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
643
|
+
<Listbox
|
|
644
|
+
id="x"
|
|
645
|
+
currentValue=""
|
|
646
|
+
options={one_option}
|
|
647
|
+
visualFocusIndex={-1}
|
|
648
|
+
lastOptionIndex={0}
|
|
649
|
+
multiple={false}
|
|
650
|
+
optional={false}
|
|
651
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
652
|
+
searchable={false}
|
|
653
|
+
handleOptionOnClick={() => {}}
|
|
654
|
+
styles={{ width: 360 }}
|
|
655
|
+
/>
|
|
656
|
+
</HalstackProvider>
|
|
657
|
+
</ExampleContainer>
|
|
658
|
+
<ExampleContainer>
|
|
659
|
+
<Title title="Focused option" theme="light" level={4} />{" "}
|
|
660
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
661
|
+
<Listbox
|
|
662
|
+
id="x"
|
|
663
|
+
currentValue=""
|
|
664
|
+
options={one_option}
|
|
665
|
+
visualFocusIndex={0}
|
|
666
|
+
lastOptionIndex={0}
|
|
667
|
+
multiple={false}
|
|
668
|
+
optional={false}
|
|
669
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
670
|
+
searchable={false}
|
|
671
|
+
handleOptionOnClick={() => {}}
|
|
672
|
+
styles={{ width: 360 }}
|
|
673
|
+
/>
|
|
674
|
+
</HalstackProvider>
|
|
675
|
+
</ExampleContainer>
|
|
676
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
677
|
+
<Title title="Hovered selected option" theme="light" level={4} />{" "}
|
|
678
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
679
|
+
<Listbox
|
|
680
|
+
id="x"
|
|
681
|
+
currentValue="1"
|
|
682
|
+
options={single_options}
|
|
683
|
+
visualFocusIndex={-1}
|
|
684
|
+
lastOptionIndex={3}
|
|
685
|
+
multiple={false}
|
|
686
|
+
optional={false}
|
|
687
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
688
|
+
searchable={false}
|
|
689
|
+
handleOptionOnClick={() => {}}
|
|
690
|
+
styles={{ width: 360 }}
|
|
691
|
+
/>
|
|
692
|
+
</HalstackProvider>
|
|
693
|
+
</ExampleContainer>
|
|
694
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
695
|
+
<Title title="Active selected option" theme="light" level={4} />{" "}
|
|
696
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
697
|
+
<Listbox
|
|
698
|
+
id="x"
|
|
699
|
+
currentValue="2"
|
|
700
|
+
options={single_options}
|
|
701
|
+
visualFocusIndex={0}
|
|
702
|
+
lastOptionIndex={3}
|
|
703
|
+
multiple={false}
|
|
704
|
+
optional={false}
|
|
705
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
706
|
+
searchable={false}
|
|
707
|
+
handleOptionOnClick={() => {}}
|
|
708
|
+
styles={{ width: 360 }}
|
|
709
|
+
/>
|
|
710
|
+
</HalstackProvider>
|
|
711
|
+
</ExampleContainer>
|
|
712
|
+
<Title title="Listbox with icons" theme="light" level={3} />
|
|
713
|
+
<ExampleContainer>
|
|
714
|
+
<Title title="Icons (SVGs)" theme="light" level={4} />{" "}
|
|
715
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
716
|
+
<Listbox
|
|
717
|
+
id="x"
|
|
718
|
+
currentValue="3"
|
|
719
|
+
options={icon_options}
|
|
720
|
+
visualFocusIndex={-1}
|
|
721
|
+
lastOptionIndex={3}
|
|
722
|
+
multiple={false}
|
|
723
|
+
optional={false}
|
|
724
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
725
|
+
searchable={false}
|
|
726
|
+
handleOptionOnClick={() => {}}
|
|
727
|
+
styles={{ width: 360 }}
|
|
728
|
+
/>
|
|
729
|
+
</HalstackProvider>
|
|
730
|
+
</ExampleContainer>
|
|
731
|
+
</ThemeProvider>
|
|
732
|
+
</>
|
|
733
|
+
);
|
|
358
734
|
};
|
|
359
|
-
|
|
735
|
+
|
|
736
|
+
const SearchableSelect = () => (
|
|
360
737
|
<ExampleContainer expanded>
|
|
361
|
-
<Title title="
|
|
362
|
-
<DxcSelect label="Select
|
|
738
|
+
<Title title="Searchable select" theme="light" level={4} />
|
|
739
|
+
<DxcSelect label="Select Label" searchable options={single_options} placeholder="Choose an option" />
|
|
363
740
|
</ExampleContainer>
|
|
364
741
|
);
|
|
365
|
-
|
|
742
|
+
|
|
743
|
+
const SearchableSelectOpinionated = () => (
|
|
366
744
|
<ExampleContainer expanded>
|
|
367
745
|
<Title title="Searchable select" theme="light" level={4} />
|
|
368
|
-
<
|
|
746
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
747
|
+
<DxcSelect label="Select Label" searchable options={single_options} placeholder="Choose an option" />
|
|
748
|
+
</HalstackProvider>
|
|
369
749
|
</ExampleContainer>
|
|
370
750
|
);
|
|
371
|
-
|
|
751
|
+
|
|
752
|
+
const SearchValue = () => (
|
|
372
753
|
<ExampleContainer expanded>
|
|
373
754
|
<Title title="Searchable select with value" theme="light" level={4} />
|
|
374
|
-
<DxcSelect
|
|
755
|
+
<DxcSelect
|
|
756
|
+
label="Select Label"
|
|
757
|
+
searchable
|
|
758
|
+
defaultValue="1"
|
|
759
|
+
options={single_options}
|
|
760
|
+
placeholder="Choose an option"
|
|
761
|
+
/>
|
|
762
|
+
</ExampleContainer>
|
|
763
|
+
);
|
|
764
|
+
|
|
765
|
+
const SearchValueOpinionated = () => (
|
|
766
|
+
<ExampleContainer expanded>
|
|
767
|
+
<Title title="Searchable select with value" theme="light" level={4} />
|
|
768
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
769
|
+
<DxcSelect
|
|
770
|
+
label="Select Label"
|
|
771
|
+
searchable
|
|
772
|
+
defaultValue="1"
|
|
773
|
+
options={single_options}
|
|
774
|
+
placeholder="Choose an option"
|
|
775
|
+
/>
|
|
776
|
+
</HalstackProvider>
|
|
375
777
|
</ExampleContainer>
|
|
376
778
|
);
|
|
377
779
|
|
|
@@ -382,85 +784,73 @@ const MultipleSelect = () => (
|
|
|
382
784
|
<DxcSelect
|
|
383
785
|
label="Select label"
|
|
384
786
|
options={single_options}
|
|
385
|
-
|
|
787
|
+
defaultValue={["1", "4"]}
|
|
386
788
|
multiple
|
|
387
789
|
placeholder="Choose an option"
|
|
388
790
|
/>
|
|
389
791
|
</ExampleContainer>
|
|
390
792
|
</>
|
|
391
793
|
);
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
<Title title="Grouped options simple select" theme="light" level={4} />
|
|
395
|
-
<DxcSelect label="Label" options={group_options} value="9" placeholder="Choose an option" />
|
|
396
|
-
</ExampleContainer>
|
|
397
|
-
);
|
|
398
|
-
const MultipleGroupedOptionsSelect = () => (
|
|
399
|
-
<ExampleContainer expanded>
|
|
400
|
-
<Title title="Grouped options multiple select" theme="light" level={4} />
|
|
401
|
-
<DxcSelect label="Label" options={group_options} value={["0", "2"]} multiple placeholder="Choose an option" />
|
|
402
|
-
</ExampleContainer>
|
|
403
|
-
);
|
|
404
|
-
const RescaledIcons = () => (
|
|
794
|
+
|
|
795
|
+
const MultipleSelectOpinioated = () => (
|
|
405
796
|
<ExampleContainer expanded>
|
|
406
|
-
<Title title="
|
|
407
|
-
<
|
|
797
|
+
<Title title="Multiple select" theme="light" level={4} />
|
|
798
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
799
|
+
<DxcSelect
|
|
800
|
+
label="Select label"
|
|
801
|
+
options={single_options}
|
|
802
|
+
defaultValue={["1", "4"]}
|
|
803
|
+
multiple
|
|
804
|
+
placeholder="Choose an option"
|
|
805
|
+
/>
|
|
806
|
+
</HalstackProvider>
|
|
408
807
|
</ExampleContainer>
|
|
409
808
|
);
|
|
410
|
-
|
|
809
|
+
|
|
810
|
+
const DefaultGroupedOptionsSelect = () => (
|
|
411
811
|
<ExampleContainer expanded>
|
|
412
|
-
<Title title="
|
|
413
|
-
<DxcSelect label="Label" options={
|
|
812
|
+
<Title title="Grouped options simple select" theme="light" level={4} />
|
|
813
|
+
<DxcSelect label="Label" options={group_options} defaultValue="9" placeholder="Choose an option" />
|
|
414
814
|
</ExampleContainer>
|
|
415
815
|
);
|
|
416
|
-
|
|
816
|
+
|
|
817
|
+
const DefaultGroupedOptionsSelectOpinionated = () => (
|
|
417
818
|
<ExampleContainer expanded>
|
|
418
|
-
<Title title="
|
|
419
|
-
<
|
|
819
|
+
<Title title="Grouped options simple select" theme="light" level={4} />
|
|
820
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
821
|
+
<DxcSelect label="Label" options={group_options} defaultValue="9" placeholder="Choose an option" />
|
|
822
|
+
</HalstackProvider>
|
|
420
823
|
</ExampleContainer>
|
|
421
824
|
);
|
|
422
|
-
|
|
825
|
+
|
|
826
|
+
const MultipleGroupedOptionsSelect = () => (
|
|
423
827
|
<ExampleContainer expanded>
|
|
424
|
-
<Title title="
|
|
828
|
+
<Title title="Grouped options multiple select" theme="light" level={4} />
|
|
425
829
|
<DxcSelect
|
|
426
830
|
label="Label"
|
|
427
|
-
options={
|
|
831
|
+
options={group_options}
|
|
832
|
+
defaultValue={["0", "2"]}
|
|
428
833
|
multiple
|
|
429
|
-
value={["3", "2"]}
|
|
430
834
|
placeholder="Choose an option"
|
|
431
835
|
/>
|
|
432
836
|
</ExampleContainer>
|
|
433
837
|
);
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
<
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
<ExampleContainer pseudoState="pseudo-active" expanded>
|
|
448
|
-
<Title title="Actived Option" theme="light" level={4} />
|
|
449
|
-
<DxcSelect label="Actived" options={one_option} placeholder="Choose an option" />
|
|
450
|
-
</ExampleContainer>
|
|
451
|
-
);
|
|
452
|
-
const SelectedOptionHovered = () => (
|
|
453
|
-
<ExampleContainer pseudoState="pseudo-hover" expanded>
|
|
454
|
-
<Title title="Hovered Selected Option" theme="light" level={4} />
|
|
455
|
-
<DxcSelect label="Hovered" value="1" options={one_option} placeholder="Choose an option" />
|
|
456
|
-
</ExampleContainer>
|
|
457
|
-
);
|
|
458
|
-
const SelectedOptionActived = () => (
|
|
459
|
-
<ExampleContainer pseudoState="pseudo-active" expanded>
|
|
460
|
-
<Title title="Actived Selected Option" theme="light" level={4} />
|
|
461
|
-
<DxcSelect label="Actived" value="1" options={one_option} placeholder="Choose an option" />
|
|
838
|
+
|
|
839
|
+
const MultipleGroupedOptionsSelectOpinionated = () => (
|
|
840
|
+
<ExampleContainer expanded>
|
|
841
|
+
<Title title="Grouped options multiple select" theme="light" level={4} />
|
|
842
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
843
|
+
<DxcSelect
|
|
844
|
+
label="Label"
|
|
845
|
+
options={group_options}
|
|
846
|
+
defaultValue={["0", "2"]}
|
|
847
|
+
multiple
|
|
848
|
+
placeholder="Choose an option"
|
|
849
|
+
/>
|
|
850
|
+
</HalstackProvider>
|
|
462
851
|
</ExampleContainer>
|
|
463
852
|
);
|
|
853
|
+
|
|
464
854
|
const MultipleSearchable = () => (
|
|
465
855
|
<ExampleContainer expanded>
|
|
466
856
|
<Title title="Searchable multiple select with value" theme="light" level={4} />
|
|
@@ -468,114 +858,113 @@ const MultipleSearchable = () => (
|
|
|
468
858
|
label="Select Label"
|
|
469
859
|
searchable
|
|
470
860
|
multiple
|
|
471
|
-
|
|
861
|
+
defaultValue={["1", "4"]}
|
|
472
862
|
options={single_options}
|
|
473
863
|
placeholder="Choose an option"
|
|
474
864
|
/>
|
|
475
865
|
</ExampleContainer>
|
|
476
866
|
);
|
|
477
|
-
|
|
478
|
-
|
|
867
|
+
|
|
868
|
+
const MultipleSearchableOpinionated = () => (
|
|
869
|
+
<ExampleContainer expanded>
|
|
870
|
+
<Title title="Searchable multiple select with value" theme="light" level={4} />
|
|
871
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
872
|
+
<DxcSelect
|
|
873
|
+
label="Select Label"
|
|
874
|
+
searchable
|
|
875
|
+
multiple
|
|
876
|
+
defaultValue={["1", "4"]}
|
|
877
|
+
options={single_options}
|
|
878
|
+
placeholder="Choose an option"
|
|
879
|
+
/>
|
|
880
|
+
</HalstackProvider>
|
|
881
|
+
</ExampleContainer>
|
|
882
|
+
);
|
|
883
|
+
|
|
884
|
+
export const Chromatic = Select.bind({});
|
|
885
|
+
Chromatic.play = async ({ canvasElement }) => {
|
|
886
|
+
const canvas = within(canvasElement);
|
|
887
|
+
await userEvent.click(canvas.getAllByRole("combobox")[24]);
|
|
888
|
+
};
|
|
889
|
+
|
|
890
|
+
export const ListboxStates = SelectListbox.bind({});
|
|
891
|
+
ListboxStates.play = async ({ canvasElement }) => {
|
|
479
892
|
const canvas = within(canvasElement);
|
|
480
893
|
const select = canvas.getByRole("combobox");
|
|
481
894
|
await userEvent.click(select);
|
|
482
895
|
};
|
|
896
|
+
|
|
483
897
|
export const Searchable = SearchableSelect.bind({});
|
|
484
898
|
Searchable.play = async ({ canvasElement }) => {
|
|
485
899
|
const canvas = within(canvasElement);
|
|
486
|
-
await userEvent.
|
|
487
|
-
await waitFor(async () => {
|
|
488
|
-
userEvent.type(canvas.getByRole("combobox"), "r");
|
|
489
|
-
});
|
|
900
|
+
await userEvent.type(canvas.getByRole("combobox"), "r");
|
|
490
901
|
};
|
|
491
|
-
|
|
492
|
-
|
|
902
|
+
|
|
903
|
+
export const SearchableOpinionated = SearchableSelectOpinionated.bind({});
|
|
904
|
+
SearchableOpinionated.play = async ({ canvasElement }) => {
|
|
493
905
|
const canvas = within(canvasElement);
|
|
494
|
-
await userEvent.
|
|
906
|
+
await userEvent.type(canvas.getByRole("combobox"), "r");
|
|
495
907
|
};
|
|
496
908
|
|
|
497
|
-
export const
|
|
498
|
-
|
|
909
|
+
export const SearchableWithValue = SearchValue.bind({});
|
|
910
|
+
SearchableWithValue.play = async ({ canvasElement }) => {
|
|
499
911
|
const canvas = within(canvasElement);
|
|
500
|
-
await userEvent.click(canvas.
|
|
912
|
+
await userEvent.click(canvas.getByRole("combobox"));
|
|
501
913
|
};
|
|
502
914
|
|
|
503
|
-
export const
|
|
504
|
-
|
|
915
|
+
export const SearchableWithValueOpinionated = SearchValueOpinionated.bind({});
|
|
916
|
+
SearchableWithValueOpinionated.play = async ({ canvasElement }) => {
|
|
505
917
|
const canvas = within(canvasElement);
|
|
506
|
-
|
|
507
|
-
await userEvent.click(select);
|
|
918
|
+
await userEvent.click(canvas.getByRole("combobox"));
|
|
508
919
|
};
|
|
509
920
|
|
|
510
|
-
export const
|
|
511
|
-
|
|
921
|
+
export const MultipleSearchableWithValue = MultipleSearchable.bind({});
|
|
922
|
+
MultipleSearchableWithValue.play = async ({ canvasElement }) => {
|
|
512
923
|
const canvas = within(canvasElement);
|
|
513
924
|
await userEvent.click(canvas.getAllByRole("combobox")[0]);
|
|
514
925
|
};
|
|
515
926
|
|
|
516
|
-
export const
|
|
517
|
-
|
|
518
|
-
const canvas = within(canvasElement);
|
|
519
|
-
const select = canvas.getByRole("combobox");
|
|
520
|
-
await userEvent.click(select);
|
|
521
|
-
};
|
|
522
|
-
export const SelectWithIconsDisplayed = SelectWithIcons.bind({});
|
|
523
|
-
SelectWithIconsDisplayed.play = async ({ canvasElement }) => {
|
|
927
|
+
export const MultipleSearchableWithValueOpinionated = MultipleSearchableOpinionated.bind({});
|
|
928
|
+
MultipleSearchableWithValueOpinionated.play = async ({ canvasElement }) => {
|
|
524
929
|
const canvas = within(canvasElement);
|
|
525
|
-
|
|
526
|
-
await userEvent.click(select);
|
|
930
|
+
await userEvent.click(canvas.getAllByRole("combobox")[0]);
|
|
527
931
|
};
|
|
528
932
|
|
|
529
|
-
export const
|
|
530
|
-
|
|
531
|
-
const canvas = within(canvasElement);
|
|
532
|
-
const select = canvas.getByRole("combobox");
|
|
533
|
-
await userEvent.click(select);
|
|
534
|
-
};
|
|
535
|
-
export const SelectMultipleWithIconsDisplayed = SelectMultipleWithIcons.bind({});
|
|
536
|
-
SelectMultipleWithIconsDisplayed.play = async ({ canvasElement }) => {
|
|
933
|
+
export const GroupOptionsDisplayed = DefaultGroupedOptionsSelect.bind({});
|
|
934
|
+
GroupOptionsDisplayed.play = async ({ canvasElement }) => {
|
|
537
935
|
const canvas = within(canvasElement);
|
|
538
936
|
const select = canvas.getByRole("combobox");
|
|
539
937
|
await userEvent.click(select);
|
|
540
938
|
};
|
|
541
939
|
|
|
542
|
-
export const
|
|
543
|
-
|
|
940
|
+
export const GroupOptionsDisplayedOpinionated = DefaultGroupedOptionsSelectOpinionated.bind({});
|
|
941
|
+
GroupOptionsDisplayedOpinionated.play = async ({ canvasElement }) => {
|
|
544
942
|
const canvas = within(canvasElement);
|
|
545
943
|
const select = canvas.getByRole("combobox");
|
|
546
944
|
await userEvent.click(select);
|
|
547
945
|
};
|
|
548
946
|
|
|
549
|
-
export const
|
|
550
|
-
|
|
947
|
+
export const MultipleOptionsDisplayed = MultipleSelect.bind({});
|
|
948
|
+
MultipleOptionsDisplayed.play = async ({ canvasElement }) => {
|
|
551
949
|
const canvas = within(canvasElement);
|
|
552
|
-
|
|
553
|
-
await userEvent.click(select);
|
|
950
|
+
await userEvent.click(canvas.getAllByRole("combobox")[0]);
|
|
554
951
|
};
|
|
555
952
|
|
|
556
|
-
export const
|
|
557
|
-
|
|
953
|
+
export const MultipleOptionsDisplayedOpinionated = MultipleSelectOpinioated.bind({});
|
|
954
|
+
MultipleOptionsDisplayedOpinionated.play = async ({ canvasElement }) => {
|
|
558
955
|
const canvas = within(canvasElement);
|
|
559
|
-
|
|
560
|
-
await userEvent.click(select);
|
|
561
|
-
await waitFor(async () => {
|
|
562
|
-
fireEvent.keyDown(select, { key: "ArrowDown", code: "ArrowDown", keyCode: 40, charCode: 40 });
|
|
563
|
-
});
|
|
564
|
-
};
|
|
565
|
-
export const OptionActived = OnlyOneOptionActived.bind({});
|
|
566
|
-
OptionActived.play = async ({ canvasElement }) => {
|
|
567
|
-
const canvas = within(canvasElement);
|
|
568
|
-
const select = canvas.getByRole("combobox");
|
|
569
|
-
await userEvent.click(select);
|
|
956
|
+
await userEvent.click(canvas.getAllByRole("combobox")[0]);
|
|
570
957
|
};
|
|
571
|
-
|
|
572
|
-
|
|
958
|
+
|
|
959
|
+
export const MultipleGroupedOptionsDisplayed = MultipleGroupedOptionsSelect.bind({});
|
|
960
|
+
MultipleGroupedOptionsDisplayed.play = async ({ canvasElement }) => {
|
|
573
961
|
const canvas = within(canvasElement);
|
|
574
962
|
const select = canvas.getByRole("combobox");
|
|
575
963
|
await userEvent.click(select);
|
|
576
964
|
};
|
|
577
|
-
|
|
578
|
-
|
|
965
|
+
|
|
966
|
+
export const MultipleGroupedOptionsDisplayedOpinionated = MultipleGroupedOptionsSelectOpinionated.bind({});
|
|
967
|
+
MultipleGroupedOptionsDisplayedOpinionated.play = async ({ canvasElement }) => {
|
|
579
968
|
const canvas = within(canvasElement);
|
|
580
969
|
const select = canvas.getByRole("combobox");
|
|
581
970
|
await userEvent.click(select);
|