@transferwise/components 46.116.0 → 46.117.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.
Files changed (71) hide show
  1. package/build/alert/Alert.js +2 -1
  2. package/build/alert/Alert.js.map +1 -1
  3. package/build/alert/Alert.mjs +2 -1
  4. package/build/alert/Alert.mjs.map +1 -1
  5. package/build/main.css +60 -139
  6. package/build/prompt/InlinePrompt/InlinePrompt.js +14 -8
  7. package/build/prompt/InlinePrompt/InlinePrompt.js.map +1 -1
  8. package/build/prompt/InlinePrompt/InlinePrompt.mjs +15 -9
  9. package/build/prompt/InlinePrompt/InlinePrompt.mjs.map +1 -1
  10. package/build/sentimentSurface/SentimentSurface.js +6 -5
  11. package/build/sentimentSurface/SentimentSurface.js.map +1 -1
  12. package/build/sentimentSurface/SentimentSurface.mjs +6 -5
  13. package/build/sentimentSurface/SentimentSurface.mjs.map +1 -1
  14. package/build/styles/button/Button.css +17 -17
  15. package/build/styles/button/Button.vars.css +16 -16
  16. package/build/styles/iconButton/IconButton.css +8 -8
  17. package/build/styles/inputs/Input.css +2 -4
  18. package/build/styles/inputs/TextArea.css +2 -4
  19. package/build/styles/link/Link.css +1 -0
  20. package/build/styles/main.css +60 -139
  21. package/build/styles/popover/Popover.css +2 -4
  22. package/build/styles/prompt/InlinePrompt/InlinePrompt.css +26 -105
  23. package/build/styles/sentimentSurface/SentimentSurface.css +4 -1
  24. package/build/types/alert/Alert.d.ts.map +1 -1
  25. package/build/types/prompt/InlinePrompt/InlinePrompt.d.ts +19 -3
  26. package/build/types/prompt/InlinePrompt/InlinePrompt.d.ts.map +1 -1
  27. package/build/types/sentimentSurface/SentimentSurface.d.ts +5 -4
  28. package/build/types/sentimentSurface/SentimentSurface.d.ts.map +1 -1
  29. package/build/types/sentimentSurface/SentimentSurface.types.d.ts +4 -16
  30. package/build/types/sentimentSurface/SentimentSurface.types.d.ts.map +1 -1
  31. package/build/types/test-utils/story-config.d.ts +24 -0
  32. package/build/types/test-utils/story-config.d.ts.map +1 -1
  33. package/package.json +13 -12
  34. package/src/alert/Alert.tsx +3 -1
  35. package/src/button/Button.css +17 -17
  36. package/src/button/Button.less +1 -1
  37. package/src/button/Button.story.tsx +75 -110
  38. package/src/button/Button.tests.story.tsx +189 -0
  39. package/src/button/Button.vars.css +16 -16
  40. package/src/button/Button.vars.less +58 -18
  41. package/src/iconButton/IconButton.css +8 -8
  42. package/src/iconButton/IconButton.less +35 -4
  43. package/src/iconButton/IconButton.story.tsx +72 -3
  44. package/src/inputs/Input.css +2 -4
  45. package/src/inputs/TextArea.css +2 -4
  46. package/src/link/Link.css +1 -0
  47. package/src/link/Link.less +1 -0
  48. package/src/link/Link.story.tsx +28 -0
  49. package/src/main.css +60 -139
  50. package/src/popover/Popover.css +2 -4
  51. package/src/prompt/InlinePrompt/InlinePrompt.css +26 -105
  52. package/src/prompt/InlinePrompt/InlinePrompt.less +31 -119
  53. package/src/prompt/InlinePrompt/InlinePrompt.spec.tsx +87 -29
  54. package/src/prompt/InlinePrompt/InlinePrompt.story.tsx +223 -31
  55. package/src/prompt/InlinePrompt/InlinePrompt.tsx +42 -11
  56. package/src/sentimentSurface/SentimentSurface.css +4 -1
  57. package/src/sentimentSurface/SentimentSurface.docs.mdx +37 -478
  58. package/src/sentimentSurface/SentimentSurface.less +118 -114
  59. package/src/sentimentSurface/SentimentSurface.spec.tsx +31 -11
  60. package/src/sentimentSurface/SentimentSurface.story.tsx +325 -147
  61. package/src/sentimentSurface/SentimentSurface.tests.story.tsx +85 -86
  62. package/src/sentimentSurface/SentimentSurface.tsx +16 -9
  63. package/src/sentimentSurface/SentimentSurface.types.ts +5 -20
  64. package/src/test-utils/story-config.ts +0 -1
  65. package/build/sentimentSurface/classMap.js +0 -17
  66. package/build/sentimentSurface/classMap.js.map +0 -1
  67. package/build/sentimentSurface/classMap.mjs +0 -14
  68. package/build/sentimentSurface/classMap.mjs.map +0 -1
  69. package/build/types/sentimentSurface/classMap.d.ts +0 -4
  70. package/build/types/sentimentSurface/classMap.d.ts.map +0 -1
  71. package/src/sentimentSurface/classMap.ts +0 -15
