@massimo-cassandro/minimo 0.10.11 → 0.11.1

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.
Files changed (32) hide show
  1. package/design-tokens/components/snackbar.minimo.tokens.jsonc +106 -12
  2. package/design-tokens/shadows.minimo.tokens.jsonc +19 -0
  3. package/design-tokens/z-index.minimo.tokens.jsonc +4 -0
  4. package/design-tokens-src/_readme.md +1 -1
  5. package/design-tokens-src/badge.minimo.tokens.mjs +36 -0
  6. package/design-tokens-src/btn-close.minimo.tokens.mjs +101 -0
  7. package/design-tokens-src/components/snackbar.minimo.tokens.mjs +113 -21
  8. package/design-tokens-src/flex-grid.minimo.tokens.mjs +18 -0
  9. package/design-tokens-src/shadows.minimo.tokens.mjs +16 -0
  10. package/design-tokens-src/z-index.minimo.tokens.mjs +14 -0
  11. package/design-tokens-utilities/build-tokens-src/transforms.mjs +2 -1
  12. package/index.js +10 -0
  13. package/package.json +2 -11
  14. package/src/components/dismiss-alerts.js +7 -6
  15. package/src/components/form-reset-submit.js +38 -0
  16. package/src/components/inner-nav/inner-nav.js +11 -8
  17. package/src/components/snackbar/snackbar.js +56 -62
  18. package/src/components/snackbar/snackbar.module.css +79 -49
  19. package/src/css/buttons/btn-close.css +3 -2
  20. package/src/css/forms/forms.css +1 -0
  21. package/src/custom-properties.css +22 -4
  22. package/src/web-components/s-datatable-component/docs.md +187 -0
  23. package/src/web-components/s-datatable-component/s-datatable-component.js +517 -0
  24. package/src/web-components/{simple-datatable/simple-datatable.module.css → s-datatable-component/s-datatable-component.module.css} +1 -1
  25. package/src/web-components/{simple-datatable → s-datatable-component}/src/parse-cols.js +1 -1
  26. package/design-tokens-src/badge.minimo.tokens.jsonc +0 -36
  27. package/design-tokens-src/btn-close.minimo.tokens.jsonc +0 -101
  28. package/design-tokens-src/flex-grid.minimo.tokens.jsonc +0 -18
  29. package/design-tokens-src/gradients-shadowes.minimo.tokens.jsonc +0 -4
  30. package/design-tokens-src/z-index.minimo.tokens.jsonc +0 -8
  31. package/src/components/forms.js +0 -36
  32. package/src/web-components/simple-datatable/simple-datatable.js +0 -218
@@ -6,27 +6,121 @@
6
6
  // -----------------------------------------------------------------------
