@newlogic-digital/ui 3.3.0 → 3.5.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 +10 -14
- package/package.json +23 -23
- package/src/data/main.json +2 -8
- package/src/emails/{templates/Content.twig → templates.test/Content.latte} +10 -2
- package/src/emails/{templates/Header.twig → templates.test/Header.latte} +1 -1
- package/src/emails/{templates/Layout.twig → templates.test/Layout.latte} +2 -2
- package/src/icons.svg +34 -28
- package/src/scripts/Components/CookieConsent.js +22 -28
- package/src/scripts/Layout/Header.js +25 -11
- package/src/scripts/Layout/Main.js +25 -55
- package/src/scripts/Libraries/+.js +4 -5
- package/src/scripts/Libraries/Dialog.js +37 -72
- package/src/scripts/Libraries/Drawer.js +22 -21
- package/src/scripts/Libraries/Form.js +8 -13
- package/src/scripts/Libraries/Naja.js +33 -0
- package/src/scripts/Libraries/ReCaptcha.js +14 -4
- package/src/scripts/Libraries/Ripple.js +6 -22
- package/src/scripts/Libraries/Script.js +1 -2
- package/src/scripts/Libraries/Slider.js +160 -0
- package/src/scripts/Libraries/Stimulus.js +0 -1
- package/src/scripts/Libraries/Swup.js +54 -38
- package/src/scripts/Libraries/Tippy.js +17 -20
- package/src/scripts/Ui/+.js +3 -3
- package/src/scripts/Ui/Check.js +8 -0
- package/src/scripts/Ui/Control.js +186 -0
- package/src/scripts/Ui/ControlSelect.js +24 -0
- package/src/scripts/Ui/Text.js +8 -10
- package/src/scripts/Utils/Functions/+.js +3 -3
- package/src/scripts/Utils/Functions/importScript.js +1 -1
- package/src/scripts/Utils/Functions/importStyle.js +1 -1
- package/src/scripts/Utils/Functions/inputStep.js +9 -0
- package/src/scripts/Utils/Functions/inputValidity.js +57 -0
- package/src/scripts/Utils/Functions/loadStimulus.js +12 -9
- package/src/scripts/Utils/Functions/replaceScript.js +4 -0
- package/src/scripts/Utils/Functions/replaceTag.js +1 -5
- package/src/scripts/Utils/cdn.js +2 -3
- package/src/scripts/Utils/global.js +1 -1
- package/src/styles/Components/+.css +1 -1
- package/src/styles/Components/CookieConsent.css +22 -25
- package/src/styles/Components/Dialog/Default.css +10 -62
- package/src/styles/Components/Dropdown/Default.css +6 -3
- package/src/styles/Components/Field.css +1 -0
- package/src/styles/Layout/Header.css +13 -17
- package/src/styles/Layout/Main.css +8 -91
- package/src/styles/Layout/Nav.css +31 -27
- package/src/styles/Libraries/+.css +1 -2
- package/src/styles/Libraries/Datepicker.css +38 -229
- package/src/styles/Libraries/Dialog.css +1 -19
- package/src/styles/Libraries/Drawer.css +17 -29
- package/src/styles/Libraries/Hint.css +86 -101
- package/src/styles/Libraries/Pickr.css +13 -0
- package/src/styles/Libraries/Ripple.css +1 -29
- package/src/styles/Libraries/Tippy.css +25 -39
- package/src/styles/Ui/+.css +6 -5
- package/src/styles/Ui/Badge.css +7 -82
- package/src/styles/Ui/Btn.css +13 -226
- package/src/styles/Ui/Check.css +1 -0
- package/src/styles/Ui/Control.css +47 -0
- package/src/styles/Ui/ControlSelect.css +66 -0
- package/src/styles/Ui/Dot.css +22 -0
- package/src/styles/Ui/Group.css +1 -0
- package/src/styles/Ui/Heading.css +3 -22
- package/src/styles/Ui/Image.css +1 -17
- package/src/styles/Ui/Info.css +1 -0
- package/src/styles/Ui/Label.css +1 -14
- package/src/styles/Ui/Link.css +2 -41
- package/src/styles/Ui/Notice.css +1 -47
- package/src/styles/Ui/Progress.css +1 -56
- package/src/styles/Ui/Switch.css +1 -70
- package/src/styles/Ui/Text.css +4 -245
- package/src/styles/Ui/Title.css +5 -13
- package/src/styles/Utils/+.css +3 -4
- package/src/styles/Utils/breakpoints.css +1 -0
- package/src/styles/Utils/config.css +5 -0
- package/src/styles/Utils/default.css +8 -122
- package/src/styles/Utils/icons.css +3 -7
- package/src/styles/Utils/keyframes.css +1 -182
- package/src/styles/Utils/{tailwind/base.css → tailwind.css} +31 -21
- package/src/styles/Utils/theme/+.css +1 -1
- package/src/styles/Utils/theme/main.css +14 -23
- package/src/styles/main.css +19 -15
- package/src/styles/tinymce.css +34 -0
- package/src/templates/Components/CookieConsent.latte +28 -0
- package/src/templates/Components/Dialogs/Basic.latte +22 -0
- package/src/templates/Layout/{Header.twig → Header.latte} +15 -17
- package/src/templates/Layout/Main.latte +62 -0
- package/src/templates/Sections/Gdpr.latte +127 -0
- package/src/templates/Sections/Site.latte +141 -0
- package/src/templates/Sections/Ui/Docs/@intro.html +13 -62
- package/src/templates/Sections/Ui/Docs/@nav.html +41 -92
- package/src/templates/Sections/Ui/Docs/@styles.html +2 -6
- package/src/templates/Sections/Ui/Docs/Default.latte +1059 -0
- package/src/templates/Sections/Ui/Icons.html +11 -9
- package/src/templates/Sections/Ui/Intro.html +66 -37
- package/src/templates/Sections/Ui.latte +8 -0
- package/src/templates/Ui/+.latte +5 -0
- package/src/templates/Ui/Check.latte +7 -0
- package/src/templates/Ui/Control.latte +9 -0
- package/src/templates/Ui/ControlDate.latte +14 -0
- package/src/templates/Ui/ControlSelect.latte +9 -0
- package/src/templates/Ui/ControlTime.latte +14 -0
- package/src/templates/Utils/sections.latte +3 -0
- package/src/views/dialog/basic.json.latte +5 -0
- package/src/views/dropdown/{tippy.json.twig → tippy.json.latte} +7 -4
- package/src/views/email/email.latte +6 -0
- package/src/views/email/email.test.latte +6 -0
- package/src/views/gdpr.json +1 -1
- package/src/views/index.json +1 -1
- package/src/views/site.json +11 -0
- package/src/views/ui-icons.json +1 -1
- package/src/views/ui.json +1 -1
- package/vite.config.js +16 -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/scripts/Libraries/Anchor.js +0 -35
- package/src/scripts/Libraries/NativeSlider.js +0 -138
- package/src/scripts/Libraries/Tabs.js +0 -16
- package/src/scripts/Ui/Checkbox.js +0 -10
- package/src/scripts/Ui/Input.js +0 -259
- package/src/scripts/Ui/Select.js +0 -53
- package/src/scripts/Utils/Functions/checkValidity.js +0 -44
- package/src/scripts/Utils/Functions/dataValue.js +0 -52
- package/src/scripts/Utils/Functions/inView.js +0 -24
- package/src/styles/Components/Form/+.css +0 -1
- package/src/styles/Components/Form/CookieConsent.css +0 -31
- package/src/styles/Libraries/NativeSlider.css +0 -60
- package/src/styles/Libraries/Tabs.css +0 -19
- package/src/styles/Ui/Checkbox.css +0 -151
- package/src/styles/Ui/Icon.css +0 -33
- package/src/styles/Ui/Input.css +0 -467
- package/src/styles/Ui/Radio.css +0 -4
- package/src/styles/Ui/Select.css +0 -137
- package/src/styles/Utils/normalize.css +0 -223
- package/src/styles/Utils/tailwind/+.css +0 -2
- package/src/styles/Utils/tailwind/gutters.css +0 -346
- package/src/styles/Utils/vars.css +0 -126
- package/src/styles/Utils/vendor.css +0 -1
- package/src/templates/Components/CookieConsent.twig +0 -30
- package/src/templates/Components/Dialogs/Basic.twig +0 -24
- package/src/templates/Layout/Main.twig +0 -49
- package/src/templates/Sections/Gdpr.twig +0 -64
- package/src/templates/Sections/Ui/Docs/Default.twig +0 -1600
- package/src/templates/Sections/Ui.twig +0 -8
- package/src/templates/Utils/sections.twig +0 -3
- package/src/views/dialog/basic.json.twig +0 -3
- package/tailwind.config.cjs +0 -69
- /package/src/emails/{templates.prod → templates}/.gitkeep +0 -0
- /package/src/templates/Layout/{Footer.twig → Footer.latte} +0 -0
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
export default function LibNativeSlider(selector, parent) {
|
|
2
|
-
const self = {
|
|
3
|
-
behavior: 'auto',
|
|
4
|
-
ref: {
|
|
5
|
-
nav: parent.querySelector('[data-lib-ns-nav]'),
|
|
6
|
-
select: parent.querySelectorAll('[data-lib-ns-nav-item]'),
|
|
7
|
-
progress: parent.querySelector('[data-lib-ns-progress]'),
|
|
8
|
-
counterMin: parent.querySelector('[data-lib-ns-counter="min"]'),
|
|
9
|
-
counterMax: parent.querySelector('[data-lib-ns-counter="max"]'),
|
|
10
|
-
prev: parent.querySelector('[data-lib-ns-prev]'),
|
|
11
|
-
next: parent.querySelector('[data-lib-ns-next]')
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
if (!selector.classList.contains('is-fade')) {
|
|
16
|
-
self.behavior = 'smooth'
|
|
17
|
-
|
|
18
|
-
if (!document.documentElement.classList.contains('safari')) {
|
|
19
|
-
const grabbing = () => {
|
|
20
|
-
self.isDown = false
|
|
21
|
-
self.paused = false
|
|
22
|
-
selector.classList.remove('is-grabbing')
|
|
23
|
-
selector.scrollLeft = selector.scrollLeft - 1
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
selector.addEventListener('mouseleave', grabbing)
|
|
27
|
-
|
|
28
|
-
selector.addEventListener('mouseup', grabbing)
|
|
29
|
-
|
|
30
|
-
selector.addEventListener('mousedown', e => {
|
|
31
|
-
self.isDown = true
|
|
32
|
-
self.startX = e.pageX - selector.offsetLeft
|
|
33
|
-
self.scrollLeft = selector.scrollLeft
|
|
34
|
-
self.paused = true
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
selector.addEventListener('mousemove', e => {
|
|
38
|
-
if (!self.isDown) return
|
|
39
|
-
e.preventDefault()
|
|
40
|
-
const x = e.pageX - selector.offsetLeft
|
|
41
|
-
const walk = (x - self.startX) * 1.25
|
|
42
|
-
selector.classList.add('is-grabbing')
|
|
43
|
-
selector.scrollLeft = self.scrollLeft - walk
|
|
44
|
-
|
|
45
|
-
selector.ondragstart = dragEvent => {
|
|
46
|
-
dragEvent.preventDefault()
|
|
47
|
-
}
|
|
48
|
-
})
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
self.counterMax = parseInt(((selector.scrollWidth - selector.clientWidth) / selector.children[0].clientWidth + 1).toFixed(0))
|
|
53
|
-
|
|
54
|
-
if (self.ref.counterMax !== null) {
|
|
55
|
-
self.ref.counterMax.textContent = self.counterMax
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (self.ref.nav !== null) {
|
|
59
|
-
self.ref.nav.insertAdjacentHTML('beforeend', [...Array(self.counterMax)].map((x, i) => `<div data-state="${i === 0 && 'active'}" aria-label="${i + 1}" aria-current="step" data-lib-ns-nav-item="${i}"></div>`).join(''))
|
|
60
|
-
self.ref.select = parent.querySelectorAll('[data-lib-ns-nav-item]')
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (typeof self.ref.select[0] !== 'undefined') {
|
|
64
|
-
self.ref.select.forEach(elm => {
|
|
65
|
-
elm.addEventListener('click', () => {
|
|
66
|
-
if (!elm._hasDataValue('state', 'active')) {
|
|
67
|
-
const position = selector.scrollLeft / selector.children[0].clientWidth
|
|
68
|
-
const selected = elm.dataset.libNsNavItem
|
|
69
|
-
|
|
70
|
-
if (position - selected <= 0) {
|
|
71
|
-
selector.scroll({ left: selector.scrollLeft + selector.children[0].clientWidth * (selected - position), behavior: self.behavior })
|
|
72
|
-
} else {
|
|
73
|
-
selector.scroll({ left: selector.scrollLeft - selector.children[0].clientWidth * (position - selected), behavior: self.behavior })
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
})
|
|
77
|
-
})
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
selector.addEventListener('scroll', () => {
|
|
81
|
-
if (self.ref.progress !== null) {
|
|
82
|
-
self.ref.progress.value = ((selector.scrollLeft + selector.clientWidth) / selector.scrollWidth * 100).toFixed(2)
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const activeSlide = parseInt(((selector.scrollLeft / selector.children[0].clientWidth) + 1).toFixed(0))
|
|
86
|
-
|
|
87
|
-
if (self.ref.counterMin !== null) {
|
|
88
|
-
self.ref.counterMin.textContent = activeSlide
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if (typeof self.ref.select[0] !== 'undefined') {
|
|
92
|
-
self.ref.select.forEach(elm => elm._removeDataValue('state', 'active'))
|
|
93
|
-
|
|
94
|
-
self.ref.select[activeSlide - 1]._addDataValue('state', 'active')
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (Math.floor(selector.scrollLeft / selector.children[0].clientWidth) === selector.scrollLeft / selector.children[0].clientWidth) {
|
|
98
|
-
[...selector.children].forEach(elm => {
|
|
99
|
-
elm._removeDataValue('state', 'active')
|
|
100
|
-
|
|
101
|
-
if (selector.scrollLeft === elm.offsetLeft - elm.parentNode.offsetLeft) {
|
|
102
|
-
elm._addDataValue('state', 'active')
|
|
103
|
-
}
|
|
104
|
-
})
|
|
105
|
-
}
|
|
106
|
-
}, { passive: true })
|
|
107
|
-
|
|
108
|
-
if (self.ref.progress !== null) {
|
|
109
|
-
self.ref.progress.addEventListener('click', e => {
|
|
110
|
-
selector.scrollLeft = (selector.scrollWidth / 100) * (e.clientX - e.target.offsetLeft) / e.target.clientWidth * 100
|
|
111
|
-
})
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
if (self.ref.prev !== null && self.ref.next !== null) {
|
|
115
|
-
self.ref.prev.addEventListener('click', () => selector.scroll({ left: selector.scrollLeft - selector.children[0].clientWidth, behavior: self.behavior }))
|
|
116
|
-
|
|
117
|
-
self.ref.next.addEventListener('click', () => selector.scroll({ left: selector.scrollLeft + selector.children[0].clientWidth, behavior: self.behavior }))
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
[self.ref.prev, self.ref.next, ...self.ref.select, self.ref.progress].forEach(elm => {
|
|
121
|
-
if (typeof elm !== 'undefined' && elm !== null) {
|
|
122
|
-
elm.addEventListener('mouseenter', () => (self.paused = true))
|
|
123
|
-
elm.addEventListener('mouseleave', () => (self.paused = false))
|
|
124
|
-
}
|
|
125
|
-
})
|
|
126
|
-
|
|
127
|
-
if (!isNaN(parseInt(selector.getAttribute('data-lib-ns')))) {
|
|
128
|
-
setInterval(() => {
|
|
129
|
-
if (!self.paused) {
|
|
130
|
-
if (selector.scrollLeft <= selector.children[0].clientWidth) {
|
|
131
|
-
selector.scroll({ left: selector.scrollLeft + selector.children[0].clientWidth, behavior: self.behavior })
|
|
132
|
-
} else {
|
|
133
|
-
selector.scroll({ left: 0, behavior: self.behavior })
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}, parseInt(selector.getAttribute('data-lib-ns')))
|
|
137
|
-
}
|
|
138
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
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', () => {
|
|
4
|
-
arguments[0].preventDefault()
|
|
5
|
-
|
|
6
|
-
selector.closest('[data-lib-tabs-nav]').querySelectorAll('[data-lib-tabs-item="nav"]').forEach(element => element._removeDataValue('state', 'active'))
|
|
7
|
-
selector._addDataValue('state', 'active')
|
|
8
|
-
|
|
9
|
-
;[...element.querySelector('[data-lib-tabs-area]').children].forEach(element => {
|
|
10
|
-
element._removeDataValue('state', 'active')
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
element.querySelector('[data-lib-tabs-area]').children[index]._addDataValue('state', 'active')
|
|
14
|
-
})
|
|
15
|
-
})
|
|
16
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { LibStimulus, Controller } from '../Libraries/Stimulus.js'
|
|
2
|
-
import { checkValidity } from '../Utils/Functions/+.js'
|
|
3
|
-
|
|
4
|
-
['ui-checkbox', 'ui-radio'].forEach(identifier => LibStimulus.register(identifier, class extends Controller {
|
|
5
|
-
connect() {
|
|
6
|
-
const input = this.element.querySelector('input:not([type="hidden"])')
|
|
7
|
-
|
|
8
|
-
input.addEventListener('change', () => checkValidity(this.element))
|
|
9
|
-
}
|
|
10
|
-
}))
|
package/src/scripts/Ui/Input.js
DELETED
|
@@ -1,259 +0,0 @@
|
|
|
1
|
-
import cdn from '../Utils/cdn.js'
|
|
2
|
-
import { LibStimulus, Controller } from '../Libraries/Stimulus.js'
|
|
3
|
-
import { importStyle, checkValidity } from '../Utils/Functions/+.js'
|
|
4
|
-
|
|
5
|
-
LibStimulus.register('ui-input', class extends Controller {
|
|
6
|
-
async connect() {
|
|
7
|
-
checkValidity(this.element, { validate: false })
|
|
8
|
-
|
|
9
|
-
this.element.addEventListener('change', () => checkValidity(this.element))
|
|
10
|
-
|
|
11
|
-
this.typeNumber(this.element)
|
|
12
|
-
|
|
13
|
-
this.typeFile(this.element)
|
|
14
|
-
|
|
15
|
-
await this.typeDatetime(this.element)
|
|
16
|
-
|
|
17
|
-
await this.typeColor(this.element)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
typeNumber(element) {
|
|
21
|
-
if (element.querySelector('[type="number"]') !== null) {
|
|
22
|
-
if (element.querySelector('.icon') === null) {
|
|
23
|
-
element.insertAdjacentHTML('beforeend', '<span class="icon icon-angle-down" data-action="minus"></span><span class="icon icon-angle-up" data-action="plus"></span>')
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
element.querySelector('[type="number"]').addEventListener('keydown', e => {
|
|
27
|
-
if ([46, 8, 9, 27, 13, 190].indexOf(e.keyCode) !== -1 || e.keyCode === 16 || (e.keyCode === 65 && e.ctrlKey === true) || (e.keyCode >= 35 && e.keyCode <= 39)) {
|
|
28
|
-
return
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (((e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
|
|
32
|
-
e.preventDefault()
|
|
33
|
-
}
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
element.querySelector('[data-action="plus"]').addEventListener('click', () => {
|
|
37
|
-
const input = this.element.querySelector('input')
|
|
38
|
-
const num = parseInt(input.value === '' ? 0 : input.value) + parseInt(input.step === '' ? 1 : input.step)
|
|
39
|
-
|
|
40
|
-
if (num <= input.max || input.max === '') {
|
|
41
|
-
input.value = num.toString()
|
|
42
|
-
input.dispatchEvent(new Event('change', { bubbles: true }))
|
|
43
|
-
}
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
element.querySelector('[data-action="minus"]').addEventListener('click', () => {
|
|
47
|
-
const input = this.element.querySelector('input')
|
|
48
|
-
const num = parseInt(input.value) - parseInt(input.step === '' ? 1 : input.step)
|
|
49
|
-
|
|
50
|
-
if (num >= input.min || input.min === '') {
|
|
51
|
-
input.value = num.toString()
|
|
52
|
-
input.dispatchEvent(new Event('change', { bubbles: true }))
|
|
53
|
-
}
|
|
54
|
-
})
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
async typeDatetime(element) {
|
|
59
|
-
const date = element.querySelector('[type^="date"]')
|
|
60
|
-
|
|
61
|
-
if (date !== null && !document.documentElement.classList.contains('mobile')) {
|
|
62
|
-
const lang = await import(`/* @vite-ignore */ https://cdn.jsdelivr.net/npm/vanillajs-datepicker@1.2.0/js/i18n/locales/${document.documentElement.lang === 'en' ? 'cs' : document.documentElement.lang}.min.js`)
|
|
63
|
-
const { Datepicker } = await import('vanillajs-datepicker')
|
|
64
|
-
|
|
65
|
-
await importStyle(cdn.datepicker)
|
|
66
|
-
|
|
67
|
-
Object.assign(Datepicker.locales, lang.default)
|
|
68
|
-
|
|
69
|
-
const datetime = date.getAttribute('type') === 'datetime-local'
|
|
70
|
-
const required = date.getAttribute('required') !== null
|
|
71
|
-
const placeholder = date.getAttribute('placeholder') !== null
|
|
72
|
-
let currentDate; let currentTime = null
|
|
73
|
-
|
|
74
|
-
date.setAttribute('type', 'hidden')
|
|
75
|
-
element.insertAdjacentHTML('beforeend', `<input type="text" inputmode="none" ${required ? 'required' : ''} ${placeholder ? `placeholder="${date.getAttribute('placeholder')}"` : ''}>`)
|
|
76
|
-
|
|
77
|
-
const hidden = element.querySelector('[type="hidden"]')
|
|
78
|
-
|
|
79
|
-
if (datetime && hidden.value.indexOf(':') !== -1) {
|
|
80
|
-
hidden.setAttribute('data-time', hidden.value.substring(hidden.value.indexOf(':') - 2, hidden.value.length))
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const datepicker = new Datepicker(element.querySelector('[type="text"]'), Object.assign({
|
|
84
|
-
autohide: !datetime,
|
|
85
|
-
language: document.documentElement.lang,
|
|
86
|
-
format: 'dd.mm.yyyy',
|
|
87
|
-
clearBtn: true,
|
|
88
|
-
todayBtn: true,
|
|
89
|
-
todayBtnMode: 1,
|
|
90
|
-
minDate: Datepicker.parseDate(hidden.getAttribute('min'), 'yyyy-mm-dd'),
|
|
91
|
-
maxDate: Datepicker.parseDate(hidden.getAttribute('max'), 'yyyy-mm-dd')
|
|
92
|
-
}, JSON.parse(element.getAttribute('data-lib-datepicker'))))
|
|
93
|
-
datepicker.setDate(Datepicker.parseDate(hidden.value, 'yyyy-mm-dd'))
|
|
94
|
-
|
|
95
|
-
if (datetime && hidden.value) {
|
|
96
|
-
element.insertAdjacentHTML('afterbegin', `<span class="input" ${placeholder ? 'placeholder' : ''}><span>${datepicker.getDate('dd.mm.yyyy') + '</span> ' + hidden.dataset.time}</span>`)
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
if (datetime) {
|
|
100
|
-
datepicker.element.addEventListener('keydown', e => {
|
|
101
|
-
if (e.key === 'Backspace' || e.key === 'Delete') {
|
|
102
|
-
datepicker.setDate({ clear: true })
|
|
103
|
-
} else {
|
|
104
|
-
e.preventDefault()
|
|
105
|
-
}
|
|
106
|
-
})
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
datepicker.element.addEventListener('changeDate', () => {
|
|
110
|
-
if (typeof hidden.dataset.time !== 'undefined') {
|
|
111
|
-
if (typeof datepicker.getDate('yyyy-mm-dd') !== 'undefined') {
|
|
112
|
-
hidden.value = datepicker.getDate('yyyy-mm-dd') + 'T' + hidden.dataset.time
|
|
113
|
-
|
|
114
|
-
const value = '<span>' + datepicker.getDate('dd.mm.yyyy') + '</span> ' + hidden.dataset.time
|
|
115
|
-
|
|
116
|
-
if (element.querySelector('.input') === null) {
|
|
117
|
-
element.insertAdjacentHTML('afterbegin', `<span class="input" ${placeholder ? 'placeholder' : ''}>${value}</span>`)
|
|
118
|
-
} else {
|
|
119
|
-
element.querySelector('.input').innerHTML = value
|
|
120
|
-
}
|
|
121
|
-
} else {
|
|
122
|
-
hidden.value = ''
|
|
123
|
-
element.querySelector('.input').textContent = ''
|
|
124
|
-
}
|
|
125
|
-
} else if (datepicker.getDate()) {
|
|
126
|
-
hidden.value = datepicker.getDate('yyyy-mm-dd')
|
|
127
|
-
} else {
|
|
128
|
-
hidden.value = ''
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
hidden.dispatchEvent(new Event('change', { bubbles: true }))
|
|
132
|
-
})
|
|
133
|
-
|
|
134
|
-
datepicker.element.addEventListener('show', element => {
|
|
135
|
-
const footer = element.detail.datepicker.picker.element.querySelector('.datepicker-footer')
|
|
136
|
-
currentDate = datepicker.getDate('yyyy-mm-dd')
|
|
137
|
-
|
|
138
|
-
this.element._addDataValue('state', 'active')
|
|
139
|
-
|
|
140
|
-
if (footer.querySelector('[type="time"]') === null && datetime) {
|
|
141
|
-
let time = hidden.dataset.time
|
|
142
|
-
|
|
143
|
-
if (typeof time === 'undefined') {
|
|
144
|
-
time = new Date().toLocaleTimeString('de', { hour: '2-digit', minute: '2-digit' })
|
|
145
|
-
hidden.setAttribute('data-time', time)
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
currentTime = time
|
|
149
|
-
|
|
150
|
-
footer.querySelector('.datepicker-controls').insertAdjacentHTML('beforeend', `<input type="time" value="${time}" aria-label="Text"><button type="button" data-ok class="button ok-btn" style="width: auto;">Ok</button>`)
|
|
151
|
-
|
|
152
|
-
footer.querySelector('[type="time"]').addEventListener('change', e => {
|
|
153
|
-
hidden.setAttribute('data-time', e.target.value)
|
|
154
|
-
})
|
|
155
|
-
|
|
156
|
-
footer.querySelector('[type="time"]').addEventListener('mousedown', e =>
|
|
157
|
-
e.stopPropagation()
|
|
158
|
-
)
|
|
159
|
-
|
|
160
|
-
footer.querySelector('[type="time"]').addEventListener('blur', e => {
|
|
161
|
-
e.stopPropagation()
|
|
162
|
-
e.preventDefault()
|
|
163
|
-
datepicker.element.focus()
|
|
164
|
-
})
|
|
165
|
-
|
|
166
|
-
footer.querySelector('[data-ok]').addEventListener('click', () => {
|
|
167
|
-
if (hidden.value === '') {
|
|
168
|
-
footer.querySelector('.today-btn').click()
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
datepicker.element.focus()
|
|
172
|
-
datepicker.hide()
|
|
173
|
-
})
|
|
174
|
-
} else if (datetime) {
|
|
175
|
-
currentTime = hidden.dataset.time
|
|
176
|
-
}
|
|
177
|
-
})
|
|
178
|
-
|
|
179
|
-
datepicker.element.addEventListener('hide', element => {
|
|
180
|
-
if (hidden.value === '') {
|
|
181
|
-
this.element._removeDataValue('state', 'active')
|
|
182
|
-
} else {
|
|
183
|
-
if (datetime) {
|
|
184
|
-
element.detail.datepicker.picker.element.querySelector('[type="time"]').dispatchEvent(new Event('change', { bubbles: true }))
|
|
185
|
-
|
|
186
|
-
if (currentDate !== datepicker.getDate('yyyy-mm-dd') || currentTime.toString() !== hidden.dataset.time.toString()) {
|
|
187
|
-
datepicker.element.dispatchEvent(new Event('changeDate', { bubbles: true }))
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
})
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
async typeColor(element) {
|
|
196
|
-
if (element.querySelector('[type="color"]') !== null) {
|
|
197
|
-
const Pickr = (await import('@simonwep/pickr')).default
|
|
198
|
-
const input = element.querySelector('input')
|
|
199
|
-
|
|
200
|
-
await importStyle(cdn.pickrCss)
|
|
201
|
-
|
|
202
|
-
element.setAttribute('data-type', 'color')
|
|
203
|
-
element.querySelector('[type="color"]').setAttribute('inputmode', 'none')
|
|
204
|
-
element.querySelector('[type="color"]').setAttribute('type', 'text')
|
|
205
|
-
element.insertAdjacentHTML('afterbegin', '<span class="color"></span>')
|
|
206
|
-
|
|
207
|
-
input.setAttribute('maxlength', '9')
|
|
208
|
-
input.setAttribute('pattern', '^#?([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$')
|
|
209
|
-
|
|
210
|
-
const pickr = new Pickr({
|
|
211
|
-
el: input,
|
|
212
|
-
useAsButton: true,
|
|
213
|
-
theme: 'nano',
|
|
214
|
-
position: 'bottom-start',
|
|
215
|
-
components: {
|
|
216
|
-
preview: true,
|
|
217
|
-
opacity: true,
|
|
218
|
-
hue: true,
|
|
219
|
-
interaction: {
|
|
220
|
-
hex: true,
|
|
221
|
-
rgba: true,
|
|
222
|
-
input: true
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}).on('init', pickr => {
|
|
226
|
-
pickr.setColor(input.value)
|
|
227
|
-
}).on('change', color => {
|
|
228
|
-
input.value = color.toHEXA().toString()
|
|
229
|
-
element.querySelector('.color').style['background-color'] = color.toHEXA().toString()
|
|
230
|
-
}).on('hide', pickr => {
|
|
231
|
-
pickr.applyColor()
|
|
232
|
-
input.dispatchEvent(new Event('change', { bubbles: true }))
|
|
233
|
-
})
|
|
234
|
-
|
|
235
|
-
input.addEventListener('change', ({ target }) => {
|
|
236
|
-
pickr.setColor(target.value)
|
|
237
|
-
})
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
typeFile(element) {
|
|
242
|
-
if (element.querySelector('[type="file"]') !== null) {
|
|
243
|
-
element.setAttribute('data-type', 'file')
|
|
244
|
-
element.insertAdjacentHTML('beforeend', `<span class="icon icon-paper-clip">${element.querySelector('input').title}</span><span data-placeholder="${element.querySelector('input').placeholder}"></span>`)
|
|
245
|
-
element.querySelector('input').addEventListener('change', e => {
|
|
246
|
-
const placeholder = element.querySelector('span:not(.icon)')
|
|
247
|
-
|
|
248
|
-
if (e.target.getAttribute('multiple') === null) {
|
|
249
|
-
placeholder.removeAttribute('data-placeholder')
|
|
250
|
-
placeholder.textContent = e.target.value.replace(/.*(\/|\\)/, '')
|
|
251
|
-
} else {
|
|
252
|
-
const files = e.target.files
|
|
253
|
-
placeholder.removeAttribute('data-placeholder')
|
|
254
|
-
placeholder.textContent = Object.keys(files).length === 1 ? e.target.value.replace(/.*(\/|\\)/, '') : `${Object.keys(files).length} soubory`
|
|
255
|
-
}
|
|
256
|
-
})
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
})
|
package/src/scripts/Ui/Select.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { LibStimulus, Controller } from '../Libraries/Stimulus.js'
|
|
2
|
-
import { checkValidity } from '../Utils/Functions/+.js'
|
|
3
|
-
|
|
4
|
-
LibStimulus.register('ui-select', class extends Controller {
|
|
5
|
-
connect() {
|
|
6
|
-
const element = this.element
|
|
7
|
-
const select = element.querySelector('select')
|
|
8
|
-
const option = element.querySelectorAll('[data-option]')
|
|
9
|
-
|
|
10
|
-
element.addEventListener('click', () => {
|
|
11
|
-
if (!element._hasDataValue('state', 'focus')) {
|
|
12
|
-
element._addDataValue('state', 'focus')
|
|
13
|
-
} else {
|
|
14
|
-
element._removeDataValue('state', 'focus')
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
element.addEventListener('blur', function e() {
|
|
18
|
-
element._removeDataValue('state', 'focus')
|
|
19
|
-
element.removeEventListener('blur', e)
|
|
20
|
-
})
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
element.addEventListener('click', e => {
|
|
24
|
-
if ((element._hasDataValue('state', 'focus') && e.timeStamp === 0) || e.target.tagName === 'OPTION') {
|
|
25
|
-
element._removeDataValue('state', 'focus')
|
|
26
|
-
}
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
select.addEventListener('change', () => {
|
|
30
|
-
checkValidity(element)
|
|
31
|
-
this.valueCheck(select)
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
if (option[0] !== null) {
|
|
35
|
-
option.forEach(option => {
|
|
36
|
-
option.addEventListener('click', () => {
|
|
37
|
-
select.value = option.getAttribute('data-option')
|
|
38
|
-
select.dispatchEvent(new Event('change', { bubbles: true }))
|
|
39
|
-
})
|
|
40
|
-
})
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
this.valueCheck(select)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
valueCheck(select) {
|
|
47
|
-
if (select.value === '') {
|
|
48
|
-
this.element._removeDataValue('state', 'active')
|
|
49
|
-
} else {
|
|
50
|
-
this.element._addDataValue('state', 'active')
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
})
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
export default function checkValidity(element, options = {}) {
|
|
2
|
-
const { validate, message } = Object.assign({ validate: true, message: false }, options)
|
|
3
|
-
const selectors = element.querySelectorAll('input, textarea, select')
|
|
4
|
-
|
|
5
|
-
selectors.forEach(selector => {
|
|
6
|
-
const isInput = element.classList.contains('ui-input')
|
|
7
|
-
const isSelect = element.classList.contains('ui-select')
|
|
8
|
-
const validationMessage = selector.dataset.validationMessage ?? selector.validationMessage
|
|
9
|
-
const validityElement = element.closest('.ui-input-group')?.querySelector('em') ?? element.querySelector('em')
|
|
10
|
-
|
|
11
|
-
if (!selector.outerHTML.match(/(data-novalidate|readonly|hidden)/) && validate) {
|
|
12
|
-
element._removeDataValue('state', 'valid invalid active')
|
|
13
|
-
|
|
14
|
-
if ((isInput || isSelect) && element.querySelector('[class^="icon"][class*="valid"]') !== null) {
|
|
15
|
-
element.querySelector('[class^="icon"][class*="valid"]').remove()
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
if (selector.checkValidity()) {
|
|
19
|
-
element._addDataValue('state', 'valid')
|
|
20
|
-
|
|
21
|
-
if (validityElement) {
|
|
22
|
-
validityElement.remove()
|
|
23
|
-
}
|
|
24
|
-
} else {
|
|
25
|
-
element._addDataValue('state', 'invalid')
|
|
26
|
-
|
|
27
|
-
if (!validityElement && message) {
|
|
28
|
-
(element.closest('.ui-input-group') ?? element).insertAdjacentHTML('beforeend', `<em>${validationMessage}</em>`)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if ((isInput || isSelect) && element.querySelector('[class^="icon"][class*="valid"]') === null) {
|
|
32
|
-
const icon = element.querySelector('.icon-r')
|
|
33
|
-
const where = icon || element
|
|
34
|
-
|
|
35
|
-
where.insertAdjacentHTML(icon ? 'afterend' : 'beforeend', `<div class="icon-r icon-invalid text-error lib-hint-top lib-hint-error" tabindex="0" aria-label="${validationMessage}"><svg><use href="#icon-exclamation-circle"></use></svg></div>`)
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (isInput && selector.value !== '') {
|
|
41
|
-
element._addDataValue('state', 'active')
|
|
42
|
-
}
|
|
43
|
-
})
|
|
44
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
Element.prototype._addDataValue = function(key, value) {
|
|
2
|
-
key = `data-${key}`
|
|
3
|
-
|
|
4
|
-
let attribute = this.getAttribute(key)
|
|
5
|
-
|
|
6
|
-
if (attribute === null) {
|
|
7
|
-
this.setAttribute(key, value)
|
|
8
|
-
} else {
|
|
9
|
-
value = value.split(' ')
|
|
10
|
-
attribute = attribute.split(' ')
|
|
11
|
-
|
|
12
|
-
value.map(value => !attribute.includes(value) && attribute.push(value))
|
|
13
|
-
|
|
14
|
-
this.setAttribute(key, attribute.join(' '))
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
Element.prototype._removeDataValue = function(key, value) {
|
|
19
|
-
const result = []
|
|
20
|
-
|
|
21
|
-
key = `data-${key}`
|
|
22
|
-
|
|
23
|
-
const attribute = this.getAttribute(key)
|
|
24
|
-
|
|
25
|
-
if (attribute === null) return
|
|
26
|
-
|
|
27
|
-
attribute.split(' ').map(attribute => !value.split(' ').includes(attribute) && result.push(attribute))
|
|
28
|
-
|
|
29
|
-
if (result.length !== 0) {
|
|
30
|
-
this.setAttribute(key, result.join(' '))
|
|
31
|
-
} else {
|
|
32
|
-
this.removeAttribute(key)
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
Element.prototype._hasDataValue = function(key, value) {
|
|
37
|
-
key = `data-${key}`
|
|
38
|
-
|
|
39
|
-
const attribute = this.getAttribute(key)
|
|
40
|
-
|
|
41
|
-
if (attribute === null) return false
|
|
42
|
-
return attribute.split(' ').includes(value)
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
Element.prototype._getDataValue = function(key) {
|
|
46
|
-
key = `data-${key}`
|
|
47
|
-
|
|
48
|
-
const attribute = this.getAttribute(key)
|
|
49
|
-
|
|
50
|
-
if (attribute === null) return ''
|
|
51
|
-
return attribute
|
|
52
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export default function inView(element, options = {}) {
|
|
2
|
-
let inView = false
|
|
3
|
-
|
|
4
|
-
return new Promise((resolve) => {
|
|
5
|
-
if (typeof IntersectionObserver === 'undefined') {
|
|
6
|
-
resolve()
|
|
7
|
-
return false
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
if (!options.rootMargin) {
|
|
11
|
-
options.rootMargin = '100px'
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const observer = new IntersectionObserver(entries => {
|
|
15
|
-
if (entries[0].isIntersecting && inView === false) {
|
|
16
|
-
inView = entries[0].isIntersecting
|
|
17
|
-
observer.disconnect()
|
|
18
|
-
resolve()
|
|
19
|
-
}
|
|
20
|
-
}, options || {})
|
|
21
|
-
|
|
22
|
-
observer.observe(element)
|
|
23
|
-
})
|
|
24
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@import "CookieConsent.css";
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
.c-form-cookieconsent {
|
|
2
|
-
& .wrp_form_head {
|
|
3
|
-
margin-bottom: 1rem;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
& .wrp_form_body {
|
|
7
|
-
display: flex;
|
|
8
|
-
flex-direction: row;
|
|
9
|
-
margin: 0 0 1.75rem;
|
|
10
|
-
line-height: 1.5;
|
|
11
|
-
|
|
12
|
-
@media (--media-m) {
|
|
13
|
-
flex-direction: column;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
& .ui-radio {
|
|
17
|
-
&:not(:last-of-type) {
|
|
18
|
-
margin-right: 1rem;
|
|
19
|
-
|
|
20
|
-
@media (--media-m) {
|
|
21
|
-
margin-right: auto;
|
|
22
|
-
margin-bottom: 0.75rem;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
& .wrp_form_foot {
|
|
29
|
-
margin-top: 2rem;
|
|
30
|
-
}
|
|
31
|
-
}
|