@@ -1,10 +1,22 @@
1
1
  .wds-Button {
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-color-hover: var(--color-interactive-control-hover);
7
- --Button-color-active: var(--color-interactive-control-active);
2
+ --Button-background: var(--color-sentiment-interactive-primary, var(--color-interactive-accent));
3
+ --Button-background-hover: var(
4
+ --color-sentiment-interactive-primary-hover,
5
+ var(--color-interactive-accent-hover)
6
+ );
7
+ --Button-background-active: var(
8
+ --color-sentiment-interactive-primary-active,
9
+ var(--color-interactive-accent-active)
10
+ );
11
+ --Button-color: var(--color-sentiment-interactive-control, var(--color-interactive-control));
12
+ --Button-color-hover: var(
13
+ --color-sentiment-interactive-control-hover,
14
+ var(--color-interactive-control-hover)
15
+ );
16
+ --Button-color-active: var(
17
+ --color-sentiment-interactive-control-active,
18
+ var(--color-interactive-control-active)
19
+ );
8
20
  --Button-border-radius: var(--radius-full);
9
21
  --Button-label-gap: var(--size-4);
10
22
 
@@ -16,17 +28,47 @@
16
28
  --Button-transition-duration: 150ms;
17
29
  --Button-transition-easing: ease-in-out;
18
30
 
19
- --Button-secondary-background: var(--color-interactive-neutral);
20
- --Button-secondary-background-hover: var(--color-interactive-neutral-hover);
21
- --Button-secondary-background-active: var(--color-interactive-neutral-active);
22
- --Button-secondary-color: var(--color-interactive-primary);
23
- --Button-secondary-color-hover: var(--color-interactive-primary-hover);
24
- --Button-secondary-color-active: var(--color-interactive-primary-active);
31
+ --Button-secondary-background: var(
32
+ --color-sentiment-interactive-secondary-neutral,
33
+ var(--color-interactive-neutral)
34
+ );
35
+ --Button-secondary-background-hover: var(
36
+ --color-sentiment-interactive-secondary-neutral-hover,
37
+ var(--color-interactive-neutral-hover)
38
+ );
39
+ --Button-secondary-background-active: var(
40
+ --color-sentiment-interactive-secondary-neutral-active,
41
+ var(--color-interactive-neutral-active)
42
+ );
43
+ --Button-secondary-color: var(
44
+ --color-sentiment-content-primary,
45
+ var(--color-interactive-primary)
46
+ );
47
+ --Button-secondary-color-hover: var(
48
+ --color-sentiment-content-primary-hover,
49
+ var(--color-interactive-primary-hover)
50
+ );
51
+ --Button-secondary-color-active: var(
52
+ --color-sentiment-content-primary-active,
53
+ var(--color-interactive-primary-active)
54
+ );
25
55
 
26
- --Button-secondary-neutral-background: var(--color-background-neutral);
27
- --Button-secondary-neutral-background-hover: var(--color-background-neutral-hover);
28
- --Button-secondary-neutral-background-active: var(--color-background-neutral-active);
29
- --Button-secondary-neutral-color: var(--color-content-primary);
56
+ --Button-secondary-neutral-background: var(
57
+ --color-sentiment-interactive-secondary-neutral,
58
+ var(--color-background-neutral)
59
+ );
60
+ --Button-secondary-neutral-background-hover: var(
61
+ --color-sentiment-interactive-secondary-neutral-hover,
62
+ var(--color-background-neutral-hover)
63
+ );
64
+ --Button-secondary-neutral-background-active: var(
65
+ --color-sentiment-interactive-secondary-neutral-active,
66
+ var(--color-background-neutral-active)
67
+ );
68
+ --Button-secondary-neutral-color: var(
69
+ --color-sentiment-content-primary,
70
+ var(--color-content-primary)
71
+ );
30
72
 
31
73
  --Button-tertiary-background: transparent;
32
74
  --Button-tertiary-background-hover: var(--color-background-screen-hover);
@@ -52,5 +94,3 @@
52
94
  --Button-secondary-negative-color: var(--color-white);
53
95
  }
