@transferwise/components 0.0.0-experimental-cdb8834 → 0.0.0-experimental-2b6c540

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 (46) hide show
  1. package/build/main.css +5 -11
  2. package/build/prompt/ActionPrompt/ActionPrompt.js +0 -2
  3. package/build/prompt/ActionPrompt/ActionPrompt.js.map +1 -1
  4. package/build/prompt/ActionPrompt/ActionPrompt.mjs +0 -2
  5. package/build/prompt/ActionPrompt/ActionPrompt.mjs.map +1 -1
  6. package/build/prompt/InfoPrompt/InfoPrompt.js.map +1 -1
  7. package/build/prompt/InfoPrompt/InfoPrompt.mjs.map +1 -1
  8. package/build/prompt/InlinePrompt/InlinePrompt.js +1 -1
  9. package/build/prompt/InlinePrompt/InlinePrompt.js.map +1 -1
  10. package/build/prompt/InlinePrompt/InlinePrompt.mjs +1 -1
  11. package/build/prompt/InlinePrompt/InlinePrompt.mjs.map +1 -1
  12. package/build/styles/main.css +5 -11
  13. package/build/styles/prompt/ActionPrompt/ActionPrompt.css +0 -4
  14. package/build/styles/prompt/InfoPrompt/InfoPrompt.css +3 -3
  15. package/build/styles/prompt/InlinePrompt/InlinePrompt.css +2 -3
  16. package/build/styles/prompt/PrimitivePrompt/PrimitivePrompt.css +0 -1
  17. package/build/types/prompt/ActionPrompt/ActionPrompt.d.ts +7 -0
  18. package/build/types/prompt/ActionPrompt/ActionPrompt.d.ts.map +1 -1
  19. package/build/types/prompt/InfoPrompt/InfoPrompt.d.ts +4 -2
  20. package/build/types/prompt/InfoPrompt/InfoPrompt.d.ts.map +1 -1
  21. package/package.json +1 -1
  22. package/src/iconButton/IconButton.story.tsx +173 -48
  23. package/src/iconButton/IconButton.test.story.tsx +194 -0
  24. package/src/listItem/_stories/ListItem.story.tsx +0 -1
  25. package/src/main.css +5 -11
  26. package/src/prompt/ActionPrompt/ActionPrompt.accessibility.docs.mdx +1 -17
  27. package/src/prompt/ActionPrompt/ActionPrompt.css +0 -4
  28. package/src/prompt/ActionPrompt/ActionPrompt.less +1 -5
  29. package/src/prompt/ActionPrompt/ActionPrompt.story.tsx +262 -119
  30. package/src/prompt/ActionPrompt/ActionPrompt.test.story.tsx +86 -3
  31. package/src/prompt/ActionPrompt/ActionPrompt.tsx +9 -6
  32. package/src/prompt/InfoPrompt/InfoPrompt.accessibility.docs.mdx +79 -0
  33. package/src/prompt/InfoPrompt/InfoPrompt.css +3 -3
  34. package/src/prompt/InfoPrompt/InfoPrompt.less +3 -4
  35. package/src/prompt/InfoPrompt/InfoPrompt.story.tsx +80 -109
  36. package/src/prompt/InfoPrompt/InfoPrompt.test.story.tsx +54 -1
  37. package/src/prompt/InfoPrompt/InfoPrompt.tsx +4 -2
  38. package/src/prompt/InlinePrompt/InlinePrompt.accessibility.docs.mdx +63 -0
  39. package/src/prompt/InlinePrompt/InlinePrompt.css +2 -3
  40. package/src/prompt/InlinePrompt/InlinePrompt.less +2 -2
  41. package/src/prompt/InlinePrompt/InlinePrompt.story.tsx +25 -30
  42. package/src/prompt/InlinePrompt/InlinePrompt.test.story.tsx +21 -0
  43. package/src/prompt/InlinePrompt/InlinePrompt.test.tsx +3 -10
  44. package/src/prompt/InlinePrompt/InlinePrompt.tsx +1 -1
  45. package/src/prompt/PrimitivePrompt/PrimitivePrompt.css +0 -1
  46. package/src/prompt/PrimitivePrompt/PrimitivePrompt.less +1 -2
@@ -1,5 +1,18 @@
1
1
  import { Meta, StoryObj } from '@storybook/react-webpack5';
