@massimo-cassandro/minimo 0.1.3 → 0.1.5
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/package.json +4 -6
- package/src/components/auto-datatable/auto-datatable.css +355 -0
- package/src/components/auto-datatable/auto-datatable.js +154 -0
- package/src/components/init.js +7 -0
- package/src/components/modal-alert/flash-alerts.js +32 -0
- package/src/components/modal-alert/modal-alert.css +47 -0
- package/src/components/modal-alert/modal-alert.js +85 -0
- package/src/components/modal-content/modal-content.js +152 -0
- package/src/components/modal-content/modal-content.module.css +142 -0
- package/src/components/recaptcha/recaptcha.css +74 -0
- package/src/components/sf-macro/sf-macro.css +104 -0
- package/src/components/sf-macro/sf-macro.js +44 -0
- package/src/components/vanilla-cookie-consent/cookie-consent.css +20 -0
- package/src/components/vanilla-cookie-consent/cookie-consent.js +76 -0
- package/src/components/vanilla-cookie-consent/render-cookie-list.js +32 -0
- package/src/components/vanilla-cookie-consent/src/cookie-list.js +85 -0
- package/src/components/vanilla-cookie-consent/src/it-translation.js +38 -0
- package/src/components/vanilla-cookie-consent/src/run-analytics.js +54 -0
- package/src/components/vanilla-cookie-consent/src/run-recaptcha.js +71 -0
- package/src/css/alerts.css +95 -0
- package/src/css/anchors.css +40 -0
- package/src/css/buttons/btn-close.css +41 -0
- package/src/css/buttons/buttons.css +188 -0
- package/src/css/buttons/status-buttons.css +107 -0
- package/src/css/container.css +15 -0
- package/src/css/data-formats.css +30 -0
- package/src/css/details.css +19 -0
- package/src/css/dialog-content.css +72 -0
- package/src/css/flex.css +30 -0
- package/src/css/forms/form-edit-info.css +17 -0
- package/src/css/forms/forms.css +315 -0
- package/src/css/grid.css +63 -0
- package/src/css/headings.css +34 -0
- package/src/css/icons.css +114 -0
- package/src/css/inner-nav.css +11 -0
- package/src/css/layout-base.css +11 -0
- package/src/css/overlay.css +11 -0
- package/src/css/reset.css +59 -0
- package/src/css/spinners/TODO spinner-circle.css +54 -0
- package/src/css/spinners/TODO spinner-three-dots.css +14 -0
- package/src/css/spinners/spinner-circle-basic.css +15 -0
- package/src/css/spinners/spinner-trailing-dots.css +51 -0
- package/src/css/spinners/spinner-wrapper.css +20 -0
- package/src/css/svg.css +3 -0
- package/src/css/table.css +66 -0
- package/src/css/text.css +114 -0
- package/src/css/utilities.css +128 -0
- package/src/custom-media-default.css +16 -0
- package/src/custom-properties-default.css +278 -0
- package/src/index-template.css +49 -0
- package/src/index.js +0 -0
- package/src/js/alert-autoclose.js +9 -0
- package/src/js/create-blurhash-canvas.js +47 -0
- package/src/js/dialog-content.js +82 -0
- package/src/js/dismiss-alerts.js +6 -0
- package/src/js/forms.js +36 -0
- package/src/js/img-viewer-dom-builder.js +196 -0
- package/src/js/inner-nav.js +11 -0
- package/src/js/overlay.js +12 -0
- package/src/js/print-icon.js +51 -0
- package/src/js/spinner.js +30 -0
|
@@ -0,0 +1,85 @@
|
|
|
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
|
+
export function mAlert(params) {
|
|
84
|
+
modalAlert(params, custom_defaults, marks);
|
|
85
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { domBuilder, classnames } from '@node_modules/@massimo-cassandro/js-utilities/index.js';
|
|
2
|
+
import { spinner } from '@minimo/spinner.js';
|
|
3
|
+
import * as styles from './modal-content.module.css?inline';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement
|
|
9
|
+
|
|
10
|
+
export function modalContent({
|
|
11
|
+
|
|
12
|
+
/** iframe | content */
|
|
13
|
+
mode = 'iframe',
|
|
14
|
+
|
|
15
|
+
/** dialog extra class */
|
|
16
|
+
dialogClassName = null,
|
|
17
|
+
|
|
18
|
+
/** iframe url */
|
|
19
|
+
iframeUrl = null,
|
|
20
|
+
|
|
21
|
+
/** content string (markup) o array */
|
|
22
|
+
content = null,
|
|
23
|
+
|
|
24
|
+
/** content extra classname */
|
|
25
|
+
contentClassName = null,
|
|
26
|
+
|
|
27
|
+
/** dimensione modal: full, large, medium o small */
|
|
28
|
+
size = 'large',
|
|
29
|
+
|
|
30
|
+
/** padding: std (var(--spacing-md) 0) o none */
|
|
31
|
+
padding = 'std'
|
|
32
|
+
}) {
|
|
33
|
+
|
|
34
|
+
if(!['content', 'iframe'].includes(mode)) {
|
|
35
|
+
throw `modalContent: parametro 'mode' non corretto (${mode})`;
|
|
36
|
+
}
|
|
37
|
+
if(!iframeUrl && mode === 'iframe') {
|
|
38
|
+
throw 'modalContent: parametro `iframeUrl` mancante';
|
|
39
|
+
}
|
|
40
|
+
if(content == null && mode === 'content') {
|
|
41
|
+
throw 'modalContent: parametro `content` mancante';
|
|
42
|
+
}
|
|
43
|
+
if(!['full', 'large', 'medium', 'small'].includes(size)) {
|
|
44
|
+
throw `modalContent: parametro 'size' non corretto (${size})`;
|
|
45
|
+
}
|
|
46
|
+
if(!['std', 'none'].includes(padding)) {
|
|
47
|
+
throw `modalContent: parametro 'padding' non corretto (${padding})`;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
let dialog_element, dialog_inner, iframe_element = null, content_element = null;
|
|
51
|
+
const iframeLoadEventHandler = () => {
|
|
52
|
+
dialog_element.classList.add(styles.on);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
if(!dialog_element) {
|
|
56
|
+
|
|
57
|
+
domBuilder([
|
|
58
|
+
{
|
|
59
|
+
tag: 'dialog',
|
|
60
|
+
className: styles.dialog,
|
|
61
|
+
attrs: {
|
|
62
|
+
'closedby': 'any'
|
|
63
|
+
},
|
|
64
|
+
children: [
|
|
65
|
+
{
|
|
66
|
+
tag: 'button',
|
|
67
|
+
className: styles.closeButton, // TODO standardizzare close btn
|
|
68
|
+
attrs: {
|
|
69
|
+
'aria-label': 'Chiudi'
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
className: styles.dialogInner,
|
|
74
|
+
children: [
|
|
75
|
+
{
|
|
76
|
+
className: styles.modalSpinner,
|
|
77
|
+
content: spinner({container: null, withOverlay: false })
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
], document.body);
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
dialog_element = document.querySelector(`.${styles.dialog}`);
|
|
88
|
+
dialog_inner = dialog_element.querySelector(`.${styles.dialogInner}`);
|
|
89
|
+
|
|
90
|
+
dialog_element.querySelector(`.${styles.closeButton}`).addEventListener('click', () => {
|
|
91
|
+
dialog_element.close();
|
|
92
|
+
}, false);
|
|
93
|
+
|
|
94
|
+
// listener chiusura
|
|
95
|
+
dialog_element.addEventListener('close', () => {
|
|
96
|
+
|
|
97
|
+
iframe_element?.removeEventListener('load', iframeLoadEventHandler, false);
|
|
98
|
+
iframe_element?.remove();
|
|
99
|
+
content_element?.remove();
|
|
100
|
+
|
|
101
|
+
document.body.classList.remove('overflow-hidden');
|
|
102
|
+
dialog_element.classList.remove(styles.on);
|
|
103
|
+
}, false);
|
|
104
|
+
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
// aggiunta classi extra
|
|
109
|
+
dialog_element.className = classnames(
|
|
110
|
+
styles.dialog,
|
|
111
|
+
dialogClassName,
|
|
112
|
+
styles[`size-${size}`],
|
|
113
|
+
styles[`padding-${padding}`]
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
domBuilder([
|
|
117
|
+
{
|
|
118
|
+
condition: mode === 'iframe',
|
|
119
|
+
className: styles.iframeEl,
|
|
120
|
+
tag: 'iframe',
|
|
121
|
+
attrs: {
|
|
122
|
+
src: ''
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
condition: mode === 'content',
|
|
127
|
+
className: classnames(styles.contentEl, contentClassName),
|
|
128
|
+
content: (content && !Array.isArray(content))? content : null,
|
|
129
|
+
children: (content && Array.isArray(content))? content : null
|
|
130
|
+
}
|
|
131
|
+
], dialog_inner);
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
document.body.classList.add('overflow-hidden');
|
|
135
|
+
dialog_element.showModal();
|
|
136
|
+
dialog_element.focus();
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
if(mode === 'iframe') {
|
|
140
|
+
iframe_element = dialog_element.querySelector(`.${styles.iframeEl}`);
|
|
141
|
+
iframe_element.src = iframeUrl;
|
|
142
|
+
|
|
143
|
+
// listener load per i frame
|
|
144
|
+
iframe_element?.addEventListener('load', iframeLoadEventHandler, false);
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
} else if (mode === 'content') {
|
|
148
|
+
content_element = dialog_element.querySelector(`.${styles.contentEl}`);
|
|
149
|
+
dialog_element.classList.add(styles.on);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
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(--spacing-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(--spacing-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(--spacing-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(--spacing-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
|
+
|
|
@@ -0,0 +1,74 @@
|
|
|
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-mix(in srgb, #000 50%, transparent));
|
|
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(--spacing-xs);
|
|
53
|
+
color: var(--recaptcha-alert-fg, #fff);
|
|
54
|
+
background-color: var(--recaptcha-alert-bg, #000);
|
|
55
|
+
border: .5px solid currentColor;
|
|
56
|
+
border-radius: var(--radius-xs);
|
|
57
|
+
box-shadow: var(--box-shadow-base);
|
|
58
|
+
transform-origin: center;
|
|
59
|
+
translate: -50% -50%;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.grecaptcha-badge {
|
|
65
|
+
visibility: hidden;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.grecaptcha-info {
|
|
69
|
+
margin: 1rem 0 0;
|
|
70
|
+
font-size: .6rem;
|
|
71
|
+
font-style: italic;
|
|
72
|
+
font-weight: 300;
|
|
73
|
+
opacity: 75%;
|
|
74
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
|
|
2
|
+
.sf-macro-wrapper {
|
|
3
|
+
--sf-macro-rows-padding: .5rem;
|
|
4
|
+
--sf-macro-rows-margin-bottom: 1rem;
|
|
5
|
+
--sf-macro-rows-border-radius: .4rem;
|
|
6
|
+
--sf-macro-rows-hover-bg-color: color-mix(in srgb, var(--body-bg-color) 95%, #000);
|
|
7
|
+
--sf-macro-even-rows-bg-color: var(--body-bg-color); /* rgb(0 0 0 / .05); */
|
|
8
|
+
--sf-macro-rows-border: 1px solid var(--stone-5);
|
|
9
|
+
--sf-macro-close-btn-size: 2rem;
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
/* etichette campi righe successive alla prima */
|
|
13
|
+
@media (--desktop-up) {
|
|
14
|
+
&:not(.always-show-labels) {
|
|
15
|
+
.sf-macro-riga {
|
|
16
|
+
&:not(:first-child) {
|
|
17
|
+
.form-label, label {
|
|
18
|
+
display: none;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/*
|
|
26
|
+
// forza la visualizzazione delle etichette in tutte le righe
|
|
27
|
+
// a partire dal breakpont successivo a quello indicato
|
|
28
|
+
@each $brk in (xs, sm, md, lg, xl) {
|
|
29
|
+
&.sf-macro-show-label-down-#{$brk} {
|
|
30
|
+
@include media-breakpoint-down($brk) {
|
|
31
|
+
.form-label, label {
|
|
32
|
+
display: inline-block !important;
|
|
33
|
+
}
|
|
34
|
+
} // end @media
|
|
35
|
+
}
|
|
36
|
+
} // end @each
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.sf-macro-riga {
|
|
42
|
+
position: relative;
|
|
43
|
+
padding: var(--sf-macro-rows-padding);
|
|
44
|
+
margin-bottom: var(--sf-macro-rows-margin-bottom);
|
|
45
|
+
border: var(--sf-macro-rows-border);
|
|
46
|
+
border-radius: var(--sf-macro-rows-border-radius);
|
|
47
|
+
|
|
48
|
+
&:nth-child(even) {
|
|
49
|
+
background-color: var(--sf-macro-even-rows-bg-color);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
&:hover {
|
|
54
|
+
background-color: var(--sf-macro-rows-hover-bg-color);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.form-group {
|
|
58
|
+
margin-bottom: 0;
|
|
59
|
+
|
|
60
|
+
&:has([type='checkbox']) {
|
|
61
|
+
align-self: center;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.grid {
|
|
66
|
+
row-gap: .8rem;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
} /* end .sf-macro-riga */
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
.sf-macro-close-btn { /* button */
|
|
73
|
+
position: absolute;
|
|
74
|
+
top: -.5rem;
|
|
75
|
+
right: -.5rem;
|
|
76
|
+
z-index: 1;
|
|
77
|
+
display: block;
|
|
78
|
+
width: var(--sf-macro-close-btn-size);
|
|
79
|
+
height: var(--sf-macro-close-btn-size);
|
|
80
|
+
padding: 1px;
|
|
81
|
+
color: currentColor;
|
|
82
|
+
background-color: var(--body-content-bg);
|
|
83
|
+
border-radius: 50%;
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
&[disabled], [disabled] & {
|
|
87
|
+
cursor: not-allowed;
|
|
88
|
+
opacity: .4;
|
|
89
|
+
transform: skew(-15deg);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
svg {
|
|
93
|
+
width: 100%;
|
|
94
|
+
aspect-ratio: 1;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.sf-macro-riga:has(.sf-macro-close-btn:not(:disabled):hover) {
|
|
99
|
+
|
|
100
|
+
outline: 2px dashed var(--status-danger-color);
|
|
101
|
+
.sf-macro-close-btn {
|
|
102
|
+
color: var(--status-danger-color);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import './sf-macro.css';
|
|
2
|
+
|
|
3
|
+
export function sf_macro({
|
|
4
|
+
wrapper_selector = '.sf-macro-wrapper',
|
|
5
|
+
row_selector = '.sf-macro-riga',
|
|
6
|
+
add_callback = null,
|
|
7
|
+
del_callback = null
|
|
8
|
+
}={}) {
|
|
9
|
+
|
|
10
|
+
document.querySelectorAll(wrapper_selector).forEach(fset => {
|
|
11
|
+
const macro_container = fset.querySelector('.sf-macro-container')
|
|
12
|
+
,macro_template = macro_container.dataset.template
|
|
13
|
+
;
|
|
14
|
+
|
|
15
|
+
// listeners
|
|
16
|
+
fset.addEventListener('click', e => {
|
|
17
|
+
|
|
18
|
+
if(e.target.closest('.sf-macro-riga-add')) {
|
|
19
|
+
|
|
20
|
+
const righe_macro = macro_container.querySelectorAll(row_selector).length;
|
|
21
|
+
|
|
22
|
+
macro_container.insertAdjacentHTML('beforeend',
|
|
23
|
+
macro_template.replace(/__indice\d?__/g, righe_macro + 1)
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
if(add_callback && typeof add_callback === 'function') {
|
|
27
|
+
add_callback(
|
|
28
|
+
macro_container.querySelector('.sf-macro-riga:last-child'),
|
|
29
|
+
e.target.closest('.sf-macro-riga-add')
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
} else if(e.target.closest('.sf-macro-close-btn')) {
|
|
35
|
+
e.target.closest(row_selector).remove();
|
|
36
|
+
|
|
37
|
+
if(del_callback && typeof del_callback === 'function') {
|
|
38
|
+
del_callback();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
}, false);
|
|
43
|
+
}); // end foreach wrapper_selector
|
|
44
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/* stylelint-disable selector-max-id */
|
|
2
|
+
@import 'vanilla-cookieconsent/dist/cookieconsent.css';
|
|
3
|
+
|
|
4
|
+
/* stylelint-disable declaration-no-important */
|
|
5
|
+
#cc-main {
|
|
6
|
+
h2 {
|
|
7
|
+
line-height: 1.3 !important;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.btn-link {
|
|
11
|
+
font-weight: var(--font-weight-semibold);
|
|
12
|
+
|
|
13
|
+
@media (hover: hover) {
|
|
14
|
+
&:hover {
|
|
15
|
+
text-decoration: underline;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/* stylelint-enable declaration-no-important */
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import './cookie-consent.css';
|
|
2
|
+
import * as CookieConsent from 'vanilla-cookieconsent';
|
|
3
|
+
import { it_translation } from './src/it-translation.js';
|
|
4
|
+
// import { run_analytics } from './src/run-analytics.js';
|
|
5
|
+
import { run_recaptcha, disableRecaptcha } from './src/run-recaptcha.js';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
// https://cookieconsent.orestbida.com/essential/getting-started.html
|
|
9
|
+
CookieConsent.run({
|
|
10
|
+
hideFromBots: !(new URLSearchParams(document.location.search).get('cc-list-parser') !== null), // abilita il parsing dei cookie da cookies-list
|
|
11
|
+
categories: {
|
|
12
|
+
necessary: {
|
|
13
|
+
enabled: true,
|
|
14
|
+
readOnly: true
|
|
15
|
+
},
|
|
16
|
+
functionality: {
|
|
17
|
+
enabled: true,
|
|
18
|
+
},
|
|
19
|
+
analytics: {
|
|
20
|
+
enabled: true,
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
guiOptions: {
|
|
24
|
+
consentModal: {
|
|
25
|
+
layout: 'box',
|
|
26
|
+
position: 'bottom right',
|
|
27
|
+
flipButtons: false,
|
|
28
|
+
equalWeightButtons: false
|
|
29
|
+
},
|
|
30
|
+
preferencesModal: {
|
|
31
|
+
layout: 'box',
|
|
32
|
+
// position: 'left right',
|
|
33
|
+
flipButtons: false,
|
|
34
|
+
equalWeightButtons: true
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
language: {
|
|
38
|
+
default: 'it',
|
|
39
|
+
translations: it_translation
|
|
40
|
+
},
|
|
41
|
+
onConsent: ({cookie}) => {
|
|
42
|
+
// if(cookie.categories.indexOf('analytics') !== -1) {
|
|
43
|
+
// run_analytics();
|
|
44
|
+
// }
|
|
45
|
+
if(cookie.categories.indexOf('functionality') !== -1) {
|
|
46
|
+
run_recaptcha();
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
// https://cookieconsent.orestbida.com/reference/configuration-reference.html#onchange
|
|
50
|
+
onChange: ({/* cookie, */changedCategories/* , changedServices */}) => {
|
|
51
|
+
if(changedCategories.includes('functionality')){
|
|
52
|
+
|
|
53
|
+
// caso in cui si cambia l'intera categoria
|
|
54
|
+
if(CookieConsent.acceptedCategory('functionality')){
|
|
55
|
+
run_recaptcha();
|
|
56
|
+
} else {
|
|
57
|
+
disableRecaptcha();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// TODO caso in cui si cambia il solo recaptcha (se ce ne fossero anche altri)
|
|
61
|
+
// console.log(cookie);
|
|
62
|
+
// console.log(changedServices);
|
|
63
|
+
// console.log(CookieConsent.acceptedService('_GRECAPTCHA', 'functionality'));
|
|
64
|
+
|
|
65
|
+
// if(changedServices['functionality'].includes('Google Analytics')){
|
|
66
|
+
// if(CookieConsent.acceptedService('Google Analytics', 'analytics')){
|
|
67
|
+
// // Google Analytics was just enabled
|
|
68
|
+
// }else{
|
|
69
|
+
// // Google Analytics was just disabled
|
|
70
|
+
// }
|
|
71
|
+
// }
|
|
72
|
+
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|