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.
package/dist/tabs.css CHANGED
@@ -1,52 +1,126 @@
1
+ /**
2
+ * Tabs. Two markups are supported and styled together:
3
+ *
4
+ * - CSS-only baseline: `.hl-tablist` of `<label class="hl-tab">` wrapping a
5
+ * radio, then a `.hl-tabpanels` of `.hl-tabpanel`s. `:has(input:checked)`
6
+ * switches panels with no JavaScript (up to 8 tabs).
7
+ * - Enhanced: the enhancer adds `role="tab"`/`tabpanel`, roving focus, and
8
+ * `aria-selected`, toggles `[hidden]` on panels, and marks the root
9
+ * `data-hl-ready`, at which point the no-JS rules below stand down.
10
+ */
1
11
  @layer components {
2
12
  [data-hl-tabs] {
3
- border: 1px solid var(--hl-border);
13
+ border: var(--hl-border-width) solid var(--hl-border);
4
14
  border-radius: var(--hl-radius-lg);
5
15
  }
6
16
 
17
+ .hl-tablist,
7
18
  [data-hl-tabs] [role='tablist'] {
8
19
  display: flex;
9
20
  gap: var(--hl-space-2);
10
21
  padding: var(--hl-space-2);
11
- border-bottom: 1px solid var(--hl-border);
22
+ border-bottom: var(--hl-border-width) solid var(--hl-border);
12
23
  }
13
24
 
25
+ .hl-tab,
14
26
  [data-hl-tabs] [role='tab'] {
27
+ position: relative;
15
28
  -webkit-appearance: none;
16
29
  -moz-appearance: none;
17
30
  appearance: none;
31
+ display: inline-flex;
32
+ align-items: center;
18
33
  background: transparent;
19
34
  border: 0;
20
35
  border-radius: var(--hl-radius-sm);
21
36
  padding: var(--hl-space-2) var(--hl-space-3);
22
37
  color: inherit;
38
+ font: inherit;
39
+ cursor: pointer;
23
40
  }
24
41
 
42
+ /* The baseline keeps selection in a visually hidden radio per tab label. */
43
+ .hl-tab > input[type='radio'] {
44
+ position: absolute;
45
+ top: 0;
46
+ right: 0;
47
+ bottom: 0;
48
+ left: 0;
49
+ margin: 0;
50
+ opacity: 0;
51
+ cursor: pointer;
52
+ }
53
+
54
+ .hl-tab:has(input:checked),
25
55
  [data-hl-tabs] [role='tab'][aria-selected='true'] {
26
56
  background: var(--hl-surface-2);
27
57
  }
28
58
 
59
+ .hl-tab:has(input:focus-visible),
60
+ [data-hl-tabs] [role='tab']:focus-visible {
61
+ outline: var(--hl-focus-ring);
62
+ outline-offset: 2px;
63
+ }
64
+
65
+ .hl-tab:has(input:disabled),
29
66
  [data-hl-tabs] [role='tab'][disabled],
30
67
  [data-hl-tabs] [role='tab'][aria-disabled='true'] {
31
68
  opacity: 0.5;
32
69
  cursor: not-allowed;
33
70
  }
34
71
 
35
- [data-hl-tabs] [role='tab']:focus-visible {
36
- outline: var(--hl-focus-ring);
37
- outline-offset: 2px;
38
- }
39
-
72
+ .hl-tabpanel,
40
73
  [data-hl-tabs] [role='tabpanel'] {
41
74
  padding: var(--hl-space-4);
42
75
  }
43
76
 
77
+ .hl-tabpanel[hidden],
44
78
  [role='tabpanel'][hidden] {
45
79
  display: none;
46
80
  }
47
81
 
48
- /* No-JS fallback: until the enhancer marks the root ready, show only the
49
- first panel so server-rendered content degrades to readable output. */
82
+ /* No-JS baseline: reveal the panel whose tab radio is checked, by position.
83
+ These stand down once the enhancer sets data-hl-ready and owns [hidden]. */
84
+ [data-hl-tabs]:not([data-hl-ready]) .hl-tabpanels > .hl-tabpanel {
85
+ display: none;
86
+ }
87
+
88
+ [data-hl-tabs]:not([data-hl-ready])
89
+ .hl-tablist:has(.hl-tab:nth-of-type(1) input:checked)
90
+ ~ .hl-tabpanels
91
+ > .hl-tabpanel:nth-of-type(1),
92
+ [data-hl-tabs]:not([data-hl-ready])
93
+ .hl-tablist:has(.hl-tab:nth-of-type(2) input:checked)
94
+ ~ .hl-tabpanels
95
+ > .hl-tabpanel:nth-of-type(2),
96
+ [data-hl-tabs]:not([data-hl-ready])
97
+ .hl-tablist:has(.hl-tab:nth-of-type(3) input:checked)
98
+ ~ .hl-tabpanels
99
+ > .hl-tabpanel:nth-of-type(3),
100
+ [data-hl-tabs]:not([data-hl-ready])
101
+ .hl-tablist:has(.hl-tab:nth-of-type(4) input:checked)
102
+ ~ .hl-tabpanels
103
+ > .hl-tabpanel:nth-of-type(4),
104
+ [data-hl-tabs]:not([data-hl-ready])
105
+ .hl-tablist:has(.hl-tab:nth-of-type(5) input:checked)
106
+ ~ .hl-tabpanels
107
+ > .hl-tabpanel:nth-of-type(5),
108
+ [data-hl-tabs]:not([data-hl-ready])
109
+ .hl-tablist:has(.hl-tab:nth-of-type(6) input:checked)
110
+ ~ .hl-tabpanels
111
+ > .hl-tabpanel:nth-of-type(6),
112
+ [data-hl-tabs]:not([data-hl-ready])
113
+ .hl-tablist:has(.hl-tab:nth-of-type(7) input:checked)
114
+ ~ .hl-tabpanels
115
+ > .hl-tabpanel:nth-of-type(7),
116
+ [data-hl-tabs]:not([data-hl-ready])
117
+ .hl-tablist:has(.hl-tab:nth-of-type(8) input:checked)
118
+ ~ .hl-tabpanels
119
+ > .hl-tabpanel:nth-of-type(8) {
120
+ display: block;
121
+ }
122
+
123
+ /* Role-only markup (no radios) before JS: degrade to showing the first panel. */
50
124
  [data-hl-tabs]:not([data-hl-ready]) [role='tabpanel'] ~ [role='tabpanel'] {
51
125
  display: none;
52
126
  }
package/dist/textarea.css CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Multi-line text input — `<textarea class="hl-textarea">`.
2
+ * Multi-line text input: `<textarea class="hl-textarea">`.
3
3
  * data-hl-invalid: error styling (pair with aria-invalid)
4
4
  */
5
5
  @layer components {
package/dist/tokens.css CHANGED
@@ -143,7 +143,7 @@
143
143
  --hl-font-semibold: 600;
144
144
  --hl-font-bold: 700;
145
145
 
146
- /* Elevation (shadows) — tuned for light surfaces */
146
+ /* Elevation (shadows), tuned for light surfaces */
147
147
  --hl-shadow-xs: 0 1px 2px 0 hsla(222, 47%, 11%, 0.05);
148
148
  --hl-shadow-sm: 0 1px 3px 0 hsla(222, 47%, 11%, 0.1), 0 1px 2px -1px hsla(222, 47%, 11%, 0.1);
149
149
  --hl-shadow-md:
@@ -187,7 +187,7 @@
187
187
  /**
188
188
  * Semantic tokens map the raw palette to roles (surface, text, border, intent
189
189
  * colors). Components reference only these, so theming and dark mode are a
190
- * matter of remapping a couple dozen variables — never touching component CSS.
190
+ * matter of remapping a couple dozen variables, never touching component CSS.
191
191
  *
192
192
  * Light is the default in `:root`. Dark applies automatically via
193
193
  * `prefers-color-scheme` (unless `[data-theme="light"]` opts out) and always
package/dist/tooltip.css CHANGED
@@ -1,23 +1,49 @@
1
+ /**
2
+ * Tooltip: a `[role="tooltip"]` element described by a `[data-hl-tooltip]`
3
+ * trigger. With no JavaScript it shows on the trigger's `:hover`/`:focus-visible`
4
+ * (the tip must be the trigger's next sibling). When the enhancer runs it marks
5
+ * the trigger `data-hl-tooltip-managed` and drives visibility through
6
+ * `data-hl-tooltip-open` instead, adding show/hide delays, a grace period, and
7
+ * Escape-to-dismiss.
8
+ */
1
9
  @layer components {
2
10
  [role='tooltip'] {
11
+ /* Fallback placement: the JS positioner writes inline position/inset on
12
+ engines without CSS anchor positioning. */
3
13
  position: absolute;
4
14
  z-index: var(--hl-z-tooltip);
5
- top: auto;
6
- right: auto;
7
- bottom: auto;
8
- left: 0;
9
- translate: 0 -0.25rem;
15
+ width: -moz-max-content;
16
+ width: max-content;
17
+ max-width: 32ch;
18
+ margin: 0;
10
19
  padding: var(--hl-space-1) var(--hl-space-2);
11
20
  border-radius: var(--hl-radius-sm);
12
21
  background: var(--hl-fg);
13
22
  color: var(--hl-surface);
14
23
  font-size: var(--hl-text-sm);
15
- max-width: 32ch;
16
- width: -moz-max-content;
17
- width: max-content;
18
24
  }
19
25
 
20
26
  [role='tooltip'][hidden] {
21
27
  display: none;
22
28
  }
29
+
30
+ /* No-JS baseline: reveal while the adjacent trigger is hovered or focused.
31
+ Suppressed once the enhancer takes over (trigger gains -managed). */
32
+ [data-hl-tooltip]:not([data-hl-tooltip-managed]):hover + [role='tooltip'],
33
+ [data-hl-tooltip]:not([data-hl-tooltip-managed]):focus-visible + [role='tooltip'] {
34
+ display: block;
35
+ }
36
+
37
+ /* Modern placement: pin above the trigger via the anchor-name the enhancer
38
+ sets, flipping below when there's no room. */
39
+ @supports (anchor-name: --x) {
40
+ [role='tooltip'] {
41
+ position: fixed;
42
+ inset-area: block-start;
43
+ position-area: block-start;
44
+ position-try-fallbacks: flip-block;
45
+ margin-top: var(--hl-space-1);
46
+ margin-bottom: var(--hl-space-1);
47
+ }
48
+ }
23
49
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hydrateless",
3
- "version": "0.6.0",
4
- "description": "Accessible, themeable UI primitives — semantic HTML + modern CSS first, optional JS enhancers.",
3
+ "version": "0.8.0",
4
+ "description": "Accessible, themeable UI primitives: semantic HTML and modern CSS first, optional JS enhancers.",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",