@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.
Files changed (155) hide show
  1. package/build/avatarLayout/AvatarLayout.js +10 -2
  2. package/build/avatarLayout/AvatarLayout.js.map +1 -1
  3. package/build/avatarLayout/AvatarLayout.mjs +10 -2
  4. package/build/avatarLayout/AvatarLayout.mjs.map +1 -1
  5. package/build/button/Button/src/Button.js +93 -0
  6. package/build/button/Button/src/Button.js.map +1 -0
  7. package/build/button/Button/src/Button.mjs +91 -0
  8. package/build/button/Button/src/Button.mjs.map +1 -0
  9. package/build/button/{Button.js → LegacyButton/Button.js} +25 -24
  10. package/build/button/LegacyButton/Button.js.map +1 -0
  11. package/build/button/{Button.mjs → LegacyButton/Button.mjs} +25 -24
  12. package/build/button/LegacyButton/Button.mjs.map +1 -0
  13. package/build/button/LegacyButton/classMap.js +42 -0
  14. package/build/button/LegacyButton/classMap.js.map +1 -0
  15. package/build/button/LegacyButton/classMap.mjs +39 -0
  16. package/build/button/LegacyButton/classMap.mjs.map +1 -0
  17. package/build/button/{legacyUtils → LegacyButton/legacyUtils}/legacyUtils.js +21 -21
  18. package/build/button/LegacyButton/legacyUtils/legacyUtils.js.map +1 -0
  19. package/build/button/{legacyUtils → LegacyButton/legacyUtils}/legacyUtils.mjs +21 -21
  20. package/build/button/LegacyButton/legacyUtils/legacyUtils.mjs.map +1 -0
  21. package/build/button/src/Button.js +76 -0
  22. package/build/button/src/Button.js.map +1 -0
  23. package/build/button/src/Button.mjs +74 -0
  24. package/build/button/src/Button.mjs.map +1 -0
  25. package/build/circularButton/CircularButton.js +1 -1
  26. package/build/circularButton/CircularButton.js.map +1 -1
  27. package/build/circularButton/CircularButton.mjs +1 -1
  28. package/build/circularButton/CircularButton.mjs.map +1 -1
  29. package/build/common/action/Action.js +1 -1
  30. package/build/common/action/Action.js.map +1 -1
  31. package/build/common/action/Action.mjs +1 -1
  32. package/build/common/action/Action.mjs.map +1 -1
  33. package/build/criticalBanner/CriticalCommsBanner.js +1 -1
  34. package/build/criticalBanner/CriticalCommsBanner.mjs +1 -1
  35. package/build/header/Header.js +1 -1
  36. package/build/header/Header.mjs +1 -1
  37. package/build/index.js +1 -1
  38. package/build/index.mjs +1 -1
  39. package/build/link/Link.js +8 -3
  40. package/build/link/Link.js.map +1 -1
  41. package/build/link/Link.mjs +8 -3
  42. package/build/link/Link.mjs.map +1 -1
  43. package/build/main.css +288 -29
  44. package/build/nudge/Nudge.js +1 -1
  45. package/build/nudge/Nudge.js.map +1 -1
  46. package/build/nudge/Nudge.mjs +1 -1
  47. package/build/nudge/Nudge.mjs.map +1 -1
  48. package/build/select/Select.js +4 -2
  49. package/build/select/Select.js.map +1 -1
  50. package/build/select/Select.mjs +4 -2
  51. package/build/select/Select.mjs.map +1 -1
  52. package/build/styles/avatarLayout/AvatarLayout.css +11 -0
  53. package/build/styles/button/Button/less/Button.css +253 -0
  54. package/build/styles/button/Button/less/Button.vars.css +57 -0
  55. package/build/styles/iconButton/IconButton.css +24 -29
  56. package/build/styles/main.css +288 -29
  57. package/build/types/avatarLayout/AvatarLayout.d.ts +1 -2
  58. package/build/types/avatarLayout/AvatarLayout.d.ts.map +1 -1
  59. package/build/types/avatarLayout/index.d.ts +1 -0
  60. package/build/types/avatarLayout/index.d.ts.map +1 -1
  61. package/build/types/button/Button/index.d.ts +3 -0
  62. package/build/types/button/Button/index.d.ts.map +1 -0
  63. package/build/types/button/Button/src/Button.d.ts +4 -0
  64. package/build/types/button/Button/src/Button.d.ts.map +1 -0
  65. package/build/types/button/Button/src/Button.types.d.ts +50 -0
  66. package/build/types/button/Button/src/Button.types.d.ts.map +1 -0
  67. package/build/types/button/Button/src/index.d.ts +2 -0
  68. package/build/types/button/Button/src/index.d.ts.map +1 -0
  69. package/build/types/button/{Button.d.ts → LegacyButton/Button.d.ts} +6 -4
  70. package/build/types/button/LegacyButton/Button.d.ts.map +1 -0
  71. package/build/types/button/LegacyButton/classMap.d.ts.map +1 -0
  72. package/build/types/button/LegacyButton/index.d.ts +3 -0
  73. package/build/types/button/LegacyButton/index.d.ts.map +1 -0
  74. package/build/types/button/LegacyButton/legacyUtils/index.d.ts.map +1 -0
  75. package/build/types/button/{legacyUtils → LegacyButton/legacyUtils}/legacyUtils.d.ts +1 -1
  76. package/build/types/button/LegacyButton/legacyUtils/legacyUtils.d.ts.map +1 -0
  77. package/build/types/button/index.d.ts +2 -2
  78. package/build/types/button/index.d.ts.map +1 -1
  79. package/build/types/button/src/Button.d.ts +30 -0
  80. package/build/types/button/src/Button.d.ts.map +1 -0
  81. package/build/types/button/src/index.d.ts +3 -0
  82. package/build/types/button/src/index.d.ts.map +1 -0
  83. package/build/types/link/Link.d.ts +2 -2
  84. package/build/types/link/Link.d.ts.map +1 -1
  85. package/build/types/select/Select.d.ts.map +1 -1
  86. package/build/types/test-utils/index.d.ts.map +1 -1
  87. package/build/upload/steps/completeStep/completeStep.js +1 -1
  88. package/build/upload/steps/completeStep/completeStep.mjs +1 -1
  89. package/build/upload/steps/processingStep/processingStep.js +1 -1
  90. package/build/upload/steps/processingStep/processingStep.mjs +1 -1
  91. package/build/uploadInput/UploadInput.js +1 -1
  92. package/build/uploadInput/UploadInput.mjs +1 -1
  93. package/package.json +5 -5
  94. package/src/avatarLayout/AvatarLayout.css +11 -0
  95. package/src/avatarLayout/AvatarLayout.less +18 -1
  96. package/src/avatarLayout/AvatarLayout.story.tsx +2 -0
  97. package/src/avatarLayout/AvatarLayout.tsx +14 -4
  98. package/src/avatarLayout/index.ts +1 -0
  99. package/src/avatarWrapper/AvatarWrapper.story.tsx +2 -0
  100. package/src/button/Button/index.ts +2 -0
  101. package/src/button/Button/less/Button.css +253 -0
  102. package/src/button/Button/less/Button.less +221 -0
  103. package/src/button/Button/less/Button.vars.css +57 -0
  104. package/src/button/Button/less/Button.vars.less +65 -0
  105. package/src/button/Button/src/Button.tsx +116 -0
  106. package/src/button/Button/src/Button.types.ts +70 -0
  107. package/src/button/Button/src/index.ts +1 -0
  108. package/src/button/Button/stories/Button.story.tsx +314 -0
  109. package/src/button/Button/stories/Button.tests.story.tsx +288 -0
  110. package/src/button/Button/test/Button.spec.tsx +328 -0
  111. package/src/button/{Button.less → LegacyButton/Button.less} +1 -1
  112. package/src/button/{Button.spec.tsx → LegacyButton/Button.spec.tsx} +3 -3
  113. package/src/button/LegacyButton/Button.story.tsx +224 -0
  114. package/src/button/{Button.tsx → LegacyButton/Button.tsx} +12 -8
  115. package/src/button/{classMap.ts → LegacyButton/classMap.ts} +1 -1
  116. package/src/button/LegacyButton/index.ts +3 -0
  117. package/src/button/{legacyUtils → LegacyButton/legacyUtils}/legacyUtils.spec.tsx +2 -2
  118. package/src/button/{legacyUtils → LegacyButton/legacyUtils}/legacyUtils.ts +2 -2
  119. package/src/button/index.ts +2 -3
  120. package/src/button/src/Button.tsx +118 -0
  121. package/src/button/src/index.ts +2 -0
  122. package/src/button/test/Button.spec.tsx +66 -0
  123. package/src/circularButton/CircularButton.tsx +1 -1
  124. package/src/common/action/Action.tsx +1 -1
  125. package/src/iconButton/IconButton.css +24 -29
  126. package/src/iconButton/IconButton.less +4 -4
  127. package/src/link/Link.tsx +15 -6
  128. package/src/main.css +288 -29
  129. package/src/main.less +2 -1
  130. package/src/nudge/Nudge.tsx +1 -1
  131. package/src/primitives/PrimitiveAnchor/stories/PrimitiveAnchor.story.tsx +1 -1
  132. package/src/primitives/PrimitiveAnchor/test/PrimitiveAnchor.spec.tsx +1 -1
  133. package/src/primitives/PrimitiveButton/stories/PrimitiveButton.story.tsx +1 -1
  134. package/src/primitives/PrimitiveButton/test/PrimitiveButton.spec.tsx +2 -3
  135. package/src/select/Select.tsx +1 -0
  136. package/src/test-utils/index.tsx +0 -1
  137. package/build/button/Button.js.map +0 -1
  138. package/build/button/Button.mjs.map +0 -1
  139. package/build/button/classMap.js +0 -42
  140. package/build/button/classMap.js.map +0 -1
  141. package/build/button/classMap.mjs +0 -39
  142. package/build/button/classMap.mjs.map +0 -1
  143. package/build/button/legacyUtils/legacyUtils.js.map +0 -1
  144. package/build/button/legacyUtils/legacyUtils.mjs.map +0 -1
  145. package/build/types/button/Button.d.ts.map +0 -1
  146. package/build/types/button/classMap.d.ts.map +0 -1
  147. package/build/types/button/legacyUtils/index.d.ts.map +0 -1
  148. package/build/types/button/legacyUtils/legacyUtils.d.ts.map +0 -1
  149. package/src/button/Button.story.tsx +0 -163
  150. /package/build/styles/button/{Button.css → LegacyButton/Button.css} +0 -0
  151. /package/build/types/button/{classMap.d.ts → LegacyButton/classMap.d.ts} +0 -0
  152. /package/build/types/button/{legacyUtils → LegacyButton/legacyUtils}/index.d.ts +0 -0
  153. /package/src/button/{Button.css → LegacyButton/Button.css} +0 -0
  154. /package/src/button/{__snapshots__ → LegacyButton/__snapshots__}/Button.spec.tsx.snap +0 -0
  155. /package/src/button/{legacyUtils → LegacyButton/legacyUtils}/index.ts +0 -0
