hydrateless 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/alert.css CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Alert — `<div class="hl-alert" role="alert" data-hl-intent="…">` with an
2
+ * Alert: `<div class="hl-alert" role="alert" data-hl-intent="…">` with an
3
3
  * optional icon, `.hl-alert-title`, and body content.
4
4
  * data-hl-intent: info (default) | success | warning | danger | neutral
5
5
  */
package/dist/avatar.css CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Avatar — `<span class="hl-avatar">` containing an `<img>` or fallback
2
+ * Avatar: `<span class="hl-avatar">` containing an `<img>` or fallback
3
3
  * initials/icon. Stack with `<div class="hl-avatar-group">`.
4
4
  * data-hl-size: xs | sm | md (default) | lg | xl
5
5
  * data-hl-shape: square
package/dist/badge.css CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Badge — `<span class="hl-badge" data-hl-intent="…" data-hl-variant="…">`.
2
+ * Badge: `<span class="hl-badge" data-hl-intent="…" data-hl-variant="…">`.
3
3
  * data-hl-intent: neutral (default) | primary | danger | success | warning | info
4
4
  * data-hl-variant: soft (default) | solid | outline
5
5
  * data-hl-size: sm | md (default)
package/dist/button.css CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Button — `<button class="hl-button">` (works on `<a>`/`<input>` too).
2
+ * Button: `<button class="hl-button">` (works on `<a>`/`<input>` too).
3
3
  *
4
4
  * Color is driven by a small set of local custom properties so the
5
5
  * intent × variant matrix stays DRY: `data-hl-intent` swaps the accent set,
package/dist/card.css CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Card — `<div class="hl-card">` with optional `.hl-card-header`,
2
+ * Card: `<div class="hl-card">` with optional `.hl-card-header`,
3
3
  * `.hl-card-body`, `.hl-card-footer`, `.hl-card-title`, `.hl-card-description`.
4
4
  * data-hl-interactive: hover/active elevation for clickable cards
5
5
  */
package/dist/checkbox.css CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Checkbox — `<label class="hl-checkbox"><input type="checkbox"><span>…</span></label>`.
2
+ * Checkbox: `<label class="hl-checkbox"><input type="checkbox"><span>…</span></label>`.
3
3
  * The native input is restyled (appearance:none) with a CSS checkmark, keeping
4
4
  * full keyboard + form semantics.
5
5
  */
package/dist/combobox.css CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Combobox — `<div data-hl-combobox>` wrapping an `<input>` and a
2
+ * Combobox: `<div data-hl-combobox>` wrapping an `<input>` and a
3
3
  * `<ul role="listbox">` of `<li role="option">`. The enhancer toggles the
4
4
  * listbox and manages `aria-activedescendant`.
5
5
  */
@@ -26,6 +26,24 @@
26
26
  box-shadow: var(--hl-overlay-shadow);
27
27
  }
28
28
 
29
+ /* Modern engines pin the listbox to the input via the anchor-name the
30
+ enhancer sets, so it escapes overflow-clipping ancestors. */
31
+ @supports (anchor-name: --x) {
32
+ [data-hl-combobox] [role='listbox'] {
33
+ position: fixed;
34
+ top: auto;
35
+ right: auto;
36
+ bottom: auto;
37
+ left: auto;
38
+ width: anchor-size(width);
39
+ inset-area: block-end;
40
+ position-area: block-end;
41
+ position-try-fallbacks: flip-block;
42
+ margin-top: var(--hl-space-1);
43
+ margin-bottom: var(--hl-space-1);
44
+ }
45
+ }
46
+
29
47
  [data-hl-combobox] [role='listbox'][hidden] {
30
48
  display: none;
31
49
  }
package/dist/command.css CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Command palette — `<div data-hl-command>` containing a search input
2
+ * Command palette: `<div data-hl-command>` containing a search input
3
3
  * (`[data-hl-command-input]`), an empty state (`[data-hl-command-empty]`), and a
4
4
  * `[data-hl-command-list] role="listbox"` of grouped `[role="option"]` items.
5
5
  * Often placed inside a `<dialog class="hl-modal">`.
