@dxc-technology/halstack-react 0.0.0-8aa8e6b → 0.0.0-8c10296
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.d.ts +4 -2
- package/HalstackContext.js +110 -58
- package/alert/Alert.js +4 -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 +31 -32
- package/bleed/types.d.ts +1 -1
- package/box/Box.js +22 -32
- package/button/Button.js +3 -1
- package/card/Card.js +34 -36
- package/checkbox/Checkbox.js +4 -1
- package/common/variables.js +176 -78
- package/date-input/DateInput.js +5 -2
- package/file-input/FileInput.js +9 -6
- package/file-input/FileItem.js +7 -5
- package/footer/Footer.js +7 -5
- package/header/Header.js +7 -4
- package/inline/Inline.d.ts +4 -0
- package/inline/Inline.js +54 -0
- package/inline/Inline.stories.tsx +240 -0
- package/inline/types.d.ts +32 -0
- package/{quick-nav-container → inline}/types.js +0 -0
- package/inset/Inset.js +1 -34
- package/inset/Inset.stories.tsx +32 -32
- 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 +3 -2
- package/link/Link.js +57 -70
- package/link/Link.stories.tsx +87 -52
- package/link/Link.test.js +7 -15
- package/link/types.d.ts +7 -23
- package/main.d.ts +5 -4
- package/main.js +25 -11
- package/number-input/types.d.ts +1 -1
- package/package.json +2 -1
- package/paginator/Paginator.js +17 -38
- package/paginator/Paginator.test.js +42 -0
- package/password-input/PasswordInput.js +7 -4
- package/password-input/PasswordInput.test.js +1 -2
- package/password-input/types.d.ts +1 -1
- package/progress-bar/ProgressBar.js +1 -1
- package/progress-bar/ProgressBar.stories.jsx +11 -11
- package/quick-nav/QuickNav.js +65 -17
- package/quick-nav/QuickNav.stories.tsx +2 -2
- package/quick-nav/types.d.ts +1 -1
- package/radio-group/Radio.js +1 -1
- package/radio-group/RadioGroup.js +8 -6
- package/resultsetTable/ResultsetTable.test.js +42 -0
- package/select/Listbox.d.ts +1 -1
- package/select/Listbox.js +35 -8
- package/select/Select.js +83 -78
- package/select/Select.stories.tsx +144 -100
- 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/spinner/Spinner.js +1 -1
- package/switch/Switch.js +4 -1
- 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/{radio → tabs-nav}/types.js +0 -0
- package/text-input/Suggestion.d.ts +4 -0
- package/text-input/Suggestion.js +55 -0
- package/text-input/TextInput.js +46 -72
- package/text-input/TextInput.test.js +1 -1
- package/text-input/types.d.ts +14 -2
- package/textarea/Textarea.js +10 -19
- package/textarea/types.d.ts +1 -1
- package/useTranslatedLabels.d.ts +2 -0
- package/useTranslatedLabels.js +20 -0
- package/wizard/Wizard.js +27 -25
- package/quick-nav-container/HeadingLink.d.ts +0 -8
- package/quick-nav-container/HeadingLink.js +0 -58
- package/quick-nav-container/QuickNavContainer.d.ts +0 -4
- package/quick-nav-container/QuickNavContainer.js +0 -69
- package/quick-nav-container/Section.d.ts +0 -9
- package/quick-nav-container/Section.js +0 -37
- package/quick-nav-container/types.d.ts +0 -34
- 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,13 +454,18 @@ 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
|
-
<DxcSelect
|
|
460
|
+
<DxcSelect
|
|
461
|
+
label="Select Label"
|
|
462
|
+
searchable
|
|
463
|
+
defaultValue="1"
|
|
464
|
+
options={single_options}
|
|
465
|
+
placeholder="Choose an option"
|
|
466
|
+
/>
|
|
375
467
|
</ExampleContainer>
|
|
376
468
|
);
|
|
377
|
-
|
|
378
469
|
const MultipleSelect = () => (
|
|
379
470
|
<>
|
|
380
471
|
<ExampleContainer expanded>
|
|
@@ -398,7 +489,13 @@ const DefaultGroupedOptionsSelect = () => (
|
|
|
398
489
|
const MultipleGroupedOptionsSelect = () => (
|
|
399
490
|
<ExampleContainer expanded>
|
|
400
491
|
<Title title="Grouped options multiple select" theme="light" level={4} />
|
|
401
|
-
<DxcSelect
|
|
492
|
+
<DxcSelect
|
|
493
|
+
label="Label"
|
|
494
|
+
options={group_options}
|
|
495
|
+
defaultValue={["0", "2"]}
|
|
496
|
+
multiple
|
|
497
|
+
placeholder="Choose an option"
|
|
498
|
+
/>
|
|
402
499
|
</ExampleContainer>
|
|
403
500
|
);
|
|
404
501
|
const RescaledIcons = () => (
|
|
@@ -431,36 +528,7 @@ const MultipleGroupedOptionsSelectWithIcons = () => (
|
|
|
431
528
|
/>
|
|
432
529
|
</ExampleContainer>
|
|
433
530
|
);
|
|
434
|
-
|
|
435
|
-
<ExampleContainer pseudoState="pseudo-hover" expanded>
|
|
436
|
-
<Title title="Hovered Option" theme="light" level={4} />
|
|
437
|
-
<DxcSelect label="Hovered" options={one_option} placeholder="Choose an option" />
|
|
438
|
-
</ExampleContainer>
|
|
439
|
-
);
|
|
440
|
-
const OnlyOneOptionFocused = () => (
|
|
441
|
-
<ExampleContainer pseudoState="pseudo-focus" expanded>
|
|
442
|
-
<Title title="Focused Option" theme="light" level={4} />
|
|
443
|
-
<DxcSelect label="Focused" options={one_option} placeholder="Choose an option" />
|
|
444
|
-
</ExampleContainer>
|
|
445
|
-
);
|
|
446
|
-
const OnlyOneOptionActived = () => (
|
|
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" defaultValue="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" defaultValue="1" options={one_option} placeholder="Choose an option" />
|
|
462
|
-
</ExampleContainer>
|
|
463
|
-
);
|
|
531
|
+
|
|
464
532
|
const MultipleSearchable = () => (
|
|
465
533
|
<ExampleContainer expanded>
|
|
466
534
|
<Title title="Searchable multiple select with value" theme="light" level={4} />
|
|
@@ -474,12 +542,20 @@ const MultipleSearchable = () => (
|
|
|
474
542
|
/>
|
|
475
543
|
</ExampleContainer>
|
|
476
544
|
);
|
|
477
|
-
|
|
478
|
-
|
|
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 }) => {
|
|
479
554
|
const canvas = within(canvasElement);
|
|
480
555
|
const select = canvas.getByRole("combobox");
|
|
481
556
|
await userEvent.click(select);
|
|
482
557
|
};
|
|
558
|
+
|
|
483
559
|
export const Searchable = SearchableSelect.bind({});
|
|
484
560
|
Searchable.play = async ({ canvasElement }) => {
|
|
485
561
|
const canvas = within(canvasElement);
|
|
@@ -488,14 +564,15 @@ Searchable.play = async ({ canvasElement }) => {
|
|
|
488
564
|
userEvent.type(canvas.getByRole("combobox"), "r");
|
|
489
565
|
});
|
|
490
566
|
};
|
|
491
|
-
|
|
492
|
-
|
|
567
|
+
|
|
568
|
+
export const SearchableWithValue = SearchValue.bind({});
|
|
569
|
+
SearchableWithValue.play = async ({ canvasElement }) => {
|
|
493
570
|
const canvas = within(canvasElement);
|
|
494
571
|
await userEvent.click(canvas.getByRole("combobox"));
|
|
495
572
|
};
|
|
496
573
|
|
|
497
|
-
export const
|
|
498
|
-
|
|
574
|
+
export const MultipleSearchableWithValue = MultipleSearchable.bind({});
|
|
575
|
+
MultipleSearchableWithValue.play = async ({ canvasElement }) => {
|
|
499
576
|
const canvas = within(canvasElement);
|
|
500
577
|
await userEvent.click(canvas.getAllByRole("combobox")[0]);
|
|
501
578
|
};
|
|
@@ -507,75 +584,42 @@ GroupOptionsDisplayed.play = async ({ canvasElement }) => {
|
|
|
507
584
|
await userEvent.click(select);
|
|
508
585
|
};
|
|
509
586
|
|
|
510
|
-
export const
|
|
511
|
-
|
|
587
|
+
export const MultipleOptionsDisplayed = MultipleSelect.bind({});
|
|
588
|
+
MultipleOptionsDisplayed.play = async ({ canvasElement }) => {
|
|
512
589
|
const canvas = within(canvasElement);
|
|
513
590
|
await userEvent.click(canvas.getAllByRole("combobox")[0]);
|
|
514
591
|
};
|
|
515
592
|
|
|
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 }) => {
|
|
593
|
+
export const MultipleGroupedOptionsDisplayed = MultipleGroupedOptionsSelect.bind({});
|
|
594
|
+
MultipleGroupedOptionsDisplayed.play = async ({ canvasElement }) => {
|
|
524
595
|
const canvas = within(canvasElement);
|
|
525
596
|
const select = canvas.getByRole("combobox");
|
|
526
597
|
await userEvent.click(select);
|
|
527
598
|
};
|
|
528
599
|
|
|
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 }) => {
|
|
600
|
+
export const WithIconsDisplayed = SelectWithIcons.bind({});
|
|
601
|
+
WithIconsDisplayed.play = async ({ canvasElement }) => {
|
|
537
602
|
const canvas = within(canvasElement);
|
|
538
603
|
const select = canvas.getByRole("combobox");
|
|
539
604
|
await userEvent.click(select);
|
|
540
605
|
};
|
|
541
606
|
|
|
542
|
-
export const
|
|
543
|
-
|
|
607
|
+
export const WithRescaledIconsDisplayed = RescaledIcons.bind({});
|
|
608
|
+
WithRescaledIconsDisplayed.play = async ({ canvasElement }) => {
|
|
544
609
|
const canvas = within(canvasElement);
|
|
545
610
|
const select = canvas.getByRole("combobox");
|
|
546
611
|
await userEvent.click(select);
|
|
547
612
|
};
|
|
548
613
|
|
|
549
|
-
export const
|
|
550
|
-
|
|
614
|
+
export const MultipleWithIconsDisplayed = SelectMultipleWithIcons.bind({});
|
|
615
|
+
MultipleWithIconsDisplayed.play = async ({ canvasElement }) => {
|
|
551
616
|
const canvas = within(canvasElement);
|
|
552
617
|
const select = canvas.getByRole("combobox");
|
|
553
618
|
await userEvent.click(select);
|
|
554
619
|
};
|
|
555
620
|
|
|
556
|
-
export const
|
|
557
|
-
|
|
558
|
-
const canvas = within(canvasElement);
|
|
559
|
-
const select = canvas.getByRole("combobox");
|
|
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);
|
|
570
|
-
};
|
|
571
|
-
export const OptionSelectedHovered = SelectedOptionHovered.bind({});
|
|
572
|
-
OptionSelectedHovered.play = async ({ canvasElement }) => {
|
|
573
|
-
const canvas = within(canvasElement);
|
|
574
|
-
const select = canvas.getByRole("combobox");
|
|
575
|
-
await userEvent.click(select);
|
|
576
|
-
};
|
|
577
|
-
export const OptionSelectedActived = SelectedOptionActived.bind({});
|
|
578
|
-
OptionSelectedActived.play = async ({ canvasElement }) => {
|
|
621
|
+
export const MultipleGroupedWithIconsDisplayed = MultipleGroupedOptionsSelectWithIcons.bind({});
|
|
622
|
+
MultipleGroupedWithIconsDisplayed.play = async ({ canvasElement }) => {
|
|
579
623
|
const canvas = within(canvasElement);
|
|
580
624
|
const select = canvas.getByRole("combobox");
|
|
581
625
|
await userEvent.click(select);
|