2
- import { ArrowLeft, Cross, Defrost, Edit, Menu, Plus } from '@transferwise/icons';
2
+ import {
3
+ ArrowLeft,
4
+ Cross,
5
+ Defrost,
6
+ Edit,
7
+ Menu,
8
+ Plus,
9
+ Settings,
10
+ Star,
11
+ Travel,
12
+ Briefcase,
13
+ Bank,
14
+ Freeze,
15
+ } from '@transferwise/icons';
3
16
  import IconButton, { Props } from './IconButton';
4
17
  import { action } from 'storybook/actions';
5
18
  import Body from '../body';
@@ -114,48 +127,167 @@ export const Basic: Story = {
114
127
  */
115
128
  export const SentimentAwareness: Story = {
116
129
  render: () => {
130
+ const priorities = ['primary', 'secondary', 'tertiary', 'minimal', 'disabled'] as const;
131
+ const sentiments = ['success', 'warning', 'negative', 'neutral', 'proposition'] as const;
132
+
117
133
  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)' }}
134
+ <div style={{ display: 'flex', flexDirection: 'column' }}>
135
+ {/* Header row with priority labels */}
136
+ <div style={{ display: 'flex', alignItems: 'flex-end', marginBottom: '4px', gap: '8px' }}>
137
+ <div style={{ width: '82px', paddingLeft: '8px' }} />
138
+ {priorities.map((priority) => (
139
+ <div
140
+ key={priority}
141
+ style={{
142
+ width: '32px',
143
+ textAlign: 'center',
144
+ fontSize: '11px',
145
+ fontWeight: 'bold',
146
+ writingMode: 'vertical-rl',
147
+ transform: 'rotate(180deg)',
148
+ height: '60px',
149
+ display: 'flex',
150
+ alignItems: 'center',
151
+ justifyContent: 'center',
152
+ }}
126
153
  >
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
- </>
154
+ {priority}
155
+ </div>
156
+ ))}
157
+ </div>
158
+
159
+ {/* Rows for each sentiment with base and elevated emphasis */}
160
+ {sentiments.flatMap((sentiment) => [
161
+ <SentimentSurface
162
+ key={`${sentiment}-base`}
163
+ sentiment={sentiment}
164
+ emphasis="base"
165
+ style={{ display: 'flex', alignItems: 'center', padding: '8px 0', gap: '8px' }}
166
+ >
167
+ <div
168
+ style={{
169
+ width: '82px',
170
+ fontSize: '11px',
171
+ fontWeight: 'bold',
172
+ textAlign: 'left',
173
+ paddingLeft: '8px',
174
+ }}
175
+ >
176
+ {sentiment} (base)
177
+ </div>
178
+ <IconButton
179
+ size={32}
180
+ aria-label="Primary action"
181
+ priority="primary"
182
+ type="default"
183
+ onClick={action('button click')}
184
+ >
185
+ <Plus />
186
+ </IconButton>
187
+ <IconButton
188
+ size={32}
189
+ aria-label="Secondary action"
190
+ priority="secondary"
191
+ type="default"
192
+ onClick={action('button click')}
193
+ >
194
+ <Settings />
195
+ </IconButton>
196
+ <IconButton
197
+ size={32}
198
+ aria-label="Tertiary action"
199
+ priority="tertiary"
200
+ type="default"
201
+ onClick={action('button click')}
202
+ >
203
+ <Star />
204
+ </IconButton>
205
+ <IconButton
206
+ size={32}
207
+ aria-label="Minimal action"
208
+ priority="minimal"
209
+ type="default"
210
+ onClick={action('button click')}
211
+ >
212
+ <Travel />
213
+ </IconButton>
214
+ <IconButton
215
+ size={32}
216
+ aria-label="Disabled action"
217
+ priority="primary"
218
+ type="default"
219
+ disabled
220
+ onClick={action('button click')}
221
+ >
222
+ <Menu />
223
+ </IconButton>
224
+ </SentimentSurface>,
225
+ <SentimentSurface
226
+ key={`${sentiment}-elevated`}
227
+ sentiment={sentiment}
228
+ emphasis="elevated"
229
+ style={{ display: 'flex', alignItems: 'center', padding: '8px 0', gap: '8px' }}
230
+ >
231
+ <div
232
+ style={{
233
+ width: '82px',
234
+ fontSize: '11px',
235
+ fontWeight: 'bold',
236
+ textAlign: 'left',
237
+ paddingLeft: '8px',
238
+ }}
239
+ >
240
+ {sentiment} (elevated)
241
+ </div>
242
+ <IconButton
243
+ size={32}
244
+ aria-label="Primary action"
245
+ priority="primary"
246
+ type="default"
247
+ onClick={action('button click')}
248
+ >
249
+ <Briefcase />
250
+ </IconButton>
251
+ <IconButton
252
+ size={32}
253
+ aria-label="Secondary action"
254
+ priority="secondary"
255
+ type="default"
256
+ onClick={action('button click')}
257
+ >
258
+ <Bank />
259
+ </IconButton>
260
+ <IconButton
261
+ size={32}
262
+ aria-label="Tertiary action"
263
+ priority="tertiary"
264
+ type="default"
265
+ onClick={action('button click')}
266
+ >
267
+ <Freeze />
268
+ </IconButton>
269
+ <IconButton
270
+ size={32}
271
+ aria-label="Minimal action"
272
+ priority="minimal"
273
+ type="default"
274
+ onClick={action('button click')}
275
+ >
276
+ <Edit />
277
+ </IconButton>
278
+ <IconButton
279
+ size={32}
280
+ aria-label="Disabled action"
281
+ priority="primary"
282
+ type="default"
283
+ disabled
284
+ onClick={action('button click')}
285
+ >
286
+ <Cross />
287
+ </IconButton>
288
+ </SentimentSurface>,
289
+ ])}
290
+ </div>
159
291
  );
160
292
  },
