@wise/wds-codemods 1.1.3-experimental-c5533b3 → 1.1.3-experimental-ae0bfdd
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.
|
@@ -51,264 +51,6 @@ When using enum values:
|
|
|
51
51
|
|
|
52
52
|
---
|
|
53
53
|
|
|
54
|
-
## Basic Migration
|
|
55
|
-
|
|
56
|
-
```tsx
|
|
57
|
-
<Alert type="positive" message="Payment completed successfully." />
|
|
58
|
-
→
|
|
59
|
-
<InfoPrompt sentiment="success" description="Payment completed successfully." />
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
---
|
|
63
|
-
|
|
64
|
-
## With Title
|
|
65
|
-
|
|
66
|
-
```tsx
|
|
67
|
-
<Alert type="neutral" title="We're reviewing your information." message="This may take a few minutes." />
|
|
68
|
-
→
|
|
69
|
-
<InfoPrompt sentiment="neutral" title="We're reviewing your information." description="This may take a few minutes." />
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
---
|
|
73
|
-
|
|
74
|
-
## With onDismiss
|
|
75
|
-
|
|
76
|
-
Alert's `onDismiss` receives a `MouseEvent`; InfoPrompt's `onDismiss` receives no arguments.
|
|
77
|
-
|
|
78
|
-
```tsx
|
|
79
|
-
<Alert type="warning" message="Check your details." onDismiss={(e) => handleDismiss(e)} />
|
|
80
|
-
→
|
|
81
|
-
<InfoPrompt sentiment="warning" description="Check your details." onDismiss={() => handleDismiss()} />
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
If the handler already ignores the event:
|
|
85
|
-
|
|
86
|
-
```tsx
|
|
87
|
-
<Alert type="warning" message="Check your details." onDismiss={() => setVisible(false)} />
|
|
88
|
-
→
|
|
89
|
-
<InfoPrompt sentiment="warning" description="Check your details." onDismiss={() => setVisible(false)} />
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
---
|
|
93
|
-
|
|
94
|
-
## With Link Action
|
|
95
|
-
|
|
96
|
-
Alert renders a `<Link>` by default (`as` omitted or `as="link"`).
|
|
97
|
-
|
|
98
|
-
- `action.text` → `action.label`
|
|
99
|
-
- `action['aria-label']` → removed (not supported; use a descriptive `label` instead)
|
|
100
|
-
|
|
101
|
-
```tsx
|
|
102
|
-
<Alert
|
|
103
|
-
type="neutral"
|
|
104
|
-
message="New feature available."
|
|
105
|
-
action={{ text: 'Read more', href: '/features', target: '_blank' }}
|
|
106
|
-
/>
|
|
107
|
-
→
|
|
108
|
-
<InfoPrompt
|
|
109
|
-
sentiment="neutral"
|
|
110
|
-
description="New feature available."
|
|
111
|
-
action={{ label: 'Read more', href: '/features', target: '_blank' }}
|
|
112
|
-
/>
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
---
|
|
116
|
-
|
|
117
|
-
## With Button Action
|
|
118
|
-
|
|
119
|
-
InfoPrompt does **not** support `as: 'button'`. The action is always rendered as a `<Link>`.
|
|
120
|
-
|
|
121
|
-
- If the Alert action used `as: 'button'` with an `href`, convert to a link action
|
|
122
|
-
- If the Alert action used `as: 'button'` without `href` (onClick only), convert to an action with `onClick`
|
|
123
|
-
|
|
124
|
-
```tsx
|
|
125
|
-
<Alert
|
|
126
|
-
type="neutral"
|
|
127
|
-
message="Verify your identity."
|
|
128
|
-
action={{ text: 'Verify now', as: 'button', onClick: handleVerify }}
|
|
129
|
-
/>
|
|
130
|
-
→
|
|
131
|
-
<InfoPrompt
|
|
132
|
-
sentiment="neutral"
|
|
133
|
-
description="Verify your identity."
|
|
134
|
-
action={{ label: 'Verify now', onClick: handleVerify }}
|
|
135
|
-
/>
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
```tsx
|
|
139
|
-
<Alert
|
|
140
|
-
type="neutral"
|
|
141
|
-
message="Go to settings."
|
|
142
|
-
action={{ text: 'Open settings', as: 'button', href: '/settings', target: '_blank' }}
|
|
143
|
-
/>
|
|
144
|
-
→
|
|
145
|
-
<InfoPrompt
|
|
146
|
-
sentiment="neutral"
|
|
147
|
-
description="Go to settings."
|
|
148
|
-
action={{ label: 'Open settings', href: '/settings', target: '_blank' }}
|
|
149
|
-
/>
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
---
|
|
153
|
-
|
|
154
|
-
## With Custom Icon → Media
|
|
155
|
-
|
|
156
|
-
Alert's `icon` accepts a bare ReactNode. InfoPrompt's `media` requires an object `{ asset: ReactNode }`.
|
|
157
|
-
|
|
158
|
-
The icon/asset should include its own accessibility attributes (e.g. `title`, `aria-label`).
|
|
159
|
-
|
|
160
|
-
```tsx
|
|
161
|
-
<Alert type="neutral" message="Scheduled for later." icon={<ClockBorderless size={24} />} />
|
|
162
|
-
→
|
|
163
|
-
<InfoPrompt sentiment="neutral" description="Scheduled for later." media={{ asset: <ClockBorderless size={24} /> }} />
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
---
|
|
167
|
-
|
|
168
|
-
## With statusIconLabel
|
|
169
|
-
|
|
170
|
-
`statusIconLabel` is removed. InfoPrompt's default status icons handle accessibility internally.
|
|
171
|
-
If you need a custom accessible name, provide it via `media.asset` attributes.
|
|
172
|
-
|
|
173
|
-
```tsx
|
|
174
|
-
<Alert type="positive" message="Done!" statusIconLabel="Success indicator" />
|
|
175
|
-
→
|
|
176
|
-
<InfoPrompt sentiment="success" description="Done!" />
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
---
|
|
180
|
-
|
|
181
|
-
## Bold Markdown in Message
|
|
182
|
-
|
|
183
|
-
Alert's `message` supports inline bold markdown (`**text**`). InfoPrompt's `description` is **plain text only**.
|
|
184
|
-
|
|
185
|
-
Strip the markdown delimiters or restructure your content:
|
|
186
|
-
|
|
187
|
-
```tsx
|
|
188
|
-
<Alert type="positive" message="Payments sent **today** might not arrive in time." />
|
|
189
|
-
→
|
|
190
|
-
<InfoPrompt sentiment="success" description="Payments sent today might not arrive in time." />
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
---
|
|
194
|
-
|
|
195
|
-
## Children (Deprecated in Alert)
|
|
196
|
-
|
|
197
|
-
Alert's `children` prop (deprecated) allowed arbitrary ReactNode content. InfoPrompt requires a string `description`.
|
|
198
|
-
|
|
199
|
-
Convert the child content to a plain text string:
|
|
200
|
-
|
|
201
|
-
```tsx
|
|
202
|
-
<Alert type="neutral">Your transfer is <strong>in progress</strong>.</Alert>
|
|
203
|
-
→
|
|
204
|
-
<InfoPrompt sentiment="neutral" description="Your transfer is in progress." />
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
---
|
|
208
|
-
|
|
209
|
-
## Deprecated `type` Values
|
|
210
|
-
|
|
211
|
-
If still using deprecated Alert type values, map them directly:
|
|
212
|
-
|
|
213
|
-
```tsx
|
|
214
|
-
<Alert type="success" message="Done!" />
|
|
215
|
-
→
|
|
216
|
-
<InfoPrompt sentiment="success" description="Done!" />
|
|
217
|
-
|
|
218
|
-
<Alert type="info" message="FYI." />
|
|
219
|
-
→
|
|
220
|
-
<InfoPrompt sentiment="neutral" description="FYI." />
|
|
221
|
-
|
|
222
|
-
<Alert type="error" message="Something went wrong." />
|
|
223
|
-
→
|
|
224
|
-
<InfoPrompt sentiment="negative" description="Something went wrong." />
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
---
|
|
228
|
-
|
|
229
|
-
## Arrow (Deprecated in Alert)
|
|
230
|
-
|
|
231
|
-
`arrow` is not supported in InfoPrompt. Use `InlinePrompt` instead for arrow/pointer behaviour.
|
|
232
|
-
|
|
233
|
-
```tsx
|
|
234
|
-
<Alert type="neutral" message="Hint text." arrow="up-left" />
|
|
235
|
-
→
|
|
236
|
-
<InfoPrompt sentiment="neutral" description="Hint text." />
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
If arrow pointing behaviour is required, migrate to `InlinePrompt` instead of `InfoPrompt`.
|
|
240
|
-
|
|
241
|
-
---
|
|
242
|
-
|
|
243
|
-
## Dismissible (Deprecated in Alert)
|
|
244
|
-
|
|
245
|
-
Replace the deprecated `dismissible` boolean with `onDismiss` handler:
|
|
246
|
-
|
|
247
|
-
```tsx
|
|
248
|
-
<Alert type="neutral" message="Notice." dismissible />
|
|
249
|
-
→
|
|
250
|
-
<InfoPrompt sentiment="neutral" description="Notice." onDismiss={() => setVisible(false)} />
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
---
|
|
254
|
-
|
|
255
|
-
## Full Example
|
|
256
|
-
|
|
257
|
-
### Before
|
|
258
|
-
|
|
259
|
-
```tsx
|
|
260
|
-
import { Alert, Sentiment } from '@transferwise/components';
|
|
261
|
-
import { ClockBorderless } from '@transferwise/icons';
|
|
262
|
-
|
|
263
|
-
function MyComponent() {
|
|
264
|
-
const [visible, setVisible] = useState(true);
|
|
265
|
-
|
|
266
|
-
if (!visible) return null;
|
|
267
|
-
|
|
268
|
-
return (
|
|
269
|
-
<Alert
|
|
270
|
-
type={Sentiment.POSITIVE}
|
|
271
|
-
title="Payment Successful"
|
|
272
|
-
message="Your payment of **$100** has been sent."
|
|
273
|
-
icon={<ClockBorderless size={24} />}
|
|
274
|
-
action={{
|
|
275
|
-
text: 'View details',
|
|
276
|
-
href: '/transactions',
|
|
277
|
-
target: '_blank',
|
|
278
|
-
'aria-label': 'View transaction details',
|
|
279
|
-
}}
|
|
280
|
-
onDismiss={(e) => setVisible(false)}
|
|
281
|
-
/>
|
|
282
|
-
);
|
|
283
|
-
}
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
### After
|
|
287
|
-
|
|
288
|
-
```tsx
|
|
289
|
-
import { InfoPrompt } from '@transferwise/components';
|
|
290
|
-
import { ClockBorderless } from '@transferwise/icons';
|
|
291
|
-
|
|
292
|
-
function MyComponent() {
|
|
293
|
-
const [visible, setVisible] = useState(true);
|
|
294
|
-
|
|
295
|
-
if (!visible) return null;
|
|
296
|
-
|
|
297
|
-
return (
|
|
298
|
-
<InfoPrompt
|
|
299
|
-
sentiment="success"
|
|
300
|
-
title="Payment Successful"
|
|
301
|
-
description="Your payment of $100 has been sent."
|
|
302
|
-
media={{ asset: <ClockBorderless size={24} title="Clock" /> }}
|
|
303
|
-
action={{ label: 'View details', href: '/transactions', target: '_blank' }}
|
|
304
|
-
onDismiss={() => setVisible(false)}
|
|
305
|
-
/>
|
|
306
|
-
);
|
|
307
|
-
}
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
---
|
|
311
|
-
|
|
312
54
|
## New Props in InfoPrompt (Not in Alert)
|
|
313
55
|
|
|
314
56
|
| Prop | Type | Default | Description |
|