hydrateless 0.9.0 → 0.10.1

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.
@@ -74,6 +74,7 @@
74
74
  */
75
75
  @layer components {
76
76
  [data-hl-tabs] {
77
+ min-inline-size: 0;
77
78
  border: var(--hl-border-width) solid var(--hl-border);
78
79
  border-radius: var(--hl-radius-lg);
79
80
  }
@@ -81,6 +82,7 @@
81
82
  .hl-tablist,
82
83
  [data-hl-tabs] [role='tablist'] {
83
84
  display: flex;
85
+ overflow-x: auto;
84
86
  gap: var(--hl-space-2);
85
87
  padding: var(--hl-space-2);
86
88
  border-block-end: var(--hl-border-width) solid var(--hl-border);
@@ -101,6 +103,7 @@
101
103
  position: relative;
102
104
  appearance: none;
103
105
  display: inline-flex;
106
+ flex: none;
104
107
  align-items: center;
105
108
  background: transparent;
106
109
  border: 0;
@@ -270,7 +273,7 @@
270
273
  * links. With no JavaScript it is a plain link list; the enhancer marks the
271
274
  * link for the heading in view with `aria-current="true"`.
272
275
  * data-hl-toc: the nav
273
- * data-hl-toc-content: optional element whose headings are observed
276
+ * data-hl-content-selector: optional element whose headings are observed
274
277
  */
275
278
  @layer components {
276
279
  nav[data-hl-toc] {
@@ -485,6 +488,9 @@
485
488
  :is(.hl-modal, dialog[data-hl-modal]) {
486
489
  inline-size: min(90vi, var(--hl-modal-inline-size));
487
490
  max-inline-size: none;
491
+
492
+ /* The reset clears the UA's auto margin; restore native dialog centering. */
493
+ margin: auto;
488
494
  padding: 0;
489
495
  border: none;
490
496
  border-radius: var(--hl-radius-lg);
@@ -744,12 +750,16 @@
744
750
  * `hidden`), and drives visibility through `data-hl-tooltip-open` with show
745
751
  * and hide delays, a grace period, and Escape to dismiss.
746
752
  * data-hl-tooltip: the trigger
747
- * data-hl-placement: top (default) | bottom | left | right, on the trigger
753
+ * data-hl-placement: top (default) | bottom | start | end, on the trigger
754
+ * data-hl-side: the resolved side, set on the tip by the enhancer
748
755
  * data-hl-tooltip-managed: set on the trigger by the enhancer
749
756
  * data-hl-tooltip-open: set on the tip while shown
750
757
  */
751
758
  @layer components {
752
759
  [role='tooltip'] {
760
+ /* Closed baseline tips must not intercept input or remain exposed to AT. */
761
+ display: none;
762
+
753
763
  /* Fallback placement: the JS positioner writes inline position/inset on
754
764
  engines without CSS anchor positioning. */
755
765
  position: absolute;
@@ -793,16 +803,51 @@
793
803
  }
794
804
  }
795
805
 
796
- /* Modern placement: pin above the trigger via the anchor-name the enhancer
797
- sets, flipping below when there's no room. */
806
+ /* Modern placement: pin to the requested side of the trigger via the
807
+ anchor-name the enhancer sets, flipping when there's no room. The side
808
+ comes from `data-hl-side` on the tip (enhanced) or `data-hl-placement` on
809
+ the preceding trigger (no-JS baseline). */
798
810
  @supports (anchor-name: --x) {
811
+ :has(> [data-hl-tooltip]) {
812
+ anchor-scope: --hl-tooltip-trigger;
813
+ }
814
+
815
+ [data-hl-tooltip] {
816
+ anchor-name: --hl-tooltip-trigger;
817
+ }
818
+
799
819
  [role='tooltip'] {
820
+ position-anchor: --hl-tooltip-trigger;
800
821
  position: fixed;
801
822
  inset: auto;
802
823
  position-area: block-start;
803
824
  position-try-fallbacks: flip-block;
804
825
  margin-block: var(--hl-space-1);
805
826
  }
827
+
828
+ [role='tooltip'][data-hl-side='bottom'],
829
+ [data-hl-tooltip][data-hl-placement^='bottom'] + [role='tooltip'] {
830
+ position-area: block-end;
831
+ }
832
+
833
+ [role='tooltip']:is([data-hl-side='start'], [data-hl-side='end']),
834
+ [data-hl-tooltip]:is([data-hl-placement^='start'], [data-hl-placement^='end'])
835
+ + [role='tooltip'] {
836
+ position-try-fallbacks: flip-inline;
837
+ margin-block: 0;
838
+ margin-inline: var(--hl-space-1);
839
+ translate: 0 0;
840
+ }
841
+
842
+ [role='tooltip'][data-hl-side='start'],
843
+ [data-hl-tooltip][data-hl-placement^='start'] + [role='tooltip'] {
844
+ position-area: inline-start;
845
+ }
846
+
847
+ [role='tooltip'][data-hl-side='end'],
848
+ [data-hl-tooltip][data-hl-placement^='end'] + [role='tooltip'] {
849
+ position-area: inline-end;
850
+ }
806
851
  }
807
852
 
808
853
  /* Inverted colors flatten away; keep a visible edge on the system canvas. */
@@ -825,7 +870,9 @@
825
870
  * data-hl-dropdown-menu: the `<ul>` (or any list) of items
826
871
  * data-hl-value: an item's value for `hl:select`
827
872
  * Items are `role="menuitem"`, `menuitemcheckbox`, or `menuitemradio`, either
828
- * directly in the list, inside `<li>`, or inside `<li><ul role="group">`.
873
+ * directly in the list, inside `<li>`, or inside `<li><ul role="group">`. An
874
+ * item followed by a sibling `<ul role="menu">` (or `[data-hl-submenu]`) opens
875
+ * it as a nested submenu to the inline-end side.
829
876
  */
830
877
  @layer components {
831
878
  [data-hl-dropdown] {
@@ -879,6 +926,60 @@
879
926
  list-style: none;
880
927
  }
881
928
 
929
+ /* Nested submenus share the panel styling and sit beside their trigger. */
930
+ [data-hl-dropdown-menu] li {
931
+ position: relative;
932
+ }
933
+
934
+ [data-hl-dropdown-menu] :is([role='menu'], [data-hl-submenu]) {
935
+ position: absolute;
936
+ inset-block-start: 0;
937
+ inset-inline-start: calc(100% + var(--hl-space-1));
938
+ z-index: var(--hl-z-dropdown);
939
+ min-inline-size: 10rem;
940
+ margin: 0;
941
+ padding: var(--hl-space-1);
942
+ list-style: none;
943
+ border: var(--hl-border-width) solid var(--hl-border);
944
+ border-radius: var(--hl-radius-lg);
945
+ background: var(--hl-surface);
946
+ box-shadow: var(--hl-overlay-shadow);
947
+ }
948
+
949
+ [data-hl-dropdown-menu]
950
+ :is([role='menu'], [data-hl-submenu]):is([hidden], [popover]:not(:popover-open)) {
951
+ display: none;
952
+ }
953
+
954
+ [data-hl-dropdown-menu] :is([role='menu'], [data-hl-submenu])[popover] {
955
+ position: fixed;
956
+ inset: auto;
957
+ }
958
+
959
+ @supports (position-area: block-end) {
960
+ [data-hl-dropdown-menu] :is([role='menu'], [data-hl-submenu])[popover] {
961
+ position-area: inline-end span-block-end;
962
+ position-try-fallbacks: flip-inline, flip-block;
963
+ margin-inline: var(--hl-space-1);
964
+ }
965
+ }
966
+
967
+ /* Submenu chevron: a rotated square corner at the inline end. */
968
+ [data-hl-dropdown-menu] [role^='menuitem'][aria-haspopup='menu']::after {
969
+ content: '';
970
+ inline-size: 0.4rem;
971
+ block-size: 0.4rem;
972
+ margin-inline-start: auto;
973
+ border-inline-end: 1.5px solid currentcolor;
974
+ border-block-end: 1.5px solid currentcolor;
975
+ rotate: -45deg;
976
+ opacity: 0.6;
977
+ }
978
+
979
+ [data-hl-dropdown-menu] [role^='menuitem'][aria-expanded='true'] {
980
+ background: var(--hl-surface-2);
981
+ }
982
+
882
983
  [data-hl-dropdown-menu] [role^='menuitem'] {
883
984
  display: flex;
884
985
  align-items: center;
@@ -948,8 +1049,10 @@
948
1049
  }
949
1050
  /**
950
1051
  * Menubar / navigation menu: `<ul data-hl-menu role="menubar">` of `<li>`
951
- * items, each optionally holding a trigger and a single-level submenu
952
- * (`<ul role="menu">` or `[data-hl-menu-submenu]`) as siblings inside the `<li>`.
1052
+ * items, each optionally holding a trigger and a submenu (`<ul role="menu">`
1053
+ * or `[data-hl-submenu]`) as siblings inside the `<li>`. Submenus nest: an
1054
+ * item inside a submenu may itself be followed by a submenu, which opens to
1055
+ * its inline-end side.
953
1056
  *
954
1057
  * No-JS baseline: a submenu shows while its `<li>` is hovered or has focus
955
1058
  * within it, so every link stays reachable by mouse and keyboard. The enhancer
@@ -957,7 +1060,7 @@
957
1060
  * plus a top-layer `popover`) and adds roving focus, arrow keys, typeahead,
958
1061
  * and checkable items. It reads:
959
1062
  * data-hl-menu: root; `aria-orientation="vertical"` stacks it
960
- * data-hl-menu-submenu: a submenu without `role="menu"`
1063
+ * data-hl-submenu: a submenu without `role="menu"`
961
1064
  * data-hl-value: a top-level trigger's value for `hl:change`
962
1065
  * data-hl-ready: set by the enhancer
963
1066
  */
@@ -1026,7 +1129,13 @@
1026
1129
  opacity: 0.6;
1027
1130
  }
1028
1131
 
1029
- [data-hl-menu] :is([role='menu'], [data-hl-menu-submenu]) {
1132
+ /* Submenus that open to the side point their chevron that way. */
1133
+ [data-hl-menu][aria-orientation='vertical'] [role^='menuitem'][aria-haspopup]::after,
1134
+ [data-hl-menu] :is([role='menu'], [data-hl-submenu]) [role^='menuitem'][aria-haspopup]::after {
1135
+ rotate: -45deg;
1136
+ }
1137
+
1138
+ [data-hl-menu] :is([role='menu'], [data-hl-submenu]) {
1030
1139
  position: absolute;
1031
1140
  inset-block-start: calc(100% + var(--hl-space-1));
1032
1141
  inset-inline-start: 0;
@@ -1046,17 +1155,22 @@
1046
1155
  overlay var(--hl-duration-fast) allow-discrete;
1047
1156
  }
1048
1157
 
1049
- [data-hl-menu][aria-orientation='vertical'] :is([role='menu'], [data-hl-menu-submenu]) {
1158
+ /* Vertical menubars and every nested level open to the inline-end side. */
1159
+ [data-hl-menu][aria-orientation='vertical'] :is([role='menu'], [data-hl-submenu]),
1160
+ [data-hl-menu] :is([role='menu'], [data-hl-submenu]) :is([role='menu'], [data-hl-submenu]) {
1050
1161
  inset-block-start: 0;
1051
1162
  inset-inline-start: calc(100% + var(--hl-space-1));
1052
1163
  }
1053
1164
 
1165
+ [data-hl-menu] :is([role='menu'], [data-hl-submenu]) li {
1166
+ position: relative;
1167
+ }
1168
+
1054
1169
  /* Closed states: `hidden` (enhancer without Popover API), a closed popover
1055
1170
  (enhancer with it), and the no-JS baseline below. Each is also the exit
1056
1171
  target of the transition. */
1057
- [data-hl-menu]
1058
- :is([role='menu'], [data-hl-menu-submenu]):is([hidden], [popover]:not(:popover-open)),
1059
- [data-hl-menu]:not([data-hl-ready]) :is([role='menu'], [data-hl-menu-submenu]) {
1172
+ [data-hl-menu] :is([role='menu'], [data-hl-submenu]):is([hidden], [popover]:not(:popover-open)),
1173
+ [data-hl-menu]:not([data-hl-ready]) :is([role='menu'], [data-hl-submenu]) {
1060
1174
  display: none;
1061
1175
  opacity: 0;
1062
1176
  translate: 0 -0.25rem;
@@ -1065,14 +1179,14 @@
1065
1179
  /* No-JS baseline: reveal on hover or focus within the parent item. */
1066
1180
  [data-hl-menu]:not([data-hl-ready])
1067
1181
  li:is(:hover, :focus-within)
1068
- > :is([role='menu'], [data-hl-menu-submenu]) {
1182
+ > :is([role='menu'], [data-hl-submenu]) {
1069
1183
  display: block;
1070
1184
  opacity: 1;
1071
1185
  translate: 0 0;
1072
1186
  }
1073
1187
 
1074
1188
  @starting-style {
1075
- [data-hl-menu] :is([role='menu'], [data-hl-menu-submenu]) {
1189
+ [data-hl-menu] :is([role='menu'], [data-hl-submenu]) {
1076
1190
  opacity: 0;
1077
1191
  translate: 0 -0.25rem;
1078
1192
  }
@@ -1081,20 +1195,22 @@
1081
1195
  /* Enhanced path: the submenu is a native popover in the top layer, anchored
1082
1196
  to its trigger. The absolute-position rules above stay as the fallback for
1083
1197
  engines without the Popover API. */
1084
- [data-hl-menu] :is([role='menu'], [data-hl-menu-submenu])[popover] {
1198
+ [data-hl-menu] :is([role='menu'], [data-hl-submenu])[popover] {
1085
1199
  position: fixed;
1086
1200
  inset: auto;
1087
1201
  }
1088
1202
 
1089
1203
  @supports (position-area: block-end) {
1090
- [data-hl-menu] :is([role='menu'], [data-hl-menu-submenu])[popover] {
1204
+ [data-hl-menu] :is([role='menu'], [data-hl-submenu])[popover] {
1091
1205
  position-area: block-end span-inline-end;
1092
1206
  position-try-fallbacks: flip-block, flip-inline;
1093
1207
  margin-block: var(--hl-space-1);
1094
1208
  }
1095
1209
 
1096
- [data-hl-menu][aria-orientation='vertical']
1097
- :is([role='menu'], [data-hl-menu-submenu])[popover] {
1210
+ [data-hl-menu][aria-orientation='vertical'] :is([role='menu'], [data-hl-submenu])[popover],
1211
+ [data-hl-menu]
1212
+ :is([role='menu'], [data-hl-submenu])
1213
+ :is([role='menu'], [data-hl-submenu])[popover] {
1098
1214
  position-area: inline-end span-block-end;
1099
1215
  position-try-fallbacks: flip-inline, flip-block;
1100
1216
  margin-block: 0;
@@ -1278,7 +1394,7 @@
1278
1394
  font-weight: var(--hl-font-semibold);
1279
1395
  text-transform: uppercase;
1280
1396
  letter-spacing: 0.04em;
1281
- color: var(--hl-fg-subtle);
1397
+ color: var(--hl-fg-muted);
1282
1398
  }
1283
1399
 
1284
1400
  [data-hl-command] [role='option'] {
@@ -1475,7 +1591,7 @@
1475
1591
 
1476
1592
  .hl-button[data-hl-variant='outline'] {
1477
1593
  background: transparent;
1478
- color: var(--_accent);
1594
+ color: var(--_soft-fg);
1479
1595
  border-color: var(--hl-border-strong);
1480
1596
  }
1481
1597
 
@@ -1486,7 +1602,7 @@
1486
1602
 
1487
1603
  .hl-button[data-hl-variant='ghost'] {
1488
1604
  background: transparent;
1489
- color: var(--_accent);
1605
+ color: var(--_soft-fg);
1490
1606
  }
1491
1607
 
1492
1608
  .hl-button[data-hl-variant='ghost']:hover {
@@ -1497,7 +1613,7 @@
1497
1613
  block-size: auto;
1498
1614
  padding: 0;
1499
1615
  background: transparent;
1500
- color: var(--_accent);
1616
+ color: var(--_soft-fg);
1501
1617
  border-color: transparent;
1502
1618
  text-decoration: underline;
1503
1619
  text-underline-offset: 0.2em;
@@ -1864,7 +1980,12 @@
1864
1980
  /**
1865
1981
  * Checkbox: `<label class="hl-checkbox"><input type="checkbox"><span>...</span></label>`.
1866
1982
  * The native input is restyled (appearance: none) with a CSS checkmark, keeping
1867
- * full keyboard and form semantics. Pure CSS; there is no enhancer.
1983
+ * full keyboard and form semantics. A single checkbox needs no JavaScript; the
1984
+ * `data-hl-checkbox-group` enhancer adds a `data-hl-checkbox-all` master box
1985
+ * (checked/indeterminate follows the group) and `data-hl-indeterminate` for an
1986
+ * initial mixed state, both styled here through `:indeterminate`.
1987
+ * data-hl-checkbox-group: wrapper around related boxes for the enhancer
1988
+ * data-hl-checkbox-all: the master "select all" box inside the group
1868
1989
  */
1869
1990
  @layer components {
1870
1991
  .hl-checkbox {
@@ -2150,7 +2271,7 @@
2150
2271
  .hl-label[data-hl-required]::after {
2151
2272
  content: '*';
2152
2273
  margin-inline-start: var(--hl-space-1);
2153
- color: var(--hl-danger);
2274
+ color: var(--hl-danger-subtle-fg);
2154
2275
  }
2155
2276
 
2156
2277
  .hl-help {
@@ -2163,11 +2284,11 @@
2163
2284
  margin: 0;
2164
2285
  font-size: var(--hl-text-xs);
2165
2286
  font-weight: var(--hl-font-medium);
2166
- color: var(--hl-danger);
2287
+ color: var(--hl-danger-subtle-fg);
2167
2288
  }
2168
2289
 
2169
2290
  .hl-field[data-hl-invalid] .hl-label {
2170
- color: var(--hl-danger);
2291
+ color: var(--hl-danger-subtle-fg);
2171
2292
  }
2172
2293
 
2173
2294
  .hl-fieldset {
@@ -2223,7 +2344,16 @@
2223
2344
  /* Modern engines pin the listbox to the input via the anchor-name the
2224
2345
  enhancer sets, so it escapes overflow-clipping ancestors. */
2225
2346
  @supports (anchor-name: --x) {
2347
+ [data-hl-combobox] {
2348
+ anchor-scope: --hl-combobox-input;
2349
+ }
2350
+
2351
+ [data-hl-combobox] > input {
2352
+ anchor-name: --hl-combobox-input;
2353
+ }
2354
+
2226
2355
  [data-hl-combobox] [role='listbox'] {
2356
+ position-anchor: --hl-combobox-input;
2227
2357
  position: fixed;
2228
2358
  inset: auto;
2229
2359
  inline-size: anchor-size(width);
@@ -2295,13 +2425,17 @@
2295
2425
  * Segmented control: `<div class="hl-segmented" role="radiogroup">` of
2296
2426
  * `<label class="hl-segmented-item"><input type="radio">...</label>` segments.
2297
2427
  * Radio inputs give free keyboard navigation; the checked segment is raised.
2298
- * A button variant using `aria-pressed="true"` is also supported. Pure CSS;
2299
- * there is no enhancer.
2428
+ * A button variant is also supported: with the enhancer (`data-hl-segmented`)
2429
+ * buttons become a `role="radio"` group with `aria-checked` and arrow keys;
2430
+ * without it, mark the active button `aria-pressed="true"`.
2300
2431
  * data-hl-size: sm | md (default) | lg
2301
2432
  */
2302
2433
  @layer components {
2303
2434
  .hl-segmented {
2304
2435
  display: inline-flex;
2436
+ flex-wrap: wrap;
2437
+ max-inline-size: 100%;
2438
+ min-inline-size: 0;
2305
2439
  align-items: stretch;
2306
2440
  gap: var(--hl-space-1);
2307
2441
  padding: var(--hl-space-1);
@@ -2313,6 +2447,7 @@
2313
2447
  .hl-segmented-item {
2314
2448
  position: relative;
2315
2449
  display: inline-flex;
2450
+ flex-shrink: 0;
2316
2451
  align-items: center;
2317
2452
  justify-content: center;
2318
2453
  gap: var(--hl-space-2);
@@ -2346,14 +2481,14 @@
2346
2481
  }
2347
2482
 
2348
2483
  .hl-segmented-item:has(input:checked),
2349
- .hl-segmented-item[aria-pressed='true'] {
2484
+ .hl-segmented-item:is([aria-pressed='true'], [aria-checked='true']) {
2350
2485
  background: var(--hl-surface);
2351
2486
  color: var(--hl-fg);
2352
2487
  box-shadow: var(--hl-shadow-sm);
2353
2488
  }
2354
2489
 
2355
2490
  .hl-segmented-item:has(input:focus-visible),
2356
- .hl-segmented-item[aria-pressed]:focus-visible {
2491
+ .hl-segmented-item:is([aria-pressed], [aria-checked]):focus-visible {
2357
2492
  outline: var(--hl-focus-ring);
2358
2493
  outline-offset: var(--hl-focus-offset);
2359
2494
  }
@@ -2381,7 +2516,7 @@
2381
2516
  }
2382
2517
 
2383
2518
  .hl-segmented-item:has(input:checked),
2384
- .hl-segmented-item[aria-pressed='true'] {
2519
+ .hl-segmented-item:is([aria-pressed='true'], [aria-checked='true']) {
2385
2520
  background: Highlight;
2386
2521
  color: HighlightText;
2387
2522
  }
@@ -2390,7 +2525,11 @@
2390
2525
  /**
2391
2526
  * Slider: native `<input type="range" class="hl-slider">`. Restyled track and
2392
2527
  * thumb across WebKit/Blink and Firefox while keeping native keyboard support
2393
- * and RTL direction. Pure CSS; there is no enhancer.
2528
+ * and RTL direction. Firefox paints the filled part of the track natively
2529
+ * (`::-moz-range-progress`); other engines get it from the
2530
+ * `--hl-slider-progress` custom property the enhancer keeps in sync when the
2531
+ * input sits inside a `[data-hl-slider]` wrapper (with an optional `<output>`).
2532
+ * data-hl-slider: wrapper around the input (and output) for the enhancer
2394
2533
  */
2395
2534
  @layer components {
2396
2535
  .hl-slider {
@@ -2411,6 +2550,40 @@
2411
2550
  background: var(--hl-surface-3);
2412
2551
  }
2413
2552
 
2553
+ /* Fill up to the thumb once the enhancer publishes the progress. */
2554
+ .hl-slider[style*='--hl-slider-progress']::-webkit-slider-runnable-track {
2555
+ background: linear-gradient(
2556
+ to right,
2557
+ var(--hl-primary) var(--hl-slider-progress),
2558
+ var(--hl-surface-3) var(--hl-slider-progress)
2559
+ );
2560
+ }
2561
+
2562
+ :is(
2563
+ [dir='rtl'] .hl-slider,
2564
+ .hl-slider:dir(rtl)
2565
+ )[style*='--hl-slider-progress']::-webkit-slider-runnable-track {
2566
+ background: linear-gradient(
2567
+ to left,
2568
+ var(--hl-primary) var(--hl-slider-progress),
2569
+ var(--hl-surface-3) var(--hl-slider-progress)
2570
+ );
2571
+ }
2572
+
2573
+ [data-hl-slider] {
2574
+ display: flex;
2575
+ align-items: center;
2576
+ gap: var(--hl-space-3);
2577
+ }
2578
+
2579
+ [data-hl-slider] > output {
2580
+ min-inline-size: 3ch;
2581
+ font-size: var(--hl-text-sm);
2582
+ font-variant-numeric: tabular-nums;
2583
+ color: var(--hl-fg-muted);
2584
+ text-align: end;
2585
+ }
2586
+
2414
2587
  .hl-slider::-moz-range-track {
2415
2588
  block-size: var(--_track);
2416
2589
  border-radius: var(--hl-radius-full);
@@ -2477,9 +2650,13 @@
2477
2650
  /* Feedback & data display */
2478
2651
  /**
2479
2652
  * Alert: `<div class="hl-alert" role="alert" data-hl-intent="...">` with an
2480
- * optional icon, `.hl-alert-title`, and body content. Pure CSS; there is no
2481
- * enhancer.
2482
- * data-hl-intent: info (default) | success | warning | danger | neutral
2653
+ * optional icon, `.hl-alert-title`, and body content. Add `data-hl-alert` and
2654
+ * a `[data-hl-dismiss]` button for the dismiss enhancer, which fades the alert
2655
+ * out (`data-hl-alert-closing`) before hiding it.
2656
+ * data-hl-intent: info (default) | success | warning | danger | neutral
2657
+ * data-hl-alert: opt in to the dismiss enhancer
2658
+ * data-hl-dismiss: the dismiss button inside the alert
2659
+ * data-hl-alert-closing: set by the enhancer during the exit transition
2483
2660
  */
2484
2661
  @layer components {
2485
2662
  .hl-alert {
@@ -2497,6 +2674,55 @@
2497
2674
  color: var(--_fg);
2498
2675
  font-size: var(--hl-text-sm);
2499
2676
  line-height: var(--hl-leading-normal);
2677
+ transition:
2678
+ opacity var(--hl-duration-base) var(--hl-ease-standard),
2679
+ translate var(--hl-duration-base) var(--hl-ease-standard);
2680
+ }
2681
+
2682
+ .hl-alert[data-hl-alert-closing] {
2683
+ opacity: 0;
2684
+ translate: 0 -0.25rem;
2685
+ }
2686
+
2687
+ /* `display: flex` above would otherwise beat the user agent's `[hidden]`. */
2688
+ .hl-alert[hidden] {
2689
+ display: none;
2690
+ }
2691
+
2692
+ .hl-alert [data-hl-dismiss] {
2693
+ display: inline-flex;
2694
+ align-items: center;
2695
+ justify-content: center;
2696
+ flex: none;
2697
+ inline-size: 1.5rem;
2698
+ block-size: 1.5rem;
2699
+ margin-inline-start: auto;
2700
+ margin-block-start: -0.125rem;
2701
+ padding: 0;
2702
+ border: 0;
2703
+ border-radius: var(--hl-radius-sm);
2704
+ background: transparent;
2705
+ color: inherit;
2706
+ font: inherit;
2707
+ line-height: 1;
2708
+ cursor: pointer;
2709
+ opacity: 0.7;
2710
+ }
2711
+
2712
+ .hl-alert [data-hl-dismiss]:hover {
2713
+ opacity: 1;
2714
+ background: color-mix(in oklab, currentcolor 10%, transparent);
2715
+ }
2716
+
2717
+ .hl-alert [data-hl-dismiss]:focus-visible {
2718
+ outline: var(--hl-focus-ring);
2719
+ outline-offset: var(--hl-focus-offset);
2720
+ opacity: 1;
2721
+ }
2722
+
2723
+ .hl-alert [data-hl-dismiss]:empty::before {
2724
+ content: '\00D7';
2725
+ font-size: var(--hl-text-lg);
2500
2726
  }
2501
2727
 
2502
2728
  .hl-alert[data-hl-intent='success'] {
@@ -2631,7 +2857,7 @@
2631
2857
 
2632
2858
  .hl-badge[data-hl-variant='outline'] {
2633
2859
  background: transparent;
2634
- color: var(--_accent);
2860
+ color: var(--_soft-fg);
2635
2861
  border-color: currentcolor;
2636
2862
  }
2637
2863
 
@@ -2741,7 +2967,7 @@
2741
2967
  border-radius: var(--hl-radius-full);
2742
2968
  overflow: hidden;
2743
2969
  background: var(--hl-surface-3);
2744
- color: var(--hl-fg-muted);
2970
+ color: var(--hl-fg);
2745
2971
  font-size: calc(var(--_size) * 0.4);
2746
2972
  font-weight: var(--hl-font-medium);
2747
2973
  line-height: 1;
@@ -3034,11 +3260,14 @@
3034
3260
  /**
3035
3261
  * Table: `<table class="hl-table">`, optionally inside
3036
3262
  * `<div class="hl-table-wrapper">` so wide tables scroll instead of breaking
3037
- * the layout. Pure CSS; there is no enhancer.
3263
+ * the layout. Add `data-hl-table` and mark headers `data-hl-sort` for the
3264
+ * sorting enhancer; it sets `aria-sort` on the active column.
3038
3265
  * data-hl-striped: zebra rows
3039
3266
  * data-hl-hover: highlight row on hover
3040
3267
  * data-hl-align: start (default) | center | end, on the table or a cell
3041
3268
  * data-hl-size: sm | md (default) | lg, cell padding density
3269
+ * data-hl-table: opt in to the sorting enhancer
3270
+ * data-hl-sort: a sortable header (value: the column key)
3042
3271
  */
3043
3272
  @layer components {
3044
3273
  .hl-table-wrapper {
@@ -3081,6 +3310,51 @@
3081
3310
  border-block-end-color: var(--hl-border-strong);
3082
3311
  }
3083
3312
 
3313
+ /* Sortable headers: a pointer cursor, a focus ring, and a direction glyph. */
3314
+ .hl-table th[data-hl-sort] {
3315
+ cursor: pointer;
3316
+ -webkit-user-select: none;
3317
+ user-select: none;
3318
+ }
3319
+
3320
+ .hl-table th[data-hl-sort]:hover {
3321
+ color: var(--hl-fg);
3322
+ }
3323
+
3324
+ .hl-table th[data-hl-sort]:focus-visible {
3325
+ outline: var(--hl-focus-ring);
3326
+ outline-offset: calc(var(--hl-focus-offset) * -1);
3327
+ }
3328
+
3329
+ .hl-table th[data-hl-sort]::after {
3330
+ content: '';
3331
+ display: inline-block;
3332
+ inline-size: 0.35em;
3333
+ block-size: 0.35em;
3334
+ margin-inline-start: var(--hl-space-1);
3335
+ border-inline-end: 1.5px solid currentcolor;
3336
+ border-block-end: 1.5px solid currentcolor;
3337
+ opacity: 0;
3338
+ translate: 0 -0.15em;
3339
+ rotate: 45deg;
3340
+ transition: opacity var(--hl-duration-fast) var(--hl-ease-standard);
3341
+ }
3342
+
3343
+ .hl-table th[data-hl-sort]:hover::after {
3344
+ opacity: 0.4;
3345
+ }
3346
+
3347
+ .hl-table th[aria-sort='ascending']::after,
3348
+ .hl-table th[aria-sort='descending']::after {
3349
+ opacity: 1;
3350
+ color: var(--hl-primary);
3351
+ }
3352
+
3353
+ .hl-table th[aria-sort='ascending']::after {
3354
+ rotate: 225deg;
3355
+ translate: 0 0.1em;
3356
+ }
3357
+
3084
3358
  .hl-table tfoot td {
3085
3359
  font-weight: var(--hl-font-medium);
3086
3360
  color: var(--hl-fg-muted);