@@ -35,55 +35,129 @@
35
35
  padding: var(--hl-space-3) var(--hl-space-4) var(--hl-space-4);
36
36
  }
37
37
  }
38
+ /**
39
+ * Tabs. Two markups are supported and styled together:
40
+ *
41
+ * - CSS-only baseline: `.hl-tablist` of `<label class="hl-tab">` wrapping a
42
+ * radio, then a `.hl-tabpanels` of `.hl-tabpanel`s. `:has(input:checked)`
43
+ * switches panels with no JavaScript (up to 8 tabs).
44
+ * - Enhanced: the enhancer adds `role="tab"`/`tabpanel`, roving focus, and
45
+ * `aria-selected`, toggles `[hidden]` on panels, and marks the root
46
+ * `data-hl-ready`, at which point the no-JS rules below stand down.
47
+ */
38
48
  @layer components {
39
49
  [data-hl-tabs] {
40
- border: 1px solid var(--hl-border);
50
+ border: var(--hl-border-width) solid var(--hl-border);
41
51
  border-radius: var(--hl-radius-lg);
42
52
  }
43
53
 
54
+ .hl-tablist,
44
55
  [data-hl-tabs] [role='tablist'] {
45
56
  display: flex;
46
57
  gap: var(--hl-space-2);
47
58
  padding: var(--hl-space-2);
48
- border-bottom: 1px solid var(--hl-border);
59
+ border-bottom: var(--hl-border-width) solid var(--hl-border);
49
60
  }
50
61
 
62
+ .hl-tab,
51
63
  [data-hl-tabs] [role='tab'] {
64
+ position: relative;
52
65
  -webkit-appearance: none;
53
66
  -moz-appearance: none;
54
67
  appearance: none;
68
+ display: inline-flex;
69
+ align-items: center;
55
70
  background: transparent;
56
71
  border: 0;
57
72
  border-radius: var(--hl-radius-sm);
58
73
  padding: var(--hl-space-2) var(--hl-space-3);
59
74
  color: inherit;
75
+ font: inherit;
76
+ cursor: pointer;
77
+ }
78
+
79
+ /* The baseline keeps selection in a visually hidden radio per tab label. */
80
+ .hl-tab > input[type='radio'] {
81
+ position: absolute;
82
+ top: 0;
83
+ right: 0;
84
+ bottom: 0;
85
+ left: 0;
86
+ margin: 0;
87
+ opacity: 0;
88
+ cursor: pointer;
60
89
  }
61
90
 
91
+ .hl-tab:has(input:checked),
62
92
  [data-hl-tabs] [role='tab'][aria-selected='true'] {
63
93
  background: var(--hl-surface-2);
64
94
  }
65
95
 
96
+ .hl-tab:has(input:focus-visible),
97
+ [data-hl-tabs] [role='tab']:focus-visible {
98
+ outline: var(--hl-focus-ring);
99
+ outline-offset: 2px;
100
+ }
101
+
102
+ .hl-tab:has(input:disabled),
66
103
  [data-hl-tabs] [role='tab'][disabled],
67
104
  [data-hl-tabs] [role='tab'][aria-disabled='true'] {
68
105
  opacity: 0.5;
69
106
  cursor: not-allowed;
70
107
  }
71
108
 
72
- [data-hl-tabs] [role='tab']:focus-visible {
73
- outline: var(--hl-focus-ring);
74
- outline-offset: 2px;
75
- }
76
-
109
+ .hl-tabpanel,
77
110
  [data-hl-tabs] [role='tabpanel'] {
78
111
  padding: var(--hl-space-4);
79
112
  }
80
113
 
114
+ .hl-tabpanel[hidden],
81
115
  [role='tabpanel'][hidden] {
82
116
  display: none;
83
117
  }
84
118
 
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. */
119
+ /* No-JS baseline: reveal the panel whose tab radio is checked, by position.
120
+ These stand down once the enhancer sets data-hl-ready and owns [hidden]. */
121
+ [data-hl-tabs]:not([data-hl-ready]) .hl-tabpanels > .hl-tabpanel {
122
+ display: none;
123
+ }
124
+
125
+ [data-hl-tabs]:not([data-hl-ready])
126
+ .hl-tablist:has(.hl-tab:nth-of-type(1) input:checked)
127
+ ~ .hl-tabpanels
128
+ > .hl-tabpanel:nth-of-type(1),
129
+ [data-hl-tabs]:not([data-hl-ready])
130
+ .hl-tablist:has(.hl-tab:nth-of-type(2) input:checked)
131
+ ~ .hl-tabpanels
132
+ > .hl-tabpanel:nth-of-type(2),
133
+ [data-hl-tabs]:not([data-hl-ready])
134
+ .hl-tablist:has(.hl-tab:nth-of-type(3) input:checked)
135
+ ~ .hl-tabpanels
136
+ > .hl-tabpanel:nth-of-type(3),
137
+ [data-hl-tabs]:not([data-hl-ready])
138
+ .hl-tablist:has(.hl-tab:nth-of-type(4) input:checked)
139
+ ~ .hl-tabpanels
140
+ > .hl-tabpanel:nth-of-type(4),
141
+ [data-hl-tabs]:not([data-hl-ready])
142
+ .hl-tablist:has(.hl-tab:nth-of-type(5) input:checked)
143
+ ~ .hl-tabpanels
144
+ > .hl-tabpanel:nth-of-type(5),
145
+ [data-hl-tabs]:not([data-hl-ready])
146
+ .hl-tablist:has(.hl-tab:nth-of-type(6) input:checked)
147
+ ~ .hl-tabpanels
148
+ > .hl-tabpanel:nth-of-type(6),
149
+ [data-hl-tabs]:not([data-hl-ready])
150
+ .hl-tablist:has(.hl-tab:nth-of-type(7) input:checked)
151
+ ~ .hl-tabpanels
152
+ > .hl-tabpanel:nth-of-type(7),
153
+ [data-hl-tabs]:not([data-hl-ready])
154
+ .hl-tablist:has(.hl-tab:nth-of-type(8) input:checked)
155
+ ~ .hl-tabpanels
156
+ > .hl-tabpanel:nth-of-type(8) {
157
+ display: block;
158
+ }
159
+
160
+ /* Role-only markup (no radios) before JS: degrade to showing the first panel. */
87
161
  [data-hl-tabs]:not([data-hl-ready]) [role='tabpanel'] ~ [role='tabpanel'] {
88
162
  display: none;
89
163
  }
@@ -216,7 +290,7 @@
216
290
  }
