@conatel-sa/react-ui 0.2.3 → 0.2.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/README.md +42 -23
- package/dist/cards.d.ts +37 -0
- package/dist/cards.mjs +299 -0
- package/dist/cards.umd.js +346 -0
- package/dist/dialogs.d.ts +25 -0
- package/dist/dialogs.mjs +194 -0
- package/dist/dialogs.umd.js +246 -0
- package/dist/forms.d.ts +104 -0
- package/dist/forms.mjs +585 -0
- package/dist/forms.umd.js +626 -0
- package/dist/icons.d.ts +50 -0
- package/dist/icons.mjs +149 -0
- package/dist/icons.umd.js +187 -0
- package/dist/index.css +214 -0
- package/dist/index.mjs +73 -1
- package/dist/material-symbols.css +20 -0
- package/dist/metrics.d.ts +19 -0
- package/dist/metrics.mjs +94 -0
- package/dist/metrics.umd.js +143 -0
- package/dist/status.d.ts +16 -0
- package/dist/status.mjs +117 -0
- package/dist/status.umd.js +166 -0
- package/package.json +42 -4
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var ReactLibraryCards = (() => {
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/cards-entry.ts
|
|
22
|
+
var cards_entry_exports = {};
|
|
23
|
+
__export(cards_entry_exports, {
|
|
24
|
+
ArtifactReportCard: () => ArtifactReportCard,
|
|
25
|
+
ChangelogPanel: () => ChangelogPanel,
|
|
26
|
+
FeatureCard: () => FeatureCard,
|
|
27
|
+
ServiceCard: () => ServiceCard
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// tools/react-shim.mjs
|
|
31
|
+
var R = typeof window !== "undefined" && window.React ? window.React : {};
|
|
32
|
+
var react_shim_default = R;
|
|
33
|
+
var {
|
|
34
|
+
useContext,
|
|
35
|
+
useEffect,
|
|
36
|
+
useLayoutEffect,
|
|
37
|
+
useMemo,
|
|
38
|
+
useState,
|
|
39
|
+
useRef,
|
|
40
|
+
useCallback,
|
|
41
|
+
useId,
|
|
42
|
+
createContext,
|
|
43
|
+
Fragment
|
|
44
|
+
} = R;
|
|
45
|
+
|
|
46
|
+
// tools/jsx-runtime-shim.mjs
|
|
47
|
+
function jsx(type, props, key) {
|
|
48
|
+
const p = key != null ? { ...props, key } : props;
|
|
49
|
+
return react_shim_default.createElement(type, p);
|
|
50
|
+
}
|
|
51
|
+
function jsxs(type, props, key) {
|
|
52
|
+
return jsx(type, props, key);
|
|
53
|
+
}
|
|
54
|
+
var Fragment2 = react_shim_default.Fragment;
|
|
55
|
+
|
|
56
|
+
// src/components/cards/ServiceCard.tsx
|
|
57
|
+
function statusStyles(status) {
|
|
58
|
+
switch (status) {
|
|
59
|
+
case "active":
|
|
60
|
+
return {
|
|
61
|
+
bg: "var(--color-success-light, rgba(16, 185, 129, 0.1))",
|
|
62
|
+
fg: "var(--color-success, #10b981)",
|
|
63
|
+
label: "OK"
|
|
64
|
+
};
|
|
65
|
+
case "degraded":
|
|
66
|
+
return {
|
|
67
|
+
bg: "var(--color-warning-light, rgba(245, 158, 11, 0.12))",
|
|
68
|
+
fg: "var(--color-warning, #f59e0b)",
|
|
69
|
+
label: "WARN"
|
|
70
|
+
};
|
|
71
|
+
case "error":
|
|
72
|
+
return {
|
|
73
|
+
bg: "var(--color-error-light, rgba(204, 3, 46, 0.12))",
|
|
74
|
+
fg: "var(--color-error, #CC032E)",
|
|
75
|
+
label: "ERROR"
|
|
76
|
+
};
|
|
77
|
+
case "info":
|
|
78
|
+
return {
|
|
79
|
+
bg: "var(--color-info-light, rgba(37, 99, 235, 0.12))",
|
|
80
|
+
fg: "var(--color-info, #2563eb)",
|
|
81
|
+
label: "INFO"
|
|
82
|
+
};
|
|
83
|
+
default:
|
|
84
|
+
return {
|
|
85
|
+
bg: "var(--color-neutral-100, #f5f5f5)",
|
|
86
|
+
fg: "var(--color-text-muted, #6b6b6b)",
|
|
87
|
+
label: "INFO"
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function ServiceCard({
|
|
92
|
+
icon,
|
|
93
|
+
title,
|
|
94
|
+
description,
|
|
95
|
+
status,
|
|
96
|
+
count,
|
|
97
|
+
onClick
|
|
98
|
+
}) {
|
|
99
|
+
const st = statusStyles(status);
|
|
100
|
+
return /* @__PURE__ */ jsxs(
|
|
101
|
+
"div",
|
|
102
|
+
{
|
|
103
|
+
role: onClick ? "button" : void 0,
|
|
104
|
+
tabIndex: onClick ? 0 : void 0,
|
|
105
|
+
onClick,
|
|
106
|
+
onKeyDown: (e) => {
|
|
107
|
+
if (!onClick) return;
|
|
108
|
+
if (e.key === "Enter" || e.key === " ") onClick();
|
|
109
|
+
},
|
|
110
|
+
style: {
|
|
111
|
+
border: "1.5px solid var(--color-border, #e0e0e0)",
|
|
112
|
+
borderRadius: "var(--radius-lg, 8px)",
|
|
113
|
+
background: "var(--color-surface, #ffffff)",
|
|
114
|
+
boxShadow: "var(--shadow-sm, 0 1px 3px rgba(0,0,0,.1))",
|
|
115
|
+
padding: "var(--space-4, 16px)",
|
|
116
|
+
cursor: onClick ? "pointer" : "default"
|
|
117
|
+
},
|
|
118
|
+
children: [
|
|
119
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: "var(--space-3, 12px)" }, children: [
|
|
120
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: "var(--space-3, 12px)", flex: 1, minWidth: 0 }, children: [
|
|
121
|
+
icon ? /* @__PURE__ */ jsx(
|
|
122
|
+
"span",
|
|
123
|
+
{
|
|
124
|
+
className: "material-symbols-outlined",
|
|
125
|
+
style: { fontSize: "1.5rem", color: "var(--color-primary, #CC032E)", marginTop: "2px" },
|
|
126
|
+
"aria-hidden": "true",
|
|
127
|
+
children: icon
|
|
128
|
+
}
|
|
129
|
+
) : null,
|
|
130
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "var(--space-1, .25rem)", minWidth: 0 }, children: [
|
|
131
|
+
/* @__PURE__ */ jsx(
|
|
132
|
+
"div",
|
|
133
|
+
{
|
|
134
|
+
style: {
|
|
135
|
+
fontFamily: "var(--font-sans, system-ui)",
|
|
136
|
+
fontSize: "var(--text-base, 15px)",
|
|
137
|
+
fontWeight: "var(--weight-semibold, 600)",
|
|
138
|
+
color: "var(--color-text, #1a1a1a)",
|
|
139
|
+
whiteSpace: "nowrap",
|
|
140
|
+
overflow: "hidden",
|
|
141
|
+
textOverflow: "ellipsis"
|
|
142
|
+
},
|
|
143
|
+
children: title
|
|
144
|
+
}
|
|
145
|
+
),
|
|
146
|
+
description ? /* @__PURE__ */ jsx("div", { style: { fontFamily: "var(--font-sans, system-ui)", fontSize: "var(--text-sm, 13px)", color: "var(--color-text-muted, #757578)", lineHeight: 1.3 }, children: description }) : null
|
|
147
|
+
] })
|
|
148
|
+
] }),
|
|
149
|
+
count != null ? /* @__PURE__ */ jsx(
|
|
150
|
+
"div",
|
|
151
|
+
{
|
|
152
|
+
style: {
|
|
153
|
+
minWidth: "3rem",
|
|
154
|
+
textAlign: "right",
|
|
155
|
+
fontFamily: "var(--font-sans, system-ui)",
|
|
156
|
+
fontSize: "var(--text-sm, 13px)",
|
|
157
|
+
color: "var(--color-text-muted, #757578)",
|
|
158
|
+
fontWeight: "var(--weight-medium, 500)"
|
|
159
|
+
},
|
|
160
|
+
children: count
|
|
161
|
+
}
|
|
162
|
+
) : null
|
|
163
|
+
] }),
|
|
164
|
+
status ? /* @__PURE__ */ jsx("div", { style: { marginTop: "var(--space-3, 12px)" }, children: /* @__PURE__ */ jsx(
|
|
165
|
+
"span",
|
|
166
|
+
{
|
|
167
|
+
style: {
|
|
168
|
+
display: "inline-flex",
|
|
169
|
+
alignItems: "center",
|
|
170
|
+
gap: "var(--space-2, 8px)",
|
|
171
|
+
padding: "var(--space-1, .25rem) var(--space-2, 8px)",
|
|
172
|
+
borderRadius: "var(--radius-full, 9999px)",
|
|
173
|
+
background: st.bg,
|
|
174
|
+
color: st.fg,
|
|
175
|
+
fontFamily: "var(--font-sans, system-ui)",
|
|
176
|
+
fontSize: "var(--text-sm, 13px)",
|
|
177
|
+
fontWeight: "var(--weight-medium, 500)",
|
|
178
|
+
whiteSpace: "nowrap"
|
|
179
|
+
},
|
|
180
|
+
children: st.label
|
|
181
|
+
}
|
|
182
|
+
) }) : null
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// src/components/cards/FeatureCard.tsx
|
|
189
|
+
var baseCardStyle = {
|
|
190
|
+
position: "relative",
|
|
191
|
+
display: "block",
|
|
192
|
+
border: "1.5px solid var(--color-border, #e0e0e0)",
|
|
193
|
+
borderRadius: "var(--radius-lg, 12px)",
|
|
194
|
+
background: "var(--color-surface, #ffffff)",
|
|
195
|
+
boxShadow: "var(--shadow-sm, 0 1px 3px rgba(0,0,0,.08))",
|
|
196
|
+
padding: "var(--space-4, 16px)",
|
|
197
|
+
textDecoration: "none",
|
|
198
|
+
color: "inherit",
|
|
199
|
+
fontFamily: "var(--font-sans, system-ui)",
|
|
200
|
+
textAlign: "left",
|
|
201
|
+
cursor: "default",
|
|
202
|
+
boxSizing: "border-box"
|
|
203
|
+
};
|
|
204
|
+
function FeatureCard({
|
|
205
|
+
title,
|
|
206
|
+
description,
|
|
207
|
+
icon,
|
|
208
|
+
corner,
|
|
209
|
+
href,
|
|
210
|
+
onClick,
|
|
211
|
+
children,
|
|
212
|
+
style,
|
|
213
|
+
className
|
|
214
|
+
}) {
|
|
215
|
+
const interactive = Boolean(href || onClick);
|
|
216
|
+
const mergedStyle = {
|
|
217
|
+
...baseCardStyle,
|
|
218
|
+
cursor: interactive ? "pointer" : "default",
|
|
219
|
+
...style
|
|
220
|
+
};
|
|
221
|
+
const inner = /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
222
|
+
corner ? /* @__PURE__ */ jsx(
|
|
223
|
+
"div",
|
|
224
|
+
{
|
|
225
|
+
style: {
|
|
226
|
+
position: "absolute",
|
|
227
|
+
top: "0.75rem",
|
|
228
|
+
right: "0.75rem",
|
|
229
|
+
display: "flex",
|
|
230
|
+
alignItems: "center",
|
|
231
|
+
gap: "0.25rem",
|
|
232
|
+
fontSize: "0.75rem",
|
|
233
|
+
color: "var(--color-text-muted, #757578)"
|
|
234
|
+
},
|
|
235
|
+
children: corner
|
|
236
|
+
}
|
|
237
|
+
) : null,
|
|
238
|
+
icon ? /* @__PURE__ */ jsx("div", { style: { marginBottom: "var(--space-3, 12px)" }, children: /* @__PURE__ */ jsx("span", { className: "material-symbols-outlined", style: { fontSize: "2rem", color: "var(--color-primary, #2563eb)" }, "aria-hidden": true, children: icon }) }) : null,
|
|
239
|
+
/* @__PURE__ */ jsx("div", { style: { fontWeight: 700, fontSize: "var(--text-base, 15px)", color: "var(--color-text, #1a1a1a)", marginBottom: "var(--space-2, 8px)" }, children: title }),
|
|
240
|
+
description ? /* @__PURE__ */ jsx("div", { style: { fontSize: "var(--text-sm, 13px)", color: "var(--color-text-muted, #757578)", lineHeight: 1.45 }, children: description }) : null,
|
|
241
|
+
children
|
|
242
|
+
] });
|
|
243
|
+
if (href) {
|
|
244
|
+
return /* @__PURE__ */ jsx("a", { href, className, style: mergedStyle, children: inner });
|
|
245
|
+
}
|
|
246
|
+
if (onClick) {
|
|
247
|
+
return /* @__PURE__ */ jsx("button", { type: "button", className, style: mergedStyle, onClick, children: inner });
|
|
248
|
+
}
|
|
249
|
+
return /* @__PURE__ */ jsx("div", { className, style: mergedStyle, children: inner });
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// src/components/cards/ChangelogPanel.tsx
|
|
253
|
+
function ChangelogPanel({ version, items }) {
|
|
254
|
+
return /* @__PURE__ */ jsxs(
|
|
255
|
+
"div",
|
|
256
|
+
{
|
|
257
|
+
style: {
|
|
258
|
+
border: "1.5px solid var(--color-border, #e0e0e0)",
|
|
259
|
+
borderRadius: "var(--radius-lg, 8px)",
|
|
260
|
+
background: "var(--color-surface, #ffffff)",
|
|
261
|
+
boxShadow: "var(--shadow-sm, 0 1px 3px rgba(0,0,0,.1))",
|
|
262
|
+
padding: "var(--space-4, 16px)"
|
|
263
|
+
},
|
|
264
|
+
children: [
|
|
265
|
+
/* @__PURE__ */ jsx("div", { style: { fontFamily: "var(--font-sans, system-ui)", fontWeight: "var(--weight-semibold, 600)", color: "var(--color-text, #1a1a1a)", fontSize: "var(--text-base, 15px)" }, children: version ? `Changelog ${version}` : "Changelog" }),
|
|
266
|
+
/* @__PURE__ */ jsx("div", { style: { marginTop: "var(--space-3, 12px)", display: "flex", flexDirection: "column", gap: "var(--space-3, 12px)" }, children: items.map((it, idx) => /* @__PURE__ */ jsxs("div", { children: [
|
|
267
|
+
/* @__PURE__ */ jsx("div", { style: { fontFamily: "var(--font-sans, system-ui)", fontWeight: "var(--weight-semibold, 600)", color: "var(--color-text, #1a1a1a)", fontSize: "var(--text-sm, 13px)" }, children: it.title }),
|
|
268
|
+
/* @__PURE__ */ jsx("div", { style: { fontFamily: "var(--font-sans, system-ui)", color: "var(--color-text-muted, #757578)", fontSize: "var(--text-sm, 13px)", lineHeight: 1.4, marginTop: "var(--space-1, .25rem)" }, children: it.content })
|
|
269
|
+
] }, idx)) })
|
|
270
|
+
]
|
|
271
|
+
}
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// src/components/cards/ArtifactReportCard.tsx
|
|
276
|
+
function variantToColors(variant) {
|
|
277
|
+
switch (variant) {
|
|
278
|
+
case "success":
|
|
279
|
+
return { fg: "var(--color-success, #10b981)", bg: "var(--color-success, #10b981)" };
|
|
280
|
+
case "warning":
|
|
281
|
+
return { fg: "var(--color-warning, #f59e0b)", bg: "var(--color-warning, #f59e0b)" };
|
|
282
|
+
case "error":
|
|
283
|
+
return { fg: "var(--color-error, #CC032E)", bg: "var(--color-error, #CC032E)" };
|
|
284
|
+
case "info":
|
|
285
|
+
return { fg: "var(--color-info, #2563eb)", bg: "var(--color-info, #2563eb)" };
|
|
286
|
+
case "primary":
|
|
287
|
+
default:
|
|
288
|
+
return { fg: "var(--color-primary, var(--color-brand, #CC032E))", bg: "var(--color-primary, var(--color-brand, #CC032E))" };
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
function ArtifactReportCard({ title, stats }) {
|
|
292
|
+
const max = Math.max(1, ...stats.map((s) => typeof s.value === "number" ? s.value : 0));
|
|
293
|
+
return /* @__PURE__ */ jsxs(
|
|
294
|
+
"div",
|
|
295
|
+
{
|
|
296
|
+
style: {
|
|
297
|
+
border: "1.5px solid var(--color-border, #e0e0e0)",
|
|
298
|
+
borderRadius: "var(--radius-lg, 8px)",
|
|
299
|
+
background: "var(--color-surface, #ffffff)",
|
|
300
|
+
boxShadow: "var(--shadow-sm, 0 1px 3px rgba(0,0,0,.1))",
|
|
301
|
+
padding: "var(--space-4, 16px)"
|
|
302
|
+
},
|
|
303
|
+
children: [
|
|
304
|
+
title ? /* @__PURE__ */ jsx("div", { style: { fontFamily: "var(--font-sans, system-ui)", fontWeight: "var(--weight-semibold, 600)", color: "var(--color-text, #1a1a1a)", fontSize: "var(--text-base, 15px)" }, children: title }) : null,
|
|
305
|
+
/* @__PURE__ */ jsx("div", { style: { marginTop: "var(--space-3, 12px)", display: "flex", flexDirection: "column", gap: "var(--space-3, 12px)" }, children: stats.map((s, idx) => {
|
|
306
|
+
const colors = variantToColors(s.variant);
|
|
307
|
+
const ratio = Math.max(0, Math.min(1, s.value / max));
|
|
308
|
+
return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "var(--space-2, 8px)" }, children: [
|
|
309
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "space-between", gap: "var(--space-2, 8px)" }, children: [
|
|
310
|
+
/* @__PURE__ */ jsx("div", { style: { fontFamily: "var(--font-sans, system-ui)", color: "var(--color-text-muted, #757578)", fontSize: "var(--text-sm, 13px)", fontWeight: "var(--weight-medium, 500)" }, children: s.label }),
|
|
311
|
+
/* @__PURE__ */ jsx("div", { style: { fontFamily: "var(--font-sans, system-ui)", color: colors.fg, fontSize: "var(--text-sm, 13px)", fontWeight: "var(--weight-semibold, 600)" }, children: s.value })
|
|
312
|
+
] }),
|
|
313
|
+
/* @__PURE__ */ jsx(
|
|
314
|
+
"div",
|
|
315
|
+
{
|
|
316
|
+
style: {
|
|
317
|
+
width: "100%",
|
|
318
|
+
height: "10px",
|
|
319
|
+
borderRadius: "var(--radius-full, 9999px)",
|
|
320
|
+
background: "var(--color-neutral-200, rgba(0,0,0,.08))",
|
|
321
|
+
overflow: "hidden"
|
|
322
|
+
},
|
|
323
|
+
"aria-hidden": "true",
|
|
324
|
+
children: /* @__PURE__ */ jsx(
|
|
325
|
+
"div",
|
|
326
|
+
{
|
|
327
|
+
style: {
|
|
328
|
+
width: `${Math.round(ratio * 100)}%`,
|
|
329
|
+
height: "100%",
|
|
330
|
+
background: colors.bg,
|
|
331
|
+
borderRadius: "inherit",
|
|
332
|
+
transition: "width var(--duration-base, .15s) var(--ease-out, ease) "
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
)
|
|
336
|
+
}
|
|
337
|
+
),
|
|
338
|
+
s.footer ? /* @__PURE__ */ jsx("div", { style: { fontFamily: "var(--font-sans, system-ui)", color: "var(--color-text-muted, #757578)", fontSize: "var(--text-sm, 13px)", lineHeight: 1.35 }, children: s.footer }) : null
|
|
339
|
+
] }, idx);
|
|
340
|
+
}) })
|
|
341
|
+
]
|
|
342
|
+
}
|
|
343
|
+
);
|
|
344
|
+
}
|
|
345
|
+
return __toCommonJS(cards_entry_exports);
|
|
346
|
+
})();
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export type ChangelogDialogSection = {
|
|
4
|
+
type: string;
|
|
5
|
+
label: string;
|
|
6
|
+
emoji: string;
|
|
7
|
+
items: string[];
|
|
8
|
+
};
|
|
9
|
+
export type ChangelogDialogVersion = {
|
|
10
|
+
version: string;
|
|
11
|
+
date: string;
|
|
12
|
+
sections: ChangelogDialogSection[];
|
|
13
|
+
};
|
|
14
|
+
export type ChangelogDialogData = {
|
|
15
|
+
current_version?: string;
|
|
16
|
+
versions: ChangelogDialogVersion[];
|
|
17
|
+
};
|
|
18
|
+
export type ChangelogDialogProps = {
|
|
19
|
+
isOpen: boolean;
|
|
20
|
+
onClose: () => void;
|
|
21
|
+
data: ChangelogDialogData | null;
|
|
22
|
+
title?: ReactNode;
|
|
23
|
+
confirmLabel?: string;
|
|
24
|
+
};
|
|
25
|
+
export declare function ChangelogDialog(props: ChangelogDialogProps): JSX.Element | null;
|
package/dist/dialogs.mjs
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
// src/components/dialogs/ChangelogDialog.tsx
|
|
2
|
+
import { useEffect, useLayoutEffect, useState } from "react";
|
|
3
|
+
import { createPortal } from "react-dom";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
function readActiveTheme() {
|
|
6
|
+
if (typeof document === "undefined") return "conatel";
|
|
7
|
+
const el = document.querySelector("[data-theme]");
|
|
8
|
+
const t = el?.getAttribute("data-theme");
|
|
9
|
+
return t === "vivion" ? "vivion" : "conatel";
|
|
10
|
+
}
|
|
11
|
+
function formatDate(dateStr) {
|
|
12
|
+
try {
|
|
13
|
+
const [year, month, day] = dateStr.split("-").map(Number);
|
|
14
|
+
const date = new Date(year, month - 1, day);
|
|
15
|
+
return date.toLocaleDateString("es-AR", { day: "numeric", month: "short", year: "numeric" });
|
|
16
|
+
} catch {
|
|
17
|
+
return dateStr;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function ChangelogDialog({
|
|
21
|
+
isOpen,
|
|
22
|
+
onClose,
|
|
23
|
+
data,
|
|
24
|
+
title = "Novedades",
|
|
25
|
+
confirmLabel = "Entendido"
|
|
26
|
+
}) {
|
|
27
|
+
const [mounted, setMounted] = useState(false);
|
|
28
|
+
const [theme, setTheme] = useState("conatel");
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
setMounted(true);
|
|
31
|
+
}, []);
|
|
32
|
+
useLayoutEffect(() => {
|
|
33
|
+
if (!isOpen) return;
|
|
34
|
+
setTheme(readActiveTheme());
|
|
35
|
+
}, [isOpen]);
|
|
36
|
+
if (!isOpen || !data || !mounted) return null;
|
|
37
|
+
const overlay = /* @__PURE__ */ jsx(
|
|
38
|
+
"div",
|
|
39
|
+
{
|
|
40
|
+
className: `theme-${theme}`,
|
|
41
|
+
"data-theme": theme,
|
|
42
|
+
style: {
|
|
43
|
+
position: "fixed",
|
|
44
|
+
inset: 0,
|
|
45
|
+
zIndex: 1e3,
|
|
46
|
+
display: "flex",
|
|
47
|
+
alignItems: "center",
|
|
48
|
+
justifyContent: "center",
|
|
49
|
+
background: "rgba(0,0,0,0.45)",
|
|
50
|
+
padding: "1rem",
|
|
51
|
+
fontFamily: "var(--font-sans, system-ui)",
|
|
52
|
+
colorScheme: "light"
|
|
53
|
+
},
|
|
54
|
+
onClick: (e) => {
|
|
55
|
+
if (e.target === e.currentTarget) onClose();
|
|
56
|
+
},
|
|
57
|
+
role: "presentation",
|
|
58
|
+
children: /* @__PURE__ */ jsxs(
|
|
59
|
+
"div",
|
|
60
|
+
{
|
|
61
|
+
style: {
|
|
62
|
+
background: "var(--color-surface, #ffffff)",
|
|
63
|
+
border: "1px solid var(--color-border, #e5e7eb)",
|
|
64
|
+
borderRadius: "var(--radius-lg, 12px)",
|
|
65
|
+
boxShadow: "var(--shadow-lg, 0 10px 40px rgba(0,0,0,.12))",
|
|
66
|
+
width: "100%",
|
|
67
|
+
maxWidth: "520px",
|
|
68
|
+
maxHeight: "80vh",
|
|
69
|
+
display: "flex",
|
|
70
|
+
flexDirection: "column",
|
|
71
|
+
overflow: "hidden"
|
|
72
|
+
},
|
|
73
|
+
role: "dialog",
|
|
74
|
+
"aria-modal": "true",
|
|
75
|
+
"aria-labelledby": "changelog-dialog-title",
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ jsxs(
|
|
78
|
+
"div",
|
|
79
|
+
{
|
|
80
|
+
style: {
|
|
81
|
+
display: "flex",
|
|
82
|
+
alignItems: "center",
|
|
83
|
+
justifyContent: "space-between",
|
|
84
|
+
padding: "1rem 1.25rem",
|
|
85
|
+
borderBottom: "1px solid var(--color-border, #e5e7eb)",
|
|
86
|
+
flexShrink: 0
|
|
87
|
+
},
|
|
88
|
+
children: [
|
|
89
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem", minWidth: 0 }, children: [
|
|
90
|
+
/* @__PURE__ */ jsx("span", { className: "material-symbols-outlined", style: { color: "var(--color-primary)", fontSize: "1.25rem" }, "aria-hidden": true, children: "auto_awesome" }),
|
|
91
|
+
/* @__PURE__ */ jsx("span", { id: "changelog-dialog-title", style: { fontWeight: 600, fontSize: "1rem", color: "var(--color-text, #111827)" }, children: title })
|
|
92
|
+
] }),
|
|
93
|
+
/* @__PURE__ */ jsx(
|
|
94
|
+
"button",
|
|
95
|
+
{
|
|
96
|
+
type: "button",
|
|
97
|
+
onClick: onClose,
|
|
98
|
+
style: {
|
|
99
|
+
background: "transparent",
|
|
100
|
+
border: "none",
|
|
101
|
+
cursor: "pointer",
|
|
102
|
+
color: "var(--color-text-muted, #6b7280)",
|
|
103
|
+
display: "flex",
|
|
104
|
+
alignItems: "center",
|
|
105
|
+
padding: "0.25rem",
|
|
106
|
+
borderRadius: "var(--radius-sm, 6px)"
|
|
107
|
+
},
|
|
108
|
+
"aria-label": "Cerrar",
|
|
109
|
+
children: /* @__PURE__ */ jsx("span", { className: "material-symbols-outlined", style: { fontSize: "1.25rem" }, "aria-hidden": true, children: "close" })
|
|
110
|
+
}
|
|
111
|
+
)
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
),
|
|
115
|
+
/* @__PURE__ */ jsx("div", { style: { overflowY: "auto", padding: "1rem 1.25rem", flex: 1 }, children: data.versions.length === 0 ? /* @__PURE__ */ jsx("p", { style: { color: "var(--color-text-muted, #6b7280)", textAlign: "center", margin: "2rem 0" }, children: "No hay novedades disponibles." }) : data.versions.map((ver, idx) => /* @__PURE__ */ jsxs("div", { children: [
|
|
116
|
+
idx > 0 ? /* @__PURE__ */ jsx("div", { style: { height: "1px", background: "var(--color-border, #e5e7eb)", margin: "1.25rem 0" } }) : null,
|
|
117
|
+
/* @__PURE__ */ jsxs("div", { style: { marginBottom: "0.75rem" }, children: [
|
|
118
|
+
/* @__PURE__ */ jsxs("span", { style: { fontWeight: 700, fontSize: "0.95rem", color: "var(--color-text, #111827)" }, children: [
|
|
119
|
+
"v",
|
|
120
|
+
ver.version
|
|
121
|
+
] }),
|
|
122
|
+
/* @__PURE__ */ jsxs("span", { style: { marginLeft: "0.5rem", fontSize: "0.8rem", color: "var(--color-text-muted, #6b7280)" }, children: [
|
|
123
|
+
"\u2014 ",
|
|
124
|
+
formatDate(ver.date)
|
|
125
|
+
] })
|
|
126
|
+
] }),
|
|
127
|
+
/* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: "0.5rem" }, children: ver.sections.map((section) => /* @__PURE__ */ jsxs(
|
|
128
|
+
"div",
|
|
129
|
+
{
|
|
130
|
+
style: {
|
|
131
|
+
background: "var(--color-bg-secondary, #f9fafb)",
|
|
132
|
+
border: "1px solid var(--color-border, #e5e7eb)",
|
|
133
|
+
borderRadius: "var(--radius-md, 8px)",
|
|
134
|
+
padding: "0.625rem 0.875rem"
|
|
135
|
+
},
|
|
136
|
+
children: [
|
|
137
|
+
/* @__PURE__ */ jsxs("div", { style: { fontWeight: 600, fontSize: "0.85rem", color: "var(--color-text, #111827)", marginBottom: "0.375rem" }, children: [
|
|
138
|
+
section.emoji,
|
|
139
|
+
" ",
|
|
140
|
+
section.label
|
|
141
|
+
] }),
|
|
142
|
+
/* @__PURE__ */ jsx("ul", { style: { margin: 0, paddingLeft: "1.1rem", listStyle: "disc" }, children: section.items.map((item, i) => /* @__PURE__ */ jsx("li", { style: { fontSize: "0.83rem", color: "var(--color-text-muted, #4b5563)", lineHeight: 1.5 }, children: item }, i)) })
|
|
143
|
+
]
|
|
144
|
+
},
|
|
145
|
+
section.type
|
|
146
|
+
)) })
|
|
147
|
+
] }, ver.version)) }),
|
|
148
|
+
/* @__PURE__ */ jsx(
|
|
149
|
+
"div",
|
|
150
|
+
{
|
|
151
|
+
style: {
|
|
152
|
+
padding: "0.75rem 1.25rem",
|
|
153
|
+
borderTop: "1px solid var(--color-border, #e5e7eb)",
|
|
154
|
+
display: "flex",
|
|
155
|
+
justifyContent: "center",
|
|
156
|
+
flexShrink: 0
|
|
157
|
+
},
|
|
158
|
+
children: /* @__PURE__ */ jsxs(
|
|
159
|
+
"button",
|
|
160
|
+
{
|
|
161
|
+
type: "button",
|
|
162
|
+
onClick: onClose,
|
|
163
|
+
style: {
|
|
164
|
+
display: "inline-flex",
|
|
165
|
+
alignItems: "center",
|
|
166
|
+
gap: "0.375rem",
|
|
167
|
+
background: "var(--color-primary)",
|
|
168
|
+
color: "#fff",
|
|
169
|
+
border: "none",
|
|
170
|
+
borderRadius: "var(--radius-md, 8px)",
|
|
171
|
+
padding: "0.5rem 1.25rem",
|
|
172
|
+
fontWeight: 600,
|
|
173
|
+
fontSize: "0.875rem",
|
|
174
|
+
cursor: "pointer",
|
|
175
|
+
fontFamily: "inherit"
|
|
176
|
+
},
|
|
177
|
+
children: [
|
|
178
|
+
/* @__PURE__ */ jsx("span", { className: "material-symbols-outlined", style: { fontSize: "1rem" }, "aria-hidden": true, children: "check" }),
|
|
179
|
+
confirmLabel
|
|
180
|
+
]
|
|
181
|
+
}
|
|
182
|
+
)
|
|
183
|
+
}
|
|
184
|
+
)
|
|
185
|
+
]
|
|
186
|
+
}
|
|
187
|
+
)
|
|
188
|
+
}
|
|
189
|
+
);
|
|
190
|
+
return createPortal(overlay, document.body);
|
|
191
|
+
}
|
|
192
|
+
export {
|
|
193
|
+
ChangelogDialog
|
|
194
|
+
};
|