@massimo-cassandro/minimo 1.8.0 → 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.0",
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.6",
58
- "@massimo-cassandro/eslint-config": "^3.0.9",
59
- "@massimo-cassandro/stylelint-config": "^2.3.9",
60
- "style-dictionary": "^5.4.4"
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
  }
@@ -1,8 +1,7 @@
1
1
  import { domBuilder } from '../../utilities/dom-builder/dom-builder.js';
2
2
  import { classnames } from '../../utilities/classnames.js';
3
3
  import { spinner } from '../spinner/spinner.js';
4
- import * as _modalCss from './modal-popup.module.css';
5
- const styles = /** @type {Record<string, string>} */ (/** @type {any} */ (_modalCss).default ?? _modalCss);
4
+ import * as styles from './modal-popup.module.css';
6
5
 
7
6
 
8
7
  // https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement
@@ -47,8 +46,8 @@ function closeDialog(el) {
47
46
  * @param {((data: *, el: Element) => void) | null} [params.ajaxCallback=null] - Called with the Ajax response and the content element.
48
47
  * @param {((el: HTMLDialogElement) => void) | null} [params.closeCallback=null] - Called with the dialog element just before it is removed.
49
48
  * @param {boolean} [params.addScrollbarPadding=false] - Adds right padding to compensate for the scrollbar.
50
- * @param {string | null} [params.headerContent=null] - Header content: plain text or HTML.
51
- * @param {string | null} [params.footerContent=null] - Footer content: plain text or HTML.
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.
52
51
  * @returns {HTMLDialogElement} The dialog element.
53
52
  */
54
53
  export function modalPopup({
@@ -79,10 +78,10 @@ export function modalPopup({
79
78
  closeCallback = null,
80
79
  addScrollbarPadding = false, // adds extra right padding to compensate for the scrollbar
81
80
 
82
- /** header content: plain text or HTML */
81
+ /** header content: plain text, HTML or domBuilder array */
83
82
  headerContent = null,
84
83
 
85
- /** footer content: plain text or HTML */
84
+ /** footer content: plain text, HTML or domBuilder array */
86
85
  footerContent = null,
87
86
  }) {
88
87
 
@@ -132,11 +131,11 @@ export function modalPopup({
132
131
  {
133
132
  className: styles.header,
134
133
  condition: headerContent != null,
135
- content: headerContent
134
+ content: Array.isArray(headerContent) ? null : headerContent,
135
+ children: Array.isArray(headerContent) ? headerContent : undefined
136
136
  },
137
137
  {
138
138
  className: classnames(styles.content, contentExtraClassName),
139
-
140
139
  content: mode === 'html'
141
140
  ? content
142
141
  : mode === 'ajax'
@@ -180,7 +179,8 @@ export function modalPopup({
180
179
  {
181
180
  className: styles.footer,
182
181
  condition: footerContent != null,
183
- content: footerContent
182
+ content: Array.isArray(footerContent) ? null : footerContent,
183
+ children: Array.isArray(footerContent) ? footerContent : undefined
184
184
  },
185
185
  ]
186
186
  }
@@ -1,15 +1,6 @@
1
1
  // @ts-check
2
2
 
3
- import * as _css from './slide-up-down-toggle.module.css';
4
-
5
- /*
6
- * css-loader exposes class names differently depending on webpack config:
7
- * modules.namedExport: true → named exports → import * as _css → _css.slide
8
- * default (namedExport off) → default export → import styles → styles.slide
9
- * (= _css.default.slide)
10
- * The fallback chain below handles both without changing any other code.
11
- */
12
- const styles = { slide: _css.slide ?? /** @type {any} */ (_css).default?.slide ?? 'slide' };
3
+ import * as styles from './slide-up-down-toggle.module.css';
13
4
 
14
5
  /**
15
6
  * @module slide-up-down-toggle
@@ -1,7 +1,6 @@
1
1
  import { domBuilder } from '../../utilities/dom-builder/dom-builder.js';
2
2
  import { classnames } from '../../utilities/classnames.js';
3
- import * as _snackbarCss from './snackbar.module.css';
4
- const styles = /** @type {Record<string, string>} */ (/** @type {any} */ (_snackbarCss).default ?? _snackbarCss);
3
+ import * as styles from './snackbar.module.css';
5
4
 
6
5
  /*
7
6
  References
@@ -1,5 +1,4 @@
1
- import * as _spinnerCss from './spinner.module.css';
2
- const styles = /** @type {Record<string, string>} */ (/** @type {any} */ (_spinnerCss).default ?? _spinnerCss);
1
+ import * as styles from './spinner.module.css';
3
2
 
4
3
  // The spinner class depends on the spinner type in use; the corresponding CSS file must be included.
5
4
  // TODO: system for configuring the spinner type to allow multiple spinner types in the same project
@@ -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
- form.querySelector('[type="submit"]').disabled = false;
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});
@@ -3,8 +3,7 @@ import { DataTable } from 'simple-datatables';
3
3
 
4
4
  import { parseCols } from './src/parse-cols.js';
5
5
 
6
- import * as _sdatatableCss from './s-datatable-component.module.css';
7
- const styles = /** @type {Record<string, string>} */ (/** @type {any} */ (_sdatatableCss).default ?? _sdatatableCss);
6
+ import * as styles from './s-datatable-component.module.css';
8
7
 
9
8
  import caretLeftIcon from '../../icons/caret-left.svg?inline';
10
9
  import caretRightIcon from '../../icons/caret-right.svg?inline';
@@ -14,6 +13,8 @@ import caretRightIcon from '../../icons/caret-right.svg?inline';
14
13
  * Implementazione di simple-datatable (https://fiduswriter.github.io/simple-datatables/documentation/)
15
14
  * per generare una tabella da dati json e da un oggetto `cols` di configurazione
16
15
  *
16
+ * @deprecated Componente destinato alla dismissione
17
+ *
17
18
  * ─────────────────────────────────────────────────────────────────────────────
18
19
  * PARAMETRI
19
20
  * ─────────────────────────────────────────────────────────────────────────────
@@ -207,11 +208,23 @@ function resolveTemplate(tpl, row, { nullAs = '', warnColIdx } = {}) {
207
208
  return tpl;
208
209
  }
209
210
 
211
+ let _deprecationWarned = false;
212
+
213
+ /**
214
+ * @deprecated Componente destinato alla dismissione, verrà sostituito da `json-table`.
215
+ * Vedi la documentazione all'inizio del file per i dettagli.
216
+ */
210
217
  class SimpleDatatableAdapter extends HTMLElement {
211
218
  constructor() {
212
219
  super();
213
220
  // this.attachShadow({ mode: 'open' }); // commentare per light dom
214
221
 
222
+ if (!_deprecationWarned) {
223
+ _deprecationWarned = true;
224
+ // eslint-disable-next-line no-console
225
+ console.warn('[s-datatable] componente deprecato');
226
+ }
227
+
215
228
  this._config = null;
216
229
  this._initCalledProgrammatically = false;
217
230
  this._isConnected = false;
@@ -5,8 +5,7 @@
5
5
 
6
6
  import { classnames } from '../../../../index.js';
7
7
 
8
- import * as _sdatatableCss from '../s-datatable-component.module.css';
9
- const styles = /** @type {Record<string, string>} */ (/** @type {any} */ (_sdatatableCss).default ?? _sdatatableCss);
8
+ import * as styles from '../s-datatable-component.module.css';
10
9
 
11
10
  import checkIcon from '../../../icons/check-bold.svg?inline';
12
11
  import xIcon from '../../../icons/x-bold.svg?inline';