217
291
  }
218
292
  /**
219
- * Pagination — `<nav class="hl-pagination" aria-label="Pagination">` wrapping a
293
+ * Pagination: `<nav class="hl-pagination" aria-label="Pagination">` wrapping a
220
294
  * list of `.hl-pagination-item` links/buttons; mark the active page with
221
295
  * `aria-current="page"` and use `.hl-pagination-ellipsis` for gaps.
222
296
  */
@@ -286,7 +360,7 @@
286
360
  }
287
361
  }
288
362
  /**
289
- * Separator — `<hr class="hl-separator">` or
363
+ * Separator: `<hr class="hl-separator">` or
290
364
  * `<div class="hl-separator" role="separator" aria-orientation="vertical">`.
291
365
  */
292
366
  @layer components {
@@ -343,7 +417,7 @@
343
417
  border-top: 1px solid var(--hl-border);
344
418
  }
345
419
 
346
- .hl-modal [data-hl-modal-close]:focus-visible {
420
+ .hl-modal [command='close']:focus-visible {
347
421
  outline: var(--hl-focus-ring);
348
422
  outline-offset: 2px;
349
423
  }
@@ -428,10 +502,20 @@
428
502
  border-top: 1px solid var(--hl-border);
429
503
  }
430
504
  }
505
+ /**
506
+ * Popover: a `[popover] [data-hl-popover]` surface opened by a
507
+ * `<button popovertarget="…">` (or `command="toggle-popover"`). The browser
508
+ * owns the top layer, light-dismiss, and Escape with no JavaScript; the
509
+ * enhancer only mirrors `aria-expanded`, adds optional hover, and runs the JS
510
+ * positioning fallback on engines without CSS anchor positioning.
511
+ */
431
512
  @layer components {
432
- [popover],
433
513
  [data-hl-popover] {
434
- border: 1px solid var(--hl-border);
514
+ margin: 0;
515
+ width: -moz-max-content;
516
+ width: max-content;
517
+ max-width: min(92vw, 22rem);
518
+ border: var(--hl-border-width) solid var(--hl-border);
435
519
  border-radius: var(--hl-radius-lg);
436
520
  padding: var(--hl-space-3);
437
521
  background: var(--hl-surface);
@@ -439,64 +523,123 @@
439
523
  box-shadow: var(--hl-overlay-shadow);
440
524
  }
441
525
 
526
+ /* Until the `popover` attribute is present (author omitted it and JS hasn't
527
+ upgraded the element yet), keep the surface out of the flow. */
442
528
  [data-hl-popover]:not([popover]) {
529
+ display: none;
530
+ }
531
+
532
+ /* Engines without the Popover API can't promote it to the top layer, so the
533
+ JS fallback positions it; give it a stacking context to land above content. */
534
+ [data-hl-popover]:not(:popover-open) {
443
535
  z-index: var(--hl-z-popover);
444
536
  }
445
537
 
446
- [data-hl-popover][hidden] {
447
- display: none;
538
+ /* Modern placement: anchor to the invoking control (the popover's implicit
539
+ anchor) and flip when there isn't room. Older engines use the JS fallback,
540
+ which writes inline position/inset and wins over these rules. */
541
+ @supports (position-area: block-end) {
542
+ [data-hl-popover] {
543
+ position: fixed;
544
+ inset-area: block-end;
545
+ position-area: block-end;
546
+ position-try-fallbacks: flip-block, flip-inline;
547
+ margin-top: var(--hl-space-1);
548
+ margin-bottom: var(--hl-space-1);
549
+ }
448
550
  }
449
551
  }
552
+ /**
553
+ * Tooltip: a `[role="tooltip"]` element described by a `[data-hl-tooltip]`
554
+ * trigger. With no JavaScript it shows on the trigger's `:hover`/`:focus-visible`
555
+ * (the tip must be the trigger's next sibling). When the enhancer runs it marks
556
+ * the trigger `data-hl-tooltip-managed` and drives visibility through
557
+ * `data-hl-tooltip-open` instead, adding show/hide delays, a grace period, and
558
+ * Escape-to-dismiss.
559
+ */
450
560
  @layer components {
451
561
  [role='tooltip'] {
562
+ /* Fallback placement: the JS positioner writes inline position/inset on
563
+ engines without CSS anchor positioning. */
452
564
  position: absolute;
453
565
  z-index: var(--hl-z-tooltip);
454
- top: auto;
455
- right: auto;
456
- bottom: auto;
457
- left: 0;
458
- translate: 0 -0.25rem;
566
+ width: -moz-max-content;
567
+ width: max-content;
568
+ max-width: 32ch;
569
+ margin: 0;
459
570
  padding: var(--hl-space-1) var(--hl-space-2);
460
571
  border-radius: var(--hl-radius-sm);
461
572
  background: var(--hl-fg);
462
573
  color: var(--hl-surface);
463
574
  font-size: var(--hl-text-sm);
464
- max-width: 32ch;
465
- width: -moz-max-content;
466
- width: max-content;
467
575
  }
468
576
 
469
577
  [role='tooltip'][hidden] {
470
578
  display: none;
471
579
  }
580
+
581
+ /* No-JS baseline: reveal while the adjacent trigger is hovered or focused.
582
+ Suppressed once the enhancer takes over (trigger gains -managed). */
583
+ [data-hl-tooltip]:not([data-hl-tooltip-managed]):hover + [role='tooltip'],
584
+ [data-hl-tooltip]:not([data-hl-tooltip-managed]):focus-visible + [role='tooltip'] {
585
+ display: block;
586
+ }
587
+
588
+ /* Modern placement: pin above the trigger via the anchor-name the enhancer
589
+ sets, flipping below when there's no room. */
590
+ @supports (anchor-name: --x) {
591
+ [role='tooltip'] {
592
+ position: fixed;
593
+ inset-area: block-start;
594
+ position-area: block-start;
595
+ position-try-fallbacks: flip-block;
596
+ margin-top: var(--hl-space-1);
597
+ margin-bottom: var(--hl-space-1);
598
+ }
599
+ }
472
600
  }
601
+ /**
602
+ * Dropdown menu button: `<div data-hl-dropdown>` wrapping a
603
+ * `[data-hl-dropdown-trigger]` button and a `[data-hl-dropdown-menu]` list. The
604
+ * enhancer turns the menu into a native `popover` the trigger controls through
605
+ * `popovertarget`, so opening, Escape, and light-dismiss need no JavaScript;
606
+ * the menu lives in the top layer and is placed with CSS anchor positioning.
607
+ */
473
608
  @layer components {
474
609
  [data-hl-dropdown] {
475
- position: relative;
476
610
  display: inline-block;
477
611
  }
478
612
 
479
613
  [data-hl-dropdown-menu] {
480
- position: absolute;
481
- z-index: var(--hl-z-dropdown);
614
+ margin: 0;
482
615
  min-width: 10rem;
483
- border: 1px solid var(--hl-border);
616
+ border: var(--hl-border-width) solid var(--hl-border);
484
617
  border-radius: var(--hl-radius-lg);
485
618
  background: var(--hl-surface);
486
619
  box-shadow: var(--hl-overlay-shadow);
487
620
  padding: var(--hl-space-1);
488
621
  list-style: none;
489
- margin: var(--hl-space-1) 0 0;
490
622
  }
491
623
 
492
- [data-hl-dropdown-menu][hidden] {
624
+ /* Before the menu is promoted to a popover (JS not yet loaded), hide it. */
625
+ [data-hl-dropdown-menu]:not([popover]) {
493
626
  display: none;
494
627
  }
495
628
 
496
- [data-hl-dropdown-menu][data-hl-side='top'] {
497
- top: auto;
498
- bottom: 100%;
499
- margin: 0 0 var(--hl-space-1);
629
+ [data-hl-dropdown-menu]:not(:popover-open) {
630
+ z-index: var(--hl-z-dropdown);
631
+ }
632
+
633
+ /* Open below the trigger, start-aligned, flipping when cramped. */
634
+ @supports (position-area: block-end) {
635
+ [data-hl-dropdown-menu] {
636
+ position: fixed;
637
+ inset-area: block-end span-inline-end;
638
+ position-area: block-end span-inline-end;
639
+ position-try-fallbacks: flip-block, flip-inline;
640
+ margin-top: var(--hl-space-1);
641
+ margin-bottom: var(--hl-space-1);
642
+ }
500
643
  }
501
644
 
502
645
  [data-hl-dropdown-menu] [role='menuitem'] {
@@ -530,7 +673,7 @@
530
673
  }
531
674
  }
532
675
  /**
533
- * Menubar / navigation menu — `<ul data-hl-menu role="menubar">` with optional
676
+ * Menubar / navigation menu: `<ul data-hl-menu role="menubar">` with optional
534
677
  * single-level submenus (`<ul role="menu" data-hl-menu-submenu>`). The enhancer
535
678
  * handles roving focus, arrow navigation, and open/close.
536
679
  */
@@ -712,7 +855,7 @@
712
855
  }
713
856
  }
714
857
  /**
715
- * Command palette — `<div data-hl-command>` containing a search input
858
+ * Command palette: `<div data-hl-command>` containing a search input
716
859
  * (`[data-hl-command-input]`), an empty state (`[data-hl-command-empty]`), and a
717
860
  * `[data-hl-command-list] role="listbox"` of grouped `[role="option"]` items.
718
861
  * Often placed inside a `<dialog class="hl-modal">`.
@@ -815,7 +958,7 @@
815
958
  }
816
959
  /* Forms */
817
960
  /**
818
- * Button — `<button class="hl-button">` (works on `<a>`/`<input>` too).
961
+ * Button: `<button class="hl-button">` (works on `<a>`/`<input>` too).
819
962
  *
820
963
  * Color is driven by a small set of local custom properties so the
821
964
  * intent × variant matrix stays DRY: `data-hl-intent` swaps the accent set,
@@ -1070,7 +1213,7 @@
1070
1213
  }
1071
1214
  }
1072
1215
  /**
1073
- * Text input — `<input class="hl-input">`.
1216
+ * Text input: `<input class="hl-input">`.
1074
1217
  * data-hl-size: sm | md (default) | lg
1075
1218
  * data-hl-invalid: error styling (pair with aria-invalid)
1076
1219
  */
@@ -1156,7 +1299,7 @@
1156
1299
  }
