@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
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var ReactLibraryDialogs = (() => {
|
|
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/dialogs-entry.ts
|
|
22
|
+
var dialogs_entry_exports = {};
|
|
23
|
+
__export(dialogs_entry_exports, {
|
|
24
|
+
ChangelogDialog: () => ChangelogDialog
|
|
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/react-dom-shim.mjs
|
|
44
|
+
var RD = typeof window !== "undefined" && window.ReactDOM ? window.ReactDOM : {};
|
|
45
|
+
var { createPortal } = RD;
|
|
46
|
+
|
|
47
|
+
// tools/jsx-runtime-shim.mjs
|
|
48
|
+
function jsx(type, props, key) {
|
|
49
|
+
const p = key != null ? { ...props, key } : props;
|
|
50
|
+
return react_shim_default.createElement(type, p);
|
|
51
|
+
}
|
|
52
|
+
function jsxs(type, props, key) {
|
|
53
|
+
return jsx(type, props, key);
|
|
54
|
+
}
|
|
55
|
+
var Fragment2 = react_shim_default.Fragment;
|
|
56
|
+
|
|
57
|
+
// src/components/dialogs/ChangelogDialog.tsx
|
|
58
|
+
function readActiveTheme() {
|
|
59
|
+
if (typeof document === "undefined") return "conatel";
|
|
60
|
+
const el = document.querySelector("[data-theme]");
|
|
61
|
+
const t = el?.getAttribute("data-theme");
|
|
62
|
+
return t === "vivion" ? "vivion" : "conatel";
|
|
63
|
+
}
|
|
64
|
+
function formatDate(dateStr) {
|
|
65
|
+
try {
|
|
66
|
+
const [year, month, day] = dateStr.split("-").map(Number);
|
|
67
|
+
const date = new Date(year, month - 1, day);
|
|
68
|
+
return date.toLocaleDateString("es-AR", { day: "numeric", month: "short", year: "numeric" });
|
|
69
|
+
} catch {
|
|
70
|
+
return dateStr;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function ChangelogDialog({
|
|
74
|
+
isOpen,
|
|
75
|
+
onClose,
|
|
76
|
+
data,
|
|
77
|
+
title = "Novedades",
|
|
78
|
+
confirmLabel = "Entendido"
|
|
79
|
+
}) {
|
|
80
|
+
const [mounted, setMounted] = useState(false);
|
|
81
|
+
const [theme, setTheme] = useState("conatel");
|
|
82
|
+
useEffect(() => {
|
|
83
|
+
setMounted(true);
|
|
84
|
+
}, []);
|
|
85
|
+
useLayoutEffect(() => {
|
|
86
|
+
if (!isOpen) return;
|
|
87
|
+
setTheme(readActiveTheme());
|
|
88
|
+
}, [isOpen]);
|
|
89
|
+
if (!isOpen || !data || !mounted) return null;
|
|
90
|
+
const overlay = /* @__PURE__ */ jsx(
|
|
91
|
+
"div",
|
|
92
|
+
{
|
|
93
|
+
className: `theme-${theme}`,
|
|
94
|
+
"data-theme": theme,
|
|
95
|
+
style: {
|
|
96
|
+
position: "fixed",
|
|
97
|
+
inset: 0,
|
|
98
|
+
zIndex: 1e3,
|
|
99
|
+
display: "flex",
|
|
100
|
+
alignItems: "center",
|
|
101
|
+
justifyContent: "center",
|
|
102
|
+
background: "rgba(0,0,0,0.45)",
|
|
103
|
+
padding: "1rem",
|
|
104
|
+
fontFamily: "var(--font-sans, system-ui)",
|
|
105
|
+
colorScheme: "light"
|
|
106
|
+
},
|
|
107
|
+
onClick: (e) => {
|
|
108
|
+
if (e.target === e.currentTarget) onClose();
|
|
109
|
+
},
|
|
110
|
+
role: "presentation",
|
|
111
|
+
children: /* @__PURE__ */ jsxs(
|
|
112
|
+
"div",
|
|
113
|
+
{
|
|
114
|
+
style: {
|
|
115
|
+
background: "var(--color-surface, #ffffff)",
|
|
116
|
+
border: "1px solid var(--color-border, #e5e7eb)",
|
|
117
|
+
borderRadius: "var(--radius-lg, 12px)",
|
|
118
|
+
boxShadow: "var(--shadow-lg, 0 10px 40px rgba(0,0,0,.12))",
|
|
119
|
+
width: "100%",
|
|
120
|
+
maxWidth: "520px",
|
|
121
|
+
maxHeight: "80vh",
|
|
122
|
+
display: "flex",
|
|
123
|
+
flexDirection: "column",
|
|
124
|
+
overflow: "hidden"
|
|
125
|
+
},
|
|
126
|
+
role: "dialog",
|
|
127
|
+
"aria-modal": "true",
|
|
128
|
+
"aria-labelledby": "changelog-dialog-title",
|
|
129
|
+
children: [
|
|
130
|
+
/* @__PURE__ */ jsxs(
|
|
131
|
+
"div",
|
|
132
|
+
{
|
|
133
|
+
style: {
|
|
134
|
+
display: "flex",
|
|
135
|
+
alignItems: "center",
|
|
136
|
+
justifyContent: "space-between",
|
|
137
|
+
padding: "1rem 1.25rem",
|
|
138
|
+
borderBottom: "1px solid var(--color-border, #e5e7eb)",
|
|
139
|
+
flexShrink: 0
|
|
140
|
+
},
|
|
141
|
+
children: [
|
|
142
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem", minWidth: 0 }, children: [
|
|
143
|
+
/* @__PURE__ */ jsx("span", { className: "material-symbols-outlined", style: { color: "var(--color-primary)", fontSize: "1.25rem" }, "aria-hidden": true, children: "auto_awesome" }),
|
|
144
|
+
/* @__PURE__ */ jsx("span", { id: "changelog-dialog-title", style: { fontWeight: 600, fontSize: "1rem", color: "var(--color-text, #111827)" }, children: title })
|
|
145
|
+
] }),
|
|
146
|
+
/* @__PURE__ */ jsx(
|
|
147
|
+
"button",
|
|
148
|
+
{
|
|
149
|
+
type: "button",
|
|
150
|
+
onClick: onClose,
|
|
151
|
+
style: {
|
|
152
|
+
background: "transparent",
|
|
153
|
+
border: "none",
|
|
154
|
+
cursor: "pointer",
|
|
155
|
+
color: "var(--color-text-muted, #6b7280)",
|
|
156
|
+
display: "flex",
|
|
157
|
+
alignItems: "center",
|
|
158
|
+
padding: "0.25rem",
|
|
159
|
+
borderRadius: "var(--radius-sm, 6px)"
|
|
160
|
+
},
|
|
161
|
+
"aria-label": "Cerrar",
|
|
162
|
+
children: /* @__PURE__ */ jsx("span", { className: "material-symbols-outlined", style: { fontSize: "1.25rem" }, "aria-hidden": true, children: "close" })
|
|
163
|
+
}
|
|
164
|
+
)
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
),
|
|
168
|
+
/* @__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: [
|
|
169
|
+
idx > 0 ? /* @__PURE__ */ jsx("div", { style: { height: "1px", background: "var(--color-border, #e5e7eb)", margin: "1.25rem 0" } }) : null,
|
|
170
|
+
/* @__PURE__ */ jsxs("div", { style: { marginBottom: "0.75rem" }, children: [
|
|
171
|
+
/* @__PURE__ */ jsxs("span", { style: { fontWeight: 700, fontSize: "0.95rem", color: "var(--color-text, #111827)" }, children: [
|
|
172
|
+
"v",
|
|
173
|
+
ver.version
|
|
174
|
+
] }),
|
|
175
|
+
/* @__PURE__ */ jsxs("span", { style: { marginLeft: "0.5rem", fontSize: "0.8rem", color: "var(--color-text-muted, #6b7280)" }, children: [
|
|
176
|
+
"\u2014 ",
|
|
177
|
+
formatDate(ver.date)
|
|
178
|
+
] })
|
|
179
|
+
] }),
|
|
180
|
+
/* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: "0.5rem" }, children: ver.sections.map((section) => /* @__PURE__ */ jsxs(
|
|
181
|
+
"div",
|
|
182
|
+
{
|
|
183
|
+
style: {
|
|
184
|
+
background: "var(--color-bg-secondary, #f9fafb)",
|
|
185
|
+
border: "1px solid var(--color-border, #e5e7eb)",
|
|
186
|
+
borderRadius: "var(--radius-md, 8px)",
|
|
187
|
+
padding: "0.625rem 0.875rem"
|
|
188
|
+
},
|
|
189
|
+
children: [
|
|
190
|
+
/* @__PURE__ */ jsxs("div", { style: { fontWeight: 600, fontSize: "0.85rem", color: "var(--color-text, #111827)", marginBottom: "0.375rem" }, children: [
|
|
191
|
+
section.emoji,
|
|
192
|
+
" ",
|
|
193
|
+
section.label
|
|
194
|
+
] }),
|
|
195
|
+
/* @__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)) })
|
|
196
|
+
]
|
|
197
|
+
},
|
|
198
|
+
section.type
|
|
199
|
+
)) })
|
|
200
|
+
] }, ver.version)) }),
|
|
201
|
+
/* @__PURE__ */ jsx(
|
|
202
|
+
"div",
|
|
203
|
+
{
|
|
204
|
+
style: {
|
|
205
|
+
padding: "0.75rem 1.25rem",
|
|
206
|
+
borderTop: "1px solid var(--color-border, #e5e7eb)",
|
|
207
|
+
display: "flex",
|
|
208
|
+
justifyContent: "center",
|
|
209
|
+
flexShrink: 0
|
|
210
|
+
},
|
|
211
|
+
children: /* @__PURE__ */ jsxs(
|
|
212
|
+
"button",
|
|
213
|
+
{
|
|
214
|
+
type: "button",
|
|
215
|
+
onClick: onClose,
|
|
216
|
+
style: {
|
|
217
|
+
display: "inline-flex",
|
|
218
|
+
alignItems: "center",
|
|
219
|
+
gap: "0.375rem",
|
|
220
|
+
background: "var(--color-primary)",
|
|
221
|
+
color: "#fff",
|
|
222
|
+
border: "none",
|
|
223
|
+
borderRadius: "var(--radius-md, 8px)",
|
|
224
|
+
padding: "0.5rem 1.25rem",
|
|
225
|
+
fontWeight: 600,
|
|
226
|
+
fontSize: "0.875rem",
|
|
227
|
+
cursor: "pointer",
|
|
228
|
+
fontFamily: "inherit"
|
|
229
|
+
},
|
|
230
|
+
children: [
|
|
231
|
+
/* @__PURE__ */ jsx("span", { className: "material-symbols-outlined", style: { fontSize: "1rem" }, "aria-hidden": true, children: "check" }),
|
|
232
|
+
confirmLabel
|
|
233
|
+
]
|
|
234
|
+
}
|
|
235
|
+
)
|
|
236
|
+
}
|
|
237
|
+
)
|
|
238
|
+
]
|
|
239
|
+
}
|
|
240
|
+
)
|
|
241
|
+
}
|
|
242
|
+
);
|
|
243
|
+
return createPortal(overlay, document.body);
|
|
244
|
+
}
|
|
245
|
+
return __toCommonJS(dialogs_entry_exports);
|
|
246
|
+
})();
|
package/dist/forms.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export interface PasswordChecks {
|
|
2
|
+
minLength: boolean;
|
|
3
|
+
hasLower: boolean;
|
|
4
|
+
hasUpper: boolean;
|
|
5
|
+
hasDigit: boolean;
|
|
6
|
+
hasSpecial: boolean;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function validatePassword(password: string): PasswordChecks;
|
|
10
|
+
export function isPasswordValid(checks: PasswordChecks): boolean;
|
|
11
|
+
export function getPasswordValid(password: string): boolean;
|
|
12
|
+
|
|
13
|
+
export const PASSWORD_RULES: ReadonlyArray<{
|
|
14
|
+
key: 'minLength' | 'hasLower' | 'hasUpper' | 'hasDigit' | 'hasSpecial';
|
|
15
|
+
label: string;
|
|
16
|
+
ok: (c: PasswordChecks) => boolean;
|
|
17
|
+
}>;
|
|
18
|
+
|
|
19
|
+
export const PASSWORD_HINT: string;
|
|
20
|
+
|
|
21
|
+
export type PasswordInputProps = {
|
|
22
|
+
value: string;
|
|
23
|
+
onChange: (next: string) => void;
|
|
24
|
+
placeholder?: string;
|
|
25
|
+
label?: string;
|
|
26
|
+
hint?: string;
|
|
27
|
+
error?: string;
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
required?: boolean;
|
|
30
|
+
ariaLabel?: string;
|
|
31
|
+
showValidation?: boolean;
|
|
32
|
+
id?: string;
|
|
33
|
+
inputClassName?: string;
|
|
34
|
+
className?: string;
|
|
35
|
+
minLength?: number;
|
|
36
|
+
'data-testid'?: string;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export declare function PasswordInput(props: PasswordInputProps): JSX.Element;
|
|
40
|
+
|
|
41
|
+
export type MultiSelectOption = { value: string; label: string };
|
|
42
|
+
|
|
43
|
+
export type MultiSelectDropdownProps = {
|
|
44
|
+
label?: string;
|
|
45
|
+
options: MultiSelectOption[];
|
|
46
|
+
value?: string[];
|
|
47
|
+
selected?: string[];
|
|
48
|
+
onChange: (next: string[]) => void;
|
|
49
|
+
placeholder?: string;
|
|
50
|
+
emptyLabel?: string;
|
|
51
|
+
disabled?: boolean;
|
|
52
|
+
allowAllNone?: boolean;
|
|
53
|
+
allLabel?: string;
|
|
54
|
+
noneLabel?: string;
|
|
55
|
+
maxLabels?: number;
|
|
56
|
+
labelStyle?: import('react').CSSProperties;
|
|
57
|
+
style?: import('react').CSSProperties;
|
|
58
|
+
buttonClassName?: string;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export declare function MultiSelectDropdown(props: MultiSelectDropdownProps): JSX.Element;
|