@newlogic-digital/ui 3.0.1 → 3.1.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 +8 -12
- package/gulpfile.js +16 -168
- package/package.json +13 -8
- package/src/emails/email.css +15 -9
- package/src/emails/email.twig +7 -7
- package/src/icons.svg +32 -0
- package/src/main.json +14 -27
- package/src/scripts/Components/+.js +2 -2
- package/src/scripts/Components/CookieConsent.js +66 -64
- package/src/scripts/Components/Form.js +28 -21
- 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 +12 -10
- package/src/scripts/Libraries/Anchor.js +18 -43
- package/src/scripts/Libraries/CookieConsent.js +37 -58
- package/src/scripts/Libraries/Dialog.js +56 -55
- package/src/scripts/Libraries/Drawer.js +23 -23
- 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/Stimulus.js +30 -34
- package/src/scripts/Libraries/Swup.js +47 -50
- 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/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/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/Components/Item/+.css +1 -0
- package/src/styles/Layout/+.css +2 -0
- package/src/{templates/Components/Dialogs/.gitkeep → styles/Layout/Header.css} +0 -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 -15
- 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/Sections/+.css +1 -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/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 -0
- package/src/styles/Utils/tailwind/base.css +15 -0
- package/src/styles/Utils/tailwind/gutters.css +264 -263
- 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 +6 -3
- package/src/styles/tailwind.css +1 -4
- 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 +47 -64
- package/src/templates/Sections/Gdpr.twig +64 -0
- package/src/templates/Sections/Ui.twig +2104 -0
- package/src/templates/dialog-basic.twig +2 -2
- package/src/templates/gdpr.json +11 -0
- package/src/templates/index.json +8 -2
- package/src/templates/json-tippy.twig +16 -0
- package/src/templates/ui.json +11 -0
- package/CHANGELOG +0 -231
- package/src/icons/selection.json +0 -1
- package/src/icons/style.css +0 -171
- package/src/icons/variables.css +0 -31
- 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/templates/Layout/Preload.twig +0 -21
- package/src/templates/Sections/.gitkeep +0 -0
|
@@ -1,82 +1,79 @@
|
|
|
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
6
|
|
|
7
7
|
const LibSwup = new Swup({
|
|
8
|
-
containers: ['#l-main'],
|
|
9
|
-
linkSelector:
|
|
10
|
-
})
|
|
8
|
+
containers: ['#l-main', '#l-header'].filter(element => document.querySelector(element)),
|
|
9
|
+
linkSelector: `:is(a[href^="${window.location.origin}"], a[href^="/"]):not([data-no-swup], [data-naja], [target="_blank"])`
|
|
10
|
+
})
|
|
11
11
|
|
|
12
|
-
LibSwup.on('clickLink', () => {
|
|
13
|
-
document.body.classList.remove(
|
|
12
|
+
LibSwup.on('clickLink', async() => {
|
|
13
|
+
document.body.classList.remove('overflow-hidden')
|
|
14
14
|
|
|
15
|
-
if (document.querySelector(
|
|
16
|
-
|
|
15
|
+
if (document.querySelector('.lib-drawer[data-state~="active"]') !== null) {
|
|
16
|
+
getController(document.body, 'lib-drawer').hide()
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
if (document.querySelector(
|
|
20
|
-
LibDialog.hide()
|
|
19
|
+
if (document.querySelector('.lib-dialog') !== null) {
|
|
20
|
+
await LibDialog.hide()
|
|
21
21
|
}
|
|
22
|
-
})
|
|
22
|
+
})
|
|
23
23
|
|
|
24
24
|
LibSwup.on('animationOutDone', () => {
|
|
25
|
-
|
|
26
|
-
})
|
|
25
|
+
document.documentElement.scroll({ top: 0, behavior: 'instant' })
|
|
26
|
+
})
|
|
27
27
|
|
|
28
28
|
LibSwup.on('contentReplaced', () => {
|
|
29
|
-
const content = new DOMParser().parseFromString(LibSwup.cache
|
|
29
|
+
const content = new DOMParser().parseFromString(LibSwup.cache.getCurrentPage().originalContent, 'text/html')
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
content.head.querySelectorAll('[data-lib-swup-replace]').forEach(element => {
|
|
32
|
+
const tag = document.querySelector(`[data-lib-swup-replace=${element.dataset.libSwupReplace}]`)
|
|
33
33
|
|
|
34
34
|
if (tag !== null) {
|
|
35
35
|
tag.outerHTML = element.outerHTML
|
|
36
36
|
} else {
|
|
37
|
-
document.head.insertAdjacentHTML(
|
|
37
|
+
document.head.insertAdjacentHTML('beforeend', element.outerHTML)
|
|
38
38
|
}
|
|
39
|
-
})
|
|
39
|
+
})
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
loadStimulus(document.querySelector(selector));
|
|
43
|
-
});
|
|
41
|
+
LibAnchor.init()
|
|
44
42
|
|
|
45
|
-
|
|
43
|
+
LibSwup.options.containers.forEach(selector => {
|
|
44
|
+
loadStimulus(document.querySelector(selector))
|
|
45
|
+
})
|
|
46
46
|
|
|
47
|
-
if (typeof window.fbq !==
|
|
48
|
-
window.fbq('track', 'PageView')
|
|
47
|
+
if (typeof window.fbq !== 'undefined') {
|
|
48
|
+
window.fbq('track', 'PageView')
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
if (typeof gtag !==
|
|
52
|
-
|
|
53
|
-
window.dataLayer.forEach(function
|
|
54
|
-
if (config[0] ===
|
|
55
|
-
if (typeof config[1] !==
|
|
56
|
-
configs.push(config[1])
|
|
51
|
+
if (typeof gtag !== 'undefined') {
|
|
52
|
+
const configs = []
|
|
53
|
+
window.dataLayer.forEach(function(config) {
|
|
54
|
+
if (config[0] === 'config') {
|
|
55
|
+
if (typeof config[1] !== 'undefined' && !configs.includes(config[1])) {
|
|
56
|
+
configs.push(config[1])
|
|
57
57
|
window.gtag('config', config[1], {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
})
|
|
58
|
+
page_title: document.title,
|
|
59
|
+
page_path: window.location.pathname + window.location.search
|
|
60
|
+
})
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
})
|
|
63
|
+
})
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
if (typeof window.dataLayer !==
|
|
66
|
+
if (typeof window.dataLayer !== 'undefined') {
|
|
67
67
|
window.dataLayer.push({
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
})
|
|
68
|
+
event: 'VirtualPageview',
|
|
69
|
+
virtualPageURL: window.location.pathname + window.location.search,
|
|
70
|
+
virtualPageTitle: document.title
|
|
71
|
+
})
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
if (typeof LibCookieConsent !==
|
|
75
|
-
LibCookieConsent.init()
|
|
74
|
+
if (typeof LibCookieConsent !== 'undefined') {
|
|
75
|
+
LibCookieConsent.init()
|
|
76
76
|
}
|
|
77
|
+
})
|
|
77
78
|
|
|
78
|
-
|
|
79
|
-
document.body.classList.add("is-body-loaded");
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
export default LibSwup;
|
|
79
|
+
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
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { loadStimulus, importStyle } from '../Utils/Functions/+.js'
|
|
2
|
+
import cdn from '../Utils/cdn.js'
|
|
3
|
+
|
|
4
|
+
export default class LibTippy {
|
|
5
|
+
async init(element, options, template) {
|
|
6
|
+
const tippy = (await import('tippy.js')).default
|
|
7
|
+
const { roundArrow } = await import('tippy.js')
|
|
8
|
+
|
|
9
|
+
await importStyle(cdn.tippy)
|
|
10
|
+
|
|
11
|
+
if (typeof element._tippy !== 'undefined') {
|
|
12
|
+
return false
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (this.type.includes('dropdown')) {
|
|
16
|
+
this.options.placement = 'bottom-end'
|
|
17
|
+
this.options.arrow = false
|
|
18
|
+
this.options.maxWidth = 'none'
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (this.type.includes('arrow')) {
|
|
22
|
+
options.arrow = roundArrow
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (!template.startsWith('/')) {
|
|
26
|
+
if (template !== '') {
|
|
27
|
+
options.content = document.querySelector('#' + template).innerHTML
|
|
28
|
+
} else {
|
|
29
|
+
options.content = `
|
|
30
|
+
<div class="ui-dropdown">
|
|
31
|
+
<div class="wrp_dropdown_body">
|
|
32
|
+
${element.getAttribute('aria-label')}
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
`
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (typeof element.dataset.libTippySlot !== 'undefined') {
|
|
40
|
+
for (const [key, value] of Object.entries(JSON.parse(element.dataset.libTippySlot))) {
|
|
41
|
+
options.content = options.content.replaceAll(`{${key}}`, value).replaceAll(`%7B${key}%7B`, value)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
tippy(element, options)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
constructor(element, attributes = ['tooltip', '']) {
|
|
49
|
+
const self = this
|
|
50
|
+
|
|
51
|
+
this.options = {
|
|
52
|
+
content: '',
|
|
53
|
+
placement: 'bottom',
|
|
54
|
+
trigger: 'mouseenter focus',
|
|
55
|
+
interactive: true,
|
|
56
|
+
appendTo: 'parent',
|
|
57
|
+
arrow: false,
|
|
58
|
+
theme: 'light-border',
|
|
59
|
+
animation: 'scale',
|
|
60
|
+
inertia: true,
|
|
61
|
+
allowHTML: true,
|
|
62
|
+
onShow: (instance) => {
|
|
63
|
+
let name = this.template
|
|
64
|
+
|
|
65
|
+
if (this.type.includes('-full')) {
|
|
66
|
+
instance.popper.classList.add('is-full')
|
|
67
|
+
document.documentElement.classList.add('m:is-body-overlay')
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (typeof name === 'undefined') {
|
|
71
|
+
name = this.type
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
instance.popper.querySelector('.tippy-box').setAttribute('data-name', name)
|
|
75
|
+
|
|
76
|
+
loadStimulus(instance.popper.querySelector('.tippy-content'))
|
|
77
|
+
},
|
|
78
|
+
onHide: () => {
|
|
79
|
+
if (this.type.includes('-full')) {
|
|
80
|
+
setTimeout(() => document.documentElement.classList.remove('m:is-body-overlay'), 50)
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
this.type = attributes[0]
|
|
86
|
+
this.template = attributes[1]
|
|
87
|
+
|
|
88
|
+
if (this.type.includes('dropdown')) {
|
|
89
|
+
this.options.trigger = 'click'
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (typeof element.dataset.tippyTrigger !== 'undefined') {
|
|
93
|
+
this.options.trigger = element.dataset.tippyTrigger
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
this.options.showOnCreate = true
|
|
97
|
+
|
|
98
|
+
this.options.trigger !== 'manual' && this.options.trigger.split(' ').forEach(event => {
|
|
99
|
+
element.addEventListener(event, async function e() {
|
|
100
|
+
if (self.template.startsWith('/') && self.options.content === '') {
|
|
101
|
+
element.style.cursor = 'wait'
|
|
102
|
+
|
|
103
|
+
fetch(self.template, { headers: { 'X-Requested-With': 'XMLHttpRequest' } }).then(response => {
|
|
104
|
+
return response.json()
|
|
105
|
+
}).then(async(data) => {
|
|
106
|
+
self.options.content = data.content
|
|
107
|
+
element.style.cursor = ''
|
|
108
|
+
await self.init(element, self.options, self.template)
|
|
109
|
+
element.removeEventListener(event, e)
|
|
110
|
+
})
|
|
111
|
+
} else {
|
|
112
|
+
await self.init(element, self.options, self.template)
|
|
113
|
+
element.removeEventListener(event, e)
|
|
114
|
+
}
|
|
115
|
+
})
|
|
116
|
+
})
|
|
117
|
+
}
|
|
118
|
+
}
|
package/src/scripts/Ui/+.js
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { LibStimulus, Controller } from '../Libraries/Stimulus.js'
|
|
2
|
+
|
|
3
|
+
LibStimulus.register('ui-checkbox', class extends Controller {
|
|
4
|
+
validate(element) {
|
|
5
|
+
element.parentNode._removeDataValue('state', 'valid invalid')
|
|
6
|
+
|
|
7
|
+
if (element.checkValidity()) {
|
|
8
|
+
element.parentNode._addDataValue('state', 'valid')
|
|
9
|
+
} else {
|
|
10
|
+
element.parentNode._addDataValue('state', 'invalid')
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
connect() {
|
|
15
|
+
const input = this.element.querySelector('input:not([type="hidden"])')
|
|
16
|
+
|
|
17
|
+
input.addEventListener('change', () => this.validate(input))
|
|
18
|
+
}
|
|
19
|
+
})
|