@mittwald/flow-react-components 1.1.0-next.10 → 1.1.0-next.11
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/MIGRATION.md +389 -144
- package/README.md +2 -1
- package/USAGE.md +2 -1
- package/dist/assets/component-index.json +1 -1
- package/dist/assets/doc-properties.json +1 -1
- package/package.json +9 -9
package/MIGRATION.md
CHANGED
|
@@ -1,31 +1,34 @@
|
|
|
1
1
|
# Migrations
|
|
2
2
|
|
|
3
|
+
<!-- AUTO-GENERATED by `pnpm nx build codemods` — do not edit.
|
|
4
|
+
Source: packages/codemods/src/migrations/<id>/entry.md -->
|
|
5
|
+
|
|
3
6
|
Entries are sorted by version, newest first. Find the version you are coming
|
|
4
7
|
from and work your way up.
|
|
5
8
|
|
|
6
|
-
Catching up across
|
|
7
|
-
|
|
9
|
+
Catching up across several versions? One command bumps every Flow dependency and
|
|
10
|
+
runs the codemod of every migration up to the version it lands on:
|
|
8
11
|
|
|
9
12
|
```shell
|
|
10
|
-
npx
|
|
11
|
-
-t https://raw.githubusercontent.com/mittwald/flow/refs/heads/main/packages/codemods/src/transforms/flowAlphaAll.ts \
|
|
12
|
-
--parser tsx \
|
|
13
|
-
src
|
|
13
|
+
npx @mittwald/flow-codemods@latest upgrade
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
It is not the whole migration. Most entries below have no codemod and have to be
|
|
17
|
+
done by hand — the command prints those when it is done. It lists migrations
|
|
18
|
+
older than your current version too: nothing records which ones you already
|
|
19
|
+
performed, and re-running a codemod is a no-op.
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
`0.1.0` → `0.2.0` codemod is not part of `flowAlphaAll` — run that one
|
|
22
|
-
separately, and only when coming from `0.1.0`.
|
|
21
|
+
It refuses to run on a dirty working tree (`--allow-dirty` overrides that) and
|
|
22
|
+
rewrites files in place, so review the diff afterwards.
|
|
23
23
|
|
|
24
24
|
---
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
<a id="segmented-control-deprecated"></a>
|
|
27
|
+
|
|
28
|
+
## SegmentedControl deprecated
|
|
27
29
|
|
|
28
|
-
|
|
30
|
+
**Since `0.2.0-alpha.1056`** · deprecation · manual change · also applies to
|
|
31
|
+
`@mittwald/flow-remote-react-components`
|
|
29
32
|
|
|
30
33
|
`SegmentedControl` and `Segment` are deprecated. The component covered two
|
|
31
34
|
different jobs, and each already has its own component in Flow. Which
|
|
@@ -84,11 +87,18 @@ The `containerBreakpointSize` property has no counterpart: `Tabs` collapse on
|
|
|
84
87
|
their own when the available width runs out, and a `RadioGroup` stacks its
|
|
85
88
|
options anyway.
|
|
86
89
|
|
|
90
|
+
**Apply:** Replace `SegmentedControl` with `Tabs` when the selection switches
|
|
91
|
+
displayed content, or with `RadioGroup` when it sets a value. Pick per usage —
|
|
92
|
+
this is a structural change, not a rename.
|
|
93
|
+
|
|
87
94
|
---
|
|
88
95
|
|
|
89
|
-
|
|
96
|
+
<a id="align-to-combine"></a>
|
|
90
97
|
|
|
91
|
-
|
|
98
|
+
## Align renamed to Combine
|
|
99
|
+
|
|
100
|
+
**Since `0.2.0-alpha.1047`** · migration · codemod available · also applies to
|
|
101
|
+
`@mittwald/flow-remote-react-components`
|
|
92
102
|
|
|
93
103
|
`Align` is now called `Combine`. The old name suggested a generic alignment tool
|
|
94
104
|
and clashed with the `align` property of `Flex`; the component actually gives
|
|
@@ -106,27 +116,26 @@ known combinations of components a fixed, correct arrangement.
|
|
|
106
116
|
`Align` (and the `flr-align` remote element) keeps working unchanged, logs a
|
|
107
117
|
deprecation warning at runtime, and will be removed in a future major version.
|
|
108
118
|
|
|
109
|
-
A codemod renames `Align` to `Combine` and `AlignProps` to `CombineProps`:
|
|
110
|
-
|
|
111
|
-
```shell
|
|
112
|
-
npx jscodeshift \
|
|
113
|
-
-t https://raw.githubusercontent.com/mittwald/flow/refs/heads/main/packages/codemods/src/transforms/flowAlphaAlignToCombine.ts \
|
|
114
|
-
--parser tsx \
|
|
115
|
-
src
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
Replace `src` with your sources folder.
|
|
119
|
-
|
|
120
119
|
The component tokens were renamed along with the component
|
|
121
120
|
(`--align--avatar-text--spacing` is now `--combine--avatar-text--spacing`), and
|
|
122
121
|
so were the CSS class names (`.flow--align` is now `.flow--combine`). Both are
|
|
123
122
|
internal and not covered by Semantic Versioning.
|
|
124
123
|
|
|
124
|
+
**Apply:** Rename `Align` to `Combine` and `AlignProps` to `CombineProps`, for
|
|
125
|
+
named, aliased and namespace imports from a Flow package.
|
|
126
|
+
|
|
127
|
+
```shell
|
|
128
|
+
npx @mittwald/flow-codemods@latest align-to-combine src
|
|
129
|
+
```
|
|
130
|
+
|
|
125
131
|
---
|
|
126
132
|
|
|
127
|
-
|
|
133
|
+
<a id="button-color-accent-to-success"></a>
|
|
134
|
+
|
|
135
|
+
## Button: color `accent` renamed to `success`
|
|
128
136
|
|
|
129
|
-
|
|
137
|
+
**Since `0.2.0-alpha.1046`** · migration · codemod available · also applies to
|
|
138
|
+
`@mittwald/flow-remote-react-components`
|
|
130
139
|
|
|
131
140
|
The button color `accent` is now called `success` — the name says what the color
|
|
132
141
|
means instead of how it looks.
|
|
@@ -138,16 +147,7 @@ means instead of how it looks.
|
|
|
138
147
|
|
|
139
148
|
`color="accent"` keeps working and logs a deprecation warning, but will be
|
|
140
149
|
removed in a future release. A codemod rewrites it on `Button` and
|
|
141
|
-
`SubmitButton
|
|
142
|
-
|
|
143
|
-
```shell
|
|
144
|
-
npx jscodeshift \
|
|
145
|
-
-t https://raw.githubusercontent.com/mittwald/flow/refs/heads/main/packages/codemods/src/transforms/flowAlphaButtonColorAccentToSuccess.ts \
|
|
146
|
-
--parser tsx \
|
|
147
|
-
src
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
Replace `src` with your sources folder.
|
|
150
|
+
`SubmitButton`.
|
|
151
151
|
|
|
152
152
|
The CSS class and the design tokens are renamed **without** a fallback — update
|
|
153
153
|
them by hand if you use `@mittwald/flow-stylesheet` or the token CSS variables
|
|
@@ -167,37 +167,63 @@ The same rename applies to every `--button--accent-{solid,plain,soft,outline}-*`
|
|
|
167
167
|
variable. `Chat`'s internal class `flow--chat--accent-button` became
|
|
168
168
|
`flow--chat--success-button`.
|
|
169
169
|
|
|
170
|
+
**Apply:** Rename `color="accent"` to `color="success"` on `Button` and
|
|
171
|
+
`SubmitButton`. Also update the CSS class `flow--button--accent` to
|
|
172
|
+
`flow--button--success` and every
|
|
173
|
+
`--button--accent-{solid,plain,soft,outline}-*` design token to its `success`
|
|
174
|
+
counterpart if you use `@mittwald/flow-stylesheet` or the token CSS variables
|
|
175
|
+
directly — those have no fallback.
|
|
176
|
+
|
|
177
|
+
```shell
|
|
178
|
+
npx @mittwald/flow-codemods@latest button-color-accent-to-success src
|
|
179
|
+
```
|
|
180
|
+
|
|
170
181
|
---
|
|
171
182
|
|
|
172
|
-
|
|
183
|
+
<a id="tooltip-trigger-delay-type"></a>
|
|
184
|
+
|
|
185
|
+
## TooltipTrigger changed delay type
|
|
173
186
|
|
|
174
|
-
|
|
187
|
+
**Since `0.2.0-alpha.1016`** · migration · manual change · also applies to
|
|
188
|
+
`@mittwald/flow-remote-react-components`
|
|
175
189
|
|
|
176
|
-
Numeric delay values are no longer accepted; only string literals
|
|
190
|
+
Numeric delay values are no longer accepted; only the string literals
|
|
191
|
+
`"default"` (400ms) and `"long"` (1500ms) are valid. Pick by what the element
|
|
192
|
+
needs, not by rounding the old number to the nearest preset — a former
|
|
193
|
+
`delay={500}` is closer to `"long"` numerically, but if the element is an
|
|
194
|
+
icon-only button that cannot be understood without the tooltip, `"default"` is
|
|
195
|
+
still the right choice.
|
|
177
196
|
|
|
178
197
|
```diff
|
|
179
198
|
- <TooltipTrigger delay={300} />
|
|
180
199
|
+ <TooltipTrigger delay="default" />
|
|
200
|
+
```
|
|
181
201
|
|
|
182
|
-
-
|
|
202
|
+
For an icon-only button that needs the tooltip to be understood.
|
|
203
|
+
|
|
204
|
+
```diff
|
|
205
|
+
- <TooltipTrigger delay={2000} />
|
|
183
206
|
+ <TooltipTrigger delay="long" />
|
|
184
207
|
```
|
|
185
208
|
|
|
186
|
-
|
|
209
|
+
For supplementary information on an element that is already labeled.
|
|
187
210
|
|
|
188
|
-
|
|
211
|
+
**Apply:** Replace every numeric `delay` value on `TooltipTrigger` with one of
|
|
212
|
+
the two string literals: `"default"` (400ms) or `"long"` (1500ms). Pick by
|
|
213
|
+
intent, not by which number is closer — `"default"` is for elements that cannot
|
|
214
|
+
be understood without the tooltip (icon-only buttons), `"long"` is for
|
|
215
|
+
supplementary information on elements that are already labeled. A previous
|
|
216
|
+
numeric value is not a reliable guide: `delay={500}` maps to `"default"`
|
|
217
|
+
(400ms), not `"long"` (1500ms), if the element still needs the tooltip to be
|
|
218
|
+
understood.
|
|
189
219
|
|
|
190
|
-
|
|
191
|
-
before it closes while the form is _dirty_ — previously this required the
|
|
192
|
-
`requireCloseModalConfirmationOnUnsavedChanges` flag. After a successful submit
|
|
193
|
-
or a `form.reset()` the modal closes right away, and actions in the
|
|
194
|
-
`<ActionGroup />` as well as the close button in the heading still close it
|
|
195
|
-
immediately.
|
|
220
|
+
---
|
|
196
221
|
|
|
197
|
-
|
|
198
|
-
|
|
222
|
+
<a id="flags-to-component-defaults-provider"></a>
|
|
223
|
+
|
|
224
|
+
## `flags` is replaced by the ComponentDefaultsProvider
|
|
199
225
|
|
|
200
|
-
|
|
226
|
+
**Since `0.2.0-alpha.1005`** · deprecation · manual change
|
|
201
227
|
|
|
202
228
|
The global `flags` object is deprecated. Application-wide defaults are defined
|
|
203
229
|
with the `<ComponentDefaultsProvider />` instead, which additionally works per
|
|
@@ -224,11 +250,75 @@ Assigning a flag keeps working — it acts as the application-wide default below
|
|
|
224
250
|
the provider and logs a deprecation warning — but the flags will be removed in a
|
|
225
251
|
future release.
|
|
226
252
|
|
|
253
|
+
**Apply:** Replace assignments to the global `flags` object with an equivalent
|
|
254
|
+
`<ComponentDefaultsProvider defaults={{ ... }} />` wrapping the app, or the
|
|
255
|
+
subtree the default should apply to.
|
|
256
|
+
|
|
227
257
|
---
|
|
228
258
|
|
|
229
|
-
|
|
259
|
+
<a id="modal-unsaved-changes-confirmation"></a>
|
|
260
|
+
|
|
261
|
+
## Closing a Modal with unsaved changes is confirmed by default
|
|
262
|
+
|
|
263
|
+
**Since `0.2.0-alpha.1005`** · migration · no code change needed · also applies
|
|
264
|
+
to `@mittwald/flow-remote-react-components`
|
|
265
|
+
|
|
266
|
+
A `Modal` that contains a react-hook-form `<Form>` now asks for confirmation
|
|
267
|
+
before it closes while the form is _dirty_ — previously this required the
|
|
268
|
+
`requireCloseModalConfirmationOnUnsavedChanges` flag. After a successful submit
|
|
269
|
+
or a `form.reset()` the modal closes right away, and actions in the
|
|
270
|
+
`<ActionGroup />` as well as the close button in the heading still close it
|
|
271
|
+
immediately.
|
|
230
272
|
|
|
231
|
-
|
|
273
|
+
Nothing to do if you had the flag enabled. To keep the previous behavior, switch
|
|
274
|
+
the default off (see below).
|
|
275
|
+
|
|
276
|
+
**Apply:** No code change required — if you had
|
|
277
|
+
`requireCloseModalConfirmationOnUnsavedChanges` enabled, the new default matches
|
|
278
|
+
it. To keep the previous behaviour (closing without confirmation), set
|
|
279
|
+
`Form: { confirmModalCloseOnUnsavedChanges: false }` via
|
|
280
|
+
`<ComponentDefaultsProvider />`, or its deprecated equivalent, the
|
|
281
|
+
`flags.requireCloseModalConfirmationOnUnsavedChanges = false` assignment.
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
<a id="password-tools-subpath-renamed"></a>
|
|
286
|
+
|
|
287
|
+
## `password-tools` entry renamed to `mittwald-password-tools-js`
|
|
288
|
+
|
|
289
|
+
**Since `0.2.0-alpha.1000`** · migration · codemod available
|
|
290
|
+
|
|
291
|
+
The subpath export carrying the `@mittwald/password-tools-js` integration is
|
|
292
|
+
called `@mittwald/flow-react-components/mittwald-password-tools-js`. Between
|
|
293
|
+
`0.2.0-alpha.913` and `0.2.0-alpha.999` it was called
|
|
294
|
+
`@mittwald/flow-react-components/password-tools`; `0.2.0-alpha.1000` reverted
|
|
295
|
+
that name.
|
|
296
|
+
|
|
297
|
+
```diff
|
|
298
|
+
- import { Rule } from "@mittwald/flow-react-components/password-tools";
|
|
299
|
+
+ import { Rule } from "@mittwald/flow-react-components/mittwald-password-tools-js";
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
Only code written against a version inside that window is affected. There is no
|
|
303
|
+
deprecation path and no fallback: a subpath export that no longer exists is a
|
|
304
|
+
hard `TS2307` ("Cannot find module") and fails the build.
|
|
305
|
+
|
|
306
|
+
**Apply:** Replace the import path
|
|
307
|
+
`@mittwald/flow-react-components/password-tools` with
|
|
308
|
+
`@mittwald/flow-react-components/mittwald-password-tools-js`.
|
|
309
|
+
|
|
310
|
+
```shell
|
|
311
|
+
npx @mittwald/flow-codemods@latest password-tools-subpath-renamed src
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
<a id="table-column-width-props"></a>
|
|
317
|
+
|
|
318
|
+
## TableColumn: `maxWidth` removed, `width` and `minWidth` retyped
|
|
319
|
+
|
|
320
|
+
**Since `0.2.0-alpha.956`** · migration · manual change · also applies to
|
|
321
|
+
`@mittwald/flow-remote-react-components`
|
|
232
322
|
|
|
233
323
|
`maxWidth` has been removed. `width` and `minWidth` are now typed as
|
|
234
324
|
`number | string`: they no longer accept `null`, and the previous
|
|
@@ -244,32 +334,33 @@ Percentage, pixel and `fr` values keep working as strings or numbers
|
|
|
244
334
|
(`width="50%"`, `width="200fr"`, `width={300}`). Where you passed `null` to mean
|
|
245
335
|
"no explicit width", omit the prop instead.
|
|
246
336
|
|
|
337
|
+
**Apply:** Remove `maxWidth` from every `TableColumn`. Where `width` or
|
|
338
|
+
`minWidth` was `null`, omit the prop instead — the type no longer accepts
|
|
339
|
+
`null`, only `number | string`.
|
|
340
|
+
|
|
247
341
|
---
|
|
248
342
|
|
|
249
|
-
|
|
343
|
+
<a id="table-render-prop-removed"></a>
|
|
344
|
+
|
|
345
|
+
## Table: `render` prop removed
|
|
250
346
|
|
|
251
|
-
|
|
347
|
+
**Since `0.2.0-alpha.866`** · migration · manual change · also applies to
|
|
348
|
+
`@mittwald/flow-remote-react-components`
|
|
252
349
|
|
|
253
350
|
The `render` escape hatch on `Table` has been removed. Compose the table from
|
|
254
351
|
`TableHeader`, `TableColumn`, `TableBody`, `TableRow` and `TableCell` instead.
|
|
255
352
|
|
|
256
|
-
|
|
353
|
+
**Apply:** Replace the `render` escape hatch on `Table` with a composition of
|
|
354
|
+
`TableHeader`, `TableColumn`, `TableBody`, `TableRow` and `TableCell`.
|
|
257
355
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
### TableCell: `render` prop removed
|
|
356
|
+
---
|
|
261
357
|
|
|
262
|
-
|
|
263
|
-
content as children instead.
|
|
358
|
+
<a id="color-primary-to-default"></a>
|
|
264
359
|
|
|
265
|
-
|
|
266
|
-
- <TableCell render={(cell) => <CustomCell {...cell} />} />
|
|
267
|
-
+ <TableCell>
|
|
268
|
-
+ <CustomCell />
|
|
269
|
-
+ </TableCell>
|
|
270
|
-
```
|
|
360
|
+
## Breadcrumb, HeaderNavigation, Heading, IllustratedMessage, and Link: color property "primary" renamed to "default"
|
|
271
361
|
|
|
272
|
-
|
|
362
|
+
**Since `0.2.0-alpha.846`** · migration · codemod available · also applies to
|
|
363
|
+
`@mittwald/flow-remote-react-components`
|
|
273
364
|
|
|
274
365
|
The `color="primary"` property has been renamed to `color="default"`.
|
|
275
366
|
|
|
@@ -280,22 +371,45 @@ The `color="primary"` property has been renamed to `color="default"`.
|
|
|
280
371
|
|
|
281
372
|
A codemod rewrites `color="primary"` to `color="default"` on these five
|
|
282
373
|
components (and leaves other components such as `Button`, where `"primary"` is
|
|
283
|
-
still valid, untouched)
|
|
374
|
+
still valid, untouched).
|
|
375
|
+
|
|
376
|
+
**Apply:** Rewrite `color="primary"` to `color="default"` on `Breadcrumb`,
|
|
377
|
+
`HeaderNavigation`, `Heading`, `IllustratedMessage`, and `Link` only — leave
|
|
378
|
+
`Button` (and any other component where `"primary"` is still valid) untouched.
|
|
284
379
|
|
|
285
380
|
```shell
|
|
286
|
-
npx
|
|
287
|
-
-t https://raw.githubusercontent.com/mittwald/flow/refs/heads/main/packages/codemods/src/transforms/flowAlphaColorPrimaryToDefault.ts \
|
|
288
|
-
--parser tsx \
|
|
289
|
-
src
|
|
381
|
+
npx @mittwald/flow-codemods@latest color-primary-to-default src
|
|
290
382
|
```
|
|
291
383
|
|
|
292
|
-
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
<a id="table-cell-render-prop-removed"></a>
|
|
387
|
+
|
|
388
|
+
## TableCell: `render` prop removed
|
|
389
|
+
|
|
390
|
+
**Since `0.2.0-alpha.846`** · migration · manual change · also applies to
|
|
391
|
+
`@mittwald/flow-remote-react-components`
|
|
392
|
+
|
|
393
|
+
The `render` escape hatch on `TableCell` has been removed. Provide the cell
|
|
394
|
+
content as children instead.
|
|
395
|
+
|
|
396
|
+
```diff
|
|
397
|
+
- <TableCell render={(cell) => <CustomCell {...cell} />} />
|
|
398
|
+
+ <TableCell>
|
|
399
|
+
+ <CustomCell />
|
|
400
|
+
+ </TableCell>
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
**Apply:** Provide the cell content as children of `TableCell` instead of a
|
|
404
|
+
`render` function.
|
|
293
405
|
|
|
294
406
|
---
|
|
295
407
|
|
|
296
|
-
|
|
408
|
+
<a id="password-tools-rule"></a>
|
|
297
409
|
|
|
298
|
-
|
|
410
|
+
## password-tools: `AsyncRule` and `SyncRule` replaced by `Rule`
|
|
411
|
+
|
|
412
|
+
**Since `0.2.0-alpha.802`** · migration · codemod available
|
|
299
413
|
|
|
300
414
|
The `@mittwald/flow-react-components/mittwald-password-tools-js` entry no longer
|
|
301
415
|
exports `AsyncRule` and `SyncRule`. The underlying `@mittwald/password-tools-js`
|
|
@@ -309,11 +423,71 @@ merged both into a single abstract `Rule`.
|
|
|
309
423
|
A custom rule extends `Rule` and may return its result synchronously or as a
|
|
310
424
|
promise — the distinction the two classes used to encode is gone.
|
|
311
425
|
|
|
426
|
+
A codemod replaces both names. A file that imported both — or one of them next
|
|
427
|
+
to `Rule` — ends up with a single import.
|
|
428
|
+
|
|
429
|
+
**Apply:** Replace `AsyncRule` and `SyncRule` imports from
|
|
430
|
+
`@mittwald/flow-react-components/mittwald-password-tools-js` with `Rule`. Update
|
|
431
|
+
custom rule classes to extend `Rule` instead.
|
|
432
|
+
|
|
433
|
+
```shell
|
|
434
|
+
npx @mittwald/flow-codemods@latest password-tools-rule src
|
|
435
|
+
```
|
|
436
|
+
|
|
312
437
|
---
|
|
313
438
|
|
|
314
|
-
|
|
439
|
+
<a id="accent-box-color-to-background-color"></a>
|
|
440
|
+
|
|
441
|
+
## AccentBox.color is now a declaration for foreground
|
|
442
|
+
|
|
443
|
+
**Since `0.2.0-alpha.786`** · migration · codemod available · also applies to
|
|
444
|
+
`@mittwald/flow-remote-react-components`
|
|
445
|
+
|
|
446
|
+
The `color` property now controls foreground colors. Use the `backgroundColor`
|
|
447
|
+
property to set the background color instead.
|
|
448
|
+
|
|
449
|
+
```diff
|
|
450
|
+
- <AccentBox color="gradient">
|
|
451
|
+
+ <AccentBox backgroundColor="gradient" />
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
`color` did not go away, it changed meaning — so this is not a rename. It used
|
|
455
|
+
to accept `"blue" | "green" | "gradient" | "neutral"` and now accepts
|
|
456
|
+
`"default" | "dark" | "light" | "dark-static" | "light-static"`.
|
|
457
|
+
|
|
458
|
+
A codemod decides per value: a value from the new foreground union stays on
|
|
459
|
+
`color`, every other literal moves to `backgroundColor`. Two cases stay
|
|
460
|
+
untouched, because neither can be decided from the value alone — check them by
|
|
461
|
+
hand:
|
|
315
462
|
|
|
316
|
-
|
|
463
|
+
- `color={expression}`, where the same expression means the background in old
|
|
464
|
+
code and the foreground in new code.
|
|
465
|
+
- An element that already carries `backgroundColor`, where moving `color` there
|
|
466
|
+
would overwrite the explicit value.
|
|
467
|
+
|
|
468
|
+
One value changes what you see: the runtime fallback maps `"neutral"`,
|
|
469
|
+
`"gradient"` and `"green"` onto the background, but not `"blue"`, so
|
|
470
|
+
`<AccentBox color="blue">` currently renders the neutral background. The codemod
|
|
471
|
+
turns it into `backgroundColor="blue"`, which restores the blue one.
|
|
472
|
+
|
|
473
|
+
**Apply:** Move every `color` value that is not one of
|
|
474
|
+
`"default" | "dark" | "light" | "dark-static" | "light-static"` to
|
|
475
|
+
`backgroundColor` instead. Review `color={expression}` and any element that
|
|
476
|
+
already has `backgroundColor` by hand — neither can be decided from the value
|
|
477
|
+
alone.
|
|
478
|
+
|
|
479
|
+
```shell
|
|
480
|
+
npx @mittwald/flow-codemods@latest accent-box-color-to-background-color src
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
---
|
|
484
|
+
|
|
485
|
+
<a id="cartesian-chart-restructured"></a>
|
|
486
|
+
|
|
487
|
+
## CartesianChart
|
|
488
|
+
|
|
489
|
+
**Since `0.2.0-alpha.780`** · migration · manual change · also applies to
|
|
490
|
+
`@mittwald/flow-remote-react-components`
|
|
317
491
|
|
|
318
492
|
> If you're using a _Function_ in the `dataKey` - you need to define a
|
|
319
493
|
> `dataKeyLabel` as well.
|
|
@@ -403,25 +577,20 @@ const ExampleChart = typedCartesianChart<ChartData>();
|
|
|
403
577
|
</ExampleChart.Chart>
|
|
404
578
|
```
|
|
405
579
|
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
The `color` property now controls foreground colors. Use the `backgroundColor`
|
|
413
|
-
property to set the background color instead.
|
|
414
|
-
|
|
415
|
-
```diff
|
|
416
|
-
- <AccentBox color="gradient">
|
|
417
|
-
+ <AccentBox backgroundColor="gradient" />
|
|
418
|
-
```
|
|
580
|
+
**Apply:** Add `dataKeyLabel` wherever a `dataKey` is a function — a string
|
|
581
|
+
`dataKey` already sets it automatically. Where a `tickFormatter` or other
|
|
582
|
+
callback relied on the argument being `any`, add an explicit type check (for
|
|
583
|
+
example `instanceof Date`), or switch to `typedCartesianChart<T>()` for a chart
|
|
584
|
+
whose callbacks are typed from your own data shape.
|
|
419
585
|
|
|
420
586
|
---
|
|
421
587
|
|
|
422
|
-
|
|
588
|
+
<a id="code-block-syntax-highlighter-removed"></a>
|
|
423
589
|
|
|
424
|
-
|
|
590
|
+
## Removed the underlying react-syntax-highlighter library from CodeBlock
|
|
591
|
+
|
|
592
|
+
**Since `0.2.0-alpha.756`** · migration · manual change · also applies to
|
|
593
|
+
`@mittwald/flow-remote-react-components`
|
|
425
594
|
|
|
426
595
|
We've replaced the `react-syntax-highlighter` library, which means many
|
|
427
596
|
properties have been removed and the remaining ones have been simplified. See
|
|
@@ -429,11 +598,17 @@ the
|
|
|
429
598
|
[CodeBlock documentation](https://flow.mittwald.de/04-components/content/code-block/overview)
|
|
430
599
|
for details on what's now supported.
|
|
431
600
|
|
|
601
|
+
**Apply:** Check every `CodeBlock` usage against the current props (see the
|
|
602
|
+
[CodeBlock documentation](https://flow.mittwald.de/04-components/content/code-block/overview))
|
|
603
|
+
and remove or replace props the new implementation does not support.
|
|
604
|
+
|
|
432
605
|
---
|
|
433
606
|
|
|
434
|
-
|
|
607
|
+
<a id="muted-action-error-to-abort-action-error"></a>
|
|
608
|
+
|
|
609
|
+
## `MutedActionError` renamed to `AbortActionError`
|
|
435
610
|
|
|
436
|
-
|
|
611
|
+
**Since `0.2.0-alpha.712`** · migration · codemod available
|
|
437
612
|
|
|
438
613
|
The error that aborts an `Action` without reporting a failure is now called
|
|
439
614
|
`AbortActionError`. Its static helpers were renamed along with it.
|
|
@@ -456,11 +631,46 @@ There is no alias for the old name. The thrown error's `name` changed from
|
|
|
456
631
|
`"MutedActionError"` to `"AbortActionError"` as well — update any code that
|
|
457
632
|
matches on it.
|
|
458
633
|
|
|
634
|
+
A codemod renames the class and both static helpers. It also rewrites an
|
|
635
|
+
`error.name === "MutedActionError"` comparison, but only in a file that imports
|
|
636
|
+
the class — a check living anywhere else cannot be recognised, so grep for the
|
|
637
|
+
string once when you are done.
|
|
638
|
+
|
|
639
|
+
**Apply:** Rename `MutedActionError` to `AbortActionError`, `isMutedActionError`
|
|
640
|
+
to `isAbortActionError`, and `rethrowIfNotMuted` to `rethrowIfNotAborted`.
|
|
641
|
+
Update any `error.name === "MutedActionError"` comparison to
|
|
642
|
+
`"AbortActionError"`.
|
|
643
|
+
|
|
644
|
+
```shell
|
|
645
|
+
npx @mittwald/flow-codemods@latest muted-action-error-to-abort-action-error src
|
|
646
|
+
```
|
|
647
|
+
|
|
648
|
+
---
|
|
649
|
+
|
|
650
|
+
<a id="overlay-controller-add-on-close-return-type"></a>
|
|
651
|
+
|
|
652
|
+
## OverlayController.addOnClose / addOnOpen return type changed
|
|
653
|
+
|
|
654
|
+
**Since `0.2.0-alpha.696`** · migration · manual change · also applies to
|
|
655
|
+
`@mittwald/flow-remote-react-components`
|
|
656
|
+
|
|
657
|
+
The return type changed from `() => void` to `() => unknown`
|
|
658
|
+
|
|
659
|
+
**Apply:** No type change needed: the return type widened from `() => void` to
|
|
660
|
+
`() => unknown`, and a `() => void` callback stays assignable. Instead, check
|
|
661
|
+
every callback passed to `addOnClose`/`addOnOpen` for one that can return
|
|
662
|
+
`false` — for example an arrow function whose body is an expression evaluating
|
|
663
|
+
to `false`. `executeHandlers` now treats any handler returning `false` as a veto
|
|
664
|
+
and cancels the close/open. A callback that returned `false` incidentally, with
|
|
665
|
+
no intent to block anything, now silently cancels closes.
|
|
666
|
+
|
|
459
667
|
---
|
|
460
668
|
|
|
461
|
-
|
|
669
|
+
<a id="form-resets-after-modal-close"></a>
|
|
670
|
+
|
|
671
|
+
## Form: resets itself after the surrounding modal closes
|
|
462
672
|
|
|
463
|
-
|
|
673
|
+
**Since `0.2.0-alpha.694`** · migration · no code change needed
|
|
464
674
|
|
|
465
675
|
A react-hook-form `<Form>` inside a `Modal` now resets to its default values
|
|
466
676
|
once the modal has closed. Previously it kept what the user had entered, so
|
|
@@ -476,19 +686,18 @@ Opt out per form with the new `autoReset` prop:
|
|
|
476
686
|
`autoReset` also takes an object (`autoReset={{ onAfterModalClose: false }}`) so
|
|
477
687
|
further reset triggers can be added without another prop.
|
|
478
688
|
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
### OverlayController.addOnClose / addOnOpen return type changed
|
|
484
|
-
|
|
485
|
-
The return type changed from `() => void` to `() => unknown`
|
|
689
|
+
**Apply:** No code change required. To keep the previous behaviour (the form
|
|
690
|
+
keeping what the user entered), pass `autoReset={false}` (or
|
|
691
|
+
`autoReset={{ onAfterModalClose: false }}`) to `Form`.
|
|
486
692
|
|
|
487
693
|
---
|
|
488
694
|
|
|
489
|
-
|
|
695
|
+
<a id="cartesian-chart-empty-view"></a>
|
|
696
|
+
|
|
697
|
+
## CartesianChart.emptyView changed
|
|
490
698
|
|
|
491
|
-
|
|
699
|
+
**Since `0.2.0-alpha.676`** · migration · manual change · also applies to
|
|
700
|
+
`@mittwald/flow-remote-react-components`
|
|
492
701
|
|
|
493
702
|
Component references are no longer accepted for `emptyView` - must be a rendered
|
|
494
703
|
element now.
|
|
@@ -498,11 +707,17 @@ element now.
|
|
|
498
707
|
+ <CartesianChart emptyView={<EmptyState />} />
|
|
499
708
|
```
|
|
500
709
|
|
|
710
|
+
**Apply:** Wrap the `emptyView` value in JSX — `emptyView={<EmptyState />}`
|
|
711
|
+
instead of `emptyView={EmptyState}`.
|
|
712
|
+
|
|
501
713
|
---
|
|
502
714
|
|
|
503
|
-
|
|
715
|
+
<a id="action-prop-to-on-action"></a>
|
|
716
|
+
|
|
717
|
+
## Action: `action` renamed to `onAction`
|
|
504
718
|
|
|
505
|
-
|
|
719
|
+
**Since `0.2.0-alpha.646`** · migration · codemod available · also applies to
|
|
720
|
+
`@mittwald/flow-remote-react-components`
|
|
506
721
|
|
|
507
722
|
`Action`'s `action` prop is now called `onAction`, which matches the naming of
|
|
508
723
|
every other event prop in Flow.
|
|
@@ -519,32 +734,61 @@ prop. At runtime the old prop still works: `Action` maps it to `onAction` and
|
|
|
519
734
|
logs a deprecation warning, and an explicit `onAction` wins. The fallback will
|
|
520
735
|
be removed in a future major version.
|
|
521
736
|
|
|
522
|
-
A codemod renames the prop on `Action
|
|
737
|
+
A codemod renames the prop on `Action`.
|
|
738
|
+
|
|
739
|
+
**Apply:** Rename the `action` prop on `Action` to `onAction`.
|
|
523
740
|
|
|
524
741
|
```shell
|
|
525
|
-
npx
|
|
526
|
-
-t https://raw.githubusercontent.com/mittwald/flow/refs/heads/main/packages/codemods/src/transforms/flowAlphaActionPropToOnAction.ts \
|
|
527
|
-
--parser tsx \
|
|
528
|
-
src
|
|
742
|
+
npx @mittwald/flow-codemods@latest action-prop-to-on-action src
|
|
529
743
|
```
|
|
530
744
|
|
|
531
|
-
|
|
745
|
+
---
|
|
746
|
+
|
|
747
|
+
<a id="button-props-interfaces"></a>
|
|
748
|
+
|
|
749
|
+
## Removed ResetButton and SubmitButton Interfaces
|
|
532
750
|
|
|
533
|
-
|
|
751
|
+
**Since `0.2.0-alpha.646`** · migration · codemod available
|
|
534
752
|
|
|
535
753
|
The `RemoteButtonElementProps`, `ResetButtonProps`, and `SubmitButtonProps`
|
|
536
754
|
interfaces have been removed. Use `ButtonProps` instead.
|
|
537
755
|
|
|
756
|
+
```diff
|
|
757
|
+
- import type { SubmitButtonProps } from "@mittwald/flow-react-components/react-hook-form";
|
|
758
|
+
+ import type { ButtonProps } from "@mittwald/flow-react-components";
|
|
759
|
+
```
|
|
760
|
+
|
|
761
|
+
Note the entry: `ButtonProps` lives in the package root, while the removed names
|
|
762
|
+
came from `react-hook-form`. A codemod moves the import along with the name. It
|
|
763
|
+
covers `@mittwald/flow-react-components` only.
|
|
764
|
+
`@mittwald/flow-remote-react-components` does not export `ButtonProps`, so there
|
|
765
|
+
is nothing to move a remote import onto — pick your own source for the type
|
|
766
|
+
there. `RemoteButtonElementProps` is left alone as well:
|
|
767
|
+
`@mittwald/flow-remote-elements` still exports that name.
|
|
768
|
+
|
|
769
|
+
**Apply:** Replace `ResetButtonProps`/`SubmitButtonProps` imports from
|
|
770
|
+
`@mittwald/flow-react-components/react-hook-form` with `ButtonProps` from the
|
|
771
|
+
package root. Leave `RemoteButtonElementProps` (from
|
|
772
|
+
`@mittwald/flow-remote-elements`) alone.
|
|
773
|
+
|
|
774
|
+
```shell
|
|
775
|
+
npx @mittwald/flow-codemods@latest button-props-interfaces src
|
|
776
|
+
```
|
|
777
|
+
|
|
538
778
|
---
|
|
539
779
|
|
|
540
|
-
|
|
780
|
+
<a id="imports-to-package-root"></a>
|
|
781
|
+
|
|
782
|
+
## Subpath imports moved to the package root
|
|
783
|
+
|
|
784
|
+
**Since `0.2.0-alpha.28`** · migration · codemod available
|
|
541
785
|
|
|
542
786
|
With the latest update to `@mittwald/flow-react-components`, the way package
|
|
543
787
|
exports are handled has changed. You no longer need to specify subdirectories
|
|
544
788
|
explicitly when importing components and utilities. Instead, imports are now
|
|
545
789
|
structured in a more streamlined way.
|
|
546
790
|
|
|
547
|
-
|
|
791
|
+
### Changes in Imports
|
|
548
792
|
|
|
549
793
|
Previously, you had to import components and utilities from specific
|
|
550
794
|
subdirectories, like this:
|
|
@@ -565,28 +809,14 @@ import { Field } from "@mittwald/flow-react-components/react-hook-form";
|
|
|
565
809
|
import { Link } from "@mittwald/flow-react-components/nextjs";
|
|
566
810
|
```
|
|
567
811
|
|
|
568
|
-
|
|
812
|
+
### `tsconfig.json`
|
|
569
813
|
|
|
570
814
|
Set `"module": "esnext"` in your `tsconfig.json`, if you have trouble with
|
|
571
815
|
missing module exports.
|
|
572
816
|
|
|
573
|
-
|
|
817
|
+
### Migration Steps
|
|
574
818
|
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
```shell
|
|
578
|
-
npx jscodeshift \
|
|
579
|
-
-t https://raw.githubusercontent.com/mittwald/flow/refs/heads/main/packages/codemods/src/transforms/flow020.ts \
|
|
580
|
-
--parser tsx \
|
|
581
|
-
src
|
|
582
|
-
```
|
|
583
|
-
|
|
584
|
-
Replace `src` with your sources folder. If you do not use TypeScript in your
|
|
585
|
-
project, use `--parser jsx`.
|
|
586
|
-
|
|
587
|
-
See the [docs of jscodeshift](https://jscodeshift.com/run/cli/)
|
|
588
|
-
|
|
589
|
-
### Do it manually
|
|
819
|
+
#### Do it manually
|
|
590
820
|
|
|
591
821
|
1. **Update all import statements** in your project according to the new
|
|
592
822
|
structure.
|
|
@@ -595,16 +825,28 @@ See the [docs of jscodeshift](https://jscodeshift.com/run/cli/)
|
|
|
595
825
|
4. **Run your test suite** to ensure no regressions were introduced by the
|
|
596
826
|
migration.
|
|
597
827
|
|
|
598
|
-
|
|
828
|
+
This change shipped in `0.2.0-alpha.28`: `0.2.0-alpha.27` still published one
|
|
829
|
+
export entry per component, `alpha.28` published the flat set. Neither `0.1.0`
|
|
830
|
+
nor `0.2.0` was ever released as a stable version — both are alpha-only lines,
|
|
831
|
+
and the first stable release of Flow is `1.0.0`.
|
|
599
832
|
|
|
600
|
-
|
|
601
|
-
-
|
|
602
|
-
|
|
603
|
-
-
|
|
833
|
+
**Apply:** Rewrite every subdirectory import from
|
|
834
|
+
`@mittwald/flow-react-components` to the package root, except `react-hook-form`
|
|
835
|
+
and `nextjs`, which move to `@mittwald/flow-react-components/react-hook-form`
|
|
836
|
+
and `@mittwald/flow-react-components/nextjs`. If you hit missing module errors,
|
|
837
|
+
set `"module": "esnext"` in `tsconfig.json`.
|
|
604
838
|
|
|
605
|
-
|
|
839
|
+
```shell
|
|
840
|
+
npx @mittwald/flow-codemods@latest imports-to-package-root src
|
|
841
|
+
```
|
|
606
842
|
|
|
607
|
-
|
|
843
|
+
---
|
|
844
|
+
|
|
845
|
+
<a id="renamed-css-export"></a>
|
|
846
|
+
|
|
847
|
+
## Renamed CSS export
|
|
848
|
+
|
|
849
|
+
**Since `0.1.0-alpha.292`** · migration · manual change
|
|
608
850
|
|
|
609
851
|
The CSS export `@mittwald/flow-react-components/styles` has renamed to the more
|
|
610
852
|
precise name `@mittwald/flow-react-components/all.css`, because the file
|
|
@@ -616,3 +858,6 @@ as well. A documentation on how to use them is planned.
|
|
|
616
858
|
- import "@mittwald/flow-react-components/styles";
|
|
617
859
|
+ import "@mittwald/flow-react-components/all.css";
|
|
618
860
|
```
|
|
861
|
+
|
|
862
|
+
**Apply:** Replace the import `@mittwald/flow-react-components/styles` with
|
|
863
|
+
`@mittwald/flow-react-components/all.css`.
|