@@ -0,0 +1,221 @@
1
+ @import './Button.vars.less';
2
+
3
+ /* Button Styles */
4
+ .wds-Button {
5
+ display: inline-flex;
6
+ flex: none;
7
+ width: auto;
8
+ align-items: center;
9
+ justify-content: center;
10
+ vertical-align: middle;
11
+ font-weight: var(--Button-font-weight);
12
+ font-size: var(--Button-font-size);
13
+ letter-spacing: var(--Button-letter-spacing);
14
+ line-height: var(--Button-line-height);
15
+ text-align: center;
16
+ text-decoration: none;
17
+ white-space: nowrap;
18
+ word-wrap: break-word;
19
+ appearance: none;
20
+ background-color: var(--Button-background);
21
+ border: none;
22
+ border-radius: var(--Button-border-radius);
23
+ color: var(--Button-color);
24
+ cursor: pointer;
25
+ padding: var(--Button-padding);
26
+
27
+ &:focus {
28
+ text-decoration: none;
29
+ }
30
+
31
+ &:hover {
32
+ background-color: var(--Button-background-hover);
33
+ text-decoration: none;
34
+ }
35
+
36
+ &:active {
37
+ background-color: var(--Button-background-active);
38
+ text-decoration: none;
39
+ }
40
+
41
+ &:disabled {
42
+ mix-blend-mode: luminosity;
43
+ opacity: 0.45;
44
+ cursor: not-allowed;
45
+
46
+ &:hover,
47
+ &:active {
48
+ background-color: var(--Button-background);
49
+ }
50
+ }
51
+
52
+ // Priority modifiers
53
+ &--secondary {
54
+ --Button-background: var(--Button-secondary-background);
55
+ --Button-background-hover: var(--Button-secondary-hover-background);
56
+ --Button-background-active: var(--Button-secondary-active-background);
57
+ --Button-color: var(--Button-secondary-color);
58
+ }
59
+
60
+ &--tertiary {
61
+ --Button-background: var(--Button-tertiary-background);
62
+ --Button-background-hover: var(--Button-tertiary-hover-background);
63
+ --Button-background-active: var(--Button-tertiary-active-background);
64
+ --Button-color: var(--Button-tertiary-color);
65
+
66
+ .wds-Button-icon--right {
67
+ color: var(--color-interactive-primary);
68
+ }
69
+ }
70
+
71
+ &--minimal {
72
+ --Button-background: var(--Button-minimal-background);
73
+ --Button-background-hover: var(--Button-minimal-hover-background);
74
+ --Button-background-active: var(--Button-minimal-active-background);
75
+ --Button-color: var(--Button-minimal-color);
76
+
77
+ text-decoration: underline;
78
+
79
+ &:hover,
80
+ &:hover:active {
81
+ text-decoration: underline;
82
+ }
83
+ }
84
+
85
+ // Negative styles
86
+ &--negative {
87
+
88
+ &.wds-Button--primary {
89
+ --Button-background: var(--Button-primary-negative-background);
90
+ --Button-background-hover: var(--Button-primary-negative-hover-background);
91
+ --Button-background-active: var(--Button-primary-negative-active-background);
92
+ --Button-color: var(--Button-primary-negative-color);
93
+ --Button-avatar-border-color: var(--Button-primary-netative-avatar-border-color);
94
+ }
95
+
96
+ &.wds-Button--secondary {
97
+ --Button-background: var(--Button-secondary-negative-background);
98
+ --Button-background-hover: var(--Button-secondary-negative-hover-background);
99
+ --Button-background-active: var(--Button-secondary-negative-active-background);
100
+ --Button-color: var(--Button-secondary-negative-color);
101
+ --Button-avatar-border-color: var(--Button-secondary-netative-avatar-border-color);
102
+ }
103
+ }
104
+
105
+ // Size modifiers
106
+ &--small {
107
+ --Button-padding: var(--Button-size-small-padding);
108
+ --Button-line-height: 22px;
109
+ --Button-font-size: var(--font-size-14);
110
+ --Button-letter-spacing: -0.006em;
111
+
112
+ .wds-Button-icon--left {
113
+ margin-right: var(--size-4);
114
+ :dir(rtl) & {
115
+ margin-right: 0;
116
+ margin-left: var(--size-4);
117
+ }
118
+ }
119
+ }
120
+
121
+ &--medium {
122
+ --Button-padding: var(--Button-size-medium-padding);
123
+ }
124
+
125
+ &--large {
126
+ --Button-padding: var(--Button-size-large-padding);
127
+ }
128
+
129
+ // Width mofidiers
130
+ &--block {
131
+ width: 100%;
132
+ }
133
+
134
+ &-avatars {
135
+ display: inline-flex;
136
+ margin-right: 5px;
137
+ margin-left: calc(var(--size-4) * -1);
138
+
139
+ :dir(rtl) & {
140
+ margin-right: 0;
141
+ margin-left: 5px;
142
+ }
143
+
144
+ .np-circle {
145
+ --circle-border-color: var(--Button-avatar-border-color);
146
+ }
147
+
148
+ .np-avatar-view .np-avatar-view-content {
149
+ color: var(--Button-color);
150
+ }
151
+ }
152
+
153
+ // Icon styles
154
+ &-icon {
155
+ display: inline-block;
156
+
157
+ &--left {
158
+ margin-right: var(--size-8);
159
+ :dir(rtl) & {
160
+ margin-right: 0;
161
+ margin-left: var(--size-8);
162
+ }
163
+ }
164
+
165
+ &--right {
166
+ margin-left: var(--size-4);
167
+ :dir(rtl) & {
168
+ margin-left: 0;
169
+ margin-right: var(--size-4);
170
+ }
171
+ }
172
+ }
173
+
174
+ &-content {
175
+ position: relative;
176
+
177
+ &--loading {
178
+ .wds-Button-label,
179
+ .wds-Button-media,
180
+ .wds-Button-icon {
181
+ visibility: hidden;
182
+ opacity: 0;
183
+ }
184
+ }
185
+ }
186
+
187
+ &-label {
188
+ display: flex;
189
+ justify-content: center;
190
+ align-items: center;
191
+ position: relative;
192
+ }
193
+
194
+ &-loader {
195
+ position: absolute;
196
+ display: flex;
197
+ justify-content: center;
198
+ align-items: center;
199
+ width: 100%;
200
+ height: 100%;
201
+
202
+ .process-circle {
203
+ stroke: var(--Button-color);
204
+ }
205
+ }
206
+ }
207
+
208
+ /* RTL Styles */
209
+ :dir(rtl) {
210
+ .wds-Button {
211
+ .tw-icon-chevron-right,
212
+ .tw-icon-arrow-right {
213
+ transform: rotate(180deg);
214
+ }
215
+
216
+ .tw-icon-chevron-left,
217
+ .tw-icon-arrow-left {
218
+ transform: rotate(180deg);
219
+ }
220
+ }
221
+ }
@@ -0,0 +1,57 @@
1
+ :root {
2
+ --Button-background: var(--color-interactive-accent);
3
+ --Button-background-hover: var(--color-interactive-accent-hover);
4
+ --Button-background-active: var(--color-interactive-accent-active);
5
+ --Button-color: var(--color-interactive-control);
6
+ --Button-padding: var(--size-8) var(--size-12);
7
+ --Button-border-radius: var(--radius-full);
8
+ --Button-font-size: var(--font-size-16);
9
+ --Button-line-height: var(--size-24);
10
+ --Button-font-weight: var(--font-weight-semi-bold);
11
+ --Button-letter-spacing: -0.011em;
12
+ --Button-size-small-padding: 5px var(--size-12);
13
+ --Button-size-medium-padding: var(--size-8) var(--size-12);
14
+ --Button-size-large-padding: var(--size-12) var(--size-16);
15
+ --Button-avatar-border-color: var(--color-border-neutral);
16
+ --Button-secondary-background: var(--color-interactive-neutral);
17
+ --Button-secondary-background-hover: var(--color-interactive-neutral-hover);
18
+ --Button-secondary-background-active: var(--color-interactive-neutral-active);
19
+ --Button-secondary-color: var(--color-interactive-primary);
20
+ --Button-tertiary-background: var(--color-background-neutral);
21
+ --Button-tertiary-background-hover: var(--color-background-neutral-hover);
22
+ --Button-tertiary-background-active: var(--color-background-neutral-active);
23
+ --Button-tertiary-color: var(--color-content-primary);
24
+ --Button-minimal-background: transparent;
25
+ --Button-minimal-background-hover: var(--color-background-screen-hover);
26
+ --Button-minimal-background-active: var(--color-background-screen-active);
27
+ --Button-minimal-color: var(--color-interactive-primary);
28
+ --Button-primary-negative-background: var(--color-sentiment-negative-primary);
29
+ --Button-primary-negative-background-hover: var(--color-sentiment-negative-primary-hover);
30
+ --Button-primary-negative-background-active: var(--color-sentiment-negative-primary-active);
31
+ --Button-primary-negative-color: var(--color-contrast);
32
+ --Button-primary-netative-avatar-border-color: rgba(255,255,255,0.2);
33
+ --Button-secondary-negative-background: var(--color-sentiment-negative-secondary);
34
+ --Button-secondary-negative-background-hover: var(--color-sentiment-negative-secondary-hover);
35
+ --Button-secondary-negative-background-active: var(--color-sentiment-negative-secondary-active);
36
+ --Button-secondary-negative-color: var(--color-sentiment-negative-primary);
37
+ --Button-secondary-netative-avatar-border-color: rgba(168,32,13,0.12157);
38
+ }
39
+ .np-theme-personal--dark {
40
+ --Button-primary-netative-avatar-border-color: rgba(14,15,12,0.12157);
41
+ }
42
+ .np-theme-personal--forest-green {
43
+ --color-interactive-neutral: rgba(159,232,112,0.2);
44
+ --color-interactive-neutral-hover: rgba(205,255,173,0.2);
45
+ --color-interactive-neutral-active: rgba(236,255,224,0.2);
46
+ --color-sentiment-negative-secondary: rgba(255,196,194,0.2);
47
+ --color-sentiment-negative-secondary-hover: rgba(255,220,219,0.2);
48
+ --color-sentiment-negative-secondary-active: rgba(255,235,235,0.2);
49
+ --Button-primary-netative-avatar-border-color: rgba(14,15,12,0.12157);
50
+ --Button-secondary-netative-avatar-border-color: rgba(14,15,12,0.12157);
51
+ }
52
+ .np-theme-personal--bright-green {
53
+ --color-contrast: #FFFFFF;
54
+ --Button-secondary-color: var(--color-interactive-control);
55
+ --Button-secondary-negative-color: var(--color-contrast);
56
+ --Button-secondary-netative-avatar-border-color: var(--Button-primary-netative-avatar-border-color);
57
+ }
@@ -0,0 +1,65 @@
1
+ :root {
2
+ --Button-background: var(--color-interactive-accent);
3
+ --Button-background-hover: var(--color-interactive-accent-hover);
4
+ --Button-background-active: var(--color-interactive-accent-active);
5
+ --Button-color: var(--color-interactive-control);
6
+ --Button-padding: var(--size-8) var(--size-12);
7
+ --Button-border-radius: var(--radius-full);
8
+ --Button-font-size: var(--font-size-16);
9
+ --Button-line-height: var(--size-24);
10
+ --Button-font-weight: var(--font-weight-semi-bold);
11
+ --Button-letter-spacing: -0.011em;
12
+ --Button-size-small-padding: 5px var(--size-12);
13
+ --Button-size-medium-padding: var(--size-8) var(--size-12);
14
+ --Button-size-large-padding: var(--size-12) var(--size-16);
15
+ --Button-avatar-border-color: var(--color-border-neutral);
16
+
17
+ --Button-secondary-background: var(--color-interactive-neutral);
18
+ --Button-secondary-background-hover: var(--color-interactive-neutral-hover);
19
+ --Button-secondary-background-active: var(--color-interactive-neutral-active);
20
+ --Button-secondary-color: var(--color-interactive-primary);
21
+
22
+ --Button-tertiary-background: var(--color-background-neutral);
23
+ --Button-tertiary-background-hover: var(--color-background-neutral-hover);
24
+ --Button-tertiary-background-active: var(--color-background-neutral-active);
25
+ --Button-tertiary-color: var(--color-content-primary);
26
+
27
+ --Button-minimal-background: transparent;
28
+ --Button-minimal-background-hover: var(--color-background-screen-hover);
29
+ --Button-minimal-background-active: var(--color-background-screen-active);
30
+ --Button-minimal-color: var(--color-interactive-primary);
31
+
32
+ --Button-primary-negative-background: var(--color-sentiment-negative-primary);
33
+ --Button-primary-negative-background-hover: var(--color-sentiment-negative-primary-hover);
34
+ --Button-primary-negative-background-active: var(--color-sentiment-negative-primary-active);
35
+ --Button-primary-negative-color: var(--color-contrast);
36
+ --Button-primary-netative-avatar-border-color: #FFFFFF33;
37
+
38
+ --Button-secondary-negative-background: var(--color-sentiment-negative-secondary);
39
+ --Button-secondary-negative-background-hover: var(--color-sentiment-negative-secondary-hover);
40
+ --Button-secondary-negative-background-active: var(--color-sentiment-negative-secondary-active);
41
+ --Button-secondary-negative-color: var(--color-sentiment-negative-primary);
42
+ --Button-secondary-netative-avatar-border-color: #A8200D1F;
43
+ }
44
+
45
+ .np-theme-personal--dark {
46
+ --Button-primary-netative-avatar-border-color: #0E0F0C1F;
47
+ }
48
+
49
+ .np-theme-personal--forest-green {
50
+ --color-interactive-neutral: #9FE87033;
51
+ --color-interactive-neutral-hover: #CDFFAD33;
52
+ --color-interactive-neutral-active: #ECFFE033;
53
+ --color-sentiment-negative-secondary: #FFC4C233;
54
+ --color-sentiment-negative-secondary-hover: #FFDCDB33;
55
+ --color-sentiment-negative-secondary-active: #FFEBEB33;
56
+ --Button-primary-netative-avatar-border-color: #0E0F0C1F;
57
+ --Button-secondary-netative-avatar-border-color: #0E0F0C1F;
58
+ }
59
+
60
+ .np-theme-personal--bright-green {
61
+ --color-contrast: #FFFFFF;
62
+ --Button-secondary-color: var(--color-interactive-control);
63
+ --Button-secondary-negative-color: var(--color-contrast);
64
+ --Button-secondary-netative-avatar-border-color: var(--Button-primary-netative-avatar-border-color);
65
+ }
@@ -0,0 +1,116 @@
1
+ import React, { forwardRef, useMemo } from 'react';
2
+ import { clsx } from 'clsx';
3
+ import type { ButtonProps } from './Button.types';
4
+ import PrimitiveButton from '../../../primitives/PrimitiveButton';
5
+ import PrimitiveAnchor from '../../../primitives/PrimitiveAnchor';
6
+ import ProcessIndicator from '../../../processIndicator/ProcessIndicator';
7
+ import AvatarView from '../../../avatarView/AvatarView';
8
+ import AvatarLayout from '../../../avatarLayout/AvatarLayout';
9
+
10
+ const Button = forwardRef<HTMLButtonElement | HTMLAnchorElement, ButtonProps>(
11
+ (
12
+ {
13
+ as = 'button',
14
+ children,
15
+ className,
16
+ size = 'md',
17
+ href,
18
+ priority = 'primary',
19
+ appearance = 'default',
20
+ iconLeft: LeftIcon,
21
+ iconRight: RightIcon,
22
+ avatars,
23
+ type = 'button',
24
+ loading = false,
25
+ block = false,
26
+ ...props
27
+ },
28
+ ref,
29
+ ) => {
30
+ const sizeClass = useMemo(() => {
31
+ return size === 'sm' ? 'small' : size === 'md' ? 'medium' : size === 'lg' ? 'large' : '';
32
+ }, [size]);
33
+
34
+ const classNames = clsx(
35
+ {
36
+ [`wds-Button`]: as === 'a',
37
+ [`wds-Button--block`]: block,
38
+ [`wds-Button--${sizeClass}`]: size,
39
+ [`wds-Button--${priority}`]: priority,
40
+ [`wds-Button--${appearance}`]: appearance,
41
+ },
42
+ className,
43
+ );
44
+
45
+ const contentClassNames = clsx('wds-Button-content', {
46
+ [`wds-Button-content--loading`]: loading,
47
+ });
48
+
49
+ const content = (
50
+ <span className={contentClassNames}>
51
+ {loading && (
52
+ <ProcessIndicator
53
+ size="xs"
54
+ className="wds-Button-loader"
55
+ data-testid="button-loader-indicator"
56
+ />
57
+ )}
58
+ <span className="wds-Button-label" aria-hidden={loading}>
59
+ {size === 'lg' ? (
60
+ children
61
+ ) : (
62
+ <>
63
+ {size === 'md' && avatars && (
64
+ <span className="wds-Button-avatars">
65
+ {avatars.length === 1 ? (
66
+ <AvatarView size={24} {...avatars[0]}>
67
+ {avatars[0]?.asset}
68
+ </AvatarView>
69
+ ) : (
70
+ <AvatarLayout orientation="horizontal" avatars={avatars} size={24} />
71
+ )}
72
+ </span>
73
+ )}
74
+ {!avatars && LeftIcon && (
75
+ <LeftIcon className="wds-Button-icon wds-Button-icon--left" />
76
+ )}
77
+ {children}
78
+ {RightIcon && <RightIcon className="wds-Button-icon wds-Button-icon--right" />}
79
+ </>
80
+ )}
81
+ </span>
82
+ </span>
83
+ );
84
+
85
+ if (as === 'a') {
86
+ return (
87
+ <PrimitiveAnchor
88
+ ref={ref as React.Ref<HTMLAnchorElement>}
89
+ {...(props as any)}
90
+ href={href}
91
+ className={classNames}
92
+ disabled={props.disabled}
93
+ >
94
+ {content}
95
+ </PrimitiveAnchor>
96
+ );
97
+ }
98
+
99
+ return (
100
+ <PrimitiveButton
101
+ ref={ref as React.Ref<HTMLButtonElement>}
102
+ {...(props as any)}
103
+ className={classNames}
104
+ disabled={props.disabled}
105
+ loading={loading}
106
+ type={type}
107
+ >
108
+ {content}
109
+ </PrimitiveButton>
110
+ );
111
+ },
112
+ );
113
+
114
+ Button.displayName = 'Button';
115
+
116
+ export default Button;
@@ -0,0 +1,70 @@
1
+ import { ReactNode } from 'react';
2
+ import type {
3
+ PrimitiveButtonProps,
4
+ PrimitiveAnchorProps,
5
+ PrimitiveButtonElementRef,
6
+ PrimitiveAnchorElementRef,
7
+ } from '../../../primitives';
8
+ import type { SingleAvatarType } from '../../../avatarLayout';
9
+
10
+ export type ButtonApperance = 'default' | 'negative';
11
+ export type ButtonPriority = 'primary' | 'secondary' | 'tertiary' | 'minimal';
12
+ export type ButtonType = 'button' | 'submit' | 'reset';
13
+ export type ButtonSize = 'sm' | 'md' | 'lg';
14
+ export type ButtonRefType = PrimitiveButtonElementRef | PrimitiveAnchorElementRef;
15
+
16
+ /**
17
+ * Common properties for the Button component.
18
+ */
19
+ export interface CommonButtonProps {
20
+ /** The HTML element to render */
21
+ as?: 'button' | 'a';
22
+
23
+ /** Additional class name(s) to apply to the button */
24
+ className?: string;
25
+
26
+ /** Content to be displayed inside the button */
27
+ children?: ReactNode;
28
+
29
+ /** Whether the button is disabled */
30
+ disabled?: boolean;
31
+
32
+ href?: string;
33
+
34
+ /** Whether the button is in a loading state */
35
+ loading?: boolean;
36
+
37
+ /** Whether the button should take up the full width of its container */
38
+ block?: boolean;
39
+
40
+ /** Size of the button */
41
+ size?: ButtonSize;
42
+
43
+ /**
44
+ * Priority of the button
45
+ * @default 'primary'
46
+ */
47
+ priority?: ButtonPriority;
48
+
49
+ /**
50
+ * Appearance of the button
51
+ * @default 'default'
52
+ */
53
+ appearance?: ButtonApperance;
54
+
55
+ /** Icon to be displayed on the left side of the button */
56
+ iconLeft?: React.ElementType;
57
+
58
+ /** Icon to be displayed on the right side of the button */
59
+ iconRight?: React.ElementType;
60
+
61
+ /** Media to be displayed on the left side of the button */
62
+ avatars?: SingleAvatarType[];
63
+
64
+ /** Optional property to provide component Ref */
65
+ ref?: ButtonRefType;
66
+ }
67
+
68
+ export type ButtonElementProps = PrimitiveButtonProps & CommonButtonProps;
69
+ export type AnchorElementProps = PrimitiveAnchorProps & CommonButtonProps;
70
+ export type ButtonProps = ButtonElementProps | AnchorElementProps;
@@ -0,0 +1 @@
1
+ export { default } from './Button';