@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.
- package/README.md +1 -1
- package/accordion/README.md +405 -2
- package/alert/README.md +372 -2
- package/alert-dialog/README.md +471 -5
- package/aspect-ratio/README.md +272 -5
- package/autocomplete/README.md +502 -2
- package/avatar/README.md +357 -5
- package/badge/README.md +318 -2
- package/basic-alert/README.md +353 -2
- package/breadcrumb/README.md +406 -5
- package/button/README.md +482 -2
- package/button/fesm2022/button.mjs +85 -107
- package/button/types/button.d.ts +5 -8
- package/button-group/README.md +318 -5
- package/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/collapsible/README.md +332 -5
- package/combobox/README.md +507 -5
- package/combobox/fesm2022/combobox.mjs +4 -1
- package/command/README.md +435 -5
- package/confirmation-dialog/README.md +301 -2
- package/context-menu/README.md +366 -5
- package/date-picker/README.md +465 -2
- package/date-picker/fesm2022/date-picker.mjs +2 -2
- package/dialog/README.md +448 -2
- package/drawer/README.md +395 -5
- package/dropdown-menu/README.md +417 -5
- package/empty/README.md +329 -5
- package/field/README.md +385 -5
- package/form-checkbox/README.md +312 -2
- package/form-date-picker/README.md +322 -2
- package/form-field/README.md +356 -2
- package/form-field-simple/README.md +340 -2
- package/form-searchable-multiselect/README.md +361 -2
- package/form-select/README.md +350 -2
- package/form-text-input/README.md +371 -2
- package/form-textarea/README.md +347 -2
- package/hover-card/README.md +256 -5
- package/icon/README.md +239 -2
- package/input/README.md +269 -2
- package/input-group/README.md +335 -5
- package/input-group/fesm2022/input-group.mjs +3 -3
- package/input-otp/README.md +375 -5
- package/item/README.md +385 -5
- package/item/fesm2022/item.mjs +3 -3
- package/kbd/README.md +291 -5
- package/label/README.md +272 -2
- package/layout-simple/README.md +193 -2
- package/layout-simple/fesm2022/layout-simple.mjs +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/navigation-menu/README.md +369 -5
- package/package.json +1 -1
- package/pagination/README.md +388 -5
- package/popover/README.md +331 -2
- package/progress/README.md +311 -5
- package/radio-group/README.md +364 -2
- package/radio-group/fesm2022/radio-group.mjs +5 -1
- package/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 +17 -13
- package/sonner/README.md +346 -2
- package/spinner/README.md +284 -2
- package/switch/README.md +310 -2
- package/table/README.md +423 -5
- package/tabs/README.md +411 -2
- package/tabs/fesm2022/tabs.mjs +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/carousel/README.md
CHANGED
|
@@ -1,11 +1,339 @@
|
|
|
1
|
-
# Carousel
|
|
1
|
+
# Carousel (`@egose/shadcn-theme-ng/carousel`)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
An Embla-powered content carousel — the Angular port of shadcn/ui `Carousel`. `hlm-carousel` wraps `embla-carousel-angular` (`EmblaCarouselDirective`) with an `orientation`-aware shell (`horizontal | vertical`, RTL-aware via CDK `Directionality`), exposes Embla state as read-only signals (`canScrollPrev/Next`, `currentSlide`, `slideCount`), and ships `hlm-carousel-content` / `hlm-carousel-item` layout directives, `button[hlm-carousel-previous]` / `button[hlm-carousel-next]` controls, and an `hlm-carousel-slide-display` counter. No spartan-ng brain primitive is used; scrolling, snapping, and plugins are pure Embla.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Ships as `@egose/shadcn-theme-ng/carousel` and `@egose/shadcn-theme-ng-tw/carousel` (the `tw:`-prefixed variant). See the [package README](../../README.md) for install, peer dependencies, and Tailwind setup. Do not publish this project directory independently — it is consumed via the published subpath only.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Installation
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
|
|
10
|
+
# Plain Tailwind (no prefix):
|
|
11
|
+
npm install @egose/shadcn-theme-ng
|
|
12
|
+
|
|
13
|
+
# Or the tw:-prefixed variant:
|
|
14
|
+
npm install @egose/shadcn-theme-ng-tw
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Peers are listed in the [package README](../../README.md). This subpath declares `@angular/common`, `@angular/core`, and `@spartan-ng/brain` as peers (see `projects/carousel/package.json`); at runtime it also needs `embla-carousel`, `embla-carousel-angular` (transitive implementation deps — do not install directly unless you import them), plus `@egose/shadcn-theme-ng/button` styles for the nav buttons.
|
|
18
|
+
|
|
19
|
+
## Imports
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import {
|
|
23
|
+
HlmCarousel,
|
|
24
|
+
HlmCarouselContent,
|
|
25
|
+
HlmCarouselItem,
|
|
26
|
+
HlmCarouselPrevious,
|
|
27
|
+
HlmCarouselNext,
|
|
28
|
+
HlmCarouselSlideDisplay,
|
|
29
|
+
HlmCarouselImports,
|
|
30
|
+
HlmCarouselModule,
|
|
31
|
+
} from '@egose/shadcn-theme-ng/carousel';
|
|
32
|
+
// tw variant:
|
|
33
|
+
// import { ... } from '@egose/shadcn-theme-ng-tw/carousel';
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Standalone:
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import { Component } from '@angular/core';
|
|
40
|
+
import { HlmCarouselImports } from '@egose/shadcn-theme-ng/carousel';
|
|
41
|
+
|
|
42
|
+
@Component({
|
|
43
|
+
selector: 'app-demo',
|
|
44
|
+
standalone: true,
|
|
45
|
+
imports: [...HlmCarouselImports],
|
|
46
|
+
template: `...`,
|
|
47
|
+
})
|
|
48
|
+
export class DemoComponent {}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
NgModule:
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import { NgModule } from '@angular/core';
|
|
55
|
+
import { HlmCarouselModule } from '@egose/shadcn-theme-ng/carousel';
|
|
56
|
+
|
|
57
|
+
@NgModule({ imports: [HlmCarouselModule] })
|
|
58
|
+
export class DemoModule {}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Anatomy / Structure
|
|
62
|
+
|
|
63
|
+
```html
|
|
64
|
+
<hlm-carousel orientation="horizontal" [options]="{ loop: true }" [plugins]="plugins">
|
|
65
|
+
<hlm-carousel-content>
|
|
66
|
+
<hlm-carousel-item>Slide 1</hlm-carousel-item>
|
|
67
|
+
<hlm-carousel-item>Slide 2</hlm-carousel-item>
|
|
68
|
+
<hlm-carousel-item>Slide 3</hlm-carousel-item>
|
|
69
|
+
</hlm-carousel-content>
|
|
70
|
+
|
|
71
|
+
<button hlm-carousel-previous></button>
|
|
72
|
+
<button hlm-carousel-next></button>
|
|
73
|
+
<hlm-carousel-slide-display />
|
|
74
|
+
</hlm-carousel>
|
|
11
75
|
```
|
|
76
|
+
|
|
77
|
+
Real selectors:
|
|
78
|
+
|
|
79
|
+
| Class | Selector | Notes |
|
|
80
|
+
| ------------------------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
81
|
+
| `HlmCarousel` | `hlm-carousel` | `role="region"`, `aria-roledescription="carousel"`. Projects `[hlmCarouselContent]` into the Embla viewport; everything else into the outer shell (position nav buttons here). |
|
|
82
|
+
| `HlmCarouselContent` | `[hlmCarouselContent]`, `hlm-carousel-content` | Flex track (`-ml-4` / `-mt-4 flex-col` by orientation). Must be inside `hlm-carousel` (injects it). |
|
|
83
|
+
| `HlmCarouselItem` | `[hlmCarouselItem]`, `hlm-carousel-item` | `basis-full`, `role="group"`, `aria-roledescription="slide"`. |
|
|
84
|
+
| `HlmCarouselPrevious` | `button[hlm-carousel-previous]`, `button[hlmCarouselPrevious]` | Outline icon-sm button; auto-disabled at start; `(click)` → `scrollPrev()`. |
|
|
85
|
+
| `HlmCarouselNext` | `button[hlm-carousel-next]`, `button[hlmCarouselNext]` | Same, wired to `scrollNext()`. |
|
|
86
|
+
| `HlmCarouselSlideDisplay` | `hlm-carousel-slide-display` | `N / total` counter + sr-only label. |
|
|
87
|
+
|
|
88
|
+
## API reference
|
|
89
|
+
|
|
90
|
+
### `HlmCarousel` (`hlm-carousel`)
|
|
91
|
+
|
|
92
|
+
| Input | Type | Default | Description |
|
|
93
|
+
| ------------- | --------------------------------------------- | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
94
|
+
| `orientation` | `'horizontal' \| 'vertical'` | `'horizontal'` | Embla `axis` (`x`/`y`), track layout, and nav-button placement. |
|
|
95
|
+
| `options` | `Omit<EmblaOptionsType, 'axis'> \| undefined` | `undefined` | Raw Embla options (`loop`, `align`, `slidesToScroll`, `direction`, …). `direction` defaults to the ambient CDK `Directionality`; explicit `direction` wins. |
|
|
96
|
+
| `plugins` | `EmblaPluginType[]` | `[]` | Embla plugins (e.g. Autoplay). Passed straight to the directive. |
|
|
97
|
+
|
|
98
|
+
| Signal (read-only) | Type | Description |
|
|
99
|
+
| ------------------ | ----------------- | ----------------------------------------------------------------------------------- |
|
|
100
|
+
| `canScrollPrev` | `Signal<boolean>` | Updated on Embla `init`/`select`/`reInit`. Drives the previous button's `disabled`. |
|
|
101
|
+
| `canScrollNext` | `Signal<boolean>` | Same for next. |
|
|
102
|
+
| `currentSlide` | `Signal<number>` | Zero-based `selectedScrollSnap()`. |
|
|
103
|
+
| `slideCount` | `Signal<number>` | `scrollSnapList().length`. |
|
|
104
|
+
|
|
105
|
+
| Method | Description |
|
|
106
|
+
| -------------- | --------------------------------------------------- |
|
|
107
|
+
| `scrollPrev()` | Delegates to `EmblaCarouselDirective.scrollPrev()`. |
|
|
108
|
+
| `scrollNext()` | Delegates to `EmblaCarouselDirective.scrollNext()`. |
|
|
109
|
+
|
|
110
|
+
Host `(keydown)`: `ArrowLeft` → `scrollPrev()`, `ArrowRight` → `scrollNext()` (with `preventDefault`).
|
|
111
|
+
|
|
112
|
+
### Nav buttons
|
|
113
|
+
|
|
114
|
+
Both are `HlmBtn` host-directive components (`inputs: ['variant', 'size']`, defaulted via `provideBrnButtonConfig({ variant: 'outline', size: 'icon-sm' })`). Position classes are computed from the parent orientation (absolute `-start-12`/`-end-12` horizontal, `-top-12`/`-bottom-12` rotated vertical). Overriding `variant`/`size` is supported but replaces the outline icon look.
|
|
115
|
+
|
|
116
|
+
### `HlmCarouselSlideDisplay` (`hlm-carousel-slide-display`)
|
|
117
|
+
|
|
118
|
+
| Input | Type | Default | Description |
|
|
119
|
+
| ------------ | ------------ | --------------------------------- | ------------------------------------------------------------------ |
|
|
120
|
+
| `slideClass` | `ClassValue` | `'text-muted-foreground text-sm'` | Class for the visible `N / total` div (`aria-hidden`). |
|
|
121
|
+
| `label` | `string` | `'Slide'` | Prefix for the sr-only `"{{label}} N of total is displayed"` text. |
|
|
122
|
+
|
|
123
|
+
## Examples
|
|
124
|
+
|
|
125
|
+
### 1. Basic horizontal carousel
|
|
126
|
+
|
|
127
|
+
```ts
|
|
128
|
+
import { Component } from '@angular/core';
|
|
129
|
+
import { HlmCarouselImports } from '@egose/shadcn-theme-ng/carousel';
|
|
130
|
+
import { HlmCardImports } from '@egose/shadcn-theme-ng/card';
|
|
131
|
+
|
|
132
|
+
@Component({
|
|
133
|
+
selector: 'app-basic-carousel',
|
|
134
|
+
standalone: true,
|
|
135
|
+
imports: [...HlmCarouselImports, ...HlmCardImports],
|
|
136
|
+
template: `
|
|
137
|
+
<hlm-carousel class="mx-12 max-w-xl">
|
|
138
|
+
<hlm-carousel-content>
|
|
139
|
+
@for (n of [1, 2, 3, 4]; track n) {
|
|
140
|
+
<hlm-carousel-item>
|
|
141
|
+
<div hlmCard class="m-1">
|
|
142
|
+
<div hlmCardContent class="flex aspect-video items-center justify-center text-3xl font-semibold">
|
|
143
|
+
{{ n }}
|
|
144
|
+
</div>
|
|
145
|
+
</div>
|
|
146
|
+
</hlm-carousel-item>
|
|
147
|
+
}
|
|
148
|
+
</hlm-carousel-content>
|
|
149
|
+
<button hlm-carousel-previous></button>
|
|
150
|
+
<button hlm-carousel-next></button>
|
|
151
|
+
</hlm-carousel>
|
|
152
|
+
`,
|
|
153
|
+
})
|
|
154
|
+
export class BasicCarouselComponent {}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
> Nav buttons are absolutely positioned outside the viewport (`-start-12`/`-end-12`) — leave horizontal margin on the carousel or wrap it in padded layout.
|
|
158
|
+
|
|
159
|
+
### 2. Vertical carousel
|
|
160
|
+
|
|
161
|
+
```ts
|
|
162
|
+
import { Component } from '@angular/core';
|
|
163
|
+
import { HlmCarouselImports } from '@egose/shadcn-theme-ng/carousel';
|
|
164
|
+
|
|
165
|
+
@Component({
|
|
166
|
+
selector: 'app-vertical-carousel',
|
|
167
|
+
standalone: true,
|
|
168
|
+
imports: [...HlmCarouselImports],
|
|
169
|
+
template: `
|
|
170
|
+
<hlm-carousel orientation="vertical" class="my-12 h-96 w-64">
|
|
171
|
+
<hlm-carousel-content class="h-96">
|
|
172
|
+
@for (n of [1, 2, 3]; track n) {
|
|
173
|
+
<hlm-carousel-item>
|
|
174
|
+
<div class="bg-muted flex h-full items-center justify-center rounded-lg text-2xl">
|
|
175
|
+
{{ n }}
|
|
176
|
+
</div>
|
|
177
|
+
</hlm-carousel-item>
|
|
178
|
+
}
|
|
179
|
+
</hlm-carousel-content>
|
|
180
|
+
<button hlm-carousel-previous></button>
|
|
181
|
+
<button hlm-carousel-next></button>
|
|
182
|
+
</hlm-carousel>
|
|
183
|
+
`,
|
|
184
|
+
})
|
|
185
|
+
export class VerticalCarouselComponent {}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### 3. Looping + aligned + multi-slide options
|
|
189
|
+
|
|
190
|
+
Any Embla option except `axis` (owned by `orientation`) passes through.
|
|
191
|
+
|
|
192
|
+
```ts
|
|
193
|
+
import { Component } from '@angular/core';
|
|
194
|
+
import { HlmCarouselImports } from '@egose/shadcn-theme-ng/carousel';
|
|
195
|
+
|
|
196
|
+
@Component({
|
|
197
|
+
selector: 'app-loop-carousel',
|
|
198
|
+
standalone: true,
|
|
199
|
+
imports: [...HlmCarouselImports],
|
|
200
|
+
template: `
|
|
201
|
+
<hlm-carousel [options]="{ loop: true, align: 'start', slidesToScroll: 1 }" class="mx-12 max-w-2xl">
|
|
202
|
+
<hlm-carousel-content>
|
|
203
|
+
@for (n of [1, 2, 3, 4, 5, 6]; track n) {
|
|
204
|
+
<hlm-carousel-item class="md:basis-1/2 lg:basis-1/3">
|
|
205
|
+
<div class="bg-card m-1 rounded-lg p-6 text-center ring-1">Card {{ n }}</div>
|
|
206
|
+
</hlm-carousel-item>
|
|
207
|
+
}
|
|
208
|
+
</hlm-carousel-content>
|
|
209
|
+
<button hlm-carousel-previous></button>
|
|
210
|
+
<button hlm-carousel-next></button>
|
|
211
|
+
</hlm-carousel>
|
|
212
|
+
`,
|
|
213
|
+
})
|
|
214
|
+
export class LoopCarouselComponent {}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
> Override item basis per breakpoint with your own `class` — the directive merges it with `min-w-0 shrink-0 grow-0 basis-full`.
|
|
218
|
+
|
|
219
|
+
### 4. Slide counter display
|
|
220
|
+
|
|
221
|
+
```ts
|
|
222
|
+
import { Component } from '@angular/core';
|
|
223
|
+
import { HlmCarouselImports } from '@egose/shadcn-theme-ng/carousel';
|
|
224
|
+
|
|
225
|
+
@Component({
|
|
226
|
+
selector: 'app-counter-carousel',
|
|
227
|
+
standalone: true,
|
|
228
|
+
imports: [...HlmCarouselImports],
|
|
229
|
+
template: `
|
|
230
|
+
<hlm-carousel class="mx-12 max-w-xl">
|
|
231
|
+
<hlm-carousel-content>
|
|
232
|
+
@for (src of images; track src) {
|
|
233
|
+
<hlm-carousel-item>
|
|
234
|
+
<img [src]="src" alt="Carousel image" class="aspect-video w-full rounded-lg object-cover" />
|
|
235
|
+
</hlm-carousel-item>
|
|
236
|
+
}
|
|
237
|
+
</hlm-carousel-content>
|
|
238
|
+
<div class="mt-2 flex items-center justify-between">
|
|
239
|
+
<div class="flex gap-2">
|
|
240
|
+
<button hlm-carousel-previous class="static! translate-none! rotate-0!"></button>
|
|
241
|
+
<button hlm-carousel-next class="static! translate-none! rotate-0!"></button>
|
|
242
|
+
</div>
|
|
243
|
+
<hlm-carousel-slide-display label="Photo" slideClass="text-sm font-medium" />
|
|
244
|
+
</div>
|
|
245
|
+
</hlm-carousel>
|
|
246
|
+
`,
|
|
247
|
+
})
|
|
248
|
+
export class CounterCarouselComponent {
|
|
249
|
+
readonly images = [
|
|
250
|
+
'https://picsum.photos/800/450?1',
|
|
251
|
+
'https://picsum.photos/800/450?2',
|
|
252
|
+
'https://picsum.photos/800/450?3',
|
|
253
|
+
];
|
|
254
|
+
}
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### 5. Programmatic control via template ref
|
|
258
|
+
|
|
259
|
+
`scrollPrev/scrollNext` plus the state signals are public — wire custom dots or external buttons.
|
|
260
|
+
|
|
261
|
+
```ts
|
|
262
|
+
import { Component } from '@angular/core';
|
|
263
|
+
import { HlmCarouselImports, HlmCarousel } from '@egose/shadcn-theme-ng/carousel';
|
|
264
|
+
import { HlmButtonImports } from '@egose/shadcn-theme-ng/button';
|
|
265
|
+
|
|
266
|
+
@Component({
|
|
267
|
+
selector: 'app-controlled-carousel',
|
|
268
|
+
standalone: true,
|
|
269
|
+
imports: [...HlmCarouselImports, ...HlmButtonImports],
|
|
270
|
+
template: `
|
|
271
|
+
<hlm-carousel #car class="mx-12 max-w-xl">
|
|
272
|
+
<hlm-carousel-content>
|
|
273
|
+
@for (n of [1, 2, 3, 4]; track n) {
|
|
274
|
+
<hlm-carousel-item>
|
|
275
|
+
<div class="bg-muted m-1 flex aspect-video items-center justify-center rounded-lg">Slide {{ n }}</div>
|
|
276
|
+
</hlm-carousel-item>
|
|
277
|
+
}
|
|
278
|
+
</hlm-carousel-content>
|
|
279
|
+
</hlm-carousel>
|
|
280
|
+
|
|
281
|
+
<div class="mt-3 flex items-center gap-2">
|
|
282
|
+
<button hlmBtn variant="outline" (click)="car.scrollPrev()" [disabled]="!car.canScrollPrev()">Prev</button>
|
|
283
|
+
<button hlmBtn variant="outline" (click)="car.scrollNext()" [disabled]="!car.canScrollNext()">Next</button>
|
|
284
|
+
<span class="text-sm">Slide {{ car.currentSlide() + 1 }} / {{ car.slideCount() }}</span>
|
|
285
|
+
</div>
|
|
286
|
+
`,
|
|
287
|
+
})
|
|
288
|
+
export class ControlledCarouselComponent {}
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### 6. Autoplay plugin (advanced)
|
|
292
|
+
|
|
293
|
+
```ts
|
|
294
|
+
import { Component } from '@angular/core';
|
|
295
|
+
import Autoplay from 'embla-carousel-autoplay';
|
|
296
|
+
import { HlmCarouselImports } from '@egose/shadcn-theme-ng/carousel';
|
|
297
|
+
|
|
298
|
+
@Component({
|
|
299
|
+
selector: 'app-autoplay-carousel',
|
|
300
|
+
standalone: true,
|
|
301
|
+
imports: [...HlmCarouselImports],
|
|
302
|
+
template: `
|
|
303
|
+
<hlm-carousel [plugins]="plugins" [options]="{ loop: true }" class="mx-12 max-w-xl">
|
|
304
|
+
<hlm-carousel-content>
|
|
305
|
+
@for (n of [1, 2, 3]; track n) {
|
|
306
|
+
<hlm-carousel-item>
|
|
307
|
+
<div class="bg-muted m-1 flex aspect-video items-center justify-center rounded-lg text-2xl">
|
|
308
|
+
{{ n }}
|
|
309
|
+
</div>
|
|
310
|
+
</hlm-carousel-item>
|
|
311
|
+
}
|
|
312
|
+
</hlm-carousel-content>
|
|
313
|
+
<button hlm-carousel-previous></button>
|
|
314
|
+
<button hlm-carousel-next></button>
|
|
315
|
+
</hlm-carousel>
|
|
316
|
+
`,
|
|
317
|
+
})
|
|
318
|
+
export class AutoplayCarouselComponent {
|
|
319
|
+
readonly plugins = [Autoplay({ delay: 3000, stopOnInteraction: true })];
|
|
320
|
+
}
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
## Accessibility notes
|
|
324
|
+
|
|
325
|
+
- The shell is `role="region"` / `aria-roledescription="carousel"` and each item is `role="group"` / `aria-roledescription="slide"` — give the carousel an `aria-label` (e.g. `aria-label="Product photos"`) so regions are distinguishable.
|
|
326
|
+
- Nav buttons include sr-only `"Previous slide"` / `"Next slide"` text and auto-disable at the ends; keep the `disabled` binding intact.
|
|
327
|
+
- `hlm-carousel-slide-display` renders both a visible `aria-hidden` counter and an sr-only `"Slide N of T is displayed"` live-region-friendly label.
|
|
328
|
+
- Arrow-key handling is on the host (`ArrowLeft/Right` → prev/next). For vertical carousels, consider adding your own Up/Down handling — the built-in handler only maps Left/Right.
|
|
329
|
+
|
|
330
|
+
## Theming / CSS variables
|
|
331
|
+
|
|
332
|
+
No component-specific CSS variables. Track/item geometry comes from Tailwind (`basis-full`, `-ml-4`/`pl-4` gutters, `rounded-full` nav buttons). RTL flips automatically via CDK `Directionality` (chevron icons use `rtl:rotate-180`).
|
|
333
|
+
|
|
334
|
+
## Related subpaths
|
|
335
|
+
|
|
336
|
+
- `@egose/shadcn-theme-ng/button` — `HlmBtn` powers the prev/next buttons (`variant`/`size` host inputs).
|
|
337
|
+
- `@egose/shadcn-theme-ng/card` — typical slide content wrapper.
|
|
338
|
+
- `@egose/shadcn-theme-ng/icon` — `ng-icon` chevrons inside nav buttons (provide your own icons for custom controls).
|
|
339
|
+
- `@egose/shadcn-theme-ng/utils` — `hlm` class merging used by the nav-button positioning.
|
|
@@ -133,7 +133,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
133
133
|
class HlmCarouselItem {
|
|
134
134
|
_orientation = inject(HlmCarousel).orientation;
|
|
135
135
|
constructor() {
|
|
136
|
-
classes(() => [
|
|
136
|
+
classes(() => [
|
|
137
|
+
'tw:min-w-0 tw:shrink-0 tw:grow-0 tw:basis-full',
|
|
138
|
+
this._orientation() === 'horizontal' ? 'tw:pl-4' : 'tw:pt-4',
|
|
139
|
+
]);
|
|
137
140
|
}
|
|
138
141
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmCarouselItem, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
139
142
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: HlmCarouselItem, isStandalone: true, selector: "[hlmCarouselItem],hlm-carousel-item", host: { attributes: { "data-slot": "carousel-item", "role": "group", "aria-roledescription": "slide" } }, ngImport: i0 });
|