@filipgutica/design-system 1.0.3 → 1.0.4

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.
@@ -14,7 +14,10 @@
14
14
  * stand in for :hover, :active, and :focus-visible, and ARIA or native attributes
15
15
  * (aria-pressed, aria-checked, checked, disabled, aria-invalid, aria-busy) set the rest.
16
16
  * Pinned specimens sit inside an inert wrapper, so they take no focus and no input.
17
- * Drop the .is-* classes when you copy a component.
17
+ * Drop the .is-* classes, and the rules that name them, when you copy a component.
18
+ *
19
+ * Hover: a real :hover rule sits in @media (hover: hover), so a tap on a touch screen leaves
20
+ * no fill behind. The .is-hover rule beside it pins the same look for the specimen.
18
21
  */
19
22
 
20
23
  /* ---------- Shared recipes ---------- */
@@ -28,16 +31,21 @@
28
31
  .btn { --depth: var(--shadow-raise); display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: var(--control-md); padding: 0 var(--space-3); border: 1px solid transparent; border-radius: var(--radius-control); background: var(--color-accent); color: var(--color-accent-text); box-shadow: var(--depth); font: var(--weight-medium) var(--text-md) / 1.25 var(--font-ui); letter-spacing: -0.01em; cursor: pointer; transition: background-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out); }
29
32
  .btn[data-size="sm"] { min-height: var(--control-sm); padding: 0 0.625rem; font-size: var(--text-sm); }
30
33
  .btn[data-size="lg"] { min-height: var(--control-lg); padding: 0 var(--space-4); font-size: var(--text-lg); }
31
- .btn:is(:hover, .is-hover):not(:disabled) { background: var(--color-button-hover); }
34
+ .btn.is-hover:not(:disabled) { background: var(--color-button-hover); }
35
+ @media (hover: hover) { .btn:hover:not(:disabled) { background: var(--color-button-hover); } }
32
36
  .btn.secondary { background: var(--color-control-thumb); color: var(--color-text); }
33
- .btn.secondary:is(:hover, .is-hover):not(:disabled) { background: color-mix(in srgb, var(--color-text) 8%, var(--color-control-thumb)); }
37
+ .btn.secondary.is-hover:not(:disabled) { background: color-mix(in srgb, var(--color-text) 8%, var(--color-control-thumb)); }
38
+ @media (hover: hover) { .btn.secondary:hover:not(:disabled) { background: color-mix(in srgb, var(--color-text) 8%, var(--color-control-thumb)); } }
34
39
  .btn.ghost { --depth: none; background: transparent; color: var(--color-muted); }
35
- .btn.ghost:is(:hover, .is-hover):not(:disabled) { background: var(--color-row-hover); color: var(--color-text); }
40
+ .btn.ghost.is-hover:not(:disabled) { background: var(--color-row-hover); color: var(--color-text); }
41
+ @media (hover: hover) { .btn.ghost:hover:not(:disabled) { background: var(--color-row-hover); color: var(--color-text); } }
36
42
  /* Danger rises like the other filled variants; its text mixes the hue toward --color-text, as status badges do. */
37
43
  .btn.danger { background: var(--color-error-surface); color: light-dark(color-mix(in srgb, var(--color-error) 75%, var(--color-text)), color-mix(in srgb, var(--color-error) 85%, var(--color-text))); }
38
- .btn.danger:is(:hover, .is-hover):not(:disabled) { background: color-mix(in srgb, var(--color-error) 10%, var(--color-error-surface)); }
44
+ .btn.danger.is-hover:not(:disabled) { background: color-mix(in srgb, var(--color-error) 10%, var(--color-error-surface)); }
45
+ @media (hover: hover) { .btn.danger:hover:not(:disabled) { background: color-mix(in srgb, var(--color-error) 10%, var(--color-error-surface)); } }
39
46
  .btn.text { --depth: none; min-height: auto; padding: var(--space-1); background: transparent; color: var(--color-link); text-decoration: underline; text-underline-offset: 0.2em; }
40
- .btn.text:is(:hover, .is-hover):not(:disabled) { background: transparent; }
47
+ .btn.text.is-hover:not(:disabled) { background: transparent; }
48
+ @media (hover: hover) { .btn.text:hover:not(:disabled) { background: transparent; } }
41
49
  /* A press sinks the button 1px and changes its fill, so the click reads at a glance. */
42
50
  .btn:not(.secondary, .ghost, .danger, .text):is(:active, [aria-pressed="true"], .is-active):not(:disabled) { background: var(--color-button-hover); }
43
51
  .btn:is(.secondary, .ghost):is(:active, [aria-pressed="true"], .is-active):not(:disabled) { background: var(--color-well); }
@@ -59,7 +67,8 @@
59
67
  never a text glyph such as ×: a font draws a glyph's ink off its box centre.
60
68
  :where keeps the base below each component's own size and layout. */
61
69
  :where(.quiet-action) { display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: var(--radius-control); background: transparent; font: inherit; cursor: pointer; transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out); }
62
- .quiet-action:is(:hover, .is-hover):where(:not(:disabled)) { color: var(--color-text); background: color-mix(in srgb, currentColor 12%, transparent); }
70
+ .quiet-action.is-hover:where(:not(:disabled)) { color: var(--color-text); background: color-mix(in srgb, currentColor 12%, transparent); }
71
+ @media (hover: hover) { .quiet-action:hover:where(:not(:disabled)) { color: var(--color-text); background: color-mix(in srgb, currentColor 12%, transparent); } }
63
72
  .quiet-action:is(:active, .is-active):where(:not(:disabled)) { background: color-mix(in srgb, currentColor 18%, transparent); }
