@transferwise/components 0.0.0-experimental-3d57e31 → 0.0.0-experimental-0315684
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/Button.js +79 -78
- package/build/button/Button.js.map +1 -1
- package/build/button/Button.mjs +80 -79
- package/build/button/Button.mjs.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.js +2 -2
- package/build/criticalBanner/CriticalCommsBanner.js.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.mjs +1 -1
- package/build/header/Header.js +2 -2
- package/build/header/Header.js.map +1 -1
- package/build/header/Header.mjs +1 -1
- package/build/index.js +4 -2
- package/build/index.js.map +1 -1
- package/build/index.mjs +2 -1
- package/build/index.mjs.map +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 +0 -223
- package/build/primitives/PrimitiveAnchor/src/PrimitiveAnchor.js +3 -1
- package/build/primitives/PrimitiveAnchor/src/PrimitiveAnchor.js.map +1 -1
- package/build/primitives/PrimitiveAnchor/src/PrimitiveAnchor.mjs +3 -1
- package/build/primitives/PrimitiveAnchor/src/PrimitiveAnchor.mjs.map +1 -1
- package/build/primitives/PrimitiveButton/src/PrimitiveButton.js +4 -1
- package/build/primitives/PrimitiveButton/src/PrimitiveButton.js.map +1 -1
- package/build/primitives/PrimitiveButton/src/PrimitiveButton.mjs +4 -1
- package/build/primitives/PrimitiveButton/src/PrimitiveButton.mjs.map +1 -1
- package/build/select/Select.js +2 -2
- package/build/select/Select.js.map +1 -1
- package/build/select/Select.mjs +1 -1
- package/build/styles/avatarLayout/AvatarLayout.css +0 -11
- package/build/styles/button/Button.css +15 -204
- package/build/styles/main.css +0 -223
- package/build/table/Table.js +166 -0
- package/build/table/Table.js.map +1 -0
- package/build/table/Table.messages.js +24 -0
- package/build/table/Table.messages.js.map +1 -0
- package/build/table/Table.messages.mjs +22 -0
- package/build/table/Table.messages.mjs.map +1 -0
- package/build/table/Table.mjs +164 -0
- package/build/table/Table.mjs.map +1 -0
- package/build/table/TableCell.js +86 -0
- package/build/table/TableCell.js.map +1 -0
- package/build/table/TableCell.mjs +84 -0
- package/build/table/TableCell.mjs.map +1 -0
- package/build/table/TableHeader.js +57 -0
- package/build/table/TableHeader.js.map +1 -0
- package/build/table/TableHeader.mjs +55 -0
- package/build/table/TableHeader.mjs.map +1 -0
- package/build/table/TableRow.js +85 -0
- package/build/table/TableRow.js.map +1 -0
- package/build/table/TableRow.mjs +83 -0
- package/build/table/TableRow.mjs.map +1 -0
- package/build/table/TableStatusText.js +54 -0
- package/build/table/TableStatusText.js.map +1 -0
- package/build/table/TableStatusText.mjs +52 -0
- package/build/table/TableStatusText.mjs.map +1 -0
- package/build/types/avatarLayout/AvatarLayout.d.ts.map +1 -1
- package/build/types/button/Button.d.ts +23 -2
- package/build/types/button/Button.d.ts.map +1 -1
- package/build/types/button/index.d.ts +2 -2
- package/build/types/button/index.d.ts.map +1 -1
- package/build/types/index.d.ts +2 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/link/Link.d.ts +2 -2
- package/build/types/link/Link.d.ts.map +1 -1
- package/build/types/primitives/PrimitiveAnchor/src/PrimitiveAnchor.d.ts.map +1 -1
- package/build/types/primitives/PrimitiveAnchor/src/PrimitiveAnchor.types.d.ts +2 -6
- package/build/types/primitives/PrimitiveAnchor/src/PrimitiveAnchor.types.d.ts.map +1 -1
- package/build/types/primitives/PrimitiveButton/src/PrimitiveButton.d.ts.map +1 -1
- package/build/types/primitives/PrimitiveButton/src/PrimitiveButton.types.d.ts +0 -1
- package/build/types/primitives/PrimitiveButton/src/PrimitiveButton.types.d.ts.map +1 -1
- package/build/upload/steps/completeStep/completeStep.js +2 -2
- package/build/upload/steps/completeStep/completeStep.js.map +1 -1
- package/build/upload/steps/completeStep/completeStep.mjs +1 -1
- package/build/upload/steps/processingStep/processingStep.js +2 -2
- package/build/upload/steps/processingStep/processingStep.js.map +1 -1
- package/build/upload/steps/processingStep/processingStep.mjs +1 -1
- package/build/uploadInput/UploadInput.js +3 -3
- package/build/uploadInput/UploadInput.js.map +1 -1
- package/build/uploadInput/UploadInput.mjs +1 -1
- package/package.json +4 -4
- package/src/avatarLayout/AvatarLayout.css +0 -11
- package/src/avatarLayout/AvatarLayout.less +1 -18
- package/src/avatarLayout/AvatarLayout.tsx +2 -10
- package/src/button/Button.css +15 -204
- package/src/button/Button.less +14 -211
- package/src/button/Button.spec.tsx +227 -75
- package/src/button/Button.story.tsx +138 -612
- package/src/button/Button.tsx +132 -88
- package/src/button/__snapshots__/Button.spec.tsx.snap +309 -0
- package/src/button/index.ts +3 -2
- package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +1 -1
- package/src/index.ts +12 -0
- package/src/inputs/SelectInput.story.tsx +1 -1
- package/src/link/Link.tsx +6 -15
- package/src/main.css +0 -223
- package/src/main.less +0 -1
- package/src/primitives/PrimitiveAnchor/src/PrimitiveAnchor.tsx +7 -1
- package/src/primitives/PrimitiveAnchor/src/PrimitiveAnchor.types.ts +2 -7
- package/src/primitives/PrimitiveAnchor/test/PrimitiveAnchor.spec.tsx +3 -1
- package/src/primitives/PrimitiveButton/src/PrimitiveButton.tsx +8 -1
- package/src/primitives/PrimitiveButton/src/PrimitiveButton.types.ts +0 -2
- package/src/primitives/PrimitiveButton/test/PrimitiveButton.spec.tsx +5 -2
- package/build/button/Button.resolver.js +0 -75
- package/build/button/Button.resolver.js.map +0 -1
- package/build/button/Button.resolver.mjs +0 -73
- package/build/button/Button.resolver.mjs.map +0 -1
- package/build/button/LegacyButton.js +0 -114
- package/build/button/LegacyButton.js.map +0 -1
- package/build/button/LegacyButton.mjs +0 -112
- package/build/button/LegacyButton.mjs.map +0 -1
- package/build/styles/button/Button.vars.css +0 -39
- package/build/styles/button/LegacyButton.css +0 -23
- package/build/types/button/Button.resolver.d.ts +0 -33
- package/build/types/button/Button.resolver.d.ts.map +0 -1
- package/build/types/button/Button.types.d.ts +0 -54
- package/build/types/button/Button.types.d.ts.map +0 -1
- package/build/types/button/LegacyButton.d.ts +0 -30
- package/build/types/button/LegacyButton.d.ts.map +0 -1
- package/src/button/Button.resolver.tsx +0 -75
- package/src/button/Button.tests.story.tsx +0 -27
- package/src/button/Button.types.ts +0 -68
- package/src/button/Button.vars.css +0 -39
- package/src/button/Button.vars.less +0 -50
- package/src/button/LegacyButton.css +0 -23
- package/src/button/LegacyButton.less +0 -24
- package/src/button/LegacyButton.spec.tsx +0 -146
- package/src/button/LegacyButton.story.tsx +0 -225
- package/src/button/LegacyButton.tsx +0 -161
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));
|
|
535
527
|
height: var(--np-avatar-layout-size);
|
|
@@ -543,9 +535,6 @@ 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
|
}
|
|
@@ -716,218 +705,6 @@ div.critical-comms .critical-comms-body {
|
|
|
716
705
|
.np-btn.disabled[class] {
|
|
717
706
|
pointer-events: auto;
|
|
718
707
|
}
|
|
719
|
-
.wds-Button {
|
|
720
|
-
--Button-background: var(--color-interactive-accent);
|
|
721
|
-
--Button-background-hover: var(--color-interactive-accent-hover);
|
|
722
|
-
--Button-background-active: var(--color-interactive-accent-active);
|
|
723
|
-
--Button-color: var(--color-interactive-control);
|
|
724
|
-
--Button-border-radius: var(--radius-full);
|
|
725
|
-
--Button-label-gap: var(--size-4);
|
|
726
|
-
--Button-large-padding: var(--size-12) var(--size-16);
|
|
727
|
-
--Button-medium-padding: var(--size-8) var(--size-12);
|
|
728
|
-
--Button-small-padding: calc(var(--size-10) * 0.5) var(--size-12);
|
|
729
|
-
--Button-avatar-border-color: var(--color-border-neutral);
|
|
730
|
-
--Button-transition-duration: 150ms;
|
|
731
|
-
--Button-transition-easing: ease-in-out;
|
|
732
|
-
--Button-secondary-background: var(--color-interactive-neutral);
|
|
733
|
-
--Button-secondary-background-hover: var(--color-interactive-neutral-hover);
|
|
734
|
-
--Button-secondary-background-active: var(--color-interactive-neutral-active);
|
|
735
|
-
--Button-secondary-color: var(--color-interactive-primary);
|
|
736
|
-
--Button-tertiary-background: var(--color-background-neutral);
|
|
737
|
-
--Button-tertiary-background-hover: var(--color-background-neutral-hover);
|
|
738
|
-
--Button-tertiary-background-active: var(--color-background-neutral-active);
|
|
739
|
-
--Button-tertiary-color: var(--color-content-primary);
|
|
740
|
-
--Button-minimal-background: transparent;
|
|
741
|
-
--Button-minimal-background-hover: var(--color-background-screen-hover);
|
|
742
|
-
--Button-minimal-background-active: var(--color-background-screen-active);
|
|
743
|
-
--Button-minimal-color: var(--color-interactive-primary);
|
|
744
|
-
--Button-primary-negative-background: var(--color-sentiment-negative-primary);
|
|
745
|
-
--Button-primary-negative-background-hover: var(--color-sentiment-negative-primary-hover);
|
|
746
|
-
--Button-primary-negative-background-active: var(--color-sentiment-negative-primary-active);
|
|
747
|
-
--Button-primary-negative-color: var(--color-contrast);
|
|
748
|
-
--Button-secondary-negative-background: var(--color-sentiment-negative-secondary);
|
|
749
|
-
--Button-secondary-negative-background-hover: var(--color-sentiment-negative-secondary-hover);
|
|
750
|
-
--Button-secondary-negative-background-active: var(--color-sentiment-negative-secondary-active);
|
|
751
|
-
--Button-secondary-negative-color: var(--color-sentiment-negative-primary);
|
|
752
|
-
}
|
|
753
|
-
.np-theme-personal--bright-green .wds-Button {
|
|
754
|
-
--color-contrast: #FFFFFF;
|
|
755
|
-
--Button-secondary-color: var(--color-interactive-control);
|
|
756
|
-
--Button-secondary-negative-color: var(--color-contrast);
|
|
757
|
-
}
|
|
758
|
-
/* Button Styles */
|
|
759
|
-
.wds-Button {
|
|
760
|
-
display: inline-flex;
|
|
761
|
-
flex: none;
|
|
762
|
-
width: auto;
|
|
763
|
-
align-items: center;
|
|
764
|
-
justify-content: center;
|
|
765
|
-
vertical-align: middle;
|
|
766
|
-
text-align: center;
|
|
767
|
-
-webkit-text-decoration: none;
|
|
768
|
-
text-decoration: none;
|
|
769
|
-
white-space: nowrap;
|
|
770
|
-
word-wrap: break-word;
|
|
771
|
-
-webkit-appearance: none;
|
|
772
|
-
-moz-appearance: none;
|
|
773
|
-
appearance: none;
|
|
774
|
-
background-color: var(--Button-background);
|
|
775
|
-
border: none;
|
|
776
|
-
border-radius: var(--Button-border-radius);
|
|
777
|
-
color: var(--Button-color);
|
|
778
|
-
cursor: pointer;
|
|
779
|
-
transition: color, background-color var(--Button-transition-duration) var(--Button-transition-easing);
|
|
780
|
-
}
|
|
781
|
-
.wds-Button:hover {
|
|
782
|
-
background-color: var(--Button-background-hover);
|
|
783
|
-
}
|
|
784
|
-
.wds-Button:active {
|
|
785
|
-
background-color: var(--Button-background-active);
|
|
786
|
-
}
|
|
787
|
-
.wds-Button.wds-Button--disabled,
|
|
788
|
-
.wds-Button:disabled {
|
|
789
|
-
mix-blend-mode: luminosity;
|
|
790
|
-
opacity: 0.45;
|
|
791
|
-
cursor: not-allowed;
|
|
792
|
-
}
|
|
793
|
-
.wds-Button.wds-Button--disabled:hover,
|
|
794
|
-
.wds-Button:disabled:hover,
|
|
795
|
-
.wds-Button.wds-Button--disabled:active,
|
|
796
|
-
.wds-Button:disabled:active {
|
|
797
|
-
background-color: var(--Button-background);
|
|
798
|
-
}
|
|
799
|
-
.wds-Button--secondary {
|
|
800
|
-
--Button-background: var(--Button-secondary-background);
|
|
801
|
-
--Button-background-hover: var(--Button-secondary-background-hover);
|
|
802
|
-
--Button-background-active: var(--Button-secondary-background-active);
|
|
803
|
-
--Button-color: var(--Button-secondary-color);
|
|
804
|
-
}
|
|
805
|
-
.wds-Button--tertiary {
|
|
806
|
-
--Button-background: var(--Button-tertiary-background);
|
|
807
|
-
--Button-background-hover: var(--Button-tertiary-background-hover);
|
|
808
|
-
--Button-background-active: var(--Button-tertiary-background-active);
|
|
809
|
-
--Button-color: var(--Button-tertiary-color);
|
|
810
|
-
}
|
|
811
|
-
.wds-Button--tertiary .wds-Button-icon--end {
|
|
812
|
-
color: var(--color-interactive-primary);
|
|
813
|
-
}
|
|
814
|
-
.wds-Button--minimal {
|
|
815
|
-
--Button-background: var(--Button-minimal-background);
|
|
816
|
-
--Button-background-hover: var(--Button-minimal-background-hover);
|
|
817
|
-
--Button-background-active: var(--Button-minimal-background-active);
|
|
818
|
-
--Button-color: var(--Button-minimal-color);
|
|
819
|
-
-webkit-text-decoration: underline;
|
|
820
|
-
text-decoration: underline;
|
|
821
|
-
text-underline-offset: 3px;
|
|
822
|
-
text-decoration-thickness: 1px;
|
|
823
|
-
}
|
|
824
|
-
.wds-Button--negative.wds-Button--primary {
|
|
825
|
-
--Button-background: var(--Button-primary-negative-background);
|
|
826
|
-
--Button-background-hover: var(--Button-primary-negative-background-hover);
|
|
827
|
-
--Button-background-active: var(--Button-primary-negative-background-active);
|
|
828
|
-
--Button-color: var(--Button-primary-negative-color);
|
|
829
|
-
}
|
|
830
|
-
.wds-Button--negative.wds-Button--secondary {
|
|
831
|
-
--Button-background: var(--Button-secondary-negative-background);
|
|
832
|
-
--Button-background-hover: var(--Button-secondary-negative-background-hover);
|
|
833
|
-
--Button-background-active: var(--Button-secondary-negative-background-active);
|
|
834
|
-
--Button-color: var(--Button-secondary-negative-color);
|
|
835
|
-
}
|
|
836
|
-
.wds-Button--large {
|
|
837
|
-
padding: var(--Button-large-padding);
|
|
838
|
-
}
|
|
839
|
-
.wds-Button--medium {
|
|
840
|
-
padding: var(--Button-medium-padding);
|
|
841
|
-
}
|
|
842
|
-
.wds-Button--medium:has(.wds-Button-avatars) {
|
|
843
|
-
padding-inline-start: 8px;
|
|
844
|
-
padding-inline-start: var(--size-8);
|
|
845
|
-
}
|
|
846
|
-
.wds-Button--medium:has(.wds-Button-icon--end) {
|
|
847
|
-
padding-inline-end: 8px;
|
|
848
|
-
padding-inline-end: var(--size-8);
|
|
849
|
-
}
|
|
850
|
-
.wds-Button--medium .wds-Button-icon--start {
|
|
851
|
-
margin-inline-end: var(--Button-label-gap);
|
|
852
|
-
}
|
|
853
|
-
.wds-Button--small {
|
|
854
|
-
padding: var(--Button-small-padding);
|
|
855
|
-
}
|
|
856
|
-
.wds-Button--small:has(.wds-Button-icon--start) {
|
|
857
|
-
padding-inline-start: 8px;
|
|
858
|
-
padding-inline-start: var(--size-8);
|
|
859
|
-
}
|
|
860
|
-
.wds-Button--small:has(.wds-Button-icon--end) {
|
|
861
|
-
padding-inline-end: 8px;
|
|
862
|
-
padding-inline-end: var(--size-8);
|
|
863
|
-
}
|
|
864
|
-
.wds-Button--block {
|
|
865
|
-
width: 100%;
|
|
866
|
-
}
|
|
867
|
-
.wds-Button-avatars {
|
|
868
|
-
display: inline-flex;
|
|
869
|
-
}
|
|
870
|
-
.wds-Button-avatars .np-avatar-view .np-avatar-view-content {
|
|
871
|
-
color: var(--Button-color);
|
|
872
|
-
}
|
|
873
|
-
.wds-Button-icon {
|
|
874
|
-
display: inline-block;
|
|
875
|
-
}
|
|
876
|
-
.wds-Button-content {
|
|
877
|
-
position: relative;
|
|
878
|
-
}
|
|
879
|
-
.wds-Button-content--loading .wds-Button-label,
|
|
880
|
-
.wds-Button-content--loading .wds-Button-media,
|
|
881
|
-
.wds-Button-content--loading .wds-Button-icon {
|
|
882
|
-
visibility: hidden;
|
|
883
|
-
opacity: 0;
|
|
884
|
-
}
|
|
885
|
-
.wds-Button-label {
|
|
886
|
-
display: flex;
|
|
887
|
-
justify-content: center;
|
|
888
|
-
align-items: center;
|
|
889
|
-
gap: var(--Button-label-gap);
|
|
890
|
-
position: relative;
|
|
891
|
-
}
|
|
892
|
-
.wds-Button-loader {
|
|
893
|
-
position: absolute;
|
|
894
|
-
display: flex;
|
|
895
|
-
justify-content: center;
|
|
896
|
-
align-items: center;
|
|
897
|
-
width: 100%;
|
|
898
|
-
height: 100%;
|
|
899
|
-
}
|
|
900
|
-
.wds-Button-loader .process-circle {
|
|
901
|
-
stroke: var(--Button-color);
|
|
902
|
-
}
|
|
903
|
-
/* RTL Styles */
|
|
904
|
-
[dir="rtl"] .wds-Button .tw-icon-chevron-right,[dir="rtl"] .wds-Button .tw-icon-arrow-right {
|
|
905
|
-
transform: rotate(180deg);
|
|
906
|
-
}
|
|
907
|
-
[dir="rtl"] .wds-Button .tw-icon-chevron-left,[dir="rtl"] .wds-Button .tw-icon-arrow-left {
|
|
908
|
-
transform: rotate(180deg);
|
|
909
|
-
}
|
|
910
|
-
/* Avatar border transparency */
|
|
911
|
-
/* dark buttons get 20% transparency, light buttons get 12% */
|
|
912
|
-
.wds-Button-avatars .np-circle {
|
|
913
|
-
--circle-border-color: color-mix(in srgb, var(--Button-color) 20%, transparent);
|
|
914
|
-
}
|
|
915
|
-
.np-theme-personal:not(.np-theme-personal--dark):not(.np-theme-personal--forest-green):not(.np-theme-personal--bright-green) .wds-Button--secondary.wds-Button--negative .wds-Button-avatars .np-circle,
|
|
916
|
-
.np-theme-personal:not(.np-theme-personal--dark):not(.np-theme-personal--forest-green):not(.np-theme-personal--bright-green) .wds-Button--secondary .wds-Button-avatars .np-circle,
|
|
917
|
-
.np-theme-personal:not(.np-theme-personal--dark):not(.np-theme-personal--forest-green):not(.np-theme-personal--bright-green) .wds-Button--tertiary .wds-Button-avatars .np-circle,
|
|
918
|
-
.np-theme-personal:not(.np-theme-personal--dark):not(.np-theme-personal--forest-green):not(.np-theme-personal--bright-green) .wds-Button--minimal .wds-Button-avatars .np-circle {
|
|
919
|
-
--circle-border-color: color-mix(in srgb, var(--Button-color) 12%, transparent);
|
|
920
|
-
}
|
|
921
|
-
.np-theme-personal--dark .wds-Button--primary .wds-Button-avatars .np-circle,
|
|
922
|
-
.np-theme-personal--dark .wds-Button--primary.wds-Button--negative .wds-Button-avatars .np-circle,
|
|
923
|
-
.np-theme-personal--forest-green .wds-Button--primary .wds-Button-avatars .np-circle,
|
|
924
|
-
.np-theme-personal--forest-green .wds-Button--primary.wds-Button--negative .wds-Button-avatars .np-circle {
|
|
925
|
-
--circle-border-color: color-mix(in srgb, var(--Button-color) 12%, transparent);
|
|
926
|
-
}
|
|
927
|
-
.np-theme-personal--bright-green .wds-Button--tertiary .wds-Button-avatars .np-circle,
|
|
928
|
-
.np-theme-personal--bright-green .wds-Button--minimal .wds-Button-avatars .np-circle {
|
|
929
|
-
--circle-border-color: color-mix(in srgb, var(--Button-color) 12%, transparent);
|
|
930
|
-
}
|
|
931
708
|
.np-card {
|
|
932
709
|
overflow: hidden;
|
|
933
710
|
transition-property: transform, box-shadow;
|
package/src/main.less
CHANGED
|
@@ -30,7 +30,13 @@ const PrimitiveAnchor = forwardRef<HTMLAnchorElement, PrimitiveAnchorProps>(
|
|
|
30
30
|
},
|
|
31
31
|
ref,
|
|
32
32
|
) => {
|
|
33
|
-
const anchorClasses = clsx(
|
|
33
|
+
const anchorClasses = clsx(
|
|
34
|
+
'wds-Anchor',
|
|
35
|
+
{
|
|
36
|
+
'wds-Anchor--disabled': disabled,
|
|
37
|
+
},
|
|
38
|
+
className,
|
|
39
|
+
);
|
|
34
40
|
|
|
35
41
|
const handleClick = useCallback(
|
|
36
42
|
(event: React.MouseEvent<HTMLAnchorElement>) => {
|
|
@@ -13,21 +13,16 @@ export type PrimitiveAnchorElementRef = React.Ref<HTMLAnchorElement>;
|
|
|
13
13
|
export interface PrimitiveAnchorProps
|
|
14
14
|
extends BasePrimitiveProps,
|
|
15
15
|
StyleProp,
|
|
16
|
-
Omit<PrimitiveAnchorAttributes, 'role'
|
|
16
|
+
Omit<PrimitiveAnchorAttributes, 'role'> {
|
|
17
17
|
/** Content of the anchor */
|
|
18
18
|
children?: ReactNode;
|
|
19
19
|
|
|
20
20
|
/** The URL to navigate to when the anchor is clicked */
|
|
21
|
-
href
|
|
21
|
+
href: string;
|
|
22
22
|
|
|
23
23
|
/** Disable the anchor */
|
|
24
24
|
disabled?: boolean;
|
|
25
25
|
|
|
26
26
|
/** Reference to the anchor element */
|
|
27
27
|
ref?: PrimitiveAnchorElementRef;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* HTML anchor `target` attribute. If set to `_blank`, `rel="noopener noreferrer"` is automatically added to the rendered node.
|
|
31
|
-
*/
|
|
32
|
-
target?: HTMLAnchorElement['target'];
|
|
33
28
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { render, screen } from '@testing-library/react';
|
|
2
|
-
import PrimitiveAnchor from '
|
|
2
|
+
import PrimitiveAnchor from '..';
|
|
3
3
|
|
|
4
4
|
describe('PrimitiveAnchor', () => {
|
|
5
5
|
const defaultProps = {
|
|
@@ -27,6 +27,7 @@ describe('PrimitiveAnchor', () => {
|
|
|
27
27
|
renderAnchor(props);
|
|
28
28
|
|
|
29
29
|
const link = screen.getByRole('link');
|
|
30
|
+
expect(link).toHaveClass('wds-Anchor');
|
|
30
31
|
expect(link).toHaveClass('custom-class');
|
|
31
32
|
});
|
|
32
33
|
|
|
@@ -40,6 +41,7 @@ describe('PrimitiveAnchor', () => {
|
|
|
40
41
|
|
|
41
42
|
const link = screen.getByRole('link');
|
|
42
43
|
expect(link).toHaveAttribute('aria-disabled', 'true');
|
|
44
|
+
expect(link).toHaveClass('wds-Anchor--disabled');
|
|
43
45
|
expect(link).not.toHaveAttribute('href', 'https://example.com');
|
|
44
46
|
});
|
|
45
47
|
|
|
@@ -35,7 +35,14 @@ const PrimitiveButton = forwardRef<HTMLButtonElement, PrimitiveButtonProps>(
|
|
|
35
35
|
ref,
|
|
36
36
|
) => {
|
|
37
37
|
const intl = useIntl();
|
|
38
|
-
const classNames = clsx(
|
|
38
|
+
const classNames = clsx(
|
|
39
|
+
'wds-Button',
|
|
40
|
+
{
|
|
41
|
+
'wds-Button--disabled': disabled,
|
|
42
|
+
'wds-Button--loading': loading,
|
|
43
|
+
},
|
|
44
|
+
className,
|
|
45
|
+
);
|
|
39
46
|
|
|
40
47
|
const handleClick = useCallback(
|
|
41
48
|
(event: React.MouseEvent<HTMLButtonElement>) => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { screen } from '@testing-library/react';
|
|
2
|
-
import
|
|
1
|
+
import { fireEvent, screen } from '@testing-library/react';
|
|
2
|
+
import { userEvent } from '@testing-library/user-event';
|
|
3
|
+
import PrimitiveButton from '..';
|
|
3
4
|
import messages from '../../../i18n/commonMessages/Button.messages';
|
|
4
5
|
import { render } from '../../../test-utils';
|
|
5
6
|
|
|
@@ -35,6 +36,7 @@ describe('Button', () => {
|
|
|
35
36
|
renderButton(props);
|
|
36
37
|
|
|
37
38
|
const button = screen.getByRole('button');
|
|
39
|
+
expect(button).toHaveClass('wds-Button');
|
|
38
40
|
expect(button).toHaveClass('custom-class');
|
|
39
41
|
});
|
|
40
42
|
|
|
@@ -47,6 +49,7 @@ describe('Button', () => {
|
|
|
47
49
|
renderButton(props);
|
|
48
50
|
|
|
49
51
|
const button = screen.getByRole('button');
|
|
52
|
+
expect(button).toHaveClass('wds-Button--disabled');
|
|
50
53
|
expect(button).toBeDisabled();
|
|
51
54
|
});
|
|
52
55
|
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var React = require('react');
|
|
4
|
-
var LegacyButton = require('./LegacyButton.js');
|
|
5
|
-
var Button$1 = require('./Button.js');
|
|
6
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
-
|
|
8
|
-
const mapProps = props => {
|
|
9
|
-
const {
|
|
10
|
-
priority,
|
|
11
|
-
size,
|
|
12
|
-
type,
|
|
13
|
-
...newProps
|
|
14
|
-
} = props;
|
|
15
|
-
const priorityMapping = {
|
|
16
|
-
accent: {
|
|
17
|
-
primary: 'primary',
|
|
18
|
-
secondary: 'tertiary',
|
|
19
|
-
tertiary: 'minimal'
|
|
20
|
-
},
|
|
21
|
-
positive: {
|
|
22
|
-
primary: 'primary',
|
|
23
|
-
secondary: 'tertiary',
|
|
24
|
-
tertiary: 'tertiary'
|
|
25
|
-
},
|
|
26
|
-
negative: {
|
|
27
|
-
primary: 'primary',
|
|
28
|
-
secondary: 'secondary',
|
|
29
|
-
tertiary: 'secondary'
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
const mappedPriority = type && priority ? priorityMapping[type]?.[priority] || priority : priority || undefined;
|
|
33
|
-
const mappedSentiment = type === 'negative' ? 'negative' : undefined;
|
|
34
|
-
const legacyButtonTypes = ['accent', 'negative', 'positive', 'primary', 'pay', 'secondary', 'danger', 'link'];
|
|
35
|
-
const resolveSize = () => {
|
|
36
|
-
if (size) {
|
|
37
|
-
return {
|
|
38
|
-
xs: 'sm',
|
|
39
|
-
sm: 'sm',
|
|
40
|
-
md: 'md',
|
|
41
|
-
lg: 'lg'
|
|
42
|
-
}[size] || size;
|
|
43
|
-
}
|
|
44
|
-
return size;
|
|
45
|
-
};
|
|
46
|
-
return {
|
|
47
|
-
...newProps,
|
|
48
|
-
size: resolveSize(),
|
|
49
|
-
priority: mappedPriority,
|
|
50
|
-
sentiment: mappedSentiment || ('sentiment' in props ? props.sentiment : null),
|
|
51
|
-
type: type && !legacyButtonTypes.includes(type) ? type : props.htmlType || null,
|
|
52
|
-
v2: true
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
const Button = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
56
|
-
const {
|
|
57
|
-
v2 = false,
|
|
58
|
-
...rest
|
|
59
|
-
} = props;
|
|
60
|
-
if (v2) {
|
|
61
|
-
const mappedProps = mapProps(props);
|
|
62
|
-
return /*#__PURE__*/jsxRuntime.jsx(Button$1, {
|
|
63
|
-
...mappedProps,
|
|
64
|
-
ref: ref
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
return /*#__PURE__*/jsxRuntime.jsx(LegacyButton, {
|
|
68
|
-
...rest,
|
|
69
|
-
ref: ref
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
Button.displayName = 'Button';
|
|
73
|
-
|
|
74
|
-
module.exports = Button;
|
|
75
|
-
//# sourceMappingURL=Button.resolver.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Button.resolver.js","sources":["../../src/button/Button.resolver.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport LegacyButton, { LegacyButtonProps } from './LegacyButton';\nimport { ButtonProps as NewButtonProps } from './Button.types';\nimport NewButton from './Button';\n\nexport type ButtonProps = LegacyButtonProps | NewButtonProps;\n\nconst mapProps = (props: LegacyButtonProps): NewButtonProps => {\n const { priority, size, type, ...newProps } = props;\n\n const priorityMapping: Record<string, Record<string, NewButtonProps['priority']>> = {\n accent: {\n primary: 'primary',\n secondary: 'tertiary',\n tertiary: 'minimal',\n },\n positive: {\n primary: 'primary',\n secondary: 'tertiary',\n tertiary: 'tertiary',\n },\n negative: {\n primary: 'primary',\n secondary: 'secondary',\n tertiary: 'secondary',\n },\n };\n\n const mappedPriority =\n type && priority ? priorityMapping[type]?.[priority] || priority : priority || undefined;\n const mappedSentiment = type === 'negative' ? 'negative' : undefined;\n\n const legacyButtonTypes: LegacyButtonProps['type'][] = [\n 'accent',\n 'negative',\n 'positive',\n 'primary',\n 'pay',\n 'secondary',\n 'danger',\n 'link',\n ];\n\n const resolveSize = () => {\n if (size) {\n return { xs: 'sm', sm: 'sm', md: 'md', lg: 'lg' }[size] || size;\n }\n\n return size;\n };\n\n return {\n ...newProps,\n size: resolveSize(),\n priority: mappedPriority,\n sentiment: mappedSentiment || ('sentiment' in props ? props.sentiment : null),\n type: type && !legacyButtonTypes.includes(type) ? type : props.htmlType || null,\n v2: true,\n } as NewButtonProps;\n};\n\nconst Button = forwardRef<HTMLButtonElement | HTMLAnchorElement, ButtonProps>((props, ref) => {\n const { v2 = false, ...rest } = props;\n\n if (v2) {\n const mappedProps = mapProps(props as LegacyButtonProps);\n return <NewButton {...mappedProps} ref={ref} />;\n }\n\n return <LegacyButton {...(rest as LegacyButtonProps)} ref={ref} />;\n});\n\nButton.displayName = 'Button';\n\nexport default Button;\n"],"names":["mapProps","props","priority","size","type","newProps","priorityMapping","accent","primary","secondary","tertiary","positive","negative","mappedPriority","undefined","mappedSentiment","legacyButtonTypes","resolveSize","xs","sm","md","lg","sentiment","includes","htmlType","v2","Button","forwardRef","ref","rest","mappedProps","_jsx","NewButton","LegacyButton","displayName"],"mappings":";;;;;;;AAOA,MAAMA,QAAQ,GAAIC,KAAwB,IAAoB;EAC5D,MAAM;IAAEC,QAAQ;IAAEC,IAAI;IAAEC,IAAI;IAAE,GAAGC,QAAAA;AAAQ,GAAE,GAAGJ,KAAK,CAAA;AAEnD,EAAA,MAAMK,eAAe,GAA+D;AAClFC,IAAAA,MAAM,EAAE;AACNC,MAAAA,OAAO,EAAE,SAAS;AAClBC,MAAAA,SAAS,EAAE,UAAU;AACrBC,MAAAA,QAAQ,EAAE,SAAA;KACX;AACDC,IAAAA,QAAQ,EAAE;AACRH,MAAAA,OAAO,EAAE,SAAS;AAClBC,MAAAA,SAAS,EAAE,UAAU;AACrBC,MAAAA,QAAQ,EAAE,UAAA;KACX;AACDE,IAAAA,QAAQ,EAAE;AACRJ,MAAAA,OAAO,EAAE,SAAS;AAClBC,MAAAA,SAAS,EAAE,WAAW;AACtBC,MAAAA,QAAQ,EAAE,WAAA;AACX,KAAA;GACF,CAAA;AAED,EAAA,MAAMG,cAAc,GAClBT,IAAI,IAAIF,QAAQ,GAAGI,eAAe,CAACF,IAAI,CAAC,GAAGF,QAAQ,CAAC,IAAIA,QAAQ,GAAGA,QAAQ,IAAIY,SAAS,CAAA;EAC1F,MAAMC,eAAe,GAAGX,IAAI,KAAK,UAAU,GAAG,UAAU,GAAGU,SAAS,CAAA;AAEpE,EAAA,MAAME,iBAAiB,GAAgC,CACrD,QAAQ,EACR,UAAU,EACV,UAAU,EACV,SAAS,EACT,KAAK,EACL,WAAW,EACX,QAAQ,EACR,MAAM,CACP,CAAA;EAED,MAAMC,WAAW,GAAGA,MAAK;AACvB,IAAA,IAAId,IAAI,EAAE;MACR,OAAO;AAAEe,QAAAA,EAAE,EAAE,IAAI;AAAEC,QAAAA,EAAE,EAAE,IAAI;AAAEC,QAAAA,EAAE,EAAE,IAAI;AAAEC,QAAAA,EAAE,EAAE,IAAA;AAAI,OAAE,CAAClB,IAAI,CAAC,IAAIA,IAAI,CAAA;AACjE,KAAA;AAEA,IAAA,OAAOA,IAAI,CAAA;GACZ,CAAA;EAED,OAAO;AACL,IAAA,GAAGE,QAAQ;IACXF,IAAI,EAAEc,WAAW,EAAE;AACnBf,IAAAA,QAAQ,EAAEW,cAAc;AACxBS,IAAAA,SAAS,EAAEP,eAAe,KAAK,WAAW,IAAId,KAAK,GAAGA,KAAK,CAACqB,SAAS,GAAG,IAAI,CAAC;AAC7ElB,IAAAA,IAAI,EAAEA,IAAI,IAAI,CAACY,iBAAiB,CAACO,QAAQ,CAACnB,IAAI,CAAC,GAAGA,IAAI,GAAGH,KAAK,CAACuB,QAAQ,IAAI,IAAI;AAC/EC,IAAAA,EAAE,EAAE,IAAA;GACa,CAAA;AACrB,CAAC,CAAA;AAEKC,MAAAA,MAAM,gBAAGC,gBAAU,CAAqD,CAAC1B,KAAK,EAAE2B,GAAG,KAAI;EAC3F,MAAM;AAAEH,IAAAA,EAAE,GAAG,KAAK;IAAE,GAAGI,IAAAA;AAAI,GAAE,GAAG5B,KAAK,CAAA;AAErC,EAAA,IAAIwB,EAAE,EAAE;AACN,IAAA,MAAMK,WAAW,GAAG9B,QAAQ,CAACC,KAA0B,CAAC,CAAA;IACxD,oBAAO8B,cAAA,CAACC,QAAS,EAAA;AAAA,MAAA,GAAKF,WAAW;AAAEF,MAAAA,GAAG,EAAEA,GAAAA;AAAI,MAAG,CAAA;AACjD,GAAA;EAEA,oBAAOG,cAAA,CAACE,YAAY,EAAA;AAAA,IAAA,GAAMJ,IAA0B;AAAED,IAAAA,GAAG,EAAEA,GAAAA;AAAI,IAAG,CAAA;AACpE,CAAC,EAAC;AAEFF,MAAM,CAACQ,WAAW,GAAG,QAAQ;;;;"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { forwardRef } from 'react';
|
|
2
|
-
import LegacyButton from './LegacyButton.mjs';
|
|
3
|
-
import Button$1 from './Button.mjs';
|
|
4
|
-
import { jsx } from 'react/jsx-runtime';
|
|
5
|
-
|
|
6
|
-
const mapProps = props => {
|
|
7
|
-
const {
|
|
8
|
-
priority,
|
|
9
|
-
size,
|
|
10
|
-
type,
|
|
11
|
-
...newProps
|
|
12
|
-
} = props;
|
|
13
|
-
const priorityMapping = {
|
|
14
|
-
accent: {
|
|
15
|
-
primary: 'primary',
|
|
16
|
-
secondary: 'tertiary',
|
|
17
|
-
tertiary: 'minimal'
|
|
18
|
-
},
|
|
19
|
-
positive: {
|
|
20
|
-
primary: 'primary',
|
|
21
|
-
secondary: 'tertiary',
|
|
22
|
-
tertiary: 'tertiary'
|
|
23
|
-
},
|
|
24
|
-
negative: {
|
|
25
|
-
primary: 'primary',
|
|
26
|
-
secondary: 'secondary',
|
|
27
|
-
tertiary: 'secondary'
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
const mappedPriority = type && priority ? priorityMapping[type]?.[priority] || priority : priority || undefined;
|
|
31
|
-
const mappedSentiment = type === 'negative' ? 'negative' : undefined;
|
|
32
|
-
const legacyButtonTypes = ['accent', 'negative', 'positive', 'primary', 'pay', 'secondary', 'danger', 'link'];
|
|
33
|
-
const resolveSize = () => {
|
|
34
|
-
if (size) {
|
|
35
|
-
return {
|
|
36
|
-
xs: 'sm',
|
|
37
|
-
sm: 'sm',
|
|
38
|
-
md: 'md',
|
|
39
|
-
lg: 'lg'
|
|
40
|
-
}[size] || size;
|
|
41
|
-
}
|
|
42
|
-
return size;
|
|
43
|
-
};
|
|
44
|
-
return {
|
|
45
|
-
...newProps,
|
|
46
|
-
size: resolveSize(),
|
|
47
|
-
priority: mappedPriority,
|
|
48
|
-
sentiment: mappedSentiment || ('sentiment' in props ? props.sentiment : null),
|
|
49
|
-
type: type && !legacyButtonTypes.includes(type) ? type : props.htmlType || null,
|
|
50
|
-
v2: true
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
const Button = /*#__PURE__*/forwardRef((props, ref) => {
|
|
54
|
-
const {
|
|
55
|
-
v2 = false,
|
|
56
|
-
...rest
|
|
57
|
-
} = props;
|
|
58
|
-
if (v2) {
|
|
59
|
-
const mappedProps = mapProps(props);
|
|
60
|
-
return /*#__PURE__*/jsx(Button$1, {
|
|
61
|
-
...mappedProps,
|
|
62
|
-
ref: ref
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
return /*#__PURE__*/jsx(LegacyButton, {
|
|
66
|
-
...rest,
|
|
67
|
-
ref: ref
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
Button.displayName = 'Button';
|
|
71
|
-
|
|
72
|
-
export { Button as default };
|
|
73
|
-
//# sourceMappingURL=Button.resolver.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Button.resolver.mjs","sources":["../../src/button/Button.resolver.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport LegacyButton, { LegacyButtonProps } from './LegacyButton';\nimport { ButtonProps as NewButtonProps } from './Button.types';\nimport NewButton from './Button';\n\nexport type ButtonProps = LegacyButtonProps | NewButtonProps;\n\nconst mapProps = (props: LegacyButtonProps): NewButtonProps => {\n const { priority, size, type, ...newProps } = props;\n\n const priorityMapping: Record<string, Record<string, NewButtonProps['priority']>> = {\n accent: {\n primary: 'primary',\n secondary: 'tertiary',\n tertiary: 'minimal',\n },\n positive: {\n primary: 'primary',\n secondary: 'tertiary',\n tertiary: 'tertiary',\n },\n negative: {\n primary: 'primary',\n secondary: 'secondary',\n tertiary: 'secondary',\n },\n };\n\n const mappedPriority =\n type && priority ? priorityMapping[type]?.[priority] || priority : priority || undefined;\n const mappedSentiment = type === 'negative' ? 'negative' : undefined;\n\n const legacyButtonTypes: LegacyButtonProps['type'][] = [\n 'accent',\n 'negative',\n 'positive',\n 'primary',\n 'pay',\n 'secondary',\n 'danger',\n 'link',\n ];\n\n const resolveSize = () => {\n if (size) {\n return { xs: 'sm', sm: 'sm', md: 'md', lg: 'lg' }[size] || size;\n }\n\n return size;\n };\n\n return {\n ...newProps,\n size: resolveSize(),\n priority: mappedPriority,\n sentiment: mappedSentiment || ('sentiment' in props ? props.sentiment : null),\n type: type && !legacyButtonTypes.includes(type) ? type : props.htmlType || null,\n v2: true,\n } as NewButtonProps;\n};\n\nconst Button = forwardRef<HTMLButtonElement | HTMLAnchorElement, ButtonProps>((props, ref) => {\n const { v2 = false, ...rest } = props;\n\n if (v2) {\n const mappedProps = mapProps(props as LegacyButtonProps);\n return <NewButton {...mappedProps} ref={ref} />;\n }\n\n return <LegacyButton {...(rest as LegacyButtonProps)} ref={ref} />;\n});\n\nButton.displayName = 'Button';\n\nexport default Button;\n"],"names":["mapProps","props","priority","size","type","newProps","priorityMapping","accent","primary","secondary","tertiary","positive","negative","mappedPriority","undefined","mappedSentiment","legacyButtonTypes","resolveSize","xs","sm","md","lg","sentiment","includes","htmlType","v2","Button","forwardRef","ref","rest","mappedProps","_jsx","NewButton","LegacyButton","displayName"],"mappings":";;;;;AAOA,MAAMA,QAAQ,GAAIC,KAAwB,IAAoB;EAC5D,MAAM;IAAEC,QAAQ;IAAEC,IAAI;IAAEC,IAAI;IAAE,GAAGC,QAAAA;AAAQ,GAAE,GAAGJ,KAAK,CAAA;AAEnD,EAAA,MAAMK,eAAe,GAA+D;AAClFC,IAAAA,MAAM,EAAE;AACNC,MAAAA,OAAO,EAAE,SAAS;AAClBC,MAAAA,SAAS,EAAE,UAAU;AACrBC,MAAAA,QAAQ,EAAE,SAAA;KACX;AACDC,IAAAA,QAAQ,EAAE;AACRH,MAAAA,OAAO,EAAE,SAAS;AAClBC,MAAAA,SAAS,EAAE,UAAU;AACrBC,MAAAA,QAAQ,EAAE,UAAA;KACX;AACDE,IAAAA,QAAQ,EAAE;AACRJ,MAAAA,OAAO,EAAE,SAAS;AAClBC,MAAAA,SAAS,EAAE,WAAW;AACtBC,MAAAA,QAAQ,EAAE,WAAA;AACX,KAAA;GACF,CAAA;AAED,EAAA,MAAMG,cAAc,GAClBT,IAAI,IAAIF,QAAQ,GAAGI,eAAe,CAACF,IAAI,CAAC,GAAGF,QAAQ,CAAC,IAAIA,QAAQ,GAAGA,QAAQ,IAAIY,SAAS,CAAA;EAC1F,MAAMC,eAAe,GAAGX,IAAI,KAAK,UAAU,GAAG,UAAU,GAAGU,SAAS,CAAA;AAEpE,EAAA,MAAME,iBAAiB,GAAgC,CACrD,QAAQ,EACR,UAAU,EACV,UAAU,EACV,SAAS,EACT,KAAK,EACL,WAAW,EACX,QAAQ,EACR,MAAM,CACP,CAAA;EAED,MAAMC,WAAW,GAAGA,MAAK;AACvB,IAAA,IAAId,IAAI,EAAE;MACR,OAAO;AAAEe,QAAAA,EAAE,EAAE,IAAI;AAAEC,QAAAA,EAAE,EAAE,IAAI;AAAEC,QAAAA,EAAE,EAAE,IAAI;AAAEC,QAAAA,EAAE,EAAE,IAAA;AAAI,OAAE,CAAClB,IAAI,CAAC,IAAIA,IAAI,CAAA;AACjE,KAAA;AAEA,IAAA,OAAOA,IAAI,CAAA;GACZ,CAAA;EAED,OAAO;AACL,IAAA,GAAGE,QAAQ;IACXF,IAAI,EAAEc,WAAW,EAAE;AACnBf,IAAAA,QAAQ,EAAEW,cAAc;AACxBS,IAAAA,SAAS,EAAEP,eAAe,KAAK,WAAW,IAAId,KAAK,GAAGA,KAAK,CAACqB,SAAS,GAAG,IAAI,CAAC;AAC7ElB,IAAAA,IAAI,EAAEA,IAAI,IAAI,CAACY,iBAAiB,CAACO,QAAQ,CAACnB,IAAI,CAAC,GAAGA,IAAI,GAAGH,KAAK,CAACuB,QAAQ,IAAI,IAAI;AAC/EC,IAAAA,EAAE,EAAE,IAAA;GACa,CAAA;AACrB,CAAC,CAAA;AAEKC,MAAAA,MAAM,gBAAGC,UAAU,CAAqD,CAAC1B,KAAK,EAAE2B,GAAG,KAAI;EAC3F,MAAM;AAAEH,IAAAA,EAAE,GAAG,KAAK;IAAE,GAAGI,IAAAA;AAAI,GAAE,GAAG5B,KAAK,CAAA;AAErC,EAAA,IAAIwB,EAAE,EAAE;AACN,IAAA,MAAMK,WAAW,GAAG9B,QAAQ,CAACC,KAA0B,CAAC,CAAA;IACxD,oBAAO8B,GAAA,CAACC,QAAS,EAAA;AAAA,MAAA,GAAKF,WAAW;AAAEF,MAAAA,GAAG,EAAEA,GAAAA;AAAI,MAAG,CAAA;AACjD,GAAA;EAEA,oBAAOG,GAAA,CAACE,YAAY,EAAA;AAAA,IAAA,GAAMJ,IAA0B;AAAED,IAAAA,GAAG,EAAEA,GAAAA;AAAI,IAAG,CAAA;AACpE,CAAC,EAAC;AAEFF,MAAM,CAACQ,WAAW,GAAG,QAAQ;;;;"}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var clsx = require('clsx');
|
|
4
|
-
var React = require('react');
|
|
5
|
-
var reactIntl = require('react-intl');
|
|
6
|
-
require('../common/theme.js');
|
|
7
|
-
require('../common/direction.js');
|
|
8
|
-
var control = require('../common/propsValues/control.js');
|
|
9
|
-
require('../common/propsValues/breakpoint.js');
|
|
10
|
-
var size = require('../common/propsValues/size.js');
|
|
11
|
-
require('../common/propsValues/typography.js');
|
|
12
|
-
require('../common/propsValues/width.js');
|
|
13
|
-
require('../common/propsValues/type.js');
|
|
14
|
-
require('../common/propsValues/dateMode.js');
|
|
15
|
-
require('../common/propsValues/monthFormat.js');
|
|
16
|
-
require('../common/propsValues/position.js');
|
|
17
|
-
require('../common/propsValues/layouts.js');
|
|
18
|
-
require('../common/propsValues/status.js');
|
|
19
|
-
require('../common/propsValues/sentiment.js');
|
|
20
|
-
require('../common/propsValues/profileType.js');
|
|
21
|
-
require('../common/propsValues/variant.js');
|
|
22
|
-
require('../common/propsValues/scroll.js');
|
|
23
|
-
require('../common/propsValues/markdownNodeType.js');
|
|
24
|
-
require('../common/fileType.js');
|
|
25
|
-
require('@transferwise/icons');
|
|
26
|
-
require('../common/closeButton/CloseButton.messages.js');
|
|
27
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
28
|
-
var ProcessIndicator = require('../processIndicator/ProcessIndicator.js');
|
|
29
|
-
var Button_messages = require('../i18n/commonMessages/Button.messages.js');
|
|
30
|
-
var classMap = require('./classMap.js');
|
|
31
|
-
var legacyUtils = require('./legacyUtils/legacyUtils.js');
|
|
32
|
-
|
|
33
|
-
const LegacyButton = /*#__PURE__*/React.forwardRef(({
|
|
34
|
-
as: component = 'button',
|
|
35
|
-
block = false,
|
|
36
|
-
children,
|
|
37
|
-
className,
|
|
38
|
-
disabled,
|
|
39
|
-
loading = false,
|
|
40
|
-
priority = control.Priority.PRIMARY,
|
|
41
|
-
size: size$1 = size.Size.MEDIUM,
|
|
42
|
-
type = control.ControlType.ACCENT,
|
|
43
|
-
onClick,
|
|
44
|
-
...rest
|
|
45
|
-
}, ref) => {
|
|
46
|
-
const intl = reactIntl.useIntl();
|
|
47
|
-
legacyUtils.logDeprecationNotices({
|
|
48
|
-
size: size$1,
|
|
49
|
-
type
|
|
50
|
-
});
|
|
51
|
-
const newType = legacyUtils.establishNewType(type);
|
|
52
|
-
const newPriority = legacyUtils.establishNewPriority(priority, type);
|
|
53
|
-
const classes = clsx.clsx(`btn btn-${size$1}`, `np-btn np-btn-${size$1}`, {
|
|
54
|
-
'btn-loading': loading,
|
|
55
|
-
'btn-block np-btn-block': block,
|
|
56
|
-
disabled
|
|
57
|
-
},
|
|
58
|
-
// @ts-expect-error fix when refactor `typeClassMap` to TypeScript
|
|
59
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
60
|
-
classMap.typeClassMap[newType],
|
|
61
|
-
// @ts-expect-error fix when refactor `typeClassMap` to TypeScript
|
|
62
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
63
|
-
classMap.priorityClassMap[newPriority], className);
|
|
64
|
-
function processIndicatorSize() {
|
|
65
|
-
return ['sm', 'xs'].includes(size$1) ? 'xxs' : 'xs';
|
|
66
|
-
}
|
|
67
|
-
const Element = component ?? 'button';
|
|
68
|
-
let props;
|
|
69
|
-
if (Element === 'button') {
|
|
70
|
-
const {
|
|
71
|
-
htmlType = 'button',
|
|
72
|
-
...restProps
|
|
73
|
-
} = rest;
|
|
74
|
-
props = {
|
|
75
|
-
...restProps,
|
|
76
|
-
disabled,
|
|
77
|
-
'aria-disabled': loading,
|
|
78
|
-
type: htmlType
|
|
79
|
-
};
|
|
80
|
-
} else {
|
|
81
|
-
props = {
|
|
82
|
-
...rest,
|
|
83
|
-
'aria-disabled': loading
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Ensures that the button cannot be activated in loading or disabled mode,
|
|
88
|
-
* when `aria-disabled` might be used over the `disabled` HTML attribute
|
|
89
|
-
*/
|
|
90
|
-
const handleClick = handler => event => {
|
|
91
|
-
if (disabled || loading) {
|
|
92
|
-
event.preventDefault();
|
|
93
|
-
} else if (typeof handler === 'function') {
|
|
94
|
-
handler(event);
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
return /*#__PURE__*/jsxRuntime.jsxs(Element, {
|
|
98
|
-
ref: ref,
|
|
99
|
-
className: classes,
|
|
100
|
-
onClick: handleClick(onClick),
|
|
101
|
-
...props,
|
|
102
|
-
"aria-live": loading ? 'polite' : 'off',
|
|
103
|
-
"aria-busy": loading,
|
|
104
|
-
"aria-label": loading ? intl.formatMessage(Button_messages.loadingAriaLabel) : rest['aria-label'],
|
|
105
|
-
children: [children, loading && /*#__PURE__*/jsxRuntime.jsx(ProcessIndicator, {
|
|
106
|
-
size: processIndicatorSize(),
|
|
107
|
-
className: "btn-loader",
|
|
108
|
-
"data-testid": "ButtonProgressIndicator"
|
|
109
|
-
})]
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
module.exports = LegacyButton;
|
|
114
|
-
//# sourceMappingURL=LegacyButton.js.map
|