@transferwise/components 0.0.0-experimental-75fc27b → 0.0.0-experimental-8a932bb
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 +10 -2
- package/build/avatarLayout/AvatarLayout.js.map +1 -1
- package/build/avatarLayout/AvatarLayout.mjs +10 -2
- package/build/avatarLayout/AvatarLayout.mjs.map +1 -1
- package/build/button/Button/src/Button.js +93 -0
- package/build/button/Button/src/Button.js.map +1 -0
- package/build/button/Button/src/Button.mjs +91 -0
- package/build/button/Button/src/Button.mjs.map +1 -0
- package/build/button/{Button.js → LegacyButton/Button.js} +25 -24
- package/build/button/LegacyButton/Button.js.map +1 -0
- package/build/button/{Button.mjs → LegacyButton/Button.mjs} +25 -24
- package/build/button/LegacyButton/Button.mjs.map +1 -0
- package/build/button/LegacyButton/classMap.js +42 -0
- package/build/button/LegacyButton/classMap.js.map +1 -0
- package/build/button/LegacyButton/classMap.mjs +39 -0
- package/build/button/LegacyButton/classMap.mjs.map +1 -0
- package/build/button/{legacyUtils → LegacyButton/legacyUtils}/legacyUtils.js +21 -21
- package/build/button/LegacyButton/legacyUtils/legacyUtils.js.map +1 -0
- package/build/button/{legacyUtils → LegacyButton/legacyUtils}/legacyUtils.mjs +21 -21
- package/build/button/LegacyButton/legacyUtils/legacyUtils.mjs.map +1 -0
- package/build/button/src/Button.js +76 -0
- package/build/button/src/Button.js.map +1 -0
- package/build/button/src/Button.mjs +74 -0
- package/build/button/src/Button.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 +8 -3
- package/build/link/Link.js.map +1 -1
- package/build/link/Link.mjs +8 -3
- package/build/link/Link.mjs.map +1 -1
- package/build/main.css +288 -29
- 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 +4 -2
- package/build/select/Select.js.map +1 -1
- package/build/select/Select.mjs +4 -2
- package/build/select/Select.mjs.map +1 -1
- package/build/styles/avatarLayout/AvatarLayout.css +11 -0
- package/build/styles/button/Button/less/Button.css +253 -0
- package/build/styles/button/Button/less/Button.vars.css +57 -0
- package/build/styles/iconButton/IconButton.css +24 -29
- package/build/styles/main.css +288 -29
- package/build/types/avatarLayout/AvatarLayout.d.ts +1 -2
- package/build/types/avatarLayout/AvatarLayout.d.ts.map +1 -1
- package/build/types/avatarLayout/index.d.ts +1 -0
- package/build/types/avatarLayout/index.d.ts.map +1 -1
- package/build/types/button/Button/index.d.ts +3 -0
- package/build/types/button/Button/index.d.ts.map +1 -0
- package/build/types/button/Button/src/Button.d.ts +4 -0
- package/build/types/button/Button/src/Button.d.ts.map +1 -0
- package/build/types/button/Button/src/Button.types.d.ts +50 -0
- package/build/types/button/Button/src/Button.types.d.ts.map +1 -0
- package/build/types/button/Button/src/index.d.ts +2 -0
- package/build/types/button/Button/src/index.d.ts.map +1 -0
- package/build/types/button/{Button.d.ts → LegacyButton/Button.d.ts} +6 -4
- package/build/types/button/LegacyButton/Button.d.ts.map +1 -0
- package/build/types/button/LegacyButton/classMap.d.ts.map +1 -0
- package/build/types/button/LegacyButton/index.d.ts +3 -0
- package/build/types/button/LegacyButton/index.d.ts.map +1 -0
- package/build/types/button/LegacyButton/legacyUtils/index.d.ts.map +1 -0
- package/build/types/button/{legacyUtils → LegacyButton/legacyUtils}/legacyUtils.d.ts +1 -1
- package/build/types/button/LegacyButton/legacyUtils/legacyUtils.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/src/Button.d.ts +30 -0
- package/build/types/button/src/Button.d.ts.map +1 -0
- package/build/types/button/src/index.d.ts +3 -0
- package/build/types/button/src/index.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/select/Select.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 +5 -5
- package/src/avatarLayout/AvatarLayout.css +11 -0
- package/src/avatarLayout/AvatarLayout.less +18 -1
- package/src/avatarLayout/AvatarLayout.story.tsx +2 -0
- package/src/avatarLayout/AvatarLayout.tsx +14 -4
- package/src/avatarLayout/index.ts +1 -0
- package/src/avatarWrapper/AvatarWrapper.story.tsx +2 -0
- package/src/button/Button/index.ts +2 -0
- package/src/button/Button/less/Button.css +253 -0
- package/src/button/Button/less/Button.less +221 -0
- package/src/button/Button/less/Button.vars.css +57 -0
- package/src/button/Button/less/Button.vars.less +65 -0
- package/src/button/Button/src/Button.tsx +116 -0
- package/src/button/Button/src/Button.types.ts +70 -0
- package/src/button/Button/src/index.ts +1 -0
- package/src/button/Button/stories/Button.story.tsx +314 -0
- package/src/button/Button/stories/Button.tests.story.tsx +288 -0
- package/src/button/Button/test/Button.spec.tsx +328 -0
- package/src/button/{Button.less → LegacyButton/Button.less} +1 -1
- package/src/button/{Button.spec.tsx → LegacyButton/Button.spec.tsx} +3 -3
- package/src/button/LegacyButton/Button.story.tsx +224 -0
- package/src/button/{Button.tsx → LegacyButton/Button.tsx} +12 -8
- package/src/button/{classMap.ts → LegacyButton/classMap.ts} +1 -1
- package/src/button/LegacyButton/index.ts +3 -0
- package/src/button/{legacyUtils → LegacyButton/legacyUtils}/legacyUtils.spec.tsx +2 -2
- package/src/button/{legacyUtils → LegacyButton/legacyUtils}/legacyUtils.ts +2 -2
- package/src/button/index.ts +2 -3
- package/src/button/src/Button.tsx +118 -0
- package/src/button/src/index.ts +2 -0
- package/src/button/test/Button.spec.tsx +66 -0
- package/src/circularButton/CircularButton.tsx +1 -1
- package/src/common/action/Action.tsx +1 -1
- package/src/iconButton/IconButton.css +24 -29
- package/src/iconButton/IconButton.less +4 -4
- package/src/link/Link.tsx +15 -6
- package/src/main.css +288 -29
- package/src/main.less +2 -1
- package/src/nudge/Nudge.tsx +1 -1
- 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 +2 -3
- package/src/select/Select.tsx +1 -0
- package/src/test-utils/index.tsx +0 -1
- package/build/button/Button.js.map +0 -1
- package/build/button/Button.mjs.map +0 -1
- package/build/button/classMap.js +0 -42
- package/build/button/classMap.js.map +0 -1
- package/build/button/classMap.mjs +0 -39
- package/build/button/classMap.mjs.map +0 -1
- package/build/button/legacyUtils/legacyUtils.js.map +0 -1
- package/build/button/legacyUtils/legacyUtils.mjs.map +0 -1
- package/build/types/button/Button.d.ts.map +0 -1
- package/build/types/button/classMap.d.ts.map +0 -1
- package/build/types/button/legacyUtils/index.d.ts.map +0 -1
- package/build/types/button/legacyUtils/legacyUtils.d.ts.map +0 -1
- package/src/button/Button.story.tsx +0 -163
- /package/build/styles/button/{Button.css → LegacyButton/Button.css} +0 -0
- /package/build/types/button/{classMap.d.ts → LegacyButton/classMap.d.ts} +0 -0
- /package/build/types/button/{legacyUtils → LegacyButton/legacyUtils}/index.d.ts +0 -0
- /package/src/button/{Button.css → LegacyButton/Button.css} +0 -0
- /package/src/button/{__snapshots__ → LegacyButton/__snapshots__}/Button.spec.tsx.snap +0 -0
- /package/src/button/{legacyUtils → LegacyButton/legacyUtils}/index.ts +0 -0
package/src/main.css
CHANGED
|
@@ -518,10 +518,18 @@ 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
|
+
}
|
|
521
525
|
.np-avatar-layout-diagonal-child {
|
|
522
526
|
margin-left: calc(var(--np-avatar-layout-size) - var(--np-avatar-size) * 2);
|
|
523
527
|
margin-top: calc(var(--np-avatar-layout-size) - var(--np-avatar-size));
|
|
524
528
|
}
|
|
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
|
+
}
|
|
525
533
|
.np-avatar-layout-horizontal {
|
|
526
534
|
width: calc(var(--np-avatar-size) * 2 - var(--np-avatar-offset) - 2px);
|
|
527
535
|
height: var(--np-avatar-layout-size);
|
|
@@ -535,81 +543,79 @@ div.critical-comms .critical-comms-body {
|
|
|
535
543
|
.np-avatar-layout-horizontal-child {
|
|
536
544
|
margin-left: calc(var(--np-avatar-offset) * -1);
|
|
537
545
|
}
|
|
546
|
+
[dir="rtl"] .np-avatar-layout-horizontal-child {
|
|
547
|
+
margin-right: calc(var(--np-avatar-offset) * -1);
|
|
548
|
+
}
|
|
538
549
|
.np-icon-button {
|
|
539
550
|
border: none;
|
|
540
551
|
}
|
|
541
552
|
.np-icon-button-tertiary-default {
|
|
542
|
-
color: var(--color-interactive-primary);
|
|
543
|
-
background
|
|
544
|
-
background-color: var(--color-background-neutral);
|
|
553
|
+
--Button-color: var(--color-interactive-primary);
|
|
554
|
+
--Button-background: var(--color-background-neutral);
|
|
545
555
|
}
|
|
546
556
|
.np-icon-button-tertiary-default:not(.disabled):not(:disabled):hover {
|
|
547
|
-
background-
|
|
557
|
+
--Button-background-hover: var(--color-background-neutral-hover);
|
|
548
558
|
}
|
|
549
559
|
.np-icon-button-tertiary-default:not(.disabled):not(:disabled):active {
|
|
550
|
-
background-
|
|
560
|
+
--Button-background-active: var(--color-background-neutral-active);
|
|
551
561
|
}
|
|
552
562
|
.np-icon-button-primary-default {
|
|
553
|
-
color: var(--color-interactive-control);
|
|
554
|
-
background
|
|
555
|
-
background-color: var(--color-interactive-accent);
|
|
563
|
+
--Button-color: var(--color-interactive-control);
|
|
564
|
+
--Button-background: var(--color-interactive-accent);
|
|
556
565
|
}
|
|
557
566
|
.np-icon-button-primary-default:not(.disabled):not(:disabled):hover {
|
|
558
|
-
background-
|
|
559
|
-
background-color: var(--color-interactive-accent-hover);
|
|
567
|
+
--Button-background-hover: var(--color-interactive-accent-hover);
|
|
560
568
|
}
|
|
561
569
|
.np-icon-button-primary-default:not(.disabled):not(:disabled):active {
|
|
562
|
-
background-
|
|
563
|
-
background-color: var(--color-interactive-accent-active);
|
|
570
|
+
--Button-background-active: var(--color-interactive-accent-active);
|
|
564
571
|
}
|
|
565
572
|
.np-icon-button-primary-negative {
|
|
566
|
-
color: var(--color-contrast-overlay);
|
|
567
|
-
background
|
|
573
|
+
--Button-color: var(--color-contrast-overlay);
|
|
574
|
+
--Button-background: var(--color-sentiment-negative-primary);
|
|
568
575
|
}
|
|
569
576
|
.np-icon-button-primary-negative:not(.disabled):not(:disabled):hover {
|
|
570
|
-
background-
|
|
577
|
+
--Button-background-hover: var(--color-sentiment-negative-primary-hover);
|
|
571
578
|
}
|
|
572
579
|
.np-icon-button-primary-negative:not(.disabled):not(:disabled):active {
|
|
573
|
-
background-
|
|
580
|
+
--Button-background-active: var(--color-sentiment-negative-primary-active);
|
|
574
581
|
}
|
|
575
582
|
.np-theme-personal--bright-green .np-icon-button-primary-negative {
|
|
576
583
|
color: var(--color-white);
|
|
577
584
|
}
|
|
578
585
|
.np-icon-button-minimal-default {
|
|
579
|
-
color: var(--color-interactive-primary);
|
|
580
|
-
background
|
|
581
|
-
background-color: var(--color-background-screen);
|
|
586
|
+
--Button-color: var(--color-interactive-primary);
|
|
587
|
+
--Button-background: var(--color-background-screen);
|
|
582
588
|
background-color: transparent;
|
|
583
589
|
}
|
|
584
590
|
.np-icon-button-minimal-default:not(.disabled):not(:disabled):hover {
|
|
585
|
-
background-
|
|
591
|
+
--Button-background-hover: var(--color-background-screen-hover);
|
|
586
592
|
}
|
|
587
593
|
.np-icon-button-minimal-default:not(.disabled):not(:disabled):active {
|
|
588
|
-
background-
|
|
594
|
+
--Button-background-active: var(--color-background-screen-active);
|
|
589
595
|
}
|
|
590
596
|
.np-icon-button-secondary-default {
|
|
591
|
-
color: var(--color-interactive-primary);
|
|
592
|
-
background
|
|
597
|
+
--Button-color: var(--color-interactive-primary);
|
|
598
|
+
--Button-background: var(--color-interactive-neutral);
|
|
593
599
|
}
|
|
594
600
|
.np-icon-button-secondary-default:not(.disabled):not(:disabled):hover {
|
|
595
|
-
background-
|
|
601
|
+
--Button-background-hover: var(--color-interactive-neutral-hover);
|
|
596
602
|
}
|
|
597
603
|
.np-icon-button-secondary-default:not(.disabled):not(:disabled):active {
|
|
598
|
-
background-
|
|
604
|
+
--Button-background-active: var(--color-interactive-neutral-active);
|
|
599
605
|
}
|
|
600
606
|
.np-theme-personal--bright-green .np-icon-button-secondary-default,
|
|
601
607
|
.np-theme-personal--forest-green .np-icon-button-secondary-default {
|
|
602
608
|
color: var(--color-interactive-control);
|
|
603
609
|
}
|
|
604
610
|
.np-icon-button-secondary-negative {
|
|
605
|
-
color: var(--color-sentiment-negative-primary);
|
|
606
|
-
background
|
|
611
|
+
--Button-color: var(--color-sentiment-negative-primary);
|
|
612
|
+
--Button-background: var(--color-sentiment-negative-secondary);
|
|
607
613
|
}
|
|
608
614
|
.np-icon-button-secondary-negative:not(.disabled):not(:disabled):hover {
|
|
609
|
-
background-
|
|
615
|
+
--Button-background-hover: var(--color-sentiment-negative-secondary-hover);
|
|
610
616
|
}
|
|
611
617
|
.np-icon-button-secondary-negative:not(.disabled):not(:disabled):active {
|
|
612
|
-
background-
|
|
618
|
+
--Button-background-active: var(--color-sentiment-negative-secondary-active);
|
|
613
619
|
}
|
|
614
620
|
.np-theme-personal--bright-green .np-icon-button-secondary-negative {
|
|
615
621
|
color: var(--color-white);
|
|
@@ -705,6 +711,259 @@ div.critical-comms .critical-comms-body {
|
|
|
705
711
|
.np-btn.disabled[class] {
|
|
706
712
|
pointer-events: auto;
|
|
707
713
|
}
|
|
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
|
+
}
|
|
708
967
|
.np-card {
|
|
709
968
|
overflow: hidden;
|
|
710
969
|
transition-property: transform, box-shadow;
|
package/src/main.less
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
@import "./avatarLayout/AvatarLayout.less";
|
|
8
8
|
@import "./iconButton/IconButton.less";
|
|
9
9
|
@import "./badge/Badge.less";
|
|
10
|
-
@import "./button/Button.less";
|
|
10
|
+
@import "./button/LegacyButton/Button.less";
|
|
11
|
+
@import "./button/Button/less/Button.less";
|
|
11
12
|
@import "./card/Card.less";
|
|
12
13
|
@import "./carousel/Carousel.less";
|
|
13
14
|
@import "./checkboxButton/CheckboxButton.less";
|
package/src/nudge/Nudge.tsx
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import PrimitiveButton from '..';
|
|
1
|
+
import { screen } from '@testing-library/react';
|
|
2
|
+
import PrimitiveButton from '../src';
|
|
4
3
|
import messages from '../../../i18n/commonMessages/Button.messages';
|
|
5
4
|
import { render } from '../../../test-utils';
|
|
6
5
|
|
package/src/select/Select.tsx
CHANGED
package/src/test-utils/index.tsx
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../src/button/Button.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ElementType, forwardRef, MouseEvent } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport {\n Size,\n ControlType,\n Priority,\n ControlTypeAccent,\n ControlTypeNegative,\n ControlTypePositive,\n PriorityPrimary,\n PrioritySecondary,\n PriorityTertiary,\n SizeExtraSmall,\n SizeSmall,\n SizeMedium,\n SizeLarge,\n} from '../common';\nimport ProcessIndicator from '../processIndicator';\n\nimport messages from '../i18n/commonMessages/Button.messages';\nimport { typeClassMap, priorityClassMap } from './classMap';\nimport { establishNewPriority, establishNewType, logDeprecationNotices } from './legacyUtils';\n\n/** @deprecated */\ntype DeprecatedTypes = 'primary' | 'pay' | 'secondary' | 'danger' | 'link';\n\n/** @deprecated */\ntype DeprecatedSizes = SizeExtraSmall;\n\ntype CommonProps = {\n block?: boolean;\n disabled?: boolean;\n loading?: boolean;\n type?: ControlTypeAccent | ControlTypeNegative | ControlTypePositive | DeprecatedTypes | null;\n priority?: PriorityPrimary | PrioritySecondary | PriorityTertiary | null;\n size?: SizeSmall | SizeMedium | SizeLarge | DeprecatedSizes;\n};\n\ntype ButtonProps = CommonProps &\n Omit<React.ComponentPropsWithRef<'button'>, 'type'> & {\n as?: 'button';\n htmlType?: 'submit' | 'reset' | 'button';\n };\n\ntype AnchorProps = CommonProps &\n Omit<React.ComponentPropsWithRef<'a'>, 'type'> & {\n as?: 'a';\n };\n\nexport type Props = ButtonProps | AnchorProps;\n\nexport type ButtonReferenceType = HTMLButtonElement | HTMLAnchorElement;\n\nconst Button = forwardRef<ButtonReferenceType, Props>(\n (\n {\n as: component,\n block = false,\n children,\n className,\n disabled,\n loading = false,\n priority = Priority.PRIMARY,\n size = Size.MEDIUM,\n type = ControlType.ACCENT,\n onClick,\n ...rest\n }: Props,\n reference,\n ) => {\n const intl = useIntl();\n\n logDeprecationNotices({ size, type });\n\n const newType = establishNewType(type);\n const newPriority = establishNewPriority(priority, type);\n\n const classes = clsx(\n `btn btn-${size}`,\n `np-btn np-btn-${size}`,\n {\n 'btn-loading': loading,\n 'btn-block np-btn-block': block,\n disabled,\n },\n // @ts-expect-error fix when refactor `typeClassMap` to TypeScript\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n typeClassMap[newType],\n // @ts-expect-error fix when refactor `typeClassMap` to TypeScript\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n priorityClassMap[newPriority],\n className,\n );\n\n function processIndicatorSize() {\n return ['sm', 'xs'].includes(size) ? 'xxs' : 'xs';\n }\n\n const Element = (component as ElementType) ?? 'button';\n let props;\n\n if (Element === 'button') {\n const { htmlType = 'button', ...restProps } = rest as ButtonProps;\n props = {\n ...restProps,\n disabled,\n 'aria-disabled': loading,\n type: htmlType,\n };\n } else {\n props = {\n ...rest,\n 'aria-disabled': loading,\n } as AnchorProps;\n }\n\n /**\n * Ensures that the button cannot be activated in loading or disabled mode,\n * when `aria-disabled` might be used over the `disabled` HTML attribute\n */\n const handleClick =\n (handler: Props['onClick']) =>\n (event: MouseEvent<HTMLButtonElement> & MouseEvent<HTMLAnchorElement>) => {\n if (disabled || loading) {\n event.preventDefault();\n } else if (typeof handler === 'function') {\n handler(event);\n }\n };\n\n return (\n <Element\n ref={reference}\n className={classes}\n onClick={handleClick(onClick)}\n {...props}\n aria-live={loading ? 'polite' : 'off'}\n aria-busy={loading}\n aria-label={loading ? intl.formatMessage(messages.loadingAriaLabel) : rest['aria-label']}\n >\n {children}\n {loading && (\n <ProcessIndicator\n size={processIndicatorSize()}\n className=\"btn-loader\"\n data-testid=\"ButtonProgressIndicator\"\n />\n )}\n </Element>\n );\n },\n);\n\nexport default Button;\n"],"names":["Button","forwardRef","as","component","block","children","className","disabled","loading","priority","Priority","PRIMARY","size","Size","MEDIUM","type","ControlType","ACCENT","onClick","rest","reference","intl","useIntl","logDeprecationNotices","newType","establishNewType","newPriority","establishNewPriority","classes","clsx","typeClassMap","priorityClassMap","processIndicatorSize","includes","Element","props","htmlType","restProps","handleClick","handler","event","preventDefault","_jsxs","ref","formatMessage","messages","loadingAriaLabel","_jsx","ProcessIndicator"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuDA,MAAMA,MAAM,gBAAGC,gBAAU,CACvB,CACE;AACEC,EAAAA,EAAE,EAAEC,SAAS;AACbC,EAAAA,KAAK,GAAG,KAAK;EACbC,QAAQ;EACRC,SAAS;EACTC,QAAQ;AACRC,EAAAA,OAAO,GAAG,KAAK;EACfC,QAAQ,GAAGC,gBAAQ,CAACC,OAAO;QAC3BC,MAAI,GAAGC,SAAI,CAACC,MAAM;EAClBC,IAAI,GAAGC,mBAAW,CAACC,MAAM;EACzBC,OAAO;EACP,GAAGC,IAAAA;AACG,CA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hB,IAAI;AACP,MAAA,eAAe,EAAEX,OAAAA;KACH,CAAA;AAClB,GAAA;AAEA;;;AAGG;AACH,EAAA,MAAM8B,WAAW,GACdC,OAAyB,IACzBC,KAAoE,IAAI;IACvE,IAAIjC,QAAQ,IAAIC,OAAO,EAAE;MACvBgC,KAAK,CAACC,cAAc,EAAE,CAAA;AACxB,KAAC,MAAM,IAAI,OAAOF,OAAO,KAAK,UAAU,EAAE;MACxCA,OAAO,CAACC,KAAK,CAAC,CAAA;AAChB,KAAA;GACD,CAAA;EAEH,oBACEE,eAAA,CAACR,OAAO,EAAA;AACNS,IAAAA,GAAG,EAAEvB,SAAU;AACfd,IAAAA,SAAS,EAAEsB,OAAQ;AACnBV,IAAAA,OAAO,EAAEoB,WAAW,CAACpB,OAAO,CAAE;AAAA,IAAA,GAC1BiB,KAAK;AACT,IAAA,WAAA,EAAW3B,OAAO,GAAG,QAAQ,GAAG,KAAM;AACtC,IAAA,WAAA,EAAWA,OAAQ;AACnB,IAAA,YAAA,EAAYA,OAAO,GAAGa,IAAI,CAACuB,aAAa,CAACC,eAAQ,CAACC,gBAAgB,CAAC,GAAG3B,IAAI,CAAC,YAAY,CAAE;AAAAd,IAAAA,QAAA,GAExFA,QAAQ,EACRG,OAAO,iBACNuC,cAAA,CAACC,gBAAgB,EAAA;MACfpC,IAAI,EAAEoB,oBAAoB,EAAG;AAC7B1B,MAAAA,SAAS,EAAC,YAAY;MACtB,aAAY,EAAA,yBAAA;AAAyB,KACrC,CACH,CAAA;AAAA,GACM,CAAC,CAAA;AAEd,CAAC;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Button.mjs","sources":["../../src/button/Button.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ElementType, forwardRef, MouseEvent } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport {\n Size,\n ControlType,\n Priority,\n ControlTypeAccent,\n ControlTypeNegative,\n ControlTypePositive,\n PriorityPrimary,\n PrioritySecondary,\n PriorityTertiary,\n SizeExtraSmall,\n SizeSmall,\n SizeMedium,\n SizeLarge,\n} from '../common';\nimport ProcessIndicator from '../processIndicator';\n\nimport messages from '../i18n/commonMessages/Button.messages';\nimport { typeClassMap, priorityClassMap } from './classMap';\nimport { establishNewPriority, establishNewType, logDeprecationNotices } from './legacyUtils';\n\n/** @deprecated */\ntype DeprecatedTypes = 'primary' | 'pay' | 'secondary' | 'danger' | 'link';\n\n/** @deprecated */\ntype DeprecatedSizes = SizeExtraSmall;\n\ntype CommonProps = {\n block?: boolean;\n disabled?: boolean;\n loading?: boolean;\n type?: ControlTypeAccent | ControlTypeNegative | ControlTypePositive | DeprecatedTypes | null;\n priority?: PriorityPrimary | PrioritySecondary | PriorityTertiary | null;\n size?: SizeSmall | SizeMedium | SizeLarge | DeprecatedSizes;\n};\n\ntype ButtonProps = CommonProps &\n Omit<React.ComponentPropsWithRef<'button'>, 'type'> & {\n as?: 'button';\n htmlType?: 'submit' | 'reset' | 'button';\n };\n\ntype AnchorProps = CommonProps &\n Omit<React.ComponentPropsWithRef<'a'>, 'type'> & {\n as?: 'a';\n };\n\nexport type Props = ButtonProps | AnchorProps;\n\nexport type ButtonReferenceType = HTMLButtonElement | HTMLAnchorElement;\n\nconst Button = forwardRef<ButtonReferenceType, Props>(\n (\n {\n as: component,\n block = false,\n children,\n className,\n disabled,\n loading = false,\n priority = Priority.PRIMARY,\n size = Size.MEDIUM,\n type = ControlType.ACCENT,\n onClick,\n ...rest\n }: Props,\n reference,\n ) => {\n const intl = useIntl();\n\n logDeprecationNotices({ size, type });\n\n const newType = establishNewType(type);\n const newPriority = establishNewPriority(priority, type);\n\n const classes = clsx(\n `btn btn-${size}`,\n `np-btn np-btn-${size}`,\n {\n 'btn-loading': loading,\n 'btn-block np-btn-block': block,\n disabled,\n },\n // @ts-expect-error fix when refactor `typeClassMap` to TypeScript\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n typeClassMap[newType],\n // @ts-expect-error fix when refactor `typeClassMap` to TypeScript\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n priorityClassMap[newPriority],\n className,\n );\n\n function processIndicatorSize() {\n return ['sm', 'xs'].includes(size) ? 'xxs' : 'xs';\n }\n\n const Element = (component as ElementType) ?? 'button';\n let props;\n\n if (Element === 'button') {\n const { htmlType = 'button', ...restProps } = rest as ButtonProps;\n props = {\n ...restProps,\n disabled,\n 'aria-disabled': loading,\n type: htmlType,\n };\n } else {\n props = {\n ...rest,\n 'aria-disabled': loading,\n } as AnchorProps;\n }\n\n /**\n * Ensures that the button cannot be activated in loading or disabled mode,\n * when `aria-disabled` might be used over the `disabled` HTML attribute\n */\n const handleClick =\n (handler: Props['onClick']) =>\n (event: MouseEvent<HTMLButtonElement> & MouseEvent<HTMLAnchorElement>) => {\n if (disabled || loading) {\n event.preventDefault();\n } else if (typeof handler === 'function') {\n handler(event);\n }\n };\n\n return (\n <Element\n ref={reference}\n className={classes}\n onClick={handleClick(onClick)}\n {...props}\n aria-live={loading ? 'polite' : 'off'}\n aria-busy={loading}\n aria-label={loading ? intl.formatMessage(messages.loadingAriaLabel) : rest['aria-label']}\n >\n {children}\n {loading && (\n <ProcessIndicator\n size={processIndicatorSize()}\n className=\"btn-loader\"\n data-testid=\"ButtonProgressIndicator\"\n />\n )}\n </Element>\n );\n },\n);\n\nexport default Button;\n"],"names":["Button","forwardRef","as","component","block","children","className","disabled","loading","priority","Priority","PRIMARY","size","Size","MEDIUM","type","ControlType","ACCENT","onClick","rest","reference","intl","useIntl","logDeprecationNotices","newType","establishNewType","newPriority","establishNewPriority","classes","clsx","typeClassMap","priorityClassMap","processIndicatorSize","includes","Element","props","htmlType","restProps","handleClick","handler","event","preventDefault","_jsxs","ref","formatMessage","messages","loadingAriaLabel","_jsx","ProcessIndicator"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuDA,MAAMA,MAAM,gBAAGC,UAAU,CACvB,CACE;AACEC,EAAAA,EAAE,EAAEC,SAA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"}
|
package/build/button/classMap.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
require('../common/theme.js');
|
|
4
|
-
require('../common/direction.js');
|
|
5
|
-
var control = require('../common/propsValues/control.js');
|
|
6
|
-
require('../common/propsValues/breakpoint.js');
|
|
7
|
-
require('../common/propsValues/size.js');
|
|
8
|
-
require('../common/propsValues/typography.js');
|
|
9
|
-
require('../common/propsValues/width.js');
|
|
10
|
-
require('../common/propsValues/type.js');
|
|
11
|
-
require('../common/propsValues/dateMode.js');
|
|
12
|
-
require('../common/propsValues/monthFormat.js');
|
|
13
|
-
require('../common/propsValues/position.js');
|
|
14
|
-
require('../common/propsValues/layouts.js');
|
|
15
|
-
require('../common/propsValues/status.js');
|
|
16
|
-
require('../common/propsValues/sentiment.js');
|
|
17
|
-
require('../common/propsValues/profileType.js');
|
|
18
|
-
require('../common/propsValues/variant.js');
|
|
19
|
-
require('../common/propsValues/scroll.js');
|
|
20
|
-
require('../common/propsValues/markdownNodeType.js');
|
|
21
|
-
require('../common/fileType.js');
|
|
22
|
-
require('@transferwise/icons');
|
|
23
|
-
require('clsx');
|
|
24
|
-
require('react');
|
|
25
|
-
require('react-intl');
|
|
26
|
-
require('../common/closeButton/CloseButton.messages.js');
|
|
27
|
-
require('react/jsx-runtime');
|
|
28
|
-
|
|
29
|
-
const typeClassMap = {
|
|
30
|
-
[control.ControlType.ACCENT]: 'btn-accent',
|
|
31
|
-
[control.ControlType.POSITIVE]: 'btn-positive',
|
|
32
|
-
[control.ControlType.NEGATIVE]: 'btn-negative'
|
|
33
|
-
};
|
|
34
|
-
const priorityClassMap = {
|
|
35
|
-
[control.Priority.PRIMARY]: 'btn-priority-1',
|
|
36
|
-
[control.Priority.SECONDARY]: 'btn-priority-2',
|
|
37
|
-
[control.Priority.TERTIARY]: 'btn-priority-3'
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
exports.priorityClassMap = priorityClassMap;
|
|
41
|
-
exports.typeClassMap = typeClassMap;
|
|
42
|
-
//# sourceMappingURL=classMap.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"classMap.js","sources":["../../src/button/classMap.ts"],"sourcesContent":["import { ControlType, Priority } from '../common';\n\nexport const typeClassMap = {\n [ControlType.ACCENT]: 'btn-accent',\n [ControlType.POSITIVE]: 'btn-positive',\n [ControlType.NEGATIVE]: 'btn-negative',\n};\n\nexport const priorityClassMap = {\n [Priority.PRIMARY]: 'btn-priority-1',\n [Priority.SECONDARY]: 'btn-priority-2',\n [Priority.TERTIARY]: 'btn-priority-3',\n};\n"],"names":["typeClassMap","ControlType","ACCENT","POSITIVE","NEGATIVE","priorityClassMap","Priority","PRIMARY","SECONDARY","TERTIARY"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,MAAMA,YAAY,GAAG;AAC1B,EAAA,CAACC,mBAAW,CAACC,MAAM,GAAG,YAAY;AAClC,EAAA,CAACD,mBAAW,CAACE,QAAQ,GAAG,cAAc;EACtC,CAACF,mBAAW,CAACG,QAAQ,GAAG,cAAA;EACzB;AAEM,MAAMC,gBAAgB,GAAG;AAC9B,EAAA,CAACC,gBAAQ,CAACC,OAAO,GAAG,gBAAgB;AACpC,EAAA,CAACD,gBAAQ,CAACE,SAAS,GAAG,gBAAgB;EACtC,CAACF,gBAAQ,CAACG,QAAQ,GAAG,gBAAA;;;;;;"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import '../common/theme.mjs';
|
|
2
|
-
import '../common/direction.mjs';
|
|
3
|
-
import { ControlType, Priority } from '../common/propsValues/control.mjs';
|
|
4
|
-
import '../common/propsValues/breakpoint.mjs';
|
|
5
|
-
import '../common/propsValues/size.mjs';
|
|
6
|
-
import '../common/propsValues/typography.mjs';
|
|
7
|
-
import '../common/propsValues/width.mjs';
|
|
8
|
-
import '../common/propsValues/type.mjs';
|
|
9
|
-
import '../common/propsValues/dateMode.mjs';
|
|
10
|
-
import '../common/propsValues/monthFormat.mjs';
|
|
11
|
-
import '../common/propsValues/position.mjs';
|
|
12
|
-
import '../common/propsValues/layouts.mjs';
|
|
13
|
-
import '../common/propsValues/status.mjs';
|
|
14
|
-
import '../common/propsValues/sentiment.mjs';
|
|
15
|
-
import '../common/propsValues/profileType.mjs';
|
|
16
|
-
import '../common/propsValues/variant.mjs';
|
|
17
|
-
import '../common/propsValues/scroll.mjs';
|
|
18
|
-
import '../common/propsValues/markdownNodeType.mjs';
|
|
19
|
-
import '../common/fileType.mjs';
|
|
20
|
-
import '@transferwise/icons';
|
|
21
|
-
import 'clsx';
|
|
22
|
-
import 'react';
|
|
23
|
-
import 'react-intl';
|
|
24
|
-
import '../common/closeButton/CloseButton.messages.mjs';
|
|
25
|
-
import 'react/jsx-runtime';
|
|
26
|
-
|
|
27
|
-
const typeClassMap = {
|
|
28
|
-
[ControlType.ACCENT]: 'btn-accent',
|
|
29
|
-
[ControlType.POSITIVE]: 'btn-positive',
|
|
30
|
-
[ControlType.NEGATIVE]: 'btn-negative'
|
|
31
|
-
};
|
|
32
|
-
const priorityClassMap = {
|
|
33
|
-
[Priority.PRIMARY]: 'btn-priority-1',
|
|
34
|
-
[Priority.SECONDARY]: 'btn-priority-2',
|
|
35
|
-
[Priority.TERTIARY]: 'btn-priority-3'
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export { priorityClassMap, typeClassMap };
|
|
39
|
-
//# sourceMappingURL=classMap.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"classMap.mjs","sources":["../../src/button/classMap.ts"],"sourcesContent":["import { ControlType, Priority } from '../common';\n\nexport const typeClassMap = {\n [ControlType.ACCENT]: 'btn-accent',\n [ControlType.POSITIVE]: 'btn-positive',\n [ControlType.NEGATIVE]: 'btn-negative',\n};\n\nexport const priorityClassMap = {\n [Priority.PRIMARY]: 'btn-priority-1',\n [Priority.SECONDARY]: 'btn-priority-2',\n [Priority.TERTIARY]: 'btn-priority-3',\n};\n"],"names":["typeClassMap","ControlType","ACCENT","POSITIVE","NEGATIVE","priorityClassMap","Priority","PRIMARY","SECONDARY","TERTIARY"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,MAAMA,YAAY,GAAG;AAC1B,EAAA,CAACC,WAAW,CAACC,MAAM,GAAG,YAAY;AAClC,EAAA,CAACD,WAAW,CAACE,QAAQ,GAAG,cAAc;EACtC,CAACF,WAAW,CAACG,QAAQ,GAAG,cAAA;EACzB;AAEM,MAAMC,gBAAgB,GAAG;AAC9B,EAAA,CAACC,QAAQ,CAACC,OAAO,GAAG,gBAAgB;AACpC,EAAA,CAACD,QAAQ,CAACE,SAAS,GAAG,gBAAgB;EACtC,CAACF,QAAQ,CAACG,QAAQ,GAAG,gBAAA;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"legacyUtils.js","sources":["../../../src/button/legacyUtils/legacyUtils.ts"],"sourcesContent":["import { ControlType, Priority, Size, Type } from '../../common';\nimport { logActionRequired, logActionRequiredIf } from '../../utilities';\n\nconst deprecatedTypeMap: Record<Type, ControlType> = {\n [Type.PRIMARY]: ControlType.ACCENT,\n [Type.SECONDARY]: ControlType.ACCENT,\n [Type.LINK]: ControlType.ACCENT,\n [Type.PAY]: ControlType.POSITIVE,\n [Type.DANGER]: ControlType.NEGATIVE,\n};\n\ntype OldTypeKeys = Type.DANGER | Type.LINK | Type.SECONDARY;\nconst oldTypePriorityMap: Record<OldTypeKeys, Priority> = {\n [Type.DANGER]: Priority.SECONDARY,\n [Type.LINK]: Priority.TERTIARY,\n [Type.SECONDARY]: Priority.SECONDARY,\n};\n\nconst deprecatedTypeMapMessage = {\n [Type.DANGER]: 'Type.NEGATIVE',\n [Type.LINK]: 'ControlType.ACCENT with priority Priority.TERTIARY',\n [Type.PAY]: 'ControlType.POSITIVE',\n [Type.PRIMARY]: 'ControlType.ACCENT',\n [Type.SECONDARY]: 'ControlType.ACCENT with priority Priority.SECONDARY',\n};\n\nconst deprecatedTypes = Object.keys(deprecatedTypeMap);\n\ntype EstablishNewTypeType = (\n originalType: Type | (string & Record<never, never>) | null,\n) => `${ControlType}` | string | null;\n\nexport const establishNewType: EstablishNewTypeType = (originalType) =>\n originalType && originalType in deprecatedTypeMap\n ? deprecatedTypeMap[originalType as Type]\n : originalType;\n\ntype EstablishNewPriorityType = (\n originalPriority?: Priority | (string & Record<never, never>) | null,\n originalType?: OldTypeKeys | (string & Record<never, never>) | null,\n) => `${ControlType}` | string | null | undefined;\n\nexport const establishNewPriority: EstablishNewPriorityType = (originalPriority, originalType) => {\n const type = originalType ? establishNewType(originalType) : '';\n\n // The old SECONDARY and LINK types now map to priorities. If they're still using one of\n // these old types, ignore whatever priority they've passed and use this instead.\n if (originalType && originalType in oldTypePriorityMap) {\n return oldTypePriorityMap[originalType as OldTypeKeys];\n }\n // Only ControlType.ACCENT supports tertiary styles\n if (originalPriority === Priority.TERTIARY && type !== ControlType.ACCENT) {\n return Priority.SECONDARY;\n }\n return originalPriority;\n};\n\ntype DeprecatedTypeMapMessageType = keyof typeof deprecatedTypeMapMessage;\ntype LogDeprecationNoticesType = (params: {\n size?: `${Size}`;\n type?: DeprecatedTypeMapMessageType | (string & Record<never, never>) | null;\n}) => void;\nexport const logDeprecationNotices: LogDeprecationNoticesType = ({ size, type }) => {\n logActionRequiredIf(\n 'Button has deprecated the `Size.EXTRA_SMALL` value for the `size` prop. Please use Size.SMALL instead.',\n size === Size.EXTRA_SMALL,\n );\n\n if (type && deprecatedTypes.includes(type) && type in deprecatedTypeMapMessage) {\n logActionRequired(\n `Button has deprecated the ${type} value for the \\`type\\` prop. Please update to ${deprecatedTypeMapMessage[type as DeprecatedTypeMapMessageType]}.`,\n );\n }\n};\n"],"names":["deprecatedTypeMap","Type","PRIMARY","ControlType","ACCENT","SECONDARY","LINK","PAY","POSITIVE","DANGER","NEGATIVE","oldTypePriorityMap","Priority","TERTIARY","deprecatedTypeMapMessage","deprecatedTypes","Object","keys","establishNewType","originalType","establishNewPriority","originalPriority","type","logDeprecationNotices","size","logActionRequiredIf","Size","EXTRA_SMALL","includes","logActionRequired"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAMA,iBAAiB,GAA8B;AACnD,EAAA,CAACC,SAAI,CAACC,OAAO,GAAGC,mBAAW,CAACC,MAAM;AAClC,EAAA,CAACH,SAAI,CAACI,SAAS,GAAGF,mBAAW,CAACC,MAAM;AACpC,EAAA,CAACH,SAAI,CAACK,IAAI,GAAGH,mBAAW,CAACC,MAAM;AAC/B,EAAA,CAACH,SAAI,CAACM,GAAG,GAAGJ,mBAAW,CAACK,QAAQ;AAChC,EAAA,CAACP,SAAI,CAACQ,MAAM,GAAGN,mBAAW,CAACO,QAAAA;CAC5B,CAAA;AAGD,MAAMC,kBAAkB,GAAkC;AACxD,EAAA,CAACV,SAAI,CAACQ,MAAM,GAAGG,gBAAQ,CAACP,SAAS;AACjC,EAAA,CAACJ,SAAI,CAACK,IAAI,GAAGM,gBAAQ,CAACC,QAAQ;AAC9B,EAAA,CAACZ,SAAI,CAACI,SAAS,GAAGO,gBAAQ,CAACP,SAAAA;CAC5B,CAAA;AAED,MAAMS,wBAAwB,GAAG;AAC/B,EAAA,CAACb,SAAI,CAACQ,MAAM,GAAG,eAAe;AAC9B,EAAA,CAACR,SAAI,CAACK,IAAI,GAAG,oDAAoD;AACjE,EAAA,CAACL,SAAI,CAACM,GAAG,GAAG,sBAAsB;AAClC,EAAA,CAACN,SAAI,CAACC,OAAO,GAAG,oBAAoB;EACpC,CAACD,SAAI,CAACI,SAAS,GAAG,qDAAA;CACnB,CAAA;AAED,MAAMU,eAAe,GAAGC,MAAM,CAACC,IAAI,CAACjB,iBAAiB,CAAC,CAAA;MAMzCkB,gBAAgB,GAA0BC,YAAY,IACjEA,YAAY,IAAIA,YAAY,IAAInB,iBAAiB,GAC7CA,iBAAiB,CAACmB,YAAoB,CAAC,GACvCA,aAAY;MAOLC,oBAAoB,GAA6BA,CAACC,gBAAgB,EAAEF,YAAY,KAAI;EAC/F,MAAMG,IAAI,GAAGH,YAAY,GAAGD,gBAAgB,CAACC,YAAY,CAAC,GAAG,EAAE,CAAA;AAE/D;AACA;AACA,EAAA,IAAIA,YAAY,IAAIA,YAAY,IAAIR,kBAAkB,EAAE;IACtD,OAAOA,kBAAkB,CAACQ,YAA2B,CAAC,CAAA;AACxD,GAAA;AACA;EACA,IAAIE,gBAAgB,KAAKT,gBAAQ,CAACC,QAAQ,IAAIS,IAAI,KAAKnB,mBAAW,CAACC,MAAM,EAAE;IACzE,OAAOQ,gBAAQ,CAACP,SAAS,CAAA;AAC3B,GAAA;AACA,EAAA,OAAOgB,gBAAgB,CAAA;AACzB,EAAC;AAOM,MAAME,qBAAqB,GAA8BA,CAAC;QAAEC,MAAI;AAAEF,EAAAA,IAAAA;AAAM,CAAA,KAAI;EACjFG,qCAAmB,CACjB,wGAAwG,EACxGD,MAAI,KAAKE,SAAI,CAACC,WAAW,CAC1B,CAAA;AAED,EAAA,IAAIL,IAAI,IAAIP,eAAe,CAACa,QAAQ,CAACN,IAAI,CAAC,IAAIA,IAAI,IAAIR,wBAAwB,EAAE;IAC9Ee,mCAAiB,CACf,6BAA6BP,IAAI,CAAA,+CAAA,EAAkDR,wBAAwB,CAACQ,IAAoC,CAAC,CAAA,CAAA,CAAG,CACrJ,CAAA;AACH,GAAA;AACF;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"legacyUtils.mjs","sources":["../../../src/button/legacyUtils/legacyUtils.ts"],"sourcesContent":["import { ControlType, Priority, Size, Type } from '../../common';\nimport { logActionRequired, logActionRequiredIf } from '../../utilities';\n\nconst deprecatedTypeMap: Record<Type, ControlType> = {\n [Type.PRIMARY]: ControlType.ACCENT,\n [Type.SECONDARY]: ControlType.ACCENT,\n [Type.LINK]: ControlType.ACCENT,\n [Type.PAY]: ControlType.POSITIVE,\n [Type.DANGER]: ControlType.NEGATIVE,\n};\n\ntype OldTypeKeys = Type.DANGER | Type.LINK | Type.SECONDARY;\nconst oldTypePriorityMap: Record<OldTypeKeys, Priority> = {\n [Type.DANGER]: Priority.SECONDARY,\n [Type.LINK]: Priority.TERTIARY,\n [Type.SECONDARY]: Priority.SECONDARY,\n};\n\nconst deprecatedTypeMapMessage = {\n [Type.DANGER]: 'Type.NEGATIVE',\n [Type.LINK]: 'ControlType.ACCENT with priority Priority.TERTIARY',\n [Type.PAY]: 'ControlType.POSITIVE',\n [Type.PRIMARY]: 'ControlType.ACCENT',\n [Type.SECONDARY]: 'ControlType.ACCENT with priority Priority.SECONDARY',\n};\n\nconst deprecatedTypes = Object.keys(deprecatedTypeMap);\n\ntype EstablishNewTypeType = (\n originalType: Type | (string & Record<never, never>) | null,\n) => `${ControlType}` | string | null;\n\nexport const establishNewType: EstablishNewTypeType = (originalType) =>\n originalType && originalType in deprecatedTypeMap\n ? deprecatedTypeMap[originalType as Type]\n : originalType;\n\ntype EstablishNewPriorityType = (\n originalPriority?: Priority | (string & Record<never, never>) | null,\n originalType?: OldTypeKeys | (string & Record<never, never>) | null,\n) => `${ControlType}` | string | null | undefined;\n\nexport const establishNewPriority: EstablishNewPriorityType = (originalPriority, originalType) => {\n const type = originalType ? establishNewType(originalType) : '';\n\n // The old SECONDARY and LINK types now map to priorities. If they're still using one of\n // these old types, ignore whatever priority they've passed and use this instead.\n if (originalType && originalType in oldTypePriorityMap) {\n return oldTypePriorityMap[originalType as OldTypeKeys];\n }\n // Only ControlType.ACCENT supports tertiary styles\n if (originalPriority === Priority.TERTIARY && type !== ControlType.ACCENT) {\n return Priority.SECONDARY;\n }\n return originalPriority;\n};\n\ntype DeprecatedTypeMapMessageType = keyof typeof deprecatedTypeMapMessage;\ntype LogDeprecationNoticesType = (params: {\n size?: `${Size}`;\n type?: DeprecatedTypeMapMessageType | (string & Record<never, never>) | null;\n}) => void;\nexport const logDeprecationNotices: LogDeprecationNoticesType = ({ size, type }) => {\n logActionRequiredIf(\n 'Button has deprecated the `Size.EXTRA_SMALL` value for the `size` prop. Please use Size.SMALL instead.',\n size === Size.EXTRA_SMALL,\n );\n\n if (type && deprecatedTypes.includes(type) && type in deprecatedTypeMapMessage) {\n logActionRequired(\n `Button has deprecated the ${type} value for the \\`type\\` prop. Please update to ${deprecatedTypeMapMessage[type as DeprecatedTypeMapMessageType]}.`,\n );\n }\n};\n"],"names":["deprecatedTypeMap","Type","PRIMARY","ControlType","ACCENT","SECONDARY","LINK","PAY","POSITIVE","DANGER","NEGATIVE","oldTypePriorityMap","Priority","TERTIARY","deprecatedTypeMapMessage","deprecatedTypes","Object","keys","establishNewType","originalType","establishNewPriority","originalPriority","type","logDeprecationNotices","size","logActionRequiredIf","Size","EXTRA_SMALL","includes","logActionRequired"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAMA,iBAAiB,GAA8B;AACnD,EAAA,CAACC,IAAI,CAACC,OAAO,GAAGC,WAAW,CAACC,MAAM;AAClC,EAAA,CAACH,IAAI,CAACI,SAAS,GAAGF,WAAW,CAACC,MAAM;AACpC,EAAA,CAACH,IAAI,CAACK,IAAI,GAAGH,WAAW,CAACC,MAAM;AAC/B,EAAA,CAACH,IAAI,CAACM,GAAG,GAAGJ,WAAW,CAACK,QAAQ;AAChC,EAAA,CAACP,IAAI,CAACQ,MAAM,GAAGN,WAAW,CAACO,QAAAA;CAC5B,CAAA;AAGD,MAAMC,kBAAkB,GAAkC;AACxD,EAAA,CAACV,IAAI,CAACQ,MAAM,GAAGG,QAAQ,CAACP,SAAS;AACjC,EAAA,CAACJ,IAAI,CAACK,IAAI,GAAGM,QAAQ,CAACC,QAAQ;AAC9B,EAAA,CAACZ,IAAI,CAACI,SAAS,GAAGO,QAAQ,CAACP,SAAAA;CAC5B,CAAA;AAED,MAAMS,wBAAwB,GAAG;AAC/B,EAAA,CAACb,IAAI,CAACQ,MAAM,GAAG,eAAe;AAC9B,EAAA,CAACR,IAAI,CAACK,IAAI,GAAG,oDAAoD;A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AAG,WAAW,GAAG,WAAW,CAAC;AAE9C,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,GAAG,iBAAiB,CAAC;AAExE,QAAA,MAAM,MAAM,uJAkGX,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"classMap.d.ts","sourceRoot":"","sources":["../../../src/button/classMap.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY;;;;CAIxB,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;CAI5B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/button/legacyUtils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"legacyUtils.d.ts","sourceRoot":"","sources":["../../../../src/button/legacyUtils/legacyUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAWjE,KAAK,WAAW,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC;AAO5D,QAAA,MAAM,wBAAwB;;;;;;CAM7B,CAAC;AAIF,KAAK,oBAAoB,GAAG,CAC1B,YAAY,EAAE,IAAI,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,GAAG,IAAI,KACxD,GAAG,WAAW,EAAE,GAAG,MAAM,GAAG,IAAI,CAAC;AAEtC,eAAO,MAAM,gBAAgB,EAAE,oBAGb,CAAC;AAEnB,KAAK,wBAAwB,GAAG,CAC9B,gBAAgB,CAAC,EAAE,QAAQ,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,EA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