hydrateless 0.8.0 → 0.10.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.
Files changed (45) hide show
  1. package/README.md +120 -0
  2. package/dist/accordion.css +20 -8
  3. package/dist/alert.css +69 -8
  4. package/dist/avatar.css +8 -14
  5. package/dist/badge.css +9 -1
  6. package/dist/breadcrumb.css +7 -3
  7. package/dist/button.css +48 -28
  8. package/dist/card.css +8 -5
  9. package/dist/checkbox.css +36 -22
  10. package/dist/combobox.css +43 -15
  11. package/dist/command-palette.css +123 -0
  12. package/dist/components.css +1351 -571
  13. package/dist/disclosure.css +27 -29
  14. package/dist/drawer.css +76 -48
  15. package/dist/dropdown.css +138 -22
  16. package/dist/field.css +5 -4
  17. package/dist/hydrateless.css +1581 -1330
  18. package/dist/hydrateless.min.css +1 -1
  19. package/dist/input.css +20 -17
  20. package/dist/kbd.css +4 -3
  21. package/dist/menu.css +106 -45
  22. package/dist/modal.css +63 -14
  23. package/dist/pagination.css +20 -11
  24. package/dist/popover.css +34 -12
  25. package/dist/progress.css +23 -12
  26. package/dist/{radio.css → radio-group.css} +23 -16
  27. package/dist/reset.css +7 -2
  28. package/dist/{segmented.css → segmented-control.css} +24 -12
  29. package/dist/select.css +28 -22
  30. package/dist/separator.css +9 -9
  31. package/dist/skeleton.css +18 -10
  32. package/dist/skip-link.css +13 -8
  33. package/dist/slider.css +66 -25
  34. package/dist/spinner.css +17 -14
  35. package/dist/switch.css +55 -18
  36. package/dist/table.css +100 -15
  37. package/dist/tabs.css +35 -11
  38. package/dist/textarea.css +26 -12
  39. package/dist/theme.css +5 -24
  40. package/dist/toast.css +40 -36
  41. package/dist/toc.css +17 -4
  42. package/dist/tokens.css +208 -183
  43. package/dist/tooltip.css +74 -17
  44. package/package.json +4 -4
  45. package/dist/command.css +0 -102
package/dist/skeleton.css CHANGED
@@ -1,13 +1,14 @@
1
1
  /**
2
- * Skeleton: `<span class="hl-skeleton" data-hl-variant="…" aria-hidden="true">`
3
- * placeholder shown while content loads.
4
- * data-hl-variant: rect (default) | text | circle
2
+ * Skeleton: `<span class="hl-skeleton" data-hl-shape="..." aria-hidden="true">`
3
+ * placeholder shown while content loads. Pure CSS; there is no enhancer.
4
+ * Size it with inline `inline-size`/`block-size`.
5
+ * data-hl-shape: rect (default) | text | circle
5
6
  */
