@dxc-technology/halstack-react 0.0.0-c2834c3 → 0.0.0-c291a0c
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 +1 -4
- 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 +62 -63
- package/bleed/types.d.ts +1 -1
- package/box/Box.js +22 -32
- package/card/Card.js +34 -36
- package/common/variables.js +4 -18
- package/footer/Icons.js +1 -1
- package/inline/Inline.d.ts +4 -0
- package/inline/Inline.js +54 -0
- package/inline/Inline.stories.tsx +264 -0
- package/inline/types.d.ts +32 -0
- package/{radio → inline}/types.js +0 -0
- package/inset/Inset.js +1 -34
- package/inset/Inset.stories.tsx +33 -33
- package/inset/types.d.ts +1 -1
- package/layout/ApplicationLayout.d.ts +4 -3
- package/layout/ApplicationLayout.js +83 -102
- package/layout/ApplicationLayout.stories.tsx +14 -59
- 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 +5 -10
- package/link/Link.d.ts +2 -2
- package/link/Link.js +23 -49
- package/link/types.d.ts +2 -3
- package/list/List.js +1 -1
- package/list/List.stories.tsx +16 -22
- package/list/types.d.ts +1 -1
- package/main.d.ts +3 -2
- package/main.js +16 -8
- package/package.json +2 -1
- package/paginator/Paginator.test.js +42 -0
- package/progress-bar/ProgressBar.js +1 -1
- package/progress-bar/ProgressBar.stories.jsx +11 -11
- package/quick-nav/QuickNav.js +19 -23
- package/resultsetTable/ResultsetTable.test.js +42 -0
- package/select/Listbox.d.ts +1 -1
- package/select/Listbox.js +30 -7
- package/select/Select.js +73 -67
- package/select/Select.stories.tsx +130 -98
- package/select/Select.test.js +299 -194
- package/select/types.d.ts +3 -4
- package/sidenav/Sidenav.d.ts +1 -1
- package/sidenav/Sidenav.js +20 -9
- package/stack/Stack.d.ts +2 -1
- package/stack/Stack.js +23 -70
- package/stack/Stack.stories.tsx +139 -78
- package/stack/types.d.ts +11 -7
- package/tabs-nav/NavTabs.d.ts +8 -0
- package/tabs-nav/NavTabs.js +125 -0
- package/tabs-nav/NavTabs.stories.tsx +170 -0
- package/tabs-nav/NavTabs.test.js +82 -0
- package/tabs-nav/Tab.d.ts +4 -0
- package/tabs-nav/Tab.js +132 -0
- package/tabs-nav/types.d.ts +53 -0
- package/tabs-nav/types.js +5 -0
- package/radio/Radio.d.ts +0 -4
- package/radio/Radio.js +0 -173
- package/radio/Radio.stories.tsx +0 -192
- package/radio/Radio.test.js +0 -71
- package/radio/types.d.ts +0 -54
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
2
|
import { userEvent, within, waitFor } from "@storybook/testing-library";
|
|
4
|
-
import { fireEvent } from "@testing-library/react";
|
|
5
|
-
|
|
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 DxcButton from "../button/Button";
|
|
8
|
+
import DxcCheckbox from "../checkbox/Checkbox";
|
|
10
9
|
|
|
11
10
|
export default {
|
|
12
11
|
title: "Select",
|
|
@@ -340,7 +339,7 @@ const Select = () => (
|
|
|
340
339
|
<DxcSelect label="Label" options={single_options} multiple defaultValue={["1", "2", "3", "4"]} />
|
|
341
340
|
<Title title="Value with ellipsis" theme="light" level={4} />
|
|
342
341
|
<DxcSelect label="Label" options={optionsWithEllipsisMedium} defaultValue="1" size="medium" />
|
|
343
|
-
<Title title="
|
|
342
|
+
<Title title="Options with ellipsis" theme="light" level={4} />
|
|
344
343
|
<DxcSelect
|
|
345
344
|
label="Label"
|
|
346
345
|
placeholder="Choose an option"
|
|
@@ -351,16 +350,103 @@ const Select = () => (
|
|
|
351
350
|
</ExampleContainer>
|
|
352
351
|
</>
|
|
353
352
|
);
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
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} />
|
|
369
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
370
|
+
<Title title="Hovered option" theme="light" level={4} />
|
|
371
|
+
<Listbox
|
|
372
|
+
id="x"
|
|
373
|
+
currentValue=""
|
|
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
|
+
styles={{ width: 360 }}
|
|
383
|
+
/>
|
|
384
|
+
</ExampleContainer>
|
|
385
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
386
|
+
<Title title="Active option" theme="light" level={4} />
|
|
387
|
+
<Listbox
|
|
388
|
+
id="x"
|
|
389
|
+
currentValue=""
|
|
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
|
+
styles={{ width: 360 }}
|
|
399
|
+
/>
|
|
400
|
+
</ExampleContainer>
|
|
401
|
+
<ExampleContainer>
|
|
402
|
+
<Title title="Focused option" theme="light" level={4} />
|
|
403
|
+
<Listbox
|
|
404
|
+
id="x"
|
|
405
|
+
currentValue=""
|
|
406
|
+
options={one_option}
|
|
407
|
+
visualFocusIndex={0}
|
|
408
|
+
lastOptionIndex={0}
|
|
409
|
+
multiple={false}
|
|
410
|
+
optional={false}
|
|
411
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
412
|
+
searchable={false}
|
|
413
|
+
handleOptionOnClick={() => {}}
|
|
414
|
+
styles={{ width: 360 }}
|
|
415
|
+
/>
|
|
416
|
+
</ExampleContainer>
|
|
417
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
418
|
+
<Title title="Hovered selected option" theme="light" level={4} />
|
|
419
|
+
<Listbox
|
|
420
|
+
id="x"
|
|
421
|
+
currentValue="1"
|
|
422
|
+
options={single_options}
|
|
423
|
+
visualFocusIndex={-1}
|
|
424
|
+
lastOptionIndex={3}
|
|
425
|
+
multiple={false}
|
|
426
|
+
optional={false}
|
|
427
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
428
|
+
searchable={false}
|
|
429
|
+
handleOptionOnClick={() => {}}
|
|
430
|
+
styles={{ width: 360 }}
|
|
431
|
+
/>
|
|
432
|
+
</ExampleContainer>
|
|
433
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
434
|
+
<Title title="Active selected option" theme="light" level={4} />
|
|
435
|
+
<Listbox
|
|
436
|
+
id="x"
|
|
437
|
+
currentValue="2"
|
|
438
|
+
options={single_options}
|
|
439
|
+
visualFocusIndex={0}
|
|
440
|
+
lastOptionIndex={3}
|
|
441
|
+
multiple={false}
|
|
442
|
+
optional={false}
|
|
443
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
444
|
+
searchable={false}
|
|
445
|
+
handleOptionOnClick={() => {}}
|
|
446
|
+
styles={{ width: 360 }}
|
|
447
|
+
/>
|
|
448
|
+
</ExampleContainer>
|
|
449
|
+
</>
|
|
364
450
|
);
|
|
365
451
|
const SearchableSelect = () => (
|
|
366
452
|
<ExampleContainer expanded>
|
|
@@ -368,7 +454,7 @@ const SearchableSelect = () => (
|
|
|
368
454
|
<DxcSelect label="Select Label" searchable options={single_options} placeholder="Choose an option" />
|
|
369
455
|
</ExampleContainer>
|
|
370
456
|
);
|
|
371
|
-
const
|
|
457
|
+
const SearchValue = () => (
|
|
372
458
|
<ExampleContainer expanded>
|
|
373
459
|
<Title title="Searchable select with value" theme="light" level={4} />
|
|
374
460
|
<DxcSelect
|
|
@@ -380,7 +466,6 @@ const SearchableWithValue = () => (
|
|
|
380
466
|
/>
|
|
381
467
|
</ExampleContainer>
|
|
382
468
|
);
|
|
383
|
-
|
|
384
469
|
const MultipleSelect = () => (
|
|
385
470
|
<>
|
|
386
471
|
<ExampleContainer expanded>
|
|
@@ -443,36 +528,7 @@ const MultipleGroupedOptionsSelectWithIcons = () => (
|
|
|
443
528
|
/>
|
|
444
529
|
</ExampleContainer>
|
|
445
530
|
);
|
|
446
|
-
|
|
447
|
-
<ExampleContainer pseudoState="pseudo-hover" expanded>
|
|
448
|
-
<Title title="Hovered Option" theme="light" level={4} />
|
|
449
|
-
<DxcSelect label="Hovered" options={one_option} placeholder="Choose an option" />
|
|
450
|
-
</ExampleContainer>
|
|
451
|
-
);
|
|
452
|
-
const OnlyOneOptionFocused = () => (
|
|
453
|
-
<ExampleContainer pseudoState="pseudo-focus" expanded>
|
|
454
|
-
<Title title="Focused Option" theme="light" level={4} />
|
|
455
|
-
<DxcSelect label="Focused" options={one_option} placeholder="Choose an option" />
|
|
456
|
-
</ExampleContainer>
|
|
457
|
-
);
|
|
458
|
-
const OnlyOneOptionActived = () => (
|
|
459
|
-
<ExampleContainer pseudoState="pseudo-active" expanded>
|
|
460
|
-
<Title title="Actived Option" theme="light" level={4} />
|
|
461
|
-
<DxcSelect label="Actived" options={one_option} placeholder="Choose an option" />
|
|
462
|
-
</ExampleContainer>
|
|
463
|
-
);
|
|
464
|
-
const SelectedOptionHovered = () => (
|
|
465
|
-
<ExampleContainer pseudoState="pseudo-hover" expanded>
|
|
466
|
-
<Title title="Hovered Selected Option" theme="light" level={4} />
|
|
467
|
-
<DxcSelect label="Hovered" defaultValue="1" options={one_option} placeholder="Choose an option" />
|
|
468
|
-
</ExampleContainer>
|
|
469
|
-
);
|
|
470
|
-
const SelectedOptionActived = () => (
|
|
471
|
-
<ExampleContainer pseudoState="pseudo-active" expanded>
|
|
472
|
-
<Title title="Actived Selected Option" theme="light" level={4} />
|
|
473
|
-
<DxcSelect label="Actived" defaultValue="1" options={one_option} placeholder="Choose an option" />
|
|
474
|
-
</ExampleContainer>
|
|
475
|
-
);
|
|
531
|
+
|
|
476
532
|
const MultipleSearchable = () => (
|
|
477
533
|
<ExampleContainer expanded>
|
|
478
534
|
<Title title="Searchable multiple select with value" theme="light" level={4} />
|
|
@@ -486,12 +542,20 @@ const MultipleSearchable = () => (
|
|
|
486
542
|
/>
|
|
487
543
|
</ExampleContainer>
|
|
488
544
|
);
|
|
489
|
-
|
|
490
|
-
|
|
545
|
+
|
|
546
|
+
export const Chromatic = Select.bind({});
|
|
547
|
+
Chromatic.play = async ({ canvasElement }) => {
|
|
548
|
+
const canvas = within(canvasElement);
|
|
549
|
+
await userEvent.click(canvas.getAllByRole("combobox")[24]);
|
|
550
|
+
};
|
|
551
|
+
|
|
552
|
+
export const ListboxStates = SelectListbox.bind({});
|
|
553
|
+
ListboxStates.play = async ({ canvasElement }) => {
|
|
491
554
|
const canvas = within(canvasElement);
|
|
492
555
|
const select = canvas.getByRole("combobox");
|
|
493
556
|
await userEvent.click(select);
|
|
494
557
|
};
|
|
558
|
+
|
|
495
559
|
export const Searchable = SearchableSelect.bind({});
|
|
496
560
|
Searchable.play = async ({ canvasElement }) => {
|
|
497
561
|
const canvas = within(canvasElement);
|
|
@@ -500,14 +564,15 @@ Searchable.play = async ({ canvasElement }) => {
|
|
|
500
564
|
userEvent.type(canvas.getByRole("combobox"), "r");
|
|
501
565
|
});
|
|
502
566
|
};
|
|
503
|
-
|
|
504
|
-
|
|
567
|
+
|
|
568
|
+
export const SearchableWithValue = SearchValue.bind({});
|
|
569
|
+
SearchableWithValue.play = async ({ canvasElement }) => {
|
|
505
570
|
const canvas = within(canvasElement);
|
|
506
571
|
await userEvent.click(canvas.getByRole("combobox"));
|
|
507
572
|
};
|
|
508
573
|
|
|
509
|
-
export const
|
|
510
|
-
|
|
574
|
+
export const MultipleSearchableWithValue = MultipleSearchable.bind({});
|
|
575
|
+
MultipleSearchableWithValue.play = async ({ canvasElement }) => {
|
|
511
576
|
const canvas = within(canvasElement);
|
|
512
577
|
await userEvent.click(canvas.getAllByRole("combobox")[0]);
|
|
513
578
|
};
|
|
@@ -519,75 +584,42 @@ GroupOptionsDisplayed.play = async ({ canvasElement }) => {
|
|
|
519
584
|
await userEvent.click(select);
|
|
520
585
|
};
|
|
521
586
|
|
|
522
|
-
export const
|
|
523
|
-
|
|
587
|
+
export const MultipleOptionsDisplayed = MultipleSelect.bind({});
|
|
588
|
+
MultipleOptionsDisplayed.play = async ({ canvasElement }) => {
|
|
524
589
|
const canvas = within(canvasElement);
|
|
525
590
|
await userEvent.click(canvas.getAllByRole("combobox")[0]);
|
|
526
591
|
};
|
|
527
592
|
|
|
528
|
-
export const
|
|
529
|
-
|
|
530
|
-
const canvas = within(canvasElement);
|
|
531
|
-
const select = canvas.getByRole("combobox");
|
|
532
|
-
await userEvent.click(select);
|
|
533
|
-
};
|
|
534
|
-
export const SelectWithIconsDisplayed = SelectWithIcons.bind({});
|
|
535
|
-
SelectWithIconsDisplayed.play = async ({ canvasElement }) => {
|
|
593
|
+
export const MultipleGroupedOptionsDisplayed = MultipleGroupedOptionsSelect.bind({});
|
|
594
|
+
MultipleGroupedOptionsDisplayed.play = async ({ canvasElement }) => {
|
|
536
595
|
const canvas = within(canvasElement);
|
|
537
596
|
const select = canvas.getByRole("combobox");
|
|
538
597
|
await userEvent.click(select);
|
|
539
598
|
};
|
|
540
599
|
|
|
541
|
-
export const
|
|
542
|
-
|
|
543
|
-
const canvas = within(canvasElement);
|
|
544
|
-
const select = canvas.getByRole("combobox");
|
|
545
|
-
await userEvent.click(select);
|
|
546
|
-
};
|
|
547
|
-
export const SelectMultipleWithIconsDisplayed = SelectMultipleWithIcons.bind({});
|
|
548
|
-
SelectMultipleWithIconsDisplayed.play = async ({ canvasElement }) => {
|
|
600
|
+
export const WithIconsDisplayed = SelectWithIcons.bind({});
|
|
601
|
+
WithIconsDisplayed.play = async ({ canvasElement }) => {
|
|
549
602
|
const canvas = within(canvasElement);
|
|
550
603
|
const select = canvas.getByRole("combobox");
|
|
551
604
|
await userEvent.click(select);
|
|
552
605
|
};
|
|
553
606
|
|
|
554
|
-
export const
|
|
555
|
-
|
|
607
|
+
export const WithRescaledIconsDisplayed = RescaledIcons.bind({});
|
|
608
|
+
WithRescaledIconsDisplayed.play = async ({ canvasElement }) => {
|
|
556
609
|
const canvas = within(canvasElement);
|
|
557
610
|
const select = canvas.getByRole("combobox");
|
|
558
611
|
await userEvent.click(select);
|
|
559
612
|
};
|
|
560
613
|
|
|
561
|
-
export const
|
|
562
|
-
|
|
614
|
+
export const MultipleWithIconsDisplayed = SelectMultipleWithIcons.bind({});
|
|
615
|
+
MultipleWithIconsDisplayed.play = async ({ canvasElement }) => {
|
|
563
616
|
const canvas = within(canvasElement);
|
|
564
617
|
const select = canvas.getByRole("combobox");
|
|
565
618
|
await userEvent.click(select);
|
|
566
619
|
};
|
|
567
620
|
|
|
568
|
-
export const
|
|
569
|
-
|
|
570
|
-
const canvas = within(canvasElement);
|
|
571
|
-
const select = canvas.getByRole("combobox");
|
|
572
|
-
await userEvent.click(select);
|
|
573
|
-
await waitFor(async () => {
|
|
574
|
-
fireEvent.keyDown(select, { key: "ArrowDown", code: "ArrowDown", keyCode: 40, charCode: 40 });
|
|
575
|
-
});
|
|
576
|
-
};
|
|
577
|
-
export const OptionActived = OnlyOneOptionActived.bind({});
|
|
578
|
-
OptionActived.play = async ({ canvasElement }) => {
|
|
579
|
-
const canvas = within(canvasElement);
|
|
580
|
-
const select = canvas.getByRole("combobox");
|
|
581
|
-
await userEvent.click(select);
|
|
582
|
-
};
|
|
583
|
-
export const OptionSelectedHovered = SelectedOptionHovered.bind({});
|
|
584
|
-
OptionSelectedHovered.play = async ({ canvasElement }) => {
|
|
585
|
-
const canvas = within(canvasElement);
|
|
586
|
-
const select = canvas.getByRole("combobox");
|
|
587
|
-
await userEvent.click(select);
|
|
588
|
-
};
|
|
589
|
-
export const OptionSelectedActived = SelectedOptionActived.bind({});
|
|
590
|
-
OptionSelectedActived.play = async ({ canvasElement }) => {
|
|
621
|
+
export const MultipleGroupedWithIconsDisplayed = MultipleGroupedOptionsSelectWithIcons.bind({});
|
|
622
|
+
MultipleGroupedWithIconsDisplayed.play = async ({ canvasElement }) => {
|
|
591
623
|
const canvas = within(canvasElement);
|
|
592
624
|
const select = canvas.getByRole("combobox");
|
|
593
625
|
await userEvent.click(select);
|