161
293
  parameters: {
@@ -166,11 +298,4 @@ export const SentimentAwareness: Story = {
166
298
  },
167
299
  },
168
300
  },
169
- decorators: [
170
- (Story) => (
171
- <div style={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>
172
- <Story />
173
- </div>
174
- ),
175
- ],
176
301
  };
@@ -0,0 +1,194 @@
1
+ import { Meta, StoryObj } from '@storybook/react-webpack5';
2
+ import { Menu, Plus, Settings, Star, Travel } from '@transferwise/icons';
3
+ import { action } from 'storybook/actions';
4
+ import IconButton from './IconButton';
5
+ import SentimentSurface from '../sentimentSurface';
6
+ import { allModes } from '../../.storybook/modes';
7
+
8
+ export default {
9
+ title: 'Actions/IconButton/Tests',
10
+ component: IconButton,
11
+ tags: ['!autodocs', '!manifest'],
12
+ } satisfies Meta<typeof IconButton>;
13
+
14
+ type Story = StoryObj<typeof IconButton>;
15
+
16
+ /**
17
+ * IconButton displayed across all themes and sentiments for visual regression testing.
18
+ */
19
+ export const AllThemesAndSentiments: Story = {
20
+ render: () => {
21
+ const priorities = ['primary', 'secondary', 'tertiary', 'minimal', 'disabled'] as const;
22
+ const sentiments = ['negative', 'warning', 'neutral', 'success', 'proposition'] as const;
23
+ const icons = [Plus, Settings, Star, Travel];
24
+
25
+ return (
26
+ <div style={{ display: 'flex', flexDirection: 'column' }}>
27
+ {/* Header row with priority labels */}
28
+ <div style={{ display: 'flex', alignItems: 'flex-end', marginBottom: '4px', gap: '8px' }}>
29
+ <div style={{ width: '82px', paddingLeft: '8px' }} />
30
+ {priorities.map((priority) => (
31
+ <div
32
+ key={priority}
33
+ style={{
34
+ width: '32px',
35
+ textAlign: 'center',
36
+ fontSize: '11px',
37
+ fontWeight: 'bold',
38
+ writingMode: 'vertical-rl',
39
+ transform: 'rotate(180deg)',
40
+ height: '60px',
41
+ display: 'flex',
42
+ alignItems: 'center',
43
+ justifyContent: 'center',
44
+ }}
45
+ >
46
+ {priority}
47
+ </div>
48
+ ))}
49
+ </div>
50
+
51
+ {/* Rows for each sentiment with base and elevated emphasis */}
52
+ {sentiments.flatMap((sentiment) => [
53
+ <SentimentSurface
54
+ key={`${sentiment}-base`}
55
+ sentiment={sentiment}
56
+ emphasis="base"
57
+ style={{ display: 'flex', alignItems: 'center', padding: '8px 0', gap: '8px' }}
58
+ >
59
+ <div
60
+ style={{
61
+ width: '82px',
62
+ fontSize: '11px',
63
+ fontWeight: 'bold',
64
+ textAlign: 'left',
65
+ paddingLeft: '8px',
66
+ }}
67
+ >
68
+ {sentiment} (base)
69
+ </div>
70
+ <IconButton
71
+ size={32}
72
+ aria-label="Primary action"
73
+ priority="primary"
74
+ type="default"
75
+ onClick={action('button click')}
76
+ >
77
+ <Plus />
78
+ </IconButton>
79
+ <IconButton
80
+ size={32}
81
+ aria-label="Secondary action"
82
+ priority="secondary"
83
+ type="default"
84
+ onClick={action('button click')}
85
+ >
86
+ <Settings />
87
+ </IconButton>
88
+ <IconButton
89
+ size={32}
90
+ aria-label="Tertiary action"
91
+ priority="tertiary"
92
+ type="default"
93
+ onClick={action('button click')}
94
+ >
95
+ <Star />
96
+ </IconButton>
97
+ <IconButton
98
+ size={32}
99
+ aria-label="Minimal action"
100
+ priority="minimal"
101
+ type="default"
102
+ onClick={action('button click')}
103
+ >
104
+ <Travel />
105
+ </IconButton>
106
+ <IconButton
107
+ size={32}
108
+ aria-label="Disabled action"
109
+ priority="primary"
110
+ type="default"
111
+ disabled
112
+ onClick={action('button click')}
113
+ >
114
+ <Menu />
115
+ </IconButton>
116
+ </SentimentSurface>,
117
+ <SentimentSurface
118
+ key={`${sentiment}-elevated`}
119
+ sentiment={sentiment}
120
+ emphasis="elevated"
121
+ style={{ display: 'flex', alignItems: 'center', padding: '8px 0', gap: '8px' }}
122
+ >
123
+ <div
124
+ style={{
125
+ width: '82px',
126
+ fontSize: '11px',
127
+ fontWeight: 'bold',
128
+ textAlign: 'left',
129
+ paddingLeft: '8px',
130
+ }}
131
+ >
132
+ {sentiment} (elevated)
133
+ </div>
134
+ <IconButton
135
+ size={32}
136
+ aria-label="Primary action"
137
+ priority="primary"
138
+ type="default"
139
+ onClick={action('button click')}
140
+ >
141
+ <Plus />
142
+ </IconButton>
143
+ <IconButton
144
+ size={32}
145
+ aria-label="Secondary action"
146
+ priority="secondary"
147
+ type="default"
148
+ onClick={action('button click')}
149
+ >
150
+ <Settings />
151
+ </IconButton>
152
+ <IconButton
153
+ size={32}
154
+ aria-label="Tertiary action"
155
+ priority="tertiary"
156
+ type="default"
157
+ onClick={action('button click')}
158
+ >
159
+ <Star />
160
+ </IconButton>
161
+ <IconButton
162
+ size={32}
163
+ aria-label="Minimal action"
164
+ priority="minimal"
165
+ type="default"
166
+ onClick={action('button click')}
167
+ >
168
+ <Travel />
169
+ </IconButton>
170
+ <IconButton
171
+ size={32}
172
+ aria-label="Disabled action"
173
+ priority="primary"
174
+ type="default"
175
+ disabled
176
+ onClick={action('button click')}
177
+ >
178
+ <Menu />
179
+ </IconButton>
180
+ </SentimentSurface>,
181
+ ])}
182
+ </div>
183
+ );
184
+ },
185
+ parameters: {
186
+ padding: '16px',
187
+ variants: ['default', 'dark', 'bright-green', 'forest-green'],
188
+ chromatic: {
189
+ dark: allModes.dark,
190
+ brightGreen: allModes.brightGreen,
191
+ forestGreen: allModes.forestGreen,
192
+ },
193
+ },
194
+ };
@@ -252,7 +252,6 @@ const getPropsForPreview = (args: PreviewStoryArgs): [ListItemProps, Partial<Lis
252
252
  };
