@iris.interactive/handcook 2.6.5 → 2.6.8
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/package.json
CHANGED
|
@@ -20,20 +20,18 @@ import './modal.component.scss';
|
|
|
20
20
|
|
|
21
21
|
export class HcModal {
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
src: '',
|
|
25
|
-
type: 'inline'
|
|
26
|
-
}
|
|
23
|
+
options = {};
|
|
27
24
|
|
|
28
25
|
constructor(elements = ElementEnum.modal, overrideOptions = {}) {
|
|
29
|
-
let options = {};
|
|
30
|
-
Object.assign(options, this.defaultOptions, overrideOptions);
|
|
31
26
|
document.querySelectorAll(elements).forEach(element => {
|
|
32
27
|
Fancybox.bind(element);
|
|
33
28
|
element.addEventListener('click', (e) => {
|
|
34
29
|
e.preventDefault();
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
this.initOptions();
|
|
31
|
+
Object.assign(this.options, overrideOptions);
|
|
32
|
+
this.options.src = this.options.src != '' ? this.options.src : (e.currentTarget.hasAttribute('href') ? e.currentTarget.getAttribute('href') : (e.currentTarget.hasAttribute('data-hc-src') ? e.currentTarget.dataset.hcSrc : ''));
|
|
33
|
+
this.options.parentEl = this.options.parentEl !== null ? document.querySelector(this.options.parentEl) : (e.currentTarget.hasAttribute('data-hc-modal-parent') ? document.querySelector(e.currentTarget.getAttribute('data-hc-modal-parent')) : '');
|
|
34
|
+
Fancybox.show([this.options]);
|
|
37
35
|
});
|
|
38
36
|
});
|
|
39
37
|
}
|
|
@@ -45,6 +43,14 @@ export class HcModal {
|
|
|
45
43
|
static close(all) {
|
|
46
44
|
Fancybox.close(all);
|
|
47
45
|
}
|
|
46
|
+
|
|
47
|
+
initOptions() {
|
|
48
|
+
this.options = {
|
|
49
|
+
src: '',
|
|
50
|
+
type: 'inline',
|
|
51
|
+
parentEl: null
|
|
52
|
+
};
|
|
53
|
+
}
|
|
48
54
|
}
|
|
49
55
|
|
|
50
56
|
const hc_modal = function (trigger, options) {
|
|
@@ -38,22 +38,55 @@ export class HcSlider {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
setOptions() {
|
|
41
|
-
|
|
42
|
-
const attr = this.slider.getAttribute('data-hc-' + option);
|
|
43
|
-
if (attr !== null) {
|
|
44
|
-
if (typeof option === "boolean") {
|
|
45
|
-
this.options[option] = attr !== false;
|
|
46
|
-
} else {
|
|
47
|
-
this.options[option] = attr;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
const attr = this.slider.getAttribute('data-hc-autoplay');
|
|
41
|
+
const attr = this.slider.getAttribute('data-hc-slider-autoplay');
|
|
52
42
|
if (attr !== null) {
|
|
53
43
|
this.options['autoplay'] = {
|
|
54
44
|
delay: attr
|
|
55
45
|
}
|
|
56
46
|
}
|
|
47
|
+
|
|
48
|
+
const gap = this.slider.getAttribute('data-hc-slider-gap');
|
|
49
|
+
const slidesPerView = this.slider.getAttribute('data-hc-slider-slides-per-view');
|
|
50
|
+
if (gap !== null) {
|
|
51
|
+
this.options['spaceBetween'] = parseFloat(gap);
|
|
52
|
+
}
|
|
53
|
+
if (slidesPerView !== null) {
|
|
54
|
+
this.options['slidesPerView'] = parseFloat(slidesPerView);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const gapMedium = this.slider.getAttribute('data-hc-slider-gap-medium');
|
|
58
|
+
const slidesPerViewMedium = this.slider.getAttribute('data-hc-slider-slides-per-view-medium');
|
|
59
|
+
if (gapMedium !== null) {
|
|
60
|
+
this.options['breakpoints'][650]['spaceBetween'] = parseFloat(gapMedium);
|
|
61
|
+
}
|
|
62
|
+
if (slidesPerViewMedium !== null) {
|
|
63
|
+
this.options['breakpoints'][650]['slidesPerView'] = parseFloat(slidesPerViewMedium);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const gapLarge = this.slider.getAttribute('data-hc-slider-gap-large');
|
|
67
|
+
const slidesPerViewLarge = this.slider.getAttribute('data-hc-slider-slides-per-view-large');
|
|
68
|
+
if (gapLarge !== null) {
|
|
69
|
+
this.options['breakpoints']['1000']['spaceBetween'] = parseFloat(gapLarge);
|
|
70
|
+
}
|
|
71
|
+
if (slidesPerViewLarge !== null) {
|
|
72
|
+
this.options['breakpoints']['1000']['slidesPerView'] = parseFloat(slidesPerViewLarge);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const gapXlarge = this.slider.getAttribute('data-hc-slider-gap-xlarge');
|
|
76
|
+
const slidesPerViewXlarge = this.slider.getAttribute('data-hc-slider-slides-per-view-xlarge');
|
|
77
|
+
if (gapXlarge !== null) {
|
|
78
|
+
this.options['breakpoints']['1453']['spaceBetween'] = parseFloat(gapXlarge);
|
|
79
|
+
}
|
|
80
|
+
if (slidesPerViewXlarge !== null) {
|
|
81
|
+
this.options['breakpoints']['1453']['slidesPerView'] = parseFloat(slidesPerViewXlarge);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const freeMode = this.slider.getAttribute('data-hc-slider-free-mode');
|
|
85
|
+
if (freeMode !== null) {
|
|
86
|
+
this.options['freeMode'] = {
|
|
87
|
+
enabled: true
|
|
88
|
+
}
|
|
89
|
+
}
|
|
57
90
|
}
|
|
58
91
|
|
|
59
92
|
buildDom() {
|
|
@@ -66,15 +99,12 @@ export class HcSlider {
|
|
|
66
99
|
|
|
67
100
|
// On ajoute la classe swiper a notre slider,
|
|
68
101
|
// on crée la div wrapper et on insére les slider item dedans
|
|
69
|
-
this.slider.classList.add('swiper');
|
|
70
102
|
const wrapperElement = document.createElement("div");
|
|
71
103
|
wrapperElement.classList.add("swiper-wrapper");
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
items.forEach(item => {
|
|
75
|
-
wrapper.appendChild(item);
|
|
76
|
-
});
|
|
104
|
+
items.forEach(item => {
|
|
105
|
+
wrapperElement.appendChild(item);
|
|
77
106
|
});
|
|
107
|
+
this.slider.appendChild(wrapperElement);
|
|
78
108
|
|
|
79
109
|
// On ajout les différentes div utile en fonction des options passées
|
|
80
110
|
if (this.slider.hasAttribute('data-hc-slider-pagination')) {
|
|
@@ -114,7 +144,7 @@ export class HcSlider {
|
|
|
114
144
|
|
|
115
145
|
initOptions() {
|
|
116
146
|
this.options = {
|
|
117
|
-
slidesPerView:
|
|
147
|
+
slidesPerView: "auto",
|
|
118
148
|
pagination: false,
|
|
119
149
|
navigation: false,
|
|
120
150
|
mousewheel: {
|
|
@@ -145,6 +175,11 @@ export class HcSlider {
|
|
|
145
175
|
swiper.$el.find('.swiper-slide-next').addClass('hc-slider-slide-next');
|
|
146
176
|
swiper.$el.find('.swiper-slide-prev').addClass('hc-slider-slide-prev');
|
|
147
177
|
}
|
|
178
|
+
},
|
|
179
|
+
breakpoints: {
|
|
180
|
+
650: {},
|
|
181
|
+
1000: {},
|
|
182
|
+
1453: {},
|
|
148
183
|
}
|
|
149
184
|
};
|
|
150
185
|
}
|
|
@@ -89,6 +89,8 @@ $font-size-small: var(--iris--global--font-size-small);
|
|
|
89
89
|
$font-size-small--rem: var(--iris--global--font-size-small--rem);
|
|
90
90
|
$font-size-regular: $font-size;
|
|
91
91
|
$font-size-regular--rem: $font-size--rem;
|
|
92
|
+
$font-size-regular--small: var(--iris--global--font-size-regular--small);
|
|
93
|
+
$font-size-regular--small--rem: var(--iris--global--font-size-regular--small--rem);
|
|
92
94
|
$font-size-large: var(--iris--global--font-size-large);
|
|
93
95
|
$font-size-large--rem: var(--iris--global--font-size-large--rem);
|
|
94
96
|
$font-size-large--small: var(--iris--global--font-size-large--small);
|