@transferwise/components 0.0.0-experimental-a9e2e05 → 0.0.0-experimental-e92f7ac
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/build/avatarLayout/AvatarLayout.js +2 -9
- package/build/avatarLayout/AvatarLayout.js.map +1 -1
- package/build/avatarLayout/AvatarLayout.mjs +2 -9
- package/build/avatarLayout/AvatarLayout.mjs.map +1 -1
- package/build/button/{LegacyButton/Button.js → Button.js} +24 -25
- package/build/button/Button.js.map +1 -0
- package/build/button/{LegacyButton/Button.mjs → Button.mjs} +24 -25
- package/build/button/Button.mjs.map +1 -0
- package/build/button/classMap.js +42 -0
- package/build/button/classMap.js.map +1 -0
- package/build/button/classMap.mjs +39 -0
- package/build/button/classMap.mjs.map +1 -0
- package/build/button/{LegacyButton/legacyUtils → legacyUtils}/legacyUtils.js +21 -21
- package/build/button/legacyUtils/legacyUtils.js.map +1 -0
- package/build/button/{LegacyButton/legacyUtils → legacyUtils}/legacyUtils.mjs +21 -21
- package/build/button/legacyUtils/legacyUtils.mjs.map +1 -0
- package/build/circularButton/CircularButton.js +1 -1
- package/build/circularButton/CircularButton.js.map +1 -1
- package/build/circularButton/CircularButton.mjs +1 -1
- package/build/circularButton/CircularButton.mjs.map +1 -1
- package/build/common/action/Action.js +1 -1
- package/build/common/action/Action.js.map +1 -1
- package/build/common/action/Action.mjs +1 -1
- package/build/common/action/Action.mjs.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.js +1 -1
- package/build/criticalBanner/CriticalCommsBanner.mjs +1 -1
- package/build/header/Header.js +1 -1
- package/build/header/Header.mjs +1 -1
- package/build/index.js +1 -1
- package/build/index.mjs +1 -1
- package/build/link/Link.js +3 -8
- package/build/link/Link.js.map +1 -1
- package/build/link/Link.mjs +3 -8
- package/build/link/Link.mjs.map +1 -1
- package/build/main.css +29 -288
- package/build/nudge/Nudge.js +1 -1
- package/build/nudge/Nudge.js.map +1 -1
- package/build/nudge/Nudge.mjs +1 -1
- package/build/nudge/Nudge.mjs.map +1 -1
- package/build/select/Select.js +1 -1
- package/build/select/Select.mjs +1 -1
- package/build/styles/avatarLayout/AvatarLayout.css +0 -11
- package/build/styles/iconButton/IconButton.css +29 -24
- package/build/styles/main.css +29 -288
- package/build/types/avatarLayout/AvatarLayout.d.ts +2 -1
- package/build/types/avatarLayout/AvatarLayout.d.ts.map +1 -1
- package/build/types/avatarLayout/index.d.ts +0 -1
- package/build/types/avatarLayout/index.d.ts.map +1 -1
- package/build/types/button/{LegacyButton/Button.d.ts → Button.d.ts} +5 -8
- package/build/types/button/Button.d.ts.map +1 -0
- package/build/types/button/classMap.d.ts.map +1 -0
- package/build/types/button/index.d.ts +2 -2
- package/build/types/button/index.d.ts.map +1 -1
- package/build/types/button/legacyUtils/index.d.ts.map +1 -0
- package/build/types/button/{LegacyButton/legacyUtils → legacyUtils}/legacyUtils.d.ts +1 -1
- package/build/types/button/legacyUtils/legacyUtils.d.ts.map +1 -0
- package/build/types/link/Link.d.ts +2 -2
- package/build/types/link/Link.d.ts.map +1 -1
- package/build/types/test-utils/index.d.ts.map +1 -1
- package/build/upload/steps/completeStep/completeStep.js +1 -1
- package/build/upload/steps/completeStep/completeStep.mjs +1 -1
- package/build/upload/steps/processingStep/processingStep.js +1 -1
- package/build/upload/steps/processingStep/processingStep.mjs +1 -1
- package/build/uploadInput/UploadInput.js +1 -1
- package/build/uploadInput/UploadInput.mjs +1 -1
- package/package.json +3 -3
- package/src/avatarLayout/AvatarLayout.css +0 -11
- package/src/avatarLayout/AvatarLayout.less +1 -18
- package/src/avatarLayout/AvatarLayout.tsx +3 -11
- package/src/avatarLayout/index.ts +0 -1
- package/src/avatarWrapper/AvatarWrapper.story.tsx +0 -2
- package/src/button/{LegacyButton/Button.less → Button.less} +1 -1
- package/src/button/{LegacyButton/Button.spec.tsx → Button.spec.tsx} +3 -3
- package/src/button/Button.story.tsx +163 -0
- package/src/button/{LegacyButton/Button.tsx → Button.tsx} +9 -14
- package/src/button/{LegacyButton/classMap.ts → classMap.ts} +1 -1
- package/src/button/index.ts +3 -2
- package/src/button/{LegacyButton/legacyUtils → legacyUtils}/legacyUtils.spec.tsx +2 -2
- package/src/button/{LegacyButton/legacyUtils → legacyUtils}/legacyUtils.ts +2 -2
- package/src/circularButton/CircularButton.tsx +1 -1
- package/src/common/action/Action.tsx +1 -1
- package/src/iconButton/IconButton.css +29 -24
- package/src/iconButton/IconButton.less +4 -4
- package/src/link/Link.tsx +6 -15
- package/src/main.css +29 -288
- package/src/main.less +1 -2
- package/src/nudge/Nudge.tsx +1 -1
- package/src/phoneNumberInput/PhoneNumberInput.spec.tsx +283 -0
- package/src/primitives/PrimitiveAnchor/stories/PrimitiveAnchor.story.tsx +1 -1
- package/src/primitives/PrimitiveAnchor/test/PrimitiveAnchor.spec.tsx +1 -1
- package/src/primitives/PrimitiveButton/stories/PrimitiveButton.story.tsx +1 -1
- package/src/primitives/PrimitiveButton/test/PrimitiveButton.spec.tsx +3 -2
- package/src/test-utils/index.tsx +1 -0
- package/build/button/Button/src/Button.js +0 -93
- package/build/button/Button/src/Button.js.map +0 -1
- package/build/button/Button/src/Button.mjs +0 -91
- package/build/button/Button/src/Button.mjs.map +0 -1
- package/build/button/LegacyButton/Button.js.map +0 -1
- package/build/button/LegacyButton/Button.mjs.map +0 -1
- package/build/button/LegacyButton/classMap.js +0 -42
- package/build/button/LegacyButton/classMap.js.map +0 -1
- package/build/button/LegacyButton/classMap.mjs +0 -39
- package/build/button/LegacyButton/classMap.mjs.map +0 -1
- package/build/button/LegacyButton/legacyUtils/legacyUtils.js.map +0 -1
- package/build/button/LegacyButton/legacyUtils/legacyUtils.mjs.map +0 -1
- package/build/button/src/Button.js +0 -66
- package/build/button/src/Button.js.map +0 -1
- package/build/button/src/Button.mjs +0 -64
- package/build/button/src/Button.mjs.map +0 -1
- package/build/styles/button/Button/less/Button.css +0 -253
- package/build/styles/button/Button/less/Button.vars.css +0 -57
- package/build/types/button/Button/index.d.ts +0 -3
- package/build/types/button/Button/index.d.ts.map +0 -1
- package/build/types/button/Button/src/Button.d.ts +0 -4
- package/build/types/button/Button/src/Button.d.ts.map +0 -1
- package/build/types/button/Button/src/Button.types.d.ts +0 -50
- package/build/types/button/Button/src/Button.types.d.ts.map +0 -1
- package/build/types/button/Button/src/index.d.ts +0 -2
- package/build/types/button/Button/src/index.d.ts.map +0 -1
- package/build/types/button/LegacyButton/Button.d.ts.map +0 -1
- package/build/types/button/LegacyButton/classMap.d.ts.map +0 -1
- package/build/types/button/LegacyButton/index.d.ts +0 -3
- package/build/types/button/LegacyButton/index.d.ts.map +0 -1
- package/build/types/button/LegacyButton/legacyUtils/index.d.ts.map +0 -1
- package/build/types/button/LegacyButton/legacyUtils/legacyUtils.d.ts.map +0 -1
- package/build/types/button/src/Button.d.ts +0 -47
- package/build/types/button/src/Button.d.ts.map +0 -1
- package/build/types/button/src/index.d.ts +0 -3
- package/build/types/button/src/index.d.ts.map +0 -1
- package/src/button/Button/index.ts +0 -2
- package/src/button/Button/less/Button.css +0 -253
- package/src/button/Button/less/Button.less +0 -221
- package/src/button/Button/less/Button.vars.css +0 -57
- package/src/button/Button/less/Button.vars.less +0 -65
- package/src/button/Button/src/Button.tsx +0 -116
- package/src/button/Button/src/Button.types.ts +0 -70
- package/src/button/Button/src/index.ts +0 -1
- package/src/button/Button/stories/Button.story.tsx +0 -314
- package/src/button/Button/stories/Button.tests.story.tsx +0 -288
- package/src/button/Button/test/Button.spec.tsx +0 -328
- package/src/button/LegacyButton/Button.story.tsx +0 -224
- package/src/button/LegacyButton/index.ts +0 -3
- package/src/button/src/Button.tsx +0 -87
- package/src/button/src/index.ts +0 -2
- package/src/button/test/Button.spec.tsx +0 -32
- package/src/phoneNumberInput/PhoneNumberInput.rtl.spec.tsx +0 -32
- package/src/phoneNumberInput/PhoneNumberInput.spec.js +0 -356
- /package/build/styles/button/{LegacyButton/Button.css → Button.css} +0 -0
- /package/build/types/button/{LegacyButton/classMap.d.ts → classMap.d.ts} +0 -0
- /package/build/types/button/{LegacyButton/legacyUtils → legacyUtils}/index.d.ts +0 -0
- /package/src/button/{LegacyButton/Button.css → Button.css} +0 -0
- /package/src/button/{LegacyButton/__snapshots__ → __snapshots__}/Button.spec.tsx.snap +0 -0
- /package/src/button/{LegacyButton/legacyUtils → legacyUtils}/index.ts +0 -0
package/src/main.css
CHANGED
|
@@ -518,18 +518,10 @@ div.critical-comms .critical-comms-body {
|
|
|
518
518
|
-webkit-mask-image: radial-gradient(circle at bottom calc(100% - var(--np-avatar-size) - var(--np-avatar-offset)) right calc(100% - var(--np-avatar-size) - var(--np-avatar-offset)), transparent 0, transparent calc(var(--np-avatar-size) / 2 + 2px), black 0);
|
|
519
519
|
mask-image: radial-gradient(circle at bottom calc(100% - var(--np-avatar-size) - var(--np-avatar-offset)) right calc(100% - var(--np-avatar-size) - var(--np-avatar-offset)), transparent 0, transparent calc(var(--np-avatar-size) / 2 + 2px), black 0);
|
|
520
520
|
}
|
|
521
|
-
[dir="rtl"] .np-avatar-layout-diagonal-mask {
|
|
522
|
-
-webkit-mask-image: radial-gradient(circle at bottom calc(100% - var(--np-avatar-size) - var(--np-avatar-offset)) left calc(100% - var(--np-avatar-size) - var(--np-avatar-offset)), transparent 0, transparent calc(var(--np-avatar-size) / 2 + 2px), black 0);
|
|
523
|
-
mask-image: radial-gradient(circle at bottom calc(100% - var(--np-avatar-size) - var(--np-avatar-offset)) left calc(100% - var(--np-avatar-size) - var(--np-avatar-offset)), transparent 0, transparent calc(var(--np-avatar-size) / 2 + 2px), black 0);
|
|
524
|
-
}
|
|
525
521
|
.np-avatar-layout-diagonal-child {
|
|
526
522
|
margin-left: calc(var(--np-avatar-layout-size) - var(--np-avatar-size) * 2);
|
|
527
523
|
margin-top: calc(var(--np-avatar-layout-size) - var(--np-avatar-size));
|
|
528
524
|
}
|
|
529
|
-
[dir="rtl"] .np-avatar-layout-diagonal-child {
|
|
530
|
-
margin-left: 0;
|
|
531
|
-
margin-right: calc(var(--np-avatar-layout-size) - var(--np-avatar-size) * 2);
|
|
532
|
-
}
|
|
533
525
|
.np-avatar-layout-horizontal {
|
|
534
526
|
width: calc(var(--np-avatar-size) * 2 - var(--np-avatar-offset) - 2px);
|
|
535
527
|
height: var(--np-avatar-layout-size);
|
|
@@ -543,79 +535,81 @@ div.critical-comms .critical-comms-body {
|
|
|
543
535
|
.np-avatar-layout-horizontal-child {
|
|
544
536
|
margin-left: calc(var(--np-avatar-offset) * -1);
|
|
545
537
|
}
|
|
546
|
-
[dir="rtl"] .np-avatar-layout-horizontal-child {
|
|
547
|
-
margin-right: calc(var(--np-avatar-offset) * -1);
|
|
548
|
-
}
|
|
549
538
|
.np-icon-button {
|
|
550
539
|
border: none;
|
|
551
540
|
}
|
|
552
541
|
.np-icon-button-tertiary-default {
|
|
553
|
-
|
|
554
|
-
|
|
542
|
+
color: var(--color-interactive-primary);
|
|
543
|
+
background-color: rgba(134,167,189,0.10196);
|
|
544
|
+
background-color: var(--color-background-neutral);
|
|
555
545
|
}
|
|
556
546
|
.np-icon-button-tertiary-default:not(.disabled):not(:disabled):hover {
|
|
557
|
-
|
|
547
|
+
background-color: var(--color-background-neutral-hover);
|
|
558
548
|
}
|
|
559
549
|
.np-icon-button-tertiary-default:not(.disabled):not(:disabled):active {
|
|
560
|
-
|
|
550
|
+
background-color: var(--color-background-neutral-active);
|
|
561
551
|
}
|
|
562
552
|
.np-icon-button-primary-default {
|
|
563
|
-
|
|
564
|
-
|
|
553
|
+
color: var(--color-interactive-control);
|
|
554
|
+
background-color: #00a2dd;
|
|
555
|
+
background-color: var(--color-interactive-accent);
|
|
565
556
|
}
|
|
566
557
|
.np-icon-button-primary-default:not(.disabled):not(:disabled):hover {
|
|
567
|
-
|
|
558
|
+
background-color: #008fc9;
|
|
559
|
+
background-color: var(--color-interactive-accent-hover);
|
|
568
560
|
}
|
|
569
561
|
.np-icon-button-primary-default:not(.disabled):not(:disabled):active {
|
|
570
|
-
|
|
562
|
+
background-color: #0081ba;
|
|
563
|
+
background-color: var(--color-interactive-accent-active);
|
|
571
564
|
}
|
|
572
565
|
.np-icon-button-primary-negative {
|
|
573
|
-
|
|
574
|
-
|
|
566
|
+
color: var(--color-contrast-overlay);
|
|
567
|
+
background-color: var(--color-sentiment-negative-primary);
|
|
575
568
|
}
|
|
576
569
|
.np-icon-button-primary-negative:not(.disabled):not(:disabled):hover {
|
|
577
|
-
|
|
570
|
+
background-color: var(--color-sentiment-negative-primary-hover);
|
|
578
571
|
}
|
|
579
572
|
.np-icon-button-primary-negative:not(.disabled):not(:disabled):active {
|
|
580
|
-
|
|
573
|
+
background-color: var(--color-sentiment-negative-primary-active);
|
|
581
574
|
}
|
|
582
575
|
.np-theme-personal--bright-green .np-icon-button-primary-negative {
|
|
583
576
|
color: var(--color-white);
|
|
584
577
|
}
|
|
585
578
|
.np-icon-button-minimal-default {
|
|
586
|
-
|
|
587
|
-
|
|
579
|
+
color: var(--color-interactive-primary);
|
|
580
|
+
background-color: #ffffff;
|
|
581
|
+
background-color: var(--color-background-screen);
|
|
588
582
|
background-color: transparent;
|
|
589
583
|
}
|
|
590
584
|
.np-icon-button-minimal-default:not(.disabled):not(:disabled):hover {
|
|
591
|
-
|
|
585
|
+
background-color: var(--color-background-screen-hover);
|
|
592
586
|
}
|
|
593
587
|
.np-icon-button-minimal-default:not(.disabled):not(:disabled):active {
|
|
594
|
-
|
|
588
|
+
background-color: var(--color-background-screen-active);
|
|
595
589
|
}
|
|
596
590
|
.np-icon-button-secondary-default {
|
|
597
|
-
|
|
598
|
-
|
|
591
|
+
color: var(--color-interactive-primary);
|
|
592
|
+
background-color: var(--color-interactive-neutral);
|
|
599
593
|
}
|
|
600
594
|
.np-icon-button-secondary-default:not(.disabled):not(:disabled):hover {
|
|
601
|
-
|
|
595
|
+
background-color: var(--color-interactive-neutral-hover);
|
|
602
596
|
}
|
|
603
597
|
.np-icon-button-secondary-default:not(.disabled):not(:disabled):active {
|
|
604
|
-
|
|
598
|
+
background-color: var(--color-interactive-neutral-active);
|
|
605
599
|
}
|
|
606
600
|
.np-theme-personal--bright-green .np-icon-button-secondary-default,
|
|
607
601
|
.np-theme-personal--forest-green .np-icon-button-secondary-default {
|
|
608
602
|
color: var(--color-interactive-control);
|
|
609
603
|
}
|
|
610
604
|
.np-icon-button-secondary-negative {
|
|
611
|
-
|
|
612
|
-
|
|
605
|
+
color: var(--color-sentiment-negative-primary);
|
|
606
|
+
background-color: var(--color-sentiment-negative-secondary);
|
|
613
607
|
}
|
|
614
608
|
.np-icon-button-secondary-negative:not(.disabled):not(:disabled):hover {
|
|
615
|
-
|
|
609
|
+
background-color: var(--color-sentiment-negative-secondary-hover);
|
|
616
610
|
}
|
|
617
611
|
.np-icon-button-secondary-negative:not(.disabled):not(:disabled):active {
|
|
618
|
-
|
|
612
|
+
background-color: var(--color-sentiment-negative-secondary-active);
|
|
619
613
|
}
|
|
620
614
|
.np-theme-personal--bright-green .np-icon-button-secondary-negative {
|
|
621
615
|
color: var(--color-white);
|
|
@@ -711,259 +705,6 @@ div.critical-comms .critical-comms-body {
|
|
|
711
705
|
.np-btn.disabled[class] {
|
|
712
706
|
pointer-events: auto;
|
|
713
707
|
}
|
|
714
|
-
:root {
|
|
715
|
-
--Button-background: var(--color-interactive-accent);
|
|
716
|
-
--Button-background-hover: var(--color-interactive-accent-hover);
|
|
717
|
-
--Button-background-active: var(--color-interactive-accent-active);
|
|
718
|
-
--Button-color: var(--color-interactive-control);
|
|
719
|
-
--Button-padding: var(--size-8) var(--size-12);
|
|
720
|
-
--Button-border-radius: var(--radius-full);
|
|
721
|
-
--Button-font-size: var(--font-size-16);
|
|
722
|
-
--Button-line-height: var(--size-24);
|
|
723
|
-
--Button-font-weight: var(--font-weight-semi-bold);
|
|
724
|
-
--Button-letter-spacing: -0.011em;
|
|
725
|
-
--Button-size-small-padding: 5px var(--size-12);
|
|
726
|
-
--Button-size-medium-padding: var(--size-8) var(--size-12);
|
|
727
|
-
--Button-size-large-padding: var(--size-12) var(--size-16);
|
|
728
|
-
--Button-avatar-border-color: var(--color-border-neutral);
|
|
729
|
-
--Button-secondary-background: var(--color-interactive-neutral);
|
|
730
|
-
--Button-secondary-background-hover: var(--color-interactive-neutral-hover);
|
|
731
|
-
--Button-secondary-background-active: var(--color-interactive-neutral-active);
|
|
732
|
-
--Button-secondary-color: var(--color-interactive-primary);
|
|
733
|
-
--Button-tertiary-background: var(--color-background-neutral);
|
|
734
|
-
--Button-tertiary-background-hover: var(--color-background-neutral-hover);
|
|
735
|
-
--Button-tertiary-background-active: var(--color-background-neutral-active);
|
|
736
|
-
--Button-tertiary-color: var(--color-content-primary);
|
|
737
|
-
--Button-minimal-background: transparent;
|
|
738
|
-
--Button-minimal-background-hover: var(--color-background-screen-hover);
|
|
739
|
-
--Button-minimal-background-active: var(--color-background-screen-active);
|
|
740
|
-
--Button-minimal-color: var(--color-interactive-primary);
|
|
741
|
-
--Button-primary-negative-background: var(--color-sentiment-negative-primary);
|
|
742
|
-
--Button-primary-negative-background-hover: var(--color-sentiment-negative-primary-hover);
|
|
743
|
-
--Button-primary-negative-background-active: var(--color-sentiment-negative-primary-active);
|
|
744
|
-
--Button-primary-negative-color: var(--color-contrast);
|
|
745
|
-
--Button-primary-netative-avatar-border-color: rgba(255,255,255,0.2);
|
|
746
|
-
--Button-secondary-negative-background: var(--color-sentiment-negative-secondary);
|
|
747
|
-
--Button-secondary-negative-background-hover: var(--color-sentiment-negative-secondary-hover);
|
|
748
|
-
--Button-secondary-negative-background-active: var(--color-sentiment-negative-secondary-active);
|
|
749
|
-
--Button-secondary-negative-color: var(--color-sentiment-negative-primary);
|
|
750
|
-
--Button-secondary-netative-avatar-border-color: rgba(168,32,13,0.12157);
|
|
751
|
-
}
|
|
752
|
-
.np-theme-personal--dark {
|
|
753
|
-
--Button-primary-netative-avatar-border-color: rgba(14,15,12,0.12157);
|
|
754
|
-
}
|
|
755
|
-
.np-theme-personal--forest-green {
|
|
756
|
-
--color-interactive-neutral: rgba(159,232,112,0.2);
|
|
757
|
-
--color-interactive-neutral-hover: rgba(205,255,173,0.2);
|
|
758
|
-
--color-interactive-neutral-active: rgba(236,255,224,0.2);
|
|
759
|
-
--color-sentiment-negative-secondary: rgba(255,196,194,0.2);
|
|
760
|
-
--color-sentiment-negative-secondary-hover: rgba(255,220,219,0.2);
|
|
761
|
-
--color-sentiment-negative-secondary-active: rgba(255,235,235,0.2);
|
|
762
|
-
--Button-primary-netative-avatar-border-color: rgba(14,15,12,0.12157);
|
|
763
|
-
--Button-secondary-netative-avatar-border-color: rgba(14,15,12,0.12157);
|
|
764
|
-
}
|
|
765
|
-
.np-theme-personal--bright-green {
|
|
766
|
-
--color-contrast: #FFFFFF;
|
|
767
|
-
--Button-secondary-color: var(--color-interactive-control);
|
|
768
|
-
--Button-secondary-negative-color: var(--color-contrast);
|
|
769
|
-
--Button-secondary-netative-avatar-border-color: var(--Button-primary-netative-avatar-border-color);
|
|
770
|
-
}
|
|
771
|
-
/* Button Styles */
|
|
772
|
-
.wds-Button {
|
|
773
|
-
display: inline-flex;
|
|
774
|
-
flex: none;
|
|
775
|
-
width: auto;
|
|
776
|
-
align-items: center;
|
|
777
|
-
justify-content: center;
|
|
778
|
-
vertical-align: middle;
|
|
779
|
-
font-weight: 600;
|
|
780
|
-
font-weight: var(--Button-font-weight);
|
|
781
|
-
font-size: 1rem;
|
|
782
|
-
font-size: var(--Button-font-size);
|
|
783
|
-
letter-spacing: -0.011em;
|
|
784
|
-
letter-spacing: var(--Button-letter-spacing);
|
|
785
|
-
line-height: 24px;
|
|
786
|
-
line-height: var(--Button-line-height);
|
|
787
|
-
text-align: center;
|
|
788
|
-
-webkit-text-decoration: none;
|
|
789
|
-
text-decoration: none;
|
|
790
|
-
white-space: nowrap;
|
|
791
|
-
word-wrap: break-word;
|
|
792
|
-
-webkit-appearance: none;
|
|
793
|
-
-moz-appearance: none;
|
|
794
|
-
appearance: none;
|
|
795
|
-
background-color: #00a2dd;
|
|
796
|
-
background-color: var(--Button-background);
|
|
797
|
-
border: none;
|
|
798
|
-
border-radius: 9999px;
|
|
799
|
-
border-radius: var(--Button-border-radius);
|
|
800
|
-
color: var(--Button-color);
|
|
801
|
-
cursor: pointer;
|
|
802
|
-
padding: 8px 12px;
|
|
803
|
-
padding: var(--Button-padding);
|
|
804
|
-
}
|
|
805
|
-
.wds-Button:focus {
|
|
806
|
-
-webkit-text-decoration: none;
|
|
807
|
-
text-decoration: none;
|
|
808
|
-
}
|
|
809
|
-
.wds-Button:hover {
|
|
810
|
-
background-color: #008fc9;
|
|
811
|
-
background-color: var(--Button-background-hover);
|
|
812
|
-
-webkit-text-decoration: none;
|
|
813
|
-
text-decoration: none;
|
|
814
|
-
}
|
|
815
|
-
.wds-Button:active {
|
|
816
|
-
background-color: #0081ba;
|
|
817
|
-
background-color: var(--Button-background-active);
|
|
818
|
-
-webkit-text-decoration: none;
|
|
819
|
-
text-decoration: none;
|
|
820
|
-
}
|
|
821
|
-
.wds-Button:disabled {
|
|
822
|
-
mix-blend-mode: luminosity;
|
|
823
|
-
opacity: 0.45;
|
|
824
|
-
cursor: not-allowed;
|
|
825
|
-
}
|
|
826
|
-
.wds-Button:disabled:hover,
|
|
827
|
-
.wds-Button:disabled:active {
|
|
828
|
-
background-color: #00a2dd;
|
|
829
|
-
background-color: var(--Button-background);
|
|
830
|
-
}
|
|
831
|
-
.wds-Button--secondary {
|
|
832
|
-
--Button-background: var(--Button-secondary-background);
|
|
833
|
-
--Button-background-hover: var(--Button-secondary-hover-background);
|
|
834
|
-
--Button-background-active: var(--Button-secondary-active-background);
|
|
835
|
-
--Button-color: var(--Button-secondary-color);
|
|
836
|
-
}
|
|
837
|
-
.wds-Button--tertiary {
|
|
838
|
-
--Button-background: var(--Button-tertiary-background);
|
|
839
|
-
--Button-background-hover: var(--Button-tertiary-hover-background);
|
|
840
|
-
--Button-background-active: var(--Button-tertiary-active-background);
|
|
841
|
-
--Button-color: var(--Button-tertiary-color);
|
|
842
|
-
}
|
|
843
|
-
.wds-Button--tertiary .wds-Button-icon--right {
|
|
844
|
-
color: var(--color-interactive-primary);
|
|
845
|
-
}
|
|
846
|
-
.wds-Button--minimal {
|
|
847
|
-
--Button-background: var(--Button-minimal-background);
|
|
848
|
-
--Button-background-hover: var(--Button-minimal-hover-background);
|
|
849
|
-
--Button-background-active: var(--Button-minimal-active-background);
|
|
850
|
-
--Button-color: var(--Button-minimal-color);
|
|
851
|
-
-webkit-text-decoration: underline;
|
|
852
|
-
text-decoration: underline;
|
|
853
|
-
}
|
|
854
|
-
.wds-Button--minimal:hover,
|
|
855
|
-
.wds-Button--minimal:hover:active {
|
|
856
|
-
-webkit-text-decoration: underline;
|
|
857
|
-
text-decoration: underline;
|
|
858
|
-
}
|
|
859
|
-
.wds-Button--negative.wds-Button--primary {
|
|
860
|
-
--Button-background: var(--Button-primary-negative-background);
|
|
861
|
-
--Button-background-hover: var(--Button-primary-negative-hover-background);
|
|
862
|
-
--Button-background-active: var(--Button-primary-negative-active-background);
|
|
863
|
-
--Button-color: var(--Button-primary-negative-color);
|
|
864
|
-
--Button-avatar-border-color: var(--Button-primary-netative-avatar-border-color);
|
|
865
|
-
}
|
|
866
|
-
.wds-Button--negative.wds-Button--secondary {
|
|
867
|
-
--Button-background: var(--Button-secondary-negative-background);
|
|
868
|
-
--Button-background-hover: var(--Button-secondary-negative-hover-background);
|
|
869
|
-
--Button-background-active: var(--Button-secondary-negative-active-background);
|
|
870
|
-
--Button-color: var(--Button-secondary-negative-color);
|
|
871
|
-
--Button-avatar-border-color: var(--Button-secondary-netative-avatar-border-color);
|
|
872
|
-
}
|
|
873
|
-
.wds-Button--small {
|
|
874
|
-
--Button-padding: var(--Button-size-small-padding);
|
|
875
|
-
--Button-line-height: 22px;
|
|
876
|
-
--Button-font-size: var(--font-size-14);
|
|
877
|
-
--Button-letter-spacing: -0.006em;
|
|
878
|
-
}
|
|
879
|
-
.wds-Button--small .wds-Button-icon--left {
|
|
880
|
-
margin-right: 4px;
|
|
881
|
-
margin-right: var(--size-4);
|
|
882
|
-
}
|
|
883
|
-
[dir="rtl"] .wds-Button--small .wds-Button-icon--left {
|
|
884
|
-
margin-right: 0;
|
|
885
|
-
margin-left: 4px;
|
|
886
|
-
margin-left: var(--size-4);
|
|
887
|
-
}
|
|
888
|
-
.wds-Button--medium {
|
|
889
|
-
--Button-padding: var(--Button-size-medium-padding);
|
|
890
|
-
}
|
|
891
|
-
.wds-Button--large {
|
|
892
|
-
--Button-padding: var(--Button-size-large-padding);
|
|
893
|
-
}
|
|
894
|
-
.wds-Button--block {
|
|
895
|
-
width: 100%;
|
|
896
|
-
}
|
|
897
|
-
.wds-Button-avatars {
|
|
898
|
-
display: inline-flex;
|
|
899
|
-
margin-right: 5px;
|
|
900
|
-
margin-left: calc(4px * -1);
|
|
901
|
-
margin-left: calc(var(--size-4) * -1);
|
|
902
|
-
}
|
|
903
|
-
[dir="rtl"] .wds-Button-avatars {
|
|
904
|
-
margin-right: 0;
|
|
905
|
-
margin-left: 5px;
|
|
906
|
-
}
|
|
907
|
-
.wds-Button-avatars .np-circle {
|
|
908
|
-
--circle-border-color: var(--Button-avatar-border-color);
|
|
909
|
-
}
|
|
910
|
-
.wds-Button-avatars .np-avatar-view .np-avatar-view-content {
|
|
911
|
-
color: var(--Button-color);
|
|
912
|
-
}
|
|
913
|
-
.wds-Button-icon {
|
|
914
|
-
display: inline-block;
|
|
915
|
-
}
|
|
916
|
-
.wds-Button-icon--left {
|
|
917
|
-
margin-right: 8px;
|
|
918
|
-
margin-right: var(--size-8);
|
|
919
|
-
}
|
|
920
|
-
[dir="rtl"] .wds-Button-icon--left {
|
|
921
|
-
margin-right: 0;
|
|
922
|
-
margin-left: 8px;
|
|
923
|
-
margin-left: var(--size-8);
|
|
924
|
-
}
|
|
925
|
-
.wds-Button-icon--right {
|
|
926
|
-
margin-left: 4px;
|
|
927
|
-
margin-left: var(--size-4);
|
|
928
|
-
}
|
|
929
|
-
[dir="rtl"] .wds-Button-icon--right {
|
|
930
|
-
margin-left: 0;
|
|
931
|
-
margin-right: 4px;
|
|
932
|
-
margin-right: var(--size-4);
|
|
933
|
-
}
|
|
934
|
-
.wds-Button-content {
|
|
935
|
-
position: relative;
|
|
936
|
-
}
|
|
937
|
-
.wds-Button-content--loading .wds-Button-label,
|
|
938
|
-
.wds-Button-content--loading .wds-Button-media,
|
|
939
|
-
.wds-Button-content--loading .wds-Button-icon {
|
|
940
|
-
visibility: hidden;
|
|
941
|
-
opacity: 0;
|
|
942
|
-
}
|
|
943
|
-
.wds-Button-label {
|
|
944
|
-
display: flex;
|
|
945
|
-
justify-content: center;
|
|
946
|
-
align-items: center;
|
|
947
|
-
position: relative;
|
|
948
|
-
}
|
|
949
|
-
.wds-Button-loader {
|
|
950
|
-
position: absolute;
|
|
951
|
-
display: flex;
|
|
952
|
-
justify-content: center;
|
|
953
|
-
align-items: center;
|
|
954
|
-
width: 100%;
|
|
955
|
-
height: 100%;
|
|
956
|
-
}
|
|
957
|
-
.wds-Button-loader .process-circle {
|
|
958
|
-
stroke: var(--Button-color);
|
|
959
|
-
}
|
|
960
|
-
/* RTL Styles */
|
|
961
|
-
[dir="rtl"] .wds-Button .tw-icon-chevron-right,[dir="rtl"] .wds-Button .tw-icon-arrow-right {
|
|
962
|
-
transform: rotate(180deg);
|
|
963
|
-
}
|
|
964
|
-
[dir="rtl"] .wds-Button .tw-icon-chevron-left,[dir="rtl"] .wds-Button .tw-icon-arrow-left {
|
|
965
|
-
transform: rotate(180deg);
|
|
966
|
-
}
|
|
967
708
|
.np-card {
|
|
968
709
|
overflow: hidden;
|
|
969
710
|
transition-property: transform, box-shadow;
|
package/src/main.less
CHANGED
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
@import "./avatarLayout/AvatarLayout.less";
|
|
8
8
|
@import "./iconButton/IconButton.less";
|
|
9
9
|
@import "./badge/Badge.less";
|
|
10
|
-
@import "./button/
|
|
11
|
-
@import "./button/Button/less/Button.less";
|
|
10
|
+
@import "./button/Button.less";
|
|
12
11
|
@import "./card/Card.less";
|
|
13
12
|
@import "./carousel/Carousel.less";
|
|
14
13
|
@import "./checkboxButton/CheckboxButton.less";
|
package/src/nudge/Nudge.tsx
CHANGED
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import { Field } from '../field/Field';
|
|
2
|
+
import {
|
|
3
|
+
mockMatchMedia,
|
|
4
|
+
mockResizeObserver,
|
|
5
|
+
render,
|
|
6
|
+
screen,
|
|
7
|
+
within,
|
|
8
|
+
userEvent,
|
|
9
|
+
} from '../test-utils';
|
|
10
|
+
|
|
11
|
+
import PhoneNumberInput, { PhoneNumberInputProps } from './PhoneNumberInput';
|
|
12
|
+
|
|
13
|
+
mockMatchMedia();
|
|
14
|
+
mockResizeObserver();
|
|
15
|
+
|
|
16
|
+
describe('PhoneNumberInput', () => {
|
|
17
|
+
afterEach(jest.clearAllMocks);
|
|
18
|
+
|
|
19
|
+
const props = { onChange: jest.fn() };
|
|
20
|
+
|
|
21
|
+
const customRender = (overrides: Partial<PhoneNumberInputProps> = {}, locale?: string) =>
|
|
22
|
+
render(<PhoneNumberInput {...props} {...overrides} />, { locale });
|
|
23
|
+
|
|
24
|
+
const getPrefixEl = () => screen.getByRole('combobox');
|
|
25
|
+
const getInputEl = () => screen.getByRole('textbox');
|
|
26
|
+
|
|
27
|
+
describe('defaults', () => {
|
|
28
|
+
it('should set prefix control to default UK value', () => {
|
|
29
|
+
customRender();
|
|
30
|
+
expect(getPrefixEl()).toHaveTextContent('+44');
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('should set number control to empty', () => {
|
|
34
|
+
customRender();
|
|
35
|
+
expect(getInputEl()).toHaveValue('');
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('should not disable the select', () => {
|
|
39
|
+
customRender();
|
|
40
|
+
expect(getPrefixEl()).toBeEnabled();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('should not disable the input', () => {
|
|
44
|
+
customRender();
|
|
45
|
+
expect(getInputEl()).toBeEnabled();
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('should propagate `initialValue`', () => {
|
|
50
|
+
const prefix = '+39';
|
|
51
|
+
const number = '123456789';
|
|
52
|
+
customRender({ initialValue: `${prefix}${number}` });
|
|
53
|
+
expect(getPrefixEl()).toHaveTextContent(prefix);
|
|
54
|
+
expect(getInputEl()).toHaveValue(number);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
describe('id prop', () => {
|
|
58
|
+
it('should not render id by default', () => {
|
|
59
|
+
customRender();
|
|
60
|
+
expect(getPrefixEl()).not.toHaveAttribute('id');
|
|
61
|
+
expect(getInputEl()).not.toHaveAttribute('id');
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('should respect `id` for the input and ignore the select', () => {
|
|
65
|
+
const id = 'component-id';
|
|
66
|
+
customRender({ id });
|
|
67
|
+
expect(getPrefixEl()).not.toHaveAttribute('id');
|
|
68
|
+
expect(getInputEl()).toHaveAttribute('id', id);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
describe('pasting', () => {
|
|
73
|
+
const initialPrefix = '+48';
|
|
74
|
+
const initialNumber = '987654321';
|
|
75
|
+
|
|
76
|
+
const renderAndPaste = async (value: string) => {
|
|
77
|
+
customRender({ initialValue: `${initialPrefix}${initialNumber}` });
|
|
78
|
+
await userEvent.tab();
|
|
79
|
+
await userEvent.tab();
|
|
80
|
+
await userEvent.paste(value);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
[
|
|
84
|
+
{ number: '+36303932551', countryCode: '+36', localNumber: '303932551' },
|
|
85
|
+
{ number: '+39123456781', countryCode: '+39', localNumber: '123456781' },
|
|
86
|
+
{ number: '+44 7700 900415', countryCode: '+44', localNumber: '7700900415' },
|
|
87
|
+
{ number: '+2975557308515', countryCode: '+297', localNumber: '5557308515' },
|
|
88
|
+
{ number: '+297-555-7217-360', countryCode: '+297', localNumber: '5557217360' },
|
|
89
|
+
{ number: '+213-555-5160-67', countryCode: '+213', localNumber: '555516067' },
|
|
90
|
+
{ number: '+246-387-5553', countryCode: '+246', localNumber: '3875553' },
|
|
91
|
+
{ number: '+852-940-5558--6', countryCode: '+852', localNumber: '94055586' },
|
|
92
|
+
{ number: '+228 253 5558 4', countryCode: '+228', localNumber: '25355584' },
|
|
93
|
+
].forEach(({ number, countryCode, localNumber }) => {
|
|
94
|
+
it(`'${number}' number should update the value properly`, async () => {
|
|
95
|
+
await renderAndPaste(number);
|
|
96
|
+
|
|
97
|
+
expect(getPrefixEl()).toHaveTextContent(countryCode);
|
|
98
|
+
expect(getInputEl()).toHaveValue(localNumber);
|
|
99
|
+
expect(props.onChange).toHaveBeenCalledWith(number.replace(/[\s-]+/g, ''), countryCode);
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('should not paste invalid characters', async () => {
|
|
104
|
+
await renderAndPaste('+36asdasdasd');
|
|
105
|
+
expect(getPrefixEl()).toHaveTextContent(initialPrefix);
|
|
106
|
+
expect(getInputEl()).toHaveValue(initialNumber);
|
|
107
|
+
expect(props.onChange).not.toHaveBeenCalled();
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it('should not paste countries which are not in the select', async () => {
|
|
111
|
+
await renderAndPaste('+9992342343423');
|
|
112
|
+
expect(getPrefixEl()).toHaveTextContent(initialPrefix);
|
|
113
|
+
expect(getInputEl()).toHaveValue(initialNumber);
|
|
114
|
+
expect(props.onChange).not.toHaveBeenCalled();
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it("should not paste numbers which doesn't start with the country code", async () => {
|
|
118
|
+
await renderAndPaste('0+36303932551');
|
|
119
|
+
expect(getPrefixEl()).toHaveTextContent(initialPrefix);
|
|
120
|
+
expect(getInputEl()).toHaveValue(initialNumber);
|
|
121
|
+
expect(props.onChange).not.toHaveBeenCalled();
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
it("should allow pasting numbers which don't contain a country code", async () => {
|
|
125
|
+
const newNumber = '06303932551';
|
|
126
|
+
await renderAndPaste(newNumber);
|
|
127
|
+
expect(getPrefixEl()).toHaveTextContent(initialPrefix);
|
|
128
|
+
expect(getInputEl()).toHaveValue(newNumber);
|
|
129
|
+
expect(props.onChange).toHaveBeenCalledWith(`${initialPrefix}${newNumber}`, initialPrefix);
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
describe('initialValue', () => {
|
|
134
|
+
describe('when a model is supplied that could match more than one prefix', () => {
|
|
135
|
+
const initialProps = { initialValue: '+1868123456789' };
|
|
136
|
+
|
|
137
|
+
it('should set the select to the longest matching prefix', () => {
|
|
138
|
+
customRender(initialProps);
|
|
139
|
+
expect(getPrefixEl()).toHaveTextContent('+1868');
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
it('should set the number input to the rest of the number', () => {
|
|
143
|
+
customRender(initialProps);
|
|
144
|
+
expect(getInputEl()).toHaveValue('123456789');
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
describe('when a model is supplied with no matching prefix', () => {
|
|
149
|
+
const initialProps = { initialValue: '+999123456789' };
|
|
150
|
+
|
|
151
|
+
it('should empty the select', () => {
|
|
152
|
+
customRender(initialProps);
|
|
153
|
+
expect(getPrefixEl()).toHaveTextContent('Select an option...');
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
it('should put the whole value in the input without the plus', () => {
|
|
157
|
+
customRender(initialProps);
|
|
158
|
+
expect(getInputEl()).toHaveValue('999123456789');
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
describe('when an invalid model is supplied', () => {
|
|
163
|
+
it('should not re-explode model', () => {
|
|
164
|
+
customRender({ initialValue: '+123' });
|
|
165
|
+
expect(getPrefixEl()).toHaveTextContent('+44');
|
|
166
|
+
expect(getInputEl()).toHaveValue('');
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
describe('when disabled is true', () => {
|
|
172
|
+
it('should disable both controls', () => {
|
|
173
|
+
customRender({ disabled: true });
|
|
174
|
+
expect(getPrefixEl()).toBeDisabled();
|
|
175
|
+
expect(getInputEl()).toBeDisabled();
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
describe('placeholders', () => {
|
|
180
|
+
it('should use the provided placeholder', () => {
|
|
181
|
+
const placeholder = 'custom placeholder';
|
|
182
|
+
customRender({ placeholder });
|
|
183
|
+
expect(getInputEl()).toHaveAttribute('placeholder', placeholder);
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
it('should use the provided searchPlaceholder', async () => {
|
|
187
|
+
const searchPlaceholder = 'search placeholder';
|
|
188
|
+
customRender({ searchPlaceholder });
|
|
189
|
+
await userEvent.click(getPrefixEl());
|
|
190
|
+
expect(screen.getByRole('combobox', { name: searchPlaceholder })).toBeInTheDocument();
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
describe('when supplied with a locale', () => {
|
|
195
|
+
describe('and a value', () => {
|
|
196
|
+
it('should use the prefix of the supplied value', () => {
|
|
197
|
+
customRender({ initialValue: '+12345678' }, 'es');
|
|
198
|
+
expect(getPrefixEl()).toHaveTextContent('+1');
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
describe('and no value', () => {
|
|
203
|
+
describe('and no country code', () => {
|
|
204
|
+
it('should default the prefix to the local country', () => {
|
|
205
|
+
customRender(undefined, 'es');
|
|
206
|
+
expect(getPrefixEl()).toHaveTextContent('+34');
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
describe('and country code', () => {
|
|
211
|
+
it('should override locale prefix with country specific prefix', () => {
|
|
212
|
+
customRender({ countryCode: 'US' }, 'es');
|
|
213
|
+
expect(getPrefixEl()).toHaveTextContent('+1');
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
describe('user input', () => {
|
|
220
|
+
describe('valid number', () => {
|
|
221
|
+
it('should trigger onChange handler', async () => {
|
|
222
|
+
customRender();
|
|
223
|
+
await userEvent.type(getInputEl(), '123');
|
|
224
|
+
expect(props.onChange).toHaveBeenCalledWith('+44123', '+44');
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
describe('invalid number', () => {
|
|
229
|
+
it('should trigger onChange with null value', async () => {
|
|
230
|
+
customRender({ initialValue: '+1234' });
|
|
231
|
+
await userEvent.type(getInputEl(), '{Backspace}{Backspace}{Backspace}1');
|
|
232
|
+
expect(props.onChange).toHaveBeenCalledWith(null, '+1');
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
describe('when user insert invalid character', () => {
|
|
237
|
+
it('should strip them', async () => {
|
|
238
|
+
customRender({ initialValue: '+12345678' });
|
|
239
|
+
await userEvent.type(getInputEl(), '123--');
|
|
240
|
+
expect(props.onChange).toHaveBeenCalledWith('+12345678123', '+1');
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
describe('overlapping prefix and suffix numbers', () => {
|
|
245
|
+
it("shouldn't change the prefix number on matching suffix input", async () => {
|
|
246
|
+
customRender({ countryCode: 'eg' });
|
|
247
|
+
await userEvent.type(getInputEl(), '1111111');
|
|
248
|
+
expect(getInputEl()).toHaveValue('1111111');
|
|
249
|
+
expect(props.onChange).toHaveBeenCalledWith('+201111111', '+20');
|
|
250
|
+
});
|
|
251
|
+
});
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
describe('when selectProps is supplied', () => {
|
|
255
|
+
it('renders Select component with expected props', () => {
|
|
256
|
+
customRender({ selectProps: { className: 'custom-class' } });
|
|
257
|
+
expect(getPrefixEl().parentElement).toHaveClass('custom-class');
|
|
258
|
+
});
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
it('supports custom `aria-labelledby` attribute', () => {
|
|
262
|
+
render(
|
|
263
|
+
<>
|
|
264
|
+
{/* eslint-disable-next-line jsx-a11y/label-has-associated-control */}
|
|
265
|
+
<label id="prioritized-label">Prioritized label</label>
|
|
266
|
+
<PhoneNumberInput aria-labelledby="prioritized-label" onChange={() => {}} />
|
|
267
|
+
</>,
|
|
268
|
+
);
|
|
269
|
+
|
|
270
|
+
expect(
|
|
271
|
+
within(screen.getByLabelText('Prioritized label')).getByRole('textbox'),
|
|
272
|
+
).toBeInTheDocument();
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
it('supports `Field` for labeling', () => {
|
|
276
|
+
render(
|
|
277
|
+
<Field label="Phone number">
|
|
278
|
+
<PhoneNumberInput initialValue="+12345678" onChange={() => {}} />
|
|
279
|
+
</Field>,
|
|
280
|
+
);
|
|
281
|
+
expect(screen.getAllByRole('group')[0]).toHaveAccessibleName(/^Phone number/);
|
|
282
|
+
});
|
|
283
|
+
});
|