1157
1300
  }
1158
1301
  /**
1159
- * Multi-line text input — `<textarea class="hl-textarea">`.
1302
+ * Multi-line text input: `<textarea class="hl-textarea">`.
1160
1303
  * data-hl-invalid: error styling (pair with aria-invalid)
1161
1304
  */
1162
1305
  @layer components {
@@ -1213,7 +1356,7 @@
1213
1356
  }
1214
1357
  }
1215
1358
  /**
1216
- * Native select — `<span class="hl-select-wrapper"><select class="hl-select">`.
1359
+ * Native select: `<span class="hl-select-wrapper"><select class="hl-select">`.
1217
1360
  * The wrapper draws a custom caret while the native control keeps full
1218
1361
  * keyboard/mobile behavior.
1219
1362
  * data-hl-size: sm | md (default) | lg
@@ -1298,7 +1441,7 @@
1298
1441
  }
1299
1442
  }
1300
1443
  /**
1301
- * Checkbox — `<label class="hl-checkbox"><input type="checkbox"><span>…</span></label>`.
1444
+ * Checkbox: `<label class="hl-checkbox"><input type="checkbox"><span>…</span></label>`.
1302
1445
  * The native input is restyled (appearance:none) with a CSS checkmark, keeping
1303
1446
  * full keyboard + form semantics.
1304
1447
  */
