@iris.interactive/handcook 7.0.10 → 7.1.0-beta.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/README.md +1 -1
- package/package.json +1 -1
- package/public/scripts/components/collapse/collapse.component.js +9 -1
- package/public/scripts/components/slider/slider.component.js +10 -1
- package/public/scripts/components/tooltip/tooltip.component.js +2 -2
- package/public/styles/scss/_variables.scss +4 -0
- package/public/styles/scss/mixins/_mixin-style.scss +4 -8
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Welcome to HandCook 👨🍳
|
|
2
|
-

|
|
3
3
|

|
|
4
4
|
[](#)
|
|
5
5
|
[](https://twitter.com/captain\_iris)
|
package/package.json
CHANGED
|
@@ -39,9 +39,15 @@ export class HcCollapse {
|
|
|
39
39
|
});
|
|
40
40
|
collapseList.map(function (collapse) {
|
|
41
41
|
document.querySelectorAll(`[data-hc-collapse-trigger="${collapse._element.getAttribute("data-hc-collapse")}"]`).forEach(trigger => {
|
|
42
|
-
|
|
42
|
+
const handleTriggerAction = (e) => {
|
|
43
43
|
e.preventDefault();
|
|
44
44
|
collapse.toggle();
|
|
45
|
+
};
|
|
46
|
+
trigger.addEventListener('click', handleTriggerAction);
|
|
47
|
+
trigger.addEventListener('keydown', (e) => {
|
|
48
|
+
if (e.which == 13 ) {
|
|
49
|
+
handleTriggerAction(e);
|
|
50
|
+
}
|
|
45
51
|
});
|
|
46
52
|
});
|
|
47
53
|
});
|
|
@@ -52,6 +58,7 @@ export class HcCollapse {
|
|
|
52
58
|
if (triggerEl.classList.contains('active')) {
|
|
53
59
|
triggerEl.classList.remove('active');
|
|
54
60
|
}
|
|
61
|
+
triggerEl.setAttribute('aria-expanded', 'false');
|
|
55
62
|
});
|
|
56
63
|
trigger.dispatchEvent(this.hideEvent);
|
|
57
64
|
});
|
|
@@ -63,6 +70,7 @@ export class HcCollapse {
|
|
|
63
70
|
if (!triggerEl.classList.contains('active')) {
|
|
64
71
|
triggerEl.classList.add('active');
|
|
65
72
|
}
|
|
73
|
+
triggerEl.setAttribute('aria-expanded', 'true');
|
|
66
74
|
});
|
|
67
75
|
trigger.dispatchEvent(this.showEvent);
|
|
68
76
|
});
|
|
@@ -198,6 +198,7 @@ export class HcSlider {
|
|
|
198
198
|
const items = [].slice.call(this.slider.children);
|
|
199
199
|
items.forEach(item => {
|
|
200
200
|
item.classList.add('swiper-slide');
|
|
201
|
+
item.setAttribute('aria-roledescription', 'slide');
|
|
201
202
|
});
|
|
202
203
|
|
|
203
204
|
// On ajoute la classe swiper a notre slider,
|
|
@@ -237,7 +238,7 @@ export class HcSlider {
|
|
|
237
238
|
buttonsWrapper.appendChild(buttonPrev);
|
|
238
239
|
buttonsWrapper.appendChild(buttonNext);
|
|
239
240
|
|
|
240
|
-
this.slider.
|
|
241
|
+
this.slider.prepend(buttonsWrapper);
|
|
241
242
|
} else {
|
|
242
243
|
if (!this.slider.hasAttribute('data-hc-slider-arrow-prev') && prevEl.length === 0) {
|
|
243
244
|
const buttonPrev = document.createElement("div");
|
|
@@ -266,6 +267,14 @@ export class HcSlider {
|
|
|
266
267
|
grabCursor: true,
|
|
267
268
|
loop: false,
|
|
268
269
|
watchSlidesProgress: true,
|
|
270
|
+
a11y: {
|
|
271
|
+
prevSlideMessage: IRISCollectionTheme.translate.slider.prevSlideMessage ?? 'Slide précédente',
|
|
272
|
+
nextSlideMessage: IRISCollectionTheme.translate.slider.nextSlideMessage ?? 'Slide suivante',
|
|
273
|
+
firstSlideMessage: IRISCollectionTheme.translate.slider.firstSlideMessage ?? 'Vous êtes sur la première slide',
|
|
274
|
+
lastSlideMessage: IRISCollectionTheme.translate.slider.lastSlideMessage ?? 'Vous avez atteint la dernière slide',
|
|
275
|
+
paginationBulletMessage: IRISCollectionTheme.translate.slider.paginationBulletMessage ?? 'Aller sur la slide {{index}}',
|
|
276
|
+
slideLabelMessage: IRISCollectionTheme.translate.slider.slideLabelMessage ?? 'Slide {{index}} sur {{slidesLength}}',
|
|
277
|
+
},
|
|
269
278
|
on: {
|
|
270
279
|
init: (swiper) => {
|
|
271
280
|
|
|
@@ -40,14 +40,14 @@ export class HcTooltip {
|
|
|
40
40
|
document.querySelectorAll(elements).forEach(element => {
|
|
41
41
|
let options = {};
|
|
42
42
|
Object.assign(options, this.defaultOptions, overrideOptions);
|
|
43
|
-
options.trigger = options.trigger != '' ? options.trigger : (element.hasAttribute(TooltipEnum.attrPopover) ? "click" : "mouseenter");
|
|
43
|
+
options.trigger = options.trigger != '' ? options.trigger : (element.hasAttribute(TooltipEnum.attrPopover) ? "click focus" : "mouseenter focus");
|
|
44
44
|
options.content = options.content != '' ? options.content : (element.hasAttribute(TooltipEnum.attrContent) ? element.getAttribute(TooltipEnum.attrContent) : '');
|
|
45
45
|
options.placement = options.placement != '' ? options.placement : (element.hasAttribute(TooltipEnum.attrPlacement) ? element.getAttribute(TooltipEnum.attrPlacement) : 'bottom');
|
|
46
46
|
options.interactive = options.interactive != '' ? options.interactive : (element.hasAttribute(TooltipEnum.attrInteractive) ? element.getAttribute(TooltipEnum.attrInteractive) : false);
|
|
47
47
|
let backgroundColor = element.hasAttribute(TooltipEnum.attrBackgroundColor) ? element.getAttribute(TooltipEnum.attrBackgroundColor) : '';
|
|
48
48
|
let color = element.hasAttribute(TooltipEnum.attrColor) ? element.getAttribute(TooltipEnum.attrColor) : '';
|
|
49
49
|
let fontSize = element.hasAttribute(TooltipEnum.attrFontSize) ? element.getAttribute(TooltipEnum.attrFontSize) : '';
|
|
50
|
-
if (options.trigger
|
|
50
|
+
if (options.trigger.indexOf('click') !== -1) {
|
|
51
51
|
element.addEventListener('click', (e) => {
|
|
52
52
|
e.preventDefault();
|
|
53
53
|
});
|
|
@@ -169,9 +169,7 @@
|
|
|
169
169
|
@include transition;
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
&:visited
|
|
173
|
-
&:focus,
|
|
174
|
-
&:focus-within {
|
|
172
|
+
&:visited {
|
|
175
173
|
color: $button-color;
|
|
176
174
|
background-color: $button-background-color;
|
|
177
175
|
background-image: $button-background-image;
|
|
@@ -180,7 +178,7 @@
|
|
|
180
178
|
border: $button-border;
|
|
181
179
|
}
|
|
182
180
|
|
|
183
|
-
@include hover {
|
|
181
|
+
@include hover-focus {
|
|
184
182
|
color: $button-color-hover;
|
|
185
183
|
background-color: $button-background-color-hover;
|
|
186
184
|
border: $button-border-hover;
|
|
@@ -228,9 +226,7 @@
|
|
|
228
226
|
@include transition;
|
|
229
227
|
}
|
|
230
228
|
|
|
231
|
-
&:visited
|
|
232
|
-
&:focus,
|
|
233
|
-
&:focus-within {
|
|
229
|
+
&:visited {
|
|
234
230
|
color: $secondary-button-color;
|
|
235
231
|
background-color: $secondary-button-background-color;
|
|
236
232
|
background-image: $secondary-button-background-image;
|
|
@@ -239,7 +235,7 @@
|
|
|
239
235
|
border: $secondary-button-border;
|
|
240
236
|
}
|
|
241
237
|
|
|
242
|
-
@include hover {
|
|
238
|
+
@include hover-focus {
|
|
243
239
|
color: $secondary-button-color-hover;
|
|
244
240
|
background-color: $secondary-button-background-color-hover;
|
|
245
241
|
border: $secondary-button-border-hover;
|