@newlogic-digital/ui 3.2.0 → 3.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -5
- package/package.json +21 -14
- package/src/data/main.json +5 -1
- package/src/emails/{email.css → styles/email.css} +1 -1
- package/src/emails/templates/Content.twig +16 -0
- package/src/emails/templates/Header.twig +14 -0
- package/src/emails/templates/Layout.twig +23 -0
- package/src/scripts/Components/CookieConsent.js +0 -1
- package/src/scripts/Layout/Header.js +23 -11
- package/src/scripts/Layout/Main.js +6 -39
- package/src/scripts/Libraries/+.js +2 -1
- package/src/scripts/Libraries/Dialog.js +35 -65
- package/src/scripts/Libraries/Drawer.js +21 -15
- package/src/scripts/Libraries/Form.js +14 -18
- package/src/scripts/Libraries/Naja.js +35 -0
- package/src/scripts/Libraries/NativeSlider.js +3 -2
- package/src/scripts/Libraries/ReCaptcha.js +24 -4
- package/src/scripts/Libraries/Stimulus.js +1 -31
- package/src/scripts/Libraries/Swup.js +24 -32
- package/src/scripts/Libraries/Tabs.js +5 -5
- package/src/scripts/Libraries/Tippy.js +3 -1
- package/src/scripts/Ui/+.js +0 -1
- package/src/scripts/Ui/Checkbox.js +4 -13
- package/src/scripts/Ui/Input.js +19 -65
- package/src/scripts/Ui/Select.js +11 -39
- package/src/scripts/Ui/Text.js +2 -4
- package/src/scripts/Utils/Functions/+.js +1 -1
- package/src/scripts/Utils/Functions/checkValidity.js +44 -0
- package/src/scripts/Utils/Functions/loadStimulus.js +4 -1
- package/src/scripts/Utils/cdn.js +3 -3
- package/src/scripts/Utils/global.js +6 -8
- package/src/styles/Components/+.css +1 -1
- package/src/styles/Components/Dialog/Default.css +17 -52
- package/src/styles/Components/Dropdown/+.css +1 -0
- package/src/styles/{Ui/Dropdown.css → Components/Dropdown/Default.css} +1 -1
- package/src/styles/Layout/Main.css +4 -20
- package/src/styles/Libraries/+.css +0 -1
- package/src/styles/Libraries/Dialog.css +23 -7
- package/src/styles/Libraries/Drawer.css +3 -9
- package/src/styles/Libraries/Hint.css +4 -3
- package/src/styles/Libraries/NativeSlider.css +8 -0
- package/src/styles/Libraries/Ripple.css +4 -17
- package/src/styles/Libraries/Tippy.css +1 -1
- package/src/styles/Ui/+.css +0 -1
- package/src/styles/Ui/Badge.css +1 -1
- package/src/styles/Ui/Btn.css +24 -6
- package/src/styles/Ui/Checkbox.css +28 -3
- package/src/styles/Ui/Heading.css +2 -1
- package/src/styles/Ui/Icon.css +2 -2
- package/src/styles/Ui/Image.css +1 -7
- package/src/styles/Ui/Input.css +65 -18
- package/src/styles/Ui/Label.css +2 -2
- package/src/styles/Ui/Link.css +13 -6
- package/src/styles/Ui/Notice.css +1 -1
- package/src/styles/Ui/Select.css +3 -5
- package/src/styles/Ui/Text.css +18 -4
- package/src/styles/Ui/Title.css +3 -2
- package/src/styles/Utils/+.css +1 -0
- package/src/styles/Utils/breakpoints.css +9 -0
- package/src/styles/Utils/default.css +12 -115
- package/src/styles/Utils/tailwind/+.css +1 -0
- package/src/styles/Utils/tailwind/base.css +0 -12
- package/src/styles/Utils/tailwind/utilities.css +48 -0
- package/src/styles/Utils/vars.css +28 -39
- package/src/styles/Utils/vendor.css +2 -1
- package/src/styles/main.css +2 -3
- package/src/templates/Components/Dialogs/Basic.twig +15 -17
- package/src/templates/Layout/Main.twig +0 -6
- package/src/templates/Sections/Ui/Docs/@intro.html +97 -0
- package/src/templates/Sections/Ui/Docs/@nav.html +195 -0
- package/src/templates/Sections/Ui/Docs/@styles.html +100 -0
- package/src/templates/Sections/Ui/Docs/Default.twig +1600 -0
- package/src/templates/Sections/Ui/Icons.html +28 -0
- package/src/templates/Sections/Ui/Intro.html +136 -0
- package/src/templates/Sections/Ui.twig +5 -2090
- package/src/templates/Utils/sections.twig +2 -2
- package/src/views/{dialog-basic.json.twig → dialog/basic.json.twig} +1 -1
- package/src/views/{json-tippy.json.twig → dropdown/tippy.json.twig} +3 -3
- package/src/views/email/email.twig +6 -0
- package/src/views/gdpr.json +2 -1
- package/src/views/index.json +2 -2
- package/src/views/ui-icons.json +12 -0
- package/src/views/ui.json +2 -2
- package/vite.config.js +24 -4
- package/src/emails/email.twig +0 -60
- package/src/scripts/Ui/Radio.js +0 -23
- package/src/scripts/Utils/Functions/inView.js +0 -25
- package/src/styles/Components/Item/+.css +0 -1
- package/src/styles/Libraries/Lazysizes.css +0 -9
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<p align="center">
|
|
2
2
|
<a href="https://ui.newlogic.cz/" target="_blank" rel="noopener noreferrer">
|
|
3
|
-
<img width="180" src="https://ui.
|
|
3
|
+
<img width="180" src="https://ui.newlogic.cz/favicons/android-chrome-192x192.png" alt="Logo">
|
|
4
4
|
</a>
|
|
5
5
|
</p>
|
|
6
6
|
<p align="center">
|
|
@@ -74,9 +74,5 @@ import "node_modules/@newlogic-digital/ui/src/scripts/main.js"
|
|
|
74
74
|
|
|
75
75
|
Each Vituum project has to have config via `vite.config.js`, docs - [vituum.dev](https://vituum.dev)
|
|
76
76
|
|
|
77
|
-
## 📌 Future plans
|
|
78
|
-
- support for new modern web features `:has`, `<dialog>`
|
|
79
|
-
- performance optimization
|
|
80
|
-
|
|
81
77
|
## Licence
|
|
82
78
|
GNU GPLv3
|
package/package.json
CHANGED
|
@@ -1,38 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newlogic-digital/ui",
|
|
3
|
-
"version": "3.2
|
|
3
|
+
"version": "3.4.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "vite.config.js",
|
|
6
6
|
"author": "New Logic Studio s.r.o.",
|
|
7
7
|
"description": "Lightweight, modern and modular CSS framework with the best principles",
|
|
8
8
|
"license": "GNU GPLv3",
|
|
9
9
|
"scripts": {
|
|
10
|
+
"postinstall": "rm -rf node_modules/typed-query-selector",
|
|
10
11
|
"dev": "vite",
|
|
11
12
|
"preview": "vite preview",
|
|
12
|
-
"build": "
|
|
13
|
-
"build
|
|
13
|
+
"build": "vite build --mode development",
|
|
14
|
+
"build-production": "vite build",
|
|
15
|
+
"build-emails": "vite build --mode emails",
|
|
16
|
+
"emails": "vituum emails",
|
|
14
17
|
"cleanup": "vituum cleanup",
|
|
15
18
|
"eslint": "eslint 'src/scripts/**/*.js'",
|
|
16
|
-
"eslint
|
|
19
|
+
"eslint-fix": "eslint 'src/scripts/**/*.js' --fix",
|
|
17
20
|
"stylelint": "stylelint 'src/styles/**/*.css'",
|
|
18
|
-
"stylelint
|
|
21
|
+
"stylelint-fix": "stylelint 'src/styles/**/*.css' --fix"
|
|
19
22
|
},
|
|
20
23
|
"dependencies": {
|
|
21
24
|
"@simonwep/pickr": "^1.8.2",
|
|
22
|
-
"@hotwired/stimulus": "3.1
|
|
23
|
-
"
|
|
25
|
+
"@hotwired/stimulus": "^3.2.1",
|
|
26
|
+
"winduum": "^0.1.18",
|
|
27
|
+
"swup": "^3.1.1",
|
|
28
|
+
"naja": "^2.5.0",
|
|
24
29
|
"tippy.js": "^6.3.7",
|
|
25
|
-
"vanillajs-datepicker": "^1.
|
|
30
|
+
"vanillajs-datepicker": "^1.3.3",
|
|
31
|
+
"css-has-pseudo": "^5.0.2"
|
|
26
32
|
},
|
|
27
33
|
"devDependencies": {
|
|
28
|
-
"@newlogic-digital/core": "^
|
|
29
|
-
"
|
|
30
|
-
"eslint-config-standard": "^17.
|
|
31
|
-
"stylelint-config-standard": "^
|
|
34
|
+
"@newlogic-digital/core": "^2.0.0",
|
|
35
|
+
"@types/grecaptcha": "^3.0.4",
|
|
36
|
+
"eslint-config-standard": "^17.1.0",
|
|
37
|
+
"stylelint-config-standard": "^33.0.0",
|
|
38
|
+
"stylelint-stylistic": "^0.4.2",
|
|
39
|
+
"postcss-custom-selectors": "^7.1.3"
|
|
32
40
|
},
|
|
33
41
|
"files": [
|
|
34
|
-
"src"
|
|
35
|
-
"gulpfile.js"
|
|
42
|
+
"src"
|
|
36
43
|
],
|
|
37
44
|
"engines": {
|
|
38
45
|
"node": ">=16.0.0",
|
package/src/data/main.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
2
|
+
"lang": "en",
|
|
3
3
|
"prefetch": [
|
|
4
4
|
"https://cdn.jsdelivr.net",
|
|
5
5
|
"https://fonts.gstatic.com",
|
|
@@ -31,6 +31,10 @@
|
|
|
31
31
|
{
|
|
32
32
|
"name": "Documentation",
|
|
33
33
|
"url": "/ui"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "Icons",
|
|
37
|
+
"url": "/ui-icons"
|
|
34
38
|
}
|
|
35
39
|
]
|
|
36
40
|
},
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<tr class="nlm_content">
|
|
2
|
+
<td>
|
|
3
|
+
<table class="elm_inner_container">
|
|
4
|
+
<tr>
|
|
5
|
+
<td>
|
|
6
|
+
<br />
|
|
7
|
+
<div class="elm_content_heading">Thanks for your email:</div>
|
|
8
|
+
<br />
|
|
9
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis vitae est dui. Vestibulum vehicula in mi in interdum. Aliquam quis tempor nibh. Duis tincidunt vel purus tincidunt iaculis. In bibendum leo justo, et elementum justo dapibus et. Aliquam eu elementum magna. Fusce egestas urna ac venenatis auctor. Phasellus felis leo, suscipit non est sit amet, lobortis pellentesque urna. Ut enim leo, posuere eget mauris vel, egestas pellentesque metus. Curabitur ut est ut orci blandit suscipit. Morbi lacinia sapien luctus lectus maximus, vitae gravida lectus aliquet. Vestibulum ut placerat diam. Fusce dapibus tincidunt justo, sed venenatis nisl porttitor vitae.</p>
|
|
10
|
+
<br />
|
|
11
|
+
<div class="elm_content_info"><a href="https://www.example.com"><span>www.example.com</span></a></div>
|
|
12
|
+
</td>
|
|
13
|
+
</tr>
|
|
14
|
+
</table>
|
|
15
|
+
</td>
|
|
16
|
+
</tr>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<tr class="elm_header">
|
|
2
|
+
<td>
|
|
3
|
+
<table class="elm_inner_container">
|
|
4
|
+
<tr>
|
|
5
|
+
<td>
|
|
6
|
+
<br />
|
|
7
|
+
<a href="#"><img src="https://via.placeholder.com/160x60" width="160" alt="" style="width: 160px" /></a>
|
|
8
|
+
<br />
|
|
9
|
+
<br />
|
|
10
|
+
</td>
|
|
11
|
+
</tr>
|
|
12
|
+
</table>
|
|
13
|
+
</td>
|
|
14
|
+
</tr>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
|
|
3
|
+
<head>
|
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
5
|
+
<title>Email Template</title>
|
|
6
|
+
<!--[if gte mso 9]><xml><o:OfficeDocumentSettings><o:PixelsPerInch>96</o:PixelsPerInch></o:OfficeDocumentSettings></xml><![endif]-->
|
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
8
|
+
<style type="text/css">
|
|
9
|
+
@import '/src/emails/styles/email.css';
|
|
10
|
+
</style>
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<table class="elm_container_wrapper">
|
|
14
|
+
<tr>
|
|
15
|
+
<td>
|
|
16
|
+
<table class="elm_container">
|
|
17
|
+
<block name="body" with="locals"></block>
|
|
18
|
+
</table>
|
|
19
|
+
</td>
|
|
20
|
+
</tr>
|
|
21
|
+
</table>
|
|
22
|
+
</body>
|
|
23
|
+
</html>
|
|
@@ -1,18 +1,30 @@
|
|
|
1
1
|
import { LibStimulus, Controller, getController } from '../Libraries/Stimulus.js'
|
|
2
2
|
|
|
3
|
-
LibStimulus.register('l-header',
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
LibStimulus.register('l-header',
|
|
4
|
+
/** @property {LibDrawer} libDrawerOutlet */
|
|
5
|
+
class extends Controller {
|
|
6
|
+
connect() {
|
|
7
|
+
if (document.querySelector('#l-nav') === null) {
|
|
8
|
+
this.element.insertAdjacentHTML('afterend', `
|
|
9
|
+
<div id="l-nav" class="lib-drawer" data-lib-drawer-target="nav" data-action="scroll->lib-drawer#scroll" inert aria-hidden="true">
|
|
10
|
+
<div class="wrp_nav">
|
|
11
|
+
<div class="wrp_nav_head"></div>
|
|
12
|
+
<div class="wrp_nav_body"></div>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
`)
|
|
7
16
|
|
|
8
|
-
|
|
17
|
+
/** @type {LibDrawer} */
|
|
18
|
+
const LibDrawer = getController(document.body, 'lib-drawer')
|
|
19
|
+
LibDrawer.init()
|
|
9
20
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
21
|
+
const layoutNav = document.querySelector('#l-nav')
|
|
22
|
+
const logo = this.element.querySelector('.elm_header_logo').outerHTML
|
|
23
|
+
const nav = this.element.querySelector('.elm_header_nav').outerHTML
|
|
13
24
|
|
|
14
|
-
|
|
15
|
-
|
|
25
|
+
layoutNav.querySelector('.wrp_nav_head').insertAdjacentHTML('beforeend', logo)
|
|
26
|
+
layoutNav.querySelector('.wrp_nav_body').insertAdjacentHTML('beforeend', nav)
|
|
27
|
+
}
|
|
16
28
|
}
|
|
17
29
|
}
|
|
18
|
-
|
|
30
|
+
)
|
|
@@ -1,27 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import LibRipple from '../Libraries/Ripple.js'
|
|
1
|
+
import { showRipple } from 'winduum/src/libraries/ripple.js'
|
|
2
|
+
import { LibStimulus, Controller } from '../Libraries/Stimulus.js'
|
|
4
3
|
import LibAnchor from '../Libraries/Anchor.js'
|
|
5
|
-
import LibDialog from '../Libraries/Dialog.js'
|
|
6
4
|
import LibTippy from '../Libraries/Tippy.js'
|
|
7
5
|
import LibTabs from '../Libraries/Tabs.js'
|
|
8
6
|
import LibNativeSlider from '../Libraries/NativeSlider.js'
|
|
9
|
-
import cdn from '../Utils/cdn.js'
|
|
10
7
|
|
|
11
8
|
LibStimulus.register('lib', class extends Controller {
|
|
12
|
-
connect() {
|
|
13
|
-
if (!('scrollBehavior' in document.documentElement.style)) {
|
|
14
|
-
importScript(cdn.seamless).then(() => window.seamless.polyfill())
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
9
|
ripple(e) {
|
|
19
|
-
|
|
10
|
+
showRipple(e)
|
|
20
11
|
}
|
|
21
12
|
|
|
22
|
-
anchor(
|
|
23
|
-
|
|
24
|
-
LibAnchor.action(
|
|
13
|
+
anchor({ currentTarget }) {
|
|
14
|
+
arguments[0].preventDefault()
|
|
15
|
+
LibAnchor.action(currentTarget)
|
|
25
16
|
}
|
|
26
17
|
|
|
27
18
|
darkMode() {
|
|
@@ -35,30 +26,6 @@ LibStimulus.register('lib', class extends Controller {
|
|
|
35
26
|
}
|
|
36
27
|
})
|
|
37
28
|
|
|
38
|
-
LibStimulus.register('lib-dialog', class extends Controller {
|
|
39
|
-
async connect() {
|
|
40
|
-
if (this.element.getAttribute('data-lib-dialog-open')) {
|
|
41
|
-
const url = this.element.getAttribute('data-action-url')
|
|
42
|
-
|
|
43
|
-
if (url) {
|
|
44
|
-
await LibDialog.action(this.element, url, () => loadStimulus(document.querySelector('.lib-dialog')))
|
|
45
|
-
} else {
|
|
46
|
-
await LibDialog.show(document.querySelector(this.element.getAttribute('data-lib-dialog-open')).innerHTML, () => loadStimulus(document.querySelector('.lib-dialog')))
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
async show({ currentTarget }) {
|
|
52
|
-
const url = currentTarget.getAttribute('data-action-url')
|
|
53
|
-
|
|
54
|
-
await LibDialog.action(currentTarget, url)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
async hide() {
|
|
58
|
-
await LibDialog.hide()
|
|
59
|
-
}
|
|
60
|
-
})
|
|
61
|
-
|
|
62
29
|
LibStimulus.register('lib-tabs', class extends Controller {
|
|
63
30
|
connect() {
|
|
64
31
|
LibTabs(this.element)
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export { default as Anchor } from './Anchor.js'
|
|
2
2
|
export { default as CookieConsent } from './CookieConsent.js'
|
|
3
|
-
|
|
3
|
+
import './Dialog.js'
|
|
4
4
|
import './Drawer.js'
|
|
5
5
|
import './Form.js'
|
|
6
|
+
import './Naja.js'
|
|
6
7
|
export { default as NativeSlider } from './NativeSlider.js'
|
|
7
8
|
import './ReCaptcha.js'
|
|
8
9
|
export { default as Ripple } from './Ripple.js'
|
|
@@ -1,75 +1,45 @@
|
|
|
1
|
-
import { loadStimulus } from './Stimulus.js'
|
|
1
|
+
import { Controller, LibStimulus, loadStimulus } from './Stimulus.js'
|
|
2
|
+
import { insertDialog, closeDialog, fetchDialog, dialogSelector } from 'winduum/src/libraries/dialog.js'
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
if (document.querySelector('.lib-dialog') === null) {
|
|
11
|
-
document.body.insertAdjacentHTML('beforeend', '<div class="lib-dialog"></div>')
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
document.querySelector('.lib-dialog').insertAdjacentHTML('beforeend', content)
|
|
15
|
-
document.querySelector('.lib-dialog').style.display = 'flex'
|
|
16
|
-
|
|
17
|
-
function outerHeight(el) {
|
|
18
|
-
return el.offsetHeight + parseInt(getComputedStyle(el).marginTop) + parseInt(getComputedStyle(el).marginBottom)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (outerHeight(document.querySelector('.lib-dialog > [class^="c-dialog"]')) > window.innerHeight) {
|
|
22
|
-
const offset = window.innerWidth - document.body.clientWidth
|
|
23
|
-
|
|
24
|
-
document.documentElement.style.paddingRight = `${offset}px`
|
|
25
|
-
document.documentElement.classList.add('overflow-hidden')
|
|
4
|
+
LibStimulus.register('lib-dialog', class extends Controller {
|
|
5
|
+
static values = {
|
|
6
|
+
open: String,
|
|
7
|
+
url: String
|
|
8
|
+
}
|
|
26
9
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
10
|
+
async connect() {
|
|
11
|
+
if (this.hasOpenValue) {
|
|
12
|
+
if (this.hasUrlValue) {
|
|
13
|
+
await fetchDialog({
|
|
14
|
+
url: this.urlValue, insertOptions: { remove: true }
|
|
15
|
+
})
|
|
16
|
+
} else {
|
|
17
|
+
await insertDialog(document.querySelector(this.openValue).innerHTML, {
|
|
18
|
+
remove: true
|
|
19
|
+
})
|
|
30
20
|
}
|
|
31
21
|
|
|
32
|
-
loadStimulus(
|
|
22
|
+
loadStimulus(dialogSelector('.lib-dialog'))
|
|
23
|
+
}
|
|
24
|
+
}
|
|
33
25
|
|
|
34
|
-
|
|
26
|
+
async show({ currentTarget, params }) {
|
|
27
|
+
currentTarget._addDataValue('state', 'loading')
|
|
28
|
+
currentTarget.classList.add('cursor-wait')
|
|
35
29
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
})
|
|
42
|
-
}
|
|
43
|
-
}, true)
|
|
44
|
-
})
|
|
45
|
-
},
|
|
46
|
-
hide: async() => {
|
|
47
|
-
return new Promise(resolve => {
|
|
48
|
-
if (document.querySelector('.lib-dialog') !== null) {
|
|
49
|
-
document.querySelector('.lib-dialog')._addDataValue('state', 'hiding')
|
|
30
|
+
await fetchDialog({
|
|
31
|
+
url: params.url,
|
|
32
|
+
insertOptions: {
|
|
33
|
+
remove: params.remove ?? true,
|
|
34
|
+
append: params.append ?? false
|
|
50
35
|
}
|
|
36
|
+
}).then(() => loadStimulus(dialogSelector('.lib-dialog')))
|
|
51
37
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
document.querySelector('.lib-dialog').style.display = 'none'
|
|
55
|
-
document.documentElement.classList.remove('overflow-hidden')
|
|
56
|
-
|
|
57
|
-
if (document.querySelector('#l-header') !== null) {
|
|
58
|
-
document.querySelector('#l-header').style.right = ''
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
document.querySelector('.lib-dialog').remove()
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
resolve()
|
|
65
|
-
}, 300)
|
|
66
|
-
})
|
|
67
|
-
},
|
|
68
|
-
action: async(element, url) => {
|
|
69
|
-
fetch(url, { headers: { 'X-Requested-With': 'XMLHttpRequest' } }).then(response => response.json()).then(({ dialog }) => {
|
|
70
|
-
LibDialog.show(dialog)
|
|
71
|
-
})
|
|
38
|
+
currentTarget._removeDataValue('state', 'loading')
|
|
39
|
+
currentTarget.classList.remove('cursor-wait')
|
|
72
40
|
}
|
|
73
|
-
}
|
|
74
41
|
|
|
75
|
-
|
|
42
|
+
async hide({ params }) {
|
|
43
|
+
await closeDialog({ remove: params.remove ?? false })
|
|
44
|
+
}
|
|
45
|
+
})
|
|
@@ -1,38 +1,44 @@
|
|
|
1
1
|
import { LibStimulus, Controller } from './Stimulus.js'
|
|
2
2
|
|
|
3
|
-
LibStimulus.register('lib-drawer', class extends Controller {
|
|
3
|
+
LibStimulus.register('lib-drawer', class LibDrawer extends Controller {
|
|
4
|
+
static targets = ['nav']
|
|
5
|
+
|
|
4
6
|
init() {
|
|
5
|
-
setTimeout(() => this.
|
|
6
|
-
this.
|
|
7
|
-
if (target === this.
|
|
7
|
+
setTimeout(() => this.navTarget.classList.add('is-transition'), 50)
|
|
8
|
+
this.navTarget.addEventListener('click', ({ target }) => {
|
|
9
|
+
if (target === this.navTarget) {
|
|
8
10
|
this.hide()
|
|
9
11
|
}
|
|
10
12
|
})
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
show() {
|
|
14
|
-
this.
|
|
15
|
-
this.
|
|
16
|
-
this.
|
|
17
|
-
this.
|
|
16
|
+
this.navTarget.scrollLeft = 0
|
|
17
|
+
this.navTarget.style.setProperty('--lib-drawer-opacity', '1')
|
|
18
|
+
this.navTarget.classList.add('is-opacity')
|
|
19
|
+
this.navTarget._addDataValue('state', 'active')
|
|
20
|
+
this.navTarget.setAttribute('aria-hidden', 'false')
|
|
21
|
+
this.navTarget.removeAttribute('inert')
|
|
18
22
|
document.documentElement.classList.add('overflow-hidden')
|
|
19
23
|
}
|
|
20
24
|
|
|
21
25
|
hide() {
|
|
22
|
-
this.
|
|
23
|
-
this.
|
|
24
|
-
this.
|
|
26
|
+
this.navTarget.setAttribute('inert', '')
|
|
27
|
+
this.navTarget.setAttribute('aria-hidden', 'true')
|
|
28
|
+
this.navTarget._removeDataValue('state', 'active')
|
|
29
|
+
this.navTarget.classList.add('is-opacity')
|
|
30
|
+
this.navTarget.style.setProperty('--lib-drawer-opacity', '0')
|
|
25
31
|
document.documentElement.classList.remove('overflow-hidden')
|
|
26
32
|
}
|
|
27
33
|
|
|
28
34
|
scroll({ target }) {
|
|
29
35
|
if (target.scrollLeft > 1) {
|
|
30
|
-
this.
|
|
31
|
-
this.
|
|
36
|
+
this.navTarget.classList.remove('is-opacity')
|
|
37
|
+
this.navTarget.style.setProperty('--lib-drawer-opacity', `${Math.abs((target.scrollLeft / this.navTarget.children[0].clientWidth) - 1)}`)
|
|
32
38
|
}
|
|
33
39
|
|
|
34
|
-
if (target.scrollLeft === this.
|
|
35
|
-
this.
|
|
40
|
+
if (target.scrollLeft === this.navTarget.children[0].clientWidth) {
|
|
41
|
+
this.navTarget._removeDataValue('state', 'active')
|
|
36
42
|
document.documentElement.classList.remove('overflow-hidden')
|
|
37
43
|
}
|
|
38
44
|
}
|
|
@@ -1,33 +1,29 @@
|
|
|
1
|
-
import { LibStimulus, Controller
|
|
1
|
+
import { LibStimulus, Controller } from './Stimulus.js'
|
|
2
|
+
import { checkValidity } from '../Utils/Functions/+.js'
|
|
2
3
|
|
|
3
4
|
LibStimulus.register('lib-form', class extends Controller {
|
|
4
5
|
connect() {
|
|
5
6
|
this.element.setAttribute('novalidate', '')
|
|
6
|
-
this.element.addEventListener('submit', e => this.
|
|
7
|
+
this.element.addEventListener('submit', e => this.validation(e))
|
|
7
8
|
}
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
if (element.
|
|
10
|
+
validation(e) {
|
|
11
|
+
if (this.element.checkValidity() === false) {
|
|
11
12
|
e.preventDefault()
|
|
12
13
|
e.stopPropagation()
|
|
13
|
-
}
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
15
|
+
this.element.querySelector(':invalid').scrollIntoView({ behavior: 'smooth', block: 'center' })
|
|
16
|
+
this.element.querySelector(':invalid').focus()
|
|
17
|
+
} else {
|
|
18
|
+
this.element.querySelector('[type="submit"]')._addDataValue('state', 'loading')
|
|
19
|
+
}
|
|
18
20
|
|
|
19
|
-
element.querySelectorAll('.ui-
|
|
20
|
-
|
|
21
|
+
this.element.querySelectorAll('.ui-input, [data-controller="ui-checkbox"], [data-controller="ui-radio"]').forEach(element => {
|
|
22
|
+
checkValidity(element, { message: true })
|
|
21
23
|
})
|
|
22
24
|
|
|
23
|
-
element.querySelectorAll('
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (input.checkValidity()) {
|
|
27
|
-
input.parentNode._addDataValue('state', 'valid')
|
|
28
|
-
} else {
|
|
29
|
-
input.parentNode._addDataValue('state', 'invalid')
|
|
30
|
-
}
|
|
25
|
+
this.element.querySelectorAll('.ui-select:not([data-state*="active"]) select[required]').forEach(select => {
|
|
26
|
+
checkValidity(select.closest('.ui-select'), { message: true })
|
|
31
27
|
})
|
|
32
28
|
}
|
|
33
29
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import naja from 'naja'
|
|
2
|
+
import { Controller, LibStimulus, loadStimulus } from './Stimulus.js'
|
|
3
|
+
|
|
4
|
+
LibStimulus.register('lib-naja', class extends Controller {
|
|
5
|
+
async connect() {
|
|
6
|
+
naja.uiHandler.addEventListener('interaction', ({ detail }) => {
|
|
7
|
+
const element = detail.element
|
|
8
|
+
|
|
9
|
+
detail.options.target = element
|
|
10
|
+
|
|
11
|
+
element.dispatchEvent(new CustomEvent('naja-interaction', { bubbles: true, cancelable: true }))
|
|
12
|
+
|
|
13
|
+
if (element?.form && !element.form.reportValidity()) {
|
|
14
|
+
arguments[0].preventDefault()
|
|
15
|
+
}
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
naja.snippetHandler.addEventListener('afterUpdate', ({ detail }) => {
|
|
19
|
+
detail?.options.target.dispatchEvent(new CustomEvent('naja-afterUpdate', { bubbles: true, cancelable: true }))
|
|
20
|
+
|
|
21
|
+
loadStimulus(document.body, false)
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
naja.uiHandler.selector = '[data-naja]'
|
|
25
|
+
naja.initialize({
|
|
26
|
+
history: false
|
|
27
|
+
})
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async fetch({ currentTarget }) {
|
|
31
|
+
arguments[0].preventDefault()
|
|
32
|
+
|
|
33
|
+
await naja.makeRequest('GET', currentTarget.dataset.actionUrl, null, { history: false })
|
|
34
|
+
}
|
|
35
|
+
})
|
|
@@ -49,8 +49,9 @@ export default function LibNativeSlider(selector, parent) {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
self.counterMax = parseInt(((selector.scrollWidth - selector.clientWidth) / selector.children[0].clientWidth + 1).toFixed(0))
|
|
53
|
+
|
|
52
54
|
if (self.ref.counterMax !== null) {
|
|
53
|
-
self.counterMax = parseInt(((selector.scrollWidth - selector.clientWidth) / selector.children[0].clientWidth + 1).toFixed(0))
|
|
54
55
|
self.ref.counterMax.textContent = self.counterMax
|
|
55
56
|
}
|
|
56
57
|
|
|
@@ -126,7 +127,7 @@ export default function LibNativeSlider(selector, parent) {
|
|
|
126
127
|
if (!isNaN(parseInt(selector.getAttribute('data-lib-ns')))) {
|
|
127
128
|
setInterval(() => {
|
|
128
129
|
if (!self.paused) {
|
|
129
|
-
if (selector.scrollLeft
|
|
130
|
+
if (selector.scrollLeft < selector.children[0].clientWidth * (selector.children.length - 1)) {
|
|
130
131
|
selector.scroll({ left: selector.scrollLeft + selector.children[0].clientWidth, behavior: self.behavior })
|
|
131
132
|
} else {
|
|
132
133
|
selector.scroll({ left: 0, behavior: self.behavior })
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import { LibStimulus, Controller } from './Stimulus.js'
|
|
2
|
+
import naja from 'naja'
|
|
2
3
|
import importScript from '../Utils/Functions/importScript.js'
|
|
3
4
|
import cdn from '../Utils/cdn.js'
|
|
4
5
|
|
|
5
6
|
LibStimulus.register('lib-recaptcha', class extends Controller {
|
|
7
|
+
static values = {
|
|
8
|
+
api: String,
|
|
9
|
+
action: String
|
|
10
|
+
}
|
|
11
|
+
|
|
6
12
|
connect() {
|
|
7
|
-
importScript(cdn.recaptcha.replace('{apikey}', this.
|
|
13
|
+
importScript(cdn.recaptcha.replace('{apikey}', this.apiValue))
|
|
8
14
|
}
|
|
9
15
|
|
|
10
16
|
async execute() {
|
|
11
17
|
return new Promise(resolve => {
|
|
12
18
|
window.grecaptcha.enterprise.ready(() => {
|
|
13
|
-
window.grecaptcha.enterprise.execute(this.
|
|
19
|
+
window.grecaptcha.enterprise.execute(this.apiValue, { action: this.actionValue ?? 'form' }).then(token => {
|
|
14
20
|
this.element.querySelector('[name="gtoken"]').value = token
|
|
15
21
|
resolve()
|
|
16
22
|
})
|
|
@@ -18,10 +24,24 @@ LibStimulus.register('lib-recaptcha', class extends Controller {
|
|
|
18
24
|
})
|
|
19
25
|
}
|
|
20
26
|
|
|
21
|
-
async submit(
|
|
22
|
-
|
|
27
|
+
async submit() {
|
|
28
|
+
if (this.element.reportValidity() === false) {
|
|
29
|
+
return false
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
arguments[0].preventDefault()
|
|
23
33
|
|
|
24
34
|
await this.execute()
|
|
25
35
|
this.element.submit()
|
|
26
36
|
}
|
|
37
|
+
|
|
38
|
+
async submitFetch() {
|
|
39
|
+
if (this.element.reportValidity() === false) {
|
|
40
|
+
return false
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
arguments[0].preventDefault()
|
|
44
|
+
await this.execute()
|
|
45
|
+
await naja.makeRequest(this.element.method, this.element.action, new FormData(this.element), { history: 'replace' })
|
|
46
|
+
}
|
|
27
47
|
})
|