mypgs 1.5.1 → 2.0.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/AGENTS.md +8 -5
- package/README.md +1 -1
- package/assets/javascript/_imports.js +4 -0
- package/assets/javascript/_pgs.js +58 -0
- package/assets/javascript/base/_darkmode.js +27 -105
- package/assets/javascript/base/_svg.js +103 -0
- package/assets/javascript/components/_accordion.js +2 -2
- package/assets/javascript/components/_menu.js +1 -3
- package/assets/javascript/components/_modals.js +159 -136
- package/assets/javascript/components/_notifications.js +19 -9
- package/assets/javascript/components/_search.js +391 -0
- package/assets/javascript/components/_slides.js +66 -32
- package/assets/javascript/components/_stepTabs.js +4 -4
- package/assets/javascript/components/_steps.js +2 -2
- package/assets/javascript/components/_summary.js +2 -2
- package/assets/javascript/functions/_formValidate.js +97 -53
- package/assets/javascript/functions/_scrollY.js +10 -10
- package/assets/javascript/index.js +2 -0
- package/assets/javascript/layout/_header.js +29 -7
- package/assets/scss/base/_color.scss +5 -5
- package/assets/scss/base/_html.scss +2 -2
- package/assets/scss/base/_variables.scss +4 -2
- package/assets/scss/components/_dropdown.scss +2 -1
- package/assets/scss/components/_form.scss +2 -2
- package/assets/scss/components/_logo.scss +2 -2
- package/assets/scss/components/_menu.scss +20 -27
- package/assets/scss/components/_modals.scss +11 -1
- package/assets/scss/components/_notification.scss +23 -30
- package/assets/scss/components/_search.scss +140 -0
- package/assets/scss/index.scss +2 -2
- package/assets/scss/layout/_header.scss +1 -1
- package/assets/scss/layout/_pageShell.scss +19 -15
- package/assets/scss/mixin/_mx-form.scss +7 -7
- package/{templates/html → demo}/demo.html +1 -1
- package/demo/demo.js +240 -0
- package/dist/css/index.css +188 -125
- package/dist/css/index.css.map +1 -1
- package/dist/css/index.min.css +1 -1
- package/dist/index.d.ts +70 -0
- package/dist/javascript/index.js +1038 -405
- package/dist/javascript/index.js.map +1 -1
- package/dist/javascript/index.min.js +1 -1
- package/docs/componenti-e-markup.md +62 -27
- package/docs/components/accordion.md +61 -0
- package/docs/components/badges.md +67 -0
- package/docs/components/breadcumbs.md +43 -0
- package/docs/components/button.md +59 -0
- package/docs/components/card.md +50 -0
- package/docs/components/dropdown.md +135 -0
- package/docs/components/form.md +113 -0
- package/docs/components/logo.md +36 -0
- package/docs/components/menu.md +90 -0
- package/docs/components/modal.md +131 -0
- package/docs/components/notification.md +81 -0
- package/docs/components/search.md +117 -0
- package/docs/components/slides.md +85 -0
- package/docs/components/stepTabs.md +93 -0
- package/docs/components/steps.md +56 -0
- package/docs/components/summary.md +49 -0
- package/docs/components/table.md +42 -0
- package/docs/components/tooltip.md +53 -0
- package/docs/helper-javascript.md +71 -3
- package/docs/layout/body.md +41 -0
- package/docs/layout/flex.md +116 -0
- package/docs/layout/footer.md +71 -0
- package/docs/layout/grid.md +116 -0
- package/docs/layout/header.md +116 -0
- package/docs/layout/pageShell.md +94 -0
- package/docs/layout/section.md +69 -0
- package/docs/patterns/cookieConsent.md +89 -0
- package/package.json +2 -1
- package/scripts/generate-component-docs.js +557 -0
- package/templates/html/components/accordion.html +33 -4
- package/templates/html/components/badges.html +23 -0
- package/templates/html/components/breadcumbs.html +14 -0
- package/templates/html/components/button.html +22 -0
- package/templates/html/components/card.html +20 -0
- package/templates/html/components/dropdown.html +34 -0
- package/templates/html/components/form.html +82 -4
- package/templates/html/components/logo.html +22 -1
- package/templates/html/components/menu.html +40 -1
- package/templates/html/components/modal.html +44 -0
- package/templates/html/components/notification.html +68 -32
- package/templates/html/components/search.html +107 -0
- package/templates/html/components/slides.html +43 -0
- package/templates/html/components/stepTabs.html +47 -0
- package/templates/html/components/steps.html +24 -0
- package/templates/html/components/summary.html +27 -0
- package/templates/html/components/table.html +12 -0
- package/templates/html/components/tooltip.html +35 -0
- package/templates/html/layout/body.html +20 -5
- package/templates/html/layout/flex.html +20 -0
- package/templates/html/layout/footer.html +29 -1
- package/templates/html/layout/grid.html +20 -0
- package/templates/html/layout/header.html +52 -5
- package/templates/html/layout/pageShell.html +19 -0
- package/templates/html/layout/section.html +32 -10
- package/templates/html/patterns/cookieConsent.html +31 -0
- package/templates/react/components/form.jsx +3 -3
- package/templates/react/components/logo.jsx +1 -1
- package/templates/react/components/notification.jsx +4 -4
- package/templates/react/components/{searchbar.jsx → search.jsx} +9 -7
- package/templates/react/patterns/footer.jsx +1 -1
- package/templates/react/patterns/header.jsx +16 -10
- package/assets/scss/components/_searchbar.scss +0 -70
- package/templates/html/components/searchbar.html +0 -29
- package/templates/html/demo.js +0 -137
- /package/{templates/html → demo}/demo.css +0 -0
|
@@ -2,16 +2,22 @@ import { useEffect } from "react";
|
|
|
2
2
|
|
|
3
3
|
export default function Header() {
|
|
4
4
|
useEffect(() => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
const addPgsState = (element, state) => {
|
|
6
|
+
if (!element) return;
|
|
7
|
+
|
|
8
|
+
const states = element.getAttribute("pgs-state")?.split(/\s+/) ?? [];
|
|
9
|
+
element.setAttribute("pgs-state", [...new Set([...states, state])].join(" "));
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
if (localStorage.getItem("screenIsDarkMode") === "true") {
|
|
13
|
+
addPgsState(document.documentElement, "darkmode");
|
|
14
|
+
addPgsState(document.body, "darkmode");
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (window.innerWidth < 600) {
|
|
18
|
+
addPgsState(document.querySelector("header"), "mobileActive");
|
|
19
|
+
addPgsState(document.querySelector("[pgs~=header-element]"), "mobileActive");
|
|
20
|
+
}
|
|
15
21
|
}, []);
|
|
16
22
|
|
|
17
23
|
return (
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
@use "../mixin/mixin" as *;
|
|
2
|
-
|
|
3
|
-
//= SEARCH BAR
|
|
4
|
-
[pgs~="searchbar"] {
|
|
5
|
-
position: relative;
|
|
6
|
-
flex: 1;
|
|
7
|
-
width: 100%;
|
|
8
|
-
overflow: hidden;
|
|
9
|
-
margin-inline: auto;
|
|
10
|
-
@include button_header();
|
|
11
|
-
padding: 0;
|
|
12
|
-
gap: 0;
|
|
13
|
-
|
|
14
|
-
//+ mobile
|
|
15
|
-
@media (min-width: $mobile) {
|
|
16
|
-
min-width: 21.4rem;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
button {
|
|
20
|
-
outline: none;
|
|
21
|
-
border: none;
|
|
22
|
-
background: none;
|
|
23
|
-
padding-left: var(--button-size);
|
|
24
|
-
aspect-ratio: 1;
|
|
25
|
-
height: 100%;
|
|
26
|
-
border-radius: var(--border-radius-input);
|
|
27
|
-
cursor: pointer;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
input {
|
|
31
|
-
cursor: text !important;
|
|
32
|
-
border: 0;
|
|
33
|
-
padding: var(--button-size);
|
|
34
|
-
margin: 2px;
|
|
35
|
-
margin-left: 0;
|
|
36
|
-
font-family: var(--font);
|
|
37
|
-
font-weight: 600;
|
|
38
|
-
font-size: 1.6rem;
|
|
39
|
-
border-radius: var(--border-radius-input);
|
|
40
|
-
height: 100%;
|
|
41
|
-
width: 100%;
|
|
42
|
-
min-width: 21.4rem;
|
|
43
|
-
background-color: transparent;
|
|
44
|
-
color: contrast-color(color-mix(in srgb, var(--button-background) 77%, black));
|
|
45
|
-
|
|
46
|
-
&::placeholder {
|
|
47
|
-
color: contrast-color(color-mix(in srgb, var(--button-background) 77%, black));
|
|
48
|
-
opacity: .6;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
&:focus-visible {
|
|
52
|
-
outline: unset;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
&:has(input:focus-visible){
|
|
57
|
-
outline: var(--focus-visible);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
@at-root dialog #{&} {
|
|
61
|
-
margin-inline: auto;
|
|
62
|
-
max-width: calc(100% - var(--padding-page) * 2);
|
|
63
|
-
height: max-content;
|
|
64
|
-
background-color: var(--color-white);
|
|
65
|
-
|
|
66
|
-
input {
|
|
67
|
-
padding-block: 20px;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
<form pgs="buttonNohover searchbar" autocomplete="off" action="" method="get">
|
|
2
|
-
<button type="submit" title="Cerca"><i class="fa-solid fa-search"></i></button>
|
|
3
|
-
<input type="search" name="s" placeholder="Cerca" value="">
|
|
4
|
-
</form>
|
|
5
|
-
|
|
6
|
-
<div pgs="modal searchbar-modal" pgs-option="containerPGS[header]">
|
|
7
|
-
|
|
8
|
-
<button type="button" pgs="modal-button buttonIcon" title="Cerca">
|
|
9
|
-
<i class="fa-solid fa-search"></i>
|
|
10
|
-
</button>
|
|
11
|
-
|
|
12
|
-
<dialog>
|
|
13
|
-
<div pgs="flexRow section searchbar-mobile">
|
|
14
|
-
|
|
15
|
-
<form pgs="buttonNohover searchbar" autocomplete="off" action="/" method="get">
|
|
16
|
-
<button type="submit" title="Cerca">
|
|
17
|
-
<i class="fa-solid fa-search"></i>
|
|
18
|
-
</button>
|
|
19
|
-
|
|
20
|
-
<input type="search" name="s" placeholder="Cerca" value="">
|
|
21
|
-
</form>
|
|
22
|
-
|
|
23
|
-
<button type="button" pgs="modal-close buttonIcon">
|
|
24
|
-
<i class="fa-solid fa-close"></i>
|
|
25
|
-
</button>
|
|
26
|
-
|
|
27
|
-
</div>
|
|
28
|
-
</dialog>
|
|
29
|
-
</div>
|
package/templates/html/demo.js
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
if (localStorage.getItem("screenIsDarkMode") === "true") {
|
|
3
|
-
document.body.classList.add("darkmode");
|
|
4
|
-
document.querySelector(":root").setAttribute("data-darkmode", "true");
|
|
5
|
-
document.body.setAttribute("data-darkmode", "true");
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const templateFiles = [
|
|
10
|
-
"components/summary.html",
|
|
11
|
-
"components/menu.html",
|
|
12
|
-
"components/tooltip.html",
|
|
13
|
-
"components/modal.html",
|
|
14
|
-
"components/stepTabs.html",
|
|
15
|
-
"components/accordion.html",
|
|
16
|
-
"components/badges.html",
|
|
17
|
-
"components/breadcumbs.html",
|
|
18
|
-
"components/button.html",
|
|
19
|
-
"components/card.html",
|
|
20
|
-
"components/dropdown.html",
|
|
21
|
-
"components/tooltip.html",
|
|
22
|
-
"components/form.html",
|
|
23
|
-
"components/logo.html",
|
|
24
|
-
"components/searchbar.html",
|
|
25
|
-
"components/slides.html",
|
|
26
|
-
"components/steps.html",
|
|
27
|
-
"components/table.html",
|
|
28
|
-
"components/notification.html",
|
|
29
|
-
"layout/body.html",
|
|
30
|
-
"layout/section.html",
|
|
31
|
-
"layout/flex.html",
|
|
32
|
-
"layout/grid.html",
|
|
33
|
-
"layout/pageShell.html",
|
|
34
|
-
"layout/footer.html",
|
|
35
|
-
"layout/header.html",
|
|
36
|
-
"patterns/cookieConsent.html",
|
|
37
|
-
];
|
|
38
|
-
|
|
39
|
-
function getTemplateTitle(path) {
|
|
40
|
-
return path.replace(".html", "").replace("/", " / ")
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function renderSourceTemplate(section, html) {
|
|
44
|
-
const pre = document.createElement("pre");
|
|
45
|
-
const code = document.createElement("code");
|
|
46
|
-
code.textContent = html.trim();
|
|
47
|
-
pre.append(code);
|
|
48
|
-
section.append(pre);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function renderTemplate(section, path, html) {
|
|
52
|
-
const content = document.createElement("div");
|
|
53
|
-
content.setAttribute("pgs", "container flexColumnElements");
|
|
54
|
-
content.innerHTML = html;
|
|
55
|
-
section.append(content);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function renderLayout(root, path, html) {
|
|
59
|
-
const template = document.createElement("template");
|
|
60
|
-
template.innerHTML = html.trim();
|
|
61
|
-
root.append(template.content.cloneNode(true));
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function renderTitle(section, path) {
|
|
65
|
-
const title = document.createElement("p");
|
|
66
|
-
title.classList.add("template-title");
|
|
67
|
-
title.innerHTML = "<strong>" + getTemplateTitle(path) + "</strong>";
|
|
68
|
-
section.append(title);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
async function loadTemplate(path) {
|
|
72
|
-
const response = await fetch(path);
|
|
73
|
-
if (!response.ok) throw new Error(`${path}: ${response.status}`);
|
|
74
|
-
return response.text();
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function loadPgsJavascript() {
|
|
78
|
-
const script = document.createElement("script");
|
|
79
|
-
script.src = "../../dist/javascript/index.js";
|
|
80
|
-
document.body.append(script);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
async function bootDemo() {
|
|
84
|
-
const BEEFORE = document.getElementById("templates-demo-before");
|
|
85
|
-
const MAIN = document.getElementById("templates-demo-main");
|
|
86
|
-
const AFTER = document.getElementById("templates-demo-after");
|
|
87
|
-
|
|
88
|
-
for (const path of templateFiles) {
|
|
89
|
-
const isHeader = path === "layout/header.html";
|
|
90
|
-
const isfooter = path === "layout/footer.html";
|
|
91
|
-
const isBody = path === "layout/body.html";
|
|
92
|
-
|
|
93
|
-
if (isHeader || isfooter) {
|
|
94
|
-
try {
|
|
95
|
-
const html = await loadTemplate(path);
|
|
96
|
-
renderLayout(isHeader ? BEEFORE : AFTER, path, html);
|
|
97
|
-
} catch (error) {
|
|
98
|
-
const message = document.createElement("p");
|
|
99
|
-
message.textContent = `Template non caricato: ${error.message}`;
|
|
100
|
-
layoutRoot.append(message);
|
|
101
|
-
}
|
|
102
|
-
continue;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
const section = document.createElement("section");
|
|
106
|
-
section.setAttribute("pgs", "section flexColumnElements");
|
|
107
|
-
section.dataset.template = path;
|
|
108
|
-
renderTitle(section, path);
|
|
109
|
-
|
|
110
|
-
if (isBody) {
|
|
111
|
-
const html = await loadTemplate(path);
|
|
112
|
-
renderSourceTemplate(section, html);
|
|
113
|
-
MAIN.append(section);
|
|
114
|
-
continue
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
try {
|
|
118
|
-
const html = await loadTemplate(path);
|
|
119
|
-
renderTemplate(section, path, html);
|
|
120
|
-
} catch (error) {
|
|
121
|
-
const message = document.createElement("p");
|
|
122
|
-
message.textContent = `Template non caricato: ${error.message}`;
|
|
123
|
-
section.append(message);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
MAIN.append(section);
|
|
127
|
-
|
|
128
|
-
if (path == "layout/section.html" || path == "layout/pageShell.html") {
|
|
129
|
-
section.style.display = "contents";
|
|
130
|
-
Array.from(section.children).forEach(c => c.style.width = "100%");
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
loadPgsJavascript();
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
bootDemo();
|
|
File without changes
|