@conatel-sa/react-ui 0.2.2 → 0.2.4
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 +345 -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 +61 -0
- package/dist/forms.mjs +518 -0
- package/dist/forms.umd.js +562 -0
- package/dist/icons.d.ts +50 -0
- package/dist/icons.mjs +149 -0
- package/dist/icons.umd.js +186 -0
- package/dist/index.css +1 -1
- package/dist/index.mjs +213 -141
- package/dist/index.umd.js +1 -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 +142 -0
- package/dist/status.d.ts +16 -0
- package/dist/status.mjs +117 -0
- package/dist/status.umd.js +165 -0
- package/package.json +42 -4
|
@@ -0,0 +1,165 @@
|
|
|
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
|
+
useMemo,
|
|
34
|
+
useState,
|
|
35
|
+
useRef,
|
|
36
|
+
useCallback,
|
|
37
|
+
useId,
|
|
38
|
+
createContext,
|
|
39
|
+
Fragment
|
|
40
|
+
} = R;
|
|
41
|
+
|
|
42
|
+
// tools/jsx-runtime-shim.mjs
|
|
43
|
+
function jsx(type, props, key) {
|
|
44
|
+
const p = key != null ? { ...props, key } : props;
|
|
45
|
+
return react_shim_default.createElement(type, p);
|
|
46
|
+
}
|
|
47
|
+
function jsxs(type, props, key) {
|
|
48
|
+
return jsx(type, props, key);
|
|
49
|
+
}
|
|
50
|
+
var Fragment2 = react_shim_default.Fragment;
|
|
51
|
+
|
|
52
|
+
// src/components/status/StatusSummaryPopover.tsx
|
|
53
|
+
function stateIcon(state) {
|
|
54
|
+
switch (state) {
|
|
55
|
+
case "ok":
|
|
56
|
+
return "check_circle";
|
|
57
|
+
case "warn":
|
|
58
|
+
return "warning";
|
|
59
|
+
case "error":
|
|
60
|
+
return "error";
|
|
61
|
+
case "pending":
|
|
62
|
+
default:
|
|
63
|
+
return "schedule";
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function stateColor(state) {
|
|
67
|
+
switch (state) {
|
|
68
|
+
case "ok":
|
|
69
|
+
return "var(--color-success, #22c55e)";
|
|
70
|
+
case "warn":
|
|
71
|
+
return "var(--color-warning, #eab308)";
|
|
72
|
+
case "error":
|
|
73
|
+
return "var(--color-error, #ef4444)";
|
|
74
|
+
case "pending":
|
|
75
|
+
default:
|
|
76
|
+
return "var(--color-text-muted, #6b7280)";
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function StatusSummaryPopover({
|
|
80
|
+
items,
|
|
81
|
+
triggerLabel = "Estado de sistemas",
|
|
82
|
+
summaryIcon = "monitoring",
|
|
83
|
+
color,
|
|
84
|
+
style
|
|
85
|
+
}) {
|
|
86
|
+
const [open, setOpen] = useState(false);
|
|
87
|
+
const ref = useRef(null);
|
|
88
|
+
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)");
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
if (!open) return;
|
|
91
|
+
const handle = (e) => {
|
|
92
|
+
if (ref.current && !ref.current.contains(e.target)) setOpen(false);
|
|
93
|
+
};
|
|
94
|
+
document.addEventListener("mousedown", handle);
|
|
95
|
+
return () => document.removeEventListener("mousedown", handle);
|
|
96
|
+
}, [open]);
|
|
97
|
+
return /* @__PURE__ */ jsxs("div", { ref, style: { position: "relative", display: "inline-flex", alignItems: "center", ...style }, children: [
|
|
98
|
+
/* @__PURE__ */ jsx(
|
|
99
|
+
"button",
|
|
100
|
+
{
|
|
101
|
+
type: "button",
|
|
102
|
+
title: triggerLabel,
|
|
103
|
+
"aria-label": triggerLabel,
|
|
104
|
+
"aria-expanded": open,
|
|
105
|
+
onClick: () => setOpen((v) => !v),
|
|
106
|
+
style: {
|
|
107
|
+
display: "inline-flex",
|
|
108
|
+
alignItems: "center",
|
|
109
|
+
padding: "0.25rem",
|
|
110
|
+
marginRight: "0.25rem",
|
|
111
|
+
background: "transparent",
|
|
112
|
+
border: "none",
|
|
113
|
+
color: triggerColor,
|
|
114
|
+
cursor: "pointer",
|
|
115
|
+
borderRadius: "4px"
|
|
116
|
+
},
|
|
117
|
+
children: /* @__PURE__ */ jsx("span", { className: "material-symbols-outlined", style: { fontSize: "1.5rem" }, "aria-hidden": true, children: summaryIcon })
|
|
118
|
+
}
|
|
119
|
+
),
|
|
120
|
+
open ? /* @__PURE__ */ jsxs(
|
|
121
|
+
"div",
|
|
122
|
+
{
|
|
123
|
+
role: "tooltip",
|
|
124
|
+
style: {
|
|
125
|
+
position: "absolute",
|
|
126
|
+
top: "100%",
|
|
127
|
+
right: 0,
|
|
128
|
+
marginTop: "0.25rem",
|
|
129
|
+
minWidth: "220px",
|
|
130
|
+
maxWidth: "300px",
|
|
131
|
+
padding: "0.75rem",
|
|
132
|
+
zIndex: 1e3,
|
|
133
|
+
background: "var(--color-surface, #ffffff)",
|
|
134
|
+
border: "1px solid var(--color-border, #e5e7eb)",
|
|
135
|
+
borderRadius: "var(--radius-md, 8px)",
|
|
136
|
+
boxShadow: "var(--shadow-md, 0 4px 12px rgba(0,0,0,.1))",
|
|
137
|
+
fontFamily: "var(--font-sans, system-ui)"
|
|
138
|
+
},
|
|
139
|
+
children: [
|
|
140
|
+
/* @__PURE__ */ jsx("div", { style: { fontSize: "0.8rem", color: "var(--color-text-muted, #6b7280)", marginBottom: "0.5rem" }, children: "Resumen" }),
|
|
141
|
+
items.map((row, i) => /* @__PURE__ */ jsxs(
|
|
142
|
+
"div",
|
|
143
|
+
{
|
|
144
|
+
style: {
|
|
145
|
+
display: "flex",
|
|
146
|
+
alignItems: "center",
|
|
147
|
+
gap: "0.5rem",
|
|
148
|
+
fontSize: "0.85rem",
|
|
149
|
+
marginTop: i > 0 ? "0.35rem" : 0
|
|
150
|
+
},
|
|
151
|
+
children: [
|
|
152
|
+
/* @__PURE__ */ jsx("span", { className: "material-symbols-outlined", style: { fontSize: "1rem", color: stateColor(row.state) }, "aria-hidden": true, children: stateIcon(row.state) }),
|
|
153
|
+
/* @__PURE__ */ jsx("span", { style: { flex: 1, minWidth: 0 }, children: row.label }),
|
|
154
|
+
/* @__PURE__ */ jsx("span", { style: { color: "var(--color-text-muted, #6b7280)", whiteSpace: "nowrap", fontSize: "0.8rem" }, children: row.detail ?? "" })
|
|
155
|
+
]
|
|
156
|
+
},
|
|
157
|
+
`${row.label}-${i}`
|
|
158
|
+
))
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
) : null
|
|
162
|
+
] });
|
|
163
|
+
}
|
|
164
|
+
return __toCommonJS(status_entry_exports);
|
|
165
|
+
})();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@conatel-sa/react-ui",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "Biblioteca de componentes React para productos Conatel y Vivion. Incluye más de 20 componentes UI
|
|
3
|
+
"version": "0.2.4",
|
|
4
|
+
"description": "Biblioteca de componentes React para productos Conatel y Vivion. Incluye más de 20 componentes UI con theming. Subpaquetes opcionales: ./icons, ./forms, ./cards, ./dialogs, ./metrics, ./status.",
|
|
5
5
|
"main": "dist/index.umd.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -11,7 +11,39 @@
|
|
|
11
11
|
"import": "./dist/index.mjs",
|
|
12
12
|
"require": "./dist/index.umd.js"
|
|
13
13
|
},
|
|
14
|
-
"./dist/index.css": "./dist/index.css"
|
|
14
|
+
"./dist/index.css": "./dist/index.css",
|
|
15
|
+
"./dist/material-symbols.css": "./dist/material-symbols.css",
|
|
16
|
+
"./icons": {
|
|
17
|
+
"types": "./dist/icons.d.ts",
|
|
18
|
+
"import": "./dist/icons.mjs",
|
|
19
|
+
"require": "./dist/icons.umd.js"
|
|
20
|
+
}
|
|
21
|
+
,
|
|
22
|
+
"./forms": {
|
|
23
|
+
"types": "./dist/forms.d.ts",
|
|
24
|
+
"import": "./dist/forms.mjs",
|
|
25
|
+
"require": "./dist/forms.umd.js"
|
|
26
|
+
},
|
|
27
|
+
"./cards": {
|
|
28
|
+
"types": "./dist/cards.d.ts",
|
|
29
|
+
"import": "./dist/cards.mjs",
|
|
30
|
+
"require": "./dist/cards.umd.js"
|
|
31
|
+
},
|
|
32
|
+
"./dialogs": {
|
|
33
|
+
"types": "./dist/dialogs.d.ts",
|
|
34
|
+
"import": "./dist/dialogs.mjs",
|
|
35
|
+
"require": "./dist/dialogs.umd.js"
|
|
36
|
+
},
|
|
37
|
+
"./metrics": {
|
|
38
|
+
"types": "./dist/metrics.d.ts",
|
|
39
|
+
"import": "./dist/metrics.mjs",
|
|
40
|
+
"require": "./dist/metrics.umd.js"
|
|
41
|
+
},
|
|
42
|
+
"./status": {
|
|
43
|
+
"types": "./dist/status.d.ts",
|
|
44
|
+
"import": "./dist/status.mjs",
|
|
45
|
+
"require": "./dist/status.umd.js"
|
|
46
|
+
}
|
|
15
47
|
},
|
|
16
48
|
"files": [
|
|
17
49
|
"dist"
|
|
@@ -36,7 +68,13 @@
|
|
|
36
68
|
},
|
|
37
69
|
"peerDependencies": {
|
|
38
70
|
"react": "^18.0.0",
|
|
39
|
-
"react-dom": "^18.0.0"
|
|
71
|
+
"react-dom": "^18.0.0",
|
|
72
|
+
"lucide-react": "^0.460.0"
|
|
73
|
+
},
|
|
74
|
+
"peerDependenciesMeta": {
|
|
75
|
+
"lucide-react": {
|
|
76
|
+
"optional": true
|
|
77
|
+
}
|
|
40
78
|
},
|
|
41
79
|
"devDependencies": {
|
|
42
80
|
"@storybook/addon-a11y": "^8.4.0",
|