@transferwise/components 46.87.2 → 46.88.0
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 +9 -2
- package/build/avatarLayout/AvatarLayout.js.map +1 -1
- package/build/avatarLayout/AvatarLayout.mjs +9 -2
- package/build/avatarLayout/AvatarLayout.mjs.map +1 -1
- package/build/button/Button.js +92 -79
- package/build/button/Button.js.map +1 -1
- package/build/button/Button.mjs +93 -80
- package/build/button/Button.mjs.map +1 -1
- package/build/button/Button.resolver.js +74 -0
- package/build/button/Button.resolver.js.map +1 -0
- package/build/button/Button.resolver.mjs +72 -0
- package/build/button/Button.resolver.mjs.map +1 -0
- package/build/button/LegacyButton.js +114 -0
- package/build/button/LegacyButton.js.map +1 -0
- package/build/button/LegacyButton.mjs +112 -0
- package/build/button/LegacyButton.mjs.map +1 -0
- package/build/circularButton/CircularButton.js.map +1 -1
- package/build/circularButton/CircularButton.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 +2 -2
- 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 +247 -0
- package/build/primitives/PrimitiveAnchor/src/PrimitiveAnchor.js +2 -4
- package/build/primitives/PrimitiveAnchor/src/PrimitiveAnchor.js.map +1 -1
- package/build/primitives/PrimitiveAnchor/src/PrimitiveAnchor.mjs +2 -4
- package/build/primitives/PrimitiveAnchor/src/PrimitiveAnchor.mjs.map +1 -1
- package/build/primitives/PrimitiveButton/src/PrimitiveButton.js +3 -5
- package/build/primitives/PrimitiveButton/src/PrimitiveButton.js.map +1 -1
- package/build/primitives/PrimitiveButton/src/PrimitiveButton.mjs +3 -5
- 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 +11 -0
- package/build/styles/button/Button.css +228 -15
- package/build/styles/button/Button.vars.css +46 -0
- package/build/styles/button/LegacyButton.css +23 -0
- package/build/styles/main.css +247 -0
- package/build/types/avatarLayout/AvatarLayout.d.ts.map +1 -1
- package/build/types/button/Button.d.ts +2 -23
- package/build/types/button/Button.d.ts.map +1 -1
- package/build/types/button/Button.resolver.d.ts +35 -0
- package/build/types/button/Button.resolver.d.ts.map +1 -0
- package/build/types/button/Button.types.d.ts +70 -0
- package/build/types/button/Button.types.d.ts.map +1 -0
- package/build/types/button/LegacyButton.d.ts +44 -0
- package/build/types/button/LegacyButton.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/circularButton/CircularButton.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 +6 -2
- 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/test-utils/story-config.d.ts +1 -1
- package/build/types/test-utils/story-config.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 +3 -3
- package/src/alert/Alert.tests.story.tsx +1 -1
- package/src/avatar/Avatar.story.tsx +1 -1
- package/src/avatarLayout/AvatarLayout.css +11 -0
- package/src/avatarLayout/AvatarLayout.less +18 -1
- package/src/avatarLayout/AvatarLayout.tsx +10 -2
- package/src/avatarWrapper/AvatarWrapper.story.tsx +1 -1
- package/src/badge/Badge.story.tsx +1 -1
- package/src/button/Button.accessibility.docs.mdx +103 -0
- package/src/button/Button.css +228 -15
- package/src/button/Button.less +242 -14
- package/src/button/Button.resolver.tsx +73 -0
- package/src/button/Button.spec.tsx +329 -213
- package/src/button/Button.story.tsx +782 -134
- package/src/button/Button.tests.story.tsx +27 -0
- package/src/button/Button.tsx +103 -132
- package/src/button/Button.types.ts +92 -0
- package/src/button/Button.vars.css +46 -0
- package/src/button/Button.vars.less +59 -0
- package/src/button/LegacyButton.css +23 -0
- package/src/button/LegacyButton.less +24 -0
- package/src/button/LegacyButton.spec.tsx +147 -0
- package/src/button/LegacyButton.story.tsx +228 -0
- package/src/button/LegacyButton.tsx +177 -0
- package/src/button/index.ts +2 -3
- package/src/card/Card.story.tsx +6 -1
- package/src/circularButton/CircularButton.tsx +1 -0
- package/src/field/Field.story.tsx +1 -1
- package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +1 -2
- package/src/inputs/SelectInput.story.tsx +1 -1
- package/src/label/Label.story.tsx +1 -1
- package/src/link/Link.tsx +15 -6
- package/src/main.css +247 -0
- package/src/main.less +1 -0
- package/src/primitives/PrimitiveAnchor/src/PrimitiveAnchor.tsx +2 -8
- package/src/primitives/PrimitiveAnchor/src/PrimitiveAnchor.types.ts +7 -2
- package/src/primitives/PrimitiveAnchor/test/PrimitiveAnchor.spec.tsx +1 -3
- package/src/primitives/PrimitiveButton/src/PrimitiveButton.tsx +4 -12
- package/src/primitives/PrimitiveButton/test/PrimitiveButton.spec.tsx +16 -13
- package/src/select/Select.story.tsx +4 -1
- package/src/test-utils/Parameters.d.ts +9 -1
- package/src/test-utils/story-config.ts +10 -1
- package/src/button/__snapshots__/Button.spec.tsx.snap +0 -309
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) * var(--np-avatar-avatars-count) - (var(--np-avatar-offset) * (var(--np-avatar-avatars-count) - 1)));
|
|
527
535
|
width: calc(var(--np-avatar-size) * var(--np-avatar-avatars-count) - calc(var(--np-avatar-offset) * calc(var(--np-avatar-avatars-count) - 1)));
|
|
@@ -536,6 +544,9 @@ div.critical-comms .critical-comms-body {
|
|
|
536
544
|
.np-avatar-layout-horizontal-child {
|
|
537
545
|
margin-left: calc(var(--np-avatar-offset) * -1);
|
|
538
546
|
}
|
|
547
|
+
[dir="rtl"] .np-avatar-layout-horizontal-child {
|
|
548
|
+
margin-right: calc(var(--np-avatar-offset) * -1);
|
|
549
|
+
}
|
|
539
550
|
.np-icon-button {
|
|
540
551
|
border: none;
|
|
541
552
|
}
|
|
@@ -706,6 +717,242 @@ div.critical-comms .critical-comms-body {
|
|
|
706
717
|
.np-btn.disabled[class] {
|
|
707
718
|
pointer-events: auto;
|
|
708
719
|
}
|
|
720
|
+
.wds-Button {
|
|
721
|
+
--Button-background: var(--color-interactive-accent);
|
|
722
|
+
--Button-background-hover: var(--color-interactive-accent-hover);
|
|
723
|
+
--Button-background-active: var(--color-interactive-accent-active);
|
|
724
|
+
--Button-color: var(--color-interactive-control);
|
|
725
|
+
--Button-border-radius: var(--radius-full);
|
|
726
|
+
--Button-label-gap: var(--size-4);
|
|
727
|
+
--Button-large-padding: var(--size-12) var(--size-16);
|
|
728
|
+
--Button-medium-padding: var(--size-8) var(--size-12);
|
|
729
|
+
--Button-small-padding: var(--size-5) var(--size-12);
|
|
730
|
+
--Button-avatar-border-color: var(--color-border-neutral);
|
|
731
|
+
--Button-transition-duration: 150ms;
|
|
732
|
+
--Button-transition-easing: ease-in-out;
|
|
733
|
+
--Button-secondary-background: var(--color-interactive-neutral);
|
|
734
|
+
--Button-secondary-background-hover: var(--color-interactive-neutral-hover);
|
|
735
|
+
--Button-secondary-background-active: var(--color-interactive-neutral-active);
|
|
736
|
+
--Button-secondary-color: var(--color-interactive-primary);
|
|
737
|
+
--Button-secondary-neutral-background: var(--color-background-neutral);
|
|
738
|
+
--Button-secondary-neutral-background-hover: var(--color-background-neutral-hover);
|
|
739
|
+
--Button-secondary-neutral-background-active: var(--color-background-neutral-active);
|
|
740
|
+
--Button-secondary-neutral-color: var(--color-content-primary);
|
|
741
|
+
--Button-tertiary-background: transparent;
|
|
742
|
+
--Button-tertiary-background-hover: var(--color-background-screen-hover);
|
|
743
|
+
--Button-tertiary-background-active: var(--color-background-screen-active);
|
|
744
|
+
--Button-tertiary-color: var(--color-interactive-primary);
|
|
745
|
+
--Button-primary-negative-background: var(--color-sentiment-negative-primary);
|
|
746
|
+
--Button-primary-negative-background-hover: var(--color-sentiment-negative-primary-hover);
|
|
747
|
+
--Button-primary-negative-background-active: var(--color-sentiment-negative-primary-active);
|
|
748
|
+
--Button-primary-negative-color: var(--color-contrast-overlay);
|
|
749
|
+
--Button-secondary-negative-background: var(--color-sentiment-negative-secondary);
|
|
750
|
+
--Button-secondary-negative-background-hover: var(--color-sentiment-negative-secondary-hover);
|
|
751
|
+
--Button-secondary-negative-background-active: var(--color-sentiment-negative-secondary-active);
|
|
752
|
+
--Button-secondary-negative-color: var(--color-sentiment-negative-primary);
|
|
753
|
+
}
|
|
754
|
+
.np-theme-personal--bright-green .wds-Button {
|
|
755
|
+
--Button-primary-negative-color: var(--color-white);
|
|
756
|
+
--Button-secondary-color: var(--color-interactive-control);
|
|
757
|
+
--Button-secondary-negative-color: var(--color-white);
|
|
758
|
+
}
|
|
759
|
+
.np-theme-personal--forest-green .wds-Button {
|
|
760
|
+
--Button-secondary-background: var(--color-interactive-neutral);
|
|
761
|
+
--Button-secondary-negative-background: var(--color-sentiment-negative-primary);
|
|
762
|
+
--Button-secondary-negative-background-hover: var(--color-sentiment-negative-primary-hover);
|
|
763
|
+
--Button-secondary-negative-background-active: var(--color-sentiment-negative-primary-active);
|
|
764
|
+
--Button-secondary-negative-color: var(--color-contrast-overlay);
|
|
765
|
+
}
|
|
766
|
+
/* Button Styles */
|
|
767
|
+
.wds-Button {
|
|
768
|
+
display: inline-flex;
|
|
769
|
+
flex: none;
|
|
770
|
+
width: auto;
|
|
771
|
+
align-items: center;
|
|
772
|
+
justify-content: center;
|
|
773
|
+
vertical-align: middle;
|
|
774
|
+
text-align: center;
|
|
775
|
+
white-space: nowrap;
|
|
776
|
+
word-wrap: break-word;
|
|
777
|
+
-webkit-appearance: none;
|
|
778
|
+
-moz-appearance: none;
|
|
779
|
+
appearance: none;
|
|
780
|
+
background-color: var(--Button-background);
|
|
781
|
+
border: none;
|
|
782
|
+
border-radius: var(--Button-border-radius);
|
|
783
|
+
color: var(--Button-color);
|
|
784
|
+
cursor: pointer;
|
|
785
|
+
transition: color, background-color var(--Button-transition-duration) var(--Button-transition-easing);
|
|
786
|
+
}
|
|
787
|
+
.wds-Button,
|
|
788
|
+
.wds-Button:hover,
|
|
789
|
+
.wds-Button:active,
|
|
790
|
+
.wds-Button:focus {
|
|
791
|
+
-webkit-text-decoration: none;
|
|
792
|
+
text-decoration: none;
|
|
793
|
+
color: var(--Button-color);
|
|
794
|
+
}
|
|
795
|
+
.wds-Button:hover {
|
|
796
|
+
background-color: var(--Button-background-hover);
|
|
797
|
+
}
|
|
798
|
+
.wds-Button:active {
|
|
799
|
+
background-color: var(--Button-background-active);
|
|
800
|
+
}
|
|
801
|
+
.wds-Button.wds-Button--disabled,
|
|
802
|
+
.wds-Button:disabled {
|
|
803
|
+
filter: none;
|
|
804
|
+
mix-blend-mode: luminosity;
|
|
805
|
+
opacity: 0.45;
|
|
806
|
+
cursor: not-allowed;
|
|
807
|
+
}
|
|
808
|
+
.wds-Button.wds-Button--disabled,
|
|
809
|
+
.wds-Button:disabled,
|
|
810
|
+
.wds-Button.wds-Button--disabled:hover,
|
|
811
|
+
.wds-Button:disabled:hover,
|
|
812
|
+
.wds-Button.wds-Button--disabled:active,
|
|
813
|
+
.wds-Button:disabled:active {
|
|
814
|
+
background-color: var(--Button-background);
|
|
815
|
+
}
|
|
816
|
+
.wds-Button--secondary {
|
|
817
|
+
--Button-background: var(--Button-secondary-background);
|
|
818
|
+
--Button-background-hover: var(--Button-secondary-background-hover);
|
|
819
|
+
--Button-background-active: var(--Button-secondary-background-active);
|
|
820
|
+
--Button-color: var(--Button-secondary-color);
|
|
821
|
+
}
|
|
822
|
+
.wds-Button--secondary-neutral {
|
|
823
|
+
--Button-background: var(--Button-secondary-neutral-background);
|
|
824
|
+
--Button-background-hover: var(--Button-secondary-neutral-background-hover);
|
|
825
|
+
--Button-background-active: var(--Button-secondary-neutral-background-active);
|
|
826
|
+
--Button-color: var(--Button-secondary-neutral-color);
|
|
827
|
+
}
|
|
828
|
+
.wds-Button--secondary-neutral .wds-Button-icon--end {
|
|
829
|
+
color: var(--color-interactive-primary);
|
|
830
|
+
}
|
|
831
|
+
.wds-Button--tertiary {
|
|
832
|
+
--Button-background: var(--Button-tertiary-background);
|
|
833
|
+
--Button-background-hover: var(--Button-tertiary-background-hover);
|
|
834
|
+
--Button-background-active: var(--Button-tertiary-background-active);
|
|
835
|
+
--Button-color: var(--Button-tertiary-color);
|
|
836
|
+
}
|
|
837
|
+
.wds-Button--tertiary .wds-Button-labelText,
|
|
838
|
+
.wds-Button--tertiary:hover .wds-Button-labelText,
|
|
839
|
+
.wds-Button--tertiary:active .wds-Button-labelText,
|
|
840
|
+
.wds-Button--tertiary:focus .wds-Button-labelText {
|
|
841
|
+
-webkit-text-decoration: underline;
|
|
842
|
+
text-decoration: underline;
|
|
843
|
+
text-underline-offset: 3px;
|
|
844
|
+
text-decoration-thickness: 1px;
|
|
845
|
+
}
|
|
846
|
+
.wds-Button--negative.wds-Button--primary {
|
|
847
|
+
--Button-background: var(--Button-primary-negative-background);
|
|
848
|
+
--Button-background-hover: var(--Button-primary-negative-background-hover);
|
|
849
|
+
--Button-background-active: var(--Button-primary-negative-background-active);
|
|
850
|
+
--Button-color: var(--Button-primary-negative-color);
|
|
851
|
+
}
|
|
852
|
+
.wds-Button--negative.wds-Button--secondary {
|
|
853
|
+
--Button-background: var(--Button-secondary-negative-background);
|
|
854
|
+
--Button-background-hover: var(--Button-secondary-negative-background-hover);
|
|
855
|
+
--Button-background-active: var(--Button-secondary-negative-background-active);
|
|
856
|
+
--Button-color: var(--Button-secondary-negative-color);
|
|
857
|
+
}
|
|
858
|
+
.wds-Button--large {
|
|
859
|
+
padding: var(--Button-large-padding);
|
|
860
|
+
}
|
|
861
|
+
.wds-Button--medium {
|
|
862
|
+
padding: var(--Button-medium-padding);
|
|
863
|
+
}
|
|
864
|
+
.wds-Button--medium:has(.wds-Button-avatars) {
|
|
865
|
+
padding-inline-start: 8px;
|
|
866
|
+
padding-inline-start: var(--size-8);
|
|
867
|
+
}
|
|
868
|
+
.wds-Button--medium:has(.wds-Button-icon--end) {
|
|
869
|
+
padding-inline-end: 8px;
|
|
870
|
+
padding-inline-end: var(--size-8);
|
|
871
|
+
}
|
|
872
|
+
.wds-Button--medium .wds-Button-icon--start {
|
|
873
|
+
margin-inline-end: var(--Button-label-gap);
|
|
874
|
+
}
|
|
875
|
+
.wds-Button--small {
|
|
876
|
+
padding: var(--Button-small-padding);
|
|
877
|
+
}
|
|
878
|
+
.wds-Button--small:has(.wds-Button-icon--start) {
|
|
879
|
+
padding-inline-start: 8px;
|
|
880
|
+
padding-inline-start: var(--size-8);
|
|
881
|
+
}
|
|
882
|
+
.wds-Button--small:has(.wds-Button-icon--end) {
|
|
883
|
+
padding-inline-end: 8px;
|
|
884
|
+
padding-inline-end: var(--size-8);
|
|
885
|
+
}
|
|
886
|
+
.wds-Button--block {
|
|
887
|
+
width: 100%;
|
|
888
|
+
}
|
|
889
|
+
.wds-Button-avatars {
|
|
890
|
+
display: inline-flex;
|
|
891
|
+
}
|
|
892
|
+
.wds-Button-avatars .np-avatar-view .np-avatar-view-content {
|
|
893
|
+
color: var(--Button-color);
|
|
894
|
+
}
|
|
895
|
+
.wds-Button-icon {
|
|
896
|
+
display: inline-block;
|
|
897
|
+
}
|
|
898
|
+
.wds-Button-icon--md {
|
|
899
|
+
--Button-iconSize: calc(var(--size-10) + var(--size-8));
|
|
900
|
+
}
|
|
901
|
+
.wds-Button-icon--sm {
|
|
902
|
+
--Button-iconSize: var(--size-16);
|
|
903
|
+
}
|
|
904
|
+
.wds-Button-icon svg {
|
|
905
|
+
width: var(--Button-iconSize);
|
|
906
|
+
height: var(--Button-iconSize);
|
|
907
|
+
}
|
|
908
|
+
.wds-Button-content {
|
|
909
|
+
position: relative;
|
|
910
|
+
}
|
|
911
|
+
.wds-Button-content--loading .wds-Button-label,
|
|
912
|
+
.wds-Button-content--loading .wds-Button-media,
|
|
913
|
+
.wds-Button-content--loading .wds-Button-icon {
|
|
914
|
+
visibility: hidden;
|
|
915
|
+
opacity: 0;
|
|
916
|
+
}
|
|
917
|
+
.wds-Button-label {
|
|
918
|
+
display: flex;
|
|
919
|
+
justify-content: center;
|
|
920
|
+
align-items: center;
|
|
921
|
+
gap: var(--Button-label-gap);
|
|
922
|
+
position: relative;
|
|
923
|
+
}
|
|
924
|
+
.wds-Button-loader {
|
|
925
|
+
position: absolute;
|
|
926
|
+
width: 100%;
|
|
927
|
+
height: 100%;
|
|
928
|
+
}
|
|
929
|
+
.wds-Button-loader .process-circle {
|
|
930
|
+
stroke: var(--Button-color);
|
|
931
|
+
}
|
|
932
|
+
/* Avatar border transparency */
|
|
933
|
+
/* dark buttons get 20% transparency, light buttons get 12% */
|
|
934
|
+
.wds-Button-avatars .np-circle {
|
|
935
|
+
--circle-border-color: color-mix(in srgb, var(--Button-color) 20%, transparent);
|
|
936
|
+
}
|
|
937
|
+
.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,
|
|
938
|
+
.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,
|
|
939
|
+
.np-theme-personal:not(.np-theme-personal--dark):not(.np-theme-personal--forest-green):not(.np-theme-personal--bright-green) .wds-Button--secondary-neutral .wds-Button-avatars .np-circle,
|
|
940
|
+
.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 {
|
|
941
|
+
--circle-border-color: color-mix(in srgb, var(--Button-color) 12%, transparent);
|
|
942
|
+
}
|
|
943
|
+
.np-theme-personal--dark .wds-Button--primary .wds-Button-avatars .np-circle,
|
|
944
|
+
.np-theme-personal--dark .wds-Button--primary.wds-Button--negative .wds-Button-avatars .np-circle,
|
|
945
|
+
.np-theme-personal--forest-green .wds-Button--primary .wds-Button-avatars .np-circle,
|
|
946
|
+
.np-theme-personal--forest-green .wds-Button--primary.wds-Button--negative .wds-Button-avatars .np-circle {
|
|
947
|
+
--circle-border-color: color-mix(in srgb, var(--Button-color) 12%, transparent);
|
|
948
|
+
}
|
|
949
|
+
.np-theme-personal--bright-green .wds-Button--tertiary .wds-Button-avatars .np-circle,
|
|
950
|
+
.np-theme-personal--bright-green .wds-Button--secondary-neutral .wds-Button-avatars .np-circle {
|
|
951
|
+
--circle-border-color: color-mix(in srgb, var(--Button-color) 12%, transparent);
|
|
952
|
+
}
|
|
953
|
+
[dir="rtl"] .wds-Button .tw-icon-chevron-right,[dir="rtl"] .wds-Button .tw-icon-arrow-right,[dir="rtl"] .wds-Button .tw-icon-chevron-left,[dir="rtl"] .wds-Button .tw-icon-arrow-left,[dir="rtl"] .wds-Button .tw-icon-arrow-diagonal-down,[dir="rtl"] .wds-Button .tw-icon-arrow-diagonal-up,[dir="rtl"] .wds-Button .tw-icon-list,[dir="rtl"] .wds-Button .tw-icon-activity {
|
|
954
|
+
scale: -1 1;
|
|
955
|
+
}
|
|
709
956
|
.np-card {
|
|
710
957
|
overflow: hidden;
|
|
711
958
|
transition-property: transform, box-shadow;
|
package/src/main.less
CHANGED
|
@@ -30,13 +30,7 @@ const PrimitiveAnchor = forwardRef<HTMLAnchorElement, PrimitiveAnchorProps>(
|
|
|
30
30
|
},
|
|
31
31
|
ref,
|
|
32
32
|
) => {
|
|
33
|
-
const anchorClasses = clsx(
|
|
34
|
-
'wds-Anchor',
|
|
35
|
-
{
|
|
36
|
-
'wds-Anchor--disabled': disabled,
|
|
37
|
-
},
|
|
38
|
-
className,
|
|
39
|
-
);
|
|
33
|
+
const anchorClasses = clsx(className);
|
|
40
34
|
|
|
41
35
|
const handleClick = useCallback(
|
|
42
36
|
(event: React.MouseEvent<HTMLAnchorElement>) => {
|
|
@@ -96,7 +90,7 @@ const PrimitiveAnchor = forwardRef<HTMLAnchorElement, PrimitiveAnchorProps>(
|
|
|
96
90
|
* https://www.scottohara.me/blog/2021/05/28/disabled-links.html
|
|
97
91
|
*/
|
|
98
92
|
const anchorProps = {
|
|
99
|
-
'aria-disabled': disabled,
|
|
93
|
+
'aria-disabled': disabled || undefined,
|
|
100
94
|
className: anchorClasses,
|
|
101
95
|
'data-testid': testId,
|
|
102
96
|
href: disabled ? undefined : href,
|
|
@@ -13,16 +13,21 @@ 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' | 'type'> {
|
|
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 | undefined;
|
|
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'];
|
|
28
33
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { render, screen } from '@testing-library/react';
|
|
2
|
-
import PrimitiveAnchor from '
|
|
2
|
+
import PrimitiveAnchor from '../src';
|
|
3
3
|
|
|
4
4
|
describe('PrimitiveAnchor', () => {
|
|
5
5
|
const defaultProps = {
|
|
@@ -27,7 +27,6 @@ describe('PrimitiveAnchor', () => {
|
|
|
27
27
|
renderAnchor(props);
|
|
28
28
|
|
|
29
29
|
const link = screen.getByRole('link');
|
|
30
|
-
expect(link).toHaveClass('wds-Anchor');
|
|
31
30
|
expect(link).toHaveClass('custom-class');
|
|
32
31
|
});
|
|
33
32
|
|
|
@@ -41,7 +40,6 @@ describe('PrimitiveAnchor', () => {
|
|
|
41
40
|
|
|
42
41
|
const link = screen.getByRole('link');
|
|
43
42
|
expect(link).toHaveAttribute('aria-disabled', 'true');
|
|
44
|
-
expect(link).toHaveClass('wds-Anchor--disabled');
|
|
45
43
|
expect(link).not.toHaveAttribute('href', 'https://example.com');
|
|
46
44
|
});
|
|
47
45
|
|
|
@@ -35,14 +35,7 @@ const PrimitiveButton = forwardRef<HTMLButtonElement, PrimitiveButtonProps>(
|
|
|
35
35
|
ref,
|
|
36
36
|
) => {
|
|
37
37
|
const intl = useIntl();
|
|
38
|
-
const classNames = clsx(
|
|
39
|
-
'wds-Button',
|
|
40
|
-
{
|
|
41
|
-
'wds-Button--disabled': disabled,
|
|
42
|
-
'wds-Button--loading': loading,
|
|
43
|
-
},
|
|
44
|
-
className,
|
|
45
|
-
);
|
|
38
|
+
const classNames = clsx(className);
|
|
46
39
|
|
|
47
40
|
const handleClick = useCallback(
|
|
48
41
|
(event: React.MouseEvent<HTMLButtonElement>) => {
|
|
@@ -102,10 +95,9 @@ const PrimitiveButton = forwardRef<HTMLButtonElement, PrimitiveButtonProps>(
|
|
|
102
95
|
* by assistive technologies, set to 'polite' during loading.
|
|
103
96
|
*/
|
|
104
97
|
const buttonProps = {
|
|
105
|
-
'aria-disabled':
|
|
106
|
-
'aria-
|
|
107
|
-
|
|
108
|
-
: props['aria-label'],
|
|
98
|
+
'aria-disabled': loading || undefined,
|
|
99
|
+
'aria-busy': loading || undefined,
|
|
100
|
+
'aria-label': loading ? intl.formatMessage(messages.loadingAriaLabel) : props['aria-label'],
|
|
109
101
|
'aria-live': (loading ? 'polite' : 'off') as 'polite' | 'off' | 'assertive' | undefined,
|
|
110
102
|
className: classNames,
|
|
111
103
|
'data-testid': testId,
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { userEvent } from '@testing-library/user-event';
|
|
3
|
-
import PrimitiveButton from '..';
|
|
4
|
-
import messages from '../../../i18n/commonMessages/Button.messages';
|
|
1
|
+
import { screen } from '@testing-library/react';
|
|
5
2
|
import { render } from '../../../test-utils';
|
|
3
|
+
import PrimitiveButton from '../src';
|
|
4
|
+
import allMessages from '../../../i18n';
|
|
6
5
|
|
|
7
6
|
describe('Button', () => {
|
|
8
7
|
const defaultProps = {
|
|
@@ -12,7 +11,7 @@ describe('Button', () => {
|
|
|
12
11
|
const renderButton = (
|
|
13
12
|
props?: Partial<typeof defaultProps>,
|
|
14
13
|
locale = 'en',
|
|
15
|
-
localeMessages =
|
|
14
|
+
localeMessages = allMessages.en,
|
|
16
15
|
) => {
|
|
17
16
|
return render(
|
|
18
17
|
<PrimitiveButton {...defaultProps} {...props} />,
|
|
@@ -36,7 +35,6 @@ describe('Button', () => {
|
|
|
36
35
|
renderButton(props);
|
|
37
36
|
|
|
38
37
|
const button = screen.getByRole('button');
|
|
39
|
-
expect(button).toHaveClass('wds-Button');
|
|
40
38
|
expect(button).toHaveClass('custom-class');
|
|
41
39
|
});
|
|
42
40
|
|
|
@@ -49,10 +47,20 @@ describe('Button', () => {
|
|
|
49
47
|
renderButton(props);
|
|
50
48
|
|
|
51
49
|
const button = screen.getByRole('button');
|
|
52
|
-
expect(button).toHaveClass('wds-Button--disabled');
|
|
53
50
|
expect(button).toBeDisabled();
|
|
54
51
|
});
|
|
55
52
|
|
|
53
|
+
it('disables and announces the button as busy in loading mode', () => {
|
|
54
|
+
const props = {
|
|
55
|
+
...defaultProps,
|
|
56
|
+
loading: true,
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
renderButton(props);
|
|
60
|
+
|
|
61
|
+
expect(screen.getByRole('button', { busy: true })).toHaveAttribute('aria-disabled', 'true');
|
|
62
|
+
});
|
|
63
|
+
|
|
56
64
|
it('sets data-testid attribute', () => {
|
|
57
65
|
const props = {
|
|
58
66
|
...defaultProps,
|
|
@@ -101,12 +109,7 @@ describe('Button', () => {
|
|
|
101
109
|
loading: true,
|
|
102
110
|
};
|
|
103
111
|
|
|
104
|
-
|
|
105
|
-
...messages,
|
|
106
|
-
'neptune.Button.loadingAriaLabel': 'cargando',
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
renderButton(props, 'es', spanishMessages);
|
|
112
|
+
renderButton(props, 'es', allMessages.es);
|
|
110
113
|
|
|
111
114
|
const button = screen.getByRole('button');
|
|
112
115
|
expect(button).toHaveAttribute('aria-label', 'cargando');
|
|
@@ -4,9 +4,12 @@ import { useState } from 'react';
|
|
|
4
4
|
|
|
5
5
|
import Select, { SelectItem, SelectOptionItem } from './Select';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated Use **`SelectInput`** instead (https://neptune.wise.design/blog/2023-11-28-adopting-our-new-selectinput)
|
|
9
|
+
*/
|
|
7
10
|
export default {
|
|
8
11
|
component: Select,
|
|
9
|
-
title: 'Forms/Select',
|
|
12
|
+
title: 'Forms/Select (Deprecated)',
|
|
10
13
|
};
|
|
11
14
|
|
|
12
15
|
const ImageIcon = () => (
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
declare module '@storybook/react' {
|
|
2
2
|
interface Parameters {
|
|
3
3
|
/** Prefer using `storyConfig` for configuring variants */
|
|
4
|
-
variants?: (
|
|
4
|
+
variants?: (
|
|
5
|
+
| 'default'
|
|
6
|
+
| 'light'
|
|
7
|
+
| 'dark'
|
|
8
|
+
| 'bright-green'
|
|
9
|
+
| 'forest-green'
|
|
10
|
+
| 'rtl'
|
|
11
|
+
| (string & Record<string, unknown>)
|
|
12
|
+
)[];
|
|
5
13
|
/** Used by Chromatic */
|
|
6
14
|
chromatic?: ChromaticParameters;
|
|
7
15
|
viewport?: {
|
|
@@ -30,7 +30,16 @@ interface StoryConfig {
|
|
|
30
30
|
*
|
|
31
31
|
* @default undefined
|
|
32
32
|
*/
|
|
33
|
-
variants?: (
|
|
33
|
+
variants?: (
|
|
34
|
+
| 'default'
|
|
35
|
+
| 'light'
|
|
36
|
+
| 'dark'
|
|
37
|
+
| 'bright-green'
|
|
38
|
+
| 'forest-green'
|
|
39
|
+
| 'rtl'
|
|
40
|
+
| 'mobile'
|
|
41
|
+
| '400%'
|
|
42
|
+
)[];
|
|
34
43
|
}
|
|
35
44
|
|
|
36
45
|
const getViewportWidth = (viewport: (typeof viewports)[keyof typeof viewports]) => {
|