@cognitap/radiant 0.0.78 → 0.0.79

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 (222) hide show
  1. package/CHANGELOG.md +11 -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.js +4 -4
  55. package/dist/library/components/Form/Form.js.map +1 -1
  56. package/dist/library/components/HoverCard/HoverCard.js +1 -1
  57. package/dist/library/components/HoverCard/HoverCard.js.map +1 -1
  58. package/dist/library/components/InlineCode/InlineCode.js +1 -1
  59. package/dist/library/components/InlineCode/InlineCode.js.map +1 -1
  60. package/dist/library/components/Input/Input.js +1 -1
  61. package/dist/library/components/Input/Input.js.map +1 -1
  62. package/dist/library/components/InputGroup/InputGroup.js +1 -1
  63. package/dist/library/components/InputGroup/InputGroup.js.map +1 -1
  64. package/dist/library/components/Kbd/Kbd.js +1 -1
  65. package/dist/library/components/Kbd/Kbd.js.map +1 -1
  66. package/dist/library/components/Link/Link.js +1 -1
  67. package/dist/library/components/Link/Link.js.map +1 -1
  68. package/dist/library/components/Menu/Menu.js +1 -1
  69. package/dist/library/components/Menu/Menu.js.map +1 -1
  70. package/dist/library/components/Menubar/Menubar.js +1 -1
  71. package/dist/library/components/Menubar/Menubar.js.map +1 -1
  72. package/dist/library/components/Meter/Meter.js +1 -1
  73. package/dist/library/components/Meter/Meter.js.map +1 -1
  74. package/dist/library/components/NativeSelect/NativeSelect.js +1 -1
  75. package/dist/library/components/NativeSelect/NativeSelect.js.map +1 -1
  76. package/dist/library/components/NavLink/NavLink.js +1 -1
  77. package/dist/library/components/NavLink/NavLink.js.map +1 -1
  78. package/dist/library/components/NavigationMenu/NavigationMenu.js +1 -1
  79. package/dist/library/components/NavigationMenu/NavigationMenu.js.map +1 -1
  80. package/dist/library/components/NumberField/NumberField.js +1 -1
  81. package/dist/library/components/NumberField/NumberField.js.map +1 -1
  82. package/dist/library/components/OTPField/OTPField.js +1 -1
  83. package/dist/library/components/OTPField/OTPField.js.map +1 -1
  84. package/dist/library/components/Pagination/Pagination.js +1 -1
  85. package/dist/library/components/Pagination/Pagination.js.map +1 -1
  86. package/dist/library/components/PasswordInput/PasswordInput.js +1 -1
  87. package/dist/library/components/PasswordInput/PasswordInput.js.map +1 -1
  88. package/dist/library/components/Popover/Popover.js +1 -1
  89. package/dist/library/components/Popover/Popover.js.map +1 -1
  90. package/dist/library/components/Progress/Progress.js +1 -1
  91. package/dist/library/components/Progress/Progress.js.map +1 -1
  92. package/dist/library/components/RadioGroup/RadioGroup.js +1 -1
  93. package/dist/library/components/RadioGroup/RadioGroup.js.map +1 -1
  94. package/dist/library/components/Resizable/Resizable.js +1 -1
  95. package/dist/library/components/Resizable/Resizable.js.map +1 -1
  96. package/dist/library/components/ScrollArea/ScrollArea.js +1 -1
  97. package/dist/library/components/ScrollArea/ScrollArea.js.map +1 -1
  98. package/dist/library/components/Select/Select.js +1 -1
  99. package/dist/library/components/Select/Select.js.map +1 -1
  100. package/dist/library/components/Separator/Separator.js +1 -1
  101. package/dist/library/components/Separator/Separator.js.map +1 -1
  102. package/dist/library/components/Skeleton/Skeleton.js +1 -1
  103. package/dist/library/components/Skeleton/Skeleton.js.map +1 -1
  104. package/dist/library/components/Slider/Slider.js +1 -1
  105. package/dist/library/components/Slider/Slider.js.map +1 -1
  106. package/dist/library/components/Spinner/Spinner.js +1 -1
  107. package/dist/library/components/Spinner/Spinner.js.map +1 -1
  108. package/dist/library/components/Switch/Switch.js +1 -1
  109. package/dist/library/components/Switch/Switch.js.map +1 -1
  110. package/dist/library/components/Table/Table.js +1 -1
  111. package/dist/library/components/Table/Table.js.map +1 -1
  112. package/dist/library/components/Tabs/Tabs.js +1 -1
  113. package/dist/library/components/Tabs/Tabs.js.map +1 -1
  114. package/dist/library/components/Tag/Tag.js +1 -1
  115. package/dist/library/components/Tag/Tag.js.map +1 -1
  116. package/dist/library/components/TagsInput/TagsInput.js +1 -1
  117. package/dist/library/components/TagsInput/TagsInput.js.map +1 -1
  118. package/dist/library/components/Textarea/Textarea.js +1 -1
  119. package/dist/library/components/Textarea/Textarea.js.map +1 -1
  120. package/dist/library/components/ThemeScope/ThemeScope.js +1 -1
  121. package/dist/library/components/ThemeScope/ThemeScope.js.map +1 -1
  122. package/dist/library/components/Toast/Toast.js +1 -1
  123. package/dist/library/components/Toast/Toast.js.map +1 -1
  124. package/dist/library/components/ToggleGroup/ToggleGroup.js +3 -1
  125. package/dist/library/components/ToggleGroup/ToggleGroup.js.map +1 -1
  126. package/dist/library/components/Toolbar/Toolbar.js +1 -1
  127. package/dist/library/components/Toolbar/Toolbar.js.map +1 -1
  128. package/dist/library/components/Tooltip/Tooltip.js +1 -1
  129. package/dist/library/components/Tooltip/Tooltip.js.map +1 -1
  130. package/dist/library/motion/MotionLink.js +1 -1
  131. package/dist/library/motion/MotionLink.js.map +1 -1
  132. package/dist/library/react/useComboboxPopup.d.ts.map +1 -1
  133. package/dist/library/react/useComboboxPopup.js +45 -6
  134. package/dist/library/react/useComboboxPopup.js.map +1 -1
  135. package/dist/library/react/useRovingFocus.d.ts.map +1 -1
  136. package/dist/library/react/useRovingFocus.js +76 -11
  137. package/dist/library/react/useRovingFocus.js.map +1 -1
  138. package/dist/library/react/useToastTimer.d.ts.map +1 -1
  139. package/dist/library/react/useToastTimer.js +28 -9
  140. package/dist/library/react/useToastTimer.js.map +1 -1
  141. package/dist/library/styles.css +1 -1
  142. package/docs/accessibility.md +23 -111
  143. package/docs/architecture.md +48 -242
  144. package/docs/motion.md +65 -130
  145. package/docs/theming.md +51 -427
  146. package/package.json +21 -13
  147. package/src/charts/Charts.tsx +1 -1
  148. package/src/components/Accordion/Accordion.tsx +1 -1
  149. package/src/components/Alert/Alert.tsx +1 -1
  150. package/src/components/AppShell/AppShell.tsx +1 -1
  151. package/src/components/AspectRatio/AspectRatio.tsx +1 -1
  152. package/src/components/Avatar/Avatar.tsx +1 -1
  153. package/src/components/Badge/Badge.tsx +1 -1
  154. package/src/components/Breadcrumb/Breadcrumb.tsx +1 -1
  155. package/src/components/Button/Button.tsx +1 -1
  156. package/src/components/ButtonGroup/ButtonGroup.tsx +1 -1
  157. package/src/components/Card/Card.tsx +1 -1
  158. package/src/components/Carousel/Carousel.tsx +6 -6
  159. package/src/components/Checkbox/Checkbox.tsx +1 -1
  160. package/src/components/CheckboxGroup/CheckboxGroup.tsx +1 -1
  161. package/src/components/CodeBlock/CodeBlock.tsx +1 -1
  162. package/src/components/Collapsible/Collapsible.tsx +1 -1
  163. package/src/components/Combobox/Combobox.tsx +1 -1
  164. package/src/components/Command/Command.tsx +1 -1
  165. package/src/components/ContextMenu/ContextMenu.tsx +1 -1
  166. package/src/components/Dialog/Dialog.tsx +1 -1
  167. package/src/components/Drawer/Drawer.tsx +1 -1
  168. package/src/components/EmptyState/EmptyState.tsx +1 -1
  169. package/src/components/Field/Field.tsx +1 -1
  170. package/src/components/Fieldset/Fieldset.tsx +1 -1
  171. package/src/components/FileInput/FileInput.tsx +1 -1
  172. package/src/components/Form/Form.tsx +4 -4
  173. package/src/components/HoverCard/HoverCard.tsx +1 -1
  174. package/src/components/InlineCode/InlineCode.tsx +1 -1
  175. package/src/components/Input/Input.tsx +1 -1
  176. package/src/components/InputGroup/InputGroup.tsx +1 -1
  177. package/src/components/Kbd/Kbd.tsx +1 -1
  178. package/src/components/Link/Link.tsx +1 -1
  179. package/src/components/Menu/Menu.tsx +1 -1
  180. package/src/components/Menubar/Menubar.tsx +1 -1
  181. package/src/components/Meter/Meter.tsx +1 -1
  182. package/src/components/NativeSelect/NativeSelect.tsx +1 -1
  183. package/src/components/NavLink/NavLink.tsx +1 -1
  184. package/src/components/NavigationMenu/NavigationMenu.tsx +1 -1
  185. package/src/components/NumberField/NumberField.tsx +1 -1
  186. package/src/components/OTPField/OTPField.tsx +1 -1
  187. package/src/components/Pagination/Pagination.tsx +1 -1
  188. package/src/components/PasswordInput/PasswordInput.tsx +1 -1
  189. package/src/components/Popover/Popover.tsx +1 -1
  190. package/src/components/Progress/Progress.tsx +1 -1
  191. package/src/components/RadioGroup/RadioGroup.tsx +1 -1
  192. package/src/components/Resizable/Resizable.tsx +1 -1
  193. package/src/components/ScrollArea/ScrollArea.tsx +1 -1
  194. package/src/components/Select/Select.tsx +1 -1
  195. package/src/components/Separator/Separator.tsx +1 -1
  196. package/src/components/Skeleton/Skeleton.tsx +1 -1
  197. package/src/components/Slider/Slider.tsx +1 -1
  198. package/src/components/Spinner/Spinner.tsx +1 -1
  199. package/src/components/Switch/Switch.tsx +1 -1
  200. package/src/components/Table/Table.tsx +1 -1
  201. package/src/components/Tabs/Tabs.tsx +1 -1
  202. package/src/components/Tag/Tag.tsx +1 -1
  203. package/src/components/TagsInput/TagsInput.tsx +1 -1
  204. package/src/components/Textarea/Textarea.tsx +1 -1
  205. package/src/components/ThemeScope/ThemeScope.tsx +1 -1
  206. package/src/components/Toast/Toast.tsx +1 -1
  207. package/src/components/ToggleGroup/ToggleGroup.tsx +3 -1
  208. package/src/components/Toolbar/Toolbar.tsx +1 -1
  209. package/src/components/Tooltip/Tooltip.tsx +1 -1
  210. package/src/css.d.ts +2 -0
  211. package/src/motion/MotionLink.tsx +1 -1
  212. package/src/react/useComboboxPopup.ts +38 -6
  213. package/src/react/useRovingFocus.ts +73 -8
  214. package/src/react/useToastTimer.ts +24 -9
  215. package/src/styles.d.ts +1 -0
  216. package/src/themes/baseline.css +1 -1
  217. package/src/typography.css +17 -12
  218. package/dist/library/cn.d.ts +0 -3
  219. package/dist/library/cn.d.ts.map +0 -1
  220. package/dist/library/cn.js +0 -370
  221. package/dist/library/cn.js.map +0 -1
  222. package/src/cn.ts +0 -372
