@uncinq/css-components 1.16.2 → 1.16.4
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 +11 -10
- package/css/components/alert.css +5 -0
- package/css/components/panel.css +8 -6
- package/docs/_index.md +0 -84
- package/docs/buttons/_index.md +7 -0
- package/docs/buttons/btn-close.md +58 -0
- package/docs/buttons/btn-filter.md +36 -0
- package/docs/buttons/btn-menu.md +39 -0
- package/docs/buttons/btn-search.md +40 -0
- package/docs/buttons/btn-share.md +33 -0
- package/docs/buttons/btn-toc.md +23 -0
- package/docs/buttons/btn-toggle-video.md +58 -0
- package/docs/buttons/btn.md +95 -0
- package/docs/buttons/overview.md +75 -0
- package/docs/cascade-layers.md +9 -7
- package/docs/content/_index.md +7 -0
- package/docs/content/alert.md +97 -0
- package/docs/content/badge.md +50 -0
- package/docs/content/banner.md +43 -0
- package/docs/content/card.md +93 -0
- package/docs/content/items.md +76 -0
- package/docs/content/list.md +41 -0
- package/docs/content/media.md +88 -0
- package/docs/content/overview.md +39 -0
- package/docs/content/surtitle.md +43 -0
- package/docs/embeds/_index.md +7 -0
- package/docs/embeds/embed.md +53 -0
- package/docs/embeds/map.md +57 -0
- package/docs/embeds/overview.md +25 -0
- package/docs/embeds/video.md +53 -0
- package/docs/forms/_index.md +7 -0
- package/docs/forms/form-check.md +77 -0
- package/docs/forms/form.md +67 -0
- package/docs/forms/overview.md +31 -0
- package/docs/navigation/_index.md +7 -0
- package/docs/navigation/breadcrumb.md +59 -0
- package/docs/navigation/nav-accessibility.md +67 -0
- package/docs/navigation/nav-title.md +43 -0
- package/docs/navigation/nav.md +65 -0
- package/docs/navigation/overview.md +29 -0
- package/docs/navigation/pagination.md +77 -0
- package/docs/overlays/_index.md +7 -0
- package/docs/overlays/drawer.md +58 -0
- package/docs/overlays/dropdown.md +87 -0
- package/docs/overlays/modal.md +75 -0
- package/docs/overlays/overview.md +34 -0
- package/docs/overlays/panel.md +159 -0
- package/docs/overview.md +93 -0
- package/docs/utilities/_index.md +7 -0
- package/docs/utilities/overview.md +21 -0
- package/docs/{utilities.md → utilities/scrollsnap.md} +26 -9
- package/package.json +1 -1
- package/docs/buttons.md +0 -103
- package/docs/content.md +0 -145
- package/docs/embeds.md +0 -66
- package/docs/forms.md +0 -80
- package/docs/navigation.md +0 -93
- package/docs/overlays.md +0 -133
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
isIndex: false
|
|
3
|
-
title:
|
|
4
|
-
description:
|
|
5
|
-
weight:
|
|
6
|
-
icon:
|
|
3
|
+
title: Scrollsnap
|
|
4
|
+
description: Turns a grid into a horizontal snap carousel below a breakpoint, bleeding into the gutter so the next item peeks in.
|
|
5
|
+
weight: 2
|
|
6
|
+
icon: arrow-left-right
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
## `.scrollsnap`
|
|
10
|
-
|
|
11
9
|
Turns a grid into a horizontal carousel with snap points. Items keep their own width, the grid stops wrapping, and the row scrolls sideways, bleeding into the gutter so the next item peeks in.
|
|
12
10
|
|
|
13
11
|
```html
|
|
@@ -34,9 +32,22 @@ This is the one thing to get right, and it reads backwards from most responsive
|
|
|
34
32
|
|
|
35
33
|
**The suffix names the rung where the carousel STOPS and the grid comes back.** `.scrollsnap-md` is a carousel on mobile and tablet, and a grid from 1024px up.
|
|
36
34
|
|
|
37
|
-
##
|
|
35
|
+
## How a variant hands the grid back
|
|
36
|
+
|
|
37
|
+
Above its rung, every property is set to `revert-layer` rather than to a second set of values:
|
|
38
|
+
|
|
39
|
+
```css
|
|
40
|
+
@media (--md) {
|
|
41
|
+
.scrollsnap-md {
|
|
42
|
+
grid-auto-flow: revert-layer;
|
|
43
|
+
grid-template-columns: revert-layer;
|
|
44
|
+
margin-inline: revert-layer;
|
|
45
|
+
/* … */
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
38
49
|
|
|
39
|
-
|
|
50
|
+
`revert-layer` hands the property back to the layer below, which is the component's own grid rule in `@layer components`. So there is no duplicated set of grid values to keep in step: whatever `.items` declares is what comes back, including any override you wrote yourself.
|
|
40
51
|
|
|
41
52
|
## Item width
|
|
42
53
|
|
|
@@ -51,7 +62,7 @@ Items take `--items-min-width`, the same value that drives the grid, capped by `
|
|
|
51
62
|
|
|
52
63
|
## The bleed, and why margin and padding disagree
|
|
53
64
|
|
|
54
|
-
The row pulls out to the screen edge using `--container-bleed`, published by `.container` in [css-base](
|
|
65
|
+
The row pulls out to the screen edge using `--container-bleed`, published by `.container` in [css-base](../../../css-base/layouts/container/#the---container-bleed-contract). The property inherits, so it reaches the row from a `.container` however far up it sits.
|
|
55
66
|
|
|
56
67
|
Outside a container there is no published value, and the two `var()` fallbacks differ **on purpose**, because margin and padding answer different questions:
|
|
57
68
|
|
|
@@ -65,3 +76,9 @@ Inside a container the two collapse to one value: both read the published bleed,
|
|
|
65
76
|
`scroll-margin-inline` follows the **padding**, not the margin. It is what makes an item snap flush with the content edge rather than the padding edge, so it has to cancel the padding whatever the margin does.
|
|
66
77
|
|
|
67
78
|
This is the same reasoning as the `--container-bleed` contract itself, applied to a scroll container. If you write your own full-bleed component, copy the pair rather than picking one fallback for both.
|
|
79
|
+
|
|
80
|
+
## It needs a build step
|
|
81
|
+
|
|
82
|
+
The four responsive variants are written with `@media (--sm)` and its siblings, which rely on the `@custom-media` rules declared in css-base. No browser implements `@custom-media`, so without [postcss-custom-media](https://www.npmjs.com/package/postcss-custom-media) every `.scrollsnap-*` variant becomes a permanent carousel: the base block applies and the block that hands the grid back is dropped.
|
|
83
|
+
|
|
84
|
+
The failure is silent. See [the package index](../../).
|
package/package.json
CHANGED
package/docs/buttons.md
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
isIndex: false
|
|
3
|
-
title: Buttons
|
|
4
|
-
description: The .btn base class with its colour, size and style variants, and the seven specialised buttons built on it.
|
|
5
|
-
weight: 2
|
|
6
|
-
icon: hand-index
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## `.btn`
|
|
10
|
-
|
|
11
|
-
The base class. Works on `<button>`, `<a>` and `<input type="submit">`, and reads `--btn-*` from [@uncinq/component-tokens](../../component-tokens/reference/).
|
|
12
|
-
|
|
13
|
-
```html
|
|
14
|
-
<button class="btn">Send</button>
|
|
15
|
-
<a class="btn btn-secondary" href="/contact">Contact</a>
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
### Colour variants
|
|
19
|
-
|
|
20
|
-
| Class | Intent |
|
|
21
|
-
| --- | --- |
|
|
22
|
-
| `.btn-primary` | Primary action |
|
|
23
|
-
| `.btn-secondary` | Secondary action |
|
|
24
|
-
| `.btn-brand` | Brand-coloured |
|
|
25
|
-
| `.btn-neutral` | Neutral emphasis |
|
|
26
|
-
| `.btn-dark` | Dark surface |
|
|
27
|
-
| `.btn-light` | Light surface |
|
|
28
|
-
| `.btn-success` | Confirmation |
|
|
29
|
-
| `.btn-danger` | Destructive action |
|
|
30
|
-
| `.btn-warning` | Warning |
|
|
31
|
-
| `.btn-info` | Informational |
|
|
32
|
-
|
|
33
|
-
Each variant sets `--btn-color-background`, `--btn-color-border` and `--btn-color-text` together. The text colour always comes from the matching `--color-text-on-*` semantic token, so contrast is preserved when the underlying colour is overridden. That pairing is the reason to change `--color-brand` rather than `--btn-color-background` when rebranding.
|
|
34
|
-
|
|
35
|
-
### Sizes
|
|
36
|
-
|
|
37
|
-
| Class | Use |
|
|
38
|
-
| --- | --- |
|
|
39
|
-
| `.btn-xs` | Dense UI, inline controls |
|
|
40
|
-
| `.btn-sm` | Compact |
|
|
41
|
-
| `.btn-md` | Default, can be omitted |
|
|
42
|
-
| `.btn-lg` | Prominent |
|
|
43
|
-
| `.btn-xl` | Hero call to action |
|
|
44
|
-
|
|
45
|
-
### Style variants
|
|
46
|
-
|
|
47
|
-
| Class | Effect |
|
|
48
|
-
| --- | --- |
|
|
49
|
-
| `.btn-ghost` | Transparent background, visible border |
|
|
50
|
-
| `.btn-link` | Renders as a link, no background or border |
|
|
51
|
-
| `.btn-control` | Form control styling, transparent border, for buttons sitting next to inputs |
|
|
52
|
-
|
|
53
|
-
Variants compose: `class="btn btn-danger btn-sm btn-ghost"`.
|
|
54
|
-
|
|
55
|
-
## Specialised buttons
|
|
56
|
-
|
|
57
|
-
Seven single-purpose buttons. Read the second column before using one: whether `.btn` is required differs between them.
|
|
58
|
-
|
|
59
|
-
| Class | Needs `.btn` | Icon | Purpose |
|
|
60
|
-
| --- | --- | --- | --- |
|
|
61
|
-
| `.btn-close` | no | `--icon-close` | Close control, used inside panels and alerts |
|
|
62
|
-
| `.btn-menu` | no | `--icon-menu` | Menu toggle, typically the burger in a header |
|
|
63
|
-
| `.btn-search` | yes | `--icon-search` | Search toggle |
|
|
64
|
-
| `.btn-filter` | yes | `--icon-filter` | Filters toggle |
|
|
65
|
-
| `.btn-share` | yes | `--icon-share` | Share control |
|
|
66
|
-
| `.btn-toc` | yes | `--icon-toc` | Table of contents toggle |
|
|
67
|
-
| `.btn-toggle-video` | yes | child elements | Play and pause control overlaid on a video |
|
|
68
|
-
|
|
69
|
-
```html
|
|
70
|
-
<!-- self-contained -->
|
|
71
|
-
<button class="btn-close" aria-label="Close"></button>
|
|
72
|
-
|
|
73
|
-
<!-- modifier on .btn -->
|
|
74
|
-
<button class="btn btn-search" aria-label="Search"></button>
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
`.btn-close` and `.btn-menu` redeclare everything they need, with `--btn-close-*` and `--btn-menu-*` falling back to the matching `--btn-*` token. They therefore look consistent with `.btn` without depending on it. The other five are modifiers, and omitting the base class leaves them largely unstyled.
|
|
78
|
-
|
|
79
|
-
Six of the seven **do ship their icon**, drawn as a `mask` on `::before` from the icon tokens in [@uncinq/design-tokens](../../design-tokens/reference/#icon). Because it is a mask rather than a background image, the glyph takes `currentColor` and follows the button's text colour through every state. Size it with `--icon-size`, or per button with `--btn-close-icon-size` and its siblings.
|
|
80
|
-
|
|
81
|
-
`.btn-toggle-video` is the exception and expects two child elements, for the reason given below.
|
|
82
|
-
|
|
83
|
-
When a button has no visible text, give it an accessible name with `aria-label`, or a `.visually-hidden` span from [css-base](../../css-base/base/#accessibility-helpers). None of these buttons provides one for you.
|
|
84
|
-
|
|
85
|
-
## `.btn-toggle-video`
|
|
86
|
-
|
|
87
|
-
The one worth explaining, because its behaviour is driven by a state class rather than by CSS alone.
|
|
88
|
-
|
|
89
|
-
It is a play and pause control overlaid on a video that autoplays without native controls, which WCAG requires to be pausable. It stays transparent so the video shows through, and the `.is-playing` class, toggled by whatever script drives the video, decides which of the two icons is shown.
|
|
90
|
-
|
|
91
|
-
```html
|
|
92
|
-
<div class="video">
|
|
93
|
-
<video autoplay muted loop playsinline></video>
|
|
94
|
-
<button class="btn btn-toggle-video is-playing" aria-label="Pause">
|
|
95
|
-
<span class="icon-pause"></span>
|
|
96
|
-
<span class="icon-play"></span>
|
|
97
|
-
</button>
|
|
98
|
-
</div>
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
The `.video` wrapper is what positions it. See [Embeds](../embeds/).
|
|
102
|
-
|
|
103
|
-
Your script owns two things: toggling `.is-playing` in step with the video's actual state, and keeping the accessible name in sync, since the control means "pause" while playing and "play" while paused.
|
package/docs/content.md
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
isIndex: false
|
|
3
|
-
title: Content
|
|
4
|
-
description: Alerts, badges, banners, cards, the items grid, labelled lists, media objects and surtitles.
|
|
5
|
-
weight: 4
|
|
6
|
-
icon: card-text
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## `.alert`
|
|
10
|
-
|
|
11
|
-
An inline notification block.
|
|
12
|
-
|
|
13
|
-
```html
|
|
14
|
-
<div class="alert alert-info">
|
|
15
|
-
<p class="alert-heading">Heads up</p>
|
|
16
|
-
<p>Your changes were saved.</p>
|
|
17
|
-
</div>
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
Variants: `.alert-primary`, `.alert-secondary`, `.alert-brand`, `.alert-neutral`, `.alert-dark`, `.alert-light`, `.alert-success`, `.alert-danger`, `.alert-warning`, `.alert-info`.
|
|
21
|
-
|
|
22
|
-
Each sets the background, border and text colour from the matching `-muted` and `-strong` semantic tokens, so the pairing stays legible if the underlying colour changes.
|
|
23
|
-
|
|
24
|
-
Two behaviours are worth knowing. `--color-link` is reassigned to the alert's own text colour, so links inside an alert do not fall back to the page link colour against a tinted background. And an alert whose first child is an `.icon`, with no `.alert-heading`, switches to a horizontal layout automatically.
|
|
25
|
-
|
|
26
|
-
`.container` inside an alert inherits the same flex layout, which is what lets a full-bleed alert keep its content aligned with the rest of the page.
|
|
27
|
-
|
|
28
|
-
## `.banner`
|
|
29
|
-
|
|
30
|
-
A thin variation on the alert, centred rather than start-aligned. It sets `--alert-align: center` and flattens paragraph margins, and nothing else.
|
|
31
|
-
|
|
32
|
-
```html
|
|
33
|
-
<div class="alert banner">
|
|
34
|
-
<p>Site-wide announcement.</p>
|
|
35
|
-
</div>
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
It is a modifier on `.alert`, so use both classes.
|
|
39
|
-
|
|
40
|
-
## `.badge`
|
|
41
|
-
|
|
42
|
-
A small inline label.
|
|
43
|
-
|
|
44
|
-
```html
|
|
45
|
-
<span class="badge badge-success">Published</span>
|
|
46
|
-
<a class="badge" href="/tag/css">css</a>
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
Variants mirror the alert set: `.badge-primary`, `.badge-secondary`, `.badge-brand`, `.badge-neutral`, `.badge-dark`, `.badge-light`, `.badge-success`, `.badge-danger`, `.badge-warning`, `.badge-info`.
|
|
50
|
-
|
|
51
|
-
Hover styles apply only to `a.badge`, guarded by `@media (hover: hover) and (pointer: fine)`, so a static badge never looks interactive.
|
|
52
|
-
|
|
53
|
-
## `.card`
|
|
54
|
-
|
|
55
|
-
A self-contained content card.
|
|
56
|
-
|
|
57
|
-
```html
|
|
58
|
-
<article class="card">
|
|
59
|
-
<div class="content">
|
|
60
|
-
<p class="surtitle">Category</p>
|
|
61
|
-
<p class="title">Card title</p>
|
|
62
|
-
<p class="description">Short description.</p>
|
|
63
|
-
</div>
|
|
64
|
-
<div class="media">
|
|
65
|
-
<picture>...</picture>
|
|
66
|
-
</div>
|
|
67
|
-
</article>
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
The media block sits first visually, through `--card-media-order: -1`, regardless of its position in the markup. Put it after the content so that screen readers and search engines reach the text first.
|
|
71
|
-
|
|
72
|
-
Wrapping the content in `a.content` makes the whole card clickable, using a `::before` overlay that covers the card. Focus is then handled on the card itself with `:has(a.content:focus-visible)`, so the focus ring outlines the card rather than an invisible box. Nested interactive elements inside such a card will be unreachable, which is the known trade-off of this pattern.
|
|
73
|
-
|
|
74
|
-
Sizing with `--card-max-width` and `--card-width` is unset by default. Prefer `ch` units, so the width tracks the text measure.
|
|
75
|
-
|
|
76
|
-
{{< alert-block state="info" >}}
|
|
77
|
-
The source comment in `card.css` describes `.card` as a backwards-compatible alias for `.item` and recommends using `.item` directly. That is misleading for anyone consuming this package on its own: **`.item` is not defined here**. It lives in the Hugolify design system theme. Within `@uncinq/css-components`, `.card` is a complete implementation and the class to use.
|
|
78
|
-
{{< /alert-block >}}
|
|
79
|
-
|
|
80
|
-
## `.items`
|
|
81
|
-
|
|
82
|
-
A responsive grid, and the usual container for cards.
|
|
83
|
-
|
|
84
|
-
```html
|
|
85
|
-
<div class="items">
|
|
86
|
-
<article class="card">...</article>
|
|
87
|
-
<article class="card">...</article>
|
|
88
|
-
</div>
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
The column count is intrinsic rather than breakpoint-driven:
|
|
92
|
-
|
|
93
|
-
```css
|
|
94
|
-
grid-template-columns: repeat(
|
|
95
|
-
var(--items-cols, auto-fill),
|
|
96
|
-
minmax(min(var(--items-min-width, var(--max-width-item)), 100%), 1fr)
|
|
97
|
-
);
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
Items wrap when they no longer fit at `--items-min-width`, with no media query involved. Set `--items-cols` to a number to force a fixed count instead.
|
|
101
|
-
|
|
102
|
-
It also declares `container-type: inline-size` and `container-name: items`, so children can use container queries against the grid rather than the viewport.
|
|
103
|
-
|
|
104
|
-
Pair it with [`.scrollsnap`](../utilities/) to turn the grid into a horizontal carousel below a given breakpoint.
|
|
105
|
-
|
|
106
|
-
## `.list`
|
|
107
|
-
|
|
108
|
-
A compact labelled list with dash markers.
|
|
109
|
-
|
|
110
|
-
```html
|
|
111
|
-
<div class="list">
|
|
112
|
-
<p>Optional label</p>
|
|
113
|
-
<ul>
|
|
114
|
-
<li>First</li>
|
|
115
|
-
<li>Second</li>
|
|
116
|
-
</ul>
|
|
117
|
-
</div>
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
The wrapper is a `div`, with the label as a sibling of the list rather than inside it. Either `ul` or `ol` works.
|
|
121
|
-
|
|
122
|
-
## `.media`
|
|
123
|
-
|
|
124
|
-
The structural base for media blocks, controlling aspect ratio, background and border.
|
|
125
|
-
|
|
126
|
-
| Class | Use |
|
|
127
|
-
| --- | --- |
|
|
128
|
-
| `.media` | Base, for a picture or video |
|
|
129
|
-
| `.media-logo` | Logo, typically contained rather than cropped |
|
|
130
|
-
| `.media-icon` | Icon, sized from `--icon-size` |
|
|
131
|
-
|
|
132
|
-
`.media-logo` and `.media-icon` build on `.media`. Inside a `.card`, the card reassigns `--media-color-background` and `--media-ratio` from its own `--card-media-*` tokens, so a media block adapts to its context without a variant class.
|
|
133
|
-
|
|
134
|
-
A `.video` inside a `.media` is stretched to fill it. See [Embeds](../embeds/).
|
|
135
|
-
|
|
136
|
-
## `.surtitle`
|
|
137
|
-
|
|
138
|
-
An eyebrow label above a heading.
|
|
139
|
-
|
|
140
|
-
```html
|
|
141
|
-
<p class="surtitle">Category</p>
|
|
142
|
-
<h2>Main title</h2>
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
Inside a `.card` it gets a negative `--surtitle-margin-block-end`, pulling it closer to the title so the pair reads as one unit.
|
package/docs/embeds.md
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
isIndex: false
|
|
3
|
-
title: Embeds
|
|
4
|
-
description: Aspect-ratio wrappers for third-party embeds, native video and maps.
|
|
5
|
-
weight: 6
|
|
6
|
-
icon: play-btn
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## `.embed`
|
|
10
|
-
|
|
11
|
-
A responsive container for third-party embeds, holding an aspect ratio so the page does not reflow once the iframe loads.
|
|
12
|
-
|
|
13
|
-
```html
|
|
14
|
-
<div class="embed">
|
|
15
|
-
<iframe src="https://..." title="Video title" allowfullscreen></iframe>
|
|
16
|
-
</div>
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
Accepts `iframe`, `video`, `embed` or `object` as its child. The ratio comes from `--embed-ratio`, which defaults to the video ratio token. Override it per instance for a square or portrait embed:
|
|
20
|
-
|
|
21
|
-
```html
|
|
22
|
-
<div class="embed" style="--embed-ratio: 1">...</div>
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
Always give the `iframe` a `title`. It is the only accessible name an embedded frame has.
|
|
26
|
-
|
|
27
|
-
## `.video`
|
|
28
|
-
|
|
29
|
-
A wrapper for a **native** `<video>`, as opposed to an embedded player.
|
|
30
|
-
|
|
31
|
-
```html
|
|
32
|
-
<div class="video">
|
|
33
|
-
<video autoplay muted loop playsinline></video>
|
|
34
|
-
<button class="btn btn-toggle-video is-playing" aria-label="Pause">
|
|
35
|
-
<span class="icon-pause"></span>
|
|
36
|
-
<span class="icon-play"></span>
|
|
37
|
-
</button>
|
|
38
|
-
</div>
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
The wrapper positions the optional toggle control over the video. Inside a `.media`, the wrapper is stretched to fill it, so a video and an image are interchangeable within a card.
|
|
42
|
-
|
|
43
|
-
The control is there for a reason rather than for decoration. A video that autoplays without native controls must be pausable to meet WCAG, which is exactly what `.btn-toggle-video` provides. If your video carries `controls`, you do not need it. See [Buttons](../buttons/#btn-toggle-video) for the `.is-playing` contract.
|
|
44
|
-
|
|
45
|
-
## `.map`
|
|
46
|
-
|
|
47
|
-
A map container, driven by Leaflet through a `js-map` hook.
|
|
48
|
-
|
|
49
|
-
```html
|
|
50
|
-
<div class="map js-map"
|
|
51
|
-
data-markers="[...]"
|
|
52
|
-
data-zoom="12"
|
|
53
|
-
data-tile="3"
|
|
54
|
-
data-marker-hidden="false"></div>
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
| Attribute | Role |
|
|
58
|
-
| --- | --- |
|
|
59
|
-
| `data-markers` | The markers to plot |
|
|
60
|
-
| `data-zoom` | Initial zoom level |
|
|
61
|
-
| `data-tile` | Tile layer selection |
|
|
62
|
-
| `data-marker-hidden` | Whether markers start hidden |
|
|
63
|
-
|
|
64
|
-
This package provides the container only: sizing, background and border. Leaflet itself, its stylesheet and the script reading those attributes are yours to supply.
|
|
65
|
-
|
|
66
|
-
Leaflet's own CSS is a good example of why the layer order matters. Import it into `@layer libs` and any adjustments you write into `@layer vendors`, so that a lazily loaded Leaflet cannot outrank your own rules on source order. See [Cascade layers](../cascade-layers/).
|
package/docs/forms.md
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
isIndex: false
|
|
3
|
-
title: Forms
|
|
4
|
-
description: The .form grid, its layout helpers, and where the actual control styling lives.
|
|
5
|
-
weight: 7
|
|
6
|
-
icon: ui-checks
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
Form **controls** are styled by [@uncinq/css-base](../../css-base/base/#forms), on the native elements themselves. There is no `.input` or `.select` class to apply.
|
|
10
|
-
|
|
11
|
-
This package adds only what css-base cannot: the layout around those controls.
|
|
12
|
-
|
|
13
|
-
## `.form`
|
|
14
|
-
|
|
15
|
-
A responsive two-column grid that collapses to one column when there is not enough room.
|
|
16
|
-
|
|
17
|
-
```html
|
|
18
|
-
<form class="form">
|
|
19
|
-
<div>
|
|
20
|
-
<label for="first">First name</label>
|
|
21
|
-
<input id="first" type="text">
|
|
22
|
-
</div>
|
|
23
|
-
<div>
|
|
24
|
-
<label for="last">Last name</label>
|
|
25
|
-
<input id="last" type="text">
|
|
26
|
-
</div>
|
|
27
|
-
<div class="full">
|
|
28
|
-
<label for="message">Message</label>
|
|
29
|
-
<textarea id="message"></textarea>
|
|
30
|
-
<p class="help">Markdown is supported.</p>
|
|
31
|
-
</div>
|
|
32
|
-
<div class="actions">
|
|
33
|
-
<button class="btn" type="submit">Send</button>
|
|
34
|
-
</div>
|
|
35
|
-
</form>
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
The column rule is worth reading once:
|
|
39
|
-
|
|
40
|
-
```css
|
|
41
|
-
grid-template-columns: repeat(
|
|
42
|
-
auto-fill,
|
|
43
|
-
minmax(max(var(--form-col-min-width, 25ch), calc(50% - var(--gap) / 2)), 1fr)
|
|
44
|
-
);
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
The `max()` sets a floor of `25ch` **and** caps the result at half the width. The effect is a form that is one column or two, never three, however wide the container gets. A three-column form is almost never what you want, because it breaks the vertical reading order of a sequence of fields.
|
|
48
|
-
|
|
49
|
-
Change the floor with `--form-col-min-width`.
|
|
50
|
-
|
|
51
|
-
## Layout helpers
|
|
52
|
-
|
|
53
|
-
| Class | Effect |
|
|
54
|
-
| --- | --- |
|
|
55
|
-
| `.full` | Spans both columns, `grid-column: 1 / -1` |
|
|
56
|
-
| `.actions` | Spans both columns and stacks its children vertically |
|
|
57
|
-
| `.help` | Help text under a field |
|
|
58
|
-
| `.form-check` | A checkbox or radio laid out inline with its label |
|
|
59
|
-
|
|
60
|
-
```html
|
|
61
|
-
<div class="form-check">
|
|
62
|
-
<input id="terms" type="checkbox">
|
|
63
|
-
<label for="terms">I accept the terms</label>
|
|
64
|
-
</div>
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
`.form-check` is deliberately minimal, just `display: flex`. The checkbox and radio appearance, including the gap with the adjacent label, comes from css-base, which styles `[type='checkbox'] + label` directly.
|
|
68
|
-
|
|
69
|
-
## Accessibility
|
|
70
|
-
|
|
71
|
-
Nothing here supplies an accessible name. Every control needs a `<label for>` pointing at its `id`, or a `.visually-hidden` label when the design has no room for a visible one.
|
|
72
|
-
|
|
73
|
-
Tie `.help` text to its field with `aria-describedby`, otherwise it is visible but never announced:
|
|
74
|
-
|
|
75
|
-
```html
|
|
76
|
-
<input id="message" aria-describedby="message-help">
|
|
77
|
-
<p class="help" id="message-help">Markdown is supported.</p>
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
For error states, use `aria-invalid="true"` on the control and point `aria-describedby` at the error message.
|
package/docs/navigation.md
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
isIndex: false
|
|
3
|
-
title: Navigation
|
|
4
|
-
description: Navigation lists, skip links, breadcrumbs and pagination.
|
|
5
|
-
weight: 5
|
|
6
|
-
icon: signpost
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## `.nav`
|
|
10
|
-
|
|
11
|
-
The base navigation list, vertical by default.
|
|
12
|
-
|
|
13
|
-
```html
|
|
14
|
-
<ul class="nav">
|
|
15
|
-
<li><a href="/">Home</a></li>
|
|
16
|
-
<li><a href="/about">About</a></li>
|
|
17
|
-
</ul>
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
Works on `ul` or `ol`. **Direction is set by context, not by a modifier class**: a header lays its nav out horizontally by setting `flex-direction: row` on it. That keeps the component free of layout variants that would only ever be used in one place.
|
|
21
|
-
|
|
22
|
-
## `.nav-title`
|
|
23
|
-
|
|
24
|
-
A title within a navigation block, for labelling a group of links.
|
|
25
|
-
|
|
26
|
-
## `.nav-accessibility`
|
|
27
|
-
|
|
28
|
-
Skip links, for keyboard and assistive technology users.
|
|
29
|
-
|
|
30
|
-
```html
|
|
31
|
-
<ul class="nav nav-accessibility">
|
|
32
|
-
<li><a href="#main">Skip to content</a></li>
|
|
33
|
-
<li><a href="#navigation">Skip to navigation</a></li>
|
|
34
|
-
<li><a href="#footer">Skip to footer</a></li>
|
|
35
|
-
</ul>
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
Three things matter here, and getting any of them wrong defeats the purpose:
|
|
39
|
-
|
|
40
|
-
**It must be the first focusable element in `<body>`.** A skip link that comes after the navigation it skips is useless.
|
|
41
|
-
|
|
42
|
-
**It is hidden off-screen, not hidden.** It slides into view when a child receives focus. Using `display: none` would remove it from the tab order entirely.
|
|
43
|
-
|
|
44
|
-
**It requires the `.nav` base class** alongside it.
|
|
45
|
-
|
|
46
|
-
The targets must exist and be focusable. An `id` on a non-interactive element needs `tabindex="-1"` for the jump to move focus rather than just scroll.
|
|
47
|
-
|
|
48
|
-
## `.breadcrumb-wrapper`
|
|
49
|
-
|
|
50
|
-
The breadcrumb trail. Note that the class goes on the **wrapper**, not on the list itself.
|
|
51
|
-
|
|
52
|
-
```html
|
|
53
|
-
<nav class="breadcrumb-wrapper" aria-label="Breadcrumb">
|
|
54
|
-
<ol>
|
|
55
|
-
<li><a href="/">Home</a></li>
|
|
56
|
-
<li><a href="/docs">Docs</a></li>
|
|
57
|
-
<li aria-current="page">Navigation</li>
|
|
58
|
-
</ol>
|
|
59
|
-
</nav>
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
The separator is drawn from `--breadcrumb-separator`, which defaults to `"/"`. Mark the current page with `aria-current="page"` rather than relying on it being last.
|
|
63
|
-
|
|
64
|
-
## `.pagination`
|
|
65
|
-
|
|
66
|
-
A page navigation list.
|
|
67
|
-
|
|
68
|
-
```html
|
|
69
|
-
<nav role="navigation" aria-label="Pagination">
|
|
70
|
-
<ul class="pagination">
|
|
71
|
-
<li class="disabled"><a class="first">First</a></li>
|
|
72
|
-
<li><a class="previous">Previous</a></li>
|
|
73
|
-
<li class="item active"><a href="?page=1">1</a></li>
|
|
74
|
-
<li class="item item-adjacent"><a href="?page=2">2</a></li>
|
|
75
|
-
<li><a class="next">Next</a></li>
|
|
76
|
-
<li><a class="last">Last</a></li>
|
|
77
|
-
</ul>
|
|
78
|
-
</nav>
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
| Class | Role |
|
|
82
|
-
| --- | --- |
|
|
83
|
-
| `.first`, `.previous`, `.next`, `.last` | Navigation controls, on the `a` |
|
|
84
|
-
| `.item` | A page number, on the `li` |
|
|
85
|
-
| `.item-adjacent` | A page number next to the current one |
|
|
86
|
-
| `.active` | The current page |
|
|
87
|
-
| `.disabled` | An unavailable control, on the `li` |
|
|
88
|
-
|
|
89
|
-
`.item-adjacent` exists so that a responsive paginator can hide distant page numbers while keeping the immediate neighbours visible, which is the usual mobile treatment.
|
|
90
|
-
|
|
91
|
-
**The glyphs for `.first`, `.last`, `.previous` and `.next` are not provided.** This package positions and spaces them; the theme supplies the arrow through `a::before` or `a::after` content. A paginator with no theme styling will show the text labels only, which is a reasonable fallback but rarely what you want visually.
|
|
92
|
-
|
|
93
|
-
Note that `.item` here means a pagination entry, and is unrelated to the `.item` card unit mentioned in [Content](../content/).
|