@mittwald/flow-react-components 1.2.0-next.1 → 1.2.0-next.10

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 (64) hide show
  1. package/MIGRATION.md +194 -10
  2. package/dist/assets/component-index.json +1 -1
  3. package/dist/assets/doc-properties.json +1 -1
  4. package/dist/css/all-layered.css +1 -1
  5. package/dist/css/all.css +1 -1
  6. package/dist/js/default.mjs +2 -1
  7. package/dist/js/packages/components/src/components/CartesianChart/CartesianChart.mjs +34 -26
  8. package/dist/js/packages/components/src/components/CartesianChart/CartesianChart.mjs.map +1 -1
  9. package/dist/js/packages/components/src/components/CartesianChart/components/Bar/Bar.mjs +40 -0
  10. package/dist/js/packages/components/src/components/CartesianChart/components/Bar/Bar.mjs.map +1 -0
  11. package/dist/js/packages/components/src/components/CartesianChart/components/XAxis/XAxis.mjs +3 -1
  12. package/dist/js/packages/components/src/components/CartesianChart/components/XAxis/XAxis.mjs.map +1 -1
  13. package/dist/js/packages/components/src/components/CartesianChart/components/YAxis/YAxis.mjs +2 -1
  14. package/dist/js/packages/components/src/components/CartesianChart/components/YAxis/YAxis.mjs.map +1 -1
  15. package/dist/js/packages/components/src/components/CartesianChart/context.mjs +11 -0
  16. package/dist/js/packages/components/src/components/CartesianChart/context.mjs.map +1 -0
  17. package/dist/js/packages/components/src/components/CartesianChart/types.mjs.map +1 -1
  18. package/dist/js/packages/components/src/components/Heading/Heading.module.mjs.map +1 -1
  19. package/dist/js/packages/components/src/components/SegmentedControl/components/Segment/Segment.mjs +2 -1
  20. package/dist/js/packages/components/src/components/SegmentedControl/components/Segment/Segment.mjs.map +1 -1
  21. package/dist/js/packages/components/src/components/Tabs/Tabs.mjs +3 -1
  22. package/dist/js/packages/components/src/components/Tabs/Tabs.mjs.map +1 -1
  23. package/dist/js/packages/components/src/components/Tabs/components/TabList/TabList.mjs +3 -1
  24. package/dist/js/packages/components/src/components/Tabs/components/TabList/TabList.mjs.map +1 -1
  25. package/dist/js/packages/design-tokens/dist/json-runtime/all-dark.mjs +6 -1
  26. package/dist/js/packages/design-tokens/dist/json-runtime/all-dark.mjs.map +1 -1
  27. package/dist/js/packages/design-tokens/dist/json-runtime/all-light.mjs +6 -1
  28. package/dist/js/packages/design-tokens/dist/json-runtime/all-light.mjs.map +1 -1
  29. package/dist/types/components/CartesianChart/CartesianChart.d.ts +12 -1
  30. package/dist/types/components/CartesianChart/CartesianChart.d.ts.map +1 -1
  31. package/dist/types/components/CartesianChart/components/Bar/Bar.d.ts +19 -0
  32. package/dist/types/components/CartesianChart/components/Bar/Bar.d.ts.map +1 -0
  33. package/dist/types/components/CartesianChart/components/Bar/index.d.ts +3 -0
  34. package/dist/types/components/CartesianChart/components/Bar/index.d.ts.map +1 -0
  35. package/dist/types/components/CartesianChart/components/Bar/view.d.ts +8 -0
  36. package/dist/types/components/CartesianChart/components/Bar/view.d.ts.map +1 -0
  37. package/dist/types/components/CartesianChart/components/XAxis/XAxis.d.ts.map +1 -1
  38. package/dist/types/components/CartesianChart/components/YAxis/YAxis.d.ts.map +1 -1
  39. package/dist/types/components/CartesianChart/context.d.ts +8 -0
  40. package/dist/types/components/CartesianChart/context.d.ts.map +1 -0
  41. package/dist/types/components/CartesianChart/index.d.ts +1 -0
  42. package/dist/types/components/CartesianChart/index.d.ts.map +1 -1
  43. package/dist/types/components/CartesianChart/stories/Default.stories.d.ts +4 -0
  44. package/dist/types/components/CartesianChart/stories/Default.stories.d.ts.map +1 -1
  45. package/dist/types/components/CartesianChart/types.d.ts +6 -0
  46. package/dist/types/components/CartesianChart/types.d.ts.map +1 -1
  47. package/dist/types/components/DonutChart/stories/Default.stories.d.ts.map +1 -1
  48. package/dist/types/components/List/stories/Default.stories.d.ts.map +1 -1
  49. package/dist/types/components/Modal/stories/Default.stories.d.ts.map +1 -1
  50. package/dist/types/components/SegmentedControl/components/Segment/Segment.d.ts +2 -1
  51. package/dist/types/components/SegmentedControl/components/Segment/Segment.d.ts.map +1 -1
  52. package/dist/types/components/Select/stories/Default.stories.d.ts.map +1 -1
  53. package/dist/types/components/Tabs/Tabs.browser.test.d.ts +2 -0
  54. package/dist/types/components/Tabs/Tabs.browser.test.d.ts.map +1 -0
  55. package/dist/types/components/Tabs/Tabs.d.ts +8 -0
  56. package/dist/types/components/Tabs/Tabs.d.ts.map +1 -1
  57. package/dist/types/components/Tabs/components/TabList/TabList.d.ts +2 -0
  58. package/dist/types/components/Tabs/components/TabList/TabList.d.ts.map +1 -1
  59. package/dist/types/components/Tabs/stories/Default.stories.d.ts.map +1 -1
  60. package/dist/types/lib/theming/hooks/useDesignTokens.d.ts +6 -0
  61. package/dist/types/lib/theming/hooks/useDesignTokens.d.ts.map +1 -1
  62. package/dist/types/views/BarView.d.ts +5 -0
  63. package/dist/types/views/BarView.d.ts.map +1 -0
  64. package/package.json +9 -9