64
73
  .quiet-action:disabled { opacity: 0.58; cursor: not-allowed; }
65
74
 
@@ -89,7 +98,7 @@
89
98
  .select::picker(select) { min-width: anchor-size(width); max-height: min(20rem, 50dvh); overflow: auto; margin-block: var(--space-1); padding: var(--space-1); border: 1px solid transparent; border-radius: var(--radius-panel); background: var(--color-surface-raised); color: var(--color-text); box-shadow: var(--shadow-dialog); font: var(--text-md) / var(--leading) var(--font-ui); }
90
99
  .select option { min-height: var(--control-sm); padding: var(--space-2) var(--space-3); border-radius: calc(var(--radius-panel) - var(--space-1)); cursor: pointer; }
91
100
  .select option:checked { background: var(--color-row-selected); }
92
- .select option:hover:where(:not(:disabled)) { background: var(--color-row-hover); }
101
+ @media (hover: hover) { .select option:hover:where(:not(:disabled)) { background: var(--color-row-hover); } }
93
102
  /* Inset: the picker scrolls. */
94
103
  .select option:focus-visible { background: var(--color-row-hover); outline: var(--focus-width) solid var(--color-focus); outline-offset: calc(var(--focus-width) * -1); }
95
104
  .select option::checkmark { order: 1; margin-left: auto; color: var(--color-accent); }
@@ -103,7 +112,7 @@
103
112
  .search input::placeholder { color: var(--color-muted); }
104
113
  /* The native search clear button, quieted to a thin muted cross drawn with a mask. */
105
114
  .search input::-webkit-search-cancel-button { width: 0.75rem; height: 0.75rem; margin-inline-start: var(--space-2); background: var(--color-muted); cursor: pointer; -webkit-appearance: none; appearance: none; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 2.5l7 7m0-7l-7 7' stroke='black' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat; }
106
- .search input:where(:not(:disabled))::-webkit-search-cancel-button:hover { background: var(--color-text); }
115
+ @media (hover: hover) { .search input:where(:not(:disabled))::-webkit-search-cancel-button:hover { background: var(--color-text); } }
107
116
  /* A disabled field drops into the grey well (the same fill as rest in dark) and loses its shadow. background-color keeps the select chevron. */
108
117
  :is(.input, .select, .textarea):disabled { background-color: var(--color-well); box-shadow: none; opacity: 0.58; cursor: not-allowed; }
109
118
  /* A static drawing of the open picker; a native select cannot be pinned open. */
@@ -130,7 +139,8 @@
130
139
  /* Radio card: the native radio owns selection; the label owns the card surface. */
131
140
  .radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-3); width: min(100%, 420px); border: 0; margin: 0; padding: 0; }
132
141
  .radio-card { --depth: var(--shadow-raise); position: relative; display: grid; gap: var(--space-1); min-width: 0; padding: var(--space-3); padding-right: var(--space-8); border: 1px solid transparent; border-radius: var(--radius-panel); background: var(--color-surface-raised); box-shadow: var(--depth); cursor: pointer; transition: background-color var(--duration-fast) var(--ease-out); }
133
- .radio-card:is(:hover, .is-hover):not(:has(input:checked, input:disabled)) { background: color-mix(in srgb, var(--color-surface-muted) 45%, var(--color-surface-raised)); }
142
+ .radio-card.is-hover:not(:has(input:checked, input:disabled)) { background: color-mix(in srgb, var(--color-surface-muted) 45%, var(--color-surface-raised)); }
143
+ @media (hover: hover) { .radio-card:hover:not(:has(input:checked, input:disabled)) { background: color-mix(in srgb, var(--color-surface-muted) 45%, var(--color-surface-raised)); } }
134
144
  /* Depth and a check badge show the choice, without an accent ring. */
135
145
  .radio-card:has(input:checked) { --depth: var(--shadow-sink); background: var(--color-well); }
136
146
  .radio-card:has(input:disabled) { opacity: 0.58; cursor: not-allowed; }
@@ -158,7 +168,8 @@
158
168
  .toggle { --w: 2.75rem; --h: 1.375rem; --inset: 0.125rem; --depth: none; display: flex; align-items: center; gap: var(--space-3); min-height: var(--control-md); padding: var(--space-2) var(--space-3); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-field); background: var(--color-surface-raised); color: var(--color-text); font: var(--text-md) / var(--leading-tight) var(--font-ui); text-align: left; cursor: pointer; transition: background-color var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out); }
159
169
  .toggle[data-size="sm"] { --w: 2.2rem; --h: 1.1rem; --inset: 0.1rem; min-height: var(--control-sm); font-size: var(--text-sm); }
160
170
  .toggle[data-size="lg"] { --w: 3.3rem; --h: 1.65rem; --inset: 0.15rem; min-height: var(--control-lg); font-size: var(--text-lg); }
161
- .toggle:is(:hover, .is-hover):not(:disabled, [aria-pressed="true"]) { border-color: var(--color-border); }
171
+ .toggle.is-hover:not(:disabled, [aria-pressed="true"]) { border-color: var(--color-border); }
172
+ @media (hover: hover) { .toggle:hover:not(:disabled, [aria-pressed="true"]) { border-color: var(--color-border); } }
162
173
  /* The switch carries the on state; the card takes a faint 8% accent tint and an accent hairline. */