6
7
  @layer components {
7
8
  .hl-skeleton {
8
9
  display: block;
9
- width: 100%;
10
- height: 1rem;
10
+ inline-size: 100%;
11
+ block-size: 1rem;
11
12
  border-radius: var(--hl-radius-md);
12
13
  background: linear-gradient(
13
14
  90deg,
@@ -19,14 +20,14 @@
19
20
  animation: hl-skeleton-shimmer 1.4s var(--hl-ease-standard) infinite;
20
21
  }
21
22
 
22
- .hl-skeleton[data-hl-variant='text'] {
23
- height: 0.7em;
23
+ .hl-skeleton[data-hl-shape='text'] {
24
+ block-size: 0.7em;
24
25
  border-radius: var(--hl-radius-sm);
25
26
  }
26
27
 
27
- .hl-skeleton[data-hl-variant='circle'] {
28
- width: 2.5rem;
29
- height: 2.5rem;
28
+ .hl-skeleton[data-hl-shape='circle'] {
29
+ inline-size: 2.5rem;
30
+ block-size: 2.5rem;
30
31
  border-radius: var(--hl-radius-full);
31
32
  }
32
33
 
@@ -46,4 +47,11 @@
46
47
  background: var(--hl-surface-3);
47
48
  }
48
49
  }
50
+
51
+ /* Fills flatten to Canvas in forced colors; outline the placeholder instead. */
52
+ @media (forced-colors: active) {
53
+ .hl-skeleton {
54
+ border: var(--hl-border-width) solid GrayText;
55
+ }
56
+ }
49
57
  }
@@ -1,18 +1,23 @@
1
+ /**
2
+ * Skip link: `<a class="hl-skip-link" href="#main">Skip to content</a>` placed
3
+ * first in the body. Visually hidden until it receives keyboard focus, then
4
+ * pinned to the start corner of the viewport. Pure CSS; there is no enhancer.
5
+ */
1
6
  @layer components {
2
7
  .hl-skip-link {
3
8
  position: absolute;
4
- left: -9999px;
5
- top: auto;
6
- width: 1px;
7
- height: 1px;
9
+ inset-inline-start: -9999px;
10
+ inset-block-start: auto;
11
+ inline-size: 1px;
12
+ block-size: 1px;
8
13
  overflow: hidden;
9
14
  }
10
15
 
11
16
  .hl-skip-link:focus-visible {
12
- left: 0;
13
- top: 0;
14
- width: auto;
15
- height: auto;
17
+ inset-inline-start: 0;
18
+ inset-block-start: 0;
19
+ inline-size: auto;
20
+ block-size: auto;
16
21
  padding: var(--hl-space-2) var(--hl-space-3);
17
22
  background: var(--hl-fg);
18
23
  color: var(--hl-surface);
package/dist/slider.css CHANGED
@@ -1,60 +1,93 @@
1
1
  /**
2
2
  * Slider: native `<input type="range" class="hl-slider">`. Restyled track and
3
- * thumb across WebKit/Blink and Firefox while keeping native keyboard support.
3
+ * thumb across WebKit/Blink and Firefox while keeping native keyboard support
4
+ * and RTL direction. Firefox paints the filled part of the track natively
5
+ * (`::-moz-range-progress`); other engines get it from the
6
+ * `--hl-slider-progress` custom property the enhancer keeps in sync when the
7
+ * input sits inside a `[data-hl-slider]` wrapper (with an optional `<output>`).
8
+ * data-hl-slider: wrapper around the input (and output) for the enhancer
4
9
  */
5
10
  @layer components {
6
11
  .hl-slider {
7
12
  --_track: 0.375rem;
8
13
  --_thumb: 1.15rem;
9
14
 
10
- -webkit-appearance: none;
11
-
12
- -moz-appearance: none;
13
-
14
- appearance: none;
15
- width: 100%;
16
- height: 1.15rem;
17
- height: var(--_thumb);
15
+ appearance: none;
16
+ inline-size: 100%;
17
+ block-size: var(--_thumb);
18
18
  margin: 0;
19
19
  background: transparent;
20
20
  cursor: pointer;
21
21
  }
22
22
 
23
23
  .hl-slider::-webkit-slider-runnable-track {
24
- height: var(--_track);
24
+ block-size: var(--_track);
25
25
  border-radius: var(--hl-radius-full);
26
26
  background: var(--hl-surface-3);
27
27
  }
28
28
 
29
+ /* Fill up to the thumb once the enhancer publishes the progress. */
30
+ .hl-slider[style*='--hl-slider-progress']::-webkit-slider-runnable-track {
31
+ background: linear-gradient(
32
+ to right,
33
+ var(--hl-primary) var(--hl-slider-progress),
34
+ var(--hl-surface-3) var(--hl-slider-progress)
35
+ );
36
+ }
37
+
38
+ :is(
39
+ [dir='rtl'] .hl-slider,
40
+ .hl-slider:dir(rtl)
41
+ )[style*='--hl-slider-progress']::-webkit-slider-runnable-track {
42
+ background: linear-gradient(
43
+ to left,
44
+ var(--hl-primary) var(--hl-slider-progress),
45
+ var(--hl-surface-3) var(--hl-slider-progress)
46
+ );
47
+ }
48
+
49
+ [data-hl-slider] {
50
+ display: flex;
51
+ align-items: center;
52
+ gap: var(--hl-space-3);
53
+ }
54
+
55
+ [data-hl-slider] > output {
56
+ min-inline-size: 3ch;
57
+ font-size: var(--hl-text-sm);
58
+ font-variant-numeric: tabular-nums;
59
+ color: var(--hl-fg-muted);
60
+ text-align: end;
61
+ }
62
+
29
63
  .hl-slider::-moz-range-track {
30
- height: var(--_track);
64
+ block-size: var(--_track);
31
65
  border-radius: var(--hl-radius-full);
32
66
  background: var(--hl-surface-3);
33
67
  }
34
68
 
35
69
  .hl-slider::-moz-range-progress {
36
- height: var(--_track);
70
+ block-size: var(--_track);
37
71
  border-radius: var(--hl-radius-full);
38
72
  background: var(--hl-primary);
39
73
  }
40
74
 
41
75
  .hl-slider::-webkit-slider-thumb {
42
- -webkit-appearance: none;
43
- appearance: none;
44
- width: var(--_thumb);
45
- height: var(--_thumb);
46
- margin-top: calc((var(--_track) - var(--_thumb)) / 2);
76
+ appearance: none;
77
+ inline-size: var(--_thumb);
78
+ block-size: var(--_thumb);
79
+ margin-block-start: calc((var(--_track) - var(--_thumb)) / 2);
47
80
  border: 2px solid var(--hl-surface);
48
81
  border-radius: var(--hl-radius-full);
49
82
  background: var(--hl-primary);
50
83
  box-shadow: var(--hl-shadow-sm);
51
- -webkit-transition: transform var(--hl-duration-fast) var(--hl-ease-standard);
52
- transition: transform var(--hl-duration-fast) var(--hl-ease-standard);
84
+ -webkit-transition: scale var(--hl-duration-fast) var(--hl-ease-standard);
85
+ transition: scale var(--hl-duration-fast) var(--hl-ease-standard);
53
86
  }
54
87
 
55
88
  .hl-slider::-moz-range-thumb {
56
- width: var(--_thumb);
57
- height: var(--_thumb);
89
+ inline-size: var(--_thumb);
90
+ block-size: var(--_thumb);
58
91
  border: 2px solid var(--hl-surface);
59
92
  border-radius: var(--hl-radius-full);
60
93
  background: var(--hl-primary);
@@ -62,7 +95,7 @@
62
95
  }
63
96
 
64
97
  .hl-slider:active::-webkit-slider-thumb {
65
- transform: scale(1.1);
98
+ scale: 1.1;
66
99
  }
67
100
 
68
101
  .hl-slider:focus-visible {
@@ -70,15 +103,23 @@
70
103
  }
71
104
 
72
105
  .hl-slider:focus-visible::-webkit-slider-thumb {
73
- box-shadow: 0 0 0 4px color-mix(in oklab, var(--hl-ring) 35%, transparent);
106
+ box-shadow: var(--hl-focus-shadow);
74
107
  }
75
108
 
76
109
  .hl-slider:focus-visible::-moz-range-thumb {
77
- box-shadow: 0 0 0 4px color-mix(in oklab, var(--hl-ring) 35%, transparent);
110
+ box-shadow: var(--hl-focus-shadow);
78
111
  }
79
112
 
80
113
  .hl-slider:disabled {
81
114
  cursor: not-allowed;
82
- opacity: 0.6;
115
+ opacity: var(--hl-disabled-opacity);
116
+ }
117
+
118
+ /* Shadows vanish in forced colors, so focus falls back to an outline. */
119
+ @media (forced-colors: active) {
120
+ .hl-slider:focus-visible {
121
+ outline: var(--hl-focus-ring);
122
+ outline-offset: var(--hl-focus-offset);
123
+ }
83
124
  }
84
125
  }
package/dist/spinner.css CHANGED
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Spinner: `<span class="hl-spinner" role="status" aria-label="Loading">`.
3
- * Inherits `currentColor`, so set `color` to theme it.
3
+ * Inherits `currentColor`, so set `color` to theme it. Pure CSS; there is no
4
+ * enhancer.
4
5
  * data-hl-size: sm | md (default) | lg | xl
5
6
  */
6
7
  @layer components {
@@ -10,22 +11,14 @@
10
11
 
11
12
  display: inline-block;
12
13
  flex: none;
13
- width: 1.25rem;
14
- width: var(--_size);
15
- height: 1.25rem;
16
- height: var(--_size);
17
- border: 2px solid color-mix(in oklab, currentcolor 25%, transparent);
18
- border-top-color: currentcolor;
14
+ inline-size: var(--_size);
15
+ block-size: var(--_size);
16
+ border: var(--_width) solid color-mix(in oklab, currentcolor 25%, transparent);
17
+ border-block-start-color: currentcolor;
19
18
  border-radius: var(--hl-radius-full);
20
19
  animation: hl-spinner-rotate 0.6s linear infinite;
21
20
  }
22
21
 
23
- @supports (color: color-mix(in lch, red, blue)) {
24
- .hl-spinner {
25
- border: var(--_width) solid color-mix(in oklab, currentcolor 25%, transparent);
26
- }
27
- }
28
-
29
22
  .hl-spinner[data-hl-size='sm'] {
30
23
  --_size: 1rem;
31
24
  }
@@ -46,9 +39,19 @@
46
39
  }
47
40
  }
48
41
 
42
+ /* A static arc still reads as "loading" without continuous motion. */
49
43
  @media (prefers-reduced-motion: reduce) {
50
44
  .hl-spinner {
51
- animation-duration: 1.4s;
45
+ animation: none;
46
+ }
47
+ }
48
+
49
+ /* The faded ring is color-mixed, which forced colors flatten; keep the arc
50
+ visible by drawing the rest of the ring in GrayText. */
51
+ @media (forced-colors: active) {
52
+ .hl-spinner {
53
+ border-color: GrayText;
54
+ border-block-start-color: CanvasText;
52
55
  }
53
56
  }
54
57
  }
