@newlogic-digital/ui 3.7.5 → 4.0.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 +17 -31
- package/package.json +21 -12
- package/src/data/main.json +2 -32
- package/src/data/nav.json +12 -0
- package/src/icons.svg +0 -30
- package/src/pages/dialog/basic.json.latte +5 -0
- package/src/pages/email/index.json +12 -0
- package/src/pages/gdpr.json +11 -0
- package/src/pages/index.json +8 -0
- package/src/scripts/components/(ui)/+.js +12 -0
- package/src/scripts/components/(ui)/Button.js +4 -0
- package/src/scripts/components/(ui)/Compare.js +4 -0
- package/src/scripts/components/(ui)/Control.js +11 -0
- package/src/scripts/components/(ui)/ControlSelect.js +4 -0
- package/src/scripts/components/(ui)/Details.js +4 -0
- package/src/scripts/components/(ui)/Dialog.js +17 -0
- package/src/scripts/components/(ui)/Drawer.js +4 -0
- package/src/scripts/components/(ui)/Form.js +15 -0
- package/src/scripts/components/(ui)/Popover.js +4 -0
- package/src/scripts/components/(ui)/Range.js +4 -0
- package/src/scripts/components/(ui)/Tabs.js +4 -0
- package/src/scripts/components/(ui)/Toast.js +4 -0
- package/src/scripts/components/+.js +5 -0
- package/src/scripts/components/App.js +5 -0
- package/src/scripts/components/ReCaptcha.js +4 -0
- package/src/scripts/components/Reveal.js +4 -0
- package/src/scripts/components/cookieconsent/+.js +2 -0
- package/src/scripts/components/cookieconsent/CookieConsentDialog.js +4 -0
- package/src/scripts/components/cookieconsent/CookieConsentForm.js +4 -0
- package/src/scripts/composables/+.js +3 -0
- package/src/scripts/composables/naja.js +24 -0
- package/src/scripts/composables/stimulus.js +31 -0
- package/src/scripts/composables/swup.js +23 -0
- package/src/scripts/main.js +3 -6
- package/src/scripts/utils/+.js +1 -0
- package/src/scripts/{Utils → utils}/initAfter.js +3 -3
- package/src/styles/base/+.css +4 -0
- package/src/styles/{Utils/default.css → base/defaults.css} +11 -1
- package/src/styles/base/transitions.css +12 -0
- package/src/styles/components/(layout)/+.css +2 -0
- package/src/styles/components/(layout)/Header.css +11 -0
- package/src/styles/{Layout → components/(layout)}/Main.css +2 -13
- package/src/styles/components/(ui)/+.css +23 -0
- package/src/styles/components/(ui)/Badge.css +8 -0
- package/src/styles/components/(ui)/Button.css +12 -0
- package/src/styles/components/(ui)/Check.css +1 -0
- package/src/styles/components/(ui)/Compare.css +1 -0
- package/src/styles/components/(ui)/Control.css +29 -0
- package/src/styles/components/(ui)/ControlSelect.css +1 -0
- package/src/styles/components/(ui)/Drawer.css +14 -0
- package/src/styles/components/(ui)/Group.css +1 -0
- package/src/styles/components/(ui)/Heading.css +4 -0
- package/src/styles/components/(ui)/Image.css +1 -0
- package/src/styles/components/(ui)/Info.css +1 -0
- package/src/styles/components/(ui)/Label.css +1 -0
- package/src/styles/components/(ui)/Link.css +2 -0
- package/src/styles/components/(ui)/Notice.css +1 -0
- package/src/styles/components/(ui)/Progress.css +1 -0
- package/src/styles/components/(ui)/Range.css +1 -0
- package/src/styles/components/(ui)/Switch.css +1 -0
- package/src/styles/components/(ui)/Text.css +1 -0
- package/src/styles/components/(ui)/Title.css +4 -0
- package/src/styles/components/(ui)/dialog/+.css +2 -0
- package/src/styles/components/(ui)/dialog/Dialog.css +2 -0
- package/src/styles/components/(ui)/dialog/DialogContent.css +2 -0
- package/src/styles/components/+.css +3 -0
- package/src/styles/components/cookieconsent/+.css +1 -0
- package/src/styles/{Components/Dialog/CookieConsent.css → components/cookieconsent/CookieConsentDialog.css} +4 -4
- package/src/styles/emails/+.css +5 -0
- package/src/styles/emails/base/+.css +2 -0
- package/src/styles/emails/base/defaults.css +22 -0
- package/src/styles/emails/components/+.css +4 -0
- package/src/styles/emails/components/Button.css +31 -0
- package/src/styles/emails/components/Heading.css +7 -0
- package/src/styles/emails/components/Main.css +13 -0
- package/src/{emails/styles/main/Ui → styles/emails/components}/Text.css +7 -5
- package/src/styles/emails/main.css +9 -0
- package/src/styles/emails/theme/+.css +2 -0
- package/src/styles/emails/theme/config.css +5 -0
- package/src/styles/emails/theme/default.css +13 -0
- package/src/styles/emails/utils/+.css +1 -0
- package/src/styles/emails/utils/common.css +29 -0
- package/src/styles/main.css +5 -11
- package/src/styles/theme/+.css +2 -0
- package/src/styles/theme/dark.css +5 -0
- package/src/styles/theme/main.css +35 -0
- package/src/styles/tinymce.css +2 -34
- package/src/styles/utils/+.css +4 -0
- package/src/styles/utils/container.css +5 -0
- package/src/styles/utils/index.css +8 -0
- package/src/styles/utils/reveal.css +22 -0
- package/src/styles/utils/scrollbar.css +23 -0
- package/src/templates/components/(layout)/Footer.latte +1 -0
- package/src/templates/components/(layout)/Header.latte +7 -0
- package/src/templates/components/(ui)/Toast.latte +9 -0
- package/src/templates/{Sections/Text.latte → components/Content.latte} +3 -3
- package/src/templates/components/Example.latte +17 -0
- package/src/templates/{Sections/CookieConsent.latte → components/cookieconsent/CookieConsentContent.latte} +4 -4
- package/src/templates/components/cookieconsent/CookieConsentDialog.latte +27 -0
- package/src/templates/{Components/Form/CookieConsent.latte → components/cookieconsent/CookieConsentForm.latte} +9 -9
- package/src/templates/components/dialog/DialogBasic.latte +18 -0
- package/src/templates/emails/components/Content.latte +29 -0
- package/src/templates/emails/components/Footer.latte +13 -0
- package/src/templates/emails/components/Header.latte +8 -0
- package/src/{emails/templates.test/Layout.latte → templates/emails/layouts/default.latte} +12 -12
- package/src/templates/{Layout/Main.latte → layouts/default.latte} +24 -26
- package/vite.config.js +2 -21
- package/src/emails/styles/main/+.css +0 -3
- package/src/emails/styles/main/Base/+.css +0 -2
- package/src/emails/styles/main/Base/config.css +0 -22
- package/src/emails/styles/main/Components/+.css +0 -1
- package/src/emails/styles/main/Components/Card.css +0 -12
- package/src/emails/styles/main/Ui/+.css +0 -3
- package/src/emails/styles/main/Ui/Btn.css +0 -78
- package/src/emails/styles/main/Ui/Heading.css +0 -8
- package/src/emails/styles/main.css +0 -92
- package/src/emails/templates/.gitkeep +0 -0
- package/src/emails/templates.test/Sections/Footer.latte +0 -22
- package/src/emails/templates.test/Sections/Header.latte +0 -37
- package/src/emails/templates.test/Sections/Text.latte +0 -24
- package/src/scripts/Components/+.js +0 -2
- package/src/scripts/Components/Drawer.js +0 -60
- package/src/scripts/Components/Popover.js +0 -65
- package/src/scripts/Layout/+.js +0 -1
- package/src/scripts/Layout/Header.js +0 -20
- package/src/scripts/Libraries/+.js +0 -10
- package/src/scripts/Libraries/CookieConsent.js +0 -80
- package/src/scripts/Libraries/Dialog.js +0 -28
- package/src/scripts/Libraries/Form.js +0 -13
- package/src/scripts/Libraries/Naja.js +0 -37
- package/src/scripts/Libraries/ReCaptcha.js +0 -25
- package/src/scripts/Libraries/Reveal.js +0 -32
- package/src/scripts/Libraries/Ripple.js +0 -8
- package/src/scripts/Libraries/Stimulus.js +0 -56
- package/src/scripts/Libraries/Swup.js +0 -77
- package/src/scripts/Libraries/Toaster.js +0 -55
- package/src/scripts/Sections/+.js +0 -0
- package/src/scripts/Ui/+.js +0 -4
- package/src/scripts/Ui/Check.js +0 -8
- package/src/scripts/Ui/Control.js +0 -194
- package/src/scripts/Ui/ControlSelect.js +0 -25
- package/src/scripts/Ui/Text.js +0 -21
- package/src/scripts/Utils/+.js +0 -3
- package/src/scripts/Utils/cdn.js +0 -5
- package/src/scripts/Utils/naja.js +0 -41
- package/src/scripts/Utils/utilities.js +0 -8
- package/src/styles/Components/+.css +0 -5
- package/src/styles/Components/Dialog/+.css +0 -3
- package/src/styles/Components/Dialog/Content.css +0 -2
- package/src/styles/Components/Dialog/Default.css +0 -2
- package/src/styles/Components/Drawer.css +0 -18
- package/src/styles/Layout/+.css +0 -3
- package/src/styles/Layout/Header.css +0 -18
- package/src/styles/Layout/Nav.css +0 -23
- package/src/styles/Libraries/+.css +0 -2
- package/src/styles/Libraries/Datepicker.css +0 -54
- package/src/styles/Libraries/Pickr.css +0 -13
- package/src/styles/Sections/+.css +0 -1
- package/src/styles/Ui/+.css +0 -16
- package/src/styles/Ui/Badge.css +0 -8
- package/src/styles/Ui/Btn.css +0 -14
- package/src/styles/Ui/Check.css +0 -1
- package/src/styles/Ui/Control.css +0 -57
- package/src/styles/Ui/ControlSelect.css +0 -57
- package/src/styles/Ui/Group.css +0 -1
- package/src/styles/Ui/Heading.css +0 -4
- package/src/styles/Ui/Image.css +0 -1
- package/src/styles/Ui/Info.css +0 -1
- package/src/styles/Ui/Label.css +0 -1
- package/src/styles/Ui/Link.css +0 -8
- package/src/styles/Ui/Notice.css +0 -9
- package/src/styles/Ui/Progress.css +0 -1
- package/src/styles/Ui/Switch.css +0 -1
- package/src/styles/Ui/Text.css +0 -1
- package/src/styles/Ui/Title.css +0 -4
- package/src/styles/Utils/+.css +0 -6
- package/src/styles/Utils/config.css +0 -16
- package/src/styles/Utils/theme/+.css +0 -1
- package/src/styles/Utils/theme/main.css +0 -33
- package/src/styles/Utils/utilities.css +0 -42
- package/src/templates/Components/Dialog/Basic.latte +0 -24
- package/src/templates/Components/Dialog/CookieConsent.latte +0 -27
- package/src/templates/Layout/Footer.latte +0 -0
- package/src/templates/Layout/Header.latte +0 -38
- package/src/templates/Sections/Site.latte +0 -213
- package/src/templates/Sections/Ui/Docs/@intro.html +0 -48
- package/src/templates/Sections/Ui/Docs/@nav.html +0 -134
- package/src/templates/Sections/Ui/Docs/@styles.html +0 -96
- package/src/templates/Sections/Ui/Docs/Default.latte +0 -979
- package/src/templates/Sections/Ui/Icons.html +0 -30
- package/src/templates/Sections/Ui/Intro.html +0 -119
- package/src/templates/Sections/Ui.latte +0 -8
- package/src/templates/Ui/+.latte +0 -5
- package/src/templates/Ui/Check.latte +0 -7
- package/src/templates/Ui/Control.latte +0 -9
- package/src/templates/Ui/ControlDate.latte +0 -14
- package/src/templates/Ui/ControlSelect.latte +0 -9
- package/src/templates/Ui/ControlTime.latte +0 -14
- package/src/views/dialog/basic.json.latte +0 -5
- package/src/views/email/email.latte +0 -6
- package/src/views/email/email.test.latte +0 -6
- package/src/views/gdpr.json +0 -14
- package/src/views/index.json +0 -12
- package/src/views/popover/info.json.latte +0 -15
- package/src/views/site.json +0 -11
- package/src/views/ui-icons.json +0 -12
- package/src/views/ui.json +0 -11
- /package/src/styles/{Utils → base}/breakpoints.css +0 -0
- /package/src/styles/{Utils → base}/keyframes.css +0 -0
- /package/src/styles/{Components → components/(ui)}/Field.css +0 -0
- /package/src/styles/{Components → components/(ui)}/Popover.css +0 -0
- /package/src/styles/{Components → components/(ui)}/Toaster.css +0 -0
- /package/src/{emails/styles/main/Base/font.css → styles/emails/base/fonts.css} +0 -0
- /package/src/templates/{Utils → utils}/sections.latte +0 -0
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { LibStimulus, Controller } from '../Libraries/Stimulus.js'
|
|
2
|
-
import { showDrawer, closeDrawer, scrollDrawer } from 'winduum/src/components/drawer/index.js'
|
|
3
|
-
|
|
4
|
-
LibStimulus.register('c-drawer', class extends Controller {
|
|
5
|
-
static values = {
|
|
6
|
-
inertMatch: {
|
|
7
|
-
type: String,
|
|
8
|
-
default: ':where(.c-drawer, .l-header)'
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
connect() {
|
|
13
|
-
this.scrollReset()
|
|
14
|
-
this.element.addEventListener('click', ({ target }) => {
|
|
15
|
-
if (target === this.element) this.close()
|
|
16
|
-
})
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
scrollReset() {
|
|
20
|
-
this.element.scroll({ left: this.element.scrollWidth, behavior: 'instant' })
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
scroll({ target }) {
|
|
24
|
-
scrollDrawer(target)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
inert(inert) {
|
|
28
|
-
[...document.body.children].forEach((element) => {
|
|
29
|
-
if (!element.matches(this.inertMatchValue)) (element.inert = inert)
|
|
30
|
-
})
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
show() {
|
|
34
|
-
this.scrollReset()
|
|
35
|
-
this.element.classList.add('active')
|
|
36
|
-
showDrawer(this.element)
|
|
37
|
-
this.inert(true)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
close() {
|
|
41
|
-
closeDrawer(this.element)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
toggle({ currentTarget }) {
|
|
45
|
-
this.activeButton = currentTarget
|
|
46
|
-
|
|
47
|
-
if (!currentTarget.classList.contains('active')) {
|
|
48
|
-
currentTarget.classList.add('active')
|
|
49
|
-
this.show()
|
|
50
|
-
} else {
|
|
51
|
-
this.close()
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
dismiss() {
|
|
56
|
-
this.element.classList.remove('active')
|
|
57
|
-
this.activeButton?.classList?.remove('active')
|
|
58
|
-
this.inert(false)
|
|
59
|
-
}
|
|
60
|
-
})
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { Controller, LibStimulus } from '../Libraries/Stimulus.js'
|
|
2
|
-
import { dataset, fetchJson } from '@newlogic-digital/utils-js'
|
|
3
|
-
import initAfter from '../Utils/initAfter.js'
|
|
4
|
-
|
|
5
|
-
LibStimulus.register('c-popover', class extends Controller {
|
|
6
|
-
static values = {
|
|
7
|
-
url: String,
|
|
8
|
-
insertTo: String,
|
|
9
|
-
manual: Boolean
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
async toggle({ currentTarget, params }) {
|
|
13
|
-
const { togglePopover } = await import('winduum/src/components/popover/index.js')
|
|
14
|
-
const hasUrlValue = this.hasUrlValue && !this.popoverTarget
|
|
15
|
-
|
|
16
|
-
if (hasUrlValue) await this.fetch()
|
|
17
|
-
|
|
18
|
-
this.popoverTarget = document.getElementById(currentTarget.getAttribute('popovertarget'))
|
|
19
|
-
|
|
20
|
-
if (hasUrlValue) initAfter(this.popoverTarget)
|
|
21
|
-
|
|
22
|
-
await togglePopover(currentTarget, params)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
async hide() {
|
|
26
|
-
if (this.popoverActionTarget.ariaExpanded !== 'true') return
|
|
27
|
-
|
|
28
|
-
const { hidePopover } = await import('winduum/src/components/popover/index.js')
|
|
29
|
-
|
|
30
|
-
await hidePopover(this.popoverActionTarget)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
async dismiss({ target }) {
|
|
34
|
-
if (this.popoverActionTarget.ariaExpanded !== 'true') return
|
|
35
|
-
|
|
36
|
-
if (!this.popoverTarget.contains(target) && !this.popoverActionTarget.isEqualNode(target) && this.popoverActionTarget.ariaExpanded === 'true') {
|
|
37
|
-
await this.hide()
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
async fetch() {
|
|
42
|
-
this.popoverActionTarget.classList.add('loading', 'cursor-wait')
|
|
43
|
-
|
|
44
|
-
const { content } = await fetchJson(this.urlValue)
|
|
45
|
-
|
|
46
|
-
this.popoverActionTarget.classList.remove('loading', 'cursor-wait')
|
|
47
|
-
|
|
48
|
-
const insertElement = !this.hasInsertToValue ? this.popoverActionTarget : document.querySelector(this.insertToValue)
|
|
49
|
-
insertElement.insertAdjacentHTML(!this.hasInsertToValue ? 'afterend' : 'beforeend', content)
|
|
50
|
-
|
|
51
|
-
return content
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
connect() {
|
|
55
|
-
this.popoverActionTarget = this.element.querySelector('[popovertargetaction]')
|
|
56
|
-
|
|
57
|
-
if (!this.popoverActionTarget) return
|
|
58
|
-
|
|
59
|
-
;(!this.hasManualValue || !this.manualValue) && dataset(this.popoverActionTarget, 'action').add(
|
|
60
|
-
`click->c-popover#${this.popoverActionTarget.getAttribute('popovertargetaction')}:prevent`,
|
|
61
|
-
'keydown.esc@window->c-popover#hide',
|
|
62
|
-
'click@window->c-popover#dismiss'
|
|
63
|
-
)
|
|
64
|
-
}
|
|
65
|
-
})
|
package/src/scripts/Layout/+.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import './Header.js'
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { LibStimulus, Controller } from '../Libraries/Stimulus.js'
|
|
2
|
-
|
|
3
|
-
LibStimulus.register('l-header', class extends Controller {
|
|
4
|
-
static targets = ['logo', 'nav']
|
|
5
|
-
|
|
6
|
-
connect() {
|
|
7
|
-
if (!document.querySelector('.l-nav')) {
|
|
8
|
-
this.element.insertAdjacentHTML('afterend', `
|
|
9
|
-
<div class="l-nav c-drawer" data-controller="c-drawer" data-action="scroll->c-drawer#scroll c-drawer:close->c-drawer#dismiss" inert>
|
|
10
|
-
<div class="c-drawer-content"></div>
|
|
11
|
-
</div>
|
|
12
|
-
`)
|
|
13
|
-
|
|
14
|
-
const drawerContentElement = document.querySelector('.l-nav .c-drawer-content')
|
|
15
|
-
|
|
16
|
-
drawerContentElement.insertAdjacentHTML('beforeend', this.logoTarget.outerHTML)
|
|
17
|
-
drawerContentElement.insertAdjacentHTML('beforeend', this.navTarget.outerHTML)
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
})
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { LibStimulus, Controller } from './Stimulus.js'
|
|
2
|
-
import { appendCookieConsent, setCookieConsent } from '@newlogic-digital/cookieconsent-js'
|
|
3
|
-
import { showDialog, closeDialog } from 'winduum/src/components/dialog/index.js'
|
|
4
|
-
|
|
5
|
-
export const getCookieConsentItem = (key = 'cookieconsent-js') => localStorage.getItem(key)
|
|
6
|
-
|
|
7
|
-
export const initCookieConsent = (element = document, type = getCookieConsentItem() ?? []) => {
|
|
8
|
-
element.querySelectorAll('[data-lib-cookieconsent]').forEach((element) => {
|
|
9
|
-
if (type.includes(element.getAttribute('data-lib-cookieconsent'))) {
|
|
10
|
-
appendCookieConsent(element, {
|
|
11
|
-
ignoreAttributeName: /(type|data-lib-cookieconsent)/
|
|
12
|
-
})
|
|
13
|
-
}
|
|
14
|
-
})
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
LibStimulus.register('c-dialog-cookieconsent', class extends Controller {
|
|
18
|
-
async connect() {
|
|
19
|
-
initCookieConsent()
|
|
20
|
-
|
|
21
|
-
if (document.querySelector('.c-form-cookieconsent')) {
|
|
22
|
-
return
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (!getCookieConsentItem() || parseInt(getCookieConsentItem('cookieconsent-js-expire')) < Date.now()) {
|
|
26
|
-
setTimeout(async () => {
|
|
27
|
-
await showDialog(this.element, { closable: false })
|
|
28
|
-
}, 1500)
|
|
29
|
-
} else {
|
|
30
|
-
this.element.remove()
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
async approve() {
|
|
35
|
-
await this.hide(['performance', 'marketing'])
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
async decline() {
|
|
39
|
-
await this.hide([])
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
async hide(type) {
|
|
43
|
-
await setCookieConsent(type)
|
|
44
|
-
initCookieConsent(document, type)
|
|
45
|
-
await closeDialog(this.element, { remove: true })
|
|
46
|
-
}
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
LibStimulus.register('c-form-cookieconsent', class extends Controller {
|
|
50
|
-
connect() {
|
|
51
|
-
document.querySelector('.c-dialog-cookieconsent')?.close()
|
|
52
|
-
|
|
53
|
-
this.element.querySelectorAll('input:not([disabled])').forEach((input) => {
|
|
54
|
-
input.checked = false
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
JSON.parse(getCookieConsentItem())?.forEach((type) => {
|
|
58
|
-
if (this.element.querySelector(`input[value="${type}"]`) !== null) {
|
|
59
|
-
this.element.querySelector(`input[value="${type}"]`).checked = true
|
|
60
|
-
}
|
|
61
|
-
})
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
async update() {
|
|
65
|
-
const type = []
|
|
66
|
-
|
|
67
|
-
this.element.querySelectorAll('input:not([disabled])').forEach((input) => {
|
|
68
|
-
input.checked && type.push(input.value)
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
await setCookieConsent(type)
|
|
72
|
-
location.reload()
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
disconnect() {
|
|
76
|
-
if ((!getCookieConsentItem() || parseInt(getCookieConsentItem('cookieconsent-js-expire')) < Date.now())) {
|
|
77
|
-
document.querySelector('.c-dialog-cookieconsent')?.showModal()
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
})
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Controller, LibStimulus } from './../Libraries/Stimulus.js'
|
|
2
|
-
import { insertDialog, closeDialog, dialogSelector } from 'winduum/src/components/dialog/index.js'
|
|
3
|
-
import initAfter from '../Utils/initAfter.js'
|
|
4
|
-
import { fetchJson } from '@newlogic-digital/utils-js'
|
|
5
|
-
|
|
6
|
-
LibStimulus.register('lib-dialog', class extends Controller {
|
|
7
|
-
async show({ currentTarget, params }) {
|
|
8
|
-
const loadingClasses = (params.loadingClass ?? 'loading cursor-wait').split(' ')
|
|
9
|
-
|
|
10
|
-
currentTarget.classList.add(...loadingClasses)
|
|
11
|
-
|
|
12
|
-
await this.fetch(params.url, params)
|
|
13
|
-
|
|
14
|
-
currentTarget.classList.remove(...loadingClasses)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
async close({ currentTarget, params }) {
|
|
18
|
-
await closeDialog(currentTarget.closest('dialog'), { remove: params.remove ?? true })
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
async fetch(url, options) {
|
|
22
|
-
const { content } = await fetchJson(url)
|
|
23
|
-
|
|
24
|
-
await insertDialog(content, options)
|
|
25
|
-
|
|
26
|
-
initAfter(dialogSelector('.c-dialog'))
|
|
27
|
-
}
|
|
28
|
-
})
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { LibStimulus, Controller } from './Stimulus.js'
|
|
2
|
-
import { validateForm } from 'winduum/src/components/form/index.js'
|
|
3
|
-
|
|
4
|
-
LibStimulus.register('lib-form', class extends Controller {
|
|
5
|
-
connect() {
|
|
6
|
-
this.element.noValidate = true
|
|
7
|
-
this.element.addEventListener('submit', this.validate)
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
async validate(event) {
|
|
11
|
-
validateForm(event)
|
|
12
|
-
}
|
|
13
|
-
})
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Controller, LibStimulus, initStimulus } from './Stimulus.js'
|
|
2
|
-
import { initCookieConsent } from './CookieConsent.js'
|
|
3
|
-
import {
|
|
4
|
-
initNaja,
|
|
5
|
-
NajaRecaptchaExtension,
|
|
6
|
-
NajaFormValidityExtension
|
|
7
|
-
} from '../Utils/naja.js'
|
|
8
|
-
import naja from 'naja'
|
|
9
|
-
import LibSwup from './Swup.js'
|
|
10
|
-
|
|
11
|
-
LibStimulus.register('lib-naja', class extends Controller {
|
|
12
|
-
async initialize() {
|
|
13
|
-
naja.uiHandler.selector = '[data-naja]'
|
|
14
|
-
|
|
15
|
-
await initNaja(this.element, false)
|
|
16
|
-
|
|
17
|
-
if (naja.initialized) return
|
|
18
|
-
|
|
19
|
-
naja.uiHandler.addEventListener('interaction', ({ detail }) => {
|
|
20
|
-
detail.element.dispatchEvent(new CustomEvent('naja:interaction', { bubbles: true, cancelable: true }))
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
naja.snippetHandler.addEventListener('afterUpdate', ({ detail }) => {
|
|
24
|
-
detail.snippet.dispatchEvent(new CustomEvent('naja:afterUpdate', { bubbles: true, cancelable: true }))
|
|
25
|
-
|
|
26
|
-
initStimulus(detail.snippet)
|
|
27
|
-
initNaja(detail.snippet)
|
|
28
|
-
initCookieConsent(detail.snippet)
|
|
29
|
-
|
|
30
|
-
LibSwup.cache.clear()
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
naja.registerExtension(NajaRecaptchaExtension)
|
|
34
|
-
naja.registerExtension(NajaFormValidityExtension)
|
|
35
|
-
naja.initialize()
|
|
36
|
-
}
|
|
37
|
-
})
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { LibStimulus, Controller } from './Stimulus.js'
|
|
2
|
-
import { importScript } from '@newlogic-digital/utils-js'
|
|
3
|
-
import cdn from '../Utils/cdn.js'
|
|
4
|
-
|
|
5
|
-
LibStimulus.register('lib-recaptcha', class extends Controller {
|
|
6
|
-
static values = {
|
|
7
|
-
api: String,
|
|
8
|
-
action: String
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
connect() {
|
|
12
|
-
importScript(cdn.recaptcha.replace('{apikey}', this.apiValue))
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
execute(event) {
|
|
16
|
-
if (event?.detail?.recaptchaExecuted) return
|
|
17
|
-
|
|
18
|
-
window.grecaptcha.enterprise.ready(() => {
|
|
19
|
-
window.grecaptcha.enterprise.execute(this.apiValue, { action: this.actionValue ?? 'form' }).then((token) => {
|
|
20
|
-
this.element.gtoken.value = token
|
|
21
|
-
this.element.dispatchEvent(new CustomEvent('submit', { cancelable: true, detail: { recaptchaExecuted: true } }))
|
|
22
|
-
})
|
|
23
|
-
})
|
|
24
|
-
}
|
|
25
|
-
})
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Controller, LibStimulus } from './Stimulus.js'
|
|
2
|
-
import { dataset } from '@newlogic-digital/utils-js'
|
|
3
|
-
|
|
4
|
-
LibStimulus.register('lib-reveal', class extends Controller {
|
|
5
|
-
static targets = ['item']
|
|
6
|
-
|
|
7
|
-
intersectionObserver() {
|
|
8
|
-
this.observer = new IntersectionObserver((entries, observer) => {
|
|
9
|
-
entries.forEach((entry) => {
|
|
10
|
-
if (entry.intersectionRatio > 0.1 && !entry.target.classList.contains('in')) {
|
|
11
|
-
entry.target.classList.add('in')
|
|
12
|
-
|
|
13
|
-
if (entry.target.dataset.controllerNameParam) {
|
|
14
|
-
dataset(entry.target, 'controller').add(entry.target.dataset.controllerNameParam)
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
})
|
|
18
|
-
}, {
|
|
19
|
-
threshold: 0.1
|
|
20
|
-
})
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
itemTargetConnected(element) {
|
|
24
|
-
if (!this.observer) this.intersectionObserver()
|
|
25
|
-
|
|
26
|
-
this.observer?.observe(element)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
itemTargetDisconnected(element) {
|
|
30
|
-
this.observer?.unobserve(element)
|
|
31
|
-
}
|
|
32
|
-
})
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { Application, Controller } from '@hotwired/stimulus'
|
|
2
|
-
import { dataset } from '@newlogic-digital/utils-js'
|
|
3
|
-
|
|
4
|
-
function initActions(parent, selectors) {
|
|
5
|
-
if (!parent) return
|
|
6
|
-
|
|
7
|
-
selectors.forEach(([selector, action]) => {
|
|
8
|
-
parent.querySelectorAll(selector).forEach((element) => {
|
|
9
|
-
dataset(element, 'action').add(action)
|
|
10
|
-
})
|
|
11
|
-
})
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function initControllers(parent, selectors) {
|
|
15
|
-
if (!parent) return
|
|
16
|
-
|
|
17
|
-
selectors.forEach((selector) => {
|
|
18
|
-
[...parent.getElementsByClassName(selector)].forEach((element) => {
|
|
19
|
-
dataset(element, 'controller').add(selector)
|
|
20
|
-
})
|
|
21
|
-
})
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function initStimulus(element, { controllers, actions } = {
|
|
25
|
-
controllers: ['ui-control', 'ui-text', 'ui-check'],
|
|
26
|
-
actions: [['.ui-btn', 'click->lib-ripple#show'], ['.ui-check', 'change->ui-check#validate']]
|
|
27
|
-
}) {
|
|
28
|
-
initControllers(element, controllers)
|
|
29
|
-
initActions(element, actions)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const LibStimulus = new Application(document.documentElement)
|
|
33
|
-
|
|
34
|
-
const getController = (...arg) => LibStimulus.getControllerForElementAndIdentifier(...arg)
|
|
35
|
-
|
|
36
|
-
const delegateController = (name, method, event = {}, selector) => {
|
|
37
|
-
const controller = getController(document.querySelector(selector || `.${name}`), name)
|
|
38
|
-
|
|
39
|
-
if (controller) return method ? controller[method](event) : controller
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
LibStimulus.start().then(() => initStimulus(document.body))
|
|
43
|
-
|
|
44
|
-
LibStimulus.register('controller', class extends Controller {
|
|
45
|
-
delegate(event) {
|
|
46
|
-
delegateController(event.params.name, event.params.method, event, event.params.selector)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
load({ currentTarget, params }) {
|
|
50
|
-
dataset(currentTarget, 'controller').add(params.name)
|
|
51
|
-
}
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
window.LibStimulus = { default: LibStimulus, Controller, initStimulus, delegateController }
|
|
55
|
-
|
|
56
|
-
export { LibStimulus, Controller, initStimulus, getController, delegateController }
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { dialogSelector } from 'winduum/src/components/dialog/index.js'
|
|
2
|
-
import { delegateController } from './Stimulus.js'
|
|
3
|
-
import Swup from 'swup'
|
|
4
|
-
import initAfter from '../Utils/initAfter.js'
|
|
5
|
-
|
|
6
|
-
const LibSwup = new Swup({
|
|
7
|
-
containers: ['.l-main', '.l-header'].filter(element => document.querySelector(element)),
|
|
8
|
-
ignoreVisit: (url, { el }) => el?.closest('[data-no-swup], [data-naja]'),
|
|
9
|
-
animationSelector: '.swup-transition'
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
LibSwup.hooks.on('animation:out:start', async () => {
|
|
13
|
-
document.body.classList.remove('overflow-hidden')
|
|
14
|
-
|
|
15
|
-
delegateController('c-drawer', 'close')
|
|
16
|
-
delegateController('lib-dialog', 'close', {
|
|
17
|
-
currentTarget: dialogSelector('.c-dialog')
|
|
18
|
-
}, 'body')
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
LibSwup.hooks.before('scroll:top', (visit, { options }) => {
|
|
22
|
-
if (visit.from.url !== visit.to.url) (options.behavior = 'instant')
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
/** @var {Array} dataLayer */
|
|
26
|
-
/** @var {Function} rc */
|
|
27
|
-
/** @var {Function} retargetingHit */
|
|
28
|
-
/** @var {Function} conversionHit */
|
|
29
|
-
/** @var {Object} retargetingConf */
|
|
30
|
-
/** @var {Object} conversionConf */
|
|
31
|
-
/** @var {Function} fbq */
|
|
32
|
-
LibSwup.hooks.on('content:replace', (visit, { page }) => {
|
|
33
|
-
const content = new DOMParser().parseFromString(page.html, 'text/html')
|
|
34
|
-
|
|
35
|
-
content.querySelectorAll('[data-lib-replace-tag]').forEach((element) => {
|
|
36
|
-
const replaceTag = document.querySelector(`[data-lib-replace-tag="${element.dataset.libReplaceTag}"]`)
|
|
37
|
-
const placement = element.closest('head') ? document.head : replaceTag.parentElement
|
|
38
|
-
|
|
39
|
-
replaceTag ? (replaceTag.outerHTML = element.outerHTML) : placement.insertAdjacentHTML('beforeend', element.outerHTML)
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
LibSwup.options.containers.forEach((selector) => {
|
|
43
|
-
initAfter(document.querySelector(selector))
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
window.dataLayer && window.dataLayer.push({
|
|
47
|
-
event: 'page_view'
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
window.rc?.retargetingHit && window.rc.retargetingHit(window.retargetingConf ?? {})
|
|
51
|
-
window.rc?.conversionHit && window.rc.conversionHit(window.conversionConf ?? {})
|
|
52
|
-
|
|
53
|
-
window.fbq && window.fbq('track', 'PageView')
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
LibSwup.hooks.on('cache:set', (visit, { page }) => {
|
|
57
|
-
LibSwup.cache.update(page.url, { created: Date.now(), ttl: 1000 * 60 })
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
LibSwup.hooks.before('page:load', () => {
|
|
61
|
-
// noinspection JSCheckFunctionSignatures
|
|
62
|
-
LibSwup.cache.prune((url, { created, ttl }) => Date.now() > created + ttl)
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
document.addEventListener('click', ({ target }) => {
|
|
66
|
-
const noSwup = target.closest('[data-no-swup]')
|
|
67
|
-
|
|
68
|
-
if (!noSwup) return
|
|
69
|
-
|
|
70
|
-
if (noSwup.classList.contains('ui-btn')) {
|
|
71
|
-
noSwup.classList.add('loading')
|
|
72
|
-
} else {
|
|
73
|
-
noSwup.classList.add('cursor-wait')
|
|
74
|
-
}
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
export default LibSwup
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { Controller, LibStimulus } from '../Libraries/Stimulus.js'
|
|
2
|
-
|
|
3
|
-
export const insertToaster = async (element, options) => {
|
|
4
|
-
if (!document.querySelector('.c-toaster')) {
|
|
5
|
-
element.insertAdjacentHTML('beforeend', `<ol class="c-toaster ${options?.classes ?? ''}" data-lib-toaster-target="toaster"></ol>`)
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const insertToast = async (element, options) => {
|
|
10
|
-
const { showToast } = await import('winduum/src/components/toaster/index.js')
|
|
11
|
-
|
|
12
|
-
element.insertAdjacentHTML('beforeend', `
|
|
13
|
-
<li class="c-toast ${options.classes ?? ''}" role="status" aria-live="assertive" aria-atomic="true" data-controller="c-toast">
|
|
14
|
-
<div class="c-toast-content border-main/10">
|
|
15
|
-
<div class="flex-col gap-0.5">
|
|
16
|
-
<div class="ui-title empty:hidden">${options.title ?? ''}</div>
|
|
17
|
-
<div class="ui-title sm font-normal empty:hidden text-main/70">${options.text ?? ''}</div>
|
|
18
|
-
</div>
|
|
19
|
-
<button class="ui-btn sm circle muted ml-auto accent-main -mr-1" data-action="c-toast#close">
|
|
20
|
-
<svg class="size-4">
|
|
21
|
-
<use href="#icon-x-mark"></use>
|
|
22
|
-
</svg>
|
|
23
|
-
</button>
|
|
24
|
-
</div>
|
|
25
|
-
</li>
|
|
26
|
-
`)
|
|
27
|
-
|
|
28
|
-
await showToast(element.children[element.children.length - 1], {
|
|
29
|
-
autoHide: false,
|
|
30
|
-
...options?.show
|
|
31
|
-
})
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
LibStimulus.register('lib-toaster', class extends Controller {
|
|
35
|
-
static targets = ['toaster', 'show']
|
|
36
|
-
|
|
37
|
-
async show({ params }) {
|
|
38
|
-
await insertToaster(document.querySelector('dialog[open]') || document.body)
|
|
39
|
-
await insertToast(this.toasterTarget, params)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
async showTargetConnected(element) {
|
|
43
|
-
await this.show({
|
|
44
|
-
params: JSON.parse(element.innerHTML)
|
|
45
|
-
})
|
|
46
|
-
}
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
LibStimulus.register('c-toast', class extends Controller {
|
|
50
|
-
async close() {
|
|
51
|
-
const { closeToast } = await import('winduum/src/components/toaster/index.js')
|
|
52
|
-
|
|
53
|
-
await closeToast(this.element)
|
|
54
|
-
}
|
|
55
|
-
})
|
|
File without changes
|
package/src/scripts/Ui/+.js
DELETED
package/src/scripts/Ui/Check.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { LibStimulus, Controller } from '../Libraries/Stimulus.js'
|
|
2
|
-
import { validateField } from 'winduum/src/components/form/index.js'
|
|
3
|
-
|
|
4
|
-
LibStimulus.register('ui-check', class extends Controller {
|
|
5
|
-
async validate({ currentTarget }) {
|
|
6
|
-
validateField(currentTarget)
|
|
7
|
-
}
|
|
8
|
-
})
|