@massimo-cassandro/minimo 1.8.1 → 1.8.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/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Massimo Cassandro
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@massimo-cassandro/minimo",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.2",
|
|
4
4
|
"description": "Light css framework & utilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@massimo-cassandro/dev-updater": "^3.0.
|
|
58
|
-
"@massimo-cassandro/eslint-config": "^3.0.
|
|
59
|
-
"@massimo-cassandro/stylelint-config": "^2.3.
|
|
60
|
-
"style-dictionary": "^5.
|
|
57
|
+
"@massimo-cassandro/dev-updater": "^3.0.7",
|
|
58
|
+
"@massimo-cassandro/eslint-config": "^3.0.11",
|
|
59
|
+
"@massimo-cassandro/stylelint-config": "^2.3.11",
|
|
60
|
+
"style-dictionary": "^5.5.0"
|
|
61
61
|
}
|
|
62
62
|
}
|
|
@@ -46,8 +46,8 @@ function closeDialog(el) {
|
|
|
46
46
|
* @param {((data: *, el: Element) => void) | null} [params.ajaxCallback=null] - Called with the Ajax response and the content element.
|
|
47
47
|
* @param {((el: HTMLDialogElement) => void) | null} [params.closeCallback=null] - Called with the dialog element just before it is removed.
|
|
48
48
|
* @param {boolean} [params.addScrollbarPadding=false] - Adds right padding to compensate for the scrollbar.
|
|
49
|
-
* @param {string | null} [params.headerContent=null] - Header content: plain text or
|
|
50
|
-
* @param {string | null} [params.footerContent=null] - Footer content: plain text or
|
|
49
|
+
* @param {string | any[] | null} [params.headerContent=null] - Header content: plain text, HTML, or a domBuilder array.
|
|
50
|
+
* @param {string | any[] | null} [params.footerContent=null] - Footer content: plain text, HTML, or a domBuilder array.
|
|
51
51
|
* @returns {HTMLDialogElement} The dialog element.
|
|
52
52
|
*/
|
|
53
53
|
export function modalPopup({
|
|
@@ -78,10 +78,10 @@ export function modalPopup({
|
|
|
78
78
|
closeCallback = null,
|
|
79
79
|
addScrollbarPadding = false, // adds extra right padding to compensate for the scrollbar
|
|
80
80
|
|
|
81
|
-
/** header content: plain text or
|
|
81
|
+
/** header content: plain text, HTML or domBuilder array */
|
|
82
82
|
headerContent = null,
|
|
83
83
|
|
|
84
|
-
/** footer content: plain text or
|
|
84
|
+
/** footer content: plain text, HTML or domBuilder array */
|
|
85
85
|
footerContent = null,
|
|
86
86
|
}) {
|
|
87
87
|
|
|
@@ -131,11 +131,11 @@ export function modalPopup({
|
|
|
131
131
|
{
|
|
132
132
|
className: styles.header,
|
|
133
133
|
condition: headerContent != null,
|
|
134
|
-
content: headerContent
|
|
134
|
+
content: Array.isArray(headerContent) ? null : headerContent,
|
|
135
|
+
children: Array.isArray(headerContent) ? headerContent : undefined
|
|
135
136
|
},
|
|
136
137
|
{
|
|
137
138
|
className: classnames(styles.content, contentExtraClassName),
|
|
138
|
-
|
|
139
139
|
content: mode === 'html'
|
|
140
140
|
? content
|
|
141
141
|
: mode === 'ajax'
|
|
@@ -179,7 +179,8 @@ export function modalPopup({
|
|
|
179
179
|
{
|
|
180
180
|
className: styles.footer,
|
|
181
181
|
condition: footerContent != null,
|
|
182
|
-
content: footerContent
|
|
182
|
+
content: Array.isArray(footerContent) ? null : footerContent,
|
|
183
|
+
children: Array.isArray(footerContent) ? footerContent : undefined
|
|
183
184
|
},
|
|
184
185
|
]
|
|
185
186
|
}
|
|
@@ -6,8 +6,12 @@ example:
|
|
|
6
6
|
|
|
7
7
|
const form = document.getElementById('form-__xxxx___');
|
|
8
8
|
form.addEventListener('submit', e => {
|
|
9
|
+
|
|
10
|
+
// TODO disableBtnOnSubmit ??
|
|
11
|
+
|
|
9
12
|
form.querySelectorAll('.is-invalid').forEach(item => {
|
|
10
13
|
item.classList.remove('is-invalid');
|
|
14
|
+
item.setCustomValidity('');
|
|
11
15
|
});
|
|
12
16
|
form.classList.add('was-validated');
|
|
13
17
|
try {
|
|
@@ -16,12 +20,22 @@ form.addEventListener('submit', e => {
|
|
|
16
20
|
}
|
|
17
21
|
} catch( error ) {
|
|
18
22
|
e.preventDefault();
|
|
19
|
-
|
|
23
|
+
enableSubmitBtns();
|
|
20
24
|
|
|
21
25
|
if (error instanceof ValidationError) {
|
|
22
26
|
|
|
23
27
|
(error.fields??[]).forEach(field => {
|
|
24
28
|
field.classList.add('is-invalid');
|
|
29
|
+
field.setCustomValidity(error.message);
|
|
30
|
+
|
|
31
|
+
// rimuove il setCustomValidity alla modifica del campo
|
|
32
|
+
field.addEventListener('input', () => {
|
|
33
|
+
field.setCustomValidity('');
|
|
34
|
+
field.classList.remove('is-invalid');
|
|
35
|
+
|
|
36
|
+
// rimuove la classe che attiva la visualizzaione
|
|
37
|
+
form.classList.remove('was-validated');
|
|
38
|
+
}, {once: true});
|
|
25
39
|
});
|
|
26
40
|
|
|
27
41
|
error.fields[0]?.focus({preventScroll:false});
|