@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
package/docs/overlays.md
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
isIndex: false
|
|
3
|
-
title: Overlays
|
|
4
|
-
description: The shared panel skeleton behind .modal and .drawer, the two opening strategies, and the .dropdown contract.
|
|
5
|
-
weight: 3
|
|
6
|
-
icon: window-stack
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## The shared panel skeleton
|
|
10
|
-
|
|
11
|
-
`.modal` and `.drawer` are the same panel. Same structure (header, content, footer), same open and closed contract, same backdrop. They differ only in where they sit: modal centres them, drawer sticks them to an edge.
|
|
12
|
-
|
|
13
|
-
`components/panel.css` owns every rule. The two variants are **pure configuration**: `modal.css` and `drawer.css` declare nothing but `--panel-*` tokens.
|
|
14
|
-
|
|
15
|
-
There is **no `.panel` class to apply.** The file targets `:where(.modal, .drawer)` directly, so the skeleton arrives with either variant class. `panel` names the shared concept and the token namespace, not a class.
|
|
16
|
-
|
|
17
|
-
```html
|
|
18
|
-
<dialog class="modal" id="contact" aria-labelledby="contactLabel">
|
|
19
|
-
<div class="header">
|
|
20
|
-
<p class="title" id="contactLabel">Contact</p>
|
|
21
|
-
<button class="btn-close js-dialog-close" aria-label="Close"></button>
|
|
22
|
-
</div>
|
|
23
|
-
<div class="content">...</div>
|
|
24
|
-
<div class="footer">...</div>
|
|
25
|
-
</dialog>
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
Each variant aliases `--panel-*` from its own namespace, so `--modal-*` and `--drawer-*` remain the public API. Override those, not `--panel-*`.
|
|
29
|
-
|
|
30
|
-
## Two ways to open a panel
|
|
31
|
-
|
|
32
|
-
**The tag picks the strategy, not the class.** Either variant works both ways.
|
|
33
|
-
|
|
34
|
-
### `<dialog>` with `showModal()`
|
|
35
|
-
|
|
36
|
-
The browser handles Escape, the focus trap and making the rest of the page inert. You get `[open]`, the native `::backdrop` and the top layer for free.
|
|
37
|
-
|
|
38
|
-
This is the right choice when the panel is **always** a dialog.
|
|
39
|
-
|
|
40
|
-
### `popover="auto"` with `showPopover()`
|
|
41
|
-
|
|
42
|
-
Same top layer, same native `::backdrop`, but the element carries no implicit role.
|
|
43
|
-
|
|
44
|
-
Use this when the panel becomes a static region of the page above a breakpoint, which is what the `.panel-inline-*` variants do. The reason is an accessibility one: a `<dialog>` is exposed as `role="dialog"` even when it is only styled as a sidebar, whereas a script can set that role solely while the panel is actually open.
|
|
45
|
-
|
|
46
|
-
## `.modal`
|
|
47
|
-
|
|
48
|
-
A centred panel. Size a single instance by overriding `--modal-max-width` on the element itself.
|
|
49
|
-
|
|
50
|
-
```html
|
|
51
|
-
<dialog class="modal" style="--modal-max-width: 40rem">...</dialog>
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## `.drawer`
|
|
55
|
-
|
|
56
|
-
A panel sliding in from an edge.
|
|
57
|
-
|
|
58
|
-
| Class | Edge |
|
|
59
|
-
| --- | --- |
|
|
60
|
-
| `.drawer-start` | Inline start, left in a left-to-right document |
|
|
61
|
-
| `.drawer-end` | Inline end |
|
|
62
|
-
| `.drawer-top` | Top |
|
|
63
|
-
| `.drawer-bottom` | Bottom |
|
|
64
|
-
|
|
65
|
-
## `.panel-inline-*`
|
|
66
|
-
|
|
67
|
-
Turns a panel into an ordinary region of the page from a breakpoint upwards, while it stays an overlay below.
|
|
68
|
-
|
|
69
|
-
| Class | Becomes inline at |
|
|
70
|
-
| --- | --- |
|
|
71
|
-
| `.panel-inline-sm` | `--sm`, 768px |
|
|
72
|
-
| `.panel-inline-md` | `--md`, 1024px |
|
|
73
|
-
| `.panel-inline-lg` | `--lg`, 1440px |
|
|
74
|
-
| `.panel-inline-xl` | `--xl`, 1600px |
|
|
75
|
-
|
|
76
|
-
This is the case that calls for `popover="auto"` rather than `<dialog>`. A filters sidebar that is a drawer on mobile and a column on desktop should not announce itself as a dialog while it is a column.
|
|
77
|
-
|
|
78
|
-
These variants beat `.modal` and `.drawer` on **source order**, not specificity, which is why `panel.css` is imported last. See [Cascade layers](../cascade-layers/).
|
|
79
|
-
|
|
80
|
-
## `.panel-trigger-*`
|
|
81
|
-
|
|
82
|
-
The companion to `.panel-inline-*`, applied to the **trigger button** rather than to the panel. It hides the trigger at the breakpoint where the panel stops being an overlay.
|
|
83
|
-
|
|
84
|
-
| Class | Trigger hidden from |
|
|
85
|
-
| --- | --- |
|
|
86
|
-
| `.panel-trigger-sm` | `--sm`, 768px |
|
|
87
|
-
| `.panel-trigger-md` | `--md`, 1024px |
|
|
88
|
-
| `.panel-trigger-lg` | `--lg`, 1440px |
|
|
89
|
-
| `.panel-trigger-xl` | `--xl`, 1600px |
|
|
90
|
-
|
|
91
|
-
Pair the suffixes: a panel carrying `.panel-inline-md` needs its button carrying `.panel-trigger-md`, otherwise a button that opens nothing remains on screen at desktop width.
|
|
92
|
-
|
|
93
|
-
The reason this is a second class rather than something CSS derives on its own is worth knowing, because it looks like a redundancy. Nothing structurally connects a trigger to its panel: the only link is `data-target` matching an `id`, and no selector can compare two attribute values. A positional rule would work only until somebody moved the markup, and a filter button typically lives in the page heading rather than beside the panel it opens. In practice both classes come from the same configuration value, so the pair cannot disagree.
|
|
94
|
-
|
|
95
|
-
## The JavaScript contract
|
|
96
|
-
|
|
97
|
-
This package ships no JavaScript. `.modal` and `.drawer` expect a script that provides:
|
|
98
|
-
|
|
99
|
-
| Hook | Role |
|
|
100
|
-
| --- | --- |
|
|
101
|
-
| `.js-dialog-toggle[data-target="#id"]` | Opens the panel it points at |
|
|
102
|
-
| `.js-dialog-close` | Any element inside the panel that closes it |
|
|
103
|
-
|
|
104
|
-
Closing must also work on Escape and on a click outside. With `<dialog>` and `showModal()` the browser already does both. With `popover="auto"` the platform handles light dismiss and Escape too, so in practice the script mainly manages the role and the open call.
|
|
105
|
-
|
|
106
|
-
## `.dropdown`
|
|
107
|
-
|
|
108
|
-
A contextual menu, with a tighter JavaScript contract because it animates.
|
|
109
|
-
|
|
110
|
-
```html
|
|
111
|
-
<div class="dropdown">
|
|
112
|
-
<button class="js-dropdown-toggle" aria-expanded="false">Label</button>
|
|
113
|
-
<ul class="dropdown-menu" role="menu">
|
|
114
|
-
<li><a class="dropdown-item" href="#">Item</a></li>
|
|
115
|
-
<li><hr class="dropdown-divider"></li>
|
|
116
|
-
<li><a class="dropdown-item" href="#">Item</a></li>
|
|
117
|
-
</ul>
|
|
118
|
-
</div>
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
The trigger is `.js-dropdown-toggle`, and its **next element sibling must be** `.dropdown-menu`.
|
|
122
|
-
|
|
123
|
-
The script toggles three classes on the menu, in this sequence:
|
|
124
|
-
|
|
125
|
-
| Class | Meaning |
|
|
126
|
-
| --- | --- |
|
|
127
|
-
| `.showing` | Opening transition has started |
|
|
128
|
-
| `.show` | Fully open |
|
|
129
|
-
| `.hiding` | Closing transition has started |
|
|
130
|
-
|
|
131
|
-
It must also keep `aria-expanded` on the toggle in sync. The three-class sequence exists so the menu can animate out before being removed from the flow; a single `.show` class would make the closing transition impossible.
|
|
132
|
-
|
|
133
|
-
`.dropdown-menu-end` aligns the menu to the inline end of its trigger rather than the start.
|