@loomidev/drawer 0.5.0 → 0.7.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 +14 -14
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @loomidev/drawer
|
|
2
2
|
|
|
3
|
-
`<loomi-drawer>`
|
|
3
|
+
`<loomi-drawer>` - a panel that slides in from the edge of the screen, with configurable
|
|
4
4
|
size, an optional backdrop, and focus management built in.
|
|
5
5
|
|
|
6
6
|
```bash
|
|
@@ -13,12 +13,12 @@ import "@loomidev/drawer";
|
|
|
13
13
|
|
|
14
14
|
## Default Drawer
|
|
15
15
|
|
|
16
|
-
Drawers are usually triggered by an action
|
|
16
|
+
Drawers are usually triggered by an action - a button click, say. Every LoomiUI drawer is
|
|
17
17
|
opened and closed by its unique `name`, using the exported `showLoomiDrawer()` /
|
|
18
18
|
`hideLoomiDrawer()` helpers (or the instance methods `show()`/`hide()` if you already have
|
|
19
19
|
a reference to the element).
|
|
20
20
|
|
|
21
|
-
> **Important:** give every drawer on a page a unique `name`
|
|
21
|
+
> **Important:** give every drawer on a page a unique `name` - it's how `showLoomiDrawer()`
|
|
22
22
|
> finds the right one.
|
|
23
23
|
|
|
24
24
|
The default drawer slides in from the right, shows a close button, and dismisses on
|
|
@@ -62,7 +62,7 @@ size by width; top/bottom drawers span the full width and size by height.
|
|
|
62
62
|
<loomi-drawer size="small" title="Small" name="small-drawer">20rem wide.</loomi-drawer>
|
|
63
63
|
|
|
64
64
|
<loomi-button onclick="showLoomiDrawer('medium-drawer')">Medium</loomi-button>
|
|
65
|
-
<loomi-drawer size="medium" title="Medium" name="medium-drawer">28rem wide
|
|
65
|
+
<loomi-drawer size="medium" title="Medium" name="medium-drawer">28rem wide - the default.</loomi-drawer>
|
|
66
66
|
|
|
67
67
|
<loomi-button onclick="showLoomiDrawer('large-drawer')">Large</loomi-button>
|
|
68
68
|
<loomi-drawer size="large" title="Large" name="large-drawer">36rem wide.</loomi-drawer>
|
|
@@ -86,12 +86,12 @@ once it overflows the drawer's height.
|
|
|
86
86
|
|
|
87
87
|
Three independent toggles control dismissal:
|
|
88
88
|
|
|
89
|
-
- `backdrop` (default `true`)
|
|
89
|
+
- `backdrop` (default `true`) - shows a dimmed overlay behind the panel and blocks
|
|
90
90
|
interaction with the rest of the page while open.
|
|
91
|
-
- `close-on-outside-click` (default `true`)
|
|
91
|
+
- `close-on-outside-click` (default `true`) - clicking outside the panel closes it. This
|
|
92
92
|
works even with `backdrop="false"`, since it's just watching for clicks outside the
|
|
93
93
|
panel rather than relying on the backdrop element itself.
|
|
94
|
-
- <kbd>Esc</kbd> always closes the drawer
|
|
94
|
+
- <kbd>Esc</kbd> always closes the drawer - there's no attribute to turn that off.
|
|
95
95
|
|
|
96
96
|
```html
|
|
97
97
|
<!-- no dimming overlay, but the rest of the page stays inert because outside clicks
|
|
@@ -100,7 +100,7 @@ Three independent toggles control dismissal:
|
|
|
100
100
|
|
|
101
101
|
<!-- only the close button or Escape can dismiss it -->
|
|
102
102
|
<loomi-drawer name="pinned" close-on-outside-click="false">
|
|
103
|
-
Click outside all you want
|
|
103
|
+
Click outside all you want - only the X (or Escape) closes me.
|
|
104
104
|
</loomi-drawer>
|
|
105
105
|
```
|
|
106
106
|
|
|
@@ -113,7 +113,7 @@ rather than a true overlay.
|
|
|
113
113
|
|
|
114
114
|
## Custom Animations
|
|
115
115
|
|
|
116
|
-
Every part of the slide animation is overridable through CSS custom properties
|
|
116
|
+
Every part of the slide animation is overridable through CSS custom properties - no
|
|
117
117
|
rebuild required:
|
|
118
118
|
|
|
119
119
|
| Property | Default |
|
|
@@ -148,20 +148,20 @@ selector:
|
|
|
148
148
|
}
|
|
149
149
|
```
|
|
150
150
|
|
|
151
|
-
`prefers-reduced-motion: reduce` is honored automatically
|
|
151
|
+
`prefers-reduced-motion: reduce` is honored automatically - the animation still runs (so
|
|
152
152
|
`hide()` resolves promptly) but at a near-instant duration.
|
|
153
153
|
|
|
154
154
|
## Accessibility
|
|
155
155
|
|
|
156
|
-
For the library-wide baseline, see [Foundations
|
|
156
|
+
For the library-wide baseline, see [Foundations - Accessibility](https://loomiui.com/foundations/#accessibility).
|
|
157
157
|
|
|
158
158
|
## Responsive behavior
|
|
159
159
|
|
|
160
|
-
For the shared container and viewport rules, see [Foundations
|
|
160
|
+
For the shared container and viewport rules, see [Foundations - Responsive behavior](https://loomiui.com/foundations/#responsive-behavior).
|
|
161
161
|
|
|
162
162
|
## Dark mode
|
|
163
163
|
|
|
164
|
-
For theme activation, token overrides, and contrast guidance, see [Foundations
|
|
164
|
+
For theme activation, token overrides, and contrast guidance, see [Foundations - Dark mode](https://loomiui.com/foundations/#dark-mode).
|
|
165
165
|
|
|
166
166
|
## Attributes
|
|
167
167
|
|
|
@@ -202,7 +202,7 @@ close animation finishes and the drawer unmounts).
|
|
|
202
202
|
|
|
203
203
|
Opening a drawer moves focus into it (the close button if shown, otherwise the first
|
|
204
204
|
focusable element, otherwise the panel itself). While `backdrop` is on, <kbd>Tab</kbd> is
|
|
205
|
-
trapped inside the panel; closing it restores focus to whatever was focused before
|
|
205
|
+
trapped inside the panel; closing it restores focus to whatever was focused before - all
|
|
206
206
|
automatic, no setup needed.
|
|
207
207
|
|
|
208
208
|
## Full Example
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loomidev/drawer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "<loomi-drawer> — a sliding edge panel with optional backdrop, focus trap, and customizable animations.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@loomidev/core": "^0.
|
|
34
|
-
"@loomidev/icon": "^0.
|
|
33
|
+
"@loomidev/core": "^0.7.0",
|
|
34
|
+
"@loomidev/icon": "^0.7.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"lit": "^3.0.0"
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"lit": "^3.3.3",
|
|
42
42
|
"tailwindcss": "^4.3.3",
|
|
43
43
|
"typescript": "^5.6.3",
|
|
44
|
-
"@loomidev/theme": "^0.
|
|
44
|
+
"@loomidev/theme": "^0.7.0"
|
|
45
45
|
},
|
|
46
46
|
"keywords": [
|
|
47
47
|
"web-components",
|