@tet/tet-components 1.3.133-testing → 1.3.134-testing
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/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/tet-carousel.cjs.entry.js +164 -91
- package/dist/cjs/tet-components.cjs.js +1 -1
- package/dist/collection/components/basic/carousel/tet-carousel/test/tet-carousel.spec.js +0 -2
- package/dist/collection/components/basic/carousel/tet-carousel/tet-carousel.css +26 -6
- package/dist/collection/components/basic/carousel/tet-carousel/tet-carousel.js +187 -147
- package/dist/components/tet-carousel.js +169 -99
- package/dist/esm/loader.js +1 -1
- package/dist/esm/tet-carousel.entry.js +165 -92
- package/dist/esm/tet-components.js +1 -1
- package/dist/tet-components/p-784327ff.entry.js +1 -0
- package/dist/tet-components/tet-components.esm.js +1 -1
- package/dist/types/components/basic/carousel/tet-carousel/tet-carousel.d.ts +25 -22
- package/dist/types/components.d.ts +8 -24
- package/package.json +1 -1
- package/dist/tet-components/p-cfb157e3.entry.js +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { h, Host } from "@stencil/core";
|
|
1
|
+
import { h, Host, forceUpdate } from "@stencil/core";
|
|
2
|
+
import { processTranslations, t } from "../../../../services/translations/index";
|
|
2
3
|
export class TetCarousel {
|
|
3
4
|
constructor() {
|
|
4
5
|
this.draggedAnchor = null;
|
|
@@ -12,37 +13,65 @@ export class TetCarousel {
|
|
|
12
13
|
this.trackElement = null;
|
|
13
14
|
this.dragStartX = 0;
|
|
14
15
|
this.swipeStart = 0;
|
|
15
|
-
this.
|
|
16
|
+
this.handleMove = () => {
|
|
16
17
|
var _a;
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
const slot = (_a = this.container) === null || _a === void 0 ? void 0 : _a.querySelector('slot');
|
|
19
|
+
if (!slot)
|
|
20
|
+
return 1;
|
|
21
|
+
const assigned = slot.assignedElements ? slot.assignedElements() : [];
|
|
22
|
+
const item = assigned[this.activeItem];
|
|
23
|
+
if (item) {
|
|
24
|
+
this.moveToItem(item);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
this.handlePrev = () => {
|
|
28
|
+
if (this.activeItem > 0) {
|
|
29
|
+
this.activeItem -= 1;
|
|
19
30
|
}
|
|
20
|
-
|
|
21
|
-
this.dragOffset = -(this.activeIndex * wrapperWidth);
|
|
31
|
+
this.handleMove();
|
|
22
32
|
};
|
|
23
33
|
this.handleNext = () => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
this.activeIndex += 1;
|
|
34
|
+
if (this.activeItem < this.totalItems) {
|
|
35
|
+
this.activeItem += 1;
|
|
27
36
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
37
|
+
this.handleMove();
|
|
38
|
+
};
|
|
39
|
+
this.moveToLastScreen = () => {
|
|
40
|
+
const wrapperWidth = this.getViewportWidth();
|
|
41
|
+
const totalWidth = this.getSlotClientWidth();
|
|
42
|
+
this.dragOffset = -(totalWidth - wrapperWidth);
|
|
31
43
|
};
|
|
32
|
-
this.
|
|
33
|
-
var _a
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
44
|
+
this.moveToTarget = (target) => {
|
|
45
|
+
var _a;
|
|
46
|
+
const slot = (_a = this.container) === null || _a === void 0 ? void 0 : _a.querySelector('slot');
|
|
47
|
+
if (!slot)
|
|
48
|
+
return 1;
|
|
49
|
+
const assigned = slot.assignedElements ? slot.assignedElements() : [];
|
|
50
|
+
for (const [index, item] of assigned.entries()) {
|
|
51
|
+
const rect = item.getBoundingClientRect();
|
|
52
|
+
const trackRect = this.trackElement.getBoundingClientRect();
|
|
53
|
+
let relativeLeft = rect.left - trackRect.left;
|
|
54
|
+
const gradientOffset = this.calculateGradient(item, relativeLeft);
|
|
55
|
+
if (relativeLeft >= target - this.swipeThreshold + gradientOffset) {
|
|
56
|
+
this.moveToItem(item, index);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
38
59
|
}
|
|
60
|
+
this.moveToItem(assigned[0], 0);
|
|
61
|
+
return;
|
|
39
62
|
};
|
|
40
63
|
this.handleDotClick = (idx) => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
this.
|
|
45
|
-
|
|
64
|
+
this.activeDotIndex = idx;
|
|
65
|
+
const totalWidth = this.getSlotClientWidth();
|
|
66
|
+
let targetDragOffset = 0;
|
|
67
|
+
if (this.dotCount - 1 === this.activeDotIndex && !this.isDragging) {
|
|
68
|
+
const viewPortWidth = this.getViewportWidth();
|
|
69
|
+
targetDragOffset = totalWidth - viewPortWidth;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
targetDragOffset = idx * this.getDotScreenLength();
|
|
73
|
+
}
|
|
74
|
+
this.moveToTarget(targetDragOffset);
|
|
46
75
|
};
|
|
47
76
|
this.onPointerDown = (e) => {
|
|
48
77
|
e.preventDefault();
|
|
@@ -68,7 +97,6 @@ export class TetCarousel {
|
|
|
68
97
|
}
|
|
69
98
|
};
|
|
70
99
|
this.onPointerMove = (e) => {
|
|
71
|
-
var _a, _b, _c;
|
|
72
100
|
if (!this.isDragging)
|
|
73
101
|
return;
|
|
74
102
|
// Only consider this a move (and prevent clicks) when movement exceeds a small threshold.
|
|
@@ -85,21 +113,20 @@ export class TetCarousel {
|
|
|
85
113
|
let _dragOffset = this.dragOffset;
|
|
86
114
|
_dragOffset += delta;
|
|
87
115
|
this.dragStartX = e.screenX;
|
|
88
|
-
const wrapperWidth =
|
|
89
|
-
const totalWidth =
|
|
116
|
+
const wrapperWidth = this.getViewportWidth();
|
|
117
|
+
const totalWidth = this.getSlotClientWidth();
|
|
90
118
|
const totalScrollableWidth = -(totalWidth - wrapperWidth);
|
|
91
119
|
if (totalScrollableWidth < _dragOffset && _dragOffset < 0) {
|
|
92
120
|
this.dragOffset = _dragOffset;
|
|
93
121
|
}
|
|
94
122
|
};
|
|
95
123
|
this.onPointerUp = (e) => {
|
|
96
|
-
var _a, _b, _c;
|
|
97
124
|
e.preventDefault();
|
|
98
125
|
e.stopPropagation();
|
|
99
126
|
e.stopImmediatePropagation();
|
|
100
127
|
if (!this.isDragging)
|
|
101
128
|
return;
|
|
102
|
-
// Snap
|
|
129
|
+
// Snap activeDotIndex when dragOffset passes threshold from last index position
|
|
103
130
|
this.isDragging = false;
|
|
104
131
|
// Let the once:true capture handler auto-remove itself. Clear flag after a tick.
|
|
105
132
|
if (this.clickPreventAdded) {
|
|
@@ -108,17 +135,7 @@ export class TetCarousel {
|
|
|
108
135
|
}, 0);
|
|
109
136
|
}
|
|
110
137
|
if (Math.abs(this.dragOffset - this.swipeStart) > this.swipeThreshold) {
|
|
111
|
-
|
|
112
|
-
let index = this.activeIndex + indexOffsett;
|
|
113
|
-
index = Math.max(0, Math.min(index, this.screenCount - 1));
|
|
114
|
-
this.activeIndex = index;
|
|
115
|
-
const wrapperWidth = ((_a = this.container) === null || _a === void 0 ? void 0 : _a.offsetWidth) || window.innerWidth;
|
|
116
|
-
if (this.screenCount - 1 === this.activeIndex && !this.isDragging) {
|
|
117
|
-
const totalWidth = ((_c = (_b = this.trackElement) === null || _b === void 0 ? void 0 : _b.querySelector('slot')) === null || _c === void 0 ? void 0 : _c.offsetWidth) || window.innerWidth;
|
|
118
|
-
this.dragOffset = -(totalWidth - wrapperWidth);
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
this.dragOffset = -(index * wrapperWidth);
|
|
138
|
+
this.moveToTarget(-this.dragOffset);
|
|
122
139
|
}
|
|
123
140
|
document.body.style.userSelect = '';
|
|
124
141
|
document.removeEventListener('pointermove', this.onPointerMove);
|
|
@@ -133,10 +150,10 @@ export class TetCarousel {
|
|
|
133
150
|
this.draggedAnchor.addEventListener('click', preventClick, true);
|
|
134
151
|
}
|
|
135
152
|
};
|
|
136
|
-
this.
|
|
137
|
-
this.
|
|
153
|
+
this.activeDotIndex = 0;
|
|
154
|
+
this.dotCount = 0;
|
|
138
155
|
this.totalItems = 0;
|
|
139
|
-
this.
|
|
156
|
+
this.activeItem = 0;
|
|
140
157
|
this.theme = 'light';
|
|
141
158
|
this.isDragging = false;
|
|
142
159
|
this.dragOffset = 0;
|
|
@@ -148,17 +165,46 @@ export class TetCarousel {
|
|
|
148
165
|
this.transitionTiming = 'cubic-bezier(0.77,0,0.175,1)';
|
|
149
166
|
this.buttonIconLeft = 'arrow-left';
|
|
150
167
|
this.buttonIconRight = 'arrow-right';
|
|
151
|
-
this.
|
|
152
|
-
this.
|
|
153
|
-
|
|
154
|
-
|
|
168
|
+
this.maxDots = 8;
|
|
169
|
+
this.language = 'lv';
|
|
170
|
+
}
|
|
171
|
+
async onLanguageChange(language) {
|
|
172
|
+
processTranslations('tet-components', language).then(() => forceUpdate(this));
|
|
173
|
+
}
|
|
174
|
+
componentWillLoad() {
|
|
175
|
+
processTranslations('tet-components', this.language).then(() => forceUpdate(this));
|
|
176
|
+
}
|
|
177
|
+
getViewportWidth() {
|
|
178
|
+
var _a;
|
|
179
|
+
return ((_a = this.container) === null || _a === void 0 ? void 0 : _a.offsetWidth) || window.innerWidth;
|
|
180
|
+
}
|
|
181
|
+
getSlotClientWidth() {
|
|
182
|
+
var _a, _b;
|
|
183
|
+
return ((_b = (_a = this.trackElement) === null || _a === void 0 ? void 0 : _a.querySelector('slot')) === null || _b === void 0 ? void 0 : _b.offsetWidth) || window.innerWidth;
|
|
184
|
+
}
|
|
185
|
+
getDotScreenLength() {
|
|
186
|
+
const totalWidth = this.getSlotClientWidth();
|
|
187
|
+
return (totalWidth / this.dotCount);
|
|
188
|
+
}
|
|
189
|
+
isLast(lastScreenBorder, position) {
|
|
190
|
+
const totalWidth = this.getSlotClientWidth();
|
|
191
|
+
const relativeLeftToEnd = totalWidth - position;
|
|
192
|
+
return relativeLeftToEnd <= lastScreenBorder;
|
|
193
|
+
}
|
|
194
|
+
isLastViewport(position) {
|
|
195
|
+
const viewportWidth = this.getViewportWidth();
|
|
196
|
+
return this.isLast(viewportWidth, position);
|
|
197
|
+
}
|
|
198
|
+
isLastDotScreen(position, dotScreenLength) {
|
|
199
|
+
const viewportWidth = this.getViewportWidth();
|
|
200
|
+
const lastScreenBorder = Math.max(dotScreenLength, viewportWidth);
|
|
201
|
+
return this.isLast(lastScreenBorder, position);
|
|
155
202
|
}
|
|
156
203
|
checkGradient() {
|
|
157
|
-
var _a, _b, _c;
|
|
158
204
|
if (this.showGradient) {
|
|
159
205
|
const absOffset = Math.abs(this.dragOffset);
|
|
160
|
-
const wrapperWidth =
|
|
161
|
-
const totalWidth =
|
|
206
|
+
const wrapperWidth = this.getViewportWidth();
|
|
207
|
+
const totalWidth = this.getSlotClientWidth();
|
|
162
208
|
const rightEdgeDistance = totalWidth - absOffset - wrapperWidth;
|
|
163
209
|
if (rightEdgeDistance >= 0) {
|
|
164
210
|
const rightEdge = rightEdgeDistance < 16;
|
|
@@ -181,39 +227,43 @@ export class TetCarousel {
|
|
|
181
227
|
this.rightGradientRef.style.opacity = "0";
|
|
182
228
|
}
|
|
183
229
|
}
|
|
184
|
-
|
|
185
|
-
var _a
|
|
230
|
+
getDotCount() {
|
|
231
|
+
var _a;
|
|
186
232
|
const slot = (_a = this.container) === null || _a === void 0 ? void 0 : _a.querySelector('slot');
|
|
187
233
|
if (!slot)
|
|
188
234
|
return 1;
|
|
189
235
|
const assigned = slot.assignedElements ? slot.assignedElements() : [];
|
|
190
236
|
if (assigned.length === 0)
|
|
191
237
|
return 1;
|
|
192
|
-
let totalWidth = 0;
|
|
193
|
-
assigned.forEach((el, index) => {
|
|
194
|
-
totalWidth += el.offsetWidth || 0;
|
|
195
|
-
this.items.push({ id: index, width: el.offsetWidth || 0 });
|
|
196
|
-
});
|
|
197
|
-
if (totalWidth === 0) {
|
|
198
|
-
totalWidth = assigned.length * window.innerWidth;
|
|
199
|
-
}
|
|
200
|
-
const screenWidth = ((_b = this.container) === null || _b === void 0 ? void 0 : _b.offsetWidth) || window.innerWidth;
|
|
201
238
|
this.totalItems = assigned.length;
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
const
|
|
208
|
-
|
|
239
|
+
const viewportWidth = this.getViewportWidth();
|
|
240
|
+
const totalWidth = this.getSlotClientWidth();
|
|
241
|
+
let count = 0;
|
|
242
|
+
assigned.forEach((el) => {
|
|
243
|
+
const rect = el.getBoundingClientRect();
|
|
244
|
+
const trackRect = this.trackElement.getBoundingClientRect();
|
|
245
|
+
let relativeLeft = rect.left - trackRect.left;
|
|
246
|
+
if (relativeLeft > totalWidth - viewportWidth) {
|
|
247
|
+
this.dotCount = Math.min(this === null || this === void 0 ? void 0 : this.maxDots, count + 1);
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
count = Math.min(this === null || this === void 0 ? void 0 : this.maxDots, Math.ceil(relativeLeft / viewportWidth));
|
|
209
251
|
});
|
|
210
252
|
}
|
|
253
|
+
calculateGradient(item, relativeLeft) {
|
|
254
|
+
const totalWidth = this.getSlotClientWidth();
|
|
255
|
+
const offsetWidth = item.offsetWidth;
|
|
256
|
+
let relativeRight = totalWidth - relativeLeft - offsetWidth;
|
|
257
|
+
let gradientOffset = this.showGradient ? 160 : 0;
|
|
258
|
+
gradientOffset = relativeLeft < 160 ? relativeLeft : gradientOffset;
|
|
259
|
+
gradientOffset = relativeRight < 160 ? 0 : gradientOffset;
|
|
260
|
+
return gradientOffset;
|
|
261
|
+
}
|
|
211
262
|
componentDidLoad() {
|
|
212
|
-
this.
|
|
213
|
-
window.addEventListener('resize', this.
|
|
263
|
+
this.getDotCount();
|
|
264
|
+
window.addEventListener('resize', this.getDotCount.bind(this));
|
|
214
265
|
this.addAnchorFocusListeners();
|
|
215
266
|
this.checkGradient();
|
|
216
|
-
this.disableTabIndex();
|
|
217
267
|
}
|
|
218
268
|
addAnchorFocusListeners() {
|
|
219
269
|
if (!this.trackElement)
|
|
@@ -233,40 +283,57 @@ export class TetCarousel {
|
|
|
233
283
|
}
|
|
234
284
|
const tabIndexElements = Array.from(el.querySelectorAll('[tabindex="0"]'));
|
|
235
285
|
anchors = anchors.concat(tabIndexElements);
|
|
286
|
+
if (el.shadowRoot) {
|
|
287
|
+
const deepTabIndexElements = Array.from(el.shadowRoot.querySelectorAll('[tabindex="0"]'));
|
|
288
|
+
anchors = anchors.concat(deepTabIndexElements);
|
|
289
|
+
}
|
|
236
290
|
});
|
|
237
|
-
anchors.forEach((a) => {
|
|
291
|
+
anchors.forEach((a, index) => {
|
|
238
292
|
a.addEventListener('focus', () => {
|
|
239
|
-
|
|
240
|
-
const screenWidth = ((_a = this.container) === null || _a === void 0 ? void 0 : _a.offsetWidth) || window.innerWidth;
|
|
241
|
-
const rect = a.getBoundingClientRect();
|
|
242
|
-
const trackRect = this.trackElement.getBoundingClientRect();
|
|
243
|
-
let relativeLeft = rect.left - trackRect.left;
|
|
244
|
-
const totalWidth = ((_c = (_b = this.trackElement) === null || _b === void 0 ? void 0 : _b.querySelector('slot')) === null || _c === void 0 ? void 0 : _c.offsetWidth) || window.innerWidth;
|
|
245
|
-
let relativeRight = totalWidth - relativeLeft - a.offsetWidth;
|
|
246
|
-
// calculations for active index/dots
|
|
247
|
-
let index = Math.round(-this.dragOffset / screenWidth);
|
|
248
|
-
index = Math.max(0, Math.min(index, this.screenCount - 1));
|
|
249
|
-
let gradientOffset = this.showGradient ? 160 : 0;
|
|
250
|
-
gradientOffset = relativeLeft < 160 ? relativeLeft : gradientOffset;
|
|
251
|
-
gradientOffset = relativeRight < 160 ? 0 : gradientOffset;
|
|
252
|
-
relativeLeft -= gradientOffset;
|
|
253
|
-
const screenIdx = Math.floor((relativeLeft - gradientOffset) / screenWidth);
|
|
254
|
-
this.activeIndex = Math.max(0, Math.min(screenIdx, this.screenCount - 1));
|
|
255
|
-
if (totalWidth > screenWidth + relativeLeft) {
|
|
256
|
-
this.dragOffset = -relativeLeft;
|
|
257
|
-
}
|
|
258
|
-
this.checkForLastScreen();
|
|
293
|
+
this.moveToItem(a, index);
|
|
259
294
|
});
|
|
260
295
|
});
|
|
261
296
|
}
|
|
297
|
+
clampDotIndex(dotIndex) {
|
|
298
|
+
return Math.max(0, Math.min(dotIndex, this.dotCount - 1));
|
|
299
|
+
}
|
|
300
|
+
setDotIndex(position, gradientOffset) {
|
|
301
|
+
let dotIndex = 0;
|
|
302
|
+
const dotScreenLength = this.getDotScreenLength();
|
|
303
|
+
if (this.isLastDotScreen(position, dotScreenLength)) {
|
|
304
|
+
dotIndex = this.dotCount - 1;
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
dotIndex = Math.floor((position + gradientOffset) / dotScreenLength);
|
|
308
|
+
}
|
|
309
|
+
this.activeDotIndex = this.clampDotIndex(dotIndex);
|
|
310
|
+
}
|
|
311
|
+
moveToItem(item, index) {
|
|
312
|
+
if (index || index === 0) {
|
|
313
|
+
this.activeItem = index;
|
|
314
|
+
}
|
|
315
|
+
const rect = item.getBoundingClientRect();
|
|
316
|
+
const trackRect = this.trackElement.getBoundingClientRect();
|
|
317
|
+
let relativeLeft = rect.left - trackRect.left;
|
|
318
|
+
const gradientOffset = this.calculateGradient(item, relativeLeft);
|
|
319
|
+
this.setDotIndex(relativeLeft, gradientOffset);
|
|
320
|
+
if (!this.isLastViewport(relativeLeft)) {
|
|
321
|
+
this.dragOffset = -relativeLeft;
|
|
322
|
+
}
|
|
323
|
+
else {
|
|
324
|
+
this.moveToLastScreen();
|
|
325
|
+
}
|
|
326
|
+
}
|
|
262
327
|
disconnectedCallback() {
|
|
263
|
-
window.removeEventListener('resize', this.
|
|
328
|
+
window.removeEventListener('resize', this.getDotCount.bind(this));
|
|
264
329
|
}
|
|
265
330
|
render() {
|
|
266
|
-
return (h(Host, { key: '
|
|
331
|
+
return (h(Host, { key: 'd2a06bc0e502d130ad3642fcbda590a003e6f305' }, h("div", { key: '96ac837374a1ad150f925a44dc534547426a13e1', class: { 'tet-carousel': true, [`${this.theme}`]: true }, ref: (el) => (this.container = el), part: "carousel" }, h("div", { key: 'e8f8f9b22d1a2170bb4f3a7e5834d2832c18b853', class: "tet-carousel__container" }, h("div", { key: '63e2d90692e0d5a6b58e919016a3baf614c7bfb3', class: "tet-carousel__gradient-left", ref: (el) => { this.leftGradientRef = el; } }), h("div", { key: '29c271641073f62bade810d4f3f05666fbc48f78', class: "tet-carousel__gradient-right", ref: (el) => { this.rightGradientRef = el; } }), h("div", { key: 'c6ca2fe643e5fe9a1ab4fe9b383ac033939a268f', class: "tet-carousel__track", ref: (el) => (this.trackElement = el), style: {
|
|
267
332
|
transform: `translateX(${this.dragOffset}px)`,
|
|
268
333
|
transition: this.isDragging ? 'none' : `transform ${this.transitionDuration}ms ${this.transitionTiming}`
|
|
269
|
-
}, onPointerDown: this.onPointerDown, onMouseMove: this.onPointerMove, onPointerUp: this.onPointerUp, onMouseLeave: this.onPointerUp }, h("slot", { key: '
|
|
334
|
+
}, onPointerDown: this.onPointerDown, onMouseMove: this.onPointerMove, onPointerUp: this.onPointerUp, onMouseLeave: this.onPointerUp }, h("slot", { key: '70203e9f192cdc419352b8c37b6525c46b947aac' }))), (this.showButtons || this.showDots) && (h("div", { key: '104db94f8bfe2d26c939fd906089bac09a190f39', class: "tet-carousel__controls" }, this.showButtons && (h("div", { key: 'a359503a813556b1ae04663b67bffc80fb6d3eba', class: "tet-carousel__buttons tet-carousel__buttons--mobile" }, h("tet-button", { key: 'b879d216ee1475385528534e1e7ba582cc6340fa', class: "tet-carousel__btn", theme: this.theme === 'light' ? 'dark' : 'light', "icon-name": this.buttonIconLeft, "icon-mode": true, onClick: this.handlePrev, "aria-label": t('components-carousel-previous'), disabled: this.dotCount <= 1 || this.activeItem === 0 }))), this.showDots && (h("div", { key: 'fe2fa44f42636e6d1a1d9a216db73ebff6063f51', class: "tet-carousel__dots" }, Array.from({ length: this.dotCount }).map((_, idx) => (h("button", { type: "button", class: `tet-carousel__dot${idx === this.activeDotIndex ? ' active' : ''}`, key: idx, onClick: () => this.handleDotClick(idx) }))))), this.showButtons && (h("div", { key: '6fef3b90e8646571d8947fd81785bf1dbffe636b', class: "tet-carousel__buttons " }, h("tet-button", { key: '8e51c2e7a3585c36ba144a6c8f6a57f4c1c3bd48', class: "tet-carousel__buttons--desktop tet-carousel__btn ", theme: this.theme === 'light' ? 'dark' : 'light', "icon-name": this.buttonIconLeft, "icon-mode": true, onClick: this.handlePrev, "aria-label": t('components-carousel-previous'), disabled: this.dotCount <= 1 || this.activeItem === 0 }), h("tet-button", { key: 'affb86f1c2c3dd128389b1bea0179806512ea3d1', class: "tet-carousel__btn", theme: this.theme === 'light' ? 'dark' : 'light', "icon-name": this.buttonIconRight, "icon-mode": true, onClick: this.handleNext, "aria-label": t('components-carousel-next'), disabled: this.dotCount <= 1
|
|
335
|
+
|| this.activeItem === this.totalItems - 1
|
|
336
|
+
|| this.isLastViewport(-this.dragOffset) }))))))));
|
|
270
337
|
}
|
|
271
338
|
static get is() { return "tet-carousel"; }
|
|
272
339
|
static get encapsulation() { return "shadow"; }
|
|
@@ -444,92 +511,65 @@ export class TetCarousel {
|
|
|
444
511
|
"reflect": false,
|
|
445
512
|
"defaultValue": "'arrow-right'"
|
|
446
513
|
},
|
|
447
|
-
"
|
|
448
|
-
"type": "
|
|
449
|
-
"mutable": false,
|
|
450
|
-
"complexType": {
|
|
451
|
-
"original": "string",
|
|
452
|
-
"resolved": "string",
|
|
453
|
-
"references": {}
|
|
454
|
-
},
|
|
455
|
-
"required": false,
|
|
456
|
-
"optional": false,
|
|
457
|
-
"docs": {
|
|
458
|
-
"tags": [],
|
|
459
|
-
"text": "Additional CSS class for the carousel container."
|
|
460
|
-
},
|
|
461
|
-
"attribute": "container-class",
|
|
462
|
-
"reflect": false,
|
|
463
|
-
"defaultValue": "''"
|
|
464
|
-
},
|
|
465
|
-
"trackClass": {
|
|
466
|
-
"type": "string",
|
|
467
|
-
"mutable": false,
|
|
468
|
-
"complexType": {
|
|
469
|
-
"original": "string",
|
|
470
|
-
"resolved": "string",
|
|
471
|
-
"references": {}
|
|
472
|
-
},
|
|
473
|
-
"required": false,
|
|
474
|
-
"optional": false,
|
|
475
|
-
"docs": {
|
|
476
|
-
"tags": [],
|
|
477
|
-
"text": "Additional CSS class for the carousel track."
|
|
478
|
-
},
|
|
479
|
-
"attribute": "track-class",
|
|
480
|
-
"reflect": false,
|
|
481
|
-
"defaultValue": "''"
|
|
482
|
-
},
|
|
483
|
-
"buttonClass": {
|
|
484
|
-
"type": "string",
|
|
514
|
+
"maxDots": {
|
|
515
|
+
"type": "number",
|
|
485
516
|
"mutable": false,
|
|
486
517
|
"complexType": {
|
|
487
|
-
"original": "
|
|
488
|
-
"resolved": "
|
|
518
|
+
"original": "number",
|
|
519
|
+
"resolved": "number",
|
|
489
520
|
"references": {}
|
|
490
521
|
},
|
|
491
522
|
"required": false,
|
|
492
523
|
"optional": false,
|
|
493
524
|
"docs": {
|
|
494
525
|
"tags": [],
|
|
495
|
-
"text": "
|
|
526
|
+
"text": "Maximum number of dots."
|
|
496
527
|
},
|
|
497
|
-
"attribute": "
|
|
528
|
+
"attribute": "max-dots",
|
|
498
529
|
"reflect": false,
|
|
499
|
-
"defaultValue": "
|
|
530
|
+
"defaultValue": "8"
|
|
500
531
|
},
|
|
501
|
-
"
|
|
532
|
+
"language": {
|
|
502
533
|
"type": "string",
|
|
503
534
|
"mutable": false,
|
|
504
535
|
"complexType": {
|
|
505
|
-
"original": "
|
|
506
|
-
"resolved": "
|
|
507
|
-
"references": {
|
|
536
|
+
"original": "Language",
|
|
537
|
+
"resolved": "\"en\" | \"lv\" | \"ru\"",
|
|
538
|
+
"references": {
|
|
539
|
+
"Language": {
|
|
540
|
+
"location": "import",
|
|
541
|
+
"path": "@services/translations",
|
|
542
|
+
"id": "src/services/translations/index.ts::Language"
|
|
543
|
+
}
|
|
544
|
+
}
|
|
508
545
|
},
|
|
509
546
|
"required": false,
|
|
510
547
|
"optional": false,
|
|
511
548
|
"docs": {
|
|
512
549
|
"tags": [],
|
|
513
|
-
"text": "
|
|
550
|
+
"text": "The translation language."
|
|
514
551
|
},
|
|
515
|
-
"attribute": "
|
|
552
|
+
"attribute": "language",
|
|
516
553
|
"reflect": false,
|
|
517
|
-
"defaultValue": "''"
|
|
554
|
+
"defaultValue": "'lv'"
|
|
518
555
|
}
|
|
519
556
|
};
|
|
520
557
|
}
|
|
521
558
|
static get states() {
|
|
522
559
|
return {
|
|
523
|
-
"
|
|
524
|
-
"
|
|
560
|
+
"activeDotIndex": {},
|
|
561
|
+
"dotCount": {},
|
|
525
562
|
"totalItems": {},
|
|
526
|
-
"
|
|
563
|
+
"activeItem": {},
|
|
527
564
|
"isDragging": {},
|
|
528
565
|
"dragOffset": {}
|
|
529
566
|
};
|
|
530
567
|
}
|
|
531
568
|
static get watchers() {
|
|
532
569
|
return [{
|
|
570
|
+
"propName": "language",
|
|
571
|
+
"methodName": "onLanguageChange"
|
|
572
|
+
}, {
|
|
533
573
|
"propName": "showGradient",
|
|
534
574
|
"methodName": "checkGradient"
|
|
535
575
|
}, {
|