163
174
  .toggle[aria-pressed="true"] { border-color: color-mix(in srgb, var(--color-accent) 35%, transparent); background: color-mix(in srgb, var(--color-accent) 8%, var(--color-surface-raised)); }
164
175
  .toggle:disabled { opacity: 0.58; cursor: not-allowed; }
@@ -174,8 +185,10 @@
174
185
  .segmented[data-icon-only] button { width: var(--item); padding: 0; }
175
186
  /* The thumb is inset inside each full-size button, so it floats on the track and the hit area keeps its size. */
176
187
  .segmented button::before { content: ""; position: absolute; inset: 2px; z-index: -2; border-radius: var(--radius-control); pointer-events: none; }
177
- .segmented button:is(:hover, .is-hover):not(:disabled, [aria-pressed="true"]) { color: var(--color-text); }
178
- .segmented button:is(:hover, .is-hover):not(:disabled, [aria-pressed="true"])::before { background: color-mix(in srgb, var(--color-control-thumb) 45%, transparent); }
188
+ .segmented button.is-hover:not(:disabled, [aria-pressed="true"]) { color: var(--color-text); }
189
+ @media (hover: hover) { .segmented button:hover:not(:disabled, [aria-pressed="true"]) { color: var(--color-text); } }
190
+ .segmented button.is-hover:not(:disabled, [aria-pressed="true"])::before { background: color-mix(in srgb, var(--color-control-thumb) 45%, transparent); }
191
+ @media (hover: hover) { .segmented button:hover:not(:disabled, [aria-pressed="true"])::before { background: color-mix(in srgb, var(--color-control-thumb) 45%, transparent); } }
179
192
  /* The pressed label reads at 4.5:1 on its thumb, and an icon at 3:1 (--color-segmented-current-text). */
180
193
  .segmented button[aria-pressed="true"] { color: var(--color-segmented-current-text); }
181
194
  .segmented button[aria-pressed="true"]::before { z-index: -1; background: var(--color-control-thumb); box-shadow: var(--shadow-raise); }
@@ -235,7 +248,8 @@
235
248
  .tablist[data-clip="end"] { mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent); }
236
249
  .tablist[data-clip="start end"] { mask-image: linear-gradient(to right, transparent, #000 24px, #000 calc(100% - 24px), transparent); }
237
250
  .tab { position: relative; flex: none; min-height: var(--control-md); padding: var(--space-2) var(--space-3); border: 0; border-radius: var(--radius-inline); background: transparent; color: var(--color-muted); font: var(--weight-medium) var(--text-md) / var(--leading) var(--font-ui); white-space: nowrap; cursor: pointer; transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out); }
238
- .tab:is(:hover, .is-hover):where(:not(:disabled)) { background: var(--color-row-hover); color: var(--color-text); }
251
+ .tab.is-hover:where(:not(:disabled)) { background: var(--color-row-hover); color: var(--color-text); }
252
+ @media (hover: hover) { .tab:hover:where(:not(:disabled)) { background: var(--color-row-hover); color: var(--color-text); } }
239
253
  /* The selected tab takes the navigation row's lifted fill: one selected state for both. The fill is a
240
254
  ::before layer behind the label, so it can glide between tabs as the segmented thumb does. */
241
255
  .tab[aria-selected="true"] { background: transparent; color: var(--color-nav-current-text); }
@@ -324,7 +338,8 @@
324
338
  .navlist { display: grid; gap: 0.125rem; width: min(100%, 240px); }
325
339
  .navlist .group-label { padding: 0 var(--space-3) var(--space-1); color: var(--color-muted); font-size: var(--text-xs); font-weight: var(--weight-semibold); }
326
340
  .navlist a { position: relative; display: flex; align-items: center; min-height: var(--row); padding-inline: var(--space-3); border-radius: var(--radius-inline); color: var(--color-muted); font-size: var(--text-sm); text-decoration: none; transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out); }
327
- .navlist a:is(:hover, .is-hover) { background: var(--color-row-hover); color: var(--color-text); text-decoration: none; }
341
+ .navlist a.is-hover { background: var(--color-row-hover); color: var(--color-text); text-decoration: none; }
342
+ @media (hover: hover) { .navlist a:hover { background: var(--color-row-hover); color: var(--color-text); text-decoration: none; } }
328
343
  .navlist a[aria-current="page"] { background: var(--color-nav-current); box-shadow: var(--shadow-nav-current); color: var(--color-nav-current-text); font-weight: var(--weight-medium); }
329
344
  .navlist a[aria-current="location"] { color: var(--color-text); font-weight: var(--weight-medium); }
330
345
  .navlist a[aria-current="location"]::before { content: ""; position: absolute; inset-inline-start: var(--space-1); width: 3px; height: 14px; border-radius: var(--radius-pill); background: var(--color-accent); }
@@ -350,7 +365,8 @@
350
365
  details.rail-details[open] > .navlist { margin-top: var(--space-2); }
351
366
  /* A collapsible group's label is a disclosure button in the group-label type. Only rails over about 40 rows use it. */
