@newlogic-digital/ui 3.3.0 → 3.4.2
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 +19 -20
- package/src/data/main.json +0 -1
- package/src/emails/templates/Layout.twig +1 -1
- package/src/scripts/Components/CookieConsent.js +0 -1
- package/src/scripts/Layout/Header.js +23 -11
- package/src/scripts/Layout/Main.js +3 -36
- package/src/scripts/Libraries/+.js +2 -1
- package/src/scripts/Libraries/Dialog.js +35 -72
- package/src/scripts/Libraries/Drawer.js +5 -1
- package/src/scripts/Libraries/Form.js +2 -0
- package/src/scripts/Libraries/Naja.js +35 -0
- package/src/scripts/Libraries/NativeSlider.js +1 -1
- package/src/scripts/Libraries/ReCaptcha.js +15 -0
- package/src/scripts/Libraries/Swup.js +19 -31
- package/src/scripts/Ui/Input.js +1 -1
- package/src/scripts/Utils/Functions/+.js +0 -1
- package/src/scripts/Utils/Functions/loadStimulus.js +4 -1
- package/src/scripts/Utils/cdn.js +3 -3
- package/src/styles/Components/Dialog/Default.css +17 -52
- package/src/styles/Layout/Main.css +4 -20
- package/src/styles/Libraries/Dialog.css +23 -7
- package/src/styles/Libraries/Drawer.css +2 -8
- package/src/styles/Libraries/Ripple.css +4 -17
- package/src/styles/Ui/Checkbox.css +0 -1
- package/src/styles/Ui/Link.css +1 -1
- package/src/styles/Ui/Text.css +5 -0
- package/src/styles/Utils/+.css +10 -9
- package/src/styles/Utils/breakpoints.css +9 -0
- package/src/styles/Utils/default.css +12 -108
- package/src/styles/Utils/tailwind/+.css +3 -2
- package/src/styles/Utils/tailwind/base.css +0 -37
- package/src/styles/Utils/tailwind/utilities.css +48 -0
- package/src/styles/Utils/theme/+.css +1 -1
- package/src/styles/Utils/vars.css +0 -35
- package/src/styles/Utils/vendor.css +2 -1
- package/src/styles/main.css +2 -3
- package/src/templates/Components/Dialogs/Basic.twig +15 -17
- package/src/templates/Sections/Ui/Docs/Default.twig +15 -15
- package/src/templates/Sections/Ui/Intro.html +1 -1
- package/src/views/dialog/basic.json.twig +1 -1
- package/src/views/email/email.twig +6 -0
- package/vite.config.js +22 -6
- package/.eslintrc +0 -13
- package/.stylelintrc +0 -18
- package/public/sw.js +0 -30
- package/src/emails/email.prod.html +0 -6
- package/src/emails/email.twig.html +0 -6
- package/src/emails/templates.prod/.gitkeep +0 -0
- package/src/scripts/Utils/Functions/inView.js +0 -24
- package/tailwind.config.cjs +0 -69
package/package.json
CHANGED
|
@@ -1,46 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newlogic-digital/ui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "vite.config.js",
|
|
6
6
|
"author": "New Logic Studio s.r.o.",
|
|
7
7
|
"description": "Lightweight, modern and modular CSS framework with the best principles",
|
|
8
8
|
"license": "GNU GPLv3",
|
|
9
9
|
"scripts": {
|
|
10
|
+
"postinstall": "rm -rf node_modules/typed-query-selector",
|
|
10
11
|
"dev": "vite",
|
|
11
12
|
"preview": "vite preview",
|
|
12
|
-
"build": "
|
|
13
|
-
"build
|
|
14
|
-
"build
|
|
13
|
+
"build": "vite build --mode development",
|
|
14
|
+
"build-production": "vite build",
|
|
15
|
+
"build-emails": "vite build --mode emails",
|
|
15
16
|
"emails": "vituum emails",
|
|
16
17
|
"cleanup": "vituum cleanup",
|
|
17
18
|
"eslint": "eslint 'src/scripts/**/*.js'",
|
|
18
|
-
"eslint
|
|
19
|
+
"eslint-fix": "eslint 'src/scripts/**/*.js' --fix",
|
|
19
20
|
"stylelint": "stylelint 'src/styles/**/*.css'",
|
|
20
|
-
"stylelint
|
|
21
|
+
"stylelint-fix": "stylelint 'src/styles/**/*.css' --fix"
|
|
21
22
|
},
|
|
22
23
|
"dependencies": {
|
|
23
24
|
"@simonwep/pickr": "^1.8.2",
|
|
24
|
-
"@hotwired/stimulus": "^3.
|
|
25
|
-
"
|
|
25
|
+
"@hotwired/stimulus": "^3.2.1",
|
|
26
|
+
"winduum": "^0.1.18",
|
|
27
|
+
"swup": "^3.1.1",
|
|
28
|
+
"naja": "^2.5.0",
|
|
26
29
|
"tippy.js": "^6.3.7",
|
|
27
|
-
"vanillajs-datepicker": "^1.
|
|
28
|
-
"css-has-pseudo": "^
|
|
30
|
+
"vanillajs-datepicker": "^1.3.3",
|
|
31
|
+
"css-has-pseudo": "^5.0.2"
|
|
29
32
|
},
|
|
30
33
|
"devDependencies": {
|
|
31
|
-
"@newlogic-digital/core": "^
|
|
34
|
+
"@newlogic-digital/core": "^2.0.0",
|
|
32
35
|
"@types/grecaptcha": "^3.0.4",
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"stylelint-
|
|
36
|
+
"eslint-config-standard": "^17.1.0",
|
|
37
|
+
"stylelint-config-standard": "^33.0.0",
|
|
38
|
+
"stylelint-stylistic": "^0.4.2",
|
|
39
|
+
"postcss-custom-selectors": "^7.1.3"
|
|
36
40
|
},
|
|
37
41
|
"files": [
|
|
38
|
-
"src"
|
|
39
|
-
"tailwind.config.cjs",
|
|
40
|
-
"vite.config.js",
|
|
41
|
-
".eslintrc",
|
|
42
|
-
".stylelintrc",
|
|
43
|
-
"public/sw.js"
|
|
42
|
+
"src"
|
|
44
43
|
],
|
|
45
44
|
"engines": {
|
|
46
45
|
"node": ">=16.0.0",
|
package/src/data/main.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<!--[if gte mso 9]><xml><o:OfficeDocumentSettings><o:PixelsPerInch>96</o:PixelsPerInch></o:OfficeDocumentSettings></xml><![endif]-->
|
|
7
7
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
8
8
|
<style type="text/css">
|
|
9
|
-
@import 'styles/email.css';
|
|
9
|
+
@import '/src/emails/styles/email.css';
|
|
10
10
|
</style>
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|
|
@@ -1,18 +1,30 @@
|
|
|
1
1
|
import { LibStimulus, Controller, getController } from '../Libraries/Stimulus.js'
|
|
2
2
|
|
|
3
|
-
LibStimulus.register('l-header',
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
LibStimulus.register('l-header',
|
|
4
|
+
/** @property {LibDrawer} libDrawerOutlet */
|
|
5
|
+
class extends Controller {
|
|
6
|
+
connect() {
|
|
7
|
+
if (document.querySelector('#l-nav') === null) {
|
|
8
|
+
this.element.insertAdjacentHTML('afterend', `
|
|
9
|
+
<div id="l-nav" class="lib-drawer" data-lib-drawer-target="nav" data-action="scroll->lib-drawer#scroll" inert aria-hidden="true">
|
|
10
|
+
<div class="wrp_nav">
|
|
11
|
+
<div class="wrp_nav_head"></div>
|
|
12
|
+
<div class="wrp_nav_body"></div>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
`)
|
|
7
16
|
|
|
8
|
-
|
|
17
|
+
/** @type {LibDrawer} */
|
|
18
|
+
const LibDrawer = getController(document.body, 'lib-drawer')
|
|
19
|
+
LibDrawer.init()
|
|
9
20
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
21
|
+
const layoutNav = document.querySelector('#l-nav')
|
|
22
|
+
const logo = this.element.querySelector('.elm_header_logo').outerHTML
|
|
23
|
+
const nav = this.element.querySelector('.elm_header_nav').outerHTML
|
|
13
24
|
|
|
14
|
-
|
|
15
|
-
|
|
25
|
+
layoutNav.querySelector('.wrp_nav_head').insertAdjacentHTML('beforeend', logo)
|
|
26
|
+
layoutNav.querySelector('.wrp_nav_body').insertAdjacentHTML('beforeend', nav)
|
|
27
|
+
}
|
|
16
28
|
}
|
|
17
29
|
}
|
|
18
|
-
|
|
30
|
+
)
|
|
@@ -1,22 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import LibRipple from '../Libraries/Ripple.js'
|
|
1
|
+
import { showRipple } from 'winduum/src/libraries/ripple.js'
|
|
2
|
+
import { LibStimulus, Controller } from '../Libraries/Stimulus.js'
|
|
4
3
|
import LibAnchor from '../Libraries/Anchor.js'
|
|
5
|
-
import LibDialog from '../Libraries/Dialog.js'
|
|
6
4
|
import LibTippy from '../Libraries/Tippy.js'
|
|
7
5
|
import LibTabs from '../Libraries/Tabs.js'
|
|
8
6
|
import LibNativeSlider from '../Libraries/NativeSlider.js'
|
|
9
|
-
import cdn from '../Utils/cdn.js'
|
|
10
7
|
|
|
11
8
|
LibStimulus.register('lib', class extends Controller {
|
|
12
|
-
connect() {
|
|
13
|
-
if (!('scrollBehavior' in document.documentElement.style)) {
|
|
14
|
-
importScript(cdn.seamless).then(() => window.seamless.polyfill())
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
9
|
ripple(e) {
|
|
19
|
-
|
|
10
|
+
showRipple(e)
|
|
20
11
|
}
|
|
21
12
|
|
|
22
13
|
anchor({ currentTarget }) {
|
|
@@ -35,30 +26,6 @@ LibStimulus.register('lib', class extends Controller {
|
|
|
35
26
|
}
|
|
36
27
|
})
|
|
37
28
|
|
|
38
|
-
LibStimulus.register('lib-dialog', class extends Controller {
|
|
39
|
-
async connect() {
|
|
40
|
-
if (this.element.getAttribute('data-lib-dialog-open')) {
|
|
41
|
-
const url = this.element.getAttribute('data-action-url')
|
|
42
|
-
|
|
43
|
-
if (url) {
|
|
44
|
-
await LibDialog.action(this.element, url, () => loadStimulus(document.querySelector('.lib-dialog')))
|
|
45
|
-
} else {
|
|
46
|
-
await LibDialog.show(document.querySelector(this.element.getAttribute('data-lib-dialog-open')).innerHTML, () => loadStimulus(document.querySelector('.lib-dialog')))
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
async show({ currentTarget }) {
|
|
52
|
-
const url = currentTarget.getAttribute('data-action-url')
|
|
53
|
-
|
|
54
|
-
await LibDialog.action(currentTarget, url)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
async hide() {
|
|
58
|
-
await LibDialog.hide()
|
|
59
|
-
}
|
|
60
|
-
})
|
|
61
|
-
|
|
62
29
|
LibStimulus.register('lib-tabs', class extends Controller {
|
|
63
30
|
connect() {
|
|
64
31
|
LibTabs(this.element)
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export { default as Anchor } from './Anchor.js'
|
|
2
2
|
export { default as CookieConsent } from './CookieConsent.js'
|
|
3
|
-
|
|
3
|
+
import './Dialog.js'
|
|
4
4
|
import './Drawer.js'
|
|
5
5
|
import './Form.js'
|
|
6
|
+
import './Naja.js'
|
|
6
7
|
export { default as NativeSlider } from './NativeSlider.js'
|
|
7
8
|
import './ReCaptcha.js'
|
|
8
9
|
export { default as Ripple } from './Ripple.js'
|
|
@@ -1,82 +1,45 @@
|
|
|
1
|
-
import { loadStimulus } from './Stimulus.js'
|
|
1
|
+
import { Controller, LibStimulus, loadStimulus } from './Stimulus.js'
|
|
2
|
+
import { insertDialog, closeDialog, fetchDialog, dialogSelector } from 'winduum/src/libraries/dialog.js'
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
if (document.querySelector('.lib-dialog') === null) {
|
|
11
|
-
document.body.insertAdjacentHTML('beforeend', '<div class="lib-dialog" tabindex="0"></div>')
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
document.querySelector('.lib-dialog').insertAdjacentHTML('beforeend', content)
|
|
15
|
-
document.querySelector('.lib-dialog').style.display = 'flex'
|
|
16
|
-
|
|
17
|
-
function outerHeight(el) {
|
|
18
|
-
return el.offsetHeight + parseInt(getComputedStyle(el).marginTop) + parseInt(getComputedStyle(el).marginBottom)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (outerHeight(document.querySelector('.lib-dialog > [class^="c-dialog"]')) > window.innerHeight) {
|
|
22
|
-
const offset = window.innerWidth - document.body.clientWidth
|
|
23
|
-
|
|
24
|
-
document.documentElement.style.paddingRight = `${offset}px`
|
|
25
|
-
document.documentElement.classList.add('overflow-hidden')
|
|
4
|
+
LibStimulus.register('lib-dialog', class extends Controller {
|
|
5
|
+
static values = {
|
|
6
|
+
open: String,
|
|
7
|
+
url: String
|
|
8
|
+
}
|
|
26
9
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
10
|
+
async connect() {
|
|
11
|
+
if (this.hasOpenValue) {
|
|
12
|
+
if (this.hasUrlValue) {
|
|
13
|
+
await fetchDialog({
|
|
14
|
+
url: this.urlValue, insertOptions: { remove: true }
|
|
15
|
+
})
|
|
16
|
+
} else {
|
|
17
|
+
await insertDialog(document.querySelector(this.openValue).innerHTML, {
|
|
18
|
+
remove: true
|
|
19
|
+
})
|
|
30
20
|
}
|
|
31
21
|
|
|
32
|
-
loadStimulus(
|
|
33
|
-
|
|
34
|
-
|
|
22
|
+
loadStimulus(dialogSelector('.lib-dialog'))
|
|
23
|
+
}
|
|
24
|
+
}
|
|
35
25
|
|
|
36
|
-
|
|
26
|
+
async show({ currentTarget, params }) {
|
|
27
|
+
currentTarget._addDataValue('state', 'loading')
|
|
28
|
+
currentTarget.classList.add('cursor-wait')
|
|
37
29
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
})
|
|
44
|
-
}
|
|
45
|
-
}, true)
|
|
46
|
-
})
|
|
47
|
-
},
|
|
48
|
-
hide: async() => {
|
|
49
|
-
return new Promise(resolve => {
|
|
50
|
-
if (document.querySelector('.lib-dialog') !== null) {
|
|
51
|
-
document.querySelector('.lib-dialog')._addDataValue('state', 'hiding')
|
|
30
|
+
await fetchDialog({
|
|
31
|
+
url: params.url,
|
|
32
|
+
insertOptions: {
|
|
33
|
+
remove: params.remove ?? true,
|
|
34
|
+
append: params.append ?? false
|
|
52
35
|
}
|
|
36
|
+
}).then(() => loadStimulus(dialogSelector('.lib-dialog')))
|
|
53
37
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
document.querySelector('.lib-dialog').style.display = 'none'
|
|
57
|
-
document.documentElement.classList.remove('overflow-hidden')
|
|
58
|
-
|
|
59
|
-
if (document.querySelector('#l-header') !== null) {
|
|
60
|
-
document.querySelector('#l-header').style.right = ''
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
document.querySelector('.lib-dialog').remove()
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
resolve()
|
|
67
|
-
}, 300)
|
|
68
|
-
})
|
|
69
|
-
},
|
|
70
|
-
action: async(element, url) => {
|
|
71
|
-
element._addDataValue('state', 'loading')
|
|
72
|
-
element.classList.add('cursor-wait')
|
|
73
|
-
|
|
74
|
-
fetch(url, { headers: { 'X-Requested-With': 'XMLHttpRequest' } }).then(response => response.json()).then(({ dialog }) => {
|
|
75
|
-
LibDialog.show(dialog)
|
|
76
|
-
element._removeDataValue('state', 'loading')
|
|
77
|
-
element.classList.remove('cursor-wait')
|
|
78
|
-
})
|
|
38
|
+
currentTarget._removeDataValue('state', 'loading')
|
|
39
|
+
currentTarget.classList.remove('cursor-wait')
|
|
79
40
|
}
|
|
80
|
-
}
|
|
81
41
|
|
|
82
|
-
|
|
42
|
+
async hide({ params }) {
|
|
43
|
+
await closeDialog({ remove: params.remove ?? false })
|
|
44
|
+
}
|
|
45
|
+
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LibStimulus, Controller } from './Stimulus.js'
|
|
2
2
|
|
|
3
|
-
LibStimulus.register('lib-drawer', class extends Controller {
|
|
3
|
+
LibStimulus.register('lib-drawer', class LibDrawer extends Controller {
|
|
4
4
|
static targets = ['nav']
|
|
5
5
|
|
|
6
6
|
init() {
|
|
@@ -17,10 +17,14 @@ LibStimulus.register('lib-drawer', class extends Controller {
|
|
|
17
17
|
this.navTarget.style.setProperty('--lib-drawer-opacity', '1')
|
|
18
18
|
this.navTarget.classList.add('is-opacity')
|
|
19
19
|
this.navTarget._addDataValue('state', 'active')
|
|
20
|
+
this.navTarget.setAttribute('aria-hidden', 'false')
|
|
21
|
+
this.navTarget.removeAttribute('inert')
|
|
20
22
|
document.documentElement.classList.add('overflow-hidden')
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
hide() {
|
|
26
|
+
this.navTarget.setAttribute('inert', '')
|
|
27
|
+
this.navTarget.setAttribute('aria-hidden', 'true')
|
|
24
28
|
this.navTarget._removeDataValue('state', 'active')
|
|
25
29
|
this.navTarget.classList.add('is-opacity')
|
|
26
30
|
this.navTarget.style.setProperty('--lib-drawer-opacity', '0')
|
|
@@ -14,6 +14,8 @@ LibStimulus.register('lib-form', class extends Controller {
|
|
|
14
14
|
|
|
15
15
|
this.element.querySelector(':invalid').scrollIntoView({ behavior: 'smooth', block: 'center' })
|
|
16
16
|
this.element.querySelector(':invalid').focus()
|
|
17
|
+
} else {
|
|
18
|
+
this.element.querySelector('[type="submit"]')._addDataValue('state', 'loading')
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
this.element.querySelectorAll('.ui-input, [data-controller="ui-checkbox"], [data-controller="ui-radio"]').forEach(element => {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import naja from 'naja'
|
|
2
|
+
import { Controller, LibStimulus, loadStimulus } from './Stimulus.js'
|
|
3
|
+
|
|
4
|
+
LibStimulus.register('lib-naja', class extends Controller {
|
|
5
|
+
async connect() {
|
|
6
|
+
naja.uiHandler.addEventListener('interaction', ({ detail }) => {
|
|
7
|
+
const element = detail.element
|
|
8
|
+
|
|
9
|
+
detail.options.target = element
|
|
10
|
+
|
|
11
|
+
element.dispatchEvent(new CustomEvent('naja-interaction', { bubbles: true, cancelable: true }))
|
|
12
|
+
|
|
13
|
+
if (element?.form && !element.form.reportValidity()) {
|
|
14
|
+
arguments[0].preventDefault()
|
|
15
|
+
}
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
naja.snippetHandler.addEventListener('afterUpdate', ({ detail }) => {
|
|
19
|
+
detail?.options.target.dispatchEvent(new CustomEvent('naja-afterUpdate', { bubbles: true, cancelable: true }))
|
|
20
|
+
|
|
21
|
+
loadStimulus(document.body, false)
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
naja.uiHandler.selector = '[data-naja]'
|
|
25
|
+
naja.initialize({
|
|
26
|
+
history: false
|
|
27
|
+
})
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async fetch({ currentTarget }) {
|
|
31
|
+
arguments[0].preventDefault()
|
|
32
|
+
|
|
33
|
+
await naja.makeRequest('GET', currentTarget.dataset.actionUrl, null, { history: false })
|
|
34
|
+
}
|
|
35
|
+
})
|
|
@@ -127,7 +127,7 @@ export default function LibNativeSlider(selector, parent) {
|
|
|
127
127
|
if (!isNaN(parseInt(selector.getAttribute('data-lib-ns')))) {
|
|
128
128
|
setInterval(() => {
|
|
129
129
|
if (!self.paused) {
|
|
130
|
-
if (selector.scrollLeft
|
|
130
|
+
if (selector.scrollLeft < selector.children[0].clientWidth * (selector.children.length - 1)) {
|
|
131
131
|
selector.scroll({ left: selector.scrollLeft + selector.children[0].clientWidth, behavior: self.behavior })
|
|
132
132
|
} else {
|
|
133
133
|
selector.scroll({ left: 0, behavior: self.behavior })
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LibStimulus, Controller } from './Stimulus.js'
|
|
2
|
+
import naja from 'naja'
|
|
2
3
|
import importScript from '../Utils/Functions/importScript.js'
|
|
3
4
|
import cdn from '../Utils/cdn.js'
|
|
4
5
|
|
|
@@ -24,9 +25,23 @@ LibStimulus.register('lib-recaptcha', class extends Controller {
|
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
async submit() {
|
|
28
|
+
if (this.element.reportValidity() === false) {
|
|
29
|
+
return false
|
|
30
|
+
}
|
|
31
|
+
|
|
27
32
|
arguments[0].preventDefault()
|
|
28
33
|
|
|
29
34
|
await this.execute()
|
|
30
35
|
this.element.submit()
|
|
31
36
|
}
|
|
37
|
+
|
|
38
|
+
async submitFetch() {
|
|
39
|
+
if (this.element.reportValidity() === false) {
|
|
40
|
+
return false
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
arguments[0].preventDefault()
|
|
44
|
+
await this.execute()
|
|
45
|
+
await naja.makeRequest(this.element.method, this.element.action, new FormData(this.element), { history: 'replace' })
|
|
46
|
+
}
|
|
32
47
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Swup from 'swup'
|
|
2
2
|
import { getController, loadStimulus } from './Stimulus.js'
|
|
3
|
+
import { closeDialog } from 'winduum/src/libraries/dialog.js'
|
|
3
4
|
import LibAnchor from './Anchor.js'
|
|
4
|
-
import LibDialog from './Dialog.js'
|
|
5
5
|
import LibCookieConsent from './CookieConsent.js'
|
|
6
6
|
import replaceTag from '../Utils/Functions/replaceTag.js'
|
|
7
7
|
|
|
@@ -14,11 +14,13 @@ LibSwup.on('clickLink', async({ target }) => {
|
|
|
14
14
|
document.body.classList.remove('overflow-hidden')
|
|
15
15
|
|
|
16
16
|
if (document.querySelector('.lib-drawer[data-state~="active"]') !== null) {
|
|
17
|
-
|
|
17
|
+
/** @type {LibDrawer} */
|
|
18
|
+
const LibDrawer = getController(document.body, 'lib-drawer')
|
|
19
|
+
LibDrawer.hide()
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
if (document.querySelector('.lib-dialog') !== null) {
|
|
21
|
-
await
|
|
23
|
+
await closeDialog()
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
if (window.location.href === target.closest('a').href) {
|
|
@@ -30,47 +32,33 @@ LibSwup.on('animationOutDone', () => {
|
|
|
30
32
|
document.documentElement.scroll({ top: 0, behavior: 'instant' })
|
|
31
33
|
})
|
|
32
34
|
|
|
35
|
+
/** @var {Array} dataLayer */
|
|
36
|
+
/** @var {Function} rc */
|
|
37
|
+
/** @var {Function} retargetingHit */
|
|
38
|
+
/** @var {Function} conversionHit */
|
|
39
|
+
/** @var {Object} retargetingConf */
|
|
40
|
+
/** @var {Object} conversionConf */
|
|
41
|
+
/** @var {Function} fbq */
|
|
33
42
|
LibSwup.on('contentReplaced', () => {
|
|
34
43
|
const content = new DOMParser().parseFromString(LibSwup.cache.getCurrentPage().originalContent, 'text/html')
|
|
35
44
|
|
|
36
45
|
replaceTag(content)
|
|
37
46
|
|
|
38
47
|
LibAnchor.init()
|
|
48
|
+
LibCookieConsent.init()
|
|
39
49
|
|
|
40
50
|
LibSwup.options.containers.forEach(selector => {
|
|
41
51
|
loadStimulus(document.querySelector(selector))
|
|
42
52
|
})
|
|
43
53
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (typeof gtag !== 'undefined') {
|
|
49
|
-
const configs = []
|
|
50
|
-
window.dataLayer.forEach(function(config) {
|
|
51
|
-
if (config[0] === 'config') {
|
|
52
|
-
if (typeof config[1] !== 'undefined' && !configs.includes(config[1])) {
|
|
53
|
-
configs.push(config[1])
|
|
54
|
-
window.gtag('config', config[1], {
|
|
55
|
-
page_title: document.title,
|
|
56
|
-
page_path: window.location.pathname + window.location.search
|
|
57
|
-
})
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
})
|
|
61
|
-
}
|
|
54
|
+
window.dataLayer && window.dataLayer.push({
|
|
55
|
+
event: 'page_view'
|
|
56
|
+
})
|
|
62
57
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
event: 'VirtualPageview',
|
|
66
|
-
virtualPageURL: window.location.pathname + window.location.search,
|
|
67
|
-
virtualPageTitle: document.title
|
|
68
|
-
})
|
|
69
|
-
}
|
|
58
|
+
window.rc?.retargetingHit && window.rc.retargetingHit(window.retargetingConf)
|
|
59
|
+
window.rc?.conversionHit && window.rc.conversionHit(window.conversionConf)
|
|
70
60
|
|
|
71
|
-
|
|
72
|
-
LibCookieConsent.init()
|
|
73
|
-
}
|
|
61
|
+
window.fbq && window.fbq('track', 'PageView')
|
|
74
62
|
})
|
|
75
63
|
|
|
76
64
|
export default LibSwup
|
package/src/scripts/Ui/Input.js
CHANGED
|
@@ -59,7 +59,7 @@ LibStimulus.register('ui-input', class extends Controller {
|
|
|
59
59
|
const date = element.querySelector('[type^="date"]')
|
|
60
60
|
|
|
61
61
|
if (date !== null && !document.documentElement.classList.contains('mobile')) {
|
|
62
|
-
const lang = await import(
|
|
62
|
+
const lang = await import(/* @vite-ignore */ cdn.datepickerLang.replace('{lang}', document.documentElement.lang === 'en' ? 'cs' : document.documentElement.lang))
|
|
63
63
|
const { Datepicker } = await import('vanillajs-datepicker')
|
|
64
64
|
|
|
65
65
|
await importStyle(cdn.datepicker)
|
|
@@ -2,6 +2,5 @@ export { default as checkValidity } from './checkValidity.js'
|
|
|
2
2
|
import './dataValue.js'
|
|
3
3
|
export { default as importScript } from './importScript.js'
|
|
4
4
|
export { default as importStyle } from './importStyle.js'
|
|
5
|
-
export { default as inView } from './inView.js'
|
|
6
5
|
export { default as loadStimulus } from './loadStimulus.js'
|
|
7
6
|
export { default as replaceTag } from './replaceTag.js'
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import naja from 'naja'
|
|
2
|
+
|
|
1
3
|
const dynamicControllers = ['ui-input', 'ui-select', 'ui-text', 'ui-checkbox', 'ui-radio', 'c-cookieconsent', 'c-form-cookieconsent']
|
|
2
4
|
const dynamicActions = [['.ui-btn', 'click->lib#ripple']]
|
|
3
5
|
|
|
@@ -33,7 +35,8 @@ function loadActions(parent, selectors) {
|
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
37
|
|
|
36
|
-
export default function loadStimulus(selector) {
|
|
38
|
+
export default function loadStimulus(selector, najaLoad = true) {
|
|
37
39
|
loadControllers(selector, dynamicControllers)
|
|
38
40
|
loadActions(selector, dynamicActions)
|
|
41
|
+
najaLoad && naja.uiHandler.bindUI(selector)
|
|
39
42
|
}
|
package/src/scripts/Utils/cdn.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
recaptcha: 'https://www.google.com/recaptcha/enterprise.js?render={apikey}',
|
|
3
|
-
|
|
4
|
-
pickrCss: 'https://cdn.jsdelivr.net/npm/@simonwep/pickr@1.8.0/dist/themes/nano.min.css',
|
|
3
|
+
pickrCss: 'https://cdn.jsdelivr.net/npm/@simonwep/pickr@1.8.2/dist/themes/nano.min.css',
|
|
5
4
|
tippy: 'https://cdn.jsdelivr.net/combine/npm/tippy.js@6.3.7/dist/tippy.css,npm/tippy.js@6.3.1/dist/svg-arrow.css,npm/tippy.js@6.3.7/themes/light-border.css,npm/tippy.js@6.3.7/animations/scale.css',
|
|
6
|
-
datepicker: 'https://cdn.jsdelivr.net/npm/vanillajs-datepicker@1.
|
|
5
|
+
datepicker: 'https://cdn.jsdelivr.net/npm/vanillajs-datepicker@1.3.3/dist/css/datepicker.min.css',
|
|
6
|
+
datepickerLang: 'https://cdn.jsdelivr.net/npm/vanillajs-datepicker@1.3.3/js/i18n/locales/{lang}.min.js'
|
|
7
7
|
}
|