@transferwise/components 0.0.0-experimental-1de8033 → 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 (31) hide show
  1. package/build/main.css +3 -1
  2. package/build/prompt/ActionPrompt/ActionPrompt.js +4 -4
  3. package/build/prompt/ActionPrompt/ActionPrompt.js.map +1 -1
  4. package/build/prompt/ActionPrompt/ActionPrompt.mjs +4 -4
  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/styles/main.css +3 -1
  9. package/build/styles/prompt/InfoPrompt/InfoPrompt.css +3 -1
  10. package/build/types/prompt/ActionPrompt/ActionPrompt.d.ts +7 -0
  11. package/build/types/prompt/ActionPrompt/ActionPrompt.d.ts.map +1 -1
  12. package/build/types/prompt/InfoPrompt/InfoPrompt.d.ts +4 -2
  13. package/build/types/prompt/InfoPrompt/InfoPrompt.d.ts.map +1 -1
  14. package/package.json +1 -1
  15. package/src/iconButton/IconButton.story.tsx +173 -48
  16. package/src/iconButton/IconButton.test.story.tsx +194 -0
  17. package/src/listItem/_stories/ListItem.story.tsx +0 -1
  18. package/src/main.css +3 -1
  19. package/src/prompt/ActionPrompt/ActionPrompt.accessibility.docs.mdx +1 -17
  20. package/src/prompt/ActionPrompt/ActionPrompt.story.tsx +271 -107
  21. package/src/prompt/ActionPrompt/ActionPrompt.test.story.tsx +86 -3
  22. package/src/prompt/ActionPrompt/ActionPrompt.tsx +11 -4
  23. package/src/prompt/InfoPrompt/InfoPrompt.accessibility.docs.mdx +79 -0
  24. package/src/prompt/InfoPrompt/InfoPrompt.css +3 -1
  25. package/src/prompt/InfoPrompt/InfoPrompt.less +4 -4
  26. package/src/prompt/InfoPrompt/InfoPrompt.story.tsx +80 -86
  27. package/src/prompt/InfoPrompt/InfoPrompt.test.story.tsx +54 -1
  28. package/src/prompt/InfoPrompt/InfoPrompt.tsx +4 -2
  29. package/src/prompt/InlinePrompt/InlinePrompt.accessibility.docs.mdx +63 -0
  30. package/src/prompt/InlinePrompt/InlinePrompt.story.tsx +24 -29
  31. package/src/prompt/InlinePrompt/InlinePrompt.test.story.tsx +21 -0
@@ -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
@@ -5443,7 +5443,7 @@ html:not([dir="rtl"]) .np-navigation-option {
5443
5443
  }
5444
5444
  .wds-info-prompt {
5445
5445
  --Prompt-gap: var(--size-8);
5446
- --Prompt-padding: 12px;
5446
+ --Prompt-padding: var(--size-12);
5447
5447
  }
5448
5448
  .wds-info-prompt__content {
5449
5449
  display: flex;
@@ -5467,7 +5467,9 @@ html:not([dir="rtl"]) .np-navigation-option {
5467
5467
  }
5468
5468
  .wds-info-prompt__media svg {
5469
5469
  width: 24px;
5470
+ width: var(--size-24);
5470
5471
  height: 24px;
5472
+ height: var(--size-24);
5471
5473
  }
5472
5474
  .wds-info-prompt .wds-prompt__media-wrapper {
5473
5475
  padding: 0;
@@ -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