54
96
  }
55
-
56
-
@@ -13,17 +13,17 @@
13
13
  background-color: var(--color-background-neutral-active);
14
14
  }
15
15
  .np-icon-button-primary-default {
16
- color: var(--color-interactive-control);
16
+ color: var(--color-sentiment-interactive-control, var(--color-interactive-control));
17
17
  background-color: #00a2dd;
18
- background-color: var(--color-interactive-accent);
18
+ background-color: var(--color-sentiment-interactive-primary, var(--color-interactive-accent));
19
19
  }
20
20
  .np-icon-button-primary-default:not(.disabled):not(:disabled):hover {
21
21
  background-color: #008fc9;
22
- background-color: var(--color-interactive-accent-hover);
22
+ background-color: var(--color-sentiment-interactive-primary-hover, var(--color-interactive-accent-hover));
23
23
  }
24
24
  .np-icon-button-primary-default:not(.disabled):not(:disabled):active {
25
25
  background-color: #0081ba;
26
- background-color: var(--color-interactive-accent-active);
26
+ background-color: var(--color-sentiment-interactive-primary-active, var(--color-interactive-accent-active));
27
27
  }
28
28
  .np-icon-button-primary-negative {
29
29
  color: var(--color-contrast-overlay);
@@ -51,14 +51,14 @@
51
51
  background-color: var(--color-background-screen-active);
52
52
  }
53
53
  .np-icon-button-secondary-default {
54
- color: var(--color-interactive-primary);
55
- background-color: var(--color-interactive-neutral);
54
+ color: var(--color-sentiment-content-primary, var(--color-interactive-primary));
55
+ background-color: var(--color-sentiment-interactive-secondary-neutral, var(--color-interactive-neutral));
56
56
  }
57
57
  .np-icon-button-secondary-default:not(.disabled):not(:disabled):hover {
58
- background-color: var(--color-interactive-neutral-hover);
58
+ background-color: var(--color-sentiment-interactive-secondary-neutral-hover, var(--color-interactive-neutral-hover));
59
59
  }
60
60
  .np-icon-button-secondary-default:not(.disabled):not(:disabled):active {
61
- background-color: var(--color-interactive-neutral-active);
61
+ background-color: var(--color-sentiment-interactive-secondary-neutral-active, var(--color-interactive-neutral-active));
62
62
  }
63
63
  .np-theme-personal--bright-green .np-icon-button-secondary-default,
64
64
  .np-theme-personal--forest-green .np-icon-button-secondary-default {
@@ -5,7 +5,21 @@
5
5
  }
6
6
 
7
7
  &-primary-default {
8
- .colors(--color-interactive-control, --color-interactive-accent);
8
+ color: var(--color-sentiment-interactive-control, var(--color-interactive-control));
9
+ background-color: var(--color-sentiment-interactive-primary, var(--color-interactive-accent));
10
+
11
+ &:not(.disabled, :disabled):hover {
12
+ background-color: var(
13
+ --color-sentiment-interactive-primary-hover,
14
+ var(--color-interactive-accent-hover)
15
+ );
16
+ }
17
+ &:not(.disabled, :disabled):active {
18
+ background-color: var(
19
+ --color-sentiment-interactive-primary-active,
20
+ var(--color-interactive-accent-active)
21
+ );
22
+ }
9
23
  }
10
24
 
11
25
  &-primary-negative {
@@ -22,7 +36,24 @@
22
36
  }
23
37
 
