@mittwald/flow-react-components 1.2.0-next.24 → 1.2.0-next.26
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 +62 -0
- package/dist/assets/component-index.json +1 -1
- package/dist/assets/doc-properties.json +1 -1
- package/dist/js/packages/components/src/components/Markdown/Markdown.mjs +8 -1
- package/dist/js/packages/components/src/components/Markdown/Markdown.mjs.map +1 -1
- package/dist/js/packages/components/src/components/Option/Option.mjs +12 -3
- package/dist/js/packages/components/src/components/Option/Option.mjs.map +1 -1
- package/dist/js/packages/components/src/lib/react/remote.mjs +40 -7
- package/dist/js/packages/components/src/lib/react/remote.mjs.map +1 -1
- package/dist/types/components/Markdown/Markdown.d.ts.map +1 -1
- package/dist/types/components/Option/Option.d.ts +10 -0
- package/dist/types/components/Option/Option.d.ts.map +1 -1
- package/dist/types/lib/react/remote.d.ts +28 -2
- package/dist/types/lib/react/remote.d.ts.map +1 -1
- package/package.json +9 -9
package/MIGRATION.md
CHANGED
|
@@ -28,6 +28,68 @@ The CLI's own output does detect it and prints the right form.
|
|
|
28
28
|
|
|
29
29
|
---
|
|
30
30
|
|
|
31
|
+
<a id="option-value-inferred-from-mixed-children"></a>
|
|
32
|
+
|
|
33
|
+
## Option: value is inferred from mixed children
|
|
34
|
+
|
|
35
|
+
**Since `1.1.12`** · migration · no code change needed · also applies to
|
|
36
|
+
`@mittwald/flow-remote-react-components`
|
|
37
|
+
|
|
38
|
+
An `Option` used to infer its `textValue` — and, through it, its `value` — only
|
|
39
|
+
when its children were exactly one text node. Text next to any element left both
|
|
40
|
+
undefined, so react-aria assigned the option a key off a render-order counter:
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
<Select>
|
|
44
|
+
<Option>
|
|
45
|
+
Millennium Falcon <Badge>Latest</Badge>
|
|
46
|
+
</Option>
|
|
47
|
+
<Option>X-Wing</Option>
|
|
48
|
+
</Select>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
| Option | key before | key now |
|
|
52
|
+
| ----------------------------- | -------------- | ------------------- |
|
|
53
|
+
| `Millennium Falcon` + `Badge` | `react-aria-1` | `Millennium Falcon` |
|
|
54
|
+
| `X-Wing` | `X-Wing` | `X-Wing` |
|
|
55
|
+
|
|
56
|
+
The key is what the field reports as its selected value and what `defaultValue`
|
|
57
|
+
has to match, so the old key made the field submit a meaningless string, could
|
|
58
|
+
not be preselected, and shifted when unrelated markup around it changed.
|
|
59
|
+
|
|
60
|
+
Only text that is a child itself contributes — text inside an element child does
|
|
61
|
+
not, so the option above is `"Millennium Falcon"` and not
|
|
62
|
+
`"Millennium Falcon Latest"`.
|
|
63
|
+
|
|
64
|
+
An `Option` with no text among its children at all still has no key to infer,
|
|
65
|
+
and now says so on the console instead of failing silently:
|
|
66
|
+
|
|
67
|
+
```tsx
|
|
68
|
+
// logs: An <Option> has no 'value' and none could be inferred from its children…
|
|
69
|
+
<Option>
|
|
70
|
+
<Text>Millennium Falcon</Text>
|
|
71
|
+
</Option>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Give those options a `value`:
|
|
75
|
+
|
|
76
|
+
```diff
|
|
77
|
+
- <Option>
|
|
78
|
+
+ <Option value="millennium-falcon">
|
|
79
|
+
<Text>Millennium Falcon</Text>
|
|
80
|
+
</Option>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Apply:** No code change required for the option itself. An `Option` whose
|
|
84
|
+
children are text plus an element — text and a `Badge`, text and an icon — now
|
|
85
|
+
carries that text as its key, where it previously fell back to react-aria's
|
|
86
|
+
generated `react-aria-N`. Check anywhere such a key was read back: a stored or
|
|
87
|
+
server-side selection, a `defaultValue`/`value` matched against it, or a test
|
|
88
|
+
asserting on it. Pass an explicit `value` to pin the key to something other than
|
|
89
|
+
the display text.
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
31
93
|
<a id="use-design-tokens-build-metadata-removed"></a>
|
|
32
94
|
|
|
33
95
|
## useDesignTokens(): no longer returns style-dictionary build metadata
|