Files
sigpro-ui/dist/sigpro-ui.esm.js
natxocc e842ed8041
All checks were successful
Deploy Docs to Synology / deploy (push) Successful in 3s
adapt new Input
2026-04-23 13:22:49 +02:00

1705 lines
56 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)
});
};
// components/Accordion.js
var exports_Accordion = {};
__export(exports_Accordion, {
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 $ = 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($), true);
}
return f;
}, deleteProperty(c, t) {
let r = Reflect.deleteProperty(c, t);
if (r)
w(i(t), true), w(i($), true);
return r;
}, ownKeys(c) {
return w(i($)), 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 ? n(h, 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);
});
// components/Accordion.js
var Accordion = (props, children) => {
const name = props.name || `accordion-${Math.random().toString(36).slice(2, 9)}`;
if (props.items && Array.isArray(props.items)) {
return O("div", { class: `space-y-2 ${props.class ?? ""}` }, props.items.map((item) => O("div", { class: `collapse ${item.class ?? ""}` }, [
O("input", { type: "radio", name, checked: item.open }),
O("div", { class: "collapse-title text-xl font-medium" }, item.title),
O("div", { class: "collapse-content" }, children)
])));
}
return O("div", { class: `collapse ${props.class ?? ""}` }, [
O("input", { type: "radio", name, checked: props.open }),
O("div", { class: "collapse-title text-xl font-medium" }, props.title),
O("div", { class: "collapse-content" }, children)
]);
};
// components/Alert.js
var exports_Alert = {};
__export(exports_Alert, {
Alert: () => Alert
});
var Alert = (props, children) => {
children === undefined && (children = props, props = {});
return O("div", { ...props, class: `alert ${props.class ?? ""}` }, children);
};
// components/Autocomplete.js
var exports_Autocomplete = {};
__export(exports_Autocomplete, {
Autocomplete: () => Autocomplete
});
var Autocomplete = (props) => {
const query = S("");
const isOpen = S(false);
const cursor = S(-1);
const filteredItems = S([]);
R(() => {
const v2 = typeof props.value === "function" ? props.value() : props.value;
return v2 || "";
}, (newVal) => setTimeout(() => query(newVal), 0));
R(() => {
const q2 = String(query()).toLowerCase();
const allItems = typeof props.items === "function" ? props.items() : props.items;
const filtered = q2 ? allItems.filter((item) => (typeof item === "string" ? item : item.label).toLowerCase().includes(q2)) : allItems;
filteredItems(filtered);
});
const pick = (item) => {
const display = typeof item === "string" ? item : item.label;
const actual = typeof item === "string" ? item : item.value;
query(display);
if (typeof props.value === "function")
props.value(actual);
props.onselect?.(item);
isOpen(false);
cursor(-1);
};
const handleKeyDown = (e) => {
const list = filteredItems();
if (e.key === "ArrowDown") {
e.preventDefault();
isOpen(true);
cursor(Math.min(cursor() + 1, list.length - 1));
} else if (e.key === "ArrowUp") {
e.preventDefault();
cursor(Math.max(cursor() - 1, 0));
} else if (e.key === "Enter" && cursor() >= 0) {
e.preventDefault();
pick(list[cursor()]);
} else if (e.key === "Escape") {
isOpen(false);
}
};
return O("div", { class: `relative w-full ${props.class ?? ""}` }, [
O("label", { class: "input input-bordered w-full" }, [
O("span", { class: "icon-[lucide--search]" }),
O("input", {
...props,
type: "text",
class: "grow",
placeholder: props.placeholder || "Buscar...",
value: query,
onfocus: () => isOpen(true),
onblur: () => setTimeout(() => isOpen(false), 150),
onkeydown: handleKeyDown,
oninput: (e) => {
const newVal = e.target.value;
query(newVal);
if (typeof props.value === "function")
props.value(newVal);
isOpen(true);
cursor(-1);
}
})
]),
O("ul", {
class: "absolute left-0 w-full menu bg-base-100 rounded-box mt-1 p-2 shadow-xl max-h-60 overflow-y-auto border border-base-300 z-50",
style: () => `display: ${isOpen() && filteredItems().length ? "block" : "none"};`
}, [
K(filteredItems, (item, idx) => O("li", {}, [
O("a", {
class: () => `block w-full ${cursor() === idx ? "active bg-primary text-primary-content" : ""}`,
onclick: () => pick(item),
onmouseenter: () => cursor(idx)
}, typeof item === "string" ? item : item.label)
]), (item, idx) => (typeof item === "string" ? item : item.value) + idx),
() => filteredItems().length === 0 ? O("li", { class: "flex justify-center p-4 opacity-50" }, O("span", { class: "icon-[lucide--search-x] text-2xl" })) : null
])
]);
};
// components/Badge.js
var exports_Badge = {};
__export(exports_Badge, {
Badge: () => Badge
});
var Badge = (props, children) => {
children === undefined && (children = props, props = {});
return O("span", { ...props, class: `badge ${props.class ?? ""}` }, children);
};
// components/button.js
var exports_button = {};
__export(exports_button, {
Button: () => Button
});
var Button = (props, children) => {
children === undefined && (children = props, props = {});
return O("button", { ...props, class: `btn ${props.class ?? ""}` }, children);
};
// components/Calendar.js
var exports_Calendar = {};
__export(exports_Calendar, {
Calendar: () => Calendar
});
var Calendar = (props) => {
const internalDate = S(new Date);
const hoverDate = S(null);
const startHour = S(0);
const endHour = S(0);
const isRangeMode = () => {
const r = typeof props.range === "function" ? props.range() : props.range;
return r === true;
};
const now = new Date;
const todayStr = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, "0")}-${String(now.getDate()).padStart(2, "0")}`;
const formatDate = (d) => {
const year = d.getFullYear();
const month = String(d.getMonth() + 1).padStart(2, "0");
const day = String(d.getDate()).padStart(2, "0");
return `${year}-${month}-${day}`;
};
const getCurrentValue = () => {
return typeof props.value === "function" ? props.value() : props.value;
};
const selectDate = (date) => {
const dateStr = formatDate(date);
const current = getCurrentValue();
if (isRangeMode()) {
if (!current?.start || current.start && current.end) {
const newValue = {
start: dateStr,
end: null,
...props.hour && { startHour: startHour() }
};
props.onChange?.(newValue);
} else {
const start = current.start;
let newValue;
if (dateStr < start) {
newValue = { start: dateStr, end: start };
} else {
newValue = { start, end: dateStr };
}
if (props.hour) {
newValue.startHour = current.startHour !== undefined ? current.startHour : startHour();
newValue.endHour = endHour();
}
props.onChange?.(newValue);
}
} else {
const newValue = props.hour ? `${dateStr}T${String(startHour()).padStart(2, "0")}:00:00` : dateStr;
props.onChange?.(newValue);
}
};
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: onHourChange }) => {
return 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) => onHourChange(parseInt(e.target.value))
}),
O("span", { class: "text-sm font-mono min-w-[48px] text-center" }, () => String(typeof hVal === "function" ? hVal() : hVal).padStart(2, "0") + ":00")
])
]);
};
return O("div", { class: `p-4 bg-base-100 border border-base-300 shadow-2xl rounded-box w-80 select-none ${props.class ?? ""}`.trim() }, [
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();
const year = d.getFullYear();
const month = d.getMonth();
const firstDay = new Date(year, month, 1).getDay();
const offset = firstDay === 0 ? 6 : firstDay - 1;
const daysInMonth = new Date(year, month + 1, 0).getDate();
const cells = [];
for (let i = 0;i < offset; i++)
cells.push(O("div"));
for (let i = 1;i <= daysInMonth; i++) {
const date = new Date(year, month, i);
const dStr = formatDate(date);
cells.push(O("button", {
type: "button",
class: () => {
const v2 = getCurrentValue();
const h = hoverDate();
const isStart = typeof v2 === "string" ? v2.split("T")[0] === dStr : v2?.start === dStr;
const isEnd = v2?.end === dStr;
let inRange = false;
if (isRangeMode() && v2?.start) {
const start = v2.start;
if (!v2.end && h) {
inRange = dStr > start && dStr <= h || dStr < start && dStr >= h;
} else if (v2.end) {
inRange = dStr > start && dStr < v2.end;
}
}
const base = "btn btn-xs p-0 aspect-square min-h-0 h-auto font-normal relative";
const state = isStart || isEnd ? "btn-primary z-10" : inRange ? "bg-primary/20 border-none rounded-none" : "btn-ghost";
const today = dStr === todayStr ? "ring-1 ring-primary ring-inset font-black text-primary" : "";
return `${base} ${state} ${today}`.trim();
},
onmouseenter: () => {
if (isRangeMode())
hoverDate(dStr);
},
onclick: () => selectDate(date)
}, i.toString()));
}
return cells;
}
]),
props.hour ? O("div", { class: "mt-3 pt-2 border-t border-base-300" }, [
isRangeMode() ? 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
]);
};
// components/card.js
var exports_card = {};
__export(exports_card, {
CardTitle: () => CardTitle,
CardBody: () => CardBody,
CardActions: () => CardActions,
Card: () => Card
});
var Card = (props, children) => {
children === undefined && (children = props, props = {});
return O("div", { ...props, class: `card ${props.class ?? ""}` }, children);
};
var CardTitle = (props, children) => {
children === undefined && (children = props, props = {});
return O("div", { ...props, class: `card-title ${props.class ?? ""}` }, children);
};
var CardBody = (props, children) => {
children === undefined && (children = props, props = {});
return O("div", { ...props, class: `card-body ${props.class ?? ""}` }, children);
};
var CardActions = (props, children) => {
children === undefined && (children = props, props = {});
return O("div", { ...props, class: `card-actions ${props.class ?? ""}` }, children);
};
// components/carousel.js
var exports_carousel = {};
__export(exports_carousel, {
CarouselItem: () => CarouselItem,
Carousel: () => Carousel
});
var Carousel = (props, children) => {
children === undefined && (children = props, props = {});
return O("div", { ...props, class: `carousel ${props.class ?? ""}` }, children);
};
var CarouselItem = (props, children) => {
children === undefined && (children = props, props = {});
return O("div", { ...props, class: `carousel-item ${props.class ?? ""}` }, children);
};
// components/chat.js
var exports_chat = {};
__export(exports_chat, {
ChatMessage: () => ChatMessage,
ChatImage: () => ChatImage,
ChatHeader: () => ChatHeader,
ChatFooter: () => ChatFooter,
ChatBubble: () => ChatBubble,
Chat: () => Chat
});
var Chat = (props, children) => {
children === undefined && (children = props, props = {});
return O("div", { ...props, class: `chat ${props.class ?? ""}` }, children);
};
var ChatImage = (props, children) => {
children === undefined && (children = props, props = {});
return O("div", { ...props, class: `chat-image avatar ${props.class ?? ""}` }, O("div", { class: "w-10 rounded-full" }, typeof children === "string" ? O("img", { src: children, alt: "avatar" }) : children));
};
var ChatHeader = (props, children) => {
children === undefined && (children = props, props = {});
return O("div", { ...props, class: `chat-header ${props.class ?? ""}` }, children);
};
var ChatFooter = (props, children) => {
children === undefined && (children = props, props = {});
return O("div", { ...props, class: `chat-footer ${props.class ?? ""}` }, children);
};
var ChatBubble = (props, children) => {
children === undefined && (children = props, props = {});
return O("div", { ...props, class: `chat-bubble ${props.class ?? ""}` }, children);
};
var ChatMessage = (props) => {
const { position = "start", avatar, header, message, footer, bubbleClass, ...rest } = props;
return Chat({ ...rest, class: `chat-${position} ${props.class ?? ""}` }, [
avatar && ChatImage(avatar),
header && ChatHeader(header),
ChatBubble({ class: bubbleClass }, message),
footer && ChatFooter(footer)
]);
};
// components/checkbox.js
var exports_checkbox = {};
__export(exports_checkbox, {
Checkbox: () => Checkbox
});
var Checkbox = (props) => O("input", { ...props, type: "checkbox", class: `checkbox ${props.class ?? ""}` });
// components/colorpicker.js
var exports_colorpicker = {};
__export(exports_colorpicker, {
Colorpicker: () => Colorpicker
});
var Colorpicker = (props) => {
const isOpen = S(false);
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 getColor = () => {
const v2 = props.value;
return (typeof v2 === "function" ? v2() : v2) || "#000000";
};
return O("div", { class: `relative w-fit ${props.class ?? ""}` }, [
O("button", {
type: "button",
class: "btn px-3 bg-base-100 border-base-300 hover:border-primary/50 flex items-center gap-2 shadow-sm font-normal normal-case",
onclick: (e) => {
e.stopPropagation();
isOpen(!isOpen());
},
...props
}, [
O("div", {
class: "size-5 rounded-sm shadow-inner border border-black/10 shrink-0",
style: () => `background-color: ${getColor()}`
}),
props.label ? O("span", { class: "opacity-80" }, props.label) : null
]),
z(isOpen, () => O("div", {
class: "absolute left-0 mt-2 p-3 bg-base-100 border border-base-300 shadow-2xl rounded-box z-[110] w-64 select-none",
onclick: (e) => e.stopPropagation()
}, [
O("div", { class: "grid grid-cols-8 gap-1" }, palette.map((c) => O("button", {
type: "button",
style: `background-color: ${c}`,
class: () => {
const active = getColor().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 ${active ? "ring-2 ring-offset-1 ring-primary z-10 scale-110" : ""}`;
},
onclick: () => {
if (typeof props.value === "function")
props.value(c);
isOpen(false);
}
})))
])),
z(isOpen, () => O("div", {
class: "fixed inset-0 z-[100]",
onclick: () => isOpen(false)
}))
]);
};
// components/Datepicker.js
var exports_Datepicker = {};
__export(exports_Datepicker, {
Datepicker: () => Datepicker
});
var Datepicker = (props) => {
const isOpen = S(false);
const isRangeMode = () => {
const r = typeof props.range === "function" ? props.range() : props.range;
return r === true;
};
const displayValue = S("");
R(() => {
const v2 = typeof props.value === "function" ? props.value() : props.value;
if (!v2) {
displayValue("");
return;
}
let text = "";
if (typeof v2 === "string") {
text = props.hour && v2.includes("T") ? v2.replace("T", " ") : v2;
} else if (v2.start && v2.end) {
const startStr = props.hour && v2.startHour !== undefined ? `${v2.start} ${String(v2.startHour).padStart(2, "0")}:00` : v2.start;
const endStr = props.hour && v2.endHour !== undefined ? `${v2.end} ${String(v2.endHour).padStart(2, "0")}:00` : v2.end;
text = `${startStr} - ${endStr}`;
} else if (v2.start) {
const startStr = props.hour && v2.startHour !== undefined ? `${v2.start} ${String(v2.startHour).padStart(2, "0")}:00` : v2.start;
text = `${startStr}...`;
}
displayValue(text);
});
const handleCalendarChange = (newValue) => {
if (typeof props.value === "function")
props.value(newValue);
if (!isRangeMode() || newValue?.end !== undefined && newValue?.end !== null) {
isOpen(false);
}
};
const toggleOpen = (e) => {
e.stopPropagation();
isOpen(!isOpen());
};
return O("div", { class: `relative w-full ${props.class ?? ""}` }, [
O("label", { class: "input input-bordered w-full", onclick: toggleOpen }, [
O("span", { class: "icon-[lucide--calendar]" }),
O("input", {
...props,
type: "text",
class: "grow",
value: displayValue,
readonly: true,
placeholder: props.placeholder || (isRangeMode() ? "Seleccionar rango..." : "Seleccionar fecha...")
})
]),
z(isOpen, () => O("div", {
class: "absolute left-0 mt-2 z-[100]",
onclick: (e) => e.stopPropagation()
}, [
Calendar({
value: props.value,
range: isRangeMode(),
hour: props.hour,
onChange: handleCalendarChange
})
])),
z(isOpen, () => O("div", { class: "fixed inset-0 z-[90]", onclick: () => isOpen(false) }))
]);
};
// components/drawer.js
var exports_drawer = {};
__export(exports_drawer, {
Sidebar: () => Sidebar,
Drawer: () => Drawer
});
var Drawer = (props, children) => {
children === undefined && (children = props, props = {});
return O("div", { ...props, class: `drawer ${props.class ?? ""}` }, children);
};
var Sidebar = (props) => {
const id = props.id || `drawer-${Math.random().toString(36).slice(2, 9)}`;
return O("div", { ...props, class: `drawer ${props.class ?? ""}` }, [
O("input", {
id,
type: "checkbox",
class: "drawer-toggle",
checked: () => typeof props.open === "function" ? props.open() : props.open,
onchange: (e) => typeof props.open === "function" && props.open(e.target.checked)
}),
O("div", { class: "drawer-content" }, props.children),
O("div", { class: "drawer-side" }, [
O("label", {
for: id,
class: "drawer-overlay",
onclick: () => typeof props.open === "function" && props.open(false)
}),
O("div", { class: "min-h-full bg-base-200 w-80 p-4" }, typeof props.content === "function" ? props.content() : props.content)
])
]);
};
// components/dropdown.js
var exports_dropdown = {};
__export(exports_dropdown, {
Dropdown: () => Dropdown
});
var currentOpen = null;
if (typeof window !== "undefined" && !window.__dropdownHandlerRegistered) {
window.addEventListener("click", (e) => {
if (currentOpen && !currentOpen.contains(e.target)) {
currentOpen.open = false;
currentOpen = null;
}
});
window.__dropdownHandlerRegistered = true;
}
var Dropdown = (props) => O("details", {
...props,
class: `dropdown ${props.class ?? ""}`,
onclick: (e) => {
const details = e.currentTarget;
if (currentOpen && currentOpen !== details)
currentOpen.open = false;
setTimeout(() => {
currentOpen = details.open ? details : null;
}, 0);
}
}, props.children);
// components/fab.js
var exports_fab = {};
__export(exports_fab, {
Fab: () => Fab
});
var Fab = (props, children) => {
children === undefined && (children = props, props = {});
return O("div", { ...props, class: `fab ${props.class ?? ""}` }, children);
};
// components/fieldset.js
var exports_fieldset = {};
__export(exports_fieldset, {
Fieldset: () => Fieldset
});
var Fieldset = (props, children) => O("fieldset", {
...props,
class: `fieldset ${props.class ?? ""}`
}, [
props.legend ? O("legend", { class: "fieldset-legend" }, props.legend) : null,
children
]);
// components/fileinput.js
var exports_fileinput = {};
__export(exports_fileinput, {
Fileinput: () => Fileinput
});
var Fileinput = (props) => {
const selectedFiles = S([]);
const isDragging = S(false);
const error = S(null);
const maxBytes = (props.max || 2) * 1024 * 1024;
const handleFiles = (files) => {
const fileList = Array.from(files);
error(null);
if (fileList.find((f) => f.size > maxBytes)) {
error(`Máx ${props.max || 2}MB`);
return;
}
selectedFiles([...selectedFiles(), ...fileList]);
props.onselect?.(selectedFiles());
};
const removeFile = (idx) => {
const updated = selectedFiles().filter((_2, i) => i !== idx);
selectedFiles(updated);
props.onselect?.(updated);
};
return O("div", { ...props, class: `fieldset w-full p-0 ${props.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 ${isDragging() ? "border-primary bg-primary/10" : "border-base-content/20 bg-base-100 hover:bg-base-200"}`,
ondragover: (e) => {
e.preventDefault();
isDragging(true);
},
ondragleave: () => isDragging(false),
ondrop: (e) => {
e.preventDefault();
isDragging(false);
handleFiles(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 ${props.max || 2}MB`)
]),
O("input", {
type: "file",
multiple: true,
accept: props.accept || "*",
class: "hidden",
onchange: (e) => handleFiles(e.target.files)
})
]),
() => error() && O("span", { class: "text-[10px] text-error mt-1 px-1 font-medium" }, error()),
z(() => selectedFiles().length > 0, () => O("ul", { class: "mt-2 space-y-1" }, [
K(selectedFiles, (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();
removeFile(idx);
}
}, O("span", { class: "icon-[lucide--x]" }))
]), (file) => file.name + file.lastModified)
]))
]);
};
// components/icon.js
var exports_icon = {};
__export(exports_icon, {
Icon: () => Icon
});
var Icon = (props, children) => {
if (typeof props === "string") {
if (props.includes("icon-") || props.startsWith("lucide-")) {
return O("span", { class: props }, children);
}
return O("span", { class: "icon" }, props);
}
if (!props)
return null;
const { class: className, ...rest } = props;
return O("span", { ...rest, class: className }, children);
};
// components/indicator.js
var exports_indicator = {};
__export(exports_indicator, {
Indicator: () => Indicator
});
var Indicator = (props, children) => {
children === undefined && (children = props, props = {});
return O("div", { ...props, class: `indicator ${props.class ?? ""}` }, [
props.value ? O("span", { class: `indicator-item badge ${props.class ?? ""}` }, props.value) : null,
children
]);
};
// components/Input.js
var exports_Input = {};
__export(exports_Input, {
Input: () => Input
});
// components/_core.js
var get = (val) => typeof val === "function" ? val() : val;
var cls = (...classes) => classes.filter(Boolean).join(" ").trim();
var isFunc = (f) => typeof f === "function";
// components/Input.js
var Input = (props) => {
const { label, icon, float, placeholder, value, left, right, content, ...rest } = props;
const showPassword = S(false);
const isFocused = S(false);
const isPassword = props.type === "password";
const inputType = () => isPassword ? get(showPassword) ? "text" : "password" : props.type || "text";
return O("div", {
class: "input-container",
onfocusin: () => isFocused(true),
onfocusout: (e) => {
if (!e.currentTarget.contains(e.relatedTarget)) {
isFocused(false);
}
}
}, [
O("label", { class: "floating-label" }, [
float ? O("span", {}, label) : null,
O("label", {
class: () => cls("input", props.class)
}, [
label && !float ? O("span", { class: "label" }, label) : null,
left ?? null,
O("input", {
...rest,
type: inputType,
class: "grow",
placeholder: placeholder || label || " ",
value
}),
right ?? null,
isPassword ? O("label", { class: "swap swap-rotate ml-2" }, [
O("input", {
type: "checkbox",
onchange: (e) => showPassword(e.target.checked)
}),
O("span", { class: "swap-on icon-[lucide--eye]" }),
O("span", { class: "swap-off icon-[lucide--eye-off]" })
]) : null
]),
z(isFocused, () => G({ duration: 300, slide: true }, O("div", {
class: "input-content",
onmousedown: (e) => e.preventDefault()
}, [
isFunc(content) ? content(isFocused) : content
])))
])
]);
};
// components/kbd.js
var exports_kbd = {};
__export(exports_kbd, {
Kbd: () => Kbd
});
var Kbd = (props, children) => {
children === undefined && (children = props, props = {});
return O("kbd", { ...props, class: `kbd ${props.class ?? ""}` }, children);
};
// components/loading.js
var exports_loading = {};
__export(exports_loading, {
Loading: () => Loading
});
var Loading = (props, children) => {
children === undefined && (children = props, props = {});
return O("span", { ...props, class: `loading loading-spinner ${props.class ?? ""}` }, children);
};
// components/menu.js
var exports_menu = {};
__export(exports_menu, {
MenuItems: () => MenuItems,
Menu: () => Menu
});
var Menu = (props, children) => {
children === undefined && (children = props, props = {});
return O("ul", { ...props, class: `menu ${props.class ?? ""}` }, children);
};
var MenuItems = (props) => {
const { items, keyFn = (item, idx) => item.id ?? idx } = props;
const itemsSignal = typeof items === "function" ? items : () => items || [];
const renderItem = (item) => {
if (item.children) {
return O("li", {}, [
O("details", {}, [
O("summary", {}, item.label),
O("ul", {}, MenuItems({ items: item.children }))
])
]);
}
return O("li", {}, O("a", {
href: item.href,
onclick: item.onclick ? (e) => {
if (!item.href)
e.preventDefault();
item.onclick(e);
} : null
}, item.label));
};
return K(itemsSignal, renderItem, keyFn);
};
// components/modal.js
var exports_modal = {};
__export(exports_modal, {
Modal: () => Modal
});
var Modal = (props) => {
let dialogRef = null;
R(() => {
const isOpen = typeof props.open === "function" ? props.open() : props.open;
if (!dialogRef)
return;
isOpen ? dialogRef.showModal() : dialogRef.close();
});
const close = () => typeof props.open === "function" && props.open(false);
return O("dialog", {
...props,
ref: (el) => dialogRef = el,
class: `modal ${props.class ?? ""}`,
onclose: close,
oncancel: close
}, [
O("div", { class: "modal-box" }, [
props.title && O("h3", { class: "text-lg font-bold" }, props.title),
props.children,
O("div", { class: "modal-action" }, [
props.actions || O("button", { class: "btn", onclick: close }, "Cerrar")
])
]),
O("form", { method: "dialog", class: "modal-backdrop" }, [
O("button", {}, "close")
])
]);
};
// components/navbar.js
var exports_navbar = {};
__export(exports_navbar, {
Navbar: () => Navbar
});
var Navbar = (props, children) => {
children === undefined && (children = props, props = {});
return O("div", { ...props, class: `navbar ${props.class ?? ""}` }, children);
};
// components/radial.js
var exports_radial = {};
__export(exports_radial, {
Radial: () => Radial
});
var Radial = (props, children) => {
children === undefined && (children = props, props = {});
const percentage = props.value != null ? props.value / (props.max || 100) * 100 : 0;
const style = `--value: ${percentage}; --max: 100;`;
return O("div", {
...props,
class: `radial-progress ${props.class ?? ""}`,
style,
role: "progressbar",
"aria-valuenow": props.value,
"aria-valuemin": 0,
"aria-valuemax": props.max || 100
}, children || `${Math.round(percentage)}%`);
};
// components/radio.js
var exports_radio = {};
__export(exports_radio, {
Radio: () => Radio
});
var Radio = (props) => O("input", { ...props, type: "radio", class: `radio ${props.class ?? ""}` });
// components/range.js
var exports_range = {};
__export(exports_range, {
Range: () => Range
});
var Range = (props) => O("input", { ...props, type: "range", class: `range ${props.class ?? ""}` });
// components/rating.js
var exports_rating = {};
__export(exports_rating, {
Rating: () => Rating
});
var Rating = (props, children) => {
children === undefined && (children = props, props = {});
const name = `rating-${Math.random().toString(36).slice(2, 7)}`;
return O("div", { ...props, class: `rating ${props.class ?? ""}` }, children || Array.from({ length: props.count || 5 }, (_2, i) => {
const starValue = i + 1;
return O("input", {
type: "radio",
name,
class: `mask ${props.mask || "mask-star"}`,
checked: () => typeof props.value === "function" ? props.value() === starValue : props.value === starValue,
onchange: () => {
if (props.onchange)
props.onchange(starValue);
else if (typeof props.value === "function")
props.value(starValue);
}
});
}));
};
// components/skeleton.js
var exports_skeleton = {};
__export(exports_skeleton, {
SkeletonText: () => SkeletonText,
Skeleton: () => Skeleton
});
var Skeleton = (props) => O("div", { ...props, class: `skeleton ${props.class ?? ""}` });
var SkeletonText = (props) => {
return O("div", { ...props, class: "space-y-2" }, Array.from({ length: props.lines || 3 }, () => O("div", { class: `skeleton h-4 w-full ${props.class ?? ""}` })));
};
// components/select.js
var exports_select = {};
__export(exports_select, {
SelectLabel: () => SelectLabel,
SelectItems: () => SelectItems,
Select: () => Select
});
var Select = (props, children) => {
children === undefined && (children = props, props = {});
return O("select", { ...props, class: `select ${props.class ?? ""}` }, children);
};
var SelectItems = (props) => {
const placeholderOption = props.placeholder ? O("option", { disabled: props.placeholderDisabled ?? true, selected: true }, props.placeholder) : null;
const dynamicOptions = K(() => [...typeof props.items === "function" ? props.items() : props.items || []], (item) => {
const val = typeof item === "string" ? item : item.value;
const label = typeof item === "string" ? item : item.label;
return O("option", { value: val }, label);
}, props.keyFn || ((item) => typeof item === "string" ? item : item.value));
return placeholderOption ? [placeholderOption, dynamicOptions] : dynamicOptions;
};
var SelectLabel = (props, children) => O("label", { class: `${props.float ? "floating-label" : "select"}` }, [
O("span", { class: props.float ? "" : "label opacity-50" }, props.label),
props.left ?? null,
O("select", { ...props, class: `${props.float ? "select" : ""} ${props.class ?? ""}` }, children),
props.right ?? null
]);
// components/stack.js
var exports_stack = {};
__export(exports_stack, {
Stack: () => Stack
});
var Stack = (props, children) => {
children === undefined && (children = props, props = {});
return O("div", { ...props, class: `stack ${props.class ?? ""}` }, children);
};
// components/stat.js
var exports_stat = {};
__export(exports_stat, {
Stats: () => Stats,
Stat: () => Stat
});
var Stats = (props, children) => {
children === undefined && (children = props, props = {});
const direction = props.vertical ? "stats-vertical" : "stats-horizontal";
return O("div", { ...props, class: `stats ${direction} ${props.class ?? ""}`.trim() }, children);
};
var Stat = (props, children) => {
children === undefined && (children = props, props = {});
return O("div", { ...props, class: `stat ${props.class ?? ""}` }, [
props.icon && O("div", { class: "stat-figure" }, props.icon),
props.label && O("div", { class: "stat-title" }, props.label),
props.value && O("div", { class: "stat-value" }, props.value),
props.desc && O("div", { class: "stat-desc" }, props.desc),
props.actions && O("div", { class: "stat-actions" }, props.actions),
children
]);
};
// components/swap.js
var exports_swap = {};
__export(exports_swap, {
Swap: () => Swap
});
var Swap = (props) => {
return O("label", { ...props, class: `swap ${props.class ?? ""}` }, [
O("input", {
type: "checkbox",
checked: () => typeof props.value === "function" ? props.value() : props.value,
onchange: (e) => typeof props.value === "function" && props.value(e.target.checked)
}),
O("div", { class: "swap-on" }, props.on),
O("div", { class: "swap-off" }, props.off)
]);
};
// components/table.js
var exports_table = {};
__export(exports_table, {
TableItems: () => TableItems,
Table: () => Table
});
var Table = (props, children) => {
children === undefined && (children = props, props = {});
return O("table", { ...props, class: `table ${props.class ?? ""}` }, children);
};
var TableItems = (props) => {
const itemArray = typeof props.items === "function" ? props.items() : props.items || [];
const thead = props.header !== false && props.columns?.some((col) => col.label) ? O("thead", {}, O("tr", {}, props.columns.map((col) => O("th", { class: col.class }, col.label)))) : null;
const tbody = O("tbody", {}, [
K(itemArray, (item, idx) => O("tr", {}, props.columns.map((col) => {
const content = col.render ? col.render(item, idx) : item[col.key];
return O("td", { class: col.class }, content);
})), props.keyFn || ((item, idx) => item.id ?? idx))
]);
return [thead, tbody];
};
// components/tabs.js
var exports_tabs = {};
__export(exports_tabs, {
Tabs: () => Tabs,
TabItems: () => TabItems,
TabContent: () => TabContent,
TabClose: () => TabClose,
Tab: () => Tab
});
var Tabs = (props, children) => {
children === undefined && (children = props, props = {});
return O("div", { ...props, class: `tabs ${props.class ?? ""}` }, children);
};
var Tab = (props, children) => {
children === undefined && (children = props, props = {});
return O("a", { ...props, role: "tab", class: `tab ${props.class ?? ""}` }, children);
};
var TabContent = (props, children) => {
children === undefined && (children = props, props = {});
return O("div", { ...props, class: `tab-content ${props.class ?? ""}` }, children);
};
var TabClose = (props) => O("a", { ...props, role: "tab", class: `tab ${props.class ?? ""}` }, [
O("span", { class: "flex items-center" }, [
props.label,
O("span", {
class: "icon-[lucide--x] w-3.5 h-3.5 ml-2 cursor-pointer hover:opacity-70",
onclick: (e) => {
e.stopPropagation();
props.onClose?.(e);
}
})
])
]);
var TabItems = (props) => {
const items = typeof props.items === "function" ? props.items : () => props.items || [];
return K(items, (item, idx) => {
const TabComp = item.closable ? TabClose : Tab;
return [
TabComp({
...item,
class: () => props.activeIndex() === idx ? `tab-active ${item.class ?? ""}` : item.class,
onclick: (e) => {
e.preventDefault();
props.activeIndex(idx);
item.onclick?.(e);
},
onClose: () => props.onClose?.(idx, item)
}),
TabContent({
style: () => `display: ${props.activeIndex() === idx ? "block" : "none"};`
}, typeof item.content === "function" ? item.content() : item.content)
];
}, (item, idx) => item.id ?? idx);
};
// components/textarea.js
var exports_textarea = {};
__export(exports_textarea, {
Textarea: () => Textarea
});
var Textarea = (props) => O("textarea", { ...props, class: `textarea ${props.class ?? ""}` });
// components/textrotate.js
var exports_textrotate = {};
__export(exports_textrotate, {
TextRotate: () => TextRotate
});
var TextRotate = (props) => {
const wordsArray = Array.isArray(props.words) ? props.words : typeof props.words === "string" ? props.words.split(",") : [];
return O("span", { ...props, class: `text-rotate ${props.class ?? ""}` }, [
O("span", {}, wordsArray.map((word) => O("span", {}, word)))
]);
};
// components/timeline.js
var exports_timeline = {};
__export(exports_timeline, {
Timeline: () => Timeline
});
var Timeline = (props, children) => {
children === undefined && (children = props, props = {});
const vertical = props.vertical !== false;
const compact = props.compact === true;
return O("ul", {
...props,
class: `timeline ${vertical ? "timeline-vertical" : "timeline-horizontal"} ${compact ? "timeline-compact" : ""} ${props.class ?? ""}`.trim()
}, children);
};
// components/toast.js
var exports_toast = {};
__export(exports_toast, {
Toast: () => Toast
});
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 toastHost = O("div", { style: "display: contents" });
container.appendChild(toastHost);
let timeoutId;
const close = () => {
clearTimeout(timeoutId);
const el = toastHost.firstElementChild;
if (el && !el.classList.contains("opacity-0")) {
el.classList.add("translate-x-full", "opacity-0");
setTimeout(() => {
instance.destroy();
toastHost.remove();
if (!container.hasChildNodes())
container.remove();
}, 300);
} else {
instance.destroy();
toastHost.remove();
}
};
const ToastComponent = () => {
const closeIcon = O("span", { class: "icon-[lucide--x]" });
const closeBtn = O("button", {
class: "btn btn-xs btn-circle btn-ghost",
onclick: close
}, closeIcon);
const alertDiv = O("div", {
class: `alert alert-soft ${type} shadow-lg transition-all duration-300 translate-x-10 opacity-0 pointer-events-auto`
}, [
O("span", {}, typeof message === "function" ? message() : message),
closeBtn
]);
requestAnimationFrame(() => alertDiv.classList.remove("translate-x-10", "opacity-0"));
return alertDiv;
};
const instance = H(ToastComponent, toastHost);
if (duration > 0)
timeoutId = setTimeout(close, duration);
return close;
};
// components/tooltip.js
var exports_tooltip = {};
__export(exports_tooltip, {
Tooltip: () => Tooltip
});
var Tooltip = (props, children) => {
children === undefined && (children = props, props = {});
return O("div", { ...props, class: `tooltip ${props.class ?? ""}`, "data-tip": props.tip }, children);
};
// utils.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_Accordion,
...exports_Alert,
...exports_Autocomplete,
...exports_Badge,
...exports_button,
...exports_Calendar,
...exports_card,
...exports_carousel,
...exports_chat,
...exports_checkbox,
...exports_colorpicker,
...exports_Datepicker,
...exports_drawer,
...exports_dropdown,
...exports_fab,
...exports_fieldset,
...exports_fileinput,
...exports_icon,
...exports_indicator,
...exports_Input,
...exports_kbd,
...exports_loading,
...exports_menu,
...exports_modal,
...exports_navbar,
...exports_radial,
...exports_radio,
...exports_range,
...exports_rating,
...exports_skeleton,
...exports_select,
...exports_stack,
...exports_stat,
...exports_stat,
...exports_swap,
...exports_table,
...exports_tabs,
...exports_textarea,
...exports_textrotate,
...exports_timeline,
...exports_toast,
...exports_tooltip
};
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 installed");
}
export {
Utils,
Components
};