@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.
Files changed (87) 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/calendar/README.md +357 -2
  16. package/card/README.md +331 -5
  17. package/carousel/README.md +333 -5
  18. package/carousel/fesm2022/carousel.mjs +4 -1
  19. package/checkbox/README.md +320 -2
  20. package/collapsible/README.md +332 -5
  21. package/combobox/README.md +507 -5
  22. package/combobox/fesm2022/combobox.mjs +4 -1
  23. package/command/README.md +435 -5
  24. package/confirmation-dialog/README.md +301 -2
  25. package/context-menu/README.md +366 -5
  26. package/date-picker/README.md +465 -2
  27. package/date-picker/fesm2022/date-picker.mjs +2 -2
  28. package/dialog/README.md +448 -2
  29. package/drawer/README.md +395 -5
  30. package/dropdown-menu/README.md +417 -5
  31. package/empty/README.md +329 -5
  32. package/field/README.md +385 -5
  33. package/form-checkbox/README.md +312 -2
  34. package/form-date-picker/README.md +322 -2
  35. package/form-field/README.md +356 -2
  36. package/form-field-simple/README.md +340 -2
  37. package/form-searchable-multiselect/README.md +361 -2
  38. package/form-select/README.md +350 -2
  39. package/form-text-input/README.md +371 -2
  40. package/form-textarea/README.md +347 -2
  41. package/hover-card/README.md +256 -5
  42. package/icon/README.md +239 -2
  43. package/input/README.md +269 -2
  44. package/input-group/README.md +335 -5
  45. package/input-group/fesm2022/input-group.mjs +3 -3
  46. package/input-otp/README.md +375 -5
  47. package/item/README.md +385 -5
  48. package/item/fesm2022/item.mjs +3 -3
  49. package/kbd/README.md +291 -5
  50. package/label/README.md +272 -2
  51. package/layout-simple/README.md +193 -2
  52. package/layout-simple/fesm2022/layout-simple.mjs +472 -236
  53. package/layout-simple/types/layout-simple.d.ts +174 -137
  54. package/menu/README.md +417 -2
  55. package/menubar/README.md +343 -5
  56. package/native-select/README.md +323 -5
  57. package/navigation-menu/README.md +369 -5
  58. package/package.json +1 -1
  59. package/pagination/README.md +388 -5
  60. package/popover/README.md +331 -2
  61. package/progress/README.md +311 -5
  62. package/radio-group/README.md +364 -2
  63. package/radio-group/fesm2022/radio-group.mjs +5 -1
  64. package/radio-group/types/radio-group.d.ts +1 -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 +3 -3
  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 +2 -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/typography/types/typography.d.ts +8 -8
  87. package/utils/README.md +303 -2
package/README.md CHANGED
@@ -156,7 +156,7 @@ import { EgLayoutSimple, MenuItem } from '@egose/shadcn-theme-ng/layout-simple';
156
156
  standalone: true,
157
157
  imports: [EgLayoutSimple, ...HlmButtonImports],
