hydrateless 0.6.0 → 0.8.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.
@@ -1,12 +1,18 @@
1
1
  /* Disclosure & layout */
2
+ /**
3
+ * Disclosure: a styled native `<details>`. The class and the `data-hl-disclosure`
4
+ * attribute (which also opts into the state enhancer) are interchangeable, so
5
+ * plain HTML needs only one of them. Exclusive groups need no JavaScript:
6
+ * give related disclosures the same `name` attribute.
7
+ */
2
8
  @layer components {
3
- details.hl-disclosure {
9
+ details.hl-disclosure, details[data-hl-disclosure] {
4
10
  border: 1px solid var(--hl-border);
5
11
  border-radius: var(--hl-radius-lg);
6
12
  background: var(--hl-surface);
7
13
  }
8
14
 
9
- details.hl-disclosure > summary {
15
+ details.hl-disclosure > summary, details[data-hl-disclosure] > summary {
10
16
  list-style: none;
11
17
  cursor: pointer;
12
18
  padding: var(--hl-space-3) var(--hl-space-4);
@@ -16,74 +22,167 @@
16
22
  display: none;
17
23
  }
18
24
 
25
+ details[data-hl-disclosure] > summary::-webkit-details-marker {
26
+ display: none;
27
+ }
28
+
19
29
  details.hl-disclosure > summary:focus-visible {
20
30
  outline: var(--hl-focus-ring);
21
31
  outline-offset: 2px;
22
32
  }
23
33
 
34
+ details[data-hl-disclosure] > summary:focus-visible {
35
+ outline: var(--hl-focus-ring);
36
+ outline-offset: 2px;
37
+ }
38
+
24
39
  details.hl-disclosure > summary::after {
25
40
  content: '\25B8';
26
41
  float: right;
27
42
  transition: transform var(--hl-duration-fast) var(--hl-ease-standard);
28
43
  }
29
44
 
45
+ details[data-hl-disclosure] > summary::after {
46
+ content: '\25B8';
47
+ float: right;
48
+ transition: transform var(--hl-duration-fast) var(--hl-ease-standard);
49
+ }
50
+
30
51
  details.hl-disclosure[open] > summary::after {
31
52
  transform: rotate(90deg);
32
53
  }
33
54
 
34
- details.hl-disclosure > .hl-disclosure-panel {
55
+ details[data-hl-disclosure][open] > summary::after {
56
+ transform: rotate(90deg);
57
+ }
58
+
59
+ details.hl-disclosure > .hl-disclosure-panel, details[data-hl-disclosure] > .hl-disclosure-panel {
35
60
  padding: var(--hl-space-3) var(--hl-space-4) var(--hl-space-4);
36
61
  }
37
62
  }
63
+ /**
64
+ * Tabs. Two markups are supported and styled together:
65
+ *
66
+ * - CSS-only baseline: `.hl-tablist` of `<label class="hl-tab">` wrapping a
67
+ * radio, then a `.hl-tabpanels` of `.hl-tabpanel`s. `:has(input:checked)`
68
+ * switches panels with no JavaScript (up to 8 tabs).
69
+ * - Enhanced: the enhancer adds `role="tab"`/`tabpanel`, roving focus, and
70
+ * `aria-selected`, toggles `[hidden]` on panels, and marks the root
71
+ * `data-hl-ready`, at which point the no-JS rules below stand down.
72
+ */
38
73
  @layer components {
39
74
  [data-hl-tabs] {
40
- border: 1px solid var(--hl-border);
75
+ border: var(--hl-border-width) solid var(--hl-border);
41
76
  border-radius: var(--hl-radius-lg);
42
77
  }
43
78
 
79
+ .hl-tablist,
44
80
  [data-hl-tabs] [role='tablist'] {
45
81
  display: flex;
46
82
  gap: var(--hl-space-2);
47
83
  padding: var(--hl-space-2);
48
- border-bottom: 1px solid var(--hl-border);
84
+ border-bottom: var(--hl-border-width) solid var(--hl-border);
49
85
  }
50
86
 
87
+ .hl-tab,
51
88
  [data-hl-tabs] [role='tab'] {
89
+ position: relative;
52
90
  -webkit-appearance: none;
53
91
  -moz-appearance: none;
54
92
  appearance: none;
93
+ display: inline-flex;
94
+ align-items: center;
55
95
  background: transparent;
56
96
  border: 0;
57
97
  border-radius: var(--hl-radius-sm);
58
98
  padding: var(--hl-space-2) var(--hl-space-3);
59
99
  color: inherit;
100
+ font: inherit;
101
+ cursor: pointer;
60
102
  }
61
103
 
104
+ /* The baseline keeps selection in a visually hidden radio per tab label. */
105
+ .hl-tab > input[type='radio'] {
106
+ position: absolute;
107
+ top: 0;
108
+ right: 0;
109
+ bottom: 0;
110
+ left: 0;
111
+ margin: 0;
112
+ opacity: 0;
113
+ cursor: pointer;
114
+ }
115
+
116
+ .hl-tab:has(input:checked),
62
117
  [data-hl-tabs] [role='tab'][aria-selected='true'] {
63
118
  background: var(--hl-surface-2);
64
119
  }
65
120
 
121
+ .hl-tab:has(input:focus-visible),
122
+ [data-hl-tabs] [role='tab']:focus-visible {
123
+ outline: var(--hl-focus-ring);
124
+ outline-offset: 2px;
125
+ }
126
+
127
+ .hl-tab:has(input:disabled),
66
128
  [data-hl-tabs] [role='tab'][disabled],
67
129
  [data-hl-tabs] [role='tab'][aria-disabled='true'] {
68
130
  opacity: 0.5;
69
131
  cursor: not-allowed;
70
132
  }
71
133
 
72
- [data-hl-tabs] [role='tab']:focus-visible {
73
- outline: var(--hl-focus-ring);
74
- outline-offset: 2px;
75
- }
76
-
134
+ .hl-tabpanel,
77
135
  [data-hl-tabs] [role='tabpanel'] {
78
136
  padding: var(--hl-space-4);
79
137
  }
80
138
 
139
+ .hl-tabpanel[hidden],
81
140
  [role='tabpanel'][hidden] {
82
141
  display: none;
83
142
  }
84
143
 
85
- /* No-JS fallback: until the enhancer marks the root ready, show only the
86
- first panel so server-rendered content degrades to readable output. */
144
+ /* No-JS baseline: reveal the panel whose tab radio is checked, by position.
145
+ These stand down once the enhancer sets data-hl-ready and owns [hidden]. */
146
+ [data-hl-tabs]:not([data-hl-ready]) .hl-tabpanels > .hl-tabpanel {
147
+ display: none;
148
+ }
149
+
150
+ [data-hl-tabs]:not([data-hl-ready])
151
+ .hl-tablist:has(.hl-tab:nth-of-type(1) input:checked)
152
+ ~ .hl-tabpanels
153
+ > .hl-tabpanel:nth-of-type(1),
154
+ [data-hl-tabs]:not([data-hl-ready])
155
+ .hl-tablist:has(.hl-tab:nth-of-type(2) input:checked)
156
+ ~ .hl-tabpanels
157
+ > .hl-tabpanel:nth-of-type(2),
158
+ [data-hl-tabs]:not([data-hl-ready])
159
+ .hl-tablist:has(.hl-tab:nth-of-type(3) input:checked)
160
+ ~ .hl-tabpanels
161
+ > .hl-tabpanel:nth-of-type(3),
162
+ [data-hl-tabs]:not([data-hl-ready])
163
+ .hl-tablist:has(.hl-tab:nth-of-type(4) input:checked)
164
+ ~ .hl-tabpanels
165
+ > .hl-tabpanel:nth-of-type(4),
166
+ [data-hl-tabs]:not([data-hl-ready])
167
+ .hl-tablist:has(.hl-tab:nth-of-type(5) input:checked)
168
+ ~ .hl-tabpanels
169
+ > .hl-tabpanel:nth-of-type(5),
170
+ [data-hl-tabs]:not([data-hl-ready])
171
+ .hl-tablist:has(.hl-tab:nth-of-type(6) input:checked)
172
+ ~ .hl-tabpanels
173
+ > .hl-tabpanel:nth-of-type(6),
174
+ [data-hl-tabs]:not([data-hl-ready])
175
+ .hl-tablist:has(.hl-tab:nth-of-type(7) input:checked)
176
+ ~ .hl-tabpanels
177
+ > .hl-tabpanel:nth-of-type(7),
178
+ [data-hl-tabs]:not([data-hl-ready])
179
+ .hl-tablist:has(.hl-tab:nth-of-type(8) input:checked)
180
+ ~ .hl-tabpanels
181
+ > .hl-tabpanel:nth-of-type(8) {
182
+ display: block;
183
+ }
184
+
185
+ /* Role-only markup (no radios) before JS: degrade to showing the first panel. */
87
186
  [data-hl-tabs]:not([data-hl-ready]) [role='tabpanel'] ~ [role='tabpanel'] {
88
187
  display: none;
89
188
  }
@@ -216,7 +315,7 @@
216
315
  }
217
316
  }
218
317
  /**
219
- * Pagination — `<nav class="hl-pagination" aria-label="Pagination">` wrapping a
318
+ * Pagination: `<nav class="hl-pagination" aria-label="Pagination">` wrapping a
220
319
  * list of `.hl-pagination-item` links/buttons; mark the active page with
221
320
  * `aria-current="page"` and use `.hl-pagination-ellipsis` for gaps.
222
321
  */
@@ -286,7 +385,7 @@
286
385
  }
287
386
  }