package/dist/switch.css CHANGED
@@ -1,39 +1,53 @@
1
+ /**
2
+ * Switch: `<label data-hl-switch><input type="checkbox" role="switch"> Label</label>`.
3
+ * The native checkbox is restyled as a track and thumb, so state, keyboard,
4
+ * and form submission stay native. Pure CSS; there is no enhancer.
5
+ * data-hl-switch: the label wrapper
6
+ */
1
7
  @layer components {
2
8
  [data-hl-switch] {
9
+ --_track-inline: 2.25rem;
10
+ --_track-block: 1.25rem;
11
+ --_gap: 2px;
12
+ --_thumb: calc(var(--_track-block) - var(--_gap) * 2);
13
+ --_travel: calc(var(--_track-inline) - var(--_track-block));
14
+
3
15
  display: inline-flex;
4
16
  align-items: center;
5
17
  gap: var(--hl-space-2);
6
18
  }
7
19
 
8
20
  [data-hl-switch] input[type='checkbox'] {
9
- -webkit-appearance: none;
10
- -moz-appearance: none;
11
- appearance: none;
12
- width: 2.25rem;
13
- height: 1.25rem;
14
- border-radius: 1.25rem;
15
- background: var(--hl-border-strong);
21
+ appearance: none;
16
22
  position: relative;
17
- outline-offset: 2px;
23
+ inline-size: var(--_track-inline);
24
+ block-size: var(--_track-block);
25
+ margin: 0;
26
+ border-radius: var(--hl-radius-full);
27
+ background: var(--hl-border-strong);
18
28
  transition: background-color var(--hl-duration-fast) var(--hl-ease-standard);
19
29
  }
20
30
 
31
+ /* The thumb rests at the inline start and travels toward the inline end,
32
+ so it is placed logically and slides left under RTL. */
21
33
  [data-hl-switch] input[type='checkbox']::after {
22
34
  content: '';
23
35
  position: absolute;
24
- top: 2px;
25
- right: auto;
26
- bottom: auto;
27
- left: 2px;
28
- width: calc(1.25rem - 4px);
29
- height: calc(1.25rem - 4px);
30
- border-radius: 50%;
36
+ inset-block-start: var(--_gap);
37
+ inset-inline-start: var(--_gap);
38
+ inline-size: var(--_thumb);
39
+ block-size: var(--_thumb);
40
+ border-radius: var(--hl-radius-full);
31
41
  background: var(--hl-surface);
32
- transition: transform var(--hl-duration-fast) var(--hl-ease-standard);
42
+ transition: translate var(--hl-duration-fast) var(--hl-ease-standard);
33
43
  }
34
44
 
35
45
  [data-hl-switch] input[type='checkbox']:checked::after {
36
- transform: translateX(1rem);
46
+ translate: var(--_travel) 0;
47
+ }
48
+
49
+ [data-hl-switch] input[type='checkbox']:checked:dir(rtl)::after {
50
+ translate: calc(var(--_travel) * -1) 0;
37
51
  }
38
52
 
39
53
  [data-hl-switch] input[type='checkbox']:checked {
@@ -42,10 +56,11 @@
42
56
 
43
57
  [data-hl-switch] input[type='checkbox']:focus-visible {
44
58
  outline: var(--hl-focus-ring);
59
+ outline-offset: var(--hl-focus-offset);
45
60
  }
46
61
 
47
62
  [data-hl-switch] input[type='checkbox']:disabled {
48
- opacity: 0.5;
63
+ opacity: var(--hl-disabled-opacity);
49
64
  cursor: not-allowed;
50
65
  }
51
66
 
@@ -53,4 +68,26 @@
53
68
  opacity: 0.7;
54
69
  cursor: not-allowed;
55
70
  }
71
+
72
+ /* The track needs an edge once its fill is flattened, and the custom-drawn
73
+ thumb keeps its own colors so it stays visible on both states. */
74
+ @media (forced-colors: active) {
75
+ [data-hl-switch] input[type='checkbox'] {
76
+ border: var(--hl-border-width) solid ButtonBorder;
77
+ }
78
+
79
+ [data-hl-switch] input[type='checkbox']:checked {
80
+ background: Highlight;
81
+ border-color: Highlight;
82
+ }
83
+
84
+ [data-hl-switch] input[type='checkbox']::after {
85
+ forced-color-adjust: none;
86
+ background: ButtonText;
87
+ }
88
+
89
+ [data-hl-switch] input[type='checkbox']:checked::after {
90
+ background: HighlightText;
91
+ }
92
+ }
56
93
  }