158
158
  template: \`
159
- <eg-layout-simple [leftMenus]="items">
159
+ <eg-layout-simple brandName="My workspace" [primaryNavigation]="items">
160
160
  <button hlmBtn variant="primary">Click</button>
161
161
  </eg-layout-simple>
162
162
  \`,
@@ -1,3 +1,406 @@
1
- # Accordion Subpath
1
+ # Accordion (`@egose/shadcn-theme-ng/accordion`)
2
2
 
3
- This project ships only as `@egose/shadcn-theme-ng/accordion` or `@egose/shadcn-theme-ng-tw/accordion`. See the [package README](../../README.md) for installation, compatibility, Tailwind variant, test, and release guidance. Do not publish this project directory independently.
3
+ A collapsible content panel set in the shadcn/ui Accordion style. Each section pairs a clickable
4
+ trigger row with an expanding content region, so long option lists, FAQs, and settings groups stay
5
+ compact until the user opens them.
6
+
7
+ The Angular implementation is a thin styling layer over the headless
8
+ [`BrnAccordion*` primitives from `@spartan-ng/brain/accordion`](https://www.spartan-ng.com/):
9
+ `HlmAccordion` / `HlmAccordionItem` / `HlmAccordionTrigger` / `HlmAccordionContent` compose
10
+ `BrnAccordion` / `BrnAccordionItem` / `BrnAccordionTrigger` / `BrnAccordionContent` via
11
+ `hostDirectives` (or inheritance for the content), adding shadcn spacing, borders, typography, and
12
+ `class` merging through `hlm()` from `@egose/shadcn-theme-ng/utils`. `HlmAccordionIcon` is a
13
+ companion directive that styles an `ng-icon` (chevron-down) placed inside a trigger.
14
+
15
+ > **Ships as:** `@egose/shadcn-theme-ng/accordion` and `@egose/shadcn-theme-ng-tw/accordion`
16
+ > (the `tw:`-prefixed Tailwind variant). Both expose the identical TypeScript surface; only the
17
+ > emitted Tailwind class strings differ. See the [package README](../../README.md) for install
18
+ > steps, peer dependencies, and Tailwind setup. Do not publish this project directory independently.
19
+
20
+ ## Installation
21
+
22
+ ```bash
23
+ # Plain Tailwind (no prefix)
24
+ npm install @egose/shadcn-theme-ng
25
+
26
+ # tw:-prefixed Tailwind variant
27
+ npm install @egose/shadcn-theme-ng-tw
28
+ ```
29
+
30
+ Peer dependencies (Angular, `@spartan-ng/brain`, `@ng-icons/*`, `rxjs`, …) are documented in the
31
+ [package README](../../README.md#peer-dependencies). This subpath additionally relies at runtime on
32
+ `@egose/shadcn-theme-ng/utils` (`hlm()`), `@egose/shadcn-theme-ng/icon` (`provideHlmIconConfig`),
33
+ and `@ng-icons/lucide` (`lucideChevronDown`) for the icon directive.
34
+
35
+ ## Imports
36
+
37
+ All symbols are exported from the subpath root (`projects/accordion/src/public-api.ts`):
38
+
39
+ ```ts
40
+ import {
41
+ HlmAccordion,
42
+ HlmAccordionItem,
43
+ HlmAccordionTrigger,
44
+ HlmAccordionContent,
45
+ HlmAccordionIcon,
46
+ HlmAccordionImports,
47
+ HlmAccordionModule,
48
+ } from '@egose/shadcn-theme-ng/accordion';
49
+ // tw variant: replace with '@egose/shadcn-theme-ng-tw/accordion'
50
+ ```
51
+
52
+ Standalone component — spread the `*Imports` array:
53
+
54
+ ```ts
55
+ import { Component } from '@angular/core';
56
+ import { HlmAccordionImports } from '@egose/shadcn-theme-ng/accordion';
57
+
58
+ @Component({
59
+ selector: 'app-demo',
60
+ standalone: true,
61
+ imports: [...HlmAccordionImports],
62
+ template: `...`,
63
+ })
64
+ export class DemoComponent {}
65
+ ```
66
+
67
+ NgModule-based consumer — import the module:
68
+
69
+ ```ts
70
+ import { NgModule } from '@angular/core';
71
+ import { HlmAccordionModule } from '@egose/shadcn-theme-ng/accordion';
72
+
73
+ @NgModule({ imports: [HlmAccordionModule] })
74
+ export class DemoModule {}
75
+ ```
76
+
77
+ ## Anatomy / Structure
78
+
79
+ ```html
80
+ <!-- hlm-accordion OR any element with hlmAccordion -->
81
+ <hlm-accordion type="single" orientation="vertical">
82
+ <!-- hlm-accordion-item OR [hlmAccordionItem] OR brn-accordion-item[hlm] -->
83
+ <hlm-accordion-item>
84
+ <!-- any element with hlmAccordionTrigger -->
85
+ <button hlmAccordionTrigger>
86
+ Section title
87
+ <!-- chevron icon (either attribute spelling works) -->
88
+ <ng-icon hlmAccIcon name="lucideChevronDown" />
89
+ </button>
90
+ <!-- content element -->
91
+ <hlm-accordion-content>
92
+ <p>Collapsible body.</p>
93
+ </hlm-accordion-content>
94
+ </hlm-accordion-item>
95
+ </hlm-accordion>
96
+ ```
97
+
98
+ Real selectors (from source):
99
+
100
+ | Class | Selector(s) | Kind |
101
+ | --------------------- | ----------------------------------------------------------------- | --------- |
102
+ | `HlmAccordion` | `[hlmAccordion], hlm-accordion` | Directive |
103
+ | `HlmAccordionItem` | `[hlmAccordionItem], brn-accordion-item[hlm], hlm-accordion-item` | Directive |
104
+ | `HlmAccordionTrigger` | `[hlmAccordionTrigger]` | Directive |
105
+ | `HlmAccordionContent` | `hlm-accordion-content` | Component |
106
+ | `HlmAccordionIcon` | `ng-icon[egAccordionIcon], ng-icon[hlmAccIcon]` | Directive |
107
+
108
+ ## API reference
109
+
110
+ ### `HlmAccordion` — `[hlmAccordion], hlm-accordion`
111
+
112
+ Thin directive wrapper around `BrnAccordion` (inputs forwarded via `hostDirectives`).
113
+
114
+ | Input | Type | Default | Description |
115
+ | ------------- | --------------------------- | --------------- | --------------------------------------------------------------------------- |
116
+ | `type` | forwarded to `BrnAccordion` | (brain default) | `'single'` or `'multiple'` open-item behavior. |
117
+ | `orientation` | forwarded to `BrnAccordion` | (brain default) | `'horizontal'` renders the root as `flex-row`, anything else as `flex-col`. |
118
+ | `class` | `ClassValue` | `''` | Extra classes merged via `hlm()`. |
119
+
120
+ ### `HlmAccordionItem` — `[hlmAccordionItem], brn-accordion-item[hlm], hlm-accordion-item`
121
+
122
+ Thin wrapper around `BrnAccordionItem`.
123
+
124
+ | Input | Type | Default | Description |
125
+ | ---------- | ------------------------------- | ------- | ----------------------------------------- |
126
+ | `isOpened` | forwarded to `BrnAccordionItem` | — | Whether this item starts/sets open state. |
127
+ | `class` | `ClassValue` | `''` | Extra classes merged via `hlm()`. |
128
+
129
+ ### `HlmAccordionTrigger` — `[hlmAccordionTrigger]`
130
+
131
+ Thin wrapper around `BrnAccordionTrigger` (no extra inputs — the whole `BrnAccordionTrigger`
132
+ surface is inherited through `hostDirectives`).
133
+
134
+ | Input | Type | Default | Description |
135
+ | ------- | ------------ | ------- | --------------------------------- |
136
+ | `class` | `ClassValue` | `''` | Extra classes merged via `hlm()`. |
137
+
138
+ ### `HlmAccordionContent` — `hlm-accordion-content`
139
+
140
+ Component **extending** `BrnAccordionContent`, so the `state()` signal (`'open' | 'closed'`) and
141
+ all brain behavior are inherited. The open state switches the host between
142
+ `grid-rows-[1fr]` and `hidden`; an inner `div[attr.inert]` keeps closed content out of the
143
+ tab order.
144
+
145
+ | Input | Type | Default | Description |
146
+ | ------- | ------------ | ------- | --------------------------------- |
147
+ | `class` | `ClassValue` | `''` | Extra classes merged via `hlm()`. |
148
+
149
+ ### `HlmAccordionIcon` — `ng-icon[egAccordionIcon], ng-icon[hlmAccIcon]`
150
+
151
+ Styling directive for the chevron `ng-icon` inside a trigger. It registers
152
+ `provideIcons({ lucideChevronDown })` and `provideHlmIconConfig({ size: 'sm' })`, and applies the
153
+ muted, small, animated sizing classes.
154
+
155
+ | Input | Type | Default | Description |
156
+ | ------- | ------------ | ------- | --------------------------------- |
157
+ | `class` | `ClassValue` | `''` | Extra classes merged via `hlm()`. |
158
+
159
+ > **Selector quirk (read from source):** the trigger stylesheet contains a
160
+ > `[&[data-state=open]>[egAccIcon]]:rotate-180` rule, but the icon directive itself matches
161
+ > `egAccordionIcon` / `hlmAccIcon`. If you want the chevron to rotate automatically on open, add a
162
+ > plain `egAccIcon` attribute to the icon element alongside the directive attribute
163
+ > (see the rotation example below).
164
+
165
+ ## Examples
166
+
167
+ ### 1. Basic single accordion
168
+
169
+ ```ts
170
+ import { Component } from '@angular/core';
171
+ import { HlmAccordionImports } from '@egose/shadcn-theme-ng/accordion';
172
+
173
+ @Component({
174
+ selector: 'app-accordion-basic',
175
+ standalone: true,
176
+ imports: [...HlmAccordionImports],
177
+ template: `
178
+ <hlm-accordion type="single">
179
+ <hlm-accordion-item>
180
+ <button hlmAccordionTrigger>
181
+ Is it accessible?
182
+ <ng-icon hlmAccIcon name="lucideChevronDown" />
183
+ </button>
184
+ <hlm-accordion-content>
185
+ <p>Yes. Triggers are real buttons and closed panels are inert.</p>
186
+ </hlm-accordion-content>
187
+ </hlm-accordion-item>
188
+ <hlm-accordion-item>
189
+ <button hlmAccordionTrigger>
190
+ Is it styled?
191
+ <ng-icon hlmAccIcon name="lucideChevronDown" />
192
+ </button>
193
+ <hlm-accordion-content>
194
+ <p>Yes. It follows the shadcn/ui accordion look.</p>
195
+ </hlm-accordion-content>
196
+ </hlm-accordion-item>
197
+ </hlm-accordion>
198
+ `,
199
+ })
200
+ export class AccordionBasicComponent {}
201
+ ```
202
+
203
+ ```html
204
+ <app-accordion-basic />
205
+ ```
206
+
207
+ ### 2. Multiple open panels + attribute selectors on native elements
208
+
209
+ `HlmAccordion` also works as an attribute on a `div`, and items accept the long
210
+ `brn-accordion-item[hlm]` spelling for interop with raw brain templates.
211
+
212
+ ```ts
213
+ import { Component } from '@angular/core';
214
+ import { HlmAccordionImports } from '@egose/shadcn-theme-ng/accordion';
215
+
216
+ @Component({
217
+ selector: 'app-accordion-multiple',
218
+ standalone: true,
219
+ imports: [...HlmAccordionImports],
220
+ template: `
221
+ <div hlmAccordion type="multiple">
222
+ <div hlmAccordionItem>
223
+ <button hlmAccordionTrigger>
224
+ Shipping
225
+ <ng-icon egAccordionIcon name="lucideChevronDown" />
226
+ </button>
227
+ <hlm-accordion-content><p>Ships worldwide.</p></hlm-accordion-content>
228
+ </div>
229
+ <div hlmAccordionItem>
230
+ <button hlmAccordionTrigger>
231
+ Returns
232
+ <ng-icon egAccordionIcon name="lucideChevronDown" />
233
+ </button>
234
+ <hlm-accordion-content><p>30-day returns.</p></hlm-accordion-content>
235
+ </div>
236
+ </div>
237
+ `,
238
+ })
239
+ export class AccordionMultipleComponent {}
240
+ ```
241
+
242
+ ### 3. Pre-opened item via `isOpened`
243
+
244
+ ```ts
245
+ import { Component } from '@angular/core';
246
+ import { HlmAccordionImports } from '@egose/shadcn-theme-ng/accordion';
247
+
248
+ @Component({
249
+ selector: 'app-accordion-open',
250
+ standalone: true,
251
+ imports: [...HlmAccordionImports],
252
+ template: `
253
+ <hlm-accordion type="single">
254
+ <hlm-accordion-item [isOpened]="true">
255
+ <button hlmAccordionTrigger>
256
+ Open by default
257
+ <ng-icon hlmAccIcon name="lucideChevronDown" />
258
+ </button>
259
+ <hlm-accordion-content>
260
+ <p>This panel renders expanded on first paint.</p>
261
+ </hlm-accordion-content>
262
+ </hlm-accordion-item>
263
+ <hlm-accordion-item>
264
+ <button hlmAccordionTrigger>
265
+ Closed by default
266
+ <ng-icon hlmAccIcon name="lucideChevronDown" />
267
+ </button>
268
+ <hlm-accordion-content><p>Opens on click.</p></hlm-accordion-content>
269
+ </hlm-accordion-item>
270
+ </hlm-accordion>
271
+ `,
272
+ })
273
+ export class AccordionOpenComponent {}
274
+ ```
275
+
276
+ ### 4. Chevron that rotates on open
277
+
278
+ The stylesheet rotates a child carrying a bare `egAccIcon` attribute when the trigger reports
279
+ `data-state="open"`. Combine it with the icon directive so you keep both the sizing and the
280
+ rotation:
281
+
282
+ ```ts
283
+ import { Component } from '@angular/core';
284
+ import { HlmAccordionImports } from '@egose/shadcn-theme-ng/accordion';
285
+
286
+ @Component({
287
+ selector: 'app-accordion-rotate',
288
+ standalone: true,
289
+ imports: [...HlmAccordionImports],
290
+ template: `
291
+ <hlm-accordion type="single">
292
+ @for (faq of faqs; track faq.q) {
293
+ <hlm-accordion-item>
294
+ <button hlmAccordionTrigger>
295
+ {{ faq.q }}
296
+ <ng-icon hlmAccIcon egAccIcon name="lucideChevronDown" />
297
+ </button>
298
+ <hlm-accordion-content>
299
+ <p>{{ faq.a }}</p>
300
+ </hlm-accordion-content>
301
+ </hlm-accordion-item>
302
+ }
303
+ </hlm-accordion>
304
+ `,
305
+ })
306
+ export class AccordionRotateComponent {
307
+ readonly faqs = [
308
+ { q: 'What is shadcn?', a: 'A set of re-usable UI patterns.' },
309
+ { q: 'What is spartan-ng?', a: 'Headless Angular primitives (brain) plus styled (helm) components.' },
310
+ ];
311
+ }
312
+ ```
313
+
314
+ ### 5. Data-driven FAQ with custom classes
315
+
316
+ Every piece accepts a `class` input merged through `hlm()`, so per-item tweaks compose cleanly:
317
+
318
+ ```ts
319
+ import { Component, signal } from '@angular/core';
320
+ import { HlmAccordionImports } from '@egose/shadcn-theme-ng/accordion';
321
+
322
+ @Component({
323
+ selector: 'app-accordion-faq',
324
+ standalone: true,
325
+ imports: [...HlmAccordionImports],
326
+ template: `
327
+ <hlm-accordion type="single" class="tw:rounded-lg tw:border tw:px-4">
328
+ @for (faq of faqs(); track faq.q) {
329
+ <hlm-accordion-item class="tw:last:border-b-0">
330
+ <button hlmAccordionTrigger class="tw:text-base">
331
+ {{ faq.q }}
332
+ <ng-icon hlmAccIcon name="lucideChevronDown" />
333
+ </button>
334
+ <hlm-accordion-content class="tw:text-muted-foreground">
335
+ <p>{{ faq.a }}</p>
336
+ @if (faq.link) {
337
+ <a class="tw:underline" [href]="faq.link">Learn more</a>
338
+ }
339
+ </hlm-accordion-content>
340
+ </hlm-accordion-item>
341
+ }
342
+ </hlm-accordion>
343
+ `,
344
+ })
345
+ export class AccordionFaqComponent {
346
+ readonly faqs = signal([
347
+ { q: 'How do I install?', a: 'npm install @egose/shadcn-theme-ng', link: '' },
348
+ { q: 'Which Tailwind setup?', a: 'Pick the plain or tw: variant.', link: '' },
349
+ ]);
350
+ }
351
+ ```
352
+
353
+ ### 6. Horizontal orientation
354
+
355
+ `HlmAccordion` reads the brain `orientation()` signal: `'horizontal'` switches the root to
356
+ `flex-row`, anything else stays `flex-col`.
357
+
358
+ ```ts
359
+ import { Component } from '@angular/core';
360
+ import { HlmAccordionImports } from '@egose/shadcn-theme-ng/accordion';
361
+
362
+ @Component({
363
+ selector: 'app-accordion-horizontal',
364
+ standalone: true,
365
+ imports: [...HlmAccordionImports],
366
+ template: `
367
+ <hlm-accordion type="multiple" orientation="horizontal" class="tw:gap-2">
368
+ <hlm-accordion-item class="tw:border tw:rounded-md tw:px-3">
369
+ <button hlmAccordionTrigger>A <ng-icon hlmAccIcon name="lucideChevronDown" /></button>
370
+ <hlm-accordion-content><p>First column.</p></hlm-accordion-content>
371
+ </hlm-accordion-item>
372
+ <hlm-accordion-item class="tw:border tw:rounded-md tw:px-3">
373
+ <button hlmAccordionTrigger>B <ng-icon hlmAccIcon name="lucideChevronDown" /></button>
374
+ <hlm-accordion-content><p>Second column.</p></hlm-accordion-content>
375
+ </hlm-accordion-item>
376
+ </hlm-accordion>
377
+ `,
378
+ })
379
+ export class AccordionHorizontalComponent {}
380
+ ```
381
+
382
+ ## Accessibility notes
383
+
384
+ - Triggers are native `<button>` elements enhanced by `BrnAccordionTrigger`: keyboard focus,
385
+ `Enter`/`Space` activation, and arrow-key navigation between items come from the brain primitive.
386
+ - `HlmAccordionContent` marks its inner wrapper `inert` while closed so hidden content is removed
387
+ from the tab order and assistive-technology traversal.
388
+ - The icon is decorative (`pointer-events-none`); keep the trigger label as real text so screen
389
+ readers announce the section name. If you add `sr-only` helper text, put it inside the trigger,
390
+ not the icon.
391
+ - `HlmAccordionIcon` sets the icon size through `provideHlmIconConfig({ size: 'sm' })` — overriding
392
+ the global icon config locally, so surrounding icons are unaffected.
393
+
394
+ ## Theming / CSS variables
395
+
396
+ Styling is class-based (`hlm()` + Tailwind tokens such as `border-border`, `text-muted-foreground`,
397
+ `ring-ring/50`); no component-specific CSS variables are declared. Pass `class` to any piece to
398
+ extend the look, and configure the shadcn theme tokens globally as described in the
399
+ [package README](../../README.md).
400
+
401
+ ## Related subpaths
402
+
403
+ - `@egose/shadcn-theme-ng/icon` — `provideHlmIconConfig`, `HlmIcon` (icon sizing used by the trigger icon)
404
+ - `@egose/shadcn-theme-ng/collapsible` — single-region expand/collapse primitive
405
+ - `@egose/shadcn-theme-ng/separator` — dividers between accordion items
406
+ - `@egose/shadcn-theme-ng/typography` — prose styling for rich accordion bodies