@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
package/dist/index.mjs
CHANGED
|
@@ -653,7 +653,79 @@ function eo({
|
|
|
653
653
|
u,
|
|
654
654
|
{
|
|
655
655
|
className: Ne,
|
|
656
|
-
style: {
|
|
656
|
+
style: {
|
|
657
|
+
colorScheme: "light",
|
|
658
|
+
...(p === "conatel" ? {
|
|
659
|
+
"--font-sans": "Inter, system-ui, -apple-system, sans-serif",
|
|
660
|
+
"--color-brand": "#CC032E",
|
|
661
|
+
"--color-brand-hover": "#a30225",
|
|
662
|
+
"--color-brand-active": "#CC032E",
|
|
663
|
+
"--color-brand-light": "#fdf2f4",
|
|
664
|
+
"--color-accent": "#757578",
|
|
665
|
+
"--color-accent-hover": "#5F6062",
|
|
666
|
+
"--color-accent-light": "#f3f3f3",
|
|
667
|
+
"--color-text": "#2C2C2C",
|
|
668
|
+
"--color-text-muted": "#757578",
|
|
669
|
+
"--color-text-subtle": "#BCC0C3",
|
|
670
|
+
"--color-border": "#BCC0C3",
|
|
671
|
+
"--color-border-strong": "#5F6062",
|
|
672
|
+
"--color-border-focus": "#CC032E",
|
|
673
|
+
"--focus-ring": "0 0 0 3px rgba(204, 3, 46, 0.1)",
|
|
674
|
+
"--radius-md": "8px",
|
|
675
|
+
"--radius-lg": "12px",
|
|
676
|
+
"--shadow-sm": "0 1px 2px 0 rgb(0 0 0 / 0.05)",
|
|
677
|
+
"--shadow-md": "0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05)",
|
|
678
|
+
"--shadow-lg": "0 10px 15px -3px rgb(0 0 0 / 0.05), 0 4px 6px -4px rgb(0 0 0 / 0.05)",
|
|
679
|
+
"--color-bg": "#f4f6f8",
|
|
680
|
+
"--color-bg-alt": "#f8fafc",
|
|
681
|
+
"--color-surface": "#ffffff",
|
|
682
|
+
"--color-surface-raised": "#ffffff",
|
|
683
|
+
"--color-secondary-contrast": "#ffffff",
|
|
684
|
+
"--color-tertiary": "#4F4F50",
|
|
685
|
+
"--color-tertiary-hover": "#383839",
|
|
686
|
+
"--color-success": "#10b981",
|
|
687
|
+
"--color-success-light": "rgba(16, 185, 129, 0.1)",
|
|
688
|
+
"--color-warning": "#f59e0b",
|
|
689
|
+
"--color-warning-light": "rgba(245, 158, 11, 0.1)",
|
|
690
|
+
"--color-error": "#CC032E",
|
|
691
|
+
"--color-error-light": "rgba(204, 3, 46, 0.1)"
|
|
692
|
+
} : p === "vivion" ? {
|
|
693
|
+
"--font-sans": "Inter, system-ui, -apple-system, sans-serif",
|
|
694
|
+
"--color-brand": "#0098D4",
|
|
695
|
+
"--color-brand-hover": "#0098D4",
|
|
696
|
+
"--color-brand-active": "#0098D4",
|
|
697
|
+
"--color-brand-light": "#e5f5fd",
|
|
698
|
+
"--color-accent": "#757578",
|
|
699
|
+
"--color-accent-hover": "#5F6062",
|
|
700
|
+
"--color-accent-light": "#f3f3f3",
|
|
701
|
+
"--color-text": "#2C2C2C",
|
|
702
|
+
"--color-text-muted": "#757578",
|
|
703
|
+
"--color-text-subtle": "#BCC0C3",
|
|
704
|
+
"--color-border": "#BCC0C3",
|
|
705
|
+
"--color-border-strong": "#5F6062",
|
|
706
|
+
"--color-border-focus": "#0098D4",
|
|
707
|
+
"--focus-ring": "0 0 0 3px rgba(0, 152, 212, 0.12)",
|
|
708
|
+
"--radius-md": "8px",
|
|
709
|
+
"--radius-lg": "12px",
|
|
710
|
+
"--shadow-sm": "0 1px 2px 0 rgb(0 0 0 / 0.05)",
|
|
711
|
+
"--shadow-md": "0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05)",
|
|
712
|
+
"--shadow-lg": "0 10px 15px -3px rgb(0 0 0 / 0.05), 0 4px 6px -4px rgb(0 0 0 / 0.05)",
|
|
713
|
+
"--color-bg": "#f4f6f8",
|
|
714
|
+
"--color-bg-alt": "#f8fafc",
|
|
715
|
+
"--color-surface": "#ffffff",
|
|
716
|
+
"--color-surface-raised": "#ffffff",
|
|
717
|
+
"--color-secondary-contrast": "#ffffff",
|
|
718
|
+
"--color-tertiary": "#4F4F50",
|
|
719
|
+
"--color-tertiary-hover": "#383839",
|
|
720
|
+
"--color-success": "#10b981",
|
|
721
|
+
"--color-success-light": "rgba(16, 185, 129, 0.1)",
|
|
722
|
+
"--color-warning": "#f59e0b",
|
|
723
|
+
"--color-warning-light": "rgba(245, 158, 11, 0.1)",
|
|
724
|
+
"--color-error": "#CC032E",
|
|
725
|
+
"--color-error-light": "rgba(204, 3, 46, 0.1)"
|
|
726
|
+
} : {}),
|
|
727
|
+
...c
|
|
728
|
+
},
|
|
657
729
|
"data-theme": p,
|
|
658
730
|
children: o
|
|
659
731
|
},
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Estilos base para Material Symbols Outlined (alineado con patrones de apps que usan
|
|
3
|
+
* la misma familia tipográfica). Importar junto con `dist/index.css` del ThemeProvider.
|
|
4
|
+
*/
|
|
5
|
+
.material-symbols-outlined {
|
|
6
|
+
font-family: 'Material Symbols Outlined', system-ui, -apple-system, sans-serif;
|
|
7
|
+
font-weight: normal;
|
|
8
|
+
font-style: normal;
|
|
9
|
+
font-size: 24px;
|
|
10
|
+
line-height: 1;
|
|
11
|
+
letter-spacing: normal;
|
|
12
|
+
text-transform: none;
|
|
13
|
+
display: inline-block;
|
|
14
|
+
white-space: nowrap;
|
|
15
|
+
word-wrap: normal;
|
|
16
|
+
direction: ltr;
|
|
17
|
+
-webkit-font-feature-settings: 'liga';
|
|
18
|
+
-webkit-font-smoothing: antialiased;
|
|
19
|
+
color: currentColor;
|
|
20
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
|
|
3
|
+
export type StatInlineProps = {
|
|
4
|
+
label: string;
|
|
5
|
+
value: string;
|
|
6
|
+
accentColor?: string;
|
|
7
|
+
style?: CSSProperties;
|
|
8
|
+
};
|
|
9
|
+
export declare function StatInline(props: StatInlineProps): JSX.Element;
|
|
10
|
+
|
|
11
|
+
export type MiniMeterProps = {
|
|
12
|
+
label: string;
|
|
13
|
+
value: number;
|
|
14
|
+
valueText?: string;
|
|
15
|
+
color?: string;
|
|
16
|
+
labelWidth?: string;
|
|
17
|
+
style?: CSSProperties;
|
|
18
|
+
};
|
|
19
|
+
export declare function MiniMeter(props: MiniMeterProps): JSX.Element;
|
package/dist/metrics.mjs
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// src/components/metrics/StatInline.tsx
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
function StatInline({ label, value, accentColor = "var(--color-primary, #2563eb)", style }) {
|
|
4
|
+
const border = `${accentColor}33`;
|
|
5
|
+
return /* @__PURE__ */ jsxs(
|
|
6
|
+
"div",
|
|
7
|
+
{
|
|
8
|
+
style: {
|
|
9
|
+
background: "var(--color-bg-tertiary, #f9fafb)",
|
|
10
|
+
border: `1px solid ${border}`,
|
|
11
|
+
borderRadius: "var(--radius-md, 8px)",
|
|
12
|
+
padding: "var(--space-2, 8px) var(--space-3, 12px)",
|
|
13
|
+
minWidth: "5rem",
|
|
14
|
+
textAlign: "center",
|
|
15
|
+
fontFamily: "var(--font-sans, system-ui)",
|
|
16
|
+
...style
|
|
17
|
+
},
|
|
18
|
+
children: [
|
|
19
|
+
/* @__PURE__ */ jsx("div", { style: { fontSize: "1.1rem", fontWeight: 700, color: accentColor }, children: value }),
|
|
20
|
+
/* @__PURE__ */ jsx("div", { style: { fontSize: "0.7rem", color: "var(--color-text-muted, #6b7280)", marginTop: "0.1rem" }, children: label })
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// src/components/metrics/MiniMeter.tsx
|
|
27
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
28
|
+
function MiniMeter({
|
|
29
|
+
label,
|
|
30
|
+
value,
|
|
31
|
+
valueText,
|
|
32
|
+
color = "var(--color-primary, #2563eb)",
|
|
33
|
+
labelWidth = "120px",
|
|
34
|
+
style
|
|
35
|
+
}) {
|
|
36
|
+
const pct = Math.max(0, Math.min(100, value));
|
|
37
|
+
const right = valueText ?? `${Math.round(pct)}%`;
|
|
38
|
+
return /* @__PURE__ */ jsxs2(
|
|
39
|
+
"div",
|
|
40
|
+
{
|
|
41
|
+
style: {
|
|
42
|
+
display: "grid",
|
|
43
|
+
gridTemplateColumns: `${labelWidth} 1fr 54px`,
|
|
44
|
+
gap: "var(--space-2, 8px)",
|
|
45
|
+
alignItems: "center",
|
|
46
|
+
marginBottom: "0.35rem",
|
|
47
|
+
fontFamily: "var(--font-sans, system-ui)",
|
|
48
|
+
...style
|
|
49
|
+
},
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ jsx2("span", { style: { fontSize: "0.75rem", color: "var(--color-text-muted, #6b7280)", overflow: "hidden", textOverflow: "ellipsis" }, children: label }),
|
|
52
|
+
/* @__PURE__ */ jsx2(
|
|
53
|
+
"div",
|
|
54
|
+
{
|
|
55
|
+
style: {
|
|
56
|
+
height: "0.75rem",
|
|
57
|
+
background: "var(--color-bg-tertiary, #f3f4f6)",
|
|
58
|
+
borderRadius: "9999px",
|
|
59
|
+
overflow: "hidden"
|
|
60
|
+
},
|
|
61
|
+
children: /* @__PURE__ */ jsx2(
|
|
62
|
+
"div",
|
|
63
|
+
{
|
|
64
|
+
style: {
|
|
65
|
+
width: `${pct}%`,
|
|
66
|
+
minWidth: pct > 0 ? "2px" : "0",
|
|
67
|
+
height: "100%",
|
|
68
|
+
background: color,
|
|
69
|
+
borderRadius: "9999px"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
),
|
|
75
|
+
/* @__PURE__ */ jsx2(
|
|
76
|
+
"span",
|
|
77
|
+
{
|
|
78
|
+
style: {
|
|
79
|
+
fontSize: "0.75rem",
|
|
80
|
+
fontWeight: 600,
|
|
81
|
+
color: "var(--color-text, #111827)",
|
|
82
|
+
textAlign: "right"
|
|
83
|
+
},
|
|
84
|
+
children: right
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
export {
|
|
92
|
+
MiniMeter,
|
|
93
|
+
StatInline
|
|
94
|
+
};
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var ReactLibraryMetrics = (() => {
|
|
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/metrics-entry.ts
|
|
22
|
+
var metrics_entry_exports = {};
|
|
23
|
+
__export(metrics_entry_exports, {
|
|
24
|
+
MiniMeter: () => MiniMeter,
|
|
25
|
+
StatInline: () => StatInline
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// tools/react-shim.mjs
|
|
29
|
+
var R = typeof window !== "undefined" && window.React ? window.React : {};
|
|
30
|
+
var react_shim_default = R;
|
|
31
|
+
var {
|
|
32
|
+
useContext,
|
|
33
|
+
useEffect,
|
|
34
|
+
useLayoutEffect,
|
|
35
|
+
useMemo,
|
|
36
|
+
useState,
|
|
37
|
+
useRef,
|
|
38
|
+
useCallback,
|
|
39
|
+
useId,
|
|
40
|
+
createContext,
|
|
41
|
+
Fragment
|
|
42
|
+
} = R;
|
|
43
|
+
|
|
44
|
+
// tools/jsx-runtime-shim.mjs
|
|
45
|
+
function jsx(type, props, key) {
|
|
46
|
+
const p = key != null ? { ...props, key } : props;
|
|
47
|
+
return react_shim_default.createElement(type, p);
|
|
48
|
+
}
|
|
49
|
+
function jsxs(type, props, key) {
|
|
50
|
+
return jsx(type, props, key);
|
|
51
|
+
}
|
|
52
|
+
var Fragment2 = react_shim_default.Fragment;
|
|
53
|
+
|
|
54
|
+
// src/components/metrics/StatInline.tsx
|
|
55
|
+
function StatInline({ label, value, accentColor = "var(--color-primary, #2563eb)", style }) {
|
|
56
|
+
const border = `${accentColor}33`;
|
|
57
|
+
return /* @__PURE__ */ jsxs(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
style: {
|
|
61
|
+
background: "var(--color-bg-tertiary, #f9fafb)",
|
|
62
|
+
border: `1px solid ${border}`,
|
|
63
|
+
borderRadius: "var(--radius-md, 8px)",
|
|
64
|
+
padding: "var(--space-2, 8px) var(--space-3, 12px)",
|
|
65
|
+
minWidth: "5rem",
|
|
66
|
+
textAlign: "center",
|
|
67
|
+
fontFamily: "var(--font-sans, system-ui)",
|
|
68
|
+
...style
|
|
69
|
+
},
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ jsx("div", { style: { fontSize: "1.1rem", fontWeight: 700, color: accentColor }, children: value }),
|
|
72
|
+
/* @__PURE__ */ jsx("div", { style: { fontSize: "0.7rem", color: "var(--color-text-muted, #6b7280)", marginTop: "0.1rem" }, children: label })
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// src/components/metrics/MiniMeter.tsx
|
|
79
|
+
function MiniMeter({
|
|
80
|
+
label,
|
|
81
|
+
value,
|
|
82
|
+
valueText,
|
|
83
|
+
color = "var(--color-primary, #2563eb)",
|
|
84
|
+
labelWidth = "120px",
|
|
85
|
+
style
|
|
86
|
+
}) {
|
|
87
|
+
const pct = Math.max(0, Math.min(100, value));
|
|
88
|
+
const right = valueText ?? `${Math.round(pct)}%`;
|
|
89
|
+
return /* @__PURE__ */ jsxs(
|
|
90
|
+
"div",
|
|
91
|
+
{
|
|
92
|
+
style: {
|
|
93
|
+
display: "grid",
|
|
94
|
+
gridTemplateColumns: `${labelWidth} 1fr 54px`,
|
|
95
|
+
gap: "var(--space-2, 8px)",
|
|
96
|
+
alignItems: "center",
|
|
97
|
+
marginBottom: "0.35rem",
|
|
98
|
+
fontFamily: "var(--font-sans, system-ui)",
|
|
99
|
+
...style
|
|
100
|
+
},
|
|
101
|
+
children: [
|
|
102
|
+
/* @__PURE__ */ jsx("span", { style: { fontSize: "0.75rem", color: "var(--color-text-muted, #6b7280)", overflow: "hidden", textOverflow: "ellipsis" }, children: label }),
|
|
103
|
+
/* @__PURE__ */ jsx(
|
|
104
|
+
"div",
|
|
105
|
+
{
|
|
106
|
+
style: {
|
|
107
|
+
height: "0.75rem",
|
|
108
|
+
background: "var(--color-bg-tertiary, #f3f4f6)",
|
|
109
|
+
borderRadius: "9999px",
|
|
110
|
+
overflow: "hidden"
|
|
111
|
+
},
|
|
112
|
+
children: /* @__PURE__ */ jsx(
|
|
113
|
+
"div",
|
|
114
|
+
{
|
|
115
|
+
style: {
|
|
116
|
+
width: `${pct}%`,
|
|
117
|
+
minWidth: pct > 0 ? "2px" : "0",
|
|
118
|
+
height: "100%",
|
|
119
|
+
background: color,
|
|
120
|
+
borderRadius: "9999px"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
),
|
|
126
|
+
/* @__PURE__ */ jsx(
|
|
127
|
+
"span",
|
|
128
|
+
{
|
|
129
|
+
style: {
|
|
130
|
+
fontSize: "0.75rem",
|
|
131
|
+
fontWeight: 600,
|
|
132
|
+
color: "var(--color-text, #111827)",
|
|
133
|
+
textAlign: "right"
|
|
134
|
+
},
|
|
135
|
+
children: right
|
|
136
|
+
}
|
|
137
|
+
)
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
return __toCommonJS(metrics_entry_exports);
|
|
143
|
+
})();
|
package/dist/status.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
|
|
3
|
+
export type StatusSummaryState = 'ok' | 'warn' | 'error' | 'pending';
|
|
4
|
+
export type StatusSummaryItem = {
|
|
5
|
+
label: string;
|
|
6
|
+
state: StatusSummaryState;
|
|
7
|
+
detail?: string;
|
|
8
|
+
};
|
|
9
|
+
export type StatusSummaryPopoverProps = {
|
|
10
|
+
items: StatusSummaryItem[];
|
|
11
|
+
triggerLabel?: string;
|
|
12
|
+
summaryIcon?: string;
|
|
13
|
+
color?: string;
|
|
14
|
+
style?: CSSProperties;
|
|
15
|
+
};
|
|
16
|
+
export declare function StatusSummaryPopover(props: StatusSummaryPopoverProps): JSX.Element;
|
package/dist/status.mjs
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// src/components/status/StatusSummaryPopover.tsx
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
function stateIcon(state) {
|
|
5
|
+
switch (state) {
|
|
6
|
+
case "ok":
|
|
7
|
+
return "check_circle";
|
|
8
|
+
case "warn":
|
|
9
|
+
return "warning";
|
|
10
|
+
case "error":
|
|
11
|
+
return "error";
|
|
12
|
+
case "pending":
|
|
13
|
+
default:
|
|
14
|
+
return "schedule";
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function stateColor(state) {
|
|
18
|
+
switch (state) {
|
|
19
|
+
case "ok":
|
|
20
|
+
return "var(--color-success, #22c55e)";
|
|
21
|
+
case "warn":
|
|
22
|
+
return "var(--color-warning, #eab308)";
|
|
23
|
+
case "error":
|
|
24
|
+
return "var(--color-error, #ef4444)";
|
|
25
|
+
case "pending":
|
|
26
|
+
default:
|
|
27
|
+
return "var(--color-text-muted, #6b7280)";
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function StatusSummaryPopover({
|
|
31
|
+
items,
|
|
32
|
+
triggerLabel = "Estado de sistemas",
|
|
33
|
+
summaryIcon = "monitoring",
|
|
34
|
+
color,
|
|
35
|
+
style
|
|
36
|
+
}) {
|
|
37
|
+
const [open, setOpen] = useState(false);
|
|
38
|
+
const ref = useRef(null);
|
|
39
|
+
const triggerColor = color ?? (items.some((i) => i.state === "error") ? "var(--color-error, #ef4444)" : items.some((i) => i.state === "warn") ? "var(--color-warning, #eab308)" : items.every((i) => i.state === "ok") ? "var(--color-success, #22c55e)" : "var(--color-text-muted, #6b7280)");
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (!open) return;
|
|
42
|
+
const handle = (e) => {
|
|
43
|
+
if (ref.current && !ref.current.contains(e.target)) setOpen(false);
|
|
44
|
+
};
|
|
45
|
+
document.addEventListener("mousedown", handle);
|
|
46
|
+
return () => document.removeEventListener("mousedown", handle);
|
|
47
|
+
}, [open]);
|
|
48
|
+
return /* @__PURE__ */ jsxs("div", { ref, style: { position: "relative", display: "inline-flex", alignItems: "center", ...style }, children: [
|
|
49
|
+
/* @__PURE__ */ jsx(
|
|
50
|
+
"button",
|
|
51
|
+
{
|
|
52
|
+
type: "button",
|
|
53
|
+
title: triggerLabel,
|
|
54
|
+
"aria-label": triggerLabel,
|
|
55
|
+
"aria-expanded": open,
|
|
56
|
+
onClick: () => setOpen((v) => !v),
|
|
57
|
+
style: {
|
|
58
|
+
display: "inline-flex",
|
|
59
|
+
alignItems: "center",
|
|
60
|
+
padding: "0.25rem",
|
|
61
|
+
marginRight: "0.25rem",
|
|
62
|
+
background: "transparent",
|
|
63
|
+
border: "none",
|
|
64
|
+
color: triggerColor,
|
|
65
|
+
cursor: "pointer",
|
|
66
|
+
borderRadius: "4px"
|
|
67
|
+
},
|
|
68
|
+
children: /* @__PURE__ */ jsx("span", { className: "material-symbols-outlined", style: { fontSize: "1.5rem" }, "aria-hidden": true, children: summaryIcon })
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
open ? /* @__PURE__ */ jsxs(
|
|
72
|
+
"div",
|
|
73
|
+
{
|
|
74
|
+
role: "tooltip",
|
|
75
|
+
style: {
|
|
76
|
+
position: "absolute",
|
|
77
|
+
top: "100%",
|
|
78
|
+
right: 0,
|
|
79
|
+
marginTop: "0.25rem",
|
|
80
|
+
minWidth: "220px",
|
|
81
|
+
maxWidth: "300px",
|
|
82
|
+
padding: "0.75rem",
|
|
83
|
+
zIndex: 1e3,
|
|
84
|
+
background: "var(--color-surface, #ffffff)",
|
|
85
|
+
border: "1px solid var(--color-border, #e5e7eb)",
|
|
86
|
+
borderRadius: "var(--radius-md, 8px)",
|
|
87
|
+
boxShadow: "var(--shadow-md, 0 4px 12px rgba(0,0,0,.1))",
|
|
88
|
+
fontFamily: "var(--font-sans, system-ui)"
|
|
89
|
+
},
|
|
90
|
+
children: [
|
|
91
|
+
/* @__PURE__ */ jsx("div", { style: { fontSize: "0.8rem", color: "var(--color-text-muted, #6b7280)", marginBottom: "0.5rem" }, children: "Resumen" }),
|
|
92
|
+
items.map((row, i) => /* @__PURE__ */ jsxs(
|
|
93
|
+
"div",
|
|
94
|
+
{
|
|
95
|
+
style: {
|
|
96
|
+
display: "flex",
|
|
97
|
+
alignItems: "center",
|
|
98
|
+
gap: "0.5rem",
|
|
99
|
+
fontSize: "0.85rem",
|
|
100
|
+
marginTop: i > 0 ? "0.35rem" : 0
|
|
101
|
+
},
|
|
102
|
+
children: [
|
|
103
|
+
/* @__PURE__ */ jsx("span", { className: "material-symbols-outlined", style: { fontSize: "1rem", color: stateColor(row.state) }, "aria-hidden": true, children: stateIcon(row.state) }),
|
|
104
|
+
/* @__PURE__ */ jsx("span", { style: { flex: 1, minWidth: 0 }, children: row.label }),
|
|
105
|
+
/* @__PURE__ */ jsx("span", { style: { color: "var(--color-text-muted, #6b7280)", whiteSpace: "nowrap", fontSize: "0.8rem" }, children: row.detail ?? "" })
|
|
106
|
+
]
|
|
107
|
+
},
|
|
108
|
+
`${row.label}-${i}`
|
|
109
|
+
))
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
) : null
|
|
113
|
+
] });
|
|
114
|
+
}
|
|
115
|
+
export {
|
|
116
|
+
StatusSummaryPopover
|
|
117
|
+
};
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var ReactLibraryStatus = (() => {
|
|
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/status-entry.ts
|
|
22
|
+
var status_entry_exports = {};
|
|
23
|
+
__export(status_entry_exports, {
|
|
24
|
+
StatusSummaryPopover: () => StatusSummaryPopover
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// tools/react-shim.mjs
|
|
28
|
+
var R = typeof window !== "undefined" && window.React ? window.React : {};
|
|
29
|
+
var react_shim_default = R;
|
|
30
|
+
var {
|
|
31
|
+
useContext,
|
|
32
|
+
useEffect,
|
|
33
|
+
useLayoutEffect,
|
|
34
|
+
useMemo,
|
|
35
|
+
useState,
|
|
36
|
+
useRef,
|
|
37
|
+
useCallback,
|
|
38
|
+
useId,
|
|
39
|
+
createContext,
|
|
40
|
+
Fragment
|
|
41
|
+
} = R;
|
|
42
|
+
|
|
43
|
+
// tools/jsx-runtime-shim.mjs
|
|
44
|
+
function jsx(type, props, key) {
|
|
45
|
+
const p = key != null ? { ...props, key } : props;
|
|
46
|
+
return react_shim_default.createElement(type, p);
|
|
47
|
+
}
|
|
48
|
+
function jsxs(type, props, key) {
|
|
49
|
+
return jsx(type, props, key);
|
|
50
|
+
}
|
|
51
|
+
var Fragment2 = react_shim_default.Fragment;
|
|
52
|
+
|
|
53
|
+
// src/components/status/StatusSummaryPopover.tsx
|
|
54
|
+
function stateIcon(state) {
|
|
55
|
+
switch (state) {
|
|
56
|
+
case "ok":
|
|
57
|
+
return "check_circle";
|
|
58
|
+
case "warn":
|
|
59
|
+
return "warning";
|
|
60
|
+
case "error":
|
|
61
|
+
return "error";
|
|
62
|
+
case "pending":
|
|
63
|
+
default:
|
|
64
|
+
return "schedule";
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function stateColor(state) {
|
|
68
|
+
switch (state) {
|
|
69
|
+
case "ok":
|
|
70
|
+
return "var(--color-success, #22c55e)";
|
|
71
|
+
case "warn":
|
|
72
|
+
return "var(--color-warning, #eab308)";
|
|
73
|
+
case "error":
|
|
74
|
+
return "var(--color-error, #ef4444)";
|
|
75
|
+
case "pending":
|
|
76
|
+
default:
|
|
77
|
+
return "var(--color-text-muted, #6b7280)";
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function StatusSummaryPopover({
|
|
81
|
+
items,
|
|
82
|
+
triggerLabel = "Estado de sistemas",
|
|
83
|
+
summaryIcon = "monitoring",
|
|
84
|
+
color,
|
|
85
|
+
style
|
|
86
|
+
}) {
|
|
87
|
+
const [open, setOpen] = useState(false);
|
|
88
|
+
const ref = useRef(null);
|
|
89
|
+
const triggerColor = color ?? (items.some((i) => i.state === "error") ? "var(--color-error, #ef4444)" : items.some((i) => i.state === "warn") ? "var(--color-warning, #eab308)" : items.every((i) => i.state === "ok") ? "var(--color-success, #22c55e)" : "var(--color-text-muted, #6b7280)");
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
if (!open) return;
|
|
92
|
+
const handle = (e) => {
|
|
93
|
+
if (ref.current && !ref.current.contains(e.target)) setOpen(false);
|
|
94
|
+
};
|
|
95
|
+
document.addEventListener("mousedown", handle);
|
|
96
|
+
return () => document.removeEventListener("mousedown", handle);
|
|
97
|
+
}, [open]);
|
|
98
|
+
return /* @__PURE__ */ jsxs("div", { ref, style: { position: "relative", display: "inline-flex", alignItems: "center", ...style }, children: [
|
|
99
|
+
/* @__PURE__ */ jsx(
|
|
100
|
+
"button",
|
|
101
|
+
{
|
|
102
|
+
type: "button",
|
|
103
|
+
title: triggerLabel,
|
|
104
|
+
"aria-label": triggerLabel,
|
|
105
|
+
"aria-expanded": open,
|
|
106
|
+
onClick: () => setOpen((v) => !v),
|
|
107
|
+
style: {
|
|
108
|
+
display: "inline-flex",
|
|
109
|
+
alignItems: "center",
|
|
110
|
+
padding: "0.25rem",
|
|
111
|
+
marginRight: "0.25rem",
|
|
112
|
+
background: "transparent",
|
|
113
|
+
border: "none",
|
|
114
|
+
color: triggerColor,
|
|
115
|
+
cursor: "pointer",
|
|
116
|
+
borderRadius: "4px"
|
|
117
|
+
},
|
|
118
|
+
children: /* @__PURE__ */ jsx("span", { className: "material-symbols-outlined", style: { fontSize: "1.5rem" }, "aria-hidden": true, children: summaryIcon })
|
|
119
|
+
}
|
|
120
|
+
),
|
|
121
|
+
open ? /* @__PURE__ */ jsxs(
|
|
122
|
+
"div",
|
|
123
|
+
{
|
|
124
|
+
role: "tooltip",
|
|
125
|
+
style: {
|
|
126
|
+
position: "absolute",
|
|
127
|
+
top: "100%",
|
|
128
|
+
right: 0,
|
|
129
|
+
marginTop: "0.25rem",
|
|
130
|
+
minWidth: "220px",
|
|
131
|
+
maxWidth: "300px",
|
|
132
|
+
padding: "0.75rem",
|
|
133
|
+
zIndex: 1e3,
|
|
134
|
+
background: "var(--color-surface, #ffffff)",
|
|
135
|
+
border: "1px solid var(--color-border, #e5e7eb)",
|
|
136
|
+
borderRadius: "var(--radius-md, 8px)",
|
|
137
|
+
boxShadow: "var(--shadow-md, 0 4px 12px rgba(0,0,0,.1))",
|
|
138
|
+
fontFamily: "var(--font-sans, system-ui)"
|
|
139
|
+
},
|
|
140
|
+
children: [
|
|
141
|
+
/* @__PURE__ */ jsx("div", { style: { fontSize: "0.8rem", color: "var(--color-text-muted, #6b7280)", marginBottom: "0.5rem" }, children: "Resumen" }),
|
|
142
|
+
items.map((row, i) => /* @__PURE__ */ jsxs(
|
|
143
|
+
"div",
|
|
144
|
+
{
|
|
145
|
+
style: {
|
|
146
|
+
display: "flex",
|
|
147
|
+
alignItems: "center",
|
|
148
|
+
gap: "0.5rem",
|
|
149
|
+
fontSize: "0.85rem",
|
|
150
|
+
marginTop: i > 0 ? "0.35rem" : 0
|
|
151
|
+
},
|
|
152
|
+
children: [
|
|
153
|
+
/* @__PURE__ */ jsx("span", { className: "material-symbols-outlined", style: { fontSize: "1rem", color: stateColor(row.state) }, "aria-hidden": true, children: stateIcon(row.state) }),
|
|
154
|
+
/* @__PURE__ */ jsx("span", { style: { flex: 1, minWidth: 0 }, children: row.label }),
|
|
155
|
+
/* @__PURE__ */ jsx("span", { style: { color: "var(--color-text-muted, #6b7280)", whiteSpace: "nowrap", fontSize: "0.8rem" }, children: row.detail ?? "" })
|
|
156
|
+
]
|
|
157
|
+
},
|
|
158
|
+
`${row.label}-${i}`
|
|
159
|
+
))
|
|
160
|
+
]
|
|
161
|
+
}
|
|
162
|
+
) : null
|
|
163
|
+
] });
|
|
164
|
+
}
|
|
165
|
+
return __toCommonJS(status_entry_exports);
|
|
166
|
+
})();
|