@massimo-cassandro/minimo 1.16.1 → 1.17.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 (41) hide show
  1. package/README.md +9 -0
  2. package/design-tokens/_src/components/modal-alert.minimo.tokens.mjs +164 -0
  3. package/design-tokens/_src/components/slide-up-down-toggle.minimo.tokens.mjs +9 -0
  4. package/design-tokens/_src/headings.minimo.tokens.mjs +8 -0
  5. package/design-tokens/_src/typography.minimo.tokens.mjs +1 -1
  6. package/design-tokens/tokens/components/modal-alert.minimo.tokens.jsonc +166 -0
  7. package/design-tokens/tokens/components/slide-up-down-toggle.minimo.tokens.jsonc +14 -0
  8. package/design-tokens/tokens/headings.minimo.tokens.jsonc +8 -0
  9. package/design-tokens/utilities/build-tokens-src/formats/css.mjs +1 -1
  10. package/design-tokens/utilities/build-tokens-src/formats/penpot.mjs +1 -1
  11. package/design-tokens/utilities/check-unresolved-custom-props.mjs +11 -12
  12. package/design-tokens/utilities/tokens-config-sample.mjs +1 -1
  13. package/dev-tools/README.md +1 -1
  14. package/dev-tools/starter-kit/webpack.config.mjs +0 -22
  15. package/package.json +2 -1
  16. package/src/components/modal-alert/modal-alert.js +295 -165
  17. package/src/components/modal-alert/modal-alert.module.css +145 -0
  18. package/src/components/modal-alert/svg/confirm.svg +4 -1
  19. package/src/components/modal-alert/svg/danger.svg +4 -0
  20. package/src/components/modal-alert/svg/error.svg +4 -1
  21. package/src/components/modal-alert/svg/info.svg +4 -1
  22. package/src/components/modal-alert/svg/success.svg +4 -1
  23. package/src/components/modal-alert/svg/warning.svg +4 -1
  24. package/src/components/slide-up-down-toggle/slide-up-down-toggle.module.css +2 -2
  25. package/src/css/dimensions.css +3 -0
  26. package/src/css/margin-padding-bootstrap-media.css +1844 -0
  27. package/src/css/margin-padding-bootstrap.css +464 -0
  28. package/src/css/margin-padding-media.css +1843 -0
  29. package/src/css/margin-padding.css +405 -45
  30. package/src/custom-media.css +12 -0
  31. package/src/custom-properties.css +24 -0
  32. package/src/minimo.css +5 -0
  33. package/src/components/modal-alert/TODO modal-alert-demo/demo.css +0 -63
  34. package/src/components/modal-alert/TODO modal-alert-demo/demo.js +0 -155
  35. package/src/components/modal-alert/TODO.md +0 -3
  36. package/src/components/modal-alert/customization-templates/custom-modal-alert.css +0 -46
  37. package/src/components/modal-alert/customization-templates/custom-modal-alert.js +0 -89
  38. package/src/components/modal-alert/defaults.js +0 -58
  39. package/src/components/modal-alert/marks.js +0 -9
  40. package/src/components/modal-alert/modal-alert.css +0 -159
  41. package/src/components/modal-alert/svg/svg-to-js.mjs +0 -26