288
387
  /**
289
- * Separator — `<hr class="hl-separator">` or
388
+ * Separator: `<hr class="hl-separator">` or
290
389
  * `<div class="hl-separator" role="separator" aria-orientation="vertical">`.
291
390
  */
292
391
  @layer components {
@@ -343,7 +442,7 @@
343
442
  border-top: 1px solid var(--hl-border);
344
443
  }
345
444
 
346
- .hl-modal [data-hl-modal-close]:focus-visible {
445
+ .hl-modal [command='close']:focus-visible {
347
446
  outline: var(--hl-focus-ring);
348
447
  outline-offset: 2px;
349
448
  }
@@ -428,10 +527,20 @@
428
527
  border-top: 1px solid var(--hl-border);
429
528
  }
430
529
  }
530
+ /**
531
+ * Popover: a `[popover] [data-hl-popover]` surface opened by a
532
+ * `<button popovertarget="…">` (or `command="toggle-popover"`). The browser
533
+ * owns the top layer, light-dismiss, and Escape with no JavaScript; the
534
+ * enhancer only mirrors `aria-expanded`, adds optional hover, and runs the JS
535
+ * positioning fallback on engines without CSS anchor positioning.
536
+ */
431
537
  @layer components {
432
- [popover],
433
538
  [data-hl-popover] {
434
- border: 1px solid var(--hl-border);
539
+ margin: 0;
540
+ width: -moz-max-content;
541
+ width: max-content;
542
+ max-width: min(92vw, 22rem);
543
+ border: var(--hl-border-width) solid var(--hl-border);
435
544
  border-radius: var(--hl-radius-lg);
436
545
  padding: var(--hl-space-3);
437
546
  background: var(--hl-surface);
@@ -439,64 +548,123 @@
439
548
  box-shadow: var(--hl-overlay-shadow);
440
549
  }
441
550
 
551
+ /* Until the `popover` attribute is present (author omitted it and JS hasn't
552
+ upgraded the element yet), keep the surface out of the flow. */
442
553
  [data-hl-popover]:not([popover]) {
554
+ display: none;
555
+ }
556
+
557
+ /* Engines without the Popover API can't promote it to the top layer, so the
558
+ JS fallback positions it; give it a stacking context to land above content. */
559
+ [data-hl-popover]:not(:popover-open) {
443
560
  z-index: var(--hl-z-popover);
444
561
  }
445
562
 
446
- [data-hl-popover][hidden] {
447
- display: none;
563
+ /* Modern placement: anchor to the invoking control (the popover's implicit
564
+ anchor) and flip when there isn't room. Older engines use the JS fallback,
565
+ which writes inline position/inset and wins over these rules. */
566
+ @supports (position-area: block-end) {
567
+ [data-hl-popover] {
568
+ position: fixed;
569
+ inset-area: block-end;
570
+ position-area: block-end;
571
+ position-try-fallbacks: flip-block, flip-inline;
572
+ margin-top: var(--hl-space-1);
573
+ margin-bottom: var(--hl-space-1);
574
+ }
448
575
  }
449
576
  }
577
+ /**
578
+ * Tooltip: a `[role="tooltip"]` element described by a `[data-hl-tooltip]`
579
+ * trigger. With no JavaScript it shows on the trigger's `:hover`/`:focus-visible`
580
+ * (the tip must be the trigger's next sibling). When the enhancer runs it marks
581
+ * the trigger `data-hl-tooltip-managed` and drives visibility through
582
+ * `data-hl-tooltip-open` instead, adding show/hide delays, a grace period, and
583
+ * Escape-to-dismiss.
584
+ */
450
585
  @layer components {
451
586
  [role='tooltip'] {
587
+ /* Fallback placement: the JS positioner writes inline position/inset on
588
+ engines without CSS anchor positioning. */
452
589
  position: absolute;
453
590
  z-index: var(--hl-z-tooltip);
454
- top: auto;
455
- right: auto;
456
- bottom: auto;
457
- left: 0;
458
- translate: 0 -0.25rem;
591
+ width: -moz-max-content;
592
+ width: max-content;
593
+ max-width: 32ch;
594
+ margin: 0;
459
595
  padding: var(--hl-space-1) var(--hl-space-2);
460
596
  border-radius: var(--hl-radius-sm);
461
597
  background: var(--hl-fg);
462
598
  color: var(--hl-surface);
463
599
  font-size: var(--hl-text-sm);
464
- max-width: 32ch;
465
- width: -moz-max-content;
466
- width: max-content;
467
600
  }
468
601
 
469
602
  [role='tooltip'][hidden] {
470
603
  display: none;
471
604
  }
605
+
606
+ /* No-JS baseline: reveal while the adjacent trigger is hovered or focused.
607
+ Suppressed once the enhancer takes over (trigger gains -managed). */
608
+ [data-hl-tooltip]:not([data-hl-tooltip-managed]):hover + [role='tooltip'],
609
+ [data-hl-tooltip]:not([data-hl-tooltip-managed]):focus-visible + [role='tooltip'] {
610
+ display: block;
611
+ }
612
+
613
+ /* Modern placement: pin above the trigger via the anchor-name the enhancer
614
+ sets, flipping below when there's no room. */
615
+ @supports (anchor-name: --x) {
616
+ [role='tooltip'] {
617
+ position: fixed;
618
+ inset-area: block-start;
619
+ position-area: block-start;
620
+ position-try-fallbacks: flip-block;
621
+ margin-top: var(--hl-space-1);
622
+ margin-bottom: var(--hl-space-1);
623
+ }
624
+ }
472
625
  }
626
+ /**
627
+ * Dropdown menu button: `<div data-hl-dropdown>` wrapping a
628
+ * `[data-hl-dropdown-trigger]` button and a `[data-hl-dropdown-menu]` list. The
629
+ * enhancer turns the menu into a native `popover` the trigger controls through
630
+ * `popovertarget`, so opening, Escape, and light-dismiss need no JavaScript;
631
+ * the menu lives in the top layer and is placed with CSS anchor positioning.
632
+ */
473
633
  @layer components {
474
634
  [data-hl-dropdown] {
475
- position: relative;
476
635
  display: inline-block;
477
636
  }
478
637
 
479
638
  [data-hl-dropdown-menu] {
480
- position: absolute;
481
- z-index: var(--hl-z-dropdown);
639
+ margin: 0;
482
640
  min-width: 10rem;
483
- border: 1px solid var(--hl-border);
641
+ border: var(--hl-border-width) solid var(--hl-border);
484
642
  border-radius: var(--hl-radius-lg);
485
643
  background: var(--hl-surface);
486
644
  box-shadow: var(--hl-overlay-shadow);
487
645
  padding: var(--hl-space-1);
488
646
  list-style: none;
489
- margin: var(--hl-space-1) 0 0;
490
647
  }
491
648
 
492
- [data-hl-dropdown-menu][hidden] {
649
+ /* Before the menu is promoted to a popover (JS not yet loaded), hide it. */
650
+ [data-hl-dropdown-menu]:not([popover]) {
493
651
  display: none;
494
652
  }
495
653
 
496
- [data-hl-dropdown-menu][data-hl-side='top'] {
497
- top: auto;
498
- bottom: 100%;
499
- margin: 0 0 var(--hl-space-1);
654
+ [data-hl-dropdown-menu]:not(:popover-open) {
655
+ z-index: var(--hl-z-dropdown);
656
+ }
657
+
658
+ /* Open below the trigger, start-aligned, flipping when cramped. */
659
+ @supports (position-area: block-end) {
660
+ [data-hl-dropdown-menu] {
661
+ position: fixed;
662
+ inset-area: block-end span-inline-end;
663
+ position-area: block-end span-inline-end;
664
+ position-try-fallbacks: flip-block, flip-inline;
665
+ margin-top: var(--hl-space-1);
666
+ margin-bottom: var(--hl-space-1);
667
+ }
500
668
  }
501
669
 
502
670
  [data-hl-dropdown-menu] [role='menuitem'] {
@@ -530,9 +698,11 @@
530
698
  }
531
699
  }
532
700
  /**
533
- * Menubar / navigation menu — `<ul data-hl-menu role="menubar">` with optional
701
+ * Menubar / navigation menu: `<ul data-hl-menu role="menubar">` with optional
534
702
  * single-level submenus (`<ul role="menu" data-hl-menu-submenu>`). The enhancer
535
- * handles roving focus, arrow navigation, and open/close.
703
+ * handles roving focus, arrow navigation, and open/close, promoting each
704
+ * submenu to a native popover so it renders in the top layer, anchored to its
705
+ * trigger with CSS anchor positioning.
536
706
  */
537
707
  @layer components {
538
708
  [data-hl-menu] {
@@ -621,6 +791,37 @@
621
791
  display: none;
622
792
  }
623
793
 
794
+ /* Enhanced path: the submenu is a native popover in the top layer, anchored
795
+ to its trigger. The absolute-position rules above stay as the fallback for
796
+ engines without the Popover API. */
797
+ [data-hl-menu] [role='menu'][popover] {
798
+ position: fixed;
799
+ top: auto;
800
+ right: auto;
801
+ bottom: auto;
802
+ left: auto;
803
+ }
804
+
805
+ @supports (position-area: block-end) {
806
+ [data-hl-menu] [role='menu'][popover] {
807
+ inset-area: block-end span-inline-end;
808
+ position-area: block-end span-inline-end;
809
+ position-try-fallbacks: flip-block, flip-inline;
810
+ margin-top: var(--hl-space-1);
811
+ margin-bottom: var(--hl-space-1);
812
+ }
813
+
814
+ [data-hl-menu][aria-orientation='vertical'] [role='menu'][popover] {
815
+ inset-area: inline-end span-block-end;
816
+ position-area: inline-end span-block-end;
817
+ position-try-fallbacks: flip-inline, flip-block;
818
+ margin-top: 0;
819
+ margin-bottom: 0;
820
+ margin-left: var(--hl-space-1);
821
+ margin-right: var(--hl-space-1);
822
+ }
823
+ }
824
+
624
825
  [data-hl-menu] [role='separator'] {
625
826
  height: var(--hl-border-width);
626
827
  margin: var(--hl-space-1) 0;
@@ -712,7 +913,7 @@
712
913
  }
713
914
  }
714
915
  /**
715
- * Command palette — `<div data-hl-command>` containing a search input
916
+ * Command palette: `<div data-hl-command>` containing a search input
716
917
  * (`[data-hl-command-input]`), an empty state (`[data-hl-command-empty]`), and a
717
918
  * `[data-hl-command-list] role="listbox"` of grouped `[role="option"]` items.
718
919
  * Often placed inside a `<dialog class="hl-modal">`.
@@ -815,7 +1016,7 @@
815
1016
  }
816
1017
  /* Forms */
817
1018
  /**
818
- * Button — `<button class="hl-button">` (works on `<a>`/`<input>` too).
1019
+ * Button: `<button class="hl-button">` (works on `<a>`/`<input>` too).
819
1020
  *
820
1021
  * Color is driven by a small set of local custom properties so the
821
1022
  * intent × variant matrix stays DRY: `data-hl-intent` swaps the accent set,
@@ -1070,7 +1271,7 @@
1070
1271
  }
1071
1272
  }
1072
1273
  /**
1073
- * Text input — `<input class="hl-input">`.
1274
+ * Text input: `<input class="hl-input">`.
1074
1275
  * data-hl-size: sm | md (default) | lg
1075
1276
  * data-hl-invalid: error styling (pair with aria-invalid)
1076
1277
  */
@@ -1156,7 +1357,7 @@
1156
1357
  }
1157
1358
  }
1158
1359
  /**
1159
- * Multi-line text input — `<textarea class="hl-textarea">`.
1360
+ * Multi-line text input: `<textarea class="hl-textarea">`.
1160
1361
  * data-hl-invalid: error styling (pair with aria-invalid)
1161
1362
  */
1162
1363
  @layer components {
@@ -1213,7 +1414,7 @@
1213
1414
  }
1214
1415
  }
