@nxgt/material 3.4.0 → 3.6.0
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 +78 -0
- package/README.md +2 -2
- package/dist/components/components.css +1 -0
- package/dist/components/theme-tokens.css +78 -71
- package/dist/components/tones/tokens.css +5 -5
- package/dist/components/ui/display/chip/chip-hairline.css +1 -1
- package/dist/components/ui/layout/app-shell/activity-backdrop.css +24 -0
- package/dist/components/ui/layout/sidebar/sidebar-tokens.css +1 -1
- package/dist/components/ui/overlays/dialog/dialog.css +2 -2
- package/dist/components/ui/primitives/field-box/field-box-tokens.css +1 -1
- package/dist/components/ui/primitives/toggle-group/toggle-group-segmented.css +2 -2
- package/dist/components/ui/primitives/toggle-group/toggle-group-separate.css +1 -1
- package/dist/{components-p7VoF7gR.js → components-BCYZgeoV.js} +21 -14
- package/dist/components.js +1 -1
- package/dist/lib/components/ui/layout/app-shell/activity-layout.d.ts +23 -1
- package/dist/main.js +1 -1
- package/dist/material.css +1 -1
- package/docs/components/data-display.md +2 -2
- package/docs/components/navigation-and-layout.md +1 -0
- package/docs/guides/app-shell.md +47 -0
- package/docs/guides/backgrounds.md +7 -1
- package/docs/guides/theming.md +86 -43
- package/docs/troubleshooting.md +50 -3
- package/lib/components/components.css +1 -0
- package/lib/components/theme-tokens.css +78 -71
- package/lib/components/tones/tokens.css +5 -5
- package/lib/components/ui/display/chip/chip-hairline.css +1 -1
- package/lib/components/ui/layout/app-shell/activity-backdrop.css +24 -0
- package/lib/components/ui/layout/sidebar/sidebar-tokens.css +1 -1
- package/lib/components/ui/overlays/dialog/dialog.css +2 -2
- package/lib/components/ui/primitives/field-box/field-box-tokens.css +1 -1
- package/lib/components/ui/primitives/toggle-group/toggle-group-segmented.css +2 -2
- package/lib/components/ui/primitives/toggle-group/toggle-group-separate.css +1 -1
- package/package.json +1 -1
|
@@ -60,7 +60,7 @@ Parts: `Avatar` (the composed one), `AvatarBase`, `AvatarImage`,
|
|
|
60
60
|
| `shape` | `ShapeName` | — | clips the photo to one of the expressive shapes instead of a circle; the fallback is framed by it when there is no `src` or it fails to load. `alt` names it. Unset: the round avatar, unchanged |
|
|
61
61
|
| `tone` | the eight named tones, or a tone of your own declared in `AppTones` | neutral | the fallback fills with the tone's container, draws its initials or icon in the tone's text colour (`--nxgt-tone-text`, also when there is no `tone`) and a hairline in it (3:1 against the page or card). A loaded photo is not tinted |
|
|
62
62
|
|
|
63
|
-
The hairline's strength is `--avatar-ring-share`, the share of the tone's text colour mixed into the surface (default `
|
|
63
|
+
The hairline's strength is `--avatar-ring-share`, the share of the tone's text colour mixed into the surface (default `68%`, from `--nxgt-tone-ring-share`; 3:1 or more at that value). Override it in your CSS:
|
|
64
64
|
|
|
65
65
|
```css
|
|
66
66
|
:root { --avatar-ring-share: 80%; }
|
|
@@ -435,7 +435,7 @@ import { StatCard } from '@nxgt/material/components';
|
|
|
435
435
|
|
|
436
436
|
Parts: the root carries `data-slot="stat-card"`, `data-variant` and, when a tone applies, `data-tone` (the tone, or `neutral` on a `tonal` or `filled` card without one); the icon wrapper carries `data-slot="stat-card-icon"`. The types `StatCardProps`, `StatCardVariant` and `StatCardValueSize` are exported.
|
|
437
437
|
|
|
438
|
-
In `filled`, the delta and its trend arrow take the on-colour too (the arrow and the sign still say up or down). The outline's share is `--stat-card-ring-share` (`
|
|
438
|
+
In `filled`, the delta and its trend arrow take the on-colour too (the arrow and the sign still say up or down). The outline's share is `--stat-card-ring-share` (`68%`, or `--nxgt-tone-ring-share` for every ring); it draws the tonal card's border, the filled card's edge in a calm zone and the hairline round the icon chip. Known limit: the dark theme's primary `filled` card has an edge of about 2.3:1 on a `Card` and 2.5:1 on the page (its text is 7:1); a `tonal` card avoids it. See [App tones](../guides/theming.md#app-tones-on-shape-fab-avatar-statcard-and-the-metric-cards).
|
|
439
439
|
|
|
440
440
|
**Storybook:** `Data display/StatCard`, `Data display/StatCard/Tones` · **Vue:** `StatCard`
|
|
441
441
|
|
|
@@ -81,6 +81,7 @@ phone's menu sheet pad clear of `env(safe-area-inset-*)`, as classes; see the
|
|
|
81
81
|
| `titleAs` | `'h1'` … `'h6'` \| `'div'` | `'h1'` | `ActivityContent`: the title's heading level |
|
|
82
82
|
| `inset` | `boolean` | `false` | `ActivityContent`: pads the content 1rem on each side. Off, it lines up with the app bar and the cards |
|
|
83
83
|
| `align` | `'start' \| 'center'` | `'start'` | `ActivityLayout`, `AppSidebar`: the collapsed rail's entries sit right under the brand, or `'center'` for centred in the height below it |
|
|
84
|
+
| `backdrop` | `ReactNode` | — | `ActivityLayout`: a decorative background behind the frame, in place of the gradient and its blobs: a `Background` preset from `@nxgt/material/backgrounds`. Rendered in an `inert`, `aria-hidden` layer that fills the layout. See [Use a background preset behind the shell](../guides/app-shell.md#use-a-background-preset-behind-the-shell) |
|
|
84
85
|
| `routeTransition` | `boolean \| Omit<ViewTransitionProps, 'children' \| 'ref'>` | `true` | `ActivityLayout`: React's `<ViewTransition>` around the content region, so a navigation cross-fades it. `false` renders none (your app has its own boundary); an object passes `default` / `update` classes, `name`, callbacks through. See [Route transitions](../guides/app-shell.md#route-transitions) |
|
|
85
86
|
|
|
86
87
|
The active entry is the longest match across the whole menu, segment-aware.
|
package/docs/guides/app-shell.md
CHANGED
|
@@ -191,6 +191,7 @@ partitionMenu(items); // { content, footer }
|
|
|
191
191
|
| `align` | `'start' \| 'center'` | `'start'` | Where the collapsed rail's entries sit: right under the brand, or centred in the height below it |
|
|
192
192
|
| `menuOpen` | `boolean` | — | Controls the phone's menu sheet: open while `true`. Leave it out and the layout manages the sheet. Only a phone shows the sheet |
|
|
193
193
|
| `onMenuOpenChange` | `(open: boolean) => void` | — | Called for every change of the sheet: the menu button, Escape, the close button, a followed link, a new location |
|
|
194
|
+
| `backdrop` | `ReactNode` | — | A decorative background drawn behind the frame in place of the built-in gradient and blobs: usually a `Background` preset from `@nxgt/material/backgrounds` (see [Use a background preset behind the shell](#use-a-background-preset-behind-the-shell)) |
|
|
194
195
|
|
|
195
196
|
On a page with `viewport-fit=cover` (an installed PWA drawing under a
|
|
196
197
|
notch and the home indicator), the shell pads clear of
|
|
@@ -483,6 +484,52 @@ while the sheet is open, so leave ids out of it. A link in `brand` (a home
|
|
|
483
484
|
link around the logo) is the sheet's first focusable element, so it takes
|
|
484
485
|
the focus when the sheet opens.
|
|
485
486
|
|
|
487
|
+
## Use a background preset behind the shell
|
|
488
|
+
|
|
489
|
+
The shell draws the gradient with three blurred blobs behind its frame. To use
|
|
490
|
+
one of the 44 presets of `@nxgt/material/backgrounds` instead, pass it as
|
|
491
|
+
`backdrop`:
|
|
492
|
+
|
|
493
|
+
```tsx
|
|
494
|
+
import { Outlet } from 'react-router';
|
|
495
|
+
import { ActivityLayout, type MenuItem } from '@nxgt/material/components';
|
|
496
|
+
import { Background, MOTIF_SHAPES_ALL } from '@nxgt/material/backgrounds';
|
|
497
|
+
import '@nxgt/material/backgrounds.css'; // or one preset's backgrounds/<preset>.css
|
|
498
|
+
|
|
499
|
+
export function Shell({ items }: { items: MenuItem[] }) {
|
|
500
|
+
return (
|
|
501
|
+
<ActivityLayout
|
|
502
|
+
items={items}
|
|
503
|
+
backdrop={<Background preset="shapes" motif={{ shapes: MOTIF_SHAPES_ALL }} />}
|
|
504
|
+
>
|
|
505
|
+
<Outlet />
|
|
506
|
+
</ActivityLayout>
|
|
507
|
+
);
|
|
508
|
+
}
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
- **It replaces the gradient.** While `backdrop` is given the layout's root
|
|
512
|
+
carries `data-backdrop`, and the built-in gradient (its tint and three blobs) is not drawn (plain
|
|
513
|
+
CSS, no inline `style`). Without it the markup and the look are what they
|
|
514
|
+
were; `null`, `undefined` and `false` count as none.
|
|
515
|
+
- **It sits behind everything.** The node is wrapped in a layer
|
|
516
|
+
(`[data-slot="activity-layout-backdrop"]`) that fills the layout, under the
|
|
517
|
+
sidebar, the header and the content. The layer is `inert`, `aria-hidden="true"`
|
|
518
|
+
and takes no pointer, so the preset is decoration only: put nothing
|
|
519
|
+
interactive in it.
|
|
520
|
+
- **It fills the layout.** A `Background` in the layer is sized to the layer,
|
|
521
|
+
not to `100lvw × 100lvh`, so you need no `className` or `fill`. In
|
|
522
|
+
`scroll="document"` the layout grows with the content, and so does the preset.
|
|
523
|
+
- **Readable by design.** The frame keeps `bg-background-paper` and the sidebar
|
|
524
|
+
and header their `bg-background/40`, so the content reads over a busy preset.
|
|
525
|
+
Tone it down with the preset's `intensity` (`subtle`) rather than by
|
|
526
|
+
restyling the frame.
|
|
527
|
+
- **The stylesheet is yours to import.** `@nxgt/material/backgrounds` is a
|
|
528
|
+
separate entry, so `ActivityLayout` never pulls it in: import it where you
|
|
529
|
+
build the `backdrop`, and its `backgrounds.css` once.
|
|
530
|
+
- The `--nxgt-bg-blob-1..3` variables recolour the built-in blobs only; the
|
|
531
|
+
`blobs` preset reads them too.
|
|
532
|
+
|
|
486
533
|
## Route transitions
|
|
487
534
|
|
|
488
535
|
`ActivityLayout` wraps its content region (`data-slot="activity-content-region"`)
|
|
@@ -296,12 +296,18 @@ you can select on:
|
|
|
296
296
|
The gradient ends on `--nxgt-bg-cp`, not `--nxgt-bg-c2`: to recolour it, set
|
|
297
297
|
`--nxgt-bg-cp` too.
|
|
298
298
|
|
|
299
|
+
## Behind the app shell
|
|
300
|
+
|
|
301
|
+
`ActivityLayout` takes a preset as its `backdrop`, replacing the gradient and
|
|
302
|
+
its blobs: `backdrop={<Background preset="shapes" motif={{ shapes: MOTIF_SHAPES_ALL }} />}`.
|
|
303
|
+
See [Use a background preset behind the shell](./app-shell.md#use-a-background-preset-behind-the-shell).
|
|
304
|
+
|
|
299
305
|
## Recolour the blobs
|
|
300
306
|
|
|
301
307
|
The gradient's three blobs have a public API: `--nxgt-bg-blob-1`, `--nxgt-bg-blob-2` and `--nxgt-bg-blob-3`.
|
|
302
308
|
Each takes any colour. Unset, a blob keeps the tone's gradient, so adding the
|
|
303
309
|
variables changes nothing until you set one. The `blobs` preset reads the same variables. `ActivityLayout` draws the same
|
|
304
|
-
blobs, so set them on `[data-slot="activity-layout"]`:
|
|
310
|
+
blobs (unless it has a `backdrop`), so set them on `[data-slot="activity-layout"]`:
|
|
305
311
|
|
|
306
312
|
```css
|
|
307
313
|
[data-slot="activity-layout"] {
|
package/docs/guides/theming.md
CHANGED
|
@@ -90,6 +90,48 @@ container is the accent colour itself, the same as `bg-accent`.
|
|
|
90
90
|
|
|
91
91
|
Put `text-foreground` on a container; it stays well above 4.5:1 in both themes.
|
|
92
92
|
|
|
93
|
+
## The neutral palette
|
|
94
|
+
|
|
95
|
+
The neutrals of both themes are softly tinted toward violet (hue 290, low
|
|
96
|
+
chroma), to sit with the primary indigo instead of fighting it. The values:
|
|
97
|
+
|
|
98
|
+
| Token | Light | Dark |
|
|
99
|
+
| --- | --- | --- |
|
|
100
|
+
| `--background` | `oklch(0.973 0.008 293.9)` | `oklch(0.192 0.016 290.5)` |
|
|
101
|
+
| `--card`, `--popover` / `--sidebar` | white / `oklch(0.985 0.006 293.9)` | `oklch(0.232 0.019 289.4)` |
|
|
102
|
+
| `--foreground` | `oklch(0.227 0.017 290)` | `oklch(0.943 0.012 291.3)` |
|
|
103
|
+
| `--muted`, `--accent` | `oklch(0.955 0.012 292)`, `oklch(0.91 0.016 293)` | `oklch(0.27 0.022 290)` |
|
|
104
|
+
| `--muted-foreground` | `oklch(0.478 0.032 292)` | `oklch(0.725 0.03 292.2)` |
|
|
105
|
+
| `--border`, `--input` | `oklch(0.912 0.016 293.7)` | `oklch(0.301 0.025 291.4)`, `oklch(0.34 0.027 291.4)` |
|
|
106
|
+
|
|
107
|
+
Earlier versions used a blue-slate neutral (hue 247 to 266; the dark
|
|
108
|
+
background `oklch(0.14 0.036 258.53)` was a deep navy). To bring it back,
|
|
109
|
+
redefine the tokens after the stylesheet import, under the same selectors;
|
|
110
|
+
the main ones are below and the changelog of `@nxgt/material` 3.6.0 lists
|
|
111
|
+
every old value (accent, ring, sidebar, tooltip, secondary and the others):
|
|
112
|
+
|
|
113
|
+
```css
|
|
114
|
+
:root {
|
|
115
|
+
--background: oklch(1 0 0);
|
|
116
|
+
--foreground: oklch(0.14 0.036 258.53);
|
|
117
|
+
--muted: oklch(0.968 0.007 247.896);
|
|
118
|
+
--muted-foreground: oklch(0.52 0.046 257.417);
|
|
119
|
+
--border: oklch(0.929 0.013 255.508);
|
|
120
|
+
--input: oklch(0.929 0.013 255.508);
|
|
121
|
+
}
|
|
122
|
+
.dark,
|
|
123
|
+
[data-theme="dark"] {
|
|
124
|
+
--background: oklch(0.14 0.036 258.53);
|
|
125
|
+
--foreground: oklch(0.984 0.003 247.858);
|
|
126
|
+
--card: oklch(0.208 0.042 265.755);
|
|
127
|
+
--popover: oklch(0.208 0.042 265.755);
|
|
128
|
+
--muted: oklch(0.279 0.041 260.031);
|
|
129
|
+
--muted-foreground: oklch(0.66 0.046 257.417);
|
|
130
|
+
--border: oklch(1 0 0 / 10%);
|
|
131
|
+
--input: oklch(1 0 0 / 15%);
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
93
135
|
## Motion and shape tokens
|
|
94
136
|
|
|
95
137
|
`styles.css` also carries Material 3 expressive motion and corner tokens, as
|
|
@@ -227,12 +269,12 @@ any tone, yours included:
|
|
|
227
269
|
| `--nxgt-tone-on` | `text-tone-on` | what is drawn on it |
|
|
228
270
|
| `--nxgt-tone-container` | `bg-tone-container` | a tint of it over the surface it sits on |
|
|
229
271
|
| `--nxgt-tone-text` | `text-tone-text` | it as text on the page or its container |
|
|
230
|
-
| `--nxgt-tone-ring-share` | — | the share of the text colour in the ring below (`
|
|
272
|
+
| `--nxgt-tone-ring-share` | — | the share of the text colour in the ring below (`68%`, set on `:root`) |
|
|
231
273
|
| `--nxgt-tone-ring` | `border-(--nxgt-tone-ring)` | a hairline: its text colour mixed into the surface at that share, 3:1 against it |
|
|
232
274
|
|
|
233
275
|
The ring is drawn by: the `Avatar` fallback (the inset hairline, or the stroke of a shaped one); the tonal `StatCard` outline, the edges of its filled card and the ring round its icon chip; the outline and rank badge of a toned metric card; and, in a [calm zone](#calm-zone), the edge of a tonal `Shape`, an `Avatar`, a `StatCard` and a rank badge once their container steps back.
|
|
234
276
|
|
|
235
|
-
Which knob changes which ring: `--nxgt-tone-ring-share` is the shared one, and being inherited it works on `:root` (`:root { --nxgt-tone-ring-share: 80%; }` makes every ring stronger) or on a wrapper (only the rings inside it). A component with a knob of its own, `--avatar-ring-share` or `--stat-card-ring-share`, takes it over for that component only: it applies to the component's own element, it is not inherited by a tone nested inside it, and `--stat-card-ring-share` draws every edge of the `StatCard`. Keep a ring at 3:1 or more against its surface (
|
|
277
|
+
Which knob changes which ring: `--nxgt-tone-ring-share` is the shared one, and being inherited it works on `:root` (`:root { --nxgt-tone-ring-share: 80%; }` makes every ring stronger) or on a wrapper (only the rings inside it). A component with a knob of its own, `--avatar-ring-share` or `--stat-card-ring-share`, takes it over for that component only: it applies to the component's own element, it is not inherited by a tone nested inside it, and `--stat-card-ring-share` draws every edge of the `StatCard`. Keep a ring at 3:1 or more against its surface (68 % does in light and dark) when you change the share.
|
|
236
278
|
|
|
237
279
|
```tsx
|
|
238
280
|
<span data-tone="success" className="bg-tone-container text-tone-text">
|
|
@@ -742,22 +784,22 @@ the rest yourself. Without the class the anchor keeps the prose style.
|
|
|
742
784
|
## Contrast and reduced motion
|
|
743
785
|
|
|
744
786
|
**Contrast.** The shipped light palette keeps the text of every filled status
|
|
745
|
-
colour at 4.5:1 or more (WCAG 1.4.3): `--secondary`
|
|
746
|
-
`--info`
|
|
787
|
+
colour at 4.5:1 or more (WCAG 1.4.3): `--secondary` 6.2:1, `--success` 6.1:1,
|
|
788
|
+
`--info` 6.3:1 and `--warning` 5.5:1 against their `-foreground`, and
|
|
747
789
|
`--secondary` as text (a `tonal`, `outlined` or `link` `Button`) 6.0:1 on
|
|
748
790
|
`--background`, 4.8:1 on its own 15 % `tonal` tint.
|
|
749
791
|
|
|
750
792
|
The dark theme keeps brighter values, read as text on the dark surfaces: the
|
|
751
|
-
dark `--tertiary` (`oklch(0.7 0.15 310.75)`) is
|
|
752
|
-
|
|
793
|
+
dark `--tertiary` (`oklch(0.7 0.15 310.75)`) is 6.5:1 on `--background` and
|
|
794
|
+
5.9:1 on `--card`, with a dark `--tertiary-foreground` that keeps 6.5:1 on
|
|
753
795
|
a filled tertiary surface (light: 7.6:1 under near-white). The dark
|
|
754
|
-
`--secondary` (`oklch(0.
|
|
755
|
-
and 5.8:1 on `--card` (a `tonal` secondary `Button` 5.
|
|
796
|
+
`--secondary` (`oklch(0.675 0.1135 245.65)`) is 6.3:1 on `--background`
|
|
797
|
+
and 5.8:1 on `--card` (a `tonal` secondary `Button` 5.1:1 and 4.6:1). Under
|
|
756
798
|
near-white text those brights are too light, so every filled surface built on
|
|
757
799
|
them is tinted in the dark theme: a filled `secondary` `Button`, `IconButton`
|
|
758
|
-
or `Badge` at 70 % (5.2:1 on `--background`, 4.9:1 on `--card`), a filled
|
|
759
|
-
`success`, `info` or `warning` one at 60 % (7.
|
|
760
|
-
`--background`; 6.
|
|
800
|
+
or `Badge` at 70 % (4.9 to 5.2:1 on `--background`, 4.7 to 4.9:1 on `--card`), a filled
|
|
801
|
+
`success`, `info` or `warning` one at 60 % (7.1:1, 5.6:1 and 5.8:1 on
|
|
802
|
+
`--background`; 6.8:1, 5.3:1 and 5.5:1 on `--card`; the `warning` `Button` 5.9:1). Their hover, focus and
|
|
761
803
|
pressed states are tinted further down, so they only gain contrast.
|
|
762
804
|
|
|
763
805
|
In the light theme the filled `primary`, `secondary`, `success`, `info`,
|
|
@@ -773,11 +815,11 @@ The `tonal`, `outlined` and `link` variants of `Button` and `IconButton` draw
|
|
|
773
815
|
their text and icon in one tone per colour, read on `--background`, on
|
|
774
816
|
`--card` and on the variant's own tint (15 % at most, at rest or focused). In
|
|
775
817
|
the light theme `primary`, `secondary`, `info` and `success` use the token
|
|
776
|
-
itself (5.
|
|
777
|
-
token mixed with 15 % black (6.
|
|
778
|
-
mixed with 60 % white, the `--primary-text` token (
|
|
779
|
-
2.2:1), `success` and `warning` with 15 % white (
|
|
780
|
-
30 % white (5.
|
|
818
|
+
itself (5.4, 4.8, 4.9 and 4.7:1 at their lowest) and `warning` and `error` the
|
|
819
|
+
token mixed with 15 % black (6.0 and 5.0:1). In the dark theme `primary` is
|
|
820
|
+
mixed with 60 % white, the `--primary-text` token (7.7:1 at its lowest: the token itself is a dark indigo,
|
|
821
|
+
2.2:1), `success` and `warning` with 15 % white (4.8 and 5.8:1), `error` with
|
|
822
|
+
30 % white (5.5:1), and `secondary` and `info` use the token (4.6 and 5.0:1).
|
|
781
823
|
The tones are mixed from the tokens (`color-mix(in oklab, var(--color-error)
|
|
782
824
|
85%, black)`), so an override of a token moves its tone with it; a text colour
|
|
783
825
|
of your own on one of those buttons (`className="text-primary-text"`) replaces the tone
|
|
@@ -796,32 +838,32 @@ the filled surface's near-white text below 4.5:1 (`0.62` gives 3.85:1).
|
|
|
796
838
|
the light theme, 70 in the dark one), so a warning `Alert`, `Banner`, `Badge`
|
|
797
839
|
or toast does not read as a failure. Light `oklch(0.52 0.13 62)` is 5.5:1
|
|
798
840
|
under its near-white `-foreground`; dark `oklch(0.7 0.15 70)` reads as text at
|
|
799
|
-
7
|
|
841
|
+
6.7:1 on `--background` and 6.1:1 on `--card` (5.9 and 5.3:1 on its 10 % tint). An app that overrides `--warning` keeps its own
|
|
800
842
|
value; one that keeps the shipped value sees its `bg-warning` and
|
|
801
843
|
`text-warning` surfaces change hue, and re-checks its custom pairs.
|
|
802
844
|
|
|
803
845
|
**A selected `DataTable` row** (`TableRow`, `data-state="selected"`) is a 15 %
|
|
804
846
|
primary tint with `foreground` text, a bar on the inline-start edge of its
|
|
805
847
|
first cell (`before:`, primary in the light theme, primary mixed with 60 %
|
|
806
|
-
white in the dark one: 5.
|
|
807
|
-
row), and the checkbox, drawn in the same dark colour (
|
|
808
|
-
tint is too light to be told from its neighbour alone (1.
|
|
848
|
+
white in the dark one: 5.4:1 in light and 7.7:1 or more in dark against the
|
|
849
|
+
row), and the checkbox, drawn in the same dark colour (7.7:1 or more). The
|
|
850
|
+
tint is too light to be told from its neighbour alone (1.25:1 in light, 1.10 to
|
|
809
851
|
1.11:1 in dark), which is what keeps the text at 4.5:1 or more on a page and on
|
|
810
|
-
a `Card`:
|
|
811
|
-
on a `Card` and
|
|
812
|
-
`text-muted-foreground` texts (drawn as `foreground` at 70 %) are
|
|
813
|
-
light and
|
|
852
|
+
a `Card`: 12.6:1 in light, and in dark 14.1:1 on a page, 12.9:1 in a `DataTable`
|
|
853
|
+
on a `Card` and for a bare `TableRow` on a `Card`. Links and
|
|
854
|
+
`text-muted-foreground` texts (drawn as `foreground` at 70 %) are 5.6:1 in
|
|
855
|
+
light and 7.0:1 in dark for a bare row on a `Card`. A `text-error-text` text
|
|
814
856
|
keeps its colour. Do not
|
|
815
857
|
put `text-primary-foreground` in a cell for a selected row: it is near-white
|
|
816
858
|
on that tint.
|
|
817
859
|
|
|
818
860
|
**Error text has a token of its own**, `--error-text` (`text-error-text`), so
|
|
819
861
|
the fill can stay dark while the text is light enough to read. The light value
|
|
820
|
-
is `color-mix(in oklab, var(--error)
|
|
821
|
-
|
|
862
|
+
is `color-mix(in oklab, var(--error) 92%, black)` (5.6:1 on `--background`,
|
|
863
|
+
6.0:1 on `--card`, 5.0:1 on the `bg-error/10` tint of a focused menu item, where
|
|
822
864
|
`--error` gives 5.0 and 4.2:1); the dark one is
|
|
823
|
-
`color-mix(in oklab, var(--error) 80%, white)`, 5.
|
|
824
|
-
5.
|
|
865
|
+
`color-mix(in oklab, var(--error) 80%, white)`, 5.4:1 on `--background` and
|
|
866
|
+
5.0:1 on `--card`, where `--error` itself gives 3.9 and 3.5:1. Field messages,
|
|
825
867
|
`HelperText` in its error state, form, dialog and upload errors, a textarea's
|
|
826
868
|
counter over its limit, the error lines of `Terminal`, a
|
|
827
869
|
`variant="error"` menu item and the falling values of the metric cards use it.
|
|
@@ -846,7 +888,8 @@ the override on the root.
|
|
|
846
888
|
**Primary text has a token of its own**, `--primary-text` (`text-primary-text`),
|
|
847
889
|
for the same reason: the brand colour is a dark fill (it keeps near-white text
|
|
848
890
|
readable on a button) and reads at only about 2:1 as text on the dark surfaces.
|
|
849
|
-
The light value is `var(--primary)
|
|
891
|
+
The light value is `color-mix(in oklab, var(--primary) 96%, black)` (primary
|
|
892
|
+
4 % toward black, 7.3:1 on the violet page); the dark one is
|
|
850
893
|
`color-mix(in oklab, var(--primary) 40%, white)` (primary mixed 60 % with
|
|
851
894
|
white, the recipe of the tonal `Button` labels). `Typography tone="primary"`,
|
|
852
895
|
the `Alert` primary icon, links, selected labels and the other primary text of
|
|
@@ -871,33 +914,33 @@ at rest, hovered, focused and pressed, the tracks and the tabs;
|
|
|
871
914
|
tokens after an override.
|
|
872
915
|
|
|
873
916
|
**Tabs.** An `underline` tab's active label is `--primary` in the light
|
|
874
|
-
theme (
|
|
875
|
-
`--primary` mixed with 60 % white in the dark one (
|
|
917
|
+
theme (6.8:1 on `--background`, 7.3:1 on `--card`, 6.4:1 on `--muted`) and
|
|
918
|
+
`--primary` mixed with 60 % white in the dark one (9.3:1, 8.5:1 and 7.6:1);
|
|
876
919
|
its bar and every tab's focus outline are `--primary` in the light theme and
|
|
877
|
-
`--track-fill` in the dark one (at least 6.7:1 and 9.
|
|
920
|
+
`--track-fill` in the dark one (at least 6.7:1 and 9.4:1 on those surfaces).
|
|
878
921
|
An inactive label is `--muted-foreground`, and turns to `--foreground` when
|
|
879
922
|
hovered. A `segmented` tab's active label is `--foreground` on the raised
|
|
880
|
-
surface (
|
|
881
|
-
the track, so it has a `--muted-foreground` border (5.
|
|
923
|
+
surface (17.1:1 light, 14.2:1 dark); that surface is only 1.1:1 to 1.2:1 on
|
|
924
|
+
the track, so it has a `--muted-foreground` border (5.8:1 light, 6.2:1 dark
|
|
882
925
|
on the track), and the label also changes colour and weight. Storybook's
|
|
883
926
|
`Guides/Theming/Contrast` story `Tabs` measures each label at rest, hovered
|
|
884
927
|
and focused, the outline, the bar and the border, on the three surfaces, in
|
|
885
928
|
both themes.
|
|
886
929
|
|
|
887
|
-
`--muted-foreground` is
|
|
888
|
-
"paper" tint (`bg-background-paper`, 5 % primary) and 5.
|
|
889
|
-
the light theme; in the dark theme it is
|
|
890
|
-
`--card`,
|
|
891
|
-
is a dark surface (`oklch(0.
|
|
892
|
-
near-white block on a dark page) and `--foreground` on it reaches
|
|
930
|
+
`--muted-foreground` is 6.2:1 on `--background`, 6.7:1 on `--card`, 5.7:1 on the
|
|
931
|
+
"paper" tint (`bg-background-paper`, 5 % primary) and 5.8:1 on `--muted` in
|
|
932
|
+
the light theme; in the dark theme it is 7.5:1 on `--background`, 6.9:1 on
|
|
933
|
+
`--card`, 7.3:1 on the paper tint and 6.2:1 on `--muted`. The dark `--muted`
|
|
934
|
+
is a dark surface (`oklch(0.27 0.022 290)`, it was the light value, a
|
|
935
|
+
near-white block on a dark page) and `--foreground` on it reaches 12.8:1.
|
|
893
936
|
|
|
894
937
|
**Tracks.** The empty part of a `Slider`, of the password strength meter and
|
|
895
938
|
the `Drawer` handle use `--track` (`bg-track`), and the `Slider`'s range and
|
|
896
939
|
thumb border `--track-fill` (`bg-track-fill`, `border-track-fill`). In the
|
|
897
|
-
dark theme the track reaches 3.
|
|
940
|
+
dark theme the track reaches 3.5:1 on `--background` and 3.2:1 on `--card`
|
|
898
941
|
(WCAG 1.4.11; `bg-muted`, a dark surface now, gave 1.4:1 and 1.2:1), and the
|
|
899
|
-
fill 3.
|
|
900
|
-
light `--muted`) and `--track-fill` is `--primary`: the thumb,
|
|
942
|
+
fill 3.3:1 on the track. The light theme keeps a pale track (`--track` is the
|
|
943
|
+
light `--muted`) and `--track-fill` is `--primary`: the thumb, 6.8:1 on the
|
|
901
944
|
page, shows the value. A track, bar, handle or divider of your own drawn with
|
|
902
945
|
`bg-muted` is near invisible in the dark theme now that `--muted` is a dark
|
|
903
946
|
surface: draw it with `bg-track`.
|
package/docs/troubleshooting.md
CHANGED
|
@@ -27,6 +27,7 @@ words in your error.
|
|
|
27
27
|
|
|
28
28
|
- [Components render unstyled, with no error](#components-render-unstyled-with-no-error)
|
|
29
29
|
- [A link is blue and underlined on hover and focus](#a-link-of-mine-or-of-a-component-is-blue-and-underlined-on-hover-and-focus)
|
|
30
|
+
- [The light and dark neutrals turned violet after upgrading to 3.6](#the-light-and-dark-neutrals-turned-violet-after-upgrading-to-36)
|
|
30
31
|
- [Math renders in the system fonts](#math-renders-in-the-system-fonts)
|
|
31
32
|
- [`<Icon>` renders nothing](#icon-renders-nothing)
|
|
32
33
|
- [An accessibility audit reports low contrast on a badge, a button, a toast or a menu entry](#an-accessibility-audit-reports-low-contrast-on-a-badge-a-button-a-toast-or-a-menu-entry)
|
|
@@ -58,6 +59,7 @@ words in your error.
|
|
|
58
59
|
- [My activity content lost its side padding, or the rail's entries moved up](#my-activity-content-lost-its-side-padding-or-the-rails-entries-moved-up)
|
|
59
60
|
- [axe reports `target-size` on a control under a form's sticky actions](#axe-reports-target-size-on-a-control-under-a-forms-sticky-actions)
|
|
60
61
|
- [`color-contrast` fails over the background blobs on phone](#color-contrast-fails-over-the-background-blobs-on-phone)
|
|
62
|
+
- [`ActivityLayout`'s `backdrop` shows nothing, or the blobs are still there](#activitylayouts-backdrop-shows-nothing-or-the-blobs-are-still-there)
|
|
61
63
|
- [Shaped Gallery tiles are plain rounded squares](#shaped-gallery-tiles-are-plain-rounded-squares)
|
|
62
64
|
- [A component with my own tone (Shape, Fab, Avatar, StatCard, a metric card) shows no colour, or `tone` is a type error](#a-component-with-my-own-tone-shape-fab-avatar-statcard-a-metric-card-shows-no-colour-or-tone-is-a-type-error)
|
|
63
65
|
- [A test expects the old `bg-muted` Avatar fallback, or a filled fallback shows a grey ring](#a-test-expects-the-old-bg-muted-avatar-fallback-or-a-filled-fallback-shows-a-grey-ring)
|
|
@@ -739,6 +741,34 @@ public/assets/icons/sprites/sharp-solid.svg ← <Icon name="atom" family="sharp"
|
|
|
739
741
|
|
|
740
742
|
Serve one sheet per style you use, from your own Font Awesome Pro kit.
|
|
741
743
|
|
|
744
|
+
### The light and dark neutrals turned violet after upgrading to 3.6
|
|
745
|
+
|
|
746
|
+
**When:** after `@nxgt/material` 3.6, the page, cards, borders and muted text
|
|
747
|
+
are softly violet-tinted (the dark background was a deep navy), and a
|
|
748
|
+
screenshot test, or a brand that sat on the old slate, no longer matches.
|
|
749
|
+
**Why:** the neutral tokens moved to hue 290 with low chroma in both themes
|
|
750
|
+
(the palette is listed in the [theming guide](guides/theming.md#the-neutral-palette)).
|
|
751
|
+
Primary and the status colours did not change, except that the light
|
|
752
|
+
`--secondary`, `--success` and `--info` and the dark `--secondary` moved
|
|
753
|
+
0.02 in lightness, so their tonal tints keep 4.5:1 on the new page colour.
|
|
754
|
+
**Fix:** update the screenshots, or redefine the old neutrals after the
|
|
755
|
+
stylesheet import, under `:root` and `.dark, [data-theme="dark"]`:
|
|
756
|
+
|
|
757
|
+
```css
|
|
758
|
+
.dark,
|
|
759
|
+
[data-theme="dark"] {
|
|
760
|
+
--background: oklch(0.14 0.036 258.53);
|
|
761
|
+
--card: oklch(0.208 0.042 265.755);
|
|
762
|
+
--popover: oklch(0.208 0.042 265.755);
|
|
763
|
+
--muted: oklch(0.279 0.041 260.031);
|
|
764
|
+
--border: oklch(1 0 0 / 10%);
|
|
765
|
+
}
|
|
766
|
+
```
|
|
767
|
+
|
|
768
|
+
The [theming guide](guides/theming.md#the-neutral-palette) has the main old
|
|
769
|
+
values for both themes (the `:root` block too); the changelog of 3.6.0 lists
|
|
770
|
+
every one.
|
|
771
|
+
|
|
742
772
|
### An accessibility audit reports low contrast on a badge, a button, a toast or a menu entry
|
|
743
773
|
|
|
744
774
|
**When:** axe (or Lighthouse) reports `color-contrast` on a `Badge` with
|
|
@@ -794,7 +824,7 @@ yours still fail, you override them.
|
|
|
794
824
|
In the dark theme, a filled `secondary` `Button` gave its near-white text
|
|
795
825
|
4.3:1, a `tonal` secondary one 3.9:1 (3.4:1 on `--card`), and a filled
|
|
796
826
|
`success`, `info` or `warning` one 3.5:1, 2.5:1 and 3.4:1. The dark
|
|
797
|
-
`--secondary` is brighter (`oklch(0.
|
|
827
|
+
`--secondary` is brighter (`oklch(0.675 ...)`, 6.3:1 as text on
|
|
798
828
|
`--background`), and the filled `secondary`, `success`, `info` and `warning`
|
|
799
829
|
`Button`s and `IconButton`s are filled in the dark theme with an opaque mix
|
|
800
830
|
toward `--background` (about 70 %), so their text keeps 4.5:1 over any backdrop.
|
|
@@ -871,12 +901,12 @@ subtitle colour of your own on a selected `ListTile` must reach 4.5:1 on
|
|
|
871
901
|
### An accessibility audit reports low contrast on error text in the dark theme
|
|
872
902
|
|
|
873
903
|
**When:** an error message, a validation hint or a red value of your own, in
|
|
874
|
-
the dark theme, fails 4.5:1 (about
|
|
904
|
+
the dark theme, fails 4.5:1 (about 3.9:1 on the page, 3.5:1 on a card); the
|
|
875
905
|
catalogue's own field messages pass.
|
|
876
906
|
**Why:** it is drawn with `text-error`, the fill colour. The dark `--error` is
|
|
877
907
|
kept dark enough for near-white text on a filled error surface, which makes it
|
|
878
908
|
too dark to read as text on the dark surfaces. Error text has its own token,
|
|
879
|
-
`--error-text`, lightened in the dark theme (5.
|
|
909
|
+
`--error-text`, lightened in the dark theme (5.4:1 on `--background`, 5.0:1 on
|
|
880
910
|
`--card`).
|
|
881
911
|
**Fix:** draw text with `text-error-text`; keep `text-error` for fills,
|
|
882
912
|
borders and icons that stand alone. On a `Button` or `IconButton` drop the
|
|
@@ -1254,6 +1284,23 @@ reports "needs review", not a failure), and delete the `[data-layer]` rules:
|
|
|
1254
1284
|
}
|
|
1255
1285
|
```
|
|
1256
1286
|
|
|
1287
|
+
### `ActivityLayout`'s `backdrop` shows nothing, or the blobs are still there
|
|
1288
|
+
|
|
1289
|
+
**When:** `<ActivityLayout backdrop={<Background preset="shapes" />}>` draws
|
|
1290
|
+
no shapes, or draws the gradient's blobs behind them.
|
|
1291
|
+
**Why:** the presets' CSS is not in `styles.css`, it is its own opt-in file, so
|
|
1292
|
+
without it the preset's layers have no look. The blobs are hidden by CSS keyed
|
|
1293
|
+
on `data-backdrop` in `styles.css`; they stay when the `Background` you pass
|
|
1294
|
+
comes from `@nxgt/material/components` (the gradient alone) and so draws its own
|
|
1295
|
+
blobs, or when the page loads a copy of `styles.css` older than 3.5.
|
|
1296
|
+
**Fix:** import `Background` from `@nxgt/material/backgrounds`, import
|
|
1297
|
+
`@nxgt/material/backgrounds.css` once, and keep `@nxgt/material` current.
|
|
1298
|
+
|
|
1299
|
+
```tsx
|
|
1300
|
+
import { Background } from '@nxgt/material/backgrounds';
|
|
1301
|
+
import '@nxgt/material/backgrounds.css';
|
|
1302
|
+
```
|
|
1303
|
+
|
|
1257
1304
|
### A ResponsiveButton no longer shows its tooltip next to its visible label
|
|
1258
1305
|
|
|
1259
1306
|
**When:** a `ResponsiveButton` with a `tooltip` on a desktop width (768 px and up, or `expanded`), where the tooltip used to appear beside the label.
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
@import "./ui/actions/button-group/button-group.css";
|
|
57
57
|
/* ActivityLayout: the route transition (cross-fade, none under reduced motion). */
|
|
58
58
|
@import "./ui/layout/app-shell/route-transition.css";
|
|
59
|
+
@import "./ui/layout/app-shell/activity-backdrop.css";
|
|
59
60
|
/* DataTable cards and tiles: the item shell (hairline, tint, start bar, columns by the list's width). */
|
|
60
61
|
@import "./ui/collections/data-table/data-table-items.css";
|
|
61
62
|
@import "./ui/collections/data-table/data-table-items-compact.css";
|