@tectra-ng/ui 0.1.4 → 0.1.6
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/carousel/README.md +53 -0
- package/datepicker/README.md +1 -1
- package/fesm2022/tectra-ng-ui-button.mjs +9 -3
- package/fesm2022/tectra-ng-ui-button.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-carousel.mjs +939 -0
- package/fesm2022/tectra-ng-ui-carousel.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-galleria.mjs +1140 -0
- package/fesm2022/tectra-ng-ui-galleria.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-icon-field.mjs +24 -8
- package/fesm2022/tectra-ng-ui-icon-field.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-image.mjs +759 -0
- package/fesm2022/tectra-ng-ui-image.mjs.map +1 -0
- package/galleria/README.md +62 -0
- package/image/README.md +54 -0
- package/package.json +55 -8
- package/types/tectra-ng-ui-button.d.ts +4 -2
- package/types/tectra-ng-ui-button.d.ts.map +1 -1
- package/types/tectra-ng-ui-carousel.d.ts +263 -0
- package/types/tectra-ng-ui-carousel.d.ts.map +1 -0
- package/types/tectra-ng-ui-galleria.d.ts +407 -0
- package/types/tectra-ng-ui-galleria.d.ts.map +1 -0
- package/types/tectra-ng-ui-icon-field.d.ts +9 -4
- package/types/tectra-ng-ui-icon-field.d.ts.map +1 -1
- package/types/tectra-ng-ui-image.d.ts +259 -0
- package/types/tectra-ng-ui-image.d.ts.map +1 -0
|
@@ -0,0 +1,939 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, DOCUMENT, DestroyRef, Directive, ElementRef, Injector, TemplateRef, afterNextRender, booleanAttribute, computed, contentChild, effect, inject, input, model, numberAttribute, signal, untracked, viewChild } from "@angular/core";
|
|
3
|
+
import { NgTemplateOutlet } from "@angular/common";
|
|
4
|
+
import { injectPassThrough, injectUnstyled } from "@tectra-ng/core/config";
|
|
5
|
+
import { injectTranslations } from "@tectra-ng/core/i18n";
|
|
6
|
+
import { optionalBoolean, txCanAnimate, txCssTime, txSwapMotion } from "@tectra-ng/core/utils";
|
|
7
|
+
import { toStyleObject } from "@tectra-ng/themes";
|
|
8
|
+
import { TxButton } from "@tectra-ng/ui/button";
|
|
9
|
+
var TxCarouselItemTemplate = class TxCarouselItemTemplate {
|
|
10
|
+
template = inject(TemplateRef);
|
|
11
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
12
|
+
minVersion: "12.0.0",
|
|
13
|
+
version: "22.2.3",
|
|
14
|
+
ngImport: i0,
|
|
15
|
+
type: TxCarouselItemTemplate,
|
|
16
|
+
deps: [],
|
|
17
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
18
|
+
});
|
|
19
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
20
|
+
minVersion: "14.0.0",
|
|
21
|
+
version: "22.2.3",
|
|
22
|
+
type: TxCarouselItemTemplate,
|
|
23
|
+
isStandalone: true,
|
|
24
|
+
selector: "ng-template[txCarouselItem]",
|
|
25
|
+
ngImport: i0
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
29
|
+
minVersion: "12.0.0",
|
|
30
|
+
version: "22.2.3",
|
|
31
|
+
ngImport: i0,
|
|
32
|
+
type: TxCarouselItemTemplate,
|
|
33
|
+
decorators: [{
|
|
34
|
+
type: Directive,
|
|
35
|
+
args: [{ selector: "ng-template[txCarouselItem]" }]
|
|
36
|
+
}]
|
|
37
|
+
});
|
|
38
|
+
var TxCarouselIndicatorTemplate = class TxCarouselIndicatorTemplate {
|
|
39
|
+
template = inject(TemplateRef);
|
|
40
|
+
static ngTemplateContextGuard(_directive, context) {
|
|
41
|
+
return !!context;
|
|
42
|
+
}
|
|
43
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
44
|
+
minVersion: "12.0.0",
|
|
45
|
+
version: "22.2.3",
|
|
46
|
+
ngImport: i0,
|
|
47
|
+
type: TxCarouselIndicatorTemplate,
|
|
48
|
+
deps: [],
|
|
49
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
50
|
+
});
|
|
51
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
52
|
+
minVersion: "14.0.0",
|
|
53
|
+
version: "22.2.3",
|
|
54
|
+
type: TxCarouselIndicatorTemplate,
|
|
55
|
+
isStandalone: true,
|
|
56
|
+
selector: "ng-template[txCarouselIndicator]",
|
|
57
|
+
ngImport: i0
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
61
|
+
minVersion: "12.0.0",
|
|
62
|
+
version: "22.2.3",
|
|
63
|
+
ngImport: i0,
|
|
64
|
+
type: TxCarouselIndicatorTemplate,
|
|
65
|
+
decorators: [{
|
|
66
|
+
type: Directive,
|
|
67
|
+
args: [{ selector: "ng-template[txCarouselIndicator]" }]
|
|
68
|
+
}]
|
|
69
|
+
});
|
|
70
|
+
var TxCarouselHeader = class TxCarouselHeader {
|
|
71
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
72
|
+
minVersion: "12.0.0",
|
|
73
|
+
version: "22.2.3",
|
|
74
|
+
ngImport: i0,
|
|
75
|
+
type: TxCarouselHeader,
|
|
76
|
+
deps: [],
|
|
77
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
78
|
+
});
|
|
79
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
80
|
+
minVersion: "14.0.0",
|
|
81
|
+
version: "22.2.3",
|
|
82
|
+
type: TxCarouselHeader,
|
|
83
|
+
isStandalone: true,
|
|
84
|
+
selector: "[txCarouselHeader]",
|
|
85
|
+
ngImport: i0
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
89
|
+
minVersion: "12.0.0",
|
|
90
|
+
version: "22.2.3",
|
|
91
|
+
ngImport: i0,
|
|
92
|
+
type: TxCarouselHeader,
|
|
93
|
+
decorators: [{
|
|
94
|
+
type: Directive,
|
|
95
|
+
args: [{ selector: "[txCarouselHeader]" }]
|
|
96
|
+
}]
|
|
97
|
+
});
|
|
98
|
+
var TxCarouselFooter = class TxCarouselFooter {
|
|
99
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
100
|
+
minVersion: "12.0.0",
|
|
101
|
+
version: "22.2.3",
|
|
102
|
+
ngImport: i0,
|
|
103
|
+
type: TxCarouselFooter,
|
|
104
|
+
deps: [],
|
|
105
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
106
|
+
});
|
|
107
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
108
|
+
minVersion: "14.0.0",
|
|
109
|
+
version: "22.2.3",
|
|
110
|
+
type: TxCarouselFooter,
|
|
111
|
+
isStandalone: true,
|
|
112
|
+
selector: "[txCarouselFooter]",
|
|
113
|
+
ngImport: i0
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
117
|
+
minVersion: "12.0.0",
|
|
118
|
+
version: "22.2.3",
|
|
119
|
+
ngImport: i0,
|
|
120
|
+
type: TxCarouselFooter,
|
|
121
|
+
decorators: [{
|
|
122
|
+
type: Directive,
|
|
123
|
+
args: [{ selector: "[txCarouselFooter]" }]
|
|
124
|
+
}]
|
|
125
|
+
});
|
|
126
|
+
const DRAG_START = 6;
|
|
127
|
+
const SWIPE_RATIO = .2;
|
|
128
|
+
const SWIPE_MIN = 40;
|
|
129
|
+
const EDGE_RESISTANCE = .3;
|
|
130
|
+
const SWAP_DURATION = 500;
|
|
131
|
+
const SWAP_STAGGER = 40;
|
|
132
|
+
function percent(value) {
|
|
133
|
+
return `${Math.round(value * 1e4) / 1e4}%`;
|
|
134
|
+
}
|
|
135
|
+
var TxCarousel = class TxCarousel {
|
|
136
|
+
document = inject(DOCUMENT);
|
|
137
|
+
host = inject(ElementRef);
|
|
138
|
+
destroyRef = inject(DestroyRef);
|
|
139
|
+
drag = null;
|
|
140
|
+
injector = inject(Injector);
|
|
141
|
+
swapToken = 0;
|
|
142
|
+
swapStarted = false;
|
|
143
|
+
suppressClick = false;
|
|
144
|
+
value = input([], ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
145
|
+
page = model(0, ...ngDevMode ? [{ debugName: "page" }] : /* istanbul ignore next */ []);
|
|
146
|
+
numVisible = input(1, {
|
|
147
|
+
...ngDevMode ? { debugName: "numVisible" } : /* istanbul ignore next */ {},
|
|
148
|
+
transform: numberAttribute
|
|
149
|
+
});
|
|
150
|
+
numScroll = input(1, {
|
|
151
|
+
...ngDevMode ? { debugName: "numScroll" } : /* istanbul ignore next */ {},
|
|
152
|
+
transform: numberAttribute
|
|
153
|
+
});
|
|
154
|
+
responsiveOptions = input(void 0, ...ngDevMode ? [{ debugName: "responsiveOptions" }] : /* istanbul ignore next */ []);
|
|
155
|
+
orientation = input("horizontal", ...ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []);
|
|
156
|
+
verticalViewPortHeight = input("300px", ...ngDevMode ? [{ debugName: "verticalViewPortHeight" }] : /* istanbul ignore next */ []);
|
|
157
|
+
circular = input(false, {
|
|
158
|
+
...ngDevMode ? { debugName: "circular" } : /* istanbul ignore next */ {},
|
|
159
|
+
transform: booleanAttribute
|
|
160
|
+
});
|
|
161
|
+
autoplayInterval = input(0, {
|
|
162
|
+
...ngDevMode ? { debugName: "autoplayInterval" } : /* istanbul ignore next */ {},
|
|
163
|
+
transform: numberAttribute
|
|
164
|
+
});
|
|
165
|
+
showIndicators = input(true, {
|
|
166
|
+
...ngDevMode ? { debugName: "showIndicators" } : /* istanbul ignore next */ {},
|
|
167
|
+
transform: booleanAttribute
|
|
168
|
+
});
|
|
169
|
+
showNavigators = input(true, {
|
|
170
|
+
...ngDevMode ? { debugName: "showNavigators" } : /* istanbul ignore next */ {},
|
|
171
|
+
transform: booleanAttribute
|
|
172
|
+
});
|
|
173
|
+
swipe = input(true, {
|
|
174
|
+
...ngDevMode ? { debugName: "swipe" } : /* istanbul ignore next */ {},
|
|
175
|
+
transform: booleanAttribute
|
|
176
|
+
});
|
|
177
|
+
effect = input("slide", ...ngDevMode ? [{ debugName: "effect" }] : /* istanbul ignore next */ []);
|
|
178
|
+
prevIcon = input(void 0, ...ngDevMode ? [{ debugName: "prevIcon" }] : /* istanbul ignore next */ []);
|
|
179
|
+
nextIcon = input(void 0, ...ngDevMode ? [{ debugName: "nextIcon" }] : /* istanbul ignore next */ []);
|
|
180
|
+
ariaLabel = input(void 0, ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
181
|
+
ariaLabelledBy = input(void 0, ...ngDevMode ? [{ debugName: "ariaLabelledBy" }] : /* istanbul ignore next */ []);
|
|
182
|
+
dt = input(void 0, ...ngDevMode ? [{ debugName: "dt" }] : /* istanbul ignore next */ []);
|
|
183
|
+
pt = input(void 0, ...ngDevMode ? [{ debugName: "pt" }] : /* istanbul ignore next */ []);
|
|
184
|
+
ptOptions = input(void 0, ...ngDevMode ? [{ debugName: "ptOptions" }] : /* istanbul ignore next */ []);
|
|
185
|
+
unstyled = input(void 0, {
|
|
186
|
+
...ngDevMode ? { debugName: "unstyled" } : /* istanbul ignore next */ {},
|
|
187
|
+
transform: optionalBoolean
|
|
188
|
+
});
|
|
189
|
+
translations = injectTranslations();
|
|
190
|
+
isUnstyled = injectUnstyled(this.unstyled);
|
|
191
|
+
passThrough = injectPassThrough("carousel", this, this.pt, this.ptOptions);
|
|
192
|
+
hostStyle = computed(() => ({
|
|
193
|
+
...toStyleObject(this.dt(), "--tx-carousel"),
|
|
194
|
+
...this.passThrough().root?.style
|
|
195
|
+
}), ...ngDevMode ? [{ debugName: "hostStyle" }] : /* istanbul ignore next */ []);
|
|
196
|
+
itemTemplate = contentChild(TxCarouselItemTemplate, ...ngDevMode ? [{ debugName: "itemTemplate" }] : /* istanbul ignore next */ []);
|
|
197
|
+
indicatorTemplate = contentChild(TxCarouselIndicatorTemplate, ...ngDevMode ? [{ debugName: "indicatorTemplate" }] : /* istanbul ignore next */ []);
|
|
198
|
+
header = contentChild(TxCarouselHeader, ...ngDevMode ? [{ debugName: "header" }] : /* istanbul ignore next */ []);
|
|
199
|
+
footer = contentChild(TxCarouselFooter, ...ngDevMode ? [{ debugName: "footer" }] : /* istanbul ignore next */ []);
|
|
200
|
+
viewport = viewChild.required("viewport", ...ngDevMode ? [{ debugName: "viewport" }] : /* istanbul ignore next */ []);
|
|
201
|
+
indicatorList = viewChild("indicators", ...ngDevMode ? [{ debugName: "indicatorList" }] : /* istanbul ignore next */ []);
|
|
202
|
+
hovered = signal(false, ...ngDevMode ? [{ debugName: "hovered" }] : /* istanbul ignore next */ []);
|
|
203
|
+
focused = signal(false, ...ngDevMode ? [{ debugName: "focused" }] : /* istanbul ignore next */ []);
|
|
204
|
+
autoplayStopped = signal(false, ...ngDevMode ? [{ debugName: "autoplayStopped" }] : /* istanbul ignore next */ []);
|
|
205
|
+
dragging = signal(false, ...ngDevMode ? [{ debugName: "dragging" }] : /* istanbul ignore next */ []);
|
|
206
|
+
shownFirst = signal(0, ...ngDevMode ? [{ debugName: "shownFirst" }] : /* istanbul ignore next */ []);
|
|
207
|
+
dragOffset = signal(0, ...ngDevMode ? [{ debugName: "dragOffset" }] : /* istanbul ignore next */ []);
|
|
208
|
+
responsive = signal(null, ...ngDevMode ? [{ debugName: "responsive" }] : /* istanbul ignore next */ []);
|
|
209
|
+
items = computed(() => this.value() ?? [], ...ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []);
|
|
210
|
+
vertical = computed(() => this.orientation() === "vertical", ...ngDevMode ? [{ debugName: "vertical" }] : /* istanbul ignore next */ []);
|
|
211
|
+
visibleCount = computed(() => Math.max(1, Math.floor(this.responsive()?.numVisible ?? this.numVisible())), ...ngDevMode ? [{ debugName: "visibleCount" }] : /* istanbul ignore next */ []);
|
|
212
|
+
scrollCount = computed(() => Math.max(1, Math.floor(this.responsive()?.numScroll ?? this.responsive()?.numVisible ?? this.numScroll())), ...ngDevMode ? [{ debugName: "scrollCount" }] : /* istanbul ignore next */ []);
|
|
213
|
+
totalPages = computed(() => {
|
|
214
|
+
const count = this.items().length;
|
|
215
|
+
const visible = this.visibleCount();
|
|
216
|
+
return count <= visible ? 1 : Math.ceil((count - visible) / this.scrollCount()) + 1;
|
|
217
|
+
}, ...ngDevMode ? [{ debugName: "totalPages" }] : /* istanbul ignore next */ []);
|
|
218
|
+
currentPage = computed(() => Math.min(Math.max(Math.floor(this.page()), 0), this.totalPages() - 1), ...ngDevMode ? [{ debugName: "currentPage" }] : /* istanbul ignore next */ []);
|
|
219
|
+
pages = computed(() => Array.from({ length: this.totalPages() }, (_, index) => index), ...ngDevMode ? [{ debugName: "pages" }] : /* istanbul ignore next */ []);
|
|
220
|
+
firstIndex = computed(() => Math.min(this.currentPage() * this.scrollCount(), Math.max(this.items().length - this.visibleCount(), 0)), ...ngDevMode ? [{ debugName: "firstIndex" }] : /* istanbul ignore next */ []);
|
|
221
|
+
autoplaying = computed(() => this.autoplayInterval() > 0 && !this.autoplayStopped() && this.totalPages() > 1, ...ngDevMode ? [{ debugName: "autoplaying" }] : /* istanbul ignore next */ []);
|
|
222
|
+
isCircular = computed(() => this.circular() || this.autoplayInterval() > 0, ...ngDevMode ? [{ debugName: "isCircular" }] : /* istanbul ignore next */ []);
|
|
223
|
+
canPrev = computed(() => this.totalPages() > 1 && (this.isCircular() || this.currentPage() > 0), ...ngDevMode ? [{ debugName: "canPrev" }] : /* istanbul ignore next */ []);
|
|
224
|
+
canNext = computed(() => this.totalPages() > 1 && (this.isCircular() || this.currentPage() < this.totalPages() - 1), ...ngDevMode ? [{ debugName: "canNext" }] : /* istanbul ignore next */ []);
|
|
225
|
+
prevIconName = computed(() => this.prevIcon() ?? (this.vertical() ? "chevron-up" : "chevron-left"), ...ngDevMode ? [{ debugName: "prevIconName" }] : /* istanbul ignore next */ []);
|
|
226
|
+
nextIconName = computed(() => this.nextIcon() ?? (this.vertical() ? "chevron-down" : "chevron-right"), ...ngDevMode ? [{ debugName: "nextIconName" }] : /* istanbul ignore next */ []);
|
|
227
|
+
itemBasis = computed(() => percent(100 / this.visibleCount()), ...ngDevMode ? [{ debugName: "itemBasis" }] : /* istanbul ignore next */ []);
|
|
228
|
+
trackTransform = computed(() => {
|
|
229
|
+
const shift = percent(-this.shownFirst() * 100 / this.visibleCount());
|
|
230
|
+
const offset = `${this.dragOffset()}px`;
|
|
231
|
+
return this.vertical() ? `translate3d(0, calc(${shift} + ${offset}), 0)` : `translate3d(calc(${shift} + ${offset}), 0, 0)`;
|
|
232
|
+
}, ...ngDevMode ? [{ debugName: "trackTransform" }] : /* istanbul ignore next */ []);
|
|
233
|
+
constructor() {
|
|
234
|
+
effect((onCleanup) => {
|
|
235
|
+
const options = this.responsiveOptions();
|
|
236
|
+
const view = this.document.defaultView;
|
|
237
|
+
if (!options?.length || !view?.matchMedia) {
|
|
238
|
+
this.responsive.set(null);
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
const entries = [...options].sort((a, b) => parseFloat(a.breakpoint) - parseFloat(b.breakpoint)).map((option) => ({
|
|
242
|
+
option,
|
|
243
|
+
query: view.matchMedia(`(max-width: ${option.breakpoint})`)
|
|
244
|
+
}));
|
|
245
|
+
const pick = () => this.responsive.set(entries.find((entry) => entry.query.matches)?.option ?? null);
|
|
246
|
+
pick();
|
|
247
|
+
entries.forEach((entry) => entry.query.addEventListener("change", pick));
|
|
248
|
+
onCleanup(() => entries.forEach((entry) => entry.query.removeEventListener("change", pick)));
|
|
249
|
+
});
|
|
250
|
+
effect((onCleanup) => {
|
|
251
|
+
const interval = this.autoplayInterval();
|
|
252
|
+
if (!this.autoplaying() || this.hovered() || this.focused() || this.dragging()) return;
|
|
253
|
+
const timer = setInterval(() => this.step(1), interval);
|
|
254
|
+
onCleanup(() => clearInterval(timer));
|
|
255
|
+
});
|
|
256
|
+
effect(() => {
|
|
257
|
+
const first = this.firstIndex();
|
|
258
|
+
untracked(() => this.swapTo(first));
|
|
259
|
+
});
|
|
260
|
+
afterNextRender(() => {
|
|
261
|
+
const viewport = this.viewport().nativeElement;
|
|
262
|
+
const swallow = (event) => {
|
|
263
|
+
if (this.suppressClick) {
|
|
264
|
+
event.preventDefault();
|
|
265
|
+
event.stopPropagation();
|
|
266
|
+
this.suppressClick = false;
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
viewport.addEventListener("click", swallow, true);
|
|
270
|
+
this.destroyRef.onDestroy(() => viewport.removeEventListener("click", swallow, true));
|
|
271
|
+
});
|
|
272
|
+
this.destroyRef.onDestroy(() => this.releaseDrag());
|
|
273
|
+
}
|
|
274
|
+
next() {
|
|
275
|
+
this.step(1);
|
|
276
|
+
}
|
|
277
|
+
prev() {
|
|
278
|
+
this.step(-1);
|
|
279
|
+
}
|
|
280
|
+
goTo(page) {
|
|
281
|
+
this.page.set(Math.min(Math.max(page, 0), this.totalPages() - 1));
|
|
282
|
+
}
|
|
283
|
+
startAutoplay() {
|
|
284
|
+
this.autoplayStopped.set(false);
|
|
285
|
+
}
|
|
286
|
+
stopAutoplay() {
|
|
287
|
+
this.autoplayStopped.set(true);
|
|
288
|
+
}
|
|
289
|
+
isShown(index) {
|
|
290
|
+
const first = this.shownFirst();
|
|
291
|
+
return index >= first && index < first + this.visibleCount();
|
|
292
|
+
}
|
|
293
|
+
slideLabel(index) {
|
|
294
|
+
return this.translations().slideOf.replace("{index}", String(index + 1)).replace("{total}", String(this.items().length));
|
|
295
|
+
}
|
|
296
|
+
pageLabel(page) {
|
|
297
|
+
return this.translations().pageNumber.replace("{page}", String(page + 1));
|
|
298
|
+
}
|
|
299
|
+
onNavigate(direction) {
|
|
300
|
+
this.step(direction);
|
|
301
|
+
this.stopAutoplay();
|
|
302
|
+
}
|
|
303
|
+
onIndicatorClick(page) {
|
|
304
|
+
this.goTo(page);
|
|
305
|
+
this.stopAutoplay();
|
|
306
|
+
}
|
|
307
|
+
onIndicatorKeydown(event) {
|
|
308
|
+
const last = this.totalPages() - 1;
|
|
309
|
+
const target = {
|
|
310
|
+
ArrowRight: this.currentPage() + 1,
|
|
311
|
+
ArrowDown: this.currentPage() + 1,
|
|
312
|
+
ArrowLeft: this.currentPage() - 1,
|
|
313
|
+
ArrowUp: this.currentPage() - 1,
|
|
314
|
+
Home: 0,
|
|
315
|
+
End: last
|
|
316
|
+
}[event.key];
|
|
317
|
+
if (target === void 0) return;
|
|
318
|
+
event.preventDefault();
|
|
319
|
+
const page = target > last ? 0 : target < 0 ? last : target;
|
|
320
|
+
this.onIndicatorClick(page);
|
|
321
|
+
queueMicrotask(() => this.indicatorList()?.nativeElement.querySelectorAll(".tx-carousel__indicator-button")[page]?.focus());
|
|
322
|
+
}
|
|
323
|
+
onFocusOut(event) {
|
|
324
|
+
if (!this.host.nativeElement.contains(event.relatedTarget)) this.focused.set(false);
|
|
325
|
+
}
|
|
326
|
+
onPointerDown(event) {
|
|
327
|
+
if (!this.swipe() || this.totalPages() < 2 || event.pointerType === "mouse" && event.button !== 0) return;
|
|
328
|
+
const rect = this.viewport().nativeElement.getBoundingClientRect();
|
|
329
|
+
const vertical = this.vertical();
|
|
330
|
+
this.drag = {
|
|
331
|
+
pointerId: event.pointerId,
|
|
332
|
+
start: vertical ? event.clientY : event.clientX,
|
|
333
|
+
cross: vertical ? event.clientX : event.clientY,
|
|
334
|
+
size: (vertical ? rect.height : rect.width) / this.visibleCount(),
|
|
335
|
+
active: false
|
|
336
|
+
};
|
|
337
|
+
this.document.addEventListener("pointermove", this.onPointerMove);
|
|
338
|
+
this.document.addEventListener("pointerup", this.onPointerUp);
|
|
339
|
+
this.document.addEventListener("pointercancel", this.onPointerCancel);
|
|
340
|
+
}
|
|
341
|
+
onPointerMove = (event) => {
|
|
342
|
+
const drag = this.drag;
|
|
343
|
+
if (!drag || event.pointerId !== drag.pointerId) return;
|
|
344
|
+
const vertical = this.vertical();
|
|
345
|
+
const delta = (vertical ? event.clientY : event.clientX) - drag.start;
|
|
346
|
+
const cross = (vertical ? event.clientX : event.clientY) - drag.cross;
|
|
347
|
+
if (!drag.active) {
|
|
348
|
+
if (Math.abs(delta) < DRAG_START) return;
|
|
349
|
+
if (Math.abs(cross) > Math.abs(delta)) {
|
|
350
|
+
this.releaseDrag();
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
drag.active = true;
|
|
354
|
+
this.dragging.set(true);
|
|
355
|
+
}
|
|
356
|
+
event.preventDefault();
|
|
357
|
+
const blocked = delta > 0 && !this.canPrev() || delta < 0 && !this.canNext();
|
|
358
|
+
this.dragOffset.set(blocked ? delta * EDGE_RESISTANCE : delta);
|
|
359
|
+
};
|
|
360
|
+
onPointerUp = (event) => {
|
|
361
|
+
const drag = this.drag;
|
|
362
|
+
if (!drag || event.pointerId !== drag.pointerId) return;
|
|
363
|
+
const offset = this.dragOffset();
|
|
364
|
+
if (drag.active) {
|
|
365
|
+
this.suppressClick = true;
|
|
366
|
+
setTimeout(() => this.suppressClick = false);
|
|
367
|
+
if (Math.abs(offset) >= Math.min(SWIPE_MIN, drag.size * SWIPE_RATIO) + .5) {
|
|
368
|
+
const direction = offset < 0 ? 1 : -1;
|
|
369
|
+
if (direction === 1 ? this.canNext() : this.canPrev()) this.onNavigate(direction);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
this.releaseDrag();
|
|
373
|
+
};
|
|
374
|
+
onPointerCancel = () => {
|
|
375
|
+
this.releaseDrag();
|
|
376
|
+
};
|
|
377
|
+
releaseDrag() {
|
|
378
|
+
this.drag = null;
|
|
379
|
+
this.dragging.set(false);
|
|
380
|
+
this.dragOffset.set(0);
|
|
381
|
+
this.document.removeEventListener("pointermove", this.onPointerMove);
|
|
382
|
+
this.document.removeEventListener("pointerup", this.onPointerUp);
|
|
383
|
+
this.document.removeEventListener("pointercancel", this.onPointerCancel);
|
|
384
|
+
}
|
|
385
|
+
swapTo(first) {
|
|
386
|
+
const previous = this.shownFirst();
|
|
387
|
+
const token = ++this.swapToken;
|
|
388
|
+
if (!this.swapStarted) {
|
|
389
|
+
this.swapStarted = true;
|
|
390
|
+
this.shownFirst.set(first);
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
const viewport = this.viewport().nativeElement;
|
|
394
|
+
const motion = txSwapMotion(this.effect(), first > previous ? 1 : -1, this.vertical() ? "y" : "x");
|
|
395
|
+
const outgoing = Array.from(viewport.querySelectorAll(".tx-carousel__item--active"));
|
|
396
|
+
if (first === previous || this.effect() === "slide" || !motion || !outgoing.length || !txCanAnimate(outgoing[0])) {
|
|
397
|
+
this.shownFirst.set(first);
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
viewport.querySelectorAll(".tx-carousel__item").forEach((item) => item.getAnimations().forEach((animation) => animation.cancel()));
|
|
401
|
+
const part = txCssTime(viewport, "--tx-carousel-slide-duration", SWAP_DURATION) / 2;
|
|
402
|
+
const easing = (viewport.ownerDocument.defaultView?.getComputedStyle(viewport).getPropertyValue("--tx-carousel-slide-easing") ?? "").trim() || "ease";
|
|
403
|
+
const leaves = outgoing.map((item) => item.animate(motion.leave, {
|
|
404
|
+
duration: part,
|
|
405
|
+
easing,
|
|
406
|
+
fill: "forwards"
|
|
407
|
+
}));
|
|
408
|
+
Promise.all(leaves.map((animation) => animation.finished.catch(() => void 0))).then(() => {
|
|
409
|
+
if (token !== this.swapToken) return;
|
|
410
|
+
this.shownFirst.set(first);
|
|
411
|
+
afterNextRender(() => {
|
|
412
|
+
leaves.forEach((animation) => animation.cancel());
|
|
413
|
+
if (token !== this.swapToken) return;
|
|
414
|
+
Array.from(viewport.querySelectorAll(".tx-carousel__item--active")).forEach((item, order) => item.animate(motion.enter, {
|
|
415
|
+
duration: part,
|
|
416
|
+
easing,
|
|
417
|
+
delay: order * SWAP_STAGGER,
|
|
418
|
+
fill: "backwards"
|
|
419
|
+
}));
|
|
420
|
+
}, { injector: this.injector });
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
step(direction) {
|
|
424
|
+
const total = this.totalPages();
|
|
425
|
+
if (total < 2) return;
|
|
426
|
+
const next = this.currentPage() + direction;
|
|
427
|
+
if (next >= 0 && next < total) this.page.set(next);
|
|
428
|
+
else if (this.isCircular()) this.page.set(next < 0 ? total - 1 : 0);
|
|
429
|
+
}
|
|
430
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
431
|
+
minVersion: "12.0.0",
|
|
432
|
+
version: "22.2.3",
|
|
433
|
+
ngImport: i0,
|
|
434
|
+
type: TxCarousel,
|
|
435
|
+
deps: [],
|
|
436
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
437
|
+
});
|
|
438
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
439
|
+
minVersion: "17.0.0",
|
|
440
|
+
version: "22.2.3",
|
|
441
|
+
type: TxCarousel,
|
|
442
|
+
isStandalone: true,
|
|
443
|
+
selector: "tx-carousel",
|
|
444
|
+
inputs: {
|
|
445
|
+
value: {
|
|
446
|
+
classPropertyName: "value",
|
|
447
|
+
publicName: "value",
|
|
448
|
+
isSignal: true,
|
|
449
|
+
isRequired: false,
|
|
450
|
+
transformFunction: null
|
|
451
|
+
},
|
|
452
|
+
page: {
|
|
453
|
+
classPropertyName: "page",
|
|
454
|
+
publicName: "page",
|
|
455
|
+
isSignal: true,
|
|
456
|
+
isRequired: false,
|
|
457
|
+
transformFunction: null
|
|
458
|
+
},
|
|
459
|
+
numVisible: {
|
|
460
|
+
classPropertyName: "numVisible",
|
|
461
|
+
publicName: "numVisible",
|
|
462
|
+
isSignal: true,
|
|
463
|
+
isRequired: false,
|
|
464
|
+
transformFunction: null
|
|
465
|
+
},
|
|
466
|
+
numScroll: {
|
|
467
|
+
classPropertyName: "numScroll",
|
|
468
|
+
publicName: "numScroll",
|
|
469
|
+
isSignal: true,
|
|
470
|
+
isRequired: false,
|
|
471
|
+
transformFunction: null
|
|
472
|
+
},
|
|
473
|
+
responsiveOptions: {
|
|
474
|
+
classPropertyName: "responsiveOptions",
|
|
475
|
+
publicName: "responsiveOptions",
|
|
476
|
+
isSignal: true,
|
|
477
|
+
isRequired: false,
|
|
478
|
+
transformFunction: null
|
|
479
|
+
},
|
|
480
|
+
orientation: {
|
|
481
|
+
classPropertyName: "orientation",
|
|
482
|
+
publicName: "orientation",
|
|
483
|
+
isSignal: true,
|
|
484
|
+
isRequired: false,
|
|
485
|
+
transformFunction: null
|
|
486
|
+
},
|
|
487
|
+
verticalViewPortHeight: {
|
|
488
|
+
classPropertyName: "verticalViewPortHeight",
|
|
489
|
+
publicName: "verticalViewPortHeight",
|
|
490
|
+
isSignal: true,
|
|
491
|
+
isRequired: false,
|
|
492
|
+
transformFunction: null
|
|
493
|
+
},
|
|
494
|
+
circular: {
|
|
495
|
+
classPropertyName: "circular",
|
|
496
|
+
publicName: "circular",
|
|
497
|
+
isSignal: true,
|
|
498
|
+
isRequired: false,
|
|
499
|
+
transformFunction: null
|
|
500
|
+
},
|
|
501
|
+
autoplayInterval: {
|
|
502
|
+
classPropertyName: "autoplayInterval",
|
|
503
|
+
publicName: "autoplayInterval",
|
|
504
|
+
isSignal: true,
|
|
505
|
+
isRequired: false,
|
|
506
|
+
transformFunction: null
|
|
507
|
+
},
|
|
508
|
+
showIndicators: {
|
|
509
|
+
classPropertyName: "showIndicators",
|
|
510
|
+
publicName: "showIndicators",
|
|
511
|
+
isSignal: true,
|
|
512
|
+
isRequired: false,
|
|
513
|
+
transformFunction: null
|
|
514
|
+
},
|
|
515
|
+
showNavigators: {
|
|
516
|
+
classPropertyName: "showNavigators",
|
|
517
|
+
publicName: "showNavigators",
|
|
518
|
+
isSignal: true,
|
|
519
|
+
isRequired: false,
|
|
520
|
+
transformFunction: null
|
|
521
|
+
},
|
|
522
|
+
swipe: {
|
|
523
|
+
classPropertyName: "swipe",
|
|
524
|
+
publicName: "swipe",
|
|
525
|
+
isSignal: true,
|
|
526
|
+
isRequired: false,
|
|
527
|
+
transformFunction: null
|
|
528
|
+
},
|
|
529
|
+
effect: {
|
|
530
|
+
classPropertyName: "effect",
|
|
531
|
+
publicName: "effect",
|
|
532
|
+
isSignal: true,
|
|
533
|
+
isRequired: false,
|
|
534
|
+
transformFunction: null
|
|
535
|
+
},
|
|
536
|
+
prevIcon: {
|
|
537
|
+
classPropertyName: "prevIcon",
|
|
538
|
+
publicName: "prevIcon",
|
|
539
|
+
isSignal: true,
|
|
540
|
+
isRequired: false,
|
|
541
|
+
transformFunction: null
|
|
542
|
+
},
|
|
543
|
+
nextIcon: {
|
|
544
|
+
classPropertyName: "nextIcon",
|
|
545
|
+
publicName: "nextIcon",
|
|
546
|
+
isSignal: true,
|
|
547
|
+
isRequired: false,
|
|
548
|
+
transformFunction: null
|
|
549
|
+
},
|
|
550
|
+
ariaLabel: {
|
|
551
|
+
classPropertyName: "ariaLabel",
|
|
552
|
+
publicName: "ariaLabel",
|
|
553
|
+
isSignal: true,
|
|
554
|
+
isRequired: false,
|
|
555
|
+
transformFunction: null
|
|
556
|
+
},
|
|
557
|
+
ariaLabelledBy: {
|
|
558
|
+
classPropertyName: "ariaLabelledBy",
|
|
559
|
+
publicName: "ariaLabelledBy",
|
|
560
|
+
isSignal: true,
|
|
561
|
+
isRequired: false,
|
|
562
|
+
transformFunction: null
|
|
563
|
+
},
|
|
564
|
+
dt: {
|
|
565
|
+
classPropertyName: "dt",
|
|
566
|
+
publicName: "dt",
|
|
567
|
+
isSignal: true,
|
|
568
|
+
isRequired: false,
|
|
569
|
+
transformFunction: null
|
|
570
|
+
},
|
|
571
|
+
pt: {
|
|
572
|
+
classPropertyName: "pt",
|
|
573
|
+
publicName: "pt",
|
|
574
|
+
isSignal: true,
|
|
575
|
+
isRequired: false,
|
|
576
|
+
transformFunction: null
|
|
577
|
+
},
|
|
578
|
+
ptOptions: {
|
|
579
|
+
classPropertyName: "ptOptions",
|
|
580
|
+
publicName: "ptOptions",
|
|
581
|
+
isSignal: true,
|
|
582
|
+
isRequired: false,
|
|
583
|
+
transformFunction: null
|
|
584
|
+
},
|
|
585
|
+
unstyled: {
|
|
586
|
+
classPropertyName: "unstyled",
|
|
587
|
+
publicName: "unstyled",
|
|
588
|
+
isSignal: true,
|
|
589
|
+
isRequired: false,
|
|
590
|
+
transformFunction: null
|
|
591
|
+
}
|
|
592
|
+
},
|
|
593
|
+
outputs: { page: "pageChange" },
|
|
594
|
+
host: {
|
|
595
|
+
attributes: { "role": "region" },
|
|
596
|
+
listeners: {
|
|
597
|
+
"mouseenter": "hovered.set(true)",
|
|
598
|
+
"mouseleave": "hovered.set(false)",
|
|
599
|
+
"focusin": "focused.set(true)",
|
|
600
|
+
"focusout": "onFocusOut($event)"
|
|
601
|
+
},
|
|
602
|
+
properties: {
|
|
603
|
+
"class": "passThrough().root?.class",
|
|
604
|
+
"style": "hostStyle()",
|
|
605
|
+
"attr.data-styled": "!isUnstyled() || null",
|
|
606
|
+
"attr.data-orientation": "orientation()",
|
|
607
|
+
"attr.aria-roledescription": "translations().carousel",
|
|
608
|
+
"attr.aria-label": "ariaLabel() ?? null",
|
|
609
|
+
"attr.aria-labelledby": "ariaLabelledBy() ?? null",
|
|
610
|
+
"class.tx-carousel--vertical": "vertical()",
|
|
611
|
+
"class.tx-carousel--dragging": "dragging()",
|
|
612
|
+
"class.tx-carousel--instant": "effect() !== 'slide'"
|
|
613
|
+
},
|
|
614
|
+
classAttribute: "tx-carousel"
|
|
615
|
+
},
|
|
616
|
+
queries: [
|
|
617
|
+
{
|
|
618
|
+
propertyName: "itemTemplate",
|
|
619
|
+
first: true,
|
|
620
|
+
predicate: TxCarouselItemTemplate,
|
|
621
|
+
descendants: true,
|
|
622
|
+
isSignal: true
|
|
623
|
+
},
|
|
624
|
+
{
|
|
625
|
+
propertyName: "indicatorTemplate",
|
|
626
|
+
first: true,
|
|
627
|
+
predicate: TxCarouselIndicatorTemplate,
|
|
628
|
+
descendants: true,
|
|
629
|
+
isSignal: true
|
|
630
|
+
},
|
|
631
|
+
{
|
|
632
|
+
propertyName: "header",
|
|
633
|
+
first: true,
|
|
634
|
+
predicate: TxCarouselHeader,
|
|
635
|
+
descendants: true,
|
|
636
|
+
isSignal: true
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
propertyName: "footer",
|
|
640
|
+
first: true,
|
|
641
|
+
predicate: TxCarouselFooter,
|
|
642
|
+
descendants: true,
|
|
643
|
+
isSignal: true
|
|
644
|
+
}
|
|
645
|
+
],
|
|
646
|
+
viewQueries: [{
|
|
647
|
+
propertyName: "viewport",
|
|
648
|
+
first: true,
|
|
649
|
+
predicate: ["viewport"],
|
|
650
|
+
descendants: true,
|
|
651
|
+
isSignal: true
|
|
652
|
+
}, {
|
|
653
|
+
propertyName: "indicatorList",
|
|
654
|
+
first: true,
|
|
655
|
+
predicate: ["indicators"],
|
|
656
|
+
descendants: true,
|
|
657
|
+
isSignal: true
|
|
658
|
+
}],
|
|
659
|
+
ngImport: i0,
|
|
660
|
+
template: "@if (header()) {\n <div class=\"tx-carousel__header\" [class]=\"passThrough().header?.class\" [style]=\"passThrough().header?.style\">\n <ng-content select=\"[txCarouselHeader]\" />\n </div>\n}\n<div class=\"tx-carousel__content\" [class]=\"passThrough().content?.class\" [style]=\"passThrough().content?.style\">\n @if (showNavigators()) {\n <button\n txButton\n type=\"button\"\n text\n rounded\n severity=\"secondary\"\n class=\"tx-carousel__navigator tx-carousel__prev\"\n [class]=\"passThrough().navigator?.class\"\n [style]=\"passThrough().navigator?.style\"\n [icon]=\"prevIconName()\"\n [disabled]=\"!canPrev()\"\n [attr.aria-label]=\"translations().previousSlide\"\n (click)=\"onNavigate(-1)\"\n ></button>\n }\n <div\n #viewport\n class=\"tx-carousel__viewport\"\n [class]=\"passThrough().viewport?.class\"\n [style]=\"passThrough().viewport?.style\"\n [style.height]=\"vertical() ? verticalViewPortHeight() : null\"\n [attr.aria-live]=\"autoplaying() ? 'off' : 'polite'\"\n (pointerdown)=\"onPointerDown($event)\"\n (dragstart)=\"$event.preventDefault()\"\n >\n <div class=\"tx-carousel__track\" [class]=\"passThrough().track?.class\" [style]=\"passThrough().track?.style\" [style.transform]=\"trackTransform()\">\n @for (item of items(); track $index) {\n @let shown = isShown($index);\n <div\n class=\"tx-carousel__item\"\n role=\"group\"\n [class]=\"passThrough().item?.class\"\n [style]=\"passThrough().item?.style\"\n [class.tx-carousel__item--active]=\"shown\"\n [style.flex-basis]=\"itemBasis()\"\n [attr.aria-roledescription]=\"translations().slide\"\n [attr.aria-label]=\"slideLabel($index)\"\n [attr.aria-hidden]=\"shown ? null : 'true'\"\n [attr.inert]=\"shown ? null : ''\"\n >\n @if (itemTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template.template\" [ngTemplateOutletContext]=\"{ $implicit: item, index: $index, active: shown }\" />\n }\n </div>\n }\n </div>\n </div>\n @if (showNavigators()) {\n <button\n txButton\n type=\"button\"\n text\n rounded\n severity=\"secondary\"\n class=\"tx-carousel__navigator tx-carousel__next\"\n [class]=\"passThrough().navigator?.class\"\n [style]=\"passThrough().navigator?.style\"\n [icon]=\"nextIconName()\"\n [disabled]=\"!canNext()\"\n [attr.aria-label]=\"translations().nextSlide\"\n (click)=\"onNavigate(1)\"\n ></button>\n }\n</div>\n@if (showIndicators() && totalPages() > 1) {\n <ul #indicators class=\"tx-carousel__indicators\" [class]=\"passThrough().indicators?.class\" [style]=\"passThrough().indicators?.style\">\n @for (dot of pages(); track dot) {\n @let active = dot === currentPage();\n <li class=\"tx-carousel__indicator\" [class]=\"passThrough().indicator?.class\" [style]=\"passThrough().indicator?.style\" [class.tx-carousel__indicator--active]=\"active\">\n <button\n type=\"button\"\n class=\"tx-carousel__indicator-button\"\n [attr.aria-label]=\"pageLabel(dot)\"\n [attr.aria-current]=\"active ? 'true' : null\"\n [tabIndex]=\"active ? 0 : -1\"\n (click)=\"onIndicatorClick(dot)\"\n (keydown)=\"onIndicatorKeydown($event)\"\n >\n @if (indicatorTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template.template\" [ngTemplateOutletContext]=\"{ $implicit: dot, active }\" />\n }\n </button>\n </li>\n }\n </ul>\n}\n@if (footer()) {\n <div class=\"tx-carousel__footer\" [class]=\"passThrough().footer?.class\" [style]=\"passThrough().footer?.style\">\n <ng-content select=\"[txCarouselFooter]\" />\n </div>\n}\n",
|
|
661
|
+
styles: [":host{display:flex;flex-direction:column;min-width:0}.tx-carousel__content{display:flex;align-items:center;min-width:0}:host([data-orientation=vertical]) .tx-carousel__content{flex-direction:column}.tx-carousel__navigator{flex-shrink:0}.tx-carousel__viewport{flex:1 1 auto;min-width:0;overflow:hidden;touch-action:pan-y pinch-zoom}:host([data-orientation=vertical]) .tx-carousel__viewport{align-self:stretch;touch-action:pan-x pinch-zoom}.tx-carousel__track{display:flex;width:100%;height:100%}:host([data-orientation=vertical]) .tx-carousel__track{flex-direction:column}.tx-carousel__item{flex-grow:0;flex-shrink:0;min-width:0;min-height:0;box-sizing:border-box}.tx-carousel__indicators{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;margin:0;list-style:none}.tx-carousel__indicator-button{position:relative;display:block;margin:0;padding:0;border:0;font:inherit;cursor:pointer}:host([data-styled]) .tx-carousel__content{gap:var(--tx-carousel-content-gap)}:host([data-styled]) .tx-carousel__track{transition:transform var(--tx-carousel-slide-duration) var(--tx-carousel-slide-easing)}:host([data-styled]) .tx-carousel__indicators{gap:var(--tx-carousel-indicator-list-gap);padding:var(--tx-carousel-indicator-list-padding)}:host([data-styled]) .tx-carousel__indicator-button{width:var(--tx-carousel-indicator-width);height:var(--tx-carousel-indicator-height);border-radius:var(--tx-carousel-indicator-border-radius);background:var(--tx-carousel-indicator-background);transition:background-color var(--tx-carousel-transition-duration)}:host([data-styled]) .tx-carousel__indicator-button:before{content:\"\";position:absolute;inset:50% 0 auto;height:var(--tx-carousel-indicator-hit-area);translate:0 -50%}:host([data-styled]) .tx-carousel__indicator-button:hover{background:var(--tx-carousel-indicator-hover-background)}:host([data-styled]) .tx-carousel__indicator-button:focus-visible{outline:var(--tx-carousel-indicator-focus-ring-width) solid var(--tx-carousel-indicator-focus-ring-color);outline-offset:var(--tx-carousel-indicator-focus-ring-offset)}:host([data-styled]) .tx-carousel__indicator--active .tx-carousel__indicator-button{background:var(--tx-carousel-indicator-active-background)}:host(.tx-carousel--instant) .tx-carousel__track{transition:none}:host(.tx-carousel--dragging){-webkit-user-select:none;user-select:none}:host(.tx-carousel--dragging) .tx-carousel__track{transition:none}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-carousel__track,:host([data-styled]) .tx-carousel__indicator-button{transition:none}}\n"],
|
|
662
|
+
dependencies: [{
|
|
663
|
+
kind: "directive",
|
|
664
|
+
type: NgTemplateOutlet,
|
|
665
|
+
selector: "[ngTemplateOutlet]",
|
|
666
|
+
inputs: [
|
|
667
|
+
"ngTemplateOutletContext",
|
|
668
|
+
"ngTemplateOutlet",
|
|
669
|
+
"ngTemplateOutletInjector"
|
|
670
|
+
]
|
|
671
|
+
}, {
|
|
672
|
+
kind: "component",
|
|
673
|
+
type: TxButton,
|
|
674
|
+
selector: "button[txButton], a[txButton]",
|
|
675
|
+
inputs: [
|
|
676
|
+
"label",
|
|
677
|
+
"severity",
|
|
678
|
+
"size",
|
|
679
|
+
"variant",
|
|
680
|
+
"outlined",
|
|
681
|
+
"text",
|
|
682
|
+
"link",
|
|
683
|
+
"rounded",
|
|
684
|
+
"raised",
|
|
685
|
+
"plain",
|
|
686
|
+
"fluid",
|
|
687
|
+
"disabled",
|
|
688
|
+
"tabindex",
|
|
689
|
+
"icon",
|
|
690
|
+
"iconPos",
|
|
691
|
+
"iconOnly",
|
|
692
|
+
"loading",
|
|
693
|
+
"loadingIcon",
|
|
694
|
+
"badge",
|
|
695
|
+
"badgeSeverity",
|
|
696
|
+
"dt",
|
|
697
|
+
"pt",
|
|
698
|
+
"ptOptions",
|
|
699
|
+
"unstyled"
|
|
700
|
+
]
|
|
701
|
+
}],
|
|
702
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
703
|
+
});
|
|
704
|
+
};
|
|
705
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
706
|
+
minVersion: "12.0.0",
|
|
707
|
+
version: "22.2.3",
|
|
708
|
+
ngImport: i0,
|
|
709
|
+
type: TxCarousel,
|
|
710
|
+
decorators: [{
|
|
711
|
+
type: Component,
|
|
712
|
+
args: [{
|
|
713
|
+
selector: "tx-carousel",
|
|
714
|
+
imports: [NgTemplateOutlet, TxButton],
|
|
715
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
716
|
+
host: {
|
|
717
|
+
class: "tx-carousel",
|
|
718
|
+
role: "region",
|
|
719
|
+
"[class]": "passThrough().root?.class",
|
|
720
|
+
"[style]": "hostStyle()",
|
|
721
|
+
"[attr.data-styled]": "!isUnstyled() || null",
|
|
722
|
+
"[attr.data-orientation]": "orientation()",
|
|
723
|
+
"[attr.aria-roledescription]": "translations().carousel",
|
|
724
|
+
"[attr.aria-label]": "ariaLabel() ?? null",
|
|
725
|
+
"[attr.aria-labelledby]": "ariaLabelledBy() ?? null",
|
|
726
|
+
"[class.tx-carousel--vertical]": "vertical()",
|
|
727
|
+
"[class.tx-carousel--dragging]": "dragging()",
|
|
728
|
+
"[class.tx-carousel--instant]": "effect() !== 'slide'",
|
|
729
|
+
"(mouseenter)": "hovered.set(true)",
|
|
730
|
+
"(mouseleave)": "hovered.set(false)",
|
|
731
|
+
"(focusin)": "focused.set(true)",
|
|
732
|
+
"(focusout)": "onFocusOut($event)"
|
|
733
|
+
},
|
|
734
|
+
template: "@if (header()) {\n <div class=\"tx-carousel__header\" [class]=\"passThrough().header?.class\" [style]=\"passThrough().header?.style\">\n <ng-content select=\"[txCarouselHeader]\" />\n </div>\n}\n<div class=\"tx-carousel__content\" [class]=\"passThrough().content?.class\" [style]=\"passThrough().content?.style\">\n @if (showNavigators()) {\n <button\n txButton\n type=\"button\"\n text\n rounded\n severity=\"secondary\"\n class=\"tx-carousel__navigator tx-carousel__prev\"\n [class]=\"passThrough().navigator?.class\"\n [style]=\"passThrough().navigator?.style\"\n [icon]=\"prevIconName()\"\n [disabled]=\"!canPrev()\"\n [attr.aria-label]=\"translations().previousSlide\"\n (click)=\"onNavigate(-1)\"\n ></button>\n }\n <div\n #viewport\n class=\"tx-carousel__viewport\"\n [class]=\"passThrough().viewport?.class\"\n [style]=\"passThrough().viewport?.style\"\n [style.height]=\"vertical() ? verticalViewPortHeight() : null\"\n [attr.aria-live]=\"autoplaying() ? 'off' : 'polite'\"\n (pointerdown)=\"onPointerDown($event)\"\n (dragstart)=\"$event.preventDefault()\"\n >\n <div class=\"tx-carousel__track\" [class]=\"passThrough().track?.class\" [style]=\"passThrough().track?.style\" [style.transform]=\"trackTransform()\">\n @for (item of items(); track $index) {\n @let shown = isShown($index);\n <div\n class=\"tx-carousel__item\"\n role=\"group\"\n [class]=\"passThrough().item?.class\"\n [style]=\"passThrough().item?.style\"\n [class.tx-carousel__item--active]=\"shown\"\n [style.flex-basis]=\"itemBasis()\"\n [attr.aria-roledescription]=\"translations().slide\"\n [attr.aria-label]=\"slideLabel($index)\"\n [attr.aria-hidden]=\"shown ? null : 'true'\"\n [attr.inert]=\"shown ? null : ''\"\n >\n @if (itemTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template.template\" [ngTemplateOutletContext]=\"{ $implicit: item, index: $index, active: shown }\" />\n }\n </div>\n }\n </div>\n </div>\n @if (showNavigators()) {\n <button\n txButton\n type=\"button\"\n text\n rounded\n severity=\"secondary\"\n class=\"tx-carousel__navigator tx-carousel__next\"\n [class]=\"passThrough().navigator?.class\"\n [style]=\"passThrough().navigator?.style\"\n [icon]=\"nextIconName()\"\n [disabled]=\"!canNext()\"\n [attr.aria-label]=\"translations().nextSlide\"\n (click)=\"onNavigate(1)\"\n ></button>\n }\n</div>\n@if (showIndicators() && totalPages() > 1) {\n <ul #indicators class=\"tx-carousel__indicators\" [class]=\"passThrough().indicators?.class\" [style]=\"passThrough().indicators?.style\">\n @for (dot of pages(); track dot) {\n @let active = dot === currentPage();\n <li class=\"tx-carousel__indicator\" [class]=\"passThrough().indicator?.class\" [style]=\"passThrough().indicator?.style\" [class.tx-carousel__indicator--active]=\"active\">\n <button\n type=\"button\"\n class=\"tx-carousel__indicator-button\"\n [attr.aria-label]=\"pageLabel(dot)\"\n [attr.aria-current]=\"active ? 'true' : null\"\n [tabIndex]=\"active ? 0 : -1\"\n (click)=\"onIndicatorClick(dot)\"\n (keydown)=\"onIndicatorKeydown($event)\"\n >\n @if (indicatorTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template.template\" [ngTemplateOutletContext]=\"{ $implicit: dot, active }\" />\n }\n </button>\n </li>\n }\n </ul>\n}\n@if (footer()) {\n <div class=\"tx-carousel__footer\" [class]=\"passThrough().footer?.class\" [style]=\"passThrough().footer?.style\">\n <ng-content select=\"[txCarouselFooter]\" />\n </div>\n}\n",
|
|
735
|
+
styles: [":host{display:flex;flex-direction:column;min-width:0}.tx-carousel__content{display:flex;align-items:center;min-width:0}:host([data-orientation=vertical]) .tx-carousel__content{flex-direction:column}.tx-carousel__navigator{flex-shrink:0}.tx-carousel__viewport{flex:1 1 auto;min-width:0;overflow:hidden;touch-action:pan-y pinch-zoom}:host([data-orientation=vertical]) .tx-carousel__viewport{align-self:stretch;touch-action:pan-x pinch-zoom}.tx-carousel__track{display:flex;width:100%;height:100%}:host([data-orientation=vertical]) .tx-carousel__track{flex-direction:column}.tx-carousel__item{flex-grow:0;flex-shrink:0;min-width:0;min-height:0;box-sizing:border-box}.tx-carousel__indicators{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;margin:0;list-style:none}.tx-carousel__indicator-button{position:relative;display:block;margin:0;padding:0;border:0;font:inherit;cursor:pointer}:host([data-styled]) .tx-carousel__content{gap:var(--tx-carousel-content-gap)}:host([data-styled]) .tx-carousel__track{transition:transform var(--tx-carousel-slide-duration) var(--tx-carousel-slide-easing)}:host([data-styled]) .tx-carousel__indicators{gap:var(--tx-carousel-indicator-list-gap);padding:var(--tx-carousel-indicator-list-padding)}:host([data-styled]) .tx-carousel__indicator-button{width:var(--tx-carousel-indicator-width);height:var(--tx-carousel-indicator-height);border-radius:var(--tx-carousel-indicator-border-radius);background:var(--tx-carousel-indicator-background);transition:background-color var(--tx-carousel-transition-duration)}:host([data-styled]) .tx-carousel__indicator-button:before{content:\"\";position:absolute;inset:50% 0 auto;height:var(--tx-carousel-indicator-hit-area);translate:0 -50%}:host([data-styled]) .tx-carousel__indicator-button:hover{background:var(--tx-carousel-indicator-hover-background)}:host([data-styled]) .tx-carousel__indicator-button:focus-visible{outline:var(--tx-carousel-indicator-focus-ring-width) solid var(--tx-carousel-indicator-focus-ring-color);outline-offset:var(--tx-carousel-indicator-focus-ring-offset)}:host([data-styled]) .tx-carousel__indicator--active .tx-carousel__indicator-button{background:var(--tx-carousel-indicator-active-background)}:host(.tx-carousel--instant) .tx-carousel__track{transition:none}:host(.tx-carousel--dragging){-webkit-user-select:none;user-select:none}:host(.tx-carousel--dragging) .tx-carousel__track{transition:none}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-carousel__track,:host([data-styled]) .tx-carousel__indicator-button{transition:none}}\n"]
|
|
736
|
+
}]
|
|
737
|
+
}],
|
|
738
|
+
ctorParameters: () => [],
|
|
739
|
+
propDecorators: {
|
|
740
|
+
value: [{
|
|
741
|
+
type: i0.Input,
|
|
742
|
+
args: [{
|
|
743
|
+
isSignal: true,
|
|
744
|
+
alias: "value",
|
|
745
|
+
required: false
|
|
746
|
+
}]
|
|
747
|
+
}],
|
|
748
|
+
page: [{
|
|
749
|
+
type: i0.Input,
|
|
750
|
+
args: [{
|
|
751
|
+
isSignal: true,
|
|
752
|
+
alias: "page",
|
|
753
|
+
required: false
|
|
754
|
+
}]
|
|
755
|
+
}, {
|
|
756
|
+
type: i0.Output,
|
|
757
|
+
args: ["pageChange"]
|
|
758
|
+
}],
|
|
759
|
+
numVisible: [{
|
|
760
|
+
type: i0.Input,
|
|
761
|
+
args: [{
|
|
762
|
+
isSignal: true,
|
|
763
|
+
alias: "numVisible",
|
|
764
|
+
required: false
|
|
765
|
+
}]
|
|
766
|
+
}],
|
|
767
|
+
numScroll: [{
|
|
768
|
+
type: i0.Input,
|
|
769
|
+
args: [{
|
|
770
|
+
isSignal: true,
|
|
771
|
+
alias: "numScroll",
|
|
772
|
+
required: false
|
|
773
|
+
}]
|
|
774
|
+
}],
|
|
775
|
+
responsiveOptions: [{
|
|
776
|
+
type: i0.Input,
|
|
777
|
+
args: [{
|
|
778
|
+
isSignal: true,
|
|
779
|
+
alias: "responsiveOptions",
|
|
780
|
+
required: false
|
|
781
|
+
}]
|
|
782
|
+
}],
|
|
783
|
+
orientation: [{
|
|
784
|
+
type: i0.Input,
|
|
785
|
+
args: [{
|
|
786
|
+
isSignal: true,
|
|
787
|
+
alias: "orientation",
|
|
788
|
+
required: false
|
|
789
|
+
}]
|
|
790
|
+
}],
|
|
791
|
+
verticalViewPortHeight: [{
|
|
792
|
+
type: i0.Input,
|
|
793
|
+
args: [{
|
|
794
|
+
isSignal: true,
|
|
795
|
+
alias: "verticalViewPortHeight",
|
|
796
|
+
required: false
|
|
797
|
+
}]
|
|
798
|
+
}],
|
|
799
|
+
circular: [{
|
|
800
|
+
type: i0.Input,
|
|
801
|
+
args: [{
|
|
802
|
+
isSignal: true,
|
|
803
|
+
alias: "circular",
|
|
804
|
+
required: false
|
|
805
|
+
}]
|
|
806
|
+
}],
|
|
807
|
+
autoplayInterval: [{
|
|
808
|
+
type: i0.Input,
|
|
809
|
+
args: [{
|
|
810
|
+
isSignal: true,
|
|
811
|
+
alias: "autoplayInterval",
|
|
812
|
+
required: false
|
|
813
|
+
}]
|
|
814
|
+
}],
|
|
815
|
+
showIndicators: [{
|
|
816
|
+
type: i0.Input,
|
|
817
|
+
args: [{
|
|
818
|
+
isSignal: true,
|
|
819
|
+
alias: "showIndicators",
|
|
820
|
+
required: false
|
|
821
|
+
}]
|
|
822
|
+
}],
|
|
823
|
+
showNavigators: [{
|
|
824
|
+
type: i0.Input,
|
|
825
|
+
args: [{
|
|
826
|
+
isSignal: true,
|
|
827
|
+
alias: "showNavigators",
|
|
828
|
+
required: false
|
|
829
|
+
}]
|
|
830
|
+
}],
|
|
831
|
+
swipe: [{
|
|
832
|
+
type: i0.Input,
|
|
833
|
+
args: [{
|
|
834
|
+
isSignal: true,
|
|
835
|
+
alias: "swipe",
|
|
836
|
+
required: false
|
|
837
|
+
}]
|
|
838
|
+
}],
|
|
839
|
+
effect: [{
|
|
840
|
+
type: i0.Input,
|
|
841
|
+
args: [{
|
|
842
|
+
isSignal: true,
|
|
843
|
+
alias: "effect",
|
|
844
|
+
required: false
|
|
845
|
+
}]
|
|
846
|
+
}],
|
|
847
|
+
prevIcon: [{
|
|
848
|
+
type: i0.Input,
|
|
849
|
+
args: [{
|
|
850
|
+
isSignal: true,
|
|
851
|
+
alias: "prevIcon",
|
|
852
|
+
required: false
|
|
853
|
+
}]
|
|
854
|
+
}],
|
|
855
|
+
nextIcon: [{
|
|
856
|
+
type: i0.Input,
|
|
857
|
+
args: [{
|
|
858
|
+
isSignal: true,
|
|
859
|
+
alias: "nextIcon",
|
|
860
|
+
required: false
|
|
861
|
+
}]
|
|
862
|
+
}],
|
|
863
|
+
ariaLabel: [{
|
|
864
|
+
type: i0.Input,
|
|
865
|
+
args: [{
|
|
866
|
+
isSignal: true,
|
|
867
|
+
alias: "ariaLabel",
|
|
868
|
+
required: false
|
|
869
|
+
}]
|
|
870
|
+
}],
|
|
871
|
+
ariaLabelledBy: [{
|
|
872
|
+
type: i0.Input,
|
|
873
|
+
args: [{
|
|
874
|
+
isSignal: true,
|
|
875
|
+
alias: "ariaLabelledBy",
|
|
876
|
+
required: false
|
|
877
|
+
}]
|
|
878
|
+
}],
|
|
879
|
+
dt: [{
|
|
880
|
+
type: i0.Input,
|
|
881
|
+
args: [{
|
|
882
|
+
isSignal: true,
|
|
883
|
+
alias: "dt",
|
|
884
|
+
required: false
|
|
885
|
+
}]
|
|
886
|
+
}],
|
|
887
|
+
pt: [{
|
|
888
|
+
type: i0.Input,
|
|
889
|
+
args: [{
|
|
890
|
+
isSignal: true,
|
|
891
|
+
alias: "pt",
|
|
892
|
+
required: false
|
|
893
|
+
}]
|
|
894
|
+
}],
|
|
895
|
+
ptOptions: [{
|
|
896
|
+
type: i0.Input,
|
|
897
|
+
args: [{
|
|
898
|
+
isSignal: true,
|
|
899
|
+
alias: "ptOptions",
|
|
900
|
+
required: false
|
|
901
|
+
}]
|
|
902
|
+
}],
|
|
903
|
+
unstyled: [{
|
|
904
|
+
type: i0.Input,
|
|
905
|
+
args: [{
|
|
906
|
+
isSignal: true,
|
|
907
|
+
alias: "unstyled",
|
|
908
|
+
required: false
|
|
909
|
+
}]
|
|
910
|
+
}],
|
|
911
|
+
itemTemplate: [{
|
|
912
|
+
type: i0.ContentChild,
|
|
913
|
+
args: [i0.forwardRef(() => TxCarouselItemTemplate), { isSignal: true }]
|
|
914
|
+
}],
|
|
915
|
+
indicatorTemplate: [{
|
|
916
|
+
type: i0.ContentChild,
|
|
917
|
+
args: [i0.forwardRef(() => TxCarouselIndicatorTemplate), { isSignal: true }]
|
|
918
|
+
}],
|
|
919
|
+
header: [{
|
|
920
|
+
type: i0.ContentChild,
|
|
921
|
+
args: [i0.forwardRef(() => TxCarouselHeader), { isSignal: true }]
|
|
922
|
+
}],
|
|
923
|
+
footer: [{
|
|
924
|
+
type: i0.ContentChild,
|
|
925
|
+
args: [i0.forwardRef(() => TxCarouselFooter), { isSignal: true }]
|
|
926
|
+
}],
|
|
927
|
+
viewport: [{
|
|
928
|
+
type: i0.ViewChild,
|
|
929
|
+
args: ["viewport", { isSignal: true }]
|
|
930
|
+
}],
|
|
931
|
+
indicatorList: [{
|
|
932
|
+
type: i0.ViewChild,
|
|
933
|
+
args: ["indicators", { isSignal: true }]
|
|
934
|
+
}]
|
|
935
|
+
}
|
|
936
|
+
});
|
|
937
|
+
export { TxCarousel, TxCarouselFooter, TxCarouselHeader, TxCarouselIndicatorTemplate, TxCarouselItemTemplate };
|
|
938
|
+
|
|
939
|
+
//# sourceMappingURL=tectra-ng-ui-carousel.mjs.map
|