@iris.interactive/handcook 2.3.11 → 2.5.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.
Files changed (26) hide show
  1. package/mix-manifest.json +7 -0
  2. package/package.json +10 -2
  3. package/public/index.html +390 -29
  4. package/public/scripts/components/collapse/collapse.component.css +50 -0
  5. package/public/scripts/components/collapse/collapse.component.js +66 -0
  6. package/public/scripts/components/collapse/collapse.component.scss +19 -0
  7. package/public/scripts/components/dropdown/dropdown.component.js +45 -0
  8. package/public/scripts/components/lazyload/lazyload.component.js +26 -0
  9. package/public/scripts/components/lightbox/lightbox.component.js +32 -0
  10. package/public/scripts/components/modal/modal.component.css +18 -0
  11. package/public/scripts/components/modal/modal.component.js +45 -0
  12. package/public/scripts/components/modal/modal.component.scss +20 -0
  13. package/public/scripts/components/slider/slider.component.js +123 -0
  14. package/public/scripts/components/smooth-scroll/smooth-scroll.component.js +64 -0
  15. package/public/scripts/components/tab/tab.component.css +20 -0
  16. package/public/scripts/components/tab/tab.component.js +46 -0
  17. package/public/scripts/components/tab/tab.component.scss +23 -0
  18. package/public/scripts/components/toggle/toggle.component.js +50 -0
  19. package/public/scripts/components/tooltip/tooltip.component.js +75 -0
  20. package/public/scripts/enumerators/element.enum.js +28 -0
  21. package/public/scripts/enumerators/tooltip.enum.js +21 -0
  22. package/public/scripts/index.js +21962 -65
  23. package/public/styles/scss/mixins/_mixin-font.scss +2 -2
  24. package/public/styles/scss/style.css +186 -0
  25. package/public/mix-manifest.json +0 -9
  26. package/public/scripts/SmoothScroll.js +0 -41