352
367
  .group-toggle { display: flex; align-items: center; justify-content: space-between; min-height: var(--control-sm); padding: 0 var(--space-3); border: 1px solid transparent; border-radius: var(--radius-inline); background: transparent; color: var(--color-muted); font: var(--weight-semibold) var(--text-xs) var(--font-ui); cursor: pointer; transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out); }
353
- .group-toggle:is(:hover, .is-hover):where(:not(:disabled)) { background: var(--color-row-hover); color: var(--color-text); }
368
+ .group-toggle.is-hover:where(:not(:disabled)) { background: var(--color-row-hover); color: var(--color-text); }
369
+ @media (hover: hover) { .group-toggle:hover:where(:not(:disabled)) { background: var(--color-row-hover); color: var(--color-text); } }
354
370
  .group-toggle .icon { transition: transform var(--duration-fast) var(--ease-out); }
355
371
  .group-toggle[aria-expanded="false"] .icon { transform: rotate(-90deg); }
356
372
  /* Inset: the rail list scrolls. */
@@ -395,7 +411,8 @@
395
411
  .crumbs li { display: inline-flex; align-items: center; gap: var(--space-2); min-width: 0; }
396
412
  .crumbs li + li::before { content: "/" / ""; color: var(--color-muted); }
397
413
  .crumbs a { display: inline-flex; align-items: center; min-height: var(--control-sm); border-radius: var(--radius-inline); color: var(--color-muted); text-decoration: none; }
398
- .crumbs a:is(:hover, .is-hover) { color: var(--color-text); text-decoration: underline; text-underline-offset: 0.2em; }
414
+ .crumbs a.is-hover { color: var(--color-text); text-decoration: underline; text-underline-offset: 0.2em; }
415
+ @media (hover: hover) { .crumbs a:hover { color: var(--color-text); text-decoration: underline; text-underline-offset: 0.2em; } }
399
416
  .crumbs [aria-current="page"] { color: var(--color-text); font-weight: var(--weight-medium); overflow-wrap: anywhere; }
400
417
  /* Crumbs share the header row with the strip, so they centre on the cap height too. */
401
418
  @supports (text-box: trim-both cap alphabetic) {
@@ -410,7 +427,8 @@
410
427
  /* Pager: previous at the start, next always at the end. */
411
428
  .pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); width: 100%; padding-top: var(--space-6); border-top: 1px solid var(--color-border-subtle); }
412
429
  .pager a { display: grid; align-content: start; gap: 0.125rem; padding: var(--space-3) var(--space-4); border: 1px solid transparent; border-radius: var(--radius-field); color: var(--color-text); text-decoration: none; transition: background-color var(--duration-fast) var(--ease-out); }
413
- .pager a:is(:hover, .is-hover) { background: var(--color-row-hover); }
430
+ .pager a.is-hover { background: var(--color-row-hover); }
431
+ @media (hover: hover) { .pager a:hover { background: var(--color-row-hover); } }
414
432
  .pager a[rel="next"] { grid-column: 2; justify-items: end; text-align: end; }
415
433
  .pager-dir { display: inline-flex; align-items: center; gap: var(--space-1); color: var(--color-muted); font-size: var(--text-xs); }
416
434
  .pager-title { font-weight: var(--weight-medium); }
@@ -428,9 +446,11 @@
428
446
  /* Dividers are straight lines inset by the row padding, so they never follow a rounded corner.
429
447
  A filled row (hovered or selected) hides the divider above it and the one below it. */
430
448
  .rows [role="option"] + [role="option"]::before { content: ""; position: absolute; inset: 0 var(--space-3) auto; border-top: 1px solid var(--color-border-subtle); }
431
- .rows [role="option"]:is(:hover, .is-hover, [aria-selected="true"])::before,
432
- .rows [role="option"]:is(:hover, .is-hover, [aria-selected="true"]) + [role="option"]::before { display: none; }
433
- .rows [role="option"]:is(:hover, .is-hover) { background: var(--color-row-hover); }
449
+ .rows [role="option"]:is(.is-hover, [aria-selected="true"])::before,
450
+ .rows [role="option"]:is(.is-hover, [aria-selected="true"]) + [role="option"]::before { display: none; }
451
+ @media (hover: hover) { .rows [role="option"]:hover::before, .rows [role="option"]:hover + [role="option"]::before { display: none; } }
452
+ .rows [role="option"].is-hover { background: var(--color-row-hover); }
453
+ @media (hover: hover) { .rows [role="option"]:hover { background: var(--color-row-hover); } }
434
454
  /* The selected row takes the navigation row's current recipe; it comes after hover, so hover keeps the fill. */
435
455
  .rows [role="option"][aria-selected="true"] { background: var(--color-nav-current); box-shadow: var(--shadow-nav-current); color: var(--color-nav-current-text); font-weight: var(--weight-medium); }
436
456
  @media (forced-colors: active) { .rows [role="option"][aria-selected="true"] { border-inline-start: 2px solid Highlight; } }
@@ -443,7 +463,8 @@
443
463
  /* Copy is a quiet action; this sets its size and place. */
444
464
  .copy { display: inline-flex; align-items: center; justify-content: center; gap: 0.375rem; min-width: var(--control-lg); min-height: var(--control-lg); margin-left: auto; padding: var(--space-1) 0.375rem; color: inherit; }
445
465
  /* The code block has its own palette, so its Copy keeps the plate's text colour on hover. */