@@ -1377,7 +1520,7 @@
1377
1520
  }
1378
1521
  }
1379
1522
  /**
1380
- * Radio — `<label class="hl-radio"><input type="radio"><span>…</span></label>`,
1523
+ * Radio: `<label class="hl-radio"><input type="radio"><span>…</span></label>`,
1381
1524
  * grouped in `<div class="hl-radio-group" role="radiogroup">`.
1382
1525
  */
1383
1526
  @layer components {
@@ -1511,7 +1654,7 @@
1511
1654
  }
1512
1655
  }
1513
1656
  /**
1514
- * Field — accessible form-control layout: `.hl-field` stacks a `.hl-label`,
1657
+ * Field, accessible form-control layout: `.hl-field` stacks a `.hl-label`,
1515
1658
  * the control, `.hl-help`, and `.hl-error`. `.hl-fieldset` + `.hl-legend`
1516
1659
  * group related fields.
1517
1660
  */
@@ -1570,7 +1713,7 @@
1570
1713
  }
1571
1714
  }
1572
1715
  /**
1573
- * Combobox — `<div data-hl-combobox>` wrapping an `<input>` and a
1716
+ * Combobox: `<div data-hl-combobox>` wrapping an `<input>` and a
1574
1717
  * `<ul role="listbox">` of `<li role="option">`. The enhancer toggles the
1575
1718
  * listbox and manages `aria-activedescendant`.
1576
1719
  */
