@egose/shadcn-theme-ng 0.1.0 → 0.3.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 +2 -2
- 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/autocomplete/fesm2022/autocomplete.mjs +1 -1
- 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/checkbox/fesm2022/checkbox.mjs +6 -7
- package/checkbox/types/checkbox.d.ts +1 -1
- package/collapsible/README.md +332 -5
- package/combobox/README.md +507 -5
- package/combobox/fesm2022/combobox.mjs +5 -2
- 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 +469 -2
- package/date-picker/fesm2022/date-picker.mjs +150 -32
- package/date-picker/types/date-picker.d.ts +102 -9
- 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-autocomplete/README.md +177 -0
- package/form-autocomplete/fesm2022/form-autocomplete.mjs +125 -0
- package/form-autocomplete/package.json +24 -0
- package/form-autocomplete/types/form-autocomplete.d.ts +61 -0
- package/form-checkbox/README.md +322 -2
- package/form-checkbox/fesm2022/form-checkbox.mjs +22 -9
- package/form-checkbox/types/form-checkbox.d.ts +23 -4
- package/form-combobox/README.md +202 -0
- package/form-combobox/fesm2022/form-combobox.mjs +147 -0
- package/form-combobox/package.json +24 -0
- package/form-combobox/types/form-combobox.d.ts +73 -0
- package/form-date-picker/README.md +348 -2
- package/form-date-picker/fesm2022/form-date-picker.mjs +38 -12
- package/form-date-picker/types/form-date-picker.d.ts +17 -1
- package/form-date-picker-multi/README.md +191 -0
- package/form-date-picker-multi/fesm2022/form-date-picker-multi.mjs +129 -0
- package/form-date-picker-multi/package.json +24 -0
- package/form-date-picker-multi/types/form-date-picker-multi.d.ts +58 -0
- package/form-date-range-picker/README.md +253 -0
- package/form-date-range-picker/fesm2022/form-date-range-picker.mjs +130 -0
- package/form-date-range-picker/package.json +24 -0
- package/form-date-range-picker/types/form-date-range-picker.d.ts +55 -0
- package/form-field/README.md +356 -2
- package/form-field-simple/README.md +340 -2
- package/form-input-otp/README.md +194 -0
- package/form-input-otp/fesm2022/form-input-otp.mjs +106 -0
- package/form-input-otp/package.json +24 -0
- package/form-input-otp/types/form-input-otp.d.ts +58 -0
- package/form-month-year-picker/README.md +188 -0
- package/form-month-year-picker/fesm2022/form-month-year-picker.mjs +125 -0
- package/form-month-year-picker/package.json +24 -0
- package/form-month-year-picker/types/form-month-year-picker.d.ts +53 -0
- package/form-native-select/README.md +205 -0
- package/form-native-select/fesm2022/form-native-select.mjs +103 -0
- package/form-native-select/package.json +24 -0
- package/form-native-select/types/form-native-select.d.ts +57 -0
- package/form-phone-input/README.md +188 -0
- package/form-phone-input/fesm2022/form-phone-input.mjs +113 -0
- package/form-phone-input/package.json +24 -0
- package/form-phone-input/types/form-phone-input.d.ts +58 -0
- package/form-radio-group/README.md +198 -0
- package/form-radio-group/fesm2022/form-radio-group.mjs +111 -0
- package/form-radio-group/package.json +24 -0
- package/form-radio-group/types/form-radio-group.d.ts +63 -0
- package/form-searchable-multiselect/README.md +371 -2
- package/form-searchable-multiselect/fesm2022/form-searchable-multiselect.mjs +19 -10
- package/form-searchable-multiselect/types/form-searchable-multiselect.d.ts +18 -1
- package/form-select/README.md +360 -2
- package/form-select/fesm2022/form-select.mjs +20 -11
- package/form-select/types/form-select.d.ts +18 -1
- package/form-slider/README.md +182 -0
- package/form-slider/fesm2022/form-slider.mjs +106 -0
- package/form-slider/package.json +24 -0
- package/form-slider/types/form-slider.d.ts +60 -0
- package/form-switch/README.md +173 -0
- package/form-switch/fesm2022/form-switch.mjs +100 -0
- package/form-switch/package.json +24 -0
- package/form-switch/types/form-switch.d.ts +50 -0
- package/form-text-input/README.md +381 -2
- package/form-text-input/fesm2022/form-text-input.mjs +19 -10
- package/form-text-input/types/form-text-input.d.ts +18 -1
- package/form-textarea/README.md +357 -2
- package/form-textarea/fesm2022/form-textarea.mjs +19 -10
- package/form-textarea/types/form-textarea.d.ts +18 -1
- package/form-toggle/README.md +186 -0
- package/form-toggle/fesm2022/form-toggle.mjs +159 -0
- package/form-toggle/package.json +24 -0
- package/form-toggle/types/form-toggle.d.ts +82 -0
- package/form-toggle-group/README.md +176 -0
- package/form-toggle-group/fesm2022/form-toggle-group.mjs +116 -0
- package/form-toggle-group/package.json +24 -0
- package/form-toggle-group/types/form-toggle-group.d.ts +65 -0
- 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 +22 -12
- package/input-group/types/input-group.d.ts +4 -1
- 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/native-select/fesm2022/native-select.mjs +18 -6
- package/native-select/types/native-select.d.ts +7 -2
- package/navigation-menu/README.md +369 -5
- package/package.json +57 -1
- package/pagination/README.md +388 -5
- package/phone-input/README.md +114 -0
- package/phone-input/fesm2022/phone-input.mjs +191 -0
- package/phone-input/package.json +24 -0
- package/phone-input/types/phone-input.d.ts +67 -0
- 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/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/switch/fesm2022/switch.mjs +7 -5
- package/switch/types/switch.d.ts +2 -1
- 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/utils/README.md +303 -2
package/sheet/README.md
CHANGED
|
@@ -1,3 +1,312 @@
|
|
|
1
|
-
# Sheet
|
|
1
|
+
# Sheet (`@egose/shadcn-theme-ng/sheet`)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A shadcn/ui-style **Sheet** — a slide-over panel (dialog) anchored to any screen edge. This is the Angular equivalent of shadcn/ui `Sheet` (`SheetTrigger`, `SheetContent`, `SheetHeader`, `SheetFooter`, `SheetTitle`, `SheetDescription`, `SheetClose`).
|
|
4
|
+
|
|
5
|
+
The overlay/focus-trap/dialog mechanics come from **spartan-ng/brain** (`BrnSheet`, `BrnSheetOverlay`, `BrnSheetClose`, `BrnSheetTitle`, `BrnSheetDescription`, `BrnDialog`). This package adds the shadcn shell: `HlmSheet` root (extends `BrnSheet`, renders the overlay + content outlet), `HlmSheetContent` with `side` variants (top/bottom/left/right, default right) plus a built-in close button, header/footer/title/description layout pieces, and overlay/close styling directives.
|
|
6
|
+
|
|
7
|
+
> **Ships as:** `@egose/shadcn-theme-ng/sheet` and `@egose/shadcn-theme-ng-tw/sheet` (the `tw:`-prefixed Tailwind variant — same API, class strings prefixed with `tw:`).
|
|
8
|
+
> See the [package README](../../README.md) for installation, peer dependencies, and Tailwind setup. Do not publish this project directory independently.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
# Plain Tailwind (no prefix)
|
|
14
|
+
npm install @egose/shadcn-theme-ng
|
|
15
|
+
|
|
16
|
+
# Or the tw:-prefixed variant
|
|
17
|
+
npm install @egose/shadcn-theme-ng-tw
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { HlmSheetImports } from '@egose/shadcn-theme-ng/sheet';
|
|
22
|
+
// tw variant:
|
|
23
|
+
// import { HlmSheetImports } from '@egose/shadcn-theme-ng-tw/sheet';
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Peer dependencies (see [package README](../../README.md) for versions): `@angular/core`, `@angular/common`. Icons use `@ng-icons/lucide` (`lucideX` for the built-in close button), installed transitively.
|
|
27
|
+
|
|
28
|
+
## Imports
|
|
29
|
+
|
|
30
|
+
Real exported symbols (from `src/public-api.ts`):
|
|
31
|
+
|
|
32
|
+
| Symbol | Kind | Selector |
|
|
33
|
+
| --------------------- | ------------------------------ | ------------------------------------------------------------------------------ |
|
|
34
|
+
| `HlmSheet` | Component (extends `BrnSheet`) | `hlm-sheet` (`exportAs: 'hlmSheet'`) |
|
|
35
|
+
| `HlmSheetContent` | Component | `hlm-sheet-content` |
|
|
36
|
+
| `HlmSheetHeader` | Component | `hlm-sheet-header` |
|
|
37
|
+
| `HlmSheetFooter` | Component | `hlm-sheet-footer` |
|
|
38
|
+
| `HlmSheetTitle` | Directive | `[hlmSheetTitle]` |
|
|
39
|
+
| `HlmSheetDescription` | Directive | `[hlmSheetDescription]` |
|
|
40
|
+
| `HlmSheetOverlay` | Directive | `[hlmSheetOverlay],brn-sheet-overlay[hlm]` |
|
|
41
|
+
| `HlmSheetClose` | Directive | `[hlmSheetClose],[brnSheetClose][hlm]` |
|
|
42
|
+
| `sheetVariants` | `cva` | Side-variant class builder (`top \| bottom \| left \| right`, default `right`) |
|
|
43
|
+
| `HlmSheetImports` | `const` array | All components/directives above, for standalone `imports` |
|
|
44
|
+
| `HlmSheetModule` | `NgModule` | NgModule wrapper re-exporting all of the above |
|
|
45
|
+
|
|
46
|
+
Standalone usage:
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
import { Component } from '@angular/core';
|
|
50
|
+
import { HlmSheetImports } from '@egose/shadcn-theme-ng/sheet';
|
|
51
|
+
|
|
52
|
+
@Component({
|
|
53
|
+
selector: 'app-demo',
|
|
54
|
+
standalone: true,
|
|
55
|
+
imports: [HlmSheetImports],
|
|
56
|
+
template: `...`,
|
|
57
|
+
})
|
|
58
|
+
export class DemoComponent {}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
NgModule usage:
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
import { NgModule } from '@angular/core';
|
|
65
|
+
import { HlmSheetModule } from '@egose/shadcn-theme-ng/sheet';
|
|
66
|
+
|
|
67
|
+
@NgModule({ imports: [HlmSheetModule] })
|
|
68
|
+
export class DemoModule {}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Anatomy / Structure
|
|
72
|
+
|
|
73
|
+
The `HlmSheet` root renders `<brn-sheet-overlay hlm />` plus your projected content. `HlmSheetContent` must be projected with the brain structural directive `*brnSheetContent` so it opens/closes with dialog state; the trigger uses `*brnSheetTrigger`:
|
|
74
|
+
|
|
75
|
+
```html
|
|
76
|
+
<hlm-sheet>
|
|
77
|
+
<button hlmButton *brnSheetTrigger>Edit profile</button>
|
|
78
|
+
|
|
79
|
+
<hlm-sheet-content *brnSheetContent="let ctx">
|
|
80
|
+
<hlm-sheet-header>
|
|
81
|
+
<h2 hlmSheetTitle>Edit profile</h2>
|
|
82
|
+
<p hlmSheetDescription>Update your details. Click save when done.</p>
|
|
83
|
+
</hlm-sheet-header>
|
|
84
|
+
|
|
85
|
+
<div class="tw:px-4">...form fields...</div>
|
|
86
|
+
|
|
87
|
+
<hlm-sheet-footer>
|
|
88
|
+
<button hlmButton brnSheetClose hlmSheetClose>Save</button>
|
|
89
|
+
<button hlmButton variant="outline" brnSheetClose hlmSheetClose>Cancel</button>
|
|
90
|
+
</hlm-sheet-footer>
|
|
91
|
+
</hlm-sheet-content>
|
|
92
|
+
</hlm-sheet>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Real selectors:
|
|
96
|
+
|
|
97
|
+
| Selector | Class | Notes |
|
|
98
|
+
| ------------------------------------------ | --------------------- | -------------------------------------------------------------------------------------------- |
|
|
99
|
+
| `hlm-sheet` | `HlmSheet` | Root; template = overlay + `<ng-content />`; provides itself as `BrnDialog`/`BrnSheet` |
|
|
100
|
+
| `hlm-sheet-content` | `HlmSheetContent` | Sliding panel; auto close (X) button; `data-state` reflects open/closed |
|
|
101
|
+
| `hlm-sheet-header` | `HlmSheetHeader` | Column layout, padded |
|
|
102
|
+
| `hlm-sheet-footer` | `HlmSheetFooter` | Bottom-pinned column (`mt-auto`), padded |
|
|
103
|
+
| `[hlmSheetTitle]` | `HlmSheetTitle` | Semibold title; forwards `BrnSheetTitle` (accessible dialog name) |
|
|
104
|
+
| `[hlmSheetDescription]` | `HlmSheetDescription` | Muted small description; forwards `BrnSheetDescription` |
|
|
105
|
+
| `[hlmSheetOverlay],brn-sheet-overlay[hlm]` | `HlmSheetOverlay` | Dimmed backdrop with fade animations |
|
|
106
|
+
| `[hlmSheetClose],[brnSheetClose][hlm]` | `HlmSheetClose` | Close-button styling (absolute top-right); apply on an element that also has `brnSheetClose` |
|
|
107
|
+
|
|
108
|
+
## API reference
|
|
109
|
+
|
|
110
|
+
### HlmSheet (component)
|
|
111
|
+
|
|
112
|
+
Extends `BrnSheet`, so every `BrnSheet`/`BrnDialog` input/output (e.g. `state`, `stateChanged`, `side` where supported) is available on the host. Own template: `<brn-sheet-overlay hlm />` + content outlet. `exportAs: 'hlmSheet'` for `#sheet="hlmSheet"` references.
|
|
113
|
+
|
|
114
|
+
### HlmSheetContent (component)
|
|
115
|
+
|
|
116
|
+
| Input | Type | Default | Description |
|
|
117
|
+
| --------------------- | ------------ | ------- | --------------------------------------------------------------------- |
|
|
118
|
+
| `class` (`userClass`) | `ClassValue` | `''` | Extra classes appended to the `sheetVariants({ side })` panel classes |
|
|
119
|
+
|
|
120
|
+
The `side` comes from the exposed-side provider of the enclosing brain sheet context (`injectExposedSideProvider`); the open state comes from `injectExposesStateProvider` and is mirrored to `data-state`. Side classes via the exported `sheetVariants` cva:
|
|
121
|
+
|
|
122
|
+
| `side` | Placement |
|
|
123
|
+
| ----------------- | ------------------------------------------------------------------ |
|
|
124
|
+
| `right` (default) | Right edge, full height, `w-3/4 sm:max-w-sm`, slides in from right |
|
|
125
|
+
| `left` | Left edge, mirrored |
|
|
126
|
+
| `top` | Top edge, full width, auto height, bottom border |
|
|
127
|
+
| `bottom` | Bottom edge, full width, auto height, top border |
|
|
128
|
+
|
|
129
|
+
The built-in close button (`<button brnSheetClose hlm>` with `lucideX` icon + sr-only "Close") is always rendered — add `class="...hidden"` overrides or your own close controls as needed; you cannot remove it via input.
|
|
130
|
+
|
|
131
|
+
### HlmSheetHeader / HlmSheetFooter / HlmSheetTitle / HlmSheetDescription
|
|
132
|
+
|
|
133
|
+
Layout-only (header: `flex flex-col gap-1.5 p-4`; footer: `mt-auto flex flex-col gap-2 p-4`) plus a `class` (`userClass`) input each. Title forwards `BrnSheetTitle`, description forwards `BrnSheetDescription` — always include a title so the dialog has an accessible name.
|
|
134
|
+
|
|
135
|
+
### HlmSheetOverlay / HlmSheetClose (directives)
|
|
136
|
+
|
|
137
|
+
Styling-only, each with a `class` (`userClass`) input. `HlmSheetOverlay` pushes its computed class into a custom-class-settable host when present (brain overlay interop). `HlmSheetClose` positions the button absolutely top-right with the subtle-opacity hover treatment — it must sit on an element that also closes the sheet (`brnSheetClose`).
|
|
138
|
+
|
|
139
|
+
## Examples
|
|
140
|
+
|
|
141
|
+
### 1. Basic right-side sheet
|
|
142
|
+
|
|
143
|
+
```ts
|
|
144
|
+
import { Component } from '@angular/core';
|
|
145
|
+
import { BrnSheetImports } from '@spartan-ng/brain/sheet';
|
|
146
|
+
import { HlmButtonImports } from '@egose/shadcn-theme-ng/button';
|
|
147
|
+
import { HlmSheetImports } from '@egose/shadcn-theme-ng/sheet';
|
|
148
|
+
|
|
149
|
+
@Component({
|
|
150
|
+
selector: 'app-basic-sheet',
|
|
151
|
+
standalone: true,
|
|
152
|
+
imports: [BrnSheetImports, HlmButtonImports, HlmSheetImports],
|
|
153
|
+
template: `
|
|
154
|
+
<hlm-sheet>
|
|
155
|
+
<button hlmButton variant="outline" *brnSheetTrigger>Open sheet</button>
|
|
156
|
+
|
|
157
|
+
<hlm-sheet-content *brnSheetContent="let ctx">
|
|
158
|
+
<hlm-sheet-header>
|
|
159
|
+
<h2 hlmSheetTitle>Notifications</h2>
|
|
160
|
+
<p hlmSheetDescription>You have 3 unread messages.</p>
|
|
161
|
+
</hlm-sheet-header>
|
|
162
|
+
<div class="tw:px-4 tw:text-sm">Sheet body…</div>
|
|
163
|
+
<hlm-sheet-footer>
|
|
164
|
+
<button hlmButton brnSheetClose hlmSheetClose>Done</button>
|
|
165
|
+
</hlm-sheet-footer>
|
|
166
|
+
</hlm-sheet-content>
|
|
167
|
+
</hlm-sheet>
|
|
168
|
+
`,
|
|
169
|
+
})
|
|
170
|
+
export class BasicSheetComponent {}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
(`*brnSheetTrigger` / `*brnSheetContent` come from `BrnSheetImports` — import that alongside `HlmSheetImports`.)
|
|
174
|
+
|
|
175
|
+
### 2. All four sides
|
|
176
|
+
|
|
177
|
+
```html
|
|
178
|
+
<hlm-sheet [side]="'left'">
|
|
179
|
+
<button hlmButton *brnSheetTrigger>Left nav</button>
|
|
180
|
+
<hlm-sheet-content *brnSheetContent="let ctx">
|
|
181
|
+
<hlm-sheet-header>
|
|
182
|
+
<h2 hlmSheetTitle>Menu</h2>
|
|
183
|
+
</hlm-sheet-header>
|
|
184
|
+
</hlm-sheet-content>
|
|
185
|
+
</hlm-sheet>
|
|
186
|
+
|
|
187
|
+
<!-- side="top" | side="bottom" work the same; omit for the default right -->
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
`side` is read by `HlmSheetContent` through the exposed-side provider, and `sheetVariants({ side })` drives the slide animation direction.
|
|
191
|
+
|
|
192
|
+
### 3. Form sheet with footer actions
|
|
193
|
+
|
|
194
|
+
```ts
|
|
195
|
+
import { Component } from '@angular/core';
|
|
196
|
+
import { FormsModule } from '@angular/forms';
|
|
197
|
+
import { BrnSheetImports } from '@spartan-ng/brain/sheet';
|
|
198
|
+
import { HlmButtonImports } from '@egose/shadcn-theme-ng/button';
|
|
199
|
+
import { HlmInputImports } from '@egose/shadcn-theme-ng/input';
|
|
200
|
+
import { HlmLabelImports } from '@egose/shadcn-theme-ng/label';
|
|
201
|
+
import { HlmSheetImports } from '@egose/shadcn-theme-ng/sheet';
|
|
202
|
+
|
|
203
|
+
@Component({
|
|
204
|
+
selector: 'app-form-sheet',
|
|
205
|
+
standalone: true,
|
|
206
|
+
imports: [BrnSheetImports, FormsModule, HlmButtonImports, HlmInputImports, HlmLabelImports, HlmSheetImports],
|
|
207
|
+
template: `
|
|
208
|
+
<hlm-sheet>
|
|
209
|
+
<button hlmButton *brnSheetTrigger>Edit profile</button>
|
|
210
|
+
<hlm-sheet-content *brnSheetContent="let ctx">
|
|
211
|
+
<hlm-sheet-header>
|
|
212
|
+
<h2 hlmSheetTitle>Edit profile</h2>
|
|
213
|
+
<p hlmSheetDescription>Changes save when you click Save.</p>
|
|
214
|
+
</hlm-sheet-header>
|
|
215
|
+
|
|
216
|
+
<div class="tw:grid tw:gap-4 tw:px-4">
|
|
217
|
+
<div class="tw:grid tw:gap-2">
|
|
218
|
+
<label hlmLabel for="sheet-name">Name</label>
|
|
219
|
+
<input hlmInput id="sheet-name" [(ngModel)]="name" name="name" />
|
|
220
|
+
</div>
|
|
221
|
+
</div>
|
|
222
|
+
|
|
223
|
+
<hlm-sheet-footer>
|
|
224
|
+
<button hlmButton (click)="save(ctx)">Save</button>
|
|
225
|
+
<button hlmButton variant="outline" brnSheetClose hlmSheetClose>Cancel</button>
|
|
226
|
+
</hlm-sheet-footer>
|
|
227
|
+
</hlm-sheet-content>
|
|
228
|
+
</hlm-sheet>
|
|
229
|
+
`,
|
|
230
|
+
})
|
|
231
|
+
export class FormSheetComponent {
|
|
232
|
+
name = 'Ada';
|
|
233
|
+
|
|
234
|
+
save(ctx: { close: () => void }): void {
|
|
235
|
+
console.log('saving', this.name);
|
|
236
|
+
ctx.close();
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### 4. Programmatic open/close via exportAs
|
|
242
|
+
|
|
243
|
+
```html
|
|
244
|
+
<hlm-sheet #sheet="hlmSheet" [state]="state">
|
|
245
|
+
<hlm-sheet-content *brnSheetContent="let ctx">
|
|
246
|
+
<hlm-sheet-header>
|
|
247
|
+
<h2 hlmSheetTitle>Controlled</h2>
|
|
248
|
+
<p hlmSheetDescription>Opened from code.</p>
|
|
249
|
+
</hlm-sheet-header>
|
|
250
|
+
<hlm-sheet-footer>
|
|
251
|
+
<button hlmButton (click)="state = 'closed'">Close from code</button>
|
|
252
|
+
</hlm-sheet-footer>
|
|
253
|
+
</hlm-sheet-content>
|
|
254
|
+
</hlm-sheet>
|
|
255
|
+
|
|
256
|
+
<button hlmButton (click)="state = 'open'">Open from code</button>
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### 5. Custom close affordances with `hlmSheetClose`
|
|
260
|
+
|
|
261
|
+
```html
|
|
262
|
+
<hlm-sheet-content *brnSheetContent="let ctx">
|
|
263
|
+
<hlm-sheet-header>
|
|
264
|
+
<h2 hlmSheetTitle>Confirm delete</h2>
|
|
265
|
+
<p hlmSheetDescription>This action cannot be undone.</p>
|
|
266
|
+
</hlm-sheet-header>
|
|
267
|
+
|
|
268
|
+
<hlm-sheet-footer>
|
|
269
|
+
<button hlmButton variant="destructive" brnSheetClose hlmSheetClose>Delete</button>
|
|
270
|
+
<button hlmButton variant="ghost" brnSheetClose hlmSheetClose>Keep it</button>
|
|
271
|
+
</hlm-sheet-footer>
|
|
272
|
+
</hlm-sheet-content>
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
`brnSheetClose` does the closing; `hlmSheetClose` only styles. You can also put `hlmSheetClose` on any absolutely-positioned custom close button.
|
|
276
|
+
|
|
277
|
+
### 6. Wide / custom-sized content with `sheetVariants`
|
|
278
|
+
|
|
279
|
+
```ts
|
|
280
|
+
import { Component } from '@angular/core';
|
|
281
|
+
import { sheetVariants } from '@egose/shadcn-theme-ng/sheet';
|
|
282
|
+
|
|
283
|
+
@Component({ selector: 'app-wide-sheet', template: '' })
|
|
284
|
+
export class WideSheetComponent {
|
|
285
|
+
// Reuse the exact variant builder for a custom panel:
|
|
286
|
+
protected readonly panelClass = sheetVariants({ side: 'right' });
|
|
287
|
+
}
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
```html
|
|
291
|
+
<hlm-sheet-content *brnSheetContent="let ctx" class="tw:sm:max-w-lg"> ... </hlm-sheet-content>
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
`userClass` merges after the variant classes, so `tw:sm:max-w-lg` widens the default `sm:max-w-sm` panel.
|
|
295
|
+
|
|
296
|
+
## Accessibility notes
|
|
297
|
+
|
|
298
|
+
- Always include `hlmSheetTitle` — it forwards `BrnSheetTitle` and gives the dialog its accessible name. Add `hlmSheetDescription` for context.
|
|
299
|
+
- Focus is trapped inside the open sheet and returned to the trigger on close (brain dialog behavior); keep the trigger in the DOM and don't unmount the sheet while open.
|
|
300
|
+
- The overlay click + `Escape` dismiss via brain defaults; destructive flows should still require an explicit footer confirmation, not overlay dismissal alone.
|
|
301
|
+
- The built-in X button has an sr-only "Close" label — if you hide it, provide another labelled close control.
|
|
302
|
+
|
|
303
|
+
## Theming / CSS variables
|
|
304
|
+
|
|
305
|
+
Class-driven (`bg-background` panel, `bg-black/50` overlay, border tokens). Animate via the `data-[state=open|closed]` attributes if you customize transitions. Dark mode follows the theme tokens.
|
|
306
|
+
|
|
307
|
+
## Related subpaths
|
|
308
|
+
|
|
309
|
+
- `@egose/shadcn-theme-ng/dialog` — centered modal counterpart
|
|
310
|
+
- `@egose/shadcn-theme-ng/drawer` — bottom-anchored mobile-style panel counterpart
|
|
311
|
+
- `@egose/shadcn-theme-ng/sidebar` — persistent app navigation (uses `hlm-sheet` internally on mobile)
|
|
312
|
+
- `@egose/shadcn-theme-ng/button` — triggers and footer actions
|