@massimo-cassandro/minimo 0.6.6 → 0.7.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.
- package/design-tokens/components/sf-macro.minimo.tokens.jsonc +20 -2
- package/design-tokens-src/components/sf-macro.minimo.tokens.mjs +32 -14
- package/package.json +1 -1
- package/src/components/sf-macro/sf-macro.css +9 -3
- package/src/components/sf-macro/sf-macro.js +3 -2
- package/src/custom-properties-default.css +6 -9
- package/src/icons/caret-down-bold.svg +1 -0
- package/design-tokens-src/components/recaptcha.minimo.tokens.jsonc +0 -24
- package/design-tokens-src/components/toast.minimo.tokens.jsonc +0 -29
- package/src/components/alert-autoclose.js +0 -9
- package/src/components/auto-datatable/auto-datatable.css +0 -355
- package/src/components/auto-datatable/auto-datatable.js +0 -154
- package/src/components/create-blurhash-canvas.js +0 -47
- package/src/components/img-viewer-dom-builder.js +0 -196
- package/src/components/modal-alert/flash-alerts.js +0 -32
- package/src/components/modal-content/modal-content.js +0 -152
- package/src/components/modal-content/modal-content.module.css +0 -142
- package/src/components/popup-page/popup-page.css +0 -72
- package/src/components/popup-page/popup-page.js +0 -84
- package/src/components/print-icon.js +0 -51
- package/src/components/recaptcha/recaptcha.css +0 -73
- package/src/components/spinner/TODO spinner-circle.css +0 -54
- package/src/components/spinner/TODO spinner-three-dots.css +0 -14
- package/src/components/spinner/readme.md +0 -1
- package/src/components/spinner/spinner-trailing-dots.css +0 -51
- package/src/components/spinner/spinner-wrapper.css +0 -20
- package/src/components/spinner/spinner.js +0 -30
- package/src/components/toast/toast.js +0 -77
- package/src/components/toast/toast.module.css +0 -59
- package/src/components/vanilla-cookie-consent/cookie-consent.css +0 -20
- package/src/components/vanilla-cookie-consent/cookie-consent.js +0 -76
- package/src/components/vanilla-cookie-consent/render-cookie-list.js +0 -32
- package/src/components/vanilla-cookie-consent/src/cookie-list.js +0 -85
- package/src/components/vanilla-cookie-consent/src/it-translation.js +0 -38
- package/src/components/vanilla-cookie-consent/src/run-analytics.js +0 -54
- package/src/components/vanilla-cookie-consent/src/run-recaptcha.js +0 -71
- package/src/css/forms/select-indicator.svg +0 -3
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
/* TODO custom props nel file generale */
|
|
2
|
-
/* TODO prevedere opzione con bordo del pulsante di chiusura (NB: si disallinea) */
|
|
3
|
-
/* TODO cambiare icona chiusura con svg? */
|
|
4
|
-
/* TODO aggiungere wrapper intorno a dialogInner (a filo con il dialog) per la scroll bar */
|
|
5
|
-
|
|
6
|
-
.dialog { /* dialog */
|
|
7
|
-
--modal-border-radius: var(--radius-md, 1.2rem);
|
|
8
|
-
position: fixed;
|
|
9
|
-
max-width: 80dvw;
|
|
10
|
-
max-height: 90dvh;
|
|
11
|
-
padding: 0;
|
|
12
|
-
margin: auto;
|
|
13
|
-
overflow: visible;
|
|
14
|
-
background-color: var(--body-bg-color, #fff);
|
|
15
|
-
border: none;
|
|
16
|
-
border-radius: var(--modal-border-radius);
|
|
17
|
-
box-shadow: 0 0 2rem .5rem rgb(0 0 0 / .5);
|
|
18
|
-
transition: scale .2s ease-out;
|
|
19
|
-
scale: 0;
|
|
20
|
-
|
|
21
|
-
/* stylelint-disable selector-class-pattern */
|
|
22
|
-
&.size-full {
|
|
23
|
-
width: 80dvw;
|
|
24
|
-
height: 90dvh;
|
|
25
|
-
}
|
|
26
|
-
/* dimensioni std -> size == 'large' */
|
|
27
|
-
&.size-large {
|
|
28
|
-
width: 50rem; /* 800px */
|
|
29
|
-
height: auto;
|
|
30
|
-
}
|
|
31
|
-
&.size-medium {
|
|
32
|
-
width: 37.5rem; /* 600px */
|
|
33
|
-
height: 37.5rem;
|
|
34
|
-
}
|
|
35
|
-
&.size-small {
|
|
36
|
-
width: 32rem; /* ~500 x 400 */
|
|
37
|
-
height: 25rem;
|
|
38
|
-
}
|
|
39
|
-
/* stylelint-enable selector-class-pattern */
|
|
40
|
-
|
|
41
|
-
&.on {
|
|
42
|
-
scale: 1;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
&::backdrop {
|
|
46
|
-
overscroll-behavior: contain;
|
|
47
|
-
background-color: rgb(0 0 0 / .7);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.dialogInner {
|
|
53
|
-
width: 100%;
|
|
54
|
-
height: 100%;
|
|
55
|
-
padding-inline-end: var(--size-md);
|
|
56
|
-
overflow-x: hidden;
|
|
57
|
-
overflow-y: auto;
|
|
58
|
-
/* scrollbar-gutter: stable; */
|
|
59
|
-
border-radius: var(--modal-border-radius);
|
|
60
|
-
|
|
61
|
-
/* stylelint-disable selector-class-pattern */
|
|
62
|
-
.padding-std & {
|
|
63
|
-
padding: var(--size-md) 0;
|
|
64
|
-
}
|
|
65
|
-
.padding-none & {
|
|
66
|
-
padding: 0;
|
|
67
|
-
}
|
|
68
|
-
/* stylelint-enable selector-class-pattern */
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.modalSpinner {
|
|
72
|
-
position: relative;
|
|
73
|
-
padding-block-start: var(--size-2xl);
|
|
74
|
-
|
|
75
|
-
.dialog.on & {
|
|
76
|
-
display: none;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.iframeEl, .contentEl {
|
|
81
|
-
width: 100%;
|
|
82
|
-
overscroll-behavior: contain;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.iframeEl {
|
|
86
|
-
height: 100%;
|
|
87
|
-
padding: 0;
|
|
88
|
-
margin: 0;
|
|
89
|
-
border: none;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.contentEl {
|
|
93
|
-
min-height: 100%;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.closeButton {
|
|
97
|
-
--btn-color: var(--secondary-fg, #000);
|
|
98
|
-
--btn-bg-color: var(--secondary, #fff);
|
|
99
|
-
--btn-hover-color: var(--secondary, #fff);
|
|
100
|
-
--btn-hover-bg-color: var(--secondary-fg, #000);
|
|
101
|
-
--icon-size: 2.5rem;
|
|
102
|
-
--btn-padding: var(--size-xs, .5rem);
|
|
103
|
-
--icon-bars-thickness: 3px;
|
|
104
|
-
|
|
105
|
-
position: absolute;
|
|
106
|
-
top: calc(-1 * var(--icon-size) / 3);
|
|
107
|
-
right: calc(-1 * var(--icon-size) / 3);
|
|
108
|
-
display: block;
|
|
109
|
-
width: var(--icon-size);
|
|
110
|
-
height: var(--icon-size);
|
|
111
|
-
padding: var(--btn-padding);
|
|
112
|
-
color: var(--btn-color);
|
|
113
|
-
cursor: pointer;
|
|
114
|
-
background-color: var(--btn-bg-color);
|
|
115
|
-
/* border: var(--icon-bars-thickness) solid currentColor; */
|
|
116
|
-
border: none;
|
|
117
|
-
border-radius: 50%;
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
&:hover {
|
|
121
|
-
--btn-color: var(--btn-hover-color);
|
|
122
|
-
--btn-bg-color: var(--btn-hover-bg-color);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
&::before, &::after {
|
|
126
|
-
position: absolute;
|
|
127
|
-
top: 50%;
|
|
128
|
-
left: var(--btn-padding);
|
|
129
|
-
display: block;
|
|
130
|
-
width: calc(var(--icon-size) - (var(--btn-padding) * 2));
|
|
131
|
-
height: var(--icon-bars-thickness);
|
|
132
|
-
content: '';
|
|
133
|
-
background: currentColor;
|
|
134
|
-
}
|
|
135
|
-
&::before {
|
|
136
|
-
transform: translateY(-50%) rotate(45deg);
|
|
137
|
-
}
|
|
138
|
-
&::after {
|
|
139
|
-
transform: translateY(-50%) rotate(-45deg);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
.content-dialog {
|
|
2
|
-
display: none;
|
|
3
|
-
width: 90dvw;
|
|
4
|
-
max-width: 900px;
|
|
5
|
-
height: 90dvh;
|
|
6
|
-
padding: 1rem;
|
|
7
|
-
margin: auto;
|
|
8
|
-
background-color: var(--body-background-color);
|
|
9
|
-
border: none;
|
|
10
|
-
border-radius: var(--radius-lg);
|
|
11
|
-
box-shadow: var(--shadow-4);
|
|
12
|
-
transform: translateY(-200vh);
|
|
13
|
-
animation: dialog-in .3s ease-out;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
&[open] {
|
|
17
|
-
display: block;
|
|
18
|
-
transform: none;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
&::backdrop {
|
|
22
|
-
overscroll-behavior: contain;
|
|
23
|
-
background-color: color-mix(in srgb, #000 40%, transparent);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.content-dialog-close {
|
|
28
|
-
position: sticky;
|
|
29
|
-
top: 0;
|
|
30
|
-
z-index: 1;
|
|
31
|
-
align-self: flex-end;
|
|
32
|
-
|
|
33
|
-
button {
|
|
34
|
-
top: -.5rem;
|
|
35
|
-
right: -.5rem;
|
|
36
|
-
width: 2rem;
|
|
37
|
-
aspect-ratio: 1;
|
|
38
|
-
padding: 4px;
|
|
39
|
-
background-color: var(--body-background-color);
|
|
40
|
-
border: 1px solid var(--neutral-100);
|
|
41
|
-
border-radius: 50%;
|
|
42
|
-
box-shadow: var(--shadow-3);
|
|
43
|
-
|
|
44
|
-
@media (hover: hover) { /* @media (any-hover: hover) { */
|
|
45
|
-
&:hover {
|
|
46
|
-
background-color: color-mix(in srgb, var(--text-color) 10%, transparent);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
svg {
|
|
53
|
-
width: 1.5rem;
|
|
54
|
-
aspect-ratio: 1;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.content-dialog-inner {
|
|
59
|
-
position: relative;
|
|
60
|
-
z-index: 0;
|
|
61
|
-
display: flex;
|
|
62
|
-
flex-flow: column nowrap;
|
|
63
|
-
gap: .4rem;
|
|
64
|
-
align-items: stretch;
|
|
65
|
-
justify-content: flex-start;
|
|
66
|
-
isolation: isolate;
|
|
67
|
-
}
|
|
68
|
-
.content-dialog-body {
|
|
69
|
-
position: relative;
|
|
70
|
-
flex: 1;
|
|
71
|
-
overflow: auto;
|
|
72
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
// TODO completare
|
|
2
|
-
|
|
3
|
-
import './popup-page.css';
|
|
4
|
-
import xIcon from '@icone/x.svg?inline';
|
|
5
|
-
import { spinner } from '../spinner/spinner';
|
|
6
|
-
/**
|
|
7
|
-
`indicator_class`: classe da aggiungere al wrapper per indicare in modo univoco il dialog
|
|
8
|
-
*/
|
|
9
|
-
export function content_dialog_markup(indicator_class) {
|
|
10
|
-
|
|
11
|
-
return `<dialog class="${indicator_class} content-dialog">` +
|
|
12
|
-
'<div class="content-dialog-inner">' +
|
|
13
|
-
'<div class="content-dialog-close">' +
|
|
14
|
-
`<button type="button" class="btn-reset content-dialog-close-btn" aria-label="Chiudi finestra">${xIcon}</button>` +
|
|
15
|
-
'</div>' +
|
|
16
|
-
'<div class="content-dialog-body"></div>' +
|
|
17
|
-
'</div>'+
|
|
18
|
-
'</dialog>';
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
`content_url` : url del file contenente il contenuto da caricare via ajax
|
|
24
|
-
`indicator_class`: classe da aggiungere al wrapper per indicare in modo univoco il dialog
|
|
25
|
-
`once_callback` : callback da invocare solo la prima volta, alla creazione del dialog
|
|
26
|
-
*/
|
|
27
|
-
let dialog_list = {};
|
|
28
|
-
export async function show_ajax_content_dialog({content_url, class_identifier, once_callback = null}){
|
|
29
|
-
|
|
30
|
-
const close_dialog = (class_identifier) => {
|
|
31
|
-
dialog_list[class_identifier].close();
|
|
32
|
-
document.body.classList.remove('overflow-hidden');
|
|
33
|
-
}
|
|
34
|
-
,open_dialog = (class_identifier) => {
|
|
35
|
-
dialog_list[class_identifier].showModal();
|
|
36
|
-
document.body.classList.add('overflow-hidden');
|
|
37
|
-
}
|
|
38
|
-
;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if(!Object.keys(dialog_list).includes(class_identifier)) {
|
|
42
|
-
document.body.insertAdjacentHTML('beforeend',
|
|
43
|
-
content_dialog_markup(class_identifier)
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
const dialog = document.querySelector(`.content-dialog.${class_identifier}`);
|
|
47
|
-
dialog_list[class_identifier] = dialog;
|
|
48
|
-
dialog.querySelector('.content-dialog-close-btn').addEventListener('click', () => {
|
|
49
|
-
close_dialog(class_identifier);
|
|
50
|
-
}, false);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const dialog_body = dialog.querySelector('.content-dialog-body');
|
|
54
|
-
dialog_body.innerHTML = spinner();
|
|
55
|
-
open_dialog(class_identifier);
|
|
56
|
-
|
|
57
|
-
const url = content_url;
|
|
58
|
-
(async () => {
|
|
59
|
-
const response = await fetch(url),
|
|
60
|
-
content = await response.text();
|
|
61
|
-
return content;
|
|
62
|
-
})()
|
|
63
|
-
.then(content => {
|
|
64
|
-
dialog_body.innerHTML = content;
|
|
65
|
-
|
|
66
|
-
if(once_callback && typeof once_callback === 'function') {
|
|
67
|
-
once_callback(dialog_body);
|
|
68
|
-
}
|
|
69
|
-
})
|
|
70
|
-
.catch(err => {
|
|
71
|
-
/* eslint-disable no-console */
|
|
72
|
-
console.error(url);
|
|
73
|
-
console.error(err);
|
|
74
|
-
/* eslint-enable no-console */
|
|
75
|
-
|
|
76
|
-
alert('Si è verificato un errore.\n'+
|
|
77
|
-
'Ricarica la pagina e ripeti l’operazione');
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
} else {
|
|
81
|
-
open_dialog(class_identifier);
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { domBuilder } from '@massimo-cassandro/js-utilities/index.js';
|
|
2
|
-
|
|
3
|
-
const icon_file = document.body.dataset.icons;
|
|
4
|
-
|
|
5
|
-
export function printIcon({iconId, className='icon', title= null, output = 'html'}) {
|
|
6
|
-
|
|
7
|
-
if(!['html', 'element', 'builderArray'].includes(output)) {
|
|
8
|
-
// eslint-disable-next-line no-console
|
|
9
|
-
console.error(`'printIcon': parametro output non corretto (${output}). `+
|
|
10
|
-
'Deve essere `html`, `element` o `builderArray`');
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
// accetta anche un solo argomento stringa (= iconId)
|
|
14
|
-
if(arguments.length === 1 && typeof arguments[0] === 'string') {
|
|
15
|
-
iconId = arguments[0];
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const iconArray = [
|
|
20
|
-
{
|
|
21
|
-
tag: 'svg',
|
|
22
|
-
className: className,
|
|
23
|
-
children: [
|
|
24
|
-
{
|
|
25
|
-
tag: 'title',
|
|
26
|
-
content: title,
|
|
27
|
-
condition: title != null
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
tag: 'use',
|
|
31
|
-
attrs: {
|
|
32
|
-
href: `${icon_file}#${iconId}`
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
]
|
|
36
|
-
}
|
|
37
|
-
];
|
|
38
|
-
|
|
39
|
-
if(output === 'builderArray') {
|
|
40
|
-
return iconArray;
|
|
41
|
-
} else {
|
|
42
|
-
|
|
43
|
-
const iconElement = domBuilder(iconArray);
|
|
44
|
-
if(output === 'element') {
|
|
45
|
-
return iconElement;
|
|
46
|
-
} else {
|
|
47
|
-
return iconElement.outerHTML;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
|
|
3
|
-
{%- set chiave_recaptcha_client = '6Le75-AZAAAAAO1sEV1JChhNg3nYw1HBn9AjaVSN' -%}
|
|
4
|
-
<div class="recaptcha-form-wrapper disabled" data-key="{{ chiave_recaptcha_client }}">
|
|
5
|
-
|
|
6
|
-
<form id="form-xxx" action="" method="post">
|
|
7
|
-
..
|
|
8
|
-
</form>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
<div class="recaptcha-alert">Per abilitare questo form è necessario attivare
|
|
12
|
-
i cookie per le funzionalità aggiuntive modificando le tue
|
|
13
|
-
<button class="btn btn-link" type="button" data-cc="show-preferencesModal" aria-haspopup="dialog">preferenze per i cookie</button></div>
|
|
14
|
-
|
|
15
|
-
<p class="text-xs">Questo modulo è protetto da Google reCAPTCHA.
|
|
16
|
-
Per info consulta la <a href="https://policies.google.com/privacy" target="_blank" rel="noopener noreferrer">Privacy Policy</a> di Google
|
|
17
|
-
e i <a href="https://policies.google.com/terms" target="_blank" rel="noopener noreferrer">termini di servizio</a>.</p>
|
|
18
|
-
</div>
|
|
19
|
-
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
.recaptcha-form-wrapper {
|
|
23
|
-
|
|
24
|
-
.recaptcha-alert {
|
|
25
|
-
display: none;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
&.disabled {
|
|
29
|
-
position: relative;
|
|
30
|
-
|
|
31
|
-
.recaptcha-form-inner-wrapper {
|
|
32
|
-
filter: blur(2px);
|
|
33
|
-
|
|
34
|
-
&::after {
|
|
35
|
-
position: absolute;
|
|
36
|
-
inset: 0;
|
|
37
|
-
display: block;
|
|
38
|
-
content: '';
|
|
39
|
-
background-color: var(--recaptcha-alert-overlay-color, rgb(0 0 0 / .5));
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
input, select, textarea {
|
|
43
|
-
pointer-events: none;
|
|
44
|
-
user-select: none;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.recaptcha-alert {
|
|
48
|
-
position: absolute;
|
|
49
|
-
top: 50%;
|
|
50
|
-
left: 50%;
|
|
51
|
-
display: block;
|
|
52
|
-
padding: var(--size-xs);
|
|
53
|
-
color: var(--recaptcha-alert-fg, #fff);
|
|
54
|
-
background-color: var(--recaptcha-alert-background-color, #000);
|
|
55
|
-
border: .5px solid currentColor;
|
|
56
|
-
border-radius: var(--radius-xs);
|
|
57
|
-
transform-origin: center;
|
|
58
|
-
translate: -50% -50%;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.grecaptcha-badge {
|
|
64
|
-
visibility: hidden;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.grecaptcha-info {
|
|
68
|
-
margin: 1rem 0 0;
|
|
69
|
-
font-size: .6rem;
|
|
70
|
-
font-style: italic;
|
|
71
|
-
font-weight: 300;
|
|
72
|
-
opacity: 75%;
|
|
73
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
https://lukehaas.me/projects/css-spinners/ (#2)
|
|
3
|
-
|
|
4
|
-
<div class="spinner-wrapper"><div class="spinner">Loading...</div></div>
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
.spinner {
|
|
9
|
-
position: relative;
|
|
10
|
-
width: 10em;
|
|
11
|
-
height: 10em;
|
|
12
|
-
margin: 55px auto;
|
|
13
|
-
font-size: .7rem;
|
|
14
|
-
color: var(--_spinner-color);
|
|
15
|
-
text-indent: -99999em;
|
|
16
|
-
box-shadow: inset 0 0 0 1em;
|
|
17
|
-
transform: translateZ(0);
|
|
18
|
-
|
|
19
|
-
&, &::before, &::after {
|
|
20
|
-
border-radius: 50%;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
&::before, &::after {
|
|
24
|
-
position: absolute;
|
|
25
|
-
content: '';
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.spinner::before {
|
|
30
|
-
top: -.1em;
|
|
31
|
-
left: -.1em;
|
|
32
|
-
width: 5.2em;
|
|
33
|
-
height: 10.2em;
|
|
34
|
-
border-radius: 10.2em 0 0 10.2em;
|
|
35
|
-
transform-origin: 5.1em 5.1em;
|
|
36
|
-
animation: spinner-load 2s infinite ease 1.5s;
|
|
37
|
-
}
|
|
38
|
-
.spinner::after {
|
|
39
|
-
top: -.1em;
|
|
40
|
-
left: 4.9em;
|
|
41
|
-
width: 5.2em;
|
|
42
|
-
height: 10.2em;
|
|
43
|
-
border-radius: 0 10.2em 10.2em 0;
|
|
44
|
-
transform-origin: 0.1em 5.1em;
|
|
45
|
-
animation: spinner-load 2s infinite ease;
|
|
46
|
-
}
|
|
47
|
-
@keyframes spinner-load {
|
|
48
|
-
0% {
|
|
49
|
-
transform: rotate(0deg);
|
|
50
|
-
}
|
|
51
|
-
100% {
|
|
52
|
-
transform: rotate(360deg);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/* HTML: <div class="loader"></div> */
|
|
2
|
-
/* https://css-loaders.com/dots/ #1 */
|
|
3
|
-
.spinner {
|
|
4
|
-
width: 80px;
|
|
5
|
-
aspect-ratio: 6;
|
|
6
|
-
margin-top: 2rem;
|
|
7
|
-
clip-path: inset(0 100% 0 0);
|
|
8
|
-
background: radial-gradient(circle closest-side, var(--text-color) 90%, transparent) 0 / calc(100% / 3) 100% space;
|
|
9
|
-
animation: l1 1s steps(4) infinite;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
@keyframes l1 { to { clip-path: inset(0 -34% 0 0); } }
|
|
13
|
-
|
|
14
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Gli spinner hanno tutti la stessa classe, presumendo che se ne usi solo una per volta...
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
https://projects.lukehaas.me/css-loaders/ (#6)
|
|
3
|
-
|
|
4
|
-
<div class="spinner-wrapper"><div class="spinner">Loading...</div></div>
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
.spinner {
|
|
8
|
-
position: relative;
|
|
9
|
-
width: 1em;
|
|
10
|
-
height: 1em;
|
|
11
|
-
/* margin: 2rem auto; */
|
|
12
|
-
overflow: hidden;
|
|
13
|
-
font-size: 3.5rem;
|
|
14
|
-
color: var(--text-color);
|
|
15
|
-
text-indent: -9999em;
|
|
16
|
-
border-radius: 50%;
|
|
17
|
-
transform: translateZ(0);
|
|
18
|
-
animation: loader 1.7s infinite ease, round 1.7s infinite ease;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
@keyframes loader {
|
|
22
|
-
0% {
|
|
23
|
-
box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em;
|
|
24
|
-
}
|
|
25
|
-
5%,
|
|
26
|
-
95% {
|
|
27
|
-
box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em;
|
|
28
|
-
}
|
|
29
|
-
10%,
|
|
30
|
-
59% {
|
|
31
|
-
box-shadow: 0 -0.83em 0 -0.4em, -0.087em -0.825em 0 -0.42em, -0.173em -0.812em 0 -0.44em, -0.256em -0.789em 0 -0.46em, -0.297em -0.775em 0 -0.477em;
|
|
32
|
-
}
|
|
33
|
-
20% {
|
|
34
|
-
box-shadow: 0 -0.83em 0 -0.4em, -0.338em -0.758em 0 -0.42em, -0.555em -0.617em 0 -0.44em, -0.671em -0.488em 0 -0.46em, -0.749em -0.34em 0 -0.477em;
|
|
35
|
-
}
|
|
36
|
-
38% {
|
|
37
|
-
box-shadow: 0 -0.83em 0 -0.4em, -0.377em -0.74em 0 -0.42em, -0.645em -0.522em 0 -0.44em, -0.775em -0.297em 0 -0.46em, -0.82em -0.09em 0 -0.477em;
|
|
38
|
-
}
|
|
39
|
-
100% {
|
|
40
|
-
box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
@keyframes round {
|
|
45
|
-
0% {
|
|
46
|
-
transform: rotate(0deg);
|
|
47
|
-
}
|
|
48
|
-
100% {
|
|
49
|
-
transform: rotate(360deg);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
.spinner-overlay {
|
|
2
|
-
position: absolute;
|
|
3
|
-
inset: 0;
|
|
4
|
-
z-index: var(--z-index-overlay);
|
|
5
|
-
display: grid;
|
|
6
|
-
place-content: center;
|
|
7
|
-
pointer-events: none;
|
|
8
|
-
background-color: var(--overlay-color);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.spinner-wrapper {
|
|
12
|
-
position: absolute;
|
|
13
|
-
top: 1rem;
|
|
14
|
-
left: 50%;
|
|
15
|
-
display: grid;
|
|
16
|
-
place-content: center;
|
|
17
|
-
width: 4rem;
|
|
18
|
-
aspect-ratio: 1;
|
|
19
|
-
translate: -50%;
|
|
20
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// import './spinner.css'; // incorporato nel css principale
|
|
2
|
-
|
|
3
|
-
/*
|
|
4
|
-
uso
|
|
5
|
-
|
|
6
|
-
import { spinner } from '@minimo/spinner.js';
|
|
7
|
-
|
|
8
|
-
spinner({container: xxxx, withOverlay: false|true });
|
|
9
|
-
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
// TODO rifare con domBuilder
|
|
13
|
-
|
|
14
|
-
export function spinner({container, withOverlay = false }) {
|
|
15
|
-
const spinnerMarkup =
|
|
16
|
-
`<div class="${withOverlay? 'spinner-overlay' : 'spinner-wrapper'}"><div class="spinner">Loading...</div></div>`;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if(container != null) {
|
|
20
|
-
container.insertAdjacentHTML('beforeend', spinnerMarkup);
|
|
21
|
-
} else {
|
|
22
|
-
return spinnerMarkup;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function removeSpinner(container) {
|
|
27
|
-
container.querySelectorAll('.spinner-overlay, .spinner-wrapper')
|
|
28
|
-
.forEach(item => item.remove());
|
|
29
|
-
|
|
30
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
// forked from https://github.com/argyleink/gui-challenges/tree/main/toast
|
|
2
|
-
// https://web.dev/articles/building/a-toast-component?hl=en
|
|
3
|
-
|
|
4
|
-
// TODO rivedere
|
|
5
|
-
|
|
6
|
-
import * as styles from './toast.module.css';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const init = () => {
|
|
10
|
-
const toastWrapper = document.createElement('section');
|
|
11
|
-
toastWrapper.classList.add(styles.toastWrapper);
|
|
12
|
-
|
|
13
|
-
// document.firstElementChild.insertBefore(toastWrapper, document.body);
|
|
14
|
-
document.body.append(toastWrapper);
|
|
15
|
-
return toastWrapper;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const createToast = text => {
|
|
19
|
-
const thisToast = document.createElement('output');
|
|
20
|
-
|
|
21
|
-
thisToast.innerHTML = text;
|
|
22
|
-
thisToast.classList.add(styles.toast);
|
|
23
|
-
thisToast.setAttribute('role', 'status');
|
|
24
|
-
thisToast.setAttribute('aria-live', 'polite');
|
|
25
|
-
|
|
26
|
-
return thisToast;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const addToast = toast => {
|
|
30
|
-
const { matches:motionOK } = window.matchMedia(
|
|
31
|
-
'(prefers-reduced-motion: no-preference)'
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
toastWrapper.children.length && motionOK
|
|
35
|
-
? flipToast(toast)
|
|
36
|
-
: toastWrapper.appendChild(toast);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const Toast = text => {
|
|
40
|
-
let toast = createToast(text);
|
|
41
|
-
addToast(toast);
|
|
42
|
-
|
|
43
|
-
return Promise.allSettled(
|
|
44
|
-
toast.getAnimations().map( animation => animation.finished )
|
|
45
|
-
).then(() => {
|
|
46
|
-
toastWrapper.removeChild(toast);
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
// https://aerotwist.com/blog/flip-your-animations/
|
|
51
|
-
const flipToast = toast => {
|
|
52
|
-
// FIRST
|
|
53
|
-
const first = toastWrapper.offsetHeight;
|
|
54
|
-
|
|
55
|
-
// add new child to change container size
|
|
56
|
-
toastWrapper.appendChild(toast);
|
|
57
|
-
|
|
58
|
-
// LAST
|
|
59
|
-
const last = toastWrapper.offsetHeight;
|
|
60
|
-
|
|
61
|
-
// INVERT
|
|
62
|
-
const invert = last - first;
|
|
63
|
-
|
|
64
|
-
// PLAY
|
|
65
|
-
const animation = toastWrapper.animate([
|
|
66
|
-
{ transform: `translateY(${invert}px)` },
|
|
67
|
-
{ transform: 'translateY(0)' }
|
|
68
|
-
], {
|
|
69
|
-
duration: 150,
|
|
70
|
-
easing: 'ease-out',
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
animation.startTime = document.timeline.currentTime;
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const toastWrapper = init();
|
|
77
|
-
export { Toast };
|