@cognitap/radiant 0.0.78 → 0.0.80

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 (232) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +6 -3
  3. package/RELEASE_POLICY.md +8 -19
  4. package/dist/library/charts/Charts.js +1 -1
  5. package/dist/library/charts/Charts.js.map +1 -1
  6. package/dist/library/components/Accordion/Accordion.js +1 -1
  7. package/dist/library/components/Accordion/Accordion.js.map +1 -1
  8. package/dist/library/components/Alert/Alert.js +1 -1
  9. package/dist/library/components/Alert/Alert.js.map +1 -1
  10. package/dist/library/components/AppShell/AppShell.js +1 -1
  11. package/dist/library/components/AppShell/AppShell.js.map +1 -1
  12. package/dist/library/components/AspectRatio/AspectRatio.js +1 -1
  13. package/dist/library/components/AspectRatio/AspectRatio.js.map +1 -1
  14. package/dist/library/components/Avatar/Avatar.js +1 -1
  15. package/dist/library/components/Avatar/Avatar.js.map +1 -1
  16. package/dist/library/components/Badge/Badge.js +1 -1
  17. package/dist/library/components/Badge/Badge.js.map +1 -1
  18. package/dist/library/components/Breadcrumb/Breadcrumb.js +1 -1
  19. package/dist/library/components/Breadcrumb/Breadcrumb.js.map +1 -1
  20. package/dist/library/components/Button/Button.js +1 -1
  21. package/dist/library/components/Button/Button.js.map +1 -1
  22. package/dist/library/components/ButtonGroup/ButtonGroup.js +1 -1
  23. package/dist/library/components/ButtonGroup/ButtonGroup.js.map +1 -1
  24. package/dist/library/components/Card/Card.js +1 -1
  25. package/dist/library/components/Card/Card.js.map +1 -1
  26. package/dist/library/components/Carousel/Carousel.js +6 -6
  27. package/dist/library/components/Carousel/Carousel.js.map +1 -1
  28. package/dist/library/components/Checkbox/Checkbox.js +1 -1
  29. package/dist/library/components/Checkbox/Checkbox.js.map +1 -1
  30. package/dist/library/components/CheckboxGroup/CheckboxGroup.js +1 -1
  31. package/dist/library/components/CheckboxGroup/CheckboxGroup.js.map +1 -1
  32. package/dist/library/components/CodeBlock/CodeBlock.js +1 -1
  33. package/dist/library/components/CodeBlock/CodeBlock.js.map +1 -1
  34. package/dist/library/components/Collapsible/Collapsible.js +1 -1
  35. package/dist/library/components/Collapsible/Collapsible.js.map +1 -1
  36. package/dist/library/components/Combobox/Combobox.js +1 -1
  37. package/dist/library/components/Combobox/Combobox.js.map +1 -1
  38. package/dist/library/components/Command/Command.js +1 -1
  39. package/dist/library/components/Command/Command.js.map +1 -1
  40. package/dist/library/components/ContextMenu/ContextMenu.js +1 -1
  41. package/dist/library/components/ContextMenu/ContextMenu.js.map +1 -1
  42. package/dist/library/components/Dialog/Dialog.js +1 -1
  43. package/dist/library/components/Dialog/Dialog.js.map +1 -1
  44. package/dist/library/components/Drawer/Drawer.js +1 -1
  45. package/dist/library/components/Drawer/Drawer.js.map +1 -1
  46. package/dist/library/components/EmptyState/EmptyState.js +1 -1
  47. package/dist/library/components/EmptyState/EmptyState.js.map +1 -1
  48. package/dist/library/components/Field/Field.js +1 -1
  49. package/dist/library/components/Field/Field.js.map +1 -1
  50. package/dist/library/components/Fieldset/Fieldset.js +1 -1
  51. package/dist/library/components/Fieldset/Fieldset.js.map +1 -1
  52. package/dist/library/components/FileInput/FileInput.js +1 -1
  53. package/dist/library/components/FileInput/FileInput.js.map +1 -1
  54. package/dist/library/components/Form/Form.d.ts +1 -1
  55. package/dist/library/components/Form/Form.d.ts.map +1 -1
  56. package/dist/library/components/Form/Form.js +8 -5
  57. package/dist/library/components/Form/Form.js.map +1 -1
  58. package/dist/library/components/HoverCard/HoverCard.js +1 -1
  59. package/dist/library/components/HoverCard/HoverCard.js.map +1 -1
  60. package/dist/library/components/InlineCode/InlineCode.js +1 -1
  61. package/dist/library/components/InlineCode/InlineCode.js.map +1 -1
  62. package/dist/library/components/Input/Input.js +1 -1
  63. package/dist/library/components/Input/Input.js.map +1 -1
  64. package/dist/library/components/InputGroup/InputGroup.js +1 -1
  65. package/dist/library/components/InputGroup/InputGroup.js.map +1 -1
  66. package/dist/library/components/Kbd/Kbd.js +1 -1
  67. package/dist/library/components/Kbd/Kbd.js.map +1 -1
  68. package/dist/library/components/Link/Link.js +1 -1
  69. package/dist/library/components/Link/Link.js.map +1 -1
  70. package/dist/library/components/Menu/Menu.js +1 -1
  71. package/dist/library/components/Menu/Menu.js.map +1 -1
  72. package/dist/library/components/Menubar/Menubar.js +1 -1
  73. package/dist/library/components/Menubar/Menubar.js.map +1 -1
  74. package/dist/library/components/Meter/Meter.js +1 -1
  75. package/dist/library/components/Meter/Meter.js.map +1 -1
  76. package/dist/library/components/NativeSelect/NativeSelect.js +1 -1
  77. package/dist/library/components/NativeSelect/NativeSelect.js.map +1 -1
  78. package/dist/library/components/NavLink/NavLink.js +1 -1
  79. package/dist/library/components/NavLink/NavLink.js.map +1 -1
  80. package/dist/library/components/NavigationMenu/NavigationMenu.d.ts +1 -6
  81. package/dist/library/components/NavigationMenu/NavigationMenu.d.ts.map +1 -1
  82. package/dist/library/components/NavigationMenu/NavigationMenu.js +62 -49
  83. package/dist/library/components/NavigationMenu/NavigationMenu.js.map +1 -1
  84. package/dist/library/components/NumberField/NumberField.js +1 -1
  85. package/dist/library/components/NumberField/NumberField.js.map +1 -1
  86. package/dist/library/components/OTPField/OTPField.js +1 -1
  87. package/dist/library/components/OTPField/OTPField.js.map +1 -1
  88. package/dist/library/components/Pagination/Pagination.js +1 -1
  89. package/dist/library/components/Pagination/Pagination.js.map +1 -1
  90. package/dist/library/components/PasswordInput/PasswordInput.js +1 -1
  91. package/dist/library/components/PasswordInput/PasswordInput.js.map +1 -1
  92. package/dist/library/components/Popover/Popover.js +1 -1
  93. package/dist/library/components/Popover/Popover.js.map +1 -1
  94. package/dist/library/components/Progress/Progress.js +1 -1
  95. package/dist/library/components/Progress/Progress.js.map +1 -1
  96. package/dist/library/components/RadioGroup/RadioGroup.js +1 -1
  97. package/dist/library/components/RadioGroup/RadioGroup.js.map +1 -1
  98. package/dist/library/components/Resizable/Resizable.d.ts +0 -2
  99. package/dist/library/components/Resizable/Resizable.d.ts.map +1 -1
  100. package/dist/library/components/Resizable/Resizable.js +7 -8
  101. package/dist/library/components/Resizable/Resizable.js.map +1 -1
  102. package/dist/library/components/ScrollArea/ScrollArea.js +1 -1
  103. package/dist/library/components/ScrollArea/ScrollArea.js.map +1 -1
  104. package/dist/library/components/Select/Select.js +1 -1
  105. package/dist/library/components/Select/Select.js.map +1 -1
  106. package/dist/library/components/Separator/Separator.js +1 -1
  107. package/dist/library/components/Separator/Separator.js.map +1 -1
  108. package/dist/library/components/Skeleton/Skeleton.js +1 -1
  109. package/dist/library/components/Skeleton/Skeleton.js.map +1 -1
  110. package/dist/library/components/Slider/Slider.js +1 -1
  111. package/dist/library/components/Slider/Slider.js.map +1 -1
  112. package/dist/library/components/Spinner/Spinner.js +1 -1
  113. package/dist/library/components/Spinner/Spinner.js.map +1 -1
  114. package/dist/library/components/Switch/Switch.js +1 -1
  115. package/dist/library/components/Switch/Switch.js.map +1 -1
  116. package/dist/library/components/Table/Table.js +1 -1
  117. package/dist/library/components/Table/Table.js.map +1 -1
  118. package/dist/library/components/Tabs/Tabs.js +1 -1
  119. package/dist/library/components/Tabs/Tabs.js.map +1 -1
  120. package/dist/library/components/Tag/Tag.js +1 -1
  121. package/dist/library/components/Tag/Tag.js.map +1 -1
  122. package/dist/library/components/TagsInput/TagsInput.js +1 -1
  123. package/dist/library/components/TagsInput/TagsInput.js.map +1 -1
  124. package/dist/library/components/Textarea/Textarea.js +1 -1
  125. package/dist/library/components/Textarea/Textarea.js.map +1 -1
  126. package/dist/library/components/ThemeScope/ThemeScope.js +1 -1
  127. package/dist/library/components/ThemeScope/ThemeScope.js.map +1 -1
  128. package/dist/library/components/Toast/Toast.js +1 -1
  129. package/dist/library/components/Toast/Toast.js.map +1 -1
  130. package/dist/library/components/ToggleGroup/ToggleGroup.js +3 -1
  131. package/dist/library/components/ToggleGroup/ToggleGroup.js.map +1 -1
  132. package/dist/library/components/Toolbar/Toolbar.js +1 -1
  133. package/dist/library/components/Toolbar/Toolbar.js.map +1 -1
  134. package/dist/library/components/Tooltip/Tooltip.js +1 -1
  135. package/dist/library/components/Tooltip/Tooltip.js.map +1 -1
  136. package/dist/library/index.d.ts +1 -1
  137. package/dist/library/index.d.ts.map +1 -1
  138. package/dist/library/index.js.map +1 -1
  139. package/dist/library/motion/MotionLink.js +1 -1
  140. package/dist/library/motion/MotionLink.js.map +1 -1
  141. package/dist/library/react/useComboboxPopup.d.ts.map +1 -1
  142. package/dist/library/react/useComboboxPopup.js +45 -6
  143. package/dist/library/react/useComboboxPopup.js.map +1 -1
  144. package/dist/library/react/useRovingFocus.d.ts.map +1 -1
  145. package/dist/library/react/useRovingFocus.js +76 -11
  146. package/dist/library/react/useRovingFocus.js.map +1 -1
  147. package/dist/library/react/useToastTimer.d.ts.map +1 -1
  148. package/dist/library/react/useToastTimer.js +28 -9
  149. package/dist/library/react/useToastTimer.js.map +1 -1
  150. package/dist/library/styles.css +1 -1
  151. package/docs/accessibility.md +23 -111
  152. package/docs/architecture.md +48 -242
  153. package/docs/motion.md +65 -130
  154. package/docs/theming.md +51 -427
  155. package/package.json +21 -13
  156. package/src/charts/Charts.tsx +1 -1
  157. package/src/components/Accordion/Accordion.tsx +1 -1
  158. package/src/components/Alert/Alert.tsx +1 -1
  159. package/src/components/AppShell/AppShell.tsx +1 -1
  160. package/src/components/AspectRatio/AspectRatio.tsx +1 -1
  161. package/src/components/Avatar/Avatar.tsx +1 -1
  162. package/src/components/Badge/Badge.tsx +1 -1
  163. package/src/components/Breadcrumb/Breadcrumb.tsx +1 -1
  164. package/src/components/Button/Button.tsx +1 -1
  165. package/src/components/ButtonGroup/ButtonGroup.tsx +1 -1
  166. package/src/components/Card/Card.tsx +1 -1
  167. package/src/components/Carousel/Carousel.tsx +6 -6
  168. package/src/components/Checkbox/Checkbox.tsx +1 -1
  169. package/src/components/CheckboxGroup/CheckboxGroup.tsx +1 -1
  170. package/src/components/CodeBlock/CodeBlock.tsx +1 -1
  171. package/src/components/Collapsible/Collapsible.tsx +1 -1
  172. package/src/components/Combobox/Combobox.tsx +1 -1
  173. package/src/components/Command/Command.tsx +1 -1
  174. package/src/components/ContextMenu/ContextMenu.tsx +1 -1
  175. package/src/components/Dialog/Dialog.tsx +1 -1
  176. package/src/components/Drawer/Drawer.tsx +1 -1
  177. package/src/components/EmptyState/EmptyState.tsx +1 -1
  178. package/src/components/Field/Field.tsx +1 -1
  179. package/src/components/Fieldset/Fieldset.tsx +1 -1
  180. package/src/components/FileInput/FileInput.tsx +1 -1
  181. package/src/components/Form/Form.tsx +9 -6
  182. package/src/components/HoverCard/HoverCard.tsx +1 -1
  183. package/src/components/InlineCode/InlineCode.tsx +1 -1
  184. package/src/components/Input/Input.tsx +1 -1
  185. package/src/components/InputGroup/InputGroup.tsx +1 -1
  186. package/src/components/Kbd/Kbd.tsx +1 -1
  187. package/src/components/Link/Link.tsx +1 -1
  188. package/src/components/Menu/Menu.tsx +1 -1
  189. package/src/components/Menubar/Menubar.tsx +1 -1
  190. package/src/components/Meter/Meter.tsx +1 -1
  191. package/src/components/NativeSelect/NativeSelect.tsx +1 -1
  192. package/src/components/NavLink/NavLink.tsx +1 -1
  193. package/src/components/NavigationMenu/NavigationMenu.tsx +77 -59
  194. package/src/components/NumberField/NumberField.tsx +1 -1
  195. package/src/components/OTPField/OTPField.tsx +1 -1
  196. package/src/components/Pagination/Pagination.tsx +1 -1
  197. package/src/components/PasswordInput/PasswordInput.tsx +1 -1
  198. package/src/components/Popover/Popover.tsx +1 -1
  199. package/src/components/Progress/Progress.tsx +1 -1
  200. package/src/components/RadioGroup/RadioGroup.tsx +1 -1
  201. package/src/components/Resizable/Resizable.tsx +10 -12
  202. package/src/components/ScrollArea/ScrollArea.tsx +1 -1
  203. package/src/components/Select/Select.tsx +1 -1
  204. package/src/components/Separator/Separator.tsx +1 -1
  205. package/src/components/Skeleton/Skeleton.tsx +1 -1
  206. package/src/components/Slider/Slider.tsx +1 -1
  207. package/src/components/Spinner/Spinner.tsx +1 -1
  208. package/src/components/Switch/Switch.tsx +1 -1
  209. package/src/components/Table/Table.tsx +1 -1
  210. package/src/components/Tabs/Tabs.tsx +1 -1
  211. package/src/components/Tag/Tag.tsx +1 -1
  212. package/src/components/TagsInput/TagsInput.tsx +1 -1
  213. package/src/components/Textarea/Textarea.tsx +1 -1
  214. package/src/components/ThemeScope/ThemeScope.tsx +1 -1
  215. package/src/components/Toast/Toast.tsx +1 -1
  216. package/src/components/ToggleGroup/ToggleGroup.tsx +3 -1
  217. package/src/components/Toolbar/Toolbar.tsx +1 -1
  218. package/src/components/Tooltip/Tooltip.tsx +1 -1
  219. package/src/css.d.ts +2 -0
  220. package/src/index.ts +0 -1
  221. package/src/motion/MotionLink.tsx +1 -1
  222. package/src/react/useComboboxPopup.ts +38 -6
  223. package/src/react/useRovingFocus.ts +73 -8
  224. package/src/react/useToastTimer.ts +24 -9
  225. package/src/styles.d.ts +1 -0
  226. package/src/themes/baseline.css +1 -1
  227. package/src/typography.css +17 -12
  228. package/dist/library/cn.d.ts +0 -3
  229. package/dist/library/cn.d.ts.map +0 -1
  230. package/dist/library/cn.js +0 -370
  231. package/dist/library/cn.js.map +0 -1
  232. package/src/cn.ts +0 -372
