You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e5725bf
Browse filesBrowse the repository at this point in the historyBrowse files
feat(v3): Tree, Toolbar, Pagination and Stepper composables (#2723) (#3074)
* feat(Pagination)!: usePagination composable with page change details (#2723)
The page model goes through useControllableState: a cancellable
beforeUpdate:page, update:page(value, details) with a
PaginationChangeReason, and no emit when the page is unchanged. The
parts are thin shells over shared surface builders; the root context's
page is read-only and onPageChange takes a reason and event.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(Stepper)!: useStepper composable with step change details (#2723)
The step model goes through useControllableState: a cancellable
beforeUpdate:modelValue, update:modelValue(value, details) with a
StepperChangeReason ('trigger-press', 'trigger-keydown', 'next-step',
'prev-step'), and no emit when the step is unchanged. Item, trigger,
title and description render from shared surface builders; the root
context's modelValue is read-only and changeModelValue takes a reason
and event.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(Toolbar): useToolbar composable (#2723)
Toolbar has no model: useToolbar returns the role="toolbar" surface,
button and link surfaces and the context. ToolbarToggleGroup keeps
forwarding ToggleGroupRoot's cancellable beforeUpdate:modelValue and
update:modelValue details; tests cover both.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(Tree)!: useTree composable with selection and expanded change details (#2723)
modelValue and expanded both go through useControllableState: a
cancellable beforeUpdate:*, update:*(value, details) with
TreeChangeReason ('item-press', 'item-keydown', 'range-select') or
TreeExpandedChangeReason ('item-press', 'item-keydown'), and no emit
when the value is unchanged (selections compare by getKey).
propagateSelect and bubbleSelect are folded into one change, so a press
emits once instead of up to three times. TreeItem renders from a shared
surface builder; TreeVirtualizer stays a component and passes its
keydown to range selection. The root context's modelValue and expanded
are read-only; onSelect/onToggle take a reason and event.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(Pagination): regenerate API meta for the Tree, Pagination and Stepper emits
Spell out PaginationList's slot union so the generated docs keep it
instead of the PaginationItem alias.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(Tree): migration notes for the Tree, Pagination, Stepper and Toolbar composables
Adds the roots to "Converted so far", the four reason unions, a
"Tree, Pagination and Stepper" section to the migration guide and
section 17 to the agent page.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(Tree): no duplicate keys with propagate/bubble select; context setters
bubbleSelect no longer appends a parent that is already selected, and
propagateSelect no longer appends children that are already selected.
v2 did both, so the next press removed only one copy and the item
stayed selected.
The root context gains setModelValue and setExpanded (single-emit
writes for custom select-all / expand-all parts), and types items as
T[] | undefined. The JSDoc no longer claims v2 emitted several times
per press (its deep watcher batched the writes), and the range-select
docs cover the TreeVirtualizer's Shift+Home/End/PageUp/PageDown/
ArrowLeft/ArrowRight.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(Pagination): keep the value attribute on PaginationListItem
v2 bound every prop onto the button, so it rendered value="N".
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(Stepper): block goToStep onto a disabled step; boolean slot types
goToStep read the trigger at [step] instead of [step - 1] and tested
the empty disabled attribute for truthiness, so it never blocked. It
now returns false and emits nothing for a disabled step.
The slot types goToStep/nextStep/prevStep as returning boolean, and
useStepper().getItem derives the title and description ids from a
reactive step.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(Tree): correct the emit-count claim; document the de-duplication, goToStep and context setters
v2 emitted once per propagated or bubbled press (its deep watcher
batched the writes), so the "up to three times" claim is dropped. What
changed is that the emit is synchronous, carries details and has one
cancellable beforeUpdate.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(Stepper): regenerate meta for the boolean slot navigation types
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(Stepper): read the item's disabled state in goToStep, not the stale attribute
The trigger's disabled attribute also encodes linear reachability and only
updates on the next render, so two synchronous nextStep() calls stopped at
step 2. Triggers now register a getter for their item's own disabled state.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/content/docs/guides/migration-v3-agent.md
+34-3Lines changed: 34 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -81,7 +81,7 @@ You are migrating a Vue project from Reka UI v2 to Reka UI v3. Work through the
81
81
82
82
**What changed.**`update:*` events on stateful roots now receive a second argument, a `ChangeEventDetails` object with `reason`, `event`, `isCanceled` and `cancel()`, and a cancellable `beforeUpdate:*` event fires before every change. `v-model` keeps working unchanged. Uncontrolled components emit synchronously from the interaction instead of from a watcher on the next tick, and a component that mounts uncontrolled and later receives a defined model value becomes controlled from then on, even if the model is later cleared to `undefined`.
83
83
84
-
Converted so far: `SwitchRoot`, `TabsRoot`, `Toggle`, `ToggleGroupRoot`, `CheckboxRoot`, `CheckboxGroupRoot`, `RadioGroupRoot`, `ListboxRoot`, `AccordionRoot` (`modelValue`), `DropdownMenuRoot`, `DropdownMenuSub`, `ContextMenuRoot`, `ContextMenuSub`, `MenubarRoot` (`modelValue`), `MenubarSub`, `DialogRoot`, `AlertDialogRoot`, `PopoverRoot`, `TooltipRoot`, `HoverCardRoot`, `CollapsibleRoot`, `DatePickerRoot` and `DateRangePickerRoot` (`open`, `view`), `CalendarRoot` and `RangeCalendarRoot` (`modelValue`, `placeholder`, `view`), `ColorAreaRoot`, `ColorFieldRoot`, `ColorSliderRoot` and `ColorSwatchPickerRoot` (`modelValue`), `ComboboxRoot` and `AutocompleteRoot` (`modelValue`, `open`; section 16), `NumberFieldRoot`, `PinInputRoot`, `RatingRoot`, `SliderRoot`, `TagsInputRoot`, `TagGroupRoot` and `EditableRoot` (`modelValue`; sections 17 and 18), and `SelectRoot` (`modelValue`, `open`; section 19). On the converted families an `update:*` event fires only when the value actually changes; re-selecting the current value emits nothing, and a multiple selection is compared entry by entry (a `ListboxRoot` with `multiple` and `selection-behavior="replace"` no longer emits a fresh `[value]` array for a re-pressed item). `ColorAreaRoot` also now emits `change` (declared but never fired in v2) on every pointer move and arrow-key step that changes the color, and `changeEnd` after each keyboard step as well as on pointer release; both carry a `Color` object (section 10). Treat every other family as still on the v2 single-argument shape; the [Migration to v3](./migration-v3) guide lists the families as they convert. `DrawerRoot` is not on this contract: its `update:open(value, details)` is unchanged from v2 (it fires before the change and `details.cancel()` inside it vetoes the change), it has no `beforeUpdate:open`, and `update:snapPoint` stays single-argument. Leave Drawer listeners unchanged.
84
+
Converted so far: `SwitchRoot`, `TabsRoot`, `Toggle`, `ToggleGroupRoot`, `CheckboxRoot`, `CheckboxGroupRoot`, `RadioGroupRoot`, `ListboxRoot`, `AccordionRoot` (`modelValue`), `DropdownMenuRoot`, `DropdownMenuSub`, `ContextMenuRoot`, `ContextMenuSub`, `MenubarRoot` (`modelValue`), `MenubarSub`, `DialogRoot`, `AlertDialogRoot`, `PopoverRoot`, `TooltipRoot`, `HoverCardRoot`, `CollapsibleRoot`, `DatePickerRoot` and `DateRangePickerRoot` (`open`, `view`), `CalendarRoot` and `RangeCalendarRoot` (`modelValue`, `placeholder`, `view`), `ColorAreaRoot`, `ColorFieldRoot`, `ColorSliderRoot` and `ColorSwatchPickerRoot` (`modelValue`), `ComboboxRoot` and `AutocompleteRoot` (`modelValue`, `open`; section 16), `NumberFieldRoot`, `PinInputRoot`, `RatingRoot`, `SliderRoot`, `TagsInputRoot`, `TagGroupRoot` and `EditableRoot` (`modelValue`; sections 17 and 18), `SelectRoot` (`modelValue`, `open`; section 19), `TreeRoot` (`modelValue`, `expanded`; section 21), `PaginationRoot` (`page`), `StepperRoot` (`modelValue`), and `ToolbarToggleGroup` (through the `ToggleGroupRoot` it wraps). On the converted families an `update:*` event fires only when the value actually changes; re-selecting the current value emits nothing, and a multiple selection is compared entry by entry (a `ListboxRoot` with `multiple` and `selection-behavior="replace"` no longer emits a fresh `[value]` array for a re-pressed item). `ColorAreaRoot` also now emits `change` (declared but never fired in v2) on every pointer move and arrow-key step that changes the color, and `changeEnd` after each keyboard step as well as on pointer release; both carry a `Color` object (section 10). Treat every other family as still on the v2 single-argument shape; the [Migration to v3](./migration-v3) guide lists the families as they convert. `DrawerRoot` is not on this contract: its `update:open(value, details)` is unchanged from v2 (it fires before the change and `details.cancel()` inside it vetoes the change), it has no `beforeUpdate:open`, and `update:snapPoint` stays single-argument. Leave Drawer listeners unchanged.
85
85
86
86
**How to find it.** Search for listeners and emit declarations on those roots: `@update:open`, `@update:model-value`, `@update:modelValue`, `@update:placeholder`, `'update:open'`, `'update:modelValue'`, `'update:placeholder'`, `onUpdate:open`, `onUpdate:modelValue`, `onUpdate:placeholder`, `defineEmits` in components that wrap one of the roots, `useForwardPropsEmits`, `emitted('update:open')` and `toHaveBeenCalledWith` in tests, and `watch(` calls that react to these models.
The reason unions, all exported from `reka-ui`, are `DialogOpenChangeReason` (also exported as `AlertDialogOpenChangeReason`), `PopoverOpenChangeReason`, `TooltipOpenChangeReason`, `HoverCardOpenChangeReason`, `MenuOpenChangeReason` (shared by the DropdownMenu, ContextMenu and Menubar parts, and also exported as `DropdownMenuOpenChangeReason`, `ContextMenuOpenChangeReason` and `MenubarChangeReason`), `SwitchChangeReason`, `TabsChangeReason`, `ToggleChangeReason`, `ToggleGroupChangeReason`, `CheckboxChangeReason`, `CheckboxGroupChangeReason`, `RadioGroupChangeReason`, `ListboxChangeReason`, `AccordionChangeReason`, `CollapsibleChangeReason`, `DatePickerOpenChangeReason`, `DateRangePickerOpenChangeReason`, `CalendarChangeReason`, `RangeCalendarChangeReason`, `ColorAreaChangeReason`, `ColorFieldChangeReason`, `ColorSliderChangeReason`, `ColorSwatchPickerChangeReason`, `ComboboxChangeReason`, `ComboboxOpenChangeReason` (the `open` reasons of both `ComboboxRoot` and `AutocompleteRoot`), `AutocompleteChangeReason`, `NumberFieldChangeReason`, `PinInputChangeReason`, `RatingChangeReason`, `SliderChangeReason`, `TagsInputChangeReason`, `TagGroupChangeReason`, `EditableChangeReason`, `SelectChangeReason` and `SelectOpenChangeReason`. `details.reason` is the family union plus the shared `BaseChangeReason` (`'imperative-action'` for programmatic changes such as a slot's `close()`), so a `switch` over the family union alone is incomplete.
100
+
The reason unions, all exported from `reka-ui`, are `DialogOpenChangeReason` (also exported as `AlertDialogOpenChangeReason`), `PopoverOpenChangeReason`, `TooltipOpenChangeReason`, `HoverCardOpenChangeReason`, `MenuOpenChangeReason` (shared by the DropdownMenu, ContextMenu and Menubar parts, and also exported as `DropdownMenuOpenChangeReason`, `ContextMenuOpenChangeReason` and `MenubarChangeReason`), `SwitchChangeReason`, `TabsChangeReason`, `ToggleChangeReason`, `ToggleGroupChangeReason`, `CheckboxChangeReason`, `CheckboxGroupChangeReason`, `RadioGroupChangeReason`, `ListboxChangeReason`, `AccordionChangeReason`, `CollapsibleChangeReason`, `DatePickerOpenChangeReason`, `DateRangePickerOpenChangeReason`, `CalendarChangeReason`, `RangeCalendarChangeReason`, `ColorAreaChangeReason`, `ColorFieldChangeReason`, `ColorSliderChangeReason`, `ColorSwatchPickerChangeReason`, `ComboboxChangeReason`, `ComboboxOpenChangeReason` (the `open` reasons of both `ComboboxRoot` and `AutocompleteRoot`), `AutocompleteChangeReason`, `NumberFieldChangeReason`, `PinInputChangeReason`, `RatingChangeReason`, `SliderChangeReason`, `TagsInputChangeReason`, `TagGroupChangeReason`, `EditableChangeReason`, `SelectChangeReason`, `SelectOpenChangeReason`, `TreeChangeReason`, `TreeExpandedChangeReason`, `PaginationChangeReason` and `StepperChangeReason`. `ToolbarToggleGroup` reports `ToggleGroupChangeReason`. `details.reason` is the family union plus the shared `BaseChangeReason` (`'imperative-action'` for programmatic changes such as a slot's `close()`), so a `switch` over the family union alone is incomplete.
101
101
- Wrappers that forward with `useForwardPropsEmits` need no change.
102
102
- Custom parts built on `injectAccordionRootContext()` or `injectCollapsibleRootContext()`: the Accordion root context's `modelValue` is now a readonly `ComputedRef`, so call `changeModelValue` instead of assigning it, and `changeModelValue(value, reason?, event?)` now takes an optional reason and native event and returns a boolean (`false` when the change was cancelled or did not change the value). On the Collapsible root context, `onOpenToggle(event?)` accepts the native event, `onContentFound(event)` is new, and `contentId` is backed by a ref, so assigning it also updates the trigger's `aria-controls`.
103
103
- Tests: an assertion such as `expect(emit).toHaveBeenCalledWith(true)` or `expect(wrapper.emitted('update:open')[0]).toEqual([true])` now fails because of the extra argument. Assert on the first element (`[0][0]`) or use `expect.objectContaining({ reason:'…' })` for the details. Tests that awaited a tick for an uncontrolled emit may now see it synchronously; remove waits only if the test's intent is unchanged.
- `goToStep(step)`ontoadisabledstep (its`StepperItem`has`disabled`) isblocked:itreturns`false`andemitsnothing. v2's check never fired, so it moved there.
- In-placemutationofatree's selection or expanded array: `.push(`, `.splice(`, `.pop(` on the `TreeRoot` slot's`modelValue` / `expanded`oronthebound`v-model`array.
0 commit comments