446
- .code .copy:is(:hover, .is-hover):where(:not(:disabled)) { color: inherit; }
466
+ .code .copy.is-hover:where(:not(:disabled)) { color: inherit; }
467
+ @media (hover: hover) { .code .copy:hover:where(:not(:disabled)) { color: inherit; } }
447
468
  /* Inset: the code block clips its content. */
448
469
  .code pre:is(:focus-visible, .is-focus) { outline: var(--focus-width) solid var(--color-focus); outline-offset: calc(var(--focus-width) * -1); }
449
470
  .code .copy.quiet-action:is(:focus-visible, .is-focus) { outline-offset: calc(var(--focus-width) * -1); }
@@ -592,7 +613,8 @@
592
613
  .tab[aria-selected="true"]::before { content: none; }
593
614
  .check input:checked { forced-color-adjust: none; border-color: Highlight; background: Highlight; }
594
615
  /* The masked search cross would lose its fill, so it opts out and takes the system text colour. */
595
- .search input::-webkit-search-cancel-button, .search input:where(:not(:disabled))::-webkit-search-cancel-button:hover { forced-color-adjust: none; background: CanvasText; }
616
+ .search input::-webkit-search-cancel-button { forced-color-adjust: none; background: CanvasText; }
617
+ @media (hover: hover) { .search input:where(:not(:disabled))::-webkit-search-cancel-button:hover { forced-color-adjust: none; background: CanvasText; } }
596
618
  .check input[type="checkbox"]:checked::before { border-color: HighlightText; }
597
619
  .check input[type="radio"]:checked { background: HighlightText; }
598
620
  .radio-card input:checked { forced-color-adjust: none; border-color: Highlight; background: Highlight; color: HighlightText; }
@@ -35,6 +35,7 @@ A control's **States** line names each interactive state it has. In `components.
35
35
  - **Sizes.** `sm`, `md`, and `lg` use `--control-sm`, `--control-md`, and `--control-lg` for height, with `--text-sm`, `--text-md`, and `--text-lg`. At tablet width (`max-width: 800px`) touch targets use `--control-lg`.
36
36
  - **Borders.** Every control keeps a 1px border, transparent unless its section says otherwise, so forced colors can draw an edge.
