@massimo-cassandro/minimo 0.10.11 → 0.11.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.
Files changed (27) 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/package.json +1 -1
  13. package/src/components/snackbar/snackbar.js +56 -62
  14. package/src/components/snackbar/snackbar.module.css +79 -49
  15. package/src/css/buttons/btn-close.css +3 -2
  16. package/src/css/forms/forms.css +1 -0
  17. package/src/custom-properties.css +22 -4
  18. package/src/web-components/s-datatable-component/docs.md +187 -0
  19. package/src/web-components/s-datatable-component/s-datatable-component.js +517 -0
  20. package/src/web-components/{simple-datatable/simple-datatable.module.css → s-datatable-component/s-datatable-component.module.css} +1 -1
  21. package/src/web-components/{simple-datatable → s-datatable-component}/src/parse-cols.js +1 -1
  22. package/design-tokens-src/badge.minimo.tokens.jsonc +0 -36
  23. package/design-tokens-src/btn-close.minimo.tokens.jsonc +0 -101
  24. package/design-tokens-src/flex-grid.minimo.tokens.jsonc +0 -18
  25. package/design-tokens-src/gradients-shadowes.minimo.tokens.jsonc +0 -4
  26. package/design-tokens-src/z-index.minimo.tokens.jsonc +0 -8
  27. 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massimo-cassandro/minimo",
3
- "version": "0.10.11",
3
+ "version": "0.11.0",
4
4
  "description": "Light css framework & utilities",
5
5
  "type": "module",
6
6
  "homepage": "https://github.com/massimo-cassandro/minimo#readme",
@@ -12,94 +12,88 @@ References
12
12
 
13
13
  */
14
14
 
15
+ // TODO snackbar action
16
+ // TODO gestione snackbar multiple (NO stacking)
17
+
18
+
15
19
  export function snackbar(message, options = {}){
16
20
 
17
21
  options = {
18
22
 
19
23
  status : null, // danger, warning, info, success
20
- duration : 4000, // ms or false/null to avoid autoclose
24
+ duration : 6000, // ms or false/null to avoid autoclose
21
25
  close_btn : true, // true | false
22
26
 
23
- // TODO snackbar action
24
27
  action : null, // null or function
25
28
  action_text : null, // null or string
26
29
 
27
30
  ...options
28
31
  };
29
32
 
30
- domBuilder([
33
+ let _popover, _timeoutID;
34
+
35
+ const removePopover = () => {
36
+ if (_popover?.matches(':popover-open')) {
37
+ if (_timeoutID) clearTimeout(_timeoutID);
38
+
39
+ _popover.classList.add(styles.isHiding);
40
+
41
+ _popover.addEventListener('animationend', () => {
42
+ _popover.hidePopover();
43
+ _popover.remove();
44
+ }, { once: true });
45
+ }
46
+ };
47
+
48
+ _popover = domBuilder([
31
49
  {
32
- className: classnames(styles.snackbar, options.status? styles[`status-${options.status}`] : null),
50
+ className: classnames(styles.snackbarOuter, options.status? styles[`status-${options.status}`] : null),
33
51
  attrs: {
34
52
  popover: 'manual',
35
- role: options.action? 'alert' : 'status'
53
+ role: (options.action || ['danger','warning'].includes(options.status)) ? 'alert' : 'status'
36
54
  },
37
55
  children: [
38
56
  {
39
- className: styles.text,
40
- content: message
41
- },
42
- {
43
- tag: 'button',
44
- attrs: {
45
- type: 'button',
46
- },
47
- className: classnames('btn-reset', styles.action),
48
- content: options.action_text?? '_action-text_',
49
- condition: options.action && (typeof options.action === 'function'),
50
- // callback: el => {}
51
- },
52
- {
53
- tag: 'button',
54
- className: classnames('btn-close', styles.closeBtn),
55
- attrs: {
56
- type: 'button',
57
- },
57
+ className: styles.snackbar,
58
+ children: [
59
+ {
60
+ // className: styles.text,
61
+ content: message
62
+ },
63
+ {
64
+ condition: options.action != null && (typeof options.action === 'function'),
65
+ tag: 'button',
66
+ attrs: {
67
+ type: 'button',
68
+ },
69
+ className: classnames('btn-reset', styles.action),
70
+ content: options.action_text?? '_action-text_',
71
+ },
72
+ {
73
+ tag: 'button',
74
+ className: classnames('btn-close', styles.closeBtn),
75
+ attrs: {
76
+ type: 'button',
77
+ },
78
+ callback: el => el.addEventListener('click', () => removePopover())
79
+ }
80
+ ]
58
81
  }
59
82
  ]
60
83
  }
61
84
  ], document.body);
62
85
 
63
- }
64
-
65
- /*
66
- export const NotificationCore = {
67
-
68
- createNotificationElement(message, options = {}) {
69
-
86
+ _popover.showPopover();
70
87
 
71
88
 
72
- const show = () => {
73
- document.body.appendChild(el);
74
- el.showPopover();
75
- setTimeout(() => hide(), duration);
76
- };
89
+ if(options.duration) {
90
+ _timeoutID = setTimeout(removePopover, options.duration);
77
91
 
78
- const hide = () => {
79
- if (el.matches(':popover-open')) {
80
- el.hidePopover();
81
- el.remove(); // Pulizia del DOM
82
- }
83
- };
92
+ // mette in pausa il timeout sull'hover
93
+ _popover.addEventListener('mouseenter', () => clearTimeout(_timeoutID));
94
+ _popover.addEventListener('mouseleave', () => {
95
+ _timeoutID = setTimeout(removePopover, options.duration);
96
+ });
84
97
 
85
- return { el, show, hide };
86
98
  }
87
- };
88
-
89
-
90
-
91
-
92
- toast
93
-
94
- import { NotificationCore } from './notifications.js';
95
-
96
- export const toast = (message, type = 'info') => {
97
- const { el, show } = NotificationCore.createBase(message, { type, duration: 4000 });
98
-
99
- el.classList.add('ui-toast');
100
-
101
- show();
102
- };
103
-
104
-
105
- */
99
+ }