hydrateless 0.8.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +120 -0
  2. package/dist/accordion.css +20 -8
  3. package/dist/alert.css +69 -8
  4. package/dist/avatar.css +8 -14
  5. package/dist/badge.css +9 -1
  6. package/dist/breadcrumb.css +7 -3
  7. package/dist/button.css +48 -28
  8. package/dist/card.css +8 -5
  9. package/dist/checkbox.css +36 -22
  10. package/dist/combobox.css +43 -15
  11. package/dist/command-palette.css +123 -0
  12. package/dist/components.css +1351 -571
  13. package/dist/disclosure.css +27 -29
  14. package/dist/drawer.css +76 -48
  15. package/dist/dropdown.css +138 -22
  16. package/dist/field.css +5 -4
  17. package/dist/hydrateless.css +1581 -1330
  18. package/dist/hydrateless.min.css +1 -1
  19. package/dist/input.css +20 -17
  20. package/dist/kbd.css +4 -3
  21. package/dist/menu.css +106 -45
  22. package/dist/modal.css +63 -14
  23. package/dist/pagination.css +20 -11
  24. package/dist/popover.css +34 -12
  25. package/dist/progress.css +23 -12
  26. package/dist/{radio.css → radio-group.css} +23 -16
  27. package/dist/reset.css +7 -2
  28. package/dist/{segmented.css → segmented-control.css} +24 -12
  29. package/dist/select.css +28 -22
  30. package/dist/separator.css +9 -9
  31. package/dist/skeleton.css +18 -10
  32. package/dist/skip-link.css +13 -8
  33. package/dist/slider.css +66 -25
  34. package/dist/spinner.css +17 -14
  35. package/dist/switch.css +55 -18
  36. package/dist/table.css +100 -15
  37. package/dist/tabs.css +35 -11
  38. package/dist/textarea.css +26 -12
  39. package/dist/theme.css +5 -24
  40. package/dist/toast.css +40 -36
  41. package/dist/toc.css +17 -4
  42. package/dist/tokens.css +208 -183
  43. package/dist/tooltip.css +74 -17
  44. package/package.json +4 -4
  45. package/dist/command.css +0 -102
package/dist/checkbox.css CHANGED
@@ -1,7 +1,12 @@
1
1
  /**
2
- * Checkbox: `<label class="hl-checkbox"><input type="checkbox"><span>…</span></label>`.
3
- * The native input is restyled (appearance:none) with a CSS checkmark, keeping
4
- * full keyboard + form semantics.
2
+ * Checkbox: `<label class="hl-checkbox"><input type="checkbox"><span>...</span></label>`.
3
+ * The native input is restyled (appearance: none) with a CSS checkmark, keeping
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 {
@@ -14,34 +19,33 @@
14
19
  }
15
20
 
16
21
  .hl-checkbox > input[type='checkbox'] {
17
- -webkit-appearance: none;
18
- -moz-appearance: none;
19
- appearance: none;
22
+ appearance: none;
20
23
  flex: none;
21
- width: 1.15rem;
22
- height: 1.15rem;
24
+ inline-size: 1.15rem;
25
+ block-size: 1.15rem;
23
26
  margin: 0;
24
27
  border: var(--hl-border-width-2) solid var(--hl-border-strong);
25
28
  border-radius: var(--hl-radius-sm);
26
29
  background: var(--hl-surface);
27
30
  display: grid;
28
- align-content: center;
29
- justify-content: center;
30
31
  place-content: center;
31
32
  cursor: pointer;
32
33
  transition:
33
- background-color var(--hl-duration-fast) var(--hl-ease-standard), border-color var(--hl-duration-fast) var(--hl-ease-standard);
34
+ background-color var(--hl-duration-fast) var(--hl-ease-standard),
35
+ border-color var(--hl-duration-fast) var(--hl-ease-standard);
34
36
  }
35
37
 
38
+ /* The mark is a rotated L drawn with two borders; direction-neutral. */
36
39
  .hl-checkbox > input[type='checkbox']::after {
37
40
  content: '';
38
- width: 0.34rem;
39
- height: 0.62rem;
41
+ inline-size: 0.34rem;
42
+ block-size: 0.62rem;
40
43
  border: solid var(--hl-primary-fg);
41
44
  border-width: 0 2px 2px 0;
42
- margin-top: -2px;
43
- transform: rotate(45deg) scale(0);
44
- transition: transform var(--hl-duration-fast) var(--hl-ease-emphasized);
45
+ margin-block-start: -2px;
46
+ rotate: 45deg;
47
+ scale: 0;
48
+ transition: scale var(--hl-duration-fast) var(--hl-ease-emphasized);
45
49
  }
46
50
 
47
51
  .hl-checkbox > input[type='checkbox']:checked,
@@ -51,29 +55,39 @@
51
55
  }
52
56
 
53
57
  .hl-checkbox > input[type='checkbox']:checked::after {
54
- transform: rotate(45deg) scale(1);
58
+ scale: 1;
55
59
  }
56
60
 
