@cognitap/radiant 0.0.4 → 0.0.6
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.
- package/CHANGELOG.md +44 -0
- package/README.md +17 -0
- package/dist/library/Button.d.ts +3 -1
- package/dist/library/Button.d.ts.map +1 -1
- package/dist/library/Button.js +43 -2
- package/dist/library/Button.js.map +1 -1
- package/dist/library/Card.d.ts.map +1 -1
- package/dist/library/Card.js +8 -6
- package/dist/library/Card.js.map +1 -1
- package/dist/library/Checkbox.js +2 -2
- package/dist/library/Checkbox.js.map +1 -1
- package/dist/library/Collapsible.d.ts +2 -1
- package/dist/library/Collapsible.d.ts.map +1 -1
- package/dist/library/Collapsible.js +10 -6
- package/dist/library/Collapsible.js.map +1 -1
- package/dist/library/Dialog.d.ts +2 -1
- package/dist/library/Dialog.d.ts.map +1 -1
- package/dist/library/Dialog.js +13 -8
- package/dist/library/Dialog.js.map +1 -1
- package/dist/library/Field.js +4 -4
- package/dist/library/Field.js.map +1 -1
- package/dist/library/Input.d.ts.map +1 -1
- package/dist/library/Input.js +4 -3
- package/dist/library/Input.js.map +1 -1
- package/dist/library/Link.d.ts.map +1 -1
- package/dist/library/Link.js +0 -1
- package/dist/library/Link.js.map +1 -1
- package/dist/library/RadioGroup.js +2 -2
- package/dist/library/RadioGroup.js.map +1 -1
- package/dist/library/ThemeScope.d.ts.map +1 -1
- package/dist/library/ThemeScope.js +11 -10
- package/dist/library/ThemeScope.js.map +1 -1
- package/dist/library/actionStyles.js +2 -2
- package/dist/library/actionStyles.js.map +1 -1
- package/dist/library/cn.d.ts +2 -1
- package/dist/library/cn.d.ts.map +1 -1
- package/dist/library/cn.js +22 -1
- package/dist/library/cn.js.map +1 -1
- package/dist/library/index.d.ts +5 -1
- package/dist/library/index.d.ts.map +1 -1
- package/dist/library/index.js +2 -0
- package/dist/library/index.js.map +1 -1
- package/dist/library/motion/MotionLink.d.ts +7 -0
- package/dist/library/motion/MotionLink.d.ts.map +1 -0
- package/dist/library/motion/MotionLink.js +45 -0
- package/dist/library/motion/MotionLink.js.map +1 -0
- package/dist/library/motion/browser.d.ts +5 -0
- package/dist/library/motion/browser.d.ts.map +1 -0
- package/dist/library/motion/browser.js +35 -0
- package/dist/library/motion/browser.js.map +1 -0
- package/dist/library/motion/config.d.ts +26 -0
- package/dist/library/motion/config.d.ts.map +1 -0
- package/dist/library/motion/config.js +58 -0
- package/dist/library/motion/config.js.map +1 -0
- package/dist/library/motion/context.d.ts +2 -0
- package/dist/library/motion/context.d.ts.map +1 -0
- package/dist/library/motion/context.js +5 -0
- package/dist/library/motion/context.js.map +1 -0
- package/dist/library/motion/drag.d.ts +20 -0
- package/dist/library/motion/drag.d.ts.map +1 -0
- package/dist/library/motion/drag.js +138 -0
- package/dist/library/motion/drag.js.map +1 -0
- package/dist/library/motion/dragBrowser.d.ts +4 -0
- package/dist/library/motion/dragBrowser.d.ts.map +1 -0
- package/dist/library/motion/dragBrowser.js +156 -0
- package/dist/library/motion/dragBrowser.js.map +1 -0
- package/dist/library/motion/follow.d.ts +9 -0
- package/dist/library/motion/follow.d.ts.map +1 -0
- package/dist/library/motion/follow.js +26 -0
- package/dist/library/motion/follow.js.map +1 -0
- package/dist/library/motion/host.d.ts +27 -0
- package/dist/library/motion/host.d.ts.map +1 -0
- package/dist/library/motion/host.js +62 -0
- package/dist/library/motion/host.js.map +1 -0
- package/dist/library/motion/index.d.ts +16 -0
- package/dist/library/motion/index.d.ts.map +1 -0
- package/dist/library/motion/index.js +9 -0
- package/dist/library/motion/index.js.map +1 -0
- package/dist/library/motion/layout.d.ts +20 -0
- package/dist/library/motion/layout.d.ts.map +1 -0
- package/dist/library/motion/layout.js +67 -0
- package/dist/library/motion/layout.js.map +1 -0
- package/dist/library/motion/layoutDom.d.ts +17 -0
- package/dist/library/motion/layoutDom.d.ts.map +1 -0
- package/dist/library/motion/layoutDom.js +272 -0
- package/dist/library/motion/layoutDom.js.map +1 -0
- package/dist/library/motion/press.d.ts +5 -0
- package/dist/library/motion/press.d.ts.map +1 -0
- package/dist/library/motion/press.js +72 -0
- package/dist/library/motion/press.js.map +1 -0
- package/dist/library/motion/pressPolicy.d.ts +5 -0
- package/dist/library/motion/pressPolicy.d.ts.map +1 -0
- package/dist/library/motion/pressPolicy.js +8 -0
- package/dist/library/motion/pressPolicy.js.map +1 -0
- package/dist/library/motion/react.d.ts +35 -0
- package/dist/library/motion/react.d.ts.map +1 -0
- package/dist/library/motion/react.js +224 -0
- package/dist/library/motion/react.js.map +1 -0
- package/dist/library/motion/runtime.d.ts +22 -0
- package/dist/library/motion/runtime.d.ts.map +1 -0
- package/dist/library/motion/runtime.js +117 -0
- package/dist/library/motion/runtime.js.map +1 -0
- package/dist/library/motion/transitions.d.ts +5 -0
- package/dist/library/motion/transitions.d.ts.map +1 -0
- package/dist/library/motion/transitions.js +211 -0
- package/dist/library/motion/transitions.js.map +1 -0
- package/dist/library/styles.css +1 -1
- package/dist/library/themes/defineTheme.d.ts +3 -0
- package/dist/library/themes/defineTheme.d.ts.map +1 -1
- package/dist/library/themes/defineTheme.js +9 -3
- package/dist/library/themes/defineTheme.js.map +1 -1
- package/dist/library/themes/index.d.ts +1 -1
- package/dist/library/themes/index.d.ts.map +1 -1
- package/dist/library/themes/index.js.map +1 -1
- package/dist/library/themes/themeDocument.d.ts.map +1 -1
- package/dist/library/themes/themeDocument.js +39 -8
- package/dist/library/themes/themeDocument.js.map +1 -1
- package/dist/library/themes/themeDocumentTypes.d.ts +16 -1
- package/dist/library/themes/themeDocumentTypes.d.ts.map +1 -1
- package/dist/library/themes/themeDocumentTypes.js.map +1 -1
- package/dist/library/themes/tokens.d.ts +7 -0
- package/dist/library/themes/tokens.d.ts.map +1 -1
- package/dist/library/themes/tokens.js +99 -0
- package/dist/library/themes/tokens.js.map +1 -1
- package/dist/library/typography/index.d.ts +72 -0
- package/dist/library/typography/index.d.ts.map +1 -0
- package/dist/library/typography/index.js +160 -0
- package/dist/library/typography/index.js.map +1 -0
- package/dist/library/typography/types.d.ts +78 -0
- package/dist/library/typography/types.d.ts.map +1 -0
- package/dist/library/typography/types.js +2 -0
- package/dist/library/typography/types.js.map +1 -0
- package/docs/motion.md +434 -0
- package/docs/system.md +33 -0
- package/docs/theming.md +204 -0
- package/package.json +20 -4
- package/src/Button.tsx +49 -1
- package/src/Card.tsx +8 -6
- package/src/Checkbox.tsx +2 -2
- package/src/Collapsible.tsx +18 -5
- package/src/Dialog.tsx +18 -7
- package/src/Field.tsx +4 -4
- package/src/Input.tsx +4 -3
- package/src/Link.tsx +0 -1
- package/src/RadioGroup.tsx +2 -2
- package/src/ThemeScope.tsx +22 -18
- package/src/actionStyles.ts +2 -2
- package/src/cn.ts +25 -1
- package/src/index.ts +12 -0
- package/src/motion/MotionLink.tsx +64 -0
- package/src/motion/browser.ts +45 -0
- package/src/motion/config.ts +79 -0
- package/src/motion/context.ts +4 -0
- package/src/motion/drag.ts +151 -0
- package/src/motion/dragBrowser.ts +159 -0
- package/src/motion/follow.ts +28 -0
- package/src/motion/host.ts +88 -0
- package/src/motion/index.ts +28 -0
- package/src/motion/layout.ts +78 -0
- package/src/motion/layoutDom.ts +293 -0
- package/src/motion/press.ts +77 -0
- package/src/motion/pressPolicy.ts +12 -0
- package/src/motion/react.ts +272 -0
- package/src/motion/runtime.ts +122 -0
- package/src/motion/transitions.ts +206 -0
- package/src/styles.css +1 -0
- package/src/themes/baseline.css +131 -0
- package/src/themes/defineTheme.ts +15 -3
- package/src/themes/index.ts +2 -0
- package/src/themes/themeDocument.ts +47 -9
- package/src/themes/themeDocumentTypes.ts +24 -5
- package/src/themes/tokens.ts +137 -0
- package/src/typography/index.ts +199 -0
- package/src/typography/types.ts +92 -0
- package/src/typography.css +336 -0
package/docs/theming.md
CHANGED
|
@@ -209,6 +209,14 @@ or regenerated palette; the compiler never silently adjusts the source.
|
|
|
209
209
|
fonts and determines availability. Local font bytes, file paths/handles, URLs,
|
|
210
210
|
DOM objects and runtime functions have no fields in the schema. A local family
|
|
211
211
|
name can travel with the configuration, but the local font itself does not.
|
|
212
|
+
Optional `axes` records available OpenType ranges as `{ tag, min, default, max }`.
|
|
213
|
+
Axis tags are unique four-character ASCII identifiers; at most 32 finite, ordered
|
|
214
|
+
ranges are accepted per font. These are capabilities for setup and inspection,
|
|
215
|
+
not selected variations. Trial-only axis adjustments remain in the typeface lab.
|
|
216
|
+
Full/selective documents retain these descriptors; compiling them does not change
|
|
217
|
+
paint or load font files. Compressed custom files without inspected axes remain
|
|
218
|
+
unverified rather than receiving invented capabilities.
|
|
219
|
+
|
|
212
220
|
Font metadata does not set `typography.values.family` automatically.
|
|
213
221
|
|
|
214
222
|
Full and selective authoring JSON preserve those descriptors; only selecting
|
|
@@ -218,6 +226,202 @@ arrays, strings, booleans, null and finite numbers, restricted further by their
|
|
|
218
226
|
field schema. Functions, class/binary instances, cycles, accessors and unsupported
|
|
219
227
|
keys fail before import can silently discard data.
|
|
220
228
|
|
|
229
|
+
## Responsive typography
|
|
230
|
+
|
|
231
|
+
Typesetting is opt-in and uses the existing theme compiler. The accepted
|
|
232
|
+
[role model](research/dev-162-typography-model.md) separates Body/Headings/UI/Code
|
|
233
|
+
font assignments, 16 text styles and independent prose/UI rhythms.
|
|
234
|
+
|
|
235
|
+
```tsx
|
|
236
|
+
import { ThemeScope, compileThemeDocument, defineThemeDocument,
|
|
237
|
+
generateTypography, updateThemeDocument } from '@cognitap/radiant'
|
|
238
|
+
|
|
239
|
+
const document = defineThemeDocument({
|
|
240
|
+
kind: 'radiant-theme', version: 1, id: 'publication', name: 'Publication',
|
|
241
|
+
sections: { typography: { typesetting: {
|
|
242
|
+
preset: 'source-serif',
|
|
243
|
+
prose: { paragraphSpacing: 1.4 },
|
|
244
|
+
styles: { 'prose-title': { weight: 650 } },
|
|
245
|
+
} } },
|
|
246
|
+
})
|
|
247
|
+
const theme = compileThemeDocument(document)
|
|
248
|
+
|
|
249
|
+
// Inside your application, with either documented CSS route:
|
|
250
|
+
<ThemeScope theme={theme}>
|
|
251
|
+
<article data-rad-prose="" data-rad-type-container="">
|
|
252
|
+
<h1>A shared language for careful work</h1>
|
|
253
|
+
<p data-rad-text="prose-lead">A lead can use its own reusable style.</p>
|
|
254
|
+
<p>Body copy with <em>emphasis</em> and <code>inline.code</code>.</p>
|
|
255
|
+
<h2>A new section</h2>
|
|
256
|
+
<p>Paragraph and heading spacing follow the prose rhythm.</p>
|
|
257
|
+
</article>
|
|
258
|
+
</ThemeScope>
|
|
259
|
+
|
|
260
|
+
const next = updateThemeDocument(document, {
|
|
261
|
+
typography: { typesetting: { ui: { size: 18 } } },
|
|
262
|
+
})
|
|
263
|
+
const result = generateTypography(next.sections.typography!.typesetting)
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
`generateTypography`, `typographyPresets`, `typographyRoles` and their types also
|
|
267
|
+
export from the pure `@cognitap/radiant/typography` entry. It imports no React,
|
|
268
|
+
reads no browser globals and loads no fonts. For plain definitions, pass
|
|
269
|
+
`result.tokens` as `tokens.typography` to `defineTheme`. `prose`, `ui`, and
|
|
270
|
+
`styles` expose calculated settings. Immutable `result.input` is JSON-replayable
|
|
271
|
+
and preserves manual/automatic ownership instead of pinning calculated metrics.
|
|
272
|
+
|
|
273
|
+
### Authoring and precedence
|
|
274
|
+
|
|
275
|
+
`typography.typesetting` generates common defaults. Explicit `typography.values`
|
|
276
|
+
leaves override them, followed by `typography.modes.light/dark` leaves. Existing
|
|
277
|
+
component exceptions retain their precedence. Typography-only section exports
|
|
278
|
+
carry recipes, explicit values and font descriptors through the existing
|
|
279
|
+
merge/replace import rules; no second compiler or loading path is introduced.
|
|
280
|
+
|
|
281
|
+
`preset` is `inter` (default), `source-serif`, or `plex`. Each `fonts.body`,
|
|
282
|
+
`headings`, `ui` and `code` accepts a CSS `family` list and optional `profile`:
|
|
283
|
+
`inter`, `source-serif-4`, `plex-sans`, `plex-mono`, or `manual`. A new family
|
|
284
|
+
without a profile selects manual defaults. A profile is an explicit claim about
|
|
285
|
+
the supplied font, not detection of an installed file. Consumers own that setup.
|
|
286
|
+
|
|
287
|
+
| Manual setting | Bounds | Default |
|
|
288
|
+
| -------------------------- | ----------------------- | ------------------------------------- |
|
|
289
|
+
| `prose.size` | 12–40 reference px | Inter/Plex: 20, Serif: 21, manual: 20 |
|
|
290
|
+
| `prose.lineHeight` | 1–3 | Inter/Plex: 1.6, Serif/manual: 1.65 |
|
|
291
|
+
| `prose.paragraphSpacing` | 0–4em | 1.25em |
|
|
292
|
+
| `prose.measure` | 20–120ch | Inter/manual: 64, Serif/Plex: 62 |
|
|
293
|
+
| `prose.headingScale` | 1.1–1.5 | 1.25 |
|
|
294
|
+
| `ui.size`, `ui.lineHeight` | 12–32 reference px, 1–3 | 16px / 1.5 |
|
|
295
|
+
|
|
296
|
+
Each `styles[role]` accepts `assignment`, `narrow`, `wide`, `weight`, `lineHeight`,
|
|
297
|
+
`tracking` and `measure`. Endpoint sizes are reference pixels at a 16px root,
|
|
298
|
+
emitted as rem. Narrow is 8–256px; wide 8–512px and at least narrow. Weight is
|
|
299
|
+
1–1000, leading .8–3, tracking -.2–.5em and measure 0–120ch; zero measure means
|
|
300
|
+
layout-owned. These are predictable bounds, not a guarantee every combination
|
|
301
|
+
will look good.
|
|
302
|
+
|
|
303
|
+
`recommendations.body/ui` flags known contextual starting points. Other fonts
|
|
304
|
+
remain manually tunable. `warnings` identifies style weights outside a claimed
|
|
305
|
+
profile's range, retaining the authored value rather than silently clamping it.
|
|
306
|
+
Inspect warnings before accepting a theme. There is no universal readability
|
|
307
|
+
score or implicit normalization.
|
|
308
|
+
|
|
309
|
+
Context updates preserve explicit `styles` overrides. To reset a style or return
|
|
310
|
+
a metric to automatic behavior, omit that key from the next recipe and **replace**
|
|
311
|
+
the typography section, retaining other metadata/explicit values. Merge semantics
|
|
312
|
+
cannot delete a stored leaf by omission. To select a fresh starting point,
|
|
313
|
+
replace its recipe; merging only a preset ID intentionally retains old overrides.
|
|
314
|
+
When merging a saved font assignment, change its family and profile together
|
|
315
|
+
(use `manual` for an unfamiliar font), or replace the recipe. Merging only a
|
|
316
|
+
family retains a previously stored profile.
|
|
317
|
+
|
|
318
|
+
### Semantic HTML and local width
|
|
319
|
+
|
|
320
|
+
- `data-rad-text="prose-title"` selects presentation on any semantic element; it
|
|
321
|
+
does not set heading levels or ARIA roles. `typographyRoles` lists all 16 values:
|
|
322
|
+
prose title/heading/subheading/body/lead/small/quote; UI title/body/label/
|
|
323
|
+
supporting/caption/metric/eyebrow; display; code.
|
|
324
|
+
- `data-rad-prose` opts a container into Body typography, maximum measure and
|
|
325
|
+
flow. Its **direct** headings, paragraphs/lists, captions, quotes and `pre`
|
|
326
|
+
blocks receive their corresponding styles. Nested section wrappers can opt
|
|
327
|
+
into prose explicitly.
|
|
328
|
+
- Explicit `data-rad-text` wins over automatic element mapping. A direct block
|
|
329
|
+
with `data-rad-not-prose` or a Radiant `data-slot` host skips mapping/flow;
|
|
330
|
+
ordinary inherited font properties still inherit. Opt-out is not a reset.
|
|
331
|
+
- `data-rad-type-container` establishes the named `radiant-type` inline-size
|
|
332
|
+
container. Put it on the content column, including nested columns. Heading/
|
|
333
|
+
display sizing interpolates over 24–56rem of local width. Body/UI sizes stay
|
|
334
|
+
fixed rem values. Without an opt-in ancestor, roles use their compact endpoint.
|
|
335
|
+
|
|
336
|
+
Hooks are low-specificity rules in the components layer. Utilities, ordinary
|
|
337
|
+
application CSS and inline styles override them. Token shorthand utilities are
|
|
338
|
+
registered by property in the existing class merger, for example
|
|
339
|
+
`text-(--rad-typography-roles-prose-title-size)` and
|
|
340
|
+
`font-(--rad-typography-roles-prose-title-family)`. An application Tailwind build
|
|
341
|
+
must generate new utilities; importing precompiled library CSS does not do that.
|
|
342
|
+
|
|
343
|
+
Measure is a maximum, not minimum width or exact character count. Prose wraps
|
|
344
|
+
long words; preformatted code scrolls within its box. Give scrollable code
|
|
345
|
+
keyboard access and an appropriate name where needed. UI styles leave measure
|
|
346
|
+
to the layout. Inline code uses .9em and inherited weight/leading, not block-code
|
|
347
|
+
line boxes. Actual italic/weight assets are required; text-style hosts disable
|
|
348
|
+
synthetic font styles.
|
|
349
|
+
|
|
350
|
+
Direct token authoring uses `roles[role].size` for the compact endpoint and
|
|
351
|
+
`fluidSize` for the responsive expression. Set both to fix a style at all widths,
|
|
352
|
+
or set equal `narrow`/`wide` inputs. Other role leaves are `family`, `weight`,
|
|
353
|
+
`lineHeight`, `letterSpacing` and `measure`; prose flow leaves are
|
|
354
|
+
`flow.paragraph`, `headingBefore` and `headingAfter`.
|
|
355
|
+
|
|
356
|
+
### Fonts, migration and verification
|
|
357
|
+
|
|
358
|
+
Load chosen families/styles/weights with your application's font loader or
|
|
359
|
+
self-hosted `@font-face`. Presets contain family/fallback lists, not font URLs,
|
|
360
|
+
bytes or loaders. `typography.fonts` remains portable metadata; it does not load
|
|
361
|
+
fonts or automatically select assignments. The role baseline follows the legacy
|
|
362
|
+
shared family, with system monospace for code. Generated presets explicitly
|
|
363
|
+
select their named families.
|
|
364
|
+
|
|
365
|
+
### Component roles and earlier themes
|
|
366
|
+
|
|
367
|
+
Production families now consume the same UI roles as the workshop specimens:
|
|
368
|
+
|
|
369
|
+
| Text host | Shared role | Deliberate size owner |
|
|
370
|
+
| -------------------------------------------------------------------------- | ------------------------- | ---------------------------------------------------- |
|
|
371
|
+
| ThemeScope, Card, DialogContent, Field, Collapsible and disclosure content | `ui-body` | Role; `collapsible.contentSize` remains an exception |
|
|
372
|
+
| CardTitle, DialogTitle | `ui-title` | Role; component title size/weight overrides win |
|
|
373
|
+
| Field label/legend, CollapsibleTrigger, AccordionTrigger | `ui-label` | Role; Field label overrides win |
|
|
374
|
+
| Button, action-shaped Link | `ui-label` | Existing `controlSize` and Button font-size slots |
|
|
375
|
+
| Input | `ui-body` | Existing `controlSize` and Input font-size slot |
|
|
376
|
+
| Checkbox/Radio label | `ui-label` | Existing `controlSize` and label-size slots |
|
|
377
|
+
| Field help/error, CardDescription, DialogDescription | `ui-supporting` | Role; existing component size slots win |
|
|
378
|
+
| Inline/subtle Link | Inherits surrounding text | Parent text, including prose and code assignments |
|
|
379
|
+
|
|
380
|
+
Roles supply family, weight, line height and tracking. Component UI text uses
|
|
381
|
+
`size` (the compact endpoint), without prose measure limits or prose margins.
|
|
382
|
+
Control sizes deliberately keep their 13/14/15px font metrics and 32/40/48px
|
|
383
|
+
height/min-height defaults. Changing UI rhythm/style size therefore changes
|
|
384
|
+
ordinary interface copy and labels, while size-constrained controls retain their
|
|
385
|
+
metrics. To change those metrics, author `control.small/medium/large.fontSize`
|
|
386
|
+
(and height/padding as needed), or a supported component font-size exception.
|
|
387
|
+
Button and action-shaped Link share the Button-only typography exceptions.
|
|
388
|
+
Accordion and Dialog actions reuse disclosure/Button styling respectively.
|
|
389
|
+
|
|
390
|
+
The baseline `ui-body`, `ui-label`, `ui-title` and `ui-supporting` roles alias
|
|
391
|
+
legacy family, size, weight and tracking leaves. Earlier themes and every built-in
|
|
392
|
+
preset therefore retain their authored families/sizes/weights and deliberate
|
|
393
|
+
Button exceptions. Baseline UI leading is now explicit: Body/Supporting 1.5,
|
|
394
|
+
Label 1.4 and Title 1.3. Checkbox/Radio labels and disclosure triggers now use the
|
|
395
|
+
shared label weight rather than inheriting body weight. These wrapping/rhythm
|
|
396
|
+
changes require matching package JavaScript/CSS and layout review.
|
|
397
|
+
|
|
398
|
+
To migrate a theme, replace `family/bodySize/bodyWeight` with `roles['ui-body']`,
|
|
399
|
+
`smallSize` with `roles['ui-supporting'].size`, `headingSize/headingWeight` with
|
|
400
|
+
`roles['ui-title']`, and `labelWeight` with `roles['ui-label'].weight`. The earlier
|
|
401
|
+
shared family/tracking fields affect all four baseline roles; specify those
|
|
402
|
+
leaves on each role to retain that breadth. Prefer a `typesetting` recipe when
|
|
403
|
+
you want independently assigned Body/Headings/UI/Code families and repeatable
|
|
404
|
+
rhythms. A recipe materializes these roles and then explicit `values`/mode role
|
|
405
|
+
leaves override it; legacy leaves no longer control recipe-owned roles. There
|
|
406
|
+
is no implicit recipe adoption or destructive migration of stored documents.
|
|
407
|
+
Local component variables, caller utilities and ordinary CSS retain precedence.
|
|
408
|
+
When migrating a legacy CSS variable applied directly to a text host, set the
|
|
409
|
+
corresponding role variable on that host; inherited role aliases may already
|
|
410
|
+
have resolved on the enclosing theme scope.
|
|
411
|
+
|
|
412
|
+
New `roles` and `flow` are ordinary shared token leaves with partial/mode
|
|
413
|
+
overrides. Older 0.0.4 parsers reject the new authoring keys; consume matching
|
|
414
|
+
package JavaScript/CSS and defer the public docs pin to chapter promotion.
|
|
415
|
+
|
|
416
|
+
Canonical examples: **System → Typography → Roles / Prose / Components / Serif Interface / Mono Interface**. The installed
|
|
417
|
+
artifact gate verifies all 16 roles at 320/390/640/800px, both modes, nested
|
|
418
|
+
containers and named/mode-only scopes, caller overrides, flow, inline code and
|
|
419
|
+
root-enlargement/text-spacing probes through compiled CSS and Tailwind, each
|
|
420
|
+
with/without reset. These fixtures use system fallbacks; actual-font quality
|
|
421
|
+
remains bounded by DEV-162's recorded study. Browser zoom, manual AT, more scripts/
|
|
422
|
+
browsers, production component adoption and final public review remain chapter
|
|
423
|
+
acceptance work.
|
|
424
|
+
|
|
221
425
|
## Generate a color wall
|
|
222
426
|
|
|
223
427
|
```ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cognitap/radiant",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "React interaction components and presentation primitives",
|
|
5
5
|
"homepage": "https://github.com/cognitap/radiant#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"CHANGELOG.md",
|
|
17
17
|
"RELEASE_POLICY.md",
|
|
18
18
|
"docs/system.md",
|
|
19
|
+
"docs/motion.md",
|
|
19
20
|
"docs/accessibility.md",
|
|
20
21
|
"docs/theming.md",
|
|
21
22
|
"dist/library",
|
|
@@ -24,7 +25,8 @@
|
|
|
24
25
|
"src/styles.css",
|
|
25
26
|
"src/themes/baseline.css",
|
|
26
27
|
"!src/**/*.stories.*",
|
|
27
|
-
"!src/**/*.test.*"
|
|
28
|
+
"!src/**/*.test.*",
|
|
29
|
+
"src/typography.css"
|
|
28
30
|
],
|
|
29
31
|
"type": "module",
|
|
30
32
|
"sideEffects": [
|
|
@@ -41,6 +43,18 @@
|
|
|
41
43
|
"./color": {
|
|
42
44
|
"types": "./dist/library/color/index.d.ts",
|
|
43
45
|
"default": "./dist/library/color/index.js"
|
|
46
|
+
},
|
|
47
|
+
"./typography": {
|
|
48
|
+
"types": "./dist/library/typography/index.d.ts",
|
|
49
|
+
"default": "./dist/library/typography/index.js"
|
|
50
|
+
},
|
|
51
|
+
"./motion": {
|
|
52
|
+
"types": "./dist/library/motion/index.d.ts",
|
|
53
|
+
"default": "./dist/library/motion/index.js"
|
|
54
|
+
},
|
|
55
|
+
"./motion/react": {
|
|
56
|
+
"types": "./dist/library/motion/react.d.ts",
|
|
57
|
+
"default": "./dist/library/motion/react.js"
|
|
44
58
|
}
|
|
45
59
|
},
|
|
46
60
|
"publishConfig": {
|
|
@@ -50,7 +64,8 @@
|
|
|
50
64
|
},
|
|
51
65
|
"dependencies": {
|
|
52
66
|
"class-variance-authority": "0.7.1",
|
|
53
|
-
"cn": "0.4.0"
|
|
67
|
+
"cn": "0.4.0",
|
|
68
|
+
"motion": "14.7.1"
|
|
54
69
|
},
|
|
55
70
|
"devDependencies": {
|
|
56
71
|
"@storybook/addon-a11y": "10.6.1",
|
|
@@ -111,7 +126,8 @@
|
|
|
111
126
|
"lint": "oxlint --deny-warnings",
|
|
112
127
|
"format": "oxfmt",
|
|
113
128
|
"format:check": "oxfmt --check",
|
|
114
|
-
"check:source": "pnpm theme:check && pnpm format:check && pnpm lint && pnpm typecheck",
|
|
129
|
+
"check:source": "pnpm theme:check && pnpm format:check && pnpm lint && pnpm typecheck && pnpm docs:check",
|
|
130
|
+
"docs:check": "node scripts/check-docs.mjs",
|
|
115
131
|
"check:ci": "pnpm check:source && pnpm test && pnpm build:storybook && pnpm test:browser:smoke",
|
|
116
132
|
"check": "pnpm check:source && pnpm test --styles --compositions && pnpm build:storybook && pnpm test:browser",
|
|
117
133
|
"test:compositions": "pnpm build && node scripts/verify-package.mjs --compositions",
|
package/src/Button.tsx
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import type { ComponentProps, ReactElement } from 'react'
|
|
4
4
|
import { Fragment, isValidElement } from 'react'
|
|
5
|
+
import { callerOwnsPress, springPressClass, offPressClass } from './motion/pressPolicy.js'
|
|
6
|
+
import { usePressHost } from './motion/host.js'
|
|
5
7
|
import { actionVariants } from './actionStyles.js'
|
|
6
8
|
import type { ButtonVariant, ControlSize, Tone } from './presentation.js'
|
|
7
9
|
import { cn } from './cn.js'
|
|
@@ -31,10 +33,14 @@ export type ButtonProps = Omit<ComponentProps<'button'>, 'style'> & {
|
|
|
31
33
|
iconOnly?: boolean
|
|
32
34
|
fullWidth?: boolean
|
|
33
35
|
pending?: boolean
|
|
36
|
+
/** Requires MotionProvider. Off also suppresses legacy spatial transitions. */
|
|
37
|
+
motion?: 'inherit' | 'off'
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
export function Button({
|
|
37
41
|
render,
|
|
42
|
+
motion = 'inherit',
|
|
43
|
+
ref,
|
|
38
44
|
type = 'button',
|
|
39
45
|
variant = 'solid',
|
|
40
46
|
tone = 'accent',
|
|
@@ -47,15 +53,56 @@ export function Button({
|
|
|
47
53
|
children,
|
|
48
54
|
...props
|
|
49
55
|
}: ButtonProps) {
|
|
56
|
+
const callerOwnsScale = callerOwnsPress(props.style, className)
|
|
57
|
+
const press = usePressHost(ref, motion === 'off' || callerOwnsScale)
|
|
58
|
+
const spatial = (press.active || motion === 'off') && !callerOwnsScale
|
|
50
59
|
const buttonProps: ButtonRenderProps = {
|
|
51
60
|
...props,
|
|
61
|
+
ref: press.active ? press.ref : ref,
|
|
62
|
+
onPointerDown: event => {
|
|
63
|
+
props.onPointerDown?.(event)
|
|
64
|
+
if (!pending && !event.defaultPrevented) press.press(event.nativeEvent)
|
|
65
|
+
},
|
|
66
|
+
onPointerUp: event => {
|
|
67
|
+
props.onPointerUp?.(event)
|
|
68
|
+
press.release()
|
|
69
|
+
},
|
|
70
|
+
onPointerCancel: event => {
|
|
71
|
+
props.onPointerCancel?.(event)
|
|
72
|
+
press.release()
|
|
73
|
+
},
|
|
74
|
+
onPointerLeave: event => {
|
|
75
|
+
props.onPointerLeave?.(event)
|
|
76
|
+
press.release()
|
|
77
|
+
},
|
|
78
|
+
onLostPointerCapture: event => {
|
|
79
|
+
props.onLostPointerCapture?.(event)
|
|
80
|
+
press.release()
|
|
81
|
+
},
|
|
82
|
+
onBlur: event => {
|
|
83
|
+
props.onBlur?.(event)
|
|
84
|
+
press.release()
|
|
85
|
+
},
|
|
86
|
+
onKeyDown: event => {
|
|
87
|
+
props.onKeyDown?.(event)
|
|
88
|
+
if (!pending && !event.defaultPrevented) press.press(event.nativeEvent)
|
|
89
|
+
},
|
|
90
|
+
onKeyUp: event => {
|
|
91
|
+
props.onKeyUp?.(event)
|
|
92
|
+
press.release()
|
|
93
|
+
},
|
|
52
94
|
type,
|
|
53
95
|
'aria-busy': pending || props['aria-busy'],
|
|
54
96
|
'data-slot': joinIds('button', props['data-slot']) ?? 'button',
|
|
55
97
|
'data-variant': variant,
|
|
56
98
|
'data-tone': tone,
|
|
57
99
|
'data-control-size': controlSize,
|
|
58
|
-
className: cn(
|
|
100
|
+
className: cn(
|
|
101
|
+
actionVariants({ variant, tone, controlSize, iconOnly, fullWidth }),
|
|
102
|
+
spatial && springPressClass,
|
|
103
|
+
motion === 'off' && !callerOwnsScale && offPressClass,
|
|
104
|
+
className
|
|
105
|
+
),
|
|
59
106
|
onClick: composeAction(
|
|
60
107
|
onClick,
|
|
61
108
|
undefined,
|
|
@@ -76,6 +123,7 @@ export function Button({
|
|
|
76
123
|
)
|
|
77
124
|
}
|
|
78
125
|
if (!render) return <button {...buttonProps}>{buttonProps.children}</button>
|
|
126
|
+
// oxlint-disable-next-line react/refs -- The render contract forwards refs; it does not read ref.current.
|
|
79
127
|
const element = render(buttonProps)
|
|
80
128
|
if (
|
|
81
129
|
!isValidElement(element) ||
|
package/src/Card.tsx
CHANGED
|
@@ -9,7 +9,7 @@ const colorMotionClass =
|
|
|
9
9
|
|
|
10
10
|
const cardVariants = cva([
|
|
11
11
|
colorMotionClass,
|
|
12
|
-
'
|
|
12
|
+
'font-[family-name:var(--rad-typography-roles-ui-body-family,system-ui,sans-serif)] tracking-[var(--rad-typography-roles-ui-body-letter-spacing,-0.011em)] text-[length:var(--rad-typography-roles-ui-body-size,0.875rem)] font-[number:var(--rad-typography-roles-ui-body-weight,400)] leading-[var(--rad-typography-roles-ui-body-line-height,1.5)]',
|
|
13
13
|
'box-border grid w-full gap-[var(--rad-card-gap,var(--rad-surface-gap,1rem))] text-start antialiased',
|
|
14
14
|
'rounded-[var(--rad-card-radius,var(--rad-surface-radius,0.75rem))]',
|
|
15
15
|
'[corner-shape:var(--rad-card-corner-shape,var(--rad-surface-corner-shape,round))]',
|
|
@@ -29,17 +29,19 @@ const cardHeaderVariants = cva([
|
|
|
29
29
|
|
|
30
30
|
const cardTitleVariants = cva([
|
|
31
31
|
colorMotionClass,
|
|
32
|
-
'm-0 min-w-0 break-words
|
|
33
|
-
'
|
|
34
|
-
'[
|
|
32
|
+
'm-0 min-w-0 break-words',
|
|
33
|
+
'font-[family-name:var(--rad-typography-roles-ui-title-family,system-ui,sans-serif)] tracking-[var(--rad-typography-roles-ui-title-letter-spacing,-0.015em)]',
|
|
34
|
+
'text-[length:var(--rad-card-title-size,var(--rad-typography-roles-ui-title-size,1.125rem))] leading-[var(--rad-typography-roles-ui-title-line-height,1.3)]',
|
|
35
|
+
'font-[number:var(--rad-card-title-weight,var(--rad-typography-roles-ui-title-weight,600))]',
|
|
35
36
|
'forced-colors:text-[CanvasText]'
|
|
36
37
|
])
|
|
37
38
|
|
|
38
39
|
const cardDescriptionVariants = cva([
|
|
39
40
|
colorMotionClass,
|
|
40
|
-
'm-0 min-w-0 break-words
|
|
41
|
+
'm-0 min-w-0 break-words',
|
|
41
42
|
'[color:var(--rad-card-description-color,var(--rad-color-muted-foreground,oklch(0.45_0.01_286)))]',
|
|
42
|
-
'[font-
|
|
43
|
+
'font-[family-name:var(--rad-typography-roles-ui-supporting-family,system-ui,sans-serif)] font-[number:var(--rad-typography-roles-ui-supporting-weight,400)] tracking-[var(--rad-typography-roles-ui-supporting-letter-spacing,0em)]',
|
|
44
|
+
'text-[length:var(--rad-card-description-size,var(--rad-typography-roles-ui-supporting-size,0.8125rem))] leading-[var(--rad-typography-roles-ui-supporting-line-height,1.5)]',
|
|
43
45
|
'forced-colors:text-[CanvasText]'
|
|
44
46
|
])
|
|
45
47
|
|
package/src/Checkbox.tsx
CHANGED
|
@@ -43,10 +43,10 @@ const markClass =
|
|
|
43
43
|
'pointer-events-none absolute inset-0 size-full scale-65 [color:var(--rad-checkbox-mark,var(--rad-color-accent-foreground,oklch(0.985_0_0)))] peer-disabled:[color:var(--rad-checkbox-mark,var(--rad-color-muted-foreground,oklch(0.45_0.01_286)))] forced-colors:text-[HighlightText] forced-colors:peer-disabled:text-[GrayText]'
|
|
44
44
|
|
|
45
45
|
const rowClass =
|
|
46
|
-
'
|
|
46
|
+
'inline-flex min-h-6 cursor-pointer items-center gap-[var(--rad-checkbox-gap,var(--rad-spacing-label-gap,0.5rem))] select-none has-disabled:cursor-not-allowed'
|
|
47
47
|
|
|
48
48
|
const labelClass =
|
|
49
|
-
'
|
|
49
|
+
'font-[family-name:var(--rad-typography-roles-ui-label-family,system-ui,sans-serif)] tracking-[var(--rad-typography-roles-ui-label-letter-spacing,-0.011em)] font-[number:var(--rad-typography-roles-ui-label-weight,400)] [color:var(--rad-checkbox-label-color,var(--rad-color-foreground,oklch(0.21_0.006_286)))] text-[length:var(--rad-checkbox-label-size,var(--_rad-control-font-size))] leading-[var(--rad-typography-roles-ui-label-line-height,1.4)]'
|
|
50
50
|
|
|
51
51
|
export type CheckboxProps = Omit<
|
|
52
52
|
ComponentProps<'input'>,
|
package/src/Collapsible.tsx
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import type { ComponentProps, ToggleEvent } from 'react'
|
|
4
4
|
import { createContext, useContext, useId } from 'react'
|
|
5
5
|
import { cva } from 'class-variance-authority'
|
|
6
|
+
import { useTransitionHost } from './motion/host.js'
|
|
6
7
|
import { cn } from './cn.js'
|
|
7
8
|
import { joinIds } from './internal/ids.js'
|
|
8
9
|
import type { ThemeStyle } from './themes/defineTheme.js'
|
|
@@ -13,8 +14,8 @@ const colorMotionClass =
|
|
|
13
14
|
|
|
14
15
|
const collapsibleVariants = cva([
|
|
15
16
|
colorMotionClass,
|
|
16
|
-
'
|
|
17
|
-
'group box-border grid w-full gap-[var(--rad-collapsible-gap,var(--rad-surface-gap,1rem))] text-start antialiased',
|
|
17
|
+
'font-[family-name:var(--rad-typography-roles-ui-body-family,system-ui,sans-serif)] tracking-[var(--rad-typography-roles-ui-body-letter-spacing,-0.011em)] text-[length:var(--rad-typography-roles-ui-body-size,0.875rem)] font-[number:var(--rad-typography-roles-ui-body-weight,400)] leading-[var(--rad-typography-roles-ui-body-line-height,1.5)]',
|
|
18
|
+
'group box-border grid w-full min-w-0 gap-[var(--rad-collapsible-gap,var(--rad-surface-gap,1rem))] text-start antialiased',
|
|
18
19
|
'rounded-[var(--rad-collapsible-radius,var(--rad-surface-radius,0.75rem))]',
|
|
19
20
|
'[corner-shape:var(--rad-collapsible-corner-shape,var(--rad-surface-corner-shape,round))]',
|
|
20
21
|
'[border-width:var(--rad-collapsible-border-width,var(--rad-surface-border-width,1px))]',
|
|
@@ -35,7 +36,8 @@ const collapsibleVariants = cva([
|
|
|
35
36
|
|
|
36
37
|
const collapsibleTriggerVariants = cva([
|
|
37
38
|
colorMotionClass,
|
|
38
|
-
'
|
|
39
|
+
'font-[family-name:var(--rad-typography-roles-ui-label-family,system-ui,sans-serif)] text-[length:var(--rad-typography-roles-ui-label-size,0.875rem)] font-[number:var(--rad-typography-roles-ui-label-weight,550)] leading-[var(--rad-typography-roles-ui-label-line-height,1.4)] tracking-[var(--rad-typography-roles-ui-label-letter-spacing,0em)]',
|
|
40
|
+
'box-border flex w-full min-w-0 cursor-pointer break-words items-center gap-[var(--rad-collapsible-gap,var(--rad-surface-gap,1rem))]',
|
|
39
41
|
'list-none p-[var(--rad-collapsible-padding,var(--rad-surface-padding,1.5rem))]',
|
|
40
42
|
'[&::-webkit-details-marker]:hidden [&::marker]:content-none',
|
|
41
43
|
'focus-visible:rounded-[var(--rad-collapsible-radius,var(--rad-surface-radius,0.75rem))]',
|
|
@@ -59,13 +61,14 @@ const collapsibleContentVariants = cva([
|
|
|
59
61
|
colorMotionClass,
|
|
60
62
|
'min-w-0 px-[var(--rad-collapsible-padding,var(--rad-surface-padding,1.5rem))] pb-[var(--rad-collapsible-padding,var(--rad-surface-padding,1.5rem))]',
|
|
61
63
|
'[color:var(--rad-collapsible-content-color,var(--rad-color-foreground,oklch(0.21_0.006_286)))]',
|
|
62
|
-
'[
|
|
64
|
+
'text-[length:var(--rad-collapsible-content-size,var(--rad-typography-roles-ui-body-size,0.875rem))]',
|
|
63
65
|
'forced-colors:text-[CanvasText]'
|
|
64
66
|
])
|
|
65
67
|
|
|
66
68
|
export type CollapsibleProps = Omit<ComponentProps<'details'>, 'open' | 'onToggle' | 'style'> &
|
|
67
69
|
({ open: boolean; defaultOpen?: never } | { open?: undefined; defaultOpen?: boolean }) & {
|
|
68
70
|
style?: ThemeStyle
|
|
71
|
+
motion?: 'inherit' | 'off'
|
|
69
72
|
'data-slot'?: string
|
|
70
73
|
onOpenChange?: (open: boolean) => void
|
|
71
74
|
onToggle?: (event: ToggleEvent<HTMLDetailsElement>) => void
|
|
@@ -102,12 +105,15 @@ function useCollapsibleContext() {
|
|
|
102
105
|
export function Collapsible({
|
|
103
106
|
open,
|
|
104
107
|
defaultOpen,
|
|
108
|
+
motion = 'inherit',
|
|
109
|
+
ref,
|
|
105
110
|
onOpenChange,
|
|
106
111
|
onToggle,
|
|
107
112
|
className,
|
|
108
113
|
children,
|
|
109
114
|
...props
|
|
110
115
|
}: CollapsibleProps) {
|
|
116
|
+
const transition = useTransitionHost<HTMLDetailsElement>('disclosure', ref, motion === 'off')
|
|
111
117
|
const contentId = useId()
|
|
112
118
|
const {
|
|
113
119
|
value: isOpen,
|
|
@@ -125,7 +131,14 @@ export function Collapsible({
|
|
|
125
131
|
<CollapsibleContext.Provider value={{ open: isOpen, contentId, setOpen }}>
|
|
126
132
|
<details
|
|
127
133
|
{...props}
|
|
128
|
-
|
|
134
|
+
ref={transition.active ? transition.ref : ref}
|
|
135
|
+
className={cn(
|
|
136
|
+
collapsibleVariants(),
|
|
137
|
+
transition.active &&
|
|
138
|
+
'[&::details-content]:[content-visibility:visible] [&::details-content]:transition-none [&:not([open])::details-content]:h-[var(--_rad-spring-details-height,0px)] open:[&::details-content]:h-[var(--_rad-spring-details-height,auto)]',
|
|
139
|
+
motion === 'off' && '[&::details-content]:transition-none',
|
|
140
|
+
className
|
|
141
|
+
)}
|
|
129
142
|
data-slot={joinIds('collapsible', props['data-slot'])}
|
|
130
143
|
data-state={isOpen ? 'open' : 'closed'}
|
|
131
144
|
open={isOpen}
|
package/src/Dialog.tsx
CHANGED
|
@@ -4,6 +4,8 @@ import type { ComponentProps, MouseEvent, ReactNode } from 'react'
|
|
|
4
4
|
import { createContext, useContext, useEffect, useId, useRef, useState } from 'react'
|
|
5
5
|
import { cva } from 'class-variance-authority'
|
|
6
6
|
import { Button, type ButtonProps, type ButtonRenderProps } from './Button.js'
|
|
7
|
+
import { callerOwnsPress } from './motion/pressPolicy.js'
|
|
8
|
+
import { useTransitionHost } from './motion/host.js'
|
|
7
9
|
import { cn } from './cn.js'
|
|
8
10
|
import { composeAction } from './internal/events.js'
|
|
9
11
|
import { joinIds } from './internal/ids.js'
|
|
@@ -16,7 +18,7 @@ const colorMotionClass =
|
|
|
16
18
|
|
|
17
19
|
const dialogVariants = cva([
|
|
18
20
|
colorMotionClass,
|
|
19
|
-
'
|
|
21
|
+
'font-[family-name:var(--rad-typography-roles-ui-body-family,system-ui,sans-serif)] tracking-[var(--rad-typography-roles-ui-body-letter-spacing,-0.011em)] text-[length:var(--rad-typography-roles-ui-body-size,0.875rem)] font-[number:var(--rad-typography-roles-ui-body-weight,400)] leading-[var(--rad-typography-roles-ui-body-line-height,1.5)]',
|
|
20
22
|
'box-border text-start antialiased',
|
|
21
23
|
'[&:not([open])]:hidden',
|
|
22
24
|
'open:m-auto open:grid open:overflow-auto open:overscroll-contain',
|
|
@@ -45,17 +47,19 @@ const dialogVariants = cva([
|
|
|
45
47
|
|
|
46
48
|
const dialogTitleVariants = cva([
|
|
47
49
|
colorMotionClass,
|
|
48
|
-
'm-0 min-w-0 break-words
|
|
49
|
-
'
|
|
50
|
-
'[
|
|
50
|
+
'm-0 min-w-0 break-words',
|
|
51
|
+
'font-[family-name:var(--rad-typography-roles-ui-title-family,system-ui,sans-serif)] tracking-[var(--rad-typography-roles-ui-title-letter-spacing,-0.015em)]',
|
|
52
|
+
'text-[length:var(--rad-dialog-title-size,var(--rad-typography-roles-ui-title-size,1.125rem))] leading-[var(--rad-typography-roles-ui-title-line-height,1.3)]',
|
|
53
|
+
'font-[number:var(--rad-dialog-title-weight,var(--rad-typography-roles-ui-title-weight,600))]',
|
|
51
54
|
'forced-colors:text-[CanvasText]'
|
|
52
55
|
])
|
|
53
56
|
|
|
54
57
|
const dialogDescriptionVariants = cva([
|
|
55
58
|
colorMotionClass,
|
|
56
|
-
'm-0 min-w-0 break-words
|
|
59
|
+
'm-0 min-w-0 break-words',
|
|
57
60
|
'[color:var(--rad-dialog-description-color,var(--rad-color-muted-foreground,oklch(0.45_0.01_286)))]',
|
|
58
|
-
'[font-
|
|
61
|
+
'font-[family-name:var(--rad-typography-roles-ui-supporting-family,system-ui,sans-serif)] font-[number:var(--rad-typography-roles-ui-supporting-weight,400)] tracking-[var(--rad-typography-roles-ui-supporting-letter-spacing,0em)]',
|
|
62
|
+
'text-[length:var(--rad-dialog-description-size,var(--rad-typography-roles-ui-supporting-size,0.8125rem))] leading-[var(--rad-typography-roles-ui-supporting-line-height,1.5)]',
|
|
59
63
|
'forced-colors:text-[CanvasText]'
|
|
60
64
|
])
|
|
61
65
|
|
|
@@ -91,6 +95,7 @@ export type DialogTriggerProps = ButtonProps
|
|
|
91
95
|
|
|
92
96
|
export type DialogContentProps = Omit<ComponentProps<'dialog'>, 'open' | 'style'> & {
|
|
93
97
|
style?: ThemeStyle
|
|
98
|
+
motion?: 'inherit' | 'off'
|
|
94
99
|
}
|
|
95
100
|
|
|
96
101
|
export type DialogTitleProps = Omit<ComponentProps<'h2'>, 'style'> & { style?: ThemeStyle }
|
|
@@ -182,6 +187,7 @@ export function DialogTrigger(props: DialogTriggerProps) {
|
|
|
182
187
|
}
|
|
183
188
|
|
|
184
189
|
export function DialogContent({
|
|
190
|
+
motion = 'inherit',
|
|
185
191
|
className,
|
|
186
192
|
onClick,
|
|
187
193
|
onCancel,
|
|
@@ -191,7 +197,12 @@ export function DialogContent({
|
|
|
191
197
|
}: DialogContentProps) {
|
|
192
198
|
const dialog = useDialogContext()
|
|
193
199
|
const nodeRef = useRef<HTMLDialogElement>(null)
|
|
194
|
-
const
|
|
200
|
+
const transition = useTransitionHost<HTMLDialogElement>(
|
|
201
|
+
'dialog',
|
|
202
|
+
ref,
|
|
203
|
+
motion === 'off' || callerOwnsPress(props.style, className)
|
|
204
|
+
)
|
|
205
|
+
const hostRef = useComposedRefs(nodeRef, transition.active ? transition.ref : ref)
|
|
195
206
|
const unmounting = useRef(false)
|
|
196
207
|
const previousModal = useRef(dialog.modal)
|
|
197
208
|
// Bumps after the browser closes a dialog whose controlled `open` value is still true.
|
package/src/Field.tsx
CHANGED
|
@@ -10,7 +10,7 @@ import type { PartStyle } from './presentation.js'
|
|
|
10
10
|
|
|
11
11
|
const fieldVariants = cva(
|
|
12
12
|
[
|
|
13
|
-
'
|
|
13
|
+
'font-[family-name:var(--rad-typography-roles-ui-body-family,system-ui,sans-serif)] tracking-[var(--rad-typography-roles-ui-body-letter-spacing,-0.011em)] text-[length:var(--rad-typography-roles-ui-body-size,0.875rem)] font-[number:var(--rad-typography-roles-ui-body-weight,400)] leading-[var(--rad-typography-roles-ui-body-line-height,1.5)]',
|
|
14
14
|
'grid min-w-0 [gap:var(--rad-field-gap,var(--rad-spacing-field-gap,0.375rem))]',
|
|
15
15
|
// Dim controls/labels once; help and error text must stay readable.
|
|
16
16
|
'in-[[data-slot~=field][data-disabled]]:[--_rad-disabled-opacity:1]',
|
|
@@ -30,13 +30,13 @@ const fieldVariants = cva(
|
|
|
30
30
|
)
|
|
31
31
|
|
|
32
32
|
const labelClass =
|
|
33
|
-
'min-w-0 break-words p-0 [color:var(--rad-field-label-color,var(--rad-color-foreground,oklch(0.21_0.006_286)))] [
|
|
33
|
+
'min-w-0 break-words p-0 [color:var(--rad-field-label-color,var(--rad-color-foreground,oklch(0.21_0.006_286)))] text-[length:var(--rad-field-label-size,var(--rad-typography-roles-ui-label-size,0.875rem))] font-[number:var(--rad-field-label-weight,var(--rad-typography-roles-ui-label-weight,550))] forced-colors:text-[CanvasText] font-[family-name:var(--rad-typography-roles-ui-label-family,system-ui,sans-serif)] leading-[var(--rad-typography-roles-ui-label-line-height,1.4)] tracking-[var(--rad-typography-roles-ui-label-letter-spacing,0em)]'
|
|
34
34
|
|
|
35
35
|
const descriptionClass =
|
|
36
|
-
'min-w-0 break-words [color:var(--rad-field-description-color,var(--rad-color-muted-foreground,oklch(0.45_0.01_286)))] [
|
|
36
|
+
'min-w-0 break-words [color:var(--rad-field-description-color,var(--rad-color-muted-foreground,oklch(0.45_0.01_286)))] text-[length:var(--rad-field-description-size,var(--rad-typography-roles-ui-supporting-size,0.8125rem))] forced-colors:text-[CanvasText] font-[family-name:var(--rad-typography-roles-ui-supporting-family,system-ui,sans-serif)] leading-[var(--rad-typography-roles-ui-supporting-line-height,1.5)] tracking-[var(--rad-typography-roles-ui-supporting-letter-spacing,0em)] font-[number:var(--rad-typography-roles-ui-supporting-weight,400)]'
|
|
37
37
|
|
|
38
38
|
const errorClass =
|
|
39
|
-
'min-w-0 break-words [color:var(--rad-field-error-color,var(--rad-color-invalid,oklch(0.56_0.19_25)))] [
|
|
39
|
+
'min-w-0 break-words [color:var(--rad-field-error-color,var(--rad-color-invalid,oklch(0.56_0.19_25)))] text-[length:var(--rad-field-error-size,var(--rad-typography-roles-ui-supporting-size,0.8125rem))] forced-colors:text-[CanvasText] font-[family-name:var(--rad-typography-roles-ui-supporting-family,system-ui,sans-serif)] leading-[var(--rad-typography-roles-ui-supporting-line-height,1.5)] tracking-[var(--rad-typography-roles-ui-supporting-letter-spacing,0em)] font-[number:var(--rad-typography-roles-ui-supporting-weight,400)]'
|
|
40
40
|
|
|
41
41
|
const requiredClass =
|
|
42
42
|
'ms-[0.25em] [color:var(--rad-field-required-color,var(--rad-color-invalid,oklch(0.56_0.19_25)))] forced-colors:text-[CanvasText]'
|
package/src/Input.tsx
CHANGED
|
@@ -14,9 +14,10 @@ const inputVariants = cva([
|
|
|
14
14
|
'box-border w-full min-w-0',
|
|
15
15
|
'h-[var(--rad-input-height,var(--_rad-control-height))]',
|
|
16
16
|
'px-[var(--rad-input-padding,var(--_rad-control-padding))]',
|
|
17
|
-
'
|
|
18
|
-
'[
|
|
19
|
-
'[
|
|
17
|
+
'font-[family-name:var(--rad-input-font-family,var(--rad-typography-roles-ui-body-family,system-ui,sans-serif))] tracking-[var(--rad-typography-roles-ui-body-letter-spacing,-0.011em)]',
|
|
18
|
+
'text-[length:var(--rad-input-font-size,var(--_rad-control-font-size))]',
|
|
19
|
+
'leading-[var(--rad-typography-roles-ui-body-line-height,1.5)]',
|
|
20
|
+
'font-[number:var(--rad-input-font-weight,var(--rad-typography-roles-ui-body-weight,400))]',
|
|
20
21
|
'[color:var(--rad-input-color,var(--rad-color-foreground,oklch(0.21_0.006_286)))]',
|
|
21
22
|
'bg-[var(--rad-input-background,var(--rad-color-surface,oklch(1_0_0)))]',
|
|
22
23
|
'[border-width:var(--rad-input-border-width,var(--rad-control-border-width,1px))]',
|
package/src/Link.tsx
CHANGED
|
@@ -7,7 +7,6 @@ import type { ThemeStyle } from './themes/defineTheme.js'
|
|
|
7
7
|
|
|
8
8
|
const linkVariants = cva(
|
|
9
9
|
[
|
|
10
|
-
'[font-family:var(--rad-typography-family,system-ui,sans-serif)] [letter-spacing:var(--rad-typography-letter-spacing,-0.011em)]',
|
|
11
10
|
'[color:var(--_link-color)] [text-underline-offset:var(--rad-link-underline-offset,0.1875rem)]',
|
|
12
11
|
'transition-colors duration-[var(--rad-link-color-duration,var(--rad-motion-color-duration,150ms))]',
|
|
13
12
|
'hover:[color:var(--_link-hover)]',
|
package/src/RadioGroup.tsx
CHANGED
|
@@ -44,10 +44,10 @@ const dotClass =
|
|
|
44
44
|
'pointer-events-none absolute inset-[30%] rounded-[var(--rad-radio-radius,999px)] bg-[var(--rad-radio-mark,var(--rad-color-accent-foreground,oklch(0.985_0_0)))] peer-disabled:bg-[var(--rad-radio-mark,var(--rad-color-muted-foreground,oklch(0.45_0.01_286)))] opacity-0 peer-checked:opacity-100 forced-colors:bg-[HighlightText] forced-colors:peer-disabled:bg-[GrayText]'
|
|
45
45
|
|
|
46
46
|
const rowClass =
|
|
47
|
-
'
|
|
47
|
+
'inline-flex min-h-6 cursor-pointer items-center gap-[var(--rad-radio-label-gap,var(--rad-spacing-label-gap,0.5rem))] select-none has-disabled:cursor-not-allowed'
|
|
48
48
|
|
|
49
49
|
const labelClass =
|
|
50
|
-
'
|
|
50
|
+
'font-[family-name:var(--rad-typography-roles-ui-label-family,system-ui,sans-serif)] tracking-[var(--rad-typography-roles-ui-label-letter-spacing,-0.011em)] font-[number:var(--rad-typography-roles-ui-label-weight,400)] [color:var(--rad-radio-label-color,var(--rad-color-foreground,oklch(0.21_0.006_286)))] text-[length:var(--rad-radio-label-size,var(--_rad-control-font-size))] leading-[var(--rad-typography-roles-ui-label-line-height,1.4)]'
|
|
51
51
|
|
|
52
52
|
const optionsClass =
|
|
53
53
|
'grid justify-items-start gap-[var(--rad-radio-group-gap,var(--rad-spacing-group-gap,0.75rem))]'
|