package/MIGRATION.md CHANGED
@@ -21,6 +21,11 @@ performed, and re-running a codemod is a no-op.
21
21
  It refuses to run on a dirty working tree (`--allow-dirty` overrides that) and
22
22
  rewrites files in place, so review the diff afterwards.
23
23
 
24
+ Every command on this page is written with `npx`, because a generated file
25
+ cannot know your package manager. Substitute the equivalent if yours differs:
26
+ `pnpm dlx`, `yarn dlx` (Yarn Classic has no `dlx` — it uses `npx`), or `bun x`.
27
+ The CLI's own output does detect it and prints the right form.
28
+
24
29
  ---
25
30
 
26
31
  <a id="use-design-tokens-build-metadata-removed"></a>
@@ -99,8 +104,16 @@ tracked the selection both go away.
99
104
  ```
100
105
 
101
106
  **Setting a value.** The selection feeds a form or a setting. Use a
102
- `RadioGroup`: each `Segment` becomes a `Radio`, everything else — `Label`,
103
- `FieldDescription`, `FieldError`, the React Hook Form binding — stays as it is.
107
+ `RadioGroup`: each `Segment` becomes a `RadioButton`, everything else — `Label`,
108
+ `FieldDescription`, `FieldError`, `value`/`defaultValue`/`onChange`, the React
109
+ Hook Form binding — stays as it is.
110
+
111
+ This direction is a rename, not a restructure. The types line up:
112
+ `SegmentedControlProps` and `RadioGroupProps` both extend
113
+ `Omit<Aria.RadioGroupProps, "children">`, and `SegmentProps` and
114
+ `RadioButtonProps` are the same type (`RadioButtonProps` is declared as
115
+ `RadioProps`, which is identical to `SegmentProps`). Only
116
+ `containerBreakpointSize` has no counterpart — see the note at the end.
104
117
 
105
118
  ```diff
106
119
  - <SegmentedControl defaultValue="debit">
@@ -108,15 +121,56 @@ tracked the selection both go away.
108
121
  <Label>Zahlungsart</Label>