57
61
  .hl-checkbox > input[type='checkbox']:indeterminate::after {
58
- width: 0.6rem;
59
- height: 0;
62
+ inline-size: 0.6rem;
63
+ block-size: 0;
60
64
  margin: 0;
61
65
  border-width: 0 0 2px;
62
- transform: none;
66
+ rotate: none;
67
+ scale: 1;
63
68
  }
64
69
 
65
70
  .hl-checkbox > input[type='checkbox']:focus-visible {
66
71
  outline: var(--hl-focus-ring);
67
- outline-offset: 2px;
72
+ outline-offset: var(--hl-focus-offset);
68
73
  }
69
74
 
70
75
  .hl-checkbox > input[type='checkbox']:disabled {
71
76
  cursor: not-allowed;
72
- opacity: 0.55;
77
+ opacity: var(--hl-disabled-opacity);
73
78
  }
74
79
 
75
80
  .hl-checkbox:has(> input:disabled) {
76
81
  cursor: not-allowed;
77
82
  color: var(--hl-fg-subtle);
78
83
  }
84
+
85
+ /* The custom-drawn mark must keep its own colors to stay visible on the
86
+ Highlight fill; everything else follows the system palette. */
87
+ @media (forced-colors: active) {
88
+ .hl-checkbox > input[type='checkbox']::after {
89
+ forced-color-adjust: none;
90
+ border-color: HighlightText;
91
+ }
92
+ }
79
93
  }
package/dist/combobox.css CHANGED
@@ -1,7 +1,13 @@
1
1
  /**
2
2
  * Combobox: `<div data-hl-combobox>` wrapping an `<input>` and a
3
- * `<ul role="listbox">` of `<li role="option">`. The enhancer toggles the
4
- * listbox and manages `aria-activedescendant`.
3
+ * `<ul role="listbox">` of `<li role="option">`.
4
+ *
5
+ * No-JS baseline: the listbox is hidden until the root has focus within it,
6
+ * so the options are at least reachable and readable. The enhancer marks the
7
+ * root `data-hl-ready` and then owns visibility through `hidden`, filtering,
8
+ * and `aria-activedescendant`.
9
+ * data-hl-combobox: root
10
+ * data-hl-ready: set by the enhancer; the baseline rules stand down
5
11
  */
