Files
sigpro-ui/dist/sigpro-ui.esm.js
natxocc 953fae7bbc
All checks were successful
Deploy Docs to Synology / deploy (push) Successful in 3s
New Stat Stats
2026-04-27 18:01:15 +02:00

1209 lines
44 KiB
JavaScript

var __defProp = Object.defineProperty;
var __returnValue = (v) => v;
function __exportSetter(name, newValue) {
this[name] = __returnValue.bind(null, newValue);
}
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, {
get: all[name],
enumerable: true,
configurable: true,
set: __exportSetter.bind(all, name)
});
};
// sigpro-components.js
var exports_sigpro_components = {};
__export(exports_sigpro_components, {
Tooltip: () => Tooltip,
Toggle: () => Toggle,
Toast: () => Toast,
Timeline: () => Timeline,
Textrotate: () => Textrotate,
Textarea: () => Textarea,
Tabs: () => Tabs,
TableItems: () => TableItems,
Table: () => Table,
SwapToggle: () => SwapToggle,
SwapOn: () => SwapOn,
SwapOff: () => SwapOff,
Swap: () => Swap,
Steps: () => Steps,
Step: () => Step,
Stats: () => Stats,
Stat: () => Stat,
Stack: () => Stack,
SkeletonText: () => SkeletonText,
Skeleton: () => Skeleton,
Select: () => Select,
RatingItems: () => RatingItems,
Rating: () => Rating,
Range: () => Range,
Radio: () => Radio,
Radial: () => Radial,
Progress: () => Progress,
Navbar: () => Navbar,
Modal: () => Modal,
Menu: () => Menu,
Loading: () => Loading,
ListRows: () => ListRows,
List: () => List,
Kbd: () => Kbd,
Input: () => Input,
Indicator: () => Indicator,
Icon: () => Icon,
Fileinput: () => Fileinput,
Fieldset: () => Fieldset,
Fab: () => Fab,
DropdownContent: () => DropdownContent,
DropdownButton: () => DropdownButton,
Dropdown: () => Dropdown,
DrawerToggle: () => DrawerToggle,
DrawerSide: () => DrawerSide,
DrawerOverlay: () => DrawerOverlay,
DrawerContent: () => DrawerContent,
Drawer: () => Drawer,
Divider: () => Divider,
Datepicker: () => Datepicker,
Colorpicker: () => Colorpicker,
ColorPalette: () => ColorPalette,
Checkbox: () => Checkbox,
ChatImage: () => ChatImage,
ChatHeader: () => ChatHeader,
ChatFooter: () => ChatFooter,
ChatBubble: () => ChatBubble,
Chat: () => Chat,
CarouselItem: () => CarouselItem,
Carousel: () => Carousel,
CardTitle: () => CardTitle,
CardBody: () => CardBody,
CardActions: () => CardActions,
Card: () => Card,
Calendar: () => Calendar,
Button: () => Button,
Badge: () => Badge,
Autocomplete: () => Autocomplete,
Alert: () => Alert,
Accordion: () => Accordion
});
// node_modules/sigpro/dist/sigpro.esm.min.js
var y = (e) => typeof e === "function";
var P = (e) => e && typeof e === "object";
var b = Array.isArray;
var g = typeof document < "u" ? document : null;
var k = (e) => e?._isRuntime ? e.container : e instanceof Node ? e : g.createTextNode(e == null ? "" : String(e));
var p = null;
var _ = null;
var x = false;
var A = 0;
var C = new Set;
var D = new WeakMap;
var $2 = Symbol("iter");
var B = new WeakMap;
var E = (e) => {
if (!e || e._disposed)
return;
e._disposed = true;
let o = [e];
while (o.length) {
let n = o.pop();
if (n._cleanups)
n._cleanups.forEach((i) => i()), n._cleanups.clear();
if (n._children)
n._children.forEach((i) => o.push(i)), n._children.clear();
if (n._deps)
n._deps.forEach((i) => i.delete(n)), n._deps.clear();
}
};
var N = (e) => {
if (_)
(_._cleanups ||= new Set).add(e);
};
var V = (e) => {
let o = p;
p = null;
try {
return e();
} finally {
p = o;
}
};
var T = (e, o = false) => {
let n = () => {
if (n._disposed)
return;
if (n._deps)
n._deps.forEach((c) => c.delete(n));
if (n._cleanups)
n._cleanups.forEach((c) => c()), n._cleanups.clear();
let i = p, s = _;
p = _ = n;
try {
return n._result = e();
} catch (c) {
console.error("[SigPro]", c);
} finally {
p = i, _ = s;
}
};
if (n._deps = n._cleanups = n._children = null, n._disposed = false, n._isComputed = o, n._depth = p ? p._depth + 1 : 0, n._mounts = [], n._parent = _, _)
(_._children ||= new Set).add(n);
return n;
};
var q = () => {
if (x)
return;
x = true;
let e = Array.from(C).sort((o, n) => o._depth - n._depth);
C.clear();
for (let o of e)
if (!o._disposed)
o();
x = false;
};
var W = (e) => {
A++;
try {
return e();
} finally {
if (A--, A === 0 && C.size > 0 && !x)
q();
}
};
var w = (e, o = false) => {
if (!o && p && !p._disposed)
e.add(p), (p._deps ||= new Set).add(e);
else if (o && e.size > 0) {
let n = false;
for (let i of e) {
if (i === p || i._disposed)
continue;
if (i._isComputed) {
if (i._dirty = true, i._subs)
w(i._subs, true);
} else
C.add(i), n = true;
}
if (n && !x && A === 0)
queueMicrotask(q);
}
};
var S = (e, o = null) => {
let n = new Set;
if (y(e)) {
let i, s = () => {
if (s._dirty) {
let c = p;
p = s;
try {
let t = e();
if (!Object.is(i, t))
i = t, w(n, true);
} finally {
p = c;
}
s._dirty = false;
}
return w(n), i;
};
if (s._isComputed = true, s._subs = n, s._dirty = true, s._deps = null, s._disposed = false, s.stop = () => {}, _)
N(s.stop);
return s;
}
if (o)
try {
e = JSON.parse(localStorage.getItem(o)) ?? e;
} catch (i) {}
return (...i) => {
if (i.length) {
let s = y(i[0]) ? i[0](e) : i[0];
if (!Object.is(e, s)) {
if (e = s, o)
localStorage.setItem(o, JSON.stringify(e));
w(n, true);
}
}
return w(n), e;
};
};
var I = (e) => {
if (!P(e))
return e;
let o = D.get(e);
if (o)
return o;
let n = new Map, i = (c) => {
let t = n.get(c);
if (!t)
n.set(c, t = new Set);
return t;
}, s = new Proxy(e, { get(c, t, r) {
if (typeof t !== "symbol")
w(i(t));
return I(Reflect.get(c, t, r));
}, set(c, t, r, l) {
let u = Reflect.has(c, t), a = Reflect.get(c, t, l), f = Reflect.set(c, t, r, l);
if (f && !Object.is(a, r)) {
if (w(i(t), true), !u)
w(i($2), true);
}
return f;
}, deleteProperty(c, t) {
let r = Reflect.deleteProperty(c, t);
if (r)
w(i(t), true), w(i($2), true);
return r;
}, ownKeys(c) {
return w(i($2)), Reflect.ownKeys(c);
} });
return D.set(e, s), s;
};
var R = (e, o) => {
if (o === undefined) {
let i = T(e);
return i(), () => E(i);
}
let n = T(() => {
let i = Array.isArray(e) ? e.map((s) => s()) : e();
V(() => o(i));
});
return n(), () => E(n);
};
var L = (e) => {
if (!e)
return;
if (e._cleanups)
e._cleanups.forEach((o) => o()), e._cleanups.clear();
if (e._ownerEffect)
E(e._ownerEffect);
if (e.childNodes)
e.childNodes.forEach((o) => L(o));
};
var F = /^\s*(javascript|data|vbscript):/i;
var J = (e) => e === "src" || e === "href" || e.startsWith("on");
var M = (e, o) => {
if (o == null || o === false)
return null;
if (J(e)) {
let n = String(o);
if (F.test(n))
return console.warn(`[SigPro] Bloqueado protocolo peligroso en ${e}`), "#";
}
return o;
};
var O = (e, o = {}, n = []) => {
if (o instanceof Node || b(o) || !P(o))
n = o, o = {};
if (y(e)) {
let t = T(() => {
let a = e(o, { children: n, emit: (f, ...h) => o[`on${f[0].toUpperCase()}${f.slice(1)}`]?.(...h) });
return t._result = a, a;
});
t();
let r = t._result;
if (r == null)
return null;
let l = r instanceof Node || b(r) && r.every((a) => a instanceof Node) ? r : g.createTextNode(String(r)), u = (a) => {
if (P(a) && !a._isRuntime)
a._mounts = t._mounts || [], a._cleanups = t._cleanups || new Set, a._ownerEffect = t;
};
return b(l) ? l.forEach(u) : u(l), l;
}
let i = /^(svg|path|circle|rect|line|poly(line|gon)|g|defs|text(path)?|tspan|use|symbol|image|marker|ellipse)$/i.test(e), s = i ? g.createElementNS("http://www.w3.org/2000/svg", e) : g.createElement(e);
s._cleanups = new Set;
for (let t in o) {
if (!o.hasOwnProperty(t))
continue;
let r = o[t];
if (t === "ref") {
y(r) ? r(s) : r.current = s;
continue;
}
if (i && t.startsWith("xlink:")) {
r == null ? s.removeAttributeNS("http://www.w3.org/1999/xlink", t.slice(6)) : s.setAttributeNS("http://www.w3.org/1999/xlink", t.slice(6), r);
continue;
}
if (t.startsWith("on")) {
let l = t.slice(2).toLowerCase();
s.addEventListener(l, r);
let u = () => s.removeEventListener(l, r);
s._cleanups.add(u), N(u);
} else if (y(r)) {
let l = T(() => {
let u = M(t, r());
if (t === "class")
s.className = u || "";
else if (u == null)
s.removeAttribute(t);
else if (t in s && !i)
s[t] = u;
else
s.setAttribute(t, u === true ? "" : u);
});
if (l(), s._cleanups.add(() => E(l)), N(() => E(l)), /^(INPUT|TEXTAREA|SELECT)$/.test(s.tagName) && (t === "value" || t === "checked")) {
let u = t === "checked" ? "change" : "input";
s.addEventListener(u, (a) => r(a.target[t]));
}
} else {
let l = M(t, r);
if (l != null)
if (t in s && !i)
s[t] = l;
else
s.setAttribute(t, l === true ? "" : l);
}
}
let c = (t) => {
if (b(t))
return t.forEach(c);
if (y(t)) {
let r = g.createTextNode("");
s.appendChild(r);
let l = [], u = T(() => {
let a = t(), f = (b(a) ? a : [a]).map(k);
l.forEach((d) => {
if (d._isRuntime)
d.destroy();
else
L(d);
if (d.parentNode)
d.remove();
});
let h = r;
for (let d = f.length - 1;d >= 0; d--) {
let m = f[d];
if (m.parentNode !== h.parentNode)
h.parentNode?.insertBefore(m, h);
if (m._mounts)
m._mounts.forEach((U) => U());
h = m;
}
l = f;
});
u(), s._cleanups.add(() => E(u)), N(() => E(u));
} else {
let r = k(t);
if (s.appendChild(r), r._mounts)
r._mounts.forEach((l) => l());
}
};
return c(n), s;
};
var j = (e) => {
let o = new Set, n = _, i = p, s = g.createElement("div");
s.style.display = "contents", s.setAttribute("role", "presentation"), _ = { _cleanups: o }, p = null;
let c = (t) => {
if (!t)
return;
if (t._isRuntime)
o.add(t.destroy), s.appendChild(t.container);
else if (b(t))
t.forEach(c);
else
s.appendChild(t instanceof Node ? t : g.createTextNode(String(t == null ? "" : t)));
};
try {
c(e({ onCleanup: (t) => o.add(t) }));
} finally {
_ = n, p = i;
}
return { _isRuntime: true, container: s, destroy: () => {
o.forEach((t) => t()), L(s), s.remove();
} };
};
var z = (e, o, n = null) => {
let i = g.createTextNode(""), s = O("div", { style: "display:contents" }, [i]), c = null;
return R(() => !!(y(e) ? e() : e), (t) => {
if (c)
c.destroy(), c = null;
let r = t ? o : n;
if (r)
c = j(() => y(r) ? r() : r), s.insertBefore(c.container, i);
}), N(() => c?.destroy()), s;
};
var G = ({ name: e, duration: o = 200, scale: n, slide: i, rotate: s, blur: c }, t) => {
let r = typeof t === "function" ? t() : t;
if (!(r instanceof Node))
return r;
if (e)
return r.style.animation = `${e}-in ${o}ms`, r;
let l = n || i || s || c, u = [n ? "scale(0.95)" : "", i ? "translateY(-10px)" : "", s ? "rotate(-2deg)" : ""].filter(Boolean).join(" ");
if (r.style.transition = `all ${o}ms ease`, r.style.opacity = "0", l)
r.style.transform = u;
if (c)
r.style.filter = "blur(4px)";
return requestAnimationFrame(() => {
if (r.style.opacity = "1", l)
r.style.transform = "none";
if (c)
r.style.filter = "none";
}), r;
};
var K = (e, o, n) => {
let i = g.createTextNode(""), s = O("div", { style: "display:contents" }, [i]), c = new Map;
return R(() => (y(e) ? e() : e) || [], (t) => {
let r = new Map, l = [], u = t || [];
for (let f = 0;f < u.length; f++) {
let h = u[f], d = n ? h?.[n] ?? f : h?.id ?? f, m = c.get(d);
if (!m)
m = j(() => o(h, f));
else
c.delete(d);
r.set(d, m), l.push(m);
}
c.forEach((f) => f.destroy());
let a = i;
for (let f = l.length - 1;f >= 0; f--) {
let d = l[f].container;
if (d.nextSibling !== a)
s.insertBefore(d, a);
a = d;
}
c = r;
}), s;
};
var v = (e) => {
let o = () => window.location.hash.slice(1) || "/", n = S(o()), i = () => n(o());
window.addEventListener("hashchange", i), N(() => window.removeEventListener("hashchange", i));
let s = O("div", { class: "router-hook" }), c = null;
return R([n], () => {
let t = n(), r = e.find((l) => {
let u = l.path.split("/").filter(Boolean), a = t.split("/").filter(Boolean);
return u.length === a.length && u.every((f, h) => f[0] === ":" || f === a[h]);
}) || e.find((l) => l.path === "*");
if (r) {
c?.destroy();
let l = {};
r.path.split("/").filter(Boolean).forEach((u, a) => {
if (u[0] === ":")
l[u.slice(1)] = t.split("/").filter(Boolean)[a];
}), v.params(l), c = j(() => y(r.component) ? r.component(l) : r.component), s.replaceChildren(c.container);
}
}), s;
};
v.params = S({});
v.to = (e) => window.location.hash = e.replace(/^#?\/?/, "#/");
v.back = () => window.history.back();
v.path = () => window.location.hash.replace(/^#/, "") || "/";
var Q = ({ url: e, method: o = "GET", headers: n = {} }) => {
let i = S(false), s = S(null), c = S(null), t = null, r = null;
return { run: async (a = null) => {
t?.abort(), clearTimeout(r), t = new AbortController, r = setTimeout(() => t.abort(), 1e4), i(true), s(null);
try {
let f = a instanceof FormData, h = await fetch(e, { method: o, headers: f ? n : { "Content-Type": "application/json", ...n }, body: f ? a : a ? JSON.stringify(a) : undefined, signal: t.signal }), d = await h.text(), m = d ? JSON.parse(d) : null;
if (!h.ok)
throw Error(m?.message || h.statusText);
return c(m), m;
} catch (f) {
if (f.name !== "AbortError")
s(f.message);
throw f;
} finally {
i(false), clearTimeout(r), t = null, r = null;
}
}, abort: () => t?.abort(), loading: i, error: s, data: c };
};
var H = (e, o) => {
let n = typeof o === "string" ? g.querySelector(o) : o;
if (!n)
return;
if (B.has(n))
B.get(n).destroy();
let i = j(y(e) ? e : () => e);
return n.replaceChildren(i.container), B.set(n, i), i;
};
var X = Object.freeze({ $: S, $$: I, watch: R, h: O, when: z, each: K, fx: G, router: v, req: Q, mount: H, batch: W });
if (typeof window < "u")
Object.assign(window, X), "a abbr article aside audio b blockquote br button canvas caption cite code col colgroup datalist dd del details dfn dialog div dl dt em embed fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 header hr i iframe img input ins kbd label legend li main mark meter nav object ol optgroup option output p picture pre progress section select slot small source span strong sub summary sup svg table tbody td template textarea tfoot th thead time tr u ul video".split(" ").forEach((e) => {
window[e] = (o, n) => O(e, o, n);
});
// sigpro-helpers.js
var get = (val) => typeof val === "function" ? val() : val;
var getBy = (item, field = "label") => item && typeof item === "object" ? item[field] : item;
var cls = (...classes) => classes.filter(Boolean).join(" ").trim();
var isFn = (f) => typeof f === "function";
var filterBy = (items, query, field = "label", q2 = String(query).toLowerCase()) => !query ? get(items) : get(items).filter((item) => String(item && typeof item === "object" ? item[field] : item).toLowerCase().includes(q2));
var rand = (r) => `${r}-${Math.random().toString(36).slice(2, 9)}`;
var close = () => document.activeElement?.blur();
// sigpro-components.js
var Accordion = (p2) => {
const name = p2.name || rand("acc");
return K(p2.items, (it) => {
return O("div", { class: cls("collapse", p2.class) }, [
O("input", { type: "radio", name, checked: it.open || undefined }),
it.title ? O("div", { class: cls("collapse-title", `${it.classTitle ?? " font-semibold"}`) }, it.title) : null,
it.content ? O("div", { class: cls("collapse-content text-sm", `${it.classContent ?? " font-semibold"}`) }, it.content) : null
]);
});
};
var Alert = (p2, c) => O("div", { ...p2, class: cls("alert", p2.class) }, c);
var Autocomplete = ({ items, value, onselect, placeholder = "...", ...props }) => {
const query = S(get(value) || "");
const filtered = S(() => filterBy(items, query()));
const pick = (item) => {
const display = getBy(item);
const actual = typeof item === "string" ? item : item.value;
query(display);
if (isFn(value))
value(actual);
onselect?.(item);
close();
};
return Dropdown({ class: "w-full" }, [
O("div", { tabindex: "0", role: "button", class: "w-full" }, Input({
...props,
placeholder,
value: query,
left: O("span", { class: "icon-[lucide--search]" }),
oninput: (e) => {
query(e.target.value);
if (isFn(value))
value(e.target.value);
}
})),
DropdownContent({ class: "p-2 bg-base-100 rounded-box shadow-xl w-full max-h-60 overflow-y-auto border border-base-300 z-50" }, O("ul", { class: "menu flex-col flex-nowrap w-full p-0" }, [
K(filtered, (item) => O("li", {}, [
O("a", {
onmousedown: (e) => e.preventDefault(),
onclick: () => pick(item)
}, getBy(item))
]), (item) => getBy(item)),
() => filtered().length === 0 ? O("li", { class: "p-4 opacity-50 text-center" }, "Sin resultados") : null
]))
]);
};
var Badge = (p2, c) => O("span", { ...p2, class: cls("badge", p2.class) }, c);
var Button = (p2, c) => O("button", { ...p2, class: cls("btn", p2.class) }, c);
var Calendar = (p2) => {
const internalDate = S(new Date);
const hoverDate = S(null);
const startHour = S(0);
const endHour = S(0);
const now = new Date;
const todayStr = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, "0")}-${String(now.getDate()).padStart(2, "0")}`;
const fmt = (d) => `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
const rangeMode = () => get(p2.range) === true;
const current = () => get(p2.value);
const selectDate = (date) => {
const s = fmt(date);
const v2 = current();
if (rangeMode()) {
if (!v2?.start || v2.start && v2.end) {
p2.onChange?.({ start: s, end: null, ...p2.hour && { startHour: startHour() } });
} else {
const start = v2.start;
const nv = s < start ? { start: s, end: start } : { start, end: s };
if (p2.hour) {
nv.startHour = v2.startHour ?? startHour();
nv.endHour = endHour();
}
p2.onChange?.(nv);
}
} else {
p2.onChange?.(p2.hour ? `${s}T${String(startHour()).padStart(2, "0")}:00:00` : s);
}
};
const move = (m) => {
const d = internalDate();
internalDate(new Date(d.getFullYear(), d.getMonth() + m, 1));
};
const moveYear = (y2) => {
const d = internalDate();
internalDate(new Date(d.getFullYear() + y2, d.getMonth(), 1));
};
const HourSlider = ({ value: hVal, onChange: onH }) => O("div", { class: "flex-1" }, [
O("div", { class: "flex gap-2 items-center" }, [
O("input", { type: "range", min: 0, max: 23, value: hVal, class: "range range-xs flex-1", oninput: (e) => onH(+e.target.value) }),
O("span", { class: "text-sm font-mono min-w-[48px] text-center" }, () => String(get(hVal)).padStart(2, "0") + ":00")
])
]);
return O("div", {
class: cls("p-4 bg-base-100 border border-base-300 shadow-2xl rounded-box w-80 select-none", p2.class)
}, [
O("div", { class: "flex justify-between items-center mb-4 gap-1" }, [
O("div", { class: "flex gap-0.5" }, [
O("button", { type: "button", class: "btn btn-ghost btn-xs px-1", onclick: () => moveYear(-1) }, O("span", { class: "icon-[lucide--chevrons-left]" })),
O("button", { type: "button", class: "btn btn-ghost btn-xs px-1", onclick: () => move(-1) }, O("span", { class: "icon-[lucide--chevron-left]" }))
]),
O("span", { class: "font-bold uppercase flex-1 text-center" }, () => internalDate().toLocaleString("es-ES", { month: "short", year: "numeric" })),
O("div", { class: "flex gap-0.5" }, [
O("button", { type: "button", class: "btn btn-ghost btn-xs px-1", onclick: () => move(1) }, O("span", { class: "icon-[lucide--chevron-right]" })),
O("button", { type: "button", class: "btn btn-ghost btn-xs px-1", onclick: () => moveYear(1) }, O("span", { class: "icon-[lucide--chevrons-right]" }))
])
]),
O("div", { class: "grid grid-cols-7 gap-1", onmouseleave: () => hoverDate(null) }, [
...["L", "M", "X", "J", "V", "S", "D"].map((d) => O("div", { class: "text-[10px] opacity-40 font-bold text-center" }, d)),
() => {
const d = internalDate(), y2 = d.getFullYear(), m = d.getMonth();
const firstDay = new Date(y2, m, 1).getDay();
const offset = firstDay === 0 ? 6 : firstDay - 1;
const dim = new Date(y2, m + 1, 0).getDate();
const cells = [];
for (let i = 0;i < offset; i++)
cells.push(O("div"));
for (let i = 1;i <= dim; i++) {
const date = new Date(y2, m, i), ds = fmt(date);
cells.push(O("button", {
type: "button",
class: () => {
const v2 = current(), h = hoverDate();
const isStart = typeof v2 === "string" ? v2.split("T")[0] === ds : v2?.start === ds;
const isEnd = v2?.end === ds;
let inRange = false;
if (rangeMode() && v2?.start) {
const start = v2.start;
if (!v2.end && h)
inRange = ds > start && ds <= h || ds < start && ds >= h;
else if (v2.end)
inRange = ds > start && ds < v2.end;
}
const base = "btn btn-xs p-0 aspect-square min-h-0 h-auto font-normal relative";
const st = isStart || isEnd ? "btn-primary z-10" : inRange ? "bg-primary/20 border-none rounded-none" : "btn-ghost";
const today = ds === todayStr ? "ring-1 ring-primary ring-inset font-black text-primary" : "";
return cls(base, st, today);
},
onmouseenter: () => rangeMode() && hoverDate(ds),
onclick: () => selectDate(date)
}, i.toString()));
}
return cells;
}
]),
p2.hour ? O("div", { class: "mt-3 pt-2 border-t border-base-300" }, rangeMode() ? O("div", { class: "flex gap-4" }, [HourSlider({ value: startHour, onChange: (h) => startHour(h) }), HourSlider({ value: endHour, onChange: (h) => endHour(h) })]) : HourSlider({ value: startHour, onChange: (h) => startHour(h) })) : null
]);
};
var Card = (p2, c) => O("div", { ...p2, class: cls("card", p2.class) }, c);
var CardTitle = (p2, c) => O("div", { ...p2, class: cls("card-title", p2.class) }, c);
var CardBody = (p2, c) => O("div", { ...p2, class: cls("card-body", p2.class) }, c);
var CardActions = (p2, c) => O("div", { ...p2, class: cls("card-actions", p2.class) }, c);
var Carousel = (p2, c) => O("div", { ...p2, class: cls("carousel", p2.class) }, c);
var CarouselItem = (p2, c) => O("div", { ...p2, class: cls("carousel-item", p2.class) }, c);
var Chat = (p2, c) => O("div", { ...p2, class: cls("chat", p2.class) }, c);
var ChatBubble = (p2, c) => O("div", { ...p2, class: cls("chat-bubble", p2.class) }, c);
var ChatFooter = (p2, c) => O("div", { ...p2, class: cls("chat-footer", p2.class) }, c);
var ChatHeader = (p2, c) => O("div", { ...p2, class: cls("chat-header", p2.class) }, c);
var ChatImage = (p2, c) => O("div", { ...p2, class: cls("chat-image avatar", p2.class) }, O("div", { class: "w-10 rounded-full" }, typeof c === "string" ? O("img", { src: c, alt: "avatar" }) : c));
var Checkbox = (p2) => O("input", { ...p2, type: "checkbox", class: cls("checkbox", p2.class) });
var Colorpicker = (p2) => {
const current = () => get(p2.value) || "#000000";
return Dropdown({}, [
DropdownButton({ class: "btn" }, [
O("div", { class: "size-5 rounded-sm", style: () => `background-color: ${current()}` }),
p2.label && O("span", {}, p2.label)
]),
DropdownContent({ class: "p-3 bg-base-100 rounded-box shadow-xl w-64" }, ColorPalette({ value: p2.value, onchange: (c) => {
isFn(p2.value) ? p2.value(c) : p2.onchange?.(c);
} }))
]);
};
var ColorPalette = (p2) => {
const current = () => get(p2.value) || "#000000";
const palette = [
"#000",
"#1A1A1A",
"#333",
"#4D4D4D",
"#666",
"#808080",
"#B3B3B3",
"#FFF",
"#450a0a",
"#7f1d1d",
"#991b1b",
"#b91c1c",
"#dc2626",
"#ef4444",
"#f87171",
"#fca5a5",
"#431407",
"#7c2d12",
"#9a3412",
"#c2410c",
"#ea580c",
"#f97316",
"#fb923c",
"#ffedd5",
"#713f12",
"#a16207",
"#ca8a04",
"#eab308",
"#facc15",
"#fde047",
"#fef08a",
"#fff9c4",
"#064e3b",
"#065f46",
"#059669",
"#10b981",
"#34d399",
"#4ade80",
"#84cc16",
"#d9f99d",
"#082f49",
"#075985",
"#0284c7",
"#0ea5e9",
"#38bdf8",
"#7dd3fc",
"#22d3ee",
"#cffafe",
"#1e1b4b",
"#312e81",
"#4338ca",
"#4f46e5",
"#6366f1",
"#818cf8",
"#a5b4fc",
"#e0e7ff",
"#2e1065",
"#4c1d95",
"#6d28d9",
"#7c3aed",
"#8b5cf6",
"#a855f7",
"#d946ef",
"#fae8ff"
];
const pick = (c) => isFn(p2.value) ? p2.value(c) : p2.onchange?.(c);
return O("div", { class: "grid grid-cols-8 gap-1" }, palette.map((c) => O("button", {
type: "button",
style: `background-color: ${c}`,
class: () => {
const act = current().toLowerCase() === c.toLowerCase();
return `size-6 rounded-sm cursor-pointer transition-all hover:scale-125 hover:z-10 active:scale-95 outline-none border border-black/5 p-0 min-h-0 ${act ? "ring-2 ring-offset-1 ring-primary z-10 scale-110" : ""}`;
},
onclick: () => {
pick(c);
close();
}
})));
};
var Datepicker = (p2) => {
const displayValue = S("");
const rangeMode = () => get(p2.range) === true;
R(() => {
const v2 = get(p2.value);
if (!v2)
return displayValue("");
let text = "";
if (typeof v2 === "string") {
text = p2.hour && v2.includes("T") ? v2.replace("T", " ") : v2;
} else if (v2.start && v2.end) {
const startStr = p2.hour && v2.startHour != null ? `${v2.start} ${String(v2.startHour).padStart(2, "0")}:00` : v2.start;
const endStr = p2.hour && v2.endHour != null ? `${v2.end} ${String(v2.endHour).padStart(2, "0")}:00` : v2.end;
text = `${startStr} - ${endStr}`;
} else if (v2.start) {
const startStr = p2.hour && v2.startHour != null ? `${v2.start} ${String(v2.startHour).padStart(2, "0")}:00` : v2.start;
text = `${startStr}...`;
}
displayValue(text);
});
const handleChange = (val) => {
if (isFn(p2.value))
p2.value(val);
else
p2.onChange?.(val);
if (!rangeMode() || val?.end != null)
close();
};
return Dropdown({ class: cls("w-full", p2.class) }, [
O("label", {
tabindex: "0",
role: "button",
class: "input input-bordered flex items-center gap-2 cursor-pointer"
}, [
O("span", { class: "icon-[lucide--calendar] shrink-0" }),
O("span", {
class: () => `grow text-left truncate ${!displayValue() ? "opacity-50" : ""}`
}, () => displayValue() || p2.placeholder || (rangeMode() ? "Seleccionar rango..." : "Seleccionar fecha...")),
() => displayValue() ? O("button", {
type: "button",
class: "btn btn-ghost btn-xs btn-circle -mr-2",
onmousedown: (e) => {
e.preventDefault();
e.stopPropagation();
if (isFn(p2.value))
p2.value(null);
else
p2.onChange?.(null);
displayValue("");
}
}, O("span", { class: "icon-[lucide--x] opacity-50" })) : null
]),
DropdownContent({ class: "p-0 bg-base-100 rounded-box shadow-xl" }, Calendar({
value: p2.value,
range: rangeMode(),
hour: p2.hour,
onChange: handleChange
}))
]);
};
var Drawer = (p2, c) => div({ ...p2, class: cls("drawer", p2.class) }, c);
var DrawerToggle = (p2) => input({ ...p2, type: "checkbox", class: "drawer-toggle", checked: () => get(p2.checked), onchange: (e) => isFn(p2.checked) && p2.checked(e.target.checked) });
var DrawerContent = (p2, c) => div({ ...p2, class: cls("drawer-content", p2.class) }, c);
var DrawerSide = (p2, c) => div({ ...p2, class: cls("drawer-side", p2.class) }, c);
var DrawerOverlay = (p2) => label({ ...p2, for: p2.for, class: cls("drawer-overlay", p2.class) });
var Divider = (p2) => O("div", { ...p2, class: cls("divider", p2.class) });
var Dropdown = (p2, c) => O("div", { ...p2, class: cls("dropdown", p2.class) }, c);
var DropdownButton = (p2, c) => O("div", { ...p2, tabindex: "0", role: "button", class: cls("btn", p2.class) }, c);
var DropdownContent = (p2, c) => O("div", { ...p2, tabindex: "0", class: cls("dropdown-content", p2.class) }, c);
var Fab = (p2, c) => O("div", { class: "fab" }, [O("div", { tabindex: "0", role: "button", class: cls("btn", p2.class) }, Icon(p2.icon)), c]);
var Fieldset = (p2, c) => O("fieldset", { class: cls("fieldset", p2.class) }, [O("legend", { class: "fieldset-legend" }, p2.label), c]);
var Fileinput = (p2) => {
const files = S([]);
const drag = S(false);
const error = S(null);
const maxBytes = (p2.max || 2) * 1024 * 1024;
const process = (fileList) => {
const arr = Array.from(fileList);
error(null);
if (arr.some((f) => f.size > maxBytes)) {
error(`Máx ${p2.max || 2}MB`);
return;
}
const updated = [...files(), ...arr];
files(updated);
if (isFn(p2.onselect))
p2.onselect(updated);
else if (isFn(p2.value))
p2.value(updated);
};
const remove = (idx) => {
const updated = files().filter((_2, i) => i !== idx);
files(updated);
if (isFn(p2.onselect))
p2.onselect(updated);
else if (isFn(p2.value))
p2.value(updated);
};
return O("div", { class: cls("fieldset w-full p-0", p2.class) }, [
O("label", {
class: () => `relative flex items-center justify-between w-full h-12 px-4 border-2 border-dashed rounded-lg cursor-pointer transition-all duration-200 ${drag() ? "border-primary bg-primary/10" : "border-base-content/20 bg-base-100 hover:bg-base-200"}`,
ondragover: (e) => {
e.preventDefault();
drag(true);
},
ondragleave: () => drag(false),
ondrop: (e) => {
e.preventDefault();
drag(false);
process(e.dataTransfer.files);
}
}, [
O("div", { class: "flex items-center gap-3 w-full" }, [
O("span", { class: "icon-[lucide--upload]" }),
O("span", { class: "text-sm opacity-70 truncate grow text-left" }, "Arrastra o selecciona archivos..."),
O("span", { class: "text-[10px] opacity-40 shrink-0" }, `Máx ${p2.max || 2}MB`)
]),
O("input", {
type: "file",
multiple: true,
accept: p2.accept || "*",
class: "hidden",
onchange: (e) => process(e.target.files)
})
]),
() => error() && O("span", { class: "text-[10px] text-error mt-1 px-1 font-medium" }, error()),
z(() => files().length > 0, () => O("ul", { class: "mt-2 space-y-1" }, K(files, (file, idx) => O("li", { class: "flex items-center justify-between p-1.5 pl-3 text-xs bg-base-200/50 rounded-md border border-base-300" }, [
O("div", { class: "flex items-center gap-2 truncate" }, [
O("span", { class: "opacity-50" }, "\uD83D\uDCC4"),
O("span", { class: "truncate font-medium max-w-[200px]" }, file.name),
O("span", { class: "text-[9px] opacity-40" }, `(${(file.size / 1024).toFixed(0)} KB)`)
]),
O("button", {
type: "button",
class: "btn btn-ghost btn-xs btn-circle",
onclick: (e) => {
e.preventDefault();
remove(idx);
}
}, O("span", { class: "icon-[lucide--x]" }))
]))))
]);
};
var Icon = (p2) => O("span", { class: p2.startsWith("icon-") ? p2 : "" }, p2.startsWith("icon-") ? null : p2);
var Indicator = (p2, c) => O("div", { ...p2, class: cls("indicator", p2.class) }, [p2.value && O("span", { class: cls("indicator-item badge", p2.class) }, p2.value), c]);
var Input = (p2) => {
const { label: label2, icon, float, placeholder, value, left, right, rule, hint, content, ...rest } = p2;
const showPassword = S(false);
const isPassword = p2.type === "password";
const pattern = rule ?? null;
const inputType = () => isPassword ? get(showPassword) ? "text" : "password" : p2.type || "search";
return O("label", { class: float ? "floating-label" : "" }, [
float ? O("span", {}, label2) : null,
O("label", { pattern, class: () => cls("input validator", p2.class) }, [
label2 && !float ? O("span", { class: "label" }, label2) : null,
left ?? null,
O("input", { ...rest, type: inputType, class: "grow", pattern, placeholder: placeholder || label2 || " ", value }),
right ?? null,
isPassword ? Swap({ class: "ml-2" }, [
SwapToggle({ value: showPassword, class: "swap-rotate" }),
SwapOn({}, Icon("icon-[lucide--eye]")),
SwapOff({}, Icon("icon-[lucide--eye-off]"))
]) : null
]),
hint ? O("div", { class: "validator-hint" }, hint) : null
]);
};
var Kbd = (p2, c) => O("kbd", { ...p2, class: cls("kbd", p2.class) }, c);
var List = (p2, c) => O("ul", { ...p2, class: cls("list", p2.class) }, c);
var ListRows = (p2) => () => (get(p2.items) || []).map((item, idx) => O("li", { class: cls("list-row", p2.class, item?.class) }, typeof p2.render === "function" ? p2.render(item, idx) : item));
var Loading = (p2, c) => O("span", { ...p2, class: cls("loading loading-spinner", p2.class) }, c);
var Menu = (p2) => {
if (p2.children !== undefined)
return O("ul", { class: cls("menu", p2.class), ...p2 }, p2.children);
const { items } = p2;
const render = (item) => item.children ? O("li", {}, O("details", { open: item.open || undefined }, [
O("summary", {}, getBy(item)),
O("ul", {}, K(() => get(item.children) || [], render))
])) : O("li", {}, O("a", {
href: item.href,
onclick: item.onclick ? (e) => {
if (!item.href)
e.preventDefault();
item.onclick(e);
} : null
}, getBy(item)));
return O("ul", { class: cls("menu", p2.class) }, K(() => get(items) || [], render));
};
var Modal = (p2) => {
let dialogRef = null;
R(() => {
const isOpen = get(p2.open);
if (!dialogRef)
return;
isOpen ? dialogRef.showModal() : dialogRef.close();
});
const close2 = () => isFn(p2.open) && p2.open(false);
return O("dialog", {
...p2,
ref: (el) => dialogRef = el,
class: cls("modal", p2.class),
onclose: close2,
oncancel: close2
}, [
O("div", { class: "modal-box" }, [
p2.title && O("h3", { class: "text-lg font-bold" }, p2.title),
p2.children,
O("div", { class: "modal-action" }, [
p2.actions || Button({ class: "btn", onclick: close2 }, "Cerrar")
])
]),
O("form", { method: "dialog", class: "modal-backdrop" }, [
O("button", {}, "close")
])
]);
};
var Navbar = (p2, c) => O("div", { ...p2, class: cls("navbar", p2.class) }, c);
var Progress = (p2) => O("progress", { ...p2, class: cls("progress", p2.class) });
var Radial = (p2, c) => O("div", { ...p2, class: cls("radial-progress", p2.class), style: `--value:${p2.value ?? 0};${p2.style ?? ""}`, role: "progressbar", "aria-valuenow": p2.value ?? 0 }, c ?? `${p2.value ?? 0}%`);
var Radio = (p2) => O("input", { ...p2, type: "radio", class: cls("radio", p2.class) });
var Range = (p2) => O("input", { ...p2, type: "range", class: cls("range", p2.class) });
var Rating = (p2, c) => O("div", { ...p2, class: "rating" }, c);
var RatingItems = (p2) => [...Array(p2.count)].map((_2, i) => O("input", { class: cls("mask", p2.class), name: p2.name, type: "radio", checked: () => get(p2.value) === i, onchange: () => isFn(p2.value) ? p2.value(i) : p2.onchange?.(i) }));
var Select = (p2, c) => {
if (c !== undefined)
return O("select", { class: cls("select", p2.class), ...p2 }, c);
const { label: label2, float, placeholder, placeholderDisabled = true, value, left, right, hint, items, keyFn, ...rest } = p2;
const opts = () => {
const raw = get(items) || [];
const ph = placeholder ? [{ disabled: placeholderDisabled, label: placeholder, value: "" }] : [];
return [...ph, ...raw];
};
return O("label", { class: float ? "floating-label" : "" }, [
float ? O("span", {}, label2) : null,
O("label", { class: cls("select", rest.class) }, [
!float && label2 ? O("span", { class: "label" }, label2) : null,
left ?? null,
O("select", {
value: () => get(value),
onchange: (e) => isFn(value) ? value(e.target.value) : rest.onchange?.(e)
}, K(opts, (item) => {
const val = getBy(item, item.value !== undefined ? "value" : undefined);
const lab = getBy(item, "label");
return O("option", { value: val, disabled: item.disabled || undefined }, lab);
})),
right ?? null
]),
hint ? O("div", { class: "validator-hint" }, hint) : null
]);
};
var Skeleton = (p2) => O("div", { ...p2, class: cls("skeleton", p2.class) });
var SkeletonText = (p2) => O("span", { ...p2, class: cls("skeleton skeleton-text", p2.class) });
var Stack = (p2, c) => O("div", { ...p2, class: cls("stack", p2.class) }, c);
var Stats = (p2, c) => O("div", { ...p2, class: cls("stats shadow", p2.class) }, c);
var Stat = (p2) => O("div", { ...p2, class: cls("stat", p2.class) }, [
p2.title ? O("div", { class: "stat-title" }, p2.title) : null,
p2.value ? O("div", { class: "stat-value" }, p2.value) : null,
p2.desc ? O("div", { class: "stat-desc" }, p2.desc) : null
]);
var Steps = (p2, c) => O("ul", { ...p2, class: cls("steps", p2.class) }, c);
var Step = (p2, c) => O("li", { ...p2, class: cls("step", p2.class), "data-content": p2.dataContent }, c);
var Swap = (p2, c) => O("label", { ...p2, class: cls("swap", p2.class) }, c);
var SwapToggle = (p2) => O("input", { type: "checkbox", checked: () => get(p2.value), onchange: (e) => isFn(p2.value) && p2.value(e.target.checked), class: p2.class });
var SwapOn = (p2, c) => O("div", { ...p2, class: cls("swap-on", p2.class) }, c);
var SwapOff = (p2, c) => O("div", { ...p2, class: cls("swap-off", p2.class) }, c);
var Table = (p2, c) => O("table", { ...p2, class: cls("table", p2.class) }, c);
var TableItems = ({ items, columns = [], header = true }) => {
const head = header !== false && columns.some((c) => c.label) ? O("thead", {}, O("tr", {}, columns.map((c) => O("th", { class: c.class }, c.label)))) : null;
const body = O("tbody", {}, () => {
const list = get(items) || [];
return list.map((it, idx) => O("tr", {}, columns.map((c) => {
const v2 = c.render ? c.render(it, idx) : it[c.key];
return O("td", { class: c.class }, v2);
})));
});
return [head, body].filter(Boolean);
};
var Tabs = (p2, c) => {
if (!p2.items) {
const { class: className2, ...rest2 } = p2;
return O("div", { ...rest2, class: cls("tabs", className2) }, c);
}
const { items, activeIndex, onClose, class: className, ...rest } = p2;
const get2 = (x2) => isFn(x2) ? x2() : x2;
const closeH = onClose || (isFn(items) ? (idx, item) => {
const arr = get2(items);
const newArr = arr.filter((_2, i) => i !== idx);
items(newArr);
if (activeIndex() >= newArr.length)
activeIndex(Math.max(0, newArr.length - 1));
} : null);
return O("div", { ...rest, class: cls("tabs", className) }, () => {
const list = get2(items) || [];
return list.flatMap((it, idx) => {
const isActive = () => activeIndex() === idx;
const button = O("button", {
class: () => `tab ${isActive() ? "tab-active" : ""} ${it.class || ""}`,
onclick: (e) => {
e.preventDefault();
activeIndex(idx);
it.onclick?.(e);
}
}, [
getBy(it),
it.closable ? O("span", {
class: "ml-1 inline-flex items-center justify-center w-4 h-4 rounded-full hover:bg-base-300 text-base-content/60 hover:text-base-content cursor-pointer",
onclick: (e) => {
e.stopPropagation();
closeH?.(idx, it);
}
}, O("span", { class: "icon-[lucide--x] w-3 h-3" })) : null
]);
const contentDiv = O("div", {
class: "tab-content bg-base-100 border-base-300 p-6",
style: () => `display: ${isActive() ? "block" : "none"};`
}, isFn(it.content) ? it.content() : it.content);
return [button, contentDiv];
});
});
};
var Textarea = (p2) => O("textarea", { ...p2, class: cls("textarea", p2.class) });
var Textrotate = (p2, c) => O("span", { ...p2, class: cls("text-rotate", p2.class) }, c);
var Timeline = (p2, c) => O("ul", { ...p2, class: cls("timeline", p2.class) }, c);
var Toast = (message, type = "alert-success", duration = 3500) => {
let container = document.getElementById("sigpro-toast-container");
if (!container) {
container = O("div", {
id: "sigpro-toast-container",
class: "fixed top-0 right-0 z-[9999] p-4 flex flex-col gap-2 pointer-events-none"
});
document.body.appendChild(container);
}
const host = O("div", { style: "display: contents" });
container.appendChild(host);
let closeFn, timer, enterTimer;
const ToastComponent = () => {
const visible = S(false);
const leaving = S(false);
closeFn = () => {
if (leaving())
return;
clearTimeout(timer);
clearTimeout(enterTimer);
leaving(true);
setTimeout(() => {
instance.destroy();
host.remove();
if (!container.hasChildNodes())
container.remove();
}, 300);
};
enterTimer = setTimeout(() => visible(true), 0);
const content = typeof message === "function" ? get(message) : message;
const msgNode = typeof content === "string" ? O("span", {}, content) : content;
return O("div", {
class: () => {
if (leaving())
return `alert alert-soft ${type} shadow-lg transition-all duration-300 translate-x-full opacity-0 pointer-events-auto`;
if (visible())
return `alert alert-soft ${type} shadow-lg transition-all duration-300 translate-x-0 opacity-100 pointer-events-auto`;
return `alert alert-soft ${type} shadow-lg transition-all duration-300 translate-x-10 opacity-0 pointer-events-auto`;
}
}, [
msgNode,
O("button", {
class: "btn btn-xs btn-circle btn-ghost",
onclick: closeFn
}, O("span", { class: "icon-[lucide--x]" }))
]);
};
const instance = H(ToastComponent, host);
if (duration > 0)
timer = setTimeout(closeFn, duration);
return closeFn;
};
var Toggle = (p2) => O("input", { ...p2, type: "checkbox", class: cls("toggle", p2.class) });
var Tooltip = (p2, c) => O("div", { ...p2, class: cls("tooltip", p2.class), "data-tip": p2.tip }, c);
// sigpro-locale.js
var i18n = {
es: {
close: "Cerrar",
confirm: "Confirmar",
cancel: "Cancelar",
search: "Buscar...",
loading: "Cargando...",
nodata: "Sin datos"
},
en: {
close: "Close",
confirm: "Confirm",
cancel: "Cancel",
search: "Search...",
loading: "Loading...",
nodata: "No data"
}
};
var currentLocale = S("es");
var Locale = (t) => currentLocale(t);
var tt = (t) => () => i18n[currentLocale()][t] || t;
// index.js
var Components = {
...exports_sigpro_components
};
var Utils = {
Locale,
tt
};
if (typeof window !== "undefined") {
Object.entries({ ...Components, ...Utils }).forEach(([name, value]) => {
Object.defineProperty(window, name, {
value,
writable: false,
configurable: true,
enumerable: true
});
});
console.log("SigProUI DX installed");
}
export {
Utils,
Components
};