diff --git a/.agents/skills/apsara/references/composition.md b/.agents/skills/apsara/references/composition.md index c6c679642..635416cab 100644 --- a/.agents/skills/apsara/references/composition.md +++ b/.agents/skills/apsara/references/composition.md @@ -65,6 +65,8 @@ const [open, setOpen] = useState(false); ``` +Most change callbacks (`onValueChange`, `onOpenChange`, `onInputValueChange`, and the like) take the new value first and a details object second. Components that wrap Base UI pass Base UI's `eventDetails`. Other components pass their own `details`, for example `details.mode` on `ColorPicker` and `details.operation` on `FilterChip`. A few callbacks take only the value, for example CodeBlock `onValueChange` and ColorPicker `onModeChange`. Check the props table for the exact signature. + Several overlay roots (`Dialog`, `Menu`, `Popover`, `Tooltip`) also expose `createHandle` for advanced imperative open/close from outside the subtree — use only when a trigger can't live in the same tree. ## Select diff --git a/apps/www/src/content/docs/(overview)/upgrading.mdx b/apps/www/src/content/docs/(overview)/upgrading.mdx index 82f756aad..d7ca84e3b 100644 --- a/apps/www/src/content/docs/(overview)/upgrading.mdx +++ b/apps/www/src/content/docs/(overview)/upgrading.mdx @@ -7,6 +7,51 @@ One section per release, newest first, with only the changes that need action from you. The full record of every release, features and fixes included, is on [GitHub releases](https://github.com/raystack/apsara/releases). +## Unreleased: change callbacks get a details object + +The change callbacks below pass a second argument after the value. A +component that wraps Base UI passes Base UI's `eventDetails`. A component that +keeps its own state passes a `details` object with the same `reason` and +`event` fields, plus any field of its own. + +### 1. Update the three callbacks whose second argument changes + +| `onValueChange` | Before | After | +|---|---|---| +| `TextArea` | `(value, event)` | `(value, eventDetails)` | +| `ColorPicker` | `(value, mode)` | `(value, details)` | +| `FilterChip` | `(value, operation)` | `(value, details)` | + +TextArea's `event` was the React `ChangeEvent`. `eventDetails.event` is the +native event. ColorPicker's mode is `details.mode`, and FilterChip's operation +is `details.operation`. + +```tsx +// Before + save(value, mode)} /> + apply(value, operation)} /> +