package/docs/motion.md CHANGED
@@ -1,10 +1,12 @@
1
1
  # Motion
2
2
 
3
- Radiant's spring motion is opt-in. It uses Motion's physics behind
4
- Radiant-owned bindings; see the [engine decision](adr/0001-spring-engine-boundaries.md).
5
- Import `@cognitap/radiant/motion` or `/motion/react` for the runtime.
3
+ Opt-in springs for Radiant components and your own elements. Functions are in `@cognitap/radiant/motion`. Hooks and components are in `@cognitap/radiant/motion/react`. Both wrap Motion's `springValue`. See [ADR 0001](adr/0001-spring-engine-boundaries.md).
6
4
 
7
- ## Theme profiles
5
+ `prefers-reduced-motion: reduce` disables spring animation. Duration and easing tokens still apply to CSS transitions.
6
+
7
+ ## Theme profile
8
+
9
+ A theme sets springs under `motion`:
8
10
 
9
11
  ```tsx
10
12
  const theme = defineTheme({
@@ -17,137 +19,70 @@ const theme = defineTheme({
17
19
  })
18
20
  ```
19
21
 
20
- | Field | Rule |
21
- | --------------------- | ----------------------------------------------------------------------------------- |
22
- | `spring` | Default 320 / 30 / 1. Stiffness and damping in (0, 10000], mass in (0, 100] |
23
- | `interactions.<name>` | `press`, `disclosure`, `dialog`, `follow`, `drag`, `layout`; each inherits `spring` |
24
- | `mode` | `system` (default) or `off` |
22
+ | Field | Rule |
23
+ | --------------------- | -------------------------------------------------------------------------------------- |
24
+ | `spring` | Default `320` / `30` / `1`. Stiffness and damping in `(0, 10000]`, mass in `(0, 100]` |
25
+ | `interactions.<name>` | `press`, `disclosure`, `dialog`, `follow`, `drag`, or `layout`; each inherits `spring` |
26
+ | `mode` | `system` (default) or `off` |
25
27
 
