@egose/shadcn-theme-ng-tw 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.
Files changed (86) hide show
  1. package/README.md +1 -1
  2. package/accordion/README.md +405 -2
  3. package/alert/README.md +372 -2
  4. package/alert-dialog/README.md +471 -5
  5. package/aspect-ratio/README.md +272 -5
  6. package/autocomplete/README.md +502 -2
  7. package/avatar/README.md +357 -5
  8. package/badge/README.md +318 -2
  9. package/basic-alert/README.md +353 -2
  10. package/breadcrumb/README.md +406 -5
  11. package/button/README.md +482 -2
  12. package/button/fesm2022/button.mjs +85 -107
  13. package/button/types/button.d.ts +5 -8
  14. package/button-group/README.md +318 -5
  15. package/button-group/fesm2022/button-group.mjs +1 -1
  16. package/calendar/README.md +357 -2
  17. package/card/README.md +331 -5
  18. package/carousel/README.md +333 -5
  19. package/carousel/fesm2022/carousel.mjs +4 -1
  20. package/checkbox/README.md +320 -2
  21. package/collapsible/README.md +332 -5
  22. package/combobox/README.md +507 -5
  23. package/combobox/fesm2022/combobox.mjs +4 -1
  24. package/command/README.md +435 -5
  25. package/confirmation-dialog/README.md +301 -2
  26. package/context-menu/README.md +366 -5
  27. package/date-picker/README.md +465 -2
  28. package/date-picker/fesm2022/date-picker.mjs +2 -2
  29. package/dialog/README.md +448 -2
  30. package/drawer/README.md +395 -5
  31. package/dropdown-menu/README.md +417 -5
  32. package/empty/README.md +329 -5
  33. package/field/README.md +385 -5
  34. package/form-checkbox/README.md +312 -2
  35. package/form-date-picker/README.md +322 -2
  36. package/form-field/README.md +356 -2
  37. package/form-field-simple/README.md +340 -2
  38. package/form-searchable-multiselect/README.md +361 -2
  39. package/form-select/README.md +350 -2
  40. package/form-text-input/README.md +371 -2
  41. package/form-textarea/README.md +347 -2
  42. package/hover-card/README.md +256 -5
  43. package/icon/README.md +239 -2
  44. package/input/README.md +269 -2
  45. package/input-group/README.md +335 -5
  46. package/input-group/fesm2022/input-group.mjs +3 -3
  47. package/input-otp/README.md +375 -5
  48. package/item/README.md +385 -5
  49. package/item/fesm2022/item.mjs +3 -3
  50. package/kbd/README.md +291 -5
  51. package/label/README.md +272 -2
  52. package/layout-simple/README.md +193 -2
  53. package/layout-simple/fesm2022/layout-simple.mjs +877 -409
  54. package/layout-simple/types/layout-simple.d.ts +174 -137
  55. package/menu/README.md +417 -2
  56. package/menubar/README.md +343 -5
  57. package/native-select/README.md +323 -5
  58. package/navigation-menu/README.md +369 -5
  59. package/package.json +1 -1
  60. package/pagination/README.md +388 -5
  61. package/popover/README.md +331 -2
  62. package/progress/README.md +311 -5
  63. package/radio-group/README.md +364 -2
  64. package/radio-group/fesm2022/radio-group.mjs +5 -1
  65. package/resizable/README.md +269 -5
  66. package/scroll-area/README.md +233 -5
  67. package/searchable-multiselect/README.md +323 -2
  68. package/select/README.md +437 -2
  69. package/separator/README.md +222 -2
  70. package/sheet/README.md +311 -2
  71. package/sidebar/README.md +457 -5
  72. package/skeleton/README.md +217 -5
  73. package/slider/README.md +273 -5
  74. package/slider/fesm2022/slider.mjs +17 -13
  75. package/sonner/README.md +346 -2
  76. package/spinner/README.md +284 -2
  77. package/switch/README.md +310 -2
  78. package/table/README.md +423 -5
  79. package/tabs/README.md +411 -2
  80. package/tabs/fesm2022/tabs.mjs +12 -2
  81. package/textarea/README.md +282 -5
  82. package/toggle/README.md +270 -5
  83. package/toggle-group/README.md +340 -5
  84. package/tooltip/README.md +269 -2
  85. package/typography/README.md +271 -5
  86. 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
- This project was generated using [Angular CLI](https://github.com/angular/angular-cli).
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
- ## Building
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
- To build the library, run:
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
- ng build drawer
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.