@cognitap/radiant 0.0.7 → 0.0.8

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 (57) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +2 -2
  3. package/dist/library/Select.d.ts +87 -0
  4. package/dist/library/Select.d.ts.map +1 -0
  5. package/dist/library/Select.js +454 -0
  6. package/dist/library/Select.js.map +1 -0
  7. package/dist/library/cn.d.ts.map +1 -1
  8. package/dist/library/cn.js +20 -3
  9. package/dist/library/cn.js.map +1 -1
  10. package/dist/library/examples/glass.d.ts.map +1 -1
  11. package/dist/library/examples/glass.js +5 -0
  12. package/dist/library/examples/glass.js.map +1 -1
  13. package/dist/library/index.d.ts +2 -0
  14. package/dist/library/index.d.ts.map +1 -1
  15. package/dist/library/index.js +1 -0
  16. package/dist/library/index.js.map +1 -1
  17. package/dist/library/internal/select.d.ts +37 -0
  18. package/dist/library/internal/select.d.ts.map +1 -0
  19. package/dist/library/internal/select.js +42 -0
  20. package/dist/library/internal/select.js.map +1 -0
  21. package/dist/library/motion/host.d.ts +2 -1
  22. package/dist/library/motion/host.d.ts.map +1 -1
  23. package/dist/library/motion/host.js.map +1 -1
  24. package/dist/library/motion/popup.d.ts +5 -0
  25. package/dist/library/motion/popup.d.ts.map +1 -0
  26. package/dist/library/motion/popup.js +60 -0
  27. package/dist/library/motion/popup.js.map +1 -0
  28. package/dist/library/motion/react.d.ts.map +1 -1
  29. package/dist/library/motion/react.js +3 -1
  30. package/dist/library/motion/react.js.map +1 -1
  31. package/dist/library/react/useControllableState.d.ts +1 -0
  32. package/dist/library/react/useControllableState.d.ts.map +1 -1
  33. package/dist/library/react/useControllableState.js +8 -1
  34. package/dist/library/react/useControllableState.js.map +1 -1
  35. package/dist/library/selectStyles.d.ts +4 -0
  36. package/dist/library/selectStyles.d.ts.map +1 -0
  37. package/dist/library/selectStyles.js +32 -0
  38. package/dist/library/selectStyles.js.map +1 -0
  39. package/dist/library/styles.css +1 -1
  40. package/dist/library/themes/components.d.ts +24 -0
  41. package/dist/library/themes/components.d.ts.map +1 -1
  42. package/dist/library/themes/components.js +24 -0
  43. package/dist/library/themes/components.js.map +1 -1
  44. package/docs/architecture.md +14 -3
  45. package/docs/motion.md +4 -4
  46. package/package.json +1 -1
  47. package/src/Select.tsx +781 -0
  48. package/src/cn.ts +20 -3
  49. package/src/examples/glass.ts +5 -0
  50. package/src/index.ts +27 -0
  51. package/src/internal/select.ts +80 -0
  52. package/src/motion/host.ts +2 -1
  53. package/src/motion/popup.ts +55 -0
  54. package/src/motion/react.ts +3 -1
  55. package/src/react/useControllableState.ts +7 -1
  56. package/src/selectStyles.ts +34 -0
  57. package/src/themes/components.ts +24 -0
@@ -1,10 +1,10 @@
1
1
  # Architecture
2
2
 