@@ -1597,6 +1740,24 @@
1597
1740
  box-shadow: var(--hl-overlay-shadow);
1598
1741
  }
1599
1742
 
1743
+ /* Modern engines pin the listbox to the input via the anchor-name the
1744
+ enhancer sets, so it escapes overflow-clipping ancestors. */
1745
+ @supports (anchor-name: --x) {
1746
+ [data-hl-combobox] [role='listbox'] {
1747
+ position: fixed;
1748
+ top: auto;
1749
+ right: auto;
1750
+ bottom: auto;
1751
+ left: auto;
1752
+ width: anchor-size(width);
1753
+ inset-area: block-end;
1754
+ position-area: block-end;
1755
+ position-try-fallbacks: flip-block;
1756
+ margin-top: var(--hl-space-1);
1757
+ margin-bottom: var(--hl-space-1);
1758
+ }
1759
+ }
1760
+
1600
1761
  [data-hl-combobox] [role='listbox'][hidden] {
1601
1762
  display: none;
1602
1763
  }
@@ -1628,7 +1789,7 @@
1628
1789
  }
1629
1790
  }
1630
1791
  /**
1631
- * Segmented control — `<div class="hl-segmented" role="radiogroup">` of
1792
+ * Segmented control: `<div class="hl-segmented" role="radiogroup">` of
1632
1793
  * `<label class="hl-segmented-item"><input type="radio">…</label>` segments.
1633
1794
  * Radio inputs give free keyboard navigation; the checked segment is raised.
1634
1795
  * A button variant using `aria-pressed="true"` is also supported.
@@ -1713,7 +1874,7 @@
1713
1874
  }
1714
1875
  }
1715
1876
  /**
1716
- * Slider — native `<input type="range" class="hl-slider">`. Restyled track and
1877
+ * Slider: native `<input type="range" class="hl-slider">`. Restyled track and
1717
1878
  * thumb across WebKit/Blink and Firefox while keeping native keyboard support.
1718
1879
  */