1215
1416
  /**
1216
- * Native select — `<span class="hl-select-wrapper"><select class="hl-select">`.
1417
+ * Native select: `<span class="hl-select-wrapper"><select class="hl-select">`.
1217
1418
  * The wrapper draws a custom caret while the native control keeps full
1218
1419
  * keyboard/mobile behavior.
1219
1420
  * data-hl-size: sm | md (default) | lg
@@ -1298,7 +1499,7 @@
1298
1499
  }
1299
1500
  }
1300
1501
  /**
1301
- * Checkbox — `<label class="hl-checkbox"><input type="checkbox"><span>…</span></label>`.
1502
+ * Checkbox: `<label class="hl-checkbox"><input type="checkbox"><span>…</span></label>`.
1302
1503
  * The native input is restyled (appearance:none) with a CSS checkmark, keeping
1303
1504
  * full keyboard + form semantics.
1304
1505
  */
@@ -1377,7 +1578,7 @@
1377
1578
  }
1378
1579
  }
1379
1580
  /**
1380
- * Radio — `<label class="hl-radio"><input type="radio"><span>…</span></label>`,
1581
+ * Radio: `<label class="hl-radio"><input type="radio"><span>…</span></label>`,
1381
1582
  * grouped in `<div class="hl-radio-group" role="radiogroup">`.
1382
1583
  */