7
7
  {
8
8
  "snackbar": {
9
- "font": {
10
- "size": {
11
- "$type": "dimension",
12
- "$value": "{font.size.sm}"
9
+ "outer": {
10
+ "drop-shadow": {
11
+ "$type": "shadow",
12
+ "$value": "{box-shadow.base}"
13
+ },
14
+ "background": {
15
+ "color": {
16
+ "$type": "color",
17
+ "$value": "{secondary.100}"
18
+ }
19
+ },
20
+ "border": {
21
+ "$type": "string",
22
+ "$value": "none"
23
+ },
24
+ "border-radius": {
25
+ "$type": "color",
26
+ "$value": "{radius.xs}"
27
+ },
28
+ "padding": {
29
+ "block": {
30
+ "$type": "dimension",
31
+ "$value": 0
32
+ },
33
+ "inline": {
34
+ "$type": "dimension",
35
+ "$value": 0
36
+ }
13
37
  }
14
38
  },
15
- "border": {
16
- "radius": {
39
+ "text": {
40
+ "color": {
17
41
  "$type": "color",
18
- "$value": "{radius.sm}"
42
+ "$value": "{secondary.100-fg}"
19
43
  }
20
44
  },
21
- "text": {
45
+ "background": {
22
46
  "color": {
23
47
  "$type": "color",
24
- "$value": "{text.color}"
48
+ "$value": "{secondary.100}"
49
+ }
50
+ },
51
+ "border": {
52
+ "radius": {
53
+ "$type": "color",
54
+ "$value": "{radius.xs}"
55
+ }
56
+ },
57
+ "font": {
58
+ "size": {
59
+ "$type": "dimension",
60
+ "$value": "{font.size.sm}"
25
61
  }
26
62
  },
27
- "duration": {
28
- "$type": "duration",
29
- "$value": "5s"
63
+ "btn-close": {
64
+ "size": {
65
+ "$type": "dimension",
66
+ "$value": "1rem"
67
+ },
68
+ "icon": {
69
+ "color": {
70
+ "$type": "color",
71
+ "$value": "{snackbar.text.color}"
72
+ }
73
+ },
74
+ "hover": {
75
+ "background": {
76
+ "color": {
77
+ "$type": "color",
78
+ "$value": "color-mix(in srgb, {snackbar.text.color} 40%, transparent)"
79
+ }
80
+ },
81
+ "border": {
82
+ "color": {
83
+ "$type": "color",
84
+ "$value": "transparent"
85
+ }
86
+ },
87
+ "icon": {
88
+ "color": {
89
+ "$type": "color",
90
+ "$value": "{snackbar.background.color}"
91
+ }
92
+ }
93
+ },
94
+ "focus": {
95
+ "outline": {
96
+ "width": {
97
+ "$type": "dimension",
98
+ "$value": "2px"
99
+ },
100
+ "offset": {
101
+ "$type": "dimension",
102
+ "$value": "2px"
103
+ },
104
+ "color": {
105
+ "$type": "color",
106
+ "$value": "color-mix(in srgb, {snackbar.text.color} 50%, transparent)"
107
+ }
108
+ }
109
+ },
110
+ "active": {
111
+ "background": {
112
+ "color": {
113
+ "$type": "color",
114
+ "$value": "transparent"
115
+ }
116
+ },
117
+ "icon": {
118
+ "color": {
119
+ "$type": "color",
120
+ "$value": "{snackbar.text.color}"
121
+ }
122
+ }
123
+ }
30
124
  }
31
125
  }
32
126
  }
@@ -0,0 +1,19 @@
1
+ // -----------------------------------------------------------------------
2
+ // Generated file — do not edit manually.
3
+ // This file is produced by the design-token build pipeline.
4
+ // Source of truth: the token files in the project source directory.
5
+ // Re-generate with: node build-tokens.mjs --config <path/to/config>
6
+ // -----------------------------------------------------------------------
7
+ {
8
+ "box-shadow": {
9
+ "base": {
10
+ "$type": "shadow",
11
+ "$value": {
12
+ "color": "rgb(0 0 0 / .25)",
13
+ "offsetX": "0",
14
+ "offsetY": "0",
15
+ "blur": "12px"
16
+ }
17
+ }
18
+ }
19
+ }
@@ -9,6 +9,10 @@
9
9
  "overlay": {
10
10
  "$type": "number",
11
11
  "$value": 99
12
+ },
13
+ "snackbar": {
14
+ "$type": "number",
15
+ "$value": 100
12
16
  }
13
17
  }
14
18
  }
@@ -15,7 +15,7 @@
15
15
  * Name of the font family or list (array). ("Inter", ["Helvetica", "Arial"] )
16
16
  * **Font Weight** (`fontWeight`)
17
17
  * Font weight (number or text alias). (700, "bold", "light" )
18
- * **Edge** (`border`)
18
+ * **border** (`border`)
19
19
  * Compound: requires color, width, style. ({"color": "#000", "width": "1px", "style": "solid"} )
20
20
  * **Shadow** (`shadow`)
21
21
  * Compound: color, offsetX, offsetY, blur, spread, inset. ({"color": "#0003", "offsetX": "0px", "offsetY": "4px", "blur": "10px"} )
@@ -0,0 +1,36 @@
1
+ export default {
2
+ badge: {
3
+ background: {
4
+ color: {
5
+ $value: '{primary.100}',
6
+ $type: 'color'
7
+ }
8
+ },
9
+ color: {
10
+ $value: '{primary.100-fg}',
11
+ $type: 'color'
12
+ },
13
+ font: {
14
+ size: {
15
+ $value: '{font.size.xs}',
16
+ $type: 'dimension'
17
+ },
18
+ weight: {
19
+ $value: '{font.weight.semibold}',
20
+ $type: 'number'
21
+ }
22
+ },
23
+ lg: {
24
+ font: {
25
+ size: {
26
+ $value: '{font.size.base}',
27
+ $type: 'dimension'
28
+ },
29
+ weight: {
30
+ $value: '{badge.font.weight}',
31
+ $type: 'number'
32
+ }
33
+ }
34
+ }
35
+ } // end badge
36
+ };
@@ -0,0 +1,101 @@
1
+ export default {
2
+ btn: {
3
+ close: {
4
+ size: {
5
+ $value: '1.5rem',
6
+ $type: 'dimension'
7
+ },
8
+ padding: {
9
+ $value: '3px',
10
+ $type: 'dimension'
11
+ },
12
+ border: {
13
+ width: {
14
+ $value: '2px',
15
+ $type: 'dimension'
16
+ },
17
+ color: {
18
+ $value: '{btn.close.icon.color}',
19
+ $type: 'color'
20
+ },
21
+ radius: {
22
+ $value: '50%',
23
+ $type: 'dimension'
24
+ }
25
+
26
+ },
27
+ background: {
28
+ color: {
29
+ $value: '{body.background.color}',
30
+ $type: 'color'
31
+ },
32
+
33
+ },
34
+ icon: {
35
+ color: {
36
+ $value: '{text.color}',
37
+ $type: 'color'
38
+ },
39
+ bar: {
40
+ size: {
41
+ $value: '2px',
42
+ $type: 'dimension'
43
+ }
44
+ }
45
+
46
+ },
47
+
48
+ hover: {
49
+ background: {
50
+ color: {
51
+ $value: '{btn.close.icon.color}',
52
+ $type: 'color'
53
+ }
54
+ },
55
+ border: {
56
+ color: {
57
+ $value: '{btn.close.icon.color}',
58
+ $type: 'color'
59
+ }
60
+ },
61
+ icon: {
62
+ color: {
63
+ $value: '{btn.close.background.color}',
64
+ $type: 'color'
65
+ }
66
+ }
67
+ },
68
+
69
+ focus: {
70
+ outline: {
71
+ width: {
72
+ $value: '2px',
73
+ $type: 'dimension'
74
+ },
75
+ offset: {
76
+ $value: '2px',
77
+ $type: 'dimension'
78
+ },
79
+ color: {
80
+ $value: '{link.focus.outline.color}',
81
+ $type: 'color'
82
+ }
83
+ }
84
+ },
85
+ active: {
86
+ background: {
87
+ color: {
88
+ $value: '{btn.close.background.color}',
89
+ $type: 'color'
90
+ }
91
+ },
92
+ icon: {
93
+ color: {
94
+ $value: '{link.active.color}',
95
+ $type: 'color'
96
+ }
97
+ }
98
+ }
99
+ } // end close
100
+ } // end btn
101
+ };
@@ -1,35 +1,127 @@
1
1
  // tokens utitilizzati sia da snackaber che da toast
2
2
  export default{
3
3
  snackbar: {
4
-
5
-
6
-
7
-
8
-
9
-
10
- font: {
11
- size: {
12
- $value: '{font.size.sm}',
13
- $type: 'dimension'
4
+ outer: {
5
+ 'drop-shadow': {
6
+ $type: 'shadow',
7
+ $value: '{box-shadow.base}'
14
8
  },
15
- },
16
-
17
- border: {
18
- radius: {
19
- $value: '{radius.sm}',
9
+ background: {
10
+ color: {
11
+ $type: 'color',
12
+ $value: '{secondary.100}'
13
+ }
14
+ },
15
+ border: {
16
+ $value: 'none',
17
+ $type: 'string'
18
+ },
19
+ 'border-radius': {
20
+ $value: '{radius.xs}',
20
21
  $type: 'color'
22
+ },
23
+ padding: {
24
+ block: {
25
+ $type: 'dimension',
26
+ $value: 0
27
+ },
28
+ inline: {
29
+ $type: 'dimension',
30
+ $value: 0
31
+ },
21
32
  }
22
33
  },
34
+
23
35
  text: {
24
36
  color: {
25
- $value: '{text.color}',
37
+ $type: 'color',
38
+ $value: '{secondary.100-fg}'
39
+ }
40
+ },
41
+ background: {
42
+ color: {
43
+ $type: 'color',
44
+ $value: '{secondary.100}'
45
+ }
46
+ },
47
+ border: {
48
+ radius: {
49
+ $value: '{radius.xs}',
26
50
  $type: 'color'
27
51
  }
28
52
  },
29
- duration: {
30
- $value: '5s',
31
- $type: 'duration'
32
- }
33
- }
53
+ font: {
54
+ size: {
55
+ $value: '{font.size.sm}',
56
+ $type: 'dimension'
57
+ },
58
+ },
59
+
60
+ 'btn-close': {
61
+
62
+ size: {
63
+ $value: '1rem',
64
+ $type: 'dimension'
65
+ },
66
+ icon: {
67
+ color: {
68
+ $value: '{snackbar.text.color}',
69
+ $type: 'color'
70
+ }
71
+ },
72
+
73
+ hover: {
74
+ background: {
75
+ color: {
76
+ $value: 'color-mix(in srgb, {snackbar.text.color} 40%, transparent)',
77
+ $type: 'color'
78
+ }
79
+ },
80
+ border: {
81
+ color: {
82
+ $value: 'transparent',
83
+ $type: 'color'
84
+ }
85
+ },
86
+ icon: {
87
+ color: {
88
+ $value: '{snackbar.background.color}',
89
+ $type: 'color'
90
+ }
91
+ }
92
+ },
93
+
94
+ focus: {
95
+ outline: {
96
+ width: {
97
+ $value: '2px',
98
+ $type: 'dimension'
99
+ },
100
+ offset: {
101
+ $value: '2px',
102
+ $type: 'dimension'
103
+ },
104
+ color: {
105
+ $value: 'color-mix(in srgb, {snackbar.text.color} 50%, transparent)',
106
+ $type: 'color'
107
+ }
108
+ }
109
+ },
110
+ active: {
111
+ background: {
112
+ color: {
113
+ $value: 'transparent',
114
+ $type: 'color'
115
+ }
116
+ },
117
+ icon: {
118
+ color: {
119
+ $value: '{snackbar.text.color}',
120
+ $type: 'color'
121
+ }
122
+ }
123
+ }
124
+ } // end btn-close
125
+ } // end snackbar
34
126
 
35
127
  };
@@ -0,0 +1,18 @@
1
+ export default {
2
+ 'flex-grid': {
3
+ gap: {
4
+ $value: '1.5rem',
5
+ $type: 'dimension'
6
+ }
7
+ },
8
+ grid: {
9
+ cols: {
10
+ $value: 3,
11
+ $type: 'number'
12
+ },
13
+ 'min-col-width': {
14
+ $value: '6rem',
15
+ $type: 'dimension'
16
+ }
17
+ }
18
+ };
@@ -0,0 +1,16 @@
1
+ export default {
2
+ 'box-shadow': {
3
+ base: {
4
+ $type: 'shadow',
5
+ $value: {
6
+ color: 'rgb(0 0 0 / .25)',
7
+ offsetX: '0',
8
+ offsetY: '0',
9
+ blur: '12px'
10
+ }
11
+ }
12
+ }
13
+ };
14
+
15
+
16
+ // --box-shadow-base: 0 0 1.2rem 0x00000040;
@@ -0,0 +1,14 @@
1
+ export default {
2
+ 'z-index': {
3
+ overlay: {
4
+ $value: 99,
5
+ $type: 'number'
6
+ },
7
+
8
+ snackbar: {
9
+ $value: 100,
10
+ $type: 'number'
11
+ },
12
+
13
+ }
14
+ };
@@ -64,7 +64,8 @@ StyleDictionary.registerTransform({
64
64
  const value = token.$value || token.value;
65
65
  return (token.$type === 'dimension' || token.type === 'dimension')
66
66
  && typeof value === 'string'
67
- && !value.endsWith('rem');
67
+ && !value.endsWith('rem')
68
+ && !value.endsWith('%');
68
69
  },
69
70
  transform: (token) => {
70
71
  const value = token.$value || token.value;
package/index.js CHANGED
@@ -1,4 +1,14 @@
1
+
2
+ // utilities
1
3
  export { classnames } from './src/utilities/classnames.js';
2
4
  export { domBuilder } from './src/utilities/dom-builder/dom-builder.js';
3
5
  export { enableSubmitBtns } from './src/utilities/enable-submit-btns.js';
6
+
7
+ // components
4
8
  export { default as modalAlert } from './src/components/modal-alert/modal-alert.js';
9
+ export { dismissAlerts } from './src/components/dismiss-alerts.js';
10
+ export { formResetSubmit } from './src/components/form-reset-submit.js';
11
+ export { innerNav } from './src/components/inner-nav/inner-nav.js';
12
+ export { overlay, removeOverlay } from './src/components/overlay/overlay.js';
13
+ export { sf_macro } from './src/components/sf-macro/sf-macro.js';
14
+ export { snackbar } from './src/components/snackbar/snackbar.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massimo-cassandro/minimo",
3
- "version": "0.10.11",
3
+ "version": "0.11.1",
4
4
  "description": "Light css framework & utilities",
5
5
  "type": "module",
6
6
  "homepage": "https://github.com/massimo-cassandro/minimo#readme",
@@ -30,16 +30,7 @@
30
30
  "access": "public"
31
31
  },
32
32
  "main": "./index.js",
33
- "sideEffects": [
34
- "*.css",
35
- "*.js",
36
- "*.svg",
37
- "*.jpg",
38
- "*.jpeg",
39
- "*.png",
40
- "*.webp",
41
- "*.avif"
42
- ],
33
+ "sideEffects": false,
43
34
  "files": [
44
35
  "./index.js",
45
36
  "src/**/*.{js,mjs,css,svg,md}",
@@ -1,6 +1,7 @@
1
- // dismiss alerts
2
- document.querySelectorAll('[data-dismiss]').forEach(item => {
3
- item.addEventListener('click', () => {
4
- item.closest('.' + item.dataset.dismiss).remove();
5
- }, false);
6
- });
1
+ export function dismissAlerts(){
2
+ document.querySelectorAll('[data-dismiss]').forEach(item => {
3
+ item.addEventListener('click', () => {
4
+ item.closest('.' + item.dataset.dismiss).remove();
5
+ }, false);
6
+ });
7
+ }
@@ -0,0 +1,38 @@
1
+ // import './form.css'; //incorporato nel css principale
2
+ import { enableSubmitBtns } from '../../index.js';
3
+
4
+ export function formResetSubmit(){
5
+
6
+ document.querySelectorAll('form').forEach( form => {
7
+
8
+ // form.querySelectorAll('[type="submit"]').forEach(btn =>{
9
+ // btn.addEventListener('click', () => {
10
+ // form.classList.add('was-validated');
11
+ // }, false);
12
+ // });
13
+
14
+ form.addEventListener('submit', e => {
15
+
16
+ if(!form.hasAttribute('data-no-was-validated')) {
17
+ form.classList.add('was-validated');
18
+ }
19
+
20
+ form.querySelectorAll('.is-invalid, .is-valid').forEach(item => {
21
+ item.classList.remove('is-invalid', 'is-valid');
22
+ });
23
+
24
+ if(!form.checkValidity()) {
25
+ e.preventDefault();
26
+ enableSubmitBtns();
27
+
28
+ } else {
29
+ if(!form.hasAttribute('data-no-disabling') && !form.hasAttribute('data-disable-submit')) { /* 'data-disable-submit' per compatibilitò con verioni precedenti */
30
+ form.querySelectorAll('[type="submit"]').forEach(btn => {
31
+ btn.disabled = true;
32
+ });
33
+ }
34
+ }
35
+ }, false);
36
+ });
37
+ }
38
+
@@ -7,13 +7,16 @@
7
7
 
8
8
  import './inner-nav.css';
9
9
 
10
- let nav_primary = document.querySelector('.inner-nav-main');
11
- if (nav_primary) {
12
- // nav_primary.classList.add('text-right', 'd-print-none');
13
- let nav = nav_primary.innerHTML;
10
+ export function innerNav(){
14
11
 
15
- document.querySelectorAll('.inner-nav').forEach(item => {
16
- item.innerHTML = nav;
17
- // item.classList.add('text-right', 'd-print-none');
18
- });
12
+ const nav_primary = document.querySelector('.inner-nav-main');
13
+ if (nav_primary) {
14
+ // nav_primary.classList.add('text-right', 'd-print-none');
15
+ let nav = nav_primary.innerHTML;
16
+
17
+ document.querySelectorAll('.inner-nav').forEach(item => {
18
+ item.innerHTML = nav;
19
+ // item.classList.add('text-right', 'd-print-none');
20
+ });
21
+ }
19
22
  }