package/dist/table.css CHANGED
@@ -1,31 +1,45 @@
1
1
  /**
2
- * Table: `<table class="hl-table">`. Semantic table styling with optional
3
- * zebra striping and hover.
2
+ * Table: `<table class="hl-table">`, optionally inside
3
+ * `<div class="hl-table-wrapper">` so wide tables scroll instead of breaking
4
+ * the layout. Add `data-hl-table` and mark headers `data-hl-sort` for the
5
+ * sorting enhancer; it sets `aria-sort` on the active column.
4
6
  * data-hl-striped: zebra rows
5
7
  * data-hl-hover: highlight row on hover
8
+ * data-hl-align: start (default) | center | end, on the table or a cell
9
+ * data-hl-size: sm | md (default) | lg, cell padding density
10
+ * data-hl-table: opt in to the sorting enhancer
11
+ * data-hl-sort: a sortable header (value: the column key)
6
12
  */
7
13
  @layer components {
14
+ .hl-table-wrapper {
15
+ inline-size: 100%;
16
+ overflow-x: auto;
17
+ overscroll-behavior-x: contain;
18
+ }
19
+
8
20
  .hl-table {
9
- width: 100%;
21
+ --_pad-y: var(--hl-space-2);
22
+ --_pad-x: var(--hl-space-3);
23
+
24
+ inline-size: 100%;
10
25
  border-collapse: collapse;
11
26
  font-size: var(--hl-text-sm);
12
27
  color: var(--hl-fg);
13
28
  }
14
29
 
15
30
  .hl-table caption {
16
- padding-top: var(--hl-space-2);
17
- padding-bottom: var(--hl-space-2);
31
+ padding-block: var(--hl-space-2);
18
32
  color: var(--hl-fg-muted);
19
- text-align: left;
33
+ text-align: start;
20
34
  caption-side: bottom;
21
35
  }
22
36
 
23
37
  .hl-table th,
24
38
  .hl-table td {
25
- padding: var(--hl-space-2) var(--hl-space-3);
26
- text-align: left;
39
+ padding: var(--_pad-y) var(--_pad-x);
40
+ text-align: start;
27
41
  vertical-align: middle;
28
- border-bottom: var(--hl-border-width) solid var(--hl-border);
42
+ border-block-end: var(--hl-border-width) solid var(--hl-border);
29
43
  }
30
44
 
31
45
  .hl-table thead th {
@@ -34,7 +48,52 @@
34
48
  text-transform: uppercase;
35
49
  letter-spacing: 0.03em;
36
50
  color: var(--hl-fg-muted);
37
- border-bottom-color: var(--hl-border-strong);
51
+ border-block-end-color: var(--hl-border-strong);
52
+ }
53
+
54
+ /* Sortable headers: a pointer cursor, a focus ring, and a direction glyph. */
55
+ .hl-table th[data-hl-sort] {
56
+ cursor: pointer;
57
+ -webkit-user-select: none;
58
+ user-select: none;
59
+ }
60
+
61
+ .hl-table th[data-hl-sort]:hover {
62
+ color: var(--hl-fg);
63
+ }
64
+
65
+ .hl-table th[data-hl-sort]:focus-visible {
66
+ outline: var(--hl-focus-ring);
67
+ outline-offset: calc(var(--hl-focus-offset) * -1);
68
+ }
69
+
70
+ .hl-table th[data-hl-sort]::after {
71
+ content: '';
72
+ display: inline-block;
73
+ inline-size: 0.35em;
74
+ block-size: 0.35em;
75
+ margin-inline-start: var(--hl-space-1);
76
+ border-inline-end: 1.5px solid currentcolor;
77
+ border-block-end: 1.5px solid currentcolor;
78
+ opacity: 0;
79
+ translate: 0 -0.15em;
80
+ rotate: 45deg;
81
+ transition: opacity var(--hl-duration-fast) var(--hl-ease-standard);
82
+ }
83
+
84
+ .hl-table th[data-hl-sort]:hover::after {
85
+ opacity: 0.4;
86
+ }
87
+
88
+ .hl-table th[aria-sort='ascending']::after,
89
+ .hl-table th[aria-sort='descending']::after {
90
+ opacity: 1;
91
+ color: var(--hl-primary);
92
+ }
93
+
94
+ .hl-table th[aria-sort='ascending']::after {
95
+ rotate: 225deg;
96
+ translate: 0 0.1em;
38
97
  }
39
98
 
40
99
  .hl-table tfoot td {
@@ -50,13 +109,39 @@
50
109
  background: color-mix(in oklab, var(--hl-primary) 8%, transparent);
51
110
  }
52
111
 
53
- .hl-table td[data-hl-align='end'],
54
- .hl-table th[data-hl-align='end'] {
55
- text-align: right;
112
+ .hl-table[data-hl-size='sm'] {
113
+ --_pad-y: var(--hl-space-1);
114
+ --_pad-x: var(--hl-space-2);
115
+
116
+ font-size: var(--hl-text-xs);
117
+ }
118
+
119
+ .hl-table[data-hl-size='lg'] {
120
+ --_pad-y: var(--hl-space-3);
121
+ --_pad-x: var(--hl-space-4);
122
+
123
+ font-size: var(--hl-text-base);
124
+ }
125
+
126
+ .hl-table[data-hl-align='start'] :is(th, td),
127
+ .hl-table :is(th, td)[data-hl-align='start'] {
128
+ text-align: start;
56
129
  }
57
130
 
58
- .hl-table td[data-hl-align='center'],
59
- .hl-table th[data-hl-align='center'] {
131
+ .hl-table[data-hl-align='center'] :is(th, td),
132
+ .hl-table :is(th, td)[data-hl-align='center'] {
60
133
  text-align: center;
61
134
  }
135
+
136
+ .hl-table[data-hl-align='end'] :is(th, td),
137
+ .hl-table :is(th, td)[data-hl-align='end'] {
138
+ text-align: end;
139
+ }
140
+
141
+ @media (forced-colors: active) {
142
+ .hl-table[data-hl-hover] tbody tr:hover {
143
+ background: Highlight;
144
+ color: HighlightText;
145
+ }
146
+ }
62
147
  }
package/dist/tabs.css CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Tabs. Two markups are supported and styled together:
2
+ * Tabs: `<div data-hl-tabs>`. Two markups are supported and styled together:
3
3
  *
4
4
  * - CSS-only baseline: `.hl-tablist` of `<label class="hl-tab">` wrapping a
5
5
  * radio, then a `.hl-tabpanels` of `.hl-tabpanel`s. `:has(input:checked)`
@@ -7,6 +7,10 @@
7
7
  * - Enhanced: the enhancer adds `role="tab"`/`tabpanel`, roving focus, and
8
8
  * `aria-selected`, toggles `[hidden]` on panels, and marks the root
9
9
  * `data-hl-ready`, at which point the no-JS rules below stand down.
10
+ * data-hl-tabs: root
11
+ * data-hl-ready: set by the enhancer
12
+ * `aria-orientation="vertical"` on the tablist stacks the tabs at the
13
+ * inline start of the panels.
10
14
  */
11
15
  @layer components {
12
16
  [data-hl-tabs] {
@@ -19,15 +23,23 @@
19
23
  display: flex;
20
24
  gap: var(--hl-space-2);
21
25
  padding: var(--hl-space-2);
22
- border-bottom: var(--hl-border-width) solid var(--hl-border);
26
+ border-block-end: var(--hl-border-width) solid var(--hl-border);
27
+ }
28
+
29
+ [data-hl-tabs]:has(> [role='tablist'][aria-orientation='vertical']) {
30
+ display: flex;
31
+ }
32
+
33
+ [data-hl-tabs] [role='tablist'][aria-orientation='vertical'] {
34
+ flex-direction: column;
35
+ border-block-end: 0;
36
+ border-inline-end: var(--hl-border-width) solid var(--hl-border);
23
37
  }
24
38
 
25
39
  .hl-tab,
26
40
  [data-hl-tabs] [role='tab'] {
27
41
  position: relative;
28
- -webkit-appearance: none;
29
- -moz-appearance: none;
30
- appearance: none;
42
+ appearance: none;
31
43
  display: inline-flex;
32
44
  align-items: center;
33
45
  background: transparent;
@@ -42,10 +54,7 @@
42
54
  /* The baseline keeps selection in a visually hidden radio per tab label. */
43
55
  .hl-tab > input[type='radio'] {
44
56
  position: absolute;
45
- top: 0;
46
- right: 0;
47
- bottom: 0;
48
- left: 0;
57
+ inset: 0;
49
58
  margin: 0;
50
59
  opacity: 0;
51
60
  cursor: pointer;
@@ -59,13 +68,13 @@
59
68
  .hl-tab:has(input:focus-visible),
60
69
  [data-hl-tabs] [role='tab']:focus-visible {
61
70
  outline: var(--hl-focus-ring);
62
- outline-offset: 2px;
71
+ outline-offset: var(--hl-focus-offset);
63
72
  }
64
73
 
65
74
  .hl-tab:has(input:disabled),
66
75
  [data-hl-tabs] [role='tab'][disabled],
67
76
  [data-hl-tabs] [role='tab'][aria-disabled='true'] {
68
- opacity: 0.5;
77
+ opacity: var(--hl-disabled-opacity);
69
78
  cursor: not-allowed;
70
79
  }
71
80
 
@@ -124,4 +133,19 @@
124
133
  [data-hl-tabs]:not([data-hl-ready]) [role='tabpanel'] ~ [role='tabpanel'] {
125
134
  display: none;
126
135
  }
136
+
137
+ /* Selection is a fill, which forced colors flatten; use the system highlight
138
+ and give every tab an edge. */
139
+ @media (forced-colors: active) {
140
+ .hl-tab,
141
+ [data-hl-tabs] [role='tab'] {
142
+ border: var(--hl-border-width) solid ButtonBorder;
143
+ }
144
+
145
+ .hl-tab:has(input:checked),
146
+ [data-hl-tabs] [role='tab'][aria-selected='true'] {
147
+ background: Highlight;
148
+ color: HighlightText;
149
+ }
150
+ }
127
151
  }