@@ -0,0 +1,26 @@
1
+ /*
2
+ * IRIS Interactive
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is no subject to a specific license
7
+ * but it belongs to the company IRIS Interactive.
8
+ * You can contact IRIS Interactive at the following
9
+ * address: contact@iris-interactive.fr
10
+ *
11
+ * @author Lucas ROCHE
12
+ * @date 22/02/2022 14:16
13
+ * @copyright Copyright (c) 2002-2022 IRIS Interactive, Inc. (http://www.iris-interactive.fr)
14
+ */
15
+
16
+
17
+ import LazyLoad from "vanilla-lazyload";
18
+
19
+ export const hc_lazyload = function() {
20
+ return new LazyLoad({
21
+ elements_selector: '[data-hc-src], [data-hc-bg], [data-hc-bg-hidpi]',
22
+ data_src: 'hc-src',
23
+ data_bg: 'hc-bg',
24
+ data_bg_hidpi: 'hc-bg-hidpi'
25
+ });
26
+ }
@@ -0,0 +1,32 @@
1
+ /*
2
+ * IRIS Interactive
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is no subject to a specific license
7
+ * but it belongs to the company IRIS Interactive.
8
+ * You can contact IRIS Interactive at the following
9
+ * address: contact@iris-interactive.fr
10
+ *
11
+ * @author Lucas ROCHE
12
+ * @date 21/02/2022 09:57
13
+ * @copyright Copyright (c) 2002-2022 IRIS Interactive, Inc. (http://www.iris-interactive.fr)
14
+ */
15
+
16
+ import {Fancybox} from "@fancyapps/ui";
17
+ import '@fancyapps/ui/dist/fancybox.css';
18
+ import ElementEnum from "../../enumerators/element.enum";
19
+
20
+ class HcLightbox {
21
+
22
+ instance = [];
23
+
24
+ constructor(elements = ElementEnum.lightbox) {
25
+ Fancybox.bind(elements);
26
+ this.instance = Fancybox.getInstance();
27
+ }
28
+ }
29
+
30
+ export const hc_lightbox = function (trigger, options) {
31
+ return new HcLightbox(trigger, options);
32
+ }
@@ -0,0 +1,18 @@
1
+ /*
2
+ * IRIS Interactive
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is no subject to a specific license
7
+ * but it belongs to the company IRIS Interactive.
8
+ * You can contact IRIS Interactive at the following
9
+ * address: contact@iris-interactive.fr
10
+ *
11
+ * @author Lucas ROCHE
12
+ * @date 01/02/2022 11:21
13
+ * @copyright Copyright (c) 2002-2022 IRIS Interactive, Inc. (http://www.iris-interactive.fr)
14
+ */
15
+ .hc-modal {
16
+ display: none;
17
+ max-width: 500px;
18
+ }
@@ -0,0 +1,45 @@
1
+ /*
2
+ * IRIS Interactive
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is no subject to a specific license
7
+ * but it belongs to the company IRIS Interactive.
8
+ * You can contact IRIS Interactive at the following
9
+ * address: contact@iris-interactive.fr
10
+ *
11
+ * @author Lucas ROCHE
12
+ * @date 01/02/2022 11:01
13
+ * @copyright Copyright (c) 2002-2022 IRIS Interactive, Inc. (http://www.iris-interactive.fr)
14
+ */
15
+
16
+ import ElementEnum from "../../enumerators/element.enum";
17
+ import {Fancybox} from "@fancyapps/ui";
18
+ import '@fancyapps/ui/dist/fancybox.css';
19
+ import './modal.component.css';
20
+
21
+ class HcModal {
22
+
23
+ instance = [];
24
+ defaultOptions = {
25
+ src: '',
26
+ type: 'inline'
27
+ }
28
+
29
+ constructor(elements = ElementEnum.modal, overrideOptions = {}) {
30
+ let options = {};
31
+ Object.assign(options, this.defaultOptions, overrideOptions);
32
+ document.querySelectorAll(elements).forEach(element => {
33
+ options.src = options.src != '' ? options.src : (element.hasAttribute('href') ? element.getAttribute('href') : (element.hasAttribute('data-hc-src') ? element.dataset.hcSrc : ''));
34
+ this.instance.push(Fancybox.bind(element));
35
+ element.addEventListener('click', (e) => {
36
+ e.preventDefault();
37
+ Fancybox.show([options]);
38
+ });
39
+ });
40
+ }
41
+ }
42
+
43
+ export const hc_modal = function (trigger, options) {
44
+ return new HcModal(trigger, options);
45
+ }
@@ -0,0 +1,20 @@
1
+ /*
2
+ * IRIS Interactive
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is no subject to a specific license
7
+ * but it belongs to the company IRIS Interactive.
8
+ * You can contact IRIS Interactive at the following
9
+ * address: contact@iris-interactive.fr
10
+ *
11
+ * @author Lucas ROCHE
12
+ * @date 01/02/2022 11:21
13
+ * @copyright Copyright (c) 2002-2022 IRIS Interactive, Inc. (http://www.iris-interactive.fr)
14
+ */
15
+
16
+
17
+ .hc-modal {
18
+ display: none;
19
+ max-width: 500px;
20
+ }
@@ -0,0 +1,123 @@
1
+ /*
2
+ * IRIS Interactive
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is no subject to a specific license
7
+ * but it belongs to the company IRIS Interactive.
8
+ * You can contact IRIS Interactive at the following
9
+ * address: contact@iris-interactive.fr
10
+ *
11
+ * @author Lucas ROCHE
12
+ * @date 22/02/2022 17:21
13
+ * @copyright Copyright (c) 2002-2022 IRIS Interactive, Inc. (http://www.iris-interactive.fr)
14
+ */
15
+
16
+ import ElementEnum from "../../enumerators/element.enum";
17
+ import Swiper from "swiper/bundle";
18
+ import "swiper/css";
19
+
20
+ class HcSlider {
21
+
22
+ slider;
23
+
24
+ // Options
25
+ options = {};
26
+
27
+ constructor(elements = ElementEnum.slider) {
28
+ this.initOptions();
29
+ document.querySelectorAll(elements).forEach(element => {
30
+ this.slider = element;
31
+ this.setOptions();
32
+ this.buildDom();
33
+ new Swiper(element, this.options);
34
+ this.initOptions();
35
+ });
36
+ }
37
+
38
+ setOptions() {
39
+ for (const option in this.options) {
40
+ const attr = this.slider.getAttribute('data-hc-' + option);
41
+ if (attr !== null) {
42
+ if (typeof option === "boolean") {
43
+ this.options[option] = attr !== false;
44
+ } else {
45
+ this.options[option] = attr;
46
+ }
47
+ }
48
+ }
49
+ const attr = this.slider.getAttribute('data-hc-autoplay');
50
+ if (attr !== null) {
51
+ this.options['autoplay'] = {
52
+ delay: attr
53
+ }
54
+ }
55
+ }
56
+
57
+ buildDom() {
58
+ // On recupère les slide items (element de DOM enfant de premier niveau)
59
+ // et on leur ajoute la classe des slide item
60
+ const items = [].slice.call(this.slider.children);
61
+ items.forEach(item => {
62
+ item.classList.add('swiper-slide');
63
+ });
64
+
65
+ // On ajoute la classe swiper a notre slider,
66
+ // on crée la div wrapper et on insére les slider item dedans
67
+ this.slider.classList.add('swiper');
68
+ const wrapperElement = document.createElement("div");
69
+ wrapperElement.classList.add( "swiper-wrapper" );
70
+ this.slider.appendChild(wrapperElement);
71
+ this.slider.querySelectorAll('.swiper-wrapper').forEach(wrapper => {
72
+ items.forEach(item => {
73
+ wrapper.appendChild(item);
74
+ });
75
+ });
76
+
77
+ // On ajout les différentes div utile en fonction des options passées
78
+ if (this.slider.hasAttribute('data-hc-slider-pagination')) {
79
+
80
+ const paginationElement = document.createElement("div");
81
+ paginationElement.classList.add("swiper-pagination");
82
+ this.slider.appendChild(paginationElement);
83
+
84
+ this.options['pagination'] = {
85
+ el: '.swiper-pagination',
86
+ type: 'bullets',
87
+ clickable: true
88
+ };
89
+ }
90
+ if (this.slider.hasAttribute('data-hc-slider-arrows')) {
91
+
92
+ const buttonPrev = document.createElement("div");
93
+ buttonPrev.classList.add("swiper-button-prev");
94
+ this.slider.appendChild(buttonPrev);
95
+
96
+ const buttonNext = document.createElement("div");
97
+ buttonNext.classList.add("swiper-button-next");
98
+ this.slider.appendChild(buttonNext);
99
+
100
+ this.options['navigation'] = {
101
+ nextEl: '.swiper-button-next',
102
+ prevEl: '.swiper-button-prev',
103
+ };
104
+ }
105
+ }
106
+
107
+ initOptions() {
108
+ this.options = {
109
+ slidesPerView: 'auto',
110
+ pagination: false,
111
+ navigation: false,
112
+ mousewheel: {
113
+ forceToAxis: true,
114
+ },
115
+ grabCursor: true,
116
+ loop: false
117
+ };
118
+ }
119
+ }
120
+
121
+ export const hc_slider = function (trigger) {
122
+ return new HcSlider(trigger);
123
+ }
@@ -0,0 +1,64 @@
1
+ /*
2
+ * IRIS Interactive
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is no subject to a specific license
7
+ * but it belongs to the company IRIS Interactive.
8
+ * You can contact IRIS Interactive at the following
9
+ * address: contact@iris-interactive.fr
10
+ *
11
+ * @author Lucas ROCHE
12
+ * @date 28/01/2022 14:27
13
+ * @copyright Copyright (c) 2002-2022 IRIS Interactive, Inc. (http://www.iris-interactive.fr)
14
+ */
15
+
16
+ import ElementEnum from "../../enumerators/element.enum";
17
+
18
+ class HcSmoothScroll {
19
+
20
+ constructor(triggerAttribute = ElementEnum.scrollSmooth, durationAnimation = 1000) {
21
+
22
+ document.addEventListener('click', (e) => {
23
+ if(e.target && e.target.hasAttribute(ElementEnum.scrollSmooth)) {
24
+ e.preventDefault();
25
+ const target = (e.target.getAttribute('href') != '') ? document.querySelector(e.target.getAttribute('href')) : document.querySelector(e.target.dataset.href);
26
+ const shift = (e.target.dataset.shift !== undefined) ? e.target.dataset.shift : 0;
27
+ const anim = requestAnimationFrame((timestamp) => {
28
+ const stamp = timestamp || new Date().getTime();
29
+ const start = stamp;
30
+
31
+ const startScrollOffset = window.pageYOffset;
32
+ const scrollEndElemTop = target.getBoundingClientRect().top - shift;
33
+
34
+ this.scrollToElem(start, stamp, durationAnimation, scrollEndElemTop, startScrollOffset);
35
+ })
36
+ }
37
+ });
38
+ }
39
+
40
+ easeInCubic(t) {
41
+ return t * t * t
42
+ }
43
+
44
+ scrollToElem(startTime, currentTime, duration, scrollEndElemTop, startScrollOffset) {
45
+ const runtime = currentTime - startTime;
46
+ let progress = runtime / duration;
47
+
48
+ progress = Math.min(progress, 1);
49
+
50
+ const ease = this.easeInCubic(progress);
51
+
52
+ window.scroll(0, startScrollOffset + (scrollEndElemTop * ease));
53
+ if (runtime < duration) {
54
+ requestAnimationFrame((timestamp) => {
55
+ const currentTime = timestamp || new Date().getTime();
56
+ this.scrollToElem(startTime, currentTime, duration, scrollEndElemTop, startScrollOffset);
57
+ })
58
+ }
59
+ }
60
+ }
61
+
62
+ export const hc_smooth_scroll = function(trigger, options) {
63
+ new HcSmoothScroll(trigger, options);
64
+ }
@@ -0,0 +1,20 @@
1
+ /*!
2
+ * IRIS Interactive
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is no subject to a specific license
7
+ * but it belongs to the company IRIS Interactive.
8
+ * You can contact IRIS Interactive at the following
9
+ * address: contact@iris-interactive.fr
10
+ *
11
+ * @author Lucas ROCHE
12
+ * @date 22/02/2022 14:57
13
+ * @copyright Copyright (c) 2002-2022 IRIS Interactive, Inc. (http://www.iris-interactive.fr)
14
+ */
15
+ [data-hc-tab-content] > [data-hc-tab-pane] {
16
+ display: none;
17
+ }
18
+ [data-hc-tab-content] > .active {
19
+ display: block;
20
+ }
@@ -0,0 +1,46 @@
1
+ /*
2
+ * IRIS Interactive
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is no subject to a specific license
7
+ * but it belongs to the company IRIS Interactive.
8
+ * You can contact IRIS Interactive at the following
9
+ * address: contact@iris-interactive.fr
10
+ *
11
+ * @author Lucas ROCHE
12
+ * @date 22/02/2022 14:34
13
+ * @copyright Copyright (c) 2002-2022 IRIS Interactive, Inc. (http://www.iris-interactive.fr)
14
+ */
15
+
16
+ import ElementEnum from "../../enumerators/element.enum";
17
+ import "./tab.component.css";
18
+ import Tab from "bootstrap/js/src/tab";
19
+
20
+ class HcTab {
21
+
22
+ constructor(elements = ElementEnum.tab) {
23
+ this.buildDOM();
24
+ const triggerTabList = [].slice.call(document.querySelectorAll(elements))
25
+ triggerTabList.forEach(function (triggerEl) {
26
+ const tabTrigger = new Tab(triggerEl);
27
+
28
+ triggerEl.addEventListener('click', function (event) {
29
+ event.preventDefault()
30
+ tabTrigger.show()
31
+ })
32
+ })
33
+ }
34
+
35
+ buildDOM() {
36
+ document.querySelectorAll("[data-hc-tab-wrapper]").forEach(wrapper => {
37
+ if (!wrapper.classList.contains("nav")) {
38
+ wrapper.classList.add("nav")
39
+ }
40
+ })
41
+ }
42
+ }
43
+
44
+ export const hc_tab = function (trigger) {
45
+ return new HcTab(trigger);
46
+ }
@@ -0,0 +1,23 @@
1
+ /*!
2
+ * IRIS Interactive
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is no subject to a specific license
7
+ * but it belongs to the company IRIS Interactive.
8
+ * You can contact IRIS Interactive at the following
9
+ * address: contact@iris-interactive.fr
10
+ *
11
+ * @author Lucas ROCHE
12
+ * @date 22/02/2022 14:57
13
+ * @copyright Copyright (c) 2002-2022 IRIS Interactive, Inc. (http://www.iris-interactive.fr)
14
+ */
15
+
16
+ [data-hc-tab-content] {
17
+ > [data-hc-tab-pane] {
18
+ display: none;
19
+ }
20
+ > .active {
21
+ display: block;
22
+ }
23
+ }
@@ -0,0 +1,50 @@
1
+ /*
2
+ * IRIS Interactive
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is no subject to a specific license
7
+ * but it belongs to the company IRIS Interactive.
8
+ * You can contact IRIS Interactive at the following
9
+ * address: contact@iris-interactive.fr
10
+ *
11
+ * @author Lucas ROCHE
12
+ * @date 22/02/2022 16:50
13
+ * @copyright Copyright (c) 2002-2022 IRIS Interactive, Inc. (http://www.iris-interactive.fr)
14
+ */
15
+
16
+
17
+ import ElementEnum from "../../enumerators/element.enum";
18
+
19
+ class HcToggle {
20
+
21
+ constructor(elements = ElementEnum.toggle) {
22
+ document.querySelectorAll(elements).forEach(element => {
23
+ element.addEventListener('click', (e) => {
24
+ e.preventDefault();
25
+ const attribute = e.currentTarget.dataset.hcToggleAttribute;
26
+ const value = e.currentTarget.dataset.hcToggleValue;
27
+ const targets = e.currentTarget.getAttribute("href") ? e.currentTarget.getAttribute("href") : e.currentTarget.dataset.hcToggleTarget;
28
+ document.querySelectorAll(targets).forEach(target => {
29
+ if(target.getAttribute(attribute) === value) {
30
+ if(attribute === "class"){
31
+ target.classList.remove(value);
32
+ } else {
33
+ target.removeAttribute(attribute);
34
+ }
35
+ } else {
36
+ if(attribute === "class"){
37
+ target.classList.add(value);
38
+ } else {
39
+ target.setAttribute(attribute, value);
40
+ }
41
+ }
42
+ });
43
+ });
44
+ });
45
+ }
46
+ }
47
+
48
+ export const hc_toggle = function (trigger) {
49
+ return new HcToggle(trigger);
50
+ }
@@ -0,0 +1,75 @@
1
+ /*
2
+ * IRIS Interactive
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is no subject to a specific license
7
+ * but it belongs to the company IRIS Interactive.
8
+ * You can contact IRIS Interactive at the following
9
+ * address: contact@iris-interactive.fr
10
+ *
11
+ * @author Lucas ROCHE
12
+ * @date 28/01/2022 14:52
13
+ * @copyright Copyright (c) 2002-2022 IRIS Interactive, Inc. (http://www.iris-interactive.fr)
14
+ */
15
+
16
+
17
+ import tippy from "tippy.js";
18
+ import "tippy.js/dist/tippy.css"
19
+ import ElementEnum from "../../enumerators/element.enum";
20
+ import TooltipEnum from "../../enumerators/tooltip.enum";
21
+
22
+ class HcTooltip {
23
+
24
+ instances = [];
25
+ defaultOptions = {
26
+ placement: '',
27
+ content: '',
28
+ trigger: ''
29
+ };
30
+
31
+ constructor(elements = ElementEnum.tooltip, overrideOptions = {}) {
32
+ document.querySelectorAll(elements).forEach(element => {
33
+ let options = {};
34
+ Object.assign(options, this.defaultOptions, overrideOptions);
35
+ options.trigger = options.trigger != '' ? options.trigger : (element.hasAttribute(TooltipEnum.attrPopover) ? "click" : "mouseenter focus");
36
+ options.content = options.content != '' ? options.content : (element.hasAttribute(TooltipEnum.attrContent) ? element.getAttribute(TooltipEnum.attrContent) : '');
37
+ options.placement = options.placement != '' ? options.placement : (element.hasAttribute(TooltipEnum.attrPlacement) ? element.getAttribute(TooltipEnum.attrPlacement) : '');
38
+ if (options.trigger === 'click') {
39
+ element.addEventListener('click', (e) => {
40
+ e.preventDefault();
41
+ });
42
+ }
43
+ const instance = tippy(element, options);
44
+ this.instances.push(instance);
45
+ });
46
+ }
47
+
48
+ show() {
49
+ this.instances.forEach(instance => {
50
+ instance.show();
51
+ })
52
+ }
53
+
54
+ hide() {
55
+ this.instances.forEach(instance => {
56
+ instance.hide();
57
+ })
58
+ }
59
+
60
+ disable() {
61
+ this.instances.forEach(instance => {
62
+ instance.disable();
63
+ })
64
+ }
65
+
66
+ enable() {
67
+ this.instances.forEach(instance => {
68
+ instance.enable();
69
+ })
70
+ }
71
+ }
72
+
73
+ export const hc_tooltip = function (trigger, options) {
74
+ return new HcTooltip(trigger, options);
75
+ };
@@ -0,0 +1,28 @@
1
+ /*
2
+ * IRIS Interactive
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is no subject to a specific license
7
+ * but it belongs to the company IRIS Interactive.
8
+ * You can contact IRIS Interactive at the following
9
+ * address: contact@iris-interactive.fr
10
+ *
11
+ * @author Lucas ROCHE
12
+ * @date 01/02/2022 10:36
13
+ * @copyright Copyright (c) 2002-2022 IRIS Interactive, Inc. (http://www.iris-interactive.fr)
14
+ */
15
+
16
+ export default class ElementEnum {
17
+ static tooltip = '[data-hc-tooltip], [data-hc-popover]';
18
+ static popover = '[data-hc-popover]';
19
+ static scrollSmooth = 'data-hc-smooth-scroll';
20
+ static modal = '[data-hc-modal]';
21
+ static lightbox = '[data-hc-lightbox]';
22
+ static dropdown = '[data-hc-dropdown]';
23
+ static collapse = '[data-hc-collapse]';
24
+ static collapseItem = '[data-hc-collapse-item]';
25
+ static tab = '[data-hc-tab]';
26
+ static toggle = '[data-hc-toggle]';
27
+ static slider = '[data-hc-slider]';
28
+ }
@@ -0,0 +1,21 @@
1
+ /*
2
+ * IRIS Interactive
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is no subject to a specific license
7
+ * but it belongs to the company IRIS Interactive.
8
+ * You can contact IRIS Interactive at the following
9
+ * address: contact@iris-interactive.fr
10
+ *
11
+ * @author Lucas ROCHE
12
+ * @date 01/02/2022 10:40
13
+ * @copyright Copyright (c) 2002-2022 IRIS Interactive, Inc. (http://www.iris-interactive.fr)
14
+ */
15
+
16
+
17
+ export default class TooltipEnum {
18
+ static attrPopover = "data-hc-popover";
19
+ static attrContent = "data-hc-tooltip-content";
20
+ static attrPlacement = "data-hc-tooltip-placement";
21
+ }