@egose/shadcn-theme-ng 0.1.0 → 0.2.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 +1 -1
- package/accordion/README.md +405 -2
- package/alert/README.md +372 -2
- package/alert-dialog/README.md +471 -5
- package/aspect-ratio/README.md +272 -5
- package/autocomplete/README.md +502 -2
- package/avatar/README.md +357 -5
- package/badge/README.md +318 -2
- package/basic-alert/README.md +353 -2
- package/breadcrumb/README.md +406 -5
- package/button/README.md +482 -2
- package/button/fesm2022/button.mjs +85 -107
- package/button/types/button.d.ts +5 -8
- package/button-group/README.md +318 -5
- package/calendar/README.md +357 -2
- package/card/README.md +331 -5
- package/carousel/README.md +333 -5
- package/carousel/fesm2022/carousel.mjs +4 -1
- package/checkbox/README.md +320 -2
- package/collapsible/README.md +332 -5
- package/combobox/README.md +507 -5
- package/combobox/fesm2022/combobox.mjs +4 -1
- package/command/README.md +435 -5
- package/confirmation-dialog/README.md +301 -2
- package/context-menu/README.md +366 -5
- package/date-picker/README.md +465 -2
- package/date-picker/fesm2022/date-picker.mjs +2 -2
- package/dialog/README.md +448 -2
- package/drawer/README.md +395 -5
- package/dropdown-menu/README.md +417 -5
- package/empty/README.md +329 -5
- package/field/README.md +385 -5
- package/form-checkbox/README.md +312 -2
- package/form-date-picker/README.md +322 -2
- package/form-field/README.md +356 -2
- package/form-field-simple/README.md +340 -2
- package/form-searchable-multiselect/README.md +361 -2
- package/form-select/README.md +350 -2
- package/form-text-input/README.md +371 -2
- package/form-textarea/README.md +347 -2
- package/hover-card/README.md +256 -5
- package/icon/README.md +239 -2
- package/input/README.md +269 -2
- package/input-group/README.md +335 -5
- package/input-group/fesm2022/input-group.mjs +3 -3
- package/input-otp/README.md +375 -5
- package/item/README.md +385 -5
- package/item/fesm2022/item.mjs +3 -3
- package/kbd/README.md +291 -5
- package/label/README.md +272 -2
- package/layout-simple/README.md +193 -2
- package/layout-simple/fesm2022/layout-simple.mjs +472 -236
- package/layout-simple/types/layout-simple.d.ts +174 -137
- package/menu/README.md +417 -2
- package/menubar/README.md +343 -5
- package/native-select/README.md +323 -5
- package/navigation-menu/README.md +369 -5
- package/package.json +1 -1
- package/pagination/README.md +388 -5
- package/popover/README.md +331 -2
- package/progress/README.md +311 -5
- package/radio-group/README.md +364 -2
- package/radio-group/fesm2022/radio-group.mjs +5 -1
- package/radio-group/types/radio-group.d.ts +1 -1
- package/resizable/README.md +269 -5
- package/scroll-area/README.md +233 -5
- package/searchable-multiselect/README.md +323 -2
- package/select/README.md +437 -2
- package/separator/README.md +222 -2
- package/sheet/README.md +311 -2
- package/sidebar/README.md +457 -5
- package/skeleton/README.md +217 -5
- package/slider/README.md +273 -5
- package/slider/fesm2022/slider.mjs +3 -3
- package/sonner/README.md +346 -2
- package/spinner/README.md +284 -2
- package/switch/README.md +310 -2
- package/table/README.md +423 -5
- package/tabs/README.md +411 -2
- package/tabs/fesm2022/tabs.mjs +2 -2
- package/textarea/README.md +282 -5
- package/toggle/README.md +270 -5
- package/toggle-group/README.md +340 -5
- package/tooltip/README.md +269 -2
- package/typography/README.md +271 -5
- package/typography/types/typography.d.ts +8 -8
- package/utils/README.md +303 -2
package/drawer/README.md
CHANGED
|
@@ -1,11 +1,401 @@
|
|
|
1
|
-
# Drawer
|
|
1
|
+
# Drawer (`@egose/shadcn-theme-ng/drawer`)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A swipeable bottom/side panel in the shadcn/ui Drawer (vaul-style) look: overlay + sliding content with header, title, description, and footer slots. Equivalent to shadcn/ui `Drawer`.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The Angular implementation is a thin styling layer over the headless
|
|
6
|
+
[`BrnDrawer*` primitives from `@spartan-ng/brain/drawer`](https://www.spartan-ng.com/) (built on the
|
|
7
|
+
brain dialog core): `HlmDrawer` extends `BrnDrawer`, `HlmDrawerContent` composes `BrnDrawerHandle`
|
|
8
|
+
with direction-aware slide animations, and trigger/close/title/description/overlay directives compose
|
|
9
|
+
their `Brn*` counterparts via `hostDirectives`. Styling uses `hlm()` / `classes()` from
|
|
10
|
+
`@egose/shadcn-theme-ng/utils`.
|
|
6
11
|
|
|
7
|
-
|
|
12
|
+
> **Ships as:** `@egose/shadcn-theme-ng/drawer` and `@egose/shadcn-theme-ng-tw/drawer`
|
|
13
|
+
> (the `tw:`-prefixed Tailwind variant). Both expose the identical TypeScript surface; only the
|
|
14
|
+
> emitted Tailwind class strings differ. See the [package README](../../README.md) for install
|
|
15
|
+
> steps, peer dependencies, and Tailwind setup. Do not publish this project directory independently.
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
8
18
|
|
|
9
19
|
```bash
|
|
10
|
-
|
|
20
|
+
# Plain Tailwind (no prefix)
|
|
21
|
+
npm install @egose/shadcn-theme-ng
|
|
22
|
+
|
|
23
|
+
# tw:-prefixed Tailwind variant
|
|
24
|
+
npm install @egose/shadcn-theme-ng-tw
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Peer dependencies (Angular, `@spartan-ng/brain`, `@ng-icons/*`, `rxjs`, …) are documented in the
|
|
28
|
+
[package README](../../README.md#peer-dependencies). This subpath has no extra runtime component
|
|
29
|
+
dependencies beyond `@egose/shadcn-theme-ng/utils`.
|
|
30
|
+
|
|
31
|
+
## Imports
|
|
32
|
+
|
|
33
|
+
All symbols are exported from the subpath root (`projects/drawer/src/public-api.ts`):
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import {
|
|
37
|
+
HlmDrawer,
|
|
38
|
+
HlmDrawerContent,
|
|
39
|
+
HlmDrawerTrigger,
|
|
40
|
+
HlmDrawerClose,
|
|
41
|
+
HlmDrawerOverlay,
|
|
42
|
+
HlmDrawerPortal,
|
|
43
|
+
HlmDrawerTitle,
|
|
44
|
+
HlmDrawerDescription,
|
|
45
|
+
HlmDrawerHeader,
|
|
46
|
+
HlmDrawerFooter,
|
|
47
|
+
HlmDrawerImports,
|
|
48
|
+
HlmDrawerModule,
|
|
49
|
+
} from '@egose/shadcn-theme-ng/drawer';
|
|
50
|
+
// tw variant: replace with '@egose/shadcn-theme-ng-tw/drawer'
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Standalone component — spread the `*Imports` array:
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
import { Component } from '@angular/core';
|
|
57
|
+
import { HlmDrawerImports } from '@egose/shadcn-theme-ng/drawer';
|
|
58
|
+
|
|
59
|
+
@Component({
|
|
60
|
+
selector: 'app-demo',
|
|
61
|
+
standalone: true,
|
|
62
|
+
imports: [...HlmDrawerImports],
|
|
63
|
+
template: `...`,
|
|
64
|
+
})
|
|
65
|
+
export class DemoComponent {}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
NgModule-based consumer — import the module:
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
import { NgModule } from '@angular/core';
|
|
72
|
+
import { HlmDrawerModule } from '@egose/shadcn-theme-ng/drawer';
|
|
73
|
+
|
|
74
|
+
@NgModule({ imports: [HlmDrawerModule] })
|
|
75
|
+
export class DemoModule {}
|
|
11
76
|
```
|
|
77
|
+
|
|
78
|
+
## Anatomy / Structure
|
|
79
|
+
|
|
80
|
+
```html
|
|
81
|
+
<hlm-drawer>
|
|
82
|
+
<button hlmBtn variant="outline" hlmDrawerTrigger>Open drawer</button>
|
|
83
|
+
|
|
84
|
+
<hlm-drawer-content>
|
|
85
|
+
<div hlmDrawerHeader>
|
|
86
|
+
<h2 hlmDrawerTitle>Edit profile</h2>
|
|
87
|
+
<p hlmDrawerDescription>Make changes here.</p>
|
|
88
|
+
</div>
|
|
89
|
+
|
|
90
|
+
<p class="tw:px-4">Drawer body…</p>
|
|
91
|
+
|
|
92
|
+
<div hlmDrawerFooter>
|
|
93
|
+
<button hlmBtn hlmDrawerClose>Close</button>
|
|
94
|
+
</div>
|
|
95
|
+
</hlm-drawer-content>
|
|
96
|
+
</hlm-drawer>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Real selectors (from source):
|
|
100
|
+
|
|
101
|
+
| Class | Selector(s) | Kind |
|
|
102
|
+
| ---------------------- | ---------------------------------------- | ------------------------------- |
|
|
103
|
+
| `HlmDrawer` | `hlm-drawer` | Component (extends `BrnDrawer`) |
|
|
104
|
+
| `HlmDrawerContent` | `hlm-drawer-content` | Component |
|
|
105
|
+
| `HlmDrawerTrigger` | `button[hlmDrawerTrigger]` | Directive (thin wrapper) |
|
|
106
|
+
| `HlmDrawerClose` | `button[hlmDrawerClose]` | Directive (thin wrapper) |
|
|
107
|
+
| `HlmDrawerOverlay` | `[hlmDrawerOverlay], hlm-drawer-overlay` | Directive |
|
|
108
|
+
| `HlmDrawerPortal` | `[hlmDrawerPortal]` | Directive |
|
|
109
|
+
| `HlmDrawerTitle` | `[hlmDrawerTitle]` | Directive |
|
|
110
|
+
| `HlmDrawerDescription` | `[hlmDrawerDescription]` | Directive |
|
|
111
|
+
| `HlmDrawerHeader` | `[hlmDrawerHeader], hlm-drawer-header` | Directive |
|
|
112
|
+
| `HlmDrawerFooter` | `[hlmDrawerFooter], hlm-drawer-footer` | Directive |
|
|
113
|
+
|
|
114
|
+
## API reference
|
|
115
|
+
|
|
116
|
+
### `HlmDrawer` — `hlm-drawer`
|
|
117
|
+
|
|
118
|
+
Root drawer state host. Extends `BrnDrawer` (and provides `BrnDialog` + `BrnDrawer` tokens). Renders `<hlm-drawer-overlay />` plus projected content. `exportAs: 'hlmDrawer'`.
|
|
119
|
+
|
|
120
|
+
No new inputs/outputs — direction and dialog options come from the trigger (`direction`) and brain defaults.
|
|
121
|
+
|
|
122
|
+
### `HlmDrawerContent` — `hlm-drawer-content`
|
|
123
|
+
|
|
124
|
+
The sliding panel. Hosts `BrnDrawerHandle` (swipe/drag, `closeThreshold` input forwarded), exposes `data-vaul-drawer-direction` and `data-state`, and renders the drag handle bar for bottom drawers plus projected content.
|
|
125
|
+
|
|
126
|
+
| Input (forwarded) | Type | Description |
|
|
127
|
+
| ----------------- | ------------------------------ | ------------------------------------- |
|
|
128
|
+
| `closeThreshold` | forwarded to `BrnDrawerHandle` | Drag distance that closes the drawer. |
|
|
129
|
+
|
|
130
|
+
| Member | Description |
|
|
131
|
+
| ------- | ------------------------------------------------------------------------------------ |
|
|
132
|
+
| `state` | Current open state signal (from the exposed state provider, defaults to `'closed'`). |
|
|
133
|
+
|
|
134
|
+
Direction styling (`bottom` default, plus `top` / `left` / `right`) is driven by the trigger's `direction` via `data-vaul-drawer-direction` selectors.
|
|
135
|
+
|
|
136
|
+
### `HlmDrawerTrigger` — `button[hlmDrawerTrigger]`
|
|
137
|
+
|
|
138
|
+
Thin wrapper. Forwards `id`, `direction`, `type` to `BrnDrawerTrigger` via `hostDirectives`. Set `direction="left" | "right" | "top" | "bottom"` here.
|
|
139
|
+
|
|
140
|
+
### `HlmDrawerClose` — `button[hlmDrawerClose]`
|
|
141
|
+
|
|
142
|
+
Thin wrapper around `BrnDrawerClose`. Place on any `<button>` inside the drawer to close it.
|
|
143
|
+
|
|
144
|
+
### `HlmDrawerOverlay` — `[hlmDrawerOverlay], hlm-drawer-overlay`
|
|
145
|
+
|
|
146
|
+
Backdrop. Wraps `BrnDrawerOverlay`; merges `class` via `hlm()`.
|
|
147
|
+
|
|
148
|
+
| Input | Type | Default | Description |
|
|
149
|
+
| ------- | ------------ | ------- | --------------------------------------------------- |
|
|
150
|
+
| `class` | `ClassValue` | `''` | Extra classes merged over the base overlay classes. |
|
|
151
|
+
|
|
152
|
+
### `HlmDrawerPortal` — `[hlmDrawerPortal]`
|
|
153
|
+
|
|
154
|
+
Thin wrapper forwarding `context` and `class` to `BrnDrawerContent` for portal-based content.
|
|
155
|
+
|
|
156
|
+
### `HlmDrawerTitle` — `[hlmDrawerTitle]` / `HlmDrawerDescription` — `[hlmDrawerDescription]`
|
|
157
|
+
|
|
158
|
+
Accessible title/description. Wrap `BrnDrawerTitle` / `BrnDrawerDescription` plus shadcn typography. No inputs.
|
|
159
|
+
|
|
160
|
+
### `HlmDrawerHeader` / `HlmDrawerFooter`
|
|
161
|
+
|
|
162
|
+
Pure layout directives, no inputs. Header centers text on top/bottom drawers; footer stacks actions with `mt-auto`.
|
|
163
|
+
|
|
164
|
+
## Examples
|
|
165
|
+
|
|
166
|
+
### 1. Basic bottom drawer
|
|
167
|
+
|
|
168
|
+
```ts
|
|
169
|
+
import { Component } from '@angular/core';
|
|
170
|
+
import { HlmDrawerImports } from '@egose/shadcn-theme-ng/drawer';
|
|
171
|
+
import { HlmButton } from '@egose/shadcn-theme-ng/button';
|
|
172
|
+
|
|
173
|
+
@Component({
|
|
174
|
+
selector: 'app-basic-drawer',
|
|
175
|
+
standalone: true,
|
|
176
|
+
imports: [...HlmDrawerImports, HlmButton],
|
|
177
|
+
template: `
|
|
178
|
+
<hlm-drawer>
|
|
179
|
+
<button hlmBtn variant="outline" hlmDrawerTrigger>Open drawer</button>
|
|
180
|
+
<hlm-drawer-content>
|
|
181
|
+
<div hlmDrawerHeader>
|
|
182
|
+
<h2 hlmDrawerTitle>Are you sure?</h2>
|
|
183
|
+
<p hlmDrawerDescription>This action cannot be undone.</p>
|
|
184
|
+
</div>
|
|
185
|
+
<div hlmDrawerFooter>
|
|
186
|
+
<button hlmBtn hlmDrawerClose>Close</button>
|
|
187
|
+
</div>
|
|
188
|
+
</hlm-drawer-content>
|
|
189
|
+
</hlm-drawer>
|
|
190
|
+
`,
|
|
191
|
+
})
|
|
192
|
+
export class BasicDrawerComponent {}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### 2. Direction variants (left / right / top)
|
|
196
|
+
|
|
197
|
+
```ts
|
|
198
|
+
import { Component } from '@angular/core';
|
|
199
|
+
import { HlmDrawerImports } from '@egose/shadcn-theme-ng/drawer';
|
|
200
|
+
import { HlmButton } from '@egose/shadcn-theme-ng/button';
|
|
201
|
+
|
|
202
|
+
@Component({
|
|
203
|
+
selector: 'app-directions',
|
|
204
|
+
standalone: true,
|
|
205
|
+
imports: [...HlmDrawerImports, HlmButton],
|
|
206
|
+
template: `
|
|
207
|
+
<hlm-drawer>
|
|
208
|
+
<button hlmBtn variant="outline" hlmDrawerTrigger direction="right">Right panel</button>
|
|
209
|
+
<hlm-drawer-content>
|
|
210
|
+
<div hlmDrawerHeader>
|
|
211
|
+
<h2 hlmDrawerTitle>Right drawer</h2>
|
|
212
|
+
<p hlmDrawerDescription>Slides in from the right.</p>
|
|
213
|
+
</div>
|
|
214
|
+
<div hlmDrawerFooter>
|
|
215
|
+
<button hlmBtn variant="outline" hlmDrawerClose>Close</button>
|
|
216
|
+
</div>
|
|
217
|
+
</hlm-drawer-content>
|
|
218
|
+
</hlm-drawer>
|
|
219
|
+
|
|
220
|
+
<hlm-drawer>
|
|
221
|
+
<button hlmBtn variant="outline" hlmDrawerTrigger direction="left">Left panel</button>
|
|
222
|
+
<hlm-drawer-content>
|
|
223
|
+
<div hlmDrawerHeader>
|
|
224
|
+
<h2 hlmDrawerTitle>Left drawer</h2>
|
|
225
|
+
<p hlmDrawerDescription>Slides in from the left.</p>
|
|
226
|
+
</div>
|
|
227
|
+
</hlm-drawer-content>
|
|
228
|
+
</hlm-drawer>
|
|
229
|
+
`,
|
|
230
|
+
})
|
|
231
|
+
export class DirectionsComponent {}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### 3. Form drawer with footer actions
|
|
235
|
+
|
|
236
|
+
```ts
|
|
237
|
+
import { Component, inject } from '@angular/core';
|
|
238
|
+
import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms';
|
|
239
|
+
import { HlmDrawerImports } from '@egose/shadcn-theme-ng/drawer';
|
|
240
|
+
import { HlmButton } from '@egose/shadcn-theme-ng/button';
|
|
241
|
+
import { HlmLabel } from '@egose/shadcn-theme-ng/label';
|
|
242
|
+
import { HlmInput } from '@egose/shadcn-theme-ng/input';
|
|
243
|
+
|
|
244
|
+
@Component({
|
|
245
|
+
selector: 'app-form-drawer',
|
|
246
|
+
standalone: true,
|
|
247
|
+
imports: [ReactiveFormsModule, HlmLabel, HlmInput, HlmButton, ...HlmDrawerImports],
|
|
248
|
+
template: `
|
|
249
|
+
<hlm-drawer>
|
|
250
|
+
<button hlmBtn hlmDrawerTrigger>New goal</button>
|
|
251
|
+
<hlm-drawer-content>
|
|
252
|
+
<div hlmDrawerHeader>
|
|
253
|
+
<h2 hlmDrawerTitle>New goal</h2>
|
|
254
|
+
<p hlmDrawerDescription>Set a goal for this week.</p>
|
|
255
|
+
</div>
|
|
256
|
+
<form [formGroup]="form" class="tw:grid tw:gap-4 tw:px-4">
|
|
257
|
+
<label hlmLabel for="goal">Goal</label>
|
|
258
|
+
<input hlmInput id="goal" formControlName="goal" placeholder="Exercise 3x" />
|
|
259
|
+
</form>
|
|
260
|
+
<div hlmDrawerFooter>
|
|
261
|
+
<button hlmBtn [disabled]="form.invalid" hlmDrawerClose (click)="save()">Save</button>
|
|
262
|
+
<button hlmBtn variant="outline" hlmDrawerClose>Cancel</button>
|
|
263
|
+
</div>
|
|
264
|
+
</hlm-drawer-content>
|
|
265
|
+
</hlm-drawer>
|
|
266
|
+
`,
|
|
267
|
+
})
|
|
268
|
+
export class FormDrawerComponent {
|
|
269
|
+
private readonly fb = inject(FormBuilder);
|
|
270
|
+
readonly form = this.fb.group({ goal: ['', Validators.required] });
|
|
271
|
+
save() {
|
|
272
|
+
console.log(this.form.value);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### 4. Drag threshold + custom overlay
|
|
278
|
+
|
|
279
|
+
```ts
|
|
280
|
+
import { Component } from '@angular/core';
|
|
281
|
+
import { HlmDrawerImports } from '@egose/shadcn-theme-ng/drawer';
|
|
282
|
+
import { HlmButton } from '@egose/shadcn-theme-ng/button';
|
|
283
|
+
|
|
284
|
+
@Component({
|
|
285
|
+
selector: 'app-threshold',
|
|
286
|
+
standalone: true,
|
|
287
|
+
imports: [...HlmDrawerImports, HlmButton],
|
|
288
|
+
template: `
|
|
289
|
+
<hlm-drawer>
|
|
290
|
+
<button hlmBtn variant="secondary" hlmDrawerTrigger>Player queue</button>
|
|
291
|
+
<hlm-drawer-content [closeThreshold]="0.4" class="tw:max-h-[60vh]">
|
|
292
|
+
<div hlmDrawerHeader>
|
|
293
|
+
<h2 hlmDrawerTitle>Up next</h2>
|
|
294
|
+
<p hlmDrawerDescription>Drag down past 40% to dismiss.</p>
|
|
295
|
+
</div>
|
|
296
|
+
<ul class="tw:px-4 tw:text-sm">
|
|
297
|
+
<li>Track 1 — Intro</li>
|
|
298
|
+
<li>Track 2 — Verse</li>
|
|
299
|
+
<li>Track 3 — Outro</li>
|
|
300
|
+
</ul>
|
|
301
|
+
<div hlmDrawerFooter>
|
|
302
|
+
<button hlmBtn variant="outline" hlmDrawerClose>Close</button>
|
|
303
|
+
</div>
|
|
304
|
+
</hlm-drawer-content>
|
|
305
|
+
</hlm-drawer>
|
|
306
|
+
`,
|
|
307
|
+
})
|
|
308
|
+
export class ThresholdComponent {}
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### 5. Element + attribute header/footer spellings
|
|
312
|
+
|
|
313
|
+
```ts
|
|
314
|
+
import { Component } from '@angular/core';
|
|
315
|
+
import { HlmDrawerImports } from '@egose/shadcn-theme-ng/drawer';
|
|
316
|
+
import { HlmButton } from '@egose/shadcn-theme-ng/button';
|
|
317
|
+
|
|
318
|
+
@Component({
|
|
319
|
+
selector: 'app-spellings',
|
|
320
|
+
standalone: true,
|
|
321
|
+
imports: [...HlmDrawerImports, HlmButton],
|
|
322
|
+
template: `
|
|
323
|
+
<hlm-drawer>
|
|
324
|
+
<button hlmBtn variant="ghost" hlmDrawerTrigger>Filters</button>
|
|
325
|
+
<hlm-drawer-content>
|
|
326
|
+
<hlm-drawer-header>
|
|
327
|
+
<h2 hlmDrawerTitle>Filters</h2>
|
|
328
|
+
<p hlmDrawerDescription>Refine the list below.</p>
|
|
329
|
+
</hlm-drawer-header>
|
|
330
|
+
<div class="tw:px-4 tw:text-sm">Filter controls…</div>
|
|
331
|
+
<hlm-drawer-footer>
|
|
332
|
+
<button hlmBtn hlmDrawerClose>Apply</button>
|
|
333
|
+
<button hlmBtn variant="ghost" hlmDrawerClose>Reset</button>
|
|
334
|
+
</hlm-drawer-footer>
|
|
335
|
+
</hlm-drawer-content>
|
|
336
|
+
</hlm-drawer>
|
|
337
|
+
`,
|
|
338
|
+
})
|
|
339
|
+
export class SpellingsComponent {}
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
### 6. Multi-step content inside one drawer
|
|
343
|
+
|
|
344
|
+
```ts
|
|
345
|
+
import { Component, signal } from '@angular/core';
|
|
346
|
+
import { HlmDrawerImports } from '@egose/shadcn-theme-ng/drawer';
|
|
347
|
+
import { HlmButton } from '@egose/shadcn-theme-ng/button';
|
|
348
|
+
|
|
349
|
+
@Component({
|
|
350
|
+
selector: 'app-steps',
|
|
351
|
+
standalone: true,
|
|
352
|
+
imports: [...HlmDrawerImports, HlmButton],
|
|
353
|
+
template: `
|
|
354
|
+
<hlm-drawer>
|
|
355
|
+
<button hlmBtn hlmDrawerTrigger>Checkout</button>
|
|
356
|
+
<hlm-drawer-content>
|
|
357
|
+
<div hlmDrawerHeader>
|
|
358
|
+
<h2 hlmDrawerTitle>Step {{ step() }} of 2</h2>
|
|
359
|
+
<p hlmDrawerDescription>{{ step() === 1 ? 'Address' : 'Payment' }}</p>
|
|
360
|
+
</div>
|
|
361
|
+
<div class="tw:px-4 tw:text-sm">
|
|
362
|
+
@if (step() === 1) {
|
|
363
|
+
<p>Address form…</p>
|
|
364
|
+
} @else {
|
|
365
|
+
<p>Payment form…</p>
|
|
366
|
+
}
|
|
367
|
+
</div>
|
|
368
|
+
<div hlmDrawerFooter>
|
|
369
|
+
@if (step() === 1) {
|
|
370
|
+
<button hlmBtn (click)="step.set(2)">Next</button>
|
|
371
|
+
} @else {
|
|
372
|
+
<button hlmBtn (click)="step.set(1)" variant="outline">Back</button>
|
|
373
|
+
<button hlmBtn hlmDrawerClose>Pay</button>
|
|
374
|
+
}
|
|
375
|
+
</div>
|
|
376
|
+
</hlm-drawer-content>
|
|
377
|
+
</hlm-drawer>
|
|
378
|
+
`,
|
|
379
|
+
})
|
|
380
|
+
export class StepsComponent {
|
|
381
|
+
readonly step = signal(1);
|
|
382
|
+
}
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
## Accessibility notes
|
|
386
|
+
|
|
387
|
+
- Always include `hlmDrawerTitle` and `hlmDrawerDescription` so the panel is labelled and described (brain `BrnDrawerTitle` / `BrnDrawerDescription` wiring).
|
|
388
|
+
- Focus is trapped while open and restored to the trigger on close; escape and overlay click dismiss by default.
|
|
389
|
+
- The drag handle is visual; keyboard and screen-reader users rely on the close button — always provide a labelled `hlmDrawerClose` control.
|
|
390
|
+
- `data-state` and `data-vaul-drawer-direction` attributes let assistive and custom styles target open/closed and directional states.
|
|
391
|
+
|
|
392
|
+
## Theming / CSS variables
|
|
393
|
+
|
|
394
|
+
No component-specific CSS variables. Panel geometry and slide animations are direction-aware via `data-vaul-drawer-direction` selectors; colors come from global tokens (`--background`, `--muted`, …). Extend with `class` on `hlm-drawer-content` / overlay.
|
|
395
|
+
|
|
396
|
+
## Related subpaths
|
|
397
|
+
|
|
398
|
+
- `@egose/shadcn-theme-ng/dialog` — centered modal built on the same brain dialog core.
|
|
399
|
+
- `@egose/shadcn-theme-ng/sheet` — side-anchored panel alternative without swipe handling.
|
|
400
|
+
- `@egose/shadcn-theme-ng/button` — `hlmBtn` triggers and footer actions.
|
|
401
|
+
- `@egose/shadcn-theme-ng/separator` — dividers inside drawer bodies.
|