6
12
  @layer components {
7
13
  [data-hl-combobox] {
@@ -11,11 +17,10 @@
11
17
 
12
18
  [data-hl-combobox] [role='listbox'] {
13
19
  position: absolute;
14
- top: calc(100% + var(--hl-space-1));
15
- left: 0;
16
- right: 0;
20
+ inset-block-start: calc(100% + var(--hl-space-1));
21
+ inset-inline: 0;
17
22
  z-index: var(--hl-z-dropdown);
18
- max-height: 16rem;
23
+ max-block-size: 16rem;
19
24
  margin: 0;
20
25
  padding: var(--hl-space-1);
21
26
  overflow-y: auto;
@@ -31,16 +36,11 @@
31
36
  @supports (anchor-name: --x) {
32
37
  [data-hl-combobox] [role='listbox'] {
33
38
  position: fixed;
34
- top: auto;
35
- right: auto;
36
- bottom: auto;
37
- left: auto;
38
- width: anchor-size(width);
39
- inset-area: block-end;
39
+ inset: auto;
40
+ inline-size: anchor-size(width);
40
41
  position-area: block-end;
41
42
  position-try-fallbacks: flip-block;
42
- margin-top: var(--hl-space-1);
43
- margin-bottom: var(--hl-space-1);
43
+ margin-block: var(--hl-space-1);
44
44
  }
45
45
  }
46
46
 
@@ -48,6 +48,23 @@
48
48
  display: none;
49
49
  }
50
50
 
51
+ /* No-JS baseline: reveal the list while the field has focus. */
52
+ [data-hl-combobox]:not([data-hl-ready]) [role='listbox'] {
53
+ display: none;
54
+ }
55
+
56
+ [data-hl-combobox]:not([data-hl-ready]):focus-within [role='listbox'] {
57
+ display: block;
58
+ }
59
+
60
+ /* The input may be a plain `<input>` rather than `.hl-input`; make sure it
61
+ still shows a focus ring. */
62
+ [data-hl-combobox] > input:focus-visible {
63
+ outline: none;
64
+ border-color: var(--hl-ring);
65
+ box-shadow: var(--hl-focus-shadow);
66
+ }
67
+
51
68
  [data-hl-combobox] [role='option'] {
52
69
  display: flex;
53
70
  align-items: center;
@@ -70,7 +87,18 @@
70
87
  }
71
88
 
72
89
  [data-hl-combobox] [role='option'][aria-disabled='true'] {
73
- opacity: 0.5;
90
+ opacity: var(--hl-disabled-opacity);
74
91
  pointer-events: none;
75
92
  }
93
+
94
+ @media (forced-colors: active) {
95
+ [data-hl-combobox] [role='option'][aria-selected='true'] {
96
+ background: Highlight;
97
+ color: HighlightText;
98
+ }
99
+
100
+ [data-hl-combobox] [role='option'][aria-disabled='true'] {
101
+ color: GrayText;
102
+ }
103
+ }
76
104
  }
@@ -0,0 +1,123 @@
1
+ /**
2
+ * Command palette: `<div data-hl-command>` containing a search input
3
+ * (`.hl-command-input` or `[data-hl-command-input]`), an empty state
4
+ * (`[data-hl-command-empty]`), and a `[data-hl-command-list] role="listbox"` of
5
+ * grouped `[role="option"]` items. Often placed inside a `<dialog class="hl-modal">`.
6
+ *
7
+ * No-JS baseline: every item is listed and the empty state stays hidden,
8
+ * since nothing can filter yet. The enhancer marks the root `data-hl-ready`
9
+ * and then toggles `hidden` on items, groups, and the empty state.
10
+ * data-hl-command: root
11
+ * data-hl-command-input: filter field
12
+ * data-hl-command-list: listbox
13
+ * data-hl-command-group: a group wrapper (hidden when all its items are)
14
+ * data-hl-command-empty: "no results" message
15
+ * data-hl-ready: set by the enhancer
16
+ */
17
+ @layer components {
18
+ [data-hl-command] {
19
+ display: flex;
20
+ flex-direction: column;
21
+ min-block-size: 0;
22
+ overflow: hidden;
23
+ background: var(--hl-overlay);
24
+ border-radius: var(--hl-radius-lg);
25
+ }
26
+
27
+ :is(.hl-command-input, [data-hl-command-input]) {
28
+ flex: none;
29
+ inline-size: 100%;
30
+ block-size: var(--hl-control-height-lg);
31
+ padding-inline: var(--hl-space-4);
32
+ border: 0;
33
+ border-block-end: var(--hl-border-width) solid var(--hl-border);
34
+ border-radius: 0;
35
+ background: transparent;
36
+ color: var(--hl-fg);
37
+ font: inherit;
38
+ font-size: var(--hl-text-base);
39
+ }
40
+
41
+ /* The field is flush with the palette edge, so the ring is drawn inward. */
42
+ :is(.hl-command-input, [data-hl-command-input]):focus-visible {
43
+ outline: var(--hl-focus-ring);
44
+ outline-offset: calc(var(--hl-focus-offset) * -1);
45
+ }
46
+
47
+ :is(.hl-command-input, [data-hl-command-input])::placeholder {
48
+ color: var(--hl-fg-subtle);
49
+ }
50
+
51
+ [data-hl-command-list] {
52
+ flex: 1 1 auto;
53
+ max-block-size: 24rem;
54
+ overflow-y: auto;
55
+ padding: var(--hl-space-2);
56
+ }
57
+
58
+ [data-hl-command-group][hidden] {
59
+ display: none;
60
+ }
61
+
62
+ .hl-command-group-label {
63
+ padding: var(--hl-space-2) var(--hl-space-2) var(--hl-space-1);
64
+ font-size: var(--hl-text-xs);
65
+ font-weight: var(--hl-font-semibold);
66
+ text-transform: uppercase;
67
+ letter-spacing: 0.04em;
68
+ color: var(--hl-fg-subtle);
69
+ }
70
+
71
+ [data-hl-command] [role='option'] {
72
+ display: flex;
73
+ align-items: center;
74
+ gap: var(--hl-space-3);
75
+ padding: var(--hl-space-2) var(--hl-space-3);
76
+ border-radius: var(--hl-radius-md);
77
+ font-size: var(--hl-text-sm);
78
+ color: var(--hl-fg);
79
+ cursor: pointer;
80
+ }
81
+
82
+ [data-hl-command] [role='option'][hidden] {
83
+ display: none;
84
+ }
85
+
86
+ [data-hl-command] [role='option']:hover,
87
+ [data-hl-command] [role='option'][aria-selected='true'] {
88
+ background: var(--hl-primary-subtle);
89
+ color: var(--hl-primary-subtle-fg);
90
+ }
91
+
92
+ [data-hl-command] [role='option'][aria-disabled='true'] {
93
+ opacity: var(--hl-disabled-opacity);
94
+ pointer-events: none;
95
+ }
96
+
97
+ [data-hl-command] [role='option'] svg {
98
+ inline-size: 1.1em;
99
+ block-size: 1.1em;
100
+ flex: none;
101
+ opacity: 0.7;
102
+ }
103
+
104
+ [data-hl-command-empty] {
105
+ padding: var(--hl-space-8) var(--hl-space-4);
106
+ text-align: center;
107
+ font-size: var(--hl-text-sm);
108
+ color: var(--hl-fg-muted);
109
+ }
110
+
111
+ /* No-JS baseline: there is no filtering, so there are never "no results". */
112
+ [data-hl-command-empty][hidden],
113
+ [data-hl-command]:not([data-hl-ready]) [data-hl-command-empty] {
114
+ display: none;
115
+ }
116
+
117
+ @media (forced-colors: active) {
118
+ [data-hl-command] [role='option'][aria-selected='true'] {
119
+ background: Highlight;
120
+ color: HighlightText;
121
+ }
122
+ }
123
+ }