37
37
  - **Depth.** Each control takes its shadow from the [depth tiers](DESIGN.md#depth).
38
+ - **Hover.** Hover fills apply only where the pointer can hover. Put every `:hover` rule that sets a background, shadow, border colour, or text colour in `@media (hover: hover)`, because a touch screen keeps `:hover` on the last element tapped. The pressed tint stays outside the query: it shows only while a finger is down.
38
39
  - **Press.** Only a button has a pressed state; see [Button](#button). A [quiet action](#quiet-action) tints on press without sinking. Other controls have no `:active` treatment: they show their latched state as their section says.
39
40
  - **Focus.** One ring for every role but fields: `outline: var(--focus-width) solid var(--color-focus); outline-offset: var(--focus-offset)` (2px, 3px), with no halo or glow. `--color-focus` is the accent (`--color-accent`), which reaches 3:1 on `--color-bg`, `--color-surface`, and `--color-surface-raised` in both themes. It sits around primary, danger, and selected controls too. Do not give a role its own ring colour; where a variant must recolour the ring, set only `outline-color`. The ring is drawn over the control's own raise or sink shadow, which does not change. It goes on the visible part of a composite control: the switch track, the radio card, and the slider thumb. A dark plate (command plate, terminal capture) sets `--color-focus: var(--color-project-dark)`, the dark-theme accent, which reaches 3:1 on the plate in both page themes. In forced colors, a control that opts out of adjustment (a checked box, the switch track, a pressed segmented option) sets `outline-color: CanvasText`. Inside a scrolling or clipping parent, the ring is inset (`outline-offset: calc(var(--focus-width) * -1)`), and a comment names the reason. Only `:focus-visible` shows a ring; pointer hover never does.
40
41
  - **Field focus.** Fields (input, select, textarea, and the search wrapper) draw no ring. On `:focus-visible` (the search wrapper uses `:has(input:focus-visible)`) the 1px edge turns `--color-accent`, and `--shadow-field-focus` (`inset 0 0 0 2px`, the accent at 18% over transparent) draws a muted accent line inside it, with `outline: none`. The fill does not change in either theme. An invalid field keeps its `--color-error` edge while focused, and its inset line is `--shadow-field-focus-invalid` (`--color-error` at 18%). Forced colors drop the inset line, so a focused field there draws `outline: var(--focus-width) solid Highlight; outline-offset: -1px`.
@@ -15,7 +15,8 @@
15
15
  .sidebar { position: sticky; top: var(--space-6); align-self: start; display: grid; gap: var(--space-1); padding-block: var(--space-6); }
16
16
  /* Navigation rows: components.html#navigation-list, unchanged. Only the rail's placement and spacing are local. */
17
17
  .navlist a { position: relative; display: flex; align-items: center; min-height: var(--row); padding-inline: var(--space-3); border-radius: var(--radius-inline); color: var(--color-muted); font-size: var(--text-sm); text-decoration: none; transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out); }
18
- .navlist a:is(:hover, .is-hover) { background: var(--color-row-hover); color: var(--color-text); text-decoration: none; }
18
+ .navlist a.is-hover { background: var(--color-row-hover); color: var(--color-text); text-decoration: none; }
19
+ @media (hover: hover) { .navlist a:hover { background: var(--color-row-hover); color: var(--color-text); text-decoration: none; } }
19
20
  .navlist a[aria-current="page"] { background: var(--color-nav-current); box-shadow: var(--shadow-nav-current); color: var(--color-nav-current-text); font-weight: var(--weight-medium); }
20
21
  .navlist a[aria-current="location"] { color: var(--color-text); font-weight: var(--weight-medium); }
21
22
  .navlist a[aria-current="location"]::before { content: ""; position: absolute; inset-inline-start: var(--space-1); width: 3px; height: 14px; border-radius: var(--radius-pill); background: var(--color-accent); }
@@ -43,7 +44,8 @@ p { max-width: var(--measure); color: var(--color-muted); font-size: var(--text-
43
44
  .command pre { min-width: 0; flex: 1; margin: 0; overflow-x: auto; font-size: var(--text-sm); }
44
45
  /* Copy is a quiet action: components.html#quiet-action, unchanged. The page adds its size and colour only. */
45
46
  :where(.quiet-action) { display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: var(--radius-control); background: transparent; font: inherit; cursor: pointer; transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out); }
46
- .quiet-action:is(:hover, .is-hover):where(:not(:disabled)) { color: var(--color-text); background: color-mix(in srgb, currentColor 12%, transparent); }
47
+ .quiet-action.is-hover:where(:not(:disabled)) { color: var(--color-text); background: color-mix(in srgb, currentColor 12%, transparent); }
48
+ @media (hover: hover) { .quiet-action:hover:where(:not(:disabled)) { color: var(--color-text); background: color-mix(in srgb, currentColor 12%, transparent); } }
47
49
  .quiet-action:is(:active, .is-active):where(:not(:disabled)) { background: color-mix(in srgb, currentColor 18%, transparent); }
48
50
  .quiet-action:disabled { opacity: 0.58; cursor: not-allowed; }
49
51
  .command button { flex: none; min-width: var(--control-lg); min-height: var(--control-lg); color: var(--color-terminal-caption-text); }
@@ -20,7 +20,8 @@ h1 { max-width: 18ch; font-size: var(--text-display); letter-spacing: var(--trac
20
20
  /* The one primary action: components.html#button, unchanged. The page adds layout only. */
21
21
  .btn { --depth: var(--shadow-raise); display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: var(--control-md); padding: 0 var(--space-3); border: 1px solid transparent; border-radius: var(--radius-control); background: var(--color-accent); color: var(--color-accent-text); box-shadow: var(--depth); font: var(--weight-medium) var(--text-md) / 1.25 var(--font-ui); letter-spacing: -0.01em; cursor: pointer; transition: background-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out); }
22
22
  .btn[data-size="lg"] { min-height: var(--control-lg); padding: 0 var(--space-4); font-size: var(--text-lg); }
23
- .btn:is(:hover, .is-hover):not(:disabled) { background: var(--color-button-hover); }
23
+ .btn.is-hover:not(:disabled) { background: var(--color-button-hover); }
24
+ @media (hover: hover) { .btn:hover:not(:disabled) { background: var(--color-button-hover); } }
24
25
  .btn:not(.secondary, .ghost, .danger, .text):is(:active, [aria-pressed="true"], .is-active):not(:disabled) { background: var(--color-button-hover); }
25
26
  .btn:not(.text):is(:active, [aria-pressed="true"], .is-active):not(:disabled) { --depth: var(--shadow-sink); transform: translateY(1px); }
26
27
  a.btn { text-decoration: none; }
@@ -20,7 +20,8 @@
20
20
  .navlist { display: grid; gap: 0.125rem; width: min(100%, 240px); }
21
21
  .navlist .group-label { padding: 0 var(--space-3) var(--space-1); color: var(--color-muted); font-size: var(--text-xs); font-weight: var(--weight-semibold); }
22
22
  .navlist a { position: relative; display: flex; align-items: center; min-height: var(--row); padding-inline: var(--space-3); border-radius: var(--radius-inline); color: var(--color-muted); font-size: var(--text-sm); text-decoration: none; transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out); }
23
- .navlist a:is(:hover, .is-hover) { background: var(--color-row-hover); color: var(--color-text); text-decoration: none; }
23
+ .navlist a.is-hover { background: var(--color-row-hover); color: var(--color-text); text-decoration: none; }
24
+ @media (hover: hover) { .navlist a:hover { background: var(--color-row-hover); color: var(--color-text); text-decoration: none; } }
24
25
  /* The Foundations specimens share the current-page and location rules, forced colors included. */
25
26
  .navlist a[aria-current="page"], .nav-current-sample { background: var(--color-nav-current); box-shadow: var(--shadow-nav-current); color: var(--color-nav-current-text); font-weight: var(--weight-medium); }
26
27
  .navlist a[aria-current="location"], .pip-sample { color: var(--color-text); font-weight: var(--weight-medium); }
@@ -66,17 +67,21 @@
66
67
  /* Buttons and quiet actions: components.html#button and #quiet-action, unchanged. The page adds layout only. */
67
68
  .btn { --depth: var(--shadow-raise); display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: var(--control-md); padding: 0 var(--space-3); border: 1px solid transparent; border-radius: var(--radius-control); background: var(--color-accent); color: var(--color-accent-text); box-shadow: var(--depth); font: var(--weight-medium) var(--text-md) / 1.25 var(--font-ui); letter-spacing: -0.01em; cursor: pointer; transition: background-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out); }
68
69
  .btn[data-size="sm"] { min-height: var(--control-sm); padding: 0 0.625rem; font-size: var(--text-sm); }
69
- .btn:is(:hover, .is-hover):not(:disabled) { background: var(--color-button-hover); }
70
+ .btn.is-hover:not(:disabled) { background: var(--color-button-hover); }
71
+ @media (hover: hover) { .btn:hover:not(:disabled) { background: var(--color-button-hover); } }
70
72
  .btn.secondary { background: var(--color-control-thumb); color: var(--color-text); }
71
- .btn.secondary:is(:hover, .is-hover):not(:disabled) { background: color-mix(in srgb, var(--color-text) 8%, var(--color-control-thumb)); }
73
+ .btn.secondary.is-hover:not(:disabled) { background: color-mix(in srgb, var(--color-text) 8%, var(--color-control-thumb)); }
74
+ @media (hover: hover) { .btn.secondary:hover:not(:disabled) { background: color-mix(in srgb, var(--color-text) 8%, var(--color-control-thumb)); } }
72
75
  .btn.ghost { --depth: none; background: transparent; color: var(--color-muted); }
73
- .btn.ghost:is(:hover, .is-hover):not(:disabled) { background: var(--color-row-hover); color: var(--color-text); }
76
+ .btn.ghost.is-hover:not(:disabled) { background: var(--color-row-hover); color: var(--color-text); }
77
+ @media (hover: hover) { .btn.ghost:hover:not(:disabled) { background: var(--color-row-hover); color: var(--color-text); } }
74
78
  .btn:not(.secondary, .ghost, .danger, .text):is(:active, [aria-pressed="true"], .is-active):not(:disabled) { background: var(--color-button-hover); }
75
79
  .btn:is(.secondary, .ghost):is(:active, [aria-pressed="true"], .is-active):not(:disabled) { background: var(--color-well); }
76
80
  .btn:not(.text):is(:active, [aria-pressed="true"], .is-active):not(:disabled) { --depth: var(--shadow-sink); transform: translateY(1px); }
77
81
  .btn:disabled { --depth: none; opacity: 0.58; cursor: not-allowed; }
78
82
  :where(.quiet-action) { display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: var(--radius-control); background: transparent; font: inherit; cursor: pointer; transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out); }