26
- Reduced motion always wins. ThemeScope inherits its
27
- theme's profile, and switching light or dark mode does not change it. Theme
28
- documents store it at `sections.motion.profile`. The CSS duration and easing
29
- tokens still drive ordinary CSS transitions.
28
+ `ThemeScope` keeps the profile across light and dark. Theme documents store it at `sections.motion.profile`.
30
29
 
31
30
  ## Component motion
32
31
 
33
- ```tsx
34
- import { MotionProvider, MotionLink } from '@cognitap/radiant/motion/react'
35
-
36
- ;<MotionProvider>
37
- <Button>Save</Button>
38
- <Button motion="off">No spring</Button>
39
- <MotionLink
40
- variant="solid"
41
- href="/account"
42
- >
43
- Account
44
- </MotionLink>
45
- </MotionProvider>
46
- ```
47
-
48
- `MotionProvider` adds no DOM. Inside it:
49
-
50
- - Button, DialogTrigger and DialogClose compress on press, using
51
- `--rad-button-press-scale` (default 0.97, range 0.5–1). Use `MotionLink` for
52
- action-shaped links; plain Link stays server-renderable. Only the active
53
- pointer or key releases its press.
54
- - Collapsible and Accordion animate natural height, including replacement and
55
- resized content. Closed content is inert immediately. Before hydration,
56
- native details controls visibility. Neither scales its children.
57
- - Dialog springs open and closes natively immediately. An inert copy finishes
58
- exit, bounded to 500 descendants and two seconds. Nested dialogs, media,
59
- canvas, embeds and custom elements (including customized built-ins) skip it.
60
- - Select reuses Button press and dialog springs for popup opacity. Closing is immediate.
61
-
62
- Set `motion="off"` on Button, MotionLink, Collapsible, SelectContent or DialogContent.
63
- Theme off and reduced motion suppress springs and CSS lift/shift. Pending and
64
- disabled cancel a held press; re-enabling never replays it. Native activation,
65
- focus and Escape stay immediate; `preventDefault` cancels compression.
66
- Caller scale utilities and inline scale/scale transitions opt out. Other scale
67
- styles need `motion="off"`. Explore [Link](../src/components/Link/Link.stories.tsx) and [Button](../src/components/Button/Button.stories.tsx).
68
-
69
- ## Hooks and functions
70
-
71
- | API | Entry | Use |
72
- | ---------------------------------------------- | --------------- | ------------------------------------------------------------------------------------------------- |
73
- | `createSpring(initial, options)` | `/motion` | A numeric spring: `to`, `jump`, `stop`, `get`, `getVelocity`, `subscribe`, `configure`, `destroy` |
74
- | `bindSpringStyle(el, spring, prop)` | `/motion` | Drive `scale`, `opacity`, `width`, `height`, `translateX` or `translateY` |
75
- | `useSpring`, `useSpringStyle` | `/motion/react` | The same, owned by a component and the theme profile |
76
- | `useReducedMotion` | `/motion/react` | The live system preference |
77
- | `useSpringFollow(target)` | `/motion/react` | Follow a changing number or a `SpringSource` (`get`, `subscribe`) |
78
- | `bindSpringSource(spring, source)` | `/motion` | The same, managed by hand |
79
- | `useSpringDrag(ref, initial, opts)` | `/motion/react` | One-axis drag with bounds and snap points |
80
- | `createSpringDrag`, `bindSpringDrag` | `/motion` | The same, managed by hand |
81
- | `useSpringLayout(ref)` | `/motion/react` | Animate resize and reorder of a grid or flex group |
82
- | `bindSpringLayout(root)`, `createLayoutSpring` | `/motion` | The same, managed by hand |
83
-
84
- Hooks follow the theme profile and reduced motion for you. With the plain
85
- functions, you pass `enabled` and call `destroy`.
86
-
87
- Rules for every spring:
88
-
89
- - Values are finite numbers in one unit. Convert percentages, colors and CSS
90
- variables first.
91
- - A new target keeps the current position and momentum. New physics apply once
92
- the spring rests.
93
- - With motion off or reduced, a spring jumps straight to its target, or to
94
- `reducedValue` if you set one.
95
- - A bound style property belongs to the spring until cleanup. Don't animate it
96
- or give it a CSS transition elsewhere. Cleanup restores the previous value.
97
- - Server rendering never animates, and hooks never store frames in React state.
98
-
99
- ## Drag
100
-
101
- Release velocity comes from recent pointer samples. The handle settles on the
102
- snap point nearest to where it would land 180ms ahead. Arrow keys move between
103
- snap points, Home and End go to the ends, and Escape cancels. A finished drag
104
- swallows the click that follows it. With reduced motion, dragging still works
105
- and only the settling is instant.
106
-
107
- ## Layout
32
+ Wrap a subtree in `MotionProvider`. It adds no DOM.
108
33
 