3
- How Radiant's ten families fit together and why. Props are on the
3
+ How Radiant's eleven families fit together and why. Props are on the
4
4
  [docs site](https://github.com/cognitap/radiant-docs); themes are in [theming](theming.md); springs are in
5
5
  [motion](motion.md).
6
6
 
7
- The families are Button, Link, Field, Input, Checkbox, RadioGroup (with Radio),
7
+ The families are Button, Link, Field, Input, Select, Checkbox, RadioGroup (with Radio),
8
8
  Dialog, Collapsible, Accordion and Card. All ship in one package,
9
9
  `@cognitap/radiant`. Deep imports are unsupported.
10
10
 
@@ -21,7 +21,9 @@ Each piece of behavior has one owner:
21
21
  | Content, validation, routing, fetching and persistence | The consumer |
22
22
 
23
23
  Why: the browser already gets keyboard, focus and form behavior right.
24
- Radiant wraps native elements and has no headless-library dependency.
24
+ Radiant has no headless-library dependency. Select owns its themed listbox and
25
+ item focus, while a visually hidden native select supplies form semantics.
26
+ Its local portal uses the top layer, preserving theme inheritance and modal ancestry.
25
27
 
26
28
  Import rules:
27
29
 
@@ -96,6 +98,8 @@ host, never a wrapper:
96
98
  | Button / Link | `button` / `a`, including through `render` |
97
99
  | Field | `div` in control layout; `fieldset` in group layout |
98
100
  | Input / Checkbox / Radio | Native `input` |
101
+ | Select / SelectPortal | None; state / portal |
102
+ | SelectTrigger / SelectContent / SelectViewport / SelectItem | Button's `button` / `div` / `div` / `div` |
99
103
  | RadioGroup | Field's `fieldset` |
100
104
  | Dialog | None; it only owns state |
101
105
  | DialogTrigger / DialogClose | Button's `button` |
@@ -134,6 +138,7 @@ may refuse it. No-op requests and prop syncs fire no callback.
134
138
  | Input | `value` / `defaultValue` | Native `onChange`, `onBlur` | `''` |
135
139
  | Checkbox, standalone Radio | `checked` / `defaultChecked` | Native `onChange`, `onBlur` | `false` |
136
140
  | RadioGroup | `value` / `defaultValue` | `onValueChange(string)` or native `onChange` | `null` |
141
+ | Select | `value` / `defaultValue` | `onValueChange(string \| null)` | `null` |
137
142
  | Dialog, Collapsible | `open` / `defaultOpen` | `onOpenChange(boolean)` | `false` |
138
143
  | Accordion single | `value` / `defaultValue` | `onValueChange(string \| null)` | `null` |
139
144
  | Accordion multiple | `value` / `defaultValue` | `onValueChange(string[])` | `[]` |
@@ -153,6 +158,12 @@ resets its own values. Reset never changes Dialog or disclosure state. Why: form
153
158
  libraries differ, and Radiant should fit any of them without a hidden form
154
159
  store. TanStack Form is an optional example adapter, not a dependency.
155
160
 
161
+ Select takes one `items` registry for SSR labels, native options and typeahead.
162
+ Rich labels supply `textValue`. The focused option and committed value are
163
+ distinct; activation commits, Escape dismisses and restores trigger focus.
164
+ Native reset silently restores uncontrolled selection. Controlled resets stay
165
+ with the owner. User selections emit form change; prop syncs do not.
166
+
156
167
  ## Replacement and events
157
168
 
158
169
  Button, Link and the Dialog actions accept `render(resolvedProps)`. Forward all
package/docs/motion.md CHANGED
@@ -2,8 +2,7 @@
2
2
 
3
3
  Radiant's spring motion is opt-in. It uses Motion's physics behind
4
4
  Radiant-owned bindings; see the [engine decision](adr/0001-spring-engine-boundaries.md).
5
- The root package carries only configuration and types. Import
6
- `@cognitap/radiant/motion` or `/motion/react` to use the runtime.
5
+ Import `@cognitap/radiant/motion` or `/motion/react` for the runtime.
7
6
 
8
7
  ## Theme profiles
9
8
 
@@ -24,7 +23,7 @@ const theme = defineTheme({
24
23
  | `interactions.<name>` | `press`, `disclosure`, `dialog`, `follow`, `drag`, `layout`; each inherits `spring` |
25
24
  | `mode` | `system` (default) or `off` |
26
25
 
27
- The system reduced-motion setting always wins. A nested ThemeScope inherits its
26
+ Reduced motion always wins. ThemeScope inherits its
28
27
  theme's profile, and switching light or dark mode does not change it. Theme
29
28
  documents store it at `sections.motion.profile`. The CSS duration and easing
30
29
  tokens still drive ordinary CSS transitions.
@@ -58,8 +57,9 @@ import { MotionProvider, MotionLink } from '@cognitap/radiant/motion/react'
58
57
  - Dialog springs open and closes natively immediately. An inert copy finishes
59
58
  exit, bounded to 500 descendants and two seconds. Nested dialogs, media,
60
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
61
 
62
- Set `motion="off"` on Button, MotionLink, Collapsible or DialogContent.
62
+ Set `motion="off"` on Button, MotionLink, Collapsible, SelectContent or DialogContent.
63
63
  Theme off and reduced motion suppress springs and CSS lift/shift. Pending and
64
64
  disabled cancel a held press; re-enabling never replays it. Native activation,
65
65
  focus and Escape stay immediate; `preventDefault` cancels compression.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cognitap/radiant",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "React interaction components and presentation primitives",
5
5
  "homepage": "https://radiant-docs.pages.dev",
6
6
  "bugs": {