253
253
 
254
254
  export const Playground: StoryObj<PreviewStoryArgs> = {
255
- tags: ['!autodocs'],
256
255
  render: (args: PreviewStoryArgs) => {
257
256
  const [props, previewProps] = getPropsForPreview(args);
258
257
 
package/src/main.css CHANGED
@@ -5346,7 +5346,6 @@ html:not([dir="rtl"]) .np-navigation-option {
5346
5346
  padding: var(--Prompt-padding, var(--padding-x-small));
5347
5347
  text-align: left;
5348
5348
  word-break: break-word;
5349
- width: 100%;
5350
5349
  }
5351
5350
  .wds-prompt__content-wrapper {
5352
5351
  display: grid;
@@ -5406,9 +5405,8 @@ html:not([dir="rtl"]) .np-navigation-option {
5406
5405
  .wds-inline-prompt:has(button):active {
5407
5406
  background-color: var(--color-sentiment-background-surface-active);
5408
5407
  }
5409
- .wds-inline-prompt--auto-width {
5410
- width: auto;
5411
- width: initial;
5408
+ .wds-inline-prompt--full-width {
5409
+ width: 100%;
5412
5410
  }
5413
5411
  .wds-inline-prompt--muted {
5414
5412
  opacity: 0.93;
@@ -5445,14 +5443,12 @@ html:not([dir="rtl"]) .np-navigation-option {
5445
5443
  }
5446
5444
  .wds-info-prompt {
5447
5445
  --Prompt-gap: var(--size-8);
5448
- --Prompt-padding: 12px;
5446
+ --Prompt-padding: var(--size-12);
5449
5447
  }
5450
5448
  .wds-info-prompt__content {
5451
5449
  display: flex;
5452
5450
  flex-direction: column;
5453
5451
  justify-content: center;
5454
- max-width: calc(48px * 10);
5455
- max-width: calc(var(--size-48) * 10);
5456
5452
  }
5457
5453
  .wds-info-prompt__content:has(.wds-info-prompt__title) {
5458
5454
  justify-content: flex-start;
@@ -5471,7 +5467,9 @@ html:not([dir="rtl"]) .np-navigation-option {
5471
5467
  }
5472
5468
  .wds-info-prompt__media svg {
5473
5469
  width: 24px;
5470
+ width: var(--size-24);
5474
5471
  height: 24px;
5472
+ height: var(--size-24);
5475
5473
  }
5476
5474
  .wds-info-prompt .wds-prompt__media-wrapper {
5477
5475
  padding: 0;
@@ -7488,7 +7486,3 @@ html:not([dir="rtl"]) .np-navigation-option {
7488
7486
  min-width: fit-content;
7489
7487
  }
7490
7488
  }
7491
- .wds-action-prompt__content {
7492
- max-width: calc(48px * 10);
7493
- max-width: calc(var(--size-48) * 10);
7494
- }
@@ -31,23 +31,7 @@ If you want to provide a custom label for screen readers, you can use the `aria-
31
31
 
32
32
  ## Media
33
33
 
34
- You can use the `aria-hidden` attribute on media assets to hide them from screen readers if they're not providing any additional information. This is useful when the media is purely decorative or when its content is already conveyed through other means (e.g., text).
35
-
36
- <Source
37
- dark
38
- code={`
39
- <ActionPrompt
40
- media={{
41
- 'aria-hidden': true,
42
- avatar: { asset: <People /> },
43
- }}
44
- title="Sync contacts for a faster experience"
45
- ...
46
- />
47
- `}
48
- />
49
-
50
- You can also use `aria-label` on media assets to provide a custom label for screen readers.
34
+ You can use `aria-label` on media assets to provide a custom label for screen readers.
51
35
 
52
36
  <Source
53
37
  dark
@@ -19,7 +19,3 @@
19
19
  min-width: fit-content;
20
20
  }
21
21
  }
22
- .wds-action-prompt__content {
23
- max-width: calc(48px * 10);
24
- max-width: calc(var(--size-48) * 10);
25
- }
@@ -20,8 +20,4 @@
20
20
  }
21
21
  }
22
22
  }
23
-
24
- &__content{
25
- max-width: calc(var(--size-48) * 10);
26
- }
27
- }
23
+ }