79
- .quiet-action:is(:hover, .is-hover):where(:not(:disabled)) { color: var(--color-text); background: color-mix(in srgb, currentColor 12%, transparent); }
83
+ .quiet-action.is-hover:where(:not(:disabled)) { color: var(--color-text); background: color-mix(in srgb, currentColor 12%, transparent); }
84
+ @media (hover: hover) { .quiet-action:hover:where(:not(:disabled)) { color: var(--color-text); background: color-mix(in srgb, currentColor 12%, transparent); } }
80
85
  .quiet-action:is(:active, .is-active):where(:not(:disabled)) { background: color-mix(in srgb, currentColor 18%, transparent); }
81
86
  .quiet-action:disabled { opacity: 0.58; cursor: not-allowed; }
82
87
  /* .is-focus pins the focus state in the Focus and motion specimens. */
@@ -94,17 +99,18 @@
94
99
  .search input::placeholder { color: var(--color-muted); }
95
100
  /* The native clear button, quieted to a thin muted cross drawn with a mask. */
96
101
  .search input::-webkit-search-cancel-button { width: 0.75rem; height: 0.75rem; margin-inline-start: var(--space-2); background: var(--color-muted); cursor: pointer; -webkit-appearance: none; appearance: none; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 2.5l7 7m0-7l-7 7' stroke='black' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat; }
97
- .search input:where(:not(:disabled))::-webkit-search-cancel-button:hover { background: var(--color-text); }
102
+ @media (hover: hover) { .search input:where(:not(:disabled))::-webkit-search-cancel-button:hover { background: var(--color-text); } }
98
103
  /* Forced colors would drop the masked fill, so the cross opts out and takes the system text colour. */
99
104
  /* Forced colors drop the inset line, so the focused field draws the system ring just inside its edge. */
100
105
  @media (forced-colors: active) { .search:is(:has(input:focus-visible), .is-focus) { outline: var(--focus-width) solid Highlight; outline-offset: -1px; } }
101
- @media (forced-colors: active) { .search input::-webkit-search-cancel-button, .search input:where(:not(:disabled))::-webkit-search-cancel-button:hover { forced-color-adjust: none; background: CanvasText; } }
106
+ @media (forced-colors: active) { .search input::-webkit-search-cancel-button { forced-color-adjust: none; background: CanvasText; } @media (hover: hover) { .search input:where(:not(:disabled))::-webkit-search-cancel-button:hover { forced-color-adjust: none; background: CanvasText; } } }
102
107
  kbd { font-size: var(--text-xs); color: var(--color-muted); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-inline); padding: 0 var(--space-1); line-height: 1.125rem; background: var(--color-surface-raised); }
103
108
 
104
109
  /* Tabs, for the Foundations specimens: components.html#tabs, unchanged. */
105
110
  .tablist { --glide-lead: 260ms; --glide-trail: 300ms; display: flex; width: max-content; max-width: 100%; overflow-x: auto; padding: var(--space-1); isolation: isolate; }