1383
1584
  @layer components {
@@ -1511,7 +1712,7 @@
1511
1712
  }
1512
1713
  }
1513
1714
  /**
1514
- * Field — accessible form-control layout: `.hl-field` stacks a `.hl-label`,
1715
+ * Field, accessible form-control layout: `.hl-field` stacks a `.hl-label`,
1515
1716
  * the control, `.hl-help`, and `.hl-error`. `.hl-fieldset` + `.hl-legend`
1516
1717
  * group related fields.
1517
1718
  */
@@ -1570,7 +1771,7 @@
1570
1771
  }
1571
1772
  }
1572
1773
  /**
1573
- * Combobox — `<div data-hl-combobox>` wrapping an `<input>` and a
1774
+ * Combobox: `<div data-hl-combobox>` wrapping an `<input>` and a
1574
1775
  * `<ul role="listbox">` of `<li role="option">`. The enhancer toggles the
1575
1776
  * listbox and manages `aria-activedescendant`.
1576
1777
  */
@@ -1597,6 +1798,24 @@
1597
1798
  box-shadow: var(--hl-overlay-shadow);
1598
1799
  }
1599
1800
 
1801
+ /* Modern engines pin the listbox to the input via the anchor-name the
1802
+ enhancer sets, so it escapes overflow-clipping ancestors. */
1803
+ @supports (anchor-name: --x) {
1804
+ [data-hl-combobox] [role='listbox'] {
1805
+ position: fixed;
1806
+ top: auto;
1807
+ right: auto;
1808
+ bottom: auto;
1809
+ left: auto;
1810
+ width: anchor-size(width);
1811
+ inset-area: block-end;
1812
+ position-area: block-end;
1813
+ position-try-fallbacks: flip-block;
1814
+ margin-top: var(--hl-space-1);
1815
+ margin-bottom: var(--hl-space-1);
1816
+ }
1817
+ }
1818
+
1600
1819
  [data-hl-combobox] [role='listbox'][hidden] {
1601
1820
  display: none;
1602
1821
  }