109
34
  ```tsx
110
- <div
111
- ref={root}
112
- className="grid grid-cols-2 gap-4"
113
- >
114
- {items.map(item => (
115
- <div
116
- key={item.id}
117
- data-rad-layout-slot=""
118
- className="flow-root"
119
- >
120
- <div data-rad-layout-part="">
121
- <Card>{item.title}</Card>
122
- </div>
123
- </div>
124
- ))}
125
- </div>
35
+ import { Button } from '@cognitap/radiant'
36
+ import { MotionLink, MotionProvider } from '@cognitap/radiant/motion/react'
37
+
38
+ export function AccountActions() {
39
+ return (
40
+ <MotionProvider>
41
+ <Button>Save</Button>
42
+ <Button motion="off">No spring</Button>
43
+ <MotionLink
44
+ variant="solid"
45
+ href="/account"
46
+ >
47
+ Account
48
+ </MotionLink>
49
+ </MotionProvider>
50
+ )
51
+ }
126
52
  ```
127
53
 
128
- Each direct child of the root is a slot with one part inside. Keep their keys
129
- stable. Text reflows at the animated width; nothing is scaled or cloned. Items
130
- that enter or leave appear at once.
131
-
132
- The [Card dashboard](../.storybook/examples/CardExamples.tsx) preserves styles and focus.
133
-
134
- - Slots carry no padding, border or positioning. Put decoration on the part,
135
- which needs no outer margin.
136
- - Don't transform, transition or position the slot or part yourself.
137
- - The root and its ancestors must not be scaled, rotated or zoomed.
138
- - Nested layout groups, sticky or fixed slots and shared-element morphs are not
139
- supported.
140
-
141
- React commits measure automatically. Call `measure()` after changing a slot's
142
- or part's own styles. Moving focus during a reorder is the application's job.
143
-
144
- Wrap Fields in dedicated parts with stable slots, as in the
145
- [Field example](../.storybook/examples/FieldExamples.tsx). Only surrounding space
146
- moves; errors and relationships stay immediate. Keep validation and focus in the
147
- consumer. The [Input editor](../.storybook/examples/InputExamples.tsx) springs a
148
- separate focus cue, preserving the native ring, caret and caller styles.
149
-
150
- The [Checkbox permissions example](../.storybook/examples/CheckboxExamples.tsx)
151
- uses `useSpring` and `parts.indicator` for decorative entry feedback. Checked and
152
- mixed semantics stay native. Disabled changes settle the glyph, and indicator
153
- customization takes ownership. The local adapter keeps frame writes outside React.
54
+ Examples:
55
+
56
+ | Component | Motion |
57
+ | ---------------------------------------- | --------------------------------------------------------------------------------- |
58
+ | `Button`, `DialogTrigger`, `DialogClose` | Compress on press to `--rad-button-press-scale` (default `0.97`, range `0.5`–`1`) |
59
+ | `MotionLink` | Press scale on button-styled links. `Link` stays server-renderable |
60
+ | `Collapsible`, `Accordion` | Animate height. Closed content is inert immediately |
61
+ | `Dialog` | Springs open. The `<dialog>` closes immediately. An inert clone finishes the exit |
62
+ | `Select` | Fade the popup in. Close immediately |
63
+
64
+ The exit clone is skipped when the dialog has more than 500 descendants, or when it contains a nested dialog, media, a canvas, an embed, or a custom element. The clone stops after 2 seconds.
65
+
66
+ Pass `motion="off"` on `Button`, `MotionLink`, `Collapsible`, `SelectContent`, or `DialogContent`. A caller `scale-*` class, inline `scale`, or scale transition also disables press scaling.
67
+
68
+ ## Spring API
69
+
70
+ | API | Entry | Purpose |
71
+ | ---------------------------------------------- | --------------- | ------------------------------------------------------------------------------- |
72
+ | `createSpring(initial, options)` | `/motion` | `to`, `jump`, `stop`, `get`, `getVelocity`, `subscribe`, `configure`, `destroy` |
73
+ | `bindSpringStyle(el, spring, prop)` | `/motion` | `scale`, `opacity`, `width`, `height`, `translateX`, `translateY` |
74
+ | `useSpring`, `useSpringStyle` | `/motion/react` | Theme profile and reduced motion |
75
+ | `useReducedMotion` | `/motion/react` | `prefers-reduced-motion` |
76
+ | `useSpringFollow(target)` | `/motion/react` | Follow a number or `SpringSource` (`{ get, subscribe }`) |
77
+ | `bindSpringSource(spring, source)` | `/motion` | `useSpringFollow` outside React |
78
+ | `useSpringDrag(ref, initial, opts)` | `/motion/react` | One-axis pointer and keyboard drag, with bounds and snap points |
79
+ | `createSpringDrag`, `bindSpringDrag` | `/motion` | Drag controller and element binding |
80
+ | `useSpringLayout(ref)` | `/motion/react` | Reorder and resize a flex or grid group |
81
+ | `bindSpringLayout(root)`, `createLayoutSpring` | `/motion` | Layout binding and a 4-axis spring |
82
+
83
+ - Values are finite numbers in one unit. Convert percentages, colors, and CSS variables first.
84
+ - `to(next)` keeps position and velocity. `configure` applies at rest.
85
+ - When motion is off or reduced, `to` jumps to `reducedValue ?? target`.
86
+ - `bindSpringStyle` writes its CSS property and restores the previous inline value on cleanup.
87
+ - Hooks do not write animation frames to React state.
88
+ - `useSpringLayout` measures each direct child marked `data-rad-layout-slot`. That child has one first-child `data-rad-layout-part`, no padding or border, and stays in normal flow.