@dxc-technology/halstack-react 8.0.0 → 9.0.0
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/HalstackContext.js +94 -45
- package/accordion/Accordion.js +7 -13
- package/accordion/Accordion.stories.tsx +102 -13
- package/alert/Alert.stories.tsx +28 -0
- package/box/Box.js +1 -3
- package/box/Box.stories.tsx +15 -0
- package/button/Button.js +11 -13
- package/button/Button.stories.tsx +150 -8
- package/checkbox/Checkbox.stories.tsx +52 -0
- package/chip/Chip.js +16 -22
- package/chip/Chip.stories.tsx +96 -9
- package/common/variables.js +280 -288
- package/date-input/Calendar.d.ts +1 -1
- package/date-input/Calendar.js +43 -43
- package/date-input/DateInput.js +74 -32
- package/date-input/DateInput.stories.tsx +183 -30
- package/date-input/DateInput.test.js +120 -37
- package/date-input/DatePicker.js +38 -52
- package/date-input/Icons.d.ts +6 -0
- package/date-input/Icons.js +75 -0
- package/date-input/YearPicker.d.ts +1 -1
- package/date-input/YearPicker.js +23 -12
- package/date-input/types.d.ts +6 -8
- package/dialog/Dialog.js +60 -73
- package/dialog/Dialog.stories.tsx +211 -159
- package/dialog/Dialog.test.js +301 -2
- package/dropdown/Dropdown.js +3 -6
- package/dropdown/Dropdown.stories.tsx +210 -84
- package/dropdown/DropdownMenu.js +8 -18
- package/dropdown/DropdownMenuItem.js +4 -15
- package/file-input/FileInput.js +3 -6
- package/file-input/FileInput.stories.tsx +85 -2
- package/file-input/FileInput.test.js +0 -41
- package/file-input/FileItem.js +1 -0
- package/footer/Footer.stories.tsx +91 -0
- package/header/Header.js +18 -20
- package/header/Header.stories.tsx +149 -6
- package/link/Link.stories.tsx +60 -0
- package/main.d.ts +1 -1
- package/main.js +1 -1
- package/{tabs-nav → nav-tabs}/NavTabs.js +1 -1
- package/{tabs-nav → nav-tabs}/NavTabs.stories.tsx +96 -6
- package/{tabs-nav → nav-tabs}/Tab.js +35 -15
- package/package.json +1 -1
- package/paginator/Icons.d.ts +5 -0
- package/paginator/Icons.js +16 -28
- package/paginator/Paginator.js +5 -11
- package/paginator/Paginator.stories.tsx +24 -0
- package/paginator/Paginator.test.js +17 -10
- package/progress-bar/ProgressBar.js +4 -4
- package/progress-bar/ProgressBar.stories.jsx +35 -2
- package/quick-nav/QuickNav.stories.tsx +14 -0
- package/radio-group/RadioGroup.stories.tsx +131 -18
- package/resultsetTable/ResultsetTable.test.js +17 -22
- package/select/Listbox.d.ts +1 -1
- package/select/Listbox.js +5 -34
- package/select/Option.js +11 -24
- package/select/Select.js +43 -24
- package/select/Select.stories.tsx +492 -145
- package/select/Select.test.js +17 -22
- package/select/types.d.ts +2 -2
- package/sidenav/Sidenav.js +8 -10
- package/sidenav/Sidenav.stories.tsx +148 -46
- package/slider/Slider.js +4 -4
- package/slider/Slider.stories.tsx +57 -0
- package/spinner/Spinner.js +2 -2
- package/spinner/Spinner.stories.jsx +27 -1
- package/switch/Switch.js +1 -1
- package/switch/Switch.stories.tsx +33 -0
- package/table/Table.stories.jsx +80 -1
- package/tabs/Tab.js +3 -5
- package/tabs/Tabs.js +3 -3
- package/tabs/Tabs.stories.tsx +45 -5
- package/tag/Tag.stories.tsx +14 -1
- package/text-input/Suggestion.js +32 -5
- package/text-input/TextInput.js +7 -11
- package/text-input/TextInput.stories.tsx +92 -4
- package/text-input/TextInput.test.js +125 -25
- package/textarea/Textarea.stories.jsx +60 -1
- package/toggle-group/ToggleGroup.stories.tsx +42 -0
- package/utils/FocusLock.d.ts +13 -0
- package/utils/FocusLock.js +139 -0
- package/wizard/Wizard.stories.tsx +20 -0
- /package/{tabs-nav → nav-tabs}/NavTabs.d.ts +0 -0
- /package/{tabs-nav → nav-tabs}/NavTabs.test.js +0 -0
- /package/{tabs-nav → nav-tabs}/Tab.d.ts +0 -0
- /package/{tabs-nav → nav-tabs}/types.d.ts +0 -0
- /package/{tabs-nav → nav-tabs}/types.js +0 -0
|
@@ -4,8 +4,9 @@ import Title from "../../.storybook/components/Title";
|
|
|
4
4
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
5
|
import DxcSelect from "./Select";
|
|
6
6
|
import Listbox from "./Listbox";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
7
|
+
import { ThemeProvider } from "styled-components";
|
|
8
|
+
import useTheme from "../useTheme";
|
|
9
|
+
import { HalstackProvider } from "../HalstackContext";
|
|
9
10
|
|
|
10
11
|
export default {
|
|
11
12
|
title: "Select",
|
|
@@ -13,12 +14,14 @@ export default {
|
|
|
13
14
|
};
|
|
14
15
|
|
|
15
16
|
const one_option = [{ label: "Option 01", value: "1" }];
|
|
17
|
+
|
|
16
18
|
const single_options = [
|
|
17
19
|
{ label: "Option 01", value: "1" },
|
|
18
20
|
{ label: "Option 02", value: "2" },
|
|
19
21
|
{ label: "Option 03", value: "3" },
|
|
20
22
|
{ label: "Option 04", value: "4" },
|
|
21
23
|
];
|
|
24
|
+
|
|
22
25
|
const group_options = [
|
|
23
26
|
{
|
|
24
27
|
label: "Group 001",
|
|
@@ -61,6 +64,7 @@ const group_options = [
|
|
|
61
64
|
],
|
|
62
65
|
},
|
|
63
66
|
];
|
|
67
|
+
|
|
64
68
|
const icon_options_grouped = [
|
|
65
69
|
{
|
|
66
70
|
label: "Group 001",
|
|
@@ -124,6 +128,7 @@ const icon_options_grouped = [
|
|
|
124
128
|
],
|
|
125
129
|
},
|
|
126
130
|
];
|
|
131
|
+
|
|
127
132
|
const icon_options = [
|
|
128
133
|
{
|
|
129
134
|
label: "3G Mobile",
|
|
@@ -172,6 +177,7 @@ const icon_options = [
|
|
|
172
177
|
),
|
|
173
178
|
},
|
|
174
179
|
];
|
|
180
|
+
|
|
175
181
|
const url_options = [
|
|
176
182
|
{
|
|
177
183
|
label: "Social Media",
|
|
@@ -189,7 +195,29 @@ const url_options = [
|
|
|
189
195
|
{
|
|
190
196
|
label: "Facebook",
|
|
191
197
|
value: "facebook",
|
|
192
|
-
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
|
+
),
|
|
193
221
|
},
|
|
194
222
|
{
|
|
195
223
|
label: "Pinterest",
|
|
@@ -219,13 +247,22 @@ const url_options = [
|
|
|
219
247
|
],
|
|
220
248
|
},
|
|
221
249
|
];
|
|
250
|
+
|
|
222
251
|
const optionsWithEllipsisMedium = [
|
|
223
252
|
{ label: "Optiond1234567890123456789012345678901234", value: "1" },
|
|
224
253
|
{ label: "Optiond12345678901234567890123456789012345", value: "2" },
|
|
225
254
|
{ label: "Option 031111111111111111111111111111222", value: "3" },
|
|
226
|
-
{ label: "Option 03111111111111111111111111111222", value: "4" },
|
|
227
255
|
];
|
|
228
256
|
|
|
257
|
+
const opinionatedTheme = {
|
|
258
|
+
select: {
|
|
259
|
+
selectedOptionBackgroundColor: "#e6f4ff",
|
|
260
|
+
fontColor: "#000000",
|
|
261
|
+
optionFontColor: "#000000",
|
|
262
|
+
hoverBorderColor: "#a46ede",
|
|
263
|
+
},
|
|
264
|
+
};
|
|
265
|
+
|
|
229
266
|
const Select = () => (
|
|
230
267
|
<>
|
|
231
268
|
<Title title="States" theme="light" level={2} />
|
|
@@ -338,123 +375,380 @@ const Select = () => (
|
|
|
338
375
|
<Title title="Multiple selection with ellipsis" theme="light" level={4} />
|
|
339
376
|
<DxcSelect label="Label" options={single_options} multiple defaultValue={["1", "2", "3", "4"]} />
|
|
340
377
|
<Title title="Value with ellipsis" theme="light" level={4} />
|
|
341
|
-
<DxcSelect label="Label" options={optionsWithEllipsisMedium} defaultValue="1"
|
|
378
|
+
<DxcSelect label="Label" options={optionsWithEllipsisMedium} defaultValue="1" />
|
|
342
379
|
<Title title="Options with ellipsis" theme="light" level={4} />
|
|
343
380
|
<DxcSelect
|
|
344
381
|
label="Label"
|
|
345
382
|
placeholder="Choose an option"
|
|
346
383
|
defaultValue="1"
|
|
347
384
|
options={optionsWithEllipsisMedium}
|
|
348
|
-
|
|
385
|
+
margin={{ top: "xxlarge" }}
|
|
349
386
|
/>
|
|
350
387
|
</ExampleContainer>
|
|
351
|
-
|
|
352
|
-
);
|
|
353
|
-
const SelectListbox = () => (
|
|
354
|
-
<>
|
|
355
|
-
<Title title="Listbox" theme="light" level={2} />
|
|
356
|
-
<Title title="Default with opened listbox" theme="light" level={3} />
|
|
357
|
-
<ExampleContainer>
|
|
358
|
-
<div style={{ display: "flex", gap: "30px", flexDirection: "column", marginBottom: "80px" }}>
|
|
359
|
-
<DxcSelect label="Label" options={single_options} optional placeholder="Choose an option" />
|
|
360
|
-
<DxcCheckbox
|
|
361
|
-
label="You understand the selection and give your consent"
|
|
362
|
-
onChange={() => {}}
|
|
363
|
-
labelPosition="after"
|
|
364
|
-
/>
|
|
365
|
-
<DxcButton label="Submit" onClick={() => {}} size="medium" />
|
|
366
|
-
</div>
|
|
367
|
-
</ExampleContainer>
|
|
368
|
-
<Title title="Listbox option states" theme="light" level={3} />
|
|
388
|
+
<Title title="Opinionated theme" theme="light" level={2} />
|
|
369
389
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
370
|
-
<Title title="Hovered
|
|
371
|
-
<
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
options={one_option}
|
|
375
|
-
visualFocusIndex={-1}
|
|
376
|
-
lastOptionIndex={0}
|
|
377
|
-
multiple={false}
|
|
378
|
-
optional={false}
|
|
379
|
-
optionalItem={{ label: "Empty", value: "" }}
|
|
380
|
-
searchable={false}
|
|
381
|
-
handleOptionOnClick={() => {}}
|
|
382
|
-
getSelectWidth={() => 360}
|
|
383
|
-
/>
|
|
390
|
+
<Title title="Hovered" theme="light" level={4} />
|
|
391
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
392
|
+
<DxcSelect label="Hovered" options={single_options} />
|
|
393
|
+
</HalstackProvider>
|
|
384
394
|
</ExampleContainer>
|
|
385
|
-
<ExampleContainer pseudoState="pseudo-
|
|
386
|
-
<Title title="
|
|
387
|
-
<
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
options={one_option}
|
|
391
|
-
visualFocusIndex={-1}
|
|
392
|
-
lastOptionIndex={0}
|
|
393
|
-
multiple={false}
|
|
394
|
-
optional={false}
|
|
395
|
-
optionalItem={{ label: "Empty", value: "" }}
|
|
396
|
-
searchable={false}
|
|
397
|
-
handleOptionOnClick={() => {}}
|
|
398
|
-
getSelectWidth={() => 360}
|
|
399
|
-
|
|
400
|
-
/>
|
|
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>
|
|
401
400
|
</ExampleContainer>
|
|
402
401
|
<ExampleContainer>
|
|
403
|
-
<Title title="
|
|
404
|
-
<
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
options={one_option}
|
|
408
|
-
visualFocusIndex={0}
|
|
409
|
-
lastOptionIndex={0}
|
|
410
|
-
multiple={false}
|
|
411
|
-
optional={false}
|
|
412
|
-
optionalItem={{ label: "Empty", value: "" }}
|
|
413
|
-
searchable={false}
|
|
414
|
-
handleOptionOnClick={() => {}}
|
|
415
|
-
getSelectWidth={() => 360}
|
|
416
|
-
/>
|
|
402
|
+
<Title title="Disabled" theme="light" level={4} />
|
|
403
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
404
|
+
<DxcSelect label="Disabled" placeholder="Placeholder" disabled options={single_options} />
|
|
405
|
+
</HalstackProvider>
|
|
417
406
|
</ExampleContainer>
|
|
418
|
-
<ExampleContainer
|
|
419
|
-
<Title title="
|
|
420
|
-
<
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
options={single_options}
|
|
424
|
-
visualFocusIndex={-1}
|
|
425
|
-
lastOptionIndex={3}
|
|
426
|
-
multiple={false}
|
|
427
|
-
optional={false}
|
|
428
|
-
optionalItem={{ label: "Empty", value: "" }}
|
|
429
|
-
searchable={false}
|
|
430
|
-
handleOptionOnClick={() => {}}
|
|
431
|
-
getSelectWidth={() => 360}
|
|
432
|
-
/>
|
|
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>
|
|
433
412
|
</ExampleContainer>
|
|
434
|
-
<ExampleContainer
|
|
435
|
-
<Title title="
|
|
436
|
-
<
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
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>
|
|
449
436
|
</ExampleContainer>
|
|
450
437
|
</>
|
|
451
438
|
);
|
|
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
|
+
);
|
|
734
|
+
};
|
|
735
|
+
|
|
452
736
|
const SearchableSelect = () => (
|
|
453
737
|
<ExampleContainer expanded>
|
|
454
738
|
<Title title="Searchable select" theme="light" level={4} />
|
|
455
739
|
<DxcSelect label="Select Label" searchable options={single_options} placeholder="Choose an option" />
|
|
456
740
|
</ExampleContainer>
|
|
457
741
|
);
|
|
742
|
+
|
|
743
|
+
const SearchableSelectOpinionated = () => (
|
|
744
|
+
<ExampleContainer expanded>
|
|
745
|
+
<Title title="Searchable select" theme="light" level={4} />
|
|
746
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
747
|
+
<DxcSelect label="Select Label" searchable options={single_options} placeholder="Choose an option" />
|
|
748
|
+
</HalstackProvider>
|
|
749
|
+
</ExampleContainer>
|
|
750
|
+
);
|
|
751
|
+
|
|
458
752
|
const SearchValue = () => (
|
|
459
753
|
<ExampleContainer expanded>
|
|
460
754
|
<Title title="Searchable select with value" theme="light" level={4} />
|
|
@@ -467,6 +761,22 @@ const SearchValue = () => (
|
|
|
467
761
|
/>
|
|
468
762
|
</ExampleContainer>
|
|
469
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>
|
|
777
|
+
</ExampleContainer>
|
|
778
|
+
);
|
|
779
|
+
|
|
470
780
|
const MultipleSelect = () => (
|
|
471
781
|
<>
|
|
472
782
|
<ExampleContainer expanded>
|
|
@@ -481,12 +791,38 @@ const MultipleSelect = () => (
|
|
|
481
791
|
</ExampleContainer>
|
|
482
792
|
</>
|
|
483
793
|
);
|
|
794
|
+
|
|
795
|
+
const MultipleSelectOpinioated = () => (
|
|
796
|
+
<ExampleContainer expanded>
|
|
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>
|
|
807
|
+
</ExampleContainer>
|
|
808
|
+
);
|
|
809
|
+
|
|
484
810
|
const DefaultGroupedOptionsSelect = () => (
|
|
485
811
|
<ExampleContainer expanded>
|
|
486
812
|
<Title title="Grouped options simple select" theme="light" level={4} />
|
|
487
813
|
<DxcSelect label="Label" options={group_options} defaultValue="9" placeholder="Choose an option" />
|
|
488
814
|
</ExampleContainer>
|
|
489
815
|
);
|
|
816
|
+
|
|
817
|
+
const DefaultGroupedOptionsSelectOpinionated = () => (
|
|
818
|
+
<ExampleContainer expanded>
|
|
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>
|
|
823
|
+
</ExampleContainer>
|
|
824
|
+
);
|
|
825
|
+
|
|
490
826
|
const MultipleGroupedOptionsSelect = () => (
|
|
491
827
|
<ExampleContainer expanded>
|
|
492
828
|
<Title title="Grouped options multiple select" theme="light" level={4} />
|
|
@@ -499,34 +835,19 @@ const MultipleGroupedOptionsSelect = () => (
|
|
|
499
835
|
/>
|
|
500
836
|
</ExampleContainer>
|
|
501
837
|
);
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
<Title title="Rescaled icons displayed" theme="light" level={4} />
|
|
505
|
-
<DxcSelect label="Label" options={url_options} defaultValue="facebook" placeholder="Choose an option" />
|
|
506
|
-
</ExampleContainer>
|
|
507
|
-
);
|
|
508
|
-
const SelectWithIcons = () => (
|
|
509
|
-
<ExampleContainer expanded>
|
|
510
|
-
<Title title="Normal icons displayed" theme="light" level={4} />
|
|
511
|
-
<DxcSelect label="Label" options={icon_options} defaultValue="3" placeholder="Choose an option" />
|
|
512
|
-
</ExampleContainer>
|
|
513
|
-
);
|
|
514
|
-
const SelectMultipleWithIcons = () => (
|
|
515
|
-
<ExampleContainer expanded>
|
|
516
|
-
<Title title="Multiple select with icons" theme="light" level={4} />
|
|
517
|
-
<DxcSelect label="Label" options={icon_options} multiple defaultValue={["1", "3"]} placeholder="Choose an option" />
|
|
518
|
-
</ExampleContainer>
|
|
519
|
-
);
|
|
520
|
-
const MultipleGroupedOptionsSelectWithIcons = () => (
|
|
838
|
+
|
|
839
|
+
const MultipleGroupedOptionsSelectOpinionated = () => (
|
|
521
840
|
<ExampleContainer expanded>
|
|
522
|
-
<Title title="
|
|
523
|
-
<
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
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>
|
|
530
851
|
</ExampleContainer>
|
|
531
852
|
);
|
|
532
853
|
|
|
@@ -544,6 +865,22 @@ const MultipleSearchable = () => (
|
|
|
544
865
|
</ExampleContainer>
|
|
545
866
|
);
|
|
546
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
|
+
|
|
547
884
|
export const Chromatic = Select.bind({});
|
|
548
885
|
Chromatic.play = async ({ canvasElement }) => {
|
|
549
886
|
const canvas = within(canvasElement);
|
|
@@ -563,18 +900,36 @@ Searchable.play = async ({ canvasElement }) => {
|
|
|
563
900
|
await userEvent.type(canvas.getByRole("combobox"), "r");
|
|
564
901
|
};
|
|
565
902
|
|
|
903
|
+
export const SearchableOpinionated = SearchableSelectOpinionated.bind({});
|
|
904
|
+
SearchableOpinionated.play = async ({ canvasElement }) => {
|
|
905
|
+
const canvas = within(canvasElement);
|
|
906
|
+
await userEvent.type(canvas.getByRole("combobox"), "r");
|
|
907
|
+
};
|
|
908
|
+
|
|
566
909
|
export const SearchableWithValue = SearchValue.bind({});
|
|
567
910
|
SearchableWithValue.play = async ({ canvasElement }) => {
|
|
568
911
|
const canvas = within(canvasElement);
|
|
569
912
|
await userEvent.click(canvas.getByRole("combobox"));
|
|
570
913
|
};
|
|
571
914
|
|
|
915
|
+
export const SearchableWithValueOpinionated = SearchValueOpinionated.bind({});
|
|
916
|
+
SearchableWithValueOpinionated.play = async ({ canvasElement }) => {
|
|
917
|
+
const canvas = within(canvasElement);
|
|
918
|
+
await userEvent.click(canvas.getByRole("combobox"));
|
|
919
|
+
};
|
|
920
|
+
|
|
572
921
|
export const MultipleSearchableWithValue = MultipleSearchable.bind({});
|
|
573
922
|
MultipleSearchableWithValue.play = async ({ canvasElement }) => {
|
|
574
923
|
const canvas = within(canvasElement);
|
|
575
924
|
await userEvent.click(canvas.getAllByRole("combobox")[0]);
|
|
576
925
|
};
|
|
577
926
|
|
|
927
|
+
export const MultipleSearchableWithValueOpinionated = MultipleSearchableOpinionated.bind({});
|
|
928
|
+
MultipleSearchableWithValueOpinionated.play = async ({ canvasElement }) => {
|
|
929
|
+
const canvas = within(canvasElement);
|
|
930
|
+
await userEvent.click(canvas.getAllByRole("combobox")[0]);
|
|
931
|
+
};
|
|
932
|
+
|
|
578
933
|
export const GroupOptionsDisplayed = DefaultGroupedOptionsSelect.bind({});
|
|
579
934
|
GroupOptionsDisplayed.play = async ({ canvasElement }) => {
|
|
580
935
|
const canvas = within(canvasElement);
|
|
@@ -582,42 +937,34 @@ GroupOptionsDisplayed.play = async ({ canvasElement }) => {
|
|
|
582
937
|
await userEvent.click(select);
|
|
583
938
|
};
|
|
584
939
|
|
|
585
|
-
export const
|
|
586
|
-
|
|
587
|
-
const canvas = within(canvasElement);
|
|
588
|
-
await userEvent.click(canvas.getAllByRole("combobox")[0]);
|
|
589
|
-
};
|
|
590
|
-
|
|
591
|
-
export const MultipleGroupedOptionsDisplayed = MultipleGroupedOptionsSelect.bind({});
|
|
592
|
-
MultipleGroupedOptionsDisplayed.play = async ({ canvasElement }) => {
|
|
940
|
+
export const GroupOptionsDisplayedOpinionated = DefaultGroupedOptionsSelectOpinionated.bind({});
|
|
941
|
+
GroupOptionsDisplayedOpinionated.play = async ({ canvasElement }) => {
|
|
593
942
|
const canvas = within(canvasElement);
|
|
594
943
|
const select = canvas.getByRole("combobox");
|
|
595
944
|
await userEvent.click(select);
|
|
596
945
|
};
|
|
597
946
|
|
|
598
|
-
export const
|
|
599
|
-
|
|
947
|
+
export const MultipleOptionsDisplayed = MultipleSelect.bind({});
|
|
948
|
+
MultipleOptionsDisplayed.play = async ({ canvasElement }) => {
|
|
600
949
|
const canvas = within(canvasElement);
|
|
601
|
-
|
|
602
|
-
await userEvent.click(select);
|
|
950
|
+
await userEvent.click(canvas.getAllByRole("combobox")[0]);
|
|
603
951
|
};
|
|
604
952
|
|
|
605
|
-
export const
|
|
606
|
-
|
|
953
|
+
export const MultipleOptionsDisplayedOpinionated = MultipleSelectOpinioated.bind({});
|
|
954
|
+
MultipleOptionsDisplayedOpinionated.play = async ({ canvasElement }) => {
|
|
607
955
|
const canvas = within(canvasElement);
|
|
608
|
-
|
|
609
|
-
await userEvent.click(select);
|
|
956
|
+
await userEvent.click(canvas.getAllByRole("combobox")[0]);
|
|
610
957
|
};
|
|
611
958
|
|
|
612
|
-
export const
|
|
613
|
-
|
|
959
|
+
export const MultipleGroupedOptionsDisplayed = MultipleGroupedOptionsSelect.bind({});
|
|
960
|
+
MultipleGroupedOptionsDisplayed.play = async ({ canvasElement }) => {
|
|
614
961
|
const canvas = within(canvasElement);
|
|
615
962
|
const select = canvas.getByRole("combobox");
|
|
616
963
|
await userEvent.click(select);
|
|
617
964
|
};
|
|
618
965
|
|
|
619
|
-
export const
|
|
620
|
-
|
|
966
|
+
export const MultipleGroupedOptionsDisplayedOpinionated = MultipleGroupedOptionsSelectOpinionated.bind({});
|
|
967
|
+
MultipleGroupedOptionsDisplayedOpinionated.play = async ({ canvasElement }) => {
|
|
621
968
|
const canvas = within(canvasElement);
|
|
622
969
|
const select = canvas.getByRole("combobox");
|
|
623
970
|
await userEvent.click(select);
|