@@ -1628,7 +1847,7 @@
1628
1847
  }
1629
1848
  }
1630
1849
  /**
1631
- * Segmented control — `<div class="hl-segmented" role="radiogroup">` of
1850
+ * Segmented control: `<div class="hl-segmented" role="radiogroup">` of
1632
1851
  * `<label class="hl-segmented-item"><input type="radio">…</label>` segments.
1633
1852
  * Radio inputs give free keyboard navigation; the checked segment is raised.
1634
1853
  * A button variant using `aria-pressed="true"` is also supported.
@@ -1713,7 +1932,7 @@
1713
1932
  }
1714
1933
  }
1715
1934
  /**
1716
- * Slider — native `<input type="range" class="hl-slider">`. Restyled track and
1935
+ * Slider: native `<input type="range" class="hl-slider">`. Restyled track and
1717
1936
  * thumb across WebKit/Blink and Firefox while keeping native keyboard support.
1718
1937
  */
1719
1938
  @layer components {
@@ -1798,7 +2017,7 @@
1798
2017
  }
1799
2018
  /* Feedback & data display */
1800
2019
  /**
1801
- * Alert — `<div class="hl-alert" role="alert" data-hl-intent="…">` with an
2020
+ * Alert: `<div class="hl-alert" role="alert" data-hl-intent="…">` with an
1802
2021
  * optional icon, `.hl-alert-title`, and body content.
1803
2022
  * data-hl-intent: info (default) | success | warning | danger | neutral
1804
2023
  */
