@transferwise/components 0.0.0-experimental-4f5d175 → 0.0.0-experimental-de92c64
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/button/Button.js +3 -4
- package/build/button/Button.js.map +1 -1
- package/build/button/Button.mjs +3 -4
- package/build/button/Button.mjs.map +1 -1
- package/build/iconButton/IconButton.js +2 -2
- package/build/iconButton/IconButton.mjs +2 -2
- package/build/link/Link.js +2 -2
- package/build/link/Link.mjs +2 -2
- package/build/main.css +6 -23
- package/build/primitives/PrimitiveAnchor/{src/PrimitiveAnchor.js → PrimitiveAnchor.js} +1 -1
- package/build/primitives/PrimitiveAnchor/PrimitiveAnchor.js.map +1 -0
- package/build/primitives/PrimitiveAnchor/{src/PrimitiveAnchor.mjs → PrimitiveAnchor.mjs} +1 -1
- package/build/primitives/PrimitiveAnchor/PrimitiveAnchor.mjs.map +1 -0
- package/build/primitives/PrimitiveButton/{src/PrimitiveButton.js → PrimitiveButton.js} +2 -3
- package/build/primitives/PrimitiveButton/PrimitiveButton.js.map +1 -0
- package/build/primitives/PrimitiveButton/{src/PrimitiveButton.mjs → PrimitiveButton.mjs} +2 -3
- package/build/primitives/PrimitiveButton/PrimitiveButton.mjs.map +1 -0
- package/build/styles/button/Button.css +6 -23
- package/build/styles/button/Button.vars.css +3 -10
- package/build/styles/main.css +6 -23
- package/build/types/button/Button.d.ts.map +1 -1
- package/build/types/primitives/PrimitiveAnchor/PrimitiveAnchor.d.ts.map +1 -0
- package/build/types/primitives/PrimitiveAnchor/PrimitiveAnchor.types.d.ts +25 -0
- package/build/types/primitives/PrimitiveAnchor/PrimitiveAnchor.types.d.ts.map +1 -0
- package/build/types/primitives/PrimitiveAnchor/index.d.ts +2 -2
- package/build/types/primitives/PrimitiveAnchor/index.d.ts.map +1 -1
- package/build/types/primitives/PrimitiveButton/{src/PrimitiveButton.d.ts → PrimitiveButton.d.ts} +1 -1
- package/build/types/primitives/PrimitiveButton/PrimitiveButton.d.ts.map +1 -0
- package/build/types/primitives/PrimitiveButton/{src/PrimitiveButton.types.d.ts → PrimitiveButton.types.d.ts} +1 -1
- package/build/types/primitives/PrimitiveButton/PrimitiveButton.types.d.ts.map +1 -0
- package/build/types/primitives/PrimitiveButton/index.d.ts +2 -2
- package/build/types/primitives/PrimitiveButton/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/button/Button.css +6 -23
- package/src/button/Button.less +16 -25
- package/src/button/Button.spec.tsx +0 -103
- package/src/button/Button.story.tsx +16 -8
- package/src/button/Button.tsx +1 -2
- package/src/button/Button.vars.css +3 -10
- package/src/button/Button.vars.less +6 -16
- package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +1 -0
- package/src/main.css +6 -23
- package/src/primitives/PrimitiveAnchor/{src/PrimitiveAnchor.tsx → PrimitiveAnchor.tsx} +1 -1
- package/src/primitives/PrimitiveAnchor/PrimitiveAnchor.types.ts +33 -0
- package/src/primitives/PrimitiveAnchor/index.ts +6 -2
- package/src/primitives/PrimitiveAnchor/stories/PrimitiveAnchor.tests.story.tsx +1 -1
- package/src/primitives/PrimitiveAnchor/test/PrimitiveAnchor.spec.tsx +1 -1
- package/src/primitives/PrimitiveButton/{src/PrimitiveButton.tsx → PrimitiveButton.tsx} +6 -5
- package/src/primitives/PrimitiveButton/{src/PrimitiveButton.types.ts → PrimitiveButton.types.ts} +1 -1
- package/src/primitives/PrimitiveButton/index.ts +6 -2
- package/src/primitives/PrimitiveButton/stories/PrimitiveButton.tests.story.tsx +1 -1
- package/src/primitives/PrimitiveButton/test/PrimitiveButton.spec.tsx +9 -15
- package/build/primitives/PrimitiveAnchor/src/PrimitiveAnchor.js.map +0 -1
- package/build/primitives/PrimitiveAnchor/src/PrimitiveAnchor.mjs.map +0 -1
- package/build/primitives/PrimitiveButton/src/PrimitiveButton.js.map +0 -1
- package/build/primitives/PrimitiveButton/src/PrimitiveButton.mjs.map +0 -1
- package/build/types/primitives/PrimitiveAnchor/src/PrimitiveAnchor.d.ts.map +0 -1
- package/build/types/primitives/PrimitiveAnchor/src/index.d.ts +0 -3
- package/build/types/primitives/PrimitiveAnchor/src/index.d.ts.map +0 -1
- package/build/types/primitives/PrimitiveButton/src/PrimitiveButton.d.ts.map +0 -1
- package/build/types/primitives/PrimitiveButton/src/PrimitiveButton.types.d.ts.map +0 -1
- package/build/types/primitives/PrimitiveButton/src/index.d.ts +0 -3
- package/build/types/primitives/PrimitiveButton/src/index.d.ts.map +0 -1
- package/src/primitives/PrimitiveAnchor/src/index.ts +0 -6
- package/src/primitives/PrimitiveButton/src/index.ts +0 -6
- /package/build/types/primitives/PrimitiveAnchor/{src/PrimitiveAnchor.d.ts → PrimitiveAnchor.d.ts} +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { default } from './
|
|
2
|
-
export
|
|
1
|
+
export { default } from './PrimitiveButton';
|
|
2
|
+
export type { PrimitiveButtonProps, PrimitiveButtonAttributes, PrimitiveButtonElementRef, } from './PrimitiveButton.types';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/primitives/PrimitiveButton/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/primitives/PrimitiveButton/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,YAAY,EACV,oBAAoB,EACpB,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,yBAAyB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@transferwise/components",
|
|
3
|
-
"version": "0.0.0-experimental-
|
|
3
|
+
"version": "0.0.0-experimental-de92c64",
|
|
4
4
|
"description": "Neptune React components",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -92,12 +92,12 @@
|
|
|
92
92
|
"rollup-preserve-directives": "^1.1.1",
|
|
93
93
|
"storybook": "^8.2.2",
|
|
94
94
|
"@transferwise/less-config": "3.1.0",
|
|
95
|
-
"@transferwise/neptune-css": "0.0.0-experimental-
|
|
95
|
+
"@transferwise/neptune-css": "0.0.0-experimental-de92c64",
|
|
96
96
|
"@wise/components-theming": "1.6.1"
|
|
97
97
|
},
|
|
98
98
|
"peerDependencies": {
|
|
99
99
|
"@transferwise/icons": "^3.13.1",
|
|
100
|
-
"@transferwise/neptune-css": "0.0.0-experimental-
|
|
100
|
+
"@transferwise/neptune-css": "0.0.0-experimental-de92c64",
|
|
101
101
|
"@wise/art": "^2.16",
|
|
102
102
|
"@wise/components-theming": "^1.0.0",
|
|
103
103
|
"react": ">=18",
|
package/src/button/Button.css
CHANGED
|
@@ -26,23 +26,16 @@
|
|
|
26
26
|
--Button-primary-negative-background: var(--color-sentiment-negative-primary);
|
|
27
27
|
--Button-primary-negative-background-hover: var(--color-sentiment-negative-primary-hover);
|
|
28
28
|
--Button-primary-negative-background-active: var(--color-sentiment-negative-primary-active);
|
|
29
|
-
--Button-primary-negative-color: var(--color-contrast
|
|
29
|
+
--Button-primary-negative-color: var(--color-contrast);
|
|
30
30
|
--Button-secondary-negative-background: var(--color-sentiment-negative-secondary);
|
|
31
31
|
--Button-secondary-negative-background-hover: var(--color-sentiment-negative-secondary-hover);
|
|
32
32
|
--Button-secondary-negative-background-active: var(--color-sentiment-negative-secondary-active);
|
|
33
33
|
--Button-secondary-negative-color: var(--color-sentiment-negative-primary);
|
|
34
34
|
}
|
|
35
35
|
.np-theme-personal--bright-green .wds-Button {
|
|
36
|
-
--
|
|
36
|
+
--color-contrast: #FFFFFF;
|
|
37
37
|
--Button-secondary-color: var(--color-interactive-control);
|
|
38
|
-
--Button-secondary-negative-color: var(--color-
|
|
39
|
-
}
|
|
40
|
-
.np-theme-personal--forest-green .wds-Button {
|
|
41
|
-
--Button-secondary-background: var(--color-interactive-neutral);
|
|
42
|
-
--Button-secondary-negative-background: var(--color-sentiment-negative-primary);
|
|
43
|
-
--Button-secondary-negative-background-hover: var(--color-sentiment-negative-primary-hover);
|
|
44
|
-
--Button-secondary-negative-background-active: var(--color-sentiment-negative-primary-active);
|
|
45
|
-
--Button-secondary-negative-color: var(--color-contrast-overlay);
|
|
38
|
+
--Button-secondary-negative-color: var(--color-contrast);
|
|
46
39
|
}
|
|
47
40
|
/* Button Styles */
|
|
48
41
|
.wds-Button {
|
|
@@ -75,13 +68,10 @@
|
|
|
75
68
|
}
|
|
76
69
|
.wds-Button.wds-Button--disabled,
|
|
77
70
|
.wds-Button:disabled {
|
|
78
|
-
filter: none;
|
|
79
71
|
mix-blend-mode: luminosity;
|
|
80
72
|
opacity: 0.45;
|
|
81
73
|
cursor: not-allowed;
|
|
82
74
|
}
|
|
83
|
-
.wds-Button.wds-Button--disabled,
|
|
84
|
-
.wds-Button:disabled,
|
|
85
75
|
.wds-Button.wds-Button--disabled:hover,
|
|
86
76
|
.wds-Button:disabled:hover,
|
|
87
77
|
.wds-Button.wds-Button--disabled:active,
|
|
@@ -183,22 +173,12 @@
|
|
|
183
173
|
}
|
|
184
174
|
.wds-Button-loader {
|
|
185
175
|
position: absolute;
|
|
186
|
-
display: flex;
|
|
187
|
-
justify-content: center;
|
|
188
|
-
align-items: center;
|
|
189
176
|
width: 100%;
|
|
190
177
|
height: 100%;
|
|
191
178
|
}
|
|
192
179
|
.wds-Button-loader .process-circle {
|
|
193
180
|
stroke: var(--Button-color);
|
|
194
181
|
}
|
|
195
|
-
/* RTL Styles */
|
|
196
|
-
[dir="rtl"] .wds-Button .tw-icon-chevron-right,[dir="rtl"] .wds-Button .tw-icon-arrow-right {
|
|
197
|
-
transform: rotate(180deg);
|
|
198
|
-
}
|
|
199
|
-
[dir="rtl"] .wds-Button .tw-icon-chevron-left,[dir="rtl"] .wds-Button .tw-icon-arrow-left {
|
|
200
|
-
transform: rotate(180deg);
|
|
201
|
-
}
|
|
202
182
|
/* Avatar border transparency */
|
|
203
183
|
/* dark buttons get 20% transparency, light buttons get 12% */
|
|
204
184
|
.wds-Button-avatars .np-circle {
|
|
@@ -220,3 +200,6 @@
|
|
|
220
200
|
.np-theme-personal--bright-green .wds-Button--minimal .wds-Button-avatars .np-circle {
|
|
221
201
|
--circle-border-color: color-mix(in srgb, var(--Button-color) 12%, transparent);
|
|
222
202
|
}
|
|
203
|
+
[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 {
|
|
204
|
+
scale: -1 1;
|
|
205
|
+
}
|
package/src/button/Button.less
CHANGED
|
@@ -30,16 +30,10 @@
|
|
|
30
30
|
|
|
31
31
|
&.wds-Button--disabled,
|
|
32
32
|
&:disabled {
|
|
33
|
-
// The declarations below are necessary as design specs for
|
|
34
|
-
// the button's disabled state have changed. This is to be
|
|
35
|
-
// further investigated at a later stage.
|
|
36
|
-
// @see https://transferwise.atlassian.net/browse/DS-7386
|
|
37
|
-
filter: none;
|
|
38
33
|
mix-blend-mode: luminosity;
|
|
39
34
|
opacity: 0.45;
|
|
40
35
|
cursor: not-allowed;
|
|
41
36
|
|
|
42
|
-
&,
|
|
43
37
|
&:hover,
|
|
44
38
|
&:active {
|
|
45
39
|
background-color: var(--Button-background);
|
|
@@ -128,7 +122,7 @@
|
|
|
128
122
|
|
|
129
123
|
|
|
130
124
|
|
|
131
|
-
// Width
|
|
125
|
+
// Width mofidiers
|
|
132
126
|
&--block {
|
|
133
127
|
width: 100%;
|
|
134
128
|
}
|
|
@@ -169,9 +163,6 @@
|
|
|
169
163
|
|
|
170
164
|
&-loader {
|
|
171
165
|
position: absolute;
|
|
172
|
-
display: flex;
|
|
173
|
-
justify-content: center;
|
|
174
|
-
align-items: center;
|
|
175
166
|
width: 100%;
|
|
176
167
|
height: 100%;
|
|
177
168
|
|
|
@@ -181,21 +172,6 @@
|
|
|
181
172
|
}
|
|
182
173
|
}
|
|
183
174
|
|
|
184
|
-
/* RTL Styles */
|
|
185
|
-
:dir(rtl) {
|
|
186
|
-
.wds-Button {
|
|
187
|
-
.tw-icon-chevron-right,
|
|
188
|
-
.tw-icon-arrow-right {
|
|
189
|
-
transform: rotate(180deg);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
.tw-icon-chevron-left,
|
|
193
|
-
.tw-icon-arrow-left {
|
|
194
|
-
transform: rotate(180deg);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
175
|
/* Avatar border transparency */
|
|
200
176
|
/* dark buttons get 20% transparency, light buttons get 12% */
|
|
201
177
|
.wds-Button-avatars {
|
|
@@ -225,3 +201,18 @@
|
|
|
225
201
|
}
|
|
226
202
|
}
|
|
227
203
|
}
|
|
204
|
+
|
|
205
|
+
:dir(rtl) {
|
|
206
|
+
.wds-Button {
|
|
207
|
+
.tw-icon-chevron-right,
|
|
208
|
+
.tw-icon-arrow-right,
|
|
209
|
+
.tw-icon-chevron-left,
|
|
210
|
+
.tw-icon-arrow-left,
|
|
211
|
+
.tw-icon-arrow-diagonal-down,
|
|
212
|
+
.tw-icon-arrow-diagonal-up,
|
|
213
|
+
.tw-icon-list,
|
|
214
|
+
.tw-icon-activity {
|
|
215
|
+
scale: -1 1;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
@@ -71,109 +71,6 @@ describe('Button', () => {
|
|
|
71
71
|
);
|
|
72
72
|
expect(screen.getByRole('link', { name })).toHaveAttribute('href', href);
|
|
73
73
|
});
|
|
74
|
-
|
|
75
|
-
describe('disabled mode', () => {
|
|
76
|
-
describe('button', () => {
|
|
77
|
-
it('should not be disabled by default', () => {
|
|
78
|
-
render(<Button v2>{name}</Button>);
|
|
79
|
-
const button = screen.getByRole('button');
|
|
80
|
-
expect(button).toBeEnabled();
|
|
81
|
-
expect(button).not.toHaveAttribute('aria-disabled');
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
it('should respect disabled mode and set it only via the `disabled` attribute', () => {
|
|
85
|
-
render(
|
|
86
|
-
<Button v2 disabled>
|
|
87
|
-
{name}
|
|
88
|
-
</Button>,
|
|
89
|
-
);
|
|
90
|
-
const button = screen.getByRole('button');
|
|
91
|
-
expect(button).toBeDisabled();
|
|
92
|
-
expect(button).not.toHaveAttribute('aria-disabled');
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
describe('anchor', () => {
|
|
97
|
-
it('should not be disabled by default', () => {
|
|
98
|
-
render(
|
|
99
|
-
<Button v2 href="wise.com">
|
|
100
|
-
{name}
|
|
101
|
-
</Button>,
|
|
102
|
-
);
|
|
103
|
-
const button = screen.getByRole('link');
|
|
104
|
-
expect(button).toBeEnabled();
|
|
105
|
-
expect(button).not.toHaveAttribute('aria-disabled');
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
it('should respect disabled mode', () => {
|
|
109
|
-
render(
|
|
110
|
-
<Button v2 href="wise.com" disabled>
|
|
111
|
-
{name}
|
|
112
|
-
</Button>,
|
|
113
|
-
);
|
|
114
|
-
const button = screen.getByRole('link');
|
|
115
|
-
expect(button).toHaveAttribute('aria-disabled');
|
|
116
|
-
expect(button).toBeEnabled();
|
|
117
|
-
expect(button).not.toHaveAttribute('href');
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
describe('loading mode', () => {
|
|
123
|
-
describe('button', () => {
|
|
124
|
-
it('should not be loading by default', () => {
|
|
125
|
-
render(<Button v2>{name}</Button>);
|
|
126
|
-
const button = screen.getByRole('button');
|
|
127
|
-
expect(button).toBeEnabled();
|
|
128
|
-
expect(button).not.toHaveAttribute('aria-busy');
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
it('should respect loading mode', () => {
|
|
132
|
-
render(
|
|
133
|
-
<Button v2 loading>
|
|
134
|
-
{name}
|
|
135
|
-
</Button>,
|
|
136
|
-
);
|
|
137
|
-
const button = screen.getByRole('button');
|
|
138
|
-
expect(button).toHaveAttribute('aria-busy');
|
|
139
|
-
// the `disabled` attribute is not set to keep the button
|
|
140
|
-
// focusable but aria attribute is defined to make it
|
|
141
|
-
// announced properly by the assistive tech
|
|
142
|
-
expect(button).toBeEnabled();
|
|
143
|
-
expect(button).toHaveAttribute('aria-disabled');
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
describe('anchor', () => {
|
|
148
|
-
it('should not be loading by default', () => {
|
|
149
|
-
render(
|
|
150
|
-
<Button v2 href="wise.com">
|
|
151
|
-
{name}
|
|
152
|
-
</Button>,
|
|
153
|
-
);
|
|
154
|
-
const button = screen.getByRole('link');
|
|
155
|
-
expect(button).toBeEnabled();
|
|
156
|
-
expect(button).not.toHaveAttribute('aria-busy');
|
|
157
|
-
expect(button).not.toHaveAttribute('aria-disabled');
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
it('should respect loading mode', () => {
|
|
161
|
-
render(
|
|
162
|
-
<Button v2 loading href="wise.com">
|
|
163
|
-
{name}
|
|
164
|
-
</Button>,
|
|
165
|
-
);
|
|
166
|
-
const button = screen.getByRole('link');
|
|
167
|
-
expect(button).toHaveAttribute('aria-busy');
|
|
168
|
-
// the `disabled` attribute is not set to keep the button
|
|
169
|
-
// focusable but aria attribute is defined to make it
|
|
170
|
-
// announced properly by the assistive tech
|
|
171
|
-
expect(button).toBeEnabled();
|
|
172
|
-
expect(button).toHaveAttribute('aria-disabled');
|
|
173
|
-
expect(button).not.toHaveAttribute('href');
|
|
174
|
-
});
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
74
|
});
|
|
178
75
|
});
|
|
179
76
|
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react';
|
|
2
2
|
import { fn } from '@storybook/test';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
Freeze,
|
|
5
|
+
ArrowRight,
|
|
6
|
+
ArrowLeft,
|
|
7
|
+
ArrowDiagonalDown,
|
|
8
|
+
ArrowDiagonalUp,
|
|
9
|
+
ChevronRight,
|
|
10
|
+
ChevronLeft,
|
|
11
|
+
} from '@transferwise/icons';
|
|
4
12
|
import { Flag } from '@wise/art';
|
|
5
13
|
import Button from './Button.resolver';
|
|
6
14
|
import type { ButtonProps, ButtonPriority } from './Button.types';
|
|
@@ -668,8 +676,8 @@ export const AllVariants = storyConfig(
|
|
|
668
676
|
sentiment="negative"
|
|
669
677
|
priority={priority as ButtonPriority}
|
|
670
678
|
size={size}
|
|
671
|
-
iconStart={
|
|
672
|
-
iconEnd={
|
|
679
|
+
iconStart={ChevronLeft}
|
|
680
|
+
iconEnd={ChevronRight}
|
|
673
681
|
avatars={[{ asset: <Freeze /> }]}
|
|
674
682
|
block
|
|
675
683
|
href="https://wise.com"
|
|
@@ -683,8 +691,8 @@ export const AllVariants = storyConfig(
|
|
|
683
691
|
sentiment="negative"
|
|
684
692
|
priority={priority as ButtonPriority}
|
|
685
693
|
size={size}
|
|
686
|
-
iconStart={
|
|
687
|
-
iconEnd={
|
|
694
|
+
iconStart={ChevronLeft}
|
|
695
|
+
iconEnd={ChevronRight}
|
|
688
696
|
avatars={[{ asset: <Freeze /> }]}
|
|
689
697
|
block
|
|
690
698
|
disabled
|
|
@@ -696,8 +704,8 @@ export const AllVariants = storyConfig(
|
|
|
696
704
|
sentiment="negative"
|
|
697
705
|
priority={priority as ButtonPriority}
|
|
698
706
|
size={size}
|
|
699
|
-
iconStart={
|
|
700
|
-
iconEnd={
|
|
707
|
+
iconStart={ChevronLeft}
|
|
708
|
+
iconEnd={ChevronRight}
|
|
701
709
|
avatars={[{ asset: <Freeze /> }]}
|
|
702
710
|
block
|
|
703
711
|
loading
|
|
@@ -710,5 +718,5 @@ export const AllVariants = storyConfig(
|
|
|
710
718
|
</div>
|
|
711
719
|
),
|
|
712
720
|
},
|
|
713
|
-
{ variants: ['default', 'dark', 'bright-green', 'forest-green'] },
|
|
721
|
+
{ variants: ['default', 'dark', 'bright-green', 'forest-green', 'rtl'] },
|
|
714
722
|
);
|
package/src/button/Button.tsx
CHANGED
|
@@ -94,8 +94,7 @@ const Button = forwardRef<ButtonReferenceType, NewButtonProps>(
|
|
|
94
94
|
{...(props as any)}
|
|
95
95
|
href={href}
|
|
96
96
|
className={classNames}
|
|
97
|
-
disabled={disabled
|
|
98
|
-
aria-busy={loading || undefined}
|
|
97
|
+
disabled={disabled}
|
|
99
98
|
>
|
|
100
99
|
{content}
|
|
101
100
|
</PrimitiveAnchor>
|
|
@@ -26,21 +26,14 @@
|
|
|
26
26
|
--Button-primary-negative-background: var(--color-sentiment-negative-primary);
|
|
27
27
|
--Button-primary-negative-background-hover: var(--color-sentiment-negative-primary-hover);
|
|
28
28
|
--Button-primary-negative-background-active: var(--color-sentiment-negative-primary-active);
|
|
29
|
-
--Button-primary-negative-color: var(--color-contrast
|
|
29
|
+
--Button-primary-negative-color: var(--color-contrast);
|
|
30
30
|
--Button-secondary-negative-background: var(--color-sentiment-negative-secondary);
|
|
31
31
|
--Button-secondary-negative-background-hover: var(--color-sentiment-negative-secondary-hover);
|
|
32
32
|
--Button-secondary-negative-background-active: var(--color-sentiment-negative-secondary-active);
|
|
33
33
|
--Button-secondary-negative-color: var(--color-sentiment-negative-primary);
|
|
34
34
|
}
|
|
35
35
|
.np-theme-personal--bright-green .wds-Button {
|
|
36
|
-
--
|
|
36
|
+
--color-contrast: #FFFFFF;
|
|
37
37
|
--Button-secondary-color: var(--color-interactive-control);
|
|
38
|
-
--Button-secondary-negative-color: var(--color-
|
|
39
|
-
}
|
|
40
|
-
.np-theme-personal--forest-green .wds-Button {
|
|
41
|
-
--Button-secondary-background: var(--color-interactive-neutral);
|
|
42
|
-
--Button-secondary-negative-background: var(--color-sentiment-negative-primary);
|
|
43
|
-
--Button-secondary-negative-background-hover: var(--color-sentiment-negative-primary-hover);
|
|
44
|
-
--Button-secondary-negative-background-active: var(--color-sentiment-negative-primary-active);
|
|
45
|
-
--Button-secondary-negative-color: var(--color-contrast-overlay);
|
|
38
|
+
--Button-secondary-negative-color: var(--color-contrast);
|
|
46
39
|
}
|
|
@@ -33,28 +33,18 @@
|
|
|
33
33
|
--Button-primary-negative-background: var(--color-sentiment-negative-primary);
|
|
34
34
|
--Button-primary-negative-background-hover: var(--color-sentiment-negative-primary-hover);
|
|
35
35
|
--Button-primary-negative-background-active: var(--color-sentiment-negative-primary-active);
|
|
36
|
-
--Button-primary-negative-color: var(--color-contrast
|
|
36
|
+
--Button-primary-negative-color: var(--color-contrast);
|
|
37
37
|
|
|
38
38
|
--Button-secondary-negative-background: var(--color-sentiment-negative-secondary);
|
|
39
39
|
--Button-secondary-negative-background-hover: var(--color-sentiment-negative-secondary-hover);
|
|
40
40
|
--Button-secondary-negative-background-active: var(--color-sentiment-negative-secondary-active);
|
|
41
41
|
--Button-secondary-negative-color: var(--color-sentiment-negative-primary);
|
|
42
|
+
}
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
.
|
|
45
|
-
--
|
|
44
|
+
.np-theme-personal--bright-green {
|
|
45
|
+
.wds-Button {
|
|
46
|
+
--color-contrast: #FFFFFF;
|
|
46
47
|
--Button-secondary-color: var(--color-interactive-control);
|
|
47
|
-
--Button-secondary-negative-color: var(--color-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
.np-theme-personal--forest-green & {
|
|
52
|
-
--Button-secondary-background: var(--color-interactive-neutral);
|
|
53
|
-
--Button-secondary-negative-background: var(--color-sentiment-negative-primary);
|
|
54
|
-
--Button-secondary-negative-background-hover: var(--color-sentiment-negative-primary-hover);
|
|
55
|
-
--Button-secondary-negative-background-active: var(--color-sentiment-negative-primary-active);
|
|
56
|
-
--Button-secondary-negative-color: var(--color-contrast-overlay);
|
|
48
|
+
--Button-secondary-negative-color: var(--color-contrast);
|
|
57
49
|
}
|
|
58
50
|
}
|
|
59
|
-
|
|
60
|
-
|
|
@@ -9,6 +9,7 @@ exports[`FlowNavigation on mobile renders as expected 1`] = `
|
|
|
9
9
|
class="np-flow-header d-flex flex-wrap align-items-center justify-content-between flex__item--12 np-flow-navigation__content p-x-3 np-flow-navigation--xs-max"
|
|
10
10
|
>
|
|
11
11
|
<button
|
|
12
|
+
aria-disabled="false"
|
|
12
13
|
aria-label="back to previous step"
|
|
13
14
|
aria-live="off"
|
|
14
15
|
class="np-circle d-flex align-items-center justify-content-center np-icon-button np-icon-button-tertiary-default"
|
package/src/main.css
CHANGED
|
@@ -744,23 +744,16 @@ div.critical-comms .critical-comms-body {
|
|
|
744
744
|
--Button-primary-negative-background: var(--color-sentiment-negative-primary);
|
|
745
745
|
--Button-primary-negative-background-hover: var(--color-sentiment-negative-primary-hover);
|
|
746
746
|
--Button-primary-negative-background-active: var(--color-sentiment-negative-primary-active);
|
|
747
|
-
--Button-primary-negative-color: var(--color-contrast
|
|
747
|
+
--Button-primary-negative-color: var(--color-contrast);
|
|
748
748
|
--Button-secondary-negative-background: var(--color-sentiment-negative-secondary);
|
|
749
749
|
--Button-secondary-negative-background-hover: var(--color-sentiment-negative-secondary-hover);
|
|
750
750
|
--Button-secondary-negative-background-active: var(--color-sentiment-negative-secondary-active);
|
|
751
751
|
--Button-secondary-negative-color: var(--color-sentiment-negative-primary);
|
|
752
752
|
}
|
|
753
753
|
.np-theme-personal--bright-green .wds-Button {
|
|
754
|
-
--
|
|
754
|
+
--color-contrast: #FFFFFF;
|
|
755
755
|
--Button-secondary-color: var(--color-interactive-control);
|
|
756
|
-
--Button-secondary-negative-color: var(--color-
|
|
757
|
-
}
|
|
758
|
-
.np-theme-personal--forest-green .wds-Button {
|
|
759
|
-
--Button-secondary-background: var(--color-interactive-neutral);
|
|
760
|
-
--Button-secondary-negative-background: var(--color-sentiment-negative-primary);
|
|
761
|
-
--Button-secondary-negative-background-hover: var(--color-sentiment-negative-primary-hover);
|
|
762
|
-
--Button-secondary-negative-background-active: var(--color-sentiment-negative-primary-active);
|
|
763
|
-
--Button-secondary-negative-color: var(--color-contrast-overlay);
|
|
756
|
+
--Button-secondary-negative-color: var(--color-contrast);
|
|
764
757
|
}
|
|
765
758
|
/* Button Styles */
|
|
766
759
|
.wds-Button {
|
|
@@ -793,13 +786,10 @@ div.critical-comms .critical-comms-body {
|
|
|
793
786
|
}
|
|
794
787
|
.wds-Button.wds-Button--disabled,
|
|
795
788
|
.wds-Button:disabled {
|
|
796
|
-
filter: none;
|
|
797
789
|
mix-blend-mode: luminosity;
|
|
798
790
|
opacity: 0.45;
|
|
799
791
|
cursor: not-allowed;
|
|
800
792
|
}
|
|
801
|
-
.wds-Button.wds-Button--disabled,
|
|
802
|
-
.wds-Button:disabled,
|
|
803
793
|
.wds-Button.wds-Button--disabled:hover,
|
|
804
794
|
.wds-Button:disabled:hover,
|
|
805
795
|
.wds-Button.wds-Button--disabled:active,
|
|
@@ -901,22 +891,12 @@ div.critical-comms .critical-comms-body {
|
|
|
901
891
|
}
|
|
902
892
|
.wds-Button-loader {
|
|
903
893
|
position: absolute;
|
|
904
|
-
display: flex;
|
|
905
|
-
justify-content: center;
|
|
906
|
-
align-items: center;
|
|
907
894
|
width: 100%;
|
|
908
895
|
height: 100%;
|
|
909
896
|
}
|
|
910
897
|
.wds-Button-loader .process-circle {
|
|
911
898
|
stroke: var(--Button-color);
|
|
912
899
|
}
|
|
913
|
-
/* RTL Styles */
|
|
914
|
-
[dir="rtl"] .wds-Button .tw-icon-chevron-right,[dir="rtl"] .wds-Button .tw-icon-arrow-right {
|
|
915
|
-
transform: rotate(180deg);
|
|
916
|
-
}
|
|
917
|
-
[dir="rtl"] .wds-Button .tw-icon-chevron-left,[dir="rtl"] .wds-Button .tw-icon-arrow-left {
|
|
918
|
-
transform: rotate(180deg);
|
|
919
|
-
}
|
|
920
900
|
/* Avatar border transparency */
|
|
921
901
|
/* dark buttons get 20% transparency, light buttons get 12% */
|
|
922
902
|
.wds-Button-avatars .np-circle {
|
|
@@ -938,6 +918,9 @@ div.critical-comms .critical-comms-body {
|
|
|
938
918
|
.np-theme-personal--bright-green .wds-Button--minimal .wds-Button-avatars .np-circle {
|
|
939
919
|
--circle-border-color: color-mix(in srgb, var(--Button-color) 12%, transparent);
|
|
940
920
|
}
|
|
921
|
+
[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 {
|
|
922
|
+
scale: -1 1;
|
|
923
|
+
}
|
|
941
924
|
.np-card {
|
|
942
925
|
overflow: hidden;
|
|
943
926
|
transition-property: transform, box-shadow;
|
|
@@ -90,7 +90,7 @@ const PrimitiveAnchor = forwardRef<HTMLAnchorElement, PrimitiveAnchorProps>(
|
|
|
90
90
|
* https://www.scottohara.me/blog/2021/05/28/disabled-links.html
|
|
91
91
|
*/
|
|
92
92
|
const anchorProps = {
|
|
93
|
-
'aria-disabled': disabled
|
|
93
|
+
'aria-disabled': disabled,
|
|
94
94
|
className: anchorClasses,
|
|
95
95
|
'data-testid': testId,
|
|
96
96
|
href: disabled ? undefined : href,
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { BasePrimitiveProps, StyleProp } from '..';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Type aliases for an anchor component.
|
|
6
|
+
*/
|
|
7
|
+
export type PrimitiveAnchorAttributes = React.AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
8
|
+
export type PrimitiveAnchorElementRef = React.Ref<HTMLAnchorElement>;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Properties for the anchor component.
|
|
12
|
+
*/
|
|
13
|
+
export interface PrimitiveAnchorProps
|
|
14
|
+
extends BasePrimitiveProps,
|
|
15
|
+
StyleProp,
|
|
16
|
+
Omit<PrimitiveAnchorAttributes, 'role'> {
|
|
17
|
+
/** Content of the anchor */
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
|
|
20
|
+
/** The URL to navigate to when the anchor is clicked */
|
|
21
|
+
href?: string | undefined;
|
|
22
|
+
|
|
23
|
+
/** Disable the anchor */
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
|
|
26
|
+
/** Reference to the anchor element */
|
|
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
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { userEvent, within, expect, waitFor } from '@storybook/test';
|
|
3
3
|
import { Meta, StoryObj } from '@storybook/react';
|
|
4
|
-
import PrimitiveAnchor from '
|
|
4
|
+
import PrimitiveAnchor from '..';
|
|
5
5
|
|
|
6
6
|
const meta = {
|
|
7
7
|
title: 'Primitives/Anchor/Tests',
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import React, { forwardRef, useCallback } from 'react';
|
|
3
3
|
import { clsx } from 'clsx';
|
|
4
4
|
import { useIntl, MessageDescriptor } from 'react-intl';
|
|
5
|
-
import messages from '
|
|
6
|
-
import type { PrimitiveButtonProps } from '
|
|
5
|
+
import messages from '../../i18n/commonMessages/Button.messages';
|
|
6
|
+
import type { PrimitiveButtonProps } from '.';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* The Primitive `PrimitiveButton` component can be used in various parts the Wise Design
|
|
@@ -95,9 +95,10 @@ const PrimitiveButton = forwardRef<HTMLButtonElement, PrimitiveButtonProps>(
|
|
|
95
95
|
* by assistive technologies, set to 'polite' during loading.
|
|
96
96
|
*/
|
|
97
97
|
const buttonProps = {
|
|
98
|
-
'aria-disabled':
|
|
99
|
-
'aria-
|
|
100
|
-
|
|
98
|
+
'aria-disabled': disabled || loading,
|
|
99
|
+
'aria-label': loading
|
|
100
|
+
? intl.formatMessage(messages.loadingAriaLabel as MessageDescriptor)
|
|
101
|
+
: props['aria-label'],
|
|
101
102
|
'aria-live': (loading ? 'polite' : 'off') as 'polite' | 'off' | 'assertive' | undefined,
|
|
102
103
|
className: classNames,
|
|
103
104
|
'data-testid': testId,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { userEvent, within, expect, waitFor } from '@storybook/test';
|
|
3
3
|
import { Meta, StoryObj } from '@storybook/react';
|
|
4
|
-
import PrimitiveButton from '
|
|
4
|
+
import PrimitiveButton from '..';
|
|
5
5
|
|
|
6
6
|
const meta = {
|
|
7
7
|
title: 'Primitives/Button/Tests',
|