@conatel-sa/react-ui 0.2.3 → 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.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 +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
package/dist/icons.mjs
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
// src/components/Icon/Icon.tsx
|
|
2
|
+
import { useContext } from "react";
|
|
3
|
+
|
|
4
|
+
// src/components/Icon/IconContext.tsx
|
|
5
|
+
import { createContext } from "react";
|
|
6
|
+
var DEFAULT_FONT_HREF = "https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200";
|
|
7
|
+
var defaultIconContext = {
|
|
8
|
+
fontHref: DEFAULT_FONT_HREF,
|
|
9
|
+
injectStylesheet: true,
|
|
10
|
+
defaultSize: "md",
|
|
11
|
+
className: void 0
|
|
12
|
+
};
|
|
13
|
+
var IconContext = createContext(defaultIconContext);
|
|
14
|
+
|
|
15
|
+
// src/components/Icon/size.ts
|
|
16
|
+
var PRESET_PX = {
|
|
17
|
+
sm: 16,
|
|
18
|
+
md: 20,
|
|
19
|
+
lg: 24
|
|
20
|
+
};
|
|
21
|
+
function resolveIconSize(size, fallback) {
|
|
22
|
+
const s = size ?? fallback;
|
|
23
|
+
if (typeof s === "number") return s;
|
|
24
|
+
return PRESET_PX[s];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// src/components/Icon/Icon.tsx
|
|
28
|
+
import { jsx } from "react/jsx-runtime";
|
|
29
|
+
function Icon({
|
|
30
|
+
name,
|
|
31
|
+
size,
|
|
32
|
+
fill = 0,
|
|
33
|
+
className = "",
|
|
34
|
+
style,
|
|
35
|
+
"aria-label": ariaLabel
|
|
36
|
+
}) {
|
|
37
|
+
const ctx = useContext(IconContext);
|
|
38
|
+
const px = resolveIconSize(size, ctx.defaultSize);
|
|
39
|
+
const extra = ctx.className ? ` ${ctx.className}` : "";
|
|
40
|
+
const combined = `material-symbols-outlined${extra}${className ? ` ${className}` : ""}`.trim();
|
|
41
|
+
const fontVariation = `'FILL' ${fill}, 'wght' 400, 'GRAD' 0, 'opsz' 24`;
|
|
42
|
+
return /* @__PURE__ */ jsx(
|
|
43
|
+
"span",
|
|
44
|
+
{
|
|
45
|
+
className: combined,
|
|
46
|
+
style: {
|
|
47
|
+
fontSize: px,
|
|
48
|
+
lineHeight: 1,
|
|
49
|
+
display: "inline-block",
|
|
50
|
+
fontVariationSettings: fontVariation,
|
|
51
|
+
...style
|
|
52
|
+
},
|
|
53
|
+
"aria-hidden": ariaLabel ? void 0 : true,
|
|
54
|
+
"aria-label": ariaLabel,
|
|
55
|
+
role: ariaLabel ? "img" : void 0,
|
|
56
|
+
children: name
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// src/components/Icon/IconProvider.tsx
|
|
62
|
+
import { useEffect, useMemo } from "react";
|
|
63
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
64
|
+
function mergeContext(partial) {
|
|
65
|
+
return {
|
|
66
|
+
...defaultIconContext,
|
|
67
|
+
...partial,
|
|
68
|
+
fontHref: partial?.fontHref ?? defaultIconContext.fontHref,
|
|
69
|
+
injectStylesheet: partial?.injectStylesheet ?? defaultIconContext.injectStylesheet,
|
|
70
|
+
defaultSize: partial?.defaultSize ?? defaultIconContext.defaultSize,
|
|
71
|
+
className: partial?.className
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function IconProvider({
|
|
75
|
+
children,
|
|
76
|
+
fontHref = DEFAULT_FONT_HREF,
|
|
77
|
+
injectStylesheet = true,
|
|
78
|
+
defaultSize = "md",
|
|
79
|
+
className
|
|
80
|
+
}) {
|
|
81
|
+
const value = useMemo(
|
|
82
|
+
() => mergeContext({
|
|
83
|
+
fontHref,
|
|
84
|
+
injectStylesheet,
|
|
85
|
+
defaultSize,
|
|
86
|
+
className
|
|
87
|
+
}),
|
|
88
|
+
[fontHref, injectStylesheet, defaultSize, className]
|
|
89
|
+
);
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
if (!injectStylesheet || typeof document === "undefined") return;
|
|
92
|
+
const ensureLink = () => {
|
|
93
|
+
const sheets = document.querySelectorAll('link[rel="stylesheet"]');
|
|
94
|
+
const duplicate = Array.from(sheets).some(
|
|
95
|
+
(el) => (el.getAttribute("href") || "") === fontHref
|
|
96
|
+
);
|
|
97
|
+
if (duplicate) return;
|
|
98
|
+
const link = document.createElement("link");
|
|
99
|
+
link.rel = "stylesheet";
|
|
100
|
+
link.href = fontHref;
|
|
101
|
+
document.head.appendChild(link);
|
|
102
|
+
};
|
|
103
|
+
ensureLink();
|
|
104
|
+
const t = window.setTimeout(ensureLink, 50);
|
|
105
|
+
return () => window.clearTimeout(t);
|
|
106
|
+
}, [fontHref, injectStylesheet]);
|
|
107
|
+
return /* @__PURE__ */ jsx2(IconContext.Provider, { value, children });
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// src/components/Icon/LucideIcon.tsx
|
|
111
|
+
import { useContext as useContext2 } from "react";
|
|
112
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
113
|
+
function LucideIcon({
|
|
114
|
+
as: Comp,
|
|
115
|
+
size,
|
|
116
|
+
className,
|
|
117
|
+
strokeWidth = 2,
|
|
118
|
+
"aria-label": ariaLabel
|
|
119
|
+
}) {
|
|
120
|
+
const ctx = useContext2(IconContext);
|
|
121
|
+
const px = resolveIconSize(size, ctx.defaultSize);
|
|
122
|
+
const extra = ctx.className ? ` ${ctx.className}` : "";
|
|
123
|
+
const combined = `${className ?? ""}${extra}`.trim();
|
|
124
|
+
return /* @__PURE__ */ jsx3(
|
|
125
|
+
Comp,
|
|
126
|
+
{
|
|
127
|
+
className: combined || void 0,
|
|
128
|
+
size: px,
|
|
129
|
+
strokeWidth,
|
|
130
|
+
"aria-hidden": ariaLabel ? void 0 : true,
|
|
131
|
+
"aria-label": ariaLabel
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// src/components/Icon/useIconContext.ts
|
|
137
|
+
import { useContext as useContext3 } from "react";
|
|
138
|
+
function useIconContext() {
|
|
139
|
+
return useContext3(IconContext);
|
|
140
|
+
}
|
|
141
|
+
export {
|
|
142
|
+
DEFAULT_FONT_HREF,
|
|
143
|
+
Icon,
|
|
144
|
+
IconContext,
|
|
145
|
+
IconProvider,
|
|
146
|
+
LucideIcon,
|
|
147
|
+
defaultIconContext,
|
|
148
|
+
useIconContext
|
|
149
|
+
};
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var ReactLibraryIcons = (() => {
|
|
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/icons-entry.ts
|
|
22
|
+
var icons_entry_exports = {};
|
|
23
|
+
__export(icons_entry_exports, {
|
|
24
|
+
DEFAULT_FONT_HREF: () => DEFAULT_FONT_HREF,
|
|
25
|
+
Icon: () => Icon,
|
|
26
|
+
IconContext: () => IconContext,
|
|
27
|
+
IconProvider: () => IconProvider,
|
|
28
|
+
LucideIcon: () => LucideIcon,
|
|
29
|
+
defaultIconContext: () => defaultIconContext,
|
|
30
|
+
useIconContext: () => useIconContext
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// tools/react-shim.mjs
|
|
34
|
+
var R = typeof window !== "undefined" && window.React ? window.React : {};
|
|
35
|
+
var react_shim_default = R;
|
|
36
|
+
var {
|
|
37
|
+
useContext,
|
|
38
|
+
useEffect,
|
|
39
|
+
useMemo,
|
|
40
|
+
useState,
|
|
41
|
+
useRef,
|
|
42
|
+
useCallback,
|
|
43
|
+
useId,
|
|
44
|
+
createContext,
|
|
45
|
+
Fragment
|
|
46
|
+
} = R;
|
|
47
|
+
|
|
48
|
+
// src/components/Icon/IconContext.tsx
|
|
49
|
+
var DEFAULT_FONT_HREF = "https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200";
|
|
50
|
+
var defaultIconContext = {
|
|
51
|
+
fontHref: DEFAULT_FONT_HREF,
|
|
52
|
+
injectStylesheet: true,
|
|
53
|
+
defaultSize: "md",
|
|
54
|
+
className: void 0
|
|
55
|
+
};
|
|
56
|
+
var IconContext = createContext(defaultIconContext);
|
|
57
|
+
|
|
58
|
+
// src/components/Icon/size.ts
|
|
59
|
+
var PRESET_PX = {
|
|
60
|
+
sm: 16,
|
|
61
|
+
md: 20,
|
|
62
|
+
lg: 24
|
|
63
|
+
};
|
|
64
|
+
function resolveIconSize(size, fallback) {
|
|
65
|
+
const s = size ?? fallback;
|
|
66
|
+
if (typeof s === "number") return s;
|
|
67
|
+
return PRESET_PX[s];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// tools/jsx-runtime-shim.mjs
|
|
71
|
+
function jsx(type, props, key) {
|
|
72
|
+
const p = key != null ? { ...props, key } : props;
|
|
73
|
+
return react_shim_default.createElement(type, p);
|
|
74
|
+
}
|
|
75
|
+
var Fragment2 = react_shim_default.Fragment;
|
|
76
|
+
|
|
77
|
+
// src/components/Icon/Icon.tsx
|
|
78
|
+
function Icon({
|
|
79
|
+
name,
|
|
80
|
+
size,
|
|
81
|
+
fill = 0,
|
|
82
|
+
className = "",
|
|
83
|
+
style,
|
|
84
|
+
"aria-label": ariaLabel
|
|
85
|
+
}) {
|
|
86
|
+
const ctx = useContext(IconContext);
|
|
87
|
+
const px = resolveIconSize(size, ctx.defaultSize);
|
|
88
|
+
const extra = ctx.className ? ` ${ctx.className}` : "";
|
|
89
|
+
const combined = `material-symbols-outlined${extra}${className ? ` ${className}` : ""}`.trim();
|
|
90
|
+
const fontVariation = `'FILL' ${fill}, 'wght' 400, 'GRAD' 0, 'opsz' 24`;
|
|
91
|
+
return /* @__PURE__ */ jsx(
|
|
92
|
+
"span",
|
|
93
|
+
{
|
|
94
|
+
className: combined,
|
|
95
|
+
style: {
|
|
96
|
+
fontSize: px,
|
|
97
|
+
lineHeight: 1,
|
|
98
|
+
display: "inline-block",
|
|
99
|
+
fontVariationSettings: fontVariation,
|
|
100
|
+
...style
|
|
101
|
+
},
|
|
102
|
+
"aria-hidden": ariaLabel ? void 0 : true,
|
|
103
|
+
"aria-label": ariaLabel,
|
|
104
|
+
role: ariaLabel ? "img" : void 0,
|
|
105
|
+
children: name
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// src/components/Icon/IconProvider.tsx
|
|
111
|
+
function mergeContext(partial) {
|
|
112
|
+
return {
|
|
113
|
+
...defaultIconContext,
|
|
114
|
+
...partial,
|
|
115
|
+
fontHref: partial?.fontHref ?? defaultIconContext.fontHref,
|
|
116
|
+
injectStylesheet: partial?.injectStylesheet ?? defaultIconContext.injectStylesheet,
|
|
117
|
+
defaultSize: partial?.defaultSize ?? defaultIconContext.defaultSize,
|
|
118
|
+
className: partial?.className
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function IconProvider({
|
|
122
|
+
children,
|
|
123
|
+
fontHref = DEFAULT_FONT_HREF,
|
|
124
|
+
injectStylesheet = true,
|
|
125
|
+
defaultSize = "md",
|
|
126
|
+
className
|
|
127
|
+
}) {
|
|
128
|
+
const value = useMemo(
|
|
129
|
+
() => mergeContext({
|
|
130
|
+
fontHref,
|
|
131
|
+
injectStylesheet,
|
|
132
|
+
defaultSize,
|
|
133
|
+
className
|
|
134
|
+
}),
|
|
135
|
+
[fontHref, injectStylesheet, defaultSize, className]
|
|
136
|
+
);
|
|
137
|
+
useEffect(() => {
|
|
138
|
+
if (!injectStylesheet || typeof document === "undefined") return;
|
|
139
|
+
const ensureLink = () => {
|
|
140
|
+
const sheets = document.querySelectorAll('link[rel="stylesheet"]');
|
|
141
|
+
const duplicate = Array.from(sheets).some(
|
|
142
|
+
(el) => (el.getAttribute("href") || "") === fontHref
|
|
143
|
+
);
|
|
144
|
+
if (duplicate) return;
|
|
145
|
+
const link = document.createElement("link");
|
|
146
|
+
link.rel = "stylesheet";
|
|
147
|
+
link.href = fontHref;
|
|
148
|
+
document.head.appendChild(link);
|
|
149
|
+
};
|
|
150
|
+
ensureLink();
|
|
151
|
+
const t = window.setTimeout(ensureLink, 50);
|
|
152
|
+
return () => window.clearTimeout(t);
|
|
153
|
+
}, [fontHref, injectStylesheet]);
|
|
154
|
+
return /* @__PURE__ */ jsx(IconContext.Provider, { value, children });
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// src/components/Icon/LucideIcon.tsx
|
|
158
|
+
function LucideIcon({
|
|
159
|
+
as: Comp,
|
|
160
|
+
size,
|
|
161
|
+
className,
|
|
162
|
+
strokeWidth = 2,
|
|
163
|
+
"aria-label": ariaLabel
|
|
164
|
+
}) {
|
|
165
|
+
const ctx = useContext(IconContext);
|
|
166
|
+
const px = resolveIconSize(size, ctx.defaultSize);
|
|
167
|
+
const extra = ctx.className ? ` ${ctx.className}` : "";
|
|
168
|
+
const combined = `${className ?? ""}${extra}`.trim();
|
|
169
|
+
return /* @__PURE__ */ jsx(
|
|
170
|
+
Comp,
|
|
171
|
+
{
|
|
172
|
+
className: combined || void 0,
|
|
173
|
+
size: px,
|
|
174
|
+
strokeWidth,
|
|
175
|
+
"aria-hidden": ariaLabel ? void 0 : true,
|
|
176
|
+
"aria-label": ariaLabel
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// src/components/Icon/useIconContext.ts
|
|
182
|
+
function useIconContext() {
|
|
183
|
+
return useContext(IconContext);
|
|
184
|
+
}
|
|
185
|
+
return __toCommonJS(icons_entry_exports);
|
|
186
|
+
})();
|
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,142 @@
|
|
|
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
|
+
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/metrics/StatInline.tsx
|
|
54
|
+
function StatInline({ label, value, accentColor = "var(--color-primary, #2563eb)", style }) {
|
|
55
|
+
const border = `${accentColor}33`;
|
|
56
|
+
return /* @__PURE__ */ jsxs(
|
|
57
|
+
"div",
|
|
58
|
+
{
|
|
59
|
+
style: {
|
|
60
|
+
background: "var(--color-bg-tertiary, #f9fafb)",
|
|
61
|
+
border: `1px solid ${border}`,
|
|
62
|
+
borderRadius: "var(--radius-md, 8px)",
|
|
63
|
+
padding: "var(--space-2, 8px) var(--space-3, 12px)",
|
|
64
|
+
minWidth: "5rem",
|
|
65
|
+
textAlign: "center",
|
|
66
|
+
fontFamily: "var(--font-sans, system-ui)",
|
|
67
|
+
...style
|
|
68
|
+
},
|
|
69
|
+
children: [
|
|
70
|
+
/* @__PURE__ */ jsx("div", { style: { fontSize: "1.1rem", fontWeight: 700, color: accentColor }, children: value }),
|
|
71
|
+
/* @__PURE__ */ jsx("div", { style: { fontSize: "0.7rem", color: "var(--color-text-muted, #6b7280)", marginTop: "0.1rem" }, children: label })
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// src/components/metrics/MiniMeter.tsx
|
|
78
|
+
function MiniMeter({
|
|
79
|
+
label,
|
|
80
|
+
value,
|
|
81
|
+
valueText,
|
|
82
|
+
color = "var(--color-primary, #2563eb)",
|
|
83
|
+
labelWidth = "120px",
|
|
84
|
+
style
|
|
85
|
+
}) {
|
|
86
|
+
const pct = Math.max(0, Math.min(100, value));
|
|
87
|
+
const right = valueText ?? `${Math.round(pct)}%`;
|
|
88
|
+
return /* @__PURE__ */ jsxs(
|
|
89
|
+
"div",
|
|
90
|
+
{
|
|
91
|
+
style: {
|
|
92
|
+
display: "grid",
|
|
93
|
+
gridTemplateColumns: `${labelWidth} 1fr 54px`,
|
|
94
|
+
gap: "var(--space-2, 8px)",
|
|
95
|
+
alignItems: "center",
|
|
96
|
+
marginBottom: "0.35rem",
|
|
97
|
+
fontFamily: "var(--font-sans, system-ui)",
|
|
98
|
+
...style
|
|
99
|
+
},
|
|
100
|
+
children: [
|
|
101
|
+
/* @__PURE__ */ jsx("span", { style: { fontSize: "0.75rem", color: "var(--color-text-muted, #6b7280)", overflow: "hidden", textOverflow: "ellipsis" }, children: label }),
|
|
102
|
+
/* @__PURE__ */ jsx(
|
|
103
|
+
"div",
|
|
104
|
+
{
|
|
105
|
+
style: {
|
|
106
|
+
height: "0.75rem",
|
|
107
|
+
background: "var(--color-bg-tertiary, #f3f4f6)",
|
|
108
|
+
borderRadius: "9999px",
|
|
109
|
+
overflow: "hidden"
|
|
110
|
+
},
|
|
111
|
+
children: /* @__PURE__ */ jsx(
|
|
112
|
+
"div",
|
|
113
|
+
{
|
|
114
|
+
style: {
|
|
115
|
+
width: `${pct}%`,
|
|
116
|
+
minWidth: pct > 0 ? "2px" : "0",
|
|
117
|
+
height: "100%",
|
|
118
|
+
background: color,
|
|
119
|
+
borderRadius: "9999px"
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
),
|
|
125
|
+
/* @__PURE__ */ jsx(
|
|
126
|
+
"span",
|
|
127
|
+
{
|
|
128
|
+
style: {
|
|
129
|
+
fontSize: "0.75rem",
|
|
130
|
+
fontWeight: 600,
|
|
131
|
+
color: "var(--color-text, #111827)",
|
|
132
|
+
textAlign: "right"
|
|
133
|
+
},
|
|
134
|
+
children: right
|
|
135
|
+
}
|
|
136
|
+
)
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
return __toCommonJS(metrics_entry_exports);
|
|
142
|
+
})();
|