@@ -1870,7 +2089,7 @@
1870
2089
  }
1871
2090
  }
1872
2091
  /**
1873
- * Badge — `<span class="hl-badge" data-hl-intent="…" data-hl-variant="…">`.
2092
+ * Badge: `<span class="hl-badge" data-hl-intent="…" data-hl-variant="…">`.
1874
2093
  * data-hl-intent: neutral (default) | primary | danger | success | warning | info
1875
2094
  * data-hl-variant: soft (default) | solid | outline
1876
2095
  * data-hl-size: sm | md (default)
@@ -1954,7 +2173,7 @@
1954
2173
  }
1955
2174
  }
1956
2175
  /**
1957
- * Card — `<div class="hl-card">` with optional `.hl-card-header`,
2176
+ * Card: `<div class="hl-card">` with optional `.hl-card-header`,
1958
2177
  * `.hl-card-body`, `.hl-card-footer`, `.hl-card-title`, `.hl-card-description`.
1959
2178
  * data-hl-interactive: hover/active elevation for clickable cards
1960
2179
  */
@@ -2025,7 +2244,7 @@
2025
2244
  }
2026
2245
  }
2027
2246
  /**
2028
- * Avatar — `<span class="hl-avatar">` containing an `<img>` or fallback
2247
+ * Avatar: `<span class="hl-avatar">` containing an `<img>` or fallback
2029
2248
  * initials/icon. Stack with `<div class="hl-avatar-group">`.
2030
2249
  * data-hl-size: xs | sm | md (default) | lg | xl
2031
2250
  * data-hl-shape: square
@@ -2099,7 +2318,7 @@
2099
2318
  }
2100
2319
  }
2101
2320
  /**
2102
- * Progress — native `<progress class="hl-progress" value max>`. Omit `value`
2321
+ * Progress: native `<progress class="hl-progress" value max>`. Omit `value`
2103
2322
  * for an indeterminate bar.
2104
2323
  * data-hl-intent: primary (default) | success | warning | danger | info
2105
2324
  * data-hl-size: sm | md (default) | lg
@@ -2193,7 +2412,7 @@
2193
2412
  }
2194
2413
  }
2195
2414
  /**
2196
- * Spinner — `<span class="hl-spinner" role="status" aria-label="Loading">`.
2415
+ * Spinner: `<span class="hl-spinner" role="status" aria-label="Loading">`.
2197
2416
  * Inherits `currentColor`, so set `color` to theme it.
2198
2417
  * data-hl-size: sm | md (default) | lg | xl
2199
2418
  */
