@newlogic-digital/ui 3.2.0 → 3.3.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/.eslintrc +13 -0
- package/.stylelintrc +18 -0
- package/README.md +1 -5
- package/package.json +16 -8
- package/public/sw.js +30 -0
- package/src/data/main.json +5 -0
- package/src/emails/email.prod.html +6 -0
- package/src/emails/email.twig.html +6 -0
- 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/emails/templates.prod/.gitkeep +0 -0
- package/src/scripts/Layout/Main.js +3 -3
- package/src/scripts/Libraries/Dialog.js +8 -1
- package/src/scripts/Libraries/Drawer.js +16 -14
- package/src/scripts/Libraries/Form.js +12 -18
- package/src/scripts/Libraries/NativeSlider.js +2 -1
- package/src/scripts/Libraries/ReCaptcha.js +9 -4
- package/src/scripts/Libraries/Stimulus.js +1 -31
- package/src/scripts/Libraries/Swup.js +5 -1
- 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 +18 -64
- package/src/scripts/Ui/Select.js +11 -39
- package/src/scripts/Ui/Text.js +2 -4
- package/src/scripts/Utils/Functions/+.js +1 -0
- package/src/scripts/Utils/Functions/checkValidity.js +44 -0
- package/src/scripts/Utils/Functions/inView.js +7 -8
- package/src/scripts/Utils/cdn.js +1 -1
- package/src/scripts/Utils/global.js +6 -8
- package/src/styles/Components/+.css +1 -1
- package/src/styles/Components/Dropdown/+.css +1 -0
- package/src/styles/{Ui/Dropdown.css → Components/Dropdown/Default.css} +1 -1
- package/src/styles/Libraries/+.css +0 -1
- package/src/styles/Libraries/Drawer.css +1 -1
- package/src/styles/Libraries/Hint.css +4 -3
- package/src/styles/Libraries/NativeSlider.css +8 -0
- 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 -2
- 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 +12 -5
- package/src/styles/Ui/Notice.css +1 -1
- package/src/styles/Ui/Select.css +3 -5
- package/src/styles/Ui/Text.css +13 -4
- package/src/styles/Ui/Title.css +3 -2
- package/src/styles/Utils/+.css +9 -9
- package/src/styles/Utils/default.css +0 -7
- package/src/styles/Utils/tailwind/+.css +2 -2
- package/src/styles/Utils/tailwind/base.css +25 -0
- package/src/styles/Utils/theme/+.css +1 -1
- package/src/styles/Utils/vars.css +32 -8
- 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} +0 -0
- package/src/views/{json-tippy.json.twig → dropdown/tippy.json.twig} +3 -3
- 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/tailwind.config.cjs +69 -0
- package/vite.config.js +5 -1
- package/src/emails/email.twig +0 -60
- package/src/scripts/Ui/Radio.js +0 -23
- package/src/styles/Components/Item/+.css +0 -1
- package/src/styles/Libraries/Lazysizes.css +0 -9
package/.eslintrc
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "standard",
|
|
3
|
+
"rules": {
|
|
4
|
+
"indent": ["error", 4],
|
|
5
|
+
"no-new": "off",
|
|
6
|
+
"space-before-function-paren": ["error", "never"],
|
|
7
|
+
"import/extensions": ["error", "ignorePackages"]
|
|
8
|
+
},
|
|
9
|
+
"env": {
|
|
10
|
+
"browser": true
|
|
11
|
+
},
|
|
12
|
+
"ignorePatterns": ["**/+.js"]
|
|
13
|
+
}
|
package/.stylelintrc
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "stylelint-config-standard",
|
|
3
|
+
"rules": {
|
|
4
|
+
"at-rule-no-unknown": [true, {"ignoreAtRules": ["layer", "tailwind"]}],
|
|
5
|
+
"selector-list-comma-newline-after": "always-multi-line",
|
|
6
|
+
"string-quotes": "double",
|
|
7
|
+
"comment-empty-line-before": ["always", {"except": ["first-nested"], "ignore": ["stylelint-commands"], "ignoreComments": ["/^clean-css/"]}],
|
|
8
|
+
"length-zero-no-unit": [true, {"ignore": ["custom-properties"]}],
|
|
9
|
+
"value-keyword-case": ["lower", { "camelCaseSvgKeywords": true }],
|
|
10
|
+
"alpha-value-notation": "number",
|
|
11
|
+
"property-no-vendor-prefix": [true, { "ignoreProperties": "appearance" }],
|
|
12
|
+
"number-max-precision": [4, { "ignoreProperties": "letter-spacing" }],
|
|
13
|
+
"max-line-length": 140,
|
|
14
|
+
"selector-class-pattern": null,
|
|
15
|
+
"import-notation": "string"
|
|
16
|
+
},
|
|
17
|
+
"ignoreFiles": ["**/+.css", "src/styles/Utils/normalize.css"]
|
|
18
|
+
}
|
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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newlogic-digital/ui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "vite.config.js",
|
|
6
6
|
"author": "New Logic Studio s.r.o.",
|
|
@@ -10,7 +10,9 @@
|
|
|
10
10
|
"dev": "vite",
|
|
11
11
|
"preview": "vite preview",
|
|
12
12
|
"build": "vituum build",
|
|
13
|
+
"build:emails": "vituum build && vituum emails",
|
|
13
14
|
"build:headless": "vituum headless",
|
|
15
|
+
"emails": "vituum emails",
|
|
14
16
|
"cleanup": "vituum cleanup",
|
|
15
17
|
"eslint": "eslint 'src/scripts/**/*.js'",
|
|
16
18
|
"eslint:fix": "eslint 'src/scripts/**/*.js' --fix",
|
|
@@ -19,20 +21,26 @@
|
|
|
19
21
|
},
|
|
20
22
|
"dependencies": {
|
|
21
23
|
"@simonwep/pickr": "^1.8.2",
|
|
22
|
-
"@hotwired/stimulus": "3.1.
|
|
23
|
-
"swup": "2.0.19",
|
|
24
|
+
"@hotwired/stimulus": "^3.1.1",
|
|
25
|
+
"swup": "^2.0.19",
|
|
24
26
|
"tippy.js": "^6.3.7",
|
|
25
|
-
"vanillajs-datepicker": "^1.2.0"
|
|
27
|
+
"vanillajs-datepicker": "^1.2.0",
|
|
28
|
+
"css-has-pseudo": "^4.0.1"
|
|
26
29
|
},
|
|
27
30
|
"devDependencies": {
|
|
28
|
-
"@newlogic-digital/core": "^1.0.
|
|
29
|
-
"
|
|
31
|
+
"@newlogic-digital/core": "^1.0.10",
|
|
32
|
+
"@types/grecaptcha": "^3.0.4",
|
|
33
|
+
"vituum": "^0.0.35",
|
|
30
34
|
"eslint-config-standard": "^17.0.0",
|
|
31
|
-
"stylelint-config-standard": "^
|
|
35
|
+
"stylelint-config-standard": "^29.0.0"
|
|
32
36
|
},
|
|
33
37
|
"files": [
|
|
34
38
|
"src",
|
|
35
|
-
"
|
|
39
|
+
"tailwind.config.cjs",
|
|
40
|
+
"vite.config.js",
|
|
41
|
+
".eslintrc",
|
|
42
|
+
".stylelintrc",
|
|
43
|
+
"public/sw.js"
|
|
36
44
|
],
|
|
37
45
|
"engines": {
|
|
38
46
|
"node": ">=16.0.0",
|
package/public/sw.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const offlineUrl = '/offline'
|
|
2
|
+
|
|
3
|
+
self.addEventListener('install', function(event) {
|
|
4
|
+
const offlineRequest = new Request(offlineUrl)
|
|
5
|
+
|
|
6
|
+
event.waitUntil(
|
|
7
|
+
fetch(offlineRequest).then(function(response) {
|
|
8
|
+
return caches.open('offline').then(function(cache) {
|
|
9
|
+
console.log('[oninstall] Cached offline page', response.url)
|
|
10
|
+
return cache.put(offlineRequest, response)
|
|
11
|
+
})
|
|
12
|
+
})
|
|
13
|
+
)
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
self.addEventListener('fetch', function(event) {
|
|
17
|
+
const request = event.request
|
|
18
|
+
|
|
19
|
+
if (request.url.match(/\.(css|jpg|jpeg|png|gif|js|woff|woff2|ttf|svg|mp4|webp)$/) || request.url.indexOf(request.referrer) !== 0) {
|
|
20
|
+
} else if (request.method === 'GET') {
|
|
21
|
+
event.respondWith(
|
|
22
|
+
fetch(request).catch(function(error) {
|
|
23
|
+
console.log('[onfetch] Failed. Serving cached offline fallback ' + error)
|
|
24
|
+
return caches.open('offline').then(function(cache) {
|
|
25
|
+
return cache.match(offlineUrl)
|
|
26
|
+
})
|
|
27
|
+
})
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
})
|
package/src/data/main.json
CHANGED
|
@@ -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 '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>
|
|
File without changes
|
|
@@ -19,9 +19,9 @@ LibStimulus.register('lib', class extends Controller {
|
|
|
19
19
|
LibRipple(e)
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
anchor(
|
|
23
|
-
|
|
24
|
-
LibAnchor.action(
|
|
22
|
+
anchor({ currentTarget }) {
|
|
23
|
+
arguments[0].preventDefault()
|
|
24
|
+
LibAnchor.action(currentTarget)
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
darkMode() {
|
|
@@ -8,7 +8,7 @@ const LibDialog = {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
if (document.querySelector('.lib-dialog') === null) {
|
|
11
|
-
document.body.insertAdjacentHTML('beforeend', '<div class="lib-dialog"></div>')
|
|
11
|
+
document.body.insertAdjacentHTML('beforeend', '<div class="lib-dialog" tabindex="0"></div>')
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
document.querySelector('.lib-dialog').insertAdjacentHTML('beforeend', content)
|
|
@@ -31,6 +31,8 @@ const LibDialog = {
|
|
|
31
31
|
|
|
32
32
|
loadStimulus(document.querySelector('.lib-dialog'))
|
|
33
33
|
|
|
34
|
+
document.querySelector('.lib-dialog').focus()
|
|
35
|
+
|
|
34
36
|
resolve()
|
|
35
37
|
|
|
36
38
|
document.querySelector('.lib-dialog').addEventListener('mousedown', e => {
|
|
@@ -66,8 +68,13 @@ const LibDialog = {
|
|
|
66
68
|
})
|
|
67
69
|
},
|
|
68
70
|
action: async(element, url) => {
|
|
71
|
+
element._addDataValue('state', 'loading')
|
|
72
|
+
element.classList.add('cursor-wait')
|
|
73
|
+
|
|
69
74
|
fetch(url, { headers: { 'X-Requested-With': 'XMLHttpRequest' } }).then(response => response.json()).then(({ dialog }) => {
|
|
70
75
|
LibDialog.show(dialog)
|
|
76
|
+
element._removeDataValue('state', 'loading')
|
|
77
|
+
element.classList.remove('cursor-wait')
|
|
71
78
|
})
|
|
72
79
|
}
|
|
73
80
|
}
|
|
@@ -1,38 +1,40 @@
|
|
|
1
1
|
import { LibStimulus, Controller } from './Stimulus.js'
|
|
2
2
|
|
|
3
3
|
LibStimulus.register('lib-drawer', class 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')
|
|
18
20
|
document.documentElement.classList.add('overflow-hidden')
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
hide() {
|
|
22
|
-
this.
|
|
23
|
-
this.
|
|
24
|
-
this.
|
|
24
|
+
this.navTarget._removeDataValue('state', 'active')
|
|
25
|
+
this.navTarget.classList.add('is-opacity')
|
|
26
|
+
this.navTarget.style.setProperty('--lib-drawer-opacity', '0')
|
|
25
27
|
document.documentElement.classList.remove('overflow-hidden')
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
scroll({ target }) {
|
|
29
31
|
if (target.scrollLeft > 1) {
|
|
30
|
-
this.
|
|
31
|
-
this.
|
|
32
|
+
this.navTarget.classList.remove('is-opacity')
|
|
33
|
+
this.navTarget.style.setProperty('--lib-drawer-opacity', `${Math.abs((target.scrollLeft / this.navTarget.children[0].clientWidth) - 1)}`)
|
|
32
34
|
}
|
|
33
35
|
|
|
34
|
-
if (target.scrollLeft === this.
|
|
35
|
-
this.
|
|
36
|
+
if (target.scrollLeft === this.navTarget.children[0].clientWidth) {
|
|
37
|
+
this.navTarget._removeDataValue('state', 'active')
|
|
36
38
|
document.documentElement.classList.remove('overflow-hidden')
|
|
37
39
|
}
|
|
38
40
|
}
|
|
@@ -1,33 +1,27 @@
|
|
|
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
|
+
}
|
|
18
18
|
|
|
19
|
-
element.querySelectorAll('.ui-
|
|
20
|
-
|
|
19
|
+
this.element.querySelectorAll('.ui-input, [data-controller="ui-checkbox"], [data-controller="ui-radio"]').forEach(element => {
|
|
20
|
+
checkValidity(element, { message: true })
|
|
21
21
|
})
|
|
22
22
|
|
|
23
|
-
element.querySelectorAll('
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (input.checkValidity()) {
|
|
27
|
-
input.parentNode._addDataValue('state', 'valid')
|
|
28
|
-
} else {
|
|
29
|
-
input.parentNode._addDataValue('state', 'invalid')
|
|
30
|
-
}
|
|
23
|
+
this.element.querySelectorAll('.ui-select:not([data-state*="active"]) select[required]').forEach(select => {
|
|
24
|
+
checkValidity(select.closest('.ui-select'), { message: true })
|
|
31
25
|
})
|
|
32
26
|
}
|
|
33
27
|
|
|
@@ -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
|
|
|
@@ -3,14 +3,19 @@ import importScript from '../Utils/Functions/importScript.js'
|
|
|
3
3
|
import cdn from '../Utils/cdn.js'
|
|
4
4
|
|
|
5
5
|
LibStimulus.register('lib-recaptcha', class extends Controller {
|
|
6
|
+
static values = {
|
|
7
|
+
api: String,
|
|
8
|
+
action: String
|
|
9
|
+
}
|
|
10
|
+
|
|
6
11
|
connect() {
|
|
7
|
-
importScript(cdn.recaptcha.replace('{apikey}', this.
|
|
12
|
+
importScript(cdn.recaptcha.replace('{apikey}', this.apiValue))
|
|
8
13
|
}
|
|
9
14
|
|
|
10
15
|
async execute() {
|
|
11
16
|
return new Promise(resolve => {
|
|
12
17
|
window.grecaptcha.enterprise.ready(() => {
|
|
13
|
-
window.grecaptcha.enterprise.execute(this.
|
|
18
|
+
window.grecaptcha.enterprise.execute(this.apiValue, { action: this.actionValue ?? 'form' }).then(token => {
|
|
14
19
|
this.element.querySelector('[name="gtoken"]').value = token
|
|
15
20
|
resolve()
|
|
16
21
|
})
|
|
@@ -18,8 +23,8 @@ LibStimulus.register('lib-recaptcha', class extends Controller {
|
|
|
18
23
|
})
|
|
19
24
|
}
|
|
20
25
|
|
|
21
|
-
async submit(
|
|
22
|
-
|
|
26
|
+
async submit() {
|
|
27
|
+
arguments[0].preventDefault()
|
|
23
28
|
|
|
24
29
|
await this.execute()
|
|
25
30
|
this.element.submit()
|
|
@@ -1,40 +1,10 @@
|
|
|
1
|
-
import { Application, Controller
|
|
1
|
+
import { Application, Controller } from '@hotwired/stimulus'
|
|
2
2
|
import loadStimulus from '../Utils/Functions/loadStimulus.js'
|
|
3
3
|
|
|
4
4
|
const LibStimulus = new Application(document.documentElement)
|
|
5
5
|
|
|
6
6
|
const getController = (element, identifier) => LibStimulus.getControllerForElementAndIdentifier(element, identifier)
|
|
7
7
|
|
|
8
|
-
class Controller extends DefaultController {
|
|
9
|
-
getValue(value) {
|
|
10
|
-
return this[`${value}Value`]
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
setValue(type, value) {
|
|
14
|
-
this[`${type}Value`] = value
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
hasValue(value) {
|
|
18
|
-
return this.data.has(`${value}Value`)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
getClass(value) {
|
|
22
|
-
return this.data.get(`${value}Class`)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
queryTarget(target) {
|
|
26
|
-
return this.targets.find(target)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
queryTargetAll(targets) {
|
|
30
|
-
return this.targets.findAll(targets)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
hasTarget(target) {
|
|
34
|
-
return this.targets.has(target)
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
8
|
LibStimulus.start().then(() => loadStimulus(document.body))
|
|
39
9
|
|
|
40
10
|
window.LibStimulus = { default: LibStimulus, Controller, loadStimulus }
|
|
@@ -10,7 +10,7 @@ const LibSwup = new Swup({
|
|
|
10
10
|
linkSelector: `:is(a[href^="${window.location.origin}"], a[href^="/"]):not([data-no-swup], [data-naja], [target="_blank"])`
|
|
11
11
|
})
|
|
12
12
|
|
|
13
|
-
LibSwup.on('clickLink', async() => {
|
|
13
|
+
LibSwup.on('clickLink', async({ target }) => {
|
|
14
14
|
document.body.classList.remove('overflow-hidden')
|
|
15
15
|
|
|
16
16
|
if (document.querySelector('.lib-drawer[data-state~="active"]') !== null) {
|
|
@@ -20,6 +20,10 @@ LibSwup.on('clickLink', async() => {
|
|
|
20
20
|
if (document.querySelector('.lib-dialog') !== null) {
|
|
21
21
|
await LibDialog.hide()
|
|
22
22
|
}
|
|
23
|
+
|
|
24
|
+
if (window.location.href === target.closest('a').href) {
|
|
25
|
+
document.documentElement.scroll({ top: 0 })
|
|
26
|
+
}
|
|
23
27
|
})
|
|
24
28
|
|
|
25
29
|
LibSwup.on('animationOutDone', () => {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export default function LibTabs(element) {
|
|
2
2
|
element.querySelector('[data-lib-tabs-nav]').querySelectorAll('[data-lib-tabs-item="nav"]').forEach((selector, index) => {
|
|
3
|
-
selector.addEventListener('click',
|
|
4
|
-
|
|
3
|
+
selector.addEventListener('click', () => {
|
|
4
|
+
arguments[0].preventDefault()
|
|
5
5
|
|
|
6
|
-
selector.closest('[data-lib-tabs-nav]').querySelectorAll('[data-lib-tabs-item="nav"]').forEach(
|
|
6
|
+
selector.closest('[data-lib-tabs-nav]').querySelectorAll('[data-lib-tabs-item="nav"]').forEach(element => element._removeDataValue('state', 'active'))
|
|
7
7
|
selector._addDataValue('state', 'active')
|
|
8
8
|
|
|
9
|
-
;[...element.querySelector('[data-lib-tabs-area]').children].forEach(
|
|
10
|
-
|
|
9
|
+
;[...element.querySelector('[data-lib-tabs-area]').children].forEach(element => {
|
|
10
|
+
element._removeDataValue('state', 'active')
|
|
11
11
|
})
|
|
12
12
|
|
|
13
13
|
element.querySelector('[data-lib-tabs-area]').children[index]._addDataValue('state', 'active')
|
|
@@ -27,7 +27,7 @@ export default class LibTippy {
|
|
|
27
27
|
options.content = document.querySelector('#' + template).innerHTML
|
|
28
28
|
} else {
|
|
29
29
|
options.content = `
|
|
30
|
-
<div class="
|
|
30
|
+
<div class="c-dropdown">
|
|
31
31
|
<div class="wrp_dropdown_body">
|
|
32
32
|
${element.getAttribute('aria-label')}
|
|
33
33
|
</div>
|
|
@@ -99,12 +99,14 @@ export default class LibTippy {
|
|
|
99
99
|
element.addEventListener(event, async function e() {
|
|
100
100
|
if (self.template.startsWith('/') && self.options.content === '') {
|
|
101
101
|
element.style.cursor = 'wait'
|
|
102
|
+
element._addDataValue('state', 'loading')
|
|
102
103
|
|
|
103
104
|
fetch(self.template, { headers: { 'X-Requested-With': 'XMLHttpRequest' } }).then(response => {
|
|
104
105
|
return response.json()
|
|
105
106
|
}).then(async(data) => {
|
|
106
107
|
self.options.content = data.content
|
|
107
108
|
element.style.cursor = ''
|
|
109
|
+
element._removeDataValue('state', 'loading')
|
|
108
110
|
await self.init(element, self.options, self.template)
|
|
109
111
|
element.removeEventListener(event, e)
|
|
110
112
|
})
|
package/src/scripts/Ui/+.js
CHANGED
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
import { LibStimulus, Controller } from '../Libraries/Stimulus.js'
|
|
2
|
+
import { checkValidity } from '../Utils/Functions/+.js'
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
validate(element) {
|
|
5
|
-
element.parentNode._removeDataValue('state', 'valid invalid')
|
|
6
|
-
|
|
7
|
-
if (element.checkValidity()) {
|
|
8
|
-
element.parentNode._addDataValue('state', 'valid')
|
|
9
|
-
} else {
|
|
10
|
-
element.parentNode._addDataValue('state', 'invalid')
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
4
|
+
['ui-checkbox', 'ui-radio'].forEach(identifier => LibStimulus.register(identifier, class extends Controller {
|
|
14
5
|
connect() {
|
|
15
6
|
const input = this.element.querySelector('input:not([type="hidden"])')
|
|
16
7
|
|
|
17
|
-
input.addEventListener('change', () => this.
|
|
8
|
+
input.addEventListener('change', () => checkValidity(this.element))
|
|
18
9
|
}
|
|
19
|
-
})
|
|
10
|
+
}))
|