@mittwald/flow-react-components 1.1.0-next.9 → 1.1.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.
- package/MIGRATION.md +429 -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/dist/js/packages/components/src/lib/theming/hooks/useDesignTokens.mjs +2 -2
- package/dist/js/packages/components/src/lib/theming/hooks/useDesignTokens.mjs.map +1 -1
- package/dist/js/packages/components/src/lib/tokens/CategoricalColors.mjs +1 -1
- package/dist/js/packages/components/src/lib/tokens/CategoricalColors.mjs.map +1 -1
- package/dist/js/packages/design-tokens/dist/json-runtime/all-dark.mjs +5789 -0
- package/dist/js/packages/design-tokens/dist/json-runtime/all-dark.mjs.map +1 -0
- package/dist/js/packages/design-tokens/dist/json-runtime/all-light.mjs +5789 -0
- package/dist/js/packages/design-tokens/dist/json-runtime/all-light.mjs.map +1 -0
- package/dist/types/lib/theming/hooks/useDesignTokens.d.ts +526 -19583
- package/dist/types/lib/theming/hooks/useDesignTokens.d.ts.map +1 -1
- package/dist/types/lib/theming/types.d.ts +1 -1
- package/dist/types/lib/theming/types.d.ts.map +1 -1
- package/dist/types/lib/tokens/CategoricalColors.d.ts +1 -1
- package/dist/types/lib/tokens/CategoricalColors.d.ts.map +1 -1
- package/package.json +9 -9
- package/dist/js/packages/design-tokens/dist/json/all-dark.mjs +0 -17519
- package/dist/js/packages/design-tokens/dist/json/all-dark.mjs.map +0 -1
- package/dist/js/packages/design-tokens/dist/json/all-light.mjs +0 -17519
- package/dist/js/packages/design-tokens/dist/json/all-light.mjs.map +0 -1
package/MIGRATION.md
CHANGED
|
@@ -1,31 +1,74 @@
|
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
npx @mittwald/flow-codemods@latest upgrade
|
|
14
|
+
```
|
|
15
|
+
|
|
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.
|
|
20
|
+
|
|
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
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
<a id="use-design-tokens-build-metadata-removed"></a>
|
|
27
|
+
|
|
28
|
+
## useDesignTokens(): no longer returns style-dictionary build metadata
|
|
29
|
+
|
|
30
|
+
**Since `1.0.16`** · migration · manual change
|
|
31
|
+
|
|
32
|
+
The hook imported the design tokens' full style-dictionary output, which carries
|
|
33
|
+
`filePath`, `isSource`, `original`, `name`, `attributes` and `key` on every one
|
|
34
|
+
of the 1538 tokens. That metadata is 94 % of the payload and meant nothing in a
|
|
35
|
+
browser — it put 1.37 MB of JavaScript into every bundle that touched the
|
|
36
|
+
package. The hook now reads a runtime build of the same tokens.
|
|
37
|
+
|
|
38
|
+
Every token keeps `value` and `path`, unchanged and with identical values, so
|
|
39
|
+
the common access patterns are untouched:
|
|
40
|
+
|
|
41
|
+
```tsx
|
|
42
|
+
const tokens = useDesignTokens();
|
|
43
|
+
tokens["loading-spinner"]["transition-duration"].value; // still works
|
|
44
|
+
tokens.axis.color.path; // still works
|
|
14
45
|
```
|
|
15
46
|
|
|
16
|
-
|
|
17
|
-
|
|
47
|
+
Only the build metadata is gone. If you read one of those fields, take it from
|
|
48
|
+
`@mittwald/flow-design-tokens/json/all-light.json` (or `all-dark.json`) directly
|
|
49
|
+
— that artifact is unchanged. Do not import it into browser code; it is the
|
|
50
|
+
reason this change exists.
|
|
18
51
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
52
|
+
```diff
|
|
53
|
+
- const source = useDesignTokens().button["corner-radius"].filePath;
|
|
54
|
+
+ import tokens from "@mittwald/flow-design-tokens/json/all-light.json";
|
|
55
|
+
+ const source = tokens.button["corner-radius"].filePath;
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Apply:** Only affects code reading `filePath`, `isSource`, `original`, `name`,
|
|
59
|
+
`attributes` or `key` off a token returned by `useDesignTokens()`. Those fields
|
|
60
|
+
are gone; read them from `@mittwald/flow-design-tokens/json/all-light.json` (or
|
|
61
|
+
`all-dark.json`) instead, and never from browser code. `value` and `path` are
|
|
62
|
+
unchanged — code using only those needs no change.
|
|
23
63
|
|
|
24
64
|
---
|
|
25
65
|
|
|
26
|
-
|
|
66
|
+
<a id="segmented-control-deprecated"></a>
|
|
67
|
+
|
|
68
|
+
## SegmentedControl deprecated
|
|
27
69
|
|
|
28
|
-
|
|
70
|
+
**Since `0.2.0-alpha.1056`** · deprecation · manual change · also applies to
|
|
71
|
+
`@mittwald/flow-remote-react-components`
|
|
29
72
|
|
|
30
73
|
`SegmentedControl` and `Segment` are deprecated. The component covered two
|
|
31
74
|
different jobs, and each already has its own component in Flow. Which
|
|
@@ -84,11 +127,18 @@ The `containerBreakpointSize` property has no counterpart: `Tabs` collapse on
|
|
|
84
127
|
their own when the available width runs out, and a `RadioGroup` stacks its
|
|
85
128
|
options anyway.
|
|
86
129
|
|
|
130
|
+
**Apply:** Replace `SegmentedControl` with `Tabs` when the selection switches
|
|
131
|
+
displayed content, or with `RadioGroup` when it sets a value. Pick per usage —
|
|
132
|
+
this is a structural change, not a rename.
|
|
133
|
+
|
|
87
134
|
---
|
|
88
135
|
|
|
89
|
-
|
|
136
|
+
<a id="align-to-combine"></a>
|
|
137
|
+
|
|
138
|
+
## Align renamed to Combine
|
|
90
139
|
|
|
91
|
-
|
|
140
|
+
**Since `0.2.0-alpha.1047`** · migration · codemod available · also applies to
|
|
141
|
+
`@mittwald/flow-remote-react-components`
|
|
92
142
|
|
|
93
143
|
`Align` is now called `Combine`. The old name suggested a generic alignment tool
|
|
94
144
|
and clashed with the `align` property of `Flex`; the component actually gives
|
|
@@ -106,27 +156,26 @@ known combinations of components a fixed, correct arrangement.
|
|
|
106
156
|
`Align` (and the `flr-align` remote element) keeps working unchanged, logs a
|
|
107
157
|
deprecation warning at runtime, and will be removed in a future major version.
|
|
108
158
|
|
|
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
159
|
The component tokens were renamed along with the component
|
|
121
160
|
(`--align--avatar-text--spacing` is now `--combine--avatar-text--spacing`), and
|
|
122
161
|
so were the CSS class names (`.flow--align` is now `.flow--combine`). Both are
|
|
123
162
|
internal and not covered by Semantic Versioning.
|
|
124
163
|
|
|
164
|
+
**Apply:** Rename `Align` to `Combine` and `AlignProps` to `CombineProps`, for
|
|
165
|
+
named, aliased and namespace imports from a Flow package.
|
|
166
|
+
|
|
167
|
+
```shell
|
|
168
|
+
npx @mittwald/flow-codemods@latest align-to-combine src
|
|
169
|
+
```
|
|
170
|
+
|
|
125
171
|
---
|
|
126
172
|
|
|
127
|
-
|
|
173
|
+
<a id="button-color-accent-to-success"></a>
|
|
128
174
|
|
|
129
|
-
|
|
175
|
+
## Button: color `accent` renamed to `success`
|
|
176
|
+
|
|
177
|
+
**Since `0.2.0-alpha.1046`** · migration · codemod available · also applies to
|
|
178
|
+
`@mittwald/flow-remote-react-components`
|
|
130
179
|
|
|
131
180
|
The button color `accent` is now called `success` — the name says what the color
|
|
132
181
|
means instead of how it looks.
|
|
@@ -138,16 +187,7 @@ means instead of how it looks.
|
|
|
138
187
|
|
|
139
188
|
`color="accent"` keeps working and logs a deprecation warning, but will be
|
|
140
189
|
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.
|
|
190
|
+
`SubmitButton`.
|
|
151
191
|
|
|
152
192
|
The CSS class and the design tokens are renamed **without** a fallback — update
|
|
153
193
|
them by hand if you use `@mittwald/flow-stylesheet` or the token CSS variables
|
|
@@ -167,37 +207,63 @@ The same rename applies to every `--button--accent-{solid,plain,soft,outline}-*`
|
|
|
167
207
|
variable. `Chat`'s internal class `flow--chat--accent-button` became
|
|
168
208
|
`flow--chat--success-button`.
|
|
169
209
|
|
|
210
|
+
**Apply:** Rename `color="accent"` to `color="success"` on `Button` and
|
|
211
|
+
`SubmitButton`. Also update the CSS class `flow--button--accent` to
|
|
212
|
+
`flow--button--success` and every
|
|
213
|
+
`--button--accent-{solid,plain,soft,outline}-*` design token to its `success`
|
|
214
|
+
counterpart if you use `@mittwald/flow-stylesheet` or the token CSS variables
|
|
215
|
+
directly — those have no fallback.
|
|
216
|
+
|
|
217
|
+
```shell
|
|
218
|
+
npx @mittwald/flow-codemods@latest button-color-accent-to-success src
|
|
219
|
+
```
|
|
220
|
+
|
|
170
221
|
---
|
|
171
222
|
|
|
172
|
-
|
|
223
|
+
<a id="tooltip-trigger-delay-type"></a>
|
|
224
|
+
|
|
225
|
+
## TooltipTrigger changed delay type
|
|
173
226
|
|
|
174
|
-
|
|
227
|
+
**Since `0.2.0-alpha.1016`** · migration · manual change · also applies to
|
|
228
|
+
`@mittwald/flow-remote-react-components`
|
|
175
229
|
|
|
176
|
-
Numeric delay values are no longer accepted; only string literals
|
|
230
|
+
Numeric delay values are no longer accepted; only the string literals
|
|
231
|
+
`"default"` (400ms) and `"long"` (1500ms) are valid. Pick by what the element
|
|
232
|
+
needs, not by rounding the old number to the nearest preset — a former
|
|
233
|
+
`delay={500}` is closer to `"long"` numerically, but if the element is an
|
|
234
|
+
icon-only button that cannot be understood without the tooltip, `"default"` is
|
|
235
|
+
still the right choice.
|
|
177
236
|
|
|
178
237
|
```diff
|
|
179
238
|
- <TooltipTrigger delay={300} />
|
|
180
239
|
+ <TooltipTrigger delay="default" />
|
|
240
|
+
```
|
|
181
241
|
|
|
182
|
-
-
|
|
242
|
+
For an icon-only button that needs the tooltip to be understood.
|
|
243
|
+
|
|
244
|
+
```diff
|
|
245
|
+
- <TooltipTrigger delay={2000} />
|
|
183
246
|
+ <TooltipTrigger delay="long" />
|
|
184
247
|
```
|
|
185
248
|
|
|
186
|
-
|
|
249
|
+
For supplementary information on an element that is already labeled.
|
|
187
250
|
|
|
188
|
-
|
|
251
|
+
**Apply:** Replace every numeric `delay` value on `TooltipTrigger` with one of
|
|
252
|
+
the two string literals: `"default"` (400ms) or `"long"` (1500ms). Pick by
|
|
253
|
+
intent, not by which number is closer — `"default"` is for elements that cannot
|
|
254
|
+
be understood without the tooltip (icon-only buttons), `"long"` is for
|
|
255
|
+
supplementary information on elements that are already labeled. A previous
|
|
256
|
+
numeric value is not a reliable guide: `delay={500}` maps to `"default"`
|
|
257
|
+
(400ms), not `"long"` (1500ms), if the element still needs the tooltip to be
|
|
258
|
+
understood.
|
|
189
259
|
|
|
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.
|
|
260
|
+
---
|
|
196
261
|
|
|
197
|
-
|
|
198
|
-
|
|
262
|
+
<a id="flags-to-component-defaults-provider"></a>
|
|
263
|
+
|
|
264
|
+
## `flags` is replaced by the ComponentDefaultsProvider
|
|
199
265
|
|
|
200
|
-
|
|
266
|
+
**Since `0.2.0-alpha.1005`** · deprecation · manual change
|
|
201
267
|
|
|
202
268
|
The global `flags` object is deprecated. Application-wide defaults are defined
|
|
203
269
|
with the `<ComponentDefaultsProvider />` instead, which additionally works per
|
|
@@ -224,11 +290,75 @@ Assigning a flag keeps working — it acts as the application-wide default below
|
|
|
224
290
|
the provider and logs a deprecation warning — but the flags will be removed in a
|
|
225
291
|
future release.
|
|
226
292
|
|
|
293
|
+
**Apply:** Replace assignments to the global `flags` object with an equivalent
|
|
294
|
+
`<ComponentDefaultsProvider defaults={{ ... }} />` wrapping the app, or the
|
|
295
|
+
subtree the default should apply to.
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
<a id="modal-unsaved-changes-confirmation"></a>
|
|
300
|
+
|
|
301
|
+
## Closing a Modal with unsaved changes is confirmed by default
|
|
302
|
+
|
|
303
|
+
**Since `0.2.0-alpha.1005`** · migration · no code change needed · also applies
|
|
304
|
+
to `@mittwald/flow-remote-react-components`
|
|
305
|
+
|
|
306
|
+
A `Modal` that contains a react-hook-form `<Form>` now asks for confirmation
|
|
307
|
+
before it closes while the form is _dirty_ — previously this required the
|
|
308
|
+
`requireCloseModalConfirmationOnUnsavedChanges` flag. After a successful submit
|
|
309
|
+
or a `form.reset()` the modal closes right away, and actions in the
|
|
310
|
+
`<ActionGroup />` as well as the close button in the heading still close it
|
|
311
|
+
immediately.
|
|
312
|
+
|
|
313
|
+
Nothing to do if you had the flag enabled. To keep the previous behavior, switch
|
|
314
|
+
the default off (see below).
|
|
315
|
+
|
|
316
|
+
**Apply:** No code change required — if you had
|
|
317
|
+
`requireCloseModalConfirmationOnUnsavedChanges` enabled, the new default matches
|
|
318
|
+
it. To keep the previous behaviour (closing without confirmation), set
|
|
319
|
+
`Form: { confirmModalCloseOnUnsavedChanges: false }` via
|
|
320
|
+
`<ComponentDefaultsProvider />`, or its deprecated equivalent, the
|
|
321
|
+
`flags.requireCloseModalConfirmationOnUnsavedChanges = false` assignment.
|
|
322
|
+
|
|
227
323
|
---
|
|
228
324
|
|
|
229
|
-
|
|
325
|
+
<a id="password-tools-subpath-renamed"></a>
|
|
230
326
|
|
|
231
|
-
|
|
327
|
+
## `password-tools` entry renamed to `mittwald-password-tools-js`
|
|
328
|
+
|
|
329
|
+
**Since `0.2.0-alpha.1000`** · migration · codemod available
|
|
330
|
+
|
|
331
|
+
The subpath export carrying the `@mittwald/password-tools-js` integration is
|
|
332
|
+
called `@mittwald/flow-react-components/mittwald-password-tools-js`. Between
|
|
333
|
+
`0.2.0-alpha.913` and `0.2.0-alpha.999` it was called
|
|
334
|
+
`@mittwald/flow-react-components/password-tools`; `0.2.0-alpha.1000` reverted
|
|
335
|
+
that name.
|
|
336
|
+
|
|
337
|
+
```diff
|
|
338
|
+
- import { Rule } from "@mittwald/flow-react-components/password-tools";
|
|
339
|
+
+ import { Rule } from "@mittwald/flow-react-components/mittwald-password-tools-js";
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
Only code written against a version inside that window is affected. There is no
|
|
343
|
+
deprecation path and no fallback: a subpath export that no longer exists is a
|
|
344
|
+
hard `TS2307` ("Cannot find module") and fails the build.
|
|
345
|
+
|
|
346
|
+
**Apply:** Replace the import path
|
|
347
|
+
`@mittwald/flow-react-components/password-tools` with
|
|
348
|
+
`@mittwald/flow-react-components/mittwald-password-tools-js`.
|
|
349
|
+
|
|
350
|
+
```shell
|
|
351
|
+
npx @mittwald/flow-codemods@latest password-tools-subpath-renamed src
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
---
|
|
355
|
+
|
|
356
|
+
<a id="table-column-width-props"></a>
|
|
357
|
+
|
|
358
|
+
## TableColumn: `maxWidth` removed, `width` and `minWidth` retyped
|
|
359
|
+
|
|
360
|
+
**Since `0.2.0-alpha.956`** · migration · manual change · also applies to
|
|
361
|
+
`@mittwald/flow-remote-react-components`
|
|
232
362
|
|
|
233
363
|
`maxWidth` has been removed. `width` and `minWidth` are now typed as
|
|
234
364
|
`number | string`: they no longer accept `null`, and the previous
|
|
@@ -244,32 +374,33 @@ Percentage, pixel and `fr` values keep working as strings or numbers
|
|
|
244
374
|
(`width="50%"`, `width="200fr"`, `width={300}`). Where you passed `null` to mean
|
|
245
375
|
"no explicit width", omit the prop instead.
|
|
246
376
|
|
|
377
|
+
**Apply:** Remove `maxWidth` from every `TableColumn`. Where `width` or
|
|
378
|
+
`minWidth` was `null`, omit the prop instead — the type no longer accepts
|
|
379
|
+
`null`, only `number | string`.
|
|
380
|
+
|
|
247
381
|
---
|
|
248
382
|
|
|
249
|
-
|
|
383
|
+
<a id="table-render-prop-removed"></a>
|
|
384
|
+
|
|
385
|
+
## Table: `render` prop removed
|
|
250
386
|
|
|
251
|
-
|
|
387
|
+
**Since `0.2.0-alpha.866`** · migration · manual change · also applies to
|
|
388
|
+
`@mittwald/flow-remote-react-components`
|
|
252
389
|
|
|
253
390
|
The `render` escape hatch on `Table` has been removed. Compose the table from
|
|
254
391
|
`TableHeader`, `TableColumn`, `TableBody`, `TableRow` and `TableCell` instead.
|
|
255
392
|
|
|
393
|
+
**Apply:** Replace the `render` escape hatch on `Table` with a composition of
|
|
394
|
+
`TableHeader`, `TableColumn`, `TableBody`, `TableRow` and `TableCell`.
|
|
395
|
+
|
|
256
396
|
---
|
|
257
397
|
|
|
258
|
-
|
|
398
|
+
<a id="color-primary-to-default"></a>
|
|
259
399
|
|
|
260
|
-
|
|
400
|
+
## Breadcrumb, HeaderNavigation, Heading, IllustratedMessage, and Link: color property "primary" renamed to "default"
|
|
261
401
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
```diff
|
|
266
|
-
- <TableCell render={(cell) => <CustomCell {...cell} />} />
|
|
267
|
-
+ <TableCell>
|
|
268
|
-
+ <CustomCell />
|
|
269
|
-
+ </TableCell>
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
### Breadcrumb, HeaderNavigation, Heading, IllustratedMessage, and Link: color property "primary" renamed to "default"
|
|
402
|
+
**Since `0.2.0-alpha.846`** · migration · codemod available · also applies to
|
|
403
|
+
`@mittwald/flow-remote-react-components`
|
|
273
404
|
|
|
274
405
|
The `color="primary"` property has been renamed to `color="default"`.
|
|
275
406
|
|
|
@@ -280,22 +411,45 @@ The `color="primary"` property has been renamed to `color="default"`.
|
|
|
280
411
|
|
|
281
412
|
A codemod rewrites `color="primary"` to `color="default"` on these five
|
|
282
413
|
components (and leaves other components such as `Button`, where `"primary"` is
|
|
283
|
-
still valid, untouched)
|
|
414
|
+
still valid, untouched).
|
|
415
|
+
|
|
416
|
+
**Apply:** Rewrite `color="primary"` to `color="default"` on `Breadcrumb`,
|
|
417
|
+
`HeaderNavigation`, `Heading`, `IllustratedMessage`, and `Link` only — leave
|
|
418
|
+
`Button` (and any other component where `"primary"` is still valid) untouched.
|
|
284
419
|
|
|
285
420
|
```shell
|
|
286
|
-
npx
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
421
|
+
npx @mittwald/flow-codemods@latest color-primary-to-default src
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
---
|
|
425
|
+
|
|
426
|
+
<a id="table-cell-render-prop-removed"></a>
|
|
427
|
+
|
|
428
|
+
## TableCell: `render` prop removed
|
|
429
|
+
|
|
430
|
+
**Since `0.2.0-alpha.846`** · migration · manual change · also applies to
|
|
431
|
+
`@mittwald/flow-remote-react-components`
|
|
432
|
+
|
|
433
|
+
The `render` escape hatch on `TableCell` has been removed. Provide the cell
|
|
434
|
+
content as children instead.
|
|
435
|
+
|
|
436
|
+
```diff
|
|
437
|
+
- <TableCell render={(cell) => <CustomCell {...cell} />} />
|
|
438
|
+
+ <TableCell>
|
|
439
|
+
+ <CustomCell />
|
|
440
|
+
+ </TableCell>
|
|
290
441
|
```
|
|
291
442
|
|
|
292
|
-
|
|
443
|
+
**Apply:** Provide the cell content as children of `TableCell` instead of a
|
|
444
|
+
`render` function.
|
|
293
445
|
|
|
294
446
|
---
|
|
295
447
|
|
|
296
|
-
|
|
448
|
+
<a id="password-tools-rule"></a>
|
|
449
|
+
|
|
450
|
+
## password-tools: `AsyncRule` and `SyncRule` replaced by `Rule`
|
|
297
451
|
|
|
298
|
-
|
|
452
|
+
**Since `0.2.0-alpha.802`** · migration · codemod available
|
|
299
453
|
|
|
300
454
|
The `@mittwald/flow-react-components/mittwald-password-tools-js` entry no longer
|
|
301
455
|
exports `AsyncRule` and `SyncRule`. The underlying `@mittwald/password-tools-js`
|
|
@@ -309,11 +463,71 @@ merged both into a single abstract `Rule`.
|
|
|
309
463
|
A custom rule extends `Rule` and may return its result synchronously or as a
|
|
310
464
|
promise — the distinction the two classes used to encode is gone.
|
|
311
465
|
|
|
466
|
+
A codemod replaces both names. A file that imported both — or one of them next
|
|
467
|
+
to `Rule` — ends up with a single import.
|
|
468
|
+
|
|
469
|
+
**Apply:** Replace `AsyncRule` and `SyncRule` imports from
|
|
470
|
+
`@mittwald/flow-react-components/mittwald-password-tools-js` with `Rule`. Update
|
|
471
|
+
custom rule classes to extend `Rule` instead.
|
|
472
|
+
|
|
473
|
+
```shell
|
|
474
|
+
npx @mittwald/flow-codemods@latest password-tools-rule src
|
|
475
|
+
```
|
|
476
|
+
|
|
312
477
|
---
|
|
313
478
|
|
|
314
|
-
|
|
479
|
+
<a id="accent-box-color-to-background-color"></a>
|
|
315
480
|
|
|
316
|
-
|
|
481
|
+
## AccentBox.color is now a declaration for foreground
|
|
482
|
+
|
|
483
|
+
**Since `0.2.0-alpha.786`** · migration · codemod available · also applies to
|
|
484
|
+
`@mittwald/flow-remote-react-components`
|
|
485
|
+
|
|
486
|
+
The `color` property now controls foreground colors. Use the `backgroundColor`
|
|
487
|
+
property to set the background color instead.
|
|
488
|
+
|
|
489
|
+
```diff
|
|
490
|
+
- <AccentBox color="gradient">
|
|
491
|
+
+ <AccentBox backgroundColor="gradient" />
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
`color` did not go away, it changed meaning — so this is not a rename. It used
|
|
495
|
+
to accept `"blue" | "green" | "gradient" | "neutral"` and now accepts
|
|
496
|
+
`"default" | "dark" | "light" | "dark-static" | "light-static"`.
|
|
497
|
+
|
|
498
|
+
A codemod decides per value: a value from the new foreground union stays on
|
|
499
|
+
`color`, every other literal moves to `backgroundColor`. Two cases stay
|
|
500
|
+
untouched, because neither can be decided from the value alone — check them by
|
|
501
|
+
hand:
|
|
502
|
+
|
|
503
|
+
- `color={expression}`, where the same expression means the background in old
|
|
504
|
+
code and the foreground in new code.
|
|
505
|
+
- An element that already carries `backgroundColor`, where moving `color` there
|
|
506
|
+
would overwrite the explicit value.
|
|
507
|
+
|
|
508
|
+
One value changes what you see: the runtime fallback maps `"neutral"`,
|
|
509
|
+
`"gradient"` and `"green"` onto the background, but not `"blue"`, so
|
|
510
|
+
`<AccentBox color="blue">` currently renders the neutral background. The codemod
|
|
511
|
+
turns it into `backgroundColor="blue"`, which restores the blue one.
|
|
512
|
+
|
|
513
|
+
**Apply:** Move every `color` value that is not one of
|
|
514
|
+
`"default" | "dark" | "light" | "dark-static" | "light-static"` to
|
|
515
|
+
`backgroundColor` instead. Review `color={expression}` and any element that
|
|
516
|
+
already has `backgroundColor` by hand — neither can be decided from the value
|
|
517
|
+
alone.
|
|
518
|
+
|
|
519
|
+
```shell
|
|
520
|
+
npx @mittwald/flow-codemods@latest accent-box-color-to-background-color src
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
---
|
|
524
|
+
|
|
525
|
+
<a id="cartesian-chart-restructured"></a>
|
|
526
|
+
|
|
527
|
+
## CartesianChart
|
|
528
|
+
|
|
529
|
+
**Since `0.2.0-alpha.780`** · migration · manual change · also applies to
|
|
530
|
+
`@mittwald/flow-remote-react-components`
|
|
317
531
|
|
|
318
532
|
> If you're using a _Function_ in the `dataKey` - you need to define a
|
|
319
533
|
> `dataKeyLabel` as well.
|
|
@@ -403,25 +617,20 @@ const ExampleChart = typedCartesianChart<ChartData>();
|
|
|
403
617
|
</ExampleChart.Chart>
|
|
404
618
|
```
|
|
405
619
|
|
|
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
|
-
```
|
|
620
|
+
**Apply:** Add `dataKeyLabel` wherever a `dataKey` is a function — a string
|
|
621
|
+
`dataKey` already sets it automatically. Where a `tickFormatter` or other
|
|
622
|
+
callback relied on the argument being `any`, add an explicit type check (for
|
|
623
|
+
example `instanceof Date`), or switch to `typedCartesianChart<T>()` for a chart
|
|
624
|
+
whose callbacks are typed from your own data shape.
|
|
419
625
|
|
|
420
626
|
---
|
|
421
627
|
|
|
422
|
-
|
|
628
|
+
<a id="code-block-syntax-highlighter-removed"></a>
|
|
629
|
+
|
|
630
|
+
## Removed the underlying react-syntax-highlighter library from CodeBlock
|
|
423
631
|
|
|
424
|
-
|
|
632
|
+
**Since `0.2.0-alpha.756`** · migration · manual change · also applies to
|
|
633
|
+
`@mittwald/flow-remote-react-components`
|
|
425
634
|
|
|
426
635
|
We've replaced the `react-syntax-highlighter` library, which means many
|
|
427
636
|
properties have been removed and the remaining ones have been simplified. See
|
|
@@ -429,11 +638,17 @@ the
|
|
|
429
638
|
[CodeBlock documentation](https://flow.mittwald.de/04-components/content/code-block/overview)
|
|
430
639
|
for details on what's now supported.
|
|
431
640
|
|
|
641
|
+
**Apply:** Check every `CodeBlock` usage against the current props (see the
|
|
642
|
+
[CodeBlock documentation](https://flow.mittwald.de/04-components/content/code-block/overview))
|
|
643
|
+
and remove or replace props the new implementation does not support.
|
|
644
|
+
|
|
432
645
|
---
|
|
433
646
|
|
|
434
|
-
|
|
647
|
+
<a id="muted-action-error-to-abort-action-error"></a>
|
|
648
|
+
|
|
649
|
+
## `MutedActionError` renamed to `AbortActionError`
|
|
435
650
|
|
|
436
|
-
|
|
651
|
+
**Since `0.2.0-alpha.712`** · migration · codemod available
|
|
437
652
|
|
|
438
653
|
The error that aborts an `Action` without reporting a failure is now called
|
|
439
654
|
`AbortActionError`. Its static helpers were renamed along with it.
|
|
@@ -456,11 +671,46 @@ There is no alias for the old name. The thrown error's `name` changed from
|
|
|
456
671
|
`"MutedActionError"` to `"AbortActionError"` as well — update any code that
|
|
457
672
|
matches on it.
|
|
458
673
|
|
|
674
|
+
A codemod renames the class and both static helpers. It also rewrites an
|
|
675
|
+
`error.name === "MutedActionError"` comparison, but only in a file that imports
|
|
676
|
+
the class — a check living anywhere else cannot be recognised, so grep for the
|
|
677
|
+
string once when you are done.
|
|
678
|
+
|
|
679
|
+
**Apply:** Rename `MutedActionError` to `AbortActionError`, `isMutedActionError`
|
|
680
|
+
to `isAbortActionError`, and `rethrowIfNotMuted` to `rethrowIfNotAborted`.
|
|
681
|
+
Update any `error.name === "MutedActionError"` comparison to
|
|
682
|
+
`"AbortActionError"`.
|
|
683
|
+
|
|
684
|
+
```shell
|
|
685
|
+
npx @mittwald/flow-codemods@latest muted-action-error-to-abort-action-error src
|
|
686
|
+
```
|
|
687
|
+
|
|
688
|
+
---
|
|
689
|
+
|
|
690
|
+
<a id="overlay-controller-add-on-close-return-type"></a>
|
|
691
|
+
|
|
692
|
+
## OverlayController.addOnClose / addOnOpen return type changed
|
|
693
|
+
|
|
694
|
+
**Since `0.2.0-alpha.696`** · migration · manual change · also applies to
|
|
695
|
+
`@mittwald/flow-remote-react-components`
|
|
696
|
+
|
|
697
|
+
The return type changed from `() => void` to `() => unknown`
|
|
698
|
+
|
|
699
|
+
**Apply:** No type change needed: the return type widened from `() => void` to
|
|
700
|
+
`() => unknown`, and a `() => void` callback stays assignable. Instead, check
|
|
701
|
+
every callback passed to `addOnClose`/`addOnOpen` for one that can return
|
|
702
|
+
`false` — for example an arrow function whose body is an expression evaluating
|
|
703
|
+
to `false`. `executeHandlers` now treats any handler returning `false` as a veto
|
|
704
|
+
and cancels the close/open. A callback that returned `false` incidentally, with
|
|
705
|
+
no intent to block anything, now silently cancels closes.
|
|
706
|
+
|
|
459
707
|
---
|
|
460
708
|
|
|
461
|
-
|
|
709
|
+
<a id="form-resets-after-modal-close"></a>
|
|
462
710
|
|
|
463
|
-
|
|
711
|
+
## Form: resets itself after the surrounding modal closes
|
|
712
|
+
|
|
713
|
+
**Since `0.2.0-alpha.694`** · migration · no code change needed
|
|
464
714
|
|
|
465
715
|
A react-hook-form `<Form>` inside a `Modal` now resets to its default values
|
|
466
716
|
once the modal has closed. Previously it kept what the user had entered, so
|
|
@@ -476,19 +726,18 @@ Opt out per form with the new `autoReset` prop:
|
|
|
476
726
|
`autoReset` also takes an object (`autoReset={{ onAfterModalClose: false }}`) so
|
|
477
727
|
further reset triggers can be added without another prop.
|
|
478
728
|
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
### OverlayController.addOnClose / addOnOpen return type changed
|
|
484
|
-
|
|
485
|
-
The return type changed from `() => void` to `() => unknown`
|
|
729
|
+
**Apply:** No code change required. To keep the previous behaviour (the form
|
|
730
|
+
keeping what the user entered), pass `autoReset={false}` (or
|
|
731
|
+
`autoReset={{ onAfterModalClose: false }}`) to `Form`.
|
|
486
732
|
|
|
487
733
|
---
|
|
488
734
|
|
|
489
|
-
|
|
735
|
+
<a id="cartesian-chart-empty-view"></a>
|
|
736
|
+
|
|
737
|
+
## CartesianChart.emptyView changed
|
|
490
738
|
|
|
491
|
-
|
|
739
|
+
**Since `0.2.0-alpha.676`** · migration · manual change · also applies to
|
|
740
|
+
`@mittwald/flow-remote-react-components`
|
|
492
741
|
|
|
493
742
|
Component references are no longer accepted for `emptyView` - must be a rendered
|
|
494
743
|
element now.
|
|
@@ -498,11 +747,17 @@ element now.
|
|
|
498
747
|
+ <CartesianChart emptyView={<EmptyState />} />
|
|
499
748
|
```
|
|
500
749
|
|
|
750
|
+
**Apply:** Wrap the `emptyView` value in JSX — `emptyView={<EmptyState />}`
|
|
751
|
+
instead of `emptyView={EmptyState}`.
|
|
752
|
+
|
|
501
753
|
---
|
|
502
754
|
|
|
503
|
-
|
|
755
|
+
<a id="action-prop-to-on-action"></a>
|
|
504
756
|
|
|
505
|
-
|
|
757
|
+
## Action: `action` renamed to `onAction`
|
|
758
|
+
|
|
759
|
+
**Since `0.2.0-alpha.646`** · migration · codemod available · also applies to
|
|
760
|
+
`@mittwald/flow-remote-react-components`
|
|
506
761
|
|
|
507
762
|
`Action`'s `action` prop is now called `onAction`, which matches the naming of
|
|
508
763
|
every other event prop in Flow.
|
|
@@ -519,32 +774,61 @@ prop. At runtime the old prop still works: `Action` maps it to `onAction` and
|
|
|
519
774
|
logs a deprecation warning, and an explicit `onAction` wins. The fallback will
|
|
520
775
|
be removed in a future major version.
|
|
521
776
|
|
|
522
|
-
A codemod renames the prop on `Action
|
|
777
|
+
A codemod renames the prop on `Action`.
|
|
778
|
+
|
|
779
|
+
**Apply:** Rename the `action` prop on `Action` to `onAction`.
|
|
523
780
|
|
|
524
781
|
```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
|
|
782
|
+
npx @mittwald/flow-codemods@latest action-prop-to-on-action src
|
|
529
783
|
```
|
|
530
784
|
|
|
531
|
-
|
|
785
|
+
---
|
|
532
786
|
|
|
533
|
-
|
|
787
|
+
<a id="button-props-interfaces"></a>
|
|
788
|
+
|
|
789
|
+
## Removed ResetButton and SubmitButton Interfaces
|
|
790
|
+
|
|
791
|
+
**Since `0.2.0-alpha.646`** · migration · codemod available
|
|
534
792
|
|
|
535
793
|
The `RemoteButtonElementProps`, `ResetButtonProps`, and `SubmitButtonProps`
|
|
536
794
|
interfaces have been removed. Use `ButtonProps` instead.
|
|
537
795
|
|
|
796
|
+
```diff
|
|
797
|
+
- import type { SubmitButtonProps } from "@mittwald/flow-react-components/react-hook-form";
|
|
798
|
+
+ import type { ButtonProps } from "@mittwald/flow-react-components";
|
|
799
|
+
```
|
|
800
|
+
|
|
801
|
+
Note the entry: `ButtonProps` lives in the package root, while the removed names
|
|
802
|
+
came from `react-hook-form`. A codemod moves the import along with the name. It
|
|
803
|
+
covers `@mittwald/flow-react-components` only.
|
|
804
|
+
`@mittwald/flow-remote-react-components` does not export `ButtonProps`, so there
|
|
805
|
+
is nothing to move a remote import onto — pick your own source for the type
|
|
806
|
+
there. `RemoteButtonElementProps` is left alone as well:
|
|
807
|
+
`@mittwald/flow-remote-elements` still exports that name.
|
|
808
|
+
|
|
809
|
+
**Apply:** Replace `ResetButtonProps`/`SubmitButtonProps` imports from
|
|
810
|
+
`@mittwald/flow-react-components/react-hook-form` with `ButtonProps` from the
|
|
811
|
+
package root. Leave `RemoteButtonElementProps` (from
|
|
812
|
+
`@mittwald/flow-remote-elements`) alone.
|
|
813
|
+
|
|
814
|
+
```shell
|
|
815
|
+
npx @mittwald/flow-codemods@latest button-props-interfaces src
|
|
816
|
+
```
|
|
817
|
+
|
|
538
818
|
---
|
|
539
819
|
|
|
540
|
-
|
|
820
|
+
<a id="imports-to-package-root"></a>
|
|
821
|
+
|
|
822
|
+
## Subpath imports moved to the package root
|
|
823
|
+
|
|
824
|
+
**Since `0.2.0-alpha.28`** · migration · codemod available
|
|
541
825
|
|
|
542
826
|
With the latest update to `@mittwald/flow-react-components`, the way package
|
|
543
827
|
exports are handled has changed. You no longer need to specify subdirectories
|
|
544
828
|
explicitly when importing components and utilities. Instead, imports are now
|
|
545
829
|
structured in a more streamlined way.
|
|
546
830
|
|
|
547
|
-
|
|
831
|
+
### Changes in Imports
|
|
548
832
|
|
|
549
833
|
Previously, you had to import components and utilities from specific
|
|
550
834
|
subdirectories, like this:
|
|
@@ -565,28 +849,14 @@ import { Field } from "@mittwald/flow-react-components/react-hook-form";
|
|
|
565
849
|
import { Link } from "@mittwald/flow-react-components/nextjs";
|
|
566
850
|
```
|
|
567
851
|
|
|
568
|
-
|
|
852
|
+
### `tsconfig.json`
|
|
569
853
|
|
|
570
854
|
Set `"module": "esnext"` in your `tsconfig.json`, if you have trouble with
|
|
571
855
|
missing module exports.
|
|
572
856
|
|
|
573
|
-
|
|
857
|
+
### Migration Steps
|
|
574
858
|
|
|
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
|
|
859
|
+
#### Do it manually
|
|
590
860
|
|
|
591
861
|
1. **Update all import statements** in your project according to the new
|
|
592
862
|
structure.
|
|
@@ -595,16 +865,28 @@ See the [docs of jscodeshift](https://jscodeshift.com/run/cli/)
|
|
|
595
865
|
4. **Run your test suite** to ensure no regressions were introduced by the
|
|
596
866
|
migration.
|
|
597
867
|
|
|
598
|
-
|
|
868
|
+
This change shipped in `0.2.0-alpha.28`: `0.2.0-alpha.27` still published one
|
|
869
|
+
export entry per component, `alpha.28` published the flat set. Neither `0.1.0`
|
|
870
|
+
nor `0.2.0` was ever released as a stable version — both are alpha-only lines,
|
|
871
|
+
and the first stable release of Flow is `1.0.0`.
|
|
872
|
+
|
|
873
|
+
**Apply:** Rewrite every subdirectory import from
|
|
874
|
+
`@mittwald/flow-react-components` to the package root, except `react-hook-form`
|
|
875
|
+
and `nextjs`, which move to `@mittwald/flow-react-components/react-hook-form`
|
|
876
|
+
and `@mittwald/flow-react-components/nextjs`. If you hit missing module errors,
|
|
877
|
+
set `"module": "esnext"` in `tsconfig.json`.
|
|
599
878
|
|
|
600
|
-
|
|
601
|
-
-
|
|
602
|
-
|
|
603
|
-
|
|
879
|
+
```shell
|
|
880
|
+
npx @mittwald/flow-codemods@latest imports-to-package-root src
|
|
881
|
+
```
|
|
882
|
+
|
|
883
|
+
---
|
|
884
|
+
|
|
885
|
+
<a id="renamed-css-export"></a>
|
|
604
886
|
|
|
605
|
-
##
|
|
887
|
+
## Renamed CSS export
|
|
606
888
|
|
|
607
|
-
|
|
889
|
+
**Since `0.1.0-alpha.292`** · migration · manual change
|
|
608
890
|
|
|
609
891
|
The CSS export `@mittwald/flow-react-components/styles` has renamed to the more
|
|
610
892
|
precise name `@mittwald/flow-react-components/all.css`, because the file
|
|
@@ -616,3 +898,6 @@ as well. A documentation on how to use them is planned.
|
|
|
616
898
|
- import "@mittwald/flow-react-components/styles";
|
|
617
899
|
+ import "@mittwald/flow-react-components/all.css";
|
|
618
900
|
```
|
|
901
|
+
|
|
902
|
+
**Apply:** Replace the import `@mittwald/flow-react-components/styles` with
|
|
903
|
+
`@mittwald/flow-react-components/all.css`.
|