@everymatrix/casino-challenges-overlay-slider 0.0.1
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/casino-challenges-overlay-slider/app-globals-0f993ce5.js +1 -0
- package/dist/casino-challenges-overlay-slider/casino-challenges-overlay-card_2.entry.js +1 -0
- package/dist/casino-challenges-overlay-slider/casino-challenges-overlay-slider-2eb80eb5.js +1 -0
- package/dist/casino-challenges-overlay-slider/casino-challenges-overlay-slider.esm.js +1 -0
- package/dist/casino-challenges-overlay-slider/index-9e63661c.js +2 -0
- package/dist/casino-challenges-overlay-slider/index.esm.js +1 -0
- package/dist/cjs/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/casino-challenges-overlay-card_2.cjs.entry.js +164 -0
- package/dist/cjs/casino-challenges-overlay-slider-bf3e8c30.js +412 -0
- package/dist/cjs/casino-challenges-overlay-slider.cjs.js +25 -0
- package/dist/cjs/index-180bdedd.js +1248 -0
- package/dist/cjs/index.cjs.js +10 -0
- package/dist/cjs/loader.cjs.js +15 -0
- package/dist/collection/assets/left_arrow.svg +3 -0
- package/dist/collection/assets/right_arrow.svg +3 -0
- package/dist/collection/collection-manifest.json +13 -0
- package/dist/collection/components/casino-challenges-overlay-slider/casino-challenges-overlay-slider.css +98 -0
- package/dist/collection/components/casino-challenges-overlay-slider/casino-challenges-overlay-slider.js +450 -0
- package/dist/collection/components/casino-challenges-overlay-slider/components/casino-challenges-overlay-card.css +107 -0
- package/dist/collection/components/casino-challenges-overlay-slider/components/casino-challenges-overlay-card.js +260 -0
- package/dist/collection/components/casino-challenges-overlay-slider/index.js +1 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/locale.utils.js +48 -0
- package/dist/collection/utils/types.js +52 -0
- package/dist/collection/utils/utils.js +20 -0
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/casino-challenges-overlay-card_2.entry.js +160 -0
- package/dist/esm/casino-challenges-overlay-slider-2eb80eb5.js +409 -0
- package/dist/esm/casino-challenges-overlay-slider.js +20 -0
- package/dist/esm/index-9e63661c.js +1220 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/loader.js +11 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/stencil.config.dev.js +19 -0
- package/dist/stencil.config.js +19 -0
- package/dist/storybook/main.js +43 -0
- package/dist/storybook/preview.js +9 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay-slider/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay-slider/.stencil/packages/stencil/casino-challenges-overlay-slider/stencil.config.d.ts +2 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay-slider/.stencil/packages/stencil/casino-challenges-overlay-slider/stencil.config.dev.d.ts +2 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay-slider/.stencil/packages/stencil/casino-challenges-overlay-slider/storybook/main.d.ts +3 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay-slider/.stencil/packages/stencil/casino-challenges-overlay-slider/storybook/preview.d.ts +70 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay-slider/.stencil/tools/plugins/index.d.ts +4 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay-slider/.stencil/tools/plugins/lazy-load-chunk-plugin.d.ts +12 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay-slider/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay-slider/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay-slider/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
- package/dist/types/components/casino-challenges-overlay-slider/casino-challenges-overlay-slider.d.ts +53 -0
- package/dist/types/components/casino-challenges-overlay-slider/components/casino-challenges-overlay-card.d.ts +22 -0
- package/dist/types/components/casino-challenges-overlay-slider/index.d.ts +1 -0
- package/dist/types/components.d.ts +118 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1674 -0
- package/dist/types/utils/locale.utils.d.ts +3 -0
- package/dist/types/utils/types.d.ts +120 -0
- package/dist/types/utils/utils.d.ts +2 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/loader/package.json +11 -0
- package/package.json +27 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const casinoChallengesOverlaySlider = require('./casino-challenges-overlay-slider-bf3e8c30.js');
|
|
6
|
+
require('./index-180bdedd.js');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
exports.CasinoChallengesOverlaySlider = casinoChallengesOverlaySlider.CasinoChallengesOverlaySlider;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-180bdedd.js');
|
|
6
|
+
const appGlobals = require('./app-globals-3a1e7e63.js');
|
|
7
|
+
|
|
8
|
+
const defineCustomElements = async (win, options) => {
|
|
9
|
+
if (typeof window === 'undefined') return undefined;
|
|
10
|
+
await appGlobals.globalScripts();
|
|
11
|
+
return index.bootstrapLazy([["casino-challenges-overlay-card_2.cjs",[[1,"casino-challenges-overlay-slider",{"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"language":[513],"isMobile":[516,"is-mobile"],"challenges":[16],"initialProgressId":[1,"initial-progress-id"],"activeTabIndex":[1,"active-tab-index"],"currentIndex":[32],"slideWidth":[32],"slideHeight":[32],"isOneSlide":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"],"currentIndex":["onCurrentIndexChange"],"challenges":["onChallengesChange"],"initialProgressId":["onInitialProgressIdChange"]}],[0,"casino-challenges-overlay-card",{"challenge":[16],"index":[2],"arrLength":[2,"arr-length"],"currentIndex":[2,"current-index"],"language":[1],"isOptedOut":[4,"is-opted-out"],"slideWidth":[2,"slide-width"],"slideHeight":[2,"slide-height"],"timeLeft":[32]}]]]], options);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.setNonce = index.setNonce;
|
|
15
|
+
exports.defineCustomElements = defineCustomElements;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"entries": [
|
|
3
|
+
"components/casino-challenges-overlay-slider/casino-challenges-overlay-slider.js",
|
|
4
|
+
"components/casino-challenges-overlay-slider/components/casino-challenges-overlay-card.js"
|
|
5
|
+
],
|
|
6
|
+
"compiler": {
|
|
7
|
+
"name": "@stencil/core",
|
|
8
|
+
"version": "4.19.2",
|
|
9
|
+
"typescriptVersion": "5.4.5"
|
|
10
|
+
},
|
|
11
|
+
"collections": [],
|
|
12
|
+
"bundles": []
|
|
13
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
@import url("https://fonts.googleapis.com/css2?family=Teachers:ital,wght@0,400..800;1,400..800&display=swap");
|
|
2
|
+
.one-slide .challenges__slider {
|
|
3
|
+
justify-content: center;
|
|
4
|
+
cursor: pointer;
|
|
5
|
+
transition: none;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.slider-container {
|
|
9
|
+
position: relative;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.challenges__slider-wrapper {
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
width: 100%;
|
|
15
|
+
}
|
|
16
|
+
.challenges__slider {
|
|
17
|
+
display: flex;
|
|
18
|
+
transition: transform 0.25s ease;
|
|
19
|
+
will-change: transform;
|
|
20
|
+
touch-action: pan-y;
|
|
21
|
+
user-select: none;
|
|
22
|
+
cursor: grab;
|
|
23
|
+
}
|
|
24
|
+
.challenges__slider.active {
|
|
25
|
+
cursor: grabbing;
|
|
26
|
+
}
|
|
27
|
+
.challenges__slider-dots {
|
|
28
|
+
display: flex;
|
|
29
|
+
justify-content: center;
|
|
30
|
+
margin-top: 10px;
|
|
31
|
+
}
|
|
32
|
+
.challenges__slider-dot {
|
|
33
|
+
width: 7px;
|
|
34
|
+
height: 7px;
|
|
35
|
+
border-radius: 50%;
|
|
36
|
+
background: var(--emw--dot-button-bg, rgba(255, 255, 255, 0.1490196078));
|
|
37
|
+
margin: 4px;
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
transition: 0.2s;
|
|
40
|
+
}
|
|
41
|
+
.challenges__slider-dot.active {
|
|
42
|
+
width: 29px;
|
|
43
|
+
border-radius: 8px;
|
|
44
|
+
background: var(--emw--dot-button-active-bg, rgba(255, 255, 255, 0.2));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.action-button {
|
|
48
|
+
position: absolute;
|
|
49
|
+
top: 42%;
|
|
50
|
+
transform: translateY(-50%);
|
|
51
|
+
stroke: white;
|
|
52
|
+
width: 36px;
|
|
53
|
+
height: 36px;
|
|
54
|
+
border-radius: 50%;
|
|
55
|
+
display: flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
border: 2px solid var(--emw--color-container-border, rgba(255, 255, 255, 0.0705882353));
|
|
59
|
+
background: var(--emw--color-container-background, rgba(9, 9, 9, 0.5019607843));
|
|
60
|
+
backdrop-filter: blur(9.5px);
|
|
61
|
+
cursor: pointer;
|
|
62
|
+
}
|
|
63
|
+
.action-button--prev {
|
|
64
|
+
left: 30px;
|
|
65
|
+
}
|
|
66
|
+
.action-button--next {
|
|
67
|
+
right: 30px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.mobile .challenges__slider-dot {
|
|
71
|
+
width: 5px;
|
|
72
|
+
height: 5px;
|
|
73
|
+
margin: 2px;
|
|
74
|
+
}
|
|
75
|
+
.mobile .challenges__slider-dot.active {
|
|
76
|
+
width: 18px;
|
|
77
|
+
}
|
|
78
|
+
.mobile .challenges__slide__image-wrapper {
|
|
79
|
+
width: 240px;
|
|
80
|
+
height: 122px;
|
|
81
|
+
}
|
|
82
|
+
.mobile .challenges__slide__title {
|
|
83
|
+
bottom: 8px;
|
|
84
|
+
left: 8px;
|
|
85
|
+
font-size: var(--emw--font-size-small, 14px);
|
|
86
|
+
max-width: 224px;
|
|
87
|
+
}
|
|
88
|
+
.mobile .challenges__slide__badge {
|
|
89
|
+
top: 8px;
|
|
90
|
+
left: 8px;
|
|
91
|
+
font-size: var(--emw--font-size-2x-small, 11px);
|
|
92
|
+
}
|
|
93
|
+
.mobile .challenges__slide__badge .status {
|
|
94
|
+
height: 17px;
|
|
95
|
+
}
|
|
96
|
+
.mobile .action-button {
|
|
97
|
+
display: none;
|
|
98
|
+
}
|
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { setClientStyling, setClientStylingURL, setStreamStyling } from "../../../../../../../../libs/common/src/styling/index";
|
|
3
|
+
import { resolveTranslationUrl } from "../../utils/locale.utils";
|
|
4
|
+
import rightArrow from "../../assets/right_arrow.svg";
|
|
5
|
+
import leftArrow from "../../assets/left_arrow.svg";
|
|
6
|
+
export class CasinoChallengesOverlaySlider {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.slideGap = 0;
|
|
9
|
+
this.isDragging = false;
|
|
10
|
+
this.startX = 0;
|
|
11
|
+
this.currentTranslate = 0;
|
|
12
|
+
this.baseTranslate = 0;
|
|
13
|
+
this.slideWidthToContainer = 0.57; // 57%
|
|
14
|
+
this.slideHeightToContainer = 0.3; // 30%
|
|
15
|
+
this.next = () => {
|
|
16
|
+
this.currentIndex++;
|
|
17
|
+
this.setPositionByIndex();
|
|
18
|
+
const len = this.challenges.length;
|
|
19
|
+
if (this.currentIndex === len + 1) {
|
|
20
|
+
setTimeout(() => this.scheduleReset(1), 250);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
this.prev = () => {
|
|
24
|
+
this.currentIndex--;
|
|
25
|
+
this.setPositionByIndex();
|
|
26
|
+
const len = this.challenges.length;
|
|
27
|
+
if (this.currentIndex === 0) {
|
|
28
|
+
setTimeout(() => this.scheduleReset(len), 250);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
this.onPointerDown = (e) => {
|
|
32
|
+
var _a;
|
|
33
|
+
if (this.isOneSlide) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
this.isDragging = true;
|
|
37
|
+
this.startX = e.clientX;
|
|
38
|
+
this.baseTranslate = this.getBaseTranslate();
|
|
39
|
+
(_a = this.sliderContainer) === null || _a === void 0 ? void 0 : _a.setPointerCapture(e.pointerId);
|
|
40
|
+
};
|
|
41
|
+
this.onPointerMove = (e) => {
|
|
42
|
+
if (!this.isDragging)
|
|
43
|
+
return;
|
|
44
|
+
this.currentTranslate = this.baseTranslate + (e.clientX - this.startX);
|
|
45
|
+
this.setSliderPosition(this.currentTranslate);
|
|
46
|
+
};
|
|
47
|
+
this.onPointerUp = (e) => {
|
|
48
|
+
var _a;
|
|
49
|
+
if (!this.isDragging)
|
|
50
|
+
return;
|
|
51
|
+
this.isDragging = false;
|
|
52
|
+
(_a = this.sliderContainer) === null || _a === void 0 ? void 0 : _a.releasePointerCapture(e.pointerId);
|
|
53
|
+
const moved = this.currentTranslate - this.getBaseTranslate();
|
|
54
|
+
const threshold = 50;
|
|
55
|
+
if (moved < -threshold)
|
|
56
|
+
this.next();
|
|
57
|
+
else if (moved > threshold)
|
|
58
|
+
this.prev();
|
|
59
|
+
else
|
|
60
|
+
this.setPositionByIndex();
|
|
61
|
+
};
|
|
62
|
+
this.mbSource = undefined;
|
|
63
|
+
this.clientStyling = undefined;
|
|
64
|
+
this.clientStylingUrl = undefined;
|
|
65
|
+
this.translationUrl = '';
|
|
66
|
+
this.language = 'en';
|
|
67
|
+
this.isMobile = false;
|
|
68
|
+
this.challenges = undefined;
|
|
69
|
+
this.initialProgressId = '';
|
|
70
|
+
this.activeTabIndex = '';
|
|
71
|
+
this.currentIndex = null;
|
|
72
|
+
this.slideWidth = 0;
|
|
73
|
+
this.slideHeight = 0;
|
|
74
|
+
this.isOneSlide = false;
|
|
75
|
+
}
|
|
76
|
+
handleClientStylingChange(newValue, oldValue) {
|
|
77
|
+
if (newValue != oldValue) {
|
|
78
|
+
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
handleClientStylingUrlChange(newValue, oldValue) {
|
|
82
|
+
if (newValue != oldValue) {
|
|
83
|
+
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
handleMbSourceChange(newValue, oldValue) {
|
|
87
|
+
if (newValue != oldValue) {
|
|
88
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
onCurrentIndexChange(newValue, oldValue) {
|
|
92
|
+
if (oldValue !== null && newValue !== oldValue && newValue > 0) {
|
|
93
|
+
const activeChallenge = this.challenges[newValue - 1];
|
|
94
|
+
this.activeChallengeChange.emit(activeChallenge === null || activeChallenge === void 0 ? void 0 : activeChallenge.Id);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
onChallengesChange(newValue) {
|
|
98
|
+
this.isOneSlide = newValue.length === 1;
|
|
99
|
+
}
|
|
100
|
+
onInitialProgressIdChange(newValue, oldValue) {
|
|
101
|
+
if (newValue != oldValue) {
|
|
102
|
+
this.updateCurrentIndex();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
componentWillLoad() {
|
|
106
|
+
if (this.translationUrl) {
|
|
107
|
+
resolveTranslationUrl(this.translationUrl);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
componentDidLoad() {
|
|
111
|
+
var _a;
|
|
112
|
+
this.isOneSlide = ((_a = this.challenges) === null || _a === void 0 ? void 0 : _a.length) === 1;
|
|
113
|
+
this.resizeObserver = new ResizeObserver(([entry]) => {
|
|
114
|
+
this.slideWidth = Math.round(entry.contentRect.width * this.slideWidthToContainer);
|
|
115
|
+
this.slideHeight = Math.round(entry.contentRect.width * this.slideHeightToContainer);
|
|
116
|
+
if (!this.isOneSlide) {
|
|
117
|
+
this.setPositionByIndex();
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
if (this.stylingContainer) {
|
|
121
|
+
if (this.mbSource)
|
|
122
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
123
|
+
if (this.clientStyling)
|
|
124
|
+
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
125
|
+
if (this.clientStylingUrl)
|
|
126
|
+
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
127
|
+
this.resizeObserver.observe(this.stylingContainer);
|
|
128
|
+
}
|
|
129
|
+
this.updateCurrentIndex();
|
|
130
|
+
}
|
|
131
|
+
disconnectedCallback() {
|
|
132
|
+
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
133
|
+
this.resizeObserver && this.resizeObserver.disconnect();
|
|
134
|
+
}
|
|
135
|
+
updateCurrentIndex() {
|
|
136
|
+
if (this.isOneSlide) {
|
|
137
|
+
this.currentIndex = 0;
|
|
138
|
+
this.setSliderPosition(0);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
requestAnimationFrame(() => {
|
|
142
|
+
var _a;
|
|
143
|
+
const index = ((_a = this.challenges) === null || _a === void 0 ? void 0 : _a.findIndex((challenge) => (challenge === null || challenge === void 0 ? void 0 : challenge.Id) === this.initialProgressId)) || 0;
|
|
144
|
+
this.currentIndex = index + 1;
|
|
145
|
+
this.setPositionByIndex(false);
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
setSliderPosition(value) {
|
|
150
|
+
if (!this.sliderContainer)
|
|
151
|
+
return;
|
|
152
|
+
this.sliderContainer.style.transform = `translateX(${value}px)`;
|
|
153
|
+
}
|
|
154
|
+
getCarouselItems() {
|
|
155
|
+
const items = this.challenges;
|
|
156
|
+
if (items.length <= 1)
|
|
157
|
+
return items;
|
|
158
|
+
return [items[items.length - 1], ...items, items[0]];
|
|
159
|
+
}
|
|
160
|
+
scheduleReset(index) {
|
|
161
|
+
if (!this.sliderContainer)
|
|
162
|
+
return;
|
|
163
|
+
requestAnimationFrame(() => {
|
|
164
|
+
requestAnimationFrame(() => {
|
|
165
|
+
const el = this.sliderContainer;
|
|
166
|
+
el.style.transition = 'none';
|
|
167
|
+
this.currentIndex = index;
|
|
168
|
+
this.setPositionByIndex(false);
|
|
169
|
+
requestAnimationFrame(() => {
|
|
170
|
+
el.style.transition = '';
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
setPositionByIndex(withTransition = true) {
|
|
176
|
+
if (!this.sliderContainer)
|
|
177
|
+
return;
|
|
178
|
+
const gap = this.slideGap;
|
|
179
|
+
const offset = (this.sliderContainer.clientWidth - this.slideWidth) / 2;
|
|
180
|
+
this.currentTranslate = -(this.slideWidth + gap) * this.currentIndex + offset;
|
|
181
|
+
if (!withTransition) {
|
|
182
|
+
this.disableTransition();
|
|
183
|
+
}
|
|
184
|
+
this.setSliderPosition(this.currentTranslate);
|
|
185
|
+
}
|
|
186
|
+
getBaseTranslate() {
|
|
187
|
+
var _a, _b;
|
|
188
|
+
const slide = (_a = this.sliderContainer) === null || _a === void 0 ? void 0 : _a.querySelector('.challenges__slide');
|
|
189
|
+
const wrapper = (_b = this.sliderContainer) === null || _b === void 0 ? void 0 : _b.parentElement;
|
|
190
|
+
if (!slide || !wrapper)
|
|
191
|
+
return 0;
|
|
192
|
+
const slideWidth = slide.clientWidth;
|
|
193
|
+
const gap = this.slideGap;
|
|
194
|
+
const offset = (wrapper.clientWidth - slideWidth) / 2;
|
|
195
|
+
return -(slideWidth + gap) * this.currentIndex + offset;
|
|
196
|
+
}
|
|
197
|
+
disableTransition() {
|
|
198
|
+
if (!this.sliderContainer)
|
|
199
|
+
return;
|
|
200
|
+
this.sliderContainer.style.transition = 'none';
|
|
201
|
+
requestAnimationFrame(() => {
|
|
202
|
+
this.sliderContainer.style.transition = '';
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
goToSlide(index) {
|
|
206
|
+
this.currentIndex = index + 1;
|
|
207
|
+
this.setPositionByIndex();
|
|
208
|
+
}
|
|
209
|
+
getRealIndex() {
|
|
210
|
+
const len = this.challenges.length;
|
|
211
|
+
if (this.currentIndex === 0)
|
|
212
|
+
return len - 1;
|
|
213
|
+
if (this.currentIndex === len + 1)
|
|
214
|
+
return 0;
|
|
215
|
+
return this.currentIndex - 1;
|
|
216
|
+
}
|
|
217
|
+
render() {
|
|
218
|
+
return (h("div", { key: '25e34524b9a1fb6fcd4b164f5f3d58a58173ed09', class: { 'slider-container': true, mobile: this.isMobile, 'one-slide': this.isOneSlide }, ref: (el) => (this.stylingContainer = el) }, h("div", { key: '1f77218efd7201eb0de40405d7128168d5bb2a64', class: "challenges__slider-wrapper", onPointerDown: this.onPointerDown, onPointerMove: this.onPointerMove, onPointerUp: this.onPointerUp, onPointerLeave: this.onPointerUp }, h("div", { key: '623e0d69197edea0a4a01a670bc678e2c99af735', class: "challenges__slider", ref: (el) => (this.sliderContainer = el) }, this.getCarouselItems().map((item, index, arr) => (h("casino-challenges-overlay-card", { challenge: item, index: index, arrLength: arr.length, currentIndex: this.currentIndex, slideWidth: this.slideWidth, slideHeight: this.slideHeight }))))), this.challenges.length > 1 && (h("div", { key: 'ffc80e15f608761c6b830dd6f8ed19ebf7a2498e' }, h("button", { key: '0403fb4615605c33ef596c74ae2427b5e823b7d9', class: "action-button action-button--prev", onClick: this.prev }, h("img", { key: 'de3536ec00f15de6240d3c7da032b9584fffbc92', src: leftArrow, alt: "" })), h("button", { key: '84cc6967ded946264bde8db938c8e5541ace145c', class: "action-button action-button--next", onClick: this.next }, h("img", { key: 'f6e8d44662f3ca55866001d90d41f66c4a5f6f04', src: rightArrow, alt: "" })), h("div", { key: '25124a8bb6d0fc72086e69e20b6fc2f41986999e', class: "challenges__slider-dots" }, this.challenges.map((_, i) => (h("span", { class: {
|
|
219
|
+
'challenges__slider-dot': true,
|
|
220
|
+
active: i === this.getRealIndex()
|
|
221
|
+
}, onClick: () => {
|
|
222
|
+
this.goToSlide(i);
|
|
223
|
+
} }))))))));
|
|
224
|
+
}
|
|
225
|
+
static get is() { return "casino-challenges-overlay-slider"; }
|
|
226
|
+
static get encapsulation() { return "shadow"; }
|
|
227
|
+
static get originalStyleUrls() {
|
|
228
|
+
return {
|
|
229
|
+
"$": ["casino-challenges-overlay-slider.scss"]
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
static get styleUrls() {
|
|
233
|
+
return {
|
|
234
|
+
"$": ["casino-challenges-overlay-slider.css"]
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
static get properties() {
|
|
238
|
+
return {
|
|
239
|
+
"mbSource": {
|
|
240
|
+
"type": "string",
|
|
241
|
+
"mutable": false,
|
|
242
|
+
"complexType": {
|
|
243
|
+
"original": "string",
|
|
244
|
+
"resolved": "string",
|
|
245
|
+
"references": {}
|
|
246
|
+
},
|
|
247
|
+
"required": false,
|
|
248
|
+
"optional": false,
|
|
249
|
+
"docs": {
|
|
250
|
+
"tags": [],
|
|
251
|
+
"text": ""
|
|
252
|
+
},
|
|
253
|
+
"attribute": "mb-source",
|
|
254
|
+
"reflect": true
|
|
255
|
+
},
|
|
256
|
+
"clientStyling": {
|
|
257
|
+
"type": "string",
|
|
258
|
+
"mutable": false,
|
|
259
|
+
"complexType": {
|
|
260
|
+
"original": "string",
|
|
261
|
+
"resolved": "string",
|
|
262
|
+
"references": {}
|
|
263
|
+
},
|
|
264
|
+
"required": false,
|
|
265
|
+
"optional": false,
|
|
266
|
+
"docs": {
|
|
267
|
+
"tags": [],
|
|
268
|
+
"text": ""
|
|
269
|
+
},
|
|
270
|
+
"attribute": "client-styling",
|
|
271
|
+
"reflect": true
|
|
272
|
+
},
|
|
273
|
+
"clientStylingUrl": {
|
|
274
|
+
"type": "string",
|
|
275
|
+
"mutable": false,
|
|
276
|
+
"complexType": {
|
|
277
|
+
"original": "string",
|
|
278
|
+
"resolved": "string",
|
|
279
|
+
"references": {}
|
|
280
|
+
},
|
|
281
|
+
"required": false,
|
|
282
|
+
"optional": false,
|
|
283
|
+
"docs": {
|
|
284
|
+
"tags": [],
|
|
285
|
+
"text": ""
|
|
286
|
+
},
|
|
287
|
+
"attribute": "client-styling-url",
|
|
288
|
+
"reflect": true
|
|
289
|
+
},
|
|
290
|
+
"translationUrl": {
|
|
291
|
+
"type": "string",
|
|
292
|
+
"mutable": false,
|
|
293
|
+
"complexType": {
|
|
294
|
+
"original": "string",
|
|
295
|
+
"resolved": "string",
|
|
296
|
+
"references": {}
|
|
297
|
+
},
|
|
298
|
+
"required": false,
|
|
299
|
+
"optional": false,
|
|
300
|
+
"docs": {
|
|
301
|
+
"tags": [],
|
|
302
|
+
"text": ""
|
|
303
|
+
},
|
|
304
|
+
"attribute": "translation-url",
|
|
305
|
+
"reflect": true,
|
|
306
|
+
"defaultValue": "''"
|
|
307
|
+
},
|
|
308
|
+
"language": {
|
|
309
|
+
"type": "string",
|
|
310
|
+
"mutable": false,
|
|
311
|
+
"complexType": {
|
|
312
|
+
"original": "string",
|
|
313
|
+
"resolved": "string",
|
|
314
|
+
"references": {}
|
|
315
|
+
},
|
|
316
|
+
"required": false,
|
|
317
|
+
"optional": false,
|
|
318
|
+
"docs": {
|
|
319
|
+
"tags": [],
|
|
320
|
+
"text": ""
|
|
321
|
+
},
|
|
322
|
+
"attribute": "language",
|
|
323
|
+
"reflect": true,
|
|
324
|
+
"defaultValue": "'en'"
|
|
325
|
+
},
|
|
326
|
+
"isMobile": {
|
|
327
|
+
"type": "boolean",
|
|
328
|
+
"mutable": false,
|
|
329
|
+
"complexType": {
|
|
330
|
+
"original": "boolean",
|
|
331
|
+
"resolved": "boolean",
|
|
332
|
+
"references": {}
|
|
333
|
+
},
|
|
334
|
+
"required": false,
|
|
335
|
+
"optional": false,
|
|
336
|
+
"docs": {
|
|
337
|
+
"tags": [],
|
|
338
|
+
"text": ""
|
|
339
|
+
},
|
|
340
|
+
"attribute": "is-mobile",
|
|
341
|
+
"reflect": true,
|
|
342
|
+
"defaultValue": "false"
|
|
343
|
+
},
|
|
344
|
+
"challenges": {
|
|
345
|
+
"type": "unknown",
|
|
346
|
+
"mutable": false,
|
|
347
|
+
"complexType": {
|
|
348
|
+
"original": "IChallenge[]",
|
|
349
|
+
"resolved": "IChallenge[]",
|
|
350
|
+
"references": {
|
|
351
|
+
"IChallenge": {
|
|
352
|
+
"location": "import",
|
|
353
|
+
"path": "../../utils/types",
|
|
354
|
+
"id": "../../../../packages/stencil/casino-challenges-overlay-slider/src/utils/types.ts::IChallenge"
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
"required": false,
|
|
359
|
+
"optional": false,
|
|
360
|
+
"docs": {
|
|
361
|
+
"tags": [],
|
|
362
|
+
"text": ""
|
|
363
|
+
}
|
|
364
|
+
},
|
|
365
|
+
"initialProgressId": {
|
|
366
|
+
"type": "string",
|
|
367
|
+
"mutable": false,
|
|
368
|
+
"complexType": {
|
|
369
|
+
"original": "string",
|
|
370
|
+
"resolved": "string",
|
|
371
|
+
"references": {}
|
|
372
|
+
},
|
|
373
|
+
"required": false,
|
|
374
|
+
"optional": false,
|
|
375
|
+
"docs": {
|
|
376
|
+
"tags": [],
|
|
377
|
+
"text": ""
|
|
378
|
+
},
|
|
379
|
+
"attribute": "initial-progress-id",
|
|
380
|
+
"reflect": false,
|
|
381
|
+
"defaultValue": "''"
|
|
382
|
+
},
|
|
383
|
+
"activeTabIndex": {
|
|
384
|
+
"type": "string",
|
|
385
|
+
"mutable": false,
|
|
386
|
+
"complexType": {
|
|
387
|
+
"original": "string",
|
|
388
|
+
"resolved": "string",
|
|
389
|
+
"references": {}
|
|
390
|
+
},
|
|
391
|
+
"required": false,
|
|
392
|
+
"optional": false,
|
|
393
|
+
"docs": {
|
|
394
|
+
"tags": [],
|
|
395
|
+
"text": ""
|
|
396
|
+
},
|
|
397
|
+
"attribute": "active-tab-index",
|
|
398
|
+
"reflect": false,
|
|
399
|
+
"defaultValue": "''"
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
static get states() {
|
|
404
|
+
return {
|
|
405
|
+
"currentIndex": {},
|
|
406
|
+
"slideWidth": {},
|
|
407
|
+
"slideHeight": {},
|
|
408
|
+
"isOneSlide": {}
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
static get events() {
|
|
412
|
+
return [{
|
|
413
|
+
"method": "activeChallengeChange",
|
|
414
|
+
"name": "activeChallengeChange",
|
|
415
|
+
"bubbles": true,
|
|
416
|
+
"cancelable": true,
|
|
417
|
+
"composed": true,
|
|
418
|
+
"docs": {
|
|
419
|
+
"tags": [],
|
|
420
|
+
"text": ""
|
|
421
|
+
},
|
|
422
|
+
"complexType": {
|
|
423
|
+
"original": "any",
|
|
424
|
+
"resolved": "any",
|
|
425
|
+
"references": {}
|
|
426
|
+
}
|
|
427
|
+
}];
|
|
428
|
+
}
|
|
429
|
+
static get watchers() {
|
|
430
|
+
return [{
|
|
431
|
+
"propName": "clientStyling",
|
|
432
|
+
"methodName": "handleClientStylingChange"
|
|
433
|
+
}, {
|
|
434
|
+
"propName": "clientStylingUrl",
|
|
435
|
+
"methodName": "handleClientStylingUrlChange"
|
|
436
|
+
}, {
|
|
437
|
+
"propName": "mbSource",
|
|
438
|
+
"methodName": "handleMbSourceChange"
|
|
439
|
+
}, {
|
|
440
|
+
"propName": "currentIndex",
|
|
441
|
+
"methodName": "onCurrentIndexChange"
|
|
442
|
+
}, {
|
|
443
|
+
"propName": "challenges",
|
|
444
|
+
"methodName": "onChallengesChange"
|
|
445
|
+
}, {
|
|
446
|
+
"propName": "initialProgressId",
|
|
447
|
+
"methodName": "onInitialProgressIdChange"
|
|
448
|
+
}];
|
|
449
|
+
}
|
|
450
|
+
}
|