@egose/shadcn-theme-ng-tw 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/fesm2022/alert.mjs +1 -1
- 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/button-group/fesm2022/button-group.mjs +1 -1
- 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 +211 -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 +273 -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 +60 -16
- 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 +239 -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 +236 -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 +194 -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 +229 -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 +187 -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 +203 -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 +211 -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 +24 -15
- package/form-select/types/form-select.d.ts +18 -1
- package/form-slider/README.md +182 -0
- package/form-slider/fesm2022/form-slider.mjs +186 -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 +178 -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 +241 -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 +216 -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 +23 -13
- 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 +877 -409
- 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/sheet/fesm2022/sheet.mjs +1 -1
- package/sidebar/README.md +457 -5
- package/skeleton/README.md +217 -5
- package/slider/README.md +273 -5
- package/slider/fesm2022/slider.mjs +17 -13
- 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 +12 -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/README.md
CHANGED
|
@@ -138,7 +138,7 @@ Import by component name. Component `NameX` is reachable at `@egose/shadcn-theme
|
|
|
138
138
|
|
|
139
139
|
<!-- BEGIN GENERATED SUBPATHS -->
|
|
140
140
|
|
|
141
|
-
`accordion`, `alert`, `alert-dialog`, `aspect-ratio`, `autocomplete`, `avatar`, `badge`, `basic-alert`, `breadcrumb`, `button`, `button-group`, `calendar`, `card`, `carousel`, `checkbox`, `collapsible`, `combobox`, `command`, `confirmation-dialog`, `context-menu`, `date-picker`, `dialog`, `drawer`, `dropdown-menu`, `empty`, `field`, `form-checkbox`, `form-date-picker`, `form-field`, `form-field-simple`, `form-searchable-multiselect`, `form-select`, `form-text-input`, `form-textarea`, `hover-card`, `icon`, `input`, `input-group`, `input-otp`, `item`, `kbd`, `label`, `layout-simple`, `menu`, `menubar`, `native-select`, `navigation-menu`, `pagination`, `popover`, `progress`, `radio-group`, `resizable`, `scroll-area`, `searchable-multiselect`, `select`, `separator`, `sheet`, `sidebar`, `skeleton`, `slider`, `sonner`, `spinner`, `switch`, `table`, `tabs`, `textarea`, `toggle`, `toggle-group`, `tooltip`, `typography`, `utils`.
|
|
141
|
+
`accordion`, `alert`, `alert-dialog`, `aspect-ratio`, `autocomplete`, `avatar`, `badge`, `basic-alert`, `breadcrumb`, `button`, `button-group`, `calendar`, `card`, `carousel`, `checkbox`, `collapsible`, `combobox`, `command`, `confirmation-dialog`, `context-menu`, `date-picker`, `dialog`, `drawer`, `dropdown-menu`, `empty`, `field`, `form-autocomplete`, `form-checkbox`, `form-combobox`, `form-date-picker`, `form-date-picker-multi`, `form-date-range-picker`, `form-field`, `form-field-simple`, `form-input-otp`, `form-month-year-picker`, `form-native-select`, `form-phone-input`, `form-radio-group`, `form-searchable-multiselect`, `form-select`, `form-slider`, `form-switch`, `form-text-input`, `form-textarea`, `form-toggle`, `form-toggle-group`, `hover-card`, `icon`, `input`, `input-group`, `input-otp`, `item`, `kbd`, `label`, `layout-simple`, `menu`, `menubar`, `native-select`, `navigation-menu`, `pagination`, `phone-input`, `popover`, `progress`, `radio-group`, `resizable`, `scroll-area`, `searchable-multiselect`, `select`, `separator`, `sheet`, `sidebar`, `skeleton`, `slider`, `sonner`, `spinner`, `switch`, `table`, `tabs`, `textarea`, `toggle`, `toggle-group`, `tooltip`, `typography`, `utils`.
|
|
142
142
|
|
|
143
143
|
<!-- END GENERATED SUBPATHS -->
|
|
144
144
|
|
|
@@ -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 [
|
|
159
|
+
<eg-layout-simple brandName="My workspace" [primaryNavigation]="items">
|
|
160
160
|
<button hlmBtn variant="primary">Click</button>
|
|
161
161
|
</eg-layout-simple>
|
|
162
162
|
\`,
|
package/accordion/README.md
CHANGED
|
@@ -1,3 +1,406 @@
|
|
|
1
|
-
# Accordion
|
|
1
|
+
# Accordion (`@egose/shadcn-theme-ng/accordion`)
|
|
2
2
|
|
|
3
|
-
|
|
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
|