1719
1880
  @layer components {
@@ -1798,7 +1959,7 @@
1798
1959
  }
1799
1960
  /* Feedback & data display */
1800
1961
  /**
1801
- * Alert — `<div class="hl-alert" role="alert" data-hl-intent="…">` with an
1962
+ * Alert: `<div class="hl-alert" role="alert" data-hl-intent="…">` with an
1802
1963
  * optional icon, `.hl-alert-title`, and body content.
1803
1964
  * data-hl-intent: info (default) | success | warning | danger | neutral
1804
1965
  */
@@ -1870,7 +2031,7 @@
1870
2031
  }
1871
2032
  }
1872
2033
  /**
1873
- * Badge — `<span class="hl-badge" data-hl-intent="…" data-hl-variant="…">`.
2034
+ * Badge: `<span class="hl-badge" data-hl-intent="…" data-hl-variant="…">`.
1874
2035
  * data-hl-intent: neutral (default) | primary | danger | success | warning | info
1875
2036
  * data-hl-variant: soft (default) | solid | outline
1876
2037
  * data-hl-size: sm | md (default)
@@ -1954,7 +2115,7 @@
1954
2115
  }
1955
2116
  }
1956
2117
  /**
1957
- * Card — `<div class="hl-card">` with optional `.hl-card-header`,
2118
+ * Card: `<div class="hl-card">` with optional `.hl-card-header`,
1958
2119
  * `.hl-card-body`, `.hl-card-footer`, `.hl-card-title`, `.hl-card-description`.
1959
2120
  * data-hl-interactive: hover/active elevation for clickable cards
1960
2121
  */
@@ -2025,7 +2186,7 @@
2025
2186
  }
2026
2187
  }
2027
2188
  /**
2028
- * Avatar — `<span class="hl-avatar">` containing an `<img>` or fallback
2189
+ * Avatar: `<span class="hl-avatar">` containing an `<img>` or fallback
2029
2190
  * initials/icon. Stack with `<div class="hl-avatar-group">`.
2030
2191
  * data-hl-size: xs | sm | md (default) | lg | xl
2031
2192
  * data-hl-shape: square
@@ -2099,7 +2260,7 @@
2099
2260
  }
2100
2261
  }
2101
2262
  /**
2102
- * Progress — native `<progress class="hl-progress" value max>`. Omit `value`
2263
+ * Progress: native `<progress class="hl-progress" value max>`. Omit `value`
2103
2264
  * for an indeterminate bar.
2104
2265
  * data-hl-intent: primary (default) | success | warning | danger | info
2105
2266
  * data-hl-size: sm | md (default) | lg
@@ -2193,7 +2354,7 @@
2193
2354
  }
2194
2355
  }
2195
2356
  /**
2196
- * Spinner — `<span class="hl-spinner" role="status" aria-label="Loading">`.
2357
+ * Spinner: `<span class="hl-spinner" role="status" aria-label="Loading">`.
2197
2358
  * Inherits `currentColor`, so set `color` to theme it.
2198
2359
  * data-hl-size: sm | md (default) | lg | xl
2199
2360
  */
