+[feat] `BottomSheetSwitcher` and the `sheetId` prop of `BottomSheet` are deprecated. The replacement is already in this release: write each step of a multi-step flow as its own standalone `BottomSheet` with `isOpen`, driven by one state value that names the open step; closing the top sheet and opening the next in the same update runs the same replace handoff the switcher ran (entering step above, a taller retained step aligns down and fades after both motions, one steady scrim, focus into the new step and back to the flow's opener on close). Migration, per flow: (1) replace the `activeSheet` / `onActiveSheetChange` pair with one `step` state value; (2) give each step `isOpen={step === 'id'}` and `onOpenChange={isOpen => !isOpen && setStep(current => (current === 'id' ? null : current))}` in place of `sheetId="id"` (the guard keeps a step that is being replaced from clearing the step the person just chose); (3) remove the `BottomSheetSwitcher` wrapper, moving its `hasScrim` onto every step; (4) keep the step buttons as they were (`setStep('next')`). The handoff runs when the move is made from inside the open step (a step's own Continue or Back, or code while focus is in it); a step changed from a control outside the flow's sheets — a page control beside a `hasScrim={false}` flow, or code after focus has left the step — closes and opens with the sheets' own push and pop motion, where the switcher handed off on any `activeSheet` change. The switcher's other props map as follows: `onCancel` becomes a guarded `onOpenChange` on each step (one that ignores `false` while the flow must stay open), which keeps the step's dialog role — a standalone sheet reports Escape, the platform close, the scrim tap and the swipe all as `onOpenChange(false)` with no reason, so the guard holds the step open against all of them while it applies, where `onCancel` vetoed only the cancel request; a veto of Escape alone has no equivalent, and the only per-path lever is `purpose` (`form` keeps Escape and blocks the scrim tap and the swipe; `required` blocks all three and exposes the step as an `alertdialog`). A consumer `aria-label` / `aria-labelledby` becomes each step's `label`, which names its dialog. `ref`, `id`, `data-testid`, `className`, `style`, `xstyle` and the other dialog props have no dialog-level equivalent — a standalone sheet's `ref` and base props reach its panel `<div>` and its dialog is implementation — so a test or an anchor that needs the dialog queries the panel's `closest('dialog')`, and dialog-level styling is dropped. Flows that keep using the switcher keep working: a switcher flow used on its own behaves as released — with two fixes released alongside: a toast raised from a step now renders above the flow and can be pressed, and under reduced motion its steps' entrance, exit and handoff follow the reduced-motion rule (no travel; a cross-fade on touch, immediate otherwise) — and when it is stacked with other sheets the stacking behaviour of this release applies to it as one level (it recedes and is blocked when covered, shares the one scrim, stands down from dismissal while covered, and returns focus by the stacking rules). Its declarations and docs are marked `@deprecated` and its docs, templates and stories show only the replacement, until a future minor release removes it. Non-modal flows (`hasScrim={false}`) migrate the same way: non-modal sheets replace each other too.
0 commit comments