@@ -2247,7 +2466,7 @@
2247
2466
  }
2248
2467
  }
2249
2468
  /**
2250
- * Skeleton — `<span class="hl-skeleton" data-hl-variant="…" aria-hidden="true">`
2469
+ * Skeleton: `<span class="hl-skeleton" data-hl-variant="…" aria-hidden="true">`
2251
2470
  * placeholder shown while content loads.
2252
2471
  * data-hl-variant: rect (default) | text | circle
2253
2472
  */
@@ -2296,7 +2515,7 @@
2296
2515
  }
2297
2516
  }
2298
2517
  /**
2299
- * Keyboard key — `<kbd class="hl-kbd">⌘</kbd>`. Combine inline, e.g.
2518
+ * Keyboard key: `<kbd class="hl-kbd">⌘</kbd>`. Combine inline, e.g.
2300
2519
  * `<kbd class="hl-kbd">⌘</kbd><kbd class="hl-kbd">K</kbd>`.
2301
2520
  */
2302
2521
  @layer components {
@@ -2318,7 +2537,7 @@
2318
2537
  }
2319
2538
  }
2320
2539
  /**
2321
- * Table — `<table class="hl-table">`. Semantic table styling with optional
2540
+ * Table: `<table class="hl-table">`. Semantic table styling with optional
2322
2541
  * zebra striping and hover.
2323
2542
  * data-hl-striped: zebra rows
2324
2543
  * data-hl-hover: highlight row on hover
@@ -1,11 +1,17 @@
1
+ /**
2
+ * Disclosure: a styled native `<details>`. The class and the `data-hl-disclosure`
3
+ * attribute (which also opts into the state enhancer) are interchangeable, so
4
+ * plain HTML needs only one of them. Exclusive groups need no JavaScript:
5
+ * give related disclosures the same `name` attribute.
6
+ */
1
7
  @layer components {
2
- details.hl-disclosure {
8
+ details.hl-disclosure, details[data-hl-disclosure] {
3
9
  border: 1px solid var(--hl-border);
4
10
  border-radius: var(--hl-radius-lg);
5
11
  background: var(--hl-surface);
6
12
  }
7
13
 
8
- details.hl-disclosure > summary {
14
+ details.hl-disclosure > summary, details[data-hl-disclosure] > summary {
9
15
  list-style: none;
10
16
  cursor: pointer;
11
17
  padding: var(--hl-space-3) var(--hl-space-4);
@@ -15,22 +21,41 @@
15
21
  display: none;
16
22
  }
17
23
 
24
+ details[data-hl-disclosure] > summary::-webkit-details-marker {
25
+ display: none;
26
+ }
27
+
18
28
  details.hl-disclosure > summary:focus-visible {
19
29
  outline: var(--hl-focus-ring);
20
30
  outline-offset: 2px;
21
31
  }
22
32
 
33
+ details[data-hl-disclosure] > summary:focus-visible {
34
+ outline: var(--hl-focus-ring);
35
+ outline-offset: 2px;
36
+ }
37
+
23
38
  details.hl-disclosure > summary::after {
24
39
  content: '\25B8';
25
40
  float: right;
26
41
  transition: transform var(--hl-duration-fast) var(--hl-ease-standard);
27
42
  }
28
43
 
44
+ details[data-hl-disclosure] > summary::after {
45
+ content: '\25B8';
46
+ float: right;
47
+ transition: transform var(--hl-duration-fast) var(--hl-ease-standard);
48
+ }
49
+
29
50
  details.hl-disclosure[open] > summary::after {
30
51
  transform: rotate(90deg);
31
52
  }
32
53
 
33
- details.hl-disclosure > .hl-disclosure-panel {
54
+ details[data-hl-disclosure][open] > summary::after {
55
+ transform: rotate(90deg);
56
+ }
57
+
58
+ details.hl-disclosure > .hl-disclosure-panel, details[data-hl-disclosure] > .hl-disclosure-panel {
34
59
  padding: var(--hl-space-3) var(--hl-space-4) var(--hl-space-4);
35
60
  }
36
61
  }