24
38
  &-secondary-default {
25
- .colors(--color-interactive-primary, --color-interactive-neutral);
39
+ color: var(--color-sentiment-content-primary, var(--color-interactive-primary));
40
+ background-color: var(
41
+ --color-sentiment-interactive-secondary-neutral,
42
+ var(--color-interactive-neutral)
43
+ );
44
+
45
+ &:not(.disabled, :disabled):hover {
46
+ background-color: var(
47
+ --color-sentiment-interactive-secondary-neutral-hover,
48
+ var(--color-interactive-neutral-hover)
49
+ );
50
+ }
51
+ &:not(.disabled, :disabled):active {
52
+ background-color: var(
53
+ --color-sentiment-interactive-secondary-neutral-active,
54
+ var(--color-interactive-neutral-active)
55
+ );
56
+ }
26
57
 
27
58
  .np-theme-personal--bright-green &,
28
59
  .np-theme-personal--forest-green & {
@@ -46,10 +77,10 @@
46
77
  background-color: var(@bg-color);
47
78
 
48
79
  &:not(.disabled, :disabled):hover {
49
- background-color:~"var(@{bg-color}-hover)";
80
+ background-color: ~"var(@{bg-color}-hover)";
50
81
  }
51
82
  &:not(.disabled, :disabled):active {
52
- background-color:~"var(@{bg-color}-active)";
83
+ background-color: ~"var(@{bg-color}-active)";
53
84
  }
54
85
  }
55
86
  }
@@ -1,9 +1,9 @@
1
- /* eslint-disable react/jsx-key */
2
1
  import { Meta, StoryObj } from '@storybook/react-webpack5';
3
2
  import { ArrowLeft, Cross, Defrost, Edit, Menu, Plus } from '@transferwise/icons';
4
3
  import IconButton, { Props } from './IconButton';
5
4
  import { action } from 'storybook/actions';
6
5
  import Body from '../body';
6
+ import SentimentSurface from '../sentimentSurface';
7
7
 
8
8
  export default {
9
9
  title: 'Actions/IconButton',
@@ -94,14 +94,83 @@ export const Basic: Story = {
94
94
  >
95
95
  {['Primary', 'Secondary', 'Tertiary', 'Minimal', 'Neg primary', 'Neg secondary'].map(
96
96
  (variant) => (
97
- <Body type="body-default-bold">{variant}</Body>
97
+ <Body key={variant} type="body-default-bold">
98
+ {variant}
99
+ </Body>
98
100
  ),
99
101
  )}
100
102
  {sizes.map((size) => (
101
- <Template size={size} />
103
+ <Template key={size} size={size} />
102
104
  ))}
103
105
  <Template size={72} disabled />
104
106
  </div>
105
107
  );
106
108
  },
107
109
  };
110
+
111
+ /**
112
+ * `IconButton` is sentiment-aware and will automatically adjust its
113
+ * colours if wrapped inside the [SentimentSurface](/?path=/docs/content-sentimentsurface--docs) component
114
+ */
115
+ export const SentimentAwareness: Story = {
116
+ render: () => {
117
+ return (
118
+ <>
119
+ {(['success', 'warning', 'negative', 'neutral', 'proposition'] as const).map(
120
+ (sentiment) => (
121
+ <SentimentSurface
122
+ key={sentiment}
123
+ sentiment={sentiment}
124
+ className="p-a-1 d-flex align-items-center"
125
+ style={{ gap: 'var(--size-8)' }}
126
+ >
127
+ <IconButton
128
+ size={32}
129
+ aria-label="Primary action"
130
+ priority="primary"
131
+ type="default"
132
+ onClick={action('button click')}
133
+ >
134
+ <Plus />
135
+ </IconButton>
136
+ <IconButton
137
+ size={32}
138
+ aria-label="Secondary action"
139
+ priority="secondary"
140
+ type="default"
141
+ onClick={action('button click')}
142
+ >
143
+ <Defrost />
144
+ </IconButton>
145
+ <IconButton
146
+ size={32}
147
+ aria-label="Disabled action"
148
+ priority="primary"
149
+ type="default"
150
+ disabled
151
+ onClick={action('button click')}
152
+ >
153
+ <Menu />
154
+ </IconButton>
155
+ </SentimentSurface>
156
+ ),
157
+ )}
158
+ </>
159
+ );
160
+ },
161
+ parameters: {
162
+ docs: {
163
+ source: { type: 'dynamic' },
164
+ canvas: {
165
+ sourceState: 'hidden',
166
+ },
167
+ },
168
+ },
169
+ decorators: [
170
+ (Story) => (
171
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>
172
+ <Story />
173
+ </div>
174
+ ),
175
+ ],
176
+ };
@@ -108,8 +108,7 @@
108
108
  }