106
111
  .tab { position: relative; flex: none; min-height: var(--control-md); padding: var(--space-2) var(--space-3); border: 0; border-radius: var(--radius-inline); background: transparent; color: var(--color-muted); font: var(--weight-medium) var(--text-md) / var(--leading) var(--font-ui); white-space: nowrap; cursor: pointer; transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out); }
107
- .tab:is(:hover, .is-hover):where(:not(:disabled)) { background: var(--color-row-hover); color: var(--color-text); }
112
+ .tab.is-hover:where(:not(:disabled)) { background: var(--color-row-hover); color: var(--color-text); }
113
+ @media (hover: hover) { .tab:hover:where(:not(:disabled)) { background: var(--color-row-hover); color: var(--color-text); } }
108
114
  /* The selected tab takes the navigation row's lifted fill: one selected state for both. The fill is a
109
115
  ::before layer behind the label; in the catalogue it glides between tabs. */
110
116
  .tab[aria-selected="true"] { background: transparent; color: var(--color-nav-current-text); }
@@ -123,8 +129,10 @@
123
129
  .segmented[data-icon-only] button { width: var(--item); padding: 0; }
124
130
  /* The thumb is inset inside each full-size button, so it floats on the track and the hit area keeps its size. */
125
131
  .segmented button::before { content: ""; position: absolute; inset: 2px; z-index: -2; border-radius: var(--radius-control); pointer-events: none; }
126
- .segmented button:is(:hover, .is-hover):not(:disabled, [aria-pressed="true"]) { color: var(--color-text); }
127
- .segmented button:is(:hover, .is-hover):not(:disabled, [aria-pressed="true"])::before { background: color-mix(in srgb, var(--color-control-thumb) 45%, transparent); }
132
+ .segmented button.is-hover:not(:disabled, [aria-pressed="true"]) { color: var(--color-text); }
133
+ @media (hover: hover) { .segmented button:hover:not(:disabled, [aria-pressed="true"]) { color: var(--color-text); } }
134
+ .segmented button.is-hover:not(:disabled, [aria-pressed="true"])::before { background: color-mix(in srgb, var(--color-control-thumb) 45%, transparent); }
135
+ @media (hover: hover) { .segmented button:hover:not(:disabled, [aria-pressed="true"])::before { background: color-mix(in srgb, var(--color-control-thumb) 45%, transparent); } }
128
136
  /* The pressed label reads at 4.5:1 on its thumb, and an icon at 3:1 (--color-segmented-current-text). */
129
137
  .segmented button[aria-pressed="true"] { color: var(--color-segmented-current-text); }
130
138
  .segmented button[aria-pressed="true"]::before { z-index: -1; background: var(--color-control-thumb); box-shadow: var(--shadow-raise); }
@@ -171,9 +179,13 @@
171
179
  /* List selection: components.html#navigation-list. Dividers are straight lines inset by the row
172
180
  padding; a filled row (hovered or selected) hides the divider above it and the one below it. */
173
181
  .row + .row::before { content: ""; position: absolute; inset: 0 var(--space-3) auto; border-top: 1px solid var(--color-border-subtle); }
174
- .row:is(:hover:where(:not(:disabled)), [aria-selected="true"])::before,
175
- .row:is(:hover:where(:not(:disabled)), [aria-selected="true"]) + .row::before { display: none; }
176
- .row:hover:where(:not(:disabled)) { background: var(--color-row-hover); }
182
+ .row[aria-selected="true"]::before,
183
+ .row[aria-selected="true"] + .row::before { display: none; }
184
+ @media (hover: hover) {
185
+ .row:hover:where(:not(:disabled))::before,
186
+ .row:hover:where(:not(:disabled)) + .row::before { display: none; }
187
+ .row:hover:where(:not(:disabled)) { background: var(--color-row-hover); }
188
+ }
177
189
  /* The selected row takes the navigation row's current recipe; it comes after hover, so hover keeps the fill. */
178
190
  .row[aria-selected="true"] { background: var(--color-nav-current); box-shadow: var(--shadow-nav-current); font-weight: var(--weight-medium); }
179
191
  .row[aria-selected="true"] .title { color: var(--color-nav-current-text); }
@@ -262,7 +274,8 @@
262
274
  /* Copy is a quiet action; this sets its size and place. */
263
275
  .copy { display: inline-flex; align-items: center; justify-content: center; gap: 0.375rem; min-width: var(--control-lg); min-height: var(--control-lg); margin-left: auto; padding: var(--space-1) 0.375rem; color: inherit; }
264
276
  /* The code block has its own palette, so its Copy keeps the plate's text colour on hover. */
265
- .code .copy:is(:hover, .is-hover):where(:not(:disabled)) { color: inherit; }
277
+ .code .copy.is-hover:where(:not(:disabled)) { color: inherit; }
278
+ @media (hover: hover) { .code .copy:hover:where(:not(:disabled)) { color: inherit; } }
266
279
  /* Inset: the code block clips its content. */
267
280
  .code pre:is(:focus-visible, .is-focus) { outline: var(--focus-width) solid var(--color-focus); outline-offset: calc(var(--focus-width) * -1); }
268
281
  .code .copy.quiet-action:is(:focus-visible, .is-focus) { outline-offset: calc(var(--focus-width) * -1); }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@filipgutica/design-system",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Filip's design language, tokens, and component catalogue for any framework",
5
5
  "type": "module",
6
6
  "sideEffects": [