@crystal-ui/core 2.1.0 → 2.3.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/assets/crystal-theme.css +15 -0
- package/assets/crystal.css +652 -12
- package/assets/crystal.js +10 -0
- package/assets/motion.css +3 -3
- package/assets/motion.js +17 -2
- package/assets/tokens.js +1 -1
- package/docs/accessibility.md +19 -3
- package/docs/adoption.md +3 -1
- package/docs/catalogue.md +467 -53
- package/docs/components.md +36 -9
- package/docs/materials.md +12 -4
- package/docs/motion-components.md +11 -8
- package/docs/motion.md +10 -4
- package/docs/tokens.md +3 -2
- package/engines.js +13 -2
- package/exports/crystal-tokens.kt +2 -1
- package/exports/crystal-tokens.swift +2 -1
- package/exports/crystal-tokens.ts +2 -1
- package/package.json +2 -1
- package/tokens/catalogue/01-layout.json +45 -0
- package/tokens/catalogue/02-navigation.json +88 -6
- package/tokens/catalogue/03-actions.json +42 -2
- package/tokens/catalogue/04-inputs.json +359 -5
- package/tokens/catalogue/05-data-display.json +185 -21
- package/tokens/catalogue/06-feedback.json +75 -6
- package/tokens/catalogue/07-overlays.json +52 -5
- package/tokens/catalogue/08-typography.json +54 -0
- package/tokens/catalogue/09-utility.json +79 -0
- package/tokens/catalogue/10-charts.json +89 -1
- package/tokens/catalogue/11-media.json +33 -0
- package/tokens/catalogue/12-commerce.json +133 -1
- package/tokens/catalogue/13-screens.json +77 -0
- package/tokens/catalogue/14-blocks.json +101 -0
- package/tokens/catalogue.json +1656 -48
- package/tokens/crystal.json +3 -2
- package/tokens/crystal.tokens.json +7 -2
- package/tokens/motion-recipes.json +124 -96
- package/tokens/surfaces.json +177 -0
package/assets/crystal.css
CHANGED
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
:is(.cr-frost,.cr-acrylic):before{content:'';position:absolute;inset:0;pointer-events:none;z-index:-1;border-radius:inherit;opacity:var(--cr-grain-opacity);background-image:url('grain.svg')}
|
|
24
24
|
:is(.cr-resin,.cr-glass){background:var(--cr-resin-fill);border-radius:999px;box-shadow:var(--cr-shadow-float);backdrop-filter:blur(var(--cr-resin-blur)) saturate(var(--cr-resin-saturation));-webkit-backdrop-filter:blur(var(--cr-resin-blur)) saturate(var(--cr-resin-saturation))}
|
|
25
25
|
.cr-well{background:var(--cr-surface);border-radius:calc(var(--cr-radius) - 7px);color:var(--cr-text);border:1px solid var(--cr-edge)}
|
|
26
|
-
.cr-button{min-height:
|
|
27
|
-
|
|
26
|
+
.cr-button{min-height:48px;padding:15px 24px;border-radius:999px;border:1px solid transparent;font-weight:750;text-decoration:none;display:inline-flex;align-items:center;justify-content:center;gap:9px;line-height:1.3}
|
|
27
|
+
/* The button vocabulary is four names and none of them is a colour Crystal
|
|
28
28
|
does not have.
|
|
29
29
|
|
|
30
30
|
`.cr-button` is the action control: a Resin shell with the neutral Haze
|
|
@@ -90,7 +90,10 @@
|
|
|
90
90
|
.cr-bubble.own{background:transparent;color:var(--cr-content-own-text)}
|
|
91
91
|
.cr-bubble.own::before{background:var(--cr-haze-own-fill)}
|
|
92
92
|
.cr-well::before,.cr-content-fill::before{box-shadow:none}
|
|
93
|
-
|
|
93
|
+
/* Fixed centres a native <dialog>, which the browser gives inset:0 and auto
|
|
94
|
+
margins when it is modal. On any other element the class is the material and
|
|
95
|
+
the host positions it (D-29). */
|
|
96
|
+
dialog.cr-dialog{position:fixed}
|
|
94
97
|
.cr-dialog::before{box-shadow:var(--cr-shadow-float)}
|
|
95
98
|
:is(:is(.cr-haze,.cr-surface),.cr-well,.cr-bubble,.cr-content-fill,.cr-dialog) a:not(.cr-button){color:inherit;text-decoration:underline}
|
|
96
99
|
/* Place content >=12px from the feathered edge; functional boundaries remain explicit. */
|
|
@@ -329,10 +332,12 @@
|
|
|
329
332
|
|
|
330
333
|
In `@layer crystal.component`, which is where the preview had it and where the
|
|
331
334
|
layer order at the top of this file already reserves a slot. That matters for
|
|
332
|
-
more than tidiness: the rules above
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
335
|
+
more than tidiness: the rules above sit in `crystal.reset`, an earlier layer,
|
|
336
|
+
so these win regardless of specificity — which is what let a reset-layer hover
|
|
337
|
+
(D-21) and a reset-layer target size (D-20) publish values that never
|
|
338
|
+
rendered. A component recipe belongs in this layer or nowhere. The cascade is
|
|
339
|
+
the one the preview has been rendering all along, which is what makes this an
|
|
340
|
+
adoption rather than a redesign.
|
|
336
341
|
--------------------------------------------------------------------------- */
|
|
337
342
|
@layer crystal.component {
|
|
338
343
|
:is(button,a.cr-button,.cr-control,.cr-field-shell,.cr-resin-haze,.cr-status) {
|
|
@@ -538,26 +543,26 @@ span.cr-field-shell :is(input,select,textarea):focus-visible {
|
|
|
538
543
|
span.cr-field-shell {
|
|
539
544
|
padding-inline-end: 40px;
|
|
540
545
|
}
|
|
541
|
-
|
|
546
|
+
.cr-field-shell>.cr-indicator {
|
|
542
547
|
inset-block-start: 50%;
|
|
543
548
|
inset-inline-end: 10px;
|
|
544
549
|
transform: translateY(-50%);
|
|
545
550
|
width: 24px;
|
|
546
551
|
height: 24px;
|
|
547
552
|
}
|
|
548
|
-
|
|
553
|
+
.cr-field-shell>.cr-indicator::after {
|
|
549
554
|
content: '○';
|
|
550
555
|
font-size: 15px;
|
|
551
556
|
}
|
|
552
|
-
|
|
557
|
+
.cr-field-shell:focus-within>.cr-indicator::after {
|
|
553
558
|
content: '●';
|
|
554
559
|
font-size: 9px;
|
|
555
560
|
}
|
|
556
|
-
|
|
561
|
+
.cr-field-shell:has(:is([required],[aria-required=true]))>.cr-indicator::after {
|
|
557
562
|
content: '*';
|
|
558
563
|
font-size: 19px;
|
|
559
564
|
}
|
|
560
|
-
|
|
565
|
+
.cr-field-shell:has([aria-invalid=true])>.cr-indicator::after {
|
|
561
566
|
content: '!';
|
|
562
567
|
font-size: 15px;
|
|
563
568
|
}
|
|
@@ -1167,3 +1172,638 @@ span.cr-status>span {
|
|
|
1167
1172
|
}
|
|
1168
1173
|
}
|
|
1169
1174
|
}
|
|
1175
|
+
|
|
1176
|
+
|
|
1177
|
+
/* ---------------------------------------------------------------------------
|
|
1178
|
+
Component recipes for the catalogue — 28 September 2026.
|
|
1179
|
+
|
|
1180
|
+
`core/tokens/surfaces.json` names the closed set of material compositions a
|
|
1181
|
+
component may be made of, and every catalogue entry now says which it is.
|
|
1182
|
+
Most of the vocabulary was already here. Four compositions were not, and
|
|
1183
|
+
each was found the same way: Crystal React reached a component the catalogue
|
|
1184
|
+
specified, looked for the recipe, and rebuilt it locally with a comment
|
|
1185
|
+
saying Crystal had none. The R-19 sweep named them — a navigation link, a
|
|
1186
|
+
nav rail item, a drag handle, and the "bare" control that eighteen distinct
|
|
1187
|
+
controls and 127 instances had been approximating with `background:
|
|
1188
|
+
transparent`, which takes off one layer of the Resin coat and leaves four.
|
|
1189
|
+
|
|
1190
|
+
Each recipe is authored here, in `@layer crystal.component`, and nowhere
|
|
1191
|
+
else. Not in `crystal.reset`: D-20 and D-21 were both rules authored there
|
|
1192
|
+
that this layer erased, and a recipe that may not render is worse than none.
|
|
1193
|
+
|
|
1194
|
+
Everything reads tokens where a token exists and falls back to the literal
|
|
1195
|
+
the token publishes, so a stylesheet loaded without the generated theme
|
|
1196
|
+
still renders the same recipe.
|
|
1197
|
+
--------------------------------------------------------------------------- */
|
|
1198
|
+
@layer crystal.component {
|
|
1199
|
+
|
|
1200
|
+
/* A bare control.
|
|
1201
|
+
*
|
|
1202
|
+
* Selector note, which applies to the three recipes below: the coat is keyed on
|
|
1203
|
+
* `:is(button, a.cr-button, …)`, specificity (0,1,1), in this same layer. A lone
|
|
1204
|
+
* class is (0,1,0) and loses to it whatever the source order — measured, a
|
|
1205
|
+
* `<button class="cr-bare">` kept the fill, the rim and the blur. Each recipe
|
|
1206
|
+
* therefore carries the element compound and reaches (0,2,0). A rule that must
|
|
1207
|
+
* beat the coat and does not say so in its selector is D-20 by another route.
|
|
1208
|
+
*
|
|
1209
|
+
* Crystal paints the Resin coat by element — `:is(button, …)` above — so a
|
|
1210
|
+
* `<button>` wears the fill, the rim, the float shadow, the backdrop blur and
|
|
1211
|
+
* both feathered pseudo-layers whether or not anything asked. A control that
|
|
1212
|
+
* sits inside a surface which already has a coat must not wear a second one: a
|
|
1213
|
+
* disclosure chevron, a chip's remove button, a sort header, a stepper's arrows,
|
|
1214
|
+
* the dismiss button on a toast. Declaring `background: transparent` on one of
|
|
1215
|
+
* those takes off one layer of five. This takes off all five and keeps what a
|
|
1216
|
+
* control still owes — the 44px target, the pill hit area, the focus ring.
|
|
1217
|
+
*
|
|
1218
|
+
* It is not `.cr-button.quiet`. Quiet keeps the whole shell and drops only the
|
|
1219
|
+
* reading pad, which is what makes a quiet *button* quiet; a chevron is not a
|
|
1220
|
+
* Resin control that has been quietened.
|
|
1221
|
+
*/
|
|
1222
|
+
:is(button, a, [role=button], .cr-bare).cr-bare {
|
|
1223
|
+
display: inline-flex;
|
|
1224
|
+
align-items: center;
|
|
1225
|
+
justify-content: center;
|
|
1226
|
+
gap: 8px;
|
|
1227
|
+
min-inline-size: 44px;
|
|
1228
|
+
min-block-size: 44px;
|
|
1229
|
+
padding: 0 10px;
|
|
1230
|
+
border: 1px solid transparent;
|
|
1231
|
+
border-radius: 999px;
|
|
1232
|
+
background: transparent;
|
|
1233
|
+
color: inherit;
|
|
1234
|
+
backdrop-filter: none;
|
|
1235
|
+
-webkit-backdrop-filter: none;
|
|
1236
|
+
filter: none;
|
|
1237
|
+
font-weight: inherit;
|
|
1238
|
+
}
|
|
1239
|
+
.cr-bare::before,
|
|
1240
|
+
.cr-bare::after {
|
|
1241
|
+
content: none;
|
|
1242
|
+
display: none;
|
|
1243
|
+
}
|
|
1244
|
+
/* Resting state only: focus is a box-shadow recipe, and a blanket `none`
|
|
1245
|
+
would silently reduce it to a bare outline. */
|
|
1246
|
+
.cr-bare:not(:focus-visible) {
|
|
1247
|
+
box-shadow: none;
|
|
1248
|
+
}
|
|
1249
|
+
.cr-bare:hover:not(:disabled):not([aria-disabled=true]) {
|
|
1250
|
+
background: var(--cr-surface-alt);
|
|
1251
|
+
filter: none;
|
|
1252
|
+
}
|
|
1253
|
+
/* An on state without a reading pad has nothing to tint, so it takes the
|
|
1254
|
+
weight half of the selection rule and keeps the surface ink — the element
|
|
1255
|
+
rule above would otherwise leave on-primary ink on a transparent ground. */
|
|
1256
|
+
.cr-bare:is([aria-pressed=true],[aria-selected=true],[aria-checked=true]) {
|
|
1257
|
+
color: var(--cr-text);
|
|
1258
|
+
font-weight: 800;
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
/* A drag handle: a bare control with a grip and a lift while it is held.
|
|
1262
|
+
* Pointer capture, the keyboard alternative and drop validation are the
|
|
1263
|
+
* product's; the handle says only that it can be grabbed and when it has been. */
|
|
1264
|
+
:is(button, [role=button], .cr-drag-handle).cr-drag-handle {
|
|
1265
|
+
cursor: grab;
|
|
1266
|
+
touch-action: none;
|
|
1267
|
+
color: var(--cr-muted);
|
|
1268
|
+
padding: 12px 16px;
|
|
1269
|
+
background-image: radial-gradient(circle at center, currentColor 1.25px, transparent 1.75px);
|
|
1270
|
+
background-size: 6px 6px;
|
|
1271
|
+
background-repeat: repeat;
|
|
1272
|
+
background-position: center;
|
|
1273
|
+
background-clip: content-box;
|
|
1274
|
+
background-color: transparent;
|
|
1275
|
+
}
|
|
1276
|
+
.cr-drag-handle:hover:not([aria-disabled=true]) {
|
|
1277
|
+
color: var(--cr-text);
|
|
1278
|
+
}
|
|
1279
|
+
.cr-drag-handle:is([aria-grabbed=true],[data-dragging],[data-dragging=true]) {
|
|
1280
|
+
cursor: grabbing;
|
|
1281
|
+
color: var(--cr-text);
|
|
1282
|
+
background-color: var(--cr-surface);
|
|
1283
|
+
box-shadow: var(--cr-shadow-float);
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
/* A navigation entry.
|
|
1287
|
+
*
|
|
1288
|
+
* `docs/components.md` names the documentation site's side menu as the
|
|
1289
|
+
* reference implementation of selection, and until now that recipe lived only
|
|
1290
|
+
* in the site's own stylesheet — the same shape as D-9, a specification only
|
|
1291
|
+
* one renderer could read. Lifted from `crystal-preview` `.menu-item` as it
|
|
1292
|
+
* renders: an entry is furniture on the panel beneath it, so it has no material
|
|
1293
|
+
* of its own and no Resin coat. Thirteen floating capsules in a sidebar would
|
|
1294
|
+
* be exactly the legibility noise the hierarchy exists to prevent. The pill
|
|
1295
|
+
* geometry stays, because "go here" is an action.
|
|
1296
|
+
*
|
|
1297
|
+
* Selection is label weight, 650 at rest and 800 when current. Nothing is drawn
|
|
1298
|
+
* beside the label for selection. `.stacked` puts the icon above the label for a
|
|
1299
|
+
* rail.
|
|
1300
|
+
*
|
|
1301
|
+
* Current *location* is a different indicator, and the catalogue says so: "current
|
|
1302
|
+
* location is a dot; selection within a set is label weight" (D-22, ruled on
|
|
1303
|
+
* 28 September 2026). The dot is drawn on `aria-current` only — never for
|
|
1304
|
+
* `aria-selected` or `aria-pressed`, which are selection — and it sits inside the
|
|
1305
|
+
* entry's own inline-start padding, absolutely positioned, so the label does not
|
|
1306
|
+
* move by a pixel when the page changes. It is a flat mark in the primary colour:
|
|
1307
|
+
* no material, no elevation, no blur. An entry is furniture on the panel beneath
|
|
1308
|
+
* it, and a dot that floated or diffused would be one more plane in a column the
|
|
1309
|
+
* hierarchy keeps quiet.
|
|
1310
|
+
*/
|
|
1311
|
+
:is(button, a, [role=link], .cr-nav-item).cr-nav-item {
|
|
1312
|
+
position: relative;
|
|
1313
|
+
display: inline-flex;
|
|
1314
|
+
align-items: center;
|
|
1315
|
+
justify-content: flex-start;
|
|
1316
|
+
gap: 10px;
|
|
1317
|
+
min-height: 44px;
|
|
1318
|
+
padding: 10px 14px;
|
|
1319
|
+
border: 1px solid transparent;
|
|
1320
|
+
border-radius: 999px;
|
|
1321
|
+
background: transparent;
|
|
1322
|
+
color: var(--cr-muted);
|
|
1323
|
+
font-size: 14px;
|
|
1324
|
+
font-weight: 650;
|
|
1325
|
+
line-height: 1.35;
|
|
1326
|
+
text-align: start;
|
|
1327
|
+
text-decoration: none;
|
|
1328
|
+
backdrop-filter: none;
|
|
1329
|
+
-webkit-backdrop-filter: none;
|
|
1330
|
+
filter: none;
|
|
1331
|
+
}
|
|
1332
|
+
.cr-nav-item::before,
|
|
1333
|
+
.cr-nav-item::after {
|
|
1334
|
+
content: none;
|
|
1335
|
+
display: none;
|
|
1336
|
+
}
|
|
1337
|
+
.cr-nav-item:not(:focus-visible) {
|
|
1338
|
+
box-shadow: none;
|
|
1339
|
+
}
|
|
1340
|
+
.cr-nav-item:hover:not([aria-disabled=true]) {
|
|
1341
|
+
background: var(--cr-surface-alt);
|
|
1342
|
+
color: var(--cr-text);
|
|
1343
|
+
filter: none;
|
|
1344
|
+
}
|
|
1345
|
+
.cr-nav-item:is([aria-current]:not([aria-current=false]),[aria-selected=true],[aria-pressed=true]) {
|
|
1346
|
+
background: var(--cr-surface-alt);
|
|
1347
|
+
color: var(--cr-text);
|
|
1348
|
+
font-weight: 800;
|
|
1349
|
+
}
|
|
1350
|
+
/* The location dot. 6px is twice `component.indicator.lineWidth`, so a dot and a
|
|
1351
|
+
marking line read as one weight of mark. */
|
|
1352
|
+
.cr-nav-item:is([aria-current]:not([aria-current=false]))::before {
|
|
1353
|
+
content: '';
|
|
1354
|
+
display: block;
|
|
1355
|
+
position: absolute;
|
|
1356
|
+
inset-block-start: 50%;
|
|
1357
|
+
inset-inline-start: 4px;
|
|
1358
|
+
width: 6px;
|
|
1359
|
+
height: 6px;
|
|
1360
|
+
border-radius: 50%;
|
|
1361
|
+
background: var(--cr-primary);
|
|
1362
|
+
translate: 0 -50%;
|
|
1363
|
+
pointer-events: none;
|
|
1364
|
+
}
|
|
1365
|
+
.cr-nav-item.stacked {
|
|
1366
|
+
flex-direction: column;
|
|
1367
|
+
justify-content: center;
|
|
1368
|
+
gap: 4px;
|
|
1369
|
+
min-width: 64px;
|
|
1370
|
+
padding: 8px 10px;
|
|
1371
|
+
font-size: 12px;
|
|
1372
|
+
line-height: 1.25;
|
|
1373
|
+
}
|
|
1374
|
+
.cr-nav-item svg {
|
|
1375
|
+
width: 24px;
|
|
1376
|
+
height: 24px;
|
|
1377
|
+
}
|
|
1378
|
+
/* Stacked, the inline start is beside the icon, so the dot sits above it instead,
|
|
1379
|
+
centred in the entry's own block-start padding. */
|
|
1380
|
+
.cr-nav-item.stacked:is([aria-current]:not([aria-current=false]))::before {
|
|
1381
|
+
inset-block-start: 2px;
|
|
1382
|
+
inset-inline: 0;
|
|
1383
|
+
margin-inline: auto;
|
|
1384
|
+
translate: none;
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
/* A Resin panel: the Resin plane with the content radius instead of the pill,
|
|
1388
|
+
for a floating control plane that is a rectangle — a floating window, a wide
|
|
1389
|
+
media control bar. Fill, rim, blur and shadow are the plane's; only the
|
|
1390
|
+
geometry changes, and it matches the Frost panel's so nested radii line up. */
|
|
1391
|
+
:is(.cr-resin,.cr-glass).panel {
|
|
1392
|
+
border-radius: calc(var(--cr-radius) + 6px);
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
/* A switch is a checkbox with a track. Native `<input type=checkbox
|
|
1396
|
+
role=switch>`, styled by element like the checkbox and radio above: the
|
|
1397
|
+
track is the Resin box stretched to the published track size, the thumb is
|
|
1398
|
+
the opaque surface with the contact shadow, and the on state is the
|
|
1399
|
+
primary-soft pair. The thumb travels the difference between the two
|
|
1400
|
+
dimensions, so changing either token moves it correctly. */
|
|
1401
|
+
input[type=checkbox][role=switch] {
|
|
1402
|
+
width: var(--cr-switch-track-width, 44px);
|
|
1403
|
+
height: var(--cr-switch-track-height, 28px);
|
|
1404
|
+
border-radius: 999px;
|
|
1405
|
+
display: inline-block;
|
|
1406
|
+
position: relative;
|
|
1407
|
+
}
|
|
1408
|
+
input[type=checkbox][role=switch]::after {
|
|
1409
|
+
content: '';
|
|
1410
|
+
position: absolute;
|
|
1411
|
+
inset-block-start: 2px;
|
|
1412
|
+
inset-inline-start: 2px;
|
|
1413
|
+
width: calc(var(--cr-switch-track-height, 28px) - 6px);
|
|
1414
|
+
height: calc(var(--cr-switch-track-height, 28px) - 6px);
|
|
1415
|
+
border: 0;
|
|
1416
|
+
border-radius: 50%;
|
|
1417
|
+
background: var(--cr-surface);
|
|
1418
|
+
box-shadow: 0 2px 4px var(--cr-control-edge), 0 4px 8px var(--cr-shadow-contact);
|
|
1419
|
+
transition: translate var(--cr-state) var(--cr-ease-settle);
|
|
1420
|
+
}
|
|
1421
|
+
input[type=checkbox][role=switch]:checked {
|
|
1422
|
+
background: var(--cr-primary-soft);
|
|
1423
|
+
}
|
|
1424
|
+
input[type=checkbox][role=switch]:checked::after {
|
|
1425
|
+
content: '';
|
|
1426
|
+
width: calc(var(--cr-switch-track-height, 28px) - 6px);
|
|
1427
|
+
height: calc(var(--cr-switch-track-height, 28px) - 6px);
|
|
1428
|
+
background: var(--cr-primary);
|
|
1429
|
+
box-shadow: 0 2px 4px var(--cr-control-edge), 0 4px 8px var(--cr-shadow-contact);
|
|
1430
|
+
translate: calc(var(--cr-switch-track-width, 44px) - var(--cr-switch-track-height, 28px)) 0;
|
|
1431
|
+
}
|
|
1432
|
+
:root[dir=rtl] input[type=checkbox][role=switch]:checked::after {
|
|
1433
|
+
translate: calc(var(--cr-switch-track-height, 28px) - var(--cr-switch-track-width, 44px)) 0;
|
|
1434
|
+
}
|
|
1435
|
+
|
|
1436
|
+
/* The checkbox and radio read their geometry from the tokens that publish it,
|
|
1437
|
+
with the literal the token publishes as the fallback. Same rendering; one
|
|
1438
|
+
source. */
|
|
1439
|
+
input:is([type=checkbox],[type=radio]) {
|
|
1440
|
+
width: var(--cr-choice-box-size, 26px);
|
|
1441
|
+
height: var(--cr-choice-box-size, 26px);
|
|
1442
|
+
border-radius: var(--cr-choice-box-radius, 9px);
|
|
1443
|
+
}
|
|
1444
|
+
input[type=radio] {
|
|
1445
|
+
border-radius: 50%;
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
/* Disabled. The reset layer dims a native `button:disabled` and nothing else,
|
|
1449
|
+
so an action link, a control span and a navigation entry had no disabled
|
|
1450
|
+
state at all. The opacity is the published token; a disabled element must
|
|
1451
|
+
still not be the only explanation of unavailability, and the product still
|
|
1452
|
+
has to refuse the action — this only shows that it will. */
|
|
1453
|
+
button:disabled,
|
|
1454
|
+
:is(a.cr-button,.cr-control,.cr-nav-item,.cr-bare,.cr-drag-handle)[aria-disabled=true] {
|
|
1455
|
+
opacity: var(--cr-action-disabled-opacity, .55);
|
|
1456
|
+
cursor: not-allowed;
|
|
1457
|
+
filter: none;
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
/* Controls inside a Resin plane lose their own backdrop filter — the rule above
|
|
1461
|
+
lists the action controls, and these are controls too. */
|
|
1462
|
+
:is(.cr-resin,.cr-glass,.cr-resin-haze) :is(.cr-bare,.cr-nav-item,.cr-drag-handle) {
|
|
1463
|
+
backdrop-filter: none;
|
|
1464
|
+
-webkit-backdrop-filter: none;
|
|
1465
|
+
isolation: isolate;
|
|
1466
|
+
}
|
|
1467
|
+
|
|
1468
|
+
@media (prefers-reduced-transparency:reduce) {
|
|
1469
|
+
.cr-drag-handle:is([aria-grabbed=true],[data-dragging],[data-dragging=true]) {
|
|
1470
|
+
background-color: var(--cr-surface);
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
@media (forced-colors:active) {
|
|
1475
|
+
/* The current entry is a ring, never a fill: Chromium paints an opaque Canvas
|
|
1476
|
+
backplate behind text runs, above the element's own background, so a filled
|
|
1477
|
+
row loses its label entirely. */
|
|
1478
|
+
.cr-nav-item:is([aria-current]:not([aria-current=false]),[aria-selected=true],[aria-pressed=true]) {
|
|
1479
|
+
background: Canvas;
|
|
1480
|
+
color: CanvasText;
|
|
1481
|
+
outline: 2px solid Highlight;
|
|
1482
|
+
outline-offset: -3px;
|
|
1483
|
+
}
|
|
1484
|
+
.cr-nav-item:is([aria-current]:not([aria-current=false]))::before {
|
|
1485
|
+
background: Highlight;
|
|
1486
|
+
}
|
|
1487
|
+
.cr-nav-item,
|
|
1488
|
+
.cr-bare {
|
|
1489
|
+
border-color: transparent;
|
|
1490
|
+
box-shadow: none;
|
|
1491
|
+
}
|
|
1492
|
+
.cr-drag-handle:is([aria-grabbed=true],[data-dragging],[data-dragging=true]) {
|
|
1493
|
+
background-color: Canvas;
|
|
1494
|
+
outline: 2px solid Highlight;
|
|
1495
|
+
outline-offset: -3px;
|
|
1496
|
+
box-shadow: none;
|
|
1497
|
+
}
|
|
1498
|
+
input[type=checkbox][role=switch] {
|
|
1499
|
+
appearance: auto;
|
|
1500
|
+
width: auto;
|
|
1501
|
+
height: auto;
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
|
|
1507
|
+
/* ---------------------------------------------------------------------------
|
|
1508
|
+
Rulings of 29 September 2026 — proposals/2026-09-29-rulings.md.
|
|
1509
|
+
|
|
1510
|
+
Each recipe below closes an open issue that a consumer found by reaching for
|
|
1511
|
+
Crystal and finding it did not reach: a dock whose controls were not buttons,
|
|
1512
|
+
a group whose segments touch, a dialog whose body scrolls, an overlay inside a
|
|
1513
|
+
pane, a count badge. As in the block above, each is authored in
|
|
1514
|
+
`@layer crystal.component` and nowhere else, and each carries its own
|
|
1515
|
+
reduced-transparency and forced-colours branches.
|
|
1516
|
+
--------------------------------------------------------------------------- */
|
|
1517
|
+
@layer crystal.component {
|
|
1518
|
+
|
|
1519
|
+
/* The dock's controls, whatever the element (D-26).
|
|
1520
|
+
*
|
|
1521
|
+
* `.cr-dock button` reaches only a <button>. A tab is often `[role=tab]` on
|
|
1522
|
+
* another element, a segmented control is often radio inputs inside labels, and
|
|
1523
|
+
* a dock or bottom-bar destination is a link carrying `aria-current`. Each gets
|
|
1524
|
+
* the dock button's values here, selected by its own state — `aria-selected`, a
|
|
1525
|
+
* checked radio, `aria-current`.
|
|
1526
|
+
*
|
|
1527
|
+
* Every selector is inside `:where()`, so it adds no specificity to `.cr-dock`,
|
|
1528
|
+
* and the existing `.cr-dock button` rules (0,1,1) keep winning on a <button>
|
|
1529
|
+
* that is also `[role=tab]`. Nothing a consumer already sits against moves. */
|
|
1530
|
+
.cr-dock :where([role=tab], a, label:has(input[type=radio])) {
|
|
1531
|
+
display: inline-flex;
|
|
1532
|
+
align-items: center;
|
|
1533
|
+
justify-content: center;
|
|
1534
|
+
position: relative;
|
|
1535
|
+
min-height: 52px;
|
|
1536
|
+
padding: 13px 18px;
|
|
1537
|
+
border: 0;
|
|
1538
|
+
border-radius: 999px;
|
|
1539
|
+
background: transparent;
|
|
1540
|
+
color: var(--cr-text);
|
|
1541
|
+
font-weight: 700;
|
|
1542
|
+
white-space: nowrap;
|
|
1543
|
+
text-decoration: none;
|
|
1544
|
+
cursor: pointer;
|
|
1545
|
+
}
|
|
1546
|
+
.cr-dock :where([role=tab][aria-selected=true], a[aria-current]:not([aria-current=false]), label:has(input[type=radio]:checked)) {
|
|
1547
|
+
background: var(--cr-primary);
|
|
1548
|
+
color: var(--cr-on-primary);
|
|
1549
|
+
box-shadow: 0 3px 7px var(--cr-shadow-contact);
|
|
1550
|
+
/* Selection is weight first, as a selected dock button's is: typographic, so
|
|
1551
|
+
it never rests on the fill's colour alone. */
|
|
1552
|
+
font-weight: 800;
|
|
1553
|
+
}
|
|
1554
|
+
.cr-dock :where([role=tab]:not([aria-selected=true]), a:not([aria-current]:not([aria-current=false])), label:has(input[type=radio]:not(:checked))):hover {
|
|
1555
|
+
background: var(--cr-surface);
|
|
1556
|
+
}
|
|
1557
|
+
/* The radio is the control and the label is what is seen; the input stays in the
|
|
1558
|
+
accessibility tree and takes focus, and its ring is drawn on the label. The
|
|
1559
|
+
label is matched by a radio anywhere inside it — React Aria, for one, wraps
|
|
1560
|
+
its input in a visually hidden span — and only a radio that is the label's own
|
|
1561
|
+
child is hidden here, because a wrapped one is already hidden by its wrapper. */
|
|
1562
|
+
.cr-dock :where(label:has(> input[type=radio])) > input[type=radio] {
|
|
1563
|
+
position: absolute;
|
|
1564
|
+
inset: 0;
|
|
1565
|
+
width: 100%;
|
|
1566
|
+
height: 100%;
|
|
1567
|
+
margin: 0;
|
|
1568
|
+
opacity: 0;
|
|
1569
|
+
cursor: pointer;
|
|
1570
|
+
}
|
|
1571
|
+
.cr-dock :where(label:has(input[type=radio]:focus-visible)) {
|
|
1572
|
+
outline: 2px solid var(--cr-focus-core);
|
|
1573
|
+
outline-offset: 3px;
|
|
1574
|
+
box-shadow: inset 0 2px 1px var(--cr-rim), var(--cr-focus-ring);
|
|
1575
|
+
}
|
|
1576
|
+
@media (max-width:600px) {
|
|
1577
|
+
.cr-dock :where([role=tab], a, label:has(input[type=radio])) {
|
|
1578
|
+
padding: 10px 9px;
|
|
1579
|
+
font-size: 11px;
|
|
1580
|
+
min-height: 44px;
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
@media (forced-colors:active) {
|
|
1584
|
+
.cr-dock :where([role=tab][aria-selected=true], a[aria-current]:not([aria-current=false]), label:has(input[type=radio]:checked)) {
|
|
1585
|
+
background: Canvas;
|
|
1586
|
+
color: CanvasText;
|
|
1587
|
+
outline: 2px solid Highlight;
|
|
1588
|
+
outline-offset: -3px;
|
|
1589
|
+
box-shadow: none;
|
|
1590
|
+
}
|
|
1591
|
+
.cr-dock :where(label:has(input[type=radio]:focus-visible)) {
|
|
1592
|
+
outline-color: Highlight;
|
|
1593
|
+
box-shadow: none;
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1597
|
+
/* A group — the `group` surface (D-26).
|
|
1598
|
+
*
|
|
1599
|
+
* A button group and a split button are one Resin plane whose segments touch:
|
|
1600
|
+
* the silhouette is a single pill, the interior corners square off against
|
|
1601
|
+
* their neighbours, and a hairline in `--cr-edge` separates them. The plane is
|
|
1602
|
+
* the group's, so the children give up their own elevation and diffusion — a
|
|
1603
|
+
* Resin button on a Resin plane is the composition Crystal forbids — and keep
|
|
1604
|
+
* their fill, so a primary action's ink still has its fill beneath it.
|
|
1605
|
+
*
|
|
1606
|
+
* The child selector is `:is(button, a.cr-button, .cr-button, .cr-control)`
|
|
1607
|
+
* under the group, (0,2,1), because the Resin coat it subtracts from is keyed on
|
|
1608
|
+
* the element at (0,1,1) in this same layer. */
|
|
1609
|
+
.cr-group {
|
|
1610
|
+
display: inline-flex;
|
|
1611
|
+
align-items: stretch;
|
|
1612
|
+
position: relative;
|
|
1613
|
+
isolation: isolate;
|
|
1614
|
+
border: 1px solid var(--cr-rim);
|
|
1615
|
+
border-radius: 999px;
|
|
1616
|
+
background: var(--cr-resin-fill);
|
|
1617
|
+
box-shadow: var(--cr-shadow-float);
|
|
1618
|
+
backdrop-filter: blur(var(--cr-resin-blur)) saturate(var(--cr-resin-saturation));
|
|
1619
|
+
-webkit-backdrop-filter: blur(var(--cr-resin-blur)) saturate(var(--cr-resin-saturation));
|
|
1620
|
+
}
|
|
1621
|
+
.cr-group::before {
|
|
1622
|
+
content: '';
|
|
1623
|
+
position: absolute;
|
|
1624
|
+
inset: var(--cr-haze-inset);
|
|
1625
|
+
z-index: -1;
|
|
1626
|
+
pointer-events: none;
|
|
1627
|
+
border-radius: inherit;
|
|
1628
|
+
background: var(--cr-haze-fill);
|
|
1629
|
+
filter: blur(var(--cr-haze-feather));
|
|
1630
|
+
}
|
|
1631
|
+
.cr-group > :is(button, a.cr-button, .cr-button, .cr-control) {
|
|
1632
|
+
border-radius: 0;
|
|
1633
|
+
box-shadow: none;
|
|
1634
|
+
backdrop-filter: none;
|
|
1635
|
+
-webkit-backdrop-filter: none;
|
|
1636
|
+
isolation: isolate;
|
|
1637
|
+
}
|
|
1638
|
+
.cr-group > :is(button, a.cr-button, .cr-button, .cr-control):first-child {
|
|
1639
|
+
border-start-start-radius: 999px;
|
|
1640
|
+
border-end-start-radius: 999px;
|
|
1641
|
+
}
|
|
1642
|
+
.cr-group > :is(button, a.cr-button, .cr-button, .cr-control):last-child {
|
|
1643
|
+
border-start-end-radius: 999px;
|
|
1644
|
+
border-end-end-radius: 999px;
|
|
1645
|
+
}
|
|
1646
|
+
.cr-group > :is(button, a.cr-button, .cr-button, .cr-control) + :is(button, a.cr-button, .cr-button, .cr-control) {
|
|
1647
|
+
border-inline-start: 1px solid var(--cr-edge);
|
|
1648
|
+
}
|
|
1649
|
+
/* Stacked, the pill radius clamps to a stadium whose ends meet the first and
|
|
1650
|
+
last children's own. */
|
|
1651
|
+
.cr-group.vertical {
|
|
1652
|
+
flex-direction: column;
|
|
1653
|
+
}
|
|
1654
|
+
.cr-group.vertical > :is(button, a.cr-button, .cr-button, .cr-control) + :is(button, a.cr-button, .cr-button, .cr-control) {
|
|
1655
|
+
border-inline-start: 0;
|
|
1656
|
+
border-block-start: 1px solid var(--cr-edge);
|
|
1657
|
+
}
|
|
1658
|
+
.cr-group.vertical > :is(button, a.cr-button, .cr-button, .cr-control):first-child {
|
|
1659
|
+
border-radius: 0;
|
|
1660
|
+
border-start-start-radius: 999px;
|
|
1661
|
+
border-start-end-radius: 999px;
|
|
1662
|
+
}
|
|
1663
|
+
.cr-group.vertical > :is(button, a.cr-button, .cr-button, .cr-control):last-child {
|
|
1664
|
+
border-radius: 0;
|
|
1665
|
+
border-end-start-radius: 999px;
|
|
1666
|
+
border-end-end-radius: 999px;
|
|
1667
|
+
}
|
|
1668
|
+
[data-effects=opaque] .cr-group {
|
|
1669
|
+
background: var(--cr-surface);
|
|
1670
|
+
backdrop-filter: none;
|
|
1671
|
+
-webkit-backdrop-filter: none;
|
|
1672
|
+
}
|
|
1673
|
+
@media (prefers-reduced-transparency:reduce) {
|
|
1674
|
+
.cr-group {
|
|
1675
|
+
background: var(--cr-surface);
|
|
1676
|
+
backdrop-filter: none;
|
|
1677
|
+
-webkit-backdrop-filter: none;
|
|
1678
|
+
}
|
|
1679
|
+
.cr-group::before {
|
|
1680
|
+
filter: none;
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
@media (forced-colors:active) {
|
|
1684
|
+
.cr-group {
|
|
1685
|
+
background: ButtonFace;
|
|
1686
|
+
border: 1px solid ButtonText;
|
|
1687
|
+
box-shadow: none;
|
|
1688
|
+
backdrop-filter: none;
|
|
1689
|
+
}
|
|
1690
|
+
.cr-group::before {
|
|
1691
|
+
display: none;
|
|
1692
|
+
}
|
|
1693
|
+
.cr-group > :is(button, a.cr-button, .cr-button, .cr-control) + :is(button, a.cr-button, .cr-button, .cr-control) {
|
|
1694
|
+
border-inline-start-color: ButtonText;
|
|
1695
|
+
border-block-start-color: ButtonText;
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
|
|
1699
|
+
/* A dialog's body scrolls; the dialog does not (D-25).
|
|
1700
|
+
*
|
|
1701
|
+
* A surface that scrolls takes its title out of view in a tall dialog, and
|
|
1702
|
+
* cannot take the edge fade, because a mask fades an element's own fill and rim
|
|
1703
|
+
* along with its content. So the surface is a column that does not scroll, and
|
|
1704
|
+
* `.cr-dialog-body` scrolls inside it — with `.cr-scroll-frost` beside it for
|
|
1705
|
+
* the scroll contract, the Frost scrollbar and the edge fade, since a dialog is
|
|
1706
|
+
* a reading surface.
|
|
1707
|
+
*
|
|
1708
|
+
* Keyed on the body's presence, so a 2.2 dialog written without one goes on
|
|
1709
|
+
* scrolling as its surface, exactly as before. And only an open native dialog is
|
|
1710
|
+
* shown: an author `display` would otherwise beat the browser's
|
|
1711
|
+
* `dialog:not([open]) { display: none }`. */
|
|
1712
|
+
.cr-dialog:has(> .cr-dialog-body) {
|
|
1713
|
+
display: flex;
|
|
1714
|
+
flex-direction: column;
|
|
1715
|
+
overflow: visible;
|
|
1716
|
+
}
|
|
1717
|
+
dialog.cr-dialog:has(> .cr-dialog-body):not([open]) {
|
|
1718
|
+
display: none;
|
|
1719
|
+
}
|
|
1720
|
+
/* The header's gap, which body paragraphs' own margins used to supply. It
|
|
1721
|
+
matches the gap inside the header, as the footer's 24px matches its own. */
|
|
1722
|
+
.cr-dialog > header + .cr-dialog-body {
|
|
1723
|
+
margin-top: 20px;
|
|
1724
|
+
}
|
|
1725
|
+
.cr-dialog-body {
|
|
1726
|
+
flex: 1 1 auto;
|
|
1727
|
+
min-height: 0;
|
|
1728
|
+
overflow: auto;
|
|
1729
|
+
overflow-x: hidden;
|
|
1730
|
+
overscroll-behavior: contain;
|
|
1731
|
+
/* Both edges, as the dialog had: its content is centred, and a gutter on one
|
|
1732
|
+
side alone would sit it off-centre. */
|
|
1733
|
+
scrollbar-gutter: stable both-edges;
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1736
|
+
/* An overlay inside a pane (D-25).
|
|
1737
|
+
*
|
|
1738
|
+
* On the page a transient overlay is Frost. Inside a pane that is already
|
|
1739
|
+
* lifted — a Haze dialog, a Frost panel — it recesses into Haze rather than
|
|
1740
|
+
* floating a second pane of glass, and plain Haze has no edge: a menu drawn that
|
|
1741
|
+
* way over a Haze dialog cannot be told from the dialog. The recessed overlay is
|
|
1742
|
+
* Haze given the one boundary it needs: a flat fill, the `--cr-edge` rim and the
|
|
1743
|
+
* content shadow. There is no feather — a bordered box has no perimeter to
|
|
1744
|
+
* dissolve into its surroundings. */
|
|
1745
|
+
:is(.cr-haze,.cr-surface).overlay {
|
|
1746
|
+
border: 1px solid var(--cr-edge);
|
|
1747
|
+
border-radius: var(--cr-radius);
|
|
1748
|
+
background: var(--cr-haze-fill);
|
|
1749
|
+
box-shadow: var(--cr-shadow-content);
|
|
1750
|
+
}
|
|
1751
|
+
:is(.cr-haze,.cr-surface).overlay::before {
|
|
1752
|
+
display: none;
|
|
1753
|
+
}
|
|
1754
|
+
[data-effects=opaque] :is(.cr-haze,.cr-surface).overlay {
|
|
1755
|
+
background: var(--cr-surface);
|
|
1756
|
+
}
|
|
1757
|
+
@media (prefers-reduced-transparency:reduce) {
|
|
1758
|
+
:is(.cr-haze,.cr-surface).overlay {
|
|
1759
|
+
background: var(--cr-surface);
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
@media (forced-colors:active) {
|
|
1763
|
+
:is(.cr-haze,.cr-surface).overlay {
|
|
1764
|
+
background: Canvas;
|
|
1765
|
+
color: CanvasText;
|
|
1766
|
+
border: 1px solid CanvasText;
|
|
1767
|
+
box-shadow: none;
|
|
1768
|
+
}
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1771
|
+
/* A count (D-27).
|
|
1772
|
+
*
|
|
1773
|
+
* `.cr-resin-haze` is sized for a tag: its Haze pad is inset by
|
|
1774
|
+
* `--cr-haze-inset`, 8px, and its block padding is 17px. On a 20px count badge
|
|
1775
|
+
* the first leaves a pad a few pixels across with the digit mostly outside it,
|
|
1776
|
+
* and the second makes the badge 55px tall. A count fills to its own edge — it
|
|
1777
|
+
* is smaller than the perimeter the inset protects — has no block padding, and
|
|
1778
|
+
* is a circle that becomes a pill as the digits need it: a square minimum and a
|
|
1779
|
+
* pill radius, so the shape follows the content. 20px is
|
|
1780
|
+
* `component.indicator.size`; 4px is the smallest spacing step. */
|
|
1781
|
+
.cr-resin-haze.count {
|
|
1782
|
+
display: inline-flex;
|
|
1783
|
+
align-items: center;
|
|
1784
|
+
justify-content: center;
|
|
1785
|
+
box-sizing: border-box;
|
|
1786
|
+
min-width: 20px;
|
|
1787
|
+
min-height: 20px;
|
|
1788
|
+
padding: 0 4px;
|
|
1789
|
+
border-radius: 999px;
|
|
1790
|
+
font-size: var(--cr-text-caption-size, 13px);
|
|
1791
|
+
/* One line in a circle: the caption's reading leading plus the rim would
|
|
1792
|
+
make the circle 21px and no longer round. */
|
|
1793
|
+
line-height: 1;
|
|
1794
|
+
font-weight: 700;
|
|
1795
|
+
font-variant-numeric: tabular-nums;
|
|
1796
|
+
white-space: nowrap;
|
|
1797
|
+
}
|
|
1798
|
+
.cr-resin-haze.count::before {
|
|
1799
|
+
inset: 0;
|
|
1800
|
+
}
|
|
1801
|
+
|
|
1802
|
+
/* The indicator's field glyphs now reach any field shell (D-27); a shell that is
|
|
1803
|
+
a block — a label, a textarea, a row of chips — makes the same room for the
|
|
1804
|
+
glyph that the inline shell always has. `:where()` so this adds nothing to the
|
|
1805
|
+
shell's own specificity; the inline shell's padding rule is unchanged. */
|
|
1806
|
+
:where(.cr-field-shell:not(span)):has(> .cr-indicator) {
|
|
1807
|
+
padding-inline-end: 40px;
|
|
1808
|
+
}
|
|
1809
|
+
}
|