109
109
  @supports (hyphenate-limit-chars: 1) {
110
110
  .np-form-control--size-lg {
111
- -webkit-hyphens: auto;
112
- hyphens: auto;
111
+ hyphens: auto;
113
112
  hyphenate-limit-chars: 7 3;
114
113
  }
115
114
  @media (min-width: 768px) {
@@ -125,8 +124,7 @@
125
124
  }
126
125
  @supports (not (hyphenate-limit-chars: 1)) and (-webkit-hyphenate-limit-before: 1) {
127
126
  .np-form-control--size-lg {
128
- -webkit-hyphens: auto;
129
- hyphens: auto;
127
+ hyphens: auto;
130
128
  -webkit-hyphenate-limit-before: 3;
131
129
  -webkit-hyphenate-limit-after: 3;
132
130
  }
@@ -108,8 +108,7 @@
108
108
  }
109
109
  @supports (hyphenate-limit-chars: 1) {
110
110
  .np-form-control--size-lg {
111
- -webkit-hyphens: auto;
112
- hyphens: auto;
111
+ hyphens: auto;
113
112
  hyphenate-limit-chars: 7 3;
114
113
  }
115
114
  @media (min-width: 768px) {
@@ -125,8 +124,7 @@
125
124
  }
126
125
  @supports (not (hyphenate-limit-chars: 1)) and (-webkit-hyphenate-limit-before: 1) {
127
126
  .np-form-control--size-lg {
128
- -webkit-hyphens: auto;
129
- hyphens: auto;
127
+ hyphens: auto;
130
128
  -webkit-hyphenate-limit-before: 3;
131
129
  -webkit-hyphenate-limit-after: 3;
132
130
  }
package/src/link/Link.css CHANGED
@@ -1,6 +1,7 @@
1
1
  a,
2
2
  button.np-link {
3
3
  border-radius: 2px;
4
+ color: var(--color-sentiment-content-primary, var(--color-content-link));
4
5
  }
5
6
  .np-link .tw-icon {
6
7
  display: flex;
@@ -3,6 +3,7 @@
3
3
 
4
4
  a, button.np-link {
5
5
  border-radius: 2px;
6
+ color: var(--color-sentiment-content-primary, var(--color-content-link));
6
7
  }
7
8
 
8
9
  .np-link {
@@ -2,6 +2,7 @@ import Body from '../body/Body';
2
2
  import { Typography } from '../common';
3
3
  import Title from '../title/Title';
4
4
 
5
+ import SentimentSurface from '../sentimentSurface';
5
6
  import Link from '.';
6
7
 
7
8
  export default {
@@ -158,3 +159,30 @@ export const Basic = () => {
158
159
  </>
159
160
  );
160
161
  };
162
+
163
+ /**
164
+ * `Link` is sentiment-aware and will automatically adjust its
165
+ * colours if wrapped inside the [SentimentSurface](/?path=/docs/content-sentimentsurface--docs) component
166
+ */
167
+ export const SentimentAwareness = function Render() {
168
+ return (['success', 'warning', 'negative'] as const).map((sentiment) => (
169
+ <SentimentSurface key={sentiment} sentiment={sentiment} className="p-a-1">
170
+ {'Some text with an '}
171
+ <Link href="#">inline link</Link>
172
+ {' adjusted to match the current colour scheme. It also works with '}
173
+ <Link href="#" target="_blank">
174
+ external
175
+ </Link>
176
+ {' and '}
177
+ <Link href="#" target="_blank" disabled>
178
+ disabled links
179
+ </Link>
180
+ .
181
+ </SentimentSurface>
182
+ ));
183
+ };
184
+ SentimentAwareness.parameters = {
185
+ docs: {
186
+ source: { type: 'dynamic' },
187
+ },
188
+ };