@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,60 +1,35 @@
|
|
|
1
1
|
const LibAnchor = {
|
|
2
2
|
animation: (element) => {
|
|
3
|
-
|
|
4
|
-
let attr = "data-offset";
|
|
3
|
+
const offset = parseInt(window.getComputedStyle(document.documentElement).getPropertyValue('scroll-padding-top'))
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
offset = 0;
|
|
8
|
-
if (element.getAttribute(attr) !== null) {
|
|
9
|
-
if (isNaN(parseInt(element.getAttribute(attr)))) {
|
|
10
|
-
offset = document.querySelector(element.getAttribute(attr)).offsetHeight;
|
|
11
|
-
} else {
|
|
12
|
-
offset = parseInt(element.getAttribute(attr));
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
document.documentElement.scroll({top: element.offsetTop - offset, behavior: "smooth"});
|
|
5
|
+
document.documentElement.scroll({ top: element.offsetTop - offset, behavior: 'smooth' })
|
|
18
6
|
},
|
|
19
7
|
action: (element) => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
href = element.getAttribute("data-action-href");
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
let id = document.querySelector("[id=" + href.replace('#', '') + "]");
|
|
27
|
-
let options = element.getAttribute("data-action-options");
|
|
8
|
+
const href = element.href ? element.getAttribute('href') : element.getAttribute('data-action-href')
|
|
9
|
+
const data = element.dataset.libAnhor ? element.dataset.libAnhor : ''
|
|
10
|
+
const target = document.querySelector(`[id="${href.replace('#', '')}"]`)
|
|
28
11
|
|
|
29
|
-
if (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (id !== null) {
|
|
34
|
-
if (!(options.indexOf("mobile") > -1 && window.innerWidth > 960)) {
|
|
35
|
-
|
|
36
|
-
LibAnchor.animation(id);
|
|
12
|
+
if (target !== null) {
|
|
13
|
+
if (!(data.includes('mobile') && window.innerWidth > 960)) {
|
|
14
|
+
LibAnchor.animation(target)
|
|
15
|
+
}
|
|
37
16
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
17
|
+
if (!data.includes('silent')) {
|
|
18
|
+
window.location.hash = target.id
|
|
41
19
|
}
|
|
42
20
|
}
|
|
43
21
|
},
|
|
44
22
|
init: () => {
|
|
45
|
-
|
|
23
|
+
const selector = document.querySelectorAll('[id]')
|
|
46
24
|
|
|
47
25
|
if (selector[0] !== null) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
LibAnchor.animation(element);
|
|
26
|
+
selector.forEach(element => {
|
|
27
|
+
if (window.location.hash && element.getAttribute('id') === window.location.hash.replace('#', '')) {
|
|
28
|
+
LibAnchor.animation(element)
|
|
52
29
|
}
|
|
53
|
-
})
|
|
30
|
+
})
|
|
54
31
|
}
|
|
55
32
|
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
LibAnchor.init();
|
|
33
|
+
}
|
|
59
34
|
|
|
60
|
-
export default LibAnchor
|
|
35
|
+
export default LibAnchor
|
|
@@ -1,82 +1,67 @@
|
|
|
1
1
|
const LibCookieConsent = {
|
|
2
|
+
setItem: (key, value) => {
|
|
3
|
+
localStorage.setItem(key, value)
|
|
4
|
+
},
|
|
5
|
+
getItem: (key) => {
|
|
6
|
+
return localStorage.getItem(key)
|
|
7
|
+
},
|
|
2
8
|
init: () => {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
LibCookieConsent.append("performance");
|
|
8
|
-
} else if (type === "marketing") {
|
|
9
|
-
LibCookieConsent.append("all");
|
|
10
|
-
}
|
|
11
|
-
} else {
|
|
12
|
-
LibCookieConsent.append("all");
|
|
13
|
-
}
|
|
14
|
-
} else if (localStorage.getItem('cookieconsent') === null) {
|
|
15
|
-
LibCookieConsent.append("all");
|
|
9
|
+
const type = LibCookieConsent.getItem('lib-cookieconsent')
|
|
10
|
+
|
|
11
|
+
if (type !== null) {
|
|
12
|
+
JSON.parse(type).forEach(type => LibCookieConsent.append(type))
|
|
16
13
|
}
|
|
17
14
|
},
|
|
18
|
-
set: (type
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
LibCookieConsent.append("all");
|
|
22
|
-
|
|
23
|
-
} else if (type === "performance") {
|
|
24
|
-
localStorage.setItem("cookieconsent", "approve");
|
|
25
|
-
localStorage.setItem("cookieconsent_type", "performance");
|
|
26
|
-
LibCookieConsent.append("performance");
|
|
15
|
+
set: (type) => {
|
|
16
|
+
LibCookieConsent.setItem('lib-cookieconsent', JSON.stringify(type))
|
|
17
|
+
LibCookieConsent.setItem('lib-cookieconsent-expire', (Date.now() + 31556926 * 1000).toString())
|
|
27
18
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
LibCookieConsent.
|
|
32
|
-
|
|
33
|
-
} else if (type === "decline") {
|
|
34
|
-
localStorage.setItem("cookieconsent", "decline");
|
|
35
|
-
localStorage.removeItem("cookieconsent_type");
|
|
36
|
-
LibCookieConsent.remove();
|
|
37
|
-
|
|
38
|
-
if (callback) {
|
|
39
|
-
callback();
|
|
40
|
-
}
|
|
19
|
+
if (type.length > 0) {
|
|
20
|
+
type.forEach(type => LibCookieConsent.append(type))
|
|
21
|
+
} else {
|
|
22
|
+
LibCookieConsent.setItem('lib-cookieconsent', JSON.stringify([]))
|
|
23
|
+
LibCookieConsent.remove()
|
|
41
24
|
}
|
|
42
25
|
},
|
|
43
26
|
remove: () => {
|
|
44
|
-
document.cookie.split(
|
|
45
|
-
document.cookie = c.replace(/^ +/,
|
|
46
|
-
})
|
|
27
|
+
document.cookie.split(';').forEach(c => {
|
|
28
|
+
document.cookie = c.replace(/^ +/, '').replace(/=.*/, '=;expires=' + new Date().toUTCString() + ';path=/')
|
|
29
|
+
})
|
|
47
30
|
},
|
|
48
31
|
append: (type) => {
|
|
49
|
-
|
|
50
|
-
if (type ===
|
|
51
|
-
|
|
52
|
-
let delay = 0
|
|
32
|
+
document.querySelectorAll('[data-lib-cookieconsent]').forEach(elm => {
|
|
33
|
+
if (type === 'all' || elm.getAttribute('data-lib-cookieconsent') === type) {
|
|
34
|
+
const script = document.createElement('script')
|
|
35
|
+
let delay = 0
|
|
53
36
|
|
|
54
|
-
[...elm.attributes].forEach((attribute) => {
|
|
37
|
+
;[...elm.attributes].forEach((attribute) => {
|
|
55
38
|
if (attribute.specified) {
|
|
56
|
-
if (attribute.name.indexOf(
|
|
57
|
-
script.setAttribute(attribute.name, attribute.value)
|
|
39
|
+
if (attribute.name.indexOf('data-lib-cookieconsent') === -1 && attribute.name.indexOf('type') === -1) {
|
|
40
|
+
script.setAttribute(attribute.name, attribute.value)
|
|
58
41
|
}
|
|
59
42
|
}
|
|
60
|
-
})
|
|
43
|
+
})
|
|
61
44
|
|
|
62
|
-
script.innerHTML = elm.innerHTML
|
|
45
|
+
script.innerHTML = elm.innerHTML
|
|
63
46
|
|
|
64
|
-
if (elm.getAttribute(
|
|
65
|
-
delay = parseInt(elm.getAttribute(
|
|
47
|
+
if (elm.getAttribute('data-lib-cookieconsent-delay')) {
|
|
48
|
+
delay = parseInt(elm.getAttribute('data-lib-cookieconsent-delay'))
|
|
66
49
|
}
|
|
67
50
|
|
|
68
51
|
setTimeout(() => {
|
|
69
|
-
if (elm.closest(
|
|
70
|
-
document.body.appendChild(script)
|
|
71
|
-
} else if (elm.closest(
|
|
72
|
-
document.head.appendChild(script)
|
|
52
|
+
if (elm.closest('body') !== null) {
|
|
53
|
+
document.body.appendChild(script)
|
|
54
|
+
} else if (elm.closest('head') !== null) {
|
|
55
|
+
document.head.appendChild(script)
|
|
73
56
|
}
|
|
74
57
|
|
|
75
|
-
elm.remove()
|
|
76
|
-
}, delay)
|
|
58
|
+
elm.remove()
|
|
59
|
+
}, delay)
|
|
77
60
|
}
|
|
78
61
|
})
|
|
79
62
|
}
|
|
80
|
-
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
LibCookieConsent.init()
|
|
81
66
|
|
|
82
|
-
export default LibCookieConsent
|
|
67
|
+
export default LibCookieConsent
|
|
@@ -1,74 +1,75 @@
|
|
|
1
|
+
import { loadStimulus } from './Stimulus.js'
|
|
2
|
+
|
|
1
3
|
const LibDialog = {
|
|
2
|
-
show: (content
|
|
3
|
-
|
|
4
|
-
document.querySelector(
|
|
5
|
-
|
|
4
|
+
show: async(content) => {
|
|
5
|
+
return new Promise(resolve => {
|
|
6
|
+
if (document.querySelector('.lib-dialog > [class^="c-dialog"]') !== null) {
|
|
7
|
+
document.querySelector('.lib-dialog > [class^="c-dialog"]').remove()
|
|
8
|
+
}
|
|
6
9
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
if (document.querySelector('.lib-dialog') === null) {
|
|
11
|
+
document.body.insertAdjacentHTML('beforeend', '<div class="lib-dialog"></div>')
|
|
12
|
+
}
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
document.querySelector('.lib-dialog').insertAdjacentHTML('beforeend', content)
|
|
15
|
+
document.querySelector('.lib-dialog').style.display = 'flex'
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
function outerHeight(el) {
|
|
18
|
+
return el.offsetHeight + parseInt(getComputedStyle(el).marginTop) + parseInt(getComputedStyle(el).marginBottom)
|
|
19
|
+
}
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
if (outerHeight(document.querySelector('.lib-dialog > [class^="c-dialog"]')) > window.innerHeight) {
|
|
22
|
+
const offset = window.innerWidth - document.body.clientWidth
|
|
20
23
|
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
document.documentElement.style.paddingRight = `${offset}px`
|
|
25
|
+
document.documentElement.classList.add('overflow-hidden')
|
|
23
26
|
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
if (document.querySelector('#l-header') !== null) {
|
|
28
|
+
document.querySelector('#l-header').style.right = `${offset}px`
|
|
29
|
+
}
|
|
26
30
|
}
|
|
27
|
-
}
|
|
28
31
|
|
|
29
|
-
|
|
30
|
-
callback();
|
|
31
|
-
}
|
|
32
|
+
loadStimulus(document.querySelector('.lib-dialog'))
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
document.documentElement.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
resolve()
|
|
35
|
+
|
|
36
|
+
document.querySelector('.lib-dialog').addEventListener('mousedown', e => {
|
|
37
|
+
if (e.target.classList.contains('lib-dialog')) {
|
|
38
|
+
document.documentElement.addEventListener('mouseup', function e() {
|
|
39
|
+
LibDialog.hide()
|
|
40
|
+
document.documentElement.removeEventListener('mouseup', e)
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
}, true)
|
|
44
|
+
})
|
|
41
45
|
},
|
|
42
|
-
hide: (
|
|
43
|
-
|
|
44
|
-
document.querySelector(
|
|
45
|
-
|
|
46
|
+
hide: async() => {
|
|
47
|
+
return new Promise(resolve => {
|
|
48
|
+
if (document.querySelector('.lib-dialog') !== null) {
|
|
49
|
+
document.querySelector('.lib-dialog')._addDataValue('state', 'hiding')
|
|
50
|
+
}
|
|
46
51
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
setTimeout(() => {
|
|
53
|
+
if (document.querySelector('.lib-dialog') !== null) {
|
|
54
|
+
document.querySelector('.lib-dialog').style.display = 'none'
|
|
55
|
+
document.documentElement.classList.remove('overflow-hidden')
|
|
51
56
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
57
|
+
if (document.querySelector('#l-header') !== null) {
|
|
58
|
+
document.querySelector('#l-header').style.right = ''
|
|
59
|
+
}
|
|
55
60
|
|
|
56
|
-
|
|
57
|
-
|
|
61
|
+
document.querySelector('.lib-dialog').remove()
|
|
62
|
+
}
|
|
58
63
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}, 300);
|
|
64
|
+
resolve()
|
|
65
|
+
}, 300)
|
|
66
|
+
})
|
|
63
67
|
},
|
|
64
|
-
action: (element, url
|
|
65
|
-
fetch(url, {headers: {'X-Requested-With': 'XMLHttpRequest'}}).then((
|
|
66
|
-
|
|
68
|
+
action: async(element, url) => {
|
|
69
|
+
fetch(url, { headers: { 'X-Requested-With': 'XMLHttpRequest' } }).then(response => response.json()).then(({ dialog }) => {
|
|
70
|
+
LibDialog.show(dialog)
|
|
67
71
|
})
|
|
68
|
-
.then((data) => {
|
|
69
|
-
LibDialog.show(data["dialog"], callback);
|
|
70
|
-
});
|
|
71
72
|
}
|
|
72
|
-
}
|
|
73
|
+
}
|
|
73
74
|
|
|
74
|
-
export default LibDialog
|
|
75
|
+
export default LibDialog
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { LibStimulus, Controller } from
|
|
1
|
+
import { LibStimulus, Controller } from './Stimulus.js'
|
|
2
2
|
|
|
3
|
-
LibStimulus.register(
|
|
3
|
+
LibStimulus.register('lib-drawer', class extends Controller {
|
|
4
4
|
init() {
|
|
5
|
-
setTimeout(() => this.queryTarget(
|
|
6
|
-
this.queryTarget(
|
|
7
|
-
if (
|
|
8
|
-
this.hide()
|
|
5
|
+
setTimeout(() => this.queryTarget('nav').classList.add('is-transition'), 50)
|
|
6
|
+
this.queryTarget('nav').addEventListener('click', ({ target }) => {
|
|
7
|
+
if (target === this.queryTarget('nav')) {
|
|
8
|
+
this.hide()
|
|
9
9
|
}
|
|
10
10
|
})
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
show() {
|
|
14
|
-
this.queryTarget(
|
|
15
|
-
this.queryTarget(
|
|
16
|
-
this.queryTarget(
|
|
17
|
-
this.queryTarget(
|
|
18
|
-
document.documentElement.classList.add(
|
|
14
|
+
this.queryTarget('nav').scrollLeft = 0
|
|
15
|
+
this.queryTarget('nav').style.setProperty('--lib-drawer-opacity', '1')
|
|
16
|
+
this.queryTarget('nav').classList.add('is-opacity')
|
|
17
|
+
this.queryTarget('nav')._addDataValue('state', 'active')
|
|
18
|
+
document.documentElement.classList.add('overflow-hidden')
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
hide() {
|
|
22
|
-
this.queryTarget(
|
|
23
|
-
this.queryTarget(
|
|
24
|
-
this.queryTarget(
|
|
25
|
-
document.documentElement.classList.remove(
|
|
22
|
+
this.queryTarget('nav')._removeDataValue('state', 'active')
|
|
23
|
+
this.queryTarget('nav').classList.add('is-opacity')
|
|
24
|
+
this.queryTarget('nav').style.setProperty('--lib-drawer-opacity', '0')
|
|
25
|
+
document.documentElement.classList.remove('overflow-hidden')
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
scroll(
|
|
29
|
-
if (
|
|
30
|
-
this.queryTarget(
|
|
31
|
-
this.queryTarget(
|
|
28
|
+
scroll({ target }) {
|
|
29
|
+
if (target.scrollLeft > 1) {
|
|
30
|
+
this.queryTarget('nav').classList.remove('is-opacity')
|
|
31
|
+
this.queryTarget('nav').style.setProperty('--lib-drawer-opacity', `${Math.abs((target.scrollLeft / this.queryTarget('nav').children[0].clientWidth) - 1)}`)
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
if (
|
|
35
|
-
this.queryTarget(
|
|
36
|
-
document.documentElement.classList.remove(
|
|
34
|
+
if (target.scrollLeft === this.queryTarget('nav').children[0].clientWidth) {
|
|
35
|
+
this.queryTarget('nav')._removeDataValue('state', 'active')
|
|
36
|
+
document.documentElement.classList.remove('overflow-hidden')
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
})
|
|
39
|
+
})
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { LibStimulus, Controller, getController } from './Stimulus.js'
|
|
2
|
+
|
|
3
|
+
LibStimulus.register('lib-form', class extends Controller {
|
|
4
|
+
connect() {
|
|
5
|
+
this.element.setAttribute('novalidate', '')
|
|
6
|
+
this.element.addEventListener('submit', e => this.validate(this.element, e))
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
validate(element, e) {
|
|
10
|
+
if (element.reportValidity() === false) {
|
|
11
|
+
e.preventDefault()
|
|
12
|
+
e.stopPropagation()
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
element.querySelectorAll('.ui-input').forEach(element => {
|
|
16
|
+
getController(element, 'ui-input').validate(element, true)
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
element.querySelectorAll('.ui-select:not([data-state*="active"]) select[required]').forEach(select => {
|
|
20
|
+
getController(select.parentNode, 'ui-select').validate(select.parentNode, select)
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
element.querySelectorAll('[data-controller="ui-checkbox"] input:not([type="hidden"])').forEach(input => {
|
|
24
|
+
input.parentNode._removeDataValue('state', 'valid invalid')
|
|
25
|
+
|
|
26
|
+
if (input.checkValidity()) {
|
|
27
|
+
input.parentNode._addDataValue('state', 'valid')
|
|
28
|
+
} else {
|
|
29
|
+
input.parentNode._addDataValue('state', 'invalid')
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
submitForm({ currentTarget }) {
|
|
35
|
+
currentTarget.form.dispatchEvent(new Event('submit', { bubbles: true, cancelable: true }))
|
|
36
|
+
}
|
|
37
|
+
})
|