@sensorario/sg-components 0.0.104 → 0.0.105
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/dist/components/Avatar/Avatar.d.ts +10 -0
- package/dist/components/Avatar/Avatar.stories.d.ts +8 -0
- package/dist/components/Badge/Badge.d.ts +17 -0
- package/dist/components/Badge/Badge.stories.d.ts +8 -0
- package/dist/components/Button/Button.d.ts +1 -0
- package/dist/components/Button/Button.stories.d.ts +1 -0
- package/dist/components/Card/Card.d.ts +20 -0
- package/dist/components/Card/Card.stories.d.ts +9 -0
- package/dist/components/ConfirmModal/ConfirmModal.d.ts +18 -0
- package/dist/components/ConfirmModal/ConfirmModal.stories.d.ts +7 -0
- package/dist/components/FormField/FormField.d.ts +19 -0
- package/dist/components/FormField/FormField.stories.d.ts +6 -0
- package/dist/components/PasswordInput/PasswordInput.d.ts +1 -0
- package/dist/components/ProgressBar/ProgressBar.d.ts +16 -0
- package/dist/components/ProgressBar/ProgressBar.stories.d.ts +10 -0
- package/dist/components/Select/Select.d.ts +7 -0
- package/dist/components/StatusMessage/StatusMessage.d.ts +13 -0
- package/dist/components/StatusMessage/StatusMessage.stories.d.ts +10 -0
- package/dist/components/Table/Table.stories.d.ts +5 -0
- package/dist/components/Tabs/Tabs.d.ts +19 -0
- package/dist/components/Tabs/Tabs.stories.d.ts +8 -0
- package/dist/components/Textarea/Textarea.d.ts +7 -0
- package/dist/components/Toggle/Toggle.d.ts +5 -1
- package/dist/components/Toggle/Toggle.stories.d.ts +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.es.js +559 -334
- package/dist/sg-components.css +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,174 +1,174 @@
|
|
|
1
|
-
import e, {
|
|
2
|
-
import { Fragment as
|
|
3
|
-
import { setI18n as
|
|
4
|
-
import
|
|
1
|
+
import e, { cloneElement as t, createElement as n, forwardRef as r, isValidElement as i, useEffect as a, useId as o, useImperativeHandle as s, useRef as c, useState as l } from "react";
|
|
2
|
+
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
3
|
+
import { setI18n as p, useTranslation as m } from "react-i18next";
|
|
4
|
+
import h from "i18next";
|
|
5
5
|
//#region src/components/Icon/Icon.tsx
|
|
6
|
-
var
|
|
7
|
-
menu: /* @__PURE__ */
|
|
8
|
-
/* @__PURE__ */
|
|
6
|
+
var g = {
|
|
7
|
+
menu: /* @__PURE__ */ f(u, { children: [
|
|
8
|
+
/* @__PURE__ */ d("line", {
|
|
9
9
|
x1: "3",
|
|
10
10
|
y1: "6",
|
|
11
11
|
x2: "21",
|
|
12
12
|
y2: "6"
|
|
13
13
|
}),
|
|
14
|
-
/* @__PURE__ */
|
|
14
|
+
/* @__PURE__ */ d("line", {
|
|
15
15
|
x1: "3",
|
|
16
16
|
y1: "12",
|
|
17
17
|
x2: "21",
|
|
18
18
|
y2: "12"
|
|
19
19
|
}),
|
|
20
|
-
/* @__PURE__ */
|
|
20
|
+
/* @__PURE__ */ d("line", {
|
|
21
21
|
x1: "3",
|
|
22
22
|
y1: "18",
|
|
23
23
|
x2: "21",
|
|
24
24
|
y2: "18"
|
|
25
25
|
})
|
|
26
26
|
] }),
|
|
27
|
-
layout: /* @__PURE__ */
|
|
28
|
-
/* @__PURE__ */
|
|
27
|
+
layout: /* @__PURE__ */ f(u, { children: [
|
|
28
|
+
/* @__PURE__ */ d("rect", {
|
|
29
29
|
x: "3",
|
|
30
30
|
y: "3",
|
|
31
31
|
width: "18",
|
|
32
32
|
height: "18",
|
|
33
33
|
rx: "2"
|
|
34
34
|
}),
|
|
35
|
-
/* @__PURE__ */
|
|
35
|
+
/* @__PURE__ */ d("line", {
|
|
36
36
|
x1: "3",
|
|
37
37
|
y1: "9",
|
|
38
38
|
x2: "21",
|
|
39
39
|
y2: "9"
|
|
40
40
|
}),
|
|
41
|
-
/* @__PURE__ */
|
|
41
|
+
/* @__PURE__ */ d("line", {
|
|
42
42
|
x1: "9",
|
|
43
43
|
y1: "9",
|
|
44
44
|
x2: "9",
|
|
45
45
|
y2: "21"
|
|
46
46
|
})
|
|
47
47
|
] }),
|
|
48
|
-
edit: /* @__PURE__ */
|
|
48
|
+
edit: /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("path", { d: "M4 20l1-4L16 5l3 3L8 19l-4 1z" }), /* @__PURE__ */ d("line", {
|
|
49
49
|
x1: "14",
|
|
50
50
|
y1: "7",
|
|
51
51
|
x2: "17",
|
|
52
52
|
y2: "10"
|
|
53
53
|
})] }),
|
|
54
|
-
"help-circle": /* @__PURE__ */
|
|
55
|
-
/* @__PURE__ */
|
|
54
|
+
"help-circle": /* @__PURE__ */ f(u, { children: [
|
|
55
|
+
/* @__PURE__ */ d("circle", {
|
|
56
56
|
cx: "12",
|
|
57
57
|
cy: "12",
|
|
58
58
|
r: "9"
|
|
59
59
|
}),
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
-
/* @__PURE__ */
|
|
60
|
+
/* @__PURE__ */ d("path", { d: "M9.5 9a2.5 2.5 0 0 1 5 0c0 2-2.5 2-2.5 4" }),
|
|
61
|
+
/* @__PURE__ */ d("line", {
|
|
62
62
|
x1: "12",
|
|
63
63
|
y1: "17",
|
|
64
64
|
x2: "12",
|
|
65
65
|
y2: "17.01"
|
|
66
66
|
})
|
|
67
67
|
] }),
|
|
68
|
-
check: /* @__PURE__ */
|
|
69
|
-
x: /* @__PURE__ */
|
|
68
|
+
check: /* @__PURE__ */ d("polyline", { points: "4 12 9 17 20 6" }),
|
|
69
|
+
x: /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("line", {
|
|
70
70
|
x1: "6",
|
|
71
71
|
y1: "6",
|
|
72
72
|
x2: "18",
|
|
73
73
|
y2: "18"
|
|
74
|
-
}), /* @__PURE__ */
|
|
74
|
+
}), /* @__PURE__ */ d("line", {
|
|
75
75
|
x1: "18",
|
|
76
76
|
y1: "6",
|
|
77
77
|
x2: "6",
|
|
78
78
|
y2: "18"
|
|
79
79
|
})] }),
|
|
80
|
-
"file-plus": /* @__PURE__ */
|
|
81
|
-
/* @__PURE__ */
|
|
82
|
-
/* @__PURE__ */
|
|
83
|
-
/* @__PURE__ */
|
|
80
|
+
"file-plus": /* @__PURE__ */ f(u, { children: [
|
|
81
|
+
/* @__PURE__ */ d("path", { d: "M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z" }),
|
|
82
|
+
/* @__PURE__ */ d("polyline", { points: "14 3 14 8 19 8" }),
|
|
83
|
+
/* @__PURE__ */ d("line", {
|
|
84
84
|
x1: "12",
|
|
85
85
|
y1: "12",
|
|
86
86
|
x2: "12",
|
|
87
87
|
y2: "17"
|
|
88
88
|
}),
|
|
89
|
-
/* @__PURE__ */
|
|
89
|
+
/* @__PURE__ */ d("line", {
|
|
90
90
|
x1: "9.5",
|
|
91
91
|
y1: "14.5",
|
|
92
92
|
x2: "14.5",
|
|
93
93
|
y2: "14.5"
|
|
94
94
|
})
|
|
95
95
|
] }),
|
|
96
|
-
link: /* @__PURE__ */
|
|
97
|
-
/* @__PURE__ */
|
|
98
|
-
/* @__PURE__ */
|
|
99
|
-
/* @__PURE__ */
|
|
96
|
+
link: /* @__PURE__ */ f(u, { children: [
|
|
97
|
+
/* @__PURE__ */ d("path", { d: "M9 15l6-6" }),
|
|
98
|
+
/* @__PURE__ */ d("path", { d: "M8 13.5 5.5 16a3 3 0 0 0 4.24 4.24l2.5-2.5" }),
|
|
99
|
+
/* @__PURE__ */ d("path", { d: "M16 10.5 18.5 8a3 3 0 0 0-4.24-4.24l-2.5 2.5" })
|
|
100
100
|
] }),
|
|
101
|
-
"share-2": /* @__PURE__ */
|
|
102
|
-
/* @__PURE__ */
|
|
101
|
+
"share-2": /* @__PURE__ */ f(u, { children: [
|
|
102
|
+
/* @__PURE__ */ d("circle", {
|
|
103
103
|
cx: "6",
|
|
104
104
|
cy: "12",
|
|
105
105
|
r: "2.4"
|
|
106
106
|
}),
|
|
107
|
-
/* @__PURE__ */
|
|
107
|
+
/* @__PURE__ */ d("circle", {
|
|
108
108
|
cx: "18",
|
|
109
109
|
cy: "6",
|
|
110
110
|
r: "2.4"
|
|
111
111
|
}),
|
|
112
|
-
/* @__PURE__ */
|
|
112
|
+
/* @__PURE__ */ d("circle", {
|
|
113
113
|
cx: "18",
|
|
114
114
|
cy: "18",
|
|
115
115
|
r: "2.4"
|
|
116
116
|
}),
|
|
117
|
-
/* @__PURE__ */
|
|
117
|
+
/* @__PURE__ */ d("line", {
|
|
118
118
|
x1: "8.2",
|
|
119
119
|
y1: "10.8",
|
|
120
120
|
x2: "15.8",
|
|
121
121
|
y2: "7.2"
|
|
122
122
|
}),
|
|
123
|
-
/* @__PURE__ */
|
|
123
|
+
/* @__PURE__ */ d("line", {
|
|
124
124
|
x1: "8.2",
|
|
125
125
|
y1: "13.2",
|
|
126
126
|
x2: "15.8",
|
|
127
127
|
y2: "16.8"
|
|
128
128
|
})
|
|
129
129
|
] }),
|
|
130
|
-
download: /* @__PURE__ */
|
|
131
|
-
/* @__PURE__ */
|
|
132
|
-
/* @__PURE__ */
|
|
133
|
-
/* @__PURE__ */
|
|
130
|
+
download: /* @__PURE__ */ f(u, { children: [
|
|
131
|
+
/* @__PURE__ */ d("path", { d: "M12 3v12" }),
|
|
132
|
+
/* @__PURE__ */ d("polyline", { points: "7 11 12 16 17 11" }),
|
|
133
|
+
/* @__PURE__ */ d("path", { d: "M5 19h14" })
|
|
134
134
|
] }),
|
|
135
|
-
book: /* @__PURE__ */
|
|
136
|
-
printer: /* @__PURE__ */
|
|
137
|
-
/* @__PURE__ */
|
|
138
|
-
/* @__PURE__ */
|
|
135
|
+
book: /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("path", { d: "M4 5.5A2.5 2.5 0 0 1 6.5 3H12v18H6.5A2.5 2.5 0 0 1 4 18.5z" }), /* @__PURE__ */ d("path", { d: "M20 5.5A2.5 2.5 0 0 0 17.5 3H12v18h5.5a2.5 2.5 0 0 0 2.5-2.5z" })] }),
|
|
136
|
+
printer: /* @__PURE__ */ f(u, { children: [
|
|
137
|
+
/* @__PURE__ */ d("path", { d: "M6 9V3h12v6" }),
|
|
138
|
+
/* @__PURE__ */ d("rect", {
|
|
139
139
|
x: "4",
|
|
140
140
|
y: "9",
|
|
141
141
|
width: "16",
|
|
142
142
|
height: "8",
|
|
143
143
|
rx: "1.5"
|
|
144
144
|
}),
|
|
145
|
-
/* @__PURE__ */
|
|
145
|
+
/* @__PURE__ */ d("path", { d: "M6 17v4h12v-4" })
|
|
146
146
|
] }),
|
|
147
|
-
eye: /* @__PURE__ */
|
|
147
|
+
eye: /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("path", { d: "M2 12c2.5-5 7-8 10-8s7.5 3 10 8c-2.5 5-7 8-10 8s-7.5-3-10-8z" }), /* @__PURE__ */ d("circle", {
|
|
148
148
|
cx: "12",
|
|
149
149
|
cy: "12",
|
|
150
150
|
r: "3"
|
|
151
151
|
})] }),
|
|
152
|
-
columns: /* @__PURE__ */
|
|
152
|
+
columns: /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("rect", {
|
|
153
153
|
x: "3",
|
|
154
154
|
y: "4",
|
|
155
155
|
width: "8",
|
|
156
156
|
height: "16",
|
|
157
157
|
rx: "1.5"
|
|
158
|
-
}), /* @__PURE__ */
|
|
158
|
+
}), /* @__PURE__ */ d("rect", {
|
|
159
159
|
x: "13",
|
|
160
160
|
y: "4",
|
|
161
161
|
width: "8",
|
|
162
162
|
height: "16",
|
|
163
163
|
rx: "1.5"
|
|
164
164
|
})] }),
|
|
165
|
-
"sidebar-left": /* @__PURE__ */
|
|
165
|
+
"sidebar-left": /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("rect", {
|
|
166
166
|
x: "3",
|
|
167
167
|
y: "4",
|
|
168
168
|
width: "18",
|
|
169
169
|
height: "16",
|
|
170
170
|
rx: "2"
|
|
171
|
-
}), /* @__PURE__ */
|
|
171
|
+
}), /* @__PURE__ */ d("rect", {
|
|
172
172
|
x: "4",
|
|
173
173
|
y: "5",
|
|
174
174
|
width: "6",
|
|
@@ -177,13 +177,13 @@ var p = {
|
|
|
177
177
|
fill: "currentColor",
|
|
178
178
|
stroke: "none"
|
|
179
179
|
})] }),
|
|
180
|
-
"sidebar-right": /* @__PURE__ */
|
|
180
|
+
"sidebar-right": /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("rect", {
|
|
181
181
|
x: "3",
|
|
182
182
|
y: "4",
|
|
183
183
|
width: "18",
|
|
184
184
|
height: "16",
|
|
185
185
|
rx: "2"
|
|
186
|
-
}), /* @__PURE__ */
|
|
186
|
+
}), /* @__PURE__ */ d("rect", {
|
|
187
187
|
x: "14",
|
|
188
188
|
y: "5",
|
|
189
189
|
width: "6",
|
|
@@ -192,29 +192,29 @@ var p = {
|
|
|
192
192
|
fill: "currentColor",
|
|
193
193
|
stroke: "none"
|
|
194
194
|
})] }),
|
|
195
|
-
play: /* @__PURE__ */
|
|
196
|
-
pause: /* @__PURE__ */
|
|
195
|
+
play: /* @__PURE__ */ d("polygon", { points: "5 3 19 12 5 21 5 3" }),
|
|
196
|
+
pause: /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("rect", {
|
|
197
197
|
x: "6",
|
|
198
198
|
y: "4",
|
|
199
199
|
width: "4",
|
|
200
200
|
height: "16",
|
|
201
201
|
rx: "1"
|
|
202
|
-
}), /* @__PURE__ */
|
|
202
|
+
}), /* @__PURE__ */ d("rect", {
|
|
203
203
|
x: "14",
|
|
204
204
|
y: "4",
|
|
205
205
|
width: "4",
|
|
206
206
|
height: "16",
|
|
207
207
|
rx: "1"
|
|
208
208
|
})] }),
|
|
209
|
-
"volume-2": /* @__PURE__ */
|
|
210
|
-
/* @__PURE__ */
|
|
211
|
-
/* @__PURE__ */
|
|
212
|
-
/* @__PURE__ */
|
|
209
|
+
"volume-2": /* @__PURE__ */ f(u, { children: [
|
|
210
|
+
/* @__PURE__ */ d("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
|
|
211
|
+
/* @__PURE__ */ d("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07" }),
|
|
212
|
+
/* @__PURE__ */ d("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14" })
|
|
213
213
|
] }),
|
|
214
|
-
"tech-node": /* @__PURE__ */
|
|
215
|
-
"tech-go": /* @__PURE__ */
|
|
216
|
-
"tech-php": /* @__PURE__ */
|
|
217
|
-
grid: /* @__PURE__ */
|
|
214
|
+
"tech-node": /* @__PURE__ */ d("polygon", { points: "12,3 19.8,7.5 19.8,16.5 12,21 4.2,16.5 4.2,7.5" }),
|
|
215
|
+
"tech-go": /* @__PURE__ */ d("polygon", { points: "12,3 21,12 12,21 3,12" }),
|
|
216
|
+
"tech-php": /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("path", { d: "M9 4c-1.5 0-2.5 1-2.5 2.5v3c0 1-.5 1.5-1.5 2.5 1 1 1.5 1.5 1.5 2.5v3c0 1.5 1 2.5 2.5 2.5" }), /* @__PURE__ */ d("path", { d: "M15 4c1.5 0 2.5 1 2.5 2.5v3c0 1 .5 1.5 1.5 2.5-1 1-1.5 1.5-1.5 2.5v3c0 1.5-1 2.5-2.5 2.5" })] }),
|
|
217
|
+
grid: /* @__PURE__ */ d("g", {
|
|
218
218
|
fill: "currentColor",
|
|
219
219
|
stroke: "none",
|
|
220
220
|
children: [
|
|
@@ -225,20 +225,20 @@ var p = {
|
|
|
225
225
|
5,
|
|
226
226
|
12,
|
|
227
227
|
19
|
|
228
|
-
].map((t) => /* @__PURE__ */
|
|
228
|
+
].map((t) => /* @__PURE__ */ d("circle", {
|
|
229
229
|
cx: t,
|
|
230
230
|
cy: e,
|
|
231
231
|
r: "2"
|
|
232
232
|
}, `${t}-${e}`)))
|
|
233
233
|
}),
|
|
234
|
-
lock: /* @__PURE__ */
|
|
234
|
+
lock: /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("rect", {
|
|
235
235
|
x: "5",
|
|
236
236
|
y: "11",
|
|
237
237
|
width: "14",
|
|
238
238
|
height: "10",
|
|
239
239
|
rx: "2"
|
|
240
|
-
}), /* @__PURE__ */
|
|
241
|
-
},
|
|
240
|
+
}), /* @__PURE__ */ d("path", { d: "M8 11V7a4 4 0 0 1 8 0v4" })] })
|
|
241
|
+
}, _ = ({ name: e, size: t = 18, ...n }) => /* @__PURE__ */ d("svg", {
|
|
242
242
|
className: "sg-icon",
|
|
243
243
|
width: t,
|
|
244
244
|
height: t,
|
|
@@ -250,50 +250,51 @@ var p = {
|
|
|
250
250
|
strokeLinejoin: "round",
|
|
251
251
|
"aria-hidden": "true",
|
|
252
252
|
...n,
|
|
253
|
-
children:
|
|
254
|
-
}),
|
|
253
|
+
children: g[e]
|
|
254
|
+
}), v = ({ label: e, icon: t, iconOnly: n, variant: r = "primary", className: i, title: a, ...o }) => /* @__PURE__ */ f("button", {
|
|
255
255
|
className: [
|
|
256
256
|
"custom-button",
|
|
257
|
+
r === "primary" ? "" : `custom-button--${r}`,
|
|
257
258
|
t ? "custom-button-with-icon" : "",
|
|
258
|
-
|
|
259
|
+
i
|
|
259
260
|
].filter(Boolean).join(" "),
|
|
260
|
-
title:
|
|
261
|
-
...
|
|
262
|
-
children: [t && /* @__PURE__ */
|
|
261
|
+
title: a ?? (n ? e : void 0),
|
|
262
|
+
...o,
|
|
263
|
+
children: [t && /* @__PURE__ */ d(_, { name: t }), /* @__PURE__ */ d("span", {
|
|
263
264
|
className: n ? "custom-button-label-visually-hidden" : void 0,
|
|
264
265
|
children: e
|
|
265
266
|
})]
|
|
266
|
-
}),
|
|
267
|
+
}), y = ({ copyright: e = "© 2026 My Company", href: t = "#", links: n = [] }) => /* @__PURE__ */ f("footer", {
|
|
267
268
|
className: "footer",
|
|
268
|
-
children: [/* @__PURE__ */
|
|
269
|
+
children: [/* @__PURE__ */ d("span", { children: /* @__PURE__ */ d("a", {
|
|
269
270
|
href: t,
|
|
270
271
|
children: e
|
|
271
|
-
}) }), n.length > 0 && /* @__PURE__ */
|
|
272
|
+
}) }), n.length > 0 && /* @__PURE__ */ d("nav", { children: n.map(({ label: e, href: t }) => /* @__PURE__ */ d("a", {
|
|
272
273
|
href: t,
|
|
273
274
|
style: { marginLeft: "16px" },
|
|
274
275
|
children: e
|
|
275
276
|
}, t)) })]
|
|
276
|
-
}),
|
|
277
|
-
function
|
|
278
|
-
return document.cookie.split("; ").some((e) => e.startsWith(`${
|
|
277
|
+
}), b = "simonegentili.com-cookie-consent", x = 3600 * 24 * 365;
|
|
278
|
+
function S() {
|
|
279
|
+
return document.cookie.split("; ").some((e) => e.startsWith(`${b}=`));
|
|
279
280
|
}
|
|
280
|
-
function
|
|
281
|
-
document.cookie = `${
|
|
281
|
+
function C() {
|
|
282
|
+
document.cookie = `${b}=accepted; path=/; domain=.simonegentili.com; max-age=${x}; secure; samesite=strict`;
|
|
282
283
|
}
|
|
283
|
-
var
|
|
284
|
-
let [t,
|
|
285
|
-
return
|
|
286
|
-
|
|
287
|
-
}, []), t ? /* @__PURE__ */
|
|
284
|
+
var w = ({ privacyPolicyHref: e = "https://simonegentili.com/privacy" }) => {
|
|
285
|
+
let [t, n] = l(!1);
|
|
286
|
+
return a(() => {
|
|
287
|
+
n(!S());
|
|
288
|
+
}, []), t ? /* @__PURE__ */ f("div", {
|
|
288
289
|
className: "cookie-consent",
|
|
289
290
|
role: "region",
|
|
290
291
|
"aria-label": "Informativa sui cookie",
|
|
291
|
-
children: [/* @__PURE__ */
|
|
292
|
+
children: [/* @__PURE__ */ f("p", {
|
|
292
293
|
className: "cookie-consent-text",
|
|
293
294
|
children: [
|
|
294
295
|
"Questo sito utilizza esclusivamente cookie tecnici necessari al funzionamento (es. autenticazione). Non sono presenti cookie di profilazione o di terze parti. Per saperne di più consulta la",
|
|
295
296
|
" ",
|
|
296
|
-
/* @__PURE__ */
|
|
297
|
+
/* @__PURE__ */ d("a", {
|
|
297
298
|
href: e,
|
|
298
299
|
target: "_blank",
|
|
299
300
|
rel: "noopener noreferrer",
|
|
@@ -301,15 +302,15 @@ var x = ({ privacyPolicyHref: e = "https://simonegentili.com/privacy" }) => {
|
|
|
301
302
|
}),
|
|
302
303
|
"."
|
|
303
304
|
]
|
|
304
|
-
}), /* @__PURE__ */
|
|
305
|
+
}), /* @__PURE__ */ d(v, {
|
|
305
306
|
label: "Accetta",
|
|
306
307
|
onClick: () => {
|
|
307
|
-
|
|
308
|
+
C(), n(!1);
|
|
308
309
|
},
|
|
309
310
|
className: "cookie-consent-accept"
|
|
310
311
|
})]
|
|
311
312
|
}) : null;
|
|
312
|
-
},
|
|
313
|
+
}, T = [
|
|
313
314
|
{
|
|
314
315
|
label: "guitar",
|
|
315
316
|
href: "https://guitar.simonegentili.com"
|
|
@@ -330,33 +331,33 @@ var x = ({ privacyPolicyHref: e = "https://simonegentili.com/privacy" }) => {
|
|
|
330
331
|
label: "code2image",
|
|
331
332
|
href: "https://code2image.simonegentili.com"
|
|
332
333
|
}
|
|
333
|
-
],
|
|
334
|
+
], E = () => /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(y, {
|
|
334
335
|
href: "https://simonegentili.com",
|
|
335
336
|
copyright: "© 2026 simonegentili.com",
|
|
336
|
-
links:
|
|
337
|
-
}), /* @__PURE__ */
|
|
337
|
+
links: T
|
|
338
|
+
}), /* @__PURE__ */ d(w, {})] }), D = ({ onNavigate: e, title: t = "Simone Gentili - senior web developer, tech author and chess enthusiast", homePageKey: n = "home", children: r, className: i }) => /* @__PURE__ */ d("header", {
|
|
338
339
|
className: i ? `header ${i}` : "header",
|
|
339
|
-
children: /* @__PURE__ */
|
|
340
|
+
children: /* @__PURE__ */ f("div", {
|
|
340
341
|
className: "header-container",
|
|
341
|
-
children: [/* @__PURE__ */
|
|
342
|
+
children: [/* @__PURE__ */ d("div", {
|
|
342
343
|
className: "logo",
|
|
343
344
|
onClick: () => {
|
|
344
345
|
e?.(n);
|
|
345
346
|
},
|
|
346
|
-
children: /* @__PURE__ */
|
|
347
|
+
children: /* @__PURE__ */ d("h1", {
|
|
347
348
|
className: "logo-text",
|
|
348
349
|
children: t
|
|
349
350
|
})
|
|
350
|
-
}), r && /* @__PURE__ */
|
|
351
|
+
}), r && /* @__PURE__ */ d("div", {
|
|
351
352
|
className: "header-actions",
|
|
352
353
|
children: r
|
|
353
354
|
})]
|
|
354
355
|
})
|
|
355
|
-
}),
|
|
356
|
+
}), O = ({ onNavigate: e }) => /* @__PURE__ */ d(D, {
|
|
356
357
|
onNavigate: e,
|
|
357
358
|
title: "Simone Gentili - senior web developer, tech author and chess enthusiast",
|
|
358
359
|
homePageKey: "home"
|
|
359
|
-
}),
|
|
360
|
+
}), k = {
|
|
360
361
|
auth: {
|
|
361
362
|
login: "Accedi",
|
|
362
363
|
logout: "Esci",
|
|
@@ -387,8 +388,14 @@ var x = ({ privacyPolicyHref: e = "https://simonegentili.com/privacy" }) => {
|
|
|
387
388
|
errorEmpty: "Inserisci e conferma la nuova password.",
|
|
388
389
|
errorMismatch: "Le password non coincidono."
|
|
389
390
|
},
|
|
390
|
-
languageSwitcher: { label: "Lingua" }
|
|
391
|
-
|
|
391
|
+
languageSwitcher: { label: "Lingua" },
|
|
392
|
+
status: { loading: "Caricamento…" },
|
|
393
|
+
badge: { remove: "Rimuovi" },
|
|
394
|
+
confirm: {
|
|
395
|
+
confirm: "Conferma",
|
|
396
|
+
cancel: "Annulla"
|
|
397
|
+
}
|
|
398
|
+
}, ee = {
|
|
392
399
|
auth: {
|
|
393
400
|
login: "Log in",
|
|
394
401
|
logout: "Log out",
|
|
@@ -419,8 +426,14 @@ var x = ({ privacyPolicyHref: e = "https://simonegentili.com/privacy" }) => {
|
|
|
419
426
|
errorEmpty: "Enter and confirm the new password.",
|
|
420
427
|
errorMismatch: "The passwords don't match."
|
|
421
428
|
},
|
|
422
|
-
languageSwitcher: { label: "Language" }
|
|
423
|
-
|
|
429
|
+
languageSwitcher: { label: "Language" },
|
|
430
|
+
status: { loading: "Loading…" },
|
|
431
|
+
badge: { remove: "Remove" },
|
|
432
|
+
confirm: {
|
|
433
|
+
confirm: "Confirm",
|
|
434
|
+
cancel: "Cancel"
|
|
435
|
+
}
|
|
436
|
+
}, te = {
|
|
424
437
|
auth: {
|
|
425
438
|
login: "Se connecter",
|
|
426
439
|
logout: "Se déconnecter",
|
|
@@ -451,8 +464,14 @@ var x = ({ privacyPolicyHref: e = "https://simonegentili.com/privacy" }) => {
|
|
|
451
464
|
errorEmpty: "Saisissez et confirmez le nouveau mot de passe.",
|
|
452
465
|
errorMismatch: "Les mots de passe ne correspondent pas."
|
|
453
466
|
},
|
|
454
|
-
languageSwitcher: { label: "Langue" }
|
|
455
|
-
|
|
467
|
+
languageSwitcher: { label: "Langue" },
|
|
468
|
+
status: { loading: "Chargement…" },
|
|
469
|
+
badge: { remove: "Retirer" },
|
|
470
|
+
confirm: {
|
|
471
|
+
confirm: "Confirmer",
|
|
472
|
+
cancel: "Annuler"
|
|
473
|
+
}
|
|
474
|
+
}, ne = {
|
|
456
475
|
auth: {
|
|
457
476
|
login: "Anmelden",
|
|
458
477
|
logout: "Abmelden",
|
|
@@ -483,8 +502,14 @@ var x = ({ privacyPolicyHref: e = "https://simonegentili.com/privacy" }) => {
|
|
|
483
502
|
errorEmpty: "Gib das neue Passwort ein und bestätige es.",
|
|
484
503
|
errorMismatch: "Die Passwörter stimmen nicht überein."
|
|
485
504
|
},
|
|
486
|
-
languageSwitcher: { label: "Sprache" }
|
|
487
|
-
|
|
505
|
+
languageSwitcher: { label: "Sprache" },
|
|
506
|
+
status: { loading: "Wird geladen…" },
|
|
507
|
+
badge: { remove: "Entfernen" },
|
|
508
|
+
confirm: {
|
|
509
|
+
confirm: "Bestätigen",
|
|
510
|
+
cancel: "Abbrechen"
|
|
511
|
+
}
|
|
512
|
+
}, re = {
|
|
488
513
|
auth: {
|
|
489
514
|
login: "Iniciar sesión",
|
|
490
515
|
logout: "Cerrar sesión",
|
|
@@ -515,8 +540,14 @@ var x = ({ privacyPolicyHref: e = "https://simonegentili.com/privacy" }) => {
|
|
|
515
540
|
errorEmpty: "Introduce y confirma la nueva contraseña.",
|
|
516
541
|
errorMismatch: "Las contraseñas no coinciden."
|
|
517
542
|
},
|
|
518
|
-
languageSwitcher: { label: "Idioma" }
|
|
519
|
-
|
|
543
|
+
languageSwitcher: { label: "Idioma" },
|
|
544
|
+
status: { loading: "Cargando…" },
|
|
545
|
+
badge: { remove: "Quitar" },
|
|
546
|
+
confirm: {
|
|
547
|
+
confirm: "Confirmar",
|
|
548
|
+
cancel: "Cancelar"
|
|
549
|
+
}
|
|
550
|
+
}, A = {
|
|
520
551
|
auth: {
|
|
521
552
|
login: "ログイン",
|
|
522
553
|
logout: "ログアウト",
|
|
@@ -547,7 +578,13 @@ var x = ({ privacyPolicyHref: e = "https://simonegentili.com/privacy" }) => {
|
|
|
547
578
|
errorEmpty: "新しいパスワードを入力して確認してください。",
|
|
548
579
|
errorMismatch: "パスワードが一致しません。"
|
|
549
580
|
},
|
|
550
|
-
languageSwitcher: { label: "言語" }
|
|
581
|
+
languageSwitcher: { label: "言語" },
|
|
582
|
+
status: { loading: "読み込み中…" },
|
|
583
|
+
badge: { remove: "削除" },
|
|
584
|
+
confirm: {
|
|
585
|
+
confirm: "確認",
|
|
586
|
+
cancel: "キャンセル"
|
|
587
|
+
}
|
|
551
588
|
}, j = [
|
|
552
589
|
"it",
|
|
553
590
|
"en",
|
|
@@ -562,69 +599,69 @@ var x = ({ privacyPolicyHref: e = "https://simonegentili.com/privacy" }) => {
|
|
|
562
599
|
de: "Deutsch",
|
|
563
600
|
es: "Español",
|
|
564
601
|
ja: "日本語"
|
|
565
|
-
}, N = "sg-language", P = "it",
|
|
602
|
+
}, N = "sg-language", P = "it", F = (e) => !!e && j.includes(e), I = () => {
|
|
566
603
|
let e = document.cookie.split("; ").find((e) => e.startsWith(`${N}=`))?.slice(12);
|
|
567
|
-
return
|
|
568
|
-
},
|
|
604
|
+
return F(e) ? e : null;
|
|
605
|
+
}, ie = (e) => {
|
|
569
606
|
let t = window.location.hostname.endsWith("simonegentili.com") ? "; domain=.simonegentili.com; secure" : "";
|
|
570
607
|
document.cookie = `${N}=${e}; path=/; max-age=31536000; samesite=lax${t}`;
|
|
571
|
-
}, L =
|
|
608
|
+
}, L = h.createInstance();
|
|
572
609
|
L.init({
|
|
573
610
|
resources: {
|
|
574
|
-
it: { sg:
|
|
575
|
-
en: { sg:
|
|
576
|
-
fr: { sg:
|
|
577
|
-
de: { sg:
|
|
578
|
-
es: { sg:
|
|
579
|
-
ja: { sg:
|
|
611
|
+
it: { sg: k },
|
|
612
|
+
en: { sg: ee },
|
|
613
|
+
fr: { sg: te },
|
|
614
|
+
de: { sg: ne },
|
|
615
|
+
es: { sg: re },
|
|
616
|
+
ja: { sg: A }
|
|
580
617
|
},
|
|
581
|
-
lng:
|
|
618
|
+
lng: I() ?? P,
|
|
582
619
|
fallbackLng: P,
|
|
583
620
|
supportedLngs: [...j],
|
|
584
621
|
ns: ["sg", "translation"],
|
|
585
622
|
defaultNS: "translation",
|
|
586
623
|
initAsync: !1,
|
|
587
624
|
interpolation: { escapeValue: !1 }
|
|
588
|
-
}), L.on("languageChanged",
|
|
589
|
-
var
|
|
625
|
+
}), L.on("languageChanged", ie);
|
|
626
|
+
var ae = ({ resources: e }) => {
|
|
590
627
|
for (let [t, n] of Object.entries(e)) L.addResourceBundle(t, "translation", n, !0, !0);
|
|
591
|
-
return
|
|
592
|
-
}, R = "https://api.simonegentili.com/heimdall", z = (e) => e.endsWith("/") ? e : `${e}/`,
|
|
628
|
+
return p(L), L;
|
|
629
|
+
}, R = "https://api.simonegentili.com/heimdall", z = (e) => e.endsWith("/") ? e : `${e}/`, oe = (e) => {
|
|
593
630
|
let t = z(window.location.origin + window.location.pathname);
|
|
594
631
|
return e.filter((e) => t.startsWith(z(e.url))).sort((e, t) => t.url.length - e.url.length)[0] ?? null;
|
|
595
632
|
}, B = ({ token: e, heimdallUrl: t = R }) => {
|
|
596
|
-
let { t:
|
|
597
|
-
|
|
598
|
-
e && fetch(`${t}/access`, { headers: { Authorization: `Bearer ${e}` } }).then((e) => e.ok ? e.json() : Promise.reject(e.status)).then((t) =>
|
|
633
|
+
let { t: n } = m("sg", { i18n: L }), [r, i] = l(null), [o, s] = l(!1), [c, p] = l(!1);
|
|
634
|
+
a(() => {
|
|
635
|
+
e && fetch(`${t}/access`, { headers: { Authorization: `Bearer ${e}` } }).then((e) => e.ok ? e.json() : Promise.reject(e.status)).then((t) => i({
|
|
599
636
|
token: e,
|
|
600
|
-
app:
|
|
601
|
-
})).catch(() =>
|
|
637
|
+
app: oe(t.apps)
|
|
638
|
+
})).catch(() => i({
|
|
602
639
|
token: e,
|
|
603
640
|
app: null
|
|
604
641
|
}));
|
|
605
642
|
}, [e, t]);
|
|
606
|
-
let
|
|
607
|
-
return !e ||
|
|
643
|
+
let h = r?.token === e ? r.app : null;
|
|
644
|
+
return !e || h === null || h.access === "open" || h.access === "approved" ? null : /* @__PURE__ */ d("div", {
|
|
608
645
|
className: "sg-access-gate",
|
|
609
646
|
role: "dialog",
|
|
610
647
|
"aria-modal": "true",
|
|
611
648
|
"aria-labelledby": "sg-access-gate-title",
|
|
612
|
-
children: /* @__PURE__ */
|
|
649
|
+
children: /* @__PURE__ */ f("div", {
|
|
613
650
|
className: "sg-access-gate-card",
|
|
614
|
-
children: [/* @__PURE__ */
|
|
651
|
+
children: [/* @__PURE__ */ d("h2", {
|
|
615
652
|
id: "sg-access-gate-title",
|
|
616
|
-
children:
|
|
617
|
-
}),
|
|
618
|
-
/* @__PURE__ */
|
|
619
|
-
|
|
653
|
+
children: n("accessGate.title", { app: h.name })
|
|
654
|
+
}), h.access === "pending" ? /* @__PURE__ */ d("p", { children: n("accessGate.pending") }) : /* @__PURE__ */ f(u, { children: [
|
|
655
|
+
/* @__PURE__ */ d("p", { children: h.access === "rejected" ? n("accessGate.rejected") : n("accessGate.none") }),
|
|
656
|
+
c && /* @__PURE__ */ d("p", {
|
|
620
657
|
className: "sg-access-gate-error",
|
|
621
|
-
children:
|
|
658
|
+
children: n("accessGate.failed")
|
|
622
659
|
}),
|
|
623
|
-
/* @__PURE__ */
|
|
624
|
-
label:
|
|
625
|
-
disabled:
|
|
660
|
+
/* @__PURE__ */ d(v, {
|
|
661
|
+
label: n(o ? "accessGate.sending" : "accessGate.request"),
|
|
662
|
+
disabled: o,
|
|
626
663
|
onClick: async () => {
|
|
627
|
-
|
|
664
|
+
s(!0), p(!1);
|
|
628
665
|
try {
|
|
629
666
|
let n = await fetch(`${t}/access-requests`, {
|
|
630
667
|
method: "POST",
|
|
@@ -632,98 +669,98 @@ var ne = ({ resources: e }) => {
|
|
|
632
669
|
Authorization: `Bearer ${e}`,
|
|
633
670
|
"Content-Type": "application/json"
|
|
634
671
|
},
|
|
635
|
-
body: JSON.stringify({ app:
|
|
672
|
+
body: JSON.stringify({ app: h.slug })
|
|
636
673
|
});
|
|
637
|
-
n.ok || n.status === 409 ?
|
|
674
|
+
n.ok || n.status === 409 ? i({
|
|
638
675
|
token: e,
|
|
639
676
|
app: {
|
|
640
|
-
...
|
|
677
|
+
...h,
|
|
641
678
|
access: "pending"
|
|
642
679
|
}
|
|
643
|
-
}) :
|
|
680
|
+
}) : p(!0);
|
|
644
681
|
} catch {
|
|
645
|
-
|
|
682
|
+
p(!0);
|
|
646
683
|
} finally {
|
|
647
|
-
|
|
684
|
+
s(!1);
|
|
648
685
|
}
|
|
649
686
|
}
|
|
650
687
|
})
|
|
651
688
|
] })]
|
|
652
689
|
})
|
|
653
690
|
});
|
|
654
|
-
}, V = "https://api.simonegentili.com/heimdall/launcher", H = ({ appsUrl: e = V, label: t, token:
|
|
655
|
-
let { t:
|
|
656
|
-
return
|
|
657
|
-
!
|
|
658
|
-
token:
|
|
691
|
+
}, V = "https://api.simonegentili.com/heimdall/launcher", H = ({ appsUrl: e = V, label: t, token: n = null }) => {
|
|
692
|
+
let { t: r } = m("sg", { i18n: L }), i = t ?? r("launcher.label"), [o, s] = l(!1), [u, p] = l(null), h = u?.token === n ? u.apps : null, [g, v] = l(!1), y = c(null);
|
|
693
|
+
return a(() => {
|
|
694
|
+
!o || h !== null || fetch(e, n ? { headers: { Authorization: `Bearer ${n}` } } : void 0).then((e) => e.ok ? e.json() : Promise.reject(e.status)).then((e) => p({
|
|
695
|
+
token: n,
|
|
659
696
|
apps: e.apps
|
|
660
697
|
})).catch(() => v(!0));
|
|
661
698
|
}, [
|
|
662
|
-
|
|
663
|
-
|
|
699
|
+
o,
|
|
700
|
+
h,
|
|
664
701
|
e,
|
|
665
|
-
|
|
666
|
-
]),
|
|
667
|
-
if (!
|
|
702
|
+
n
|
|
703
|
+
]), a(() => {
|
|
704
|
+
if (!o) return;
|
|
668
705
|
let e = (e) => {
|
|
669
|
-
y.current?.contains(e.target) ||
|
|
706
|
+
y.current?.contains(e.target) || s(!1);
|
|
670
707
|
}, t = (e) => {
|
|
671
|
-
e.key === "Escape" &&
|
|
708
|
+
e.key === "Escape" && s(!1);
|
|
672
709
|
};
|
|
673
710
|
return document.addEventListener("pointerdown", e), document.addEventListener("keydown", t), () => {
|
|
674
711
|
document.removeEventListener("pointerdown", e), document.removeEventListener("keydown", t);
|
|
675
712
|
};
|
|
676
|
-
}, [
|
|
713
|
+
}, [o]), /* @__PURE__ */ f("div", {
|
|
677
714
|
className: "sg-app-launcher",
|
|
678
715
|
ref: y,
|
|
679
|
-
children: [/* @__PURE__ */
|
|
716
|
+
children: [/* @__PURE__ */ d("button", {
|
|
680
717
|
type: "button",
|
|
681
718
|
className: "sg-app-launcher-toggle",
|
|
682
|
-
"aria-label":
|
|
683
|
-
title:
|
|
684
|
-
"aria-expanded":
|
|
719
|
+
"aria-label": i,
|
|
720
|
+
title: i,
|
|
721
|
+
"aria-expanded": o,
|
|
685
722
|
onClick: () => {
|
|
686
|
-
|
|
723
|
+
o || v(!1), s(!o);
|
|
687
724
|
},
|
|
688
|
-
children: /* @__PURE__ */
|
|
725
|
+
children: /* @__PURE__ */ d(_, {
|
|
689
726
|
name: "grid",
|
|
690
727
|
size: 22
|
|
691
728
|
})
|
|
692
|
-
}),
|
|
729
|
+
}), o && /* @__PURE__ */ d("div", {
|
|
693
730
|
className: "sg-app-launcher-panel",
|
|
694
|
-
children:
|
|
731
|
+
children: g ? /* @__PURE__ */ d("p", {
|
|
695
732
|
className: "sg-app-launcher-message",
|
|
696
|
-
children:
|
|
697
|
-
}) :
|
|
733
|
+
children: r("launcher.loadFailed")
|
|
734
|
+
}) : h === null ? /* @__PURE__ */ d("p", {
|
|
698
735
|
className: "sg-app-launcher-message",
|
|
699
|
-
children:
|
|
700
|
-
}) : /* @__PURE__ */
|
|
736
|
+
children: r("launcher.loading")
|
|
737
|
+
}) : /* @__PURE__ */ d("ul", {
|
|
701
738
|
className: "sg-app-launcher-grid",
|
|
702
|
-
children:
|
|
739
|
+
children: h.map((e) => /* @__PURE__ */ d("li", { children: /* @__PURE__ */ f("a", {
|
|
703
740
|
href: e.url,
|
|
704
741
|
className: [
|
|
705
742
|
"sg-app-launcher-app",
|
|
706
743
|
new URL(e.url).origin === window.location.origin ? "current" : "",
|
|
707
744
|
e.locked ? "locked" : ""
|
|
708
745
|
].filter(Boolean).join(" "),
|
|
709
|
-
title: e.locked ? `${e.name}: ${
|
|
710
|
-
children: [/* @__PURE__ */
|
|
746
|
+
title: e.locked ? `${e.name}: ${r("launcher.locked")}` : void 0,
|
|
747
|
+
children: [/* @__PURE__ */ f("span", {
|
|
711
748
|
className: "sg-app-launcher-tile",
|
|
712
749
|
"aria-hidden": "true",
|
|
713
|
-
children: [e.name.charAt(0).toUpperCase(), e.locked && /* @__PURE__ */
|
|
750
|
+
children: [e.name.charAt(0).toUpperCase(), e.locked && /* @__PURE__ */ d("span", {
|
|
714
751
|
className: "sg-app-launcher-lock",
|
|
715
|
-
children: /* @__PURE__ */
|
|
752
|
+
children: /* @__PURE__ */ d(_, {
|
|
716
753
|
name: "lock",
|
|
717
754
|
size: 12
|
|
718
755
|
})
|
|
719
756
|
})]
|
|
720
|
-
}), /* @__PURE__ */
|
|
757
|
+
}), /* @__PURE__ */ f("span", {
|
|
721
758
|
className: "sg-app-launcher-name",
|
|
722
|
-
children: [e.name, e.locked && /* @__PURE__ */
|
|
759
|
+
children: [e.name, e.locked && /* @__PURE__ */ f("span", {
|
|
723
760
|
className: "sg-visually-hidden",
|
|
724
761
|
children: [
|
|
725
762
|
" (",
|
|
726
|
-
|
|
763
|
+
r("launcher.locked"),
|
|
727
764
|
")"
|
|
728
765
|
]
|
|
729
766
|
})]
|
|
@@ -732,34 +769,48 @@ var ne = ({ resources: e }) => {
|
|
|
732
769
|
})
|
|
733
770
|
})]
|
|
734
771
|
});
|
|
735
|
-
}, U = ({
|
|
736
|
-
let
|
|
737
|
-
return
|
|
772
|
+
}, U = ({ src: e, name: t, size: n = 32, className: r }) => {
|
|
773
|
+
let i = ["sg-avatar", r].filter(Boolean).join(" "), a = { "--avatar-size": `${n}px` };
|
|
774
|
+
return e ? /* @__PURE__ */ d("img", {
|
|
775
|
+
className: i,
|
|
776
|
+
style: a,
|
|
777
|
+
src: e,
|
|
778
|
+
alt: t ?? ""
|
|
779
|
+
}) : /* @__PURE__ */ d("span", {
|
|
780
|
+
className: i,
|
|
781
|
+
style: a,
|
|
782
|
+
role: "img",
|
|
783
|
+
"aria-label": t ?? void 0,
|
|
784
|
+
children: t?.trim().charAt(0).toUpperCase() || "?"
|
|
785
|
+
});
|
|
786
|
+
}, W = ({ isLoggedIn: e, handleLogin: t, handleLogout: n }) => {
|
|
787
|
+
let { t: r } = m("sg", { i18n: L });
|
|
788
|
+
return /* @__PURE__ */ d(u, { children: e ? /* @__PURE__ */ d("button", {
|
|
738
789
|
onClick: n,
|
|
739
790
|
className: "sg-authenticator-button",
|
|
740
791
|
children: r("auth.logout")
|
|
741
|
-
}) : /* @__PURE__ */
|
|
792
|
+
}) : /* @__PURE__ */ d("button", {
|
|
742
793
|
onClick: t,
|
|
743
794
|
className: "sg-authenticator-button",
|
|
744
795
|
children: r("auth.login")
|
|
745
796
|
}) });
|
|
746
|
-
},
|
|
747
|
-
let { t:
|
|
797
|
+
}, G = 220, K = ({ open: t, onClose: n, title: r, icon: i, children: o, buttons: s, footer: c, closeLabel: u, className: p }) => {
|
|
798
|
+
let { t: h } = m("sg", { i18n: L }), [g, _] = l(!1), [y, b] = l({
|
|
748
799
|
x: 0,
|
|
749
800
|
y: 0
|
|
750
|
-
}), x = e.useRef(null), [S, C] =
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
},
|
|
801
|
+
}), x = e.useRef(null), [S, C] = l(!1), w = (e) => {
|
|
802
|
+
g || (_(!0), setTimeout(() => {
|
|
803
|
+
_(!1), e();
|
|
804
|
+
}, G));
|
|
754
805
|
};
|
|
755
|
-
|
|
806
|
+
a(() => {
|
|
756
807
|
if (!t) return;
|
|
757
808
|
let e = (e) => {
|
|
758
|
-
e.key === "Escape" && w(
|
|
809
|
+
e.key === "Escape" && w(n);
|
|
759
810
|
};
|
|
760
811
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
761
|
-
}, [t,
|
|
762
|
-
let [T, E] =
|
|
812
|
+
}, [t, n]);
|
|
813
|
+
let [T, E] = l(t);
|
|
763
814
|
if (t !== T && (E(t), t && b({
|
|
764
815
|
x: 0,
|
|
765
816
|
y: 0
|
|
@@ -783,117 +834,121 @@ var ne = ({ resources: e }) => {
|
|
|
783
834
|
function k() {
|
|
784
835
|
x.current = null, C(!1);
|
|
785
836
|
}
|
|
786
|
-
return /* @__PURE__ */
|
|
787
|
-
className: `modal-overlay${
|
|
788
|
-
onClick: () => w(
|
|
789
|
-
children: /* @__PURE__ */
|
|
790
|
-
className: `modal-content${
|
|
837
|
+
return /* @__PURE__ */ d("div", {
|
|
838
|
+
className: `modal-overlay${g ? " modal-overlay-closing" : ""}`,
|
|
839
|
+
onClick: () => w(n),
|
|
840
|
+
children: /* @__PURE__ */ f("div", {
|
|
841
|
+
className: `modal-content${p ? ` ${p}` : ""}${g ? " modal-content-closing" : ""}`,
|
|
791
842
|
style: {
|
|
792
843
|
"--drag-x": `${y.x}px`,
|
|
793
844
|
"--drag-y": `${y.y}px`
|
|
794
845
|
},
|
|
795
846
|
onClick: (e) => e.stopPropagation(),
|
|
796
847
|
children: [
|
|
797
|
-
/* @__PURE__ */
|
|
848
|
+
/* @__PURE__ */ f("div", {
|
|
798
849
|
className: `modal-header${S ? " modal-header-dragging" : ""}`,
|
|
799
850
|
onPointerDown: D,
|
|
800
851
|
onPointerMove: O,
|
|
801
852
|
onPointerUp: k,
|
|
802
853
|
onPointerCancel: k,
|
|
803
854
|
children: [
|
|
804
|
-
|
|
855
|
+
i && /* @__PURE__ */ d("span", {
|
|
805
856
|
className: "modal-icon",
|
|
806
|
-
children:
|
|
857
|
+
children: i
|
|
807
858
|
}),
|
|
808
|
-
|
|
859
|
+
r && /* @__PURE__ */ d("h2", {
|
|
809
860
|
className: "modal-title",
|
|
810
|
-
children:
|
|
861
|
+
children: r
|
|
811
862
|
}),
|
|
812
|
-
/* @__PURE__ */
|
|
863
|
+
/* @__PURE__ */ d("button", {
|
|
813
864
|
type: "button",
|
|
814
865
|
className: "modal-close",
|
|
815
|
-
"aria-label":
|
|
816
|
-
onClick: () => w(
|
|
817
|
-
disabled:
|
|
866
|
+
"aria-label": u ?? h("modal.close"),
|
|
867
|
+
onClick: () => w(n),
|
|
868
|
+
disabled: g,
|
|
818
869
|
children: "×"
|
|
819
870
|
})
|
|
820
871
|
]
|
|
821
872
|
}),
|
|
822
|
-
/* @__PURE__ */
|
|
873
|
+
/* @__PURE__ */ d("div", {
|
|
823
874
|
className: "modal-children",
|
|
824
|
-
children:
|
|
875
|
+
children: o
|
|
825
876
|
}),
|
|
826
|
-
|
|
877
|
+
s && /* @__PURE__ */ d("div", {
|
|
827
878
|
className: "modal-footer",
|
|
828
|
-
children:
|
|
879
|
+
children: s.map((e, t) => /* @__PURE__ */ d(v, {
|
|
829
880
|
label: e.label,
|
|
830
881
|
onClick: () => w(e.onClick),
|
|
831
|
-
disabled:
|
|
882
|
+
disabled: g
|
|
832
883
|
}, t))
|
|
833
884
|
}),
|
|
834
|
-
|
|
885
|
+
c && /* @__PURE__ */ d("div", {
|
|
835
886
|
className: "modal-footer",
|
|
836
|
-
children:
|
|
887
|
+
children: c
|
|
837
888
|
})
|
|
838
889
|
]
|
|
839
890
|
})
|
|
840
891
|
});
|
|
841
|
-
},
|
|
842
|
-
let
|
|
843
|
-
return /* @__PURE__ */
|
|
892
|
+
}, q = ({ label: e, invalid: t, className: n, id: r, ...i }) => {
|
|
893
|
+
let a = o(), s = r ?? a;
|
|
894
|
+
return /* @__PURE__ */ f("div", {
|
|
844
895
|
className: "input-wrapper",
|
|
845
|
-
children: [e && /* @__PURE__ */
|
|
896
|
+
children: [e && /* @__PURE__ */ d("label", {
|
|
846
897
|
className: "input-label",
|
|
847
898
|
htmlFor: s,
|
|
848
899
|
children: e
|
|
849
|
-
}), /* @__PURE__ */
|
|
900
|
+
}), /* @__PURE__ */ d("input", {
|
|
850
901
|
id: s,
|
|
851
902
|
className: [
|
|
852
903
|
"input-field",
|
|
853
904
|
t ? "input-field--invalid" : "",
|
|
854
905
|
n
|
|
855
906
|
].filter(Boolean).join(" "),
|
|
856
|
-
...
|
|
907
|
+
...i
|
|
857
908
|
})]
|
|
858
909
|
});
|
|
859
|
-
},
|
|
860
|
-
let a =
|
|
861
|
-
return /* @__PURE__ */
|
|
910
|
+
}, J = ({ label: e, invalid: t, className: n, id: r, ...i }) => {
|
|
911
|
+
let a = o(), s = r ?? a;
|
|
912
|
+
return /* @__PURE__ */ f("div", {
|
|
862
913
|
className: "input-wrapper",
|
|
863
|
-
children: [e && /* @__PURE__ */
|
|
914
|
+
children: [e && /* @__PURE__ */ d("label", {
|
|
864
915
|
className: "input-label",
|
|
865
|
-
htmlFor:
|
|
916
|
+
htmlFor: s,
|
|
866
917
|
children: e
|
|
867
|
-
}), /* @__PURE__ */
|
|
868
|
-
id:
|
|
918
|
+
}), /* @__PURE__ */ d("input", {
|
|
919
|
+
id: s,
|
|
869
920
|
type: "password",
|
|
870
|
-
className: [
|
|
921
|
+
className: [
|
|
922
|
+
"input-field",
|
|
923
|
+
t ? "input-field--invalid" : "",
|
|
924
|
+
n
|
|
925
|
+
].filter(Boolean).join(" "),
|
|
871
926
|
...i
|
|
872
927
|
})]
|
|
873
928
|
});
|
|
874
|
-
},
|
|
875
|
-
let { t: r } =
|
|
876
|
-
return /* @__PURE__ */
|
|
929
|
+
}, se = ({ open: e, onClose: t, onLogin: n }) => {
|
|
930
|
+
let { t: r } = m("sg", { i18n: L }), [i, a] = l(""), [o, s] = l("");
|
|
931
|
+
return /* @__PURE__ */ d(K, {
|
|
877
932
|
open: e,
|
|
878
933
|
onClose: t,
|
|
879
934
|
title: r("auth.login"),
|
|
880
|
-
children: /* @__PURE__ */
|
|
935
|
+
children: /* @__PURE__ */ f("form", {
|
|
881
936
|
onSubmit: (e) => {
|
|
882
|
-
e.preventDefault(), n(i,
|
|
937
|
+
e.preventDefault(), n(i, o);
|
|
883
938
|
},
|
|
884
939
|
children: [
|
|
885
|
-
/* @__PURE__ */
|
|
940
|
+
/* @__PURE__ */ d(q, {
|
|
886
941
|
label: r("auth.username"),
|
|
887
942
|
value: i,
|
|
888
943
|
onChange: (e) => a(e.target.value),
|
|
889
944
|
autoFocus: !0
|
|
890
945
|
}),
|
|
891
|
-
/* @__PURE__ */
|
|
946
|
+
/* @__PURE__ */ d(J, {
|
|
892
947
|
label: r("auth.password"),
|
|
893
|
-
value:
|
|
894
|
-
onChange: (e) =>
|
|
948
|
+
value: o,
|
|
949
|
+
onChange: (e) => s(e.target.value)
|
|
895
950
|
}),
|
|
896
|
-
/* @__PURE__ */
|
|
951
|
+
/* @__PURE__ */ d(v, {
|
|
897
952
|
label: r("auth.login"),
|
|
898
953
|
type: "submit",
|
|
899
954
|
style: { width: "100%" }
|
|
@@ -901,83 +956,79 @@ var ne = ({ resources: e }) => {
|
|
|
901
956
|
]
|
|
902
957
|
})
|
|
903
958
|
});
|
|
904
|
-
},
|
|
959
|
+
}, ce = "simonegentili.com-access-token", Y = "sg-avatar-change", X = (e) => document.cookie.split("; ").some((t) => t.startsWith(`${e}=`) && t.slice(e.length + 1).length > 0), le = (e) => {
|
|
905
960
|
let t = document.cookie.split("; ").find((t) => t.startsWith(`${e}=`));
|
|
906
961
|
return t ? t.slice(e.length + 1) : null;
|
|
907
|
-
},
|
|
962
|
+
}, ue = (e, t) => {
|
|
908
963
|
try {
|
|
909
964
|
return JSON.parse(atob(e.split(".")[1].replace(/-/g, "+").replace(/_/g, "/")))[t] ?? null;
|
|
910
965
|
} catch {
|
|
911
966
|
return null;
|
|
912
967
|
}
|
|
913
|
-
}, Z =
|
|
914
|
-
let [v, y] =
|
|
915
|
-
|
|
916
|
-
let S = v ?
|
|
917
|
-
return
|
|
968
|
+
}, Z = r(({ title: e = "Quadrato", homePageKey: t = "home", onNavigate: n, cookieName: r = ce, username: i = null, usernameJwtField: o = "sub", onLogin: c, onLogout: p, onUserAuthenticated: m, appsUrl: h, heimdallUrl: g = R }, _) => {
|
|
969
|
+
let [v, y] = l(() => X(r)), [b, x] = l(!1);
|
|
970
|
+
s(_, () => ({ openLoginModal: () => x(!0) }));
|
|
971
|
+
let S = v ? le(r) : null, C = i ?? (S ? ue(S, o) : null), [w, T] = l(null), E = S && w?.token === S ? w.src : null;
|
|
972
|
+
return a(() => {
|
|
918
973
|
if (!S) return;
|
|
919
974
|
let e = !1;
|
|
920
975
|
return fetch(`${g}/me/avatar`, { headers: { Authorization: `Bearer ${S}` } }).then((e) => e.ok ? e.json() : null).then((t) => {
|
|
921
|
-
e ||
|
|
976
|
+
e || T({
|
|
922
977
|
token: S,
|
|
923
978
|
src: t?.avatar ?? null
|
|
924
979
|
});
|
|
925
980
|
}).catch(() => {}), () => {
|
|
926
981
|
e = !0;
|
|
927
982
|
};
|
|
928
|
-
}, [S, g]),
|
|
983
|
+
}, [S, g]), a(() => {
|
|
929
984
|
if (!S) return;
|
|
930
|
-
let e = (e) =>
|
|
985
|
+
let e = (e) => T({
|
|
931
986
|
token: S,
|
|
932
987
|
src: e.detail
|
|
933
988
|
});
|
|
934
989
|
return window.addEventListener(Y, e), () => window.removeEventListener(Y, e);
|
|
935
|
-
}, [S]),
|
|
990
|
+
}, [S]), a(() => {
|
|
936
991
|
m?.(v, v ? C : null);
|
|
937
|
-
}, []), /* @__PURE__ */
|
|
938
|
-
/* @__PURE__ */
|
|
939
|
-
onNavigate:
|
|
992
|
+
}, []), /* @__PURE__ */ f(u, { children: [
|
|
993
|
+
/* @__PURE__ */ f(D, {
|
|
994
|
+
onNavigate: n,
|
|
940
995
|
title: e,
|
|
941
996
|
homePageKey: t,
|
|
942
997
|
className: "quadrato-header",
|
|
943
|
-
children: [/* @__PURE__ */
|
|
998
|
+
children: [/* @__PURE__ */ d(H, {
|
|
944
999
|
appsUrl: h,
|
|
945
1000
|
token: S
|
|
946
|
-
}), /* @__PURE__ */
|
|
1001
|
+
}), /* @__PURE__ */ f("div", {
|
|
947
1002
|
className: "quadrato-header-auth",
|
|
948
1003
|
children: [
|
|
949
|
-
v &&
|
|
950
|
-
|
|
951
|
-
src: D,
|
|
952
|
-
alt: ""
|
|
953
|
-
}),
|
|
954
|
-
v && C && /* @__PURE__ */ c("span", {
|
|
1004
|
+
v && E && /* @__PURE__ */ d(U, { src: E }),
|
|
1005
|
+
v && C && /* @__PURE__ */ d("span", {
|
|
955
1006
|
className: "quadrato-header-username",
|
|
956
1007
|
children: C
|
|
957
1008
|
}),
|
|
958
|
-
/* @__PURE__ */
|
|
1009
|
+
/* @__PURE__ */ d(W, {
|
|
959
1010
|
isLoggedIn: v,
|
|
960
1011
|
handleLogin: () => x(!0),
|
|
961
1012
|
handleLogout: () => {
|
|
962
1013
|
p?.();
|
|
963
|
-
let e = X(
|
|
1014
|
+
let e = X(r);
|
|
964
1015
|
y(e), m?.(e, null);
|
|
965
1016
|
}
|
|
966
1017
|
})
|
|
967
1018
|
]
|
|
968
1019
|
})]
|
|
969
1020
|
}),
|
|
970
|
-
/* @__PURE__ */
|
|
1021
|
+
/* @__PURE__ */ d(B, {
|
|
971
1022
|
token: S,
|
|
972
1023
|
heimdallUrl: g
|
|
973
1024
|
}),
|
|
974
|
-
/* @__PURE__ */
|
|
1025
|
+
/* @__PURE__ */ d(se, {
|
|
975
1026
|
open: b,
|
|
976
1027
|
onClose: () => x(!1),
|
|
977
1028
|
onLogin: async (e, t) => {
|
|
978
|
-
await
|
|
979
|
-
let n = X(
|
|
980
|
-
y(n), x(!1), m?.(n, n ?
|
|
1029
|
+
await c(e, t);
|
|
1030
|
+
let n = X(r);
|
|
1031
|
+
y(n), x(!1), m?.(n, n ? i ?? e : null);
|
|
981
1032
|
}
|
|
982
1033
|
})
|
|
983
1034
|
] });
|
|
@@ -985,42 +1036,42 @@ var ne = ({ resources: e }) => {
|
|
|
985
1036
|
Z.displayName = "QuadratoHeader";
|
|
986
1037
|
//#endregion
|
|
987
1038
|
//#region src/components/SetPasswordModal/SetPasswordModal.tsx
|
|
988
|
-
var
|
|
989
|
-
let { t: r } =
|
|
990
|
-
return /* @__PURE__ */
|
|
1039
|
+
var de = ({ open: e, onClose: t, onSubmit: n }) => {
|
|
1040
|
+
let { t: r } = m("sg", { i18n: L }), [i, a] = l(""), [o, s] = l(""), [c, u] = l("");
|
|
1041
|
+
return /* @__PURE__ */ d(K, {
|
|
991
1042
|
open: e,
|
|
992
1043
|
onClose: t,
|
|
993
1044
|
title: r("setPassword.title"),
|
|
994
|
-
children: /* @__PURE__ */
|
|
1045
|
+
children: /* @__PURE__ */ f("form", {
|
|
995
1046
|
className: "set-password-modal-form",
|
|
996
1047
|
onSubmit: (e) => {
|
|
997
|
-
if (e.preventDefault(), i === "" ||
|
|
998
|
-
|
|
1048
|
+
if (e.preventDefault(), i === "" || o === "") {
|
|
1049
|
+
u(r("setPassword.errorEmpty"));
|
|
999
1050
|
return;
|
|
1000
1051
|
}
|
|
1001
|
-
if (i !==
|
|
1002
|
-
|
|
1052
|
+
if (i !== o) {
|
|
1053
|
+
u(r("setPassword.errorMismatch"));
|
|
1003
1054
|
return;
|
|
1004
1055
|
}
|
|
1005
|
-
|
|
1056
|
+
u(""), n(i);
|
|
1006
1057
|
},
|
|
1007
1058
|
children: [
|
|
1008
|
-
/* @__PURE__ */
|
|
1059
|
+
/* @__PURE__ */ d(J, {
|
|
1009
1060
|
label: r("setPassword.newPassword"),
|
|
1010
1061
|
value: i,
|
|
1011
1062
|
onChange: (e) => a(e.target.value),
|
|
1012
1063
|
autoFocus: !0
|
|
1013
1064
|
}),
|
|
1014
|
-
/* @__PURE__ */
|
|
1065
|
+
/* @__PURE__ */ d(J, {
|
|
1015
1066
|
label: r("setPassword.confirmPassword"),
|
|
1016
|
-
value:
|
|
1017
|
-
onChange: (e) =>
|
|
1067
|
+
value: o,
|
|
1068
|
+
onChange: (e) => s(e.target.value)
|
|
1018
1069
|
}),
|
|
1019
|
-
|
|
1070
|
+
c && /* @__PURE__ */ d("p", {
|
|
1020
1071
|
className: "set-password-modal-error",
|
|
1021
|
-
children:
|
|
1072
|
+
children: c
|
|
1022
1073
|
}),
|
|
1023
|
-
/* @__PURE__ */
|
|
1074
|
+
/* @__PURE__ */ d(v, {
|
|
1024
1075
|
label: r("setPassword.submit"),
|
|
1025
1076
|
type: "submit",
|
|
1026
1077
|
style: { width: "100%" }
|
|
@@ -1028,48 +1079,48 @@ var se = ({ open: e, onClose: t, onSubmit: n }) => {
|
|
|
1028
1079
|
]
|
|
1029
1080
|
})
|
|
1030
1081
|
});
|
|
1031
|
-
},
|
|
1032
|
-
let [
|
|
1033
|
-
return
|
|
1034
|
-
if (!
|
|
1082
|
+
}, fe = ({ value: e, onChange: t, swatches: n }) => {
|
|
1083
|
+
let [r, i] = l(!1), o = c(null);
|
|
1084
|
+
return a(() => {
|
|
1085
|
+
if (!r) return;
|
|
1035
1086
|
let e = (e) => {
|
|
1036
|
-
|
|
1087
|
+
o.current && !o.current.contains(e.target) && i(!1);
|
|
1037
1088
|
}, t = (e) => {
|
|
1038
|
-
e.key === "Escape" &&
|
|
1089
|
+
e.key === "Escape" && i(!1);
|
|
1039
1090
|
};
|
|
1040
1091
|
return document.addEventListener("mousedown", e), document.addEventListener("keydown", t), () => {
|
|
1041
1092
|
document.removeEventListener("mousedown", e), document.removeEventListener("keydown", t);
|
|
1042
1093
|
};
|
|
1043
|
-
}, [
|
|
1044
|
-
ref:
|
|
1094
|
+
}, [r]), /* @__PURE__ */ f("div", {
|
|
1095
|
+
ref: o,
|
|
1045
1096
|
className: "sg-color-picker",
|
|
1046
|
-
children: [/* @__PURE__ */
|
|
1097
|
+
children: [/* @__PURE__ */ f("button", {
|
|
1047
1098
|
type: "button",
|
|
1048
1099
|
className: "sg-color-picker-toggle",
|
|
1049
|
-
onClick: () =>
|
|
1050
|
-
children: [/* @__PURE__ */
|
|
1100
|
+
onClick: () => i((e) => !e),
|
|
1101
|
+
children: [/* @__PURE__ */ d("span", {
|
|
1051
1102
|
className: "sg-color-picker-swatch",
|
|
1052
1103
|
style: { background: e }
|
|
1053
|
-
}), /* @__PURE__ */
|
|
1104
|
+
}), /* @__PURE__ */ d("span", {
|
|
1054
1105
|
className: "sg-color-picker-toggle-label",
|
|
1055
1106
|
children: e
|
|
1056
1107
|
})]
|
|
1057
|
-
}),
|
|
1108
|
+
}), r && /* @__PURE__ */ f("div", {
|
|
1058
1109
|
className: "sg-color-picker-popover",
|
|
1059
|
-
children: [/* @__PURE__ */
|
|
1110
|
+
children: [/* @__PURE__ */ d("div", {
|
|
1060
1111
|
className: "sg-color-picker-grid",
|
|
1061
|
-
children:
|
|
1112
|
+
children: n.map((n) => /* @__PURE__ */ d("button", {
|
|
1062
1113
|
type: "button",
|
|
1063
1114
|
title: n,
|
|
1064
1115
|
className: `sg-color-picker-swatch-button${n.toLowerCase() === e?.toLowerCase() ? " active" : ""}`,
|
|
1065
1116
|
style: { background: n },
|
|
1066
1117
|
onClick: () => {
|
|
1067
|
-
t(n),
|
|
1118
|
+
t(n), i(!1);
|
|
1068
1119
|
}
|
|
1069
1120
|
}, n))
|
|
1070
|
-
}), /* @__PURE__ */
|
|
1121
|
+
}), /* @__PURE__ */ f("label", {
|
|
1071
1122
|
className: "sg-color-picker-custom",
|
|
1072
|
-
children: ["Colore personalizzato", /* @__PURE__ */
|
|
1123
|
+
children: ["Colore personalizzato", /* @__PURE__ */ d("input", {
|
|
1073
1124
|
type: "color",
|
|
1074
1125
|
value: e,
|
|
1075
1126
|
onChange: (e) => t(e.target.value)
|
|
@@ -1077,76 +1128,250 @@ var se = ({ open: e, onClose: t, onSubmit: n }) => {
|
|
|
1077
1128
|
})]
|
|
1078
1129
|
})]
|
|
1079
1130
|
});
|
|
1080
|
-
},
|
|
1081
|
-
let [
|
|
1082
|
-
return
|
|
1083
|
-
if (!
|
|
1131
|
+
}, Q = (e) => e.split(",")[0].replace(/'/g, ""), pe = ({ value: e, onChange: t, options: n }) => {
|
|
1132
|
+
let [r, i] = l(!1), o = c(null);
|
|
1133
|
+
return a(() => {
|
|
1134
|
+
if (!r) return;
|
|
1084
1135
|
let e = (e) => {
|
|
1085
|
-
|
|
1136
|
+
o.current && !o.current.contains(e.target) && i(!1);
|
|
1086
1137
|
}, t = (e) => {
|
|
1087
|
-
e.key === "Escape" &&
|
|
1138
|
+
e.key === "Escape" && i(!1);
|
|
1088
1139
|
};
|
|
1089
1140
|
return document.addEventListener("mousedown", e), document.addEventListener("keydown", t), () => {
|
|
1090
1141
|
document.removeEventListener("mousedown", e), document.removeEventListener("keydown", t);
|
|
1091
1142
|
};
|
|
1092
|
-
}, [
|
|
1093
|
-
ref:
|
|
1143
|
+
}, [r]), /* @__PURE__ */ f("div", {
|
|
1144
|
+
ref: o,
|
|
1094
1145
|
className: "sg-font-picker",
|
|
1095
|
-
children: [/* @__PURE__ */
|
|
1146
|
+
children: [/* @__PURE__ */ f("button", {
|
|
1096
1147
|
type: "button",
|
|
1097
1148
|
className: "sg-font-picker-toggle",
|
|
1098
|
-
onClick: () =>
|
|
1149
|
+
onClick: () => i((e) => !e),
|
|
1099
1150
|
style: { fontFamily: e },
|
|
1100
|
-
children: [/* @__PURE__ */
|
|
1151
|
+
children: [/* @__PURE__ */ d("span", {
|
|
1101
1152
|
className: "sg-font-picker-toggle-label",
|
|
1102
|
-
children:
|
|
1103
|
-
}), /* @__PURE__ */
|
|
1153
|
+
children: Q(e)
|
|
1154
|
+
}), /* @__PURE__ */ d("span", {
|
|
1104
1155
|
className: "sg-font-picker-toggle-caret",
|
|
1105
|
-
children:
|
|
1156
|
+
children: r ? "▲" : "▼"
|
|
1106
1157
|
})]
|
|
1107
|
-
}),
|
|
1158
|
+
}), r && /* @__PURE__ */ d("ul", {
|
|
1108
1159
|
className: "sg-font-picker-list",
|
|
1109
|
-
children:
|
|
1160
|
+
children: n.map((n) => /* @__PURE__ */ d("li", { children: /* @__PURE__ */ d("button", {
|
|
1110
1161
|
type: "button",
|
|
1111
1162
|
className: `sg-font-picker-option${n === e ? " active" : ""}`,
|
|
1112
1163
|
onClick: () => {
|
|
1113
|
-
t(n),
|
|
1164
|
+
t(n), i(!1);
|
|
1114
1165
|
},
|
|
1115
1166
|
style: { fontFamily: n },
|
|
1116
|
-
children:
|
|
1167
|
+
children: Q(n)
|
|
1117
1168
|
}) }, n))
|
|
1118
1169
|
})]
|
|
1119
1170
|
});
|
|
1120
|
-
},
|
|
1121
|
-
className: "sg-toggle",
|
|
1171
|
+
}, me = ({ checked: e, onChange: t, label: n, icons: r, layout: i = "inline" }) => /* @__PURE__ */ f("label", {
|
|
1172
|
+
className: i === "row" ? "sg-toggle sg-toggle--row" : "sg-toggle",
|
|
1122
1173
|
children: [
|
|
1123
|
-
/* @__PURE__ */
|
|
1174
|
+
/* @__PURE__ */ d("input", {
|
|
1124
1175
|
type: "checkbox",
|
|
1125
1176
|
checked: e,
|
|
1126
1177
|
onChange: (e) => t(e.target.checked),
|
|
1127
1178
|
className: "sg-toggle-input"
|
|
1128
1179
|
}),
|
|
1129
|
-
/* @__PURE__ */
|
|
1180
|
+
/* @__PURE__ */ d("span", {
|
|
1130
1181
|
className: "sg-toggle-track",
|
|
1131
|
-
children: /* @__PURE__ */
|
|
1182
|
+
children: /* @__PURE__ */ d("span", { className: "sg-toggle-thumb" })
|
|
1132
1183
|
}),
|
|
1133
|
-
/* @__PURE__ */
|
|
1184
|
+
/* @__PURE__ */ d("span", {
|
|
1134
1185
|
className: "sg-toggle-label",
|
|
1135
1186
|
children: n
|
|
1187
|
+
}),
|
|
1188
|
+
r && /* @__PURE__ */ d("span", {
|
|
1189
|
+
className: "sg-toggle-icons",
|
|
1190
|
+
children: r
|
|
1136
1191
|
})
|
|
1137
1192
|
]
|
|
1138
|
-
}),
|
|
1139
|
-
let { t, i18n: n } =
|
|
1140
|
-
return /* @__PURE__ */
|
|
1193
|
+
}), he = ({ className: e }) => {
|
|
1194
|
+
let { t, i18n: n } = m("sg", { i18n: L });
|
|
1195
|
+
return /* @__PURE__ */ d("select", {
|
|
1141
1196
|
className: ["sg-language-switcher", e].filter(Boolean).join(" "),
|
|
1142
1197
|
value: n.resolvedLanguage,
|
|
1143
1198
|
onChange: (e) => n.changeLanguage(e.target.value),
|
|
1144
1199
|
"aria-label": t("languageSwitcher.label"),
|
|
1145
|
-
children: j.map((e) => /* @__PURE__ */
|
|
1200
|
+
children: j.map((e) => /* @__PURE__ */ d("option", {
|
|
1146
1201
|
value: e,
|
|
1147
1202
|
children: M[e]
|
|
1148
1203
|
}, e))
|
|
1149
1204
|
});
|
|
1205
|
+
}, ge = ({ value: e, max: t = 100, label: n, ariaLabel: r, tone: i = "accent", size: a = "md", className: o }) => {
|
|
1206
|
+
let s = t > 0 ? Math.min(100, Math.max(0, e / t * 100)) : 0;
|
|
1207
|
+
return /* @__PURE__ */ f("div", {
|
|
1208
|
+
className: [
|
|
1209
|
+
"sg-progress",
|
|
1210
|
+
`sg-progress--${i}`,
|
|
1211
|
+
`sg-progress--${a}`,
|
|
1212
|
+
o
|
|
1213
|
+
].filter(Boolean).join(" "),
|
|
1214
|
+
children: [/* @__PURE__ */ d("div", {
|
|
1215
|
+
className: "sg-progress-track",
|
|
1216
|
+
role: "progressbar",
|
|
1217
|
+
"aria-valuemin": 0,
|
|
1218
|
+
"aria-valuemax": t,
|
|
1219
|
+
"aria-valuenow": e,
|
|
1220
|
+
"aria-label": r,
|
|
1221
|
+
children: /* @__PURE__ */ d("div", {
|
|
1222
|
+
className: "sg-progress-fill",
|
|
1223
|
+
style: { width: `${s}%` }
|
|
1224
|
+
})
|
|
1225
|
+
}), n !== void 0 && /* @__PURE__ */ d("span", {
|
|
1226
|
+
className: "sg-progress-label",
|
|
1227
|
+
children: n
|
|
1228
|
+
})]
|
|
1229
|
+
});
|
|
1230
|
+
}, _e = ({ kind: e = "info", boxed: t = !1, children: n, className: r }) => {
|
|
1231
|
+
let { t: i } = m("sg", { i18n: L });
|
|
1232
|
+
return /* @__PURE__ */ f("p", {
|
|
1233
|
+
className: [
|
|
1234
|
+
"sg-status",
|
|
1235
|
+
`sg-status--${e}`,
|
|
1236
|
+
t ? "sg-status--boxed" : "",
|
|
1237
|
+
r
|
|
1238
|
+
].filter(Boolean).join(" "),
|
|
1239
|
+
role: e === "error" ? "alert" : e === "loading" ? "status" : void 0,
|
|
1240
|
+
children: [e === "loading" && /* @__PURE__ */ d("span", {
|
|
1241
|
+
className: "sg-status-spinner",
|
|
1242
|
+
"aria-hidden": "true"
|
|
1243
|
+
}), n ?? (e === "loading" ? i("status.loading") : null)]
|
|
1244
|
+
});
|
|
1245
|
+
}, ve = ({ header: e, actions: t, children: r, variant: i = "default", interactive: a = !1, as: o = "div", href: s, className: c }) => n(o, {
|
|
1246
|
+
className: [
|
|
1247
|
+
"sg-card",
|
|
1248
|
+
`sg-card--${i}`,
|
|
1249
|
+
a ? "sg-card--interactive" : "",
|
|
1250
|
+
c
|
|
1251
|
+
].filter(Boolean).join(" "),
|
|
1252
|
+
href: s
|
|
1253
|
+
}, e && /* @__PURE__ */ d("div", {
|
|
1254
|
+
className: "sg-card-header",
|
|
1255
|
+
children: e
|
|
1256
|
+
}), r, t && /* @__PURE__ */ d("div", {
|
|
1257
|
+
className: "sg-card-actions",
|
|
1258
|
+
children: t
|
|
1259
|
+
})), ye = ({ children: e, tone: t = "neutral", onClick: n, selected: r = !1, onRemove: i, removeLabel: a, className: o }) => {
|
|
1260
|
+
let { t: s } = m("sg", { i18n: L });
|
|
1261
|
+
return /* @__PURE__ */ f("span", {
|
|
1262
|
+
className: [
|
|
1263
|
+
"sg-badge",
|
|
1264
|
+
`sg-badge--${t}`,
|
|
1265
|
+
r ? "sg-badge--selected" : "",
|
|
1266
|
+
o
|
|
1267
|
+
].filter(Boolean).join(" "),
|
|
1268
|
+
children: [n ? /* @__PURE__ */ d("button", {
|
|
1269
|
+
type: "button",
|
|
1270
|
+
className: "sg-badge-toggle",
|
|
1271
|
+
"aria-pressed": r,
|
|
1272
|
+
onClick: n,
|
|
1273
|
+
children: e
|
|
1274
|
+
}) : e, i && /* @__PURE__ */ d("button", {
|
|
1275
|
+
type: "button",
|
|
1276
|
+
className: "sg-badge-remove",
|
|
1277
|
+
"aria-label": a ?? s("badge.remove"),
|
|
1278
|
+
onClick: i,
|
|
1279
|
+
children: "×"
|
|
1280
|
+
})]
|
|
1281
|
+
});
|
|
1282
|
+
}, $ = ({ open: e, title: t, children: n, onConfirm: r, onCancel: i, confirmLabel: a, cancelLabel: o, danger: s = !1, icon: c }) => {
|
|
1283
|
+
let { t: l } = m("sg", { i18n: L });
|
|
1284
|
+
return /* @__PURE__ */ d(K, {
|
|
1285
|
+
open: e,
|
|
1286
|
+
onClose: i,
|
|
1287
|
+
title: t,
|
|
1288
|
+
icon: c,
|
|
1289
|
+
footer: /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(v, {
|
|
1290
|
+
variant: "secondary",
|
|
1291
|
+
label: o ?? l("confirm.cancel"),
|
|
1292
|
+
onClick: i
|
|
1293
|
+
}), /* @__PURE__ */ d(v, {
|
|
1294
|
+
variant: s ? "danger" : "primary",
|
|
1295
|
+
label: a ?? l("confirm.confirm"),
|
|
1296
|
+
onClick: r,
|
|
1297
|
+
autoFocus: !0
|
|
1298
|
+
})] }),
|
|
1299
|
+
children: n && /* @__PURE__ */ d("div", {
|
|
1300
|
+
className: "sg-confirm-message",
|
|
1301
|
+
children: n
|
|
1302
|
+
})
|
|
1303
|
+
});
|
|
1304
|
+
}, be = ({ invalid: e, className: t, rows: n = 3, ...r }) => /* @__PURE__ */ d("textarea", {
|
|
1305
|
+
rows: n,
|
|
1306
|
+
className: [
|
|
1307
|
+
"input-field",
|
|
1308
|
+
"sg-textarea",
|
|
1309
|
+
e ? "input-field--invalid" : "",
|
|
1310
|
+
t
|
|
1311
|
+
].filter(Boolean).join(" "),
|
|
1312
|
+
...r
|
|
1313
|
+
}), xe = ({ invalid: e, className: t, children: n, ...r }) => /* @__PURE__ */ d("select", {
|
|
1314
|
+
className: [
|
|
1315
|
+
"input-field",
|
|
1316
|
+
"sg-select",
|
|
1317
|
+
e ? "input-field--invalid" : "",
|
|
1318
|
+
t
|
|
1319
|
+
].filter(Boolean).join(" "),
|
|
1320
|
+
...r,
|
|
1321
|
+
children: n
|
|
1322
|
+
}), Se = ({ label: e, children: n, hint: r, error: a, className: s }) => {
|
|
1323
|
+
let c = o(), l = i(n) ? n : null, u = l?.props.id ?? c, p = `${u}-note`, m = a ?? r;
|
|
1324
|
+
return /* @__PURE__ */ f("div", {
|
|
1325
|
+
className: ["sg-field", s].filter(Boolean).join(" "),
|
|
1326
|
+
children: [
|
|
1327
|
+
/* @__PURE__ */ d("label", {
|
|
1328
|
+
className: "input-label",
|
|
1329
|
+
htmlFor: u,
|
|
1330
|
+
children: e
|
|
1331
|
+
}),
|
|
1332
|
+
l ? t(l, {
|
|
1333
|
+
id: u,
|
|
1334
|
+
"aria-describedby": m ? p : l.props["aria-describedby"],
|
|
1335
|
+
...a ? { "aria-invalid": !0 } : {},
|
|
1336
|
+
...a && typeof l.type != "string" ? { invalid: !0 } : {}
|
|
1337
|
+
}) : n,
|
|
1338
|
+
m && /* @__PURE__ */ d("p", {
|
|
1339
|
+
id: p,
|
|
1340
|
+
className: a ? "sg-field-error" : "sg-field-hint",
|
|
1341
|
+
children: m
|
|
1342
|
+
})
|
|
1343
|
+
]
|
|
1344
|
+
});
|
|
1345
|
+
}, Ce = ({ items: e, value: t, onChange: n, variant: r = "underline", ariaLabel: i, className: a }) => {
|
|
1346
|
+
let o = c(null);
|
|
1347
|
+
return /* @__PURE__ */ d("div", {
|
|
1348
|
+
ref: o,
|
|
1349
|
+
role: "tablist",
|
|
1350
|
+
"aria-label": i,
|
|
1351
|
+
className: [
|
|
1352
|
+
"sg-tabs",
|
|
1353
|
+
`sg-tabs--${r}`,
|
|
1354
|
+
a
|
|
1355
|
+
].filter(Boolean).join(" "),
|
|
1356
|
+
onKeyDown: (r) => {
|
|
1357
|
+
let i = e.filter((e) => !e.disabled), a = i.findIndex((e) => e.value === t), s = r.key === "ArrowRight" ? i[(a + 1) % i.length] : r.key === "ArrowLeft" ? i[(a - 1 + i.length) % i.length] : r.key === "Home" ? i[0] : r.key === "End" ? i[i.length - 1] : null;
|
|
1358
|
+
s && (r.preventDefault(), n(s.value), o.current?.querySelector(`[data-value="${String(s.value)}"]`)?.focus());
|
|
1359
|
+
},
|
|
1360
|
+
children: e.map((e) => {
|
|
1361
|
+
let r = e.value === t;
|
|
1362
|
+
return /* @__PURE__ */ d("button", {
|
|
1363
|
+
type: "button",
|
|
1364
|
+
role: "tab",
|
|
1365
|
+
"data-value": String(e.value),
|
|
1366
|
+
"aria-selected": r,
|
|
1367
|
+
tabIndex: r ? 0 : -1,
|
|
1368
|
+
disabled: e.disabled,
|
|
1369
|
+
className: r ? "sg-tab sg-tab--active" : "sg-tab",
|
|
1370
|
+
onClick: () => n(e.value),
|
|
1371
|
+
children: e.label
|
|
1372
|
+
}, e.value);
|
|
1373
|
+
})
|
|
1374
|
+
});
|
|
1150
1375
|
};
|
|
1151
1376
|
//#endregion
|
|
1152
|
-
export { Y as AVATAR_CHANGE_EVENT, B as AppAccessGate, H as AppLauncher,
|
|
1377
|
+
export { Y as AVATAR_CHANGE_EVENT, B as AppAccessGate, H as AppLauncher, W as Authenticator, U as Avatar, ye as Badge, v as Button, ve as Card, fe as ColorPicker, $ as ConfirmModal, w as CookieConsent, V as DEFAULT_APPS_URL, R as DEFAULT_HEIMDALL_URL, pe as FontPicker, y as Footer, Se as FormField, D as Header, _ as Icon, q as Input, N as LANGUAGE_COOKIE, M as LANGUAGE_NAMES, he as LanguageSwitcher, K as Modal, J as PasswordInput, ge as ProgressBar, Z as QuadratoHeader, E as SGFooter, O as SGHeader, j as SUPPORTED_LANGUAGES, xe as Select, de as SetPasswordModal, _e as StatusMessage, Ce as Tabs, be as Textarea, me as Toggle, ae as createI18n, I as readLanguageCookie, L as sgI18n };
|