@@ -2247,7 +2408,7 @@
2247
2408
  }
2248
2409
  }
2249
2410
  /**
2250
- * Skeleton — `<span class="hl-skeleton" data-hl-variant="…" aria-hidden="true">`
2411
+ * Skeleton: `<span class="hl-skeleton" data-hl-variant="…" aria-hidden="true">`
2251
2412
  * placeholder shown while content loads.
2252
2413
  * data-hl-variant: rect (default) | text | circle
2253
2414
  */
@@ -2296,7 +2457,7 @@
2296
2457
  }
2297
2458
  }
2298
2459
  /**
2299
- * Keyboard key — `<kbd class="hl-kbd">⌘</kbd>`. Combine inline, e.g.
2460
+ * Keyboard key: `<kbd class="hl-kbd">⌘</kbd>`. Combine inline, e.g.
2300
2461
  * `<kbd class="hl-kbd">⌘</kbd><kbd class="hl-kbd">K</kbd>`.
2301
2462
  */
2302
2463
  @layer components {
@@ -2318,7 +2479,7 @@
2318
2479
  }
2319
2480
  }
2320
2481
  /**
2321
- * Table — `<table class="hl-table">`. Semantic table styling with optional
2482
+ * Table: `<table class="hl-table">`. Semantic table styling with optional
2322
2483
  * zebra striping and hover.
2323
2484
  * data-hl-striped: zebra rows
2324
2485
  * data-hl-hover: highlight row on hover
package/dist/dropdown.css CHANGED
@@ -1,30 +1,45 @@
1
+ /**
2
+ * Dropdown menu button: `<div data-hl-dropdown>` wrapping a
3
+ * `[data-hl-dropdown-trigger]` button and a `[data-hl-dropdown-menu]` list. The
4
+ * enhancer turns the menu into a native `popover` the trigger controls through
5
+ * `popovertarget`, so opening, Escape, and light-dismiss need no JavaScript;
6
+ * the menu lives in the top layer and is placed with CSS anchor positioning.
7
+ */
1
8
  @layer components {
2
9
  [data-hl-dropdown] {
3
- position: relative;
4
10
  display: inline-block;
5
11
  }
6
12
 
7
13
  [data-hl-dropdown-menu] {
8
- position: absolute;
9
- z-index: var(--hl-z-dropdown);
14
+ margin: 0;
10
15
  min-width: 10rem;
11
- border: 1px solid var(--hl-border);
16
+ border: var(--hl-border-width) solid var(--hl-border);
12
17
  border-radius: var(--hl-radius-lg);
13
18
  background: var(--hl-surface);
14
19
  box-shadow: var(--hl-overlay-shadow);
15
20
  padding: var(--hl-space-1);
16
21
  list-style: none;
17
- margin: var(--hl-space-1) 0 0;
18
22
  }
19
23
 
20
- [data-hl-dropdown-menu][hidden] {
24
+ /* Before the menu is promoted to a popover (JS not yet loaded), hide it. */
25
+ [data-hl-dropdown-menu]:not([popover]) {
21
26
  display: none;
22
27
  }
23
28
 
24
- [data-hl-dropdown-menu][data-hl-side='top'] {
25
- top: auto;
26
- bottom: 100%;
27
- margin: 0 0 var(--hl-space-1);
29
+ [data-hl-dropdown-menu]:not(:popover-open) {
30
+ z-index: var(--hl-z-dropdown);
31
+ }
32
+
33
+ /* Open below the trigger, start-aligned, flipping when cramped. */
34
+ @supports (position-area: block-end) {
35
+ [data-hl-dropdown-menu] {
36
+ position: fixed;
37
+ inset-area: block-end span-inline-end;
38
+ position-area: block-end span-inline-end;
39
+ position-try-fallbacks: flip-block, flip-inline;
40
+ margin-top: var(--hl-space-1);
41
+ margin-bottom: var(--hl-space-1);
42
+ }
28
43
  }
29
44
 
30
45
  [data-hl-dropdown-menu] [role='menuitem'] {