Files
sigpro-ui/dist/sigpro-ui.js
natxocc 5a5f593025
All checks were successful
Deploy Docs to Synology / deploy (push) Successful in 4s
minusculas
2026-04-22 08:27:59 +02:00

1671 lines
58 KiB
JavaScript

(() => {
var __defProp = Object.defineProperty;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __hasOwnProp = Object.prototype.hasOwnProperty;
function __accessProp(key) {
return this[key];
}
var __toCommonJS = (from) => {
var entry = (__moduleCache ??= new WeakMap).get(from), desc;
if (entry)
return entry;
entry = __defProp({}, "__esModule", { value: true });
if (from && typeof from === "object" || typeof from === "function") {
for (var key of __getOwnPropNames(from))
if (!__hasOwnProp.call(entry, key))
__defProp(entry, key, {
get: __accessProp.bind(from, key),
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
});
}
__moduleCache.set(from, entry);
return entry;
};
var __moduleCache;
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)
});
};
// index.js
var exports_sigpro_ui = {};
__export(exports_sigpro_ui, {
Utils: () => Utils,
Components: () => Components
});
// components/Accordion.js
var exports_Accordion = {};
__export(exports_Accordion, {
Accordion: () => Accordion
});
// node_modules/sigpro/dist/sigpro.esm.min.js
var m = (e) => typeof e === "function";
var j = (e) => e && typeof e === "object";
var N = Array.isArray;
var E = typeof document < "u" ? document : null;
var $ = (e) => e?._isRuntime ? e.container : e instanceof Node ? e : E.createTextNode(e == null ? "" : String(e));
var p = null;
var _ = null;
var C = false;
var A = 0;
var T = new Set;
var U = new WeakMap;
var L = Symbol("iter");
var M = new WeakMap;
var v = (e) => {
if (!e || e._disposed)
return;
e._disposed = true;
let s = [e];
while (s.length) {
let t = s.pop();
if (t._cleanups)
t._cleanups.forEach((r) => r()), t._cleanups.clear();
if (t._children)
t._children.forEach((r) => s.push(r)), t._children.clear();
if (t._deps)
t._deps.forEach((r) => r.delete(t)), t._deps.clear();
}
};
var k = (e) => {
if (_)
(_._mounts ||= []).push(e);
};
var g = (e) => {
if (_)
(_._cleanups ||= new Set).add(e);
};
var q = (e) => {
let s = p;
p = null;
try {
return e();
} finally {
p = s;
}
};
var O = (e, s = false) => {
let t = () => {
if (t._disposed)
return;
if (t._deps)
t._deps.forEach((c) => c.delete(t));
if (t._cleanups)
t._cleanups.forEach((c) => c()), t._cleanups.clear();
let r = p, n = _;
p = _ = t;
try {
return t._result = e();
} catch (c) {
console.error("[SigPro]", c);
} finally {
p = r, _ = n;
}
};
if (t._deps = t._cleanups = t._children = null, t._disposed = false, t._isComputed = s, t._depth = p ? p._depth + 1 : 0, t._mounts = [], t._parent = _, _)
(_._children ||= new Set).add(t);
return t;
};
var W = () => {
if (C)
return;
C = true;
let e = Array.from(T).sort((s, t) => s._depth - t._depth);
T.clear();
for (let s of e)
if (!s._disposed)
s();
C = false;
};
var z = (e) => {
A++;
try {
return e();
} finally {
if (A--, A === 0 && T.size > 0 && !C)
W();
}
};
var w = (e, s = false) => {
if (!s && p && !p._disposed)
e.add(p), (p._deps ||= new Set).add(e);
else if (s && e.size > 0) {
let t = false;
for (let r of e) {
if (r === p || r._disposed)
continue;
if (r._isComputed) {
if (r._dirty = true, r._subs)
w(r._subs, true);
} else
T.add(r), t = true;
}
if (t && !C && A === 0)
queueMicrotask(W);
}
};
var B = (e, s = null) => {
let t = new Set;
if (m(e)) {
let r, n = () => {
if (n._dirty) {
let c = p;
p = n;
try {
let i = e();
if (!Object.is(r, i))
r = i, w(t, true);
} finally {
p = c;
}
n._dirty = false;
}
return w(t), r;
};
if (n._isComputed = true, n._subs = t, n._dirty = true, n._deps = null, n._disposed = false, n.stop = () => {}, _)
g(n.stop);
return n;
}
if (s)
try {
e = JSON.parse(localStorage.getItem(s)) ?? e;
} catch (r) {}
return (...r) => {
if (r.length) {
let n = m(r[0]) ? r[0](e) : r[0];
if (!Object.is(e, n)) {
if (e = n, s)
localStorage.setItem(s, JSON.stringify(e));
w(t, true);
}
}
return w(t), e;
};
};
var D = (e) => {
if (!j(e))
return e;
let s = U.get(e);
if (s)
return s;
let t = new Map, r = (n) => {
let c = t.get(n);
if (!c)
t.set(n, c = new Set);
return c;
};
return s = new Proxy(e, { get(n, c, i) {
if (typeof c !== "symbol")
w(r(c));
return D(Reflect.get(n, c, i));
}, set(n, c, i, o) {
let l = !Reflect.has(n, c), a = Reflect.get(n, c, o), d = Reflect.set(n, c, i, o);
if (d && !Object.is(a, i)) {
if (w(r(c), true), l)
w(r(L), true);
}
return d;
}, deleteProperty(n, c) {
let i = Reflect.deleteProperty(n, c);
if (i)
w(r(c), true), w(r(L), true);
return i;
}, ownKeys(n) {
return w(r(L)), Reflect.ownKeys(n);
} }), U.set(e, s), s;
};
var R = (e, s) => {
if (s === undefined) {
let r = O(e);
return r(), () => v(r);
}
let t = O(() => {
let r = Array.isArray(e) ? e.map((n) => n()) : e();
q(() => s(r));
});
return t(), () => v(t);
};
var P = (e) => {
if (e._cleanups)
e._cleanups.forEach((s) => s()), e._cleanups.clear();
if (e._ownerEffect)
v(e._ownerEffect);
if (e.childNodes)
e.childNodes.forEach(P);
};
var F = /^\s*(javascript|data|vbscript):/i;
var G = (e) => e === "src" || e === "href" || e.startsWith("on");
var I = (e, s) => {
if (s == null || s === false)
return null;
if (G(e)) {
let t = String(s);
if (F.test(t))
return console.warn(`[SigPro] Bloqueado protocolo peligroso en ${e}`), "#";
}
return s;
};
var S = (e, s = {}, t = []) => {
if (s instanceof Node || N(s) || !j(s))
t = s, s = {};
if (m(e)) {
let i = { _mounts: [], _cleanups: new Set }, o = O(() => {
let f = e(s, { children: t, emit: (h, ...u) => s[`on${h[0].toUpperCase()}${h.slice(1)}`]?.(...u) });
return o._result = f, f;
});
o();
let l = o._result;
if (l == null)
return null;
let a = l instanceof Node || N(l) && l.every((f) => f instanceof Node) ? l : E.createTextNode(String(l)), d = (f) => {
if (j(f) && !f._isRuntime)
f._mounts = o._mounts || [], f._cleanups = o._cleanups || new Set, f._ownerEffect = o;
};
return N(a) ? a.forEach(d) : d(a), a;
}
let r = /^(svg|path|circle|rect|line|poly(line|gon)|g|defs|text(path)?|tspan|use|symbol|image|marker|ellipse)$/i.test(e), n = r ? E.createElementNS("http://www.w3.org/2000/svg", e) : E.createElement(e);
n._cleanups = new Set;
for (let i in s) {
if (!s.hasOwnProperty(i))
continue;
let o = s[i];
if (i === "ref") {
m(o) ? o(n) : o.current = n;
continue;
}
if (r && i.startsWith("xlink:")) {
val == null ? n.removeAttributeNS("http://www.w3.org/1999/xlink", i.slice(6)) : n.setAttributeNS("http://www.w3.org/1999/xlink", i.slice(6), val);
continue;
}
if (i.startsWith("on")) {
let l = i.slice(2).toLowerCase();
n.addEventListener(l, o);
let a = () => n.removeEventListener(l, o);
n._cleanups.add(a), g(a);
} else if (m(o)) {
let l = O(() => {
let a = I(i, o());
if (i === "class")
n.className = a || "";
else if (a == null)
n.removeAttribute(i);
else if (i in n && !r)
n[i] = a;
else
n.setAttribute(i, a === true ? "" : a);
});
if (l(), n._cleanups.add(() => v(l)), g(() => v(l)), /^(INPUT|TEXTAREA|SELECT)$/.test(n.tagName) && (i === "value" || i === "checked")) {
let a = i === "checked" ? "change" : "input";
n.addEventListener(a, (d) => o(d.target[i]));
}
} else {
let l = I(i, o);
if (l != null)
if (i in n && !r)
n[i] = l;
else
n.setAttribute(i, l === true ? "" : l);
}
}
let c = (i) => {
if (N(i))
return i.forEach(c);
if (m(i)) {
let o = E.createTextNode("");
n.appendChild(o);
let l = [], a = O(() => {
let d = i(), f = (N(d) ? d : [d]).map($);
l.forEach((u) => {
if (u._isRuntime)
u.destroy();
else
P(u);
if (u.parentNode)
u.remove();
});
let h = o;
for (let u = f.length - 1;u >= 0; u--) {
let y = f[u];
if (y.parentNode !== h.parentNode)
h.parentNode?.insertBefore(y, h);
if (y._mounts)
y._mounts.forEach((V) => V());
h = y;
}
l = f;
});
a(), n._cleanups.add(() => v(a)), g(() => v(a));
} else {
let o = $(i);
if (n.appendChild(o), o._mounts)
o._mounts.forEach((l) => l());
}
};
return c(t), n;
};
var b = (e) => {
let s = new Set, t = [], r = _, n = p, c = E.createElement("div");
c.style.display = "contents", c.setAttribute("role", "presentation"), _ = { _cleanups: s, _mounts: t }, p = null;
let i = (o) => {
if (!o)
return;
if (o._isRuntime)
s.add(o.destroy), c.appendChild(o.container);
else if (N(o))
o.forEach(i);
else
c.appendChild(o instanceof Node ? o : E.createTextNode(String(o == null ? "" : o)));
};
try {
i(e({ onCleanup: (o) => s.add(o) }));
} finally {
_ = r, p = n;
}
return t.forEach((o) => o()), { _isRuntime: true, container: c, destroy: () => {
s.forEach((o) => o()), P(c), c.remove();
} };
};
var J = (e, s, t = null) => {
let r = E.createTextNode(""), n = S("div", { style: "display:contents" }, [r]), c = null;
return R(() => !!(m(e) ? e() : e), (i) => {
if (c)
c.destroy(), c = null;
let o = i ? s : t;
if (o)
c = b(() => m(o) ? o() : o), n.insertBefore(c.container, r);
}), g(() => c?.destroy()), n;
};
var K = (e, s, t) => {
let r = E.createTextNode(""), n = S("div", { style: "display:contents" }, [r]), c = new Map;
return R(() => (m(e) ? e() : e) || [], (i) => {
let o = new Map, l = [], a = i || [];
for (let f = 0;f < a.length; f++) {
let h = a[f], u = t ? t(h, f) : h?.id ?? f, y = c.get(u);
if (!y)
y = b(() => s(h, f));
else
c.delete(u);
o.set(u, y), l.push(y);
}
c.forEach((f) => f.destroy());
let d = r;
for (let f = l.length - 1;f >= 0; f--) {
let u = l[f].container;
if (u.nextSibling !== d)
n.insertBefore(u, d);
d = u;
}
c = o;
}), n;
};
var x = (e) => {
let s = () => window.location.hash.slice(1) || "/", t = B(s()), r = () => t(s());
window.addEventListener("hashchange", r), g(() => window.removeEventListener("hashchange", r));
let n = S("div", { class: "router-hook" }), c = null;
return R([t], () => {
let i = t(), o = e.find((l) => {
let a = l.path.split("/").filter(Boolean), d = i.split("/").filter(Boolean);
return a.length === d.length && a.every((f, h) => f[0] === ":" || f === d[h]);
}) || e.find((l) => l.path === "*");
if (o) {
c?.destroy();
let l = {};
o.path.split("/").filter(Boolean).forEach((a, d) => {
if (a[0] === ":")
l[a.slice(1)] = i.split("/").filter(Boolean)[d];
}), x.params(l), c = b(() => m(o.component) ? o.component(l) : o.component), n.replaceChildren(c.container);
}
}), n;
};
x.params = B({});
x.to = (e) => window.location.hash = e.replace(/^#?\/?/, "#/");
x.back = () => window.history.back();
x.path = () => window.location.hash.replace(/^#/, "") || "/";
var Q = (e, s, { enter: t, leave: r } = {}) => {
let n = S("div", { style: "display:contents" }), c = null, i = (o, l) => {
let a = false, d = () => !a && (a = true, l());
if (!o)
return d();
"transitionend animationend".split(" ").map((f) => o.addEventListener(f, d, { once: true })), setTimeout(d, 500);
};
return R(e, (o) => {
if (o && !c) {
let l = (c = b(s)).container.firstChild;
if (n.appendChild(c.container), t && l)
l.classList.add(t), l.clientTop, l.classList.add(t + "-active"), i(l, () => l.classList.remove(t, t + "-active"));
} else if (!o && c) {
let l = c.container.firstChild, a = () => (c?.destroy(), c = null);
r && l ? (l.classList.add(r), i(l, a)) : a();
}
}), g(() => c?.destroy()), n;
};
var H = (e, s) => {
let t = typeof s === "string" ? E.querySelector(s) : s;
if (!t)
return;
if (M.has(t))
M.get(t).destroy();
let r = b(m(e) ? e : () => e);
return t.replaceChildren(r.container), M.set(t, r), r;
};
var X = Object.freeze({ $: B, $$: D, Watch: R, Tag: S, Render: b, If: J, For: K, Router: x, Mount: H, onMount: k, onUnmount: g, Anim: Q, Batch: z });
if (typeof window < "u")
Object.assign(window, X), "div span p h1 h2 h3 h4 h5 h6 br hr section article aside nav main header footer ul ol li a em strong pre code form label input textarea select button img svg".split(" ").forEach((e) => {
let s = e[0].toUpperCase() + e.slice(1);
window[s] = (t, r) => S(e, t, r);
});
// components/Accordion.js
var Accordion = (props) => {
const name = props.name || `accordion-${Math.random().toString(36).slice(2, 9)}`;
if (props.items && Array.isArray(props.items)) {
return S("div", { class: `space-y-2 ${props.class ?? ""}` }, props.items.map((item) => S("div", { class: `collapse ${item.class ?? ""}` }, [
S("input", { type: "radio", name, checked: item.open }),
S("div", { class: "collapse-title text-xl font-medium" }, item.title),
S("div", { class: "collapse-content" }, item.children)
])));
}
return S("div", { class: `collapse ${props.class ?? ""}` }, [
S("input", { type: "radio", name, checked: props.open }),
S("div", { class: "collapse-title text-xl font-medium" }, props.title),
S("div", { class: "collapse-content" }, props.children)
]);
};
// components/Alert.js
var exports_Alert = {};
__export(exports_Alert, {
Alert: () => Alert
});
var Alert = (props, children) => {
children === undefined && (children = props, props = {});
return S("div", { ...props, class: `alert ${props.class ?? ""}` }, children);
};
// components/Autocomplete.js
var exports_Autocomplete = {};
__export(exports_Autocomplete, {
Autocomplete: () => Autocomplete
});
var Autocomplete = (props) => {
const query = B("");
const isOpen = B(false);
const cursor = B(-1);
const filteredItems = B([]);
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 S("div", { class: `relative w-full ${props.class ?? ""}` }, [
S("label", { class: "input input-bordered w-full" }, [
S("span", { class: "icon-[lucide--search]" }),
S("input", {
...props,
type: "text",
class: "input 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);
}
})
]),
S("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) => S("li", {}, [
S("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 ? S("li", { class: "flex justify-center p-4 opacity-50" }, S("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 S("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 S("button", { ...props, class: `btn ${props.class ?? ""}` }, children);
};
// components/Calendar.js
var exports_Calendar = {};
__export(exports_Calendar, {
Calendar: () => Calendar
});
var Calendar = (props) => {
const internalDate = B(new Date);
const hoverDate = B(null);
const startHour = B(0);
const endHour = B(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 = (m2) => {
const d = internalDate();
internalDate(new Date(d.getFullYear(), d.getMonth() + m2, 1));
};
const moveYear = (y) => {
const d = internalDate();
internalDate(new Date(d.getFullYear() + y, d.getMonth(), 1));
};
const HourSlider = ({ value: hVal, onChange: onHourChange }) => {
return S("div", { class: "flex-1" }, [
S("div", { class: "flex gap-2 items-center" }, [
S("input", {
type: "range",
min: 0,
max: 23,
value: hVal,
class: "range range-xs flex-1",
oninput: (e) => onHourChange(parseInt(e.target.value))
}),
S("span", { class: "text-sm font-mono min-w-[48px] text-center" }, () => String(typeof hVal === "function" ? hVal() : hVal).padStart(2, "0") + ":00")
])
]);
};
return S("div", { class: `p-4 bg-base-100 border border-base-300 shadow-2xl rounded-box w-80 select-none ${props.class ?? ""}`.trim() }, [
S("div", { class: "flex justify-between items-center mb-4 gap-1" }, [
S("div", { class: "flex gap-0.5" }, [
S("button", { type: "button", class: "btn btn-ghost btn-xs px-1", onclick: () => moveYear(-1) }, S("span", { class: "icon-[lucide--chevrons-left]" })),
S("button", { type: "button", class: "btn btn-ghost btn-xs px-1", onclick: () => move(-1) }, S("span", { class: "icon-[lucide--chevron-left]" }))
]),
S("span", { class: "font-bold uppercase flex-1 text-center" }, [
() => internalDate().toLocaleString("es-ES", { month: "short", year: "numeric" })
]),
S("div", { class: "flex gap-0.5" }, [
S("button", { type: "button", class: "btn btn-ghost btn-xs px-1", onclick: () => move(1) }, S("span", { class: "icon-[lucide--chevron-right]" })),
S("button", { type: "button", class: "btn btn-ghost btn-xs px-1", onclick: () => moveYear(1) }, S("span", { class: "icon-[lucide--chevrons-right]" }))
])
]),
S("div", { class: "grid grid-cols-7 gap-1", onmouseleave: () => hoverDate(null) }, [
...["L", "M", "X", "J", "V", "S", "D"].map((d) => S("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(S("div"));
for (let i = 1;i <= daysInMonth; i++) {
const date = new Date(year, month, i);
const dStr = formatDate(date);
cells.push(S("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 ? S("div", { class: "mt-3 pt-2 border-t border-base-300" }, [
isRangeMode() ? S("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 S("div", { ...props, class: `card ${props.class ?? ""}` }, children);
};
var CardTitle = (props, children) => {
children === undefined && (children = props, props = {});
return S("div", { ...props, class: `card-title ${props.class ?? ""}` }, children);
};
var CardBody = (props, children) => {
children === undefined && (children = props, props = {});
return S("div", { ...props, class: `card-body ${props.class ?? ""}` }, children);
};
var CardActions = (props, children) => {
children === undefined && (children = props, props = {});
return S("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 S("div", { ...props, class: `carousel ${props.class ?? ""}` }, children);
};
var CarouselItem = (props, children) => {
children === undefined && (children = props, props = {});
return S("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 S("div", { ...props, class: `chat ${props.class ?? ""}` }, children);
};
var ChatImage = (props, children) => {
children === undefined && (children = props, props = {});
return S("div", { ...props, class: `chat-image avatar ${props.class ?? ""}` }, S("div", { class: "w-10 rounded-full" }, typeof children === "string" ? S("img", { src: children, alt: "avatar" }) : children));
};
var ChatHeader = (props, children) => {
children === undefined && (children = props, props = {});
return S("div", { ...props, class: `chat-header ${props.class ?? ""}` }, children);
};
var ChatFooter = (props, children) => {
children === undefined && (children = props, props = {});
return S("div", { ...props, class: `chat-footer ${props.class ?? ""}` }, children);
};
var ChatBubble = (props, children) => {
children === undefined && (children = props, props = {});
return S("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) => S("input", { ...props, type: "checkbox", class: `checkbox ${props.class ?? ""}` });
// components/Colorpicker.js
var exports_Colorpicker = {};
__export(exports_Colorpicker, {
Colorpicker: () => Colorpicker
});
var Colorpicker = (props) => {
const isOpen = B(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 S("div", { class: `relative w-fit ${props.class ?? ""}` }, [
S("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
}, [
S("div", {
class: "size-5 rounded-sm shadow-inner border border-black/10 shrink-0",
style: () => `background-color: ${getColor()}`
}),
props.label ? S("span", { class: "opacity-80" }, props.label) : null
]),
J(isOpen, () => S("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()
}, [
S("div", { class: "grid grid-cols-8 gap-1" }, palette.map((c) => S("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);
}
})))
])),
J(isOpen, () => S("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 = B(false);
const isRangeMode = () => {
const r = typeof props.range === "function" ? props.range() : props.range;
return r === true;
};
const displayValue = B("");
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 S("div", { class: `relative w-full ${props.class ?? ""}` }, [
S("label", { class: "input input-bordered w-full", onclick: toggleOpen }, [
S("span", { class: "icon-[lucide--calendar]" }),
S("input", {
...props,
type: "text",
class: "grow",
value: displayValue,
readonly: true,
placeholder: props.placeholder || (isRangeMode() ? "Seleccionar rango..." : "Seleccionar fecha...")
})
]),
J(isOpen, () => S("div", {
class: "absolute left-0 mt-2 z-[100]",
onclick: (e) => e.stopPropagation()
}, [
Calendar({
value: props.value,
range: isRangeMode(),
hour: props.hour,
onChange: handleCalendarChange
})
])),
J(isOpen, () => S("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 S("div", { ...props, class: `drawer ${props.class ?? ""}` }, children);
};
var Sidebar = (props) => {
const id = props.id || `drawer-${Math.random().toString(36).slice(2, 9)}`;
return S("div", { ...props, class: `drawer ${props.class ?? ""}` }, [
S("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)
}),
S("div", { class: "drawer-content" }, props.children),
S("div", { class: "drawer-side" }, [
S("label", {
for: id,
class: "drawer-overlay",
onclick: () => typeof props.open === "function" && props.open(false)
}),
S("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) => S("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 S("div", { ...props, class: `fab ${props.class ?? ""}` }, children);
};
// components/Fieldset.js
var exports_Fieldset = {};
__export(exports_Fieldset, {
Fieldset: () => Fieldset
});
var Fieldset = (props, children) => S("fieldset", {
...props,
class: `fieldset ${props.class ?? ""}`
}, [
props.legend ? S("legend", { class: "fieldset-legend" }, props.legend) : null,
children
]);
// components/Fileinput.js
var exports_Fileinput = {};
__export(exports_Fileinput, {
Fileinput: () => Fileinput
});
var Fileinput = (props) => {
const selectedFiles = B([]);
const isDragging = B(false);
const error = B(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 S("div", { ...props, class: `fieldset w-full p-0 ${props.class ?? ""}` }, [
S("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);
}
}, [
S("div", { class: "flex items-center gap-3 w-full" }, [
S("span", { class: "icon-[lucide--upload]" }),
S("span", { class: "text-sm opacity-70 truncate grow text-left" }, "Arrastra o selecciona archivos..."),
S("span", { class: "text-[10px] opacity-40 shrink-0" }, `Máx ${props.max || 2}MB`)
]),
S("input", {
type: "file",
multiple: true,
accept: props.accept || "*",
class: "hidden",
onchange: (e) => handleFiles(e.target.files)
})
]),
() => error() && S("span", { class: "text-[10px] text-error mt-1 px-1 font-medium" }, error()),
J(() => selectedFiles().length > 0, () => S("ul", { class: "mt-2 space-y-1" }, [
K(selectedFiles, (file, idx) => S("li", { class: "flex items-center justify-between p-1.5 pl-3 text-xs bg-base-200/50 rounded-md border border-base-300" }, [
S("div", { class: "flex items-center gap-2 truncate" }, [
S("span", { class: "opacity-50" }, "\uD83D\uDCC4"),
S("span", { class: "truncate font-medium max-w-[200px]" }, file.name),
S("span", { class: "text-[9px] opacity-40" }, `(${(file.size / 1024).toFixed(0)} KB)`)
]),
S("button", {
type: "button",
class: "btn btn-ghost btn-xs btn-circle",
onclick: (e) => {
e.preventDefault();
removeFile(idx);
}
}, S("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 S("span", { class: props }, children);
}
return S("span", { class: "icon" }, props);
}
if (!props)
return null;
const { class: className, ...rest } = props;
return S("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 S("div", { ...props, class: `indicator ${props.class ?? ""}` }, [
props.value ? S("span", { class: `indicator-item badge ${props.class ?? ""}` }, props.value) : null,
children
]);
};
// components/Input.js
var exports_Input = {};
__export(exports_Input, {
InputLabel: () => InputLabel,
Input: () => Input
});
var Input = (props) => S("input", { ...props, class: `input ${props.class ?? ""}` });
var InputLabel = (props) => S("label", { class: `${props.float ? "floating-label" : "input"}` }, [
S("span", { class: props.float ? "" : "label opacity-50" }, props.label),
props.left ?? null,
S("input", { ...props, class: `${props.float ? "input" : ""} ${props.class ?? ""}` }),
props.right ?? null
]);
// components/Kdb.js
var exports_Kdb = {};
__export(exports_Kdb, {
Kbd: () => Kbd
});
var Kbd = (props, children) => {
children === undefined && (children = props, props = {});
return S("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 S("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 S("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 S("li", {}, [
S("details", {}, [
S("summary", {}, item.label),
S("ul", {}, MenuItems({ items: item.children }))
])
]);
}
return S("li", {}, S("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 S("dialog", {
...props,
ref: (el) => dialogRef = el,
class: `modal ${props.class ?? ""}`,
onclose: close,
oncancel: close
}, [
S("div", { class: "modal-box" }, [
props.title && S("h3", { class: "text-lg font-bold" }, props.title),
props.children,
S("div", { class: "modal-action" }, [
props.actions || S("button", { class: "btn", onclick: close }, "Cerrar")
])
]),
S("form", { method: "dialog", class: "modal-backdrop" }, [
S("button", {}, "close")
])
]);
};
// components/Navbar.js
var exports_Navbar = {};
__export(exports_Navbar, {
Navbar: () => Navbar
});
var Navbar = (props, children) => {
children === undefined && (children = props, props = {});
return S("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 S("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) => S("input", { ...props, type: "radio", class: `radio ${props.class ?? ""}` });
// components/Range.js
var exports_Range = {};
__export(exports_Range, {
Range: () => Range
});
var Range = (props) => S("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 S("div", { ...props, class: `rating ${props.class ?? ""}` }, children || Array.from({ length: props.count || 5 }, (_2, i) => {
const starValue = i + 1;
return S("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) => S("div", { ...props, class: `skeleton ${props.class ?? ""}` });
var SkeletonText = (props) => {
return S("div", { ...props, class: "space-y-2" }, Array.from({ length: props.lines || 3 }, () => S("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 S("select", { ...props, class: `select ${props.class ?? ""}` }, children);
};
var SelectItems = (props) => {
const placeholderOption = props.placeholder ? S("option", { disabled: props.placeholderDisabled ?? true, selected: true }, props.placeholder) : null;
const dynamicOptions = K(() => [...typeof props.items === "function" ? props.items() : props.items || []], (item) => {
const val2 = typeof item === "string" ? item : item.value;
const label = typeof item === "string" ? item : item.label;
return S("option", { value: val2 }, label);
}, props.keyFn || ((item) => typeof item === "string" ? item : item.value));
return placeholderOption ? [placeholderOption, dynamicOptions] : dynamicOptions;
};
var SelectLabel = (props, children) => S("label", { class: `${props.float ? "floating-label" : "select"}` }, [
S("span", { class: props.float ? "" : "label opacity-50" }, props.label),
props.left ?? null,
S("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 S("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 S("div", { ...props, class: `stats ${direction} ${props.class ?? ""}`.trim() }, children);
};
var Stat = (props, children) => {
children === undefined && (children = props, props = {});
return S("div", { ...props, class: `stat ${props.class ?? ""}` }, [
props.icon && S("div", { class: "stat-figure" }, props.icon),
props.label && S("div", { class: "stat-title" }, props.label),
props.value && S("div", { class: "stat-value" }, props.value),
props.desc && S("div", { class: "stat-desc" }, props.desc),
props.actions && S("div", { class: "stat-actions" }, props.actions),
children
]);
};
// components/Swap.js
var exports_Swap = {};
__export(exports_Swap, {
Swap: () => Swap
});
var Swap = (props) => {
return S("label", { ...props, class: `swap ${props.class ?? ""}` }, [
S("input", {
type: "checkbox",
checked: () => typeof props.value === "function" ? props.value() : props.value,
onchange: (e) => typeof props.value === "function" && props.value(e.target.checked)
}),
S("div", { class: "swap-on" }, props.on),
S("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 S("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) ? S("thead", {}, S("tr", {}, props.columns.map((col) => S("th", { class: col.class }, col.label)))) : null;
const tbody = S("tbody", {}, [
K(itemArray, (item, idx) => S("tr", {}, props.columns.map((col) => {
const content = col.render ? col.render(item, idx) : item[col.key];
return S("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 S("div", { ...props, class: `tabs ${props.class ?? ""}` }, children);
};
var Tab = (props, children) => {
children === undefined && (children = props, props = {});
return S("a", { ...props, role: "tab", class: `tab ${props.class ?? ""}` }, children);
};
var TabContent = (props, children) => {
children === undefined && (children = props, props = {});
return S("div", { ...props, class: `tab-content ${props.class ?? ""}` }, children);
};
var TabClose = (props) => S("a", { ...props, role: "tab", class: `tab ${props.class ?? ""}` }, [
S("span", { class: "flex items-center" }, [
props.label,
S("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) => S("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 S("span", { ...props, class: `text-rotate ${props.class ?? ""}` }, [
S("span", {}, wordsArray.map((word) => S("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 S("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 = S("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 = S("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 = S("span", { class: "icon-[lucide--x]" });
const closeBtn = S("button", {
class: "btn btn-xs btn-circle btn-ghost",
onclick: close
}, closeIcon);
const alertDiv = S("div", {
class: `alert alert-soft ${type} shadow-lg transition-all duration-300 translate-x-10 opacity-0 pointer-events-auto`
}, [
S("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 S("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 = B("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_Kdb,
...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");
}
})();