@newlogic-digital/ui 3.4.2 → 3.7.5
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 +21 -15
- package/package.json +32 -24
- package/src/data/main.json +25 -15
- package/src/emails/styles/main/+.css +3 -0
- package/src/emails/styles/main/Base/+.css +2 -0
- package/src/emails/styles/main/Base/config.css +22 -0
- package/src/emails/styles/main/Components/+.css +1 -0
- package/src/emails/styles/main/Components/Card.css +12 -0
- package/src/emails/styles/main/Ui/+.css +3 -0
- package/src/emails/styles/main/Ui/Btn.css +78 -0
- package/src/emails/styles/main/Ui/Heading.css +8 -0
- package/src/emails/styles/main/Ui/Text.css +12 -0
- package/src/emails/styles/main.css +92 -0
- package/src/emails/{templates/Layout.twig → templates.test/Layout.latte} +17 -5
- package/src/emails/templates.test/Sections/Footer.latte +22 -0
- package/src/emails/templates.test/Sections/Header.latte +37 -0
- package/src/emails/templates.test/Sections/Text.latte +24 -0
- package/src/icons.svg +27 -21
- package/src/scripts/Components/+.js +2 -1
- package/src/scripts/Components/Drawer.js +60 -0
- package/src/scripts/Components/Popover.js +65 -0
- package/src/scripts/Layout/+.js +0 -1
- package/src/scripts/Layout/Header.js +14 -24
- package/src/scripts/Libraries/+.js +4 -8
- package/src/scripts/Libraries/CookieConsent.js +65 -52
- package/src/scripts/Libraries/Dialog.js +19 -36
- package/src/scripts/Libraries/Form.js +5 -25
- package/src/scripts/Libraries/Naja.js +22 -20
- package/src/scripts/Libraries/ReCaptcha.js +8 -30
- package/src/scripts/Libraries/Reveal.js +32 -0
- package/src/scripts/Libraries/Ripple.js +6 -22
- package/src/scripts/Libraries/Stimulus.js +49 -5
- package/src/scripts/Libraries/Swup.js +45 -32
- package/src/scripts/Libraries/Toaster.js +55 -0
- package/src/scripts/Ui/+.js +3 -3
- package/src/scripts/Ui/Check.js +8 -0
- package/src/scripts/Ui/Control.js +194 -0
- package/src/scripts/Ui/ControlSelect.js +25 -0
- package/src/scripts/Ui/Text.js +9 -11
- package/src/scripts/Utils/+.js +3 -3
- package/src/scripts/Utils/cdn.js +1 -3
- package/src/scripts/Utils/initAfter.js +11 -0
- package/src/scripts/Utils/naja.js +41 -0
- package/src/scripts/Utils/utilities.js +8 -0
- package/src/scripts/main.js +2 -1
- package/src/styles/Components/+.css +4 -3
- package/src/styles/Components/Dialog/+.css +2 -0
- package/src/styles/Components/Dialog/Content.css +2 -0
- package/src/styles/Components/Dialog/CookieConsent.css +17 -0
- package/src/styles/Components/Dialog/Default.css +2 -43
- package/src/styles/Components/Drawer.css +18 -0
- package/src/styles/Components/Field.css +1 -0
- package/src/styles/Components/Popover.css +1 -0
- package/src/styles/Components/Toaster.css +2 -0
- package/src/styles/Layout/Header.css +9 -45
- package/src/styles/Layout/Main.css +11 -75
- package/src/styles/Layout/Nav.css +13 -33
- package/src/styles/Libraries/+.css +1 -7
- package/src/styles/Libraries/Datepicker.css +38 -229
- package/src/styles/Libraries/Pickr.css +13 -0
- package/src/styles/Ui/+.css +5 -5
- package/src/styles/Ui/Badge.css +8 -82
- package/src/styles/Ui/Btn.css +14 -226
- package/src/styles/Ui/Check.css +1 -0
- package/src/styles/Ui/Control.css +57 -0
- package/src/styles/Ui/ControlSelect.css +57 -0
- package/src/styles/Ui/Group.css +1 -0
- package/src/styles/Ui/Heading.css +4 -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 +6 -39
- package/src/styles/Ui/Notice.css +5 -43
- package/src/styles/Ui/Progress.css +1 -56
- package/src/styles/Ui/Switch.css +1 -70
- package/src/styles/Ui/Text.css +1 -254
- package/src/styles/Ui/Title.css +4 -15
- package/src/styles/Utils/+.css +6 -10
- package/src/styles/Utils/breakpoints.css +1 -9
- package/src/styles/Utils/config.css +16 -0
- package/src/styles/Utils/default.css +15 -26
- package/src/styles/Utils/keyframes.css +1 -182
- package/src/styles/Utils/theme/+.css +1 -1
- package/src/styles/Utils/theme/main.css +28 -23
- package/src/styles/Utils/utilities.css +42 -0
- package/src/styles/main.css +16 -14
- package/src/styles/tinymce.css +34 -0
- package/src/templates/Components/Dialog/Basic.latte +24 -0
- package/src/templates/Components/Dialog/CookieConsent.latte +27 -0
- package/src/templates/Components/Form/CookieConsent.latte +47 -0
- package/src/templates/Layout/Header.latte +38 -0
- package/src/templates/Layout/Main.latte +73 -0
- package/src/templates/Sections/CookieConsent.latte +69 -0
- package/src/templates/Sections/Site.latte +213 -0
- package/src/templates/Sections/Text.latte +64 -0
- package/src/templates/Sections/Ui/Docs/@intro.html +16 -65
- package/src/templates/Sections/Ui/Docs/@nav.html +68 -129
- package/src/templates/Sections/Ui/Docs/@styles.html +3 -7
- package/src/templates/Sections/Ui/Docs/Default.latte +979 -0
- package/src/templates/Sections/Ui/Icons.html +11 -9
- package/src/templates/Sections/Ui/Intro.html +62 -79
- 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/email/email.latte +6 -0
- package/src/views/email/email.test.latte +6 -0
- package/src/views/gdpr.json +6 -4
- package/src/views/index.json +1 -1
- package/src/views/popover/info.json.latte +15 -0
- 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 +17 -16
- package/src/emails/styles/email.css +0 -77
- package/src/emails/templates/Content.twig +0 -16
- package/src/emails/templates/Header.twig +0 -14
- package/src/scripts/Components/CookieConsent.js +0 -83
- package/src/scripts/Layout/Main.js +0 -47
- package/src/scripts/Libraries/Anchor.js +0 -35
- package/src/scripts/Libraries/Drawer.js +0 -45
- package/src/scripts/Libraries/NativeSlider.js +0 -138
- package/src/scripts/Libraries/Script.js +0 -19
- package/src/scripts/Libraries/Tabs.js +0 -16
- package/src/scripts/Libraries/Tippy.js +0 -120
- 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/+.js +0 -6
- package/src/scripts/Utils/Functions/checkValidity.js +0 -44
- package/src/scripts/Utils/Functions/dataValue.js +0 -52
- package/src/scripts/Utils/Functions/importScript.js +0 -17
- package/src/scripts/Utils/Functions/importStyle.js +0 -18
- package/src/scripts/Utils/Functions/loadStimulus.js +0 -42
- package/src/scripts/Utils/Functions/replaceTag.js +0 -12
- package/src/scripts/Utils/global.js +0 -15
- package/src/styles/Components/CookieConsent.css +0 -71
- package/src/styles/Components/Dropdown/+.css +0 -1
- package/src/styles/Components/Dropdown/Default.css +0 -5
- package/src/styles/Components/Form/+.css +0 -1
- package/src/styles/Components/Form/CookieConsent.css +0 -31
- package/src/styles/Libraries/Dialog.css +0 -35
- package/src/styles/Libraries/Drawer.css +0 -70
- package/src/styles/Libraries/Hint.css +0 -201
- package/src/styles/Libraries/NativeSlider.css +0 -60
- package/src/styles/Libraries/Ripple.css +0 -16
- package/src/styles/Libraries/Tabs.css +0 -19
- package/src/styles/Libraries/Tippy.css +0 -87
- package/src/styles/Ui/Checkbox.css +0 -150
- 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/icons.css +0 -9
- package/src/styles/Utils/normalize.css +0 -223
- package/src/styles/Utils/tailwind/+.css +0 -3
- package/src/styles/Utils/tailwind/base.css +0 -3
- package/src/styles/Utils/tailwind/gutters.css +0 -346
- package/src/styles/Utils/tailwind/utilities.css +0 -48
- package/src/styles/Utils/vars.css +0 -91
- package/src/styles/Utils/vendor.css +0 -2
- package/src/templates/Components/CookieConsent.twig +0 -30
- package/src/templates/Components/Dialogs/Basic.twig +0 -22
- package/src/templates/Layout/Header.twig +0 -42
- 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/src/views/dropdown/tippy.json.twig +0 -16
- package/src/views/email/email.twig +0 -6
- /package/src/{styles/Utils/print.css → emails/styles/main/Base/font.css} +0 -0
- /package/src/{templates/Components/Items → emails/templates}/.gitkeep +0 -0
- /package/src/templates/Layout/{Footer.twig → Footer.latte} +0 -0
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 */ cdn.datepickerLang.replace('{lang}', document.documentElement.lang === 'en' ? 'cs' : document.documentElement.lang))
|
|
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,6 +0,0 @@
|
|
|
1
|
-
export { default as checkValidity } from './checkValidity.js'
|
|
2
|
-
import './dataValue.js'
|
|
3
|
-
export { default as importScript } from './importScript.js'
|
|
4
|
-
export { default as importStyle } from './importStyle.js'
|
|
5
|
-
export { default as loadStimulus } from './loadStimulus.js'
|
|
6
|
-
export { default as replaceTag } from './replaceTag.js'
|
|
@@ -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,17 +0,0 @@
|
|
|
1
|
-
export default function importScript(url) {
|
|
2
|
-
return new Promise((resolve, reject) => {
|
|
3
|
-
if (document.querySelector(`script[src="${url}"]`) === null) {
|
|
4
|
-
const script = document.createElement('script')
|
|
5
|
-
|
|
6
|
-
script._importScript = new Promise((resolve, reject) => {
|
|
7
|
-
script.src = url
|
|
8
|
-
script.onload = resolve
|
|
9
|
-
script.onerror = reject
|
|
10
|
-
}).then(resolve).catch(reject)
|
|
11
|
-
|
|
12
|
-
document.head.appendChild(script)
|
|
13
|
-
} else {
|
|
14
|
-
document.querySelector(`script[src="${url}"]`)._importScript.then(resolve)
|
|
15
|
-
}
|
|
16
|
-
})
|
|
17
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export default function importStyle(url) {
|
|
2
|
-
return new Promise((resolve, reject) => {
|
|
3
|
-
if (document.querySelector(`link[href="${url}"]`) === null) {
|
|
4
|
-
const style = document.createElement('link')
|
|
5
|
-
|
|
6
|
-
style._importStyle = new Promise((resolve, reject) => {
|
|
7
|
-
style.href = url
|
|
8
|
-
style.rel = 'stylesheet'
|
|
9
|
-
style.onload = resolve
|
|
10
|
-
style.onerror = reject
|
|
11
|
-
}).then(resolve).catch(reject)
|
|
12
|
-
|
|
13
|
-
document.head.prepend(style)
|
|
14
|
-
} else {
|
|
15
|
-
document.querySelector(`link[href="${url}"]`)._importStyle.then(resolve)
|
|
16
|
-
}
|
|
17
|
-
})
|
|
18
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import naja from 'naja'
|
|
2
|
-
|
|
3
|
-
const dynamicControllers = ['ui-input', 'ui-select', 'ui-text', 'ui-checkbox', 'ui-radio', 'c-cookieconsent', 'c-form-cookieconsent']
|
|
4
|
-
const dynamicActions = [['.ui-btn', 'click->lib#ripple']]
|
|
5
|
-
|
|
6
|
-
if (!('scrollBehavior' in document.documentElement.style)) {
|
|
7
|
-
dynamicActions.push(['a[href^="#"]', 'click->lib#anchor'])
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
function loadControllers(parent, selectors) {
|
|
11
|
-
if (parent !== null) {
|
|
12
|
-
selectors.forEach(selector => {
|
|
13
|
-
[...parent.getElementsByClassName(selector)].forEach(element => {
|
|
14
|
-
if (element.getAttribute('data-controller') === null) {
|
|
15
|
-
element.setAttribute('data-controller', selector)
|
|
16
|
-
}
|
|
17
|
-
})
|
|
18
|
-
})
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function loadActions(parent, selectors) {
|
|
23
|
-
if (parent !== null) {
|
|
24
|
-
selectors.forEach(selector => {
|
|
25
|
-
parent.querySelectorAll(selector[0]).forEach(element => {
|
|
26
|
-
const attribute = element.getAttribute('data-action')
|
|
27
|
-
|
|
28
|
-
if (attribute === null) {
|
|
29
|
-
element.setAttribute('data-action', selector[1])
|
|
30
|
-
} else if (attribute.indexOf(selector[1]) === -1) {
|
|
31
|
-
element.setAttribute('data-action', `${attribute} ${selector[1]}`)
|
|
32
|
-
}
|
|
33
|
-
})
|
|
34
|
-
})
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export default function loadStimulus(selector, najaLoad = true) {
|
|
39
|
-
loadControllers(selector, dynamicControllers)
|
|
40
|
-
loadActions(selector, dynamicActions)
|
|
41
|
-
najaLoad && naja.uiHandler.bindUI(selector)
|
|
42
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export default function replaceTag(documentElement) {
|
|
2
|
-
documentElement.querySelectorAll('[data-lib-replace-tag]').forEach(element => {
|
|
3
|
-
const replaceTag = document.querySelector(`[data-lib-replace-tag=${element.dataset.libReplaceTag}]`)
|
|
4
|
-
const placement = element.closest('head') ? document.head : replaceTag.parentElement
|
|
5
|
-
|
|
6
|
-
replaceTag ? (replaceTag.outerHTML = element.outerHTML) : placement.insertAdjacentHTML('beforeend', element.outerHTML)
|
|
7
|
-
|
|
8
|
-
if (element.tagName === 'SCRIPT') {
|
|
9
|
-
document.querySelector(`[data-lib-replace-tag=${element.dataset.libReplaceTag}]`)._addDataValue('controller', 'lib-script')
|
|
10
|
-
}
|
|
11
|
-
})
|
|
12
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
!CSS.supports('selector(:has(*))') && (async() => (await import('css-has-pseudo/browser')).default(document))()
|
|
2
|
-
|
|
3
|
-
if ('serviceWorker' in navigator && location.protocol === 'https:') {
|
|
4
|
-
window.addEventListener('load', () => {
|
|
5
|
-
if (!document.documentElement.classList.contains('no-sw')) {
|
|
6
|
-
navigator.serviceWorker.register('/sw.js').catch(e => console.error(e))
|
|
7
|
-
} else {
|
|
8
|
-
navigator.serviceWorker.getRegistrations().then(async registrations => {
|
|
9
|
-
for (const registration of registrations) {
|
|
10
|
-
await registration.unregister()
|
|
11
|
-
}
|
|
12
|
-
})
|
|
13
|
-
}
|
|
14
|
-
})
|
|
15
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
.c-cookieconsent {
|
|
2
|
-
position: fixed;
|
|
3
|
-
inset: 0;
|
|
4
|
-
display: none;
|
|
5
|
-
z-index: var(--z-50);
|
|
6
|
-
background-color: rgb(var(--color-dark) / 0.75);
|
|
7
|
-
justify-content: center;
|
|
8
|
-
align-items: center;
|
|
9
|
-
flex-direction: column;
|
|
10
|
-
|
|
11
|
-
@media print {
|
|
12
|
-
display: none !important;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
&:not(.is-animate) {
|
|
16
|
-
animation: 0.5s ease 0s forwards 1 fade-out;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
&.is-animate {
|
|
20
|
-
animation: 0.5s ease 0s backwards 1 fade-in;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
&:--state-active {
|
|
24
|
-
display: flex;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
& .wrp {
|
|
28
|
-
max-width: 32rem;
|
|
29
|
-
width: calc(100% - 2rem);
|
|
30
|
-
border-radius: var(--radius);
|
|
31
|
-
padding: 2rem;
|
|
32
|
-
|
|
33
|
-
@nest :--type-center& {
|
|
34
|
-
max-width: 26rem;
|
|
35
|
-
text-align: center;
|
|
36
|
-
|
|
37
|
-
& .ui-image {
|
|
38
|
-
margin-left: auto;
|
|
39
|
-
margin-right: auto;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
& .wrp_c_head {
|
|
44
|
-
margin-bottom: 1rem;
|
|
45
|
-
|
|
46
|
-
@media (--media-t) {
|
|
47
|
-
margin-bottom: 1.5rem;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
& .wrp_c_body {
|
|
52
|
-
& .ui-text {
|
|
53
|
-
--ui-text-size: 0.875rem;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
& .wrp_c_foot {
|
|
58
|
-
display: flex;
|
|
59
|
-
align-items: center;
|
|
60
|
-
margin-top: 1.5rem;
|
|
61
|
-
|
|
62
|
-
@media (--media-t) {
|
|
63
|
-
margin-top: 2rem;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
& .ui-link {
|
|
67
|
-
font-weight: var(--font-normal);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@import "Default.css";
|
|
@@ -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
|
-
}
|