package/docs/theming.md CHANGED
@@ -1,15 +1,12 @@
1
1
  # Theming
2
2
 
3
- Radiant has one theme model. Shared tokens define the design system, and
4
- component overrides are deliberate exceptions. For how this fits the rest of the
5
- library, see [architecture](architecture.md).
3
+ Shared tokens set the design system. Component overrides are per-family exceptions. Keep the contracts in [architecture](architecture.md#customization-limits).
6
4
 
7
- Import `@cognitap/radiant/styles.css` once. It gives every component a neutral
8
- light and dark baseline without a provider. Tailwind applications can use the
9
- [source route](../README.md#with-tailwind) instead; both read the same theme
10
- variables.
5
+ ## Setup
11
6
 
12
- ## Make a theme
7
+ Import `@cognitap/radiant/styles.css` once, or `@cognitap/radiant/tailwind.css` in a Tailwind build (see the [README](../README.md#with-tailwind)). Components then use the neutral light and dark baseline, with no provider.
8
+
9
+ ## Define a theme
13
10
 
14
11
  ```tsx
15
12
  import { defineTheme } from '@cognitap/radiant'
@@ -32,20 +29,13 @@ const garden = defineTheme({
32
29
  })
33
30
  ```
34
31
 
35
- `id` is a stable lowercase slug; store and select themes by it. `name` is the
36
- display label. Every field is a typed partial override of the library defaults,
37
- and the result is immutable, JSON-serializable data.
38
-
39
- Unknown groups, roles, components or keys fail the type check and throw at
40
- runtime. Values are CSS strings, weights may be numbers, and opacities are
41
- numbers from 0 to 1. Radiant does not check CSS grammar or contrast:
42
- `var(--brand)` is accepted as is.
32
+ - `id` is a lowercase slug. `name` is the display label.
33
+ - Every field is a typed partial of the library defaults. Unknown keys fail typechecking and throw at runtime.
34
+ - The returned `Theme` is frozen and JSON-serializable.
35
+ - Each mode resolves library defaults, then common `tokens` and `components`, then `modes.<mode>`. A shared color has to work in both modes.
36
+ - Token paths are in [`src/themes/tokens.ts`](../src/themes/tokens.ts). Component override keys are in [`src/themes/components.ts`](../src/themes/components.ts).
43
37
 
44
- Each mode resolves as **library mode defaults → common values → that mode's
45
- values**. Put a color in common `tokens` only if it works in both modes;
46
- otherwise give its dark value too.
47
-
48
- ## Apply it
38
+ ## Apply a theme
49
39
 
50
40
  ```tsx
51
41
  import { Button, ThemeScope, defaultTheme } from '@cognitap/radiant'
@@ -61,434 +51,68 @@ import { Button, ThemeScope, defaultTheme } from '@cognitap/radiant'
61
51
  </ThemeScope>
62
52
  ```
63
53
 
64
- `ThemeScope` is a plain `div` that takes native props and a ref. It paints its
65
- canvas, foreground and body text for its subtree only. It never touches the
66
- document, loads fonts or stores a preference.
67
-
68
- - **`theme`** starts fresh from the library defaults. Nothing from an outer
69
- theme leaks in, so `defaultTheme` fully resets a subtree, including button
70
- effects.
71
- - **`mode`** is `light`, `dark` or `system`, independent of the theme. `system`
72
- uses a CSS media query, so server and client markup match.
73
- - **Omit either** to inherit it. At the root the stylesheet defaults to
74
- `system`.
75
- - **Inline `style`** on a scope wins over its generated values. Theme variables
76
- set inline on a scope survive nested mode-only scopes. A new named theme
77
- clears them.
78
-
79
- A mode-only scope recomputes the current theme, so it does not keep token
80
- overrides from a stylesheet rule or plain wrapper above it. Put overrides that
81
- must survive a mode switch in the theme or in a scope's inline `style`.
82
-
83
- A native Dialog stays in the scope where it renders.
84
-
85
- ## Override one component
54
+ `ThemeScope` renders a `div`. It sets custom properties and paints canvas, foreground, and body text on that subtree. Document color, font loading, and storage stay outside the scope.
86
55
 
87
- Values resolve as **component override → shared token → baseline**. For
88
- example, `components.button.radius` changes Button only, while
89
- `tokens.control.radius` changes Button, Input and the other controls. A
90
- component never falls back to another component's override.
56
+ | Prop | Behavior |
57
+ | ------------------------- | -------------------------------------------------------------------------------------------------------------------- |
58
+ | `theme` | Starts from library defaults, so a nested `defaultTheme` resets an outer theme |
59
+ | `mode` | `'light'`, `'dark'`, or `'system'`; `'system'` follows `prefers-color-scheme` in CSS so server and client HTML match |
60
+ | Omitted `theme` or `mode` | Inherits from the parent scope |
61
+ | `style` | Overrides the generated custom properties and survives nested mode-only scopes |
91
62
 
92
- Component keys are grouped by family under `components`: `button`, `link`,
93
- `field`, `input`, `textarea`, `slider`, `select`, `combobox`, `checkbox`, `switch`, `radio`, `radioGroup`, `dialog`, `popover`, `tooltip`, `menu`, `alert`, `toast`, `progress`, `collapsible`,
94
- `accordion`, `tabs` and `card`. Every key is listed in
95
- [`src/themes/components.ts`](../src/themes/components.ts). Set fonts, uppercase,
96
- shadows and press motion for every action through the [roles](#roles); use
97
- `components.button` only when Button alone should differ.
98
- `radioGroup.gap` spaces the options, and `radio.labelGap` spaces one option's
99
- label.
63
+ ## CSS variables
100
64
 
101
- Every token and key has a CSS variable named after its path:
102
-
103
- | Path | CSS variable |
104
- | ------------------------------ | ----------------------------- |
105
- | `tokens.color.accent` | `--rad-color-accent` |
106
- | `tokens.control.medium.height` | `--rad-control-medium-height` |
107
- | `components.button.radius` | `--rad-button-radius` |
108
- | `components.radioGroup.gap` | `--rad-radio-group-gap` |
109
-
110
- For a one-off change, set the variable in `style`. `ThemeStyle` types it:
65
+ A value resolves as the component override, then the shared token, then the baseline. An override stays on its own component. Each key becomes a kebab-case `--rad-` property: `tokens.control.medium.height` is `--rad-control-medium-height`, and `components.radioGroup.gap` is `--rad-radio-group-gap`. Names starting with `--_` are internal.
111
66
 
112
67
  ```tsx
113
68
  import { Button, type ThemeStyle } from '@cognitap/radiant'
114
69
 
115
70
  const local: ThemeStyle = { '--rad-button-radius': '1rem' }
116
71
 
117
- <Button style={local}>Save</Button>
72
+ export function Save() {
73
+ return <Button style={local}>Save</Button>
74
+ }
118
75
  ```
119
76
 
120
- Use `ThemeComponentOverrides` to type reusable override objects. Theme values
121
- are inline custom properties, so a stylesheet rule on the same element cannot
122
- override them; use `style`, or set the variable on a descendant. Caller classes
123
- merge after the defaults. Variables starting with `--_` are internal.
124
-
125
- Some defaults to know:
126
-
127
- - Checkbox caps an inherited radius at a quarter of its size, so it stays a
128
- box. An explicit `components.checkbox.radius` still wins.
129
- - Radio stays circular under any control shape.
130
- - Input, Textarea, Checkbox, Switch and Radio outlines mix border and foreground colors, so
131
- controls have more contrast than passive dividers.
132
- - Disabled opacity applies once, not again on a disabled child.
133
- - A pressed Button mixes 20% of its text color into its fill, over
134
- `control.selected` when the theme sets it. `components.button.selectedLayer`
135
- sets the amount.
136
-
137
- Restyling must keep components usable. See
138
- [what customization must keep](architecture.md#what-customization-must-keep).
139
-
140
77
  ## Roles
141
78
 
142
- A theme should not need component overrides to look coherent. Each part of a
143
- component plays one **role**, and each role reads one token group, so one
144
- setting restyles every family that plays it. Overrides stay for exceptions.
145
-
146
- | Role | Token group | Parts |
147
- | --------- | -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
148
- | Action | `control.action` | Button and the parts built on it, Link's button variants, ButtonGroup; the voice of tabs, chips and Table column headers |
149
- | Field | `control.field` | Input, Textarea, NativeSelect, InputGroup, OTP slots, Select, Combobox and TagsInput |
150
- | Indicator | `control.indicator` | Checkbox and Radio boxes, the Switch track, Switch and Slider thumbs |
151
- | Track | `control.track` | ToggleGroup and Tabs lists, Progress, Meter, Skeleton, Slider and ScrollArea rails, Resizable hover, the Menubar border |
152
- | Selected | `control.selected` | Pressed toggles, the ToggleGroup indicator, the selected tab, NavLink, the current page, Carousel indicator, chosen option, open menu |
153
- | Surface | `surface` | Card, Alert, Collapsible, Accordion, TableContainer, EmptyState, CodeBlock, Carousel, Sidebar, Separator, Tabs content |
154
- | Overlay | `surface.overlay*`, `surface.backdropFilter` | Popover, HoverCard, Menu, listboxes, Tooltip, Dialog, Drawer, NavigationMenu viewport; Toast's shadow |
155
- | Item | `control.item` | Highlighted rows in menus, listboxes and Command |
79
+ Each part reads one token role.
156
80
 
157
- Tooltips keep their own background and cap their radius at `0.5rem`. Drawers
158
- round only the edges that face the page.
81
+ | Role | Token group | Parts |
82
+ | --------- | -------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
83
+ | Action | `control.action` | `Button` and parts built on it, button-styled `Link`, `ButtonGroup`, and the typography of tabs and headers |
84
+ | Field | `control.field` | `Input`, `Textarea`, `NativeSelect`, `InputGroup`, `OTPField` slots, `Select`, `Combobox`, `TagsInput` |
85
+ | Indicator | `control.indicator` | `Checkbox` and `Radio` boxes, `Switch` track, `Switch` and `Slider` thumbs |
86
+ | Track | `control.track` | `ToggleGroup` and `Tabs` lists, `Progress`, `Meter`, `Skeleton`, `Slider` and `ScrollArea` rails, `Menubar` |
87
+ | Selected | `control.selected` | Pressed toggles, `ToggleGroup` indicator, active tab, `NavLink`, current page, chosen option, open menu |
88
+ | Surface | `surface` | `Card`, `Alert`, `Collapsible`, `Accordion`, `TableContainer`, `EmptyState`, `CodeBlock`, `Sidebar` |
89
+ | Overlay | `surface.overlay*`, `surface.backdropFilter` | `Popover`, `HoverCard`, `Menu`, listboxes, `Tooltip`, `Dialog`, `Drawer`, `NavigationMenu` viewport |
90
+ | Item | `control.item` | Highlighted rows in menus, listboxes, and `Command` |
159
91
 
160
- Native scroll boxes, such as AppShell, overlays, listboxes, TableContainer and
161
- Textarea, draw ScrollArea's `thumbColor` at 45% on a clear track. Forced colors
162
- keep system scrollbars.
92
+ Shared geometry:
163
93
 
164
- The rules every family follows:
94
+ - Inset parts subtract their inset from the parent radius. Thin parts cap the radius at half their height. `Checkbox` caps it at a quarter of its size, and `Radio` stays circular.
95
+ - Buttons inside a field or chip (`NumberField` steppers, `PasswordInput` toggle, `Tag` remove) stay flat and inherit the field's typography.
96
+ - Keyboard focus reads the family's `focus*` overrides, then `tokens.focus`. Menu, listbox, and `Command` items show focus with the item highlight.
97
+ - Native scroll containers draw `ScrollArea`'s `thumbColor` at 45% opacity on a transparent track, and use system scrollbars under `forced-colors`.
165
98
 
166
- - **Concentric corners.** A part inset in a rounded parent uses the parent's
167
- radius minus the inset, and the parent's corner shape.
168
- - **Capped corners.** Thin parts cap their radius at half their thickness, so
169
- a large radius gives pills and `0px` gives bars. Only parts that are round
170
- by meaning, such as Radio, always stay round.
171
- - **One depth language.** `action.shadow`, `field.shadow`, `indicator.shadow`,
172
- `track.shadow` and the surface shadows should read as one material: hard
173
- offsets, bevels, glows or nothing.
174
- - **One press.** `motion.pressScale`, `pressShiftX`, `pressShiftY` and
175
- `hoverLift` move every pressable, and `action.radiusPressed` reshapes it.
176
- - **Inline actions.** Buttons inside a field or chip, such as NumberField's
177
- steppers, PasswordInput's toggle and Tag's remove, stay flat and take the
178
- field's voice. A Select trigger is a field, not a Button.
179
- - **Chips.** Badge, Tag, Kbd and Avatar take the control radius, corner shape
180
- and border, capped at half their height. Avatar stays round unless the
181
- control radius is `0px`.
182
- - **One voice.** `action.fontFamily`, `fontWeight`, `textTransform` and
183
- `letterSpacing` set how actions and Table column headers read. Labels and
184
- values keep their roles.
185
- - **One selection.** `control.selected` draws the chosen member of every set.
186
- An underline is an inset bottom shadow on a transparent background.
187
- - **One focus ring.** Every keyboard focus ring reads the family's `focusColor`,
188
- `focusWidth`, `focusOffset` and `focusStyle`, then the `focus` tokens. Scroll
189
- boxes draw it inside their edge. Rows in menus, listboxes and Command show
190
- focus with the item highlight instead, since focus moves between rows of one
191
- widget.
99
+ ## Presets
192
100
 
193
- Unset selected, item and track keys leave each family its own baseline look.
194
-
195
- ## Example themes and fonts
196
-
197
- The core entry ships one theme, `defaultTheme`. The other presets are examples
198
- to copy or start from, published separately at `@cognitap/radiant/examples`.
199
- Its readonly `themes` registry lists them, each is a named export, and
200
- `themeDefinitions` holds the definition behind each theme in the same order.
201
- Pass a definition to `themeDocumentFromDefinition` to edit it as a document;
202
- the theme workshop starts from these.
203
-
204
- ```tsx
205
- import { jelly } from '@cognitap/radiant/examples'
206
- ```
207
-
208
- | ID | Name | Export | Fonts | Language |
209
- | --------------- | ------------- | --------------------- | -------------------------------------- | --------------------------------------------------- |
210
- | `radiant` | Radiant | `radiant` | Inter | Calm product UI, raised white selection |
211
- | `default` | Default | `defaultTheme` (core) | System sans | The neutral baseline |
212
- | `soft-squircle` | Soft squircle | `soft` | Nunito | Squircles, filled wells, diffuse shadows |
213
- | `sharp-3d` | Sharp 3D | `sharp` | System sans; Archivo Black for actions | Neo-brutalist ink outlines and hard offset shadows |
214
- | `glass` | Glass | `glass` | Manrope | Frosted translucent layers over a gradient |
215
- | `jelly` | Jelly | `jelly` | Baloo 2 | Clay bevels, pressed-in wells, springy presses |
216
- | `ticket` | Ticket | `ticket` | Barlow Condensed | Notched controls, scooped dashed stubs, inked picks |
217
- | `neon` | Neon | `neon` | IBM Plex Mono | Bevel-cut corners and glows on a grid |
218
- | `editorial` | Editorial | `editorial` | Source Serif 4 | Serif on paper, hairlines, underlined selection |
219
-
220
- Choosing a theme never downloads a font. Load the families yourself with weights
221
- 400, 600 and 700, and Archivo Black 400 for Sharp 3D. Every family falls back
222
- to a system family.
223
-
224
- Glass uses a gradient canvas and translucent surfaces, and
225
- `surface.backdropFilter` frosts every floating panel. `surface.backdrop` paints
226
- the overlay behind a dialog. Shapes use CSS `corner-shape`; browsers without it
227
- show ordinary rounded corners.
101
+ `defaultTheme` ships in `@cognitap/radiant`. Example themes in `@cognitap/radiant/examples` are `radiant`, `soft`, `sharp`, `glass`, `jelly`, `ticket`, `neon`, and `editorial`, also collected in the `themes` and `themeDefinitions` arrays. Themes name font families and do not download them. Load those families in the app, or they fall back to system fonts.
228
102
 
229
103
  ## Typography
230
104
 
231
- Typesetting is an opt-in recipe compiled into the theme. It assigns Body,
232
- Headings, UI and Code fonts, 16 text styles, and separate prose and UI rhythms.
233
-
234
- ```tsx
235
- import { ThemeScope, compileThemeDocument, defineThemeDocument } from '@cognitap/radiant'
236
-
237
- const theme = compileThemeDocument(defineThemeDocument({
238
- kind: 'radiant-theme', version: 1, id: 'publication', name: 'Publication',
239
- sections: { typography: { typesetting: {
240
- preset: 'source-serif',
241
- prose: { paragraphSpacing: 1.4 },
242
- styles: { 'prose-title': { weight: 650 } }
243
- } } }
244
- }))
245
-
246
- <ThemeScope theme={theme}>
247
- <article data-rad-prose="" data-rad-type-container="">
248
- <h1>Title</h1>
249
- <p data-rad-text="prose-lead">Lead paragraph.</p>
250
- </article>
251
- </ThemeScope>
252
- ```
253
-
254
- `preset` is `inter` (default), `source-serif` or `plex`. Each of `fonts.body`,
255
- `headings`, `ui` and `code` takes a CSS `family` and an optional `profile`
256
- (`inter`, `source-serif-4`, `plex-sans`, `plex-mono` or `manual`). A profile is
257
- your claim about the font; Radiant does not detect it.
258
-
259
- | Setting | Range | Default |
260
- | -------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------- |
261
- | `prose.size` | 12–40px | Inter/Plex 20, Serif 21, manual 20 |
262
- | `prose.lineHeight` | 1–3 | Inter/Plex 1.6, Serif/manual 1.65 |
263
- | `prose.paragraphSpacing` | 0–4em | 1.25em |
264
- | `prose.measure` | 20–120ch | Inter/manual 64, Serif/Plex 62 |
265
- | `prose.headingScale` | 1.1–1.5 | 1.25 |
266
- | `ui.size`, `ui.lineHeight` | 12–32px, 1–3 | 16px / 1.5 |
267
- | `styles[role]` | `narrow` 8–256px, `wide` 8–512px, weight 1–1000, leading 0.8–3, tracking −0.2–0.5em, measure 0–120ch | From the preset |
268
-
269
- Explicit `typography.values` override the recipe, and mode values override
270
- both. Out-of-profile weights produce `warnings` rather than being clamped.
271
- To reset a style, omit it and **replace** the typography section; a merge cannot
272
- delete a key. `generateTypography` and the presets are also exported from the
273
- React-free `@cognitap/radiant/typography` entry.
274
-
275
- HTML hooks:
276
-
277
- - `data-rad-text="<role>"` applies one of the 16 styles listed in
278
- `typographyRoles`. It does not change heading levels or ARIA.
279
- - `data-rad-prose` styles the container's **direct** headings, paragraphs,
280
- lists, quotes and code blocks. `data-rad-not-prose` on a child opts it out.
281
- - `data-rad-type-container` makes heading sizes scale with the column's width,
282
- between 24rem and 56rem. Body and UI sizes stay fixed.
283
-
284
- The hooks have low specificity, so utilities, your CSS and inline styles win.
285
- Load real italic and bold faces; synthetic styles are turned off.
286
-
287
- Components use the UI roles:
288
-
289
- | Text | Role |
290
- | --------------------------------------------------------------------------- | ------------------------- |
291
- | ThemeScope, Card, DialogContent, Field, disclosure body | `ui-body` |
292
- | CardTitle, DialogTitle | `ui-title` |
293
- | Field label, disclosure triggers, Button, Checkbox, Switch and Radio labels | `ui-label` |
294
- | Input, Textarea | `ui-body` |
295
- | Field help and error, CardDescription, DialogDescription | `ui-supporting` |
296
- | Inline Link | Inherits surrounding text |
297
-
298
- Controls keep their own font size from `control.<size>.fontSize`, so changing
299
- the UI role size does not resize buttons or inputs.
300
-
301
- ## Colors
302
-
303
- `generateColorWall` builds 18 palettes of 11 shades (50–950) from one brand
304
- color. `recommendColorPalette` picks a working set from that wall, maps it to
305
- light and dark color roles, and reports contrast checks. Both are pure,
306
- deterministic and exported from the React-free `@cognitap/radiant/color` entry.
307
-
308
- ```ts
309
- import { generateColorWall, recommendColorPalette } from '@cognitap/radiant/color'
310
- import { updateThemeAppearance, compileThemeDocument } from '@cognitap/radiant'
311
-
312
- const wall = generateColorWall({ brand: '#7C3AED', wallPreset: 'expressive' })
313
- const palette = recommendColorPalette(wall, { working: { support: 'teal' } })
314
- const failures = palette.checks.filter(check => check.pass === false)
315
-
316
- const theme = compileThemeDocument(
317
- updateThemeAppearance(document, {
318
- palette,
319
- geometry: { values: { spacing: 1.25, controlRadius: 8 } }
320
- })
321
- )
322
- ```
323
-
324
- | Wall input | Default | Range |
325
- | ---------------- | ----------- | --------------------------------------------------- |
326
- | `brand` | Required | Six-digit sRGB hex |
327
- | `fidelity` | `anchored` | `anchored` keeps the exact brand color as one shade |
328
- | `wallPreset` | `balanced` | `classic`, `balanced`, `expressive` |
329
- | `rampPreset` | `balanced` | Same values, for the brand palette only |
330
- | `vividness` | From preset | 0–1, other palettes |
331
- | `brandVividness` | From preset | 0–1, brand palette |
332
- | `lightness` | `hue-aware` | `hue-aware` or `shared` |
333
- | `distribution` | `1` | 0.75–1.35 |
334
- | `neutralTint` | From preset | 0–0.035 |
335
- | `hueAlignment` | From preset | 0–1 |
336
- | `neutralHue` | `255` | Degrees, used when the brand is nearly gray |
337
-
338
- `wall.input` holds every effective setting, so passing it back reproduces the
339
- same wall.
340
-
341
- By default the working set is Brand (primary), the family nearest the brand
342
- hue plus 150° (support), Neutral, Emerald (success), Amber (warning) and Red
343
- (danger). Text must reach 4.5:1 against its background. Borders, focus rings and
344
- the checked fill must reach 3:1. Disabled pairs are reported but not
345
- required to pass. The checks cover these base pairs only. Recheck gradients,
346
- translucency and overrides in the browser.
347
-
348
- `updateThemeAppearance` applies a palette and geometry together without
349
- touching component overrides:
350
-
351
- | Geometry | Range | Changes |
352
- | ------------------------------------------ | --------------------------- | ------------------------------------------ |
353
- | `spacing` | 0.5–2 | All spacing gaps, surface padding and gap |
354
- | `density` | 0.75–1.5 | Control height, padding and indicator size |
355
- | `controlRadius` | 0–32px | Control radius |
356
- | `surfaceRadius` | 0–48px | Card, Dialog and Collapsible radius |
357
- | `controlBorderWidth`, `surfaceBorderWidth` | 0–4px | Border widths |
358
- | `borderStyle` | `solid`, `dashed`, `dotted` | Control and surface borders |
359
- | `elevation` | 0–3 | Surface and overlay shadows |
360
- | `backdropOpacity` | 0–0.9 | Modal overlay |
361
-
362
- Scales apply to the baseline, so applying `spacing: 1.25` twice gives the same
363
- result. Values out of range throw instead of being clamped.
364
-
365
- ## Theme documents
366
-
367
- `ThemeDocument` is the editable, versioned form of a theme, used by the docs
368
- site's theme workshop. It keeps the authored values plus metadata such as
369
- palettes and font descriptors. `compileThemeDocument` turns it into a `Theme`
370
- for `ThemeScope`.
371
-
372
- | Function | Does |
373
- | ----------------------------------------------- | --------------------------------------------------------------- |
374
- | `themeDocumentFromDefinition(definition)` | Wraps a `defineTheme` input, keeping only explicit values |
375
- | `updateThemeDocument(doc, sections)` | Deep-merges the given sections; arrays are replaced whole |
376
- | `updateThemeDocument(doc, sections, 'replace')` | Replaces each given section; `{ color: {} }` resets color |
377
- | `exportThemeSections(doc, ['color'])` | Exports chosen sections without the theme's identity |
378
- | `parseThemeDocument(json)` | Validates a full document or a section export from `JSON.parse` |
379
-
380
- Sections match the token groups plus `components`. Updating a section never
381
- touches `components`, so per-component exceptions survive. Font descriptors
382
- record requirements only; your application loads the fonts. Parsing rejects
383
- unknown fields and unsupported versions with the failing path.
105
+ `@cognitap/radiant/typography`, also exported from the root, compiles a typesetting preset (`'inter'`, `'source-serif'`, or `'plex'`) into 16 text roles (`typographyRoles`) and prose and UI flow variables. Set it at `sections.typography.typesetting`, with `prose` and `styles` overrides, and compile the document.
384
106
 
385
- ## Token reference
107
+ | Attribute | Effect |
108
+ | ------------------------- | ------------------------------------------------------------------------------------------------------------- |
109
+ | `data-rad-text="<role>"` | Sets one text role. The element keeps its own semantics |
110
+ | `data-rad-prose` | Styles direct child headings, paragraphs, lists, blockquotes, and code. `data-rad-not-prose` opts a child out |
111
+ | `data-rad-type-container` | Heading sizes scale with container width from `24rem` to `56rem` |
386
112
 
387
- CSS names are `--rad-` plus the kebab-case path. The values come from
388
- [`src/themes/tokens.ts`](../src/themes/tokens.ts). `surface.canvas` and
389
- `surface.backdrop` accept any CSS background, including gradients.
113
+ ## Color
390
114
 
391
- | Path | Light default | Dark default |
392
- | ----------------------------------- | ------------------------------------ | ------------------------------------ |
393
- | `color.surface` | `oklch(1 0 0)` | `oklch(0.21 0.006 286)` |
394
- | `color.foreground` | `oklch(0.21 0.006 286)` | `oklch(0.985 0 0)` |
395
- | `color.mutedForeground` | `oklch(0.45 0.01 286)` | `oklch(0.75 0.01 286)` |
396
- | `color.border` | `oklch(0.885 0.005 286)` | `oklch(0.4 0.008 286)` |
397
- | `color.placeholder` | `oklch(0.5 0.01 286)` | `oklch(0.7 0.01 286)` |
398
- | `color.disabledBackground` | `oklch(0.96 0.005 286)` | `oklch(0.26 0.006 286)` |
399
- | `color.disabledBorder` | `oklch(0.88 0.005 286)` | `oklch(0.38 0.006 286)` |
400
- | `color.invalid` | `oklch(0.56 0.19 25)` | `oklch(0.75 0.16 25)` |
401
- | `color.focus` | `oklch(0.55 0.13 255)` | `oklch(0.75 0.13 255)` |
402
- | `color.accent` | `oklch(0.21 0.006 286)` | `oklch(0.92 0.005 286)` |
403
- | `color.accentForeground` | `oklch(0.985 0 0)` | `oklch(0.21 0.006 286)` |
404
- | `color.neutral` | `oklch(0.955 0.004 286)` | `oklch(0.3 0.006 286)` |
405
- | `color.neutralForeground` | `oklch(0.21 0.006 286)` | `oklch(0.985 0 0)` |
406
- | `color.warning` | `oklch(0.8 0.14 78)` | Same |
407
- | `color.warningForeground` | `oklch(0.3 0.07 55)` | Same |
408
- | `color.danger` | `oklch(0.56 0.19 25)` | `oklch(0.72 0.17 25)` |
409
- | `color.dangerForeground` | `oklch(0.99 0 0)` | `oklch(0.2 0.04 25)` |
410
- | `typography.family` | `system-ui, sans-serif` | Same |
411
- | `typography.bodySize` | `0.875rem` | Same |
412
- | `typography.smallSize` | `0.8125rem` | Same |
413
- | `typography.headingSize` | `1.125rem` | Same |
414
- | `typography.bodyWeight` | `400` | Same |
415
- | `typography.labelWeight` | `550` | Same |
416
- | `typography.headingWeight` | `600` | Same |
417
- | `typography.letterSpacing` | `-0.011em` | Same |
418
- | `control.small.height` | `2rem` | Same |
419
- | `control.small.paddingInline` | `0.75rem` | Same |
420
- | `control.small.fontSize` | `0.8125rem` | Same |
421
- | `control.small.indicatorSize` | `1rem` | Same |
422
- | `control.medium.height` | `2.5rem` | Same |
423
- | `control.medium.paddingInline` | `1rem` | Same |
424
- | `control.medium.fontSize` | `0.875rem` | Same |
425
- | `control.medium.indicatorSize` | `1.125rem` | Same |
426
- | `control.large.height` | `3rem` | Same |
427
- | `control.large.paddingInline` | `1.375rem` | Same |
428
- | `control.large.fontSize` | `0.9375rem` | Same |
429
- | `control.large.indicatorSize` | `1.25rem` | Same |
430
- | `control.radius` | `0.5rem` | Same |
431
- | `control.cornerShape` | `round` | Same |
432
- | `control.borderWidth` | `1px` | Same |
433
- | `control.borderStyle` | `solid` | Same |
434
- | `control.action.fontFamily` | UI label family | Same |
435
- | `control.action.fontWeight` | UI label weight | Same |
436
- | `control.action.textTransform` | `none` | Same |
437
- | `control.action.letterSpacing` | UI label tracking | Same |
438
- | `control.action.borderColor` | Unset: each variant's edge | Same |
439
- | `control.action.shadow` | `0 1px 2px 0 rgb(0 0 0 / 0.06)` | Same |
440
- | `control.action.shadowPressed` | `0 1px 2px 0 rgb(0 0 0 / 0.06)` | Same |
441
- | `control.action.highlight` | `0` (0–1) | Same |
442
- | `control.action.sheen` | `0` (0–1) | Same |
443
- | `control.action.radiusPressed` | Unset: keeps the rest radius | Same |
444
- | `control.action.cornerShapePressed` | Unset: keeps the rest shape | Same |
445
- | `control.field.background` | `color.surface` | Same |
446
- | `control.field.borderColor` | Unset: the control outline | Same |
447
- | `control.field.shadow` | `none` | Same |
448
- | `control.field.backdropFilter` | `none` | Same |
449
- | `control.indicator.shadow` | `none` | Same |
450
- | `control.indicator.checkedShadow` | `none` | Same |
451
- | `control.indicator.thumbShadow` | `none` | Same |
452
- | `control.track.background` | Unset: each track's own fill | Same |
453
- | `control.track.borderWidth` | Unset: each track's own edge | Same |
454
- | `control.track.shadow` | `none` | Same |
455
- | `control.selected.background` | Unset | Same |
456
- | `control.selected.foreground` | Unset | Same |
457
- | `control.selected.borderColor` | Unset | Same |
458
- | `control.selected.shadow` | Unset | Same |
459
- | `control.item.highlightBackground` | Unset | Same |
460
- | `control.item.highlightForeground` | Unset | Same |
461
- | `surface.canvas` | `oklch(1 0 0)` | `oklch(0.16 0.006 286)` |
462
- | `surface.radius` | `0.75rem` | Same |
463
- | `surface.cornerShape` | `round` | Same |
464
- | `surface.borderWidth` | `1px` | Same |
465
- | `surface.borderStyle` | `solid` | Same |
466
- | `surface.padding` | `1.5rem` | Same |
467
- | `surface.gap` | `1rem` | Same |
468
- | `surface.shadow` | `0 1px 2px 0 rgb(0 0 0 / 0.06)` | `0 1px 2px 0 rgb(0 0 0 / 0.25)` |
469
- | `surface.overlayShadow` | `0 24px 64px -16px rgb(0 0 0 / 0.3)` | `0 24px 64px -16px rgb(0 0 0 / 0.6)` |
470
- | `surface.backdrop` | `rgb(0 0 0 / 0.45)` | `rgb(0 0 0 / 0.65)` |
471
- | `surface.backdropFilter` | `none` | Same |
472
- | `surface.overlayBackground` | `color.surface` | Same |
473
- | `focus.width` | `2px` | Same |
474
- | `focus.offset` | `2px` | Same |
475
- | `focus.style` | `solid` | Same |
476
- | `motion.pressDuration` | `80ms` | Same |
477
- | `motion.pressEase` | `cubic-bezier(0.3, 0, 0, 1)` | Same |
478
- | `motion.releaseDuration` | `160ms` | Same |
479
- | `motion.releaseEase` | `cubic-bezier(0.2, 0.8, 0.2, 1)` | Same |
480
- | `motion.colorDuration` | `150ms` | Same |
481
- | `motion.disclosureDuration` | `150ms` | Same |
482
- | `motion.pressScale` | `0.97` | Same |
483
- | `motion.pressShiftX` | `0px` | Same |
484
- | `motion.pressShiftY` | `0px` | Same |
485
- | `motion.hoverLift` | `0px` | Same |
486
- | `spacing.labelGap` | `0.5rem` | Same |
487
- | `spacing.fieldGap` | `0.375rem` | Same |
488
- | `spacing.groupGap` | `0.75rem` | Same |
489
- | `spacing.headerGap` | `0.375rem` | Same |
490
- | `spacing.footerGap` | `0.5rem` | Same |
491
- | `state.disabledOpacity` | `0.5` | Same |
115
+ `@cognitap/radiant/color` exports two pure functions:
492
116
 
493
- Typography recipes add `typography.roles` and `typography.flow` leaves, which
494
- can also be authored directly.
117
+ - `generateColorWall({ brand, wallPreset })` builds 18 palettes of 11 shades (`50` to `950`) from a six-digit hex brand color.
118
+ - `recommendColorPalette(wall, options)` maps `brand`, `support`, `neutral`, `success`, `warning`, and `danger` to light and dark color tokens. `checks` require 4.5:1 for text and 3:1 for borders, focus rings, and checked fills.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cognitap/radiant",
3
- "version": "0.0.78",
3
+ "version": "0.0.79",
4
4
  "description": "React interaction components and presentation primitives",
5
5
  "homepage": "https://radiant-docs.pages.dev",
6
6
  "bugs": {
@@ -37,8 +37,14 @@
37
37
  "types": "./dist/library/index.d.ts",
38
38
  "default": "./dist/library/index.js"
39
39
  },
40
- "./styles.css": "./dist/library/styles.css",
41
- "./reset.css": "./dist/library/reset.css",
40
+ "./styles.css": {
41
+ "types": "./src/css.d.ts",
42
+ "default": "./dist/library/styles.css"
43
+ },
44
+ "./reset.css": {
45
+ "types": "./src/css.d.ts",
46
+ "default": "./dist/library/reset.css"
47
+ },
42
48
  "./tailwind.css": "./src/styles.css",
43
49
  "./color": {
44
50
  "types": "./dist/library/color/index.d.ts",
@@ -76,6 +82,7 @@
76
82
  "motion": "14.7.1"
77
83
  },
78
84
  "devDependencies": {
85
+ "@cognitap/galactica": "0.2.3",
79
86
  "@storybook/addon-a11y": "10.6.1",
80
87
  "@storybook/addon-docs": "10.6.1",
81
88
  "@storybook/addon-vitest": "10.6.1",
@@ -103,6 +110,7 @@
103
110
  },
104
111
  "peerDependencies": {
105
112
  "react": "^19.3.0",
113
+ "react-dom": "^19.3.0",
106
114
  "tailwindcss": "^4.3.3"
107
115
  },
108
116
  "peerDependenciesMeta": {
@@ -121,25 +129,25 @@
121
129
  "storybook": "pnpm theme:generate && storybook dev --host 127.0.0.1 --port 6006 --no-open --disable-telemetry",
122
130
  "build": "rimraf dist/library && pnpm build:js && pnpm build:css",
123
131
  "build:js": "tsc -p tsconfig.build.json",
124
- "build:css": "pnpm theme:generate && tailwindcss -i styles/library.css -o dist/library/styles.css --minify && tailwindcss -i styles/reset.css -o dist/library/reset.css --minify && node scripts/preserve-css-layer-order.mjs",
132
+ "build:css": "pnpm theme:generate && tailwindcss -i styles/library.css -o dist/library/styles.css --minify && tailwindcss -i styles/reset.css -o dist/library/reset.css --minify && node scripts/preserve-css-layer-order.ts",
125
133
  "watch": "pnpm run --parallel '/^watch:/'",
126
134
  "watch:js": "tsc -p tsconfig.build.json --watch --preserveWatchOutput",
127
135
  "watch:styles": "pnpm theme:generate && tailwindcss -i styles/library.css -o dist/library/styles.css --watch=always",
128
136
  "build:storybook": "pnpm theme:generate && storybook build --output-dir dist/storybook --disable-telemetry",
129
137
  "test": "pnpm build && node --test tests/*.test.mjs && node scripts/pack-and-test.ts",
130
138
  "test:package": "pnpm build && node scripts/pack-and-test.ts",
131
- "typecheck": "pnpm build:js && tsc --noEmit && pnpm typecheck:contracts",
132
- "typecheck:contracts": "tsc -p docs/contracts/tsconfig.json",
139
+ "typecheck": "pnpm build:js && tsc --noEmit",
133
140
  "lint": "oxlint --deny-warnings",
134
141
  "format": "oxfmt",
135
142
  "format:check": "oxfmt --check",
136
- "check:source": "pnpm theme:check && pnpm format:check && pnpm lint && pnpm typecheck && pnpm docs:check",
137
- "docs:check": "node scripts/check-docs.mjs",
138
- "check": "pnpm check:source && pnpm build && node --test tests/*.test.mjs && node scripts/pack-and-test.ts && pnpm build:storybook && pnpm test:browser --project=storybook-radiant-light --project=storybook-radiant-dark",
139
- "release:prepare": "node scripts/prepare-release.mjs",
140
- "theme:generate": "node scripts/generate-theme-css.mjs",
141
- "theme:check": "node scripts/generate-theme-css.mjs --check",
142
- "watch:theme": "node scripts/generate-theme-css.mjs --watch",
143
+ "docs:check": "node scripts/check-docs.ts",
144
+ "check": "pnpm check:library && pnpm check:storybook",
145
+ "check:library": "pnpm theme:check && pnpm format:check && pnpm lint && pnpm build && tsc --noEmit && pnpm docs:check && node --test tests/*.test.mjs && node scripts/pack-and-test.ts",
146
+ "check:storybook": "pnpm build:storybook && pnpm test:browser --project=storybook-radiant-light --project=storybook-radiant-dark",
147
+ "release:prepare": "node scripts/prepare-release.ts",
148
+ "theme:generate": "node scripts/generate-theme-css.ts",
149
+ "theme:check": "node scripts/generate-theme-css.ts --check",
150
+ "watch:theme": "node scripts/generate-theme-css.ts --watch",
143
151
  "test:browser": "pnpm theme:generate && vitest run"
144
152
  }
145
153
  }
@@ -7,7 +7,7 @@ import {
7
7
  type ComponentProps,
8
8
  type ReactNode
9
9
  } from 'react'
10
- import { cn } from '../cn.js'
10
+ import { cn } from 'cn'
11
11
  import { joinIds } from '../internal/ids.js'
12
12
  import {
13
13
  chartGeometry,
@@ -2,7 +2,7 @@
2
2
 
3
3
  import type { ComponentProps, ReactNode } from 'react'
4
4
  import { createContext, useContext, useState } from 'react'
5
- import { cn } from '../../cn.js'
5
+ import { cn } from 'cn'
6
6
  import { joinIds } from '../../internal/ids.js'
7
7
  import type { ThemeStyle } from '../../themes/defineTheme.js'
8
8
  import { composeAction } from '../../internal/events.js'