hydrateless 0.9.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.
package/dist/alert.css CHANGED
@@ -1,8 +1,12 @@
1
1
  /**
2
2
  * Alert: `<div class="hl-alert" role="alert" data-hl-intent="...">` with an
3
- * optional icon, `.hl-alert-title`, and body content. Pure CSS; there is no
4
- * enhancer.
5
- * data-hl-intent: info (default) | success | warning | danger | neutral
3
+ * optional icon, `.hl-alert-title`, and body content. Add `data-hl-alert` and
4
+ * a `[data-hl-dismiss]` button for the dismiss enhancer, which fades the alert
5
+ * out (`data-hl-alert-closing`) before hiding it.
6
+ * data-hl-intent: info (default) | success | warning | danger | neutral
7
+ * data-hl-alert: opt in to the dismiss enhancer
8
+ * data-hl-dismiss: the dismiss button inside the alert
9
+ * data-hl-alert-closing: set by the enhancer during the exit transition
6
10
  */
7
11
  @layer components {
8
12
  .hl-alert {
@@ -20,6 +24,55 @@
20
24
  color: var(--_fg);
21
25
  font-size: var(--hl-text-sm);
22
26
  line-height: var(--hl-leading-normal);
27
+ transition:
28
+ opacity var(--hl-duration-base) var(--hl-ease-standard),
29
+ translate var(--hl-duration-base) var(--hl-ease-standard);
30
+ }
31
+
32
+ .hl-alert[data-hl-alert-closing] {
33
+ opacity: 0;
34
+ translate: 0 -0.25rem;
35
+ }
36
+
37
+ /* `display: flex` above would otherwise beat the user agent's `[hidden]`. */
38
+ .hl-alert[hidden] {
39
+ display: none;
40
+ }
41
+
42
+ .hl-alert [data-hl-dismiss] {
43
+ display: inline-flex;
44
+ align-items: center;
45
+ justify-content: center;
46
+ flex: none;
47
+ inline-size: 1.5rem;
48
+ block-size: 1.5rem;
49
+ margin-inline-start: auto;
50
+ margin-block-start: -0.125rem;
51
+ padding: 0;
52
+ border: 0;
53
+ border-radius: var(--hl-radius-sm);
54
+ background: transparent;
55
+ color: inherit;
56
+ font: inherit;
57
+ line-height: 1;
58
+ cursor: pointer;
59
+ opacity: 0.7;
60
+ }
61
+
62
+ .hl-alert [data-hl-dismiss]:hover {
63
+ opacity: 1;
64
+ background: color-mix(in oklab, currentcolor 10%, transparent);
65
+ }
66
+
67
+ .hl-alert [data-hl-dismiss]:focus-visible {
68
+ outline: var(--hl-focus-ring);
69
+ outline-offset: var(--hl-focus-offset);
70
+ opacity: 1;
71
+ }
72
+
73
+ .hl-alert [data-hl-dismiss]:empty::before {
74
+ content: '\00D7';
75
+ font-size: var(--hl-text-lg);
23
76
  }
24
77
 
25
78
  .hl-alert[data-hl-intent='success'] {
package/dist/checkbox.css CHANGED
@@ -1,7 +1,12 @@
1
1
  /**
2
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
- * full keyboard and form semantics. Pure CSS; there is no enhancer.
4
+ * full keyboard and form semantics. A single checkbox needs no JavaScript; the
5
+ * `data-hl-checkbox-group` enhancer adds a `data-hl-checkbox-all` master box
6
+ * (checked/indeterminate follows the group) and `data-hl-indeterminate` for an
7
+ * initial mixed state, both styled here through `:indeterminate`.
8
+ * data-hl-checkbox-group: wrapper around related boxes for the enhancer
9
+ * data-hl-checkbox-all: the master "select all" box inside the group
5
10
  */
6
11
  @layer components {
7
12
  .hl-checkbox {
@@ -270,7 +270,7 @@
270
270
  * links. With no JavaScript it is a plain link list; the enhancer marks the
271
271
  * link for the heading in view with `aria-current="true"`.
272
272
  * data-hl-toc: the nav
273
- * data-hl-toc-content: optional element whose headings are observed
273
+ * data-hl-content-selector: optional element whose headings are observed
274
274
  */
275
275
  @layer components {
276
276
  nav[data-hl-toc] {
@@ -744,7 +744,8 @@
744
744
  * `hidden`), and drives visibility through `data-hl-tooltip-open` with show
745
745
  * and hide delays, a grace period, and Escape to dismiss.
746
746
  * data-hl-tooltip: the trigger
747
- * data-hl-placement: top (default) | bottom | left | right, on the trigger
747
+ * data-hl-placement: top (default) | bottom | start | end, on the trigger
748
+ * data-hl-side: the resolved side, set on the tip by the enhancer
748
749
  * data-hl-tooltip-managed: set on the trigger by the enhancer
749
750
  * data-hl-tooltip-open: set on the tip while shown
750
751
  */
@@ -793,8 +794,10 @@
793
794
  }
794
795
  }
795
796
 
796
- /* Modern placement: pin above the trigger via the anchor-name the enhancer
797
- sets, flipping below when there's no room. */
797
+ /* Modern placement: pin to the requested side of the trigger via the
798
+ anchor-name the enhancer sets, flipping when there's no room. The side
799
+ comes from `data-hl-side` on the tip (enhanced) or `data-hl-placement` on
800
+ the preceding trigger (no-JS baseline). */
798
801
  @supports (anchor-name: --x) {
799
802
  [role='tooltip'] {
800
803
  position: fixed;
@@ -803,6 +806,30 @@
803
806
  position-try-fallbacks: flip-block;
804
807
  margin-block: var(--hl-space-1);
805
808
  }
809
+
810
+ [role='tooltip'][data-hl-side='bottom'],
811
+ [data-hl-tooltip][data-hl-placement^='bottom'] + [role='tooltip'] {
812
+ position-area: block-end;
813
+ }
814
+
815
+ [role='tooltip']:is([data-hl-side='start'], [data-hl-side='end']),
816
+ [data-hl-tooltip]:is([data-hl-placement^='start'], [data-hl-placement^='end'])
817
+ + [role='tooltip'] {
818
+ position-try-fallbacks: flip-inline;
819
+ margin-block: 0;
820
+ margin-inline: var(--hl-space-1);
821
+ translate: 0 0;
822
+ }
823
+
824
+ [role='tooltip'][data-hl-side='start'],
825
+ [data-hl-tooltip][data-hl-placement^='start'] + [role='tooltip'] {
826
+ position-area: inline-start;
827
+ }
828
+
829
+ [role='tooltip'][data-hl-side='end'],
830
+ [data-hl-tooltip][data-hl-placement^='end'] + [role='tooltip'] {
831
+ position-area: inline-end;
832
+ }
806
833
  }
807
834
 
808
835
  /* Inverted colors flatten away; keep a visible edge on the system canvas. */
@@ -825,7 +852,9 @@
825
852
  * data-hl-dropdown-menu: the `<ul>` (or any list) of items
826
853
  * data-hl-value: an item's value for `hl:select`
827
854
  * Items are `role="menuitem"`, `menuitemcheckbox`, or `menuitemradio`, either
828
- * directly in the list, inside `<li>`, or inside `<li><ul role="group">`.
855
+ * directly in the list, inside `<li>`, or inside `<li><ul role="group">`. An
856
+ * item followed by a sibling `<ul role="menu">` (or `[data-hl-submenu]`) opens
857
+ * it as a nested submenu to the inline-end side.
829
858
  */
830
859
  @layer components {
831
860
  [data-hl-dropdown] {
@@ -879,6 +908,60 @@
879
908
  list-style: none;
880
909
  }
881
910
 
911
+ /* Nested submenus share the panel styling and sit beside their trigger. */
912
+ [data-hl-dropdown-menu] li {
913
+ position: relative;
914
+ }
915
+
916
+ [data-hl-dropdown-menu] :is([role='menu'], [data-hl-submenu]) {
917
+ position: absolute;
918
+ inset-block-start: 0;
919
+ inset-inline-start: calc(100% + var(--hl-space-1));
920
+ z-index: var(--hl-z-dropdown);
921
+ min-inline-size: 10rem;
922
+ margin: 0;
923
+ padding: var(--hl-space-1);
924
+ list-style: none;
925
+ border: var(--hl-border-width) solid var(--hl-border);
926
+ border-radius: var(--hl-radius-lg);
927
+ background: var(--hl-surface);
928
+ box-shadow: var(--hl-overlay-shadow);
929
+ }
930
+
931
+ [data-hl-dropdown-menu]
932
+ :is([role='menu'], [data-hl-submenu]):is([hidden], [popover]:not(:popover-open)) {
933
+ display: none;
934
+ }
935
+
936
+ [data-hl-dropdown-menu] :is([role='menu'], [data-hl-submenu])[popover] {
937
+ position: fixed;
938
+ inset: auto;
939
+ }
940
+
941
+ @supports (position-area: block-end) {
942
+ [data-hl-dropdown-menu] :is([role='menu'], [data-hl-submenu])[popover] {
943
+ position-area: inline-end span-block-end;
944
+ position-try-fallbacks: flip-inline, flip-block;
945
+ margin-inline: var(--hl-space-1);
946
+ }
947
+ }
948
+
949
+ /* Submenu chevron: a rotated square corner at the inline end. */
950
+ [data-hl-dropdown-menu] [role^='menuitem'][aria-haspopup='menu']::after {
951
+ content: '';
952
+ inline-size: 0.4rem;
953
+ block-size: 0.4rem;
954
+ margin-inline-start: auto;
955
+ border-inline-end: 1.5px solid currentcolor;
956
+ border-block-end: 1.5px solid currentcolor;
957
+ rotate: -45deg;
958
+ opacity: 0.6;
959
+ }
960
+
961
+ [data-hl-dropdown-menu] [role^='menuitem'][aria-expanded='true'] {
962
+ background: var(--hl-surface-2);
963
+ }
964
+
882
965
  [data-hl-dropdown-menu] [role^='menuitem'] {
883
966
  display: flex;
884
967
  align-items: center;
@@ -948,8 +1031,10 @@
948
1031
  }
949
1032
  /**
950
1033
  * 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>`.
1034
+ * items, each optionally holding a trigger and a submenu (`<ul role="menu">`
1035
+ * or `[data-hl-submenu]`) as siblings inside the `<li>`. Submenus nest: an
1036
+ * item inside a submenu may itself be followed by a submenu, which opens to
1037
+ * its inline-end side.
953
1038
  *
954
1039
  * No-JS baseline: a submenu shows while its `<li>` is hovered or has focus
955
1040
  * within it, so every link stays reachable by mouse and keyboard. The enhancer
@@ -957,7 +1042,7 @@
957
1042
  * plus a top-layer `popover`) and adds roving focus, arrow keys, typeahead,
958
1043
  * and checkable items. It reads:
959
1044
  * data-hl-menu: root; `aria-orientation="vertical"` stacks it
960
- * data-hl-menu-submenu: a submenu without `role="menu"`
1045
+ * data-hl-submenu: a submenu without `role="menu"`
961
1046
  * data-hl-value: a top-level trigger's value for `hl:change`
962
1047
  * data-hl-ready: set by the enhancer
963
1048
  */
@@ -1026,7 +1111,13 @@
1026
1111
  opacity: 0.6;
1027
1112
  }
1028
1113
 
1029
- [data-hl-menu] :is([role='menu'], [data-hl-menu-submenu]) {
1114
+ /* Submenus that open to the side point their chevron that way. */
1115
+ [data-hl-menu][aria-orientation='vertical'] [role^='menuitem'][aria-haspopup]::after,
1116
+ [data-hl-menu] :is([role='menu'], [data-hl-submenu]) [role^='menuitem'][aria-haspopup]::after {
1117
+ rotate: -45deg;
1118
+ }
1119
+
1120
+ [data-hl-menu] :is([role='menu'], [data-hl-submenu]) {
1030
1121
  position: absolute;
1031
1122
  inset-block-start: calc(100% + var(--hl-space-1));
1032
1123
  inset-inline-start: 0;
@@ -1046,17 +1137,22 @@
1046
1137
  overlay var(--hl-duration-fast) allow-discrete;
1047
1138
  }
1048
1139
 
1049
- [data-hl-menu][aria-orientation='vertical'] :is([role='menu'], [data-hl-menu-submenu]) {
1140
+ /* Vertical menubars and every nested level open to the inline-end side. */
1141
+ [data-hl-menu][aria-orientation='vertical'] :is([role='menu'], [data-hl-submenu]),
1142
+ [data-hl-menu] :is([role='menu'], [data-hl-submenu]) :is([role='menu'], [data-hl-submenu]) {
1050
1143
  inset-block-start: 0;
1051
1144
  inset-inline-start: calc(100% + var(--hl-space-1));
1052
1145
  }
1053
1146
 
1147
+ [data-hl-menu] :is([role='menu'], [data-hl-submenu]) li {
1148
+ position: relative;
1149
+ }
1150
+
1054
1151
  /* Closed states: `hidden` (enhancer without Popover API), a closed popover
1055
1152
  (enhancer with it), and the no-JS baseline below. Each is also the exit
1056
1153
  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]) {
1154
+ [data-hl-menu] :is([role='menu'], [data-hl-submenu]):is([hidden], [popover]:not(:popover-open)),
1155
+ [data-hl-menu]:not([data-hl-ready]) :is([role='menu'], [data-hl-submenu]) {
1060
1156
  display: none;
1061
1157
  opacity: 0;
1062
1158
  translate: 0 -0.25rem;
@@ -1065,14 +1161,14 @@
1065
1161
  /* No-JS baseline: reveal on hover or focus within the parent item. */
1066
1162
  [data-hl-menu]:not([data-hl-ready])
1067
1163
  li:is(:hover, :focus-within)
1068
- > :is([role='menu'], [data-hl-menu-submenu]) {
1164
+ > :is([role='menu'], [data-hl-submenu]) {
1069
1165
  display: block;
1070
1166
  opacity: 1;
1071
1167
  translate: 0 0;
1072
1168
  }
1073
1169
 
1074
1170
  @starting-style {
1075
- [data-hl-menu] :is([role='menu'], [data-hl-menu-submenu]) {
1171
+ [data-hl-menu] :is([role='menu'], [data-hl-submenu]) {
1076
1172
  opacity: 0;
1077
1173
  translate: 0 -0.25rem;
1078
1174
  }
@@ -1081,20 +1177,22 @@
1081
1177
  /* Enhanced path: the submenu is a native popover in the top layer, anchored
1082
1178
  to its trigger. The absolute-position rules above stay as the fallback for
1083
1179
  engines without the Popover API. */
1084
- [data-hl-menu] :is([role='menu'], [data-hl-menu-submenu])[popover] {
1180
+ [data-hl-menu] :is([role='menu'], [data-hl-submenu])[popover] {
1085
1181
  position: fixed;
1086
1182
  inset: auto;
1087
1183
  }
1088
1184
 
1089
1185
  @supports (position-area: block-end) {
1090
- [data-hl-menu] :is([role='menu'], [data-hl-menu-submenu])[popover] {
1186
+ [data-hl-menu] :is([role='menu'], [data-hl-submenu])[popover] {
1091
1187
  position-area: block-end span-inline-end;
1092
1188
  position-try-fallbacks: flip-block, flip-inline;
1093
1189
  margin-block: var(--hl-space-1);
1094
1190
  }
1095
1191
 
1096
- [data-hl-menu][aria-orientation='vertical']
1097
- :is([role='menu'], [data-hl-menu-submenu])[popover] {
1192
+ [data-hl-menu][aria-orientation='vertical'] :is([role='menu'], [data-hl-submenu])[popover],
1193
+ [data-hl-menu]
1194
+ :is([role='menu'], [data-hl-submenu])
1195
+ :is([role='menu'], [data-hl-submenu])[popover] {
1098
1196
  position-area: inline-end span-block-end;
1099
1197
  position-try-fallbacks: flip-inline, flip-block;
1100
1198
  margin-block: 0;
@@ -1864,7 +1962,12 @@
1864
1962
  /**
1865
1963
  * Checkbox: `<label class="hl-checkbox"><input type="checkbox"><span>...</span></label>`.
1866
1964
  * The native input is restyled (appearance: none) with a CSS checkmark, keeping
1867
- * full keyboard and form semantics. Pure CSS; there is no enhancer.
1965
+ * full keyboard and form semantics. A single checkbox needs no JavaScript; the
1966
+ * `data-hl-checkbox-group` enhancer adds a `data-hl-checkbox-all` master box
1967
+ * (checked/indeterminate follows the group) and `data-hl-indeterminate` for an
1968
+ * initial mixed state, both styled here through `:indeterminate`.
1969
+ * data-hl-checkbox-group: wrapper around related boxes for the enhancer
1970
+ * data-hl-checkbox-all: the master "select all" box inside the group
1868
1971
  */
1869
1972
  @layer components {
1870
1973
  .hl-checkbox {
@@ -2295,8 +2398,9 @@
2295
2398
  * Segmented control: `<div class="hl-segmented" role="radiogroup">` of
2296
2399
  * `<label class="hl-segmented-item"><input type="radio">...</label>` segments.
2297
2400
  * 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.
2401
+ * A button variant is also supported: with the enhancer (`data-hl-segmented`)
2402
+ * buttons become a `role="radio"` group with `aria-checked` and arrow keys;
2403
+ * without it, mark the active button `aria-pressed="true"`.
2300
2404
  * data-hl-size: sm | md (default) | lg
2301
2405
  */
2302
2406
  @layer components {
@@ -2346,14 +2450,14 @@
2346
2450
  }
2347
2451
 
2348
2452
  .hl-segmented-item:has(input:checked),
2349
- .hl-segmented-item[aria-pressed='true'] {
2453
+ .hl-segmented-item:is([aria-pressed='true'], [aria-checked='true']) {
2350
2454
  background: var(--hl-surface);
2351
2455
  color: var(--hl-fg);
2352
2456
  box-shadow: var(--hl-shadow-sm);
2353
2457
  }
2354
2458
 
2355
2459
  .hl-segmented-item:has(input:focus-visible),
2356
- .hl-segmented-item[aria-pressed]:focus-visible {
2460
+ .hl-segmented-item:is([aria-pressed], [aria-checked]):focus-visible {
2357
2461
  outline: var(--hl-focus-ring);
2358
2462
  outline-offset: var(--hl-focus-offset);
2359
2463
  }
@@ -2381,7 +2485,7 @@
2381
2485
  }
2382
2486
 
2383
2487
  .hl-segmented-item:has(input:checked),
2384
- .hl-segmented-item[aria-pressed='true'] {
2488
+ .hl-segmented-item:is([aria-pressed='true'], [aria-checked='true']) {
2385
2489
  background: Highlight;
2386
2490
  color: HighlightText;
2387
2491
  }
@@ -2390,7 +2494,11 @@
2390
2494
  /**
2391
2495
  * Slider: native `<input type="range" class="hl-slider">`. Restyled track and
2392
2496
  * thumb across WebKit/Blink and Firefox while keeping native keyboard support
2393
- * and RTL direction. Pure CSS; there is no enhancer.
2497
+ * and RTL direction. Firefox paints the filled part of the track natively
2498
+ * (`::-moz-range-progress`); other engines get it from the
2499
+ * `--hl-slider-progress` custom property the enhancer keeps in sync when the
2500
+ * input sits inside a `[data-hl-slider]` wrapper (with an optional `<output>`).
2501
+ * data-hl-slider: wrapper around the input (and output) for the enhancer
2394
2502
  */
2395
2503
  @layer components {
2396
2504
  .hl-slider {
@@ -2411,6 +2519,40 @@
2411
2519
  background: var(--hl-surface-3);
2412
2520
  }
2413
2521
 
2522
+ /* Fill up to the thumb once the enhancer publishes the progress. */
2523
+ .hl-slider[style*='--hl-slider-progress']::-webkit-slider-runnable-track {
2524
+ background: linear-gradient(
2525
+ to right,
2526
+ var(--hl-primary) var(--hl-slider-progress),
2527
+ var(--hl-surface-3) var(--hl-slider-progress)
2528
+ );
2529
+ }
2530
+
2531
+ :is(
2532
+ [dir='rtl'] .hl-slider,
2533
+ .hl-slider:dir(rtl)
2534
+ )[style*='--hl-slider-progress']::-webkit-slider-runnable-track {
2535
+ background: linear-gradient(
2536
+ to left,
2537
+ var(--hl-primary) var(--hl-slider-progress),
2538
+ var(--hl-surface-3) var(--hl-slider-progress)
2539
+ );
2540
+ }
2541
+
2542
+ [data-hl-slider] {
2543
+ display: flex;
2544
+ align-items: center;
2545
+ gap: var(--hl-space-3);
2546
+ }
2547
+
2548
+ [data-hl-slider] > output {
2549
+ min-inline-size: 3ch;
2550
+ font-size: var(--hl-text-sm);
2551
+ font-variant-numeric: tabular-nums;
2552
+ color: var(--hl-fg-muted);
2553
+ text-align: end;
2554
+ }
2555
+
2414
2556
  .hl-slider::-moz-range-track {
2415
2557
  block-size: var(--_track);
2416
2558
  border-radius: var(--hl-radius-full);
@@ -2477,9 +2619,13 @@
2477
2619
  /* Feedback & data display */
2478
2620
  /**
2479
2621
  * 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
2622
+ * optional icon, `.hl-alert-title`, and body content. Add `data-hl-alert` and
2623
+ * a `[data-hl-dismiss]` button for the dismiss enhancer, which fades the alert
2624
+ * out (`data-hl-alert-closing`) before hiding it.
2625
+ * data-hl-intent: info (default) | success | warning | danger | neutral
2626
+ * data-hl-alert: opt in to the dismiss enhancer
2627
+ * data-hl-dismiss: the dismiss button inside the alert
2628
+ * data-hl-alert-closing: set by the enhancer during the exit transition
2483
2629
  */
2484
2630
  @layer components {
2485
2631
  .hl-alert {
@@ -2497,6 +2643,55 @@
2497
2643
  color: var(--_fg);
2498
2644
  font-size: var(--hl-text-sm);
2499
2645
  line-height: var(--hl-leading-normal);
2646
+ transition:
2647
+ opacity var(--hl-duration-base) var(--hl-ease-standard),
2648
+ translate var(--hl-duration-base) var(--hl-ease-standard);
2649
+ }
2650
+
2651
+ .hl-alert[data-hl-alert-closing] {
2652
+ opacity: 0;
2653
+ translate: 0 -0.25rem;
2654
+ }
2655
+
2656
+ /* `display: flex` above would otherwise beat the user agent's `[hidden]`. */
2657
+ .hl-alert[hidden] {
2658
+ display: none;
2659
+ }
2660
+
2661
+ .hl-alert [data-hl-dismiss] {
2662
+ display: inline-flex;
2663
+ align-items: center;
2664
+ justify-content: center;
2665
+ flex: none;
2666
+ inline-size: 1.5rem;
2667
+ block-size: 1.5rem;
2668
+ margin-inline-start: auto;
2669
+ margin-block-start: -0.125rem;
2670
+ padding: 0;
2671
+ border: 0;
2672
+ border-radius: var(--hl-radius-sm);
2673
+ background: transparent;
2674
+ color: inherit;
2675
+ font: inherit;
2676
+ line-height: 1;
2677
+ cursor: pointer;
2678
+ opacity: 0.7;
2679
+ }
2680
+
2681
+ .hl-alert [data-hl-dismiss]:hover {
2682
+ opacity: 1;
2683
+ background: color-mix(in oklab, currentcolor 10%, transparent);
2684
+ }
2685
+
2686
+ .hl-alert [data-hl-dismiss]:focus-visible {
2687
+ outline: var(--hl-focus-ring);
2688
+ outline-offset: var(--hl-focus-offset);
2689
+ opacity: 1;
2690
+ }
2691
+
2692
+ .hl-alert [data-hl-dismiss]:empty::before {
2693
+ content: '\00D7';
2694
+ font-size: var(--hl-text-lg);
2500
2695
  }
2501
2696
 
2502
2697
  .hl-alert[data-hl-intent='success'] {
@@ -3034,11 +3229,14 @@
3034
3229
  /**
3035
3230
  * Table: `<table class="hl-table">`, optionally inside
3036
3231
  * `<div class="hl-table-wrapper">` so wide tables scroll instead of breaking
3037
- * the layout. Pure CSS; there is no enhancer.
3232
+ * the layout. Add `data-hl-table` and mark headers `data-hl-sort` for the
3233
+ * sorting enhancer; it sets `aria-sort` on the active column.
3038
3234
  * data-hl-striped: zebra rows
3039
3235
  * data-hl-hover: highlight row on hover
3040
3236
  * data-hl-align: start (default) | center | end, on the table or a cell
3041
3237
  * data-hl-size: sm | md (default) | lg, cell padding density
3238
+ * data-hl-table: opt in to the sorting enhancer
3239
+ * data-hl-sort: a sortable header (value: the column key)
3042
3240
  */
3043
3241
  @layer components {
3044
3242
  .hl-table-wrapper {
@@ -3081,6 +3279,51 @@
3081
3279
  border-block-end-color: var(--hl-border-strong);
3082
3280
  }
3083
3281
 
3282
+ /* Sortable headers: a pointer cursor, a focus ring, and a direction glyph. */
3283
+ .hl-table th[data-hl-sort] {
3284
+ cursor: pointer;
3285
+ -webkit-user-select: none;
3286
+ user-select: none;
3287
+ }
3288
+
3289
+ .hl-table th[data-hl-sort]:hover {
3290
+ color: var(--hl-fg);
3291
+ }
3292
+
3293
+ .hl-table th[data-hl-sort]:focus-visible {
3294
+ outline: var(--hl-focus-ring);
3295
+ outline-offset: calc(var(--hl-focus-offset) * -1);
3296
+ }
3297
+
3298
+ .hl-table th[data-hl-sort]::after {
3299
+ content: '';
3300
+ display: inline-block;
3301
+ inline-size: 0.35em;
3302
+ block-size: 0.35em;
3303
+ margin-inline-start: var(--hl-space-1);
3304
+ border-inline-end: 1.5px solid currentcolor;
3305
+ border-block-end: 1.5px solid currentcolor;
3306
+ opacity: 0;
3307
+ translate: 0 -0.15em;
3308
+ rotate: 45deg;
3309
+ transition: opacity var(--hl-duration-fast) var(--hl-ease-standard);
3310
+ }
3311
+
3312
+ .hl-table th[data-hl-sort]:hover::after {
3313
+ opacity: 0.4;
3314
+ }
3315
+
3316
+ .hl-table th[aria-sort='ascending']::after,
3317
+ .hl-table th[aria-sort='descending']::after {
3318
+ opacity: 1;
3319
+ color: var(--hl-primary);
3320
+ }
3321
+
3322
+ .hl-table th[aria-sort='ascending']::after {
3323
+ rotate: 225deg;
3324
+ translate: 0 0.1em;
3325
+ }
3326
+
3084
3327
  .hl-table tfoot td {
3085
3328
  font-weight: var(--hl-font-medium);
3086
3329
  color: var(--hl-fg-muted);
package/dist/dropdown.css CHANGED
@@ -11,7 +11,9 @@
11
11
  * data-hl-dropdown-menu: the `<ul>` (or any list) of items
12
12
  * data-hl-value: an item's value for `hl:select`
13
13
  * Items are `role="menuitem"`, `menuitemcheckbox`, or `menuitemradio`, either
14
- * directly in the list, inside `<li>`, or inside `<li><ul role="group">`.
14
+ * directly in the list, inside `<li>`, or inside `<li><ul role="group">`. An
15
+ * item followed by a sibling `<ul role="menu">` (or `[data-hl-submenu]`) opens
16
+ * it as a nested submenu to the inline-end side.
15
17
  */
16
18
  @layer components {
17
19
  [data-hl-dropdown] {
@@ -65,6 +67,60 @@
65
67
  list-style: none;
66
68
  }
67
69
 
70
+ /* Nested submenus share the panel styling and sit beside their trigger. */
71
+ [data-hl-dropdown-menu] li {
72
+ position: relative;
73
+ }
74
+
75
+ [data-hl-dropdown-menu] :is([role='menu'], [data-hl-submenu]) {
76
+ position: absolute;
77
+ inset-block-start: 0;
78
+ inset-inline-start: calc(100% + var(--hl-space-1));
79
+ z-index: var(--hl-z-dropdown);
80
+ min-inline-size: 10rem;
81
+ margin: 0;
82
+ padding: var(--hl-space-1);
83
+ list-style: none;
84
+ border: var(--hl-border-width) solid var(--hl-border);
85
+ border-radius: var(--hl-radius-lg);
86
+ background: var(--hl-surface);
87
+ box-shadow: var(--hl-overlay-shadow);
88
+ }
89
+
90
+ [data-hl-dropdown-menu]
91
+ :is([role='menu'], [data-hl-submenu]):is([hidden], [popover]:not(:popover-open)) {
92
+ display: none;
93
+ }
94
+
95
+ [data-hl-dropdown-menu] :is([role='menu'], [data-hl-submenu])[popover] {
96
+ position: fixed;
97
+ inset: auto;
98
+ }
99
+
100
+ @supports (position-area: block-end) {
101
+ [data-hl-dropdown-menu] :is([role='menu'], [data-hl-submenu])[popover] {
102
+ position-area: inline-end span-block-end;
103
+ position-try-fallbacks: flip-inline, flip-block;
104
+ margin-inline: var(--hl-space-1);
105
+ }
106
+ }
107
+
108
+ /* Submenu chevron: a rotated square corner at the inline end. */
109
+ [data-hl-dropdown-menu] [role^='menuitem'][aria-haspopup='menu']::after {
110
+ content: '';
111
+ inline-size: 0.4rem;
112
+ block-size: 0.4rem;
113
+ margin-inline-start: auto;
114
+ border-inline-end: 1.5px solid currentcolor;
115
+ border-block-end: 1.5px solid currentcolor;
116
+ rotate: -45deg;
117
+ opacity: 0.6;
118
+ }
119
+
120
+ [data-hl-dropdown-menu] [role^='menuitem'][aria-expanded='true'] {
121
+ background: var(--hl-surface-2);
122
+ }
123
+
68
124
  [data-hl-dropdown-menu] [role^='menuitem'] {
69
125
  display: flex;
70
126
  align-items: center;