hydrateless 0.7.0 → 0.9.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/README.md +120 -0
- package/dist/accordion.css +20 -8
- package/dist/alert.css +15 -7
- package/dist/avatar.css +8 -14
- package/dist/badge.css +9 -1
- package/dist/breadcrumb.css +7 -3
- package/dist/button.css +48 -28
- package/dist/card.css +8 -5
- package/dist/checkbox.css +31 -22
- package/dist/combobox.css +43 -15
- package/dist/command-palette.css +123 -0
- package/dist/components.css +1127 -532
- package/dist/disclosure.css +35 -12
- package/dist/drawer.css +76 -48
- package/dist/dropdown.css +82 -22
- package/dist/field.css +5 -4
- package/dist/hydrateless.css +1359 -1282
- package/dist/hydrateless.min.css +1 -1
- package/dist/input.css +20 -17
- package/dist/kbd.css +4 -3
- package/dist/menu.css +107 -28
- package/dist/modal.css +63 -14
- package/dist/pagination.css +20 -11
- package/dist/popover.css +34 -12
- package/dist/progress.css +23 -12
- package/dist/{radio.css → radio-group.css} +23 -16
- package/dist/reset.css +7 -2
- package/dist/{segmented.css → segmented-control.css} +21 -10
- package/dist/select.css +28 -22
- package/dist/separator.css +9 -9
- package/dist/skeleton.css +18 -10
- package/dist/skip-link.css +13 -8
- package/dist/slider.css +28 -25
- package/dist/spinner.css +17 -14
- package/dist/switch.css +55 -18
- package/dist/table.css +52 -15
- package/dist/tabs.css +35 -11
- package/dist/textarea.css +26 -12
- package/dist/theme.css +5 -24
- package/dist/toast.css +40 -36
- package/dist/toc.css +17 -4
- package/dist/tokens.css +208 -179
- package/dist/tooltip.css +45 -15
- package/package.json +4 -4
- package/dist/command.css +0 -102
package/README.md
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# hydrateless
|
|
2
|
+
|
|
3
|
+
Accessible, themeable UI primitives built on semantic HTML and modern CSS. This package is the CSS: every component works with no JavaScript, and the optional enhancers in `@hydrateless/enhancers` layer keyboard patterns and APIs on top of the same markup.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install hydrateless
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```html
|
|
12
|
+
<link rel="stylesheet" href="node_modules/hydrateless/dist/hydrateless.css" />
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Or from a CDN, pinned to a major:
|
|
16
|
+
|
|
17
|
+
```html
|
|
18
|
+
<link rel="stylesheet" href="https://unpkg.com/hydrateless@0/dist/hydrateless.min.css" />
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Entry points
|
|
22
|
+
|
|
23
|
+
`hydrateless.css` bundles everything in four cascade layers, declared in this order so later layers always win:
|
|
24
|
+
|
|
25
|
+
```css
|
|
26
|
+
@layer reset, tokens, theme, components;
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Each layer and each component is also a subpath export, so you can take only what you need. Always include `tokens.css`; the components reference the tokens and nothing else.
|
|
30
|
+
|
|
31
|
+
| Subpath | Contents |
|
|
32
|
+
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- |
|
|
33
|
+
| `hydrateless/reset.css` | Border-box sizing, zeroed margins, inherited form fonts |
|
|
34
|
+
| `hydrateless/tokens.css` | Palette, scales, and semantic tokens (`--hl-*`) |
|
|
35
|
+
| `hydrateless/theme.css` | Body colors and type built on the tokens |
|
|
36
|
+
| `hydrateless/components.css` | Every component below |
|
|
37
|
+
| `hydrateless/accordion.css`, `disclosure.css`, `tabs.css`, `toc.css`, `breadcrumb.css`, `pagination.css`, `separator.css` | Disclosure and navigation |
|
|
38
|
+
| `hydrateless/modal.css`, `drawer.css`, `popover.css`, `tooltip.css`, `dropdown.css`, `menu.css`, `toast.css`, `command-palette.css` | Overlays |
|
|
39
|
+
| `hydrateless/button.css`, `input.css`, `textarea.css`, `select.css`, `checkbox.css`, `radio-group.css`, `switch.css`, `field.css`, `combobox.css`, `segmented-control.css`, `slider.css` | Forms |
|
|
40
|
+
| `hydrateless/alert.css`, `badge.css`, `card.css`, `avatar.css`, `progress.css`, `spinner.css`, `skeleton.css`, `kbd.css`, `table.css` | Feedback and data display |
|
|
41
|
+
| `hydrateless/skip-link.css` | Navigation utility |
|
|
42
|
+
|
|
43
|
+
```js
|
|
44
|
+
import 'hydrateless/tokens.css';
|
|
45
|
+
import 'hydrateless/button.css';
|
|
46
|
+
import 'hydrateless/segmented-control.css';
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Class names don't follow the file names one to one: `segmented-control.css` styles `.hl-segmented`, `radio-group.css` styles `.hl-radio-group` and `.hl-radio`, and `command-palette.css` styles `[data-hl-command]` and `.hl-command-*`.
|
|
50
|
+
|
|
51
|
+
## Theming
|
|
52
|
+
|
|
53
|
+
Every color token is a `light-dark()` pair, resolved by `color-scheme`. The root follows the system preference; set `data-theme` on any element to pin a scheme for that subtree:
|
|
54
|
+
|
|
55
|
+
```html
|
|
56
|
+
<html data-theme="dark">
|
|
57
|
+
...
|
|
58
|
+
<aside data-theme="light">Always light</aside>
|
|
59
|
+
</html>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Override tokens anywhere in the cascade; the components read only the semantic layer, so a brand swap is a handful of variables:
|
|
63
|
+
|
|
64
|
+
```css
|
|
65
|
+
:root {
|
|
66
|
+
--hl-primary: light-dark(hsl(280deg 70% 45%), hsl(280deg 80% 65%));
|
|
67
|
+
--hl-primary-fg: white;
|
|
68
|
+
--hl-radius-md: 0.25rem;
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Token reference
|
|
73
|
+
|
|
74
|
+
Palette ramps (`--hl-gray-50` to `--hl-gray-950`, `--hl-brand-*`, `--hl-red-*`, `--hl-amber-*`, `--hl-green-*`, `--hl-sky-*`) live in `tokens/palette.css`. The tokens components actually use:
|
|
75
|
+
|
|
76
|
+
| Token | Purpose |
|
|
77
|
+
| ------------------------------------------------------------------------------- | --------------------------------------------------------------- |
|
|
78
|
+
| `--hl-bg`, `--hl-surface`, `--hl-surface-2`, `--hl-surface-3` | Page and stepped surfaces |
|
|
79
|
+
| `--hl-fg`, `--hl-fg-muted`, `--hl-fg-subtle` | Text |
|
|
80
|
+
| `--hl-border`, `--hl-border-strong`, `--hl-border-width`, `--hl-border-width-2` | Borders |
|
|
81
|
+
| `--hl-ring`, `--hl-focus-ring`, `--hl-focus-shadow`, `--hl-focus-offset` | Focus ring color, full outline value, soft halo, outline gap |
|
|
82
|
+
| `--hl-primary`, `--hl-danger`, `--hl-success`, `--hl-warning`, `--hl-info` | Intents, each with `-hover`, `-fg`, `-subtle`, `-subtle-fg` |
|
|
83
|
+
| `--hl-scrim`, `--hl-overlay`, `--hl-overlay-shadow` | Backdrop and floating surfaces |
|
|
84
|
+
| `--hl-shadow-xs` to `--hl-shadow-xl`, `--hl-shadow-color` | Elevation |
|
|
85
|
+
| `--hl-space-*`, `--hl-radius-*`, `--hl-text-*`, `--hl-leading-*`, `--hl-font-*` | Spacing, radii, and type scales |
|
|
86
|
+
| `--hl-control-block-size`, `--hl-control-height-sm`, `-md`, `-lg` | Control heights; `-md` is an alias of `--hl-control-block-size` |
|
|
87
|
+
| `--hl-overlay-inline-size`, `--hl-modal-inline-size` | Drawer and modal widths |
|
|
88
|
+
| `--hl-disabled-opacity` | Opacity of disabled controls and items |
|
|
89
|
+
| `--hl-z-*` | Stacking order for the JS positioning fallback |
|
|
90
|
+
| `--hl-duration-fast`, `-base`, `-slow`, `--hl-ease-standard`, `-emphasized` | Motion |
|
|
91
|
+
|
|
92
|
+
## Conventions
|
|
93
|
+
|
|
94
|
+
State and variants are `data-hl-*` attributes rather than modifier classes:
|
|
95
|
+
|
|
96
|
+
- `data-hl-intent="primary | danger | success | warning | info | neutral"` on buttons, badges, alerts, progress, and toasts.
|
|
97
|
+
- `data-hl-variant="solid | soft | outline | ghost | link"` is the button's visual style (and `soft | solid | outline` on badges).
|
|
98
|
+
- `data-hl-size="sm | md | lg"` on controls, tables, and avatars.
|
|
99
|
+
- `data-hl-side="start | end"` on the drawer (default `end`). Sides are logical, so they flip under `dir="rtl"`.
|
|
100
|
+
- `data-hl-shape="text | circle | rect"` on skeletons.
|
|
101
|
+
- `data-hl-orientation` on radio groups and separators; `aria-orientation` on tablists and menus.
|
|
102
|
+
- `data-hl-ready` is set by an enhancer once it owns a component; the CSS no-JS baselines (menu submenus on hover, combobox list on focus, tab panels by radio, command palette empty state) stand down when it's present.
|
|
103
|
+
|
|
104
|
+
Modal and drawer selectors accept either the class or the data attribute: `:is(.hl-modal, dialog[data-hl-modal])` and `:is(.hl-drawer, dialog[data-hl-drawer])`.
|
|
105
|
+
|
|
106
|
+
## Right to left
|
|
107
|
+
|
|
108
|
+
The stylesheet uses logical properties throughout (`inline-size`, `margin-inline-start`, `inset-inline-end`, `text-align: start`), so setting `dir="rtl"` mirrors every component. Transforms are physical, so the two places that move things, the switch thumb and the drawer slide, are mirrored with `:dir(rtl)`.
|
|
109
|
+
|
|
110
|
+
## Motion
|
|
111
|
+
|
|
112
|
+
Overlays (popover, dropdown, menu submenus, tooltip, modal and its backdrop, drawer, toast) enter through `@starting-style` and exit through `transition-behavior: allow-discrete` on `display` and `overlay`, using the duration and easing tokens. Under `prefers-reduced-motion: reduce` the duration tokens drop to `0ms`, and the spinner, loading button, and indeterminate progress stop animating and render a static arc or bar.
|
|
113
|
+
|
|
114
|
+
## Forced colors
|
|
115
|
+
|
|
116
|
+
Under `forced-colors: active` the semantic tokens map to system colors (`Canvas`, `CanvasText`, `Highlight`, `HighlightText`, `GrayText`), controls that normally rely on fills gain `ButtonBorder`/`CanvasText` borders, and selected tabs, segments, options, and checked switches use `Highlight`. Only the custom-drawn checkbox mark, radio dot, and switch thumb use `forced-color-adjust: none`.
|
|
117
|
+
|
|
118
|
+
## Browser support
|
|
119
|
+
|
|
120
|
+
The CSS targets evergreen browsers with the Popover API, `:has()`, `light-dark()`, and `@starting-style`. CSS anchor positioning is used where available; the enhancers provide a JS positioning fallback elsewhere. The build (`scripts/build.mjs`) intentionally leaves these features native rather than polyfilling them.
|
package/dist/accordion.css
CHANGED
|
@@ -1,18 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Accordion: `<div data-hl-accordion>` of native `<details>` items, each with a
|
|
3
|
+
* `<summary>` header and an `.hl-accordion-panel` body.
|
|
4
|
+
*
|
|
5
|
+
* No-JS baseline: `<details>` opens and closes on its own; exclusive groups
|
|
6
|
+
* need only a shared `name` attribute. The enhancer adds arrow-key movement
|
|
7
|
+
* between headers and the value API, and reads nothing else from the markup.
|
|
8
|
+
* data-hl-accordion: root (opts into the enhancer)
|
|
9
|
+
*/
|
|
1
10
|
@layer components {
|
|
2
11
|
[data-hl-accordion] {
|
|
3
|
-
border:
|
|
12
|
+
border: var(--hl-border-width) solid var(--hl-border);
|
|
4
13
|
border-radius: var(--hl-radius-lg);
|
|
5
14
|
}
|
|
6
15
|
|
|
7
16
|
[data-hl-accordion] > details {
|
|
8
|
-
border-
|
|
17
|
+
border-block-start: var(--hl-border-width) solid var(--hl-border);
|
|
9
18
|
}
|
|
10
19
|
|
|
11
20
|
[data-hl-accordion] > details:first-child {
|
|
12
|
-
border-
|
|
21
|
+
border-block-start: 0;
|
|
13
22
|
}
|
|
14
23
|
|
|
15
24
|
[data-hl-accordion] > details > summary {
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
gap: var(--hl-space-2);
|
|
16
28
|
list-style: none;
|
|
17
29
|
cursor: pointer;
|
|
18
30
|
padding: var(--hl-space-3) var(--hl-space-4);
|
|
@@ -24,18 +36,18 @@
|
|
|
24
36
|
|
|
25
37
|
[data-hl-accordion] > details > summary:focus-visible {
|
|
26
38
|
outline: var(--hl-focus-ring);
|
|
27
|
-
outline-offset:
|
|
39
|
+
outline-offset: var(--hl-focus-offset);
|
|
28
40
|
}
|
|
29
41
|
|
|
42
|
+
/* The chevron sits at the inline end so it lands on the left under RTL. */
|
|
30
43
|
[data-hl-accordion] > details > summary::after {
|
|
31
44
|
content: '\25BE';
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
transition: transform var(--hl-duration-fast) var(--hl-ease-standard);
|
|
45
|
+
margin-inline-start: auto;
|
|
46
|
+
transition: rotate var(--hl-duration-fast) var(--hl-ease-standard);
|
|
35
47
|
}
|
|
36
48
|
|
|
37
49
|
[data-hl-accordion] > details[open] > summary::after {
|
|
38
|
-
|
|
50
|
+
rotate: 180deg;
|
|
39
51
|
}
|
|
40
52
|
|
|
41
53
|
[data-hl-accordion] > details > .hl-accordion-panel {
|
package/dist/alert.css
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Alert: `<div class="hl-alert" role="alert" data-hl-intent="
|
|
3
|
-
* optional icon, `.hl-alert-title`, and body content.
|
|
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.
|
|
4
5
|
* data-hl-intent: info (default) | success | warning | danger | neutral
|
|
5
6
|
*/
|
|
6
7
|
@layer components {
|
|
@@ -13,7 +14,7 @@
|
|
|
13
14
|
gap: var(--hl-space-3);
|
|
14
15
|
padding: var(--hl-space-3) var(--hl-space-4);
|
|
15
16
|
border: var(--hl-border-width) solid transparent;
|
|
16
|
-
border-
|
|
17
|
+
border-inline-start: 3px solid var(--_accent);
|
|
17
18
|
border-radius: var(--hl-radius-md);
|
|
18
19
|
background: var(--_bg);
|
|
19
20
|
color: var(--_fg);
|
|
@@ -47,9 +48,9 @@
|
|
|
47
48
|
|
|
48
49
|
.hl-alert > svg:first-child {
|
|
49
50
|
flex: none;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
margin-
|
|
51
|
+
inline-size: 1.25rem;
|
|
52
|
+
block-size: 1.25rem;
|
|
53
|
+
margin-block-start: 0.1rem;
|
|
53
54
|
color: var(--_accent);
|
|
54
55
|
}
|
|
55
56
|
|
|
@@ -57,7 +58,7 @@
|
|
|
57
58
|
display: flex;
|
|
58
59
|
flex-direction: column;
|
|
59
60
|
gap: var(--hl-space-1);
|
|
60
|
-
min-
|
|
61
|
+
min-inline-size: 0;
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
.hl-alert-title {
|
|
@@ -69,4 +70,11 @@
|
|
|
69
70
|
.hl-alert p {
|
|
70
71
|
margin: 0;
|
|
71
72
|
}
|
|
73
|
+
|
|
74
|
+
/* Fills are flattened in forced colors, so the outline carries the shape. */
|
|
75
|
+
@media (forced-colors: active) {
|
|
76
|
+
.hl-alert {
|
|
77
|
+
border-color: CanvasText;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
72
80
|
}
|
package/dist/avatar.css
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Avatar: `<span class="hl-avatar">` containing an `<img>` or fallback
|
|
3
|
-
* initials/icon. Stack with `<div class="hl-avatar-group">`.
|
|
3
|
+
* initials/icon. Stack with `<div class="hl-avatar-group">`. Pure CSS; there
|
|
4
|
+
* is no enhancer.
|
|
4
5
|
* data-hl-size: xs | sm | md (default) | lg | xl
|
|
5
6
|
* data-hl-shape: square
|
|
6
7
|
*/
|
|
@@ -10,25 +11,19 @@
|
|
|
10
11
|
|
|
11
12
|
position: relative;
|
|
12
13
|
display: inline-grid;
|
|
13
|
-
align-items: center;
|
|
14
|
-
justify-items: center;
|
|
15
14
|
place-items: center;
|
|
16
15
|
flex: none;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
height: 2.5rem;
|
|
20
|
-
height: var(--_size);
|
|
16
|
+
inline-size: var(--_size);
|
|
17
|
+
block-size: var(--_size);
|
|
21
18
|
border-radius: var(--hl-radius-full);
|
|
22
19
|
overflow: hidden;
|
|
23
20
|
background: var(--hl-surface-3);
|
|
24
21
|
color: var(--hl-fg-muted);
|
|
25
|
-
font-size: calc(2.5rem * 0.4);
|
|
26
22
|
font-size: calc(var(--_size) * 0.4);
|
|
27
23
|
font-weight: var(--hl-font-medium);
|
|
28
24
|
line-height: 1;
|
|
29
25
|
text-transform: uppercase;
|
|
30
26
|
-webkit-user-select: none;
|
|
31
|
-
-moz-user-select: none;
|
|
32
27
|
user-select: none;
|
|
33
28
|
}
|
|
34
29
|
|
|
@@ -37,10 +32,9 @@
|
|
|
37
32
|
}
|
|
38
33
|
|
|
39
34
|
.hl-avatar > img {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
object-fit: cover;
|
|
35
|
+
inline-size: 100%;
|
|
36
|
+
block-size: 100%;
|
|
37
|
+
object-fit: cover;
|
|
44
38
|
}
|
|
45
39
|
|
|
46
40
|
.hl-avatar[data-hl-size='xs'] {
|
|
@@ -69,6 +63,6 @@
|
|
|
69
63
|
}
|
|
70
64
|
|
|
71
65
|
.hl-avatar-group > .hl-avatar:not(:first-child) {
|
|
72
|
-
margin-
|
|
66
|
+
margin-inline-start: -0.6rem;
|
|
73
67
|
}
|
|
74
68
|
}
|
package/dist/badge.css
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Badge: `<span class="hl-badge" data-hl-intent="
|
|
2
|
+
* Badge: `<span class="hl-badge" data-hl-intent="..." data-hl-variant="...">`.
|
|
3
|
+
* Pure CSS; there is no enhancer.
|
|
3
4
|
* data-hl-intent: neutral (default) | primary | danger | success | warning | info
|
|
4
5
|
* data-hl-variant: soft (default) | solid | outline
|
|
5
6
|
* data-hl-size: sm | md (default)
|
|
@@ -81,4 +82,11 @@
|
|
|
81
82
|
padding: 0 var(--hl-space-1-5);
|
|
82
83
|
font-size: 0.6875rem;
|
|
83
84
|
}
|
|
85
|
+
|
|
86
|
+
/* Soft and solid fills disappear in forced colors; keep the pill outline. */
|
|
87
|
+
@media (forced-colors: active) {
|
|
88
|
+
.hl-badge {
|
|
89
|
+
border-color: CanvasText;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
84
92
|
}
|
package/dist/breadcrumb.css
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Breadcrumb: `<nav data-hl-breadcrumb aria-label="Breadcrumb">` wrapping an
|
|
3
|
+
* `<ol>` of links; the current page carries `aria-current="page"`. Pure CSS;
|
|
4
|
+
* there is no enhancer. Order follows the writing direction, so the trail
|
|
5
|
+
* reads right to left under RTL.
|
|
6
|
+
*/
|
|
1
7
|
@layer components {
|
|
2
8
|
nav[data-hl-breadcrumb] ol {
|
|
3
9
|
display: flex;
|
|
@@ -22,19 +28,17 @@
|
|
|
22
28
|
|
|
23
29
|
nav[data-hl-breadcrumb] a {
|
|
24
30
|
color: var(--hl-primary);
|
|
25
|
-
-webkit-text-decoration: none;
|
|
26
31
|
text-decoration: none;
|
|
27
32
|
border-radius: var(--hl-radius-sm);
|
|
28
33
|
}
|
|
29
34
|
|
|
30
35
|
nav[data-hl-breadcrumb] a:hover {
|
|
31
|
-
-webkit-text-decoration: underline;
|
|
32
36
|
text-decoration: underline;
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
nav[data-hl-breadcrumb] a:focus-visible {
|
|
36
40
|
outline: var(--hl-focus-ring);
|
|
37
|
-
outline-offset:
|
|
41
|
+
outline-offset: var(--hl-focus-offset);
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
nav[data-hl-breadcrumb] [aria-current='page'] {
|
package/dist/button.css
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Button: `<button class="hl-button">` (works on `<a>`/`<input>` too).
|
|
2
|
+
* Button: `<button class="hl-button">` (works on `<a>`/`<input>` too). Pure
|
|
3
|
+
* CSS; there is no enhancer.
|
|
3
4
|
*
|
|
4
5
|
* Color is driven by a small set of local custom properties so the
|
|
5
|
-
* intent
|
|
6
|
+
* intent by variant matrix stays DRY: `data-hl-intent` swaps the accent set,
|
|
6
7
|
* `data-hl-variant` decides how those values are applied.
|
|
7
8
|
*
|
|
8
9
|
* data-hl-variant: solid (default) | soft | outline | ghost | link
|
|
9
10
|
* data-hl-intent: neutral (default) | primary | danger | success | warning | info
|
|
10
11
|
* data-hl-size: sm | md (default) | lg
|
|
11
|
-
* data-hl-block: stretch to container
|
|
12
|
+
* data-hl-block: stretch to the container's inline size
|
|
12
13
|
* data-hl-icon: square, icon-only
|
|
14
|
+
* data-hl-loading: shows a spinner and blocks interaction
|
|
13
15
|
*/
|
|
14
16
|
@layer components {
|
|
15
17
|
.hl-button {
|
|
@@ -29,9 +31,8 @@
|
|
|
29
31
|
align-items: center;
|
|
30
32
|
justify-content: center;
|
|
31
33
|
gap: var(--_gap);
|
|
32
|
-
|
|
33
|
-
padding-
|
|
34
|
-
padding-right: var(--_pad-x);
|
|
34
|
+
block-size: var(--_height);
|
|
35
|
+
padding-inline: var(--_pad-x);
|
|
35
36
|
border: var(--hl-border-width) solid transparent;
|
|
36
37
|
border-radius: var(--hl-radius-md);
|
|
37
38
|
font-family: inherit;
|
|
@@ -39,16 +40,17 @@
|
|
|
39
40
|
font-weight: var(--hl-font-medium);
|
|
40
41
|
line-height: 1;
|
|
41
42
|
white-space: nowrap;
|
|
42
|
-
-webkit-text-decoration: none;
|
|
43
43
|
text-decoration: none;
|
|
44
44
|
cursor: pointer;
|
|
45
45
|
-webkit-user-select: none;
|
|
46
|
-
-moz-user-select: none;
|
|
47
46
|
user-select: none;
|
|
48
47
|
background: var(--_solid-bg);
|
|
49
48
|
color: var(--_solid-fg);
|
|
50
49
|
transition:
|
|
51
|
-
background-color var(--hl-duration-fast) var(--hl-ease-standard),
|
|
50
|
+
background-color var(--hl-duration-fast) var(--hl-ease-standard),
|
|
51
|
+
border-color var(--hl-duration-fast) var(--hl-ease-standard),
|
|
52
|
+
color var(--hl-duration-fast) var(--hl-ease-standard),
|
|
53
|
+
box-shadow var(--hl-duration-fast) var(--hl-ease-standard);
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
.hl-button:hover {
|
|
@@ -61,14 +63,14 @@
|
|
|
61
63
|
|
|
62
64
|
.hl-button:focus-visible {
|
|
63
65
|
outline: var(--hl-focus-ring);
|
|
64
|
-
outline-offset:
|
|
66
|
+
outline-offset: var(--hl-focus-offset);
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
.hl-button:disabled,
|
|
68
70
|
.hl-button[aria-disabled='true'],
|
|
69
71
|
.hl-button[data-hl-loading] {
|
|
70
72
|
cursor: not-allowed;
|
|
71
|
-
opacity:
|
|
73
|
+
opacity: var(--hl-disabled-opacity);
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
.hl-button[data-hl-loading] {
|
|
@@ -155,12 +157,11 @@
|
|
|
155
157
|
}
|
|
156
158
|
|
|
157
159
|
.hl-button[data-hl-variant='link'] {
|
|
158
|
-
|
|
160
|
+
block-size: auto;
|
|
159
161
|
padding: 0;
|
|
160
162
|
background: transparent;
|
|
161
163
|
color: var(--_accent);
|
|
162
164
|
border-color: transparent;
|
|
163
|
-
-webkit-text-decoration: underline;
|
|
164
165
|
text-decoration: underline;
|
|
165
166
|
text-underline-offset: 0.2em;
|
|
166
167
|
}
|
|
@@ -189,34 +190,34 @@
|
|
|
189
190
|
|
|
190
191
|
.hl-button[data-hl-block] {
|
|
191
192
|
display: flex;
|
|
192
|
-
|
|
193
|
+
inline-size: 100%;
|
|
193
194
|
}
|
|
194
195
|
|
|
195
196
|
.hl-button[data-hl-icon] {
|
|
196
|
-
|
|
197
|
-
padding-
|
|
198
|
-
padding-right: 0;
|
|
197
|
+
inline-size: var(--_height);
|
|
198
|
+
padding-inline: 0;
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
.hl-button > svg {
|
|
202
|
-
|
|
203
|
-
|
|
202
|
+
inline-size: 1.1em;
|
|
203
|
+
block-size: 1.1em;
|
|
204
204
|
flex: none;
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
.hl-button[data-hl-loading]::before {
|
|
208
208
|
content: '';
|
|
209
|
-
|
|
210
|
-
|
|
209
|
+
inline-size: 1em;
|
|
210
|
+
block-size: 1em;
|
|
211
211
|
border: 2px solid currentcolor;
|
|
212
|
-
border-
|
|
212
|
+
border-block-start-color: transparent;
|
|
213
213
|
border-radius: var(--hl-radius-full);
|
|
214
214
|
animation: hl-button-spin 0.6s linear infinite;
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
+
/* A static arc still reads as "busy" without continuous motion. */
|
|
217
218
|
@media (prefers-reduced-motion: reduce) {
|
|
218
219
|
.hl-button[data-hl-loading]::before {
|
|
219
|
-
animation
|
|
220
|
+
animation: none;
|
|
220
221
|
}
|
|
221
222
|
}
|
|
222
223
|
|
|
@@ -235,21 +236,40 @@
|
|
|
235
236
|
}
|
|
236
237
|
|
|
237
238
|
.hl-button-group > .hl-button:not(:first-child) {
|
|
238
|
-
margin-
|
|
239
|
+
margin-inline-start: calc(var(--hl-border-width) * -1);
|
|
239
240
|
}
|
|
240
241
|
|
|
241
242
|
.hl-button-group > .hl-button:first-child {
|
|
242
|
-
border-
|
|
243
|
-
border-
|
|
243
|
+
border-start-start-radius: var(--hl-radius-md);
|
|
244
|
+
border-end-start-radius: var(--hl-radius-md);
|
|
244
245
|
}
|
|
245
246
|
|
|
246
247
|
.hl-button-group > .hl-button:last-child {
|
|
247
|
-
border-
|
|
248
|
-
border-
|
|
248
|
+
border-start-end-radius: var(--hl-radius-md);
|
|
249
|
+
border-end-end-radius: var(--hl-radius-md);
|
|
249
250
|
}
|
|
250
251
|
|
|
251
252
|
.hl-button-group > .hl-button:hover,
|
|
252
253
|
.hl-button-group > .hl-button:focus-visible {
|
|
253
254
|
z-index: 1;
|
|
254
255
|
}
|
|
256
|
+
|
|
257
|
+
/* Forced colors flatten every fill to Canvas, so the border alone tells a
|
|
258
|
+
button apart from text; the link variant keeps reading as a link. */
|
|
259
|
+
@media (forced-colors: active) {
|
|
260
|
+
.hl-button {
|
|
261
|
+
border-color: ButtonBorder;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.hl-button[data-hl-variant='link'] {
|
|
265
|
+
border-color: transparent;
|
|
266
|
+
color: LinkText;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.hl-button:disabled,
|
|
270
|
+
.hl-button[aria-disabled='true'] {
|
|
271
|
+
color: GrayText;
|
|
272
|
+
border-color: GrayText;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
255
275
|
}
|
package/dist/card.css
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
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
|
+
* Pure CSS; there is no enhancer.
|
|
4
5
|
* data-hl-interactive: hover/active elevation for clickable cards
|
|
5
6
|
*/
|
|
6
7
|
@layer components {
|
|
@@ -19,7 +20,7 @@
|
|
|
19
20
|
flex-direction: column;
|
|
20
21
|
gap: var(--hl-space-1);
|
|
21
22
|
padding: var(--hl-space-4) var(--hl-space-5);
|
|
22
|
-
border-
|
|
23
|
+
border-block-end: var(--hl-border-width) solid var(--hl-border);
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
.hl-card-body {
|
|
@@ -32,7 +33,7 @@
|
|
|
32
33
|
align-items: center;
|
|
33
34
|
gap: var(--hl-space-2);
|
|
34
35
|
padding: var(--hl-space-4) var(--hl-space-5);
|
|
35
|
-
border-
|
|
36
|
+
border-block-start: var(--hl-border-width) solid var(--hl-border);
|
|
36
37
|
background: var(--hl-surface-2);
|
|
37
38
|
}
|
|
38
39
|
|
|
@@ -52,7 +53,9 @@
|
|
|
52
53
|
.hl-card[data-hl-interactive] {
|
|
53
54
|
cursor: pointer;
|
|
54
55
|
transition:
|
|
55
|
-
border-color var(--hl-duration-fast) var(--hl-ease-standard),
|
|
56
|
+
border-color var(--hl-duration-fast) var(--hl-ease-standard),
|
|
57
|
+
box-shadow var(--hl-duration-base) var(--hl-ease-standard),
|
|
58
|
+
translate var(--hl-duration-base) var(--hl-ease-standard);
|
|
56
59
|
}
|
|
57
60
|
|
|
58
61
|
.hl-card[data-hl-interactive]:hover {
|
|
@@ -62,10 +65,10 @@
|
|
|
62
65
|
|
|
63
66
|
.hl-card[data-hl-interactive]:focus-within {
|
|
64
67
|
outline: var(--hl-focus-ring);
|
|
65
|
-
outline-offset:
|
|
68
|
+
outline-offset: var(--hl-focus-offset);
|
|
66
69
|
}
|
|
67
70
|
|
|
68
71
|
.hl-card[data-hl-interactive]:active {
|
|
69
|
-
|
|
72
|
+
translate: 0 1px;
|
|
70
73
|
}
|
|
71
74
|
}
|
package/dist/checkbox.css
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Checkbox: `<label class="hl-checkbox"><input type="checkbox"><span
|
|
3
|
-
* The native input is restyled (appearance:none) with a CSS checkmark, keeping
|
|
4
|
-
* full keyboard
|
|
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. Pure CSS; there is no enhancer.
|
|
5
5
|
*/
|
|
6
6
|
@layer components {
|
|
7
7
|
.hl-checkbox {
|
|
@@ -14,34 +14,33 @@
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
.hl-checkbox > input[type='checkbox'] {
|
|
17
|
-
|
|
18
|
-
-moz-appearance: none;
|
|
19
|
-
appearance: none;
|
|
17
|
+
appearance: none;
|
|
20
18
|
flex: none;
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
inline-size: 1.15rem;
|
|
20
|
+
block-size: 1.15rem;
|
|
23
21
|
margin: 0;
|
|
24
22
|
border: var(--hl-border-width-2) solid var(--hl-border-strong);
|
|
25
23
|
border-radius: var(--hl-radius-sm);
|
|
26
24
|
background: var(--hl-surface);
|
|
27
25
|
display: grid;
|
|
28
|
-
align-content: center;
|
|
29
|
-
justify-content: center;
|
|
30
26
|
place-content: center;
|
|
31
27
|
cursor: pointer;
|
|
32
28
|
transition:
|
|
33
|
-
background-color var(--hl-duration-fast) var(--hl-ease-standard),
|
|
29
|
+
background-color var(--hl-duration-fast) var(--hl-ease-standard),
|
|
30
|
+
border-color var(--hl-duration-fast) var(--hl-ease-standard);
|
|
34
31
|
}
|
|
35
32
|
|
|
33
|
+
/* The mark is a rotated L drawn with two borders; direction-neutral. */
|
|
36
34
|
.hl-checkbox > input[type='checkbox']::after {
|
|
37
35
|
content: '';
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
inline-size: 0.34rem;
|
|
37
|
+
block-size: 0.62rem;
|
|
40
38
|
border: solid var(--hl-primary-fg);
|
|
41
39
|
border-width: 0 2px 2px 0;
|
|
42
|
-
margin-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
margin-block-start: -2px;
|
|
41
|
+
rotate: 45deg;
|
|
42
|
+
scale: 0;
|
|
43
|
+
transition: scale var(--hl-duration-fast) var(--hl-ease-emphasized);
|
|
45
44
|
}
|
|
46
45
|
|
|
47
46
|
.hl-checkbox > input[type='checkbox']:checked,
|
|
@@ -51,29 +50,39 @@
|
|
|
51
50
|
}
|
|
52
51
|
|
|
53
52
|
.hl-checkbox > input[type='checkbox']:checked::after {
|
|
54
|
-
|
|
53
|
+
scale: 1;
|
|
55
54
|
}
|
|
56
55
|
|
|
57
56
|
.hl-checkbox > input[type='checkbox']:indeterminate::after {
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
inline-size: 0.6rem;
|
|
58
|
+
block-size: 0;
|
|
60
59
|
margin: 0;
|
|
61
60
|
border-width: 0 0 2px;
|
|
62
|
-
|
|
61
|
+
rotate: none;
|
|
62
|
+
scale: 1;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
.hl-checkbox > input[type='checkbox']:focus-visible {
|
|
66
66
|
outline: var(--hl-focus-ring);
|
|
67
|
-
outline-offset:
|
|
67
|
+
outline-offset: var(--hl-focus-offset);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
.hl-checkbox > input[type='checkbox']:disabled {
|
|
71
71
|
cursor: not-allowed;
|
|
72
|
-
opacity:
|
|
72
|
+
opacity: var(--hl-disabled-opacity);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
.hl-checkbox:has(> input:disabled) {
|
|
76
76
|
cursor: not-allowed;
|
|
77
77
|
color: var(--hl-fg-subtle);
|
|
78
78
|
}
|
|
79
|
+
|
|
80
|
+
/* The custom-drawn mark must keep its own colors to stay visible on the
|
|
81
|
+
Highlight fill; everything else follows the system palette. */
|
|
82
|
+
@media (forced-colors: active) {
|
|
83
|
+
.hl-checkbox > input[type='checkbox']::after {
|
|
84
|
+
forced-color-adjust: none;
|
|
85
|
+
border-color: HighlightText;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
79
88
|
}
|