@@ -1,155 +0,0 @@
1
- import mAlert from '../src/modal-alert.js';
2
-
3
- const custom_defaults = {
4
-
5
- //settings to be applied to all dialog types
6
- globals: {
7
- onOpen: () => {
8
- // console.log('open'); // eslint-disable-line
9
- document.body.classList.add('modal-alert-is-open');
10
- },
11
- onClose: () => {
12
- // console.log('close'); // eslint-disable-line
13
- document.body.classList.remove('modal-alert-is-open');
14
- },
15
- cssFile: null
16
- },
17
-
18
- success: {
19
- title: 'Done!',
20
- mes: null,
21
- ok_btn_text: 'OK',
22
- heading_class: 'text-success',
23
- ok_btn_class: 'btn',
24
- timer: 4000, // ms
25
- },
26
- error: {
27
- title: 'An error has occurred',
28
- mes: null,
29
- ok_btn_text: 'OK',
30
- heading_class: null,
31
- text_class: null,
32
- ok_btn_class: 'btn',
33
- timer: null,
34
- },
35
- warning: {
36
- title: 'Attention!',
37
- mes: null,
38
- ok_btn_text: 'OK',
39
- heading_class: null,
40
- text_class: null,
41
- ok_btn_class: 'btn',
42
- timer: null,
43
- },
44
- info: {
45
- title: null,
46
- mes: null,
47
- ok_btn_text: 'OK',
48
- heading_class: null,
49
- text_class: null,
50
- ok_btn_class: 'btn',
51
- timer: null,
52
- },
53
- confirm: {
54
- title: 'Do you confirm?',
55
- mes: null,
56
- ok_btn_text: 'OK',
57
- cancel_btn_text: 'Cancel',
58
- cancel_focus: true, // false to give focus to the ok button
59
- heading_class: null,
60
- text_class: null,
61
- ok_btn_class: 'btn btn-outline',
62
- cancel_btn_class: 'btn',
63
- callback: null,
64
- timer: null,
65
- }
66
- };
67
-
68
- document.querySelector('.demo-success').addEventListener('click', () => {
69
- mAlert({
70
- type : 'success',
71
- mes: 'Lorem ipsum dolor sit amet',
72
- callback: () => alert('callback')
73
- }, custom_defaults);
74
- }, false);
75
-
76
- document.querySelector('.demo-info').addEventListener('click', () => {
77
- mAlert({
78
- type : 'info',
79
- title: 'Info',
80
- mes: '<strong>Lorem ipsum</strong> dolor sit amet'
81
- }, custom_defaults);
82
- }, false);
83
-
84
- document.querySelector('.demo-error').addEventListener('click', () => {
85
- mAlert({
86
- type : 'error'
87
- }, custom_defaults);
88
- }, false);
89
-
90
- document.querySelector('.demo-error-extra-btn').addEventListener('click', () => {
91
- mAlert({
92
- type : 'error',
93
- ok_btn_class: 'btn btn-error btn btn-outline',
94
- extra_btn: '<button type="button" data-malert-result="extra-btn-result" class="btn btn-error extra-btn">Extra btn</button>',
95
- extra_btn_selector: '.extra-btn',
96
- extra_btn_focus: true,
97
- callback: result => alert(result === 'extra-btn-result'? 'Extra button pressed' : 'OK button pressed')
98
- }, custom_defaults);
99
- }, false);
100
-
101
- document.querySelector('.demo-warning').addEventListener('click', () => {
102
- mAlert({
103
- type : 'warning',
104
- mes: '<p>Quo dolorum cumque quo placeat aperiam doloribus dolorum animi. Sunt et dolores quas autem. Porro inventore ratione. Ex facere doloremque. Consectetur enim dolor. Sint ut facere quidem et et dicta natus itaque.</p> <p>Odit in eos repellat exercitationem tempore blanditiis voluptate. Dignissimos est tempora qui ducimus at et expedita esse.</p>'
105
- }, custom_defaults);
106
- }, false);
107
-
108
- document.querySelector('.demo-confirm').addEventListener('click', () => {
109
- mAlert({
110
- type : 'confirm',
111
- callback: result => alert(`${result? 'OK' : 'Cancel'} button pressed`)
112
- }, custom_defaults);
113
- }, false);
114
-
115
-
116
- // forms
117
- // Confirm on form submit
118
- document.getElementById('test-form').addEventListener('submit', e => {
119
- let choiceIsNeeded = true;
120
-
121
- if(choiceIsNeeded) {
122
- e.preventDefault();
123
- mAlert({
124
- type : 'confirm',
125
- title: 'A choice is needed',
126
- mes: 'Some message...',
127
- ok_btn_text: 'Continue submit',
128
- cancel_btn_text: 'Stop',
129
- callback: result => {
130
- if(result) {
131
- alert('submit');
132
- e.target.submit();
133
- } else {
134
- alert('submit canceled');
135
- }
136
- }
137
- }, custom_defaults);
138
- }
139
-
140
- }, false);
141
-
142
- // Error on form submit
143
- document.getElementById('test-form2').addEventListener('submit', e => {
144
- let isError = true;
145
-
146
- if(isError) {
147
- e.preventDefault();
148
- mAlert({
149
- type : 'error',
150
- title: 'Oh my! There is an error...',
151
- mes: 'Some message'
152
- }, custom_defaults);
153
- }
154
-
155
- }, false);
@@ -1,3 +0,0 @@
1
- da rivedere
2
- spostare custom props nel dictionary
3
- eliminare customization-templates, gestire tutto da tokens
@@ -1,46 +0,0 @@
1
-
2
- @import '@massimo-cassandro/modal-alert';
3
-
4
-
5
- .modal-alert {
6
- --malert-success-color: var(--status-success-color);
7
- --malert-success-color-fg: var(--status-success-fg);
8
-
9
- --malert-info-color: var(--status-info-color);
10
- --malert-info-color-fg: var(--status-info-fg);
11
-
12
- --malert-warning-color: var(--status-warning-color);
13
- --malert-warning-color-fg: var(--status-warning-fg);
14
-
15
- --malert-danger-color: var(--status-danger-color);
16
- --malert-danger-color-fg: var(--status-danger-fg);
17
-
18
- --malert-confirm-color: var(--status-warning-color);
19
- --malert-confirm-color-fg: var(--status-warning-fg);
20
-
21
- /* --malert-marks-stroke-width: 6px; */
22
- --malert-backdrop: rgb(0 0 0 / .3);
23
- --malert-border-radius: var(--radius-md);
24
- /* --malert-box-shadow: var(--box-shadow); */
25
- --malert-heading-font-family: var(--font-family);
26
- /* --malert-heading-line-height: */
27
- --malert-heading-font-size: 1.8rem;
28
- --malert-heading-font-weigth: var(--font-size-base);
29
- --malert-body-font-family: var(--font-family);
30
-
31
- top: 50%;
32
- left: 50%;
33
- translate: -50% -50%;
34
- }
35
-
36
-
37
-
38
- .malert-mark {
39
- svg {
40
- width: 7rem;
41
- max-width: none;
42
- height: 7rem;
43
- fill: var(--malert-color-fg);
44
- stroke: none;
45
- }
46
- }
@@ -1,89 +0,0 @@
1
- // import './modal-alert.css'; // importato direttamente dal css principale per ottimizzarne l'uso
2
-
3
- import modalAlert from '@massimo-cassandro/modal-alert';
4
-
5
- import checkIcon from './svg/check-circle-duotone.svg?inline';
6
- import infoIcon from './svg/info-duotone.svg?inline';
7
- import confirmIcon from './svg/question-duotone.svg?inline';
8
- import warningIcon from './svg/warning-duotone.svg?inline';
9
- import errorIcon from './svg/x-circle-duotone.svg?inline';
10
-
11
- const custom_defaults = {
12
-
13
- globals: {
14
- onOpen: () => {
15
- document.body.classList.add('overflow-hidden');
16
- },
17
- onClose: () => {
18
- document.body.classList.remove('overflow-hidden');
19
- },
20
- cssFile: null,
21
- animation: true,
22
- showMarks: true,
23
- },
24
-
25
- success: {
26
- title: 'Operazione completata',
27
- mes: null,
28
- ok_btn_text: 'OK',
29
- heading_class: null,
30
- ok_btn_class: 'btn btn-success',
31
- timer: 4000, // ms
32
- },
33
- error: {
34
- title: 'Si è verificato un errore',
35
- mes: null,
36
- ok_btn_text: 'OK',
37
- heading_class: null,
38
- text_class: null,
39
- ok_btn_class: 'btn btn-danger',
40
- timer: null,
41
- },
42
- warning: {
43
- title: 'Attenzione!',
44
- mes: null,
45
- ok_btn_text: 'OK',
46
- heading_class: null,
47
- text_class: null,
48
- ok_btn_class: 'btn btn-warning',
49
- timer: null,
50
- },
51
- info: {
52
- title: null,
53
- mes: null,
54
- ok_btn_text: 'OK',
55
- heading_class: null,
56
- text_class: null,
57
- ok_btn_class: 'btn btn-info',
58
- timer: null,
59
- },
60
- confirm: {
61
- title: 'Confermi?',
62
- mes: null,
63
- ok_btn_text: 'OK',
64
- cancel_btn_text: 'Cancel',
65
- cancel_focus: true, // false to give focus to the ok button
66
- heading_class: null,
67
- text_class: null,
68
- ok_btn_class: 'btn btn-warning',
69
- cancel_btn_class: 'btn btn-outline-secondary',
70
- callback: null,
71
- timer: null
72
- }
73
- };
74
-
75
- const marks = {
76
- success: checkIcon,
77
- error: errorIcon,
78
- warning: warningIcon,
79
- info: infoIcon,
80
- confirm: confirmIcon
81
- };
82
-
83
- /**
84
- * @param {Record<string, *>} params
85
- * @returns {void}
86
- */
87
- export function mAlert(params) {
88
- modalAlert(params, custom_defaults, marks);
89
- }
@@ -1,58 +0,0 @@
1
- /**
2
- * Default configuration for all modal-alert dialog types.
3
- * Type-specific blocks can override any `globals` setting.
4
- */
5
- export const defaults = {
6
-
7
- // settings applied to all dialog types; can be overridden per type
8
- globals: {
9
- extra_class: null,
10
- onOpen: null,
11
- onClose: null,
12
- cssFile: null, // css file to be automatically loaded // TODO remove
13
- animation: true,
14
- showMarks: true,
15
- callback: null,
16
- timer: null,
17
- mes: null,
18
- heading_class: null,
19
- text_class: null,
20
-
21
- // extra btn markup, ignored on confirm
22
- extra_btn: null,
23
- extra_btn_selector: null,
24
- extra_btn_focus: true
25
- },
26
-
27
- success: {
28
- title: 'Operazione completata',
29
- ok_btn_text: 'OK',
30
- ok_btn_class: 'btn',
31
- timer: 4000 // ms
32
- },
33
- error: {
34
- title: 'Si è verificato un errore',
35
- ok_btn_text: 'OK',
36
- ok_btn_class: 'btn'
37
- },
38
- warning: {
39
- title: 'Attenzione!',
40
- ok_btn_text: 'OK',
41
- ok_btn_class: 'btn'
42
- },
43
- info: {
44
- title: null,
45
- ok_btn_text: 'OK',
46
- ok_btn_class: 'btn'
47
- },
48
- confirm: {
49
- title: 'Confermi?',
50
- use_warning_icon: false, // when true, uses the warning icon instead of the confirm icon
51
- ok_btn_text: 'OK',
52
- cancel_btn_text: 'Annulla',
53
- cancel_focus: true, // false to give focus to the ok button
54
- ok_btn_class: 'btn btn-outline',
55
- cancel_btn_class: 'btn'
56
- }
57
-
58
- };
@@ -1,9 +0,0 @@
1
- /* eslint-disable quotes */
2
-
3
- /*
4
- This file was generated by the script `svg-to-js.mjs`
5
- (https://github.com/massimo-cassandro/modal-alert/blob/main/src/svg/svg-to-js.mjs).
6
- DO NOT EDIT (any changes will be overwritten)
7
- */
8
-
9
- export const marks = {"confirm":"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 132 132\"><circle cx=\"66\" cy=\"66\" r=\"63\"/><path d=\"M44 48a21.928 21.928 0 0 1 6.443-15.556A21.931 21.931 0 0 1 66 26c12.15 0 22 9.85 22 22 0 6.14-2.668 11.543-6.573 15.683-6.514 6.91-15.363 4.47-15.363 16.065v7.935M66 105.816v-6.975\"/></svg>\n","error":"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 132 132\"><circle cx=\"66\" cy=\"66\" r=\"63\"/><path d=\"M35 39l61.4 54.4m0-54.4L35 93.2\"/></svg>\n","info":"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 132 132\"><circle cx=\"66\" cy=\"66\" r=\"63\"/><path d=\"M74 105l-8.6.237V45.713L56 46m9.6-13.025V26\"/></svg>\n","success":"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 132 132\"><circle cx=\"66\" cy=\"66\" r=\"63\"/><path d=\"M101.4 42L52.7 90.6 31 69.3\"/></svg>\n","warning":"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 132 132\"><circle cx=\"66\" cy=\"66\" r=\"63\"/><path d=\"M41.839 72.475v-37.2c0-3.852 3.143-6.975 7.02-6.975s7.02 3.123 7.02 6.975V65.5m0-30.225v-9.3c0-3.852 3.143-6.975 7.02-6.975s7.02 3.123 7.02 6.975V65.5m0-30.225c0-3.852 3.143-6.975 7.02-6.975 3.878 0 7.02 3.123 7.02 6.975V65.5m0-20.925c0-3.852 3.144-6.975 7.02-6.975 3.878 0 7.021 3.123 7.021 6.975V84.1C98 99.509 85.428 112 69.92 112h-9.36c-9.896-1.357-18.517-6.496-23.401-13.95L24.522 73.637c-2.584-3.53-1.799-8.475 1.755-11.043 3.555-2.568 8.531-1.788 11.116 1.743l4.212 8.138\"/></svg>\n"};
@@ -1,159 +0,0 @@
1
- .modal-alert {
2
- width: 600px;
3
- max-width: 90vw;
4
- padding: 0;
5
- background-color: var(--malert-background-color, #fff);
6
- border: none;
7
- border-radius: var(--malert-border-radius, 6px);
8
-
9
- /* https://www.joshwcomeau.com/shadow-palette/ */
10
- --default-shadow-color: 0deg 0% 0%;
11
- --default-box-shadow:
12
- 0 .4px 04px hsl(var(--default-shadow-color) / .15),
13
- -.3px 3px 3.3px -.5px hsl(var(--default-shadow-color) / .15),
14
- -.5px 6.1px 6.6px -.9px hsl(var(--default-shadow-color) / .14),
15
- -.9px 11.2px 12.1px -1.4px hsl(var(--default-shadow-color) / .14),
16
- -1.6px 19.5px 21.1px -1.9px hsl(var(--default-shadow-color) / .13),
17
- -2.7px 32.7px 35.4px -2.3px hsl(var(--default-shadow-color) / .13),
18
- -4.3px 52px 56.4px -2.8px hsl(var(--default-shadow-color) / .12);
19
-
20
- box-shadow: var(--malert-box-shadow, var(--default-box-shadow));
21
- /* box-shadow: 2px 2px 12px #000; */
22
-
23
- &::backdrop {
24
- overscroll-behavior: contain;
25
- background-color: var(--malert-backdrop, rgba(0 0 0 / .7));
26
- }
27
-
28
- &, * {
29
- box-sizing: border-box;
30
- }
31
-
32
- &.modal-alert-success {
33
- --malert-color: var(--malert-success-color, hsl(123deg 51% 33%));
34
- --malert-color-fg: var(--malert-success-color-fg, #fff);
35
- }
36
- &.modal-alert-info {
37
- --malert-color: var(--malert-info-color, hsl(201deg 98% 41%));
38
- --malert-color-fg: var(--malert-info-color-fg, #fff);
39
- }
40
- &.modal-alert-warning {
41
- --malert-color: var(--malert-warning-color, hsl(29deg 99% 40%));
42
- --malert-color-fg: var(--malert-warning-color-fg, #fff);
43
- }
44
- &.modal-alert-error {
45
- --malert-color: var(--malert-error-color, hsl(0deg 100% 40%));
46
- --malert-color-fg: var(--malert-error-color-fg, #fff);
47
- }
48
- &.modal-alert-confirm {
49
- --malert-color: var(--malert-confirm-color, hsl(277deg 72% 45%));
50
- --malert-color-fg: var(--malert-confirm-color-fg, #fff);
51
- }
52
- }
53
-
54
- .malert-inner {
55
- display: flex;
56
- flex-flow: column nowrap;
57
- /* gap: .7rem; */
58
- align-items: stretch;
59
- justify-content: flex-start;
60
-
61
- @media screen and (min-width: 600px) {
62
- flex-direction: row;
63
- }
64
- }
65
-
66
-
67
- .malert-mark {
68
- display: flex;
69
- flex: 0;
70
- align-items: center;
71
- justify-content: center;
72
- width: 100%;
73
- padding: .4rem;
74
- background-color: var(--malert-color);
75
-
76
- svg {
77
- width: 100px;
78
- aspect-ratio: 1;
79
- fill: none;
80
- stroke: var(--malert-color-fg);
81
- stroke-linecap: round;
82
- stroke-linejoin: round;
83
- stroke-width: var(--malert-marks-stroke-width, 6px);
84
- }
85
-
86
- @media screen and (min-width: 600px) {
87
- flex-direction: row;
88
- align-items: flex-start;
89
- width: auto;
90
- padding: 1rem;
91
- /* svg {
92
- width: 100px;
93
- } */
94
- }
95
- }
96
-
97
- .malert-body {
98
- display: flex;
99
- flex: 1;
100
- flex-flow: column nowrap;
101
- gap: .5rem;
102
- align-items: stretch;
103
- justify-content: flex-start;
104
- padding: .5rem;
105
-
106
- text-align: center;
107
-
108
- @media screen and (min-width: 600px) {
109
- padding: 1rem;
110
- text-align: left;
111
- }
112
- }
113
-
114
- .malert-heading {
115
- font-family: var(--malert-heading-font-family, sans-serif);
116
- font-size: var(--malert-heading-font-size, 2rem);
117
- font-weight: var(--malert-heading-font-weight, 700);
118
- line-height: var(--malert-heading-line-height, 1.2);
119
- }
120
- .malert-text {
121
- font-family: var(--malert-text-font-family, sans-serif);
122
-
123
- }
124
- .malert-btns {
125
- display: flex;
126
- flex-flow: column nowrap;
127
- gap: 1rem;
128
- align-items: center;
129
- justify-content: flex-start;
130
-
131
- padding-top: 1rem;
132
- margin-top: auto;
133
-
134
- @media screen and (min-width: 600px) {
135
- flex-direction: row;
136
- justify-content: space-between;
137
- }
138
- }
139
-
140
-
141
- .modal-alert-animated {
142
- transform: translateY(-500%);
143
- animation: dialog-in .3s ease-out;
144
-
145
- &[open] {
146
- transform: none;
147
- }
148
- }
149
-
150
- @keyframes dialog-in {
151
- from {
152
- opacity: 0;
153
- transform: translateY(-50%);
154
- }
155
- to {
156
- opacity: 1;
157
- transform: translateY(0);
158
- }
159
- }
@@ -1,26 +0,0 @@
1
- /* eslint-disable no-console */
2
- // build a js file with all svgs as variables
3
-
4
- import * as fs from 'fs';
5
- import * as path from 'path';
6
-
7
- const __dirname = new URL('.', import.meta.url).pathname
8
- ,target_file = path.resolve(__dirname, '../marks.js')
9
- ,marks = {};
10
-
11
- ['confirm', 'error', 'info', 'success', 'warning'].forEach(svg => {
12
- const svg_content = fs.readFileSync(path.resolve(__dirname, `./${svg}.svg`), 'utf8');
13
- marks[svg] = svg_content; //.replaceAll('\'', '\\\'');
14
- });
15
-
16
- const content = '/* eslint-disable quotes */\n\n' +
17
- '/*\n' +
18
- ' This file was generated by the script `svg-to-js.mjs`\n' +
19
- ' (https://github.com/massimo-cassandro/modal-alert/blob/main/src/svg/svg-to-js.mjs).\n' +
20
- ' DO NOT EDIT (any changes will be overwritten)\n' +
21
- '*/\n\n' +
22
- 'export const marks = ' + JSON.stringify(marks) + ';';
23
-
24
- fs.writeFileSync(target_file, content, 'utf-8');
25
-
26
- console.log('svg-to-js: DONE');