109
122
  - <Segment value="debit">Lastschrift</Segment>
110
123
  - <Segment value="invoice">Rechnung</Segment>
111
- + <Radio value="debit">Lastschrift</Radio>
112
- + <Radio value="invoice">Rechnung</Radio>
124
+ + <RadioButton value="debit">Lastschrift</RadioButton>
125
+ + <RadioButton value="invoice">Rechnung</RadioButton>
113
126
  <FieldDescription>Jederzeit änderbar</FieldDescription>
114
127
  - </SegmentedControl>
115
128
  + </RadioGroup>
116
129
  ```
117
130
 
118
- There is no codemod. Both replacements change the structure, and picking the
119
- right one is a decision per usage, not a rename.
131
+ **Always `RadioButton`, not `Radio`.** A `RadioGroup` also accepts a plain
132
+ `Radio`, and it takes the same props, so both would compile — but `RadioButton`
133
+ is the replacement for a `Segment`. The appearance still changes: `RadioButton`
134
+ does not reproduce the segmented control's joined row, which came from
135
+ `Segment`'s own `flex: 1` and collapsed borders. See the
136
+ [RadioGroup docs](https://flow.mittwald.de/components/form-controls/radio-group).
137
+
138
+ #### Three things the Tabs direction changes
139
+
140
+ **The controlled-state props are named differently.** `SegmentedControl` takes
141
+ `value` / `defaultValue` / `onChange` (it is a radio group); `Tabs` takes
142
+ `selectedKey` / `defaultSelectedKey` / `onSelectionChange`. Nothing carries over
143
+ by name here, unlike the `RadioGroup` direction.
144
+
145
+ **The group `Label`.** `SegmentedControl` is a form field — it wraps
146
+ react-aria's `RadioGroup` — so a `<Label>` inside it is a field label. `Tabs`
147
+ has no equivalent slot, and a tab list labels itself through its tab titles. The
148
+ `Label` therefore cannot move into `Tabs`, but its text has somewhere to go:
149
+
150
+ - into the surrounding `Section`'s `Heading`, when the group wants a visible
151
+ title
152
+ - into `aria-label` on `Tabs`, when it does not — that names the tab list for
153
+ screen readers without showing the name
154
+ - nowhere, when the surrounding heading already names the group
155
+
156
+ A `Label` on its own is **not** a signal that the usage was a `RadioGroup` case
157
+ — plenty of content switchers were authored with one, because the component
158
+ required a field label.
159
+
160
+ **Panels that register form fields.** Moving the switched-in content into a
161
+ `Tab` does not change when it mounts. `Tab` renders its panel with
162
+ `shouldForceMount` and wraps `Content` and `Section` in
163
+ `<Activity isActive={…}>`, so every tab's subtree is mounted and keeps its state
164
+ — an inactive tab is hidden, not unmounted. React Hook Form fields inside a tab
165
+ stay registered across a tab switch, exactly as they did as siblings below a
166
+ `SegmentedControl`.
167
+
168
+ There is no codemod, and the reason is the choice rather than the edit. Which
169
+ replacement is right cannot be decided from the source: a value-setting usage
170
+ and a content switcher look alike at the call site, and only the surrounding
171
+ intention separates them. The `RadioGroup` direction would be mechanical **once
172
+ that decision is made** — if you have many usages that all go that way, a
173
+ find-and-replace of `SegmentedControl`/`Segment` gets you most of it.
120
174
 
121
175
  `SegmentedControl` and `Segment` (and the `flr-segmented-control` /
122
176
  `flr-segment` remote elements) keep working unchanged and will be removed in a
@@ -128,8 +182,18 @@ their own when the available width runs out, and a `RadioGroup` stacks its
128
182
  options anyway.
129
183
 
130
184
  **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.
185
+ displayed content, or with `RadioGroup` when it sets a value. Pick per usage.
186
+ The two directions cost very different amounts of work. Towards `RadioGroup` it
187
+ is a prop-compatible rename: `SegmentedControl` → `RadioGroup` and `Segment` →
188
+ `RadioButton` (always `RadioButton`, not `Radio`; it takes exactly `Segment`'s
189
+ props), with `value`/`defaultValue`/`onChange` and a `Label` child all carrying
190
+ over. Only `containerBreakpointSize` has no counterpart, and the joined row is
191
+ not reproduced. Towards `Tabs` it is structural: the state props are
192
+ `selectedKey`/`defaultSelectedKey` rather than `value`/`defaultValue`, there is
193
+ no `Label` slot (the group label moves to the surrounding `Heading`, or to
194
+ `aria-label` on `Tabs` when it should not be visible, or goes away), and the
195
+ switched panels move inside the tabs — where they stay mounted, so form fields
196
+ in them keep their registration.
133
197
 
134
198
  ---
135
199
 
@@ -353,6 +417,94 @@ npx @mittwald/flow-codemods@latest password-tools-subpath-renamed src
353
417
 
354
418
  ---
355
419
 
420
+ <a id="tabs-navigation-usage-to-tab-navigation"></a>
421
+
422
+ ## Tabs restyled; navigation usage moves to TabNavigation
423
+
424
+ **Since `0.2.0-alpha.977`** · migration · manual change · also applies to
425
+ `@mittwald/flow-remote-react-components`
426
+
427
+ `Tabs` restyled: the tab list now fills the available width with equal-size tabs
428
+ and a shared, animated indicator that slides between them, instead of the
429
+ previous fit-content tabs that each carried their own hover/pressed/selected
430
+ background. Nothing else about `Tabs` changed — same props, same panels, same
431
+ collapsing behavior. If `Tabs` switches content within a page, there is nothing
432
+ to do; the new look applies on upgrade.
433
+
434
+ **Real navigation has a proper home now.** React Aria's `Tab` (which `TabTitle`
435
+ extends) accepts the same routing props as a plain link — `href`, `target`,
436
+ `routerOptions`, … — so a `Tabs` could always double as a navigation control:
437
+ give a `TabTitle` an `href` and selecting it pushed a real route change while
438
+ the row still looked and behaved like tabs otherwise. That usage only reached
439
+ for `Tabs` because nothing else looked right for it. Now there is
440
+ `TabNavigation`, introduced in the same version specifically for this case — and
441
+ it keeps the visual language the old `Tabs` used to have.
442
+
443
+ ```diff
444
+ - <Tabs selectedKey={pathname}>
445
+ - <Tab id="/apps">
446
+ - <TabTitle href="/apps">Apps</TabTitle>
447
+ - </Tab>
448
+ - <Tab id="/container">
449
+ - <TabTitle href="/container">Container</TabTitle>
450
+ - </Tab>
451
+ - </Tabs>
452
+ + <TabNavigation aria-label="Projekt-Navigation">
453
+ + <Link href="/apps" aria-current={pathname === "/apps" ? "page" : undefined}>
454
+ + Apps
455
+ + </Link>
456
+ + <Link
457
+ + href="/container"
458
+ + aria-current={pathname === "/container" ? "page" : undefined}
459
+ + >
460
+ + Container
461
+ + </Link>
462
+ + </TabNavigation>
463
+ ```
464
+
465
+ #### What moves and what doesn't
466
+
467
+ **The children.** `Tab` / `TabTitle` / the panel disappear; `TabNavigation`
468
+ takes plain `Link` children directly. There is no panel, because the destination
469
+ page's content lives on that route, not inside the component.
470
+
471
+ **The active state.** `selectedKey` / `defaultSelectedKey` / `onSelectionChange`
472
+ have no counterpart — `TabNavigation` does not track selection itself. Each
473
+ `Link` marks itself current with `aria-current="page"`, which the app's router
474
+ already knows how to derive (e.g. from the current pathname), the same way it
475
+ would for any other navigation link.
476
+
477
+ **Status icons.** An `AlertIcon` moves from inside `TabTitle` to inside the
478
+ `Link`.
479
+
480
+ **Collapsing.** The two do this differently. `Tabs` collapses all at once: as
481
+ soon as any tab stops fitting, the whole tab list turns into a single button
482
+ showing the active tab, which opens every tab in a context menu. `TabNavigation`
483
+ collapses incrementally: links are hidden one by one as space runs out, and only
484
+ those that no longer fit move into the "More" button's menu — the rest stay
485
+ visible as ordinary links.
486
+
487
+ There is no codemod: only the surrounding code knows whether a given `Tabs`
488
+ usage was real navigation (an `href` on `TabTitle`, or a route push from
489
+ `onSelectionChange`) or a genuine content switcher that merely looked similar
490
+ before this change — the two are indistinguishable from the source alone.
491
+
492
+ **Apply:** Tabs' rendering changed: the tab list now fills the available width
493
+ with equal-size tabs and a shared, animated indicator that slides between them,
494
+ replacing the previous fit-content tabs that each carried their own
495
+ hover/pressed/selected background. Nothing else about `Tabs` changed, and a
496
+ `Tabs` that switches content within a page needs no code change — the new look
497
+ applies on upgrade. Where `Tabs` was used to fake real navigation instead — a
498
+ `TabTitle` given an `href` (`Aria.Tab`'s routing props: `href`, `target`,
499
+ `routerOptions`, …) so selecting it pushed a real route change — replace it with
500
+ `TabNavigation`: plain `Link` children instead of `Tab`/`TabTitle`/panels,
501
+ `aria-current="page"` on the active `Link` instead of
502
+ `selectedKey`/`defaultSelectedKey`/`onSelectionChange`. `TabNavigation` keeps
503
+ the visual language the old `Tabs` used to have, because it now owns that use
504
+ case.
505
+
506
+ ---
507
+
356
508
  <a id="table-column-width-props"></a>
357
509
 
358
510
  ## TableColumn: `maxWidth` removed, `width` and `minWidth` retyped
@@ -774,9 +926,41 @@ prop. At runtime the old prop still works: `Action` maps it to `onAction` and
774
926
  logs a deprecation warning, and an explicit `onAction` wins. The fallback will
775
927
  be removed in a future major version.
776
928
 
777
- A codemod renames the prop on `Action`.
929
+ #### The type changed too
930
+
931
+ `onAction` is typed `ActionFn`, which is `(...args: unknown[]) => unknown`. A
932
+ function that declares a parameter of any narrower type is not assignable to it,
933
+ because the parameter would receive `unknown`:
934
+
935
+ ```
936
+ Type '(options?: CloseOptions | undefined) => void' is not assignable to type 'ActionFn'.
937
+ Types of parameters 'options' and 'args' are incompatible.
938
+ Type 'unknown' is not assignable to type 'CloseOptions | undefined'.
939
+ ```
940
+
941
+ Wrap the call instead of passing the reference:
942
+
943
+ ```diff
944
+ - <Action onAction={controller.close}>
945
+ + <Action onAction={() => controller.close()}>
946
+ ```
778
947
 
779
- **Apply:** Rename the `action` prop on `Action` to `onAction`.
948
+ Only function **references** are affected. An inline arrow
949
+ (`onAction={() => …}`), a zero-parameter function, and anything already
950
+ accepting `unknown` are all fine.
951
+
952
+ A codemod renames the prop. It deliberately does not wrap: whether the
953
+ referenced function declares a parameter cannot be decided from the source —
954
+ that needs type information — and wrapping everything would silently drop the
955
+ arguments `Action` passes to handlers that do accept them.
956
+
957
+ **Apply:** Rename the `action` prop on `Action` to `onAction`. Not only a
958
+ rename: the new prop is typed `ActionFn` (`(...args: unknown[]) => unknown`), so
959
+ a function _reference_ that declares a parameter no longer type-checks and needs
960
+ wrapping — `onAction={() => controller.close()}` rather than
961
+ `onAction={controller.close}`. Check every site where you passed a reference
962
+ rather than an inline arrow; the codemod renames the prop but cannot decide this
963
+ one from the source.
780
964
 
781
965
  ```shell
782
966
  npx @mittwald/flow-codemods@latest action-prop-to-on-action src