@newlogic-digital/ui 3.0.3 → 3.2.0
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 +20 -22
- package/package.json +25 -14
- package/src/{main.json → data/main.json} +13 -11
- package/src/emails/email.css +3 -3
- package/src/emails/email.twig +1 -1
- package/src/icons.svg +32 -0
- package/src/scripts/Components/+.js +1 -2
- package/src/scripts/Components/CookieConsent.js +68 -64
- package/src/scripts/Layout/+.js +2 -1
- package/src/scripts/Layout/Header.js +18 -0
- package/src/scripts/Layout/Main.js +49 -45
- package/src/scripts/Libraries/+.js +13 -10
- package/src/scripts/Libraries/Anchor.js +18 -43
- package/src/scripts/Libraries/CookieConsent.js +42 -57
- package/src/scripts/Libraries/Dialog.js +56 -55
- package/src/scripts/Libraries/Drawer.js +23 -23
- package/src/scripts/Libraries/Form.js +37 -0
- package/src/scripts/Libraries/NativeSlider.js +86 -86
- package/src/scripts/Libraries/ReCaptcha.js +20 -18
- package/src/scripts/Libraries/Ripple.js +16 -32
- package/src/scripts/Libraries/Script.js +19 -0
- package/src/scripts/Libraries/Stimulus.js +30 -34
- package/src/scripts/Libraries/Swup.js +45 -55
- package/src/scripts/Libraries/Tabs.js +12 -18
- package/src/scripts/Libraries/Tippy.js +118 -0
- package/src/scripts/Ui/+.js +5 -3
- package/src/scripts/Ui/Checkbox.js +19 -0
- package/src/scripts/Ui/Input.js +188 -161
- package/src/scripts/Ui/Radio.js +23 -0
- package/src/scripts/Ui/Select.js +64 -37
- package/src/scripts/Ui/Text.js +25 -0
- package/src/scripts/Utils/+.js +3 -0
- package/src/scripts/Utils/Functions/+.js +6 -6
- package/src/scripts/Utils/Functions/dataValue.js +28 -25
- package/src/scripts/Utils/Functions/importScript.js +9 -11
- package/src/scripts/Utils/Functions/importStyle.js +18 -5
- package/src/scripts/Utils/Functions/inView.js +19 -21
- package/src/scripts/Utils/Functions/loadStimulus.js +22 -20
- package/src/scripts/Utils/Functions/replaceTag.js +12 -0
- package/src/scripts/Utils/cdn.js +6 -4
- package/src/scripts/Utils/global.js +10 -33
- package/src/scripts/main.js +6 -6
- package/src/styles/Components/CookieConsent.css +40 -179
- package/src/styles/Components/Dialog/Default.css +12 -15
- package/src/styles/Components/Form/CookieConsent.css +7 -12
- package/src/styles/Layout/+.css +2 -0
- package/src/styles/Layout/Header.css +54 -0
- package/src/styles/Layout/Main.css +28 -63
- package/src/styles/Layout/Nav.css +43 -0
- package/src/styles/Libraries/+.css +1 -1
- package/src/styles/Libraries/Datepicker.css +85 -39
- package/src/styles/Libraries/Dialog.css +6 -5
- package/src/styles/Libraries/Drawer.css +15 -14
- package/src/styles/Libraries/Hint.css +29 -23
- package/src/styles/Libraries/Lazysizes.css +2 -1
- package/src/styles/Libraries/NativeSlider.css +19 -18
- package/src/styles/Libraries/Ripple.css +8 -5
- package/src/styles/Libraries/Tabs.css +4 -4
- package/src/styles/Libraries/Tippy.css +87 -0
- package/src/styles/Ui/+.css +5 -1
- package/src/styles/Ui/Badge.css +33 -19
- package/src/styles/Ui/Btn.css +80 -53
- package/src/styles/Ui/Checkbox.css +80 -41
- package/src/styles/Ui/Dropdown.css +5 -0
- package/src/styles/Ui/Heading.css +12 -12
- package/src/styles/Ui/Icon.css +27 -8
- package/src/styles/Ui/Image.css +23 -0
- package/src/styles/Ui/Input.css +295 -220
- package/src/styles/Ui/Label.css +14 -0
- package/src/styles/Ui/Link.css +3 -3
- package/src/styles/Ui/Notice.css +14 -16
- package/src/styles/Ui/Progress.css +10 -21
- package/src/styles/Ui/Radio.css +3 -8
- package/src/styles/Ui/Select.css +63 -112
- package/src/styles/Ui/Switch.css +70 -0
- package/src/styles/Ui/{Wsw.css → Text.css} +61 -80
- package/src/styles/Ui/Title.css +8 -4
- package/src/styles/Utils/+.css +9 -0
- package/src/styles/Utils/default.css +75 -67
- package/src/styles/Utils/icons.css +9 -0
- package/src/styles/Utils/keyframes.css +182 -0
- package/src/styles/Utils/normalize.css +223 -0
- package/src/styles/Utils/print.css +1 -1
- package/src/styles/Utils/tailwind/+.css +2 -0
- package/src/styles/Utils/tailwind/base.css +15 -0
- package/src/styles/Utils/tailwind/gutters.css +264 -263
- package/src/styles/Utils/theme/+.css +1 -0
- package/src/styles/Utils/theme/main.css +24 -21
- package/src/styles/Utils/vars.css +58 -35
- package/src/styles/Utils/vendor.css +1 -2
- package/src/styles/main.css +8 -3
- package/src/templates/Components/CookieConsent.twig +30 -0
- package/src/templates/Components/Dialogs/Basic.twig +7 -3
- package/src/templates/Layout/Header.twig +42 -0
- package/src/templates/Layout/Main.twig +52 -67
- package/src/templates/Sections/Gdpr.twig +64 -0
- package/src/templates/Sections/Ui.twig +2093 -0
- package/src/views/dialog-basic.json.twig +3 -0
- package/src/views/gdpr.json +11 -0
- package/src/views/index.json +12 -0
- package/src/views/json-tippy.json.twig +16 -0
- package/src/views/ui.json +11 -0
- package/vite.config.js +6 -0
- package/CHANGELOG +0 -231
- package/gulpfile.js +0 -192
- package/src/icons/iconfont.css +0 -171
- package/src/icons/selection.json +0 -1
- package/src/icons/variables.css +0 -31
- package/src/scripts/Components/Form.js +0 -26
- package/src/scripts/Ui/Wsw.js +0 -25
- package/src/scripts/Utils/Functions/bodyLoaded.js +0 -12
- package/src/styles/Libraries/Animate.css +0 -184
- package/src/styles/Utils/reference.css +0 -2
- package/src/styles/Utils/tailwind/content.css +0 -24
- package/src/styles/Utils/theme/vars.css +0 -19
- package/src/styles/preload.css +0 -29
- package/src/styles/tailwind.css +0 -5
- package/src/templates/Sections/.gitkeep +0 -0
- package/src/templates/dialog-basic.twig +0 -3
- package/src/templates/index.json +0 -6
|
@@ -1,137 +1,137 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
behavior:
|
|
1
|
+
export default function LibNativeSlider(selector, parent) {
|
|
2
|
+
const self = {
|
|
3
|
+
behavior: 'auto',
|
|
4
4
|
ref: {
|
|
5
|
-
nav: parent.querySelector(
|
|
6
|
-
select: parent.querySelectorAll(
|
|
7
|
-
progress: parent.querySelector(
|
|
8
|
-
counterMin: parent.querySelector(
|
|
9
|
-
counterMax: parent.querySelector(
|
|
10
|
-
prev: parent.querySelector(
|
|
11
|
-
next: parent.querySelector(
|
|
5
|
+
nav: parent.querySelector('[data-lib-ns-nav]'),
|
|
6
|
+
select: parent.querySelectorAll('[data-lib-ns-nav-item]'),
|
|
7
|
+
progress: parent.querySelector('[data-lib-ns-progress]'),
|
|
8
|
+
counterMin: parent.querySelector('[data-lib-ns-counter="min"]'),
|
|
9
|
+
counterMax: parent.querySelector('[data-lib-ns-counter="max"]'),
|
|
10
|
+
prev: parent.querySelector('[data-lib-ns-prev]'),
|
|
11
|
+
next: parent.querySelector('[data-lib-ns-next]')
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
if (!selector.classList.contains(
|
|
16
|
-
self.behavior =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
dragEvent
|
|
46
|
-
|
|
47
|
-
|
|
14
|
+
|
|
15
|
+
if (!selector.classList.contains('is-fade')) {
|
|
16
|
+
self.behavior = 'smooth'
|
|
17
|
+
|
|
18
|
+
if (!document.documentElement.classList.contains('safari')) {
|
|
19
|
+
const grabbing = () => {
|
|
20
|
+
self.isDown = false
|
|
21
|
+
self.paused = false
|
|
22
|
+
selector.classList.remove('is-grabbing')
|
|
23
|
+
selector.scrollLeft = selector.scrollLeft - 1
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
selector.addEventListener('mouseleave', grabbing)
|
|
27
|
+
|
|
28
|
+
selector.addEventListener('mouseup', grabbing)
|
|
29
|
+
|
|
30
|
+
selector.addEventListener('mousedown', e => {
|
|
31
|
+
self.isDown = true
|
|
32
|
+
self.startX = e.pageX - selector.offsetLeft
|
|
33
|
+
self.scrollLeft = selector.scrollLeft
|
|
34
|
+
self.paused = true
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
selector.addEventListener('mousemove', e => {
|
|
38
|
+
if (!self.isDown) return
|
|
39
|
+
e.preventDefault()
|
|
40
|
+
const x = e.pageX - selector.offsetLeft
|
|
41
|
+
const walk = (x - self.startX) * 1.25
|
|
42
|
+
selector.classList.add('is-grabbing')
|
|
43
|
+
selector.scrollLeft = self.scrollLeft - walk
|
|
44
|
+
|
|
45
|
+
selector.ondragstart = dragEvent => {
|
|
46
|
+
dragEvent.preventDefault()
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
}
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
if (self.ref.counterMax !== null) {
|
|
51
|
-
self.counterMax = parseInt(((selector.scrollWidth - selector.clientWidth) / selector.children[0].clientWidth + 1).toFixed(0))
|
|
52
|
-
self.ref.counterMax.textContent = self.counterMax
|
|
53
|
+
self.counterMax = parseInt(((selector.scrollWidth - selector.clientWidth) / selector.children[0].clientWidth + 1).toFixed(0))
|
|
54
|
+
self.ref.counterMax.textContent = self.counterMax
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
if (self.ref.nav !== null) {
|
|
56
|
-
self.ref.nav.insertAdjacentHTML(
|
|
57
|
-
self.ref.select = parent.querySelectorAll(
|
|
58
|
+
self.ref.nav.insertAdjacentHTML('beforeend', [...Array(self.counterMax)].map((x, i) => `<div data-state="${i === 0 && 'active'}" aria-label="${i + 1}" aria-current="step" data-lib-ns-nav-item="${i}"></div>`).join(''))
|
|
59
|
+
self.ref.select = parent.querySelectorAll('[data-lib-ns-nav-item]')
|
|
58
60
|
}
|
|
59
61
|
|
|
60
|
-
if (typeof self.ref.select[0] !==
|
|
61
|
-
self.ref.select.forEach(
|
|
62
|
-
elm.addEventListener(
|
|
63
|
-
if (!elm._hasDataValue(
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
if (typeof self.ref.select[0] !== 'undefined') {
|
|
63
|
+
self.ref.select.forEach(elm => {
|
|
64
|
+
elm.addEventListener('click', () => {
|
|
65
|
+
if (!elm._hasDataValue('state', 'active')) {
|
|
66
|
+
const position = selector.scrollLeft / selector.children[0].clientWidth
|
|
67
|
+
const selected = elm.dataset.libNsNavItem
|
|
66
68
|
|
|
67
69
|
if (position - selected <= 0) {
|
|
68
|
-
selector.scroll({ left: selector.scrollLeft + selector.children[0].clientWidth * (selected - position), behavior: self.behavior })
|
|
70
|
+
selector.scroll({ left: selector.scrollLeft + selector.children[0].clientWidth * (selected - position), behavior: self.behavior })
|
|
69
71
|
} else {
|
|
70
|
-
selector.scroll({ left: selector.scrollLeft - selector.children[0].clientWidth * (position - selected), behavior: self.behavior })
|
|
72
|
+
selector.scroll({ left: selector.scrollLeft - selector.children[0].clientWidth * (position - selected), behavior: self.behavior })
|
|
71
73
|
}
|
|
72
74
|
}
|
|
73
|
-
})
|
|
74
|
-
})
|
|
75
|
+
})
|
|
76
|
+
})
|
|
75
77
|
}
|
|
76
78
|
|
|
77
|
-
selector.addEventListener(
|
|
79
|
+
selector.addEventListener('scroll', () => {
|
|
78
80
|
if (self.ref.progress !== null) {
|
|
79
|
-
self.ref.progress.value = ((selector.scrollLeft + selector.clientWidth) / selector.scrollWidth * 100).toFixed(2)
|
|
81
|
+
self.ref.progress.value = ((selector.scrollLeft + selector.clientWidth) / selector.scrollWidth * 100).toFixed(2)
|
|
80
82
|
}
|
|
81
83
|
|
|
82
|
-
|
|
84
|
+
const activeSlide = parseInt(((selector.scrollLeft / selector.children[0].clientWidth) + 1).toFixed(0))
|
|
83
85
|
|
|
84
86
|
if (self.ref.counterMin !== null) {
|
|
85
|
-
self.ref.counterMin.textContent = activeSlide
|
|
87
|
+
self.ref.counterMin.textContent = activeSlide
|
|
86
88
|
}
|
|
87
89
|
|
|
88
|
-
if (typeof self.ref.select[0] !==
|
|
89
|
-
self.ref.select.forEach(
|
|
90
|
+
if (typeof self.ref.select[0] !== 'undefined') {
|
|
91
|
+
self.ref.select.forEach(elm => elm._removeDataValue('state', 'active'))
|
|
90
92
|
|
|
91
|
-
self.ref.select[activeSlide-1]._addDataValue(
|
|
93
|
+
self.ref.select[activeSlide - 1]._addDataValue('state', 'active')
|
|
92
94
|
}
|
|
93
95
|
|
|
94
96
|
if (Math.floor(selector.scrollLeft / selector.children[0].clientWidth) === selector.scrollLeft / selector.children[0].clientWidth) {
|
|
95
|
-
[...selector.children].forEach(
|
|
96
|
-
elm._removeDataValue(
|
|
97
|
+
[...selector.children].forEach(elm => {
|
|
98
|
+
elm._removeDataValue('state', 'active')
|
|
97
99
|
|
|
98
100
|
if (selector.scrollLeft === elm.offsetLeft - elm.parentNode.offsetLeft) {
|
|
99
|
-
elm._addDataValue(
|
|
101
|
+
elm._addDataValue('state', 'active')
|
|
100
102
|
}
|
|
101
|
-
})
|
|
103
|
+
})
|
|
102
104
|
}
|
|
103
|
-
}, { passive: true })
|
|
105
|
+
}, { passive: true })
|
|
104
106
|
|
|
105
107
|
if (self.ref.progress !== null) {
|
|
106
|
-
self.ref.progress.addEventListener(
|
|
107
|
-
selector.scrollLeft = (selector.scrollWidth / 100) * (e.clientX - e.target
|
|
108
|
-
})
|
|
108
|
+
self.ref.progress.addEventListener('click', e => {
|
|
109
|
+
selector.scrollLeft = (selector.scrollWidth / 100) * (e.clientX - e.target.offsetLeft) / e.target.clientWidth * 100
|
|
110
|
+
})
|
|
109
111
|
}
|
|
110
112
|
|
|
111
113
|
if (self.ref.prev !== null && self.ref.next !== null) {
|
|
112
|
-
self.ref.prev.addEventListener(
|
|
114
|
+
self.ref.prev.addEventListener('click', () => selector.scroll({ left: selector.scrollLeft - selector.children[0].clientWidth, behavior: self.behavior }))
|
|
113
115
|
|
|
114
|
-
self.ref.next.addEventListener(
|
|
116
|
+
self.ref.next.addEventListener('click', () => selector.scroll({ left: selector.scrollLeft + selector.children[0].clientWidth, behavior: self.behavior }))
|
|
115
117
|
}
|
|
116
118
|
|
|
117
|
-
[self.ref.prev, self.ref.next, ...self.ref.select, self.ref.progress].
|
|
118
|
-
if (typeof elm !==
|
|
119
|
-
elm.addEventListener(
|
|
120
|
-
elm.addEventListener(
|
|
119
|
+
[self.ref.prev, self.ref.next, ...self.ref.select, self.ref.progress].forEach(elm => {
|
|
120
|
+
if (typeof elm !== 'undefined' && elm !== null) {
|
|
121
|
+
elm.addEventListener('mouseenter', () => (self.paused = true))
|
|
122
|
+
elm.addEventListener('mouseleave', () => (self.paused = false))
|
|
121
123
|
}
|
|
122
124
|
})
|
|
123
125
|
|
|
124
|
-
if (!isNaN(parseInt(selector.getAttribute(
|
|
126
|
+
if (!isNaN(parseInt(selector.getAttribute('data-lib-ns')))) {
|
|
125
127
|
setInterval(() => {
|
|
126
128
|
if (!self.paused) {
|
|
127
129
|
if (selector.scrollLeft <= selector.children[0].clientWidth) {
|
|
128
|
-
selector.scroll({ left: selector.scrollLeft + selector.children[0].clientWidth, behavior: self.behavior })
|
|
130
|
+
selector.scroll({ left: selector.scrollLeft + selector.children[0].clientWidth, behavior: self.behavior })
|
|
129
131
|
} else {
|
|
130
|
-
selector.scroll({ left: 0, behavior: self.behavior })
|
|
132
|
+
selector.scroll({ left: 0, behavior: self.behavior })
|
|
131
133
|
}
|
|
132
134
|
}
|
|
133
|
-
}, parseInt(selector.getAttribute(
|
|
135
|
+
}, parseInt(selector.getAttribute('data-lib-ns')))
|
|
134
136
|
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
export default LibNativeSlider;
|
|
137
|
+
}
|
|
@@ -1,25 +1,27 @@
|
|
|
1
|
-
import { LibStimulus, Controller } from
|
|
2
|
-
import importScript from
|
|
3
|
-
import cdn from
|
|
1
|
+
import { LibStimulus, Controller } from './Stimulus.js'
|
|
2
|
+
import importScript from '../Utils/Functions/importScript.js'
|
|
3
|
+
import cdn from '../Utils/cdn.js'
|
|
4
4
|
|
|
5
|
-
LibStimulus.register(
|
|
5
|
+
LibStimulus.register('lib-recaptcha', class extends Controller {
|
|
6
6
|
connect() {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
this.interval = setInterval(() => this.captcha(), 150000);
|
|
7
|
+
importScript(cdn.recaptcha.replace('{apikey}', this.data.get('api')))
|
|
10
8
|
}
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
window.grecaptcha.ready(
|
|
15
|
-
window.grecaptcha.execute(this.data.get(
|
|
16
|
-
this.element.querySelector(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
async execute() {
|
|
11
|
+
return new Promise(resolve => {
|
|
12
|
+
window.grecaptcha.enterprise.ready(() => {
|
|
13
|
+
window.grecaptcha.enterprise.execute(this.data.get('api'), { action: this.data.get('action') ? this.data.get('action') : 'form' }).then(token => {
|
|
14
|
+
this.element.querySelector('[name="gtoken"]').value = token
|
|
15
|
+
resolve()
|
|
16
|
+
})
|
|
17
|
+
})
|
|
18
|
+
})
|
|
20
19
|
}
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
async submit(e) {
|
|
22
|
+
e.preventDefault()
|
|
23
|
+
|
|
24
|
+
await this.execute()
|
|
25
|
+
this.element.submit()
|
|
24
26
|
}
|
|
25
|
-
})
|
|
27
|
+
})
|
|
@@ -1,40 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
if (container.querySelector(".lib-ripple-inner") === null) {
|
|
4
|
-
container.insertAdjacentHTML("beforeend", `<div class='lib-ripple-inner'></div>`);
|
|
5
|
-
}
|
|
1
|
+
const LibRipple = ({ currentTarget, layerX, layerY }) => {
|
|
2
|
+
const container = currentTarget
|
|
6
3
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
if (ink.clientWidth === 0 && ink.clientHeight === 0) {
|
|
12
|
-
let d = Math.max(element.offsetWidth, element.offsetHeight);
|
|
13
|
-
|
|
14
|
-
ink.style["width"] = d + 'px';
|
|
15
|
-
ink.style["height"] = d + 'px';
|
|
16
|
-
}
|
|
4
|
+
if (container.querySelector('.lib-ripple') === null) {
|
|
5
|
+
container.insertAdjacentHTML('beforeend', "<div class='lib-ripple'></div>")
|
|
6
|
+
}
|
|
17
7
|
|
|
18
|
-
|
|
8
|
+
const ink = container.querySelector('.lib-ripple')
|
|
19
9
|
|
|
20
|
-
|
|
21
|
-
x = e.clientX - container.offsetLeft - (ink.clientWidth / 2);
|
|
22
|
-
y = e.clientY - container.offsetTop - (ink.clientHeight / 2);
|
|
23
|
-
} else {
|
|
24
|
-
x = e.pageX - container.offsetLeft - (ink.clientWidth / 2);
|
|
25
|
-
y = e.pageY - container.offsetTop - (ink.clientHeight / 2);
|
|
26
|
-
}
|
|
10
|
+
ink.classList.remove('animation')
|
|
27
11
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
ink.classList.add("animation");
|
|
31
|
-
};
|
|
12
|
+
if (ink.clientWidth === 0 && ink.clientHeight === 0) {
|
|
13
|
+
const d = Math.max(container.offsetWidth, container.offsetHeight)
|
|
32
14
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
} else {
|
|
36
|
-
init(element);
|
|
15
|
+
ink.style.width = d + 'px'
|
|
16
|
+
ink.style.height = d + 'px'
|
|
37
17
|
}
|
|
18
|
+
|
|
19
|
+
ink.style.top = layerY - (ink.clientHeight / 2) + 'px'
|
|
20
|
+
ink.style.left = layerX - (ink.clientWidth / 2) + 'px'
|
|
21
|
+
ink.classList.add('animation')
|
|
38
22
|
}
|
|
39
23
|
|
|
40
|
-
export default LibRipple
|
|
24
|
+
export default LibRipple
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { LibStimulus, Controller } from './Stimulus.js'
|
|
2
|
+
|
|
3
|
+
LibStimulus.register('lib-script', class extends Controller {
|
|
4
|
+
connect() {
|
|
5
|
+
const element = this.element
|
|
6
|
+
const script = document.createElement('script')
|
|
7
|
+
|
|
8
|
+
;[...element.attributes].forEach(attribute => {
|
|
9
|
+
if (attribute.specified && !attribute.name.includes('type') && !attribute.name.includes('data-controller')) {
|
|
10
|
+
script.setAttribute(attribute.name, attribute.value)
|
|
11
|
+
}
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
script.innerHTML = element.innerHTML
|
|
15
|
+
|
|
16
|
+
element.parentElement.appendChild(script)
|
|
17
|
+
element.remove()
|
|
18
|
+
}
|
|
19
|
+
})
|
|
@@ -1,46 +1,42 @@
|
|
|
1
|
-
import { Application, Controller } from
|
|
2
|
-
import loadStimulus from
|
|
1
|
+
import { Application, Controller as DefaultController } from '@hotwired/stimulus'
|
|
2
|
+
import loadStimulus from '../Utils/Functions/loadStimulus.js'
|
|
3
3
|
|
|
4
|
-
const LibStimulus = new Application(document.documentElement
|
|
5
|
-
controllerAttribute: "data-controller",
|
|
6
|
-
actionAttribute: "data-action",
|
|
7
|
-
targetAttribute: "data-ref"
|
|
8
|
-
});
|
|
4
|
+
const LibStimulus = new Application(document.documentElement)
|
|
9
5
|
|
|
10
|
-
|
|
6
|
+
const getController = (element, identifier) => LibStimulus.getControllerForElementAndIdentifier(element, identifier)
|
|
11
7
|
|
|
12
|
-
Controller
|
|
13
|
-
|
|
14
|
-
}
|
|
8
|
+
class Controller extends DefaultController {
|
|
9
|
+
getValue(value) {
|
|
10
|
+
return this[`${value}Value`]
|
|
11
|
+
}
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
13
|
+
setValue(type, value) {
|
|
14
|
+
this[`${type}Value`] = value
|
|
15
|
+
}
|
|
19
16
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
17
|
+
hasValue(value) {
|
|
18
|
+
return this.data.has(`${value}Value`)
|
|
19
|
+
}
|
|
23
20
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
21
|
+
getClass(value) {
|
|
22
|
+
return this.data.get(`${value}Class`)
|
|
23
|
+
}
|
|
27
24
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
25
|
+
queryTarget(target) {
|
|
26
|
+
return this.targets.find(target)
|
|
27
|
+
}
|
|
31
28
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
29
|
+
queryTargetAll(targets) {
|
|
30
|
+
return this.targets.findAll(targets)
|
|
31
|
+
}
|
|
35
32
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
33
|
+
hasTarget(target) {
|
|
34
|
+
return this.targets.has(target)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
39
37
|
|
|
40
|
-
LibStimulus.start().then(() =>
|
|
41
|
-
loadStimulus(document);
|
|
42
|
-
});
|
|
38
|
+
LibStimulus.start().then(() => loadStimulus(document.body))
|
|
43
39
|
|
|
44
|
-
window.LibStimulus = LibStimulus
|
|
40
|
+
window.LibStimulus = { default: LibStimulus, Controller, loadStimulus }
|
|
45
41
|
|
|
46
|
-
export { LibStimulus, Controller, loadStimulus }
|
|
42
|
+
export { LibStimulus, Controller, loadStimulus, getController }
|
|
@@ -1,82 +1,72 @@
|
|
|
1
|
-
import Swup from 'swup'
|
|
2
|
-
import {
|
|
3
|
-
import LibAnchor from
|
|
4
|
-
import LibDialog from
|
|
5
|
-
import LibCookieConsent from
|
|
1
|
+
import Swup from 'swup'
|
|
2
|
+
import { getController, loadStimulus } from './Stimulus.js'
|
|
3
|
+
import LibAnchor from './Anchor.js'
|
|
4
|
+
import LibDialog from './Dialog.js'
|
|
5
|
+
import LibCookieConsent from './CookieConsent.js'
|
|
6
|
+
import replaceTag from '../Utils/Functions/replaceTag.js'
|
|
6
7
|
|
|
7
8
|
const LibSwup = new Swup({
|
|
8
|
-
containers: ['#l-main'],
|
|
9
|
-
linkSelector:
|
|
10
|
-
})
|
|
9
|
+
containers: ['#l-main', '#l-header'].filter(element => document.querySelector(element)),
|
|
10
|
+
linkSelector: `:is(a[href^="${window.location.origin}"], a[href^="/"]):not([data-no-swup], [data-naja], [target="_blank"])`
|
|
11
|
+
})
|
|
11
12
|
|
|
12
|
-
LibSwup.on('clickLink', () => {
|
|
13
|
-
document.body.classList.remove(
|
|
13
|
+
LibSwup.on('clickLink', async() => {
|
|
14
|
+
document.body.classList.remove('overflow-hidden')
|
|
14
15
|
|
|
15
|
-
if (document.querySelector(
|
|
16
|
-
|
|
16
|
+
if (document.querySelector('.lib-drawer[data-state~="active"]') !== null) {
|
|
17
|
+
getController(document.body, 'lib-drawer').hide()
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
if (document.querySelector(
|
|
20
|
-
LibDialog.hide()
|
|
20
|
+
if (document.querySelector('.lib-dialog') !== null) {
|
|
21
|
+
await LibDialog.hide()
|
|
21
22
|
}
|
|
22
|
-
})
|
|
23
|
+
})
|
|
23
24
|
|
|
24
25
|
LibSwup.on('animationOutDone', () => {
|
|
25
|
-
|
|
26
|
-
})
|
|
26
|
+
document.documentElement.scroll({ top: 0, behavior: 'instant' })
|
|
27
|
+
})
|
|
27
28
|
|
|
28
29
|
LibSwup.on('contentReplaced', () => {
|
|
29
|
-
const content = new DOMParser().parseFromString(LibSwup.cache
|
|
30
|
+
const content = new DOMParser().parseFromString(LibSwup.cache.getCurrentPage().originalContent, 'text/html')
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
let tag = document.querySelector(`[data-lib-swup-replace=${element.dataset.libSwupReplace}]`);
|
|
32
|
+
replaceTag(content)
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
tag.outerHTML = element.outerHTML
|
|
36
|
-
} else {
|
|
37
|
-
document.head.insertAdjacentHTML("beforeend", element.outerHTML);
|
|
38
|
-
}
|
|
39
|
-
});
|
|
34
|
+
LibAnchor.init()
|
|
40
35
|
|
|
41
|
-
LibSwup.options.containers.forEach(
|
|
42
|
-
loadStimulus(document.querySelector(selector))
|
|
43
|
-
})
|
|
36
|
+
LibSwup.options.containers.forEach(selector => {
|
|
37
|
+
loadStimulus(document.querySelector(selector))
|
|
38
|
+
})
|
|
44
39
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (typeof window.fbq !== "undefined") {
|
|
48
|
-
window.fbq('track', 'PageView');
|
|
40
|
+
if (typeof window.fbq !== 'undefined') {
|
|
41
|
+
window.fbq('track', 'PageView')
|
|
49
42
|
}
|
|
50
43
|
|
|
51
|
-
if (typeof gtag !==
|
|
52
|
-
|
|
53
|
-
window.dataLayer.forEach(function
|
|
54
|
-
if (config[0] ===
|
|
55
|
-
if (typeof config[1] !==
|
|
56
|
-
configs.push(config[1])
|
|
44
|
+
if (typeof gtag !== 'undefined') {
|
|
45
|
+
const configs = []
|
|
46
|
+
window.dataLayer.forEach(function(config) {
|
|
47
|
+
if (config[0] === 'config') {
|
|
48
|
+
if (typeof config[1] !== 'undefined' && !configs.includes(config[1])) {
|
|
49
|
+
configs.push(config[1])
|
|
57
50
|
window.gtag('config', config[1], {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
})
|
|
51
|
+
page_title: document.title,
|
|
52
|
+
page_path: window.location.pathname + window.location.search
|
|
53
|
+
})
|
|
61
54
|
}
|
|
62
55
|
}
|
|
63
|
-
})
|
|
56
|
+
})
|
|
64
57
|
}
|
|
65
58
|
|
|
66
|
-
if (typeof window.dataLayer !==
|
|
59
|
+
if (typeof window.dataLayer !== 'undefined') {
|
|
67
60
|
window.dataLayer.push({
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
})
|
|
61
|
+
event: 'VirtualPageview',
|
|
62
|
+
virtualPageURL: window.location.pathname + window.location.search,
|
|
63
|
+
virtualPageTitle: document.title
|
|
64
|
+
})
|
|
72
65
|
}
|
|
73
66
|
|
|
74
|
-
if (typeof LibCookieConsent !==
|
|
75
|
-
LibCookieConsent.init()
|
|
67
|
+
if (typeof LibCookieConsent !== 'undefined') {
|
|
68
|
+
LibCookieConsent.init()
|
|
76
69
|
}
|
|
70
|
+
})
|
|
77
71
|
|
|
78
|
-
|
|
79
|
-
document.body.classList.add("is-body-loaded");
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
export default LibSwup;
|
|
72
|
+
export default LibSwup
|
|
@@ -1,22 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
selector.addEventListener(
|
|
4
|
-
e.preventDefault()
|
|
1
|
+
export default function LibTabs(element) {
|
|
2
|
+
element.querySelector('[data-lib-tabs-nav]').querySelectorAll('[data-lib-tabs-item="nav"]').forEach((selector, index) => {
|
|
3
|
+
selector.addEventListener('click', e => {
|
|
4
|
+
e.preventDefault()
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
selector._addDataValue(
|
|
6
|
+
selector.closest('[data-lib-tabs-nav]').querySelectorAll('[data-lib-tabs-item="nav"]').forEach(elm => elm._removeDataValue('state', 'active'))
|
|
7
|
+
selector._addDataValue('state', 'active')
|
|
8
8
|
|
|
9
|
-
[...element.querySelector(
|
|
10
|
-
elm._removeDataValue(
|
|
11
|
-
})
|
|
9
|
+
;[...element.querySelector('[data-lib-tabs-area]').children].forEach(elm => {
|
|
10
|
+
elm._removeDataValue('state', 'active')
|
|
11
|
+
})
|
|
12
12
|
|
|
13
|
-
element.querySelector(
|
|
14
|
-
|
|
15
|
-
if (callback) {
|
|
16
|
-
callback(index);
|
|
17
|
-
}
|
|
13
|
+
element.querySelector('[data-lib-tabs-area]').children[index]._addDataValue('state', 'active')
|
|
18
14
|
})
|
|
19
|
-
})
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export default LibTabs;
|
|
15
|
+
})
|
|
16
|
+
}
|